diff --git a/src/actionsDeps.ml b/src/actionsDeps.ml index a99d9ec17d8b8812eee213dca7f00c8b9fb87075..7f9141b6faea776a57b19cf5cda399b0d24f3dfb 100644 --- a/src/actionsDeps.ml +++ b/src/actionsDeps.ml @@ -1,5 +1,6 @@ -(** Time-stamp: <modified the 20/03/2013 (at 10:55) by Erwan Jahier> *) +(** Time-stamp: <modified the 21/03/2013 (at 15:30) by Erwan Jahier> *) +let dbg = Some(Verbose.get_flag "exec") (* exported *) type rhs = Soc.var_expr list @@ -121,6 +122,26 @@ type var2actions_tbl = Actions.t VarMap.t let var2actions = VarMap.find +let rec (get_parents : Soc.var_expr -> Soc.var_expr list) = + fun var -> +(* if var = t.[2].field, then it returns (also) t.[2] and t *) + match var with + | Soc.Field(ve,_,_) + | Soc.Index(ve,_,_) -> ve::(get_parents ve) + | Soc.Var(_,vt) + | Soc.Const(_,vt) -> [var] + +let rec (get_top_var : Soc.var_expr -> Soc.var_expr) = + fun var -> +(* if var = t.[2].field, then it returns (also) t.[2] and t *) + match var with + | Soc.Field(ve,_,_) + | Soc.Index(ve,_,_) -> get_top_var ve + | Soc.Var(_,vt) + | Soc.Const(_,vt) -> var + + + (** TODO jb: On a peut-être pas besoin de stocker les actions dans des set, il devrait n'y avoir qu'une seule action pour chaque sortie en théorie (?) *) @@ -131,10 +152,11 @@ let (get_var2actions_tbl : action list -> var2actions_tbl) = let _, _, lhs, _, lxm = action in let (tabulate_output:var2actions_tbl -> Soc.var_expr -> var2actions_tbl) = fun tbl output -> - let tabulate_action = try var2actions output tbl + let v = get_top_var output in + let tabulate_action = try var2actions v tbl with Not_found -> Actions.empty in - VarMap.add output (Actions.add action tabulate_action) tbl + VarMap.add v (Actions.add action tabulate_action) tbl in List.fold_left tabulate_output tbl lhs in @@ -147,22 +169,12 @@ let (get_var2actions_tbl : action list -> var2actions_tbl) = ont besoin d'être effectuées avant de pouvoir se servir de [input_vars] comme entrée d'une autre action. - XXX si t de type tableau depend de x, il ne voit pas que t[i] aussi !!! TODO: gérer les dépendances entre des filtres plus complexes, comme par ex., l'utilisation d'un champ d'une structure nécessite d'avoir initialisé la structure parente. *) -let rec (get_parents : Soc.var_expr -> Soc.var_expr list) = - fun var -> -(* if var = t.[2].field, then it returns (also) t.[2] and t *) - match var with - | Soc.Field(ve,_) - | Soc.Index(ve,_,_) -> ve::(get_parents ve) - | Soc.Var(_,vt) - | Soc.Const(_,vt) -> [var] - let rec (actions_of_vars: Soc.var_expr list -> var2actions_tbl -> action list) = fun vars tbl -> @@ -213,23 +225,27 @@ let build_data_deps_from_actions: t -> action list -> t = let deps = List.fold_left (fun acc_deps action -> - let (_, rhs, _, _,_) = action in - let deps = actions_of_vars rhs tbl in - if deps = [] then ( - print_string ("\n====> No deps for " ^ - (String.concat "," (List.map SocUtils.string_of_filter rhs))); - acc_deps - ) - else - add_deps acc_deps action deps + let (_, rhs, _, _,_) = action in + let deps = actions_of_vars rhs tbl in + if deps = [] then ( + Verbose.exe ~flag:dbg (fun () -> + print_string ("\n====> No deps for " ^ + (String.concat "," (List.map SocUtils.string_of_filter rhs)))); + acc_deps + ) + else + add_deps acc_deps action deps ) deps al in - let al_str = List.map string_of_action al in -(* print_string (String.concat "\n " al_str); *) -(* print_string (string_of_var2actions_tbl tbl); *) -(* flush stdout; *) + Verbose.exe ~flag:dbg (fun () -> + let al_str = List.map string_of_action al in + print_string "\n ====> List of actions to be sorted:\n"; + print_string (String.concat "\n " al_str); + print_string "\n ====> List of computed dependencies:\n"; + print_string (string_of_var2actions_tbl tbl); + flush stdout); deps (*********************************************************************************) diff --git a/src/lic2soc.ml b/src/lic2soc.ml index ea6c122de06fde51c5418ae6285c1de6d61aa245..0252c7cfefb4f2940239589f1662921183e73cba 100644 --- a/src/lic2soc.ml +++ b/src/lic2soc.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 19/03/2013 (at 18:17) by Erwan Jahier> *) +(** Time-stamp: <modified the 21/03/2013 (at 09:56) by Erwan Jahier> *) open Lxm open Lic @@ -129,7 +129,7 @@ let rec get_leaf: (LicPrg.t -> Lic.val_exp -> Soc.var_expr list option) = | None -> assert false | _ -> assert false in - Some [Soc.Field(filter_expr, (field, type_))] + Some [Soc.Field(filter_expr, field, type_)] ) | Lic.ARRAY_ACCES i -> ( let expr = match val_exp_list with [e] -> e | _ -> assert false in @@ -192,7 +192,7 @@ let rec filter_of_left_part: (LicPrg.t -> Lic.left -> Soc.var_expr list) = ) | Lic.LeftFieldLic(lp,field,t) -> ( let lpl = filter_of_left_part licprg lp in - List.map (fun lp -> Soc.Field(lp, (field, lic_to_soc_type t))) lpl + List.map (fun lp -> Soc.Field(lp, field, lic_to_soc_type t)) lpl ) | Lic.LeftArrayLic(lp,index,t) -> ( let lpl = filter_of_left_part licprg lp in @@ -299,7 +299,7 @@ let (val_exp_to_filter: LicPrg.t -> Lic.val_exp -> Soc.var_expr) = | None -> assert false | _ -> assert false in - Soc.Field(filter_expr, (field, type_)) + Soc.Field(filter_expr, field, type_) ) | ARRAY_ACCES i -> ( let expr = match val_exp_list with [e] -> e | _ -> assert false in @@ -447,7 +447,7 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> let filter_to_field filter field ftype = let ftype = match ftype with [x] -> x | _ -> assert false in let filter = match filter with [x] -> x | _ -> assert false in - Soc.Field(filter, (field, lic_to_soc_type ftype)) + Soc.Field(filter, field, lic_to_soc_type ftype) in let actions = List.map diff --git a/src/soc.ml b/src/soc.ml index cc737a0f5680622a4429d5dc3e852b681f24313e..6fcbfe274e27b9af1b1d2fe58e0c1c5d9ac339b8 100644 --- a/src/soc.ml +++ b/src/soc.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 19/03/2013 (at 15:08) by Erwan Jahier> *) +(* Time-stamp: <modified the 21/03/2013 (at 09:55) by Erwan Jahier> *) (** Synchronous Object Component *) @@ -29,14 +29,14 @@ type instance = ident * key type var_expr = | Var of var | Const of var (* useful? *) - | Field of var_expr * var + | Field of var_expr * ident * var_type | Index of var_expr * int * var_type let (var_type_of_var_expr : var_expr -> var_type) = function | Var(_,vt) | Const(_,vt) - | Field(_, (_,vt)) + | Field(_, _,vt) | Index(_,_,vt) -> vt diff --git a/src/socExecEvalPredef.ml b/src/socExecEvalPredef.ml index c372d2dab0d6c887bb4ac7ac9ac5b79bbc2b9f84..da5a17851119c1c0818c3759fc43cd6895554d1d 100644 --- a/src/socExecEvalPredef.ml +++ b/src/socExecEvalPredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 20/03/2013 (at 17:57) by Erwan Jahier> *) +(* Time-stamp: <modified the 21/03/2013 (at 11:34) by Erwan Jahier> *) open SocExecValue open Soc @@ -191,15 +191,7 @@ let lustre_impl ctx = let lustre_if ctx = let (vn,vv) = match ([get_val "c" ctx; get_val "xt" ctx; get_val "xe" ctx]) with - | [B c; I x1; I x2] -> "z"::ctx.cpath,I(if c then x1 else x2) - | [B c; F x1; F x2] -> "z"::ctx.cpath,F(if c then x1 else x2) - | [B c; B x1; B x2] -> "z"::ctx.cpath,B(if c then x1 else x2) - | [B c; I x1; U] -> "z"::ctx.cpath,if c then I x1 else U - | [B c; U; I x2] -> "z"::ctx.cpath,if c then U else I x2 - | [B c; B x1; U] -> "z"::ctx.cpath,if c then B x1 else U - | [B c; U; B x2] -> "z"::ctx.cpath,if c then U else B x2 - | [B c; F x1; U] -> "z"::ctx.cpath,if c then F x1 else U - | [B c; U; F x2] -> "z"::ctx.cpath,if c then U else F x2 + | [B c; v1; v2] -> "z"::ctx.cpath, if c then v1 else v2 | [U;_; _] | [_;U;U] -> "z"::ctx.cpath,U | _ -> assert false in @@ -228,11 +220,8 @@ let lustre_array tl ctx = in let (vn,vv) = match ([get_val "x" ctx]) with - | [B x] -> "z"::ctx.cpath,A(Array.make i (B x)) - | [I x] -> "z"::ctx.cpath,A(Array.make i (I x)) - | [F x] -> "z"::ctx.cpath,A(Array.make i (F x)) - | [A x] -> "z"::ctx.cpath,A(Array.make i (A x)) | [U] -> "z"::ctx.cpath,U + | [v] -> "z"::ctx.cpath,A(Array.make i v) | _ -> assert false in { ctx with s = sadd ctx.s vn vv } diff --git a/src/socExecValue.ml b/src/socExecValue.ml index d5874415351925737325a8133ea09fd221e597cf..e1292af7940aef3f5084a6508d5ab389c9413385 100644 --- a/src/socExecValue.ml +++ b/src/socExecValue.ml @@ -1,8 +1,9 @@ -(* Time-stamp: <modified the 20/03/2013 (at 17:27) by Erwan Jahier> *) +(* Time-stamp: <modified the 21/03/2013 (at 11:22) by Erwan Jahier> *) open Soc -type t = I of int | F of float | B of bool | E of Soc.ident | A of t array | U +type t = I of int | F of float | B of bool | E of Soc.ident + | A of t array | S of (Soc.ident * t) list | U (* Meant to represent paths in the call tree. Actually it both represent path and variable with a path, depending on the @@ -40,7 +41,7 @@ let rec (get_top_var_type : Soc.var_expr -> Soc.var_type) = match ve with | Var(_,vt) -> vt | Index(ve,_,_) - | Field(ve, _) -> get_top_var_type ve + | Field(ve, _, _) -> get_top_var_type ve | Const(id,_) -> assert false type access = Idx of int | Fld of ident @@ -50,7 +51,7 @@ let rec (get_access : Soc.var_expr -> access list) = match ve with | Var(id,_) -> [] | Index(ve,i,_) -> (Idx i)::(get_access ve) - | Field(ve, (n,_)) -> (Fld n)::(get_access ve) + | Field(ve, n,_) -> (Fld n)::(get_access ve) | Const(id,_) -> assert false let rec (update_val : t -> t -> access list -> t) = @@ -62,6 +63,10 @@ let rec (update_val : t -> t -> access list -> t) = let a_i = update_val a.(i) v access in a.(i) <- a_i; A a + | S(fl), (Fld fn)::access -> + S (List.map + (fun (fn2,v2) -> if fn=fn2 then fn,update_val v2 v access else (fn2,v2)) + fl) | _,_ -> assert false (* finish me (field struct) *) let (update_leaf : var_expr -> t -> t -> substs) = @@ -80,7 +85,9 @@ let rec (create_val : Soc.var_type -> t -> access list -> t) = let a_i = create_val vt v access in a.(i) <- a_i; A a - | _,_ -> assert false (* finish me (field struct) *) + | Struct(sn,fl), (Fld fn)::access -> + S(List.map (fun (fn2,vt2) -> if fn=fn2 then fn,create_val vt2 v access else fn2,U) fl) + | _,_ -> assert false let (create_leaf : var_expr -> t -> substs) = fun ve v -> @@ -167,6 +174,7 @@ let rec (to_string : t -> string) = | B true -> "t" | B false -> "f" | E e -> e + | S fl -> String.concat " " (List.map (fun (fn,fv) -> to_string fv) fl) | A a -> let str = ref "" in let f i a = str := !str ^ " " ^ (to_string a) in @@ -250,18 +258,12 @@ let (get_val : ident -> ctx -> t) = print_string msg; flush stdout; assert false - - let (get_enum : ident -> ctx -> ident) = fun id ctx -> match get_val id ctx with | E e -> e | _ -> assert false (* should not fail *) - - - - let rec (get_value : ctx -> var_expr -> t) = fun ctx v -> match v with @@ -271,7 +273,16 @@ let rec (get_value : ctx -> var_expr -> t) = | Const(id_in,Int) -> I (int_of_string id_in) | Const(id_in,Real) -> F (float_of_string id_in) | Const(id,_) -> assert false (* finish me! *) - | Field(_,_) -> assert false (* finish me! *) + | Field(ve,fn,t) -> + let s = get_value ctx ve in + (match s with + | S fl -> ( + try List.assoc fn fl + with Not_found -> assert false (* should not occur *) + ) + | _ -> assert false (* should not occur *) + ) + | Index(ve,i,vt) -> let a = get_value ctx ve in match a with diff --git a/src/socExecValue.mli b/src/socExecValue.mli index c540ba4560d5426e5862d8a4e88a18e342b5a818..14b8c38ffc830a9efa3025e77a5d657581ee2fb1 100644 --- a/src/socExecValue.mli +++ b/src/socExecValue.mli @@ -1,8 +1,10 @@ -(* Time-stamp: <modified the 20/03/2013 (at 17:23) by Erwan Jahier> *) +(* Time-stamp: <modified the 20/03/2013 (at 18:36) by Erwan Jahier> *) (** Manipulating data in the Soc interpreter *) -type t = | I of int | F of float | B of bool | E of Soc.ident | A of t array +type t = | I of int | F of float | B of bool | E of Soc.ident + | A of t array + | S of (Soc.ident * t) list | U (* to set uninitialized mem *) type path = Soc.ident list diff --git a/src/socPredef.ml b/src/socPredef.ml index b15b12611e527aa7b696d45b573d8928c535aa1b..b5df28ffd700c44cc456d0875d74ed20f9685578 100644 --- a/src/socPredef.ml +++ b/src/socPredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 20/03/2013 (at 18:01) by Erwan Jahier> *) +(* Time-stamp: <modified the 21/03/2013 (at 10:48) by Erwan Jahier> *) (** Synchronous Object Code for Predefined operators. *) @@ -13,38 +13,18 @@ let b = Soc.Bool let i = Soc.Int let r = Soc.Real -let bb = ["x", b], ["z", b] -let ii = ["x", i], ["z", i] -let rr = ["x", r], ["z", r] -let ri = ["x", r], ["z", i] -let ir = ["x", i], ["z", r ] - -let bbb = ["x", b; "y", b], ["z", b] -let iii = ["x", i; "y", i], ["z", i] -let rrr = ["x", r; "y", r], ["z", r] -let rrb = ["x", r; "y", r], ["z", b] -let iib = ["x", i; "y", i], ["z", b] +let aa t1 t2 = ["x", t1], ["z", t2] +let aaa t1 t2 t3 = ["x", t1; "y",t2], ["z", t3] (* if/then/else *) -let bbbb = ["c", b; "xt", b; "xe", b], ["z", b] -let biii = ["c", b; "xt", i; "xe", i], ["z", i] -let brrr = ["c", b; "xt", r; "xe", r], ["z", r] +let baaa t = ["c", b; "xt", t; "xe", t], ["z", t] let (soc_profile_of_types : Soc.var_type list -> var list * var list) = function - | [Soc.Bool;Soc.Bool] -> bb - | [Soc.Bool;Soc.Bool;Soc.Bool] -> bbb - | [Soc.Int ;Soc.Int] -> ii - | [Soc.Int ;Soc.Int ;Soc.Int] -> iii - | [Soc.Int ;Soc.Int ;Soc.Bool] -> iib - | [Soc.Real;Soc.Real] -> rr - | [Soc.Real;Soc.Int] -> ri - | [Soc.Int ;Soc.Real] -> ir - | [Soc.Real;Soc.Real;Soc.Real] -> rrr - | [Soc.Real;Soc.Real;Soc.Bool] -> rrb - | [Soc.Bool;Soc.Bool;Soc.Bool;Soc.Bool] -> bbbb - | [Soc.Bool;Soc.Int ;Soc.Int;Soc.Int] -> biii - | [Soc.Bool;Soc.Real;Soc.Real;Soc.Real] -> brrr + | [t1; t2] -> aa t1 t2 + | [t1;t2;t3] -> aaa t1 t2 t3 + | [Bool;t1;t2;t3] -> baaa t1 + | tl -> (* diese and xor XXX todo *) print_string ("Unsupported case: "^ ( @@ -99,35 +79,23 @@ let of_soc_key : Soc.key -> Soc.t = let sp = soc_profile_of_types in match id with | "Lustre::mod" -> (make_soc sk (sp tl) [step11]) - | "Lustre::iuminus" -> (make_soc sk (sp tl) [step11]) - | "Lustre::ruminus" -> (make_soc sk (sp tl) [step11]) + | "Lustre::uminus" -> (make_soc sk (sp tl) [step11]) | "Lustre::not" -> (make_soc sk (sp tl) [step11]) | "Lustre::real2int" -> (make_soc sk (sp tl) [step11]) | "Lustre::int2real" -> (make_soc sk (sp tl) [step11]) | "Lustre::plus" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::iplus" -> assert false - | "Lustre::rplus" -> assert false - | "Lustre::itimes" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rtimes" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::idiv" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rdiv" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::iminus" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rminus" -> (make_soc sk (sp tl) [step21 None]) - - | "Lustre::ilt" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rlt" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::igt" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rgt" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::ilte" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rlte" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::igte" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rgte" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::times" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::div" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::minus" -> (make_soc sk (sp tl) [step21 None]) + + | "Lustre::lt" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::gt" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::lte" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::gte" -> (make_soc sk (sp tl) [step21 None]) | "Lustre::and" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::beq" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::ieq" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::req" -> (make_soc sk (sp tl) [step21 None]) + | "Lustre::eq" -> (make_soc sk (sp tl) [step21 None]) | "Lustre::neq" -> (make_soc sk (sp tl) [step21 None]) | "Lustre::or" -> (make_soc sk (sp tl) [step21 None]) | "Lustre::xor" -> (make_soc sk (sp tl) [step21 None]) @@ -424,39 +392,39 @@ let soc_interface_of_predef: | AstPredef.PLUS_n, [Int; Int] -> of_soc_key (("Lustre::plus"), types@[Int], None) | AstPredef.PLUS_n, [Real; Real] -> of_soc_key (("Lustre::plus"), types@[Real], None) | AstPredef.RPLUS_n, [Real; Real] -> of_soc_key (("Lustre::plus"), types@[Real], None) - | AstPredef.ITIMES_n,[Int; Int] -> of_soc_key (("Lustre::itimes"), types@[Int], None) - | AstPredef.TIMES_n, [Int; Int] -> of_soc_key (("Lustre::itimes"), types@[Int], None) - | AstPredef.TIMES_n, [Real; Real] -> of_soc_key (("Lustre::rtimes"), types@[Real], None) - | AstPredef.RTIMES_n,[Real; Real] -> of_soc_key (("Lustre::rtimes"), types@[Real], None) - | AstPredef.ISLASH_n,[Int; Int] -> of_soc_key (("Lustre::idiv"), types@[Int], None) - | AstPredef.SLASH_n, [Int; Int] -> of_soc_key (("Lustre::idiv"), types@[Int], None) - | AstPredef.DIV_n, [Int; Int] -> of_soc_key (("Lustre::idiv"), types@[Int], None) + | AstPredef.ITIMES_n,[Int; Int] -> of_soc_key (("Lustre::times"), types@[Int], None) + | AstPredef.TIMES_n, [Int; Int] -> of_soc_key (("Lustre::times"), types@[Int], None) + | AstPredef.TIMES_n, [Real; Real] -> of_soc_key (("Lustre::times"), types@[Real], None) + | AstPredef.RTIMES_n,[Real; Real] -> of_soc_key (("Lustre::times"), types@[Real], None) + | AstPredef.ISLASH_n,[Int; Int] -> of_soc_key (("Lustre::div"), types@[Int], None) + | AstPredef.SLASH_n, [Int; Int] -> of_soc_key (("Lustre::div"), types@[Int], None) + | AstPredef.DIV_n, [Int; Int] -> of_soc_key (("Lustre::div"), types@[Int], None) | AstPredef.MOD_n, [Int;Int] -> of_soc_key (("Lustre::mod"), types@[Int], None) - | AstPredef.SLASH_n, [Real; Real] -> of_soc_key (("Lustre::rdiv"), types@[Real], None) - | AstPredef.RSLASH_n,[Real; Real] -> of_soc_key (("Lustre::rdiv"), types@[Real], None) - | AstPredef.MINUS_n, [Int; Int] -> of_soc_key (("Lustre::iminus"), types@[Int], None) - | AstPredef.IMINUS_n,[Int; Int] -> of_soc_key (("Lustre::iminus"), types@[Int], None) - | AstPredef.MINUS_n, [Real; Real] -> of_soc_key (("Lustre::rminus"), types@[Real], None) - | AstPredef.RMINUS_n,[Real; Real] -> of_soc_key (("Lustre::rminus"), types@[Real], None) - | AstPredef.UMINUS_n,[Int] -> of_soc_key (("Lustre::iuminus"), types@[Int], None) - | AstPredef.IUMINUS_n, [Int] -> of_soc_key (("Lustre::iuminus"), types@[Int], None) - | AstPredef.UMINUS_n, [Real] -> of_soc_key (("Lustre::ruminus"), types@[Real], None) - | AstPredef.RUMINUS_n, [Real] -> of_soc_key (("Lustre::ruminus"), types@[Real], None) - | AstPredef.LT_n, [Int; Int] -> of_soc_key (("Lustre::ilt"), types@[Int], None) - | AstPredef.LT_n, [Real; Real] -> of_soc_key (("Lustre::rlt"), types@[Real], None) - | AstPredef.GT_n, [Int; Int] -> of_soc_key (("Lustre::igt"), types@[Int], None) - | AstPredef.GT_n, [Real; Real] -> of_soc_key (("Lustre::rgt"), types@[Real], None) - | AstPredef.LTE_n, [Int; Int] -> of_soc_key (("Lustre::ilte"), types@[Int], None) - | AstPredef.LTE_n, [Real; Real] -> of_soc_key (("Lustre::rlte"), types@[Real], None) - | AstPredef.GTE_n, [Int; Int] -> of_soc_key (("Lustre::igte"), types@[Int], None) - | AstPredef.GTE_n, [Real; Real] -> of_soc_key (("Lustre::rgte"), types@[Real], None) + | AstPredef.SLASH_n, [Real; Real] -> of_soc_key (("Lustre::div"), types@[Real], None) + | AstPredef.RSLASH_n,[Real; Real] -> of_soc_key (("Lustre::div"), types@[Real], None) + | AstPredef.MINUS_n, [Int; Int] -> of_soc_key (("Lustre::minus"), types@[Int], None) + | AstPredef.IMINUS_n,[Int; Int] -> of_soc_key (("Lustre::minus"), types@[Int], None) + | AstPredef.MINUS_n, [Real; Real] -> of_soc_key (("Lustre::minus"), types@[Real], None) + | AstPredef.RMINUS_n,[Real; Real] -> of_soc_key (("Lustre::minus"), types@[Real], None) + | AstPredef.UMINUS_n,[Int] -> of_soc_key (("Lustre::uminus"), types@[Int], None) + | AstPredef.IUMINUS_n, [Int] -> of_soc_key (("Lustre::uminus"), types@[Int], None) + | AstPredef.UMINUS_n, [Real] -> of_soc_key (("Lustre::uminus"), types@[Real], None) + | AstPredef.RUMINUS_n, [Real] -> of_soc_key (("Lustre::uminus"), types@[Real], None) + | AstPredef.LT_n, [Int; Int] -> of_soc_key (("Lustre::lt"), types@[Int], None) + | AstPredef.LT_n, [Real; Real] -> of_soc_key (("Lustre::lt"), types@[Real], None) + | AstPredef.GT_n, [Int; Int] -> of_soc_key (("Lustre::gt"), types@[Int], None) + | AstPredef.GT_n, [Real; Real] -> of_soc_key (("Lustre::gt"), types@[Real], None) + | AstPredef.LTE_n, [Int; Int] -> of_soc_key (("Lustre::lte"), types@[Int], None) + | AstPredef.LTE_n, [Real; Real] -> of_soc_key (("Lustre::lte"), types@[Real], None) + | AstPredef.GTE_n, [Int; Int] -> of_soc_key (("Lustre::gte"), types@[Int], None) + | AstPredef.GTE_n, [Real; Real] -> of_soc_key (("Lustre::gte"), types@[Real], None) | AstPredef.AND_n, [Bool; Bool] -> of_soc_key (("Lustre::and"), types@[Bool], None) | AstPredef.OR_n, [Bool; Bool] -> of_soc_key (("Lustre::or"), types@[Bool], None) | AstPredef.XOR_n, [Bool; Bool] -> of_soc_key (("Lustre::xor"), types@[Bool], None) | AstPredef.IMPL_n, [Bool; Bool] -> of_soc_key (("Lustre::impl"), types@[Bool], None) - | AstPredef.EQ_n, [Bool; Bool] -> of_soc_key (("Lustre::beq"), types@[Bool], None) - | AstPredef.EQ_n, [Int; Int] -> of_soc_key (("Lustre::ieq"), types@[Int], None) - | AstPredef.EQ_n, [Real; Real] -> of_soc_key (("Lustre::req"), types@[Real], None) + | AstPredef.EQ_n, [Bool; Bool] -> of_soc_key (("Lustre::eq"), types@[Bool], None) + | AstPredef.EQ_n, [Int; Int] -> of_soc_key (("Lustre::eq"), types@[Int], None) + | AstPredef.EQ_n, [Real; Real] -> of_soc_key (("Lustre::eq"), types@[Real], None) | AstPredef.NEQ_n, [Bool; Bool] -> of_soc_key (("Lustre::neq"), types@[Bool], None) | AstPredef.NOT_n, [Bool] -> of_soc_key (("Lustre::not"), types@[Bool], None) @@ -464,7 +432,7 @@ let soc_interface_of_predef: | AstPredef.FALSE_n, [] -> finish_me lxm ; assert false (* todo *) | AstPredef.RCONST_n _, [] -> finish_me lxm ; assert false (* todo *) | AstPredef.ICONST_n _, [] -> finish_me lxm ; assert false (* todo *) - | AstPredef.REAL2INT_n, [Real] -> finish_me lxm ; assert false (* todo *) + | AstPredef.REAL2INT_n, [Real] -> of_soc_key (("Lustre::real2int"), [Real;Int], None) | AstPredef.INT2REAL_n, [Int] -> finish_me lxm ; assert false (* todo *) | AstPredef.NOR_n, _ -> finish_me lxm ; assert false (* todo *) | AstPredef.DIESE_n, _ -> finish_me lxm ; assert false (* todo *) diff --git a/src/socUtils.ml b/src/socUtils.ml index 7c982d479d84286f1ee48aeffa5288555909baf8..952af1bdfbc1b1506b700f6602465ed007dbc017 100644 --- a/src/socUtils.ml +++ b/src/socUtils.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 13/03/2013 (at 22:25) by Erwan JAHIER> *) +(** Time-stamp: <modified the 21/03/2013 (at 09:55) by Erwan Jahier> *) open Soc @@ -106,7 +106,7 @@ let rec string_of_filter_ff: (Soc.var_expr -> Format.formatter -> unit) = fun v ff -> match v with | Const(id, _) | Var (id,_) -> fprintf ff "%s" id - | Field(f, (id,_)) -> string_of_filter_ff f ff; fprintf ff ".%s" id + | Field(f, id,_) -> string_of_filter_ff f ff; fprintf ff ".%s" id | Index(f, index,_) -> string_of_filter_ff f ff; fprintf ff "[%d]" index let string_of_filter: (Soc.var_expr -> string) = fun v ->