projects
/
SXSI
/
xpathcomp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5783565
)
Start making the code tag agnostic.
author
Kim Nguyễn
<kn@lri.fr>
Thu, 16 Feb 2012 01:58:36 +0000
(
02:58
+0100)
committer
Kim Nguyễn
<kn@lri.fr>
Thu, 16 Feb 2012 01:58:36 +0000
(
02:58
+0100)
src/tag.ml
patch
|
blob
|
history
src/tag.mli
patch
|
blob
|
history
diff --git
a/src/tag.ml
b/src/tag.ml
index
6c88089
..
01d3788
100644
(file)
--- a/
src/tag.ml
+++ b/
src/tag.ml
@@
-10,6
+10,13
@@
type t = int
type pool
type t = int
type pool
+type operations = {
+ tag : pool -> string -> t;
+ to_string : pool -> t ->string;
+ nullt : pool -> t;
+ translate : pool -> t -> t
+}
+
external null_pool : unit -> pool = "caml_xml_tree_nullt"
external null_tag : unit -> t = "caml_xml_tree_nullt"
external register_tag : pool -> string -> t = "caml_xml_tree_register_tag"
external null_pool : unit -> pool = "caml_xml_tree_nullt"
external null_tag : unit -> t = "caml_xml_tree_nullt"
external register_tag : pool -> string -> t = "caml_xml_tree_register_tag"
@@
-55,6
+62,17
@@
let to_string t =
else if t == nullt then "<!NIL!>"
else tag_name (get_pool()) t
else if t == nullt then "<!NIL!>"
else tag_name (get_pool()) t
+
+let xml_operations = {
+ tag = (fun _ x -> tag x);
+ to_string = (fun _ x -> to_string x);
+ nullt = (fun _ -> nullt);
+ translate = (fun _ x -> x);
+}
+
+
+
+
let dump_tags () =
Format.eprintf "Tags are:\n";
let doc = get_pool() in
let dump_tags () =
Format.eprintf "Tags are:\n";
let doc = get_pool() in
diff --git
a/src/tag.mli
b/src/tag.mli
index
6dc51ee
..
7a11be0
100644
(file)
--- a/
src/tag.mli
+++ b/
src/tag.mli
@@
-1,5
+1,12
@@
type t = int
type pool
type t = int
type pool
+type operations = {
+ tag : pool -> string -> t;
+ to_string : pool -> t -> string;
+ nullt : pool -> t;
+ translate : pool -> t -> t
+}
+
val tag : string -> t
val document_node : t
val tag : string -> t
val document_node : t
@@
-12,7
+19,7
@@
val pcdata_close : t
val attribute_data_close : t
val attribute_data_close : t
-val init : pool -> unit
+val init : pool ->
(* operations -> *)
unit
val to_string : t -> string
val compare : t -> t -> int
val equal : t -> t -> bool
val to_string : t -> string
val compare : t -> t -> int
val equal : t -> t -> bool