diff options
Diffstat (limited to 'sample')
114 files changed, 960 insertions, 9576 deletions
diff --git a/sample/README b/sample/README index b55234a947..796aba1dc3 100644 --- a/sample/README +++ b/sample/README @@ -16,6 +16,7 @@ fib.pl Fibonacci number (Perl) fib.py Fibonacci number (Python) fib.rb Fibonacci number (Ruby) fib.scm Fibonacci number (Scheme) +freq.rb count word occurrence from.rb scan mail spool fullpath.rb convert ls -lR to fullpath format less.rb front end for less @@ -28,6 +29,7 @@ mpart.rb split file int multi part observ.rb observer design pattern sample occur.pl count word occurrence (Perl) occur.rb count word occurrence (Ruby) +occur2.rb count word occurrence - another style philos.rb famous dining philosophers pi.rb calculate PI rcs.awk random character stereogram (AWK) diff --git a/sample/all-ruby-quine.rb b/sample/all-ruby-quine.rb deleted file mode 100644 index 7686121468..0000000000 --- a/sample/all-ruby-quine.rb +++ /dev/null @@ -1,24 +0,0 @@ - eval($s=("t='eval($s=('+d=34.chr;s=3 - 2.chr+$s*i=8;v=$VERSION||eval('begin;v=V - ERSION;rescue;v||RUBY_VERSION;end');f=('?'*8 - +'A|'+'?'*20+'G?c'+'?'*15+'A@CXx@~@_`OpGxCxp@~pO - xS|O~G?c?q?xC`AP|q?x_|C_xC_xO@H@cG?G?qA|_|_`GCpOxC|H -NFccqq@`_|OF@`?q?x_@x_x_`GB`O``O~G?C@qCxCxP@D@|G~C?pO|C? - pO|C?AP|A~HNN`ccxC|Q@L@B"+"GpGpc@p?x_`GB`???_@FO|OB@ - xC|P`@?c?q?HPx@~@_`G@`????@L^`?q?x?xq@|_|O~GC` - xA~@_@GBD').unpack('c*');w=4+v.length*u= - 15;r=10.chr;j=0;while-24+w*u>i=1+i - ;x=i%w;x>0||t=t+d+'+'+r+d;k= - i/w%12>2&&x%u>3&&x%u+i - /w*11-34+('-._'. - index(c=v[ - x/u,1] - )||c.hex +3)*99| - |0; k=f [k/6 ][k% - 6]; t=t +s[ - k*j =k+ j,1 - ]end;pr int (t+ - d+' ).s pli - t.j oin [0, - 609 ])# Y.E. '+r) - ").split .join)# diff --git a/sample/biorhythm.rb b/sample/biorhythm.rb index f5d189014b..bd7c39f5aa 100644 --- a/sample/biorhythm.rb +++ b/sample/biorhythm.rb @@ -25,7 +25,7 @@ # Environment: basic, dos, os9 include Math -require "date" +require "date.rb" require "optparse" require "optparse/date" @@ -36,10 +36,11 @@ def print_header(y, m, d, p, w) end def get_position(z) + pi = Math::PI z = Integer(z) - phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * PI / 180.0))).to_i - emot = (50.0 * (1.0 + sin((z / 28.0 - (z / 28)) * 360.0 * PI / 180.0))).to_i - geist =(50.0 * (1.0 + sin((z / 33.0 - (z / 33)) * 360.0 * PI / 180.0))).to_i + phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i + emot = (50.0 * (1.0 + sin((z / 28.0 - (z / 28)) * 360.0 * pi / 180.0))).to_i + geist =(50.0 * (1.0 + sin((z / 33.0 - (z / 33)) * 360.0 * pi / 180.0))).to_i return phys, emot, geist end diff --git a/sample/coverage.rb b/sample/coverage.rb index 42ba89fd50..8e8d6167e2 100644 --- a/sample/coverage.rb +++ b/sample/coverage.rb @@ -49,7 +49,7 @@ at_exit do end end - File.open(cfile, "w") do |out| + open(cfile, "w") do |out| covs.zip(sources, pcovs).each_with_index do |(cov, line, pcov), idx| cov += pcov || 0 if cov cov = (cov ? (cov == 0 ? "#####" : cov.to_s) : "-").rjust(9) diff --git a/sample/dir.rb b/sample/dir.rb index 81257cd917..44733c2cf4 100644 --- a/sample/dir.rb +++ b/sample/dir.rb @@ -1,7 +1,12 @@ # directory access # list all files but .*/*~/*.o -Dir.foreach(".") do |file| - unless file.start_with?('.') or file.end_with?('~', '.o') - puts file +dirp = Dir.open(".") +for f in dirp + case f + when /\A\./, /~\z/, /\.o/ + # do not print + else + print f, "\n" end end +dirp.close diff --git a/sample/drb/README.ja.rdoc b/sample/drb/README.ja.rdoc index 1697b1b704..3ab70f3369 100644 --- a/sample/drb/README.ja.rdoc +++ b/sample/drb/README.ja.rdoc @@ -50,7 +50,7 @@ * drbssl_s.rb * drbssl_c.rb -* DRbProtocolの追加例 +* DRbProtoclの追加例 * http0.rb * http0serv.rb diff --git a/sample/drb/README.rdoc b/sample/drb/README.rdoc index e6b457bc5c..80ae910a8a 100644 --- a/sample/drb/README.rdoc +++ b/sample/drb/README.rdoc @@ -1,6 +1,6 @@ = Sample scripts -* array and iterator +* array and iteretor * darray.rb --- server * darrayc.rb --- client @@ -47,7 +47,7 @@ * drbssl_s.rb * drbssl_c.rb -* add DRbProtocol +* add DRbProtocl * http0.rb * http0serv.rb diff --git a/sample/drb/dchats.rb b/sample/drb/dchats.rb index c96486a452..58af3cf005 100644 --- a/sample/drb/dchats.rb +++ b/sample/drb/dchats.rb @@ -28,7 +28,7 @@ end class ChatServer def initialize - @mutex = Thread::Mutex.new + @mutex = Mutex.new @members = {} end diff --git a/sample/drb/http0serv.rb b/sample/drb/http0serv.rb index 2e853312e1..1a58811fed 100644 --- a/sample/drb/http0serv.rb +++ b/sample/drb/http0serv.rb @@ -1,6 +1,6 @@ require 'webrick' require 'drb/drb' -require_relative 'http0' +require 'drb/http0' module DRb module HTTP0 @@ -61,7 +61,7 @@ module DRb def accept client = @queue.pop - ServerSide.new(uri, client, @config) + ServerSide.new(client, @config) end def setup_webrick(uri) @@ -79,14 +79,12 @@ module DRb end class ServerSide - def initialize(uri, callback, config) - @uri = uri + def initialize(callback, config) @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 diff --git a/sample/drb/name.rb b/sample/drb/name.rb index 6d88186dab..a8ad28749d 100644 --- a/sample/drb/name.rb +++ b/sample/drb/name.rb @@ -39,12 +39,11 @@ require 'drb/drb' module DRbNamedObject DRbNAMEDICT = {} - DRBNAMEMUTEX = Thread::Mutex.new attr_reader(:drb_name) def drb_name=(name) @drb_name = name - DRBNAMEMUTEX.synchronize do + Thread.exclusive do raise(IndexError, name) if DRbNAMEDICT[name] DRbNAMEDICT[name] = self end diff --git a/sample/drb/old_tuplespace.rb b/sample/drb/old_tuplespace.rb index 2d5310086e..8be1542c06 100644 --- a/sample/drb/old_tuplespace.rb +++ b/sample/drb/old_tuplespace.rb @@ -31,7 +31,7 @@ class TupleSpace def initialize @que = {} @waiting = {} - @que.taint # enable tainted communication + @que.taint # enable tainted comunication @waiting.taint self.taint end diff --git a/sample/exyacc.rb b/sample/exyacc.rb index cbcc18d58b..9a9435a0dc 100644 --- a/sample/exyacc.rb +++ b/sample/exyacc.rb @@ -8,7 +8,7 @@ ARGF.each(nil) do |source| grammar = source[sbeg, send-sbeg] grammar.sub!(/.*\n/, "") grammar.gsub!(/'\{'/, "'\001'") - grammar.gsub!(/["']\}["']/, "'\002'") + grammar.gsub!(/'\}'/, "'\002'") grammar.gsub!(%r{\*/}, "\003\003") grammar.gsub!(%r{/\*[^\003]*\003\003}, '') while grammar.gsub!(/\{[^{}]*\}/, ''); end diff --git a/sample/fact.rb b/sample/fact.rb index 9f6ca72ca7..d8147a40f1 100644 --- a/sample/fact.rb +++ b/sample/fact.rb @@ -4,6 +4,6 @@ def fact(n) n.downto(1) do |i| f *= i end - f + return f end -puts fact(ARGV[0].to_i) +print fact(ARGV[0].to_i), "\n" diff --git a/sample/fib.py b/sample/fib.py index 90dc1e09ed..8318021d24 100644 --- a/sample/fib.py +++ b/sample/fib.py @@ -6,5 +6,5 @@ def fib(n): else: return fib(n-2)+fib(n-1) -print(fib(20)) +print fib(20) diff --git a/sample/freq.rb b/sample/freq.rb new file mode 100644 index 0000000000..1b2194c69a --- /dev/null +++ b/sample/freq.rb @@ -0,0 +1,12 @@ +# word occurrence listing +# usage: ruby freq.rb file.. +freq = Hash.new(0) +while line = gets() + line.scan(/\w+/) do |word| + freq[word] += 1 + end +end + +for word in freq.keys.sort! + print word, " -- ", freq[word], "\n" +end diff --git a/sample/from.rb b/sample/from.rb index 0e5a08de5f..db1299c869 100644 --- a/sample/from.rb +++ b/sample/from.rb @@ -62,7 +62,7 @@ def from_main if File.exist?(file) atime = File.atime(file) mtime = File.mtime(file) - File.open(file, "r") do |f| + open(file, "r") do |f| until f.eof? header = {} f.each_line do |line| diff --git a/sample/iseq_loader.rb b/sample/iseq_loader.rb index 8c271405d6..bb2d92ea77 100644 --- a/sample/iseq_loader.rb +++ b/sample/iseq_loader.rb @@ -41,7 +41,7 @@ class RubyVM::InstructionSequence at_exit{ STDERR.puts "[ISEQ_LOADER] #{Process.pid} time: #{Time.now - LAUNCHED_TIME}, " + "loaded: #{$ISEQ_LOADER_LOADED}, " + - "compiled: #{$ISEQ_LOADER_COMPILED}, " + + "compied: #{$ISEQ_LOADER_COMPILED}, " + "ignored: #{$ISEQ_LOADER_IGNORED}" } if COMPILE_VERBOSE @@ -141,11 +141,11 @@ class RubyVM::InstructionSequence end def read_compiled_iseq fname, iseq_key - File.open(iseq_key, 'rb'){|f| f.read} + open(iseq_key, 'rb'){|f| f.read} end def write_compiled_iseq fname, iseq_key, binary - File.open(iseq_key, 'wb'){|f| f.write(binary)} + open(iseq_key, 'wb'){|f| f.write(binary)} end end diff --git a/sample/list.rb b/sample/list.rb index 7458ba0244..b4d1d653e4 100644 --- a/sample/list.rb +++ b/sample/list.rb @@ -5,6 +5,7 @@ class MyElem # @variables are instance variable, no declaration needed @data = item @succ = nil + @head = nil end def data @@ -22,10 +23,6 @@ class MyElem end class MyList - def initialize - @head = nil - end - def add_to_list(obj) elt = MyElem.new(obj) if @head diff --git a/sample/list3.rb b/sample/list3.rb index 110e405cf9..1d9f04b710 100644 --- a/sample/list3.rb +++ b/sample/list3.rb @@ -7,7 +7,7 @@ class Point self end - def inspect + def to_s sprintf("%d@%d", @x, @y) end end diff --git a/sample/mine.rb b/sample/mine.rb index 77e0204bf6..a841d1a60a 100755 --- a/sample/mine.rb +++ b/sample/mine.rb @@ -1,8 +1,6 @@ #! /usr/bin/ruby -Ku # -*- coding: utf-8 -*- -require 'io/console' - class Board def clr print "\e[2J" @@ -145,8 +143,8 @@ class Board end bd=Board.new(10,10,10) - -IO.console.raw do +system("stty raw -echo") +begin loop do case STDIN.getc when ?n # new game @@ -172,5 +170,7 @@ IO.console.raw do bd.reset end end +ensure + system("stty -raw echo") end print "\n" diff --git a/sample/mpart.rb b/sample/mpart.rb index eeb895d3de..a88eba0ef6 100644 --- a/sample/mpart.rb +++ b/sample/mpart.rb @@ -2,29 +2,11 @@ # split into multi part # usage: mpart.rb [-nnn] file.. -class MPart < File - def self.new(basename, extname, part, parts) - super(sprintf("%s.%s%02d", basename, extname, part), "w"). - begin_mpart(basename, part, parts) - end - - def begin_mpart(basename, part, parts) - printf("%s part%02d/%02d\n", basename, part, parts) - write("BEGIN--cut here--cut here\n") - self - end - - def close - write("END--cut here--cut here\n") - super - end -end - lines = 1000 if (ARGV[0] =~ /^-(\d+)$/ ) - lines = $1.to_i - ARGV.shift + lines = $1.to_i; + ARGV.shift; end basename = ARGV[0] @@ -32,23 +14,31 @@ extname = "part" part = 1 line = 0 -ofp = nil fline = 0 -File.foreach(basename) {fline += 1} +for i in ifp = open(basename) + fline = fline + 1 +end +ifp.close parts = fline / lines + 1 -File.foreach(basename) do |i| +for i in ifp = open(basename) if line == 0 - ofp = MPart.new(basename, extname, part, parts) + ofp = open(sprintf("%s.%s%02d", basename, extname, part), "w") + printf(ofp, "%s part%02d/%02d\n", basename, part, parts) + ofp.write("BEGIN--cut here--cut here\n") end ofp.write(i) - line += 1 - if line >= lines + line = line + 1 + if line >= lines and !ifp.eof? + ofp.write("END--cut here--cut here\n") ofp.close - part += 1 + part = part + 1 line = 0 end end +ofp.write("END--cut here--cut here\n") ofp.close + +ifp.close diff --git a/sample/net-imap.rb b/sample/net-imap.rb new file mode 100644 index 0000000000..b93ecb746e --- /dev/null +++ b/sample/net-imap.rb @@ -0,0 +1,167 @@ +require 'net/imap' +require "getoptlong" + +$stdout.sync = true +$port = nil +$user = ENV["USER"] || ENV["LOGNAME"] +$auth = "login" +$ssl = false +$starttls = false + +def usage + <<EOF +usage: #{$0} [options] <host> + + --help print this message + --port=PORT specifies port + --user=USER specifies user + --auth=AUTH specifies auth type + --starttls use starttls + --ssl use ssl +EOF +end + +begin + require 'io/console' +rescue LoadError + def _noecho(&block) + system("stty", "-echo") + begin + yield STDIN + ensure + system("stty", "echo") + end + end +else + def _noecho(&block) + STDIN.noecho(&block) + end +end + +def get_password + print "password: " + begin + return _noecho(&:gets).chomp + ensure + puts + end +end + +def get_command + printf("%s@%s> ", $user, $host) + if line = gets + return line.strip.split(/\s+/) + else + return nil + end +end + +parser = GetoptLong.new +parser.set_options(['--debug', GetoptLong::NO_ARGUMENT], + ['--help', GetoptLong::NO_ARGUMENT], + ['--port', GetoptLong::REQUIRED_ARGUMENT], + ['--user', GetoptLong::REQUIRED_ARGUMENT], + ['--auth', GetoptLong::REQUIRED_ARGUMENT], + ['--starttls', GetoptLong::NO_ARGUMENT], + ['--ssl', GetoptLong::NO_ARGUMENT]) +begin + parser.each_option do |name, arg| + case name + when "--port" + $port = arg + when "--user" + $user = arg + when "--auth" + $auth = arg + when "--ssl" + $ssl = true + when "--starttls" + $starttls = true + when "--debug" + Net::IMAP.debug = true + when "--help" + usage + exit + end + end +rescue + abort usage +end + +$host = ARGV.shift +unless $host + abort usage +end + +imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl) +begin + imap.starttls if $starttls + class << password = method(:get_password) + alias to_str call + end + imap.authenticate($auth, $user, password) + while true + cmd, *args = get_command + break unless cmd + begin + case cmd + when "list" + for mbox in imap.list("", args[0] || "*") + if mbox.attr.include?(Net::IMAP::NOSELECT) + prefix = "!" + elsif mbox.attr.include?(Net::IMAP::MARKED) + prefix = "*" + else + prefix = " " + end + print prefix, mbox.name, "\n" + end + when "select" + imap.select(args[0] || "inbox") + print "ok\n" + when "close" + imap.close + print "ok\n" + when "summary" + unless messages = imap.responses["EXISTS"][-1] + puts "not selected" + next + end + if messages > 0 + for data in imap.fetch(1..-1, ["ENVELOPE"]) + print data.seqno, ": ", data.attr["ENVELOPE"].subject, "\n" + end + else + puts "no message" + end + when "fetch" + if args[0] + data = imap.fetch(args[0].to_i, ["RFC822.HEADER", "RFC822.TEXT"])[0] + puts data.attr["RFC822.HEADER"] + puts data.attr["RFC822.TEXT"] + else + puts "missing argument" + end + when "logout", "exit", "quit" + break + when "help", "?" + print <<EOF +list [pattern] list mailboxes +select [mailbox] select mailbox +close close mailbox +summary display summary +fetch [msgno] display message +logout logout +help, ? display help message +EOF + else + print "unknown command: ", cmd, "\n" + end + rescue Net::IMAP::Error + puts $! + end + end +ensure + imap.logout + imap.disconnect +end diff --git a/sample/observ.rb b/sample/observ.rb index ef4a9f60f5..a7ea45271d 100644 --- a/sample/observ.rb +++ b/sample/observ.rb @@ -27,5 +27,5 @@ class Clock end end -Clock.new(Tick.new) +clock = Clock.new(Tick.new) sleep diff --git a/sample/occur.rb b/sample/occur.rb index 5927ebc889..42151d85e8 100644 --- a/sample/occur.rb +++ b/sample/occur.rb @@ -2,7 +2,7 @@ # usage: ruby occur.rb file.. freq = Hash.new(0) while line = gets() - line.scan(/\w+/) do |word| + for word in line.split(/\W+/) freq[word] += 1 end end diff --git a/sample/occur2.rb b/sample/occur2.rb new file mode 100644 index 0000000000..ef8ad2c541 --- /dev/null +++ b/sample/occur2.rb @@ -0,0 +1,13 @@ +# word occurrence listing +# usage: ruby occur2.rb file.. +freq = {} +ARGF.each_line do |line| + for word in line.split(/\W+/) + freq[word] ||= 0 + freq[word] += 1 + end +end + +for word in freq.keys.sort + printf("%s -- %d\n", word, freq[word]) +end diff --git a/sample/openssl/c_rehash.rb b/sample/openssl/c_rehash.rb index de4b66e902..cd6c9d5fd4 100644 --- a/sample/openssl/c_rehash.rb +++ b/sample/openssl/c_rehash.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require 'openssl' +require 'digest/md5' class CHashDir include Enumerable @@ -160,7 +161,7 @@ private end def fingerprint(der) - OpenSSL::Digest.hexdigest('MD5', der).upcase + Digest::MD5.hexdigest(der).upcase end end diff --git a/sample/openssl/cert2text.rb b/sample/openssl/cert2text.rb index fe14e51d3a..50da224e76 100644 --- a/sample/openssl/cert2text.rb +++ b/sample/openssl/cert2text.rb @@ -1,13 +1,10 @@ #!/usr/bin/env ruby require 'openssl' +include OpenSSL::X509 def cert2text(cert_str) - [ - OpenSSL::X509::Certificate, - OpenSSL::X509::CRL, - OpenSSL::X509::Request, - ].each do |klass| + [Certificate, CRL, Request].each do |klass| begin puts klass.new(cert_str).to_text return diff --git a/sample/openssl/certstore.rb b/sample/openssl/certstore.rb index 72e59f6dad..c6e8f816bc 100644 --- a/sample/openssl/certstore.rb +++ b/sample/openssl/certstore.rb @@ -3,6 +3,9 @@ require 'crlstore' class CertStore + include OpenSSL + include X509 + attr_reader :self_signed_ca attr_reader :other_ca attr_reader :ee @@ -14,11 +17,11 @@ class CertStore @c_store = CHashDir.new(@certs_dir) @c_store.hash_dir(true) @crl_store = CrlStore.new(@c_store) - @x509store = OpenSSL::X509::Store.new + @x509store = Store.new @self_signed_ca = @other_ca = @ee = @crl = nil # Uncomment this line to let OpenSSL to check CRL for each certs. - # @x509store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK | OpenSSL::X509::V_FLAG_CRL_CHECK_ALL + # @x509store.flags = V_FLAG_CRL_CHECK | V_FLAG_CRL_CHECK_ALL add_path scan_certs diff --git a/sample/openssl/echo_cli.rb b/sample/openssl/echo_cli.rb index 3fbadf3361..069a21ec94 100644 --- a/sample/openssl/echo_cli.rb +++ b/sample/openssl/echo_cli.rb @@ -15,7 +15,7 @@ ca_path = options["C"] ctx = OpenSSL::SSL::SSLContext.new() if cert_file && key_file ctx.cert = OpenSSL::X509::Certificate.new(File::read(cert_file)) - ctx.key = OpenSSL::PKey.read(File::read(key_file)) + ctx.key = OpenSSL::PKey::RSA.new(File::read(key_file)) end if ca_path ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER diff --git a/sample/openssl/echo_svr.rb b/sample/openssl/echo_svr.rb index f20fb52bf5..719de6be84 100644 --- a/sample/openssl/echo_svr.rb +++ b/sample/openssl/echo_svr.rb @@ -13,9 +13,9 @@ ca_path = options["C"] if cert_file && key_file cert = OpenSSL::X509::Certificate.new(File::read(cert_file)) - key = OpenSSL::PKey.read(File::read(key_file)) + key = OpenSSL::PKey::RSA.new(File::read(key_file)) else - key = OpenSSL::PKey::RSA.new(2048){ print "." } + key = OpenSSL::PKey::RSA.new(512){ print "." } puts cert = OpenSSL::X509::Certificate.new cert.version = 2 @@ -25,7 +25,7 @@ else cert.issuer = name cert.not_before = Time.now cert.not_after = Time.now + 3600 - cert.public_key = key + cert.public_key = key.public_key ef = OpenSSL::X509::ExtensionFactory.new(nil,cert) cert.extensions = [ ef.create_extension("basicConstraints","CA:FALSE"), @@ -37,7 +37,7 @@ else ef.issuer_certificate = cert cert.add_extension ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always") - cert.sign(key, "SHA1") + cert.sign(key, OpenSSL::Digest::SHA1.new) end ctx = OpenSSL::SSL::SSLContext.new() diff --git a/sample/openssl/gen_csr.rb b/sample/openssl/gen_csr.rb index 34b23fec1c..4228707fdb 100644 --- a/sample/openssl/gen_csr.rb +++ b/sample/openssl/gen_csr.rb @@ -3,6 +3,8 @@ require 'optparse' require 'openssl' +include OpenSSL + def usage myname = File::basename($0) $stderr.puts <<EOS @@ -19,13 +21,13 @@ keyout = options["keyout"] || "keypair.pem" $stdout.sync = true name_str = ARGV.shift or usage() -name = OpenSSL::X509::Name.parse(name_str) +name = X509::Name.parse(name_str) keypair = nil if keypair_file - keypair = OpenSSL::PKey.read(File.read(keypair_file)) + keypair = PKey::RSA.new(File.open(keypair_file).read) else - keypair = OpenSSL::PKey::RSA.new(2048) { putc "." } + keypair = PKey::RSA.new(1024) { putc "." } puts puts "Writing #{keyout}..." File.open(keyout, "w", 0400) do |f| @@ -35,11 +37,11 @@ end puts "Generating CSR for #{name_str}" -req = OpenSSL::X509::Request.new +req = X509::Request.new req.version = 0 req.subject = name -req.public_key = keypair -req.sign(keypair, "MD5") +req.public_key = keypair.public_key +req.sign(keypair, Digest::MD5.new) puts "Writing #{csrout}..." File.open(csrout, "w") do |f| diff --git a/sample/openssl/smime_read.rb b/sample/openssl/smime_read.rb index b617c6e3a5..17394f9b8d 100644 --- a/sample/openssl/smime_read.rb +++ b/sample/openssl/smime_read.rb @@ -1,5 +1,6 @@ require 'optparse' require 'openssl' +include OpenSSL options = ARGV.getopts("c:k:C:") @@ -9,14 +10,14 @@ ca_path = options["C"] data = $stdin.read -cert = OpenSSL::X509::Certificate.new(File::read(cert_file)) -key = OpenSSL::PKey::read(File::read(key_file)) -p7enc = OpenSSL::PKCS7::read_smime(data) +cert = X509::Certificate.new(File::read(cert_file)) +key = PKey::RSA.new(File::read(key_file)) +p7enc = PKCS7::read_smime(data) data = p7enc.decrypt(key, cert) -store = OpenSSL::X509::Store.new +store = X509::Store.new store.add_path(ca_path) -p7sig = OpenSSL::PKCS7::read_smime(data) +p7sig = PKCS7::read_smime(data) if p7sig.verify([], store) puts p7sig.data end diff --git a/sample/openssl/smime_write.rb b/sample/openssl/smime_write.rb index e1254d8748..5a5236c750 100644 --- a/sample/openssl/smime_write.rb +++ b/sample/openssl/smime_write.rb @@ -1,5 +1,6 @@ require 'openssl' require 'optparse' +include OpenSSL options = ARGV.getopts("c:k:r:") @@ -7,16 +8,16 @@ cert_file = options["c"] key_file = options["k"] rcpt_file = options["r"] -cert = OpenSSL::X509::Certificate.new(File::read(cert_file)) -key = OpenSSL::PKey::read(File::read(key_file)) +cert = X509::Certificate.new(File::read(cert_file)) +key = PKey::RSA.new(File::read(key_file)) data = "Content-Type: text/plain\r\n" data << "\r\n" data << "This is a clear-signed message.\r\n" -p7sig = OpenSSL::PKCS7::sign(cert, key, data, [], OpenSSL::PKCS7::DETACHED) -smime0 = OpenSSL::PKCS7::write_smime(p7sig) +p7sig = PKCS7::sign(cert, key, data, [], PKCS7::DETACHED) +smime0 = PKCS7::write_smime(p7sig) -rcpt = OpenSSL::X509::Certificate.new(File::read(rcpt_file)) -p7enc = OpenSSL::PKCS7::encrypt([rcpt], smime0) -print OpenSSL::PKCS7::write_smime(p7enc) +rcpt = X509::Certificate.new(File::read(rcpt_file)) +p7enc = PKCS7::encrypt([rcpt], smime0) +print PKCS7::write_smime(p7enc) diff --git a/sample/prism/find_calls.rb b/sample/prism/find_calls.rb deleted file mode 100644 index 30af56c719..0000000000 --- a/sample/prism/find_calls.rb +++ /dev/null @@ -1,105 +0,0 @@ -# This script finds calls to a specific method with a certain keyword parameter -# within a given source file. - -require "prism" -require "pp" - -# For deprecation or refactoring purposes, it's often useful to find all of the -# places that call a specific method with a specific k eyword parameter. This is -# easily accomplished with a visitor such as this one. -class QuxParameterVisitor < Prism::Visitor - def initialize(calls) - @calls = calls - end - - def visit_call_node(node) - @calls << node if qux?(node) - super - end - - private - - def qux?(node) - # All nodes implement pattern matching, so you can use the `in` operator to - # pull out all of their individual fields. As you can see by this extensive - # pattern match, this is quite a powerful feature. - node in { - # This checks that the receiver is the constant Qux or the constant path - # ::Qux. We are assuming relative constants are fine in this case. - receiver: ( - Prism::ConstantReadNode[name: :Qux] | - Prism::ConstantPathNode[parent: nil, name: :Qux] - ), - # This checks that the name of the method is qux. We purposefully are not - # checking the call operator (., ::, or &.) because we want all of them. - # In other ASTs, this would be multiple node types, but prism combines - # them all into one for convenience. - name: :qux, - arguments: Prism::ArgumentsNode[ - # Here we're going to use the "find" pattern to find the keyword hash - # node that has the correct key. - arguments: [ - *, - Prism::KeywordHashNode[ - # Here we'll use another "find" pattern to find the key that we are - # specifically looking for. - elements: [ - *, - # Finally, we can assert against the key itself. Note that we are - # not looking at the value of hash pair, because we are only - # specifically looking for a key. - Prism::AssocNode[key: Prism::SymbolNode[unescaped: "qux"]], - * - ] - ], - * - ] - ] - } - end -end - -calls = [] -Prism.parse_stream(DATA).value.accept(QuxParameterVisitor.new(calls)) - -calls.each do |call| - print "CallNode " - puts PP.pp(call.location, +"") - print " " - puts call.slice -end - -# => -# CallNode (5,6)-(5,29) -# Qux.qux(222, qux: true) -# CallNode (9,6)-(9,30) -# Qux&.qux(333, qux: true) -# CallNode (20,6)-(20,51) -# Qux::qux(888, qux: ::Qux.qux(999, qux: true)) -# CallNode (20,25)-(20,50) -# ::Qux.qux(999, qux: true) - -__END__ -module Foo - class Bar - def baz1 - Qux.qux(111) - Qux.qux(222, qux: true) - end - - def baz2 - Qux&.qux(333, qux: true) - Qux&.qux(444) - end - - def baz3 - qux(555, qux: false) - 666.qux(666) - end - - def baz4 - Qux::qux(777) - Qux::qux(888, qux: ::Qux.qux(999, qux: true)) - end - end -end diff --git a/sample/prism/find_comments.rb b/sample/prism/find_comments.rb deleted file mode 100644 index 6a26cd32b7..0000000000 --- a/sample/prism/find_comments.rb +++ /dev/null @@ -1,100 +0,0 @@ -# This script finds all of the comments within a given source file for a method. - -require "prism" - -class FindMethodComments < Prism::Visitor - def initialize(target, comments, nesting = []) - @target = target - @comments = comments - @nesting = nesting - end - - # These visit methods are specific to each class. Defining a visitor allows - # you to group functionality that applies to all node types into a single - # class. You can find which method corresponds to which node type by looking - # at the class name, calling #type on the node, or by looking at the #accept - # method definition on the node. - def visit_module_node(node) - visitor = FindMethodComments.new(@target, @comments, [*@nesting, node.name]) - node.compact_child_nodes.each { |child| child.accept(visitor) } - end - - def visit_class_node(node) - # We could keep track of an internal state where we push the class name here - # and then pop it after the visit is complete. However, it is often simpler - # and cleaner to generate a new visitor instance when the state changes, - # because then the state is immutable and it's easier to reason about. This - # also provides for more debugging opportunity in the initializer. - visitor = FindMethodComments.new(@target, @comments, [*@nesting, node.name]) - node.compact_child_nodes.each { |child| child.accept(visitor) } - end - - def visit_def_node(node) - if [*@nesting, node.name] == @target - # Comments are always attached to locations (either inner locations on a - # node like the location of a keyword or the location on the node itself). - # Nodes are considered either "leading" or "trailing", which means that - # they occur before or after the location, respectively. In this case of - # documentation, we only want to consider leading comments. You can also - # fetch all of the comments on a location with #comments. - @comments.concat(node.location.leading_comments) - else - super - end - end -end - -# Most of the time, the concept of "finding" something in the AST can be -# accomplished either with a queue or with a visitor. In this case we will use a -# visitor, but a queue would work just as well. -def find_comments(result, path) - target = path.split(/::|#/).map(&:to_sym) - comments = [] - - result.value.accept(FindMethodComments.new(target, comments)) - comments -end - -result = Prism.parse_stream(DATA) -result.attach_comments! - -find_comments(result, "Foo#foo").each do |comment| - puts comment.inspect - puts comment.slice -end - -# => -# #<Prism::InlineComment @location=#<Prism::Location @start_offset=205 @length=27 start_line=13>> -# # This is the documentation -# #<Prism::InlineComment @location=#<Prism::Location @start_offset=235 @length=21 start_line=14>> -# # for the foo method. - -find_comments(result, "Foo::Bar#bar").each do |comment| - puts comment.inspect - puts comment.slice -end - -# => -# #<Prism::InlineComment @location=#<Prism::Location @start_offset=126 @length=23 start_line=7>> -# # This is documentation -# #<Prism::InlineComment @location=#<Prism::Location @start_offset=154 @length=21 start_line=8>> -# # for the bar method. - -__END__ -# This is the documentation -# for the Foo module. -module Foo - # This is documentation - # for the Bar class. - class Bar - # This is documentation - # for the bar method. - def bar - end - end - - # This is the documentation - # for the foo method. - def foo - end -end diff --git a/sample/prism/locate_nodes.rb b/sample/prism/locate_nodes.rb deleted file mode 100644 index 7a51db4367..0000000000 --- a/sample/prism/locate_nodes.rb +++ /dev/null @@ -1,84 +0,0 @@ -# This script locates a set of nodes determined by a line and column (in bytes). - -require "prism" -require "pp" - -# This method determines if the given location covers the given line and column. -# It's important to note that columns (and offsets) in prism are always in -# bytes. This is because prism supports all 90 source encodings that Ruby -# supports. You can always retrieve the column (or offset) of a location in -# other units with other provided APIs, like #start_character_column or -# #start_code_units_column. -def covers?(location, line:, column:) - start_line = location.start_line - end_line = location.end_line - - if start_line == end_line - # If the location only spans one line, then we only check if the line - # matches and that the column is covered by the column range. - line == start_line && (location.start_column...location.end_column).cover?(column) - else - # Otherwise, we check that it is on the start line and the column is greater - # than or equal to the start column, or that it is on the end line and the - # column is less than the end column, or that it is between the start and - # end lines. - (line == start_line && column >= location.start_column) || - (line == end_line && column < location.end_column) || - (line > start_line && line < end_line) - end -end - -# This method descends down into the AST whose root is `node` and returns the -# array of all of the nodes that cover the given line and column. -def locate(node, line:, column:) - queue = [node] - result = [] - - # We could use a recursive method here instead if we wanted, but it's - # important to note that that will not work for ASTs that are nested deeply - # enough to cause a stack overflow. - while (node = queue.shift) - result << node - - # Nodes have `child_nodes` and `compact_child_nodes`. `child_nodes` have - # consistent indices but include `nil` for optional fields that are not - # present, whereas `compact_child_nodes` has inconsistent indices but does - # not include `nil` for optional fields that are not present. - node.compact_child_nodes.find do |child| - queue << child if covers?(child.location, line: line, column: column) - end - end - - result -end - -result = Prism.parse_stream(DATA) -locate(result.value, line: 4, column: 14).each_with_index do |node, index| - print " " * index - print node.class.name.split("::", 2).last - print " " - puts PP.pp(node.location, +"") -end - -# => -# ProgramNode (1,0)-(7,3) -# StatementsNode (1,0)-(7,3) -# ModuleNode (1,0)-(7,3) -# StatementsNode (2,2)-(6,5) -# ClassNode (2,2)-(6,5) -# StatementsNode (3,4)-(5,7) -# DefNode (3,4)-(5,7) -# StatementsNode (4,6)-(4,21) -# CallNode (4,6)-(4,21) -# CallNode (4,6)-(4,15) -# ArgumentsNode (4,12)-(4,15) -# IntegerNode (4,12)-(4,15) - -__END__ -module Foo - class Bar - def baz - 111 + 222 + 333 - end - end -end diff --git a/sample/prism/make_tags.rb b/sample/prism/make_tags.rb deleted file mode 100644 index dc770ab1b0..0000000000 --- a/sample/prism/make_tags.rb +++ /dev/null @@ -1,302 +0,0 @@ -# This script generates a tags file using Prism to parse the Ruby files. - -require "prism" - -# This visitor is responsible for visiting the nodes in the AST and generating -# the appropriate tags. The tags are stored in the entries array as strings. -class TagsVisitor < Prism::Visitor - # This represents an entry in the tags file, which is a tab-separated line. It - # houses the logic for how an entry is constructed. - class Entry - attr_reader :parts - - def initialize(name, filepath, pattern, type) - @parts = [name, filepath, pattern, type] - end - - def attribute(key, value) - parts << "#{key}:#{value}" - end - - def attribute_class(nesting, names) - return if nesting.empty? && names.length == 1 - attribute("class", [*nesting, names].flatten.tap(&:pop).join(".")) - end - - def attribute_inherits(names) - attribute("inherits", names.join(".")) if names - end - - def to_line - parts.join("\t") - end - end - - private_constant :Entry - - attr_reader :entries, :filepath, :lines, :nesting, :singleton - - # Initialize the visitor with the given parameters. The first three parameters - # are constant throughout the visit, while the last two are controlled by the - # visitor as it traverses the AST. These are treated as immutable by virtue of - # the visit methods constructing new visitors when they need to change. - def initialize(entries, filepath, lines, nesting = [], singleton = false) - @entries = entries - @filepath = filepath - @lines = lines - @nesting = nesting - @singleton = singleton - end - - # Visit a method alias node and generate the appropriate tags. - # - # alias m2 m1 - # - def visit_alias_method_node(node) - enter(node.new_name.unescaped.to_sym, node, "a") do |entry| - entry.attribute_class(nesting, [nil]) - end - - super - end - - # Visit a method call to attr_reader, attr_writer, or attr_accessor without a - # receiver and generate the appropriate tags. Note that this ignores the fact - # that these methods could be overridden, which is a limitation of this - # script. - # - # attr_accessor :m1 - # - def visit_call_node(node) - if !node.receiver && %i[attr_reader attr_writer attr_accessor].include?(name = node.name) - (node.arguments&.arguments || []).grep(Prism::SymbolNode).each do |argument| - if name != :attr_writer - enter(:"#{argument.unescaped}", argument, singleton ? "F" : "f") do |entry| - entry.attribute_class(nesting, [nil]) - end - end - - if name != :attr_reader - enter(:"#{argument.unescaped}=", argument, singleton ? "F" : "f") do |entry| - entry.attribute_class(nesting, [nil]) - end - end - end - end - - super - end - - # Visit a class node and generate the appropriate tags. - # - # class C1 - # end - # - def visit_class_node(node) - if (names = names_for(node.constant_path)) - enter(names.last, node, "c") do |entry| - entry.attribute_class(nesting, names) - entry.attribute_inherits(names_for(node.superclass)) - end - - node.body&.accept(copy_visitor([*nesting, names], singleton)) - end - end - - # Visit a constant path write node and generate the appropriate tags. - # - # C1::C2 = 1 - # - def visit_constant_path_write_node(node) - if (names = names_for(node.target)) - enter(names.last, node, "C") do |entry| - entry.attribute_class(nesting, names) - end - end - - super - end - - # Visit a constant write node and generate the appropriate tags. - # - # C1 = 1 - # - def visit_constant_write_node(node) - enter(node.name, node, "C") do |entry| - entry.attribute_class(nesting, [nil]) - end - - super - end - - # Visit a method definition node and generate the appropriate tags. - # - # def m1; end - # - def visit_def_node(node) - enter(node.name, node, (node.receiver || singleton) ? "F" : "f") do |entry| - entry.attribute_class(nesting, [nil]) - end - - super - end - - # Visit a module node and generate the appropriate tags. - # - # module M1 - # end - # - def visit_module_node(node) - if (names = names_for(node.constant_path)) - enter(names.last, node, "m") do |entry| - entry.attribute_class(nesting, names) - end - - node.body&.accept(copy_visitor([*nesting, names], singleton)) - end - end - - # Visit a singleton class node and generate the appropriate tags. - # - # class << self - # end - # - def visit_singleton_class_node(node) - case node.expression - when Prism::SelfNode - node.body&.accept(copy_visitor(nesting, true)) - when Prism::ConstantReadNode, Prism::ConstantPathNode - if (names = names_for(node.expression)) - node.body&.accept(copy_visitor([*nesting, names], true)) - end - else - node.body&.accept(copy_visitor([*nesting, nil], true)) - end - end - - private - - # Generate a new visitor with the given dynamic options. The static options - # are copied over automatically. - def copy_visitor(nesting, singleton) - TagsVisitor.new(entries, filepath, lines, nesting, singleton) - end - - # Generate a new entry for the given name, node, and type and add it into the - # list of entries. The block is used to add additional attributes to the - # entry. - def enter(name, node, type) - line = lines[node.location.start_line - 1].chomp - pattern = "/^#{line.gsub("\\", "\\\\\\\\").gsub("/", "\\/")}$/;\"" - - entry = Entry.new(name, filepath, pattern, type) - yield entry - - entries << entry.to_line - end - - # Retrieve the names for the given node. This is used to construct the class - # attribute for the tags. - def names_for(node) - case node - when Prism::ConstantPathNode - names = names_for(node.parent) - return unless names - - names << node.name - when Prism::ConstantReadNode - [node.name] - when Prism::SelfNode - [:self] - else - # dynamic - end - end -end - -# Parse the Ruby file and visit all of the nodes in the resulting AST. Once all -# of the nodes have been visited, the entries array should be populated with the -# tags. -result = Prism.parse_stream(DATA) -result.value.accept(TagsVisitor.new(entries = [], __FILE__, result.source.lines)) - -# Print the tags to STDOUT. -puts "!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;\" to lines/" -puts "!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/" -puts entries.sort - -# => -# !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -# !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -# C1 sample/prism/make_tags.rb /^ class C1$/;" c class:M1.M2 -# C2 sample/prism/make_tags.rb /^ class C2 < Object$/;" c class:M1.M2.C1 inherits:Object -# C6 sample/prism/make_tags.rb /^ C6 = 1$/;" C class:M1 -# C7 sample/prism/make_tags.rb /^ C7 = 2$/;" C class:M1 -# C9 sample/prism/make_tags.rb /^ C8::C9 = 3$/;" C class:M1.C8 -# M1 sample/prism/make_tags.rb /^module M1$/;" m -# M2 sample/prism/make_tags.rb /^ module M2$/;" m class:M1 -# M4 sample/prism/make_tags.rb /^ module M3::M4$/;" m class:M1.M3 -# M5 sample/prism/make_tags.rb /^ module self::M5$/;" m class:M1.self -# m1 sample/prism/make_tags.rb /^ def m1; end$/;" f class:M1.M2.C1.C2 -# m10 sample/prism/make_tags.rb /^ attr_accessor :m10, :m11$/;" f class:M1.M3.M4 -# m10= sample/prism/make_tags.rb /^ attr_accessor :m10, :m11$/;" f class:M1.M3.M4 -# m11 sample/prism/make_tags.rb /^ attr_accessor :m10, :m11$/;" f class:M1.M3.M4 -# m11= sample/prism/make_tags.rb /^ attr_accessor :m10, :m11$/;" f class:M1.M3.M4 -# m12 sample/prism/make_tags.rb /^ attr_reader :m12, :m13, :m14$/;" f class:M1.M3.M4 -# m13 sample/prism/make_tags.rb /^ attr_reader :m12, :m13, :m14$/;" f class:M1.M3.M4 -# m14 sample/prism/make_tags.rb /^ attr_reader :m12, :m13, :m14$/;" f class:M1.M3.M4 -# m15= sample/prism/make_tags.rb /^ attr_writer :m15$/;" f class:M1.M3.M4 -# m2 sample/prism/make_tags.rb /^ def m2; end$/;" f class:M1.M2.C1.C2 -# m3 sample/prism/make_tags.rb /^ alias m3 m1$/;" a class:M1.M2.C1.C2 -# m4 sample/prism/make_tags.rb /^ alias :m4 :m2$/;" a class:M1.M2.C1.C2 -# m5 sample/prism/make_tags.rb /^ def self.m5; end$/;" F class:M1.M2.C1.C2 -# m6 sample/prism/make_tags.rb /^ def m6; end$/;" F class:M1.M2.C1.C2 -# m7 sample/prism/make_tags.rb /^ def m7; end$/;" F class:M1.M2.C1.C2.C3 -# m8 sample/prism/make_tags.rb /^ def m8; end$/;" F class:M1.M2.C1.C2.C4.C5 -# m9 sample/prism/make_tags.rb /^ def m9; end$/;" F class:M1.M2.C1.C2. - -__END__ -module M1 - module M2 - class C1 - class C2 < Object - def m1; end - def m2; end - - alias m3 m1 - alias :m4 :m2 - - def self.m5; end - - class << self - def m6; end - end - - class << C3 - def m7; end - end - - class << C4::C5 - def m8; end - end - - class << c - def m9; end - end - end - end - end - - module M3::M4 - attr_accessor :m10, :m11 - attr_reader :m12, :m13, :m14 - attr_writer :m15 - end - - module self::M5 - end - - C6 = 1 - C7 = 2 - C8::C9 = 3 -end diff --git a/sample/prism/multiplex_constants.rb b/sample/prism/multiplex_constants.rb deleted file mode 100644 index e39f2c36f6..0000000000 --- a/sample/prism/multiplex_constants.rb +++ /dev/null @@ -1,138 +0,0 @@ -# This script indexes the classes and modules within a set of files using the -# saved source functionality. - -require "prism" -require "etc" -require "tempfile" - -module Indexer - # A class that implements the #enter functionality so that it can be passed to - # the various save* APIs. This effectively bundles up all of the node_id and - # field_name pairs so that they can be written back to the parent process. - class Repository - attr_reader :scope, :entries - - def initialize - @scope = [] - @entries = [] - end - - def with(next_scope) - previous_scope = scope - @scope = scope + next_scope - yield - @scope = previous_scope - end - - def empty? - entries.empty? - end - - def enter(node_id, field_name) - entries << [scope.join("::"), node_id, field_name] - end - end - - # Visit the classes and modules in the AST and save their locations into the - # repository. - class Visitor < Prism::Visitor - attr_reader :repository - - def initialize(repository) - @repository = repository - end - - def visit_class_node(node) - repository.with(node.constant_path.full_name_parts) do - node.constant_path.save_location(repository) - visit(node.body) - end - end - - def visit_module_node(node) - repository.with(node.constant_path.full_name_parts) do - node.constant_path.save_location(repository) - visit(node.body) - end - end - end - - # Index the classes and modules within a file. If there are any entries, - # return them as a serialized string to the parent process. - def self.index(filepath) - repository = Repository.new - Prism.parse_file(filepath).value.accept(Visitor.new(repository)) - "#{filepath}|#{repository.entries.join("|")}" unless repository.empty? - end -end - -def index_glob(glob, count = Etc.nprocessors - 1) - process_ids = [] - filepath_writers = [] - index_reader, index_writer = IO.pipe - - # For each number in count, fork off a worker that has access to two pipes. - # The first pipe is the index_writer, to which it writes all of the results of - # indexing the various files. The second pipe is the filepath_reader, from - # which it reads the filepaths that it needs to index. - count.times do - filepath_reader, filepath_writer = IO.pipe - - process_ids << fork do - filepath_writer.close - index_reader.close - - while (filepath = filepath_reader.gets(chomp: true)) - results = Indexer.index(filepath) - index_writer.puts(results) if results - end - end - - filepath_reader.close - filepath_writers << filepath_writer - end - - index_writer.close - - # In a separate thread, write all of the filepaths to the various worker - # processes. This is done in a separate threads since puts will eventually - # block when each of the pipe buffers fills up. We write in a round-robin - # fashion to the various workers. This could be improved using a work-stealing - # algorithm, but is fine if you don't end up having a ton of variety in the - # size of your files. - writer_thread = - Thread.new do - Dir[glob].each_with_index do |filepath, index| - filepath_writers[index % count].puts(filepath) - end - end - - index = Hash.new { |hash, key| hash[key] = [] } - - # In a separate thread, read all of the results from the various worker - # processes and store them in the index. This is done in a separate thread so - # that reads and writes can be interleaved. This is important so that the - # index pipe doesn't fill up and block the writer. - reader_thread = - Thread.new do - while (line = index_reader.gets(chomp: true)) - filepath, *entries = line.split("|") - repository = Prism::Relocation.filepath(filepath).filepath.lines.code_unit_columns(Encoding::UTF_16LE).leading_comments - - entries.each_slice(3) do |(name, node_id, field_name)| - index[name] << repository.enter(Integer(node_id), field_name.to_sym) - end - end - end - - writer_thread.join - filepath_writers.each(&:close) - - reader_thread.join - index_reader.close - - process_ids.each { |process_id| Process.wait(process_id) } - index -end - -index_glob(File.expand_path("../../lib/**/*.rb", __dir__)) diff --git a/sample/prism/relocate_constants.rb b/sample/prism/relocate_constants.rb deleted file mode 100644 index faa48f6388..0000000000 --- a/sample/prism/relocate_constants.rb +++ /dev/null @@ -1,43 +0,0 @@ -# This script finds the declaration of all classes and modules and stores them -# in a hash for an in-memory database of constants. - -require "prism" - -class RelocationVisitor < Prism::Visitor - attr_reader :index, :repository, :scope - - def initialize(index, repository, scope = []) - @index = index - @repository = repository - @scope = scope - end - - def visit_class_node(node) - next_scope = scope + node.constant_path.full_name_parts - index[next_scope.join("::")] << node.constant_path.save(repository) - node.body&.accept(RelocationVisitor.new(index, repository, next_scope)) - end - - def visit_module_node(node) - next_scope = scope + node.constant_path.full_name_parts - index[next_scope.join("::")] << node.constant_path.save(repository) - node.body&.accept(RelocationVisitor.new(index, repository, next_scope)) - end -end - -# Create an index that will store a mapping between the names of constants to a -# list of the locations where they are declared or re-opened. -index = Hash.new { |hash, key| hash[key] = [] } - -# Loop through every file in the lib directory of this repository and parse them -# with Prism. Then visit them using the RelocateVisitor to store their -# repository entries in the index. -Dir[File.expand_path("../../lib/**/*.rb", __dir__)].each do |filepath| - repository = Prism::Relocation.filepath(filepath).filepath.lines.code_unit_columns(Encoding::UTF_16LE) - Prism.parse_file(filepath).value.accept(RelocationVisitor.new(index, repository)) -end - -puts index["Prism::ParametersNode"].map { |entry| "#{entry.filepath}:#{entry.start_line}:#{entry.start_code_units_column}" } -# => -# prism/lib/prism/node.rb:13889:8 -# prism/lib/prism/node_ext.rb:267:8 diff --git a/sample/prism/visit_nodes.rb b/sample/prism/visit_nodes.rb deleted file mode 100644 index 5ba703b0a3..0000000000 --- a/sample/prism/visit_nodes.rb +++ /dev/null @@ -1,63 +0,0 @@ -# This script visits all of the nodes of a specific type within a given source -# file. It uses the visitor class to traverse the AST. - -require "prism" -require "pp" - -class CaseInsensitiveRegularExpressionVisitor < Prism::Visitor - def initialize(regexps) - @regexps = regexps - end - - # As the visitor is walking the tree, this method will only be called when it - # encounters a regular expression node. We can then call any regular - # expression -specific APIs. In this case, we are only interested in the - # regular expressions that are case-insensitive, which we can retrieve with - # the #ignore_case? method. - def visit_regular_expression_node(node) - @regexps << node if node.ignore_case? - super - end - - def visit_interpolated_regular_expression_node(node) - @regexps << node if node.ignore_case? - - # The default behavior of the visitor is to continue visiting the children - # of the node. Because Ruby is so dynamic, it's actually possible for - # another regular expression to be interpolated in statements contained - # within the #{} contained in this interpolated regular expression node. By - # calling `super`, we ensure the visitor will continue. Failing to call - # `super` will cause the visitor to stop the traversal of the tree, which - # can also be useful in some cases. - super - end -end - -result = Prism.parse_stream(DATA) -regexps = [] - -result.value.accept(CaseInsensitiveRegularExpressionVisitor.new(regexps)) -regexps.each do |node| - print node.class.name.split("::", 2).last - print " " - puts PP.pp(node.location, +"") - - if node.is_a?(Prism::RegularExpressionNode) - print " " - p node.unescaped - end -end - -# => -# InterpolatedRegularExpressionNode (3,9)-(3,47) -# RegularExpressionNode (3,16)-(3,22) -# "bar" -# RegularExpressionNode (4,9)-(4,15) -# "bar" - -__END__ -class Foo - REG1 = /foo/ - REG2 = /foo #{/bar/i =~ "" ? "bar" : "baz"}/i - REG3 = /bar/i -end diff --git a/sample/ripper/ruby2html.rb b/sample/ripper/ruby2html.rb index 1e6b3bf550..8f64f5a713 100644 --- a/sample/ripper/ruby2html.rb +++ b/sample/ripper/ruby2html.rb @@ -73,11 +73,7 @@ class ERB end def ruby2html(f, encoding, css, print_line_number) - if RUBY_VERSION >= '2.6' - erb = ERB.new(TEMPLATE, trim_mode: '>') - else - erb = ERB.new(TEMPLATE, nil, '>') - end + erb = ERB.new(TEMPLATE, nil, '>') erb.filename = __FILE__ erb.lineno = TEMPLATE_LINE erb.result(binding()) diff --git a/sample/rss/blend.rb b/sample/rss/blend.rb new file mode 100755 index 0000000000..351f6f373f --- /dev/null +++ b/sample/rss/blend.rb @@ -0,0 +1,79 @@ +#!/usr/bin/env ruby + +require "rss" + +feeds = [] +verbose = false +encoding = "UTF-8" + +def error(exception) + mark = "=" * 20 + mark = "#{mark} error #{mark}" + STDERR.puts mark + STDERR.puts exception.class + STDERR.puts exception.message + STDERR.puts exception.backtrace + STDERR.puts mark +end + +before_time = Time.now +ARGV.each do |fname| + if fname == '-v' + verbose = true + next + end + rss = nil + f = File.new(fname).read + begin + ## do validate parse + rss = RSS::Parser.parse(f) + rescue RSS::InvalidRSSError + error($!) if verbose + ## do non validate parse for invalid RSS 1.0 + begin + rss = RSS::Parser.parse(f, false) + rescue RSS::Error + ## invalid RSS. + error($!) if verbose + end + rescue RSS::Error + error($!) if verbose + end + if rss.nil? + STDERR.puts "#{fname} does not include RSS 1.0 or 0.9x/2.0" + else + begin + rss.output_encoding = encoding + rescue RSS::UnknownConversionMethodError + error($!) if verbose + end + feeds << rss + end +end +processing_time = Time.now - before_time + +rss = RSS::Maker.make("1.0") do |maker| + maker.encoding = encoding + maker.channel.about = "http://example.com/blend.rdf" + maker.channel.title = "blended feeds" + maker.channel.link = "http://example.com/" + maker.channel.description = "blended feeds generated by RSS Parser" + + feeds.each do |feed| + feed.items.each do |item| + item.setup_maker(maker.items) + end + end + + maker.items.each do |item| + item.title ||= "UNKNOWN" + item.link ||= "UNKNOWN" + end + + maker.items.do_sort = true + maker.items.max_size = 15 +end +puts rss + +STDERR.puts "Used XML parser: #{RSS::Parser.default_parser}" +STDERR.puts "Processing time: #{processing_time}s" diff --git a/sample/rss/convert.rb b/sample/rss/convert.rb new file mode 100755 index 0000000000..e6bff4c623 --- /dev/null +++ b/sample/rss/convert.rb @@ -0,0 +1,69 @@ +#!/usr/bin/env ruby + +require "rss" + +feeds = [] +verbose = false +encoding = "UTF-8" +to_version = "1.0" + +def error(exception) + mark = "=" * 20 + mark = "#{mark} error #{mark}" + STDERR.puts mark + STDERR.puts exception.class + STDERR.puts exception.message + STDERR.puts exception.backtrace + STDERR.puts mark +end + +before_time = Time.now +ARGV.each do |fname| + case fname + when '-v' + verbose = true + next + when /^-t(0\.91|1\.0|2\.0|atom)$/ + to_version = $1 + next + end + rss = nil + f = File.read(fname) + begin + ## do validate parse + rss = RSS::Parser.parse(f) + rescue RSS::InvalidRSSError + error($!) if verbose + ## do non validate parse for invalid RSS 1.0 + begin + rss = RSS::Parser.parse(f, false) + rescue RSS::Error + ## invalid RSS. + error($!) if verbose + end + rescue RSS::Error + error($!) if verbose + end + if rss.nil? + STDERR.puts "#{fname} does not include RSS 1.0 or 0.9x/2.0" + else + begin + rss.output_encoding = encoding + rescue RSS::UnknownConversionMethodError + error($!) if verbose + end + feeds << [fname, rss] + end +end +processing_time = Time.now - before_time + +feeds.each do |fname, rss| + converted_rss = rss.to_xml(to_version) + output_name = fname.sub(/(\.[^\.]+)$/, "-#{to_version}\\1") + File.open(output_name, "w") do |output| + output.print(converted_rss) + end +end + +STDERR.puts "Used XML parser: #{RSS::Parser.default_parser}" +STDERR.puts "Processing time: #{processing_time}s" diff --git a/sample/rss/list_description.rb b/sample/rss/list_description.rb new file mode 100755 index 0000000000..990974d8f5 --- /dev/null +++ b/sample/rss/list_description.rb @@ -0,0 +1,91 @@ +#!/usr/bin/env ruby + +require "nkf" +class String + # From tdiary.rb + def shorten( len = 120 ) + lines = NKF::nkf( "-t -m0 -f#{len}", self.gsub( /\n/, ' ' ) ).split( /\n/ ) + lines[0].concat( '...' ) if lines[0] and lines[1] + lines[0] + end +end + +require "rss" + +channels = {} +verbose = false + +def error(exception) + mark = "=" * 20 + mark = "#{mark} error #{mark}" + puts mark + puts exception.class + puts exception.message + puts exception.backtrace + puts mark +end + +before_time = Time.now +ARGV.each do |fname| + if fname == '-v' + verbose = true + next + end + rss = nil + f = File.new(fname).read + begin + ## do validate parse + rss = RSS::Parser.parse(f) + rescue RSS::InvalidRSSError + error($!) if verbose + ## do non validate parse for invalid RSS 1.0 + begin + rss = RSS::Parser.parse(f, false) + rescue RSS::Error + ## invalid RSS. + error($!) if verbose + end + rescue RSS::Error + error($!) if verbose + end + if rss.nil? + puts "#{fname} does not include RSS 1.0 or 0.9x/2.0" + else + begin + rss.output_encoding = "utf-8" + rescue RSS::UnknownConversionMethodError + error($!) if verbose + end + + rss = rss.to_rss("1.0") do |maker| + maker.channel.about ||= maker.channel.link + maker.channel.description ||= "No description" + maker.items.each do |item| + item.title ||= "No title" + item.link ||= "UNKNOWN" + end + end + next if rss.nil? + + rss.items.each do |item| + channels[rss.channel.title] ||= [] + channels[rss.channel.title] << item if item.description + end + end +end +processing_time = Time.now - before_time + +channels.sort do |x, y| + x[0] <=> y[0] +end[0..20].each do |title, items| + puts "Channel: #{title}" unless items.empty? + items.sort do |x, y| + x.title <=> y.title + end[0..10].each do |item| + puts " Item: #{item.title.shorten(50)}" + puts " Description: #{item.description.shorten(50)}" + end +end + +puts "Used XML parser: #{RSS::Parser.default_parser}" +puts "Processing time: #{processing_time}s" diff --git a/sample/rss/re_read.rb b/sample/rss/re_read.rb new file mode 100755 index 0000000000..c386ab20f6 --- /dev/null +++ b/sample/rss/re_read.rb @@ -0,0 +1,64 @@ +#!/usr/bin/env ruby + +require "rss" + +def error(exception) + mark = "=" * 20 + mark = "#{mark} error #{mark}" + puts mark + puts exception.class + puts exception.message + puts exception.backtrace + puts mark +end + +verbose = false +before_time = Time.now + +ARGV.each do |fname| + if fname == '-v' + verbose = true + next + end + source = nil + File.open(fname) do |f| + source = f.read + end + + rss = nil + read = false + begin + rss = RSS::Parser.parse(source) + puts "Re-read valid feed: #{fname}" + RSS::Parser.parse(rss.to_s) + read = true + rescue RSS::InvalidRSSError + error($!) if verbose + ## do non validate parse for invalid feed + begin + rss = RSS::Parser.parse(source, false) + rescue RSS::Error + ## invalid feed + error($!) if verbose + end + rescue RSS::Error + error($!) if verbose + end + + if rss.nil? + puts "Invalid feed: #{fname}" + elsif !read + puts "Re-read invalid feed: #{fname}" + begin + RSS::Parser.parse(rss.to_s) + rescue RSS::Error + puts " Error occurred: #{fname}" + error($!) if verbose + end + end +end + +processing_time = Time.now - before_time + +puts "Used XML parser: #{RSS::Parser.default_parser}" +puts "Processing time: #{processing_time}s" diff --git a/sample/rss/rss_recent.rb b/sample/rss/rss_recent.rb new file mode 100755 index 0000000000..14c861284e --- /dev/null +++ b/sample/rss/rss_recent.rb @@ -0,0 +1,85 @@ +#!/usr/bin/env ruby + +require "nkf" +class String + # From tdiary.rb + def shorten( len = 120 ) + lines = NKF::nkf( "-t -m0 -f#{len}", self.gsub( /\n/, ' ' ) ).split( /\n/ ) + lines[0].concat( '...' ) if lines[0] and lines[1] + lines[0] + end +end + +require "rss" + +items = [] +verbose = false + +def error(exception) + mark = "=" * 20 + mark = "#{mark} error #{mark}" + puts mark + puts exception.class + puts exception.message + puts exception.backtrace + puts mark +end +before_time = Time.now +ARGV.each do |fname| + if fname == '-v' + verbose = true + next + end + rss = nil + f = File.new(fname).read + begin + ## do validate parse + rss = RSS::Parser.parse(f) + rescue RSS::InvalidRSSError + error($!) if verbose + ## do non validate parse for invalid RSS 1.0 + begin + rss = RSS::Parser.parse(f, false) + rescue RSS::Error + ## invalid RSS. + error($!) if verbose + end + rescue RSS::Error + error($!) if verbose + end + if rss.nil? + puts "#{fname} does not include RSS 1.0 or 0.9x/2.0" + else + begin + rss.output_encoding = "utf-8" + rescue RSS::UnknownConversionMethodError + error($!) if verbose + end + + rss = rss.to_rss("1.0") do |maker| + maker.channel.about ||= maker.channel.link + maker.channel.description ||= "No description" + maker.items.each do |item| + item.title ||= "UNKNOWN" + item.link ||= "UNKNOWN" + end + end + next if rss.nil? + + rss.items.each do |item| + items << [rss.channel, item] if item.dc_date + end + end +end +processing_time = Time.now - before_time + +items.sort do |x, y| + y[1].dc_date <=> x[1].dc_date +end[0..20].each do |channel, item| + puts "#{item.dc_date.localtime.iso8601}: " << + "#{channel.title}: #{item.title}" + puts " Description: #{item.description.shorten(50)}" if item.description +end + +puts "Used XML parser: #{RSS::Parser.default_parser}" +puts "Processing time: #{processing_time}s" diff --git a/sample/test.rb b/sample/test.rb index 65dd9abd10..65dd9abd10 100644..100755 --- a/sample/test.rb +++ b/sample/test.rb diff --git a/sample/testunit/adder.rb b/sample/testunit/adder.rb new file mode 100644 index 0000000000..aa5c88cc7b --- /dev/null +++ b/sample/testunit/adder.rb @@ -0,0 +1,13 @@ +# Author:: Nathaniel Talbott. +# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. +# License:: Ruby license. + +class Adder + def initialize(number) + @number = number + end + def add(number) + return @number + number + end +end + diff --git a/sample/testunit/subtracter.rb b/sample/testunit/subtracter.rb new file mode 100644 index 0000000000..2c08247805 --- /dev/null +++ b/sample/testunit/subtracter.rb @@ -0,0 +1,12 @@ +# Author:: Nathaniel Talbott. +# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. +# License:: Ruby license. + +class Subtracter + def initialize(number) + @number = number + end + def subtract(number) + return @number - number + end +end diff --git a/sample/testunit/tc_adder.rb b/sample/testunit/tc_adder.rb new file mode 100644 index 0000000000..8453beb20a --- /dev/null +++ b/sample/testunit/tc_adder.rb @@ -0,0 +1,18 @@ +# Author:: Nathaniel Talbott. +# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. +# License:: Ruby license. + +require 'test/unit' +require 'adder' + +class TC_Adder < Test::Unit::TestCase + def setup + @adder = Adder.new(5) + end + def test_add + assert_equal(7, @adder.add(2), "Should have added correctly") + end + def teardown + @adder = nil + end +end diff --git a/sample/testunit/tc_subtracter.rb b/sample/testunit/tc_subtracter.rb new file mode 100644 index 0000000000..d2c8313350 --- /dev/null +++ b/sample/testunit/tc_subtracter.rb @@ -0,0 +1,18 @@ +# Author:: Nathaniel Talbott. +# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. +# License:: Ruby license. + +require 'test/unit' +require 'subtracter' + +class TC_Subtracter < Test::Unit::TestCase + def setup + @subtracter = Subtracter.new(5) + end + def test_subtract + assert_equal(3, @subtracter.subtract(2), "Should have subtracted correctly") + end + def teardown + @subtracter = nil + end +end diff --git a/sample/testunit/ts_examples.rb b/sample/testunit/ts_examples.rb new file mode 100644 index 0000000000..3d24dd6522 --- /dev/null +++ b/sample/testunit/ts_examples.rb @@ -0,0 +1,7 @@ +# Author:: Nathaniel Talbott. +# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. +# License:: Ruby license. + +require 'test/unit' +require 'tc_adder' +require 'tc_subtracter' diff --git a/sample/timeout.rb b/sample/timeout.rb index ad4459aff0..8d25d72a76 100644 --- a/sample/timeout.rb +++ b/sample/timeout.rb @@ -1,31 +1,31 @@ require 'timeout' def progress(n = 5) - n.times {|i| print i; STDOUT.flush; sleep 1} + n.times {|i| print i; STDOUT.flush; sleep 1; i+= 1} puts "never reach" end -p Timeout.timeout(5) { +p timeout(5) { 45 } -p Timeout.timeout(5, Timeout::Error) { +p timeout(5, Timeout::Error) { 45 } -p Timeout.timeout(nil) { +p timeout(nil) { 54 } -p Timeout.timeout(0) { +p timeout(0) { 54 } begin - Timeout.timeout(5) {progress} + timeout(5) {progress} rescue => e puts e.message end begin - Timeout.timeout(3) { + timeout(3) { begin - Timeout.timeout(5) {progress} + timeout(5) {progress} rescue => e puts "never reach" end @@ -36,7 +36,7 @@ end class MyTimeout < StandardError end begin - Timeout.timeout(2, MyTimeout) {progress} + timeout(2, MyTimeout) {progress} rescue MyTimeout => e puts e.message end diff --git a/sample/trick2013/kinaba/remarks.markdown b/sample/trick2013/kinaba/remarks.markdown index dcdce7e9ae..a454a5f0a1 100644 --- a/sample/trick2013/kinaba/remarks.markdown +++ b/sample/trick2013/kinaba/remarks.markdown @@ -16,11 +16,11 @@ The program contains each ASCII character from 0x20 ' ' to 0x7e '~' exactly once ### Internals -The algorithm is the obvious loop "32.upto(126){|x| putc x}". +The algorthim is the obvious loop "32.upto(126){|x| putc x}". It is not so hard to transform it to use each character *at most once*. The only slight difficulty comes from the constraint that we cannot "declare and then use" variables, because then the code will contain the variable name twice. This restriction is worked around by the $. global variable, the best friend of Ruby golfers. -The relatively interesting part is to use all the characters *at least once*. Of course, this is easily accomplished by putting everything into a comment (i.e., #unused...) or to a string literal (%(unused...), note that normal string literals are forbidden since they use quotation marks twice). Hey, but that's not fun at all! I tried to minimize the escapeway. +The relatively interesting part is to use all the charcters *at least once*. Of course, this is easily accomplished by putting everything into a comment (i.e., #unused...) or to a string literal (%(unused...), note that normal string literals are forbidden since they use quotation marks twice). Hey, but that's not fun at all! I tried to minimize the escapeway. * "@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz". Trash box of unused alphabet. I wish I could have used "gkyz" somewhere else. diff --git a/sample/trick2013/mame/music-box.mp4 b/sample/trick2013/mame/music-box.mp4 Binary files differnew file mode 100644 index 0000000000..6d1e87c01c --- /dev/null +++ b/sample/trick2013/mame/music-box.mp4 diff --git a/sample/trick2013/mame/remarks.markdown b/sample/trick2013/mame/remarks.markdown index 488681d88d..8c1988c809 100644 --- a/sample/trick2013/mame/remarks.markdown +++ b/sample/trick2013/mame/remarks.markdown @@ -27,7 +27,7 @@ In the piano roll, `#` represents a pin that hits a note, and `|` represents a s The leftmost column corresponds 110Hz (low A). Every column corresponds a semitone higher than the left one. -This program uses [the frequency modulation synthesis](https://en.wikipedia.org/wiki/Frequency_modulation_synthesis) to play the sound like a music-box. +This program uses [the frequency modulation synthesis](http://en.wikipedia.org/wiki/Frequency_modulation_synthesis) to play the sound like a music-box. You can create a different-sounding tone by changing the parameter. For example, the following will play the sound like a harpsichord. @@ -44,4 +44,4 @@ You have to use sox by replacing the following part: with: - IO.popen("./pl","wb") + IO.popen("./pl","wb")
\ No newline at end of file diff --git a/sample/trick2013/yhara/entry.rb b/sample/trick2013/yhara/entry.rb index 3666f271fa..ce125ed3df 100644 --- a/sample/trick2013/yhara/entry.rb +++ b/sample/trick2013/yhara/entry.rb @@ -2,7 +2,7 @@ def _(&b)$><<->(x){x ? (String===x ?x.upcase: (Class===x ? x : x.class).name[$a?0:($a=5)]): " "}[ begin b[];rescue Exception;$!;end ] end -_ { 1.tap } +_ { yield } _ { method(:p).unbind } _ { eval "{ " } _ { Thread.current.join } diff --git a/sample/trick2015/kinaba/entry.rb b/sample/trick2015/kinaba/entry.rb index 2a75888ef5..18923a6a9f 100644 --- a/sample/trick2015/kinaba/entry.rb +++ b/sample/trick2015/kinaba/entry.rb @@ -54,15 +54,15 @@ while 0x00012345 >= $counter srand +big && $counter >> 0b1 Enumerable - String - Struct + Fixnum + Bignum Math Complex Comparable TrueClass Dir Encoding - Proc + Data Hash Method Enumerator diff --git a/sample/trick2015/ksk_1/remarks.markdown b/sample/trick2015/ksk_1/remarks.markdown index a0b8bbcdcc..b822dc55c8 100644 --- a/sample/trick2015/ksk_1/remarks.markdown +++ b/sample/trick2015/ksk_1/remarks.markdown @@ -110,7 +110,7 @@ is simply `/=/` and removing a padding `",,,,,"`. The program no longer terminates, though. -### Limitation +### Limination The implementation requires to manipulate long strings even for some small starting numbers. For example, starting from 1,819, the number diff --git a/sample/trick2015/ksk_2/remarks.markdown b/sample/trick2015/ksk_2/remarks.markdown index 187a6804d2..bb9b705773 100644 --- a/sample/trick2015/ksk_2/remarks.markdown +++ b/sample/trick2015/ksk_2/remarks.markdown @@ -199,6 +199,6 @@ succeed to return 0. The meaning of ``\1nn`` in regular expression seems to depend on the existence of capturing expressions. In spite of these Ruby's behaviors, we have a good news! The present -SAT solver does not suffer from the issues because the program cannot +SAT sover does not suffer from the issues because the program cannot return solutions in practical time for inputs with variables more than -40. +40.
\ No newline at end of file diff --git a/sample/trick2018/01-kinaba/authors.markdown b/sample/trick2018/01-kinaba/authors.markdown deleted file mode 100644 index d0df0b379d..0000000000 --- a/sample/trick2018/01-kinaba/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* kinaba - * twitter.com/kinaba - * cctld: jp diff --git a/sample/trick2018/01-kinaba/entry.rb b/sample/trick2018/01-kinaba/entry.rb deleted file mode 100644 index eb8284d5ab..0000000000 --- a/sample/trick2018/01-kinaba/entry.rb +++ /dev/null @@ -1,8 +0,0 @@ -alias BEGIN for unless def class -super true or return defined? next -break while begin undef do end -rescue then retry else undef module -nil ensure case if yield __LINE__ -self and redo elsif not __FILE__ -alias END in end when __ENCODING__ -end until false end diff --git a/sample/trick2018/01-kinaba/remarks.markdown b/sample/trick2018/01-kinaba/remarks.markdown deleted file mode 100644 index d0b9fdffde..0000000000 --- a/sample/trick2018/01-kinaba/remarks.markdown +++ /dev/null @@ -1,55 +0,0 @@ -### Remarks - -Just run it with no argument: - - ruby entry.rb - -(Anyway it is just a no-op program. The above command only verifies -that entry.rb is a valid Ruby program.) - -I confirmed the following implementations/platforms: - -* ruby 2.5.0p0 (2017-12-25 revision 61468) [x64-mingw32] - -### Description - -First, look at - -https://docs.ruby-lang.org/ja/latest/doc/spec=2flexical.html#reserved - -and then, look at entry.rb. - -The source code of entry.rb consists only of reserved words of Ruby, -and all the reserved words are used in the code, in a way that the code -forms a valid Ruby program. No compile error, no warning, or no runtime error. - - -### Internals - -Difficult (and interesting) points of the theme are: - -* Since many of the reserved words define program structures, we cannot - use them independently. For instance, `retry` must be inside `rescue`, - or `break`/`next`/`redo` must be inside a looping construct. - Or, jump-out statements cannot occur at a position that requires a - value; `if return then true end` is a "void value expression" syntax error. -* Inserting newlines for each 6 word (to match with the spec html) is also - an interesting challenge, since Ruby is sensitive to newlines. - -Tricks used in the code are: - -* def/alias/undef can take even reserved words as parameters. - That is, `def class ... end` defines a method named `class`. - The feature is crucial since otherwise `BEGIN` etc inevitably - introduces non-reserved tokens (like `{}`). -* `defined?` can take some reserved words too (which I didn't know - until trying to write this program.) -* "void value expression" can be avoided by using `or` or `and`. - `if begin return end then true end` is a syntax error, but - `if begin false or return end then true end` is not. - - -### Limitation - -Sad to say that it's not a "perfect pangram". -It uses 'alias' and 'undef' twice, and 'end' 4 times. diff --git a/sample/trick2018/02-mame/authors.markdown b/sample/trick2018/02-mame/authors.markdown deleted file mode 100644 index 0e420fdf5d..0000000000 --- a/sample/trick2018/02-mame/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Yusuke Endoh - * mame@ruby-lang.org - * cctld: jp diff --git a/sample/trick2018/02-mame/entry.rb b/sample/trick2018/02-mame/entry.rb deleted file mode 100644 index ced791aa3d..0000000000 --- a/sample/trick2018/02-mame/entry.rb +++ /dev/null @@ -1,15 +0,0 @@ -'';eval(r=%q(->z{r="'';eval(r=\ -%q(#{r}))[%q`#{z}`]";i=-040;31. -times{|n|(15+n%2*15-n/2).times{ -r<<r[i+=(1.-n&2)*(32-n%2*31)]}} -i=r[524,0]=?\0;eval(r[479..-1]) -c['"']}))[%q`GFEDCBA"+"[e\"'"'t -kE*;;\";" TRICK2018 ";tb,;{{r -2E0$ob[us@*0)[90,336])#_i\n}s#i -0H}>["t]];};o[1,?\n*8];ex"-}eac -1Hl<1[-1]*2*t=n%2];o[14-n,0)mvk -8M$<4,?\n];15.times{|n|;o[35ie2 -!Pss.slice!(0,1)+x;sleep(0.0t;0 -'W=%q"<<95<<$s<<95;o=->n,x{n.'1 -;@[2]}|\e../,%@s="'%trick2018!8 -eval$s=%q_eval($s.gsub!(/#{%@`] diff --git a/sample/trick2018/02-mame/remarks.markdown b/sample/trick2018/02-mame/remarks.markdown deleted file mode 100644 index 88b32c205a..0000000000 --- a/sample/trick2018/02-mame/remarks.markdown +++ /dev/null @@ -1,16 +0,0 @@ -This program quines with animation. - -``` -$ ruby entry.rb -``` - -Of course, the output is executable. - -``` -$ ruby entry.rb > output -$ ruby output -``` - -Note, we don't cheat. This program uses escape sequences just for moving the cursor. It doesn't use attribution change nor overwrite to hide any code. - -The program is crafted so that it works in two ways; it works as a normal program text, and, it also works when it is rearranged in a spiral order. Some parts of the code are actually overlapped. diff --git a/sample/trick2018/03-tompng/Gemfile b/sample/trick2018/03-tompng/Gemfile deleted file mode 100644 index a24ff779dc..0000000000 --- a/sample/trick2018/03-tompng/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' -gem 'chunky_png' diff --git a/sample/trick2018/03-tompng/Gemfile.lock b/sample/trick2018/03-tompng/Gemfile.lock deleted file mode 100644 index 467f5c3495..0000000000 --- a/sample/trick2018/03-tompng/Gemfile.lock +++ /dev/null @@ -1,13 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - chunky_png (1.3.8) - -PLATFORMS - ruby - -DEPENDENCIES - chunky_png - -BUNDLED WITH - 1.16.1 diff --git a/sample/trick2018/03-tompng/authors.markdown b/sample/trick2018/03-tompng/authors.markdown deleted file mode 100644 index 26ebe24da6..0000000000 --- a/sample/trick2018/03-tompng/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Tomoya Ishida (tompng) - * tomoyapenguin@gmail.com - * cctld: jp diff --git a/sample/trick2018/03-tompng/entry.rb b/sample/trick2018/03-tompng/entry.rb deleted file mode 100644 index 26416c7019..0000000000 --- a/sample/trick2018/03-tompng/entry.rb +++ /dev/null @@ -1,31 +0,0 @@ -X=[];class String def-@;replace ?-+self end;def-a;X.reject!{|x|x. -__id__==__id__};a.replace(self+?-+a) end end;at_exit{eval C=(Zlib -.inflate((X*?-).tr(?-,'').tr('q-z','0-9').to_i(26).digits(0x100). -pack'C*'))};def method_missing n;(X<<n.to_s)[-1]end;require'zlib' -fzygtoxyzgntmdmuwvfoffbpmvzojpkhczvjvjdbtscnldwbdoprackddovivvmkz -ponzmosvtjciwkgaslscxxxwudeesmmqpfhislxuxnnypulxstzgobyaekqqhbjcg -mvko------------ddkeys----eivhnccaqyiw---bzyccmt-----------ymtnge -jwhi--------------pjxf------mdarbtumnv---qasda--------------gmwdt -wrtk---qtpzgnce----fsl-------fkgzgtbpp---gwnm----pxkpqkdiw---owga -momz---yjjvpnvar---zeo---v-----duvalwu---nsqt---waofemwakivnyqkjd -fzag---uhvusmkl----kzb---rhc----iutzjr---mqlh---ayijpwativpweaato -xexs--------------rvgv---pjdz-----lkkg---uiaw---lovitupw-----fwmn -kfru------------jvjpgv---jskycf----pal---gbuf---hfdnywog-----iuca -pntn---apmkqroeuzwuwkw---gqnmgof-----b---hlpl---vkkyhfyrqfr--jwrl -kmdb---dhspujhmtgrkccu---uonfummdt-------rqfw----bpiactehwp--fncq -yzvz---gdaxebplhfndran---ytfmviryeh------hqwkl---------------nced -bibu---fnkdthgldhkxxjg---rwnmpudhbqin----gucoyki------------hfura -cqdgqpyzqfzknvdjoxxhpjulwwyebtocxdrvklbuviwwcatlmdosxfvwntzbijguy -iglrvvzlxerflupxvsyujfacuwhrvmnecgtewtqkhtdggcltejiyqcluclkycwvzg -vvxfysvttfbeglvrlngntdngzyhqrmltazwdydxrsvjploembhgxdvfmmhepbschm -brn--iqrcdb--evv----tqp------lg--uein-wzut--mr------wkh------foqz -zsf--srjnjp--ampb--pfio--hgtekx--rrr---fwd--jn--xqkezcz--vsb--nya -khrc--evlr--oioxs--mqce--bqfmag--bwz---xda--qw--jnuzelr--qzi--itx -mdxd--duso--wxbot--nmon--ugnbdpc--a--c--e--hlg--twxndre--tby--rhg -evhbn--zb--dtxmiz--dpia------vie--h--i--t--shh------kfn------owna -ealmt--kb--scxdjy--smvl--dqmgebk--t--s--t--gfd--updcbnc--rh--dwwp -dvpnxb----wpljjdy--kolc--qflyleok---xkv---usbj--jhrawbn--ewx--bgf -eaqwrw----ejwxhet--dice--eoczconm---urz---rqyp--hovvvfc--bskj--el -aocjcts--jtumwxm----mgy------xpaoq-jtwqr-aipay------dhy--iync--hk -sckddmvuvvuhhqstumaykvczaaujrumqbbqsdvdycplyrlkkojlxnkrhbbrmnjxyf -cdtcmpfmjvthwkpzucbblttgumomlxnxwjeypfeagaukfzeokzxjebkpigcvlqnso diff --git a/sample/trick2018/03-tompng/output.txt b/sample/trick2018/03-tompng/output.txt deleted file mode 100644 index ed9a4079cc..0000000000 --- a/sample/trick2018/03-tompng/output.txt +++ /dev/null @@ -1,44 +0,0 @@ -undef p;X=[];class String def-@;replace ?-+dup end;def-a;X.reject!{|x|x.__id__==__id__};a.replace(self+?-+a) end end;at_exit{eval C= -(Zlib.inflate (X*?-).tr(?-,'').tr('q-z','0-9').to_i(26).digits(256).pack'C*')};def method_missing n;(X<<n.to_s)[-1]end;require'zlib' -gmlztzdculbtzgtjfetuh---k--htf----d-----------------------------------------------------g-b-----s--t-g--------jmuwescmgchftikfjafccs -ivchcveidpvxdabnvwyga-f--v-------xf----------------------------------------------------q-v---l-------q---------liiNeawriayymwooxgxqw -rfosepqsmojseyezmwbhi--------------ew--------------------------------------------------m---k-r-----------vwu--hiotltdmczwyjmlvbyfqwq -uvvykqdjednoqgtcmtfbzs---------f----o--------------------------------------------------t--a------m----x---f-----dldzsakyofetfozfpmrq -geusutariiiNiulkjbwlm-----d------------------------------------------------------------j---------o---------x--j-uitzrgwpupwhvendhyno -uubvnssiywkklwwdufhhi-rw----k---v-------------------------------------------------------sty-----yg---l---c-v----wkffpskpumolqmkeryzg -zrxdaiposwybbzgxdnegh-----g-----ma--n---------------------------------------------------------j----n--b-n-------yqavmscswdogpcgopygt -axiqfswlhzeamvymdnteo---q-q-w--------------------------fhrmj-----------------hkou-----------f-----d----u-o------evcuxxegekfgivzzujan -nslioftsvqvtkeigvfgwr-------------lyco-----------------igyvg-----------------okuk---------m--b-u--d--y------s---dadjrlykfhtermzfyktu -btoxzfpPicxxfligbivvf--------h----yrat---------------------------------------vjwd---------------------d-ki--o--tyqosehopkwttigwwfskp -komzvnyrvkjcjwbmdwdkp----------vxphiNdtawn--xms-saketo--jnld----ezulntdaz----nzna-----vhjwt------h----x--x--o--saxxsrkgktqotaluylbkk -sclegratyaarmgmepheml----------hwgglhlrfcx--znvmpfsgjx-onhju---gtxsmzqprlt---mjzy---frhdk-------------v---mj----dzjujmbgldfwoybgicwu -tfhgnhlzxlwtdtkgzlaca-------------gmex------arlm--------rvmh-ajtgf-----pqal--wcux-zatyi-------------------------xnluwybcugjclmablshn -tnjohqtqzivgmyutrssil-------------lcwq------jrf--------gcaii-maie------------vvnfjfqwo--------------------------filivosyhkxcvuwdibwj -tyxjiopiFqypvwdzoatuq-------------tdln------cnx---------ffuf-ajvq------------tyyypglpzmj------------------------vtqzwewqdsijrbymvpwn -niNffphoehukpvvmzvhyd-------------ahqd------nfr---------jeqk--toap-----mxhyg-tedv---otrwy-----------------------mjxnrktackwxwiajdnuc -kkxhuwbvibpvgvcampadi-------------ebmencqz--obf--------wfprz---qmrotkijiqv---ggfp-----hlzw----------------------kastwdpxiyftmypuxbtu -xetudmwzpomktgnjkcsyc---------------fwpdx---xb----j-----se-k------tllakc-----gjoo-------we------mic---lktk------ubtnrxvrjzuqlrfrsnmf -okdvfvcdbdqkckjialskk---------------------------v---u-------l----------------------------------z--q--qfg--------aaliNbxbjjpxebboneye -kcbkjmdclwnfawtfnwkeq----------------------------------j---y-------------------------------a---jmbyo-sgef--gf---extljbozuoofgyvsilct -xzoqmsqgzjxxpjqwkjkdd------------------------o--------m-------f---------------------------------n--de-ajz-rzv---fhnpbkrwdxoozpxeaxaf -mbcwxuiqdwcmadheiykaa-----------------------q-f------l---i---------------------------------r----zf---k--y---fi--dcnycheytylcgnioauee -yekiNacriqoevtdjerqbp----------------------------w---yy-----my----------------------------ko--mnbpskr--c-----j--ozyqpbfovhbhyoprzgqr -czwtuopxkdbphocfawvbk--------------------------q-s----j--b---------------------------------hd-xsb----bfiNp--w---fmwuvfambdqvxtzldwmh -xysnyrseydlkjcwfbsjnr-------------------------d-d-------------------------------------------f-enpss---qllpwr----almsdidvjwoigvldfqoa -lrpbixjpofxocxlflscpo------------------------------q-fyu--z-------------------------------------kfd-z---n-------bqxurujnxzurrdgcojks -jetyfdkcekckxbyosbfws-------------wdfhgwuvejjmf-----sxjubpvgcsl-------tnmixpv---------eurabjsdvstfv-------------qcyiqhonwoyixqeonfvp -mopPhywsozohitutgmmrb------------zxwtxe--riedeo---mspgpnv--pimlh------jhtzajk--------qqovvq---ldbrh-------------xtooxpayonpcvvtmvpra -vvuyiunpoeagdzqjecsub------------klrw------snrc---rrct------aajom--------nsyk--------peea-------azq-------------iNjefdkfhnagjicqwmsm -mbwwbfgehhbdmvvlflmee---------------------hkejn---jtbo-------jdtje-------jcei---------afyz-----smtc-------------kksvfjyuaqtohxiohhlz -dvfmfrzcmnsfruhqgjuxz------------------dfxdnlk----kkra-------xmmtf-------jwkw----------rdoozxtcho---------------bbwwferxwnnmdzcniicv -mfneisdlyeqwynldjgonj----------------jgrjvc-------uxga-------ghnpr-------sers--------scbknx----gmjo-------------moedtnlbflhtlkjibrqk -gobwqshnpbdcpjmjaeczr--------------iscsxs---------zfpo-------hhfwy-------qbba-------vhlxc-------ntod------------ndwzdomaptumzejiwqbn -snucynymvfpnadyqkzfcv-------------ggze------------kuvfs-----zuhod--------mylo-------jhwyp-----z-pywd------------dqfmpnevmtqcikbrilto -aotyxkipebdkassogpcbl-----------wgackesmvvsrihhd---orzndjndlzpb----------eobf-------kkayixzyotqfafa-w-----------mjjxoomwdglwvccozzut -rthesuszfwycsqqrtxlot-----------ejcqlhriilqbtrys------lwbkzmvp-----------zzwm-------l--qijwfllndzb-ik-----------mmokqomjepdcotnsiNig -nloryyoswwdmefywnnuhph------------------------------------------------------r--r-nd-----h--x--------------------hlgzeqqslwxgtjgghquf -nssngjtiudsrvfuxjzclhjhj----------------------------------------------------------t----------------k-f-mp-------obhyehqebtpjbkeepqzt -ezogzsimfynqmkteaipejo-g-yser-----------------------------------------------e------h-------------i---y----------qpgcqnltivmmsximbbsy -wtjjolwyoselcumgklqwpldkl-ulm-m---------------------------------------------------------------q---u-f--l--------buixfiitufktsqdtnrei -tgrtitcewseetlpeuuujb-osdokjozc------------------------------------------n---d-----f--------g--------q--g-------jyyqtezuzmcxgpcwuwfx -dpPayqmzxrwhbswwalygfurtkruw-u-k---------------------------------------------d---h------i----------c----i-------ulowcddvjbxthqlxjzbe diff --git a/sample/trick2018/03-tompng/remarks.markdown b/sample/trick2018/03-tompng/remarks.markdown deleted file mode 100644 index fe9eec5989..0000000000 --- a/sample/trick2018/03-tompng/remarks.markdown +++ /dev/null @@ -1,19 +0,0 @@ -### Remarks - -Bundle install - this program depends on `gem chunky_png` - -Run it with the following command: - bundle exec ruby entry.rb trick.png - bundle exec ruby entry.rb [other png file] - -I confirmed the following implementations/platforms: - -* ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16] -* ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16] - -### Description - -This program is a png image viewer. -The output is an asciiart of the given png file, -and it is also a source code of the png viewer itself. diff --git a/sample/trick2018/03-tompng/trick.png b/sample/trick2018/03-tompng/trick.png Binary files differdeleted file mode 100644 index d4bb0bd7c3..0000000000 --- a/sample/trick2018/03-tompng/trick.png +++ /dev/null diff --git a/sample/trick2018/04-colin/authors.markdown b/sample/trick2018/04-colin/authors.markdown deleted file mode 100644 index a846d12535..0000000000 --- a/sample/trick2018/04-colin/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Colin Fulton - * justcolin@gmail.com - * cctld: us diff --git a/sample/trick2018/04-colin/entry.rb b/sample/trick2018/04-colin/entry.rb deleted file mode 100644 index 442a8ea3a8..0000000000 --- a/sample/trick2018/04-colin/entry.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright 2018. Available for use under the terms of the MIT License. -$🚀=0;def 🤔 🏷,🤔=0,&b;puts ' '*$🚀+(🤔 ?"":"🚫 ")+🏷;$🚀+=4;b&.[];$🚀-=4;end diff --git a/sample/trick2018/04-colin/remarks.markdown b/sample/trick2018/04-colin/remarks.markdown deleted file mode 100644 index 5f4f1a8dfe..0000000000 --- a/sample/trick2018/04-colin/remarks.markdown +++ /dev/null @@ -1,62 +0,0 @@ -### Remarks - -Create a Ruby file that requires entry.rb with a series of test in it the run the file using ruby: - -``` -ruby name_of_test_file.rb -``` - -To create a test, call 🤔 with two arguments. The first is a string describing what this tests, the second argument is the test assertion. If the assertion is truthy, the test passes. If the assertion is falsy, the test fails. - -``` -string_1 = "Hello world!" -string_2 = "This is not the same!" - -🤔 "The two strings are equal", - string_1 == string_2 -``` - -To create a group of tests under a label, call 🤔 with a string describing the group and a block containing the tests in that group. - -``` -🤔 "This is a group of tests" do - # Add other groups and/or tests here. -end -``` - -Here is an example: - -``` -require './entry' - -🤔 "Math" do - 🤔 "Addition" do - 🤔 "One plus one equals two.", - 1+1 == 2 - 🤔 "One plus one equals eleven. (This should fail.)", - 1+1 == 11 - end - - 🤔 "Subtraction" do - 🤔 "One minus one equals zero.", - 1-1 == 0 - 🤔 "Ten minus one equal nine.", - 10-1 == 9 - end -end -``` - -It has been tested with the following Ruby versions: - -* ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17] -* ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15] -* If you replace `b&.[]` with `b&&b[]` it will work with ruby 2.0.0 as well, but it will be one character longer. - - -### Description - -The goal was to create a testing library where the test files looked good and the output looked good in as few characters as possible. The result is 68 characters and has one method to handle everything. - -### Limitation - -Your terminal program must support Unicode characters for the test output to look correct. If your terminal does not support Unicode, simply replace the 🚫 in the code with whatever character you want to prefix failing tests. diff --git a/sample/trick2018/05-tompng/authors.markdown b/sample/trick2018/05-tompng/authors.markdown deleted file mode 100644 index 26ebe24da6..0000000000 --- a/sample/trick2018/05-tompng/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Tomoya Ishida (tompng) - * tomoyapenguin@gmail.com - * cctld: jp diff --git a/sample/trick2018/05-tompng/entry.rb b/sample/trick2018/05-tompng/entry.rb deleted file mode 100644 index 31522b6de2..0000000000 --- a/sample/trick2018/05-tompng/entry.rb +++ /dev/null @@ -1,41 +0,0 @@ - X=[];def self.method_missing n;n.to_s.chars;end - l=[];def l.-a;X<<a=[nil,*a];a;end;def l.+a;self-a;end - class Array;def-@;[]-self;end;def-a;replace [*self,nil,*a - ]end;alias +@ -@;alias + -;end;def gen3d f;yield;b=['solid obj'];w, - h=X[0].size,X.size;X<<[];a=->r,z,dr,dz{;r-=w/2.0;z*=2;r2,z2=r+dr,z+dz*2;if r>0||r2> - 0;r=[0,r].max;r2=[0,r2].max;16.times{|i|m=Math;p=m::PI/8;;c,s=m.cos(t=i*p),m.sin(t) - c2,s2=m.cos(t=(i+1)*p),m.sin(t);t-=p/2;[[0,1,2],[0,2,3]].map{|a|b.push [:facet,'n'+ - + 'ormal',dz*m.cos(t),dz*m.sin(t),-dr]*' ','outer loop',a.map{|i|'v'+ - ++ "ertex #{[[r*c,r*s,z],[r*c2,r*s2,z],[r2*c2,r2*s2,z2],[r2* - +c, r2*s,z2]][i]*' '}"},:endloop,:endfacet}}end};(0...h). - map{| y|w.times{|x|[X[y-1][x]||a[x,y,1,0],X[y+1][x]|| - a[x+1,y+ - 1,-1,0],X[ - y][x-+1]||a[ - x,y+1,0,-1],X[y - ][x++1]||a[x+1,y, - 0,1]]if X[y][x]}} - s=[b,'end'+b[0]]* - $/;File.write(f, - s);X.replace( - []);end - -gen3d 'wine_glass.stl' do - l--ww------------------ww--l - l--ww------------------ww--l - l--ww++++++++++++++++++ww--l - l--ww++++++++++++++++++ww--l - l--ww++++++++++++++++++ww--l - l--ww++++++++++++++++++ww--l - l---ww++++++++++++++++ww---l - l----www++++++++++++www----l - l------www++++++++www------l - l--------wwwwwwwwww--------l - l-----------wwww-----------l - l------------ww------------l - l------------ww------------l - l------------ww------------l - l-----------wwww-----------l - l---------wwwwwwww---------l - l----wwwwwwwwwwwwwwwwww----l -end diff --git a/sample/trick2018/05-tompng/preview_of_output.png b/sample/trick2018/05-tompng/preview_of_output.png Binary files differdeleted file mode 100644 index db511ee2f3..0000000000 --- a/sample/trick2018/05-tompng/preview_of_output.png +++ /dev/null diff --git a/sample/trick2018/05-tompng/remarks.markdown b/sample/trick2018/05-tompng/remarks.markdown deleted file mode 100644 index b4e5708a43..0000000000 --- a/sample/trick2018/05-tompng/remarks.markdown +++ /dev/null @@ -1,31 +0,0 @@ -### Remarks - -Just run it with no argument: - - ruby entry.rb - -I confirmed the following implementations/platforms: - -* ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16] -* ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16] -* ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16] - -### Description - -This program will generate `wine_glass.stl`, a 3D data file(STL format) of a wine glass. -You can change the shape by modifying the DSL part. -For sake cup: -```ruby -gen3d 'ochoko.stl' do - l------------------------l - l-ww------------------ww-l - l-ww------------------ww-l - l-ww++++++++++++++++++ww-l - l-ww++++++++++++++++++ww-l - l--ww++++++++++++++++ww--l - l---wwww++++++++++wwww---l - l----wwwwwwwwwwwwwwww----l - l----www----------www----l -end -``` -`+` and `-` are the same meaning(just for appearance) diff --git a/sample/trick2018/README.md b/sample/trick2018/README.md deleted file mode 100644 index 345500b00a..0000000000 --- a/sample/trick2018/README.md +++ /dev/null @@ -1,16 +0,0 @@ -This directory contains the award-winning entries of -the 3rd Transcendental Ruby Imbroglio Contest for rubyKaigi (TRICK 2018). - -THESE ARE BAD EXAMPLES! You must NOT use them as a sample code. - -* 01-kinaba/entry.rb: "Most reserved" - **Gold award** -* 02-mame/entry.rb: "Best spiral" - **Silver award** -* 03-tompng/entry.rb: "Best png viewer" - **Bronze award** -* 04-colin/entry.rb: "Best one-liner" - 4th prize -* 05-tompng/entry.rb: "Most three-dimensional" - 5th prize - -These files are licensed under MIT license. - -For the contest outline and other winning entries, see: - -https://github.com/tric/trick2018 diff --git a/sample/trick2022/01-tompng/Gemfile b/sample/trick2022/01-tompng/Gemfile deleted file mode 100644 index 982b9de67f..0000000000 --- a/sample/trick2022/01-tompng/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' -gem 'matrix' diff --git a/sample/trick2022/01-tompng/Gemfile.lock b/sample/trick2022/01-tompng/Gemfile.lock deleted file mode 100644 index 8bb3c69025..0000000000 --- a/sample/trick2022/01-tompng/Gemfile.lock +++ /dev/null @@ -1,13 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - matrix (0.4.2) - -PLATFORMS - x86_64-darwin-20 - -DEPENDENCIES - matrix - -BUNDLED WITH - 2.3.3 diff --git a/sample/trick2022/01-tompng/authors.markdown b/sample/trick2022/01-tompng/authors.markdown deleted file mode 100644 index 26ebe24da6..0000000000 --- a/sample/trick2022/01-tompng/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Tomoya Ishida (tompng) - * tomoyapenguin@gmail.com - * cctld: jp diff --git a/sample/trick2022/01-tompng/entry.rb b/sample/trick2022/01-tompng/entry.rb deleted file mode 100644 index 97beacc684..0000000000 --- a/sample/trick2022/01-tompng/entry.rb +++ /dev/null @@ -1,40 +0,0 @@ - eval((s=%~c=(0..35 - ).map{s[2*_1+1]}*'';class$Inte - ger;def$quXinclude(Math ;spXo(a)=self* - a.pow(87X=h=32.chr;g=PI/480;ls=(sp*31X,89)%89; - def$abX+'eval((s=%'+(n=? .next)+s*88.chr+[nXs()=[a - =self%X+'.split(',sp*25+'?'+88.chr+');(0..36).mapX89,89- - a].miX{s[2*_1].split}',sp*31+".join.tr('$',$/)))"]*$/)Xn;end - ;reqX.split$/;trap(:INT){puts;exit};q=->t,i{a,y=((t+i*99)Xuire - 'matrX%960). ivmod(80);[(a*(7+i)+i*23)%79+(y+a)/(5+i%4)%2,39Xix';1 - 5.tiX-y/2]};p=->t,u{a=->b,c{(0..5).sum{(u%2-1)*E**(t*(b+c*_1)*gXmes{ - |i,*X.i+ i*u+=5+sin(u*u))}};x,z=a[5,3]. 5,3].rect;x+=y.Xv|z= - *?!Xi a[19,4];z+=w;r=(4+(x.abs+z.i).ab };t=(0..959).fX..? - W,?Xind{|t|(0..29).all?{x,y=q[t,_1];(x 2||h=ls[y][x]X[,* - ?]..X[/[^!-}]/]}};h=($**h+h).chr;eval( []} ->(x,yX?};a - =(0X,a,b){x=x*36+39.5;y=19.5-y*18;b*=1 |i|((yX..1 - 34)X-b).ceil..y+b).map{|j|((x-i)/a+(y j)/ .times{X.ma - p{zXx,z=p[t,_1];l=u```=0;while``````(l<1)``; u+```=0 ;d=x-y;X.in -dex(Xl+=(d.abs+(z-w``)``.i).ab``s*1.``1 ;x``,z=y``,w;o[v``=``x.r d.imag/Xc[i+ -15*Xd.abs*l*sin(2*``l-t``*g*80``-_1) l*(``1-l)/``6,a``=l*( -l)**2*0.X_1] -)};X7,a*2]&&o[v,z,``0.0``3,l**`` ``times``{|i``|(8+i).times{|Xw=* -MatXj|o[sin(i)/2+````` ```sin( `/2.0`````````)*j/200,j*0.0Xrix -[*(X5-1,0.02,0.1]``}} ``. q[t,``_1];m``[y][x]= };i=-X0.. -44).X1;$><<(['%%','[H .map{|j|(0..79).map{|k|x=(Xmap{ - |i,X -39.5)/35.8;y=( i+=1;m[j][k]?h:c[i]):ls[j]X*b| - v<<X[k];}*''}*$/<<0) 1)%9 te"`")#qv.jSaL{=;q(Q}4fXa.z - ip(Xjs(:#tK`Jm))FKO /A9(2'%iorvf7 eEa0uV xv+Q@qUU](L@&Py .1v'X0.. - ).suXydSEH{-GI|-5(,z G5evpq,[b50 D[ t {on,I?VStS`?G@LoqFCXm{|j - ,k|Xj1.QnxKz!mH%o# )b2Seut,]! 48 lBieJGi 5jeNPD#b}H3X-(p - =(iXaVz#8*+US,hgF 5#6]y-` 4hy HN hF75WjD!0IxJ$sX+k) - .powX+UP"cNUE9- G< tHvV;Ib <-s U T ? vlE xylg=x#X(i+k - ,88)XV9u$9lKb9 @C do7+-w >l { v9 { P l ga%]AK<e&'X+1)* - (j||(X4ifK/6S+ k} @@*a} 6rS xn"Q[M 8 `|g>$#BrjXb<<p; - 0))}XtbDp'Kc t2 Dat9C s C rL+ g,j]Tf B< eMI+zzkWX;b}] - .lup.XtVP<ak IM E/+)B jwv uB (Twqed D* dyf_dT7Xsolve - (v);13Xn:8 #_ RiSTO, [Fk m O]O#"+ a_ cT_.X5.time - s{c[i+X e5 T`FBEC q*f 2 o@{a<eUG aW PX15*_1] - =z[a[_1]X z_@`nll 7F1 2 [=^uS0z^ 6X||w.shif - t]}};eval(Xfg K#R N bp-E_Xc)~.split( - ?X);(0..36).map{s[2*_1].split} - .join.tr('$',$/))) diff --git a/sample/trick2022/01-tompng/remarks.markdown b/sample/trick2022/01-tompng/remarks.markdown deleted file mode 100644 index 70601908b7..0000000000 --- a/sample/trick2022/01-tompng/remarks.markdown +++ /dev/null @@ -1,51 +0,0 @@ -### Remarks - -Just run it with no argument: - - ruby entry.rb - -Or run it with one non-ascii half-width character argument: - - ruby entry.rb ⬮ - ruby entry.rb 𓆡 - -I confirmed the following implementations/platforms: - -* ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19] -* ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin20] - -### Description - -This program is an aquatic quine. -Some characters in the code are overwritten with `" "`, but this program can restore the missing parts. -Every frame of this animation is an executable ruby program that let fishes start swimming again from their current position. - -### Internals - -#### Error Correction - -Error correction is performed for each block of length 135. -It consists of 89 kinds of characters(`[*('!'..'W'), '[', *(']'..'}')]`) and satisfies the following constraint. - -``` -matrix(size: 45x135) * block_vector(size: 135) % 89 == zero_vector(size: 45) -``` - -To restore the missing characters in the block, we need to solve a linear equation problem in modulo 89. -This can be achieved by using bundled gem 'matrix' and overwriting some methods. - -```ruby -require 'matrix' -matrix = Matrix[[3, 1, 4], [1, 5, 9], [2, 6, 5]] -class Integer - def quo(x) = self * x.pow(87, 89) % 89 # Fermat's little theorem. 89 is a prime number. - def abs() = [self % 89, 89 - self % 89].min # To avoid division by multiple of 89. -end -answer = matrix.lup.solve([1, 2, 3]) #=> Vector[24, 42, 83] -(matrix * answer).map { _1 % 89 } #=> Vector[1, 2, 3] -``` - -#### Resuming Animation - -The entire animation of this fish tank is a loop of 960 frames. -This program uses position of the floating bubbles to detect current frame number from the executed source code. diff --git a/sample/trick2022/02-tompng/authors.markdown b/sample/trick2022/02-tompng/authors.markdown deleted file mode 100644 index 26ebe24da6..0000000000 --- a/sample/trick2022/02-tompng/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Tomoya Ishida (tompng) - * tomoyapenguin@gmail.com - * cctld: jp diff --git a/sample/trick2022/02-tompng/entry.rb b/sample/trick2022/02-tompng/entry.rb deleted file mode 100644 index 2e2e2bcf74..0000000000 --- a/sample/trick2022/02-tompng/entry.rb +++ /dev/null @@ -1,32 +0,0 @@ - q=->{!sleep _1/1e2};p=( - c=0..2).map{[_1/9r ,0,5**_1.i/3,1,0]} - require'socket';puts'op' "en http://localhost:#{( - w=TCPServer.new$*[0]||0).addr[1]}";Thread.new{q[2];f=[-1 - ]*s=3;t=Time.now.to_f;p.select!{0<_1[3]=[_1[3]+_1[4]/8.0,1 - ].min};9.times{h=p.map{[2**(_1*t.i)/_4**0.5/(1+Math.sin(2*t- - 9*_1%2)**32/16),_2+_4*( _3-_2)]};r=[s*3/2,84].min;g=->{x,y= -(s*(1+_1+1i)/2).rect;x<0 ||x>=s-1||y<0||y>=s-1?0:((l=f[y+1])[ -x+1]*(a=x%1)+(1-a)*l[x] )*(b=y%1)+(1-b)*((l=f[y])[x+1]*a+(1- -a)*l[x])};f=(1..r).map {|y|(1..r).map{|x|z=1.5+1.5i-3.0*(y -.i+x)/r;[h.sum{g[_1.*z +_2]}*0.9,1].min}};s=r};c=f.flatten -redo};loop{s=w.accept ; Thread.new{r=s.gets;h='HTTP/1.1 '+ -"200 OK\r\nContent-" 'T' "ype:text/html\r\n\r\n";r['/ ']?s. - <<(h+'<style>ifram' 'e{' 'opacity:0;height:0;}input{wid'+ - 'th:252px;}</styl' 'e>' '<form target="i"><input src="'+ - "g#{rand}\" type" '="im' 'age"><iframe name="i"></ifra'+ - 'me></form>'):r ['/g'] ?(h[/:.+l/]=?:'image/gif';s<< - h+'GIF8' '7a'+[84, - 84,246,0,*(0..383).map {15*_1. /(383r)**(3-_1% - 3)*17}].pack('v3c*'); loop{ s<<[67434785,5, - 44,84,84,7,c.map{_1* 127} .each_slice(126 - ).map{[127,128,*_1 ] .pack'c*'}*'', - 1,129].pack('V3x' 'v2na*c2x');q[ - 5];q.[]1while(r ==r=c)}):(x,y, - z=r.scan(/\d+/).map{_1.to_f/ - 126-1};z&&p<<[rand-0.5,( - z=x+y.i)*1.5,z/(z. - abs+0.9),0,-p[ - -3][4]=-1] - s.<<h);s - .close - }} diff --git a/sample/trick2022/02-tompng/remarks.markdown b/sample/trick2022/02-tompng/remarks.markdown deleted file mode 100644 index 3b2d3fd84b..0000000000 --- a/sample/trick2022/02-tompng/remarks.markdown +++ /dev/null @@ -1,32 +0,0 @@ -### Remarks - -1. Run it with `ruby entry.rb 8080` - -2. Open "http://localhost:8080" - -3. Click on the screen and interact with it - -I confirmed the following implementations/platforms: - -* Ruby Version - * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin20] -* Browser - * Chrome(macOS, Android) - * Firefox(macOS) - * Edge(macOS) - -### Description - -This program is an HTTP server that provides a fractal creature playground. -You can see the heartbeat of a mysterious fractal creature. Clicking on the screen will change the shape of the creature. -Surprisingly, this interactive webpage is built without JavaScript. - -### Internals - -Fractal: Iterated function system -Rendering from server: Streaming animated GIF -Sending click event to server: `<input type="image" src="streaming.gif">` with `<form target="invisible_iframe">` - -### Limitations - -Does not work on Safari and iOS. diff --git a/sample/trick2022/03-mame/authors.markdown b/sample/trick2022/03-mame/authors.markdown deleted file mode 100644 index 0e420fdf5d..0000000000 --- a/sample/trick2022/03-mame/authors.markdown +++ /dev/null @@ -1,3 +0,0 @@ -* Yusuke Endoh - * mame@ruby-lang.org - * cctld: jp diff --git a/sample/trick2022/03-mame/entry.rb b/sample/trick2022/03-mame/entry.rb deleted file mode 100644 index f24595dfa9..0000000000 --- a/sample/trick2022/03-mame/entry.rb +++ /dev/null @@ -1,27 +0,0 @@ -2022;"# - -.chars} {puts'TRICK+2022' - \ { ; -#';$><< b - ?! -};#{s=' ' # 0 -! s[0]? ( b=$<.read ;' -} ub( ,''} -';a= ''<<32 -b.lines {puts( ?.. *( -b.size) .gsub(/./) { -b.sub!( /^#$`\K(\S) - /x,a)?$1:a } - .rstrip)}): - ( [ 12,1,12,11]. -cycle { | i | t = ( s * - -10<< -10)* -10+ %(\e[A)* -10 -10. times{t[i* - _1 ] = 'TRICK+2022'[ - _1 ] };$><<t - sleep 1}) - }" diff --git a/sample/trick2022/03-mame/remarks.markdown b/sample/trick2022/03-mame/remarks.markdown deleted file mode 100644 index c38279f016..0000000000 --- a/sample/trick2022/03-mame/remarks.markdown +++ /dev/null @@ -1,96 +0,0 @@ -Execute the program normally. - -``` -$ ruby entry.rb -``` - -It shakes a string. - -... Wait! This is not all. - -Next, please apply "leftward gravity" to each letter in the file. -IOW, if there is a space to the left of a letter, move it to the left. -Here, you may want to use the following command. - -``` -$ sed "s/ //g" entry.rb | tee up.rb -``` - -This program applies "upward gravity" to each letter in an input text. -The following demo will help you understand what this means. - -``` -$ cat test.txt -$ ruby up.rb test.txt -``` - -Now, here's where we come in. -Please apply "upward gravity" to entry.rb. - -``` -$ ruby up.rb entry.rb | tee left.rb -``` - -I think that you already noticed that. -This program applies "leftward gravity" to an input text. - -``` -$ cat test.txt -$ ruby left.rb test.txt -``` - -`sed` is no longer required to create `up.rb`; just use `left.rb`. - -``` -$ ruby left.rb entry.rb > up.rb -``` - -We've come to the final stage. -Please apply `left.rb` to `left.rb`. - -``` -$ ruby left.rb left.rb | tee horizontal.rb -$ ruby horizontal.rb -``` - -Of course, it is also possible to apply `up.rb` to `up.rb`. - -``` -$ ruby up.rb up.rb | tee vertical.rb -$ ruby vertical.rb -``` - -Can you tell how they work? Enjoy analyzing! - - - ---- -Code reading tips (spoiler) - -Some code fragments are highly reused between the programs. -For example, note that this program has one code fragment to input a text -(`b=$>.read`); `up.rb` and `left.rb` share and use this code fragment. -Also, `horizontal.rb` and `vertical.rb` share the fragment `puts'TRICK+2022'`. -Sometimes letters in very distant places are reused all over the place. - -Can you tell how it detects if it is already aligned or not yet? -Here is a simplified version of the gimmick to switch behavior when -left-aligned: - -``` -"\ #{puts('not left-aligned yet')} - # {puts('left-aligned')}" -``` - -And for top-aligned: - -``` -"# -xx{puts('top-aligned')} -x#{puts('not top-aligned yet')} -" -``` - -It is also necessary to detect "top-left-aligned" and "left-top-aligned". -I made tons of subtle adjustments and trial-and-error to create the program. -I no longer know precisely how it works. diff --git a/sample/trick2022/03-mame/test.txt b/sample/trick2022/03-mame/test.txt deleted file mode 100644 index 18802153a9..0000000000 --- a/sample/trick2022/03-mame/test.txt +++ /dev/null @@ -1,13 +0,0 @@ -T - R - I - C - K - | - | - | - | - 2 - 0 - 2 - 2 diff --git a/sample/trick2022/README.md b/sample/trick2022/README.md deleted file mode 100644 index 3b2af6f86b..0000000000 --- a/sample/trick2022/README.md +++ /dev/null @@ -1,14 +0,0 @@ -This directory contains the award-winning entries of -the 4th Transcendental Ruby Imbroglio Contest for rubyKaigi (TRICK 2022). - -THESE ARE BAD EXAMPLES! You must NOT use them as a sample code. - -* 01-tompng/entry.rb: "Best fishbowl" -- Tomoya Ishida (tompng) -* 02-tompng/entry.rb: "Most interactive code" -- Tomoya Ishida (tompng) -* 03-mame/entry.rb: "Most anti-gravity" -- Yusuke Endoh - -These files are licensed under MIT license. - -For the contest outline and other winning entries, see: - -https://github.com/tric/trick2022 diff --git a/sample/uumerge.rb b/sample/uumerge.rb index 1b81582c24..2576bcb864 100644 --- a/sample/uumerge.rb +++ b/sample/uumerge.rb @@ -15,7 +15,7 @@ while line = gets() if out_stdout out = STDOUT else - out = File.open($file, "w") if $file != "" + out = open($file, "w") if $file != "" end out.binmode break diff --git a/sample/webrick/demo-app.rb b/sample/webrick/demo-app.rb new file mode 100644 index 0000000000..c7a2a0a6a4 --- /dev/null +++ b/sample/webrick/demo-app.rb @@ -0,0 +1,66 @@ +require "pp" + +module DemoApplication + def initialize(config, enctype) + super + @enctype = enctype + end + + def do_GET(req, res) + if req.path_info != "/" + res.set_redirect(WEBrick::HTTPStatus::Found, req.script_name + "/") + end + res.body =<<-_end_of_html_ + <HTML> + <FORM method="POST" enctype=#{@enctype}> + text: <INPUT type="text" name="text"><BR> + file: <INPUT type="file" name="file"><BR> + check: + <INPUT type="checkbox" name="check" value="a">a, + <INPUT type="checkbox" name="check" value="b">b, + <INPUT type="checkbox" name="check" value="c">c, + <BR> + <INPUT type="submit"> + </FORM> + </HTML> + _end_of_html_ + res['content-type'] = 'text/html; charset=iso-8859-1' + end + + def do_POST(req, res) + if req["content-length"].to_i > 1024*10 + raise WEBrick::HTTPStatus::Forbidden, "file size too large" + end + res.body =<<-_end_of_html_ + <HTML> + <H2>Query Parameters</H2> + #{display_query(req.query)} + <A href="#{req.path}">return</A> + <H2>Request</H2> + <PRE>#{WEBrick::HTMLUtils::escape(PP::pp(req, "", 80))}</PRE> + <H2>Response</H2> + <PRE>#{WEBrick::HTMLUtils::escape(PP::pp(res, "", 80))}</PRE> + </HTML> + _end_of_html_ + res['content-type'] = 'text/html; charset=iso-8859-1' + end + + private + + def display_query(q) + ret = "" + q.each{|key, val| + ret << "<H3>#{WEBrick::HTMLUtils::escape(key)}</H3>" + ret << "<TABLE border=1>" + ret << make_tr("val", val.inspect) + ret << make_tr("val.to_a", val.to_a.inspect) + ret << make_tr("val.to_ary", val.to_ary.inspect) + ret << "</TABLE>" + } + ret + end + + def make_tr(arg0, arg1) + "<TR><TD>#{arg0}</TD><TD>#{WEBrick::HTMLUtils::escape(arg1)}</TD></TR>" + end +end diff --git a/sample/webrick/demo-multipart.cgi b/sample/webrick/demo-multipart.cgi new file mode 100644 index 0000000000..0893fadadf --- /dev/null +++ b/sample/webrick/demo-multipart.cgi @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby +require "webrick/cgi" +require "webrick/https" # should load if it runs on HTTPS server +require "./demo-app" + +class DemoCGI < WEBrick::CGI + include DemoApplication +end + +config = { :NPH => false } +cgi = DemoCGI.new(config, "multipart/form-data") +cgi.start diff --git a/sample/webrick/demo-servlet.rb b/sample/webrick/demo-servlet.rb new file mode 100644 index 0000000000..9c18cc65d1 --- /dev/null +++ b/sample/webrick/demo-servlet.rb @@ -0,0 +1,6 @@ +require "webrick" +require "./demo-app" + +class DemoServlet < WEBrick::HTTPServlet::AbstractServlet + include DemoApplication +end diff --git a/sample/webrick/demo-urlencoded.cgi b/sample/webrick/demo-urlencoded.cgi new file mode 100644 index 0000000000..e4706f8b59 --- /dev/null +++ b/sample/webrick/demo-urlencoded.cgi @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby +require "webrick/cgi" +require "webrick/https" # should load if it runs on HTTPS server +require "./demo-app" + +class DemoCGI < WEBrick::CGI + include DemoApplication +end + +config = { :NPH => false } +cgi = DemoCGI.new(config, "application/x-www-form-urlencoded") +cgi.start diff --git a/sample/webrick/hello.cgi b/sample/webrick/hello.cgi new file mode 100644 index 0000000000..35d2240df0 --- /dev/null +++ b/sample/webrick/hello.cgi @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +require "webrick/cgi" + +class HelloCGI < WEBrick::CGI + def do_GET(req, res) + res["content-type"] = "text/plain" + res.body = "Hello, world.\n" + end +end + +HelloCGI.new.start diff --git a/sample/webrick/hello.rb b/sample/webrick/hello.rb new file mode 100644 index 0000000000..4d02676818 --- /dev/null +++ b/sample/webrick/hello.rb @@ -0,0 +1,8 @@ +require "webrick" + +class HelloServlet < WEBrick::HTTPServlet::AbstractServlet + def do_GET(req, res) + res["content-type"] = "text/plain" + res.body = "Hello, world.\n" + end +end diff --git a/sample/webrick/httpd.rb b/sample/webrick/httpd.rb new file mode 100644 index 0000000000..b0edf47582 --- /dev/null +++ b/sample/webrick/httpd.rb @@ -0,0 +1,23 @@ +require "webrick" + +httpd = WEBrick::HTTPServer.new( + :DocumentRoot => File::dirname(__FILE__), + :Port => 10080, + :Logger => WEBrick::Log.new($stderr, WEBrick::Log::DEBUG), + :AccessLog => [ + [ $stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT ], + [ $stderr, WEBrick::AccessLog::REFERER_LOG_FORMAT ], + [ $stderr, WEBrick::AccessLog::AGENT_LOG_FORMAT ], + ], + :CGIPathEnv => ENV["PATH"] # PATH environment variable for CGI. +) + +require "./hello" +httpd.mount("/hello", HelloServlet) + +require "./demo-servlet" +httpd.mount("/urlencoded", DemoServlet, "application/x-www-form-urlencoded") +httpd.mount("/multipart", DemoServlet, "multipart/form-data") + +trap(:INT){ httpd.shutdown } +httpd.start diff --git a/sample/webrick/httpproxy.rb b/sample/webrick/httpproxy.rb new file mode 100644 index 0000000000..c84457ece7 --- /dev/null +++ b/sample/webrick/httpproxy.rb @@ -0,0 +1,25 @@ +require "webrick" +require "webrick/httpproxy" + +# The :ProxyContentHandler proc will be invoked before sending a response to +# the User-Agent. You can inspect the pair of request and response messages +# (or edit the response message if necessary). + +pch = Proc.new{|req, res| + p [ req.request_line, res.status_line ] +} + +def upstream_proxy + if prx = ENV["http_proxy"] + return URI.parse(prx) + end + return nil +end + +httpd = WEBrick::HTTPProxyServer.new( + :Port => 10080, + :ProxyContentHandler => pch, + :ProxyURI => upstream_proxy +) +Signal.trap(:INT){ httpd.shutdown } +httpd.start diff --git a/sample/webrick/httpsd.rb b/sample/webrick/httpsd.rb new file mode 100644 index 0000000000..a120782c3c --- /dev/null +++ b/sample/webrick/httpsd.rb @@ -0,0 +1,33 @@ +require "webrick" +require "webrick/https" + +hostname = WEBrick::Utils::getservername +subject = [["O", "ruby-lang.org"], ["OU", "sample"], ["CN", hostname]] +comment = "Comment for self-signed certificate" + +httpd = WEBrick::HTTPServer.new( + :DocumentRoot => File::dirname(__FILE__), + :Port => 10443, + :SSLEnable => true, + + # Specify key pair and server certificate. + # :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.read("server.key")), + # :SSLCertificate => OpenSSL::X509::Certificate.new(File.read("server.crt")), + + # specify the following SSL options if you want to use auto + # generated self-signed certificate. + :SSLCertName => subject, + :SSLComment => comment, + + :CGIPathEnv => ENV["PATH"] # PATH environment variable for CGI. +) + +require "./hello" +httpd.mount("/hello", HelloServlet) + +require "./demo-servlet" +httpd.mount("/urlencoded", DemoServlet, "application/x-www-form-urlencoded") +httpd.mount("/multipart", DemoServlet, "multipart/form-data") + +trap(:INT){ httpd.shutdown } +httpd.start 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 |
