From 7caf271d21241ee9c9f07683daca9e513d769edc Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Wed, 3 Apr 2013 08:50:50 +0200
Subject: [PATCH] The -exec mode now supports the when and the current
 statements.

nb : programs do run, but I did not check that they run correctly...

Also fix a regression introduced in the previous change where
incorrect ec code was generated for diese.
---
 src/actionsDeps.ml       | 30 ++++++++-----
 src/actionsDeps.mli      |  6 ++-
 src/ast2lic.ml           | 19 ++++----
 src/astV6Dump.ml         |  8 ++--
 src/compile.ml           |  8 +---
 src/evalClock.ml         | 26 ++++++-----
 src/evalType.ml          | 12 ++---
 src/ident.ml             | 15 ++++---
 src/ident.mli            |  6 +--
 src/l2lExpandNodes.ml    |  8 +---
 src/l2lSplit.ml          |  5 +--
 src/lic.ml               | 19 +++++---
 src/lic2soc.ml           | 94 ++++++++++++++++++----------------------
 src/lic2soc.mli          |  3 +-
 src/licDump.ml           | 35 +++++++++------
 src/licEvalConst.ml      |  6 +--
 src/licEvalType.ml       | 18 ++++++--
 src/main.ml              | 15 ++++++-
 src/parser.mly           | 10 ++---
 src/parserUtils.ml       |  6 +--
 src/soc.ml               |  4 +-
 src/socExec.ml           |  5 +--
 src/socExecEvalPredef.ml | 12 ++++-
 src/socExecValue.ml      | 10 +++--
 src/socPredef.ml         | 35 +++++++++++++--
 src/socUtils.ml          |  3 +-
 src/unifyClock.ml        |  8 ++--
 test/lus2lic.log.ref     | 10 ++---
 test/lus2lic.sum         |  2 +-
 todo.org                 |  8 +---
 todo.org_archive         | 20 +++++++++
 31 files changed, 274 insertions(+), 192 deletions(-)

diff --git a/src/actionsDeps.ml b/src/actionsDeps.ml
index 7f9141b6..71de5fab 100644
--- a/src/actionsDeps.ml
+++ b/src/actionsDeps.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 21/03/2013 (at 15:30) by Erwan Jahier> *)
+(** Time-stamp: <modified the 02/04/2013 (at 16:05) by Erwan Jahier> *)
   
 let dbg = Some(Verbose.get_flag "exec")
 
@@ -219,23 +219,29 @@ let to_string: t -> string = fun m ->
 
 (*********************************************************************************)
 (* exported *)
-let build_data_deps_from_actions: t -> action list -> t = 
-  fun deps al ->
+let build_data_deps_from_actions:  (Lic.type_ -> Soc.var_type) -> t -> action list -> t =
+  fun lic_to_soc_type deps al ->
     let tbl = get_var2actions_tbl al in
     let deps =
-      List.fold_left 
+      List.fold_left
         (fun acc_deps action ->
-          let (_, rhs, _, _,_) = action in
-          let deps = actions_of_vars rhs tbl in
+          let (clk, rhs, _, _,_) = action in
+          let dep_vars = match clk with
+            | Lic.BaseLic -> rhs
+            | Lic.ClockVar int -> assert false
+            | Lic.On ((cc,cv,ct),_) -> (Soc.Var(cv, lic_to_soc_type ct))::rhs
+          in
+          let deps = actions_of_vars dep_vars tbl in
+          (* The guard should be computed before the guarded expression *)
           if deps = [] then (
-            Verbose.exe ~flag:dbg (fun () ->
-              print_string ("\n====> No deps for " ^
-                               (String.concat "," (List.map SocUtils.string_of_filter rhs))));
-            acc_deps 
+            Verbose.exe ~flag:dbg (fun () -> print_string (
+              "\n====> No deps for " ^
+                (String.concat "," (List.map SocUtils.string_of_filter rhs))));
+            acc_deps
           )
-          else 
+          else
             add_deps acc_deps action deps
-        ) 
+        )
         deps
         al
     in
diff --git a/src/actionsDeps.mli b/src/actionsDeps.mli
index def25266..afa57216 100644
--- a/src/actionsDeps.mli
+++ b/src/actionsDeps.mli
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 20/03/2013 (at 08:19) by Erwan Jahier> *)
+(** Time-stamp: <modified the 02/04/2013 (at 16:06) by Erwan Jahier> *)
 
 (** Compute dependencies between actions  *)
 
@@ -36,8 +36,10 @@ val string_of_action_simple: action -> string
 
     Construit des dépendances entre les actions en reliant les entrées et
     les sorties de ces actions. 
+
+    Lic2soc.lic_to_soc_type is passed inn argument to break a mutuel dep loop
 *)
-val build_data_deps_from_actions: t -> action list -> t
+val build_data_deps_from_actions:  (Lic.type_ -> Soc.var_type) -> t -> action list -> t
 
 (** Use the dependency constraints that come from the SOC (e.g., 'get' before 'set'
     in memory SOC).
diff --git a/src/ast2lic.ml b/src/ast2lic.ml
index af426fca..39dc6dc2 100644
--- a/src/ast2lic.ml
+++ b/src/ast2lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 02/04/2013 (at 09:29) by Erwan Jahier> *)
+(* Time-stamp: <modified the 02/04/2013 (at 16:02) by Erwan Jahier> *)
 
 
 open Lxm
@@ -55,10 +55,10 @@ let rec (of_clock : IdSolver.t -> AstCore.var_info -> Lic.id_clock)=
     match v.var_clock with
       | Base -> v.var_name, BaseLic
       | NamedClock({ it=(cc,cv) ; src=lxm }) ->
-        let cc = add_pack_name id_solver lxm cc in
         let vi = id_solver.id2var cv lxm in
-        let id, clk = vi.var_clock_eff in
-        v.var_name, On((cc,cv), clk)
+        let _, clk = vi.var_clock_eff in
+        let ct = vi.var_type_eff in
+        v.var_name, On((cc,cv,ct), clk)
 
 (******************************************************************************)
 (* Checks that the left part has the same type as the right one. *)
