with
Not_found -> olduri
-let clear_suffix uri ?(pat2="") pat1 =
+let clear_suffix uri ?(pat2="",0) pat1 =
try
let index = String.rindex uri '.' in
let index' = index + 1 in
let suffix = String.sub uri index' (String.length uri - index') in
- if pat1 = suffix || pat2 = suffix then
+ if fst pat1 = suffix || fst pat2 = suffix then
String.sub uri 0 index
else
uri
with
Not_found -> assert false
-let has_suffix uri pat =
+let has_suffix uri (pat,n) =
try
- let index = String.rindex uri '.' + 1 in
- let suffix = String.sub uri index (String.length uri - index) in
+ let suffix = String.sub uri (String.length uri - n) n in
pat = suffix
with
Not_found -> assert false
-let _types = "types"
let _dottypes = ".types"
-let _ann = "ann"
+let _types = "types",5
+let _ann = "ann",3
let _dotann = ".ann"
-let _var = "var"
+let _var = "var",3
let _dotbody = ".body"
-let _con = "con"
+let _con = "con",3
let _xpointer = "#xpointer(1/"
let cicuri_of_uri (uri, _) = uri_of_string (clear_suffix uri ~pat2:_types _ann)