From a4c3d9e8563f0bfc7f6222787997667dd712beb0 Mon Sep 17 00:00:00 2001 From: Adrien Guatto Date: Thu, 30 Sep 2010 21:40:04 +0200 Subject: [PATCH] Relevant command-line options are now stored as qualnames. --- compiler/main/heptc.ml | 7 ++++--- compiler/obc/c/cmain.ml | 6 +++--- compiler/utilities/global/compiler_options.ml | 9 +++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/compiler/main/heptc.ml b/compiler/main/heptc.ml index 5830f4a..ec22e06 100644 --- a/compiler/main/heptc.ml +++ b/compiler/main/heptc.ml @@ -64,6 +64,7 @@ let compile_impl modname filename = with x -> close_all_files (); raise x +let read_qualname f = Arg.String (fun s -> f (Names.qualname_of_string s)) let main () = try @@ -76,10 +77,10 @@ let main () = "-where", Arg.Unit locate_stdlib, doc_locate_stdlib; "-stdlib", Arg.String set_stdlib, doc_stdlib; "-c", Arg.Set create_object_file, doc_object_file; - "-s", Arg.String set_simulation_node, doc_sim; - "-inline", Arg.String add_inlined_node, doc_inline; + "-s", read_qualname set_simulation_node, doc_sim; + "-inline", read_qualname add_inlined_node, doc_inline; "-flatten", Arg.Set flatten, doc_flatten; - "-assert", Arg.String add_assert, doc_assert; + "-assert", read_qualname add_assert, doc_assert; "-nopervasives", Arg.Unit set_no_pervasives, doc_no_pervasives; "-target", Arg.String add_target_language, doc_target; "-targetpath", Arg.String set_target_path, doc_target_path; diff --git a/compiler/obc/c/cmain.ml b/compiler/obc/c/cmain.ml index 0f9b6b1..73582a9 100644 --- a/compiler/obc/c/cmain.ml +++ b/compiler/obc/c/cmain.ml @@ -257,10 +257,10 @@ let mk_main name p = match (!Compiler_options.simulation_node, !Compiler_options.assert_nodes) with | (None, []) -> [] | (_, n_names) -> - let find_class n = - try List.find (fun cd -> cd.cd_name.name = n) p.p_defs + let find_class qn = + try List.find (fun cd -> cd.cd_name = qn) p.p_defs with Not_found -> - Format.eprintf "Unknown node %s.\n" n; + Format.eprintf "Unknown node %a.\n" Global_printer.print_qualname qn; exit 1 in let a_classes = List.map find_class n_names in diff --git a/compiler/utilities/global/compiler_options.ml b/compiler/utilities/global/compiler_options.ml index b859741..281a116 100644 --- a/compiler/utilities/global/compiler_options.ml +++ b/compiler/utilities/global/compiler_options.ml @@ -8,6 +8,8 @@ (**************************************************************************) (* Compiler options *) +open Names + (* version of the compiler *) let version = "0.4" let date = "DATE" @@ -48,11 +50,11 @@ let show_version () = let verbose = ref false let print_types = ref false -let assert_nodes:string list ref = ref [] +let assert_nodes : qualname list ref = ref [] let add_assert nd = assert_nodes := nd :: !assert_nodes let simulation = ref false -let simulation_node : string option ref = ref None +let simulation_node : qualname option ref = ref None let set_simulation_node s = simulation := true; simulation_node := Some s @@ -75,12 +77,11 @@ let full_type_info = ref false let init = ref true -let inline:string list ref = ref [] +let inline : qualname list ref = ref [] let add_inlined_node s = inline := s :: !inline let flatten = ref false -let nodes_to_inline : string list ref = ref [] let do_iterator_fusion = ref false