X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fxml-tree_stub.cpp;fp=src%2Fxml-tree_stub.cpp;h=5dbdf36b0c20ac042f96af20c562289ae8eeecf8;hb=046839a3969319f5d38e8f72fe9cb640a639af6c;hp=1d52a9dfcd6385e1d6e5df14a1545875a0e1630b;hpb=6d471b1d8d9545dd8ee0ea6772b0d8253c981d96;p=SXSI%2Fxpathcomp.git diff --git a/src/xml-tree_stub.cpp b/src/xml-tree_stub.cpp index 1d52a9d..5dbdf36 100644 --- a/src/xml-tree_stub.cpp +++ b/src/xml-tree_stub.cpp @@ -19,14 +19,14 @@ static xml_tree::tag_t TAG(value i) return static_cast(Int_val(i)); } -extern "C" value caml_xml_tree_save(value tree, value fd, value prefix) +ML_BINDING value caml_xml_tree_save(value tree, value fd, value prefix) { CAMLparam3(tree, fd, prefix); XMLTREE(tree)->save(Int_val(fd), String_val(prefix)); CAMLreturn (Val_unit); } -extern "C" value +ML_BINDING value caml_xml_tree_load(value fd, value prefix, value load_tc, value sf) { CAMLparam4(fd, prefix, load_tc, sf); @@ -50,188 +50,188 @@ caml_xml_tree_load(value fd, value prefix, value load_tc, value sf) return (Val_unit); } -NoAlloc extern "C" value caml_xml_tree_root(value tree) +NoAlloc ML_BINDING value caml_xml_tree_root(value tree) { return (Val_int(XMLTREE(tree)->root())); } -NoAlloc extern "C" value caml_xml_tree_size(value tree) +NoAlloc ML_BINDING value caml_xml_tree_size(value tree) { return (Val_int(XMLTREE(tree)->size())); } -NoAlloc extern "C" value caml_xml_tree_num_tags(value tree) +NoAlloc ML_BINDING value caml_xml_tree_num_tags(value tree) { return (Val_int(XMLTREE(tree)->num_tags())); } -NoAlloc extern "C" value caml_xml_tree_subtree_size(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_subtree_size(value tree, value node) { return (Val_int(XMLTREE(tree)->subtree_size(TREENODE(node)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_subtree_tags(value tree, value node, value tag) { return (Val_int(XMLTREE(tree)->subtree_tags(TREENODE(node), TAG(tag)))); } -NoAlloc extern "C" value caml_xml_tree_subtree_elements(value tree, +NoAlloc ML_BINDING value caml_xml_tree_subtree_elements(value tree, value node) { return (Val_int(XMLTREE(tree)->subtree_elements(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_is_leaf(value tree, value node){ +NoAlloc ML_BINDING value caml_xml_tree_is_leaf(value tree, value node){ return (Val_bool(XMLTREE(tree)->is_leaf(TREENODE(node)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_is_ancestor(value tree, value node1, value node2) { return (Val_bool(XMLTREE(tree)->is_ancestor(TREENODE(node1), TREENODE(node2)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_is_child(value tree, value node1, value node2) { return (Val_bool(XMLTREE(tree)->is_child(TREENODE(node1), TREENODE(node2)))); } -NoAlloc extern "C" value caml_xml_tree_is_first_child(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_is_first_child(value tree, value node) { return (Val_bool(XMLTREE(tree)->is_first_child(TREENODE(node)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_is_right_descendant(value tree, value x, value y) { return (Val_bool(XMLTREE(tree)->is_right_descendant(TREENODE(x), TREENODE(y)))); } -NoAlloc extern "C" value caml_xml_tree_num_children(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_num_children(value tree, value node) { return (Val_int(XMLTREE(tree)->num_children(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_child_pos(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_child_pos(value tree, value node) { return (Val_int(XMLTREE(tree)->child_pos(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_depth(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_depth(value tree, value node) { return (Val_int(XMLTREE(tree)->depth(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_preorder(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_preorder(value tree, value node) { return (Val_int(XMLTREE(tree)->preorder(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_postorder(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_postorder(value tree, value node) { return (Val_int(XMLTREE(tree)->postorder(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_tag(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_tag(value tree, value node) { return (Val_int(XMLTREE(tree)->tag(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_parent(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_parent(value tree, value node) { return (Val_int(XMLTREE(tree)->parent(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_child(value tree, value node, value idx) +NoAlloc ML_BINDING value caml_xml_tree_child(value tree, value node, value idx) { return (Val_int(XMLTREE(tree)->child(TREENODE(node), Int_val(idx)))); } -NoAlloc extern "C" value caml_xml_tree_first_child(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_first_child(value tree, value node) { return (Val_int(XMLTREE(tree)->first_child(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_first_element(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_first_element(value tree, value node) { return (Val_int(XMLTREE(tree)->first_element(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_last_child(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_last_child(value tree, value node) { return (Val_int(XMLTREE(tree)->last_child(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_next_sibling(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_next_sibling(value tree, value node) { return (Val_int(XMLTREE(tree)->next_sibling(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_next_element(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_next_element(value tree, value node) { return (Val_int(XMLTREE(tree)->next_element(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_prev_sibling(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_prev_sibling(value tree, value node) { return (Val_int(XMLTREE(tree)->prev_sibling(TREENODE(node)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_tagged_child(value tree, value node, value tag) { return (Val_int(XMLTREE(tree)->tagged_child(TREENODE(node), TAG(tag)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_select_child(value tree, value node, value tags) { return (Val_int(XMLTREE(tree)->select_child(TREENODE(node), TAGLIST(tags)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_tagged_sibling(value tree, value node, value tag) { return (Val_int(XMLTREE(tree)->tagged_sibling(TREENODE(node), TAG(tag)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_select_sibling(value tree, value node, value tags) { return (Val_int(XMLTREE(tree)->select_sibling(TREENODE(node), TAGLIST(tags)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_tagged_descendant(value tree, value node, value tag) { return (Val_int(XMLTREE(tree)->tagged_descendant(TREENODE(node), TAG(tag)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_tagged_next(value tree, value node, value tag) { return (Val_int(XMLTREE(tree)->tagged_next(TREENODE(node), TAG(tag)))); } -NoAlloc extern "C" value +NoAlloc ML_BINDING value caml_xml_tree_select_descendant(value tree, value node, value tags) { return (Val_int(XMLTREE(tree)->select_descendant(TREENODE(node), TAGLIST(tags)))); } -NoAlloc extern "C" value caml_xml_tree_tagged_following_before(value tree, +NoAlloc ML_BINDING value caml_xml_tree_tagged_following_before(value tree, value node, value tag, value closing) @@ -241,7 +241,7 @@ NoAlloc extern "C" value caml_xml_tree_tagged_following_before(value tree, TREENODE(closing)))); } -NoAlloc extern "C" value caml_xml_tree_select_following_before(value tree, +NoAlloc ML_BINDING value caml_xml_tree_select_following_before(value tree, value node, value tags, value closing) @@ -253,7 +253,7 @@ NoAlloc extern "C" value caml_xml_tree_select_following_before(value tree, -extern "C" value caml_xml_tree_get_text_collection(value tree) +ML_BINDING value caml_xml_tree_get_text_collection(value tree) { CAMLparam1(tree); CAMLlocal1(text); @@ -262,17 +262,17 @@ extern "C" value caml_xml_tree_get_text_collection(value tree) CAMLreturn (text); } -NoAlloc extern "C" value caml_xml_tree_closing(value tree, value node) +NoAlloc ML_BINDING value caml_xml_tree_closing(value tree, value node) { return (Val_int(XMLTREE(tree)->closing(TREENODE(node)))); } -NoAlloc extern "C" value caml_xml_tree_nullt(value unit){ +NoAlloc ML_BINDING value caml_xml_tree_nullt(value unit){ return (Val_int(xml_tree::NIL)); } -extern "C" value caml_xml_tree_print(value tree, value node, value fd) +ML_BINDING value caml_xml_tree_print(value tree, value node, value fd) { CAMLparam3(tree, node, fd); XMLTREE(tree)->print(TREENODE(node), Int_val(fd)); @@ -280,7 +280,7 @@ extern "C" value caml_xml_tree_print(value tree, value node, value fd) } -extern "C" value caml_xml_tree_get_tag_name(value tree, value tag) +ML_BINDING value caml_xml_tree_get_tag_name(value tree, value tag) { CAMLparam2(tree, tag); CAMLlocal1(res); @@ -289,13 +289,13 @@ extern "C" value caml_xml_tree_get_tag_name(value tree, value tag) CAMLreturn(res); } -NoAlloc extern "C" value caml_xml_tree_flush(value tree, value fd) +NoAlloc ML_BINDING value caml_xml_tree_flush(value tree, value fd) { XMLTREE(tree)->flush(Int_val(fd)); return Val_unit; } -extern "C" value caml_xml_tree_register_tag(value tree, value str) +ML_BINDING value caml_xml_tree_register_tag(value tree, value str) { CAMLparam2(tree, str); value res; @@ -329,7 +329,7 @@ static std::vector sort_results(std::vector v, xml_tree *t) } #define BV_QUERY(pref, Pref) \ - extern "C" value caml_text_collection_## pref ##_bv(value tree, value str, value dobvv){ \ + ML_BINDING value caml_text_collection_## pref ##_bv(value tree, value str, value dobvv){ \ CAMLparam3(tree, str, dobvv); \ CAMLlocal3(res, res_bv, res_array); \ int j; \ @@ -349,7 +349,7 @@ static std::vector sort_results(std::vector v, xml_tree *t) }; \ caml_initialize(&Field(res_array, i), Val_int(j)); \ }; \ - fprintf(stderr, "Raw results: %lu, Sorted reulsts %lu\n", uresults.size(), results.size()); \ + fprintf(stderr, "Raw results: %zu, Sorted results %zu\n", uresults.size(), results.size()); \ free(cstr); \ res = caml_alloc(2, 0); \ Store_field(res, 0, res_bv); \