From 5cf28eb41a8e09b5047eec5fb5f1facc19abb01b Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Thu, 23 Oct 2008 15:15:23 +0200 Subject: [PATCH] Add code to (lic) dump structure constants. --- src/licDump.ml | 24 ++++++++++++++---------- src/test/test.res.exp | 8 ++++++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/licDump.ml b/src/licDump.ml index b48f1f6b..0fd69c21 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 15/09/2008 (at 15:36) by Erwan Jahier> *) +(** Time-stamp: <modified the 23/10/2008 (at 15:12) by Erwan Jahier> *) open Printf open Lxm @@ -526,17 +526,21 @@ and (type_decl: Ident.long -> Eff.type_ -> string) = (* exported *) and (const_decl: Ident.long -> Eff.const -> string) = fun tname ceff -> - let str = "const " ^ (long tname) in + let begin_str = ("const " ^ (long tname)) in + let end_str = (string_of_const_eff ceff) ^ ";\n" in (match ceff with - | Extern_const_eff _ -> - str^":" ^ (string_of_type_eff (Eff.type_of_const ceff))^ ";\n" - | Enum_const_eff _ -> "" (* do not print those const *) - | Struct_const_eff _ -> assert false - | Array_const_eff _ - | Bool_const_eff _ - | Int_const_eff _ - | Real_const_eff _ -> str^" = " ^ (string_of_const_eff ceff)^ ";\n" + | Enum_const_eff _ -> "" + (* do not print those const, because there were + introduced by the compiler *) + | Extern_const_eff _ -> + begin_str ^ ":" ^ (string_of_type_eff (Eff.type_of_const ceff)) ^ ";\n" + | Struct_const_eff _ + | Array_const_eff _ + | Bool_const_eff _ + | Int_const_eff _ + | Real_const_eff _ -> begin_str ^ " = " ^ end_str ) + (* exported *) and (node_of_node_exp_eff: Eff.node_exp -> string) = diff --git a/src/test/test.res.exp b/src/test/test.res.exp index bf06bd74..79a4f7ba 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -17757,9 +17757,13 @@ tel ====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/complex.lus Opening file should_work/packEnvTest/complex.lus type _complex::t = struct {re : real; im : real}; +const complex::i = _complex::t{re = 0.000000; im = 1.000000}; +function complex::re(c:_complex::t) returns (re:real); +let + re = c.re; +tel +-- end of node complex::re -*** oops: an internal error occurred in file licDump.ml, line 534, column 26 -*** when compiling lustre program should_work/packEnvTest/complex.lus ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus -- GitLab