projects
/
SXSI
/
xpathcomp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do not pass -fno-PIC when compiling for x86 (since the option is
[SXSI/xpathcomp.git]
/
src
/
xml-tree_stub.cpp
diff --git
a/src/xml-tree_stub.cpp
b/src/xml-tree_stub.cpp
index
47b6c63
..
1d52a9d
100644
(file)
--- a/
src/xml-tree_stub.cpp
+++ b/
src/xml-tree_stub.cpp
@@
-77,7
+77,8
@@
caml_xml_tree_subtree_tags(value tree, value node, value tag)
TAG(tag))));
}
TAG(tag))));
}
-NoAlloc extern "C" value caml_xml_tree_subtree_elements(value tree, value node)
+NoAlloc extern "C" value caml_xml_tree_subtree_elements(value tree,
+ value node)
{
return (Val_int(XMLTREE(tree)->subtree_elements(TREENODE(node))));
}
{
return (Val_int(XMLTREE(tree)->subtree_elements(TREENODE(node))));
}
@@
-305,7
+306,13
@@
extern "C" value caml_xml_tree_register_tag(value tree, value str)
/** Full reporting into a bit vector
*/
/** Full reporting into a bit vector
*/
-static std::vector<int32_t> sort_results(std::vector<int32_t> v)
+static void pr_vector(std::vector<int32_t> v)
+{
+ for(auto i = v.begin(); i!= v.end(); ++i)
+ fprintf(stderr, "%i ", *i);
+ fprintf(stderr, "\n");
+}
+static std::vector<int32_t> sort_results(std::vector<int32_t> v, xml_tree *t)
{
std::vector<int32_t> res;
std::sort(v.begin(), v.end());
{
std::vector<int32_t> res;
std::sort(v.begin(), v.end());
@@
-316,19
+323,19
@@
static std::vector<int32_t> sort_results(std::vector<int32_t> v)
if (i == v.end()) return res;
};
prev = *i;
if (i == v.end()) return res;
};
prev = *i;
- res.push_back(
prev
);
+ res.push_back(
t->parent_node(prev)
);
};
return res;
}
#define BV_QUERY(pref, Pref) \
extern "C" value caml_text_collection_## pref ##_bv(value tree, value str, value dobvv){ \
};
return res;
}
#define BV_QUERY(pref, Pref) \
extern "C" value caml_text_collection_## pref ##_bv(value tree, value str, value dobvv){ \
- CAMLparam3(tree, str, dobvv);
\
+ CAMLparam3(tree, str, dobvv); \
CAMLlocal3(res, res_bv, res_array); \
int j; \
uchar * cstr = (uchar *) strdup(String_val(str)); \
std::vector<int32_t> uresults = XMLTREE(tree)->Pref(cstr); \
CAMLlocal3(res, res_bv, res_array); \
int j; \
uchar * cstr = (uchar *) strdup(String_val(str)); \
std::vector<int32_t> uresults = XMLTREE(tree)->Pref(cstr); \
- std::vector<int32_t> results = sort_results(uresults
);
\
+ std::vector<int32_t> results = sort_results(uresults
, XMLTREE(tree));
\
bool dobv = Bool_val(dobvv); \
res_bv = caml_alloc_string(dobv ? ((XMLTREE(tree)->size() / 4) + 2) : 0); \
unsigned long slen = caml_string_length(res_bv); \
bool dobv = Bool_val(dobvv); \
res_bv = caml_alloc_string(dobv ? ((XMLTREE(tree)->size() / 4) + 2) : 0); \
unsigned long slen = caml_string_length(res_bv); \
@@
-336,12
+343,13
@@
static std::vector<int32_t> sort_results(std::vector<int32_t> v)
memset(&(Byte(res_bv,0)), 0, slen); \
res_array = caml_alloc_shr(results.size(), 0); \
for (unsigned int i = 0; i < results.size(); ++i) { \
memset(&(Byte(res_bv,0)), 0, slen); \
res_array = caml_alloc_shr(results.size(), 0); \
for (unsigned int i = 0; i < results.size(); ++i) { \
- j =
XMLTREE(tree)->parent_node(results[i]);
\
+ j =
results[i];
\
if (dobv) { \
Byte(res_bv, j >> 3) |= (1 << (j & 7)); \
}; \
caml_initialize(&Field(res_array, i), Val_int(j)); \
}; \
if (dobv) { \
Byte(res_bv, j >> 3) |= (1 << (j & 7)); \
}; \
caml_initialize(&Field(res_array, i), Val_int(j)); \
}; \
+ fprintf(stderr, "Raw results: %lu, Sorted reulsts %lu\n", uresults.size(), results.size()); \
free(cstr); \
res = caml_alloc(2, 0); \
Store_field(res, 0, res_bv); \
free(cstr); \
res = caml_alloc(2, 0); \
Store_field(res, 0, res_bv); \