From 8245d562e746817a859f12ddf1460305c3a50657 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Wed, 4 Feb 2009 16:22:19 +0100
Subject: [PATCH] Fix a bug in Lazycompiler.solve_x_idref.

When a node P::n1 wants to access to a node P::n2, it is ok to
search for it in the boby of P.
---
 Makefile                                      |    2 +-
 release-lv6/Makefile                          |   14 +-
 src/eff.ml                                    |    2 +-
 src/getEff.ml                                 |    2 +-
 src/ident.mli                                 |    6 +-
 src/inline.ml                                 |    2 +-
 src/lazyCompiler.ml                           |   17 +-
 src/licDump.ml                                |    2 +-
 src/predefEvalType.ml                         |    2 +-
 src/symbolTab.ml                              |   10 +-
 src/test/should_work/NONREG/Int.lus           |    1 +
 .../should_work/lionel/remplissage-1.0.lus    |  269 ++++
 src/test/test.res.exp                         | 1284 +++++++++++++++++
 13 files changed, 1591 insertions(+), 22 deletions(-)
 create mode 100644 src/test/should_work/lionel/remplissage-1.0.lus

diff --git a/Makefile b/Makefile
index fa7ec4f4..a910c20c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 
 
 all:
-	cd src; make ; make test
+	cd src; make nc ; make test
 
 .PHONY: diff test log
 
diff --git a/release-lv6/Makefile b/release-lv6/Makefile
index aafdeec1..78749095 100644
--- a/release-lv6/Makefile
+++ b/release-lv6/Makefile
@@ -1,8 +1,14 @@
 
-RELNAME_PREFIX=lv6-alpha-
-RELNAME=$(RELNAME_PREFIX)$(shell date +%d-%m-%y)-$(shell uname)
-LUS2LICDIR=~/lus2lic
+
 LIC2CDIR=~/lic2loc
+LUS2LICDIR=~/lus2lic/
+LUS2LIC=$(LUS2LICDIR)/src/lus2lic
+
+VERSION=R0.$(shell $(LUS2LIC) -version  | cut -d "." -f 2)
+
+RELNAME_PREFIX=lv6-alpha-$(VERSION)-
+RELNAME=$(RELNAME_PREFIX)$(shell date +%d-%m-%y)-$(shell uname)
+
 
 
 all: dir doc lus2lic lic2c test_files
@@ -17,7 +23,7 @@ doc:
 
 lus2lic:
 	cd $(LUS2LICDIR)/src ; make clean ; make nc
-	cp $(LUS2LICDIR)/src/lus2lic $(RELNAME)/bin/
+	cp $(LUS2LIC) $(RELNAME)/bin/
 
 lic2c:
 	cd $(LIC2CDIR)/src/ ; make clean ; make nc
diff --git a/src/eff.ml b/src/eff.ml
index 7abb869f..a7f8d534 100644
--- a/src/eff.ml
+++ b/src/eff.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 28/01/2009 (at 10:33) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 15:26) by Erwan Jahier> *)
 
 (** 
 
diff --git a/src/getEff.ml b/src/getEff.ml
index 66e2999b..f24e5239 100644
--- a/src/getEff.ml
+++ b/src/getEff.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 03/02/2009 (at 16:41) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 15:27) by Erwan Jahier> *)
 
 
 open Lxm
diff --git a/src/ident.mli b/src/ident.mli
index a12499f2..5c93d685 100644
--- a/src/ident.mli
+++ b/src/ident.mli
@@ -1,8 +1,8 @@
-(** Time-stamp: <modified the 27/01/2009 (at 16:57) by Erwan Jahier> *)
+(** Time-stamp: <modified the 03/02/2009 (at 17:50) by Erwan Jahier> *)
 
 
-type t
-type long
+type t = string
+type long = t * t
 type pack_name
 
 val to_string : t -> string
diff --git a/src/inline.ml b/src/inline.ml
index 77e51fee..c32d36e0 100644
--- a/src/inline.ml
+++ b/src/inline.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 03/02/2009 (at 16:23) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 15:27) by Erwan Jahier> *)
 
 
 open Lxm
diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml
index d03eba85..e6e83f3f 100644
--- a/src/lazyCompiler.ml
+++ b/src/lazyCompiler.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 03/02/2009 (at 17:21) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 15:27) by Erwan Jahier> *)
 
 
 open Lxm
@@ -224,26 +224,29 @@ let (lookup_node_exp_eff:
     from a « provide » part or not.
 *)
 let solve_x_idref
-    x_check_interface x_check find_x x_label to_x_key this symbols 
+    x_check_interface x_check find_x x_label to_x_key this symbols
     provide_flag currpack idr sargs lxm =
   let s = Ident.name_of_idref idr in
     match Ident.pack_of_idref idr with
-      | Some p -> x_check_interface this (to_x_key p s) lxm
+      | Some p -> 
+          if p = currpack 
+          then x_check this (to_x_key currpack s) lxm
+          else x_check_interface this (to_x_key p s) lxm
       | None ->
           (* no pack name: it must be in the symbols table *)
           try
             match (find_x symbols s lxm) with
-              | SymbolTab.Local x_info -> 
-                  if provide_flag 
+              | SymbolTab.Local x_info ->
+                  if provide_flag
                   then x_check_interface this (to_x_key currpack s) lxm
                   else x_check this (to_x_key currpack s) lxm
 
-              | SymbolTab.Imported(fid,params) -> 
+              | SymbolTab.Imported(fid,params) ->
                   let (pi,si) = (Ident.pack_of_long fid, Ident.of_long fid) in
                     assert(params=[]); (* todo *)
                     x_check_interface this (to_x_key pi si) lxm
 
-          with Not_found -> 
+          with Not_found ->
             (raise (Compile_error(lxm,"unbounded " ^ x_label ^ " ident")))
 
 
diff --git a/src/licDump.ml b/src/licDump.ml
index 9eaae95d..ffe3cb31 100644
--- a/src/licDump.ml
+++ b/src/licDump.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 02/02/2009 (at 11:15) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 15:26) by Erwan Jahier> *)
 
 open Printf
 open Lxm
diff --git a/src/predefEvalType.ml b/src/predefEvalType.ml
index 1b1ca12c..434a9946 100644
--- a/src/predefEvalType.ml
+++ b/src/predefEvalType.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 03/02/2009 (at 16:56) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 15:26) by Erwan Jahier> *)
 
 open Predef
 open Lxm
