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 let baseuri_of_uri (_,uri) =
27 module OrderedStrings =
30 let compare (s1 : t) (s2 : t) = compare s1 s2
34 module MapStringsToUri = Map.Make(OrderedStrings);;
36 let set_of_uri = ref MapStringsToUri.empty;;
39 let counter = ref 0 in
40 let c () = incr counter; !counter in
42 try MapStringsToUri.find s !set_of_uri
44 let new_uri = c(), s in
45 set_of_uri := MapStringsToUri.add s new_uri !set_of_uri;
50 let compare (n1,_) (n2,_) = n2 - n1;;
60 module UriHash = Hashtbl.Make(HT);;
61 module UriMap = Map.Make(HT);;
62 module UriSet = Set.Make(HT);;