From 3c77973ab2ef092e013ebc223ac741b513170913 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Tue, 8 Jul 2008 11:14:34 +0200
Subject: [PATCH] Use long  name to print predef  operator appearing as  static
 args of iterators (e.g.,  "Lustre::plus" instead of "Lustre::+")  in order to
 make the life of lic3loc easier.

---
 src/predef.ml         | 27 ++++++++++++++++++++++++++-
 src/predefEvalType.ml |  4 ++--
 src/test/test.res.exp | 33 +++++++++++++++++----------------
 3 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/src/predef.ml b/src/predef.ml
index a9685fc0..60e8a38a 100644
--- a/src/predef.ml
+++ b/src/predef.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 08/07/2008 (at 10:14) by Erwan Jahier> *)
+(** Time-stamp: <modified the 08/07/2008 (at 11:12) by Erwan Jahier> *)
 
 (* XXX shoud not type int, real, and bool be handled there ? *)
 
@@ -102,6 +102,31 @@ let op2string = function
   | FillRed -> "fillred"
   | BoolRed -> "boolred"
 
+let op2string_long = function
+  | EQ_n -> "equal"
+  | NEQ_n -> "diff"
+  | LT_n -> "lt"
+  | LTE_n -> "lte"
+  | GT_n -> "gt"
+  | GTE_n -> "gte"
+  | DIESE_n -> "diese"
+  | UMINUS_n -> "uminus"
+  | MINUS_n -> "minus"
+  | PLUS_n -> "plus"
+  | SLASH_n -> "div"
+  | TIMES_n -> "times"
+  | IUMINUS_n -> "iuminus"
+  | IMINUS_n -> "iminus"
+  | IPLUS_n -> "iplus"
+  | ISLASH_n -> "idiv"
+  | ITIMES_n -> "itimes"
+  | RUMINUS_n -> "ruminus"
+  | RMINUS_n -> "rminus"
+  | RPLUS_n -> "plus"
+  | RSLASH_n -> "rdiv"
+  | RTIMES_n -> "rtimes"
+  | op -> op2string op
+
 let is_infix = function
   | AND_n | OR_n | XOR_n | IMPL_n | EQ_n | NEQ_n | LT_n | LTE_n | GT_n | GTE_n | DIV_n
   | MOD_n | IF_n | MINUS_n | PLUS_n | SLASH_n | TIMES_n | IMINUS_n | IPLUS_n
diff --git a/src/predefEvalType.ml b/src/predefEvalType.ml
index 8cb9690b..ac9a9665 100644
--- a/src/predefEvalType.ml
+++ b/src/predefEvalType.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/06/2008 (at 09:49) by Erwan Jahier> *)
+(** Time-stamp: <modified the 08/07/2008 (at 11:10) by Erwan Jahier> *)
 
 open Predef
 open SyntaxTreeCore
@@ -196,7 +196,7 @@ let (op2profile : Predef.op -> Lxm.t -> static_arg_eff list -> node_profile) =
 let (make_node_exp_eff : op -> Lxm.t -> static_arg_eff list -> node_exp_eff) =
   fun op lxm sargs -> 
     let id = Ident.make_long 
-      (Ident.pack_name_of_string "Lustre") (Ident.of_string (Predef.op2string op))
+      (Ident.pack_name_of_string "Lustre") (Ident.of_string (Predef.op2string_long op))
     in
     let (lti,lto) = op2profile op lxm sargs in
     let i = ref 0 in
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index 413afde8..eec48e35 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -3800,7 +3800,7 @@ tel
 Opening file /home/jahier/lus2lic/src/test/should_work/call/bad_call03.lus
 function bad_call03::toto(i1:A_o_3; i2:A_o_3) returns (o:A_o_3);
 let
-   o = (Lustre::map<<Lustre::+, 3>>(i1, i2));
+   o = (Lustre::map<<Lustre::plus, 3>>(i1, i2));
 tel
 -- end of node bad_call03::toto
 node bad_call03::titi(c:A_real_3; d:A_real_3) returns (y:A_real_3);
@@ -4427,7 +4427,7 @@ Opening file /home/jahier/lus2lic/src/test/should_work/demo/alias.lus
 const alias::SIZE = 3;
 function alias::aliasIterOp(i1:int; i2:A_int_3) returns (o:int);
 let
-   o = (Lustre::red<<Lustre::+, 3>>(i1, i2));
+   o = (Lustre::red<<Lustre::iplus, 3>>(i1, i2));
 tel
 -- end of node alias::aliasIterOp
 function alias::aliasBoolRed(i:A_bool_2) returns (o:bool);
@@ -4456,7 +4456,8 @@ tel
 node alias::alias(a:bool) returns (b:bool; c:int);
 let
    b = (alias::aliasPredefNot(a));
-   c = (alias::aliasGivenNode(0, (map<<Lustre::+, 3>>((0^3), (SIZE^3)))));
+    c = (alias::aliasGivenNode(0, (map<<Lustre::iplus, 3>>((0^3),
+	 (SIZE^3)))));
 tel
 -- end of node alias::alias
 -- automatically defined aliases:
@@ -4908,7 +4909,7 @@ returns (
 	bid:int);
 let
    (bid, T) = (fill<<Lustre::fill<<mapdeRed::incr, 2>>, 3>>(init2));
-   r = (red<<Lustre::map<<Lustre::+, 2>>, 3>>(init, T));
+   r = (red<<Lustre::map<<Lustre::plus, 2>>, 3>>(init, T));
 tel
 -- end of node mapdeRed::mapdeRed
 -- automatically defined aliases:
