Change from unordered_set<tag> to int array in low-level select_* functions.
[SXSI/xpathcomp.git] / src / xml-tree_stub.cpp
index 2551c66..47b6c63 100644 (file)
@@ -1,6 +1,5 @@
-#include <unordered_set>
 #include "xml-tree.hpp"
-#include "common_stub.hpp"
+#include "utils_stub.hpp"
 #include <cstdio>
 
 using namespace SXSI;
@@ -20,32 +19,6 @@ static xml_tree::tag_t TAG(value i)
   return static_cast<xml_tree::tag_t>(Int_val(i));
 }
 
-static std::unordered_set<xml_tree::tag_t>*& HSET(value x)
-{
-  return Obj_val<std::unordered_set<xml_tree::tag_t>*>(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<std::unordered_set<xml_tree::tag_t>*>();
-  HSET(hset) = new std::unordered_set<xml_tree::tag_t>();
-  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);
@@ -219,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
@@ -233,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
@@ -254,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,
@@ -273,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))));
 }