blather 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/README.rdoc +2 -2
  2. data/Rakefile +30 -18
  3. data/ext/Makefile +149 -0
  4. data/ext/mkmf.log +30 -0
  5. data/ext/push_parser.bundle +0 -0
  6. data/ext/push_parser.c +231 -0
  7. data/ext/push_parser.o +0 -0
  8. data/lib/blather.rb +3 -7
  9. data/lib/blather/client.rb +247 -4
  10. data/lib/blather/roster.rb +0 -9
  11. data/lib/blather/stanza/{disco.rb → iq/disco.rb} +3 -1
  12. data/lib/blather/stanza/{disco → iq/discos}/disco_info.rb +5 -3
  13. data/lib/blather/stanza/{disco → iq/discos}/disco_items.rb +2 -0
  14. data/lib/blather/stanza/iq/query.rb +1 -1
  15. data/lib/blather/stanza/iq/roster.rb +2 -2
  16. data/lib/blather/xmpp_node.rb +1 -1
  17. data/spec/blather/stanza/{discos → iq/discos}/disco_info_spec.rb +12 -12
  18. data/spec/blather/stanza/{discos → iq/discos}/disco_items_spec.rb +1 -1
  19. data/spec/blather/stanza/iq/query_spec.rb +0 -7
  20. data/spec/blather/stanza/iq/roster_spec.rb +21 -21
  21. data/spec/blather/stanza/pubsub/event_spec.rb +13 -0
  22. data/spec/build_safe.rb +20 -0
  23. metadata +19 -68
  24. data/VERSION.yml +0 -4
  25. data/examples/pubsub/cli.rb +0 -64
  26. data/examples/pubsub/ping_pong.rb +0 -18
  27. data/examples/pubsub/pubsub_dsl.rb +0 -52
  28. data/examples/pubsub_client.rb +0 -39
  29. data/examples/rosterprint.rb +0 -14
  30. data/examples/xmpp4r/echo.rb +0 -35
  31. data/lib/blather/client/client.rb +0 -165
  32. data/lib/blather/client/dsl.rb +0 -99
  33. data/lib/blather/client/pubsub.rb +0 -53
  34. data/lib/blather/client/pubsub/node.rb +0 -27
  35. data/lib/blather/stanza/pubsub.rb +0 -33
  36. data/lib/blather/stanza/pubsub/affiliations.rb +0 -52
  37. data/lib/blather/stanza/pubsub/errors.rb +0 -9
  38. data/lib/blather/stanza/pubsub/event.rb +0 -21
  39. data/lib/blather/stanza/pubsub/items.rb +0 -59
  40. data/lib/blather/stanza/pubsub/owner.rb +0 -9
  41. data/lib/blather/stanza/pubsub/subscriptions.rb +0 -57
  42. data/spec/blather/stanza/pubsub/affiliations_spec.rb +0 -46
  43. data/spec/blather/stanza/pubsub/items_spec.rb +0 -59
  44. data/spec/blather/stanza/pubsub/subscriptions_spec.rb +0 -63
  45. data/spec/blather/stanza/pubsub_spec.rb +0 -26
  46. data/spec/fixtures/pubsub.rb +0 -157
data/README.rdoc CHANGED
@@ -67,7 +67,7 @@ There are 5 different types of guards:
67
67
  # Equivalent to stanza.chat?
68
68
  message :chat?
69
69
 
70
- # Hash with any value (:body => 'exit')
70
+ # Hash with value (:body => 'exit')
71
71
  # Calls the key on the stanza and checks for equality
72
72
  # Equivalent to stanza.body == 'exit'
73
73
  message :body => 'exit'
@@ -100,4 +100,4 @@ There are 5 different types of guards:
100
100
  = License
101
101
 
102
102
  Please see LICENSE
103
- The LibXML-Ruby license can be found in its directory
103
+ The LibXML-Ruby license can be found in its directory
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = 'blather'
8
- gem.description = gem.summary = 'An evented XMPP library written on EventMachine and libxml-ruby'
8
+ gem.summary = 'An evented XMPP library written on EventMachine and libxml-ruby'
9
9
 
10
10
  gem.email = 'sprsquish@gmail.com'
11
11
  gem.homepage = 'http://github.com/sprsquish/blather'
@@ -13,11 +13,13 @@ begin
13
13
 
14
14
  gem.rubyforge_project = 'squishtech'
15
15
 
16
- gem.extensions = %w[ext/extconf.rb]
16
+ gem.extensions = ['Rakefile']
17
17
 
