let rec load_last_state (x : (string * int * (string * bool) list) list)
(automate : (string * int * (string * bool Pervasives.ref) list Pervasives.ref * 'a ) list) : unit =
let load_statesL states_list l_ref = l_ref:=(List.map (fun (state,exec)-> (state, ref exec)) states_list) in
let rec find_state name id auto =
match auto with [] -> failwith "Bad automate"
|((name2,id2,statesL,_)::ls) -> if(name=name2 && id=id2) then statesL
else find_state name id ls;
in
let rec aux x auto =
match x with
[] -> ()
|((name,id,states_list)::xs) -> (
match auto with [] -> ()
|((name2,id2,statesL,_)::ls) -> if(name=name2 && id=id2) then (load_statesL states_list statesL; aux xs ls)
else (
let statesLL = (find_state name id ls) in
load_statesL states_list statesLL;
aux xs auto);
);
in
aux x automate