@@ -466,11 +466,12 @@ and (translate_val_exp : IdSolver.t -> UnifyClock.subst -> AstCore.val_exp
                   | STRUCT_ACCESS_n fid ->
                     s, mk_by_pos_op (Lic.STRUCT_ACCESS (fid))
 
-                  | WHEN_n Base -> s, mk_by_pos_op (Lic.WHEN Base)
-                  | WHEN_n (NamedClock { it = (cc,cv) ; src = lxm }) -> 
-                    let cc = add_pack_name id_solver lxm cc in
-                    s, 
-                    mk_by_pos_op (Lic.WHEN (NamedClock { it = (cc,cv) ; src = lxm }))
+                  | WHEN_n Base -> s, mk_by_pos_op (Lic.WHEN BaseLic)
+                  | WHEN_n (NamedClock { it = (cc,c) ; src = lxm }) -> 
+                    let var_info = id_solver.id2var c lxm in
+                    let _, clk = var_info.var_clock_eff in
+                    let ct =  var_info.var_type_eff in
+                    s, mk_by_pos_op (Lic.WHEN (On((cc,c,ct), clk)))
 
                   | ARRAY_ACCES_n ve_index ->
                     s, mk_by_pos_op (Lic.ARRAY_ACCES(
diff --git a/src/astV6Dump.ml b/src/astV6Dump.ml
index 8dc549d5..f21d6bc9 100644
--- a/src/astV6Dump.ml
+++ b/src/astV6Dump.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 07/02/2013 (at 16:06) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:04) by Erwan Jahier> *)
 
 
 open Lxm
@@ -280,11 +280,11 @@ and dump_var_decl (os: Format.formatter) (vinfo: var_info  ) = (
     match vinfo.var_clock with
 	     Base -> ()
       | NamedClock({it=cc,id;src=lxm}) ->
-        let cc_str = Ident.string_of_idref cc in
+        let cc_str = Ident.long_to_string cc in
         let id_str = Ident.to_string id in
         let clk_str = 
-          if cc_str = "True" then id_str
-          else if cc_str = "False" then ("not " ^ id_str) 
+          if cc_str = "true" then id_str
+          else if cc_str = "false" then ("not " ^ id_str) 
           else (cc_str ^ "(" ^ id_str ^ ")")
         in
         (fprintf os " when %s" ) clk_str
diff --git a/src/compile.ml b/src/compile.ml
index a8489937..f7a245ab 100644
--- a/src/compile.ml
+++ b/src/compile.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 14/03/2013 (at 16:33) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:41) by Erwan Jahier> *)
 
 open Lxm
 open Errors
@@ -6,11 +6,6 @@ open AstV6
 open AstCore
 
 (* get the first package in the package/model list *)
-let rec first_pack_in =
-  function
-    | (NSPack pi)::_ -> pi.it.pa_name
-    | (NSModel _)::tail -> first_pack_in tail
-    | [] -> raise (Global_error "No package has been provided")
 
 let (doit : AstV6.pack_or_model list -> Ident.idref option -> LicPrg.t) = 
   fun srclist main_node ->
@@ -27,7 +22,6 @@ let (doit : AstV6.pack_or_model list -> Ident.idref option -> LicPrg.t) =
     *)
     let lic_tab = LicTab.create syntax_tab in
     Verbose.exe ~level:2 (fun () -> AstTab.dump syntax_tab);
-    Ident.set_dft_pack_name (first_pack_in srclist);
 
     let lic_tab = match main_node with
       | None -> LicTab.compile_all lic_tab
diff --git a/src/evalClock.ml b/src/evalClock.ml
index 51819edb..7f3f691b 100644
--- a/src/evalClock.ml
+++ b/src/evalClock.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 26/03/2013 (at 18:24) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:22) by Erwan Jahier> *)
  
   
 open AstPredef
@@ -219,12 +219,12 @@ and f_aux id_solver s ve =
           (* Check that ve is on c(ce) on merge_clk *)
           let id_clk =
             match c.it with
-              | Bool_const_eff true  -> "True"
-              | Bool_const_eff false -> "False"
-              | Enum_const_eff (s,_) -> Ident.string_of_long2 s
+              | Bool_const_eff true  -> "Lustre", "true"
+              | Bool_const_eff false -> "Lustre", "false"
+              | Enum_const_eff (s,_) ->  s
               | _ -> assert false
           in
-          let id_clk : Ident.clk = (Ident.idref_of_string id_clk, ce.it) in
+          let id_clk = (id_clk, ce.it, Lic.type_of_const c.it) in
           let exp_clk = [On(id_clk, merge_clk)] in
           let _ve,cel,s = f c.src id_solver s ve exp_clk in
           s
@@ -268,13 +268,15 @@ and (eval_by_pos_clock : IdSolver.t -> Lic.by_pos_op -> Lxm.t -> Lic.val_exp lis
         in
         List.map current_clock (List.flatten clocks_of_args), s
       )
