nokolexbor 0.2.5 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/nokolexbor/CMakeLists.txt +7 -4
- data/ext/nokolexbor/config.h.cmake.in +2 -0
- data/ext/nokolexbor/extconf.rb +47 -25
- data/ext/nokolexbor/libxml/SAX2.h +4 -4
- data/ext/nokolexbor/libxml/chvalid.h +21 -21
- data/ext/nokolexbor/libxml/dict.h +13 -13
- data/ext/nokolexbor/libxml/globals.h +202 -202
- data/ext/nokolexbor/libxml/hash.h +25 -25
- data/ext/nokolexbor/libxml/parser.h +5 -5
- data/ext/nokolexbor/libxml/parserInternals.h +4 -4
- data/ext/nokolexbor/libxml/pattern.h +14 -14
- data/ext/nokolexbor/libxml/threads.h +15 -15
- data/ext/nokolexbor/libxml/tree.h +5 -5
- data/ext/nokolexbor/libxml/xmlerror.h +5 -5
- data/ext/nokolexbor/libxml/xmlmemory.h +16 -16
- data/ext/nokolexbor/libxml/xmlstring.h +30 -30
- data/ext/nokolexbor/libxml/xpath.h +43 -43
- data/ext/nokolexbor/libxml/xpathInternals.h +128 -128
- data/ext/nokolexbor/memory.c +6 -6
- data/ext/nokolexbor/nl_cdata.c +44 -0
- data/ext/nokolexbor/nl_comment.c +44 -0
- data/ext/nokolexbor/nl_document.c +23 -9
- data/ext/nokolexbor/nl_node.c +191 -178
- data/ext/nokolexbor/nl_node_set.c +38 -73
- data/ext/nokolexbor/nl_text.c +44 -0
- data/ext/nokolexbor/nl_xpath_context.c +33 -42
- data/ext/nokolexbor/nokolexbor.c +7 -3
- data/ext/nokolexbor/nokolexbor.h +9 -7
- data/ext/nokolexbor/private/buf.h +1 -1
- data/ext/nokolexbor/private/error.h +3 -3
- data/ext/nokolexbor/xml_SAX2.c +8 -8
- data/ext/nokolexbor/xml_buf.c +19 -19
- data/ext/nokolexbor/xml_chvalid.c +25 -25
- data/ext/nokolexbor/xml_dict.c +69 -69
- data/ext/nokolexbor/xml_encoding.c +2 -2
- data/ext/nokolexbor/xml_error.c +51 -51
- data/ext/nokolexbor/xml_globals.c +329 -329
- data/ext/nokolexbor/xml_hash.c +131 -131
- data/ext/nokolexbor/xml_memory.c +25 -25
- data/ext/nokolexbor/xml_parser.c +3 -3
- data/ext/nokolexbor/xml_parserInternals.c +15 -15
- data/ext/nokolexbor/xml_pattern.c +103 -103
- data/ext/nokolexbor/xml_string.c +93 -93
- data/ext/nokolexbor/xml_threads.c +61 -61
- data/ext/nokolexbor/xml_tree.c +12 -12
- data/ext/nokolexbor/xml_xpath.c +1194 -1203
- data/lib/nokolexbor/document.rb +92 -1
- data/lib/nokolexbor/node.rb +64 -0
- data/lib/nokolexbor/node_set.rb +6 -5
- data/lib/nokolexbor/version.rb +1 -1
- data/lib/nokolexbor.rb +21 -1
- data/patches/0001-lexbor-support-text-pseudo-element.patch +1 -1
- metadata +7 -4
data/ext/nokolexbor/xml_buf.c
CHANGED
@@ -92,7 +92,7 @@ struct _xmlBuf {
|
|
92
92
|
static void
|
93
93
|
xmlBufMemoryError(xmlBufPtr buf, const char *extra)
|
94
94
|
{
|
95
|
-
|
95
|
+
__nl_xmlSimpleError(XML_FROM_BUFFER, XML_ERR_NO_MEMORY, NULL, NULL, extra);
|
96
96
|
if ((buf) && (buf->error == 0))
|
97
97
|
buf->error = XML_ERR_NO_MEMORY;
|
98
98
|
}
|
@@ -107,7 +107,7 @@ xmlBufPtr
|
|
107
107
|
xmlBufCreate(void) {
|
108
108
|
xmlBufPtr ret;
|
109
109
|
|
110
|
-
ret = (xmlBufPtr)
|
110
|
+
ret = (xmlBufPtr) nl_xmlMalloc(sizeof(xmlBuf));
|
111
111
|
if (ret == NULL) {
|
112
112
|
xmlBufMemoryError(NULL, "creating buffer");
|
113
113
|
return(NULL);
|
@@ -115,13 +115,13 @@ xmlBufCreate(void) {
|
|
115
115
|
ret->use = 0;
|
116
116
|
ret->error = 0;
|
117
117
|
ret->buffer = NULL;
|
118
|
-
ret->size =
|
118
|
+
ret->size = nl_xmlDefaultBufferSize;
|
119
119
|
UPDATE_COMPAT(ret);
|
120
|
-
ret->alloc =
|
121
|
-
ret->content = (xmlChar *)
|
120
|
+
ret->alloc = nl_xmlBufferAllocScheme;
|
121
|
+
ret->content = (xmlChar *) nl_xmlMallocAtomic(ret->size);
|
122
122
|
if (ret->content == NULL) {
|
123
123
|
xmlBufMemoryError(ret, "creating buffer");
|
124
|
-
|
124
|
+
nl_xmlFree(ret);
|
125
125
|
return(NULL);
|
126
126
|
}
|
127
127
|
ret->content[0] = 0;
|
@@ -140,7 +140,7 @@ void
|
|
140
140
|
xmlBufFree(xmlBufPtr buf) {
|
141
141
|
if (buf == NULL) {
|
142
142
|
#ifdef DEBUG_BUFFER
|
143
|
-
|
143
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
144
144
|
"xmlBufFree: buf == NULL\n");
|
145
145
|
#endif
|
146
146
|
return;
|
@@ -148,15 +148,15 @@ xmlBufFree(xmlBufPtr buf) {
|
|
148
148
|
|
149
149
|
if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
|
150
150
|
(buf->contentIO != NULL)) {
|
151
|
-
|
151
|
+
nl_xmlFree(buf->contentIO);
|
152
152
|
} else if (buf->content != NULL) {
|
153
|
-
|
153
|
+
nl_xmlFree(buf->content);
|
154
154
|
}
|
155
|
-
|
155
|
+
nl_xmlFree(buf);
|
156
156
|
}
|
157
157
|
|
158
158
|
/**
|
159
|
-
*
|
159
|
+
* nl_xmlBufContent:
|
160
160
|
* @buf: the buffer
|
161
161
|
*
|
162
162
|
* Function to extract the content of a buffer
|
@@ -165,7 +165,7 @@ xmlBufFree(xmlBufPtr buf) {
|
|
165
165
|
*/
|
166
166
|
|
167
167
|
xmlChar *
|
168
|
-
|
168
|
+
nl_xmlBufContent(const xmlBuf *buf)
|
169
169
|
{
|
170
170
|
if ((!buf) || (buf->error))
|
171
171
|
return NULL;
|
@@ -258,7 +258,7 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
|
258
258
|
buf->content[buf->use] = 0;
|
259
259
|
buf->size += start_buf;
|
260
260
|
} else {
|
261
|
-
rebuf = (xmlChar *)
|
261
|
+
rebuf = (xmlChar *) nl_xmlRealloc(buf->contentIO, start_buf + newSize);
|
262
262
|
if (rebuf == NULL) {
|
263
263
|
xmlBufMemoryError(buf, "growing buffer");
|
264
264
|
return 0;
|
@@ -268,21 +268,21 @@ xmlBufResize(xmlBufPtr buf, size_t size)
|
|
268
268
|
}
|
269
269
|
} else {
|
270
270
|
if (buf->content == NULL) {
|
271
|
-
rebuf = (xmlChar *)
|
271
|
+
rebuf = (xmlChar *) nl_xmlMallocAtomic(newSize);
|
272
272
|
buf->use = 0;
|
273
273
|
rebuf[buf->use] = 0;
|
274
274
|
} else if (buf->size - buf->use < 100) {
|
275
|
-
rebuf = (xmlChar *)
|
275
|
+
rebuf = (xmlChar *) nl_xmlRealloc(buf->content, newSize);
|
276
276
|
} else {
|
277
277
|
/*
|
278
278
|
* if we are reallocating a buffer far from being full, it's
|
279
279
|
* better to make a new allocation and copy only the used range
|
280
280
|
* and free the old one.
|
281
281
|
*/
|
282
|
-
rebuf = (xmlChar *)
|
282
|
+
rebuf = (xmlChar *) nl_xmlMallocAtomic(newSize);
|
283
283
|
if (rebuf != NULL) {
|
284
284
|
memcpy(rebuf, buf->content, buf->use);
|
285
|
-
|
285
|
+
nl_xmlFree(buf->content);
|
286
286
|
rebuf[buf->use] = 0;
|
287
287
|
}
|
288
288
|
}
|
@@ -320,7 +320,7 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
|
|
320
320
|
|
321
321
|
if (len < -1) {
|
322
322
|
#ifdef DEBUG_BUFFER
|
323
|
-
|
323
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
324
324
|
"xmlBufAdd: len < 0\n");
|
325
325
|
#endif
|
326
326
|
return -1;
|
@@ -328,7 +328,7 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
|
|
328
328
|
if (len == 0) return 0;
|
329
329
|
|
330
330
|
if (len < 0)
|
331
|
-
len =
|
331
|
+
len = nl_xmlStrlen(str);
|
332
332
|
|
333
333
|
if (len < 0) return -1;
|
334
334
|
if (len == 0) return 0;
|
@@ -22,7 +22,7 @@
|
|
22
22
|
* allowed.
|
23
23
|
*
|
24
24
|
*/
|
25
|
-
const unsigned char
|
25
|
+
const unsigned char nl_xmlIsPubidChar_tab[256] = {
|
26
26
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
27
27
|
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
28
28
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
|
@@ -96,13 +96,13 @@ static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131},
|
|
96
96
|
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
97
97
|
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
|
98
98
|
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
|
99
|
-
const xmlChRangeGroup
|
99
|
+
const xmlChRangeGroup nl_xmlIsBaseCharGroup =
|
100
100
|
{197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
|
101
101
|
|
102
102
|
static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff},
|
103
103
|
{0xe000, 0xfffd}};
|
104
104
|
static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
|
105
|
-
const xmlChRangeGroup
|
105
|
+
const xmlChRangeGroup nl_xmlIsCharGroup =
|
106
106
|
{2, 1, xmlIsChar_srng, xmlIsChar_lrng};
|
107
107
|
|
108
108
|
static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
|
@@ -130,7 +130,7 @@ static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
|
|
130
130
|
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
|
131
131
|
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
|
132
132
|
{0x3099, 0x3099}, {0x309a, 0x309a}};
|
133
|
-
const xmlChRangeGroup
|
133
|
+
const xmlChRangeGroup nl_xmlIsCombiningGroup =
|
134
134
|
{95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
|
135
135
|
|
136
136
|
static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
|
@@ -138,24 +138,24 @@ static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
|
|
138
138
|
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
139
139
|
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
140
140
|
{0xf20, 0xf29}};
|
141
|
-
const xmlChRangeGroup
|
141
|
+
const xmlChRangeGroup nl_xmlIsDigitGroup =
|
142
142
|
{14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
|
143
143
|
|
144
144
|
static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0},
|
145
145
|
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
|
146
146
|
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
|
147
147
|
{0x30fc, 0x30fe}};
|
148
|
-
const xmlChRangeGroup
|
148
|
+
const xmlChRangeGroup nl_xmlIsExtenderGroup =
|
149
149
|
{10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
|
150
150
|
|
151
151
|
static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
|
152
152
|
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
|
153
|
-
const xmlChRangeGroup
|
153
|
+
const xmlChRangeGroup nl_xmlIsIdeographicGroup =
|
154
154
|
{3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
|
155
155
|
|
156
156
|
|
157
157
|
/**
|
158
|
-
*
|
158
|
+
* nl_xmlCharInRange:
|
159
159
|
* @val: character to be validated
|
160
160
|
* @rptr: pointer to range to be used to validate
|
161
161
|
*
|
@@ -165,7 +165,7 @@ const xmlChRangeGroup xmlIsIdeographicGroup =
|
|
165
165
|
* Returns: true if character valid, false otherwise
|
166
166
|
*/
|
167
167
|
int
|
168
|
-
|
168
|
+
nl_xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
169
169
|
int low, high, mid;
|
170
170
|
const xmlChSRange *sptr;
|
171
171
|
const xmlChLRange *lptr;
|
@@ -214,7 +214,7 @@ xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
|
214
214
|
|
215
215
|
|
216
216
|
/**
|
217
|
-
*
|
217
|
+
* nl_xmlIsBaseChar:
|
218
218
|
* @ch: character to validate
|
219
219
|
*
|
220
220
|
* This function is DEPRECATED.
|
@@ -223,13 +223,13 @@ xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
|
223
223
|
* Returns true if argument valid, false otherwise
|
224
224
|
*/
|
225
225
|
int
|
226
|
-
|
226
|
+
nl_xmlIsBaseChar(unsigned int ch) {
|
227
227
|
return(xmlIsBaseCharQ(ch));
|
228
228
|
}
|
229
229
|
|
230
230
|
|
231
231
|
/**
|
232
|
-
*
|
232
|
+
* nl_xmlIsBlank:
|
233
233
|
* @ch: character to validate
|
234
234
|
*
|
235
235
|
* This function is DEPRECATED.
|
@@ -238,13 +238,13 @@ xmlIsBaseChar(unsigned int ch) {
|
|
238
238
|
* Returns true if argument valid, false otherwise
|
239
239
|
*/
|
240
240
|
int
|
241
|
-
|
241
|
+
nl_xmlIsBlank(unsigned int ch) {
|
242
242
|
return(xmlIsBlankQ(ch));
|
243
243
|
}
|
244
244
|
|
245
245
|
|
246
246
|
/**
|
247
|
-
*
|
247
|
+
* nl_xmlIsChar:
|
248
248
|
* @ch: character to validate
|
249
249
|
*
|
250
250
|
* This function is DEPRECATED.
|
@@ -253,13 +253,13 @@ xmlIsBlank(unsigned int ch) {
|
|
253
253
|
* Returns true if argument valid, false otherwise
|
254
254
|
*/
|
255
255
|
int
|
256
|
-
|
256
|
+
nl_xmlIsChar(unsigned int ch) {
|
257
257
|
return(xmlIsCharQ(ch));
|
258
258
|
}
|
259
259
|
|
260
260
|
|
261
261
|
/**
|
262
|
-
*
|
262
|
+
* nl_xmlIsCombining:
|
263
263
|
* @ch: character to validate
|
264
264
|
*
|
265
265
|
* This function is DEPRECATED.
|
@@ -268,13 +268,13 @@ xmlIsChar(unsigned int ch) {
|
|
268
268
|
* Returns true if argument valid, false otherwise
|
269
269
|
*/
|
270
270
|
int
|
271
|
-
|
271
|
+
nl_xmlIsCombining(unsigned int ch) {
|
272
272
|
return(xmlIsCombiningQ(ch));
|
273
273
|
}
|
274
274
|
|
275
275
|
|
276
276
|
/**
|
277
|
-
*
|
277
|
+
* nl_xmlIsDigit:
|
278
278
|
* @ch: character to validate
|
279
279
|
*
|
280
280
|
* This function is DEPRECATED.
|
@@ -283,13 +283,13 @@ xmlIsCombining(unsigned int ch) {
|
|
283
283
|
* Returns true if argument valid, false otherwise
|
284
284
|
*/
|
285
285
|
int
|
286
|
-
|
286
|
+
nl_xmlIsDigit(unsigned int ch) {
|
287
287
|
return(xmlIsDigitQ(ch));
|
288
288
|
}
|
289
289
|
|
290
290
|
|
291
291
|
/**
|
292
|
-
*
|
292
|
+
* nl_xmlIsExtender:
|
293
293
|
* @ch: character to validate
|
294
294
|
*
|
295
295
|
* This function is DEPRECATED.
|
@@ -298,13 +298,13 @@ xmlIsDigit(unsigned int ch) {
|
|
298
298
|
* Returns true if argument valid, false otherwise
|
299
299
|
*/
|
300
300
|
int
|
301
|
-
|
301
|
+
nl_xmlIsExtender(unsigned int ch) {
|
302
302
|
return(xmlIsExtenderQ(ch));
|
303
303
|
}
|
304
304
|
|
305
305
|
|
306
306
|
/**
|
307
|
-
*
|
307
|
+
* nl_xmlIsIdeographic:
|
308
308
|
* @ch: character to validate
|
309
309
|
*
|
310
310
|
* This function is DEPRECATED.
|
@@ -313,13 +313,13 @@ xmlIsExtender(unsigned int ch) {
|
|
313
313
|
* Returns true if argument valid, false otherwise
|
314
314
|
*/
|
315
315
|
int
|
316
|
-
|
316
|
+
nl_xmlIsIdeographic(unsigned int ch) {
|
317
317
|
return(xmlIsIdeographicQ(ch));
|
318
318
|
}
|
319
319
|
|
320
320
|
|
321
321
|
/**
|
322
|
-
*
|
322
|
+
* nl_xmlIsPubidChar:
|
323
323
|
* @ch: character to validate
|
324
324
|
*
|
325
325
|
* This function is DEPRECATED.
|
@@ -328,7 +328,7 @@ xmlIsIdeographic(unsigned int ch) {
|
|
328
328
|
* Returns true if argument valid, false otherwise
|
329
329
|
*/
|
330
330
|
int
|
331
|
-
|
331
|
+
nl_xmlIsPubidChar(unsigned int ch) {
|
332
332
|
return(xmlIsPubidCharQ(ch));
|
333
333
|
}
|
334
334
|
|