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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/ext/nokolexbor/CMakeLists.txt +7 -4
  3. data/ext/nokolexbor/config.h.cmake.in +2 -0
  4. data/ext/nokolexbor/extconf.rb +47 -25
  5. data/ext/nokolexbor/libxml/SAX2.h +4 -4
  6. data/ext/nokolexbor/libxml/chvalid.h +21 -21
  7. data/ext/nokolexbor/libxml/dict.h +13 -13
  8. data/ext/nokolexbor/libxml/globals.h +202 -202
  9. data/ext/nokolexbor/libxml/hash.h +25 -25
  10. data/ext/nokolexbor/libxml/parser.h +5 -5
  11. data/ext/nokolexbor/libxml/parserInternals.h +4 -4
  12. data/ext/nokolexbor/libxml/pattern.h +14 -14
  13. data/ext/nokolexbor/libxml/threads.h +15 -15
  14. data/ext/nokolexbor/libxml/tree.h +5 -5
  15. data/ext/nokolexbor/libxml/xmlerror.h +5 -5
  16. data/ext/nokolexbor/libxml/xmlmemory.h +16 -16
  17. data/ext/nokolexbor/libxml/xmlstring.h +30 -30
  18. data/ext/nokolexbor/libxml/xpath.h +43 -43
  19. data/ext/nokolexbor/libxml/xpathInternals.h +128 -128
  20. data/ext/nokolexbor/memory.c +6 -6
  21. data/ext/nokolexbor/nl_cdata.c +44 -0
  22. data/ext/nokolexbor/nl_comment.c +44 -0
  23. data/ext/nokolexbor/nl_document.c +23 -9
  24. data/ext/nokolexbor/nl_node.c +191 -178
  25. data/ext/nokolexbor/nl_node_set.c +38 -73
  26. data/ext/nokolexbor/nl_text.c +44 -0
  27. data/ext/nokolexbor/nl_xpath_context.c +33 -42
  28. data/ext/nokolexbor/nokolexbor.c +7 -3
  29. data/ext/nokolexbor/nokolexbor.h +9 -7
  30. data/ext/nokolexbor/private/buf.h +1 -1
  31. data/ext/nokolexbor/private/error.h +3 -3
  32. data/ext/nokolexbor/xml_SAX2.c +8 -8
  33. data/ext/nokolexbor/xml_buf.c +19 -19
  34. data/ext/nokolexbor/xml_chvalid.c +25 -25
  35. data/ext/nokolexbor/xml_dict.c +69 -69
  36. data/ext/nokolexbor/xml_encoding.c +2 -2
  37. data/ext/nokolexbor/xml_error.c +51 -51
  38. data/ext/nokolexbor/xml_globals.c +329 -329
  39. data/ext/nokolexbor/xml_hash.c +131 -131
  40. data/ext/nokolexbor/xml_memory.c +25 -25
  41. data/ext/nokolexbor/xml_parser.c +3 -3
  42. data/ext/nokolexbor/xml_parserInternals.c +15 -15
  43. data/ext/nokolexbor/xml_pattern.c +103 -103
  44. data/ext/nokolexbor/xml_string.c +93 -93
  45. data/ext/nokolexbor/xml_threads.c +61 -61
  46. data/ext/nokolexbor/xml_tree.c +12 -12
  47. data/ext/nokolexbor/xml_xpath.c +1194 -1203
  48. data/lib/nokolexbor/document.rb +92 -1
  49. data/lib/nokolexbor/node.rb +64 -0
  50. data/lib/nokolexbor/node_set.rb +6 -5
  51. data/lib/nokolexbor/version.rb +1 -1
  52. data/lib/nokolexbor.rb +21 -1
  53. data/patches/0001-lexbor-support-text-pseudo-element.patch +1 -1
  54. metadata +7 -4
@@ -88,8 +88,8 @@ static int libxml_is_threaded = -1;
88
88
  #endif
89
89
 
