let check_cref_table (doc_settings : t_doc_settings) (table : t_cref_table) : t_cref_table =
let rec aux1 (lst : t_cref_table) (acc : (Doc_types.tr_id * t_path) list): (Doc_types.tr_id * t_path) list =
match lst with
|[] -> acc
|hd::tl ->
match hd with
|(id, path, _) ->
match id.fld_id_scope with
|None | Some Cu_scope_gbl -> aux1 tl ((id,[])::acc)
|Some Cu_scope_ch -> aux1 tl ((id, path_to_ch_node path)::acc)
|Some Cu_scope_sec -> aux1 tl ((id, path_to_sec_node path)::acc)
|Some Cu_scope_app -> aux1 tl ((id, path_to_app_node path)::acc)
|Some Cu_scope_par -> aux1 tl ((id, path_to_par_node path)::acc)
in
let rec aux2 (lst : (Doc_types.tr_id * t_path) list) : unit =
match lst with
|[] -> ()
|(id,path)::tl ->
match List.mem (id,path) tl with
|true ->
let _ : unit = IO.print_warning (String.concat "" [
"WARNING: id \'";
string_of_tr_id id;"\'";
" is defined more than once in ";
string_of_path doc_settings path;
])
in aux2 tl
|false -> aux2 tl
in
let lst : (Doc_types.tr_id * t_path) list = aux1 table [] in
let _ : unit = aux2 lst in
table