Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / options.ml @ 7dedc5f0

History | View | Annotate | Download (4.06 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
let lusi = ref false
29

    
30
let horntraces = ref false
31
let horn_cex = ref false
32
let horn_queries = ref false
33

    
34
let options =
35
  [ "-d", Arg.Set_string dest_dir,
36
    "produces code in the specified directory (default: .)";
37
    "-node", Arg.Set_string main_node, "specifies the main node";
38
    "-init", Arg.Set delay_calculus, "performs an initialisation analysis for Lustre nodes <default: no analysis>";
39
    "-dynamic", Arg.Clear static_mem, "specifies a dynamic allocation scheme for main Lustre node <default: static>";
40
    "-ansi", Arg.Set ansi, "specifies that generated C code is ansi C90 compliant <default: C99>";
41
    "-check-access", Arg.Set check, "checks at runtime that array accesses always lie within bounds <default: no check>";
42
    "-lusi", Arg.Set lusi, "only generates a .lusi interface source file from a Lustre source <default: no generation>";
43
    "-no-spec", Arg.Unit (fun () -> spec := "no"), "do not generate any specification";
44
    "-acsl-spec", Arg.Unit (fun () -> spec := "acsl"), "generates an ACSL encoding of the specification. Only meaningful for the C backend (default)";
45
    "-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";
46
    "-java", Arg.Unit (fun () -> output := "java"), "generates Java output instead of C";
47
    "-horn", Arg.Unit (fun () -> output := "horn"), "generates Horn clauses encoding output instead of C";
48
    "-horn-traces", Arg.Unit (fun () -> output := "horn"; horntraces:=true), "produce traceability file for Horn backend. Enable the horn backend.";
49
    "-horn-cex", Arg.Unit (fun () -> output := "horn"; horn_cex:=true), "generate cex enumeration. Enable the horn backend (work in progress)";
50
    "-horn-queries", Arg.Unit (fun () -> output := "horn"; horn_queries:=true), "generate queries in generated Horn file. Enable the horn backend (work in progress)";
51
    "-lustre", Arg.Unit (fun () -> output := "lustre"), "generates Lustre output, performing all active optimizations";
52
    "-inline", Arg.Set global_inline, "inline all node calls (require a main node)";
53
    "-witnesses", Arg.Set witnesses, "enable production of witnesses during compilation";
54
    "-print_types", Arg.Set print_types, "prints node types";
55
    "-print_clocks", Arg.Set print_clocks, "prints node clocks";
56
    "-O", Arg.Set_int optimization, " changes optimization level <default: 2>";
57
    "-verbose", Arg.Set_int verbose_level, " changes verbose level <default: 1>";
58
    "-version", Arg.Unit (fun () -> print_endline version), " displays the version";]
59

    
60
let get_witness_dir filename =
61
  (* Make sure the directory exists *)
62
  let dir = !dest_dir ^ "/" ^ (Filename.basename filename) ^ "_witnesses" in
63
  let _ = try
64
	    if not (Sys.is_directory dir) then (
65
	      Format.eprintf "File of name %s exists. It should be a directory.@." dir;
66
	      exit 1
67
	    )
68
    with Sys_error _ -> Unix.mkdir dir 0o750
69
  in
70
  dir
71

    
72
(* Local Variables: *)
73
(* compile-command:"make -C .." *)
74
(* End: *)