-#include "common_stub.hpp"
+#include "utils_stub.hpp"
extern "C" value caml_clz(value i)
{
{
return Val_long( ( 1 << (sizeof(unsigned long)*8 - __builtin_clzl(Long_val(i)) - 1)));
}
+
+xml_tree::tag_t*& TAGLIST(value x)
+{
+ return Obj_val<xml_tree::tag_t*>(x);
+}
+
+static void finalize_tag_list(value x)
+{
+ xml_tree::tag_t * t = TAGLIST(x);
+ delete [] t;
+}
+
+extern "C" value caml_tag_list_alloc(value length)
+{
+ CAMLparam1(length);
+ CAMLlocal1(tlist);
+ tlist = sxsi_alloc_custom<xml_tree::tag_t*>();
+ TAGLIST(tlist) = new xml_tree::tag_t[Int_val(length)];
+ CAMLreturn (tlist);
+}
+
+NoAlloc extern "C" value caml_tag_list_set(value tl, value i, value v)
+{
+ TAGLIST(tl)[Int_val(i)] = Int_val(v);
+ return Val_unit;
+}