@@ -4949,7 +4950,7 @@ var
 let
    z = ( if x[0] then a[0] else b[0]);
    c = (map<<Lustre::if, 3>>(x, a, b));
-   d = (map<<Lustre::-, 3>>(b));
+   d = (map<<Lustre::iuminus, 3>>(b));
 tel
 -- end of node mappredef::mappredef
 -- automatically defined aliases:
@@ -5003,7 +5004,7 @@ tel
 -- end of node redoptest::max
 node redoptest::redoptest(a:A_A_int_5_3) returns (b:int);
 let
-   b = (red<<Lustre::red<<Lustre::+, 5>>, 3>>(0, a));
+   b = (red<<Lustre::red<<Lustre::plus, 5>>, 3>>(0, a));
 tel
 -- end of node redoptest::redoptest
 -- automatically defined aliases:
@@ -5176,7 +5177,7 @@ var
 let
    (bidon, T_inter) = (fill<<iter::filled, 5>>(init));
    Tab_out = (map<<iter::mapped, 5>>(T_inter));
-   Red_plus = (red<<Lustre::+, 5>>((-100), Tab_out));
+   Red_plus = (red<<Lustre::plus, 5>>((-100), Tab_out));
    (zorroAcc, zorroTab) = (fillred<<iter::garcia, 5>>(0, ([0, 0, 0, 0, 0])));
 tel
 -- end of node iter::iter
@@ -7375,7 +7376,7 @@ tel
 -- end of node arrays::incr
 node arrays::big_sum(x:A_A_A_int_4_3_2) returns (s:int);
 let
-   s = (red<<Lustre::red<<Lustre::red<<Lustre::+, 4>>, 3>>, 2>>(0, x));
+   s = (red<<Lustre::red<<Lustre::red<<Lustre::plus, 4>>, 3>>, 2>>(0, x));
 tel
 -- end of node arrays::big_sum
 node arrays::big_or(x:A_A_A_bool_4_3_2) returns (s:bool);
@@ -7594,7 +7595,7 @@ tel
 -- end of node mapiter::incr
 function mapiter::map_egal(i1:A_a_2; i2:A_a_2) returns (o:A_bool_2);
 let
-   o = (Lustre::map<<Lustre::=, 2>>(i1, i2));
+   o = (Lustre::map<<Lustre::equal, 2>>(i1, i2));
 tel
 -- end of node mapiter::map_egal
 node mapiter::bitalt(in:bool) returns (sacc:bool; out:bool);
@@ -7672,7 +7673,7 @@ returns (
 	T:A_A_int_3_2);
 let
    (bid, T) = (fill<<Lustre::fill<<matrice::fibo, 3>>, 2>>(([a, a])));
-   sum = (red<<Lustre::red<<Lustre::+, 3>>, 2>>(0, T));
+   sum = (red<<Lustre::red<<Lustre::plus, 3>>, 2>>(0, T));
 tel
 -- end of node matrice::matrice
 -- automatically defined aliases:
@@ -7686,7 +7687,7 @@ const matrice2::m = 2;
 const matrice2::n = 2;
 node matrice2::matrice2(a:int) returns (res:int);
 let
-   res = (red<<Lustre::red<<Lustre::+, 2>>, 2>>(0, ((1^2)^2)));
+   res = (red<<Lustre::red<<Lustre::plus, 2>>, 2>>(0, ((1^2)^2)));
 tel
 -- end of node matrice2::matrice2
 
@@ -8185,8 +8186,8 @@ returns (
 	s1:A_A_int_2_3;
 	s2:A_A_bool_2_3);
 let
-   s1 = (map<<Lustre::map<<Lustre::/, 2>>, 3>>(i1, i2));
-   s2 = (map<<Lustre::map<<Lustre::>=, 2>>, 3>>(i1, i2));
+   s1 = (map<<Lustre::map<<Lustre::div, 2>>, 3>>(i1, i2));
+   s2 = (map<<Lustre::map<<Lustre::gte, 2>>, 3>>(i1, i2));
 tel
 -- end of node predefOp::composematint
 node predefOp::incremental(iacc:int) returns (oacc:int; res:int);
@@ -8197,7 +8198,7 @@ tel
 -- end of node predefOp::incremental
 node predefOp::reducematint(iacc:int; I:A_A_int_2_3) returns (res:int);
 let
-   res = (red<<Lustre::red<<Lustre::+, 2>>, 3>>(iacc, I));
+   res = (red<<Lustre::red<<Lustre::plus, 2>>, 3>>(iacc, I));
 tel
 -- end of node predefOp::reducematint
 node predefOp::initmatint(iacc:int) returns (sacc:int; R:A_A_int_2_3);
@@ -8251,7 +8252,7 @@ const simpleRed::m = 3;
 const simpleRed::n = 2;
 node simpleRed::simpleRed(a:int) returns (res:int);
 let
-   res = (red<<Lustre::+, 3>>(0, (a^3)));
+   res = (red<<Lustre::plus, 3>>(0, (a^3)));
 tel
 -- end of node simpleRed::simpleRed
 
@@ -8740,7 +8741,7 @@ tel
 -- end of node intArray::_isGreaterThan_
 function intArray::_isEqualTo_(i1:a; i2:a) returns (o:bool);
 let
-   o = (Lustre::=(i1, i2));
+   o = (Lustre::equal(i1, i2));
 tel
 -- end of node intArray::_isEqualTo_
 type _intArray::T_isElementOf_ = struct  {eltToSearch : int; iselementof : bool};
-- 
GitLab