X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fxml-tree_stub.cpp;h=47b6c639d2d77f1b6c7553f602bf8ac447836114;hb=refs%2Fheads%2Fnew-xml-tree;hp=cdb7fe12e244ad429ef0cf9f04cdd675e12b1909;hpb=9d19c60e10c9572885509b35c2b72f362968d6ab;p=SXSI%2Fxpathcomp.git diff --git a/src/xml-tree_stub.cpp b/src/xml-tree_stub.cpp index cdb7fe1..47b6c63 100644 --- a/src/xml-tree_stub.cpp +++ b/src/xml-tree_stub.cpp @@ -1,6 +1,6 @@ -#include #include "xml-tree.hpp" -#include "common_stub.hpp" +#include "utils_stub.hpp" +#include using namespace SXSI; @@ -19,32 +19,6 @@ static xml_tree::tag_t TAG(value i) return static_cast(Int_val(i)); } -static std::unordered_set*& HSET(value x) -{ - return Obj_val*>(x); -} - - -NoAlloc extern "C" value caml_unordered_set_length(value hset) -{ - return (Val_int((HSET(hset))->size())); -} - -extern "C" value caml_unordered_set_alloc(value unit) -{ - CAMLparam1(unit); - CAMLlocal1(hset); - hset = sxsi_alloc_custom*>(); - HSET(hset) = new std::unordered_set(); - CAMLreturn (hset); -} - -NoAlloc extern "C" value caml_unordered_set_set(value set, value v) -{ - HSET(set)->insert(TAG(v)); - return (Val_unit); -} - extern "C" value caml_xml_tree_save(value tree, value fd, value prefix) { CAMLparam3(tree, fd, prefix); @@ -218,7 +192,7 @@ caml_xml_tree_tagged_child(value tree, value node, value tag) NoAlloc extern "C" value caml_xml_tree_select_child(value tree, value node, value tags) { - return (Val_int(XMLTREE(tree)->select_child(TREENODE(node), HSET(tags)))); + return (Val_int(XMLTREE(tree)->select_child(TREENODE(node), TAGLIST(tags)))); } NoAlloc extern "C" value @@ -232,7 +206,7 @@ NoAlloc extern "C" value caml_xml_tree_select_sibling(value tree, value node, value tags) { return (Val_int(XMLTREE(tree)->select_sibling(TREENODE(node), - HSET(tags)))); + TAGLIST(tags)))); } NoAlloc extern "C" value @@ -253,7 +227,7 @@ NoAlloc extern "C" value caml_xml_tree_select_descendant(value tree, value node, value tags) { return (Val_int(XMLTREE(tree)->select_descendant(TREENODE(node), - HSET(tags)))); + TAGLIST(tags)))); } NoAlloc extern "C" value caml_xml_tree_tagged_following_before(value tree, @@ -272,7 +246,7 @@ NoAlloc extern "C" value caml_xml_tree_select_following_before(value tree, value closing) { return (Val_int(XMLTREE(tree)->select_following_before(TREENODE(node), - HSET(tags), + TAGLIST(tags), TREENODE(closing)))); }