libxml-ruby 0.6.0-x86-mswin32-60
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.
- data/CHANGES +122 -0
- data/LICENSE +23 -0
- data/README +144 -0
- data/ext/libxml/cbg.c +76 -0
- data/ext/libxml/extconf.rb +308 -0
- data/ext/libxml/libxml.c +62 -0
- data/ext/libxml/ruby_libxml.h +93 -0
- data/ext/libxml/ruby_xml_attr.c +405 -0
- data/ext/libxml/ruby_xml_attr.h +19 -0
- data/ext/libxml/ruby_xml_document.c +1111 -0
- data/ext/libxml/ruby_xml_document.h +27 -0
- data/ext/libxml/ruby_xml_dtd.c +168 -0
- data/ext/libxml/ruby_xml_dtd.h +17 -0
- data/ext/libxml/ruby_xml_html_parser.c +449 -0
- data/ext/libxml/ruby_xml_html_parser.h +29 -0
- data/ext/libxml/ruby_xml_input_cbg.c +158 -0
- data/ext/libxml/ruby_xml_input_cbg.h +20 -0
- data/ext/libxml/ruby_xml_node.c +2410 -0
- data/ext/libxml/ruby_xml_node.h +27 -0
- data/ext/libxml/ruby_xml_node_set.c +170 -0
- data/ext/libxml/ruby_xml_node_set.h +20 -0
- data/ext/libxml/ruby_xml_ns.c +153 -0
- data/ext/libxml/ruby_xml_ns.h +21 -0
- data/ext/libxml/ruby_xml_parser.c +1425 -0
- data/ext/libxml/ruby_xml_parser.h +31 -0
- data/ext/libxml/ruby_xml_parser_context.c +750 -0
- data/ext/libxml/ruby_xml_parser_context.h +22 -0
- data/ext/libxml/ruby_xml_reader.c +900 -0
- data/ext/libxml/ruby_xml_reader.h +14 -0
- data/ext/libxml/ruby_xml_sax_parser.c +485 -0
- data/ext/libxml/ruby_xml_sax_parser.h +56 -0
- data/ext/libxml/ruby_xml_schema.c +146 -0
- data/ext/libxml/ruby_xml_schema.h +16 -0
- data/ext/libxml/ruby_xml_state.c +113 -0
- data/ext/libxml/ruby_xml_state.h +12 -0
- data/ext/libxml/ruby_xml_tree.c +43 -0
- data/ext/libxml/ruby_xml_tree.h +12 -0
- data/ext/libxml/ruby_xml_xinclude.c +20 -0
- data/ext/libxml/ruby_xml_xinclude.h +13 -0
- data/ext/libxml/ruby_xml_xpath.c +243 -0
- data/ext/libxml/ruby_xml_xpath.h +23 -0
- data/ext/libxml/ruby_xml_xpath_context.c +118 -0
- data/ext/libxml/ruby_xml_xpath_context.h +20 -0
- data/ext/libxml/ruby_xml_xpath_object.c +293 -0
- data/ext/libxml/ruby_xml_xpath_object.h +28 -0
- data/ext/libxml/ruby_xml_xpointer.c +100 -0
- data/ext/libxml/ruby_xml_xpointer.h +27 -0
- data/ext/libxml/ruby_xml_xpointer_context.c +21 -0
- data/ext/libxml/ruby_xml_xpointer_context.h +18 -0
- data/ext/libxml/sax_parser_callbacks.inc +213 -0
- data/ext/libxml/version.h +9 -0
- data/lib/libxml.rb +125 -0
- data/lib/libxml_ruby.so +0 -0
- data/lib/xml/libxml.rb +5 -0
- data/mingw/libiconv-2.dll +0 -0
- data/mingw/libxml2-2.dll +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/mingw/mingw.rake +36 -0
- data/test/dtd-test.rb +24 -0
- data/test/etc_doc_to_s.rb +19 -0
- data/test/ets_copy_bug.rb +21 -0
- data/test/ets_copy_bug2.rb +32 -0
- data/test/ets_copy_bug3.rb +38 -0
- data/test/ets_doc_file.rb +15 -0
- data/test/ets_doc_to_s.rb +21 -0
- data/test/ets_gpx.rb +26 -0
- data/test/ets_node_gc.rb +21 -0
- data/test/ets_test.xml +2 -0
- data/test/ets_tsr.rb +9 -0
- data/test/gc.log +0 -0
- data/test/merge_bug.rb +55 -0
- data/test/schema-test.rb +74 -0
- data/test/tc_well_formed.rb +11 -0
- data/test/tc_xml_document.rb +52 -0
- data/test/tc_xml_document_write.rb +24 -0
- data/test/tc_xml_document_write2.rb +54 -0
- data/test/tc_xml_document_write3.rb +96 -0
- data/test/tc_xml_html_parser.rb +63 -0
- data/test/tc_xml_node.rb +59 -0
- data/test/tc_xml_node2.rb +25 -0
- data/test/tc_xml_node3.rb +27 -0
- data/test/tc_xml_node4.rb +86 -0
- data/test/tc_xml_node5.rb +52 -0
- data/test/tc_xml_node6.rb +27 -0
- data/test/tc_xml_node7.rb +35 -0
- data/test/tc_xml_node8.rb +32 -0
- data/test/tc_xml_node9.rb +32 -0
- data/test/tc_xml_node_copy.rb +40 -0
- data/test/tc_xml_node_set.rb +24 -0
- data/test/tc_xml_node_set2.rb +37 -0
- data/test/tc_xml_node_text.rb +17 -0
- data/test/tc_xml_node_xlink.rb +28 -0
- data/test/tc_xml_parser.rb +190 -0
- data/test/tc_xml_parser2.rb +16 -0
- data/test/tc_xml_parser3.rb +23 -0
- data/test/tc_xml_parser4.rb +33 -0
- data/test/tc_xml_parser5.rb +27 -0
- data/test/tc_xml_parser6.rb +23 -0
- data/test/tc_xml_parser7.rb +28 -0
- data/test/tc_xml_parser8.rb +32 -0
- data/test/tc_xml_parser9.rb +11 -0
- data/test/tc_xml_parser_context.rb +88 -0
- data/test/tc_xml_reader.rb +112 -0
- data/test/tc_xml_sax_parser.rb +104 -0
- data/test/tc_xml_sax_parser2.rb +51 -0
- data/test/tc_xml_xinclude.rb +30 -0
- data/test/tc_xml_xpath.rb +38 -0
- data/test/tc_xml_xpath2.rb +14 -0
- data/test/tc_xml_xpointer.rb +78 -0
- data/vc/libxml.sln +20 -0
- data/vc/libxml.vcproj +389 -0
- data/work/Rakefile +247 -0
- data/work/task/make +26 -0
- data/work/task/memory +37 -0
- data/work/task/rdoc +39 -0
- data/work/task/setup +1616 -0
- data/work/task/test +29 -0
- data/work/test/ets_runner.rb +33 -0
- data/work/test/libxml_test.rb +3 -0
- data/work/test/runner.rb +0 -0
- data/work/test/runner_ets.rb +33 -0
- data/work/vc/debug/libxml.exp +0 -0
- data/work/vc/debug/libxml.ilk +0 -0
- data/work/vc/debug/libxml.lib +0 -0
- data/work/vc/debug/libxml.pdb +0 -0
- data/work/vc/debug/libxml.so +0 -0
- metadata +224 -0
data/CHANGES
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
(See log/ChangeLog for more detailed changes derived directly from source control.)
|
2
|
+
|
3
|
+
== 0.5.3 /
|
4
|
+
|
5
|
+
=== 2007-11-16 "Dan Janowski" <danj at 3skel.com>
|
6
|
+
|
7
|
+
* Merged Dan's MEM2 branch to trunk.
|
8
|
+
|
9
|
+
|
10
|
+
== 0.5.2 / 2007-10-10
|
11
|
+
|
12
|
+
=== 2007-10-10 "Dan Janowski" <danj at 3skel.com>
|
13
|
+
|
14
|
+
* (Dan, fill in the major points of the changes you made up to here -thanks)
|
15
|
+
|
16
|
+
=== 2007-01-14 "Laurent Sansonetti" <lrz at chopine.be>
|
17
|
+
|
18
|
+
* Added some preliminary RDoc comments for XML::Reader.
|
19
|
+
|
20
|
+
=== 2006-12-05 "Laurent Sansonetti" <lrz at chopine.be>
|
21
|
+
|
22
|
+
* Added XML::Reader, a set of bindings to the xmlTextReader API.
|
23
|
+
|
24
|
+
|
25
|
+
== 0.3.8.4 / 2006-12-02
|
26
|
+
|
27
|
+
=== 2006-04-15 "Ross Bamform" <rosco at roscopeco.co.uk>
|
28
|
+
|
29
|
+
* Implemented SAX parser callback handling.
|
30
|
+
|
31
|
+
=== 2006-04-12 "Ross Bamford" <rosco at roscopeco.co.uk>
|
32
|
+
|
33
|
+
* Integrated and tested community patches.
|
34
|
+
* Defined XML::Node (hash) equality in terms of XML representation.
|
35
|
+
|
36
|
+
=== 2006-04-12 "Tim Yamin" <plasmaroo at gentoo.org>
|
37
|
+
|
38
|
+
* Fixed XML::Node#content inoperable bug (plasmaroo) [patch]
|
39
|
+
* Fixed memory leak in same
|
40
|
+
|
41
|
+
=== 2006-04-12 "Mark Van Holstyn" <mvette13 at gmail.com>
|
42
|
+
|
43
|
+
* Added XML::Node::Set#first (mvette13) [patch]
|
44
|
+
* Added XML::Node::Set#empty?
|
45
|
+
* Fixed XML::Node::Set#to_a
|
46
|
+
* Added XML::Node#find_first
|
47
|
+
* Added XML::Node#remove!
|
48
|
+
|
49
|
+
=== 2006-03-27 "Ross Bamford" <rosco at roscopeco.co.uk>
|
50
|
+
|
51
|
+
* Integrated contributed XML::Parser.register_error_handler patch (rosco)
|
52
|
+
|
53
|
+
=== 2006-02-27 "Ross Bamford" <rosco at roscopeco.co.uk>
|
54
|
+
|
55
|
+
* Fixed all multiple symbol definitions for -fno-common.
|
56
|
+
* Removed OSX -fno-common workaround.
|
57
|
+
|
58
|
+
|
59
|
+
== 0.3.6 / 2006-02-23
|
60
|
+
|
61
|
+
=== 2006-02-21 "Ross Bamford" <rosco at roscopeco.co.uk>
|
62
|
+
|
63
|
+
* Patched extconf.rb with OSX -fno-common workaround
|
64
|
+
* Added gem and packaging support to Rakefile
|
65
|
+
* Moved version update to Rakefile
|
66
|
+
* Removed legacy project utility scripts
|
67
|
+
|
68
|
+
=== 2005-02-19 "Ross Bamford" <rosco at roscopeco.co.uk>
|
69
|
+
|
70
|
+
* Fixed doublefree bug in ruby_xml_attr.
|
71
|
+
* Fixed small leak in parser
|
72
|
+
|
73
|
+
=== 2005-12-18 "Ross Bamford" <rosco at roscopeco.co.uk>
|
74
|
+
|
75
|
+
* Updated for GCC 4.0 (community patches)
|
76
|
+
* Fixed default validation bug
|
77
|
+
* Refactored project, removed outdated files, cleaned up tests.
|
78
|
+
* Added RDoc documentation across .c files.
|
79
|
+
* Fixed up a few strings.
|
80
|
+
|
81
|
+
=== 2004-04-04 "Mangler Jurgen" <et@wkv.at>
|
82
|
+
|
83
|
+
* ruby_xml_node.cz: fixed ruby_xml_node_property_set. The ill-behaviour
|
84
|
+
was, that there was added a second attribute of the same
|
85
|
+
name, when you were setting the value of an already existing
|
86
|
+
attribute.
|
87
|
+
|
88
|
+
=== 2004-03-17 "Lukas Svoboda" <luks@fi.muni.cz>
|
89
|
+
|
90
|
+
* ruby_xml_node.c: ruby_xml_node_to_s now returns XML subtree dump.
|
91
|
+
|
92
|
+
=== 2004-02-27 "Martin Povolny" <martin@solnet.cz>
|
93
|
+
|
94
|
+
* ruby_xml_node.c: added XML::Node.copy, this makes possible building
|
95
|
+
of xml documents from nodes taken from other xml documents
|
96
|
+
without making ruby SIGSEGV (see tests/copy_bug.rb).
|
97
|
+
|
98
|
+
=== 2004-02-26 "Martin Povolny" <martin@solnet.cz>
|
99
|
+
|
100
|
+
* ruby_xml_dtd.c, ruby_xml_dtd.h, ruby_xml_schema.c, ruby_xml_schema.h:
|
101
|
+
more work on validation, now you can actually validate
|
102
|
+
document using dtd or xml schema, also solved warning and
|
103
|
+
error propagation (see tests/{dtd|schema}-test.rb).
|
104
|
+
|
105
|
+
=== 2003-12-30 "Martin Povolny" <martin@solnet.cz>
|
106
|
+
|
107
|
+
* ruby_xml_dtd.c, ruby_xml_dtd.h, ruby_xml_schema.c, ruby_xml_schema.h:
|
108
|
+
prelimitary support for dtd and schema validation
|
109
|
+
|
110
|
+
=== 2003-09-15 "Martin Povolny" <martin@solnet.cz>
|
111
|
+
|
112
|
+
* ruby_xml_input_cbg.c, libxml.c: added class InputCallbacks to make
|
113
|
+
possible registering custom input callbacks
|
114
|
+
handlers (xmlRegisterInputCallbacks) written in ruby
|
115
|
+
|
116
|
+
=== 2003-08-01 "Martin Povolny" <martin@solnet.cz>
|
117
|
+
|
118
|
+
* ruby_xml_document.c: corrected argument handling in ruby_xml_document_find
|
119
|
+
* ruby_xml_node.c: corrected argument handling in ruby_xml_node_find
|
120
|
+
|
121
|
+
|
122
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
LibXML-Ruby
|
2
|
+
|
3
|
+
Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
|
4
|
+
Copyright (c) 2001 Wai-Sun "Squidster" Chia <waisun.chia@compaq.com>
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
+
this software and associated documentation files (the "Software"), to deal in
|
8
|
+
the Software without restriction, including without limitation the rights to
|
9
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
10
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
11
|
+
so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
23
|
+
|
data/README
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
== INSTALLATION
|
2
|
+
|
3
|
+
Installation is simple. Follow the following steps:
|
4
|
+
|
5
|
+
=== Rubygems
|
6
|
+
|
7
|
+
gem install libxml-ruby
|
8
|
+
|
9
|
+
=== Tarball/zip
|
10
|
+
|
11
|
+
$ rake test
|
12
|
+
$ rake install
|
13
|
+
|
14
|
+
If extconf yacks up an error, follow the instructions it provides.
|
15
|
+
You will need to chdir to ext/xml and run 'ruby extconf.rb' to provide
|
16
|
+
options, after which you can either use Rake for everything or
|
17
|
+
do with make (make && make install).
|
18
|
+
|
19
|
+
Once installed, look at the test scripts (tests/*.rb), and run
|
20
|
+
'rake doc' to generate API documentation.
|
21
|
+
You can find the latest documentation at:
|
22
|
+
|
23
|
+
* http://libxml.rubyforge.org/doc
|
24
|
+
|
25
|
+
== DEPENDENCIES
|
26
|
+
|
27
|
+
libxml requires a few other libraries to be installed inorder to
|
28
|
+
function properly.
|
29
|
+
|
30
|
+
* libm (math routines: very standard)
|
31
|
+
* libz (zlib)
|
32
|
+
* libiconv
|
33
|
+
* libxml2
|
34
|
+
|
35
|
+
== USAGE
|
36
|
+
|
37
|
+
Basic usage for reading and writing documents.
|
38
|
+
|
39
|
+
=== WRITING
|
40
|
+
|
41
|
+
Writing a simple document:
|
42
|
+
|
43
|
+
# require 'rubygems' # if installed via Gems
|
44
|
+
require 'xml/libxml'
|
45
|
+
|
46
|
+
doc = XML::Document.new()
|
47
|
+
doc.root = XML::Node.new('root_node')
|
48
|
+
root = doc.root
|
49
|
+
|
50
|
+
root << elem1 = XML::Node.new('elem1')
|
51
|
+
elem1['attr1'] = 'val1'
|
52
|
+
elem1['attr2'] = 'val2'
|
53
|
+
|
54
|
+
root << elem2 = XML::Node.new('elem2')
|
55
|
+
elem2['attr1'] = 'val1'
|
56
|
+
elem2['attr2'] = 'val2'
|
57
|
+
|
58
|
+
root << elem3 = XML::Node.new('elem3')
|
59
|
+
elem3 << elem4 = XML::Node.new('elem4')
|
60
|
+
elem3 << elem5 = XML::Node.new('elem5')
|
61
|
+
|
62
|
+
elem5 << elem6 = XML::Node.new('elem6')
|
63
|
+
elem6 << 'Content for element 6'
|
64
|
+
|
65
|
+
elem3['attr'] = 'baz'
|
66
|
+
|
67
|
+
# Namespace hack to reduce the numer of times XML:: is typed
|
68
|
+
include XML
|
69
|
+
root << elem7 = Node.new('foo')
|
70
|
+
1.upto(10) do |i|
|
71
|
+
elem7 << n = Node.new('bar')
|
72
|
+
n << i
|
73
|
+
end
|
74
|
+
|
75
|
+
format = true
|
76
|
+
doc.save('output.xml', format)
|
77
|
+
|
78
|
+
The file output.xml contains:
|
79
|
+
|
80
|
+
<?xml version="1.0"?>
|
81
|
+
<root_node>
|
82
|
+
<elem1 attr1="val1" attr2="val2"/>
|
83
|
+
<elem2 attr1="val1" attr2="val2"/>
|
84
|
+
<elem3 attr="baz">
|
85
|
+
<elem4/>
|
86
|
+
<elem5>
|
87
|
+
<elem6>Content for element 6</elem6>
|
88
|
+
</elem5>
|
89
|
+
</elem3>
|
90
|
+
<foo>
|
91
|
+
<bar>1</bar>
|
92
|
+
<bar>2</bar>
|
93
|
+
<bar>3</bar>
|
94
|
+
<bar>4</bar>
|
95
|
+
<bar>5</bar>
|
96
|
+
<bar>6</bar>
|
97
|
+
<bar>7</bar>
|
98
|
+
<bar>8</bar>
|
99
|
+
<bar>9</bar>
|
100
|
+
<bar>10</bar>
|
101
|
+
</foo>
|
102
|
+
</root_node>
|
103
|
+
|
104
|
+
=== READING
|
105
|
+
|
106
|
+
Reading XML is slightly more complex and there are many more ways to
|
107
|
+
perform this operation. This reads in and processes the above
|
108
|
+
generated XML document, output.xml. This script assumes that the
|
109
|
+
structure of the document is already known.
|
110
|
+
|
111
|
+
# require 'rubygems' # if installed via Gems
|
112
|
+
require 'xml/libxml'
|
113
|
+
doc = XML::Document.file('output.xml')
|
114
|
+
root = doc.root
|
115
|
+
|
116
|
+
puts "Root element name: #{root.name}"
|
117
|
+
|
118
|
+
elem3 = root.find('elem3').to_a.first
|
119
|
+
puts "Elem3: #{elem3['attr']}"
|
120
|
+
|
121
|
+
doc.find('//root_node/foo/bar').each do |node|
|
122
|
+
puts "Node path: #{node.path} \t Contents: #{node.content}"
|
123
|
+
end
|
124
|
+
|
125
|
+
And your terminal should look like:
|
126
|
+
|
127
|
+
Root element name: root_node
|
128
|
+
Elem3: baz
|
129
|
+
Node path: /root_node/foo/bar[1] Contents: 1
|
130
|
+
Node path: /root_node/foo/bar[2] Contents: 2
|
131
|
+
Node path: /root_node/foo/bar[3] Contents: 3
|
132
|
+
Node path: /root_node/foo/bar[4] Contents: 4
|
133
|
+
Node path: /root_node/foo/bar[5] Contents: 5
|
134
|
+
Node path: /root_node/foo/bar[6] Contents: 6
|
135
|
+
Node path: /root_node/foo/bar[7] Contents: 7
|
136
|
+
Node path: /root_node/foo/bar[8] Contents: 8
|
137
|
+
Node path: /root_node/foo/bar[9] Contents: 9
|
138
|
+
Node path: /root_node/foo/bar[10] Contents: 10
|
139
|
+
|
140
|
+
== MORE INFORMATION
|
141
|
+
|
142
|
+
If you have any questions, please send email to libxml-devel@rubyforge.org.
|
143
|
+
|
144
|
+
# $Id: README 143 2007-08-29 21:45:48Z transami $
|
data/ext/libxml/cbg.c
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
#include <string.h>
|
2
|
+
#include <libxml/xmlIO.h>
|
3
|
+
#include "ruby.h"
|
4
|
+
|
5
|
+
/*
|
6
|
+
int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
7
|
+
xmlInputOpenCallback openFunc,
|
8
|
+
xmlInputReadCallback readFunc,
|
9
|
+
xmlInputCloseCallback closeFunc);
|
10
|
+
|
11
|
+
|
12
|
+
int (*xmlInputMatchCallback) (char const *filename);
|
13
|
+
void* (*xmlInputOpenCallback) (char const *filename);
|
14
|
+
int (*xmlInputReadCallback) (void *context,
|
15
|
+
char *buffer,
|
16
|
+
int len);
|
17
|
+
int (*xmlInputCloseCallback) (void *context);
|
18
|
+
*/
|
19
|
+
|
20
|
+
typedef struct deb_doc_context {
|
21
|
+
char *buffer;
|
22
|
+
char *bpos;
|
23
|
+
int remaining;
|
24
|
+
} deb_doc_context;
|
25
|
+
|
26
|
+
int deb_Match (char const *filename) {
|
27
|
+
fprintf( stderr, "deb_Match: %s\n", filename );
|
28
|
+
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6)) {
|
29
|
+
return(1);
|
30
|
+
}
|
31
|
+
return(0);
|
32
|
+
}
|
33
|
+
|
34
|
+
void* deb_Open (char const *filename) {
|
35
|
+
deb_doc_context *deb_doc;
|
36
|
+
VALUE res;
|
37
|
+
|
38
|
+
deb_doc = (deb_doc_context*)malloc( sizeof(deb_doc_context) );
|
39
|
+
|
40
|
+
res = rb_funcall( rb_funcall( rb_mKernel, rb_intern("const_get"), 1, rb_str_new2("DEBSystem") ),
|
41
|
+
rb_intern("document_query"), 1, rb_str_new2(filename));
|
42
|
+
deb_doc->buffer = strdup( StringValuePtr(res) );
|
43
|
+
//deb_doc->buffer = strdup("<serepes>serepes</serepes>");
|
44
|
+
|
45
|
+
deb_doc->bpos = deb_doc->buffer;
|
46
|
+
deb_doc->remaining = strlen(deb_doc->buffer);
|
47
|
+
return deb_doc;
|
48
|
+
}
|
49
|
+
|
50
|
+
int deb_Read (void *context, char *buffer, int len) {
|
51
|
+
deb_doc_context *deb_doc;
|
52
|
+
int ret_len;
|
53
|
+
deb_doc = (deb_doc_context*)context;
|
54
|
+
|
55
|
+
if (len >= deb_doc->remaining) {
|
56
|
+
ret_len = deb_doc->remaining;
|
57
|
+
} else {
|
58
|
+
ret_len = len;
|
59
|
+
}
|
60
|
+
deb_doc->remaining -= ret_len;
|
61
|
+
strncpy( buffer, deb_doc->bpos, ret_len );
|
62
|
+
deb_doc->bpos += ret_len;
|
63
|
+
|
64
|
+
return ret_len;
|
65
|
+
}
|
66
|
+
|
67
|
+
int deb_Close (void *context) {
|
68
|
+
free( ((deb_doc_context*)context)->buffer );
|
69
|
+
free( context );
|
70
|
+
return 1;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
void deb_register_cbg() {
|
75
|
+
xmlRegisterInputCallbacks( deb_Match, deb_Open, deb_Read, deb_Close );
|
76
|
+
}
|
@@ -0,0 +1,308 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
def method_missing(s, *args)
|
6
|
+
if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
|
7
|
+
return v
|
8
|
+
else
|
9
|
+
puts "missing: #{s}"
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
if RUBY_PLATFORM =~ /win32/ # FIXME: Make more robust
|
16
|
+
|
17
|
+
# We can't use Ruby's standard build procedures
|
18
|
+
# on Windows because the Ruby executable is
|
19
|
+
# built with VC++ while here we want to build
|
20
|
+
# with MingW. So just roll our own...
|
21
|
+
|
22
|
+
target = "libxml"
|
23
|
+
|
24
|
+
#RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
25
|
+
#RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
26
|
+
#RUBY_LIB_DIR = Config::CONFIG["libdir"]
|
27
|
+
#RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
|
28
|
+
#RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
|
29
|
+
|
30
|
+
#CLEAN.include('*.o')
|
31
|
+
#CLOBBER.include('ruby_prof.so')
|
32
|
+
|
33
|
+
srcs = Dir['../ext/*.c']
|
34
|
+
|
35
|
+
objs = srcs.collect do |srcfile|
|
36
|
+
srcfile = File.basename(srcfile)
|
37
|
+
srcfile.chomp(File.extname(srcfile) + '.o')
|
38
|
+
end
|
39
|
+
|
40
|
+
#srcs.each do |srcfile|
|
41
|
+
# srcfile = File.basename(srcfile)
|
42
|
+
# objfile = srcfile.chomp(File.extname(srcfile) + '.o')
|
43
|
+
#
|
44
|
+
# if File.mtime(objfile) < File.mtime(srcfile)
|
45
|
+
# system "gcc -c -fPIC -O2 -Wall -o #{objfile} #{srcfile} -I#{RUBY_INCLUDE_DIR}"
|
46
|
+
# end
|
47
|
+
#end
|
48
|
+
|
49
|
+
#system "gcc -shared -o #{LIBNAME} #{obj} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
|
50
|
+
|
51
|
+
makefile_template = DATA.read
|
52
|
+
makefile = eval(makefile_template)
|
53
|
+
|
54
|
+
File.open('Makefile', 'w'){ |f| f << makefile }
|
55
|
+
|
56
|
+
else
|
57
|
+
|
58
|
+
require 'mkmf'
|
59
|
+
|
60
|
+
if defined?(CFLAGS)
|
61
|
+
if CFLAGS.index(CONFIG['CCDLFLAGS'])
|
62
|
+
$CFLAGS = CFLAGS
|
63
|
+
else
|
64
|
+
$CFLAGS = CFLAGS + ' ' + CONFIG['CCDLFLAGS']
|
65
|
+
end
|
66
|
+
else
|
67
|
+
$CFLAGS = CONFIG['CFLAGS']
|
68
|
+
end
|
69
|
+
$LDFLAGS = CONFIG['LDFLAGS']
|
70
|
+
$LIBPATH.push(Config::CONFIG['libdir'])
|
71
|
+
|
72
|
+
def crash(str)
|
73
|
+
printf(" extconf failure: %s\n", str)
|
74
|
+
exit 1
|
75
|
+
end
|
76
|
+
|
77
|
+
dir_config('iconv')
|
78
|
+
dir_config('xml2')
|
79
|
+
dir_config('zlib')
|
80
|
+
|
81
|
+
have_library('socket','socket')
|
82
|
+
have_library('nsl','gethostbyname')
|
83
|
+
|
84
|
+
unless have_library('m', 'atan')
|
85
|
+
# try again for gcc 4.0
|
86
|
+
saveflags = $CFLAGS
|
87
|
+
$CFLAGS += ' -fno-builtin'
|
88
|
+
unless have_library('m', 'atan')
|
89
|
+
crash('need libm')
|
90
|
+
end
|
91
|
+
$CFLAGS = saveflags
|
92
|
+
end
|
93
|
+
|
94
|
+
unless have_library('z', 'inflate') or
|
95
|
+
have_library('zlib', 'inflate') or
|
96
|
+
have_library('zlib1', 'inflate')
|
97
|
+
crash('need zlib')
|
98
|
+
else
|
99
|
+
$defs.push('-DHAVE_ZLIB_H')
|
100
|
+
end
|
101
|
+
|
102
|
+
unless have_library('iconv','iconv_open') or
|
103
|
+
have_library('iconv','libiconv_open') or
|
104
|
+
have_library('libiconv', 'libiconv_open') or
|
105
|
+
have_library('libiconv', 'iconv_open') or
|
106
|
+
have_library('c','iconv_open') or
|
107
|
+
have_library('recode','iconv_open') or
|
108
|
+
have_library('iconv')
|
109
|
+
crash(<<EOL)
|
110
|
+
need libiconv.
|
111
|
+
|
112
|
+
Install the libiconv or try passing one of the following options
|
113
|
+
to extconf.rb:
|
114
|
+
|
115
|
+
--with-iconv-dir=/path/to/iconv
|
116
|
+
--with-iconv-lib=/path/to/iconv/lib
|
117
|
+
--with-iconv-include=/path/to/iconv/include
|
118
|
+
EOL
|
119
|
+
end
|
120
|
+
|
121
|
+
unless (have_library('xml2', 'xmlParseDoc') or
|
122
|
+
have_library('libxml2', 'xmlParseDoc') or
|
123
|
+
find_library('xml2', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
124
|
+
(have_header('libxml/xmlversion.h') or
|
125
|
+
find_header('libxml/xmlversion.h',
|
126
|
+
"#{CONFIG['prefix']}/include",
|
127
|
+
'/opt/include/libxml2',
|
128
|
+
'/usr/local/include/libxml2',
|
129
|
+
'/usr/include/libxml2'))
|
130
|
+
crash(<<EOL)
|
131
|
+
need libxml2.
|
132
|
+
|
133
|
+
Install the library or try one of the following options to extconf.rb:
|
134
|
+
|
135
|
+
--with-xml2-dir=/path/to/libxml2
|
136
|
+
--with-xml2-lib=/path/to/libxml2/lib
|
137
|
+
--with-xml2-include=/path/to/libxml2/include
|
138
|
+
EOL
|
139
|
+
end
|
140
|
+
|
141
|
+
unless have_func('xmlDocFormatDump')
|
142
|
+
crash('Your version of libxml2 is too old. Please upgrade.')
|
143
|
+
end
|
144
|
+
|
145
|
+
unless have_func('docbCreateFileParserCtxt')
|
146
|
+
crash('Need docbCreateFileParserCtxt')
|
147
|
+
end
|
148
|
+
|
149
|
+
$CFLAGS << ' ' << $INCFLAGS
|
150
|
+
#$INSTALLFILES = [["libxml.rb", "$(RUBYLIBDIR)", "../xml"]]
|
151
|
+
|
152
|
+
create_header()
|
153
|
+
create_makefile('libxml_ruby')
|
154
|
+
end
|
155
|
+
|
156
|
+
__END__
|
157
|
+
|
158
|
+
SHELL = /bin/sh
|
159
|
+
|
160
|
+
#### Start of system configuration section. ####
|
161
|
+
|
162
|
+
# I think we can remove all the parts related to the install target
|
163
|
+
# since setup.rb and RubyGems handles that on their own. Correct?
|
164
|
+
|
165
|
+
srcdir = .
|
166
|
+
topdir = #{archdir} #/usr/lib/ruby/1.8/x86_64-linux
|
167
|
+
hdrdir = $(topdir)
|
168
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
169
|
+
prefix = $(DESTDIR)/usr
|
170
|
+
exec_prefix = $(DESTDIR)/usr
|
171
|
+
sitedir = $(DESTDIR)/usr/local/lib/site_ruby
|
172
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
173
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
174
|
+
dvidir = $(docdir)
|
175
|
+
datarootdir = $(prefix)/share
|
176
|
+
archdir = $(rubylibdir)/$(arch)
|
177
|
+
sbindir = $(exec_prefix)/sbin
|
178
|
+
psdir = $(docdir)
|
179
|
+
localedir = $(datarootdir)/locale
|
180
|
+
htmldir = $(docdir)
|
181
|
+
datadir = $(datarootdir)
|
182
|
+
includedir = $(prefix)/include
|
183
|
+
infodir = $(prefix)/share/info
|
184
|
+
sysconfdir = $(DESTDIR)/etc
|
185
|
+
mandir = $(prefix)/share/man
|
186
|
+
libdir = $(DESTDIR)/usr/lib
|
187
|
+
sharedstatedir = $(prefix)/com
|
188
|
+
oldincludedir = $(DESTDIR)/usr/include
|
189
|
+
pdfdir = $(docdir)
|
190
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
191
|
+
bindir = $(exec_prefix)/bin
|
192
|
+
localstatedir = $(DESTDIR)/var
|
193
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
194
|
+
libexecdir = $(prefix)/lib/ruby1.8
|
195
|
+
|
196
|
+
CC = cc
|
197
|
+
LIBRUBY = $(LIBRUBY_SO)
|
198
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
199
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
200
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
201
|
+
|
202
|
+
RUBY_EXTCONF_H = extconf.h
|
203
|
+
CFLAGS = -fPIC -fno-strict-aliasing -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
|
204
|
+
INCFLAGS = -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/include/libxml2
|
205
|
+
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\"
|
206
|
+
CXXFLAGS = $(CFLAGS)
|
207
|
+
DLDFLAGS = -L. -rdynamic -Wl,-export-dynamic
|
208
|
+
LDSHARED = $(CC) -shared
|
209
|
+
AR = ar
|
210
|
+
EXEEXT =
|
211
|
+
|
212
|
+
RUBY_INSTALL_NAME = ruby1.8
|
213
|
+
RUBY_SO_NAME = ruby1.8
|
214
|
+
arch = x86_64-linux
|
215
|
+
sitearch = x86_64-linux
|
216
|
+
ruby_version = 1.8
|
217
|
+
ruby = /usr/bin/ruby1.8
|
218
|
+
RUBY = $(ruby)
|
219
|
+
RM = rm -f
|
220
|
+
MAKEDIRS = mkdir -p
|
221
|
+
INSTALL = /usr/bin/install -c
|
222
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
223
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
224
|
+
COPY = cp
|
225
|
+
|
226
|
+
preload =
|
227
|
+
|
228
|
+
libpath = . $(libdir) /usr/lib
|
229
|
+
LIBPATH = -L"." -L"$(libdir)" -L"/usr/lib"
|
230
|
+
DEFFILE =
|
231
|
+
|
232
|
+
CLEANFILES =
|
233
|
+
DISTCLEANFILES =
|
234
|
+
|
235
|
+
extout =
|
236
|
+
extout_prefix =
|
237
|
+
target_prefix = /xml
|
238
|
+
LOCAL_LIBS =
|
239
|
+
LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lc -lz -lm -lnsl -lpthread -ldl -lcrypt -lm -lc
|
240
|
+
|
241
|
+
SRCS = #{srcs.join(' ')}
|
242
|
+
OBJS = #{objs.join(' ')}
|
243
|
+
|
244
|
+
TARGET = #{target}
|
245
|
+
DLLIB = $(TARGET).so
|
246
|
+
EXTSTATIC =
|
247
|
+
STATIC_LIB =
|
248
|
+
|
249
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
250
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
251
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
252
|
+
|
253
|
+
TARGET_SO = $(DLLIB)
|
254
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
255
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
256
|
+
|
257
|
+
all: $(DLLIB)
|
258
|
+
static: $(STATIC_LIB)
|
259
|
+
|
260
|
+
clean:
|
261
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
262
|
+
|
263
|
+
distclean: clean
|
264
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
265
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
266
|
+
|
267
|
+
realclean: distclean
|
268
|
+
install: install-so install-rb
|
269
|
+
|
270
|
+
install-so: $(RUBYARCHDIR)
|
271
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
272
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
273
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
274
|
+
install-rb: pre-install-rb install-rb-default
|
275
|
+
install-rb-default: pre-install-rb-default
|
276
|
+
pre-install-rb: Makefile
|
277
|
+
pre-install-rb-default: Makefile
|
278
|
+
$(RUBYARCHDIR):
|
279
|
+
$(MAKEDIRS) $@
|
280
|
+
|
281
|
+
site-install: site-install-so site-install-rb
|
282
|
+
site-install-so: install-so
|
283
|
+
site-install-rb: install-rb
|
284
|
+
|
285
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
286
|
+
|
287
|
+
.cc.o:
|
288
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
289
|
+
|
290
|
+
.cxx.o:
|
291
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
292
|
+
|
293
|
+
.cpp.o:
|
294
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
295
|
+
|
296
|
+
.C.o:
|
297
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
298
|
+
|
299
|
+
.c.o:
|
300
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
301
|
+
|
302
|
+
$(DLLIB): $(OBJS)
|
303
|
+
@-$(RM) $@
|
304
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
305
|
+
|
306
|
+
|
307
|
+
$(OBJS): ruby.h defines.h $(RUBY_EXTCONF_H)
|
308
|
+
|