-      | Lic.WHEN clk_exp,args -> (
-        let c_clk, when_exp_clk =
-          match clk_exp with
-            | Base -> BaseLic, BaseLic
-            | NamedClock { it = (cc,c) ; src = lxm } ->
-              let id, c_clk = (id_solver.id2var c lxm).var_clock_eff in
-              c_clk, On((cc,c), c_clk)
+      | Lic.WHEN when_exp_clk,args -> (
+        let c_clk =
+          match when_exp_clk with
+            | BaseLic -> BaseLic
+            | ClockVar _ -> assert false
+            | On((cc,c,_), c_clk) -> 
+(*             | NamedClock { it = (cc,c) ; src = lxm } -> *)
+(*               let id, c_clk = (id_solver.id2var c lxm).var_clock_eff in *)
+              c_clk
         in
 	     let aux_when exp_clk s =
           (* 
diff --git a/src/evalType.ml b/src/evalType.ml
index 5667db15..48581c03 100644
--- a/src/evalType.ml
+++ b/src/evalType.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 26/03/2013 (at 18:26) by Erwan Jahier> *)
+(** Time-stamp: <modified the 03/04/2013 (at 15:41) by Erwan Jahier> *)
  
   
 open AstPredef
@@ -226,15 +226,15 @@ and eval_by_pos_type
     | Lic.WHEN clk_exp -> (
       let args, targs = List.split (List.map (f id_solver) args) in
       let _ = match clk_exp with
-        | Base -> ()
-        | NamedClock( { it = (cc,cv) ; src = lxm }) -> 
-          let vi = id_solver.id2var cv lxm in
-          (match vi.var_type_eff with
+        | BaseLic -> ()
+        | ClockVar _ -> (assert false)
+        | On((cc,cv,ct),clk) -> 
+          (match ct with
 	         | Lic.Bool_type_eff
             | Lic.Enum_type_eff _ -> ()
 	         | teff  -> 
 		        let msg = "the type of a clock cannot be " ^
-                (Lic.string_of_type teff) 
+                (Lic.string_of_type ct) 
 		        in
 		        raise(Compile_error(lxm,msg))
           )
diff --git a/src/ident.ml b/src/ident.ml
index c399a627..3080710e 100644
--- a/src/ident.ml
+++ b/src/ident.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 04/02/2013 (at 18:46) by Erwan JAHIER> *)
+(* Time-stamp: <modified the 03/04/2013 (at 15:59) by Erwan Jahier> *)
 
 (* J'ai appele ca symbol (mais ca remplace le ident) :
 c'est juste une couche qui garantit l'unicite en memoire
@@ -76,8 +76,10 @@ let (string_of_long : long -> string) =
    | _ -> Printf.sprintf "%s%s%s" pn sep id
 
 let (string_of_long2 : long -> string) =
-  fun (pn, id) -> 
-    pn ^"::"^ id
+  function
+    | "Lustre","true" -> "true"
+    | "Lustre","false" -> "false"
+    | (pn, id) ->  pn ^"::"^ id
 
 let (no_pack_string_of_long : long -> string) =
   fun (pn, id) -> 
@@ -89,10 +91,11 @@ let (long_to_string : long -> string) =
 let (make_long : pack_name -> t -> long) =
   fun pn id -> (pn,id)
 
-let dft_pack_name = ref "DftPack" (* this dft value ougth to be reset *)
+let dft_pack_name = ref "DftPack" (* this dft value ougth to be reset before being used *)
 
 let (set_dft_pack_name : pack_name -> unit) =
   fun pn -> 
+(*     print_string ("Change the dft pack name to "^ pn^"\n");flush stdout; *)
     dft_pack_name := pn
 
 
@@ -178,10 +181,10 @@ let (make_idref : pack_name -> t -> idref) =
 
 
 
-type clk = idref * t
+type clk = long * t
 
 let (string_of_clk : clk -> string) = 
   fun (cc,cv) ->
-      (string_of_idref cc) ^ "(" ^ (to_string cv) ^ ")" 
+      (long_to_string cc) ^ "(" ^ (to_string cv) ^ ")" 
 
 (*************************************************************************)
diff --git a/src/ident.mli b/src/ident.mli
index 8035516a..d838a6cd 100644
--- a/src/ident.mli
+++ b/src/ident.mli
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 12/12/2012 (at 17:06) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:04) by Erwan Jahier> *)
 
 (**  *)
 
@@ -65,9 +65,7 @@ val long_of_idref : idref -> long
 val idref_of_long : long -> idref
 val idref_of_id : t  -> idref
 
-type clk = idref * t 
-    (* The Clock constructor, and the clock variable.
-       e.g., NamedClock("C",v), or NamedClock("True", clk) *)
+type clk = long * t
 val string_of_clk : clk -> string
 
 val wrap_idref : idref -> string -> string -> idref
diff --git a/src/l2lExpandNodes.ml b/src/l2lExpandNodes.ml
index 8c484d15..ca799135 100644
--- a/src/l2lExpandNodes.ml
+++ b/src/l2lExpandNodes.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 26/03/2013 (at 10:18) by Erwan Jahier> *)
+(* Time-stamp: <modified the 02/04/2013 (at 11:12) by Erwan Jahier> *)
 
 
 open Lxm
@@ -84,11 +84,7 @@ and (subst_in_val_exp : subst -> val_exp -> val_exp) =
                 in
                 VAR_REF id'
               | HAT(i) -> HAT(i)
-              | WHEN(AstCore.Base) ->  WHEN(AstCore.Base)
-              | WHEN(AstCore.NamedClock {src=lxm;it=(cc,cv)}) -> 
-                let var = List.assoc cv s in
-                let cv = var.var_name_eff in
-                WHEN(AstCore.NamedClock  {src=lxm;it=(cc,cv)})
+              | WHEN(_) -> by_pos_op
               | PREDEF_CALL _| CALL _ | PRE | ARROW | FBY | CURRENT  | TUPLE
               | ARRAY | CONCAT | STRUCT_ACCESS _ | ARRAY_ACCES _ | ARRAY_SLICE _ 
               | CONST _ 
diff --git a/src/l2lSplit.ml b/src/l2lSplit.ml
index 6870f836..49b3ecd3 100644
--- a/src/l2lSplit.ml
+++ b/src/l2lSplit.ml
@@ -185,10 +185,9 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
         -> if not when_flag then
             let clk = ve.ve_clk in
             match (List.hd clk) with
-              | On(clock,_) -> 
-                let clk_exp = AstCore.NamedClock (Lxm.flagit clock lxm) in
+              | On(clock,clk) -> 
                 { ve with ve_core = 
-                    CallByPosLic({src=lxm;it=Lic.WHEN clk_exp},[ve])},
+                    CallByPosLic({src=lxm;it=Lic.WHEN(On(clock,clk))},[ve])},
                 ([],[])
                   
               | (ClockVar _) (* should not occur *)
diff --git a/src/lic.ml b/src/lic.ml
index f68aea03..eb4f6c6b 100644
--- a/src/lic.ml
+++ b/src/lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/03/2013 (at 09:55) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:18) by Erwan Jahier> *)
 
 (** Define the Data Structure representing Compiled programs. *)
 
@@ -182,7 +182,7 @@ and by_pos_op =
   | FBY
   | CURRENT
 
-  | WHEN of AstCore.clock_exp
+  | WHEN of clock
   | TUPLE
 
   | CONCAT
@@ -254,11 +254,15 @@ and id_clock = Ident.t * clock
 and clock =
   | BaseLic
   | ClockVar of int (* to deal with polymorphic clocks (i.e., constants) *)
-  | On of Ident.clk * clock 
-      (* The clock expression, and the effective clock the clock var
+  | On of (Ident.long * Ident.t * type_) * clock 
+      (* - The clock constructor, 
+         - the clock variable
+         - the type of the clock variable (enum or bool)
+         - the clock of the clock
+         
          e.g., in 
-            On((clk_constructor, clk_var), clk )
-         clk is the clock of clk_var
+            On(clk_constructor, clk_var, clk_typ, sub_clk )
+         sub_clk is the clock of clock clk_var
       *)
 
 (**********************************************************************************)
@@ -603,7 +607,8 @@ and string_of_type_profile (i, o) =
 and string_of_clock = function
   | BaseLic -> " on base"
   | ClockVar i -> " on 'c"^(string_of_int i)
-  | On (id, ck) -> " on "^(Ident.string_of_clk id)^(string_of_clock ck)
+  | On ( (cc,cv,ct), ck) -> 
+    " on "^(Ident.long_to_string cc) ^ "(" ^ (Ident.to_string cv) ^ ")"  ^(string_of_clock ck)
 
 and string_of_const = function
   | Bool_const_eff true -> "true"
diff --git a/src/lic2soc.ml b/src/lic2soc.ml
index 9af1d89b..f7c0dc21 100644
--- a/src/lic2soc.ml
+++ b/src/lic2soc.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 02/04/2013 (at 08:32) by Erwan Jahier> *)
+(** Time-stamp: <modified the 03/04/2013 (at 14:20) by Erwan Jahier> *)
  
 open Lxm
 open Lic
@@ -91,9 +91,22 @@ let (slice_info_to_index_list : Lic.slice_info -> int list) =
     in
       aux f
 
+let rec (lic2soc_const : Lic.const -> Soc.var_expr list) =
+  function
+    | Bool_const_eff true -> [Soc.Const("true", Soc.Bool)]
+    | Bool_const_eff false -> [Soc.Const("false", Soc.Bool)]
+    | Int_const_eff  i -> [Soc.Const(i, Soc.Int)]
+    | Real_const_eff r -> [Soc.Const(r, Soc.Real)]
+    | Extern_const_eff (s,  teff) -> [Soc.Const(Ident.string_of_long s, lic_to_soc_type teff)]
+    | Abstract_const_eff (s,  teff,_,_) -> [Soc.Const(Ident.string_of_long s, lic_to_soc_type teff)]
+    | Enum_const_eff   (s,  teff) -> [Soc.Const(Ident.string_of_long s, lic_to_soc_type teff)]
+    | Struct_const_eff (fl, teff) -> assert false (* todo *)
+    | Array_const_eff  (ct, teff) -> assert false (* todo *)
+    | Tuple_const_eff cl -> List.flatten (List.map lic2soc_const cl)
+
 (* Returns Some(thing) if val_exp is a leaf (a var or a constant) 
 
-XXX c'est pas tres clair le role de cette fonction. Expliquer !
+   XXX c'est pas tres clair le role de cette fonction. Expliquer !
 *)
 let rec get_leaf: (LicPrg.t -> Lic.val_exp -> Soc.var_expr list option) = 
   fun licprg val_exp  ->
@@ -116,13 +129,7 @@ let rec get_leaf: (LicPrg.t -> Lic.val_exp -> Soc.var_expr list option) =
             let type_ = lic_to_soc_type (List.hd type_) in
             Some [Soc.Const(Ident.string_of_long l, type_)]
           )
-          | Lic.CONST c -> assert false
-
-(*           | Lic.PREDEF_CALL AstPredef.TRUE_n      -> Some [Soc.Const("true", Soc.Bool)] *)
-(*           | Lic.PREDEF_CALL AstPredef.FALSE_n     -> Some [Soc.Const("false", Soc.Bool)] *)
-(*           | Lic.PREDEF_CALL AstPredef.RCONST_n id -> Some [Soc.Const(id, Soc.Real)] *)
-(*           | Lic.PREDEF_CALL AstPredef.ICONST_n id -> Some [Soc.Const(id, Soc.Int)] *)
-
+          | Lic.CONST c -> Some(lic2soc_const c)
           | Lic.STRUCT_ACCESS(field) -> (
             let expr = match val_exp_list with [e] -> e | _ -> assert false in
             let type_ = lic_to_soc_type (List.hd type_) in
@@ -163,9 +170,9 @@ let rec get_leaf: (LicPrg.t -> Lic.val_exp -> Soc.var_expr list option) =
             in
             let index_list = slice_info_to_index_list si in
             let exploded_array =  
-              (* val_exp is a var ident (t) of type array; we want to gen the list
-                 t[i1], ...,t[in], where the index are specified by the slice 
-              *)
+                    (* val_exp is a var ident (t) of type array; we want to gen the list
+                       t[i1], ...,t[in], where the index are specified by the slice 
+                    *)
               List.map
                 (fun i -> Soc.Index(Soc.Const(id, type_ref), i, type_elt_ref))
                 index_list
@@ -215,7 +222,7 @@ let rec (gao_of_action: action -> Soc.gao) =
       | Lic.BaseLic -> Soc.Call (ol, op, il)
       | Lic.ClockVar i -> (* should not occur ?*)
         Soc.Call (ol, op, il)
-      | Lic.On((c, value), inner_clock) ->
+      | Lic.On((value, cvar, _ctyp), inner_clock) ->
 (*         let inner_clock = match inner_clock_opt with *)
 (*           | Some x -> x *)
 (*           | None ->  *)
@@ -223,7 +230,7 @@ let rec (gao_of_action: action -> Soc.gao) =
 (*             Errors.internal lxm; *)
 (*             assert false  *)
 (*         in *)
-        Soc.Case (Ident.string_of_idref c, [value, [unpack_clock inner_clock]] )
+        Soc.Case (cvar, [Ident.string_of_long2 value, [unpack_clock inner_clock]] )
     in
     unpack_clock ck
 
@@ -472,42 +479,27 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl ->
               | Lic.ARRAY_SLICE _ | Lic.VAR_REF _ | Lic.CONST_REF _ | Lic.CONST _
               | Lic.ARRAY_ACCES _ | Lic.STRUCT_ACCESS _ | Lic.TUPLE
                 -> assert false (* should not occur: handled via get_leaf *)
-              | Lic.WHEN ck -> (assert false 
-              (* XXX FINISH ME!!! *)
-              (*                 (* L'opérateur when n'est pas un composant, il modifie *)
-              (*                    simplement les conditions de traitement des expressions. *) *)
-              (*                 let ctx, actions, inputs, mems, deps = *)
-              (*                   actions_of_expression_list Soc.tbl clk lpl acc val_exp_list *)
-              (*                 in *)
-              (*                 let new_clock =  *)
-              (*                   match ck with *)
-              (*                     | AstCore.Base -> CE_base *)
-              (*                     | AstCore.NamedClock {it=(cc,cv)} -> *)
-              (*                       CE_clock(name, value, clk) *)
-              (*                         Clocking.clock_eff_of_clock_exp ctx.prg ck  *)
-              (*                 in *)
-              (*                 let ctx, outputs, actions_reclocked =  *)
-              (*                   match actions with *)
-              (*                     | [] -> *)
-              (*                       (* L'expression du when est une feuille, on créé quand *)
-              (*                          même une nouvelle action pour clocker la feuille. *) *)
-              (*                       ctx, lpl, [new_clock, inputs, lpl, Soc.Assign, lxm] *)
-              (*                     | _  -> *)
-              (*                       ctx, inputs, *)
-              (*                       (* Remplacement de l'horloge des actions de l'expression *)
-              (*                          par la nouvelle horloge issue du `when`. *) *)
-              (*                       List.map  *)
-              (*                         (fun (_, i,o,op,lxm) -> new_clock,i,o,op,lxm)  *)
-              (*                         actions *)
-              (*                 in *)
-              (*                 ctx, actions_reclocked, outputs, mems, deps *)
+              | Lic.WHEN ck -> (
+                (* L'opérateur when n'est pas un composant, il modifie simplement
+                   les conditions de traitement des expressions. *)
+                let ctx, actions, inputs, mems, deps =
+                  actions_of_expression_list by_pos_op_flg.src soc_tbl clk lpl acc val_exp_list
+                in
+                let ctx, outputs, actions_reclocked = 
+                  match actions with
+                    | [] -> (* L'expression du when est une feuille, on créé quand même
+                               une nouvelle action pour clocker la feuille. *)
+                      ctx, lpl, [ck, inputs, lpl, Soc.Assign, lxm]
+                    | _  -> ctx, inputs,
+                      (* Remplacement de l'horloge des actions de l'expression par
+                         la nouvelle horloge issue du `when`. *)
+                      List.map (fun (_, i,o,op,lxm) -> ck,i,o,op,lxm) actions
+                in
+                ctx, actions_reclocked, outputs, mems, deps
               )
-
-              | HAT _
-              | ARRAY 
-              | CALL _  
-              | PREDEF_CALL _ 
-              | PRE | ARROW | FBY | CURRENT | CONCAT -> (
+              | CURRENT (* todo ? *)
+              | CALL _ | PREDEF_CALL _
+              | HAT _ | ARRAY | PRE | ARROW | FBY  | CONCAT -> (
                 (* retreive the soc of "expr" in soc_tbl *)
                 let soc : Soc.t =
                   let id = by_pos_op_to_soc_ident by_pos_op_flg.it in 
@@ -663,8 +655,6 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
       fun licprg node soc_tbl ->
         let io_list = node.Lic.inlist_eff @ node.Lic.outlist_eff in 
         let io_type = List.map (fun vi -> lic_to_soc_type vi.var_type_eff) io_list in
-        let soc_key = Ident.string_of_long2 (fst node.Lic.node_key_eff), io_type, None in
-
         let soc_key = make_soc_key_of_node_exp node.Lic.node_key_eff io_type in
         let lxm = node.Lic.lxm in
         let ctx = create_context licprg in
@@ -681,7 +671,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
                 b.eqs_eff
             in
             (* Construction des dépendances entre les expressions *)
-            let all_deps = ActionsDeps.build_data_deps_from_actions deps actions in
+            let all_deps = ActionsDeps.build_data_deps_from_actions lic_to_soc_type deps actions in
             Verbose.exe ~flag:dbg
               (fun () -> print_string (ActionsDeps.to_string all_deps); flush stdout);
             let actions = 
diff --git a/src/lic2soc.mli b/src/lic2soc.mli
index 4787a331..74705332 100644
--- a/src/lic2soc.mli
+++ b/src/lic2soc.mli
@@ -1,6 +1,7 @@
-(** Time-stamp: <modified the 07/03/2013 (at 18:16) by Erwan Jahier> *)
+(** Time-stamp: <modified the 02/04/2013 (at 15:46) by Erwan Jahier> *)
 
 
 val f: LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl
 
 val user_var_prefix:string
+val lic_to_soc_type: Lic.type_ -> Soc.var_type
diff --git a/src/licDump.ml b/src/licDump.ml
index 2ade5d3d..bf0573bc 100644
--- a/src/licDump.ml
+++ b/src/licDump.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/03/2013 (at 09:37) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:17) by Erwan Jahier> *)
 
 open Errors
 open Printf
@@ -103,7 +103,7 @@ and string_ident_of_const_eff c =
   match c with
     | Int_const_eff _
     | 
-Real_const_eff _ ->
+        Real_const_eff _ ->
       correct_num_string(string_of_const_eff c)
     | Bool_const_eff _
     | Extern_const_eff _
@@ -321,6 +321,10 @@ and (string_of_leff_list : Lic.left list -> string) =
       (String.concat ", " (List.map string_of_leff l)) ^ 
       (if List.length l = 1 then "" else ")") 
 
+and (array_of_size_one : Lic.val_exp -> bool) =
+  function 
+   | {ve_typ= [Array_type_eff(Bool_type_eff, size)] } -> size = 1
+   | _ -> assert false
 and sov ve = string_of_val_exp_eff ve
 and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> string) =
   fun posop vel -> 
@@ -339,10 +343,15 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st
             
         | CALL ({it=("Lustre","diese"),[]}), [ve1] 
         | PREDEF_CALL ({it=("Lustre","diese"),[]}), [ve1] ->
-          if !Global.lv4 
+          if !Global.lv4 && array_of_size_one ve1
           then sov ve1 (* lv4 does no accept to apply # on One var only! *)
-          else (("#") ^ (tuple_par [ve1]))
-            
+          else 
+            (("#") ^ (tuple_par [ve1]))
+
+        | CALL ({it=("Lustre","nor"),[]}), [ve1] 
+        | PREDEF_CALL ({it=("Lustre","nor"),[]}), [ve1] ->
+            (("nor") ^ (tuple_par [ve1]))
+              
         | CALL ({it=("Lustre","if"),[]}), [ve1; ve2; ve3] 
         | PREDEF_CALL ({it=("Lustre","if"),[]}), [ve1; ve2; ve3] ->
           let ve2str = string_of_val_exp_eff ve2 in 
@@ -394,7 +403,7 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st
             (if is_a_tuple ve1 then tuple_par [ve1] else string_of_val_exp_eff ve1)
             ^ " fby " ^ 
               (if is_a_tuple ve1 then tuple_par [ve2] else string_of_val_exp_eff ve2)
-        | WHEN clk, vel -> (tuple vel) ^ (string_of_clock_exp clk)
+        | WHEN clk, vel -> (tuple vel) ^ (string_of_clock clk)
 
         | CURRENT,_ -> "current " ^ tuple_par vel 
         | TUPLE,_ -> (tuple vel)
@@ -644,9 +653,9 @@ and (string_of_ident_clk : Ident.clk -> string) =
   fun clk -> 
     let (cc,v) = clk in
     let clk_exp_str =
-      match Ident.string_of_idref cc with
-        | "True" -> (Ident.to_string v)
-        | "False" ->  "not " ^ (Ident.to_string v)
+      match cc with
+        | "Lustre","true" -> (Ident.to_string v)
+        | "Lustre","false" ->  "not " ^ (Ident.to_string v)
         | _ -> 
 (*             if !Global.lv4 then  *)
 (*               raise (Errors.Global_error  *)
@@ -662,8 +671,8 @@ and (string_of_ident_clk : Ident.clk -> string) =
 and string_of_clock2 (ck : Lic.clock) =
   match ck with
     | BaseLic -> " on base"
-    | On(clk_exp,ceff) ->
-        let clk_exp_str = string_of_ident_clk clk_exp in
+    | On((cc,cv,_),ceff) ->
+        let clk_exp_str = string_of_ident_clk (cc,cv) in
           " on " ^ clk_exp_str ^ (string_of_clock2 ceff)
     | ClockVar i ->  "'a" ^ string_of_int i
         
@@ -671,8 +680,8 @@ and string_of_clock2 (ck : Lic.clock) =
 and string_of_clock (ck : Lic.clock) =
   match ck with
     | BaseLic -> ""
-    | On(clk_exp,_) -> 
-        let clk_exp_str = string_of_ident_clk clk_exp in
+    | On((cc,cv,_),_) -> 
+        let clk_exp_str = string_of_ident_clk (cc,cv) in
           " when " ^ clk_exp_str
     | ClockVar _ ->  
         "" (* it migth occur that (unused) constant remain with a clock var.
diff --git a/src/licEvalConst.ml b/src/licEvalConst.ml
index 53dbfa1e..cda7e9fa 100644
--- a/src/licEvalConst.ml
+++ b/src/licEvalConst.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/03/2013 (at 09:44) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 15:14) by Erwan Jahier> *)
 
 open AstPredef
 open Lic
@@ -25,8 +25,8 @@ let ios = int_of_string
 let (arity_error_const : Lic.const list -> string -> 'a) =
   fun v expect -> 
     raise (EvalConst_error(
-             Printf.sprintf "\n*** arity error: %d argument%s, whereas %s were expected"
-               (List.length v) (if List.length v>1 then "s" else "") expect))
+      Printf.sprintf "\n*** arity error : %d argument%s, whereas %s were expected"
+        (List.length v) (if List.length v>1 then "s" else "") expect))
     
 
 let (bbb_evaluator:(bool -> bool -> bool) -> const_evaluator) =
diff --git a/src/licEvalType.ml b/src/licEvalType.ml
index 9aa140e9..2da4bd58 100644
--- a/src/licEvalType.ml
+++ b/src/licEvalType.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 02/04/2013 (at 10:18) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 15:32) by Erwan Jahier> *)
 
 open AstPredef
 open Lxm
