#include <caml/callback.h>
#include <caml/fail.h>
#include <caml/custom.h>
-
+#include "results.h"
#define CAMLRAISEMSG(msg) (caml_raise_with_string(*cpp_exception,(msg) ))
#define NOT_IMPLEMENTED(s) (caml_failwith(s))
extern "C" CAMLprim value caml_text_collection_get_cached_text(value tree, value id){
CAMLparam2(tree,id);
CAMLlocal1(str);
- char* txt = (char*) XMLTREE(tree)->GetCachedText((DocID) Int_val(id));
+ char* txt = (char*) XMLTREE(tree)->GetText((DocID) Int_val(id));
str = caml_copy_string(txt);
free(txt);
CAMLreturn (str);
return (Val_int(XMLTREE(tree)->SubtreeTags(TREENODEVAL(id),Int_val(tag))));
}
+extern "C" CAMLprim value caml_xml_tree_subtree_size(value tree,value id){
+ return (Val_int(XMLTREE(tree)->SubtreeSize(TREENODEVAL(id))));
+}
+
extern "C" CAMLprim value caml_xml_tree_register_tag(value tree,value str){
CAMLparam2(tree,str);
caml_initialize(&Field(tuple,1),Val_int(r.max));
CAMLreturn (tuple);
}
+
+extern "C" CAMLprim value caml_result_set_create(value size){
+ CAMLparam1(size);
+ results* res = (results*) malloc(sizeof(results));
+ results r = createResults (Int_val(size));
+ res->n = r.n;
+ res->lgn = r.lgn;
+ res->tree = r.tree;
+ CAMLreturn ((value) (res));
+}
+
+extern "C" CAMLprim value caml_result_set_set(value result,value p){
+ CAMLparam2(result,p);
+ setResult ( *((results*) result), Int_val(p));
+ CAMLreturn (Val_unit);
+}
+
+extern "C" CAMLprim value caml_result_set_clear(value result,value p1,value p2){
+ CAMLparam3(result,p1,p2);
+ clearRange ( *((results*) result), Int_val(p1), Int_val(p2));
+ CAMLreturn (Val_unit);
+}
+
+extern "C" CAMLprim value caml_result_set_next(value result,value p){
+ CAMLparam2(result,p);
+ CAMLreturn (Val_int(nextResult(*((results*) result), Int_val(p))));
+}
+
+