]> matita.cs.unibo.it Git - helm.git/commitdiff
virtuals for () removed and bound to 'o'
authorEnrico Tassi <enrico.tassi@inria.fr>
Thu, 8 Jan 2009 09:47:46 +0000 (09:47 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Thu, 8 Jan 2009 09:47:46 +0000 (09:47 +0000)
memory changed, used similar symbols are presented first but not altering their original order

helm/software/matita/matitaGui.ml
helm/software/matita/predefined_virtuals.ml

index ded9c83aa46dee4136af781f481d0a469321841c..72e0c9bfc7b14806082331ecd6a06a5018a3dc63 100644 (file)
@@ -1127,6 +1127,7 @@ class gui () =
       with Virtuals.Not_a_virtual -> false
          
     val similar_memory = Hashtbl.create 97
+    val mutable old_used_memory = false
 
     method private nextSimilarSymbol () = 
       let write_similarsymbol s =
@@ -1157,22 +1158,42 @@ class gui () =
           | [] ->  ()
           | eqclass ->
               similarsymbols_orig <- eqclass;
+              let is_used = 
+                try Hashtbl.find similar_memory similarsymbols_orig  
+                with Not_found -> 
+                  let is_used = List.map (fun x -> x,false) eqclass in
+                  Hashtbl.add similar_memory eqclass is_used; 
+                  is_used
+              in
               let hd, next, tl = 
-                match 
-                  try Hashtbl.find similar_memory similarsymbols_orig  
-                  with Not_found -> Hashtbl.add similar_memory eqclass eqclass; eqclass
-                with a::b::c -> a,b,c | _ -> assert false
+                let used, unused = 
+                  List.partition (fun s -> List.assoc s is_used) eqclass 
+                in
+                match used @ unused with a::b::c -> a,b,c | _ -> assert false
               in
               let hd, tl = 
                 if hd = last_symbol then next, tl @ [hd] else hd, (next::tl)
               in
+              old_used_memory <- List.assoc hd is_used;
+              let is_used = 
+                (hd,true) :: List.filter (fun (x,_) -> x <> hd) is_used
+              in
+              Hashtbl.replace similar_memory similarsymbols_orig is_used;
               write_similarsymbol hd;
               similarsymbols <- tl @ [ hd ]))
       else 
         match similarsymbols with
         | [] -> ()
         | hd :: tl ->
-            Hashtbl.replace similar_memory similarsymbols_orig similarsymbols;
+            let is_used = Hashtbl.find similar_memory similarsymbols_orig in
+            let last = HExtlib.list_last tl in
+            let old_used_for_last = old_used_memory in
+            old_used_memory <- List.assoc hd is_used;
+            let is_used = 
+              (hd, true) :: (last,old_used_for_last) ::
+                List.filter (fun (x,_) -> x <> last && x <> hd) is_used 
+            in
+            Hashtbl.replace similar_memory similarsymbols_orig is_used;
             similarsymbols <- tl @ [ hd ];
             write_similarsymbol hd
 
index 4ca3542b6b8d256928ea6082f5ef2b97bf76ad46..66c7fed9b38156f5f825107922e14ca7354f947a 100644 (file)
@@ -828,7 +828,7 @@ let predefined_virtuals = [
  ["\\NotNestedLessLess"                              ], "⒡̸", [circle];
  ["\\NotNestedGreaterGreater"                        ], "⒢̸", [circle];
  ["\\oS"; "\\circledS"                                ], "Ⓢ", [circle];
- ["\\cir";"()"                                            ], "○", [circle];
+ ["\\cir";                                            ], "○", [circle];
  ["\\xcirc"; "\\bigcirc"                              ], "◯", [circle];
 (* }}} *)
 
@@ -1507,7 +1507,6 @@ let predefined_classes = [
  ["_" ; "⎽"; "⎼"; "⎻"; "⎺"; ];
  ["<"; "≺"; "≮"; "⊀"; "〈"; "«"; ] ;
  ["□"; "◽"; "▪"; "◾"; ];
- ["∘";  "ø"; "○"; ] ;
  ["◊"; "♢"; "⧫"; "♦"; ];
  [">"; "〉"; "»"; ];       
  ["a"; "α"; "𝕒"; ] ;
@@ -1538,7 +1537,7 @@ let predefined_classes = [
  ["M"; "ℳ"; "𝕄"; ] ;
  ["n"; "𝕟"; ] ;
  ["N"; "ℕ"; "№"; ] ;
- ["o"; "θ"; "ϑ"; "𝕠"; ];
+ ["o"; "θ"; "ϑ"; "𝕠"; "∘";  "ø"; "○"; ] ;
  ["O"; "Θ"; "𝕆"; ] ;
  ["p"; "π"; "𝕡"; ] ;
  ["P"; "Π"; "℘"; "ℙ"; ] ;