lustrec / src / options.ml @ b38ffff3
History | View | Annotate | Download (3.9 KB)
1 |
(********************************************************************) |
---|---|
2 |
(* *) |
3 |
(* The LustreC compiler toolset / The LustreC Development Team *) |
4 |
(* Copyright 2012 - -- ONERA - CNRS - INPT *) |
5 |
(* *) |
6 |
(* LustreC is free software, distributed WITHOUT ANY WARRANTY *) |
7 |
(* under the terms of the GNU Lesser General Public License *) |
8 |
(* version 2.1. *) |
9 |
(* *) |
10 |
(********************************************************************) |
11 |
|
12 |
let version = "0.1-"^Version.number |
13 |
let main_node = ref "" |
14 |
let static_mem = ref true |
15 |
let print_types = ref true |
16 |
let print_clocks = ref true |
17 |
let delay_calculus = ref true |
18 |
let track_exceptions = ref true |
19 |
let ansi = ref false |
20 |
let check = ref false |
21 |
let spec = ref "acsl" |
22 |
let output = ref "C" |
23 |
let dest_dir = ref "." |
24 |
let verbose_level = ref 1 |
25 |
let global_inline = ref false |
26 |
let witnesses = ref false |
27 |
let optimization = ref 2 |
28 |
|
29 |
let horntraces = ref false |
30 |
let horn_cex = ref false |
31 |
let horn_queries = ref false |
32 |
|
33 |
let options = |
34 |
[ "-d", Arg.Set_string dest_dir, |
35 |
"produces code in the specified directory (default: .)"; |
36 |
"-node", Arg.Set_string main_node, "specifies the main node"; |
37 |
"-init", Arg.Set delay_calculus, "performs an initialisation analysis for Lustre nodes"; |
38 |
"-dynamic", Arg.Clear static_mem, "specifies a dynamic allocation scheme for main Lustre node (default: static)"; |
39 |
"-ansi", Arg.Set ansi, "specifies that generated C code is ansi C90 compliant (default: C99)"; |
40 |
"-check-access", Arg.Set check, "checks at runtime that array accesses always lie within bounds (default: no check)"; |
41 |
|
42 |
"-no-spec", Arg.Unit (fun () -> spec := "no"), "do not generate any specification"; |
43 |
"-acsl-spec", Arg.Unit (fun () -> spec := "acsl"), "generates an ACSL encoding of the specification. Only meaningful for the C backend (default)"; |
44 |
"-c-spec", Arg.Unit (fun () -> spec := "c"), "generates a C encoding of the specification instead of ACSL contracts and annotations. Only meaningful for the C backend"; |
45 |
"-java", Arg.Unit (fun () -> output := "java"), "generates Java output instead of C"; |
46 |
"-horn", Arg.Unit (fun () -> output := "horn"), "generates Horn clauses encoding output instead of C"; |
47 |
"-horn-traces", Arg.Unit (fun () -> output := "horn"; horntraces:=true), "produce traceability file for Horn backend. Enable the horn backend."; |
48 |
"-horn-cex", Arg.Unit (fun () -> output := "horn"; horn_cex:=true), "generate cex enumeration. Enable the horn backend (work in progress)"; |
49 |
"-horn-queries", Arg.Unit (fun () -> output := "horn"; horn_queries:=true), "generate queries in generated Horn file. Enable the horn backend (work in progress)"; |
50 |
"-lustre", Arg.Unit (fun () -> output := "lustre"), "generates Lustre output, performing all active optimizations"; |
51 |
"-inline", Arg.Set global_inline, "inline all node calls (require a main node)"; |
52 |
"-witnesses", Arg.Set witnesses, "enable production of witnesses during compilation"; |
53 |
"-print_types", Arg.Set print_types, "prints node types"; |
54 |
"-print_clocks", Arg.Set print_clocks, "prints node clocks"; |
55 |
"-O", Arg.Set_int optimization, " changes optimization level <default: 2>"; |
56 |
"-verbose", Arg.Set_int verbose_level, " changes verbose level <default: 1>"; |
57 |
"-version", Arg.Unit (fun () -> print_endline version), " displays the version";] |
58 |
|
59 |
let get_witness_dir filename = |
60 |
(* Make sure the directory exists *) |
61 |
let dir = !dest_dir ^ "/" ^ (Filename.basename filename) ^ "_witnesses" in |
62 |
let _ = try |
63 |
if not (Sys.is_directory dir) then ( |
64 |
Format.eprintf "File of name %s exists. It should be a directory.@." dir; |
65 |
exit 1 |
66 |
) |
67 |
with Sys_error _ -> Unix.mkdir dir 0o750 |
68 |
in |
69 |
dir |
70 |
|
71 |
(* Local Variables: *) |
72 |
(* compile-command:"make -C .." *) |
73 |
(* End: *) |