18
18
  gem.add_dependency 'eventmachine', '>= 0.12.6'
19
19
  gem.add_dependency 'libxml-ruby', '>= 1.1.3'
20
20
 
21
+ gem.files = FileList['examples/**/*', 'lib/**/*', 'ext/*'].to_a
22
+
21
23
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
22
24
  end
23
25
  rescue LoadError
@@ -46,8 +48,6 @@ rescue LoadError
46
48
  end
47
49
 
48
50
 
49
- task :default => :test
50
-
51
51
  begin
52
52
  require 'hanna/rdoctask'
53
53
 
@@ -71,28 +71,40 @@ rescue LoadError
71
71
  end
72
72
  end
73
73
 
74
- desc 'Build extensions'
75
- task :build => :extensions
76
- task :extension => :build
74
+ MAKE = ENV['MAKE'] || (RUBY_PLATFORM =~ /mswin/ ? 'nmake' : 'make')
77
75
 
78
- ext = Config::CONFIG["DLEXT"]
79
- task :extensions => ["ext/push_parser.#{ext}"]
80
- file "ext/push_parser.#{ext}" =>
81
- ["Makefile"] + FileList["ext/*.{c,h}"].to_a do |t|
82
- Dir.chdir("ext") { sh "make" }
83
- end
76
+ namespace :ext do
77
+ ext_sources = FileList['ext/*.{rb,c}']
78
+
79
+ desc 'Compile the makefile'
80
+ file 'ext/Makefile' => ext_sources do
81
+ chdir('ext') { ruby 'extconf.rb' }
82
+ end
83
+
84
+ desc "make extension"
85
+ task :make => ext_sources + ['ext/Makefile'] do
86
+ chdir('ext') { sh MAKE }
87
+ end
88
+
89
+ desc 'Build push parser'
90
+ task :build => :make
84
91
 
85
- namespace :extensions do
86
92
  desc 'Clean extensions'
87
93
  task :clean do
88
- Dir.chdir("ext") do
94
+ chdir 'ext' do
89
95
  sh "rm -f Makefile"
90
96
  sh "rm -f *.{o,so,bundle,log}"
91
97
  end
92
98
  end
93
99
  end
94
100
 
