-let initial_level1_patterns21 () = Hashtbl.create 211
-let level1_patterns21 = ref (initial_level1_patterns21 ())
-let compiled21 = ref None
-let pattern21_matrix = ref []
-let counter = ref ~-1
-
-let stack = ref [];;
-
-let push () =
- stack := (!counter,!level1_patterns21,!compiled21,!pattern21_matrix)::!stack;
- counter := ~-1;
- level1_patterns21 := initial_level1_patterns21 ();
- compiled21 := None;
- pattern21_matrix := []
-;;
-
-let pop () =
- match !stack with
- [] -> assert false
- | (ocounter,olevel1_patterns21,ocompiled21,opatterns21_matrix)::old ->
- stack := old;
- counter := ocounter;
- level1_patterns21 := olevel1_patterns21;
- compiled21 := ocompiled21;
- pattern21_matrix := opatterns21_matrix
-;;
-
-let get_compiled21 () =
- match !compiled21 with
+module IntMap = Map.Make(struct type t = int let compare = compare end);;
+
+type db = {
+ level1_patterns21: NotationPt.term IntMap.t;
+ compiled21: ((NotationPt.term -> (NotationEnv.t * NotationPt.term list * int) option)) Lazy.t option;
+ pattern21_matrix: (NotationPt.term * pattern_id) list;
+ counter: pattern_id
+}
+
+let initial_db = {
+ level1_patterns21 = IntMap.empty;
+ compiled21 = None;
+ pattern21_matrix = [];
+ counter = ~-1
+}
+
+class type g_status =
+ object
+ method content_pres_db: db
+ end
+
+class status =
+ object
+ val content_pres_db = initial_db
+ method content_pres_db = content_pres_db
+ method set_content_pres_db v = {< content_pres_db = v >}
+ method set_content_pres_status
+ : 'status. #g_status as 'status -> 'self
+ = fun o -> {< content_pres_db = o#content_pres_db >}
+ end
+
+let get_compiled21 status =
+ match status#content_pres_db.compiled21 with