diff options
Diffstat (limited to 'sample')
77 files changed, 1445 insertions, 9851 deletions
diff --git a/sample/drb/README.ja.rdoc b/sample/drb/README.ja.rdoc deleted file mode 100644 index 1697b1b704..0000000000 --- a/sample/drb/README.ja.rdoc +++ /dev/null @@ -1,59 +0,0 @@ -= サンプルスクリプト - -* Arrayをリモートから利用してイテレータを試す。 - * darray.rb --- server - * darrayc.rb --- client - -* 簡易チャット - * dchats.rb --- server - * dchatc.rb --- client - -* 分散chasen - * dhasen.rb --- server - * dhasenc.rb --- client - -* 簡易ログサーバ - * dlogd.rb --- server - * dlogc.rb --- client - -* Queueサーバ。 - クライアントdqin.rbはQueueサーバの知らないオブジェクト(DQEntry)を - pushするがDRbUnknownによりクライアントdqout.rbがpopできる。 - * dqueue.rb --- server - * dqin.rb --- client。DQEntryオブジェクトをpushする - * dqout.rb --- client。DQEntryオブジェクトをpopする - * dqlib.rb --- DQEntryを定義したライブラリ - -* 名前による参照 - IdConvをカスタマイズしてidでなく名前で参照する例 - * name.rb --- server - * namec.rb --- client - -* extservのサンプル - * extserv_test.rb - -* TimerIdConvの使用例 - * holders.rb --- server。ruby -d hodlers.rbとするとTimerIdConvを使用する。 - * holderc.rb --- client - -* rinda.rbの使用例 - * rinda_ts.rb --- TupleSpaceサーバ。 - * rindac.rb --- TupleSpaceのclientでアプリケーションのclient - * rindas.rb --- TupleSpaceのclientでアプリケーションのserver - -* observerの使用例 - cdbiff - http://namazu.org/~satoru/cdbiff/ - * dbiff.rb --- dcdbiff server - * dcdbiff.rb --- dcdbiff client - -* drbsslの使用例 - * drbssl_s.rb - * drbssl_c.rb - -* DRbProtocolの追加例 - * http0.rb - * http0serv.rb - -* ringの使用例 - * ring_place.rb - * ring_echo.rb diff --git a/sample/drb/README.rdoc b/sample/drb/README.rdoc deleted file mode 100644 index e6b457bc5c..0000000000 --- a/sample/drb/README.rdoc +++ /dev/null @@ -1,56 +0,0 @@ -= Sample scripts - -* array and iterator - * darray.rb --- server - * darrayc.rb --- client - -* simple chat - * dchats.rb --- server - * dchatc.rb --- client - -* distributed chasen (for Japanese) - * dhasen.rb --- server - * dhasenc.rb --- client - -* simple log server - * dlogd.rb --- server - * dlogc.rb --- client - -* Queue server, and DRbUnknown demo - * dqueue.rb --- server - * dqin.rb --- client. push DQEntry objects. - * dqout.rb --- client. pop DQEntry objects. - * dqlib.rb --- define DQEntry - -* IdConv customize demo: reference by name - * name.rb --- server - * namec.rb --- client - -* extserv - * extserv_test.rb - -* IdConv customize demo 2: using TimerIdConv - * holders.rb --- server - * holderc.rb --- client - -* rinda, remote tuplespace - * rinda_ts.rb --- TupleSpace server. - * rindas.rb --- provide simple service via TupleSpace. - * rindac.rb --- service user - -* observer - cdbiff - http://namazu.org/~satoru/cdbiff/ - * dbiff.rb --- dcdbiff server - * dcdbiff.rb --- dcdbiff client - -* drbssl - * drbssl_s.rb - * drbssl_c.rb - -* add DRbProtocol - * http0.rb - * http0serv.rb - -* Rinda::Ring - * ring_place.rb - * ring_echo.rb diff --git a/sample/drb/acl.rb b/sample/drb/acl.rb deleted file mode 100644 index d93eb9c1fc..0000000000 --- a/sample/drb/acl.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'drb/acl' - -list = %w(deny all - allow 192.168.1.1 - allow ::ffff:192.168.1.2 - allow 192.168.1.3 -) - -addr = ["AF_INET", 10, "lc630", "192.168.1.3"] - -acl = ACL.new -p acl.allow_addr?(addr) - -acl = ACL.new(list, ACL::DENY_ALLOW) -p acl.allow_addr?(addr) diff --git a/sample/drb/darray.rb b/sample/drb/darray.rb deleted file mode 100644 index d2ac39513f..0000000000 --- a/sample/drb/darray.rb +++ /dev/null @@ -1,12 +0,0 @@ -=begin - distributed Ruby --- Array - Copyright (c) 1999-2001 Masatoshi SEKI -=end - -require 'drb/drb' - -here = ARGV.shift -DRb.start_service(here, [1, 2, "III", 4, "five", 6]) -puts DRb.uri -DRb.thread.join - diff --git a/sample/drb/darrayc.rb b/sample/drb/darrayc.rb deleted file mode 100644 index 579e11564e..0000000000 --- a/sample/drb/darrayc.rb +++ /dev/null @@ -1,47 +0,0 @@ -=begin - distributed Ruby --- Array client - Copyright (c) 1999-2001 Masatoshi SEKI -=end - -require 'drb/drb' - -there = ARGV.shift || raise("usage: #{$0} <server_uri>") - -DRb.start_service(nil, nil) -ro = DRbObject.new(nil, there) -p ro.size - -puts "# collect" -a = ro.collect { |x| - x + x -} -p a - -puts "# find" -p ro.find { |x| x.kind_of? String } - -puts "# each, break" -ro.each do |x| - next if x == "five" - puts x -end - -puts "# each, break" -ro.each do |x| - break if x == "five" - puts x -end - -puts "# each, next" -ro.each do |x| - next if x == "five" - puts x -end - -puts "# each, redo" -count = 0 -ro.each do |x| - count += 1 - puts count - redo if count == 3 -end diff --git a/sample/drb/dbiff.rb b/sample/drb/dbiff.rb deleted file mode 100644 index 290eb1d28b..0000000000 --- a/sample/drb/dbiff.rb +++ /dev/null @@ -1,51 +0,0 @@ -# -# dbiff.rb - distributed cdbiff (server) -# * original: cdbiff by Satoru Takabayashi <http://namazu.org/~satoru/cdbiff> - -require 'drb/drb' -require 'drb/eq' -require 'drb/observer' - -class Biff - include DRb::DRbObservable - - def initialize(filename, interval) - super() - @filename = filename - @interval = interval - end - - def run - last = Time.now - while true - begin - sleep(@interval) - current = File::mtime(@filename) - if current > last - changed - begin - notify_observers(@filename, current) - rescue Error - end - last = current - end - rescue - next - end - end - end -end - -def main - filename = "/var/mail/#{ENV['USER']}" - interval = 15 - uri = 'druby://:19903' - - biff = Biff.new(filename, interval) - - DRb.start_service(uri, biff) - biff.run -end - -main - diff --git a/sample/drb/dcdbiff.rb b/sample/drb/dcdbiff.rb deleted file mode 100644 index 6a24680c33..0000000000 --- a/sample/drb/dcdbiff.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# dcdbiff.rb - distributed cdbiff (client) -# * original: cdbiff by Satoru Takabayashi <http://namazu.org/~satoru/cdbiff> - -require 'drb/drb' -require 'drb/eq' - -class Notify - include DRbUndumped - - def initialize(biff, command) - @biff = biff - @command = command - - @biff.add_observer(self) - end - - def update(filename, time) - p [filename, time] if $DEBUG - system(@command) - end - - def done - begin - @biff.delete_observer(self) - rescue - end - end -end - -def main - command = 'eject' - uri = 'druby://localhost:19903' - - DRb.start_service - biff = DRbObject.new(nil, uri) - notify = Notify.new(biff, command) - - trap("INT"){ notify.done } - DRb.thread.join -end - -main diff --git a/sample/drb/dchatc.rb b/sample/drb/dchatc.rb deleted file mode 100644 index 2b8ddbf4cc..0000000000 --- a/sample/drb/dchatc.rb +++ /dev/null @@ -1,41 +0,0 @@ -=begin - distributed Ruby --- chat client - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' - -class ChatClient - include DRbUndumped - - def initialize(name) - @name = name - @key = nil - end - attr_reader(:name) - attr_accessor(:key) - - def message(there, str) - raise 'invalid key' unless @key == there - puts str - end -end - -if __FILE__ == $0 - begin - there = ARGV.shift - name = ARGV.shift - raise "usage" unless (there and name) - rescue - $stderr.puts("usage: #{$0} <server_uri> <your_name>") - exit 1 - end - DRb.start_service - ro = DRbObject.new(nil, there) - - chat = ChatClient.new(name) - entry = ro.add_member(chat) - while gets - entry.say($_) - end -end diff --git a/sample/drb/dchats.rb b/sample/drb/dchats.rb deleted file mode 100644 index c96486a452..0000000000 --- a/sample/drb/dchats.rb +++ /dev/null @@ -1,69 +0,0 @@ -=begin - distributed Ruby --- chat server - Copyright (c) 1999-2000 Masatoshi SEKI -=end -require 'drb/drb' - -class ChatEntry - include DRbUndumped - - def initialize(server, there) - @server = server - @there = there - @name = there.name - @key = there.key = Time.now - end - attr :name, true - attr :there - - def say(str) - @server.distribute(@there, str) - end - - def listen(str) - @there.message(@key, str) - end -end - - -class ChatServer - def initialize - @mutex = Thread::Mutex.new - @members = {} - end - - def add_member(there) - client = ChatEntry.new(self, there) - @mutex.synchronize do - @members[there] = client - end - client - end - - def distribute(there, str) - name = @members[there].name - msg = "<#{name}> #{str}" - msg2 = ">#{name}< #{str}" - @mutex.synchronize do - for m in @members.keys - begin - if m == there - @members[m].listen(msg2) - else - @members[m].listen(msg) - end - rescue - p $! - @members.delete(m) - end - end - end - end -end - -if __FILE__ == $0 - here = ARGV.shift - DRb.start_service(here, ChatServer.new) - puts DRb.uri - DRb.thread.join -end diff --git a/sample/drb/dhasen.rb b/sample/drb/dhasen.rb deleted file mode 100644 index 13ff38940e..0000000000 --- a/sample/drb/dhasen.rb +++ /dev/null @@ -1,41 +0,0 @@ -=begin - distributed Ruby --- dRuby Sample Server --- chasen server - Copyright (c) 1999-2001 Masatoshi SEKI -=end - -=begin - How to play. - - Terminal 1 - | % ruby dhasen.rb - | druby://yourhost:7640 - - Terminal 2 - | % ruby dhasenc.rb druby://yourhost:7640 - -=end - -require 'drb/drb' -require 'chasen' - -class Dhasen - include DRbUndumped - - def initialize - @mutex = Thread::Mutex.new - end - - def sparse(str, *arg) - @mutex.synchronize do - Chasen.getopt(*arg) - Chasen.sparse(str) - end - end -end - -if __FILE__ == $0 - DRb.start_service(nil, Dhasen.new) - puts DRb.uri - DRb.thread.join -end - diff --git a/sample/drb/dhasenc.rb b/sample/drb/dhasenc.rb deleted file mode 100644 index dddac9882c..0000000000 --- a/sample/drb/dhasenc.rb +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -=begin - distributed Ruby --- dRuby Sample Client -- chasen client - Copyright (c) 1999-2001 Masatoshi SEKI -=end - -require 'drb/drb' - -there = ARGV.shift || raise("usage: #{$0} <server_uri>") -DRb.start_service -dhasen = DRbObject.new(nil, there) - -print dhasen.sparse("本日は、晴天なり。", "-F", '(%BB %m %M)\n', "-j") -print dhasen.sparse("本日は、晴天なり。", "-F", '(%m %M)\n') diff --git a/sample/drb/dlogc.rb b/sample/drb/dlogc.rb deleted file mode 100644 index 3939a71827..0000000000 --- a/sample/drb/dlogc.rb +++ /dev/null @@ -1,16 +0,0 @@ -=begin - distributed Ruby --- Log test - Copyright (c) 1999-2001 Masatoshi SEKI -=end - -require 'drb/drb' - -there = ARGV.shift || raise("usage: #{$0} <server_uri>") - -DRb.start_service -ro = DRbObject.new(nil, there) -ro.log(123) -ro.log("hello") -sleep 2 -ro.log("wakeup") - diff --git a/sample/drb/dlogd.rb b/sample/drb/dlogd.rb deleted file mode 100644 index a87e660346..0000000000 --- a/sample/drb/dlogd.rb +++ /dev/null @@ -1,38 +0,0 @@ -=begin - distributed Ruby --- Log server - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' - -class Logger - def initialize(fname) - @fname = fname.to_s - @fp = File.open(@fname, "a+") - @queue = Thread::Queue.new - @th = Thread.new { self.flush } - end - - def log(str) - @queue.push("#{Time.now}\t" + str.to_s) - end - - def flush - begin - while(1) - @fp.puts(@queue.pop) - @fp.flush - end - ensure - @fp.close - end - end -end - -if __FILE__ == $0 - here = ARGV.shift - DRb.start_service(here, Logger.new('/usr/tmp/dlogd.log')) - puts DRb.uri - DRb.thread.join -end - diff --git a/sample/drb/dqin.rb b/sample/drb/dqin.rb deleted file mode 100644 index 4751335fff..0000000000 --- a/sample/drb/dqin.rb +++ /dev/null @@ -1,13 +0,0 @@ -=begin - distributed Ruby --- store - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' -require 'dqlib' - -there = ARGV.shift || raise("usage: #{$0} <server_uri>") - -DRb.start_service -queue = DRbObject.new(nil, there) -queue.push(DQEntry.new(DRb.uri)) diff --git a/sample/drb/dqlib.rb b/sample/drb/dqlib.rb deleted file mode 100644 index 75f2e6115b..0000000000 --- a/sample/drb/dqlib.rb +++ /dev/null @@ -1,14 +0,0 @@ -class DQEntry - def initialize(name) - @name = name - end - - def greeting - "Hello, This is #{@name}." - end - alias to_s greeting -end - -if __FILE__ == $0 - puts DQEntry.new('DQEntry') -end diff --git a/sample/drb/dqout.rb b/sample/drb/dqout.rb deleted file mode 100644 index f2b0b4ac95..0000000000 --- a/sample/drb/dqout.rb +++ /dev/null @@ -1,14 +0,0 @@ -=begin - distributed Ruby --- fetch - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' -require 'dqlib' - -there = ARGV.shift || raise("usage: #{$0} <server_uri>") - -DRb.start_service -queue = DRbObject.new(nil, there) -entry = queue.pop -puts entry.greeting diff --git a/sample/drb/dqueue.rb b/sample/drb/dqueue.rb deleted file mode 100644 index a9afa8c858..0000000000 --- a/sample/drb/dqueue.rb +++ /dev/null @@ -1,11 +0,0 @@ -=begin - distributed Ruby --- Queue - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' - -DRb.start_service(nil, Thread::Queue.new) -puts DRb.uri -DRb.thread.join - diff --git a/sample/drb/drbc.rb b/sample/drb/drbc.rb deleted file mode 100644 index 50a86c39e8..0000000000 --- a/sample/drb/drbc.rb +++ /dev/null @@ -1,45 +0,0 @@ -=begin - distributed Ruby --- dRuby Sample Client - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' - -class DRbEx2 - include DRbUndumped - - def initialize(n) - @n = n - end - - def to_i - @n.to_i - end -end - -if __FILE__ == $0 - there = ARGV.shift - unless there - $stderr.puts("usage: #{$0} <server_uri>") - exit 1 - end - - DRb.start_service() - ro = DRbObject.new_with_uri(there) - - puts ro - p ro.to_a - puts ro.hello - p ro.hello - puts ro.sample(DRbEx2.new(1), 2, 3) - puts ro.sample(1, ro.sample(DRbEx2.new(1), 2, 3), DRbEx2.new(3)) - - begin - ro.err - rescue DRb::DRbUnknownError - p $! - p $!.unknown - rescue RuntimeError - p $! - end -end diff --git a/sample/drb/drbch.rb b/sample/drb/drbch.rb deleted file mode 100644 index 07fdcd5fae..0000000000 --- a/sample/drb/drbch.rb +++ /dev/null @@ -1,48 +0,0 @@ -=begin - distributed Ruby --- dRuby Sample Client - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -require 'drb/drb' -require 'drb/http' - -class DRbEx2 - include DRbUndumped - - def initialize(n) - @n = n - end - - def to_i - @n.to_i - end -end - -if __FILE__ == $0 - there = ARGV.shift - unless there - $stderr.puts("usage: #{$0} <server_uri>") - exit 1 - end - - DRb::DRbConn.proxy_map['x68k'] = 'http://x68k/~mas/http_cgi.rb' - - DRb.start_service() - ro = DRbObject.new(nil, there) - - puts ro - p ro.to_a - puts ro.hello - p ro.hello - puts ro.sample(DRbEx2.new(1), 2, 3) - puts ro.sample(1, ro.sample(DRbEx2.new(1), 2, 3), DRbEx2.new(3)) - - begin - ro.err - rescue DRb::DRbUnknownError - p $! - p $!.unknown - rescue RuntimeError - p $! - end -end diff --git a/sample/drb/drbm.rb b/sample/drb/drbm.rb deleted file mode 100644 index 3390608cd1..0000000000 --- a/sample/drb/drbm.rb +++ /dev/null @@ -1,60 +0,0 @@ -=begin - multiple DRbServer - Copyright (c) 1999-2002 Masatoshi SEKI -=end - -=begin - How to play. - - Terminal 1 - | % ruby drbm.rb - | druby://yourhost:7640 druby://yourhost:7641 - - Terminal 2 - | % ruby drbmc.rb druby://yourhost:7640 druby://yourhost:7641 - | [#<DRb::DRbObject .... @uri="druby://yourhost:7640">, "FOO"] - | [#<DRb::DRbObject .... @uri="druby://yourhost:7641">, "FOO"] - -=end - -require 'drb/drb' - -class Hoge - include DRbUndumped - def initialize(s) - @str = s - end - - def to_s - @str - end -end - -class Foo - def initialize(s='FOO') - @hoge = Hoge.new(s) - end - - def hello - @hoge - end -end - -class Bar < Foo - def initialize(foo) - @hoge = foo.hello - end -end - - -if __FILE__ == $0 - foo = Foo.new - s1 = DRb::DRbServer.new('druby://:7640', foo) - s2 = DRb::DRbServer.new('druby://:7641', Bar.new(foo)) - - puts "#{s1.uri} #{s2.uri}" - - s1.thread.join - s2.thread.join -end - diff --git a/sample/drb/drbmc.rb b/sample/drb/drbmc.rb deleted file mode 100644 index fd191401e6..0000000000 --- a/sample/drb/drbmc.rb +++ /dev/null @@ -1,22 +0,0 @@ -=begin - multiple DRbServer client - Copyright (c) 1999-2002 Masatoshi SEKI -=end - -require 'drb/drb' - -if __FILE__ == $0 - s1 = ARGV.shift - s2 = ARGV.shift - unless s1 && s2 - $stderr.puts("usage: #{$0} <server_uri1> <server_uri2>") - exit 1 - end - - DRb.start_service() - r1 = DRbObject.new(nil, s1) - r2 = DRbObject.new(nil, s2) - - p [r1.hello, r1.hello.to_s] - p [r2.hello, r2.hello.to_s] -end diff --git a/sample/drb/drbs-acl.rb b/sample/drb/drbs-acl.rb deleted file mode 100644 index 71c4f7bf42..0000000000 --- a/sample/drb/drbs-acl.rb +++ /dev/null @@ -1,51 +0,0 @@ -=begin - distributed Ruby --- dRuby Sample Server - Copyright (c) 1999-2000 Masatoshi SEKI -=end - -=begin - How to play. - - Terminal 1 - | % ruby drbs.rb - | druby://yourhost:7640 - - Terminal 2 - | % ruby drbc.rb druby://yourhost:7640 - | "hello" - | 6 - | 10 - -=end - -require 'drb/drb' -require 'acl' - -class DRbEx - def initialize - @hello = 'hello' - end - - def hello - info = Thread.current['DRb'] - p info['socket'].peeraddr if info - @hello - end - - def sample(a, b, c) - a.to_i + b.to_i + c.to_i - end -end - -if __FILE__ == $0 - acl = ACL.new(%w(deny all - allow 192.168.1.* - allow localhost)) - - DRb.install_acl(acl) - - DRb.start_service(nil, DRbEx.new) - puts DRb.uri - DRb.thread.join -end - diff --git a/sample/drb/drbs.rb b/sample/drb/drbs.rb deleted file mode 100644 index 5a913d9918..0000000000 --- a/sample/drb/drbs.rb +++ /dev/null @@ -1,64 +0,0 @@ -=begin - distributed Ruby --- dRuby Sample Server - Copyright (c) 1999-2000,2002 Masatoshi SEKI -=end - -=begin - How to play. - - Terminal 1 - | % ruby drbs.rb - | druby://yourhost:7640 - - Terminal 2 - | % ruby drbc.rb druby://yourhost:7640 - | "hello" - | .... - -=end - -require 'drb/drb' - -class DRbEx - include DRbUndumped - - def initialize - @hello = 'hello' - end - - def hello - cntxt = Thread.current['DRb'] - if cntxt - p cntxt['server'].uri - p cntxt['client'].peeraddr - end - Foo::Unknown.new - end - - def err - raise FooError - end - - def sample(a, b, c) - a.to_i + b.to_i + c.to_i - end -end - -class Foo - class Unknown - end -end - -class FooError < RuntimeError -end - -if __FILE__ == $0 - DRb.start_service(ARGV.shift || 'druby://:7640', DRbEx.new) - puts DRb.uri - Thread.new do - sleep 10 - DRb.stop_service - end - DRb.thread.join -end - diff --git a/sample/drb/drbssl_c.rb b/sample/drb/drbssl_c.rb deleted file mode 100644 index 65112f6e78..0000000000 --- a/sample/drb/drbssl_c.rb +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env ruby - -require 'drb' -require 'drb/ssl' - -there = ARGV.shift || "drbssl://localhost:3456" - -config = Hash.new -config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER -config[:SSLVerifyCallback] = lambda{|ok,x509_store| - p [ok, x509_store.error_string] - true -} - -DRb.start_service(nil,nil,config) -h = DRbObject.new(nil, there) -while line = gets - p h.hello(line.chomp) -end diff --git a/sample/drb/drbssl_s.rb b/sample/drb/drbssl_s.rb deleted file mode 100644 index 4d96f591d4..0000000000 --- a/sample/drb/drbssl_s.rb +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby - -require 'drb' -require 'drb/ssl' - -here = ARGV.shift || "drbssl://localhost:3456" - -class HelloWorld - include DRbUndumped - - def hello(name) - "Hello, #{name}." - end -end - -config = Hash.new -config[:verbose] = true -begin - data = open("sample.key"){|io| io.read } - config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(data) - data = open("sample.crt"){|io| io.read } - config[:SSLCertificate] = OpenSSL::X509::Certificate.new(data) -rescue - $stderr.puts "Switching to use self-signed certificate" - config[:SSLCertName] = - [ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ] -end - -DRb.start_service(here, HelloWorld.new, config) -puts DRb.uri -DRb.thread.join diff --git a/sample/drb/extserv_test.rb b/sample/drb/extserv_test.rb deleted file mode 100644 index 2c4f485dc6..0000000000 --- a/sample/drb/extserv_test.rb +++ /dev/null @@ -1,80 +0,0 @@ -=begin - dRuby sample - Copyright (c) 2000 Masatoshi SEKI - -= How to play - -* Terminal 1 - - % ruby -I. extserv_test.rb server - druby://yourhost:12345 - -* Terminal 2 - - % ruby -I. extserv_test.rb druby://yourhost:12345 - ... - -=end - -require 'drb/drb' - -def ARGV.shift - it = super() - raise "usage:\nserver: #{$0} server [<uri>]\nclient: #{$0} [quit] <uri>" unless it - it -end - -class Foo - include DRbUndumped - - def initialize(str) - @str = str - end - - def hello(it) - "#{it}: #{self}" - end - - def to_s - @str - end -end - -cmd = ARGV.shift -case cmd -when 'itest1', 'itest2' - require 'drb/extserv' - - front = Foo.new(cmd) - server = DRb::DRbServer.new(nil, front) - es = DRb::ExtServ.new(ARGV.shift, ARGV.shift, server) - server.thread.join - -when 'server' - require 'drb/extservm' - - DRb::ExtServManager.command['itest1'] = "ruby -I. #{$0} itest1" - DRb::ExtServManager.command['itest2'] = "ruby -I. #{$0} itest2" - - s = DRb::ExtServManager.new - DRb.start_service(ARGV.shift, s) - puts DRb.uri - DRb.thread.join - - -else - uri = (cmd == 'quit') ? ARGV.shift : cmd - - DRb.start_service - s = DRbObject.new(nil, uri) - t1 = s.service('itest1').front - puts t1 - t2 = s.service('itest2').front - puts t2 - puts t1.hello(t2) - if (cmd == 'quit') - s.service('itest1').stop_service - s.service('itest2').stop_service - end -end - diff --git a/sample/drb/gw_ct.rb b/sample/drb/gw_ct.rb deleted file mode 100644 index 0622784018..0000000000 --- a/sample/drb/gw_ct.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'drb/drb' - -class Foo - include DRbUndumped - - def foo(n) - n + n - end - - def bar(n) - yield(n) + yield(n) - end -end - -DRb.start_service(nil) -puts DRb.uri - -ro = DRbObject.new(nil, ARGV.shift) -ro[:tcp] = Foo.new -gets - -it = ro[:unix] -p [it, it.foo(1)] -gets - -p it.bar('2') {|n| n * 3} -gets - - diff --git a/sample/drb/gw_cu.rb b/sample/drb/gw_cu.rb deleted file mode 100644 index 8079cbdc4f..0000000000 --- a/sample/drb/gw_cu.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'drb/drb' -require 'drb/unix' - -class Foo - include DRbUndumped - - def foo(n) - n + n - end - - def bar(n) - yield(n) + yield(n) - end -end - -DRb.start_service('drbunix:', nil) -puts DRb.uri - -ro = DRbObject.new(nil, ARGV.shift) -ro[:unix] = Foo.new -gets - -it = ro[:tcp] -p [it, it.foo(1)] -gets - -p it.bar('2') {|n| n * 3} -gets diff --git a/sample/drb/gw_s.rb b/sample/drb/gw_s.rb deleted file mode 100644 index c2bea0baad..0000000000 --- a/sample/drb/gw_s.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'drb/drb' -require 'drb/unix' -require 'drb/gw' - -DRb.install_id_conv(DRb::GWIdConv.new) -gw = DRb::GW.new -s1 = DRb::DRbServer.new(ARGV.shift, gw) -s2 = DRb::DRbServer.new(ARGV.shift, gw) -s1.thread.join -s2.thread.join diff --git a/sample/drb/holderc.rb b/sample/drb/holderc.rb deleted file mode 100644 index e627916d76..0000000000 --- a/sample/drb/holderc.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'drb/drb' - -begin - there = ARGV.shift || raise -rescue - $stderr.puts("usage: #{$0} <server_uri>") - exit 1 -end - -DRb.start_service() -ro = DRbObject.new(nil, there) - -ary = [] -10.times do - ary.push(ro.gen) -end - -sleep 5 if $DEBUG - -ary.each do |e| - p e.sample([1]) -end diff --git a/sample/drb/holders.rb b/sample/drb/holders.rb deleted file mode 100644 index 293426faa5..0000000000 --- a/sample/drb/holders.rb +++ /dev/null @@ -1,63 +0,0 @@ -=begin -= How to play. - -== with timeridconv: - % ruby -d holders.rb - druby://yourhost:1234 - - % ruby holderc.rb druby://yourhost:1234 - - -== without timeridconv: - % ruby holders.rb - druby://yourhost:1234 - - % ruby holderc.rb druby://yourhost:1234 -=end - - -require 'drb/drb' - -class DRbEx3 - include DRbUndumped - - def initialize(n) - @v = n - end - - def sample(list) - sum = 0 - list.each do |e| - sum += e.to_i - end - @v * sum - end -end - -class DRbEx4 - include DRbUndumped - - def initialize - @curr = 1 - end - - def gen - begin - @curr += 1 - DRbEx3.new(@curr) - ensure - GC.start - end - end -end - -if __FILE__ == $0 - if $DEBUG - require 'drb/timeridconv' - DRb.install_id_conv(DRb::TimerIdConv.new(2)) - end - - DRb.start_service(nil, DRbEx4.new) - puts DRb.uri - DRb.thread.join -end diff --git a/sample/drb/http0.rb b/sample/drb/http0.rb deleted file mode 100644 index e40d810311..0000000000 --- a/sample/drb/http0.rb +++ /dev/null @@ -1,77 +0,0 @@ -require 'drb/drb' -require 'net/http' -require 'uri' - -module DRb - module HTTP0 - class StrStream - def initialize(str='') - @buf = str - end - attr_reader :buf - - def read(n) - begin - return @buf[0,n] - ensure - @buf[0,n] = '' - end - end - - def write(s) - @buf.concat s - end - end - - def self.uri_option(uri, config) - return uri, nil - end - - def self.open(uri, config) - unless /^http:/ =~ uri - raise(DRbBadScheme, uri) unless uri =~ /^http:/ - raise(DRbBadURI, 'can\'t parse uri:' + uri) - end - ClientSide.new(uri, config) - end - - class ClientSide - def initialize(uri, config) - @uri = uri - @res = nil - @config = config - @msg = DRbMessage.new(config) - @proxy = ENV['HTTP_PROXY'] - end - - def close; end - def alive?; false; end - - def send_request(ref, msg_id, *arg, &b) - stream = StrStream.new - @msg.send_request(stream, ref, msg_id, *arg, &b) - @reply_stream = StrStream.new - post(@uri, stream.buf) - end - - def recv_reply - @msg.recv_reply(@reply_stream) - end - - def post(url, data) - it = URI.parse(url) - path = [(it.path=='' ? '/' : it.path), it.query].compact.join('?') - http = Net::HTTP.new(it.host, it.port) - sio = StrStream.new - http.post(path, data, {'Content-Type'=>'application/octetstream;'}) do |str| - sio.write(str) - if @config[:load_limit] < sio.buf.size - raise TypeError, 'too large packet' - end - end - @reply_stream = sio - end - end - end - DRbProtocol.add_protocol(HTTP0) -end diff --git a/sample/drb/http0serv.rb b/sample/drb/http0serv.rb deleted file mode 100644 index 2e853312e1..0000000000 --- a/sample/drb/http0serv.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'webrick' -require 'drb/drb' -require_relative 'http0' - -module DRb - module HTTP0 - - def self.open_server(uri, config) - unless /^http:/ =~ uri - raise(DRbBadScheme, uri) unless uri =~ /^http:/ - raise(DRbBadURI, 'can\'t parse uri:' + uri) - end - Server.new(uri, config) - end - - class Callback < WEBrick::HTTPServlet::AbstractServlet - def initialize(config, drb) - @config = config - @drb = drb - @queue = Thread::Queue.new - end - - def do_POST(req, res) - @req = req - @res = res - @drb.push(self) - @res.body = @queue.pop - @res['content-type'] = 'application/octet-stream;' - end - - def req_body - @req.body - end - - def reply(body) - @queue.push(body) - end - - def close - @queue.push('') - end - end - - class Server - def initialize(uri, config) - @uri = uri - @config = config - @queue = Thread::Queue.new - setup_webrick(uri) - end - attr_reader :uri - - def close - @server.shutdown if @server - @server = nil - end - - def push(callback) - @queue.push(callback) - end - - def accept - client = @queue.pop - ServerSide.new(uri, client, @config) - end - - def setup_webrick(uri) - logger = WEBrick::Log::new($stderr, WEBrick::Log::FATAL) - u = URI.parse(uri) - s = WEBrick::HTTPServer.new(:Port => u.port, - :AddressFamily => Socket::AF_INET, - :BindAddress => u.host, - :Logger => logger, - :ServerType => Thread) - s.mount(u.path, Callback, self) - @server = s - s.start - end - end - - class ServerSide - def initialize(uri, callback, config) - @uri = uri - @callback = callback - @config = config - @msg = DRbMessage.new(@config) - @req_stream = StrStream.new(@callback.req_body) - end - attr_reader :uri - - def close - @callback.close if @callback - @callback = nil - end - - def alive?; false; end - - def recv_request - begin - @msg.recv_request(@req_stream) - rescue - close - raise $! - end - end - - def send_reply(succ, result) - begin - return unless @callback - stream = StrStream.new - @msg.send_reply(stream, succ, result) - @callback.reply(stream.buf) - rescue - close - raise $! - end - end - end - end -end diff --git a/sample/drb/name.rb b/sample/drb/name.rb deleted file mode 100644 index 6d88186dab..0000000000 --- a/sample/drb/name.rb +++ /dev/null @@ -1,117 +0,0 @@ -=begin - distributed Ruby --- NamedObject Sample - Copyright (c) 2000-2001 Masatoshi SEKI -=end - -=begin -How to play. - -* start server - Terminal 1 - | % ruby name.rb druby://yourhost:7640 - | druby://yourhost:7640 - | [return] to exit - -* start client - Terminal 2 - | % ruby namec.rb druby://yourhost:7640 - | #<DRb::DRbObject:0x40164174 @uri="druby://yourhost:7640", @ref="seq"> - | #<DRb::DRbObject:0x40163c9c @uri="druby://yourhost:7640", @ref="mutex"> - | 1 - | 2 - | [return] to continue - -* restart server - Terminal 1 - type [return] - | % ruby name.rb druby://yourhost:7640 - | druby://yourhost:7640 - | [return] to exit - -* continue client - Terminal 2 - type [return] - | 1 - | 2 -=end - -require 'drb/drb' - -module DRbNamedObject - DRbNAMEDICT = {} - DRBNAMEMUTEX = Thread::Mutex.new - attr_reader(:drb_name) - - def drb_name=(name) - @drb_name = name - DRBNAMEMUTEX.synchronize do - raise(IndexError, name) if DRbNAMEDICT[name] - DRbNAMEDICT[name] = self - end - end -end - -class DRbNamedIdConv < DRb::DRbIdConv - def initialize - @dict = DRbNamedObject::DRbNAMEDICT - end - - def to_obj(ref) - @dict.fetch(ref) do super end - end - - def to_id(obj) - if obj.kind_of? DRbNamedObject - return obj.drb_name - else - return super - end - end -end - -class Seq - include DRbUndumped - include DRbNamedObject - - def initialize(v, name) - @counter = v - @mutex = Thread::Mutex.new - self.drb_name = name - end - - def next_value - @mutex.synchronize do - @counter += 1 - return @counter - end - end -end - -class Front - def initialize - seq = Seq.new(0, 'seq') - mutex = Thread::Mutex.new - mutex.extend(DRbUndumped) - mutex.extend(DRbNamedObject) - mutex.drb_name = 'mutex' - @name = {} - @name['seq'] = seq - @name['mutex'] = mutex - end - - def [](k) - @name[k] - end -end - -if __FILE__ == $0 - uri = ARGV.shift - - name_conv = DRbNamedIdConv.new - - DRb.install_id_conv(name_conv) - DRb.start_service(uri, Front.new) - puts DRb.uri - DRb.thread.join -end - diff --git a/sample/drb/namec.rb b/sample/drb/namec.rb deleted file mode 100644 index 98b9d0e532..0000000000 --- a/sample/drb/namec.rb +++ /dev/null @@ -1,36 +0,0 @@ -=begin - distributed Ruby --- NamedObject Sample Client - Copyright (c) 2000-2001 Masatoshi SEKI -=end - -require 'drb/drb' - -begin - there = ARGV.shift || raise -rescue - puts "usage: #{$0} <server_uri>" - exit 1 -end - -DRb.start_service() -ro = DRbObject.new(nil, there) - -seq = ro["seq"] -mutex = ro["mutex"] - -p seq -p mutex - -mutex.synchronize do - p seq.next_value - p seq.next_value -end - -puts '[return] to continue' -gets - -mutex.synchronize do - p seq.next_value - p seq.next_value -end - diff --git a/sample/drb/old_tuplespace.rb b/sample/drb/old_tuplespace.rb deleted file mode 100644 index 2d5310086e..0000000000 --- a/sample/drb/old_tuplespace.rb +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/local/bin/ruby -# TupleSpace -# Copyright (c) 1999-2000 Masatoshi SEKI -# You can redistribute it and/or modify it under the same terms as Ruby. - -class TupleSpace - class Template - def initialize(list) - @list = list - @check_idx = [] - @list.each_with_index do |x, i| - @check_idx.push i if x - end - @size = @list.size - end - - attr :size - alias length size - - def match(tuple) - return nil if tuple.size != self.size - @check_idx.each do |i| - unless @list[i] === tuple[i] - return false - end - end - return true - end - end - - def initialize - @que = {} - @waiting = {} - @que.taint # enable tainted communication - @waiting.taint - self.taint - end - - def wakeup_waiting(tuple) - sz = tuple.length - return nil unless @waiting[sz] - - x = nil - i = -1 - found = false - @waiting[sz] = @waiting[sz].find_all { |x| - if x[0].match(tuple) - begin - x[1].wakeup - rescue ThreadError - end - false - else - true - end - } - end - - def put_waiting(template, thread) - sz = template.length - @waiting[sz] = [] unless @waiting[sz] - @waiting[sz].push([Template.new(template), thread]) - end - private :wakeup_waiting - private :put_waiting - - def get_que(template) - sz = template.length - return nil unless @que[sz] - - template = Template.new(template) - - x = nil - i = -1 - found = false - @que[sz].each_with_index do |x, i| - if template.match(x) - found = true - break - end - end - return nil unless found - - @que[sz].delete_at(i) - - return x - end - - def put_que(tuple) - sz = tuple.length - @que[sz] = [] unless @que[sz] - @que[sz].push tuple - end - private :get_que - private :put_que - - def out(*tuples) - tuples.each do |tuple| - Thread.critical = true - put_que(tuple) - wakeup_waiting(tuple) - Thread.critical = false - end - end - alias put out - alias write out - - def in(template, non_block=false) - begin - loop do - Thread.critical = true - tuple = get_que(template) - unless tuple - if non_block - raise ThreadError, "queue empty" - end - put_waiting(template, Thread.current) - Thread.stop - else - return tuple - end - end - ensure - Thread.critical = false - end - end - alias get in - alias take in - - def rd(template, non_block=false) - tuple = self.in(template, non_block) - out(tuple) - tuple - end - alias read rd - - def mv(dest, template, non_block=false) - tuple = self.in(template, non_block) - begin - dest.out(tuple) - rescue - self.out(tuple) - end - end - alias move mv -end - -if __FILE__ == $0 - ts = TupleSpace.new - clients = [] - servers = [] - - def server(ts, id) - Thread.start { - loop do - req = ts.in(['req', nil, nil]) - ac = req[1] - num = req[2] - sleep id - ts.out([ac, id, num, num * num]) - end - } - end - - def client(ts, n) - Thread.start { - ac = Object.new - tuples = (1..10).collect { |i| - ['req', ac, i * 10 + n] - } - ts.out(*tuples) - ts.out(tuples[0]) - puts "out: #{n}" - 11.times do |i| - ans = ts.in([ac, nil, nil, nil]) - puts "client(#{n}) server(#{ans[1]}) #{ans[2]} #{ans[3]}" - end - } - end - - def watcher(ts) - Thread.start { - loop do - begin - sleep 1 - p ts.rd(['req', nil, nil], true) - rescue ThreadError - puts "'req' not found." - end - end - } - end - - (0..3).each do |n| - servers.push(server(ts, n)) - end - - (1..6).each do |n| - clients.push(client(ts, n)) - end - - (1..3).each do - watcher(ts) - end - - clients.each do |t| - t.join - end -end - - - diff --git a/sample/drb/rinda_ts.rb b/sample/drb/rinda_ts.rb deleted file mode 100644 index 6f2fae5c0f..0000000000 --- a/sample/drb/rinda_ts.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'drb/drb' -require 'rinda/tuplespace' - -uri = ARGV.shift -DRb.start_service(uri, Rinda::TupleSpace.new) -puts DRb.uri -DRb.thread.join diff --git a/sample/drb/rindac.rb b/sample/drb/rindac.rb deleted file mode 100644 index 72be09deaf..0000000000 --- a/sample/drb/rindac.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'drb/drb' -require 'rinda/rinda' - -uri = ARGV.shift || raise("usage: #{$0} <server_uri>") - -DRb.start_service -ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri)) - -(1..10).each do |n| - ts.write(['sum', DRb.uri, n]) -end - -(1..10).each do |n| - ans = ts.take(['ans', DRb.uri, n, nil]) - p [ans[2], ans[3]] -end - diff --git a/sample/drb/rindas.rb b/sample/drb/rindas.rb deleted file mode 100644 index 9fd9ada2d1..0000000000 --- a/sample/drb/rindas.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'drb/drb' -require 'rinda/rinda' - -def do_it(v) - puts "do_it(#{v})" - v + v -end - -uri = ARGV.shift || raise("usage: #{$0} <server_uri>") - -DRb.start_service -ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri)) - -while true - r = ts.take(['sum', nil, nil]) - v = do_it(r[2]) - ts.write(['ans', r[1], r[2], v]) -end diff --git a/sample/drb/ring_echo.rb b/sample/drb/ring_echo.rb deleted file mode 100644 index c54628b54c..0000000000 --- a/sample/drb/ring_echo.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'drb/drb' -require 'drb/eq' -require 'rinda/ring' - -class RingEcho - include DRbUndumped - def initialize(name) - @name = name - end - - def echo(str) - "#{@name}: #{str}" - end -end - -DRb.start_service - -renewer = Rinda::SimpleRenewer.new - -finder = Rinda::RingFinger.new -ts = finder.lookup_ring_any -ts.read_all([:name, :RingEcho, nil, nil]).each do |tuple| - p tuple[2] - puts tuple[2].echo('Hello, World') rescue nil -end -ts.write([:name, :RingEcho, RingEcho.new(DRb.uri), ''], renewer) - -DRb.thread.join - diff --git a/sample/drb/ring_inspect.rb b/sample/drb/ring_inspect.rb deleted file mode 100644 index c096cd7034..0000000000 --- a/sample/drb/ring_inspect.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'rinda/ring' -require 'drb/drb' - -class Inspector - def initialize - end - - def primary - Rinda::RingFinger.primary - end - - def list_place - Rinda::RingFinger.to_a - end - - def list(idx = -1) - if idx < 0 - ts = primary - else - ts = list_place[idx] - raise "RingNotFound" unless ts - end - ts.read_all([:name, nil, nil, nil]) - end -end - -def main - DRb.start_service - r = Inspector.new -end diff --git a/sample/drb/ring_place.rb b/sample/drb/ring_place.rb deleted file mode 100644 index 11c6c2fe80..0000000000 --- a/sample/drb/ring_place.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'drb/drb' -require 'rinda/ring' -require 'rinda/tuplespace' - -unless $DEBUG - # Run as a daemon... - exit!( 0 ) if fork - Process.setsid - exit!( 0 ) if fork -end - -DRb.start_service(ARGV.shift) - -ts = Rinda::TupleSpace.new -place = Rinda::RingServer.new(ts) - -if $DEBUG - puts DRb.uri - DRb.thread.join -else - STDIN.reopen(IO::NULL) - STDOUT.reopen(IO::NULL, 'w') - STDERR.reopen(IO::NULL, 'w') - DRb.thread.join -end diff --git a/sample/drb/simpletuple.rb b/sample/drb/simpletuple.rb deleted file mode 100644 index 4bb4b1cff9..0000000000 --- a/sample/drb/simpletuple.rb +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/local/bin/ruby -# SimpleTupleSpace -# Copyright (c) 1999-2000 Masatoshi SEKI -# You can redistribute it and/or modify it under the same terms as Ruby. - -class SimpleTupleSpace - def initialize - @hash = {} - @waiting = {} - @hash.taint - @waiting.taint - self.taint - end - - def out(key, obj) - Thread.critical = true - @hash[key] ||= [] - @waiting[key] ||= [] - @hash[key].push obj - begin - t = @waiting[key].shift - @waiting.delete(key) if @waiting[key].length == 0 - t.wakeup if t - rescue ThreadError - retry - ensure - Thread.critical = false - end - end - - def in(key) - Thread.critical = true - @hash[key] ||= [] - @waiting[key] ||= [] - begin - loop do - if @hash[key].length == 0 - @waiting[key].push Thread.current - Thread.stop - else - return @hash[key].shift - end - end - ensure - @hash.delete(key) if @hash[key].length == 0 - Thread.critical = false - end - end -end - -if __FILE__ == $0 - ts = SimpleTupleSpace.new - clients = [] - servers = [] - - def server(ts) - Thread.start { - loop do - req = ts.in('req') - ac = req[0] - num = req[1] - ts.out(ac, num * num) - end - } - end - - def client(ts, n) - Thread.start { - ac = Object.new - ts.out('req', [ac, n]) - ans = ts.in(ac) - puts "#{n}: #{ans}" - } - end - - 3.times do - servers.push(server(ts)) - end - - (1..6).each do |n| - clients.push(client(ts, n)) - end - - clients.each do |t| - t.join - end -end - - diff --git a/sample/drb/speedc.rb b/sample/drb/speedc.rb deleted file mode 100644 index 64b8a65021..0000000000 --- a/sample/drb/speedc.rb +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/local/bin/ruby - -uri = ARGV.shift || raise("usage: #{$0} URI") -N = (ARGV.shift || 100).to_i - -case uri -when /^tcpromp:/, /^unixromp:/ - require 'romp' - - client = ROMP::Client.new(uri, false) - foo = client.resolve("foo") -when /^druby:/ - require 'drb/drb' - - DRb.start_service - foo = DRbObject.new(nil, uri) -end - -N.times do |n| - foo.foo(n) -end diff --git a/sample/drb/speeds.rb b/sample/drb/speeds.rb deleted file mode 100644 index 7984059423..0000000000 --- a/sample/drb/speeds.rb +++ /dev/null @@ -1,31 +0,0 @@ -class Foo - attr_reader :i - def initialize - @i = 0 - end - - def foo(i) - @i = i - i + i - end -end - -# server = ROMP::Server.new('tcpromp://localhost:4242', nil, true) - -uri = ARGV.shift || raise("usage: #{$0} URI") -foo = Foo.new - -case uri -when /^tcpromp:/, /^unixromp:/ - require 'romp' - - server = ROMP::Server.new(uri, nil, true) - server.bind(foo, "foo") - -when /^druby:/ - require 'drb/drb' - - DRb.start_service(uri, Foo.new) -end - -DRb.thread.join diff --git a/sample/openssl/c_rehash.rb b/sample/openssl/c_rehash.rb index de4b66e902..8b005bbb84 100644 --- a/sample/openssl/c_rehash.rb +++ b/sample/openssl/c_rehash.rb @@ -156,7 +156,7 @@ private end def hash_name(name) - sprintf("%x", name.hash) + sprintf("%08x", name.hash) end def fingerprint(der) diff --git a/sample/trick2025/01-omoikane/authors.markdown b/sample/trick2025/01-omoikane/authors.markdown new file mode 100644 index 0000000000..5c6823c077 --- /dev/null +++ b/sample/trick2025/01-omoikane/authors.markdown @@ -0,0 +1,5 @@ +* Don Yang + * omoikane@uguu.org + * cctld: us + * bsky.app/profile/omoikane.bsky.social + * twitter.com/uguu_org diff --git a/sample/trick2025/01-omoikane/bf.rb b/sample/trick2025/01-omoikane/bf.rb new file mode 100644 index 0000000000..74f5abe7e4 --- /dev/null +++ b/sample/trick2025/01-omoikane/bf.rb @@ -0,0 +1,81 @@ +#!/usr/bin/ruby -w +# Simple BF interpretor. +# +# This works by translating input code into ruby and evaluating the +# translated ruby code. Doing it this way runs much faster than +# interpreting BF on our own. +# +# There is no error reporting whatsoever. A malformed input may result in +# a syntax error at run time, but good luck in finding where it came from. + + +# Setup empty tape and initial pointer position. Note that tape size is +# fixed. We can make it infinite by initializing it to "[]" here and +# adding some nil checks in the generated code, but avoiding those checks +# makes the program run ~10% faster. +$code = "t=Array.new(30000,0); p=0;" + +# Counters for pending add or shift operations. We buffer incoming +-<> +# operators and output a single merged operation when we encounter a +# different operator. +$buffered_add = 0 +$buffered_shift = 0 + +# Flush pending add operations, if any. +def flush_add + if $buffered_add != 0 + $code += "t[p]+=#{$buffered_add};" + $buffered_add = 0 + end +end + +# Flush pending shift operations, if any. +def flush_shift + if $buffered_shift != 0 + $code += "p+=#{$buffered_shift};" + $buffered_shift = 0 + end +end + +def flush_pending_ops + flush_add + flush_shift +end + +# Convert input characters to ruby. +ARGF.each_char{|c| + case c + when '+' + flush_shift + $buffered_add += 1 + when '-' + flush_shift + $buffered_add -= 1 + when '<' + flush_add + $buffered_shift -= 1 + when '>' + flush_add + $buffered_shift += 1 + when ',' + flush_pending_ops + $code += "if c=STDIN.getc;" + + "t[p]=c.ord;" + + "else;" + + "t[p]=-1;" + # EOF is interpreted as -1. + "end;" + when '.' + flush_pending_ops + $code += "print t[p].chr;" + when '[' + flush_pending_ops + $code += "while t[p]!=0;" + when ']' + flush_pending_ops + $code += "end;" + end +} +flush_pending_ops + +# Evaluate converted code. +eval $code diff --git a/sample/trick2025/01-omoikane/entry.rb b/sample/trick2025/01-omoikane/entry.rb new file mode 100644 index 0000000000..c84f8079ae --- /dev/null +++ b/sample/trick2025/01-omoikane/entry.rb @@ -0,0 +1,32 @@ + a=+Math::PI/13 + #Z---z';#za-mRUBY + #A-ZaA-Mn--\[+>+>++ + '"N-Z(\++\[->++++@" + b=\[->+> +>+>\[h_ + p%{} eact + zoraq ;%{ GF. rin); + %{eb} r A R p *""\] + <<<{{{ }<\]<b + ]<l(%w| } ; a;a=%Y/ + evar{|c)} <][ #pgny\W{f + chaa,b)]>++[ ->+>>>>>[40v + .tr(= ' ;eval(%w{r=u=b= y =0;%{ + (ct;c ) ; ] <<->--<<< < < ] >>[>, + exi}; a * = A RGV.siz e > 0 ? -1:1; + z=[] ; A R G F .ea c h _ l i n e{|i +|i.eac h _ g r aph e m e _ c l u ster +{|j|i f ( k = j.o r d ) < 3 3 ; r+=k< +32?k==9? 8 - r%8 : k = = 1 0 | |k==13 +?[u+=1,-r][ 1]: 0 : 1 ; e lse;z+=[[u, +r,j]];b+=r;y+=u;r+=1;end;}};if(s=z.si +ze)>0;b/=s;y/=s;m,n=z[0];i=Math::tan( +a/2);j=Math::sin(a);z.map!{|d|p=d[1]- +b;q=d[0]-y;p-=(i*q).round;m=[m,q+=(j* + p).round].min;n=[n,p-=(i*q).round]. + min;[q,p,d[2]]};r=n;u=m;z.sort.eac + h{|d|p,b=d;r=(u<p)?n:r;print"\n" + *(p-u),"\40"*(b-r),d[2];u=p;r= + b+1};print"\n";end}*"");%(]> + "tyvuts(}}.--.>--.>+.<++' + )b\40"gena.(c)2025<<< + #)#ehol""+a*.^_^ diff --git a/sample/trick2025/01-omoikane/remarks.markdown b/sample/trick2025/01-omoikane/remarks.markdown new file mode 100644 index 0000000000..2aa77d64e4 --- /dev/null +++ b/sample/trick2025/01-omoikane/remarks.markdown @@ -0,0 +1,71 @@ +### Summary + +This is a rot13 filter. Given an input text, it will **rotate** the text by **pi/13** radians. Two modes of operation are available, selected based on number of command line arguments. + +Rotate clockwise: + + ruby entry.rb < input.txt + +Rotate counterclockwise: + + ruby entry.rb input.txt + ruby entry.rb - < input.txt + +### Details + +This program interprets input as an ASCII art with each character representing individual square pixels, and produces a rotated image to stdout. All non-whitespace characters are preserved in output, only the positions of those characters are adjusted. While all the characters are preserved, the words and sentences will not be as readable in their newly rotated form. This makes the program suitable for obfuscating text. + + ruby entry.rb original.txt > rotated.txt + ruby entry.rb < rotated.txt > unrotated.txt + +But note that while `unrotated.txt` is often the same as `original.txt`, there is no hard guarantee due to integer rounding intricacies. Whether the original text can be recovered depends a lot on its shape, be sure to check that the output is reversible if you are using this rot13 filter to post spoilers and such. + +Reversibility does hold for `entry.rb`: + + ruby entry.rb entry.rb | ruby entry.rb | diff entry.rb - + ruby entry.rb < entry.rb | ruby entry.rb - | diff entry.rb - + +Also, there is a bit of text embedded in the rotated version: + + ruby entry.rb entry.rb | ruby + +But this text is encrypted! No problem, just rotate `entry.rb` the other way for the decryption tool: + + ruby entry.rb < entry.rb > caesar_cipher_shift_13.rb + ruby entry.rb entry.rb | ruby | ruby caesar_cipher_shift_13.rb + +If current shell is `bash` or `zsh`, this can be done all in one line: + + ruby entry.rb entry.rb | ruby | ruby <(ruby entry.rb < entry.rb) + +### Miscellaneous features + +To rotate to a different angle, edit the first line of `entry.rb`. Angles between -pi/2 and pi/2 will work best, anything outside that range produces more distortion than rotation, although the output might still be reversible. + +Setting angle to zero makes this program a filter that expands tabs, trim whitespaces, and canonicalize end-of-line sequences. + +This program preserves non-ASCII characters since input is tokenized with `each_grapheme_cluster`, although all characters that's not an ASCII space/tab/newline are given the same treatment. For example, the full-width space character (U+3000) will be transformed as if it's a half-width non-whitespace ASCII character. + +If input contains only whitespace characters, output will be empty. + +The layout is meant to resemble a daruma doll. There was still ~119 bytes of space left after fitting in 3 ruby programs, so I embedded a brainfuck program as well. + + ruby bf.rb entry.rb + +A `sample_input.txt` has been included for testing. After rotating this file 26 times either clockwise or counterclockwise, you should get back the original `sample_input.txt`. + + ruby entry.rb < sample_input.txt | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | ruby entry.rb | diff sample_input.txt - + ruby entry.rb sample_input.txt | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | ruby entry.rb - | diff sample_input.txt - + +Additional development notes can be found in `spoiler_rot13.txt` (rotate clockwise to decode). + + ruby entry.rb < spoiler_rot13.txt + +### Compatibility + +Program has been verified to work under these environments: + + * ruby 3.2.2 on cygwin. + * ruby 2.5.1p57 on linux. + * ruby 2.7.4p191 on linux. + * ruby 2.7.1p83 on jslinux. diff --git a/sample/trick2025/01-omoikane/sample_input.txt b/sample/trick2025/01-omoikane/sample_input.txt new file mode 100644 index 0000000000..244530f265 --- /dev/null +++ b/sample/trick2025/01-omoikane/sample_input.txt @@ -0,0 +1,35 @@ + T U + S V + + R T U W + S V + + Q R W X + + Q X + P i h g f Y + j e + P k d Y + + O l c Z + O Z + m b + +* N N n + a A A * + + o z + M B + M p y B + + L q x C + r w + L s t u v C + K D + + K J E D + + I F + J H G E + + I F + H G diff --git a/sample/trick2025/01-omoikane/spoiler_rot13.txt b/sample/trick2025/01-omoikane/spoiler_rot13.txt new file mode 100644 index 0000000000..91636176b8 --- /dev/null +++ b/sample/trick2025/01-omoikane/spoiler_rot13.txt @@ -0,0 +1,470 @@ + . + text + ted t to + rota tex + dit HTML + to etes oss + sier wri acr + t earb"), ions . + ke itry. etat text + o ma "en erpr tive + ge te.g. e int: erna + L paut ( tiplsteps alt edit,he + a HTM inp muling cted ach dit tu + -w tes nt as havellow expe er ely ere yo + uby neragume can e fo the aftrect whethis + in/rt gee ar hat y th t. has stepindicesshat + usr/bcripingl ext tt tr texsult ion to prois w +#!/his s a s of t migh inale re rotatededis aich ts. +# TTakest. ece you origf th tra ts neike , wh tex + # stdou a piles, the ck i e exemenuld lusly ated the + # ite ang s tod che f th movu wotaneo rot pen + # To wrrent edit, an se orsort yoimul and nd o ne. + # diffe ome tion1-2. ecaue cu Whats s inal t, a en do + # ke srotaeps ous be thve. tex orig ayou t wh + # 1. Maply t st tediecausuitiated hold he l tex this + # 2. Apepea is lt bunint rot to rom ted. ated but + # 3. R cessficu is l and ough le fenabl upd nce, in + # pro diftextgina e en L fiipt the atie dable + # Thisalsoive ori larg HTMascr paste of p reay + # and rnat thedes: at's te a jav opy& bit its. t is Rubke }, + # alteeditrovi t th nerawith en c fair l ed thar ine-li, %w{ + # can pt p ayou to geser , th h a manua textasiequot %() + # scri a l ipt brow page witose ing 's eple %{}, + # Make scrin a TML textn th writt itulti of ter + ## 1. thisTML the H dit ly o lly:l, buas m use Ras t + # Run ut H via ly euick ficaiviauby hakestes. eral wan + # 2. outp its anualte q peciy trse R.rb m quo Gen nd we + # y ed to mitera by sactlecauntryouble for rs a + # Appl eed you g Rut exs, b. ele+d ithm acte + # 3. ll nlet ardins nouageientsing Algor char paperpplyg + # stiill regons ilangnvenmon ast ces: are nal ply ardin + # Youol w hingtatither e co com "A Feren els rigi sim regato + # to re trienny o quit the on diff r pix . O andailsnter + # e mole oo ma areourse asedtwo e ous. tionates detn ce o + # Onltiped tthatof c is bith sincalue rotardine toatio is n + # mumparors and ithm h, w ls, er v r of coot du rot here ns d + # coerat//, lgor Paet pixeract enteinput, but to r, tratio, an. + # op{}, on aAlan ing cha ng cthe as isspecion. ente opeinput two + # %W tati by blendinal ardiing ues th reunct on ctionthe ne or + # e roion" for orig reghift vale witer f tatirota of a li + # Thotat ort the tionut snate car_cen e roise hapeextr + # R supperve idera aboordixtra get stablockwhe s an ons. + # No pres consthingd coed e see ore terclon tting tatiugh + # - to nal any-basee neble, a mcoun lot nser e roltho + # itio sayto 0ng, wersi tingise/ds a by i oducd, a + # Addsn'trms undit rev elecockwepenible ] prstea + # - doensfor routpu in se clIt dvers pi/2t in ly to + # trategehe o care utivt. e re i/2, tex ical + # inke t tra onsecr ou mad [-pt the omat + # ma h exat c othen be weenstorible. aut + # wite theachon ca beto divers sted + # Evenantecel tati glesnd te re adju s. + # guar cane ro y ane tell b l be ment + # willn th Onlrang sti wil ele + # ofte gle.that ight idth text + # n anide ion m . W ble erialink + atiooutsrmat/ 13 entss. edita les. he scan l + Rotles nsfo:PI elemcell all tup . T we + # Ang traath: edit ter to eme) textthat + # the = M of harac ched graph ate uch her. + #NGLE ightre c.9em" atta al, rotD, sh ot + A e hesqua= "0 be seri me toue I eac + Linure GHT me to x, aphe uniqs to + # ens_HEI s na (y, d grme aation + #LINE clas "t" t of s anaphe rot + yle SS = a lis nateh grrent + # St_CLA as ordi eaciffe + EDIT nput he cogivess d + ad i ed td to acro + # Lo y neaddeheme + # onl is grap 0 + # Wemberame put _y = {|c| + # nuhe sd_in] ursor ster + # t loa = [ = c ine|_clu 8 + defdataor_x 0 ne{|lheme x % + cursal =h_li_grap 1 sor_r\n" ] + seri.eaceach= " "x +=" cur= "\ , c] + ARGFine. c =rsor_ "\t 8 - c = rial + l if cu c ==x +=" || x, se + lsifrsor_ "\n0 sor_ + e cu c ==x = 1 cur + lsifrsor_y += r_y, t + e cursor_ urso thay + cu [[c= 1 ilityed bext. + lse ta +=_x +1 obabollowal t + e daursor += e pron frigin + cerial ass. s thtatihe o + s of m easee roin t l be hat + end nter incrkwislts wilges thave + m ce nter clocresu heret ed We + } a fro n cee. a sa) o, taighion. + dat nter atio, i.e ver zer strotat + } turn n ce rotible vic frome.g.he r , + re tatio s asvers (or away er, er t tione. + nd e ro mase retion und cent aftcts: rotaitiv + e mput er ofll brota e rotionld betifa o. ox. ftern pos + # Co centon wiise ow wrotashouse ar zerng box aemai r + # ing tatilockw to hthe hey the d ofunding bon r othey + # Use roterc due ear an tduce nsteaf bounditati s atbilittion + # thcoun ely, ts nd tho re ty iter of bor ro factersiul op + # a unattifacaggegs t fini cenner oafte arti revusef f + # forte arore jthin e ino be cor and get theost er or + # Unsiblut mious itivon to before we losehe m centr fo + # vime o var postation ts be thatlso be t theedito + # coried owardf rotatinate e is we a to ause an and the t + # t nd tter of roordi thes andpears ll catesaddsm in tha + # Rou center ol co of ter,s ap s wienerrts rithd for + # - Set cenat al all cen mas cterly guppoalgo neer). + # - Seth th with ther of charat onso sion reatithe + # - suc ened d ofente. ing script alotat a gol e + # happnsteang cacts emovhis r thahe re iss to + # hat es i Usirtif nd rhy tditoent tther thi + # Wplacure.the a ng ais wan eplemsure for + # featite ertiich ave reimnot need + # desp t ins, whTo h to am any + # thashiftt. need. Ie is + # Note to g texill riptther + # massacin we wvascure + # repltes,ed jaot sa) + # deleerat am n(dat ze + # genl (Ienter ta.si + # tooet_cy = 0t| / da + #ef g = cach{|1] cy + d cxta.e+= t[0] ize, + da cx += t[ ta.s es. + cy / da inat + n cx oorda) + } etur to ccy, . + r ion cx, 2) gain + end rotatta, (a / X a + ply te(da:tan(a) | r in + # AprotaMath::sinp{|tnts. shea + def x = Math:a.maonte then + ry = n dater c cx Y, + retur Cent1] - cy r in me). + r # = t[0] - shead aphe eme. + x = t[ X, round , gr graph + y r in y).round erial ach + Shearx * x).roun x, s nd e + # -= (ry * y). (y, arou + x += (rx * ted ] pan + y -= ( updat[3] ne s + x urn 2], ith o + # Ret, t[ xt wfix) + [y, x L te_pre + HTM, id + } k ofdata0] n + d blocock(ata[ ].min + en rate e_bl = d t[1]].mi + Geneneratin_xt| _x, t[0] + # f ge_y, mch{|[min_y, + de minta.eax = [min >\n" + da min_y = ix}\" + min_ x pref + min_y {id_ + } x = min_=\"# r_y) + rsor_y = e id{|t| curso + cursor_"<preach y - + cuxt = ort.t < y * ( + teata.sx = or_y"\n" + d y, curs += = yin_x + if textor_y = m + cursor_x + curs [3] &" " + = t== "amp;" + end textext = "&= "< + ner_er_text xt =lt;"" ' + + in inner_tr_te= "&= "> '"> + if inninneext xt =gt;" SS +_s + + sif er_tr_te= "& x) +_CLA].to + el inninneext rsor_EDIT t[2 + sif er_t - cu"' + ix + + el inn (x ass=_pref + d " *n cl+ id low. + en += "<spa="' t + er be + ext '" id_tex numb + t 'nneran>" ial ns. + i</sp+ 1 ser colum + "= x re>" next. by + r_x n</p the airs them + urso + "\ find er p oup + c ext er, numbta) d gr + } rn t numbrialap(das an + retu ial f sewn_my row + nd serst or_dors b + e eacha liursoumbe + For rns te_cal n ]] + # Retuneraseri} |t| ] [t[2 + #ef geort = {ach{t[1]] += ] + d # Sumnsrt.emns[t[1] [t[2] + cola.socolumns[ ] = n. + dat if colu t[1] olum 0]]) . + e mns[ ch c [r[ ight + elscolu or ea 1] + he r by + rs f e - to t sortnext + end umbe .siz mber we the + al n r| [1, r l nu o if us + } seri [] |_, ip(r eria s, s get + Add ls =ach{ r.z xt s inateould ) + # erians.es += e ners. oordhat w [0]] + solumrial s d th pai n) c1, t ials + c se rial , finmberta) olum by [ser a + n se mberal nup(daw, cials 1] + extr + }etur l nuseriht_ma (ro ser e - one + r eria of _rig with all .siz get + end ch slistrsortartotate [2]}ials . e we ,' + r eas a e_cues snd r t| t ser airs sinc + '" + # Foturnerattuples a. map{|s[1, ue p) ine, o_s + # Re genput tuplbersort.erial valairsnewl 1].t + def# Input numta.sip(s keyal_ping + t[ + # inrial= dals.z s asserirail efix + # seals eria pairix, ut t + pr + serirn s mber(prefitho "' + retu l nu_mapies wate. '": + eriarsorentrtempl|t| _s + + end at st_cumap the .map{].to + Formnverate rom airs+ t[0 + # f coenerne fal_pfix + de # Gewliseri pre es. + # nurn "' + valu + ret' " nate + "\n ordi + } * f co) a[0] + d ge odata dat + en ranize(_x = + Getet_s minn_x + #ef gn_y,= min_y min 1 + d mix_x = mi|t| , x].max y + + max_y ach{t in_x, x].min min_ + mata.ex = = [max_x, y].max y - + da y, n_x = [min_y, y]. max_ + mix_x = [max_y 1, + man_y = [m n_x + + mix_y - mi + ma x_x + n ma + }etur + r ut + end _inp + loadty? ) a) GLE)) /td> + a = .emp (data(dat -ANNGLE ")}< > + datdatarn nter_size cy,y, A d> r> , "Ltd> }</td + if retu t_ce get cx,x, c /hea "><tdata)}</"R") + = geht = data,a, c le>< ng="4eft_ "M"ta, + end cy heig ate(e(dat /tit addiock(lata,t_da + cx,th, rototat est< ellpe_block(drigh + wid ta = = r te t 1" cerate_bllock( + t_dadata >Rota ng="{generatte_b l> + lefght_ OT" itle pacip">#{gennera labe + ri <<"Ed><t cells="top">##{ge le)</ + int <hea "1" align="toop"> "> togg or + prtml> der=t" valignn="t edit to l> errght, + <hody> bor"left" vvalig id="(ESC"><u izes-hei + <bableign="lefft" ox" dit nonet. minimline + <td align=="le heckble elay: tex hat sing + <td allignble>e="c>Enabdisplace . ne tcreap. + <ttd a</ta typdit"yle=" repor. anel he oy deerla + </tr>nputr="e" sters =cursct p ep tis bo ov + <p><il fohelpractmove sele nd keo thes t + <labeid=" chas = ab = s, also d lin + <div SCII keyft+to. "> aluean ae the ; + <li>Arrow shi und riptng vWe ccaus ght) + <li>Aab /+Z = vascpacio. ill tHei + <li>TCtrliv> xt/jaer-sratich wM");; offse + <<li>></d ="te lettect o muId("HT}" / p. + </ul typerentd aspt tontByHEIG dth + ipt iffesireg thalemeINE_ etWi + <scrry de deasin.getE"#{L 2) offs + // To thecrementht = 0.0 - p. + // tut ddocuHeig x += em";ght} + // bp = line= 0; 2; .0; + "{hei + var yle.t_x or =x < 2 = x / # + p.st bes_err 0; cingdth} + var min x = erSpa#{wi + var(var lett.abs( ) + for yle.Mathr > e + { p.ste = erro ; ; + var min_ r = e"em" + if( erro x + t_x;); }"; + { min__x = bes("L"IGHT + best ng =ByIdE_HE + Spaciment{LINt_x;"); T}"; + } tteretEle= "# besd("REIGH + e.lent.gight ng =tByINE_H; + } stylcumeneHeSpaciemen#{LIst_x + p.= doe.littergetEl = "= be + p style.leent.eighting + p.stylocumineHrSpac ta))} + p. = dle.lette e; t_da } + p.style.l tate.fals . (lefa))}ata)) + p.sty le sit = tion ns. _map(datht_d + p itabe_ed posi itio down_map(rig + / Wrnabl rsor ; pos rsor_down_map )} + /ar e t cu "M0" rsor e_cursor_down data) + v rrenor = t cu erate_cursor_ eft_)} ))} + / Cucurs o nex generate_cu ap(lata)_data + /var ng t "L", generat ht_map(dight + appi = map("M", gen _right_map(r + // Mdown rsor_map("R", ursor_right_m + var t_cursor_map( te_cursor_rig + { nvert_cursor_ nerate_cursor + #{convert_cu , generate_c + #{conver ("L", genera rs. + #{co ht = _map("M", ge ) pai + }; rig ursor_map("R" text + var rt_cursor_map nal + { onvert_cursor rigi + #{convert_c x, o n)) + #{conve uffi . (dow + #{c (id s []; ions tries + }; of ist = osit t.en ) + Listdo_l or p bjec ght) + // r un curs of O s(ri + va erse}; ue] ntrie + Rev = { {}; val ct.e + //r upft =[key, Obje + var lenst key; of + var(co e] = lue] + fo valu , va on. + { up[ [key ey; siti + onst = k e po ; + }or(c alue] . e sam tyle; + f ft[v okes$/; t th = style; + { le ystr!-~] rs a tyle = style + ed ke /^[ actele) x).style = s + } cepteys = char sty suffix).style + / AcditK for (id, (1);" + suffix).s + /ar e tyle tyle bstrd("L" + suffi + v et s setS d.sutById("M" + + // Stion = iementById("R . + func uffixetElementByI tion + { ar sent.getElemen posi + vocument.getEl n. sor + document.g itio s cur . 0"; + docum posd) viou tion ff808 + d rsoror(i pre posi nd:# ; + } te cuCurs t at rsor ); grou xt]) + Updan set ligh""); w cu f80"back erTe + // ctio highor, t ne :#80f = " .inn + fun lear curs ht a oundstyle ion. fix) + { // Ctyle( hlig ckgrid). osit suf + setS hig "bayId( me p "M" +t; + pdate id;sor,entB at sa yId(= text; + // Usor =(curElem ers entBext = text; + curStyle.get ractxt) ElemnerText = tex + setument cha, te .get).innerText + doc fort(id 1); umentffix).innerT + texteTex str( doc + suffix).in + } lace plac .subfix,("L" + suffix + Repon re = id[sufById("M" + su + //ncti fix ush(mentById("R" + fu r sufst.ptElementById + { vado_lit.getElement + uncument.getEle + document.ge it. [1]; + documen t ed ) ntry[1]; + do ecen = 0 t = entry[1]; + st r() th = rText = entry + } do moundo leng innerText = e + / Untion ist. ); ix).innerTex + /func do_l pop( suffix).inne + { f( un ist. L" + suffix). + i urn; do_l[0];Id("M" + suff + { ret = unntryntById("R" + + try = elementById(" + }ar enffixgetElementBy x); + var suent.getEleme suffi + vdocument.getEit ) ] + + document.e_ed or[0 + documnabl curs "; + if( e sor( line + { tCur "in + se us. lay = + } statt() it; disp + dit _edi e_ed yle. ; + } ge eggle nabl ).st one" + Chann to = !e) elp" = "n + //nctio dit dit ; Id("h play ; + fu le_ele_e sor)ntBy .dis edit + { enabenab (curleme tyle able_ ) + if( rsorgetE ").s = en S}") + { etCuent. ; help ked CLAS + socum "")yId(" chec DIT_ + d sor,entB t"). ("#{E + } e (curElem ("edi Name + els tyle.get ById lass + { setSment ment sByC { + docu tEle ment => + t.ge s. etEle ent) + } umen enernt.g (ev + doc listcume ick", + ent f do ("cl + } d ev t o ener ) => { + // Adonst Listedit nt) ) ) + for(c ventble_ id); (eve "Z" + { addE ena r(t. n", y == + t. if( urso ydow t.ke + { setC r("ke even + tene || + } tLis) e" ) = "z" + ); Evendit Escap ey = + } .addle_e == " nt.k ) ) + } mentenab key (eve "Z" + docuf( ! ent. (); && y == + i ( ev edit rlKey t.ke + { if gle_ t.ct even + { tog even " || + if( = "z + }lse ; ey = + e do() nt.k + { un (eve + n; y && s) ) + }etur rlKe tKey + r t.ct (edi ); + } even match .key + if( (); key. vent + { undo ent. or, er]); ) + ( ev curscurso wUp" e" ) + } e if ext(ght[ Arro spac + els aceTr(ri == " Back + { replurso .key ); n" ) == " + setC vent rsor] wDow key + f( e p[cu Arro vent. ) + } se i or(u == " || e " " + el Curs .key r]); ft" == + { set vent curso owLe .key + f( e own[ "Arr event + } se i or(d y == ; || M"} + el Curs t.ke or]) ght" ": "L"}; + { set even [curs owRi , "R": " + if( left "Arr "L", "R + } lse sor( y == ); "M": "R" + e tCur t.ke sor] "R", "M":; + { se even t[cur b" ) L": "M", r(1) + if( righ "Ta ? {"L": subst + }lse sor( ey == Key : {"sor. + e tCur nt.k hift cur { + { se eve ent.s ]] + ) => + if( = ev or[0 vent + }else ext [curs " ) , (e + { ar n nextsor); cape ick" + v r = (cur "Es ("cl + ursorsor ey == ener + cetCu nt.k tList + s eve ); Even + } if( dit( (); .add + else le_e fault it") + { togg ntDe ("ed + reve tById + } nt.p emen + eve etEl(); + ; nt.gedit + })cumegle_ + do tog + ; pt> > + })scri html + </ y></ + /bod + <OT + E diff --git a/sample/trick2025/02-mame/authors.markdown b/sample/trick2025/02-mame/authors.markdown new file mode 100644 index 0000000000..0e420fdf5d --- /dev/null +++ b/sample/trick2025/02-mame/authors.markdown @@ -0,0 +1,3 @@ +* Yusuke Endoh + * mame@ruby-lang.org + * cctld: jp diff --git a/sample/trick2025/02-mame/entry.rb b/sample/trick2025/02-mame/entry.rb new file mode 100644 index 0000000000..d5de370dc9 --- /dev/null +++ b/sample/trick2025/02-mame/entry.rb @@ -0,0 +1,34 @@ +From:pd <pd-@example.com> (`) +Date:Wed,01 Jan 2025 00:00:00 +0000 +Subject:[PATCH] +an(/.{40}/));exit].gsub(/X.*X|\n(\h+\s)?\+?/,E=""))#TRICK2025]} + +--- /dev/null ++++ pd.rb +@@ -0,0 +1,27 @@ ++%;`);;BEGIN{eval$s=%q[eval(%q[F=File;puts((dup)?(q="%;`);;BEGIN ++{eval$s=%q[#$s]}";U,*,V=R=(0..33.0).map{|t|q.gsub(/./){i=$`.siz ++e;c=(i/64*2i-26i+i%64-31)*1i**(t/16.5);x,y=c.rect;r=c.abs;r<13? ++4<=r&&r<6&&x>-4||-5<x&&x<=-3&&-6<y&&y<11??.:?X:$&}};B,A="---|%s ++\n+++|%s\n@@|-%s,%s|+%s,%s|@@\nFrom:pd|<pd-@example.com>|(`)\nD ++ate:%a,%d|%b|%Y|%T|%z\nSubject:[PATCH]|".tr(?|,z="\s")[/@.*\n/] ++,$`;(i=R.index(q))?(S,T=i<33?R[i,(f=->i{(Time.gm(2025)+86400*i) ++.strftime$'};o=f[i+1]+(fXXXXXXXXXXXXXXX[0]+q[/.*\z/]+?\n*2+A%[" ++/dev/null",v="pd.rb"]+XXXXXXXXXXXXXXXXXXXB%[0,0,1,27]+U.gsub(/^ ++/,?+)).lines[-i-2],EXXXXXXXXXXXXXXXXXXXXXXX,a=A%[v,v];V<<"\n(`\ ++n#{a+B%[0,0,1,1]}+dXXXXXXXXXXXXXXXXXXXXXXXXXup=(`)";2)]:($*.siz ++e!=2&&abort(["usagXXXXXXXXX.........XXXXXXXXXe:",$0,F,F]*z);$*. ++map{o=A%$*;F.read(XXXXXXXXX..XXXXXX..XXXXXXXX_1)});a=[i=0]*v=(s ++=[s]+S.lines).sizeXXXXXXXXX..XXXXXX..XXXXXXXX;c=b=s.map{c=_1&&[ ++c,?-+_1,i+=1]||0};XXXXXXXXX..XXXXXX..XXXXXXXXT.lines{|t|s.map{| ++s|a<<((s)?[x=a[-1]XXXXXXXXX.........XXXXXXXXX,y=a[-v]].max+((f= ++s==t)?1:0):0);c,d=(XXXXXXXX..XXXXXXXXXXXXXXXf)?[v+1,z+t]:s&&(x> ++y)?[1,?-+s]:[v,?++t]XXXXXXX..XXXXXXXXXXXXXX;b<<[b[-c],d,i+=1]}} ++;c=b[-1].flatten;b=c[(XXXXX..XXXXXXXXXXXX1..)%2];(b.map{_1[0]}* ++E).scan(/\s{,3}([-+]\s{,XXXXXXXXXXXXXXX6})*[-+]\s{,3}/){n=c[2*i ++=$`.size];o=o,B%[n%v+1-1/v,(m=c[2.*i+j=$&.size]-n)%v,T>""?n/v+1 ++:0,m/v],b[i,j]}):(o=[];a,b=[A,B].map{_1.sub(?+){'\+'}%(['(\S+)' ++]*4)};$<.read=~//;F.write$2,(s=F.readlines$1;o<<[:patching,F,$2 ++]*z;(*,n,i,m=[*$~].map{_1.to_i};n+=m;($'=~/\A((-)|\+)?(.*\n)/;$ ++2?s[i-=1,1]=[]:$1?s[i-1,0]=$3:n-=1;i+=1;n-=1)while+n>0)while/\A ++#{b}/=~$';s*E)while$'=~/^#{a}/);o):([*[?l]*799,1].shuffle*E).sc ++an(/.{40}/));exit].gsub(/X.*X|\n(\h+\s)?\+?/,E=""))#TRICK2025]} diff --git a/sample/trick2025/02-mame/remarks.markdown b/sample/trick2025/02-mame/remarks.markdown new file mode 100644 index 0000000000..8be86ebc2d --- /dev/null +++ b/sample/trick2025/02-mame/remarks.markdown @@ -0,0 +1,141 @@ +# A Lesser "Patch" Program + +This program is a minimalistic version of the traditional "patch" command, which looks like a patch. + +## Usage as a "Patch" Command + +The program reads a unified diff file from standard input and applies the changes to the specified files. + +To apply `test.patch` to `sample.rb`, use the following commands: + +``` +$ cp sample.orig.rb sample.rb +$ ruby entry.rb < test.patch +``` + +After running these commands, verify that `sample.rb` has been modified. + +## Usage as a Patch File + +Interestingly, this program is not just a patch-like tools -- it *is* a patch. +This duality allows it to be applied like a regular patch file. + +The following will create a file named pd.rb. + +``` +$ patch < entry.rb +``` + +Alternatively, you can achieve the same result using `entry.rb`: + +``` +$ ruby entry.rb < entry.rb +``` + +The generated `pd.rb` produces a new patch. + +``` +$ ruby pd.rb +``` + +The produced patch is self-referential, targeting `pd.rb` itself. +To apply it: + +``` +$ ruby pd.rb | ruby entry.rb +``` + +You'll notice the `p` logo rotates slightly counterclockwise. + +The modified `pd.rb` outputs the patch for itself again, apply the patch repeatedly--a total of 33 times! + +## From `p` to `d` + +The center `p` logo symbolizes a "patch." +When rotated 180 degrees, it resembles a `d`, signifying a transformation in functionality. +`pd.rb` now operates as a simplified "diff" command: + +``` +$ ruby pd.rb +usage: pd.rb File File + +$ ruby pd.rb sample.orig.rb sample.rb +--- sample.orig.rb ++++ sample.rb +... +``` + +## Integration with Git + +The patches are compatible with Git's `git am` command, which imports patches in mbox format. + +Start fresh by removing `pd.rb` and initializing a Git repository: + +``` +$ rm -f pd.rb +$ git init +Initialized empty Git repository in /home/... +``` + +And import `entry.rb` as a patch to the repository: + +``` +$ git am --committer-date-is-author-date entry.rb +Applying: +(/.{40}/));exit].gsub(/X.*X|\n(\h+\s)?\+?/,E=""))#_TRICK2025_]} +applying to an empty history +``` + +Verify the commit history: + +``` +$ git log +commit 1e32693f11c1df77bd797c7b3e9f108a3e139824 (HEAD -> main) +Author: pd (`) <pd-@example.com> +Date: Wed Jan 1 00:00:00 2025 +0000 + + +an(/.{40}/));exit].gsub(/X.*X|\n(\h+\s)?\+?/,E=""))#TRICK2025]} +``` + +Notice that the Author and Date are properly set. + +To apply subsequent patches: + +``` +$ for i in `seq 0 32`; do ruby pd.rb | git am --committer-date-is-author-date; done +``` + +*(A fun details: you will see the `b` logo!)* + +Now, view a commit history by the following command: + +``` +$ git log --oneline +``` + +You will rediscover the original `entry.rb` unexpectedly. + +If you set `--committer-date-is-author-date` appropriately, you should be able to run the output of `git log --oneline` as is. + +Try this unusual command: + +``` +$ git log --oneline | ruby - test.patch +``` + +## A Little Something Extra + +Interestingly, `pd.rb` -- functioning as a diff command -- is a patch to itself. +Reveal hidden details with: + +``` +$ ruby entry.rb pd.rb +$ ruby pd.rb +``` + +Can you spot the difference? + +## Limitations + +* I tested it with ruby 3.3.6, git 2.45.2, and GNU patch 2.7.6. +* No error check at all. The lesser patch do not care if there is a discrepancy between what is written in the patch and the input file, and will write over the existing file without prompt. +* It is assumed that the text files have a new line at the end. diff --git a/sample/trick2025/02-mame/sample.orig.rb b/sample/trick2025/02-mame/sample.orig.rb new file mode 100644 index 0000000000..3d880b387d --- /dev/null +++ b/sample/trick2025/02-mame/sample.orig.rb @@ -0,0 +1,8 @@ +def add(a, b) + a + b +end + +if __FILE__ == $0 + result = add(3, 5) + puts "Three plus five is #{ result }" +end diff --git a/sample/trick2025/02-mame/test.patch b/sample/trick2025/02-mame/test.patch new file mode 100644 index 0000000000..0a63ae8a4c --- /dev/null +++ b/sample/trick2025/02-mame/test.patch @@ -0,0 +1,16 @@ +--- sample.rb ++++ sample.rb +@@ -2,7 +2,13 @@ + a + b + end + ++def sub(a, b) ++ a - b ++end ++ + if __FILE__ == $0 + result = add(3, 5) + puts "Three plus five is #{ result }" ++ result = sub(5, 3) ++ puts "five minus three is #{ result }" + end diff --git a/sample/trick2025/03-tompng/authors.markdown b/sample/trick2025/03-tompng/authors.markdown new file mode 100644 index 0000000000..26ebe24da6 --- /dev/null +++ b/sample/trick2025/03-tompng/authors.markdown @@ -0,0 +1,3 @@ +* Tomoya Ishida (tompng) + * tomoyapenguin@gmail.com + * cctld: jp diff --git a/sample/trick2025/03-tompng/entry.rb b/sample/trick2025/03-tompng/entry.rb new file mode 100644 index 0000000000..0de2244979 --- /dev/null +++ b/sample/trick2025/03-tompng/entry.rb @@ -0,0 +1,74 @@ +eval->{%w[u=*? a..?i;l=*?j..? r;o=*?s..?z,?_ +;m='#-*&|^`!@$ '.chars;s=[[3] ,[0,1,3,4,6],[ +1,5],[1,4],[0, 4,6],[2,4],[2] ,[1,3,4,6],[], + [4], ];a= (0.. 7).m ap{[ + ?;*_ 1+'a 4',: a1,? x*(_ + 1+2) ]*"T /#{? x.*6 7-_1 + }/x; "};v =([c =[?x *150 + ]*4, a.reverse,[[6, 3,0].map{"a#{_ + 1}T/ #{?x*15}/x"}*( ?;*42)+';xx']* + 30,a .map{_1.tr'14' ,'25'},c,]*n=$ + /).g sub( /(^| ;)(; + *);/ ){$1 +?x* $2.s + ize+ ?;}; p,e= [0,1 + ].ma p{|t |g=( ["(m + fT/' /;#{a=(0..9).m ap{"f#{_1}T/l# + {_1} =1./"}*?;};C"' ;#{a.tr'l',?u} + ;?C" ",(0..9).map{| i|a="l#{i}T/'/ + + +;C"' ;";b ="#{o[i-1]+?=i fTi>0}%+";(1.. +9).m ap{a <<l[_1-1]+"T/% #{c=m[_1]}/;"; +b<<c +";# {(d=_1+i)>10?' ca='+o[d-11]:d +>9?' ca': o[d- 1]}= +%"+c };a+ b+[m [1.. +],?+ ,?"] *';? '}," +caT/ '/;C "';" +(1. +.8).map{u[8-_1 ]+"T/#{u[9-_1] }=1./;"}*''+u[ +0]+h='=1;?"',( 1..9).map{|i|" u#{i}T/'/;C"'; +"+(0..8-i).map {u[8-i-_1]+"T/ #{u[8-_1]}=1./ + ;"}* ''+u [i-1 ]+h} + ]*?; ).sp lit( /([^ + ;]+; )/); ((0. .43) + .map {|y| c='' ;q=- + >{a= (y-22).abs;b=( c.size+_1-78). + abs; [a<7&&b<59||b< 15,(b-30).abs< + 14][ t]};110.times{ c+=q[8]?g.shif + + + t||? ;:q[-t]??;:'T' };c.gsub(';T', + 'TT' ).rstrip}*n).g sub(/(;|T)(;;+ + )(;| $)/){$1+'/'+?x *($2.size-2)+' + /'+$ 3}}; F=Fi + le;1 0.ti mes{ + |i|a ="(n fT/m + f=l# {i}= '/;n + f=f# {i}=?';def/("+ s[i].map!{"a#{ + _1}" }*','+')=(';F. write"#{i}",a+ + ?x*( 150-a.size)+n+ v[..-5]+'))&&' + +n}; a,*b ="/) + &&de f((C nCn< + <A"; c=") )./( + ";d= 'T}' ,?A, + '__= <<B';u.map{|v| b<<v+"TT%(T<<# + {v}T )TT";d=d,v,"AC n#{v}=<<B"};o. + zip( l,m){a+=?;+_1+ "T/%#{_3}/";c+ + + +=(_3[?#]||?#+_ +3)+"))./("+_2+ +?,};F.write'+' +,n*2 6+[p [..- +10]+ (a+c ).tr ('!@',%("')).g +sub( /%([ '"`] )/,){$1},'#{TT +T'+b *';T T'+d *n,?B,')=']*n+ +n;a, b=[u ,o].map{|v|(0. +.8). map{ t=s[9-_1];t[0] +&&t+ =[1] ;v[8-_1]+"T/#{ +t*?= }#/" }*?; +';a3='+?x*25} +;F.w rite '=', [n*26]*2*e+a+n ++v+n +(b+ n+v) .tr(?a,?b)[..- +9]+' )if~ exit +'+n].join.tr(' +TRICK',_1)}[+" +\x2025"<<-?\\] diff --git a/sample/trick2025/03-tompng/remarks.markdown b/sample/trick2025/03-tompng/remarks.markdown new file mode 100644 index 0000000000..7f3f4ac6cf --- /dev/null +++ b/sample/trick2025/03-tompng/remarks.markdown @@ -0,0 +1,146 @@ +### Remarks + +Run it with no argument. It will generate 12 files: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + and =. + +```sh +ruby entry.rb +``` + +Concat and syntax highlight them. + +```sh +cat 2 0 + 2 5 = | ruby -run -e colorize +cat 4 + 1 5 + 4 + 1 8 = | ruby -run -e colorize +``` + +I confirmed the following implementations/platforms: + +* ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +MN +PRISM [arm64-darwin22] +* ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT +MN [arm64-darwin22] + +### Description + +Did you know that Ruby syntax can perform additive operations on two-digit numbers without Ruby runtime? This entry demonstrates a syntax level computation of Ruby grammar. + +`ruby entry.rb` will generate 12 files: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + and =. +These files constitute a calculator system that runs on Ruby parser. + +To calculate `6 + 7`, concat `6`, `+`, `7` and `=`. + +```sh +cat 6 + 7 = +``` + +The concatenated output is a Ruby script that does nothing. It is also an ASCII art of `█ + █ = ██` rotated 90 degrees. +Now, let's try syntax highlighting that code. + +```sh +cat 6 + 7 = | ruby -run -e colorize +``` + +Wow! You can see the calculation result `6 + 7 = 13` as a colorized ASCII art! + +This system can also add more than two numbers. All numbers should be one or two digits, and the answer should be less than 100. + +```sh +cat 3 1 + 4 + 1 5 + 9 = | ruby -run -e colorize +cat 1 + 2 + 4 + 8 + 1 6 + 3 2 = | ruby -run -e colorize +cat 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 0 = | ruby -run -e colorize +``` + +If the syntax highlighting is hard to see, use this command to change the terminal color. + +```sh +printf "\e]11;#000000\a\e]10;#333333\a\e]4;1;#ffaaaa\a" +``` + +### Internals + +To perform calculation, you need a storage and a control flow statement. +Local variable existence can be used as a storage. +Ruby syntax provides conditional local variable definition and local variable reset with state carry over which can be used as a control flow statement. + +#### Conditional Local Variable Definition + +Ruby syntax can define new local variables conditionally. + +```ruby +# Defines x and y if a is defined +a /x = y = 1./ +# Defines x and y if a is not defined +a /1#/; x = y = 1 +# Defines x or y depend on the existence of local variable a +a /(x=1);'/;(y=1);?' +``` + +#### Local Variables Reset + +Local variables can be cleared by creating a new `def` scope. + +```ruby +x = y = z = 1 +def f +# x, y, z are cleared +``` + +#### State Carry Over + +Some state should be carried over to the next `def` scope. There are two tricks to do it. + +```ruby +a /%+/i; b /%-/i; def f(x)# +; def f(y) # -; def f(z) +``` + +```ruby +a %(<<A); b %(<<B); def f +x=<<C +A +y=<<C +B +z=<<C +C +``` + +In both examples above, local variable defined in the new scope will be: + +```ruby +x # if both a and b are not defined +y # if a is defined +z # if b is defined +``` + +Combining these two tricks, Ruby syntax can carry over two states to the next `def` scope. In this system, two states represents upper digit and lower digit. + +### File Structure + +```ruby +# File 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 +(code) && +``` + +```ruby +# File + +(code) && def f(arg)= +``` + +```ruby +# File = +(code) if exit +``` + +```ruby +# cat 1 2 + 3 + 4 5 = +(one) && +(two) && +(plus) && def f(arg)= +(three) && +(plus) && def f(arg)= +(four) && +(five) && +(equal) if exit +``` + +### Limitation + +Number to be added must be one or two digits. +Answer of the addition must be less than 100. diff --git a/sample/trick2025/04-tompng/authors.markdown b/sample/trick2025/04-tompng/authors.markdown new file mode 100644 index 0000000000..26ebe24da6 --- /dev/null +++ b/sample/trick2025/04-tompng/authors.markdown @@ -0,0 +1,3 @@ +* Tomoya Ishida (tompng) + * tomoyapenguin@gmail.com + * cctld: jp diff --git a/sample/trick2025/04-tompng/entry.rb b/sample/trick2025/04-tompng/entry.rb new file mode 100644 index 0000000000..881c1af871 --- /dev/null +++ b/sample/trick2025/04-tompng/entry.rb @@ -0,0 +1,36 @@ + $c=%q@E=" + \e[4%d;37m%s\e[m" + ;n=32.chr;pu ts"\e + [H\e[J#{$c=n*54+' $c=% + q'+[64.chr]*2*$c+';e val$ + c.'+n*10+"\n"+n*57+"spl it*' + '"+n*15}";n=l=0;R=->y=0 {n+=1 + ;l=$c.lines. map{|m|m=(0..79).chunk{380-n+ + 36*Math.sin(0.04.*it-n )<9*y}.map{a=_2.map{m[it]}*'' + ;_1&&E%[6,a]||a}*'';m!=l[~-y +=1]&&$><<"\e[#{y}H#{m}\e[37H + ";m}};N=(Integer$* [-1]resc ue+30)*H=44100;alias:r:rand + ;F=->e,w=1{a=b=c=0;d=( 1-e)**0 .5*20;->v=r-0.5{a=a*w*e+v + ;b=b*w*e*e+v;d.*a-2*b+c=c*w *e**3+ v}};A=->u,n,t{(0..n). + map{|i|u=u.shuffle.map{|w|R[]; a=u.s ample;b,c,d=[[0.5 + ,(0.2+r)*H/3*1.1**i,[[1+r/10,1+r/ 10]][ i]||[1.2+ + r/10,1.3+r/5]],[0.3,r*H/2,[1,1+r/5 ]]][t +];e,f=d.shuffle;g=b+r;h=b+r;(0..[w. size/e, a.size/f ++c].max).map{g*(w[it*e]||0)+h*(a[[it-c,0].ma x*f]||0)}}}};j=A[A +[(0..9).map{a=F[0.998,1i**0.02];(0..28097).m ap{a[].real.*0.1**(8.0*i +t/H)-8e-6}},14,0].transpose.map{|d|a=[0]*3e3 ;15.times{|i|R [];b=r + (3e3);d[i].each_with_index{a[c=_2+b]=(a[c] ||0)+_1*0.63**i}} ;a},9, + 1][4..].flatten(1).shuffle;y=(0..3).map{F[ 1-1e-5]};m=[-1,1].map {[F[1 + -1e-4],F[1-5e-5],it]};u=v=w=0;k=[],[],[] ;z=F[0.7,1i**0.5];File.o pen($ + *.grep(/[^\d]/)[0]||'output.wav','wb') {|f|f<<'RIFF'+[N*4+36,'WA VEfmt + ',32,16,1,2,H,H*4,4,16,'data',N*4].p ack('Va7cVvvVVvva4V');N.tim es{| + i|$><<E%[4,?#]if(i+1)*80/N!=i*80 /N;t=[i/1e5,(N-i)/2e5,1].min;a,b,c=k + .map{it.shift||(j[20*r,0]=[g =j.pop];a=1+r/3;it[0..]=(0..g.size).m + ap{g[it*a]||0};0)};u=u *0.96+r-0.5;v=v*0.99+d=r-0.5;w=w*0.8+d + ;x=(z[].*1+0 .59i).imag;e=y.map(&:[]);f.<<m.map{|o, + p,q|r=a+(b+c)/2+(b-c)*q/5;s=o[r.abs] + ;r=t*t*(3-2*t)*(r+s*w/1e4+p[s]*x/1 + e7+[[u,0],[v,1]].sum{_1*1.5**(e[ + _2]+q*e[_2+2]/9)}/32)/9;r/(1 + +r*r)**0.5*32768}.pack'v + *'}};puts@;eval$c. + split*'' diff --git a/sample/trick2025/04-tompng/remarks.markdown b/sample/trick2025/04-tompng/remarks.markdown new file mode 100644 index 0000000000..b2d848c07c --- /dev/null +++ b/sample/trick2025/04-tompng/remarks.markdown @@ -0,0 +1,43 @@ +# Seashore - Nature Sound + +Listen to the relaxing sound of ocean waves generated by Ruby. + +## Usage + +```sh +ruby entry.rb +ruby entry.rb seashore.wav 60 +``` + +The default filename is `output.wav` and the default duration is 30 seconds. + +Tested with ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +MN +PRISM [arm64-darwin22] + +## Noise + +Noise sound is created by applying low-pass/band-pass filter to a white noise signal. +Volume of the noise should change over time. This is also calculated by using low-pass filter. + +## Wave + +Sound of a single ocean wave is composed of hundreds of water splash sounds. +Each water splash sound is composed of thousands of water drops and bubbles. +This program creates this complicated sound by repeating sound mixing. + +```ruby +sound2 = mix(sound1.change_pitch(rand), sound1.change_pitch(rand).delay(rand)) +sound4 = mix(sound2.change_pitch(rand), sound2.change_pitch(rand).delay(rand)) +... +sound32768 = mix(sound16384.change_pitch(rand), sound16384.change_pitch(rand).delay(rand)) + +splash1 = mix(sound1.delay(rand), sound2.delay(rand), sound4.delay(rand), ..., sound16384.delay(rand)) +splash2 = mix(splash1.change_pitch(rand), splash1.change_pitch(rand).delay(rand)) +splash4 = mix(splash2.change_pitch(rand), splash2.change_pitch(rand).delay(rand)) +... +splash1024 = mix(splash512.change_pitch(rand), splash512.change_pitch(rand).delay(rand)) + +wave_sound = [splash32, splash64, ..., splash1024].sample +``` + +This kind of repetition is often used in fractal rendering. In other words, this operation is rendering a fractal shape to the spectrogram canvas. +It's an efficient way to create complex structure with low computational cost. diff --git a/sample/trick2025/05-tompng/authors.markdown b/sample/trick2025/05-tompng/authors.markdown new file mode 100644 index 0000000000..26ebe24da6 --- /dev/null +++ b/sample/trick2025/05-tompng/authors.markdown @@ -0,0 +1,3 @@ +* Tomoya Ishida (tompng) + * tomoyapenguin@gmail.com + * cctld: jp diff --git a/sample/trick2025/05-tompng/entry.rb b/sample/trick2025/05-tompng/entry.rb new file mode 100644 index 0000000000..4d30c5b5a9 --- /dev/null +++ b/sample/trick2025/05-tompng/entry.rb @@ -0,0 +1,118 @@ +module ReadableFizzBuzz + module Chain + end +end + +include ReadableFizzBuzz + +Chain::Itself = Chain + +module Chain::Itself + module Void + A = B = C = D = E = F = G = H = I = J = K = L = M = Void + N = O = P = Q = R = S = T = U = V = W = X = Y = Z = Void + + module Set + end + + module Put + end + + module WriteBack + end + + module Not + include Void + end + end + + module Off + include Void + end + + module Nil + A = B = C = D = E = F = G = H = I = J = K = L = M = Off + N = O = P = Q = R = S = T = U = V = W = X = Y = Z = Off + end + + module Next + include Nil + end + + module Current + include Nil + + Not = Off + Set = Put = Next + WriteBack = Current + end + + True = If = Current + On = Next + + module On + INT = 1 + FIZZ = 'Fizz' + BUZZ = 'Buzz' + PREFIX = '0b' + FORMAT = "%d%s%s\n" + NEXT = __FILE__ + end + + module Off + INT = 0 + FIZZ = BUZZ = nil + PREFIX = '0b1' + FORMAT = "%2$s%3$s\n" + NEXT = '/dev/null' + Not = True + end + + module Initial + C = D = True + end + + module ReadableFizzBuzz::Chain::Current + include Initial + end + + If::C::Set::E = If::E::Set::F = If::F::Set::C = On + If::D::Set::G = If::G::Set::H = If::H::Set::I = If::I::Set::J = If::J::Set::D = On + If::F::Not::J::Not::Set::B = On + If::K::Not::Set::K = On + If::K::WriteBack::L = True + If::L::Not::M::Set::M = On + If::L::M::Not::Put::M = On + If::L::M::WriteBack::N = True + If::N::Not::O::Set::O = On + If::N::O::Not::Put::O = On + If::N::O::WriteBack::P = True + If::P::Not::Q::Set::Q = On + If::P::Q::Not::Put::Q = On + If::P::Q::WriteBack::R = True + If::R::Not::S::Set::S = On + If::R::S::Not::Put::S = On + If::R::S::WriteBack::T = True + If::T::Not::U::Set::U = On + If::T::U::Not::Put::U = On + If::T::U::WriteBack::V = True + If::V::Not::W::Set::W = On + If::V::W::Not::Put::W = On + If::V::W::WriteBack::X = True + If::X::Not::Y::Set::Y = On + If::X::Y::Not::Put::Y = On + If::X::Y::WriteBack::Z = True + If::Z::Not::Set::A = On +end + +module Chain::Chain + Current = Chain::Next +end + +include Chain + +module Chain::Current + NUMBER = A::PREFIX, Y::INT, W::INT, U::INT, S::INT, Q::INT, O::INT, M::INT, K::INT + printf B::FORMAT, NUMBER.join, C::FIZZ, D::BUZZ + load A::NEXT +end diff --git a/sample/trick2025/05-tompng/remarks.markdown b/sample/trick2025/05-tompng/remarks.markdown new file mode 100644 index 0000000000..adb4bf4df8 --- /dev/null +++ b/sample/trick2025/05-tompng/remarks.markdown @@ -0,0 +1,106 @@ +### Remarks + +Just run it with no argument: + +```sh +ruby entry.rb +``` + +I confirmed the following implementations/platforms: + +- ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +MN +PRISM [arm64-darwin22] +- ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [aarch64-linux-musl] + +### Description + +Readability is important even for a simple fizz buzz program. + +These are the major ingredients of a spaghetti that makes program tasty and valuable but unreadable. + +- Many class definitions +- Many method definitions +- Many method calls +- Many variables +- Conditional branches + +These are what is acceptable for a readable program. + +- Many modules: Using only a single module in a program is not good. +- Many constants: Better than magic numbers. +- Module#include: Mixins are what module is for. +- Many file loads: Usually better than loading a large file only once. +- Minimal method calls: Needed for printing output. + +This program is doing something slightly difficult in the last few lines: print output and load ruby program. +In contrast, the rest part of this program is extremely simple and easy. Module definition, constant definition and module inclusion. That's all. + +### Internals + +Called methods + +- `Module#include` +- `Array#join` +- `Kernel#printf` +- `Kernel#load` + +Deeply nested module chain to avoid constant reassignment + +```ruby +10.times do + module Root + module Chain + module X; end + module Y; end + module Z; end + end + end + include Root + + module Chain::Chain + # Not a constant reassignment because Chain::Chain is always a new module + X = Chain::Y + Y = Chain::Z + Z = Chain::X + end + include Chain + p x: X, chain: Chain +end +``` + +Constant allocation + +| Constant | Purpose | +| ---------------------- | ----------------------- | +| A | Loop condition | +| B | Format (!Fizz && !Buzz) | +| C, E, F | Fizz rotation | +| D, G, H, I, J | Buzz rotation | +| K, M, O, Q, S, U, W, Y | Iteration bits | +| L, N, P, R, T, V, X, Z | Temporary carry bits | + +Instruction sequence with constant lookup magic + +```ruby +# B = 1 if A +If::A::Set::B = On + +# B = 1 if !A +If::A::Not::Set::B = On + +# C = 1 if !A && B +If::A::Not::B::Set::C = On + +# C = 1 if !A && !B +If::A::Not::B::Not::Set::C = On +``` + +Loop with `load __FILE__` + +```ruby +# A::NEXT is __FILE__ or '/dev/null' +load A::NEXT +``` + +### Limitation + +Needs `/dev/null` diff --git a/sample/trick2025/README.md b/sample/trick2025/README.md new file mode 100644 index 0000000000..1d71f54620 --- /dev/null +++ b/sample/trick2025/README.md @@ -0,0 +1,16 @@ +This directory contains the top-five entries of +the 5th Transcendental Ruby Imbroglio Contest for rubyKaigi (TRICK 2025). + +THESE ARE BAD EXAMPLES! You must NOT use them as a sample code. + +* 1st: "Most Revolutionary" - Don Yang +* 2nd: "Most Useful" - Yusuke Endoh +* 3rd: "Most Arithmetic" - Tomoya Ishida +* 4th: "Best ASMR" - Tomoya Ishida +* 5th: "Most Maintainable" - Tomoya Ishida + +These files are licensed under MIT license. + +For the contest outline and other winning entries, see: + +https://github.com/tric/trick2025 diff --git a/sample/win32ole/excel1.rb b/sample/win32ole/excel1.rb deleted file mode 100644 index 4fe1d0c2a9..0000000000 --- a/sample/win32ole/excel1.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -application = WIN32OLE.new('Excel.Application') - -application.visible = true -workbook = application.Workbooks.Add(); -worksheet = workbook.Worksheets(1); - -=begin -worksheet.Range("A1:D1").value = ["North","South","East","West"]; -worksheet.Range("A2:B2").value = [5.2, 10]; - -worksheet.Range("C2").value = 8; -worksheet.Range("D2").value = 20; -=end - -worksheet.Range("A1:B2").value = [["North","South"], - [5.2, 10]]; - -vals = WIN32OLE_VARIANT.new([["East","West"], - [8, 20]], - WIN32OLE::VARIANT::VT_ARRAY) -worksheet.Range("C1:D2").value = vals - -range = worksheet.Range("A1:D2"); -range.Select -chart = workbook.Charts.Add; - -workbook.saved = true; - -print "Now quit Excel... Please enter." -gets - -application.ActiveWorkbook.Close(0); -application.Quit(); - diff --git a/sample/win32ole/excel2.rb b/sample/win32ole/excel2.rb deleted file mode 100644 index 47a5715f84..0000000000 --- a/sample/win32ole/excel2.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -# -4100 is the value for the Excel constant xl3DColumn. -ChartTypeVal = -4100; - -# Creates OLE object to Excel -excel = WIN32OLE.new("excel.application") - -# Create and rotate the chart -excel.visible = true; -excel.Workbooks.Add(); -excel.Range("a1").value = 3; -excel.Range("a2").value = 2; -excel.Range("a3").value = 1; -excel.Range("a1:a3").Select(); -excelchart = excel.Charts.Add(); -excelchart.type = ChartTypeVal; - -i = 0 -i.step(180, 10) do |rot| - excelchart.rotation=rot; - sleep 0.1 -end -# Done, bye - -print "Now quit Excel... Please enter." -gets - -excel.ActiveWorkbook.Close(0); -excel.Quit(); diff --git a/sample/win32ole/excel3.rb b/sample/win32ole/excel3.rb deleted file mode 100644 index 72aee2a929..0000000000 --- a/sample/win32ole/excel3.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -#application = WIN32OLE.new('Excel.Application.5') -application = WIN32OLE.new('Excel.Application') - -application.visible = true -workbook = application.Workbooks.Add(); -sheet = workbook.Worksheets(1); -sheetS = workbook.Worksheets -puts "The number of sheets is #{sheetS.count}" -puts "Now add 2 sheets after of `#{sheet.name}`" -sheetS.add({'count'=>2, 'after'=>sheet}) -puts "The number of sheets is #{sheetS.count}" - -print "Now quit Excel... Please enter." -gets - -application.ActiveWorkbook.Close(0); -application.Quit(); - diff --git a/sample/win32ole/ie.rb b/sample/win32ole/ie.rb deleted file mode 100644 index 4db64eed30..0000000000 --- a/sample/win32ole/ie.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' -url = 'http://www.ruby-lang.org/' -ie = WIN32OLE.new('InternetExplorer.Application') -ie.visible = true -ie.gohome -print "Now navigate Ruby home page... Please enter." -gets -ie.navigate(url) -print "Now quit Internet Explorer... Please enter." -gets -ie.Quit() diff --git a/sample/win32ole/ieconst.rb b/sample/win32ole/ieconst.rb deleted file mode 100644 index 363a4f8153..0000000000 --- a/sample/win32ole/ieconst.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -ie = WIN32OLE.new('InternetExplorer.Application') -=begin -WIN32OLE.const_load(ie) -WIN32OLE.constants.sort.each do |c| - puts "#{c} = #{WIN32OLE.const_get(c)}" -end -=end - -module IE_CONST -end - -WIN32OLE.const_load(ie, IE_CONST) -IE_CONST.constants.sort.each do |c| - puts "#{c} = #{IE_CONST.const_get(c)}" -end - -#------------------------------------------------------------ -# Remark!!! CONSTANTS has not tested enoughly!!! -# CONSTANTS is alpha release. -# If there are constants which first letter is not [a-zA-Z], -# like a '_Foo', then maybe you can access the value by -# using CONSTANTS['_Foo'] -#------------------------------------------------------------ -IE_CONST::CONSTANTS.each do |k, v| - puts "#{k} = #{v}" -end - -puts WIN32OLE::VERSION -ie.quit - diff --git a/sample/win32ole/ienavi.rb b/sample/win32ole/ienavi.rb deleted file mode 100644 index 5d0536028b..0000000000 --- a/sample/win32ole/ienavi.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -$urls = [] - -def navigate(url) - $urls << url -end - -def stop_msg_loop - puts "Now Stop IE..." - $LOOP = false; -end - -def default_handler(event, *args) - case event - when "BeforeNavigate" - puts "Now Navigate #{args[0]}..." - end -end - -ie = WIN32OLE.new('InternetExplorer.Application') -ie.visible = true -ie.gohome - -ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents') - -ev.on_event {|*args| default_handler(*args)} -ev.on_event("NavigateComplete") {|url| navigate(url)} -ev.on_event("Quit") {|*args| stop_msg_loop} - -$LOOP = true -while ($LOOP) - WIN32OLE_EVENT.message_loop -end - -puts "You Navigated the URLs ..." -$urls.each_with_index do |url, i| - puts "(#{i+1}) #{url}" -end - diff --git a/sample/win32ole/ienavi2.rb b/sample/win32ole/ienavi2.rb deleted file mode 100644 index 3248393077..0000000000 --- a/sample/win32ole/ienavi2.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -class IEHandler - attr_reader :loop - def initialize - @urls = [] - @loop = true - end - def method_missing(event, *args) - case event - when "BeforeNavigate2" - puts "Now Navigate #{args[1]}..." - end - end - def onNavigateComplete2(pdisp, url) - @urls << url - end - def onOnQuit - puts "Now Stop IE..." - @loop = false - end - def put_urls - puts "You Navigated the URLs ..." - @urls.each_with_index do |url, i| - puts "(#{i+1}) #{url}" - end - end -end - -ie = WIN32OLE.new('InternetExplorer.Application') -ie.visible = true -ie.gohome - -ev = WIN32OLE_EVENT.new(ie) -ev.handler = IEHandler.new - -while (ev.handler.loop) - WIN32OLE_EVENT.message_loop -end -ev.handler.put_urls diff --git a/sample/win32ole/oledirs.rb b/sample/win32ole/oledirs.rb deleted file mode 100644 index e52a0fd7ac..0000000000 --- a/sample/win32ole/oledirs.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: false -# -# You need WSH(Windows Scripting Host) to run this script. -# - -require "win32ole" - -def listup(items) -# items.each do |i| - for i in items - puts i.name - end -end - -fs = WIN32OLE.new("Scripting.FileSystemObject") - -folder = fs.GetFolder(".") - -puts "--- folder of #{folder.path} ---" -listup(folder.SubFolders) - -puts "--- files of #{folder.path} ---" -listup(folder.Files) - diff --git a/sample/win32ole/olegen.rb b/sample/win32ole/olegen.rb deleted file mode 100644 index 9398194cf1..0000000000 --- a/sample/win32ole/olegen.rb +++ /dev/null @@ -1,348 +0,0 @@ -# frozen_string_literal: false -#----------------------------- -# olegen.rb -# $Revision$ -#----------------------------- - -require 'win32ole' - -class WIN32COMGen - def initialize(typelib) - @typelib = typelib - @receiver = "" - end - attr_reader :typelib - - def ole_classes(typelib) - begin - @ole = WIN32OLE.new(typelib) - [@ole.ole_obj_help] - rescue - WIN32OLE_TYPE.ole_classes(typelib) - end - end - - def generate_args(method) - args = [] - if method.size_opt_params >= 0 - size_required_params = method.size_params - method.size_opt_params - else - size_required_params = method.size_params - 1 - end - size_required_params.times do |i| - if method.params[i] && method.params[i].optional? - args.push "arg#{i}=nil" - else - args.push "arg#{i}" - end - end - if method.size_opt_params >= 0 - method.size_opt_params.times do |i| - args.push "arg#{i + size_required_params}=nil" - end - else - args.push "*arg" - end - args.join(", ") - end - - def generate_argtype(typedetails) - ts = '' - typedetails.each do |t| - case t - when 'CARRAY', 'VOID', 'UINT', 'RESULT', 'DECIMAL', 'I8', 'UI8' -# raise "Sorry type\"" + t + "\" not supported" - ts << "\"??? NOT SUPPORTED TYPE:`#{t}'\"" - when 'USERDEFINED', 'Unknown Type 9' - ts << 'VT_DISPATCH' - break; - when 'SAFEARRAY' - ts << 'VT_ARRAY|' - when 'PTR' - ts << 'VT_BYREF|' - when 'INT' - ts << 'VT_I4' - else - if String === t - ts << 'VT_' + t - end - end - end - if ts.empty? - ts = 'VT_VARIANT' - elsif ts.end_with?(?|) - ts += 'VT_VARIANT' - end - ts - end - - def generate_argtypes(method, proptypes) - types = method.params.collect{|param| - generate_argtype(param.ole_type_detail) - }.join(", ") - if proptypes - types += ", " if types.size > 0 - types += generate_argtype(proptypes) - end - types - end - - def generate_method_body(method, disptype, types=nil) - " ret = #{@receiver}#{disptype}(#{method.dispid}, [" + - generate_args(method).gsub("=nil", "") + - "], [" + - generate_argtypes(method, types) + - "])\n" + - " @lastargs = WIN32OLE::ARGV\n" + - " ret" - end - - def generate_method_help(method, type = nil) - str = " # " - if type - str += type - else - str += method.return_type - end - str += " #{method.name}" - if method.event? - str += " EVENT" - str += " in #{method.event_interface}" - end - if method.helpstring && method.helpstring != "" - str += "\n # " - str += method.helpstring - end - args_help = generate_method_args_help(method) - if args_help - str += "\n" - str += args_help - end - str - end - - def generate_method_args_help(method) - args = [] - method.params.each_with_index {|param, i| - h = " # #{param.ole_type} arg#{i} --- #{param.name}" - inout = [] - inout.push "IN" if param.input? - inout.push "OUT" if param.output? - h += " [#{inout.join('/')}]" - h += " ( = #{param.default})" if param.default - args.push h - } - if args.size > 0 - args.join("\n") - else - nil - end - end - - def generate_method(method, disptype, io = STDOUT, types = nil) - io.puts "\n" - io.puts generate_method_help(method) - if method.invoke_kind == 'PROPERTYPUT' - io.print " def #{method.name}=(" - else - io.print " def #{method.name}(" - end - io.print generate_args(method) - io.puts ")" - io.puts generate_method_body(method, disptype, types) - io.puts " end" - end - - def generate_propputref_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYPUTREF' && method.visible? - }.each do |method| - generate_method(method, io) - end - end - - def generate_properties_with_args(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYGET' && - method.visible? && - method.size_params > 0 - }.each do |method| - types = method.return_type_detail - io.puts "\n" - io.puts generate_method_help(method, types[0]) - io.puts " def #{method.name}" - if klass.ole_type == "Class" - io.print " OLEProperty.new(@dispatch, #{method.dispid}, [" - else - io.print " OLEProperty.new(self, #{method.dispid}, [" - end - io.print generate_argtypes(method, nil) - io.print "], [" - io.print generate_argtypes(method, types) - io.puts "])" - io.puts " end" - end - end - - def generate_propput_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYPUT' && method.visible? && - method.size_params == 1 - }.each do |method| - ms = klass.ole_methods.select {|m| - m.invoke_kind == 'PROPERTYGET' && - m.dispid == method.dispid - } - types = [] - if ms.size == 1 - types = ms[0].return_type_detail - end - generate_method(method, '_setproperty', io, types) - end - end - - def generate_propget_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYGET' && method.visible? && - method.size_params == 0 - }.each do |method| - generate_method(method, '_getproperty', io) - end - end - - def generate_func_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == "FUNC" && method.visible? - }.each do |method| - generate_method(method, '_invoke', io) - end - end - - def generate_methods(klass, io = STDOUT) - generate_propget_methods(klass, io) - generate_propput_methods(klass, io) - generate_properties_with_args(klass, io) - generate_func_methods(klass, io) -# generate_propputref_methods(klass, io) - end - - def generate_constants(klass, io = STDOUT) - klass.variables.select {|v| - v.visible? && v.variable_kind == 'CONSTANT' - }.each do |v| - io.print " " - io.print v.name.sub(/^./){$&.upcase} - io.print " = " - io.puts v.value - end - end - - def class_name(klass) - klass_name = klass.name - if klass.ole_type == "Class" && - klass.guid && - klass.progid - klass_name = klass.progid.gsub(/\./, '_') - end - if /^[A-Z]/ !~ klass_name || Module.constants.include?(klass_name) - klass_name = 'OLE' + klass_name - end - klass_name - end - - def define_initialize(klass) - <<STR - - def initialize(obj = nil) - @clsid = "#{klass.guid}" - @progid = "#{klass.progid}" - if obj.nil? - @dispatch = WIN32OLE.new @progid - else - @dispatch = obj - end - end -STR - end - - def define_include - " include WIN32OLE::VARIANT" - end - - def define_instance_variables - " attr_reader :lastargs" - end - - def define_method_missing - <<STR - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end -STR - end - - def define_class(klass, io = STDOUT) - io.puts "class #{class_name(klass)} # #{klass.name}" - io.puts define_include - io.puts define_instance_variables - io.puts " attr_reader :dispatch" - io.puts " attr_reader :clsid" - io.puts " attr_reader :progid" - io.puts define_initialize(klass) - io.puts define_method_missing - end - - def define_module(klass, io = STDOUT) - io.puts "module #{class_name(klass)}" - io.puts define_include - io.puts define_instance_variables - end - - def generate_class(klass, io = STDOUT) - io.puts "\n# #{klass.helpstring}" - if klass.ole_type == "Class" && - klass.guid && - klass.progid - @receiver = "@dispatch." - define_class(klass, io) - else - @receiver = "" - define_module(klass, io) - end - generate_constants(klass, io) - generate_methods(klass, io) - io.puts "end" - end - - def generate(io = STDOUT) - io.puts "require 'win32ole'" - io.puts "require 'win32ole/property'" - - ole_classes(typelib).select{|klass| - klass.visible? && - (klass.ole_type == "Class" || - klass.ole_type == "Interface" || - klass.ole_type == "Dispatch" || - klass.ole_type == "Enum") - }.each do |klass| - generate_class(klass, io) - end - begin - @ole.quit if @ole - rescue - end - end -end - -require 'win32ole' -if __FILE__ == $0 - if ARGV.size == 0 - $stderr.puts "usage: #{$0} Type Library [...]" - exit 1 - end - ARGV.each do |typelib| - comgen = WIN32COMGen.new(typelib) - comgen.generate - end -end diff --git a/sample/win32ole/xml.rb b/sample/win32ole/xml.rb deleted file mode 100644 index 5a239c9336..0000000000 --- a/sample/win32ole/xml.rb +++ /dev/null @@ -1,7307 +0,0 @@ -# frozen_string_literal: false -# -# This file created by olegen.rb as following. -# ruby olegen.rb 'Microsoft XML, version 2.0' > xml.rb -# -require 'win32ole' -require 'win32ole/property' - -# -module IXMLDOMImplementation - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BOOL hasFeature - # BSTR arg0 --- feature [IN] - # BSTR arg1 --- version [IN] - def hasFeature(arg0, arg1) - ret = _invoke(145, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# Core DOM node interface -module IXMLDOMNode - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# Constants that define a node's type -module OLEtagDOMNodeType - include WIN32OLE::VARIANT - attr_reader :lastargs - NODE_INVALID = 0 - NODE_ELEMENT = 1 - NODE_ATTRIBUTE = 2 - NODE_TEXT = 3 - NODE_CDATA_SECTION = 4 - NODE_ENTITY_REFERENCE = 5 - NODE_ENTITY = 6 - NODE_PROCESSING_INSTRUCTION = 7 - NODE_COMMENT = 8 - NODE_DOCUMENT = 9 - NODE_DOCUMENT_TYPE = 10 - NODE_DOCUMENT_FRAGMENT = 11 - NODE_NOTATION = 12 -end - -# -module IXMLDOMNodeList - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 length - # number of nodes in the collection - def length() - ret = _getproperty(74, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # PTR item - # collection of nodes - # I4 arg0 --- index [IN] - def item - OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH]) - end - - # IXMLDOMNode nextNode - # get next node from iterator - def nextNode() - ret = _invoke(76, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID reset - # reset the position of iterator - def reset() - ret = _invoke(77, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMNamedNodeMap - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 length - # number of nodes in the collection - def length() - ret = _getproperty(74, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # PTR item - # collection of nodes - # I4 arg0 --- index [IN] - def item - OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH]) - end - - # IXMLDOMNode getNamedItem - # lookup item by name - # BSTR arg0 --- name [IN] - def getNamedItem(arg0) - ret = _invoke(83, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode setNamedItem - # set item by name - # IXMLDOMNode arg0 --- newItem [IN] - def setNamedItem(arg0) - ret = _invoke(84, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeNamedItem - # remove item by name - # BSTR arg0 --- name [IN] - def removeNamedItem(arg0) - ret = _invoke(85, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode getQualifiedItem - # lookup the item by name and namespace - # BSTR arg0 --- baseName [IN] - # BSTR arg1 --- namespaceURI [IN] - def getQualifiedItem(arg0, arg1) - ret = _invoke(87, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeQualifiedItem - # remove the item by name and namespace - # BSTR arg0 --- baseName [IN] - # BSTR arg1 --- namespaceURI [IN] - def removeQualifiedItem(arg0, arg1) - ret = _invoke(88, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextNode - # get next node from iterator - def nextNode() - ret = _invoke(89, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID reset - # reset the position of iterator - def reset() - ret = _invoke(90, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentType doctype - # node corresponding to the DOCTYPE - def doctype() - ret = _getproperty(38, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMImplementation implementation - # info on this DOM implementation - def implementation() - ret = _getproperty(39, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement documentElement - # the root of the tree - def documentElement() - ret = _getproperty(40, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # get the state of the XML document - def readyState() - ret = _getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMParseError parseError - # get the last parser error - def parseError() - ret = _getproperty(59, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # get the URL for the loaded XML document - def url() - ret = _getproperty(60, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL async - # flag for asynchronous download - def async() - ret = _getproperty(61, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL validateOnParse - # indicates whether the parser performs validation - def validateOnParse() - ret = _getproperty(65, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals() - ret = _getproperty(66, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace() - ret = _getproperty(67, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID async - # flag for asynchronous download - def async=(arg0) - ret = _setproperty(61, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID validateOnParse - # indicates whether the parser performs validation - def validateOnParse=(arg0) - ret = _setproperty(65, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals=(arg0) - ret = _setproperty(66, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace=(arg0) - ret = _setproperty(67, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # register a readystatechange event handler - def onreadystatechange=(arg0) - ret = _setproperty(68, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ondataavailable - # register an ondataavailable event handler - def ondataavailable=(arg0) - ret = _setproperty(69, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ontransformnode - # register an ontransformnode event handler - def ontransformnode=(arg0) - ret = _setproperty(70, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement createElement - # create an Element node - # BSTR arg0 --- tagName [IN] - def createElement(arg0) - ret = _invoke(41, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentFragment createDocumentFragment - # create a DocumentFragment node - def createDocumentFragment() - ret = _invoke(42, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText createTextNode - # create a text node - # BSTR arg0 --- data [IN] - def createTextNode(arg0) - ret = _invoke(43, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMComment createComment - # create a comment node - # BSTR arg0 --- data [IN] - def createComment(arg0) - ret = _invoke(44, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMCDATASection createCDATASection - # create a CDATA section node - # BSTR arg0 --- data [IN] - def createCDATASection(arg0) - ret = _invoke(45, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMProcessingInstruction createProcessingInstruction - # create a processing instruction node - # BSTR arg0 --- target [IN] - # BSTR arg1 --- data [IN] - def createProcessingInstruction(arg0, arg1) - ret = _invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute createAttribute - # create an attribute node - # BSTR arg0 --- name [IN] - def createAttribute(arg0) - ret = _invoke(47, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMEntityReference createEntityReference - # create an entity reference node - # BSTR arg0 --- name [IN] - def createEntityReference(arg0) - ret = _invoke(49, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = _invoke(50, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode createNode - # create a node of the specified node type and name - # VARIANT arg0 --- type [IN] - # BSTR arg1 --- name [IN] - # BSTR arg2 --- namespaceURI [IN] - def createNode(arg0, arg1, arg2) - ret = _invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nodeFromID - # retrieve node from it's ID - # BSTR arg0 --- idString [IN] - def nodeFromID(arg0) - ret = _invoke(56, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL load - # load document from the specified XML source - # VARIANT arg0 --- xmlSource [IN] - def load(arg0) - ret = _invoke(58, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # abort an asynchronous download - def abort() - ret = _invoke(62, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL loadXML - # load the document from a string - # BSTR arg0 --- bstrXML [IN] - def loadXML(arg0) - ret = _invoke(63, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID save - # save the document to a specified destination - # VARIANT arg0 --- destination [IN] - def save(arg0) - ret = _invoke(64, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMDocumentType - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR name - # name of the document type (root of the tree) - def name() - ret = _getproperty(131, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap entities - # a list of entities in the document - def entities() - ret = _getproperty(132, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap notations - # a list of notations in the document - def notations() - ret = _getproperty(133, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMElement - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR tagName - # get the tagName of the element - def tagName() - ret = _getproperty(97, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT getAttribute - # look up the string value of an attribute by name - # BSTR arg0 --- name [IN] - def getAttribute(arg0) - ret = _invoke(99, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID setAttribute - # set the string value of an attribute by name - # BSTR arg0 --- name [IN] - # VARIANT arg1 --- value [IN] - def setAttribute(arg0, arg1) - ret = _invoke(100, [arg0, arg1], [VT_BSTR, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID removeAttribute - # remove an attribute by name - # BSTR arg0 --- name [IN] - def removeAttribute(arg0) - ret = _invoke(101, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute getAttributeNode - # look up the attribute node by name - # BSTR arg0 --- name [IN] - def getAttributeNode(arg0) - ret = _invoke(102, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute setAttributeNode - # set the specified attribute on the element - # IXMLDOMAttribute arg0 --- DOMAttribute [IN] - def setAttributeNode(arg0) - ret = _invoke(103, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute removeAttributeNode - # remove the specified attribute - # IXMLDOMAttribute arg0 --- DOMAttribute [IN] - def removeAttributeNode(arg0) - ret = _invoke(104, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = _invoke(105, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID normalize - # collapse all adjacent text nodes in sub-tree - def normalize() - ret = _invoke(106, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMAttribute - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR name - # get name of the attribute - def name() - ret = _getproperty(118, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT value - # string value of the attribute - def value() - ret = _getproperty(120, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID value - # string value of the attribute - def value=(arg0) - ret = _setproperty(120, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMDocumentFragment - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMText - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText splitText - # split the text node into two text nodes at the position specified - # I4 arg0 --- offset [IN] - def splitText(arg0) - ret = _invoke(123, [arg0], [VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMCharacterData - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMComment - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMCDATASection - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText splitText - # split the text node into two text nodes at the position specified - # I4 arg0 --- offset [IN] - def splitText(arg0) - ret = _invoke(123, [arg0], [VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMProcessingInstruction - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR target - # the target - def target() - ret = _getproperty(127, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # the data - def data() - ret = _getproperty(128, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # the data - def data=(arg0) - ret = _setproperty(128, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMEntityReference - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# structure for reporting parser errors -module IXMLDOMParseError - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 errorCode - # the error code - def errorCode() - ret = _getproperty(0, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # the URL of the XML document containing the error - def url() - ret = _getproperty(179, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR reason - # the cause of the error - def reason() - ret = _getproperty(180, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR srcText - # the data where the error occurred - def srcText() - ret = _getproperty(181, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 line - # the line number in the XML document where the error occurred - def line() - ret = _getproperty(182, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 linepos - # the character position in the line containing the error - def linepos() - ret = _getproperty(183, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 filepos - # the absolute file position in the XML document containing the error - def filepos() - ret = _getproperty(184, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMNotation - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT publicId - # the public ID - def publicId() - ret = _getproperty(136, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT systemId - # the system ID - def systemId() - ret = _getproperty(137, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMEntity - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT publicId - # the public ID - def publicId() - ret = _getproperty(140, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT systemId - # the system ID - def systemId() - ret = _getproperty(141, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR notationName - # the name of the notation - def notationName() - ret = _getproperty(142, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# XTL runtime object -module IXTLRuntime - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 uniqueID - # IXMLDOMNode arg0 --- pNode [IN] - def uniqueID(arg0) - ret = _invoke(187, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 depth - # IXMLDOMNode arg0 --- pNode [IN] - def depth(arg0) - ret = _invoke(188, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 childNumber - # IXMLDOMNode arg0 --- pNode [IN] - def childNumber(arg0) - ret = _invoke(189, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 ancestorChildNumber - # BSTR arg0 --- bstrNodeName [IN] - # IXMLDOMNode arg1 --- pNode [IN] - def ancestorChildNumber(arg0, arg1) - ret = _invoke(190, [arg0, arg1], [VT_BSTR, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 absoluteChildNumber - # IXMLDOMNode arg0 --- pNode [IN] - def absoluteChildNumber(arg0) - ret = _invoke(191, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatIndex - # I4 arg0 --- lIndex [IN] - # BSTR arg1 --- bstrFormat [IN] - def formatIndex(arg0, arg1) - ret = _invoke(192, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatNumber - # R8 arg0 --- dblNumber [IN] - # BSTR arg1 --- bstrFormat [IN] - def formatNumber(arg0, arg1) - ret = _invoke(193, [arg0, arg1], [VT_R8, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatDate - # VARIANT arg0 --- varDate [IN] - # BSTR arg1 --- bstrFormat [IN] - # VARIANT arg2 --- varDestLocale [IN] - def formatDate(arg0, arg1, arg2=nil) - ret = _invoke(194, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatTime - # VARIANT arg0 --- varTime [IN] - # BSTR arg1 --- bstrFormat [IN] - # VARIANT arg2 --- varDestLocale [IN] - def formatTime(arg0, arg1, arg2=nil) - ret = _invoke(195, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# W3C-DOM XML Document -class Microsoft_XMLDOM_1_0 # DOMDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{2933BF90-7B36-11D2-B20E-00C04F983E60}" - @progid = "Microsoft.XMLDOM.1.0" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # BSTR nodeName - # name of the node - def nodeName() - ret = @dispatch._getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = @dispatch._getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = @dispatch._getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = @dispatch._getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = @dispatch._getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = @dispatch._getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = @dispatch._getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = @dispatch._getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = @dispatch._getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = @dispatch._getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = @dispatch._getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = @dispatch._getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = @dispatch._getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = @dispatch._getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = @dispatch._getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = @dispatch._getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = @dispatch._getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = @dispatch._getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = @dispatch._getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = @dispatch._getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = @dispatch._getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = @dispatch._getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentType doctype - # node corresponding to the DOCTYPE - def doctype() - ret = @dispatch._getproperty(38, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMImplementation implementation - # info on this DOM implementation - def implementation() - ret = @dispatch._getproperty(39, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement documentElement - # the root of the tree - def documentElement() - ret = @dispatch._getproperty(40, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # get the state of the XML document - def readyState() - ret = @dispatch._getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMParseError parseError - # get the last parser error - def parseError() - ret = @dispatch._getproperty(59, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # get the URL for the loaded XML document - def url() - ret = @dispatch._getproperty(60, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL async - # flag for asynchronous download - def async() - ret = @dispatch._getproperty(61, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL validateOnParse - # indicates whether the parser performs validation - def validateOnParse() - ret = @dispatch._getproperty(65, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals() - ret = @dispatch._getproperty(66, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace() - ret = @dispatch._getproperty(67, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = @dispatch._setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID async - # flag for asynchronous download - def async=(arg0) - ret = @dispatch._setproperty(61, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID validateOnParse - # indicates whether the parser performs validation - def validateOnParse=(arg0) - ret = @dispatch._setproperty(65, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals=(arg0) - ret = @dispatch._setproperty(66, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace=(arg0) - ret = @dispatch._setproperty(67, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # register a readystatechange event handler - def onreadystatechange=(arg0) - ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ondataavailable - # register an ondataavailable event handler - def ondataavailable=(arg0) - ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ontransformnode - # register an ontransformnode event handler - def ontransformnode=(arg0) - ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = @dispatch._invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = @dispatch._invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = @dispatch._invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = @dispatch._invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement createElement - # create an Element node - # BSTR arg0 --- tagName [IN] - def createElement(arg0) - ret = @dispatch._invoke(41, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentFragment createDocumentFragment - # create a DocumentFragment node - def createDocumentFragment() - ret = @dispatch._invoke(42, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText createTextNode - # create a text node - # BSTR arg0 --- data [IN] - def createTextNode(arg0) - ret = @dispatch._invoke(43, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMComment createComment - # create a comment node - # BSTR arg0 --- data [IN] - def createComment(arg0) - ret = @dispatch._invoke(44, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMCDATASection createCDATASection - # create a CDATA section node - # BSTR arg0 --- data [IN] - def createCDATASection(arg0) - ret = @dispatch._invoke(45, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMProcessingInstruction createProcessingInstruction - # create a processing instruction node - # BSTR arg0 --- target [IN] - # BSTR arg1 --- data [IN] - def createProcessingInstruction(arg0, arg1) - ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute createAttribute - # create an attribute node - # BSTR arg0 --- name [IN] - def createAttribute(arg0) - ret = @dispatch._invoke(47, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMEntityReference createEntityReference - # create an entity reference node - # BSTR arg0 --- name [IN] - def createEntityReference(arg0) - ret = @dispatch._invoke(49, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = @dispatch._invoke(50, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode createNode - # create a node of the specified node type and name - # VARIANT arg0 --- type [IN] - # BSTR arg1 --- name [IN] - # BSTR arg2 --- namespaceURI [IN] - def createNode(arg0, arg1, arg2) - ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nodeFromID - # retrieve node from it's ID - # BSTR arg0 --- idString [IN] - def nodeFromID(arg0) - ret = @dispatch._invoke(56, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL load - # load document from the specified XML source - # VARIANT arg0 --- xmlSource [IN] - def load(arg0) - ret = @dispatch._invoke(58, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # abort an asynchronous download - def abort() - ret = @dispatch._invoke(62, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL loadXML - # load the document from a string - # BSTR arg0 --- bstrXML [IN] - def loadXML(arg0) - ret = @dispatch._invoke(63, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID save - # save the document to a specified destination - # VARIANT arg0 --- destination [IN] - def save(arg0) - ret = @dispatch._invoke(64, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT ondataavailable EVENT in XMLDOMDocumentEvents - def ondataavailable() - ret = @dispatch._invoke(198, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents - def onreadystatechange() - ret = @dispatch._invoke(-609, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# W3C-DOM XML Document (Apartment) -class Microsoft_FreeThreadedXMLDOM_1_0 # DOMFreeThreadedDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{2933BF91-7B36-11D2-B20E-00C04F983E60}" - @progid = "Microsoft.FreeThreadedXMLDOM.1.0" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # BSTR nodeName - # name of the node - def nodeName() - ret = @dispatch._getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = @dispatch._getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = @dispatch._getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = @dispatch._getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = @dispatch._getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = @dispatch._getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = @dispatch._getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = @dispatch._getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = @dispatch._getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = @dispatch._getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = @dispatch._getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = @dispatch._getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = @dispatch._getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = @dispatch._getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = @dispatch._getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = @dispatch._getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = @dispatch._getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = @dispatch._getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = @dispatch._getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = @dispatch._getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = @dispatch._getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = @dispatch._getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentType doctype - # node corresponding to the DOCTYPE - def doctype() - ret = @dispatch._getproperty(38, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMImplementation implementation - # info on this DOM implementation - def implementation() - ret = @dispatch._getproperty(39, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement documentElement - # the root of the tree - def documentElement() - ret = @dispatch._getproperty(40, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # get the state of the XML document - def readyState() - ret = @dispatch._getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMParseError parseError - # get the last parser error - def parseError() - ret = @dispatch._getproperty(59, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # get the URL for the loaded XML document - def url() - ret = @dispatch._getproperty(60, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL async - # flag for asynchronous download - def async() - ret = @dispatch._getproperty(61, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL validateOnParse - # indicates whether the parser performs validation - def validateOnParse() - ret = @dispatch._getproperty(65, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals() - ret = @dispatch._getproperty(66, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace() - ret = @dispatch._getproperty(67, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = @dispatch._setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID async - # flag for asynchronous download - def async=(arg0) - ret = @dispatch._setproperty(61, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID validateOnParse - # indicates whether the parser performs validation - def validateOnParse=(arg0) - ret = @dispatch._setproperty(65, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals=(arg0) - ret = @dispatch._setproperty(66, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace=(arg0) - ret = @dispatch._setproperty(67, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # register a readystatechange event handler - def onreadystatechange=(arg0) - ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ondataavailable - # register an ondataavailable event handler - def ondataavailable=(arg0) - ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ontransformnode - # register an ontransformnode event handler - def ontransformnode=(arg0) - ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = @dispatch._invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = @dispatch._invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = @dispatch._invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = @dispatch._invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement createElement - # create an Element node - # BSTR arg0 --- tagName [IN] - def createElement(arg0) - ret = @dispatch._invoke(41, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentFragment createDocumentFragment - # create a DocumentFragment node - def createDocumentFragment() - ret = @dispatch._invoke(42, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText createTextNode - # create a text node - # BSTR arg0 --- data [IN] - def createTextNode(arg0) - ret = @dispatch._invoke(43, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMComment createComment - # create a comment node - # BSTR arg0 --- data [IN] - def createComment(arg0) - ret = @dispatch._invoke(44, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMCDATASection createCDATASection - # create a CDATA section node - # BSTR arg0 --- data [IN] - def createCDATASection(arg0) - ret = @dispatch._invoke(45, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMProcessingInstruction createProcessingInstruction - # create a processing instruction node - # BSTR arg0 --- target [IN] - # BSTR arg1 --- data [IN] - def createProcessingInstruction(arg0, arg1) - ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute createAttribute - # create an attribute node - # BSTR arg0 --- name [IN] - def createAttribute(arg0) - ret = @dispatch._invoke(47, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMEntityReference createEntityReference - # create an entity reference node - # BSTR arg0 --- name [IN] - def createEntityReference(arg0) - ret = @dispatch._invoke(49, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = @dispatch._invoke(50, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode createNode - # create a node of the specified node type and name - # VARIANT arg0 --- type [IN] - # BSTR arg1 --- name [IN] - # BSTR arg2 --- namespaceURI [IN] - def createNode(arg0, arg1, arg2) - ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nodeFromID - # retrieve node from it's ID - # BSTR arg0 --- idString [IN] - def nodeFromID(arg0) - ret = @dispatch._invoke(56, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL load - # load document from the specified XML source - # VARIANT arg0 --- xmlSource [IN] - def load(arg0) - ret = @dispatch._invoke(58, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # abort an asynchronous download - def abort() - ret = @dispatch._invoke(62, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL loadXML - # load the document from a string - # BSTR arg0 --- bstrXML [IN] - def loadXML(arg0) - ret = @dispatch._invoke(63, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID save - # save the document to a specified destination - # VARIANT arg0 --- destination [IN] - def save(arg0) - ret = @dispatch._invoke(64, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT ondataavailable EVENT in XMLDOMDocumentEvents - def ondataavailable() - ret = @dispatch._invoke(198, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents - def onreadystatechange() - ret = @dispatch._invoke(-609, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# IXMLHttpRequest Interface -module IXMLHttpRequest - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 status - # Get HTTP status code - def status() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR statusText - # Get HTTP status text - def statusText() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DISPATCH responseXML - # Get response body - def responseXML() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR responseText - # Get response body - def responseText() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseBody - # Get response body - def responseBody() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseStream - # Get response body - def responseStream() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # Get ready state - def readyState() - ret = _getproperty(13, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # Register a complete event handler - def onreadystatechange=(arg0) - ret = _setproperty(14, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID open - # Open HTTP connection - # BSTR arg0 --- bstrMethod [IN] - # BSTR arg1 --- bstrUrl [IN] - # VARIANT arg2 --- varAsync [IN] - # VARIANT arg3 --- bstrUser [IN] - # VARIANT arg4 --- bstrPassword [IN] - def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil) - ret = _invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID setRequestHeader - # Add HTTP request header - # BSTR arg0 --- bstrHeader [IN] - # BSTR arg1 --- bstrValue [IN] - def setRequestHeader(arg0, arg1) - ret = _invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getResponseHeader - # Get HTTP response header - # BSTR arg0 --- bstrHeader [IN] - def getResponseHeader(arg0) - ret = _invoke(3, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getAllResponseHeaders - # Get all HTTP response headers - def getAllResponseHeaders() - ret = _invoke(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID send - # Send HTTP request - # VARIANT arg0 --- varBody [IN] - def send(arg0=nil) - ret = _invoke(5, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # Abort HTTP request - def abort() - ret = _invoke(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# XML HTTP Request class. -class Microsoft_XMLHTTP_1 # XMLHTTPRequest - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{ED8C108E-4349-11D2-91A4-00C04F7969E8}" - @progid = "Microsoft.XMLHTTP.1" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # I4 status - # Get HTTP status code - def status() - ret = @dispatch._getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR statusText - # Get HTTP status text - def statusText() - ret = @dispatch._getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DISPATCH responseXML - # Get response body - def responseXML() - ret = @dispatch._getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR responseText - # Get response body - def responseText() - ret = @dispatch._getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseBody - # Get response body - def responseBody() - ret = @dispatch._getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseStream - # Get response body - def responseStream() - ret = @dispatch._getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # Get ready state - def readyState() - ret = @dispatch._getproperty(13, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # Register a complete event handler - def onreadystatechange=(arg0) - ret = @dispatch._setproperty(14, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID open - # Open HTTP connection - # BSTR arg0 --- bstrMethod [IN] - # BSTR arg1 --- bstrUrl [IN] - # VARIANT arg2 --- varAsync [IN] - # VARIANT arg3 --- bstrUser [IN] - # VARIANT arg4 --- bstrPassword [IN] - def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil) - ret = @dispatch._invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID setRequestHeader - # Add HTTP request header - # BSTR arg0 --- bstrHeader [IN] - # BSTR arg1 --- bstrValue [IN] - def setRequestHeader(arg0, arg1) - ret = @dispatch._invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getResponseHeader - # Get HTTP response header - # BSTR arg0 --- bstrHeader [IN] - def getResponseHeader(arg0) - ret = @dispatch._invoke(3, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getAllResponseHeaders - # Get all HTTP response headers - def getAllResponseHeaders() - ret = @dispatch._invoke(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID send - # Send HTTP request - # VARIANT arg0 --- varBody [IN] - def send(arg0=nil) - ret = @dispatch._invoke(5, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # Abort HTTP request - def abort() - ret = @dispatch._invoke(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# XML Data Source Object -class Microsoft_XMLDSO_1_0 # XMLDSOControl - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{550DDA30-0541-11D2-9CA9-0060B0EC3D39}" - @progid = "Microsoft.XMLDSO.1.0" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # IXMLDOMDocument XMLDocument - def XMLDocument() - ret = @dispatch._getproperty(65537, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 JavaDSOCompatible - def JavaDSOCompatible() - ret = @dispatch._getproperty(65538, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - def readyState() - ret = @dispatch._getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID XMLDocument - def XMLDocument=(arg0) - ret = @dispatch._setproperty(65537, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID JavaDSOCompatible - def JavaDSOCompatible=(arg0) - ret = @dispatch._setproperty(65538, [arg0], [VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# Constants that define types for IXMLElement. -module OLEtagXMLEMEM_TYPE - include WIN32OLE::VARIANT - attr_reader :lastargs - XMLELEMTYPE_ELEMENT = 0 - XMLELEMTYPE_TEXT = 1 - XMLELEMTYPE_COMMENT = 2 - XMLELEMTYPE_DOCUMENT = 3 - XMLELEMTYPE_DTD = 4 - XMLELEMTYPE_PI = 5 - XMLELEMTYPE_OTHER = 6 -end - -# XMLDocument extends IXML Document. It is obsolete. You should use DOMDocument. This object should not be confused with the XMLDocument property on the XML data island. -class Msxml # XMLDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{CFC399AF-D876-11D0-9C10-00C04FC99C8E}" - @progid = "Msxml" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # HRESULT url - # set URL to load an XML document from the URL. - # BSTR arg0 --- p [IN] - def url=(arg0) - ret = @dispatch._setproperty(65641, [arg0], [VT_BSTR, VT_HRESULT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT charset - # get encoding. - # BSTR arg0 --- p [IN] - def charset=(arg0) - ret = @dispatch._setproperty(65645, [arg0], [VT_BSTR, VT_HRESULT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT async - # get asynchronous loading flag. - # BOOL arg0 --- pf [IN] - def async=(arg0) - ret = @dispatch._setproperty(65649, [arg0], [VT_BOOL, VT_HRESULT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT root - # get root IXMLElement of the XML document. - # IXMLElement2,IXMLElement2 arg0 --- p [OUT] - def root - OLEProperty.new(@dispatch, 65637, [VT_BYREF|VT_BYREF|VT_DISPATCH], [VT_BYREF|VT_BYREF|VT_DISPATCH, VT_HRESULT]) - end - - # HRESULT url - # set URL to load an XML document from the URL. - # BSTR arg0 --- p [OUT] - def url - OLEProperty.new(@dispatch, 65641, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT readyState - # get ready state. - # I4 arg0 --- pl [OUT] - def readyState - OLEProperty.new(@dispatch, 65643, [VT_BYREF|VT_I4], [VT_BYREF|VT_I4, VT_HRESULT]) - end - - # HRESULT charset - # get encoding. - # BSTR arg0 --- p [OUT] - def charset - OLEProperty.new(@dispatch, 65645, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT version - # get XML version number. - # BSTR arg0 --- p [OUT] - def version - OLEProperty.new(@dispatch, 65646, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT doctype - # get document type. - # BSTR arg0 --- p [OUT] - def doctype - OLEProperty.new(@dispatch, 65647, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT async - # get asynchronous loading flag. - # BOOL arg0 --- pf [OUT] - def async - OLEProperty.new(@dispatch, 65649, [VT_BYREF|VT_BOOL], [VT_BYREF|VT_BOOL, VT_HRESULT]) - end - - # HRESULT createElement - # create different types of IXMLElements. - # VARIANT arg0 --- vType [IN] - # VARIANT arg1 --- var1 [IN] - # IXMLElement2,IXMLElement2 arg2 --- ppElem [OUT] - def createElement(arg0, arg1=nil, arg2=nil) - ret = @dispatch._invoke(65644, [arg0, arg1, arg2], [VT_VARIANT, VT_VARIANT, VT_BYREF|VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end -end |
