let compute_initial_infos role_found session_id =
let local_variables =
List.filter
(fun v ->
Globals.not_excluded_type v#get_type)
role_found#get_local
and (init_infos_lhs_var_id, init_infos_rhs, init_preds) =
extract_init_infos role_found#get_init
in
ignore (compute_assignation_list init_infos_rhs init_infos_lhs_var_id session_id session_id);
let compute_gid_of_var x =
try
if (!debug_level >= 3) then
(prerr_string " identifier of the variable: ";
prerr_int x#get_id;
prerr_newline ());
Globals.global_var_id#unsafe_get_id_of session_id x#get_id
with
_ ->
(
let x_type = Globals.type_table#get_type x#get_id in
let dummy_value = dummy_val_of_type x_type in
ignore (compute_assignation_list
[dummy_value]
[x#get_id]
session_id session_id);
if (!debug_level >= 3) then
(prerr_endline(" assignment of a dummy value "^
(term_to_string dummy_value)^" to "
^(Globals.string_id#get_name x#get_id)));
Globals.global_var_id#unsafe_get_id_of session_id x#get_id
)
in
init_predicates :=
List.fold_left
(fun ip (p,lt) ->
try
insert_with_no_copy
(get_if_value_type session_id p,
List.map (get_if_value_type session_id) lt)
ip
with _ ->
displayWarning 10
("Role "^(string_id#get_name role_found#get_name)^"\n"
^"%% Cannot instantiate \""
^(if_term_to_string "" (Unknown(p,lt)))
^"\" in init section... dropped!");
ip)
!init_predicates init_preds;
List.find_all
(fun x -> x <> 0)
(List.map compute_gid_of_var local_variables)