90
90
  /*
91
- * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree
92
- * to avoid some craziness since xmlMalloc/xmlFree may actually
91
+ * TODO: this module still uses malloc/free and not nl_xmlMalloc/nl_xmlFree
92
+ * to avoid some craziness since nl_xmlMalloc/nl_xmlFree may actually
93
93
  * be hosted on allocated blocks needing them for the allocation ...
94
94
  */
95
95
 
@@ -152,15 +152,15 @@ xmlInitMutex(xmlMutexPtr mutex)
152
152
  }
153
153
 
154
154
  /**
155
- * xmlNewMutex:
155
+ * nl_xmlNewMutex:
156
156
  *
157
- * xmlNewMutex() is used to allocate a libxml2 token struct for use in
157
+ * nl_xmlNewMutex() is used to allocate a libxml2 token struct for use in
158
158
  * synchronizing access to data.
159
159
  *
160
160
  * Returns a new simple mutex pointer or NULL in case of error
161
161
  */
162
162
  xmlMutexPtr
163
- xmlNewMutex(void)
163
+ nl_xmlNewMutex(void)
164
164
  {
165
165
  xmlMutexPtr tok;
166
166
 
@@ -189,13 +189,13 @@ xmlCleanupMutex(xmlMutexPtr mutex)
189
189
  }
190
190
 
191
191
  /**
192
- * xmlFreeMutex:
192
+ * nl_xmlFreeMutex:
193
193
  * @tok: the simple mutex
194
194
  *
195
195
  * Free a mutex.
196
196
  */
197
197
  void
198
- xmlFreeMutex(xmlMutexPtr tok)
198
+ nl_xmlFreeMutex(xmlMutexPtr tok)
199
199
  {
200
200
  if (tok == NULL)
201
201
  return;
@@ -205,13 +205,13 @@ xmlFreeMutex(xmlMutexPtr tok)
205
205
  }
206
206
 
207
207
  /**
208
- * xmlMutexLock:
208
+ * nl_xmlMutexLock:
209
209
  * @tok: the simple mutex
210
210
  *
211
- * xmlMutexLock() is used to lock a libxml2 token.
211
+ * nl_xmlMutexLock() is used to lock a libxml2 token.
212
212
  */
213
213
  void
214
- xmlMutexLock(xmlMutexPtr tok)
214
+ nl_xmlMutexLock(xmlMutexPtr tok)
215
215
  {
216
216
  if (tok == NULL)
217
217
  return;
@@ -229,13 +229,13 @@ xmlMutexLock(xmlMutexPtr tok)
229
229
  }
230
230
 
231
231
  /**
232
- * xmlMutexUnlock:
232
+ * nl_xmlMutexUnlock:
233
233
  * @tok: the simple mutex
234
234
  *
235
- * xmlMutexUnlock() is used to unlock a libxml2 token.
235
+ * nl_xmlMutexUnlock() is used to unlock a libxml2 token.
236
236
  */
237
237
  void
238
- xmlMutexUnlock(xmlMutexPtr tok)
238
+ nl_xmlMutexUnlock(xmlMutexPtr tok)
239
239
  {
240
240
  if (tok == NULL)
241
241
  return;
@@ -248,7 +248,7 @@ xmlMutexUnlock(xmlMutexPtr tok)
248
248
  }
249
249
 
250
250
  /**
251
- * xmlNewRMutex:
251
+ * nl_xmlNewRMutex:
252
252
  *
253
253
  * xmlRNewMutex() is used to allocate a reentrant mutex for use in
254
254
  * synchronizing access to data. token_r is a re-entrant lock and thus useful
@@ -258,7 +258,7 @@ xmlMutexUnlock(xmlMutexPtr tok)
258
258
  * Returns the new reentrant mutex pointer or NULL in case of error
259
259
  */
260
260
  xmlRMutexPtr
