X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Furimanager%2FuriManager.ml;h=2d099a4e9748bf64cae26ef76bf6361ce9986821;hb=57c7d6ef239b4c2b070721715887684adf41159c;hp=9ff6a796656cbcc4995ece2d97007101ff965d4c;hpb=55b82bd235d82ff7f0a40d980effe1efde1f5073;p=helm.git diff --git a/helm/software/components/urimanager/uriManager.ml b/helm/software/components/urimanager/uriManager.ml index 9ff6a7966..2d099a4e9 100644 --- a/helm/software/components/urimanager/uriManager.ml +++ b/helm/software/components/urimanager/uriManager.ml @@ -55,6 +55,13 @@ let name_of_uri (uri, _) = let index1 = String.rindex_from uri xpointer_offset '/' + 1 in let index2 = String.rindex uri '.' in String.sub uri index1 (index2 - index1) + +let nameext_of_uri (uri, _) = + let xpointer_offset, mah = + try String.rindex uri '#', 0 with Not_found -> String.length uri - 1, 1 + in + let index1 = String.rindex_from uri xpointer_offset '/' + 1 in + String.sub uri index1 (xpointer_offset - index1 + mah) let buri_of_uri (uri,_) = let xpointer_offset = @@ -184,6 +191,25 @@ let bodyuri_of_uri (uri, _) = None ;; +let ind_uri_split ((s, _) as uri) = + let noxp = strip_xpointer uri in + try + (let arg_index = String.rindex s '(' in + try + (let ty_index = String.index_from s arg_index '/' in + try + (let k_index = String.index_from s (ty_index+1) '/' in + let tyno = int_of_string (String.sub s (ty_index + 1) (k_index - ty_index - 1)) in + let kno = int_of_string (String.sub s (k_index + 1) (String.length s - k_index - 2)) in + noxp, Some tyno, Some kno) + with Not_found -> + let tyno = int_of_string (String.sub s (ty_index + 1) (String.length s - ty_index - 2)) in + noxp, Some tyno, None) + with Not_found -> noxp, None, None + ) + with Not_found -> noxp, None, None +;; + (* these are bugged! * we should remove _types, _univ, _ann all toghether *) let innertypesuri_of_uri (uri, _) = @@ -213,6 +239,19 @@ end module UriSet = Set.Make (OrderedUri) +(* +module OrderedUriPair = +struct + type t = uri * uri + let compare (u11, u12) (u21, u22) = + match compare u11 u21 with + | 0 -> compare u12 u22 + | x -> x +end + +module UriPairSet = Set.Make (OrderedUriPair) +*) + module HashedUri = struct type t = uri