1 |
22fe1c93
|
ploc
|
(* ----------------------------------------------------------------------------
|
2 |
|
|
* SchedMCore - A MultiCore Scheduling Framework
|
3 |
|
|
* Copyright (C) 2009-2011, ONERA, Toulouse, FRANCE - LIFL, Lille, FRANCE
|
4 |
|
|
*
|
5 |
|
|
* This file is part of Prelude
|
6 |
|
|
*
|
7 |
|
|
* Prelude is free software; you can redistribute it and/or
|
8 |
|
|
* modify it under the terms of the GNU Lesser General Public License
|
9 |
|
|
* as published by the Free Software Foundation ; either version 2 of
|
10 |
|
|
* the License, or (at your option) any later version.
|
11 |
|
|
*
|
12 |
|
|
* Prelude is distributed in the hope that it will be useful, but
|
13 |
|
|
* WITHOUT ANY WARRANTY ; without even the implied warranty of
|
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
|
|
* Lesser General Public License for more details.
|
16 |
|
|
*
|
17 |
|
|
* You should have received a copy of the GNU Lesser General Public
|
18 |
|
|
* License along with this program ; if not, write to the Free Software
|
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
20 |
|
|
* USA
|
21 |
|
|
*---------------------------------------------------------------------------- *)
|
22 |
|
|
|
23 |
0777a7be
|
ploc
|
let version = "0.1-"^Version.number
|
24 |
22fe1c93
|
ploc
|
let main_node = ref ""
|
25 |
|
|
let static_mem = ref true
|
26 |
|
|
let print_types = ref true
|
27 |
|
|
let print_clocks = ref true
|
28 |
|
|
let delay_calculus = ref true
|
29 |
|
|
let track_exceptions = ref true
|
30 |
|
|
let ansi = ref false
|
31 |
|
|
let check = ref false
|
32 |
|
|
let c_spec = ref false
|
33 |
3ee1012f
|
ploc
|
let output = ref "C"
|
34 |
7291cb80
|
xthirioux
|
let dest_dir = ref "."
|
35 |
22fe1c93
|
ploc
|
let verbose_level = ref 1
|
36 |
e2380d4d
|
ploc
|
let global_inline = ref false
|
37 |
|
|
let witnesses = ref false
|
38 |
22fe1c93
|
ploc
|
|
39 |
|
|
let options =
|
40 |
|
|
[ "-d", Arg.Set_string dest_dir,
|
41 |
7291cb80
|
xthirioux
|
"produces code in the specified directory (default: .)";
|
42 |
22fe1c93
|
ploc
|
"-node", Arg.Set_string main_node, "specifies the main node";
|
43 |
|
|
"-init", Arg.Set delay_calculus, "performs an initialisation analysis for Lustre nodes";
|
44 |
|
|
"-dynamic", Arg.Clear static_mem, "specifies a dynamic allocation scheme for main Lustre node (default: static)";
|
45 |
7291cb80
|
xthirioux
|
"-ansi", Arg.Set ansi, "specifies that generated C code is ansi C90 compliant (default: C99)";
|
46 |
22fe1c93
|
ploc
|
"-check-access", Arg.Set check, "checks at runtime that array accesses always lie within bounds (default: no check)";
|
47 |
|
|
"-c-spec", Arg.Set c_spec,
|
48 |
|
|
"generates a C encoding of the specification instead of ACSL contracts and annotations. Only meaningful for the C backend";
|
49 |
3ee1012f
|
ploc
|
"-java", Arg.Unit (fun () -> output := "java"), "generates Java output instead of C";
|
50 |
|
|
"-horn", Arg.Unit (fun () -> output := "horn"), "generates Horn clauses encoding output instead of C";
|
51 |
e2380d4d
|
ploc
|
"-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 |
22fe1c93
|
ploc
|
"-print_types", Arg.Set print_types, "prints node types";
|
54 |
|
|
"-print_clocks", Arg.Set print_clocks, "prints node clocks";
|
55 |
|
|
"-verbose", Arg.Set_int verbose_level, " changes verbose level <default: 1>";
|
56 |
|
|
"-version", Arg.Unit (fun () -> print_endline version), " displays the version";]
|
57 |
|
|
|
58 |
592f508c
|
ploc
|
let get_witness_dir filename =
|
59 |
|
|
(* Make sure the directory exists *)
|
60 |
|
|
let dir = !dest_dir ^ "/" ^ (Filename.basename filename) ^ "_witnesses" in
|
61 |
|
|
let _ = try
|
62 |
|
|
if not (Sys.is_directory dir) then (
|
63 |
|
|
Format.eprintf "File of name %s exists. It should be a directory.@." dir;
|
64 |
|
|
exit 1
|
65 |
|
|
)
|
66 |
|
|
with Sys_error _ -> Unix.mkdir dir 0o750
|
67 |
|
|
in
|
68 |
|
|
dir
|
69 |
22fe1c93
|
ploc
|
|
70 |
|
|
(* Local Variables: *)
|
71 |
|
|
(* compile-command:"make -C .." *)
|
72 |
|
|
(* End: *)
|