source: driver/options.ml @ 3005

Last change on this file since 3005 was 3005, checked in by sacerdot, 7 years ago

Beginning of making it fully compatible with untrusted one.

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