(* ||M|| This file is part of HELM, an Hypertextual, Electronic ||A|| Library of Mathematics, developed at the Computer Science ||T|| Department, University of Bologna, Italy. ||I|| ||T|| HELM is free software; you can redistribute it and/or ||A|| modify it under the terms of the GNU General Public License \ / version 2 or (at your option) any later version. \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) module U = NUri module L = Log module H = U.UriHash module B = Bag exception ObjectNotFound of B.message let hsize = 7000 let env = H.create hsize let age = ref 1 (* Internal functions *******************************************************) let error uri = raise (ObjectNotFound (L.items1 (U.string_of_uri uri))) (* Interface functions ******************************************************) let set_entry f entry = let _, uri, b = entry in let entry = !age, uri, b in incr age; H.add env uri entry; f entry let get_entry f uri = try f (H.find env uri) with Not_found -> error uri