source: Deliverables/D2.3/8051-memoryspaces-branch/src/options.ml @ 459

Last change on this file since 459 was 453, checked in by ayache, 9 years ago

Import of the Paris's sources.

File size: 2.2 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 annotation_flag             = ref false
31let request_annotation          = (:=) annotation_flag
32let annotation_requested ()     = !annotation_flag
33
34let interpretation_flag         = ref false
35let request_interpretation      = (:=) interpretation_flag
36let interpretation_requested () = !interpretation_flag
37
38let debug_flag                  = ref false
39let set_debug                   = (:=) debug_flag
40let is_debug_enabled ()         = !debug_flag
41
42let dev_test                    = ref false
43let set_dev_test                = (:=) dev_test
44let is_dev_test_enabled ()      = !dev_test
45
46let options = OptionsParsing.register [
47  "-s", Arg.String set_source_language,
48  " Choose the source language between:";
49  extra_doc " Clight, Cminor";
50  extra_doc " [default is C]";
51
52  "-l", Arg.String set_target_language,
53  " Choose the target language between:";
54  extra_doc " Clight, Cminor, RTLabs, RTL, ERTL, LTL, LIN, ASM";
55  extra_doc " [default is ASM]";
56
57  "-a", Arg.Set annotation_flag,
58  " Add cost annotations on the source code.";
59
60  "-i", Arg.Set interpretation_flag,
61  " Interpret the compiled code.";
62
63  "-d", Arg.Set debug_flag,
64  " Debugging mode.";
65
66  "-dev", Arg.Set dev_test,
67  " Playground for developers.";
68]
Note: See TracBrowser for help on using the repository browser.