diff --git a/src/symbolTab.ml b/src/symbolTab.ml
index 76973ac0..02eca2e1 100644
--- a/src/symbolTab.ml
+++ b/src/symbolTab.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 15/09/2008 (at 18:09) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2009 (at 11:04) by Erwan Jahier> *)
 
 (*
 Sous-module pour SyntaxTab 
@@ -61,7 +61,13 @@ let find_node (this: t) (id: Ident.t) lxm =
       raise (Global_error("Can not find node " ^ (Ident.to_string id)^
 			    " in " ^ (Lxm.file lxm)))
     else
-      raise (Compile_error(lxm, "unknown node (" ^ (Ident.to_string id)^")"))
+      let all_nodes = 
+        Hashtbl.fold (fun n _ acc -> (Ident.to_string n)::acc) this.st_nodes [] 
+      in
+      let msg = "unknown node: " ^ (Ident.to_string id)^"\n" ^ 
+        "*** known nodes are: " ^ (String.concat ", " all_nodes) ^ "\n"
+      in
+        raise (Compile_error(lxm, msg))
 
 
 (* Manip de SymbolTab.t *)
diff --git a/src/test/should_work/NONREG/Int.lus b/src/test/should_work/NONREG/Int.lus
index d41add5e..cf11b0e2 100644
--- a/src/test/should_work/NONREG/Int.lus
+++ b/src/test/should_work/NONREG/Int.lus
@@ -7,6 +7,7 @@ model Int
    const zero: Int;
    function incr (x: Int) returns (incr: Int);
    function add (x,y: Int) returns (sum: Int);
+--   function fulladd(ci, x, y: bool) returns (s, co: bool);
 
  body
    type Int = bool^n;
diff --git a/src/test/should_work/lionel/remplissage-1.0.lus b/src/test/should_work/lionel/remplissage-1.0.lus
new file mode 100644
index 00000000..9b41bfdc
--- /dev/null
+++ b/src/test/should_work/lionel/remplissage-1.0.lus
@@ -0,0 +1,269 @@
+package util
+
+provides
+
+node observer(dataBoiteCP_IN, 
+              localDataFromRead, 
+              localErasedDataFromBoiteCP, 
+              localCopyedDataFromBoiteCP, 
+              localErasedDataFromPilote, 
+              localCopyedDataFromPilote, 
+              localErasedDataFromMem, 
+              localCopyedDataFromMem : int; 
+              productionEvent, 
+              consumptionEvent, 
+              eraseMemEvent,
+              eraseBoiteCPEvent, 
+              erasePiloteEvent, 
+              copyBoiteCPEvent,
+              copyPiloteEvent, 
+              copyMemEvent : bool) 
+returns (retard, indiceCount : int; HindiceCount : bool);
+
+
+body
+
+type accChangeTab = {numEvent : int; cpt : int; indice : int};
+
+node change_tab2(tabIn : int^10;
+                indiceIn : int;
+                num_event : int)
+returns (tabOut : int^10);
+var accOut : accChangeTab;
+let 
+  accOut, tabOut = 
+    fillred<<change_elt2, 10>>(accChangeTab{numEvent = num_event; cpt = 0; indice = indiceIn}, tabIn);
+tel
+
+
+
+node change_elt2(accIn : accChangeTab; 
+                 --num_event : int; 
+                 --cptOut : int; 
+                 --indiceIn : int; 
+                 eltIn : int) 
+returns (accOut : accChangeTab;
+         --num_event : int; 
+         --cptOut : int; 
+         --indiceIn : int; 
+         eltOut : int);
+let
+  eltOut = if(accIn.indice = accIn.cpt)
+           then if accIn.numEvent=0
+                then 1 
+                else if accIn.numEvent=1 or accIn.numEvent=3 or accIn.numEvent=7
+                     then eltIn-1
+                     else if accIn.numEvent=2 or accIn.numEvent=4 or accIn.numEvent=6
+                          then eltIn+1
+                          else eltIn
+           else eltIn;
+
+  accOut = accChangeTab{numEvent = accIn.numEvent; 
+                        indice = accIn.indice;
+                        cpt = accIn.cpt+1};
+
+tel
+
+
+
+
+type accObserver = {nbCopy : int^10; 
+                    indice : int};
+
+
+node observer(dataBoiteCP_IN, 
+              localDataFromRead, 
+              localErasedDataFromBoiteCP, 
+              localCopyedDataFromBoiteCP, 
+              localErasedDataFromPilote, 
+              localCopyedDataFromPilote, 
+              localErasedDataFromMem, 
+              localCopyedDataFromMem : int; 
+              productionEvent, 
+              consumptionEvent, 
+              eraseMemEvent,
+              eraseBoiteCPEvent, 
+              erasePiloteEvent, 
+              copyBoiteCPEvent,
+              copyPiloteEvent, 
+              copyMemEvent : bool) 
+returns (retard, indiceCount : int; HindiceCount : bool);
+var 
+--  accIterOut : accObserver;--
+--  nbrCopy : int^10;  -- pour stocker le nombre de copies,  nbrCopy[i] : nb de copies dans le syst?me d'un donn?e identifi?e par "i"
+  CptRetard : int^10;  -- les horloges qui mesurent le retard correspondant ? chaque don?e (?)
+
+
+  numEvent_tab : bool^8;--
+  value_tab : int^8;--
+  nbrCopy : int^10;
+--  indiceBidon : int;
+let
+  numEvent_tab = [productionEvent, 
+                  consumptionEvent, 
+                  eraseMemEvent,
+                  copyMemEvent, 
+                  eraseBoiteCPEvent,  
+                  copyBoiteCPEvent,
+                  erasePiloteEvent,
+                  copyPiloteEvent
+                 ];
+  value_tab = [dataBoiteCP_IN, 
+               localDataFromRead, 
+               localErasedDataFromMem, 
+               localCopyedDataFromMem, 
+               localErasedDataFromBoiteCP, 
+               localCopyedDataFromBoiteCP, 
+               localErasedDataFromPilote, 
+               localCopyedDataFromPilote
+              ];
+
+  nbrCopy = updateNbrCopy(numEvent_tab, value_tab);
+
+  CptRetard = updateCptRetard(nbrCopy);
+
+  retard = calculRetard(consumptionEvent, CptRetard, localDataFromRead);
+  
+  indiceCount, HindiceCount = updateIndice(nbrCopy);
+
+--   nbrCopy = for(i=0;i<8;i++){
+--     if num_event_tab[i]=true
+--     then nbrCopy = change_tab2(pre(nbrCopy), value_tab[i], i)
+--     else nbrCopy = pre(nbrCopy)
+--   }
+tel
+
+
+
+type tIterRetard = {conEvent : bool; 
+                    dataFromRead : int; 
+                    retardCalcule : int; 
+                    cpt : int};
+
+
+
+
+node calculRetard(consumptionEvent : bool; 
+                  CptRetard : int^10; 
+                  localDataFromRead : int)
+returns (retard : int);
+var accOut : tIterRetard;
+let
+  accOut = red<<updateRetard;10>>(tIterRetard{conEvent = consumptionEvent; 
+                                   dataFromRead = localDataFromRead; 
+                                   retardCalcule = -1;
+                                   cpt = 0}, 
+                       CptRetard);
+  retard = accOut.retardCalcule;
+tel
+
+
+node updateRetard(accIn : tIterRetard; elt : int) returns (accOut : tIterRetard);
+let
+  accOut = tIterRetard{conEvent = accIn.conEvent;
+                       dataFromRead = accIn.dataFromRead;
+                       retardCalcule = -1 -> if accIn.conEvent and accIn.cpt=accIn.dataFromRead
+                                             then elt
+                                             else -1;
+                       cpt = accIn.cpt+1};
+tel
+
+
+
+
+
+
+node updateNbrCopy(numEvent_tab : bool^8;
+                   value_tab : int^8)
+returns (nbrCopy : int^10);
+var accIterOut : accObserver;
+let
+  accIterOut = accObserver{nbCopy = (-1)^10;
+                           indice =  0} 
+                -> red<<Niter;8>>(accObserver{
+                                              nbCopy = pre(accIterOut.nbCopy);
+                                              indice = 0
+                                  }, 
+                                  numEvent_tab, value_tab);
+  nbrCopy = accIterOut.nbCopy;
+tel
+
+
+node Niter(accIn : accObserver;
+           --{tabIn : int^10; 
+           -- indice : int;
+           --}; 
+            numEvent : bool;
+            value_tab : int)
+returns (accOut : accObserver);
+         --{tabOut : int^10;
+         -- indiceOut : int;
+         --})
+let 
+  accOut = accObserver{nbCopy = if numEvent 
+                                then change_tab2(accIn.nbCopy, value_tab, accIn.indice) 
+                                else accIn.nbCopy;
+                       indice = accIn.indice+1};
+tel
+
+
+
+--   indCount = -1 -> if consumptionEvent and (nbrCopy[localDataFromRead]=0)
+-- 	      then localDataFromRead
+-- 	      else -1;
+
+--   HrinsCount = false ->  consumptionEvent and (nbrCopy[localDataFromRead]=0)
+
+
+type tCounterIter = {indice : int; Hindice : bool; cpt : int};
+
+
+
+
+
+node updateIndice(nbrCopy : int^10)
+returns (indiceCount : int;
+         HindiceCount : bool);
+var iterOut : tCounterIter;
+let
+  iterOut = red<<countIter;10>>(tCounterIter{indice = -1 ; Hindice = false; cpt = 0}, nbrCopy);
+  indiceCount = iterOut.indice;
+  HindiceCount = iterOut.Hindice;
+tel
+
+node countIter(accIn : tCounterIter; eltCopy : int) 
+returns (accOut : tCounterIter);
+let
+  accOut = if pre(eltCopy<>-1) and pre(eltCopy<>0) and eltCopy=0
+           then tCounterIter{indice = accIn.cpt;
+                              Hindice = true;
+                              cpt = accIn.cpt+1}
+           else tCounterIter{indice = accIn.indice;
+                              Hindice = accIn.Hindice;
+                              cpt = accIn.cpt+1};
+tel
+
+
+
+
+-----------
+node updateCptRetard(nbrCopy : int^10) 
+returns (CptRetard : int^10);
+let
+  CptRetard = (-1)^10 -> map<<checkCopy;10>>(nbrCopy, pre(CptRetard));
+tel
+
+
+
+
+node checkCopy(eltCopy : int; oldCptRetard : int) returns (newCptRetard : int);
+let
+  newCptRetard = if(pre(eltCopy=-1) and eltCopy=1)
+                 then 0
+                 else if pre(eltCopy<>-1) and pre(eltCopy<>0) and eltCopy=0
+                      then -1
+                      else oldCptRetard+1;
+tel
+
+
+end
\ No newline at end of file
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index 8779c2a5..9699aaf3 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -17831,6 +17831,915 @@ type A_A_bool_20_4 = A_bool_20^4;
 type A_A_int_20_4 = A_int_20^4;
 type A_int_20 = int^20;
 ----------------------------------------------------------------------
+====> ../lus2lic -vl 2 should_work/lionel/pilote-1.0.lus
+Opening file should_work/lionel/pilote-1.0.lus
+const pilote::periodePilote = 5;
+const pilote::periodeCapt = 10;
+const pilote::periodeAppli = 20;
+const pilote::periodeDureePilote = 2;
+const pilote::periodeDureeAppli = 7;
+
+node pilote::ctrl(
+	in:bool) 
+returns (
+	Hcapt:bool;
+	Hpilote:bool;
+	Happli:bool);
+var
+   cptC:int;
+   cptP:int;
+   cptA:int;
+   cptDureeP:int;
+   cptDureeA:int;
+   countDP:bool;
+   countDA:bool;
+   Hduree_pilote:bool;
+   Hduree_appli:bool;
+   _v1:int;
+   _v2:bool;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v6:int;
+   _v7:bool;
+   _v8:bool;
+   _v9:bool;
+   _v10:bool;
+   _v11:int;
+   _v12:int;
+   _v13:int;
+   _v14:int;
+   _v15:int;
+   _v16:int;
+   _v17:int;
+   _v18:bool;
+   _v19:int;
+   _v20:int;
+   _v21:int;
+   _v22:int;
+   _v23:bool;
+   _v24:int;
+   _v25:int;
+   _v26:int;
+   _v27:int;
+   _v28:bool;
+   _v29:int;
+   _v30:int;
+   _v31:int;
+let
+   Hpilote = cptP = 5;
+   Hcapt = cptC = 10;
+   Happli = cptA = 20;
+   Hduree_pilote = cptDureeP = 2;
+   Hduree_appli = cptDureeA = 7;
+   countDP = false -> _v5;
+   _v1 = pre cptDureeP;
+   _v2 = _v1 = 2;
+   _v3 = pre countDP;
+   _v4 =  if _v2 then false else _v3;
+   _v5 =  if Hpilote then true else _v4;
+   countDA = false -> _v10;
+   _v6 = pre cptDureeA;
+   _v7 = _v6 = 7;
+   _v8 = pre countDA;
+   _v9 =  if _v7 then false else _v8;
+   _v10 =  if Happli then true else _v9;
+   cptDureeP = 1 -> _v13;
+   _v11 = pre cptDureeP;
+   _v12 = _v11 + 1;
+   _v13 =  if countDP then _v12 else 1;
+   cptDureeA = 1 -> _v16;
+   _v14 = pre cptDureeA;
+   _v15 = _v14 + 1;
+   _v16 =  if countDA then _v15 else 1;
+   cptC = 1 -> _v21;
+   _v17 = pre cptC;
+   _v18 = _v17 = 10;
+   _v19 = pre cptC;
+   _v20 = _v19 + 1;
+   _v21 =  if _v18 then 1 else _v20;
+   cptP = 1 -> _v26;
+   _v22 = pre cptP;
+   _v23 = _v22 = 5;
+   _v24 = pre cptP;
+   _v25 = _v24 + 1;
+   _v26 =  if _v23 then 1 else _v25;
+   cptA = 1 -> _v31;
+   _v27 = pre cptA;
+   _v28 = _v27 = 20;
+   _v29 = pre cptA;
+   _v30 = _v29 + 1;
+   _v31 =  if _v28 then 1 else _v30;
+tel
+-- end of node pilote::ctrl
+type _pilote::tUpdateCntElt = struct  {indCnt : int; HrinstCnt : bool; Hcap : bool; locCnt : int; i : int; locCntFound : bool};
+
+node pilote::udpateCntElt(
+	accIn:_pilote::tUpdateCntElt;
+	eltIn:bool) 
+returns (
+	accOut:_pilote::tUpdateCntElt;
+	eltOut:bool);
+var
+   _v1:int;
+   _v2:int;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v19:bool;
+   _v20:bool;
+   _v21:bool;
+   _v22:bool;
+   _v17:int;
+   _v18:int;
+   _v9:bool;
+   _v10:bool;
+   _v11:bool;
+   _v12:bool;
+   _v13:bool;
+   _v14:int;
+   _v15:int;
+   _v16:int;
+   _v8:bool;
+   _v7:bool;
+   _v6:int;
+let
+   eltOut =  if _v5 then true else eltIn;
+   _v1 = accIn.i;
+   _v2 = accIn.indCnt;
+   _v3 = _v1 = _v2;
+   _v4 = accIn.HrinstCnt;
+   _v5 = _v3 and _v4;
+    accOut =
+	 _pilote::tUpdateCntElt{indCnt=_v6;HrinstCnt=_v7;Hcap=_v8;locCnt=_v16;i=_v18;locCntFound=_v22};
+   _v19 = accIn.Hcap;
+   _v20 = eltIn and _v19;
+   _v21 = accIn.locCntFound;
+   _v22 = _v20 or _v21;
+   _v17 = accIn.i;
+   _v18 = _v17 + 1;
+   _v9 = accIn.Hcap;
+   _v10 = eltIn and _v9;
+   _v11 = accIn.locCntFound;
+   _v12 = not _v11;
+   _v13 = _v10 and _v12;
+   _v14 = accIn.i;
+   _v15 = accIn.locCnt;
+   _v16 =  if _v13 then _v14 else _v15;
+   _v8 = accIn.Hcap;
+   _v7 = accIn.HrinstCnt;
+   _v6 = accIn.indCnt;
+tel
+-- end of node pilote::udpateCntElt
+
+node pilote::updateCnt(
+	indCount:int;
+	HrinstCount:bool;
+	Hcapt:bool) 
+returns (
+	localCnt:int;
+	tab:A_bool_10);
+var
+   accOut:_pilote::tUpdateCntElt;
+   _v1:int;
+   _v2:_pilote::tUpdateCntElt;
+   _v3:A_bool_10;
+let
+   (accOut, tab) = fillred<<pilote::udpateCntElt, 10>>(_v2, _v3);
+   _v1 = -1;
+    _v2 =
+	 _pilote::tUpdateCntElt{indCnt=indCount;HrinstCnt=HrinstCount;Hcap=Hcapt;locCnt=_v1;i=0;locCntFound=false};
+   _v3 = false^10;
+   localCnt = accOut.locCnt;
+tel
+-- end of node pilote::updateCnt
+
+node pilote::capt(
+	Hcapt:bool;
+	HrinstCount:bool;
+	indCount:int) 
+returns (
+	dataPUT:bool;
+	stampedData:int;
+	productionEvent:bool);
+var
+   localCnt:int;
+   indCountTab:A_bool_10;
+   _v1:int;
+let
+   dataPUT = Hcapt;
+   stampedData =  if Hcapt then localCnt else _v1;
+   _v1 = -1;
+   productionEvent = Hcapt;
+   (localCnt, indCountTab) = pilote::updateCnt(indCount, HrinstCount, Hcapt);
+tel
+-- end of node pilote::capt
+
+node pilote::boiteCP(
+	dataIN:int;
+	dataGET:bool;
+	dataPUT:bool) 
+returns (
+	dataOUT:int;
+	localDataErasedFromBoiteCP:int;
+	localDataCopydFromBoiteCP:int;
+	copyBoiteCPEvent:bool;
+	erasedBoiteCPEvent:bool);
+var
+   localData:int;
+   pLocalData:int;
+   _v1:int;
+   _v2:int;
+   _v3:int;
+   _v4:int;
+   _v5:int;
+   _v6:int;
+   _v7:int;
+   _v8:int;
+   _v9:int;
+   _v10:int;
+   _v11:int;
+   _v12:int;
+   _v13:int;
+let
+   localData = _v1 -> _v5;
+   _v1 = -1;
+   _v2 = -1;
+   _v3 = pre localData;
+   _v4 =  if dataGET then _v2 else _v3;
+   _v5 =  if dataPUT then dataIN else _v4;
+   localDataErasedFromBoiteCP = _v6 -> _v8;
+   _v6 = -1;
+   _v7 = -1;
+   _v8 =  if dataPUT then pLocalData else _v7;
+   erasedBoiteCPEvent = dataPUT;
+   localDataCopydFromBoiteCP = _v9 -> _v11;
+   _v9 = -1;
+   _v10 = -1;
+   _v11 =  if dataPUT then localData else _v10;
+   copyBoiteCPEvent = dataPUT;
+   pLocalData = localData -> _v12;
+   _v12 = pre localData;
+   dataOUT =  if dataGET then pLocalData else _v13;
+   _v13 = -1;
+tel
+-- end of node pilote::boiteCP
+
+node pilote::pilote(
+	Hpilote:bool;
+	semAutP:bool;
+	dataBoiteCP:int) 
+returns (
+	semMemTakeP:bool;
+	putMemP:bool;
+	dataGET:bool;
+	piloteData:int;
+	localDataErasedFromPilote:int;
+	erasedPiloteEvent:bool;
+	copyPiloteEvent:bool;
+	localDataCopiedFromPilote:int);
+var
+   localData:int;
+   _v1:int;
+   _v2:bool;
+   _v3:int;
+   _v4:bool;
+   _v5:int;
+   _v6:int;
+   _v7:int;
+   _v8:int;
+   _v9:int;
+   _v10:int;
+   _v11:int;
+let
+   dataGET = Hpilote;
+   localData =  if Hpilote then dataBoiteCP else _v1;
+   _v1 = -1;
+   semMemTakeP = Hpilote;
+   piloteData =  if _v2 then localData else _v3;
+   _v2 = semAutP and Hpilote;
+   _v3 = -1;
+   putMemP =  if _v4 then true else false;
+   _v4 = semAutP and Hpilote;
+   localDataErasedFromPilote = _v5 -> _v8;
+   _v5 = -1;
+   _v6 = pre localData;
+   _v7 = -1;
+   _v8 =  if Hpilote then _v6 else _v7;
+   erasedPiloteEvent = Hpilote;
+   localDataCopiedFromPilote = _v9 -> _v11;
+   _v9 = -1;
+   _v10 = -1;
+   _v11 =  if Hpilote then localData else _v10;
+   copyPiloteEvent = Hpilote;
+tel
+-- end of node pilote::pilote
+
+node pilote::mem(
+	getMem:bool;
+	putMem:bool;
+	piloteData:int) 
+returns (
+	semMemGive:bool;
+	readData:int;
+	localDataErasedFromMem:int;
+	localDataCopiedFromMem:int;
+	erasedMemEvent:bool;
+	copyMemEvent:bool);
+var
+   localData:int;
+   demandeGetMem:bool;
+   _v1:bool;
+   _v2:int;
+   _v3:int;
+   _v4:int;
+   _v5:int;
+   _v6:int;
+   _v7:bool;
+   _v8:bool;
+   _v9:bool;
+   _v10:bool;
+   _v11:bool;
+   _v12:bool;
+   _v13:int;
+   _v14:int;
+   _v15:int;
+   _v16:int;
+   _v17:int;
+   _v18:int;
+   _v19:int;
+let
+   semMemGive = not _v1;
+   _v1 = getMem or putMem;
+   localData = _v2 -> _v4;
+   _v2 = -1;
+   _v3 = pre localData;
+   _v4 =  if putMem then piloteData else _v3;
+   readData =  if demandeGetMem then localData else _v5;
+   _v5 = -1;
+   demandeGetMem = getMem -> _v12;
+   _v6 = -1;
+   _v7 = readData = _v6;
+   _v8 = not _v7;
+   _v9 = pre _v8;
+   _v10 = pre demandeGetMem;
+   _v11 =  if _v9 then false else _v10;
+   _v12 =  if getMem then true else _v11;
+   localDataErasedFromMem = _v13 -> _v16;
+   _v13 = -1;
+   _v14 = pre localData;
+   _v15 = -1;
+   _v16 =  if putMem then _v14 else _v15;
+   erasedMemEvent = putMem;
+   localDataCopiedFromMem = _v17 -> _v19;
+   _v17 = -1;
+   _v18 = -1;
+   _v19 =  if putMem then localData else _v18;
+   copyMemEvent = putMem;
+tel
+-- end of node pilote::mem
+
+node pilote::semMem(
+	semMemTakeP:bool;
+	semMemTakeR:bool;
+	semMemGive:bool) 
+returns (
+	semMemAutP:bool;
+	semMemAutR:bool;
+	free:bool;
+	demandeR:bool);
+var
+   _v1:bool;
+   _v2:bool;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v6:bool;
+   _v7:bool;
+   _v8:bool;
+   _v9:bool;
+   _v10:bool;
+   _v11:bool;
+   _v12:bool;
+   _v13:bool;
+   _v14:bool;
+   _v15:bool;
+   _v16:bool;
+   _v17:bool;
+   _v18:bool;
+   _v19:bool;
+   _v20:bool;
+   _v21:bool;
+let
+   free = true -> _v10;
+   _v1 = pre free;
+   _v2 = not semMemTakeP;
+   _v3 = _v1 and _v2;
+   _v4 = not semMemTakeR;
+   _v5 = _v3 and _v4;
+   _v6 = not semMemTakeP;
+   _v7 = not semMemTakeR;
+   _v8 = _v6 and _v7;
+   _v9 = _v8 and semMemGive;
+   _v10 = _v5 or _v9;
+   semMemAutP = false -> _v12;
+   _v11 = pre free;
+   _v12 = _v11 and semMemTakeP;
+   demandeR = false -> _v17;
+   _v13 = semMemTakeR and semMemTakeP;
+   _v14 = pre semMemAutR;
+   _v15 = pre demandeR;
+   _v16 =  if _v14 then false else _v15;
+   _v17 =  if _v13 then true else _v16;
+   semMemAutR = false -> _v21;
+   _v18 = pre free;
+   _v19 = not semMemTakeP;
+   _v20 = _v18 and _v19;
+   _v21 = _v20 and demandeR;
+tel
+-- end of node pilote::semMem
+
+node pilote::read(
+	Happli:bool;
+	semAutR:bool;
+	readData:int) 
+returns (
+	getMemR:bool;
+	semMemR:bool;
+	localData:int;
+	consumptionEvent:bool);
+var
+   _v1:int;
+   _v2:bool;
+let
+   semMemR = Happli;
+   getMemR = semAutR;
+   localData = readData;
+   consumptionEvent = not _v2;
+   _v1 = -1;
+   _v2 = readData = _v1;
+tel
+-- end of node pilote::read
+type _util::accObserver = struct  {nbCopy : A_int_10; indice : int};
+type _util::accChangeTab = struct  {numEvent : int; cpt : int; indice : int};
+
+node util::change_elt2(
+	accIn:_util::accChangeTab;
+	eltIn:int) 
+returns (
+	accOut:_util::accChangeTab;
+	eltOut:int);
+var
+   _v1:int;
+   _v2:int;
+   _v3:bool;
+   _v4:int;
+   _v5:bool;
+   _v6:int;
+   _v7:bool;
+   _v8:int;
+   _v9:bool;
+   _v10:bool;
+   _v11:int;
+   _v12:bool;
+   _v13:bool;
+   _v14:int;
+   _v15:int;
+   _v16:bool;
+   _v17:int;
+   _v18:bool;
+   _v19:bool;
+   _v20:int;
+   _v21:bool;
+   _v22:bool;
+   _v23:int;
+   _v24:int;
+   _v25:int;
+   _v26:int;
+   _v29:int;
+   _v30:int;
+   _v28:int;
+   _v27:int;
+let
+   eltOut =  if _v3 then _v26 else eltIn;
+   _v1 = accIn.indice;
+   _v2 = accIn.cpt;
+   _v3 = _v1 = _v2;
+   _v4 = accIn.numEvent;
+   _v5 = _v4 = 0;
+   _v6 = accIn.numEvent;
+   _v7 = _v6 = 1;
+   _v8 = accIn.numEvent;
+   _v9 = _v8 = 3;
+   _v10 = _v7 or _v9;
+   _v11 = accIn.numEvent;
+   _v12 = _v11 = 7;
+   _v13 = _v10 or _v12;
+   _v14 = eltIn - 1;
+   _v15 = accIn.numEvent;
+   _v16 = _v15 = 2;
+   _v17 = accIn.numEvent;
+   _v18 = _v17 = 4;
+   _v19 = _v16 or _v18;
+   _v20 = accIn.numEvent;
+   _v21 = _v20 = 6;
+   _v22 = _v19 or _v21;
+   _v23 = eltIn + 1;
+   _v24 =  if _v22 then _v23 else eltIn;
+   _v25 =  if _v13 then _v14 else _v24;
+   _v26 =  if _v5 then 1 else _v25;
+   accOut = _util::accChangeTab{numEvent=_v27;indice=_v28;cpt=_v30};
+   _v29 = accIn.cpt;
+   _v30 = _v29 + 1;
+   _v28 = accIn.indice;
+   _v27 = accIn.numEvent;
+tel
+-- end of node util::change_elt2
+
+node util::change_tab2(
+	tabIn:A_int_10;
+	indiceIn:int;
+	num_event:int) 
+returns (
+	tabOut:A_int_10);
+var
+   accOut:_util::accChangeTab;
+   _v1:_util::accChangeTab;
+let
+   (accOut, tabOut) = fillred<<util::change_elt2, 10>>(_v1, tabIn);
+   _v1 = _util::accChangeTab{numEvent=num_event;cpt=0;indice=indiceIn};
+tel
+-- end of node util::change_tab2
+
+node util::Niter(
+	accIn:_util::accObserver;
+	numEvent:bool;
+	value_tab:int) 
+returns (
+	accOut:_util::accObserver);
+var
+   _v6:int;
+   _v7:int;
+   _v1:A_int_10;
+   _v2:int;
+   _v3:A_int_10;
+   _v4:A_int_10;
+   _v5:A_int_10;
+let
+   accOut = _util::accObserver{nbCopy=_v5;indice=_v7};
+   _v6 = accIn.indice;
+   _v7 = _v6 + 1;
+   _v1 = accIn.nbCopy;
+   _v2 = accIn.indice;
+   _v3 = util::change_tab2(_v1, value_tab, _v2);
+   _v4 = accIn.nbCopy;
+   _v5 =  if numEvent then _v3 else _v4;
+tel
+-- end of node util::Niter
+
+node util::updateNbrCopy(
+	numEvent_tab:A_bool_8;
+	value_tab:A_int_8) 
+returns (
+	nbrCopy:A_int_10);
+var
+   accIterOut:_util::accObserver;
+   _v1:int;
+   _v2:A_int_10;
+   _v3:_util::accObserver;
+   _v4:A_int_10;
+   _v5:A_int_10;
+   _v6:_util::accObserver;
+   _v7:_util::accObserver;
+let
+   accIterOut = _v3 -> _v7;
+   _v1 = -1;
+   _v2 = _v1^10;
+   _v3 = _util::accObserver{nbCopy=_v2;indice=0};
+   _v4 = accIterOut.nbCopy;
+   _v5 = pre _v4;
+   _v6 = _util::accObserver{nbCopy=_v5;indice=0};
+   _v7 = red<<util::Niter, 8>>(_v6, numEvent_tab, value_tab);
+   nbrCopy = accIterOut.nbCopy;
+tel
+-- end of node util::updateNbrCopy
+
+node util::checkCopy(
+	eltCopy:int;
+	oldCptRetard:int) 
+returns (
+	newCptRetard:int);
+var
+   _v1:int;
+   _v2:bool;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v6:int;
+   _v7:bool;
+   _v8:bool;
+   _v9:bool;
+   _v10:bool;
+   _v11:bool;
+   _v12:bool;
+   _v13:bool;
+   _v14:int;
+   _v15:int;
+   _v16:int;
+let
+   newCptRetard =  if _v5 then 0 else _v16;
+   _v1 = -1;
+   _v2 = eltCopy = _v1;
+   _v3 = pre _v2;
+   _v4 = eltCopy = 1;
+   _v5 = _v3 and _v4;
+   _v6 = -1;
+   _v7 = eltCopy <> _v6;
+   _v8 = pre _v7;
+   _v9 = eltCopy <> 0;
+   _v10 = pre _v9;
+   _v11 = _v8 and _v10;
+   _v12 = eltCopy = 0;
+   _v13 = _v11 and _v12;
+   _v14 = -1;
+   _v15 = oldCptRetard + 1;
+   _v16 =  if _v13 then _v14 else _v15;
+tel
+-- end of node util::checkCopy
+
+node util::updateCptRetard(
+	nbrCopy:A_int_10) 
+returns (
+	CptRetard:A_int_10);
+var
+   _v1:int;
+   _v2:A_int_10;
+   _v3:A_int_10;
+   _v4:A_int_10;
+let
+   CptRetard = _v2 -> _v4;
+   _v1 = -1;
+   _v2 = _v1^10;
+   _v3 = pre CptRetard;
+   _v4 = map<<util::checkCopy, 10>>(nbrCopy, _v3);
+tel
+-- end of node util::updateCptRetard
+type _util::tIterRetard = struct  {conEvent : bool; dataFromRead : int; retardCalcule : int; cpt : int};
+
+node util::updateRetard(
+	accIn:_util::tIterRetard;
+	elt:int) 
+returns (
+	accOut:_util::tIterRetard);
+var
+   _v12:int;
+   _v13:int;
+   _v3:int;
+   _v4:bool;
+   _v5:int;
+   _v6:int;
+   _v7:bool;
+   _v8:bool;
+   _v9:int;
+   _v10:int;
+   _v11:int;
+   _v2:int;
+   _v1:bool;
+let
+    accOut =
+	 _util::tIterRetard{conEvent=_v1;dataFromRead=_v2;retardCalcule=_v11;cpt=_v13};
+   _v12 = accIn.cpt;
+   _v13 = _v12 + 1;
+   _v3 = -1;
+   _v4 = accIn.conEvent;
+   _v5 = accIn.cpt;
+   _v6 = accIn.dataFromRead;
+   _v7 = _v5 = _v6;
+   _v8 = _v4 and _v7;
+   _v9 = -1;
+   _v10 =  if _v8 then elt else _v9;
+   _v11 = _v3 -> _v10;
+   _v2 = accIn.dataFromRead;
+   _v1 = accIn.conEvent;
+tel
+-- end of node util::updateRetard
+
+node util::calculRetard(
+	consumptionEvent:bool;
+	CptRetard:A_int_10;
+	localDataFromRead:int) 
+returns (
+	retard:int);
+var
+   accOut:_util::tIterRetard;
+   _v1:int;
+   _v2:_util::tIterRetard;
+let
+   accOut = red<<util::updateRetard, 10>>(_v2, CptRetard);
+   _v1 = -1;
+    _v2 =
+	 _util::tIterRetard{conEvent=consumptionEvent;dataFromRead=localDataFromRead;retardCalcule=_v1;cpt=0};
+   retard = accOut.retardCalcule;
+tel
+-- end of node util::calculRetard
+type _util::tCounterIter = struct  {indice : int; Hindice : bool; cpt : int};
+
+node util::countIter(
+	accIn:_util::tCounterIter;
+	eltCopy:int) 
+returns (
+	accOut:_util::tCounterIter);
+var
+   _v1:int;
+   _v2:bool;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v6:bool;
+   _v7:bool;
+   _v8:bool;
+   _v10:int;
+   _v11:int;
+   _v9:int;
+   _v12:_util::tCounterIter;
+   _v15:int;
+   _v16:int;
+   _v14:bool;
+   _v13:int;
+   _v17:_util::tCounterIter;
+let
+   accOut =  if _v8 then _v12 else _v17;
+   _v1 = -1;
+   _v2 = eltCopy <> _v1;
+   _v3 = pre _v2;
+   _v4 = eltCopy <> 0;
+   _v5 = pre _v4;
+   _v6 = _v3 and _v5;
+   _v7 = eltCopy = 0;
+   _v8 = _v6 and _v7;
+   _v10 = accIn.cpt;
+   _v11 = _v10 + 1;
+   _v9 = accIn.cpt;
+   _v12 = _util::tCounterIter{indice=_v9;Hindice=true;cpt=_v11};
+   _v15 = accIn.cpt;
+   _v16 = _v15 + 1;
+   _v14 = accIn.Hindice;
+   _v13 = accIn.indice;
+   _v17 = _util::tCounterIter{indice=_v13;Hindice=_v14;cpt=_v16};
+tel
+-- end of node util::countIter
+
+node util::updateIndice(
+	nbrCopy:A_int_10) 
+returns (
+	indiceCount:int;
+	HindiceCount:bool);
+var
+   iterOut:_util::tCounterIter;
+   _v1:int;
+   _v2:_util::tCounterIter;
+let
+   iterOut = red<<util::countIter, 10>>(_v2, nbrCopy);
+   _v1 = -1;
+   _v2 = _util::tCounterIter{indice=_v1;Hindice=false;cpt=0};
+   indiceCount = iterOut.indice;
+   HindiceCount = iterOut.Hindice;
+tel
+-- end of node util::updateIndice
+
+node util::observer(
+	dataBoiteCP_IN:int;
+	localDataFromRead:int;
+	localErasedDataFromBoiteCP:int;
+	localCopyedDataFromBoiteCP:int;
+	localErasedDataFromPilote:int;
+	localCopyedDataFromPilote:int;
+	localErasedDataFromMem:int;
+	localCopyedDataFromMem:int;
+	productionEvent:bool;
+	consumptionEvent:bool;
+	eraseMemEvent:bool;
+	eraseBoiteCPEvent:bool;
+	erasePiloteEvent:bool;
+	copyBoiteCPEvent:bool;
+	copyPiloteEvent:bool;
+	copyMemEvent:bool) 
+returns (
+	retard:int;
+	indiceCount:int;
+	HindiceCount:bool);
+var
+   CptRetard:A_int_10;
+   numEvent_tab:A_bool_8;
+   value_tab:A_int_8;
+   nbrCopy:A_int_10;
+let
+    numEvent_tab = [productionEvent, consumptionEvent, eraseMemEvent,
+	copyMemEvent, eraseBoiteCPEvent, copyBoiteCPEvent, erasePiloteEvent,
+	 copyPiloteEvent];
+    value_tab = [dataBoiteCP_IN, localDataFromRead, localErasedDataFromMem,
+	localCopyedDataFromMem, localErasedDataFromBoiteCP,
+	localCopyedDataFromBoiteCP, localErasedDataFromPilote,
+	 localCopyedDataFromPilote];
+   nbrCopy = util::updateNbrCopy(numEvent_tab, value_tab);
+   CptRetard = util::updateCptRetard(nbrCopy);
+    retard = util::calculRetard(consumptionEvent, CptRetard,
+	 localDataFromRead);
+   (indiceCount, HindiceCount) = util::updateIndice(nbrCopy);
+tel
+-- end of node util::observer
+
+node pilote::system(
+	in:bool) 
+returns (
+	v:bool;
+	dataBoiteCP_IN:int;
+	dataBoiteCP_OUT:int;
+	piloteData:int;
+	readData:int;
+	getMem:bool;
+	localDataFromRead:int;
+	Hcapt:bool;
+	Hpilote:bool;
+	Happli:bool;
+	dataBoiteCP_PUT:bool;
+	dataBoiteCP_GET:bool;
+	semMemTakeP:bool;
+	semMemTakeR:bool;
+	semMemGive:bool;
+	semMemAutP:bool;
+	semMemAutR:bool;
+	putMem:bool;
+	res:bool;
+	retard:int);
+var
+   free:bool;
+   demandeR:bool;
+   HrinstCount:bool;
+   indCount:int;
+   localErasedDataFromBoiteCP:int;
+   localCopiedDataFromBoiteCP:int;
+   localErasedDataFromPilote:int;
+   localCopiedDataFromPilote:int;
+   localErasedDataFromMem:int;
+   localCopiedDataFromMem:int;
+   productionEvent:bool;
+   consumptionEvent:bool;
+   eraseMemEvent:bool;
+   eraseBoiteCPEvent:bool;
+   erasePiloteEvent:bool;
+   copyBoiteCPEvent:bool;
+   copyPiloteEvent:bool;
+   copyMemEvent:bool;
+   _v1:int;
+   _v2:bool;
+   _v3:bool;
+   _v4:int;
+   _v5:bool;
+   _v6:bool;
+   _v7:bool;
+   _v8:bool;
+let
+   (Hcapt, Hpilote, Happli) = pilote::ctrl(in);
+    (dataBoiteCP_PUT, dataBoiteCP_IN, productionEvent) = pilote::capt(Hcapt,
+	 HrinstCount, indCount);
+    (dataBoiteCP_OUT, localErasedDataFromBoiteCP, localCopiedDataFromBoiteCP,
+	copyBoiteCPEvent, eraseBoiteCPEvent) = pilote::boiteCP(dataBoiteCP_IN,
+	 dataBoiteCP_GET, dataBoiteCP_PUT);
+    (semMemTakeP, putMem, dataBoiteCP_GET, piloteData,
+	localErasedDataFromPilote, erasePiloteEvent, copyPiloteEvent,
+	localCopiedDataFromPilote) = pilote::pilote(Hpilote, semMemAutP,
+	 dataBoiteCP_OUT);
+    (semMemGive, readData, localErasedDataFromMem, localCopiedDataFromMem,
+	 eraseMemEvent, copyMemEvent) = pilote::mem(getMem, putMem, piloteData);
+    (semMemAutP, semMemAutR, free, demandeR) = pilote::semMem(semMemTakeP,
+	 semMemTakeR, semMemGive);
+    (getMem, semMemTakeR, localDataFromRead, consumptionEvent) =
+	 pilote::read(Happli, semMemAutR, readData);
+    (retard, indCount, HrinstCount) = util::observer(dataBoiteCP_IN,
+	localDataFromRead, localErasedDataFromBoiteCP, localCopiedDataFromBoiteCP,
+	localErasedDataFromPilote, localCopiedDataFromPilote,
+	localErasedDataFromMem, localCopiedDataFromMem, productionEvent,
+	consumptionEvent, eraseMemEvent, eraseBoiteCPEvent, erasePiloteEvent,
+	 copyBoiteCPEvent, copyPiloteEvent, copyMemEvent);
+   v = _v3 and _v6;
+   _v1 = -1;
+   _v2 = dataBoiteCP_IN = _v1;
+   _v3 = not _v2;
+   _v4 = -1;
+   _v5 = localDataFromRead = _v4;
+   _v6 = not _v5;
+   res = false -> _v8;
+   _v7 = pre res;
+   _v8 = v or _v7;
+tel
+-- end of node pilote::system
+-- automatically defined aliases:
+type A_int_8 = int^8;
+type A_bool_10 = bool^10;
+type A_bool_8 = bool^8;
+type A_int_10 = int^10;
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 2 should_work/lionel/pipeline.lus
 Opening file should_work/lionel/pipeline.lus
 const pipeline::size = 10;
