]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/helena/src/basic_ag/bagEnvironment.ml
notational update in lambdadelta completed
[helm.git] / helm / software / helena / src / basic_ag / bagEnvironment.ml
index 24c2126199c5f5a568a4e4944fffb33f6d18ab91..865b6a59961d663d16f89e3af72bc1dbe5c627b4 100644 (file)
@@ -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