diff --git a/src/lic.ml b/src/lic.ml index b959ddb9519f82ef082255c156c29bab3a5a1aa4..cd6bc313ab4c50b3822d161856f00b67474097de 100644 --- a/src/lic.ml +++ b/src/lic.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 21/12/2012 (at 15:10) by Erwan Jahier> *) +(* Time-stamp: <modified the 14/01/2013 (at 14:01) by Erwan Jahier> *) (** Define the Data Structure representing Compiled programs. *) @@ -242,13 +242,10 @@ and const = (* type atomique non predef : on précise le type *) | Extern_const_eff of (Ident.long * type_) | Abstract_const_eff of (Ident.long * type_ * const * bool) - (* if the abstract const is exported (i.e., defined in the provided part), - then the bool flag is set to true. Well, it is not really an abstract - constant in that case... - - nb: well, are exported abstract constant useful at all? I don't - know, but it is not a reason to handle them unproperly... - *) + (* if the abstract const is extern (i.e., defined as an extern + in the provided part), then the bool flag is set to + true. + *) | Enum_const_eff of (Ident.long * type_) (* type_ structure : liste (champ,valeur) + type_ structure *) | Struct_const_eff of ((Ident.t * const) list * type_) @@ -468,6 +465,12 @@ let (type_are_compatible : type_ -> type_ -> bool) = | (TypeVar AnyNum), Int_type_eff | Int_type_eff, (TypeVar AnyNum) -> true | t1, t2 -> t1 = t2 +let (is_extern_type : type_ -> bool) = + fun te -> match te with + | External_type_eff _ -> true + | _ -> false + + let rec (clock_are_equals : clock -> clock -> bool) = fun c1 c2 -> match c1, c2 with | On(cid1,_), On(cid2,_) -> cid1 = cid2 @@ -598,6 +601,13 @@ let (type_of_const: const -> type_) = print_internal_error "Lic.type_of_const" "should not have been called for a tuple"; assert false +let (is_extern_const : const -> bool) = + fun te -> match te with + | Extern_const_eff _ + | Abstract_const_eff (_,_,_, true) -> true + | _ -> false + + let type_of_val_exp ve = ve.ve_typ (* accepte un UNIQUE niveau de tuple diff --git a/src/licPrg.ml b/src/licPrg.ml index 27ddcafd1310e7295c43a3ae9da7e83562db51cc..5c365ccc213e6f1fe4ef3f4641711ae76f8327d8 100644 --- a/src/licPrg.ml +++ b/src/licPrg.ml @@ -161,11 +161,6 @@ let to_file (oc: out_channel) (this:t) = with Enough -> () ) else ( - ItemKeyMap.iter - (fun tn te -> output_string !Global.oc (LicDump.type_decl tn te)) this.types; - 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 : @@ -184,7 +179,17 @@ let to_file (oc: out_channel) (this:t) = | _ -> output_string !Global.oc (LicDump.node_of_node_exp_eff nexp) ) this.nodes - ) + ); + ItemKeyMap.iter + (fun tn te -> + if (not !Global.ec || Lic.is_extern_type te) then + output_string !Global.oc (LicDump.type_decl tn te)) + this.types; + ItemKeyMap.iter + (fun cn ce -> + if (not !Global.ec || Lic.is_extern_const ce) then + output_string !Global.oc (LicDump.const_decl cn ce)) + this.consts (* GENERATEUR DE NOM DE VARIABLES *) type id_generator = string -> string diff --git a/test/lus2lic.sum b/test/lus2lic.sum index ec8f511de7d0fba0deac42bd7fbba5c1441d972f..a4fe348379b349835404a5852f90935e4199e60e 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Fri Jan 11 18:07:22 2013 +Test Run By jahier on Mon Jan 14 17:52:44 2013 Native configuration is i686-pc-linux-gnu === lus2lic tests === diff --git a/test/lus2lic.time b/test/lus2lic.time index 8a58a30fe556f8922de73d09769ad60fe48c0448..c2267cd10ff102bd969348cc4af683202d69102c 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,2 +1,2 @@ -testcase ./lus2lic.tests/non-reg.exp completed in 183 seconds -testcase ./lus2lic.tests/progression.exp completed in 12 seconds +testcase ./lus2lic.tests/non-reg.exp completed in 148 seconds +testcase ./lus2lic.tests/progression.exp completed in 14 seconds diff --git a/todo.org b/todo.org index 0c249982f764f63ab79d990558382bdbbabac699..108ec8574e976072cbe300bc4ce32cb6c22d85ab 100644 --- a/todo.org +++ b/todo.org @@ -66,13 +66,6 @@ file:should_work/test.lus file::/home/jahier/lus2lic/testsuite/should_work/heater_control.lus::0 -** TODO il ne faut pas générer l'alias de type en ec - - State "TODO" from "" [2013-01-11 Fri 09:41] -file:/tmp/t0.ec - -** TODO le mode ec genere tous les noeuds (ce que n'aime pas ec2c) - - State "TODO" from "" [2013-01-11 Fri 09:33] - ** TODO Regression dans le mode -ec - State "TODO" from "" [2013-01-11 Fri 09:33] diff --git a/todo.org_archive b/todo.org_archive index 97011122b46160e12ee92b80a5eda53f5e72b2d4..f43603b452aad22d3f42b55721b7a6c445ecda57 100644 --- a/todo.org_archive +++ b/todo.org_archive @@ -55,6 +55,29 @@ que Pascal les a débranché lors de son ménage d'été. par ex, file:~/lus2lic/src/l2lExpandArrays.ml::50 dois-je faire comme lui ou comme avant ? +* TODO le mode ec genere tous les noeuds (ce que n'aime pas ec2c) + - State "TODO" from "" [2013-01-11 Fri 09:33] + :PROPERTIES: + :ARCHIVE_TIME: 2013-01-11 Fri 18:15 + :ARCHIVE_FILE: ~/lus2lic/todo.org + :ARCHIVE_OLPATH: Regressions introduites par Pascal + :ARCHIVE_CATEGORY: lv6 + :ARCHIVE_TODO: TODO + :END: + +* TODO il ne faut pas générer l'alias de type en ec + - State "TODO" from "" [2013-01-11 Fri 09:41] + :PROPERTIES: + :ARCHIVE_TIME: 2013-01-11 Fri 18:15 + :ARCHIVE_FILE: ~/lus2lic/todo.org + :ARCHIVE_OLPATH: Regressions introduites par Pascal + :ARCHIVE_CATEGORY: lv6 + :ARCHIVE_TODO: TODO + :END: +file:/tmp/t0.ec + + +