+ if List.exists (fun (x,_,_,_) -> UriManager.eq u x) l then
+ let l =
+ let l =
+ (* this code reorders the list so that adding an already declared
+ * coercion moves it to the begging of the list *)
+ let item = List.find (fun (x,_,_,_) -> UriManager.eq u x) l in
+ let rest=List.filter (fun (x,_,_,_) -> not (UriManager.eq u x)) l in
+ item :: rest
+ in
+ List.map
+ (fun (x,n,x_saturations,x_cpos) as e ->
+ if UriManager.eq u x then
+ (* not sure, this may be a feature *)
+ (assert (x_saturations = saturations && x_cpos = cpos);
+ (x,n+1,saturations,cpos))
+ else e)
+ l
+ in
+ db := (src,tgt,l)::tl @ rest
+ else
+ db := (src,tgt,(u,1,saturations,cpos)::l)::tl @ rest