X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fhelena%2Fsrc%2Fbasic_ag%2FbagEnvironment.ml;h=865b6a59961d663d16f89e3af72bc1dbe5c627b4;hb=4217fb2c3c93019cdf9c22a80ed46d6814f1cb7d;hp=24c2126199c5f5a568a4e4944fffb33f6d18ab91;hpb=977faf4820cd8ff5e2f0a5249161bbb92ae4b097;p=helm.git diff --git a/helm/software/helena/src/basic_ag/bagEnvironment.ml b/helm/software/helena/src/basic_ag/bagEnvironment.ml index 24c212619..865b6a599 100644 --- a/helm/software/helena/src/basic_ag/bagEnvironment.ml +++ b/helm/software/helena/src/basic_ag/bagEnvironment.ml @@ -9,31 +9,37 @@ \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) -module U = NUri -module L = Log -module K = U.UriHash -module E = Entity -module Z = Bag +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 = K.create hsize +let hsize = 7000 +let env = UH.create hsize (* Internal functions *******************************************************) -let get_age = - let age = ref 0 in - fun () -> incr age; !age - let error uri = raise (ObjectNotFound (L.items1 (U.string_of_uri uri))) (* Interface functions ******************************************************) -let set_entity f (ra, na, uri, b) = - let age = get_age () in - let entry = ra, {na with E.n_apix = Some age}, uri, b in - K.add env uri entry; f entry +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 (K.find env uri) with Not_found -> error uri + try f (UH.find env uri) with Not_found -> error uri + +END