let rec atom_ground_value_to_string : Types.if_value_type -> string = function
| If_address gid->
(*
In the case of a variable, we get its initial value from
the [Globals.value_table] variable.
*)
let map_id = memory_map#get_map gid in
let if_value = value_table#get_value map_id in
if if_value = If_address gid then
(let vid=global_var_id#get_name_of gid in
let name = string_id#get_name vid in
Error_handler.displayWarning 4 ("Interface.atom_ground_value_to_string."^name);
"")
else
if_value_to_string atom_ground_value_to_string if_value (* \fix{is it possible to reuse [atom_value_to_string] } *)
| If_const strid ->
begin
(string_id#get_name strid)^
(*
If the constant is a pointer to a set, we also have to print the contains terms according to
the value of this set. To this end, we add the right terms in the [contains_term_list] variable.
*)
(try
match (Globals.type_table#get_type strid) with
(* Base(Pointer)
| Lst(_)*)
Set(_) ->
begin
let pointer_global_var_id = Globals.global_var_id#get_id_of 0 strid in
let pointer_mmap_id =
Globals.memory_map#get_map pointer_global_var_id in
let if_value_map = Globals.value_table#get_value pointer_mmap_id in
match if_value_map with
(* If_lst l *)
If_set l ->
contains_term_list :=
(List.map
(fun element ->
(* if (!debug_level >= 3) then
begin
prerr_string ("
^(Globals.string_id#get_name strid)
^");
prerr_if_value atom_ground_value_to_string element;
prerr_newline();
end;*)
(element,If_const(strid)))
l)
@ !contains_term_list;
""
| _ ->
prerr_endline ("Interface.atom_ground_value_to_string: found a pointer to something else than a set or a list");
raise Not_found
end;
| _ -> ""
with
_ -> "")
end
(*
This last case should not be encountered as long as the [print_atom_ground_value]
is called only in the previous cases.
*)
| _ -> prerr_endline "Interface.atom_ground_value_to_string: considering a non-atomic term as atomic"; ""