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
@@ -39,7 +39,7 @@ extern "C" {
|
|
39
39
|
* Raises an error.
|
40
40
|
*/
|
41
41
|
#define xmlXPathSetError(ctxt, err) \
|
42
|
-
{
|
42
|
+
{ nl_xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
|
43
43
|
if ((ctxt) != NULL) (ctxt)->error = (err); }
|
44
44
|
|
45
45
|
/**
|
@@ -101,15 +101,15 @@ extern "C" {
|
|
101
101
|
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
|
102
102
|
|
103
103
|
XMLPUBFUN int XMLCALL
|
104
|
-
|
104
|
+
nl_xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
|
105
105
|
XMLPUBFUN double XMLCALL
|
106
|
-
|
106
|
+
nl_xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
|
107
107
|
XMLPUBFUN xmlChar * XMLCALL
|
108
|
-
|
108
|
+
nl_xmlXPathPopString (xmlXPathParserContextPtr ctxt);
|
109
109
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
110
|
-
|
110
|
+
nl_xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
|
111
111
|
XMLPUBFUN void * XMLCALL
|
112
|
-
|
112
|
+
nl_xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
|
113
113
|
|
114
114
|
/**
|
115
115
|
* xmlXPathReturnBoolean:
|
@@ -119,7 +119,7 @@ XMLPUBFUN void * XMLCALL
|
|
119
119
|
* Pushes the boolean @val on the context stack.
|
120
120
|
*/
|
121
121
|
#define xmlXPathReturnBoolean(ctxt, val) \
|
122
|
-
valuePush((ctxt),
|
122
|
+
valuePush((ctxt), nl_xmlXPathNewBoolean(val))
|
123
123
|
|
124
124
|
/**
|
125
125
|
* xmlXPathReturnTrue:
|
@@ -145,7 +145,7 @@ XMLPUBFUN void * XMLCALL
|
|
145
145
|
* Pushes the double @val on the context stack.
|
146
146
|
*/
|
147
147
|
#define xmlXPathReturnNumber(ctxt, val) \
|
148
|
-
valuePush((ctxt),
|
148
|
+
valuePush((ctxt), nl_xmlXPathNewFloat(val))
|
149
149
|
|
150
150
|
/**
|
151
151
|
* xmlXPathReturnString:
|
@@ -155,7 +155,7 @@ XMLPUBFUN void * XMLCALL
|
|
155
155
|
* Pushes the string @str on the context stack.
|
156
156
|
*/
|
157
157
|
#define xmlXPathReturnString(ctxt, str) \
|
158
|
-
valuePush((ctxt),
|
158
|
+
valuePush((ctxt), nl_xmlXPathWrapString(str))
|
159
159
|
|
160
160
|
/**
|
161
161
|
* xmlXPathReturnEmptyString:
|
@@ -164,7 +164,7 @@ XMLPUBFUN void * XMLCALL
|
|
164
164
|
* Pushes an empty string on the stack.
|
165
165
|
*/
|
166
166
|
#define xmlXPathReturnEmptyString(ctxt) \
|
167
|
-
valuePush((ctxt),
|
167
|
+
valuePush((ctxt), nl_xmlXPathNewCString(""))
|
168
168
|
|
169
169
|
/**
|
170
170
|
* xmlXPathReturnNodeSet:
|
@@ -174,7 +174,7 @@ XMLPUBFUN void * XMLCALL
|
|
174
174
|
* Pushes the node-set @ns on the context stack.
|
175
175
|
*/
|
176
176
|
#define xmlXPathReturnNodeSet(ctxt, ns) \
|
177
|
-
valuePush((ctxt),
|
177
|
+
valuePush((ctxt), nl_xmlXPathWrapNodeSet(ns))
|
178
178
|
|
179
179
|
/**
|
180
180
|
* xmlXPathReturnEmptyNodeSet:
|
@@ -183,7 +183,7 @@ XMLPUBFUN void * XMLCALL
|
|
183
183
|
* Pushes an empty node-set on the context stack.
|
184
184
|
*/
|
185
185
|
#define xmlXPathReturnEmptyNodeSet(ctxt) \
|
186
|
-
valuePush((ctxt),
|
186
|
+
valuePush((ctxt), nl_xmlXPathNewNodeSet(NULL))
|
187
187
|
|
188
188
|
/**
|
189
189
|
* xmlXPathReturnExternal:
|
@@ -193,7 +193,7 @@ XMLPUBFUN void * XMLCALL
|
|
193
193
|
* Pushes user data on the context stack.
|
194
194
|
*/
|
195
195
|
#define xmlXPathReturnExternal(ctxt, val) \
|
196
|
-
valuePush((ctxt),
|
196
|
+
valuePush((ctxt), nl_xmlXPathWrapExternal(val))
|
197
197
|
|
198
198
|
/**
|
199
199
|
* xmlXPathStackIsNodeSet:
|
@@ -254,7 +254,7 @@ XMLPUBFUN void * XMLCALL
|
|
254
254
|
* Macro to raise an XPath error and return.
|
255
255
|
*/
|
256
256
|
#define XP_ERROR(X) \
|
257
|
-
{
|
257
|
+
{ nl_xmlXPathErr(ctxt, X); return; }
|
258
258
|
|
259
259
|
/**
|
260
260
|
* XP_ERROR0:
|
@@ -263,7 +263,7 @@ XMLPUBFUN void * XMLCALL
|
|
263
263
|
* Macro to raise an XPath error and return 0.
|
264
264
|
*/
|
265
265
|
#define XP_ERROR0(X) \
|
266
|
-
{
|
266
|
+
{ nl_xmlXPathErr(ctxt, X); return(0); }
|
267
267
|
|
268
268
|
/**
|
269
269
|
* CHECK_TYPE:
|
@@ -307,7 +307,7 @@ XMLPUBFUN void * XMLCALL
|
|
307
307
|
*/
|
308
308
|
#define CAST_TO_STRING \
|
309
309
|
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
|
310
|
-
|
310
|
+
nl_xmlXPathStringFunction(ctxt, 1);
|
311
311
|
|
312
312
|
/**
|
313
313
|
* CAST_TO_NUMBER:
|
@@ -316,7 +316,7 @@ XMLPUBFUN void * XMLCALL
|
|
316
316
|
*/
|
317
317
|
#define CAST_TO_NUMBER \
|
318
318
|
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
|
319
|
-
|
319
|
+
nl_xmlXPathNumberFunction(ctxt, 1);
|
320
320
|
|
321
321
|
/**
|
322
322
|
* CAST_TO_BOOLEAN:
|
@@ -325,14 +325,14 @@ XMLPUBFUN void * XMLCALL
|
|
325
325
|
*/
|
326
326
|
#define CAST_TO_BOOLEAN \
|
327
327
|
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
|
328
|
-
|
328
|
+
nl_xmlXPathBooleanFunction(ctxt, 1);
|
329
329
|
|
330
330
|
/*
|
331
331
|
* Variable Lookup forwarding.
|
332
332
|
*/
|
333
333
|
|
334
334
|
XMLPUBFUN void XMLCALL
|
335
|
-
|
335
|
+
nl_xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
|
336
336
|
xmlXPathVariableLookupFunc f,
|
337
337
|
void *data);
|
338
338
|
|
@@ -341,7 +341,7 @@ XMLPUBFUN void XMLCALL
|
|
341
341
|
*/
|
342
342
|
|
343
343
|
XMLPUBFUN void XMLCALL
|
344
|
-
|
344
|
+
nl_xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
|
345
345
|
xmlXPathFuncLookupFunc f,
|
346
346
|
void *funcCtxt);
|
347
347
|
|
@@ -349,13 +349,13 @@ XMLPUBFUN void XMLCALL
|
|
349
349
|
* Error reporting.
|
350
350
|
*/
|
351
351
|
XMLPUBFUN void XMLCALL
|
352
|
-
|
352
|
+
nl_xmlXPatherror (xmlXPathParserContextPtr ctxt,
|
353
353
|
const char *file,
|
354
354
|
int line,
|
355
355
|
int no);
|
356
356
|
|
357
357
|
XMLPUBFUN void XMLCALL
|
358
|
-
|
358
|
+
nl_xmlXPathErr (xmlXPathParserContextPtr ctxt,
|
359
359
|
int error);
|
360
360
|
|
361
361
|
#ifdef LIBXML_DEBUG_ENABLED
|
@@ -372,48 +372,48 @@ XMLPUBFUN void XMLCALL
|
|
372
372
|
* NodeSet handling.
|
373
373
|
*/
|
374
374
|
XMLPUBFUN int XMLCALL
|
375
|
-
|
375
|
+
nl_xmlXPathNodeSetContains (xmlNodeSetPtr cur,
|
376
376
|
lxb_dom_node_t_ptr val);
|
377
377
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
378
|
-
|
378
|
+
nl_xmlXPathDifference (xmlNodeSetPtr nodes1,
|
379
379
|
xmlNodeSetPtr nodes2);
|
380
380
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
381
|
-
|
381
|
+
nl_xmlXPathIntersection (xmlNodeSetPtr nodes1,
|
382
382
|
xmlNodeSetPtr nodes2);
|
383
383
|
|
384
384
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
385
|
-
|
385
|
+
nl_xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
|
386
386
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
387
|
-
|
387
|
+
nl_xmlXPathDistinct (xmlNodeSetPtr nodes);
|
388
388
|
|
389
389
|
XMLPUBFUN int XMLCALL
|
390
|
-
|
390
|
+
nl_xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
|
391
391
|
xmlNodeSetPtr nodes2);
|
392
392
|
|
393
393
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
394
|
-
|
394
|
+
nl_xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
|
395
395
|
lxb_dom_node_t_ptr node);
|
396
396
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
397
|
-
|
397
|
+
nl_xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
|
398
398
|
xmlNodeSetPtr nodes2);
|
399
399
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
400
|
-
|
400
|
+
nl_xmlXPathNodeLeading (xmlNodeSetPtr nodes,
|
401
401
|
lxb_dom_node_t_ptr node);
|
402
402
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
403
|
-
|
403
|
+
nl_xmlXPathLeading (xmlNodeSetPtr nodes1,
|
404
404
|
xmlNodeSetPtr nodes2);
|
405
405
|
|
406
406
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
407
|
-
|
407
|
+
nl_xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
|
408
408
|
lxb_dom_node_t_ptr node);
|
409
409
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
410
|
-
|
410
|
+
nl_xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
|
411
411
|
xmlNodeSetPtr nodes2);
|
412
412
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
413
|
-
|
413
|
+
nl_xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
|
414
414
|
lxb_dom_node_t_ptr node);
|
415
415
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
416
|
-
|
416
|
+
nl_xmlXPathTrailing (xmlNodeSetPtr nodes1,
|
417
417
|
xmlNodeSetPtr nodes2);
|
418
418
|
|
419
419
|
|
@@ -422,207 +422,207 @@ XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
422
422
|
*/
|
423
423
|
|
424
424
|
XMLPUBFUN int XMLCALL
|
425
|
-
|
425
|
+
nl_xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
|
426
426
|
const xmlChar *prefix,
|
427
427
|
const xmlChar *ns_uri);
|
428
428
|
XMLPUBFUN const xmlChar * XMLCALL
|
429
|
-
|
429
|
+
nl_xmlXPathNsLookup (xmlXPathContextPtr ctxt,
|
430
430
|
const xmlChar *prefix);
|
431
431
|
XMLPUBFUN void XMLCALL
|
432
|
-
|
432
|
+
nl_xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
|
433
433
|
|
434
434
|
XMLPUBFUN int XMLCALL
|
435
|
-
|
435
|
+
nl_xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
|
436
436
|
const xmlChar *name,
|
437
437
|
xmlXPathFunction f);
|
438
438
|
XMLPUBFUN int XMLCALL
|
439
|
-
|
439
|
+
nl_xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
|
440
440
|
const xmlChar *name,
|
441
441
|
const xmlChar *ns_uri,
|
442
442
|
xmlXPathFunction f);
|
443
443
|
XMLPUBFUN int XMLCALL
|
444
|
-
|
444
|
+
nl_xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
|
445
445
|
const xmlChar *name,
|
446
446
|
xmlXPathObjectPtr value);
|
447
447
|
XMLPUBFUN int XMLCALL
|
448
|
-
|
448
|
+
nl_xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
|
449
449
|
const xmlChar *name,
|
450
450
|
const xmlChar *ns_uri,
|
451
451
|
xmlXPathObjectPtr value);
|
452
452
|
XMLPUBFUN xmlXPathFunction XMLCALL
|
453
|
-
|
453
|
+
nl_xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
|
454
454
|
const xmlChar *name);
|
455
455
|
XMLPUBFUN xmlXPathFunction XMLCALL
|
456
|
-
|
456
|
+
nl_xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
|
457
457
|
const xmlChar *name,
|
458
458
|
const xmlChar *ns_uri);
|
459
459
|
XMLPUBFUN void XMLCALL
|
460
|
-
|
460
|
+
nl_xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
|
461
461
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
462
|
-
|
462
|
+
nl_xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
|
463
463
|
const xmlChar *name);
|
464
464
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
465
|
-
|
465
|
+
nl_xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
|
466
466
|
const xmlChar *name,
|
467
467
|
const xmlChar *ns_uri);
|
468
468
|
XMLPUBFUN void XMLCALL
|
469
|
-
|
469
|
+
nl_xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
|
470
470
|
|
471
471
|
/**
|
472
472
|
* Utilities to extend XPath.
|
473
473
|
*/
|
474
474
|
XMLPUBFUN xmlXPathParserContextPtr XMLCALL
|
475
|
-
|
475
|
+
nl_xmlXPathNewParserContext (const xmlChar *str,
|
476
476
|
xmlXPathContextPtr ctxt);
|
477
477
|
XMLPUBFUN void XMLCALL
|
478
|
-
|
478
|
+
nl_xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
|
479
479
|
|
480
480
|
/* TODO: remap to xmlXPathValuePop and Push. */
|
481
|
-
|
481
|
+
static xmlXPathObjectPtr XMLCALL
|
482
482
|
valuePop (xmlXPathParserContextPtr ctxt);
|
483
|
-
|
483
|
+
static int XMLCALL
|
484
484
|
valuePush (xmlXPathParserContextPtr ctxt,
|
485
485
|
xmlXPathObjectPtr value);
|
486
486
|
|
487
487
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
488
|
-
|
488
|
+
nl_xmlXPathNewString (const xmlChar *val);
|
489
489
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
490
|
-
|
490
|
+
nl_xmlXPathNewCString (const char *val);
|
491
491
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
492
|
-
|
492
|
+
nl_xmlXPathWrapString (xmlChar *val);
|
493
493
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
494
|
-
|
494
|
+
nl_xmlXPathWrapCString (char * val);
|
495
495
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
496
|
-
|
496
|
+
nl_xmlXPathNewFloat (double val);
|
497
497
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
498
|
-
|
498
|
+
nl_xmlXPathNewBoolean (int val);
|
499
499
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
500
|
-
|
500
|
+
nl_xmlXPathNewNodeSet (lxb_dom_node_t_ptr val);
|
501
501
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
502
|
-
|
502
|
+
nl_xmlXPathNewValueTree (lxb_dom_node_t_ptr val);
|
503
503
|
XMLPUBFUN int XMLCALL
|
504
|
-
|
504
|
+
nl_xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
|
505
505
|
lxb_dom_node_t_ptr val);
|
506
506
|
XMLPUBFUN int XMLCALL
|
507
|
-
|
507
|
+
nl_xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
|
508
508
|
lxb_dom_node_t_ptr val);
|
509
509
|
XMLPUBFUN int XMLCALL
|
510
|
-
|
510
|
+
nl_xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
|
511
511
|
lxb_dom_node_t_ptr node,
|
512
512
|
xmlNsPtr ns);
|
513
513
|
XMLPUBFUN void XMLCALL
|
514
|
-
|
514
|
+
nl_xmlXPathNodeSetSort (xmlNodeSetPtr set);
|
515
515
|
|
516
516
|
XMLPUBFUN void XMLCALL
|
517
|
-
|
517
|
+
nl_xmlXPathRoot (xmlXPathParserContextPtr ctxt);
|
518
518
|
XMLPUBFUN void XMLCALL
|
519
|
-
|
519
|
+
nl_xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
|
520
520
|
XMLPUBFUN xmlChar * XMLCALL
|
521
|
-
|
521
|
+
nl_xmlXPathParseName (xmlXPathParserContextPtr ctxt);
|
522
522
|
XMLPUBFUN xmlChar * XMLCALL
|
523
|
-
|
523
|
+
nl_xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
|
524
524
|
|
525
525
|
/*
|
526
526
|
* Existing functions.
|
527
527
|
*/
|
528
528
|
XMLPUBFUN double XMLCALL
|
529
|
-
|
529
|
+
nl_xmlXPathStringEvalNumber (const xmlChar *str);
|
530
530
|
XMLPUBFUN int XMLCALL
|
531
|
-
|
531
|
+
nl_xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
|
532
532
|
xmlXPathObjectPtr res);
|
533
533
|
XMLPUBFUN void XMLCALL
|
534
|
-
|
534
|
+
nl_xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
|
535
535
|
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
536
|
-
|
536
|
+
nl_xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
|
537
537
|
xmlNodeSetPtr val2);
|
538
538
|
XMLPUBFUN void XMLCALL
|
539
|
-
|
539
|
+
nl_xmlXPathNodeSetDel (xmlNodeSetPtr cur,
|
540
540
|
lxb_dom_node_t_ptr val);
|
541
541
|
XMLPUBFUN void XMLCALL
|
542
|
-
|
542
|
+
nl_xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
|
543
543
|
int val);
|
544
544
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
545
|
-
|
545
|
+
nl_xmlXPathNewNodeSetList (xmlNodeSetPtr val);
|
546
546
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
547
|
-
|
547
|
+
nl_xmlXPathWrapNodeSet (xmlNodeSetPtr val);
|
548
548
|
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
549
|
-
|
549
|
+
nl_xmlXPathWrapExternal (void *val);
|
550
550
|
|
551
|
-
XMLPUBFUN int XMLCALL
|
552
|
-
XMLPUBFUN int XMLCALL
|
553
|
-
XMLPUBFUN int XMLCALL
|
554
|
-
XMLPUBFUN void XMLCALL
|
555
|
-
XMLPUBFUN void XMLCALL
|
556
|
-
XMLPUBFUN void XMLCALL
|
557
|
-
XMLPUBFUN void XMLCALL
|
558
|
-
XMLPUBFUN void XMLCALL
|
559
|
-
XMLPUBFUN void XMLCALL
|
551
|
+
XMLPUBFUN int XMLCALL nl_xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
|
552
|
+
XMLPUBFUN int XMLCALL nl_xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
|
553
|
+
XMLPUBFUN int XMLCALL nl_xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
|
554
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
|
555
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
|
556
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
|
557
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
|
558
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
|
559
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathModValues(xmlXPathParserContextPtr ctxt);
|
560
560
|
|
561
|
-
XMLPUBFUN int XMLCALL
|
561
|
+
XMLPUBFUN int XMLCALL nl_xmlXPathIsNodeType(const xmlChar *name);
|
562
562
|
|
563
563
|
/*
|
564
564
|
* Some of the axis navigation routines.
|
565
565
|
*/
|
566
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
566
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
|
567
567
|
lxb_dom_node_t_ptr cur);
|
568
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
568
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
|
569
569
|
lxb_dom_node_t_ptr cur);
|
570
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
570
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
|
571
571
|
lxb_dom_node_t_ptr cur);
|
572
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
572
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
|
573
573
|
lxb_dom_node_t_ptr cur);
|
574
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
574
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
|
575
575
|
lxb_dom_node_t_ptr cur);
|
576
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
576
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
|
577
577
|
lxb_dom_node_t_ptr cur);
|
578
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
578
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
|
579
579
|
lxb_dom_node_t_ptr cur);
|
580
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
580
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
|
581
581
|
lxb_dom_node_t_ptr cur);
|
582
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
582
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
|
583
583
|
lxb_dom_node_t_ptr cur);
|
584
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
584
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
|
585
585
|
lxb_dom_node_t_ptr cur);
|
586
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
586
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
|
587
587
|
lxb_dom_node_t_ptr cur);
|
588
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
588
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
|
589
589
|
lxb_dom_node_t_ptr cur);
|
590
|
-
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL
|
590
|
+
XMLPUBFUN lxb_dom_node_t_ptr XMLCALL nl_xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
|
591
591
|
lxb_dom_node_t_ptr cur);
|
592
592
|
/*
|
593
593
|
* The official core of XPath functions.
|
594
594
|
*/
|
595
|
-
XMLPUBFUN void XMLCALL
|
596
|
-
XMLPUBFUN void XMLCALL
|
597
|
-
XMLPUBFUN void XMLCALL
|
598
|
-
XMLPUBFUN void XMLCALL
|
599
|
-
XMLPUBFUN void XMLCALL
|
600
|
-
XMLPUBFUN void XMLCALL
|
601
|
-
XMLPUBFUN void XMLCALL
|
602
|
-
XMLPUBFUN void XMLCALL
|
603
|
-
XMLPUBFUN void XMLCALL
|
604
|
-
XMLPUBFUN void XMLCALL
|
605
|
-
XMLPUBFUN void XMLCALL
|
606
|
-
XMLPUBFUN void XMLCALL
|
607
|
-
XMLPUBFUN void XMLCALL
|
608
|
-
XMLPUBFUN void XMLCALL
|
609
|
-
XMLPUBFUN void XMLCALL
|
610
|
-
XMLPUBFUN void XMLCALL
|
611
|
-
XMLPUBFUN void XMLCALL
|
612
|
-
XMLPUBFUN void XMLCALL
|
613
|
-
XMLPUBFUN void XMLCALL
|
614
|
-
XMLPUBFUN void XMLCALL
|
615
|
-
XMLPUBFUN void XMLCALL
|
616
|
-
XMLPUBFUN void XMLCALL
|
617
|
-
XMLPUBFUN void XMLCALL
|
618
|
-
XMLPUBFUN void XMLCALL
|
619
|
-
XMLPUBFUN void XMLCALL
|
620
|
-
XMLPUBFUN void XMLCALL
|
595
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
596
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
597
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
598
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
599
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
600
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
601
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
602
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
603
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
604
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
605
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
606
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
607
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
608
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
609
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
610
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
611
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
612
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
613
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
614
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
615
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
616
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
617
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
618
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
619
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
620
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
621
621
|
|
622
622
|
/**
|
623
623
|
* Really internal functions
|
624
624
|
*/
|
625
|
-
XMLPUBFUN void XMLCALL
|
625
|
+
XMLPUBFUN void XMLCALL nl_xmlXPathNodeSetFreeNs(xmlNsPtr ns);
|
626
626
|
|
627
627
|
#ifdef __cplusplus
|
628
628
|
}
|
data/ext/nokolexbor/memory.c
CHANGED
@@ -10,8 +10,8 @@
|
|
10
10
|
* of more frequent GC.
|
11
11
|
*/
|
12
12
|
|
13
|
-
#include <ruby.h>
|
14
13
|
#include "lexbor/core/base.h"
|
14
|
+
#include <ruby.h>
|
15
15
|
|
16
16
|
// Disable using ruby memory functions when ASAN is enabled,
|
17
17
|
// otherwise memory leak info will be all about ruby which
|
@@ -21,26 +21,26 @@
|
|
21
21
|
void *
|
22
22
|
lexbor_malloc(size_t size)
|
23
23
|
{
|
24
|
-
|
24
|
+
return ruby_xmalloc(size);
|
25
25
|
}
|
26
26
|
|
27
27
|
void *
|
28
28
|
lexbor_realloc(void *dst, size_t size)
|
29
29
|
{
|
30
|
-
|
30
|
+
return ruby_xrealloc(dst, size);
|
31
31
|
}
|
32
32
|
|
33
33
|
void *
|
34
34
|
lexbor_calloc(size_t num, size_t size)
|
35
35
|
{
|
36
|
-
|
36
|
+
return ruby_xcalloc(num, size);
|
37
37
|
}
|
38
38
|
|
39
39
|
void *
|
40
40
|
lexbor_free(void *dst)
|
41
41
|
{
|
42
|
-
|
43
|
-
|
42
|
+
ruby_xfree(dst);
|
43
|
+
return NULL;
|
44
44
|
}
|
45
45
|
|
46
46
|
#endif
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#include "nokolexbor.h"
|
2
|
+
|
3
|
+
VALUE cNokolexborCData;
|
4
|
+
extern VALUE cNokolexborText;
|
5
|
+
extern VALUE mNokolexbor;
|
6
|
+
|
7
|
+
static VALUE
|
8
|
+
nl_cdata_new(int argc, VALUE *argv, VALUE klass)
|
9
|
+
{
|
10
|
+
lxb_dom_document_t *document;
|
11
|
+
VALUE rb_content;
|
12
|
+
VALUE rb_document;
|
13
|
+
VALUE rest;
|
14
|
+
|
15
|
+
rb_scan_args(argc, argv, "2*", &rb_content, &rb_document, &rest);
|
16
|
+
|
17
|
+
if (!rb_obj_is_kind_of(rb_document, cNokolexborDocument)) {
|
18
|
+
rb_raise(rb_eArgError, "Document must be a Nokolexbor::Document");
|
19
|
+
}
|
20
|
+
|
21
|
+
document = nl_rb_document_unwrap(rb_document);
|
22
|
+
|
23
|
+
const char* c_content = StringValuePtr(rb_content);
|
24
|
+
size_t content_len = RSTRING_LEN(rb_content);
|
25
|
+
lxb_dom_cdata_section_t *element = lxb_dom_document_create_cdata_section(document, (const lxb_char_t *)c_content, content_len);
|
26
|
+
if (element == NULL) {
|
27
|
+
rb_raise(rb_eRuntimeError, "Error creating text node");
|
28
|
+
}
|
29
|
+
|
30
|
+
VALUE rb_node = nl_rb_node_create(&element->text.char_data.node, rb_document);
|
31
|
+
|
32
|
+
if (rb_block_given_p()) {
|
33
|
+
rb_yield(rb_node);
|
34
|
+
}
|
35
|
+
|
36
|
+
return rb_node;
|
37
|
+
}
|
38
|
+
|
39
|
+
void Init_nl_cdata(void)
|
40
|
+
{
|
41
|
+
cNokolexborCData = rb_define_class_under(mNokolexbor, "CDATA", cNokolexborText);
|
42
|
+
|
43
|
+
rb_define_singleton_method(cNokolexborCData, "new", nl_cdata_new, -1);
|
44
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#include "nokolexbor.h"
|
2
|
+
|
3
|
+
VALUE cNokolexborComment;
|
4
|
+
extern VALUE cNokolexborCharacterData;
|
5
|
+
extern VALUE mNokolexbor;
|
6
|
+
|
7
|
+
static VALUE
|
8
|
+
nl_comment_new(int argc, VALUE *argv, VALUE klass)
|
9
|
+
{
|
10
|
+
lxb_dom_document_t *document;
|
11
|
+
VALUE rb_content;
|
12
|
+
VALUE rb_document;
|
13
|
+
VALUE rest;
|
14
|
+
|
15
|
+
rb_scan_args(argc, argv, "2*", &rb_content, &rb_document, &rest);
|
16
|
+
|
17
|
+
if (!rb_obj_is_kind_of(rb_document, cNokolexborDocument)) {
|
18
|
+
rb_raise(rb_eArgError, "Document must be a Nokolexbor::Document");
|
19
|
+
}
|
20
|
+
|
21
|
+
document = nl_rb_document_unwrap(rb_document);
|
22
|
+
|
23
|
+
const char* c_content = StringValuePtr(rb_content);
|
24
|
+
size_t content_len = RSTRING_LEN(rb_content);
|
25
|
+
lxb_dom_comment_t *element = lxb_dom_document_create_comment(document, (const lxb_char_t *)c_content, content_len);
|
26
|
+
if (element == NULL) {
|
27
|
+
rb_raise(rb_eRuntimeError, "Error creating comment");
|
28
|
+
}
|
29
|
+
|
30
|
+
VALUE rb_node = nl_rb_node_create(&element->char_data.node, rb_document);
|
31
|
+
|
32
|
+
if (rb_block_given_p()) {
|
33
|
+
rb_yield(rb_node);
|
34
|
+
}
|
35
|
+
|
36
|
+
return rb_node;
|
37
|
+
}
|
38
|
+
|
39
|
+
void Init_nl_comment(void)
|
40
|
+
{
|
41
|
+
cNokolexborComment = rb_define_class_under(mNokolexbor, "Comment", cNokolexborCharacterData);
|
42
|
+
|
43
|
+
rb_define_singleton_method(cNokolexborComment, "new", nl_comment_new, -1);
|
44
|
+
}
|