@@ -18054,6 +18963,381 @@ tel
 -- automatically defined aliases:
 type A_bool_3 = bool^3;
 ----------------------------------------------------------------------
+====> ../lus2lic -vl 2 should_work/lionel/remplissage-1.0.lus
+Opening file should_work/lionel/remplissage-1.0.lus
+type _util::accObserver = struct  {nbCopy : A_int_10; indice : int};
+type _util::accChangeTab = struct  {numEvent : int; cpt : int; indice : int};
+
+node util::change_elt2(
+	accIn:_util::accChangeTab;
+	eltIn:int) 
+returns (
+	accOut:_util::accChangeTab;
+	eltOut:int);
+var
+   _v1:int;
+   _v2:int;
+   _v3:bool;
+   _v4:int;
+   _v5:bool;
+   _v6:int;
+   _v7:bool;
+   _v8:int;
+   _v9:bool;
+   _v10:bool;
+   _v11:int;
+   _v12:bool;
+   _v13:bool;
+   _v14:int;
+   _v15:int;
+   _v16:bool;
+   _v17:int;
+   _v18:bool;
+   _v19:bool;
+   _v20:int;
+   _v21:bool;
+   _v22:bool;
+   _v23:int;
+   _v24:int;
+   _v25:int;
+   _v26:int;
+   _v29:int;
+   _v30:int;
+   _v28:int;
+   _v27:int;
+let
+   eltOut =  if _v3 then _v26 else eltIn;
+   _v1 = accIn.indice;
+   _v2 = accIn.cpt;
+   _v3 = _v1 = _v2;
+   _v4 = accIn.numEvent;
+   _v5 = _v4 = 0;
+   _v6 = accIn.numEvent;
+   _v7 = _v6 = 1;
+   _v8 = accIn.numEvent;
+   _v9 = _v8 = 3;
+   _v10 = _v7 or _v9;
+   _v11 = accIn.numEvent;
+   _v12 = _v11 = 7;
+   _v13 = _v10 or _v12;
+   _v14 = eltIn - 1;
+   _v15 = accIn.numEvent;
+   _v16 = _v15 = 2;
+   _v17 = accIn.numEvent;
+   _v18 = _v17 = 4;
+   _v19 = _v16 or _v18;
+   _v20 = accIn.numEvent;
+   _v21 = _v20 = 6;
+   _v22 = _v19 or _v21;
+   _v23 = eltIn + 1;
+   _v24 =  if _v22 then _v23 else eltIn;
+   _v25 =  if _v13 then _v14 else _v24;
+   _v26 =  if _v5 then 1 else _v25;
+   accOut = _util::accChangeTab{numEvent=_v27;indice=_v28;cpt=_v30};
+   _v29 = accIn.cpt;
+   _v30 = _v29 + 1;
+   _v28 = accIn.indice;
+   _v27 = accIn.numEvent;
+tel
+-- end of node util::change_elt2
+
+node util::change_tab2(
+	tabIn:A_int_10;
+	indiceIn:int;
+	num_event:int) 
+returns (
+	tabOut:A_int_10);
+var
+   accOut:_util::accChangeTab;
+   _v1:_util::accChangeTab;
+let
+   (accOut, tabOut) = fillred<<util::change_elt2, 10>>(_v1, tabIn);
+   _v1 = _util::accChangeTab{numEvent=num_event;cpt=0;indice=indiceIn};
+tel
+-- end of node util::change_tab2
+
+node util::Niter(
+	accIn:_util::accObserver;
+	numEvent:bool;
+	value_tab:int) 
+returns (
+	accOut:_util::accObserver);
+var
+   _v6:int;
+   _v7:int;
+   _v1:A_int_10;
+   _v2:int;
+   _v3:A_int_10;
+   _v4:A_int_10;
+   _v5:A_int_10;
+let
+   accOut = _util::accObserver{nbCopy=_v5;indice=_v7};
+   _v6 = accIn.indice;
+   _v7 = _v6 + 1;
+   _v1 = accIn.nbCopy;
+   _v2 = accIn.indice;
+   _v3 = util::change_tab2(_v1, value_tab, _v2);
+   _v4 = accIn.nbCopy;
+   _v5 =  if numEvent then _v3 else _v4;
+tel
+-- end of node util::Niter
+
+node util::updateNbrCopy(
+	numEvent_tab:A_bool_8;
+	value_tab:A_int_8) 
+returns (
+	nbrCopy:A_int_10);
+var
+   accIterOut:_util::accObserver;
+   _v1:int;
+   _v2:A_int_10;
+   _v3:_util::accObserver;
+   _v4:A_int_10;
+   _v5:A_int_10;
+   _v6:_util::accObserver;
+   _v7:_util::accObserver;
+let
+   accIterOut = _v3 -> _v7;
+   _v1 = -1;
+   _v2 = _v1^10;
+   _v3 = _util::accObserver{nbCopy=_v2;indice=0};
+   _v4 = accIterOut.nbCopy;
+   _v5 = pre _v4;
+   _v6 = _util::accObserver{nbCopy=_v5;indice=0};
+   _v7 = red<<util::Niter, 8>>(_v6, numEvent_tab, value_tab);
+   nbrCopy = accIterOut.nbCopy;
+tel
+-- end of node util::updateNbrCopy
+
+node util::checkCopy(
+	eltCopy:int;
+	oldCptRetard:int) 
+returns (
+	newCptRetard:int);
+var
+   _v1:int;
+   _v2:bool;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v6:int;
+   _v7:bool;
+   _v8:bool;
+   _v9:bool;
+   _v10:bool;
+   _v11:bool;
+   _v12:bool;
+   _v13:bool;
+   _v14:int;
+   _v15:int;
+   _v16:int;
+let
+   newCptRetard =  if _v5 then 0 else _v16;
+   _v1 = -1;
+   _v2 = eltCopy = _v1;
+   _v3 = pre _v2;
+   _v4 = eltCopy = 1;
+   _v5 = _v3 and _v4;
+   _v6 = -1;
+   _v7 = eltCopy <> _v6;
+   _v8 = pre _v7;
+   _v9 = eltCopy <> 0;
+   _v10 = pre _v9;
+   _v11 = _v8 and _v10;
+   _v12 = eltCopy = 0;
+   _v13 = _v11 and _v12;
+   _v14 = -1;
+   _v15 = oldCptRetard + 1;
+   _v16 =  if _v13 then _v14 else _v15;
+tel
+-- end of node util::checkCopy
+
+node util::updateCptRetard(
+	nbrCopy:A_int_10) 
+returns (
+	CptRetard:A_int_10);
+var
+   _v1:int;
+   _v2:A_int_10;
+   _v3:A_int_10;
+   _v4:A_int_10;
+let
+   CptRetard = _v2 -> _v4;
+   _v1 = -1;
+   _v2 = _v1^10;
+   _v3 = pre CptRetard;
+   _v4 = map<<util::checkCopy, 10>>(nbrCopy, _v3);
+tel
+-- end of node util::updateCptRetard
+type _util::tIterRetard = struct  {conEvent : bool; dataFromRead : int; retardCalcule : int; cpt : int};
+
+node util::updateRetard(
+	accIn:_util::tIterRetard;
+	elt:int) 
+returns (
+	accOut:_util::tIterRetard);
+var
+   _v12:int;
+   _v13:int;
+   _v3:int;
+   _v4:bool;
+   _v5:int;
+   _v6:int;
+   _v7:bool;
+   _v8:bool;
+   _v9:int;
+   _v10:int;
+   _v11:int;
+   _v2:int;
+   _v1:bool;
+let
+    accOut =
+	 _util::tIterRetard{conEvent=_v1;dataFromRead=_v2;retardCalcule=_v11;cpt=_v13};
+   _v12 = accIn.cpt;
+   _v13 = _v12 + 1;
+   _v3 = -1;
+   _v4 = accIn.conEvent;
+   _v5 = accIn.cpt;
+   _v6 = accIn.dataFromRead;
+   _v7 = _v5 = _v6;
+   _v8 = _v4 and _v7;
+   _v9 = -1;
+   _v10 =  if _v8 then elt else _v9;
+   _v11 = _v3 -> _v10;
+   _v2 = accIn.dataFromRead;
+   _v1 = accIn.conEvent;
+tel
+-- end of node util::updateRetard
+
+node util::calculRetard(
+	consumptionEvent:bool;
+	CptRetard:A_int_10;
+	localDataFromRead:int) 
+returns (
+	retard:int);
+var
+   accOut:_util::tIterRetard;
+   _v1:int;
+   _v2:_util::tIterRetard;
+let
+   accOut = red<<util::updateRetard, 10>>(_v2, CptRetard);
+   _v1 = -1;
+    _v2 =
+	 _util::tIterRetard{conEvent=consumptionEvent;dataFromRead=localDataFromRead;retardCalcule=_v1;cpt=0};
+   retard = accOut.retardCalcule;
+tel
+-- end of node util::calculRetard
+type _util::tCounterIter = struct  {indice : int; Hindice : bool; cpt : int};
+
+node util::countIter(
+	accIn:_util::tCounterIter;
+	eltCopy:int) 
+returns (
+	accOut:_util::tCounterIter);
+var
+   _v1:int;
+   _v2:bool;
+   _v3:bool;
+   _v4:bool;
+   _v5:bool;
+   _v6:bool;
+   _v7:bool;
+   _v8:bool;
+   _v10:int;
+   _v11:int;
+   _v9:int;
+   _v12:_util::tCounterIter;
+   _v15:int;
+   _v16:int;
+   _v14:bool;
+   _v13:int;
+   _v17:_util::tCounterIter;
+let
+   accOut =  if _v8 then _v12 else _v17;
+   _v1 = -1;
+   _v2 = eltCopy <> _v1;
+   _v3 = pre _v2;
+   _v4 = eltCopy <> 0;
+   _v5 = pre _v4;
+   _v6 = _v3 and _v5;
+   _v7 = eltCopy = 0;
+   _v8 = _v6 and _v7;
+   _v10 = accIn.cpt;
+   _v11 = _v10 + 1;
+   _v9 = accIn.cpt;
+   _v12 = _util::tCounterIter{indice=_v9;Hindice=true;cpt=_v11};
+   _v15 = accIn.cpt;
+   _v16 = _v15 + 1;
+   _v14 = accIn.Hindice;
+   _v13 = accIn.indice;
+   _v17 = _util::tCounterIter{indice=_v13;Hindice=_v14;cpt=_v16};
+tel
+-- end of node util::countIter
+
+node util::updateIndice(
+	nbrCopy:A_int_10) 
+returns (
+	indiceCount:int;
+	HindiceCount:bool);
+var
+   iterOut:_util::tCounterIter;
+   _v1:int;
+   _v2:_util::tCounterIter;
+let
+   iterOut = red<<util::countIter, 10>>(_v2, nbrCopy);
+   _v1 = -1;
+   _v2 = _util::tCounterIter{indice=_v1;Hindice=false;cpt=0};
+   indiceCount = iterOut.indice;
+   HindiceCount = iterOut.Hindice;
+tel
+-- end of node util::updateIndice
+
+node util::observer(
+	dataBoiteCP_IN:int;
+	localDataFromRead:int;
+	localErasedDataFromBoiteCP:int;
+	localCopyedDataFromBoiteCP:int;
+	localErasedDataFromPilote:int;
+	localCopyedDataFromPilote:int;
+	localErasedDataFromMem:int;
+	localCopyedDataFromMem:int;
+	productionEvent:bool;
+	consumptionEvent:bool;
+	eraseMemEvent:bool;
+	eraseBoiteCPEvent:bool;
+	erasePiloteEvent:bool;
+	copyBoiteCPEvent:bool;
+	copyPiloteEvent:bool;
+	copyMemEvent:bool) 
+returns (
+	retard:int;
+	indiceCount:int;
+	HindiceCount:bool);
+var
+   CptRetard:A_int_10;
+   numEvent_tab:A_bool_8;
+   value_tab:A_int_8;
+   nbrCopy:A_int_10;
+let
+    numEvent_tab = [productionEvent, consumptionEvent, eraseMemEvent,
+	copyMemEvent, eraseBoiteCPEvent, copyBoiteCPEvent, erasePiloteEvent,
+	 copyPiloteEvent];
+    value_tab = [dataBoiteCP_IN, localDataFromRead, localErasedDataFromMem,
+	localCopyedDataFromMem, localErasedDataFromBoiteCP,
+	localCopyedDataFromBoiteCP, localErasedDataFromPilote,
+	 localCopyedDataFromPilote];
+   nbrCopy = util::updateNbrCopy(numEvent_tab, value_tab);
+   CptRetard = util::updateCptRetard(nbrCopy);
+    retard = util::calculRetard(consumptionEvent, CptRetard,
+	 localDataFromRead);
+   (indiceCount, HindiceCount) = util::updateIndice(nbrCopy);
+tel
+-- end of node util::observer
+-- automatically defined aliases:
+type A_int_8 = int^8;
+type A_bool_8 = bool^8;
+type A_int_10 = int^10;
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 2 should_work/lionel/simpleRed.lus
 Opening file should_work/lionel/simpleRed.lus
 const simpleRed::m = 3;
-- 
GitLab