(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* let i, j = Loc.unloc loc in Printf.fprintf oc "%d %d %s %S\n" i j key v) !oc let current_loc = ref Loc.ghost let record_in_aux_set_at loc = current_loc := loc let record_in_aux key v = record_in_aux_at !current_loc key v exception Outdated let load_aux_file_for vfile = let ret3 x y z = x, y, z in let ret4 x y z t = x, y, z, t in let h = ref empty_aux_file in let add loc k v = let m = try H.find loc !h with Not_found -> M.empty in h := H.add loc (M.add k v m) !h in let aux_fname = aux_file_name_for vfile in try let ic = open_in aux_fname in let ver, hash, fname = Scanf.fscanf ic "COQAUX%d %s %s\n" ret3 in if ver <> version then raise (Failure "aux file version mismatch"); if fname <> CUnix.strip_path vfile then raise (Failure "aux file name mismatch"); if Digest.to_hex (Digest.file vfile) <> hash then raise Outdated; while true do let i, j, k, v = Scanf.fscanf ic "%d %d %s %S\n" ret4 in add (i,j) k v; done; raise End_of_file with | End_of_file -> !h | Outdated -> empty_aux_file | Sys_error s | Scanf.Scan_failure s | Failure s | Invalid_argument s -> Pp.(msg_error (str"Error loading file "++str aux_fname++str" : "++str s)); empty_aux_file