@@ -43,9 +43,9 @@ let raise_type_error
     )
 
 let raise_arity_error (msg:string) (get:int) (expect:int) =
-    raise (EvalType_error(
-           Printf.sprintf "\n*** arity error%s: %d argument%s, whereas %d were expected"
-               msg get (if get>1 then "s" else "") expect))
+  raise (EvalType_error(
+    Printf.sprintf "\n*** arity error%s: %d argument%s, whereas %d were expected"
+      msg get (if get>1 then "s" else "") expect))
 
 (*********************************************************************************)
 (* a few local alias to make the node profile below more readable. *)
@@ -384,6 +384,16 @@ let f (id_solver: IdSolver.t) (op: op) (lxm: Lxm.t) : typer = fun ll ->
                 (type_error (List.flatten [[Bool_type_eff]; t; e]) "bool*any*any")
             | x -> (raise_arity_error "" (List.length x) 3)
         )
+        | (NOR_n | DIESE_n) -> 
+          (* VERRUE 2 : cannot check the arity for them. *)
+          let check_nary_iter acc ceff =
+            match ceff with 
+              | Array_type_eff(Bool_type_eff,_) -> acc
+              | Bool_type_eff -> acc 
+              | _ -> (type_error [ceff] "bool")
+          in
+          List.fold_left check_nary_iter () (List.flatten ll);
+          [Bool_type_eff]
         | _ -> 
           (* general case *)
           let node_eff = make_node_exp_eff id_solver (Some false) op lxm in
diff --git a/src/main.ml b/src/main.ml
index abcb7c69..3ee33f6c 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 18/03/2013 (at 17:30) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 15:10) by Erwan Jahier> *)
 
 
 
@@ -81,7 +81,9 @@ let (get_source_list : string list -> AstV6.pack_or_model list) =
          absolute paths solves the problem.
          
       *)
-      let make_it_absolute f = if Filename.is_relative f then Filename.concat (Sys.getcwd ()) f else f in
+      let make_it_absolute f = 
+        if Filename.is_relative f then Filename.concat (Sys.getcwd ()) f else f 
+      in
       List.map make_it_absolute infile_list
     in
     let first_file = assert (infile_list <> []); List.hd infile_list in
@@ -145,6 +147,12 @@ let my_exit i =
   if Sys.file_exists !Global.outfile then Sys.remove !Global.outfile;
   exit i
 
+let rec first_pack_in =
+  function
+    | (AstV6.NSPack pi)::_ -> pi.it.pa_name
+    | (AstV6.NSModel _)::tail -> first_pack_in tail
+    | [] -> raise (Global_error "No package has been provided")
+
 let main = (
   (* Compile.init_appli () ; *)
   (* parse_args (); *)
@@ -160,6 +168,9 @@ let main = (
     MainArgs.usage stderr args;
     exit 1
   );
+  let new_dft_pack = Filename.basename (Filename.chop_extension (List.hd !Global.infiles)) in
+  Ident.set_dft_pack_name new_dft_pack;
+
   let main_node = 
     if !Global.main_node = "" then None else 
       Some (Ident.idref_of_string !Global.main_node)
diff --git a/src/parser.mly b/src/parser.mly
index 21deda83..e528a78f 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -844,12 +844,12 @@ MergeCase:
         ;
 
 ClockExpr:
-    Ident TK_OPEN_PAR Ident TK_CLOSE_PAR 
-                   { (make_clock_exp (Lxm.str $1) $3) }
-  |        Ident { (make_clock_exp ("True")  $1) }
-  | TK_NOT Ident { (make_clock_exp ("False") $2) }
+    IdentRef TK_OPEN_PAR Ident TK_CLOSE_PAR 
+                   { (make_clock_exp $1.it $3) }
+  |        Ident { (make_clock_exp (Ident.idref_of_string "Lustre::true")  $1) }
+  | TK_NOT Ident { (make_clock_exp (Ident.idref_of_string "Lustre::false") $2) }
   | TK_NOT TK_OPEN_PAR Ident TK_CLOSE_PAR
-                   { (make_clock_exp ("False") $3) }
+                   { (make_clock_exp (Ident.idref_of_string "Lustre::false") $3) }
   ;
 
 PredefOp: /* ebnf:print=short */
diff --git a/src/parserUtils.ml b/src/parserUtils.ml
index 55365893..a6f5258e 100644
--- a/src/parserUtils.ml
+++ b/src/parserUtils.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 07/02/2013 (at 10:24) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 14:16) by Erwan Jahier> *)
 
 (** *)
 
@@ -520,6 +520,6 @@ let (make_ident : Lxm.t -> pragma list -> Lxm.t) =
 
 (**********************************************************************************)
 
-let (make_clock_exp : string -> Lxm.t -> clock_exp) =
+let (make_clock_exp : Ident.idref -> Lxm.t -> clock_exp) =
   fun str v_lxm -> 
-    NamedClock( Lxm.flagit (Ident.idref_of_string str, (Lxm.id v_lxm)) v_lxm)
+    NamedClock( Lxm.flagit (Ident.long_of_idref str, (Lxm.id v_lxm)) v_lxm)
diff --git a/src/soc.ml b/src/soc.ml
index 21c0ed49..443a7441 100644
--- a/src/soc.ml
+++ b/src/soc.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 29/03/2013 (at 15:45) by Erwan Jahier> *)
+(* Time-stamp: <modified the 02/04/2013 (at 15:00) by Erwan Jahier> *)
 
 (** Synchronous Object Component *)
 
@@ -46,7 +46,7 @@ type atomic_operation =
 
 (* Guarded Atomic Operation *)
 type gao =
-  | Case of ident  (* enum var *) * (ident  (* enum value *) * gao list) list
+  | Case of ident (* enum var *) * (ident (* enum value *) * gao list) list
   | Call of var_expr list * atomic_operation * var_expr list
          (* outputs       * op               * inputs *)
 
diff --git a/src/socExec.ml b/src/socExec.ml
index 25454425..37a9ba5c 100644
--- a/src/socExec.ml
+++ b/src/socExec.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 29/03/2013 (at 16:57) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 15:59) by Erwan Jahier> *)
 
 open Soc
 open SocExecValue