95
- file "Makefile" => %w[ext/extconf.rb] do
96
- command = ["ruby"] + $:.map{|dir| "-I#{File.expand_path dir}"} + ["extconf.rb"]
97
- Dir.chdir("ext") { sh(*command) }
101
+ # If running under rubygems...
102
+ __DIR__ ||= File.expand_path(File.dirname(__FILE__))
103
+ if Gem.path.any? {|path| %r(^#{Regexp.escape path}) =~ __DIR__}
104
+ task :default => :gem_build
105
+ else
106
+ task :default => ['ext:build', :test]
98
107
  end
108
+
109
+ desc ":default build when running under rubygems."
110
+ task :gem_build => 'ext:build'
data/ext/Makefile ADDED
@@ -0,0 +1,149 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
11
+ exec_prefix = $(prefix)
12
+ sitedir = $(DESTDIR)/Library/Ruby/Site
13
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
14
+ docdir = $(datarootdir)/doc/$(PACKAGE)
15
+ dvidir = $(docdir)
16
+ datarootdir = $(prefix)/share
17
+ archdir = $(rubylibdir)/$(arch)
18
+ sbindir = $(exec_prefix)/sbin
19
+ psdir = $(docdir)
20
+ localedir = $(datarootdir)/locale
21
+ htmldir = $(docdir)
22
+ datadir = $(datarootdir)
23
+ includedir = $(prefix)/include
24
+ infodir = $(DESTDIR)/usr/share/info
25
+ sysconfdir = $(prefix)/etc
26
+ mandir = $(DESTDIR)/usr/share/man
27
+ libdir = $(exec_prefix)/lib
28
+ sharedstatedir = $(prefix)/com
29
+ oldincludedir = $(DESTDIR)/usr/include
30
+ pdfdir = $(docdir)
31
+ sitearchdir = $(sitelibdir)/$(sitearch)
32
+ bindir = $(exec_prefix)/bin
33
+ localstatedir = $(prefix)/var
34
+ sitelibdir = $(sitedir)/$(ruby_version)
35
+ libexecdir = $(exec_prefix)/libexec
36
+
37
+ CC = gcc
38
+ LIBRUBY = $(LIBRUBY_SO)
39
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
40
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
41
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
42
+
43
+ RUBY_EXTCONF_H =
44
+ CFLAGS = -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -DOS_UNIX -DBUILD_FOR_RUBY
45
+ INCFLAGS = -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -I/usr/include/libxml2
46
+ CPPFLAGS =
47
+ CXXFLAGS = $(CFLAGS)
48
+ DLDFLAGS = -L. -arch ppc -arch i386
49
+ LDSHARED = cc -arch ppc -arch i386 -pipe -bundle -undefined dynamic_lookup
50
+ AR = ar
51
+ EXEEXT =
52
+
53
+ RUBY_INSTALL_NAME = ruby
54
+ RUBY_SO_NAME = ruby
55
+ arch = universal-darwin9.0
56
+ sitearch = universal-darwin9.0
57
+ ruby_version = 1.8
58
+ ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
59
+ RUBY = $(ruby)
60
+ RM = rm -f
61
+ MAKEDIRS = mkdir -p
62
+ INSTALL = /usr/bin/install -c
63
+ INSTALL_PROG = $(INSTALL) -m 0755
64
+ INSTALL_DATA = $(INSTALL) -m 644
65
+ COPY = cp
66
+
67
+ #### End of system configuration section. ####
68
+
69
+ preload =
70
+
71
+ libpath = . $(libdir)
72
+ LIBPATH = -L"." -L"$(libdir)"
73
+ DEFFILE =
74
+
75
+ CLEANFILES = mkmf.log
76
+ DISTCLEANFILES =
77
+
78
+ extout =
79
+ extout_prefix =
80
+ target_prefix =
81
+ LOCAL_LIBS =
82
+ LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lpthread -ldl -lm
83
+ SRCS = push_parser.c
84
+ OBJS = push_parser.o
85
+ TARGET = push_parser
86
+ DLLIB = $(TARGET).bundle
87
+ EXTSTATIC =
88
+ STATIC_LIB =
89
+
90
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
91
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
92
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
93
+
94
+ TARGET_SO = $(DLLIB)
95
+ CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
96
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
97
+
98
+ all: $(DLLIB)
99
+ static: $(STATIC_LIB)
100
+
101
+ clean:
102
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
103
+
104
+ distclean: clean
105
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
106
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
107
+
108
+ realclean: distclean
109
+ install: install-so install-rb
110
+
111
+ install-so: $(RUBYARCHDIR)
112
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
113
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
114
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
115
+ install-rb: pre-install-rb install-rb-default
116
+ install-rb-default: pre-install-rb-default
117
+ pre-install-rb: Makefile
118
+ pre-install-rb-default: Makefile
119
+ $(RUBYARCHDIR):
120
+ $(MAKEDIRS) $@
121
+
122
+ site-install: site-install-so site-install-rb
123
+ site-install-so: install-so
124
+ site-install-rb: install-rb
125
+
126
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
127
+
128
+ .cc.o:
129
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
130
+
131
+ .cxx.o:
132
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
133
+
134
+ .cpp.o:
135
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
136
+
137
+ .C.o:
138
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
139
+
140
+ .c.o:
141
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
142
+
143
+ $(DLLIB): $(OBJS)
144
+ @-$(RM) $@
145
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
146
+
147
+
148
+
149
+ $(OBJS): ruby.h defines.h
data/ext/mkmf.log ADDED
@@ -0,0 +1,30 @@
1
+ have_library: checking for main() in -lxml2... -------------------- yes
2
+
3
+ "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -arch ppc -arch i386 -Os -pipe -fno-common conftest.c -L"." -L"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib" -L. -arch ppc -arch i386 -lruby -lxml2 -lpthread -ldl -lm "
4
+ checked program was:
5
+ /* begin */
6
+ 1: /*top*/
7
+ 2: int main() { return 0; }
8
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
9
+ /* end */
10
+
11
+ --------------------
12
+
13
+ find_header: checking for #include <libxml/parser.h>
14
+ ... -------------------- yes
15
+
16
+ "gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -Os -pipe -fno-common conftest.c -o conftest.i"
17
+ conftest.c:1:27: error: libxml/parser.h: No such file or directory
18
+ checked program was:
19
+ /* begin */
20
+ 1: #include <libxml/parser.h>
21
+ /* end */
22
+
23
+ "gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -Os -pipe -fno-common -I/usr/include/libxml2 conftest.c -o conftest.i"
24
+ checked program was:
25
+ /* begin */
26
+ 1: #include <libxml/parser.h>
27
+ /* end */
28
+
29
+ --------------------
30
+
Binary file
data/ext/push_parser.c ADDED
@@ -0,0 +1,231 @@
1
+ /*
2
+ * Most of this was ripped from libxml-ruby's SAX handler
3
+ */
4
+
5
+ #include <libxml/parser.h>
6
+ #include <ruby.h>
7
+
8
+ xmlSAXHandler saxHandler;
9
+
10
+ static VALUE
11
+ push_parser_raise_error (
12
+ xmlErrorPtr error)
13
+ {
14
+ rb_raise(rb_eStandardError, "%s", rb_str_new2((const char*)error->message));
15
+ return Qnil;
16
+ }
17
+
18
+ static VALUE
19
+ push_parser_initialize (
20
+ VALUE self,
21
+ VALUE handler)
22
+ {
23
+ xmlParserCtxtPtr ctxt;
24
+ ctxt = xmlCreatePushParserCtxt(&saxHandler, (void *)handler, NULL, 0, NULL);
25
+
26
+ if (!ctxt)
27
+ return push_parser_raise_error(&xmlLastError);
28
+
29
+ ctxt->sax2 = 1;
30
+
31
+ rb_iv_set(self, "@__libxml_push_parser", Data_Wrap_Struct(rb_cData, 0, xmlFreeParserCtxt, ctxt));
32
+
33
+ return self;
34
+ }
35
+
36
+ static VALUE
37
+ push_parser_close (
38
+ VALUE self)
39
+ {
40
+ xmlParserCtxtPtr ctxt;
41
+ Data_Get_Struct(rb_iv_get(self, "@__libxml_push_parser"), xmlParserCtxt, ctxt);
42
+
43
+ if (xmlParseChunk(ctxt, "", 0, 1)) {
44
+ return push_parser_raise_error(&xmlLastError);
45
+ }
46
+ else {
47
+ return Qtrue;
48
+ }
49
+ }
50
+
51
+ static VALUE
52
+ push_parser_receive (
53
+ VALUE self,
54
+ VALUE chunk)
55
+ {
56
+ const char *data = StringValuePtr(chunk);
57
+ int length = RSTRING_LEN(chunk);
58
+
59
+ xmlParserCtxtPtr ctxt;
60
+ Data_Get_Struct(rb_iv_get(self, "@__libxml_push_parser"), xmlParserCtxt, ctxt);
61
+
62
+ // Chunk through in 4KB chunks so as not to overwhelm the buffers
63
+ int i;
64
+ int chunkSize = length < 4096 ? length : 4096;
65
+ for (i = 0; i < length; i += chunkSize) {
66
+ xmlParseChunk(ctxt, data+i, chunkSize, 0);
67
+ }
68
+ if ((i -= length) > 0)
69
+ xmlParseChunk(ctxt, data+(length-i), i, 0);
70
+
71
+ return self;
72
+ }
73
+
74
+ /*********
75
+ CALLBACKS
76
+ **********/
77
+ static void
78
+ push_parser_start_document_callback (
79
+ void *ctx)
80
+ {
81
+ VALUE handler = (VALUE) ctx;
82
+ if (handler != Qnil)
83
+ rb_funcall (handler, rb_intern("on_start_document"), 0);
84
+ }
85
+
86
+ static void
87
+ push_parser_end_document_callback (
88
+ void *ctx)
89
+ {
90
+ VALUE handler = (VALUE) ctx;
91
+ if (handler != Qnil)
92
+ rb_funcall (handler, rb_intern("on_end_document"), 0);
93
+ }
94
+
95
+ static void
96
+ push_parser_start_element_ns_callback (
97
+ void * ctx,
98
+ const xmlChar * localname,
99
+ const xmlChar * prefix,
100
+ const xmlChar * URI,
101
+ int nb_namespaces,
102
+ const xmlChar ** namespaces,
103
+ int nb_attributes,
104
+ int nb_defaulted,
105
+ const xmlChar ** attributes)
106
+ {
107
+ VALUE handler = (VALUE) ctx;
108
+ if (handler == Qnil)
109
+ return;
110
+
111
+ VALUE attrHash = rb_hash_new();
112
+ VALUE nsHash = rb_hash_new();
113
+
114
+ if (attributes)
115
+ {
116
+ /* Each attribute is an array of [localname, prefix, URI, value, end] */
117
+ int i;
118
+ for (i = 0; i < nb_attributes * 5; i += 5)
119
+ {
120
+ rb_hash_aset( attrHash,
121
+ rb_str_new2((const char*)attributes[i+0]),
122
+ rb_str_new((const char*)attributes[i+3], attributes[i+4] - attributes[i+3]));
123
+ }
124
+ }
125
+
126
+ if (namespaces)
127
+ {
128
+ int i;
129
+ for (i = 0; i < nb_namespaces * 2; i += 2)
130
+ {
131
+ rb_hash_aset( nsHash,
132
+ namespaces[i+0] ? rb_str_new2((const char*)namespaces[i+0]) : Qnil,
133
+ namespaces[i+1] ? rb_str_new2((const char*)namespaces[i+1]) : Qnil);
134
+ }
135
+ }
136
+
137
+ rb_funcall(handler, rb_intern("on_start_element_ns"), 5,
138
+ rb_str_new2((const char*)localname),
139
+ attrHash,
140
+ prefix ? rb_str_new2((const char*)prefix) : Qnil,
141
+ URI ? rb_str_new2((const char*)URI) : Qnil,
142
+ nsHash);
143
+ }
144
+
145
+ static void
146
+ push_parser_end_element_ns_callback (
147
+ void * ctx,
148
+ const xmlChar * localname,
149
+ const xmlChar * prefix,
150
+ const xmlChar * URI)
151
+ {
152
+ VALUE handler = (VALUE) ctx;
153
+ if (handler == Qnil)
154
+ return;
155
+
156
+ rb_funcall(handler, rb_intern("on_end_element_ns"), 3,
157
+ rb_str_new2((const char*)localname),
158
+ prefix ? rb_str_new2((const char*)prefix) : Qnil,
159
+ URI ? rb_str_new2((const char*)URI) : Qnil);
160
+ }
161
+
162
+
163
+ static void
164
+ push_parser_characters_callback (
165
+ void *ctx,
166
+ const char *chars,
167
+ int len)
168
+ {
169
+ VALUE handler = (VALUE) ctx;
170
+ if (handler != Qnil)
171
+ rb_funcall (handler, rb_intern("on_characters"), 1, rb_str_new(chars, len));
172
+ }
173
+
174
+ static void
175
+ push_parser_structured_error_callback (
176
+ void *ctx,
177
+ xmlErrorPtr error)
178
+ {
179
+ VALUE handler = (VALUE) ctx;
180
+ if (handler != Qnil)
181
+ rb_funcall (handler, rb_intern("on_error"), 1, rb_str_new2((const char*)error->message));
182
+ }
183
+
184
+ xmlSAXHandler saxHandler = {
185
+ 0, //internalSubset
186
+ 0, //isStandalone
187
+ 0, //hasInternalSubset
188
+ 0, //hasExternalSubset
189
+ 0, //resolveEntity
190
+ 0, //getEntity
191
+ 0, //entityDecl
192
+ 0, //notationDecl
193
+ 0, //attributeDecl
194
+ 0, //elementDecl
195
+ 0, //unparsedEntityDecl
196
+ 0, //setDocumentLocator
197
+ (startDocumentSAXFunc) push_parser_start_document_callback,
198
+ (endDocumentSAXFunc) push_parser_end_document_callback,
199
+ 0, //startElement
200
+ 0, //endElement
201
+ 0, //reference
202
+ (charactersSAXFunc) push_parser_characters_callback,
203
+ 0, //ignorableWhitespace
204
+ 0, //processingInstruction
205
+ 0, //comment
206
+ 0, //warning
207
+ (errorSAXFunc) push_parser_structured_error_callback,
208
+ 0, //fatalError
209
+ 0, //getParameterEntity
210
+ 0, //cdataBlock
211
+ 0, //externalSubset
212
+ XML_SAX2_MAGIC,
213
+ 0, //_private
214
+ (startElementNsSAX2Func) push_parser_start_element_ns_callback,
215
+ (endElementNsSAX2Func) push_parser_end_element_ns_callback,
216
+ (xmlStructuredErrorFunc) push_parser_structured_error_callback
217
+ };
218
+
219
+ void
220
+ Init_push_parser()
221
+ {
222
+ /* SaxPushParser */
223
+ VALUE mLibXML = rb_define_module("LibXML");
224
+ VALUE mXML = rb_define_module_under(mLibXML, "XML");
225
+ VALUE cXMLSaxPushParser = rb_define_class_under(mXML, "SaxPushParser", rb_cObject);
226
+
227
+ /* Instance Methods */
228
+ rb_define_method(cXMLSaxPushParser, "initialize", push_parser_initialize, 1);
229
+ rb_define_method(cXMLSaxPushParser, "receive", push_parser_receive, 1);
230
+ rb_define_method(cXMLSaxPushParser, "close", push_parser_close, 0);
231
+ }