(* ||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 UH = U.UriHash module L = Log module G = Options module E = Entity module Z = Bag IFDEF TYPE THEN exception ObjectNotFound of Z.message let hsize = 7000 let env = UH.create hsize (* Internal functions *******************************************************) let error uri = raise (ObjectNotFound (L.items1 (U.string_of_uri uri))) (* Interface functions ******************************************************) let set_entity f entity = IFDEF EXPAND THEN let ra, na, uri, b = entity in let entity0 = if !G.expand then ra, E.node_attrs ~apix:0 (), uri, b else entity in UH.add env uri entity0; f entity ELSE let _, _, uri, _ = entity in UH.add env uri entity; f entity END let get_entity f uri = try f (UH.find env uri) with Not_found -> error uri END