/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*  markup_stats.c - parabix demo program
    Copyright (c) 2007, Robert D. Cameron.
    Licensed to the public under the Open Software License 3.0.
    Licensed to International Characters, Inc., under the Academic
    Free License 3.0.

*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string>
#include <iostream>
using namespace std;

#define ON 1
#define OFF 2

#define TEMPLATED_SIMD_LIB
#define VALIDATION_MODE OFF

//#include "src/ilax.h"
#include "src/engine.h"

#include "tools.h"

#define TEMPLATED_SIMD_LIB
#include "lib/lib_simd.h"
#include "lib/sse_simd.h"
#include "src/engine.h"

/* Internals */
#include "src/xmlmodel.h"
#include "src/xml_error.h"
#include "src/bitplex.h"
#include "src/byteplex.h"
#include "src/xmldecl.h"
#include "src/bitlex.h"


#include "src/xmlmodel.c"
#include "src/xml_error.c"
#include "src/bitplex.c"
#include "src/byteplex.c"
#include "src/xmldecl.c"
#include "src/bitlex.c"
#include "src/engine.c"
#include "src/symtab.c"

/* Global declarations of parsing engine. */
Parser_Interface<UTF_8> * parser;


#ifdef LEAF_COUNTING
int at_start = 1;
int leaf_count = 0;
int interior_count = 0;
#endif

template<>
inline void Parser_Interface<UTF_8>::Comment_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::CDATA_start_action(unsigned char * CDATA_ptr){
}

template<>
inline void Parser_Interface<UTF_8>::CDATA_end_action(unsigned char * CDATA_end_ptr) {
}

template<>
inline void Parser_Interface<UTF_8>::PI_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::EmptyElement_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::StartTag_action(unsigned char * item, int lgth) {
/*    fwrite((char*)item, 1, lgth, stdout);
    printf(",");*/
    return;
}

template<>
inline void Parser_Interface<UTF_8>::EndTag_action(unsigned char * item, int lgth) {
    return;
}

template<>
inline void Parser_Interface<UTF_8>::Error_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::Text_action(unsigned char * item, int lgth, bool more) {
    return;
}

template<>
inline void Parser_Interface<UTF_8>::Reference_action(unsigned char * item, int lgth) {
}


template<>
inline void Parser_Interface<UTF_8>::ElementName_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::PI_Target_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::AttributeValue_action(unsigned char * name, int name_lgth, 
                                 unsigned char * val, int val_lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::Namespace_action(unsigned char * name, int name_lgth,
                             unsigned char * URI, int URI_lgth) {
}


template<>
void Parser_Interface<UTF_8>::FinalizeBuffer_action() {
}


template<>
inline void Parser_Interface<UTF_8>::DocumentStart_action() {
}

template<>
inline void Parser_Interface<UTF_8>::DocumentEnd_action() {
}

template<>
inline void Parser_Interface<UTF_8>::Doctype_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::PEReference_action(unsigned char * item, int lgth) {
}


template<>
inline void Parser_Interface<UTF_8>::ExtSubsetDecl_action(unsigned char * item, int lgth) {
}

template<>
inline void Parser_Interface<UTF_8>::Prolog_action(unsigned char * item, int lgth) {
}



void initXML(struct TestData *td) {
}

void releaseXML(struct TestData *td) {
}


void parseXML(struct TestData *td, unsigned long iter) {
/*
    Entity_Info * e;
    Model_Info * m;
    Byteplex * b;

    e = new Entity_Info;
    m = new Model_Info;
    e->AnalyzeSignature((unsigned char*)"<?xm");
    b = Byteplex::ByteplexFactory(e, (unsigned char*)td->xml, td->xmllen);
//    printf("%u %u\n", td->xmllen, strlen(td->xml));
//    puts(td->xml);
    b->DoByteplex();
    b->PreparePseudoASCII_Stream();
    XML_Decl_Parser<ASCII> decl_parser(b);
    decl_parser.ReadXMLInfo(*e);

    Crashes due to the limited buffer size in byteplex.h and some other reasons
*/    

    parser = Parser_Interface<UTF_8>::ParserFactory("/tmp/parabix.test");//td->xml+i, td->xmllen-i, e, m);
//    parser = new ParsingEngine<X8_Buffer<ASCII>, UTF_8>(e, m, b, false);
//    parser = new ParsingEngine<UTF8_Buffer, UTF_8>(e, m, b, false);
    parser->Parse_Prolog();
    parser->Parse_DocumentContent();
    delete parser;
}

int main(int argc, char *argv[]) {
    return Test(argc,argv);
}