@@ -79,13 +79,12 @@ let rec (soc_step : Soc.step_method -> Soc.tbl -> Soc.t -> SocExecValue.ctx
           rctx := assign_expr !rctx a_in a_out);  (* a_out=a_n *)
         !rctx;
 
-
 and (do_gao :  Lxm.t -> Soc.tbl -> SocExecValue.ctx -> gao -> SocExecValue.ctx) =
   fun lxm soc_tbl ctx gao ->
     match gao with
       | Case(id, id_gao_l) -> (
         let id_val = get_enum id ctx in
-        let gaol = try List.assoc id_val id_gao_l  with Not_found -> assert false in
+        let gaol = try List.assoc id_val id_gao_l with Not_found -> assert false in
         List.fold_left (do_gao lxm soc_tbl) ctx gaol
       )
       | Call(vel_out, Assign, vel_in) -> List.fold_left2 assign_expr ctx vel_in vel_out
diff --git a/src/socExecEvalPredef.ml b/src/socExecEvalPredef.ml
index 0623740d..698a448c 100644
--- a/src/socExecEvalPredef.ml
+++ b/src/socExecEvalPredef.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 02/04/2013 (at 10:15) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 08:46) by Erwan Jahier> *)
 
 open SocExecValue
 open Soc
@@ -226,6 +226,14 @@ let lustre_concat ctx =
   in
   { ctx with s = sadd ctx.s vn vv }
 
+let lustre_current ctx =
+  let (vn,vv) = 
+    match ([get_val "x" ctx]) with
+      | [v]  -> "z"::ctx.cpath, v
+      | _  -> assert false
+  in
+  { ctx with s = sadd ctx.s vn vv }
+
 let lustre_hat tl ctx =
   let i = match tl with
     | [_;Soc.Array(_,i)] -> i
@@ -273,6 +281,8 @@ let (get: Soc.key -> (ctx -> ctx)) =
     | "Lustre::array" -> lustre_array tl
     | "Lustre::concat" -> lustre_concat
 
+    | "Lustre::current" -> lustre_current
+
     | "Lustre::nor" -> assert false (* ougth to be translated into boolred *)
     | "Lustre::diese" -> assert false (* ditto *)
     | _ -> raise Not_found
diff --git a/src/socExecValue.ml b/src/socExecValue.ml
index c7ac57bc..bf81b557 100644
--- a/src/socExecValue.ml
+++ b/src/socExecValue.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 29/03/2013 (at 16:55) by Erwan Jahier> *)
+(* Time-stamp: <modified the 02/04/2013 (at 16:12) by Erwan Jahier> *)
 
 open Soc
 
@@ -280,14 +280,16 @@ let (get_enum : ident -> ctx -> ident) =
 fun id ctx -> 
   match get_val id ctx with
     | E(e,_) -> e
-    | _ -> assert false (* should not fail *) 
+    | B true -> "true"
+    | B false -> "false"
+    | o -> assert false (* should not fail *) 
 
 let rec (get_value : ctx -> var_expr -> t) =
   fun ctx v -> 
     match v with
       | Var(id,_) -> get_val id ctx
-      | Const("true",Bool) ->  B true
-      | Const("false",Bool) -> B false
+      | Const("true",  Bool) -> B true
+      | Const("false", Bool) -> B false
       | Const(id_in,Int)  -> I (int_of_string id_in)
       | Const(id_in,Real) -> F (float_of_string id_in)
       | Const(id,Enum(_,idl)) -> E(id, pos_in_list 0 id idl)
diff --git a/src/socPredef.ml b/src/socPredef.ml
index f96d31f4..51ecf8b4 100644
--- a/src/socPredef.ml
+++ b/src/socPredef.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 02/04/2013 (at 10:20) by Erwan Jahier> *)
+(* Time-stamp: <modified the 03/04/2013 (at 15:51) by Erwan Jahier> *)
 
 (** Synchronous Object Code for Predefined operators. *)
 
@@ -106,10 +106,37 @@ let of_soc_key : Soc.key -> Soc.t =
       | "Lustre::xor" -> (make_soc sk (sp tl) [step21 None])
       | "Lustre::impl" -> (make_soc sk (sp tl) [step21 None])
         
-      | "Lustre::current" -> (make_soc sk (sp tl) [step11])
-
       (* Those have instances *)
-        
+      | "Lustre::current" -> (
+        let _,tl,_ = sk in
+        let t = List.hd tl in
+        let pre_mem:var = (get_mem_name sk t, t) in
+        let prof = sp tl in
+        let v1,vout = match prof with ([v1],[vout]) -> v1,vout | _ -> assert false in
+        {
+          key      = sk;
+          profile  = (sp tl);
+          instances = [];
+          have_mem = Some (t, None); (* so that pre_mem exist *)
+          step  = [
+            {
+              name    = "get";
+              lxm     = Lxm.dummy "predef soc";
+              idx_ins  = [];
+              idx_outs = [0];
+              impl    = Gaol([pre_mem],[Call([Var(vout)], Assign, [Var(pre_mem)])]);
+            };
+            {
+              name    = "set";  
+              lxm     = Lxm.dummy "predef soc";
+              idx_ins  = [0];
+              idx_outs = [];
+              impl    = Gaol([pre_mem],[Call([Var(pre_mem)], Assign, [Var(v1)])]);
+            };
+          ];
+          precedences = ["get", ["set"]];
+        }
+      )  
       | "Lustre::pre" ->  
         let _,tl,_ = sk in
         let t = List.hd tl in
diff --git a/src/socUtils.ml b/src/socUtils.ml
index ecd20726..de0bcd0a 100644
--- a/src/socUtils.ml
+++ b/src/socUtils.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 29/03/2013 (at 16:05) by Erwan Jahier> *)
+(** Time-stamp: <modified the 02/04/2013 (at 11:07) by Erwan Jahier> *)
 
 
 open Soc
@@ -175,6 +175,7 @@ let string_of_method_ff: (Soc.t -> step_method -> Format.formatter -> unit) = fu
 
   match m.impl with
     | Predef -> fprintf ff "@]@]"
+    | Boolred _ -> assert false (* todo *)
     | Iterator _ -> assert false (* todo *)
     | Gaol (locals, gaos) ->
           fprintf ff ": {@;";
diff --git a/src/unifyClock.ml b/src/unifyClock.ml
index 233bc279..96a5d666 100644
--- a/src/unifyClock.ml
+++ b/src/unifyClock.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/03/2013 (at 10:04) by Erwan Jahier> *)
+(* Time-stamp: <modified the 02/04/2013 (at 15:59) by Erwan Jahier> *)
 
 
 open LicDump
@@ -165,10 +165,10 @@ let rec (apply_subst:subst -> Lic.clock -> Lic.clock) =
   fun (s1,s2) c ->
     match c with
       | BaseLic -> BaseLic
