nokolexbor 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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_memory.c
CHANGED
@@ -48,14 +48,14 @@ void xmlMallocBreakpoint(void);
|
|
48
48
|
************************************************************************/
|
49
49
|
|
50
50
|
#if !defined(LIBXML_THREAD_ENABLED) && !defined(LIBXML_THREAD_ALLOC_ENABLED)
|
51
|
-
#ifdef
|
52
|
-
#undef
|
51
|
+
#ifdef nl_xmlMalloc
|
52
|
+
#undef nl_xmlMalloc
|
53
53
|
#endif
|
54
|
-
#ifdef
|
55
|
-
#undef
|
54
|
+
#ifdef nl_xmlRealloc
|
55
|
+
#undef nl_xmlRealloc
|
56
56
|
#endif
|
57
|
-
#ifdef
|
58
|
-
#undef
|
57
|
+
#ifdef nl_xmlMemStrdup
|
58
|
+
#undef nl_xmlMemStrdup
|
59
59
|
#endif
|
60
60
|
#endif
|
61
61
|
|
@@ -119,13 +119,13 @@ static void debugmem_list_delete(MEMHDR *);
|
|
119
119
|
#endif
|
120
120
|
|
121
121
|
/**
|
122
|
-
*
|
122
|
+
* nl_xmlInitMemory:
|
123
123
|
*
|
124
|
-
* DEPRECATED: Alias for
|
124
|
+
* DEPRECATED: Alias for nl_xmlInitParser.
|
125
125
|
*/
|
126
126
|
int
|
127
|
-
|
128
|
-
|
127
|
+
nl_xmlInitMemory(void) {
|
128
|
+
nl_xmlInitParser();
|
129
129
|
return(0);
|
130
130
|
}
|
131
131
|
|
@@ -140,8 +140,8 @@ void
|
|
140
140
|
xmlInitMemoryInternal(void) {
|
141
141
|
char *breakpoint;
|
142
142
|
#ifdef DEBUG_MEMORY
|
143
|
-
|
144
|
-
"
|
143
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
144
|
+
"nl_xmlInitMemory()\n");
|
145
145
|
#endif
|
146
146
|
xmlInitMutex(&xmlMemMutex);
|
147
147
|
|
@@ -155,13 +155,13 @@ xmlInitMemoryInternal(void) {
|
|
155
155
|
}
|
156
156
|
|
157
157
|
#ifdef DEBUG_MEMORY
|
158
|
-
|
159
|
-
"
|
158
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
159
|
+
"nl_xmlInitMemory() Ok\n");
|
160
160
|
#endif
|
161
161
|
}
|
162
162
|
|
163
163
|
/**
|
164
|
-
*
|
164
|
+
* nl_xmlMemSetup:
|
165
165
|
* @freeFunc: the free() function to use
|
166
166
|
* @mallocFunc: the malloc() function to use
|
167
167
|
* @reallocFunc: the realloc() function to use
|
@@ -176,11 +176,11 @@ xmlInitMemoryInternal(void) {
|
|
176
176
|
* Returns 0 on success
|
177
177
|
*/
|
178
178
|
int
|
179
|
-
|
179
|
+
nl_xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
|
180
180
|
xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) {
|
181
181
|
#ifdef DEBUG_MEMORY
|
182
|
-
|
183
|
-
"
|
182
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
183
|
+
"nl_xmlMemSetup()\n");
|
184
184
|
#endif
|
185
185
|
if (freeFunc == NULL)
|
186
186
|
return(-1);
|
@@ -190,14 +190,14 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc,
|
|
190
190
|
return(-1);
|
191
191
|
if (strdupFunc == NULL)
|
192
192
|
return(-1);
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
193
|
+
nl_xmlFree = freeFunc;
|
194
|
+
nl_xmlMalloc = mallocFunc;
|
195
|
+
nl_xmlMallocAtomic = mallocFunc;
|
196
|
+
nl_xmlRealloc = reallocFunc;
|
197
|
+
nl_xmlMemStrdup = strdupFunc;
|
198
198
|
#ifdef DEBUG_MEMORY
|
199
|
-
|
200
|
-
"
|
199
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
200
|
+
"nl_xmlMemSetup() Ok\n");
|
201
201
|
#endif
|
202
202
|
return(0);
|
203
203
|
}
|
data/ext/nokolexbor/xml_parser.c
CHANGED
@@ -83,7 +83,7 @@
|
|
83
83
|
static int xmlParserInitialized = 0;
|
84
84
|
|
85
85
|
/**
|
86
|
-
*
|
86
|
+
* nl_xmlInitParser:
|
87
87
|
*
|
88
88
|
* Initialization function for the XML parser.
|
89
89
|
* This is not reentrant. Call once before processing in case of
|
@@ -91,7 +91,7 @@ static int xmlParserInitialized = 0;
|
|
91
91
|
*/
|
92
92
|
|
93
93
|
void
|
94
|
-
|
94
|
+
nl_xmlInitParser(void) {
|
95
95
|
/*
|
96
96
|
* Note that the initialization code must not make memory allocations.
|
97
97
|
*/
|
@@ -103,7 +103,7 @@ xmlInitParser(void) {
|
|
103
103
|
if (xmlParserInitialized == 0) {
|
104
104
|
#endif
|
105
105
|
#if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
|
106
|
-
if (
|
106
|
+
if (nl_xmlFree == free)
|
107
107
|
atexit(xmlCleanupParser);
|
108
108
|
#endif
|
109
109
|
|
@@ -53,12 +53,12 @@ xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
|
|
53
53
|
ctxt->disableSAX = 1;
|
54
54
|
}
|
55
55
|
if (extra)
|
56
|
-
|
56
|
+
__nl_xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
|
57
57
|
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra,
|
58
58
|
NULL, NULL, 0, 0,
|
59
59
|
"Memory allocation failed : %s\n", extra);
|
60
60
|
else
|
61
|
-
|
61
|
+
__nl_xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
|
62
62
|
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL,
|
63
63
|
NULL, NULL, 0, 0, "Memory allocation failed\n");
|
64
64
|
}
|
@@ -82,7 +82,7 @@ __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
|
|
82
82
|
return;
|
83
83
|
if (ctxt != NULL)
|
84
84
|
ctxt->errNo = xmlerr;
|
85
|
-
|
85
|
+
__nl_xmlRaiseError(NULL, NULL, NULL,
|
86
86
|
ctxt, NULL, XML_FROM_PARSER, xmlerr, XML_ERR_FATAL,
|
87
87
|
NULL, 0, (const char *) str1, (const char *) str2,
|
88
88
|
NULL, 0, 0, msg, str1, str2);
|
@@ -109,7 +109,7 @@ xmlErrInternal(xmlParserCtxtPtr ctxt, const char *msg, const xmlChar * str)
|
|
109
109
|
return;
|
110
110
|
if (ctxt != NULL)
|
111
111
|
ctxt->errNo = XML_ERR_INTERNAL_ERROR;
|
112
|
-
|
112
|
+
__nl_xmlRaiseError(NULL, NULL, NULL,
|
113
113
|
ctxt, NULL, XML_FROM_PARSER, XML_ERR_INTERNAL_ERROR,
|
114
114
|
XML_ERR_FATAL, NULL, 0, (const char *) str, NULL, NULL,
|
115
115
|
0, 0, msg, str);
|
@@ -138,7 +138,7 @@ xmlErrEncodingInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|
138
138
|
return;
|
139
139
|
if (ctxt != NULL)
|
140
140
|
ctxt->errNo = error;
|
141
|
-
|
141
|
+
__nl_xmlRaiseError(NULL, NULL, NULL,
|
142
142
|
ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL,
|
143
143
|
NULL, 0, NULL, NULL, NULL, val, 0, msg, val);
|
144
144
|
if (ctxt != NULL) {
|
@@ -149,7 +149,7 @@ xmlErrEncodingInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|
149
149
|
}
|
150
150
|
|
151
151
|
/**
|
152
|
-
*
|
152
|
+
* nl_xmlIsLetter:
|
153
153
|
* @c: an unicode character (int)
|
154
154
|
*
|
155
155
|
* Check whether the character is allowed by the production
|
@@ -158,12 +158,12 @@ xmlErrEncodingInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|
158
158
|
* Returns 0 if not, non-zero otherwise
|
159
159
|
*/
|
160
160
|
int
|
161
|
-
|
161
|
+
nl_xmlIsLetter(int c) {
|
162
162
|
return(IS_BASECHAR(c) || IS_IDEOGRAPHIC(c));
|
163
163
|
}
|
164
164
|
|
165
165
|
/**
|
166
|
-
*
|
166
|
+
* nl_xmlCopyCharMultiByte:
|
167
167
|
* @out: pointer to an array of xmlChar
|
168
168
|
* @val: the char value
|
169
169
|
*
|
@@ -172,7 +172,7 @@ xmlIsLetter(int c) {
|
|
172
172
|
* Returns the number of xmlChar written
|
173
173
|
*/
|
174
174
|
int
|
175
|
-
|
175
|
+
nl_xmlCopyCharMultiByte(xmlChar *out, int val) {
|
176
176
|
if ((out == NULL) || (val < 0)) return(0);
|
177
177
|
/*
|
178
178
|
* We are supposed to handle UTF8, check it's valid
|
@@ -191,7 +191,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
|
|
191
191
|
else if (val < 0x110000) { *out++= (val >> 18) | 0xF0; bits= 12; }
|
192
192
|
else {
|
193
193
|
xmlErrEncodingInt(NULL, XML_ERR_INVALID_CHAR,
|
194
|
-
"Internal error,
|
194
|
+
"Internal error, nl_xmlCopyCharMultiByte 0x%X out of bound\n",
|
195
195
|
val);
|
196
196
|
return(0);
|
197
197
|
}
|
@@ -204,7 +204,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
|
|
204
204
|
}
|
205
205
|
|
206
206
|
/**
|
207
|
-
*
|
207
|
+
* nl_xmlCopyChar:
|
208
208
|
* @len: Ignored, compatibility
|
209
209
|
* @out: pointer to an array of xmlChar
|
210
210
|
* @val: the char value
|
@@ -215,18 +215,18 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
|
|
215
215
|
*/
|
216
216
|
|
217
217
|
int
|
218
|
-
|
218
|
+
nl_xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
|
219
219
|
if ((out == NULL) || (val < 0)) return(0);
|
220
220
|
/* the len parameter is ignored */
|
221
221
|
if (val >= 0x80) {
|
222
|
-
return(
|
222
|
+
return(nl_xmlCopyCharMultiByte (out, val));
|
223
223
|
}
|
224
224
|
*out = val;
|
225
225
|
return 1;
|
226
226
|
}
|
227
227
|
|
228
228
|
/**
|
229
|
-
*
|
229
|
+
* nl_xmlStringCurrentChar:
|
230
230
|
* @ctxt: the XML parser context
|
231
231
|
* @cur: pointer to the beginning of the char
|
232
232
|
* @len: pointer to the length of the char read
|
@@ -238,7 +238,7 @@ xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
|
|
238
238
|
*/
|
239
239
|
|
240
240
|
int
|
241
|
-
|
241
|
+
nl_xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
|
242
242
|
{
|
243
243
|
if ((len == NULL) || (cur == NULL)) return(0);
|
244
244
|
if ((ctxt == NULL) || (ctxt->charset == XML_CHAR_ENCODING_UTF8)) {
|