261
- xmlNewRMutex(void)
261
+ nl_xmlNewRMutex(void)
262
262
  {
263
263
  xmlRMutexPtr tok;
264
264
 
@@ -276,14 +276,14 @@ xmlNewRMutex(void)
276
276
  }
277
277
 
278
278
  /**
279
- * xmlFreeRMutex:
279
+ * nl_xmlFreeRMutex:
280
280
  * @tok: the reentrant mutex
281
281
  *
282
282
  * xmlRFreeMutex() is used to reclaim resources associated with a
283
283
  * reentrant mutex.
284
284
  */
285
285
  void
286
- xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
286
+ nl_xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
287
287
  {
288
288
  if (tok == NULL)
289
289
  return;
@@ -297,13 +297,13 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
297
297
  }
298
298
 
299
299
  /**
300
- * xmlRMutexLock:
300
+ * nl_xmlRMutexLock:
301
301
  * @tok: the reentrant mutex
302
302
  *
303
- * xmlRMutexLock() is used to lock a libxml2 token_r.
303
+ * nl_xmlRMutexLock() is used to lock a libxml2 token_r.
304
304
  */
305
305
  void
306
- xmlRMutexLock(xmlRMutexPtr tok)
306
+ nl_xmlRMutexLock(xmlRMutexPtr tok)
307
307
  {
308
308
  if (tok == NULL)
309
309
  return;
@@ -333,13 +333,13 @@ xmlRMutexLock(xmlRMutexPtr tok)
333
333
  }
334
334
 
335
335
  /**
336
- * xmlRMutexUnlock:
336
+ * nl_xmlRMutexUnlock:
337
337
  * @tok: the reentrant mutex
338
338
  *
339
- * xmlRMutexUnlock() is used to unlock a libxml2 token_r.
339
+ * nl_xmlRMutexUnlock() is used to unlock a libxml2 token_r.
340
340
  */
341
341
  void
