let print_section_signatureA (role_instances : role_instance list) : unit =
(*
The key in the [role_type_table] is an integer representing the
key in the [Globals.string_id] table of the name
of a role. The second argument is the string representing
the type of the role. The [ -> Fact] part is missing.
*)
let role_type_table = (Hashtbl.create 10 : (int,(string list)) Hashtbl.t) in
let role_type_table_key_list = ref ([]: int list) in
let init_state_list =
List.map
(fun role_instance ->
(* (role_instance#get_name, (List.hd role_instance#get_initial_state))*)
(role_instance#get_name, role_instance#get_initial_state);)
role_instances
in
List.iter
(fun (a,lb) ->
List.iter
(function
(*
We are only interested in the list of actual arguments since we already
know the role identity.
*)
State(_,_,l) ->
let string_from_type =
match l with
[] -> []
| Base(Var(head))::tail ->
List.fold_left
(fun already_done -> function
Base(Var(elt)) ->
(already_done@[(global_id_to_type_string elt)])
| _ -> raise Not_found)
[(global_id_to_type_string head)] tail
| _ -> raise Not_found
in
Hashtbl.add role_type_table a string_from_type;
role_type_table_key_list := Utils.insert_with_no_copy a !role_type_table_key_list
| _ -> ())
lb)
init_state_list;
List.iter
(fun a ->
(add_type (Globals.string_id#get_name a) (Hashtbl.find role_type_table a))
)
!role_type_table_key_list