projects
/
SXSI
/
XMLTree.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Backport changes from the grammar branch
[SXSI/XMLTree.git]
/
XMLTree.h
diff --git
a/XMLTree.h
b/XMLTree.h
index
ea7b778
..
6d11d78
100644
(file)
--- a/
XMLTree.h
+++ b/
XMLTree.h
@@
-20,23
+20,13
@@
\r
#ifndef XMLTREE_H_
\r
#define XMLTREE_H_
\r
\r
#ifndef XMLTREE_H_
\r
#define XMLTREE_H_
\r
-extern "C" {
\r
-#define CAML_NAME_SPACE
\r
-#include <caml/mlvalues.h>
\r
-#include <caml/custom.h>
\r
-#define XMLTREE(x) ((XMLTree *)(* (XMLTree**) Data_custom_val(x)))
\r
- //#define XMLTREE(x) ((XMLTree*) (x))
\r
-}
\r
+
\r
+
\r
#include <unordered_set>
\r
#include <unordered_map>
\r
#include <sstream>
\r
#include "TextCollection/TextCollectionBuilder.h"
\r
\r
#include <unordered_set>
\r
#include <unordered_map>
\r
#include <sstream>
\r
#include "TextCollection/TextCollectionBuilder.h"
\r
\r
-#include <cstdio>
\r
-#include <cstdlib>
\r
-#include <cstring>
\r
-
\r
-
\r
#undef W
\r
#undef WW
\r
#undef Wminusone
\r
#undef W
\r
#undef WW
\r
#undef Wminusone
\r
@@
-50,7
+40,6
@@
using SXSI::TextCollection;
using SXSI::TextCollectionBuilder;
\r
\r
\r
using SXSI::TextCollectionBuilder;
\r
\r
\r
-
\r
// this constant is used to efficiently compute the child operation in the tree
\r
#define OPTD 10
\r
\r
// this constant is used to efficiently compute the child operation in the tree
\r
#define OPTD 10
\r
\r
@@
-96,7
+85,7
@@
typedef struct {
\r
\r
typedef std::unordered_set<int> TagIdSet;
\r
\r
\r
typedef std::unordered_set<int> TagIdSet;
\r
-typedef std::unordered_map<string,int> TagIdMap;
\r
+typedef std::unordered_map<st
d::st
ring,int> TagIdMap;
\r
typedef TagIdMap::const_iterator TagIdMapIT;
\r
\r
#define REGISTER_TAG(v,h,t) do { (h)->insert(std::make_pair((t),(v)->size()));\
\r
typedef TagIdMap::const_iterator TagIdMapIT;
\r
\r
#define REGISTER_TAG(v,h,t) do { (h)->insert(std::make_pair((t),(v)->size()));\
\r
@@
-123,7
+112,7
@@
class XMLTree {
bp *Par;
\r
\r
/** Mapping from tag identifer to tag name */
\r
bp *Par;
\r
\r
/** Mapping from tag identifer to tag name */
\r
-
vector<
string> *TagName;
\r
+
std::vector<std::
string> *TagName;
\r
TagIdMap * tIdMap;
\r
\r
/** Bit vector indicating with a 1 the positions of the non-empty texts. */
\r
TagIdMap * tIdMap;
\r
\r
/** Bit vector indicating with a 1 the positions of the non-empty texts. */
\r
@@
-142,7
+131,7
@@
class XMLTree {
\r
FILE* stream;
\r
int stream_fd;
\r
\r
FILE* stream;
\r
int stream_fd;
\r
- string * buffer;
\r
+ st
d::st
ring * buffer;
\r
void myfputs(const char* s, FILE * fp){
\r
buffer->append(s);
\r
if (buffer->size() >= 100000){
\r
void myfputs(const char* s, FILE * fp){
\r
buffer->append(s);
\r
if (buffer->size() >= 100000){
\r
@@
-181,7
+170,7
@@
class XMLTree {
XMLTree(){ buffer = 0;};
\r
\r
// non const pointer are freed by this method.
\r
XMLTree(){ buffer = 0;};
\r
\r
// non const pointer are freed by this method.
\r
-
XMLTree( pb * const par, uint npar, vector<
string> * const TN, TagIdMap * const tim, uint *empty_texts_bmp, TagType *tags,
\r
+
XMLTree( pb * const par, uint npar, std::vector<std::
string> * const TN, TagIdMap * const tim, uint *empty_texts_bmp, TagType *tags,
\r
TextCollection * const TC, bool dis_tc);
\r
\r
public:
\r
TextCollection * const TC, bool dis_tc);
\r
\r
public:
\r
@@
-271,7
+260,7
@@
public:
* if none.
\r
*/
\r
treeNode FirstElement(treeNode x);
\r
* if none.
\r
*/
\r
treeNode FirstElement(treeNode x);
\r
- value CamlFirstElement(value x);
\r
+
\r
/** LastChild(x): returns the last child of node x. */
\r
treeNode LastChild(treeNode x);
\r
\r
/** LastChild(x): returns the last child of node x. */
\r
treeNode LastChild(treeNode x);
\r
\r
@@
-284,7
+273,7
@@
public:
* if none.
\r
*/
\r
treeNode NextElement(treeNode x);
\r
* if none.
\r
*/
\r
treeNode NextElement(treeNode x);
\r
- value CamlNextElement(value x);
\r
+
\r
/** PrevSibling(x): returns the previous sibling of node x, assuming it
\r
* exists. */
\r
\r
/** PrevSibling(x): returns the previous sibling of node x, assuming it
\r
* exists. */
\r
\r
@@
-511,8
+500,6
@@
public:
\r
};
\r
\r
\r
};
\r
\r
-extern "C" value caml_cpp_fast_first_element(value xmltree, value node);
\r
-extern "C" value caml_cpp_fast_next_element(value xmltree, value node);
\r
\r
\r
\r
\r
\r
\r