From c22edbc5ea276e95164ab30221b525b440f4f70a Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Fri, 27 Feb 2015 10:04:26 +0100
Subject: [PATCH] Add an option to control whether or not structured type
 should be expanded.

---
 src/lus2licRun.ml   | 20 +++++++++++++-------
 src/lv6MainArgs.ml  |  9 ++++++++-
 src/lv6MainArgs.mli |  1 +
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/lus2licRun.ml b/src/lus2licRun.ml
index 1e86423d..bb9139fb 100644
--- a/src/lus2licRun.ml
+++ b/src/lus2licRun.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 15/01/2015 (at 13:43) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/02/2015 (at 09:50) by Erwan Jahier> *)
 (*-----------------------------------------------------------------------
 ** Copyright (C) - Verimag.
 *)
@@ -42,12 +42,18 @@ let make argv =
     )
   in
   let soc = try Soc.SocMap.find sk soc_tbl with Not_found -> assert false in
-  let soc_outputs = (SocVar.expand_profile true false (snd soc.profile)) in
-  let (vntl_i:Data.vntl) = (fst soc.profile) in
-  let (vntl_o:Data.vntl) = (snd soc.profile) in
-  (*    Lv6util.dump_entete oc;  *)
-  (*    RifIO.write_interface oc vntl_i vntl_o None None;  *)
-  (*    RifIO.flush oc;  *)
+  let soc_inputs,soc_outputs = soc.profile in
+  let soc_inputs,soc_outputs = if opt.Lv6MainArgs.expand_io_type then
+      (SocVar.expand_profile true false (fst soc.profile)),
+      (SocVar.expand_profile true false (snd soc.profile)) 
+    else
+      soc_inputs,soc_outputs
+  in
+  let (vntl_i:Data.vntl) =  soc_inputs in
+  let (vntl_o:Data.vntl) =  soc_outputs in
+(*   Lv6util.dump_entete oc; *)
+(*   RifIO.write_interface oc vntl_i vntl_o None None; *)
+(*   RifIO.flush oc; *)
 
   let (to_soc_subst : SocExecValue.ctx -> Soc.var list -> Data.subst list) =
     fun ctx vl ->
diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml
index 5a303841..779d3436 100644
--- a/src/lv6MainArgs.ml
+++ b/src/lv6MainArgs.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 26/02/2015 (at 09:52) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/02/2015 (at 09:19) by Erwan Jahier> *)
 (*
 Le manager d'argument adapté de celui de lutin, plus joli
 N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global,
@@ -30,6 +30,7 @@ type t = {
   mutable expand_nodes :  bool;
   mutable expand_node_call :  string list;
   mutable expand_arrays :  bool;
+  mutable expand_io_type :  bool;
   mutable optim_ite : bool;
   mutable gen_autotest :  bool;
   mutable oc :  Pervasives.out_channel;
@@ -91,6 +92,7 @@ let (make_opt : unit -> t) =
       expand_nodes =  false;
       expand_node_call =  [];
       expand_arrays =  false;
+      expand_io_type = false;
       optim_ite = false;
       gen_autotest =  false;
       (** the output channel *)
@@ -284,6 +286,11 @@ let mkoptab (opt:t) : unit = (
       (Arg.Unit (fun _ -> opt.expand_nodes <- true))
       ["Expand all node calls in the main node."]
     ;
+    mkopt opt
+      ["-en"; "--expand-io-type"]
+      (Arg.Unit (fun _ -> opt.expand_io_type <- true))
+      ["Expand structured types of the main node (impact the simulation only)."]
+    ;
     mkopt opt
       ["-enc"; "---expand-node-call"]
       ~arg:" <string> "
diff --git a/src/lv6MainArgs.mli b/src/lv6MainArgs.mli
index c9911ca7..0d18d50e 100644
--- a/src/lv6MainArgs.mli
+++ b/src/lv6MainArgs.mli
@@ -31,6 +31,7 @@ type t = {
   mutable expand_nodes :  bool;
   mutable expand_node_call :  string list;
   mutable expand_arrays :  bool;
+  mutable expand_io_type :  bool;
   mutable optim_ite : bool;
   mutable gen_autotest :  bool;
   mutable oc :  Pervasives.out_channel;
-- 
GitLab