diff --git a/lib/socNameC.ml b/lib/socNameC.ml index b770edb75262384c7b84a39b27fbb26a29e3fee1..c7094cee847db7e62bb8f308074e9cf05c5581d4 100644 --- a/lib/socNameC.ml +++ b/lib/socNameC.ml @@ -87,7 +87,8 @@ let get_variables_assoc : Soc.t -> (string * variable_type) list = fun soc -> let get_variables : Soc.t -> variable_type list = fun soc -> snd(List.split (get_variables_assoc soc)) -let get_gaol soc = +(*searching for tasks*) +let get_task_gaol soc = let step_impl_list = match soc.step with | [sm] -> [sm.impl] @@ -98,16 +99,16 @@ let get_gaol soc = let gaol step_impl = match step_impl with | Gaol (_,gaol) -> gaol - | Predef -> [] (*assert false*) - | Iterator _ -> assert false - | Boolred _ -> assert false - | Condact _ -> assert false - | Extern -> assert false + | Predef (*assert false*) + | Iterator _ + | Boolred _ + | Condact _ + | Extern -> [] (*no task for the time being*) in List.map gaol step_impl_list |> List.flatten let get_nodes : Soc.t -> node_type list = fun soc -> - let gaol = get_gaol soc in + let gaol = get_task_gaol soc in let tbl = Hashtbl.create 2 in let gao_to_node_type (cpt, acc) = function | Call(_,ao,_,_) -> @@ -151,7 +152,7 @@ let (var_expr_to_index : (string * variable_type) list -> var_expr -> int) = (String.concat "," (List.map string_of_int i.var_out)) let get_instances : Soc.t -> instance_type list = fun soc -> - let gaol = get_gaol soc in + let gaol = get_task_gaol soc in let ltbl = Hashtbl.create 2 in let node_cpt_ref = ref (-1) in let all_vars = (get_inputs_assoc soc) @ (get_outputs_assoc soc) @ (get_variables_assoc soc) in @@ -180,14 +181,14 @@ let (var_expr_to_index : (string * variable_type) list -> var_expr -> int) = res (*let get_literally_all_socs : Soc.t -> Soc.tbl -> Soc.t list = fun soc stbl -> - let gaol = get_gaol soc in + let gaol = get_task_gaol soc in let rec find_soc = function | Case(_, id_gaol_l, _) -> id_gaol_l |> List.map (fun (_, gaol2) -> List.map find_soc gaol2) |> List.flatten |> List.flatten | Call(_, Method((_, sk), _, _), _, _) | Call(_, Procedure(sk, _, _), _, _) -> let new_soc = (SocUtils.find (Lxm.dummy "aeaea") sk stbl) in - let new_gaol = get_gaol new_soc in + let new_gaol = get_task_gaol new_soc in if ((List.length new_gaol) = 0) then [] else [new_soc] @ (List.flatten (List.map find_soc new_gaol)) @@ -198,14 +199,14 @@ let (var_expr_to_index : (string * variable_type) list -> var_expr -> int) = x*) let get_all_soc : Soc.t -> Soc.tbl -> Soc.t list = fun soc stbl -> - let gaol = get_gaol soc in + let gaol = get_task_gaol soc in let rec find_soc = function | Case(_, id_gaol_l, _) -> id_gaol_l |> List.map (fun (_, gaol2) -> List.map find_soc gaol2) |> List.flatten |> List.flatten | Call(_, Method((_, sk), _, _), _, _) | Call(_, Procedure(sk, _, _), _, _) -> let new_soc = (SocUtils.find (Lxm.dummy "aeaea") sk stbl) in - let new_gaol = get_gaol new_soc in + let new_gaol = get_task_gaol new_soc in if ((List.length new_gaol) = 0) then [] else [new_soc] @ (List.flatten (List.map find_soc new_gaol)) @@ -243,18 +244,10 @@ let (var_expr_to_index : (string * variable_type) list -> var_expr -> int) = let (var_in, var_out):Soc.var list * Soc.var list = soc.profile in (var_in, var_out) + (*check champ mem*) let find_memory_soc : Soc.t -> bool = fun soc -> - let gaol = get_gaol soc in - let gao_has_memory = fun gao -> - match gao with - | Call(_,Assign,_,_) -> assert false - | Call(_, Method((_, sk), _, _), _, _) - | Call(_, Procedure (sk, _, _), _, _) -> - let (name, _, _) = sk in - (String.equal "Lustre::pre" name) || (String.equal "Lustre::arrow" name) (*les 2 socs qui ont de la mémoire : manque un noeud avec memoire*) - | Case(_, _, _) -> assert false - in - List.exists (fun x -> x = true) (List.map gao_has_memory gaol) + let mem = soc.memory in + mem <> No_mem let has_memory : string -> Soc.t list -> bool = fun name socs -> let soc = List.find (compare_name name) socs in @@ -262,7 +255,7 @@ let (var_expr_to_index : (string * variable_type) list -> var_expr -> int) = has_mem let get_tasks : Soc.tbl -> Soc.t -> Soc.t -> task_type list = fun stbl main_soc soc -> - let gaol = get_gaol soc in + let gaol = get_task_gaol soc in let (gao_to_tasks: gao -> task_type option) = fun gao -> match gao with | Call(_,Assign,_,_) -> None