let translated_name linfo =
try
let n = Hashtbl.find translated_names_table linfo.l_var_info.lv_id in
n
with Not_found ->
let name =
match linfo.l_var_info.lv_name with
| "\\abs" ->
begin
match linfo.l_type with
| Some Lreal -> "\\real_abs"
| Some Linteger -> "\\integer_abs"
| _ -> assert false
end
| "\\exact" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\double_exact"
| Ctype x when x == floatType -> "\\float_exact"
| _ -> assert false
end
| "\\model" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\double_model"
| Ctype x when x == floatType -> "\\float_model"
| _ -> assert false
end
| "\\round_error" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\double_round_error"
| Ctype x when x == floatType -> "\\float_round_error"
| _ -> assert false
end
| "\\total_error" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\double_total_error"
| Ctype x when x == floatType -> "\\float_total_error"
| _ -> assert false
end
| "\\relative_error" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\double_relative_error"
| Ctype x when x == floatType -> "\\float_relative_error"
| _ -> assert false
end
| "\\pow" ->
begin
match linfo.l_type with
| Some Lreal -> "\\real_pow"
| _ -> assert false
end
| "\\sqrt" ->
begin
match linfo.l_type with
| Some Lreal -> "\\real_sqrt"
| _ -> assert false
end
| "\\sign" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\sign_double"
| Ctype x when x == floatType -> "\\sign_float"
| _ -> assert false
end
| "\\is_finite" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\is_finite_double"
| Ctype x when x == floatType -> "\\is_finite_float"
| _ -> assert false
end
| "\\is_infinite" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\is_infinite_double"
| Ctype x when x == floatType -> "\\is_infinite_float"
| _ -> assert false
end
| "\\is_NaN" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\is_NaN_double"
| Ctype x when x == floatType -> "\\is_NaN_float"
| _ -> assert false
end
| "\\is_minus_infinity" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\is_minus_infinity_double"
| Ctype x when x == floatType -> "\\is_minus_infinity_float"
| _ -> assert false
end
| "\\is_plus_infinity" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\is_plus_infinity_double"
| Ctype x when x == floatType -> "\\is_plus_infinity_float"
| _ -> assert false
end
| "\\le_float" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\le_double"
| Ctype x when x == floatType -> "\\le_float"
| _ -> assert false
end
| "\\lt_float" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\lt_double"
| Ctype x when x == floatType -> "\\lt_float"
| _ -> assert false
end
| "\\ge_float" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\ge_double"
| Ctype x when x == floatType -> "\\ge_float"
| _ -> assert false
end
| "\\gt_float" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\gt_double"
| Ctype x when x == floatType -> "\\gt_float"
| _ -> assert false
end
| "\\eq_float" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\eq_double"
| Ctype x when x == floatType -> "\\eq_float"
| _ -> assert false
end
| "\\ne_float" ->
begin
match (List.hd linfo.l_profile).lv_type with
| Ctype x when x == doubleType -> "\\ne_double"
| Ctype x when x == floatType -> "\\ne_float"
| _ -> assert false
end
| s ->
try
let x = Hashtbl.find Rewrite.logic_names_overloading s in
if !x then
let ns = name_with_profile s linfo.l_profile in
ns
else
begin
s
end
with Not_found ->
s
in
Hashtbl.add translated_names_table linfo.l_var_info.lv_id name;
name