-      | On((cc,cv),clk) ->
+      | On((cc,cv,ct),clk) ->
 	     let cv = match find_subst1 cv s1 with Some cv2 -> cv2 | None -> cv in
         let clk = apply_subst (s1,s2) clk in
-	     On((cc,cv),  clk)
+	     On((cc,cv,ct),  clk)
       | ClockVar i ->
         match find_subst2 i s2 with
           | Some clk -> apply_subst (s1,s2) clk
@@ -228,7 +228,7 @@ let (f : Lxm.t -> subst -> Lic.clock -> Lic.clock -> subst) =
 	        the error message is issued outside [aux] (just below).
 	     *)
 	     | BaseLic, BaseLic -> (s1,s2) (* ok *)
-	     | On((cc1,cv1), clk1), On((cc2,cv2), clk2) ->
+	     | On((cc1,cv1,_), clk1), On((cc2,cv2,_), clk2) ->
 	       let s1 = if cv1 = cv2 then s1 else add_subst1 cv2 cv1 s1 in
 	       aux (s1,s2) (clk1, clk2)
 	     | ClockVar i, ClockVar j ->
diff --git a/test/lus2lic.log.ref b/test/lus2lic.log.ref
index 375f4569..ed6b3eae 100644
--- a/test/lus2lic.log.ref
+++ b/test/lus2lic.log.ref
@@ -1,4 +1,4 @@
-Test Run By jahier on Thu Feb  7 16:15:01 2013
+Test Run By jahier on Wed Apr  3 15:41:46 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
@@ -1637,7 +1637,7 @@ spawn ./lus2lic -o /tmp/bad_id.lic should_fail/clock/bad_id.lus
 
 XFAIL: Test bad programs (clock): lus2lic {-o /tmp/bad_id.lic should_fail/clock/bad_id.lus}
 spawn ./lus2lic -o /tmp/clock2.lic should_fail/clock/clock2.lus
-*** Error in file "/home/jahier/lus2lic/test/should_fail/clock/clock2.lus", line 6, col 21 to 21, token 'a':
+*** Error in file "/home/jahier/lus2lic/test/should_fail/clock/clock2.lus", line 6, col 16 to 19, token 'when':
 *** the type of a clock cannot be int
 
 XFAIL: Test bad programs (clock): lus2lic {-o /tmp/clock2.lic should_fail/clock/clock2.lus}
@@ -1727,7 +1727,7 @@ spawn ./lus2lic -o /tmp/m.lic should_fail/semantics/m.lus
 *** syntax error
 
 XFAIL: Test bad programs (semantics): lus2lic {-o /tmp/m.lic should_fail/semantics/m.lus}
-testcase ./lus2lic.tests/non-reg.exp completed in 24 seconds
+testcase ./lus2lic.tests/non-reg.exp completed in 60 seconds
 Running ./lus2lic.tests/progression.exp ...
 spawn ./lus2lic -o /tmp/when_not.out should_work/broken/when_not.lus
 PASS: ./lus2lic {    -o /tmp/when_not.out should_work/broken/when_not.lus}
@@ -1764,7 +1764,7 @@ spawn ./lus2lic -o /tmp/activation1.lic should_fail/semantics/broken/activation1
 XPASS: Test bad programs (semantics): lus2lic {-o /tmp/activation1.lic should_fail/semantics/broken/activation1.lus}
 spawn ./lus2lic -o /tmp/bug.lic should_fail/semantics/broken/bug.lus
 XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/semantics/broken/bug.lus}
-testcase ./lus2lic.tests/progression.exp completed in 0 seconds
+testcase ./lus2lic.tests/progression.exp completed in 1 seconds
 
 		=== lus2lic Summary ===
 
@@ -1772,4 +1772,4 @@ testcase ./lus2lic.tests/progression.exp completed in 0 seconds
 # of unexpected failures	2
 # of unexpected successes	11
 # of expected failures		37
-runtest completed at Thu Feb  7 16:15:25 2013
+runtest completed at Wed Apr  3 15:42:47 2013
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index 507cea7e..95b1048f 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,4 +1,4 @@
-Test Run By jahier on Fri Mar 29 16:59:38 2013
+Test Run By jahier on Wed Apr  3 15:41:46 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
diff --git a/todo.org b/todo.org
index b7d9190a..7a87f475 100644
--- a/todo.org
+++ b/todo.org
@@ -2,8 +2,6 @@
 #+CATEGORY: lv6
 
 * lus2lic -exec
-** TODO meta operateurs
-   - State "TODO"       from ""           [2013-03-19 Tue 10:33]
 ** TODO Unifier les modules Data de Lustre V6 et Lutin
    - State "TODO"       from ""           [2013-04-02 Tue 08:33]
 
@@ -30,17 +28,15 @@ que de lancer luciole
 --auto-stubs
 
 
-** TODO Traiter la fleche plus proprement.
-   - State "TODO"       from ""           [2013-04-02 Tue 08:33]
 ** TODO Écrire un test qui mette en jeu exhaustivement tous les operateurs
    - State "TODO"       from ""           [2013-03-19 Tue 10:38]
 
 
+** TODO Traiter la fleche plus proprement.
+   - State "TODO"       from ""           [2013-04-02 Tue 08:33]
 
 ** TODO condact, merge
    - State "TODO"       from ""           [2013-03-19 Tue 10:33]
-** TODO when, current
-   - State "TODO"       from ""           [2013-03-19 Tue 10:33]
 ** TODO fonctions externes 
    - State "TODO"       from ""           [2013-03-19 Tue 10:33]
 ** TODO Découper un peu les fonctions dans src/lic2soc.ml
diff --git a/todo.org_archive b/todo.org_archive
index f7c2dc6b..56aef140 100644
--- a/todo.org_archive
+++ b/todo.org_archive
@@ -547,6 +547,26 @@ XXX essayer de virer le constructeur Oper qui n'a pas l'air de servir à grand c
   :ARCHIVE_CATEGORY: lv6
   :ARCHIVE_TODO: TODO
   :END:
+* TODO meta operateurs
+  - State "TODO"       from ""           [2013-03-19 Tue 10:33]
+  :PROPERTIES:
+  :ARCHIVE_TIME: 2013-04-02 Tue 10:37
+  :ARCHIVE_FILE: ~/lus2lic/todo.org
+  :ARCHIVE_OLPATH: lus2lic -exec
+  :ARCHIVE_CATEGORY: lv6
+  :ARCHIVE_TODO: TODO
+  :END:
+* TODO when, current
+  - State "TODO"       from ""           [2013-03-19 Tue 10:33]
+  :PROPERTIES:
+  :ARCHIVE_TIME: 2013-04-03 Wed 08:50
+  :ARCHIVE_FILE: ~/lus2lic/todo.org
+  :ARCHIVE_OLPATH: lus2lic -exec
+  :ARCHIVE_CATEGORY: lv6
+  :ARCHIVE_TODO: TODO
+  :END:
+
+
 
 
 
-- 
GitLab