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

In -ec mode, print extern type and const.

parent ccb7c537
No related branches found
No related tags found
No related merge requests found
(* 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. *) (** Define the Data Structure representing Compiled programs. *)
...@@ -242,13 +242,10 @@ and const = ...@@ -242,13 +242,10 @@ and const =
(* type atomique non predef : on précise le type *) (* type atomique non predef : on précise le type *)
| Extern_const_eff of (Ident.long * type_) | Extern_const_eff of (Ident.long * type_)
| Abstract_const_eff of (Ident.long * type_ * const * bool) | Abstract_const_eff of (Ident.long * type_ * const * bool)
(* if the abstract const is exported (i.e., defined in the provided part), (* if the abstract const is extern (i.e., defined as an extern
then the bool flag is set to true. Well, it is not really an abstract in the provided part), then the bool flag is set to
constant in that case... true.
*)
nb: well, are exported abstract constant useful at all? I don't
know, but it is not a reason to handle them unproperly...
*)
| Enum_const_eff of (Ident.long * type_) | Enum_const_eff of (Ident.long * type_)
(* type_ structure : liste (champ,valeur) + type_ structure *) (* type_ structure : liste (champ,valeur) + type_ structure *)
| Struct_const_eff of ((Ident.t * const) list * type_) | Struct_const_eff of ((Ident.t * const) list * type_)
...@@ -468,6 +465,12 @@ let (type_are_compatible : type_ -> type_ -> bool) = ...@@ -468,6 +465,12 @@ let (type_are_compatible : type_ -> type_ -> bool) =
| (TypeVar AnyNum), Int_type_eff | Int_type_eff, (TypeVar AnyNum) -> true | (TypeVar AnyNum), Int_type_eff | Int_type_eff, (TypeVar AnyNum) -> true
| t1, t2 -> t1 = t2 | 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) = let rec (clock_are_equals : clock -> clock -> bool) =
fun c1 c2 -> match c1, c2 with fun c1 c2 -> match c1, c2 with
| On(cid1,_), On(cid2,_) -> cid1 = cid2 | On(cid1,_), On(cid2,_) -> cid1 = cid2
...@@ -598,6 +601,13 @@ let (type_of_const: const -> type_) = ...@@ -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"; print_internal_error "Lic.type_of_const" "should not have been called for a tuple";
assert false 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 let type_of_val_exp ve = ve.ve_typ
(* accepte un UNIQUE niveau de tuple (* accepte un UNIQUE niveau de tuple
......
...@@ -161,11 +161,6 @@ let to_file (oc: out_channel) (this:t) = ...@@ -161,11 +161,6 @@ let to_file (oc: out_channel) (this:t) =
with Enough -> () with Enough -> ()
) else ( ) 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 (* Pour les noeuds, pas sur que ça marche tant qu'on n'a
pas séparés les transformations source_to_source du LicTab: pas séparés les transformations source_to_source du LicTab:
en cas d'expansion, il y avait cette remarque : en cas d'expansion, il y avait cette remarque :
...@@ -184,7 +179,17 @@ let to_file (oc: out_channel) (this:t) = ...@@ -184,7 +179,17 @@ let to_file (oc: out_channel) (this:t) =
| _ -> output_string !Global.oc (LicDump.node_of_node_exp_eff nexp) | _ -> output_string !Global.oc (LicDump.node_of_node_exp_eff nexp)
) )
this.nodes 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 *) (* GENERATEUR DE NOM DE VARIABLES *)
type id_generator = string -> string type id_generator = string -> string
......
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 Native configuration is i686-pc-linux-gnu
=== lus2lic tests === === lus2lic tests ===
......
testcase ./lus2lic.tests/non-reg.exp completed in 183 seconds testcase ./lus2lic.tests/non-reg.exp completed in 148 seconds
testcase ./lus2lic.tests/progression.exp completed in 12 seconds testcase ./lus2lic.tests/progression.exp completed in 14 seconds
...@@ -66,13 +66,6 @@ file:should_work/test.lus ...@@ -66,13 +66,6 @@ file:should_work/test.lus
file::/home/jahier/lus2lic/testsuite/should_work/heater_control.lus::0 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 ** TODO Regression dans le mode -ec
- State "TODO" from "" [2013-01-11 Fri 09:33] - State "TODO" from "" [2013-01-11 Fri 09:33]
......
...@@ -55,6 +55,29 @@ que Pascal les a débranché lors de son ménage d'été. ...@@ -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 par ex, file:~/lus2lic/src/l2lExpandArrays.ml::50
dois-je faire comme lui ou comme avant ? 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
......
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