+#include <cstring>
+#include <utility>
+#include <algorithm>
+#include <vector>
+#include "xml-tree.hpp"
+#include "utils_stub.hpp"
+
+
+//define a type for the lexicographic index
+
+class lex_index {
+public:
+ //The tag ID
+ xml_tree::tag_t tag;
+ //The text data
+ std::vector<std::pair<std::string, xml_tree::node_t> > data;
+};
+
+
+
+using namespace SXSI;
+
+
+static xml_tree*& XMLTREE(value v)
+{
+ return Obj_val<xml_tree*>(v);
+}
+
+static lex_index*& LEXINDEX(value v)
+{
+ return Obj_val<lex_index*>(v);
+}
+
+static xml_tree::node_t TREENODE(value i)
+{
+ return static_cast<xml_tree::node_t>(Int_val(i));
+}
+
+static xml_tree::tag_t TAG(value i)
+{
+ return static_cast<xml_tree::tag_t>(Int_val(i));
+}
+
+
+
+
+extern "C" value caml_build_lex_index(value vtree, value vtag)
+{
+ CAMLparam2(vtree, vtag);
+ CAMLlocal1(vindex);
+ vindex = sxsi_alloc_custom<lex_index*>();
+ xml_tree * tree = XMLTREE(vtree);
+ xml_tree::tag_t tag = TAG(vtag);
+
+ //Uncomment the following and comment the failwith line
+ //LEXINDEX(vindex) = ... return a lex_index* ....
+
+
+ caml_failwith("build_lex_index not implemented");
+
+
+ CAMLreturn (vindex);
+}
+
+extern "C" value caml_print_lex_index(value vindex)
+{
+ CAMLparam1(vindex);
+ lex_index* index = LEXINDEX(vindex);
+
+ //Print the index to the terminal
+
+ caml_failwith("print_lex_index not implemented");
+
+
+ CAMLreturn (Val_unit);
+}