Skip to content
Snippets Groups Projects
Commit ccb7c537 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

In -ec mode, only generate the code for one node (if no node is specified).

Also do not print type and const declarations with -ec.
parent 484496ce
No related branches found
No related tags found
No related merge requests found
......@@ -135,33 +135,56 @@ let dump_entete oc =
Printf.fprintf oc "-- %s\n" sys_call;
Printf.fprintf oc "-- on %s the %s at %s\n" hostname date time_str
exception Enough
let to_file (oc: out_channel) (this:t) =
dump_entete oc;
(* On imprime dans l'ordre du iter, donc pas terrible ???
*)
ItemKeyMap.iter
dump_entete oc;
(* On imprime dans l'ordre du iter, donc pas terrible ???
*)
if !Global.ec then (
(* If no node is set a top-level, the compiler will compile every node. But the
ec format only accepts one node (and no type nor const)
Hence we print the first one.
*)
try
NodeKeyMap.iter (
fun _ nexp ->
match nexp.Lic.node_key_eff, nexp.Lic.def_eff with
(* only user nodes with a body are valid ec node *)
| _, Lic.BodyLic _ ->
output_string !Global.oc (LicDump.node_of_node_exp_eff nexp);
flush !Global.oc;
raise Enough
| _ -> ()
)
this.nodes
with Enough -> ()
) else (
ItemKeyMap.iter
(fun tn te -> output_string !Global.oc (LicDump.type_decl tn te)) this.types;
ItemKeyMap.iter
ItemKeyMap.iter
(fun cn ce -> output_string !Global.oc (LicDump.const_decl cn ce)) this.consts;
(* Pour les noeuds, pas sur que ça marche tant qu'on n'a
pas séparés les transformations source_to_source du LicTab:
en cas d'expansion, il y avait cette remarque :
nb: we print res_struct, but do not return it from
node_check, because the structure and array expansion
modify (instanciate) the node profiles.
nb: we print res_struct, but do not return it from
node_check, because the structure and array expansion
modify (instanciate) the node profiles.
On n'affiche PAS les extern Lustre::...
*)
NodeKeyMap.iter (
NodeKeyMap.iter (
fun _ nexp ->
match nexp.Lic.node_key_eff with
match nexp.Lic.node_key_eff with
(* inutile d'écrire les noeuds predefs *)
| (("Lustre",_),[]) -> ()
| _ -> output_string !Global.oc (LicDump.node_of_node_exp_eff nexp)
)
this.nodes
| (("Lustre",_),[]) -> ()
| _ -> output_string !Global.oc (LicDump.node_of_node_exp_eff nexp)
)
this.nodes
)
(* GENERATEUR DE NOM DE VARIABLES *)
type id_generator = string -> string
......
(* Time-stamp: <modified the 11/01/2013 (at 17:02) by Erwan Jahier> *)
(* Time-stamp: <modified the 11/01/2013 (at 18:11) by Erwan Jahier> *)
......@@ -169,9 +169,7 @@ let main = (
if !Global.outfile <> "" then Global.oc := open_out !Global.outfile;
let lic_prg = Compile.doit nsl main_node in
LicPrg.to_file !Global.oc lic_prg;
Verbose.exe ~level:3 (fun () ->
Gc.print_stat stdout
);
Verbose.exe ~level:3 (fun () -> Gc.print_stat stdout);
close_out !Global.oc
) with
Sys_error(s) ->
......
This diff is collapsed.
This diff is collapsed.
testcase ./lus2lic.tests/non-reg.exp completed in 90 seconds
testcase ./lus2lic.tests/progression.exp completed in 13 seconds
testcase ./lus2lic.tests/non-reg.exp completed in 183 seconds
testcase ./lus2lic.tests/progression.exp completed in 12 seconds
......@@ -25,6 +25,10 @@ proc should_work { test_name command_line args } {
set failed 1
exp_continue
}
"ec program must contain a single node" {
set failed 1
exp_continue
}
"error" {
set failed 1
exp_continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment