1 type symbol = Glib.unichar
4 let virtual_to_symbol = Hashtbl.create 503;;
5 let tag_to_data = Hashtbl.create 503;;
7 let add_virtual names symbol tags =
10 if Hashtbl.mem virtual_to_symbol name then
12 (Printf.sprintf "name %s already used for virtual %s" name
13 (Glib.Utf8.from_unichar (Hashtbl.find virtual_to_symbol name)))
15 Hashtbl.add virtual_to_symbol name symbol)
20 let l = Hashtbl.find tag_to_data tag in
21 let l = (names,symbol) :: l in
22 Hashtbl.replace tag_to_data tag l
24 Hashtbl.add tag_to_data tag [names,symbol])
28 let get_all_virtuals () =
31 (fun k v -> l := (k,v) :: !l;)
36 exception Not_a_virtual
38 let rec symbol_of_virtual str =
39 if str = "" then raise Not_a_virtual
41 try str, Hashtbl.find virtual_to_symbol str
43 symbol_of_virtual (String.sub str 1 (String.length str - 1))
46 let classes = Hashtbl.create 503;;
50 assert(not (Hashtbl.mem classes x));
51 Hashtbl.add classes x l) l
54 let similar_symbols symbol =
55 try Hashtbl.find classes symbol