Commit 676421e4 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Update the lus2lic plugin + fix the lutin doc wrt assert/in.

parent 31ca0228
......@@ -412,14 +412,15 @@ programmer's life more harmonious.
Very often, one wants to define some constraints that should hold in
all (or most) of the program statements. One way to do this is to
create a dummy Boolean variable that carry the constraint, and to put
it in parallel with the statement.
to put it in parallel with the statement, and to raise an exception as
soon as one branch finishes.
\begin{example}
\begin{program}
\key{exist} b : \key{bool} \key{in} \\
\key{let} b = \syn{exp} \key{in} \\
\> b \ES\ \syn{st}\\
\key{trap} stop \key{in} \{\\
\ES \ \key{loop} \{ \syn{exp} \} \key{fby} \key{raise} stop\\
\ES \ \syn{st} \key{fby} \key{raise} stop\\
\}
\end{program}
\end{example}
......
......@@ -49,6 +49,7 @@ SOC_SOURCES = \
$(OBJDIR)/action.ml \
$(OBJDIR)/actionsDeps.mli \
$(OBJDIR)/actionsDeps.ml \
$(OBJDIR)/sortActionsExpe.ml \
$(OBJDIR)/sortActions.mli \
$(OBJDIR)/sortActions.ml \
$(OBJDIR)/lic2soc.mli \
......@@ -93,8 +94,8 @@ LUSTRE_SOURCES = \
$(OBJDIR)/astTab.ml \
$(OBJDIR)/lic.ml \
$(OBJDIR)/idSolver.ml \
$(OBJDIR)/licName.mli \
$(OBJDIR)/licName.ml \
$(OBJDIR)/freshName.mli \
$(OBJDIR)/freshName.ml \
$(OBJDIR)/licDump.ml \
$(OBJDIR)/licPrg.mli \
$(OBJDIR)/licPrg.ml \
......
......@@ -778,11 +778,11 @@ cp-www:
# passer sous oasis ? il a l'air de savoir faire...
lutin-labo-install:
[ -d $(CAML_INSTALL_DIR)/../lutin ] || mkdir $(CAML_INSTALL_DIR)/../lutin
cp -f $(OBJDIR)/*lut4ocaml*.*a $(CAML_INSTALL_DIR)/../lutin
cp -f $(OBJDIR)/lutinRun.cm* $(CAML_INSTALL_DIR)/../lutin
cp -f $(OBJDIR)/*Ezdl_c_stubs* $(CAML_INSTALL_DIR)/../lutin
cp -rf ../pre_release/$(HOSTTYPE)/lib/*.* $(CAML_INSTALL_DIR)/../lutin
cp -rf ../pre_release/$(HOSTT YPE)/lib/*.so $(CAML_INSTALL_DIR)/../stublibs
cp -f $(OBJDIR)/*lut4ocaml*.*a $(CAML_INSTALL_DIR)/../lutin || true
cp -f $(OBJDIR)/lutinRun.cm* $(CAML_INSTALL_DIR)/../lutin || true
cp -f $(OBJDIR)/*Ezdl_c_stubs* $(CAML_INSTALL_DIR)/../lutin || true
cp -rf ../pre_release/$(HOSTTYPE)/lib/*.* $(CAML_INSTALL_DIR)/../lutin || true
cp -rf ../pre_release/$(HOSTT YPE)/lib/*.so $(CAML_INSTALL_DIR)/../stublibs || true
labo: lutin-labo-install
......
(** Time-stamp: <modified the 15/01/2015 (at 10:51) by Erwan Jahier> *)
(** Time-stamp: <modified the 13/03/2015 (at 15:36) by Erwan Jahier> *)
let dbg = (Verbose.get_flag "deps")
......@@ -35,6 +35,17 @@ let (remove_dep : t -> action -> t) =
let (find_deps: t -> action -> action list) =
fun m a ->
try Actions.elements (MapAction.find a m) with Not_found -> []
let rec (depends_on : t -> Action.t -> Action.t -> bool) =
fun m a1 a2 ->
try
let a1_deps = MapAction.find a1 m in
Actions.mem a2 a1_deps ||
(* XXX I should compute the closure of the deps once for all *)
Actions.exists (fun a1 -> depends_on m a1 a2) a1_deps
with
Not_found -> false
(*********************************************************************************)
(** Ajoute une liste de dépendances à une action. *)
......
(** Time-stamp: <modified the 15/01/2015 (at 10:43) by Erwan Jahier> *)
(** Time-stamp: <modified the 17/03/2015 (at 17:48) by Erwan Jahier> *)
(** Compute dependencies between actions *)
......@@ -30,5 +30,10 @@ val find_deps: t -> Action.t -> Action.t list
val have_deps : t -> Action.t -> bool
val remove_dep : t -> Action.t -> t
(* Could also be named is_greater because if a1 depends on a2, it
means that a2 should be computed before, i.e. that a2 is smaller than
a1 *)
val depends_on : t -> Action.t -> Action.t -> bool
val to_string: t -> string
(* Time-stamp: <modified the 26/02/2015 (at 11:20) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/03/2015 (at 14:30) by Erwan Jahier> *)
open Lxm
open Lv6errors
......@@ -150,8 +150,7 @@ let test_lex ( lexbuf ) = (
(* Retourne un AstV6.t *)
let lus_load lexbuf =
let tree = Lv6parser.program Lv6lexer.lexer lexbuf in
LicName.update_fresh_var_prefix ();
(* ICI *)
FreshName.update_fresh_var_prefix ();
AstRecognizePredef.f tree
type maybe_packed =
......
(** Time-stamp: <modified the 26/02/2015 (at 11:21) by Erwan Jahier> *)
(** Time-stamp: <modified the 03/03/2015 (at 14:27) by Erwan Jahier> *)
(* Replace structures and arrays by as many variables as necessary.
Since structures can be nested, it migth be a lot of new variables...
......@@ -38,7 +38,6 @@ let dbg = (Verbose.get_flag "esa")
(********************************************************************************)
(* pack useful info (while expanding nodes) into a single struct *)
type local_ctx = {
idgen : LicPrg.id_generator;
node : Lic.node_exp;
prg : LicPrg.t;
}
......@@ -47,8 +46,7 @@ type local_ctx = {
XXX code dupl. with Split.new_var
*)
let new_var str lctx type_eff clock_eff =
let id = Lv6Id.of_string (LicName.new_local_var str) in
(* let id = lctx.idgen str in (* XXX use which one ??? *) *)
let id = Lv6Id.of_string (FreshName.local_var str) in
let var =
{
var_name_eff = id;
......@@ -655,7 +653,6 @@ let rec (doit : LicPrg.t -> LicPrg.t) =
Verbose.exe ~flag:dbg (fun() -> Printf.printf "#DBG: L2lExpandArrays expands '%s'\n"
(Lic.string_of_node_key nk));
let lctx = {
idgen = LicPrg.fresh_var_id_generator inprg ne;
node = ne;
prg = inprg;
}
......
(** Time-stamp: <modified the 26/02/2015 (at 11:21) by Erwan Jahier> *)
(** Time-stamp: <modified the 03/03/2015 (at 14:27) by Erwan Jahier> *)
open Lxm
open Lic
......@@ -7,7 +7,6 @@ let dbg = (Verbose.get_flag "ei")
(* pack useful info into a single struct *)
type local_ctx = {
idgen : LicPrg.id_generator;
node : Lic.node_exp;
prg : LicPrg.t;
}
......@@ -15,7 +14,7 @@ type local_ctx = {
(********************************************************************************)
(* stuff to create fresh var names. *)
let new_var str lctx type_eff clock_eff =
let id = Lv6Id.of_string (LicName.new_local_var str) in
let id = Lv6Id.of_string (FreshName.local_var str) in
let var =
{
var_name_eff = id;
......@@ -515,7 +514,6 @@ let (doit : LicPrg.t -> LicPrg.t) =
let rec (do_node : Lic.node_key -> Lic.node_exp -> LicPrg.t -> LicPrg.t) =
fun nk ne outprg ->
let lctx = {
idgen = LicPrg.fresh_var_id_generator inprg ne;
node = ne;
prg = inprg;
}
......
(* Time-stamp: <modified the 26/02/2015 (at 11:27) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/03/2015 (at 14:27) by Erwan Jahier> *)
open Lxm
......@@ -15,7 +15,7 @@ type local_ctx = {
}
(********************************************************************************)
let new_var = LicName.new_var_info
let new_var = FreshName.var_info
(********************************************************************************)
let get_locals node =
......
......@@ -17,16 +17,13 @@ let info msg =
(********************************************************************************)
(* XXX use LicName.new_var_info *)
let new_var getid type_eff clock_eff =
let id = getid "v" in
let new_var type_eff clock_eff =
let id = Lv6Id.of_string (FreshName.local_var "v") in
let var =
{
var_name_eff = id;
var_nature_eff = AstCore.VarLocal;
var_number_eff = -1; (* this field is used only for i/o.
Should i rather put something sensible there ? *)
var_number_eff = -1;
var_type_eff = type_eff;
var_clock_eff = id,clock_eff;
} in
......@@ -163,21 +160,19 @@ let (split_tuples:Lic.eq_info Lxm.srcflagged list -> Lic.eq_info Lxm.srcflagged
*)
type split_acc = (Lic.eq_info srcflagged) list * Lic.var_info list
let rec (eq : LicPrg.id_generator -> Lic.eq_info Lxm.srcflagged -> split_acc) =
fun getid { src = lxm_eq ; it = (lhs, rhs) } ->
let n_rhs, (neqs, nlocs) = split_val_exp false true getid rhs in
let rec (eq : Lic.eq_info Lxm.srcflagged -> split_acc) =
fun { src = lxm_eq ; it = (lhs, rhs) } ->
let n_rhs, (neqs, nlocs) = split_val_exp false true rhs in
{ src = lxm_eq ; it = (lhs, n_rhs) }::neqs, nlocs
and (split_eq_acc :
LicPrg.id_generator -> split_acc -> Lic.eq_info srcflagged -> split_acc) =
fun getid (eqs, locs) equation ->
let (neqs, nlocs) = eq getid equation in
and (split_eq_acc : split_acc -> Lic.eq_info srcflagged -> split_acc) =
fun (eqs, locs) equation ->
let (neqs, nlocs) = eq equation in
let neqs = split_tuples neqs in
List.rev_append neqs eqs, List.rev_append nlocs locs
and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
Lic.val_exp * split_acc) =
fun when_flag top_level getid ve ->
and (split_val_exp : bool -> bool -> Lic.val_exp -> Lic.val_exp * split_acc) =
fun when_flag top_level ve ->
(* [when_flag] is true is the call is made from a "when" statement.
We need this flag in order to know if it is necessary to add
a when on constants. Indeed, in Lustre V6, it is not necessary
......@@ -191,9 +186,9 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
*)
match ve.ve_core with
| Merge(ce,cl) -> (
let ce,(eql1, vl1) = split_val_exp false false getid ce in
let ce,(eql1, vl1) = split_val_exp false false ce in
let const_l, vel = List.split cl in
let vel,(eql2, vl2) = split_val_exp_list false false getid vel in
let vel,(eql2, vl2) = split_val_exp_list false false vel in
let eql, vl = eql1@eql2, vl1@vl2 in
let cl = List.combine const_l vel in
let rhs = { ve with ve_core = Merge(ce,cl)} in
......@@ -202,7 +197,7 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
let clk_l = ve.ve_clk in
let typ_l = ve.ve_typ in
assert (List.length typ_l = List.length clk_l);
let nv_l = List.map2 (new_var getid) typ_l clk_l in
let nv_l = List.map2 new_var typ_l clk_l in
let lxm = lxm_of_val_exp ve in
let vi2val_exp nv =
let _,clk = nv.var_clock_eff in
......@@ -243,7 +238,7 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
let fl, eql, vl =
List.fold_left
(fun (fl_acc, eql_acc, vl_acc) (fn, fv) ->
let fv, (eql, vl) = split_val_exp false false getid fv in
let fv, (eql, vl) = split_val_exp false false fv in
((fn,fv)::fl_acc, eql@eql_acc, vl@vl_acc)
)
([],[],[])
......@@ -257,7 +252,7 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
let clk_l = ve.ve_clk in
let typ_l = ve.ve_typ in
assert (List.length typ_l = List.length clk_l);
let nv_l = List.map2 (new_var getid) typ_l clk_l in
let nv_l = List.map2 new_var typ_l clk_l in
let nve = match nv_l with
| [nv] -> { ve with ve_core =
CallByPosLic(
......@@ -276,17 +271,17 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
let (rhs, (eql,vl)) =
match by_pos_op_eff.it with
| Lic.HAT(i) ->
let vel, (eql, vl) = split_val_exp_list false false getid vel in
let vel, (eql, vl) = split_val_exp_list false false vel in
let by_pos_op_eff = Lxm.flagit (Lic.HAT(i)) lxm in
let rhs = CallByPosLic(by_pos_op_eff, vel) in
rhs, (eql, vl)
| Lic.WHEN ve -> (* should we create a var for the clock? *)
let vel,(eql, vl) = split_val_exp_list true false getid vel in
let vel,(eql, vl) = split_val_exp_list true false vel in
let by_pos_op_eff = Lxm.flagit (Lic.WHEN(ve)) lxm in
let rhs = CallByPosLic(by_pos_op_eff, vel) in
rhs, (eql, vl)
| _ ->
let vel, (eql, vl) = split_val_exp_list false false getid vel in
let vel, (eql, vl) = split_val_exp_list false false vel in
let rhs = CallByPosLic(by_pos_op_eff, vel) in
rhs, (eql, vl)
in
......@@ -298,7 +293,7 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
let clk_l = ve.ve_clk in
let typ_l = ve.ve_typ in
assert (List.length typ_l = List.length clk_l);
let nv_l = List.map2 (new_var getid) typ_l clk_l in
let nv_l = List.map2 new_var typ_l clk_l in
let nve =
match nv_l with
| [nv] -> {
......@@ -334,17 +329,16 @@ and (split_val_exp : bool -> bool -> LicPrg.id_generator -> Lic.val_exp ->
nve, (eql@[eq], vl@nv_l)
)
and (split_val_exp_list : bool ->
bool -> LicPrg.id_generator -> Lic.val_exp list -> Lic.val_exp list * split_acc) =
fun when_flag top_level getid vel ->
and (split_val_exp_list : bool -> bool -> Lic.val_exp list -> Lic.val_exp list * split_acc) =
fun when_flag top_level vel ->
let vel, accl =
List.split (List.map (split_val_exp when_flag top_level getid) vel)
List.split (List.map (split_val_exp when_flag top_level) vel)
in
let eqll,vll = List.split accl in
let eql, vl = List.flatten eqll, List.flatten vll in
(vel,(eql,vl))
and split_node (opt:Lv6MainArgs.t) (getid: LicPrg.id_generator) (n: Lic.node_exp) : Lic.node_exp =
and split_node (opt:Lv6MainArgs.t) (n: Lic.node_exp) : Lic.node_exp =
Verbose.exe ~flag:dbg (fun () ->
Printf.eprintf "*** Splitting node %s\n"
(LicDump.string_of_node_key_iter n.node_key_eff);
......@@ -354,10 +348,10 @@ and split_node (opt:Lv6MainArgs.t) (getid: LicPrg.id_generator) (n: Lic.node_exp
| MetaOpLic
| AbstractLic None -> n
| AbstractLic (Some pn) ->
{ n with def_eff = AbstractLic (Some (split_node opt getid pn)) }
{ n with def_eff = AbstractLic (Some (split_node opt pn)) }
| BodyLic b ->
let loc = match n.loclist_eff with None -> [] | Some l -> l in
let (neqs, nv) = List.fold_left (split_eq_acc getid) ([], loc) b.eqs_eff in
let (neqs, nv) = List.fold_left (split_eq_acc) ([], loc) b.eqs_eff in
info (Printf.sprintf "Split %i equations into %i ones\n"
(List.length b.eqs_eff)(List.length neqs));
......@@ -370,7 +364,7 @@ and split_node (opt:Lv6MainArgs.t) (getid: LicPrg.id_generator) (n: Lic.node_exp
let asserts = List.map (fun x -> x.it) b.asserts_eff in
let lxm_asserts = List.map (fun x -> x.src) b.asserts_eff in
let nasserts,(neqs_asserts,nv_asserts) =
split_val_exp_list false true getid asserts
split_val_exp_list false true asserts
in
assert (List.length nasserts = List.length lxm_asserts);
let nasserts = List.map2 Lxm.flagit nasserts lxm_asserts in
......@@ -403,8 +397,7 @@ let rec doit (opt:Lv6MainArgs.t) (inprg : LicPrg.t) : LicPrg.t =
let rec do_node k (ne:Lic.node_exp) =
(* On passe en parametre un constructeur de nouvelle variable locale *)
info (Printf.sprintf "#DBG: split equations of '%s'\n" (Lic.string_of_node_key k));
let getid = LicPrg.fresh_var_id_generator inprg ne in
let ne' = split_node opt getid ne in
let ne' = split_node opt ne in
res := LicPrg.add_node k ne' !res
in
(*LET's GO *)
......
(** Time-stamp: <modified the 26/02/2015 (at 11:21) by Erwan Jahier> *)
(** Time-stamp: <modified the 08/04/2015 (at 14:36) by Erwan Jahier> *)
(* XXX ce module est mal crit. A reprendre. (R1) *)
......@@ -855,7 +855,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
| _ -> assert false (* hmm. Iterating on a pre will not work. XXX fixme ! *)
in
let rec make_n_instance ctx acc n =
if n=0 then ctx,acc else
if n=0 then ctx, List.rev acc else
match make_instance lxm Lic.BaseLic ctx nsoc with
| ctx,Some inst -> make_n_instance ctx (inst::acc) (n-1)
| ctx,None -> ctx,[]
......
(* Time-stamp: <modified the 26/02/2015 (at 11:22) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/03/2015 (at 14:26) by Erwan Jahier> *)
open Lv6errors
open Printf
......@@ -248,7 +248,7 @@ and string_of_node_key_rec (no_prefix:bool) (nkey: node_key) =
| (ik, salst) ->
let astrings = List.map static_arg2string_bis salst in
let name = sprintf "%s_%s" (Lv6Id.no_pack_string_of_long ik) (String.concat "_" astrings) in
(LicName.node_key nkey name)
(FreshName.node_key nkey name)
(* for printing iterators *)
and string_of_node_key_iter (nkey: node_key) =
......
(* Time-stamp: <modified the 11/04/2013 (at 15:31) by Erwan Jahier> *)
(* Time-stamp: <modified the 07/04/2015 (at 15:05) by Erwan Jahier> *)
(* *)
......@@ -215,8 +215,7 @@ and do_boolred nk2nd nk lxm =
outlist_eff = outs;
loclist_eff = None;
def_eff = MetaOpLic;
(* ???? *)
has_mem_eff = true;
has_mem_eff = false;
is_safe_eff = true;
lxm = lxm;
}
......
(* Time-stamp: <modified the 26/02/2015 (at 11:22) by Erwan Jahier> *)
(* Time-stamp: <modified the 16/01/2015 (at 13:53) by Erwan Jahier> *)
(* maps node_key to a string that won't clash *)
......@@ -16,7 +16,7 @@ let (node_key: Lic.node_key -> string -> string) =
with Not_found ->
(* let's build an ident that won't clash *)
(* all new name should not begins with a "_" ; hence we prefix by "n_" *)
let name = if name = "" then "n_" ^ (Lv6Id.no_pack_string_of_long long) else name in
let name = if name = "" then "n_" ^ (Ident.no_pack_string_of_long long) else name in
if not (Hashtbl.mem node_name_tbl name) then
(
(* that name won't clash, but let's tabulate it *)
......@@ -140,7 +140,7 @@ let (new_local_var : string -> string) =
open Lic
let (new_var_info : string -> Lic.type_ -> Lic.id_clock -> Lic.var_info) =
fun str type_eff clock_eff ->
let id = Lv6Id.of_string (new_local_var str) in
let id = Ident.of_string (new_local_var str) in
let var =
{
var_name_eff = id;
......
(* Time-stamp: <modified the 26/02/2015 (at 11:22) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/03/2015 (at 10:42) by Erwan Jahier> *)
module ItemKeyMap = struct
include Map.Make (
......@@ -47,15 +47,6 @@ let rec pretty_sfx i =
else
(pretty_sfx ((i-1)/5))^(Char.escaped (char_of_int (97 + (i-1) mod 5)))
(** CREER DES IDENTS TOUT FRAIS *)
let fresh_type_id this pname pfx =
let rec fresh x =
let id = Printf.sprintf "%s%s" pfx (pretty_sfx x) in
let res = Lv6Id.make_long pname id in
if ItemKeyMap.mem res this.types then fresh (x+1)
else res
in
fresh 0
(** RECHERCHE *)
let find_type this k = try Some(ItemKeyMap.find k this.types ) with Not_found -> None
......@@ -265,38 +256,16 @@ let to_file (opt: Lv6MainArgs.t) (this:t) (main_node: Lv6Id.idref option) =
this.nodes
)
(* GENERATEUR DE NOM DE VARIABLES
(********************************************************************************)
(* exported *)
(** Creer Des Idents De Type Tout Frais *)
let fresh_type_id this pname pfx =
let rec fresh x =
let id = Printf.sprintf "%s%s" pfx (pretty_sfx x) in
let res = Lv6Id.make_long pname id in
if ItemKeyMap.mem res this.types then fresh (x+1)
else res
in
fresh 0
XXX Refait le boulot de LicName !!! Merger les 2 mechanismes et prendre le meilleur !!!
ce qui est sur, c'est qu'il est mal rangé ici !!!
*)
type id_generator = string -> string
let fresh_var_id_generator : t -> Lic.node_exp -> id_generator =
fun prg ne ->
let cpt = ref 0 in
let forbidden = Hashtbl.create 100 in
let _ = iter_consts (fun i c -> match c with
| Lic.Extern_const_eff (s,_)
| Lic.Abstract_const_eff (s,_,_,_)
| Lic.Enum_const_eff (s,_) -> Hashtbl.add forbidden (snd s) ()
| _ -> ()
) prg in
let dovar vi = Hashtbl.add forbidden vi.Lic.var_name_eff () in
let _ = List.iter dovar ne.Lic.inlist_eff in
let _ = List.iter dovar ne.Lic.outlist_eff in
let _ = match ne.Lic.loclist_eff with
| Some l -> List.iter dovar l | None -> ()
in
let rec dogen (pfx: string) : string =
let id = Printf.sprintf "%s%02d" pfx !cpt in
incr cpt;
try (
let _ = Hashtbl.find forbidden id in
dogen pfx
) with Not_found -> (
Hashtbl.add forbidden id ();
id
)
in
dogen
(* Time-stamp: <modified the 26/02/2015 (at 13:45) by Erwan Jahier> *)
(* Time-stamp: <modified the 03/03/2015 (at 10:42) by Erwan Jahier> *)
(** The data structure resulting from the compilation process *)
......@@ -57,14 +57,3 @@ val choose_node : t -> (Lic.node_key * Lic.node_exp) option
val find_var : Lv6Id.t -> Lic.node_exp -> Lic.var_info option
val fresh_type_id : t -> Lv6Id.pack_name -> string -> Lv6Id.long
(** utile : générateur de noms de flow 'frais'
ATTENTION ! si on en utilise plusieurs
en meme temps, il ne doivent pas interferer !
*)
type id_generator = string -> string
(** Initialisé avec
- le programme (pour éviter les constantes existantes)
- le noeud auquel on veut ajouter des variables
Et renvoie un générateur d'id unique prefixe -> nom *)
val fresh_var_id_generator : t -> Lic.node_exp -> id_generator
(* Time-stamp: <modified the 27/02/2015 (at 09:22) by Erwan Jahier> *)
(* Time-stamp: <modified the 27/02/2015 (at 10:04) by Erwan Jahier> *)
(*-----------------------------------------------------------------------
** Copyright (C) - Verimag.
*)
......@@ -42,8 +42,13 @@ let make argv =
)
in
let soc = try Soc.SocMap.find sk soc_tbl with Not_found -> assert false in
let soc_inputs = (SocVar.expand_profile true false (fst soc.profile)) in
let soc_outputs = (SocVar.expand_profile true false (snd soc.profile)) in
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; *)
......
(* Time-stamp: <modified the 27/02/2015 (at 09:19) by Erwan Jahier> *)
(* Time-stamp: <modified the 10/04/2015 (at 17:42) by Erwan Jahier> *)
(*
Le manager d'argument adapt de celui de lutin, plus joli
N.B. solution un peu batarde : les options sont stockes, comme avant, dans Global,
......@@ -13,6 +13,7 @@ let usage_msg = "usage: "^tool_name^" [options] <file> | "^tool_name^" -help"
type enum_mode = AsInt | AsConst | AsEnum
type io_transmit_mode = Stack | Heap | HeapStack
type schedul_mode = Simple | Sort | Reorder
type t = {
mutable opts : (string * Arg.spec * string) list; (* classical Arg option tab used by Arg.parse *)
......@@ -37,6 +38,7 @@ type t = {
mutable tlex : bool;
mutable exec : bool;
mutable gen_c : bool;
mutable gen_wcet : bool;
mutable rif : bool;
mutable gen_ocaml : bool;
mutable launch_cc : bool;
......@@ -57,7 +59,9 @@ type global_opt = {
mutable line_num : int;
mutable line_start_pos : int;
mutable soc2c_no_switch : bool;
mutable soc2c_inline_loops : bool;
mutable io_transmit_mode : io_transmit_mode;
mutable schedul_mode : schedul_mode;
}
let (global_opt:global_opt) =
{
......@@ -72,7 +76,9 @@ let (global_opt:global_opt) =
current_file = "";
expand_enums = AsInt;
soc2c_no_switch = false;
soc2c_inline_loops = false;
io_transmit_mode = Stack;
schedul_mode = Simple;
}
let (make_opt : unit -> t) =
fun () ->
......@@ -100,6 +106,7 @@ let (make_opt : unit -> t) =
tlex = false;
exec = false;
gen_c = false;
gen_wcet = false;
rif = false;
gen_ocaml = false;
precision = None;
......@@ -283,11 +290,11 @@ let mkoptab (opt:t) : unit = (
;
mkopt opt
["-en"; "--expand-nodes"]
(Arg.Unit (fun _ -> opt.expand_nodes <- true))
(Arg.Unit (fun _ -> opt.expand_nodes <- true; opt.inline_iterator <- true (* an iterator is a kind of node *)))
["Expand all node calls in the main node."]
;
mkopt opt
["-en"; "--expand-io-typ