Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates versions and switches to new setup-ocaml action #44

Merged
merged 3 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
uses: actions/checkout@v2

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
uses: ocaml/setup-ocaml@v2
with:
ocaml-version: ${{ matrix.ocaml-version }}
ocaml-compiler: ${{ matrix.ocaml-version }}

- run: opam pin add FrontC . --no-action
- run: opam install FrontC --deps-only
Expand Down
2 changes: 1 addition & 1 deletion FrontC.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "4.0.0"
version: "4.1.0"
synopsis: "Parses C programs to an abstract syntax tree"
description:
"FrontC provides a C parser and an OCaml definition of an abstract syntax treee for the C language. It also includes AST pretty-printers in plain and XML formats."
Expand Down
4 changes: 2 additions & 2 deletions calipso.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "4.0.0"
version: "4.1.0"
synopsis: "Rewrites C programs to remove non-structured control-flow"
description:
"Calipso analyzes programs in order to replace all nonstructured instructions (i.e., break, return, switch...) by branches and, then, remove all branches. See https://dblp.org/rec/journals/tsi/CasseFRS02 for more details"
Expand All @@ -12,7 +12,7 @@ homepage: "https://github.com/BinaryAnalysisPlatform/FrontC"
bug-reports: "https://github.com/BinaryAnalysisPlatform/FrontC/issues"
depends: [
"dune" {>= "2.7"}
"FrontC" {>= "4.0.0"}
"FrontC" {>= "4.1.0"}
"odoc" {with-doc}
]
build: [
Expand Down
2 changes: 1 addition & 1 deletion calipso/calipso.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exception ParsingError


(* Useful Data *)
let version = "Calipso V4.0 Hugues Cass�."
let version = "Calipso v4.1 Hugues Cass�."
let help = version ^ "\n" ^ "calipso [-hmPtsVv] [-r[bcfgkrs]] [-s[lrw]] [-p preprocessor] <file list> [-o <output file>]"
exception InternalError

Expand Down
2 changes: 1 addition & 1 deletion calipso/stat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let display_stats _ =


(* Useful Data *)
let version = "stat V4.0 Hugues Cass� et al."
let version = "stat v4.1 Hugues Cass� et al."
let help = version ^ "\n" ^ "stat [-hPtVv] [-r[bcfgkrs]] [-p preprocessor] <file list>"
exception InternalError

Expand Down
4 changes: 2 additions & 2 deletions ctoxml.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "4.0.0"
version: "4.1.0"
synopsis: "Parses a C program into Cabs AST and dumps as an XML document"
maintainer: ["Ivan Gotovchits <ivg@ieee.org>"]
authors: ["Hugues Cassé <casse@irit.fr> et al"]
Expand All @@ -10,7 +10,7 @@ homepage: "https://github.com/BinaryAnalysisPlatform/FrontC"
bug-reports: "https://github.com/BinaryAnalysisPlatform/FrontC/issues"
depends: [
"dune" {>= "2.7"}
"FrontC" {>= "4.0.0"}
"FrontC" {>= "4.1.0"}
"odoc" {with-doc}
]
build: [
Expand Down
90 changes: 44 additions & 46 deletions ctoxml/ctoxml_bin.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(*
(*
* $Id$
* Copyright (c) 2003, Hugues Cass� <hugues.casse@laposte.net>
*
Expand All @@ -10,10 +10,10 @@ open Frontc

(* Options *)
let banner =
"ctoxml V1.0 (02/14/04)\n" ^
"Copyright (c) 2004, Hugues Cass� <hugues.casse@laposte.net>\n\n" ^
"SYNTAX:\tctoxml [options] files...\n" ^
"\tctoxml [options] --\n"
"ctoxml v4.1\n" ^
"Copyright (c) 2004-2021, Hugues Cass� <hugues.casse@laposte.net> et al\n\n" ^
"SYNTAX:\tctoxml [options] files...\n" ^
"\tctoxml [options] --\n"
let args: parsing_arg list ref = ref []
let files: string list ref = ref []
let out_file = ref ""
Expand All @@ -22,55 +22,53 @@ let from_stdin = ref false

(* Options scanning *)
let opts = [
("-o", Arg.Set_string out_file,
"Output to the given file.");
("-pp", Arg.Unit (fun _ -> args := USE_CPP :: !args),
"Preprocess the input files.");
("-nogcc", Arg.Unit (fun _ -> args := (GCC_SUPPORT false) :: !args),
"Do not use the GCC extensions.");
("-proc", Arg.String (fun cpp -> args := (PREPROC cpp) :: !args),
"Use the given preprocessor");
("-i", Arg.String (fun file -> args := (INCLUDE file) :: !args),
"Include the given file.");
("-I", Arg.String (fun dir -> args := (INCLUDE_DIR dir) :: !args),
"Include retrieval directory");
("-D", Arg.String (fun def -> args := (DEF def) :: !args),
"Pass this definition to the preprocessor.");
("-U", Arg.String (fun undef -> args := (UNDEF undef) :: !args),
"Pass this undefinition to the preprocessor.");
("--", Arg.Set from_stdin,
"Takes input from standard input.");
("-o", Arg.Set_string out_file,
"Output to the given file.");
("-pp", Arg.Unit (fun _ -> args := USE_CPP :: !args),
"Preprocess the input files.");
("-nogcc", Arg.Unit (fun _ -> args := (GCC_SUPPORT false) :: !args),
"Do not use the GCC extensions.");
("-proc", Arg.String (fun cpp -> args := (PREPROC cpp) :: !args),
"Use the given preprocessor");
("-i", Arg.String (fun file -> args := (INCLUDE file) :: !args),
"Include the given file.");
("-I", Arg.String (fun dir -> args := (INCLUDE_DIR dir) :: !args),
"Include retrieval directory");
("-D", Arg.String (fun def -> args := (DEF def) :: !args),
"Pass this definition to the preprocessor.");
("-U", Arg.String (fun undef -> args := (UNDEF undef) :: !args),
"Pass this undefinition to the preprocessor.");
("--", Arg.Set from_stdin,
"Takes input from standard input.");
]


(* Main Program *)
let _ =

(* Parse arguments *)
Arg.parse opts (fun file -> files := file :: !files) banner;
(* Parse arguments *)
Arg.parse opts (fun file -> files := file :: !files) banner;

(* Get the output *)
let (output, close) =
if !out_file = "" then (stdout,false)
else ((open_out !out_file), true) in

(* Get the output *)
let (output, close) =
if !out_file = "" then (stdout,false)
else ((open_out !out_file), true) in

(* Process the input *)
let process opts =
match Frontc.parse opts with
PARSING_ERROR -> ()
| PARSING_OK file ->
let doc = Frontc.convert_to_xml file in
Cxml.output_doc output doc in

(* Process the inputs *)
let _ =
if !from_stdin || !files = []
then process !args
else
List.iter (fun file -> process ((FROM_FILE file) :: !args)) !files in
(* Process the input *)
let process opts =
match Frontc.parse opts with
PARSING_ERROR -> ()
| PARSING_OK file ->
let doc = Frontc.convert_to_xml file in
Cxml.output_doc output doc in

(* Close the output if needed *)
if close then close_out output
(* Process the inputs *)
let _ =
if !from_stdin || !files = []
then process !args
else
List.iter (fun file -> process ((FROM_FILE file) :: !args)) !files in


(* Close the output if needed *)
if close then close_out output
6 changes: 3 additions & 3 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(lang dune 2.7)
(using menhir 2.0)
(cram enable)
(version 4.0.0)
(version 4.1.0)
(name FrontC)

(license LGPL-2.0-only)
Expand All @@ -28,13 +28,13 @@
nonstructured instructions (i.e., break, return, switch...) \
by branches and, then, remove all branches. \
See https://dblp.org/rec/journals/tsi/CasseFRS02 for more details" )
(depends (FrontC (>= 4.0.0)))
(depends (FrontC (>= 4.1.0)))
(tags (FrontC C analysis)))

(package
(name ctoxml)
(synopsis "Parses a C program into Cabs AST and dumps as an XML document")
(depends (FrontC (>= 4.0.0)))
(depends (FrontC (>= 4.1.0)))
(tags (FrontC C parser XML)))

(generate_opam_files true)
19 changes: 2 additions & 17 deletions frontc/clexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,8 @@
**
** Project: FrontC
** File: frontc.mll
** Version: 1.0e
** Date: 9.1.99
** Author: Hugues Cass�
**
** 1.0 3.22.99 Hugues Cass� First version.
** a 4.19.99 Hugues Cass� Now accept floating notation `<int part>.'.
** b 4.26.99 Hugues Cass� Correctly handle the # <lineno> <file> ...
** directive. Previous bug was taking last
** integer of the line as line number.
** c 6.4.99 Hugues Cass� Added context handling to manage local variables
** and type definition with the same name.
** d 8.26.99 Hugues Cass� Now, manage escape sequences in string and
** characters.
** e 9.1.99 Hugues Cass� Fix, '\0' now recognized.
** f 10.8.99 Hugues Cass� Understand "__const" GCC.
** 1.1 04.150.05 Hugues Cass� Added support for __XXX__ GNU attributes.
** Added "restrict" keyword.
** Version: 4.1
** Author: Hugues Cass� et al
*)
{
open Ctokens
Expand Down
4 changes: 2 additions & 2 deletions printc/printc_bin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ open Frontc

(* Options *)
let banner =
"printc V4.0\n" ^
"Copyright (c) 2007, Hugues Cass� <hugues.casse@laposte.net> et al.\n\n" ^
"printc v4.1\n" ^
"Copyright (c) 2007-2021, Hugues Cass� <hugues.casse@laposte.net> et al.\n\n" ^
"SYNTAX:\tprintc [options] files...\n" ^
"\tprintc [options] --\n"
let args: parsing_arg list ref = ref []
Expand Down