diff --git a/src/astPredef.ml b/src/astPredef.ml index 2d6f2a51ac3c5e727627d8c832b13b6513855eed..4bf24042c3e867887a56031c8f2bb0a9adb3face 100644 --- a/src/astPredef.ml +++ b/src/astPredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/12/2012 (at 14:35) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 11:00) by Erwan Jahier> *) (** Predefined operators Type definition *) @@ -121,12 +121,12 @@ let op2string_long = function | TIMES_n -> "times" | IUMINUS_n -> "iuminus" | IMINUS_n -> "iminus" - | IPLUS_n -> "iplus" + | IPLUS_n -> "plus" | ISLASH_n -> "idiv" | ITIMES_n -> "itimes" | RUMINUS_n -> "ruminus" | RMINUS_n -> "rminus" - | RPLUS_n -> "rplus" + | RPLUS_n -> "plus" | RSLASH_n -> "rdiv" | RTIMES_n -> "rtimes" | op -> op2string op diff --git a/src/lic2soc.ml b/src/lic2soc.ml index 8ca3833abb0ef25cf43af795e8d55666876c674b..9cc37e3bc8d1e0bfbcb249dd50e08a1f1943c22b 100644 --- a/src/lic2soc.ml +++ b/src/lic2soc.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 19/03/2013 (at 10:32) by Erwan Jahier> *) +(** Time-stamp: <modified the 19/03/2013 (at 15:11) by Erwan Jahier> *) open Lxm open Lic @@ -423,6 +423,10 @@ let by_pos_op_to_soc_ident = function | CALL n -> string_of_node_key n.it | _ -> assert false + +let (get_exp_type : Soc.var_expr list -> Soc.var_type list) = + List.map Soc.var_type_of_var_expr + let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> Lic.clock -> Soc.var_expr list -> e2a_acc -> Lic.val_exp -> e2a_acc) = fun lxm soc_tbl clk lpl acc expr -> @@ -509,16 +513,15 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> List.map lic_to_soc_type (List.flatten (List.map (fun ve -> ve.ve_typ) val_exp_list)) in - let exp_type = List.hd(List.rev args_types) in - let args_types_plus = + let res_type = get_exp_type lpl in + let full_profile = (* Add the type of the expression (indeed, eg, if ARROW has 2 args of the same type t, its profile is "t -> t -> t" hence we add the missing t in *) - args_types @ [exp_type] + args_types @ res_type in - let id = SocPredef.instanciate_name id exp_type in - let sk = id, args_types_plus, None in + let sk = id, full_profile, None in try Soc.SocMap.find sk soc_tbl with Not_found -> Verbose.exe ~flag:dbg (fun () -> @@ -702,7 +705,7 @@ let f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = let t = List.hd types in (* The arrow is translated into a if. So we make sure that the "if" is in the soc tbl *) - let if_sk = SocPredef.instanciate_name "Lustre::if" t, [Bool;t;t], None in + let if_sk = "Lustre::if", [Bool;t;t], None in let acc_comp = if pos_op = Lic.ARROW && not(SocMap.mem if_sk acc_comp) then let soc = SocPredef.soc_interface_of_pos_op lxm diff --git a/src/soc.ml b/src/soc.ml index 32589e207a0d703af7b111fdf38c6f3963f6ddea..cc737a0f5680622a4429d5dc3e852b681f24313e 100644 --- a/src/soc.ml +++ b/src/soc.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 18/03/2013 (at 15:46) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 15:08) by Erwan Jahier> *) (** Synchronous Object Component *) @@ -32,6 +32,14 @@ type var_expr = | Field of var_expr * var | Index of var_expr * int * var_type +let (var_type_of_var_expr : var_expr -> var_type) = + function + | Var(_,vt) + | Const(_,vt) + | Field(_, (_,vt)) + | Index(_,_,vt) -> vt + + type atomic_operation = | Assign (* Wire *) | Method of instance * ident (* node step call ; the ident is the step name *) diff --git a/src/socExecEvalPredef.ml b/src/socExecEvalPredef.ml index 370be388596ac565b2529bd883546e17ea6df574..39bc5652314f6d993e0fee3b592d8fb853de0e51 100644 --- a/src/socExecEvalPredef.ml +++ b/src/socExecEvalPredef.ml @@ -1,44 +1,25 @@ -(* Time-stamp: <modified the 14/03/2013 (at 14:24) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 14:40) by Erwan Jahier> *) open SocExecValue open Soc (* A boring but simple module... *) -let (lustre_iplus : ctx -> ctx) = +let (lustre_plus : ctx -> ctx) = fun ctx -> let ns = match [get_val "x" ctx; get_val "y" ctx] with | [I x1; I x2] -> "z"::ctx.cpath,I(x1+x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - -let (lustre_rplus:ctx -> ctx) = - fun ctx -> - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F i1; F i2] -> "z"::ctx.cpath,F(i1+.i2) | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false + | _ -> assert false in { ctx with s = sadd ctx.s ns } - -let lustre_itimes ctx = +let lustre_times ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,I(x1 * x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rtimes ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,F(x1 *. x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false @@ -46,19 +27,10 @@ let lustre_rtimes ctx = { ctx with s = sadd ctx.s ns } -let lustre_idiv ctx = +let lustre_div ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,I(x1 / x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rdiv ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,F(x1 /. x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false @@ -66,26 +38,16 @@ let lustre_rdiv ctx = { ctx with s = sadd ctx.s ns } -let lustre_iminus ctx = +let lustre_minus ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,I(x1 - x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rminus ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,F(x1 -. x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - let lustre_mod ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with @@ -96,46 +58,27 @@ let lustre_mod ctx = { ctx with s = sadd ctx.s ns } -let lustre_ieq ctx = +let lustre_eq ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,B(x1 = x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_req ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,B(x1 = x2) + | [B x1; B x2] -> "z"::ctx.cpath,B(x1 = x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - -let lustre_iuminus ctx = +let lustre_uminus ctx = let ns = match ([get_val "x" ctx]) with | [I x1] -> "z"::ctx.cpath,I(- x1) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_ruminus ctx = - let ns = - match ([get_val "x" ctx]) with | [F x1] -> "z"::ctx.cpath,F(-. x1) - | [U] -> "z"::ctx.cpath,U + | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - let lustre_real2int ctx = let ns = match ([get_val "x" ctx]) with @@ -166,86 +109,46 @@ let lustre_not ctx = { ctx with s = sadd ctx.s ns } -let lustre_ilt ctx = +let lustre_lt ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,B(x1 < x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rlt ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,B(x1 < x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - - -let lustre_igt ctx = + +let lustre_gt ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,B(x1 > x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rgt ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,B(x1 > x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - -let lustre_ilte ctx = +let lustre_lte ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,B(x1 <= x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rlte ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,B(x1 <= x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - -let lustre_igte ctx = +let lustre_gte ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with | [I x1; I x2] -> "z"::ctx.cpath,B(x1 >= x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - -let lustre_rgte ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with | [F x1; F x2] -> "z"::ctx.cpath,B(x1 >= x2) | [U; _] | [_;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - let lustre_and ctx = let ns = match ([get_val "x" ctx; get_val "y" ctx]) with @@ -255,15 +158,6 @@ let lustre_and ctx = in { ctx with s = sadd ctx.s ns } -let lustre_beq ctx = - let ns = - match ([get_val "x" ctx; get_val "y" ctx]) with - | [B x1; B x2] -> "z"::ctx.cpath,B(x1 = x2) - | [U; _] | [_;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - let lustre_neq ctx = let ns = @@ -294,43 +188,39 @@ let lustre_impl ctx = in { ctx with s = sadd ctx.s ns } - -let lustre_iif ctx = +let lustre_if ctx = let ns = 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 | [U;_; _] | [_;U;U] -> "z"::ctx.cpath,U | _ -> assert false in { ctx with s = sadd ctx.s ns } - -let lustre_rif ctx = +let lustre_hat tl ctx = + let i = match tl with + | [_;Soc.Array(_,i)] -> i + | _ -> assert false + in let ns = - match ([get_val "c" ctx; get_val "xt" ctx; get_val "xe" ctx]) with - | [B c; F x1; F x2] -> "z"::ctx.cpath,F(if c then x1 else 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 - | [U;_; _] | [_;U;U] -> "z"::ctx.cpath,U + 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 | _ -> assert false in - { ctx with s = sadd ctx.s ns } + { ctx with s = sadd ctx.s ns } - -let lustre_bif ctx = - let ns = - match ([get_val "c" ctx; get_val "xt" ctx; get_val "xe" ctx]) with - | [B c; B x1; B x2] -> "z"::ctx.cpath,B(if c then x1 else 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 - | [U;_; _] | [_;U;U] -> "z"::ctx.cpath,U - | _ -> assert false - in - { ctx with s = sadd ctx.s ns } - - (* That one is different *) let lustre_xor ctx = assert false let lustre_diese ctx = assert false @@ -339,49 +229,37 @@ let lustre_diese ctx = assert false (* let l = List.filter (fun x -> x=B true) values in *) (* "z"::ctx.cpath,B(List.length l = 1) *) - (* exported *) let (get: Soc.key -> (ctx -> ctx)) = - fun (n,_,_) -> + fun (n,tl,_) -> match n with - | "Lustre::iplus" -> lustre_iplus - | "Lustre::rplus" -> lustre_rplus - | "Lustre::itimes"-> lustre_itimes - | "Lustre::rtimes"-> lustre_rtimes - | "Lustre::idiv" -> lustre_idiv - | "Lustre::rdiv" -> lustre_rdiv - | "Lustre::iminus"-> lustre_iminus - | "Lustre::rminus"-> lustre_rminus + | "Lustre::plus" -> lustre_plus + | "Lustre::times"-> lustre_times + | "Lustre::div" -> lustre_div + | "Lustre::minus"-> lustre_minus | "Lustre::mod" -> lustre_mod - | "Lustre::iuminus" -> lustre_iuminus - | "Lustre::ruminus" -> lustre_ruminus + | "Lustre::uminus" -> lustre_uminus | "Lustre::not" -> lustre_not | "Lustre::real2int" -> lustre_real2int | "Lustre::int2real" -> lustre_int2real - | "Lustre::ilt" -> lustre_ilt - | "Lustre::rlt" -> lustre_rlt - | "Lustre::igt" -> lustre_igt - | "Lustre::rgt" -> lustre_rgt - | "Lustre::ilte" -> lustre_ilte - | "Lustre::rlte" -> lustre_rlte - | "Lustre::igte" -> lustre_igte - | "Lustre::rgte" -> lustre_rgte + | "Lustre::lt" -> lustre_lt + | "Lustre::gt" -> lustre_gt + | "Lustre::lte" -> lustre_lte + | "Lustre::gte" -> lustre_gte | "Lustre::and" -> lustre_and - | "Lustre::beq" -> lustre_beq - | "Lustre::ieq" -> lustre_ieq - | "Lustre::req" -> lustre_req + | "Lustre::eq" -> lustre_eq | "Lustre::neq" -> lustre_neq | "Lustre::or" -> lustre_or | "Lustre::impl" -> lustre_impl - | "Lustre::iif" -> lustre_iif - | "Lustre::rif" -> lustre_rif - | "Lustre::bif" -> lustre_bif + | "Lustre::if" -> lustre_if + + | "Lustre::hat" -> lustre_hat tl | "Lustre::xor" -> lustre_xor | "Lustre::diese" -> lustre_diese diff --git a/src/socExecValue.ml b/src/socExecValue.ml index 43742c3356692772e7fbdb06c04b5c20efa4e38d..4233cd2bd0a1a33eb0a8bd52fde9099dd8e7f68d 100644 --- a/src/socExecValue.ml +++ b/src/socExecValue.ml @@ -1,8 +1,8 @@ -(* Time-stamp: <modified the 18/03/2013 (at 15:20) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 14:41) by Erwan Jahier> *) open Soc -type t = I of int | F of float | B of bool | E of Soc.ident | U +type t = I of int | F of float | B of bool | E of Soc.ident | A of t array | U (* Meant to represent paths in the call tree. Actually it both represent path and variable with a path, depending on the @@ -70,13 +70,18 @@ let (filter_top_subst : substs -> (Soc.ident * t) list) = Node(l) -> List.fold_left aux [] l | _ -> assert false -let (to_string : t -> string) = +let rec (to_string : t -> string) = function | I i -> string_of_int i | F f -> string_of_float f | B true -> "t" | B false -> "f" | E e -> e + | A a -> + let str = ref "" in + let f i a = str := !str ^ " " ^ (to_string a) in + Array.iteri f a; + !str | U -> "not initialised" let (string_of_subst_list : (path * t) list -> string) = diff --git a/src/socExecValue.mli b/src/socExecValue.mli index e53eaa7db88945531f3f7b2ecdef9c3fe1ad8597..82abc5d03619660bfa32da897afe14146c068f53 100644 --- a/src/socExecValue.mli +++ b/src/socExecValue.mli @@ -1,8 +1,9 @@ -(* Time-stamp: <modified the 18/03/2013 (at 10:43) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 14:04) by Erwan Jahier> *) (** Manipulating data in the Soc interpreter *) -type t = I of int | F of float | B of bool | E of Soc.ident | U (* to set uninitialized mem *) +type t = | I of int | F of float | B of bool | E of Soc.ident | A of t array + | U (* to set uninitialized mem *) type subst = (Soc.ident list * t) type substs diff --git a/src/socPredef.ml b/src/socPredef.ml index 8cb367de06f5d2db78d322b87354500daccb4771..a5ee877f7b85dccb0b6b608dea33e635f943f4b3 100644 --- a/src/socPredef.ml +++ b/src/socPredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 19/03/2013 (at 10:13) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 14:39) by Erwan Jahier> *) (** Synchronous Object Code for Predefined operators. *) @@ -79,14 +79,6 @@ let make_soc key profile steps = { have_mem = None; } -let (instanciate_name : string -> Soc.var_type -> string) = - fun id concrete_type -> - match Str.split (Str.regexp "::") id, concrete_type with - | ["Lustre";op], Soc.Int -> "Lustre::i" ^ op - | ["Lustre";op], Soc.Real -> "Lustre::r" ^ op - | ["Lustre";op], Soc.Bool -> "Lustre::b" ^ op - | _,_ -> id - let first_instant = Var("first_instant", Bool) let (get_mem_name : Soc.key -> var_type -> string) = @@ -113,8 +105,9 @@ let of_soc_key : Soc.key -> Soc.t = | "Lustre::real2int" -> (make_soc sk (sp tl) [step11]) | "Lustre::int2real" -> (make_soc sk (sp tl) [step11]) - | "Lustre::iplus" -> (make_soc sk (sp tl) [step21 None]) - | "Lustre::rplus" -> (make_soc sk (sp tl) [step21 None]) + | "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]) @@ -197,8 +190,7 @@ let of_soc_key : Soc.key -> Soc.t = idx_ins = [0;1]; idx_outs = [0]; impl = Some([],[Call([Var(vout)], - Procedure (instanciate_name "Lustre::if" t, - [Bool;t;t;t],None), + Procedure ("Lustre::if",[Bool;t;t;t],None), [Var(pre_mem);Var(v1);Var(v2)])]); }; { @@ -275,22 +267,6 @@ let of_soc_key : Soc.key -> Soc.t = } ]; } - | "Lustre::hat" -> { - key = sk; - profile = (sp tl); - instances = []; - precedences = []; - have_mem = None; - step = [ - { - name = "step"; - lxm = Lxm.dummy "predef soc"; - idx_ins = [0; 1]; - idx_outs = [0]; - impl = None; - } - ]; - } | _ -> print_string ("*** The soc of "^id ^ " is not defined. FINISH ME! \n"); flush stdout; assert false @@ -314,9 +290,7 @@ let instanciate_soc: Soc.t -> Soc.var_type -> Soc.t = List.map (fun (vn,vt) -> vn, instanciate_type vt) (snd c.profile) in let instanciate_key (key1, key2, key3) = - (instanciate_name key1 concrete_type, - List.map instanciate_type key2, - key3) + (key1, List.map instanciate_type key2, key3) in let new_key = instanciate_key c.key in let new_instances = @@ -391,13 +365,13 @@ let make_hat_soc: int -> Soc.var_type -> Soc.t = | t -> Soc.Array(t,i) in { - key = ("Lustre::hat", [t;Int], None); - profile = (["t", t], ["st", array_type]); + key = ("Lustre::hat", [t;array_type], None); + profile = ([("x", t)], ["z", array_type]); instances = []; step = [ { name = "step"; - lxm = Lxm.dummy "predef soc"; + lxm = Lxm.dummy "predef hat soc"; idx_ins = [0]; idx_outs = [0]; impl = None; @@ -405,7 +379,6 @@ let make_hat_soc: int -> Soc.var_type -> Soc.t = ]; precedences = []; have_mem = None; -(* init = None; *) } @@ -414,10 +387,10 @@ let soc_interface_of_predef: Lxm.t -> AstPredef.op -> Soc.var_type list -> Soc.t = fun lxm op types -> match (op, types) with (* utile de re-vérifier le type ? *) - | AstPredef.IPLUS_n, [Int; Int] -> of_soc_key (("Lustre::iplus"), types@[Int], None) - | AstPredef.PLUS_n, [Int; Int] -> of_soc_key (("Lustre::iplus"), types@[Int], None) - | AstPredef.PLUS_n, [Real; Real] -> of_soc_key (("Lustre::rplus"), types@[Real], None) - | AstPredef.RPLUS_n, [Real; Real] -> of_soc_key (("Lustre::rplus"), types@[Real], None) + | AstPredef.IPLUS_n, [Int; Int] -> of_soc_key (("Lustre::plus"), types@[Int], None) + | 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) @@ -529,12 +502,8 @@ let (soc_interface_of_pos_op: let soc = instanciate_soc soc concrete_type in soc | Lic.HAT i,_ -> - let concrete_type = List.nth types 0 in - let soc = of_soc_key (("Lustre::hat"), types@[concrete_type], None) in - let soc = instanciate_soc soc concrete_type in - soc -(* let elt_type = List.nth types 0 in *) -(* (make_hat_soc i elt_type) *) + let elt_type = List.nth types 0 in + (make_hat_soc i elt_type) | Lic.ARRAY, _ -> let concrete_type = List.nth types 0 in diff --git a/src/socPredef.mli b/src/socPredef.mli index 362ab1489338d5b308a7d4285b745f921d5da298..e8e70962845c6dc85e6c3e3345260b5561fb714b 100644 --- a/src/socPredef.mli +++ b/src/socPredef.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 18/03/2013 (at 21:54) by Erwan Jahier> *) +(* Time-stamp: <modified the 19/03/2013 (at 11:18) by Erwan Jahier> *) (** Synchronous Object Code for Predefined operators. *) @@ -13,8 +13,4 @@ val of_soc_key : Soc.key -> Soc.t val soc_interface_of_pos_op: Lxm.t -> Lic.by_pos_op -> Soc.var_type list -> Soc.t - - -val instanciate_name : string -> Soc.var_type -> string - val get_mem_name : Soc.key -> Soc.var_type -> string diff --git a/todo.org b/todo.org index e1673d909864b08a2531d5bdcd59d77873794277..727d65c51fa08ddfa7b89c6efbaa1ed3c6a61cb3 100644 --- a/todo.org +++ b/todo.org @@ -14,6 +14,8 @@ que de lancer luciole ** TODO Écrire un test qui mette en jeu exhaustivement tous les operateurs - State "TODO" from "" [2013-03-19 Tue 10:38] + + ** TODO revoir l'intégration à rif_base et genlex - State "TODO" from "" [2013-03-19 Tue 10:25] ** TODO Découper un peu les fonctions dans src/lic2soc.ml