342
- xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
342
+ nl_xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
343
343
  {
344
344
  if (tok == NULL)
345
345
  return;
@@ -387,7 +387,7 @@ __xmlGlobalInitMutexLock(void)
387
387
  if (global_init_lock == NULL) {
388
388
  cs = malloc(sizeof(CRITICAL_SECTION));
389
389
  if (cs == NULL) {
390
- xmlGenericError(xmlGenericErrorContext,
390
+ nl_xmlGenericError(nl_xmlGenericErrorContext,
391
391
  "xmlGlobalInitMutexLock: out of memory\n");
392
392
  return;
393
393
  }
@@ -461,8 +461,8 @@ __xmlGlobalInitMutexDestroy(void)
461
461
  ************************************************************************/
462
462
 
463
463
  #ifdef LIBXML_THREAD_ENABLED
464
- #ifdef xmlLastError
465
- #undef xmlLastError
464
+ #ifdef nl_xmlLastError
465
+ #undef nl_xmlLastError
466
466
  #endif
467
467
 
468
468
  /**
@@ -477,8 +477,8 @@ xmlFreeGlobalState(void *state)
477
477
  {
478
478
  xmlGlobalState *gs = (xmlGlobalState *) state;
479
479
 
480
- /* free any memory allocated in the thread's xmlLastError */
481
- xmlResetError(&(gs->xmlLastError));
480
+ /* free any memory allocated in the thread's nl_xmlLastError */
481
+ nl_xmlResetError(&(gs->nl_xmlLastError));
482
482
  free(state);
483
483
  }
484
484
 
@@ -498,13 +498,13 @@ xmlNewGlobalState(void)
498
498
 
499
499
  gs = malloc(sizeof(xmlGlobalState));
500
500
  if (gs == NULL) {
501
- xmlGenericError(xmlGenericErrorContext,
502
- "xmlGetGlobalState: out of memory\n");
501
+ nl_xmlGenericError(nl_xmlGenericErrorContext,
502
+ "nl_xmlGetGlobalState: out of memory\n");
503
503
  return (NULL);
504
504
  }
505
505
 
506
506
  memset(gs, 0, sizeof(xmlGlobalState));
507
- xmlInitializeGlobalState(gs);
507
+ nl_xmlInitializeGlobalState(gs);
508
508
  return (gs);
509
509
  }
510
510
  #endif /* LIBXML_THREAD_ENABLED */
@@ -545,16 +545,16 @@ static CRITICAL_SECTION cleanup_helpers_cs;
545
545
  #endif /* HAVE_WIN32_THREADS */
546
546
 
547
547
  /**
548
- * xmlGetGlobalState:
548
+ * nl_xmlGetGlobalState:
549
549
  *
550
550
  * DEPRECATED: Internal function, do not use.
551
551
  *
552
- * xmlGetGlobalState() is called to retrieve the global state for a thread.
552
+ * nl_xmlGetGlobalState() is called to retrieve the global state for a thread.
553
553
  *
554
554
  * Returns the thread global state or NULL in case of error
555
555
  */
556
556
  xmlGlobalStatePtr
557
- xmlGetGlobalState(void)
557
+ nl_xmlGetGlobalState(void)
558
558
  {
559
559
  #ifdef HAVE_POSIX_THREADS
560
560
  xmlGlobalState *globalval;
@@ -576,7 +576,7 @@ xmlGetGlobalState(void)
576
576
  #if defined(HAVE_COMPILER_TLS)
577
577
  if (!tlstate_inited) {
578
578
  tlstate_inited = 1;
579
- xmlInitializeGlobalState(&tlstate);
579
+ nl_xmlInitializeGlobalState(&tlstate);
580
580
  }
581
581
  return &tlstate;
582
582
  #else /* HAVE_COMPILER_TLS */
@@ -596,8 +596,8 @@ xmlGetGlobalState(void)
596
596
  p = (xmlGlobalStateCleanupHelperParams *)
597
597
  malloc(sizeof(xmlGlobalStateCleanupHelperParams));
598
598
  if (p == NULL) {
599
- xmlGenericError(xmlGenericErrorContext,
600
- "xmlGetGlobalState: out of memory\n");
599
+ nl_xmlGenericError(nl_xmlGenericErrorContext,
600
+ "nl_xmlGetGlobalState: out of memory\n");
601
601
  xmlFreeGlobalState(tsd);
602
602
  return(NULL);
603
603
  }
@@ -636,18 +636,18 @@ xmlGetGlobalState(void)
636
636
  ************************************************************************/
637
637
 
638
638
  /**
639
- * xmlGetThreadId:
639
+ * nl_xmlGetThreadId:
640
640
  *
641
641
  * DEPRECATED: Internal function, do not use.
642
642
  *
643
- * xmlGetThreadId() find the current thread ID number
643
+ * nl_xmlGetThreadId() find the current thread ID number
644
644
  * Note that this is likely to be broken on some platforms using pthreads
645
645
  * as the specification doesn't mandate pthread_t to be an integer type
646
646
  *
647
647
  * Returns the current thread ID number
648
648
  */
649
649
  int
650
- xmlGetThreadId(void)
650
+ nl_xmlGetThreadId(void)
651
651
  {
652
652
  #ifdef HAVE_POSIX_THREADS
653
653
  pthread_t id;
@@ -667,21 +667,21 @@ xmlGetThreadId(void)
667
667
  }
668
668
 
669
669
  /**
670
- * xmlIsMainThread:
670
+ * nl_xmlIsMainThread:
671
671
  *
672
672
  * DEPRECATED: Internal function, do not use.
673
673
  *
674
- * xmlIsMainThread() check whether the current thread is the main thread.
674
+ * nl_xmlIsMainThread() check whether the current thread is the main thread.
675
675
  *
676
676
  * Returns 1 if the current thread is the main thread, 0 otherwise
677
677
  */
678
678
  int
679
- xmlIsMainThread(void)
679
+ nl_xmlIsMainThread(void)
680
680
  {
681
- xmlInitParser();
681
+ nl_xmlInitParser();
682
682
 
683
683
  #ifdef DEBUG_THREADS
684
- xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n");
684
+ nl_xmlGenericError(nl_xmlGenericErrorContext, "nl_xmlIsMainThread()\n");
685
685
  #endif
686
686
  #ifdef HAVE_POSIX_THREADS
687
687
  if (XML_IS_THREADED() == 0)
@@ -695,44 +695,44 @@ xmlIsMainThread(void)
695
695
  }
696
696
 
697
697
  /**
698
- * xmlLockLibrary:
698
+ * nl_xmlLockLibrary:
699
699
  *
700
- * xmlLockLibrary() is used to take out a re-entrant lock on the libxml2
700
+ * nl_xmlLockLibrary() is used to take out a re-entrant lock on the libxml2
701
701
  * library.
702
702
  */
703
703
  void
704
- xmlLockLibrary(void)
704
+ nl_xmlLockLibrary(void)
705
705
  {
706
706
  #ifdef DEBUG_THREADS
707
- xmlGenericError(xmlGenericErrorContext, "xmlLockLibrary()\n");
707
+ nl_xmlGenericError(nl_xmlGenericErrorContext, "nl_xmlLockLibrary()\n");
708
708
  #endif
709
- xmlRMutexLock(xmlLibraryLock);
709
+ nl_xmlRMutexLock(xmlLibraryLock);
710
710
  }
711
711
 
712
712
  /**
713
- * xmlUnlockLibrary:
713
+ * nl_xmlUnlockLibrary:
714
714
  *
715
- * xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2
715
+ * nl_xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2
716
716
  * library.
717
717
  */
718
718
  void
719
- xmlUnlockLibrary(void)
719
+ nl_xmlUnlockLibrary(void)
720
720
  {
721
721
  #ifdef DEBUG_THREADS
722
- xmlGenericError(xmlGenericErrorContext, "xmlUnlockLibrary()\n");
722
+ nl_xmlGenericError(nl_xmlGenericErrorContext, "nl_xmlUnlockLibrary()\n");
723
723
  #endif
724
- xmlRMutexUnlock(xmlLibraryLock);
724
+ nl_xmlRMutexUnlock(xmlLibraryLock);
725
725
  }
726
726
 
727
727
  /**
728
- * xmlInitThreads:
728
+ * nl_xmlInitThreads:
729
729
  *
730
- * DEPRECATED: Alias for xmlInitParser.
730
+ * DEPRECATED: Alias for nl_xmlInitParser.
731
731
  */
732
732
  void
733
- xmlInitThreads(void)
733
+ nl_xmlInitThreads(void)
734
734
  {
735
- xmlInitParser();
735
+ nl_xmlInitParser();
736
736
  }
737
737
 
738
738
  /**
@@ -767,7 +767,7 @@ xmlInitThreadsInternal(void)
767
767
  }
768
768
 
769
769
  /**
770
- * xmlCleanupThreads:
770
+ * nl_xmlCleanupThreads:
771
771
  *
772
772
  * DEPRECATED: This function is a no-op. Call xmlCleanupParser
773
773
  * to free global state but see the warnings there. xmlCleanupParser
@@ -775,7 +775,7 @@ xmlInitThreadsInternal(void)
775
775
  * have call cleanup functions at all.
776
776
  */
777
777
  void
778
- xmlCleanupThreads(void)
778
+ nl_xmlCleanupThreads(void)
779
779
  {
780
780
  }
781
781
 
@@ -56,11 +56,11 @@ int __xmlRegisterCallbacks = 0;
56
56
  static void
57
57
  xmlTreeErrMemory(const char *extra)
58
58
  {
59
- __xmlSimpleError(XML_FROM_TREE, XML_ERR_NO_MEMORY, NULL, NULL, extra);
59
+ __nl_xmlSimpleError(XML_FROM_TREE, XML_ERR_NO_MEMORY, NULL, NULL, extra);
60
60
  }
61
61
 
62
62
  /**
63
- * xmlBuildQName:
63
+ * nl_xmlBuildQName:
64
64
  * @ncname: the Name
65
65
  * @prefix: the prefix
66
66
  * @memory: preallocated memory
@@ -74,7 +74,7 @@ xmlTreeErrMemory(const char *extra)
74
74
  * @memory and @ncname or NULL in case of error
75
75
  */
76
76
  xmlChar *
77
- xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
77
+ nl_xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
78
78
  xmlChar *memory, int len) {
79
79
  int lenn, lenp;
80
80
  xmlChar *ret;
@@ -86,7 +86,7 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
86
86
  lenp = strlen((char *) prefix);
87
87
 
88
88
  if ((memory == NULL) || (len < lenn + lenp + 2)) {
89
- ret = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
89
+ ret = (xmlChar *) nl_xmlMallocAtomic(lenn + lenp + 2);
90
90
  if (ret == NULL) {
91
91
  xmlTreeErrMemory("building QName");
92
92
  return(NULL);
@@ -102,7 +102,7 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
102
102
  }
103
103
 
104
104
  /**
105
- * xmlNodeGetContent:
105
+ * nl_xmlNodeGetContent:
106
106
  * @cur: the node being read
107
107
  *
108
108
  * Read the value of a node, this can be either the text carried
@@ -110,22 +110,22 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
110
110
  * of the values carried by this node child's (TEXT and ENTITY_REF).
111
111
  * Entity references are substituted.
112
112
  * Returns a new #xmlChar * or NULL if no content is available.
113
- * It's up to the caller to free the memory with xmlFree().
113
+ * It's up to the caller to free the memory with nl_xmlFree().
114
114
  */
115
115
  xmlChar *
116
- xmlNodeGetContent(const lxb_dom_node_t *cur)
116
+ nl_xmlNodeGetContent(const lxb_dom_node_t *cur)
117
117
  {
118
118
  size_t len;
119
119
  lxb_char_t *content = lxb_dom_node_text_content(cur, &len);
120
120
  if (content == NULL)
121
121
  return NULL;
122
- xmlChar *content_dup = xmlStrndup(content, len);
122
+ xmlChar *content_dup = nl_xmlStrndup(content, len);
123
123
  lxb_dom_document_destroy_text(cur->owner_document, content);
124
124
  return content_dup;
125
125
  }
126
126
 
127
127
  /**
128
- * xmlDocGetRootElement:
128
+ * nl_xmlDocGetRootElement:
129
129
  * @doc: the document
130
130
  *
131
131
  * Get the root element of the document (doc->children is a list
@@ -134,7 +134,7 @@ xmlNodeGetContent(const lxb_dom_node_t *cur)
134
134
  * Returns the #lxb_dom_node_t_ptr for the root or NULL
135
135
  */
136
136
  lxb_dom_node_t_ptr
137
- xmlDocGetRootElement(const lxb_dom_document_t *doc) {
137
+ nl_xmlDocGetRootElement(const lxb_dom_document_t *doc) {
138
138
  lxb_dom_node_t_ptr ret;
139
139
 
140
140
  if (doc == NULL) return(NULL);
@@ -148,13 +148,13 @@ xmlDocGetRootElement(const lxb_dom_document_t *doc) {
148
148
  }
149
149
 
150
150
  /**
151
- * xmlFreeNodeList:
151
+ * nl_xmlFreeNodeList:
152
152
  * @cur: the first node in the list
153
153
  *
154
154
  * Free a node and all its siblings, this is a recursive behaviour, all
155
155
  * the children are freed too.
156
156
  */
157
157
  void
158
- xmlFreeNodeList(lxb_dom_node_t_ptr cur) {
158
+ nl_xmlFreeNodeList(lxb_dom_node_t_ptr cur) {
159
159
  // Should never be called
160
160
  }