Commit a8191c97 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Chose a node in the lutin program if -m is not specified.

parent 45f9d2f8
......@@ -459,6 +459,26 @@ let make ?(libs: string list option = None) infile mnode = (
let inchannel = open_in infile in
let mainprg = Parsers.read_lut inchannel in
let tlenv = CheckType.check_pack libs mainprg in
let mnode = if mnode <> "" then mnode else
let all_nodes =
Hashtbl.fold
(fun n _ acc -> n::acc)
mainprg.Syntaxe.pck_nodetab
[]
in
(* It is not necessary to build to complete list to take the first
one, but I'm sure that list will be useful in the future... R1.*)
let mnode =
if all_nodes = [] then
(* shouldn't that be checked before? *)
raise (Errors.Global_error ("the program "^infile^
" contains no node"))
else
List.hd all_nodes
in
Verbose.put ~level:1 "# No node is specified: will use %s \n" mnode;
mnode
in
let exped = Expand.make tlenv mainprg mnode in
(* Les tables de variables decoulent du exped *)
Verbose.put ~level:3 "#---begin AutoExplore.make\n";
......@@ -548,3 +568,4 @@ let make_state ?(libs: string list option = None) ?(verb_level=0) infile mnode
get_init_state ~verb_level:verb_level zelut
)
......@@ -123,9 +123,6 @@ let rec to_simu () = (
if (infile = "") then (
MainArg.usage stderr;
raise (Global_error "no input file")
) else if (mnode = "") then (
MainArg.usage stderr;
raise (Global_error "no main node specified")
) else (
(* Parse and build the internal structure *)
Verbose.put "#Main.to_simu\n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment