Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / options.ml @ 54d032f5

History | View | Annotate | Download (4.1 KB)

1 a2d97a3e ploc
(********************************************************************)
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 22fe1c93 ploc
12 0777a7be ploc
let version = "0.1-"^Version.number
13 22fe1c93 ploc
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 d4107cf2 ploc
let spec = ref "acsl"
22 3ee1012f ploc
let output = ref "C"
23 7291cb80 xthirioux
let dest_dir = ref "."
24 22fe1c93 ploc
let verbose_level = ref 1
25 e2380d4d ploc
let global_inline = ref false
26
let witnesses = ref false
27 c1adf235 ploc
let optimization = ref 2
28 ed81df06 xthirioux
let lusi = ref false
29 a2d97a3e ploc
30 af5af1e8 ploc
let horntraces = ref false
31 43aa67ec tkahsai
let horn_cex = ref false
32 a2d97a3e ploc
let horn_queries = ref false
33 22fe1c93 ploc
34
let options =
35
  [ "-d", Arg.Set_string dest_dir,
36 9603460e xthirioux
    "uses the specified directory as root for generated/imported object and C files (default: .)";
37 22fe1c93 ploc
    "-node", Arg.Set_string main_node, "specifies the main node";
38 ed81df06 xthirioux
    "-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 d4107cf2 ploc
    "-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 3ee1012f ploc
    "-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 af5af1e8 ploc
    "-horn-traces", Arg.Unit (fun () -> output := "horn"; horntraces:=true), "produce traceability file for Horn backend. Enable the horn backend.";
49 a2d97a3e ploc
    "-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 c1adf235 ploc
    "-lustre", Arg.Unit (fun () -> output := "lustre"), "generates Lustre output, performing all active optimizations";
52 e2380d4d ploc
    "-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 22fe1c93 ploc
    "-print_types", Arg.Set print_types, "prints node types";
55
    "-print_clocks", Arg.Set print_clocks, "prints node clocks";
56 c1adf235 ploc
    "-O", Arg.Set_int optimization, " changes optimization level <default: 2>";
57 22fe1c93 ploc
    "-verbose", Arg.Set_int verbose_level, " changes verbose level <default: 1>";
58
    "-version", Arg.Unit (fun () -> print_endline version), " displays the version";]
59
60 592f508c ploc
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 43aa67ec tkahsai
  dir
71 22fe1c93 ploc
72
(* Local Variables: *)
73
(* compile-command:"make -C .." *)
74
(* End: *)