source: Deliverables/D2.2/8051/src/options.ml @ 1491

Last change on this file since 1491 was 1462, checked in by ayache, 9 years ago

Added D5.1: Frama-C plug-in and Lustre wrapper. D2.2 (8051) has been updated accordingly.

File size: 5.0 KB
Line 
1open Misc.ArgExt
2
3let default_choice       = "default"
4let option_settings_step = "during option settings"
5
6let language_from_string kind default s =
7  try 
8    Languages.from_string s
9  with Not_found -> 
10    if s = default_choice then 
11      default
12    else 
13      Error.global_error option_settings_step
14        (Printf.sprintf "`%s' is not a valid %s language." s kind)
15 
16let source_language_of_string   = language_from_string "source" Languages.Clight
17let source_language             = ref (source_language_of_string default_choice)
18let set_source_language s       = source_language := source_language_of_string s
19let get_source_language ()      = !source_language
20
21let target_language_of_string   = language_from_string "target" Languages.ASM
22let target_language             = ref (target_language_of_string default_choice)
23let set_target_language s       = target_language := target_language_of_string s
24let get_target_language ()      = !target_language
25
26let input_files                 = ref []
27let add_input_file f            = input_files := f :: !input_files
28let input_files ()              = !input_files
29
30let output_files                = ref None
31let set_output_files s          = output_files := Some s
32let get_output_files ()         = !output_files
33
34let annotation_flag             = ref false
35let request_annotation          = (:=) annotation_flag
36let annotation_requested ()     = !annotation_flag
37
38let interpretation_flag         = ref false
39let request_interpretation      = (:=) interpretation_flag
40let interpretation_requested () = !interpretation_flag
41
42let interpretations_flag         = ref false
43let request_interpretations      = (:=) interpretations_flag
44let interpretations_requested () = !interpretations_flag
45
46let debug_flag                  = ref false
47let set_debug                   = (:=) debug_flag
48let is_debug_enabled ()         = !debug_flag
49
50let asm_pretty_flag             = ref false
51let set_asm_pretty              = (:=) asm_pretty_flag
52let is_asm_pretty ()            = !asm_pretty_flag
53
54let lustre_flag                 = ref false
55let set_lustre_file             = (:=) lustre_flag
56let is_lustre_file ()           = !lustre_flag
57
58let remove_lustre_externals       = ref false
59let set_remove_lustre_externals   = (:=) remove_lustre_externals
60let is_remove_lustre_externals () = !remove_lustre_externals
61
62let lustre_test                 = ref None
63let set_lustre_test s           = lustre_test := Some s
64let get_lustre_test ()          = !lustre_test
65
66let lustre_test_cases           = ref 100
67let set_lustre_test_cases       = (:=) lustre_test_cases
68let get_lustre_test_cases ()    = !lustre_test_cases
69
70let lustre_test_cycles          = ref 100
71let set_lustre_test_cycles      = (:=) lustre_test_cycles
72let get_lustre_test_cycles ()   = !lustre_test_cycles
73
74let lustre_test_min_int         = ref (-1000)
75let set_lustre_test_min_int     = (:=) lustre_test_min_int
76let get_lustre_test_min_int ()  = !lustre_test_min_int
77
78let lustre_test_max_int         = ref 1000
79let set_lustre_test_max_int     = (:=) lustre_test_max_int
80let get_lustre_test_max_int ()  = !lustre_test_max_int
81
82(*
83let print_result_flag           = ref false
84let set_print_result            = (:=) print_result_flag
85let is_print_result_enabled ()  = !print_result_flag
86*)
87
88let dev_test                    = ref false
89let set_dev_test                = (:=) dev_test
90let is_dev_test_enabled ()      = !dev_test
91
92let options = OptionsParsing.register [
93(*
94  "-s", Arg.String set_source_language,
95  " Choose the source language between:";
96  extra_doc " Clight, Cminor";
97  extra_doc " [default is C]";
98*)
99
100  "-l", Arg.String set_target_language,
101  " Choose the target language between:";
102  extra_doc " Clight, Cminor, RTLabs, RTL, ERTL, LTL, LIN, ASM";
103  extra_doc " [default is ASM]";
104
105  "-a", Arg.Set annotation_flag,
106  " Add cost annotations on the source code.";
107
108  "-i", Arg.Set interpretation_flag,
109  " Interpret the compiled code.";
110
111  "-is", Arg.Set interpretations_flag,
112  " Interpret all the compilation passes.";
113
114  "-d", Arg.Set debug_flag,
115  " Debugging mode.";
116
117  "-o", Arg.String set_output_files,
118  " Prefix of the output files.";
119
120  "-asm-pretty", Arg.Set asm_pretty_flag,
121  " Output a pretty-printed assembly file.";
122
123  "-lustre", Arg.Set lustre_flag,
124  " Input file is a Lustre file.";
125
126  "-remove-lustre-externals", Arg.Set remove_lustre_externals,
127  " Remove Lustre externals.";
128
129  "-lustre-test", Arg.String set_lustre_test,
130  " Input file is a Lustre file, testing requested.";
131
132  "-lustre-test-cases", Arg.Int set_lustre_test_cases,
133  " Set the number of test cases when testing a Lustre";
134  extra_doc " file.";
135  extra_doc " [default is 100]";
136
137  "-lustre-test-cycles", Arg.Int set_lustre_test_cycles,
138  " Set the number of cycles for each case when testing";
139  extra_doc " a Lustre file.";
140  extra_doc " [default is 100]";
141
142  "-lustre-test-min-int", Arg.Int set_lustre_test_min_int,
143  " Random int minimum value when testing a Lustre file.";
144  extra_doc " [default is -1000]";
145
146  "-lustre-test-max-int", Arg.Int set_lustre_test_max_int,
147  " Random int maximum value when testing a Lustre file.";
148  extra_doc " [default is 1000]";
149
150(*
151  "-res", Arg.Set print_result_flag,
152  " Print the result of interpretations.";
153*)
154
155  "-dev", Arg.Set dev_test,
156  " Playground for developers.";
157]
Note: See TracBrowser for help on using the repository browser.