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=61e823836a899e2f20a9d20e39336231ab93b2e4;hpb=04ffe68396b98bbf21bcd403ffba03b94eaebadc;p=helm.git diff --git a/helm/software/helena/src/basic_ag/bagEnvironment.ml b/helm/software/helena/src/basic_ag/bagEnvironment.ml index 61e823836..865b6a599 100644 --- a/helm/software/helena/src/basic_ag/bagEnvironment.ml +++ b/helm/software/helena/src/basic_ag/bagEnvironment.ml @@ -12,28 +12,34 @@ 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 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 = age}, uri, b in - UH.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 (UH.find env uri) with Not_found -> error uri + +END