nokolexbor 0.2.2 → 0.2.4
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 +92 -0
- data/ext/nokolexbor/config.h.cmake.in +26 -0
- data/ext/nokolexbor/extconf.rb +17 -8
- data/ext/nokolexbor/libxml/{xmlversion.h → xmlversion.h.in} +41 -41
- data/ext/nokolexbor/nl_document.c +12 -4
- data/ext/nokolexbor/nl_node.c +66 -56
- data/ext/nokolexbor/nl_node_set.c +43 -22
- data/ext/nokolexbor/nl_xpath_context.c +78 -18
- data/ext/nokolexbor/nokolexbor.h +2 -0
- data/ext/nokolexbor/xml_error.c +225 -27
- data/lib/nokolexbor/node.rb +2 -2
- data/lib/nokolexbor/node_set.rb +5 -1
- data/lib/nokolexbor/version.rb +1 -1
- data/lib/nokolexbor/xpath.rb +69 -0
- data/lib/nokolexbor.rb +1 -0
- metadata +26 -9
- data/ext/nokolexbor/config.h +0 -186
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e93c293e8d506960077c772b822d4f75103d6583b8864e56f343a8ad6229c7a
|
4
|
+
data.tar.gz: 1baaaed733eae123b895e21021709fed7a7e185a10e8c27cf0d43105e7e4a272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 665232217ba5f1b0a53ad67dfcbb38244685fab9242bf718b1364b59c3b623e5150bdd471284c3424fb2c319761c30f1022d7792e1edf848e3c4c0a41de89806
|
7
|
+
data.tar.gz: 81cc64f435de161807ce0a6d3a0c8b0875a51f0f49307a763be8be4c70b3eefd0a5ea36fb364d2fec2e37b6b3307d549fc0f0bbd3afe35f47b6b797ea5998b96
|
@@ -0,0 +1,92 @@
|
|
1
|
+
cmake_minimum_required(VERSION 3.0)
|
2
|
+
|
3
|
+
set(VERSION "2.11.0")
|
4
|
+
|
5
|
+
project(libxml2 VERSION ${VERSION} LANGUAGES C)
|
6
|
+
|
7
|
+
include(CheckFunctionExists)
|
8
|
+
include(CheckIncludeFiles)
|
9
|
+
include(CheckLibraryExists)
|
10
|
+
include(CheckStructHasMember)
|
11
|
+
include(CheckSymbolExists)
|
12
|
+
|
13
|
+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
14
|
+
set(LIBXML2_WITH_AUTOMATA ON)
|
15
|
+
option(LIBXML2_WITH_C14N "Add the Canonicalization support" OFF)
|
16
|
+
option(LIBXML2_WITH_CATALOG "Add the Catalog support" OFF)
|
17
|
+
option(LIBXML2_WITH_DEBUG "Add the debugging module" OFF)
|
18
|
+
set(LIBXML2_WITH_EXPR OFF)
|
19
|
+
option(LIBXML2_WITH_FTP "Add the FTP support" OFF)
|
20
|
+
option(LIBXML2_WITH_HTML "Add the HTML support" ON)
|
21
|
+
option(LIBXML2_WITH_HTTP "Add the HTTP support" OFF)
|
22
|
+
option(LIBXML2_WITH_ICONV "Add ICONV support" OFF)
|
23
|
+
option(LIBXML2_WITH_ICU "Add ICU support" OFF)
|
24
|
+
option(LIBXML2_WITH_ISO8859X "Add ISO8859X support if no iconv" OFF)
|
25
|
+
option(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" OFF)
|
26
|
+
option(LIBXML2_WITH_LZMA "Use liblzma" OFF)
|
27
|
+
option(LIBXML2_WITH_MEM_DEBUG "Add the memory debugging module" OFF)
|
28
|
+
option(LIBXML2_WITH_MODULES "Add the dynamic modules support" OFF)
|
29
|
+
option(LIBXML2_WITH_OUTPUT "Add the serialization support" OFF)
|
30
|
+
option(LIBXML2_WITH_PATTERN "Add the xmlPattern selection interface" ON)
|
31
|
+
option(LIBXML2_WITH_PROGRAMS "Build programs" OFF)
|
32
|
+
option(LIBXML2_WITH_PUSH "Add the PUSH parser interfaces" OFF)
|
33
|
+
option(LIBXML2_WITH_PYTHON "Build Python bindings" OFF)
|
34
|
+
option(LIBXML2_WITH_READER "Add the xmlReader parsing interface" OFF)
|
35
|
+
option(LIBXML2_WITH_REGEXPS "Add Regular Expressions support" OFF)
|
36
|
+
option(LIBXML2_WITH_SAX1 "Add the older SAX1 interface" OFF)
|
37
|
+
option(LIBXML2_WITH_SCHEMAS "Add Relax-NG and Schemas support" OFF)
|
38
|
+
option(LIBXML2_WITH_SCHEMATRON "Add Schematron support" OFF)
|
39
|
+
option(LIBXML2_WITH_TESTS "Build tests" OFF)
|
40
|
+
option(LIBXML2_WITH_THREADS "Add multithread support" ON)
|
41
|
+
option(LIBXML2_WITH_THREAD_ALLOC "Add per-thread memory" OFF)
|
42
|
+
option(LIBXML2_WITH_TREE "Add the DOM like tree manipulation APIs" ON)
|
43
|
+
set(LIBXML2_WITH_TRIO OFF)
|
44
|
+
set(LIBXML2_WITH_UNICODE ON)
|
45
|
+
option(LIBXML2_WITH_VALID "Add the DTD validation support" OFF)
|
46
|
+
option(LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" OFF)
|
47
|
+
option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" OFF)
|
48
|
+
option(LIBXML2_WITH_XPATH "Add the XPATH support" ON)
|
49
|
+
option(LIBXML2_WITH_XPTR "Add the XPointer support" OFF)
|
50
|
+
option(LIBXML2_WITH_XPTR_LOCS "Add support for XPointer locations" OFF)
|
51
|
+
option(LIBXML2_WITH_ZLIB "Use libz" OFF)
|
52
|
+
set(LIBXML2_XMLCONF_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Working directory for XML Conformance Test Suite")
|
53
|
+
|
54
|
+
if(LIBXML2_WITH_THREADS)
|
55
|
+
find_package(Threads REQUIRED)
|
56
|
+
endif()
|
57
|
+
|
58
|
+
foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB)
|
59
|
+
if(LIBXML2_${VARIABLE})
|
60
|
+
set(${VARIABLE} 1)
|
61
|
+
else()
|
62
|
+
set(${VARIABLE} 0)
|
63
|
+
endif()
|
64
|
+
endforeach()
|
65
|
+
|
66
|
+
if (NOT MSVC)
|
67
|
+
check_c_source_compiles("
|
68
|
+
void __attribute__((destructor))
|
69
|
+
f(void) {}
|
70
|
+
int main(void) { return 0; }
|
71
|
+
" HAVE_ATTRIBUTE_DESTRUCTOR)
|
72
|
+
if(HAVE_ATTRIBUTE_DESTRUCTOR)
|
73
|
+
set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))")
|
74
|
+
endif()
|
75
|
+
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
76
|
+
check_function_exists(rand_r HAVE_RAND_R)
|
77
|
+
check_include_files(stdint.h HAVE_STDINT_H)
|
78
|
+
endif()
|
79
|
+
|
80
|
+
if(LIBXML2_WITH_THREADS)
|
81
|
+
# target_compile_definitions(LibXml2 PRIVATE _REENTRANT)
|
82
|
+
if(NOT WIN32)
|
83
|
+
check_include_files(pthread.h HAVE_PTHREAD_H)
|
84
|
+
endif()
|
85
|
+
endif()
|
86
|
+
|
87
|
+
if(MSVC)
|
88
|
+
configure_file(include/win32config.h config.h COPYONLY)
|
89
|
+
else()
|
90
|
+
configure_file(config.h.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
91
|
+
endif()
|
92
|
+
configure_file(libxml/xmlversion.h.in ${CMAKE_CURRENT_SOURCE_DIR}/libxml/xmlversion.h)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/* config.h. Generated from config.h.in by configure. */
|
2
|
+
/* config.h.in. Generated from configure.ac by autoheader. */
|
3
|
+
|
4
|
+
/* Define if __attribute__((destructor)) is accepted */
|
5
|
+
#cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@
|
6
|
+
|
7
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
8
|
+
#cmakedefine HAVE_INTTYPES_H 1
|
9
|
+
|
10
|
+
/* Define if <pthread.h> is there */
|
11
|
+
#cmakedefine HAVE_PTHREAD_H 1
|
12
|
+
|
13
|
+
/* Define to 1 if you have the `rand_r' function. */
|
14
|
+
#cmakedefine HAVE_RAND_R 1
|
15
|
+
|
16
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
17
|
+
#cmakedefine HAVE_STDINT_H 1
|
18
|
+
|
19
|
+
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
|
20
|
+
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
21
|
+
#define below would cause a syntax error. */
|
22
|
+
#cmakedefine _UINT32_T @_UINT32_T@
|
23
|
+
|
24
|
+
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
25
|
+
such a type exists and the standard includes do not define it. */
|
26
|
+
#cmakedefine uint32_t @uint32_t@
|
data/ext/nokolexbor/extconf.rb
CHANGED
@@ -12,8 +12,11 @@ cmake_flags << "-DLEXBOR_BUILD_STATIC=ON"
|
|
12
12
|
# For debugging
|
13
13
|
# cmake_flags << "-DLEXBOR_OPTIMIZATION_LEVEL='-O0 -g'"
|
14
14
|
|
15
|
+
append_cflags("-DLEXBOR_STATIC")
|
16
|
+
append_cflags("-DLIBXML_STATIC")
|
17
|
+
|
15
18
|
def sys(cmd)
|
16
|
-
puts "
|
19
|
+
puts "-- #{cmd}"
|
17
20
|
unless ret = xsystem(cmd)
|
18
21
|
raise "ERROR: '#{cmd}' failed"
|
19
22
|
end
|
@@ -79,19 +82,16 @@ else
|
|
79
82
|
end
|
80
83
|
|
81
84
|
if !MAKE
|
82
|
-
abort "ERROR: GNU make is required to build
|
85
|
+
abort "ERROR: GNU make is required to build Lexbor."
|
83
86
|
end
|
84
87
|
|
85
88
|
CWD = File.expand_path(File.dirname(__FILE__))
|
86
89
|
LEXBOR_DIR = File.join(CWD, '..', '..', 'vendor', 'lexbor')
|
90
|
+
EXT_DIR = File.join(CWD, '..', '..', 'ext', 'nokolexbor')
|
87
91
|
INSTALL_DIR = File.join(LEXBOR_DIR, 'dist')
|
88
92
|
|
89
93
|
if !find_executable('cmake')
|
90
|
-
abort "ERROR: CMake is required to build
|
91
|
-
end
|
92
|
-
|
93
|
-
if !Gem.win_platform? && !find_executable('pkg-config')
|
94
|
-
abort "ERROR: pkg-config is required to build Rugged."
|
94
|
+
abort "ERROR: CMake is required to build Lexbor."
|
95
95
|
end
|
96
96
|
|
97
97
|
Dir.chdir(LEXBOR_DIR) do
|
@@ -110,6 +110,15 @@ Dir.chdir(LEXBOR_DIR) do
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
# Generate config.h and xmlversion.h for libxml2
|
114
|
+
Dir.chdir(EXT_DIR) do
|
115
|
+
Dir.mkdir("build") if !Dir.exist?("build")
|
116
|
+
|
117
|
+
Dir.chdir("build") do
|
118
|
+
run_cmake(10 * 60, "..#{Gem.win_platform? ? " -DLIBXML2_WITH_THREADS=OFF" : ""}")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
113
122
|
# Prepend the vendored lexbor build dir to the $DEFLIBPATH.
|
114
123
|
#
|
115
124
|
# By default, $DEFLIBPATH includes $(libpath), which usually points
|
@@ -117,7 +126,7 @@ end
|
|
117
126
|
# installed through rbenv or rvm).
|
118
127
|
#
|
119
128
|
# This was causing system-wide lexbor installations to be preferred
|
120
|
-
# over of our vendored lexbor version when building
|
129
|
+
# over of our vendored lexbor version when building lexbor.
|
121
130
|
#
|
122
131
|
# By putting the path to the vendored lexbor library at the front of
|
123
132
|
# $DEFLIBPATH, we can ensure that our bundled version is always used.
|
@@ -21,7 +21,7 @@ extern "C" {
|
|
21
21
|
* your library and includes mismatch
|
22
22
|
*/
|
23
23
|
#ifndef LIBXML2_COMPILING_MSCCDEF
|
24
|
-
XMLPUBFUN void
|
24
|
+
XMLPUBFUN void xmlCheckVersion(int version);
|
25
25
|
#endif /* LIBXML2_COMPILING_MSCCDEF */
|
26
26
|
|
27
27
|
/**
|
@@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
29
29
|
*
|
30
30
|
* the version string like "1.2.3"
|
31
31
|
*/
|
32
|
-
#define LIBXML_DOTTED_VERSION "
|
32
|
+
#define LIBXML_DOTTED_VERSION "@VERSION@"
|
33
33
|
|
34
34
|
/**
|
35
35
|
* LIBXML_VERSION:
|
36
36
|
*
|
37
37
|
* the version number: 1.2.3 value is 10203
|
38
38
|
*/
|
39
|
-
#define LIBXML_VERSION
|
39
|
+
#define LIBXML_VERSION @LIBXML_VERSION_NUMBER@
|
40
40
|
|
41
41
|
/**
|
42
42
|
* LIBXML_VERSION_STRING:
|
43
43
|
*
|
44
44
|
* the version number string, 1.2.3 value is "10203"
|
45
45
|
*/
|
46
|
-
#define LIBXML_VERSION_STRING "
|
46
|
+
#define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@"
|
47
47
|
|
48
48
|
/**
|
49
49
|
* LIBXML_VERSION_EXTRA:
|
50
50
|
*
|
51
51
|
* extra version information, used to show a git commit description
|
52
52
|
*/
|
53
|
-
#define LIBXML_VERSION_EXTRA "
|
53
|
+
#define LIBXML_VERSION_EXTRA "@LIBXML_VERSION_EXTRA@"
|
54
54
|
|
55
55
|
/**
|
56
56
|
* LIBXML_TEST_VERSION:
|
@@ -58,10 +58,10 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
58
58
|
* Macro to check that the libxml version in use is compatible with
|
59
59
|
* the version the software has been compiled against
|
60
60
|
*/
|
61
|
-
#define LIBXML_TEST_VERSION xmlCheckVersion(
|
61
|
+
#define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@);
|
62
62
|
|
63
63
|
#ifndef VMS
|
64
|
-
#if
|
64
|
+
#if @WITH_TRIO@
|
65
65
|
/**
|
66
66
|
* WITH_TRIO:
|
67
67
|
*
|
@@ -90,7 +90,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
90
90
|
*
|
91
91
|
* Whether the thread support is configured in
|
92
92
|
*/
|
93
|
-
#if
|
93
|
+
#if @WITH_THREADS@
|
94
94
|
#define LIBXML_THREAD_ENABLED
|
95
95
|
#endif
|
96
96
|
|
@@ -99,7 +99,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
99
99
|
*
|
100
100
|
* Whether the allocation hooks are per-thread
|
101
101
|
*/
|
102
|
-
#if
|
102
|
+
#if @WITH_THREAD_ALLOC@
|
103
103
|
#define LIBXML_THREAD_ALLOC_ENABLED
|
104
104
|
#endif
|
105
105
|
|
@@ -108,7 +108,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
108
108
|
*
|
109
109
|
* Whether the DOM like tree manipulation API support is configured in
|
110
110
|
*/
|
111
|
-
#if
|
111
|
+
#if @WITH_TREE@
|
112
112
|
#define LIBXML_TREE_ENABLED
|
113
113
|
#endif
|
114
114
|
|
@@ -117,7 +117,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
117
117
|
*
|
118
118
|
* Whether the serialization/saving support is configured in
|
119
119
|
*/
|
120
|
-
#if
|
120
|
+
#if @WITH_OUTPUT@
|
121
121
|
#define LIBXML_OUTPUT_ENABLED
|
122
122
|
#endif
|
123
123
|
|
@@ -126,7 +126,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
126
126
|
*
|
127
127
|
* Whether the push parsing interfaces are configured in
|
128
128
|
*/
|
129
|
-
#if
|
129
|
+
#if @WITH_PUSH@
|
130
130
|
#define LIBXML_PUSH_ENABLED
|
131
131
|
#endif
|
132
132
|
|
@@ -135,7 +135,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
135
135
|
*
|
136
136
|
* Whether the xmlReader parsing interface is configured in
|
137
137
|
*/
|
138
|
-
#if
|
138
|
+
#if @WITH_READER@
|
139
139
|
#define LIBXML_READER_ENABLED
|
140
140
|
#endif
|
141
141
|
|
@@ -144,7 +144,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
144
144
|
*
|
145
145
|
* Whether the xmlPattern node selection interface is configured in
|
146
146
|
*/
|
147
|
-
#if
|
147
|
+
#if @WITH_PATTERN@
|
148
148
|
#define LIBXML_PATTERN_ENABLED
|
149
149
|
#endif
|
150
150
|
|
@@ -153,7 +153,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
153
153
|
*
|
154
154
|
* Whether the xmlWriter saving interface is configured in
|
155
155
|
*/
|
156
|
-
#if
|
156
|
+
#if @WITH_WRITER@
|
157
157
|
#define LIBXML_WRITER_ENABLED
|
158
158
|
#endif
|
159
159
|
|
@@ -162,7 +162,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
162
162
|
*
|
163
163
|
* Whether the older SAX1 interface is configured in
|
164
164
|
*/
|
165
|
-
#if
|
165
|
+
#if @WITH_SAX1@
|
166
166
|
#define LIBXML_SAX1_ENABLED
|
167
167
|
#endif
|
168
168
|
|
@@ -171,7 +171,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
171
171
|
*
|
172
172
|
* Whether the FTP support is configured in
|
173
173
|
*/
|
174
|
-
#if
|
174
|
+
#if @WITH_FTP@
|
175
175
|
#define LIBXML_FTP_ENABLED
|
176
176
|
#endif
|
177
177
|
|
@@ -180,7 +180,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
180
180
|
*
|
181
181
|
* Whether the HTTP support is configured in
|
182
182
|
*/
|
183
|
-
#if
|
183
|
+
#if @WITH_HTTP@
|
184
184
|
#define LIBXML_HTTP_ENABLED
|
185
185
|
#endif
|
186
186
|
|
@@ -189,7 +189,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
189
189
|
*
|
190
190
|
* Whether the DTD validation support is configured in
|
191
191
|
*/
|
192
|
-
#if
|
192
|
+
#if @WITH_VALID@
|
193
193
|
#define LIBXML_VALID_ENABLED
|
194
194
|
#endif
|
195
195
|
|
@@ -198,7 +198,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
198
198
|
*
|
199
199
|
* Whether the HTML support is configured in
|
200
200
|
*/
|
201
|
-
#if
|
201
|
+
#if @WITH_HTML@
|
202
202
|
#define LIBXML_HTML_ENABLED
|
203
203
|
#endif
|
204
204
|
|
@@ -207,7 +207,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
207
207
|
*
|
208
208
|
* Whether the deprecated APIs are compiled in for compatibility
|
209
209
|
*/
|
210
|
-
#if
|
210
|
+
#if @WITH_LEGACY@
|
211
211
|
#define LIBXML_LEGACY_ENABLED
|
212
212
|
#endif
|
213
213
|
|
@@ -216,7 +216,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
216
216
|
*
|
217
217
|
* Whether the Canonicalization support is configured in
|
218
218
|
*/
|
219
|
-
#if
|
219
|
+
#if @WITH_C14N@
|
220
220
|
#define LIBXML_C14N_ENABLED
|
221
221
|
#endif
|
222
222
|
|
@@ -225,7 +225,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
225
225
|
*
|
226
226
|
* Whether the Catalog support is configured in
|
227
227
|
*/
|
228
|
-
#if
|
228
|
+
#if @WITH_CATALOG@
|
229
229
|
#define LIBXML_CATALOG_ENABLED
|
230
230
|
#endif
|
231
231
|
|
@@ -234,7 +234,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
234
234
|
*
|
235
235
|
* Whether XPath is configured in
|
236
236
|
*/
|
237
|
-
#if
|
237
|
+
#if @WITH_XPATH@
|
238
238
|
#define LIBXML_XPATH_ENABLED
|
239
239
|
#endif
|
240
240
|
|
@@ -243,7 +243,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
243
243
|
*
|
244
244
|
* Whether XPointer is configured in
|
245
245
|
*/
|
246
|
-
#if
|
246
|
+
#if @WITH_XPTR@
|
247
247
|
#define LIBXML_XPTR_ENABLED
|
248
248
|
#endif
|
249
249
|
|
@@ -252,7 +252,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
252
252
|
*
|
253
253
|
* Whether support for XPointer locations is configured in
|
254
254
|
*/
|
255
|
-
#if
|
255
|
+
#if @WITH_XPTR_LOCS@
|
256
256
|
#define LIBXML_XPTR_LOCS_ENABLED
|
257
257
|
#endif
|
258
258
|
|
@@ -261,7 +261,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
261
261
|
*
|
262
262
|
* Whether XInclude is configured in
|
263
263
|
*/
|
264
|
-
#if
|
264
|
+
#if @WITH_XINCLUDE@
|
265
265
|
#define LIBXML_XINCLUDE_ENABLED
|
266
266
|
#endif
|
267
267
|
|
@@ -270,7 +270,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
270
270
|
*
|
271
271
|
* Whether iconv support is available
|
272
272
|
*/
|
273
|
-
#if
|
273
|
+
#if @WITH_ICONV@
|
274
274
|
#define LIBXML_ICONV_ENABLED
|
275
275
|
#endif
|
276
276
|
|
@@ -279,7 +279,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
279
279
|
*
|
280
280
|
* Whether icu support is available
|
281
281
|
*/
|
282
|
-
#if
|
282
|
+
#if @WITH_ICU@
|
283
283
|
#define LIBXML_ICU_ENABLED
|
284
284
|
#endif
|
285
285
|
|
@@ -288,7 +288,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
288
288
|
*
|
289
289
|
* Whether ISO-8859-* support is made available in case iconv is not
|
290
290
|
*/
|
291
|
-
#if
|
291
|
+
#if @WITH_ISO8859X@
|
292
292
|
#define LIBXML_ISO8859X_ENABLED
|
293
293
|
#endif
|
294
294
|
|
@@ -297,7 +297,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
297
297
|
*
|
298
298
|
* Whether Debugging module is configured in
|
299
299
|
*/
|
300
|
-
#if
|
300
|
+
#if @WITH_DEBUG@
|
301
301
|
#define LIBXML_DEBUG_ENABLED
|
302
302
|
#endif
|
303
303
|
|
@@ -306,7 +306,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
306
306
|
*
|
307
307
|
* Whether the memory debugging is configured in
|
308
308
|
*/
|
309
|
-
#if
|
309
|
+
#if @WITH_MEM_DEBUG@
|
310
310
|
#define DEBUG_MEMORY_LOCATION
|
311
311
|
#endif
|
312
312
|
|
@@ -324,7 +324,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
324
324
|
*
|
325
325
|
* Whether the Unicode related interfaces are compiled in
|
326
326
|
*/
|
327
|
-
#if
|
327
|
+
#if @WITH_REGEXPS@
|
328
328
|
#define LIBXML_UNICODE_ENABLED
|
329
329
|
#endif
|
330
330
|
|
@@ -333,7 +333,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
333
333
|
*
|
334
334
|
* Whether the regular expressions interfaces are compiled in
|
335
335
|
*/
|
336
|
-
#if
|
336
|
+
#if @WITH_REGEXPS@
|
337
337
|
#define LIBXML_REGEXP_ENABLED
|
338
338
|
#endif
|
339
339
|
|
@@ -342,7 +342,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
342
342
|
*
|
343
343
|
* Whether the automata interfaces are compiled in
|
344
344
|
*/
|
345
|
-
#if
|
345
|
+
#if @WITH_REGEXPS@
|
346
346
|
#define LIBXML_AUTOMATA_ENABLED
|
347
347
|
#endif
|
348
348
|
|
@@ -362,7 +362,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
362
362
|
*
|
363
363
|
* Whether the Schemas validation interfaces are compiled in
|
364
364
|
*/
|
365
|
-
#if
|
365
|
+
#if @WITH_SCHEMAS@
|
366
366
|
#define LIBXML_SCHEMAS_ENABLED
|
367
367
|
#endif
|
368
368
|
|
@@ -371,7 +371,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
371
371
|
*
|
372
372
|
* Whether the Schematron validation interfaces are compiled in
|
373
373
|
*/
|
374
|
-
#if
|
374
|
+
#if @WITH_SCHEMATRON@
|
375
375
|
#define LIBXML_SCHEMATRON_ENABLED
|
376
376
|
#endif
|
377
377
|
|
@@ -380,14 +380,14 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
380
380
|
*
|
381
381
|
* Whether the module interfaces are compiled in
|
382
382
|
*/
|
383
|
-
#if
|
383
|
+
#if @WITH_MODULES@
|
384
384
|
#define LIBXML_MODULES_ENABLED
|
385
385
|
/**
|
386
386
|
* LIBXML_MODULE_EXTENSION:
|
387
387
|
*
|
388
388
|
* the string suffix used by dynamic modules (usually shared libraries)
|
389
389
|
*/
|
390
|
-
#define LIBXML_MODULE_EXTENSION "
|
390
|
+
#define LIBXML_MODULE_EXTENSION "@MODULE_EXTENSION@"
|
391
391
|
#endif
|
392
392
|
|
393
393
|
/**
|
@@ -395,7 +395,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
395
395
|
*
|
396
396
|
* Whether the Zlib support is compiled in
|
397
397
|
*/
|
398
|
-
#if
|
398
|
+
#if @WITH_ZLIB@
|
399
399
|
#define LIBXML_ZLIB_ENABLED
|
400
400
|
#endif
|
401
401
|
|
@@ -404,7 +404,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
404
404
|
*
|
405
405
|
* Whether the Lzma support is compiled in
|
406
406
|
*/
|
407
|
-
#if
|
407
|
+
#if @WITH_LZMA@
|
408
408
|
#define LIBXML_LZMA_ENABLED
|
409
409
|
#endif
|
410
410
|
|
@@ -5,7 +5,7 @@ extern VALUE cNokolexborNode;
|
|
5
5
|
VALUE cNokolexborDocument;
|
6
6
|
|
7
7
|
static void
|
8
|
-
free_nl_document(
|
8
|
+
free_nl_document(lxb_html_document_t *document)
|
9
9
|
{
|
10
10
|
lxb_html_document_destroy(document);
|
11
11
|
}
|
@@ -25,7 +25,7 @@ static VALUE
|
|
25
25
|
nl_document_parse(VALUE self, VALUE rb_html)
|
26
26
|
{
|
27
27
|
const char *html_c = StringValuePtr(rb_html);
|
28
|
-
|
28
|
+
size_t html_len = RSTRING_LEN(rb_html);
|
29
29
|
|
30
30
|
lxb_html_document_t *document;
|
31
31
|
|
@@ -35,13 +35,13 @@ nl_document_parse(VALUE self, VALUE rb_html)
|
|
35
35
|
rb_raise(rb_eRuntimeError, "Error creating document");
|
36
36
|
}
|
37
37
|
|
38
|
-
lxb_status_t status = lxb_html_document_parse(document, html_c, html_len);
|
38
|
+
lxb_status_t status = lxb_html_document_parse(document, (const lxb_char_t *)html_c, html_len);
|
39
39
|
if (status != LXB_STATUS_OK)
|
40
40
|
{
|
41
41
|
nl_raise_lexbor_error(status);
|
42
42
|
}
|
43
43
|
|
44
|
-
return TypedData_Wrap_Struct(cNokolexborDocument, &nl_document_type,
|
44
|
+
return TypedData_Wrap_Struct(cNokolexborDocument, &nl_document_type, document);
|
45
45
|
}
|
46
46
|
|
47
47
|
static VALUE
|
@@ -50,6 +50,14 @@ nl_document_new(VALUE self)
|
|
50
50
|
return nl_document_parse(self, rb_str_new("", 0));
|
51
51
|
}
|
52
52
|
|
53
|
+
lxb_dom_document_t *
|
54
|
+
nl_rb_document_unwrap(VALUE rb_doc)
|
55
|
+
{
|
56
|
+
lxb_dom_document_t *doc;
|
57
|
+
TypedData_Get_Struct(rb_doc, lxb_dom_document_t, &nl_document_type, doc);
|
58
|
+
return doc;
|
59
|
+
}
|
60
|
+
|
53
61
|
void Init_nl_document(void)
|
54
62
|
{
|
55
63
|
cNokolexborDocument = rb_define_class_under(mNokolexbor, "Document", cNokolexborNode);
|