2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
14 type uri = int * string (* shareno, URI *)
16 let string_of_uri (_, uri) = uri;;
18 let name_of_uri (_, uri) =
19 let name = Filename.basename uri in
20 Filename.chop_extension name
23 module OrderedStrings =
26 let compare (s1 : t) (s2 : t) = compare s1 s2
30 module MapStringsToUri = Map.Make(OrderedStrings);;
32 let set_of_uri = ref MapStringsToUri.empty;;
35 let counter = ref 0 in
36 let c () = incr counter; !counter in
38 try MapStringsToUri.find s !set_of_uri
40 let new_uri = c(), s in
41 set_of_uri := MapStringsToUri.add s new_uri !set_of_uri;
46 let compare (n1,_) (n2,_) = n2 - n1;;
55 module UriHash = Hashtbl.Make(HT);;