summaryrefslogtreecommitdiff
path: root/spec/ruby/core/nil/nilclass_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/nil/nilclass_spec.rb')
0 files changed, 0 insertions, 0 deletions
ss='rem' style='width: 0.0%;'/> -rw-r--r--ChangeLog7834
-rw-r--r--LEGAL21
-rw-r--r--Makefile.in316
-rw-r--r--README22
-rw-r--r--README.EXT96
-rw-r--r--README.EXT.ja92
-rw-r--r--README.ja19
-rw-r--r--array.c57
-rw-r--r--bcc32/Makefile.sub389
-rw-r--r--bcc32/README.bcc3226
-rw-r--r--[-rwxr-xr-x]bcc32/configure.bat68
-rw-r--r--bcc32/setup.mak54
-rw-r--r--bignum.c85
-rwxr-xr-xbin/erb156
-rw-r--r--bin/irb8
-rw-r--r--bin/rdoc2
-rw-r--r--class.c9
-rw-r--r--common.mk305
-rw-r--r--compar.c4
-rw-r--r--configure.in234
-rw-r--r--cygwin/GNUmakefile.in17
-rw-r--r--defines.h17
-rw-r--r--dir.c405
-rw-r--r--distruby.rb49
-rw-r--r--[-rwxr-xr-x]djgpp/configure.bat0
-rw-r--r--dln.c30
-rw-r--r--dln.h4
-rw-r--r--dmydln.c2
-rw-r--r--doc/forwardable.rd4
-rw-r--r--doc/forwardable.rd.ja4
-rw-r--r--doc/irb/irb-tools.rd.ja4
-rw-r--r--doc/irb/irb.rd4
-rw-r--r--doc/irb/irb.rd.ja12
-rw-r--r--doc/shell.rd4
-rw-r--r--doc/shell.rd.ja4
-rw-r--r--enum.c176
-rw-r--r--env.h10
-rw-r--r--error.c24
-rw-r--r--eval.c1194
-rw-r--r--ext/.document6
-rw-r--r--ext/Win32API/Win32API.c11
-rw-r--r--ext/Win32API/extconf.rb1
-rw-r--r--ext/Win32API/lib/win32/resolv.rb4
-rw-r--r--ext/bigdecimal/bigdecimal.c676
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb26
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb9
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb45
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb36
-rw-r--r--ext/bigdecimal/lib/bigdecimal/nlsolve.rb38
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb31
-rw-r--r--ext/bigdecimal/sample/linear.rb2
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb2
-rw-r--r--ext/curses/curses.c107
-rw-r--r--ext/curses/extconf.rb2
-rw-r--r--ext/curses/view.rb2
-rw-r--r--ext/dbm/dbm.c20
-rw-r--r--ext/dbm/extconf.rb10
-rw-r--r--ext/dbm/testdbm.rb593
-rw-r--r--ext/digest/defs.h2
-rw-r--r--ext/digest/digest.c8
-rw-r--r--ext/digest/digest.h4
-rw-r--r--ext/digest/digest.txt2
-rw-r--r--ext/digest/digest.txt.ja2
-rw-r--r--ext/digest/extconf.rb2
-rw-r--r--ext/digest/lib/md5.rb2
-rw-r--r--ext/digest/lib/sha1.rb2
-rw-r--r--ext/digest/md5/extconf.rb5
-rw-r--r--ext/digest/md5/md5.c2
-rw-r--r--ext/digest/md5/md5.h2
-rw-r--r--ext/digest/md5/md5init.c2
-rw-r--r--ext/digest/md5/md5ossl.c2
-rw-r--r--ext/digest/md5/md5ossl.h3
-rw-r--r--ext/digest/rmd160/extconf.rb5
-rw-r--r--ext/digest/rmd160/rmd160.c2
-rw-r--r--ext/digest/rmd160/rmd160.h2
-rw-r--r--ext/digest/rmd160/rmd160hl.c2
-rw-r--r--ext/digest/rmd160/rmd160init.c2
-rw-r--r--ext/digest/rmd160/rmd160ossl.c4
-rw-r--r--ext/digest/rmd160/rmd160ossl.h3
-rw-r--r--ext/digest/sha1/extconf.rb5
-rw-r--r--ext/digest/sha1/sha1.c2
-rw-r--r--ext/digest/sha1/sha1.h2
-rw-r--r--ext/digest/sha1/sha1hl.c2
-rw-r--r--ext/digest/sha1/sha1init.c2
-rw-r--r--ext/digest/sha1/sha1ossl.c4
-rw-r--r--ext/digest/sha1/sha1ossl.h3
-rw-r--r--ext/digest/sha2/extconf.rb13
-rw-r--r--ext/digest/sha2/sha2.c4
-rw-r--r--ext/digest/sha2/sha2.h2
-rw-r--r--ext/digest/sha2/sha2hl.c2
-rw-r--r--ext/digest/sha2/sha2init.c2
-rw-r--r--ext/digest/test.sh2
-rw-r--r--ext/dl/dl.c22
-rw-r--r--ext/dl/dl.h2
-rw-r--r--ext/dl/h2rb2
-rw-r--r--ext/dl/handle.c8
-rw-r--r--ext/dl/lib/dl/import.rb9
-rw-r--r--ext/dl/lib/dl/struct.rb4
-rw-r--r--ext/dl/ptr.c104
-rw-r--r--ext/dl/sym.c3
-rw-r--r--ext/dl/test/test.rb13
-rw-r--r--ext/enumerator/enumerator.c107
-rw-r--r--ext/enumerator/enumerator.txt2
-rw-r--r--ext/etc/etc.c173
-rw-r--r--ext/etc/extconf.rb27
-rw-r--r--ext/extmk.rb362
-rw-r--r--ext/fcntl/fcntl.c77
-rw-r--r--ext/gdbm/gdbm.c20
-rw-r--r--ext/gdbm/testgdbm.rb663
-rw-r--r--ext/iconv/charset_alias.rb83
-rw-r--r--ext/iconv/extconf.rb18
-rw-r--r--ext/iconv/iconv.c127
-rw-r--r--ext/io/wait/extconf.rb7
-rw-r--r--ext/io/wait/lib/nonblock.rb2
-rw-r--r--ext/io/wait/wait.c30
-rw-r--r--ext/nkf/lib/kconv.rb337
-rw-r--r--ext/nkf/nkf-utf8/config.h36
-rw-r--r--ext/nkf/nkf-utf8/nkf.c3034
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c9335
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.h34
-rw-r--r--ext/nkf/nkf.c432
-rw-r--r--ext/nkf/test.rb864
-rw-r--r--ext/openssl/.cvsignore1
-rw-r--r--ext/openssl/extconf.rb38
-rw-r--r--ext/openssl/lib/net/ftptls.rb4
-rw-r--r--ext/openssl/lib/net/https.rb182
-rw-r--r--ext/openssl/lib/net/protocols.rb55
-rw-r--r--ext/openssl/lib/net/telnets.rb4
-rw-r--r--ext/openssl/lib/openssl.rb4
-rw-r--r--ext/openssl/lib/openssl/bn.rb4
-rw-r--r--ext/openssl/lib/openssl/buffering.rb77
-rw-r--r--ext/openssl/lib/openssl/cipher.rb36
-rw-r--r--ext/openssl/lib/openssl/digest.rb39
-rw-r--r--ext/openssl/lib/openssl/ssl.rb52
-rw-r--r--ext/openssl/lib/openssl/x509.rb4
-rw-r--r--ext/openssl/openssl_missing.c11
-rw-r--r--ext/openssl/openssl_missing.h6
-rw-r--r--ext/openssl/ossl.c32
-rw-r--r--ext/openssl/ossl.h14
-rw-r--r--ext/openssl/ossl_asn1.c17
-rw-r--r--ext/openssl/ossl_asn1.h7
-rw-r--r--ext/openssl/ossl_bio.c5
-rw-r--r--ext/openssl/ossl_bio.h2
-rw-r--r--ext/openssl/ossl_bn.c2
-rw-r--r--ext/openssl/ossl_bn.h2
-rw-r--r--ext/openssl/ossl_cipher.c34
-rw-r--r--ext/openssl/ossl_cipher.h2
-rw-r--r--ext/openssl/ossl_config.c2
-rw-r--r--ext/openssl/ossl_config.h2
-rw-r--r--ext/openssl/ossl_digest.c2
-rw-r--r--ext/openssl/ossl_digest.h2
-rw-r--r--ext/openssl/ossl_engine.c85
-rw-r--r--ext/openssl/ossl_engine.h2
-rw-r--r--ext/openssl/ossl_hmac.c2
-rw-r--r--ext/openssl/ossl_hmac.h2
-rw-r--r--ext/openssl/ossl_ns_spki.c36
-rw-r--r--ext/openssl/ossl_ns_spki.h2
-rw-r--r--ext/openssl/ossl_ocsp.c4
-rw-r--r--ext/openssl/ossl_ocsp.h2
-rw-r--r--ext/openssl/ossl_pkcs12.c2
-rw-r--r--ext/openssl/ossl_pkcs12.h4
-rw-r--r--ext/openssl/ossl_pkcs7.c170
-rw-r--r--ext/openssl/ossl_pkcs7.h5
-rw-r--r--ext/openssl/ossl_pkey.c23
-rw-r--r--ext/openssl/ossl_pkey.h17
-rw-r--r--ext/openssl/ossl_pkey_dh.c79
-rw-r--r--ext/openssl/ossl_pkey_dsa.c14
-rw-r--r--ext/openssl/ossl_pkey_rsa.c17
-rw-r--r--ext/openssl/ossl_rand.c2
-rw-r--r--ext/openssl/ossl_rand.h2
-rw-r--r--ext/openssl/ossl_ssl.c242
-rw-r--r--ext/openssl/ossl_ssl.h2
-rw-r--r--ext/openssl/ossl_version.h2
-rw-r--r--ext/openssl/ossl_x509.c2
-rw-r--r--ext/openssl/ossl_x509.h2
-rw-r--r--ext/openssl/ossl_x509attr.c2
-rw-r--r--ext/openssl/ossl_x509cert.c2
-rw-r--r--ext/openssl/ossl_x509crl.c2
-rw-r--r--ext/openssl/ossl_x509ext.c26
-rw-r--r--ext/openssl/ossl_x509name.c5
-rw-r--r--ext/openssl/ossl_x509req.c4
-rw-r--r--ext/openssl/ossl_x509revoked.c2
-rw-r--r--ext/openssl/ossl_x509store.c44
-rw-r--r--ext/openssl/ruby_missing.h2
-rw-r--r--ext/pty/pty.c55
-rw-r--r--ext/racc/cparse/cparse.c220
-rw-r--r--ext/racc/cparse/extconf.rb2
-rw-r--r--ext/readline/extconf.rb69
-rw-r--r--ext/readline/readline.c261
-rw-r--r--ext/sdbm/_sdbm.c6
-rw-r--r--ext/sdbm/init.c22
-rw-r--r--ext/sdbm/testsdbm.rb (renamed from test/sdbm/test_sdbm.rb)260
-rw-r--r--ext/socket/extconf.rb316
-rw-r--r--ext/socket/socket.c1770
-rw-r--r--ext/socket/sockport.h4
-rw-r--r--ext/stringio/README4
-rw-r--r--ext/stringio/stringio.c378
-rw-r--r--ext/strscan/strscan.c330
-rw-r--r--ext/syck/bytecode.c239
-rw-r--r--ext/syck/emitter.c1064
-rw-r--r--ext/syck/gram.c1174
-rw-r--r--ext/syck/gram.h24
-rw-r--r--ext/syck/handler.c22
-rw-r--r--ext/syck/implicit.c239
-rw-r--r--ext/syck/node.c75
-rw-r--r--ext/syck/rubyext.c2070
-rw-r--r--ext/syck/syck.c28
-rw-r--r--ext/syck/syck.h113
-rw-r--r--ext/syck/token.c1431
-rw-r--r--ext/syck/yaml2byte.c22
-rw-r--r--ext/syslog/extconf.rb2
-rw-r--r--ext/syslog/syslog.c2
-rw-r--r--ext/syslog/syslog.txt2
-rw-r--r--ext/syslog/test.rb2
-rw-r--r--ext/tcltklib/.cvsignore (renamed from ext/tk/tkutil/.cvsignore)0
-rw-r--r--ext/tcltklib/MANUAL.eng (renamed from ext/tk/MANUAL_tcltklib.eng)35
-rw-r--r--ext/tcltklib/MANUAL.euc (renamed from ext/tk/MANUAL_tcltklib.eucj)36
-rw-r--r--ext/tcltklib/README.1st (renamed from ext/tk/README.tcltklib)19
-rw-r--r--ext/tcltklib/README.ActiveTcl (renamed from ext/tk/README.ActiveTcl)0
-rw-r--r--ext/tcltklib/README.euc (renamed from ext/tk/old-README.tcltklib.eucj)0
-rw-r--r--ext/tcltklib/demo/lines0.tcl (renamed from ext/tk/sample/tcltklib/lines0.tcl)0
-rw-r--r--ext/tcltklib/demo/lines1.rb (renamed from ext/tk/sample/tcltklib/lines1.rb)0
-rw-r--r--ext/tcltklib/demo/lines2.rb (renamed from ext/tk/sample/tcltklib/lines2.rb)0
-rw-r--r--ext/tcltklib/demo/lines3.rb (renamed from ext/tk/sample/tcltklib/lines3.rb)0
-rw-r--r--ext/tcltklib/demo/lines4.rb (renamed from ext/tk/sample/tcltklib/lines4.rb)0
-rw-r--r--ext/tcltklib/demo/safeTk.rb (renamed from ext/tk/sample/tcltklib/safeTk.rb)0
-rw-r--r--ext/tcltklib/depend2
-rw-r--r--ext/tcltklib/extconf.rb250
-rw-r--r--ext/tcltklib/lib/tcltk.rb (renamed from ext/tk/lib/tcltk.rb)0
-rw-r--r--ext/tcltklib/sample/batsu.gif (renamed from ext/tk/sample/tcltklib/batsu.gif)bin538 -> 538 bytes-rw-r--r--ext/tcltklib/sample/maru.gif (renamed from ext/tk/sample/tcltklib/maru.gif)bin481 -> 481 bytes-rw-r--r--ext/tcltklib/sample/sample0.rb (renamed from ext/tk/sample/tcltklib/sample0.rb)0
-rw-r--r--ext/tcltklib/sample/sample1.rb (renamed from ext/tk/sample/tcltklib/sample1.rb)30
-rw-r--r--ext/tcltklib/sample/sample2.rb (renamed from ext/tk/sample/tcltklib/sample2.rb)12
-rw-r--r--ext/tcltklib/stubs.c104
-rw-r--r--ext/tcltklib/tcltklib.c (renamed from ext/tk/tcltklib.c)5249
-rw-r--r--ext/tk/ChangeLog.tkextlib790
-rw-r--r--ext/tk/README.1st31
-rw-r--r--ext/tk/README.macosx-aqua67
-rw-r--r--ext/tk/depend3
-rw-r--r--ext/tk/extconf.rb311
-rw-r--r--ext/tk/lib/multi-tk.rb1155
-rw-r--r--ext/tk/lib/remote-tk.rb94
-rw-r--r--ext/tk/lib/tk.rb926
-rw-r--r--ext/tk/lib/tk/after.rb2
-rw-r--r--ext/tk/lib/tk/autoload.rb4
-rw-r--r--ext/tk/lib/tk/bindtag.rb1
-rw-r--r--ext/tk/lib/tk/canvas.rb56
-rw-r--r--ext/tk/lib/tk/canvastag.rb30
-rw-r--r--ext/tk/lib/tk/clock.rb6
-rw-r--r--ext/tk/lib/tk/composite.rb113
-rw-r--r--ext/tk/lib/tk/console.rb25
-rw-r--r--ext/tk/lib/tk/dialog.rb45
-rw-r--r--ext/tk/lib/tk/encodedstr.rb8
-rw-r--r--ext/tk/lib/tk/entry.rb13
-rw-r--r--ext/tk/lib/tk/event.rb377
-rw-r--r--ext/tk/lib/tk/font.rb990
-rw-r--r--ext/tk/lib/tk/frame.rb5
-rw-r--r--ext/tk/lib/tk/grid.rb6
-rw-r--r--ext/tk/lib/tk/image.rb65
-rw-r--r--ext/tk/lib/tk/itemconfig.rb314
-rw-r--r--ext/tk/lib/tk/itemfont.rb30
-rw-r--r--ext/tk/lib/tk/kinput.rb28
-rw-r--r--ext/tk/lib/tk/label.rb4
-rw-r--r--ext/tk/lib/tk/labelframe.rb5
-rw-r--r--ext/tk/lib/tk/listbox.rb12
-rw-r--r--ext/tk/lib/tk/macpkg.rb5
-rw-r--r--ext/tk/lib/tk/menu.rb109
-rw-r--r--ext/tk/lib/tk/menuspec.rb12
-rw-r--r--ext/tk/lib/tk/mngfocus.rb8
-rw-r--r--ext/tk/lib/tk/msgcat.rb8
-rw-r--r--ext/tk/lib/tk/namespace.rb232
-rw-r--r--ext/tk/lib/tk/optiondb.rb2
-rw-r--r--ext/tk/lib/tk/pack.rb6
-rw-r--r--ext/tk/lib/tk/palette.rb9
-rw-r--r--ext/tk/lib/tk/panedwindow.rb30
-rw-r--r--ext/tk/lib/tk/radiobutton.rb21
-rw-r--r--ext/tk/lib/tk/root.rb24
-rw-r--r--ext/tk/lib/tk/scale.rb5
-rw-r--r--ext/tk/lib/tk/scrollbox.rb2
-rw-r--r--ext/tk/lib/tk/spinbox.rb22
-rw-r--r--ext/tk/lib/tk/tagfont.rb12
-rw-r--r--ext/tk/lib/tk/text.rb208
-rw-r--r--ext/tk/lib/tk/textimage.rb2
-rw-r--r--ext/tk/lib/tk/textmark.rb39
-rw-r--r--ext/tk/lib/tk/texttag.rb11
-rw-r--r--ext/tk/lib/tk/textwindow.rb2
-rw-r--r--ext/tk/lib/tk/timer.rb149
-rw-r--r--ext/tk/lib/tk/toplevel.rb27
-rw-r--r--ext/tk/lib/tk/validation.rb5
-rw-r--r--ext/tk/lib/tk/variable.rb839
-rw-r--r--ext/tk/lib/tk/virtevent.rb15
-rw-r--r--ext/tk/lib/tk/winfo.rb191
-rw-r--r--ext/tk/lib/tk/winpkg.rb5
-rw-r--r--ext/tk/lib/tk/wm.rb90
-rw-r--r--ext/tk/lib/tk/xim.rb40
-rw-r--r--ext/tk/lib/tkclass.rb2
-rw-r--r--ext/tk/lib/tkextlib/ICONS/icons.rb25
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS143
-rw-r--r--ext/tk/lib/tkextlib/blt.rb187
-rw-r--r--ext/tk/lib/tkextlib/blt/barchart.rb79
-rw-r--r--ext/tk/lib/tkextlib/blt/bitmap.rb99
-rw-r--r--ext/tk/lib/tkextlib/blt/busy.rb82
-rw-r--r--ext/tk/lib/tkextlib/blt/component.rb1835
-rw-r--r--ext/tk/lib/tkextlib/blt/container.rb28
-rw-r--r--ext/tk/lib/tkextlib/blt/cutbuffer.rb23
-rw-r--r--ext/tk/lib/tkextlib/blt/dragdrop.rb214
-rw-r--r--ext/tk/lib/tkextlib/blt/eps.rb32
-rw-r--r--ext/tk/lib/tkextlib/blt/graph.rb67
-rw-r--r--ext/tk/lib/tkextlib/blt/htext.rb110
-rw-r--r--ext/tk/lib/tkextlib/blt/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/blt/spline.rb23
-rw-r--r--ext/tk/lib/tkextlib/blt/stripchart.rb74
-rw-r--r--ext/tk/lib/tkextlib/blt/table.rb344
-rw-r--r--ext/tk/lib/tkextlib/blt/tabnotebook.rb21
-rw-r--r--ext/tk/lib/tkextlib/blt/tabset.rb401
-rw-r--r--ext/tk/lib/tkextlib/blt/ted.rb62
-rw-r--r--ext/tk/lib/tkextlib/blt/tile.rb21
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/button.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/checkbutton.rb17
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/frame.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/label.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/radiobutton.rb17
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/scrollbar.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/toplevel.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/tree.rb923
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb1146
-rw-r--r--ext/tk/lib/tkextlib/blt/unix_dnd.rb129
-rw-r--r--ext/tk/lib/tkextlib/blt/vector.rb243
-rw-r--r--ext/tk/lib/tkextlib/blt/watch.rb142
-rw-r--r--ext/tk/lib/tkextlib/blt/win_printer.rb61
-rw-r--r--ext/tk/lib/tkextlib/blt/winop.rb107
-rw-r--r--ext/tk/lib/tkextlib/bwidget.rb5
-rw-r--r--ext/tk/lib/tkextlib/bwidget/button.rb10
-rw-r--r--ext/tk/lib/tkextlib/bwidget/buttonbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dialog.rb10
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dynamichelp.rb5
-rw-r--r--ext/tk/lib/tkextlib/bwidget/entry.rb15
-rw-r--r--ext/tk/lib/tkextlib/bwidget/label.rb15
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelentry.rb19
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelframe.rb16
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb13
-rw-r--r--ext/tk/lib/tkextlib/bwidget/mainframe.rb19
-rw-r--r--ext/tk/lib/tkextlib/bwidget/messagedlg.rb11
-rw-r--r--ext/tk/lib/tkextlib/bwidget/notebook.rb9
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panelframe.rb51
-rw-r--r--ext/tk/lib/tkextlib/bwidget/passwddlg.rb17
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollview.rb5
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectfont.rb6
-rw-r--r--ext/tk/lib/tkextlib/bwidget/spinbox.rb24
-rw-r--r--ext/tk/lib/tkextlib/bwidget/statusbar.rb46
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb24
-rw-r--r--ext/tk/lib/tkextlib/itcl/incr_tcl.rb5
-rw-r--r--ext/tk/lib/tkextlib/itk/incr_tk.rb17
-rw-r--r--ext/tk/lib/tkextlib/iwidgets.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/combobox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/datefield.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialogshell.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb7
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extbutton.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb13
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/feedback.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb13
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/finddialog.rb13
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hierarchy.rb23
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledframe.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/mainwindow.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/menubar.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagebox.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb23
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/optionmenu.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/panedwindow.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/promptdialog.rb4
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/pushbutton.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/radiobox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb22
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb23
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb44
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectionbox.rb14
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb4
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spindate.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinint.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinner.rb6
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spintime.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb19
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabset.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/timeentry.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/timefield.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/toolbar.rb25
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/watch.rb11
-rw-r--r--ext/tk/lib/tkextlib/tcllib.rb37
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb17
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb21
-rw-r--r--ext/tk/lib/tkextlib/tcllib/cursor.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb9
-rw-r--r--ext/tk/lib/tkextlib/tcllib/dialog.rb84
-rw-r--r--ext/tk/lib/tkextlib/tcllib/getstring.rb131
-rw-r--r--ext/tk/lib/tkextlib/tcllib/history.rb73
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ico.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb15
-rw-r--r--ext/tk/lib/tkextlib/tcllib/panelframe.rb72
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb159
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ruler.rb65
-rw-r--r--ext/tk/lib/tkextlib/tcllib/screenruler.rb68
-rw-r--r--ext/tk/lib/tkextlib/tcllib/scrollwin.rb61
-rw-r--r--ext/tk/lib/tkextlib/tcllib/style.rb6
-rw-r--r--ext/tk/lib/tkextlib/tcllib/superframe.rb51
-rw-r--r--ext/tk/lib/tkextlib/tcllib/swaplist.rb147
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist.rb27
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_core.rb770
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb25
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb21
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tooltip.rb95
-rw-r--r--ext/tk/lib/tkextlib/tcllib/widget.rb48
-rw-r--r--ext/tk/lib/tkextlib/tclx/tclx.rb15
-rw-r--r--ext/tk/lib/tkextlib/tile.rb158
-rw-r--r--ext/tk/lib/tkextlib/tile/dialog.rb84
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb47
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb16
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb17
-rw-r--r--ext/tk/lib/tkextlib/tile/tcombobox.rb55
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb40
-rw-r--r--ext/tk/lib/tkextlib/tile/tframe.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb16
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabelframe.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb16
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb44
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb188
-rw-r--r--ext/tk/lib/tkextlib/tile/tprogressbar.rb53
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb17
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb280
-rw-r--r--ext/tk/lib/tkextlib/tile/tscale.rb50
-rw-r--r--ext/tk/lib/tkextlib/tile/tscrollbar.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tseparator.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tsquare.rb30
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb6
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb9
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb15
-rw-r--r--ext/tk/lib/tkextlib/tkimg.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/bmp.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/gif.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ico.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/jpeg.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pcx.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pixmap.rb7
-rw-r--r--ext/tk/lib/tkextlib/tkimg/png.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ppm.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ps.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sgi.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sun.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tga.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tiff.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/window.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xbm.rb5
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xpm.rb5
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb45
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb5
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb1595
-rw-r--r--ext/tk/lib/tkextlib/trofs.rb13
-rw-r--r--ext/tk/lib/tkextlib/trofs/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/trofs/trofs.rb51
-rw-r--r--ext/tk/lib/tkextlib/vu.rb5
-rw-r--r--ext/tk/lib/tkextlib/vu/bargraph.rb10
-rw-r--r--ext/tk/lib/tkextlib/vu/charts.rb6
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb4
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb6
-rw-r--r--ext/tk/sample/24hr_clock.rb286
-rw-r--r--ext/tk/sample/cd_timer.rb81
-rw-r--r--ext/tk/sample/demos-en/anilabel.rb172
-rw-r--r--ext/tk/sample/demos-en/aniwave.rb115
-rw-r--r--ext/tk/sample/demos-en/bind.rb30
-rw-r--r--ext/tk/sample/demos-en/check2.rb44
-rw-r--r--ext/tk/sample/demos-en/floor.rb4
-rw-r--r--ext/tk/sample/demos-en/floor2.rb4
-rw-r--r--ext/tk/sample/demos-en/goldberg.rb1999
-rw-r--r--ext/tk/sample/demos-en/image3.rb3
-rw-r--r--ext/tk/sample/demos-en/menu.rb12
-rw-r--r--ext/tk/sample/demos-en/pendulum.rb223
-rw-r--r--ext/tk/sample/demos-en/tcolor17
-rw-r--r--ext/tk/sample/demos-en/tcolor.bak513
-rw-r--r--ext/tk/sample/demos-en/widget146
-rw-r--r--ext/tk/sample/demos-jp/anilabel.rb174
-rw-r--r--ext/tk/sample/demos-jp/aniwave.rb116
-rw-r--r--ext/tk/sample/demos-jp/bind.rb30
-rw-r--r--ext/tk/sample/demos-jp/check2.rb44
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb2
-rw-r--r--ext/tk/sample/demos-jp/floor.rb4
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb4
-rw-r--r--ext/tk/sample/demos-jp/goldberg.rb2003
-rw-r--r--ext/tk/sample/demos-jp/image3.rb3
-rw-r--r--ext/tk/sample/demos-jp/menu.rb12
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb12
-rw-r--r--ext/tk/sample/demos-jp/pendulum.rb224
-rw-r--r--ext/tk/sample/demos-jp/tcolor17
-rw-r--r--ext/tk/sample/demos-jp/widget145
-rw-r--r--ext/tk/sample/irbtk.rb30
-rw-r--r--ext/tk/sample/scrollframe.rb237
-rw-r--r--ext/tk/sample/tkballoonhelp.rb99
-rw-r--r--ext/tk/sample/tkextlib/blt/barchart5.rb101
-rw-r--r--ext/tk/sample/tkextlib/blt/calendar.rb117
-rw-r--r--ext/tk/sample/tkextlib/blt/graph6.rb2222
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7.rb40
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7a.rb63
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7b.rb41
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7c.rb45
-rw-r--r--ext/tk/sample/tkextlib/blt/images/buckskin.gifbin7561 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/blt/images/chalk.gifbin4378 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/blt/images/qv100.t.gifbin2694 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/blt/images/rain.gifbin3785 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/blt/images/sample.gifbin186103 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/blt/pareto.rb90
-rw-r--r--ext/tk/sample/tkextlib/blt/plot1.rb9
-rw-r--r--ext/tk/sample/tkextlib/blt/plot1b.rb10
-rw-r--r--ext/tk/sample/tkextlib/blt/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/blt/scripts/stipples.rb156
-rw-r--r--ext/tk/sample/tkextlib/blt/winop1.rb40
-rw-r--r--ext/tk/sample/tkextlib/blt/winop2.rb28
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tree.rb2
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb8
-rw-r--r--ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt30
-rw-r--r--ext/tk/sample/tkextlib/tile/demo.rb972
-rw-r--r--ext/tk/sample/tkextlib/tile/iconlib.tcl110
-rw-r--r--ext/tk/sample/tkextlib/tile/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/tile/repeater.tcl117
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl149
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gifbin315 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gifbin312 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gifbin313 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gifbin329 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gifbin327 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gifbin323 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gifbin330 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gifbin327 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gifbin324 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gifbin309 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gifbin313 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gifbin314 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gifbin696 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gifbin770 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcfbin1942 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gifbin769 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gifbin254 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gifbin234 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gifbin249 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gifbin229 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gifbin1098 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gifbin626 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gifbin389 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gifbin401 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gifbin343 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gifbin316 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gifbin333 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gifbin308 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gifbin182 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gifbin182 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gifbin183 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gifbin283 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl6
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl194
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gifbin273 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gifbin258 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gifbin292 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gifbin272 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gifbin274 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gifbin258 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gifbin286 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gifbin271 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gifbin1266 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gifbin896 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gifbin881 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gifbin625 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gifbin859 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gifbin434 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gifbin423 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gifbin401 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gifbin395 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gifbin592 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gifbin1116 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gifbin61 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gifbin1057 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gifbin1095 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gifbin695 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gifbin686 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gifbin383 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gifbin878 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gifbin907 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gifbin238 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gifbin927 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gifbin405 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gifbin399 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gifbin587 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl15
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc.rb200
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl163
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gifbin522 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gifbin554 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gifbin548 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gifbin281 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gifbin273 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gifbin303 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gifbin294 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gifbin652 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gifbin644 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gifbin632 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gifbin621 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl15
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl16
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl125
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gifbin362 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gifbin250 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gifbin378 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gifbin267 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gifbin379 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gifbin266 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gifbin363 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gifbin251 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gifbin439 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gifbin443 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gifbin302 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gifbin169 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gifbin170 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gifbin235 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gifbin226 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gifbin169 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gifbin269 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gifbin342 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gifbin178 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gifbin179 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gifbin236 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gifbin178 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gifbin178 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gifbin366 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gifbin336 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/toolbutton.tcl152
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/hv.rb85
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/index.html2
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/ss.rb680
-rw-r--r--ext/tk/sample/tkextlib/tkimg/demo.rb1478
-rw-r--r--ext/tk/sample/tkextlib/tkimg/license_terms_of_Img_extension41
-rw-r--r--ext/tk/sample/tkextlib/tkimg/readme.txt3
-rw-r--r--ext/tk/sample/tkextlib/tktable/basic.rb4
-rw-r--r--ext/tk/sample/tkextlib/tktable/command.rb4
-rw-r--r--ext/tk/sample/tkextlib/tktable/debug.rb2
-rw-r--r--ext/tk/sample/tkextlib/tktable/maxsize.rb2
-rw-r--r--ext/tk/sample/tkextlib/treectrl/bitmaps.rb76
-rw-r--r--ext/tk/sample/tkextlib/treectrl/demo.rb1310
-rw-r--r--ext/tk/sample/tkextlib/treectrl/explorer.rb430
-rw-r--r--ext/tk/sample/tkextlib/treectrl/help.rb404
-rw-r--r--ext/tk/sample/tkextlib/treectrl/imovie.rb130
-rw-r--r--ext/tk/sample/tkextlib/treectrl/layout.rb159
-rw-r--r--ext/tk/sample/tkextlib/treectrl/mailwasher.rb269
-rw-r--r--ext/tk/sample/tkextlib/treectrl/outlook-folders.rb124
-rw-r--r--ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb448
-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/big-dll.gifbin437 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/big-exe.gifbin368 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/big-file.gifbin466 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/big-folder.gifbin459 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/big-txt.gifbin392 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/checked.gifbin78 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/file.gifbin279 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/folder-closed.gifbin111 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/folder-open.gifbin120 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/help-book-closed.gifbin115 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/help-book-open.gifbin128 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/help-page.gifbin132 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-01.gifbin5406 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-02.gifbin5912 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-03.gifbin4696 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-04.gifbin5783 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-05.gifbin3238 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-06.gifbin3509 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/imovie-07.gifbin2091 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-check-off.gifbin70 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-check-on.gifbin76 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-print.gifbin124 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-radio-off.gifbin68 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-radio-on.gifbin71 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-search.gifbin114 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/internet-security.gifbin108 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/mac-collapse.gifbin275 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/mac-expand.gifbin277 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-arrow.gifbin73 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-clip.gifbin73 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-deleted.gifbin138 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-draft.gifbin134 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-folder.gifbin133 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-group.gifbin144 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-inbox.gifbin133 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-local.gifbin146 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-main.gifbin174 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-outbox.gifbin136 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-read-2.gifbin343 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-read.gifbin304 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-sent.gifbin132 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-server.gifbin163 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-unread.gifbin303 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/outlook-watch.gifbin98 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/sky.gifbin6454 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/small-dll.gifbin311 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/small-exe.gifbin115 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/small-file.gifbin338 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/small-folder.gifbin307 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/small-txt.gifbin302 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/pics/unchecked.gifbin72 -> 0 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/random.rb508
-rw-r--r--ext/tk/sample/tkextlib/treectrl/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/treectrl/www-options.rb303
-rw-r--r--ext/tk/sample/tkextlib/vu/dial.rb (renamed from ext/tk/sample/tkextlib/vu/dial_demo.rb)0
-rw-r--r--ext/tk/sample/tkextlib/vu/vu.rb (renamed from ext/tk/sample/tkextlib/vu/vu_demo.rb)0
-rw-r--r--ext/tk/sample/tkrttimer.rb68
-rw-r--r--ext/tk/sample/tktextio.rb603
-rw-r--r--ext/tk/sample/tktree.rb2
-rw-r--r--ext/tk/stubs.c516
-rw-r--r--ext/tk/stubs.h33
-rw-r--r--ext/tk/tkutil.c (renamed from ext/tk/tkutil/tkutil.c)429
-rw-r--r--ext/tk/tkutil/depend1
-rw-r--r--ext/tk/tkutil/extconf.rb4
-rw-r--r--ext/win32ole/.cvsignore1
-rw-r--r--ext/win32ole/extconf.rb18
-rw-r--r--ext/win32ole/sample/olegen.rb4
-rw-r--r--ext/win32ole/tests/testNIL2VTEMPTY.rb28
-rw-r--r--ext/win32ole/tests/testOLEEVENT.rb58
-rw-r--r--ext/win32ole/tests/testOLEMETHOD.rb5
-rw-r--r--ext/win32ole/tests/testOLEPARAM.rb9
-rw-r--r--ext/win32ole/tests/testWIN32OLE.rb62
-rw-r--r--ext/win32ole/tests/test_ole_methods.rb36
-rw-r--r--ext/win32ole/tests/test_propertyputref.rb19
-rw-r--r--ext/win32ole/tests/test_word.rb37
-rw-r--r--ext/win32ole/tests/testall.rb4
-rw-r--r--ext/win32ole/win32ole.c1332
-rw-r--r--ext/zlib/doc/zlib.rd2
-rw-r--r--ext/zlib/extconf.rb11
-rw-r--r--ext/zlib/zlib.c216
-rw-r--r--file.c458
-rw-r--r--gc.c291
-rw-r--r--hash.c87
-rw-r--r--inits.c4
-rw-r--r--instruby.rb99
-rw-r--r--intern.h17
-rw-r--r--io.c591
-rw-r--r--lib/.document78
-rw-r--r--lib/abbrev.rb2
-rw-r--r--lib/benchmark.rb2
-rw-r--r--lib/cgi-lib.rb2
-rw-r--r--lib/cgi.rb21
-rw-r--r--lib/cgi/session.rb22
-rw-r--r--lib/cgi/session/pstore.rb17
-rw-r--r--lib/csv.rb2
-rw-r--r--lib/date.rb12
-rw-r--r--lib/date/format.rb60
-rw-r--r--lib/debug.rb12
-rw-r--r--lib/delegate.rb209
-rw-r--r--lib/drb/drb.rb209
-rw-r--r--lib/drb/extserv.rb5
-rw-r--r--lib/drb/extservm.rb4
-rw-r--r--lib/drb/gw.rb74
-rw-r--r--lib/drb/ssl.rb5
-rw-r--r--lib/drb/unix.rb1
-rw-r--r--lib/erb.rb14
-rw-r--r--lib/fileutils.rb1241
-rw-r--r--lib/finalize.rb39
-rw-r--r--lib/find.rb4
-rw-r--r--lib/forwardable.rb174
-rw-r--r--lib/ftools.rb80
-rw-r--r--lib/generator.rb2
-rw-r--r--lib/getoptlong.rb187
-rw-r--r--lib/getopts.rb9
-rw-r--r--lib/gserver.rb42
-rw-r--r--lib/importenv.rb2
-rw-r--r--lib/ipaddr.rb52
-rw-r--r--lib/irb.rb18
-rw-r--r--lib/irb/cmd/chws.rb8
-rw-r--r--lib/irb/cmd/fork.rb16
-rw-r--r--lib/irb/cmd/help.rb34
-rw-r--r--lib/irb/cmd/load.rb8
-rw-r--r--lib/irb/cmd/nop.rb10
-rw-r--r--lib/irb/cmd/pushws.rb8
-rw-r--r--lib/irb/cmd/subirb.rb8
-rw-r--r--lib/irb/completion.rb33
-rw-r--r--lib/irb/context.rb45
-rw-r--r--lib/irb/ext/change-ws.rb8
-rw-r--r--lib/irb/ext/history.rb14
-rw-r--r--lib/irb/ext/loader.rb16
-rw-r--r--lib/irb/ext/math-mode.rb8
-rw-r--r--lib/irb/ext/multi-irb.rb10
-rw-r--r--lib/irb/ext/save-history.rb85
-rw-r--r--lib/irb/ext/tracer.rb8
-rw-r--r--lib/irb/ext/use-loader.rb8
-rw-r--r--lib/irb/ext/workspaces.rb8
-rw-r--r--lib/irb/extend-command.rb69
-rw-r--r--lib/irb/frame.rb4
-rw-r--r--lib/irb/help.rb6
-rw-r--r--lib/irb/init.rb94
-rw-r--r--lib/irb/input-method.rb16
-rw-r--r--lib/irb/lc/error.rb8
-rw-r--r--lib/irb/lc/help-message8
-rw-r--r--lib/irb/lc/ja/error.rb10
-rw-r--r--lib/irb/lc/ja/help-message8
-rw-r--r--lib/irb/locale.rb26
-rw-r--r--lib/irb/notifier.rb145
-rw-r--r--lib/irb/output-method.rb85
-rw-r--r--lib/irb/ruby-lex.rb150
-rw-r--r--lib/irb/ruby-token.rb10
-rw-r--r--lib/irb/slex.rb365
-rw-r--r--lib/irb/version.rb10
-rw-r--r--lib/irb/workspace.rb8
-rw-r--r--lib/irb/ws-for-case-2.rb8
-rw-r--r--lib/irb/xmp.rb6
-rw-r--r--lib/jcode.rb2
-rw-r--r--lib/logger.rb281
-rw-r--r--lib/mailread.rb14
-rw-r--r--lib/mathn.rb6
-rw-r--r--lib/mkmf.rb849
-rw-r--r--lib/monitor.rb38
-rw-r--r--lib/mutex_m.rb34
-rw-r--r--lib/net/http.rb925
-rw-r--r--lib/net/https.rb173
-rw-r--r--lib/net/imap.rb13
-rw-r--r--lib/net/pop.rb6
-rw-r--r--lib/net/protocol.rb396
-rw-r--r--lib/net/smtp.rb6
-rw-r--r--lib/net/telnet.rb4
-rw-r--r--lib/open-uri.rb436
-rw-r--r--lib/open3.rb24
-rw-r--r--lib/optparse.rb1196
-rw-r--r--lib/ostruct.rb41
-rw-r--r--lib/parsearg.rb10
-rw-r--r--lib/pathname.rb819
-rw-r--r--lib/ping.rb41
-rw-r--r--lib/pp.rb309
-rw-r--r--lib/prettyprint.rb232
-rw-r--r--lib/profiler.rb58
-rw-r--r--lib/pstore.rb227
-rw-r--r--lib/racc/parser.rb66
-rw-r--r--lib/rational.rb348
-rw-r--r--lib/rdoc/README3
-rw-r--r--lib/rdoc/diagram.rb28
-rw-r--r--lib/rdoc/generators/chm_generator.rb4
-rw-r--r--lib/rdoc/generators/html_generator.rb23
-rw-r--r--lib/rdoc/generators/ri_generator.rb2
-rw-r--r--lib/rdoc/generators/template/html/hefss.rb52
-rw-r--r--lib/rdoc/generators/template/html/html.rb6
-rw-r--r--lib/rdoc/generators/template/html/kilmer.rb62
-rw-r--r--lib/rdoc/generators/template/html/old_html.rb6
-rw-r--r--lib/rdoc/markup/.document2
-rw-r--r--lib/rdoc/markup/simple_markup.rb3
-rw-r--r--lib/rdoc/markup/simple_markup/inline.rb4
-rw-r--r--lib/rdoc/markup/simple_markup/preprocess.rb7
-rw-r--r--lib/rdoc/markup/simple_markup/to_flow.rb2
-rw-r--r--lib/rdoc/parsers/parse_c.rb246
-rw-r--r--lib/rdoc/parsers/parse_f95.rb1840
-rw-r--r--lib/rdoc/parsers/parse_rb.rb47
-rw-r--r--lib/rdoc/parsers/parse_simple.rb6
-rw-r--r--lib/rdoc/rdoc.rb2
-rw-r--r--lib/rdoc/ri/ri_descriptions.rb6
-rw-r--r--lib/rdoc/ri/ri_display.rb50
-rw-r--r--lib/rdoc/ri/ri_driver.rb20
-rw-r--r--lib/rdoc/ri/ri_formatter.rb41
-rw-r--r--lib/rdoc/ri/ri_options.rb106
-rw-r--r--lib/rdoc/ri/ri_paths.rb43
-rw-r--r--lib/rdoc/usage.rb39
-rw-r--r--lib/readbytes.rb15
-rw-r--r--lib/resolv.rb145
-rw-r--r--lib/rexml/attribute.rb6
-rw-r--r--lib/rexml/cdata.rb4
-rw-r--r--lib/rexml/comment.rb6
-rw-r--r--lib/rexml/doctype.rb433
-rw-r--r--lib/rexml/document.rb26
-rw-r--r--lib/rexml/element.rb58
-rw-r--r--lib/rexml/encoding.rb108
-rw-r--r--lib/rexml/encodings/EUC-JP.rb52
-rw-r--r--lib/rexml/encodings/ICONV.rb18
-rw-r--r--lib/rexml/encodings/ISO-8859-1.rb24
-rw-r--r--lib/rexml/encodings/SHIFT-JIS.rb54
-rw-r--r--lib/rexml/encodings/SHIFT_JIS.rb2
-rw-r--r--lib/rexml/encodings/UNILE.rb13
-rw-r--r--lib/rexml/encodings/US-ASCII.rb13
-rw-r--r--lib/rexml/encodings/UTF-16.rb13
-rw-r--r--lib/rexml/encodings/UTF-8.rb13
-rw-r--r--lib/rexml/functions.rb79
-rw-r--r--lib/rexml/instruction.rb4
-rw-r--r--lib/rexml/node.rb26
-rw-r--r--lib/rexml/parent.rb319
-rw-r--r--lib/rexml/parsers/baseparser.rb761
-rw-r--r--lib/rexml/parsers/pullparser.rb319
-rw-r--r--lib/rexml/parsers/sax2parser.rb25
-rw-r--r--lib/rexml/parsers/streamparser.rb75
-rw-r--r--lib/rexml/parsers/treeparser.rb10
-rw-r--r--lib/rexml/parsers/xpathparser.rb9
-rw-r--r--lib/rexml/rexml.rb13
-rw-r--r--lib/rexml/sax2listener.rb3
-rw-r--r--lib/rexml/source.rb27
-rw-r--r--lib/rexml/streamlistener.rb3
-rw-r--r--lib/rexml/syncenumerator.rb33
-rw-r--r--lib/rexml/text.rb546
-rw-r--r--lib/rexml/validation/validation.rb5
-rw-r--r--lib/rexml/xmldecl.rb9
-rw-r--r--lib/rexml/xpath.rb8
-rw-r--r--lib/rexml/xpath_parser.rb853
-rw-r--r--lib/rinda/rinda.rb179
-rw-r--r--lib/rinda/ring.rb113
-rw-r--r--lib/rinda/tuplespace.rb509
-rw-r--r--lib/rss.rb16
-rw-r--r--lib/rss/0.9.rb544
-rw-r--r--lib/rss/1.0.rb507
-rw-r--r--lib/rss/2.0.rb128
-rw-r--r--lib/rss/content.rb28
-rw-r--r--lib/rss/converter.rb15
-rw-r--r--lib/rss/dublincore.rb144
-rw-r--r--lib/rss/image.rb193
-rw-r--r--lib/rss/maker.rb2
-rw-r--r--lib/rss/maker/1.0.rb2
-rw-r--r--lib/rss/maker/base.rb74
-rw-r--r--lib/rss/maker/content.rb4
-rw-r--r--lib/rss/maker/dublincore.rb156
-rw-r--r--lib/rss/maker/image.rb145
-rw-r--r--lib/rss/maker/syndication.rb4
-rw-r--r--lib/rss/maker/taxonomy.rb182
-rw-r--r--lib/rss/maker/trackback.rb32
-rw-r--r--lib/rss/parser.rb198
-rw-r--r--lib/rss/rexmlparser.rb17
-rw-r--r--lib/rss/rss.rb619
-rw-r--r--lib/rss/syndication.rb53
-rw-r--r--lib/rss/taxonomy.rb149
-rw-r--r--lib/rss/trackback.rb160
-rw-r--r--lib/rss/utils.rb24
-rw-r--r--lib/rss/xml-stylesheet.rb8
-rw-r--r--lib/rss/xmlparser.rb10
-rw-r--r--lib/rss/xmlscanner.rb35
-rw-r--r--lib/scanf.rb8
-rw-r--r--lib/set.rb10
-rw-r--r--lib/shell/builtin-command.rb4
-rw-r--r--lib/shell/command-processor.rb4
-rw-r--r--lib/shell/error.rb4
-rw-r--r--lib/shell/filter.rb4
-rw-r--r--lib/shell/process-controller.rb4
-rw-r--r--lib/shell/system-command.rb4
-rw-r--r--lib/shell/version.rb4
-rw-r--r--lib/singleton.rb6
-rw-r--r--lib/soap/baseData.rb188
-rw-r--r--lib/soap/element.rb37
-rw-r--r--lib/soap/encodingstyle/aspDotNetHandler.rb45
-rw-r--r--lib/soap/encodingstyle/handler.rb8
-rw-r--r--lib/soap/encodingstyle/literalHandler.rb65
-rw-r--r--lib/soap/encodingstyle/soapHandler.rb53
-rw-r--r--lib/soap/generator.rb114
-rw-r--r--lib/soap/header/handlerset.rb12
-rw-r--r--lib/soap/header/simplehandler.rb10
-rw-r--r--lib/soap/httpconfigloader.rb119
-rw-r--r--lib/soap/mapping/factory.rb62
-rw-r--r--lib/soap/mapping/mapping.rb248
-rw-r--r--lib/soap/mapping/registry.rb165
-rw-r--r--lib/soap/mapping/rubytypeFactory.rb41
-rw-r--r--lib/soap/mapping/wsdlRegistry.rb155
-rw-r--r--lib/soap/mapping/wsdlencodedregistry.rb197
-rw-r--r--lib/soap/mapping/wsdlliteralregistry.rb371
-rw-r--r--lib/soap/marshal.rb5
-rw-r--r--lib/soap/mimemessage.rb4
-rw-r--r--lib/soap/netHttpClient.rb23
-rw-r--r--lib/soap/parser.rb11
-rw-r--r--lib/soap/rpc/cgistub.rb234
-rw-r--r--lib/soap/rpc/driver.rb350
-rw-r--r--lib/soap/rpc/element.rb119
-rw-r--r--lib/soap/rpc/httpserver.rb99
-rw-r--r--lib/soap/rpc/proxy.rb356
-rw-r--r--lib/soap/rpc/router.rb552
-rw-r--r--lib/soap/rpc/soaplet.rb220
-rw-r--r--lib/soap/soap.rb57
-rw-r--r--lib/soap/streamHandler.rb164
-rw-r--r--lib/soap/wsdlDriver.rb279
-rw-r--r--lib/sync.rb6
-rw-r--r--lib/tempfile.rb6
-rw-r--r--lib/test/unit.rb75
-rw-r--r--lib/test/unit/assertionfailederror.rb2
-rw-r--r--lib/test/unit/assertions.rb236
-rw-r--r--lib/test/unit/autorunner.rb22
-rw-r--r--lib/test/unit/collector/dir.rb5
-rw-r--r--lib/test/unit/error.rb2
-rw-r--r--lib/test/unit/failure.rb2
-rw-r--r--lib/test/unit/testcase.rb2
-rw-r--r--lib/test/unit/testresult.rb1
-rw-r--r--lib/test/unit/testsuite.rb2
-rw-r--r--lib/test/unit/ui/console/testrunner.rb2
-rw-r--r--lib/test/unit/ui/fox/testrunner.rb2
-rw-r--r--lib/test/unit/ui/gtk/testrunner.rb2
-rw-r--r--lib/test/unit/ui/gtk2/testrunner.rb2
-rw-r--r--lib/test/unit/ui/testrunnermediator.rb2
-rw-r--r--lib/test/unit/ui/testrunnerutilities.rb2
-rw-r--r--lib/test/unit/ui/tk/testrunner.rb2
-rw-r--r--lib/test/unit/util/observable.rb2
-rw-r--r--lib/test/unit/util/procwrapper.rb2
-rw-r--r--lib/thread.rb106
-rw-r--r--lib/time.rb272
-rw-r--r--lib/timeout.rb73
-rw-r--r--lib/tmpdir.rb5
-rw-r--r--lib/tracer.rb23
-rw-r--r--lib/tsort.rb151
-rw-r--r--lib/un.rb52
-rw-r--r--lib/uri.rb2
-rw-r--r--lib/uri/common.rb24
-rw-r--r--lib/uri/ftp.rb2
-rw-r--r--lib/uri/generic.rb33
-rw-r--r--lib/uri/http.rb2
-rw-r--r--lib/uri/https.rb2
-rw-r--r--lib/uri/ldap.rb2
-rw-r--r--lib/uri/mailto.rb2
-rw-r--r--lib/weakref.rb19
-rw-r--r--lib/webrick/cgi.rb44
-rw-r--r--lib/webrick/config.rb2
-rw-r--r--lib/webrick/cookie.rb24
-rw-r--r--lib/webrick/httpauth.rb2
-rw-r--r--lib/webrick/httpauth/basicauth.rb2
-rw-r--r--lib/webrick/httpauth/digestauth.rb8
-rw-r--r--lib/webrick/httpauth/htpasswd.rb10
-rw-r--r--lib/webrick/httpproxy.rb18
-rw-r--r--lib/webrick/httprequest.rb14
-rw-r--r--lib/webrick/httpserver.rb4
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb6
-rw-r--r--lib/webrick/httpservlet/filehandler.rb2
-rw-r--r--lib/webrick/httputils.rb28
-rw-r--r--lib/webrick/server.rb44
-rw-r--r--lib/webrick/ssl.rb4
-rw-r--r--lib/webrick/utils.rb16
-rw-r--r--lib/wsdl/definitions.rb26
-rw-r--r--lib/wsdl/import.rb26
-rw-r--r--lib/wsdl/importer.rb58
-rw-r--r--lib/wsdl/info.rb10
-rw-r--r--lib/wsdl/operation.rb19
-rw-r--r--lib/wsdl/operationBinding.rb30
-rw-r--r--lib/wsdl/param.rb13
-rw-r--r--lib/wsdl/parser.rb35
-rw-r--r--lib/wsdl/port.rb2
-rw-r--r--lib/wsdl/portType.rb3
-rw-r--r--lib/wsdl/soap/body.rb6
-rw-r--r--lib/wsdl/soap/cgiStubCreator.rb22
-rw-r--r--lib/wsdl/soap/classDefCreator.rb268
-rw-r--r--lib/wsdl/soap/classDefCreatorSupport.rb6
-rw-r--r--lib/wsdl/soap/clientSkeltonCreator.rb4
-rw-r--r--lib/wsdl/soap/complexType.rb64
-rw-r--r--lib/wsdl/soap/definitions.rb39
-rw-r--r--lib/wsdl/soap/driverCreator.rb30
-rw-r--r--lib/wsdl/soap/element.rb6
-rw-r--r--lib/wsdl/soap/fault.rb4
-rw-r--r--lib/wsdl/soap/header.rb13
-rw-r--r--lib/wsdl/soap/mappingRegistryCreator.rb16
-rw-r--r--lib/wsdl/soap/methodDefCreator.rb163
-rw-r--r--lib/wsdl/soap/operation.rb6
-rw-r--r--lib/wsdl/soap/servantSkeltonCreator.rb8
-rw-r--r--lib/wsdl/soap/standaloneServerStubCreator.rb24
-rw-r--r--lib/wsdl/soap/wsdl2ruby.rb176
-rw-r--r--lib/wsdl/xmlSchema/all.rb4
-rw-r--r--lib/wsdl/xmlSchema/annotation.rb34
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb72
-rw-r--r--lib/wsdl/xmlSchema/choice.rb4
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb9
-rw-r--r--lib/wsdl/xmlSchema/complexType.rb8
-rw-r--r--lib/wsdl/xmlSchema/data.rb11
-rw-r--r--lib/wsdl/xmlSchema/element.rb95
-rw-r--r--lib/wsdl/xmlSchema/import.rb25
-rw-r--r--lib/wsdl/xmlSchema/importer.rb87
-rw-r--r--lib/wsdl/xmlSchema/include.rb54
-rw-r--r--lib/wsdl/xmlSchema/length.rb35
-rw-r--r--lib/wsdl/xmlSchema/parser.rb39
-rw-r--r--lib/wsdl/xmlSchema/pattern.rb36
-rw-r--r--lib/wsdl/xmlSchema/schema.rb41
-rw-r--r--lib/wsdl/xmlSchema/sequence.rb4
-rw-r--r--lib/wsdl/xmlSchema/simpleContent.rb56
-rw-r--r--lib/wsdl/xmlSchema/simpleExtension.rb54
-rw-r--r--lib/wsdl/xmlSchema/simpleRestriction.rb29
-rw-r--r--lib/wsdl/xmlSchema/simpleType.rb12
-rw-r--r--lib/wsdl/xmlSchema/xsd2ruby.rb107
-rw-r--r--lib/xmlrpc/.document1
-rw-r--r--lib/xmlrpc/base64.rb2
-rw-r--r--lib/xmlrpc/client.rb31
-rw-r--r--lib/xmlrpc/config.rb2
-rw-r--r--lib/xmlrpc/create.rb26
-rw-r--r--lib/xmlrpc/datetime.rb6
-rw-r--r--lib/xmlrpc/httpserver.rb2
-rw-r--r--lib/xmlrpc/marshal.rb2
-rw-r--r--lib/xmlrpc/parser.rb83
-rw-r--r--lib/xmlrpc/server.rb161
-rw-r--r--lib/xmlrpc/utils.rb11
-rw-r--r--lib/xsd/charset.rb78
-rw-r--r--lib/xsd/codegen/classdef.rb2
-rw-r--r--lib/xsd/codegen/commentdef.rb4
-rw-r--r--lib/xsd/codegen/gensupport.rb76
-rw-r--r--lib/xsd/codegen/methoddef.rb2
-rw-r--r--lib/xsd/codegen/moduledef.rb2
-rw-r--r--lib/xsd/datatypes.rb40
-rw-r--r--lib/xsd/iconvcharset.rb2
-rw-r--r--lib/xsd/mapping.rb42
-rw-r--r--lib/xsd/namedelements.rb14
-rw-r--r--lib/xsd/ns.rb20
-rw-r--r--lib/xsd/qname.rb13
-rw-r--r--lib/xsd/xmlparser.rb2
-rw-r--r--lib/xsd/xmlparser/xmlscanner.rb6
-rw-r--r--lib/yaml.rb121
-rw-r--r--lib/yaml/basenode.rb20
-rw-r--r--lib/yaml/emitter.rb107
-rw-r--r--lib/yaml/error.rb1
-rw-r--r--lib/yaml/rubytypes.rb777
-rw-r--r--lib/yaml/stream.rb18
-rw-r--r--lib/yaml/syck.rb8
-rw-r--r--lib/yaml/tag.rb91
-rw-r--r--lib/yaml/types.rb220
-rw-r--r--main.c4
-rw-r--r--marshal.c10
-rw-r--r--math.c57
-rwxr-xr-xmdoc2man.rb2
-rw-r--r--misc/inf-ruby.el10
-rw-r--r--misc/ruby-electric.el200
-rw-r--r--misc/ruby-mode.el33
-rw-r--r--missing.h15
-rw-r--r--missing/acosh.c4
-rw-r--r--missing/crypt.c1162
-rw-r--r--missing/erf.c3
-rw-r--r--missing/isinf.c1
-rw-r--r--missing/mkdir.c104
-rw-r--r--missing/strchr.c4
-rw-r--r--missing/strtod.c2
-rw-r--r--missing/vsnprintf.c17
-rw-r--r--mkconfig.rb101
-rw-r--r--node.h32
-rw-r--r--numeric.c64
-rw-r--r--object.c173
-rw-r--r--pack.c69
-rw-r--r--parse.y368
-rw-r--r--prec.c8
-rw-r--r--process.c600
-rw-r--r--random.c282
-rw-r--r--range.c19
-rw-r--r--re.c47
-rw-r--r--re.h4
-rw-r--r--regex.c31
-rw-r--r--ruby.15
-rw-r--r--ruby.c163
-rw-r--r--ruby.h64
-rw-r--r--rubyio.h9
-rw-r--r--rubysig.h23
-rw-r--r--rubytest.rb11
-rwxr-xr-xrunruby.rb59
-rw-r--r--sample/biorhythm.rb4
-rw-r--r--sample/openssl/cipher.rb12
-rwxr-xr-xsample/rss/blend.rb7
-rwxr-xr-xsample/rss/convert.rb69
-rw-r--r--sample/rss/list_description.rb4
-rwxr-xr-xsample/rss/re_read.rb64
-rw-r--r--sample/rss/rss_recent.rb4
-rw-r--r--sample/rss/tdiary_plugin/rss-recent.rb213
-rw-r--r--sample/soap/authheader/authmgr.rb41
-rw-r--r--sample/soap/authheader/client.rb40
-rw-r--r--sample/soap/authheader/client2.rb42
-rw-r--r--sample/soap/authheader/server.rb73
-rw-r--r--sample/soap/authheader/server2.rb83
-rw-r--r--sample/soap/babelfish.rb16
-rw-r--r--sample/soap/calc/calc.rb17
-rw-r--r--sample/soap/calc/calc2.rb29
-rw-r--r--sample/soap/calc/client.rb26
-rw-r--r--sample/soap/calc/client2.rb29
-rw-r--r--sample/soap/calc/httpd.rb20
-rw-r--r--sample/soap/calc/samplehttpd.conf2
-rw-r--r--sample/soap/calc/server.cgi15
-rw-r--r--sample/soap/calc/server.rb21
-rw-r--r--sample/soap/calc/server2.rb24
-rw-r--r--sample/soap/digraph.rb43
-rw-r--r--sample/soap/exchange/client.rb19
-rw-r--r--sample/soap/exchange/exchange.rb17
-rw-r--r--sample/soap/exchange/httpd.rb20
-rw-r--r--sample/soap/exchange/samplehttpd.conf2
-rw-r--r--sample/soap/exchange/server.cgi14
-rw-r--r--sample/soap/exchange/server.rb16
-rw-r--r--sample/soap/helloworld/hw_c.rb6
-rw-r--r--sample/soap/helloworld/hw_c_gzip.rb8
-rw-r--r--sample/soap/helloworld/hw_s.rb20
-rw-r--r--sample/soap/helloworld/hw_s_gzip.rb21
-rw-r--r--sample/soap/icd/IICD.rb17
-rw-r--r--sample/soap/icd/icd.rb46
-rw-r--r--sample/soap/raa/iRAA.rb154
-rw-r--r--sample/soap/raa/soap4r.rb30
-rw-r--r--sample/soap/raa2.4/raa.rb332
-rw-r--r--sample/soap/raa2.4/raaDriver.rb255
-rw-r--r--sample/soap/raa2.4/raaServiceClient.rb354
-rw-r--r--sample/soap/raa2.4/sample.rb115
-rw-r--r--sample/soap/sampleStruct/client.rb16
-rw-r--r--sample/soap/sampleStruct/httpd.rb20
-rw-r--r--sample/soap/sampleStruct/iSampleStruct.rb22
-rw-r--r--sample/soap/sampleStruct/sampleStruct.rb13
-rw-r--r--sample/soap/sampleStruct/samplehttpd.conf2
-rw-r--r--sample/soap/sampleStruct/server.cgi14
-rw-r--r--sample/soap/sampleStruct/server.rb20
-rw-r--r--sample/soap/scopesample/client.rb34
-rw-r--r--sample/soap/scopesample/httpd.rb22
-rw-r--r--sample/soap/scopesample/samplehttpd.conf2
-rw-r--r--sample/soap/scopesample/servant.rb18
-rwxr-xr-xsample/soap/scopesample/server.cgi29
-rw-r--r--sample/soap/scopesample/server.rb20
-rw-r--r--sample/soap/ssl/files/README1
-rw-r--r--sample/soap/ssl/files/ca.cert23
-rw-r--r--sample/soap/ssl/files/client.cert19
-rw-r--r--sample/soap/ssl/files/client.key15
-rw-r--r--sample/soap/ssl/files/server.cert19
-rw-r--r--sample/soap/ssl/files/server.key15
-rw-r--r--sample/soap/ssl/files/sslclient.properties5
-rw-r--r--sample/soap/ssl/files/sslclient_require_noserverauth.properties2
-rw-r--r--sample/soap/ssl/files/sslclient_with_clientauth.properties9
-rw-r--r--sample/soap/ssl/files/subca.cert21
-rw-r--r--sample/soap/ssl/sslclient.rb12
-rw-r--r--sample/soap/ssl/sslclient_require_noserverauth.rb12
-rw-r--r--sample/soap/ssl/sslclient_with_clientauth.rb12
-rw-r--r--sample/soap/ssl/sslserver.rb49
-rw-r--r--sample/soap/ssl/sslserver_noauth.rb45
-rw-r--r--sample/soap/ssl/sslserver_require_clientauth.rb50
-rw-r--r--sample/soap/swa/client.rb13
-rw-r--r--sample/soap/swa/server.rb23
-rw-r--r--sample/soap/whois.rb14
-rw-r--r--sample/svr.rb8
-rw-r--r--sample/test.rb4
-rw-r--r--sample/webrick/httpproxy.rb26
-rw-r--r--sample/webrick/httpsd.rb4
-rw-r--r--sample/wsdl/amazon/AmazonSearch.rb3057
-rw-r--r--sample/wsdl/amazon/AmazonSearchDriver.rb536
-rw-r--r--sample/wsdl/amazon/sampleClient.rb37
-rw-r--r--sample/wsdl/amazon/wsdlDriver.rb52
-rw-r--r--sample/wsdl/googleSearch/GoogleSearch.rb258
-rw-r--r--sample/wsdl/googleSearch/GoogleSearchDriver.rb101
-rw-r--r--sample/wsdl/googleSearch/README6
-rw-r--r--sample/wsdl/googleSearch/httpd.rb20
-rw-r--r--sample/wsdl/googleSearch/sampleClient.rb56
-rw-r--r--sample/wsdl/googleSearch/samplehttpd.conf2
-rw-r--r--sample/wsdl/googleSearch/sjissearch.sh3
-rw-r--r--sample/wsdl/googleSearch/wsdlDriver.rb23
-rw-r--r--sample/wsdl/raa/raa.wsdl264
-rw-r--r--sample/wsdl/raa/soap4r.rb31
-rw-r--r--sample/wsdl/raa2.4/raa.rb332
-rw-r--r--sample/wsdl/raa2.4/wsdlDriver.rb117
-rw-r--r--signal.c152
-rw-r--r--sprintf.c95
-rw-r--r--st.c37
-rw-r--r--st.h9
-rw-r--r--string.c96
-rw-r--r--struct.c58
-rw-r--r--test/dbm/test_dbm.rb495
-rw-r--r--test/digest/test_digest.rb141
-rw-r--r--test/drb/drbtest.rb64
-rw-r--r--test/drb/ignore_test_drb.rb24
-rw-r--r--test/drb/test_drb.rb54
-rw-r--r--test/drb/test_drbssl.rb20
-rw-r--r--test/drb/test_drbunix.rb19
-rw-r--r--test/drb/ut_drb.rb15
-rw-r--r--test/drb/ut_eval.rb10
-rw-r--r--test/drb/ut_safe1.rb5
-rw-r--r--test/fileutils/fileasserts.rb34
-rw-r--r--test/fileutils/test_dryrun.rb25
-rw-r--r--test/fileutils/test_fileutils.rb585
-rw-r--r--test/fileutils/test_nowrite.rb28
-rw-r--r--test/fileutils/test_verbose.rb25
-rw-r--r--test/gdbm/test_gdbm.rb644
-rw-r--r--test/logger/test_logger.rb112
-rw-r--r--test/net/http/test_httpheader.rb317
-rw-r--r--test/net/http/test_https_proxy.rb30
-rw-r--r--test/nkf/test_kconv.rb71
-rw-r--r--test/nkf/test_nkf.rb16
-rw-r--r--test/openssl/ssl_server.rb2
-rw-r--r--test/openssl/test_cipher.rb43
-rw-r--r--test/openssl/test_digest.rb23
-rw-r--r--test/openssl/test_ns_spki.rb59
-rw-r--r--test/openssl/test_pair.rb144
-rw-r--r--test/openssl/test_pkcs7.rb154
-rw-r--r--test/openssl/test_pkey_rsa.rb11
-rw-r--r--test/openssl/test_ssl.rb87
-rw-r--r--test/openssl/test_x509ext.rb74
-rw-r--r--test/openssl/test_x509store.rb57
-rw-r--r--test/pathname/test_pathname.rb486
-rw-r--r--test/readline/test_readline.rb27
-rw-r--r--test/rinda/test_rinda.rb144
-rw-r--r--test/rss/rss-assertions.rb93
-rw-r--r--test/rss/rss-testcase.rb50
-rw-r--r--test/rss/test_1.0.rb54
-rw-r--r--test/rss/test_2.0.rb390
-rw-r--r--test/rss/test_accessor.rb83
-rw-r--r--test/rss/test_content.rb9
-rw-r--r--test/rss/test_dublincore.rb95
-rw-r--r--test/rss/test_image.rb191
-rw-r--r--test/rss/test_inherit.rb41
-rw-r--r--test/rss/test_maker_0.9.rb58
-rw-r--r--test/rss/test_maker_1.0.rb100
-rw-r--r--test/rss/test_maker_2.0.rb92
-rw-r--r--test/rss/test_maker_dc.rb78
-rw-r--r--test/rss/test_maker_image.rb62
-rw-r--r--test/rss/test_maker_sy.rb2
-rw-r--r--test/rss/test_maker_taxo.rb81
-rw-r--r--test/rss/test_maker_trackback.rb5
-rw-r--r--test/rss/test_maker_xml-stylesheet.rb42
-rw-r--r--test/rss/test_parser.rb615
-rw-r--r--test/rss/test_parser_1.0.rb503
-rw-r--r--test/rss/test_parser_2.0.rb122
-rw-r--r--test/rss/test_setup_maker_0.9.rb64
-rw-r--r--test/rss/test_setup_maker_1.0.rb318
-rw-r--r--test/rss/test_setup_maker_2.0.rb113
-rw-r--r--test/rss/test_syndication.rb20
-rw-r--r--test/rss/test_taxonomy.rb160
-rw-r--r--test/rss/test_to_s.rb10
-rw-r--r--test/rss/test_trackback.rb22
-rw-r--r--test/rss/test_version.rb2
-rw-r--r--test/ruby/envutil.rb15
-rw-r--r--test/ruby/test_array.rb44
-rw-r--r--test/ruby/test_dir.rb42
-rw-r--r--test/ruby/test_env.rb10
-rw-r--r--test/ruby/test_file.rb38
-rw-r--r--test/ruby/test_float.rb42
-rw-r--r--test/ruby/test_iterator.rb14
-rw-r--r--test/ruby/test_method.rb42
-rw-r--r--test/ruby/test_objectspace.rb36
-rw-r--r--test/ruby/test_pack.rb3
-rw-r--r--test/ruby/test_path.rb178
-rw-r--r--test/ruby/test_process.rb41
-rw-r--r--test/ruby/test_rand.rb131
-rw-r--r--test/ruby/test_range.rb6
-rw-r--r--test/ruby/test_readpartial.rb74
-rw-r--r--test/ruby/test_settracefunc.rb136
-rw-r--r--test/ruby/test_signal.rb43
-rw-r--r--test/ruby/test_super.rb117
-rw-r--r--test/ruby/test_symbol.rb77
-rw-r--r--test/ruby/ut_eof.rb13
-rw-r--r--test/runner.rb4
-rw-r--r--test/soap/asp.net/hello.wsdl96
-rw-r--r--test/soap/asp.net/test_aspdotnet.rb111
-rw-r--r--test/soap/calc/calc2.rb4
-rw-r--r--test/soap/calc/server2.rb4
-rw-r--r--test/soap/calc/test_calc.rb7
-rw-r--r--test/soap/calc/test_calc2.rb13
-rw-r--r--test/soap/calc/test_calc_cgi.rb7
-rw-r--r--test/soap/fault/test_customfault.rb58
-rw-r--r--test/soap/header/server.cgi8
-rw-r--r--test/soap/header/test_authheader.rb9
-rw-r--r--test/soap/header/test_authheader_cgi.rb7
-rw-r--r--test/soap/header/test_simplehandler.rb116
-rw-r--r--test/soap/helloworld/test_helloworld.rb7
-rw-r--r--test/soap/ssl/sslsvr.rb7
-rw-r--r--test/soap/ssl/test_ssl.rb99
-rw-r--r--test/soap/struct/test_struct.rb8
-rw-r--r--test/soap/swa/test_file.rb12
-rw-r--r--test/soap/test_basetype.rb6
-rw-r--r--test/soap/test_envelopenamespace.rb92
-rw-r--r--test/soap/test_httpconfigloader.rb39
-rw-r--r--test/soap/test_mapping.rb59
-rw-r--r--test/soap/test_no_indent.rb86
-rw-r--r--test/soap/test_soapelement.rb3
-rw-r--r--test/soap/test_streamhandler.rb22
-rw-r--r--test/soap/test_styleuse.rb333
-rw-r--r--test/soap/wsdlDriver/calc.wsdl126
-rw-r--r--test/soap/wsdlDriver/document.wsdl54
-rw-r--r--test/soap/wsdlDriver/simpletype.wsdl6
-rw-r--r--test/soap/wsdlDriver/test_calc.rb100
-rw-r--r--test/soap/wsdlDriver/test_document.rb78
-rw-r--r--test/soap/wsdlDriver/test_simpletype.rb15
-rw-r--r--test/socket/test_nonblock.rb179
-rw-r--r--test/socket/test_socket.rb83
-rw-r--r--test/socket/test_unix.rb141
-rw-r--r--test/strscan/test_stringscanner.rb71
-rw-r--r--test/uri/test_generic.rb17
-rw-r--r--test/webrick/test_cgi.rb78
-rw-r--r--test/webrick/test_cookie.rb73
-rw-r--r--test/webrick/test_filehandler.rb65
-rw-r--r--test/webrick/test_httpauth.rb82
-rw-r--r--test/webrick/test_httprequest.rb272
-rw-r--r--test/webrick/test_httpserver.rb260
-rw-r--r--test/webrick/test_httputils.rb96
-rw-r--r--test/webrick/test_httpversion.rb40
-rw-r--r--test/webrick/test_server.rb64
-rw-r--r--test/webrick/utils.rb40
-rw-r--r--test/webrick/webrick.cgi36
-rw-r--r--test/wsdl/any/any.wsdl50
-rw-r--r--test/wsdl/any/expectedDriver.rb54
-rw-r--r--test/wsdl/any/expectedEcho.rb14
-rw-r--r--test/wsdl/any/expectedService.rb52
-rw-r--r--test/wsdl/any/test_any.rb58
-rw-r--r--test/wsdl/datetime/DatetimeService.rb42
-rw-r--r--test/wsdl/datetime/test_datetime.rb10
-rw-r--r--test/wsdl/document/document.wsdl74
-rw-r--r--test/wsdl/document/echo.rb92
-rw-r--r--test/wsdl/document/number.wsdl54
-rw-r--r--test/wsdl/document/ping_nosoapaction.wsdl66
-rw-r--r--test/wsdl/document/test_nosoapaction.rb109
-rw-r--r--test/wsdl/document/test_number.rb99
-rw-r--r--test/wsdl/document/test_rpc.rb177
-rw-r--r--test/wsdl/map/test_map.rb11
-rw-r--r--test/wsdl/marshal/person.wsdl21
-rw-r--r--test/wsdl/marshal/person_org.rb22
-rw-r--r--test/wsdl/marshal/test_wsdlmarshal.rb80
-rw-r--r--test/wsdl/qualified/lp.rb0
-rw-r--r--test/wsdl/qualified/lp.wsdl47
-rw-r--r--test/wsdl/qualified/lp.xsd26
-rw-r--r--test/wsdl/qualified/np.wsdl50
-rw-r--r--test/wsdl/qualified/test_qualified.rb154
-rw-r--r--test/wsdl/qualified/test_unqualified.rb143
-rw-r--r--test/wsdl/raa/RAAService.rb3
-rw-r--r--test/wsdl/raa/server.rb103
-rw-r--r--test/wsdl/raa/test_raa.rb9
-rw-r--r--test/wsdl/ref/expectedProduct.rb90
-rw-r--r--test/wsdl/ref/product.wsdl86
-rw-r--r--test/wsdl/ref/test_ref.rb54
-rw-r--r--test/wsdl/rpc/echoDriver.rb55
-rw-r--r--test/wsdl/rpc/echo_serviceClient.rb23
-rw-r--r--test/wsdl/rpc/rpc.wsdl75
-rw-r--r--test/wsdl/rpc/test-rpc-lit.wsdl364
-rw-r--r--test/wsdl/rpc/test-rpc-lit12.wsdl455
-rw-r--r--test/wsdl/rpc/test_rpc.rb118
-rw-r--r--test/wsdl/rpc/test_rpc_lit.rb399
-rw-r--r--test/wsdl/simpletype/rpc/expectedClient.rb34
-rw-r--r--test/wsdl/simpletype/rpc/expectedDriver.rb62
-rw-r--r--test/wsdl/simpletype/rpc/expectedEchoVersion.rb23
-rw-r--r--test/wsdl/simpletype/rpc/expectedServant.rb32
-rw-r--r--test/wsdl/simpletype/rpc/expectedService.rb60
-rw-r--r--test/wsdl/simpletype/rpc/rpc.wsdl80
-rw-r--r--test/wsdl/simpletype/rpc/test_rpc.rb62
-rw-r--r--test/wsdl/simpletype/simpletype.wsdl38
-rw-r--r--test/wsdl/simpletype/test_simpletype.rb42
-rw-r--r--test/wsdl/soap/test_soapbodyparts.rb27
-rw-r--r--test/xmlrpc/data/bug_bool.expected3
-rw-r--r--test/xmlrpc/data/bug_bool.xml8
-rw-r--r--test/xmlrpc/data/bug_cdata.expected3
-rw-r--r--test/xmlrpc/data/bug_cdata.xml8
-rw-r--r--test/xmlrpc/data/bug_covert.expected10
-rw-r--r--test/xmlrpc/data/bug_covert.xml6
-rw-r--r--test/xmlrpc/data/datetime_iso8601.xml8
-rw-r--r--test/xmlrpc/data/fault.xml16
-rw-r--r--test/xmlrpc/data/value.expected7
-rw-r--r--test/xmlrpc/data/value.xml22
-rw-r--r--test/xmlrpc/data/xml1.expected243
-rw-r--r--test/xmlrpc/data/xml1.xml1
-rw-r--r--test/xmlrpc/test_datetime.rb159
-rw-r--r--test/xmlrpc/test_features.rb48
-rw-r--r--test/xmlrpc/test_marshal.rb93
-rw-r--r--test/xmlrpc/test_parser.rb85
-rw-r--r--test/xmlrpc/test_webrick_server.rb98
-rw-r--r--test/xmlrpc/webrick_testing.rb37
-rw-r--r--test/xsd/codegen/test_classdef.rb214
-rw-r--r--test/xsd/test_xsd.rb6
-rw-r--r--test/yaml/test_yaml.rb84
-rw-r--r--time.c80
-rw-r--r--util.c111
-rw-r--r--util.h5
-rw-r--r--variable.c45
-rw-r--r--version.c9
-rw-r--r--version.h18
-rw-r--r--vms/config.h3
-rw-r--r--win32/Makefile.sub504
-rwxr-xr-xwin32/configure.bat66
-rwxr-xr-xwin32/ifchange.bat32
-rwxr-xr-xwin32/rm.bat8
-rw-r--r--win32/setup.mak98
-rw-r--r--win32/win32.c825
-rw-r--r--win32/win32.h89
-rw-r--r--wince/Makefile.sub481
-rw-r--r--[-rwxr-xr-x]wince/configure.bat161
-rw-r--r--wince/setup.mak16
-rw-r--r--wince/sys/types.h7
-rw-r--r--x68/_dtos18.c2
-rw-r--r--x68/_round.c2
-rw-r--r--x68/fconvert.c2
-rw-r--r--x68/select.c2
1472 files changed, 39906 insertions, 113519 deletions
diff --git a/.cvsignore b/.cvsignore
index 9fd96ca149..52a5620133 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -5,10 +5,6 @@
*~
.ccmalloc
.ppack
-.ext
-.git
-.svn
-.rbconfig.time
COPYING.LIB
ChangeLog.pre-alpha
ChangeLog.pre1_1
diff --git a/COPYING b/COPYING
index 9043404a83..870a5f22d6 100644
--- a/COPYING
+++ b/COPYING
@@ -1,6 +1,6 @@
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the GPL
-version 2 (see the file GPL), or the conditions below:
+(see the file GPL), or the conditions below:
1. You may make and give away verbatim copies of the source form of the
software without restriction, provided that you duplicate all of the
diff --git a/ChangeLog b/ChangeLog
index f141f91fdf..78755343f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7571 +1,3 @@
-Sat Mar 3 21:41:31 2007 Akinori MUSHA <knu@iDaemons.org>
-
- * eval.c (stack_check): Unset inline to fix build with GCC 3.4.6;
- submitted by: NISHIMATSU Takeshi <t_nissie AT yahoo.co.jp> in
- [ruby-list:43218].
- cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24556
-
-Sat Mar 3 16:30:39 2007 Akinori MUSHA <knu@iDaemons.org>
-
- * env.h (SCOPE_CLONE): Introduce a new scope flag to prevent a
- local_tbl region from getting freed many times; submitted by
- Chikanaga Tomoyuki <chikanag AT nippon-control-system.co.jp> in
- [ruby-dev:30460].
-
- * eval.c (proc_invoke): Ditto.
-
- * gc.c (obj_free): Ditto.
-
- * parse.y (top_local_setup_gen): Ditto.
-
-Sat Mar 3 15:41:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (stmt, arg): should not omit lhs of OP_ASGN1 even if
- empty. [ruby-dev:30452]
-
-Wed Feb 28 20:51:32 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * pack.c (pack_unpack): properly ignore non-base64 octets such as
- UTF-8 encoded BOMs; submitted by SOUMA Yutaka <holon@radastery.jp>
- to fix [ruby-core:10437]
-
-Wed Feb 28 00:08:11 2007 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
-
- * mkconfig.rb (RbConfig): add CONFIG['PATCHLEVEL']
-
- * common.mk: new target dist
-
- * distruby.rb: new file
-
-Tue Feb 27 21:19:35 2007 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
- workaround. [ruby-core:10259]
-
- * win32/win32.c (NtInitialize): call above function.
-
-Mon Feb 26 09:57:58 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * signal.c (ruby_signal): don't set SA_RESTART. a backport from
- the HEAD. [ruby-talk:220937] [ruby-talk:147220]
-
-Tue Feb 13 02:21:12 2007 Sam Roberts <sroberts@uniserve.com>
-
- * io.c (rb_f_syscall): Fix buffer overflow with syscall
- arguments. [ruby-bugs:PR#8541]
-
-Sat Feb 10 09:33:47 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_variant2val): sorry, fix the enbug.
-
-Sat Feb 10 09:08:01 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_variant2val): fix compile error
- on VC++.
-
-Sat Feb 10 08:38:30 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_variant2val): fix the bug when
- SAFEARRAY pointer is NULL.
-
-Tue Feb 6 20:41:39 2007 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * string.c (rb_str_sub_bang): calling rb_str_modify() should be just
- before actually modifying the string.
- fixed: [ruby-dev:30211] (originally reported by zunda)
-
-Sat Jan 27 15:20:11 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (dyna_var_lookup): should not alter dvar->val not to
- destroy living value. [ruby-core:10076]
-
- * parse.y (dyna_init): ditto.
-
-Wed Jan 24 18:05:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): fix
- regexp font-lock bug. [ruby-talk:235758]
-
-Sun Jan 14 07:26:44 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_free, ole_type_free,
- olemethod_free, olevariable_free, oleparam_free,
- ole_event_free): fix memory leak. [ruby-core:09846]
-
-Tue Jan 9 12:29:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (etc_getpwuid, etc_getgrgid): fix to correctly
- convert uid/gid from VALUE.
-
- * ext/etc/etc.c (etc_getpwuid): ditto.
-
-Mon Dec 25 20:08:28 2006 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * ext/openssl/ossl.h: fixed compilation problem on gcc 3.2.
- [ruby-talk:214786]
-
-Mon Dec 25 10:40:40 2006 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * stable version 1.8.5-p12 released.
-
-Sat Dec 16 04:02:10 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c: shouldn't run the killed thread at callback.
- [ruby-talk: 227408]
-
-Fri Dec 15 17:21:14 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rdoc/ri/ri_options.rb: prevent NameError. [ruby-dev:29597]
-
-Thu Dec 14 23:37:38 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): get rid of possible memory leak.
-
- * win32/win32.c (cmdglob, rb_w32_cmdvector, rb_w32_opendir,
- rb_w32_get_environ): not to use GC before initialization.
-
-Wed Dec 6 19:53:41 2006 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * configure.in (SITE_DIR): fixed to emtpy RUBY_SITE_LIB in config.h on
- NetBSD. fixed: [ruby-dev:29358]
-
-Mon Dec 4 10:43:46 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (dyna_init_gen): dvar initialization only if dvar is
- assigned inner block. [ruby-talk:227402]
-
-Mon Dec 4 10:22:26 2006 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
-
- * stable version 1.8.5-p2 released.
-
-Sun Dec 3 17:11:12 2006 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/cgi.rb (CGI::QueryExtension::read_multipart): should quote
- boundary. JVN#84798830
-
-Sun Nov 26 16:36:46 2006 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * version.h: addition of RUBY_PATCHLEVEL.
- * version.c: ditto.
-
-Fri Nov 24 10:17:51 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bignum.c (bignorm): avoid segmentation. a patch from Hiroyuki
- Ito <ZXB01226@nifty.com>. [ruby-list:43012]
-
-Thu Nov 2 15:43:39 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * parse.y (primary): should set NODE even when compstmt is NULL.
- merge from trunk. fixed: [ruby-dev:29732]
-
-Sat Sep 23 21:34:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi.rb (CGI::QueryExtension::read_multipart): CGI content
- may be empty. a patch from Jamis Buck <jamis at 37signals.com>.
-
-Mon Sep 4 21:43:57 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dbm/extconf.rb: create makefile according to the result of check
- for dbm header. fixed: [ruby-dev:29445]
-
-Tue Aug 29 19:10:10 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_s_create): fixed memory leak, based on the patch
- by Kent Sibilev <ksruby at gmail.com>. fixed: [ruby-talk:211233]
-
-Fri Aug 25 17:15:17 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * stable version 1.8.5 released.
-
-Fri Aug 25 17:02:06 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * gc.c (gc_sweep): typo fixed.
-
-Tue Aug 22 18:47:51 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::handle_method):
- rdoc documents C module methods as instance methods. a patch in
- [ruby-core:08536].
-
-Sat Aug 19 14:15:02 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (config.status): include winsock2.h instead of
- winsock.h when --with-winsock2 is specified.
- fixed: [ruby-dev:29296]
-
-Sat Aug 19 11:28:08 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_s_rename): use errno if set properly.
- fixed: [ruby-dev:29293]
-
-Sat Aug 19 11:09:23 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (then): remove semicolon warning. [ruby-dev:29299]
-
-Thu Aug 17 19:15:16 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_stat_[rRwWxX]): check for super user.
- fixed: [ruby-core:08616]
-
-Thu Aug 17 14:47:06 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb: added rdoc by Daniel Berger. [ruby-core:08177]
-
-Thu Aug 17 00:39:05 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/rinda/ring.rb (do_reply): Fix for RingServer fails to find a
- TupleSpace when TupleSpace resides in the same ruby process with
- RingServer. a patch from Kent Sibilev. [ruby-core:08453]
-
-Wed Aug 16 11:45:36 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (proc_setuid, proc_setgid, proc_seteuid, proc_setegid):
- get rid of bogus implementations on Mac OS X.
-
-Tue Aug 15 19:10:18 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#find_class_comment): Fix
- broken class-level documentation.
-
-Wed Aug 16 11:09:26 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (set_arg0): fill argv other than the first with an empty
- string instead of NULL.
-
-Wed Aug 16 11:08:00 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.h: removed an excess macro. fixed: [ruby-dev:29258]
-
-Tue Aug 8 23:49:06 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/irb/extend-command.rb (IRB::ExtendCommandBundle): pacify
- RDoc. a patch from Eric Hodel <drbrain at segment7.net>.
- [ruby-core:08522]
-
-Tue Aug 8 11:32:54 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * Makefile.in, common.mk, configure.in: fix for platforms without
- rm. patches from Yutaka kanemoto <kinpoco at gmail.com>.
- [ruby-dev:29215]
-
-Mon Aug 7 17:56:59 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c, ext/digest/rmd160/rmd160ossl.c,
- ext/digest/sha1/sha1ossl.c, ext/readline/readline.c: move
- incluion of config.h to pacify AIX. a patch from Yutaka
- Kanemoto <kinpoco at gmail.com>. [ruby-dev:29197]
-
-Mon Aug 7 15:55:08 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/syck/syck.c (syck_move_tokens): should avoid negative
- memmove. [ruby-list:42625]
-
-Mon Aug 7 14:37:48 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * configure.in, common.mk: AIX link issue. a patch from Yutaka
- Kanemoto <kinpoco at gmail.com>. [ruby-dev:29190]
-
- * ext/socket/socket.c: AIX socket support. [ruby-dev:29190]
-
-Mon Aug 7 12:05:28 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * dln.c, eval.c, gc.c, regex.c, ruby.h: shut up AIX alloca
- warning. a patch from Yutaka Kanemoto <kinpoco at gmail.com>.
- [ruby-dev:29191]
-
-Sun Aug 6 20:40:41 2006 Tadayoshi Funaba <tadf@dotrb.org>
-
- * lib/date/format.rb (str[fp]time): %[EO]U didn't denote %U.
-
-Sat Aug 5 17:07:43 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (top_local_setup): local_vars[-1] should point
- ruby_scope itself to protect local_tbl from garbage collection.
- [ruby-dev:29049]
-
-Sat Aug 5 13:54:03 2006 Tadayoshi Funaba <tadf@dotrb.org>
-
- * lib/date/format.rb (str[fp]time): "%\n" means "\n".
-
-Fri Aug 4 15:21:00 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib: Merge RDoc and .document from HEAD.
- * lib/drb/ssl.rb: Close socket on SSLError [ruby-core:7197]
-
-Fri Aug 4 19:13:41 2006 Keiju Ishitsuka <keiju@ruby-lang.org>
-
- * lib/irb/{init.rb,ruby-lex.rb,slex.rb}: can't input '\c' for
- [ruby-core: 7122].
-
-Fri Aug 4 14:02:14 2006 James Edward Gray II <james@grayproductions.net>
-
- * lib/date/format.rb (__strptime, strftime): allow multi-line patterns
- in Date#strftime the same as Time#strftime accepts.
- fixed: [ruby-core:08466]
-
-Fri Aug 4 13:56:51 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * pack.c (pack_pack): check argument overrun for 'P'. based on a
- patch by rucila <rucila at yahoo.cojp>. fixed: [ruby-dev:29182]
-
-Tue Aug 1 17:44:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (init_stdhandle): assign standard file handles.
-
-Tue Aug 1 12:24:58 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (Init_Binding): fix old commit miss.
-
-Mon Jul 31 17:08:20 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (exit_handler): new function; release winsock and
- environment work area.
-
- * win32/win32.c (NTInitialize): setup exit_handler.
-
- * win32/win32.c (StartSockets): use exit_handler.
-
- * win32/win32.c (rb_w32_getenv): use GetEnvironmentStrings() instead
- of GetEnvironmentVariable(), because the latter cannot distinguish
- wheather a null environment variable exists or not.
- fixed: [ruby-talk:205123]
-
-Mon Jul 31 16:15:13 2006 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_process.rb (TestProcess#test_rlimit_nofile):
- setrlimit may fail with EINVAL.
- reported by MIYAMUKO Katsuyuki. [ruby-dev:29174]
-
-Mon Jul 31 13:38:22 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/httprequest.rb (WEBrick::HTTPReuqest#parse_uri): improve
- for the value of IPv6 address in the Host: header field.
-
-Mon Jul 31 09:22:12 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ruby.h: use ifdef (or defined) for macro constants that may or
- may not be defined to shut up gcc's -Wundef warnings.
- [ruby-core:08447]
-
-Sun Jul 30 23:26:22 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_call0): trace call/return of method defined from block.
- fixed: [ruby-core:08329]
-
- * eval.c (rb_trap_eval): make the current thread runnable to deal with
- exceptions which occurred within the trap. fixed: [ruby-dev:27729]
-
- * lib/cgi/session.rb, lib/cgi/session/pstore.rb: suppress warnings.
- fixed: [ruby-talk:204896]
-
-Sat Jul 29 06:12:06 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: freeze ip_name for security reason.
-
-Sat Jul 29 01:23:52 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/logger.rb: improves the amount of documentation that Rdoc
- picks up when processing logger.rb by moving the require
- statement back before the comment block. a patch from Hugh
- Sasse <hgs at dmu.ac.uk>. [ruby-core:08422]
-
-Thu Jul 27 22:21:52 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * time.c (time_to_s): fixed format mismatch.
-
-Thu Jul 27 21:19:54 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * math.c (domain_check): a new function to check domain error
- explicitly for systems that return NaN like FreeBSD.
- [ruby-core:07019]
-
- * math.c (math_acos, math_asin, math_acosh, math_atanh, math_log,
- math_log10, math_sqrt): use domain_check().
-
- * math.c (math_sqrt): fix documentation flaw.
-
-Thu Jul 27 18:12:12 2006 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * time.c: need to declare time_utc_offset.
-
-Thu Jul 27 17:01:01 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c (io_close): always calls "close" method of the receiver.
- [ruby-core:6911] [ruby-core:8112]
-
-Thu Jul 27 16:49:01 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * time.c (time_to_s): use +0900 style timezone string for local time.
- [ruby-dev:29143]
-
-Thu Jul 27 16:41:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/openssl/ossl.h: move <ruby.h> inclusion point to shut up
- Solaris compiler. [ruby-core:08114]
-
-Wed Jul 26 22:20:59 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * configure.in: add support for as and ASFLAGS. [ruby-dev:29138]
-
-Wed Jul 26 22:13:45 2006 Minero Aoki <aamine@loveruby.net>
-
- * lib/net/http.rb: sync with HEAD (rev 1.132).
-
- * lib/net/http.rb (Net::HTTP#post, request_post, request): should
- set Content-Type: x-www-form-urlencoded by default.
-
- * lib/net/http.rb (Net::HTTPHeader#content_type): should return
- nil when there's no Content-Type.
-
- * lib/net/http.rb (Net::HTTPHeader#sub_type): should return nil
- when there's no sub Content-Type (e.g. "Content-Type: text").
-
- * lib/net/http.rb (Net::HTTPHeader#type_params): wrongly failed
- when there's no Content-Type.
-
-Wed Jul 26 18:35:38 2006 Minero Aoki <aamine@loveruby.net>
-
- * ext/strscan/strscan.c: sync with HEAD (rev 1.25).
-
- * ext/strscan/strscan.c (strscan_do_scan):
- StringScanner.new("").scan(//) should return "". [ruby-Bugs:4361]
-
-Wed Jul 26 18:14:19 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/pty/pty.c (getDevice): retry once after GC on failure.
- [ruby-core:08282]
-
-Wed Jul 26 17:28:16 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (rb_f_sprintf): prepend ".." to %u for negative bignum,
- but not "-". fixed: [ruby-core:08167]
-
-Wed Jul 26 16:39:07 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (rb_str_scan): add string modification check.
- [ruby-core:7216]
-
-Wed Jul 26 16:06:03 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi.rb (CGI::QueryExtension::read_multipart): check
- multipart boundary end. a patch from Fujioka <fuj at rabbix.jp>
- [ruby-dev:28470]
-
-Wed Jul 26 01:02:59 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: suppress warnings by automake 1.8 or later.
-
-Tue Jul 25 00:30:06 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/prettyprint.rb: RD to RDoc conversion by Hugh Sasse.
-
-Tue Jul 25 14:49:51 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (configuration): typo.
-
-Tue Jul 25 13:14:32 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * process.c (rb_proc_times): rename hz to hertz to avoid name
- crash on AIX. [ruby-dev:29126]
-
-Mon Jul 24 22:03:40 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (backtrace): skip frames successive on node and method name.
-
-Mon Jul 24 17:55:55 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * process.c (rb_f_system): add security check. [ruby-talk:202947]
-
- * process.c (rb_f_system): move signal right before fork to avoid
- signal handler intervention.
-
-Mon Jul 24 15:51:52 2006 Tanaka Akira <akr@fsij.org>
-
- * ext/readline/readline.c (readline_readline): rl_deprep_term_function
- may be NULL with libedit. reported by Ryan Davis. [ruby-dev:29070]
-
-Mon Jul 24 15:19:55 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): revert last change. [ruby-dev:29112]
- [ruby-core:08374]
-
-Sun Jul 23 22:59:49 2006 Tanaka Akira <akr@fsij.org>
-
- * test/socket/test_unix.rb: disabled on cygwin.
- reported by Kouhei Yanagita. [ruby-dev:29080]
-
-Fri Jul 21 21:21:08 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_call0): include funcalled methods in caller list.
- fixed: [ruby-core:08290]
-
-Fri Jul 21 12:11:00 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb, lib/mkmf.rb (with_destdir): remove drive letter before
- prepending destdir on DOSISH.
-
-Thu Jul 20 15:07:14 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ruby.h: export classes/modules to implement sandbox.
- [ruby-core:08283]
-
-Thu Jul 20 00:06:29 2006 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/completion.rb: support for completion of numeric
- number. [ruby-dev: 29038]
-
-Wed Jul 19 23:53:05 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/parser.rb, lib/rss/utils.rb: added documents.
-
-Tue Jul 18 22:10:13 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * process.c (rb_f_system): block SIGCHLD during the process
- execution, like glibc system(3) does. [ruby-talk:202361]
-
-Tue Jul 18 23:12:14 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (open_ifs_socket): should not use plain malloc.
-
- * win32/win32.c (rb_w32_opendir): should not use plain realloc.
-
-Tue Jul 18 18:05:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * test/ruby/test_float.rb (TestFloat::test_strtod): update test to
- conform strtod change.
-
-Tue Jul 18 15:49:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * pack.c (pack_unpack): propagate association array to copied
- string. [ruby-core:08223]
-
- * pack.c (pack_unpack): return referenced string itself if it has
- same length as specified. a patch from <nobu at ruby-lang.org>
- in [ruby-core:08225].
-
- * pack.c (pack_pack): taint 'p' packed strings.
-
-Tue Jul 18 14:03:02 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/webrick/httpserver.rb (WEBrick::HTTPServer::unmount): remove
- inpect argument from sprintf. [ruby-dev:29039]
-
-Tue Jul 18 10:53:37 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_cstr_to_dbl): limit out-of-range message.
-
- * util.c (ruby_strtod): return end pointer even if ERANGE occurred.
- fixed: [ruby-dev:29041]
-
-Mon Jul 18 00:43:05 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * util.c (ruby_strtod): stop at dot not followed by digits.
- fixed: [ruby-dev:29035]
-
-Tue Jul 18 00:01:27 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb: remove LIBRUBY_SO if static linked extensions exist.
-
-Mon Jul 17 23:30:46 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rb_cv_msvcrt): defaulted to msvcrt. Workaround for a
- bug of cygwin 1.5.20.
-
-Mon Jul 17 13:43:05 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * pack.c (define_swapx): should not use plain malloc.
-
-Mon Jul 17 12:58:41 2006 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * configure.in: should use ac_cv_lib_dl_dlopen=no on MinGW.
-
-Sat Jul 15 23:50:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_require_safe): wait for another thread requiring the same
- feature. fixed: [ruby-core:08229]
-
-Sat Jul 15 01:27:13 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (has_magic): glob names contain alphabets to enable case fold
- search also for directories. fixed: [ruby-talk:201917]
-
-Sat Jul 15 01:09:22 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * st.c (malloc): use xmalloc/xcalloc instead of plain
- malloc/calloc, to detect memory allocation failure. see
- <http://www.nongnu.org/failmalloc/>.
-
- * gc.c (rb_memerror): should not raise empty nomem_error.
-
-Fri Jul 14 13:08:13 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: add methods for new features of latest Tcl/Tk8.5.
-
- * ext/tk/lib/tk/namespace.rb: ditto.
-
-Fri Jul 14 02:30:12 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/monitor.rb: document patch from Hugh Sasse <hgs at dmu.ac.uk>.
- [ruby-core:08205]
-
-Fri Jul 14 01:09:46 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (then): error in warning action.
-
-Fri Jul 14 00:10:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * array.c (rb_ary_pop): may cause realloc oscillation. a patch
- from MORITA Naoyuki <mlgetter at kidou.sakura.ne.jp>.
- [ruby-dev:29028]
-
-Thu Jul 13 22:23:56 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/composite.rb: improve handling of the classname on the
- option database for the widget class which includes TkComposite.
-
-Thu Jul 13 20:32:19 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/parser.rb: updated documents by a patch from
- Hugh Sasse <hgs at dmu.ac.uk>. [ruby-core:8194]
-
-Wed Jul 12 13:54:09 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (then): we'd like to reserve colon here for the future.
- warning added.
-
-Tue Jul 11 20:58:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ruby.h: export rb_cMethod. [ruby-talk:201259]
-
-Tue Jul 11 19:13:33 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: remove restriction on the class of
- pseudo-toplevel.
-
-Tue Jul 11 18:00:57 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: security fix.
-
-Tue Jul 11 17:33:39 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * string.c (rb_str_dump): need to extend len for \b.
-
-Mon Jul 10 22:00:00 2006 Shigeo Kobayashi <shigek@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c: Allows '_' to appear within
- digits. [ruby-dev:28872]
-
- * ext/bigdecimal/lib/bigdecimal/util.rb: Bug in to_r reported by
- [ruby-list:42533] fixed.
-
-Mon Jul 10 19:22:19 2006 Tanaka Akira <akr@fsij.org>
-
- * gc.c (gc_sweep): expand heap earlier.
- reported by MORITA Naoyuki. [ruby-dev:28960]
-
-Mon Jul 10 18:59:34 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/font.rb: sorry. mistaken to patch.
-
-Mon Jul 10 18:46:52 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c: make SEGV risk lower at exit.
-
- * ext/tk/lib/tk.rb: ditto.
-
- * ext/tk/lib/multi-tk.rb: fail to call function-style methods on slave
- interpreters. The strategy (MultiTkIp_PseudoToplevel_Evaluable) to
- fix the problem is a little tricky. You may have to take care of
- conflicting with it.
-
- * ext/tk/lib/tk.rb: a little change for the pseudo-toplevel strategy.
-
- * ext/tk/lib/tk/font.rb: ditto.
-
- * ext/tk/lib/tk/msgcat.rb: ditto.
-
- * ext/tk/lib/tkextlib/itk/incr_tk.rb: ditto.
-
- * ext/tk/sample/demos-en/widget: fail to call function-style methods
- on sample scripts. To fix it, a strategy which similar to the way
- on MultiTiIp is used. Please take care when re-write and re-run a
- demo script on the Widget-Demo code viewer.
-
- * ext/tk/sample/demos-jp/widget: ditto.
-
-Mon Jul 10 13:58:40 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * signal.c (ruby_nativethread_signal, posix_nativethread_signal,
- sigsend_to_ruby_thread, install_nativethread_sighandler):
- nativethread-support on signal handler. RE-backport from 1.9.
-
- * ruby.h (HAVE_NATIVETHREAD_KILL): ditto.
-
- * eval.c (ruby_native_thread_kill): ditto.
-
-Mon Jul 10 10:54:14 2006 Ryan Davis <ryand@zenspider.com>
-
- * lib/rdoc/parsers/parse_f95.rb: massive overhaul from Yasuhiro
- Morikawa including new file suffixes, function support, public
- variables and constants, derived-types, defined operators and
- assignments, namelists, and subroutine and function
- arguments. Truly massive.
-
- * lib/rdoc/diagram.rb: diagrams are now cached.
-
- * lib/irb/completion.rb: fixed a crasher when completing against
- an unnamed class/module.
-
- * lib/rdoc/parsers/parse_c.rb: private comment (--/++) support in
- C-file rdoc.
-
- * lib/debug.rb: minor clarification in help.
-
- * lib/pp.rb: minor clarification on exception.
-
-Mon Jul 10 09:29:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_clear_cache_for_undef): clear entries for included
- module. fixed: [ruby-core:08180]
-
-Mon Jul 10 01:48:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * st.h (st_data_t): use pointer sized integer for st_data_t.
- [ruby-dev:28988]
-
-Sun Jul 9 18:06:47 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (try_constant): fix for value 1 at cross compiling.
-
- * lib/mkmf.rb (create_makefile): prevent substitution of macro
- definition. fixed: http://www.yotabanana.com/lab/20060624.html#p02
-
-Sun Jul 9 00:54:34 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (next_jump): deal with destination of next.
- fixed: [ruby-core:08169]
-
-Fri Jul 7 00:38:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * hash.c (rb_hash_default): should not call default procedure if
- no key is given. [ruby-list:42541]
-
-Fri Jul 7 00:29:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * time.c (time_mload): a patch from Daniel Berger
- <Daniel.Berger at qwest.com>. [ruby-core:08128]
-
-Thu Jul 6 22:21:57 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (rb_proc_times): use sysconf(_SC_CLK_TCK) value prior to
- HZ and CLK_TCK. fixed: [ruby-talk:200293]
-
-Thu Jul 6 22:17:21 2006 Minero Aoki <aamine@loveruby.net>
-
- * ext/racc/cparse/cparse.c: sync with original code, rev 1.8.
-
- * ext/racc/cparse/cparse.c: should mark CparseParams objects.
-
- * lib/racc/parser.rb: sync with original code, rev 1.8.
-
- * lib/racc/parser.rb: update coding style.
-
-Mon Jul 3 19:04:38 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c (ip_make_menu_embeddable): help to make a menu
- widget embeddable (pack, grid, and so on) like as a general widget.
- However, an embeddable menu may require to be definied some event
- bindings for general use.
-
- * ext/tk/lib/tk/event.rb: [bug fix] Tk.callback_break and
- Tk.callback_continue don't work on MultiTkIp.
-
- * ext/tk/lib/multi-tk.rb: ditto.
-
- * ext/tk/lib/tk.rb: lack of Tk.callback_return.
-
- * ext/tk/lib/tk/menu.rb: improve creating clone menus.
-
-Mon Jul 3 14:42:06 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/extconf.rb (PW_UID2VAL, PW_GID2VAL): defaulted to conversion
- from int, and sys/types.h needs to be included before grp.h.
- fixed: [ruby-dev:28938]
-
-Mon Jul 3 01:14:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (rb_str_inspect): encode \b (\010) for escape.
- [ruby-dev:28927]
-
- * string.c (rb_str_dump): ditto.
-
-Sun Jul 2 19:17:56 2006 Minero Aoki <aamine@loveruby.net>
-
- * ext/racc/cparse/cparse.c: sync with original code (rev 1.7).
-
- * ext/racc/cparse/cparse.c: use rb_catch instead of rb_iterate.
- Giving a block to a Ruby-level method by rb_iterate is obsolete on
- Ruby 1.9. Note that current cparse.c still includes one
- rb_iterate call on Ruby 1.8, but it is not a problem (at least
- just now).
-
-Sat Jul 1 15:15:49 2006 Tanaka Akira <akr@m17n.org>
-
- * test/socket/test_nonblock.rb: add timeout to send/receive
- an empty UDP packet.
- [ruby-dev:28820]
-
-Fri Jun 30 23:46:23 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * configure.in: should test isinf for Solaris with GCC compiler.
- a patch from <ville.mattila at stonesoft.com>. [ruby-core:07791]
-
- * configure.in: -shared patch from Andrew Morrow
- <andrew.c.morrow at gmail.com>. [ruby-core:08100]
-
-Thu Jun 29 18:58:51 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_version): fix patch
- failure.
-
-Thu Jun 29 18:00:51 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c: add RDoc document. a patch from
- mathew <meta at pobox.com>. [ruby-core:07050]
-
-Wed Jun 28 15:47:14 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/optparse.rb: RDoc patch from Robin Stocker <robin@nibor.org>
- [ruby-core:08087]
-
-Wed Jun 28 19:04:34 2006 Tanaka Akira <akr@m17n.org>
-
- * test/socket/test_unix.rb: test_seqpacket_pair removed.
- [ruby-dev:28846]
-
-Tue Jun 27 23:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c: RDoc update for =~ method. a patch from Alex Young
- <alex at blackkettle.org>. [ruby-core:08068]
-
-Tue Jun 27 22:47:18 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c: forgot to update TCLTKLIB_RELEASE_DATE.
-
- * ext/tk/lib/tk.rb (tk_tcl2ruby): [bug fix] sometimes fail to convert
- a tcl string to a ruby object if the tcl string includes "\n".
-
-Tue Jun 27 16:04:05 2006 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * win32/win32.h: define isascii on MinGW for msvcrt compatibility.
-
- * configure.in: set ac_cv_header_sys_time_h=no on MinGW
- for msvcrt compatibility.
-
-Tue Jun 27 11:36:02 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/etc/etc.c (setup_passwd, setup_group): allow bignum uid, gid and
- so on. [ruby-talk:199102]
-
-Mon Jun 26 13:37:27 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Merge from HEAD.
- Add options to limit the ri search path.
-
-Tue Jun 27 00:54:08 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * util.c (powersOf10): constified.
-
-Mon Jun 26 18:37:44 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c (ip_delete): fix SEGV when a slave-ip is
- deleted on callback.
-
-Mon Jun 26 10:47:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c (pipe_open): avoid closing uninitialized file descriptors.
- a patch from <tommy at tmtm.org> [ruby-dev:28600]
-
-Mon Jun 26 09:56:22 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.[ch] (rb_w32_send, rb_w32_sendto): constified.
-
-Sun Jun 25 23:02:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in, mkconfig.rb: catch-up for latest autoconf.
-
-Sat Jun 24 06:35:00 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * signal.c: revert last change.
-
- * ruby.h: ditto.
-
- * eval.c: ditto.
-
-Thu Jun 22 11:52:02 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTPResponse): duplicated error 501;
- HTTPInternalServerError should be error 500. [ruby-core:08037]
-
-Thu Jun 22 05:15:58 2006 Tanaka Akira <akr@m17n.org>
-
- * ext/socket/socket.c (sock_s_socketpair): try GC only once.
- [ruby-dev:28778]
-
-Wed Jun 21 21:28:32 2006 Tadayoshi Funaba <tadf@dotrb.org>
-
- * lib/date.rb (jd_to_commercial): now works fine even if in
- mathn-ized context.
-
-Wed Jun 21 17:32:31 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * signal.c (ruby_nativethread_signal, posix_nativethread_signal,
- sigsend_to_ruby_thread, install_nativethread_sighandler):
- nativethread-support on signal handler (backport from 1.9).
-
- * ruby.h (HAVE_NATIVETHREAD_KILL): ditto.
-
- * eval.c (ruby_native_thread_kill): ditto.
-
-Wed Jun 21 08:39:54 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): merge Date
- and Time processing. [ruby-core:08033]
-
-Wed Jun 21 01:40:25 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (yylex, reswords): modifier token is no longer returned in
- fname state. [ruby-dev:28775]
-
-Wed Jun 21 01:12:46 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: RSS::Element.def_corresponded_attr_writer
- supported date type.
-
-Tue Jun 20 22:08:36 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rss/test_parser.rb: split parser tests into ...
- * test/rss/test_parser_1.0.rb: ... RSS 1.0 parsing tests and ...
- * test/rss/test_parser_2.0.rb: ... RSS 2.0 parsing tests.
-
-Tue Jun 20 21:19:06 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: provided default RSS::Element#children.
-
- * lib/rss/0.9.rb: used default RSS::Element#children.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
-
-Tue Jun 20 21:04:33 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: provided default RSS::Element#_tags.
-
- * lib/rss/0.9.rb: used default RSS::Element#_tags.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
-
-Tue Jun 20 20:47:07 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: hide RSS::Element.install_model.
- (RSS::Element.install_have_child_element,
- RSS::Element.install_have_children_element,
- RSS::Element.install_text_element,
- RSS::Element.install_date_element): call
- RSS::Element.install_model internally.
-
- * lib/rss/0.9.rb: followed new API.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/content.rb: ditto.
- * lib/rss/dublincore.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/syndication.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
-Tue Jun 20 20:18:05 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/extconf.rb: add check for OBJ_NAME_do_all_sorted.
-
- * ext/openssl/ossl_cipher.c (ossl_s_ciphers): new method
- OpenSSL::Cipher.ciphers. it returns all the cipher names.
-
- * ext/openssl/lib/openssl/cipher.rb:
- - add constants AES128, AES192, AES256. [ruby-dev:28610]
- - reimplement without eval()
-
- * ext/openssl/lib/openssl/digest.rb: reimplement without eval().
-
- * test/openssl/test_cipher.rb, test_digest: fix about reimplemented
- features.
-
- * sample/openssl/cipher.rb: rewrite all.
-
-Sat Jun 19 11:21:46 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/test/unit/assertions.rb: Merge RDoc from HEAD.
-
-Tue Jun 20 01:06:57 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb:
- - cleanup validation mechanism. Now, #XXX_validation is
- needless.
- - changed internal variable name RSS::Element::MODEL to
- RSS::Element::MODELS.
- - RSS::Element.install_model requires uri.
-
- * lib/rss/0.9.rb: followed new validation API.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/content.rb: ditto.
- * lib/rss/dublincore.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/syndication.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
-Mon Jun 19 23:40:59 2006 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/lib/kconv.rb: remove default -m0 and fix document.
-
- * ext/nkf/nkf-8/{nkf.c, config.h, utf8tbl.c, utf8tbl.h}:
- imported nkf 2.0.7.
-
-Mon Jun 19 22:31:59 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb:
- - provided default #to_s as RSS::Element#to_s.
- - removed RSS::Element#other_element.
- - RSS::Element#tag requires attributes as Hash instead of Array.
-
- * lib/rss/0.9.rb: removed #to_s to use RSS::Element#to_s.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
- * lib/rss/2.0.rb: removed #other_element.
-
-Mon Jun 19 22:09:16 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c(ole_invoke): support some kind of
- method of word. [ruby-Bugs#3237]
-
- * ext/win32ole/tests/test_word.rb: ditto.
-
- * ext/win32ole/tests/testall.rb: ditto.
-
-Mon Jun 19 00:02:17 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: automatically detected attributes.
-
- * lib/rss/0.9.rb: removed #_attrs.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
- * lib/rss/parser.rb: followed new internal API.
-
-Mon Jun 19 00:00:17 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: fix bug: initialize improper tables.
-
-Sun Jun 18 22:36:13 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: RSS::Element#initialize accepts initial
- attributes.
- * lib/rss/0.9.rb: ditto.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/dublincore.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
- * lib/rss/utils.rb: added Utils.element_initialize_arguments? to
- detect backward compatibility initial arguments.
-
- * lib/rss/parser.rb: user initial attributes to initialize
- RSS::Element.
-
-Sun Jun 18 18:24:42 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/converter.rb: use NKF for Uconv fallback.
-
-Sun Jun 18 18:22:04 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rss/test_image.rb: shared name space configuration.
-
-Sun Jun 18 18:13:25 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: improved ignore_unknown_element
- handling. RSS::NotExpectedTagError provides tag URI.
- * lib/rss/parser.rb: ditto.
- * lib/rss/0.9.rb: ditto.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/content.rb: ditto.
- * lib/rss/dublincore.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/syndication.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
- * test/rss/rss-assertions.rb: checked URI of not expected tag too.
- * test/rss/test_parser.rb: ditto.
-
-Sun Jun 18 18:08:36 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: changed empty namespace URI representation to ""
- from nil.
- * lib/rss/parser.rb: ditto.
- * lib/rss/0.9.rb: ditto.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
-
-Sun Jun 18 18:03:50 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/parser.rb: removed a guard for requiring open-uri.
-
-Sun Jun 18 18:01:26 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: fixed typo: except -> expect
- * lib/rss/parser.rb: ditto.
- * test/rss/rss-assertions.rb: ditto.
- * test/rss/test_parser.rb: ditto.
-
-Sun Jun 18 17:52:39 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: RSS::Element#calc_indent became to be deprecated.
- * lib/rss/0.9.rb: ditto.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/taxonomy.rb: ditto.
- * lib/rss/trackback.rb: ditto.
-
- * test/rss/test_1.0.rb: removed RSS::Element.indent_size tests.
- * test/rss/test_2.0.rb: ditto.
-
-Sun Jun 18 00:49:11 2006 Tanaka Akira <akr@m17n.org>
-
- * ext/socket/socket.c (bsock_recv_nonblock): new method
- BasicSocket#recv_nonblock.
- (udp_recvfrom_nonblock): renamed from ip_recvfrom_nonblock.
- IPSocket#recvfrom_nonblock is moved to UDPSocket#recvfrom_nonblock.
- (unix_recvfrom_nonblock): removed.
- UNIXSocket#recvfrom_nonblock is removed.
-
-Sat Jun 17 22:17:17 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/mathn.rb (Integer::prime_division): raise ZeroDivisionError
- on zeros. [ruby-dev:28739]
-
-Sat Jun 17 14:53:32 2006 Tanaka Akira <akr@m17n.org>
-
- * lib/pathname.rb: backport from 1.9.
- (Kernel#Pathname): new method.
-
-Sat Jun 17 10:30:41 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb (Hash#merge, Enumerable#sort_by): removed.
-
- * lib/rss/rss.rb (RSS::RootElementMixin#to_xml): added.
- [ruby-talk:197284]
-
- We can convert RSS version easily like the following:
- rss10 = RSS::Parser.parse(File.read("1.0.rdf"))
- File.open("2.0.rss", "w") {|f| f.print(rss10.to_xml("2.0"))}
-
- * test/rss/test_1.0.rb: added #to_xml test.
- * test/rss/test_2.0.rb: ditto.
-
- * test/rss/rss-testcase.rb: added some helper methods that
- generates sample RSS 2.0.
-
- * sample/rss/convert.rb: added a sample script to convert RSS format.
-
-Sat Jun 17 10:23:22 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb (Kernel#funcall): removed.
- * lib/rss/parser.rb (Kernel.URI): removed.
-
- * lib/rss/maker/: supported
- xxx.new_yyy do |yyy|
- yyy.zzz = zzz
- ...
- end
- style and this style became the style of the recommendation.
-
- Old style
- yyy = xxx.new_yyy
- yyy.zzz = zzz
- ...
- is supported too but this style isn't recommended.
- [ruby-talk:197284]
-
- * test/rss/test_*maker*.rb: used new recommended style.
-
-Sat Jun 17 09:03:47 2006 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss, test/rss: backported from trunk. (2005-11-16 - now)
-
- * lib/rss/rss.rb (RSS::VERSION): 0.1.5 -> 0.1.6.
- * test/rss/test_version.rb (RSS::TestVersion#test_version): ditto.
-
- * lib/rss/trackback.rb: added TrackBack prefix.
- * lib/rss/maker/trackback.rb: ditto.
-
- * lib/rss/rss.rb : removed needless argument 'prefix'.
- * lib/rss/parser.rb: ditto.
-
- * lib/rss/1.0.rb: added rdf:Bag.
-
- * lib/rss/taxonomy.rb: implemented taxonomy module.
- * test/rss/test_taxonomy.rb: added tests for taxonomy support.
-
- * lib/rss/1.0.rb: added convenience method 'resources'.
- * lib/rss/taxonomy.rb: ditto.
- * test/rss/rss-assertions.rb: added test for 'resources'.
- * test/rss/test_taxonomy.rb: ditto.
-
- * lib/rss/rss.rb: fixed a indentation bug.
- * lib/rss/taxonomy.rb: fixed <taxo:topic> #to_s bug.
- * test/rss/test_taxonomy.rb: added a #to_s test.
-
- * lib/rss/maker/taxonomy.rb: implemented taxonomy module for RSS
- Maker.
- * lib/rss/taxonomy.rb: supported RSS Maker.
- * lib/rss/maker.rb: added taxonomy module support.
-
- * lib/rss/rss.rb: adjusted to other element API.
- * lib/rss/1.0.rb: adjusted to other element API but backward
- compatibility is reserved.
- * lib/rss/0.9.rb: ditto.
-
- * test/rss/test_maker_taxo.rb: added test case for taxonomy module
- for RSS Maker.
- * test/rss/test_setup_maker_1.0.rb: added tests for taxo:topic.
-
- * test/rss/test_setup_maker_1.0.rb: added backward compatibility
- test.
- * test/rss/test_setup_maker_0.9.rb: ditto.
- * test/rss/test_setup_maker_2.0.rb: ditto.
-
- * test/rss/rss-testcase.rb: added convenience method for setting
- up taxo:topic.
- * test/rss/rss-assertions.rb: added assertion for taxo:topic.
-
- * sample/rss/blend.rb: followed new API.
-
- * lib/rss/taxonomy.rb: changed class or module prefix to
- Taxonomy from Taxo.
- * lib/rss/maker/taxonomy.rb: ditto.
-
- * test/rss/test_taxonomy.rb: use #reject directory.
-
- * lib/rss/: use #__send__ instead of #send.
- * test/rss/: ditto.
-
- * lib/rss/parser.rb: added entity handling type predicate.
- * lib/rss/rexmlparser.rb: ditto.
- * lib/rss/xmlparser.rb: ditto.
- * lib/rss/xmlscanner.rb: ditto.
-
- * lib/rss/xmlscanner.rb: more robust entity handling.
-
- * test/rss/test_parser.rb: added an entity handling test.
-
- * test/rss/test_2.0.rb: added RSS 2.0 tests.
- * test/rss/rss-assertions.rb: extended XML stylesheet assertion.
- * lib/rss/0.9.rb: added initialize method.
- * test/rss/test_1.0.rb: cleanup.
-
- * lib/rss/image.rb: added Image prefix.
- * lib/rss/maker/image.rb: ditto.
-
- * lib/rss/rss.rb: improved type conversion.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/0.9.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/image.rb: ditto.
- * lib/rss/syndication.rb: ditto.
-
- * test/rss/test_2.0.rb: added type conversion tests.
- * test/rss/test_accessor.rb: ditto.
- * test/rss/test_to_s.rb: ditto.
- * test/rss/test_syndication.rb: ditto.
- * test/rss/test_setup_maker_2.0.rb: ditto.
- * test/rss/test_setup_maker_1.0.rb: ditto.
- * test/rss/test_setup_maker_0.9.rb: ditto.
- * test/rss/test_maker_sy.rb: ditto.
- * test/rss/test_maker_image.rb: ditto.
- * test/rss/test_maker_2.0.rb: ditto.
- * test/rss/test_maker_0.9.rb: ditto.
- * test/rss/test_image.rb: ditto.
-
- * test/rss/test_maker_1.0.rb: use assert instead of assert_equal.
-
- * test/rss/rss-assertions.rb: improved type conversion assertions.
-
- * lib/rss/rss.rb: added backward compatibility codes.
- * lib/rss/parser.rb: ditto.
- * test/rss/test_parser.rb: ditto.
- * test/rss/test_2.0.rb: ditto.
-
-Sat Jun 17 02:01:00 2006 Tanaka Akira <akr@m17n.org>
-
- * lib/pp.rb (Kernel#pretty_inspect): defined for pretty printed
- string.
-
-Sat Jun 17 00:23:58 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (reswords): kDO_BLOCK was missing. fixed: [ruby-core:7995]
-
-Sat Jun 17 00:02:15 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_propertyput): support
- PROPERTYPUTREF. [ruby-talk:183042]
-
- * ext/win32ole/tests/test_propertyputref.rb: ditto.
-
-Thu Jun 15 23:02:47 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (fole_methods): The return value
- of WIN32OLE#ole_methods should include PROPERTYPUTREF methods.
-
- * ext/win32ole/win32ole.c (fole_put_methods): The return value
- of WIN32OLE#ole_put_methods should include PROPERTYPUTREF methods.
-
- * ext/win32ole/tests/test_ole_methods.rb: ditto.
-
- * ext/win32ole/tests/testall.rb : ditto.
-
-Wed Jun 14 18:23:28 2006 Eric Hodel <drbrain@segment7.net>
-
- * enum.c (enum_any): Documentation typo.
-
-Wed Jun 14 15:01:09 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser#warn): Don't print
- warnings when -q is set.
-
-Wed Jun 14 23:03:53 2006 Tanaka Akira <akr@m17n.org>
-
- * configure.in: check sizeof(rlim_t).
- check setrlimit.
-
- * process.c (proc_getrlimit): new method Process.getrlimit.
- (proc_setrlimit): new method Process.setrlimit.
-
- * ruby.h (NUM2ULL): new macro.
-
-Mon Jun 12 22:25:09 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * sprintf.c (rb_f_sprintf): adjust precision length to prevent
- splitting multi-byte characters. [ruby-list:42389]
-
-Sun Jun 11 23:20:07 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optparse.rb (OptionParser::Arguable#getopts): pass self to the
- parser.
-
-Sun Jun 11 10:00:57 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.h (write): not need to define on bcc.
-
-Sun Jun 11 08:30:33 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optparse.rb (OptionParser#getopts): new methods.
-
-Sat Jun 10 18:02:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/bigdecimal/lib/bigdecimal/newton.rb (Newton::nlsolve): typo
- fixed: raize -> raise. [ruby-talk:196608]
-
-Thu Jun 8 14:19:17 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.[ch] (rb_w32_read, rb_w32_write): new functions.
- use recv() and send() when fd is socket. fixed: [ruby-dev:28694]
-
-Wed Jun 7 16:22:51 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/tempfile.rb (Tempfile::make_tmpname): put dot between
- basename and pid. [ruby-talk:196272]
-
-Wed Jun 7 14:53:04 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (errmap): add some winsock errors.
-
-Wed Jun 7 11:34:38 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * configure.in: add new configure option `--with-winsock2' for mingw.
-
- * win32/Makefile.sub (config.h): define USE_WINSOCK2 in config.h
- instead of in CPPFLAGS.
-
- * ext/socket/extconf.rb: determine whether to use winsock2 or not
- by using with_config.
-
-Wed Jun 7 10:45:10 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/{configure.bat, setup.mak, Makefile.sub, win32.h}: add
- new configure option `--with-winsock2'.
-
- * win32/win32.c (StartSockets): ditto.
-
- * ext/socket/extconf.rb: ditto.
-
- * win32/win32.c (open_ifs_socket): new function.
-
- * win32/win32.c (StartSockets, rb_w32_socket): use open_ifs_socket()
- instead of socket().
- ifs socket support is backported from trunk.
-
-Wed Jun 7 09:14:44 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): binding for the return event hook should have
- consistent scope. [ruby-core:07928]
-
- * eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
- event_hooks. no guarantee for arbitrary hook deletion.
- [ruby-dev:28632]
-
-Mon Jun 5 18:12:12 2006 Tanaka Akira <akr@m17n.org>
-
- * ext/socket/socket.c (sock_s_unpack_sockaddr_in): reject
- non-AF_INET/AF_INET6 sockaddr.
- (sock_s_unpack_sockaddr_un): reject non-AF_UNIX sockaddr.
- [ruby-dev:28691]
-
-Sun Jun 4 20:40:19 2006 Tanaka Akira <akr@m17n.org>
-
- * ext/socket/socket.c: fix sockaddr_un handling.
- [ruby-dev:28677]
-
-Fri Jun 2 22:08:17 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/forwardable.rb: RDoc typo fix from Jan Svitok
- <jan.svitok at gmail.com>. [ruby-core:07943]
-
-Fri Jun 2 19:02:09 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/extconf.rb: use create_header.
-
- * ext/openssl/ossl.h, ext/openssl/openssl_missing.h:
- include RUBY_EXTCONF_H.
-
-Fri Jun 2 17:16:52 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (CLEANINGS): remove extconf.h by distclean if created.
-
-Fri Jun 2 00:11:19 2006 Tanaka Akira <akr@m17n.org>
-
- * ext/socket/socket.c (s_recvfrom): alen may be zero with UNIXSocket
- too. (tested on NetBSD 3.0)
- (s_recvfrom_nonblock): extracted from sock_recvfrom_nonblock.
- (sock_recvfrom_nonblock): use s_recvfrom_nonblock.
- (ip_recvfrom_nonblock): new method: IPSocket#recvfrom_nonblock
- (unix_recvfrom_nonblock): new method: UNIXSocket#recvfrom_nonblock
- (s_accept_nonblock): extracted from sock_accept_nonblock.
- (sock_accept_nonblock): use s_accept_nonblock.
- (tcp_accept_nonblock): new method: TCPServer#accept_nonblock
- (unix_accept_nonblock): new method: UNIXServer#accept_nonblock
-
-Thu Jun 1 19:12:37 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_cmdvector): backslashes inside single-quotes
- no longer has special meanings. fixed: [ruby-list:42311]
-
-Thu Jun 1 16:14:41 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_getcwd): runtime's getcwd() will not success
- if the length of the cwd is longer than MAX_PATH.
- fixed [ruby-list:42335]
-
-Thu Jun 1 11:29:14 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_getcwd): set errno if not set.
- fixed [ruby-list:42346]
-
-Sat May 27 11:29:46 2006 nobuyoshi nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): remove extinit files if no statically linked
- extensions.
-
-Fri May 26 09:05:11 2006 nobuyoshi nakada <nobu@ruby-lang.org>
-
- * ruby.h, lib/mkmf.rb (create_header): clear command line options for
- macros moved to extconf.h.
-
- * ext/extmk.rb (extract_makefile, extmk): made RUBY_EXTCONF_H and
- EXTSTATIC permanent.
-
- * ext/{dbm,digest/*,socket,zlib}/extconf.rb: used $defs and $INCFLAGS.
-
- * {bcc32,win32,wince}/Makefile.sub (COMPILE_C, COMPILE_CXX): added
- $(INCFLAGS).
-
- * lib/mkmf.rb (configuration): add $defs unless extconf.h was created.
-
-Thu May 25 01:52:07 2006 nobuyoshi nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (pkg_config): particular config commands support.
-
- * ext/extmk.rb: deal with $static set in extconf.rb.
-
- * mkconfig.rb: merge multiple entries to an entry with multiple lines.
-
- * lib/mkmf.rb: allow a series of commands to link.
-
- * win32/Makefile.sub: embed manifests.
-
- * win32/setup.mak: suffix OS name by runtime version.
-
-Wed May 24 23:52:11 2006 nobuyoshi nakada <nobu@ruby-lang.org>
-
- * configure.in (ac_install_sh): ignore dummy install-sh.
- [ruby-talk:193876]
-
-Wed May 24 03:10:48 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/lib/openssl/ssl.rb
- (OpenSSL::SSL::SocketForwarder#setsockopt,getsockopt): typo fixed.
-
-Mon May 22 17:54:12 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/socket/socket.c (sock_recvfrom_nonblock): use rb_read_pending
- instead of rb_io_read_pending.
- [ruby-dev:28663]
-
-Mon May 22 17:30:04 2006 Tanaka Akira <akr@m17n.org>
-
- * rubyio.h (rb_io_set_nonblock): declared.
-
- * io.c (rb_io_set_nonblock): new function.
- (io_getpartial): nonblocking read support.
- (io_read_nonblock): new method: IO#read_nonblock.
- (io_write_nonblock): new method: IO#write_nonblock.
-
- * ext/socket/socket.c
- (sock_connect_nonblock): new method: Socket#connect_nonblock.
- (sock_accept_nonblock): new method: Socket#accept_nonblock.
- (sock_recvfrom_nonblock): new method: Socket#recvfrom_nonblock.
-
- [ruby-core:7917]
-
-Mon May 22 15:57:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (umethod_bind): should not update original class.
- [ruby-dev:28636]
-
-Mon May 22 13:38:57 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (ev_const_get): should support constant access from
- within instance_eval(). [ruby-dev:28327]
-
-Thu May 18 17:51:32 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * time.c (time_timeval): should round for usec floating
- number. [ruby-core:07896]
-
- * time.c (time_add): ditto.
-
-Thu May 18 17:11:45 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi.rb (CGI::out): support utf-8. a patch from Fujioka
- <fuj at rabbix.jp>. [ruby-dev:28649]
-
-Thu May 18 00:42:12 2006 nobuyoshi nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb, lib/mkmf.rb: use BUILD_FILE_SEPARATOR in Makefiles.
-
-Wed May 17 17:55:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * dir.c (sys_warning): should not call a vararg function
- rb_sys_warning() indirectly. [ruby-core:07886]
-
-Wed May 17 08:17:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * util.c (ruby_strtod): try to reduce errors using powersOf10
- table. [ruby-dev:28644]
-
-Tue May 16 15:34:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * re.c (rb_reg_initialize): should not allow modifying literal
- regexps. frozen check moved from rb_reg_initialize_m as well.
-
-Tue May 16 09:20:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * re.c (rb_reg_initialize): should not modify untainted objects in
- safe levels higher than 3.
-
- * re.c (rb_memcmp): type change from char* to const void*.
-
- * dir.c (dir_close): should not close untainted dir stream.
-
- * dir.c (GetDIR): add tainted/frozen check for each dir operation.
-
-Mon May 15 17:42:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg):
- typo fixed. a patch from Florian Gross <florg at florg.net>.
-
-Sat May 13 16:14:05 2006 Tanaka Akira <akr@m17n.org>
-
- * lib/pp.rb (PP.mcall): new method.
- (Struct#pretty_print): call Kernel#class and Struct#members even if
- overridden.
- (Struct#pretty_print_cycle): ditto.
- [ruby-core:7865]
-
-Thu May 11 19:57:00 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * util.c (ruby_strtod): differ addition to minimize error.
- [ruby-dev:28619]
-
-Fri Aug 11 15:39:25 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/yaml/tag.rb: Replace nodoc with stopdoc so Module methods get
- documented.
-
-Thu May 11 18:10:43 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * util.c (ruby_strtod): should not raise ERANGE when the input
- string does not have any digits. [ruby-dev:28629]
-
-Sun May 7 03:09:51 2006 Stephan Maka <stephan@spaceboyz.net>
-
- * lib/resolv.rb (Resolv::DNS::Requester::ConnectedUDP#initialize):
- Use AF_INET6 for nameservers containing colons.
-
-Sat May 6 00:38:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * signal.c (trap): sig should be less then NSIG. Coverity found
- this bug. a patch from Kevin Tew <tewk at tewk.com>.
- [ruby-core:07823]
-
-Thu May 4 02:24:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/syck/emitter.c (syck_scan_scalar): avoid accessing
- uninitialized array element. a patch from Pat Eyler
- <rubypate at gmail.com>. [ruby-core:07809]
-
- * array.c (rb_ary_fill): initialize local variables first. a
- patch from Pat Eyler <rubypate at gmail.com>. [ruby-core:07810]
-
- * ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free
- type_tag. a patch from Pat Eyler <rubypate at gmail.com>.
- [ruby-core:07808]
-
-Wed May 3 02:12:07 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c (make_hostent_internal): accept ai_family
- check from Sam Roberts <sroberts at uniserve.com>.
- [ruby-core:07691]
-
-Mon May 1 12:23:19 2006 <sinara@blade.nagaokaut.ac.jp>
-
- * numeric.c (num_div): use floor rather than rb_Integer().
- [ruby-dev:28589]
-
- * numeric.c (flo_divmod): the first element of Float#divmod should
- be an integer. [ruby-dev:28589]
-
- * test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder.
-
-Sat Apr 29 22:42:08 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_asn1.c (ossl_asn1_decode0): should initialize
- flag. [ruby-core:07785]
-
-Fri Apr 28 10:53:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * util.c (ruby_strtod): should not cut off 18 digits for no
- reason. [ruby-core:07796]
-
- * util.c (ruby_strtod): fixed wrong conversion.
-
-Thu Apr 27 01:38:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * array.c (rb_ary_fill): internalize local variable "beg" to
- pacify Coverity. [ruby-core:07770]
-
-Wed Apr 26 16:59:24 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * pack.c (pack_unpack): now supports CRLF newlines. a patch from
- <tommy at tmtm.org>. [ruby-dev:28601]
-
-Tue Apr 25 18:00:05 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c (delete_slaves): maybe increment the reference
- count of a NULL Tcl_Obj [ruby-core:07759].
-
-Tue Apr 25 07:55:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/jcode.rb (String::tr_s): should have translated non
- squeezing character sequence (i.e. a character) as well. thanks
- to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]
-
-Tue Apr 25 00:08:24 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * regex.c (re_compile_pattern): should check if c is not a
- multibyte character. a patch from KIMURA Koichi
- <kimura.koichi at canon.co.jp>. [ruby-dev:28598]
-
-Fri Apr 21 15:19:13 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c (lib_eventloop_ensure): refer freed pointer
- [ruby-core:07744] and memory leak.
-
-Fri Apr 21 12:14:52 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c: document update patch from Sam Roberts
- <sroberts at uniserve.com>. [ruby-core:07701]
-
-Wed Apr 19 13:55:27 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (arg): too much NEW_LIST()
-
- * eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen.
-
-Wed Apr 19 11:57:04 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1.
- [ruby-dev:28585]
-
- * parse.y (list_concat): revert last change.
-
- * parse.y (arg): use NODE_ARGSCAT for placeholder.
-
-Wed Apr 19 11:13:17 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/getoptlong.rb (GetoptLong::get): RDoc update patch from
- mathew <meta at pobox.com>. [ruby-core:07738]
-
-Wed Apr 19 10:13:27 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * variable.c (rb_const_set): raise error when no target klass is
- supplied. [ruby-dev:28582]
-
-Wed Apr 19 09:49:36 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (list_concat): should not modify nodes other than
- NODE_ARRAY. [ruby-dev:28583]
-
-Tue Apr 18 17:40:37 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: add a binding to a container for a slave IP.
-
- * ext/tk/lib/tk.rb: update RELEASE_DATE.
-
- * ext/tk/tcltklib.c: forget to reset a Tcl interpreter.
-
- * ext/tk/stubs.c: fix potential bugs about handling rb_argv0.
-
-Tue Apr 18 00:11:21 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c: block_unique should be 1, not frame_unique.
- [ruby-dev:28577]
-
-Fri Aug 11 15:39:25 2006 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#find_body): Make RDoc
- ignore C function prototypes. Patch by Tilman Sauerbeck
- <tilman at code-monkey.de>. [ruby-core:8574]
- * lib/yaml/tag.rb: Replace nodoc with stopdoc so Module methods get
- documented.
-
-Mon Apr 10 01:03:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * prec.c (prec_prec_f): documentation patch from
- <gerardo.santana at gmail.com>. [ruby-core:07689]
-
-Sat Apr 8 02:34:34 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bignum.c (rb_big_pow): second operand may be too big even if
- it's a Fixnum. [ruby-talk:187984]
-
-Sat Apr 8 02:12:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * README.EXT: update symbol description. [ruby-talk:188104]
-
-Thu Apr 6 23:28:47 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * COPYING: explicitly note GPLv2. [ruby-talk:187922]
-
-Thu Apr 6 11:18:37 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/panedwindow.rb: lack of arguments. [ruby-core:7681]
-
-Thu Apr 6 01:04:47 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tcltklib.c: fix SEGV when embedding to an application.
- [ruby-core:7600]
-
- * ext/tk/tcltklib.c: fix SEGV at exit. [ruby-talk:186489]
-
- * ext/tk/tkutil/tkutil.c: follow to changing specification of
- instance_eval on ruby-1.9.x.
-
- * ext/tk/lib/tk.rb: ditto.
-
- * ext/tk/lib/multi-tk.rb: ditto.
-
- * ext/tk/lib/tk.rb: remove warning about redefinition of methods.
-
- * ext/tk/lib/tk/variable.rb: remove warning about unseting Tcl
- variables.
-
-Wed Mar 29 20:54:44 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (fole_getproperty): WIN32OLE#[] should accept
- multi arguments.
-
- * ext/win32ole/tests/testWIN32OLE.rb (test_setproperty_bracket): ditto.
-
-Wed Mar 29 10:07:44 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c (nkf_each_char_to_hex, encode_fallback_subchar,
- e2w_conv): support C90 compiler.
-
-Wed Mar 29 06:48:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (backtrace): reports aliased method names in a generated
- backtrace. a patch from "U.Nakamura" <usa at garbagecollect.jp>.
- [ruby-dev:28471]
-
-Mon Mar 27 22:19:09 2006 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/{nkf.c, utf8tbl.c, config.h}: imported nkf 2.0.6.
- * Add --ic / --oc option and mapping tables.
- * Add fallback option.
- * Add --no-best-fit-chars option.
- * Fix some bugs.
-
- * ext/nkf/nkf.c (nkf_split_options): added for parse option string.
-
- * ext/nkf/lib/kconv.rb (Kconv.to*): add -m0.
- Note that Kconv.to* still imply -X.
-
-Mon Mar 27 03:17:21 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): insecure calling should be checked for non
- NODE_SCOPE method invocations too.
-
- * eval.c (rb_alias): should preserve the current safe level as
- well as method definition.
-
-Fri Mar 24 23:14:30 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (yield_under_i): pass self again for instance_eval().
- [ruby-dev:28466]
-
-Fri Mar 24 17:20:03 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * process.c (rb_f_sleep): remove description about SIGALRM which
- is not valid on the current implementation. [ruby-dev:28464]
-
-Thu Mar 23 10:47:03 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (method_missing): should support argument splat in
- super. [ruby-talk:185438]
-
-Mon Mar 20 12:05:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * configure.in: Solaris SunPro compiler -rapth patch from
- <kuwa at labs.fujitsu.com>. [ruby-dev:28443]
-
-Mon Mar 20 09:40:23 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * configure.in: remove enable_rpath=no for Solaris.
- [ruby-dev:28440]
-
-Fri Mar 17 19:08:49 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ssl.c, ext/openssl/ossl_nsspki.c: fix typo.
- [ruby-core:07571]
-
-Wed Mar 15 16:54:21 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): support libraries without *.so.
-
-Wed Mar 15 16:35:43 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ssl.c, ext/openssl/ossl_nsspki.c: should use
- "rb_str_new(0, 0)" to make empty string.
-
-Sat Mar 11 14:24:06 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rdoc/ri/ri_formatter.rb (RI::TextFormatter::wrap): removed
- space before argument parenthesis. [ruby-talk:183630]
-
- * ruby.1: a clarification patch from David Lutterkort
- <dlutter at redhat.com>. [ruby-core:7508]
-
-Sat Mar 4 15:26:40 2006 Tanaka Akira <akr@m17n.org>
-
- * gc.c (id2ref): fix symbol test.
-
-Sat Mar 4 01:08:07 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems
- directories. a patch from Eric Hodel <drbrain at segment7.net>.
- [ruby-core:07423]
-
-Thu Mar 2 19:44:18 2006 Tanaka Akira <akr@m17n.org>
-
- * gc.c: align VALUE with sizeof(RVALUE) globally.
- (is_pointer_to_heap): check alignment out of loop.
- (id2ref): avoid collision between symbols and objects.
- (rb_obj_id): ditto. moved from object.c.
- [ruby-talk:178364] [ruby-core:7305]
-
-Thu Mar 2 18:58:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_thread_fd_writable): should not re-schedule output
- from KILLED thread (must be error printing).
-
-Thu Mar 2 17:57:49 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * gc.c: commited magic for reducing RVALUE size on windows. (24->20byte)
- [ruby-core:7474]
-
-Thu Mar 2 12:59:14 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (filetime_to_unixtime): should set tm_isdst to -1.
- stat() didn't treat daylight saving time property on WinNT.
- [ruby-talk:182100]
-
-Thu Mar 2 08:02:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * gc.c (add_heap): heap_slots may overflow. a patch from Stefan
- Weil <weil at mail.berlios.de>.
-
-Wed Mar 1 00:24:31 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/rdoc/parsers/parse_rb.rb (read_escape): could not handle /\^/.
- merged Mr. Ishizuka's lib/irb/ruby-lex.rb 's patch rev 1.29.
- [ruby-talk:181631] [ruby-dev:28404]
-
-Tue Feb 28 09:32:17 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/drb/extservm.rb (invoke_service_command): cannot invoke command
- if command name is quoted on mswin32. [ruby-dev:28400]
-
-Mon Feb 27 00:19:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ruby.h (SYM2ID): should not cast to signed long.
- [ruby-core:07414]
-
-Fri Feb 24 20:07:23 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * test/drb/drbtest.rb (add_service_command): quote pathnames in the
- server's command line for space contained directory names.
- Thanks, arton. [ruby-dev:28386]
-
-Fri Feb 24 12:11:08 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * instruby.rb: install *.exe.manifest and *.dll.manifest if exist.
- It's for VC++8.
-
-Fri Feb 24 11:33:52 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub (HAVE_HYPOT): bcc32 has hypot().
-
-Fri Feb 24 11:19:58 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * time.c (time_new_internal): add prototype to tell the compiler
- arugments types.
-
- * win32/win32.c (NtInitialize): need to set a handler for VC++8.
-
-Fri Feb 24 08:19:16 2006 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test.rb: Removed. Obsolete by test/nkf.
-
- * ext/.document: enabled documents in nkf and kconv
-
- * ext/nkf/nkf.c ext/nkf/lib/kconv.rb: Add rdoc.
-
-Thu Feb 23 22:39:59 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub: use borlndmm.dll if possible. bcc32's RTL internal
- memory manager cannot handle large memory block properly.
- ex: 10000.times { "" << "." * 529671; GC.start } # crash
- [ruby-dev:28230]
-
-Thu Feb 23 13:20:28 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * eval.c (SETUP_ARGS0): fixed memory corruption. [ruby-dev:28360]
-
-Tue Feb 21 02:18:46 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * configure.in (mingw): have link. [ruby-list:41838]
-
- * win32/Makefile.sub (config.h): ditto.
-
-Tue Feb 21 02:07:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (f_arglist): should set command_start = Qtrue for
- command body. [ruby-talk:180648]
-
-Mon Feb 20 17:37:26 2006 Tanaka Akira <akr@m17n.org>
-
- * mkconfig.rb: alias RbConfig for Config.
-
-Mon Feb 20 12:27:53 2006 Kent Sibilev <ksruby@gmail.com>
-
- * lib/rational.rb (Integer::gcd): small typo fix.
- [ruby-core:07395]
-
-Mon Feb 20 01:05:27 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rational.rb (Integer::gcd): replaced by gcd4 in
- [ruby-core:07390]. [ruby-core:07377]
-
-Mon Feb 20 00:57:02 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl.h (OSSL_Debug): should not use __func__.
- [ruby-dev:28339]
-
-Sun Feb 19 04:46:29 2006 Guy Decoux <ts@moulon.inra.fr>
-
- * eval.c: initial value for block_unique must be 1.
- [ruby-talk:180420]
-
-Sat Feb 18 23:58:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/tracer.rb (Tracer::Tracer.add_filter): turn on tracer mode
- only when caller() level size is one. [ruby-core:07389]
-
- * lib/rdoc/parsers/parse_rb.rb: need not to require "tracer".
- [ruby-core:07389]
-
- * sample/rtags.rb: ditto.
-
-Sat Feb 18 12:18:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/fileutils.rb (FileUtils::fu_world_writable): make it
- private. [ruby-core:07383]
-
-Sat Feb 18 00:22:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/tracer.rb: merged a minor clarification patch from Daniel
- Berger <Daniel.Berger at qwest.com>. [ruby-core:07376]
-
-Fri Feb 17 11:18:42 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * util.c (ruby_strtod): Float("1e") should fail. [ruby-core:7330]
-
- * pack.c (EXTEND32): unpack("l") did not work where sizeof(long) != 4.
- [ruby-talk:180024]
-
- * pack.c (pack_unpack): fixed integer overflow on template "w".
- [ruby-talk:180126]
-
-Fri Feb 17 09:39:29 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_thread_wait_for): sleep should always sleep for
- specified amount of time. [ruby-talk:180067]
-
-Thu Feb 16 01:10:48 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (backtrace): frame->orig_func may not be initialized.
- [ruby-core:07367]
-
-Wed Feb 15 16:52:52 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_eval): NODE_OP_ASGN1 should allow splat in its
- argument list. [ruby-core:07366]
-
- * parse.y (arg): avoid unnecessary extra argument.
- [ruby-core:07366]
-
- * eval.c (rb_eval): honor visibility on OP_ASGN1 and
- OP_ASGN2. [ruby-core:07366]
-
-Wed Feb 15 10:09:51 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (yield_under_i): should not pass self as an argument to
- the block for instance_eval. [ruby-core:07364]
-
-Wed Feb 15 09:20:35 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_obj_instance_eval): should be no singleton classes for
- true, false, and nil. [ruby-dev:28186]
-
-Tue Feb 14 18:48:33 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (DMETHOD_P): accessing wrong frame. [ruby-dev:28181]
-
- * eval.c (proc_invoke): preserve FRAME_DMETH flag.
-
-Tue Feb 14 15:13:51 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/zlib/zlib.c: supress warning on test/zlib. [ruby-dev:28323]
-
-Tue Feb 14 14:01:17 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * time.c (search_time_t): support non 32bit time_t environments.
-
- * win32/Makefile.sub (config.h): VC++8 has ``long long'' type.
-
- * win32/Makefile.sub (config.h): VC++8's time_t is 64bit value.
-
- * win32/win32.c (rb_w32_utime): drop read-only attribute before
- changing file time.
-
- all changes are backported from CVS HEAD.
-
-Tue Feb 14 11:21:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c (argf_forward): should not use frame->argv.
- [ruby-core:07358]
-
-Mon Feb 13 18:08:12 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): argument update propagation. [ruby-dev:28044]
-
- * env.h: remove argv member from struct FRAME.
-
-Mon Feb 13 13:27:00 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (eval): should push class from binding if supplied.
- [ruby-core:07347]
-
-Mon Feb 13 00:04:00 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/erb.rb (ERB::Compiler): add instance variable @insert_cmd to
- change <%='s behavior. (backported 1.15 - 1.16)
-
-Sat Feb 11 02:04:11 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (eval): no need to push ruby_class. [ruby-dev:28176]
-
-Sat Feb 11 01:57:44 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_f_autoload): check if ruby_cbase is nil (during
- instance_eval for objects cannot have singleton classes,
- e.g. fixnums and symbols). [ruby-dev:28178]
-
-Tue Feb 7 23:03:24 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/zlib/zlib.c: should not access ruby objects in finalizer.
- [ruby-dev:28286]
-
-Mon Feb 6 16:02:51 2006 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * file.c (rb_thread_flock): ERROR_NOT_LOCKED is not an error on Cygwin.
- In such situation, flock() should return 0.
-
-Mon Feb 6 00:41:08 2006 Tanaka Akira <akr@m17n.org>
-
- * ruby.h (RSTRUCT_LEN, RSTRUCT_PTR): defined for source level
- compatibility with ruby 1.9.
-
-Sun Feb 5 21:05:34 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * numeric.c (fix_to_s): removed workaround for radix 2. Historically,
- rb_fix2str could only handle radix 8, 10, 16. (Rev1.37) But for now,
- it can handle radix 2..36. [ruby-Bugs#3438] [ruby-core:7300]
-
-Sun Feb 5 18:55:08 2006 Minero Aoki <aamine@loveruby.net>
-
- * lib/net/http.rb: imported from trunk, rev 1.129
-
- * lib/net/http.rb (add_field, get_fields): keep 1.8.2 backward
- compatibility.
-
- * lib/net/https.rb: imported from trunk, rev 1.3.
-
- * lib/net/https.rb: #use_ssl? definition moved from net/http.rb.
-
-Sun Feb 5 14:22:15 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/pstore.rb: should return default value if name is not found.
- [ruby-core:7304]
-
- * lib/pstore.rb: should raise PStore::Error if not in transaction.
-
-Sat Feb 4 22:51:43 2006 Tanaka Akira <akr@m17n.org>
-
- * eval.c: apply the FreeBSD getcontext/setcontext workaround
- only before FreeBSD 7-CURRENT.
-
-Sat Feb 4 21:19:23 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (LK_ERR): ERROR_NOT_LOCKED is not an error.
- In such situation, flock() should return 0.
-
-Sat Feb 4 15:56:37 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * numeric.c (fix_to_s): (2**32).to_s(2) fails with exception where
- sizeof(int) == 4 < sizeof(long). [ruby-core:7300]
-
-Fri Feb 3 15:06:50 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/syck.c (syck_move_tokens): should reset p->cursor or etc
- even if skip == 0. This causes buffer overrun.
- (ex: YAML.load('--- "..' + '\x82\xA0' * 511 + '"'))
-
-Thu Feb 2 23:51:18 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/emitter.c (syck_emitter_write): should not set '\0' on
- emitter's marker. if marker points to the end of buffer, this causes
- buffer overrun. (ex: YAML.dump("." * 12288))
-
-Thu Feb 2 16:01:24 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (eval): need not to protect $SAFE value.
- [ruby-core:07177]
-
-Thu Feb 2 14:45:53 2006 Ville Mattila <ville.mattila@stonesoft.com>
-
- * configure.in: The isinf is not regognized by autoconf
- library guesser on solaris 10. [ruby-core:7138]
-
-Wed Feb 1 22:01:47 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * configure.in, hash.c (ruby_setenv): use setenv(3) and unsetenv(3)
- where they are supported. modifing environ variable seems to
- segfault solaris 10. [ruby-core:7276] [ruby-dev:28270]
-
- * ruby.c (set_arg0): if use setenv(3), environ space cannot be used
- for altering argv[0].
-
-Tue Jan 31 14:46:28 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * struct.c (rb_struct_select): update RDoc description.
- [ruby-core:7254]
-
-Tue Jan 31 11:58:51 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: add MultiTkIp#eval and bg_eval.
-
- * ext/tk/lib/tk/namespace.rb: TkNamespace#eval was enbugged at the
- last commit. Now it will return a proper object.
-
-Tue Jan 31 00:10:26 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/rubyext.c (syck_resolver_transfer): workaround for SEGV.
- ex: ruby -ryaml -e 'YAML.load("!map:B {}")' [ruby-core:7217]
-
-Sat Jan 28 07:56:57 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/rdoc/usage.rb: support "a:0:33" style caller[-1]. In this case
- file name is "a:0". I don't know this really happens though...
- [ruby-Bugs:3344]
-
-Wed Jan 25 22:29:04 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in, dln.c, file.c, intern.h, missing.h (eaccess): use
- system routine if provided. fixed: [ruby-core:07195]
-
-Sun Jan 22 23:27:13 2006 Go Noguchi <gonoguti@yahoo.co.jp>
-
- * lib/test/unit/autorunner.rb (process_args): ignore arguments after
- '--' so that test scripts can handle them. fixed: [ruby-dev:28258]
-
-Sun Jan 22 22:09:52 2006 Tanaka Akira <akr@m17n.org>
-
- * eval.c (POST_GETCONTEXT): define separately from PRE_GETCONTEXT on
- IA64 to avoid reusing variable address.
-
-Sun Jan 22 20:03:35 2006 Tanaka Akira <akr@m17n.org>
-
- * eval.c (ruby_setjmp): define PRE_GETCONTEXT and POST_GETCONTEXT
- instead of FUNCTION_CALL_MAY_RETURN_TWICE.
- define PRE_GETCONTEXT to clear carry flag for workaround of
- FreeBSD/i386 getcontext/setcontext bug.
- [ruby-dev:28263]
-
-Sat Jan 21 00:36:47 2006 Tanaka Akira <akr@m17n.org>
-
- * eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): use only on SPARC and IA64
- before gcc 4.0.3.
- [ruby-dev:28247]
-
-Thu Jan 19 22:21:23 2006 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (mv): should remove file after copying.
- [ruby-dev:28223]
-
-Wed Jan 18 23:37:06 2006 Tanaka Akira <akr@m17n.org>
-
- * eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): don't clobber %l7 of SPARC
- if enable-shared.
- (ruby_setjmp): call FUNCTION_CALL_MAY_RETURN_TWICE after getcontext
- too.
- reported by Pav Lucistnik and Marius Strobl.
- http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
-
-Tue Jan 17 11:32:46 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/setup.mak (MAKE): workaround for nmake 8.
-
-Tue Jan 17 11:10:21 2006 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/{Makefile.sub,setup.mak}: invoke .bat via shell. workaround
- for nmake 8.
-
-Mon Jan 16 10:26:23 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/emitter.c (syck_emit_seq, syck_emit_map, syck_emit_item):
- should output complex key mark even if map's key is empty seq/map.
- [ruby-core:7129]
-
-Sat Jan 14 05:37:06 2006 Tanaka Akira <akr@m17n.org>
-
- * io.c (READ_DATA_PENDING, READ_DATA_PENDING_COUNT): defined
- for DragonFly BSD 1.4.0.
-
-Sat Jan 14 03:43:24 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * file.c (rb_file_s_chmod): avoid warning where sizeof(int) !=
- sizeof(void*).
-
-Fri Jan 13 19:14:56 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/rdoc/diagram.rb:
- - properly quote bare element attributes
- - terminates dangling elements (e.g. <img>, <br>, <link>, etc)
- - converts "CVS" to the more HTML-friendly acronym element
- - adds missing type attributes to style elements
-
- based on Paul Duncan's patch <pabs@pablotron.org> [ruby-core:7028]
-
- * lib/rdoc/generators/html_generator.rb: ditto.
- * lib/rdoc/generators/template/html/hefss.rb: ditto.
- * lib/rdoc/generators/template/html/html.rb: ditto.
- * lib/rdoc/generators/template/html/kilmer.rb: ditto.
-
-Thu Jan 12 11:53:08 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/sample/tkballoonhelp.rb: [bug fix] couldn't add to a widget
- which is constructed with TkComposite module.
- [new feature] support 'command' option which is called just before
- popping up the balloon help.
-
-Wed Jan 11 15:00:00 2006 Ville Mattila <mulperi@iki.fi>
-
- * io.c (READ_PENDING*): Support solaris 64-bit environments.
- Solaris defines a opaque FILE struct when compiling 64 bit
- binaries. This means that we dont have access to _ptr etc.
- members anymore. The solution by Steven Lumos is to define
- FILE64 that has needed members available. I've modified
- the origanal patch a bit so that it compiles both with gcc
- and now free sun studio 11 compiler and both amd64 and sparc.
- NOTE! We have to 64 bit solaris FILE structure time to time
- otherwise we'll get breakage.
- [ruby-core:7106]
-
-Tue Jan 10 19:42:33 2006 Tanaka Akira <akr@m17n.org>
-
- * gc.c (garbage_collect): mark ruby_current_node.
- if an exception is raised in a finalizer called written in C by
- rb_gc_call_finalizer_at_exit, ruby_set_current_source may use
- collected ruby_current_node and mark_source_filename may corrupt
- memory.
-
-Tue Jan 10 13:30:34 2006 akira yamada <akira@ruby-lang.org>
-
- * ext/syck/rubyext.c (syck_resolver_transfer): should be able to load
- !ruby/object:Bignum syntax 1.8.3 dumped. [ruby-core:6159]
-
-Tue Jan 10 12:47:41 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/yaml/rubytypes.rb (Fixnum): Bignum could not be loaded in
- ruby 1.8.3/1.8.4. [ruby-core:6115]
-
- * lib/yaml/rubytypes.rb (Numeric): Subclass of Numeric could not
- be dumped properly. [ruby-core:7047]
-
-Tue Jan 10 12:00:48 2006 Aaron Schrab <aaron @nospam@ schrab.com>
-
- * lib/yaml/rubytypes.rb (Symbol#yaml_new): YAML loading of quoted
- Symbols broken. [ruby-Bugs:2535]
-
-Mon Jan 9 19:54:35 2006 arton <artonx@yahoo.co.jp>
-
- * ext/zlib/extconf.rb: zlib compiled DLL version 1.2.3 distributed by
- http://www.zlib.net/ has zdll.lib. [ruby-dev:28209]
-
-Mon Jan 9 14:17:12 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/Makefile.sub (OPTFLAGS): I have experienced trouble on y- flag,
- (VisualC++6) so use -O2b2xg- if $(MSC_VER) < 1400. [ruby-core:7040]
-
-Mon Jan 9 14:17:12 2006 Kero van Gelder <rubyforge @nospam@ kero.tmfweb.nl>
-
- * lib/webrick/httpservlet/filehandler.rb: fixed typo. [ruby-core:7075]
-
-Sat Jan 7 15:40:07 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (singleton): get rid of segfault on syntax error.
- fixed: [ruby-core:07070]
-
-Fri Jan 6 10:16:20 2006 Steven Lumos <steven@lumos.us>
-
- * io.c (READ_DATA_PENDING): defined for 64bit Solaris on SPARC.
- [ruby-core:7057]
- (READ_DATA_PENDING_COUNT): ditto.
- (READ_DATA_PENDING_PTR): ditto.
-
-Sun Jan 1 17:07:59 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (rb_w32_seekdir): should not segfault even if passed
- the location which rb_w32_telldir didn't return. [ruby-core:7035]
- (I think HEAD implementation is better. but binary compatibility)
-
- * test/ruby/test_dir.rb: added.
-
-Sat Dec 31 22:57:00 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_thread_save_context): should not recycle scope object used
- in a thread. fixed: [ruby-dev:28177]
-
-Fri Dec 30 18:22:42 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (garbage_collect): mark objects refered from aborting threads.
- [ruby-dev:28190]
-
- * win32/Makefile.sub: VC++8 support.
-
-Fri Dec 30 14:24:53 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * dir.c (glob_helper): do not use TRUE for djgpp.
-
-Fri Dec 30 04:54:40 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (eaccess): workaround for VC++8 runtime.
-
- * win32/win32.c (ioinfo): VC++8 support.
-
-Thu Dec 29 23:59:37 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_gc_mark_threads): leave unmarked threads which won't wake
- up alone, and mark threads in the loading table. [ruby-dev:28154]
-
- * eval.c (rb_gc_abort_threads), gc.c (gc_sweep): kill unmarked
- threads. [ruby-dev:28172]
-
-Thu Dec 29 17:02:07 2005 Tanaka Akira <akr@m17n.org>
-
- * test/ruby/envutil.rb (EnvUtil.rubybin): search "ruby" instead of
- "miniruby". [ruby-dev:28140]
-
-Tue Dec 27 16:59:52 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * test/drb/drbtest.rb (DRbService::self.ext_service): increase
- timeout limit. a patch from Kazuhiro NISHIYAMA
- <zn at mbf.nifty.com>. [ruby-dev:28132]
-
-Tue Dec 27 08:29:18 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLSocket#post_connection_chech):
- treat wildcard character in commonName. [ruby-dev:28121]
-
-Mon Dec 26 22:32:47 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_eval), gc.c (gc_mark_children), node.h (NEW_ALIAS,
- NEW_VALIAS), parse.y (fitem): allow dynamic symbols to
- NODE_UNDEF and NODE_ALIAS.
- backported from trunk. fixed: [ruby-dev:28105]
-
-Mon Dec 26 08:50:36 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (ev_const_get): fixed a bug in constant reference during
- instance_eval. [yarv-dev:707]
-
- * eval.c (ev_const_defined): ditto.
-
- * lib/yaml.rb (YAML::add_domain_type): typo fixed. a patch from
- Joel VanderWerf <vjoel at path.berkeley.edu>.
- [ruby-talk:165285] [ruby-core:6995]
-
-Sat Dec 24 18:58:14 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * stable version 1.8.4 released.
-
-Fri Dec 23 10:30:23 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/digest/sha2/sha2.c (ULL): support AIX C. a patch from
- Kailden <kailden at gmail.com>. [ruby-core:06984]
-
-Wed Dec 21 16:53:06 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * file.c (w32_io_info): should return handle because FileIndex is
- valid only while file is open. [ruby-dev:28088]
-
-Wed Dec 21 14:53:26 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/pathname.rb (test_kernel_open): use File.identical?.
- [ruby-talk:171804]
-
-Tue Dec 20 22:41:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (eval_under_i): evaluate source in caller's frame.
- [ruby-dev:28076]
-
- * eval.c (rb_call_super): use original method name on exception.
- [ruby-dev:28078]
-
-Tue Dec 20 13:11:59 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/rubyext.c: fixed GC problem (backported HEAD 1.55 - 1.62)
- [ruby-dev:27839]
-
- * ext/syck/syck.h (S_FREE): small hack. no need to check if pointer is
- NULL or not before S_FREE.
-
- * st.c: uses malloc instead of xmalloc to avoid GC. syck uses st_insert
- in gram.c to insert node from rb_syck_bad_anchor_handler into
- SyckParser's hash table. if GC occurs in st_insert, it's not under
- SyckParser's mark system yet. so RString can be released wrongly.
- [ruby-dev:28057]
-
-Tue Dec 20 12:53:23 2005 why the lucky stiff <why@ruby-lang.org>
-
- * ext/syck/rubyext.c (syck_emitter_reset): to ensure compatibility
- with previous Ruby versions, documents are no longer headless.
-
-Tue Dec 20 01:46:48 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (rb_f_backquote): fix a GC problem on
- IA64 with gcc 4.0.3 20051216 (prerelease) -O3.
-
-Mon Dec 19 23:32:39 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_symname_p): fixed wrong validation. [ruby-dev:28047]
-
-Sat Dec 17 03:57:01 2005 Tanaka Akira <akr@m17n.org>
-
- * bignum.c (rb_big_rshift): fix a GC problem on
- IA64 with gcc 4.0.3 20051216 (prerelease).
-
-Sat Dec 17 03:30:23 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (bmcall): fix a GC problem by tail call on
- IA64 with gcc 4.0.3 20051216 (prerelease).
-
-Fri Dec 16 00:54:06 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * signal.c (Init_signal): revert C++ style comment.
- [ruby-dev:28041]
-
-Thu Dec 15 12:35:14 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/tmpdir.rb: merged RDoc patch from Eric Hodel <drbrain at
- segment7.net>. [ruby-core:06894]
-
-Thu Dec 15 01:33:31 2005 Tanaka Akira <akr@m17n.org>
-
- * ext/zlib/zlib.c (zstream_run): fix a GC problem by tail call on
- x86_64 with gcc 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)
-
-Wed Dec 14 12:11:46 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * test/gdbm/test_gdbm.rb: specify pid for the argument of
- Process.wait. workaround for Cygwin.
-
-Wed Dec 14 12:01:26 2005 Tanaka Akira <akr@m17n.org>
-
- * marshal.c (r_object0): fix a GC problem for reading a bignum on
- IA64 with gcc 3.3.5 (Debian 1:3.3.5-13).
-
-Tue Dec 13 12:23:47 2005 Tanaka Akira <akr@m17n.org>
-
- * re.c (rb_reg_regcomp): fix a GC problem on x86_64 with
- gcc 3.3.5 (Debian 1:3.3.5-13).
-
-Tue Dec 13 01:44:16 2005 Tanaka Akira <akr@m17n.org>
-
- * array.c (rb_ary_diff): fix a GC problem on IA64 with
- gcc 3.3.5 (Debian 1:3.3.5-13).
- When rb_ary_push is called, there was no register which contains
- `hash' but `&RHASH(hash)->tbl' instead.
-
-Tue Dec 13 00:08:09 2005 Tanaka Akira <akr@m17n.org>
-
- * sprintf.c (rb_str_format): fix a GC problem.
- [ruby-dev:28001]
-
-Mon Dec 12 15:54:56 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * test/openssl/test_ssl.rb (test_parallel): call GC.start to close
- unused files. [ruby-dev:27981]
-
-Mon Dec 12 00:33:56 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/digest/digest.c (rb_digest_base_s_digest): add volatile to
- protect temporary context object. [ruby-dev:27979]
-
- * ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should
- be called before actual variable initialization.
- [ruby-dev:27986]
-
-Fri Dec 9 23:31:02 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rexml/encoding.rb (encoding=): give priority to particular
- conversion to iconv. [ruby-core:06520]
-
-Thu Dec 8 02:07:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (umethod_bind): adjust invoking class for module method.
- [ruby-dev:27964]
-
-Thu Dec 8 00:40:52 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (call_trace_func): klass parameter should be a
- class/module that defines calling method. [ruby-talk:169307]
-
-Wed Dec 7 17:10:27 2005 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * sprintf.c (rb_f_sprintf): [ruby-dev:27967]
-
-Wed Dec 7 15:31:35 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * sprintf.c (rb_str_format): integer overflow check added.
-
- * sprintf.c (GETASTER): ditto.
-
-Wed Dec 7 01:02:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/README.macosx-aqua: [new document] tips to avoid the known
- bug on platform specific dialogs of Tcl/Tk Aqua on MacOS X.
-
- * ext/tk/tcltklib.c: fix bug on switching threads and waiting on the
- deleted interpreter on vwait and tkwait command.
-
- * ext/tk/lib/multi-tk.rb: kill the meaningless loop for the deleted Tk
- interpreter.
-
- * ext/tk/sample/demos-jp/image3.rb: [bug fix] wrong argument.
-
- * ext/tk/sample/demos-en/image3.rb: ditto.
-
- * ext/tk/sample/demos-jp/menu.rb: fix message for MacOS X.
-
- * ext/tk/sample/demos-jp/menu8x.rb: ditto.
-
- * ext/tk/sample/demos-en/menu.rb: ditto.
-
-Tue Dec 6 16:37:57 2005 Yuya Nishida <yuya@j96.org>
-
- * eval.c (exec_under): avoid accessing ruby_frame->prev.
- [ruby-dev:27948]
-
-Thu Dec 1 00:50:33 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_funcall2): allow to call protected methods.
- fixed: [ruby-dev:27890]
-
-Wed Nov 30 23:52:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (NEWHEAP, ADD2HEAP): set count after pointer was set.
- fixed: [ruby-dev:27896]
-
-Wed Nov 30 13:43:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-expr-beg): support $! at the end of
- expression. [ruby-dev:27868]
-
-Mon Nov 28 18:55:43 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/socket/socket.c (init_inetsock_internal): remove setting
- SO_REUSEADDR option on server socket on Cygwin.
- fixed: [ruby-core:6765] ([ ruby-Bugs-2872 ])
-
-Mon Nov 28 13:08:54 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (rb_w32_strerror): remove all CR and LF. (avoid broken
- error message on bccwin32 + winsock)
-
-Mon Nov 28 09:21:49 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/mkmf.rb (create_makefile): should not change sodir with
- dir.gsub!. (bccwin32 failed to install third party exntesions)
- [ruby-dev:27834]
-
-Sun Nov 27 00:56:13 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/wsdl/xmlSchema/complexContent.rb: missing
- ComplexContent#elementformdefault method.
-
-Sat Nov 26 19:57:45 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * dln.c (conv_to_posix_path): should initialize posix.
-
-Thu Nov 24 21:05:58 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * configure.in (AC_CHECK_FUNCS): need to check link().
- fixed: [ruby-dev:27814]
-
-Thu Nov 24 01:22:25 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * file.c (w32_io_info): CreateFile failed on Win9x if file was already
- opened. (FILE_SHARE_READ was needed, but actually I don't understand
- the flags of CreateFile well...)
-
-Wed Nov 23 20:59:01 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: add Tk.pkgconfig_list and Tk.pkgconfig_get
- [Tk8.5 feature].
-
- * ext/tk/lib/tk/text.rb: supports new indices modifires on a Text
- widget [Tk8.5 feature].
-
- * ext/tk/lib/tk/virtevent.rb: add TkNamedVirtualEvent.
-
- * ext/tk/lib/tk/autoload.rb: ditto.
-
- * ext/tk/lib/tk/event.rb: add :data key for virtual events [Tk8.5
- feature].
-
-Wed Nov 23 18:55:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * file.c (w32_io_info): should not call GetFileInformationByHandle
- for pipe.
-
- * file.c (w32_io_info): checks return value from rb_w32_get_osfhandle.
-
- * file.c (w32_io_info): now can identify directory on WinNT.
-
-Wed Nov 23 03:40:49 2005 Guy Decoux <ts@moulon.inra.fr>
-
- * re.c (KR_REHASH): should cast to unsigned for 64bit CPU.
- [ruby-core:06721]
-
-Wed Nov 23 11:01:33 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * intern.h, file.c: failed to compile on windows.
-
-Wed Nov 23 07:26:44 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/extconf.rb: check for X509V3_EXT_nconf_nid.
-
- * ext/openssl/ossl_x509ext.c (MakeX509ExtFactory): should use
- OPENSSL_malloc to allocate X509V3_CTX.
-
- * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_create_ext): use
- X509V3_EXT_nconf_nid to avoid SEGV (and to build extensions which
- values are placed in separate section).
-
- * test/openssl/test_x509ext.rb: new file.
-
-Wed Nov 23 01:22:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (test_identical): test if two files are identical.
-
- * file.c (rb_f_test): support DOSISH systems where st_ino is not
- reliable. fixed: [ruby-core:06672]
-
- * win32.h, win32.c (rb_w32_osid): check the running platform.
-
-Tue Nov 22 23:52:06 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optparse.rb: match incomplete (in current enconding) multibyte
- string. http://inamode6.tokuhirom.dnsalias.org/show/1551
-
-Tue Nov 22 18:36:11 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (winnt_stat): set mapped errno instead of ENOENT.
-
-Tue Nov 22 14:46:57 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_file_s_basename): skip slashes just after UNC top slashes.
-
- * test/ruby/test_path.rb (test_dirname, test_basename): follow new
- spec. and add new tests.
-
-Tue Nov 22 13:18:32 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (rb_w32_stat): Dir.chdir('//server/shared');
- p Dir.glob('*') should work on WinNT. (implemented our own
- stat(2) on WinNT) [ruby-list:41552] [ruby-dev:27711]
-
-Tue Nov 22 02:31:53 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tkextlib/tile.rb: bug fix (Tk::Tile::USE_TTK_NAMESPACE
- is not defined).
-
-Tue Nov 22 01:45:21 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_s_basename): DOSISH_UNC is defined on cygwin but
- DOSISH is not. fixed: [ruby-dev:27797]
-
-Mon Nov 21 22:50:48 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_path_skip_prefix, rb_file_s_basename): UNC without path
- should not be splitted. fixed: [ruby-dev:27776] [ruby-dev:27786]
-
- * parse.y (dsym): prohibit empty symbol literal by interpolation.
- fixed: [ruby-talk:166529]
-
-Mon Nov 21 16:03:48 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/setup.mk: findstr doesn't exist on win9x.
- fixed: [ruby-dev:27756]
-
-Sun Nov 20 22:34:06 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_symname_p): [ not followed by ] is not valid symbol.
- fixed: [ruby-talk:166520]
-
-Sat Nov 19 19:57:54 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/fileutils.rb (FileUtils::ln): ln documentation fix.
- [ruby-core:06661]
-
-Sat Nov 19 07:34:32 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/font.rb: remove dependency on Ruby's version (1.8
- or 1.9).
-
- * ext/tk/lib/tkextlib/ICONS/icons.rb: ditto.
-
- * ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.
-
-Fri Nov 18 17:57:08 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_file_s_dirname): should use skipprefix for UNC path.
- pointed out by nobu ([ruby-dev:27744]). fixed: [ruby-core:5076]
-
-Fri Nov 18 17:35:09 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: add restriction to access the entried
- command table and manipulate other IPs (for reason of security).
- Now, a IP object can be controlled by only its master IP or the
- default IP.
-
- * ext/tk/lib/remote-tk.rb: add restriction to manipulate.
-
- * ext/tk/tcltklib.c (ip_is_slave_of_p): add TclTkIp#slave_of?(ip)
- to check manipulability.
-
- * ext/tk/lib/tk.rb: bug fix on handling of Tcl's namespaces.
-
- * ext/tk/lib/tk/namespace.rb: ditto.
-
-Fri Nov 18 17:26:06 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_file_s_dirname): added checks for some patterns with drive
- letter. fixed: [ruby-dev:27738]
-
- * test/ruby/test_path.rb (test_dirname): added tests for above
- patterns.
-
-Fri Nov 18 12:18:02 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.h (S_IFIFO): r,w = IO.pipe; r.stat.pipe? now
- returns true on VisualC++6.
-
-Wed Nov 16 23:24:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (static-ruby): overridable.
-
- * ext/extmk.rb (parse_args): force to link extensions statically only
- if static is given for extstatic.
-
- * ext/extmk.rb (RUBY, RUBYW): overridable.
-
-Tue Nov 15 23:46:35 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/find.rb (Find::find): should not ignore symbolic links to
- non-existing files. [ruby-talk:165866]
-
-Tue Nov 15 16:23:26 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * array.c (rb_ary_fill): previous commit disabled this usage:
-
- a = [0,1,2,3,4,5,6,7,8,9]
- a.fill {|i| a[i] * 10} #=> [nil, nil, ...., nil]
-
- previous commit has the advantage of early garbage collection, but
- potensially this would break some script. so I reverted behavior.
-
-Tue Nov 15 16:04:10 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * array.c (rb_ary_fill): tail elements were vanished when the middle
- part of array was filled. (ie: [0,1,2,3,4].fill(-1,2,1) => [0,1,-1])
-
- * test/ruby/test_array.rb (test_fill): added.
-
-Tue Nov 15 14:39:16 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * array.c (rb_ary_fill): should adjust array length correctly when
- an array is expanded in the fill process. [ruby-core:06625]
-
-Mon Nov 14 23:49:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_s_readlink): ERANGE will occur only on GPFS.
- [ruby-dev:27699]
-
-Mon Nov 14 17:36:22 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * array.c (rb_ary_first): RDoc update from Daniel Berger
- <djberg96@yahoo.com>. [ruby-core:06577].
-
-Fri Nov 11 10:31:44 2005 Zach Dennis <zdennis@mktec.com>
-
- * ext/socket/socket.c: Socket Documentation. [ruby-core:6552]
-
-Fri Nov 11 08:20:56 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in (OUTFLAG): keep trailing spaces. [ruby-dev:27666]
-
- * mkconfig.rb: substitution refereces added.
-
-Fri Nov 11 07:44:18 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * configure.in: undef HAVE_LINK on BeOS. (link(2) always returns
- EINVAL, and this causes error in test/fileutils.)
-
- * file.c: overwride chown(2) and fchown(2) on BeOS. (these functions
- should not change user/group id if -1 is passed as corresponding
- argument, and this causes error in test/fileutils too)
- [ruby-dev:27672]
-
- * file.c (rb_file_s_link): checks HAVE_LINK.
-
-Tue Nov 8 15:32:27 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/drb/ssl.rb (DRb::SSLConfig#accept): fixed typo.
- [ruby-dev:27560] [ruby-core:4627]
-
-Mon Nov 7 13:43:51 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/stubs.c (_nativethread_consistency_check): use simpler
- (low cost) way to check whether the Tcl interpreter was compiled
- with threads enabled of not.
-
- * ext/tk/tcltklib.c: reduce warnings.
-
- * ext/tk/tkutil/tkutil.c: ditto.
-
-Mon Nov 7 00:06:58 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/yaml.rb: removed :nodoc: to generate Kernel doc. [ruby-core:6324]
-
-Sun Nov 6 23:39:13 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/iconv/iconv.c (Iconv::BrokenLibrary): exception when detected a
- bug of underlying library.
-
-Sun Nov 6 21:46:59 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tk/stubs.c (ruby_tcl_create_ip_and_stubs_init): should touch
- interpreter after initialization is done. [ruby-dev:27638]
-
-Sun Nov 6 20:13:27 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_s_readlink): readlink(2) on AIX fails with ERANGE if
- buffer size is less than required. fixed: [ruby-dev:27634]
-
-Wed Nov 2 20:25:28 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/extconf.rb: ext/tk/extconf.rb: change the check parameter
- for Win32.
-
-Wed Nov 2 20:14:53 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib: merge into ext/tk and remove.
-
-Wed Nov 2 19:03:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_rbUpdateObjCmd,
- ip_rb_threadUpdateObjCmd): passed improper flags to DoOneEvent().
-
- * ext/tk/tkutil.c: use rb_obj_respond_to() instead of rb_respond_to().
-
-Tue Nov 1 14:20:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call_super): should call method_missing if super is
- called from Kernel method.
-
- * eval.c (exec_under): frame during eval should preserve external
- information.
-
-Tue Nov 1 10:50:17 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/extconf.rb: should check ERR_peek_last_error().
- [ruby-dev:27597]
-
- * ext/openssl/ossl.c (ossl_raise): ditto.
-
-Mon Oct 31 17:34:46 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * configure.in: use proper option for Sun linker. A patch from
- Shinya Kuwamura <kuwa at labs.fujitsu.com>. [ruby-dev:27603]
-
-Mon Oct 31 11:27:22 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/gdbm/test_gdbm.rb, test/sdbm/test_sdbm.rb (test_s_open_error):
- skip on Win32/DOS platforms.
-
-Mon Oct 31 05:49:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_cipher.c (ossl_cipher_update): input data must
- not be empty. [ruby-talk:161220]
-
- * test/openssl/test_cipher.rb: add test for Cipher#update("").
-
-Mon Oct 31 05:37:20 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/httpservlet/cgihandler.rb
- (WEBrick::HTTPServlet::CGIHandler#do_GET): the value of Set-Cookie:
- header field should be splited into each cookie. [ruby-Bugs:2199]
-
- * lib/webrick/cookie.rb (WEBrick::Cookie.parse_set_cookie): new method
- to parse the value of Set-Cookie: header field.
-
- * test/webrick/test_cookie.rb, test/webrick/test_cgi.rb,
- test/webrick/webrick.cgi: add some test for cookie.
-
-Mon Oct 31 03:19:36 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/readline/readline.c (readline_readline): type check.
- [ruby-core:6089]
-
- * numeric.c (fix_rshift): RDoc fix. [ruby-core:6351]
-
- * util.h (strtod): add #undef for platforms defines strtod()
- macro. [ruby-dev:27563]
-
-Mon Oct 31 02:35:59 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * test/ruby/test_float.rb (test_precision): test by assert_in_delta.
- [ruby-dev:27575]
-
-Sat Oct 29 01:58:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/etc/etc.c: document update from mathew <meta@pobox.com>.
- [ruby-core:06473]
-
- * ext/fcntl/fcntl.c: ditto.
-
-Thu Oct 27 16:45:31 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (scan_once): wrong condition to use mbclen2().
- [ruby-dev:27535]
-
-Wed Oct 26 09:27:27 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/implicit.c (syck_type_id_to_uri): should return
- newly allocated memory. otherwise, type_id will be freed
- twice. [ruby-dev:27384] [ruby-core:6385]
-
-Wed Oct 26 09:04:51 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ruby.h (Qfalse, Qtrue, Qnil, Qundef): make sure these immediate
- values have VALUE type. there is an environment where sizeof(VALUE)
- != sizeof(int) like IA64. if 32bit integer (Qtrue) is passed to ANYARGS
- and received by 64bit integer (VALUE), upper bits may have garbage value.
- [ruby-dev:27513]
-
-Wed Oct 26 01:58:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_EXTERN): macro to export symbols in shared
- library. [ruby-core:05528]
-
- * defines.h, {bcc32,win32,wince}/Makefile.sub (RUBY_EXTERN): moved to
- configuration pass.
-
- * ext/extmk.rb (extmake): RUBY_EXTERN for static linked extensions.
-
-Tue Oct 25 15:32:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/rational.rb: applied documentation patch from Gavin Sinclair
- <gsinclair@gmail.com>. [ruby-core:06364]
-
- * lib/irb.rb (IRB::Irb::eval_input): handle prompts with newlines
- in irb auto-indentation mode. [ruby-core:06358]
-
-Tue Oct 25 02:12:08 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rdoc/markup/simple_markup.rb (SM::SimpleMarkup::LABEL_LIST_RE):
- reduce redundant backtrack. [ruby-talk:161771]
-
-Tue Oct 25 00:27:35 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/rinda/*: RDoc documentation from Eric Hodel
- <drbrain@segment7.net> added.
-
-Mon Oct 24 21:14:29 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in, io.c: use sys/syscall.h if syscall.h is not available.
- [ruby-core:06247]
-
-Mon Oct 24 20:49:45 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/Win32API/lib/win32/resolv.rb (get_info): support multiple DNS.
- fixed: [ruby-list:40058], [ruby-dev:27479]
-
-Mon Oct 24 07:57:56 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/tk/lib/tk/canvas.rb (TkCanvasItemConfig::__item_val2ruby_optkeys):
- typo fixed. [ruby-talk:162187]
-
- * ext/tk/lib/tk/menu.rb (TkMenuEntryConfig::__item_val2ruby_optkeys):
- ditto. [ruby-core:06359]
-
-Sun Oct 23 21:50:15 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/enumerator/enumerator.c: applied documentation patch from
- James Edward Gray II <james@grayproductions.net>.
- [ruby-core:06348]
-
-Sun Oct 23 07:11:11 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/extconf.rb: improve messages [ruby-core:06325].
-
- * ext/tk/lib/tk.rb, ext/tk/lib/tk/canvas.rb, ext/tk/lib/tk/entry.rb,
- ext/tk/lib/tk/frame.rb, ext/tk/lib/tk/image.rb,
- ext/tk/lib/tk/itemconfig.rb, ext/tk/lib/tk/labelframe.rb,
- ext/tk/lib/tk/listbox.rb, ext/tk/lib/tk/menu.rb,
- ext/tk/lib/tk/radiobutton.rb, ext/tk/lib/tk/scale.rb,
- ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tk/text.rb,
- ext/tk/lib/tk/toplevel.rb: improve conversion of option values.
-
- * ext/tk/lib/tkextlib/*: ditto.
-
- * ext/tk/lib/tkextlib/*: update to support ActiveTcl8.4.11.2.
-
- * ext/tk/lib/tkextlib/trofs/*: support Trofs 0.4.3.
-
- * ext/tk/lib/tkextlib/tile/*: support Tile 0.7.2.
-
- * ext/tk/lib/tkextlib/vu/*: support vu 2.3.0.
-
- * ext/tk/lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3).
-
-Sat Oct 22 23:54:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb, lib/mkmf.rb (with_config): support --with-extension
- options. [ruby-dev:27449]
-
-Sat Oct 22 13:26:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (sym_inspect), parse.y (parser_yylex, rb_symname_p): check
- if valid as a symbol name more strictly. [ruby-dev:27478]
-
- * test/ruby/test_symbol.rb: tests for [ruby-core:03573].
-
- * time.c (rb_strftime): removed meaningless volatile modifiers, and
- concatenate successive nul characters at once. [ruby-dev:27472]
-
-Fri Oct 21 19:21:56 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * rubysig.h (CHECK_INTS): fixed typo. (I believe bit-or is improper)
-
-Fri Oct 21 17:49:32 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bin/erb (ERB::Main::run): typo fixed. [ruby-core:06337]
-
-Fri Oct 21 15:27:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bignum.c (bignew_1): convertion from `int' to `char' discards
- upper bits, (ie. (char)0xff00 -> 0) so it's better to test if
- nonzero and set 0 or 1 instead of simply casting ... as a flag usage.
- (but I believe this won't cause actual bug in current implementation)
- [ruby-dev:27055]
-
- * time.c: should use LONG_LONG instead of `long long'.
-
-Thu Oct 20 09:37:15 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/mkmf.rb (create_makefile): Borland make seems not to allow
- empty dependency list. If this change is not good, please correct
- it.
-
-Thu Oct 20 07:55:09 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): get rid of a restriction
- of Borland make. fixed: [ruby-dev:27460]
-
-Thu Oct 20 00:13:18 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * rubysig.h (CHECK_INTS): fix typo.
-
-Wed Oct 19 23:58:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): do not create unnecessary empty
- directories. fixed: [ruby-dev:27451]
-
-Wed Oct 19 19:26:15 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_gc_mark_parser): get rid of segfault with old yacc.
- fixed: [ruby-dev:27439]
-
-Wed Oct 19 08:28:32 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_join): elements may contain null pointer strings.
- report and fixed by Lloyd Zusman (hippoman): [ruby-core:06326]
-
-Wed Oct 19 02:34:33 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c, gc.c, time.c: made internal symbols static. [ruby-dev:27435]
-
-Wed Oct 19 01:27:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * regex.c (re_compile_pattern): numeric literal inside character class
- disabled succeeding backtrack. fixed: [ruby-list:41328]
-
-Mon Oct 17 21:18:50 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_heap): byacc never free parser stack.
- fixed: [ruby-dev:27428]
-
-Mon Oct 17 16:04:47 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (chmod_internal, lchmod_internal): fixed type of 2nd argument.
-
-Sun Oct 16 22:16:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb: omit non-existing directories.
-
-Sun Oct 16 14:30:05 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/rinda/rinda.rb (Rinda::Tuple#initialize): check remote hash
- tuple. fixed: [ruby-list:41227]
-
- * test/rinda/test_rinda.rb: test it.
-
-Sun Oct 16 03:38:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * rubysig.h (CHECK_INTS): prevent signal handler to run during
- critical section. [ruby-core:04039]
-
- * eval.c (load_wait): need not to call rb_thread_schedule()
- explicitly. [ruby-core:04039]
-
- * eval.c (rb_thread_schedule): clear rb_thread_critical.
- [ruby-core:04039]
-
-Sat Oct 15 19:56:38 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * bin/erb: typo fixed, again. thanks, Doug Kearns.
-
-Fri Oct 14 22:08:26 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (ioctl): should set errno.
-
-Fri Oct 14 16:57:32 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/config.rb (Config::FileHandler): :UserDir should be nil.
- It is harmful to permit the access to ~/public_html by default.
- suggested by Hiroyuki Iwatsuki.
-
-Thu Oct 13 23:29:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (HEAPCNT): bison allocates indivisible size.
- fixed: [ruby-core:06261]
-
- * io.c, pack.c, ext/syck/rubyext.c, ext/syck/syck.h, missing/isinf.c:
- get rid of warnings. fixed: [ruby-core:06247]
-
-Wed Oct 12 12:52:57 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl.c (Init_openssl): should call
- OpenSSL_add_ssl_algorithms().
-
-Wed Oct 12 11:08:54 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * file.c (rb_f_test): typo in RDoc comments.
-
-Tue Oct 11 21:41:58 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_obj_respond_to): check if obj responds to the given
- method with the given visibility. [ruby-dev:27408]
-
- * eval.c (rb_respond_to): conform to Object#respond_to?. [ruby-dev:27411]
-
-Tue Oct 11 00:01:21 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * st.c (st_free_table): do not call free() but xfree().
- [ruby-core:06205]
-
-Sat Oct 8 20:04:40 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (Init_Binding): add Binding#dup method. [yarv-dev:666]
-
- * parse.y (rb_parser_malloc, rb_parser_free): manage parser stack on
- heap. [ruby-list:41199]
-
- * ext/iconv/charset_alias.rb: parse config.charset_alias file directly.
-
-Fri Oct 7 09:54:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi.rb (CGI::Cookie::parse): Cookies from Nokia devices may
- not be parsed correctly. A patch from August Z. Flatby
- (augustzf) in [ruby-Patches-2595]. [ruby-core:06183]
-
-Thu Oct 6 20:12:16 2005 Minero Aoki <aamine@loveruby.net>
-
- * ext/strscan/strscan.c (strscan_free): remove useless code.
- [ruby-dev:26368] [ruby-dev:27389]
- (backported from trunk, rev 1.22)
-
-Wed Oct 5 04:42:38 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/xmlrpc/server.rb (XMLRPC::Server#initialize): should mount the
- servlet on "/".
-
-Wed Oct 5 03:59:09 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/xmlrpc/server.rb (XMLRPC::Server#serve): delete wrong call
- of "join".
-
-Mon Oct 3 00:04:00 2005 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * pack.c (EXTEND16): [ruby-dev:27383]
-
-Thu Sep 29 10:26:18 2005 Tanaka Akira <akr@m17n.org>
-
- * ext/dl/dl.c (rb_io_to_ptr): abolish sizeof(FILE).
- [ruby-dev:27317]
-
-Thu Sep 29 07:22:05 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * evalc. (rb_f_send): underscores need to be escaped.
- fixed by Doug Kearns. [ruby-core:06053]
-
-Thu Sep 29 00:57:35 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (ev_const_get), variable.c (rb_const_get_0): retry only when
- autoload succeeded.
-
- * variable.c (rb_autoload_load): now return true if autoload
- succeeded. fixed: [ruby-dev:27331]
-
-Wed Sep 28 23:42:15 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (apply2files): add prototype.
-
- * file.c (rb_stat_inspect): constified.
-
- * class.c (rb_mod_init_copy, rb_class_init_copy), file.c (rb_stat_init_copy),
- numeric.c (num_init_copy), object.c (rb_obj_init_copy, Init_Object),
- re.c (match_init_copy, rb_reg_init_copy), time.c (time_init_copy):
- undocumented.
-
-Wed Sep 28 23:09:23 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/delegate.rb: document update from James Edward Gray II
- <james@grayproductions.net>. [ruby-core:06027]
-
-Wed Sep 28 15:14:19 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/cgi.rb (WEBrick::CGI#start): req.query_string should
- refer the value of QUERY_STRING. [ruby-list:41186]
-
- * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#query_string=):
- add new method.
-
-Wed Sep 28 10:45:44 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: cannot compile with Tcl/Tk8.0.x
- [ruby-dev:27335].
-
-Wed Sep 28 08:12:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (read_buffered_data): check if reached EOF. fixed: [ruby-dev:27334]
-
-Wed Sep 28 07:56:52 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/yaml/basenode.rb (YAML::BaseNode::match_segment): fix typo.
- [ruby-dev:27237], [ruby-core:05854]
-
- * lib/yaml/tag.rb (Module#yaml_as): suppress warnings.
-
- * lib/yaml/types.rb (YAML::PrivateType, YAML::DomainType): ditto.
-
-Wed Sep 28 03:23:35 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * rubysig.h: fixed build problem with --enable-pthread on platforms
- which don't have setitimer().
-
-Mon Sep 26 22:32:13 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (set_trace_func): add rb_secure(4) to prevent adding
- tracing function.
-
-Sun Sep 25 12:05:10 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * bin/erb: typo fixed.
-
-Sun Sep 25 01:46:43 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-calculate-indent): arrange deep-indent
- closing parenthesis at same column as the opening.
-
-Sun Sep 25 00:42:11 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-expr-beg): deal with heredoc separately.
- fixed: [ruby-list:41168]
-
- * misc/ruby-mode.el (ruby-calculate-indent): not to deepen indent
- level for continuous line inside parentheses.
- http://nabeken.tdiary.net/20050915.html#p02
-
-Sun Sep 25 00:18:11 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (unknown_node): show more information. [ruby-dev:26196]
-
-Sat Sep 24 08:56:01 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (cd): no longer accept :noop option, related
- code is useless (backported from trunk, rev 1.67).
- [ruby-core:05858] [ruby-Bugs:2494]
-
-Sat Sep 24 08:38:07 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb: fix visibility of FileUtils::NoWrite, Verbose,
- DryRun (backported from trunk, rev 1.66). [ruby-core:05954]
-
- * test/fileutils/test_nowrite.rb: test it.
-
- * test/fileutils/test_dryrun.rb: new file.
-
- * test/fileutils/test_verbose.rb: new file.
-
-Sat Sep 24 02:40:20 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/delegate.rb: document update from James Edward Gray II
- <james@grayproductions.net>. [ruby-core:05942]
-
-Thu Sep 22 23:36:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (find_executable0): default path if environment is not
- set. [ruby-dev:27281]
-
-Thu Sep 22 16:33:12 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/readline/test_readline.rb (TestReadline::replace_stdio):
- merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223].
-
-Wed Sep 21 23:30:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (configuration): generalized nmake dependent code.
-
-Wed Sep 21 09:07:55 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * stable version 1.8.3 released.
-
-Wed Sep 21 08:52:25 2005 why the lucky stiff <why@ruby-lang.org>
-
- * ext/syck/token.c: correctly compute identation of a block
- scalar's parent node. [ruby-talk:150620]
-
-Wed Sep 21 08:20:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * README.EXT, README.EXT.ja: add new features.
-
-Wed Sep 21 07:43:58 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optparse.rb (default_argv, Arguable#options): defaults strings
- to be parsed to Arguable instance.
-
-Wed Sep 21 02:44:09 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * file.c (path_check_0): disallow sticky world writable directory
- in PATH (and $LOAD_PATH). [ruby-dev:27226]
-
- * file.c (fpath_check): typo fixed.
-
-Tue Sep 20 22:29:49 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * test/wsdl/simpletype/rpc/test_rpc.rb, test/wsdl/ref/test_ref.rb,
- test/wsdl/any/test_any.rb test/soap/wsdlDriver/test_calc.rb:
- suppress deliberate warnings with $VERBOSE = nil.
-
-Tue Sep 20 21:26:23 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/wait/lib/nonblock.rb: disable on platforms non-blocking flag
- is not available. fixed: [ruby-dev:27187]
-
-Tue Sep 20 18:23:04 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (thread_mark): mark th->last_status. [ruby-dev:27179]
-
-Tue Sep 20 18:20:33 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/yaml.rb: require 'yaml/constants'. [ruby-core:5776]
-
-Tue Sep 20 17:48:34 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/xmlrpc/client.rb (XMLRPC::Client::do_rpc): add charset
- information to content-type header.[ruby-core:5127]
-
- * lib/xmlrpc/server.rb (CGIServer::serve): ditto.
-
- * lib/xmlrpc/server.rb (ModRubyServer::serve): ditto.
-
- * lib/xmlrpc/server.rb (WEBrickServlet::service): ditto.
-
-Tue Sep 20 17:34:46 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * test/webrick/test_cgi.rb: set ENV["PATH"] to CGIEnvPath on
- windows. bcc32's runtime is not installed into system directory,
- so it cannot be found without this setting. [ruby-dev:27166]
-
-Tue Sep 20 17:10:38 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * test/dbm/test_dbm.rb (TestDBM::test_s_open_error): remove
- test_s_open_error test to detect duplicate open.
- [ruby-dev:27202]
-
-Tue Sep 20 17:08:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * io.c: PIPE_BUF is not defined on BeOS. use _POSIX_PIPE_BUF instead.
- [ruby-dev:27185]
-
-Tue Sep 20 16:53:53 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * test/readline/test_readline.rb (TestReadline::replace_stdio):
- BSD seek support from [ruby-dev:25223]. fixed: [ruby-dev:27150]
-
-Tue Sep 20 15:39:40 2005 why the lucky stiff <why@ruby-lang.org>
-
- * ext/syck/emitter.c (syck_scan_scalar): prevent indicators from
- appearing alone or at the end of plain scalars. [ruby-core:5826]
-
- * ext/syck/emitter.c (syck_emit_scalar): treat typed scalar nodes
- as complex keys.
-
- * lib/syck.h: version 0.60.
-
- * lib/yaml/basenode.rb (YAML::BaseNode#at): transform keys during
- key searches.
-
- * ext/syck/rubyext.c: loading of binary-typed nodes. prevent
- emission of plain strings that look like symbols, but which aren't.
-
-Tue Sep 20 05:50:22 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * test/xmlrpc/test_webrick_server.rb (setup_http_server):
- should not include 'webrick/https' unless 'use_ssl' because
- it fails where openssl is not installed.
-
-Tue Sep 20 00:34:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c (io_close): call rb_io_close() directly if io is a T_FILE
- object. [ruby-dev:27156]
-
-Mon Sep 19 19:09:08 2005 Minero Aoki <aamine@loveruby.net>
-
- * file.c (rb_file_chown): should accept nil. [ruby-dev:27171]
- (backport from trunk, rev 1.208)
-
-Mon Sep 19 18:35:13 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/dl/dl.c (rb_io_to_ptr): fix DragonFlyBSD support.
- [ruby-dev:27151]
-
-Mon Sep 19 14:17:04 2005 Minero Aoki <aamine@loveruby.net>
-
- * ext/syck/emitter.c (syck_emit): passing an int* value to the
- long* parameter causes unaligned access on LP64 systems.
- [ruby-dev:27161]
-
-Mon Sep 19 13:44:03 2005 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: avoid core dump with WIN32OLE_EVENT.
- [ruby-dev:27133]
-
-Mon Sep 19 10:36:06 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (cp_r): default is :dereference_root=>true for
- backward compatibility. [ruby-dev:27145]
-
- * test/fileutils/test_fileutils.rb (test_cp_r): test it.
-
-Mon Sep 19 09:57:39 2005 Minero Aoki <aamine@loveruby.net>
-
- * test/fileutils/test_fileutils.rb: backported from trunk (1.36).
- (again) [ruby-dev:27145]
-
-Mon Sep 19 07:45:37 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_pkey.h, ossl_pkey_rsa.c, ossl_pkey_dsa.c:
- an instance variable "private" is added to OpenSSL::PKey class.
- this ivar is a flag that shows whether there is a private key
- in the instance.
-
- * ext/openssl/ossl_engine.c: (ossl_engine_load_privkey): set private
- key flag.
-
-Mon Sep 19 06:41:32 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb: backported from trunk (rev 1.65):
-
- * lib/fileutils.rb (rm_r): new option :secure.
-
- * lib/fileutils.rb (rm_rf): new option :secure.
-
- * lib/fileutils.rb: new method #remove_entry_secure.
-
- * lib/fileutils.rb (cd): remove option :noop.
-
- * lib/fileutils.rb (cp_r): new option :dereference_root.
-
- * lib/fileutils.rb (cp_r): new option :dereference_root.
-
- * lib/fileutils.rb: new method #remove_entry.
-
- * lib/fileutils.rb: new method #chmod_R.
-
- * lib/fileutils.rb: new method #chown.
-
- * lib/fileutils.rb: new method #chown_R.
-
- * lib/fileutils.rb: new method .commands.
-
- * lib/fileutils.rb: new method .options.
-
- * lib/fileutils.rb: new method .have_option?.
-
- * lib/fileutils.rb: new method .options_of.
-
- * lib/fileutils.rb: new method .collect_method.
-
- * lib/fileutils.rb: use module_function instead of single extend.
-
- * test/fileutils/test_fileutils.rb: backported from trunk (1.36).
-
-Mon Sep 19 03:17:48 2005 Tanaka Akira <akr@m17n.org>
-
- * file.c (rb_thread_flock): wrap the flock system call by
- TRAP_BEG/TRAP_END to enable signals. [ruby-dev:27122]
-
- * ext/socket/socket.c (bsock_send): wrap the sendto and send system
- call by TRAP_BEG/TRAP_END to enable signals when writing to a socket
- which is full. [ruby-dev:27132]
-
- * io.c (rb_io_syswrite): wrap the write system call by
- TRAP_BEG/TRAP_END to enable signals when writing to a pipe which is
- full. [ruby-dev:27134]
-
-Mon Sep 19 03:02:08 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (io_fwrite): wrap the write system call by TRAP_BEG/TRAP_END to
- enable signals when writing to a pipe which is full.
-
-Sun Sep 18 02:10:47 2005 why the lucky stiff <why@ruby-lang.org>
-
- * lib/yaml/rubytypes.rb: remove comments that are bungling up
- the rdoc and ri output. output symbols as plain scalars.
-
- * ext/syck/rubyext.c (syck_emitter_reset): emit headless
- documents always.
-
- * ext/syck/emitter.c (syck_scan_scalar): quote scalars with any
- kind of surrounding line space, tabs or spaces alike.
-
- * ext/syck/token.c: accept tabs as whitespace, not for indentation,
- but strip from plain scalars.
-
- * test/yaml/test_yaml.rb: remove outdated tests.
-
-Sat Sep 17 23:25:04 2005 sheepman <sheepman@sheepman.sakura.ne.jp>
-
- * lib/mathn.rb (Rational::inspect): should preserve original
- operand. [ruby-core:05806]
-
-Sat Sep 17 23:20:27 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi.rb (CGI::Cookie): should handle multiple values for a
- cookie name. [ruby-talk:156140]
-
-Sat Sep 17 10:42:13 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: MultiTkIp#eval_string and bg_eval_string
- should call Kernel.eval on caller's safe-level instead of slave's
- safe-level (Of course, the given script should be evaluated on
- slave's safe-level).
-
-Sat Sep 17 09:45:26 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (rb_str_substr): should propagate taintness even for
- empty strings. [ruby-dev:27121]
-
- * string.c (rb_str_aref): should infect result if range argument
- is tainted. [ruby-dev:27121]
-
-Sat Sep 17 08:35:39 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/maker/base.rb (RSS::Maker::ItemsBase#normalize): fixed
- strange RSS::Maker::Item#max_size behavior.
- Thanks to Kazuhiko <kazuhiko@fdiary.net>.
-
- * test/rss/test_maker_1.0.rb (RSS::TestMaker10#test_items): ditto.
-
-Fri Sep 16 23:09:20 2005 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_search_event_at): bug fix
- in ext/win32ole/sample/ienavi.rb.
-
- * ext/win32ole/win32ole/tests/testOLEEVENT.rb: ditto.
-
-Fri Sep 16 22:41:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_s_extname): empty string for path name ending with a
- period. fixed: [ruby-core:05651]
-
- * file.c (rb_file_join): smarter behavior at edge cases.
- fixed: [ruby-core:05706]
-
-Fri Sep 16 18:34:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/syck/node.c (syck_replace_str): was using return from the
- void function. a patch from MIYAMUKO Katsuyuki
- <miyamuko at mtb.biglobe.ne.jp>. [ruby-dev:27111]
-
-Fri Sep 16 14:48:48 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: fix typo on MultiTkIp#bg_eval_string
-
-Fri Sep 16 12:02:12 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/syck/rubyext.c (syck_resolver_transfer): remove C++ style
- comment (//). [ruby-core:05793]
-
-Fri Sep 16 00:14:14 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * test/logger/test_logger.rb: unintentionally overwritten changes by
- Usa. reverted.
-
-Fri Sep 16 00:06:18 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/cgi.rb (WEBrick::CGI::Socket#initialize): should set
- $stdout.binmode.
-
-Thu Sep 15 23:25:21 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/{soap,wsdl,xsd}, test/{soap,wsdl,xsd}: imported soap4r/1.5.5.
-
- #nnn is a ticket number at http://dev.ctor.org/soap4r
-
- * SOAP
-
- * allow to configure an envelope namespace of SOAP request. (#124)
- TemporaryNamespace = 'http://www.w3.org/2003/05/soap-envelope'
- @client.options["soap.envelope.requestnamespace"] =
- TemporaryNamespace
- @client.options["soap.envelope.responsenamespace"] =
- TemporaryNamespace
- @client.do_proc(...)
-
- * let SOAP request XML indent space configuable. see
- "soap.envelope.no_indent" option. (#130)
-
- * let external CES configuable.
- ex. client["soap.mapping.external_ces"] = 'SJIS'. $KCODE is used
- by default. (#133)
- external CES ::= CES used in Ruby object of client and server
- internal CES ::= CES used in SOAP/OM
-
- * add iso-8859-1 external CES support. (#106)
-
- * fixed illegal 'qualified' handling of elements. it caused
- ASP.NET inteoperability problem. (#144)
-
- * added 'soap.envelope.use_numeric_character_reference' (boolean)
- option to let query XML use numeric character reference in XML,
- not plain UTF-8 character. !GoogleSearch server seems to not
- allow plain UTF-8 character since 2005-08-15 update. (#147)
-
- * SOAP::Header::SimpleHeader (de)serialization throws an exception
- on !SimpleHeader.on_(in|out)bound when header is a String. so we
- could not use a simple single element headerItem. fixed. thanks
- to emil. (#129)
-
- * out parameter of rpc operation did not work. (#132)
-
- * follow HTTP redirect only if using http-access2. (#125) (#145)
-
- * add a workaround for importing an WSDL whose path begins with
- drive letter. (#115)
-
- * WSDL
-
- * SOAP Data which is defined as a simpletype was not mapped
- correctly to Ruby obj when using wsdl2ruby.rb generated classdef
- file. (#123)
-
- * rpc/literal support. (#118)
-
- * re-implemented local element qualify/unqualify control. handles
- elementFormDefault and form in WSDL. (#119)
-
- * Array of an element which has simpleType causes a crash. (#128)
-
- * prarmeterOrder may not contain return part so it can be shorter
- than parts size. Thanks to Hugh. (#139)
-
- * Samples
-
- * added !BasicAuth client sample. (#117)
-
- * added Base64 client/server sample.
-
- * added Flickr SOAP interface client sample. (#122)
-
- * added !SalesForce client sample. (#135)
-
- * updated Thawte CA certificate for !GoogleAdWords sample.
-
- * updated a client script with the newer version made by Johan.
- thanks!
-
- * shortened long file names. (#120)
-
- * fixed typo in authheader sample. (#129)
-
- * updated deprecated method usage. (#138)
-
-Thu Sep 15 23:02:57 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.h (rb_w32_stat): added prototype.
-
-Thu Sep 15 22:35:55 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_signal.rb (test_exit_action): skip the test using
- fork on fork-less platforms.
-
-Thu Sep 15 11:39:18 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/dialog.rb: If a dialog does not show up yet,
- TkDialogObj#name raises an exception. [ruby-talk:156109]
-
-Thu Sep 15 01:39:19 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/rinda/tuplespace.rb (Rinda::TemplateEntry::initialize): pull
- up method. Tabs converted to spaces.
-
-Thu Sep 15 00:18:24 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/net/telnet.rb (Net::Telnet::waitfor): replace sysread with
- readpartial. [ruby-talk:127641]
-
-Wed Sep 14 22:40:26 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (ruby_glob): glob function not using ruby exception system.
-
-Wed Sep 14 01:26:03 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/net/https.rb: backported from trunk, rev 1.3.
- [ruby-dev:25673] (again), [ruby-dev:26617] (again),
- [ruby-dev:27062]
-
- * ext/openssl/lib/net/https.rb: removed.
-
- * ext/openssl/lib/net/protocols.rb: removed.
-
- * lib/net/http.rb: #use_ssl?, #use_ssl are moved from net/https.
-
-Tue Sep 13 22:09:40 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/logger.rb (Logger): added formatter accessor to logger for
- dictating the way in which the logger should format the messages it
- displays. Thanks to Nicholas Seckar (cf. [ruby-talk:153391]) and
- Daniel Berger.
-
- * lib/logger.rb (Logger): added VERSION constant.
-
- * lib/logger.rb: removed document for LogDevice. It is an
- implementation detail and is not a public interface.
-
- * test/logger/test_logger.rb: added tests.
-
-Tue Sep 13 21:47:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (BEGIN_CALLARGS): pop halfly pushed status.
- fixed: [ruby-dev:26881]
-
-Tue Sep 13 16:26:45 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/net/http.rb: backported from trunk, rev 1.128.
- [ruby-dev:25673] [ruby-dev:26617]
-
- * lib/net/protocol.rb: backported from trunk, rev 1.78.
-
- * lib/net/protocol.rb: new method #old_open to support net/smtp
- and net/pop.
-
- * lib/net/smtp.rb: use #old_open.
-
- * lib/net/pop.rb: ditto.
-
-Tue Sep 13 12:33:05 2005 why the lucky stiff <why@ruby-lang.org>
-
- * lib/yaml.rb: reworking YAML::Stream to use the new
- emitter.
-
- * lib/yaml/stream.rb: ditto.
-
- * lib/yaml/rubytypes.rb: added Object#yaml_new.
-
- * lib/yaml/tag.rb: the tag_subclasses? method now
- shows up in the class. allow taguri to be set using an accessor.
- continue support of Object#to_yaml_type.
-
- * ext/syck/rubyext.c: new emitter code. yaml_new and yaml_initialize
- get called, should they be present. consolidated all the diaspora of internal
- node types into the family below YAML::Syck::Node -- Map,
- Seq, Scalar -- all of whom are SyckNode structs pointing to
- Ruby data. moved Object#yaml_new into the node_import and made it the
- default behavior. the target_class is always called wih yaml_new, prepended
- a parameter, which is the klass. loaded nodes through GenericResolver show their style.
- new Resolver#tagurize converts type ids to taguris.
-
- * ext/syck/implicit.re: were 'y' and 'n' seriously omitted??
-
- * ext/syck/emitter.c: renovated emitter, walks the tree in advance.
- consolidated redundant block_styles struct into
- the scalar_style struct. (this means loaded nodes can now
- be sent back to emitter and preserve at least its very basic
- formatting.)
-
- * ext/syck/gram.c: headless documents of any kind allowed.
-
- * ext/syck/node.c: new syck_replace_str methods and syck_empty_*
- methods for rewriting node contents, while keeping the ID
- and other setup info. added syck_seq_assign.
-
- * ext/syck/syck.h: reflect block_styles and new node functions.
-
-Mon Sep 12 20:53:06 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * test/openssl/test_pkcs7.rb (test_enveloped): skip this test
- to avoid a bug of PKCS7_enctypt() (only if ext/openssl is
- compiled with OpenSSL-0.9.7d or earlier versions).
- http://www.mail-archive.com/openssl-dev@openssl.org/msg17376.html
-
-Mon Sep 12 14:03:33 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * test/dbm/test_dbm.rb: remove locking test, which may not be
- supported on some platforms. [ruby-dev:27030]
-
-Mon Sep 12 10:45:58 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/dl/dl.c (rb_io_to_ptr): merged a patch for DragonFly BSD
- from Takahiro Kambe <taca at back-street.net>. [ruby-dev:27023]
-
-Sun Sep 11 22:05:51 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * bin/erb (ERB::Main#run): set ERB#filename so that it is used
- when reporting syntax/runtime errors. Tabs converted to spaces.
-
-Sat Sep 10 10:17:03 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_engine.c (ossl_engine_s_by_id):
- OpenSSL::Engine.by_id calls given block before calling
- ENGINE_init (block parameter is the return value of this method
- itself). this functionality is useful to load dynamic shared
- engines. the following code is a sample of loading a key using
- OpenSC PKCS #11 module.
-
- require "openssl"
- pkcs11 = OpenSSL::Engine.by_id("dynamic"){|e|
- e.ctrl_cmd("SO_PATH", "/usr/lib/opensc/engine_pkcs11.so")
- e.ctrl_cmd("LIST_ADD", "1")
- e.ctrl_cmd("LOAD")
- }
- pkcs11.ctrl_cmd("PIN", "secret")
- key = pkcs11.load_private_key
-
- * ext/openssl/ossl_engine.c (ossl_engine_ctrl_cmd): new method
- OpenSSL::Engine#ctrl_cmd. it wraps ENGINE_ctrl_cmd_string.
-
- * ext/openssl/ossl_engine.c (ossl_engine_get_cmds): new method
- OpenSSL::Engine#cmds. it returms engine command definitions.
-
-Sat Sep 10 10:09:47 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_asn1.c (asn1str_to_str): new function.
-
- * ext/openssl/ossl_pkcs7.c: new class OpenSSL::PKCS7::RecipientInfo.
- this class wraps PKCS7_RECIP_INFO struct.
-
- * ext/openssl/ossl_pkcs7.c: OpenSSL::PKCS7::Signer is renamed to
- OpenSSL::PKCS7::SignerInfo. ("Signer" remains as an alias of
- SignerInfo.)
-
- * test/openssl/test_pkcs7.rb: new file.
-
-Sat Sep 10 10:05:51 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ns_spki.c (ossl_spki_initialize): assume that
- the argument is a DER string if Base64 decoding failed.
-
- * ext/openssl/ossl_ns_pki.c (ossl_spki_to_der): new method.
-
- * test/openssl/test_ns_spki.rb: add new file.
-
-Sat Sep 10 09:56:24 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/lib/digest.rb: added SHA224, SHA256, SHA384 and SHA512.
- these features are enabled if this library is compiled with
- OpenSSL 0.9.8 or later.
-
- * test/openssl/test_digest.rb: add test for new digests.
-
-Sat Sep 10 09:51:30 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl.c (ossl_raise): should use ERR_peek_last_error
- to get last error on the current thread. And should report
- errors on the stack while OpenSSL.debug is true.
-
- * ext/openssl/ossl.c (ossl_get_errors): new method for debugging
- this library.
-
- * ext/openssl/ossl_ssl.c (ossl_sslctx_set_ciphers): fix error message.
-
- * ext/openssl/ossl_x509req.c (ossl_x509req_set_attributes): get rid
- of unused variable.
-
- * ext/openssl/ossl_x509store.c (ossl_x509store_initialize): should
- set @time to avoid warning.
-
- * ext/openssl/ossl_x509store.c (ossl_x509store_set_default_paths,
- X509_STORE_add_cert, X509_STORE_add_crl): should raise error if
- wrapped functions failed.
-
- * test/openssl/test_x509store.rb: add test for errors.
-
-Fri Sep 9 22:13:19 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): prohibit calling tainted method (>2) when
- $SAFE == 0.
-
-Fri Sep 9 16:45:25 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_times): make empty strings to keep taintness,
- and a little improvement. [ruby-dev:26900]
-
- * ext/iconv/iconv.c (iconv_try), ext/iconv/extconf.rb: get rid of meta
- characters in command line option. fixed: [ruby-talk:155369]
-
-Thu Sep 8 14:58:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * merged a patch from Takahiro Kambe <taca at back-street.net> to
- support DragonFly BSD. [ruby-dev:26984]
-
-Wed Sep 7 12:55:08 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb: abolish mod === tempfile to avoid a problem
- [ruby-dev:26967].
-
-Wed Sep 7 10:45:15 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_thread_switch): convert all exceptions to
- SystemExit. fixed: [ruby-core:05724]
-
- * eval.c (rb_thread_terminated): show backtrace before propagate
- exceptions to main thread.
-
-Wed Sep 7 08:35:04 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in, configure.in (MINIOBJS): miniruby on HP-UX can not load
- extension libraries.
-
- * bignum.c (bignew_1, bigadd): K&R style argument actually can't be
- defined as char.
-
- * missing/vsnprintf.c: ANSI compiler supports const keyword.
-
- * ext/digest/sha2/extconf.rb: reject platforms which has inttypes.h
- but no 64bit integer.
-
- * lib/mkmf.rb (what_type?): guesstimate type.
-
- * ext/etc/etc.c (setup_passwd), ext/etc/extconf.rb: pw_age might be
- char*. fixed: [ruby-core:05470]
-
-Wed Sep 7 08:32:47 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * object.c (rb_mod_cvar_get, rb_mod_cvar_set): document fix from
- sheepman <sheepman@sheepman.sakura.ne.jp>; a bug in visibility
- description. [ruby-dev:26965]
-
- * sprintf.c (rb_f_sprintf): warn "too many argument" on verbose
- mode (-v/-w); backported from 1.9. [ruby-dev:26963]
-
-Mon Sep 5 17:03:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/ostruct.rb: a patch from Florian Gross <florgro at gmail.com>
- merged to allow recursive inspect (and to_s) for OpenStruct.
- [ruby-core:05532]
-
-Mon Sep 5 07:01:12 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/openssl/lib/openssl/buffering.rb (Buffering#do_write):
- should clear data from the buffer which already been output.
-
-Fri Sep 2 23:51:54 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib: do not use __send__ to access private methods. [ruby-dev:26935]
-
-Fri Sep 2 03:29:00 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
-
- * lib/irb/init.rb: make IRB -I option that is same befavior for ruby.
- [ruby-dev:26872], [ruby-dev: 26920]
-
- * lib/irb/locale.rb: support to print help message when OS locale is
- ja_JP.utf-8. [ruby-dev:26872]
-
-Thu Sep 1 17:11:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): wrong condition for $SAFE restoration.
-
-Thu Sep 1 14:12:45 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: On Tcl8.5, MultiTkIp#invoke_hidden doesn't
- work (gives wrong order of arguments).
-
- * ext/tk/lib/multi-tk.rb: add MultiTkIp#invoke_hidden_on_namespace
- to support '-namespace' option of 'interp invokehidden' command
- on Tcl8.5.
-
-Wed Aug 31 14:43:15 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (OPTFLAGS): default global optimization to
- disabled for all VC++ versions. fixed: [ruby-dev:26897]
-
-Wed Aug 31 11:35:43 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/gdbm/test_gdbm.rb (teardown): should remove GDBM temporary
- file.
-
-Wed Aug 31 10:30:56 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * process.c (proc_detach, proc_setmaxgroups): missing argument type
- declaration. (I recommend ANSI-style function)
-
-Tue Aug 30 23:20:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_rescue2): initialization miss. fixed: [ruby-dev:26917]
-
- * lib/mkmf.rb (xsystem, xpopen): no longer expand by Config.
-
- * lib/mkmf.rb (link_command, cc_command, cpp_command): expand
- variables at once, and quote hdrdir. fixed: [ruby-core:05680]
-
- * lib/mkmf.rb (libpathflag): quote paths.
-
-Tue Aug 30 19:34:27 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/digest/md5/md5ossl.h, ext/digest/rmd160/rmd160ossl.h,
- ext/digest/sha1/sha1ossl.h: include <stddef.h> to avoid
- error in compilation with OpenSSL-0.9.8. [ruby-list:41068]
-
-Mon Aug 29 19:54:21 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/rdoc/usage.rb: improper exceptions. [ruby-dev:26870]
-
- * lib/rdoc/usage.rb: support the case when non-ruby code exists before
- shebang. (this is needed when ri.bat is executed on windows)
-
-Mon Aug 29 17:48:17 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (method_arity): should return proper arity value.
- [ruby-dev:26390]
-
-Mon Aug 29 01:19:57 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/time.rb (Time.parse): extract fractional seconds using
- Date._parse. [ruby-talk:153859]
-
-Sat Aug 27 20:20:01 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/curses/curses.c ({curses,window}_clrtoeol): added. suggested
- by Reyn Vlietstra.
-
- * ext/curses/curses.c: chtype in curses is not `char', rahter `long'.
- [ruby-Bugs:2298]
-
- * ext/curses/view.rb: String =~ String is deprecated.
-
-Wed Aug 24 10:53:28 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/logger/test_logger.rb (test_shifting_size): should close log
- device before unlink, since some platform cannot unlink opened
- file.
-
-Sun Aug 21 00:13:27 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/wsdl/xmlSchema/importer.rb (WSDL::XMLSchema::Importer#fetch): add
- a workaround for importing an WSDL whose path begins with drive
- letter. [ruby-dev:26242]
-
-Sat Aug 20 22:37:13 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/logger.rb (write, shift_log?, shift_log): file shifting race
- condition bug fixed. [ruby-dev:26764]
-
- * test/logger/test_logger.rb: tests.
-
-Fri Aug 19 18:13:39 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/time.rb (Time.apply_offset): fix a problem with last day of
- month. reported by Lucas Nussbaum. [ruby-talk:152866]
-
-Thu Aug 18 12:46:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub (COMMON_HEADERS): reverted 1.42.2.24.
- I misunderstood, bccwin32 on ruby_1_8 uses winsock2 originally.
- [ruby-dev:26806]
-
- * win32/win32.h: include winsock2.h instead of winsock.h. (bcc32)
-
-Wed Aug 17 23:58:05 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_to_integer): argument constified.
-
- * eval.c (terminate_process): take String message.
-
- * eval.c (rb_thread_switch): propagate the exception caused thread
- termination directly. fixed: [ruby-core:05552]
-
-Wed Aug 17 00:05:46 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_add_method): preserve safe level in the environment
- where a method is defined .
-
- * eval.c (rb_call0): restore preserved safe level in the method
- execution.
-
-Mon Aug 15 00:38:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_rescue2): reduce PUSH_TAG() as well as NODE_RESCUE.
- [ruby-dev:26800]
-
- * range.c (range_check, range_init): reduce useless exceptions.
-
-Sat Aug 13 18:51:26 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_block_pass): distinguish current block from others.
- fixed: [ruby-dev:26274]
-
- * ext/stringio/stringio.c (strio_set_string): disallow nil.
- http://www.rubyist.net/~nobu/t/20050811.html#c05
-
-Thu Aug 11 23:29:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c: keep holding string after closed.
-
-Thu Aug 11 13:01:48 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss: fixed sort bug. [ruby-list:41018]
-
- * lib/rss/1.0.rb (RSS::RDF::Channel#setup_maker_attributes):
- removed self.
-
- * lib/rss/maker/base.rb (RSS::Maker::ItemsBase#<=>): use #date
- instead of @date.
- (RSS::Maker::Base::self.def_array_element): added #size.
-
- * lib/rss/maker/1.0.rb
- (RSS::Maker::RSS10::Channel#to_rss,
- RSS::Maker::RSS10::Items::Item#to_rss): cleared dc_dates set
- upped by using #date.
-
- * lib/rss/maker/dublincore.rb
- (RSS::Maker::ChannelBase, RSS::Maker::ItemsBase::ItemBase):
- fixed opposite alias.
-
- * test/rss/test_setup_maker_1.0.rb
- (RSS::TestSetupMaker10::test_setup_maker_items_sort): added some
- tests for RSS::Maker::ItemsBase#do_sort.
-
-Wed Aug 10 10:29:40 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: fix bug on handling __ruby2val_optkeys().
-
- * ext/tk/lib/tk/itemconfig.rb: fix bug on handling
- __item_ruby2val_optkeys().
-
- * ext/tk/lib/tk/canvas.rb: didn't check __item_ruby2val_optkeys().
-
- * ext/tk/lib/tkextlib/blt/component.rb: ditto.
-
-Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: remove dangerous 'rb_jump_tag's.
-
- * ext/tk/lib/tk.rb: add __val2ruby_optkeys and __ruby2val_optkeys to
- help to convert option values between ruby and tcl.
-
- * ext/tk/lib/tk/itemconfig.rb: add __item_val2ruby_optkeys and
- __item_ruby2val_optkeys to help to convert option values between
- ruby and tcl.
-
- * ext/tk/lib/tk/radiobutton.rb: use __ruby2val_optkeys for 'variable'
- option (for the reason of backward compatibility).
-
- * ext/tk/lib/tk/composite.rb: clarify the arguments of super().
-
- * ext/tk/lib/tk/spinbox.rb: ditto.
-
- * ext/tk/lib/tk/text.rb: ditto.
-
- * ext/tk/lib/tk/validation.rb: ditto.
-
- * ext/tk/lib/tkextlib/*: support to treat tkvariable-type
- configure options.
-
-Tue Aug 9 20:30:19 2005 Tadashi Saito <shiba@mail2.accsnet.ne.jp>
-
- * bignum.c (rb_big_coerce): allow bignum x bignum coercing.
- [ruby-dev:26778]
-
-Mon Aug 8 20:43:02 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * test/ruby/test_method.rb: added. [ruby-dev:26761]
-
-Sun Aug 7 23:50:14 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * test/ruby/test_super.rb: added from HEAD. [ruby-dev:26743]
-
-Sun Aug 7 01:31:15 2005 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (WIN32OLE_EVENT#on_event): should set
- only one event handler.
-
- * ext/win32ole/tests/testOLEEVENT.rb: ditto.
-
- * ext/win32ole/tests/testOLEPARAM.rb: remove re-defined
- test_ole_type_detail method.
-
-Sat Aug 6 12:35:24 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/{tk.rb,tk/itemconfig.rb}: configure creates
- TkVariable if key name is 'variable' or 'textvariable'
- by default. [ruby-dev:26749]
-
- * ext/tk/lib/tk/{label,radiobutton}.rb: removed its own
- {variable,textvariable} function.
-
- * ext/tk/lib/tk/variable.rb: retains backward conpatibility.
-
-Fri Aug 5 12:50:32 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c: fixed memory leak when tk_funcall raised
- exception. (copies argv into heap in tk_funcall instead of
- caller)
-
-Fri Aug 5 12:42:57 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): need to convert path separetor
- before invoking install command.
-
-Fri Aug 5 00:27:04 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c: refactoring - extract ruby string <->
- tcl object conversion as get_str_from_obj and get_obj_from_str.
-
-Fri Aug 5 00:19:33 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * extmk.rb (extmake): needs to be wrapped in an Array.
-
-Thu Aug 4 18:38:36 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: cannot compile for Tcl7.6/Tk4.2.
-
- * ext/tcltklib/tcltklib.c: add nativethread consistency check.
-
- * ext/tcltklib/stubs.c: ditto.
-
- * ext/tk/lib/tk.rb: forgot to define TclTkIp.encoding and encoding=
- when Tcl is 7.6 or 8.0.
-
- * ext/tk/lib/tk/wm.rb: support to make some methods as options of
- root or toplevel widget. [ruby-talk:150336]
-
- * ext/tk/lib/tk/root.rb: ditto.
-
- * ext/tk/lib/tk/toplevel.rb: ditto.
-
- * ext/tk/lib/tkextlib/SUPPRT_STATUS: update RELEASE_DATE
-
-Thu Aug 4 08:03:39 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): should not modify $mflags for each
- extentions.
-
-Thu Aug 4 00:25:48 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk, Makefile.in, {bcc32,win32,wince}/Makefile.sub: integrated
- macro definitions.
-
- * bcc32/Makefile.sub: LIBRUBY_SO should use DLDOBJS, not EXTOBJS.
-
- * {win32,wince}/Makefile.sub: separate config.h for compiler versions.
-
-Wed Aug 3 21:59:16 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/variable.rb: TkVariable#trace didn't work on
- TkVariable retrived from TkVariable.new_hash.ref. [ruby-dev:26721]
-
-Wed Aug 3 08:22:13 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c (ruby_connect): revert [ruby-talk:111654]
- changes at 2004-09-07. [ruby-dev:26656]
-
-Tue Aug 2 10:20:54 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c: use Tcl_[GS]etVar2Ex instead of
- Tcl_Obj[GS]etVar2. (avoid Tcl_NewStringObj on supported platforms)
-
- * ext/tcltklib/tcltklib.c: use ip_{get,set,unset}_variable2_core from
- ip_{get,set,unset}_variable.
-
- * ext/tcltklib/tcltklib.c: replaced Tcl_Panic with rb_bug.
-
-Tue Aug 2 01:41:28 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/ping.rb (Ping.pingecho): should rescue StandardError.
- [ruby-dev:26677]
-
-Mon Aug 1 19:09:41 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c: refactoring - replaced rb_ivar_defined &
- rb_ivar_get with single rb_attr_get call.
-
-Mon Aug 1 18:45:07 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c (Tcl_GetStringResult): refactoring - define
- alternative macro on Tcl7.x or earlier.
-
-Mon Aug 1 13:57:35 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c (deleted_ip): refactoring - interpreter
- deletion check. [ruby-dev:26664]
-
-Mon Aug 1 01:17:40 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb (check_insecure_method): use private_methods and
- protected_methods instead of respond_to? to check method visibility.
- [ruby-dev:26616]
-
- * test/drb/drbtest.rb: ditto.
-
- * test/drb/ut_drb.rb: ditto.
-
-Mon Aug 1 00:07:32 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
- * lib/irb/context.rb: fix `irb --readline` option. [ruby-list:40955]
-
-Fri Jul 29 09:59:38 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_yield_0): push yielded node instead of yielding.
- fixed: [yarv-dev:549]
-
-Thu Jul 28 18:09:55 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/stubs.c: When --enable-tcltk-stubs, the initialize
- routine creates a Tcl/Tk interpreter and deletes it. However,
- init cost of Tk's MainWindow is not so small. And that makes it
- impossible to use libraries written with Tcl functions only on
- an environment without a graphical display. This changes support
- delaying initalization of Tk_Stubs until the script needs Tk.
-
- * ext/tcltklib/stubs.h: New file. Define prototypes and return
- codes of functions on stubs.c.
-
- * ext/tcltklib/tcltklib.c: Support delaying initalization of
- Tk_Stubs until the script needs Tk.
-
- * ext/tcltklib/tcltklib.c: Show friendly error messages for errors
- on initialization.
-
- * ext/tcltklib/tcltklib.c: Avoid SEGV on ip_finalize() when ruby is
- exiting and $DEBUG is true. (Not fix. If you know the reason of
- why, please fix it.)
-
- * ext/tk/tkutil.c (ary2list, ary2list2): bug fix on handling of
- encoding.
-
- * ext/tk/lib/multi-tk.rb: MultiTkIp#eval_string and bg_eval_string
- don't work propery.
-
- * ext/tk/lib/tk.rb: Forget extending Tk::Encoding module to Tk.
- * ext/tk/lib/tk/variable.rb: TkVarAccess fails to initialize the
- object for an element of a Tcl's array variable.
-
-Wed Jul 27 23:23:54 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * gc.c (obj_free): make message format consistent with one from
- gc_mark(). [ruby-talk:149668]
-
-Wed Jul 27 22:11:37 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * sample/rss/tdiary_plugin: removed. because the plugin
- is imported in the tDiary plugin packages.
-
-Wed Jul 27 10:59:02 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * dir.c (dir_each): rewinddir(3) before iteration.
- [ruby-talk:149628]
-
-Tue Jul 26 12:57:49 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/openssl_missin.c: include <openssl/engine.h> before
- <openssl/x509_vfy.h> to avoid compilation error of mswin32.
- suggested by NAKAMURA Usaku.
-
-Mon Jul 25 21:30:46 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * {bcc32,win32,wince}/Makefile.sub: moved CPPFLAGS only for ruby
- source to XCFLAGS.
-
-Mon Jul 25 13:45:18 2005 NAJIMA Hiroki <najima@mickey.ai.kyutech.ac.jp>
-
- * io.c: check HAVE_SYS_IOCTL_H before including the header.
- [ruby-dev:26610]
-
-Mon Jul 25 14:10:02 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: fix en-bugged part in the last commit.
-
-Sat Jul 23 16:49:04 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_engine.c (ossl_engine_s_load): should check
- OPENSSL_NO_STATIC_ENGINE.
-
-Fri Jul 22 21:06:08 2005 Tadashi Saito <shiba@mail2.accsnet.ne.jp>
-
- * bignum.c (rb_big_eq): reduce isnan(). [ruby-dev:26600]
-
- * numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le): ditto.
-
-Fri Jul 22 15:02:39 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb: moved copyright description to lib/rss.rb.
-
- * lib/rss.rb: added for convenience.
-
- * sample/rss/re_read.rb: added #to_s sample.
-
- * sample/rss/blend.rb: use 'require "rss"' instead of
- 'require "rss/*"'.
- * sample/rss/list_description.rb: ditto.
- * sample/rss/rss_recent.rb: ditto.
- * sample/rss/tdiary-plugin/rss-recent.rb: ditto.
-
- * sample/rss/tdiary-plugin/rss-recent.rb: 0.0.6 -> 0.0.7.
-
-Fri Jul 22 14:37:43 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/parser.rb (RSS::Parser#initialize): accept HTTP/FTP
- URI and local file path too.
-
- * test/rss/test_parser.rb (RSS::TestParser#test_parse): test
- for the above.
-
-Fri Jul 22 07:01:42 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tkutil.c (tk_conv_args): forget to revert thread_critical
- and gc_disable when raise ArgumentError.
-
- * ext/tk/lib/remote-tk.rb: RemoteTkIp doesn't need to include TkUtil.
-
- * ext/tcltklib/tcltklib.c: add TclTkIp#has_mainwindow? method.
-
- * ext/tk/lib/tk.rb: add Tk.has_mainwindow? method.
-
- * ext/tk/lib/multi-tk.rb: add MultiTkIp#has_mainwindow? method.
-
- * ext/tk/lib/remote-tk.rb: add RemoteTkIp#has_mainwindow? method.
-
- * ext/tk/lib/multi-tk.rb: slave IP fail to exit itself when $SAFE==4.
-
- * ext/tk/lib/multi-tk.rb: remove constants from MultiTkIp module to
- avoid access from external.
-
- * ext/tk/lib/multi-tk.rb: check_root flag is ignored on slave IPs'
- mainloop.
-
- * ext/tk/lib/multi-tk.rb: hang-up Tk.mainloop called on a slave IP
- with $SAFE==4.
-
- * ext/tk/lib/multi-tk.rb: MultiTkIp#bg_eval_proc doesn't work
- properly.
-
- * ext/tk/lib/multi-tk.rb: add MultiTkIp#set_cb_error(proc) and
- cb_error(exc) to log errors at callbacks on safe slave IPs.
-
- * ext/tk/lib/multi-tk.rb: fail to get an available slave IP object
- when call Tk.mainloop in the block which is given to new_* method,
- because cannot finish initialize while the root widget is alive.
-
- * ext/tk/lib/multi-tk.rb: fail to control a slave IP when Tk.mainloop
- runs on the IP.
-
-Wed Jul 20 19:20:37 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (S_ISREG): need to define S_ISREG before it is used first.
-
-Wed Jul 20 18:40:50 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * io.c (wsplit_p): patch for the environment where
- fcntl(F_GETFL, O_NONBLOCK) is not supported. in that case,
- set FMODE_WSPLIT without fcntl check. [ruby-dev:26566]
-
-Wed Jul 20 18:07:11 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (rb_io_ctl): update FMODE_WSPLIT_INITIALIZED and FMODE_WSPLIT
- by F_SETFL.
-
-Wed Jul 20 10:04:51 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * variable.c (rb_class_path): need to adjust snprintf() len for
- teminating NUL. [ruby-dev:26581]
-
-Wed Jul 20 04:01:55 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/socket/socket.c: sorry, BeOS also uses HAVE_CLOSESOCKET,
- so reverted.
-
- * ext/socket/extconf.rb: should not define HAVE_CLOSESOCKET
- on windows.
-
-Wed Jul 20 03:16:43 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/socket/socket.c: should not undef close() on win32.
- it's defined to rb_w32_close(), otherwise handle leaks.
- [ruby-Bugs-2131]
-
-Wed Jul 20 00:48:16 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * error.c (syserr_initialize): don't use str before StringValue()
- check. [ruby-dev:26579]
-
-Tue Jul 19 22:47:29 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * error.c (syserr_initialize): add 1 byte for snprintf() size for
- NUL at the end. [ruby-dev:26574]
-
-Tue Jul 19 16:39:46 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c (rb_io_inspect): replace sprintf() with "%s" format all
- over the place by snprintf() to avoid integer overflow.
-
-Tue Jul 19 14:08:22 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c: rbtk_eventloop_depth is used as int.
-
- * ext/tcltklib/tcltklib.c: rbtk_pending_exception is tested with
- NIL_P, so should assign Qnil instead of 0 (Qfalse).
-
- * ext/tcltklib/tcltklib.c (ip_invoke_real): fixed memory leak when
- ip is deleted.
-
-Tue Jul 19 13:19:46 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/variable.rb: For symmetry, add TkVariable#string. It
- returns a string even if the default value type of the TkVariable
- object is not "string".
-
-Mon Jul 18 21:40:20 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * eval.c (rb_call0): make the pointer to NODE volatile
- instead of NODE itself.
-
-Mon Jul 18 14:32:21 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (rb_call0): make body volatile to avoid optimization problem.
- [ruby-dev:26195]
-
-Mon Jul 18 12:23:27 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/io/wait/wait.c: wrong backport from trunk. fixed: [ruby-dev:26562]
-
-Mon Jul 18 09:36:25 2005 Tanaka Akira <akr@m17n.org>
-
- * rubyio.h (FMODE_WSPLIT, FMODE_WSPLIT_INITIALIZED): new constant.
-
- * io.c (wsplit_p): new function.
- (io_fwrite): split writing data by PIPE_BUF if wsplit_p is true in
- multi-threaded mode.
- [ruby-dev:26540]
-
-Sun Jul 17 13:46:54 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/wait/extconf.rb, ext/io/wait/wait.c: Win32 platforms support.
-
-Fri Jul 15 23:59:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rdoc/parsers/parse_c.rb (handle_class_module): handle a
- module enclosed in a built-in module. fixed: [ruby-talk:148239]
-
- * lib/rdoc/parsers/parse_c.rb (find_body): allow macros as methods.
-
- * lib/rdoc/parsers/parse_c.rb (find_call_seq): allow :nodoc: modifier
- in C. [ruby-core:04572]
-
-Fri Jul 15 18:00:01 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub (COMMON_HEADERS): ruby_1_8 is using winsock.h.
- failed to compile ext/socket on bcc5.6.4. [ruby-dev:26193]
-
-Fri Jul 15 07:58:56 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/server.rb (WEBrick::GenericServer#accept_client):
- sockets should be non-blocking mode. [ruby-dev:26405]
-
- * lib/webrick/utils.rb (WEBrick::Utils.set_non_blocking): new method.
-
- * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#read_chunked):
- should call sock.read repeatedly until the preferred size data
- is obtained.
-
-Thu Jul 14 18:27:16 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (rb_w32_strerror): should return correct message
- for ENAMETOOLONG and ENOTEMPTY. (bcc32) [ruby-dev:26533]
-
- * win32/win32.c (rb_w32_strerror): stripped CR LF on the tail.
- (bcc32) [ruby-dev:26533]
-
-Thu Jul 14 00:45:42 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * LEGAL (ext/nkf/nkf-utf8): updated from nkf1.7 to nkf-utf8.
-
-Wed Jul 13 19:37:47 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (rb_w32_mkdir): should set EEXIST (not EACCES)
- if file or directory already exists. (bcc32) [ruby-dev:26508]
-
- * win32/win32.c (rb_w32_rmdir): should set ENOTDIR (not EINVAL)
- if it is not directory. (bcc32, win32)
-
- * win32/win32.c (rb_w32_rmdir, rb_w32_unlink): restore
- FILE_ATTRIBUTE_READONLY flag on function failure.
-
-Wed Jul 13 12:40:00 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: TclTkLib.do_one_event doesn't work.
-
- * ext/tk/lib/tk.rb: Tk.thread_update is available.
-
-Tue Jul 12 23:32:11 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb: keep curdir unexpanded.
-
-Mon Jul 11 08:31:29 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * regex.c (read_special): fix parsing backslashes following \c in
- regexp. fixed: [ruby-dev:26500]
-
-Mon Jul 11 02:53:00 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/cgi.rb (WEBrick::CGI::Socket#request_line):
- mistook in merging the patch of [ruby-dev:26235] at
- revision 1.4.2.6.
-
-Sun Jul 10 23:58:04 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/pathname.rb (Pathname#unlink): try Dir.unlink first to
- avoid unlink a directory by root.
- cf. [ruby-dev:26237]
-
-Sun Jul 11 05:18:17 2005 Michael Neumann <mneumann@ruby-lang.org>
-
- * lib/xmlrpc/server.rb (XMLRPC::Server): Switch from GServer over to
- WEBrick. This makes file lib/xmlrpc/httpserver.rb obsolete (at least it is
- no further used by the XML-RPC library).
-
-Sun Jul 10 12:47:01 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/debug.rb (debug_command): added a deficient format specifier.
- fixed: [ruby-core:05419]
-
-Sat Jul 9 21:28:46 2005 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_method_dispid): convert dispid
- in Ruby and C by INT2NUM and NUM2INT.
-
- * ext/win32ole/win32ole.c (ole_invoke2): ditto.
-
- * ext/win32ole/test/testWIN32OLE.rb: ditto.
-
- * ext/win32ole/test/testOLEMETHOD.rb: ditto.
-
-Fri Jul 8 15:45:04 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb (RSS::VERSION): 0.1.4 -> 0.1.5.
-
- * test/rss/test_version.rb (RSS::TestVersion#test_version):
- ditto.
-
- * lib/rss/0.9.rb (RSS::Rss::Channel::Item::Category):
- domain attribute of <category> is optional. Thanks to
- Chris Lee <clee@kde.org>.
-
- * test/rss/test_parser.rb (RSS::TestParser#test_category20):
- adjusted test case.
-
-Tue Jul 5 23:44:06 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * instruby.rb: expand source library path.
-
-Tue Jul 5 23:27:14 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (sort_2): get rid of yet another bcc's bug.
- fixed: [ruby-core:05152]
-
- * eval.c (rb_thread_save_context): must not switch contexts during
- re-allocating stack. fixed: [ruby-core:05219]
-
-Tue Jul 5 15:15:10 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tkutil.c: fix typo.
-
-Tue Jul 5 14:51:35 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: bug fix on treating Unicode strings.
-
- * ext/tcltklib/tcltklib.c: add methods to treat encoding mode.
-
- * ext/tcltklib/MANUAL.eng: add description of TclTkLib#encoding,
- encoding_system, and so on.
-
- * ext/tcltklib/MANUAL.euc: ditto.
-
- * ext/tk/tkutil.c: fail to create a Tcl's list string from an
- array including multiple kind of encoded strings.
-
- * ext/tk/lib/tk.rb: ditto.
-
- * ext/tk/lib/multi-tk.rb: 2nd arg of _{to|from}UTF8 is omissible.
-
- * ext/tk/lib/remote-tk.rb: ditto.
-
- * ext/tk/lib/tk.rb: override TclTkLib#encoding and encoding= to
- use TkCore::INTERP.encoding and encoding=.
-
- * ext/tk/lib/tk.rb: when "require 'tk'" and $KCODE=='NONE', check
- DEFAULT_TK_ENCODING to decide Ruby/Tk's system encoding mode.
-
- * ext/tk/lib/tk/encodedstr.rb: check both of Tk.encoding and
- Tk.encoding_system. Tk.encoding has higher priority.
-
- * ext/tk/lib/tk/optiondb.rb: ditto.
-
- * ext/tk/lib/tk/spinbox.rb: ditto.
-
- * ext/tk/lib/tk/validation.rb: ditto.
-
- * ext/tk/lib/tk/namespace.rb: arguemnts for TclTkIp#_merge_tklist
- should be UTF-8 strings.
-
-Mon Jul 4 14:35:52 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * sample/svr.rb: service can be stopped by ill-behaved client; use
- tsvr.rb instead.
-
-Mon Jul 4 13:25:21 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * missing/erf.c: original erf.c by prof. Okumura is confirmed to
- be public domain. reverted BSD implementation.
-
-Mon Jul 4 11:15:37 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/{dbm,gdbm,sdbm}/test_{dbm,gdbm,sdbm}.rb: skip some tests
- which using fork on fork-less platforms.
-
-Sun Jul 3 23:26:30 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * test/wsdl/document/test_rpc.rb: compare formatted time string of
- Time objects instead of comparing Time objects itself to avoid
- unintended conflict of usec part. [ruby-dev:26220]
-
-Sat Jul 2 22:41:04 2005 Tanaka Akira <akr@m17n.org>
-
- * ext/socket/socket.c (unix_send_io, unix_recv_io): support x86-64 and
- IA64.
-
-Sat Jul 2 17:06:23 2005 Tanaka Akira <akr@m17n.org>
-
- * defines.h (FLUSH_REGISTER_WINDOWS): defined for IA64.
- (flush_register_windows): declare flush_register_windows.
-
- * eval.c (flush_register_windows): new function.
-
-Fri Jul 1 17:48:52 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bignum.c (get2comp): revert all prior changes, and calculate
- proper 2's complement for negative numbers. backported from
- HEAD.
-
-Fri Jul 1 15:50:12 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * missing/erf.c: need to include some headers for some platforms.
-
- * win32/win32.h (copysign, scalb): define for compatibility with
- other platforms. [ruby-dev:26430]
-
-Fri Jul 1 15:37:42 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * missing/crypt.c: modified to make it compilable on platforms
- other than BSD. [ruby-dev:26430]
-
- * missing/erf.c: ditto. code from <exp.c> merged.
-
-Fri Jul 1 12:44:56 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb (OpenURI.open_http): refine post_connection_check
- call.
-
-Fri Jul 1 11:34:08 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * missing/crypt.c: replaced with 4.4BSD version.
-
- * missing/erf.c: ditto.
-
- * missing/vsnprintf.c: removed the third provision from the old
- BSD license. [ruby-core:05177]
-
-Fri Jul 1 01:45:21 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_min, enum_max): must not return Qundef.
- fixed: [ruby-core:05299]
-
-Fri Jul 1 00:18:40 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/delegate.rb (Delegator::respond_to): respond_to? must check
- destination object. [ruby-talk:146894]
-
-Thu Jun 30 19:00:21 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
- * lib/irb/ruby-lex.rb (RubyLex::identify_number): alternative implements
- for [ruby-dev:26410]. And support a numeric form of 0d99999.
-
-Thu Jun 30 17:28:10 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/irb/ruby-lex.rb (RubyLex::identify_number): should not treat
- plain zero as an octal number. [ruby-dev:26410]
-
-Thu Jun 30 15:13:16 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_eval): pre-evaluate argument for unambiguous
- evaluation order. [ruby-dev:26383]
-
-Thu Jun 30 09:53:56 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/delegate.rb (Delegator::method_missing): forward unknown
- method to the destination. suggested by
- <christophe.poucet@gmail.com>. [ruby-talk:146776]
-
-Tue Jun 28 21:59:29 2005 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * dir.c, eval.c, hash.c, process.c, ruby.c: avoid warning "unused
- variable" [ruby-dev:26387]
-
-Sat Jun 25 17:15:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/httputils.rb (WEBrick::HTTPUtils.parse_query): should
- discard if key=val pair is empty. patch from Gary Wright.
-
-Sat Jun 25 23:30:51 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * process.c (detach_process_watcher): terminate process watcher
- thread right after rb_waitpid() succeed. [ruby-talk:146430]
-
-Sat Jun 25 15:49:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_min, enum_max): do not ignore nil as the first element.
-
-Sat Jun 25 14:40:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/sdbm/init.c (fsdbm_select): SDBM#select had returned the array
- which contained each elements twice. [ruby-dev:26358]
-
-Fri Jun 25 05:06:47 2005 Michael Neumann <mneumann@ruby-lang.org>
-
- * lib/xmlrpc/*, test/xmlrpc/*: backported changes from HEAD into 1.8
-
-Fri Jun 24 17:00:00 2005 Shigeo Kobayashi <shigeo@tinyforest.jp>
-
- * ext/bigdecimal/bigdecimal.c: patch from "NATORI Shin"
- (u-tokyo.ac.jp) applied to fix rounding bug.
-
-Fri Jun 24 13:06:45 2005 akira yamada <akira@ruby-lang.org>
-
- * lib/uri/common.rb, lib/uri/generic.rb: fixed typo in documents and
- replaced some existent domain name with "example.com".
-
-Fri Jun 24 12:23:19 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: fix typo on Tk.grid_propagate.
-
- * ext/tk/lib/tk.rb: Tk.event_generate and TkWindow#event_generate
- accept TkEvent::Event object as context argument.
-
- * ext/tk/lib/tk/event.rb: add TkEvent::Event#valid_fields and
- valid_for_generate to get field parameters of event_generate.
-
-Thu Jun 23 23:55:59 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * runruby.rb: should load built rbconfig.rb.
-
-Thu Jun 23 16:53:15 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/canvastag.rb: TkcGroup.new cannot include given items.
- TkcGroup#exclude calls wrong method.
- Add alias TkcGroup#add [ruby-talk:146049].
-
- * ext/tk/lib/tk/canvas.rb: TkCanvas#dtag and some subcommands of
- TkCanvas#addtag fail to treat a TkcTag argument.
-
- * ext/tk/lib/tk/event.rb: add TkEvent::Event#generate to help to send
- current event to other widgets.
-
-Mon Jun 20 18:44:04 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): DUMMY_SETJMP is replaced
- because setjmp is not enough to fix getcontext and SPARC register
- window problem.
-
-Mon Jun 20 16:48:36 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/dbm/dbm.c (fdbm_closed): new method DBM#closed?
-
- * ext/gdbm/gdbm.c (fgdbm_closed): new method GDBM#closed?
-
- * ext/sdbm/init.c (fsdbm_closed): new method SDBM#closed?
-
- * test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb, test/sdbm/test_sdbm.rb
- (teardown): close all db objects before deleting data files.
-
- * win32/win32.{ch} (unlink): hook runtime function to change
- file attribute before unlinking.
- fixed: [ruby-dev:26360]
-
-Mon Jun 20 02:15:35 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (define_final): document fix: finalizers never get called
- before target object is destroyed.
-
-Mon Jun 20 01:26:49 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/openssl_missing.c, ext/openssl/ossl.h,
- ext/openssl/ossl_asn1.c, ext/openssl/ossl_bio.c,
- ext/openssl/ossl_pkcs12.h, ext/openssl/ossl_x509req.c: avoid
- compiler warnings. suggested by Michal Rokos.
-
-Sun Jun 19 14:09:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (run_final): reduce unnecessary object allocation during
- finalization.
-
- * gc.c (rb_gc_call_finalizer_at_exit): deferred finalizers list should
- be cleared before calling them. fixed: [ruby-talk:145790]
-
-Fri Jun 17 13:01:40 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/time.rb (Time.parse): fix previous leap seconds support.
- (Time.rfc2822): ditto.
- (Time.xmlschema): ditto.
-
-Thu Jun 16 15:06:55 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c (ip_rb_threadVwaitCommand): Tcl_Release
- was missing.
-
-Thu Jun 16 13:34:48 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: add Tk.getMultiple{Open|Save}File() which return
- an Array of selected files.
-
-Thu Jun 16 12:53:24 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/time.rb (Time.parse): "Fri Jan 1 08:59:60 +0900 1999" was
- parsed as "Fri Jan 01 09:00:00 JST 1999" even on an environment
- which supports leap seconds.
- (Time.rfc2822): ditto.
- (Time.xmlschema): ditto.
-
-Thu Jun 16 08:29:22 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/dl/sym.c (rb_dlsym_call): needs FREE_ARGS before return.
- fixed memory leak. [ruby-Bugs-2034]
-
-Wed Jun 15 18:26:39 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: support "tk inactive" sub-command [for Tcl/Tk8.5a3]
-
- * ext/tk/lib/tk/namespace.rb: support "namespace path" sub-command and
- 'namespace ensemble' sub-command [for Tcl/Tk8.5a3]
-
-Tue Jun 14 02:02:43 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tkutil.c: add TkUtil::CallbackSubst.subst_arg(m, ...) &
- _define_attribute_aliases(hash) to get substitution-argument from
- attributes (e.g. subst_arg(:x,:y,:num,:button) --> "%x %y %b %b ").
-
- * ext/tk/lib/tk/event.rb: use _define_attribute_aliases().
-
-Mon Jun 13 13:01:05 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * hash.c (ruby_setenv): fixed SEGV. [ruby-dev:26186]
-
-Mon Jun 13 01:54:20 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * signal.c (sigexit): call rb_thread_signal_exit() instead of
- rb_exit(). [ruby-dev:26347]
-
- * eval.c (rb_thread_signal_exit): a new function to exit on main
- thread.
-
- * eval.c (rb_thread_switch): exit status should be retrieved from
- ruby_errinfo.
-
- * eval.c (rb_f_exit): ensure exit(0) should call
- exit(EXIT_SUCCESS).
-
-Mon Jun 13 01:20:02 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (rb_gc_mark_threads): curr_thread may not be part of the
- thread list. [ruby-dev:26312]
-
-Fri Jun 10 23:35:34 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * missing/mkdir.c: remove. [ruby-core:05177]
-
-Fri Jun 10 22:54:26 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * missing.h: fd_set stuffs need sys/types.h. fixed: [ruby-core:05179]
-
-Thu Jun 9 23:58:12 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/Win32API/Win32API.c (Win32API_Call): disable global
- optimization. fixed: [ruby-core:05143]
-
-Thu Jun 9 23:35:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_inject): default the result value to Qundef to use
- first element as initial value if not given.
-
-Thu Jun 9 19:55:41 2005 Tanaka Akira <akr@m17n.org>
-
- * eval.c (ruby_longjmp): new macro to call longjmp, setcontext, etc.
- (ruby_setjmp): new macro to call setjmp, getcontext, etc.
- (ruby_setjmp): call setjmp before getcontext to avoid IA64 register
- stack problem.
- [ruby-talk:144939]
-
- * gc.c (Init_stack): remove IA64_MAGIC_STACK_LIMIT.
-
-Thu Jun 9 11:55:34 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/delegate.rb (SimpleDelegator::__setobj__): need check for
- recursive delegation. [ruby-core:04940]
-
-Wed Jun 8 18:47:10 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-expr-beg): fix looking point drift.
-
-Wed Jun 8 11:11:34 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bignum.c (get2comp): calculate proper 2's complement for
- negative numbers. a bug in normalizing negative numbers
- reported from Honda Hiroki <hhonda@ipflex.com>.
-
-Wed Jun 8 08:33:10 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_min_by, enum_max_by): return nil if no iteration.
- fixed: [ruby-dev:26245]
-
- * eval.c (rb_need_block): ensure a block is given.
-
- * eval.c (backtrace): skip successive frames sharing same node.
-
-Wed Jun 8 00:15:08 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from
- KUBO Takehiro <kubo at jiubao.org> to support AIX. [ruby-list:40832]
-
-Wed Jun 8 00:09:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from
- Tilman Sauerbeck <tilman at code-monkey.de>. [ruby-core:05055]
-
- * lib/yaml/rubytypes.rb (Hash::to_yaml): ditto.
-
-Wed Jun 8 00:00:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/curses/curses.c (curses_insertln): merged a patch from
- TAKAHASHI Tamotsu <ttakah at lapis.plala.or.jp>. [ruby-ext:02305]
-
-Tue Jun 7 19:34:15 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/irb/init.rb (IRB::IRB.rc_file_generators): more flexible
- IRB.rc_file_generators. [ruby-core:05163]
-
-Tue Jun 7 18:39:31 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/thread.rb: RDoc documentation from Eric Hodel
- <drbrain at segment7.net> added. [ruby-core:05148]
-
-Tue Jun 7 18:30:04 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): add .SUFFIXES from depend file.
- fixed: [ruby-dev:26294]
-
-Tue Jun 7 17:39:54 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * object.c (rb_mod_cvar_get): Module#class_variable_get(): back
- ported from CVS HEAD. [ruby-talk:144741]
-
- * object.c (rb_mod_cvar_set): Module#class_variable_set().
- [ruby-talk:144741]
-
-Tue Jun 7 16:32:53 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * sprintf.c (rb_f_sprintf): raise exception on debug mode (-d),
- not verbose mode (-v/-w). [ruby-core:05123]
-
-Tue Jun 7 10:30:49 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: slave-ip fails to call procedures
- delegated by master-ip.
-
-Sun Jun 5 23:00:35 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/console.rb: create console when required
-
- * ext/tk/sample/tkextlib/tile/demo.rb: fix TypeError & create Console
-
-Sat Jun 4 14:55:18 2005 Tanaka Akira <akr@m17n.org>
-
- * test/dbm/test_dbm.rb: merged from ext/dbm/testdbm.rb.
-
- * test/gdbm/test_gdbm.rb: merged from ext/gdbm/testgdbm.rb.
-
- * test/sdbm/test_sdbm.rb: renamed from ext/sdbm/testsdbm.rb with
- modification to use test/unit.
-
-Fri Jun 3 14:06:12 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: fix typo.
-
-Wed Jun 1 11:32:42 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub: can use single quote character in DESTDIR.
- [ruby-dev:26205]
-
-Mon May 30 23:48:29 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/macpkg.rb: add PACKAGE_NAME information of Tcl/Tk
- Extension.
-
- * ext/tk/lib/tk/msgcat.rb: ditto.
-
- * ext/tk/lib/tk/winpkg.rb: ditto.
-
- * ext/tk/lib/tkextlib/*: ditto.
-
-Sat May 28 16:40:15 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * test/openssl/test_x509store.rb: add test for expired CRL
- and refine some assertions.
-
-Sat May 28 05:15:51 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_x509store.c (ossl_x509stctx_set_time): should
- not set internal flag directry.
-
-Sat May 28 02:00:11 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/cgi.rb (WEBrick::CGI::Socket#request_line):
- ENV["REQUEST_URI"] is better to get correct Request-URI
- than ENV["SCRIPT_NAME"] + ENV["PATH_INFO"]. [ruby-dev:26235]
-
-Fri May 27 16:32:04 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * lib/mkmf.rb: use the semicolon as the path separator
- in the environment of MSYS. fixed: [ruby-dev:26232]
-
-Thu May 26 06:08:11 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: add shortcut-methods of tk_call + tk_split_list
-
-Wed May 25 22:52:42 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/irb/input-method.rb: do not use Readline::HISTORY.pop.
- (backported from HEAD)
-
-Wed May 25 21:55:40 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/readline/readline.c: supported libedit. (backported from HEAD)
-
- * ext/readline/extconf.rb: ditto.
-
- * test/readline/test_readline.rb: ditto.
-
-Wed May 25 20:06:27 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: TkComm#tk_split_*list fail to split a kind of SJIS
- strings. To avoid the trouble, add arguments to control converting
- encoding, and do split on a UTF8 string.
-
- * ext/tk/lib/multi-tk.rb: modify to attend encoding.
-
- * ext/tk/lib/remote-tk.rb: ditto.
-
- * ext/tk/lib/tk/itemconfig.rb: ditto.
-
- * ext/tk/lib/tk/listbox.rb: ditto.
-
- * ext/tk/lib/tk/namespace.rb: ditto.
-
- * ext/tk/lib/tk/panedwindow.rb: ditto.
-
- * ext/tk/lib/tk/text.rb: ditto.
-
- * ext/tk/lib/tk/textmark.rb: ditto.
-
- * ext/tk/lib/tk/texttag.rb: ditto.
-
- * ext/tk/lib/tk/variable.rb: ditto.
-
- * ext/tk/lib/tk/winfo.rb: ditto.
-
- * ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb: ditto.
-
- * ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: ditto.
-
- * ext/tk/lib/tk.rb: add TkWindow#lower_window/raise_window and
- Tk#lower_window/raise_window by reason of method-name conflict
-
- * ext/tk/lib/tk/canvas.rb: bug fix on TkCanvas#delete when given
- non-TkcItem arguments.
-
- * ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb: ditto.
-
-Wed May 25 12:59:48 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb (OpenURI::Meta::RE_QUOTED_STRING): a content of
- quoted-string should be zero or more characters.
-
-Tue May 24 23:42:16 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * numeric.c (fix_pow): support Fixnum ** Float case directly
- without coercing. [ruby-talk:142697] [ruby-talk:143054]
-
-Tue May 24 16:57:24 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ruby.c (require_libraries): caused SEGV when continuation jumped
- in to the required library code.
-
-Tue May 24 11:56:25 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * lib/getopts.rb: should warn only if verbose mode.
- fixed: [ruby-dev:26201]
-
-Tue May 24 06:45:31 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): string
- literals to be matched non-greedy.
-
-Tue May 24 00:34:32 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * test/soap/calc: method name 'set' was able to crash with a class Set.
- [ruby-dev:26210]
-
- * test/wsdl/document/test_rpc.rb: dateTime comparison failed under
- TZ=right/Asia/Tokyo (with leap second.) [ruby-dev:26208]
-
-Mon May 23 16:24:05 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/extconf.rb: Framework support on MacOS X Tiger.
-
- * ext/tcltklib/README.1st: add description of Framework support options.
-
-Mon May 23 12:21:37 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * re.c (make_regexp): should not return junk address during
- compile time. [ruby-dev:26206]
-
-Sun May 22 21:54:06 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/{soap,wsdl,xsd}, test/{soap,wsdl,xsd}: imported soap4r/1.5.4.
-
- == SOAP client and server ==
-
- === for both client side and server side ===
-
- * improved document/literal service support.
- style(rpc,document)/use(encoding, literal) combination are all
- supported. for the detail about combination, see
- test/soap/test_style.rb.
-
- * let WSDLEncodedRegistry#soap2obj map SOAP/OM to Ruby according to
- WSDL as well as obj2soap. closes #70.
-
- * let SOAP::Mapping::Object handle XML attribute for doc/lit service.
- you can set/get XML attribute via accessor methods which as a name
- 'xmlattr_' prefixed (<foo name="bar"/> -> Foo#xmlattr_name).
-
- === client side ===
-
- * WSDLDriver capitalized name operation bug fixed. from
- 1.5.3-ruby1.8.2, operation which has capitalized name (such as
- KeywordSearchRequest in AWS) is defined as a method having
- uncapitalized name. (converted with GenSupport.safemethodname
- to handle operation name 'foo-bar'). it introduced serious
- incompatibility; in the past, it was defined as a capitalized.
- define capitalized method as well under that circumstance.
-
- * added new factory interface 'WSDLDriverFactory#create_rpc_driver'
- to create RPC::Driver, not WSDLDriver (RPC::Driver and WSDLDriver
- are merged). 'WSDLDriverFactory#create_driver' still creates
- WSDLDriver for compatibility but it warns that the method is
- deprecated. please use create_rpc_driver instead of create_driver.
-
- * allow to use an URI object as an endpoint_url even with net/http,
- not http-access2.
-
- === server side ===
-
- * added mod_ruby support to SOAP::CGIStub. rename a CGI script
- server.cgi to server.rb and let mod_ruby's RubyHandler handles the
- script. CGIStub detects if it's running under mod_ruby environment
- or not.
-
- * added fcgi support to SOAP::CGIStub. see the sample at
- sample/soap/calc/server.fcgi. (almost same as server.cgi but has
- fcgi handler at the bottom.)
-
- * allow to return a SOAPFault object to respond customized SOAP fault.
-
- * added the interface 'generate_explicit_type' for server side
- (CGIStub, HTTPServer). call 'self.generate_explicit_type = true'
- if you want to return simplified XML even if it's rpc/encoded
- service.
-
- == WSDL ==
-
- === WSDL definition ===
-
- * improved XML Schema support such as extension, restriction,
- simpleType, complexType + simpleContent, ref, length, import,
- include.
-
- * reduced "unknown element/attribute" warnings (warn only 1 time for
- each QName).
-
- * importing XSD file at schemaLocation with xsd:import.
-
- === code generation from WSDL ===
-
- * generator crashed when there's '-' in defined element/attribute
- name.
-
- * added ApacheMap WSDL definition.
-
- * sample/{soap,wsdl}: removed.
-
-Sun May 22 19:11:35 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#intialize):
- should initialize session id context. [ruby-core:4663]
-
- * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): add session id support.
-
-Sat May 21 10:24:21 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub: tds files were not deleted when DESTDIR
- included '\' path delimiter. [ruby-dev:26193]
-
-Thu May 19 19:04:29 2005 speakillof <speakillof@yahoo.co.jp>
-
- * lib/rexml/encodings/SHIFT-JIS.rb: encoding and decoding were
- swapped. [ruby-core:4772]
-
-Wed May 18 23:42:25 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (exc_exception): reverted to call Exception#initialize
- directly. fixed: [ruby-dev:26177]
-
-Wed May 18 23:39:09 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (glob_helper): get rid of using String. [ruby-dev:26180]
-
- * dir.c (push_braces): should skip balanced braces.
-
- * eval.c (ruby_options), win32/win32.c (NtInitialize): move argument
- intialization back. [ruby-dev:26180]
-
-Tue May 17 15:31:31 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): should
- break the loop if the socket reached to EOF. [ruby-talk:142285]
-
-Tue May 17 11:52:18 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (unixtime_to_filetime): use localtime() instead of
- gmtime() when using FileLocalTimeToFileTime().
-
-Mon May 16 22:28:43 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.h, {bcc32,win32,wince}/Makefile.sub: moved rb_[ugp]id_t
- to get rid of redefinition warnings on mingw.
-
- * class.c (rb_class_init_copy): singleton class is disallowed to copy,
- from its definition. fixed: [ruby-talk:142749]
-
-Mon May 16 08:52:29 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.{h,c}: define rb_[pgu]id_t.
-
-Mon May 16 00:21:02 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/pathname.rb (Pathname#unlink): use SystemCallError instead of
- Errno::EISDIR because EISDIR is not portable.
- [ruby-core:5001]
-
-Sun May 15 22:11:33 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb (DRbObject#method_missing): use raise(exception).
- [ruby-dev:26164]
-
-Sun May 15 18:56:35 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in, ruby.h: define rb_[pgu]id_t macros instead of typedefs
- to get rid of types which might not be defined yet. [ruby-dev:26165]
-
-Sun May 15 14:35:46 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/pathname.rb (Pathname#unlink): unlink a symlink to a directory
- was failed. [ruby-core:4992]
-
-Sun May 15 09:57:30 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (unixtime_to_filetime): deal with DST.
- [ruby-talk:141817]
-
-Sat May 14 23:59:11 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (exc_exception, {exit,name_err,syserr}_initialize): call
- Execption#initialize. fixed: [ruby-talk:142593]
-
-Sat May 14 23:57:26 2005 Erik Huelsmann <ehuels@gmail.com>
-
- * configure.in: Check for the availability of pid_t, gid_t and uid_t and
- remove AC_TYPE_UID_T. fixed: [ruby-core:04745]
-
- * defines.h: Remove pid_t typedef.
-
- * ruby.h: Define rb_pid_t, rb_gid_t and rb_uid_t in accordance with
- the available system types.
-
- * process.c: Change instances of pid_t and gid_t to their rb_*
- counterparts.
-
- * ext/pty/pty.c: Change pid_t to rb_pid_t.
-
- * vms/config.h: Define HAVE_{P,G,U}ID_T to 1.
-
- * win32/Makefile.sub: Remove #define for {g,u}id_t.
-
- * win32/win32.c: Change pid_t to rb_pid_t.
-
- * wince/Makefile.sub: Remove #define for {g,u}id_t.
-
- * wince/sys/types.h: Remove definitions of {p,g,u}id_t.
-
-Fri May 13 23:44:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb: keep srcdir unexpanded.
-
- * lib/mkmf.rb (create_makefile): quote topdir and hdrdir if necessary.
- fixed: [ruby-core:04932]
-
- * lib/mkmf.rb (configuration), {bcc32,win32,wince}/Makefile.sub: make
- also INSTALL_PROG and INSTALL_DATA system dependent.
- fixed: [ruby-core:04931]
-
-Fri May 13 17:54:39 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * variable.c (generic_ivar_get): rb_attr_get should not warn.
- [ruby-dev:26010]
-
-Fri May 13 12:28:43 2005 Daniel Berger <djberge@qwest.com>
-
- * array.c (rb_ary_select): can remove argc check. [ruby-core:4911]
-
- * test/ruby/test_array.rb: add test for find_all.
-
-Fri May 13 11:29:00 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * eval.c (unknown_node): add volatile directive to prototype.
-
-Thu May 12 17:08:48 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (rb_io_eof, remain_size, read_all, io_read, appendline)
- (swallow, rb_io_each_byte, rb_io_getc): revert previous change.
-
- * io.c (rb_io_eof, io_fread, appendline, swallow, rb_io_each_byte)
- (rb_io_getc, rb_getc): call clearerr before getc to avoid
- stdio incompatibility.
-
-Thu May 12 16:52:20 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/rdoc/parsers/parse_c.rb: more readability for mixing
- progress "c..." and warning message.
-
-Thu May 12 16:31:00 2005 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c: follow nkf 2.0.5
-
-Thu May 12 16:15:01 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (rb_io_eof, remain_size, read_all, io_read, appendline)
- (swallow, rb_io_each_byte, rb_io_getc): don't rely EOF flag.
- [ruby-talk:141527]
-
-Thu May 12 15:56:20 2005 Tilman Sauerbeck <tilman@code-monkey.de>
-
- * lib/rdoc/parsers/parse_c.rb: show parsing progress for C files.
- [ruby-core:4341]
-
-Thu May 12 13:47:56 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * test/drb/test_drb{ssl,unix}.rb: can test drb
- before install. (backported from HEAD) [ruby-dev:26146]
-
-Thu May 12 09:53:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * version.c (ruby_show_version): flush for non-tty stdout.
-
-Thu May 12 09:07:07 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * test/ruby/envutil.rb, test/drb/drbtest.rb: can test drb
- before install. (backported from HEAD) [ruby-Bugs-1672]
-
-Thu May 12 01:23:55 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_eval), parse.y (arg): reduce fixnum range literal at
- parser. fixed: [ruby-dev:26113]
-
- * eval.c (unknown_node): ignore broken NODE to get rid of accessing
- possibly inaccessible address. fixed: [ruby-dev:26122]
- should emit more useful information like [ruby-dev:26126], though.
-
-Wed May 11 16:20:01 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/cgi.rb: new methods WEBrick::CGI#[], WEBrick::CGI#logger
- and WEBrick::CGI#config. (backported from HEAD)
-
- * lib/webrick/httputils.rb (WEBrick::HTTPUtils.escape_path): should
- not use String#split("/"). (backported from HEAD)
-
-Wed May 11 15:58:39 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (break_jump): break should not cross functions.
- [ruby-list:40818]
-
-Wed May 11 10:39:37 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/tempfile.rb (Tempfile#unlink): fixed typo.
-
-Wed May 11 01:03:36 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (TMP_ALLOC): use macro NEW_NODE() to get rid of warnings on
- platforms which have no alloca(). fixed: [ruby-talk:141301]
-
-Sun May 8 23:17:47 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/timer.rb: fix typo.
-
-Sun May 8 16:52:56 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/profiler.rb: fixed "undefined method `[]' for nil:NilClass"
- [ruby-core:4775] [ruby-talk:140401] [ruby-dev:26118]
-
-Sat May 7 22:58:00 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_var): no libs argument is given.
-
-Sun May 1 09:58:11 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (process_sflag): replace '-' in variable names with '_'.
- [ruby-dev:26107]
-
- * ruby.c (set_arg0): use also environment variable space for setting
- $0. [ruby-core:04774]
-
-Wed Apr 27 23:42:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (OPTFLAGS): default global optimization to
- disabled only for VC++6.
-
-Tue Apr 26 22:58:00 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_invoke_core): call Tcl's "::unknown"
- command when can't get information of target command.
-
-Mon Apr 25 01:18:43 2005 Tanaka Akira <akr@m17n.org>
-
- * regex.c: declare rb_warn to have variadic argument. [ruby-core:4751]
-
-Sat Apr 23 19:45:59 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c (ip_RubyExitCommand): exit with status code
- via TclTkIp#_eval didn't work. [ruby-talk:139390]
-
-Fri Apr 22 16:41:50 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tcltklib/tcltklib.c (ip_set_exc_message): fixed memory leak.
-
- * ext/tcltklib/tcltklib.c: eTkCallbackReturn was not initialized.
-
-Thu Apr 21 00:07:50 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (create_makefile): support platforms have file separator
- other than /.
-
- * {bcc32,win32,wince}/Makefile.sub (BUILD_FILE_SEPARATOR): separator
- of building platform.
-
- * {bcc32,win32,wince}/Makefile.sub (CP, INSTALL): use COPY command.
-
-Wed Apr 20 23:22:39 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in, common.mk: miniruby depens on MINIOBJS.
-
- * dmydln.c (dln_load): dummy function to raise LoadError.
-
- * cygwin/GNUmakefile.in, {bcc32,win32,wince}/Makefile.sub: miniruby
- can't load extensions on Windows.
-
-Wed Apr 20 23:01:35 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/ifchange.bat: delete testing files.
-
-Wed Apr 20 07:27:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * {bcc32,win32,wince}/configure.bat, {bcc32,win32,wince}/setup.mak:
- add extout option.
-
- * bcc32/setup.mak: make configuration variables overridable.
-
-Wed Apr 20 04:15:27 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
-
- * lib/irb.rb lib/irb/* doc/irb: IRB 0.9.5
-
-Tue Apr 19 23:37:09 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * lib/ftools.rb (File.safe_unlink): do not modify a symlinked file.
-
-Tue Apr 19 00:06:20 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb: expand path for ext/**/extconf.rb.
-
-Mon Apr 18 11:25:14 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/zlib/zlib.c (zstream_run): fixed SEGV. [ruby-core:4712]
-
-Sun Apr 17 23:57:49 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake, parse_args): do not expand destdir.
-
- * ext/extmk.rb (relative_from): treat mere drive letter as an absolute
- path.
-
-Sat Apr 16 17:01:16 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * sample/rss/tdiary_plugin/rss-recent.rb (rss_recent_cache_rss):
- use the first date information of items as site date information
- if channel doesn't have date information.
-
-Sat Apr 16 15:27:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_PROG_INSTALL): not add -p option to INSTALL.
- files need timestamps to be kept are only ar-archive on a few
- platforms, and be installed by instruby.rb but not INSTALL.
- fixed: [ruby-core:04721]
-
- * mkconfig.rb: purge autoconf value variables.
-
-Sat Apr 16 10:36:01 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub: quick hack... prepend DESTDIR.
- still have restriction on DESTDIR ("", "/", "e:")
-
-Sat Apr 16 03:59:42 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/extconf.rb: check for OPENSSL_cleanse.
-
- * ext/openssl/openssl_missing.h: ditto.
-
-Thu Apr 14 19:18:30 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (remove_file): ignore exceptions caused by
- chmod.
-
- * lib/fileutils.rb (remove_dir): try to get rights to rmdir.
- [ruby-Bugs:1502] (2 items backportted from HEAD, rev 1.53-54)
-
-Thu Apr 14 16:57:40 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bcc32/Makefile.sub: failed to remove debug information files.
- fixed: [ruby-dev:26034]
-
-Wed Apr 13 23:40:21 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb (RSS::VERSION): 0.1.3 -> 0.1.4.
-
- * lib/rss/rss.rb (RSS::Element#converter): fixed converter
- transmission bug.
-
-Wed Apr 13 21:20:35 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * configure.in (mingw32): extract msvcr*.dll from objdump result.
-
-Wed Apr 13 20:24:30 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (mingw32): use actual runtime DLL name as ruby DLL
- name and default load path.
-
- * win32/Makefile.sub, win32/setup.mak: ditto.
-
-Tue Apr 12 15:33:09 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_finalize): better modification than the
- previous commit [ruby-dev:26029].
-
-Tue Apr 12 12:38:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_finalize): fix SEGV when Tcl_GlobalEval()
- modifies the argument string to eval.
-
-Tue Apr 12 02:21:55 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_finalize): add existence check of
- Tcl commands before calling Tcl_GlobalEval().
-
-Mon Apr 11 23:47:21 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb: [druby-ja:123] fix: When reference of my object is
- loaded, the object is tainted.
-
- * test/drb/test_drb.rb: ditto.
-
-Mon Apr 11 22:18:23 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * dir.c, file.c (lstat): avoid warnings for mingw.
-
-Mon Apr 11 20:11:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_finalize): adhoc patch to avoid SEGV
- when exit on Tcl/Tk8.3.x.
-
-Mon Apr 11 15:26:25 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/mkmf.rb (configuration): shouldn't output hdrdir twice.
-
-Mon Apr 11 12:09:05 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * {bcc32,win32,wince}/Makefile.sub: ri data was not installed
- into correct path. [ruby-dev:26011]
-
- * bcc32/Makefile.sub: defaulted install-nodoc. [ruby-dev:26011]
-
-Sun Apr 10 10:12:42 2005 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c(ole_invoke): retry after converting Qnil
- to VT_EMPTY.
-
- * ext/win32ole/win32ole/tests/testWIN32OLE.rb: correct error
- message string "Unknown" => "unknown".
-
-Sat Apr 9 18:20:31 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/image.rb: support to create TkImage object without
- creating a new image object on Tk.
-
- * ext/tk/lib/tk/menu.rb: use TkCommandNames on create_self()
-
- * ext/tk/lib/tk/root.rb: TkRoot.to_eval() returns '.'.
-
- * ext/tk/lib/tk/text.rb: add methods to create a TkText::IndexString
- from (x, y) coords.
-
- * ext/tk/lib/tkextlib/tile/: add demo and update support status.
-
-Sat Apr 9 14:42:29 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * sample/rss/tdiary_plugin/rss-recent.rb: supported configuration
- via Web browser.
-
-Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss: backoported from HEAD.
-
- * lib/rss: refactored.
- - gave a name to 'x'.
- - undef_method -> remove_method for avoiding a warning in ruby 1.6.
-
-
- * lib/rss/parser.rb: @@setter -> @@setters.
-
- * lib/rss/parser.rb
- (RSS::BaseListener.register_uri)
- (RSS::BaseListener.uri_registered?)
- (RSS::BaseListener.install_get_text_element):
- swapped the first argument and the second argument.
-
- * lib/rss/taxonomy.rb: swapped the first argument and the second
- argument for RSS::BaseListener.install_get_text_element.
- * lib/rss/image.rb: ditto.
- * lib/rss/syndication.rb: ditto.
- * lib/rss/dublincore.rb: ditto.
- * lib/rss/parser.rb: ditto.
- * lib/rss/1.0.rb: ditto.
- * lib/rss/2.0.rb: ditto.
- * lib/rss/0.9.rb: ditto.
- * lib/rss/content.rb: ditto.
-
- * lib/rss/parser.rb
- (RSS::BaseListener.install_setter)
- (RSS::BaseListener.register_uri): changed fallback way.
-
- * lib/rss/parser.rb: added class name registry for complex model
- elements. (ex. have childlen elements, have some attributes and
- a child element and so on.)
-
-
- * lib/rss/dublincore.rb: supported multiple Dublin Core items.
- * lib/rss/maker/dublincore.rb: ditto.
-
- * lib/rss/maker/image.rb: supproted new Dublin Core API.
-
-
- * lib/rss/maker/base.rb: added default current_element implementation.
-
-
- * lib/rss/trackback.rb (RSS::TrackBackUtils.new_with_value_if_need):
- moved to RSS::Utils.
-
- * lib/rss/utils.rb (RSS::Utils.new_with_value_if_need):
- moved from RSS::TrackBackUtils.
-
-
- * lib/rss/maker/image.rb: fixed invalid argument of
- add_need_initialize_variable bug.
- * lib/rss/maker/trackback.rb: ditto.
-
-
- * lib/rss/rss.rb (Hash#merge): added for ruby 1.6.
-
- * lib/rss/rss.rb (RSS::BaseModel.date_writer): changed to accept nil
- for date value.
-
-
- * test/test_dublincore.rb: added tests for plural accessor and
- multiple Dublin Core items.
-
- * test/test_setup_maker_1.0.rb: fixed swapped actual and expected
- values.
-
- * test/rss/rss-assertions.rb (assert_multiple_dublin_core): added
- an assertion for testing multiple Dublin Core items.
-
- * test/rss/test_maker_dc.rb (test_rss10_multiple): added a test
- for making multiple Dublin Core items.
-
- * test/rss/test_maker_dc.rb (test_date): added a test for #date=
- and #dc_date=.
-
-
- * sample/rss/tdiary_plugin/rss-recent.rb:
- new option: @options['rss-recent.use-image-link']:
- use image as link instread of text if available.
-
- * sample/rss/tdiary_plugin/rss-recent.rb (RSS_RECENT_VERSION):
- 0.0.5 -> 0.0.6.
-
-Fri Apr 8 20:17:48 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): hdrdir needs to be defined also in
- Config::CONFIG.
-
- * lib/mkmf.rb (configuration, create_makefile): get rid of recursive
- macro reference.
-
-Fri Apr 8 18:26:56 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ssl.c: add callbacks to OpenSSL::SSL::SSLContexts.
- - SSLContext#client_cert_cb=(aProc). it is called when a client
- certificate is requested by a server and no certificate was not
- set for the SSLContext. it must return an Array which includes
- OpenSSL::X509::Certificate and OpenSSL::PKey::RSA/DSA objects.
- - SSLContext#tmp_dh_callback=(aProc). it is called in key
- exchange with DH algorithm. it must return an OpenSSL::PKey::DH
- object.
-
- * ext/openssl/ossl_ssl.c (ossl_sslctx_set_ciphers): ignore the
- argument if it's nil.
-
- * ext/openssl/ossl_pkey.c
- (GetPrivPKeyPtr, ossl_pkey_sign): should call rb_funcall first.
- (DupPrivPKeyPtr): new function.
-
- * ext/openssl/ossl_pkey_dh.c: add default DH parameters.
-
- * ext/openssl/ossl_pkey.h: ditto.
-
-Fri Apr 8 01:55:20 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/sample/demos-{en,jp}/goldberg.rb: reduced window size.
- [ruby-dev:25992]
-
-Thu Apr 7 23:58:40 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): keep directory names in Makefile as macros.
-
- * lib/mkmf.rb (configuration, create_makefile): ditto.
-
- * lib/mkmf.rb (CXX_EXT): separate C++ extensions.
-
-Thu Apr 7 17:43:25 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_call0): "return" event hook should be always executed
- if event_hooks is set. fixed: [ruby-core:04662]
- (backported from HEAD)
-
-Mon Apr 4 23:17:52 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb (TkComm#array2tk_list): accept enc-mode argument to
- decide whether convert encoding of each element or not.
-
- * ext/tk/lib/tk/variable.rb (TkVariable#value=): fail to convert the
- encoding of array elements when assign an array to an TkVariable
- object.
-
-Mon Apr 4 10:26:48 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/tk/lib/tk/dialog.rb: fixed typo.
-
-Sun Apr 3 17:16:33 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.{h,c} (rb_w32_fdopen): avoid warning on bcc32.
- (backported from HEAD)
-
-Sat Apr 2 23:38:54 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (CP, INSTALL): get rid of less portable options.
-
- * lib/mkmf.rb (configuration, create_makefile): correct configuration
- variable.
-
- * {bcc32,win32,wince}/{Makefile.sub,setup.mak}: leave prefix empty in
- config.status for backward compatibility. fixed: [ruby-core:04649]
-
- * lib/mkmf.rb (create_makefile): ensure library directories get made
- before copying libraries there.
-
-Sat Apr 2 16:59:46 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb: forgot to update RELEASE_DATE
-
- * ext/tk/lib/tk/variable.rb: fix namespace trouble when autoloading
-
- * ext/tk/lib/tk/palette.rb: define Tcl variable 'tkPalette' as global
-
- * ext/tk/lib/tk/dialog.rb: use array2tk_list method when calling
- Tk.ip_eval.
-
- * ext/tk/lib/tk/autoload.rb: add autoload entry 'TkDialogObj' and
- 'TkWarningObj'
-
-Sat Apr 2 02:19:11 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb (TkWindow.initialize): accept 'without_creating'
- option without 'widgetname' option to allow creating a widget object
- which is used as an argument of Tcl/Tk's widget allocation commands.
-
- * ext/tk/lib/tk/image.rb (TkImage.initialize): accept 'imagename'
- option to create a image object by the given name.
-
-Thu Mar 31 22:23:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (SRC_EXT): exclude just case different suffixes on case
- insensitive file system platforms.
-
- * README.EXT, README.EXT.ja (Appendix C): utility functions.
-
-Thu Mar 31 14:15:44 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_engine.c (ossl_engine_s_load): should return
- value. [ruby-dev:25971]
-
-Thu Mar 31 08:25:50 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (RUBYOPT): clear for the environment RubyGems installed.
-
- * common.mk (clean-local): keep $(PREP) files till distclean.
-
- * common.mk (check): do all tests.
-
-Thu Mar 31 06:00:20 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_engine.c (ossl_engine_s_load): should not raise
- error even if the specified engine could not be loaded. (Dynamic
- engines don't have fixed name to load.)
-
-Thu Mar 31 00:18:27 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/ifchange.bat, win32/rm.bat: backported from HEAD.
-
-Wed Mar 30 23:44:50 2005 Nobuyoshi Nakada <nobu.nokada@softhome.net>
-
- * Makefile.in, */Makefile.sub, */configure.bat,
- cygwin/GNUmakefile.in, common.mk, configure.in, ext/extmk.rb,
- lib/mkmf.rb, instruby.rb, runruby.rb: backport extout.
- [ruby-dev:25963]
-
-Wed Mar 30 17:41:48 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: add TclTkIp#_create_console() method to
- create a Tcl/Tk's console window.
-
- * ext/tk/lib/multi-tk.rb: support TclTkIp#_create_console() method.
-
- * ext/tk/lib/remote-tk.rb: ditto.
-
- * ext/tk/lib/tk/console.rb: ditto.
-
- * ext/tk/lib/tk.rb: update RELEASE_DATE
-
- * ext/tk/sample/demo-*/check2.rb: use 'return' in the Proc object.
-
- * ext/tk/sample/tkextlib/**: ditto.
-
-Tue Mar 29 22:11:56 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * test/rinda/test_rinda.rb: use DRbObject.new_with instead of reinit.
- [ruby-dev:25961]
-
-Mon Mar 28 23:40:40 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb: move method DRbObject#reinit to DRbObject.new_with.
- extract method DRbObject.prepare_backtrace. add DRb.regist_server,
- remove_server, fetch_server. change server in thread variable if
- in-proc server. [druby-ja:113]
-
- * lib/drb/gw.rb: ditto.
-
-Mon Mar 28 20:43:34 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/syck/rubyext.c: get rid of warnings caused by a bug of VC.
-
-Mon Mar 28 08:39:49 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/iconv/iconv.c (iconv_create): Iconv::Failure requires 3
- arguments. (pointed out by NaHi)
-
-Sat Mar 26 22:51:33 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk.rb (_callback_entry_class?): add for checking whether
- a class is available for a callback entry.
-
- * ext/tk/lib/tk.rb (after_cancel): add Tk.after_cancel(afterID) method.
-
- * ext/tk/lib/tk.rb (array2tk_list): change from private module method
- of TkComm to public module method.
-
- * ext/tk/lib/tk.rb (cget): add check that slot argument is not
- empty string.
-
- * ext/tk/lib/tk.rb (configinfo): ditto.
-
- * ext/tk/lib/tk/itemconfig.rb (itemcget): add check that slot argument
- is not empty string.
-
- * ext/tk/lib/tk/itemconfig.rb (itemconfiginfo): ditto.
-
- * ext/tk/lib/tk/entry.rb: add TkEntry#icursor and icursor= (alias of
- cursor and cursor= method).
-
- * ext/tk/lib/tk/font.rb: improve font treatment when the font name is
- empty string.
-
- * ext/tk/lib/tk/variable.rb: add :variable, :window and :procedure
- type.
-
- * ext/tk/lib/tk/variable.rb: improve treatment of array-type
- tkvariable.
-
- * ext/tk/lib/tkextlib/blt.rb: add commands for zooming.
-
- * ext/tk/lib/tkextlib/blt/*: bug fix.
-
- * ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix and add methods
- to call TreeCtrl commands for bindings.
-
- * ext/tk/sample/tkextlib/blt/*: new sample scripts.
-
- * ext/tk/sample/tkextlib/treectrl/*: ditto.
-
-Fri Mar 25 10:53:16 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * configure.in (WIN32_LEAN_AND_MEAN): removed because a lot of
- troubles. [ruby-list:40721]
-
-Thu Mar 24 23:10:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (macro_defined?): try to compile for an old compiler
- which doesn't bail out at #error directive. [ruby-dev:25818]
-
- * lib/mkmf.rb (check_sizeof): refine logging messages.
-
-Thu Mar 24 03:57:48 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/utils.rb (WEBrick::Utils.create_listeners):
- - should raise ArgumentError if no port is specified.
- - even if the specified port is 0, all TCPServers should be
- initialized with the port given to the first one.
-
- * lib/webrick/server.rb (WEBrick::GenericServer#initialize): if :Port
- parameter is 0, it should be updated with the port number which
- actually listened.
-
-Wed Mar 23 00:35:10 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/ruby/test_settracefunc.rb (test_event): added tests for
- "class" and "end" and "raise".
-
-Tue Mar 22 22:40:18 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_call0): check event_hooks instead of trace_func.
-
-Tue Mar 22 17:30:44 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_add_event_hook): new function to add a hook function for
- interpreter events. (backported form HEAD)
-
-Sun Mar 20 22:51:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (mkmf_failed): check if Makefile is created without
- create_makefile.
-
-Sat Mar 19 23:48:10 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-mode.el (ruby-expr-beg): returned true always.
- fixed: [ruby-list:40683]
-
-Sat Mar 19 00:41:02 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/font.rb: add some TkFont class methods to get font
- information without creating a TkFont object.
-
- * ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix and define some
- classes for components of Tk::TreeCtrl
-
-Thu Mar 17 17:42:13 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * struct.c (make_struct): allow non local-id field
- names. [ruby-core:04575]
-
- * struct.c (inspect_struct): ditto.
-
-Wed Mar 16 23:36:02 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_call0): call_cfunc() should be protected.
-
- * test/ruby/test_settracefunc.rb: added test for c-return.
-
-Wed Mar 16 22:20:25 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * object.c (str_to_id): fixed typo.
-
-Wed Mar 16 18:08:32 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (rb_call0): reorganize "return" event post.
-
-Tue Mar 15 23:49:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/iconv/iconv.c (Init_iconv): InvalidEncoding also should include
- Iconv::Failure.
-
-Tue Mar 15 16:38:11 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tkutil.c (ary2list): give wrong arguments to hash2kv()
-
-Mon Mar 14 19:39:33 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/timer.rb (TkTimer): forgot to clear @return_value
- when restarting
-
- * ext/tk/lib/tk/sample/cd_timer.rb: new sample of TkRTTimer
-
-Mon Mar 14 12:21:03 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/timer.rb (TkRTTimer): forgot to reset the callback
- time. So, 'continue' do all callbacks between 'stop' and 'continue'.
-
-Mon Mar 14 08:14:56 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * object.c (str_to_id): warn for NUL containing strings.
-
-Mon Mar 14 00:13:49 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/timer.rb (TkRTTimer): correct calculation of offset
- value. get a little better accuracy.
-
- * ext/tk/sample/demos-en/widget: use a binding with no local variables
- when eval a sample script.
-
- * ext/tk/sample/demos-en/bind.rb: ditto.
-
- * ext/tk/sample/demos-en/tcolor: ditto.
-
- * ext/tk/sample/demos-jp/widget: ditto.
-
- * ext/tk/sample/demos-jp/bind.rb: ditto.
-
- * ext/tk/sample/demos-jp/tcolor: ditto.
-
-Sun Mar 13 10:04:17 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * test/rinda/test_rinda.rb: remove test_gc. [ruby-dev:25871]
-
-Thu Mar 10 19:12:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (lib_eventloop_ensure): mis-delete a timer
- handler when exit from a recursive called eventloop
-
- * ext/tk/lib/tk/timer.rb: new TkRTTimer class, which can works for a
- realtime operation
-
- * ext/tk/sample/tkrttimer.rb: sample of TkRTTimer class
-
- * ext/tk/lib/tk/textmark.rb: move TkTextMark#+ and TkTextMark#- to
- TkText::IndexModMethods
-
- * ext/tk/lib/tk/text.rb: improve TkTextMark#+ and TkTextMark#-, and
- add them to TkText::IndexModMethods module
-
- * ext/tk/sample/tktextio.rb: add test part of "seek by text index
- modifiers"
-
-Thu Mar 10 08:10:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * re.c (make_regexp): need to free internal regexp structure when
- compilation fails. [ruby-talk:133228]
-
-Wed Mar 9 20:25:58 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ssl.c (ossl_start_ssl, ossl_ssl_write): call
- rb_sys_fail if errno isn't 0. [ruby-dev:25831]
-
- * ext/openssl/lib/openssl/cipher.rb: fix typo. [ruby-dev:24285]
-
-Wed Mar 9 15:46:35 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/server.rb (WEBrick::GenericServer#start): should
- restore @token if accept failure. suggested by Dominique Brezinski.
- [ruby-core:04518]
-
-Wed Mar 9 13:37:57 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/sample/tktextio.rb: fix bug of handling 'end' position.
- support initial text, overwrite setting and pos_gravity control.
-
-Tue Mar 8 18:16:55 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/sample/tktextio.rb: New sample script. TkTextIO class in this
- sample supports to use a text widget as if it is a I/O stream (such
- like as StringIO class).
-
-Tue Mar 8 13:54:40 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/socket/socket.c: workaround for some of 4.4BSD-Lite derived OSs.
-
-Tue Mar 8 12:36:17 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c: document from Sam Roberts
- <sroberts@uniserve.com> for getsockopt and setsockopt is merged.
- [ruby-doc:824]
-
-Tue Mar 8 01:27:00 2005 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.66
- fixed: [ruby-dev:25828]
-
-Mon Mar 7 21:35:02 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * sample/webrick/httpsd.rb: fix typo in comment. suggested by
- Kazuhiko Shiozaki.
-
-Mon Mar 7 14:55:43 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (block_pass): should not push unique number if a block is
- not an orphan. [ruby-dev:25808]
-
-Wed Feb 16 02:55:21 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ssl.c (ossl_start_ssl, ossl_ssl_read,
- ossl_ssl_write):
- - need to set errno on Win32 platform.
- - should call rb_sys_fail instead of rasing SSLError if
- SSL_ERROR_SYSCALL occured.
- - should wait for that the underlying IO become readable or
- writable if the error was SSL_ERROR_WANT_READ or
- SSL_ERROR_WANT_WRITE. [ruby-dev:25795]
-
- * ext/openssl/lib/openssl/buffering.rb
- (Buffering#initialize): should set @eof and @rbuffer.
- (Buffering#fill_rbuff): should rescue Errno::EAGAIN.
- (Buffering#consume_rbuf): pointless eof flag resetting is deleted.
- (Buffering#read): should return an empty string if the specified
- size is zero.
- (Buffering#readpartial): new method.
- (Buffering#readline): fix typo.
- (Buffering#getc): return the first character of string correctly.
- (Buffering#each): fix typo. suggested by Brian Ollenberger.
- (Buffering#readchar): fix typo.
- (Buffering#eof?): should read again it the input buffer is empty.
- (Buffering#do_write): should rescue Errno::EAGAIN.
- (Buffering#puts): use "\n" as the output field separator.
-
- * ext/openssl/lib/openssl/ssl.rb: set non-blocking flag to the
- underlying IO.
-
- * ext/openssl/extconf.rb: get rid of GNUmakefile generation.
-
- * text/openssl/test_pair.rb: test for IO like methods.
-
- * test/ruby/ut_eof.rb: test about empty file.
-
-Mon Mar 7 10:22:06 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * lib/un.rb: should use OptionParser. (backported form HEAD)
-
-Mon Mar 7 09:18:42 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (rb_str_cmp_m): should not return false but nil.
- fixed: [ruby-dev:25811]
-
-Mon Mar 7 01:22:14 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tkutil.c: remove the some codes which depend on the
- difference between Ruby1.8 and 1.9, because st.c on Ruby1.9
- was changed.
-
-Mon Mar 7 00:01:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: fail to call TclTkLib.mainloop when $SAFE==4
-
-Sun Mar 6 16:41:33 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/net/http.rb: HTTPHeader holds its header fields as an array
- (backport from CVS HEAD rev 1.112-1.123). [ruby-list:40629]
-
- * test/net/http/test_httpheader.rb: new file.
-
-Sun Mar 6 11:47:10 2005 Sam Roberts <sroberts@uniserve.com>
-
- * lib/pp.rb: rdoced. [ruby-core:4490]
-
-Sun Mar 6 11:36:37 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/pp.rb (File::Stat#pretty_print): Etc.getpwuid and Etc.getgrgid
- may return nil. [ruby-talk:129826]
- reported by Daniel Berger.
-
-Sat Mar 5 18:06:21 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * dir.c (fnmatch): removed unnecessary code. (ruby_1_8 didn't have
- String#clear, so [ruby-dev:24749] didn't affect it)
-
- * win32/win32.c (NtInitialize): ditto. (by numeric.c 1.101.2.14)
-
-Sat Mar 5 16:29:26 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/multi-tk.rb: freeze callback-entry objects
-
- * ext/tk/lib/tkextlib/tile.rb: support tile-0.6
-
-Fri Mar 4 19:39:28 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#do_includes): replace
- also locally defined modules.
-
- * ext/iconv/iconv.c: backport Iconv::InvalidEncoding from CVS HEAD.
-
- * ext/strscan/strscan.c: moved misplaced rdoc.
-
-Fri Mar 4 15:58:12 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi-lib.rb: add deprecation warning. [ruby-dev:25499]
- getopts.rb, parsearg.rb, importenv.rb as well.
-
-Fri Mar 4 11:17:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (ip_rbUpdateCommand): get rid of
- warnings with Tcl/Tk 8.3 or former (backport from CVS_HEAD).
-
- * ext/tcltklib/tcltklib.c (ip_rb_threadUpdateCommand): ditto.
-
-Fri Mar 4 10:15:30 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/set.rb (SortedSet::setup): a hack to shut up warning.
- [ruby-talk:132866]
-
-Fri Mar 4 07:07:00 2005 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.63
-
-Thu Mar 3 23:49:00 2005 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.62
-
-Thu Mar 3 11:49:51 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * sample/rss/tdiary_plugin/rss-recent.rb: added site information.
-
-Wed Mar 2 19:53:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (parse_args): add DESTDIR only when not directed
- already. fixed: [ruby-dev:25781]
-
-Wed Mar 2 17:14:18 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c (lib_eventloop_core): fix typo
-
-Wed Mar 2 16:00:02 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: enforce thread-check and exception-handling
- to avoid SEGV trouble.
- [KNOWN BUG] When supports pthread and running multiple Tk
- interpreters, an interrupt signal causes SEGV frequently. That
- may be a trouble of Ruby's signal handler.
-
- * ext/tk/tkutil/tkutil.c; fix a bug on converting a SJIS string array
- to a Tcl's list string.
-
- * ext/tk/tcltklib.c: wrap Tcl's original "namespace" command to
- protect from namespace crash.
-
- * ext/tk/lib/multi-tk.rb: enforce exception-handling.
-
- * ext/tk/lib/multi-tk.rb: catch IRB_EXIT to work on irb.
-
- * ext/tk/lib/tk.rb: ditto.
-
- * ext/tk/tcltklib.c: add TclTkLib.mainloop_thread?
-
- * ext/tk/lib/multi-tk.rb: (bug fix) callback returns a value.
-
- * ext/tk/lib/tk/canvas.rb (delete): bug fix when multiple arguments.
-
- * ext/tk/lib/clock.rb: fix 'no method error'.
-
- * ext/tk/lib/clock.rb (self.clicks): accept a Symbol argument.
-
- * ext/tk/lib/variable.rb: be able to set default_value_type; :numeric,
- :bool, :string, :symbol, :list, :numlist or nil (default; same to
- :string). If set a type, TkVariable#value returns a value of the
- type.
-
- * ext/tk/lib/tkextlib/tclx/tclx.rb: add Tk::TclX.signal to warn the
- risk of using TclX extension's 'signal' command.
-
- * ext/tk/sample/irbtk.rb: irb with Ruby/Tk.
-
- * ext/tk/sample/demos-*/anilabel.rb: bug fix on 'show code'
-
- * ext/tk/sample/demos-*/aniwave.rb: new Ruby/Tk animation demo.
-
- * ext/tk/sample/demos-*/pendulum.rb: ditto.
-
- * ext/tk/sample/demos-*/goldberg.rb: ditto.
-
- * ext/tk/sample/demos-*/widget: add entries of animation demos.
-
-Tue Mar 1 00:47:43 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * test/rinda/test_rinda.rb: backport from CVS_HEAD. use
- MockClock.sleep instead of Kernel.sleep [ruby-dev:25387]
-
-Tue Mar 1 00:34:24 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/rinda/tuplespace.rb (Rinda::TupleSpace): improved keeper thread.
-
- * test/rinda/test_rinda.rb: ditto.
-
-Mon Feb 28 11:42:23 2005 Ian Macdonald <ian@caliban.org>
-
- * exception error messages updated. [ruby-core:04497]
-
-Mon Feb 28 09:03:09 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c (Init_socket): add bunch of Socket
- constants. Patch from Sam Roberts <sroberts@uniserve.com>.
- [ruby-core:04409]
-
-Wed Feb 23 15:04:32 2005 akira yamada <akira@ruby-lang.org>
-
- * lib/uri/generic.rb (split_userinfo): should split ":pass" into ""
- and "pass". [ruby-dev:25667]
-
-Wed Feb 23 08:00:18 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * array.c (rb_ary_s_create): no need for negative argc check.
- [ruby-core:04463]
-
- * array.c (rb_ary_unshift_m): ditto.
-
-Wed Feb 23 01:57:46 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (initialize): handle certs correctly. Thanks,
- NABEYA Kenichi. (backported from CVS HEAD)
-
-Tue Feb 22 07:25:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): identfier after dot must not be a variable.
-
-Mon Feb 21 10:04:49 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * {bcc32,win32,wince}/Makefile.sub (config.h): add fcntl.
-
- * win32/win32.[ch] (fcntl): ditto.
-
- * win32/win32.c (rb_w32_connect): support nonblocking mode.
-
- * ext/socket/socket.c (wait_connectable, ruby_connect): support
- nonblocking connect on various platforms.
- all changes are backported from CVS HEAD. [ruby-core:3154],
- [ruby-core:4364].
-
-Sun Feb 20 00:48:48 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb (URI::FTP#buffer_open): access mechanism
- re-implemented according to RFC 1738.
- reported by Guillaume Marcais. [ruby-talk:131650]
-
-Sat Feb 19 18:11:47 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb (DRbObject#respond_to?): take two arguments.
- [ruby-dev:25722]
-
- * test/drb/drbtest.rb: ditto.
-
-Sat Feb 19 13:52:02 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb: call OpenSSL::SSL::SSLSocket#post_connection_check
- after connection is made.
-
-Sat Feb 19 01:32:03 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/bigdecimal/lib/bigdecimal/newton.rb: resolved LoadError.
- [ruby-dev:25685]
-
- * ext/bigdecimal/sample/linear.rb: ditto.
-
- * ext/bigdecimal/sample/nlsolve.rb: ditto.
-
- * ext/bigdecimal/lib/bigdecimal/nlsolve.rb: removed because this file
- is sample script and same file exists in ext/bigdecimal/sample.
-
-Fri Feb 18 17:14:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass
- of StandardError class, not Exception class. [ruby-core:04429]
-
-Thu Feb 17 20:11:18 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * lib/drb/drb.rb (DRbServer.default_safe_level): fix typo.
-
-Thu Feb 17 20:11:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/digest/test_digest.rb: separate test case for each algorithms.
- [ruby-dev:25412]
-
-Thu Feb 17 11:54:00 2005 Nathaniel Talbott <ntalbott@ruby-lang.org>
-
- * lib/test/unit/collector.rb (collect_file): now deletes paths added
- to $LOAD_PATH instead of restoring it verbatim.
-
- * lib/test/unit/autorunner.rb (AutoRunner.run): fixed so that
- 'ruby -rtest/unit -rtest1 -rtest2 -e0' will use the objectspace
- collector again. Also tried to simplify the calling convention.
-
- * test/runner.rb: adjusted for new AutoRunner semantics.
-
- * lib/test/unit.rb: ditto.
-
-Thu Feb 17 04:21:47 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE.
- fixed: [ruby-core:04444]
-
-Thu Feb 17 00:09:45 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * test/drb/ignore_test_drb.rb: move TestDRbReusePort to new file
- [ruby-dev:25238]
-
- * test/drb/test_drb.rb: add method DRbService.ext_service, move
- TestDRbReusePort to new file [ruby-dev:25238]
-
- * test/drb/test_drb.rb: ditto.
-
- * test/drb/test_drbssl.rb: ditto.
-
- * test/drb/test_drbunix.rb: ditto.
-
- * test/drb/ut_drb.rb: reduce sleep.
-
-Thu Feb 17 00:02:27 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (is_defined): NODE_IASGN is an assignment.
-
-Wed Feb 16 23:34:30 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb: add lazy stop_service. ([druby-ja:109])
-
- * lib/drb/extserv.rb: ditto.
-
-Wed Feb 16 17:07:57 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/tkutil.c: Follow the change of st.c (st_foreach)
- [ruby-list:40623].
- Sometimes mis-convert from a Ruby's Array of SJIS Strings, which
- includes some kind of SJIS characters, to a Tcl's UTF8 list string.
-
-Mon Feb 14 23:58:17 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/parser.rb (RSS::ListenerMixin::tag_end):
- fixed invalid namespace handling bug.
-
-Mon Feb 14 13:12:38 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/lib/openssl/ssl.rb
- (OpenSSL::SSL::SSLSocket#post_connection_check): new method.
-
-Mon Feb 14 00:40:49 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb (InvokeMethod.perform): pass DRb info to sub thread.
-
- * test/drb/test_drb.rb (test_01_safe1_safe4_eval): fix test case.
-
-Sun Feb 13 23:13:46 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/dublincore.rb (RSS::DublicCoreModel#date{,=}): added
- convenient methods.
-
- * lib/rss/0.9.rb (RSS::Rss::Channel#date{,=}): ditto.
-
- * lib/rss/2.0.rb (RSS::Rss::Channel::Item#date{,=}): ditto.
-
- * test/rss/: added tests for the convenient methods.
-
-Sun Feb 13 22:43:03 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb (DRbServer): add default_safe_level, safe_level,
- config[:safe_level] ([druby-ja:120])
-
- * test/drb/test_drb.rb, ut_eval.rb, ut_safe1.rb: ditto.
-
-Sun Feb 13 16:56:52 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/cgi.rb (WEBrick::CGI.start): should set reason-phrase
- to the value of status header field. ([ruby-dev:40617])
-
-Sun Feb 13 00:52:33 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/erb.rb (ERB::Util.h, u): make it module_function.
-
-Sat Feb 12 17:29:19 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb (OpenURI.open_loop): send authentication only for
- the URI directly specified.
-
-Sat Feb 12 15:07:23 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (rand_init): suppress warning.
-
-Sat Feb 12 13:54:03 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb: support https if the platform provides CA
- certificates.
-
-Sat Feb 12 06:18:28 2005 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
-
- * ext/etc/etc.c (Init_etc): sGroup needs HAVE_ST_GR_PASSWD check.
- [ruby-dev:25675]
-
-Fri Feb 11 17:40:42 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_x509store.c (ossl_x509store_set_default_paths):
- new method OpenSSL::X509::Store#set_default_paths.
-
-Fri Feb 11 11:33:53 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/open-uri.rb (URI::HTTP#proxy_open): new option supported:
- :http_basic_authentication.
- suggested by Kent Sibilev. [ruby-core:4392]
-
-Fri Feb 11 06:30:07 2005 George Ogata <g_ogata@optushome.com.au>
-
- * misc/ruby-mode.el: ignore parenthesis inside heredoc.
- [ruby-core:04415]
-
-Fri Feb 11 04:54:13 2005 Tilman Sauerbeck <tilman@code-monkey.de>
-
- * lib/rdoc/generators/html_generator.rb: [ruby-core:04412]
-
- * lib/rdoc/generators/ri_generator.rb: ditto.
-
-Thu Feb 10 11:14:17 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (COMMON_HEADERS): shouldn't include winsock2.h.
-
- * ext/socket/extconf.rb (sockaddr_storage): remove workaround for
- mswin32.
-
-Thu Feb 10 10:29:16 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/curses/curses.c: don't need to check HAVE_WCOLOR_SET excluding
- window_color_set().
-
-Thu Feb 10 00:47:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * struct.c (make_struct): fixed: [ruby-core:04402]
-
-Wed Feb 9 08:07:08 2005 Paul Duncan <pabs@pablotron.org>
-
- * ext/curses/curses.c (window_color_set): [ruby-core:04393]
-
-Tue Feb 8 23:51:47 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb: reject :instance_eval, :class_eval, :module_eval
- [druby-ja:117]
-
-Tue Feb 8 13:06:12 2005 Sam Roberts <sroberts@uniserve.com>
-
- * ext/socket/socket.c (Init_socket): SO_REUSEPORT added.
- [ruby-talk:130092]
-
-Tue Feb 8 09:30:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/cgi.rb (CGI::Cookie): [ruby-talk:130040]
-
-Tue Feb 8 00:19:02 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/resolv.rb (Resolv::DNS::Name#subdomain_of?): new method.
- (Resolv::DNS::Name#inspect): ditto.
- Suggested by Sam Roberts. [ruby-talk:129086]
-
-Mon Feb 7 10:06:30 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * object.c: [ruby-doc:818]
-
-Mon Feb 7 01:56:20 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * instruby.rb, rubytest.rb (srcdir): no longer embed srcdir into
- rbconfig.rb. (backported from CVS HEAD)
-
- * ext/socket/extconf.rb (sockaddr_storage): winsock2.h have the
- definition of struct sockaddr_storage, but socket.c doesn't
- include it because this version of ruby still has binary level
- compatibility with winsock1.
-
- * lib/mkmf.rb (create_makefile): should support header files in
- depend file.
-
-Mon Feb 7 01:21:50 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/extconf.rb: check if getaddrinfo() works fine only when
- wide-getaddrinfo option is not given. fixed: [ruby-dev:25422]
-
- * lib/mkmf.rb ($extmk): check if under ext directory.
-
- * lib/mkmf.rb (Logging.postpone): allow recursive operation.
-
- * lib/mkmf.rb (try_constant): make sure if really a constant, reduce
- the number of times of compile.
-
- * lib/mkmf.rb (have_macro, have_var, byte_order): new functions.
-
- * lib/mkmf.rb (find_library): allow directory list with separators.
-
- * lib/mkmf.rb (arg_config): manage provided configuration options.
-
- * lib/mkmf.rb (dir_config): accept arrays of directory names as
- default values.
-
- * mkconfig.rb: no longer embed srcdir and compile_dir into
- rbconfig.rb.
-
- * lib/mkmf.rb (create_makefile): fix unbalanced parens.
-
-Sun Feb 6 19:23:01 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * eval.c (stack_extend): add prototype because VC++8 doesn't
- accept __declspec(noinline) with K&R style function definitions.
- (backported from CVS HEAD)
-
-Sun Feb 6 14:14:26 2005 Tadayoshi Funaba <tadf@dotrb.org>
-
- * lib/date.rb (new_with_hash): changed messages of exception.
-
- * lib/date/format.rb (str[fp]time): undocumented conversion
- specifications %[1-3] are now deprecated.
-
-Sun Feb 6 12:20:11 2005 Akinori MUSHA <knu@iDaemons.org>
-
- * bignum.c (rb_big2ulong_pack): One too many arguments are passed
- to big2ulong().
-
- * re.c (rb_reg_init_copy, rb_reg_initialize_m): One too many
- arguments are passed to rb_reg_initialize().
-
-Sun Feb 6 03:24:20 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/resolv.rb (Resolv::DNS::Resource::TXT): multiple strings was not
- handled.
- (Resolv::DNS::Resource::TXT#strings): new method to return all
- strings.
- (Resolv::DNS::Message::MessageEncoder#put_string_list): new method.
- (Resolv::DNS::Message::MessageDecoder#get_string_list): ditto.
- based on [ruby-talk:129732] by Sam Roberts.
-
-Fri Feb 4 00:30:45 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss: supported Image module.
- http://web.resource.org/rss/1.0/modules/image/
-
-Thu Feb 3 23:42:36 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_close, strio_close_read, strio_close_write):
- should return nil instead of self as well as IO. [ruby-dev:25623]
-
- * ext/stringio/stringio.c (strio_extend, strio_putc): fill with zero
- extended portion. [ruby-dev:25626]
-
-Wed Feb 2 23:52:53 2005 sheepman <sheepman@tcn.zaq.ne.jp>
-
- * ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
- part. [ruby-dev:25618]
-
-Wed Feb 2 21:56:01 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb (RSS::Element#convert): added.
-
- * lib/rss/rss.rb: convert -> need_convert.
-
- * lib/rss/1.0.rb: ditto.
-
- * lib/rss/0.9.rb: ditto.
-
- * lib/rss/2.0.rb: ditto.
-
- * lib/rss/trackback.rb: ditto.
-
-Tue Feb 1 22:48:48 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/drb.rb (DRb::DRbObject#respond_to?): check marshal_dump and
- _dump.
-
-Tue Feb 1 00:20:23 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (aix): fix linker flags on AIX. [ruby-talk:125460]
-
-Mon Jan 31 13:33:21 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: add invalid namespace check
-
- * ext/tk/lib/multi-tk.rb: add invalid_namespace? method
-
- * ext/tk/lib/remote-tk.rb: ditto
-
-Mon Jan 31 10:29:18 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330]
-
-Sat Jan 29 09:42:12 2005 Sam Roberts <sroberts@uniserve.com>
-
- * lib/resolv.rb (Resolv::DNS::Resource::IN::SRV): Added RFC2782 SRV
- resource record for specifying location of services.
-
-Fri Jan 28 17:16:55 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/resolv.rb (Resolv::DNS::Config.parse_resolv_conf):
- parse options line for ndots option.
- (Resolv::Hosts#lazy_initialize): return self.
- (Resolv::DNS#lazy_initialize): ditto.
- (Resolv::DNS::Config#lazy_initialize): ditto.
- Suggested by Sam Roberts.
-
-Thu Jan 27 13:18:03 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * st.c (st_foreach): report success/failure by return value.
- [ruby-Bugs-1396]
-
-Thu Jan 27 00:15:29 2005 Minero Aoki <aamine@loveruby.net>
-
- * test/fileutils/test_fileutils.rb (setup): support BSD-style
- directory group inheritance. (backport from HEAD, rev 1.32)
-
- * test/fileutils/fileasserts.rb (assert_same_entry): show entry
- difference. (backport from HEAD, rev 1.4)
-
-Wed Jan 26 23:09:11 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/net/protocol.rb (WriteAdapter#puts): should append \n, not
- prepend. [ruby-talk:128302] (backport from HEAD, rev 1.75)
-
-Wed Jan 26 10:51:50 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (flock_winnt, flock_win95): unlock file even if
- LOCK_NB is specified. (backported from CVS HEAD)
-
-Tue Jan 25 17:11:51 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ruby.c (proc_options): correct -T option in RUBYOPT. (backported
- from CVS HEAD)
-
-Tue Jan 25 14:05:52 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: fix SEGV bug; trouble on canceling remained
- after scripts [ruby-dev:25479]: NULL current namespace when deleting
- Tk interpreter [ruby-talk:126225]
-
- * ext/tcltklib/extconf.rb: bug fix; TCL_ENABLE_THREAD flag is inverted
- [ruby-talk:126360]
-
- * ext/tcltklib/extconf.rb: add yet another native-thread check
-
- * ext/tk/tkutil.c: fix SEGV bug; NULL string pointer when finalize
- Ruby interpreter
-
- * ext/tk/lib/multi-tk.rb: avoid warning for deleted safeTk ip frame
-
- * ext/tk/lib/tk/bindtag.rb: bug fix; new method of named bindtag
- doesn't return the created object [ruby-dev:25479]
-
- * ext/tk/lib/tk/menu.rb: bug on treating arguments [ruby-dev:25479]
-
- * ext/tk/lib/tk.rb: bug fix; cannot accept a callback ID string for
- a command argument [ruby-dev:25479]
-
- * ext/tk/lib/multi-tk.rb: ditto
-
- * ext/tk/lib/tk/*.rb: ditto
-
- * ext/tk/lib/tkextlib/*.rb: ditto
-
- * ext/tk/sample/demos-jp/anilabel.rb: new demo script
-
- * ext/tk/sample/demos-en/anilabel.rb: ditto
-
- * ext/tk/sample/tkHTML/ss.rb: local variable scope bug fix
- [ruby-dev:25479]
-
-Mon Jan 24 15:44:25 2005 Tilman Sauerbeck <tilman@code-monkey.de>
-
- * lib/rdoc/parsers/parse_c.rb: allow whitespace after function names.
- [ruby-core:4296]
-
- * lib/rdoc/parsers/parse_simple.rb: adds support for private comments
- in the "simple" parser. [ruby-core:4301]
-
-Mon Jan 24 15:44:25 2005 Charles Mills <cmills@freeshell.org>
-
- * lib/rdoc/parsers/parse_c.rb: adds support for constants
- (rb_define_const), accessors (rb_define_attr), and makes a
- couple fixes. [ruby-core:4307]
-
-Mon Jan 24 15:44:25 2005 Florian Gro <florgro@gmail.com>
-
- * lib/rdoc/parsers/parse_rb.rb: Logic for def Builtin.method() end
- [ruby-core:4302]
-
-Mon Jan 24 15:44:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * document updates - [ruby-core:04296], [ruby-core:04301],
- [ruby-core:04302], [ruby-core:04307]
-
-Sun Jan 23 12:41:16 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
-
- * lib/soap/wsdlDriver.rb: from 1.5.3-ruby1.8.2, operation which has
- capitalized name (such as KeywordSearchRequest in AWS) is defined as
- a method having uncapitalized name. (converted with
- GenSupport.safemethodname to handle operation name 'foo-bar'). it
- introduced serious incompatibility; in the past, it was defined as a
- capitalized.
-
- define capitalized method as well under that circumstance.
-
-Sun Jan 23 05:24:42 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ocsp.c (ossl_ocspreq_to_der): should call
- GetOCSPReq at first.
-
-Sat Jan 22 23:09:47 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/ssl.rb (accept): rescue SSLError. [druby-ja:110]
-
-Sat Jan 22 22:35:03 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * lib/drb/unix.rb: fail if UNIXFileOwner is set. [druby-ja:111]
-
-Fri Jan 21 23:58:42 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_set_pos): clear EOF flag.
- [ruby-talk:127511]
-
-Fri Jan 21 20:07:02 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/resolv.rb (Resolv::DNS::Config.resolv): don't raise ResolvError.
- reported by Sam Roberts. [ruby-talk:127133]
-
-Fri Jan 21 16:58:10 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * dir.c (rb_push_glob): should work for NUL delimited patterns.
-
-Fri Jan 21 13:58:37 2005 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (u8tou16): fixed typo. fixed: [ruby-list:40546]
- (backported from CVS HEAD)
-
-Fri Jan 21 09:30:16 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * rubyio.h (rb_eof_error): should mark as NORETURN. (backported
- from CVS HEAD)
-
-Fri Jan 21 00:31:36 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * ext/syck/rubyext.c (syck_parser_bufsize_set): avoid VC++ warning
- "local variable 'size' used without having been initialized".
-
-Thu Jan 20 19:03:24 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/extmk.rb (extmake): shouldn't set $extflags on mswin32.
-
- * win32/Makefile.sub (LIBRUBY_SO): should use $DLDOBJS instead of
- $EXTOBJS.
- fixed: [ruby-core:04290] (backported from CVS HEAD)
-
-Thu Jan 20 11:42:02 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (rb_str_new4): should propagate taintedness.
-
- * struct.c (rb_struct_set): use original method name, not callee
- name, to retrieve member slot. [ruby-core:04268]
-
- * time.c (time_strftime): protect from format modification from GC
- finalizers.
-
-Wed Jan 19 18:06:40 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/ipaddr.rb (to_s, test_to_s): too many colons with some cases.
- (backported from CVS HEAD)
-
-Wed Jan 19 01:16:30 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/resolv.rb (Resolv::DNS::Config.parse_resolv_conf): ignore
- domain and search directive without an argument.
- reported by Sam Roberts. [ruby-talk:126781]
-
-Tue Jan 18 15:03:05 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/ssl.rb (WEBrick::Config::SSL): the default value
- of :SSLEnable is false.
-
- * lib/webrick/server.rb (WEBrick::Daemon.start): prepared stdio
- don't allow changing its mode.
-
- * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_service):
- should delete trailing LF from the result of pack("m*").
-
- * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_connect):
- - should delete trailing LF from the result of pack("m*").
- - clear Request-Line not to send the response by HTTPServer#run.
-
- * lib/webrick/httputils (WEBrick::HTTPUtils.parse_qvalues):
- refine regexp (and change the name of a local variable).
-
- * lib/webrick/httputils.rb (WEBrick::HTTPUtils#escape_path): add
- new method to escape URI path component.
-
- * lib/webrick/cgi.rb (WEBrick::CGI::Socket#request_line): should
- escape SCRIPT_NAME and PATH_INFO before being parsed as a URI.
-
- * test/webrick/*, sample/webrick/httpproxy.rb: add new file.
-
-Mon Jan 17 23:33:46 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (aix): fix typo. [ruby-talk:126401]
-
-Mon Jan 17 07:08:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/readline.c: suppress warnings.
-
- * lib/irb/extend-command.rb (IRB::ContextExtender.def_extend_command):
- ditto.
-
- * lib/irb/ext/history.rb (IRB::Context::set_last_value): ditto.
-
- * lib/irb/ext/history.rb (IRB::Context::eval_history): ditto.
-
- * lib/irb/locale.rb (IRB::Locale::real_load): ditto.
-
- * lib/irb/slex.rb (SLex::Node::create_subnode): remove garbage.
-
-Mon Jan 17 00:09:42 2005 WATANABE Hirofumi <eban@ruby-lang.org>
-
- * lib/uri/common.rb (PORT): typo fix. fixed: [ruby-core:04256]
-
-Sat Jan 15 14:57:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (proc_options): ignore trailing CRs at the end of short
- options as well as long options. fixed: [ruby-core:04232]
-
-Sat Jan 15 13:35:16 2005 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rss/rss.rb (RSS::VERSION): 0.1.2 -> 0.1.3.
-
- * lib/rss/rss.rb: accept inheritance. [ruby-talk:126104]
-
-Thu Jan 13 04:48:53 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (io_fread): don't warn nonblocking behavior by default.
-
-Wed Jan 12 00:36:29 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_class_superclass): superclass of singleton class also
- should be a singleton class. fixed: [ruby-list:40519]
-
-Tue Jan 11 09:44:40 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * numeric.c (Init_Numeric): turn off floating point exceptions
- on bcc32. "1e300".to_f had crashed by overflow.
-
-Tue Jan 11 03:10:10 2005 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (copy_entry): could not copy symbolic link.
- [ruby-talk:125733]
-
- * lib/fileutils.rb (copy_stream): use read/write instead of
- sysread/syswrite.
-
-Mon Jan 10 23:08:15 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (rb_autoload): hide internal data from ruby level.
- fixed: [ruby-dev:25435], [ruby-list:40498]
-
-Mon Jan 10 01:22:55 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * gc.c (rb_data_object_alloc): klass may be NULL.
- [ruby-list:40498]
-
-Sun Jan 9 03:12:58 2005 Tanaka Akira <akr@m17n.org>
-
- * io.c (io_fread): warn nonblocking behavior.
- (io_readpartial): new method IO#readpartial.
-
-Sat Jan 8 04:38:47 2005 why the lucky stiff <why@ruby-lang.org>
-
- * lib/yaml.rb: Kernel#y requires an argument.
-
-Fri Jan 7 21:12:29 2005 TAMURA Takashi <sheepman@tcn.zaq.ne.jp>
-
- * random.c (rand_init): use ALLOC_N instead of ALLOCA_N
- [ruby-dev:25426]
-
-Fri Jan 7 18:03:35 2005 Tanaka Akira <akr@m17n.org>
-
- * gc.c (mark_locations_array): avoid core dump with -O3.
- [ruby-dev:25424]
-
-Thu Jan 6 20:31:07 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/zlib/zlib.c (zstream_end): should return value. (backported
- from CVS HEAD)
-
-Thu Jan 6 19:55:13 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.c (rb_w32_close): didn't close socket handle.
- [ruby-dev:25414]
-
- * win32/win32.c (rb_w32_open_osfhandle): bcc32's _open_osfhandle
- never set EMFILE.
-
-Thu Jan 6 17:14:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * random.c (random_seed): O_NONBLOCK isn't defined on some
- platforms. [ruby-dev:25417]
-
-Thu Jan 6 13:45:35 2005 Tanaka Akira <akr@m17n.org>
-
- * lib/time.rb: recognize +00:00 and GMT as a localtime.
-
-Thu Jan 6 07:58:28 2005 Dave Thomas <dave@pragprog.com>
-
- * lib/rdoc/usage.rb (RDoc::RDoc.usage_no_exit): Allow for colons
- in path names on DOS machines. (thanks to Johan Nilsson)
-
-Wed Jan 5 20:16:32 2005 Tanaka Akira <akr@m17n.org>
-
- * random.c (limited_big_rand): didn't work if SIZEOF_BDIGITS == 2.
- [ruby-dev:25408]
-
- * random.c (random_seed): refined.
-
-Wed Jan 5 12:49:39 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_thread_initialize): Thread objects cannot be initialized
- again. fixed: [ruby-core:04067]
-
-Wed Jan 5 10:48:16 2005 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * dir.c (dir_s_mkdir): win32 special processing doesn't need any
- longer. (backported from CVS HEAD)
-
- * win32/win32.[ch] (rb_w32_mkdir): new function. POSIX.1 compatible
- interface. (backported from CVS HEAD)
-
- * win32/win32.[ch] (rb_w32_rmdir): new function. (backported from CVS
- HEAD)
-
-Wed Jan 5 02:30:11 2005 Tanaka Akira <akr@m17n.org>
-
- * random.c (init_by_array): imported from mt19937ar-cok.tgz.
- (genrand_int32): ditto.
- (genrand_real): replaced with genrand_res53 in mt19937ar-cok.
- (rand_init): support bignum for longer seed.
- (random_seed): generate longer seed.
- (make_mask): new function.
- (limited_rand): ditto.
- (limited_big_rand): ditto.
- (rb_f_rand): call limited_rand and limited_big_rand.
- [ruby-dev:25403]
-
-Tue Jan 4 23:25:29 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * bignum.c (rb_big_rand): should return positive random number.
- [ruby-dev:25401]
-
-Tue Jan 4 11:15:29 2005 TAMURA Takashi <sheepman@tcn.zaq.ne.jp>
-
- * bignum.c (rb_big_rand): do not use rb_big_modulo to generate
- random bignums. [ruby-dev:25396]
-
-Mon Jan 3 14:01:54 2005 Tanaka Akira <akr@m17n.org>
-
- * random.c (random_seed): don't use /dev/urandom if it is not
- character device.
-
-Mon Jan 3 11:37:42 2005 Tanaka Akira <akr@m17n.org>
-
- * random.c (random_seed): use /dev/urandom if available.
- [ruby-dev:25392]
-
-Mon Jan 3 07:46:42 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * lib/webrick/httpauth/htpasswd.rb (WEBrick::Htpasswd#reload):
- raise NotImplementedError if password is encrypted by digest
- algorithms. This patch is contributed by sheepman. [ruby-list:40467]
-
- * lib/webrick/httpauth/digestauth.rb
- (WEBrick::HTTPAuth::DigestAuth#_authenticate): fix digest calculation.
- This patch is contributed by sheepman. [ruby-list:40482]
-
- * lib/webrick/{httpauth.rb,httpauth/basicauth.rb,httpproxy.rb}: use
- pack/unpack-template char "m" instead of lib/base64.rb to do base64
- encoding/decoding. fixed: [ruby-dev:25336]
-
- * test/webrick/test_httpauth.rb: new file.
-
-Sat Jan 1 04:20:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_ns_spki.c (ossl_spki_set_challenge): should call
- StringValue before GetSPKI. fixed: [ruby-dev:25359].
-
-Sat Jan 1 01:13:28 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * variable.c (rb_autoload): [ruby-dev:25373]
-
-Fri Dec 31 14:10:43 2004 Dave Thomas <dave@pragprog.com>
-
- * lib/rdoc/ri/ri_formatter.rb (RI::TextFormatter::display_flow_item): Fix problem
- if heading contains formatting.
-
-Thu Dec 30 00:41:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * eval.c (svalue_to_avalue): [ruby-dev:25366]
-
- * string.c (rb_str_justify): [ruby-dev:25367]
-
-Wed Dec 29 11:07:07 2004 Dave Thomas <dave@pragprog.com>
-
- * lib/rdoc/generators/template/html/kilmer.rb: Update to use new
- sections.
-
-Tue Dec 28 22:31:46 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_justify): create buffer string after argument type
- conversion. fixed: [ruby-dev:25341]
-
-Tue Dec 28 15:41:48 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c (reinit): should initialize all static
- variables. fixed: [ruby-list:40445]
-
-Tue Dec 28 15:25:20 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/nkf/lib/kconv.rb (Kconv::RegexpEucjp): second byte is up to
- 0xfe.
-
- * ext/nkf/lib/kconv.rb (Kconv#kconv): should handle UTF8 and UTF16
- properly.
-
-Tue Dec 28 13:35:20 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/zlib/zlib.c (rb_deflate_s_deflate, rb_inflate_s_inflate): ensure
- freeing internal zstreams. fixed: [ruby-dev:25309]
-
- * ext/zlib/zlib.c (rb_deflate_init_copy): replace rb_deflate_clone.
-
-Tue Dec 28 12:26:45 2004 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub, win32/setup.mak (RDOCTARGET, install,
- install-nodoc, install-doc): rdoc support for mswin32.
-
- * win32/configure.bat (--enable-install-doc, --disable-install-doc):
- ditto.
-
-Mon Dec 27 20:02:14 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: fix SEGV bug when deleting Tk interp
-
- * ext/tk/lib/multi-tk.rb: ditto
-
-Mon Dec 27 16:55:17 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
-
- * ext/openssl/ossl_x509name.c (Init_ossl_x509name): should use
- rb_hash_new to get exactly a Hash. fix [ruby-dev:25325].
-
-Mon Dec 27 16:29:56 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * string.c (rb_str_justify): [ruby-dev:25341]
-
-Mon Dec 27 15:47:48 2004 Minero Aoki <aamine@loveruby.net>
-
- * test/fileutils/fileasserts.rb: sync with HEAD.
-
- * test/fileutils/test_fileutils.rb: ditto.
-
- * test/fileutils/test_nowrite.rb: ditto.
-
-Mon Dec 27 15:21:07 2004 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (mv): should raise error when moving a
- directory to the (empty) directory. [ruby-talk:124368]
- (backport from HEAD 1.48)
-
- * lib/fileutils.rb (mv): wrongly did not overwrite file on Win32
- platforms. (backport from HEAD 1.48)
-
-Sat Dec 25 11:11:48 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * stable version 1.8.2 released.
-
-Sat Dec 25 04:23:49 2004 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (mkdir, mkdir_p): should ensure directory
- permission. (backportted from HEAD, 1.47)
-
- * lib/fileutils.rb (traverse, remove_dir): untaint trasted
- objects. (backportted from HEAD, 1.46)
-
-Sat Dec 25 01:28:23 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c: cancel io_reopen() change on Dec. 24th.
-
- * dln.c: use <dlfcn.h> for NetBSD. [ruby-dev:25313]
-
- * io.c (rb_f_select): IO list could be altered. [ruby-dev:25312]
-
-Fri Dec 24 23:51:48 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * bcc32/Makefile.sub: bcc32 should use RTL dll (backport from HEAD)
- [ruby-dev:25306]
-
- * win32/win32.[ch]: ditto.
-
-Fri Dec 24 23:27:18 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tk/image.rb: TkPhotoImage#cget bug fix
-
-Fri Dec 24 18:39:25 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-
- * win32/win32.[ch]: failed to compile on bcc32 (and probably wince)
- [ruby-dev:25306]
-
-Fri Dec 24 02:52:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_reopen, rb_io_reopen): prohibit to change access mode for
- special IO ports. [ruby-dev:25225]
-
-Fri Dec 24 02:22:53 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/syck/rubyext.c (rb_syck_io_str_read): [ruby-core:03973]
-
- * ext/syck/rubyext.c (syck_loader_transfer): check type conversion.
-
- * ext/syck/rubyext.c (syck_parser_assign_io, rb_new_syck_node): duck
- typing.
-
- * ext/syck/rubyext.c (syck_parser_s_alloc, syck_parser_initialize):
- allocation framework.
-
- * ext/syck/rubyext.c (syck_emitter_s_alloc, syck_emitter_initialize):
- ditto.
-
-Fri Dec 24 01:21:00 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/lib/tkextlib/blt.rb: add BLT extension support
-
- * ext/tk/lib/tkextlib/blt/*.rb: ditto
-
- * ext/tk/lib/tkextlib/blt/tile/*.rb: ditto
-
-Thu Dec 23 23:36:28 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (proc_setgroups): check if the argument lenght is
- modified. fixed: [ruby-dev:25285]
-
-Thu Dec 23 13:13:33 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tcltklib/tcltklib.c: define TclTkLib::COMPILE_INFO and
- RELEASE_DATE
-
- * ext/tcltklib/extconf.rb: ditto
-
- * ext/tk/tkutil.c: define TkUtil::RELEASE_DATE
-
- * ext/tk/lib/tk.rb: define Tk::RELEASE_DATE
-
-Thu Dec 23 09:38:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_reopen): restore exact mode. fixed: [ruby-core:04003]
-
-Thu Dec 23 00:16:32 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (bsdi): use $(CC) for LDSHARED. fixed [ruby-dev:25270]
-
Wed Dec 22 11:14:55 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_mode_modenum): replace O_ACCMODE with O_RDWR.
@@ -7576,7 +8,7 @@ Wed Dec 22 08:34:32 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/dl/sym.c (rb_dlsym_initialize): extract internal pointers after
all argument conversion. fixed: [ruby-dev:25271]
-Wed Dec 22 00:08:01 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Wed Dec 22 00:08:01 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/soap/*, test/soap/*, sample/soap/authheader/*: eval cleanup.
@@ -7610,7 +42,7 @@ Tue Dec 21 00:53:01 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/openssl/ossl_asn1.c (ossl_asn1_decode_all): ditto.
-Mon Dec 20 23:22:26 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Mon Dec 20 23:22:26 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* added files:
* lib/soap/mapping/wsdl*.rb
@@ -7736,7 +168,7 @@ Sat Dec 18 16:36:23 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/zlib/zlib.c (rb_deflate_s_deflate, rb_inflate_s_inflate):
disallow interrupt by type conversion. fixed: [ruby-dev:25226]
-Sat Dec 18 15:16:41 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Sat Dec 18 15:16:41 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/webrick/httpauth.rb,
lib/webrick/httpauth/{basicauth.rb,digestauth.rb}: use
@@ -7788,7 +220,7 @@ Fri Dec 17 16:28:12 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/textwindow.rb: wrong gravity of text mark for
embedded window
-Fri Dec 17 13:50:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
+Fri Dec 17 13:50:00 2004 Akiyoshi, Masamichi (akiyoshi@hp.com)
* vms/vmsruby_private.c, vms/vmsruby_private.h: private routines
for VMS port are added.
@@ -7959,13 +391,6 @@ Sun Dec 12 10:14:03 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/rdoc.rb (RDoc::RDoc::parse_files): Never exclude files
explicitly given on the command line.
-Sun Dec 11 23:54:07 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * ext/tk/*: update to support libraries in ActiveTcl8.4.12.0
- (see ext/tk/ChangeLog.tkextlib).
-
- * ext/tk/sample/scrollframe.rb: add a new sample.
-
Sat Dec 11 20:12:21 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/drb.rb: add DRbRemoteError. [ruby-list:40348],
@@ -7996,7 +421,7 @@ Fri Dec 10 08:39:27 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/socket/socket.c (sock_listen): get OpenFile just before calling
listen(2). fixed: [ruby-dev:25149]
-Thu Dec 9 17:00:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
+Thu Dec 9 17:00:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
* ext/socket/socket.c, ext/socket/getaddrinfo.c: port to VMS
@@ -8004,7 +429,7 @@ Thu Dec 9 16:31:02 2004 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/sdbm/init.c (GetDBM): typo.
-Thu Dec 9 16:05:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
+Thu Dec 9 16:05:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
* defines.h: change path of vms.h
* vms/vms.h: delete reference for snprintf()
@@ -8090,7 +515,7 @@ Wed Dec 8 14:31:36 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* sprintf.c (rb_f_sprintf): [ruby-dev:25104]
-Tue Dec 7 19:08:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
+Tue Dec 7 19:08:00 2004 Akiyoshi, Masamichi <akiyoshi@hp.com>
* io.c (io_fwrite): fix offset incrementation (for VMS and Human68k)
@@ -8185,7 +610,7 @@ Sat Dec 4 03:33:45 2004 Shugo Maeda <shugo@ruby-lang.org>
* test/readline/test_readline.rb: added tests for readline.
(backported from CVS HEAD)
-Sat Dec 4 02:24:00 2004 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Dec 4 02:24:00 2004 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf.c: add constant NKF::VERSION
@@ -8314,8 +739,7 @@ Mon Nov 29 15:22:28 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
Mon Nov 29 03:08:30 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * object.c (convert_type): direct call conversion methods for the
- performance. [ruby-core:03845]
+ * object.c (convert_type): [ruby-core:03845]
* eval.c (rb_funcall_rescue): new function.
@@ -8325,8 +749,7 @@ Mon Nov 29 03:08:30 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (reduce_nodes): empty body should return nil.
- * string.c (rb_str_aset): the original string should not be
- affected by modifying duplicated string. [ruby-dev:24981]
+ * string.c (rb_str_aset): [ruby-dev:24981]
Mon Nov 29 13:57:38 2004 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -8360,8 +783,7 @@ Sat Nov 27 21:43:39 2004 Tanaka Akira <akr@m17n.org>
Sat Nov 27 14:44:15 2004 Kent Sibilev <ksibilev@bellsouth.net>
- * lib/cgi/session.rb (CGI::Session::initialize): create_new_id is
- now a instance method. [ruby-core:03832]
+ * lib/cgi/session.rb (CGI::Session::initialize): [ruby-core:03832]
Sat Nov 27 09:41:21 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -8438,8 +860,7 @@ Tue Nov 23 00:10:48 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_seek): use NUM2OFFT().
- * misc/ruby-mode.el (ruby-non-block-do-re): should not match words
- start with block keyword and underscore. [ruby-core:03719]
+ * misc/ruby-mode.el (ruby-non-block-do-re): [ruby-core:03719]
Mon Nov 22 22:33:02 2004 Dave Thomas <dave@pragprog.com>
@@ -8469,11 +890,11 @@ Sat Nov 20 23:55:19 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_splice): should place index wrapping after
possible modification. [ruby-dev:24940]
-Sat Nov 20 13:26:03 2004 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Nov 20 13:26:03 2004 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/utf8tbl.c: original revision 1.7
-Sat Nov 20 05:34:24 2004 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Nov 20 05:34:24 2004 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: original nkf.c rev:1.40
@@ -8526,7 +947,7 @@ Thu Nov 18 10:10:14 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/stringio/stringio.c (strio_initialize): allow Fixnum as mode as
well as IO.new does. [ruby-dev:24896]
-Wed Nov 17 23:42:40 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Wed Nov 17 23:42:40 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/ruby/test_settracefunc.rb: added. [ruby-dev:24884]
@@ -8597,7 +1018,7 @@ Sun Nov 14 13:27:03 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/pp.rb (PP#object_address_group): remove odd number of 'f'
prefixed to negative address.
-Sun Nov 14 08:51:04 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Sun Nov 14 08:51:04 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/logger/test_logger.rb: Logger just expects
Logger#datetime_format to be used for Time#strftime independently of
@@ -8724,6 +1145,11 @@ Sat Nov 6 14:58:44 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
ruby 1.9 feature)
Sat Nov 6 11:31:04 2004 Tadayoshi Funaba <tadf@dotrb.org>
+Sat Nov 6 00:46:27 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_locktmp): check STR_TMPLOCK flag before
+ locking. [ruby-dev:24727]
+
* lib/date.rb (_parse): checks whether zone was given.
@@ -9169,14 +1595,6 @@ Mon Oct 18 02:04:11 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
do_not_reverse_lookup for each socket if :DoNotReverseLookup
is set. [ruby-core:02357]
-Mon Oct 18 00:42:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c (sock_s_getservbyaname): protocol string
- might be altered. [ruby-dev:24503]
-
- * string.c (rb_str_upto): check if return value from succ is a
- string. [ruby-dev:24504]
-
Sun Oct 17 23:03:48 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/timer.rb: TkTimer#start and restart accept a block
@@ -9269,6 +1687,14 @@ Thu Oct 7 12:55:04 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
switch. [ruby-dev:24442]
* pack.c (pack_unpack): string conversion should at the top of the
+Mon Oct 18 00:42:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_s_getservbyaname): protocol string
+ might be altered. [ruby-dev:24503]
+
+ * string.c (rb_str_upto): check if return value from succ is a
+ string. [ruby-dev:24504]
+
method. [ruby-dev:24439]
* io.c (io_read): buffer should be frozen only after the length
@@ -9358,7 +1784,6 @@ Sat Oct 2 00:42:20 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
[ruby-dev:24383]
* string.c (rb_str_sum): string may be altered. [ruby-dev:24381]
-
Mon Oct 11 17:51:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
@@ -9377,6 +1802,7 @@ Mon Oct 11 17:51:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
prevent access to recycled object (via continuation for
example). [ruby-dev:24463]
+
Fri Oct 1 11:40:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe
@@ -9407,6 +1833,11 @@ Fri Oct 1 11:25:20 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Thu Sep 30 00:50:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Sat Oct 9 00:25:39 2004 Tanaka Akira <akr@m17n.org>
+
+ * io.c (rb_io_fread): rb_thread_wait_fd() was lost.
+ [ruby-dev:24457]
+
* ext/tcltklib/tcltklib.c (ip_init): bug fix
* ext/tk/tkutil.c (get_eval_string_core): accept a Regexp object
@@ -9704,11 +2135,6 @@ Wed Sep 8 15:19:49 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/text.rb: add TkText#clear and erase
-Tue Sep 7 15:17:49 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/socket.c (ruby_connect): break immediately if a
- socket is non-blocking. [ruby-talk:111654]
-
Mon Sep 6 11:08:50 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* ext/tk/lib/tk/menu.rb(TkOptionMenubutton#insert): call correct method
@@ -9717,7 +2143,7 @@ Mon Sep 6 11:00:47 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_s_chdir): the patch to shut up false warning when
exception occurred within a block. a patch was given from Johan
- Holmberg <holmberg at iar.se>. [ruby-core:03292]
+ Holmberg <holmberg@iar.se>. [ruby-core:03292]
Mon Sep 6 07:51:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -9886,7 +2312,7 @@ Thu Aug 19 15:15:24 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (free_dir): fix memory leak. reported by yamamoto
madoka.
-Thu Aug 19 11:00:00 2004 Akiyoshi, Masamichi <masamichi.akiyoshi@hp.com>
+Thu Aug 20 11:00:00 2004 Akiyoshi, Masamichi <masamichi.akiyoshi@hp.com>
* dln.c (dln_load): Modify to call lib$find_image_symbol for VMS.
* io.c (rb_io_fwrite): Use fputc() for VMS non-stream file.
@@ -10244,6 +2670,10 @@ Wed Jul 14 12:29:07 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* test/ruby/test_float.rb (test_strtod): add test for bug fix.
+Wed Jul 14 01:18:45 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * array.c: rdoc patch - unified margin.
+
Wed Jul 14 00:31:15 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* array.c: rdoc patch. merged patch from Johan Holmberg
@@ -10276,7 +2706,7 @@ Mon Jul 12 21:20:36 2004 Dave Thomas <dave@pragprog.com>
* html_generator.rb: Support hyperlinks of the form {any text}[xxx]
as well as stuff[xxx]
-Sat Jul 10 09:30:24 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Sat Jul 10 09:30:24 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/soap/marshal/test_struct.rb: use qualified build-tin class name
(::Struct) to avoid name crash.
@@ -10380,7 +2810,7 @@ Sun Jul 4 12:24:50 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/rss.rb: added copyright header.
-Sun Jul 4 00:24:40 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Sun Jul 4 00:24:40 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* added files
* lib/soap/attachment.rb
@@ -10606,7 +3036,7 @@ Thu Jul 1 03:16:09 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/opnessl/lib/openssl/ssl.rb
(OpenSSL::SSL::SocketForwarder#listen): fix typo.
-Wed Jun 30 11:38:51 2004 Mikael Brockman <phubuh@phubuh.org>
+Wed Jun 30 11:38:51 2004 Mikael Brockman <phubuh@phubuh.org>
* parse.y (primary): should not be NULL. [ruby-core:03098]
@@ -10763,7 +3193,7 @@ Sun Jun 13 00:23:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/extconf.rb: [EXPERIMENTAL] MacOS X (darwin) support
* ext/tcltklib/tcltklib.c: fix thread trouble on callback proc, and
- eliminate warning about instance variable access
+ eliminate warning about instance variable access
* ext/tk/lib/tk/menubar.rb: improve supported menu_spec
@@ -10833,7 +3263,7 @@ Fri May 28 11:20:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (eval): reverted wrongly removed condition. [ruby-dev:23638]
-Thu May 27 23:15:18 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Thu May 27 23:15:18 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/logger.rb: leading 0 padding of timestamp usec part.
@@ -10850,7 +3280,7 @@ Thu May 27 23:15:18 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
and a cell is represented as just a String or nil(NULL). this
change will cause widespread destruction.
- CSV.open("foo.csv", "r") do |row|
+ CSV.open("foo.csv", "r") do |row|
row.each do |cell|
if cell.is_null # using Cell#is_null
p "(NULL)"
@@ -11052,11 +3482,11 @@ Mon May 17 01:15:23 2004 why the lucky stiff <why@ruby-lang.org>
* test/yaml/test_yaml.rb (test_perl_regexp): updated test to
match new regexp serialization.
-Mon May 17 00:03:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Mon May 17 00:03:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/drb/drb.rb: Cosmetic documentation changes.
-Sun May 16 22:36:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun May 16 22:36:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/test/unit.rb: Removed :nodoc: directive (it prevented effective
RDoc operation), and added file-level comment.
@@ -11068,7 +3498,7 @@ Sun May 16 20:55:49 2004 Tanaka Akira <akr@m17n.org>
(Init_dbm): define open flags: DBM::READER, DBM::WRITER, DBM::WRCREAT
and DBM::NEWDB.
-Sun May 16 13:10:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun May 16 13:10:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/test/unit/**/*.rb: Removed :nodoc: directives (many were
generating warnings, many were on private methods).
@@ -11172,7 +3602,7 @@ Mon May 10 12:11:37 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/generators/html_generator.rb: Hack to search parents
for unqualified constant names.
-Sun May 9 22:37:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun May 9 22:37:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/net/ftp.rb: improved documentation
* lib/net/imap.rb: ditto
@@ -11234,11 +3664,11 @@ Wed May 5 03:40:29 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/rinda/ring.rb: use recv instead of recvfrom.
-Tue May 4 23:52:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Tue May 4 23:52:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/gserver.rb: documented
-Tue May 4 23:46:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Tue May 4 23:46:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/xmlrpc/README.txt: introduced for documentation purposes
@@ -11295,7 +3725,7 @@ Sat Apr 24 10:38:31 2004 Dave Thomas <dave@pragprog.com>
Fri Apr 23 23:26:13 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb: $hdrdir should not contain macros for backward
- compatibility. [bruby-dev:28]
+ compatibilitiy. [bruby-dev:28]
* version.c (ruby_show_copyright): obtain copyright year from
RUBY_RELEASE_YEAR.
@@ -11367,7 +3797,7 @@ Mon Apr 19 08:14:18 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_body): Allow for
#ifdef HAVE_PROTOTYPES
-Fri Apr 16 22:33:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Fri Apr 16 22:33:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* ext/iconv/iconv.c: nearly finished RDoc comments.
@@ -11424,7 +3854,7 @@ Tue Apr 13 19:54:29 2004 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: should not overwrite HTTP request header.
[ruby-list:39543]
-Tue Apr 13 01:30:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Tue Apr 13 01:30:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* ext/iconv/iconv.c: RDoc documentation (from RD; nearly finished).
* ext/iconv/charset_alias.rb: Prevent from RDoc'ing.
@@ -11570,7 +4000,7 @@ Thu Apr 1 22:55:04 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/ri/ri_options.rb: Fix undefined variable warning.
-Thu Apr 1 19:58:37 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Thu Apr 1 19:58:37 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/soap/mapping/{factory.rb,registry.rb}: fixed illegal mapped URI
object with soap/marshal.
@@ -11648,7 +4078,7 @@ Thu Mar 25 02:00:18 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/generators/template/html/one_page_html.rb (Page):
Fix to work with C modules.
-Wed Mar 24 21:17:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Wed Mar 24 21:17:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/uri.rb: Documented (thanks Dmitry V. Sabanin).
* lib/uri/common.rb: Ditto.
@@ -11724,14 +4154,6 @@ Thu Mar 18 21:44:38 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/drb.rb: backport drb.rb 1.16.
-Fri Mar 18 17:49:51 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * struct.c (make_struct): allow const_id for accessor names.
- [ruby-core:04585]
-
- * eval.c (rb_attr): check if attribute name is local_id or
- const_id.
-
Thu Mar 18 16:22:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_eq): avoid false positive by using scope and
@@ -11913,15 +4335,15 @@ Mon Feb 23 09:16:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* instruby.rb (DOSISH): embedded path in batch files should not be
prefixed by DESTDIR. [ruby-core:02186]
-Sun Feb 22 09:54:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun Feb 22 09:54:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* re.c: corrected documentation format (again)
-Sun Feb 22 09:43:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun Feb 22 09:43:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* re.c: corrected documentation format (rb_reg_initialize_m)
-Sat Feb 21 22:36:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sat Feb 21 22:36:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* ext/zlib/zlib.c: documented, but needs more effort.
@@ -11944,16 +4366,16 @@ Thu Feb 19 23:24:16 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/generators/html_generator.rb (Generators::HtmlClass::build_attribute_list):
Support visibility modifiers for attributes
-Thu Feb 19 22:39:04 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Thu Feb 19 22:39:04 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/rinda/test_rinda.rb: DRb.start_service only once in testsuites.
DRb.start_service could handle this.
-Thu Feb 19 22:19:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Thu Feb 19 22:19:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/ostruct.rb: documented
-Thu Feb 19 21:28:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Thu Feb 19 21:28:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* ext/strscan/strscan.c: improved documentation
@@ -11974,11 +4396,11 @@ Wed Feb 18 22:52:00 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/unix.rb: remove O_NONBLOCK, thanks \ay
-Wed Feb 18 22:47:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Wed Feb 18 22:47:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* ext/strscan/strscan.c: documented
-Wed Feb 18 22:03:11 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Wed Feb 18 22:03:11 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/*: should not depend on $KCODE.
@@ -11996,7 +4418,7 @@ Tue Feb 17 23:40:34 2004 Guy Decoux <ts@moulon.inra.fr>
* sprintf.c (rb_f_sprintf): preserve original val for
format_integer. [ruby-talk:92975]
-Tue Feb 17 23:28:45 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Tue Feb 17 23:28:45 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/ruby/marshaltestlib.rb: common marshal testcase added.
@@ -12039,11 +4461,11 @@ Tue Feb 17 00:14:30 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* vms/config.h_in: ditto.
-Mon Feb 16 23:28:14 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Mon Feb 16 23:28:14 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/csv.rb: document reduction. [ruby-core:02429]
-Mon Feb 16 22:08:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Mon Feb 16 22:08:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/generator.rb: corrected doc format
* lib/rinda/rinda.rb: added documentation (from Hugh Sasse)
@@ -12095,11 +4517,11 @@ Fri Feb 13 12:35:08 2004 Minero Aoki <aamine@loveruby.net>
* test/fileutils/test_fileutils.rb: File.link may raise EINVAL and
EACCES on Windows.
-Thu Feb 12 21:45:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Thu Feb 12 21:45:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/ftools.rb: documented
-Thu Feb 12 21:25:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Thu Feb 12 21:25:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/base64.rb: backported from HEAD (modularised and documented)
@@ -12156,12 +4578,12 @@ Fri Feb 6 22:48:16 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/generators/html_generator.rb (gen_url): Support
https in RDoc hyperlinks
-Fri Feb 6 22:41:22 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Fri Feb 6 22:41:22 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/pp.rb (PPInspectTest#test_to_s_with_iv): rollback the previous
commit. [ruby-dev:22813]
-Fri Feb 6 22:22:50 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Fri Feb 6 22:22:50 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/pp.rb (PPInspectTest#test_to_s_with_iv): remove instance
variable which is defined in the test.
@@ -12226,11 +4648,11 @@ Mon Feb 2 01:54:00 2004 Tanaka Akira <akr@m17n.org>
(UDPSocket#send): recognize 3 arguments form. try all addresses on
4 arguments form.
-Sun Feb 1 18:17:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun Feb 1 18:17:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/net/http.rb: merged coding style changes from HEAD.
-Sun Feb 1 16:15:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun Feb 1 16:15:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/test/unit.rb: rearranged documentation for RDoc's sake.
* lib/matrix.rb: improved documentation.
@@ -12246,7 +4668,7 @@ Sat Jan 31 09:20:32 2004 NAKAMURA, Hiroshi <nakahiro@sairon.co.jp>
* sample/openssl/gen_csr.rb: wrong usage string.
-Sat Jan 31 01:00:32 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Sat Jan 31 01:00:32 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/soap/wsdlDriver.rb, lib/wsdl/soap/operation.rb: add support of
"parts" attribute of soap:body element in WSDL.
@@ -12461,7 +4883,7 @@ Wed Jan 14 13:31:06 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/iconv/extconf.rb: wrapper iconv.rb is dependent on platform.
-Tue Jan 13 18:54:28 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Tue Jan 13 18:54:28 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/logger.rb(Logger#msg2str): no special treatment for the object
which responds to :to_str. commited at 2004-01-11T21:46:27 by
@@ -12577,7 +4999,7 @@ Thu Jan 8 21:29:43 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_to_der): new function for
OpenSSL::PKey::RSA#to_der.
-Thu Jan 8 16:51:04 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Thu Jan 8 16:51:04 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/wsdl/datetime/test_datetime.rb: fixed a stupid testcase which
dumps "E" at month-end.
@@ -12602,7 +5024,7 @@ Wed Jan 7 13:00:18 2004 Dave Thomas <dave@pragprog.com>
names (such as "ri Thread.join" would return both
Thread.join and ThreadsWait.join)
-Wed Jan 7 12:35:41 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Wed Jan 7 12:35:41 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/debug.rb: revert command parse regexps. [ruby-list:39014] by
Shirai,Kaoru.
@@ -12992,7 +5414,7 @@ Tue Dec 23 22:47:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_check_writable): clear FMODE_RBUF before writing
something.
-Tue Dec 23 22:25:00 2003 Gavin Sinclair <gsinclair@soyabean.com.au>
+Tue Dec 23 22:25:00 2003 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/optparse.rb: incomplete RDoc documentation added in place of
existing RD comments. Tabs converted to spaces.
@@ -13016,7 +5438,7 @@ Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* pack.c (pack_pack): remove unnecessary negative value check.
[ruby-dev:22329]
-Tue Dec 23 17:26:55 2003 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+Tue Dec 23 17:26:55 2003 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
* bcc32/Makefile.sub (config.h): bcc has finite(). [ruby-list:38940]
@@ -13819,7 +6241,7 @@ Tue Dec 2 21:31:42 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/runner.rb: exit with the test result.
-Tue Dec 2 20:18:48 2003 Eric Sunshine <sunshine@sunshineco.com>
+Tue Dec 2 20:18:48 2003 Eric Sunshine <sunshine@sunshineco.com>
* configure.in (AC_PROG_YACC): AC_DEFINE(OLD_YACC) if Yacc is found
instead of Bison or byacc.
@@ -13882,7 +6304,7 @@ Mon Dec 1 14:17:49 2003 Minero Aoki <aamine@loveruby.net>
* test/fileutils/test_fileutils.rb: does much strict test on
"same" files detecting.
-Mon Dec 1 09:28:14 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Dec 1 09:28:14 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
(XCFLAGS): re-export $(XCFLAGS).
@@ -13966,7 +6388,7 @@ Fri Nov 28 19:37:56 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ruby/test_env.rb (test_has_value, test_index): condition for
aboves.
-Fri Nov 28 17:59:20 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 28 17:59:20 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_env.rb: add tests for ENV.
@@ -14052,7 +6474,7 @@ Wed Nov 26 00:55:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/httpserver.rb (HTTPServer#run): should pass the
request's keep_alive flag to the response.
-Tue Nov 25 21:41:35 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Nov 25 21:41:35 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* defines.h (ENV_IGNORECASE): should define when DOSISH without
human68k. [ruby-dev:22047]
@@ -14193,7 +6615,7 @@ Mon Nov 24 17:00:00 2003 Tanaka Akira <akr@m17n.org>
* lib/open-uri.rb: validate option names.
:content_length_proc and :progress_proc option implemented.
-Mon Nov 24 14:53:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Nov 24 14:53:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
(XCFLAGS): output empty value instead of `-DRUBY_EXPORT'.
@@ -14216,12 +6638,12 @@ Sat Nov 22 22:48:46 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: add native thread check
-Sat Nov 22 18:49:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Nov 22 18:49:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/curses/curses.c (window_nodelay): nodelay() of NetBSD's
libcruses returns no value, just like keypad().
-Sat Nov 22 17:36:36 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Nov 22 17:36:36 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
(HAVE_GETCWD): output to config.h.
@@ -14330,7 +6752,7 @@ Wed Nov 19 14:32:08 2003 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (cannot_overwrite_file?): add wince.
-Wed Nov 19 11:04:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 19 11:04:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/fileutils.rb (cannot_overwrite_file?, have_st_ino?): bccwin32
is same as mswin32.
@@ -14445,7 +6867,7 @@ Sun Nov 16 12:16:10 2003 Minero Aoki <aamine@loveruby.net>
* lib/net/protocol.rb: logging response body. [experimental]
[ruby-list:38800]
-Sun Nov 16 10:49:38 2003 Gavin Sinclair <gsinclair@soyabean.com.au>
+Sun Nov 16 10:49:38 2003 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/thread.rb (Thread.exclusive): wrap method definition in
class Thread to enable rdoc to process.
@@ -14618,7 +7040,7 @@ Sat Nov 8 13:49:50 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* configure.in: improvement of pthread check
-Sat Nov 8 13:28:46 2003 Takaaki Tateishi <ttate@ttsky.net>
+Sat Nov 8 13:28:46 2003 Takaaki Tateishi <ttate@ttsky.net>
* ext/dl/sym.c: Add DL.win32_last_error and DL.last_error.
Thanks, Kaoru Shirai.
@@ -14721,7 +7143,7 @@ Wed Nov 5 17:05:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit/ui/gtk/testrunner.rb: typo.
-Wed Nov 5 11:13:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Nov 5 11:13:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* string.c: add #include "version.h". this file still depends on it.
@@ -14742,7 +7164,7 @@ Wed Nov 5 08:39:51 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_ssl.c (ossl_ssl_get_peer_cert_chain): return nil
if no cert-chain was given.
-Tue Nov 4 23:44:48 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Nov 4 23:44:48 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub:
remove needless version.h dependency.
@@ -14848,7 +7270,7 @@ Fri Oct 31 12:55:24 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* bcc32/Makefile.sub, win32/Makefile.sub, win32/Makefile.sub: ditto.
-Fri Oct 31 01:38:14 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Oct 31 01:38:14 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* wince/Makefile.sub, win32/Makefile.sub (.y.c): allow white spaces
at the beginning of line to remove by sed. (ruby-bugs-ja:PR#580)
@@ -14907,7 +7329,7 @@ Thu Oct 30 10:14:51 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/test/unit/autorunner.rb: make fox runner work.
-Thu Oct 30 09:32:26 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Oct 30 09:32:26 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* process.c (rb_f_system): fixed lack of security check before
calling do_spawn() on win32. [ruby-talk:84555]
@@ -14936,7 +7358,7 @@ Wed Oct 29 22:02:04 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/drb/drbtest.rb: use rbconfig.rb to make the path of ruby
interpreter to exec, instead of test/ruby/envutil.rb,
-Wed Oct 29 19:58:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Oct 29 19:58:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/tcltklib/tcltklib.c (CONST84): define CONST84 when it is not
defined and TCL_MAJOR_VERSION >= 8.
@@ -14968,7 +7390,7 @@ Wed Oct 29 11:27:39 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (ret_args): node may be NULL. [ruby-talk:84530]
-Tue Oct 28 15:20:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Oct 28 15:20:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/tcltklib/tcltklib.c (VwaitVarProc, ip_rbVwaitObjCmd,
WaitVariableProc, WaitVisibilityProc, WaitWindowProc,
@@ -15050,7 +7472,7 @@ Tue Oct 21 15:57:11 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit/collector/dir.rb (Test::Unit::Collector::Dir#collect_file):
prepend the directory of target file to the load path.
-Tue Oct 21 15:08:53 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Oct 21 15:08:53 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (do_spawn, do_aspawn): should wait child process even
if callded with P_OVERLAY.
@@ -15103,7 +7525,7 @@ Mon Oct 20 11:00:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (gc_sweep): do not update malloc_limit when malloc_increase
is smaller than malloc_limit.
-Mon Oct 20 09:45:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Oct 20 09:45:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/debug.rb (debug_command): remove debug print.
@@ -15157,7 +7579,7 @@ Fri Oct 17 22:16:42 2003 Akinori MUSHA <knu@iDaemons.org>
* lib/set.rb: It is not necessary to require
'test/unit/ui/console/testrunner'.
-Fri Oct 17 11:15:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Oct 17 11:15:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_range.rb: added.
@@ -15224,7 +7646,7 @@ Wed Oct 15 15:00:54 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (ruby_run): just return FAILURE instead of parse error
count. [ruby-list:38569]
-Wed Oct 15 13:17:02 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Oct 15 13:17:02 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/digest/digest.c (rb_digest_base_alloc): need to initialize
buffer. [ruby-dev:21622]
@@ -15237,7 +7659,7 @@ Wed Oct 15 11:23:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
modules before invoking marshal_load. these two fixes are done
by Masatoshi Seki <m_seki@mva.biglobe.ne.jp>.
-Wed Oct 15 09:30:34 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Oct 15 09:30:34 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/enumerator/enumerator.c (enumerator_each): avoid VC++ warning.
@@ -15504,7 +7926,7 @@ Thu Oct 9 06:43:33 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_thread_start_0, rb_thread_raise, rb_callcc): save
variables across THREAD_SAVE_CONTEXT.
-Thu Oct 9 12:05:46 2003 Eric Sunshine <sunshine@sunshineco.com>
+Thu Oct 9 12:05:46 2003 Eric Sunshine <sunshine@sunshineco.com>
* configure.in: revived NextStep, OpenStep, and Rhapsody ports which
had become unbuildable; enhanced --enable-fat-binary option so that
@@ -15923,7 +8345,7 @@ Fri Oct 3 16:13:19 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_x509attr.c (ossl_x509attr_get_value): return
DER encoded data in OpenSSL::ASN1 types.
-Fri Oct 3 13:02:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+Fri Oct 3 13:02:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
* lib/test/unit.rb: refactored to use optparse.
@@ -15946,7 +8368,7 @@ Fri Oct 3 08:14:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/irb/ruby-lex.rb (RubyLex::identify_identifier): support
'class ::Foo' syntax. [ruby-talk:83514]
-Fri Oct 3 08:01:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+Fri Oct 3 08:01:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
* lib/test/unit/assertions.rb: added a default message for #assert,
#assert_block, and #flunk.
@@ -16042,7 +8464,7 @@ Thu Oct 2 11:17:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
* lib/test/unit/collector/objectspace.rb: ditto.
-Thu Oct 2 03:25:01 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Oct 2 03:25:01 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* eval.c (rb_thread_raise): prototype; avoid VC++ warning.
@@ -16155,11 +8577,11 @@ Wed Oct 1 17:01:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_load): Object scope had priority over required file
scope. [ruby-dev:21415]
-Wed Oct 1 14:09:53 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+Wed Oct 01 14:09:53 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/mkconfig_wce.rb: sorry, forget to commit.
-Wed Oct 1 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+Wed Oct 01 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/setup.mak: add sigmarionIII SDK support.
@@ -16169,7 +8591,7 @@ Wed Oct 1 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/mkconfig_wce.rb: camouflage RUBY_PLATFORM for compiling ext.
-Wed Oct 1 08:02:52 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+Wed Oct 01 08:02:52 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/time_wce.c (time): add zero check.
@@ -16316,7 +8738,7 @@ Sat Sep 27 03:32:37 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
test/soap/marshal/test_marshal.rb crashed with
test/ruby/test_marshal.rb.
-Sat Sep 27 01:30:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Sep 27 01:30:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/socket.c (ruby_connect): on win32, type of the 4th
argument of getsockopt is char *.
@@ -16341,7 +8763,7 @@ Fri Sep 26 00:10:13 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/README: updated.
-Thu Sep 25 17:48:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Sep 25 17:48:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/openssl/ossl.c (ossl_buf2str): fix type of 1st argument for
rb_protect.
@@ -16349,7 +8771,7 @@ Thu Sep 25 17:48:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/openssl/ossl_hmac.c (ossl_hmac_digest): should return meaningful
value.
-Thu Sep 25 09:00:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+Thu Sep 25 09:00:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
* lib/ostruct.rb: Added OpenStruct#==.
@@ -16432,7 +8854,7 @@ Sat Sep 20 11:49:05 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/logger/test_logger.rb: new file.
-Fri Sep 19 11:39:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+Fri Sep 19 11:39:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
* test/testunit/*: Added.
@@ -16573,7 +8995,7 @@ Mon Sep 15 19:02:52 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/csv/mac.csv: added. Sample CR separated CSV file.
-Fri Sep 12 22:41:48 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+Fri Sep 12 22:41:48 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* ext/openssl/ossl.c: move ASN.1 stuff to ossl_asn1.[ch]
@@ -16597,7 +9019,7 @@ Fri Sep 12 12:09:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (rb_big_xor): ditto.
-Fri Sep 12 07:06:14 2003 David Black <dblack@superlink.net>
+Fri Sep 12 07:06:14 2003 David Black <dblack@superlink.net>
* lib/scanf.rb: Took out useless @matched_item variable; some small
refactoring.
@@ -16622,7 +9044,7 @@ Wed Sep 10 22:47:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_config.c (set_conf_section_i): should check
if the argument is Array.
-Wed Sep 10 22:41:54 2003 Tietew <tietew@tietew.net>
+Wed Sep 10 22:41:54 2003 Tietew <tietew@tietew.net>
* eval.c (win32_get_exception_list): avoid VC7 warning.
[ruby-win32:577]
@@ -16640,7 +9062,7 @@ Tue Sep 9 05:17:04 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_config.rb: avoid compile error in OpenSSL-0.9.6.
-Tue Sep 9 02:41:35 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+Tue Sep 9 02:41:35 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* ext/openssl/ossl_config.c: Refine compatibility.
@@ -16710,7 +9132,7 @@ Sat Sep 6 02:26:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/test_*.rb: assert_same, assert_match, and so on.
-Sat Sep 6 18:45:46 2003 Mauricio Fernandez <batsman.geo@yahoo.com>
+Sat Sep 6 18:45:46 2003 Mauricio Fernandez <batsman.geo@yahoo.com>
* parse.y (assignable): call rb_compile_error(), not rb_bug().
[ruby-core:01523]
@@ -16729,7 +9151,7 @@ Sat Sep 6 17:40:41 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_x509ext.c (X509::Extension#critical=): new method.
-Sat Sep 6 01:23:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Sep 6 01:23:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (CreateChild): need to quote cmd if RUBYSHELL is set.
@@ -17010,12 +9432,12 @@ Sat Aug 30 03:58:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): stop TAG_RETURN/TAG_BREAK escaping.
-Fri Aug 29 22:35:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+Fri Aug 29 22:35:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
* bigdecimal.c *.html: The 2nd arg. for add,sub,mult, and div is 0,
then result will be the same as +,-,*,/ respectively.
-Fri Aug 29 17:30:15 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+Fri Aug 29 17:30:15 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* process.c: bug fix
@@ -17090,7 +9512,7 @@ Wed Aug 27 15:07:57 2003 Minero Aoki <aamine@loveruby.net>
* lib/net/smtp.rb (check_response): AUTH CRAM-MD5 returns 334
response. [ruby-list:38279]
-Wed Aug 27 05:10:15 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Aug 27 05:10:15 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (map_errno): support winsock error.
@@ -17139,7 +9561,7 @@ Sat Aug 23 18:56:53 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/nkf/nkf.c (rb_nkf_putchar): should use rb_str_resize() to just
resize a string, rb_str_cat() disallows NULL. [ruby-dev:21237]
-Sat Aug 23 16:48:41 2003 Keiju Ishitsuka <keiju@ishitsuka.com>
+Sat Aug 23 16:48:41 2003 Keiju Ishitsuka <keiju@ishitsuka.com>
* lib/irb/ruby-lex.rb: bug fix for "foo" !~ /bar/. [ruby-talk:79942]
@@ -17164,7 +9586,7 @@ Fri Aug 22 17:07:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_scan): use rb_yield_splat().
-Fri Aug 22 06:13:22 2003 why the lucky stiff <why@ruby-lang.org>
+Fri Aug 22 06:13:22 2003 why the lucky stiff <why@ruby-lang.org>
* ext/syck/rubyext.c: refactoring of the transfer method
dispatch. added yaml_org_handler for faster dispatch of
@@ -17352,7 +9774,7 @@ Fri Aug 15 02:08:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (id2ref): recycle check should be done by klass == 0.
[ruby-core:01408]
-Fri Aug 15 01:34:23 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+Fri Aug 15 01:34:23 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* ext/openssl/ossl_pkey.c: move generate_cb here
@@ -17384,7 +9806,7 @@ Thu Aug 14 20:03:34 2003 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_initialize): stop calling
OleUninitialize at exit.
-Thu Aug 14 11:27:37 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Aug 14 11:27:37 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* gc.c (rb_data_object_alloc): check type of 1st argument.
[ruby-dev:21192]
@@ -17423,7 +9845,7 @@ Wed Aug 13 15:58:31 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* object.c (rb_class_s_alloc): add function prototype to avoid VC++
warning.
-Wed Aug 13 13:50:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Aug 13 13:50:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/Win32API/Win32API.c (Win32API_initialize): should pass some
class to first argument of Data_Wrap_Struct(). (ruby-bugs:PR#1109)
@@ -17582,7 +10004,7 @@ Wed Aug 6 17:23:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c: initialize /* OK */ variables by Qnil to stop warnings.
-Wed Aug 6 04:58:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Aug 6 04:58:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/Setup*: add io/wait and openssl.
diff --git a/LEGAL b/LEGAL
index 908eb270f5..dce7c1acbf 100644
--- a/LEGAL
+++ b/LEGAL
@@ -134,12 +134,14 @@ st.[ch]:
x68/*:
missing/alloca.c:
missing/dup2.c:
+missing/erf.c:
missing/finite.c:
missing/hypot.c:
missing/isinf.c:
missing/isnan.c:
missing/memcmp.c:
missing/memmove.c:
+missing/mkdir.c:
missing/strcasecmp.c:
missing/strchr.c:
missing/streror.c:
@@ -184,8 +186,6 @@ missing/strtoul.c:
software for any purpose. It is provided "as is" without
express or implied warranty.
-missing/erf.c:
-missing/crypt.c:
missing/vsnprintf.c:
This file is under the old-style BSD license. Note that the
@@ -205,7 +205,11 @@ missing/vsnprintf.c:
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the University of
+ California, Berkeley and its contributors.
+ 4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -305,20 +309,17 @@ ext/digest/sha2/sha2hl.c:
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-ext/nkf/nkf-utf8/config.h:
-ext/nkf/nkf-utf8/nkf.c:
-ext/nkf/nkf-utf8/utf8tbl.c:
+ext/nkf/nkf1.7/nkf.c:
- These files are under the following license. So to speak, it is
+ This file is under the following license. So to speak, it is
copyrighted semi-public-domain software.
Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA)
Everyone is permitted to do anything on this program
- including copying, modifying, improving,
+ including copying, modifying, improving.
as long as you don't try to pretend that you wrote it.
i.e., the above copyright notice has to appear in all copies.
- Binary distribution requires original version messages.
- You don't have to ask before copying, redistribution or publishing.
+ You don't have to ask before copying or publishing.
THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
ext/socket/addrinfo.h:
diff --git a/Makefile.in b/Makefile.in
index 254f1656ee..663ba43111 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -10,7 +10,6 @@ YACC = @YACC@
PURIFY =
AUTOCONF = autoconf
@SET_MAKE@
-MKFILES = @MAKEFILES@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -18,21 +17,10 @@ bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
libexecdir = @libexecdir@
-datarootdir = @datarootdir@
-datadir = @datadir@
arch = @arch@
sitearch = @sitearch@
sitedir = @sitedir@
-TESTUI = console
-TESTS =
-RDOCTARGET = @RDOCTARGET@
-
-EXTOUT = @EXTOUT@
-RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
-
-empty =
-OUTFLAG = @OUTFLAG@$(empty)
CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
@@ -45,7 +33,6 @@ LDSHARED = @LIBRUBY_LDSHARED@
DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(EXTLDFLAGS) @ARCH_FLAG@
SOLIBS = @SOLIBS@
MAINLIBS = @MAINLIBS@
-MINIOBJS = @MINIOBJS@
RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
RUBY_SO_NAME=@RUBY_SO_NAME@
@@ -53,7 +40,6 @@ EXEEXT = @EXEEXT@
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
RUBY = $(RUBY_INSTALL_NAME)
MINIRUBY = @MINIRUBY@
-RUNRUBY = @RUNRUBY@
#### End of system configuration section. ####
@@ -69,55 +55,135 @@ LIBRUBYARG = @LIBRUBYARG@
LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@
LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
-PREP = @PREP@
-ARCHFILE = @ARCHFILE@
+PREP = @PREP@ @ARCHFILE@
SETUP =
EXTSTATIC = @EXTSTATIC@
-RM = rm -f
-NM = @NM@
-AR = @AR@
-ARFLAGS = rcu
-RANLIB = @RANLIB@
-AS = @AS@
-ASFLAGS = @ASFLAGS@
+EXTOBJS =
+DLDOBJS = $(DMYEXT)
+DMYEXT = dmyext.@OBJEXT@
+
+MAINOBJ = main.@OBJEXT@
+
+OBJS = array.@OBJEXT@ \
+ bignum.@OBJEXT@ \
+ class.@OBJEXT@ \
+ compar.@OBJEXT@ \
+ dir.@OBJEXT@ \
+ dln.@OBJEXT@ \
+ enum.@OBJEXT@ \
+ error.@OBJEXT@ \
+ eval.@OBJEXT@ \
+ file.@OBJEXT@ \
+ gc.@OBJEXT@ \
+ hash.@OBJEXT@ \
+ inits.@OBJEXT@ \
+ io.@OBJEXT@ \
+ marshal.@OBJEXT@ \
+ math.@OBJEXT@ \
+ numeric.@OBJEXT@ \
+ object.@OBJEXT@ \
+ pack.@OBJEXT@ \
+ parse.@OBJEXT@ \
+ process.@OBJEXT@ \
+ prec.@OBJEXT@ \
+ random.@OBJEXT@ \
+ range.@OBJEXT@ \
+ re.@OBJEXT@ \
+ regex.@OBJEXT@ \
+ ruby.@OBJEXT@ \
+ signal.@OBJEXT@ \
+ sprintf.@OBJEXT@ \
+ st.@OBJEXT@ \
+ string.@OBJEXT@ \
+ struct.@OBJEXT@ \
+ time.@OBJEXT@ \
+ util.@OBJEXT@ \
+ variable.@OBJEXT@ \
+ version.@OBJEXT@ \
+ $(MISSING)
-OBJEXT = @OBJEXT@
MANTYPE = @MANTYPE@
-PREINSTALL = @PREINSTALL@
-#### End of variables
+SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
+ --make="$(MAKE)" \
+ --mflags="$(MFLAGS)" \
+ --make-flags="$(MAKEFLAGS)"
-all:
+all: @MAKEFILES@ miniruby$(EXEEXT) rbconfig.rb $(LIBRUBY)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic="$(EXTSTATIC)" $(SCRIPT_ARGS)
-.DEFAULT: all
+miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(DMYEXT)
+ @rm -f $@
+ $(PURIFY) $(CC) $(LDFLAGS) $(MAINLIBS) $(MAINOBJ) $(DMYEXT) $(LIBRUBY_A) $(LIBS) -o $@
-# Prevent GNU make v3 from overflowing arg limit on SysV.
-.NOEXPORT:
-
-miniruby$(EXEEXT):
- @$(RM) $@
- $(PURIFY) $(CC) $(MAINOBJ) $(MINIOBJS) $(LIBRUBY_A) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(MAINLIBS)
-
-$(PROGRAM):
- @$(RM) $@
- $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) $(OUTFLAG)$@
+$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) $(SETUP) miniruby$(EXEEXT)
+ @rm -f $@
+ $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
# We must `rm' the library each time this rule is invoked because "updating" a
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
# supported.
-$(LIBRUBY_A):
- @$(RM) $@
- $(AR) $(ARFLAGS) $@ $(OBJS) $(DMYEXT)
- @-$(RANLIB) $@ 2> /dev/null || true
+$(LIBRUBY_A): $(OBJS) $(DMYEXT)
+ @rm -f $@
+ @AR@ rcu $@ $(OBJS) $(DMYEXT)
+ @-@RANLIB@ $@ 2> /dev/null || true
-$(LIBRUBY_SO):
- $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@
+$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) miniruby$(EXEEXT) $(PREP)
+ $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) -o $@
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
File.symlink "$(LIBRUBY_SO)", link}' \
$(LIBRUBY_ALIASES) || true
-fake.rb: Makefile
+ruby.imp: $(LIBRUBY_A)
+ @@NM@ -Pgp $(LIBRUBY_A) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@
+# $(MINIRUBY) $< $@
+
+install: install-nodoc @RDOCTARGET@
+
+install-nodoc: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install
+
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install
+
+install-doc:
+ @echo Generating RDoc documentation
+ $(bindir)/$(PROGRAM) $(srcdir)/bin/rdoc --all --ri-system $(srcdir)
+
+clean-ext:
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) clean 2> /dev/null || true
+
+clean-local:
+ @rm -f $(OBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY_ALIASES)
+ @rm -f ext/extinit.c ext/extinit.@OBJEXT@ dmyext.@OBJEXT@
+ @rm -f $(PROGRAM) miniruby$(EXEEXT)
+
+clean: clean-ext clean-local
+
+distclean-ext:
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) distclean 2> /dev/null || true
+
+distclean-local: clean-local
+ @rm -f @MAKEFILES@ config.h rbconfig.rb
+ @rm -f ext/config.cache config.cache config.log config.status
+ @rm -f *~ core *.core gmon.out y.tab.c y.output ruby.imp
+
+distclean: distclean-ext distclean-local
+
+realclean: distclean
+ @rm -f parse.c
+ @rm -f lex.c
+
+test: miniruby$(EXEEXT) rbconfig.rb $(PROGRAM) PHONY
+ @./miniruby$(EXEEXT) $(srcdir)/rubytest.rb
+
+rbconfig.rb: miniruby$(EXEEXT) $(srcdir)/mkconfig.rb config.status $(PREP)
+ @$(MINIRUBY) $(srcdir)/mkconfig.rb rbconfig.rb
+
+fake.rb: miniruby$(EXEEXT) Makefile
@echo ' \
class Object; \
CROSS_COMPILING = RUBY_PLATFORM; \
@@ -136,7 +202,13 @@ fake.rb: Makefile
Makefile: $(srcdir)/Makefile.in
-$(MKFILES): config.status $(srcdir)/common.mk
+.PRECIOUS: @MAKEFILES@
+
+.PHONY: test install install-nodoc install-doc
+
+PHONY:
+
+@MAKEFILES@: config.status
MAKE=$(MAKE) $(SHELL) ./config.status
@{ \
echo "all:; -@rm -f conftest.mk"; \
@@ -152,8 +224,11 @@ config.status: $(srcdir)/configure
$(srcdir)/configure: $(srcdir)/configure.in
cd $(srcdir) && $(AUTOCONF)
+.c.@OBJEXT@:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+
lex.c: keywords
- @-$(RM) $@
+ @-rm -f $@
gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@ || \
cp "$(srcdir)/$@" .
@@ -162,17 +237,144 @@ lex.c: keywords
sed '/^#/s|y\.tab\.c|$@|' y.tab.c > $@
rm -f y.tab.c
-.c.@OBJEXT@:
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+ext/extinit.@OBJEXT@: ext/extinit.c $(SETUP)
+ $(CC) $(CFLAGS) $(CPPFLAGS) @OUTFLAG@$@ -c ext/extinit.c
+
+acosh.@OBJEXT@: $(srcdir)/missing/acosh.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/acosh.c
+
+alloca.@OBJEXT@: $(srcdir)/missing/alloca.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/alloca.c
+
+crypt.@OBJEXT@: $(srcdir)/missing/crypt.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/crypt.c
+
+dup2.@OBJEXT@: $(srcdir)/missing/dup2.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dup2.c
+
+fileblocks.@OBJEXT@: $(srcdir)/missing/fileblocks.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fileblocks.c
+
+finite.@OBJEXT@: $(srcdir)/missing/finite.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/finite.c
+
+flock.@OBJEXT@: $(srcdir)/missing/flock.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/flock.c
+
+isinf.@OBJEXT@: $(srcdir)/missing/isinf.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/isinf.c
+
+isnan.@OBJEXT@: $(srcdir)/missing/isnan.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/isnan.c
+
+fnmatch.@OBJEXT@: $(srcdir)/missing/fnmatch.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fnmatch.c
+
+memcmp.@OBJEXT@: $(srcdir)/missing/memcmp.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/memcmp.c
+
+memmove.@OBJEXT@: $(srcdir)/missing/memmove.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/memmove.c
-.s.@OBJEXT@:
- $(AS) $(ASFLAGS) -o $@ $<
+mkdir.@OBJEXT@: $(srcdir)/missing/mkdir.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/mkdir.c
-clean-local::
- @$(RM) ext/extinit.c ext/extinit.$(OBJEXT)
+vsnprintf.@OBJEXT@: $(srcdir)/missing/vsnprintf.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/vsnprintf.c
-distclean-local::
- @$(RM) ext/config.cache $(RBCONFIG)
+strcasecmp.@OBJEXT@: $(srcdir)/missing/strcasecmp.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strcasecmp.c
-ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
- $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
+strncasecmp.@OBJEXT@: $(srcdir)/missing/strncasecmp.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strncasecmp.c
+
+strchr.@OBJEXT@: $(srcdir)/missing/strchr.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strchr.c
+
+strerror.@OBJEXT@: $(srcdir)/missing/strerror.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strerror.c
+
+strftime.@OBJEXT@: $(srcdir)/missing/strftime.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strftime.c
+
+strstr.@OBJEXT@: $(srcdir)/missing/strstr.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strstr.c
+
+strtol.@OBJEXT@: $(srcdir)/missing/strtol.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strtol.c
+
+strtoul.@OBJEXT@: $(srcdir)/missing/strtoul.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strtoul.c
+
+x68.@OBJEXT@: $(srcdir)/missing/x68.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/x68.c
+
+os2.@OBJEXT@: $(srcdir)/missing/os2.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/os2.c
+
+dl_os2.@OBJEXT@: $(srcdir)/missing/dl_os2.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dl_os2.c
+
+win32.@OBJEXT@: $(srcdir)/win32/win32.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -I$(srcdir)/win32 -c $(srcdir)/win32/win32.c
+
+# Prevent GNU make v3 from overflowing arg limit on SysV.
+.NOEXPORT:
+###
+array.@OBJEXT@: array.c ruby.h config.h defines.h intern.h missing.h \
+ util.h st.h
+bignum.@OBJEXT@: bignum.c ruby.h config.h defines.h intern.h missing.h
+class.@OBJEXT@: class.c ruby.h config.h defines.h intern.h missing.h \
+ rubysig.h node.h st.h
+compar.@OBJEXT@: compar.c ruby.h config.h defines.h intern.h missing.h
+dir.@OBJEXT@: dir.c ruby.h config.h defines.h intern.h missing.h util.h
+dln.@OBJEXT@: dln.c ruby.h config.h defines.h intern.h missing.h dln.h
+dmyext.@OBJEXT@: dmyext.c
+enum.@OBJEXT@: enum.c ruby.h config.h defines.h intern.h missing.h node.h \
+ util.h
+error.@OBJEXT@: error.c ruby.h config.h defines.h intern.h missing.h \
+ env.h st.h
+eval.@OBJEXT@: eval.c ruby.h config.h defines.h intern.h missing.h node.h \
+ env.h util.h rubysig.h st.h dln.h
+file.@OBJEXT@: file.c ruby.h config.h defines.h intern.h missing.h \
+ rubyio.h rubysig.h util.h dln.h
+gc.@OBJEXT@: gc.c ruby.h config.h defines.h intern.h missing.h rubysig.h \
+ st.h node.h env.h re.h regex.h
+hash.@OBJEXT@: hash.c ruby.h config.h defines.h intern.h missing.h st.h \
+ util.h rubysig.h
+inits.@OBJEXT@: inits.c ruby.h config.h defines.h intern.h missing.h
+io.@OBJEXT@: io.c ruby.h config.h defines.h intern.h missing.h rubyio.h \
+ rubysig.h env.h util.h
+main.@OBJEXT@: main.c ruby.h config.h defines.h intern.h missing.h
+marshal.@OBJEXT@: marshal.c ruby.h config.h defines.h intern.h missing.h \
+ rubyio.h st.h util.h
+math.@OBJEXT@: math.c ruby.h config.h defines.h intern.h missing.h
+numeric.@OBJEXT@: numeric.c ruby.h config.h defines.h intern.h missing.h
+object.@OBJEXT@: object.c ruby.h config.h defines.h intern.h missing.h \
+ st.h util.h
+pack.@OBJEXT@: pack.c ruby.h config.h defines.h intern.h missing.h
+parse.@OBJEXT@: parse.c ruby.h config.h defines.h intern.h missing.h \
+ env.h node.h st.h regex.h util.h lex.c
+prec.@OBJEXT@: prec.c ruby.h config.h defines.h intern.h missing.h
+process.@OBJEXT@: process.c ruby.h config.h defines.h intern.h missing.h \
+ rubysig.h st.h
+random.@OBJEXT@: random.c ruby.h config.h defines.h intern.h missing.h
+range.@OBJEXT@: range.c ruby.h config.h defines.h intern.h missing.h
+re.@OBJEXT@: re.c ruby.h config.h defines.h intern.h missing.h re.h \
+ regex.h
+regex.@OBJEXT@: regex.c config.h regex.h
+ruby.@OBJEXT@: ruby.c ruby.h config.h defines.h intern.h missing.h dln.h \
+ node.h util.h
+signal.@OBJEXT@: signal.c ruby.h config.h defines.h intern.h missing.h \
+ rubysig.h
+sprintf.@OBJEXT@: sprintf.c ruby.h config.h defines.h intern.h missing.h
+st.@OBJEXT@: st.c config.h st.h
+string.@OBJEXT@: string.c ruby.h config.h defines.h intern.h missing.h \
+ re.h regex.h
+struct.@OBJEXT@: struct.c ruby.h config.h defines.h intern.h missing.h
+time.@OBJEXT@: time.c ruby.h config.h defines.h intern.h missing.h
+util.@OBJEXT@: util.c ruby.h config.h defines.h intern.h missing.h util.h
+variable.@OBJEXT@: variable.c ruby.h config.h defines.h intern.h \
+ missing.h env.h node.h st.h util.h
+version.@OBJEXT@: version.c ruby.h config.h defines.h intern.h missing.h \
+ version.h
diff --git a/README b/README
index cf836415ad..bde22dff78 100644
--- a/README
+++ b/README
@@ -22,24 +22,16 @@ Perl). It is simple, straight-forward, and extensible.
* How to get Ruby
-The Ruby distribution files can be found in the following FTP site:
+The Ruby distribution can be found on:
ftp://ftp.ruby-lang.org/pub/ruby/
-The latest source code of this version series can be checked out
-through SVN with the following command:
+You can get it by anonymous CVS. How to check out is:
- $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6/
-
-The trunk of the Ruby source tree can be checked out with the
-following command:
-
- $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
-
-There are some other branches under development. Try the following
-command and see the list of branches:
-
- $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
+ $ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
+ (Logging in to anonymous@cvs.ruby-lang.org)
+ CVS password: anonymous
+ $ cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:/src checkout ruby
* Ruby home-page
@@ -70,7 +62,7 @@ This is what you need to do to compile and install Ruby:
2. Run ./configure, which will generate config.h and Makefile.
- 3. Edit defines.h if you need. Usually this step will not be needed.
+ 3. Edit defines.h if you need. Probably this step will not need.
4. Remove comment mark(#) before the module names from ext/Setup (or
add module names if not present), if you want to link modules
diff --git a/README.EXT b/README.EXT
index e5d39911ca..e5c4203832 100644
--- a/README.EXT
+++ b/README.EXT
@@ -295,15 +295,6 @@ To define alias to the method,
void rb_define_alias(VALUE module, const char* new, const char* old);
-To define and undefine the `allocate' class method,
-
- void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
- void rb_undef_alloc_func(VALUE klass);
-
-func have to take the klass as the argument and return a newly
-allocated instance. This instance should be empty as possible,
-without any expensive (including external) resources.
-
2.1.3 Constant definition
We have 2 functions to define constants:
@@ -330,30 +321,17 @@ of the innermost method (which is defined by Ruby) can be accessed.
2.2.2 ID or Symbol
-You can invoke methods directly, without parsing the string. First I need
-to explain about ID. ID is the integer number to represent Ruby's
-identifiers such as variable names. The Ruby data type corresponding to ID
-is Symbol. It can be accessed from Ruby in the form:
+You can invoke methods directly, without parsing the string. First I
+need to explain about symbols (whose data type is ID). ID is the
+integer number to represent Ruby's identifiers such as variable names.
+It can be accessed from Ruby in the form:
:Identifier
-You can get the ID value from a string within C code by using
+You can get the symbol value from a string within C code by using
rb_intern(const char *name)
-You can retrieve ID from Ruby object (Symbol or String) given as an
-argument by using
-
- rb_to_id(VALUE symbol)
-
-You can convert C ID to Ruby Symbol by using
-
- VALUE ID2SYM(ID id)
-
-and to convert Ruby Symbol object to ID, use
-
- ID SYM2ID(VALUE symbol)
-
2.2.3 Invoke Ruby method from C
To invoke methods directly, you can use the function below
@@ -634,14 +612,8 @@ various conditions.
The value of the variables below will affect the Makefile.
- $CFLAGS: included in CFLAGS make variable (such as -O)
- $CPPFLAGS: included in CPPFLAGS make variable (such as -I, -D)
+ $CFLAGS: included in CFLAGS make variable (such as -I)
$LDFLAGS: included in LDFLAGS make variable (such as -L)
- $objs: list of object file names
-
-In normal, object files list is automatically generated by searching
-source files, but you need directs them explicitly if any sources will
-be generated while building.
If a compilation condition is not fulfilled, you should not call
``create_makefile''. The Makefile will not generated, compilation will
@@ -799,9 +771,7 @@ NUM2INT(value)
INT2NUM(i)
NUM2DBL(value)
rb_float_new(f)
-StringValue(value)
-StringValuePtr(value)
-StringValueCStr(value)
+STR2CSTR(value)
rb_str_new2(s)
** defining class/module
@@ -1035,11 +1005,6 @@ Appendix C. Functions Available in extconf.rb
These functions are available in extconf.rb:
- have_macro(macro, headers)
-
-Checks whether macro is defined with header. Returns true if the macro
-is defined.
-
have_library(lib, func)
Checks whether the library exists, containing the specified function.
@@ -1056,61 +1021,20 @@ Checks whether func exists with header. Returns true if the function
exists. To check functions in an additional library, you need to
check that library first using have_library().
- have_var(var, header)
-
-Checks whether var exists with header. Returns true if the variable
-exists. To check variables in an additional library, you need to
-check that library first using have_library().
-
have_header(header)
Checks whether header exists. Returns true if the header file exists.
- find_header(header, path...)
-
-Checks whether header exists in path. Returns true if the header file
-exists.
-
- have_struct_member(type, member, header)
-
-Checks whether type has member with header. Returns true if the type
-is defined and has the member.
-
- have_type(type, header, opt)
-
-Checks whether type is defined with header. Returns true if the type
-is defined.
-
- check_sizeof(type, header)
-
-Checks the size of type in char with header. Returns the size if the
-type is defined, otherwise nil.
-
create_makefile(target)
Generates the Makefile for the extension library. If you don't invoke
this method, the compilation will not be done.
- find_executable(bin, path)
-
-Finds command in path, which is File::PATH_SEPARATOR-separated list of
-directories. If path is nil or omitted, environment varialbe PATH
-will be used. Returns the path name of the command if it is found,
-otherwise nil.
-
with_config(withval[, default=nil])
Parses the command line options and returns the value specified by
--with-<withval>.
- enable_config(config, *defaults)
- disable_config(config, *defaults)
-
-Parses the command line options for boolean. Returns true if
---enable-<config> is given, or false if --disable-<config> is given.
-Otherwise, yields defaults to the given block and returns the result
-if it is called with a block, or returns defaults.
-
dir_config(target[, default_dir])
dir_config(target[, default_include, default_lib])
@@ -1120,12 +1044,6 @@ to $CFLAGS and/or $LDFLAGS. --with-<target>-dir=/path is equivalent to
--with-<target>-include=/path/include --with-<target>-lib=/path/lib.
Returns an array of the added directories ([include_dir, lib_dir]).
- pkg_config(pkg)
-
-Obtains the information of pkg by pkg-config command. The actual
-command name can be overriden by --with-pkg-config command line
-option.
-
/*
* Local variables:
* fill-column: 70
diff --git a/README.EXT.ja b/README.EXT.ja
index 30c4d520ba..7a4cb5df2a 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -331,17 +331,6 @@ private¥á¥½¥Ã¥É¤È¤Ï´Ø¿ô·Á¼°¤Ç¤·¤«¸Æ¤Ó½Ð¤¹¤³¤È¤Î½ÐÍè¤Ê¤¤¥á¥½¥Ã
void rb_define_alias(VALUE module, const char* new, const char* old);
-¥¯¥é¥¹¥á¥½¥Ã¥Éallocate¤òÄêµÁ¤·¤¿¤êºï½ü¤·¤¿¤ê¤¹¤ë¤¿¤á¤Î´Ø¿ô¤Ï
-°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
-
- void rb_define_alloc_func(VALUE klass, VALUE (*func)(VALUE klass));
- void rb_undef_alloc_func(VALUE klass);
-
-func¤Ï¥¯¥é¥¹¤ò°ú¿ô¤È¤·¤Æ¼õ¤±¼è¤Ã¤Æ¡¢¿·¤·¤¯³ä¤êÅö¤Æ¤é¤ì¤¿¥¤¥ó
-¥¹¥¿¥ó¥¹¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£¤³¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ï¡¢³°Éô¥ê
-¥½¡¼¥¹¤Ê¤É¤ò´Þ¤Þ¤Ê¤¤¡¢¤Ç¤­¤ë¤À¤±¡Ö¶õ¡×¤Î¤Þ¤Þ¤Ë¤·¤Æ¤ª¤¤¤¿¤Û¤¦
-¤¬¤è¤¤¤Ç¤·¤ç¤¦¡£
-
2.1.3 Äê¿ôÄêµÁ
³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤¬É¬ÍפÊÄê¿ô¤Ï¤¢¤é¤«¤¸¤áÄêµÁ¤·¤Æ¤ª¤¤¤¿Êý¤¬Îɤ¤
@@ -380,8 +369,7 @@ C¤«¤éʸ»úÎó¤ò·Ðͳ¤»¤º¤ËRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤â¤Ç¤­¤Þ
¤¹¡¥¤½¤ÎÁ°¤Ë¡¤Ruby¥¤¥ó¥¿¥×¥ê¥¿Æâ¤Ç¥á¥½¥Ã¥É¤äÊÑ¿ô̾¤ò»ØÄꤹ¤ë
»þ¤Ë»È¤ï¤ì¤Æ¤¤¤ëID¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤ª¤­¤Þ¤·¤ç¤¦¡¥
-ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤Ç¤ÏID¤ËÂбþ¤¹¤ë
-¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¥·¥ó¥Ü¥ë(Symbol)¤¬¤¢¤ê¡¤
+ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤ÎÃæ¤Ç¤Ï
:¼±ÊÌ»Ò
@@ -394,14 +382,6 @@ ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤Ç¤ÏID¤ËÂбþ¤¹¤ë
rb_to_id(VALUE symbol)
-ID¤«¤é¥·¥ó¥Ü¥ë¤òÆÀ¤ë¤¿¤á¤Ë¤Ï°Ê²¼¤Î¥Þ¥¯¥í¤ò»È¤¤¤Þ¤¹¡¥
-
- VALUE ID2SYM(ID id)
-
-¥·¥ó¥Ü¥ë¤«¤éID¤òÆÀ¤ë¤¿¤á¤Ë¤Ï°Ê²¼¤Î¥Þ¥¯¥í¤ò»È¤¤¤Þ¤¹¡¥
-
- ID SYM2ID(VALUE symbol)
-
2.2.3 C¤«¤éRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹
C¤«¤éʸ»úÎó¤ò·Ðͳ¤»¤º¤ËRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤¿¤á¤Ë¤Ï°Ê²¼
@@ -730,14 +710,8 @@ Makefile¤òºî¤ë¾ì¹ç¤Î¿÷·¿¤Ë¤Ê¤ëextconf.rb¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤òºî¤ê
°Ê²¼¤ÎÊÑ¿ô¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥
- $CFLAGS: ¥³¥ó¥Ñ¥¤¥ë»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-O¤Ê¤É)
- $CPPFLAGS: ¥×¥ê¥×¥í¥»¥Ã¥µ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-I¤ä-D¤Ê¤É)
+ $CFLAGS: ¥³¥ó¥Ñ¥¤¥ë»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-I¤Ê¤É)
$LDFLAGS: ¥ê¥ó¥¯»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-L¤Ê¤É)
- $objs: ¥ê¥ó¥¯¤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë̾¤Î¥ê¥¹¥È
-
-¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤Ï¡¢Ä̾ï¤Ï¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò¸¡º÷¤·
-¤Æ¼«Æ°Åª¤ËÀ¸À®¤µ¤ì¤Þ¤¹¤¬¡¢make¤ÎÅÓÃæ¤Ç¥½¡¼¥¹¤òÀ¸À®¤¹¤ë¤è¤¦¤Ê
-¾ì¹ç¤ÏÌÀ¼¨Åª¤Ë»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
¥é¥¤¥Ö¥é¥ê¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¾ò·ï¤¬Â·¤ï¤º¡¤¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥³¥ó
¥Ñ¥¤¥ë¤·¤Ê¤¤»þ¤Ë¤Ïcreate_makefile¤ò¸Æ¤Ð¤Ê¤±¤ì¤ÐMakefile¤ÏÀ¸
@@ -917,9 +891,7 @@ NUM2INT(value)
INT2NUM(i)
NUM2DBL(value)
rb_float_new(f)
-StringValue(value)
-StringValuePtr(value)
-StringValueCStr(value)
+STR2CSTR(value)
rb_str_new2(s)
** ¥¯¥é¥¹/¥â¥¸¥å¡¼¥ëÄêµÁ
@@ -1151,12 +1123,6 @@ Appendix C. extconf.rb¤Ç»È¤¨¤ë´Ø¿ô¤¿¤Á
extconf.rb¤ÎÃæ¤Ç¤ÏÍøÍѲÄǽ¤Ê¥³¥ó¥Ñ¥¤¥ë¾ò·ï¥Á¥§¥Ã¥¯¤Î´Ø¿ô¤Ï°Ê
²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡¥
-have_macro(macro, headers)
-
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¥Þ¥¯¥ímacro¤¬ÄêµÁ¤µ
- ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¥Á¥§¥Ã¥¯¤¹¤ë¡¥¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë»þtrue
- ¤òÊÖ¤¹¡¥
-
have_library(lib, func)
´Ø¿ôfunc¤òÄêµÁ¤·¤Æ¤¤¤ë¥é¥¤¥Ö¥é¥êlib¤Î¸ºß¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡¥
@@ -1174,67 +1140,21 @@ have_func(func, header)
¤ë»þ¤Ë¤ÏÀè¤Ëhave_library¤Ç¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤ª¤¯
»ö¡¥´Ø¿ô¤¬Â¸ºß¤¹¤ë»þtrue¤òÊÖ¤¹¡¥
-have_var(var, header)
-
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤ÆÊÑ¿ôvar¤Î¸ºß¤ò¥Á¥§¥Ã
- ¥¯¤¹¤ë¡¥var¤¬É¸½à¤Ç¤Ï¥ê¥ó¥¯¤µ¤ì¤Ê¤¤¥é¥¤¥Ö¥é¥êÆâ¤Î¤â¤Î¤Ç¤¢
- ¤ë»þ¤Ë¤ÏÀè¤Ëhave_library¤Ç¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤ª¤¯
- »ö¡¥ÊÑ¿ô¤¬Â¸ºß¤¹¤ë»þtrue¤òÊÖ¤¹¡¥
-
have_header(header)
¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Î¸ºß¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡¥¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹
¤ë»þtrue¤òÊÖ¤¹¡¥
-find_header(header, path...)
-
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤Î¸ºß¤ò -Ipath ¤òÄɲ䷤ʤ¬¤é¥Á¥§¥Ã¥¯
- ¤¹¤ë¡¥¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬¸«ÉÕ¤«¤Ã¤¿»þ¡¤true¤òÊÖ¤¹¡¥
-
-have_struct_member(type, member, header)
-
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ·¿type¤Ë¥á¥ó¥Ðmember
- ¤¬Â¸ºß¤¹¤ë¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡¥type¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Æ¡¤member¤ò
- »ý¤Ä¤¹¤ë»þtrue¤òÊÖ¤¹¡¥
-
-have_type(type, header, opt)
-
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ·¿type¤¬Â¸ºß¤¹¤ë¤«¤ò
- ¥Á¥§¥Ã¥¯¤¹¤ë¡¥type¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë»þtrue¤òÊÖ¤¹¡¥
-
-check_sizeof(type, header)
-
- ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ·¿type¤Îcharñ°Ì¥µ¥¤
- ¥º¤òÄ´¤Ù¤ë¡¥type¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë»þ¤½¤Î¥µ¥¤¥º¤òÊÖ¤¹¡¥ÄêµÁ¤µ
- ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤Ïnil¤òÊÖ¤¹¡¥
-
create_makefile(target)
³ÈÄ¥¥é¥¤¥Ö¥é¥êÍѤÎMakefile¤òÀ¸À®¤¹¤ë¡¥¤³¤Î´Ø¿ô¤ò¸Æ¤Ð¤Ê¤±¤ì
¤Ð¤½¤Î¥é¥¤¥Ö¥é¥ê¤Ï¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Ê¤¤¡¥target¤Ï¥â¥¸¥å¡¼¥ë̾
¤òɽ¤¹¡¥
-find_executable(command, path)
-
- ¥³¥Þ¥ó¥Écommand¤òFile::PATH_SEPARATOR¤Ç¶èÀÚ¤é¤ì¤¿¥Ñ¥¹Ì¾¤Î
- ¥ê¥¹¥Èpath¤«¤éõ¤¹¡¥path¤¬nil¤Þ¤¿¤Ï¾Êά¤µ¤ì¤¿¾ì¹ç¤Ï¡¤´Ä¶­
- ÊÑ¿ôPATH¤ÎÃͤò»ÈÍѤ¹¤ë¡¥¼Â¹Ô²Äǽ¤Ê¥³¥Þ¥ó¥É¤¬¸«¤Ä¤«¤Ã¤¿¾ì¹ç
- ¤Ï¥Ñ¥¹¤ò´Þ¤à¥Õ¥¡¥¤¥ë̾¡¤¸«¤Ä¤«¤é¤Ê¤«¤Ã¤¿¾ì¹ç¤Ïnil¤òÊÖ¤¹¡¥
-
with_config(withval[, default=nil])
¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Î--with-<withval>¤Ç»ØÄꤵ¤ì¤¿¥ª¥×¥·¥ç¥óÃͤòÆÀ¤ë¡¥
-enable_config(config, *defaults)
-disable_config(config, *defaults)
-
- ¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Î--enable-<config>¤Þ¤¿¤Ï
- --disable-<config>¤Ç»ØÄꤵ¤ì¤¿¿¿µ¶ÃͤòÆÀ¤ë¡¥
- --enable-<config>¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ïtrue¡¤
- --disable-<config>¤¬»ØÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ïfalse¤òÊÖ¤¹¡¥
- ¤É¤Á¤é¤â»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¤¥Ö¥í¥Ã¥¯¤Ä¤­¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï
- *defaults¤òyield¤·¤¿·ë²Ì¡¤¥Ö¥í¥Ã¥¯¤Ê¤·¤Ê¤é*defaults¤òÊÖ¤¹¡¥
-
dir_config(target[, default_dir])
dir_config(target[, default_include, default_lib])
@@ -1245,12 +1165,6 @@ dir_config(target[, default_include, default_lib])
¤ÈÅù²Á¤Ç¤¢¤ë¡¥Äɲ䵤줿 include ¥Ç¥£¥ì¥¯¥È¥ê¤È lib ¥Ç¥£¥ì¥¯¥È¥ê¤Î
ÇÛÎó¤òÊÖ¤¹¡¥ ([include_dir, lib_dir])
-pkg_config(pkg)
-
- pkg-config¥³¥Þ¥ó¥É¤«¤é¥Ñ¥Ã¥±¡¼¥¸pkg¤Î¾ðÊó¤òÆÀ¤ë¡¥
- pkg-config¤Î¼ÂºÝ¤Î¥³¥Þ¥ó¥É̾¤Ï¡¤--with-pkg-config¥³¥Þ¥ó¥É
- ¥é¥¤¥ó¥ª¥×¥·¥ç¥ó¤Ç»ØÄê²Äǽ¡¥
-
/*
* Local variables:
* fill-column: 60
diff --git a/README.ja b/README.ja
index df8cfc03f4..fc502dd440 100644
--- a/README.ja
+++ b/README.ja
@@ -26,25 +26,18 @@ Ruby¤Ï¥Æ¥­¥¹¥È½èÍý´Ø·¸¤ÎǽÎϤʤɤËÍ¥¤ì¡¤Perl¤ÈƱ¤¸¤¯¤é¤¤¶¯ÎÏ
* Æþ¼êË¡
-** FTP¤Ç
+** ftp¤Ç
°Ê²¼¤Î¾ì½ê¤Ë¤ª¤¤¤Æ¤¢¤ê¤Þ¤¹¡¥
ftp://ftp.ruby-lang.org/pub/ruby/
-** Subversion¤Ç
+** CVS¤Ç
-ËÜ¥Ö¥é¥ó¥Á¤ÎRuby¤ÎºÇ¿·¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡¥
-
- $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6/
-
-³«È¯Àèü¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡¥
-
- $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
-
-¾¤Ë³«È¯Ãæ¤Î¥Ö¥é¥ó¥Á¤Î°ìÍ÷¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¸«¤é¤ì¤Þ¤¹¡¥
-
- $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
+ $ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
+ (Logging in to anonymous@cvs.ruby-lang.org)
+ CVS password: anonymous
+ $ cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:src checkout ruby
* ¥Û¡¼¥à¥Ú¡¼¥¸
diff --git a/array.c b/array.c
index d456373fe4..4ba3f7390d 100644
--- a/array.c
+++ b/array.c
@@ -2,8 +2,8 @@
array.c -
- $Author: akr $
- $Date: 2006/06/24 14:53:36 $
+ $Author$
+ $Date$
created at: Fri Aug 6 09:46:12 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -188,8 +188,6 @@ rb_ary_new4(n, elts)
if (n > 0 && elts) {
MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);
}
-
- /* This assignment to len will be moved to the above "if" block in Ruby 1.9 */
RARRAY(ary)->len = n;
return ary;
@@ -336,6 +334,9 @@ rb_ary_s_create(argc, argv, klass)
{
VALUE ary = ary_alloc(klass);
+ if (argc < 0) {
+ rb_raise(rb_eArgError, "negative number of arguments");
+ }
if (argc > 0) {
RARRAY(ary)->ptr = ALLOC_N(VALUE, argc);
MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
@@ -551,6 +552,9 @@ rb_ary_unshift_m(argc, argv, ary)
{
long len = RARRAY(ary)->len;
+ if (argc < 0) {
+ rb_raise(rb_eArgError, "negative number of arguments");
+ }
if (argc == 0) return ary;
/* make rooms by setting the last item */
@@ -717,16 +721,12 @@ rb_ary_at(ary, pos)
/*
* call-seq:
* array.first -> obj or nil
- * array.first(n) -> an_array
- *
- * Returns the first element, or the first +n+ elements, of the array.
- * If the array is empty, the first form returns <code>nil</code>, and the
- * second form returns an empty array.
- *
+ *
+ * Returns the first element of the array. If the array is empty,
+ * returns <code>nil</code>.
+ *
* a = [ "q", "r", "s", "t" ]
- * a.first #=> "q"
- * a.first(1) #=> ["q"]
- * a.first(3) #=> ["q", "r", "s"]
+ * a.first #=> "q"
*/
static VALUE
@@ -903,7 +903,7 @@ rb_ary_rindex(ary, val)
* array.indexes( i1, i2, ... iN ) -> an_array
* array.indices( i1, i2, ... iN ) -> an_array
*
- * Deprecated; use <code>Array#values_at</code>.
+ * Deprecated; use <code>Array#select</code>.
*/
static VALUE
@@ -1090,7 +1090,6 @@ rb_ary_insert(argc, argv, ary)
{
long pos;
- if (argc == 1) return ary;
if (argc < 1) {
rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
}
@@ -1098,9 +1097,11 @@ rb_ary_insert(argc, argv, ary)
if (pos == -1) {
pos = RARRAY(ary)->len;
}
- if (pos < 0) {
+ else if (pos < 0) {
pos++;
}
+
+ if (argc == 1) return ary;
rb_ary_splice(ary, pos, 0, rb_ary_new4(argc - 1, argv + 1));
return ary;
}
@@ -1589,8 +1590,8 @@ sort_2(ap, bp, data)
if ((long)a < (long)b) return -1;
return 0;
}
- if (TYPE(a) == T_STRING) {
- if (TYPE(b) == T_STRING) return rb_str_cmp(a, b);
+ if (TYPE(a) == T_STRING && TYPE(b) == T_STRING) {
+ return rb_str_cmp(a, b);
}
retval = rb_funcall(a, id_cmp, 1, b);
@@ -1804,12 +1805,17 @@ rb_ary_values_at(argc, argv, ary)
*/
static VALUE
-rb_ary_select(ary)
+rb_ary_select(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
VALUE result;
long i;
+ if (argc > 0) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
+ }
result = rb_ary_new2(RARRAY(ary)->len);
for (i = 0; i < RARRAY(ary)->len; i++) {
if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
@@ -2129,7 +2135,7 @@ rb_ary_transpose(ary)
}
}
else if (elen != RARRAY(tmp)->len) {
- rb_raise(rb_eIndexError, "element size differs (%d should be %d)",
+ rb_raise(rb_eIndexError, "element size differ (%d should be %d)",
RARRAY(tmp)->len, elen);
}
for (j=0; j<elen; j++) {
@@ -2225,7 +2231,7 @@ rb_ary_fill(argc, argv, ary)
VALUE ary;
{
VALUE item, arg1, arg2;
- long beg = 0, end = 0, len = 0;
+ long beg, end, len;
VALUE *p, *pend;
int block_p = Qfalse;
@@ -2263,7 +2269,9 @@ rb_ary_fill(argc, argv, ary)
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
RARRAY(ary)->aux.capa = end;
}
- rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
+ if (beg > RARRAY(ary)->len) {
+ rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
+ }
RARRAY(ary)->len = end;
}
@@ -2640,8 +2648,7 @@ static VALUE
rb_ary_diff(ary1, ary2)
VALUE ary1, ary2;
{
- VALUE ary3;
- volatile VALUE hash;
+ VALUE ary3, hash;
long i;
hash = ary_make_hash(to_ary(ary2), 0);
@@ -3016,7 +3023,7 @@ Init_Array()
rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0);
rb_define_method(rb_cArray, "map", rb_ary_collect, 0);
rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
- rb_define_method(rb_cArray, "select", rb_ary_select, 0);
+ rb_define_method(rb_cArray, "select", rb_ary_select, -1);
rb_define_method(rb_cArray, "values_at", rb_ary_values_at, -1);
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, 1);
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index 030a799e99..d04c649fa5 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -1,7 +1,6 @@
# -*- makefile -*-
SHELL = $(COMSPEC)
-MKFILES = Makefile
#### Start of system configuration section. ####
OS = bccwin32
@@ -57,7 +56,6 @@ AR = tlib
PURIFY =
AUTOCONF = autoconf
-RM = $(srcdir:/=\)\win32\rm.bat
!if !defined(PROCESSOR_ARCHITECTURE)
PROCESSOR_ARCHITECTURE = x86
@@ -93,28 +91,14 @@ exec_prefix = $(prefix)
!ifndef libdir
libdir = $(exec_prefix)/lib
!endif
-!if !defined(datadir)
-datadir = /share
+!ifndef DESTDIR
+DESTDIR = $(prefix)
!endif
-!ifndef EXTOUT
-EXTOUT = .ext
-!endif
-!ifndef RIDATADIR
-RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
-!endif
-!ifndef TESTUI
-TESTUI = console
-!endif
-!ifndef TESTS
-TESTS =
-!endif
-!ifndef RDOCTARGET
-RDOCTARGET = install-nodoc
-!endif
-
-OUTFLAG = -o
!ifndef CFLAGS
-CFLAGS = -q -tWR -tWC $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
+CFLAGS = -q $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
+!endif
+!ifndef CPPFLAGS
+CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)missing
!endif
!ifndef LDFLAGS
LDFLAGS = -S:$(STACK)
@@ -125,17 +109,14 @@ RFLAGS = $(iconinc)
!ifndef EXTLIBS
EXTLIBS =
!endif
-!ifndef MEMLIB
-MEMLIB =
-!endif
-LIBS = $(MEMLIB) cw32i.lib import32.lib ws2_32.lib $(EXTLIBS)
+LIBS = cw32.lib import32.lib ws2_32.lib $(EXTLIBS)
MISSING = acosh.obj crypt.obj erf.obj win32.obj
!ifndef STACK
STACK = 0x2000000
!endif
-XCFLAGS = -DRUBY_EXPORT -I. -I$(srcdir) -I$(srcdir)missing
+XCFLAGS = -DRUBY_EXPORT
ARFLAGS = /a
LD = ilink32 -q -Gn
@@ -154,7 +135,6 @@ PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_SO_NAME).def
MINIRUBY = .\miniruby$(EXEEXT)
-RUNRUBY = .\ruby$(EXEEXT) "$(srcdir)runruby.rb" --extout="$(EXTOUT)" --
ORGLIBPATH = $(LIB)
@@ -165,46 +145,70 @@ LIBRUBY_SO = $(RUBY_SO_NAME).dll
LIBRUBY = $(RUBY_SO_NAME).lib
LIBRUBYARG = $(LIBRUBY)
-PREP = miniruby$(EXEEXT)
-
-OBJEXT = obj
-
-WINMAINOBJ = winmain.$(OBJEXT)
-MINIOBJS = dmydln.$(OBJEXT)
-
-.path.c = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
-.path.h = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
-.path.y = $(srcdir)
-.path. = $(srcdir)
-
-.c.obj:
- $(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)
-
-.rc.res:
- $(RC) $(RFLAGS) -I. -I$(<D). $(iconinc) -I$(srcdir)win32 $(RFLAGS) -fo$@ $(<:/=\)
-
-.y.c:
- $(YACC) $(YFLAGS) $(<:\=/)
- sed -e "s!^ *extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $(@F)
- @del y.tab.c
-
-all: $(srcdir)bcc32/Makefile.sub $(srcdir)common.mk
+!ifndef EXTOBJS
+EXTOBJS = dmyext.obj
+!endif
+
+MAINOBJ = main.obj
+WINMAINOBJ = winmain.obj
+
+OBJS = array.obj \
+ bignum.obj \
+ class.obj \
+ compar.obj \
+ dir.obj \
+ dln.obj \
+ enum.obj \
+ error.obj \
+ eval.obj \
+ file.obj \
+ gc.obj \
+ hash.obj \
+ inits.obj \
+ io.obj \
+ marshal.obj \
+ math.obj \
+ numeric.obj \
+ object.obj \
+ pack.obj \
+ parse.obj \
+ prec.obj \
+ process.obj \
+ random.obj \
+ range.obj \
+ re.obj \
+ regex.obj \
+ ruby.obj \
+ signal.obj \
+ sprintf.obj \
+ st.obj \
+ string.obj \
+ struct.obj \
+ time.obj \
+ util.obj \
+ variable.obj \
+ version.obj \
+ $(MISSING)
+
+SCRIPT_ARGS = "--dest-dir=$(DESTDIR)" \
+ "--make=$(MAKE)" \
+ "--mflags=$(MFLAGS)" \
+ "--make-flags=$(MAKEFLAGS)"
+
+all: miniruby$(EXEEXT) rbconfig.rb \
+ $(LIBRUBY) $(MISCLIBS)
+ .\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb --extstatic=$(EXTSTATIC) $(SCRIPT_ARGS)
ruby: $(PROGRAM)
rubyw: $(WPROGRAM)
+lib: $(LIBRUBY)
+dll: $(LIBRUBY_SO)
-!include $(srcdir)/common.mk
-
-PHONY: Makefile
-
-CONFIG_H = ./.config.h.time
-
-config: config.status
-
-config.status: $(CONFIG_H)
+config: config.h config.status
-$(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
- @$(srcdir:/=\)win32\ifchange.bat config.h &&|
+config.h:
+ @echo Creating $(@:.\=)
+ @type > $@ &&|
\#define HAVE_SYS_TYPES_H 1
\#define HAVE_SYS_STAT_H 1
\#define HAVE_STDLIB_H 1
@@ -225,15 +229,11 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#define TOKEN_PASTE(x,y) x\#\#y
\#define HAVE_STDARG_PROTOTYPES 1
\#define NORETURN(x) x
-\#define RUBY_EXTERN extern __declspec(dllimport)
\#define HAVE_DECL_SYS_NERR 1
\#define HAVE_LIMITS_H 1
\#define HAVE_FCNTL_H 1
\#define HAVE_UTIME_H 1
\#define HAVE_FLOAT_H 1
-\#define rb_uid_t uid_t
-\#define rb_gid_t gid_t
-\#define rb_pid_t int
\#define HAVE_STRUCT_STAT_ST_RDEV 1
\#define HAVE_ST_RDEV 1
\#define GETGROUPS_T int
@@ -253,14 +253,12 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#define HAVE_STRTOUL 1
\#define HAVE_ISNAN 1
\#define HAVE_FINITE 1
-\#define HAVE_HYPOT 1
\#define HAVE_FMOD 1
\#define HAVE_WAITPID 1
\#define HAVE_FSYNC 1
\#define HAVE_GETCWD 1
\#define HAVE_CHSIZE 1
\#define HAVE_TIMES 1
-\#define HAVE_FCNTL 1
\#define HAVE_LINK 1
\#define HAVE_TELLDIR 1
\#define HAVE_SEEKDIR 1
@@ -275,6 +273,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#define STACK_GROW_DIRECTION -1
\#define DEFAULT_KCODE KCODE_NONE
\#define DLEXT ".so"
+\#define DLEXT2 ".dll"
\#define RUBY_LIB "/lib/ruby/$(MAJOR).$(MINOR)"
\#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
\#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)"
@@ -282,15 +281,12 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
\#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
|
- @exit > $@
-config.status: $(MKFILES) $(srcdir)bcc32/Makefile.sub $(srcdir)common.mk
+config.status: Makefile $(srcdir)bcc32/Makefile.sub
@echo Creating $@
@type > $@ &&|
# Generated automatically by Makefile.sub.
s,@SHELL@,$$(COMSPEC),;t t
-s,@BUILD_FILE_SEPARATOR@,\,;t t
-s,@PATH_SEPARATOR@,;,;t t
s,@CFLAGS@,$(CFLAGS),;t t
s,@CPPFLAGS@,$(CPPFLAGS),;t t
s,@CXXFLAGS@,$(CXXFLAGS),;t t
@@ -335,10 +331,6 @@ s,@AR@,$(AR),;t t
s,@ARFLAGS@,$(ARFLAGS) ,;t t
s,@LN_S@,$(LN_S),;t t
s,@SET_MAKE@,$(SET_MAKE),;t t
-s,@CP@,copy > nul,;t t
-s,@INSTALL@,copy > nul,;t t
-s,@INSTALL_PROG@,$$(INSTALL),;t t
-s,@INSTALL_DATA@,$$(INSTALL),;t t
s,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj,;t t
s,@ALLOCA@,$(ALLOCA),;t t
s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t
@@ -352,16 +344,12 @@ s,@STATIC@,$(STATIC),;t t
s,@CCDLFLAGS@,,;t t
s,@LDSHARED@,$(LDSHARED),;t t
s,@DLEXT@,so,;t t
+s,@DLEXT2@,dll,;t t
s,@LIBEXT@,lib,;t t
s,@STRIP@,$(STRIP),;t t
s,@EXTSTATIC@,$(EXTSTATIC),;t t
s,@setup@,Setup,;t t
s,@MINIRUBY@,$(MINIRUBY),;t t
-s,@PREP@,miniruby$(EXEEXT),;t t
-s,@RUNRUBY@,$(RUNRUBY),;t t
-s,@EXTOUT@,$(EXTOUT),;t t
-s,@ARCHFILE@,,;t t
-s,@RDOCTARGET@,,;t t
s,@LIBRUBY_LDSHARED@,$$(LDSHARED),;t t
s,@LIBRUBY_DLDFLAGS@,-Gi $$(DLDFLAGS),;t t
s,@RUBY_INSTALL_NAME@,$(RUBY_INSTALL_NAME),;t t
@@ -378,17 +366,16 @@ s,@LIBRUBYARG_SHARED@,$$(LIBRUBY),;t t
s,@SOLIBS@,$(SOLIBS),;t t
s,@DLDLIBS@,$(DLDLIBS),;t t
s,@ENABLE_SHARED@,yes,;t t
-s,@OUTFLAG@,$(OUTFLAG),;t t
+s,@OUTFLAG@,-o,;t t
s,@CPPOUTFILE@,,;t t
s,@LIBPATHFLAG@, -L"%s",;t t
s,@RPATHFLAG@,,;t t
s,@LIBARG@,%s.lib,;t t
s,@LINK_SO@,$$(LDSHARED) $$(DLDFLAGS) $$(LIBPATH) $$(OBJS), $$(@:/=\), nul, $$(LIBS) $$(LOCAL_LIBS), $$(DEFFILE), $$(RESFILE),;t t
-s,@COMPILE_C@,$$(CC) $$(INCFLAGS) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
-s,@COMPILE_CXX@,$$(CXX) $$(INCFLAGS) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;t t
-s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
-s,@RULE_SUBST@,{.;$$(VPATH)}%s,;t t
-s,@COMMON_LIBS@,m advapi32 avicap32 avifil32 cap comctl32 comdlg32 dlcapi gdi32 glu32 imagehlp imm32 inetmib1 kernel32 loadperf lsapi32 lz32 mapi32 mgmtapi mpr msacm32 msvfw32 nddeapi netapi32 ole32 oleaut32 oledlg olepro32 opengl32 pdh pkpd32 rasapi32 rasdlg rassapi rpcrt4 setupapi shell32 shfolder snmpapi sporder tapi32 url user32 vdmdbg version win32spl winmm wintrust wsock32,;t t
+s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
+s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;t t
+s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: .%s.%s:,;t t
+s,@COMMON_LIBS@,m,;t t
s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN;t t
s,@COMMON_HEADERS@,winsock2.h windows.h,;t t
s,@TRY_LINK@,$$(CC) -oconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(LIBPATH) $$(LDFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS),;t t
@@ -402,9 +389,9 @@ s,@srcdir@,$(srcdir),;t t
s,@top_srcdir@,$(srcdir),;t t
|
-miniruby$(EXEEXT):
+miniruby$(EXEEXT): $(LIBRUBY_A) $(MAINOBJ) dmyext.obj
@echo $(LIBS)
- $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(MINIOBJS),$@,nul,$(LIBRUBY_A) $(LIBS)
+ $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) dmyext.obj,$@,nul,$(LIBRUBY_A) $(LIBS)
$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res
$(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBY_INSTALL_NAME).res
@@ -412,21 +399,90 @@ $(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res
$(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(RUBYW_INSTALL_NAME).res
$(LD) $(LDFLAGS) $(WLDFLAGS) $(MAINOBJ) $(WINMAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBYW_INSTALL_NAME).res
-$(LIBRUBY_A): $(OBJS) $(DMYEXT)
+$(LIBRUBY_A): $(OBJS) dmyext.obj
@-if exist $@ del $@
- $(AR) $(ARFLAGS) "$@" $(OBJS) $(DMYEXT)
+ $(AR) $(ARFLAGS) "$@" $(OBJS) dmyext.obj
# $(LIBRUBY): $(LIBRUBY_SO)
# implib $@ $(LIBRUBY_SO)
-$(LIBRUBY_SO): $(LIBRUBY_A) $(DLDOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
- @echo $(DLDOBJS)
- $(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) $(DLDOBJS:/=\),$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res
-
-$(LIBRUBY): $(LIBRUBY_SO)
-
-$(RUBYDEF): $(LIBRUBY_A) $(PREP)
- $(MINIRUBY) $(srcdir)bcc32/mkexports.rb -output=$@ -base=$(RUBY_SO_NAME) $(LIBRUBY_A)
+$(LIBRUBY_SO) $(LIBRUBY): $(LIBRUBY_A) $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
+ @echo $(EXTOBJS)
+ $(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) $(EXTOBJS:/=\),$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res
+
+$(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
+ $(MINIRUBY) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A)
+
+install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)instruby.rb $(SCRIPT_ARGS)
+ $(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) install
+
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)instruby.rb -n $(SCRIPT_ARGS)
+ $(MINIRUBY) $(srcdir)ext/extmk.rb -n $(SCRIPT_ARGS) install
+
+clean: clean-ext clean-local
+
+clean-local:
+ @if exist $(LIBRUBY_A) del $(LIBRUBY_A)
+ @if exist $(MAINOBJ) del $(MAINOBJ)
+ @if exist rbconfig.rb del rbconfig.rb
+ @if exist ext\extinit.c del ext\extinit.c
+ @if exist ext\extinit.obj del ext\extinit.obj
+ @if exist ext\vc*.pdb del ext\vc*.pdb
+ @if exist *.obj del *.obj
+ @if exist *.res del *.res
+ @if exist *.tds del *.tds
+ @if exist *.il? del *.il?
+
+clean-ext:
+ @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) clean
+
+distclean: distclean-ext distclean-local
+
+distclean-local: clean-local
+ @if exist Makefile del Makefile
+ @if exist config.h del config.h
+ @if exist ext\config.cache del ext\config.cache
+ @if exist config.cache del config.cache
+ @if exist config.log del config.log
+ @if exist config.status del config.status
+ @if exist *~ del *~
+ @if exist *.bak del *.bak
+ @if exist *.stackdump del *.stackdump
+ @if exist *.core del *.core
+ @if exist gmon.out del gmon.out
+ @if exist y.tab.c del y.tab.c
+ @if exist y.output del y.output
+ @if exist *.map del *.map
+ @if exist *.pdb del *.pdb
+ @if exist *.ilk del *.ilk
+ @if exist *.exp del *.exp
+ @if exist $(RUBYDEF) del $(RUBYDEF)
+ @if exist $(RUBY_INSTALL_NAME).rc del $(RUBY_INSTALL_NAME).rc
+ @if exist $(RUBYW_INSTALL_NAME).rc del $(RUBYW_INSTALL_NAME).rc
+ @if exist $(RUBY_SO_NAME).rc del $(RUBY_SO_NAME).rc
+ @if exist $(PROGRAM) del $(PROGRAM)
+ @if exist $(WPROGRAM) del $(WPROGRAM)
+ @if exist $(LIBRUBY_SO) del $(LIBRUBY_SO)
+ @if exist $(LIBRUBY) del $(LIBRUBY)
+ @if exist ext\nul if not exist ext\* rmdir ext
+ @if exist miniruby$(EXEEXT) del miniruby$(EXEEXT)
+
+distclean-ext:
+ @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) distclean
+
+realclean: distclean
+ @if exist parse.c del parse.c
+ @if exist lex.c del lex.c
+
+test: miniruby$(EXEEXT) rbconfig.rb $(PROGRAM) NUL
+ @$(MINIRUBY) $(srcdir)rubytest.rb
+
+rbconfig.rb: miniruby$(EXEEXT) config.status
+ @$(MINIRUBY) $(srcdir)mkconfig.rb -srcdir=$(srcdir) \
+ -install_name=$(RUBY_INSTALL_NAME) \
+ -so_name=$(RUBY_SO_NAME) rbconfig.rb
$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
@$(MINIRUBY) $(srcdir)win32/resource.rb \
@@ -435,56 +491,95 @@ $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
-so_name=$(RUBY_SO_NAME) \
. $(icondirs) $(srcdir)win32
-post-install-ext::
- $(MINIRUBY) -I$(srcdir)lib -rrbconfig -rfileutils \
- -e "FileUtils.rm_f(Dir[ARGV[0]+Config::CONFIG['archdir']+'/**/*.tds'])" "$(DESTDIR:\=/)"
+#config.status: $(srcdir)configure
+# $(SHELL) .config.status --recheck
-clean-local::
- @$(RM) ext\extinit.c ext\extinit.$(OBJEXT) *.tds *.il? $(RUBY_SO_NAME).lib
- @$(RM) $(RUBY_INSTALL_NAME).res $(RUBYW_INSTALL_NAME).res $(RUBY_SO_NAME).res
+.path.c = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
+.path.h = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
+.path.y = $(srcdir)
+
+.c.obj:
+ $(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)
+
+.rc.res:
+ $(RC) $(RFLAGS) -I. -I$(<D). $(iconinc) -I$(srcdir)win32 $(RFLAGS) -fo$@ $(<:/=\)
+
+.y.c:
+ $(YACC) $(YFLAGS) $(<:\=/)
+ sed -e "s!^ *extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $(@F)
+ @del y.tab.c
-distclean-local::
- @$(RM) ext\config.cache $(RBCONFIG:/=\)
- @$(RM) *.map *.pdb *.ilk *.exp $(RUBYDEF)
- @$(RM) $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc
+parse.c: parse.y
ext/extinit.obj: ext/extinit.c $(SETUP)
$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
-main.$(OBJEXT): win32.h
-array.$(OBJEXT): win32.h
-bignum.$(OBJEXT): win32.h
-class.$(OBJEXT): win32.h
-compar.$(OBJEXT): win32.h
-dir.$(OBJEXT): dir.h win32.h
-dln.$(OBJEXT): win32.h
-enum.$(OBJEXT): win32.h
-error.$(OBJEXT): win32.h
-eval.$(OBJEXT): win32.h
-file.$(OBJEXT): win32.h
-gc.$(OBJEXT): win32.h
-hash.$(OBJEXT): win32.h
-inits.$(OBJEXT): win32.h
-io.$(OBJEXT): win32.h
-marshal.$(OBJEXT): win32.h
-math.$(OBJEXT): win32.h
-numeric.$(OBJEXT): win32.h
-object.$(OBJEXT): win32.h
-pack.$(OBJEXT): win32.h
-parse.$(OBJEXT): win32.h
-process.$(OBJEXT): win32.h
-prec.$(OBJEXT): win32.h
-random.$(OBJEXT): win32.h
-range.$(OBJEXT): win32.h
-re.$(OBJEXT): win32.h
-regex.$(OBJEXT): win32.h
-ruby.$(OBJEXT): win32.h
-signal.$(OBJEXT): win32.h
-sprintf.$(OBJEXT): win32.h
-st.$(OBJEXT): win32.h
-string.$(OBJEXT): win32.h
-struct.$(OBJEXT): win32.h
-time.$(OBJEXT): win32.h
-util.$(OBJEXT): win32.h
-variable.$(OBJEXT): win32.h
-version.$(OBJEXT): win32.h
+acosh.obj: acosh.c win32.h
+alloca.obj: alloca.c win32.h
+crypt.obj: crypt.c win32.h
+dup2.obj: dup2.c win32.h
+erf.obj: erf.c win32.h
+finite.obj: finite.c win32.h
+flock.obj: flock.c win32.h
+memcmp.obj: memcmp.c win32.h
+memmove.obj: memmove.c win32.h
+mkdir.obj: mkdir.c win32.h
+vsnprintf.obj: vsnprintf.c win32.h
+strcasecmp.obj: strcasecmp.c win32.h
+strncasecmp.obj: strncasecmp.c win32.h
+strchr.obj: strchr.c win32.h
+strdup.obj: strdup.c win32.h
+strerror.obj: strerror.c win32.h
+strftime.obj: strftime.c win32.h
+strstr.obj: strstr.c win32.h
+strtod.obj: strtod.c win32.h
+strtol.obj: strtol.c win32.h
+strtoul.obj: strtoul.c win32.h
+nt.obj: nt.c win32.h
+x68.obj: x68.c win32.h
+os2.obj: os2.c win32.h
+dl_os2.obj: dl_os2.c win32.h
+
+# when I use -I., there is confliction at "OpenFile"
+# so, set . into environment varible "include"
+win32.obj: win32.c win32.h
+
+###
+array.obj: array.c ruby.h config.h defines.h intern.h missing.h util.h st.h win32.h
+bignum.obj: bignum.c ruby.h config.h defines.h intern.h missing.h win32.h
+class.obj: class.c ruby.h config.h defines.h intern.h missing.h rubysig.h node.h st.h win32.h
+compar.obj: compar.c ruby.h config.h defines.h intern.h missing.h win32.h
+dir.obj: dir.c ruby.h config.h defines.h intern.h missing.h util.h win32.h
+dln.obj: dln.c ruby.h config.h defines.h intern.h missing.h dln.h win32.h
+dmyext.obj: dmyext.c
+enum.obj: enum.c ruby.h config.h defines.h intern.h missing.h node.h util.h win32.h
+error.obj: error.c ruby.h config.h defines.h intern.h missing.h env.h st.h win32.h
+eval.obj: eval.c ruby.h config.h defines.h intern.h missing.h node.h env.h util.h rubysig.h st.h dln.h win32.h
+file.obj: file.c ruby.h config.h defines.h intern.h missing.h rubyio.h rubysig.h util.h dln.h win32.h
+gc.obj: gc.c ruby.h config.h defines.h intern.h missing.h rubysig.h st.h node.h env.h re.h regex.h win32.h
+hash.obj: hash.c ruby.h config.h defines.h intern.h missing.h st.h util.h rubysig.h win32.h
+inits.obj: inits.c ruby.h config.h defines.h intern.h missing.h win32.h
+io.obj: io.c ruby.h config.h defines.h intern.h missing.h rubyio.h rubysig.h env.h util.h win32.h
+main.obj: main.c ruby.h config.h defines.h intern.h missing.h win32.h
+marshal.obj: marshal.c ruby.h config.h defines.h intern.h missing.h rubyio.h st.h util.h win32.h
+math.obj: math.c ruby.h config.h defines.h intern.h missing.h win32.h
+numeric.obj: numeric.c ruby.h config.h defines.h intern.h missing.h win32.h
+object.obj: object.c ruby.h config.h defines.h intern.h missing.h st.h util.h win32.h
+pack.obj: pack.c ruby.h config.h defines.h intern.h missing.h win32.h
+parse.obj: parse.c ruby.h config.h defines.h intern.h missing.h env.h node.h st.h regex.h util.h lex.c win32.h
+prec.obj: prec.c ruby.h config.h defines.h intern.h missing.h win32.h
+process.obj: process.c ruby.h config.h defines.h intern.h missing.h rubysig.h st.h win32.h
+random.obj: random.c ruby.h config.h defines.h intern.h missing.h win32.h
+range.obj: range.c ruby.h config.h defines.h intern.h missing.h win32.h
+re.obj: re.c ruby.h config.h defines.h intern.h missing.h re.h regex.h win32.h
+regex.obj: regex.c config.h regex.h win32.h
+ruby.obj: ruby.c ruby.h config.h defines.h intern.h missing.h dln.h node.h util.h win32.h
+signal.obj: signal.c ruby.h config.h defines.h intern.h missing.h rubysig.h win32.h
+sprintf.obj: sprintf.c ruby.h config.h defines.h intern.h missing.h win32.h
+st.obj: st.c config.h st.h
+string.obj: string.c ruby.h config.h defines.h intern.h missing.h re.h regex.h win32.h
+struct.obj: struct.c ruby.h config.h defines.h intern.h missing.h win32.h
+time.obj: time.c ruby.h config.h defines.h intern.h missing.h win32.h
+util.obj: util.c ruby.h config.h defines.h intern.h missing.h util.h win32.h
+variable.obj: variable.c ruby.h config.h defines.h intern.h missing.h env.h node.h st.h util.h win32.h
+version.obj: version.c ruby.h config.h defines.h intern.h missing.h version.h win32.h
diff --git a/bcc32/README.bcc32 b/bcc32/README.bcc32
index c27a1261f1..a699d34a4e 100644
--- a/bcc32/README.bcc32
+++ b/bcc32/README.bcc32
@@ -6,26 +6,18 @@
(1) Borland C++ 5.0 or later.
-(2) Please set environment variable (({PATH}))
+(2) If you want to run `((%make clean%))' or `((%make distclean%))'
+ properly, you must install UNIX compatible `((%rm%))' command on
+ your ((|PATH|)).
+
+(3) Please set environment variable (({INCLUDE})), (({LIB})), (({PATH}))
to run required commands properly from the command line.
Note: building ruby requires following commands.
* make
- * bcc32
+ * bcc
* tlib
- * ilink32
-
-(3) If you want to build from CVS source, following commands are required.
- * byacc ((<URL:http://gnuwin32.sourceforge.net/packages/byacc.htm>))
- * sed ((<URL:http://gnuwin32.sourceforge.net/packages/sed.htm>))
-
-(4) We strongly recommend to build ruby on C++Builder, to link following files.
- * usebormm.lib
- * memmgr.lib
-
- RTL's internal memory manager cannot handle large memory block properly,
- so we should use borlndmm.dll instead.
- 10000.times { "" << "." * 529671; GC.start } # crash
+ * ilink
== How to compile and install
@@ -56,10 +48,6 @@
If Ruby's version is `x.y.z', the ((|<MAJOR>|)) is `x' and the ((|<MINOR>|)) is `y'.
The ((|<PLATFORM>|)) is usually `(({i586-bccwin32}))'.
-(6) Requires dynamic RTL (cc3250.dll on C++Builder5) and borlndmm.dll (If built with
- usebormm.lib) to use installed binary. These files are ordinary in bcc32's bin
- directory.
-
== Icons
Any icon files(*.ico) in the build directory, directories specified with
diff --git a/bcc32/configure.bat b/bcc32/configure.bat
index 123a3f23c8..449b6e25b5 100755..100644
--- a/bcc32/configure.bat
+++ b/bcc32/configure.bat
@@ -8,85 +8,25 @@ echo>> ~tmp~.mak conf = %0
echo>> ~tmp~.mak $(conf:\=/): nul
echo>> ~tmp~.mak @del ~tmp~.mak
echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
+echo>> ~tmp~.mak bcc32dir="$(@D)" \
:loop
if "%1" == "" goto :end
-if "%1" == "--prefix" goto :prefix
if "%1" == "--srcdir" goto :srcdir
if "%1" == "srcdir" goto :srcdir
if "%1" == "--target" goto :target
if "%1" == "target" goto :target
-if "%1" == "--with-static-linked-ext" goto :extstatic
-if "%1" == "--program-suffix" goto :suffix
-if "%1" == "--program-name" goto :progname
-if "%1" == "--enable-install-doc" goto :enable-rdoc
-if "%1" == "--disable-install-doc" goto :disable-rdoc
-if "%1" == "--extout" goto :extout
-if "%1" == "-h" goto :help
-if "%1" == "--help" goto :help
- echo>> ~tmp~.mak "%1" \
+ echo>> ~tmp~.mak "%1"
shift
goto :loop
:srcdir
- echo>> ~tmp~.mak -D"srcdir=%2" \
- shift
- shift
-goto :loop
-:prefix
- echo>> ~tmp~.mak -D"prefix=%2" \
- shift
- shift
-goto :loop
-:suffix
- echo>> ~tmp~.mak -D"RUBY_SUFFIX=%2" \
- shift
- shift
-goto :loop
-:installname
- echo>> ~tmp~.mak -D"RUBY_INSTALL_NAME=%2" \
- shift
- shift
-goto :loop
-:soname
- echo>> ~tmp~.mak -D"RUBY_SO_NAME=%2" \
+ echo>> ~tmp~.mak "srcdir=%2"
shift
shift
goto :loop
:target
- echo>> ~tmp~.mak "%2" \
- shift
- shift
-goto :loop
-:extstatic
- echo>> ~tmp~.mak -D"EXTSTATIC=static" \
- shift
-goto :loop
-:enable-rdoc
- echo>> ~tmp~.mak -D"RDOCTARGET=install-doc" \
- shift
-goto :loop
-:disable-rdoc
- echo>> ~tmp~.mak -D"RDOCTARGET=install-nodoc" \
- shift
-goto :loop
-:extout
- echo>> ~tmp~.mak "EXTOUT=%2" \
+ echo>> ~tmp~.mak %2
shift
shift
goto :loop
-:help
- echo Configuration:
- echo --help display this help
- echo --srcdir=DIR find the sources in DIR [configure dir or `..']
- echo Installation directories:
- echo --prefix=PREFIX install files in PREFIX (ignored currently)
- echo System types:
- echo --target=TARGET configure for TARGET [i386-bccwin32]
- echo Optional Package:
- echo --with-static-linked-ext link external modules statically
- echo --enable-install-doc install rdoc indexes during install
- del ~tmp~.mak
-goto :exit
:end
-echo>> ~tmp~.mak bcc32dir="$(@D)"
make -s -f ~tmp~.mak
-:exit
diff --git a/bcc32/setup.mak b/bcc32/setup.mak
index 1c922c208f..1a243af9b6 100644
--- a/bcc32/setup.mak
+++ b/bcc32/setup.mak
@@ -9,12 +9,10 @@ srcdir = $(bcc32dir:/bcc32/=/)
!else
srcdir = $(bcc32dir)../
!endif
-!ifndef prefix
-prefix = /usr
-!endif
+
OS = bccwin32
RT = $(OS)
-BANG = !
+INCLUDE = !include
APPEND = echo>>$(MAKEFILE)
!ifdef MAKEFILE
MAKE = $(MAKE) -f $(MAKEFILE)
@@ -34,34 +32,8 @@ alpha-$(OS): -prologue- -alpha- -epilogue-
@echo Creating $(MAKEFILE)
@type > $(MAKEFILE) &&|
\#\#\# Makefile for ruby $(OS) \#\#\#
-$(BANG)ifndef srcdir
srcdir = $(srcdir:\=/)
-$(BANG)endif
-$(BANG)ifndef prefix
-prefix = $(prefix:\=/)
-$(BANG)endif
-$(BANG)ifndef EXTSTATIC
-EXTSTATIC = $(EXTSTATIC)
-$(BANG)endif
-!if defined(RDOCTARGET)
-$(BANG)ifndef RDOCTARGET
-RDOCTARGET = $(RDOCTARGET)
-$(BANG)endif
-!endif
-!if defined(EXTOUT)
-$(BANG)ifndef EXTOUT
-EXTOUT = $(EXTOUT)
-$(BANG)endif
-!endif
-|
- @type > usebormm.bat &&|
-@echo off
-ilink32 -Gn -x usebormm.lib > nul
-if exist usebormm.tds echo MEMLIB = usebormm.lib
|
- @usebormm.bat >> $(MAKEFILE)
- @del usebormm.*
-
@cpp32 -I$(srcdir) -DRUBY_EXTERN="//" -P- -o$(MAKEFILE) > nul &&|
\#include "version.h"
MAJOR = RUBY_VERSION_MAJOR
@@ -75,44 +47,28 @@ TEENY = RUBY_VERSION_TEENY
!if defined(PROCESSOR_ARCHITECTURE) || defined(PROCESSOR_LEVEL)
@type >> $(MAKEFILE) &&|
!if defined(PROCESSOR_ARCHITECTURE)
-$(BANG)ifndef PROCESSOR_ARCHITECTURE
PROCESSOR_ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
-$(BANG)endif
!endif
!if defined(PROCESSOR_LEVEL)
-$(BANG)ifndef PROCESSOR_LEVEL
PROCESSOR_LEVEL = $(PROCESSOR_LEVEL)
-$(BANG)endif
!endif
|
!endif
-alpha-: nul
- @$(APPEND) !ifndef PROCESSOR_ARCHITECTURE
@$(APPEND) PROCESSOR_ARCHITECTURE = alpha
- @$(APPEND) !endif
-ix86-: nul
- @$(APPEND) !ifndef PROCESSOR_ARCHITECTURE
@$(APPEND) PROCESSOR_ARCHITECTURE = x86
- @$(APPEND) !endif
-i386-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
@$(APPEND) PROCESSOR_LEVEL = 3
- @$(APPEND) !endif
-i486-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
@$(APPEND) PROCESSOR_LEVEL = 4
- @$(APPEND) !endif
-i586-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
@$(APPEND) PROCESSOR_LEVEL = 5
- @$(APPEND) !endif
-i686-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
@$(APPEND) PROCESSOR_LEVEL = 6
- @$(APPEND) !endif
-epilogue-: nul
@type >> $(MAKEFILE) &&|
@@ -121,13 +77,15 @@ $(BANG)endif
\# RT = $(RT)
\# RUBY_INSTALL_NAME = ruby
\# RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR)
+\# prefix = /usr
\# CFLAGS = -q $$(DEBUGFLAGS) $$(OPTFLAGS) $$(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
\# CPPFLAGS = -I. -I$$(srcdir) -I$$(srcdir)missing -DLIBRUBY_SO=\"$$(LIBRUBY_SO)\"
\# STACK = 0x2000000
\# LDFLAGS = -S:$$(STACK)
\# RFLAGS = $$(iconinc)
\# EXTLIBS = cw32.lib import32.lib user32.lib kernel32.lib
-$(BANG)include $$(srcdir)bcc32/Makefile.sub
+$(INCLUDE) $$(srcdir)bcc32/Makefile.sub
|
- @$(srcdir:/=\)\win32\rm.bat config.h config.status
+ @if exist config.h del config.h
+ @if exist config.status del config.status
@echo type "`$(MAKE)'" to make ruby for $(OS).
diff --git a/bignum.c b/bignum.c
index 3057f1d45a..aba88df04d 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2,8 +2,8 @@
bignum.c -
- $Author: shyouhei $
- $Date: 2006/12/06 10:14:12 $
+ $Author$
+ $Date$
created at: Fri Jun 10 00:48:55 JST 1994
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -42,11 +42,11 @@ static VALUE
bignew_1(klass, len, sign)
VALUE klass;
long len;
- int sign;
+ char sign;
{
NEWOBJ(big, struct RBignum);
OBJSETUP(big, klass, T_BIGNUM);
- big->sign = sign?1:0;
+ big->sign = sign;
big->len = len;
big->digits = ALLOC_N(BDIGIT, len);
@@ -65,10 +65,10 @@ rb_big_clone(x)
return z;
}
-/* modify a bignum by 2's complement */
static void
-get2comp(x)
+get2comp(x, carry) /* get 2's complement */
VALUE x;
+ int carry;
{
long i = RBIGNUM(x)->len;
BDIGIT *ds = BDIGITS(x);
@@ -81,10 +81,11 @@ get2comp(x)
ds[i++] = BIGLO(num);
num = BIGDN(num);
} while (i < RBIGNUM(x)->len);
- if (num != 0) {
+ if (!carry) return;
+ if ((ds[RBIGNUM(x)->len-1] & (1<<(BITSPERDIG-1))) == 0) {
REALLOC_N(RBIGNUM(x)->digits, BDIGIT, ++RBIGNUM(x)->len);
ds = BDIGITS(x);
- ds[RBIGNUM(x)->len-1] = RBIGNUM(x)->sign ? ~0 : 1;
+ ds[RBIGNUM(x)->len-1] = ~0;
}
}
@@ -92,17 +93,14 @@ void
rb_big_2comp(x) /* get 2's complement */
VALUE x;
{
- get2comp(x);
+ get2comp(x, Qtrue);
}
static VALUE
bignorm(x)
VALUE x;
{
- if (FIXNUM_P(x)) {
- return x;
- }
- else if (TYPE(x) == T_BIGNUM) {
+ if (!FIXNUM_P(x)) {
long len = RBIGNUM(x)->len;
BDIGIT *ds = BDIGITS(x);
@@ -753,7 +751,7 @@ unsigned long
rb_big2ulong_pack(x)
VALUE x;
{
- unsigned long num = big2ulong(x, "unsigned long");
+ unsigned long num = big2ulong(x, "unsigned long", Qfalse);
if (!RBIGNUM(x)->sign) {
return -num;
}
@@ -982,8 +980,8 @@ rb_big_eq(x, y)
volatile double a, b;
a = RFLOAT(y)->value;
- if (isnan(a)) return Qfalse;
b = rb_big2dbl(x);
+ if (isnan(a) || isnan(b)) return Qfalse;
return (a == b)?Qtrue:Qfalse;
}
default:
@@ -1052,15 +1050,13 @@ rb_big_neg(x)
VALUE x;
{
VALUE z = rb_big_clone(x);
- long i;
- BDIGIT *ds;
+ long i = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(z);
- if (!RBIGNUM(x)->sign) get2comp(z);
- ds = BDIGITS(z);
- i = RBIGNUM(x)->len;
+ if (!RBIGNUM(x)->sign) get2comp(z, Qtrue);
while (i--) ds[i] = ~ds[i];
+ if (RBIGNUM(x)->sign) get2comp(z, Qfalse);
RBIGNUM(z)->sign = !RBIGNUM(z)->sign;
- if (RBIGNUM(x)->sign) get2comp(z);
return bignorm(z);
}
@@ -1091,7 +1087,7 @@ bigsub(x, y)
}
}
- z = bignew(RBIGNUM(x)->len, z==0);
+ z = bignew(RBIGNUM(x)->len, (z == 0)?1:0);
zds = BDIGITS(z);
for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
@@ -1115,7 +1111,7 @@ bigsub(x, y)
static VALUE
bigadd(x, y, sign)
VALUE x, y;
- int sign;
+ char sign;
{
VALUE z;
BDIGIT_DBL num;
@@ -1609,11 +1605,6 @@ rb_big_pow(x, y)
if (yy > 0) {
VALUE z = x;
- if (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) {
- rb_warn("in a**b, b may be too big");
- d = (double)yy;
- break;
- }
for (;;) {
yy -= 1;
if (yy == 0) break;
@@ -1657,11 +1648,11 @@ rb_big_and(xx, yy)
}
if (!RBIGNUM(y)->sign) {
y = rb_big_clone(y);
- get2comp(y);
+ get2comp(y, Qtrue);
}
if (!RBIGNUM(x)->sign) {
x = rb_big_clone(x);
- get2comp(x);
+ get2comp(x, Qtrue);
}
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
l1 = RBIGNUM(y)->len;
@@ -1686,7 +1677,7 @@ rb_big_and(xx, yy)
for (; i<l2; i++) {
zds[i] = sign?0:ds2[i];
}
- if (!RBIGNUM(z)->sign) get2comp(z);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
return bignorm(z);
}
@@ -1711,13 +1702,14 @@ rb_big_or(xx, yy)
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
+
if (!RBIGNUM(y)->sign) {
y = rb_big_clone(y);
- get2comp(y);
+ get2comp(y, Qtrue);
}
if (!RBIGNUM(x)->sign) {
x = rb_big_clone(x);
- get2comp(x);
+ get2comp(x, Qtrue);
}
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
l1 = RBIGNUM(y)->len;
@@ -1742,7 +1734,7 @@ rb_big_or(xx, yy)
for (; i<l2; i++) {
zds[i] = sign?ds2[i]:(BIGRAD-1);
}
- if (!RBIGNUM(z)->sign) get2comp(z);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
return bignorm(z);
}
@@ -1769,13 +1761,14 @@ rb_big_xor(xx, yy)
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
+
if (!RBIGNUM(y)->sign) {
y = rb_big_clone(y);
- get2comp(y);
+ get2comp(y, Qtrue);
}
if (!RBIGNUM(x)->sign) {
x = rb_big_clone(x);
- get2comp(x);
+ get2comp(x, Qtrue);
}
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
l1 = RBIGNUM(y)->len;
@@ -1802,7 +1795,7 @@ rb_big_xor(xx, yy)
for (; i<l2; i++) {
zds[i] = sign?ds2[i]:~ds2[i];
}
- if (!RBIGNUM(z)->sign) get2comp(z);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
return bignorm(z);
}
@@ -1863,7 +1856,6 @@ rb_big_rshift(x, y)
VALUE z;
BDIGIT_DBL num = 0;
long i, j;
- volatile VALUE save_x;
if (shift < 0) return rb_big_lshift(x, INT2FIX(-shift));
@@ -1874,8 +1866,8 @@ rb_big_rshift(x, y)
return INT2FIX(-1);
}
if (!RBIGNUM(x)->sign) {
- save_x = x = rb_big_clone(x);
- get2comp(x);
+ x = rb_big_clone(x);
+ get2comp(x, Qtrue);
}
xds = BDIGITS(x);
i = RBIGNUM(x)->len; j = i - s1;
@@ -1890,7 +1882,7 @@ rb_big_rshift(x, y)
num = BIGUP(xds[i]);
}
if (!RBIGNUM(x)->sign) {
- get2comp(z);
+ get2comp(z, Qfalse);
}
return bignorm(z);
}
@@ -1935,7 +1927,7 @@ rb_big_aref(x, y)
if (!RBIGNUM(x)->sign) {
if (s1 >= RBIGNUM(x)->len) return INT2FIX(1);
x = rb_big_clone(x);
- get2comp(x);
+ get2comp(x, Qtrue);
}
else {
if (s1 >= RBIGNUM(x)->len) return INT2FIX(0);
@@ -1978,11 +1970,8 @@ rb_big_coerce(x, y)
if (FIXNUM_P(y)) {
return rb_assoc_new(rb_int2big(FIX2LONG(y)), x);
}
- else if (TYPE(y) == T_BIGNUM) {
- return rb_assoc_new(y, x);
- }
else {
- rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
+ rb_raise(rb_eTypeError, "Can't coerce %s to Bignum",
rb_obj_classname(y));
}
/* not reached */
@@ -2021,13 +2010,11 @@ rb_big_rand(max, rand_buf)
return rb_float_new(rand_buf[0]);
}
v = bignew(len,1);
- len--;
- BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
while (len--) {
BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len];
}
- return v;
+ return rb_big_modulo((VALUE)v, max);
}
/*
diff --git a/bin/erb b/bin/erb
index a6fcd5370c..2459d2562e 100755
--- a/bin/erb
+++ b/bin/erb
@@ -12,13 +12,13 @@ class ERB
arg = self.shift
return nil if arg == '--'
if arg =~ /^-(.)(.*)/
- return arg if $1 == '-'
- raise 'unknown switch "-"' if $2.index('-')
- self.unshift "-#{$2}" if $2.size > 0
- "-#{$1}"
+ return arg if $1 == '-'
+ raise 'unknown switch "-"' if $2.index('-')
+ self.unshift "-#{$2}" if $2.size > 0
+ "-#{$1}"
else
- self.unshift arg
- nil
+ self.unshift arg
+ nil
end
end
@@ -30,13 +30,13 @@ class ERB
return trim_mode if disable_percent
case trim_mode
when 0
- return '%'
+ return '%'
when 1
- return '%>'
+ return '%>'
when 2
- return '%<>'
+ return '%<>'
when '-'
- return '%-'
+ return '%-'
end
end
module_function :trim_mode_opt
@@ -45,91 +45,89 @@ class ERB
trim_mode = 0
disable_percent = false
begin
- while switch = ARGV.switch
- case switch
- when '-x' # ruby source
- output = true
- when '-n' # line number
- number = true
- when '-v' # verbose
- $VERBOSE = true
- when '--version' # version
- STDERR.puts factory.version
- exit
- when '-d', '--debug' # debug
- $DEBUG = true
- when '-r' # require
- require ARGV.req_arg
- when '-S' # security level
- arg = ARGV.req_arg
- raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-4]$/
- safe_level = arg.to_i
- when '-T' # trim mode
- arg = ARGV.req_arg
- if arg == '-'
- trim_mode = arg
- next
- end
- raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
- trim_mode = arg.to_i
- when '-K' # KCODE
- arg = ARGV.req_arg
- case arg.downcase
- when 'e', '-e', 'euc'
- $KCODE = 'EUC'
- when 's', '-s', 'sjis'
- $KCODE = 'SJIS'
- when 'u', '-u', 'utf8'
- $KCODE = 'UTF8'
- when 'n', '-n', 'none'
- $KCODE = 'NONE'
- else
- raise "invalid KCODE #{arg.dump}"
- end
- when '-P'
- disable_percent = true
- when '--help'
- raise "print this help"
- else
- raise "unknown switch #{switch.dump}"
- end
- end
- rescue # usage
- STDERR.puts $!.to_s
- STDERR.puts File.basename($0) +
- " [switches] [inputfile]"
- STDERR.puts <<EOU
+ while switch = ARGV.switch
+ case switch
+ when '-x' # ruby source
+ output = true
+ when '-n' # line number
+ number = true
+ when '-v' # verbose
+ $VERBOSE = true
+ when '--version' # version
+ STDERR.puts factory.version
+ exit
+ when '-d', '--debug' # debug
+ $DEBUG = true
+ when '-r' # require
+ require ARGV.req_arg
+ when '-S' # sacurity level
+ arg = ARGV.req_arg
+ raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-4]$/
+ safe_level = arg.to_i
+ when '-T' # trim mode
+ arg = ARGV.req_arg
+ if arg == '-'
+ trim_mode = arg
+ next
+ end
+ raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
+ trim_mode = arg.to_i
+ when '-K' # KCODE
+ arg = ARGV.req_arg
+ case arg.downcase
+ when 'e', '-e', 'euc'
+ $KCODE = 'EUC'
+ when 's', '-s', 'sjis'
+ $KCODE = 'SJIS'
+ when 'u', '-u', 'utf8'
+ $KCODE = 'UTF8'
+ when 'n', '-n', 'none'
+ $KCODE = 'NONE'
+ else
+ raise "invalid KCODE #{arg.dump}"
+ end
+ when '-P'
+ disable_percent = true
+ when '--help'
+ raise "print this help"
+ else
+ raise "unknown switch #{switch.dump}"
+ end
+ end
+ rescue # usage
+ STDERR.puts $!.to_s
+ STDERR.puts File.basename($0) +
+ " [switches] [inputfile]"
+ STDERR.puts <<EOU
-x print ruby script
-n print ruby script with line number
-v enable verbose mode
- -d set $DEBUG to true
+ -d set $DBEUG to true
-r [library] load a library
-K [kcode] specify KANJI code-set
-S [safe_level] set $SAFE (0..4)
-T [trim_mode] specify trim_mode (0..2, -)
- -P ignore lines which start with "%"
+ -P disregard the lin which starts in "%"
EOU
- exit 1
+ exit 1
end
src = $<.read
- filename = $FILENAME
exit 2 unless src
trim = trim_mode_opt(trim_mode, disable_percent)
erb = factory.new(src.untaint, safe_level, trim)
- erb.filename = filename
if output
- if number
- l = 1
- for line in erb.src
- puts "%3d %s"%[l, line]
- l += 1
- end
- else
- puts erb.src
- end
+ if number
+ l = 1
+ for line in erb.src
+ puts "%3d %s"%[l, line]
+ l += 1
+ end
+ else
+ puts erb.src
+ end
else
- erb.run(TOPLEVEL_BINDING.taint)
+ erb.run(TOPLEVEL_BINDING.taint)
end
end
module_function :run
diff --git a/bin/irb b/bin/irb
index 13474a932b..309da52161 100644
--- a/bin/irb
+++ b/bin/irb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
#
# irb.rb - intaractive ruby
-# $Release Version: 0.9.5 $
-# $Revision: 1.2.2.1 $
-# $Date: 2005/04/19 19:24:56 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.7.3 $
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
require "irb"
diff --git a/bin/rdoc b/bin/rdoc
index d08ce838f6..fe619137fd 100644
--- a/bin/rdoc
+++ b/bin/rdoc
@@ -6,7 +6,7 @@
# Copyright (c) 2003 Dave Thomas
# Released under the same terms as Ruby
#
-# $Revision: 1.1 $
+# $Revision$
## Transitional Hack ####
#
diff --git a/class.c b/class.c
index 9e41b1e260..8addef7612 100644
--- a/class.c
+++ b/class.c
@@ -2,8 +2,8 @@
class.c -
- $Author: nobu $
- $Date: 2005/09/28 14:42:46 $
+ $Author$
+ $Date$
created at: Tue Aug 10 15:05:44 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -58,7 +58,6 @@ clone_method(mid, body, tbl)
return ST_CONTINUE;
}
-/* :nodoc: */
VALUE
rb_mod_init_copy(clone, orig)
VALUE clone, orig;
@@ -86,7 +85,6 @@ rb_mod_init_copy(clone, orig)
return clone;
}
-/* :nodoc: */
VALUE
rb_class_init_copy(clone, orig)
VALUE clone, orig;
@@ -94,9 +92,6 @@ rb_class_init_copy(clone, orig)
if (RCLASS(clone)->super != 0) {
rb_raise(rb_eTypeError, "already initialized class");
}
- if (FL_TEST(orig, FL_SINGLETON)) {
- rb_raise(rb_eTypeError, "can't copy singleton class");
- }
return rb_mod_init_copy(clone, orig);
}
diff --git a/common.mk b/common.mk
deleted file mode 100644
index 3584b83e35..0000000000
--- a/common.mk
+++ /dev/null
@@ -1,305 +0,0 @@
-bin: $(PROGRAM) $(WPROGRAM)
-lib: $(LIBRUBY);
-dll: $(LIBRUBY_SO);
-
-RUBYOPT =
-
-STATIC_RUBY = static-ruby
-
-EXTCONF = extconf.rb
-RBCONFIG = ./.rbconfig.time
-
-DMYEXT = dmyext.$(OBJEXT)
-MAINOBJ = main.$(OBJEXT)
-EXTOBJS =
-DLDOBJS = $(DMYEXT)
-
-OBJS = array.$(OBJEXT) \
- bignum.$(OBJEXT) \
- class.$(OBJEXT) \
- compar.$(OBJEXT) \
- dir.$(OBJEXT) \
- dln.$(OBJEXT) \
- enum.$(OBJEXT) \
- error.$(OBJEXT) \
- eval.$(OBJEXT) \
- file.$(OBJEXT) \
- gc.$(OBJEXT) \
- hash.$(OBJEXT) \
- inits.$(OBJEXT) \
- io.$(OBJEXT) \
- marshal.$(OBJEXT) \
- math.$(OBJEXT) \
- numeric.$(OBJEXT) \
- object.$(OBJEXT) \
- pack.$(OBJEXT) \
- parse.$(OBJEXT) \
- process.$(OBJEXT) \
- prec.$(OBJEXT) \
- random.$(OBJEXT) \
- range.$(OBJEXT) \
- re.$(OBJEXT) \
- regex.$(OBJEXT) \
- ruby.$(OBJEXT) \
- signal.$(OBJEXT) \
- sprintf.$(OBJEXT) \
- st.$(OBJEXT) \
- string.$(OBJEXT) \
- struct.$(OBJEXT) \
- time.$(OBJEXT) \
- util.$(OBJEXT) \
- variable.$(OBJEXT) \
- version.$(OBJEXT) \
- $(MISSING)
-
-SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
- --make="$(MAKE)" \
- --mflags="$(MFLAGS)" \
- --make-flags="$(MAKEFLAGS)"
-EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC) --
-
-all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
-prog: $(PROGRAM) $(WPROGRAM)
-
-miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(MINIOBJS) $(OBJS) $(DMYEXT)
-
-$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
-
-$(LIBRUBY_A): $(OBJS) $(DMYEXT) $(ARCHFILE)
-
-$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP)
-
-$(STATIC_RUBY)$(EXEEXT): $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
- @$(RM) $@
- $(PURIFY) $(CC) $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(XLDFLAGS)
-
-ruby.imp: $(OBJS)
- @$(NM) -Pgp $(OBJS) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@
-
-install: install-nodoc $(RDOCTARGET)
-install-all: install-nodoc install-doc
-
-install-nodoc: install-local install-ext
-install-local: pre-install-local do-install-local post-install-local
-install-ext: pre-install-ext do-install-ext post-install-ext
-
-do-install-local: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
-do-install-ext: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
-
-install-bin: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=bin
-install-lib: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=lib
-install-man: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=man --mantype="$(MANTYPE)"
-
-what-where-all no-install-all: no-install no-install-doc
-what-where no-install: no-install-local no-install-ext
-what-where-local: no-install-local
-no-install-local: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
-what-where-ext: no-install-ext
-no-install-ext: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(EXTMK_ARGS) install
-
-install-doc: pre-install-doc do-install-doc post-install-doc
-do-install-doc: $(PROGRAM)
- @echo Generating RDoc documentation
- $(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
-
-pre-install: pre-install-local pre-install-ext
-pre-install-local:: PHONY
- $(PREINSTALL)
-pre-install-ext:: PHONY
-pre-install-doc:: PHONY
-
-post-install: post-install-local post-install-ext
-post-install-local:: PHONY
-post-install-ext:: PHONY
-post-install-doc:: PHONY
-
-clean: clean-ext clean-local
-clean-local::
- @$(RM) $(OBJS) $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
- @$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE)
-clean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) clean
-
-distclean: distclean-ext distclean-local
-distclean-local:: clean-local
- @$(RM) $(MKFILES) config.h rbconfig.rb
- @$(RM) config.cache config.log config.status
- @$(RM) *~ *.bak *.stackdump core *.core gmon.out y.tab.c y.output $(PREP)
-distclean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) distclean
-
-realclean:: distclean
- @$(RM) parse.c lex.c
-
-check: test test-all
-
-test: miniruby$(EXEEXT) $(RBCONFIG) $(PROGRAM) PHONY
- @$(MINIRUBY) $(srcdir)/rubytest.rb
-
-test-all:
- $(RUNRUBY) -C "$(srcdir)/test" runner.rb --runner=$(TESTUI) $(TESTS)
-
-extconf:
- $(MINIRUBY) -I$(srcdir)/lib -run -e mkdir -- -p "$(EXTCONFDIR)"
- $(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
-
-$(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
- @$(MINIRUBY) $(srcdir)/mkconfig.rb -timestamp=$@ \
- -install_name=$(RUBY_INSTALL_NAME) \
- -so_name=$(RUBY_SO_NAME) rbconfig.rb
-
-.PRECIOUS: $(MKFILES)
-
-.PHONY: test install install-nodoc install-doc dist
-
-PHONY:
-
-{$(VPATH)}parse.c: parse.y
-
-acosh.$(OBJEXT): {$(VPATH)}acosh.c
-alloca.$(OBJEXT): {$(VPATH)}alloca.c
-crypt.$(OBJEXT): {$(VPATH)}crypt.c
-dup2.$(OBJEXT): {$(VPATH)}dup2.c
-erf.$(OBJEXT): {$(VPATH)}erf.c
-finite.$(OBJEXT): {$(VPATH)}finite.c
-flock.$(OBJEXT): {$(VPATH)}flock.c
-memcmp.$(OBJEXT): {$(VPATH)}memcmp.c
-memmove.$(OBJEXT): {$(VPATH)}memmove.c
-mkdir.$(OBJEXT): {$(VPATH)}mkdir.c
-vsnprintf.$(OBJEXT): {$(VPATH)}vsnprintf.c
-strcasecmp.$(OBJEXT): {$(VPATH)}strcasecmp.c
-strncasecmp.$(OBJEXT): {$(VPATH)}strncasecmp.c
-strchr.$(OBJEXT): {$(VPATH)}strchr.c
-strdup.$(OBJEXT): {$(VPATH)}strdup.c
-strerror.$(OBJEXT): {$(VPATH)}strerror.c
-strftime.$(OBJEXT): {$(VPATH)}strftime.c
-strstr.$(OBJEXT): {$(VPATH)}strstr.c
-strtod.$(OBJEXT): {$(VPATH)}strtod.c
-strtol.$(OBJEXT): {$(VPATH)}strtol.c
-strtoul.$(OBJEXT): {$(VPATH)}strtoul.c
-nt.$(OBJEXT): {$(VPATH)}nt.c
-x68.$(OBJEXT): {$(VPATH)}x68.c
-os2.$(OBJEXT): {$(VPATH)}os2.c
-dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
-
-# when I use -I., there is confliction at "OpenFile"
-# so, set . into environment varible "include"
-win32.$(OBJEXT): {$(VPATH)}win32.c
-
-###
-
-array.$(OBJEXT): {$(VPATH)}array.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}util.h {$(VPATH)}st.h
-bignum.$(OBJEXT): {$(VPATH)}bignum.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-class.$(OBJEXT): {$(VPATH)}class.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubysig.h {$(VPATH)}node.h {$(VPATH)}st.h
-compar.$(OBJEXT): {$(VPATH)}compar.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-dir.$(OBJEXT): {$(VPATH)}dir.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}util.h
-dln.$(OBJEXT): {$(VPATH)}dln.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}dln.h
-dmydln.$(OBJEXT): {$(VPATH)}dmydln.c {$(VPATH)}dln.c {$(VPATH)}ruby.h \
- config.h {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}dln.h
-dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
-enum.$(OBJEXT): {$(VPATH)}enum.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}node.h {$(VPATH)}util.h
-error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}env.h {$(VPATH)}st.h
-eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h \
- {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h
-file.$(OBJEXT): {$(VPATH)}file.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubyio.h {$(VPATH)}rubysig.h {$(VPATH)}util.h \
- {$(VPATH)}dln.h
-gc.$(OBJEXT): {$(VPATH)}gc.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}node.h \
- {$(VPATH)}env.h {$(VPATH)}re.h {$(VPATH)}regex.h
-hash.$(OBJEXT): {$(VPATH)}hash.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}st.h {$(VPATH)}util.h {$(VPATH)}rubysig.h
-inits.$(OBJEXT): {$(VPATH)}inits.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-io.$(OBJEXT): {$(VPATH)}io.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubyio.h {$(VPATH)}rubysig.h {$(VPATH)}util.h \
- {$(VPATH)}env.h
-main.$(OBJEXT): {$(VPATH)}main.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-marshal.$(OBJEXT): {$(VPATH)}marshal.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubyio.h {$(VPATH)}st.h {$(VPATH)}util.h
-math.$(OBJEXT): {$(VPATH)}math.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-numeric.$(OBJEXT): {$(VPATH)}numeric.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}env.h {$(VPATH)}defines.h {$(VPATH)}intern.h \
- {$(VPATH)}missing.h
-object.$(OBJEXT): {$(VPATH)}object.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}st.h {$(VPATH)}util.h
-pack.$(OBJEXT): {$(VPATH)}pack.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-parse.$(OBJEXT): {$(VPATH)}parse.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h \
- {$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c
-prec.$(OBJEXT): {$(VPATH)}prec.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-process.$(OBJEXT): {$(VPATH)}process.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubysig.h {$(VPATH)}st.h
-random.$(OBJEXT): {$(VPATH)}random.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-range.$(OBJEXT): {$(VPATH)}range.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-re.$(OBJEXT): {$(VPATH)}re.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}re.h {$(VPATH)}regex.h
-regex.$(OBJEXT): {$(VPATH)}regex.c config.h {$(VPATH)}regex.h
-ruby.$(OBJEXT): {$(VPATH)}ruby.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}dln.h {$(VPATH)}node.h {$(VPATH)}util.h
-signal.$(OBJEXT): {$(VPATH)}signal.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}rubysig.h
-sprintf.$(OBJEXT): {$(VPATH)}sprintf.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-st.$(OBJEXT): {$(VPATH)}st.c config.h {$(VPATH)}st.h
-string.$(OBJEXT): {$(VPATH)}string.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}re.h {$(VPATH)}regex.h
-struct.$(OBJEXT): {$(VPATH)}struct.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-time.$(OBJEXT): {$(VPATH)}time.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
-util.$(OBJEXT): {$(VPATH)}util.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}util.h
-variable.$(OBJEXT): {$(VPATH)}variable.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h {$(VPATH)}util.h
-version.$(OBJEXT): {$(VPATH)}version.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}version.h
-
-dist: $(PROGRAM)
- $(RUNRUBY) $(srcdir)/distruby.rb
diff --git a/compar.c b/compar.c
index 3cd3216b77..1488b2c65d 100644
--- a/compar.c
+++ b/compar.c
@@ -2,8 +2,8 @@
compar.c -
- $Author: dave $
- $Date: 2003/12/19 00:01:18 $
+ $Author$
+ $Date$
created at: Thu Aug 26 14:39:48 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
diff --git a/configure.in b/configure.in
index b3288f8c03..b38b59bb68 100644
--- a/configure.in
+++ b/configure.in
@@ -1,9 +1,9 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT()
-AC_PREREQ(2.58)
+AC_PREREQ(2.50)
-AC_DEFUN([RUBY_MINGW32],
+AC_DEFUN(RUBY_MINGW32,
[case "$host_os" in
cygwin*)
AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
@@ -17,7 +17,7 @@ test "$rb_cv_mingw32" = yes && target_os="mingw32"
;;
esac])
-AC_DEFUN([RUBY_CPPOUTFILE],
+AC_DEFUN(RUBY_CPPOUTFILE,
[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
[cppflags=$CPPFLAGS
CPPFLAGS='-o conftest.i'
@@ -33,7 +33,7 @@ elif test -n "$rb_cv_cppoutfile"; then
fi
AC_SUBST(CPPOUTFILE)])
-AC_DEFUN([RUBY_PROG_GNU_LD],
+AC_DEFUN(RUBY_PROG_GNU_LD,
[AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld,
[if `$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null; then
rb_cv_prog_gnu_ld=yes
@@ -73,7 +73,6 @@ if test "$program_prefix" = NONE; then
fi
AC_CANONICAL_TARGET
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
-ac_install_sh='' # unusable for extension libraries.
dnl checks for fat-binary
AC_ARG_ENABLE(fat-binary,
@@ -169,38 +168,12 @@ if test -z "$AR"; then
AC_CHECK_PROGS(AR, aal, ar)
fi
-AC_CHECK_TOOL(AS, as)
-ASFLAGS=$ASFLAGS
-AC_SUBST(ASFLAGS)
-
case "$target_os" in
cygwin*|mingw*)
AC_CHECK_TOOL(NM, nm)
AC_CHECK_TOOL(WINDRES, windres)
AC_CHECK_TOOL(DLLWRAP, dllwrap)
target_cpu=`echo $target_cpu | sed s/i.86/i386/`
- case "$target_os" in
- mingw*)
- test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt
- AC_CHECK_TOOL(OBJDUMP, objdump)
- AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [
- AC_TRY_LINK([#include <stdio.h>],
- [FILE* volatile f = stdin; return 0;],
- [rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext |
- tr A-Z a-z |
- sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
- [rb_cv_msvcrt=msvcrt])
- test "$rb_cv_msvcrt" = "" && rb_cv_msvcrt=msvcrt])
- AC_ARG_WITH(winsock2,
- [ --with-winsock2 link winsock2 (MinGW only)], [
- case $withval in
- yes) with_winsock2=yes;;
- *) with_winsock2=no;;
- esac], [with_winsock2=no])
- if test "$with_winsock2" = yes; then
- AC_DEFINE(USE_WINSOCK2)
- fi
- esac
: ${enable_shared=yes}
;;
aix*)
@@ -214,20 +187,11 @@ esac
AC_PROG_LN_S
AC_PROG_MAKE_SET
-AC_PROG_INSTALL
# checks for UNIX variants that set C preprocessor variables
AC_AIX
AC_MINIX
-AC_SUBST(RM, ['rm -f'])
-AC_SUBST(CP, ['cp'])
-if $as_mkdir_p; then
- AC_SUBST(MAKEDIRS, ['mkdir -p'])
-else
- AC_SUBST(MAKEDIRS, ['install -d'])
-fi
-
dnl check for large file stuff
AC_SYS_LARGEFILE
@@ -244,11 +208,6 @@ AC_CHECK_SIZEOF(float, 4)
AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF(time_t, 0)
-for id in pid_t gid_t uid_t; do
- AC_CHECK_TYPE($id, [typ=$id], [typ=int])
- AC_DEFINE_UNQUOTED(rb_$id, $typ)
-done
-
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
rb_cv_have_prototypes=yes,
@@ -287,7 +246,7 @@ if test "$rb_cv_stdarg" = yes; then
fi
AC_CACHE_CHECK([for noreturn], rb_cv_noreturn,
-[rb_cv_noreturn=x
+[rb_cv_noreturn=no
for mac in "x __attribute__ ((noreturn))" "__declspec(noreturn) x" x; do
AC_TRY_COMPILE(
[#define NORETURN(x) $mac
@@ -297,17 +256,6 @@ NORETURN(void exit(int x));],
done])
AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn)
-AC_CACHE_CHECK([for RUBY_EXTERN], rb_cv_ruby_extern,
-[rb_cv_ruby_extern=no
-for mac in "__attribute__((dllimport))" "__declspec(dllimport)"; do
- AC_TRY_COMPILE(
- [extern $mac void conftest(void);],
- [rb_cv_ruby_extern="extern $mac"; break])
-done])
-test "x$rb_cv_ruby_extern" = xno || AC_DEFINE_UNQUOTED(RUBY_EXTERN, $rb_cv_ruby_extern)
-
-XCFLAGS="$XCFLAGS -DRUBY_EXPORT"
-
dnl Check whether we need to define sys_nerr locally
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
#include <errno.h>])
@@ -335,17 +283,13 @@ hpux*) LIBS="-lm $LIBS"
human*) ac_cv_func_getpgrp_void=yes
ac_cv_func_setitimer=no
;;
-beos*) ac_cv_func_link=no;;
+beos*) ;;
cygwin*) rb_cv_have_daylight=no
ac_cv_var_tzname=no
ac_cv_func__setjmp=no
ac_cv_func_setitimer=no
;;
-mingw*) if test "$with_winsock2" = yes; then
- LIBS="-lws2_32 $LIBS"
- else
- LIBS="-lwsock32 $LIBS"
- fi
+mingw*) LIBS="-lwsock32 $LIBS"
ac_cv_header_a_out_h=no
ac_cv_header_pwd_h=no
ac_cv_header_utime_h=no
@@ -353,7 +297,6 @@ mingw*) if test "$with_winsock2" = yes; then
ac_cv_header_sys_param_h=no
ac_cv_header_sys_resource_h=no
ac_cv_header_sys_select_h=no
- ac_cv_header_sys_time_h=no
ac_cv_header_sys_times_h=no
ac_cv_func_times=yes
ac_cv_func_waitpid=yes
@@ -364,12 +307,10 @@ mingw*) if test "$with_winsock2" = yes; then
ac_cv_func_isinf=yes
ac_cv_func_isnan=yes
ac_cv_func_finite=yes
- ac_cv_func_link=yes
ac_cv_lib_crypt_crypt=no
ac_cv_func_getpgrp_void=no
ac_cv_func_setpgrp_void=yes
ac_cv_func_memcmp_working=yes
- ac_cv_lib_dl_dlopen=no
rb_cv_binary_elf=no
rb_cv_negative_time_t=no
enable_pthread=no
@@ -379,10 +320,7 @@ os2-emx*) LIBS="-lm $LIBS"
msdosdjgpp*) LIBS="-lm $LIBS"
ac_cv_func_getpgrp_void=yes
ac_cv_func_setitimer=no
- ac_cv_sizeof_rlim_t=4
;;
-bsdi*) LIBS="-lm $LIBS"
- ac_cv_sizeof_rlim_t=8;;
freebsd*) LIBS="-lm $LIBS"
AC_CACHE_CHECK([whether -lxpg4 has to be linked],
rb_cv_lib_xpg4_needed,
@@ -422,11 +360,6 @@ bow) ac_cv_func_setitimer=no
;;
superux*) ac_cv_func_setitimer=no
;;
-solaris*2.10) if test -z "$GCC"; then
- ac_cv_func_isinf=yes
- fi
- LIBS="-lm $LIBS"
- ;;
*) LIBS="-lm $LIBS";;
esac
AC_CHECK_LIB(crypt, crypt)
@@ -444,30 +377,14 @@ dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h sys/syscall.h\
+AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\
fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \
ucontext.h intrinsics.h)
-dnl Check additional types.
-AC_CHECK_SIZEOF(rlim_t, 0, [
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_TIME_H
- # include <sys/time.h>
- #endif
- #ifdef HAVE_SYS_RESOURCE_H
- # include <sys/resource.h>
- #endif
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
- #include <stdio.h>
-])
-
dnl Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
@@ -480,18 +397,17 @@ AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(ftello)
-AC_REPLACE_FUNCS(dup2 memmove strcasecmp strncasecmp strerror strftime\
+AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul crypt flock vsnprintf\
isnan finite isinf hypot acosh erf)
-AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd eaccess\
- truncate chsize times utimes fcntl lockf lstat symlink link\
- readlink setitimer setruid seteuid setreuid setresuid\
- setproctitle setrgid setegid setregid setresgid issetugid pause\
- lchown lchmod getpgrp setpgrp getpgid setpgid initgroups\
- getgroups setgroups getpriority getrlimit setrlimit sysconf\
- dlopen sigprocmask\
- sigaction _setjmp setsid telldir seekdir fchmod mktime timegm\
- cosh sinh tanh setuid setgid setenv unsetenv)
+AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd\
+ truncate chsize times utimes fcntl lockf lstat symlink readlink\
+ setitimer setruid seteuid setreuid setresuid setproctitle\
+ setrgid setegid setregid setresgid issetugid pause lchown lchmod\
+ getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
+ getpriority getrlimit dlopen sigprocmask sigaction _setjmp\
+ setsid telldir seekdir fchmod mktime timegm cosh sinh tanh\
+ setuid setgid)
AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
[use_setreuid=$enableval])
@@ -679,7 +595,7 @@ else
fi
fi
-AC_DEFUN([RUBY_CHECK_IO_NEED],
+AC_DEFUN(RUBY_CHECK_IO_NEED,
[AC_CACHE_CHECK(whether need to [$1], [$2],
[AC_TRY_RUN([
#include <stdio.h>
@@ -754,22 +670,6 @@ if test $rb_cv_huge_st_ino = yes; then
AC_DEFINE(HUGE_ST_INO)
fi
-if test "$ac_cv_func_sysconf" = yes; then
- AC_DEFUN([RUBY_CHECK_SYSCONF], [dnl
- AC_CACHE_CHECK([whether _SC_$1 is supported], rb_cv_have_sc_[]m4_tolower($1),
- [AC_TRY_COMPILE([#include <unistd.h>
- ],
- [_SC_$1 >= 0],
- rb_cv_have_sc_[]m4_tolower($1)=yes,
- rb_cv_have_sc_[]m4_tolower($1)=no)
- ])
- if test "$rb_cv_have_sc_[]m4_tolower($1)" = yes; then
- AC_DEFINE(HAVE__SC_$1)
- fi
- ])
- RUBY_CHECK_SYSCONF(CLK_TCK)
-fi
-
case "$target_cpu" in
m68*|i?86|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;;
hppa*) rb_cv_stack_grow_dir=+1;;
@@ -881,7 +781,7 @@ if test "$rb_cv_binary_elf" = yes; then
fi
case "$target_os" in
-linux* | gnu* | k*bsd*-gnu | bsdi*)
+linux* | gnu* | k*bsd*-gnu)
if test "$rb_cv_binary_elf" = no; then
with_dln_a_out=yes
else
@@ -930,12 +830,12 @@ if test "$with_dln_a_out" != yes; then
hpux*) DLDFLAGS="$DLDFLAGS -E"
: ${LDSHARED='ld -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
- : ${LIBPATHENV=SHLIB_PATH}
rb_cv_dlopen=yes;;
solaris*) if test "$GCC" = yes; then
- : ${LDSHARED='$(CC) -shared'}
+ : ${LDSHARED='$(CC) -Wl,-G'}
if test "$rb_cv_prog_gnu_ld" = yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
+ LDSHARED="$LDSHARED -shared"
fi
else
: ${LDSHARED='ld -G'}
@@ -953,11 +853,7 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes ;;
osf*) : ${LDSHARED="ld -shared -expect_unresolved \"*\""}
rb_cv_dlopen=yes ;;
- bsdi3*) case "$CC" in
- *shlicc*) : ${LDSHARED="$CC -r"}
- rb_cv_dlopen=yes ;;
- esac ;;
- linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi*)
+ linux* | gnu* | k*bsd*-gnu | netbsd*)
: ${LDSHARED='${CC} -shared'}
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
@@ -980,6 +876,13 @@ if test "$with_dln_a_out" != yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
fi
rb_cv_dlopen=yes ;;
+ bsdi3*) case "$CC" in
+ *shlicc*) : ${LDSHARED="$CC -r"}
+ rb_cv_dlopen=yes ;;
+ esac ;;
+ bsdi*) : ${LDSHARED="ld -shared"}
+ LDFLAGS="$LDFLAGS "'-rdynamic -Wl,-rpath,$(libdir)/ruby/$(MAJOR).$(MINOR)/i386-bsdi4.0'
+ rb_cv_dlopen=yes ;;
nextstep*) : ${LDSHARED='cc -r -nostdlib'}
LDFLAGS="$LDFLAGS -u libsys_s"
rb_cv_dlopen=yes ;;
@@ -991,22 +894,17 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes ;;
darwin*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress -flat_namespace'}
: ${LDFLAGS=""}
- : ${LIBPATHENV=DYLD_LIBRARY_PATH}
rb_cv_dlopen=yes ;;
- aix*) if test "$GCC" = yes; then
- : ${LDSHARED='gcc -shared'}
- DLDFLAGS='-Wl,-G -eInit_$(TARGET)'
- LDFLAGS='-Wl,-brtl -Wl,-bE:ruby.imp'
- else
- : ${LDSHARED='/usr/ccs/bin/ld'}
- DLDFLAGS='-G -eInit_$(TARGET)'
- LDFLAGS="-brtl -bE:ruby.imp"
- fi
- : ${ARCHFILE="ruby.imp"}
- TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
- TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
- : ${LIBPATHENV=SHLIB_PATH}
- rb_cv_dlopen=yes ;;
+ aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
+ XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
+ DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
+ ARCH_FLAGS='-eInit_$(TARGET)'
+ : LDFLAGS="-brtl $LDFLAGS"
+ : ${ARCHFILE="ruby.imp"}
+ TRY_LINK='$(CC) $(DLDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
+ TRY_LINK="$TRY_LINK"' $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
+ rb_cv_dlopen=yes ;;
+
human*) : ${DLDFLAGS=''}
: ${LDSHARED=''}
: ${LDFLAGS=''}
@@ -1022,7 +920,6 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot"
;;
esac
- : ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes ;;
nto-qnx*) DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
: ${LDSHARED='ld -Bshareable -x'}
@@ -1031,7 +928,6 @@ if test "$with_dln_a_out" != yes; then
cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"}
XLDFLAGS="$XLDFLAGS -Wl,--stack,0x02000000"
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-import,--export-all"
- : ${LIBPATHENV=""}
rb_cv_dlopen=yes ;;
hiuxmpp) : ${LDSHARED='ld -r'} ;;
atheos*) : ${LDSHARED="$CC -shared"}
@@ -1047,17 +943,12 @@ if test "$with_dln_a_out" != yes; then
[enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
if test "$enable_rpath" = yes; then
LIBPATHFLAG=" -L'%1\$-s'"
- if test "$GCC" = yes; then
- RPATHFLAG=" -Wl,-R'%1\$-s'"
- else
- RPATHFLAG=" -R'%1\$-s'"
- fi
+ RPATHFLAG=" -Wl,-R'%1\$-s'"
fi
fi
AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
AC_SUBST(RPATHFLAG)
-AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
AC_SUBST(TRY_LINK)
dln_a_out_works=no
@@ -1216,16 +1107,12 @@ fi
if test x"$cross_compiling" = xyes; then
test x"$MINIRUBY" = x && MINIRUBY="${RUBY-ruby} -I`pwd` -rfake"
PREP=fake.rb
- RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
else
MINIRUBY='./miniruby$(EXEEXT)'
- PREP='miniruby$(EXEEXT)'
- RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT) --'
+ PREP=''
fi
AC_SUBST(MINIRUBY)
AC_SUBST(PREP)
-AC_SUBST(RUNRUBY)
-AC_SUBST(EXTOUT, [${EXTOUT-.ext}])
FIRSTMAKEFILE=""
LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a'
@@ -1298,6 +1185,8 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY) lib$(RUBY_SO_NAME).so'
if test "$GCC" = yes; then
LIBRUBY_DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(@F)'
+ else
+ enable_rpath=no
fi
XLDFLAGS="$XLDFLAGS "'-R${libdir}'
;;
@@ -1309,12 +1198,12 @@ if test "$enable_shared" = 'yes'; then
aix*)
if test "$GCC" = yes; then
LIBRUBY_LDSHARED='$(CC) -shared'
- LIBRUBY_DLDFLAGS='-Wl,-G -Wl,-bE:ruby.imp -Wl,-bnoentry'
+ LIBRUBY_DLDFLAGS='-Wl,-bE:ruby.imp'
else
LIBRUBY_LDSHARED='/usr/ccs/bin/ld'
- LIBRUBY_DLDFLAGS='-G -bE:ruby.imp -bnoentry'
+ LIBRUBY_DLDFLAGS='-bE:ruby.imp -bM:SRE -bnoentry'
fi
- LIBRUBYARG_SHARED='-L${libdir} -lruby'
+ LIBRUBYARG_SHARED='-L${libdir} -Wl,lib$(RUBY_SO_NAME).so'
SOLIBS='-lm -lc'
;;
beos*)
@@ -1338,11 +1227,7 @@ if test "$enable_shared" = 'yes'; then
esac
fi
if test "$enable_rpath" = yes; then
- if test "$GCC" = yes; then
- LIBRUBYARG_SHARED='-Wl,-R -Wl,$(libdir) -L$(libdir) -L. '"$LIBRUBYARG_SHARED"
- else
- LIBRUBYARG_SHARED='-R $(libdir) -L$(libdir) -L. '"$LIBRUBYARG_SHARED"
- fi
+ LIBRUBYARG_SHARED='-Wl,-R -Wl,$(libdir) -L$(libdir) -L. '"$LIBRUBYARG_SHARED"
fi
XLDFLAGS="$XLDFLAGS -L."
@@ -1418,17 +1303,18 @@ case "$target_os" in
AC_LIBOBJ([strftime])
;;
mingw*)
- RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
+ RUBY_SO_NAME=msvcrt-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
if test x"$enable_shared" = xyes; then
LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
LIBRUBY='lib$(LIBRUBY_SO).a'
fi
AC_LIBOBJ([win32])
COMMON_LIBS=m
-# COMMON_MACROS="WIN32_LEAN_AND_MEAN="
+ COMMON_MACROS="WIN32_LEAN_AND_MEAN="
COMMON_HEADERS="windows.h winsock.h"
;;
esac
+ XCFLAGS="$XCFLAGS"
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
LIBRUBY_ALIASES=''
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
@@ -1438,7 +1324,6 @@ case "$target_os" in
LIBRUBY='lib$(RUBY_SO_NAME).a'
LIBRUBYARG='-l$(RUBY_SO_NAME)'
fi
- MINIOBJS=dmydln.o
;;
hpux*)
case "$YACC" in
@@ -1447,10 +1332,6 @@ case "$target_os" in
YACC="$YACC -Nl40000 -Nm40000"
;;
esac
- MINIOBJS=dmydln.o
- ;;
- aix*)
- PREINSTALL='@$(RM) -r $(prefix)/lib/$(LIBRUBY_A) $(prefix)/lib/$(LIBRUBY_SO) $(prefix)/lib/ruby/$(MAJOR).$(MINOR)/$(arch)'
;;
*)
;;
@@ -1483,8 +1364,6 @@ AC_SUBST(COMMON_LIBS)
AC_SUBST(COMMON_MACROS)
AC_SUBST(COMMON_HEADERS)
AC_SUBST(EXPORT_PREFIX)
-AC_SUBST(MINIOBJS)
-AC_SUBST(PREINSTALL)
MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
MAKEFILES="`echo $MAKEFILES`"
@@ -1519,7 +1398,7 @@ AC_ARG_WITH(sitedir,
[ --with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
[sitedir=$withval],
[sitedir='${prefix}/lib/ruby/site_ruby'])
-SITE_DIR=`eval echo \\"${sitedir}\\"`
+SITE_DIR="`eval \"echo ${sitedir}\"`"
case "$target_os" in
cygwin*|mingw*|*djgpp*|os2-emx*)
RUBY_SITE_LIB_PATH="`expr "$SITE_DIR" : "$prefix\(/.*\)"`" ||
@@ -1555,7 +1434,7 @@ else
fi
case "$target_os" in
- mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
+ mingw*) sitearch="i386-msvcrt" ;;
*) sitearch="${arch}" ;;
esac
@@ -1599,10 +1478,5 @@ else
fi
: > confdefs.h
-AC_CONFIG_FILES($FIRSTMAKEFILE)
-AC_CONFIG_FILES(Makefile, [{
- echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)'
- test "$RUBY_INSTALL_NAME$EXEEXT" = ruby || echo 'ruby: $(PROGRAM);'
- sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk
-} >> Makefile], [RUBY_INSTALL_NAME=$RUBY_INSTALL_NAME EXEEXT=$EXEEXT])
+AC_CONFIG_FILES([$FIRSTMAKEFILE Makefile])
AC_OUTPUT
diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in
index 03208df11c..da9efaab47 100644
--- a/cygwin/GNUmakefile.in
+++ b/cygwin/GNUmakefile.in
@@ -1,14 +1,11 @@
include Makefile
ENABLE_SHARED=@ENABLE_SHARED@
-DLLWRAP = @DLLWRAP@ --target=@target_os@
ifeq (@target_os@,cygwin)
DLL_BASE_NAME := $(subst .dll,,$(LIBRUBY_SO))
else
DLL_BASE_NAME := $(RUBY_SO_NAME)
- DLLWRAP += -mno-cygwin
- VPATH += $(srcdir)/win32
endif
ifneq ($(ENABLE_SHARED),yes)
@@ -27,10 +24,6 @@ endif
WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
SOLIBS := $(DLL_BASE_NAME).res.@OBJEXT@ $(SOLIBS)
EXTOBJS += $(@:$(EXEEXT)=.res.@OBJEXT@)
-RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc
-
-ruby: $(PROGRAM)
-rubyw: $(WPROGRAM)
$(LIBRUBY): $(RUBY_EXP) $(LIBRUBY_SO)
$(RUBY_EXP) $(LIBRUBY_SO): $(DLL_BASE_NAME).res.@OBJEXT@
@@ -38,7 +31,7 @@ $(RUBY_EXP) $(LIBRUBY_SO): $(DLL_BASE_NAME).res.@OBJEXT@
%.res.@OBJEXT@: %.rc
@WINDRES@ --include-dir . --include-dir $(<D) --include-dir $(srcdir)/win32 $< $@
-$(RCFILES): $(RBCONFIG)
+$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc: rbconfig.rb
@$(MINIRUBY) $(srcdir)/win32/resource.rb \
-ruby_name=$(RUBY_INSTALL_NAME) -rubyw_name=$(RUBYW_INSTALL_NAME) \
-so_name=$(DLL_BASE_NAME) \
@@ -51,7 +44,7 @@ $(WPROGRAM): $(RUBYW_INSTALL_NAME).res.@OBJEXT@
$(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
$(RUBY_EXP): $(LIBRUBY_A)
- $(DLLWRAP) \
+ @DLLWRAP@ --target=@target_os@ --driver-name=$(CC) \
--output-exp=$(RUBY_EXP) \
--export-all $(LIBRUBY_A) $(LIBS) -o $(PROGRAM)
$(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)
@@ -70,9 +63,3 @@ cygwin-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR).dll: $(LIBRUBY_A)
@DLLWRAP@ -s --def=rubydll.def -o $@
@rm -f rubydll.def
endif
-
-clean-local::
- @$(RM) $(RUBY_EXP) $(RCFILES:.rc=.res.@OBJEXT@)
-
-distclean-local::
- @$(RM) $(RCFILES)
diff --git a/defines.h b/defines.h
index 89167e537e..a059a29b47 100644
--- a/defines.h
+++ b/defines.h
@@ -2,8 +2,8 @@
defines.h -
- $Author: nobu $
- $Date: 2005/10/25 16:59:57 $
+ $Author$
+ $Date$
created at: Wed May 18 00:21:44 JST 1994
************************************************/
@@ -176,6 +176,7 @@ void xfree _((void*));
#ifndef X_OK
#define X_OK 1
#endif
+typedef int pid_t;
#endif /* __APPLE__ */
#endif /* NeXT */
@@ -191,8 +192,11 @@ void xfree _((void*));
#include <net/socket.h> /* intern.h needs fd_set definition */
#endif
-#ifdef RUBY_EXPORT
#undef RUBY_EXTERN
+#if defined _WIN32 && !defined __GNUC__
+# ifndef RUBY_EXPORT
+# define RUBY_EXTERN extern __declspec(dllimport)
+# endif
#endif
#ifndef RUBY_EXTERN
@@ -221,13 +225,6 @@ flush_register_windows(void)
;
}
# define FLUSH_REGISTER_WINDOWS flush_register_windows()
-#elif defined(__ia64__)
-void flush_register_windows(void)
-# if defined(__GNUC__) && (( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3)
-__attribute__ ((noinline))
-# endif
- ;
-# define FLUSH_REGISTER_WINDOWS flush_register_windows()
#else
# define FLUSH_REGISTER_WINDOWS ((void)0)
#endif
diff --git a/dir.c b/dir.c
index 0798b3f76f..97b78cb2d2 100644
--- a/dir.c
+++ b/dir.c
@@ -2,8 +2,8 @@
dir.c -
- $Author: shyouhei $
- $Date: 2006/12/14 14:50:13 $
+ $Author$
+ $Date$
created at: Wed Jan 5 09:51:01 JST 1994
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -63,27 +63,14 @@ char *strchr _((char*,char));
#include "util.h"
-#if !defined HAVE_LSTAT && !defined lstat
-#define lstat stat
-#endif
-
-#ifndef CASEFOLD_FILESYSTEM
-# if defined DOSISH || defined __VMS
-# define CASEFOLD_FILESYSTEM 1
-# else
-# define CASEFOLD_FILESYSTEM 0
-# endif
+#ifndef HAVE_LSTAT
+#define lstat(path,st) stat(path,st)
#endif
#define FNM_NOESCAPE 0x01
#define FNM_PATHNAME 0x02
#define FNM_DOTMATCH 0x04
#define FNM_CASEFOLD 0x08
-#if CASEFOLD_FILESYSTEM
-#define FNM_SYSCASE FNM_CASEFOLD
-#else
-#define FNM_SYSCASE 0
-#endif
#define FNM_NOMATCH 1
#define FNM_ERROR 2
@@ -158,7 +145,9 @@ fnmatch(pat, string, flags)
int period = !(flags & FNM_DOTMATCH);
int nocase = flags & FNM_CASEFOLD;
- while ((c = *pat++) != '\0') {
+ if (!pat) pat = "";
+ if (!string) string = "";
+ while (c = *pat++) {
switch (c) {
case '?':
if (!*s || ISDIRSEP(*s) || PERIOD(s))
@@ -338,17 +327,7 @@ dir_closed()
rb_raise(rb_eIOError, "closed directory");
}
-static void
-dir_check(dir)
- VALUE dir;
-{
- if (!OBJ_TAINTED(dir) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted Dir");
- rb_check_frozen(dir);
-}
-
#define GetDIR(obj, dirp) do {\
- dir_check(dir);\
Data_Get_Struct(obj, struct dir_data, dirp);\
if (dirp->dir == NULL) dir_closed();\
} while (0)
@@ -432,7 +411,6 @@ dir_each(dir)
struct dirent *dp;
GetDIR(dir, dirp);
- rewinddir(dirp->dir);
for (dp = readdir(dirp->dir); dp != NULL; dp = readdir(dirp->dir)) {
rb_yield(rb_tainted_str_new(dp->d_name, NAMLEN(dp)));
if (dirp->dir == NULL) dir_closed();
@@ -559,9 +537,6 @@ dir_close(dir)
{
struct dir_data *dirp;
- if (rb_safe_level() >= 4 && !OBJ_TAINTED(dir)) {
- rb_raise(rb_eSecurityError, "Insecure: can't close");
- }
GetDIR(dir, dirp);
closedir(dirp->dir);
dirp->dir = NULL;
@@ -786,8 +761,13 @@ dir_s_mkdir(argc, argv, obj)
}
check_dirname(&path);
+#ifndef _WIN32
if (mkdir(RSTRING(path)->ptr, mode) == -1)
rb_sys_fail(RSTRING(path)->ptr);
+#else
+ if (mkdir(RSTRING(path)->ptr) == -1)
+ rb_sys_fail(RSTRING(path)->ptr);
+#endif
return INT2FIX(0);
}
@@ -812,22 +792,6 @@ dir_s_rmdir(obj, dir)
return INT2FIX(0);
}
-static void
-sys_warning_1(mesg)
- const char* mesg;
-{
- rb_sys_warning("%s", mesg);
-}
-
-#define GLOB_VERBOSE (1U << (sizeof(int) * CHAR_BIT - 1))
-#define sys_warning(val) \
- (void)((flags & GLOB_VERBOSE) && rb_protect((VALUE (*)_((VALUE)))sys_warning_1, (VALUE)(val), 0))
-
-#define GLOB_ALLOC(type) (type *)malloc(sizeof(type))
-#define GLOB_ALLOC_N(type, n) (type *)malloc(sizeof(type) * (n))
-#define GLOB_REALLOC_N(var, type, n) (type *)realloc((var), sizeof(type) * (n))
-#define GLOB_JUMP_TAG(status) ((status == -1) ? rb_memerror() : rb_jump_tag(status))
-
/* Return nonzero if S has any special globbing chars in it. */
static int
has_magic(s, send, flags)
@@ -837,8 +801,7 @@ has_magic(s, send, flags)
register const char *p = s;
register char c;
int open = 0;
- const int escape = !(flags & FNM_NOESCAPE);
- const int nocase = flags & FNM_CASEFOLD;
+ int escape = !(flags & FNM_NOESCAPE);
while ((c = *p++) != '\0') {
switch (c) {
@@ -857,11 +820,6 @@ has_magic(s, send, flags)
case '\\':
if (escape && *p++ == '\0')
return Qfalse;
- break;
-
- default:
- if (!FNM_SYSCASE && ISALPHA(c) && nocase)
- return Qtrue;
}
if (send && p >= send) break;
@@ -877,8 +835,7 @@ extract_path(p, pend)
int len;
len = pend - p;
- alloc = GLOB_ALLOC_N(char, len+1);
- if (!alloc) return NULL;
+ alloc = ALLOC_N(char, len+1);
memcpy(alloc, p, len);
if (len > 1 && pend[-1] == '/'
#if defined DOSISH_DRIVE_LETTER
@@ -927,8 +884,8 @@ remove_backslashes(p)
#endif
struct glob_args {
- void (*func) _((const char*, VALUE));
- const char *c;
+ void (*func) _((VALUE, VALUE));
+ VALUE c;
VALUE v;
};
@@ -939,58 +896,64 @@ glob_func_caller(val)
VALUE val;
{
struct glob_args *args = (struct glob_args *)val;
+ VALUE path = args->c;
- (*args->func)(args->c, args->v);
+ OBJ_TAINT(path);
+ RSTRING(path)->len = strlen(RSTRING(path)->ptr);
+ (*args->func)(path, args->v);
return Qnil;
}
-#define glob_call_func(func, path, arg) (*func)(path, arg)
+static int
+glob_call_func(func, path, arg)
+ void (*func) _((VALUE, VALUE));
+ VALUE path;
+ VALUE arg;
+{
+ int status;
+ struct glob_args args;
+
+ args.func = func;
+ args.c = path;
+ args.v = arg;
-static int glob_helper _((const char *path, const char *sub, int flags, int (*func)(const char *,VALUE), VALUE arg));
+ rb_protect(glob_func_caller, (VALUE)&args, &status);
+ return status;
+}
+
+static int glob_helper(VALUE path, char *sub, int flags, void (*func)(VALUE,VALUE), VALUE arg);
static int
-glob_helper(path, sub, flags, func, arg)
- const char *path;
- const char *sub;
+glob_helper(pv, sub, flags, func, arg)
+ VALUE pv;
+ char *sub;
int flags;
- int (*func) _((const char *, VALUE));
+ void (*func) _((VALUE, VALUE));
VALUE arg;
{
struct stat st;
- const char *p, *m;
+ char *p, *m, *path;
int status = 0;
- char *buf = 0;
- char *newpath = 0;
- char *newbuf;
+ StringValue(pv);
+ path = RSTRING(pv)->ptr;
p = sub ? sub : path;
if (!has_magic(p, 0, flags)) {
-#if !defined DOSISH
- if (!(flags & FNM_NOESCAPE))
+#if defined DOSISH
+ remove_backslashes(path);
+#else
+ if (!(flags & FNM_NOESCAPE)) remove_backslashes(p);
#endif
- {
- newpath = strdup(path);
- if (!newpath) return -1;
- if (sub) {
- p = newpath + (sub - path);
- remove_backslashes(newpath + (sub - path));
- sub = p;
- }
- else {
- remove_backslashes(newpath);
- p = path = newpath;
- }
- }
if (lstat(path, &st) == 0) {
- status = glob_call_func(func, path, arg);
+ status = glob_call_func(func, pv, arg);
+ if (status) return status;
}
else if (errno != ENOENT) {
/* In case stat error is other than ENOENT and
we may want to know what is wrong. */
- sys_warning(path);
+ rb_sys_warning(path);
}
- if (newpath) free(newpath);
- return status;
+ return 0;
}
while (p && !status) {
@@ -998,6 +961,7 @@ glob_helper(path, sub, flags, func, arg)
m = strchr(p, '/');
if (has_magic(p, m, flags)) {
char *dir, *base, *magic;
+ VALUE buf;
DIR *dirp;
struct dirent *dp;
int recursive = 0;
@@ -1008,21 +972,12 @@ glob_helper(path, sub, flags, func, arg)
} *tmp, *link, **tail = &link;
base = extract_path(path, p);
- if (!base) {
- status = -1;
- break;
- }
if (path == p) dir = ".";
else dir = base;
magic = extract_elem(p);
- if (!magic) {
- status = -1;
- break;
- }
if (stat(dir, &st) < 0) {
- if (errno != ENOENT)
- sys_warning(dir);
+ if (errno != ENOENT) rb_sys_warning(dir);
free(base);
free(magic);
break;
@@ -1031,19 +986,14 @@ glob_helper(path, sub, flags, func, arg)
if (m && strcmp(magic, "**") == 0) {
int n = strlen(base);
recursive = 1;
- newbuf = GLOB_REALLOC_N(buf, char, n+strlen(m)+3);
- if (!newbuf) {
- status = -1;
- goto finalize;
- }
- buf = newbuf;
- sprintf(buf, "%s%s", base, *base ? m : m+1);
- status = glob_helper(buf, buf+n, flags, func, arg);
+ buf = rb_str_new(0, n+strlen(m)+3);
+ sprintf(RSTRING(buf)->ptr, "%s%s", base, *base ? m : m+1);
+ status = glob_helper(buf, RSTRING(buf)->ptr+n, flags, func, arg);
if (status) goto finalize;
}
dirp = opendir(dir);
if (dirp == NULL) {
- sys_warning(dir);
+ rb_sys_warning(dir);
free(base);
free(magic);
break;
@@ -1067,20 +1017,14 @@ glob_helper(path, sub, flags, func, arg)
continue;
if (fnmatch("*", dp->d_name, flags) != 0)
continue;
- newbuf = GLOB_REALLOC_N(buf, char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
- if (!newbuf) {
- status = -1;
- break;
- }
- buf = newbuf;
- sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
- if (lstat(buf, &st) < 0) {
- if (errno != ENOENT)
- sys_warning(buf);
+ buf = rb_str_new(0, strlen(base)+NAMLEN(dp)+strlen(m)+6);
+ sprintf(RSTRING(buf)->ptr, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
+ if (lstat(RSTRING(buf)->ptr, &st) < 0) {
+ if (errno != ENOENT) rb_sys_warning(RSTRING(buf)->ptr);
continue;
}
if (S_ISDIR(st.st_mode)) {
- char *t = buf+strlen(buf);
+ char *t = RSTRING(buf)->ptr+strlen(RSTRING(buf)->ptr);
strcpy(t, "/**");
strcpy(t+3, m);
status = glob_helper(buf, t, flags, func, arg);
@@ -1090,25 +1034,15 @@ glob_helper(path, sub, flags, func, arg)
continue;
}
if (fnmatch(magic, dp->d_name, flags) == 0) {
- newbuf = GLOB_REALLOC_N(buf, char, strlen(base)+NAMLEN(dp)+2);
- if (!newbuf) {
- status = -1;
- break;
- }
- buf = newbuf;
- sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
+ buf = rb_str_new(0, strlen(base)+NAMLEN(dp)+2);
+ sprintf(RSTRING(buf)->ptr, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
if (!m) {
status = glob_call_func(func, buf, arg);
if (status) break;
continue;
}
- tmp = GLOB_ALLOC(struct d_link);
- if (!tmp) {
- status = -1;
- break;
- }
- tmp->path = buf;
- buf = 0;
+ tmp = ALLOC(struct d_link);
+ tmp->path = strdup(RSTRING(buf)->ptr);
*tail = tmp;
tail = &tmp->next;
}
@@ -1126,21 +1060,15 @@ glob_helper(path, sub, flags, func, arg)
int len = strlen(link->path);
int mlen = strlen(m);
- newbuf = GLOB_REALLOC_N(buf, char, len+mlen+1);
- if (!newbuf) {
- status = -1;
- goto next_elem;
- }
- buf = newbuf;
- sprintf(buf, "%s%s", link->path, m);
- status = glob_helper(buf, buf+len, flags, func, arg);
+ buf = rb_str_new(0, len+mlen+1);
+ sprintf(RSTRING(buf)->ptr, "%s%s", link->path, m);
+ status = glob_helper(buf, RSTRING(buf)->ptr+len, flags, func, arg);
}
}
else {
- sys_warning(link->path);
+ rb_sys_warning(link->path);
}
}
- next_elem:
tmp = link;
link = link->next;
free(tmp->path);
@@ -1151,61 +1079,33 @@ glob_helper(path, sub, flags, func, arg)
}
p = m;
}
- if (buf) free(buf);
- if (newpath) free(newpath);
return status;
}
-int
-ruby_glob(path, flags, func, arg)
- const char *path;
- int flags;
- int (*func) _((const char *, VALUE));
- VALUE arg;
-{
- flags |= FNM_SYSCASE;
- return glob_helper(path, 0, flags & ~GLOB_VERBOSE, func, arg);
-}
-
-int
-ruby_globi(path, flags, func, arg)
- const char *path;
+static int
+rb_glob2(path, flags, func, arg)
+ VALUE path;
int flags;
- int (*func) _((const char *, VALUE));
+ void (*func) _((VALUE, VALUE));
VALUE arg;
{
- return glob_helper(path, 0, flags | FNM_CASEFOLD, func, arg);
-}
-
-static int rb_glob_caller _((const char *, VALUE));
-
-static int
-rb_glob_caller(path, a)
- const char *path;
- VALUE a;
-{
int status;
- struct glob_args *args = (struct glob_args *)a;
- args->c = path;
- rb_protect(glob_func_caller, a, &status);
+ status = glob_helper(path, 0, flags, func, arg);
return status;
}
-static int
-rb_glob2(path, flags, func, arg)
- const char *path;
- int flags;
- void (*func) _((const char *, VALUE));
+struct rb_glob_args {
+ void (*func) _((const char*, VALUE));
VALUE arg;
-{
- struct glob_args args;
-
- args.func = func;
- args.v = arg;
+};
- flags |= FNM_SYSCASE;
- return glob_helper(path, 0, flags | GLOB_VERBOSE, rb_glob_caller, (VALUE)&args);
+static void
+rb_glob_caller(path, a)
+ VALUE path, a;
+{
+ struct rb_glob_args *args = (struct rb_glob_args *)a;
+ (*args->func)(RSTRING(path)->ptr, args->arg);
}
void
@@ -1214,7 +1114,13 @@ rb_glob(path, func, arg)
void (*func) _((const char*, VALUE));
VALUE arg;
{
- int status = rb_glob2(path, 0, func, arg);
+ struct rb_glob_args args;
+ int status;
+
+ args.func = func;
+ args.arg = arg;
+ status = rb_glob2(rb_str_new2(path), 0, rb_glob_caller, (VALUE)&args);
+
if (status) rb_jump_tag(status);
}
@@ -1224,22 +1130,28 @@ rb_globi(path, func, arg)
void (*func) _((const char*, VALUE));
VALUE arg;
{
- int status = rb_glob2(path, FNM_CASEFOLD, func, arg);
+ struct rb_glob_args args;
+ int status;
+
+ args.func = func;
+ args.arg = arg;
+ status = rb_glob2(rb_str_new2(path), FNM_CASEFOLD, rb_glob_caller, (VALUE)&args);
+
if (status) rb_jump_tag(status);
}
static void
push_pattern(path, ary)
- const char *path;
+ VALUE path;
VALUE ary;
{
- rb_ary_push(ary, rb_tainted_str_new2(path));
+ rb_ary_push(ary, path);
}
static int
push_globs(ary, s, flags)
VALUE ary;
- const char *s;
+ VALUE s;
int flags;
{
return rb_glob2(s, flags, push_pattern, ary);
@@ -1247,18 +1159,17 @@ push_globs(ary, s, flags)
static int
push_braces(ary, str, flags)
- VALUE ary;
- const char *str;
+ VALUE ary, str;
int flags;
{
- char *buf = 0;
- char *b, *newbuf;
+ VALUE buf;
+ char *b;
const char *s, *p, *t;
const char *lbrace, *rbrace;
int nest = 0;
int status = 0;
- s = p = str;
+ s = p = RSTRING(str)->ptr;
lbrace = rbrace = 0;
while (*p) {
if (*p == '{') {
@@ -1283,21 +1194,11 @@ push_braces(ary, str, flags)
t = p + 1;
for (p = t; *p!='}' && *p!=','; p++) {
/* skip inner braces */
- if (*p == '{') {
- nest = 1;
- while (*++p != '}' || --nest) {
- if (*p == '{') nest++;
- }
- }
+ if (*p == '{') while (*p!='}') p++;
}
- newbuf = GLOB_REALLOC_N(buf, char, len+1);
- if (!newbuf) {
- status = -1;
- break;
- }
- buf = newbuf;
- memcpy(buf, s, lbrace-s);
- b = buf + (lbrace-s);
+ buf = rb_str_new(0, len+1);
+ memcpy(RSTRING(buf)->ptr, s, lbrace-s);
+ b = RSTRING(buf)->ptr + (lbrace-s);
memcpy(b, t, p-t);
strcpy(b+(p-t), rbrace+1);
status = push_braces(ary, buf, flags);
@@ -1307,7 +1208,6 @@ push_braces(ary, str, flags)
else {
status = push_globs(ary, str, flags);
}
- if (buf) free(buf);
return status;
}
@@ -1319,7 +1219,9 @@ rb_push_glob(str, flags)
VALUE str;
int flags;
{
- const char *p, *pend, *buf;
+ const char *p, *pend;
+ volatile VALUE buf;
+ char *t;
int nest, maxnest;
int status = 0;
int noescape = flags & FNM_NOESCAPE;
@@ -1327,21 +1229,24 @@ rb_push_glob(str, flags)
ary = rb_ary_new();
SafeStringValue(str);
+ buf = rb_str_new(0, RSTRING(str)->len + 1);
p = RSTRING(str)->ptr;
pend = p + RSTRING(str)->len;
while (p < pend) {
+ t = RSTRING(buf)->ptr;
nest = maxnest = 0;
while (p < pend && isdelim(*p)) p++;
- buf = p;
while (p < pend && !isdelim(*p)) {
if (*p == '{') nest++, maxnest++;
if (*p == '}') nest--;
if (!noescape && *p == '\\') {
- if (++p == pend) break;
+ *t++ = *p++;
+ if (p == pend) break;
}
- p++;
+ *t++ = *p++;
}
+ *t = '\0';
if (maxnest == 0) {
status = push_globs(ary, buf, flags);
if (status) break;
@@ -1352,7 +1257,7 @@ rb_push_glob(str, flags)
}
/* else unmatched braces */
}
- if (status) GLOB_JUMP_TAG(status);
+ if (status) rb_jump_tag(status);
if (rb_block_given_p()) {
rb_ary_each(ary);
return Qnil;
@@ -1378,38 +1283,14 @@ dir_s_aref(obj, str)
/*
* call-seq:
* Dir.glob( string, [flags] ) => array
- * Dir.glob( string, [flags] ) {| filename | block } => nil
+ * Dir.glob( string, [flags] ) {| filename | block } => false
*
* Returns the filenames found by expanding the pattern given in
* <i>string</i>, either as an <i>array</i> or as parameters to the
* block. Note that this pattern is not a regexp (it's closer to a
- * shell glob). See <code>File::fnmatch</code> for the meaning of
- * the <i>flags</i> parameter.
- *
- * <code>*</code>:: Matches any file. Can be restricted by
- * other values in the glob. <code>*</code>
- * will match all files; <code>c*</code> will
- * match all files beginning with
- * <code>c</code>; <code>*c</code> will match
- * all files ending with <code>c</code>; and
- * <code>*c*</code> will match all files that
- * have <code>c</code> in them (including at
- * the beginning or end). Equivalent to
- * <code>/ .* /x</code> in regexp.
- * <code>**</code>:: Matches directories recursively.
- * <code>?</code>:: Matches any one character. Equivalent to
- * <code>/.{1}/</code> in regexp.
- * <code>[set]</code>:: Matches any one character in +set+.
- * Behaves exactly like character sets in
- * Regexp, including set negation
- * (<code>[^a-z]</code>).
- * <code>{p,q}</code>:: Matches either literal <code>p</code> or
- * literal <code>q</code>. Matching literals
- * may be more than one character in length.
- * More than two literals may be specified.
- * Equivalent to pattern alternation in
- * regexp.
- * <code>\</code>:: Escapes the next metacharacter.
+ * shell glob). See <code>File::fnmatch</code> for
+ * details of file name matching and the meaning of the <i>flags</i>
+ * parameter.
*
* Dir["config.?"] #=> ["config.h"]
* Dir.glob("config.?") #=> ["config.h"]
@@ -1419,19 +1300,6 @@ dir_s_aref(obj, str)
* Dir.glob("*") #=> ["config.h", "main.rb"]
* Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "..", "config.h", "main.rb"]
*
- * rbfiles = File.join("**", "*.rb")
- * Dir.glob(rbfiles) #=> ["main.rb",
- * "lib/song.rb",
- * "lib/song/karaoke.rb"]
- * libdirs = File.join("**", "lib")
- * Dir.glob(libdirs) #=> ["lib"]
- *
- * librbfiles = File.join("**", "lib", "**", "*.rb")
- * Dir.glob(librbfiles) #=> ["lib/song.rb",
- * "lib/song/karaoke.rb"]
- *
- * librbfiles = File.join("**", "lib", "*.rb")
- * Dir.glob(librbfiles) #=> ["lib/song.rb"]
*/
static VALUE
dir_s_glob(argc, argv, obj)
@@ -1454,6 +1322,7 @@ static VALUE
dir_open_dir(path)
VALUE path;
{
+ struct dir_data *dp;
VALUE dir = rb_funcall(rb_cDir, rb_intern("open"), 1, path);
if (TYPE(dir) != T_DATA ||
@@ -1524,27 +1393,8 @@ dir_entries(io, dirname)
* similar to shell filename globbing. It may contain the following
* metacharacters:
*
- * <code>*</code>:: Matches any file. Can be restricted by
- * other values in the glob. <code>*</code>
- * will match all files; <code>c*</code> will
- * match all files beginning with
- * <code>c</code>; <code>*c</code> will match
- * all files ending with <code>c</code>; and
- * <code>*c*</code> will match all files that
- * have <code>c</code> in them (including at
- * the beginning or end). Equivalent to
- * <code>/ .* /x</code> in regexp.
- * <code>?</code>:: Matches any one character. Equivalent to
- * <code>/.{1}/</code> in regexp.
- * <code>[set]</code>:: Matches any one character in +set+.
- * Behaves exactly like character sets in
- * Regexp, including set negation
- * (<code>[^a-z]</code>).
- * <code>\</code>:: Escapes the next metacharacter.
- *
- * <i>flags</i> is a bitwise OR of the <code>FNM_xxx</code>
- * parameters. The same glob pattern and flags are used by
- * <code>Dir::glob</code>.
+ * <i>flags</i> is a bitwise OR of the <code>FNM_xxx</code> parameters.
+ * The same glob pattern and flags are used by <code>Dir::glob</code>.
*
* File.fnmatch('cat', 'cat') #=> true
* File.fnmatch('cat', 'category') #=> false
@@ -1649,5 +1499,4 @@ Init_Dir()
rb_file_const("FNM_PATHNAME", INT2FIX(FNM_PATHNAME));
rb_file_const("FNM_DOTMATCH", INT2FIX(FNM_DOTMATCH));
rb_file_const("FNM_CASEFOLD", INT2FIX(FNM_CASEFOLD));
- rb_file_const("FNM_SYSCASE", INT2FIX(FNM_SYSCASE));
}
diff --git a/distruby.rb b/distruby.rb
deleted file mode 100644
index dcc3e76ce8..0000000000
--- a/distruby.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#!./miniruby
-
-if RUBY_PATCHLEVEL.zero?
- dirname = sprintf 'ruby-%s', RUBY_VERSION
- tagname = dirname.gsub /ruby-(\d)\.(\d)\.(\d)/, 'v\1_\2_\3'
-else
- dirname = sprintf 'ruby-%s-p%u', RUBY_VERSION, RUBY_PATCHLEVEL
- tagname = dirname.gsub /ruby-(\d)\.(\d)\.(\d)-p/, 'v\1_\2_\3_'
-end
-tarname = dirname + '.tar.gz'
-repos = 'http://svn.ruby-lang.org/repos/ruby/tags/' + tagname
-
-STDERR.puts 'exporting sources...'
-system 'svn', 'export', '-q', repos, dirname
-Dir.chdir dirname do
- STDERR.puts 'generating configure...'
- system 'autoconf'
- system 'rm', '-rf', 'autom4te.cache'
-
- STDERR.puts 'generating parse.c...'
- system 'bison', '-y', '-o', 'parse.c', 'parse.y'
-end
-
-STDERR.puts 'generating tarball...'
-system 'tar', 'chofzp', tarname, dirname
-
-open tarname, 'rb' do |fp|
- require 'digest/md5'
- require 'digest/sha1'
- str = fp.read
- md5 = Digest::MD5.hexdigest str
- sha = Digest::SHA1.hexdigest str
- printf "MD5(%s)= %s\nSHA1(%s)= %s\n", tarname, md5, tarname, sha
-end
-
-
-
-#
-# Local Variables:
-# mode: ruby
-# code: utf-8
-# indent-tabs-mode: t
-# tab-width: 3
-# ruby-indent-level: 3
-# fill-column: 79
-# default-justification: full
-# End:
-# vi: ts=3 sw=3
-
diff --git a/djgpp/configure.bat b/djgpp/configure.bat
index e6a5d79d4a..e6a5d79d4a 100755..100644
--- a/djgpp/configure.bat
+++ b/djgpp/configure.bat
diff --git a/dln.c b/dln.c
index 016d0c12a2..8f0b2a0409 100644
--- a/dln.c
+++ b/dln.c
@@ -2,8 +2,8 @@
dln.c -
- $Author: matz $
- $Date: 2006/08/07 03:43:39 $
+ $Author$
+ $Date$
created at: Tue Jan 18 17:05:06 JST 1994
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -27,6 +27,10 @@
char *dln_argv0;
#endif
+#ifdef _AIX
+#pragma alloca
+#endif
+
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#endif
@@ -85,7 +89,7 @@ char *getenv();
# include <image.h>
#endif
-#ifndef NO_DLN_LOAD
+int eaccess();
#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
@@ -156,7 +160,7 @@ static int dln_errno;
#define DLN_ENOEXEC ENOEXEC /* Exec format error */
#define DLN_ECONFL 1201 /* Symbol name conflict */
-#define DLN_ENOINIT 1202 /* No initializer given */
+#define DLN_ENOINIT 1202 /* No inititalizer given */
#define DLN_EUNDEF 1203 /* Undefine symbol remains */
#define DLN_ENOTLIB 1204 /* Not a library file */
#define DLN_EBADLIB 1205 /* Malformed library file */
@@ -391,7 +395,7 @@ dln_init(prog)
if (c != '!') goto err_noexec;
p = buf;
- /* skip forwarding spaces */
+ /* skip forwading spaces */
while (read(fd, &c, 1) == 1) {
if (c == '\n') goto err_noexec;
if (c != '\t' && c != ' ') {
@@ -956,9 +960,8 @@ load_lib(lib)
dln_errno = DLN_EBADLIB;
if (lib[0] == '-' && lib[1] == 'l') {
- long len = strlen(lib) + 4;
- char *p = alloca(len);
- snprintf(p, len, "lib%s.a", lib+2);
+ char *p = alloca(strlen(lib) + 4);
+ sprintf(p, "lib%s.a", lib+2);
lib = p;
}
@@ -1112,7 +1115,7 @@ dln_sym(name)
#endif /* USE_DLN_A_OUT */
#ifdef USE_DLN_DLOPEN
-# if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ < 105000000
+# ifdef __NetBSD__
# include <nlist.h>
# include <link.h>
# else
@@ -1271,16 +1274,10 @@ static int vms_fileact(char *filespec, int type);
static long vms_fisexh(long *sigarr, long *mecarr);
#endif
-#endif /* NO_DLN_LOAD */
-
void*
dln_load(file)
const char *file;
{
-#ifdef NO_DLN_LOAD
- rb_raise(rb_eLoadError, "this executable file can't load extension libraries");
-#else
-
#if !defined(_AIX) && !defined(NeXT)
const char *error = 0;
#define DLN_ERROR() (error = dln_strerror(), strcpy(ALLOCA_N(char, strlen(error) + 1), error))
@@ -1636,8 +1633,6 @@ dln_load(file)
failed:
rb_loaderror("%s - %s", error, file);
#endif
-
-#endif /* NO_DLN_LOAD */
return 0; /* dummy return */
}
@@ -1687,7 +1682,6 @@ conv_to_posix_path(win32, posix, len)
char *p = win32;
char *dst = posix;
- posix[0] = '\0';
for (p = win32; *p; p++)
if (*p == ';') {
*p = 0;
diff --git a/dln.h b/dln.h
index 3d52ea2827..182cf9f9f4 100644
--- a/dln.h
+++ b/dln.h
@@ -2,8 +2,8 @@
dln.h -
- $Author: michal $
- $Date: 2003/01/16 07:34:01 $
+ $Author$
+ $Date$
created at: Wed Jan 19 16:53:09 JST 1994
Copyright (C) 1993-2003 Yukihiro Matsumoto
diff --git a/dmydln.c b/dmydln.c
deleted file mode 100644
index 09ea06806c..0000000000
--- a/dmydln.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define NO_DLN_LOAD 1
-#include "dln.c"
diff --git a/doc/forwardable.rd b/doc/forwardable.rd
index f9c8234761..7272c374b6 100644
--- a/doc/forwardable.rd
+++ b/doc/forwardable.rd
@@ -1,8 +1,8 @@
-- forwardable.rb
$Release Version: 1.1 $
- $Revision: 1.2 $
- $Date: 2001/05/07 23:52:57 $
+ $Revision$
+ $Date$
Original version by Tosh
=begin
diff --git a/doc/forwardable.rd.ja b/doc/forwardable.rd.ja
index a56823dd1a..d928fddc5e 100644
--- a/doc/forwardable.rd.ja
+++ b/doc/forwardable.rd.ja
@@ -1,7 +1,7 @@
-- forwatable.rb
$Release Version: 1.1 $
- $Revision: 1.1 $
- $Date: 2001/07/19 05:42:06 $
+ $Revision$
+ $Date$
=begin
= Forwardable
diff --git a/doc/irb/irb-tools.rd.ja b/doc/irb/irb-tools.rd.ja
index 38145576dc..64d9ab29c8 100644
--- a/doc/irb/irb-tools.rd.ja
+++ b/doc/irb/irb-tools.rd.ja
@@ -1,7 +1,7 @@
irb´ØÏ¢¤ª¤Þ¤±¥³¥Þ¥ó¥É¤È¥é¥¤¥Ö¥é¥ê
$Release Version: 0.7.1 $
- $Revision: 1.1 $
- $Date: 2001/07/19 05:42:06 $
+ $Revision$
+ $Date$
by Keiju ISHITSUKA(Nihon Rational Co.,Ltd.)
=begin
diff --git a/doc/irb/irb.rd b/doc/irb/irb.rd
index f56e8b60e0..a42cd46680 100644
--- a/doc/irb/irb.rd
+++ b/doc/irb/irb.rd
@@ -1,7 +1,7 @@
irb -- interactive ruby
$Release Version: 0.9 $
- $Revision: 1.6 $
- $Date: 2003/07/31 16:34:07 $
+ $Revision$
+ $Date$
by Keiju ISHITSUKA(keiju@ishitsuka.com)
by gotoken-san who is original translater from japanese version
diff --git a/doc/irb/irb.rd.ja b/doc/irb/irb.rd.ja
index aa3c0e13aa..bf8ac5d517 100644
--- a/doc/irb/irb.rd.ja
+++ b/doc/irb/irb.rd.ja
@@ -1,8 +1,8 @@
irb -- interactive ruby
- $Release Version: 0.9.5 $
- $Revision: 1.3.2.1 $
- $Date: 2005/04/19 19:24:56 $
- by Keiju ISHITSUKA(keiju@ruby-lang.org)
+ $Release Version: 0.9 $
+ $Revision$
+ $Date$
+ by Keiju ISHITSUKA(keiju@ishitsuka.com)
=begin
= irb¤È¤Ï?
@@ -112,7 +112,6 @@ irbµ¯Æ°»þ¤Ë``~/.irbrc''¤òÆÉ¤ß¹þ¤ß¤Þ¤¹. ¤â¤·Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï,
IRB.conf[:PROMPT][:MY_PROMPT] = { # ¥×¥í¥ó¥×¥È¥â¡¼¥É¤Î̾Á°
:PROMPT_I => nil, # Ä̾ï¤Î¥×¥í¥ó¥×¥È
- :PROMPT_N => nil, # ·Ñ³¹Ô¤Î¥×¥í¥ó¥×¥È
:PROMPT_S => nil, # ʸ»úÎó¤Ê¤É¤Î·Ñ³¹Ô¤Î¥×¥í¥ó¥×¥È
:PROMPT_C => nil, # ¼°¤¬·Ñ³¤·¤Æ¤¤¤ë»þ¤Î¥×¥í¥ó¥×¥È
:RETURN => " ==>%s\n" # ¥ê¥¿¡¼¥ó»þ¤Î¥×¥í¥ó¥×¥È
@@ -127,7 +126,7 @@ OK¤Ç¤¹.
IRB.conf[:PROMPT_MODE] = :MY_PROMPT
-PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_C¤Ï, ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤷ¤Þ¤¹.
+PROMPT_I, PROMPT_S, PROMPT_C¤Ï, ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤷ¤Þ¤¹.
%N µ¯Æ°¤·¤Æ¤¤¤ë¥³¥Þ¥ó¥É̾¤¬½ÐÎϤµ¤ì¤ë.
%m main¥ª¥Ö¥¸¥§¥¯¥È(self)¤¬to_s¤Ç½ÐÎϤµ¤ì¤ë.
@@ -142,7 +141,6 @@ PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_C¤Ï, ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤷ¤Þ¤¹.
IRB.conf[:PROMPT_MODE][:DEFAULT] = {
:PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_N => "%N(%m):%03n:%i> ",
:PROMPT_S => "%N(%m):%03n:%i%l ",
:PROMPT_C => "%N(%m):%03n:%i* ",
:RETURN => "%s\n"
diff --git a/doc/shell.rd b/doc/shell.rd
index ae6855cbd8..02ee1b020a 100644
--- a/doc/shell.rd
+++ b/doc/shell.rd
@@ -1,7 +1,7 @@
-- shell.rb
$Release Version: 0.6.0 $
- $Revision: 1.2 $
- $Date: 2001/05/17 10:09:49 $
+ $Revision$
+ $Date$
by Keiju ISHITSUKA(keiju@ishitsuka.com)
=begin
diff --git a/doc/shell.rd.ja b/doc/shell.rd.ja
index aab9e5c7d2..073e71ea42 100644
--- a/doc/shell.rd.ja
+++ b/doc/shell.rd.ja
@@ -1,7 +1,7 @@
-- shell.rb
$Release Version: 0.6.0 $
- $Revision: 1.1 $
- $Date: 2001/07/19 05:42:06 $
+ $Revision$
+ $Date$
by Keiju ISHITSUKA(keiju@ishitsuka.com)
=begin
diff --git a/enum.c b/enum.c
index 112a5f820b..a745a6e604 100644
--- a/enum.c
+++ b/enum.c
@@ -2,8 +2,8 @@
enum.c -
- $Author: drbrain $
- $Date: 2006/06/15 01:24:40 $
+ $Author$
+ $Date$
created at: Fri Oct 1 15:15:19 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -80,10 +80,11 @@ enum_grep(obj, pat)
static VALUE
find_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
if (RTEST(rb_yield(i))) {
- *memo = i;
+ memo->u2.value = Qtrue;
+ memo->u1.value = i;
rb_iter_break();
}
return Qnil;
@@ -110,13 +111,13 @@ enum_find(argc, argv, obj)
VALUE* argv;
VALUE obj;
{
- VALUE memo = Qundef;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, Qfalse, 0);
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
- rb_iterate(rb_each, obj, find_i, (VALUE)&memo);
- if (memo != Qundef) {
- return memo;
+ rb_iterate(rb_each, obj, find_i, (VALUE)memo);
+ if (memo->u2.value) {
+ return memo->u1.value;
}
if (!NIL_P(if_none)) {
return rb_funcall(if_none, rb_intern("call"), 0, 0);
@@ -256,13 +257,14 @@ enum_to_a(obj)
static VALUE
inject_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
- if (*memo == Qundef) {
- *memo = i;
+ if (memo->u2.value) {
+ memo->u2.value = Qfalse;
+ memo->u1.value = i;
}
else {
- *memo = rb_yield_values(2, *memo, i);
+ memo->u1.value = rb_yield_values(2, memo->u1.value, i);
}
return Qnil;
}
@@ -303,13 +305,18 @@ enum_inject(argc, argv, obj)
int argc;
VALUE *argv, obj;
{
- VALUE memo = Qundef;
+ NODE *memo;
+ VALUE n;
- if (rb_scan_args(argc, argv, "01", &memo) == 0)
- memo = Qundef;
- rb_iterate(rb_each, obj, inject_i, (VALUE)&memo);
- if (memo == Qundef) return Qnil;
- return memo;
+ if (rb_scan_args(argc, argv, "01", &n) == 1) {
+ memo = rb_node_newnode(NODE_MEMO, n, Qfalse, 0);
+ }
+ else {
+ memo = rb_node_newnode(NODE_MEMO, Qnil, Qtrue, 0);
+ }
+ rb_iterate(rb_each, obj, inject_i, (VALUE)memo);
+ n = memo->u1.value;
+ return n;
}
static VALUE
@@ -500,10 +507,10 @@ enum_sort_by(obj)
static VALUE
all_iter_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
if (!RTEST(rb_yield(i))) {
- *memo = Qfalse;
+ memo->u1.value = Qfalse;
rb_iter_break();
}
return Qnil;
@@ -512,10 +519,10 @@ all_iter_i(i, memo)
static VALUE
all_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
if (!RTEST(i)) {
- *memo = Qfalse;
+ memo->u1.value = Qfalse;
rb_iter_break();
}
return Qnil;
@@ -542,19 +549,22 @@ static VALUE
enum_all(obj)
VALUE obj;
{
- VALUE result = Qtrue;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
- rb_iterate(rb_each, obj, rb_block_given_p() ? all_iter_i : all_i, (VALUE)&result);
+ memo->u1.value = Qtrue;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? all_iter_i : all_i, (VALUE)memo);
+ result = memo->u1.value;
return result;
}
static VALUE
any_iter_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
if (RTEST(rb_yield(i))) {
- *memo = Qtrue;
+ memo->u1.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -563,10 +573,10 @@ any_iter_i(i, memo)
static VALUE
any_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
if (RTEST(i)) {
- *memo = Qtrue;
+ memo->u1.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -578,7 +588,7 @@ any_i(i, memo)
*
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block ever returns a value other
- * than <code>false</code> or <code>nil</code>. If the block is not
+ * that <code>false</code> or <code>nil</code>. If the block is not
* given, Ruby adds an implicit block of <code>{|obj| obj}</code> (that
* is <code>any?</code> will return <code>true</code> if at least one
* of the collection members is not <code>false</code> or
@@ -594,26 +604,29 @@ static VALUE
enum_any(obj)
VALUE obj;
{
- VALUE result = Qfalse;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
- rb_iterate(rb_each, obj, rb_block_given_p() ? any_iter_i : any_i, (VALUE)&result);
+ memo->u1.value = Qfalse;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? any_iter_i : any_i, (VALUE)memo);
+ result = memo->u1.value;
return result;
}
static VALUE
min_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
VALUE cmp;
- if (*memo == Qundef) {
- *memo = i;
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
}
else {
- cmp = rb_funcall(i, id_cmp, 1, *memo);
- if (rb_cmpint(cmp, i, *memo) < 0) {
- *memo = i;
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -622,17 +635,17 @@ min_i(i, memo)
static VALUE
min_ii(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
VALUE cmp;
- if (*memo == Qundef) {
- *memo = i;
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
}
else {
- cmp = rb_yield_values(2, i, *memo);
- if (rb_cmpint(cmp, i, *memo) < 0) {
- *memo = i;
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -657,10 +670,11 @@ static VALUE
enum_min(obj)
VALUE obj;
{
- VALUE result = Qundef;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
- rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)&result);
- if (result == Qundef) return Qnil;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)memo);
+ result = memo->u1.value;
return result;
}
@@ -681,17 +695,17 @@ enum_min(obj)
static VALUE
max_i(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
VALUE cmp;
- if (*memo == Qundef) {
- *memo = i;
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
}
else {
- cmp = rb_funcall(i, id_cmp, 1, *memo);
- if (rb_cmpint(cmp, i, *memo) > 0) {
- *memo = i;
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -700,17 +714,17 @@ max_i(i, memo)
static VALUE
max_ii(i, memo)
VALUE i;
- VALUE *memo;
+ NODE *memo;
{
VALUE cmp;
- if (*memo == Qundef) {
- *memo = i;
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
}
else {
- cmp = rb_yield_values(2, i, *memo);
- if (rb_cmpint(cmp, i, *memo) > 0) {
- *memo = i;
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
}
}
return Qnil;
@@ -734,20 +748,21 @@ static VALUE
enum_max(obj)
VALUE obj;
{
- VALUE result = Qundef;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
- rb_iterate(rb_each, obj, rb_block_given_p() ? max_ii : max_i, (VALUE)&result);
- if (result == Qundef) return Qnil;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? max_ii : max_i, (VALUE)memo);
+ result = memo->u1.value;
return result;
}
static VALUE
member_i(item, memo)
VALUE item;
- VALUE *memo;
+ NODE *memo;
{
- if (rb_equal(item, memo[0])) {
- memo[1] = Qtrue;
+ if (rb_equal(item, memo->u1.value)) {
+ memo->u2.value = Qtrue;
rb_iter_break();
}
return Qnil;
@@ -770,21 +785,21 @@ static VALUE
enum_member(obj, val)
VALUE obj, val;
{
- VALUE memo[2];
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, val, Qfalse, 0);
- memo[0] = val;
- memo[1] = Qfalse;
rb_iterate(rb_each, obj, member_i, (VALUE)memo);
- return memo[1];
+ result = memo->u2.value;
+ return result;
}
static VALUE
each_with_index_i(val, memo)
VALUE val;
- VALUE *memo;
+ NODE *memo;
{
- rb_yield_values(2, val, INT2FIX(*memo));
- ++*memo;
+ rb_yield_values(2, val, INT2FIX(memo->u3.cnt));
+ memo->u3.cnt++;
return Qnil;
}
@@ -807,21 +822,20 @@ static VALUE
enum_each_with_index(obj)
VALUE obj;
{
- VALUE memo = 0;
+ NODE *memo = rb_node_newnode(NODE_MEMO, 0, 0, 0);
- rb_need_block();
- rb_iterate(rb_each, obj, each_with_index_i, (VALUE)&memo);
+ rb_iterate(rb_each, obj, each_with_index_i, (VALUE)memo);
return obj;
}
static VALUE
zip_i(val, memo)
VALUE val;
- VALUE *memo;
+ NODE *memo;
{
- VALUE result = memo[0];
- VALUE args = memo[1];
- int idx = memo[2]++;
+ VALUE result = memo->u1.value;
+ VALUE args = memo->u2.value;
+ int idx = memo->u3.cnt++;
VALUE tmp;
int i;
@@ -870,15 +884,13 @@ enum_zip(argc, argv, obj)
{
int i;
VALUE result;
- VALUE memo[3];
+ NODE *memo;
for (i=0; i<argc; i++) {
argv[i] = rb_convert_type(argv[i], T_ARRAY, "Array", "to_a");
}
result = rb_block_given_p() ? Qnil : rb_ary_new();
- memo[0] = result;
- memo[1] = rb_ary_new4(argc, argv);
- memo[2] = 0;
+ memo = rb_node_newnode(NODE_MEMO, result, rb_ary_new4(argc, argv), 0);
rb_iterate(rb_each, obj, zip_i, (VALUE)memo);
return result;
diff --git a/env.h b/env.h
index 196090f387..c47c01d9db 100644
--- a/env.h
+++ b/env.h
@@ -2,8 +2,8 @@
env.h -
- $Author: matz $
- $Date: 2006/02/13 09:10:55 $
+ $Author$
+ $Date$
created at: Mon Jul 11 11:53:03 JST 1994
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -16,6 +16,7 @@
extern struct FRAME {
VALUE self;
int argc;
+ VALUE *argv;
ID last_func;
ID orig_func;
VALUE last_class;
@@ -29,8 +30,8 @@ extern struct FRAME {
void rb_gc_mark_frame _((struct FRAME *));
-#define FRAME_DMETH 1
-#define FRAME_FUNC 2
+#define FRAME_ALLOCA 0
+#define FRAME_MALLOC 1
extern struct SCOPE {
struct RBasic super;
@@ -43,7 +44,6 @@ extern struct SCOPE {
#define SCOPE_MALLOC 1
#define SCOPE_NOSTACK 2
#define SCOPE_DONT_RECYCLE 4
-#define SCOPE_CLONE 8
extern int ruby_in_eval;
diff --git a/error.c b/error.c
index 34af299823..f4fbb10511 100644
--- a/error.c
+++ b/error.c
@@ -2,8 +2,8 @@
error.c -
- $Author: matz $
- $Date: 2006/07/20 07:04:13 $
+ $Author$
+ $Date$
created at: Mon Aug 9 16:11:34 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -303,7 +303,7 @@ VALUE rb_eNoMethodError;
VALUE rb_eSecurityError;
VALUE rb_eNotImpError;
VALUE rb_eNoMemError;
-VALUE rb_cNameErrorMesg;
+static VALUE rb_cNameErrorMesg;
VALUE rb_eScriptError;
VALUE rb_eSyntaxError;
@@ -553,7 +553,7 @@ exit_initialize(argc, argv, exc)
status = *argv++;
--argc;
}
- rb_call_super(argc, argv);
+ exc_initialize(argc, argv, exc);
rb_iv_set(exc, "status", status);
return exc;
}
@@ -633,7 +633,7 @@ name_err_initialize(argc, argv, self)
VALUE name;
name = (argc > 1) ? argv[--argc] : Qnil;
- rb_call_super(argc, argv);
+ exc_initialize(argc, argv, self);
rb_iv_set(self, "name", name);
return self;
}
@@ -678,7 +678,7 @@ name_err_to_s(exc)
* call-seq:
* NoMethodError.new(msg, name [, args]) => no_method_error
*
- * Construct a NoMethodError exception for a method of the given name
+ * Contruct a NoMethodError exception for a method of the given name
* called with the given arguments. The name may be accessed using
* the <code>#name</code> method on the resulting object, and the
* arguments using the <code>#args</code> method.
@@ -907,19 +907,16 @@ syserr_initialize(argc, argv, self)
else err = "unknown error";
if (!NIL_P(mesg)) {
VALUE str = mesg;
- size_t len;
-
StringValue(str);
- len = strlen(err)+RSTRING(str)->len+3;
- mesg = rb_str_new(0, len);
- snprintf(RSTRING(mesg)->ptr, len+1, "%s - %.*s", err,
+ mesg = rb_str_new(0, strlen(err)+RSTRING(str)->len+3);
+ sprintf(RSTRING(mesg)->ptr, "%s - %.*s", err,
(int)RSTRING(str)->len, RSTRING(str)->ptr);
rb_str_resize(mesg, strlen(RSTRING(mesg)->ptr));
}
else {
mesg = rb_str_new2(err);
}
- rb_call_super(1, &mesg);
+ exc_initialize(1, &mesg, self);
rb_iv_set(self, "errno", error);
return self;
}
@@ -1083,7 +1080,7 @@ void
rb_notimplement()
{
rb_raise(rb_eNotImpError,
- "the %s() function is unimplemented on this machine",
+ "The %s() function is unimplemented on this machine",
rb_id2name(ruby_frame->last_func));
}
@@ -1111,6 +1108,7 @@ void
rb_sys_fail(mesg)
const char *mesg;
{
+ extern int errno;
int n = errno;
VALUE arg;
diff --git a/eval.c b/eval.c
index 991792c875..a8a3cb19e2 100644
--- a/eval.c
+++ b/eval.c
@@ -2,8 +2,8 @@
eval.c -
- $Author: shyouhei $
- $Date: 2007/01/27 15:45:49 $
+ $Author$
+ $Date$
created at: Thu Jun 10 14:22:17 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -32,8 +32,9 @@
#if defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT)
#include <ucontext.h>
#define USE_CONTEXT
-#endif
+#else
#include <setjmp.h>
+#endif
#include "st.h"
#include "dln.h"
@@ -53,7 +54,9 @@
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
-# ifndef _AIX
+# ifdef _AIX
+ #pragma alloca
+# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca ();
# endif
@@ -95,6 +98,8 @@ typedef struct {
volatile int status;
} rb_jmpbuf_t[1];
+#undef longjmp
+#undef setjmp
NORETURN(static void rb_jump_context(rb_jmpbuf_t, int));
static inline void
rb_jump_context(env, val)
@@ -105,110 +110,16 @@ rb_jump_context(env, val)
setcontext(&env->context);
abort(); /* ensure noreturn */
}
-/*
- * PRE_GETCONTEXT and POST_GETCONTEXT is a magic for getcontext, gcc,
- * IA64 register stack and SPARC register window combination problem.
- *
- * Assume following code sequence.
- *
- * 1. set a register in the register stack/window such as r32/l0.
- * 2. call getcontext.
- * 3. use the register.
- * 4. update the register for other use.
- * 5. call setcontext indirectly (or directly).
- *
- * This code should be run as 1->2->3->4->5->3->4.
- * But after second getcontext return (second 3),
- * the register is broken (updated).
- * It's because getcontext/setcontext doesn't preserve the content of the
- * register stack/window.
- *
- * setjmp also doesn't preserve the content of the register stack/window.
- * But it has not the problem because gcc knows setjmp may return twice.
- * gcc detects setjmp and generates setjmp safe code.
- *
- * So setjmp calls before and after the getcontext call makes the code
- * somewhat safe.
- * It fix the problem on IA64.
- * It is not required that setjmp is called at run time, since the problem is
- * register usage.
- *
- * Since the magic setjmp is not enough for SPARC,
- * inline asm is used to prohibit registers in register windows.
- *
- * Since the problem is fixed at gcc 4.0.3, the magic is applied only for
- * prior versions of gcc.
- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21957
- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22127
- */
-# define GCC_VERSION_BEFORE(major, minor, patchlevel) \
- (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
- ((__GNUC__ < (major)) || \
- (__GNUC__ == (major) && __GNUC_MINOR__ < (minor)) || \
- (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ < (patchlevel))))
-# if GCC_VERSION_BEFORE(4,0,3) && (defined(sparc) || defined(__sparc__))
-# ifdef __pic__
-/*
- * %l7 is excluded for PIC because it is PIC register.
- * http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
- */
-# define PRE_GETCONTEXT \
- ({ __asm__ volatile ("" : : : \
- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-# else
-# define PRE_GETCONTEXT \
- ({ __asm__ volatile ("" : : : \
- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-# endif
-# define POST_GETCONTEXT PRE_GETCONTEXT
-# elif GCC_VERSION_BEFORE(4,0,3) && defined(__ia64)
-static jmp_buf function_call_may_return_twice_jmp_buf;
-int function_call_may_return_twice_false_1 = 0;
-int function_call_may_return_twice_false_2 = 0;
-# define PRE_GETCONTEXT \
- (function_call_may_return_twice_false_1 ? \
- setjmp(function_call_may_return_twice_jmp_buf) : \
- 0)
-# define POST_GETCONTEXT \
- (function_call_may_return_twice_false_2 ? \
- setjmp(function_call_may_return_twice_jmp_buf) : \
- 0)
-# elif defined(__FreeBSD__) && __FreeBSD__ < 7
-/*
- * workaround for FreeBSD/i386 getcontext/setcontext bug.
- * clear the carry flag by (0 ? ... : ...).
- * FreeBSD PR 92110 http://www.freebsd.org/cgi/query-pr.cgi?pr=92110
- * [ruby-dev:28263]
- */
-static int volatile freebsd_clear_carry_flag = 0;
-# define PRE_GETCONTEXT \
- (freebsd_clear_carry_flag ? (freebsd_clear_carry_flag = 0) : 0)
-# endif
-# ifndef PRE_GETCONTEXT
-# define PRE_GETCONTEXT 0
-# endif
-# ifndef POST_GETCONTEXT
-# define POST_GETCONTEXT 0
-# endif
-# define ruby_longjmp(env, val) rb_jump_context(env, val)
-# define ruby_setjmp(j) ((j)->status = 0, \
- PRE_GETCONTEXT, \
- getcontext(&(j)->context), \
- POST_GETCONTEXT, \
- (j)->status)
+#define longjmp(env, val) rb_jump_context(env, val)
+#define setjmp(j) ((j)->status = 0, getcontext(&(j)->context), (j)->status)
#else
typedef jmp_buf rb_jmpbuf_t;
-# if !defined(setjmp) && defined(HAVE__SETJMP)
-# define ruby_setjmp(env) _setjmp(env)
-# define ruby_longjmp(env,val) _longjmp(env,val)
-# else
-# define ruby_setjmp(env) setjmp(env)
-# define ruby_longjmp(env,val) longjmp(env,val)
-# endif
+#ifndef setjmp
+#ifdef HAVE__SETJMP
+#define setjmp(env) _setjmp(env)
+#define longjmp(env,val) _longjmp(env,val)
+#endif
+#endif
#endif
#include <sys/types.h>
@@ -226,16 +137,15 @@ typedef jmp_buf rb_jmpbuf_t;
#include <sys/stat.h>
VALUE rb_cProc;
-VALUE rb_cBinding;
+static VALUE rb_cBinding;
static VALUE proc_invoke _((VALUE,VALUE,VALUE,VALUE));
static VALUE rb_f_binding _((VALUE));
static void rb_f_END _((void));
static VALUE rb_f_block_given_p _((void));
static VALUE block_pass _((VALUE,NODE*));
-
-VALUE rb_cMethod;
+static VALUE rb_cMethod;
static VALUE method_call _((int, VALUE*, VALUE));
-VALUE rb_cUnboundMethod;
+static VALUE rb_cUnboundMethod;
static VALUE umethod_bind _((VALUE, VALUE));
static VALUE rb_mod_define_method _((int, VALUE*, VALUE));
NORETURN(static void rb_raise_jump _((VALUE)));
@@ -365,8 +275,7 @@ rb_clear_cache_for_undef(klass, id)
if (!ruby_running) return;
ent = cache; end = ent + CACHE_SIZE;
while (ent < end) {
- if (ent->mid == id &&
- RCLASS(ent->origin)->m_tbl == RCLASS(klass)->m_tbl) {
+ if (ent->origin == klass && ent->mid == id) {
ent->mid = 0;
}
ent++;
@@ -409,11 +318,6 @@ static ID init, eqq, each, aref, aset, match, missing;
static ID added, singleton_added;
static ID __id__, __send__, respond_to;
-#define NOEX_TAINTED 8
-#define NOEX_SAFE(n) ((n) >> 4)
-#define NOEX_WITH(n, v) ((n) | (v) << 4)
-#define NOEX_WITH_SAFE(n) NOEX_WITH(n, ruby_safe_level)
-
void
rb_add_method(klass, mid, node, noex)
VALUE klass;
@@ -440,7 +344,7 @@ rb_add_method(klass, mid, node, noex)
}
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
rb_clear_cache_by_id(mid);
- body = NEW_METHOD(node, NOEX_WITH_SAFE(noex));
+ body = NEW_METHOD(node, noex);
st_insert(RCLASS(klass)->m_tbl, mid, (st_data_t)body);
if (node && mid != ID_ALLOCATOR && ruby_running) {
if (FL_TEST(klass, FL_SINGLETON)) {
@@ -701,7 +605,6 @@ rb_attr(klass, id, read, write, ex)
char *buf;
ID attriv;
int noex;
- size_t len;
if (!ex) noex = NOEX_PUBLIC;
else {
@@ -719,22 +622,20 @@ rb_attr(klass, id, read, write, ex)
}
}
- if (!rb_is_local_id(id) && !rb_is_const_id(id)) {
- rb_name_error(id, "invalid attribute name `%s'", rb_id2name(id));
- }
name = rb_id2name(id);
if (!name) {
rb_raise(rb_eArgError, "argument needs to be symbol or string");
}
- len = strlen(name)+2;
- buf = ALLOCA_N(char,len);
- snprintf(buf, len, "@%s", name);
+ buf = ALLOCA_N(char,strlen(name)+2);
+ sprintf(buf, "@%s", name);
attriv = rb_intern(buf);
if (read) {
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
}
if (write) {
- rb_add_method(klass, rb_id_attrset(id), NEW_ATTRSET(attriv), noex);
+ sprintf(buf, "%s=", name);
+ id = rb_intern(buf);
+ rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
}
}
@@ -745,8 +646,8 @@ extern NODE *ruby_eval_tree_begin;
extern NODE *ruby_eval_tree;
extern int ruby_nerrs;
-VALUE rb_eLocalJumpError;
-VALUE rb_eSysStackError;
+static VALUE rb_eLocalJumpError;
+static VALUE rb_eSysStackError;
extern VALUE ruby_top_self;
@@ -764,7 +665,8 @@ static unsigned long frame_unique = 0;
_frame.node = ruby_current_node; \
_frame.iter = ruby_iter->iter; \
_frame.argc = 0; \
- _frame.flags = 0; \
+ _frame.argv = 0; \
+ _frame.flags = FRAME_ALLOCA; \
_frame.uniq = frame_unique++; \
ruby_frame = &_frame
@@ -797,7 +699,7 @@ struct BLOCK {
#define BLOCK_LAMBDA 2
static struct BLOCK *ruby_block;
-static unsigned long block_unique = 1;
+static unsigned long block_unique = 0;
#define PUSH_BLOCK(v,b) do { \
struct BLOCK _block; \
@@ -843,8 +745,6 @@ struct RVarmap *ruby_dyna_vars;
#define DVAR_DONT_RECYCLE FL_USER2
-#define DMETHOD_P() (ruby_frame->flags & FRAME_DMETH)
-
static struct RVarmap*
new_dvar(id, value, prev)
ID id;
@@ -983,7 +883,6 @@ static struct iter *ruby_iter;
#define ITER_NOT 0
#define ITER_PRE 1
#define ITER_CUR 2
-#define ITER_PAS 3
#define PUSH_ITER(i) do { \
struct iter _iter; \
@@ -1027,12 +926,12 @@ static struct tag *prot_tag;
#define PROT_LAMBDA INT2FIX(2) /* 5 */
#define PROT_YIELD INT2FIX(3) /* 7 */
-#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, ruby_setjmp(prot_tag->buf))
+#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, setjmp(prot_tag->buf))
#define JUMP_TAG(st) do { \
ruby_frame = prot_tag->frame; \
ruby_iter = prot_tag->iter; \
- ruby_longjmp(prot_tag->buf,(st)); \
+ longjmp(prot_tag->buf,(st)); \
} while (0)
#define POP_TAG() \
@@ -1118,32 +1017,9 @@ static VALUE module_setup _((VALUE,NODE*));
static VALUE massign _((VALUE,NODE*,VALUE,int));
static void assign _((VALUE,NODE*,VALUE,int));
-typedef struct event_hook {
- rb_event_hook_func_t func;
- rb_event_t events;
- struct event_hook *next;
-} rb_event_hook_t;
-
-static rb_event_hook_t *event_hooks;
-
-#define EXEC_EVENT_HOOK(event, node, self, id, klass) \
- do { \
- rb_event_hook_t *hook = event_hooks; \
- rb_event_hook_func_t hook_func; \
- rb_event_t events; \
- \
- while (hook) { \
- hook_func = hook->func; \
- events = hook->events; \
- hook = hook->next; \
- if (events & event) \
- (*hook_func)(event, node, self, id, klass); \
- } \
- } while (0)
-
static VALUE trace_func = 0;
static int tracing = 0;
-static void call_trace_func _((rb_event_t,NODE*,VALUE,ID,VALUE));
+static void call_trace_func _((char*,NODE*,VALUE,ID,VALUE));
#if 0
#define SET_CURRENT_SOURCE() (ruby_sourcefile = ruby_current_node->nd_file, \
@@ -1189,7 +1065,7 @@ error_pos()
if (ruby_sourcefile) {
if (ruby_frame->last_func) {
warn_printf("%s:%d:in `%s'", ruby_sourcefile, ruby_sourceline,
- rb_id2name(ruby_frame->orig_func));
+ rb_id2name(ruby_frame->last_func));
}
else if (ruby_sourceline == 0) {
warn_printf("%s", ruby_sourcefile);
@@ -1342,15 +1218,6 @@ int
is_ruby_native_thread() {
return NATIVETHREAD_EQUAL(ruby_thid, NATIVETHREAD_CURRENT());
}
-
-# ifdef HAVE_NATIVETHREAD_KILL
-void
-ruby_native_thread_kill(sig)
- int sig;
-{
- NATIVETHREAD_KILL(ruby_thid, sig);
-}
-# endif
#endif
void
@@ -1397,7 +1264,7 @@ ruby_init()
#ifdef __MACOS__
_macruby_init();
#elif defined(__VMS)
- _vmsruby_init();
+ _vmsruby_init();
#endif
ruby_prog_init();
ALLOW_INTS;
@@ -1441,14 +1308,6 @@ static VALUE exception_error;
static VALUE sysstack_error;
static int
-sysexit_status(err)
- VALUE err;
-{
- VALUE st = rb_iv_get(err, "status");
- return NUM2INT(st);
-}
-
-static int
error_handle(ex)
int ex;
{
@@ -1494,7 +1353,8 @@ error_handle(ex)
case TAG_RAISE:
case TAG_FATAL:
if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
- status = sysexit_status(ruby_errinfo);
+ VALUE st = rb_iv_get(ruby_errinfo, "status");
+ status = NUM2INT(st);
}
else {
error_print();
@@ -1515,6 +1375,10 @@ ruby_options(argc, argv)
{
int state;
+#ifdef _WIN32
+ argc = rb_w32_cmdvector(GetCommandLine(), &argv);
+#endif
+
Init_stack((void*)&state);
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
@@ -1526,6 +1390,11 @@ ruby_options(argc, argv)
exit(error_handle(state));
}
POP_TAG();
+
+#ifdef _WIN32_WCE
+ // free commandline buffer
+ wce_FreeCommandLine();
+#endif
}
void rb_exec_end_proc _((void));
@@ -1693,6 +1562,7 @@ rb_eval_string_wrap(str, state)
rb_extend_object(ruby_top_self, ruby_wrapper);
PUSH_FRAME();
ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = self;
PUSH_CREF(ruby_wrapper);
@@ -1834,6 +1704,7 @@ rb_eval_cmd(cmd, arg, level)
ruby_scope = top_scope;
PUSH_FRAME();
ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
ruby_frame->last_class = 0;
ruby_frame->self = ruby_top_self;
PUSH_CREF(ruby_wrapper ? ruby_wrapper : rb_cObject);
@@ -1869,13 +1740,12 @@ ev_const_defined(cref, id, self)
while (cbase && cbase->nd_next) {
struct RClass *klass = RCLASS(cbase->nd_clss);
- if (!NIL_P(klass)) {
- if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) {
- if (result == Qundef && NIL_P(rb_autoload_p((VALUE)klass, id))) {
- return Qfalse;
- }
- return Qtrue;
+ if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id);
+ if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) {
+ if (result == Qundef && NIL_P(rb_autoload_p((VALUE)klass, id))) {
+ return Qfalse;
}
+ return Qtrue;
}
cbase = cbase->nd_next;
}
@@ -1894,19 +1764,17 @@ ev_const_get(cref, id, self)
while (cbase && cbase->nd_next) {
VALUE klass = cbase->nd_clss;
- if (!NIL_P(klass)) {
- while (RCLASS(klass)->iv_tbl &&
- st_lookup(RCLASS(klass)->iv_tbl, id, &result)) {
- if (result == Qundef) {
- if (!RTEST(rb_autoload_load(klass, id))) break;
- continue;
- }
- return result;
+ if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id);
+ while (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, &result)) {
+ if (result == Qundef) {
+ rb_autoload_load(klass, id);
+ continue;
}
+ return result;
}
cbase = cbase->nd_next;
}
- return rb_const_get(NIL_P(cref->nd_clss) ? CLASS_OF(self): cref->nd_clss, id);
+ return rb_const_get(cref->nd_clss, id);
}
static VALUE
@@ -2159,8 +2027,7 @@ rb_alias(klass, name, def)
}
}
st_insert(RCLASS(klass)->m_tbl, name,
- (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin),
- NOEX_WITH_SAFE(orig->nd_noex)));
+ (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
if (singleton) {
rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
}
@@ -2219,26 +2086,26 @@ copy_node_scope(node, rval)
#ifdef C_ALLOCA
# define TMP_PROTECT NODE * volatile tmp__protect_tmp=0
# define TMP_ALLOC(n) \
- (tmp__protect_tmp = NEW_NODE(NODE_ALLOCA, \
- ALLOC_N(VALUE,n),tmp__protect_tmp,n), \
+ (tmp__protect_tmp = rb_node_newnode(NODE_ALLOCA, \
+ ALLOC_N(VALUE,n),tmp__protect_tmp,n), \
(void*)tmp__protect_tmp->nd_head)
#else
# define TMP_PROTECT typedef int foobazzz
# define TMP_ALLOC(n) ALLOCA_N(VALUE,n)
#endif
-#define SETUP_ARGS0(anode,extra) do {\
+#define SETUP_ARGS0(anode,alen) do {\
NODE *n = anode;\
if (!n) {\
argc = 0;\
argv = 0;\
}\
else if (nd_type(n) == NODE_ARRAY) {\
- argc=anode->nd_alen;\
+ argc=alen;\
if (argc > 0) {\
int i;\
n = anode;\
- argv = TMP_ALLOC(argc+extra);\
+ argv = TMP_ALLOC(argc);\
for (i=0;i<argc;i++) {\
argv[i] = rb_eval(self,n->nd_head);\
n=n->nd_next;\
@@ -2254,20 +2121,18 @@ copy_node_scope(node, rval)
if (TYPE(args) != T_ARRAY)\
args = rb_ary_to_ary(args);\
argc = RARRAY(args)->len;\
- argv = TMP_ALLOC(argc+extra);\
+ argv = ALLOCA_N(VALUE, argc);\
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\
}\
} while (0)
-#define SETUP_ARGS(anode) SETUP_ARGS0(anode,0)
+#define SETUP_ARGS(anode) SETUP_ARGS0(anode, anode->nd_alen)
#define BEGIN_CALLARGS do {\
struct BLOCK *tmp_block = ruby_block;\
int tmp_iter = ruby_iter->iter;\
- switch (tmp_iter) {\
- case ITER_PRE:\
+ if (tmp_iter == ITER_PRE) {\
ruby_block = ruby_block->outer;\
- case ITER_PAS:\
tmp_iter = ITER_NOT;\
}\
PUSH_ITER(tmp_iter)
@@ -2322,7 +2187,7 @@ is_defined(self, node, buf)
switch (nd_type(node)) {
case NODE_SUPER:
case NODE_ZSUPER:
- if (ruby_frame->last_func == 0) return 0;
+ if (ruby_frame->orig_func == 0) return 0;
else if (ruby_frame->last_class == 0) return 0;
val = ruby_frame->last_class;
if (rb_method_boundp(RCLASS(val)->super, ruby_frame->orig_func, 0)) {
@@ -2406,7 +2271,6 @@ is_defined(self, node, buf)
case NODE_DASGN:
case NODE_DASGN_CURR:
case NODE_GASGN:
- case NODE_IASGN:
case NODE_CDECL:
case NODE_CVDECL:
case NODE_CVASGN:
@@ -2519,45 +2383,6 @@ rb_obj_is_proc(proc)
return Qfalse;
}
-void
-rb_add_event_hook(func, events)
- rb_event_hook_func_t func;
- rb_event_t events;
-{
- rb_event_hook_t *hook;
-
- hook = ALLOC(rb_event_hook_t);
- hook->func = func;
- hook->events = events;
- hook->next = event_hooks;
- event_hooks = hook;
-}
-
-int
-rb_remove_event_hook(func)
- rb_event_hook_func_t func;
-{
- rb_event_hook_t *prev, *hook;
-
- prev = NULL;
- hook = event_hooks;
- while (hook) {
- if (hook->func == func) {
- if (prev) {
- prev->next = hook->next;
- }
- else {
- event_hooks = hook->next;
- }
- xfree(hook);
- return 0;
- }
- prev = hook;
- hook = hook->next;
- }
- return -1;
-}
-
/*
* call-seq:
* set_trace_func(proc) => proc
@@ -2606,54 +2431,19 @@ static VALUE
set_trace_func(obj, trace)
VALUE obj, trace;
{
- rb_event_hook_t *hook;
-
- rb_secure(4);
if (NIL_P(trace)) {
trace_func = 0;
- rb_remove_event_hook(call_trace_func);
return Qnil;
}
if (!rb_obj_is_proc(trace)) {
rb_raise(rb_eTypeError, "trace_func needs to be Proc");
}
- trace_func = trace;
- for (hook = event_hooks; hook; hook = hook->next) {
- if (hook->func == call_trace_func)
- return trace;
- }
- rb_add_event_hook(call_trace_func, RUBY_EVENT_ALL);
- return trace;
-}
-
-static char *
-get_event_name(rb_event_t event)
-{
- switch (event) {
- case RUBY_EVENT_LINE:
- return "line";
- case RUBY_EVENT_CLASS:
- return "class";
- case RUBY_EVENT_END:
- return "end";
- case RUBY_EVENT_CALL:
- return "call";
- case RUBY_EVENT_RETURN:
- return "return";
- case RUBY_EVENT_C_CALL:
- return "c-call";
- case RUBY_EVENT_C_RETURN:
- return "c-return";
- case RUBY_EVENT_RAISE:
- return "raise";
- default:
- return "unknown";
- }
+ return trace_func = trace;
}
static void
call_trace_func(event, node, self, id, klass)
- rb_event_t event;
+ char *event;
NODE *node;
VALUE self;
ID id;
@@ -2663,7 +2453,6 @@ call_trace_func(event, node, self, id, klass)
struct FRAME *prev;
NODE *node_save;
VALUE srcfile;
- char *event_name;
if (!trace_func) return;
if (tracing) return;
@@ -2691,15 +2480,14 @@ call_trace_func(event, node, self, id, klass)
klass = RBASIC(klass)->klass;
}
else if (FL_TEST(klass, FL_SINGLETON)) {
- klass = rb_iv_get(klass, "__attached__");
+ klass = self;
}
}
PUSH_TAG(PROT_NONE);
raised = thread_reset_raised();
if ((state = EXEC_TAG()) == 0) {
srcfile = rb_str_new2(ruby_sourcefile?ruby_sourcefile:"(ruby)");
- event_name = get_event_name(event);
- proc_invoke(trace_func, rb_ary_new3(6, rb_str_new2(event_name),
+ proc_invoke(trace_func, rb_ary_new3(6, rb_str_new2(event),
srcfile,
INT2FIX(ruby_sourceline),
id?ID2SYM(id):Qnil,
@@ -2757,7 +2545,7 @@ svalue_to_avalue(v)
if (RARRAY(tmp)->len == 1) {
top = rb_check_array_type(RARRAY(tmp)->ptr[0]);
if (!NIL_P(top) && RARRAY(top)->len > 1) {
- return tmp;
+ return v;
}
return rb_ary_new3(1, v);
}
@@ -2871,24 +2659,6 @@ class_prefix(self, cpath)
NORETURN(static void return_jump _((VALUE)));
NORETURN(static void break_jump _((VALUE)));
-NORETURN(static void next_jump _((VALUE)));
-NORETURN(static void unknown_node _((NODE * volatile)));
-
-static void
-unknown_node(node)
- NODE *volatile node;
-{
- ruby_current_node = 0;
- if (node->flags == 0) {
- rb_bug("terminated node (0x%lx)", node);
- }
- else if (BUILTIN_TYPE(node) != T_NODE) {
- rb_bug("not a node 0x%02lx (0x%lx)", BUILTIN_TYPE(node), node);
- }
- else {
- rb_bug("unknown node type %d (0x%lx)", nd_type(node), node);
- }
-}
static VALUE
rb_eval(self, n)
@@ -2998,9 +2768,11 @@ rb_eval(self, n)
RETURN(Qfalse);
case NODE_IF:
- EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
- ruby_frame->last_func,
- ruby_frame->last_class);
+ if (trace_func) {
+ call_trace_func("line", node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
if (RTEST(rb_eval(self, node->nd_cond))) {
node = node->nd_body;
}
@@ -3016,9 +2788,11 @@ rb_eval(self, n)
if (nd_type(node) != NODE_WHEN) goto again;
tag = node->nd_head;
while (tag) {
- EXEC_EVENT_HOOK(RUBY_EVENT_LINE, tag, self,
- ruby_frame->last_func,
- ruby_frame->last_class);
+ if (trace_func) {
+ call_trace_func("line", tag, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
if (tag->nd_head && nd_type(tag->nd_head) == NODE_WHEN) {
VALUE v = rb_eval(self, tag->nd_head->nd_head);
long i;
@@ -3057,9 +2831,11 @@ rb_eval(self, n)
}
tag = node->nd_head;
while (tag) {
- EXEC_EVENT_HOOK(RUBY_EVENT_LINE, tag, self,
- ruby_frame->last_func,
- ruby_frame->last_class);
+ if (trace_func) {
+ call_trace_func("line", tag, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
if (tag->nd_head && nd_type(tag->nd_head) == NODE_WHEN) {
VALUE v = rb_eval(self, tag->nd_head->nd_head);
long i;
@@ -3210,7 +2986,8 @@ rb_eval(self, n)
case NODE_NEXT:
CHECK_INTS;
- next_jump(rb_eval(self, node->nd_stts));
+ return_value(rb_eval(self, node->nd_stts));
+ JUMP_TAG(TAG_NEXT);
break;
case NODE_REDO:
@@ -3292,6 +3069,7 @@ rb_eval(self, n)
POP_TAG();
if (state != TAG_RAISE) ruby_errinfo = e_info;
if (state) {
+ if (state == TAG_NEXT) prot_tag->retval = result;
JUMP_TAG(state);
}
/* no exception raised */
@@ -3337,11 +3115,19 @@ rb_eval(self, n)
case NODE_DOT2:
case NODE_DOT3:
- {
- VALUE beg = rb_eval(self, node->nd_beg);
- VALUE end = rb_eval(self, node->nd_end);
- result = rb_range_new(beg, end, nd_type(node) == NODE_DOT3);
- }
+ result = rb_range_new(rb_eval(self, node->nd_beg),
+ rb_eval(self, node->nd_end),
+ nd_type(node) == NODE_DOT3);
+ if (node->nd_state) break;
+ if (nd_type(node->nd_beg) == NODE_LIT && FIXNUM_P(node->nd_beg->nd_lit) &&
+ nd_type(node->nd_end) == NODE_LIT && FIXNUM_P(node->nd_end->nd_lit))
+ {
+ nd_set_type(node, NODE_LIT);
+ node->nd_lit = result;
+ }
+ else {
+ node->nd_state = 1;
+ }
break;
case NODE_FLIP2: /* like AWK */
@@ -3471,7 +3257,7 @@ rb_eval(self, n)
TMP_PROTECT;
if (ruby_frame->last_class == 0) {
- if (ruby_frame->last_func) {
+ if (ruby_frame->orig_func) {
rb_name_error(ruby_frame->last_func,
"superclass method `%s' disabled",
rb_id2name(ruby_frame->orig_func));
@@ -3482,17 +3268,7 @@ rb_eval(self, n)
}
if (nd_type(node) == NODE_ZSUPER) {
argc = ruby_frame->argc;
- if (argc && DMETHOD_P()) {
- if (TYPE(RBASIC(ruby_scope)->klass) != T_ARRAY ||
- RARRAY(RBASIC(ruby_scope)->klass)->len != argc) {
- rb_raise(rb_eRuntimeError,
- "super: specify arguments explicitly");
- }
- argv = RARRAY(RBASIC(ruby_scope)->klass)->ptr;
- }
- else {
- argv = ruby_scope->local_vars + 2;
- }
+ argv = ruby_frame->argv;
}
else {
BEGIN_CALLARGS;
@@ -3547,29 +3323,28 @@ rb_eval(self, n)
case NODE_OP_ASGN1:
{
int argc; VALUE *argv; /* used in SETUP_ARGS */
- VALUE recv, val, tmp;
+ VALUE recv, val;
NODE *rval;
TMP_PROTECT;
recv = rb_eval(self, node->nd_recv);
rval = node->nd_args->nd_head;
- SETUP_ARGS0(node->nd_args->nd_body, 1);
- val = rb_funcall3(recv, aref, argc, argv);
+ SETUP_ARGS0(node->nd_args->nd_next, node->nd_args->nd_alen - 1);
+ val = rb_funcall2(recv, aref, argc-1, argv);
switch (node->nd_mid) {
case 0: /* OR */
- if (RTEST(val)) RETURN(val);
- val = rb_eval(self, rval);
- break;
+ if (RTEST(val)) RETURN(val);
+ val = rb_eval(self, rval);
+ break;
case 1: /* AND */
- if (!RTEST(val)) RETURN(val);
- val = rb_eval(self, rval);
- break;
+ if (!RTEST(val)) RETURN(val);
+ val = rb_eval(self, rval);
+ break;
default:
- tmp = rb_eval(self, rval);
- val = rb_funcall3(val, node->nd_mid, 1, &tmp);
+ val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
}
- argv[argc] = val;
- rb_funcall2(recv, aset, argc+1, argv);
+ argv[argc-1] = val;
+ rb_funcall2(recv, aset, argc, argv);
result = val;
}
break;
@@ -3577,22 +3352,22 @@ rb_eval(self, n)
case NODE_OP_ASGN2:
{
ID id = node->nd_next->nd_vid;
- VALUE recv, val, tmp;
+ VALUE recv, val;
recv = rb_eval(self, node->nd_recv);
- val = rb_funcall3(recv, id, 0, 0);
+ val = rb_funcall(recv, id, 0);
switch (node->nd_next->nd_mid) {
case 0: /* OR */
- if (RTEST(val)) RETURN(val);
- val = rb_eval(self, node->nd_value);
- break;
+ if (RTEST(val)) RETURN(val);
+ val = rb_eval(self, node->nd_value);
+ break;
case 1: /* AND */
- if (!RTEST(val)) RETURN(val);
- val = rb_eval(self, node->nd_value);
- break;
+ if (!RTEST(val)) RETURN(val);
+ val = rb_eval(self, node->nd_value);
+ break;
default:
- tmp = rb_eval(self, node->nd_value);
- val = rb_funcall3(val, node->nd_next->nd_mid, 1, &tmp);
+ val = rb_funcall(val, node->nd_next->nd_mid, 1,
+ rb_eval(self, node->nd_value));
}
rb_funcall2(recv, node->nd_next->nd_aid, 1, &val);
@@ -3651,6 +3426,9 @@ rb_eval(self, n)
rb_const_set(class_prefix(self, node->nd_else), node->nd_else->nd_mid, result);
}
else {
+ if (NIL_P(ruby_cbase)) {
+ rb_raise(rb_eTypeError, "no class/module to define constant");
+ }
rb_const_set(ruby_cbase, node->nd_vid, result);
}
break;
@@ -3865,6 +3643,13 @@ rb_eval(self, n)
result = node->nd_lit;
break;
+ case NODE_ATTRSET:
+ if (ruby_frame->argc != 1)
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
+ ruby_frame->argc);
+ result = rb_ivar_set(self, node->nd_vid, ruby_frame->argv[0]);
+ break;
+
case NODE_DEFN:
if (node->nd_defn) {
NODE *body, *defn;
@@ -3949,7 +3734,7 @@ rb_eval(self, n)
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class to undef method");
}
- rb_undef(ruby_class, rb_to_id(rb_eval(self, node->u2.node)));
+ rb_undef(ruby_class, node->nd_mid);
result = Qnil;
break;
@@ -3957,13 +3742,12 @@ rb_eval(self, n)
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class to make alias");
}
- rb_alias(ruby_class, rb_to_id(rb_eval(self, node->u1.node)),
- rb_to_id(rb_eval(self, node->u2.node)));
+ rb_alias(ruby_class, node->nd_new, node->nd_old);
result = Qnil;
break;
case NODE_VALIAS:
- rb_alias_variable(node->u1.id, node->u2.id);
+ rb_alias_variable(node->nd_new, node->nd_old);
result = Qnil;
break;
@@ -4090,14 +3874,16 @@ rb_eval(self, n)
break;
case NODE_NEWLINE:
- EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
- ruby_frame->last_func,
- ruby_frame->last_class);
+ if (trace_func) {
+ call_trace_func("line", node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
node = node->nd_next;
goto again;
default:
- unknown_node(node);
+ rb_bug("unknown node type %d", nd_type(node));
}
finish:
CHECK_INTS;
@@ -4143,8 +3929,9 @@ module_setup(module, n)
PUSH_CREF(module);
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
- EXEC_EVENT_HOOK(RUBY_EVENT_CLASS, n, ruby_cbase,
- ruby_frame->last_func, ruby_frame->last_class);
+ if (trace_func) {
+ call_trace_func("class", n, ruby_cbase, ruby_frame->last_func, ruby_frame->last_class);
+ }
result = rb_eval(ruby_cbase, node->nd_next);
}
POP_TAG();
@@ -4154,8 +3941,9 @@ module_setup(module, n)
POP_CLASS();
ruby_frame = frame.tmp;
- EXEC_EVENT_HOOK(RUBY_EVENT_END, n, 0,
- ruby_frame->last_func, ruby_frame->last_class);
+ if (trace_func) {
+ call_trace_func("end", n, 0, ruby_frame->last_func, ruby_frame->last_class);
+ }
if (state) JUMP_TAG(state);
return result;
@@ -4164,32 +3952,21 @@ module_setup(module, n)
static NODE *basic_respond_to = 0;
int
-rb_obj_respond_to(obj, id, priv)
+rb_respond_to(obj, id)
VALUE obj;
ID id;
- int priv;
{
VALUE klass = CLASS_OF(obj);
-
- if (rb_method_node(klass, respond_to) == basic_respond_to) {
- return rb_method_boundp(klass, id, !priv);
+ if (rb_method_node(klass, respond_to) == basic_respond_to &&
+ rb_method_boundp(klass, id, 0)) {
+ return Qtrue;
}
- else {
- VALUE args[2];
- int n = 0;
- args[n++] = ID2SYM(id);
- if (priv) args[n++] = Qtrue;
- return rb_funcall2(obj, respond_to, n, args);
+ else{
+ return rb_funcall(obj, respond_to, 1, ID2SYM(id));
}
+ return Qfalse;
}
-int
-rb_respond_to(obj, id)
- VALUE obj;
- ID id;
-{
- return rb_obj_respond_to(obj, id, Qfalse);
-}
/*
* call-seq:
@@ -4201,7 +3978,7 @@ rb_respond_to(obj, id)
*/
static VALUE
-obj_respond_to(argc, argv, obj)
+rb_obj_respond_to(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
@@ -4372,15 +4149,16 @@ rb_mod_protected_method_defined(mod, mid)
return Qfalse;
}
-NORETURN(static VALUE terminate_process _((int, VALUE)));
+NORETURN(static VALUE terminate_process _((int, const char *, long)));
static VALUE
-terminate_process(status, mesg)
+terminate_process(status, mesg, mlen)
int status;
- VALUE mesg;
+ const char *mesg;
+ long mlen;
{
VALUE args[2];
args[0] = INT2NUM(status);
- args[1] = mesg;
+ args[1] = rb_str_new(mesg, mlen);
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
@@ -4390,7 +4168,7 @@ rb_exit(status)
int status;
{
if (prot_tag) {
- terminate_process(status, rb_str_new("exit", 4));
+ terminate_process(status, "exit", 4);
}
ruby_finalize();
exit(status);
@@ -4454,9 +4232,6 @@ rb_f_exit(argc, argv)
break;
default:
istatus = NUM2INT(status);
-#if EXIT_SUCCESS != 0
- if (istatus == 0) istatus = EXIT_SUCCESS;
-#endif
break;
}
}
@@ -4495,9 +4270,9 @@ rb_f_abort(argc, argv)
VALUE mesg;
rb_scan_args(argc, argv, "1", &mesg);
- StringValue(mesg);
- rb_io_puts(1, &mesg, rb_stderr);
- terminate_process(EXIT_FAILURE, mesg);
+ StringValue(argv[0]);
+ rb_io_puts(argc, argv, rb_stderr);
+ terminate_process(EXIT_FAILURE, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
}
return Qnil; /* not reached */
}
@@ -4563,8 +4338,8 @@ rb_longjmp(tag, mesg)
}
rb_trap_restore_mask();
- if (tag != TAG_FATAL) {
- EXEC_EVENT_HOOK(RUBY_EVENT_RAISE, ruby_current_node,
+ if (trace_func && tag != TAG_FATAL) {
+ call_trace_func("raise", ruby_current_node,
ruby_frame->self,
ruby_frame->last_func,
ruby_frame->last_class);
@@ -4813,9 +4588,6 @@ break_jump(retval)
tt->retval = retval;
JUMP_TAG(TAG_BREAK);
break;
- case PROT_FUNC:
- tt = 0;
- continue;
default:
break;
}
@@ -4824,40 +4596,6 @@ break_jump(retval)
localjump_error("unexpected break", retval, TAG_BREAK);
}
-static void
-next_jump(retval)
- VALUE retval;
-{
- struct tag *tt = prot_tag;
-
- if (retval == Qundef) retval = Qnil;
- while (tt) {
- switch (tt->tag) {
- case PROT_THREAD:
- case PROT_YIELD:
- case PROT_LOOP:
- case PROT_LAMBDA:
- case PROT_FUNC:
- tt->dst = (VALUE)tt->frame->uniq;
- tt->retval = retval;
- JUMP_TAG(TAG_NEXT);
- break;
- default:
- break;
- }
- tt = tt->prev;
- }
- localjump_error("unexpected next", retval, TAG_NEXT);
-}
-
-void
-rb_need_block()
-{
- if (!rb_block_given_p()) {
- localjump_error("no block given", Qnil, 0);
- }
-}
-
static VALUE
rb_yield_0(val, self, klass, flags, avalue)
VALUE val, self, klass; /* OK */
@@ -4875,13 +4613,14 @@ rb_yield_0(val, self, klass, flags, avalue)
int lambda = flags & YIELD_LAMBDA_CALL;
int state;
- rb_need_block();
+ if (!rb_block_given_p()) {
+ localjump_error("no block given", Qnil, 0);
+ }
PUSH_VARS();
block = ruby_block;
frame = block->frame;
frame.prev = ruby_frame;
- frame.node = cnode;
ruby_frame = &(frame);
old_cref = (VALUE)ruby_cref;
ruby_cref = block->cref;
@@ -5357,23 +5096,17 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
int state;
volatile VALUE result;
volatile VALUE e_info = ruby_errinfo;
- volatile int handle = Qfalse;
- VALUE eclass;
va_list args;
PUSH_TAG(PROT_NONE);
- switch (state = EXEC_TAG()) {
- case TAG_RETRY:
- if (!handle) break;
- handle = Qfalse;
- state = 0;
- ruby_errinfo = Qnil;
- case 0:
+ if ((state = EXEC_TAG()) == 0) {
+ retry_entry:
result = (*b_proc)(data1);
- break;
- case TAG_RAISE:
- if (handle) break;
- handle = Qfalse;
+ }
+ else if (state == TAG_RAISE) {
+ int handle = Qfalse;
+ VALUE eclass;
+
va_init_list(args, data2);
while (eclass = va_arg(args, VALUE)) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
@@ -5384,14 +5117,25 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
va_end(args);
if (handle) {
- state = 0;
if (r_proc) {
- result = (*r_proc)(data2, ruby_errinfo);
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ result = (*r_proc)(data2, ruby_errinfo);
+ }
+ POP_TAG();
+ if (state == TAG_RETRY) {
+ state = 0;
+ ruby_errinfo = Qnil;
+ goto retry_entry;
+ }
}
else {
result = Qnil;
+ state = 0;
+ }
+ if (state == 0) {
+ ruby_errinfo = e_info;
}
- ruby_errinfo = e_info;
}
}
POP_TAG();
@@ -5485,7 +5229,7 @@ rb_with_disable_interrupt(proc, data)
return result;
}
-static void
+static inline void
stack_check()
{
static int overflowing = 0;
@@ -5615,21 +5359,11 @@ method_missing(obj, id, argc, argv, call_status)
else if (id == ID_ALLOCATOR) {
rb_raise(rb_eTypeError, "allocator undefined for %s", rb_class2name(obj));
}
- if (argc < 0) {
- VALUE tmp;
- argc = -argc-1;
- tmp = splat_value(argv[argc]);
- nargv = ALLOCA_N(VALUE, argc + RARRAY(tmp)->len + 1);
- MEMCPY(nargv+1, argv, VALUE, argc);
- MEMCPY(nargv+1+argc, RARRAY(tmp)->ptr, VALUE, RARRAY(tmp)->len);
- argc += RARRAY(tmp)->len;
- }
- else {
- nargv = ALLOCA_N(VALUE, argc+1);
- MEMCPY(nargv+1, argv, VALUE, argc);
- }
+ nargv = ALLOCA_N(VALUE, argc+1);
nargv[0] = ID2SYM(id);
+ MEMCPY(nargv+1, argv, VALUE, argc);
+
return rb_funcall2(obj, missing, argc+1, nargv);
}
@@ -5715,37 +5449,30 @@ call_cfunc(func, recv, len, argc, argv)
argv[11], argv[12], argv[13], argv[14]);
break;
default:
- rb_raise(rb_eArgError, "too many arguments (%d)", len);
+ rb_raise(rb_eArgError, "too many arguments(%d)", len);
break;
}
return Qnil; /* not reached */
}
static VALUE
-rb_call0(klass, recv, id, oid, argc, argv, body, flags)
+rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
VALUE klass, recv;
ID id;
ID oid;
int argc; /* OK */
VALUE *argv; /* OK */
- NODE * volatile body;
- int flags;
+ NODE *body; /* OK */
+ int nosuper;
{
NODE *b2; /* OK */
volatile VALUE result = Qnil;
int itr;
static int tick;
TMP_PROTECT;
- volatile int safe = -1;
- if (NOEX_SAFE(flags) > ruby_safe_level &&
- !(flags&NOEX_TAINTED) && ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
- rb_raise(rb_eSecurityError, "calling insecure method: %s",
- rb_id2name(id));
- }
switch (ruby_iter->iter) {
case ITER_PRE:
- case ITER_PAS:
itr = ITER_CUR;
break;
case ITER_CUR:
@@ -5759,27 +5486,15 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
stack_check();
rb_gc_finalize_deferred();
}
- if (argc < 0) {
- VALUE tmp;
- VALUE *nargv;
-
- argc = -argc-1;
- tmp = splat_value(argv[argc]);
- nargv = TMP_ALLOC(argc + RARRAY(tmp)->len);
- MEMCPY(nargv, argv, VALUE, argc);
- MEMCPY(nargv+argc, RARRAY(tmp)->ptr, VALUE, RARRAY(tmp)->len);
- argc += RARRAY(tmp)->len;
- argv = nargv;
- }
PUSH_ITER(itr);
PUSH_FRAME();
ruby_frame->last_func = id;
ruby_frame->orig_func = oid;
- ruby_frame->last_class = (flags & NOEX_NOSUPER)?0:klass;
+ ruby_frame->last_class = nosuper?0:klass;
ruby_frame->self = recv;
ruby_frame->argc = argc;
- ruby_frame->flags = 0;
+ ruby_frame->argv = argv;
switch (nd_type(body)) {
case NODE_CFUNC:
@@ -5787,22 +5502,20 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
int len = body->nd_argc;
if (len < -2) {
- rb_bug("bad argc (%d) specified for `%s(%s)'",
+ rb_bug("bad argc(%d) specified for `%s(%s)'",
len, rb_class2name(klass), rb_id2name(id));
}
- if (event_hooks) {
+ if (trace_func) {
int state;
- EXEC_EVENT_HOOK(RUBY_EVENT_C_CALL, ruby_current_node,
- recv, id, klass);
+ call_trace_func("c-call", ruby_current_node, recv, id, klass);
PUSH_TAG(PROT_FUNC);
if ((state = EXEC_TAG()) == 0) {
result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
POP_TAG();
ruby_current_node = ruby_frame->node;
- EXEC_EVENT_HOOK(RUBY_EVENT_C_RETURN, ruby_current_node,
- recv, id, klass);
+ call_trace_func("c-return", ruby_current_node, recv, id, klass);
if (state) JUMP_TAG(state);
}
else {
@@ -5820,13 +5533,9 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
break;
case NODE_ATTRSET:
- if (argc != 1)
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
- result = rb_ivar_set(recv, body->nd_vid, argv[0]);
- break;
-
+ /* for re-scoped/renamed method */
case NODE_ZSUPER:
- result = rb_call_super(argc, argv);
+ result = rb_eval(recv, body);
break;
case NODE_DMETHOD:
@@ -5834,16 +5543,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
break;
case NODE_BMETHOD:
- ruby_frame->flags |= FRAME_DMETH;
- if (event_hooks) {
- struct BLOCK *data;
- Data_Get_Struct(body->nd_cval, struct BLOCK, data);
- EXEC_EVENT_HOOK(RUBY_EVENT_CALL, data->body, recv, id, klass);
- }
result = proc_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv, klass);
- if (event_hooks) {
- EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
- }
break;
case NODE_SCOPE:
@@ -5853,6 +5553,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
NODE *saved_cref = 0;
PUSH_SCOPE();
+
if (body->nd_rval) {
saved_cref = ruby_cref;
ruby_cref = (NODE*)body->nd_rval;
@@ -5871,15 +5572,12 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
}
b2 = body = body->nd_next;
- if (NOEX_SAFE(flags) > ruby_safe_level) {
- safe = ruby_safe_level;
- ruby_safe_level = NOEX_SAFE(flags);
- }
PUSH_VARS();
PUSH_TAG(PROT_FUNC);
+
if ((state = EXEC_TAG()) == 0) {
NODE *node = 0;
- int i, nopt = 0;
+ int i;
if (nd_type(body) == NODE_ARGS) {
node = body;
@@ -5899,56 +5597,55 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
argc, i);
}
- if (!node->nd_rest) {
+ if ((long)node->nd_rest == -1) {
+ int opt = i;
NODE *optnode = node->nd_opt;
- nopt = i;
while (optnode) {
- nopt++;
+ opt++;
optnode = optnode->nd_next;
}
- if (nopt < argc) {
- rb_raise(rb_eArgError,
- "wrong number of arguments (%d for %d)",
- argc, nopt);
+ if (opt < argc) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+ argc, opt);
}
+ ruby_frame->argc = opt;
+ ruby_frame->argv = local_vars+2;
}
+
if (local_vars) {
if (i > 0) {
/* +2 for $_ and $~ */
MEMCPY(local_vars+2, argv, VALUE, i);
}
- }
- argv += i; argc -= i;
- if (node->nd_opt) {
- NODE *opt = node->nd_opt;
-
- while (opt && argc) {
- assign(recv, opt->nd_head, *argv, 1);
- argv++; argc--;
- opt = opt->nd_next;
- }
- if (opt) {
- rb_eval(recv, opt);
- }
- i = nopt;
- }
- if (node->nd_rest) {
- VALUE v;
-
- if (argc > 0) {
- v = rb_ary_new4(argc,argv);
- i = -i - 1;
+ argv += i; argc -= i;
+ if (node->nd_opt) {
+ NODE *opt = node->nd_opt;
+
+ while (opt && argc) {
+ assign(recv, opt->nd_head, *argv, 1);
+ argv++; argc--;
+ opt = opt->nd_next;
+ }
+ if (opt) {
+ rb_eval(recv, opt);
+ }
}
- else {
- v = rb_ary_new2(0);
+ local_vars = ruby_scope->local_vars;
+ if ((long)node->nd_rest >= 0) {
+ VALUE v;
+
+ if (argc > 0)
+ v = rb_ary_new4(argc,argv);
+ else
+ v = rb_ary_new2(0);
+ ruby_scope->local_vars[node->nd_rest] = v;
}
- assign(recv, node->nd_rest, v, 1);
}
- ruby_frame->argc = i;
}
- if (event_hooks) {
- EXEC_EVENT_HOOK(RUBY_EVENT_CALL, b2, recv, id, klass);
+
+ if (trace_func) {
+ call_trace_func("call", b2, recv, id, klass);
}
result = rb_eval(recv, body);
}
@@ -5957,14 +5654,13 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
state = 0;
}
POP_TAG();
- if (event_hooks) {
- EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
- }
POP_VARS();
POP_CLASS();
POP_SCOPE();
ruby_cref = saved_cref;
- if (safe >= 0) ruby_safe_level = safe;
+ if (trace_func) {
+ call_trace_func("return", ruby_frame->prev->node, recv, id, klass);
+ }
switch (state) {
case 0:
break;
@@ -5985,7 +5681,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
break;
default:
- unknown_node(body);
+ rb_bug("unknown node type %d", nd_type(body));
break;
}
POP_FRAME();
@@ -6027,13 +5723,13 @@ rb_call(klass, recv, mid, argc, argv, scope)
return method_missing(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
}
- if (mid != missing && scope == 0) {
+ if (mid != missing) {
/* receiver specified form for private method */
- if (noex & NOEX_PRIVATE)
+ if ((noex & NOEX_PRIVATE) && scope == 0)
return method_missing(recv, mid, argc, argv, CSTAT_PRIV);
/* self must be kind of a specified form for protected method */
- if (noex & NOEX_PROTECTED) {
+ if ((noex & NOEX_PROTECTED)) {
VALUE defined_class = klass;
if (TYPE(defined_class) == T_ICLASS) {
@@ -6044,7 +5740,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
}
}
- return rb_call0(klass, recv, mid, id, argc, argv, body, noex);
+ return rb_call0(klass, recv, mid, id, argc, argv, body, noex & NOEX_NOSUPER);
}
VALUE
@@ -6068,7 +5764,7 @@ rb_apply(recv, mid, args)
* obj.__send__(symbol [, args...]) => obj
*
* Invokes the method identified by _symbol_, passing it any
- * arguments specified. You can use <code>\_\_send__</code> if the name
+ * arguments specified. You can use <code>__send__</code> if the name
* +send+ clashes with an existing method in _obj_.
*
* class Klass
@@ -6198,18 +5894,15 @@ rb_call_super(argc, argv)
int argc;
const VALUE *argv;
{
- VALUE result, self, klass;
+ VALUE result, self, klass, k;
if (ruby_frame->last_class == 0) {
rb_name_error(ruby_frame->last_func, "calling `super' from `%s' is prohibited",
- rb_id2name(ruby_frame->orig_func));
+ rb_id2name(ruby_frame->last_func));
}
self = ruby_frame->self;
klass = ruby_frame->last_class;
- if (RCLASS(klass)->super == 0) {
- return method_missing(self, ruby_frame->orig_func, argc, argv, CSTAT_SUPER);
- }
PUSH_ITER(ruby_iter->iter ? ITER_PRE : ITER_NOT);
result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3);
@@ -6256,11 +5949,8 @@ backtrace(lev)
}
}
}
- for (; frame && (n = frame->node); frame = frame->prev) {
+ while (frame && (n = frame->node)) {
if (frame->prev && frame->prev->last_func) {
- if (frame->prev->node == n) {
- if (frame->prev->last_func == frame->last_func) continue;
- }
snprintf(buf, BUFSIZ, "%s:%d:in `%s'",
n->nd_file, nd_line(n),
rb_id2name(frame->prev->last_func));
@@ -6269,6 +5959,7 @@ backtrace(lev)
snprintf(buf, BUFSIZ, "%s:%d", n->nd_file, nd_line(n));
}
rb_ary_push(ary, rb_str_new2(buf));
+ frame = frame->prev;
}
return ary;
@@ -6311,7 +6002,7 @@ rb_f_caller(argc, argv)
if (NIL_P(level)) lev = 1;
else lev = NUM2INT(level);
- if (lev < 0) rb_raise(rb_eArgError, "negative level (%d)", lev);
+ if (lev < 0) rb_raise(rb_eArgError, "negative level(%d)", lev);
return backtrace(lev);
}
@@ -6422,7 +6113,7 @@ eval(self, src, scope, file, line)
file = ruby_sourcefile;
line = ruby_sourceline;
}
- PUSH_CLASS(data ? data->klass : ruby_class);
+ PUSH_CLASS(ruby_cbase);
ruby_in_eval++;
if (TYPE(ruby_class) == T_ICLASS) {
ruby_class = RBASIC(ruby_class)->klass;
@@ -6445,6 +6136,7 @@ eval(self, src, scope, file, line)
POP_TAG();
POP_CLASS();
ruby_in_eval--;
+ ruby_safe_level = safe;
if (!NIL_P(scope)) {
int dont_recycle = ruby_scope->flags & SCOPE_DONT_RECYCLE;
@@ -6570,15 +6262,14 @@ exec_under(func, under, cbase, args)
VALUE val = Qnil; /* OK */
int state;
int mode;
- struct FRAME *f = ruby_frame;
PUSH_CLASS(under);
PUSH_FRAME();
- ruby_frame->self = f->self;
- ruby_frame->last_func = f->last_func;
- ruby_frame->orig_func = f->orig_func;
- ruby_frame->last_class = f->last_class;
- ruby_frame->argc = f->argc;
+ ruby_frame->self = _frame.prev->self;
+ ruby_frame->last_func = _frame.prev->last_func;
+ ruby_frame->last_class = _frame.prev->last_class;
+ ruby_frame->argc = _frame.prev->argc;
+ ruby_frame->argv = _frame.prev->argv;
if (cbase) {
PUSH_CREF(cbase);
}
@@ -6603,11 +6294,6 @@ static VALUE
eval_under_i(args)
VALUE *args;
{
- struct FRAME *f = ruby_frame;
-
- if (f && (f = f->prev) && (f = f->prev)) {
- ruby_frame = f;
- }
return eval(args[0], args[1], Qnil, (char*)args[2], (int)args[3]);
}
@@ -6719,7 +6405,7 @@ rb_obj_instance_eval(argc, argv, self)
{
VALUE klass;
- if (SPECIAL_CONST_P(self)) {
+ if (FIXNUM_P(self) || SYMBOL_P(self)) {
klass = Qnil;
}
else {
@@ -7001,19 +6687,19 @@ rb_provide(feature)
rb_provide_feature(rb_str_new2(feature));
}
-static int
+static void
load_wait(ftptr)
char *ftptr;
{
st_data_t th;
- if (!loading_tbl) return Qfalse;
- if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return Qfalse;
+ if (!loading_tbl) return;
+ if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return;
+ if ((rb_thread_t)th == curr_thread) return;
do {
- if ((rb_thread_t)th == curr_thread) return Qtrue;
CHECK_INTS;
+ rb_thread_schedule();
} while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
- return Qtrue;
}
/*
@@ -7108,7 +6794,7 @@ static void
load_failed(fname)
VALUE fname;
{
- rb_raise(rb_eLoadError, "no such file to load -- %s", RSTRING(fname)->ptr);
+ rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
}
VALUE
@@ -7144,11 +6830,13 @@ rb_require_safe(fname, safe)
ruby_safe_level = safe;
found = search_required(fname, &feature, &path);
if (found) {
- if (!path || load_wait(RSTRING(feature)->ptr)) {
+ if (!path) {
+ load_wait(RSTRING(feature)->ptr);
result = Qfalse;
}
else {
ruby_safe_level = 0;
+ rb_provide_feature(feature);
switch (found) {
case 'r':
/* loading ruby library should be serialized. */
@@ -7171,7 +6859,6 @@ rb_require_safe(fname, safe)
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;
}
- rb_provide_feature(feature);
result = Qtrue;
}
}
@@ -7907,10 +7594,10 @@ Init_eval()
rb_define_global_function("method_missing", rb_method_missing, -1);
rb_define_global_function("loop", rb_f_loop, 0);
- rb_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1);
+ rb_define_method(rb_mKernel, "respond_to?", rb_obj_respond_to, -1);
respond_to = rb_intern("respond_to?");
- rb_global_variable((VALUE*)&basic_respond_to);
basic_respond_to = rb_method_node(rb_cObject, respond_to);
+ rb_global_variable((VALUE*)&basic_respond_to);
rb_define_global_function("raise", rb_f_raise, -1);
rb_define_global_function("fail", rb_f_raise, -1);
@@ -7975,11 +7662,11 @@ Init_eval()
/*
* call-seq:
* mod.autoload(name, filename) => nil
- *
+ *
* Registers _filename_ to be loaded (using <code>Kernel::require</code>)
- * the first time that _name_ (which may be a <code>String</code> or
+ * the first time that _module_ (which may be a <code>String</code> or
* a symbol) is accessed in the namespace of _mod_.
- *
+ *
* module A
* end
* A.autoload(:B, "b")
@@ -8000,16 +7687,7 @@ rb_mod_autoload(mod, sym, file)
}
/*
- * call-seq:
- * mod.autoload?(name) => String or nil
- *
- * Returns _filename_ to be loaded if _name_ is registered as
- * +autoload+ in the namespace of _mod_.
- *
- * module A
- * end
- * A.autoload(:B, "b")
- * A.autoload?(:B) # => "b"
+ * MISSING: documentation
*/
static VALUE
@@ -8036,21 +7714,12 @@ rb_f_autoload(obj, sym, file)
VALUE sym;
VALUE file;
{
- if (NIL_P(ruby_cbase)) {
- rb_raise(rb_eTypeError, "no class/module for autoload target");
- }
return rb_mod_autoload(ruby_cbase, sym, file);
}
+
/*
- * call-seq:
- * autoload(module, filename) => nil
- *
- * Registers _filename_ to be loaded (using <code>Kernel::require</code>)
- * the first time that _module_ (which may be a <code>String</code> or
- * a symbol) is accessed.
- *
- * autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")
+ * MISSING: documentation
*/
static VALUE
@@ -8059,23 +7728,20 @@ rb_f_autoload_p(obj, sym)
VALUE sym;
{
/* use ruby_cbase as same as rb_f_autoload. */
- if (NIL_P(ruby_cbase)) {
- return Qfalse;
- }
return rb_mod_autoload_p(ruby_cbase, sym);
}
void
Init_load()
{
+ rb_load_path = rb_ary_new();
rb_define_readonly_variable("$:", &rb_load_path);
rb_define_readonly_variable("$-I", &rb_load_path);
rb_define_readonly_variable("$LOAD_PATH", &rb_load_path);
- rb_load_path = rb_ary_new();
+ rb_features = rb_ary_new();
rb_define_readonly_variable("$\"", &rb_features);
rb_define_readonly_variable("$LOADED_FEATURES", &rb_features);
- rb_features = rb_ary_new();
rb_define_global_function("load", rb_f_load, -1);
rb_define_global_function("require", rb_f_require, 1);
@@ -8085,8 +7751,8 @@ Init_load()
rb_define_global_function("autoload?", rb_f_autoload_p, 1);
rb_global_variable(&ruby_wrapper);
- rb_global_variable(&ruby_dln_librefs);
ruby_dln_librefs = rb_ary_new();
+ rb_global_variable(&ruby_dln_librefs);
}
static void
@@ -8133,8 +7799,12 @@ frame_free(frame)
{
struct FRAME *tmp;
+ if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
+ free(frame->argv);
frame = frame->prev;
while (frame) {
+ if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
+ free(frame->argv);
tmp = frame;
frame = frame->prev;
free(tmp);
@@ -8159,9 +7829,16 @@ static void
frame_dup(frame)
struct FRAME *frame;
{
+ VALUE *argv;
struct FRAME *tmp;
for (;;) {
+ if (frame->argc > 0) {
+ argv = ALLOC_N(VALUE, frame->argc);
+ MEMCPY(argv, frame->argv, VALUE, frame->argc);
+ frame->argv = argv;
+ frame->flags |= FRAME_MALLOC;
+ }
frame->tmp = 0; /* should not preserve tmp */
if (!frame->prev) break;
tmp = ALLOC(struct FRAME);
@@ -8283,7 +7960,6 @@ rb_f_binding(self)
if (ruby_frame->prev) {
data->frame.last_func = ruby_frame->prev->last_func;
data->frame.last_class = ruby_frame->prev->last_class;
- data->frame.orig_func = ruby_frame->prev->orig_func;
}
if (data->iter) {
@@ -8495,17 +8171,11 @@ proc_invoke(proc, args, self, klass)
if (self != Qundef) _block.frame.self = self;
if (klass) _block.frame.last_class = klass;
_block.frame.argc = RARRAY(tmp)->len;
- _block.frame.flags = ruby_frame->flags;
- if (_block.frame.argc && DMETHOD_P()) {
- NEWOBJ(scope, struct SCOPE);
- OBJSETUP(scope, tmp, T_SCOPE);
- scope->local_tbl = _block.scope->local_tbl;
- scope->local_vars = _block.scope->local_vars;
- scope->flags |= SCOPE_CLONE;
- _block.scope = scope;
- }
- /* modify current frame */
+ _block.frame.argv = ALLOCA_N(VALUE, RARRAY(tmp)->len);
+ MEMCPY(_block.frame.argv, RARRAY(tmp)->ptr, VALUE, RARRAY(tmp)->len);
+ _block.frame.flags = FRAME_ALLOCA;
ruby_block = &_block;
+
PUSH_ITER(ITER_CUR);
ruby_frame->iter = ITER_CUR;
PUSH_TAG(pcall ? PROT_LAMBDA : PROT_NONE);
@@ -8594,14 +8264,15 @@ static VALUE method_arity _((VALUE));
* call-seq:
* prc.arity -> fixnum
*
- * Returns the number of arguments that would not be ignored. If the block
+ * Returns the number of arguments required by the block. If the block
* is declared to take no arguments, returns 0. If the block is known
* to take exactly n arguments, returns n. If the block has optional
* arguments, return -n-1, where n is the number of mandatory
- * arguments. A <code>proc</code> with no argument declarations
- * is the same a block declaring <code>||</code> as its arguments.
+ * arguments. A <code>proc</code> with no argument declarations
+ * returns -1, as it can accept (and ignore) an arbitrary number of
+ * parameters.
*
- * Proc.new {}.arity #=> 0
+ * Proc.new {}.arity #=> -1
* Proc.new {||}.arity #=> 0
* Proc.new {|a|}.arity #=> 1
* Proc.new {|a,b|}.arity #=> 2
@@ -8687,7 +8358,7 @@ proc_to_s(self)
struct BLOCK *data;
NODE *node;
char *cname = rb_obj_classname(self);
- const int w = (sizeof(VALUE) * CHAR_BIT) / 4;
+ const int w = (SIZEOF_LONG * CHAR_BIT) / 4;
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
VALUE str;
@@ -8695,14 +8366,12 @@ proc_to_s(self)
if ((node = data->frame.node) || (node = data->body)) {
len += strlen(node->nd_file) + 2 + (SIZEOF_LONG*CHAR_BIT-NODE_LSHIFT)/3;
str = rb_str_new(0, len);
- snprintf(RSTRING(str)->ptr, len+1,
- "#<%s:0x%.*lx@%s:%d>", cname, w, (VALUE)data->body,
- node->nd_file, nd_line(node));
+ sprintf(RSTRING(str)->ptr, "#<%s:0x%.*lx@%s:%d>", cname, w, (VALUE)data->body,
+ node->nd_file, nd_line(node));
}
else {
str = rb_str_new(0, len);
- snprintf(RSTRING(str)->ptr, len+1,
- "#<%s:0x%.*lx>", cname, w, (VALUE)data->body);
+ sprintf(RSTRING(str)->ptr, "#<%s:0x%.*lx>", cname, w, (VALUE)data->body);
}
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
@@ -8795,13 +8464,14 @@ block_pass(self, node)
proc = b;
}
- if (ruby_safe_level >= 1 && OBJ_TAINTED(proc) &&
- ruby_safe_level > proc_get_safe_level(proc)) {
- rb_raise(rb_eSecurityError, "Insecure: tainted block value");
+ if (ruby_safe_level >= 1 && OBJ_TAINTED(proc)) {
+ if (ruby_safe_level > proc_get_safe_level(proc)) {
+ rb_raise(rb_eSecurityError, "Insecure: tainted block value");
+ }
}
if (ruby_block && ruby_block->block_obj == proc) {
- PUSH_ITER(ITER_PAS);
+ PUSH_ITER(ITER_PRE);
result = rb_eval(self, node->nd_iter);
POP_ITER();
return result;
@@ -8814,7 +8484,7 @@ block_pass(self, node)
old_block = ruby_block;
_block = *data;
_block.outer = ruby_block;
- if (orphan) _block.uniq = block_unique++;
+ _block.uniq = block_unique++;
ruby_block = &_block;
PUSH_ITER(ITER_PRE);
if (ruby_frame->iter == ITER_NOT)
@@ -8860,7 +8530,6 @@ struct METHOD {
VALUE klass, rklass;
VALUE recv;
ID id, oid;
- int safe_level;
NODE *body;
};
@@ -8908,7 +8577,6 @@ mnew(klass, obj, id, mklass)
data->body = body;
data->rklass = rklass;
data->oid = oid;
- data->safe_level = NOEX_WITH_SAFE(0);
OBJ_INFECT(method, klass);
return method;
@@ -9114,21 +8782,26 @@ method_call(argc, argv, method)
{
VALUE result = Qnil; /* OK */
struct METHOD *data;
- int safe;
+ int state;
+ volatile int safe = -1;
Data_Get_Struct(method, struct METHOD, data);
if (data->recv == Qundef) {
- rb_raise(rb_eTypeError, "can't call unbound method; bind first");
+ rb_raise(rb_eTypeError, "you cannot call unbound method; bind first");
}
+ PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
+ PUSH_TAG(PROT_NONE);
if (OBJ_TAINTED(method)) {
- safe = NOEX_WITH(data->safe_level, 4)|NOEX_TAINTED;
+ safe = ruby_safe_level;
+ if (ruby_safe_level < 4) ruby_safe_level = 4;
}
- else {
- safe = data->safe_level;
+ if ((state = EXEC_TAG()) == 0) {
+ result = rb_call0(data->klass,data->recv,data->id,data->oid,argc,argv,data->body,0);
}
- PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
- result = rb_call0(data->klass,data->recv,data->id,data->oid,argc,argv,data->body,safe);
+ POP_TAG();
POP_ITER();
+ if (safe >= 0) ruby_safe_level = safe;
+ if (state) JUMP_TAG(state);
return result;
}
@@ -9228,22 +8901,13 @@ umethod_bind(method, recv)
VALUE method, recv;
{
struct METHOD *data, *bound;
- VALUE rklass = CLASS_OF(recv);
Data_Get_Struct(method, struct METHOD, data);
- if (data->rklass != rklass) {
+ if (data->rklass != CLASS_OF(recv)) {
if (FL_TEST(data->rklass, FL_SINGLETON)) {
- rb_raise(rb_eTypeError, "singleton method bound for a different object");
+ rb_raise(rb_eTypeError, "singleton method called for a different object");
}
- if (TYPE(data->rklass) == T_MODULE) {
- st_table *m_tbl = RCLASS(data->rklass)->m_tbl;
- while (RCLASS(rklass)->m_tbl != m_tbl) {
- rklass = RCLASS(rklass)->super;
- if (!rklass) goto not_instace;
- }
- }
- else if (!rb_obj_is_kind_of(recv, data->rklass)) {
- not_instace:
+ if(!rb_obj_is_kind_of(recv, data->rklass)) {
rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
rb_class2name(data->rklass));
}
@@ -9252,7 +8916,7 @@ umethod_bind(method, recv)
method = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,bound);
*bound = *data;
bound->recv = recv;
- bound->rklass = rklass;
+ bound->rklass = CLASS_OF(recv);
return method;
}
@@ -9312,21 +8976,18 @@ method_arity(method)
case NODE_IVAR:
return INT2FIX(0);
case NODE_BMETHOD:
- return proc_arity(body->nd_cval);
case NODE_DMETHOD:
- return method_arity(body->nd_cval);
- case NODE_SCOPE:
+ return proc_arity(body->nd_cval);
+ default:
body = body->nd_next; /* skip NODE_SCOPE */
if (nd_type(body) == NODE_BLOCK)
body = body->nd_head;
if (!body) return INT2FIX(0);
n = body->nd_cnt;
- if (body->nd_opt || body->nd_rest)
+ if (body->nd_opt || body->nd_rest != -1)
n = -n-1;
return INT2FIX(n);
- default:
- rb_raise(rb_eArgError, "invalid node 0x%x", nd_type(body));
- }
+ }
}
/*
@@ -9408,12 +9069,9 @@ bmcall(args, method)
VALUE args, method;
{
volatile VALUE a;
- VALUE ret;
a = svalue_to_avalue(args);
- ret = method_call(RARRAY(a)->len, RARRAY(a)->ptr, method);
- a = Qnil; /* prevent tail call */
- return ret;
+ return method_call(RARRAY(a)->len, RARRAY(a)->ptr, method);
}
VALUE
@@ -9583,13 +9241,13 @@ Init_Proc()
rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
- rb_global_variable(&exception_error);
exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
+ rb_global_variable(&exception_error);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
- rb_global_variable(&sysstack_error);
sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
OBJ_TAINT(sysstack_error);
+ rb_global_variable(&sysstack_error);
rb_cProc = rb_define_class("Proc", rb_cObject);
rb_undef_alloc_func(rb_cProc);
@@ -9676,7 +9334,6 @@ Init_Binding()
rb_undef_alloc_func(rb_cBinding);
rb_undef_method(CLASS_OF(rb_cBinding), "new");
rb_define_method(rb_cBinding, "clone", proc_clone, 0);
- rb_define_method(rb_cBinding, "dup", proc_dup, 0);
rb_define_global_function("binding", rb_f_binding, 0);
}
@@ -9945,7 +9602,6 @@ rb_trap_eval(cmd, sig, safe)
if (state) {
rb_trap_immediate = 0;
- rb_thread_ready(curr_thread);
JUMP_TAG(state);
}
@@ -10019,6 +9675,26 @@ timeofday()
#define STACK(addr) (th->stk_pos<(VALUE*)(addr) && (VALUE*)(addr)<th->stk_pos+th->stk_len)
#define ADJ(addr) (void*)(STACK(addr)?(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr):(VALUE*)(addr))
+#ifdef C_ALLOCA
+# define MARK_FRAME_ADJ(f) rb_gc_mark_frame(f)
+#else
+# define MARK_FRAME_ADJ(f) mark_frame_adj(f, th)
+static void
+mark_frame_adj(frame, th)
+ struct FRAME *frame;
+ rb_thread_t th;
+{
+ if (frame->flags & FRAME_MALLOC) {
+ rb_gc_mark_locations(frame->argv, frame->argv+frame->argc);
+ }
+ else {
+ VALUE *start = ADJ(frame->argv);
+ rb_gc_mark_locations(start, start+frame->argc);
+ }
+ rb_gc_mark((VALUE)frame->node);
+}
+#endif
+
static void
thread_mark(th)
rb_thread_t th;
@@ -10037,7 +9713,6 @@ thread_mark(th)
rb_gc_mark((VALUE)th->scope);
rb_gc_mark((VALUE)th->dyna_vars);
rb_gc_mark(th->errinfo);
- rb_gc_mark(th->last_status);
rb_gc_mark(th->last_line);
rb_gc_mark(th->last_match);
rb_mark_tbl(th->locals);
@@ -10061,13 +9736,13 @@ thread_mark(th)
frame = th->frame;
while (frame && frame != top_frame) {
frame = ADJ(frame);
- rb_gc_mark_frame(frame);
+ MARK_FRAME_ADJ(frame);
if (frame->tmp) {
struct FRAME *tmp = frame->tmp;
while (tmp && tmp != top_frame) {
tmp = ADJ(tmp);
- rb_gc_mark_frame(tmp);
+ MARK_FRAME_ADJ(tmp);
tmp = tmp->prev;
}
}
@@ -10076,21 +9751,11 @@ thread_mark(th)
block = th->block;
while (block) {
block = ADJ(block);
- rb_gc_mark_frame(&block->frame);
+ MARK_FRAME_ADJ(&block->frame);
block = block->prev;
}
}
-static int
-mark_loading_thread(key, value, lev)
- ID key;
- VALUE value;
- int lev;
-{
- rb_gc_mark(((rb_thread_t)value)->thread);
- return ST_CONTINUE;
-}
-
void
rb_gc_mark_threads()
{
@@ -10100,38 +9765,9 @@ rb_gc_mark_threads()
rb_gc_mark((VALUE)ruby_cref);
if (!curr_thread) return;
- rb_gc_mark(main_thread->thread);
- rb_gc_mark(curr_thread->thread);
- FOREACH_THREAD_FROM(main_thread, th) {
- switch (th->status) {
- case THREAD_TO_KILL:
- case THREAD_RUNNABLE:
- break;
- case THREAD_STOPPED:
- if (th->wait_for) break;
- default:
- continue;
- }
+ FOREACH_THREAD(th) {
rb_gc_mark(th->thread);
- } END_FOREACH_FROM(main_thread, th);
- if (loading_tbl) st_foreach(loading_tbl, mark_loading_thread, 0);
-}
-
-void
-rb_gc_abort_threads()
-{
- rb_thread_t th;
-
- if (!main_thread)
- return;
-
- FOREACH_THREAD_FROM(main_thread, th) {
- if (FL_TEST(th->thread, FL_MARK)) continue;
- if (th->status == THREAD_STOPPED) {
- th->status = THREAD_TO_KILL;
- rb_gc_mark(th->thread);
- }
- } END_FOREACH_FROM(main_thread, th);
+ } END_FOREACH(th);
}
static void
@@ -10193,9 +9829,7 @@ rb_thread_save_context(th)
th->stk_len = 0;
th->stk_pos = pos;
if (len > th->stk_max) {
- VALUE *ptr = realloc(th->stk_ptr, sizeof(VALUE) * len);
- if (!ptr) rb_memerror();
- th->stk_ptr = ptr;
+ REALLOC_N(th->stk_ptr, VALUE, len);
th->stk_max = len;
}
th->stk_len = len;
@@ -10224,7 +9858,6 @@ rb_thread_save_context(th)
th->frame = ruby_frame;
th->scope = ruby_scope;
- ruby_scope->flags |= SCOPE_DONT_RECYCLE;
th->klass = ruby_class;
th->wrapper = ruby_wrapper;
th->cref = ruby_cref;
@@ -10276,10 +9909,8 @@ rb_thread_switch(n)
case RESTORE_EXIT:
ruby_errinfo = th_raise_exception;
ruby_current_node = th_raise_node;
- if (!rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
- terminate_process(EXIT_FAILURE, ruby_errinfo);
- }
- rb_exc_raise(th_raise_exception);
+ error_print();
+ terminate_process(EXIT_FAILURE, 0, 0);
break;
case RESTORE_NORMAL:
default:
@@ -10290,12 +9921,12 @@ rb_thread_switch(n)
#define THREAD_SAVE_CONTEXT(th) \
(rb_thread_save_context(th),\
- rb_thread_switch((FLUSH_REGISTER_WINDOWS, ruby_setjmp((th)->context))))
+ rb_thread_switch((FLUSH_REGISTER_WINDOWS, setjmp((th)->context))))
NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
-# if defined(_MSC_VER) && _MSC_VER >= 1300
-__declspec(noinline) static void stack_extend(rb_thread_t, int);
+# if _MSC_VER >= 1300
+__declspec(noinline)
# endif
static void
stack_extend(th, exit)
@@ -10371,7 +10002,7 @@ rb_thread_restore_context(th, exit)
rb_backref_set(tmp->last_match);
tmp->last_match = tval;
- ruby_longjmp(tmp->context, ex);
+ longjmp(tmp->context, ex);
}
static void
@@ -10798,7 +10429,6 @@ rb_thread_fd_writable(fd)
if (rb_thread_critical) return Qtrue;
if (curr_thread == curr_thread->next) return Qtrue;
if (curr_thread->status == THREAD_TO_KILL) return Qtrue;
- if (curr_thread->status == THREAD_KILLED) return Qtrue;
curr_thread->status = THREAD_STOPPED;
FD_ZERO(&curr_thread->readfds);
@@ -10839,7 +10469,7 @@ rb_thread_wait_for(time)
#ifdef ERESTART
case ERESTART:
#endif
- break;
+ return;
default:
rb_sys_fail("sleep");
}
@@ -10879,9 +10509,7 @@ rb_thread_select(max, read, write, except, timeout)
fd_set *read, *write, *except;
struct timeval *timeout;
{
-#ifndef linux
double limit;
-#endif
int n;
if (!read && !write && !except) {
@@ -10893,12 +10521,10 @@ rb_thread_select(max, read, write, except, timeout)
return 0;
}
-#ifndef linux
if (timeout) {
limit = timeofday()+
(double)timeout->tv_sec+(double)timeout->tv_usec*1e-6;
}
-#endif
if (rb_thread_critical ||
curr_thread == curr_thread->next ||
@@ -11744,7 +11370,7 @@ rb_thread_start_0(fn, arg, th)
{
volatile rb_thread_t th_save = th;
volatile VALUE thread = th->thread;
- struct BLOCK *volatile saved_block = 0;
+ struct BLOCK *volatile saved_block = 0, *block;
enum thread_status status;
int state;
@@ -11836,7 +11462,6 @@ rb_thread_start_0(fn, arg, th)
}
else if (th->safe < 4 && (ruby_thread_abort || th->abort || RTEST(ruby_debug))) {
/* exit on main_thread */
- error_print();
rb_thread_main_jump(ruby_errinfo, RESTORE_EXIT);
}
else {
@@ -11942,21 +11567,10 @@ static VALUE
rb_thread_initialize(thread, args)
VALUE thread, args;
{
- rb_thread_t th;
-
if (!rb_block_given_p()) {
rb_raise(rb_eThreadError, "must be called with a block");
}
- th = rb_thread_check(thread);
- if (th->stk_max) {
- NODE *node = th->node;
- if (!node) {
- rb_raise(rb_eThreadError, "already initialized thread");
- }
- rb_raise(rb_eThreadError, "already initialized thread - %s:%d",
- node->nd_file, nd_line(node));
- }
- return rb_thread_start_0(rb_thread_yield, args, th);
+ return rb_thread_start_0(rb_thread_yield, args, rb_thread_check(thread));
}
@@ -12233,28 +11847,6 @@ rb_thread_trap_eval(cmd, sig, safe)
rb_thread_restore_context(curr_thread, RESTORE_TRAP);
}
-void
-rb_thread_signal_exit()
-{
- VALUE args[2];
-
- rb_thread_critical = 0;
- if (curr_thread == main_thread) {
- rb_thread_ready(curr_thread);
- rb_exit(EXIT_SUCCESS);
- }
- args[0] = INT2NUM(EXIT_SUCCESS);
- args[1] = rb_str_new2("exit");
- rb_thread_ready(main_thread);
- if (!rb_thread_dead(curr_thread)) {
- if (THREAD_SAVE_CONTEXT(curr_thread)) {
- return;
- }
- }
- rb_thread_main_jump(rb_class_new_instance(2, args, rb_eSystemExit),
- RESTORE_EXIT);
-}
-
static VALUE
rb_thread_raise(argc, argv, th)
int argc;
@@ -12490,10 +12082,9 @@ rb_thread_inspect(thread)
rb_thread_t th = rb_thread_check(thread);
const char *status = thread_status_name(th->status);
VALUE str;
- size_t len = strlen(cname)+7+16+9+1;
- str = rb_str_new(0, len); /* 7:tags 16:addr 9:status 1:nul */
- snprintf(RSTRING(str)->ptr, len, "#<%s:0x%lx %s>", cname, thread, status);
+ str = rb_str_new(0, strlen(cname)+7+16+9+1); /* 7:tags 16:addr 9:status 1:nul */
+ sprintf(RSTRING(str)->ptr, "#<%s:0x%lx %s>", cname, thread, status);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
OBJ_INFECT(str, thread);
@@ -12565,7 +12156,7 @@ rb_thread_atfork()
* 3: 15 16
*/
-VALUE rb_cCont;
+static VALUE rb_cCont;
/*
* call-seq:
@@ -12590,6 +12181,7 @@ rb_callcc(self)
volatile rb_thread_t th_save;
struct tag *tag;
struct RVarmap *vars;
+ struct BLOCK *blk;
THREAD_ALLOC(th);
cont = Data_Wrap_Struct(rb_cCont, thread_mark, thread_free, th);
@@ -12744,7 +12336,7 @@ thgroup_list(group)
* ThreadError: can't move from the enclosed thread group
*/
-static VALUE
+VALUE
thgroup_enclose(group)
VALUE group;
{
@@ -12919,9 +12511,9 @@ Init_Thread()
rb_define_method(cThGroup, "enclose", thgroup_enclose, 0);
rb_define_method(cThGroup, "enclosed?", thgroup_enclosed_p, 0);
rb_define_method(cThGroup, "add", thgroup_add, 1);
- rb_global_variable(&thgroup_default);
thgroup_default = rb_obj_alloc(cThGroup);
rb_define_const(cThGroup, "Default", thgroup_default);
+ rb_global_variable(&thgroup_default);
/* allocate main thread */
main_thread = rb_thread_alloc(rb_cThread);
@@ -13054,13 +12646,3 @@ rb_throw(tag, val)
argv[1] = val;
rb_f_throw(2, argv);
}
-
-/* flush_register_windows must not be inlined because flushrs doesn't flush
- * current frame in register stack. */
-#ifdef __ia64__
-void flush_register_windows(void)
-{
- __asm__ ("flushrs");
-}
-#endif
-
diff --git a/ext/.document b/ext/.document
index ba8182593e..797d8dcef8 100644
--- a/ext/.document
+++ b/ext/.document
@@ -1,11 +1,5 @@
# Add files to this as they become documented
-enumerator/enumerator.c
iconv/iconv.c
-nkf/lib/kconv.rb
-nkf/nkf.c
-socket/socket.c
-stringio/stringio.c
strscan/strscan.c
-win32ole
zlib/zlib.c
diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c
index 96ce8c6636..776df56ecb 100644
--- a/ext/Win32API/Win32API.c
+++ b/ext/Win32API/Win32API.c
@@ -53,12 +53,12 @@ Win32API_initialize(self, dllname, proc, import, export)
hdll = LoadLibrary(RSTRING(dllname)->ptr);
if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
- rb_iv_set(self, "__hdll__", Data_Wrap_Struct(rb_cData, 0, Win32API_FreeLibrary, (void*)hdll));
- hproc = (HANDLE)GetProcAddress(hdll, RSTRING(proc)->ptr);
+ rb_iv_set(self, "__hdll__", Data_Wrap_Struct(rb_cData, 0, Win32API_FreeLibrary, hdll));
+ hproc = GetProcAddress(hdll, RSTRING(proc)->ptr);
if (!hproc) {
str = rb_str_new3(proc);
str = rb_str_cat(str, "A", 1);
- hproc = (HANDLE)GetProcAddress(hdll, RSTRING(str)->ptr);
+ hproc = GetProcAddress(hdll, RSTRING(str)->ptr);
if (!hproc)
rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
RSTRING(proc)->ptr, RSTRING(str)->ptr);
@@ -137,9 +137,6 @@ Win32API_initialize(self, dllname, proc, import, export)
return Qnil;
}
-#ifdef _MSC_VER
-#pragma optimize("g", off)
-#endif
static VALUE
Win32API_Call(argc, argv, obj)
int argc;
@@ -163,7 +160,7 @@ Win32API_Call(argc, argv, obj)
if (items != nimport)
- rb_raise(rb_eRuntimeError, "wrong number of parameters: expected %d, got %d",
+ rb_raise(rb_eRuntimeError, "Wrong number of parameters: expected %d, got %d.\n",
nimport, items);
for (i = 0; i < nimport; i++) {
diff --git a/ext/Win32API/extconf.rb b/ext/Win32API/extconf.rb
index 865788556f..134a6e5b92 100644
--- a/ext/Win32API/extconf.rb
+++ b/ext/Win32API/extconf.rb
@@ -1,6 +1,5 @@
require 'mkmf'
-dir_config("win32")
if have_header("windows.h") and have_library("kernel32")
create_makefile("Win32API")
end
diff --git a/ext/Win32API/lib/win32/resolv.rb b/ext/Win32API/lib/win32/resolv.rb
index 6534d20760..5a99d04d55 100644
--- a/ext/Win32API/lib/win32/resolv.rb
+++ b/ext/Win32API/lib/win32/resolv.rb
@@ -84,7 +84,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
[ 'NameServer', 'DhcpNameServer' ].each do |key|
ns = regif.read_s(key)
unless ns.empty?
- nameserver.concat(ns.split(/[,\s]\s*/))
+ nameserver.concat(ns.split(/\s+/))
break
end
end
@@ -141,7 +141,7 @@ else
slist = reg.read_s("SearchList")
search << domain unless domain.empty?
search.concat(slist.split(/,\s*/))
- nameserver.concat(ns.split(/[,\s]\s*/))
+ nameserver.concat(ns.split(/,\s*/))
end
end
rescue Registry::Error
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 04266b1d42..4ccba8809a 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -13,7 +13,6 @@
*
*/
-#include "ruby.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -21,6 +20,7 @@
#include <errno.h>
#include <float.h>
#include <math.h>
+#include "ruby.h"
#include "math.h"
#include "version.h"
@@ -41,123 +41,8 @@ VALUE rb_cBigDecimal;
*/
#define DoSomeOne(x,y) rb_num_coerce_bin(x,y)
-#if 0
-/* BigDecimal provides arbitrary-precision floating point decimal arithmetic.
- *
- * Copyright (C) 2002 by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file
- * of the BigDecimal distribution.
- *
- * Documented by mathew <meta@pobox.com>.
- *
- * = Introduction
- *
- * Ruby provides built-in support for arbitrary precision integer arithmetic.
- * For example:
- *
- * 42**13 -> 1265437718438866624512
- *
- * BigDecimal provides similar support for very large or very accurate floating
- * point numbers.
- *
- * Decimal arithmetic is also useful for general calculation, because it
- * provides the correct answers people expect--whereas normal binary floating
- * point arithmetic often introduces subtle errors because of the conversion
- * between base 10 and base 2. For example, try:
- *
- * sum = 0
- * for i in (1..10000)
- * sum = sum + 0.0001
- * end
- * print sum
- *
- * and contrast with the output from:
- *
- * require 'bigdecimal'
- *
- * sum = BigDecimal.new("0")
- * for i in (1..10000)
- * sum = sum + BigDecimal.new("0.0001")
- * end
- * print sum
- *
- * Similarly:
- *
- * (BigDecimal.new("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") -> true
- *
- * (1.2 - 1.0) == 0.2 -> false
- *
- * = Special features of accurate decimal arithmetic
- *
- * Because BigDecimal is more accurate than normal binary floating point
- * arithmetic, it requires some special values.
- *
- * == Infinity
- *
- * BigDecimal sometimes needs to return infinity, for example if you divide
- * a value by zero.
- *
- * BigDecimal.new("1.0") / BigDecimal.new("0.0") -> infinity
- *
- * BigDecimal.new("-1.0") / BigDecimal.new("0.0") -> -infinity
- *
- * You can represent infinite numbers to BigDecimal using the strings
- * 'Infinity', '+Infinity' and '-Infinity' (case-sensitive)
- *
- * == Not a Number
- *
- * When a computation results in an undefined value, the special value NaN
- * (for 'not a number') is returned.
- *
- * Example:
- *
- * BigDecimal.new("0.0") / BigDecimal.new("0.0") -> NaN
- *
- * You can also create undefined values. NaN is never considered to be the
- * same as any other value, even NaN itself:
- *
- * n = BigDecimal.new('NaN')
- *
- * n == 0.0 -> nil
- *
- * n == n -> nil
- *
- * == Positive and negative zero
- *
- * If a computation results in a value which is too small to be represented as
- * a BigDecimal within the currently specified limits of precision, zero must
- * be returned.
- *
- * If the value which is too small to be represented is negative, a BigDecimal
- * value of negative zero is returned. If the value is positive, a value of
- * positive zero is returned.
- *
- * BigDecimal.new("1.0") / BigDecimal.new("-Infinity") -> -0.0
- *
- * BigDecimal.new("1.0") / BigDecimal.new("Infinity") -> 0.0
- *
- * (See BigDecimal.mode for how to specify limits of precision.)
- *
- * Note that -0.0 and 0.0 are considered to be the same for the purposes of
- * comparison.
- *
- * Note also that in mathematics, there is no particular concept of negative
- * or positive zero; true mathematical zero has no sign.
- */
-void
-Init_BigDecimal()
-{
- /* This is a #if-ed out function to fool Rdoc into documenting the class. */
- /* The real init function is Init_bigdecimal() further down. */
-}
-#endif
-
/*
- * Returns the BigDecimal version number.
- *
- * Ruby 1.8.0 returns 1.0.0.
- * Ruby 1.8.1 thru 1.8.3 return 1.0.1.
+ * **** BigDecimal version ****
*/
static VALUE
BigDecimal_version(VALUE self)
@@ -247,28 +132,12 @@ SomeOneMayDoIt:
return NULL; /* NULL means to coerce */
}
-/* call-seq:
- * BigDecimal.double_fig
- *
- * The BigDecimal.double_fig class method returns the number of digits a
- * Float number is allowed to have. The result depends upon the CPU and OS
- * in use.
- */
static VALUE
BigDecimal_double_fig(VALUE self)
{
return INT2FIX(VpDblFig());
}
-/* call-seq:
- * precs
- *
- * Returns an Array of two Integer values.
- *
- * The first value is the current number of significant digits in the
- * BigDecimal. The second value is the maximum number of significant digits
- * for the BigDecimal.
- */
static VALUE
BigDecimal_prec(VALUE self)
{
@@ -319,9 +188,6 @@ BigDecimal_dump(int argc, VALUE *argv, VALUE self)
return rb_str_new2(psz);
}
-/*
- * Internal method used to provide marshalling support. See the Marshal module.
- */
static VALUE
BigDecimal_load(VALUE self, VALUE str)
{
@@ -336,7 +202,7 @@ BigDecimal_load(VALUE self, VALUE str)
/* First get max prec */
while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
if(!ISDIGIT(ch)) {
- rb_raise(rb_eTypeError, "load failed: invalid character in the marshaled string");
+ rb_raise(rb_eTypeError, "Load failed: invalid character in the marshaled string");
}
m = m*10 + (unsigned long)(ch-'0');
}
@@ -347,44 +213,6 @@ BigDecimal_load(VALUE self, VALUE str)
return ToValue(pv);
}
- /* call-seq:
- * BigDecimal.mode(mode, value)
- *
- * Controls handling of arithmetic exceptions and rounding. If no value
- * is supplied, the current value is returned.
- *
- * Six values of the mode parameter control the handling of arithmetic
- * exceptions:
- *
- * BigDecimal::EXCEPTION_NaN
- * BigDecimal::EXCEPTION_INFINITY
- * BigDecimal::EXCEPTION_UNDERFLOW
- * BigDecimal::EXCEPTION_OVERFLOW
- * BigDecimal::EXCEPTION_ZERODIVIDE
- * BigDecimal::EXCEPTION_ALL
- *
- * For each mode parameter above, if the value set is false, computation
- * continues after an arithmetic exception of the appropriate type.
- * When computation continues, results are as follows:
- *
- * EXCEPTION_NaN:: NaN
- * EXCEPTION_INFINITY:: +infinity or -infinity
- * EXCEPTION_UNDERFLOW:: 0
- * EXCEPTION_OVERFLOW:: +infinity or -infinity
- * EXCEPTION_ZERODIVIDE:: +infinity or -infinity
- *
- * One value of the mode parameter controls the rounding of numeric values:
- * BigDecimal::ROUND_MODE. The values it can take are:
- *
- * ROUND_UP:: round away from zero
- * ROUND_DOWN:: round towards zero (truncate)
- * ROUND_HALF_UP:: round up if the appropriate digit >= 5, otherwise truncate (default)
- * ROUND_HALF_DOWN:: round up if the appropriate digit >= 6, otherwise truncate
- * ROUND_HALF_EVEN:: round towards the even neighbor (Banker's rounding)
- * ROUND_CEILING:: round towards positive infinity (ceil)
- * ROUND_FLOOR:: round towards negative infinity (floor)
- *
- */
static VALUE
BigDecimal_mode(int argc, VALUE *argv, VALUE self)
{
@@ -402,7 +230,7 @@ BigDecimal_mode(int argc, VALUE *argv, VALUE self)
fo = VpGetException();
if(val==Qnil) return INT2FIX(fo);
if(val!=Qfalse && val!=Qtrue) {
- rb_raise(rb_eTypeError, "second argument must be true or false");
+ rb_raise(rb_eTypeError, "The second argument must be true or false.");
return Qnil; /* Not reached */
}
if(f&VP_EXCEPTION_INFINITY) {
@@ -422,13 +250,13 @@ BigDecimal_mode(int argc, VALUE *argv, VALUE self)
if(val==Qnil) return INT2FIX(fo);
Check_Type(val, T_FIXNUM);
if(!VpIsRoundMode(FIX2INT(val))) {
- rb_raise(rb_eTypeError, "invalid rounding mode");
+ rb_raise(rb_eTypeError, "Invalid rounding mode.");
return Qnil;
}
fo = VpSetRoundMode((unsigned long)FIX2INT(val));
return INT2FIX(fo);
}
- rb_raise(rb_eTypeError, "first argument for BigDecimal#mode invalid");
+ rb_raise(rb_eTypeError, "The first argument for BigDecimal#mode is invalid.");
return Qnil;
}
@@ -481,7 +309,7 @@ VpCreateRbObject(U_LONG mx, char *str)
return pv;
}
-/* Returns True if the value is Not a Number */
+
static VALUE
BigDecimal_IsNaN(VALUE self)
{
@@ -490,7 +318,6 @@ BigDecimal_IsNaN(VALUE self)
return Qfalse;
}
-/* Returns True if the value is infinite */
static VALUE
BigDecimal_IsInfinite(VALUE self)
{
@@ -500,7 +327,6 @@ BigDecimal_IsInfinite(VALUE self)
return Qnil;
}
-/* Returns True if the value is finite (not NaN or infinite) */
static VALUE
BigDecimal_IsFinite(VALUE self)
{
@@ -510,10 +336,6 @@ BigDecimal_IsFinite(VALUE self)
return Qtrue;
}
-/* Returns the value as an integer (Fixnum or Bignum).
- *
- * If the BigNumber is infinity or NaN, returns nil.
- */
static VALUE
BigDecimal_to_i(VALUE self)
{
@@ -577,10 +399,6 @@ BigDecimal_induced_from(VALUE self, VALUE x)
return p->obj;
}
-/* Returns a new Float object having approximately the same value as the
- * BigDecimal number. Normal accuracy limits and built-in errors of binary
- * Float arithmetic apply.
- */
static VALUE
BigDecimal_to_f(VALUE self)
{
@@ -594,27 +412,13 @@ BigDecimal_to_f(VALUE self)
errno = 0;
d2 = pow(10.0,(double)e);
if((errno == ERANGE && e>0) || (d2>1.0 && (fabs(d) > (DBL_MAX / d2)))) {
- VpException(VP_EXCEPTION_OVERFLOW,"BigDecimal to Float conversion",0);
+ VpException(VP_EXCEPTION_OVERFLOW,"BigDecimal to Float conversion.",0);
if(d>0.0) return rb_float_new(DBL_MAX);
else return rb_float_new(-DBL_MAX);
}
return rb_float_new(d*d2);
}
-/* The coerce method provides support for Ruby type coercion. It is not
- * enabled by default.
- *
- * This means that binary operations like + * / or - can often be performed
- * on a BigDecimal and an object of another type, if the other object can
- * be coerced into a BigDecimal value.
- *
- * e.g.
- * a = BigDecimal.new("1.0")
- * b = a / 2.0 -> 0.5
- *
- * Note that coercing a String to a BigDecimal is not supported by default;
- * it requires a special compile-time option when building Ruby.
- */
static VALUE
BigDecimal_coerce(VALUE self, VALUE other)
{
@@ -636,17 +440,6 @@ BigDecimal_uplus(VALUE self)
return self;
}
- /* call-seq:
- * add(value, digits)
- *
- * Add the specified value.
- *
- * e.g.
- * c = a.add(b,n)
- * c = a + b
- *
- * digits:: If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.
- */
static VALUE
BigDecimal_add(VALUE self, VALUE r)
{
@@ -674,17 +467,6 @@ BigDecimal_add(VALUE self, VALUE r)
return ToValue(c);
}
- /* call-seq:
- * sub(value, digits)
- *
- * Subtract the specified value.
- *
- * e.g.
- * c = a.sub(b,n)
- * c = a - b
- *
- * digits:: If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.
- */
static VALUE
BigDecimal_sub(VALUE self, VALUE r)
{
@@ -740,7 +522,6 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
rb_bug("Undefined operation in BigDecimalCmp()");
}
-/* Returns True if the value is zero. */
static VALUE
BigDecimal_zero(VALUE self)
{
@@ -748,7 +529,6 @@ BigDecimal_zero(VALUE self)
return VpIsZero(a) ? Qtrue : Qfalse;
}
-/* Returns True if the value is non-zero. */
static VALUE
BigDecimal_nonzero(VALUE self)
{
@@ -756,84 +536,42 @@ BigDecimal_nonzero(VALUE self)
return VpIsZero(a) ? Qnil : self;
}
-/* The comparison operator.
- * a <=> b is 0 if a == b, 1 if a > b, -1 if a < b.
- */
static VALUE
BigDecimal_comp(VALUE self, VALUE r)
{
return BigDecimalCmp(self, r, '*');
}
-/*
- * Tests for value equality; returns true if the values are equal.
- *
- * The == and === operators and the eql? method have the same implementation
- * for BigDecimal.
- *
- * Values may be coerced to perform the comparison:
- *
- * BigDecimal.new('1.0') == 1.0 -> true
- */
static VALUE
BigDecimal_eq(VALUE self, VALUE r)
{
return BigDecimalCmp(self, r, '=');
}
-/* Returns true if the values are not equal in value. Values may be coerced
- * to perform the comparison:
- *
- * BigDecimal.new('1.0') != 1.0 -> false
- */
static VALUE
BigDecimal_ne(VALUE self, VALUE r)
{
return BigDecimalCmp(self, r, '!');
}
-/* call-seq:
- * a < b
- *
- * Returns true if a is less than b. Values may be coerced to perform the
- * comparison (see ==, coerce).
- */
static VALUE
BigDecimal_lt(VALUE self, VALUE r)
{
return BigDecimalCmp(self, r, '<');
}
-/* call-seq:
- * a <= b
- *
- * Returns true if a is less than or equal to b. Values may be coerced to
- * perform the comparison (see ==, coerce).
- */
static VALUE
BigDecimal_le(VALUE self, VALUE r)
{
return BigDecimalCmp(self, r, 'L');
}
-/* call-seq:
- * a > b
- *
- * Returns true if a is greater than b. Values may be coerced to
- * perform the comparison (see ==, coerce).
- */
static VALUE
BigDecimal_gt(VALUE self, VALUE r)
{
return BigDecimalCmp(self, r, '>');
}
-/* call-seq:
- * a >= b
- *
- * Returns true if a is greater than or equal to b. Values may be coerced to
- * perform the comparison (see ==, coerce)
- */
static VALUE
BigDecimal_ge(VALUE self, VALUE r)
{
@@ -851,17 +589,6 @@ BigDecimal_neg(VALUE self)
return ToValue(c);
}
- /* call-seq:
- * mult(value, digits)
- *
- * Multiply by the specified value.
- *
- * e.g.
- * c = a.mult(b,n)
- * c = a * b
- *
- * digits:: If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.
- */
static VALUE
BigDecimal_mult(VALUE self, VALUE r)
{
@@ -900,23 +627,6 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
return (VALUE)0;
}
- /* call-seq:
- * div(value, digits)
- * quo(value)
- *
- * Divide by the specified value.
- *
- * e.g.
- * c = a.div(b,n)
- *
- * digits:: If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to BigDecimal.mode.
- *
- * If digits is 0, the result is the same as the / operator. If not, the
- * result is an integer BigDecimal, by analogy with Float#div.
- *
- * The alias quo is provided since div(value, 0) is the same as computing
- * the quotient; see divmod.
- */
static VALUE
BigDecimal_div(VALUE self, VALUE r)
/* For c = self/r: with round operation */
@@ -995,12 +705,6 @@ NaN:
return (VALUE)0;
}
-/* call-seq:
- * a % b
- * a.modulo(b)
- *
- * Returns the modulus from dividing by b. See divmod.
- */
static VALUE
BigDecimal_mod(VALUE self, VALUE r) /* %: a%b = a - (a.to_f/b).floor * b */
{
@@ -1051,13 +755,6 @@ BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv)
return (VALUE)0;
}
-/* Returns the remainder from dividing by the value.
- *
- * If the values divided are of the same sign, the remainder is the same as
- * the modulus (see divmod).
- *
- * Otherwise, the remainder is the modulus minus the value divided by.
- */
static VALUE
BigDecimal_remainder(VALUE self, VALUE r) /* remainder */
{
@@ -1068,25 +765,6 @@ BigDecimal_remainder(VALUE self, VALUE r) /* remainder */
return ToValue(rv);
}
-/* Divides by the specified value, and returns the quotient and modulus
- * as BigDecimal numbers. The quotient is rounded towards negative infinity.
- *
- * For example:
- *
- * require 'bigdecimal'
- *
- * a = BigDecimal.new("42")
- * b = BigDecimal.new("9")
- *
- * q,m = a.divmod(b)
- *
- * c = q * b + m
- *
- * a == c -> true
- *
- * The quotient q is (a/b).floor, and the modulus is the amount that must be
- * added to q * b to get a.
- */
static VALUE
BigDecimal_divmod(VALUE self, VALUE r)
{
@@ -1188,12 +866,6 @@ BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
}
}
-/* Returns the absolute value.
- *
- * BigDecimal('5').abs -> 5
- *
- * BigDecimal('-3').abs -> 3
- */
static VALUE
BigDecimal_abs(VALUE self)
{
@@ -1209,13 +881,6 @@ BigDecimal_abs(VALUE self)
return ToValue(c);
}
-/* call-seq:
- * sqrt(n)
- *
- * Returns the square root of the value.
- *
- * If n is specified, returns at least that many significant digits.
- */
static VALUE
BigDecimal_sqrt(VALUE self, VALUE nFig)
{
@@ -1233,8 +898,6 @@ BigDecimal_sqrt(VALUE self, VALUE nFig)
return ToValue(c);
}
-/* Return the integer part of the number.
- */
static VALUE
BigDecimal_fix(VALUE self)
{
@@ -1249,28 +912,6 @@ BigDecimal_fix(VALUE self)
return ToValue(c);
}
-/* call-seq:
- * round(n,mode)
- *
- * Round to the nearest 1 (by default), returning the result as a BigDecimal.
- *
- * BigDecimal('3.14159').round -> 3
- *
- * BigDecimal('8.7').round -> 9
- *
- * If n is specified and positive, the fractional part of the result has no
- * more than that many digits.
- *
- * If n is specified and negative, at least that many digits to the left of the
- * decimal point will be 0 in the result.
- *
- * BigDecimal('3.14159').round(3) -> 3.142
- *
- * BigDecimal('13345.234').round(-2) -> 13300.0
- *
- * The value of the optional mode argument can be used to determine how
- * rounding is performed; see BigDecimal.mode.
- */
static VALUE
BigDecimal_round(int argc, VALUE *argv, VALUE self)
{
@@ -1299,7 +940,7 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
Check_Type(vRound, T_FIXNUM);
sw = FIX2INT(vRound);
if(!VpIsRoundMode(sw)) {
- rb_raise(rb_eTypeError, "invalid rounding mode");
+ rb_raise(rb_eTypeError, "Invalid rounding mode.");
return Qnil;
}
break;
@@ -1314,25 +955,6 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
return ToValue(c);
}
-/* call-seq:
- * truncate(n)
- *
- * Truncate to the nearest 1, returning the result as a BigDecimal.
- *
- * BigDecimal('3.14159').truncate -> 3
- *
- * BigDecimal('8.7').truncate -> 8
- *
- * If n is specified and positive, the fractional part of the result has no
- * more than that many digits.
- *
- * If n is specified and negative, at least that many digits to the left of the
- * decimal point will be 0 in the result.
- *
- * BigDecimal('3.14159').truncate(3) -> 3.141
- *
- * BigDecimal('13345.234').truncate(-2) -> 13300.0
- */
static VALUE
BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
{
@@ -1358,8 +980,6 @@ BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
return ToValue(c);
}
-/* Return the fractional part of the number.
- */
static VALUE
BigDecimal_frac(VALUE self)
{
@@ -1374,25 +994,6 @@ BigDecimal_frac(VALUE self)
return ToValue(c);
}
-/* call-seq:
- * floor(n)
- *
- * Return the largest integer less than or equal to the value, as a BigDecimal.
- *
- * BigDecimal('3.14159').floor -> 3
- *
- * BigDecimal('-9.1').floor -> -10
- *
- * If n is specified and positive, the fractional part of the result has no
- * more than that many digits.
- *
- * If n is specified and negative, at least that
- * many digits to the left of the decimal point will be 0 in the result.
- *
- * BigDecimal('3.14159').floor(3) -> 3.141
- *
- * BigDecimal('13345.234').floor(-2) -> 13300.0
- */
static VALUE
BigDecimal_floor(int argc, VALUE *argv, VALUE self)
{
@@ -1418,25 +1019,6 @@ BigDecimal_floor(int argc, VALUE *argv, VALUE self)
return ToValue(c);
}
-/* call-seq:
- * ceil(n)
- *
- * Return the smallest integer greater than or equal to the value, as a BigDecimal.
- *
- * BigDecimal('3.14159').ceil -> 4
- *
- * BigDecimal('-9.1').ceil -> -9
- *
- * If n is specified and positive, the fractional part of the result has no
- * more than that many digits.
- *
- * If n is specified and negative, at least that
- * many digits to the left of the decimal point will be 0 in the result.
- *
- * BigDecimal('3.14159').ceil(3) -> 3.142
- *
- * BigDecimal('13345.234').ceil(-2) -> 13400.0
- */
static VALUE
BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
{
@@ -1462,36 +1044,6 @@ BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
return ToValue(c);
}
-/* call-seq:
- * to_s(s)
- *
- * Converts the value to a string.
- *
- * The default format looks like 0.xxxxEnn.
- *
- * The optional parameter s consists of either an integer; or an optional '+'
- * or ' ', followed by an optional number, followed by an optional 'E' or 'F'.
- *
- * If there is a '+' at the start of s, positive values are returned with
- * a leading '+'.
- *
- * A space at the start of s returns positive values with a leading space.
- *
- * If s contains a number, a space is inserted after each group of that many
- * fractional digits.
- *
- * If s ends with an 'E', engineering notation (0.xxxxEnn) is used.
- *
- * If s ends with an 'F', conventional floating point notation is used.
- *
- * Examples:
- *
- * BigDecimal.new('-123.45678901234567890').to_s('5F') -> '-123.45678 90123 45678 9'
- *
- * BigDecimal.new('123.45678901234567890').to_s('+8F') -> '+123.45678901 23456789'
- *
- * BigDecimal.new('123.45678901234567890').to_s(' F') -> ' 123.4567890123456789'
- */
static VALUE
BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
{
@@ -1545,30 +1097,6 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
return rb_str_new2(psz);
}
-/* Splits a BigDecimal number into four parts, returned as an array of values.
- *
- * The first value represents the sign of the BigDecimal, and is -1 or 1, or 0
- * if the BigDecimal is Not a Number.
- *
- * The second value is a string representing the significant digits of the
- * BigDecimal, with no leading zeros.
- *
- * The third value is the base used for arithmetic (currently always 10) as an
- * Integer.
- *
- * The fourth value is an Integer exponent.
- *
- * If the BigDecimal can be represented as 0.xxxxxx*10**n, then xxxxxx is the
- * string of significant digits with no leading zeros, and n is the exponent.
- *
- * From these values, you can translate a BigDecimal to a float as follows:
- *
- * sign, significant_digits, base, exponent = a.split
- * f = sign * "0.#{significant_digits}".to_f * (base ** exponent)
- *
- * (Note that the to_f method is provided as a more convenient way to translate
- * a BigDecimal to a Float.)
- */
static VALUE
BigDecimal_split(VALUE self)
{
@@ -1597,11 +1125,6 @@ BigDecimal_split(VALUE self)
return obj;
}
-/* Returns the exponent of the BigDecimal number, as an Integer.
- *
- * If the number can be represented as 0.xxxxxx*10**n where xxxxxx is a string
- * of digits with no leading zeros, then n is the exponent.
- */
static VALUE
BigDecimal_exponent(VALUE self)
{
@@ -1609,16 +1132,6 @@ BigDecimal_exponent(VALUE self)
return INT2NUM(e);
}
-/* Returns debugging information about the value as a string of comma-separated
- * values in angle brackets with a leading #:
- *
- * BigDecimal.new("1234.5678").inspect ->
- * "#<BigDecimal:b7ea1130,'0.12345678E4',8(12)>"
- *
- * The first part is the address, the second is the value as a string, and
- * the final part ss(mm) is the current number of significant digits and the
- * maximum number of significant digits, respectively.
- */
static VALUE
BigDecimal_inspect(VALUE self)
{
@@ -1641,13 +1154,6 @@ BigDecimal_inspect(VALUE self)
return obj;
}
-/* call-seq:
- * power(n)
- *
- * Returns the value raised to the power of n. Note that n must be an Integer.
- *
- * Also available as the operator **
- */
static VALUE
BigDecimal_power(VALUE self, VALUE p)
{
@@ -1691,18 +1197,6 @@ BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
return ToValue(pv);
}
- /* call-seq:
- * new(initial, digits)
- *
- * Create a new BigDecimal object.
- *
- * initial:: The initial value, as a String. Spaces are ignored, unrecognized characters terminate the value.
- *
- * digits:: The number of significant digits, as a Fixnum. If omitted or 0, the number of significant digits is determined from the initial value.
- *
- * The actual number of significant digits used in computation is usually
- * larger than the specified number.
- */
static VALUE
BigDecimal_new(int argc, VALUE *argv, VALUE self)
{
@@ -1722,18 +1216,6 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
return ToValue(pv);
}
- /* call-seq:
- * BigDecimal.limit(digits)
- *
- * Limit the number of significant digits in newly created BigDecimal
- * numbers to the specified value. Rounding is performed as necessary,
- * as specified by BigDecimal.mode.
- *
- * A limit of 0, the default, means no upper limit.
- *
- * The limit specified by this method takes priority over any limit
- * specified to instance methods such as ceil, floor, truncate, or round.
- */
static VALUE
BigDecimal_limit(int argc, VALUE *argv, VALUE self)
{
@@ -1753,22 +1235,6 @@ BigDecimal_limit(int argc, VALUE *argv, VALUE self)
return nCur;
}
-/* Returns the sign of the value.
- *
- * Returns a positive value if > 0, a negative value if < 0, and a
- * zero if == 0.
- *
- * The specific value returned indicates the type and sign of the BigDecimal,
- * as follows:
- *
- * BigDecimal::SIGN_NaN:: value is Not a Number
- * BigDecimal::SIGN_POSITIVE_ZERO:: value is +0
- * BigDecimal::SIGN_NEGATIVE_ZERO:: value is -0
- * BigDecimal::SIGN_POSITIVE_INFINITE:: value is +infinity
- * BigDecimal::SIGN_NEGATIVE_INFINITE:: value is -infinity
- * BigDecimal::SIGN_POSITIVE_FINITE:: value is positive
- * BigDecimal::SIGN_NEGATIVE_FINITE:: value is negative
- */
static VALUE
BigDecimal_sign(VALUE self)
{ /* sign */
@@ -1798,94 +1264,37 @@ Init_bigdecimal(void)
rb_define_singleton_method(rb_cBigDecimal, "ver", BigDecimal_version, 0);
/* Constants definition */
-
- /*
- * Base value used in internal calculations. On a 32 bit system, BASE
- * is 10000, indicating that calculation is done in groups of 4 digits.
- * (If it were larger, BASE**2 wouldn't fit in 32 bits, so you couldn't
- * guarantee that two groups could always be multiplied together without
- * overflow.)
- */
rb_define_const(rb_cBigDecimal, "BASE", INT2FIX((S_INT)VpBaseVal()));
/* Exceptions */
-
- /*
- * Determines whether overflow, underflow or zero divide result in
- * an exception being thrown. See BigDecimal.mode.
- */
rb_define_const(rb_cBigDecimal, "EXCEPTION_ALL",INT2FIX(VP_EXCEPTION_ALL));
-
- /*
- * Determines what happens when the result of a computation is not a
- * number (NaN). See BigDecimal.mode.
- */
rb_define_const(rb_cBigDecimal, "EXCEPTION_NaN",INT2FIX(VP_EXCEPTION_NaN));
-
- /*
- * Determines what happens when the result of a computation is infinity.
- * See BigDecimal.mode.
- */
rb_define_const(rb_cBigDecimal, "EXCEPTION_INFINITY",INT2FIX(VP_EXCEPTION_INFINITY));
-
- /*
- * Determines what happens when the result of a computation is an underflow
- * (a result too small to be represented). See BigDecimal.mode.
- */
rb_define_const(rb_cBigDecimal, "EXCEPTION_UNDERFLOW",INT2FIX(VP_EXCEPTION_UNDERFLOW));
-
- /*
- * Determines what happens when the result of a computation is an underflow
- * (a result too large to be represented). See BigDecimal.mode.
- */
rb_define_const(rb_cBigDecimal, "EXCEPTION_OVERFLOW",INT2FIX(VP_EXCEPTION_OVERFLOW));
-
- /*
- * Determines what happens when a division by zero is performed.
- * See BigDecimal.mode.
- */
rb_define_const(rb_cBigDecimal, "EXCEPTION_ZERODIVIDE",INT2FIX(VP_EXCEPTION_ZERODIVIDE));
- /*
- * Determines what happens when a result must be rounded in order to
- * fit in the appropriate number of significant digits. See
- * BigDecimal.mode.
- */
+ /* Computation mode */
rb_define_const(rb_cBigDecimal, "ROUND_MODE",INT2FIX(VP_ROUND_MODE));
-
- /* Indicates that values should be rounded away from zero. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_UP",INT2FIX(VP_ROUND_UP));
- /* Indicates that values should be rounded towards zero. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_DOWN",INT2FIX(VP_ROUND_DOWN));
- /* Indicates that digits >= 5 should be rounded up, others rounded down. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_HALF_UP",INT2FIX(VP_ROUND_HALF_UP));
- /* Indicates that digits >= 6 should be rounded up, others rounded down. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_HALF_DOWN",INT2FIX(VP_ROUND_HALF_DOWN));
- /* Round towards +infinity. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_CEILING",INT2FIX(VP_ROUND_CEIL));
- /* Round towards -infinity. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_FLOOR",INT2FIX(VP_ROUND_FLOOR));
- /* Round towards the even neighbor. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_HALF_EVEN",INT2FIX(VP_ROUND_HALF_EVEN));
- /* Indicates that a value is not a number. See BigDecimal.sign. */
+ /* Constants for sign value */
rb_define_const(rb_cBigDecimal, "SIGN_NaN",INT2FIX(VP_SIGN_NaN));
- /* Indicates that a value is +0. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_ZERO",INT2FIX(VP_SIGN_POSITIVE_ZERO));
- /* Indicates that a value is -0. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_ZERO",INT2FIX(VP_SIGN_NEGATIVE_ZERO));
- /* Indicates that a value is positive and finite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_FINITE",INT2FIX(VP_SIGN_POSITIVE_FINITE));
- /* Indicates that a value is negative and finite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_FINITE",INT2FIX(VP_SIGN_NEGATIVE_FINITE));
- /* Indicates that a value is positive and infinite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_INFINITE",INT2FIX(VP_SIGN_POSITIVE_INFINITE));
- /* Indicates that a value is negative and infinite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_INFINITE",INT2FIX(VP_SIGN_NEGATIVE_INFINITE));
/* instance methods */
rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0);
-
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2);
rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2);
@@ -2496,25 +1905,14 @@ VpAlloc(U_LONG mx, char *szVal)
return vp;
}
- /* Skip all '_' after digit: 2006-6-30 */
- ni = 0;
+ /* Skip all spaces */
psz = ALLOCA_N(char,strlen(szVal)+1);
i = 0;
ipn = 0;
while(psz[i]=szVal[ipn]) {
- if(ISDIGIT(psz[i])) ++ni;
- if(psz[i]=='_') {
- if(ni>0) {ipn++;continue;}
- psz[i]=0;
- break;
- }
+ if(ISSPACE(szVal[ipn])) {ipn++;continue;}
++i; ++ipn;
}
- /* Skip trailing spaces */
- while((--i)>0) {
- if(ISSPACE(psz[i])) psz[i] = 0;
- else break;
- }
szVal = psz;
/* Check on Inf & NaN */
@@ -3906,7 +3304,7 @@ VpCtoV(Real *a, char *int_chr, U_LONG ni, char *frac, U_LONG nf, char *exp_chr,
es = e*((S_INT)BASE_FIG);
e = e * 10 + exp_chr[i] - '0';
if(es>e*((S_INT)BASE_FIG)) {
- return VpException(VP_EXCEPTION_INFINITY,"exponent overflow",0);
+ return VpException(VP_EXCEPTION_INFINITY,"Exponent overflow",0);
}
++i;
}
@@ -4325,45 +3723,28 @@ VpMidRound(Real *y, int f, int nf)
* nf: digit location to round from the the decimal point.
*/
{
- /* fracf: any positive digit under rounding position? */
- /* exptoadd: number of digits needed to compensate negative nf */
- int n,i,ix,ioffset,fracf,exptoadd;
- U_LONG v,shifter;
+ int n,i,ix,ioffset;
+ U_LONG v;
U_LONG div;
nf += y->exponent*((int)BASE_FIG);
- exptoadd=0;
- if (nf < 0) {
- exptoadd = -nf;
- nf = 0;
- }
/* ix: x->fraq[ix] contains round position */
ix = nf/(int)BASE_FIG;
- if(((U_LONG)ix)>=y->Prec) return 0; /* Unable to round */
+ if(ix<0 || ((U_LONG)ix)>=y->Prec) return 0; /* Unable to round */
ioffset = nf - ix*((int)BASE_FIG);
+ memset(y->frac+ix+1, 0, (y->Prec - (ix+1)) * sizeof(U_LONG));
v = y->frac[ix];
/* drop digits after pointed digit */
n = BASE_FIG - ioffset - 1;
- for(shifter=1,i=0;i<n;++i) shifter *= 10;
- fracf = (v%(shifter*10) > 0);
- v /= shifter;
+ for(i=0;i<n;++i) v /= 10;
div = v/10;
v = v - div*10;
- if (fracf == 0) {
- for(i=ix+1;i<y->Prec;i++) {
- if (y->frac[i]%BASE) {
- fracf = 1;
- break;
- }
- }
- }
- memset(y->frac+ix+1, 0, (y->Prec - (ix+1)) * sizeof(U_LONG));
switch(f) {
case VP_ROUND_DOWN: /* Truncate */
break;
case VP_ROUND_UP: /* Roundup */
- if(fracf) ++div;
+ if(v) ++div;
break;
case VP_ROUND_HALF_UP: /* Round half up */
if(v>=5) ++div;
@@ -4372,10 +3753,10 @@ VpMidRound(Real *y, int f, int nf)
if(v>=6) ++div;
break;
case VP_ROUND_CEIL: /* ceil */
- if(fracf && (VpGetSign(y)>0)) ++div;
+ if(v && (VpGetSign(y)>0)) ++div;
break;
case VP_ROUND_FLOOR: /* floor */
- if(fracf && (VpGetSign(y)<0)) ++div;
+ if(v && (VpGetSign(y)<0)) ++div;
break;
case VP_ROUND_HALF_EVEN: /* Banker's rounding */
if(v>5) ++div;
@@ -4395,26 +3776,13 @@ VpMidRound(Real *y, int f, int nf)
VpRdup(y,ix);
} else {
S_INT s = VpGetSign(y);
- int e = y->exponent;
VpSetOne(y);
VpSetSign(y,s);
- y->exponent = e+1;
}
} else {
y->frac[ix] = div;
VpNmlz(y);
}
- if (exptoadd > 0) {
- y->exponent += exptoadd/BASE_FIG;
- exptoadd %= BASE_FIG;
- for(i=0;i<exptoadd;i++) {
- y->frac[0] *= 10;
- if (y->frac[0] >= BASE) {
- y->frac[0] /= BASE;
- y->exponent++;
- }
- }
- }
return 1;
}
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index d80eeab901..34a60ae67a 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -1,27 +1,9 @@
#
-# require 'bigdecimal/jacobian'
+# jacobian.rb
#
-# Provides methods to compute the Jacobian matrix of a set of equations at a
-# point x. In the methods below:
-#
-# f is an Object which is used to compute the Jacobian matrix of the equations.
-# It must provide the following methods:
-#
-# f.values(x):: returns the values of all functions at x
-#
-# f.zero:: returns 0.0
-# f.one:: returns 1.0
-# f.two:: returns 1.0
-# f.ten:: returns 10.0
-#
-# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal.
-#
-# x is the point at which to compute the Jacobian.
-#
-# fx is f.values(x).
+# Computes Jacobian matrix of f at x
#
module Jacobian
- #--
def isEqual(a,b,zero=0.0,e=1.0e-8)
aa = a.abs
bb = b.abs
@@ -35,10 +17,7 @@ module Jacobian
end
end
end
- #++
- # Computes the derivative of f[i] at x[i].
- # fx is the value of f at x.
def dfdxi(f,fx,x,i)
nRetry = 0
n = x.size
@@ -70,7 +49,6 @@ module Jacobian
deriv
end
- # Computes the Jacobian of f at x. fx is the value of f at x.
def jacobian(f,fx,x)
n = x.size
dfdx = Array::new(n*n)
diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
index 8f4888725e..1d5d3170cc 100644
--- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
+++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -1,8 +1,7 @@
#
-# Solves a*x = b for x, using LU decomposition.
+# ludcmp.rb
#
module LUSolve
- # Performs LU decomposition of the n by n matrix a.
def ludecomp(a,n,zero=0,one=1)
prec = BigDecimal.limit(nil)
ps = []
@@ -53,12 +52,6 @@ module LUSolve
ps
end
- # Solves a*x = b for x, using LU decomposition.
- #
- # a is a matrix, b is a constant vector, x is the solution vector.
- #
- # ps is the pivot, a vector which indicates the permutation of rows performed
- # during LU decomposition.
def lusolve(a,b,ps,zero=0.0)
prec = BigDecimal.limit(nil)
n = ps.size
diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb
index f3248a3c5c..7b3f46ed1a 100644
--- a/ext/bigdecimal/lib/bigdecimal/math.rb
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -1,5 +1,4 @@
#
-#--
# Contents:
# sqrt(x, prec)
# sin (x, prec)
@@ -14,35 +13,19 @@
# x ... BigDecimal number to be computed.
# |x| must be small enough to get convergence.
# prec ... Number of digits to be obtained.
-#++
-#
-# Provides mathematical functions.
-#
-# Example:
#
+# Usage:
# require "bigdecimal"
-# require "bigdecimal/math"
-#
+# require "bigdecimal/math.rb"
# include BigMath
-#
# a = BigDecimal((PI(100)/2).to_s)
-# puts sin(a,100) # -> 0.10000000000000000000......E1
+# puts sin(a,100) # => 0.10000000000000000000......E1
#
module BigMath
-
- # Computes the square root of x to the specified number of digits of
- # precision.
- #
- # BigDecimal.new('2').sqrt(16).to_s
- # -> "0.14142135623730950488016887242096975E1"
- #
def sqrt(x,prec)
x.sqrt(prec)
end
- # Computes the sine of x to the specified number of digits of precision.
- #
- # If x is infinite or NaN, returns NaN.
def sin(x, prec)
raise ArgumentError, "Zero or negative precision for sin" if prec <= 0
return BigDecimal("NaN") if x.infinite? || x.nan?
@@ -68,9 +51,6 @@ module BigMath
y
end
- # Computes the cosine of x to the specified number of digits of precision.
- #
- # If x is infinite or NaN, returns NaN.
def cos(x, prec)
raise ArgumentError, "Zero or negative precision for cos" if prec <= 0
return BigDecimal("NaN") if x.infinite? || x.nan?
@@ -96,10 +76,6 @@ module BigMath
y
end
- # Computes the arctangent of x to the specified number of digits of precision.
- #
- # If x is infinite or NaN, returns NaN.
- # Raises an argument error if x > 1.
def atan(x, prec)
raise ArgumentError, "Zero or negative precision for atan" if prec <= 0
return BigDecimal("NaN") if x.infinite? || x.nan?
@@ -120,13 +96,6 @@ module BigMath
y
end
- # Computes the value of e (the base of natural logarithms) raised to the
- # power of x, to the specified number of digits of precision.
- #
- # If x is infinite or NaN, returns NaN.
- #
- # BigMath::exp(BigDecimal.new('1'), 10).to_s
- # -> "0.271828182845904523536028752390026306410273E1"
def exp(x, prec)
raise ArgumentError, "Zero or negative precision for exp" if prec <= 0
return BigDecimal("NaN") if x.infinite? || x.nan?
@@ -148,11 +117,6 @@ module BigMath
y
end
- # Computes the natural logarithm of x to the specified number of digits
- # of precision.
- #
- # Returns x if x is infinite or NaN.
- #
def log(x, prec)
raise ArgumentError, "Zero or negative argument for log" if x <= 0 || prec <= 0
return x if x.infinite? || x.nan?
@@ -174,7 +138,6 @@ module BigMath
y*two
end
- # Computes the value of pi to the specified number of digits of precision.
def PI(prec)
raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
n = prec + BigDecimal.double_fig
@@ -213,8 +176,6 @@ module BigMath
pi
end
- # Computes e (the base of natural logarithms) to the specified number of
- # digits of precision.
def E(prec)
raise ArgumentError, "Zero or negative precision for E" if prec <= 0
n = prec + BigDecimal.double_fig
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
index 59ac0f7f04..67a92474ac 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -1,29 +1,27 @@
#
# newton.rb
#
-# Solves the nonlinear algebraic equation system f = 0 by Newton's method.
-# This program is not dependent on BigDecimal.
+# Solves nonlinear algebraic equation system f = 0 by Newton's method.
+# (This program is not dependent on BigDecimal)
#
# To call:
# n = nlsolve(f,x)
-# where n is the number of iterations required,
-# x is the initial value vector
-# f is an Object which is used to compute the values of the equations to be solved.
-# It must provide the following methods:
+# where n is the number of iterations required.
+# x is the solution vector.
+# f is the object to be solved which must have following methods.
#
-# f.values(x):: returns the values of all functions at x
+# f ... Object to compute Jacobian matrix of the equation systems.
+# [Methods required for f]
+# f.values(x) returns values of all functions at x.
+# f.zero returns 0.0
+# f.one returns 1.0
+# f.two returns 1.0
+# f.ten returns 10.0
+# f.eps convergence criterion
+# x ... initial values
#
-# f.zero:: returns 0.0
-# f.one:: returns 1.0
-# f.two:: returns 1.0
-# f.ten:: returns 10.0
-#
-# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal.
-#
-# On exit, x is the solution vector.
-#
-require "bigdecimal/ludcmp"
-require "bigdecimal/jacobian"
+require "ludcmp"
+require "jacobian"
module Newton
include LUSolve
@@ -62,7 +60,7 @@ module Newton
begin
fact *= p5
if fact < minfact then
- raise "Failed to reduce function values."
+ raize "Failed to reduce function values."
end
for i in 0...n do
x[i] = xs[i] - dx[i]*fact
diff --git a/ext/bigdecimal/lib/bigdecimal/nlsolve.rb b/ext/bigdecimal/lib/bigdecimal/nlsolve.rb
new file mode 100644
index 0000000000..08f17f9ecd
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/nlsolve.rb
@@ -0,0 +1,38 @@
+#!/usr/local/bin/ruby
+
+#
+# nlsolve.rb
+# An example for solving nonlinear algebraic equation system.
+#
+
+require "bigdecimal"
+require "newton"
+include Newton
+
+class Function
+ def initialize()
+ @zero = BigDecimal::new("0.0")
+ @one = BigDecimal::new("1.0")
+ @two = BigDecimal::new("2.0")
+ @ten = BigDecimal::new("10.0")
+ @eps = BigDecimal::new("1.0e-16")
+ end
+ def zero;@zero;end
+ def one ;@one ;end
+ def two ;@two ;end
+ def ten ;@ten ;end
+ def eps ;@eps ;end
+ def values(x) # <= defines functions solved
+ f = []
+ f1 = x[0]*x[0] + x[1]*x[1] - @two # f1 = x**2 + y**2 - 2 => 0
+ f2 = x[0] - x[1] # f2 = x - y => 0
+ f <<= f1
+ f <<= f2
+ f
+ end
+end
+ f = BigDecimal::limit(100)
+ f = Function.new
+ x = [f.zero,f.zero] # Initial values
+ n = nlsolve(f,x)
+ p x
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
index 09e926acd5..1f8d6c7a49 100644
--- a/ext/bigdecimal/lib/bigdecimal/util.rb
+++ b/ext/bigdecimal/lib/bigdecimal/util.rb
@@ -1,17 +1,19 @@
#
# BigDecimal utility library.
+# ----------------------------------------------------------------------
+# Contents:
#
-# To use these functions, require 'bigdecimal/util'
-#
-# The following methods are provided to convert other types to BigDecimals:
+# String#
+# to_d ... to BigDecimal
#
-# String#to_d -> BigDecimal
-# Float#to_d -> BigDecimal
-# Rational#to_d -> BigDecimal
+# Float#
+# to_d ... to BigDecimal
#
-# The following method is provided to convert BigDecimals to other types:
+# BigDecimal#
+# to_r ... to Rational
#
-# BigDecimal#to_r -> Rational
+# Rational#
+# to_d ... to BigDecimal
#
# ----------------------------------------------------------------------
#
@@ -28,8 +30,8 @@ class String
end
class BigDecimal < Numeric
- # Converts a BigDecimal to a String of the form "nnnnnn.mmm".
- # This method is deprecated; use BigDecimal#to_s("F") instead.
+ # to "nnnnnn.mmm" form digit string
+ # Use BigDecimal#to_s("F") instead.
def to_digits
if self.nan? || self.infinite? || self.zero?
self.to_s
@@ -40,21 +42,22 @@ class BigDecimal < Numeric
end
end
- # Converts a BigDecimal to a Rational.
+ # Convert BigDecimal to Rational
def to_r
sign,digits,base,power = self.split
numerator = sign*digits.to_i
denomi_power = power - digits.size # base is always 10
if denomi_power < 0
- Rational(numerator,base ** (-denomi_power))
+ denominator = base ** (-denomi_power)
else
- Rational(numerator * (base ** denomi_power),1)
+ denominator = base ** denomi_power
end
+ Rational(numerator,denominator)
end
end
class Rational < Numeric
- # Converts a Rational to a BigDecimal
+ # Convert Rational to BigDecimal
def to_d(nFig=0)
num = self.numerator.to_s
if nFig<=0
diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb
index 88a62ffa71..7c8ca263eb 100644
--- a/ext/bigdecimal/sample/linear.rb
+++ b/ext/bigdecimal/sample/linear.rb
@@ -11,7 +11,7 @@
#
require "bigdecimal"
-require "bigdecimal/ludcmp"
+require "ludcmp"
#
# NOTE:
diff --git a/ext/bigdecimal/sample/nlsolve.rb b/ext/bigdecimal/sample/nlsolve.rb
index 7f729e6aaa..08f17f9ecd 100644
--- a/ext/bigdecimal/sample/nlsolve.rb
+++ b/ext/bigdecimal/sample/nlsolve.rb
@@ -6,7 +6,7 @@
#
require "bigdecimal"
-require "bigdecimal/newton"
+require "newton"
include Newton
class Function
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index 4e84b0837f..a8952bf186 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -1,5 +1,5 @@
/* -*- C -*-
- * $Id: curses.c,v 1.24.2.8 2006/07/18 05:08:34 matz Exp $
+ * $Id$
*
* ext/curses/curses.c
*
@@ -54,9 +54,6 @@
# define USE_MOUSE 1
#endif
-#define NUM2CH NUM2LONG
-#define CH2FIX LONG2FIX
-
static VALUE mCurses;
static VALUE mKey;
static VALUE cWindow;
@@ -127,7 +124,7 @@ curses_init_screen()
if (rb_stdscr) return rb_stdscr;
initscr();
if (stdscr == 0) {
- rb_raise(rb_eRuntimeError, "can't initialize curses");
+ rb_raise(rb_eRuntimeError, "cannot initialize curses");
}
clear();
rb_stdscr = prep_window(cWindow, stdscr);
@@ -186,15 +183,6 @@ curses_clear(obj)
return Qnil;
}
-/* def clrtoeol */
-static VALUE
-curses_clrtoeol()
-{
- curses_stdscr();
- clrtoeol();
- return Qnil;
-}
-
/* def refresh */
static VALUE
curses_refresh(obj)
@@ -374,7 +362,7 @@ curses_inch(obj)
VALUE obj;
{
curses_stdscr();
- return CH2FIX(inch());
+ return CHR2FIX(inch());
}
/* def addch(ch) */
@@ -384,7 +372,7 @@ curses_addch(obj, ch)
VALUE ch;
{
curses_stdscr();
- addch(NUM2CH(ch));
+ addch(NUM2CHR(ch));
return Qnil;
}
@@ -395,7 +383,7 @@ curses_insch(obj, ch)
VALUE ch;
{
curses_stdscr();
- insch(NUM2CH(ch));
+ insch(NUM2CHR(ch));
return Qnil;
}
@@ -458,17 +446,6 @@ curses_deleteln(obj)
return Qnil;
}
-/* def insertln */
-static VALUE
-curses_insertln(obj)
- VALUE obj;
-{
-#if defined(HAVE_INSERTLN) || defined(insertln)
- insertln();
-#endif
- return Qnil;
-}
-
/* def keyname */
static VALUE
curses_keyname(obj, c)
@@ -559,7 +536,7 @@ static VALUE
curses_bkgdset(VALUE obj, VALUE ch)
{
#ifdef HAVE_BKGDSET
- bkgdset(NUM2CH(ch));
+ bkgdset(NUM2CHR(ch));
#endif
return Qnil;
}
@@ -568,7 +545,7 @@ static VALUE
curses_bkgd(VALUE obj, VALUE ch)
{
#ifdef HAVE_BKGD
- return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
+ return (bkgd(NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
@@ -683,7 +660,7 @@ curses_getmouse(VALUE obj)
val = Data_Make_Struct(cMouseEvent,struct mousedata,
0,curses_mousedata_free,mdata);
- mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT));
+ mdata->mevent = (MEVENT*)malloc(sizeof(MEVENT));
return (getmouse(mdata->mevent) == OK) ? val : Qnil;
}
@@ -841,19 +818,6 @@ window_clear(obj)
return Qnil;
}
-/* def clrtoeol */
-static VALUE
-window_clrtoeol(obj)
- VALUE obj;
-{
- struct windata *winp;
-
- GetWINDOW(obj, winp);
- wclrtoeol(winp->window);
-
- return Qnil;
-}
-
/* def refresh */
static VALUE
window_refresh(obj)
@@ -1027,13 +991,13 @@ window_box(argc, argv, self)
rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
GetWINDOW(self, winp);
- box(winp->window, NUM2CH(vert), NUM2CH(hor));
+ box(winp->window, NUM2CHR(vert), NUM2CHR(hor));
if (!NIL_P(corn)) {
int cur_x, cur_y, x, y;
- chtype c;
+ char c;
- c = NUM2CH(corn);
+ c = NUM2CHR(corn);
getyx(winp->window, cur_y, cur_x);
x = NUM2INT(window_maxx(self)) - 1;
y = NUM2INT(window_maxy(self)) - 1;
@@ -1083,7 +1047,7 @@ window_inch(obj)
struct windata *winp;
GetWINDOW(obj, winp);
- return CH2FIX(winch(winp->window));
+ return CHR2FIX(winch(winp->window));
}
/* def addch(ch) */
@@ -1095,7 +1059,7 @@ window_addch(obj, ch)
struct windata *winp;
GetWINDOW(obj, winp);
- waddch(winp->window, NUM2CH(ch));
+ waddch(winp->window, NUM2CHR(ch));
return Qnil;
}
@@ -1109,7 +1073,7 @@ window_insch(obj, ch)
struct windata *winp;
GetWINDOW(obj, winp);
- winsch(winp->window, NUM2CH(ch));
+ winsch(winp->window, NUM2CHR(ch));
return Qnil;
}
@@ -1195,20 +1159,6 @@ window_deleteln(obj)
return Qnil;
}
-/* def insertln */
-static VALUE
-window_insertln(obj)
- VALUE obj;
-{
-#if defined(HAVE_WINSERTLN) || defined(winsertln)
- struct windata *winp;
-
- GetWINDOW(obj, winp);
- winsertln(winp->window);
-#endif
- return Qnil;
-}
-
static VALUE
window_scrollok(VALUE obj, VALUE bf)
{
@@ -1245,20 +1195,6 @@ window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
#endif
}
-#if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET)
-static VALUE
-window_color_set(VALUE obj, VALUE col)
-{
- struct windata *winp;
- int res;
-
- GetWINDOW(obj, winp);
- res = wcolor_set(winp->window, NUM2INT(col), NULL);
- return (res == OK) ? Qtrue : Qfalse;
- return Qfalse;
-}
-#endif /* USE_COLOR */
-
static VALUE
window_scroll(VALUE obj)
{
@@ -1338,7 +1274,7 @@ window_bkgdset(VALUE obj, VALUE ch)
struct windata *winp;
GetWINDOW(obj,winp);
- wbkgdset(winp->window, NUM2CH(ch));
+ wbkgdset(winp->window, NUM2CHR(ch));
#endif
return Qnil;
}
@@ -1350,7 +1286,7 @@ window_bkgd(VALUE obj, VALUE ch)
struct windata *winp;
GetWINDOW(obj,winp);
- return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
+ return (wbkgd(winp->window, NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
@@ -1360,11 +1296,11 @@ static VALUE
window_getbkgd(VALUE obj)
{
#ifdef HAVE_WGETBKGD
- chtype c;
+ char c;
struct windata *winp;
GetWINDOW(obj,winp);
- return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil;
+ return (c = getbkgd(winp->window) != ERR) ? CHR2FIX(c) : Qnil;
#else
return Qnil;
#endif
@@ -1464,7 +1400,6 @@ Init_curses()
rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
rb_define_module_function(mCurses, "clear", curses_clear, 0);
- rb_define_module_function(mCurses, "clrtoeol", curses_clrtoeol, 0);
rb_define_module_function(mCurses, "echo", curses_echo, 0);
rb_define_module_function(mCurses, "noecho", curses_noecho, 0);
rb_define_module_function(mCurses, "raw", curses_raw, 0);
@@ -1489,7 +1424,6 @@ Init_curses()
rb_define_module_function(mCurses, "getstr", curses_getstr, 0);
rb_define_module_function(mCurses, "delch", curses_delch, 0);
rb_define_module_function(mCurses, "deleteln", curses_deleteln, 0);
- rb_define_module_function(mCurses, "insertln", curses_insertln, 0);
rb_define_module_function(mCurses, "keyname", curses_keyname, 1);
rb_define_module_function(mCurses, "lines", curses_lines, 0);
rb_define_module_function(mCurses, "cols", curses_cols, 0);
@@ -1532,15 +1466,11 @@ Init_curses()
rb_define_method(cWindow, "subwin", window_subwin, 4);
rb_define_method(cWindow, "close", window_close, 0);
rb_define_method(cWindow, "clear", window_clear, 0);
- rb_define_method(cWindow, "clrtoeol", window_clrtoeol, 0);
rb_define_method(cWindow, "refresh", window_refresh, 0);
rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0);
rb_define_method(cWindow, "box", window_box, -1);
rb_define_method(cWindow, "move", window_move, 2);
rb_define_method(cWindow, "setpos", window_setpos, 2);
-#if defined(USE_COLOR) && defined(HAVE_WCOLOR_SET)
- rb_define_method(cWindow, "color_set", window_color_set, 1);
-#endif /* USE_COLOR && HAVE_WCOLOR_SET */
rb_define_method(cWindow, "cury", window_cury, 0);
rb_define_method(cWindow, "curx", window_curx, 0);
rb_define_method(cWindow, "maxy", window_maxy, 0);
@@ -1558,7 +1488,6 @@ Init_curses()
rb_define_method(cWindow, "getstr", window_getstr, 0);
rb_define_method(cWindow, "delch", window_delch, 0);
rb_define_method(cWindow, "deleteln", window_deleteln, 0);
- rb_define_method(cWindow, "insertln", window_insertln, 0);
rb_define_method(cWindow, "scroll", window_scroll, 0);
rb_define_method(cWindow, "scrollok", window_scrollok, 1);
rb_define_method(cWindow, "idlok", window_idlok, 1);
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 01fe971093..9b319ba30e 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -19,7 +19,7 @@ elsif have_header(*curses=%w"curses.h") and have_library("curses", "initscr")
end
if make
- for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg def_prog_mode reset_prog_mode timeout wtimeout nodelay init_color wcolor_set)
+ for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg def_prog_mode reset_prog_mode timeout wtimeout nodelay init_color)
have_func(f)
end
flag = "-D_XOPEN_SOURCE_EXTENDED"
diff --git a/ext/curses/view.rb b/ext/curses/view.rb
index d9a82a57db..5ba1a8413c 100644
--- a/ext/curses/view.rb
+++ b/ext/curses/view.rb
@@ -49,7 +49,7 @@ while TRUE
n = 0
while TRUE
c = getch.chr
- if c =~ /[0-9]/
+ if c =~ "[0-9]" then
n = 10 * n + c.to_i
else
break
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 83e6a9893b..9caf808961 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -2,8 +2,8 @@
dbm.c -
- $Author: usa $
- $Date: 2005/06/20 07:53:19 $
+ $Author$
+ $Date$
created at: Mon Jan 24 15:59:52 JST 1994
Copyright (C) 1995-2001 Yukihiro Matsumoto
@@ -71,21 +71,6 @@ fdbm_close(obj)
return Qnil;
}
-static VALUE
-fdbm_closed(obj)
- VALUE obj;
-{
- struct dbmdata *dbmp;
-
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp == 0)
- return Qtrue;
- if (dbmp->di_dbm == 0)
- return Qtrue;
-
- return Qfalse;
-}
-
static VALUE fdbm_alloc _((VALUE));
static VALUE
fdbm_alloc(klass)
@@ -765,7 +750,6 @@ Init_dbm()
rb_define_method(rb_cDBM, "initialize", fdbm_initialize, -1);
rb_define_method(rb_cDBM, "close", fdbm_close, 0);
- rb_define_method(rb_cDBM, "closed?", fdbm_closed, 0);
rb_define_method(rb_cDBM, "[]", fdbm_aref, 1);
rb_define_method(rb_cDBM, "fetch", fdbm_fetch_m, -1);
rb_define_method(rb_cDBM, "[]=", fdbm_store, 2);
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 52ec688952..5a67603e69 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -33,7 +33,7 @@ def db_check(db)
if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open"))
for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch)
- $defs << hsearch << '-DDBM_HDR="<'+hdr+'>"'
+ $CFLAGS += " " + hsearch + '-DDBM_HDR="<'+hdr+'>"'
return true
end
end
@@ -46,16 +46,16 @@ def db_prefix(func)
end
if dblib
- dbm_hdr = db_check(dblib)
+ db_check(dblib)
else
- dbm_hdr = %w(db db2 db1 dbm gdbm gdbm_compat qdbm).any? do |dblib|
- db_check(dblib)
+ for dblib in %w(db db2 db1 dbm gdbm gdbm_compat qdbm)
+ db_check(dblib) and break
end
end
have_header("cdefs.h")
have_header("sys/cdefs.h")
-if dbm_hdr and have_func(db_prefix("dbm_open"))
+if /DBM_HDR/ =~ $CFLAGS and have_func(db_prefix("dbm_open"))
have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
create_makefile("dbm")
end
diff --git a/ext/dbm/testdbm.rb b/ext/dbm/testdbm.rb
new file mode 100644
index 0000000000..4942ffb64a
--- /dev/null
+++ b/ext/dbm/testdbm.rb
@@ -0,0 +1,593 @@
+require 'runit/testcase'
+require 'runit/cui/testrunner'
+
+if $".grep(/\bdbm.so\b/).empty?
+ begin
+ require './dbm'
+ rescue LoadError
+ require 'dbm'
+ end
+end
+
+def uname_s
+ require 'rbconfig'
+ case Config::CONFIG['host_os']
+ when 'cygwin'
+ require 'Win32API'
+ uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
+ utsname = ' ' * 100
+ raise 'cannot get system name' if uname.call(utsname) == -1
+
+ utsname.unpack('A20' * 5)[0]
+ else
+ Config::CONFIG['host_os']
+ end
+end
+
+SYSTEM = uname_s
+
+class TestDBM < RUNIT::TestCase
+ def setup
+ @path = "tmptest_dbm_"
+ assert_instance_of(DBM, @dbm = DBM.new(@path))
+
+ # prepare to make readonly DBM file
+ DBM.open("tmptest_dbm_rdonly") {|dbm|
+ dbm['foo'] = 'FOO'
+ }
+
+ File.chmod(0400, *Dir.glob("tmptest_dbm_rdonly.*"))
+
+ assert_instance_of(DBM, @dbm_rdonly = DBM.new("tmptest_dbm_rdonly", nil))
+ end
+ def teardown
+ assert_nil(@dbm.close)
+ assert_nil(@dbm_rdonly.close)
+ GC.start
+ File.delete *Dir.glob("tmptest_dbm*").to_a
+ p Dir.glob("tmptest_dbm*") if $DEBUG
+ end
+
+ def check_size(expect, dbm=@dbm)
+ assert_equals(expect, dbm.size)
+ n = 0
+ dbm.each { n+=1 }
+ assert_equals(expect, n)
+ if expect == 0
+ assert_equals(true, dbm.empty?)
+ else
+ assert_equals(false, dbm.empty?)
+ end
+ end
+
+ def test_version
+ STDERR.print DBM::VERSION
+ end
+
+ def test_s_new_has_no_block
+ # DBM.new ignore the block
+ foo = true
+ assert_instance_of(DBM, dbm = DBM.new("tmptest_dbm") { foo = false })
+ assert_equals(foo, true)
+ assert_nil(dbm.close)
+ end
+ def test_s_open_no_create
+ assert_nil(dbm = DBM.open("tmptest_dbm", nil))
+ ensure
+ dbm.close if dbm
+ end
+ def test_s_open_with_block
+ assert_equals(DBM.open("tmptest_dbm") { :foo }, :foo)
+ end
+ def test_s_open_lock
+ fork() {
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ assert_exception(Errno::EWOULDBLOCK, "NEVER MIND IF YOU USE Berkeley DB3") {
+ begin
+ assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644))
+ rescue Errno::EAGAIN, Errno::EACCES, Errno::EINVAL
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ ensure
+ Process.wait
+ end
+ end
+
+=begin
+ # Is it guaranteed on many OS?
+ def test_s_open_lock_one_process
+ # locking on one process
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644))
+ assert_exception(Errno::EWOULDBLOCK) {
+ begin
+ DBM.open("tmptest_dbm", 0644)
+ rescue Errno::EAGAIN
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ end
+=end
+
+ def test_s_open_nolock
+ # dbm 1.8.0 specific
+ if not defined? DBM::NOLOCK
+ return
+ end
+
+ fork() {
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644,
+ DBM::NOLOCK))
+ sleep 2
+ }
+ sleep 1
+ begin
+ dbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644))
+ }
+ ensure
+ Process.wait
+ dbm2.close if dbm2
+ end
+
+ p Dir.glob("tmptest_dbm*") if $DEBUG
+
+ fork() {
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ dbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ # this test is failed on Cygwin98 (???)
+ assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644,
+ DBM::NOLOCK))
+ }
+ ensure
+ Process.wait
+ dbm2.close if dbm2
+ end
+ end
+
+ def test_s_open_error
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0))
+ assert_exception(Errno::EACCES, "NEVER MIND IF YOU USE Berkeley DB3") {
+ DBM.open("tmptest_dbm", 0)
+ }
+ dbm.close
+ end
+
+ def test_close
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm"))
+ assert_nil(dbm.close)
+
+ # closed DBM file
+ assert_exception(DBMError) { dbm.close }
+ end
+
+ def test_aref
+ assert_equals('bar', @dbm['foo'] = 'bar')
+ assert_equals('bar', @dbm['foo'])
+
+ assert_nil(@dbm['bar'])
+ end
+
+ def test_fetch
+ assert_equals('bar', @dbm['foo']='bar')
+ assert_equals('bar', @dbm.fetch('foo'))
+
+ # key not found
+ assert_exception(IndexError) {
+ @dbm.fetch('bar')
+ }
+
+ # test for `ifnone' arg
+ assert_equals('baz', @dbm.fetch('bar', 'baz'))
+
+ # test for `ifnone' block
+ assert_equals('foobar', @dbm.fetch('bar') {|key| 'foo' + key })
+ end
+
+ def test_aset
+ num = 0
+ 2.times {|i|
+ assert_equals('foo', @dbm['foo'] = 'foo')
+ assert_equals('foo', @dbm['foo'])
+ assert_equals('bar', @dbm['foo'] = 'bar')
+ assert_equals('bar', @dbm['foo'])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # assign nil
+ assert_equals('', @dbm['bar'] = '')
+ assert_equals('', @dbm['bar'])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # empty string
+ assert_equals('', @dbm[''] = '')
+ assert_equals('', @dbm[''])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # Fixnum
+ assert_equals('200', @dbm['100'] = '200')
+ assert_equals('200', @dbm['100'])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # Big key and value
+ assert_equals('y' * 100, @dbm['x' * 100] = 'y' * 100)
+ assert_equals('y' * 100, @dbm['x' * 100])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+ }
+ end
+
+ def test_index
+ assert_equals('bar', @dbm['foo'] = 'bar')
+ assert_equals('foo', @dbm.index('bar'))
+ assert_nil(@dbm['bar'])
+ end
+
+ def test_indexes
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+ assert_equals(values.reverse, @dbm.indexes(*keys.reverse))
+ end
+
+ def test_values_at
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+ assert_equals(values.reverse, @dbm.values_at(*keys.reverse))
+ end
+
+ def test_select_with_block
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+ ret = @dbm.select {|k,v|
+ assert_equals(k.upcase, v)
+ k != "bar"
+ }
+ assert_equals([['baz', 'BAZ'], ['foo', 'FOO']],
+ ret.sort)
+ end
+
+ def test_length
+ num = 10
+ assert_equals(0, @dbm.size)
+ num.times {|i|
+ i = i.to_s
+ @dbm[i] = i
+ }
+ assert_equals(num, @dbm.size)
+
+ @dbm.shift
+
+ assert_equals(num - 1, @dbm.size)
+ end
+
+ def test_empty?
+ assert_equals(true, @dbm.empty?)
+ @dbm['foo'] = 'FOO'
+ assert_equals(false, @dbm.empty?)
+ end
+
+ def test_each_pair
+ n = 0
+ @dbm.each_pair { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ n = 0
+ ret = @dbm.each_pair {|key, val|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@dbm, ret)
+ end
+
+ def test_each_value
+ n = 0
+ @dbm.each_value { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ n = 0
+ ret = @dbm.each_value {|val|
+ assert_not_nil(key = @dbm.index(val))
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@dbm, ret)
+ end
+
+ def test_each_key
+ n = 0
+ @dbm.each_key { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ n = 0
+ ret = @dbm.each_key {|key|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(@dbm[key], values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@dbm, ret)
+ end
+
+ def test_keys
+ assert_equals([], @dbm.keys)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ assert_equals(keys.sort, @dbm.keys.sort)
+ assert_equals(values.sort, @dbm.values.sort)
+ end
+
+ def test_values
+ test_keys
+ end
+
+ def test_shift
+ assert_nil(@dbm.shift)
+ assert_equals(0, @dbm.size)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ ret_keys = []
+ ret_values = []
+ while ret = @dbm.shift
+ ret_keys.push ret[0]
+ ret_values.push ret[1]
+
+ assert_equals(keys.size - ret_keys.size, @dbm.size)
+ end
+
+ assert_equals(keys.sort, ret_keys.sort)
+ assert_equals(values.sort, ret_values.sort)
+ end
+
+ def test_delete
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ key = keys[1]
+
+ assert_nil(@dbm.delete(key))
+ assert_equals(0, @dbm.size)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ assert_equals('BAR', @dbm.delete(key))
+ assert_nil(@dbm[key])
+ assert_equals(2, @dbm.size)
+
+ assert_nil(@dbm.delete(key))
+
+ if /^CYGWIN_9/ !~ SYSTEM
+ assert_exception(DBMError) {
+ @dbm_rdonly.delete("foo")
+ }
+
+ assert_nil(@dbm_rdonly.delete("bar"))
+ end
+ end
+ def test_delete_with_block
+ key = 'no called block'
+ @dbm[key] = 'foo'
+ assert_equals('foo', @dbm.delete(key) {|k| k.replace 'called block'})
+ assert_equals('no called block', key)
+ assert_equals(0, @dbm.size)
+
+ key = 'no called block'
+ assert_equals(:blockval,
+ @dbm.delete(key) {|k| k.replace 'called block'; :blockval})
+ assert_equals('called block', key)
+ assert_equals(0, @dbm.size)
+ end
+
+ def test_delete_if
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+
+ ret = @dbm.delete_if {|key, val| key.to_i < 50}
+ assert_equals(@dbm, ret)
+ check_size(50, @dbm)
+
+ ret = @dbm.delete_if {|key, val| key.to_i >= 50}
+ assert_equals(@dbm, ret)
+ check_size(0, @dbm)
+
+ # break
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+ check_size(100, @dbm)
+ n = 0;
+ @dbm.delete_if {|key, val|
+ break if n > 50
+ n+=1
+ true
+ }
+ assert_equals(51, n)
+ check_size(49, @dbm)
+
+ @dbm.clear
+
+ # raise
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+ check_size(100, @dbm)
+ n = 0;
+ begin
+ @dbm.delete_if {|key, val|
+ raise "runtime error" if n > 50
+ n+=1
+ true
+ }
+ rescue
+ end
+ assert_equals(51, n)
+ check_size(49, @dbm)
+ end
+
+ def test_reject
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+
+ hash = @dbm.reject {|key, val| key.to_i < 50}
+ assert_instance_of(Hash, hash)
+ assert_equals(100, @dbm.size)
+
+ assert_equals(50, hash.size)
+ hash.each_pair {|key,val|
+ assert_equals(false, key.to_i < 50)
+ assert_equals(key, val)
+ }
+
+ hash = @dbm.reject {|key, val| key.to_i < 100}
+ assert_instance_of(Hash, hash)
+ assert_equals(true, hash.empty?)
+ end
+
+ def test_clear
+ v = "1"
+ 100.times {v = v.next; @dbm[v] = v}
+
+ assert_equals(@dbm, @dbm.clear)
+
+ # validate DBM#size
+ i = 0
+ @dbm.each { i += 1 }
+ assert_equals(@dbm.size, i)
+ assert_equals(0, i)
+ end
+
+ def test_invert
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+
+ hash = @dbm.invert
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_update
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @dbm["101"] = "101"
+ @dbm.update hash
+ assert_equals(101, @dbm.size)
+ @dbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_replace
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @dbm["101"] = "101"
+ @dbm.replace hash
+ assert_equals(100, @dbm.size)
+ @dbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_haskey?
+ assert_equals('bar', @dbm['foo']='bar')
+ assert_equals(true, @dbm.has_key?('foo'))
+ assert_equals(false, @dbm.has_key?('bar'))
+ end
+
+ def test_has_value?
+ assert_equals('bar', @dbm['foo']='bar')
+ assert_equals(true, @dbm.has_value?('bar'))
+ assert_equals(false, @dbm.has_value?('foo'))
+ end
+
+ def test_to_a
+ v = "0"
+ 100.times {v = v.next; @dbm[v] = v}
+
+ ary = @dbm.to_a
+ assert_instance_of(Array, ary)
+ assert_equals(100, ary.size)
+ ary.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_to_hash
+ v = "0"
+ 100.times {v = v.next; @dbm[v] = v}
+
+ hash = @dbm.to_hash
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+end
+
+if $0 == __FILE__
+ if ARGV.size == 0
+ suite = RUNIT::TestSuite.new
+ suite.add_test(TestDBM.suite)
+ else
+ suite = RUNIT::TestSuite.new
+ ARGV.each do |testmethod|
+ suite.add_test(TestDBM.new(testmethod))
+ end
+ end
+
+ RUNIT::CUI::TestRunner.run(suite)
+end
diff --git a/ext/digest/defs.h b/ext/digest/defs.h
index d51c627cf9..5cfc77dd24 100644
--- a/ext/digest/defs.h
+++ b/ext/digest/defs.h
@@ -1,5 +1,5 @@
/* -*- C -*-
- * $Id: defs.h,v 1.7 2003/06/01 15:39:52 eban Exp $
+ * $Id$
*/
#ifndef DEFS_H
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 957fe4f6ea..70f986327a 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -2,14 +2,14 @@
digest.c -
- $Author: matz $
+ $Author$
created at: Fri May 25 08:57:27 JST 2001
Copyright (C) 1995-2001 Yukihiro Matsumoto
Copyright (C) 2001 Akinori MUSHA
$RoughId: digest.c,v 1.16 2001/07/13 15:38:27 knu Exp $
- $Id: digest.c,v 1.14.2.2 2005/12/12 00:36:51 matz Exp $
+ $Id$
************************************************/
@@ -91,7 +91,7 @@ rb_digest_base_s_digest(klass, str)
void *pctx;
size_t len;
unsigned char *digest;
- volatile VALUE obj = rb_digest_base_alloc(klass);
+ VALUE obj = rb_digest_base_alloc(klass);
algo = get_digest_base_metadata(klass);
Data_Get_Struct(obj, void, pctx);
@@ -120,7 +120,7 @@ rb_digest_base_s_hexdigest(klass, str)
void *pctx;
size_t len;
unsigned char *hexdigest;
- volatile VALUE obj = rb_digest_base_alloc(klass);
+ VALUE obj = rb_digest_base_alloc(klass);
algo = get_digest_base_metadata(klass);
Data_Get_Struct(obj, void, pctx);
diff --git a/ext/digest/digest.h b/ext/digest/digest.h
index 578be0a3c4..5e846df040 100644
--- a/ext/digest/digest.h
+++ b/ext/digest/digest.h
@@ -2,14 +2,14 @@
digest.c -
- $Author: knu $
+ $Author$
created at: Fri May 25 08:54:56 JST 2001
Copyright (C) 2001 Akinori MUSHA
$RoughId: digest.h,v 1.3 2001/07/13 15:38:27 knu Exp $
- $Id: digest.h,v 1.1 2001/07/13 20:06:13 knu Exp $
+ $Id$
************************************************/
diff --git a/ext/digest/digest.txt b/ext/digest/digest.txt
index 4969a9da90..5797dd18f9 100644
--- a/ext/digest/digest.txt
+++ b/ext/digest/digest.txt
@@ -1,6 +1,6 @@
.\" digest.txt - -*- Indented-Text -*- created at: Fri May 25 08:13:50 JST 2001
$RoughId: digest.txt,v 1.9 2001/07/13 19:46:51 knu Exp $
-$Id: digest.txt,v 1.1 2001/07/13 20:06:13 knu Exp $
+$Id$
** MD5(Class)
diff --git a/ext/digest/digest.txt.ja b/ext/digest/digest.txt.ja
index 7078c83573..8997d25b9d 100644
--- a/ext/digest/digest.txt.ja
+++ b/ext/digest/digest.txt.ja
@@ -1,6 +1,6 @@
.\" digest.txt.ja - -*- Indented-Text -*- created at: Fri May 25 08:22:19 JST 2001
$RoughId: digest.txt.jp,v 1.8 2001/07/13 15:38:27 knu Exp $
-$Id: digest.txt.ja,v 1.1 2001/07/19 05:42:07 knu Exp $
+$Id$
** MD5(¥¯¥é¥¹)
diff --git a/ext/digest/extconf.rb b/ext/digest/extconf.rb
index 3e35bf5064..cd512622a4 100644
--- a/ext/digest/extconf.rb
+++ b/ext/digest/extconf.rb
@@ -1,5 +1,5 @@
# $RoughId: extconf.rb,v 1.6 2001/07/13 15:38:27 knu Exp $
-# $Id: extconf.rb,v 1.1 2001/07/13 20:06:13 knu Exp $
+# $Id$
require "mkmf"
diff --git a/ext/digest/lib/md5.rb b/ext/digest/lib/md5.rb
index 6867fdc71b..1d05d7d04e 100644
--- a/ext/digest/lib/md5.rb
+++ b/ext/digest/lib/md5.rb
@@ -1,7 +1,7 @@
# just for compatibility; requiring "md5" is obsoleted
#
# $RoughId: md5.rb,v 1.4 2001/07/13 15:38:27 knu Exp $
-# $Id: md5.rb,v 1.1 2001/07/13 20:06:14 knu Exp $
+# $Id$
require 'digest/md5'
diff --git a/ext/digest/lib/sha1.rb b/ext/digest/lib/sha1.rb
index 12fb5cdfa4..c4ac6f66ea 100644
--- a/ext/digest/lib/sha1.rb
+++ b/ext/digest/lib/sha1.rb
@@ -1,7 +1,7 @@
# just for compatibility; requiring "sha1" is obsoleted
#
# $RoughId: sha1.rb,v 1.4 2001/07/13 15:38:27 knu Exp $
-# $Id: sha1.rb,v 1.1 2001/07/13 20:06:14 knu Exp $
+# $Id$
require 'digest/sha1'
diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb
index ea29c9c5f8..9acf7ba9c0 100644
--- a/ext/digest/md5/extconf.rb
+++ b/ext/digest/md5/extconf.rb
@@ -1,10 +1,9 @@
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
-# $Id: extconf.rb,v 1.4.2.2 2006/05/25 23:44:05 nobu Exp $
+# $Id$
require "mkmf"
-$defs << "-DHAVE_CONFIG_H"
-$INCFLAGS << " -I$(srcdir)/.."
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
$objs = [ "md5init.#{$OBJEXT}" ]
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index ed32cf95c1..6b61f031c4 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -43,7 +43,7 @@
/*$OrigId: md5c.c,v 1.2 2001/03/26 08:57:14 matz Exp $ */
/*$RoughId: md5.c,v 1.2 2001/07/13 19:48:41 knu Exp $ */
-/*$Id: md5.c,v 1.1 2001/07/13 20:06:14 knu Exp $ */
+/*$Id$ */
#include "md5.h"
diff --git a/ext/digest/md5/md5.h b/ext/digest/md5/md5.h
index 736e034512..fc41380d38 100644
--- a/ext/digest/md5/md5.h
+++ b/ext/digest/md5/md5.h
@@ -41,7 +41,7 @@
/* $OrigId: md5.h,v 1.2 2001/03/26 08:57:14 matz Exp $ */
/* $RoughId: md5.h,v 1.3 2002/02/24 08:14:31 knu Exp $ */
-/* $Id: md5.h,v 1.2 2002/02/24 08:20:22 knu Exp $ */
+/* $Id$ */
#ifndef MD5_INCLUDED
# define MD5_INCLUDED
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index 52f5de540f..2acca16a46 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -1,5 +1,5 @@
/* $RoughId: md5init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: md5init.c,v 1.5 2002/09/26 16:27:23 knu Exp $ */
+/* $Id$ */
#include "digest.h"
#if defined(HAVE_OPENSSL_MD5_H)
diff --git a/ext/digest/md5/md5ossl.c b/ext/digest/md5/md5ossl.c
index 4af7d19ba5..d930c7ab51 100644
--- a/ext/digest/md5/md5ossl.c
+++ b/ext/digest/md5/md5ossl.c
@@ -1,4 +1,4 @@
-/* $Id: md5ossl.c,v 1.2 2003/01/06 11:47:53 knu Exp $ */
+/* $Id$ */
#include "md5ossl.h"
#include <sys/types.h>
diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h
index 401ef3418d..dda7c743ed 100644
--- a/ext/digest/md5/md5ossl.h
+++ b/ext/digest/md5/md5ossl.h
@@ -1,9 +1,8 @@
-/* $Id: md5ossl.h,v 1.1.2.1 2005/08/30 10:43:34 gotoyuzo Exp $ */
+/* $Id$ */
#ifndef MD5OSSL_H_INCLUDED
#define MD5OSSL_H_INCLUDED
-#include <stddef.h>
#include <openssl/md5.h>
void MD5_End(MD5_CTX *pctx, unsigned char *hexdigest);
diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb
index 232a3a5e06..5bc968385c 100644
--- a/ext/digest/rmd160/extconf.rb
+++ b/ext/digest/rmd160/extconf.rb
@@ -1,10 +1,9 @@
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
-# $Id: extconf.rb,v 1.4.2.2 2006/05/25 23:44:05 nobu Exp $
+# $Id$
require "mkmf"
-$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
-$INCFLAGS << " -I$(srcdir)/.."
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
$objs = [ "rmd160init.#{$OBJEXT}" ]
diff --git a/ext/digest/rmd160/rmd160.c b/ext/digest/rmd160/rmd160.c
index 9562a6fe67..2de3c99b29 100644
--- a/ext/digest/rmd160/rmd160.c
+++ b/ext/digest/rmd160/rmd160.c
@@ -1,6 +1,6 @@
/* $NetBSD: rmd160.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $ */
/* $RoughId: rmd160.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: rmd160.c,v 1.1 2001/07/13 20:06:14 knu Exp $ */
+/* $Id$ */
/********************************************************************\
*
diff --git a/ext/digest/rmd160/rmd160.h b/ext/digest/rmd160/rmd160.h
index 7df190413e..24f9a025f0 100644
--- a/ext/digest/rmd160/rmd160.h
+++ b/ext/digest/rmd160/rmd160.h
@@ -1,6 +1,6 @@
/* $NetBSD: rmd160.h,v 1.2 2000/07/07 10:47:06 ad Exp $ */
/* $RoughId: rmd160.h,v 1.3 2002/02/24 08:14:31 knu Exp $ */
-/* $Id: rmd160.h,v 1.2 2002/02/24 08:20:22 knu Exp $ */
+/* $Id$ */
/********************************************************************\
*
diff --git a/ext/digest/rmd160/rmd160hl.c b/ext/digest/rmd160/rmd160hl.c
index 14299d7c7a..4c5e0217d9 100644
--- a/ext/digest/rmd160/rmd160hl.c
+++ b/ext/digest/rmd160/rmd160hl.c
@@ -1,6 +1,6 @@
/* $NetBSD: rmd160hl.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $ */
/* $RoughId: rmd160hl.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: rmd160hl.c,v 1.1 2001/07/13 20:06:14 knu Exp $ */
+/* $Id$ */
/* rmd160hl.c
* ----------------------------------------------------------------------------
diff --git a/ext/digest/rmd160/rmd160init.c b/ext/digest/rmd160/rmd160init.c
index 3aa7847019..b16cdbbed8 100644
--- a/ext/digest/rmd160/rmd160init.c
+++ b/ext/digest/rmd160/rmd160init.c
@@ -1,5 +1,5 @@
/* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
-/* $Id: rmd160init.c,v 1.3 2002/09/26 17:26:46 knu Exp $ */
+/* $Id$ */
#include "digest.h"
#if defined(HAVE_OPENSSL_RIPEMD_H)
diff --git a/ext/digest/rmd160/rmd160ossl.c b/ext/digest/rmd160/rmd160ossl.c
index 1a8436dfb8..be66d81ff9 100644
--- a/ext/digest/rmd160/rmd160ossl.c
+++ b/ext/digest/rmd160/rmd160ossl.c
@@ -1,7 +1,7 @@
-/* $Id: rmd160ossl.c,v 1.1.2.1 2006/08/07 09:01:27 matz Exp $ */
+/* $Id$ */
-#include "defs.h"
#include "rmd160ossl.h"
+#include "defs.h"
#include <assert.h>
#include <stdlib.h>
diff --git a/ext/digest/rmd160/rmd160ossl.h b/ext/digest/rmd160/rmd160ossl.h
index 30840ca598..824a1bf32f 100644
--- a/ext/digest/rmd160/rmd160ossl.h
+++ b/ext/digest/rmd160/rmd160ossl.h
@@ -1,9 +1,8 @@
-/* $Id: rmd160ossl.h,v 1.1.2.1 2005/08/30 10:43:35 gotoyuzo Exp $ */
+/* $Id$ */
#ifndef RMD160OSSL_H_INCLUDED
#define RMD160OSSL_H_INCLUDED
-#include <stddef.h>
#include <openssl/ripemd.h>
#define RMD160_CTX RIPEMD160_CTX
diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb
index 861c5563f9..c249a415ed 100644
--- a/ext/digest/sha1/extconf.rb
+++ b/ext/digest/sha1/extconf.rb
@@ -1,10 +1,9 @@
# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
-# $Id: extconf.rb,v 1.5.2.1 2006/05/25 23:44:05 nobu Exp $
+# $Id$
require "mkmf"
-$defs << "-DHAVE_CONFIG_H"
-$INCFLAGS << " -I$(srcdir)/.."
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
$objs = [ "sha1init.#{$OBJEXT}" ]
diff --git a/ext/digest/sha1/sha1.c b/ext/digest/sha1/sha1.c
index ba926e1fad..1012ef8751 100644
--- a/ext/digest/sha1/sha1.c
+++ b/ext/digest/sha1/sha1.c
@@ -1,7 +1,7 @@
/* $NetBSD: sha1.c,v 1.2 2001/03/22 09:51:48 agc Exp $ */
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
/* $RoughId: sha1.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: sha1.c,v 1.1 2001/07/13 20:06:14 knu Exp $ */
+/* $Id$ */
/*
* SHA-1 in C
diff --git a/ext/digest/sha1/sha1.h b/ext/digest/sha1/sha1.h
index 5a1143ea0d..2303cecc2b 100644
--- a/ext/digest/sha1/sha1.h
+++ b/ext/digest/sha1/sha1.h
@@ -1,6 +1,6 @@
/* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */
/* $RoughId: sha1.h,v 1.3 2002/02/24 08:14:32 knu Exp $ */
-/* $Id: sha1.h,v 1.2 2002/02/24 08:20:22 knu Exp $ */
+/* $Id$ */
/*
* SHA-1 in C
diff --git a/ext/digest/sha1/sha1hl.c b/ext/digest/sha1/sha1hl.c
index 47b802085d..d1a236b22c 100644
--- a/ext/digest/sha1/sha1hl.c
+++ b/ext/digest/sha1/sha1hl.c
@@ -1,6 +1,6 @@
/* $NetBSD: sha1hl.c,v 1.2 2001/03/10 15:55:14 tron Exp $ */
/* $RoughId: sha1hl.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: sha1hl.c,v 1.1 2001/07/13 20:06:14 knu Exp $ */
+/* $Id$ */
/* sha1hl.c
* ----------------------------------------------------------------------------
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
index 829a363921..426afb7cd0 100644
--- a/ext/digest/sha1/sha1init.c
+++ b/ext/digest/sha1/sha1init.c
@@ -1,5 +1,5 @@
/* $RoughId: sha1init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: sha1init.c,v 1.3 2002/09/26 17:44:33 knu Exp $ */
+/* $Id$ */
#include "digest.h"
#if defined(HAVE_OPENSSL_SHA_H)
diff --git a/ext/digest/sha1/sha1ossl.c b/ext/digest/sha1/sha1ossl.c
index 72c6eb4092..b125128f82 100644
--- a/ext/digest/sha1/sha1ossl.c
+++ b/ext/digest/sha1/sha1ossl.c
@@ -1,7 +1,7 @@
-/* $Id: sha1ossl.c,v 1.1.2.1 2006/08/07 09:01:27 matz Exp $ */
+/* $Id$ */
-#include "defs.h"
#include "sha1ossl.h"
+#include "defs.h"
#include <assert.h>
#include <stdlib.h>
diff --git a/ext/digest/sha1/sha1ossl.h b/ext/digest/sha1/sha1ossl.h
index 24b84b4274..e8d7e74baf 100644
--- a/ext/digest/sha1/sha1ossl.h
+++ b/ext/digest/sha1/sha1ossl.h
@@ -1,9 +1,8 @@
-/* $Id: sha1ossl.h,v 1.1.2.1 2005/08/30 10:43:36 gotoyuzo Exp $ */
+/* $Id$ */
#ifndef SHA1OSSL_H_INCLUDED
#define SHA1OSSL_H_INCLUDED
-#include <stddef.h>
#include <openssl/sha.h>
#define SHA1_CTX SHA_CTX
diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb
index 5d078f4bd6..c982aa64de 100644
--- a/ext/digest/sha2/extconf.rb
+++ b/ext/digest/sha2/extconf.rb
@@ -1,10 +1,9 @@
# $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $
-# $Id: extconf.rb,v 1.7.2.2 2006/05/25 23:44:06 nobu Exp $
+# $Id$
require "mkmf"
-$defs << "-DHAVE_CONFIG_H"
-$INCFLAGS << " -I$(srcdir)/.."
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
$objs = [
"sha2.#{$OBJEXT}",
@@ -18,6 +17,12 @@ have_header("inttypes.h")
have_header("unistd.h")
-if have_type("uint64_t", "defs.h", $defs.join(' '))
+if try_cpp(<<SRC, $defs.join(' '))
+#include "defs.h"
+#ifdef NO_UINT64_T
+ #error ** Cannot find a 64bit integer type - skipping the SHA2 module.
+#endif
+SRC
+then
create_makefile("digest/sha2")
end
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c
index 22e7d59cd3..24a57ded0d 100644
--- a/ext/digest/sha2/sha2.c
+++ b/ext/digest/sha2/sha2.c
@@ -34,7 +34,7 @@
*/
/* $RoughId: sha2.c,v 1.3 2002/02/26 22:03:36 knu Exp $ */
-/* $Id: sha2.c,v 1.4.2.1 2005/12/24 09:58:56 matz Exp $ */
+/* $Id$ */
#include "sha2.h"
#include <stdio.h>
@@ -67,7 +67,7 @@ typedef uint8_t sha2_byte; /* Exactly 1 byte */
typedef uint32_t sha2_word32; /* Exactly 4 bytes */
typedef uint64_t sha2_word64; /* Exactly 8 bytes */
-#if defined(__GNUC__) || defined(_HPUX_SOURCE) || defined(__IBMC__)
+#if defined(__GNUC__) || defined(_HPUX_SOURCE)
#define ULL(number) number##ULL
#else
#define ULL(number) (uint64_t)(number)
diff --git a/ext/digest/sha2/sha2.h b/ext/digest/sha2/sha2.h
index 7ccf012b77..4689ad93ce 100644
--- a/ext/digest/sha2/sha2.h
+++ b/ext/digest/sha2/sha2.h
@@ -34,7 +34,7 @@
*/
/* $RoughId: sha2.h,v 1.3 2002/02/24 08:14:32 knu Exp $ */
-/* $Id: sha2.h,v 1.2 2002/02/24 08:20:22 knu Exp $ */
+/* $Id$ */
#ifndef __SHA2_H__
#define __SHA2_H__
diff --git a/ext/digest/sha2/sha2hl.c b/ext/digest/sha2/sha2hl.c
index 8f09bd6e5a..03fde538c3 100644
--- a/ext/digest/sha2/sha2hl.c
+++ b/ext/digest/sha2/sha2hl.c
@@ -1,6 +1,6 @@
/* $NetBSD: sha2hl.c,v 1.1 2001/03/12 09:08:40 agc Exp $ */
/* $RoughId: sha2hl.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id: sha2hl.c,v 1.1 2001/07/13 20:06:14 knu Exp $ */
+/* $Id$ */
/*
* sha2hl.c
diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c
index 9c0f9854fb..4b14031811 100644
--- a/ext/digest/sha2/sha2init.c
+++ b/ext/digest/sha2/sha2init.c
@@ -1,5 +1,5 @@
/* $RoughId: sha2init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
-/* $Id: sha2init.c,v 1.2 2002/02/17 12:43:44 nobu Exp $ */
+/* $Id$ */
#include "digest.h"
#include "sha2.h"
diff --git a/ext/digest/test.sh b/ext/digest/test.sh
index 2ae2688e4d..6fb07d2177 100644
--- a/ext/digest/test.sh
+++ b/ext/digest/test.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
# $RoughId: test.sh,v 1.5 2001/07/13 15:38:27 knu Exp $
-# $Id: test.sh,v 1.2 2002/09/26 17:55:16 knu Exp $
+# $Id$
RUBY=${RUBY:=ruby}
MAKE=${MAKE:=make}
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 042afd3159..22abb754d2 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -1,5 +1,5 @@
/*
- * $Id: dl.c,v 1.20.2.5 2005/12/16 13:32:06 ttate Exp $
+ * $Id$
*/
#include <ruby.h>
@@ -147,7 +147,7 @@ dlstrdup(const char *str)
{
char *newstr;
- newstr = (char*)dlmalloc(strlen(str)+1);
+ newstr = (char*)dlmalloc(strlen(str));
strcpy(newstr,str);
return newstr;
@@ -435,15 +435,7 @@ c_parray(VALUE v, long *size)
ary[i] = (void*)(pdata->ptr);
}
else{
- e = rb_funcall(e, rb_intern("to_ptr"), 0);
- if (rb_obj_is_kind_of(e, rb_cDLPtrData)) {
- struct ptr_data *pdata;
- Data_Get_Struct(e, struct ptr_data, pdata);
- ary[i] = (void*)(pdata->ptr);
- }
- else{
- rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
- }
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
}
break;
}
@@ -503,12 +495,6 @@ rb_ary2cary(char t, VALUE v, long *size)
if (rb_obj_is_kind_of(val0, rb_cDLPtrData)) {
return (void*)c_parray(v,size);
}
- else{
- val0 = rb_funcall(val0, rb_intern("to_ptr"), 0);
- if (rb_obj_is_kind_of(val0, rb_cDLPtrData)) {
- return (void*)c_parray(v,size);
- }
- }
rb_raise(rb_eDLTypeError, "type mismatch");
case T_NIL:
return (void*)c_parray(v, size);
@@ -557,7 +543,7 @@ rb_io_to_ptr(VALUE self)
GetOpenFile(self, fptr);
fp = fptr->f;
- return fp ? rb_dlptr_new(fp, 0, 0) : Qnil;
+ return fp ? rb_dlptr_new(fp, sizeof(FILE), 0) : Qnil;
}
VALUE
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
index 9e4e01eea5..1faa316cf1 100644
--- a/ext/dl/dl.h
+++ b/ext/dl/dl.h
@@ -1,5 +1,5 @@
/* -*- C -*-
- * $Id: dl.h,v 1.9 2003/12/01 23:02:44 ttate Exp $
+ * $Id$
*/
#ifndef RUBY_DL_H
diff --git a/ext/dl/h2rb b/ext/dl/h2rb
index d5ebd6ee2c..00fbd60c82 100644
--- a/ext/dl/h2rb
+++ b/ext/dl/h2rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# -*- ruby -*-
-# $Id: h2rb,v 1.1 2002/04/02 10:56:13 ttate Exp $
+# $Id$
require 'mkmf'
require 'ftools'
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index 1e8c17e501..95b6dc74dc 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -1,5 +1,5 @@
/* -*- C -*-
- * $Id: handle.c,v 1.11.2.1 2005/02/28 02:45:17 matz Exp $
+ * $Id$
*/
#include <ruby.h>
@@ -161,7 +161,7 @@ rb_dlhandle_sym(int argc, VALUE argv[], VALUE self)
Data_Get_Struct(self, struct dl_handle, dlhandle);
if (!dlhandle->open) {
- rb_raise(rb_eRuntimeError, "closed handle");
+ rb_raise(rb_eRuntimeError, "Closed handle.");
}
handle = dlhandle->ptr;
@@ -187,11 +187,11 @@ rb_dlhandle_sym(int argc, VALUE argv[], VALUE self)
if (!func)
#endif
{
- rb_raise(rb_eRuntimeError, "unknown symbol \"%sA\"", name);
+ rb_raise(rb_eRuntimeError, "Unknown symbol \"%sA\".", name);
}
}
#else
- rb_raise(rb_eRuntimeError, "unknown symbol \"%s\"", name);
+ rb_raise(rb_eRuntimeError, "Unknown symbol \"%s\".", name);
#endif
}
val = rb_dlsym_new(func, name, stype);
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
index 63c9b2c050..2a98ace8ab 100644
--- a/ext/dl/lib/dl/import.rb
+++ b/ext/dl/lib/dl/import.rb
@@ -38,10 +38,10 @@ module DL
case proto
when /^([\d\w\*_\s]+)\(([\d\w\*_\s\,\[\]]*)\)$/
ret = $1
- args = $2.strip()
+ args = $2
ret = ret.split(/\s+/)
args = args.split(/\s*,\s*/)
- func = ret.pop()
+ func = ret.pop
if( func =~ /^\*/ )
func.gsub!(/^\*+/,"")
ret.push("*")
@@ -99,10 +99,9 @@ module DL
# example:
# typealias("uint", "unsigned int")
#
- def typealias(alias_type, ty1, enc1=nil, dec1=nil, ty2=nil, enc2=nil, dec2=nil)
+ def typealias(*args)
init_types()
- @types.typealias(alias_type, ty1, enc1, dec1,
- ty2||ty1, enc2, dec2)
+ @types.typealias(*args)
end
# example:
diff --git a/ext/dl/lib/dl/struct.rb b/ext/dl/lib/dl/struct.rb
index 33f303fe22..2f54019294 100644
--- a/ext/dl/lib/dl/struct.rb
+++ b/ext/dl/lib/dl/struct.rb
@@ -33,7 +33,7 @@ module DL
"def #{name}",
" v = @ptr[\"#{name}\"]",
" if( @len[\"#{name}\"] )",
- " v = v.collect{|x| @dec[\"#{name}\"] ? @dec[\"#{name}\"].call(x) : x }",
+ " v = v.collect{|x| @dec[\"#{name}\"].call(x) if @dec[\"#{name}\"] }",
" else",
" v = @dec[\"#{name}\"].call(v) if @dec[\"#{name}\"]",
" end",
@@ -41,7 +41,7 @@ module DL
"end",
"def #{name}=(v)",
" if( @len[\"#{name}\"] )",
- " v = v.collect{|x| @enc[\"#{name}\"] ? @enc[\"#{name}\"].call(x) : x }",
+ " v = v.collect{|x| @enc[\"#{name}\"].call(x) if @enc[\"#{name}\"] }",
" else",
" v = @enc[\"#{name}\"].call(v) if @enc[\"#{name}\"]",
" end",
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c
index 5c313fad55..32f78c4de5 100644
--- a/ext/dl/ptr.c
+++ b/ext/dl/ptr.c
@@ -1,5 +1,5 @@
/* -*- C -*-
- * $Id: ptr.c,v 1.19.2.1 2006/05/25 16:37:57 ttate Exp $
+ * $Id$
*/
#include <ruby.h>
@@ -753,32 +753,32 @@ rb_dlptr_aref(int argc, VALUE argv[], VALUE self)
switch (data->ctype) {
case DLPTR_CTYPE_STRUCT:
for (i=0; i < data->ids_num; i++) {
- switch (data->stype[i]) {
- case 'I':
- DLALIGN(data->ptr,offset,INT_ALIGN);
- break;
- case 'L':
- DLALIGN(data->ptr,offset,LONG_ALIGN);
- break;
- case 'P':
- case 'S':
- DLALIGN(data->ptr,offset,VOIDP_ALIGN);
- break;
- case 'F':
- DLALIGN(data->ptr,offset,FLOAT_ALIGN);
- break;
- case 'D':
- DLALIGN(data->ptr,offset,DOUBLE_ALIGN);
- break;
- case 'C':
- break;
- case 'H':
- DLALIGN(data->ptr,offset,SHORT_ALIGN);
- break;
- default:
- rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
- }
if (data->ids[i] == id) {
+ switch (data->stype[i]) {
+ case 'I':
+ DLALIGN(data->ptr,offset,INT_ALIGN);
+ break;
+ case 'L':
+ DLALIGN(data->ptr,offset,LONG_ALIGN);
+ break;
+ case 'P':
+ case 'S':
+ DLALIGN(data->ptr,offset,VOIDP_ALIGN);
+ break;
+ case 'F':
+ DLALIGN(data->ptr,offset,FLOAT_ALIGN);
+ break;
+ case 'D':
+ DLALIGN(data->ptr,offset,DOUBLE_ALIGN);
+ break;
+ case 'C':
+ break;
+ case 'H':
+ DLALIGN(data->ptr,offset,SHORT_ALIGN);
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
return cary2ary((char *)data->ptr + offset, data->stype[i], data->ssize[i]);
}
switch (data->stype[i]) {
@@ -883,35 +883,34 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
case DLPTR_CTYPE_STRUCT:
offset = 0;
for (i=0; i < data->ids_num; i++) {
- switch (data->stype[i]) {
- case 'I':
- DLALIGN(data->ptr,offset,INT_ALIGN);
- break;
- case 'L':
- DLALIGN(data->ptr,offset,LONG_ALIGN);
- break;
- case 'P':
- case 'S':
- DLALIGN(data->ptr,offset,VOIDP_ALIGN);
- break;
- case 'D':
- DLALIGN(data->ptr,offset,DOUBLE_ALIGN);
- break;
- case 'F':
- DLALIGN(data->ptr,offset,FLOAT_ALIGN);
- break;
- case 'C':
- break;
- case 'H':
- DLALIGN(data->ptr,offset,SHORT_ALIGN);
- break;
- default:
- rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
- }
if (data->ids[i] == id) {
+ switch (data->stype[i]) {
+ case 'I':
+ DLALIGN(data->ptr,offset,INT_ALIGN);
+ break;
+ case 'L':
+ DLALIGN(data->ptr,offset,LONG_ALIGN);
+ break;
+ case 'P':
+ case 'S':
+ DLALIGN(data->ptr,offset,VOIDP_ALIGN);
+ break;
+ case 'D':
+ DLALIGN(data->ptr,offset,DOUBLE_ALIGN);
+ break;
+ case 'F':
+ DLALIGN(data->ptr,offset,FLOAT_ALIGN);
+ break;
+ case 'C':
+ break;
+ case 'H':
+ DLALIGN(data->ptr,offset,SHORT_ALIGN);
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
memimg = ary2cary(data->stype[i], val, &memsize);
memcpy((char *)data->ptr + offset, memimg, memsize);
- dlfree(memimg);
return val;
}
switch (data->stype[i]) {
@@ -982,7 +981,6 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
}
memimg = ary2cary(data->stype[i], val, NULL);
memcpy(data->ptr, memimg, memsize);
- dlfree(memimg);
}
}
return val;
diff --git a/ext/dl/sym.c b/ext/dl/sym.c
index 6e4337c0b7..59a618496f 100644
--- a/ext/dl/sym.c
+++ b/ext/dl/sym.c
@@ -1,5 +1,5 @@
/* -*- C -*-
- * $Id: sym.c,v 1.24.2.3 2005/06/15 23:39:27 ocean Exp $
+ * $Id$
*/
#include <ruby.h>
@@ -941,7 +941,6 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
}
}
- FREE_ARGS;
#undef FREE_ARGS
return rb_assoc_new(val,dvals);
}
diff --git a/ext/dl/test/test.rb b/ext/dl/test/test.rb
index bf8dfc18e3..52be04699f 100644
--- a/ext/dl/test/test.rb
+++ b/ext/dl/test/test.rb
@@ -273,7 +273,7 @@ assert("data_aref", :must,
GC.start
-ptr = DL::malloc(32)
+ptr = DL::malloc(1024)
ptr.struct!("CHIL", "c", "h", "i", "l")
ptr["c"] = 1
ptr["h"] = 2
@@ -291,16 +291,5 @@ ptr["n"] = 10
ptr["ptr"] = nil
assert("struct!", :must, ptr["n"] == 10 && ptr["ptr"] == nil)
-ptr = DL::malloc(16)
-ptr.struct!("CICI", "c1", "i1", "c2", "i2")
-ptr["c1"] = 0xf1
-ptr["c2"] = 0xf2
-c1 = [ptr["c1"]].pack("c").unpack("C")[0]
-c2 = [ptr["c2"]].pack("c").unpack("C")[0]
-assert("struct!", :must,
- c1 == 0xf1 &&
- c2 == 0xf2)
-
-
GC.start
printf("fail/total = #{$FAIL}/#{$TOTAL}\n")
diff --git a/ext/enumerator/enumerator.c b/ext/enumerator/enumerator.c
index 7b8f109e38..74785569e7 100644
--- a/ext/enumerator/enumerator.c
+++ b/ext/enumerator/enumerator.c
@@ -2,47 +2,23 @@
enumerator.c - provides Enumerator class
- $Author: matz $
+ $Author$
Copyright (C) 2001-2003 Akinori MUSHA
$Idaemons: /home/cvs/rb/enumerator/enumerator.c,v 1.1.1.1 2001/07/15 10:12:48 knu Exp $
$RoughId: enumerator.c,v 1.6 2003/07/27 11:03:24 nobu Exp $
- $Id: enumerator.c,v 1.3.2.3 2005/10/24 00:07:00 matz Exp $
+ $Id$
************************************************/
#include "ruby.h"
#include "node.h"
-/*
- * Document-class: Enumerable::Enumerator
- *
- * A class which provides a method `each' to be used as an Enumerable
- * object.
- */
static VALUE rb_cEnumerator;
static ID sym_each, sym_each_with_index, sym_each_slice, sym_each_cons;
static ID id_new, id_enum_obj, id_enum_method, id_enum_args;
-/*
- * call-seq:
- * obj.to_enum(method = :each, *args)
- * obj.enum_for(method = :each, *args)
- *
- * Returns Enumerable::Enumerator.new(self, method, *args).
- *
- * e.g.:
- * str = "xyz"
- *
- * enum = str.enum_for(:each_byte)
- * a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
- *
- * # protects an array from being modified
- * a = [1, 2, 3]
- * some_method(a.to_enum)
- *
- */
static VALUE
obj_to_enum(obj, enum_args)
VALUE obj, enum_args;
@@ -52,13 +28,6 @@ obj_to_enum(obj, enum_args)
return rb_apply(rb_cEnumerator, id_new, enum_args);
}
-/*
- * call-seq:
- * enum_with_index
- *
- * Returns Enumerable::Enumerator.new(self, :each_with_index).
- *
- */
static VALUE
enumerator_enum_with_index(obj)
VALUE obj;
@@ -84,21 +53,6 @@ each_slice_i(val, memo)
return Qnil;
}
-/*
- * call-seq:
- * e.each_slice(n) {...}
- *
- * Iterates the given block for each slice of <n> elements.
- *
- * e.g.:
- * (1..10).each_slice(3) {|a| p a}
- * # outputs below
- * [1, 2, 3]
- * [4, 5, 6]
- * [7, 8, 9]
- * [10]
- *
- */
static VALUE
enum_each_slice(obj, n)
VALUE obj, n;
@@ -119,13 +73,6 @@ enum_each_slice(obj, n)
return Qnil;
}
-/*
- * call-seq:
- * e.enum_slice(n)
- *
- * Returns Enumerable::Enumerator.new(self, :each_slice, n).
- *
- */
static VALUE
enumerator_enum_slice(obj, n)
VALUE obj, n;
@@ -151,26 +98,6 @@ each_cons_i(val, memo)
return Qnil;
}
-/*
- * call-seq:
- * each_cons(n) {...}
- *
- * Iterates the given block for each array of consecutive <n>
- * elements.
- *
- * e.g.:
- * (1..10).each_cons(3) {|a| p a}
- * # outputs below
- * [1, 2, 3]
- * [2, 3, 4]
- * [3, 4, 5]
- * [4, 5, 6]
- * [5, 6, 7]
- * [6, 7, 8]
- * [7, 8, 9]
- * [8, 9, 10]
- *
- */
static VALUE
enum_each_cons(obj, n)
VALUE obj, n;
@@ -186,13 +113,6 @@ enum_each_cons(obj, n)
return Qnil;
}
-/*
- * call-seq:
- * e.enum_cons(n)
- *
- * Returns Enumerable::Enumerator.new(self, :each_cons, n).
- *
- */
static VALUE
enumerator_enum_cons(obj, n)
VALUE obj, n;
@@ -200,21 +120,6 @@ enumerator_enum_cons(obj, n)
return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_cons, n);
}
-/*
- * call-seq:
- * Enumerable::Enumerator.new(obj, method = :each, *args)
- *
- * Creates a new Enumerable::Enumerator object, which is to be
- * used as an Enumerable object using the given object's given
- * method with the given arguments.
- *
- * e.g.:
- * str = "xyz"
- *
- * enum = Enumerable::Enumerator.new(str, :each_byte)
- * a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
- *
- */
static VALUE
enumerator_initialize(argc, argv, obj)
int argc;
@@ -242,14 +147,6 @@ enumerator_iter(memo)
return rb_apply(memo->u1.value, memo->u2.id, memo->u3.value);
}
-/*
- * call-seq:
- * enum.each {...}
- *
- * Iterates the given block using the object and the method specified
- * in the first place.
- *
- */
static VALUE
enumerator_each(obj)
VALUE obj;
diff --git a/ext/enumerator/enumerator.txt b/ext/enumerator/enumerator.txt
index 1b84c0c088..64c7d50226 100644
--- a/ext/enumerator/enumerator.txt
+++ b/ext/enumerator/enumerator.txt
@@ -1,7 +1,7 @@
.\" enumerator.txt - -*- Indented-Text -*-
$Idaemons: /home/cvs/rb/enumerator/enumerator.txt,v 1.2 2001/07/15 10:19:24 knu Exp $
$RoughId: enumerator.txt,v 1.5 2003/02/20 12:24:51 knu Exp $
-$Id: enumerator.txt,v 1.2 2003/10/17 14:09:43 knu Exp $
+$Id$
** Enumerable::Enumerator(Class)
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 0372592049..c42f279d58 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -2,8 +2,8 @@
etc.c -
- $Author: shyouhei $
- $Date: 2007/01/09 12:24:20 $
+ $Author$
+ $Date$
created at: Tue Mar 22 18:39:19 JST 1994
************************************************/
@@ -23,10 +23,6 @@
#include <grp.h>
#endif
-#ifndef HAVE_TYPE_UID_T
-#define uid_t int
-#endif
-
static VALUE sPasswd, sGroup;
#ifndef _WIN32
@@ -34,11 +30,6 @@ char *getenv();
#endif
char *getlogin();
-/* Returns the short user name of the currently logged in user.
- *
- * e.g.
- * Etc.getlogin -> 'guest'
- */
static VALUE
etc_getlogin(obj)
VALUE obj;
@@ -79,21 +70,21 @@ setup_passwd(pwd)
#ifdef HAVE_ST_PW_PASSWD
safe_setup_str(pwd->pw_passwd),
#endif
- PW_UID2VAL(pwd->pw_uid),
- PW_GID2VAL(pwd->pw_gid),
+ INT2FIX(pwd->pw_uid),
+ INT2FIX(pwd->pw_gid),
#ifdef HAVE_ST_PW_GECOS
safe_setup_str(pwd->pw_gecos),
#endif
safe_setup_str(pwd->pw_dir),
safe_setup_str(pwd->pw_shell),
#ifdef HAVE_ST_PW_CHANGE
- INT2NUM(pwd->pw_change),
+ INT2FIX(pwd->pw_change),
#endif
#ifdef HAVE_ST_PW_QUOTA
- INT2NUM(pwd->pw_quota),
+ INT2FIX(pwd->pw_quota),
#endif
#ifdef HAVE_ST_PW_AGE
- PW_AGE2VAL(pwd->pw_age),
+ INT2FIX(pwd->pw_age),
#endif
#ifdef HAVE_ST_PW_CLASS
safe_setup_str(pwd->pw_class),
@@ -102,22 +93,13 @@ setup_passwd(pwd)
safe_setup_str(pwd->pw_comment),
#endif
#ifdef HAVE_ST_PW_EXPIRE
- INT2NUM(pwd->pw_expire),
+ INT2FIX(pwd->pw_expire),
#endif
0 /*dummy*/
);
}
#endif
-/* Returns the /etc/passwd information for the user with specified integer
- * user id (uid).
- *
- * The information is returned as a Struct::Passwd; see getpwent above for
- * details.
- *
- * e.g. * Etc.getpwuid(0) -> #<struct Struct::Passwd name="root",
- * passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
- */
static VALUE
etc_getpwuid(argc, argv, obj)
int argc;
@@ -126,12 +108,12 @@ etc_getpwuid(argc, argv, obj)
{
#if defined(HAVE_GETPWENT)
VALUE id;
- uid_t uid;
+ int uid;
struct passwd *pwd;
rb_secure(4);
if (rb_scan_args(argc, argv, "01", &id) == 1) {
- uid = PW_VAL2UID(id);
+ uid = NUM2INT(id);
}
else {
uid = getuid();
@@ -144,14 +126,6 @@ etc_getpwuid(argc, argv, obj)
#endif
}
-/* Returns the /etc/passwd information for the user with specified login name.
- *
- * The information is returned as a Struct::Passwd; see getpwent above for
- * details.
- *
- * e.g. * Etc.getpwnam('root') -> #<struct Struct::Passwd name="root",
- * passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
- */
static VALUE
etc_getpwnam(obj, nam)
VALUE obj, nam;
@@ -191,21 +165,6 @@ passwd_iterate()
}
#endif
-/* Provides a convenient Ruby iterator which executes a block for each entry
- * in the /etc/passwd file.
- *
- * The code block is passed an Etc::Passwd struct; see getpwent above for
- * details.
- *
- * Example:
- *
- * require 'etc'
- *
- * Etc.passwd {|u|
- * puts u.name + " = " + u.gecos
- * }
- *
- */
static VALUE
etc_passwd(obj)
VALUE obj;
@@ -228,9 +187,6 @@ etc_passwd(obj)
return Qnil;
}
-/* Resets the process of reading the /etc/passwd file, so that the next call
- * to getpwent will return the first entry again.
- */
static VALUE
etc_setpwent(obj)
VALUE obj;
@@ -241,9 +197,6 @@ etc_setpwent(obj)
return Qnil;
}
-/* Ends the process of scanning through the /etc/passwd file begun with
- * getpwent, and closes the file.
- */
static VALUE
etc_endpwent(obj)
VALUE obj;
@@ -254,32 +207,6 @@ etc_endpwent(obj)
return Qnil;
}
-/* Returns an entry from the /etc/passwd file. The first time it is called it
- * opens the file and returns the first entry; each successive call returns
- * the next entry, or nil if the end of the file has been reached.
- *
- * To close the file when processing is complete, call endpwent.
- *
- * Each entry is returned as a Struct::Passwd:
- *
- * - Passwd#name contains the short login name of the user as a String.
- *
- * - Passwd#passwd contains the encrypted password of the user as a String.
- * an 'x' is returned if shadow passwords are in use. An '*' is returned
- * if the user cannot log in using a password.
- *
- * - Passwd#uid contains the integer user ID (uid) of the user.
- *
- * - Passwd#gid contains the integer group ID (gid) of the user's primary group.
- *
- * - Passwd#gecos contains a longer String description of the user, such as
- * a full name. Some Unix systems provide structured information in the
- * gecos field, but this is system-dependent.
- *
- * - Passwd#dir contains the path to the home directory of the user as a String.
- *
- * - Passwd#shell contains the path to the login shell of the user as a String.
- */
static VALUE
etc_getpwent(obj)
VALUE obj;
@@ -313,31 +240,21 @@ setup_group(grp)
#ifdef HAVE_ST_GR_PASSWD
safe_setup_str(grp->gr_passwd),
#endif
- PW_GID2VAL(grp->gr_gid),
+ INT2FIX(grp->gr_gid),
mem);
}
#endif
-/* Returns information about the group with specified integer group id (gid),
- * as found in /etc/group.
- *
- * The information is returned as a Struct::Group; see getgrent above for
- * details.
- *
- * e.g. Etc.getgrgid(100) -> #<struct Struct::Group name="users", passwd="x",
- * gid=100, mem=["meta", "root"]>
- *
- */
static VALUE
etc_getgrgid(obj, id)
VALUE obj, id;
{
#ifdef HAVE_GETGRENT
- gid_t gid;
+ int gid;
struct group *grp;
rb_secure(4);
- gid = getgid();
+ gid = NUM2INT(id);
grp = getgrgid(gid);
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
return setup_group(grp);
@@ -346,16 +263,6 @@ etc_getgrgid(obj, id)
#endif
}
-/* Returns information about the group with specified String name, as found
- * in /etc/group.
- *
- * The information is returned as a Struct::Group; see getgrent above for
- * details.
- *
- * e.g. Etc.getgrnam('users') -> #<struct Struct::Group name="users",
- * passwd="x", gid=100, mem=["meta", "root"]>
- *
- */
static VALUE
etc_getgrnam(obj, nam)
VALUE obj, nam;
@@ -396,21 +303,6 @@ group_iterate()
}
#endif
-/* Provides a convenient Ruby iterator which executes a block for each entry
- * in the /etc/group file.
- *
- * The code block is passed an Etc::Group struct; see getgrent above for
- * details.
- *
- * Example:
- *
- * require 'etc'
- *
- * Etc.group {|g|
- * puts g.name + ": " + g.mem.join(', ')
- * }
- *
- */
static VALUE
etc_group(obj)
VALUE obj;
@@ -433,9 +325,6 @@ etc_group(obj)
return Qnil;
}
-/* Resets the process of reading the /etc/group file, so that the next call
- * to getgrent will return the first entry again.
- */
static VALUE
etc_setgrent(obj)
VALUE obj;
@@ -446,9 +335,6 @@ etc_setgrent(obj)
return Qnil;
}
-/* Ends the process of scanning through the /etc/group file begun by
- * getgrent, and closes the file.
- */
static VALUE
etc_endgrent(obj)
VALUE obj;
@@ -459,26 +345,6 @@ etc_endgrent(obj)
return Qnil;
}
-/* Returns an entry from the /etc/group file. The first time it is called it
- * opens the file and returns the first entry; each successive call returns
- * the next entry, or nil if the end of the file has been reached.
- *
- * To close the file when processing is complete, call endgrent.
- *
- * Each entry is returned as a Struct::Group:
- *
- * - Group#name contains the name of the group as a String.
- *
- * - Group#passwd contains the encrypted password as a String. An 'x' is
- * returned if password access to the group is not available; an empty
- * string is returned if no password is needed to obtain membership of
- * the group.
- *
- * - Group#gid contains the group's numeric ID as an integer.
- *
- * - Group#mem is an Array of Strings containing the short login names of the
- * members of the group.
- */
static VALUE
etc_getgrent(obj)
VALUE obj;
@@ -495,11 +361,6 @@ etc_getgrent(obj)
static VALUE mEtc;
-/* The etc module provides access to information from the /etc/passwd and
- * /etc/group files on Linux and Unix systems.
- *
- * Documented by mathew <meta@pobox.com>.
- */
void
Init_etc()
{
@@ -521,7 +382,6 @@ Init_etc()
rb_define_module_function(mEtc, "endgrent", etc_endgrent, 0);
rb_define_module_function(mEtc, "getgrent", etc_getgrent, 0);
- rb_global_variable(&sPasswd);
sPasswd = rb_struct_define("Passwd",
"name", "passwd", "uid", "gid",
#ifdef HAVE_ST_PW_GECOS
@@ -547,13 +407,10 @@ Init_etc()
"expire",
#endif
NULL);
+ rb_global_variable(&sPasswd);
#ifdef HAVE_GETGRENT
+ sGroup = rb_struct_define("Group", "name", "passwd", "gid", "mem", NULL);
rb_global_variable(&sGroup);
- sGroup = rb_struct_define("Group", "name",
-#ifdef HAVE_ST_GR_PASSWD
- "passwd",
-#endif
- "gid", "mem", NULL);
#endif
}
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index dbd0672545..16f2da352b 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -8,36 +8,11 @@ if a or b or c
have_struct_member('struct passwd', 'pw_gecos', 'pwd.h')
have_struct_member('struct passwd', 'pw_change', 'pwd.h')
have_struct_member('struct passwd', 'pw_quota', 'pwd.h')
- if have_struct_member('struct passwd', 'pw_age', 'pwd.h')
- case what_type?('struct passwd', 'pw_age', 'pwd.h')
- when "string"
- f = "safe_setup_str"
- when "long long"
- f = "LL2NUM"
- else
- f = "INT2NUM"
- end
- $defs.push("-DPW_AGE2VAL="+f)
- end
+ have_struct_member('struct passwd', 'pw_age', 'pwd.h')
have_struct_member('struct passwd', 'pw_class', 'pwd.h')
have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
have_struct_member('struct group', 'gr_passwd', 'grp.h')
- [%w"uid_t pwd.h", %w"gid_t grp.h"].each do |t, *h|
- h.unshift("sys/types.h")
- f = "INT2NUM"
- if have_type(t, h)
- if try_static_assert("sizeof(#{t}) > sizeof(long)", h)
- f = "LL2NUM"
- end
- if try_static_assert("(#{t})-1 > 0", h)
- f = "U#{f}"
- end
- end
- t = t.chomp('_t').upcase
- $defs.push("-DPW_#{t}2VAL=#{f}")
- $defs.push("-DPW_VAL2#{t}=#{f.sub(/([A-Z]+)2(NUM)/, '\22\1')}")
- end
create_makefile("etc")
end
diff --git a/ext/extmk.rb b/ext/extmk.rb
index bbcb3c09b8..5d26b43e13 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -16,74 +16,26 @@ alias $PROGRAM_NAME $0
alias $0 $progname
$extlist = []
-$compiled = {}
-$:.replace([Dir.pwd])
+$:.replace ["."]
require 'rbconfig'
srcdir = File.dirname(File.dirname(__FILE__))
-$:.unshift(srcdir, File.expand_path("lib", srcdir))
+$:.replace [srcdir, srcdir+"/lib", "."]
+
+require 'mkmf'
+require 'getopts'
$topdir = "."
$top_srcdir = srcdir
-
-require 'mkmf'
-require 'optparse/shellwords'
+$hdrdir = $top_srcdir
def sysquote(x)
@quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
@quote ? x.quote : x
end
-def relative_from(path, base)
- dir = File.join(path, "")
- if File.expand_path(dir) == File.expand_path(dir, base)
- path
- else
- File.join(base, path)
- end
-end
-
-def extract_makefile(makefile, keep = true)
- m = File.read(makefile)
- if !(target = m[/^TARGET[ \t]*=[ \t]*(\S*)/, 1])
- return keep
- end
- installrb = {}
- m.scan(/^install-rb-default:[ \t]*(\S+)\n\1:[ \t]*(\S+)/) {installrb[$2] = $1}
- oldrb = installrb.keys.sort
- newrb = install_rb(nil, "").collect {|d, *f| f}.flatten.sort
- if target_prefix = m[/^target_prefix[ \t]*=[ \t]*\/(.*)/, 1]
- target = "#{target_prefix}/#{target}"
- end
- unless oldrb == newrb
- if $extout
- newrb.each {|f| installrb.delete(f)}
- unless installrb.empty?
- config = CONFIG.dup
- install_dirs(target_prefix).each {|var, val| config[var] = val}
- FileUtils.rm_f(installrb.values.collect {|f| Config.expand(f, config)}, :verbose => true)
- end
- end
- return false
- end
- $target = target
- $extconf_h = m[/^RUBY_EXTCONF_H[ \t]*=[ \t]*(\S+)/, 1]
- $static ||= m[/^EXTSTATIC[ \t]*=[ \t]*(\S+)/, 1] || false
- /^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = nil
- $preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "")
- $DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "")
- if s = m[/^LIBS[ \t]*=[ \t]*(.*)/, 1]
- s.sub!(/^#{Regexp.quote($LIBRUBYARG)} */, "")
- s.sub!(/ *#{Regexp.quote($LIBS)}$/, "")
- $libs = s
- end
- $LOCAL_LIBS = m[/^LOCAL_LIBS[ \t]*=[ \t]*(.*)/, 1] || ""
- $LIBPATH = Shellwords.shellwords(m[/^libpath[ \t]*=[ \t]*(.*)/, 1] || "") - %w[$(libdir) $(topdir)]
- true
-end
-
def extmake(target)
print "#{$message} #{target}\n"
$stdout.flush
@@ -97,43 +49,35 @@ def extmake(target)
return true if $nodynamic and not $static
end
- FileUtils.mkpath target unless File.directory?(target)
+ init_mkmf
+
begin
dir = Dir.pwd
FileUtils.mkpath target unless File.directory?(target)
Dir.chdir target
top_srcdir = $top_srcdir
topdir = $topdir
- mk_srcdir = CONFIG["srcdir"]
- mk_topdir = CONFIG["topdir"]
prefix = "../" * (target.count("/")+1)
- $hdrdir = $top_srcdir = relative_from(top_srcdir, prefix)
+ if File.expand_path(top_srcdir) != File.expand_path(top_srcdir, dir)
+ $hdrdir = $top_srcdir = prefix + top_srcdir
+ end
$topdir = prefix + $topdir
$target = target
$mdir = target
$srcdir = File.join($top_srcdir, "ext", $mdir)
$preload = nil
- $compiled[target] = false
makefile = "./Makefile"
- ok = File.exist?(makefile)
unless $ignore
- Config::CONFIG["hdrdir"] = $hdrdir
- Config::CONFIG["srcdir"] = $srcdir
- Config::CONFIG["topdir"] = $topdir
- CONFIG["hdrdir"] = ($hdrdir == top_srcdir) ? top_srcdir : "$(topdir)"+top_srcdir[2..-1]
- CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}"
- CONFIG["topdir"] = $topdir
- begin
- $extconf_h = nil
- ok &&= extract_makefile(makefile)
- if (($extconf_h && !File.exist?($extconf_h)) ||
- !(t = modified?(makefile, MTIMES)) ||
- %W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb #{$srcdir}/depend".any? {|f| modified?(f, [t])})
- then
- ok = false
- init_mkmf
- Logging::logfile 'mkmf.log'
- rm_f makefile
+ if $static ||
+ !(t = modified?(makefile, MTIMES)) ||
+ %W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
+ #{$srcdir}/depend>.any? {|f| modified?(f, [t])}
+ then
+ $defs = []
+ Logging::logfile 'mkmf.log'
+ Config::CONFIG["srcdir"] = $srcdir
+ rm_f makefile
+ begin
if File.exist?($0 = "#{$srcdir}/makefile.rb")
load $0
elsif File.exist?($0 = "#{$srcdir}/extconf.rb")
@@ -141,119 +85,64 @@ def extmake(target)
else
create_makefile(target)
end
- $defs << "-DRUBY_EXPORT" if $static
- ok = File.exist?(makefile)
+ File.exist?(makefile)
+ rescue SystemExit
+ # ignore
+ ensure
+ rm_f "conftest*"
+ $0 = $PROGRAM_NAME
+ Config::CONFIG["srcdir"] = $top_srcdir
end
- rescue SystemExit
- # ignore
- ensure
- rm_f "conftest*"
- config = $0
- $0 = $PROGRAM_NAME
- end
- end
- ok = yield(ok) if block_given?
- unless ok
- open(makefile, "w") do |f|
- f.print dummy_makefile(CONFIG["srcdir"])
+ else
+ true
end
+ else
+ File.exist?(makefile)
+ end or open(makefile, "w") do |f|
+ f.print dummy_makefile($srcdir)
return true
end
args = sysquote($mflags)
- unless $destdir.to_s.empty? or $mflags.include?("DESTDIR")
- args += [sysquote("DESTDIR=" + relative_from($destdir, "../"+prefix))]
- end
if $static
- args += ["static"] unless $clean
+ args += ["static"]
$extlist.push [$static, $target, File.basename($target), $preload]
end
unless system($make, *args)
$ignore or $continue or return false
end
- $compiled[target] = true
- if $clean and $clean != true
- File.unlink(makefile) rescue nil
- end
if $static
$extflags ||= ""
$extlibs ||= []
$extpath ||= []
- unless $mswin
- $extflags = ($extflags.split | $DLDFLAGS.split | $LDFLAGS.split).join(" ")
- end
+ $extflags += " " + $DLDFLAGS unless $DLDFLAGS.empty?
+ $extflags += " " + $LDFLAGS unless $LDFLAGS.empty?
$extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
$extpath |= $LIBPATH
end
ensure
- Config::CONFIG["srcdir"] = $top_srcdir
- Config::CONFIG["topdir"] = topdir
- CONFIG["srcdir"] = mk_srcdir
- CONFIG["topdir"] = mk_topdir
- CONFIG.delete("hdrdir")
$hdrdir = $top_srcdir = top_srcdir
$topdir = topdir
Dir.chdir dir
end
- begin
- Dir.rmdir target
- target = File.dirname(target)
- rescue SystemCallError
- break
- end while true
true
end
-def compiled?(target)
- $compiled[target]
-end
-
def parse_args()
- $mflags = []
-
- opts = nil
- $optparser ||= OptionParser.new do |opts|
- opts.on('-n') {$dryrun = true}
- opts.on('--[no-]extension [EXTS]', Array) do |v|
- $extension = (v == false ? [] : v)
- end
- opts.on('--[no-]extstatic [STATIC]', Array) do |v|
- if ($extstatic = v) == false
- $extstatic = []
- elsif v
- $force_static = true if $extstatic.delete("static")
- $extstatic = nil if $extstatic.empty?
- end
- end
- opts.on('--dest-dir=DIR') do |v|
- $destdir = v
- end
- opts.on('--extout=DIR') do |v|
- $extout = (v unless v.empty?)
- end
- opts.on('--make=MAKE') do |v|
- $make = v || 'make'
- end
- opts.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
- v.grep(/\A([-\w]+)=(.*)/) {$configure_args["--#{$1}"] = $2}
- if arg = v.first
- arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
- end
- $mflags.concat(v)
- end
- opts.on('--message [MESSAGE]', String) do |v|
- $message = v
- end
- end
- begin
- $optparser.parse!(ARGV)
- rescue OptionParser::InvalidOption => e
- retry if /^--/ =~ e.args[0]
- $optparser.warn(e)
- abort opts.to_s
+ getopts('n', 'extstatic:', 'dest-dir:',
+ 'make:', 'make-flags:', 'mflags:')
+
+ $dryrun = $OPT['n']
+ $force_static = $OPT['extstatic'] == 'static'
+ $destdir = $OPT['dest-dir'] || ''
+ $make = $OPT['make'] || $make || 'make'
+ mflags = ($OPT['make-flags'] || '').strip
+ mflags = ($OPT['mflags'] || '').strip if mflags.empty?
+
+ $mflags = Shellwords.shellwords(mflags)
+ if arg = $mflags.first
+ arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
end
- $destdir ||= ''
-
$make, *rest = Shellwords.shellwords($make)
$mflags.unshift(*rest) unless rest.empty?
@@ -261,10 +150,6 @@ def parse_args()
grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
false
end
- def $mflags.defined?(var)
- grep(/\A#{var}=(.*)/) {return $1}
- false
- end
if $mflags.set?(?n)
$dryrun = true
@@ -273,33 +158,25 @@ def parse_args()
end
$continue = $mflags.set?(?k)
- if $extout
- $extout = '$(topdir)/'+$extout
- $extout_prefix = $extout ? "$(extout)$(target_prefix)/" : ""
- $mflags << "extout=#$extout" << "extout_prefix=#$extout_prefix"
- end
+ $mflags |= ["DESTDIR=#{$destdir}"]
end
parse_args()
-if target = ARGV.shift and /^[a-z-]+$/ =~ target
- $mflags.push(target)
- target = target.sub(/^(dist|real)(?=(?:clean)?$)/, '')
- case target
- when /clean/
- $ignore ||= true
- $clean = $1 ? $1[0] : true
- when /^install\b/
- $install = true
- $ignore ||= true
- $mflags.unshift("INSTALL_PROG=install -c -p -m 0755",
- "INSTALL_DATA=install -c -p -m 0644",
- "MAKEDIRS=mkdir -p") if $dryrun
- end
-end
unless $message
- if target
- $message = target.sub(/^(\w+)e?\b/, '\1ing').tr('-', ' ')
+ if $message = ARGV.shift and /^[a-z]+$/ =~ $message
+ $mflags.push($message)
+ $message = $message.sub(/^(?:dist|real)(?=(?:clean)?$)/, '\1')
+ case $message
+ when "clean"
+ $ignore ||= true
+ when "install"
+ $ignore ||= true
+ $mflags.unshift("INSTALL_PROG=install -c -p -m 0755",
+ "INSTALL_DATA=install -c -p -m 0644",
+ "MAKEDIRS=mkdir -p") if $dryrun
+ end
+ $message.sub!(/e?$/, "ing")
else
$message = "compiling"
end
@@ -308,28 +185,22 @@ end
EXEEXT = CONFIG['EXEEXT']
if CROSS_COMPILING
$ruby = CONFIG['MINIRUBY']
-elsif sep = config_string('BUILD_FILE_SEPARATOR')
- $ruby = "$(topdir:/=#{sep})#{sep}miniruby" + EXEEXT
+elsif $nmake
+ $ruby = '$(topdir:/=\\)\\miniruby' + EXEEXT
else
$ruby = '$(topdir)/miniruby' + EXEEXT
end
-$ruby << " -I'$(topdir)' -I'$(hdrdir)/lib'"
+$ruby << " -I$(topdir) -I$(hdrdir)/lib"
$config_h = '$(topdir)/config.h'
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
# get static-link modules
$static_ext = {}
-if $extstatic
- $extstatic.each do |target|
- target = target.downcase if /mswin32|bccwin32/ =~ RUBY_PLATFORM
- $static_ext[target] = $static_ext.size
- end
-end
for dir in ["ext", File::join($top_srcdir, "ext")]
setup = File::join(dir, CONFIG['setup'])
if File.file? setup
- f = open(setup)
+ f = open(setup)
while line = f.gets()
line.chomp!
line.sub!(/#.*$/, '')
@@ -343,80 +214,34 @@ for dir in ["ext", File::join($top_srcdir, "ext")]
next
end
target = target.downcase if /mswin32|bccwin32/ =~ RUBY_PLATFORM
- $static_ext[target] = $static_ext.size
+ $static_ext[target] = true
end
MTIMES << f.mtime
$setup = setup
f.close
break
end
-end unless $extstatic
-
-ext_prefix = "#{$top_srcdir}/ext"
-exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
-if $extension
- exts |= $extension.select {|d| File.directory?("#{ext_prefix}/#{d}")}
-else
- withes, withouts = %w[--with --without].collect {|w|
- if not (w = %w[-extensions -ext].collect {|opt|arg_config(w+opt)}).any?
- proc {false}
- elsif (w = w.grep(String)).empty?
- proc {true}
- else
- w.collect {|opt| opt.split(/,/)}.flatten.method(:any?)
- end
- }
- cond = proc {|ext|
- cond1 = proc {|n| File.fnmatch(n, ext, File::FNM_PATHNAME)}
- withes.call(&cond1) or !withouts.call(&cond1)
- }
- exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
- d = File.dirname(d)
- d.slice!(0, ext_prefix.length + 1)
- d
- }.find_all {|ext|
- with_config(ext, &cond)
- }.sort
-end
-
-if $extout
- Config.expand(extout = "#$extout", Config::CONFIG.merge("topdir"=>$topdir))
- if $install
- dest = Config.expand($rubylibdir.dup)
- unless $destdir.empty?
- dest.sub!($dest_prefix_pattern, Config.expand($destdir.dup))
- end
- FileUtils.cp_r(extout+"/.", dest, :verbose => true, :noop => $dryrun)
- exit
- end
- unless $ignore
- FileUtils.mkpath(extout)
- end
end
dir = Dir.pwd
FileUtils::makedirs('ext')
Dir::chdir('ext')
-$hdrdir = $top_srcdir = relative_from(srcdir, $topdir = "..")
-exts.each do |d|
- extmake(d) or abort
+if File.expand_path(srcdir) != File.expand_path(srcdir, dir)
+ $hdrdir = $top_srcdir = "../" + srcdir
+end
+$topdir = ".."
+ext_prefix = "#{$top_srcdir}/ext"
+Dir.glob("#{ext_prefix}/*/**/extconf.rb") do |d|
+ d = File.dirname(d)
+ d.slice!(0, ext_prefix.length + 1)
+ extmake(d) or exit(1)
end
$hdrdir = $top_srcdir = srcdir
$topdir = "."
-extinit = Struct.new(:c, :o) {
- def initialize(src)
- super("#{src}.c", "#{src}.#{$OBJEXT}")
- end
-}.new("extinit")
if $ignore
- FileUtils.rm_f(extinit.to_a) if $clean
Dir.chdir ".."
- if $clean
- Dir.rmdir('ext') rescue nil
- FileUtils.rm_rf(extout) if $extout
- end
exit
end
@@ -442,24 +267,23 @@ if $extlist.size > 0
end
end
- src = %{\
+ src = <<SRC
extern char *ruby_sourcefile, *rb_source_filename();
#define init(func, name) (ruby_sourcefile = src = rb_source_filename(name), func(), rb_provide(src))
void Init_ext() {\n\tchar* src;\n#$extinit}
-}
- if !modified?(extinit.c, MTIMES) || IO.read(extinit.c) != src
- open(extinit.c, "w") {|f| f.print src}
+SRC
+ if !modified?("extinit.c", MTIMES) || IO.read("extinit.c") != src
+ open("extinit.c", "w") {|f| f.print src}
end
- $extobjs = "ext/#{extinit.o} " + $extobjs
+ $extobjs = "ext/extinit.#{$OBJEXT} " + $extobjs
if RUBY_PLATFORM =~ /m68k-human|beos/
$extflags.delete("-L/usr/local/lib")
end
$extpath.delete("$(topdir)")
$extflags = libpathflag($extpath) << " " << $extflags.strip
conf = [
- ['SETUP', $setup],
- [enable_config("shared", $enable_shared) ? 'DLDOBJS' : 'EXTOBJS', $extobjs],
+ ['SETUP', $setup], [$enable_shared ? 'DLDOBJS' : 'EXTOBJS', $extobjs],
['EXTLIBS', $extlibs.join(' ')], ['EXTLDFLAGS', $extflags]
].map {|n, v|
"#{n}=#{v}" if v and !(v = v.strip).empty?
@@ -467,32 +291,20 @@ void Init_ext() {\n\tchar* src;\n#$extinit}
puts conf
$stdout.flush
$mflags.concat(conf)
-else
- FileUtils.rm_f(extinit.to_a)
end
rubies = []
-%w[RUBY RUBYW STATIC_RUBY].each {|r|
- n = r
- if r = arg_config("--"+r.downcase) || config_string(r+"_INSTALL_NAME")
- rubies << r+EXEEXT
- $mflags << "#{n}=#{r}"
- end
+%w[RUBY RUBYW].each {|r|
+ config_string(r+"_INSTALL_NAME") {|r| rubies << r+EXEEXT}
}
Dir.chdir ".."
-unless $destdir.to_s.empty?
- $mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
-end
-unless $extlist.empty?
+if $extlist.size > 0
rm_f(Config::CONFIG["LIBRUBY_SO"])
end
puts "making #{rubies.join(', ')}"
$stdout.flush
$mflags.concat(rubies)
-if $nmake == ?b
- $mflags.collect {|flag| flag.sub!(/\A(?=\w+=)/, "-D")}
-end
system($make, *sysquote($mflags)) or exit($?.exitstatus)
#Local variables:
diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c
index 8f9cb43d0c..d48630fc66 100644
--- a/ext/fcntl/fcntl.c
+++ b/ext/fcntl/fcntl.c
@@ -2,7 +2,7 @@
fcntl.c -
- $Author: matz $
+ $Author$
created at: Mon Apr 7 18:53:05 JST 1997
Copyright (C) 1997-2001 Yukihiro Matsumoto
@@ -34,81 +34,6 @@ pack up your own arguments to pass as args for locking functions, etc.
#include "ruby.h"
#include <fcntl.h>
-/* Fcntl loads the constants defined in the system's <fcntl.h> C header
- * file, and used with both the fcntl(2) and open(2) POSIX system calls.
- *
- * Copyright (C) 1997-2001 Yukihiro Matsumoto
- *
- * Documented by mathew <meta@pobox.com>
- *
- * = Usage
- *
- * To perform a fcntl(2) operation, use IO::fcntl in the core classes.
- *
- * To perform an open(2) operation, use IO::sysopen.
- *
- * The set of operations and constants available depends upon specific OS
- * platform. Some values listed below may not be supported on your system.
- *
- * The constants supported by Ruby for use with IO::fcntl are:
- *
- * - F_DUPFD - duplicate a close-on-exec file handle to a non-close-on-exec
- * file handle.
- *
- * - F_GETFD - read the close-on-exec flag of a file handle.
- *
- * - F_SETFD - set the close-on-exec flag of a file handle.
- *
- * - FD_CLOEXEC - the value of the close-on-exec flag.
- *
- * - F_GETFL - get file descriptor flags.
- *
- * - F_SETFL - set file descriptor flags.
- *
- * - O_APPEND, O_NONBLOCK, etc (see below) - file descriptor flag
- * values for the above.
- *
- * - F_GETLK - determine whether a given region of a file is locked.
- *
- * - F_SETLK - acquire a lock on a region of a file.
- *
- * - F_SETLKW - acquire a lock on a region of a file, waiting if necessary.
- *
- * - F_RDLCK, F_WRLCK, F_UNLCK - types of lock for the above.
- *
- * The constants supported by Ruby for use with IO::sysopen are:
- *
- * - O_APPEND - open file in append mode.
- *
- * - O_NOCTTY - open tty without it becoming controlling tty.
- *
- * - O_CREAT - create file if it doesn't exist.
- *
- * - O_EXCL - used with O_CREAT, fail if file exists.
- *
- * - O_TRUNC - truncate file on open.
- *
- * - O_NONBLOCK / O_NDELAY - open in non-blocking mode.
- *
- * - O_RDONLY - open read-only.
- *
- * - O_WRONLY - open write-only.
- *
- * - O_RDWR - open read-write.
- *
- * - O_ACCMODE - mask to extract read/write flags.
- *
- * Example:
- *
- * require 'fcntl'
- *
- * fd = IO::sysopen('/tmp/tempfile',
- * Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT)
- * f = IO.open(fd)
- * f.syswrite("TEMP DATA")
- * f.close
- *
- */
void
Init_fcntl()
{
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 691d512460..e59b01addf 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -2,8 +2,8 @@
gdbm.c -
- $Author: usa $
- $Date: 2005/06/20 07:53:20 $
+ $Author$
+ $Date$
modified at: Mon Jan 24 15:59:52 JST 1994
************************************************/
@@ -72,21 +72,6 @@ fgdbm_close(obj)
return Qnil;
}
-static VALUE
-fgdbm_closed(obj)
- VALUE obj;
-{
- struct dbmdata *dbmp;
-
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp == 0)
- return Qtrue;
- if (dbmp->di_dbm == 0)
- return Qtrue;
-
- return Qfalse;
-}
-
static VALUE fgdbm_s_alloc _((VALUE));
static VALUE
@@ -956,7 +941,6 @@ Init_gdbm()
rb_define_method(rb_cGDBM, "initialize", fgdbm_initialize, -1);
rb_define_method(rb_cGDBM, "close", fgdbm_close, 0);
- rb_define_method(rb_cGDBM, "closed?", fgdbm_closed, 0);
rb_define_method(rb_cGDBM, "[]", fgdbm_aref, 1);
rb_define_method(rb_cGDBM, "fetch", fgdbm_fetch_m, -1);
rb_define_method(rb_cGDBM, "[]=", fgdbm_store, 2);
diff --git a/ext/gdbm/testgdbm.rb b/ext/gdbm/testgdbm.rb
new file mode 100644
index 0000000000..a435498640
--- /dev/null
+++ b/ext/gdbm/testgdbm.rb
@@ -0,0 +1,663 @@
+require 'runit/testcase'
+require 'runit/cui/testrunner'
+
+if $".grep(/\bgdbm.so\b/).empty?
+ begin
+ require './gdbm'
+ rescue LoadError
+ require 'gdbm'
+ end
+end
+
+def uname_s
+ require 'rbconfig'
+ case Config::CONFIG['host_os']
+ when 'cygwin'
+ require 'Win32API'
+ uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
+ utsname = ' ' * 100
+ raise 'cannot get system name' if uname.call(utsname) == -1
+
+ utsname.unpack('A20' * 5)[0]
+ else
+ Config::CONFIG['host_os']
+ end
+end
+
+SYSTEM = uname_s
+
+class TestGDBM < RUNIT::TestCase
+ def setup
+ @path = "tmptest_gdbm_"
+ assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
+
+ # prepare to make readonly GDBM file
+ GDBM.open("tmptest_gdbm_rdonly", 0400) {|gdbm|
+ gdbm['foo'] = 'FOO'
+ }
+ assert_instance_of(GDBM, @gdbm_rdonly = GDBM.new("tmptest_gdbm_rdonly", nil))
+ end
+ def teardown
+ assert_nil(@gdbm.close)
+ assert_nil(@gdbm_rdonly.close)
+ GC.start
+ File.delete *Dir.glob("tmptest_gdbm*").to_a
+ p Dir.glob("tmptest_gdbm*") if $DEBUG
+ end
+
+ def check_size(expect, gdbm=@gdbm)
+ assert_equals(expect, gdbm.size)
+ n = 0
+ gdbm.each { n+=1 }
+ assert_equals(expect, n)
+ if expect == 0
+ assert_equals(true, gdbm.empty?)
+ else
+ assert_equals(false, gdbm.empty?)
+ end
+ end
+
+ def test_version
+ STDERR.print GDBM::VERSION
+ end
+
+ def test_s_new_has_no_block
+ # GDBM.new ignore the block
+ foo = true
+ assert_instance_of(GDBM, gdbm = GDBM.new("tmptest_gdbm") { foo = false })
+ assert_equals(foo, true)
+ assert_nil(gdbm.close)
+ end
+ def test_s_open_create_new
+ return if /^CYGWIN_9/ =~ SYSTEM
+
+ save_mask = File.umask(0)
+ begin
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm"))
+ gdbm.close
+ assert_equals(File.stat("tmptest_gdbm").mode & 0777, 0666)
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm2", 0644))
+ gdbm.close
+ assert_equals(File.stat("tmptest_gdbm2").mode & 0777, 0644)
+ ensure
+ File.umask save_mask
+ end
+ end
+ def test_s_open_no_create
+ # this test is failed on libgdbm 1.8.0
+ assert_nil(gdbm = GDBM.open("tmptest_gdbm", nil))
+ ensure
+ gdbm.close if gdbm
+ end
+ def test_s_open_3rd_arg
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::FAST))
+ gdbm.close
+
+ # gdbm 1.8.0 specific
+ if defined? GDBM::SYNC
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::SYNC))
+ gdbm.close
+ end
+ # gdbm 1.8.0 specific
+ if defined? GDBM::NOLOCK
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::NOLOCK))
+ gdbm.close
+ end
+ end
+ def test_s_open_with_block
+ assert_equals(GDBM.open("tmptest_gdbm") { :foo }, :foo)
+ end
+ def test_s_open_lock
+ fork() {
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ assert_exception(Errno::EWOULDBLOCK) {
+ begin
+ assert_instance_of(GDBM, gdbm2 = GDBM.open("tmptest_gdbm", 0644))
+ rescue Errno::EAGAIN, Errno::EACCES
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ ensure
+ Process.wait
+ end
+ end
+
+=begin
+ # Is it guaranteed on many OS?
+ def test_s_open_lock_one_process
+ # locking on one process
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644))
+ assert_exception(Errno::EWOULDBLOCK) {
+ begin
+ GDBM.open("tmptest_gdbm", 0644)
+ rescue Errno::EAGAIN
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ end
+=end
+
+ def test_s_open_nolock
+ # gdbm 1.8.0 specific
+ if not defined? GDBM::NOLOCK
+ return
+ end
+
+ fork() {
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::NOLOCK))
+ sleep 2
+ }
+ sleep 1
+ begin
+ gdbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ assert_instance_of(GDBM, gdbm2 = GDBM.open("tmptest_gdbm", 0644))
+ }
+ ensure
+ Process.wait
+ gdbm2.close if gdbm2
+ end
+
+ p Dir.glob("tmptest_gdbm*") if $DEBUG
+
+ fork() {
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ gdbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ # this test is failed on Cygwin98 (???)
+ assert_instance_of(GDBM, gdbm2 = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::NOLOCK))
+ }
+ ensure
+ Process.wait
+ gdbm2.close if gdbm2
+ end
+ end
+
+ def test_s_open_error
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0))
+ assert_exception(Errno::EACCES) {
+ GDBM.open("tmptest_gdbm", 0)
+ }
+ gdbm.close
+ end
+
+ def test_close
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm"))
+ assert_nil(gdbm.close)
+
+ # closed GDBM file
+ assert_exception(RuntimeError) { gdbm.close }
+ end
+
+ def test_aref
+ assert_equals('bar', @gdbm['foo'] = 'bar')
+ assert_equals('bar', @gdbm['foo'])
+
+ assert_nil(@gdbm['bar'])
+ end
+
+ def test_fetch
+ assert_equals('bar', @gdbm['foo']='bar')
+ assert_equals('bar', @gdbm.fetch('foo'))
+
+ # key not found
+ assert_exception(IndexError) {
+ @gdbm.fetch('bar')
+ }
+
+ # test for `ifnone' arg
+ assert_equals('baz', @gdbm.fetch('bar', 'baz'))
+
+ # test for `ifnone' block
+ assert_equals('foobar', @gdbm.fetch('bar') {|key| 'foo' + key })
+ end
+
+ def test_aset
+ num = 0
+ 2.times {|i|
+ assert_equals('foo', @gdbm['foo'] = 'foo')
+ assert_equals('foo', @gdbm['foo'])
+ assert_equals('bar', @gdbm['foo'] = 'bar')
+ assert_equals('bar', @gdbm['foo'])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # assign nil
+ assert_equals('', @gdbm['bar'] = '')
+ assert_equals('', @gdbm['bar'])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # empty string
+ assert_equals('', @gdbm[''] = '')
+ assert_equals('', @gdbm[''])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # Fixnum
+ assert_equals('200', @gdbm['100'] = '200')
+ assert_equals('200', @gdbm['100'])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # Big key and value
+ assert_equals('y' * 100, @gdbm['x' * 100] = 'y' * 100)
+ assert_equals('y' * 100, @gdbm['x' * 100])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+ }
+ end
+
+ def test_index
+ assert_equals('bar', @gdbm['foo'] = 'bar')
+ assert_equals('foo', @gdbm.index('bar'))
+ assert_nil(@gdbm['bar'])
+ end
+
+ def test_indexes
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+ assert_equals(values.reverse, @gdbm.indexes(*keys.reverse))
+ end
+
+ def test_values_at
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+ assert_equals(values.reverse, @gdbm.values_at(*keys.reverse))
+ end
+
+ def test_select_with_block
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+ ret = @gdbm.select {|k,v|
+ assert_equals(k.upcase, v)
+ k != "bar"
+ }
+ assert_equals([['baz', 'BAZ'], ['foo', 'FOO']],
+ ret.sort)
+ end
+
+ def test_length
+ num = 10
+ assert_equals(0, @gdbm.size)
+ num.times {|i|
+ i = i.to_s
+ @gdbm[i] = i
+ }
+ assert_equals(num, @gdbm.size)
+
+ @gdbm.shift
+
+ assert_equals(num - 1, @gdbm.size)
+ end
+
+ def test_empty?
+ assert_equals(true, @gdbm.empty?)
+ @gdbm['foo'] = 'FOO'
+ assert_equals(false, @gdbm.empty?)
+ end
+
+ def test_each_pair
+ n = 0
+ @gdbm.each_pair { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ n = 0
+ ret = @gdbm.each_pair {|key, val|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@gdbm, ret)
+ end
+
+ def test_each_value
+ n = 0
+ @gdbm.each_value { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ n = 0
+ ret = @gdbm.each_value {|val|
+ assert_not_nil(key = @gdbm.index(val))
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@gdbm, ret)
+ end
+
+ def test_each_key
+ n = 0
+ @gdbm.each_key { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ n = 0
+ ret = @gdbm.each_key {|key|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(@gdbm[key], values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@gdbm, ret)
+ end
+
+ def test_keys
+ assert_equals([], @gdbm.keys)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ assert_equals(keys.sort, @gdbm.keys.sort)
+ assert_equals(values.sort, @gdbm.values.sort)
+ end
+
+ def test_values
+ test_keys
+ end
+
+ def test_shift
+ assert_nil(@gdbm.shift)
+ assert_equals(0, @gdbm.size)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ ret_keys = []
+ ret_values = []
+ while ret = @gdbm.shift
+ ret_keys.push ret[0]
+ ret_values.push ret[1]
+
+ assert_equals(keys.size - ret_keys.size, @gdbm.size)
+ end
+
+ assert_equals(keys.sort, ret_keys.sort)
+ assert_equals(values.sort, ret_values.sort)
+ end
+
+ def test_delete
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ key = keys[1]
+
+ assert_nil(@gdbm.delete(key))
+ assert_equals(0, @gdbm.size)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ assert_equals('BAR', @gdbm.delete(key))
+ assert_nil(@gdbm[key])
+ assert_equals(2, @gdbm.size)
+
+ assert_nil(@gdbm.delete(key))
+
+ if /^CYGWIN_9/ !~ SYSTEM
+ assert_exception(GDBMError) {
+ @gdbm_rdonly.delete("foo")
+ }
+
+ assert_nil(@gdbm_rdonly.delete("bar"))
+ end
+ end
+ def test_delete_with_block
+ key = 'no called block'
+ @gdbm[key] = 'foo'
+ assert_equals('foo', @gdbm.delete(key) {|k| k.replace 'called block'})
+ assert_equals('no called block', key)
+ assert_equals(0, @gdbm.size)
+
+ key = 'no called block'
+ assert_equals(:blockval,
+ @gdbm.delete(key) {|k| k.replace 'called block'; :blockval})
+ assert_equals('called block', key)
+ assert_equals(0, @gdbm.size)
+ end
+
+ def test_delete_if
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+
+ ret = @gdbm.delete_if {|key, val| key.to_i < 50}
+ assert_equals(@gdbm, ret)
+ check_size(50, @gdbm)
+
+ ret = @gdbm.delete_if {|key, val| key.to_i >= 50}
+ assert_equals(@gdbm, ret)
+ check_size(0, @gdbm)
+
+ # break
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+ check_size(100, @gdbm)
+ n = 0;
+ @gdbm.delete_if {|key, val|
+ break if n > 50
+ n+=1
+ true
+ }
+ assert_equals(51, n)
+ check_size(49, @gdbm)
+
+ @gdbm.clear
+
+ # raise
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+ check_size(100, @gdbm)
+ n = 0;
+ begin
+ @gdbm.delete_if {|key, val|
+ raise "runtime error" if n > 50
+ n+=1
+ true
+ }
+ rescue
+ end
+ assert_equals(51, n)
+ check_size(49, @gdbm)
+ end
+
+ def test_reject
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+
+ hash = @gdbm.reject {|key, val| key.to_i < 50}
+ assert_instance_of(Hash, hash)
+ assert_equals(100, @gdbm.size)
+
+ assert_equals(50, hash.size)
+ hash.each_pair {|key,val|
+ assert_equals(false, key.to_i < 50)
+ assert_equals(key, val)
+ }
+
+ hash = @gdbm.reject {|key, val| key.to_i < 100}
+ assert_instance_of(Hash, hash)
+ assert_equals(true, hash.empty?)
+ end
+
+ def test_clear
+ v = "1"
+ 100.times {v = v.next; @gdbm[v] = v}
+
+ assert_equals(@gdbm, @gdbm.clear)
+
+ # validate GDBM#size
+ i = 0
+ @gdbm.each { i += 1 }
+ assert_equals(@gdbm.size, i)
+ assert_equals(0, i)
+ end
+
+ def test_invert
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+
+ hash = @gdbm.invert
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_update
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @gdbm["101"] = "101"
+ @gdbm.update hash
+ assert_equals(101, @gdbm.size)
+ @gdbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_replace
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @gdbm["101"] = "101"
+ @gdbm.replace hash
+ assert_equals(100, @gdbm.size)
+ @gdbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_reorganize
+ size1 = File.size(@path)
+ i = "1"
+ 1000.times {i = i.next; @gdbm[i] = i}
+ @gdbm.clear
+ @gdbm.sync
+
+ size2 = File.size(@path)
+ @gdbm.reorganize
+ size3 = File.size(@path)
+
+ # p [size1, size2, size3]
+ assert_equals(true, size1 < size2)
+ # this test is failed on Cygwin98. `GDBM version 1.8.0, as of May 19, 1999'
+ assert_equals(true, size3 < size2)
+ assert_equals(size1, size3)
+ end
+
+ def test_sync
+ assert_instance_of(GDBM, gdbm = GDBM.open('tmptest_gdbm', 0666, GDBM::FAST))
+ assert_equals(gdbm.sync, gdbm)
+ gdbm.close
+ assert_instance_of(GDBM, gdbm = GDBM.open('tmptest_gdbm', 0666))
+ assert_equals(gdbm.sync, gdbm)
+ gdbm.close
+ end
+
+ def test_cachesize=
+ assert_equals(@gdbm.cachesize = 1024, 1024)
+ end
+
+ def test_fastmode=
+ assert_equals(@gdbm.fastmode = true, true)
+ end
+
+ def test_syncmode=
+ assert_equals(@gdbm.syncmode = true, true)
+ end
+
+ def test_haskey?
+ assert_equals('bar', @gdbm['foo']='bar')
+ assert_equals(true, @gdbm.has_key?('foo'))
+ assert_equals(false, @gdbm.has_key?('bar'))
+ end
+
+ def test_has_value?
+ assert_equals('bar', @gdbm['foo']='bar')
+ assert_equals(true, @gdbm.has_value?('bar'))
+ assert_equals(false, @gdbm.has_value?('foo'))
+ end
+
+ def test_to_a
+ v = "0"
+ 100.times {v = v.next; @gdbm[v] = v}
+
+ ary = @gdbm.to_a
+ assert_instance_of(Array, ary)
+ assert_equals(100, ary.size)
+ ary.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_to_hash
+ v = "0"
+ 100.times {v = v.next; @gdbm[v] = v}
+
+ hash = @gdbm.to_hash
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+end
+
+if $0 == __FILE__
+ if ARGV.size == 0
+ suite = RUNIT::TestSuite.new
+ suite.add_test(TestGDBM.suite)
+ else
+ suite = RUNIT::TestSuite.new
+ ARGV.each do |testmethod|
+ suite.add_test(TestGDBM.new(testmethod))
+ end
+ end
+
+ RUNIT::CUI::TestRunner.run(suite)
+end
diff --git a/ext/iconv/charset_alias.rb b/ext/iconv/charset_alias.rb
index aed4644290..65fd41759b 100644
--- a/ext/iconv/charset_alias.rb
+++ b/ext/iconv/charset_alias.rb
@@ -1,12 +1,11 @@
#! /usr/bin/ruby
# :stopdoc:
require 'rbconfig'
-require 'optparse'
# http://www.ctan.org/tex-archive/macros/texinfo/texinfo/intl/config.charset
# Fri, 30 May 2003 00:09:00 GMT'
-OS = Config::CONFIG["target_os"]
+OS = Config::CONFIG["target"]
SHELL = Config::CONFIG['SHELL']
class Hash::Ordered < Hash
@@ -15,89 +14,39 @@ class Hash::Ordered < Hash
end
def []=(key, val)
ary = fetch(key) {return super(key, [self.size, key, val])} and
- ary << val
+ ary.last = val
end
- def sort
- values.sort.collect {|i, *rest| rest}
- end
- def each(&block)
- sort.each(&block)
+ def each
+ values.sort.each {|i, key, val| yield key, val}
end
end
def charset_alias(config_charset, mapfile, target = OS)
map = Hash::Ordered.new
comments = []
- open(config_charset) do |input|
- input.find {|line| /^case "\$os" in/ =~ line} or break
- input.find {|line|
- /^\s*([-\w\*]+(?:\s*\|\s*[-\w\*]+)*)(?=\))/ =~ line and
- $&.split('|').any? {|pattern| File.fnmatch?(pattern.strip, target)}
- } or break
- input.find do |line|
- case line
- when /^\s*echo "(?:\$\w+\.)?([-\w*]+)\s+([-\w]+)"/
- sys, can = $1, $2
- can.downcase!
- map[can] = sys
- false
- when /^\s*;;/
- true
- else
- false
- end
- end
+ IO.foreach("|#{SHELL} #{config_charset} #{target}") do |list|
+ next comments << list if /^\#/ =~ list
+ next unless /^(\S+)\s+(\S+)$/ =~ list
+ sys, can = $1, $2
+ can.downcase!
+ map[can] = sys
end
case target
when /linux|-gnu/
- # map.delete('ascii')
- when /cygwin|os2-emx/
+ map.delete('ascii')
+ when /cygwin/
# get rid of tilde/yen problem.
map['shift_jis'] = 'cp932'
end
- st = Hash.new(0)
- map = map.sort.collect do |can, *sys|
- if sys.grep(/^en_us(?=.|$)/i) {break true} == true
- noen = %r"^(?!en_us)\w+_\w+#{Regexp.new($')}$"i #"
- sys.reject! {|s| noen =~ s}
- end
- sys = sys.first
- st[sys] += 1
- [can, sys]
- end
- st.delete_if {|sys, i| i == 1}.empty?
- st.keys.each {|sys| st[sys] = nil}
- st.default = nil
- writer = proc do |f|
+ open(mapfile, "w") do |f|
f.puts("require 'iconv.so'")
f.puts
f.puts(comments)
f.puts("class Iconv")
- i = 0
- map.each do |can, sys|
- if s = st[sys]
- sys = s
- elsif st.key?(sys)
- sys = (st[sys] = "sys#{i+=1}") + " = '#{sys}'.freeze"
- else
- sys = "'#{sys}'.freeze"
- end
- f.puts(" charset_map['#{can}'] = #{sys}")
- end
+ map.each {|can, sys| f.puts(" charset_map['#{can}'.freeze] = '#{sys}'.freeze")}
f.puts("end")
end
- if mapfile
- open(mapfile, "w", &writer)
- else
- writer[STDOUT]
- end
end
-target = OS
-opt = nil
-ARGV.options do |opt|
- opt.banner << " config.status map.rb"
- opt.on("--target OS") {|t| target = t}
- opt.parse! and (1..2) === ARGV.size
-end or abort opt.to_s
-charset_alias(ARGV[0], ARGV[1], target)
+(2..3) === ARGV.size or abort "usage: #$0 config.status map.rb [target]"
+charset_alias(*ARGV)
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb
index a9d0cfb5e6..65ea327950 100644
--- a/ext/iconv/extconf.rb
+++ b/ext/iconv/extconf.rb
@@ -6,7 +6,7 @@ conf = File.exist?(File.join($srcdir, "config.charset"))
conf = with_config("config-charset", enable_config("config-charset", conf))
if have_func("iconv", "iconv.h") or
- have_library("iconv", "iconv", "iconv.h")
+ have_library("iconv", "iconv") {|s| s.sub(/(?=\n\/\*top\*\/)/, "#include <iconv.h>")}
if checking_for("const of iconv() 2nd argument") do
create_tmpsrc(cpp_include("iconv.h") + "---> iconv(cd,0,0,0,0) <---")
src = xpopen(cpp_command("")) {|f|f.read}
@@ -21,22 +21,20 @@ if have_func("iconv", "iconv.h") or
/\bconst\b/ =~ second
end
end
- $defs.push('-DICONV_INPTR_CONST')
+ $defs.push('-DICONV_INPTR_CAST=""')
+ else
+ $defs.push('-DICONV_INPTR_CAST="(char **)"')
end
if conf
prefix = '$(srcdir)'
prefix = $nmake ? "{#{prefix}}" : "#{prefix}/"
- if $extout
- wrapper = "$(RUBYARCHDIR)/iconv.rb"
- else
- wrapper = "./iconv.rb"
- $INSTALLFILES = [[wrapper, "$(RUBYARCHDIR)"]]
- end
+ wrapper = "./iconv.rb"
+ $INSTALLFILES = [[wrapper, "$(RUBYARCHDIR)"]]
if String === conf
require 'uri'
scheme = URI.parse(conf).scheme
else
- conf = "$(srcdir)/config.charset"
+ conf = prefix + "config.charset"
end
$cleanfiles << wrapper
end
@@ -45,7 +43,7 @@ if have_func("iconv", "iconv.h") or
open("Makefile", "a") do |mf|
mf.print("\nall: #{wrapper}\n\n#{wrapper}: #{prefix}charset_alias.rb")
mf.print(" ", conf) unless scheme
- mf.print("\n\t$(RUBY) $(srcdir)/charset_alias.rb #{conf} $@\n")
+ mf.print("\n\t$(RUBY) ", prefix, "charset_alias.rb ", conf, " $@\n")
end
end
end
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 918dd51630..c395373ff2 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -3,8 +3,8 @@
iconv.c -
- $Author: matz $
- $Date: 2005/12/12 00:36:51 $
+ $Author$
+ $Date$
created at: Wed Dec 1 20:28:09 JST 1999
All the files in this distribution are covered under the Ruby's
@@ -83,12 +83,10 @@ struct iconv_env_t
VALUE (*append)_((VALUE, VALUE));
};
-static VALUE rb_eIconvInvalidEncoding;
static VALUE rb_eIconvFailure;
static VALUE rb_eIconvIllegalSeq;
static VALUE rb_eIconvInvalidChar;
static VALUE rb_eIconvOutOfRange;
-static VALUE rb_eIconvBrokenLibrary;
static ID rb_success, rb_failed;
static VALUE iconv_fail _((VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg));
@@ -113,12 +111,6 @@ static VALUE iconv_iconv _((int argc, VALUE *argv, VALUE self));
static VALUE charset_map;
-/*
- * Document-method: charset_map
- * call-seq: Iconv.charset_map
- *
- * Returns the map from canonical name to system dependent name.
- */
static VALUE charset_map_get _((void))
{
return charset_map;
@@ -169,18 +161,10 @@ iconv_create
cd = iconv_open(tocode, fromcode);
}
if (cd == (iconv_t)-1) {
- int inval = errno == EINVAL;
- char *s = inval ? "invalid encoding " : "iconv";
- volatile VALUE msg = rb_str_new(0, strlen(s) + RSTRING(to)->len +
- RSTRING(from)->len + 8);
-
- sprintf(RSTRING(msg)->ptr, "%s(\"%s\", \"%s\")",
- s, RSTRING(to)->ptr, RSTRING(from)->ptr);
- s = RSTRING(msg)->ptr;
- RSTRING(msg)->len = strlen(s);
- if (!inval) rb_sys_fail(s);
- iconv_fail(rb_eIconvInvalidEncoding,
- Qnil, rb_ary_new3(2, to, from), NULL, s);
+ volatile VALUE msg = rb_str_new2("iconv(\"");
+ rb_str_buf_cat2(rb_str_buf_append(msg, to), "\", \"");
+ rb_str_buf_cat2(rb_str_buf_append(msg, from), "\")");
+ rb_sys_fail(StringValuePtr(msg));
}
}
@@ -244,15 +228,7 @@ iconv_try
size_t *outlen;
#endif /* HAVE_PROTOTYPES */
{
-#ifdef ICONV_INPTR_CONST
-#define ICONV_INPTR_CAST
-#else
-#define ICONV_INPTR_CAST (char **)
-#endif
- size_t ret;
-
- errno = 0;
- ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
+ size_t ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
if (ret == (size_t)-1) {
if (!*inlen)
return Qfalse;
@@ -264,8 +240,6 @@ iconv_try
return rb_eIconvIllegalSeq;
case EINVAL:
return rb_eIconvInvalidChar;
- case 0:
- return rb_eIconvBrokenLibrary;
default:
rb_sys_fail("iconv");
}
@@ -530,8 +504,8 @@ iconv_s_allocate
* === Exceptions
*
* TypeError:: if +to+ or +from+ aren't String
- * InvalidEncoding:: if designated converter couldn't find out
- * SystemCallError:: if <tt>iconv_open(3)</tt> fails
+ * ArgumentError:: if designated converter couldn't find out
+ * SystemCallError:: if <tt>iconv_open3</tt> fails
*/
static VALUE
iconv_initialize
@@ -622,7 +596,7 @@ iconv_s_convert
* === Exceptions
*
* Exceptions thrown by Iconv.new, Iconv.open and Iconv#iconv.
- */
+*/
static VALUE
iconv_s_iconv
#ifdef HAVE_PROTOTYPES
@@ -651,9 +625,7 @@ iconv_s_iconv
* Document-method: Iconv::conv
* call-seq: Iconv.iconv(to, from, *strs)
*
- * Shorthand for
- * Iconv.iconv(to, from, str).join
- * See Iconv.iconv.
+ * See Iconv.iconv ???
*/
static VALUE
iconv_s_conv
@@ -683,8 +655,8 @@ iconv_s_conv
* multiple calls of #close are guaranteed to end successfully.
*
* Returns a string containing the byte sequence to change the output buffer to
- * its initial shift state.
- */
+ * its initial shift state. <i>???</i>
+*/
static VALUE
iconv_init_state
#ifdef HAVE_PROTOTYPES
@@ -740,7 +712,7 @@ iconv_finish
* === Examples
*
* See the Iconv documentation.
- */
+*/
static VALUE
iconv_iconv
#ifdef HAVE_PROTOTYPES
@@ -760,7 +732,7 @@ iconv_iconv
return iconv_convert(VALUE2ICONV(cd), str,
NIL_P(n1) ? 0 : NUM2INT(n1),
- NIL_P(n2) ? -1 : NUM2INT(n2),
+ NIL_P(n2) ? -1 : NUM2INT(n2),
NULL);
}
@@ -768,16 +740,22 @@ iconv_iconv
* Document-class: Iconv::Failure
*
* Base attributes for Iconv exceptions.
- */
-
-/*
- * Document-method: success
- * call-seq: success
+ *
+ * === Iconv::Failure#success
*
* Returns string(s) translated successfully until the exception occurred.
* * In the case of failure occurred within Iconv.iconv, returned
* value is an array of strings translated successfully preceding
* failure and the last element is string on the way.
+ *
+ * === Iconv::Failure#failed
+ *
+ * Returns substring of the original string passed to Iconv that starts at the
+ * character caused the exception.
+ *
+ * === Iconv::Failure#inspect
+ *
+ * Returns inspected string like as: #<_class_: _success_, _failed_>
*/
static VALUE
iconv_failure_success
@@ -792,11 +770,7 @@ iconv_failure_success
}
/*
- * Document-method: failed
- * call-seq: failed
- *
- * Returns substring of the original string passed to Iconv that starts at the
- * character caused the exception.
+ * Comment!
*/
static VALUE
iconv_failure_failed
@@ -810,12 +784,6 @@ iconv_failure_failed
return rb_attr_get(self, rb_failed);
}
-/*
- * Document-method: inspect
- * call-seq: inspect
- *
- * Returns inspected string like as: #<_class_: _success_, _failed_>
- */
static VALUE
iconv_failure_inspect
#ifdef HAVE_PROTOTYPES
@@ -837,17 +805,19 @@ iconv_failure_inspect
}
/*
- * Document-class: Iconv::InvalidEncoding
- *
- * Requested coding-system is not available on this system.
- */
-
-/*
* Document-class: Iconv::IllegalSequence
*
* Input conversion stopped due to an input byte that does not belong to
* the input codeset, or the output codeset does not contain the
* character.
+ *
+ * === Superclass
+ *
+ * ArgumentError
+ *
+ * === Included Modules
+ *
+ * Iconv::Failure
*/
/*
@@ -855,19 +825,28 @@ iconv_failure_inspect
*
* Input conversion stopped due to an incomplete character or shift
* sequence at the end of the input buffer.
+ *
+ * === Superclass
+ *
+ * ArgumentError
+ *
+ * === Included Modules
+ *
+ * Iconv::Failure
*/
/*
* Document-class: Iconv::OutOfRange
*
* Iconv library internal error. Must not occur.
- */
-
-/*
- * Document-class: Iconv::BrokenLibrary
*
- * Detected a bug of underlying iconv(3) libray.
- * * returns an error without setting errno properly
+ * === Superclass
+ *
+ * RuntimeError
+ *
+ * === Included Modules
+ *
+ * Iconv::Failure
*/
void
@@ -889,22 +868,18 @@ Init_iconv _((void))
rb_define_method(rb_eIconvFailure, "failed", iconv_failure_failed, 0);
rb_define_method(rb_eIconvFailure, "inspect", iconv_failure_inspect, 0);
- rb_eIconvInvalidEncoding = rb_define_class_under(rb_cIconv, "InvalidEncoding", rb_eArgError);
rb_eIconvIllegalSeq = rb_define_class_under(rb_cIconv, "IllegalSequence", rb_eArgError);
rb_eIconvInvalidChar = rb_define_class_under(rb_cIconv, "InvalidCharacter", rb_eArgError);
rb_eIconvOutOfRange = rb_define_class_under(rb_cIconv, "OutOfRange", rb_eRuntimeError);
- rb_eIconvBrokenLibrary = rb_define_class_under(rb_cIconv, "BrokenLibrary", rb_eRuntimeError);
- rb_include_module(rb_eIconvInvalidEncoding, rb_eIconvFailure);
rb_include_module(rb_eIconvIllegalSeq, rb_eIconvFailure);
rb_include_module(rb_eIconvInvalidChar, rb_eIconvFailure);
rb_include_module(rb_eIconvOutOfRange, rb_eIconvFailure);
- rb_include_module(rb_eIconvBrokenLibrary, rb_eIconvFailure);
rb_success = rb_intern("success");
rb_failed = rb_intern("failed");
- rb_gc_register_address(&charset_map);
charset_map = rb_hash_new();
+ rb_gc_register_address(&charset_map);
rb_define_singleton_method(rb_cIconv, "charset_map", charset_map_get, 0);
}
diff --git a/ext/io/wait/extconf.rb b/ext/io/wait/extconf.rb
index 1352ef202e..ea7dc9f6cf 100644
--- a/ext/io/wait/extconf.rb
+++ b/ext/io/wait/extconf.rb
@@ -3,15 +3,10 @@ target = "io/wait"
unless macro_defined?("DOSISH", "#include <ruby.h>")
fionread = %w[sys/ioctl.h sys/filio.h].find do |h|
- checking_for("FIONREAD") {have_macro("FIONREAD", h)}
+ checking_for("FIONREAD") {macro_defined?("FIONREAD", "#include <#{h}>\n")}
end
if fionread
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
create_makefile(target)
end
-else
- if have_func("rb_w32_ioctlsocket", "ruby.h")
- have_func("rb_w32_is_socket", "ruby.h")
- create_makefile(target)
- end
end
diff --git a/ext/io/wait/lib/nonblock.rb b/ext/io/wait/lib/nonblock.rb
index 2103fdf25b..46511fb40c 100644
--- a/ext/io/wait/lib/nonblock.rb
+++ b/ext/io/wait/lib/nonblock.rb
@@ -20,4 +20,4 @@ class IO
ensure
self.nonblock = nb
end
-end if defined?(Fcntl::F_GETFL)
+end
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index 0e48f705d2..53d5bd7d18 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -2,8 +2,8 @@
io/wait.c -
- $Author: nobu $
- $Date: 2005/07/18 03:24:04 $
+ $Author$
+ $Date$
created at: Tue Aug 28 09:08:06 JST 2001
All the files in this distribution are covered under the Ruby's
@@ -15,24 +15,7 @@
#include "rubyio.h"
#include <sys/types.h>
-#if defined(FIONREAD_HEADER)
#include FIONREAD_HEADER
-#endif
-
-#ifdef HAVE_RB_W32_IOCTLSOCKET
-#define ioctl ioctlsocket
-#define ioctl_arg u_long
-#define ioctl_arg2num(i) ULONG2NUM(i)
-#else
-#define ioctl_arg int
-#define ioctl_arg2num(i) INT2NUM(i)
-#endif
-
-#ifdef HAVE_RB_W32_IS_SOCKET
-#define FIONREAD_POSSIBLE_P(fd) rb_w32_is_socket(fd)
-#else
-#define FIONREAD_POSSIBLE_P(fd) ((fd),Qtrue)
-#endif
static VALUE io_ready_p _((VALUE io));
static VALUE io_wait _((int argc, VALUE *argv, VALUE io));
@@ -58,16 +41,15 @@ io_ready_p(io)
{
OpenFile *fptr;
FILE *fp;
- ioctl_arg n;
+ int n;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
- if (!FIONREAD_POSSIBLE_P(fileno(fptr->f))) return Qfalse;
fp = fptr->f;
if (feof(fp)) return Qfalse;
if (rb_read_pending(fp)) return Qtrue;
if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0);
- if (n > 0) return ioctl_arg2num(n);
+ if (n > 0) return INT2NUM(n);
return Qnil;
}
@@ -87,8 +69,7 @@ io_wait(argc, argv, io)
OpenFile *fptr;
fd_set rd;
FILE *fp;
- int fd;
- ioctl_arg n;
+ int fd, n;
VALUE timeout;
struct timeval *tp, timerec;
@@ -112,7 +93,6 @@ io_wait(argc, argv, io)
if (rb_thread_select(fd + 1, &rd, NULL, NULL, tp) < 0)
rb_sys_fail(0);
rb_io_check_closed(fptr);
- if (!FIONREAD_POSSIBLE_P(fileno(fptr->f))) return Qfalse;
if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0);
if (n > 0) return io;
return Qnil;
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index 711a3c10a1..1fd28a5a59 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -1,73 +1,82 @@
-#
-# kconv.rb - Kanji Converter.
-#
-# $Id: kconv.rb,v 1.3.6.6 2006/06/19 14:52:54 naruse Exp $
-#
-# ----
-#
-# kconv.rb implements the Kconv class for Kanji Converter. Additionally,
-# some methods in String classes are added to allow easy conversion.
-#
-
require 'nkf'
-#
-# Kanji Converter for Ruby.
-#
module Kconv
- #
- # Public Constants
- #
-
#Constant of Encoding
-
- # Auto-Detect
- AUTO = NKF::AUTO
- # ISO-2022-JP
- JIS = NKF::JIS
- # EUC-JP
- EUC = NKF::EUC
- # Shift_JIS
- SJIS = NKF::SJIS
- # BINARY
- BINARY = NKF::BINARY
- # NOCONV
- NOCONV = NKF::NOCONV
- # ASCII
- ASCII = NKF::ASCII
- # UTF-8
- UTF8 = NKF::UTF8
- # UTF-16
- UTF16 = NKF::UTF16
- # UTF-32
- UTF32 = NKF::UTF32
- # UNKNOWN
- UNKNOWN = NKF::UNKNOWN
-
- #
- # Private Constants
- #
-
- # Revision of kconv.rb
- REVISION = %q$Revision: 1.3.6.6 $
+ AUTO = ::NKF::AUTO
+ JIS = ::NKF::JIS
+ EUC = ::NKF::EUC
+ SJIS = ::NKF::SJIS
+ BINARY = ::NKF::BINARY
+ NOCONV = ::NKF::NOCONV
+ ASCII = ::NKF::ASCII
+ UTF8 = ::NKF::UTF8
+ UTF16 = ::NKF::UTF16
+ UTF32 = ::NKF::UTF32
+ UNKNOWN = ::NKF::UNKNOWN
#Regexp of Encoding
-
- # Regexp of Shift_JIS string (private constant)
+ Iconv_Shift_JIS = /\A(?:
+ [\x00-\x7f\xa1-\xdf] |
+ \x81[\x40-\x7e\x80-\xac\xb8-\xbf\xc8-\xce\xda-\xe8\xf0-\xf7\xfc] |
+ \x82[\x4f-\x58\x60-\x79\x81-\x9a\x9f-\xf1] |
+ \x83[\x40-\x7e\x80-\x96\x9f-\xb6\xbf-\xd6\x40-\x60] |
+ \x84[\x40-\x60\x70-\x7e\x80-\x91\x9f-\xbe\x9f-\xfc] |
+ [\x89-\x8f\x90-\x97\x99-\x9f\xe0-\xea][\x40-\x7e] |
+ [\x89-\x97\x99-\x9f\xe0-\xe9][\x80-\xfc] |
+ \x98[\x40-\x72\x9f-\xfc] |
+ \xea[\x80-\xa4]
+ )*\z/nx
+ Iconv_EUC_JP = /\A(?:
+ [\x00-\x7f] |
+ \x8e [\xa1-\xdf] |
+ \x8f [\xa1-\xdf] [\xa1-\xdf] |
+ [\xa1\xb0-\xbce\xd0-\xf3][\xa1-\xfe] |
+ \xa2[\xa1-\xae\xba-\xc1\xca-\xd0\xdc-\xea\xf2-\xf9\xfe] |
+ \xa3[\xb0-\xb9\xc1-\xda\xe1-\xfa] |
+ \xa4[\xa1-\xf3] |
+ \xa5[\xa1-\xf6] |
+ \xa6[\xa1-\xb8\xc1-\xd8] |
+ \xa7[\xa1-\xc1\xd1-\xf1] |
+ \xa8[\xa1-\xc0] |
+ \xcf[\xa1-\xd3] |
+ \xf4[\xa1-\xa6]
+ )*\z/nx
+ Iconv_UTF8 = /\A(?:\xef\xbb\xbf)?(?:
+ [\x00-\x7f] |
+ \xc2[\x80-\x8d\x90-\x9f\xa1\xaa\xac\xae-\xb1\xb4\xb6\xb8\xba\xbf] |
+ \xc3[\x80-\xbf] |
+ \xc4[\x80-\x93\x96-\xa2\xa4-\xab\xae-\xbf] |
+ \xc5[\x80-\x8d\x90-\xbe] |
+ \xc7[\x8d-\x9c\xb5] |
+ \xcb[\x87\x98-\x9b\x9d] |
+ \xce[\x84-\x86\x88-\x8a\x8c\x8e-\xa1\xa3-\xbf] |
+ \xcf[\x80-\x8e] |
+ \xd0[\x81-\x8c\x8e-\xbf] |
+ \xd1[\x80-\x8f\x91-\x9f] |
+ \xe2\x84[\x83\x96\xa2\xab] |
+ \xe2\x86[\x83\x91-\x93\x96\xa2\xab] |
+ \xe2\x87[\x83\x91-\x94\x96\xa2\xab] |
+ \xe2\x88[\x82-\x83\x87-\x88\x8b\x91-\x94\x96\x9a\x9d-\x9e\xa0\xa2\xa7-\xac\xb4-\xb5\xbd] |
+ \xe2\x89[\x82-\x83\x87-\x88\x8b\x91-\x94\x96\x9a\x9d-\x9e\xa0-\xa2\xa6-\xac\xb4-\xb5\xbd] |
+ \xe2[\x8a\x8c][\x82-\x83\x86-\x88\x8b\x91-\x94\x96\x9a\x9d-\x9e\xa0-\xa2\xa5-\xac\xb4-\xb5\xbd] |
+ \xe2[\x94-\x99][\x81-\x83\x86-\x88\x8b-\x8c\x8f-\x94\x96-\x98\x9a-\x9e\xa0-\xac\xaf-\xb0\xb3-\xb5\xb7-\xb8\xbb-\xbd\xbf] |
+ \xe3\x80[\x81-\x83\x85-\x98\x9a-\x9e\xa0-\xad\xaf-\xb0\xb2-\xb5\xb7-\xb8\xbb-\xbd\xbf] |
+ \xe3[\x81-\x83\xb8-\xbf][\x81-\xbf] |
+ [\xe5-\xe7][\x80-\xbf][\x81-\xbf] |
+ \xe8[\x80-\xae\xb0-\xbf][\x81-\xbf] |
+ \xe9[\x80-\x92\x95-\xb1\xb3-\xbe][\x81-\xbf] |
+ \xef[\xbc-\xbe][\x81-\xbf] |
+ )*\z/nx
RegexpShiftjis = /\A(?:
[\x00-\x7f\xa1-\xdf] |
[\x81-\x9f\xe0-\xfc][\x40-\x7e\x80-\xfc]
)*\z/nx
-
- # Regexp of EUC-JP string (private constant)
RegexpEucjp = /\A(?:
[\x00-\x7f] |
\x8e [\xa1-\xdf] |
- \x8f [\xa1-\xdf] [\xa1-\xfe] |
- [\xa1-\xdf] [\xa1-\xfe]
+ \x8f [\xa1-\xdf] [\xa1-\xdf] |
+ [\xa1-\xdf] [\xa1-\xdf]
)*\z/nx
-
- # Regexp of UTF-8 string (private constant)
RegexpUtf8 = /\A(?:
[\x00-\x7f] |
[\xc2-\xdf] [\x80-\xbf] |
@@ -79,19 +88,9 @@ module Kconv
)*\z/nx
#
- # Public Methods
+ # kconv
#
- # call-seq:
- # Kconv.kconv(str, out_code, in_code = Kconv::AUTO)
- #
- # Convert <code>str</code> to out_code.
- # <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want to decode them, use NKF.nkf.
def kconv(str, out_code, in_code = AUTO)
opt = '-'
case in_code
@@ -102,9 +101,8 @@ module Kconv
when ::NKF::SJIS
opt << 'S'
when ::NKF::UTF8
- opt << 'W'
when ::NKF::UTF16
- opt << 'W16'
+ opt << 'W'
end
case out_code
@@ -115,9 +113,8 @@ module Kconv
when ::NKF::SJIS
opt << 's'
when ::NKF::UTF8
- opt << 'w'
when ::NKF::UTF16
- opt << 'w16'
+ opt << 'w'
when ::NKF::NOCONV
return str
end
@@ -132,73 +129,28 @@ module Kconv
# Encode to
#
- # call-seq:
- # Kconv.tojis(str) -> string
- #
- # Convert <code>str</code> to ISO-2022-JP
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-jxm0', str).
def tojis(str)
- ::NKF::nkf('-jm', str)
+ ::NKF::nkf('-j', str)
end
module_function :tojis
- # call-seq:
- # Kconv.toeuc(str) -> string
- #
- # Convert <code>str</code> to EUC-JP
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-exm0', str).
def toeuc(str)
- ::NKF::nkf('-em0', str)
+ ::NKF::nkf('-e', str)
end
module_function :toeuc
- # call-seq:
- # Kconv.tosjis(str) -> string
- #
- # Convert <code>str</code> to Shift_JIS
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-sxm0', str).
def tosjis(str)
- ::NKF::nkf('-sm', str)
+ ::NKF::nkf('-s', str)
end
module_function :tosjis
- # call-seq:
- # Kconv.toutf8(str) -> string
- #
- # Convert <code>str</code> to UTF-8
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-wxm0', str).
def toutf8(str)
- ::NKF::nkf('-wm', str)
+ ::NKF::nkf('-w', str)
end
module_function :toutf8
- # call-seq:
- # Kconv.toutf16(str) -> string
- #
- # Convert <code>str</code> to UTF-16
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-w16xm0', str).
def toutf16(str)
- ::NKF::nkf('-w16m', str)
+ ::NKF::nkf('-w16', str)
end
module_function :toutf16
@@ -206,21 +158,13 @@ module Kconv
# guess
#
- # call-seq:
- # Kconv.guess(str) -> integer
- #
- # Guess input encoding by NKF.guess2
def guess(str)
::NKF::guess(str)
end
module_function :guess
- # call-seq:
- # Kconv.guess_old(str) -> integer
- #
- # Guess input encoding by NKF.guess1
def guess_old(str)
- ::NKF::guess1(str)
+ ::NKF::guess_old(str)
end
module_function :guess_old
@@ -228,34 +172,16 @@ module Kconv
# isEncoding
#
- # call-seq:
- # Kconv.iseuc(str) -> obj or nil
- #
- # Returns whether input encoding is EUC-JP or not.
- #
- # *Note* don't expect this return value is MatchData.
def iseuc(str)
RegexpEucjp.match( str )
end
module_function :iseuc
- # call-seq:
- # Kconv.issjis(str) -> obj or nil
- #
- # Returns whether input encoding is Shift_JIS or not.
- #
- # *Note* don't expect this return value is MatchData.
def issjis(str)
RegexpShiftjis.match( str )
end
module_function :issjis
- # call-seq:
- # Kconv.isutf8(str) -> obj or nil
- #
- # Returns whether input encoding is UTF-8 or not.
- #
- # *Note* don't expect this return value is MatchData.
def isutf8(str)
RegexpUtf8.match( str )
end
@@ -264,104 +190,37 @@ module Kconv
end
class String
- # call-seq:
- # String#kconv(out_code, in_code = Kconv::AUTO)
- #
- # Convert <code>self</code> to out_code.
- # <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want to decode them, use NKF.nkf.
def kconv(out_code, in_code=Kconv::AUTO)
Kconv::kconv(self, out_code, in_code)
end
- #
# to Encoding
- #
+ def tojis
+ ::NKF::nkf('-j', self)
+ end
+ def toeuc
+ ::NKF::nkf('-e', self)
+ end
+ def tosjis
+ ::NKF::nkf('-s', self)
+ end
+ def toutf8
+ ::NKF::nkf('-w', self)
+ end
+ def toutf16
+ ::NKF::nkf('-w16', self)
+ end
- # call-seq:
- # String#tojis -> string
- #
- # Convert <code>self</code> to ISO-2022-JP
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-jxm0', str).
- def tojis; Kconv.tojis(self) end
-
- # call-seq:
- # String#toeuc -> string
- #
- # Convert <code>self</code> to EUC-JP
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-exm0', str).
- def toeuc; Kconv.toeuc(self) end
-
- # call-seq:
- # String#tosjis -> string
- #
- # Convert <code>self</code> to Shift_JIS
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-sxm0', str).
- def tosjis; Kconv.tosjis(self) end
-
- # call-seq:
- # String#toutf8 -> string
- #
- # Convert <code>self</code> to UTF-8
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-wxm0', str).
- def toutf8; Kconv.toutf8(self) end
-
- # call-seq:
- # String#toutf16 -> string
- #
- # Convert <code>self</code> to UTF-16
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want it, use NKF.nkf('-w16xm0', str).
- def toutf16; Kconv.toutf16(self) end
-
- #
# is Encoding
- #
-
- # call-seq:
- # String#iseuc -> obj or nil
- #
- # Returns whether <code>self</code>'s encoding is EUC-JP or not.
- #
- # *Note* don't expect this return value is MatchData.
- def iseuc; Kconv.iseuc(self) end
+ def iseuc
+ Kconv.iseuc( self )
+ end
- # call-seq:
- # String#issjis -> obj or nil
- #
- # Returns whether <code>self</code>'s encoding is Shift_JIS or not.
- #
- # *Note* don't expect this return value is MatchData.
- def issjis; Kconv.issjis(self) end
+ def issjis
+ Kconv.issjis( self )
+ end
- # call-seq:
- # String#isutf8 -> obj or nil
- #
- # Returns whether <code>self</code>'s encoding is UTF-8 or not.
- #
- # *Note* don't expect this return value is MatchData.
- def isutf8; Kconv.isutf8(self) end
+ def isutf8
+ Kconv.isutf8( self )
+ end
end
diff --git a/ext/nkf/nkf-utf8/config.h b/ext/nkf/nkf-utf8/config.h
index 9da82c6aee..0f202baafd 100644
--- a/ext/nkf/nkf-utf8/config.h
+++ b/ext/nkf/nkf-utf8/config.h
@@ -24,9 +24,6 @@
/* --debug, --no-output $B%*%W%7%g%s(B */
#define CHECK_OPTION
-/* JIS X0212 */
-#define X0212_ENABLE
-
/* --exec-in, --exec-out $B%*%W%7%g%s(B
* pipe, fork, execvp $B$"$?$j$,L5$$$HF0$-$^$;$s!#(B
* MS-DOS, MinGW $B$J$I$G$O(B undef $B$K$7$F$/$@$5$$(B
@@ -43,19 +40,6 @@
*/
/* #define INT_IS_SHORT */
-
-#if defined(INT_IS_SHORT)
-typedef long nkf_char;
-typedef unsigned char nkf_nfchar;
-#else
-typedef int nkf_char;
-typedef int nkf_nfchar;
-#endif
-
-/* Unicode Normalization */
-#define UNICODE_NORMALIZATION
-
-#ifndef WIN32DLL
/******************************/
/* $B%G%U%)%k%H$N=PNO%3!<%IA*Br(B */
/* Select DEFAULT_CODE */
@@ -64,25 +48,5 @@ typedef int nkf_nfchar;
/* #define DEFAULT_CODE_EUC */
/* #define DEFAULT_CODE_UTF8 */
/******************************/
-#else
-#define DEFAULT_CODE_SJIS
-#endif
-
-#if defined(NUMCHAR_OPTION) && !defined(UTF8_INPUT_ENABLE)
-#define UTF8_INPUT_ENABLE
-#endif
-
-#ifdef UNICODE_NORMALIZATION
-#ifndef UTF8_INPUT_ENABLE
-#define UTF8_INPUT_ENABLE
-#endif
-#define NORMALIZATION_TABLE_LENGTH 942
-#define NORMALIZATION_TABLE_NFC_LENGTH 3
-#define NORMALIZATION_TABLE_NFD_LENGTH 9
-struct normalization_pair{
- const nkf_nfchar nfc[NORMALIZATION_TABLE_NFC_LENGTH];
- const nkf_nfchar nfd[NORMALIZATION_TABLE_NFD_LENGTH];
-};
-#endif
#endif /* _CONFIG_H_ */
diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c
index 0d82562326..5fa1956bf9 100644
--- a/ext/nkf/nkf-utf8/nkf.c
+++ b/ext/nkf/nkf-utf8/nkf.c
@@ -39,15 +39,13 @@
** E-Mail: furukawa@tcp-ip.or.jp
** $B$^$G8fO"Mm$r$*4j$$$7$^$9!#(B
***********************************************************************/
-/* $Id: nkf.c,v 1.2.2.11 2006/06/19 14:52:55 naruse Exp $ */
-#define NKF_VERSION "2.0.7"
-#define NKF_RELEASE_DATE "2006-06-13"
+/* $Id$ */
+#define NKF_VERSION "2.0.4"
+#define NKF_RELEASE_DATE "2004-12-01"
#include "config.h"
-#include "utf8tbl.h"
-#define COPY_RIGHT \
- "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW\n" \
- "Copyright (C) 2002-2006 Kono, Furukawa, Naruse, mastodon"
+static char *CopyRight =
+ "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW, 2002-2004 Kono, Furukawa";
/*
@@ -97,7 +95,7 @@
**
**/
-#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS)
+#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__)) && !defined(MSDOS)
#define MSDOS
#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
#define __WIN32__
@@ -113,40 +111,22 @@
#endif
#include <stdlib.h>
-#include <string.h>
-#if defined(MSDOS) || defined(__OS2__)
+#if defined(MSDOS) || defined(__OS2__)
#include <fcntl.h>
#include <io.h>
-#if defined(_MSC_VER) || defined(__WATCOMC__)
-#define mktemp _mktemp
-#endif
#endif
#ifdef MSDOS
#ifdef LSI_C
#define setbinmode(fp) fsetbin(fp)
-#elif defined(__DJGPP__)
-#include <libc/dosio.h>
-#define setbinmode(fp) djgpp_setbinmode(fp)
#else /* Microsoft C, Turbo C */
#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
#endif
-#else /* UNIX */
+#else /* UNIX,OS/2 */
#define setbinmode(fp)
#endif
-#if defined(__DJGPP__)
-void djgpp_setbinmode(FILE *fp)
-{
- /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */
- int fd, m;
- fd = fileno(fp);
- m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY;
- __file_handle_set(fd, m);
-}
-#endif
-
#ifdef _IOFBF /* SysV and MSDOS, Windows */
#define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size)
#else /* BSD */
@@ -164,33 +144,23 @@ void djgpp_setbinmode(FILE *fp)
#ifdef OVERWRITE
/* added by satoru@isoternet.org */
-#if defined(__EMX__)
-#include <sys/types.h>
-#endif
+#include <string.h>
#include <sys/stat.h>
-#if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */
+#ifndef MSDOS /* UNIX, OS/2 */
#include <unistd.h>
-#if defined(__WATCOMC__)
-#include <sys/utime.h>
-#else
#include <utime.h>
-#endif
-#else /* defined(MSDOS) */
-#ifdef __WIN32__
-#ifdef __BORLANDC__ /* BCC32 */
-#include <utime.h>
-#else /* !defined(__BORLANDC__) */
-#include <sys/utime.h>
-#endif /* (__BORLANDC__) */
-#else /* !defined(__WIN32__) */
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__) /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */
+#else
+#if defined(_MSC_VER) || defined(__MINGW32__) /* VC++, MinGW */
#include <sys/utime.h>
#elif defined(__TURBOC__) /* BCC */
#include <utime.h>
#elif defined(LSI_C) /* LSI C */
-#endif /* (__WIN32__) */
#endif
#endif
+#endif
+
+#ifdef INT_IS_SHORT
+#define int long
#endif
#define FALSE 0
@@ -212,9 +182,6 @@ void djgpp_setbinmode(FILE *fp)
#define X0201 2
#define ISO8859_1 8
#define NO_X0201 3
-#define X0212 0x2844
-#define X0213_1 0x284F
-#define X0213_2 0x2850
/* Input Assumption */
@@ -232,8 +199,8 @@ void djgpp_setbinmode(FILE *fp)
#define UTF8 12
#define UTF8_INPUT 13
-#define UTF16BE_INPUT 14
-#define UTF16LE_INPUT 15
+#define UTF16LE_INPUT 14
+#define UTF16BE_INPUT 15
#define WISH_TRUE 15
@@ -256,34 +223,8 @@ void djgpp_setbinmode(FILE *fp)
#define is_alnum(c) \
(('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9'))
-/* I don't trust portablity of toupper */
-#define nkf_toupper(c) (('a'<=c && c<='z')?(c-('a'-'A')):c)
-#define nkf_isoctal(c) ('0'<=c && c<='7')
-#define nkf_isdigit(c) ('0'<=c && c<='9')
-#define nkf_isxdigit(c) (nkf_isdigit(c) || ('a'<=c && c<='f') || ('A'<=c && c <= 'F'))
-#define nkf_isblank(c) (c == SPACE || c == TAB)
-#define nkf_isspace(c) (nkf_isblank(c) || c == CR || c == NL)
-#define nkf_isalpha(c) (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))
-#define nkf_isalnum(c) (nkf_isdigit(c) || nkf_isalpha(c))
-#define nkf_isprint(c) (' '<=c && c<='~')
-#define nkf_isgraph(c) ('!'<=c && c<='~')
-#define hex2bin(c) (('0'<=c&&c<='9') ? (c-'0') : \
- ('A'<=c&&c<='F') ? (c-'A'+10) : \
- ('a'<=c&&c<='f') ? (c-'a'+10) : 0 )
-#define is_eucg3(c2) (((unsigned short)c2 >> 8) == SS3)
-
-#define CP932_TABLE_BEGIN 0xFA
-#define CP932_TABLE_END 0xFC
-#define CP932INV_TABLE_BEGIN 0xED
-#define CP932INV_TABLE_END 0xEE
-#define is_ibmext_in_sjis(c2) (CP932_TABLE_BEGIN <= c2 && c2 <= CP932_TABLE_END)
-
#define HOLD_SIZE 1024
-#if defined(INT_IS_SHORT)
-#define IOBUF_SIZE 2048
-#else
#define IOBUF_SIZE 16384
-#endif
#define DEFAULT_J 'B'
#define DEFAULT_R 'B'
@@ -296,146 +237,114 @@ void djgpp_setbinmode(FILE *fp)
#define GETA2 0x2e
-#if defined(UTF8_OUTPUT_ENABLE) || defined(UTF8_INPUT_ENABLE)
+#if defined( UTF8_OUTPUT_ENABLE ) || defined( UTF8_INPUT_ENABLE )
+#define sizeof_euc_utf8 94
#define sizeof_euc_to_utf8_1byte 94
#define sizeof_euc_to_utf8_2bytes 94
#define sizeof_utf8_to_euc_C2 64
#define sizeof_utf8_to_euc_E5B8 64
#define sizeof_utf8_to_euc_2bytes 112
-#define sizeof_utf8_to_euc_3bytes 16
+#define sizeof_utf8_to_euc_3bytes 112
#endif
/* MIME preprocessor */
+
#ifdef EASYWIN /*Easy Win */
extern POINT _BufferSize;
#endif
+/* function prototype */
+
+#ifdef ANSI_C_PROTOTYPE
+#define PROTO(x) x
+#define STATIC static
+#else
+#define PROTO(x) ()
+#define STATIC
+#endif
+
struct input_code{
char *name;
- nkf_char stat;
- nkf_char score;
- nkf_char index;
- nkf_char buf[3];
- void (*status_func)(struct input_code *, nkf_char);
- nkf_char (*iconv_func)(nkf_char c2, nkf_char c1, nkf_char c0);
+ int stat;
+ int score;
+ int index;
+ int buf[3];
+ void (*status_func)PROTO((struct input_code *, int));
+ int (*iconv_func)PROTO((int c2, int c1, int c0));
int _file_stat;
};
-static char *input_codename = "";
+STATIC char *input_codename = "";
-#ifndef PERL_XS
-static const char *CopyRight = COPY_RIGHT;
-#endif
-#if !defined(PERL_XS) && !defined(WIN32DLL)
-static nkf_char noconvert(FILE *f);
-#endif
-static void module_connection(void);
-static nkf_char kanji_convert(FILE *f);
-static nkf_char h_conv(FILE *f,nkf_char c2,nkf_char c1);
-static nkf_char push_hold_buf(nkf_char c2);
-static void set_iconv(nkf_char f, nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0));
-static nkf_char s_iconv(nkf_char c2,nkf_char c1,nkf_char c0);
-static nkf_char s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1);
-static nkf_char e_iconv(nkf_char c2,nkf_char c1,nkf_char c0);
-#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
-/* UCS Mapping
- * 0: Shift_JIS, eucJP-ascii
- * 1: eucJP-ms
- * 2: CP932, CP51932
- */
-#define UCS_MAP_ASCII 0
-#define UCS_MAP_MS 1
-#define UCS_MAP_CP932 2
-static int ms_ucs_map_f = UCS_MAP_ASCII;
-#endif
+STATIC int noconvert PROTO((FILE *f));
+STATIC int kanji_convert PROTO((FILE *f));
+STATIC int h_conv PROTO((FILE *f,int c2,int c1));
+STATIC int push_hold_buf PROTO((int c2));
+STATIC void set_iconv PROTO((int f, int (*iconv_func)()));
+STATIC int s_iconv PROTO((int c2,int c1,int c0));
+STATIC int s2e_conv PROTO((int c2, int c1, int *p2, int *p1));
+STATIC int e_iconv PROTO((int c2,int c1,int c0));
#ifdef UTF8_INPUT_ENABLE
-/* no NEC special, NEC-selected IBM extended and IBM extended characters */
-static int no_cp932ext_f = FALSE;
-/* ignore ZERO WIDTH NO-BREAK SPACE */
-static int ignore_zwnbsp_f = TRUE;
-static int no_best_fit_chars_f = FALSE;
-static nkf_char unicode_subchar = '?'; /* the regular substitution character */
-static void nkf_each_char_to_hex(void (*f)(nkf_char c2,nkf_char c1), nkf_char c);
-static void encode_fallback_html(nkf_char c);
-static void encode_fallback_xml(nkf_char c);
-static void encode_fallback_java(nkf_char c);
-static void encode_fallback_perl(nkf_char c);
-static void encode_fallback_subchar(nkf_char c);
-static void (*encode_fallback)(nkf_char c) = NULL;
-static nkf_char w2e_conv(nkf_char c2,nkf_char c1,nkf_char c0,nkf_char *p2,nkf_char *p1);
-static nkf_char w_iconv(nkf_char c2,nkf_char c1,nkf_char c0);
-static nkf_char w_iconv16(nkf_char c2,nkf_char c1,nkf_char c0);
-static nkf_char unicode_to_jis_common(nkf_char c2,nkf_char c1,nkf_char c0,nkf_char *p2,nkf_char *p1);
-static nkf_char w_iconv_common(nkf_char c1,nkf_char c0,const unsigned short *const *pp,nkf_char psize,nkf_char *p2,nkf_char *p1);
-static void w16w_conv(nkf_char val, nkf_char *p2, nkf_char *p1, nkf_char *p0);
-static nkf_char ww16_conv(nkf_char c2, nkf_char c1, nkf_char c0);
-static nkf_char w16e_conv(nkf_char val,nkf_char *p2,nkf_char *p1);
+STATIC int w2e_conv PROTO((int c2,int c1,int c0,int *p2,int *p1));
+STATIC int w_iconv PROTO((int c2,int c1,int c0));
+STATIC int w_iconv16 PROTO((int c2,int c1,int c0));
+STATIC int w_iconv_common PROTO((int c1,int c0,unsigned short **pp,int psize,int *p2,int *p1));
+STATIC int ww16_conv PROTO((int c2, int c1, int c0));
#endif
#ifdef UTF8_OUTPUT_ENABLE
-static int unicode_bom_f= 0; /* Output Unicode BOM */
-static int w_oconv16_LE = 0; /* utf-16 little endian */
-static nkf_char e2w_conv(nkf_char c2,nkf_char c1);
-static void w_oconv(nkf_char c2,nkf_char c1);
-static void w_oconv16(nkf_char c2,nkf_char c1);
-#endif
-static void e_oconv(nkf_char c2,nkf_char c1);
-static nkf_char e2s_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1);
-static void s_oconv(nkf_char c2,nkf_char c1);
-static void j_oconv(nkf_char c2,nkf_char c1);
-static void fold_conv(nkf_char c2,nkf_char c1);
-static void cr_conv(nkf_char c2,nkf_char c1);
-static void z_conv(nkf_char c2,nkf_char c1);
-static void rot_conv(nkf_char c2,nkf_char c1);
-static void hira_conv(nkf_char c2,nkf_char c1);
-static void base64_conv(nkf_char c2,nkf_char c1);
-static void iso2022jp_check_conv(nkf_char c2,nkf_char c1);
-static void no_connection(nkf_char c2,nkf_char c1);
-static nkf_char no_connection2(nkf_char c2,nkf_char c1,nkf_char c0);
-
-static void code_score(struct input_code *ptr);
-static void code_status(nkf_char c);
-
-static void std_putc(nkf_char c);
-static nkf_char std_getc(FILE *f);
-static nkf_char std_ungetc(nkf_char c,FILE *f);
-
-static nkf_char broken_getc(FILE *f);
-static nkf_char broken_ungetc(nkf_char c,FILE *f);
-
-static nkf_char mime_begin(FILE *f);
-static nkf_char mime_getc(FILE *f);
-static nkf_char mime_ungetc(nkf_char c,FILE *f);
-
-static void switch_mime_getc(void);
-static void unswitch_mime_getc(void);
-static nkf_char mime_begin_strict(FILE *f);
-static nkf_char mime_getc_buf(FILE *f);
-static nkf_char mime_ungetc_buf(nkf_char c,FILE *f);
-static nkf_char mime_integrity(FILE *f,const unsigned char *p);
-
-static nkf_char base64decode(nkf_char c);
-static void mime_prechar(nkf_char c2, nkf_char c1);
-static void mime_putc(nkf_char c);
-static void open_mime(nkf_char c);
-static void close_mime(void);
-static void eof_mime(void);
-static void mimeout_addchar(nkf_char c);
-#ifndef PERL_XS
-static void usage(void);
-static void version(void);
-#endif
-static void options(unsigned char *c);
-#if defined(PERL_XS) || defined(WIN32DLL)
-static void reinit(void);
+STATIC int e2w_conv PROTO((int c2,int c1));
+STATIC void w_oconv PROTO((int c2,int c1));
+STATIC void w_oconv16 PROTO((int c2,int c1));
+#endif
+STATIC void e_oconv PROTO((int c2,int c1));
+STATIC void e2s_conv PROTO((int c2, int c1, int *p2, int *p1));
+STATIC void s_oconv PROTO((int c2,int c1));
+STATIC void j_oconv PROTO((int c2,int c1));
+STATIC void fold_conv PROTO((int c2,int c1));
+STATIC void cr_conv PROTO((int c2,int c1));
+STATIC void z_conv PROTO((int c2,int c1));
+STATIC void rot_conv PROTO((int c2,int c1));
+STATIC void hira_conv PROTO((int c2,int c1));
+STATIC void base64_conv PROTO((int c2,int c1));
+STATIC void iso2022jp_check_conv PROTO((int c2,int c1));
+STATIC void no_connection PROTO((int c2,int c1));
+STATIC int no_connection2 PROTO((int c2,int c1,int c0));
+
+STATIC void code_score PROTO((struct input_code *ptr));
+STATIC void code_status PROTO((int c));
+
+STATIC void std_putc PROTO((int c));
+STATIC int std_getc PROTO((FILE *f));
+STATIC int std_ungetc PROTO((int c,FILE *f));
+
+STATIC int broken_getc PROTO((FILE *f));
+STATIC int broken_ungetc PROTO((int c,FILE *f));
+
+STATIC int mime_begin PROTO((FILE *f));
+STATIC int mime_getc PROTO((FILE *f));
+STATIC int mime_ungetc PROTO((int c,FILE *f));
+
+STATIC int mime_begin_strict PROTO((FILE *f));
+STATIC int mime_getc_buf PROTO((FILE *f));
+STATIC int mime_ungetc_buf PROTO((int c,FILE *f));
+STATIC int mime_integrity PROTO((FILE *f,unsigned char *p));
+
+STATIC int base64decode PROTO((int c));
+STATIC void mime_putc PROTO((int c));
+STATIC void open_mime PROTO((int c));
+STATIC void close_mime PROTO(());
+STATIC void usage PROTO(());
+STATIC void version PROTO(());
+STATIC void options PROTO((unsigned char *c));
+#ifdef PERL_XS
+STATIC void reinit PROTO(());
#endif
/* buffers */
-#if !defined(PERL_XS) && !defined(WIN32DLL)
static unsigned char stdibuf[IOBUF_SIZE];
static unsigned char stdobuf[IOBUF_SIZE];
-#endif
static unsigned char hold_buf[HOLD_SIZE*2];
static int hold_count;
@@ -448,7 +357,6 @@ static unsigned char mime_buf[MIME_BUF_SIZE];
static unsigned int mime_top = 0;
static unsigned int mime_last = 0; /* decoded */
static unsigned int mime_input = 0; /* undecoded */
-static nkf_char (*mime_iconv_back)(nkf_char c2,nkf_char c1,nkf_char c0) = NULL;
/* flags */
static int unbuf_f = FALSE;
@@ -460,7 +368,6 @@ static int hira_f = FALSE; /* hira/kata henkan */
static int input_f = FALSE; /* non fixed input code */
static int alpha_f = FALSE; /* convert JIx0208 alphbet to ASCII */
static int mime_f = STRICT_MIME; /* convert MIME B base64 or Q */
-static int mime_decode_f = FALSE; /* mime decode is explicitly on */
static int mimebuf_f = FALSE; /* MIME buffered input */
static int broken_f = FALSE; /* convert ESC-less broken JIS */
static int iso8859_f = FALSE; /* ISO8859 through */
@@ -471,63 +378,49 @@ static int x0201_f = TRUE; /* Assume JISX0201 kana */
static int x0201_f = NO_X0201; /* Assume NO JISX0201 */
#endif
static int iso2022jp_f = FALSE; /* convert ISO-2022-JP */
+#ifdef UTF8_OUTPUT_ENABLE
+static int unicode_bom_f= 0; /* Output Unicode BOM */
+static int w_oconv16_LE = 0; /* utf-16 little endian */
+static int ms_ucs_map_f = FALSE; /* Microsoft UCS Mapping Compatible */
+#endif
+
+
+#ifdef NUMCHAR_OPTION
-#ifdef UNICODE_NORMALIZATION
-static int nfc_f = FALSE;
-static nkf_char (*i_nfc_getc)(FILE *) = std_getc; /* input of ugetc */
-static nkf_char (*i_nfc_ungetc)(nkf_char c ,FILE *f) = std_ungetc;
-static nkf_char nfc_getc(FILE *f);
-static nkf_char nfc_ungetc(nkf_char c,FILE *f);
+#define CLASS_MASK 0x0f000000
+#define CLASS_UTF16 0x01000000
#endif
#ifdef INPUT_OPTION
static int cap_f = FALSE;
-static nkf_char (*i_cgetc)(FILE *) = std_getc; /* input of cgetc */
-static nkf_char (*i_cungetc)(nkf_char c ,FILE *f) = std_ungetc;
-static nkf_char cap_getc(FILE *f);
-static nkf_char cap_ungetc(nkf_char c,FILE *f);
+static int (*i_cgetc)PROTO((FILE *)) = std_getc; /* input of cgetc */
+static int (*i_cungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+STATIC int cap_getc PROTO((FILE *f));
+STATIC int cap_ungetc PROTO((int c,FILE *f));
static int url_f = FALSE;
-static nkf_char (*i_ugetc)(FILE *) = std_getc; /* input of ugetc */
-static nkf_char (*i_uungetc)(nkf_char c ,FILE *f) = std_ungetc;
-static nkf_char url_getc(FILE *f);
-static nkf_char url_ungetc(nkf_char c,FILE *f);
-#endif
+static int (*i_ugetc)PROTO((FILE *)) = std_getc; /* input of ugetc */
+static int (*i_uungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+STATIC int url_getc PROTO((FILE *f));
+STATIC int url_ungetc PROTO((int c,FILE *f));
-#if defined(INT_IS_SHORT)
-#define NKF_INT32_C(n) (n##L)
-#else
-#define NKF_INT32_C(n) (n)
-#endif
-#define PREFIX_EUCG3 NKF_INT32_C(0x8F00)
-#define CLASS_MASK NKF_INT32_C(0xFF000000)
-#define CLASS_UTF16 NKF_INT32_C(0x01000000)
-#define VALUE_MASK NKF_INT32_C(0x00FFFFFF)
-#define UNICODE_MAX NKF_INT32_C(0x0010FFFF)
-#define is_unicode_capsule(c) ((c & CLASS_MASK) == CLASS_UTF16)
-#define is_unicode_bmp(c) ((c & VALUE_MASK) <= NKF_INT32_C(0xFFFF))
-
-#ifdef NUMCHAR_OPTION
static int numchar_f = FALSE;
-static nkf_char (*i_ngetc)(FILE *) = std_getc; /* input of ugetc */
-static nkf_char (*i_nungetc)(nkf_char c ,FILE *f) = std_ungetc;
-static nkf_char numchar_getc(FILE *f);
-static nkf_char numchar_ungetc(nkf_char c,FILE *f);
+static int (*i_ngetc)PROTO((FILE *)) = std_getc; /* input of ugetc */
+static int (*i_nungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+STATIC int numchar_getc PROTO((FILE *f));
+STATIC int numchar_ungetc PROTO((int c,FILE *f));
#endif
#ifdef CHECK_OPTION
static int noout_f = FALSE;
-static void no_putc(nkf_char c);
-static nkf_char debug_f = FALSE;
-static void debug(const char *str);
-static nkf_char (*iconv_for_check)(nkf_char c2,nkf_char c1,nkf_char c0) = 0;
+STATIC void no_putc PROTO((int c));
+static int debug_f = FALSE;
+STATIC void debug PROTO((char *str));
#endif
static int guess_f = FALSE;
-#if !defined PERL_XS
-static void print_guessed_code(char *filename);
-#endif
-static void set_input_codename(char *codename);
+STATIC void print_guessed_code PROTO((char *filename));
+STATIC void set_input_codename PROTO((char *codename));
static int is_inputcode_mixed = FALSE;
static int is_inputcode_set = FALSE;
@@ -536,48 +429,32 @@ static int exec_f = 0;
#endif
#ifdef SHIFTJIS_CP932
-/* invert IBM extended characters to others */
-static int cp51932_f = TRUE;
+STATIC int cp932_f = TRUE;
+#define CP932_TABLE_BEGIN (0xfa)
+#define CP932_TABLE_END (0xfc)
-/* invert NEC-selected IBM extended characters to IBM extended characters */
-static int cp932inv_f = TRUE;
+STATIC int cp932inv_f = TRUE;
+#define CP932INV_TABLE_BEGIN (0xed)
+#define CP932INV_TABLE_END (0xee)
-/* static nkf_char cp932_conv(nkf_char c2, nkf_char c1); */
#endif /* SHIFTJIS_CP932 */
-#ifdef X0212_ENABLE
-static int x0212_f = FALSE;
-static nkf_char x0212_shift(nkf_char c);
-static nkf_char x0212_unshift(nkf_char c);
-#endif
-static int x0213_f = FALSE;
-
-static unsigned char prefix_table[256];
+STATIC unsigned char prefix_table[256];
-static void set_code_score(struct input_code *ptr, nkf_char score);
-static void clr_code_score(struct input_code *ptr, nkf_char score);
-static void status_disable(struct input_code *ptr);
-static void status_push_ch(struct input_code *ptr, nkf_char c);
-static void status_clear(struct input_code *ptr);
-static void status_reset(struct input_code *ptr);
-static void status_reinit(struct input_code *ptr);
-static void status_check(struct input_code *ptr, nkf_char c);
-static void e_status(struct input_code *, nkf_char);
-static void s_status(struct input_code *, nkf_char);
+STATIC void e_status PROTO((struct input_code *, int));
+STATIC void s_status PROTO((struct input_code *, int));
#ifdef UTF8_INPUT_ENABLE
-static void w_status(struct input_code *, nkf_char);
-static void w16_status(struct input_code *, nkf_char);
-static int utf16_mode = UTF16BE_INPUT;
+STATIC void w_status PROTO((struct input_code *, int));
+STATIC void w16_status PROTO((struct input_code *, int));
+static int utf16_mode = UTF16LE_INPUT;
#endif
struct input_code input_code_list[] = {
{"EUC-JP", 0, 0, 0, {0, 0, 0}, e_status, e_iconv, 0},
{"Shift_JIS", 0, 0, 0, {0, 0, 0}, s_status, s_iconv, 0},
-#ifdef UTF8_INPUT_ENABLE
{"UTF-8", 0, 0, 0, {0, 0, 0}, w_status, w_iconv, 0},
{"UTF-16", 0, 0, 0, {0, 0, 0}, w16_status, w_iconv16, 0},
-#endif
{0}
};
@@ -620,38 +497,38 @@ static int fold_margin = FOLD_MARGIN;
#endif
/* process default */
-static void (*output_conv)(nkf_char c2,nkf_char c1) = DEFAULT_CONV;
+static void (*output_conv)PROTO((int c2,int c1)) = DEFAULT_CONV;
-static void (*oconv)(nkf_char c2,nkf_char c1) = no_connection;
+static void (*oconv)PROTO((int c2,int c1)) = no_connection;
/* s_iconv or oconv */
-static nkf_char (*iconv)(nkf_char c2,nkf_char c1,nkf_char c0) = no_connection2;
+static int (*iconv)PROTO((int c2,int c1,int c0)) = no_connection2;
-static void (*o_zconv)(nkf_char c2,nkf_char c1) = no_connection;
-static void (*o_fconv)(nkf_char c2,nkf_char c1) = no_connection;
-static void (*o_crconv)(nkf_char c2,nkf_char c1) = no_connection;
-static void (*o_rot_conv)(nkf_char c2,nkf_char c1) = no_connection;
-static void (*o_hira_conv)(nkf_char c2,nkf_char c1) = no_connection;
-static void (*o_base64conv)(nkf_char c2,nkf_char c1) = no_connection;
-static void (*o_iso2022jp_check_conv)(nkf_char c2,nkf_char c1) = no_connection;
+static void (*o_zconv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_fconv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_crconv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_rot_conv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_hira_conv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_base64conv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_iso2022jp_check_conv)PROTO((int c2,int c1)) = no_connection;
/* static redirections */
-static void (*o_putc)(nkf_char c) = std_putc;
+static void (*o_putc)PROTO((int c)) = std_putc;
-static nkf_char (*i_getc)(FILE *f) = std_getc; /* general input */
-static nkf_char (*i_ungetc)(nkf_char c,FILE *f) =std_ungetc;
+static int (*i_getc)PROTO((FILE *f)) = std_getc; /* general input */
+static int (*i_ungetc)PROTO((int c,FILE *f)) =std_ungetc;
-static nkf_char (*i_bgetc)(FILE *) = std_getc; /* input of mgetc */
-static nkf_char (*i_bungetc)(nkf_char c ,FILE *f) = std_ungetc;
+static int (*i_bgetc)PROTO((FILE *)) = std_getc; /* input of mgetc */
+static int (*i_bungetc)PROTO((int c ,FILE *f)) = std_ungetc;
-static void (*o_mputc)(nkf_char c) = std_putc ; /* output of mputc */
+static void (*o_mputc)PROTO((int c)) = std_putc ; /* output of mputc */
-static nkf_char (*i_mgetc)(FILE *) = std_getc; /* input of mgetc */
-static nkf_char (*i_mungetc)(nkf_char c ,FILE *f) = std_ungetc;
+static int (*i_mgetc)PROTO((FILE *)) = std_getc; /* input of mgetc */
+static int (*i_mungetc)PROTO((int c ,FILE *f)) = std_ungetc;
/* for strict mime */
-static nkf_char (*i_mgetc_buf)(FILE *) = std_getc; /* input of mgetc_buf */
-static nkf_char (*i_mungetc_buf)(nkf_char c,FILE *f) = std_ungetc;
+static int (*i_mgetc_buf)PROTO((FILE *)) = std_getc; /* input of mgetc_buf */
+static int (*i_mungetc_buf)PROTO((int c,FILE *f)) = std_ungetc;
/* Global states */
static int output_mode = ASCII, /* output kanji mode */
@@ -663,7 +540,7 @@ static int mime_decode_mode = FALSE; /* MIME mode B base64, Q hex */
/* X0201 kana conversion table */
/* 90-9F A0-DF */
-static const
+static
unsigned char cv[]= {
0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57,
0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21,
@@ -686,7 +563,7 @@ unsigned char cv[]= {
/* X0201 kana conversion table for daguten */
/* 90-9F A0-DF */
-static const
+static
unsigned char dv[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -708,7 +585,7 @@ unsigned char dv[]= {
/* X0201 kana conversion table for han-daguten */
/* 90-9F A0-DF */
-static const
+static
unsigned char ev[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -731,7 +608,7 @@ unsigned char ev[]= {
/* X0208 kigou conversion table */
/* 0x8140 - 0x819e */
-static const
+static
unsigned char fv[] = {
0x00,0x00,0x00,0x00,0x2c,0x2e,0x00,0x3a,
@@ -751,13 +628,9 @@ unsigned char fv[] = {
#define CRLF 1
-static int file_out_f = FALSE;
+static int file_out = FALSE;
#ifdef OVERWRITE
-static int overwrite_f = FALSE;
-static int preserve_time_f = FALSE;
-static int backup_f = FALSE;
-static char *backup_suffix = "";
-static char *get_backup_filename(const char *suffix, const char *filename);
+static int overwrite = FALSE;
#endif
static int crmode_f = 0; /* CR, NL, CRLF */
@@ -765,15 +638,11 @@ static int crmode_f = 0; /* CR, NL, CRLF */
static int end_check;
#endif /*Easy Win */
-#define STD_GC_BUFSIZE (256)
-nkf_char std_gc_buf[STD_GC_BUFSIZE];
-nkf_char std_gc_ndx;
-
-#ifdef WIN32DLL
-#include "nkf32dll.c"
-#elif defined(PERL_XS)
-#else /* WIN32DLL */
-int main(int argc, char **argv)
+#ifndef PERL_XS
+int
+main(argc, argv)
+ int argc;
+ char **argv;
{
FILE *fin;
unsigned char *cp;
@@ -820,7 +689,7 @@ int main(int argc, char **argv)
x0201_f = ((!iso2022jp_f)? TRUE : NO_X0201);
if (binmode_f == TRUE)
-#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
+#ifdef __OS2__
if (freopen("","wb",stdout) == NULL)
return (-1);
#else
@@ -830,16 +699,16 @@ int main(int argc, char **argv)
if (unbuf_f)
setbuf(stdout, (char *) NULL);
else
- setvbuffer(stdout, (char *) stdobuf, IOBUF_SIZE);
+ setvbuffer(stdout, stdobuf, IOBUF_SIZE);
if (argc == 0) {
if (binmode_f == TRUE)
-#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
+#ifdef __OS2__
if (freopen("","rb",stdin) == NULL) return (-1);
#else
setbinmode(stdin);
#endif
- setvbuffer(stdin, (char *) stdibuf, IOBUF_SIZE);
+ setvbuffer(stdin, stdibuf, IOBUF_SIZE);
if (nop_f)
noconvert(stdin);
else {
@@ -849,12 +718,6 @@ int main(int argc, char **argv)
} else {
int nfiles = argc;
while (argc--) {
- is_inputcode_mixed = FALSE;
- is_inputcode_set = FALSE;
- input_codename = "";
-#ifdef CHECK_OPTION
- iconv_for_check = 0;
-#endif
if ((fin = fopen((origfname = *argv++), "r")) == NULL) {
perror(*--argv);
return(-1);
@@ -865,9 +728,9 @@ int main(int argc, char **argv)
#endif
/* reopen file for stdout */
- if (file_out_f == TRUE) {
+ if (file_out == TRUE) {
#ifdef OVERWRITE
- if (overwrite_f){
+ if (overwrite){
outfname = malloc(strlen(origfname)
+ strlen(".nkftmpXXXXXX")
+ 1);
@@ -889,7 +752,7 @@ int main(int argc, char **argv)
}
strcat(outfname, "ntXXXXXX");
mktemp(outfname);
- fd = open(outfname, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
+ fd = open(outfname, O_WRONLY | O_CREAT | O_TRUNC,
S_IREAD | S_IWRITE);
#else
strcat(outfname, ".nkftmpXXXXXX");
@@ -916,7 +779,7 @@ int main(int argc, char **argv)
return (-1);
}
if (binmode_f == TRUE) {
-#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
+#ifdef __OS2__
if (freopen("","wb",stdout) == NULL)
return (-1);
#else
@@ -925,13 +788,13 @@ int main(int argc, char **argv)
}
}
if (binmode_f == TRUE)
-#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
+#ifdef __OS2__
if (freopen("","rb",fin) == NULL)
return (-1);
#else
setbinmode(fin);
#endif
- setvbuffer(fin, (char *) stdibuf, IOBUF_SIZE);
+ setvbuffer(fin, stdibuf, IOBUF_SIZE);
if (nop_f)
noconvert(fin);
else {
@@ -942,9 +805,9 @@ int main(int argc, char **argv)
}
fclose(fin);
#ifdef OVERWRITE
- if (overwrite_f) {
+ if (overwrite) {
struct stat sb;
-#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__) && !defined(__WATCOMC__) && !defined(__EMX__) && !defined(__OS2__) && !defined(__DJGPP__)
+#if defined(MSDOS) && !defined(__MINGW32__)
time_t tb[2];
#else
struct utimbuf tb;
@@ -964,37 +827,23 @@ int main(int argc, char **argv)
}
/* $B%?%$%`%9%?%s%W$rI|85(B */
- if(preserve_time_f){
-#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__) && !defined(__WATCOMC__) && !defined(__EMX__) && !defined(__OS2__) && !defined(__DJGPP__)
- tb[0] = tb[1] = sb.st_mtime;
- if (utime(outfname, tb)) {
- fprintf(stderr, "Can't set timestamp %s\n", outfname);
- }
+#if defined(MSDOS) && !defined(__MINGW32__)
+ tb[0] = tb[1] = sb.st_mtime;
+ if (utime(outfname, tb)) {
+ fprintf(stderr, "Can't set timestamp %s\n", outfname);
+ }
#else
- tb.actime = sb.st_atime;
- tb.modtime = sb.st_mtime;
- if (utime(outfname, &tb)) {
- fprintf(stderr, "Can't set timestamp %s\n", outfname);
- }
-#endif
- }
- if(backup_f){
- char *backup_filename = get_backup_filename(backup_suffix, origfname);
-#ifdef MSDOS
- unlink(backup_filename);
+ tb.actime = sb.st_atime;
+ tb.modtime = sb.st_mtime;
+ if (utime(outfname, &tb)) {
+ fprintf(stderr, "Can't set timestamp %s\n", outfname);
+ }
#endif
- if (rename(origfname, backup_filename)) {
- perror(backup_filename);
- fprintf(stderr, "Can't rename %s to %s\n",
- origfname, backup_filename);
- }
- }else{
#ifdef MSDOS
- if (unlink(origfname)){
- perror(origfname);
- }
+ if (unlink(origfname)){
+ perror(origfname);
+ }
#endif
- }
if (rename(outfname, origfname)) {
perror(origfname);
fprintf(stderr, "Can't rename %s to %s\n",
@@ -1007,66 +856,23 @@ int main(int argc, char **argv)
}
}
#ifdef EASYWIN /*Easy Win */
- if (file_out_f == FALSE)
+ if (file_out == FALSE)
scanf("%d",&end_check);
else
fclose(stdout);
#else /* for Other OS */
- if (file_out_f == TRUE)
+ if (file_out == TRUE)
fclose(stdout);
-#endif /*Easy Win */
+#endif
return (0);
}
-#endif /* WIN32DLL */
-
-#ifdef OVERWRITE
-char *get_backup_filename(const char *suffix, const char *filename)
-{
- char *backup_filename;
- int asterisk_count = 0;
- int i, j;
- int filename_length = strlen(filename);
-
- for(i = 0; suffix[i]; i++){
- if(suffix[i] == '*') asterisk_count++;
- }
-
- if(asterisk_count){
- backup_filename = malloc(strlen(suffix) + (asterisk_count * (filename_length - 1)) + 1);
- if (!backup_filename){
- perror("Can't malloc backup filename.");
- return NULL;
- }
-
- for(i = 0, j = 0; suffix[i];){
- if(suffix[i] == '*'){
- backup_filename[j] = '\0';
- strncat(backup_filename, filename, filename_length);
- i++;
- j += filename_length;
- }else{
- backup_filename[j++] = suffix[i++];
- }
- }
- backup_filename[j] = '\0';
- }else{
- j = strlen(suffix) + filename_length;
- backup_filename = malloc( + 1);
- strcpy(backup_filename, filename);
- strcat(backup_filename, suffix);
- backup_filename[j] = '\0';
- }
- return backup_filename;
-}
#endif
-static const
+static
struct {
- const char *name;
- const char *alias;
+ char *name;
+ char *alias;
} long_option[] = {
- {"ic=", ""},
- {"oc=", ""},
{"base64","jMB"},
{"euc","e"},
{"euc-input","E"},
@@ -1089,35 +895,17 @@ struct {
{"guess", "g"},
{"cp932", ""},
{"no-cp932", ""},
-#ifdef X0212_ENABLE
- {"x0212", ""},
-#endif
#ifdef UTF8_OUTPUT_ENABLE
{"utf8", "w"},
{"utf16", "w16"},
{"ms-ucs-map", ""},
- {"fb-skip", ""},
- {"fb-html", ""},
- {"fb-xml", ""},
- {"fb-perl", ""},
- {"fb-java", ""},
- {"fb-subchar", ""},
- {"fb-subchar=", ""},
#endif
#ifdef UTF8_INPUT_ENABLE
{"utf8-input", "W"},
{"utf16-input", "W16"},
- {"no-cp932ext", ""},
- {"no-best-fit-chars",""},
-#endif
-#ifdef UNICODE_NORMALIZATION
- {"utf8mac-input", ""},
#endif
#ifdef OVERWRITE
{"overwrite", ""},
- {"overwrite=", ""},
- {"in-place", ""},
- {"in-place=", ""},
#endif
#ifdef INPUT_OPTION
{"cap-input", ""},
@@ -1142,330 +930,47 @@ struct {
static int option_mode = 0;
-void options(unsigned char *cp)
+void
+options(cp)
+ unsigned char *cp;
{
- nkf_char i, j;
- unsigned char *p;
- unsigned char *cp_back = NULL;
- char codeset[32];
+ int i;
+ unsigned char *p = NULL;
if (option_mode==1)
return;
- while(*cp && *cp++!='-');
- while (*cp || cp_back) {
- if(!*cp){
- cp = cp_back;
- cp_back = NULL;
- continue;
+ if (*cp++ != '-')
+ return;
+ while (*cp) {
+ if (p && !*cp) {
+ cp = p;
+ p = 0;
}
- p = 0;
switch (*cp++) {
case '-': /* literal options */
- if (!*cp || *cp == SPACE) { /* ignore the rest of arguments */
+ if (!*cp) { /* ignore the rest of arguments */
option_mode = 1;
return;
}
for (i=0;i<sizeof(long_option)/sizeof(long_option[0]);i++) {
+ int j;
p = (unsigned char *)long_option[i].name;
- for (j=0;*p && *p != '=' && *p == cp[j];p++, j++);
- if (*p == cp[j] || cp[j] == ' '){
- p = &cp[j] + 1;
+ for (j=0;*p && (*p != '=') && *p == cp[j];p++, j++);
+ if (!*p || *p == cp[j]){
+ p = &cp[j];
break;
}
p = 0;
}
if (p == 0) return;
- while(*cp && *cp != SPACE && cp++);
- if (long_option[i].alias[0]){
- cp_back = cp;
- cp = (unsigned char *)long_option[i].alias;
- }else{
- if (strcmp(long_option[i].name, "ic=") == 0){
- for (i=0; i < 16 && SPACE < p[i] && p[i] < DEL; i++){
- codeset[i] = nkf_toupper(p[i]);
- }
- codeset[i] = 0;
- if(strcmp(codeset, "ISO-2022-JP") == 0 ||
- strcmp(codeset, "X-ISO2022JP-CP932") == 0 ||
- strcmp(codeset, "CP50220") == 0 ||
- strcmp(codeset, "CP50221") == 0 ||
- strcmp(codeset, "CP50222") == 0 ||
- strcmp(codeset, "ISO-2022-JP-MS") == 0){
- input_f = JIS_INPUT;
- }else if(strcmp(codeset, "ISO-2022-JP-1") == 0){
- input_f = JIS_INPUT;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
- }else if(strcmp(codeset, "ISO-2022-JP-3") == 0){
- input_f = JIS_INPUT;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
- x0213_f = TRUE;
- }else if(strcmp(codeset, "SHIFT_JIS") == 0){
- input_f = SJIS_INPUT;
- if (x0201_f==NO_X0201) x0201_f=TRUE;
- }else if(strcmp(codeset, "WINDOWS-31J") == 0 ||
- strcmp(codeset, "CSWINDOWS31J") == 0 ||
- strcmp(codeset, "CP932") == 0 ||
- strcmp(codeset, "MS932") == 0){
- input_f = SJIS_INPUT;
- x0201_f = FALSE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_CP932;
-#endif
- }else if(strcmp(codeset, "EUCJP") == 0 ||
- strcmp(codeset, "EUC-JP") == 0){
- input_f = JIS_INPUT;
- }else if(strcmp(codeset, "CP51932") == 0){
- input_f = JIS_INPUT;
- x0201_f = FALSE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_CP932;
-#endif
- }else if(strcmp(codeset, "EUC-JP-MS") == 0 ||
- strcmp(codeset, "EUCJP-MS") == 0 ||
- strcmp(codeset, "EUCJPMS") == 0){
- input_f = JIS_INPUT;
- x0201_f = FALSE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_MS;
-#endif
- }else if(strcmp(codeset, "EUC-JP-ASCII") == 0 ||
- strcmp(codeset, "EUCJP-ASCII") == 0){
- input_f = JIS_INPUT;
- x0201_f = FALSE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_ASCII;
-#endif
- }else if(strcmp(codeset, "SHIFT_JISX0213") == 0 ||
- strcmp(codeset, "SHIFT_JIS-2004") == 0){
- input_f = SJIS_INPUT;
- x0213_f = TRUE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
- cp932inv_f = FALSE;
-#endif
- if (x0201_f==NO_X0201) x0201_f=TRUE;
- }else if(strcmp(codeset, "EUC-JISX0213") == 0 ||
- strcmp(codeset, "EUC-JIS-2004") == 0){
- input_f = JIS_INPUT;
- x0201_f = FALSE;
- x0213_f = TRUE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
- cp932inv_f = FALSE;
-#endif
-#ifdef UTF8_INPUT_ENABLE
- }else if(strcmp(codeset, "UTF-8") == 0 ||
- strcmp(codeset, "UTF-8N") == 0 ||
- strcmp(codeset, "UTF-8-BOM") == 0){
- input_f = UTF8_INPUT;
-#ifdef UNICODE_NORMALIZATION
- }else if(strcmp(codeset, "UTF8-MAC") == 0 ||
- strcmp(codeset, "UTF-8-MAC") == 0){
- input_f = UTF8_INPUT;
- nfc_f = TRUE;
-#endif
- }else if(strcmp(codeset, "UTF-16") == 0){
- input_f = UTF16BE_INPUT;
- utf16_mode = UTF16BE_INPUT;
- }else if(strcmp(codeset, "UTF-16BE") == 0 ||
- strcmp(codeset, "UTF-16BE-BOM") == 0){
- input_f = UTF16BE_INPUT;
- utf16_mode = UTF16BE_INPUT;
- }else if(strcmp(codeset, "UTF-16LE") == 0 ||
- strcmp(codeset, "UTF-16LE-BOM") == 0){
- input_f = UTF16LE_INPUT;
- utf16_mode = UTF16LE_INPUT;
-#endif
- }
- continue;
- }
- if (strcmp(long_option[i].name, "oc=") == 0){
- for (i=0; i < 16 && SPACE < p[i] && p[i] < DEL; i++){
- codeset[i] = nkf_toupper(p[i]);
- }
- codeset[i] = 0;
- if(strcmp(codeset, "ISO-2022-JP") == 0 ||
- strcmp(codeset, "CP50220") == 0){
- output_conv = j_oconv;
- }else if(strcmp(codeset, "X-ISO2022JP-CP932") == 0){
- output_conv = j_oconv;
- no_cp932ext_f = TRUE;
- }else if(strcmp(codeset, "CP50221") == 0 ||
- strcmp(codeset, "ISO-2022-JP-MS") == 0){
- output_conv = j_oconv;
- x0201_f = FALSE;
- }else if(strcmp(codeset, "ISO-2022-JP-1") == 0){
- output_conv = j_oconv;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
- }else if(strcmp(codeset, "ISO-2022-JP-3") == 0){
- output_conv = j_oconv;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
- x0213_f = TRUE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
- }else if(strcmp(codeset, "ISO-2022-JP-MS") == 0){
- output_conv = j_oconv;
- x0201_f = FALSE;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
- }else if(strcmp(codeset, "SHIFT_JIS") == 0){
- output_conv = s_oconv;
- }else if(strcmp(codeset, "WINDOWS-31J") == 0 ||
- strcmp(codeset, "CSWINDOWS31J") == 0 ||
- strcmp(codeset, "CP932") == 0 ||
- strcmp(codeset, "MS932") == 0){
- output_conv = s_oconv;
- x0201_f = FALSE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
- cp932inv_f = TRUE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_CP932;
-#endif
- }else if(strcmp(codeset, "EUCJP") == 0 ||
- strcmp(codeset, "EUC-JP") == 0){
- output_conv = e_oconv;
- }else if(strcmp(codeset, "CP51932") == 0){
- output_conv = e_oconv;
- x0201_f = FALSE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_CP932;
-#endif
- }else if(strcmp(codeset, "EUC-JP-MS") == 0 ||
- strcmp(codeset, "EUCJP-MS") == 0 ||
- strcmp(codeset, "EUCJPMS") == 0){
- output_conv = e_oconv;
- x0201_f = FALSE;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_MS;
-#endif
- }else if(strcmp(codeset, "EUC-JP-ASCII") == 0 ||
- strcmp(codeset, "EUCJP-ASCII") == 0){
- output_conv = e_oconv;
- x0201_f = FALSE;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_ASCII;
-#endif
- }else if(strcmp(codeset, "SHIFT_JISX0213") == 0 ||
- strcmp(codeset, "SHIFT_JIS-2004") == 0){
- output_conv = s_oconv;
- x0213_f = TRUE;
-#ifdef SHIFTJIS_CP932
- cp932inv_f = FALSE;
-#endif
- }else if(strcmp(codeset, "EUC-JISX0213") == 0 ||
- strcmp(codeset, "EUC-JIS-2004") == 0){
- output_conv = e_oconv;
-#ifdef X0212_ENABLE
- x0212_f = TRUE;
-#endif
- x0213_f = TRUE;
-#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
-#endif
-#ifdef UTF8_OUTPUT_ENABLE
- }else if(strcmp(codeset, "UTF-8") == 0){
- output_conv = w_oconv;
- }else if(strcmp(codeset, "UTF-8N") == 0){
- output_conv = w_oconv;
- unicode_bom_f=1;
- }else if(strcmp(codeset, "UTF-8-BOM") == 0){
- output_conv = w_oconv;
- unicode_bom_f=2;
- }else if(strcmp(codeset, "UTF-16BE") == 0){
- output_conv = w_oconv16;
- unicode_bom_f=1;
- }else if(strcmp(codeset, "UTF-16") == 0 ||
- strcmp(codeset, "UTF-16BE-BOM") == 0){
- output_conv = w_oconv16;
- unicode_bom_f=2;
- }else if(strcmp(codeset, "UTF-16LE") == 0){
- output_conv = w_oconv16;
- w_oconv16_LE = 1;
- unicode_bom_f=1;
- }else if(strcmp(codeset, "UTF-16LE-BOM") == 0){
- output_conv = w_oconv16;
- w_oconv16_LE = 1;
- unicode_bom_f=2;
-#endif
- }
- continue;
- }
+ cp = (unsigned char *)long_option[i].alias;
+ if (!*cp){
#ifdef OVERWRITE
if (strcmp(long_option[i].name, "overwrite") == 0){
- file_out_f = TRUE;
- overwrite_f = TRUE;
- preserve_time_f = TRUE;
+ file_out = TRUE;
+ overwrite = TRUE;
continue;
}
- if (strcmp(long_option[i].name, "overwrite=") == 0){
- file_out_f = TRUE;
- overwrite_f = TRUE;
- preserve_time_f = TRUE;
- backup_f = TRUE;
- backup_suffix = malloc(strlen((char *) p) + 1);
- strcpy(backup_suffix, (char *) p);
- continue;
- }
- if (strcmp(long_option[i].name, "in-place") == 0){
- file_out_f = TRUE;
- overwrite_f = TRUE;
- preserve_time_f = FALSE;
- continue;
- }
- if (strcmp(long_option[i].name, "in-place=") == 0){
- file_out_f = TRUE;
- overwrite_f = TRUE;
- preserve_time_f = FALSE;
- backup_f = TRUE;
- backup_suffix = malloc(strlen((char *) p) + 1);
- strcpy(backup_suffix, (char *) p);
- continue;
- }
#endif
#ifdef INPUT_OPTION
if (strcmp(long_option[i].name, "cap-input") == 0){
@@ -1495,21 +1000,21 @@ void options(unsigned char *cp)
#endif
if (strcmp(long_option[i].name, "cp932") == 0){
#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
+ cp932_f = TRUE;
cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_CP932;
+ ms_ucs_map_f = TRUE;
#endif
continue;
}
if (strcmp(long_option[i].name, "no-cp932") == 0){
#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
+ cp932_f = FALSE;
cp932inv_f = FALSE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = UCS_MAP_ASCII;
+ ms_ucs_map_f = FALSE;
#endif
continue;
}
@@ -1519,14 +1024,6 @@ void options(unsigned char *cp)
continue;
}
#endif
-
-#ifdef X0212_ENABLE
- if (strcmp(long_option[i].name, "x0212") == 0){
- x0212_f = TRUE;
- continue;
- }
-#endif
-
#ifdef EXEC_IO
if (strcmp(long_option[i].name, "exec-in") == 0){
exec_f = 1;
@@ -1537,83 +1034,16 @@ void options(unsigned char *cp)
return;
}
#endif
-#if defined(UTF8_OUTPUT_ENABLE) && defined(UTF8_INPUT_ENABLE)
- if (strcmp(long_option[i].name, "no-cp932ext") == 0){
- no_cp932ext_f = TRUE;
- continue;
- }
- if (strcmp(long_option[i].name, "no-best-fit-chars") == 0){
- no_best_fit_chars_f = TRUE;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-skip") == 0){
- encode_fallback = NULL;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-html") == 0){
- encode_fallback = encode_fallback_html;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-xml" ) == 0){
- encode_fallback = encode_fallback_xml;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-java") == 0){
- encode_fallback = encode_fallback_java;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-perl") == 0){
- encode_fallback = encode_fallback_perl;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-subchar") == 0){
- encode_fallback = encode_fallback_subchar;
- continue;
- }
- if (strcmp(long_option[i].name, "fb-subchar=") == 0){
- encode_fallback = encode_fallback_subchar;
- unicode_subchar = 0;
- if (p[0] != '0'){
- /* decimal number */
- for (i = 0; i < 7 && nkf_isdigit(p[i]); i++){
- unicode_subchar *= 10;
- unicode_subchar += hex2bin(p[i]);
- }
- }else if(p[1] == 'x' || p[1] == 'X'){
- /* hexadecimal number */
- for (i = 2; i < 8 && nkf_isxdigit(p[i]); i++){
- unicode_subchar <<= 4;
- unicode_subchar |= hex2bin(p[i]);
- }
- }else{
- /* octal number */
- for (i = 1; i < 8 && nkf_isoctal(p[i]); i++){
- unicode_subchar *= 8;
- unicode_subchar += hex2bin(p[i]);
- }
- }
- w16e_conv(unicode_subchar, &i, &j);
- unicode_subchar = i<<8 | j;
- continue;
- }
-#endif
#ifdef UTF8_OUTPUT_ENABLE
if (strcmp(long_option[i].name, "ms-ucs-map") == 0){
- ms_ucs_map_f = UCS_MAP_MS;
+ ms_ucs_map_f = TRUE;
continue;
}
#endif
-#ifdef UNICODE_NORMALIZATION
- if (strcmp(long_option[i].name, "utf8mac-input") == 0){
- input_f = UTF8_INPUT;
- nfc_f = TRUE;
- continue;
- }
-#endif
if (strcmp(long_option[i].name, "prefix=") == 0){
- if (nkf_isgraph(p[0])){
- for (i = 1; nkf_isgraph(p[i]); i++){
- prefix_table[p[i]] = p[0];
+ if (*p == '=' && ' ' < p[1] && p[1] < 128){
+ for (i = 2; ' ' < p[i] && p[i] < 128; i++){
+ prefix_table[p[i]] = p[1];
}
}
continue;
@@ -1627,21 +1057,7 @@ void options(unsigned char *cp)
unbuf_f = TRUE;
continue;
case 't': /* transparent mode */
- if (*cp=='1') {
- /* alias of -t */
- nop_f = TRUE;
- *cp++;
- } else if (*cp=='2') {
- /*
- * -t with put/get
- *
- * nkf -t2MB hoge.bin | nkf -t2mB | diff -s - hoge.bin
- *
- */
- nop_f = 2;
- *cp++;
- } else
- nop_f = TRUE;
+ nop_f = TRUE;
continue;
case 'j': /* JIS output */
case 'n':
@@ -1667,8 +1083,8 @@ void options(unsigned char *cp)
continue;
case 'h':
/*
- bit:1 katakana->hiragana
- bit:2 hiragana->katakana
+ bit:1 hira -> kata
+ bit:2 kata -> hira
*/
if ('9'>= *cp && *cp>='0')
hira_f |= (*cp++ -'0');
@@ -1722,17 +1138,12 @@ void options(unsigned char *cp)
#ifdef UTF8_INPUT_ENABLE
case 'W': /* UTF-8 input */
if ('1'== cp[0] && '6'==cp[1]) {
- input_f = UTF16BE_INPUT;
- utf16_mode = UTF16BE_INPUT;
- cp += 2;
+ input_f = UTF16LE_INPUT;
if (cp[0]=='L') {
cp++;
- input_f = UTF16LE_INPUT;
- utf16_mode = UTF16LE_INPUT;
} else if (cp[0] == 'B') {
cp++;
input_f = UTF16BE_INPUT;
- utf16_mode = UTF16BE_INPUT;
}
} else if (cp[0] == '8') {
cp++;
@@ -1799,7 +1210,6 @@ void options(unsigned char *cp)
}
continue;
case 'm': /* MIME support */
- /* mime_decode_f = TRUE; */ /* this has too large side effects... */
if (*cp=='B'||*cp=='Q') {
mime_decode_mode = *cp++;
mimebuf_f = FIXED_MIME;
@@ -1808,7 +1218,6 @@ void options(unsigned char *cp)
} else if (*cp=='S') {
mime_f = STRICT_MIME; cp++;
} else if (*cp=='0') {
- mime_decode_f = FALSE;
mime_f = FALSE; cp++;
}
continue;
@@ -1835,7 +1244,7 @@ void options(unsigned char *cp)
continue;
#ifndef PERL_XS
case 'O':/* for Output file */
- file_out_f = TRUE;
+ file_out = TRUE;
continue;
#endif
case 'c':/* add cr code */
@@ -1865,7 +1274,8 @@ void options(unsigned char *cp)
continue;
case ' ':
/* module muliple options in a string are allowed for Perl moudle */
- while(*cp && *cp++!='-');
+ while(*cp && *cp!='-') cp++;
+ if(*cp=='-') cp++;
continue;
default:
/* bogus option but ignored */
@@ -1875,10 +1285,10 @@ void options(unsigned char *cp)
}
#ifdef ANSI_C_PROTOTYPE
-struct input_code * find_inputcode_byfunc(nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0))
+struct input_code * find_inputcode_byfunc(int (*iconv_func)(int c2,int c1,int c0))
#else
struct input_code * find_inputcode_byfunc(iconv_func)
- nkf_char (*iconv_func)();
+ int (*iconv_func)();
#endif
{
if (iconv_func){
@@ -1893,8 +1303,17 @@ struct input_code * find_inputcode_byfunc(iconv_func)
return 0;
}
-void set_iconv(nkf_char f, nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0))
+#ifdef ANSI_C_PROTOTYPE
+void set_iconv(int f, int (*iconv_func)(int c2,int c1,int c0))
+#else
+void set_iconv(f, iconv_func)
+ int f;
+ int (*iconv_func)();
+#endif
{
+#ifdef CHECK_OPTION
+ static int (*iconv_for_check)() = 0;
+#endif
#ifdef INPUT_CODE_FIX
if (f || !input_f)
#endif
@@ -1935,40 +1354,43 @@ void set_iconv(nkf_char f, nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_ch
#define SCORE_INIT (SCORE_iMIME)
-const nkf_char score_table_A0[] = {
+int score_table_A0[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND,
SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_NO_EXIST,
};
-const nkf_char score_table_F0[] = {
+int score_table_F0[] = {
SCORE_L2, SCORE_L2, SCORE_L2, SCORE_L2,
SCORE_L2, SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST,
SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND,
SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST, SCORE_ERROR,
};
-void set_code_score(struct input_code *ptr, nkf_char score)
+void set_code_score(ptr, score)
+ struct input_code *ptr;
+ int score;
{
if (ptr){
ptr->score |= score;
}
}
-void clr_code_score(struct input_code *ptr, nkf_char score)
+void clr_code_score(ptr, score)
+ struct input_code *ptr;
+ int score;
{
if (ptr){
ptr->score &= ~score;
}
}
-void code_score(struct input_code *ptr)
+void code_score(ptr)
+ struct input_code *ptr;
{
- nkf_char c2 = ptr->buf[0];
-#ifdef UTF8_OUTPUT_ENABLE
- nkf_char c1 = ptr->buf[1];
-#endif
+ int c2 = ptr->buf[0];
+ int c1 = ptr->buf[1];
if (c2 < 0){
set_code_score(ptr, SCORE_ERROR);
}else if (c2 == SSO){
@@ -1986,7 +1408,8 @@ void code_score(struct input_code *ptr)
}
}
-void status_disable(struct input_code *ptr)
+void status_disable(ptr)
+struct input_code *ptr;
{
ptr->stat = -1;
ptr->buf[0] = -1;
@@ -1994,37 +1417,46 @@ void status_disable(struct input_code *ptr)
if (iconv == ptr->iconv_func) set_iconv(FALSE, 0);
}
-void status_push_ch(struct input_code *ptr, nkf_char c)
+void status_push_ch(ptr, c)
+ struct input_code *ptr;
+ int c;
{
ptr->buf[ptr->index++] = c;
}
-void status_clear(struct input_code *ptr)
+void status_clear(ptr)
+ struct input_code *ptr;
{
ptr->stat = 0;
ptr->index = 0;
}
-void status_reset(struct input_code *ptr)
+void status_reset(ptr)
+ struct input_code *ptr;
{
status_clear(ptr);
ptr->score = SCORE_INIT;
}
-void status_reinit(struct input_code *ptr)
+void status_reinit(ptr)
+ struct input_code *ptr;
{
status_reset(ptr);
ptr->_file_stat = 0;
}
-void status_check(struct input_code *ptr, nkf_char c)
+void status_check(ptr, c)
+ struct input_code *ptr;
+ int c;
{
if (c <= DEL && estab_f){
status_reset(ptr);
}
}
-void s_status(struct input_code *ptr, nkf_char c)
+void s_status(ptr, c)
+ struct input_code *ptr;
+ int c;
{
switch(ptr->stat){
case -1:
@@ -2034,7 +1466,7 @@ void s_status(struct input_code *ptr, nkf_char c)
if (c <= DEL){
break;
#ifdef NUMCHAR_OPTION
- }else if (is_unicode_capsule(c)){
+ }else if ((c & CLASS_MASK) == CLASS_UTF16){
break;
#endif
}else if (0xa1 <= c && c <= 0xdf){
@@ -2046,16 +1478,11 @@ void s_status(struct input_code *ptr, nkf_char c)
ptr->stat = 1;
status_push_ch(ptr, c);
#ifdef SHIFTJIS_CP932
- }else if (cp51932_f
- && is_ibmext_in_sjis(c)){
+ }else if (cp932_f
+ && CP932_TABLE_BEGIN <= c && c <= CP932_TABLE_END){
ptr->stat = 2;
status_push_ch(ptr, c);
#endif /* SHIFTJIS_CP932 */
-#ifdef X0212_ENABLE
- }else if (x0212_f && 0xf0 <= c && c <= 0xfc){
- ptr->stat = 1;
- status_push_ch(ptr, c);
-#endif /* X0212_ENABLE */
}else{
status_disable(ptr);
}
@@ -2070,8 +1497,8 @@ void s_status(struct input_code *ptr, nkf_char c)
status_disable(ptr);
}
break;
- case 2:
#ifdef SHIFTJIS_CP932
+ case 2:
if ((0x40 <= c && c <= 0x7e) || (0x80 <= c && c <= 0xfc)){
status_push_ch(ptr, c);
if (s2e_conv(ptr->buf[0], ptr->buf[1], &ptr->buf[0], &ptr->buf[1]) == 0){
@@ -2080,15 +1507,15 @@ void s_status(struct input_code *ptr, nkf_char c)
break;
}
}
-#endif /* SHIFTJIS_CP932 */
-#ifndef X0212_ENABLE
status_disable(ptr);
-#endif
break;
+#endif /* SHIFTJIS_CP932 */
}
}
-void e_status(struct input_code *ptr, nkf_char c)
+void e_status(ptr, c)
+ struct input_code *ptr;
+ int c;
{
switch (ptr->stat){
case -1:
@@ -2098,17 +1525,12 @@ void e_status(struct input_code *ptr, nkf_char c)
if (c <= DEL){
break;
#ifdef NUMCHAR_OPTION
- }else if (is_unicode_capsule(c)){
+ }else if ((c & CLASS_MASK) == CLASS_UTF16){
break;
#endif
}else if (SSO == c || (0xa1 <= c && c <= 0xfe)){
ptr->stat = 1;
status_push_ch(ptr, c);
-#ifdef X0212_ENABLE
- }else if (0x8f == c){
- ptr->stat = 2;
- status_push_ch(ptr, c);
-#endif /* X0212_ENABLE */
}else{
status_disable(ptr);
}
@@ -2122,20 +1544,13 @@ void e_status(struct input_code *ptr, nkf_char c)
status_disable(ptr);
}
break;
-#ifdef X0212_ENABLE
- case 2:
- if (0xa1 <= c && c <= 0xfe){
- ptr->stat = 1;
- status_push_ch(ptr, c);
- }else{
- status_disable(ptr);
- }
-#endif /* X0212_ENABLE */
}
}
#ifdef UTF8_INPUT_ENABLE
-void w16_status(struct input_code *ptr, nkf_char c)
+void w16_status(ptr, c)
+ struct input_code *ptr;
+ int c;
{
switch (ptr->stat){
case -1:
@@ -2181,7 +1596,9 @@ void w16_status(struct input_code *ptr, nkf_char c)
}
}
-void w_status(struct input_code *ptr, nkf_char c)
+void w_status(ptr, c)
+ struct input_code *ptr;
+ int c;
{
switch (ptr->stat){
case -1:
@@ -2191,7 +1608,7 @@ void w_status(struct input_code *ptr, nkf_char c)
if (c <= DEL){
break;
#ifdef NUMCHAR_OPTION
- }else if (is_unicode_capsule(c)){
+ }else if ((c & CLASS_MASK) == CLASS_UTF16){
break;
#endif
}else if (0xc0 <= c && c <= 0xdf){
@@ -2226,7 +1643,9 @@ void w_status(struct input_code *ptr, nkf_char c)
}
#endif
-void code_status(nkf_char c)
+void
+code_status(c)
+ int c;
{
int action_flag = 1;
struct input_code *result = 0;
@@ -2258,17 +1677,24 @@ void code_status(nkf_char c)
}
}
-#ifndef WIN32DLL
-nkf_char std_getc(FILE *f)
+#define STD_GC_BUFSIZE (256)
+int std_gc_buf[STD_GC_BUFSIZE];
+int std_gc_ndx;
+
+int
+std_getc(f)
+FILE *f;
{
if (std_gc_ndx){
return std_gc_buf[--std_gc_ndx];
}
return getc(f);
}
-#endif /*WIN32DLL*/
-nkf_char std_ungetc(nkf_char c, FILE *f)
+int
+std_ungetc(c,f)
+int c;
+FILE *f;
{
if (std_gc_ndx == STD_GC_BUFSIZE){
return EOF;
@@ -2277,29 +1703,28 @@ nkf_char std_ungetc(nkf_char c, FILE *f)
return c;
}
-#ifndef WIN32DLL
-void std_putc(nkf_char c)
+void
+std_putc(c)
+int c;
{
if(c!=EOF)
putchar(c);
}
-#endif /*WIN32DLL*/
-#if !defined(PERL_XS) && !defined(WIN32DLL)
-nkf_char noconvert(FILE *f)
+int
+noconvert(f)
+ FILE *f;
{
- nkf_char c;
+ int c;
- if (nop_f == 2)
- module_connection();
while ((c = (*i_getc)(f)) != EOF)
(*o_putc)(c);
- (*o_putc)(EOF);
return 1;
}
-#endif
-void module_connection(void)
+
+void
+module_connection()
{
oconv = output_conv;
o_putc = std_putc;
@@ -2360,12 +1785,6 @@ void module_connection(void)
i_nungetc = i_ungetc; i_ungetc= numchar_ungetc;
}
#endif
-#ifdef UNICODE_NORMALIZATION
- if (nfc_f && input_f == UTF8_INPUT){
- i_nfc_getc = i_getc; i_getc = nfc_getc;
- i_nfc_ungetc = i_ungetc; i_ungetc= nfc_ungetc;
- }
-#endif
if (mime_f && mimebuf_f==FIXED_MIME) {
i_mgetc = i_getc; i_getc = mime_getc;
i_mungetc = i_ungetc; i_ungetc = mime_ungetc;
@@ -2381,8 +1800,6 @@ void module_connection(void)
#ifdef UTF8_INPUT_ENABLE
} else if (input_f == UTF8_INPUT) {
set_iconv(-TRUE, w_iconv);
- } else if (input_f == UTF16BE_INPUT) {
- set_iconv(-TRUE, w_iconv16);
} else if (input_f == UTF16LE_INPUT) {
set_iconv(-TRUE, w_iconv16);
#endif
@@ -2402,23 +1819,16 @@ void module_connection(void)
Conversion main loop. Code detection only.
*/
-nkf_char kanji_convert(FILE *f)
+int
+kanji_convert(f)
+ FILE *f;
{
- nkf_char c1,
+ int c1,
c2, c3;
- int is_8bit = FALSE;
module_connection();
c2 = 0;
- if(input_f == SJIS_INPUT
-#ifdef UTF8_INPUT_ENABLE
- || input_f == UTF8_INPUT || input_f == UTF16BE_INPUT || input_f == UTF16LE_INPUT
-#endif
- ){
- is_8bit = TRUE;
- }
-
input_mode = ASCII;
output_mode = ASCII;
@@ -2429,15 +1839,12 @@ nkf_char kanji_convert(FILE *f)
#define LAST break /* end of loop, go closing */
while ((c1 = (*i_getc)(f)) != EOF) {
-#ifdef INPUT_CODE_FIX
- if (!input_f)
-#endif
- code_status(c1);
+ code_status(c1);
if (c2) {
/* second byte */
if (c2 > DEL) {
/* in case of 8th bit is on */
- if (!estab_f&&!mime_decode_mode) {
+ if (!estab_f) {
/* in case of not established yet */
/* It is still ambiguious */
if (h_conv(f, c2, c1)==EOF)
@@ -2475,14 +1882,13 @@ nkf_char kanji_convert(FILE *f)
c1 = (*i_getc)(f);
SEND;
#ifdef NUMCHAR_OPTION
- } else if (is_unicode_capsule(c1)){
+ } else if ((c1 & CLASS_MASK) == CLASS_UTF16){
SEND;
#endif
} else if (c1 > DEL) {
/* 8 bit code */
if (!estab_f && !iso8859_f) {
/* not established yet */
- if (!is_8bit) is_8bit = TRUE;
c2 = c1;
NEXT;
} else { /* estab_f==TRUE */
@@ -2542,8 +1948,7 @@ nkf_char kanji_convert(FILE *f)
/* look like bogus code */
NEXT;
}
- } else if (input_mode == X0208 || input_mode == X0212 ||
- input_mode == X0213_1 || input_mode == X0213_2) {
+ } else if (input_mode == X0208) {
/* in case of Kanji shifted */
c2 = c1;
NEXT;
@@ -2573,13 +1978,13 @@ nkf_char kanji_convert(FILE *f)
/* normal ASCII code */
SEND;
}
- } else if (!is_8bit && c1 == SI) {
+ } else if (c1 == SI) {
shift_mode = FALSE;
NEXT;
- } else if (!is_8bit && c1 == SO) {
+ } else if (c1 == SO) {
shift_mode = TRUE;
NEXT;
- } else if (!is_8bit && c1 == ESC ) {
+ } else if (c1 == ESC ) {
if ((c1 = (*i_getc)(f)) == EOF) {
/* (*oconv)(0, ESC); don't send bogus code */
LAST;
@@ -2594,9 +1999,7 @@ nkf_char kanji_convert(FILE *f)
input_mode = X0208;
shift_mode = FALSE;
set_input_codename("ISO-2022-JP");
-#ifdef CHECK_OPTION
debug(input_codename);
-#endif
NEXT;
} else if (c1 == '(') {
if ((c1 = (*i_getc)(f)) == EOF) {
@@ -2611,20 +2014,6 @@ nkf_char kanji_convert(FILE *f)
input_mode = X0208;
shift_mode = FALSE;
NEXT;
-#ifdef X0212_ENABLE
- } else if (c1 == 'D'){
- input_mode = X0212;
- shift_mode = FALSE;
- NEXT;
-#endif /* X0212_ENABLE */
- } else if (c1 == (X0213_1&0x7F)){
- input_mode = X0213_1;
- shift_mode = FALSE;
- NEXT;
- } else if (c1 == (X0213_2&0x7F)){
- input_mode = X0213_2;
- shift_mode = FALSE;
- NEXT;
} else {
/* could be some special code */
(*oconv)(0, ESC);
@@ -2690,7 +2079,8 @@ nkf_char kanji_convert(FILE *f)
} else if ((c1 == NL || c1 == CR) && broken_f&4) {
input_mode = ASCII; set_iconv(FALSE, 0);
SEND;
- } else if (c1 == NL && mime_decode_f && !mime_decode_mode ) {
+ /*
+ } else if (c1 == NL && mime_f && !mime_decode_mode ) {
if ((c1=(*i_getc)(f))!=EOF && c1 == SPACE) {
i_ungetc(SPACE,f);
continue;
@@ -2699,7 +2089,7 @@ nkf_char kanji_convert(FILE *f)
}
c1 = NL;
SEND;
- } else if (c1 == CR && mime_decode_f && !mime_decode_mode ) {
+ } else if (c1 == CR && mime_f && !mime_decode_mode ) {
if ((c1=(*i_getc)(f))!=EOF) {
if (c1==SPACE) {
i_ungetc(SPACE,f);
@@ -2716,35 +2106,22 @@ nkf_char kanji_convert(FILE *f)
}
c1 = CR;
SEND;
+ */
} else
SEND;
}
/* send: */
- switch(input_mode){
- case ASCII:
- if ((*iconv)(c2, c1, 0) < 0){ /* can be EUC/SJIS */
- nkf_char c0 = (*i_getc)(f);
- if (c0 != EOF){
- code_status(c0);
- (*iconv)(c2, c1, c0);
- }
- }
- break;
- case X0208:
- case X0213_1:
- (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */
- break;
-#ifdef X0212_ENABLE
- case X0212:
- (*oconv)(PREFIX_EUCG3 | c2, c1);
- break;
-#endif /* X0212_ENABLE */
- case X0213_2:
- (*oconv)(PREFIX_EUCG3 | c2, c1);
- break;
- default:
- (*oconv)(input_mode, c1); /* other special case */
- }
+ if (input_mode == X0208)
+ (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */
+ else if (input_mode)
+ (*oconv)(input_mode, c1); /* other special case */
+ else if ((*iconv)(c2, c1, 0) < 0){ /* can be EUC/SJIS */
+ int c0 = (*i_getc)(f);
+ if (c0 != EOF){
+ code_status(c0);
+ (*iconv)(c2, c1, c0);
+ }
+ }
c2 = 0;
continue;
@@ -2753,25 +2130,16 @@ nkf_char kanji_convert(FILE *f)
/* epilogue */
(*iconv)(EOF, 0, 0);
- if (!is_inputcode_set)
- {
- if (is_8bit) {
- struct input_code *p = input_code_list;
- struct input_code *result = p;
- while (p->name){
- if (p->score < result->score) result = p;
- ++p;
- }
- set_input_codename(result->name);
- }
- }
return 1;
}
-nkf_char
-h_conv(FILE *f, nkf_char c2, nkf_char c1)
+int
+h_conv(f, c2, c1)
+ FILE *f;
+ int c1,
+ c2;
{
- nkf_char wc,c3;
+ int wc,c3;
/** it must NOT be in the kanji shifte sequence */
@@ -2781,6 +2149,7 @@ h_conv(FILE *f, nkf_char c2, nkf_char c1)
hold_count = 0;
push_hold_buf(c2);
push_hold_buf(c1);
+ c2 = 0;
while ((c1 = (*i_getc)(f)) != EOF) {
if (c1 == ESC){
@@ -2824,7 +2193,7 @@ h_conv(FILE *f, nkf_char c2, nkf_char c1)
c2 = hold_buf[wc++];
if (c2 <= DEL
#ifdef NUMCHAR_OPTION
- || is_unicode_capsule(c2)
+ || (c2 & CLASS_MASK) == CLASS_UTF16
#endif
){
(*iconv)(0, c2, 0);
@@ -2844,7 +2213,7 @@ h_conv(FILE *f, nkf_char c2, nkf_char c1)
code_status(c1);
}
if ((*iconv)(c2, c1, 0) < 0){
- nkf_char c0;
+ int c0;
if (wc < hold_count){
c0 = hold_buf[wc++];
}else{
@@ -2856,6 +2225,7 @@ h_conv(FILE *f, nkf_char c2, nkf_char c1)
code_status(c0);
}
(*iconv)(c2, c1, c0);
+ c1 = c0;
}
}
return c3;
@@ -2863,118 +2233,65 @@ h_conv(FILE *f, nkf_char c2, nkf_char c1)
-nkf_char
-push_hold_buf(nkf_char c2)
+int
+push_hold_buf(c2)
+ int c2;
{
if (hold_count >= HOLD_SIZE*2)
return (EOF);
- hold_buf[hold_count++] = (unsigned char)c2;
+ hold_buf[hold_count++] = c2;
return ((hold_count >= HOLD_SIZE*2) ? EOF : hold_count);
}
-nkf_char s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
+int s2e_conv(c2, c1, p2, p1)
+ int c2, c1;
+ int *p2, *p1;
{
-#if defined(SHIFTJIS_CP932) || defined(X0212_ENABLE)
- nkf_char val;
-#endif
- static const nkf_char shift_jisx0213_s1a3_table[5][2] ={ { 1, 8}, { 3, 4}, { 5,12}, {13,14}, {15, 0} };
#ifdef SHIFTJIS_CP932
- if (cp51932_f && is_ibmext_in_sjis(c2)){
-#if 0
- extern const unsigned short shiftjis_cp932[3][189];
-#endif
- val = shiftjis_cp932[c2 - CP932_TABLE_BEGIN][c1 - 0x40];
- if (val){
- c2 = val >> 8;
- c1 = val & 0xff;
- }
+ if (cp932_f && CP932_TABLE_BEGIN <= c2 && c2 <= CP932_TABLE_END){
+ extern unsigned short shiftjis_cp932[3][189];
+ c1 = shiftjis_cp932[c2 - CP932_TABLE_BEGIN][c1 - 0x40];
+ if (c1 == 0) return 1;
+ c2 = c1 >> 8;
+ c1 &= 0xff;
}
#endif /* SHIFTJIS_CP932 */
-#ifdef X0212_ENABLE
- if (!x0213_f && is_ibmext_in_sjis(c2)){
-#if 0
- extern const unsigned short shiftjis_x0212[3][189];
-#endif
- val = shiftjis_x0212[c2 - 0xfa][c1 - 0x40];
- if (val){
- if (val > 0x7FFF){
- c2 = PREFIX_EUCG3 | (val >> 8);
- c1 = val & 0xff;
- }else{
- c2 = val >> 8;
- c1 = val & 0xff;
- }
- if (p2) *p2 = c2;
- if (p1) *p1 = c1;
- return 0;
- }
+ c2 = c2 + c2 - ((c2 <= 0x9f) ? SJ0162 : SJ6394);
+ if (c1 < 0x9f)
+ c1 = c1 - ((c1 > DEL) ? SPACE : 0x1f);
+ else {
+ c1 = c1 - 0x7e;
+ c2++;
}
-#endif
- if(c2 >= 0x80){
- if(x0213_f && c2 >= 0xF0){
- if(c2 <= 0xF3 || (c2 == 0xF4 && c1 < 0x9F)){ /* k=1, 3<=k<=5, k=8, 12<=k<=15 */
- c2 = PREFIX_EUCG3 | 0x20 | shift_jisx0213_s1a3_table[c2 - 0xF0][0x9E < c1];
- }else{ /* 78<=k<=94 */
- c2 = PREFIX_EUCG3 | (c2 * 2 - 0x17B);
- if (0x9E < c1) c2++;
- }
- }else{
- c2 = c2 + c2 - ((c2 <= 0x9F) ? SJ0162 : SJ6394);
- if (0x9E < c1) c2++;
- }
- if (c1 < 0x9F)
- c1 = c1 - ((c1 > DEL) ? SPACE : 0x1F);
- else {
- c1 = c1 - 0x7E;
- }
- }
-
-#ifdef X0212_ENABLE
- c2 = x0212_unshift(c2);
-#endif
if (p2) *p2 = c2;
if (p1) *p1 = c1;
return 0;
}
-nkf_char s_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
+int
+s_iconv(c2, c1, c0)
+ int c2,
+ c1, c0;
{
if (c2 == X0201) {
c1 &= 0x7f;
} else if ((c2 == EOF) || (c2 == 0) || c2 < SPACE) {
/* NOP */
} else {
- nkf_char ret = s2e_conv(c2, c1, &c2, &c1);
+ int ret = s2e_conv(c2, c1, &c2, &c1);
if (ret) return ret;
}
(*oconv)(c2, c1);
return 0;
}
-nkf_char e_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
+int
+e_iconv(c2, c1, c0)
+ int c2,
+ c1, c0;
{
if (c2 == X0201) {
c1 &= 0x7f;
-#ifdef X0212_ENABLE
- }else if (c2 == 0x8f){
- if (c0 == 0){
- return -1;
- }
- c2 = (c2 << 8) | (c1 & 0x7f);
- c1 = c0 & 0x7f;
-#ifdef SHIFTJIS_CP932
- if (cp51932_f){
- nkf_char s2, s1;
- if (e2s_conv(c2, c1, &s2, &s1) == 0){
- s2e_conv(s2, s1, &c2, &c1);
- if (c2 < 0x100){
- c1 &= 0x7f;
- c2 &= 0x7f;
- }
- }
- }
-#endif /* SHIFTJIS_CP932 */
-#endif /* X0212_ENABLE */
} else if (c2 == SSO){
c2 = X0201;
c1 &= 0x7f;
@@ -2989,80 +2306,58 @@ nkf_char e_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
}
#ifdef UTF8_INPUT_ENABLE
-nkf_char w2e_conv(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
+int
+w2e_conv(c2, c1, c0, p2, p1)
+ int c2, c1, c0;
+ int *p2, *p1;
{
- nkf_char ret = 0;
+ extern unsigned short * utf8_to_euc_2bytes[];
+ extern unsigned short ** utf8_to_euc_3bytes[];
+ int ret = 0;
- if (!c1){
- *p2 = 0;
- *p1 = c2;
- }else if (0xc0 <= c2 && c2 <= 0xef) {
- ret = unicode_to_jis_common(c2, c1, c0, p2, p1);
+ if (0xc0 <= c2 && c2 <= 0xef) {
+ unsigned short **pp;
+
+ if (0xe0 <= c2) {
+ if (c0 == 0) return -1;
+ pp = utf8_to_euc_3bytes[c2 - 0x80];
+ ret = w_iconv_common(c1, c0, pp, sizeof_utf8_to_euc_C2, p2, p1);
+ } else {
+ ret = w_iconv_common(c2, c1, utf8_to_euc_2bytes, sizeof_utf8_to_euc_2bytes, p2, p1);
+ }
#ifdef NUMCHAR_OPTION
- if (ret > 0){
+ if (ret){
if (p2) *p2 = 0;
if (p1) *p1 = CLASS_UTF16 | ww16_conv(c2, c1, c0);
ret = 0;
}
#endif
+ return ret;
+ } else if (c2 == X0201) {
+ c1 &= 0x7f;
}
+ if (p2) *p2 = c2;
+ if (p1) *p1 = c1;
return ret;
}
-nkf_char w_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
+int
+w_iconv(c2, c1, c0)
+ int c2,
+ c1, c0;
{
- nkf_char ret = 0;
-
- /* throw away ZERO WIDTH NO-BREAK SPACE (U+FEFF) */
- if(ignore_zwnbsp_f){
- ignore_zwnbsp_f = FALSE;
- if(c2 == 0xef && c1 == 0xbb && c0 == 0xbf)
- return 0;
- }
-
- if (c2 == 0) /* 0x00-0x7f */
- c1 &= 0x7F; /* 1byte */
- else if (c0 == 0){
- if ((c2 & 0xe0) == 0xc0){ /* 0xc0-0xdf */
- /* 2ytes */
- if((c2 & 0xFE) == 0xC0 || c1 < 0x80 || 0xBF < c1) return 0;
- }else if ((c2 & 0xf0) == 0xe0) /* 0xe0-0xef */
- return -1; /* 3bytes */
-#ifdef __COMMENT__
- else if (0xf0 <= c2)
- return 0; /* 4,5,6bytes */
- else if ((c2 & 0xc0) == 0x80) /* 0x80-0xbf */
- return 0; /* trail byte */
-#endif
- else return 0;
- }else{
- /* must be 3bytes */
- if(c2 == 0xE0){
- if(c1 < 0xA0 || 0xBF < c1 || c0 < 0x80 || 0xBF < c0)
- return 0;
- }else if(c2 == 0xED){
- if(c1 < 0x80 || 0x9F < c1 || c0 < 0x80 || 0xBF < c0)
- return 0;
- }else if((c2 & 0xf0) == 0xe0){
- if(c1 < 0x80 || 0xBF < c1 || c0 < 0x80 || 0xBF < c0)
- return 0;
- }else return 0;
- }
- if (c2 == 0 || c2 == EOF){
- } else {
- ret = w2e_conv(c2, c1, c0, &c2, &c1);
- }
+ int ret = w2e_conv(c2, c1, c0, &c2, &c1);
if (ret == 0){
(*oconv)(c2, c1);
}
return ret;
}
-#endif
-#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
-void w16w_conv(nkf_char val, nkf_char *p2, nkf_char *p1, nkf_char *p0)
+void
+w16w_conv(val, p2, p1, p0)
+ unsigned short val;
+ int *p2, *p1, *p0;
{
- val &= VALUE_MASK;
if (val < 0x80){
*p2 = val;
*p1 = 0;
@@ -3071,228 +2366,101 @@ void w16w_conv(nkf_char val, nkf_char *p2, nkf_char *p1, nkf_char *p0)
*p2 = 0xc0 | (val >> 6);
*p1 = 0x80 | (val & 0x3f);
*p0 = 0;
- } else if (val <= NKF_INT32_C(0xFFFF)) {
+ }else{
*p2 = 0xe0 | (val >> 12);
*p1 = 0x80 | ((val >> 6) & 0x3f);
*p0 = 0x80 | (val & 0x3f);
- } else {
- *p2 = 0;
- *p1 = 0;
- *p0 = 0;
}
}
-#endif
-#ifdef UTF8_INPUT_ENABLE
-nkf_char ww16_conv(nkf_char c2, nkf_char c1, nkf_char c0)
+int
+ww16_conv(c2, c1, c0)
+ int c2, c1, c0;
{
- nkf_char val;
- if (c2 >= 0xf0){
- val = -1;
- }else if (c2 >= 0xe0){
+ unsigned short val;
+ if (c2 >= 0xe0){
val = (c2 & 0x0f) << 12;
val |= (c1 & 0x3f) << 6;
val |= (c0 & 0x3f);
}else if (c2 >= 0xc0){
val = (c2 & 0x1f) << 6;
- val |= (c1 & 0x3f);
+ val |= (c1 & 0x3f) << 6;
}else{
val = c2;
}
return val;
}
-nkf_char w16e_conv(nkf_char val, nkf_char *p2, nkf_char *p1)
+int
+w16e_conv(val, p2, p1)
+ unsigned short val;
+ int *p2, *p1;
{
- nkf_char c2, c1, c0;
- nkf_char ret = 0;
- val &= VALUE_MASK;
- if (val < 0x80){
- *p2 = 0;
- *p1 = val;
- }else{
- w16w_conv(val, &c2, &c1, &c0);
- ret = unicode_to_jis_common(c2, c1, c0, p2, p1);
+ extern unsigned short * utf8_to_euc_2bytes[];
+ extern unsigned short ** utf8_to_euc_3bytes[];
+ int c2, c1, c0;
+ unsigned short **pp;
+ int psize;
+ int ret = 0;
+
+ w16w_conv(val, &c2, &c1, &c0);
+ if (c1){
+ if (c0){
+ pp = utf8_to_euc_3bytes[c2 - 0x80];
+ psize = sizeof_utf8_to_euc_C2;
+ ret = w_iconv_common(c1, c0, pp, psize, p2, p1);
+ }else{
+ pp = utf8_to_euc_2bytes;
+ psize = sizeof_utf8_to_euc_2bytes;
+ ret = w_iconv_common(c2, c1, pp, psize, p2, p1);
+ }
#ifdef NUMCHAR_OPTION
- if (ret > 0){
- *p2 = 0;
- *p1 = CLASS_UTF16 | val;
- ret = 0;
- }
+ if (ret){
+ *p2 = 0;
+ *p1 = CLASS_UTF16 | val;
+ ret = 0;
+ }
#endif
}
return ret;
}
-#endif
-#ifdef UTF8_INPUT_ENABLE
-nkf_char w_iconv16(nkf_char c2, nkf_char c1, nkf_char c0)
+int
+w_iconv16(c2, c1, c0)
+ int c2, c1,c0;
{
- nkf_char ret;
+ int ret;
- /* throw away ZERO WIDTH NO-BREAK SPACE (U+FEFF) */
- if(ignore_zwnbsp_f){
- ignore_zwnbsp_f = FALSE;
- if (c2==0376 && c1==0377){
- utf16_mode = UTF16BE_INPUT;
- return 0;
- }else if(c2==0377 && c1==0376){
- utf16_mode = UTF16LE_INPUT;
- return 0;
- }
+ if (c2==0376 && c1==0377){
+ utf16_mode = UTF16LE_INPUT;
+ return 0;
+ } else if (c2==0377 && c1==0376){
+ utf16_mode = UTF16BE_INPUT;
+ return 0;
}
- if (c2 != EOF && utf16_mode == UTF16LE_INPUT) {
- nkf_char tmp;
+ if (c2 != EOF && utf16_mode == UTF16BE_INPUT) {
+ int tmp;
tmp=c1; c1=c2; c2=tmp;
}
if ((c2==0 && c1 < 0x80) || c2==EOF) {
(*oconv)(c2, c1);
return 0;
- }else if((c2>>3)==27){ /* surrogate pair */
- return 1;
- }else ret = w16e_conv(((c2 & 0xff)<<8) + c1, &c2, &c1);
+ }
+ ret = w16e_conv(((c2<<8)&0xff00) + c1, &c2, &c1);
if (ret) return ret;
(*oconv)(c2, c1);
return 0;
}
-nkf_char unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
+int
+w_iconv_common(c1, c0, pp, psize, p2, p1)
+ int c1,c0;
+ unsigned short **pp;
+ int psize;
+ int *p2, *p1;
{
-#if 0
- extern const unsigned short *const utf8_to_euc_2bytes[];
- extern const unsigned short *const utf8_to_euc_2bytes_ms[];
- extern const unsigned short *const utf8_to_euc_2bytes_932[];
- extern const unsigned short *const *const utf8_to_euc_3bytes[];
- extern const unsigned short *const *const utf8_to_euc_3bytes_ms[];
- extern const unsigned short *const *const utf8_to_euc_3bytes_932[];
-#endif
- const unsigned short *const *pp;
- const unsigned short *const *const *ppp;
- static const int no_best_fit_chars_table_C2[] =
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 2,
- 0, 0, 1, 1, 0, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1};
- static const int no_best_fit_chars_table_C2_ms[] =
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0};
- static const int no_best_fit_chars_table_932_C2[] =
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0};
- static const int no_best_fit_chars_table_932_C3[] =
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1};
- nkf_char ret = 0;
-
- if(c2 < 0x80){
- *p2 = 0;
- *p1 = c2;
- }else if(c2 < 0xe0){
- if(no_best_fit_chars_f){
- if(ms_ucs_map_f == UCS_MAP_CP932){
- switch(c2){
- case 0xC2:
- if(no_best_fit_chars_table_932_C2[c1&0x3F]) return 1;
- break;
- case 0xC3:
- if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
- break;
- }
- }else if(cp51932_f){
- switch(c2){
- case 0xC2:
- if(no_best_fit_chars_table_C2[c1&0x3F]) return 1;
- break;
- case 0xC3:
- if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
- break;
- }
- }else if(ms_ucs_map_f == UCS_MAP_MS){
- if(c2 == 0xC2 && no_best_fit_chars_table_C2_ms[c1&0x3F]) return 1;
- }
- }
- pp =
- ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_2bytes_932 :
- ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_2bytes_ms :
- utf8_to_euc_2bytes;
- ret = w_iconv_common(c2, c1, pp, sizeof_utf8_to_euc_2bytes, p2, p1);
- }else if(c0 < 0xF0){
- if(no_best_fit_chars_f){
- if(ms_ucs_map_f == UCS_MAP_CP932){
- if(c2 == 0xE3 && c1 == 0x82 && c0 == 0x94) return 1;
- }else if(ms_ucs_map_f == UCS_MAP_MS){
- switch(c2){
- case 0xE2:
- switch(c1){
- case 0x80:
- if(c0 == 0x94 || c0 == 0x96 || c0 == 0xBE) return 1;
- break;
- case 0x88:
- if(c0 == 0x92) return 1;
- break;
- }
- break;
- case 0xE3:
- if(c1 == 0x80 || c0 == 0x9C) return 1;
- break;
- }
- }else{
- switch(c2){
- case 0xE2:
- switch(c1){
- case 0x80:
- if(c0 == 0x95) return 1;
- break;
- case 0x88:
- if(c0 == 0xA5) return 1;
- break;
- }
- break;
- case 0xEF:
- switch(c1){
- case 0xBC:
- if(c0 == 0x8D) return 1;
- break;
- case 0xBD:
- if(c0 == 0x9E && cp51932_f) return 1;
- break;
- case 0xBF:
- if(0xA0 <= c0 && c0 <= 0xA5) return 1;
- break;
- }
- break;
- }
- }
- }
- ppp =
- ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_3bytes_932 :
- ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_3bytes_ms :
- utf8_to_euc_3bytes;
- ret = w_iconv_common(c1, c0, ppp[c2 - 0xE0], sizeof_utf8_to_euc_C2, p2, p1);
- }else return -1;
-#ifdef SHIFTJIS_CP932
- if (!ret && cp51932_f && is_eucg3(*p2)) {
- nkf_char s2, s1;
- if (e2s_conv(*p2, *p1, &s2, &s1) == 0) {
- s2e_conv(s2, s1, p2, p1);
- }else{
- ret = 1;
- }
- }
-#endif
- return ret;
-}
-
-nkf_char w_iconv_common(nkf_char c1, nkf_char c0, const unsigned short *const *pp, nkf_char psize, nkf_char *p2, nkf_char *p1)
-{
- nkf_char c2;
- const unsigned short *p;
+ int c2;
+ unsigned short *p ;
unsigned short val;
if (pp == 0) return 1;
@@ -3303,19 +2471,11 @@ nkf_char w_iconv_common(nkf_char c1, nkf_char c0, const unsigned short *const *p
if (p == 0) return 1;
c0 -= 0x80;
- if (c0 < 0 || sizeof_utf8_to_euc_C2 <= c0) return 1;
+ if (c0 < 0 || sizeof_utf8_to_euc_E5B8 <= c0) return 1;
val = p[c0];
if (val == 0) return 1;
- if (no_cp932ext_f && (
- (val>>8) == 0x2D || /* NEC special characters */
- val > NKF_INT32_C(0xF300) /* IBM extended characters */
- )) return 1;
c2 = val >> 8;
- if (val > 0x7FFF){
- c2 &= 0x7f;
- c2 |= PREFIX_EUCG3;
- }
if (c2 == SO) c2 = X0201;
c1 = val & 0x7f;
if (p2) *p2 = c2;
@@ -3323,125 +2483,25 @@ nkf_char w_iconv_common(nkf_char c1, nkf_char c0, const unsigned short *const *p
return 0;
}
-void nkf_each_char_to_hex(void (*f)(nkf_char c2,nkf_char c1), nkf_char c)
-{
- const char *hex = "0123456789ABCDEF";
- int shift = 20;
- c &= VALUE_MASK;
- while(shift >= 0){
- if(c >= 1<<shift){
- while(shift >= 0){
- (*f)(0, hex[(c>>shift)&0xF]);
- shift -= 4;
- }
- }else{
- shift -= 4;
- }
- }
- return;
-}
-
-void encode_fallback_html(nkf_char c)
-{
- (*oconv)(0, '&');
- (*oconv)(0, '#');
- c &= VALUE_MASK;
- if(c >= NKF_INT32_C(1000000))
- (*oconv)(0, 0x30+(c/NKF_INT32_C(1000000))%10);
- if(c >= NKF_INT32_C(100000))
- (*oconv)(0, 0x30+(c/NKF_INT32_C(100000) )%10);
- if(c >= 10000)
- (*oconv)(0, 0x30+(c/10000 )%10);
- if(c >= 1000)
- (*oconv)(0, 0x30+(c/1000 )%10);
- if(c >= 100)
- (*oconv)(0, 0x30+(c/100 )%10);
- if(c >= 10)
- (*oconv)(0, 0x30+(c/10 )%10);
- if(c >= 0)
- (*oconv)(0, 0x30+ c %10);
- (*oconv)(0, ';');
- return;
-}
-
-void encode_fallback_xml(nkf_char c)
-{
- (*oconv)(0, '&');
- (*oconv)(0, '#');
- (*oconv)(0, 'x');
- nkf_each_char_to_hex(oconv, c);
- (*oconv)(0, ';');
- return;
-}
-
-void encode_fallback_java(nkf_char c)
-{
- const char *hex = "0123456789ABCDEF";
- (*oconv)(0, '\\');
- c &= VALUE_MASK;
- if(!is_unicode_bmp(c)){
- (*oconv)(0, 'U');
- (*oconv)(0, '0');
- (*oconv)(0, '0');
- (*oconv)(0, hex[(c>>20)&0xF]);
- (*oconv)(0, hex[(c>>16)&0xF]);
- }else{
- (*oconv)(0, 'u');
- }
- (*oconv)(0, hex[(c>>12)&0xF]);
- (*oconv)(0, hex[(c>> 8)&0xF]);
- (*oconv)(0, hex[(c>> 4)&0xF]);
- (*oconv)(0, hex[ c &0xF]);
- return;
-}
-
-void encode_fallback_perl(nkf_char c)
-{
- (*oconv)(0, '\\');
- (*oconv)(0, 'x');
- (*oconv)(0, '{');
- nkf_each_char_to_hex(oconv, c);
- (*oconv)(0, '}');
- return;
-}
-
-void encode_fallback_subchar(nkf_char c)
-{
- c = unicode_subchar;
- (*oconv)((c>>8)&0xFF, c&0xFF);
- return;
-}
#endif
#ifdef UTF8_OUTPUT_ENABLE
-nkf_char e2w_conv(nkf_char c2, nkf_char c1)
+int
+e2w_conv(c2, c1)
+ int c2, c1;
{
-#if 0
- extern const unsigned short euc_to_utf8_1byte[];
- extern const unsigned short *const euc_to_utf8_2bytes[];
- extern const unsigned short *const euc_to_utf8_2bytes_ms[];
- extern const unsigned short *const x0212_to_utf8_2bytes[];
-#endif
- const unsigned short *p;
+ extern unsigned short euc_to_utf8_1byte[];
+ extern unsigned short * euc_to_utf8_2bytes[];
+ extern unsigned short * euc_to_utf8_2bytes_ms[];
+ unsigned short *p;
if (c2 == X0201) {
p = euc_to_utf8_1byte;
-#ifdef X0212_ENABLE
- } else if (is_eucg3(c2)){
- if(ms_ucs_map_f == UCS_MAP_ASCII&& c2 == NKF_INT32_C(0x8F22) && c1 == 0x43){
- return 0xA6;
- }
- c2 = (c2&0x7f) - 0x21;
- if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes)
- p = x0212_to_utf8_2bytes[c2];
- else
- return 0;
-#endif
} else {
c2 &= 0x7f;
c2 = (c2&0x7f) - 0x21;
if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes)
- p = ms_ucs_map_f != UCS_MAP_ASCII ? euc_to_utf8_2bytes_ms[c2] : euc_to_utf8_2bytes[c2];
+ p = ms_ucs_map_f ? euc_to_utf8_2bytes_ms[c2] : euc_to_utf8_2bytes[c2];
else
return 0;
}
@@ -3452,10 +2512,22 @@ nkf_char e2w_conv(nkf_char c2, nkf_char c1)
return 0;
}
-void w_oconv(nkf_char c2, nkf_char c1)
+void
+w_oconv(c2, c1)
+ int c2,
+ c1;
{
- nkf_char c0;
- nkf_char val;
+ int c0;
+#ifdef NUMCHAR_OPTION
+ if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){
+ w16w_conv(c1, &c2, &c1, &c0);
+ (*o_putc)(c2);
+ if (c1){
+ (*o_putc)(c1);
+ if (c0) (*o_putc)(c0);
+ }
+ }
+#endif
if (c2 == EOF) {
(*o_putc)(EOF);
return;
@@ -3468,28 +2540,6 @@ void w_oconv(nkf_char c2, nkf_char c1)
unicode_bom_f=1;
}
-#ifdef NUMCHAR_OPTION
- if (c2 == 0 && is_unicode_capsule(c1)){
- val = c1 & VALUE_MASK;
- if (val < 0x80){
- (*o_putc)(val);
- }else if (val < 0x800){
- (*o_putc)(0xC0 | (val >> 6));
- (*o_putc)(0x80 | (val & 0x3f));
- } else if (val <= NKF_INT32_C(0xFFFF)) {
- (*o_putc)(0xE0 | (val >> 12));
- (*o_putc)(0x80 | ((val >> 6) & 0x3f));
- (*o_putc)(0x80 | (val & 0x3f));
- } else if (val <= NKF_INT32_C(0x10FFFF)) {
- (*o_putc)(0xE0 | ( val>>18));
- (*o_putc)(0x80 | ((val>>12) & 0x3f));
- (*o_putc)(0x80 | ((val>> 6) & 0x3f));
- (*o_putc)(0x80 | ( val & 0x3f));
- }
- return;
- }
-#endif
-
if (c2 == 0) {
output_mode = ASCII;
(*o_putc)(c1);
@@ -3498,19 +2548,19 @@ void w_oconv(nkf_char c2, nkf_char c1)
(*o_putc)(c1 | 0x080);
} else {
output_mode = UTF8;
- val = e2w_conv(c2, c1);
- if (val){
- w16w_conv(val, &c2, &c1, &c0);
- (*o_putc)(c2);
- if (c1){
- (*o_putc)(c1);
- if (c0) (*o_putc)(c0);
- }
+ w16w_conv((unsigned short)e2w_conv(c2, c1), &c2, &c1, &c0);
+ (*o_putc)(c2);
+ if (c1){
+ (*o_putc)(c1);
+ if (c0) (*o_putc)(c0);
}
}
}
-void w_oconv16(nkf_char c2, nkf_char c1)
+void
+w_oconv16(c2, c1)
+ int c2,
+ c1;
{
if (c2 == EOF) {
(*o_putc)(EOF);
@@ -3532,32 +2582,12 @@ void w_oconv16(nkf_char c2, nkf_char c1)
c2 = 0;
c1 |= 0x80;
#ifdef NUMCHAR_OPTION
- } else if (c2 == 0 && is_unicode_capsule(c1)) {
- if (is_unicode_bmp(c1)) {
- c2 = (c1 >> 8) & 0xff;
- c1 &= 0xff;
- } else {
- c1 &= VALUE_MASK;
- if (c1 <= UNICODE_MAX) {
- c2 = (c1 >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */
- c1 = (c1 & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */
- if (w_oconv16_LE){
- (*o_putc)(c2 & 0xff);
- (*o_putc)((c2 >> 8) & 0xff);
- (*o_putc)(c1 & 0xff);
- (*o_putc)((c1 >> 8) & 0xff);
- }else{
- (*o_putc)((c2 >> 8) & 0xff);
- (*o_putc)(c2 & 0xff);
- (*o_putc)((c1 >> 8) & 0xff);
- (*o_putc)(c1 & 0xff);
- }
- }
- return;
- }
+ } else if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16) {
+ c2 = (c1 >> 8) & 0xff;
+ c1 &= 0xff;
#endif
} else if (c2) {
- nkf_char val = e2w_conv(c2, c1);
+ unsigned short val = (unsigned short)e2w_conv(c2, c1);
c2 = (val >> 8) & 0xff;
c1 = val & 0xff;
}
@@ -3572,15 +2602,14 @@ void w_oconv16(nkf_char c2, nkf_char c1)
#endif
-void e_oconv(nkf_char c2, nkf_char c1)
+void
+e_oconv(c2, c1)
+ int c2,
+ c1;
{
#ifdef NUMCHAR_OPTION
- if (c2 == 0 && is_unicode_capsule(c1)){
+ if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){
w16e_conv(c1, &c2, &c1);
- if (c2 == 0 && is_unicode_capsule(c1)){
- if(encode_fallback)(*encode_fallback)(c1);
- return;
- }
}
#endif
if (c2 == EOF) {
@@ -3595,33 +2624,9 @@ void e_oconv(nkf_char c2, nkf_char c1)
} else if (c2 == ISO8859_1) {
output_mode = ISO8859_1;
(*o_putc)(c1 | 0x080);
-#ifdef X0212_ENABLE
- } else if (is_eucg3(c2)){
- output_mode = JAPANESE_EUC;
-#ifdef SHIFTJIS_CP932
- if (cp51932_f){
- nkf_char s2, s1;
- if (e2s_conv(c2, c1, &s2, &s1) == 0){
- s2e_conv(s2, s1, &c2, &c1);
- }
- }
-#endif
- if (c2 == 0) {
- output_mode = ASCII;
- (*o_putc)(c1);
- }else if (is_eucg3(c2)){
- if (x0212_f){
- (*o_putc)(0x8f);
- (*o_putc)((c2 & 0x7f) | 0x080);
- (*o_putc)(c1 | 0x080);
- }
- }else{
- (*o_putc)((c2 & 0x7f) | 0x080);
- (*o_putc)(c1 | 0x080);
- }
-#endif
} else {
- if (!nkf_isgraph(c1) || !nkf_isgraph(c2)) {
+ if ((c1<0x21 || 0x7e<c1) ||
+ (c2<0x21 || 0x7e<c2)) {
set_iconv(FALSE, 0);
return; /* too late to rescue this char */
}
@@ -3631,90 +2636,22 @@ void e_oconv(nkf_char c2, nkf_char c1)
}
}
-#ifdef X0212_ENABLE
-nkf_char x0212_shift(nkf_char c)
-{
- nkf_char ret = c;
- c &= 0x7f;
- if (is_eucg3(ret)){
- if (0x75 <= c && c <= 0x7f){
- ret = c + (0x109 - 0x75);
- }
- }else{
- if (0x75 <= c && c <= 0x7f){
- ret = c + (0x113 - 0x75);
- }
- }
- return ret;
-}
-
-
-nkf_char x0212_unshift(nkf_char c)
-{
- nkf_char ret = c;
- if (0x7f <= c && c <= 0x88){
- ret = c + (0x75 - 0x7f);
- }else if (0x89 <= c && c <= 0x92){
- ret = PREFIX_EUCG3 | 0x80 | (c + (0x75 - 0x89));
- }
- return ret;
-}
-#endif /* X0212_ENABLE */
-
-nkf_char e2s_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
+void
+e2s_conv(c2, c1, p2, p1)
+ int c2, c1, *p2, *p1;
{
- nkf_char ndx;
- if (is_eucg3(c2)){
- ndx = c2 & 0xff;
- if (x0213_f){
- if((0x21 <= ndx && ndx <= 0x2F)){
- if (p2) *p2 = ((ndx - 1) >> 1) + 0xec - ndx / 8 * 3;
- if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
- return 0;
- }else if(0x6E <= ndx && ndx <= 0x7E){
- if (p2) *p2 = ((ndx - 1) >> 1) + 0xbe;
- if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
- return 0;
- }
- return 1;
- }
-#ifdef X0212_ENABLE
- else if(nkf_isgraph(ndx)){
- nkf_char val = 0;
- const unsigned short *ptr;
-#if 0
- extern const unsigned short *const x0212_shiftjis[];
-#endif
- ptr = x0212_shiftjis[ndx - 0x21];
- if (ptr){
- val = ptr[(c1 & 0x7f) - 0x21];
- }
- if (val){
- c2 = val >> 8;
- c1 = val & 0xff;
- if (p2) *p2 = c2;
- if (p1) *p1 = c1;
- return 0;
- }
- c2 = x0212_shift(c2);
- }
-#endif /* X0212_ENABLE */
- }
- if(0x7F < c2) return 1;
if (p2) *p2 = ((c2 - 1) >> 1) + ((c2 <= 0x5e) ? 0x71 : 0xb1);
if (p1) *p1 = c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
- return 0;
}
-void s_oconv(nkf_char c2, nkf_char c1)
+void
+s_oconv(c2, c1)
+ int c2,
+ c1;
{
#ifdef NUMCHAR_OPTION
- if (c2 == 0 && is_unicode_capsule(c1)){
+ if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){
w16e_conv(c1, &c2, &c1);
- if (c2 == 0 && is_unicode_capsule(c1)){
- if(encode_fallback)(*encode_fallback)(c1);
- return;
- }
}
#endif
if (c2 == EOF) {
@@ -3729,16 +2666,9 @@ void s_oconv(nkf_char c2, nkf_char c1)
} else if (c2 == ISO8859_1) {
output_mode = ISO8859_1;
(*o_putc)(c1 | 0x080);
-#ifdef X0212_ENABLE
- } else if (is_eucg3(c2)){
- output_mode = SHIFT_JIS;
- if (e2s_conv(c2, c1, &c2, &c1) == 0){
- (*o_putc)(c2);
- (*o_putc)(c1);
- }
-#endif
} else {
- if (!nkf_isprint(c1) || !nkf_isprint(c2)) {
+ if ((c1<0x20 || 0x7e<c1) ||
+ (c2<0x20 || 0x7e<c2)) {
set_iconv(FALSE, 0);
return; /* too late to rescue this char */
}
@@ -3748,10 +2678,8 @@ void s_oconv(nkf_char c2, nkf_char c1)
#ifdef SHIFTJIS_CP932
if (cp932inv_f
&& CP932INV_TABLE_BEGIN <= c2 && c2 <= CP932INV_TABLE_END){
-#if 0
- extern const unsigned short cp932inv[2][189];
-#endif
- nkf_char c = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
+ extern unsigned short cp932inv[2][189];
+ int c = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
if (c){
c2 = c >> 8;
c1 = c & 0xff;
@@ -3767,15 +2695,14 @@ void s_oconv(nkf_char c2, nkf_char c1)
}
}
-void j_oconv(nkf_char c2, nkf_char c1)
+void
+j_oconv(c2, c1)
+ int c2,
+ c1;
{
#ifdef NUMCHAR_OPTION
- if (c2 == 0 && is_unicode_capsule(c1)){
+ if ((c1 & CLASS_MASK) == CLASS_UTF16){
w16e_conv(c1, &c2, &c1);
- if (c2 == 0 && is_unicode_capsule(c1)){
- if(encode_fallback)(*encode_fallback)(c1);
- return;
- }
}
#endif
if (c2 == EOF) {
@@ -3786,28 +2713,6 @@ void j_oconv(nkf_char c2, nkf_char c1)
output_mode = ASCII;
}
(*o_putc)(EOF);
-#ifdef X0212_ENABLE
- } else if (is_eucg3(c2)){
- if(x0213_f){
- if(output_mode!=X0213_2){
- output_mode = X0213_2;
- (*o_putc)(ESC);
- (*o_putc)('$');
- (*o_putc)('(');
- (*o_putc)(X0213_2&0x7F);
- }
- }else{
- if(output_mode!=X0212){
- output_mode = X0212;
- (*o_putc)(ESC);
- (*o_putc)('$');
- (*o_putc)('(');
- (*o_putc)(X0212&0x7F);
- }
- }
- (*o_putc)(c2 & 0x7f);
- (*o_putc)(c1);
-#endif
} else if (c2==X0201) {
if (output_mode!=X0201) {
output_mode = X0201;
@@ -3831,39 +2736,46 @@ void j_oconv(nkf_char c2, nkf_char c1)
}
(*o_putc)(c1);
} else {
- if(c2<0x20 || 0x7e<c2 || c1<0x20 || 0x7e<c1) return;
- if(x0213_f){
- if (output_mode!=X0213_1) {
- output_mode = X0213_1;
- (*o_putc)(ESC);
- (*o_putc)('$');
- (*o_putc)('(');
- (*o_putc)(X0213_1&0x7F);
- }
- }else if (output_mode != X0208) {
+ if (output_mode != X0208) {
output_mode = X0208;
(*o_putc)(ESC);
(*o_putc)('$');
(*o_putc)(kanji_intro);
}
+ if (c1<0x20 || 0x7e<c1)
+ return;
+ if (c2<0x20 || 0x7e<c2)
+ return;
(*o_putc)(c2);
(*o_putc)(c1);
}
}
-void base64_conv(nkf_char c2, nkf_char c1)
+void
+base64_conv(c2, c1)
+ int c2,
+ c1;
{
- mime_prechar(c2, c1);
+ if (base64_count>50 && !mimeout_mode && c2==0 && c1==SPACE) {
+ (*o_putc)(EOF);
+ (*o_putc)(NL);
+ } else if (base64_count>66 && mimeout_mode) {
+ (*o_base64conv)(EOF,0);
+ (*o_base64conv)(NL,0);
+ (*o_base64conv)(SPACE,0);
+ }
(*o_base64conv)(c2,c1);
}
-static nkf_char broken_buf[3];
+static int broken_buf[3];
static int broken_counter = 0;
static int broken_last = 0;
-nkf_char broken_getc(FILE *f)
+int
+broken_getc(f)
+FILE *f;
{
- nkf_char c,c1;
+ int c,c1;
if (broken_counter>0) {
return broken_buf[--broken_counter];
@@ -3899,16 +2811,21 @@ nkf_char broken_getc(FILE *f)
}
}
-nkf_char broken_ungetc(nkf_char c, FILE *f)
+int
+broken_ungetc(c,f)
+int c;
+FILE *f;
{
if (broken_counter<2)
broken_buf[broken_counter++]=c;
return c;
}
-static nkf_char prev_cr = 0;
+static int prev_cr = 0;
-void cr_conv(nkf_char c2, nkf_char c1)
+void
+cr_conv(c2,c1)
+int c2,c1;
{
if (prev_cr) {
prev_cr = 0;
@@ -3955,10 +2872,12 @@ void cr_conv(nkf_char c2, nkf_char c1)
#define char_size(c2,c1) (c2?2:1)
-void fold_conv(nkf_char c2, nkf_char c1)
+void
+fold_conv(c2,c1)
+int c2,c1;
{
- nkf_char prev0;
- nkf_char fold_state;
+ int prev0;
+ int fold_state=0;
if (c1== '\r' && !fold_preserve_f) {
fold_state=0; /* ignore cr */
@@ -4006,6 +2925,8 @@ void fold_conv(nkf_char c2, nkf_char c1)
}
} else if (c1=='\f') {
f_prev = '\n';
+ if (f_line==0)
+ fold_state = 1;
f_line = 0;
fold_state = '\n'; /* output newline and clear */
} else if ( (c2==0 && c1==' ')||
@@ -4032,7 +2953,7 @@ void fold_conv(nkf_char c2, nkf_char c1)
if (f_line<=fold_len) { /* normal case */
fold_state = 1;
} else {
- if (f_line>fold_len+fold_margin) { /* too many kinsoku suspension */
+ if (f_line>=fold_len+fold_margin) { /* too many kinsou suspension */
f_line = char_size(c2,c1);
fold_state = '\n'; /* We can't wait, do fold now */
} else if (c2==X0201) {
@@ -4123,9 +3044,11 @@ void fold_conv(nkf_char c2, nkf_char c1)
}
}
-nkf_char z_prev2=0,z_prev1=0;
+int z_prev2=0,z_prev1=0;
-void z_conv(nkf_char c2, nkf_char c1)
+void
+z_conv(c2,c1)
+int c2,c1;
{
/* if (c2) c1 &= 0x7f; assertion */
@@ -4214,7 +3137,9 @@ void z_conv(nkf_char c2, nkf_char c1)
c \
)
-void rot_conv(nkf_char c2, nkf_char c1)
+void
+rot_conv(c2,c1)
+int c2,c1;
{
if (c2==0 || c2==X0201 || c2==ISO8859_1) {
c1 = rot13(c1);
@@ -4225,43 +3150,24 @@ void rot_conv(nkf_char c2, nkf_char c1)
(*o_rot_conv)(c2,c1);
}
-void hira_conv(nkf_char c2, nkf_char c1)
+void
+hira_conv(c2,c1)
+int c2,c1;
{
- if (hira_f & 1) {
- if (c2 == 0x25) {
- if (0x20 < c1 && c1 < 0x74) {
- c2 = 0x24;
- (*o_hira_conv)(c2,c1);
- return;
- } else if (c1 == 0x74 && (output_conv == w_oconv || output_conv == w_oconv16)) {
- c2 = 0;
- c1 = CLASS_UTF16 | 0x3094;
- (*o_hira_conv)(c2,c1);
- return;
- }
- } else if (c2 == 0x21 && (c1 == 0x33 || c1 == 0x34)) {
- c1 += 2;
- (*o_hira_conv)(c2,c1);
- return;
- }
- }
- if (hira_f & 2) {
- if (c2 == 0 && c1 == (CLASS_UTF16 | 0x3094)) {
- c2 = 0x25;
- c1 = 0x74;
- } else if (c2 == 0x24 && 0x20 < c1 && c1 < 0x74) {
- c2 = 0x25;
- } else if (c2 == 0x21 && (c1 == 0x35 || c1 == 0x36)) {
- c1 -= 2;
- }
- }
+ if ((hira_f & 1) && c2==0x25 && 0x20<c1 && c1<0x74) {
+ c2 = 0x24;
+ } else if ((hira_f & 2) && c2==0x24 && 0x20<c1 && c1<0x74) {
+ c2 = 0x25;
+ }
(*o_hira_conv)(c2,c1);
}
-void iso2022jp_check_conv(nkf_char c2, nkf_char c1)
+void
+iso2022jp_check_conv(c2,c1)
+int c2, c1;
{
- static const nkf_char range[RANGE_NUM_MAX][2] = {
+ static int range[RANGE_NUM_MAX][2] = {
{0x222f, 0x2239,},
{0x2242, 0x2249,},
{0x2251, 0x225b,},
@@ -4281,8 +3187,8 @@ void iso2022jp_check_conv(nkf_char c2, nkf_char c1)
{0x4f54, 0x4f7e,},
{0x7425, 0x747e},
};
- nkf_char i;
- nkf_char start, end, c;
+ int i;
+ int start, end, c;
if(c2 >= 0x00 && c2 <= 0x20 && c1 >= 0x7f && c1 <= 0xff) {
c2 = GETA1;
@@ -4308,43 +3214,43 @@ void iso2022jp_check_conv(nkf_char c2, nkf_char c1)
/* This converts =?ISO-2022-JP?B?HOGE HOGE?= */
-const unsigned char *mime_pattern[] = {
- (const unsigned char *)"\075?EUC-JP?B?",
- (const unsigned char *)"\075?SHIFT_JIS?B?",
- (const unsigned char *)"\075?ISO-8859-1?Q?",
- (const unsigned char *)"\075?ISO-8859-1?B?",
- (const unsigned char *)"\075?ISO-2022-JP?B?",
- (const unsigned char *)"\075?ISO-2022-JP?Q?",
-#if defined(UTF8_INPUT_ENABLE)
- (const unsigned char *)"\075?UTF-8?B?",
- (const unsigned char *)"\075?UTF-8?Q?",
-#endif
- (const unsigned char *)"\075?US-ASCII?Q?",
- NULL
+unsigned char *mime_pattern[] = {
+ (unsigned char *)"\075?EUC-JP?B?",
+ (unsigned char *)"\075?SHIFT_JIS?B?",
+ (unsigned char *)"\075?ISO-8859-1?Q?",
+ (unsigned char *)"\075?ISO-8859-1?B?",
+ (unsigned char *)"\075?ISO-2022-JP?B?",
+ (unsigned char *)"\075?ISO-2022-JP?Q?",
+#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
+ (unsigned char *)"\075?UTF-8?B?",
+ (unsigned char *)"\075?UTF-8?Q?",
+#endif
+ (unsigned char *)"\075?US-ASCII?Q?",
+ NULL
};
/* $B3:Ev$9$k%3!<%I$NM%@hEY$r>e$2$k$?$a$NL\0u(B */
-nkf_char (*mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
+int (*mime_priority_func[])PROTO((int c2, int c1, int c0)) = {
e_iconv, s_iconv, 0, 0, 0, 0,
-#if defined(UTF8_INPUT_ENABLE)
+#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
w_iconv, w_iconv,
#endif
0,
};
-const nkf_char mime_encode[] = {
+int mime_encode[] = {
JAPANESE_EUC, SHIFT_JIS,ISO8859_1, ISO8859_1, X0208, X0201,
-#if defined(UTF8_INPUT_ENABLE)
+#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
UTF8, UTF8,
#endif
ASCII,
0
};
-const nkf_char mime_encode_method[] = {
+int mime_encode_method[] = {
'B', 'B','Q', 'B', 'B', 'Q',
-#if defined(UTF8_INPUT_ENABLE)
+#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
'B', 'Q',
#endif
'Q',
@@ -4354,7 +3260,13 @@ const nkf_char mime_encode_method[] = {
#define MAXRECOVER 20
-void switch_mime_getc(void)
+/* I don't trust portablity of toupper */
+#define nkf_toupper(c) (('a'<=c && c<='z')?(c-('a'-'A')):c)
+#define nkf_isdigit(c) ('0'<=c && c<='9')
+#define nkf_isxdigit(c) (nkf_isdigit(c) || ('a'<=c && c<='f') || ('A'<=c && c <= 'F'))
+
+void
+switch_mime_getc()
{
if (i_getc!=mime_getc) {
i_mgetc = i_getc; i_getc = mime_getc;
@@ -4366,7 +3278,8 @@ void switch_mime_getc(void)
}
}
-void unswitch_mime_getc(void)
+void
+unswitch_mime_getc()
{
if(mime_f==STRICT_MIME) {
i_mgetc = i_mgetc_buf;
@@ -4374,16 +3287,16 @@ void unswitch_mime_getc(void)
}
i_getc = i_mgetc;
i_ungetc = i_mungetc;
- if(mime_iconv_back)set_iconv(FALSE, mime_iconv_back);
- mime_iconv_back = NULL;
}
-nkf_char mime_begin_strict(FILE *f)
+int
+mime_begin_strict(f)
+FILE *f;
{
- nkf_char c1 = 0;
+ int c1 = 0;
int i,j,k;
- const unsigned char *p,*q;
- nkf_char r[MAXRECOVER]; /* recovery buffer, max mime pattern length */
+ unsigned char *p,*q;
+ int r[MAXRECOVER]; /* recovery buffer, max mime pattern lenght */
mime_decode_mode = FALSE;
/* =? has been checked */
@@ -4395,13 +3308,11 @@ nkf_char mime_begin_strict(FILE *f)
if ( ((r[i] = c1 = (*i_getc)(f))==EOF) || nkf_toupper(c1) != p[i] ) {
/* pattern fails, try next one */
q = p;
- while (mime_pattern[++j]) {
- p = mime_pattern[j];
+ while ((p = mime_pattern[++j])) {
for(k=2;k<i;k++) /* assume length(p) > i */
if (p[k]!=q[k]) break;
if (k==i && nkf_toupper(c1)==p[k]) break;
}
- p = mime_pattern[j];
if (p) continue; /* found next one, continue */
/* all fails, output from recovery buffer */
(*i_ungetc)(c1,f);
@@ -4413,8 +3324,6 @@ nkf_char mime_begin_strict(FILE *f)
}
mime_decode_mode = p[i-2];
- mime_iconv_back = iconv;
- set_iconv(FALSE, mime_priority_func[j]);
clr_code_score(find_inputcode_byfunc(mime_priority_func[j]), SCORE_iMIME);
if (mime_decode_mode=='B') {
@@ -4429,7 +3338,9 @@ nkf_char mime_begin_strict(FILE *f)
return c1;
}
-nkf_char mime_getc_buf(FILE *f)
+int
+mime_getc_buf(f)
+FILE *f;
{
/* we don't keep eof of Fifo, becase it contains ?= as
a terminator. It was checked in mime_integrity. */
@@ -4437,18 +3348,23 @@ nkf_char mime_getc_buf(FILE *f)
(*i_mgetc_buf)(f):Fifo(mime_input++));
}
-nkf_char mime_ungetc_buf(nkf_char c, FILE *f)
+int
+mime_ungetc_buf(c,f)
+FILE *f;
+int c;
{
if (mimebuf_f)
(*i_mungetc_buf)(c,f);
else
- Fifo(--mime_input) = (unsigned char)c;
+ Fifo(--mime_input)=c;
return c;
}
-nkf_char mime_begin(FILE *f)
+int
+mime_begin(f)
+FILE *f;
{
- nkf_char c1;
+ int c1;
int i,k;
/* In NONSTRICT mode, only =? is checked. In case of failure, we */
@@ -4459,7 +3375,7 @@ nkf_char mime_begin(FILE *f)
Fifo(mime_last++)='='; Fifo(mime_last++)='?';
for(i=2;i<MAXRECOVER;i++) { /* start at =? */
/* We accept any character type even if it is breaked by new lines */
- c1 = (*i_getc)(f); Fifo(mime_last++) = (unsigned char)c1;
+ c1 = (*i_getc)(f); Fifo(mime_last++)= c1 ;
if (c1=='\n'||c1==' '||c1=='\r'||
c1=='-'||c1=='_'||is_alnum(c1) ) continue;
if (c1=='=') {
@@ -4471,7 +3387,7 @@ nkf_char mime_begin(FILE *f)
if (c1!='?') break;
else {
/* c1=='?' */
- c1 = (*i_getc)(f); Fifo(mime_last++) = (unsigned char)c1;
+ c1 = (*i_getc)(f); Fifo(mime_last++) = c1;
if (!(++i<MAXRECOVER) || c1==EOF) break;
if (c1=='b'||c1=='B') {
mime_decode_mode = 'B';
@@ -4480,7 +3396,7 @@ nkf_char mime_begin(FILE *f)
} else {
break;
}
- c1 = (*i_getc)(f); Fifo(mime_last++) = (unsigned char)c1;
+ c1 = (*i_getc)(f); Fifo(mime_last++) = c1;
if (!(++i<MAXRECOVER) || c1==EOF) break;
if (c1!='?') {
mime_decode_mode = FALSE;
@@ -4503,12 +3419,15 @@ nkf_char mime_begin(FILE *f)
}
#ifdef CHECK_OPTION
-void no_putc(nkf_char c)
+void
+no_putc(c)
+ int c;
{
;
}
-void debug(const char *str)
+void debug(str)
+ char *str;
{
if (debug_f){
fprintf(stderr, "%s\n", str);
@@ -4516,7 +3435,9 @@ void debug(const char *str)
}
#endif
-void set_input_codename(char *codename)
+void
+set_input_codename (codename)
+ char *codename;
{
if (guess_f &&
is_inputcode_set &&
@@ -4529,8 +3450,9 @@ void set_input_codename(char *codename)
is_inputcode_set = TRUE;
}
-#if !defined(PERL_XS) && !defined(WIN32DLL)
-void print_guessed_code(char *filename)
+void
+print_guessed_code (filename)
+ char *filename;
{
char *codename = "BINARY";
if (!is_inputcode_mixed) {
@@ -4543,13 +3465,29 @@ void print_guessed_code(char *filename)
if (filename != NULL) printf("%s:", filename);
printf("%s\n", codename);
}
-#endif /*WIN32DLL*/
+
+int
+hex2bin(x)
+ int x;
+{
+ if (nkf_isdigit(x)) return x - '0';
+ return nkf_toupper(x) - 'A' + 10;
+}
#ifdef INPUT_OPTION
-nkf_char hex_getc(nkf_char ch, FILE *f, nkf_char (*g)(FILE *f), nkf_char (*u)(nkf_char c, FILE *f))
+#ifdef ANSI_C_PROTOTYPE
+int hex_getc(int ch, FILE *f, int (*g)(FILE *f), int (*u)(int c, FILE *f))
+#else
+int
+hex_getc(ch, f, g, u)
+ int ch;
+ FILE *f;
+ int (*g)();
+ int (*u)();
+#endif
{
- nkf_char c1, c2, c3;
+ int c1, c2, c3;
c1 = (*g)(f);
if (c1 != ch){
return c1;
@@ -4568,34 +3506,46 @@ nkf_char hex_getc(nkf_char ch, FILE *f, nkf_char (*g)(FILE *f), nkf_char (*u)(nk
return (hex2bin(c2) << 4) | hex2bin(c3);
}
-nkf_char cap_getc(FILE *f)
+int
+cap_getc(f)
+ FILE *f;
{
return hex_getc(':', f, i_cgetc, i_cungetc);
}
-nkf_char cap_ungetc(nkf_char c, FILE *f)
+int
+cap_ungetc(c, f)
+ int c;
+ FILE *f;
{
return (*i_cungetc)(c, f);
}
-nkf_char url_getc(FILE *f)
+int
+url_getc(f)
+ FILE *f;
{
return hex_getc('%', f, i_ugetc, i_uungetc);
}
-nkf_char url_ungetc(nkf_char c, FILE *f)
+int
+url_ungetc(c, f)
+ int c;
+ FILE *f;
{
return (*i_uungetc)(c, f);
}
#endif
#ifdef NUMCHAR_OPTION
-nkf_char numchar_getc(FILE *f)
+int
+numchar_getc(f)
+ FILE *f;
{
- nkf_char (*g)(FILE *) = i_ngetc;
- nkf_char (*u)(nkf_char c ,FILE *f) = i_nungetc;
+ int (*g)() = i_ngetc;
+ int (*u)() = i_nungetc;
int i = 0, j;
- nkf_char buf[8];
+ int buf[8];
long c = -1;
buf[i] = (*g)(f);
@@ -4605,7 +3555,7 @@ nkf_char numchar_getc(FILE *f)
c = 0;
buf[++i] = (*g)(f);
if (buf[i] == 'x' || buf[i] == 'X'){
- for (j = 0; j < 7; j++){
+ for (j = 0; j < 5; j++){
buf[++i] = (*g)(f);
if (!nkf_isxdigit(buf[i])){
if (buf[i] != ';'){
@@ -4617,7 +3567,7 @@ nkf_char numchar_getc(FILE *f)
c |= hex2bin(buf[i]);
}
}else{
- for (j = 0; j < 8; j++){
+ for (j = 0; j < 6; j++){
if (j){
buf[++i] = (*g)(f);
}
@@ -4643,70 +3593,26 @@ nkf_char numchar_getc(FILE *f)
return buf[0];
}
-nkf_char numchar_ungetc(nkf_char c, FILE *f)
+int
+numchar_ungetc(c, f)
+ int c;
+ FILE *f;
{
return (*i_nungetc)(c, f);
}
#endif
-#ifdef UNICODE_NORMALIZATION
-
-/* Normalization Form C */
-nkf_char nfc_getc(FILE *f)
-{
- nkf_char (*g)(FILE *f) = i_nfc_getc;
- nkf_char (*u)(nkf_char c ,FILE *f) = i_nfc_ungetc;
- int i=0, j, k=1, lower, upper;
- nkf_char buf[9];
- const nkf_nfchar *array;
-#if 0
- extern const struct normalization_pair normalization_table[];
-#endif
-
- buf[i] = (*g)(f);
- while (k > 0 && ((buf[i] & 0xc0) != 0x80)){
- lower=0, upper=NORMALIZATION_TABLE_LENGTH-1;
- while (upper >= lower) {
- j = (lower+upper) / 2;
- array = normalization_table[j].nfd;
- for (k=0; k < NORMALIZATION_TABLE_NFD_LENGTH && array[k]; k++){
- if (array[k] != buf[k]){
- array[k] < buf[k] ? (lower = j + 1) : (upper = j - 1);
- k = 0;
- break;
- } else if (k >= i)
- buf[++i] = (*g)(f);
- }
- if (k > 0){
- array = normalization_table[j].nfc;
- for (i=0; i < NORMALIZATION_TABLE_NFC_LENGTH && array[i]; i++)
- buf[i] = (nkf_char)(array[i]);
- i--;
- break;
- }
- }
- while (i > 0)
- (*u)(buf[i--], f);
- }
- return buf[0];
-}
-
-nkf_char nfc_ungetc(nkf_char c, FILE *f)
-{
- return (*i_nfc_ungetc)(c, f);
-}
-#endif /* UNICODE_NORMALIZATION */
-
-nkf_char
-mime_getc(FILE *f)
+int
+mime_getc(f)
+FILE *f;
{
- nkf_char c1, c2, c3, c4, cc;
- nkf_char t1, t2, t3, t4, mode, exit_mode;
- nkf_char lwsp_count;
+ int c1, c2, c3, c4, cc;
+ int t1, t2, t3, t4, mode, exit_mode;
+ int lwsp_count;
char *lwsp_buf;
char *lwsp_buf_new;
- nkf_char lwsp_size = 128;
+ int lwsp_size = 128;
if (mime_top != mime_last) { /* Something is in FIFO */
return Fifo(mime_top++);
@@ -4724,16 +3630,13 @@ mime_getc(FILE *f)
if (mime_decode_mode == 'Q') {
if ((c1 = (*i_mgetc)(f)) == EOF) return (EOF);
restart_mime_q:
- if (c1=='_' && mimebuf_f != FIXED_MIME) return ' ';
- if (c1<=' ' || DEL<=c1) {
- mime_decode_mode = exit_mode; /* prepare for quit */
- return c1;
- }
- if (c1!='=' && (c1!='?' || mimebuf_f == FIXED_MIME)) {
+ if (c1=='_') return ' ';
+ if (c1!='=' && c1!='?') {
return c1;
}
mime_decode_mode = exit_mode; /* prepare for quit */
+ if (c1<=' ') return c1;
if ((c2 = (*i_mgetc)(f)) == EOF) return (EOF);
if (c1=='?'&&c2=='=' && mimebuf_f != FIXED_MIME) {
/* end Q encoding */
@@ -4773,12 +3676,13 @@ restart_mime_q:
break;
case SPACE:
case TAB:
- lwsp_buf[lwsp_count] = (unsigned char)c1;
+ lwsp_buf[lwsp_count] = c1;
if (lwsp_count++>lwsp_size){
- lwsp_size <<= 1;
+ lwsp_size *= 2;
lwsp_buf_new = realloc(lwsp_buf, (lwsp_size+5)*sizeof(char));
if (lwsp_buf_new==NULL) {
free(lwsp_buf);
+ lwsp_buf = NULL;
perror("can't realloc");
return -1;
}
@@ -4788,13 +3692,18 @@ restart_mime_q:
}
break;
}
- if (lwsp_count > 0 && (c1 != '=' || (lwsp_buf[lwsp_count-1] != SPACE && lwsp_buf[lwsp_count-1] != TAB))) {
- i_ungetc(c1,f);
- for(lwsp_count--;lwsp_count>0;lwsp_count--)
- i_ungetc(lwsp_buf[lwsp_count],f);
- c1 = lwsp_buf[0];
+ if (lwsp_count > 0) {
+ if (c1=='=' && (lwsp_buf[lwsp_count-1]==SPACE||lwsp_buf[lwsp_count-1]==TAB)) {
+ lwsp_count = 0;
+ } else {
+ i_ungetc(c1,f);
+ for(lwsp_count--;lwsp_count>0;lwsp_count--)
+ i_ungetc(lwsp_buf[lwsp_count],f);
+ c1 = lwsp_buf[0];
+ }
}
free(lwsp_buf);
+ lwsp_buf = NULL;
return c1;
}
if (c1=='='&&c2<' ') { /* this is soft wrap */
@@ -4812,7 +3721,9 @@ restart_mime_q:
if ((c3 = (*i_mgetc)(f)) == EOF) return (EOF);
if (c2<=' ') return c2;
mime_decode_mode = 'Q'; /* still in MIME */
- return ((hex2bin(c2)<<4) + hex2bin(c3));
+#define hex(c) (('0'<=c&&c<='9')?(c-'0'):\
+ ('A'<=c&&c<='F')?(c-'A'+10):('a'<=c&&c<='f')?(c-'a'+10):0)
+ return ((hex(c2)<<4) + hex(c3));
}
if (mime_decode_mode != 'B') {
@@ -4884,12 +3795,13 @@ mime_c2_retry:
break;
case SPACE:
case TAB:
- lwsp_buf[lwsp_count] = (unsigned char)c1;
+ lwsp_buf[lwsp_count] = c1;
if (lwsp_count++>lwsp_size){
- lwsp_size <<= 1;
+ lwsp_size *= 2;
lwsp_buf_new = realloc(lwsp_buf, (lwsp_size+5)*sizeof(char));
if (lwsp_buf_new==NULL) {
free(lwsp_buf);
+ lwsp_buf = NULL;
perror("can't realloc");
return -1;
}
@@ -4899,13 +3811,18 @@ mime_c2_retry:
}
break;
}
- if (lwsp_count > 0 && (c1 != '=' || (lwsp_buf[lwsp_count-1] != SPACE && lwsp_buf[lwsp_count-1] != TAB))) {
- i_ungetc(c1,f);
- for(lwsp_count--;lwsp_count>0;lwsp_count--)
- i_ungetc(lwsp_buf[lwsp_count],f);
- c1 = lwsp_buf[0];
+ if (lwsp_count > 0) {
+ if (c1=='=' && (lwsp_buf[lwsp_count-1]==SPACE||lwsp_buf[lwsp_count-1]==TAB)) {
+ lwsp_count = 0;
+ } else {
+ i_ungetc(c1,f);
+ for(lwsp_count--;lwsp_count>0;lwsp_count--)
+ i_ungetc(lwsp_buf[lwsp_count],f);
+ c1 = lwsp_buf[0];
+ }
}
free(lwsp_buf);
+ lwsp_buf = NULL;
return c1;
}
mime_c3_retry:
@@ -4935,13 +3852,13 @@ mime_c4_retry:
t4 = 0x3f & base64decode(c4);
cc = ((t1 << 2) & 0x0fc) | ((t2 >> 4) & 0x03);
if (c2 != '=') {
- Fifo(mime_last++) = (unsigned char)cc;
+ Fifo(mime_last++) = cc;
cc = ((t2 << 4) & 0x0f0) | ((t3 >> 2) & 0x0f);
if (c3 != '=') {
- Fifo(mime_last++) = (unsigned char)cc;
+ Fifo(mime_last++) = cc;
cc = ((t3 << 6) & 0x0c0) | (t4 & 0x3f);
if (c4 != '=')
- Fifo(mime_last++) = (unsigned char)cc;
+ Fifo(mime_last++) = cc;
}
} else {
return c1;
@@ -4949,21 +3866,26 @@ mime_c4_retry:
return Fifo(mime_top++);
}
-nkf_char mime_ungetc(nkf_char c, FILE *f)
+int
+mime_ungetc(c,f)
+int c;
+FILE *f;
{
- Fifo(--mime_top) = (unsigned char)c;
+ Fifo(--mime_top) = c;
return c;
}
-nkf_char mime_integrity(FILE *f, const unsigned char *p)
+int
+mime_integrity(f,p)
+FILE *f;
+unsigned char *p;
{
- nkf_char c,d;
+ int c,d;
unsigned int q;
/* In buffered mode, read until =? or NL or buffer full
*/
mime_input = mime_top;
mime_last = mime_top;
-
while(*p) Fifo(mime_input++) = *p++;
d = 0;
q = mime_input;
@@ -4973,7 +3895,7 @@ nkf_char mime_integrity(FILE *f, const unsigned char *p)
}
if (c=='=' && d=='?') {
/* checked. skip header, start decode */
- Fifo(mime_input++) = (unsigned char)c;
+ Fifo(mime_input++) = c;
/* mime_last_input = mime_input; */
mime_input = q;
switch_mime_getc();
@@ -4982,18 +3904,20 @@ nkf_char mime_integrity(FILE *f, const unsigned char *p)
if (!( (c=='+'||c=='/'|| c=='=' || c=='?' || is_alnum(c))))
break;
/* Should we check length mod 4? */
- Fifo(mime_input++) = (unsigned char)c;
+ Fifo(mime_input++) = c;
d=c;
}
/* In case of Incomplete MIME, no MIME decode */
- Fifo(mime_input++) = (unsigned char)c;
+ Fifo(mime_input++) = c;
mime_last = mime_input; /* point undecoded buffer */
mime_decode_mode = 1; /* no decode on Fifo last in mime_getc */
switch_mime_getc(); /* anyway we need buffered getc */
return 1;
}
-nkf_char base64decode(nkf_char c)
+int
+base64decode(c)
+ int c;
{
int i;
if (c > '@') {
@@ -5012,19 +3936,21 @@ nkf_char base64decode(nkf_char c)
return (i);
}
-static const char basis_64[] =
+static char basis_64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static nkf_char b64c;
+static int b64c;
#define MIMEOUT_BUF_LENGTH (60)
char mimeout_buf[MIMEOUT_BUF_LENGTH+1];
int mimeout_buf_count = 0;
int mimeout_preserve_space = 0;
#define itoh4(c) (c>=10?c+'A'-10:c+'0')
-void open_mime(nkf_char mode)
+void
+open_mime(mode)
+int mode;
{
- const unsigned char *p;
+ unsigned char *p;
int i;
int j;
p = mime_pattern[0];
@@ -5038,10 +3964,6 @@ void open_mime(nkf_char mode)
i = 0;
if (base64_count>45) {
- if (mimeout_buf_count>0 && nkf_isblank(mimeout_buf[i])){
- (*o_mputc)(mimeout_buf[i]);
- i++;
- }
(*o_mputc)(NL);
(*o_mputc)(SPACE);
base64_count = 1;
@@ -5075,7 +3997,8 @@ void open_mime(nkf_char mode)
}
}
-void close_mime(void)
+void
+close_mime()
{
(*o_mputc)('?');
(*o_mputc)('=');
@@ -5083,7 +4006,8 @@ void close_mime(void)
mimeout_mode = 0;
}
-void eof_mime(void)
+void
+eof_mime()
{
switch(mimeout_mode) {
case 'Q':
@@ -5109,14 +4033,13 @@ void eof_mime(void)
}
}
-void mimeout_addchar(nkf_char c)
+void
+mimeout_addchar(c)
+ int c;
{
switch(mimeout_mode) {
case 'Q':
- if (c==CR||c==NL) {
- (*o_mputc)(c);
- base64_count = 0;
- } else if(!nkf_isalnum(c)) {
+ if(c>=DEL) {
(*o_mputc)('=');
(*o_mputc)(itoh4(((c>>4)&0xf)));
(*o_mputc)(itoh4((c&0xf)));
@@ -5144,239 +4067,132 @@ void mimeout_addchar(nkf_char c)
mimeout_mode='B';
base64_count += 2;
break;
- default:
- (*o_mputc)(c);
- base64_count++;
- break;
}
}
-nkf_char mime_lastchar2, mime_lastchar1;
-
-void mime_prechar(nkf_char c2, nkf_char c1)
-{
- if (mimeout_mode){
- if (c2){
- if (base64_count + mimeout_buf_count/3*4> 66){
- (*o_base64conv)(EOF,0);
- (*o_base64conv)(0,NL);
- (*o_base64conv)(0,SPACE);
- }
- }/*else if (mime_lastchar2){
- if (c1 <=DEL && !nkf_isspace(c1)){
- (*o_base64conv)(0,SPACE);
- }
- }*/
- }/*else{
- if (c2 && mime_lastchar2 == 0
- && mime_lastchar1 && !nkf_isspace(mime_lastchar1)){
- (*o_base64conv)(0,SPACE);
- }
- }*/
- mime_lastchar2 = c2;
- mime_lastchar1 = c1;
-}
-
-void mime_putc(nkf_char c)
+void
+mime_putc(c)
+ int c;
{
- int i, j;
- nkf_char lastchar;
-
- if (mimeout_f == FIXED_MIME){
- if (mimeout_mode == 'Q'){
- if (base64_count > 71){
- if (c!=CR && c!=NL) {
- (*o_mputc)('=');
- (*o_mputc)(NL);
- }
- base64_count = 0;
- }
- }else{
- if (base64_count > 71){
- eof_mime();
- (*o_mputc)(NL);
- base64_count = 0;
- }
- if (c == EOF) { /* c==EOF */
- eof_mime();
- }
- }
- if (c != EOF) { /* c==EOF */
- mimeout_addchar(c);
- }
- return;
- }
+ int i = 0;
+ int j = 0;
- /* mimeout_f != FIXED_MIME */
-
- if (c == EOF) { /* c==EOF */
- j = mimeout_buf_count;
- mimeout_buf_count = 0;
- i = 0;
- if (mimeout_mode) {
- for (;i<j;i++) {
- if (nkf_isspace(mimeout_buf[i]) && base64_count < 71){
- break;
+ if (mimeout_f==FIXED_MIME && base64_count>50) {
+ eof_mime();
+ (*o_mputc)(NL);
+ base64_count=0;
+ } else if (c==CR||c==NL) {
+ base64_count=0;
+ }
+ if (c!=EOF && mimeout_f!=FIXED_MIME) {
+ if ( c<=DEL &&(output_mode==ASCII ||output_mode == ISO8859_1 ) ) {
+ if (mimeout_mode=='Q') {
+ if (c<=SPACE) {
+ close_mime();
+ (*o_mputc)(SPACE);
+ base64_count++;
}
- mimeout_addchar(mimeout_buf[i]);
- }
- eof_mime();
- for (;i<j;i++) {
- mimeout_addchar(mimeout_buf[i]);
+ (*o_mputc)(c);
+ base64_count++;
+ return;
+ } else if (mimeout_mode) {
+ if (base64_count>63) {
+ eof_mime();
+ (*o_mputc)(NL);
+ (*o_mputc)(SPACE);
+ base64_count=1;
+ mimeout_preserve_space = TRUE;
+ }
+ if (c==SPACE || c==TAB || c==CR || c==NL) {
+ for (i=0;i<mimeout_buf_count;i++) {
+ if (SPACE<mimeout_buf[i] && mimeout_buf[i]<DEL) {
+ eof_mime();
+ for (i=0;i<mimeout_buf_count;i++) {
+ (*o_mputc)(mimeout_buf[i]);
+ base64_count++;
+ }
+ mimeout_buf_count = 0;
+ }
+ }
+ mimeout_buf[mimeout_buf_count++] = c;
+ if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
+ eof_mime();
+ base64_count = 0;
+ for (i=0;i<mimeout_buf_count;i++) {
+ (*o_mputc)(mimeout_buf[i]);
+ base64_count++;
+ }
+ }
+ return;
+ }
+ if (mimeout_buf_count>0 && SPACE<c) {
+ mimeout_buf[mimeout_buf_count++] = c;
+ if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
+ } else {
+ return;
+ }
+ }
+ } else if (!mimeout_mode) {
+ if (c==SPACE || c==TAB || c==CR || c==NL) {
+ if ((c==CR || c==NL)
+ &&(mimeout_buf[mimeout_buf_count-1]==SPACE
+ || mimeout_buf[mimeout_buf_count-1]==TAB)) {
+ mimeout_buf_count--;
+ }
+ for (i=0;i<mimeout_buf_count;i++) {
+ (*o_mputc)(mimeout_buf[i]);
+ base64_count++;
+ }
+ mimeout_buf_count = 0;
+ }
+ mimeout_buf[mimeout_buf_count++] = c;
+ if (mimeout_buf_count>75) {
+ open_mime(output_mode);
+ }
+ return;
}
- } else {
- for (;i<j;i++) {
- mimeout_addchar(mimeout_buf[i]);
+ } else if (!mimeout_mode) {
+ if (mimeout_buf_count>0 && mimeout_buf[mimeout_buf_count-1]==SPACE) {
+ for (i=0;i<mimeout_buf_count-1;i++) {
+ (*o_mputc)(mimeout_buf[i]);
+ base64_count++;
+ }
+ mimeout_buf[0] = SPACE;
+ mimeout_buf_count = 1;
}
- }
- return;
- }
-
- if (mimeout_mode=='Q') {
- if (c <= DEL && (output_mode==ASCII ||output_mode == ISO8859_1 ) ) {
- if (c <= SPACE) {
- close_mime();
- (*o_mputc)(SPACE);
- base64_count++;
- }
- (*o_mputc)(c);
- base64_count++;
+ open_mime(output_mode);
}
+ } else { /* c==EOF */
+ j = mimeout_buf_count;
+ i = 0;
+ for (;i<j;i++) {
+ if (mimeout_buf[i]==SPACE || mimeout_buf[i]==TAB
+ || mimeout_buf[i]==CR || mimeout_buf[i]==NL)
+ break;
+ (*mime_putc)(mimeout_buf[i]);
+ }
+ eof_mime();
+ for (;i<j;i++) {
+ (*o_mputc)(mimeout_buf[i]);
+ base64_count++;
+ }
return;
}
-
- if (mimeout_buf_count > 0){
- lastchar = mimeout_buf[mimeout_buf_count - 1];
- }else{
- lastchar = -1;
- }
-
- if (!mimeout_mode) {
- if (c <= DEL && (output_mode==ASCII ||output_mode == ISO8859_1)) {
- if (nkf_isspace(c)) {
- if (c==CR || c==NL) {
- base64_count=0;
- }
- for (i=0;i<mimeout_buf_count;i++) {
- (*o_mputc)(mimeout_buf[i]);
- if (mimeout_buf[i] == CR || mimeout_buf[i] == NL){
- base64_count = 0;
- }else{
- base64_count++;
- }
- }
- mimeout_buf[0] = (char)c;
- mimeout_buf_count = 1;
- }else{
- if (base64_count > 1
- && base64_count + mimeout_buf_count > 76){
- (*o_mputc)(NL);
- base64_count = 0;
- if (!nkf_isspace(mimeout_buf[0])){
- (*o_mputc)(SPACE);
- base64_count++;
- }
- }
- mimeout_buf[mimeout_buf_count++] = (char)c;
- if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
- open_mime(output_mode);
- }
- }
- return;
- }else{
- if (lastchar==CR || lastchar == NL){
- for (i=0;i<mimeout_buf_count;i++) {
- (*o_mputc)(mimeout_buf[i]);
- }
- base64_count = 0;
- mimeout_buf_count = 0;
- }
- if (lastchar==SPACE) {
- for (i=0;i<mimeout_buf_count-1;i++) {
- (*o_mputc)(mimeout_buf[i]);
- base64_count++;
- }
- mimeout_buf[0] = SPACE;
- mimeout_buf_count = 1;
- }
- open_mime(output_mode);
- }
- }else{
- /* mimeout_mode == 'B', 1, 2 */
- if ( c<=DEL && (output_mode==ASCII ||output_mode == ISO8859_1 ) ) {
- if (lastchar == CR || lastchar == NL){
- if (nkf_isblank(c)) {
- for (i=0;i<mimeout_buf_count;i++) {
- mimeout_addchar(mimeout_buf[i]);
- }
- mimeout_buf_count = 0;
- } else if (SPACE<c && c<DEL) {
- eof_mime();
- for (i=0;i<mimeout_buf_count;i++) {
- (*o_mputc)(mimeout_buf[i]);
- }
- base64_count = 0;
- mimeout_buf_count = 0;
- }
- }
- if (c==SPACE || c==TAB || c==CR || c==NL) {
- for (i=0;i<mimeout_buf_count;i++) {
- if (SPACE<mimeout_buf[i] && mimeout_buf[i]<DEL) {
- eof_mime();
- for (i=0;i<mimeout_buf_count;i++) {
- (*o_mputc)(mimeout_buf[i]);
- base64_count++;
- }
- mimeout_buf_count = 0;
- }
- }
- mimeout_buf[mimeout_buf_count++] = (char)c;
- if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
- eof_mime();
- for (i=0;i<mimeout_buf_count;i++) {
- (*o_mputc)(mimeout_buf[i]);
- base64_count++;
- }
- mimeout_buf_count = 0;
- }
- return;
- }
- if (mimeout_buf_count>0 && SPACE<c && c!='=') {
- mimeout_buf[mimeout_buf_count++] = (char)c;
- if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
- j = mimeout_buf_count;
- mimeout_buf_count = 0;
- for (i=0;i<j;i++) {
- mimeout_addchar(mimeout_buf[i]);
- }
- }
- return;
- }
- }
- }
+
if (mimeout_buf_count>0) {
j = mimeout_buf_count;
mimeout_buf_count = 0;
for (i=0;i<j;i++) {
- if (mimeout_buf[i]==CR || mimeout_buf[i]==NL)
- break;
mimeout_addchar(mimeout_buf[i]);
}
- if (i<j) {
- eof_mime();
- base64_count=0;
- for (;i<j;i++) {
- (*o_mputc)(mimeout_buf[i]);
- }
- open_mime(output_mode);
- }
}
mimeout_addchar(c);
}
-#if defined(PERL_XS) || defined(WIN32DLL)
-void reinit(void)
+#ifdef PERL_XS
+void
+reinit()
{
{
struct input_code *p = input_code_list;
@@ -5393,7 +4209,6 @@ void reinit(void)
input_f = FALSE;
alpha_f = FALSE;
mime_f = STRICT_MIME;
- mime_decode_f = FALSE;
mimebuf_f = FALSE;
broken_f = FALSE;
iso8859_f = FALSE;
@@ -5404,22 +4219,10 @@ void reinit(void)
x0201_f = NO_X0201;
#endif
iso2022jp_f = FALSE;
-#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
- ms_ucs_map_f = UCS_MAP_ASCII;
-#endif
-#ifdef UTF8_INPUT_ENABLE
- no_cp932ext_f = FALSE;
- ignore_zwnbsp_f = TRUE;
- no_best_fit_chars_f = FALSE;
- encode_fallback = NULL;
- unicode_subchar = '?';
-#endif
#ifdef UTF8_OUTPUT_ENABLE
unicode_bom_f = 0;
w_oconv16_LE = 0;
-#endif
-#ifdef UNICODE_NORMALIZATION
- nfc_f = FALSE;
+ ms_ucs_map_f = FALSE;
#endif
#ifdef INPUT_OPTION
cap_f = FALSE;
@@ -5437,13 +4240,9 @@ void reinit(void)
exec_f = 0;
#endif
#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
+ cp932_f = TRUE;
cp932inv_f = TRUE;
#endif
-#ifdef X0212_ENABLE
- x0212_f = FALSE;
- x0213_f = FALSE;
-#endif
{
int i;
for (i = 0; i < 256; i++){
@@ -5451,7 +4250,7 @@ void reinit(void)
}
}
#ifdef UTF8_INPUT_ENABLE
- utf16_mode = UTF16BE_INPUT;
+ utf16_mode = UTF16LE_INPUT;
#endif
mimeout_buf_count = 0;
mimeout_mode = 0;
@@ -5487,119 +4286,104 @@ void reinit(void)
input_mode = ASCII;
shift_mode = FALSE;
mime_decode_mode = FALSE;
- file_out_f = FALSE;
+ file_out = FALSE;
crmode_f = 0;
option_mode = 0;
broken_counter = 0;
broken_last = 0;
z_prev2=0,z_prev1=0;
-#ifdef CHECK_OPTION
- iconv_for_check = 0;
-#endif
- input_codename = "";
-#ifdef WIN32DLL
- reinitdll();
-#endif /*WIN32DLL*/
+
}
#endif
-void no_connection(nkf_char c2, nkf_char c1)
+void
+no_connection(c2,c1)
+int c2,c1;
{
no_connection2(c2,c1,0);
}
-nkf_char no_connection2(nkf_char c2, nkf_char c1, nkf_char c0)
+int
+no_connection2(c2,c1,c0)
+int c2,c1,c0;
{
fprintf(stderr,"nkf internal module connection failure.\n");
exit(1);
- return 0; /* LINT */
}
#ifndef PERL_XS
-#ifdef WIN32DLL
-#define fprintf dllprintf
-#endif
-void usage(void)
+void
+usage()
{
fprintf(stderr,"USAGE: nkf(nkf32,wnkf,nkf2) -[flags] [in file] .. [out file for -O flag]\n");
fprintf(stderr,"Flags:\n");
fprintf(stderr,"b,u Output is buffered (DEFAULT),Output is unbuffered\n");
#ifdef DEFAULT_CODE_SJIS
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift_JIS (DEFAULT), EUC-JP, UTF-8N\n");
+ fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS (DEFAULT), AT&T JIS (EUC), UTF-8\n");
#endif
#ifdef DEFAULT_CODE_JIS
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit (DEFAULT), Shift JIS, EUC-JP, UTF-8N\n");
+ fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit (DEFAULT), Shift JIS, AT&T JIS (EUC), UTF-8\n");
#endif
#ifdef DEFAULT_CODE_EUC
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS, EUC-JP (DEFAULT), UTF-8N\n");
+ fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS, AT&T JIS (EUC) (DEFAULT), UTF-8\n");
#endif
#ifdef DEFAULT_CODE_UTF8
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS, EUC-JP, UTF-8N (DEFAULT)\n");
+ fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS, AT&T JIS (EUC), UTF-8 (DEFAULT)\n");
#endif
#ifdef UTF8_OUTPUT_ENABLE
- fprintf(stderr," After 'w' you can add more options. -w[ 8 [0], 16 [[BL] [0]] ]\n");
+ fprintf(stderr," After 'w' you can add more options. (80?|16((B|L)0?)?) \n");
#endif
- fprintf(stderr,"J,S,E,W Input assumption is JIS 7 bit , Shift JIS, EUC-JP, UTF-8\n");
+ fprintf(stderr,"J,S,E,W Input assumption is JIS 7 bit , Shift JIS, AT&T JIS (EUC), UTF-8\n");
#ifdef UTF8_INPUT_ENABLE
- fprintf(stderr," After 'W' you can add more options. -W[ 8, 16 [BL] ] \n");
+ fprintf(stderr," After 'W' you can add more options. (8|16(B|L)?) \n");
#endif
fprintf(stderr,"t no conversion\n");
- fprintf(stderr,"i[@B] Specify the Esc Seq for JIS X 0208-1978/83 (DEFAULT B)\n");
- fprintf(stderr,"o[BJH] Specify the Esc Seq for ASCII/Roman (DEFAULT B)\n");
+ fprintf(stderr,"i_/o_ Output sequence to designate JIS-kanji/ASCII (DEFAULT B)\n");
fprintf(stderr,"r {de/en}crypt ROT13/47\n");
- fprintf(stderr,"h 1 katakana->hiragana, 2 hiragana->katakana, 3 both\n");
+ fprintf(stderr,"h 1 hirakana->katakana, 2 katakana->hirakana,3 both\n");
fprintf(stderr,"v Show this usage. V: show version\n");
fprintf(stderr,"m[BQN0] MIME decode [B:base64,Q:quoted,N:non-strict,0:no decode]\n");
fprintf(stderr,"M[BQ] MIME encode [B:base64 Q:quoted]\n");
fprintf(stderr,"l ISO8859-1 (Latin-1) support\n");
fprintf(stderr,"f/F Folding: -f60 or -f or -f60-10 (fold margin 10) F preserve nl\n");
- fprintf(stderr,"Z[0-3] Convert X0208 alphabet to ASCII\n");
- fprintf(stderr," 1: Kankaku to 1 space 2: to 2 spaces 3: Convert to HTML Entity\n");
+ fprintf(stderr,"Z[0-3] Convert X0208 alphabet to ASCII 1: Kankaku to space,2: 2 spaces,\n");
+ fprintf(stderr," 3: Convert HTML Entity\n");
fprintf(stderr,"X,x Assume X0201 kana in MS-Kanji, -x preserves X0201\n");
fprintf(stderr,"B[0-2] Broken input 0: missing ESC,1: any X on ESC-[($]-X,2: ASCII on NL\n");
#ifdef MSDOS
fprintf(stderr,"T Text mode output\n");
#endif
fprintf(stderr,"O Output to File (DEFAULT 'nkf.out')\n");
+ fprintf(stderr,"d,c Delete \\r in line feed and \\032, Add \\r in line feed\n");
fprintf(stderr,"I Convert non ISO-2022-JP charactor to GETA\n");
- fprintf(stderr,"d,c Convert line breaks -d: LF -c: CRLF\n");
fprintf(stderr,"-L[uwm] line mode u:LF w:CRLF m:CR (DEFAULT noconversion)\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"Long name options\n");
- fprintf(stderr," --ic=<input codeset> --oc=<output codeset>\n");
- fprintf(stderr," Specify the input or output codeset\n");
- fprintf(stderr," --fj --unix --mac --windows\n");
- fprintf(stderr," --jis --euc --sjis --utf8 --utf16 --mime --base64\n");
- fprintf(stderr," Convert for the system or code\n");
- fprintf(stderr," --hiragana --katakana --katakana-hiragana\n");
- fprintf(stderr," To Hiragana/Katakana Conversion\n");
- fprintf(stderr," --prefix= Insert escape before troublesome characters of Shift_JIS\n");
+ fprintf(stderr,"long name options\n");
+ fprintf(stderr," --fj,--unix,--mac,--windows convert for the system\n");
+ fprintf(stderr," --jis,--euc,--sjis,--utf8,--utf16,--mime,--base64 convert for the code\n");
+ fprintf(stderr," --hiragana, --katakana Hiragana/Katakana Conversion\n");
+ fprintf(stderr," --cp932, --no-cp932 CP932 compatible\n");
#ifdef INPUT_OPTION
fprintf(stderr," --cap-input, --url-input Convert hex after ':' or '%%'\n");
#endif
#ifdef NUMCHAR_OPTION
fprintf(stderr," --numchar-input Convert Unicode Character Reference\n");
#endif
-#ifdef UTF8_INPUT_ENABLE
- fprintf(stderr," --fb-{skip, html, xml, perl, java, subchar}\n");
- fprintf(stderr," Specify how nkf handles unassigned characters\n");
+#ifdef UTF8_OUTPUT_ENABLE
+ fprintf(stderr," --ms-ucs-map Microsoft UCS Mapping Compatible\n");
#endif
#ifdef OVERWRITE
- fprintf(stderr," --in-place[=SUFFIX] --overwrite[=SUFFIX]\n");
- fprintf(stderr," Overwrite original listed files by filtered result\n");
- fprintf(stderr," --overwrite preserves timestamp of original files\n");
-#endif
- fprintf(stderr," -g --guess Guess the input code\n");
- fprintf(stderr," --help --version Show this help/the version\n");
- fprintf(stderr," For more information, see also man nkf\n");
- fprintf(stderr,"\n");
+ fprintf(stderr," --overwrite Overwrite original listed files by filtered result\n");
+#endif
+ fprintf(stderr," -g, --guess Guess the input code\n");
+ fprintf(stderr," --help,--version\n");
version();
}
-void version(void)
+void
+version()
{
fprintf(stderr,"Network Kanji Filter Version %s (%s) "
-#if defined(MSDOS) && !defined(__WIN32__) && !defined(__WIN16__) && !defined(__OS2__)
+#if defined(MSDOS) && !defined(__WIN32__) && !defined(__WIN16__)
"for DOS"
#endif
#if defined(MSDOS) && defined(__WIN16__)
@@ -5614,7 +4398,7 @@ void version(void)
,NKF_VERSION,NKF_RELEASE_DATE);
fprintf(stderr,"\n%s\n",CopyRight);
}
-#endif /*PERL_XS*/
+#endif
/**
** $B%Q%C%A@):n<T(B
diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c
index 9e59956a0a..7969081b4f 100644
--- a/ext/nkf/nkf-utf8/utf8tbl.c
+++ b/ext/nkf/nkf-utf8/utf8tbl.c
@@ -1,23 +1,23 @@
#include "config.h"
#ifdef UTF8_OUTPUT_ENABLE
-const unsigned short euc_to_utf8_A1[] = {
+unsigned short euc_to_utf8_A1[] = {
0x3000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A,
0xFF1B, 0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8,
- 0xFF3E, 0x203E, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003,
- 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2014, 0x2010, 0xFF0F,
+ 0xFF3E, 0xFFE3, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003,
+ 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2015, 0x2010, 0xFF0F,
0xFF3C, 0x301C, 0x2016, 0xFF5C, 0x2026, 0x2025, 0x2018, 0x2019,
0x201C, 0x201D, 0xFF08, 0xFF09, 0x3014, 0x3015, 0xFF3B, 0xFF3D,
0xFF5B, 0xFF5D, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D,
0x300E, 0x300F, 0x3010, 0x3011, 0xFF0B, 0x2212, 0x00B1, 0x00D7,
0x00F7, 0xFF1D, 0x2260, 0xFF1C, 0xFF1E, 0x2266, 0x2267, 0x221E,
- 0x2234, 0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0x00A5,
+ 0x2234, 0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0xFFE5,
0xFF04, 0x00A2, 0x00A3, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20,
0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7,
};
/* Microsoft UCS Mapping Compatible */
-const unsigned short euc_to_utf8_A1_ms[] = {
+unsigned short euc_to_utf8_A1_ms[] = {
0x3000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A,
0xFF1B, 0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8,
0xFF3E, 0xFFE3, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003,
@@ -31,7 +31,8 @@ const unsigned short euc_to_utf8_A1_ms[] = {
0xFF04, 0xFFE0, 0xFFE1, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20,
0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7,
};
-const unsigned short euc_to_utf8_A2[] = {
+
+unsigned short euc_to_utf8_A2[] = {
0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC,
0x203B, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -47,7 +48,7 @@ const unsigned short euc_to_utf8_A2[] = {
};
/* Microsoft UCS Mapping Compatible */
-const unsigned short euc_to_utf8_A2_ms[] = {
+unsigned short euc_to_utf8_A2_ms[] = {
0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC,
0x203B, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -61,7 +62,7 @@ const unsigned short euc_to_utf8_A2_ms[] = {
0, 0, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020,
0x2021, 0x00B6, 0, 0, 0, 0, 0x25EF,
};
-const unsigned short euc_to_utf8_A3[] = {
+unsigned short euc_to_utf8_A3[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17,
@@ -75,7 +76,7 @@ const unsigned short euc_to_utf8_A3[] = {
0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57,
0xFF58, 0xFF59, 0xFF5A, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_A4[] = {
+unsigned short euc_to_utf8_A4[] = {
0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047,
0x3048, 0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F,
0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057,
@@ -89,7 +90,7 @@ const unsigned short euc_to_utf8_A4[] = {
0x3090, 0x3091, 0x3092, 0x3093, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_A5[] = {
+unsigned short euc_to_utf8_A5[] = {
0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7,
0x30A8, 0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF,
0x30B0, 0x30B1, 0x30B2, 0x30B3, 0x30B4, 0x30B5, 0x30B6, 0x30B7,
@@ -103,7 +104,7 @@ const unsigned short euc_to_utf8_A5[] = {
0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_A6[] = {
+unsigned short euc_to_utf8_A6[] = {
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8,
@@ -117,7 +118,7 @@ const unsigned short euc_to_utf8_A6[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_A7[] = {
+unsigned short euc_to_utf8_A7[] = {
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401,
0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D,
0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425,
@@ -131,7 +132,7 @@ const unsigned short euc_to_utf8_A7[] = {
0x044E, 0x044F, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_A8[] = {
+unsigned short euc_to_utf8_A8[] = {
0x2500, 0x2502, 0x250C, 0x2510, 0x2518, 0x2514, 0x251C,
0x252C, 0x2524, 0x2534, 0x253C, 0x2501, 0x2503, 0x250F, 0x2513,
0x251B, 0x2517, 0x2523, 0x2533, 0x252B, 0x253B, 0x254B, 0x2520,
@@ -145,7 +146,7 @@ const unsigned short euc_to_utf8_A8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_A9[] = {
+unsigned short euc_to_utf8_A9[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466,
0x2467, 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E,
0x246F, 0x2470, 0x2471, 0x2472, 0x2473, 0, 0, 0,
@@ -159,7 +160,7 @@ const unsigned short euc_to_utf8_A9[] = {
0, 0, 0x2488, 0x2489, 0x248A, 0x248B, 0x248C, 0x248D,
0x248E, 0x248F, 0x2490, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_AA[] = {
+unsigned short euc_to_utf8_AA[] = {
0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166,
0x2167, 0x2168, 0x2169, 0x216A, 0x216B, 0, 0, 0,
0, 0, 0, 0, 0, 0x2170, 0x2171, 0x2172,
@@ -173,7 +174,7 @@ const unsigned short euc_to_utf8_AA[] = {
0x24AF, 0x24B0, 0x24B1, 0x24B2, 0x24B3, 0x24B4, 0x24B5, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_AB[] = {
+unsigned short euc_to_utf8_AB[] = {
0x339C, 0x339F, 0x339D, 0x33A0, 0x33A4, 0, 0x33A1,
0x33A5, 0x339E, 0x33A2, 0x338E, 0, 0x338F, 0x33C4, 0x3396,
0x3397, 0x2113, 0x3398, 0x33B3, 0x33B2, 0x33B1, 0x33B0, 0x2109,
@@ -187,7 +188,7 @@ const unsigned short euc_to_utf8_AB[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x2116, 0x33CD, 0x2121, 0,
};
-const unsigned short euc_to_utf8_AC[] = {
+unsigned short euc_to_utf8_AC[] = {
0x2664, 0x2667, 0x2661, 0x2662, 0x2660, 0x2663, 0x2665,
0x2666, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x3020, 0x260E, 0x3004,
@@ -201,7 +202,7 @@ const unsigned short euc_to_utf8_AC[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_AD[] = {
+unsigned short euc_to_utf8_AD[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466,
0x2467, 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E,
0x246F, 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162,
@@ -215,7 +216,7 @@ const unsigned short euc_to_utf8_AD[] = {
0x2252, 0x2261, 0x222B, 0x222E, 0x2211, 0x221A, 0x22A5, 0x2220,
0x221F, 0x22BF, 0x2235, 0x2229, 0x222A, 0, 0x3299,
};
-const unsigned short euc_to_utf8_AE[] = {
+unsigned short euc_to_utf8_AE[] = {
0x3349, 0x3322, 0x334D, 0x3314, 0x3316, 0x3305, 0x3333,
0x334E, 0x3303, 0x3336, 0x3318, 0x3315, 0x3327, 0x3351, 0x334A,
0x3339, 0x3357, 0x330D, 0x3342, 0x3323, 0x3326, 0x333B, 0x332B,
@@ -229,7 +230,7 @@ const unsigned short euc_to_utf8_AE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x337F, 0, 0,
};
-const unsigned short euc_to_utf8_AF[] = {
+unsigned short euc_to_utf8_AF[] = {
0x222E, 0x221F, 0x22BF, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x301D, 0x301F, 0,
@@ -243,7 +244,7 @@ const unsigned short euc_to_utf8_AF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_B0[] = {
+unsigned short euc_to_utf8_B0[] = {
0x4E9C, 0x5516, 0x5A03, 0x963F, 0x54C0, 0x611B, 0x6328,
0x59F6, 0x9022, 0x8475, 0x831C, 0x7A50, 0x60AA, 0x63E1, 0x6E25,
0x65ED, 0x8466, 0x82A6, 0x9BF5, 0x6893, 0x5727, 0x65A1, 0x6271,
@@ -257,7 +258,7 @@ const unsigned short euc_to_utf8_B0[] = {
0x7A32, 0x8328, 0x828B, 0x9C2F, 0x5141, 0x5370, 0x54BD, 0x54E1,
0x56E0, 0x59FB, 0x5F15, 0x98F2, 0x6DEB, 0x80E4, 0x852D,
};
-const unsigned short euc_to_utf8_B1[] = {
+unsigned short euc_to_utf8_B1[] = {
0x9662, 0x9670, 0x96A0, 0x97FB, 0x540B, 0x53F3, 0x5B87,
0x70CF, 0x7FBD, 0x8FC2, 0x96E8, 0x536F, 0x9D5C, 0x7ABA, 0x4E11,
0x7893, 0x81FC, 0x6E26, 0x5618, 0x5504, 0x6B1D, 0x851A, 0x9C3B,
@@ -271,7 +272,7 @@ const unsigned short euc_to_utf8_B1[] = {
0x8276, 0x82D1, 0x8597, 0x9060, 0x925B, 0x9D1B, 0x5869, 0x65BC,
0x6C5A, 0x7525, 0x51F9, 0x592E, 0x5965, 0x5F80, 0x5FDC,
};
-const unsigned short euc_to_utf8_B2[] = {
+unsigned short euc_to_utf8_B2[] = {
0x62BC, 0x65FA, 0x6A2A, 0x6B27, 0x6BB4, 0x738B, 0x7FC1,
0x8956, 0x9D2C, 0x9D0E, 0x9EC4, 0x5CA1, 0x6C96, 0x837B, 0x5104,
0x5C4B, 0x61B6, 0x81C6, 0x6876, 0x7261, 0x4E59, 0x4FFA, 0x5378,
@@ -285,7 +286,7 @@ const unsigned short euc_to_utf8_B2[] = {
0x4ECB, 0x4F1A, 0x89E3, 0x56DE, 0x584A, 0x58CA, 0x5EFB, 0x5FEB,
0x602A, 0x6094, 0x6062, 0x61D0, 0x6212, 0x62D0, 0x6539,
};
-const unsigned short euc_to_utf8_B3[] = {
+unsigned short euc_to_utf8_B3[] = {
0x9B41, 0x6666, 0x68B0, 0x6D77, 0x7070, 0x754C, 0x7686,
0x7D75, 0x82A5, 0x87F9, 0x958B, 0x968E, 0x8C9D, 0x51F1, 0x52BE,
0x5916, 0x54B3, 0x5BB3, 0x5D16, 0x6168, 0x6982, 0x6DAF, 0x788D,
@@ -299,7 +300,7 @@ const unsigned short euc_to_utf8_B3[] = {
0x53F6, 0x691B, 0x6A3A, 0x9784, 0x682A, 0x515C, 0x7AC3, 0x84B2,
0x91DC, 0x938C, 0x565B, 0x9D28, 0x6822, 0x8305, 0x8431,
};
-const unsigned short euc_to_utf8_B4[] = {
+unsigned short euc_to_utf8_B4[] = {
0x7CA5, 0x5208, 0x82C5, 0x74E6, 0x4E7E, 0x4F83, 0x51A0,
0x5BD2, 0x520A, 0x52D8, 0x52E7, 0x5DFB, 0x559A, 0x582A, 0x59E6,
0x5B8C, 0x5B98, 0x5BDB, 0x5E72, 0x5E79, 0x60A3, 0x611F, 0x6163,
@@ -313,7 +314,7 @@ const unsigned short euc_to_utf8_B4[] = {
0x57FA, 0x5947, 0x5B09, 0x5BC4, 0x5C90, 0x5E0C, 0x5E7E, 0x5FCC,
0x63EE, 0x673A, 0x65D7, 0x65E2, 0x671F, 0x68CB, 0x68C4,
};
-const unsigned short euc_to_utf8_B5[] = {
+unsigned short euc_to_utf8_B5[] = {
0x6A5F, 0x5E30, 0x6BC5, 0x6C17, 0x6C7D, 0x757F, 0x7948,
0x5B63, 0x7A00, 0x7D00, 0x5FBD, 0x898F, 0x8A18, 0x8CB4, 0x8D77,
0x8ECC, 0x8F1D, 0x98E2, 0x9A0E, 0x9B3C, 0x4E80, 0x507D, 0x5100,
@@ -327,7 +328,7 @@ const unsigned short euc_to_utf8_B5[] = {
0x5DE8, 0x62D2, 0x62E0, 0x6319, 0x6E20, 0x865A, 0x8A31, 0x8DDD,
0x92F8, 0x6F01, 0x79A6, 0x9B5A, 0x4EA8, 0x4EAB, 0x4EAC,
};
-const unsigned short euc_to_utf8_B6[] = {
+unsigned short euc_to_utf8_B6[] = {
0x4F9B, 0x4FA0, 0x50D1, 0x5147, 0x7AF6, 0x5171, 0x51F6,
0x5354, 0x5321, 0x537F, 0x53EB, 0x55AC, 0x5883, 0x5CE1, 0x5F37,
0x5F4A, 0x602F, 0x6050, 0x606D, 0x631F, 0x6559, 0x6A4B, 0x6CC1,
@@ -341,7 +342,7 @@ const unsigned short euc_to_utf8_B6[] = {
0x99D2, 0x5177, 0x611A, 0x865E, 0x55B0, 0x7A7A, 0x5076, 0x5BD3,
0x9047, 0x9685, 0x4E32, 0x6ADB, 0x91E7, 0x5C51, 0x5C48,
};
-const unsigned short euc_to_utf8_B7[] = {
+unsigned short euc_to_utf8_B7[] = {
0x6398, 0x7A9F, 0x6C93, 0x9774, 0x8F61, 0x7AAA, 0x718A,
0x9688, 0x7C82, 0x6817, 0x7E70, 0x6851, 0x936C, 0x52F2, 0x541B,
0x85AB, 0x8A13, 0x7FA4, 0x8ECD, 0x90E1, 0x5366, 0x8888, 0x7941,
@@ -355,7 +356,7 @@ const unsigned short euc_to_utf8_B7[] = {
0x5039, 0x5026, 0x5065, 0x517C, 0x5238, 0x5263, 0x55A7, 0x570F,
0x5805, 0x5ACC, 0x5EFA, 0x61B2, 0x61F8, 0x62F3, 0x6372,
};
-const unsigned short euc_to_utf8_B8[] = {
+unsigned short euc_to_utf8_B8[] = {
0x691C, 0x6A29, 0x727D, 0x72AC, 0x732E, 0x7814, 0x786F,
0x7D79, 0x770C, 0x80A9, 0x898B, 0x8B19, 0x8CE2, 0x8ED2, 0x9063,
0x9375, 0x967A, 0x9855, 0x9A13, 0x9E78, 0x5143, 0x539F, 0x53B3,
@@ -369,7 +370,7 @@ const unsigned short euc_to_utf8_B8[] = {
0x4E5E, 0x9BC9, 0x4EA4, 0x4F7C, 0x4FAF, 0x5019, 0x5016, 0x5149,
0x516C, 0x529F, 0x52B9, 0x52FE, 0x539A, 0x53E3, 0x5411,
};
-const unsigned short euc_to_utf8_B9[] = {
+unsigned short euc_to_utf8_B9[] = {
0x540E, 0x5589, 0x5751, 0x57A2, 0x597D, 0x5B54, 0x5B5D,
0x5B8F, 0x5DE5, 0x5DE7, 0x5DF7, 0x5E78, 0x5E83, 0x5E9A, 0x5EB7,
0x5F18, 0x6052, 0x614C, 0x6297, 0x62D8, 0x63A7, 0x653B, 0x6602,
@@ -383,7 +384,7 @@ const unsigned short euc_to_utf8_B9[] = {
0x544A, 0x56FD, 0x7A40, 0x9177, 0x9D60, 0x9ED2, 0x7344, 0x6F09,
0x8170, 0x7511, 0x5FFD, 0x60DA, 0x9AA8, 0x72DB, 0x8FBC,
};
-const unsigned short euc_to_utf8_BA[] = {
+unsigned short euc_to_utf8_BA[] = {
0x6B64, 0x9803, 0x4ECA, 0x56F0, 0x5764, 0x58BE, 0x5A5A,
0x6068, 0x61C7, 0x660F, 0x6606, 0x6839, 0x68B1, 0x6DF7, 0x75D5,
0x7D3A, 0x826E, 0x9B42, 0x4E9B, 0x4F50, 0x53C9, 0x5506, 0x5D6F,
@@ -397,7 +398,7 @@ const unsigned short euc_to_utf8_BA[] = {
0x548B, 0x643E, 0x6628, 0x6714, 0x67F5, 0x7A84, 0x7B56, 0x7D22,
0x932F, 0x685C, 0x9BAD, 0x7B39, 0x5319, 0x518A, 0x5237,
};
-const unsigned short euc_to_utf8_BB[] = {
+unsigned short euc_to_utf8_BB[] = {
0x5BDF, 0x62F6, 0x64AE, 0x64E6, 0x672D, 0x6BBA, 0x85A9,
0x96D1, 0x7690, 0x9BD6, 0x634C, 0x9306, 0x9BAB, 0x76BF, 0x6652,
0x4E09, 0x5098, 0x53C2, 0x5C71, 0x60E8, 0x6492, 0x6563, 0x685F,
@@ -411,7 +412,7 @@ const unsigned short euc_to_utf8_BB[] = {
0x8AEE, 0x8CC7, 0x8CDC, 0x96CC, 0x98FC, 0x6B6F, 0x4E8B, 0x4F3C,
0x4F8D, 0x5150, 0x5B57, 0x5BFA, 0x6148, 0x6301, 0x6642,
};
-const unsigned short euc_to_utf8_BC[] = {
+unsigned short euc_to_utf8_BC[] = {
0x6B21, 0x6ECB, 0x6CBB, 0x723E, 0x74BD, 0x75D4, 0x78C1,
0x793A, 0x800C, 0x8033, 0x81EA, 0x8494, 0x8F9E, 0x6C50, 0x9E7F,
0x5F0F, 0x8B58, 0x9D2B, 0x7AFA, 0x8EF8, 0x5B8D, 0x96EB, 0x4E03,
@@ -425,7 +426,7 @@ const unsigned short euc_to_utf8_BC[] = {
0x816B, 0x8DA3, 0x9152, 0x9996, 0x5112, 0x53D7, 0x546A, 0x5BFF,
0x6388, 0x6A39, 0x7DAC, 0x9700, 0x56DA, 0x53CE, 0x5468,
};
-const unsigned short euc_to_utf8_BD[] = {
+unsigned short euc_to_utf8_BD[] = {
0x5B97, 0x5C31, 0x5DDE, 0x4FEE, 0x6101, 0x62FE, 0x6D32,
0x79C0, 0x79CB, 0x7D42, 0x7E4D, 0x7FD2, 0x81ED, 0x821F, 0x8490,
0x8846, 0x8972, 0x8B90, 0x8E74, 0x8F2F, 0x9031, 0x914B, 0x916C,
@@ -439,7 +440,7 @@ const unsigned short euc_to_utf8_BD[] = {
0x7F72, 0x66F8, 0x85AF, 0x85F7, 0x8AF8, 0x52A9, 0x53D9, 0x5973,
0x5E8F, 0x5F90, 0x6055, 0x92E4, 0x9664, 0x50B7, 0x511F,
};
-const unsigned short euc_to_utf8_BE[] = {
+unsigned short euc_to_utf8_BE[] = {
0x52DD, 0x5320, 0x5347, 0x53EC, 0x54E8, 0x5546, 0x5531,
0x5617, 0x5968, 0x59BE, 0x5A3C, 0x5BB5, 0x5C06, 0x5C0F, 0x5C11,
0x5C1A, 0x5E84, 0x5E8A, 0x5EE0, 0x5F70, 0x627F, 0x6284, 0x62DB,
@@ -453,7 +454,7 @@ const unsigned short euc_to_utf8_BE[] = {
0x60C5, 0x64FE, 0x6761, 0x6756, 0x6D44, 0x72B6, 0x7573, 0x7A63,
0x84B8, 0x8B72, 0x91B8, 0x9320, 0x5631, 0x57F4, 0x98FE,
};
-const unsigned short euc_to_utf8_BF[] = {
+unsigned short euc_to_utf8_BF[] = {
0x62ED, 0x690D, 0x6B96, 0x71ED, 0x7E54, 0x8077, 0x8272,
0x89E6, 0x98DF, 0x8755, 0x8FB1, 0x5C3B, 0x4F38, 0x4FE1, 0x4FB5,
0x5507, 0x5A20, 0x5BDD, 0x5BE9, 0x5FC3, 0x614E, 0x632F, 0x65B0,
@@ -467,7 +468,7 @@ const unsigned short euc_to_utf8_BF[] = {
0x745E, 0x9AC4, 0x5D07, 0x5D69, 0x6570, 0x67A2, 0x8DA8, 0x96DB,
0x636E, 0x6749, 0x6919, 0x83C5, 0x9817, 0x96C0, 0x88FE,
};
-const unsigned short euc_to_utf8_C0[] = {
+unsigned short euc_to_utf8_C0[] = {
0x6F84, 0x647A, 0x5BF8, 0x4E16, 0x702C, 0x755D, 0x662F,
0x51C4, 0x5236, 0x52E2, 0x59D3, 0x5F81, 0x6027, 0x6210, 0x653F,
0x6574, 0x661F, 0x6674, 0x68F2, 0x6816, 0x6B63, 0x6E05, 0x7272,
@@ -481,7 +482,7 @@ const unsigned short euc_to_utf8_C0[] = {
0x6247, 0x64B0, 0x6813, 0x6834, 0x6CC9, 0x6D45, 0x6D17, 0x67D3,
0x6F5C, 0x714E, 0x717D, 0x65CB, 0x7A7F, 0x7BAD, 0x7DDA,
};
-const unsigned short euc_to_utf8_C1[] = {
+unsigned short euc_to_utf8_C1[] = {
0x7E4A, 0x7FA8, 0x817A, 0x821B, 0x8239, 0x85A6, 0x8A6E,
0x8CCE, 0x8DF5, 0x9078, 0x9077, 0x92AD, 0x9291, 0x9583, 0x9BAE,
0x524D, 0x5584, 0x6F38, 0x7136, 0x5168, 0x7985, 0x7E55, 0x81B3,
@@ -495,7 +496,7 @@ const unsigned short euc_to_utf8_C1[] = {
0x8349, 0x8358, 0x846C, 0x84BC, 0x85FB, 0x88C5, 0x8D70, 0x9001,
0x906D, 0x9397, 0x971C, 0x9A12, 0x50CF, 0x5897, 0x618E,
};
-const unsigned short euc_to_utf8_C2[] = {
+unsigned short euc_to_utf8_C2[] = {
0x81D3, 0x8535, 0x8D08, 0x9020, 0x4FC3, 0x5074, 0x5247,
0x5373, 0x606F, 0x6349, 0x675F, 0x6E2C, 0x8DB3, 0x901F, 0x4FD7,
0x5C5E, 0x8CCA, 0x65CF, 0x7D9A, 0x5352, 0x8896, 0x5176, 0x63C3,
@@ -509,7 +510,7 @@ const unsigned short euc_to_utf8_C2[] = {
0x5B85, 0x6258, 0x629E, 0x62D3, 0x6CA2, 0x6FEF, 0x7422, 0x8A17,
0x9438, 0x6FC1, 0x8AFE, 0x8338, 0x51E7, 0x86F8, 0x53EA,
};
-const unsigned short euc_to_utf8_C3[] = {
+unsigned short euc_to_utf8_C3[] = {
0x53E9, 0x4F46, 0x9054, 0x8FB0, 0x596A, 0x8131, 0x5DFD,
0x7AEA, 0x8FBF, 0x68DA, 0x8C37, 0x72F8, 0x9C48, 0x6A3D, 0x8AB0,
0x4E39, 0x5358, 0x5606, 0x5766, 0x62C5, 0x63A2, 0x65E6, 0x6B4E,
@@ -523,7 +524,7 @@ const unsigned short euc_to_utf8_C3[] = {
0x8A3B, 0x914E, 0x92F3, 0x99D0, 0x6A17, 0x7026, 0x732A, 0x82E7,
0x8457, 0x8CAF, 0x4E01, 0x5146, 0x51CB, 0x558B, 0x5BF5,
};
-const unsigned short euc_to_utf8_C4[] = {
+unsigned short euc_to_utf8_C4[] = {
0x5E16, 0x5E33, 0x5E81, 0x5F14, 0x5F35, 0x5F6B, 0x5FB4,
0x61F2, 0x6311, 0x66A2, 0x671D, 0x6F6E, 0x7252, 0x753A, 0x773A,
0x8074, 0x8139, 0x8178, 0x8776, 0x8ABF, 0x8ADC, 0x8D85, 0x8DF3,
@@ -537,7 +538,7 @@ const unsigned short euc_to_utf8_C4[] = {
0x608C, 0x62B5, 0x633A, 0x63D0, 0x68AF, 0x6C40, 0x7887, 0x798E,
0x7A0B, 0x7DE0, 0x8247, 0x8A02, 0x8AE6, 0x8E44, 0x9013,
};
-const unsigned short euc_to_utf8_C5[] = {
+unsigned short euc_to_utf8_C5[] = {
0x90B8, 0x912D, 0x91D8, 0x9F0E, 0x6CE5, 0x6458, 0x64E2,
0x6575, 0x6EF4, 0x7684, 0x7B1B, 0x9069, 0x93D1, 0x6EBA, 0x54F2,
0x5FB9, 0x64A4, 0x8F4D, 0x8FED, 0x9244, 0x5178, 0x586B, 0x5929,
@@ -551,7 +552,7 @@ const unsigned short euc_to_utf8_C5[] = {
0x76D7, 0x6DD8, 0x6E6F, 0x6D9B, 0x706F, 0x71C8, 0x5F53, 0x75D8,
0x7977, 0x7B49, 0x7B54, 0x7B52, 0x7CD6, 0x7D71, 0x5230,
};
-const unsigned short euc_to_utf8_C6[] = {
+unsigned short euc_to_utf8_C6[] = {
0x8463, 0x8569, 0x85E4, 0x8A0E, 0x8B04, 0x8C46, 0x8E0F,
0x9003, 0x900F, 0x9419, 0x9676, 0x982D, 0x9A30, 0x95D8, 0x50CD,
0x52D5, 0x540C, 0x5802, 0x5C0E, 0x61A7, 0x649E, 0x6D1E, 0x77B3,
@@ -565,7 +566,7 @@ const unsigned short euc_to_utf8_C6[] = {
0x8EDF, 0x96E3, 0x6C5D, 0x4E8C, 0x5C3C, 0x5F10, 0x8FE9, 0x5302,
0x8CD1, 0x8089, 0x8679, 0x5EFF, 0x65E5, 0x4E73, 0x5165,
};
-const unsigned short euc_to_utf8_C7[] = {
+unsigned short euc_to_utf8_C7[] = {
0x5982, 0x5C3F, 0x97EE, 0x4EFB, 0x598A, 0x5FCD, 0x8A8D,
0x6FE1, 0x79B0, 0x7962, 0x5BE7, 0x8471, 0x732B, 0x71B1, 0x5E74,
0x5FF5, 0x637B, 0x649A, 0x71C3, 0x7C98, 0x4E43, 0x5EFC, 0x4E4B,
@@ -579,7 +580,7 @@ const unsigned short euc_to_utf8_C7[] = {
0x67CF, 0x6CCA, 0x767D, 0x7B94, 0x7C95, 0x8236, 0x8584, 0x8FEB,
0x66DD, 0x6F20, 0x7206, 0x7E1B, 0x83AB, 0x99C1, 0x9EA6,
};
-const unsigned short euc_to_utf8_C8[] = {
+unsigned short euc_to_utf8_C8[] = {
0x51FD, 0x7BB1, 0x7872, 0x7BB8, 0x8087, 0x7B48, 0x6AE8,
0x5E61, 0x808C, 0x7551, 0x7560, 0x516B, 0x9262, 0x6E8C, 0x767A,
0x9197, 0x9AEA, 0x4F10, 0x7F70, 0x629C, 0x7B4F, 0x95A5, 0x9CE9,
@@ -593,7 +594,7 @@ const unsigned short euc_to_utf8_C8[] = {
0x8AB9, 0x8CBB, 0x907F, 0x975E, 0x98DB, 0x6A0B, 0x7C38, 0x5099,
0x5C3E, 0x5FAE, 0x6787, 0x6BD8, 0x7435, 0x7709, 0x7F8E,
};
-const unsigned short euc_to_utf8_C9[] = {
+unsigned short euc_to_utf8_C9[] = {
0x9F3B, 0x67CA, 0x7A17, 0x5339, 0x758B, 0x9AED, 0x5F66,
0x819D, 0x83F1, 0x8098, 0x5F3C, 0x5FC5, 0x7562, 0x7B46, 0x903C,
0x6867, 0x59EB, 0x5A9B, 0x7D10, 0x767E, 0x8B2C, 0x4FF5, 0x5F6A,
@@ -607,7 +608,7 @@ const unsigned short euc_to_utf8_C9[] = {
0x6B66, 0x821E, 0x8461, 0x856A, 0x90E8, 0x5C01, 0x6953, 0x98A8,
0x847A, 0x8557, 0x4F0F, 0x526F, 0x5FA9, 0x5E45, 0x670D,
};
-const unsigned short euc_to_utf8_CA[] = {
+unsigned short euc_to_utf8_CA[] = {
0x798F, 0x8179, 0x8907, 0x8986, 0x6DF5, 0x5F17, 0x6255,
0x6CB8, 0x4ECF, 0x7269, 0x9B92, 0x5206, 0x543B, 0x5674, 0x58B3,
0x61A4, 0x626E, 0x711A, 0x596E, 0x7C89, 0x7CDE, 0x7D1B, 0x96F0,
@@ -621,7 +622,7 @@ const unsigned short euc_to_utf8_CA[] = {
0x4FF8, 0x5305, 0x5446, 0x5831, 0x5949, 0x5B9D, 0x5CF0, 0x5CEF,
0x5D29, 0x5E96, 0x62B1, 0x6367, 0x653E, 0x65B9, 0x670B,
};
-const unsigned short euc_to_utf8_CB[] = {
+unsigned short euc_to_utf8_CB[] = {
0x6CD5, 0x6CE1, 0x70F9, 0x7832, 0x7E2B, 0x80DE, 0x82B3,
0x840C, 0x84EC, 0x8702, 0x8912, 0x8A2A, 0x8C4A, 0x90A6, 0x92D2,
0x98FD, 0x9CF3, 0x9D6C, 0x4E4F, 0x4EA1, 0x508D, 0x5256, 0x574A,
@@ -635,7 +636,7 @@ const unsigned short euc_to_utf8_CB[] = {
0x9C52, 0x685D, 0x4EA6, 0x4FE3, 0x53C8, 0x62B9, 0x672B, 0x6CAB,
0x8FC4, 0x4FAD, 0x7E6D, 0x9EBF, 0x4E07, 0x6162, 0x6E80,
};
-const unsigned short euc_to_utf8_CC[] = {
+unsigned short euc_to_utf8_CC[] = {
0x6F2B, 0x8513, 0x5473, 0x672A, 0x9B45, 0x5DF3, 0x7B95,
0x5CAC, 0x5BC6, 0x871C, 0x6E4A, 0x84D1, 0x7A14, 0x8108, 0x5999,
0x7C8D, 0x6C11, 0x7720, 0x52D9, 0x5922, 0x7121, 0x725F, 0x77DB,
@@ -649,7 +650,7 @@ const unsigned short euc_to_utf8_CC[] = {
0x77E2, 0x5384, 0x5F79, 0x7D04, 0x85AC, 0x8A33, 0x8E8D, 0x9756,
0x67F3, 0x85AE, 0x9453, 0x6109, 0x6108, 0x6CB9, 0x7652,
};
-const unsigned short euc_to_utf8_CD[] = {
+unsigned short euc_to_utf8_CD[] = {
0x8AED, 0x8F38, 0x552F, 0x4F51, 0x512A, 0x52C7, 0x53CB,
0x5BA5, 0x5E7D, 0x60A0, 0x6182, 0x63D6, 0x6709, 0x67DA, 0x6E67,
0x6D8C, 0x7336, 0x7337, 0x7531, 0x7950, 0x88D5, 0x8A98, 0x904A,
@@ -663,7 +664,7 @@ const unsigned short euc_to_utf8_CD[] = {
0x4E71, 0x5375, 0x5D50, 0x6B04, 0x6FEB, 0x85CD, 0x862D, 0x89A7,
0x5229, 0x540F, 0x5C65, 0x674E, 0x68A8, 0x7406, 0x7483,
};
-const unsigned short euc_to_utf8_CE[] = {
+unsigned short euc_to_utf8_CE[] = {
0x75E2, 0x88CF, 0x88E1, 0x91CC, 0x96E2, 0x9678, 0x5F8B,
0x7387, 0x7ACB, 0x844E, 0x63A0, 0x7565, 0x5289, 0x6D41, 0x6E9C,
0x7409, 0x7559, 0x786B, 0x7C92, 0x9686, 0x7ADC, 0x9F8D, 0x4FB6,
@@ -677,7 +678,7 @@ const unsigned short euc_to_utf8_CE[] = {
0x9F62, 0x66A6, 0x6B74, 0x5217, 0x52A3, 0x70C8, 0x88C2, 0x5EC9,
0x604B, 0x6190, 0x6F23, 0x7149, 0x7C3E, 0x7DF4, 0x806F,
};
-const unsigned short euc_to_utf8_CF[] = {
+unsigned short euc_to_utf8_CF[] = {
0x84EE, 0x9023, 0x932C, 0x5442, 0x9B6F, 0x6AD3, 0x7089,
0x8CC2, 0x8DEF, 0x9732, 0x52B4, 0x5A41, 0x5ECA, 0x5F04, 0x6717,
0x697C, 0x6994, 0x6D6A, 0x6F0F, 0x7262, 0x72FC, 0x7BED, 0x8001,
@@ -691,7 +692,7 @@ const unsigned short euc_to_utf8_CF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_D0[] = {
+unsigned short euc_to_utf8_D0[] = {
0x5F0C, 0x4E10, 0x4E15, 0x4E2A, 0x4E31, 0x4E36, 0x4E3C,
0x4E3F, 0x4E42, 0x4E56, 0x4E58, 0x4E82, 0x4E85, 0x8C6B, 0x4E8A,
0x8212, 0x5F0D, 0x4E8E, 0x4E9E, 0x4E9F, 0x4EA0, 0x4EA2, 0x4EB0,
@@ -705,7 +706,7 @@ const unsigned short euc_to_utf8_D0[] = {
0x5043, 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505A, 0x5056,
0x506C, 0x5078, 0x5080, 0x509A, 0x5085, 0x50B4, 0x50B2,
};
-const unsigned short euc_to_utf8_D1[] = {
+unsigned short euc_to_utf8_D1[] = {
0x50C9, 0x50CA, 0x50B3, 0x50C2, 0x50D6, 0x50DE, 0x50E5,
0x50ED, 0x50E3, 0x50EE, 0x50F9, 0x50F5, 0x5109, 0x5101, 0x5102,
0x5116, 0x5115, 0x5114, 0x511A, 0x5121, 0x513A, 0x5137, 0x513C,
@@ -719,7 +720,7 @@ const unsigned short euc_to_utf8_D1[] = {
0x525E, 0x5254, 0x526A, 0x5274, 0x5269, 0x5273, 0x527F, 0x527D,
0x528D, 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8FA8,
};
-const unsigned short euc_to_utf8_D2[] = {
+unsigned short euc_to_utf8_D2[] = {
0x8FA7, 0x52AC, 0x52AD, 0x52BC, 0x52B5, 0x52C1, 0x52CD,
0x52D7, 0x52DE, 0x52E3, 0x52E6, 0x98ED, 0x52E0, 0x52F3, 0x52F5,
0x52F8, 0x52F9, 0x5306, 0x5308, 0x7538, 0x530D, 0x5310, 0x530F,
@@ -733,7 +734,7 @@ const unsigned short euc_to_utf8_D2[] = {
0x5492, 0x547B, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54C7,
0x54A2, 0x54B8, 0x54A5, 0x54AC, 0x54C4, 0x54C8, 0x54A8,
};
-const unsigned short euc_to_utf8_D3[] = {
+unsigned short euc_to_utf8_D3[] = {
0x54AB, 0x54C2, 0x54A4, 0x54BE, 0x54BC, 0x54D8, 0x54E5,
0x54E6, 0x550F, 0x5514, 0x54FD, 0x54EE, 0x54ED, 0x54FA, 0x54E2,
0x5539, 0x5540, 0x5563, 0x554C, 0x552E, 0x555C, 0x5545, 0x5556,
@@ -747,7 +748,7 @@ const unsigned short euc_to_utf8_D3[] = {
0x56BC, 0x56C1, 0x56C3, 0x56C0, 0x56C8, 0x56CE, 0x56D1, 0x56D3,
0x56D7, 0x56EE, 0x56F9, 0x5700, 0x56FF, 0x5704, 0x5709,
};
-const unsigned short euc_to_utf8_D4[] = {
+unsigned short euc_to_utf8_D4[] = {
0x5708, 0x570B, 0x570D, 0x5713, 0x5718, 0x5716, 0x55C7,
0x571C, 0x5726, 0x5737, 0x5738, 0x574E, 0x573B, 0x5740, 0x574F,
0x5769, 0x57C0, 0x5788, 0x5761, 0x577F, 0x5789, 0x5793, 0x57A0,
@@ -761,7 +762,7 @@ const unsigned short euc_to_utf8_D4[] = {
0x592D, 0x5932, 0x5938, 0x593E, 0x7AD2, 0x5955, 0x5950, 0x594E,
0x595A, 0x5958, 0x5962, 0x5960, 0x5967, 0x596C, 0x5969,
};
-const unsigned short euc_to_utf8_D5[] = {
+unsigned short euc_to_utf8_D5[] = {
0x5978, 0x5981, 0x599D, 0x4F5E, 0x4FAB, 0x59A3, 0x59B2,
0x59C6, 0x59E8, 0x59DC, 0x598D, 0x59D9, 0x59DA, 0x5A25, 0x5A1F,
0x5A11, 0x5A1C, 0x5A09, 0x5A1A, 0x5A40, 0x5A6C, 0x5A49, 0x5A35,
@@ -775,7 +776,7 @@ const unsigned short euc_to_utf8_D5[] = {
0x5BF3, 0x5C05, 0x5C07, 0x5C08, 0x5C0D, 0x5C13, 0x5C20, 0x5C22,
0x5C28, 0x5C38, 0x5C39, 0x5C41, 0x5C46, 0x5C4E, 0x5C53,
};
-const unsigned short euc_to_utf8_D6[] = {
+unsigned short euc_to_utf8_D6[] = {
0x5C50, 0x5C4F, 0x5B71, 0x5C6C, 0x5C6E, 0x4E62, 0x5C76,
0x5C79, 0x5C8C, 0x5C91, 0x5C94, 0x599B, 0x5CAB, 0x5CBB, 0x5CB6,
0x5CBC, 0x5CB7, 0x5CC5, 0x5CBE, 0x5CC7, 0x5CD9, 0x5CE9, 0x5CFD,
@@ -789,7 +790,7 @@ const unsigned short euc_to_utf8_D6[] = {
0x5E5F, 0x5E62, 0x5E64, 0x5E47, 0x5E75, 0x5E76, 0x5E7A, 0x9EBC,
0x5E7F, 0x5EA0, 0x5EC1, 0x5EC2, 0x5EC8, 0x5ED0, 0x5ECF,
};
-const unsigned short euc_to_utf8_D7[] = {
+unsigned short euc_to_utf8_D7[] = {
0x5ED6, 0x5EE3, 0x5EDD, 0x5EDA, 0x5EDB, 0x5EE2, 0x5EE1,
0x5EE8, 0x5EE9, 0x5EEC, 0x5EF1, 0x5EF3, 0x5EF0, 0x5EF4, 0x5EF8,
0x5EFE, 0x5F03, 0x5F09, 0x5F5D, 0x5F5C, 0x5F0B, 0x5F11, 0x5F16,
@@ -803,7 +804,7 @@ const unsigned short euc_to_utf8_D7[] = {
0x604A, 0x6046, 0x604D, 0x6063, 0x6043, 0x6064, 0x6042, 0x606C,
0x606B, 0x6059, 0x6081, 0x608D, 0x60E7, 0x6083, 0x609A,
};
-const unsigned short euc_to_utf8_D8[] = {
+unsigned short euc_to_utf8_D8[] = {
0x6084, 0x609B, 0x6096, 0x6097, 0x6092, 0x60A7, 0x608B,
0x60E1, 0x60B8, 0x60E0, 0x60D3, 0x60B4, 0x5FF0, 0x60BD, 0x60C6,
0x60B5, 0x60D8, 0x614D, 0x6115, 0x6106, 0x60F6, 0x60F7, 0x6100,
@@ -817,7 +818,7 @@ const unsigned short euc_to_utf8_D8[] = {
0x61E3, 0x61F6, 0x61FA, 0x61F4, 0x61FF, 0x61FD, 0x61FC, 0x61FE,
0x6200, 0x6208, 0x6209, 0x620D, 0x620C, 0x6214, 0x621B,
};
-const unsigned short euc_to_utf8_D9[] = {
+unsigned short euc_to_utf8_D9[] = {
0x621E, 0x6221, 0x622A, 0x622E, 0x6230, 0x6232, 0x6233,
0x6241, 0x624E, 0x625E, 0x6263, 0x625B, 0x6260, 0x6268, 0x627C,
0x6282, 0x6289, 0x627E, 0x6292, 0x6293, 0x6296, 0x62D4, 0x6283,
@@ -831,7 +832,7 @@ const unsigned short euc_to_utf8_D9[] = {
0x651D, 0x6417, 0x6428, 0x640F, 0x6467, 0x646F, 0x6476, 0x644E,
0x652A, 0x6495, 0x6493, 0x64A5, 0x64A9, 0x6488, 0x64BC,
};
-const unsigned short euc_to_utf8_DA[] = {
+unsigned short euc_to_utf8_DA[] = {
0x64DA, 0x64D2, 0x64C5, 0x64C7, 0x64BB, 0x64D8, 0x64C2,
0x64F1, 0x64E7, 0x8209, 0x64E0, 0x64E1, 0x62AC, 0x64E3, 0x64EF,
0x652C, 0x64F6, 0x64F4, 0x64F2, 0x64FA, 0x6500, 0x64FD, 0x6518,
@@ -845,7 +846,7 @@ const unsigned short euc_to_utf8_DA[] = {
0x665F, 0x6662, 0x6670, 0x6683, 0x6688, 0x668E, 0x6689, 0x6684,
0x6698, 0x669D, 0x66C1, 0x66B9, 0x66C9, 0x66BE, 0x66BC,
};
-const unsigned short euc_to_utf8_DB[] = {
+unsigned short euc_to_utf8_DB[] = {
0x66C4, 0x66B8, 0x66D6, 0x66DA, 0x66E0, 0x663F, 0x66E6,
0x66E9, 0x66F0, 0x66F5, 0x66F7, 0x670F, 0x6716, 0x671E, 0x6726,
0x6727, 0x9738, 0x672E, 0x673F, 0x6736, 0x6741, 0x6738, 0x6737,
@@ -859,7 +860,7 @@ const unsigned short euc_to_utf8_DB[] = {
0x68B5, 0x68A0, 0x68BA, 0x690F, 0x688D, 0x687E, 0x6901, 0x68CA,
0x6908, 0x68D8, 0x6922, 0x6926, 0x68E1, 0x690C, 0x68CD,
};
-const unsigned short euc_to_utf8_DC[] = {
+unsigned short euc_to_utf8_DC[] = {
0x68D4, 0x68E7, 0x68D5, 0x6936, 0x6912, 0x6904, 0x68D7,
0x68E3, 0x6925, 0x68F9, 0x68E0, 0x68EF, 0x6928, 0x692A, 0x691A,
0x6923, 0x6921, 0x68C6, 0x6979, 0x6977, 0x695C, 0x6978, 0x696B,
@@ -873,7 +874,7 @@ const unsigned short euc_to_utf8_DC[] = {
0x6A36, 0x6A78, 0x6A47, 0x6A62, 0x6A59, 0x6A66, 0x6A48, 0x6A38,
0x6A22, 0x6A90, 0x6A8D, 0x6AA0, 0x6A84, 0x6AA2, 0x6AA3,
};
-const unsigned short euc_to_utf8_DD[] = {
+unsigned short euc_to_utf8_DD[] = {
0x6A97, 0x8617, 0x6ABB, 0x6AC3, 0x6AC2, 0x6AB8, 0x6AB3,
0x6AAC, 0x6ADE, 0x6AD1, 0x6ADF, 0x6AAA, 0x6ADA, 0x6AEA, 0x6AFB,
0x6B05, 0x8616, 0x6AFA, 0x6B12, 0x6B16, 0x9B31, 0x6B1F, 0x6B38,
@@ -887,7 +888,7 @@ const unsigned short euc_to_utf8_DD[] = {
0x6C7E, 0x6C68, 0x6C73, 0x6C92, 0x6C90, 0x6CC4, 0x6CF1, 0x6CD3,
0x6CBD, 0x6CD7, 0x6CC5, 0x6CDD, 0x6CAE, 0x6CB1, 0x6CBE,
};
-const unsigned short euc_to_utf8_DE[] = {
+unsigned short euc_to_utf8_DE[] = {
0x6CBA, 0x6CDB, 0x6CEF, 0x6CD9, 0x6CEA, 0x6D1F, 0x884D,
0x6D36, 0x6D2B, 0x6D3D, 0x6D38, 0x6D19, 0x6D35, 0x6D33, 0x6D12,
0x6D0C, 0x6D63, 0x6D93, 0x6D64, 0x6D5A, 0x6D79, 0x6D59, 0x6D8E,
@@ -901,7 +902,7 @@ const unsigned short euc_to_utf8_DE[] = {
0x6EA5, 0x6EC2, 0x6E9F, 0x6F41, 0x6F11, 0x704C, 0x6EEC, 0x6EF8,
0x6EFE, 0x6F3F, 0x6EF2, 0x6F31, 0x6EEF, 0x6F32, 0x6ECC,
};
-const unsigned short euc_to_utf8_DF[] = {
+unsigned short euc_to_utf8_DF[] = {
0x6F3E, 0x6F13, 0x6EF7, 0x6F86, 0x6F7A, 0x6F78, 0x6F81,
0x6F80, 0x6F6F, 0x6F5B, 0x6FF3, 0x6F6D, 0x6F82, 0x6F7C, 0x6F58,
0x6F8E, 0x6F91, 0x6FC2, 0x6F66, 0x6FB3, 0x6FA3, 0x6FA1, 0x6FA4,
@@ -915,7 +916,7 @@ const unsigned short euc_to_utf8_DF[] = {
0x7195, 0x71A8, 0x71AC, 0x71D7, 0x71B9, 0x71BE, 0x71D2, 0x71C9,
0x71D4, 0x71CE, 0x71E0, 0x71EC, 0x71E7, 0x71F5, 0x71FC,
};
-const unsigned short euc_to_utf8_E0[] = {
+unsigned short euc_to_utf8_E0[] = {
0x71F9, 0x71FF, 0x720D, 0x7210, 0x721B, 0x7228, 0x722D,
0x722C, 0x7230, 0x7232, 0x723B, 0x723C, 0x723F, 0x7240, 0x7246,
0x724B, 0x7258, 0x7274, 0x727E, 0x7282, 0x7281, 0x7287, 0x7292,
@@ -929,7 +930,7 @@ const unsigned short euc_to_utf8_E0[] = {
0x7441, 0x745C, 0x7469, 0x7470, 0x7463, 0x746A, 0x7476, 0x747E,
0x748B, 0x749E, 0x74A7, 0x74CA, 0x74CF, 0x74D4, 0x73F1,
};
-const unsigned short euc_to_utf8_E1[] = {
+unsigned short euc_to_utf8_E1[] = {
0x74E0, 0x74E3, 0x74E7, 0x74E9, 0x74EE, 0x74F2, 0x74F0,
0x74F1, 0x74F8, 0x74F7, 0x7504, 0x7503, 0x7505, 0x750C, 0x750E,
0x750D, 0x7515, 0x7513, 0x751E, 0x7526, 0x752C, 0x753C, 0x7544,
@@ -943,7 +944,7 @@ const unsigned short euc_to_utf8_E1[] = {
0x7630, 0x763B, 0x7647, 0x7648, 0x7646, 0x765C, 0x7658, 0x7661,
0x7662, 0x7668, 0x7669, 0x766A, 0x7667, 0x766C, 0x7670,
};
-const unsigned short euc_to_utf8_E2[] = {
+unsigned short euc_to_utf8_E2[] = {
0x7672, 0x7676, 0x7678, 0x767C, 0x7680, 0x7683, 0x7688,
0x768B, 0x768E, 0x7696, 0x7693, 0x7699, 0x769A, 0x76B0, 0x76B4,
0x76B8, 0x76B9, 0x76BA, 0x76C2, 0x76CD, 0x76D6, 0x76D2, 0x76DE,
@@ -957,7 +958,7 @@ const unsigned short euc_to_utf8_E2[] = {
0x789A, 0x788C, 0x78A3, 0x78B5, 0x78AA, 0x78AF, 0x78D1, 0x78C6,
0x78CB, 0x78D4, 0x78BE, 0x78BC, 0x78C5, 0x78CA, 0x78EC,
};
-const unsigned short euc_to_utf8_E3[] = {
+unsigned short euc_to_utf8_E3[] = {
0x78E7, 0x78DA, 0x78FD, 0x78F4, 0x7907, 0x7912, 0x7911,
0x7919, 0x792C, 0x792B, 0x7940, 0x7960, 0x7957, 0x795F, 0x795A,
0x7955, 0x7953, 0x797A, 0x797F, 0x798A, 0x799D, 0x79A7, 0x9F4B,
@@ -971,7 +972,7 @@ const unsigned short euc_to_utf8_E3[] = {
0x7AE6, 0x7AED, 0x7AF0, 0x7B02, 0x7B0F, 0x7B0A, 0x7B06, 0x7B33,
0x7B18, 0x7B19, 0x7B1E, 0x7B35, 0x7B28, 0x7B36, 0x7B50,
};
-const unsigned short euc_to_utf8_E4[] = {
+unsigned short euc_to_utf8_E4[] = {
0x7B7A, 0x7B04, 0x7B4D, 0x7B0B, 0x7B4C, 0x7B45, 0x7B75,
0x7B65, 0x7B74, 0x7B67, 0x7B70, 0x7B71, 0x7B6C, 0x7B6E, 0x7B9D,
0x7B98, 0x7B9F, 0x7B8D, 0x7B9C, 0x7B9A, 0x7B8B, 0x7B92, 0x7B8F,
@@ -985,7 +986,7 @@ const unsigned short euc_to_utf8_E4[] = {
0x7CBD, 0x7CC0, 0x7CC5, 0x7CC2, 0x7CD8, 0x7CD2, 0x7CDC, 0x7CE2,
0x9B3B, 0x7CEF, 0x7CF2, 0x7CF4, 0x7CF6, 0x7CFA, 0x7D06,
};
-const unsigned short euc_to_utf8_E5[] = {
+unsigned short euc_to_utf8_E5[] = {
0x7D02, 0x7D1C, 0x7D15, 0x7D0A, 0x7D45, 0x7D4B, 0x7D2E,
0x7D32, 0x7D3F, 0x7D35, 0x7D46, 0x7D73, 0x7D56, 0x7D4E, 0x7D72,
0x7D68, 0x7D6E, 0x7D4F, 0x7D63, 0x7D93, 0x7D89, 0x7D5B, 0x7D8F,
@@ -999,7 +1000,7 @@ const unsigned short euc_to_utf8_E5[] = {
0x8FAE, 0x7E7F, 0x7E88, 0x7E89, 0x7E8C, 0x7E92, 0x7E90, 0x7E93,
0x7E94, 0x7E96, 0x7E8E, 0x7E9B, 0x7E9C, 0x7F38, 0x7F3A,
};
-const unsigned short euc_to_utf8_E6[] = {
+unsigned short euc_to_utf8_E6[] = {
0x7F45, 0x7F4C, 0x7F4D, 0x7F4E, 0x7F50, 0x7F51, 0x7F55,
0x7F54, 0x7F58, 0x7F5F, 0x7F60, 0x7F68, 0x7F69, 0x7F67, 0x7F78,
0x7F82, 0x7F86, 0x7F83, 0x7F88, 0x7F87, 0x7F8C, 0x7F94, 0x7F9E,
@@ -1013,7 +1014,7 @@ const unsigned short euc_to_utf8_E6[] = {
0x80DB, 0x80E5, 0x80D9, 0x80DD, 0x80C4, 0x80DA, 0x80D6, 0x8109,
0x80EF, 0x80F1, 0x811B, 0x8129, 0x8123, 0x812F, 0x814B,
};
-const unsigned short euc_to_utf8_E7[] = {
+unsigned short euc_to_utf8_E7[] = {
0x968B, 0x8146, 0x813E, 0x8153, 0x8151, 0x80FC, 0x8171,
0x816E, 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818A, 0x8180,
0x8182, 0x81A0, 0x8195, 0x81A4, 0x81A3, 0x815F, 0x8193, 0x81A9,
@@ -1027,7 +1028,7 @@ const unsigned short euc_to_utf8_E7[] = {
0x82E3, 0x82DF, 0x82D2, 0x82F4, 0x82F3, 0x82FA, 0x8393, 0x8303,
0x82FB, 0x82F9, 0x82DE, 0x8306, 0x82DC, 0x8309, 0x82D9,
};
-const unsigned short euc_to_utf8_E8[] = {
+unsigned short euc_to_utf8_E8[] = {
0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339,
0x8350, 0x8345, 0x832F, 0x832B, 0x8317, 0x8318, 0x8385, 0x839A,
0x83AA, 0x839F, 0x83A2, 0x8396, 0x8323, 0x838E, 0x8387, 0x838A,
@@ -1041,7 +1042,7 @@ const unsigned short euc_to_utf8_E8[] = {
0x84A1, 0x8521, 0x84FF, 0x84F4, 0x8517, 0x8518, 0x852C, 0x851F,
0x8515, 0x8514, 0x84FC, 0x8540, 0x8563, 0x8558, 0x8548,
};
-const unsigned short euc_to_utf8_E9[] = {
+unsigned short euc_to_utf8_E9[] = {
0x8541, 0x8602, 0x854B, 0x8555, 0x8580, 0x85A4, 0x8588,
0x8591, 0x858A, 0x85A8, 0x856D, 0x8594, 0x859B, 0x85EA, 0x8587,
0x859C, 0x8577, 0x857E, 0x8590, 0x85C9, 0x85BA, 0x85CF, 0x85B9,
@@ -1055,7 +1056,7 @@ const unsigned short euc_to_utf8_E9[] = {
0x8737, 0x873B, 0x8725, 0x8729, 0x871A, 0x8760, 0x875F, 0x8778,
0x874C, 0x874E, 0x8774, 0x8757, 0x8768, 0x876E, 0x8759,
};
-const unsigned short euc_to_utf8_EA[] = {
+unsigned short euc_to_utf8_EA[] = {
0x8753, 0x8763, 0x876A, 0x8805, 0x87A2, 0x879F, 0x8782,
0x87AF, 0x87CB, 0x87BD, 0x87C0, 0x87D0, 0x96D6, 0x87AB, 0x87C4,
0x87B3, 0x87C7, 0x87C6, 0x87BB, 0x87EF, 0x87F2, 0x87E0, 0x880F,
@@ -1069,7 +1070,7 @@ const unsigned short euc_to_utf8_EA[] = {
0x8913, 0x8943, 0x891E, 0x8925, 0x892A, 0x892B, 0x8941, 0x8944,
0x893B, 0x8936, 0x8938, 0x894C, 0x891D, 0x8960, 0x895E,
};
-const unsigned short euc_to_utf8_EB[] = {
+unsigned short euc_to_utf8_EB[] = {
0x8966, 0x8964, 0x896D, 0x896A, 0x896F, 0x8974, 0x8977,
0x897E, 0x8983, 0x8988, 0x898A, 0x8993, 0x8998, 0x89A1, 0x89A9,
0x89A6, 0x89AC, 0x89AF, 0x89B2, 0x89BA, 0x89BD, 0x89BF, 0x89C0,
@@ -1083,7 +1084,7 @@ const unsigned short euc_to_utf8_EB[] = {
0x8B33, 0x97AB, 0x8B26, 0x8B2B, 0x8B3E, 0x8B28, 0x8B41, 0x8B4C,
0x8B4F, 0x8B4E, 0x8B49, 0x8B56, 0x8B5B, 0x8B5A, 0x8B6B,
};
-const unsigned short euc_to_utf8_EC[] = {
+unsigned short euc_to_utf8_EC[] = {
0x8B5F, 0x8B6C, 0x8B6F, 0x8B74, 0x8B7D, 0x8B80, 0x8B8C,
0x8B8E, 0x8B92, 0x8B93, 0x8B96, 0x8B99, 0x8B9A, 0x8C3A, 0x8C41,
0x8C3F, 0x8C48, 0x8C4C, 0x8C4E, 0x8C50, 0x8C55, 0x8C62, 0x8C6C,
@@ -1097,7 +1098,7 @@ const unsigned short euc_to_utf8_EC[] = {
0x8DDF, 0x8DE3, 0x8DFC, 0x8E08, 0x8E09, 0x8DFF, 0x8E1D, 0x8E1E,
0x8E10, 0x8E1F, 0x8E42, 0x8E35, 0x8E30, 0x8E34, 0x8E4A,
};
-const unsigned short euc_to_utf8_ED[] = {
+unsigned short euc_to_utf8_ED[] = {
0x8E47, 0x8E49, 0x8E4C, 0x8E50, 0x8E48, 0x8E59, 0x8E64,
0x8E60, 0x8E2A, 0x8E63, 0x8E55, 0x8E76, 0x8E72, 0x8E7C, 0x8E81,
0x8E87, 0x8E85, 0x8E84, 0x8E8B, 0x8E8A, 0x8E93, 0x8E91, 0x8E94,
@@ -1111,7 +1112,7 @@ const unsigned short euc_to_utf8_ED[] = {
0x9005, 0x8FF9, 0x8FFA, 0x9011, 0x9015, 0x9021, 0x900D, 0x901E,
0x9016, 0x900B, 0x9027, 0x9036, 0x9035, 0x9039, 0x8FF8,
};
-const unsigned short euc_to_utf8_EE[] = {
+unsigned short euc_to_utf8_EE[] = {
0x904F, 0x9050, 0x9051, 0x9052, 0x900E, 0x9049, 0x903E,
0x9056, 0x9058, 0x905E, 0x9068, 0x906F, 0x9076, 0x96A8, 0x9072,
0x9082, 0x907D, 0x9081, 0x9080, 0x908A, 0x9089, 0x908F, 0x90A8,
@@ -1125,7 +1126,7 @@ const unsigned short euc_to_utf8_EE[] = {
0x924B, 0x9250, 0x929C, 0x9296, 0x9293, 0x929B, 0x925A, 0x92CF,
0x92B9, 0x92B7, 0x92E9, 0x930F, 0x92FA, 0x9344, 0x932E,
};
-const unsigned short euc_to_utf8_EF[] = {
+unsigned short euc_to_utf8_EF[] = {
0x9319, 0x9322, 0x931A, 0x9323, 0x933A, 0x9335, 0x933B,
0x935C, 0x9360, 0x937C, 0x936E, 0x9356, 0x93B0, 0x93AC, 0x93AD,
0x9394, 0x93B9, 0x93D6, 0x93D7, 0x93E8, 0x93E5, 0x93D8, 0x93C3,
@@ -1139,7 +1140,7 @@ const unsigned short euc_to_utf8_EF[] = {
0x95DC, 0x95E1, 0x95E5, 0x95E2, 0x9621, 0x9628, 0x962E, 0x962F,
0x9642, 0x964C, 0x964F, 0x964B, 0x9677, 0x965C, 0x965E,
};
-const unsigned short euc_to_utf8_F0[] = {
+unsigned short euc_to_utf8_F0[] = {
0x965D, 0x965F, 0x9666, 0x9672, 0x966C, 0x968D, 0x9698,
0x9695, 0x9697, 0x96AA, 0x96A7, 0x96B1, 0x96B2, 0x96B0, 0x96B4,
0x96B6, 0x96B8, 0x96B9, 0x96CE, 0x96CB, 0x96C9, 0x96CD, 0x894D,
@@ -1153,7 +1154,7 @@ const unsigned short euc_to_utf8_F0[] = {
0x97F6, 0x97F5, 0x980F, 0x980C, 0x9838, 0x9824, 0x9821, 0x9837,
0x983D, 0x9846, 0x984F, 0x984B, 0x986B, 0x986F, 0x9870,
};
-const unsigned short euc_to_utf8_F1[] = {
+unsigned short euc_to_utf8_F1[] = {
0x9871, 0x9874, 0x9873, 0x98AA, 0x98AF, 0x98B1, 0x98B6,
0x98C4, 0x98C3, 0x98C6, 0x98E9, 0x98EB, 0x9903, 0x9909, 0x9912,
0x9914, 0x9918, 0x9921, 0x991D, 0x991E, 0x9924, 0x9920, 0x992C,
@@ -1167,7 +1168,7 @@ const unsigned short euc_to_utf8_F1[] = {
0x9ACF, 0x9AD1, 0x9AD3, 0x9AD4, 0x9ADE, 0x9ADF, 0x9AE2, 0x9AE3,
0x9AE6, 0x9AEF, 0x9AEB, 0x9AEE, 0x9AF4, 0x9AF1, 0x9AF7,
};
-const unsigned short euc_to_utf8_F2[] = {
+unsigned short euc_to_utf8_F2[] = {
0x9AFB, 0x9B06, 0x9B18, 0x9B1A, 0x9B1F, 0x9B22, 0x9B23,
0x9B25, 0x9B27, 0x9B28, 0x9B29, 0x9B2A, 0x9B2E, 0x9B2F, 0x9B32,
0x9B44, 0x9B43, 0x9B4F, 0x9B4D, 0x9B4E, 0x9B51, 0x9B58, 0x9B74,
@@ -1181,7 +1182,7 @@ const unsigned short euc_to_utf8_F2[] = {
0x9D03, 0x9D06, 0x9D2A, 0x9D26, 0x9DAF, 0x9D23, 0x9D1F, 0x9D44,
0x9D15, 0x9D12, 0x9D41, 0x9D3F, 0x9D3E, 0x9D46, 0x9D48,
};
-const unsigned short euc_to_utf8_F3[] = {
+unsigned short euc_to_utf8_F3[] = {
0x9D5D, 0x9D5E, 0x9D64, 0x9D51, 0x9D50, 0x9D59, 0x9D72,
0x9D89, 0x9D87, 0x9DAB, 0x9D6F, 0x9D7A, 0x9D9A, 0x9DA4, 0x9DA9,
0x9DB2, 0x9DC4, 0x9DC1, 0x9DBB, 0x9DB8, 0x9DBA, 0x9DC6, 0x9DCF,
@@ -1195,7 +1196,7 @@ const unsigned short euc_to_utf8_F3[] = {
0x9F54, 0x9F63, 0x9F5F, 0x9F60, 0x9F61, 0x9F66, 0x9F67, 0x9F6C,
0x9F6A, 0x9F77, 0x9F72, 0x9F76, 0x9F95, 0x9F9C, 0x9FA0,
};
-const unsigned short euc_to_utf8_F4[] = {
+unsigned short euc_to_utf8_F4[] = {
0x582F, 0x69C7, 0x9059, 0x7464, 0x51DC, 0x7199, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -1209,7 +1210,7 @@ const unsigned short euc_to_utf8_F4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_F5[] = {
+unsigned short euc_to_utf8_F5[] = {
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0xFE33, 0, 0, 0, 0, 0,
@@ -1223,7 +1224,7 @@ const unsigned short euc_to_utf8_F5[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short euc_to_utf8_F9[] = {
+unsigned short euc_to_utf8_F9[] = {
0x7E8A, 0x891C, 0x9348, 0x9288, 0x84DC, 0x4FC9, 0x70BB,
0x6631, 0x68C8, 0x92F9, 0x66FB, 0x5F45, 0x4E28, 0x4EE1, 0x4EFC,
0x4F00, 0x4F03, 0x4F39, 0x4F56, 0x4F92, 0x4F8A, 0x4F9A, 0x4F94,
@@ -1237,7 +1238,7 @@ const unsigned short euc_to_utf8_F9[] = {
0x5CA6, 0x5CBA, 0x5CF5, 0x5D27, 0x5D53, 0xFA11, 0x5D42, 0x5D6D,
0x5DB8, 0x5DB9, 0x5DD0, 0x5F21, 0x5F34, 0x5F67, 0x5FB7,
};
-const unsigned short euc_to_utf8_FA[] = {
+unsigned short euc_to_utf8_FA[] = {
0x5FDE, 0x605D, 0x6085, 0x608A, 0x60DE, 0x60D5, 0x6120,
0x60F2, 0x6111, 0x6137, 0x6130, 0x6198, 0x6213, 0x62A6, 0x63F5,
0x6460, 0x649D, 0x64CE, 0x654E, 0x6600, 0x6615, 0x663B, 0x6609,
@@ -1251,7 +1252,7 @@ const unsigned short euc_to_utf8_FA[] = {
0x6FF5, 0x7005, 0x7007, 0x7028, 0x7085, 0x70AB, 0x710F, 0x7104,
0x715C, 0x7146, 0x7147, 0xFA15, 0x71C1, 0x71FE, 0x72B1,
};
-const unsigned short euc_to_utf8_FB[] = {
+unsigned short euc_to_utf8_FB[] = {
0x72BE, 0x7324, 0xFA16, 0x7377, 0x73BD, 0x73C9, 0x73D6,
0x73E3, 0x73D2, 0x7407, 0x73F5, 0x7426, 0x742A, 0x7429, 0x742E,
0x7462, 0x7489, 0x749F, 0x7501, 0x756F, 0x7682, 0x769C, 0x769E,
@@ -1265,23 +1266,7 @@ const unsigned short euc_to_utf8_FB[] = {
0x8B7F, 0x8CF0, 0x8CF4, 0x8D12, 0x8D76, 0xFA23, 0x8ECF, 0xFA24,
0xFA25, 0x9067, 0x90DE, 0xFA26, 0x9115, 0x9127, 0x91DA,
};
-const unsigned short euc_to_utf8_FC[] = {
- 0x91D7, 0x91DE, 0x91ED, 0x91EE, 0x91E4, 0x91E5, 0x9206,
- 0x9210, 0x920A, 0x923A, 0x9240, 0x923C, 0x924E, 0x9259, 0x9251,
- 0x9239, 0x9267, 0x92A7, 0x9277, 0x9278, 0x92E7, 0x92D7, 0x92D9,
- 0x92D0, 0xFA27, 0x92D5, 0x92E0, 0x92D3, 0x9325, 0x9321, 0x92FB,
- 0xFA28, 0x931E, 0x92FF, 0x931D, 0x9302, 0x9370, 0x9357, 0x93A4,
- 0x93C6, 0x93DE, 0x93F8, 0x9431, 0x9445, 0x9448, 0x9592, 0xF9DC,
- 0xFA29, 0x969D, 0x96AF, 0x9733, 0x973B, 0x9743, 0x974D, 0x974F,
- 0x9751, 0x9755, 0x9857, 0x9865, 0xFA2A, 0xFA2B, 0x9927, 0xFA2C,
- 0x999E, 0x9A4E, 0x9AD9, 0x9ADC, 0x9B75, 0x9B72, 0x9B8F, 0x9BB1,
- 0x9BBB, 0x9C00, 0x9D70, 0x9D6B, 0xFA2D, 0x9E19, 0x9ED1, 0,
- 0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176,
- 0x2177, 0x2178, 0x2179, 0xFFE2, 0x00A6, 0xFF07, 0xFF02,
-};
-
-/* Microsoft UCS Mapping Compatible */
-const unsigned short euc_to_utf8_FC_ms[] = {
+unsigned short euc_to_utf8_FC[] = {
0x91D7, 0x91DE, 0x91ED, 0x91EE, 0x91E4, 0x91E5, 0x9206,
0x9210, 0x920A, 0x923A, 0x9240, 0x923C, 0x924E, 0x9259, 0x9251,
0x9239, 0x9267, 0x92A7, 0x9277, 0x9278, 0x92E7, 0x92D7, 0x92D9,
@@ -1295,991 +1280,7 @@ const unsigned short euc_to_utf8_FC_ms[] = {
0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176,
0x2177, 0x2178, 0x2179, 0xFFE2, 0xFFE4, 0xFF07, 0xFF02,
};
-
-#ifdef X0212_ENABLE
-const unsigned short euc_to_utf8_8FA2[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0x02D8,
- 0x02C7, 0x00B8, 0x02D9, 0x02DD, 0x00AF, 0x02DB, 0x02DA, 0xFF5E,
- 0x0384, 0x0385, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x00A1, 0xFFE4, 0x00BF, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x00BA, 0x00AA, 0x00A9, 0x00AE, 0x2122,
- 0x00A4, 0x2116, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short euc_to_utf8_8FA6[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x0386, 0x0388, 0x0389, 0x038A, 0x03AA, 0, 0x038C,
- 0, 0x038E, 0x03AB, 0, 0x038F, 0, 0, 0,
- 0, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03CA, 0x0390, 0x03CC,
- 0x03C2, 0x03CD, 0x03CB, 0x03B0, 0x03CE, 0, 0,
-};
-const unsigned short euc_to_utf8_8FA7[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
- 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x040E, 0x040F, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
- 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x045E, 0x045F,
-};
-const unsigned short euc_to_utf8_8FA9[] = {
- 0x00C6, 0x0110, 0, 0x0126, 0, 0x0132, 0,
- 0x0141, 0x013F, 0, 0x014A, 0x00D8, 0x0152, 0, 0x0166,
- 0x00DE, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x00E6, 0x0111, 0x00F0, 0x0127, 0x0131, 0x0133, 0x0138,
- 0x0142, 0x0140, 0x0149, 0x014B, 0x00F8, 0x0153, 0x00DF, 0x0167,
- 0x00FE, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short euc_to_utf8_8FAA[] = {
- 0x00C1, 0x00C0, 0x00C4, 0x00C2, 0x0102, 0x01CD, 0x0100,
- 0x0104, 0x00C5, 0x00C3, 0x0106, 0x0108, 0x010C, 0x00C7, 0x010A,
- 0x010E, 0x00C9, 0x00C8, 0x00CB, 0x00CA, 0x011A, 0x0116, 0x0112,
- 0x0118, 0, 0x011C, 0x011E, 0x0122, 0x0120, 0x0124, 0x00CD,
- 0x00CC, 0x00CF, 0x00CE, 0x01CF, 0x0130, 0x012A, 0x012E, 0x0128,
- 0x0134, 0x0136, 0x0139, 0x013D, 0x013B, 0x0143, 0x0147, 0x0145,
- 0x00D1, 0x00D3, 0x00D2, 0x00D6, 0x00D4, 0x01D1, 0x0150, 0x014C,
- 0x00D5, 0x0154, 0x0158, 0x0156, 0x015A, 0x015C, 0x0160, 0x015E,
- 0x0164, 0x0162, 0x00DA, 0x00D9, 0x00DC, 0x00DB, 0x016C, 0x01D3,
- 0x0170, 0x016A, 0x0172, 0x016E, 0x0168, 0x01D7, 0x01DB, 0x01D9,
- 0x01D5, 0x0174, 0x00DD, 0x0178, 0x0176, 0x0179, 0x017D, 0x017B,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short euc_to_utf8_8FAB[] = {
- 0x00E1, 0x00E0, 0x00E4, 0x00E2, 0x0103, 0x01CE, 0x0101,
- 0x0105, 0x00E5, 0x00E3, 0x0107, 0x0109, 0x010D, 0x00E7, 0x010B,
- 0x010F, 0x00E9, 0x00E8, 0x00EB, 0x00EA, 0x011B, 0x0117, 0x0113,
- 0x0119, 0x01F5, 0x011D, 0x011F, 0, 0x0121, 0x0125, 0x00ED,
- 0x00EC, 0x00EF, 0x00EE, 0x01D0, 0, 0x012B, 0x012F, 0x0129,
- 0x0135, 0x0137, 0x013A, 0x013E, 0x013C, 0x0144, 0x0148, 0x0146,
- 0x00F1, 0x00F3, 0x00F2, 0x00F6, 0x00F4, 0x01D2, 0x0151, 0x014D,
- 0x00F5, 0x0155, 0x0159, 0x0157, 0x015B, 0x015D, 0x0161, 0x015F,
- 0x0165, 0x0163, 0x00FA, 0x00F9, 0x00FC, 0x00FB, 0x016D, 0x01D4,
- 0x0171, 0x016B, 0x0173, 0x016F, 0x0169, 0x01D8, 0x01DC, 0x01DA,
- 0x01D6, 0x0175, 0x00FD, 0x00FF, 0x0177, 0x017A, 0x017E, 0x017C,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short euc_to_utf8_8FB0[] = {
- 0x4E02, 0x4E04, 0x4E05, 0x4E0C, 0x4E12, 0x4E1F, 0x4E23,
- 0x4E24, 0x4E28, 0x4E2B, 0x4E2E, 0x4E2F, 0x4E30, 0x4E35, 0x4E40,
- 0x4E41, 0x4E44, 0x4E47, 0x4E51, 0x4E5A, 0x4E5C, 0x4E63, 0x4E68,
- 0x4E69, 0x4E74, 0x4E75, 0x4E79, 0x4E7F, 0x4E8D, 0x4E96, 0x4E97,
- 0x4E9D, 0x4EAF, 0x4EB9, 0x4EC3, 0x4ED0, 0x4EDA, 0x4EDB, 0x4EE0,
- 0x4EE1, 0x4EE2, 0x4EE8, 0x4EEF, 0x4EF1, 0x4EF3, 0x4EF5, 0x4EFD,
- 0x4EFE, 0x4EFF, 0x4F00, 0x4F02, 0x4F03, 0x4F08, 0x4F0B, 0x4F0C,
- 0x4F12, 0x4F15, 0x4F16, 0x4F17, 0x4F19, 0x4F2E, 0x4F31, 0x4F60,
- 0x4F33, 0x4F35, 0x4F37, 0x4F39, 0x4F3B, 0x4F3E, 0x4F40, 0x4F42,
- 0x4F48, 0x4F49, 0x4F4B, 0x4F4C, 0x4F52, 0x4F54, 0x4F56, 0x4F58,
- 0x4F5F, 0x4F63, 0x4F6A, 0x4F6C, 0x4F6E, 0x4F71, 0x4F77, 0x4F78,
- 0x4F79, 0x4F7A, 0x4F7D, 0x4F7E, 0x4F81, 0x4F82, 0x4F84,
-};
-const unsigned short euc_to_utf8_8FB1[] = {
- 0x4F85, 0x4F89, 0x4F8A, 0x4F8C, 0x4F8E, 0x4F90, 0x4F92,
- 0x4F93, 0x4F94, 0x4F97, 0x4F99, 0x4F9A, 0x4F9E, 0x4F9F, 0x4FB2,
- 0x4FB7, 0x4FB9, 0x4FBB, 0x4FBC, 0x4FBD, 0x4FBE, 0x4FC0, 0x4FC1,
- 0x4FC5, 0x4FC6, 0x4FC8, 0x4FC9, 0x4FCB, 0x4FCC, 0x4FCD, 0x4FCF,
- 0x4FD2, 0x4FDC, 0x4FE0, 0x4FE2, 0x4FF0, 0x4FF2, 0x4FFC, 0x4FFD,
- 0x4FFF, 0x5000, 0x5001, 0x5004, 0x5007, 0x500A, 0x500C, 0x500E,
- 0x5010, 0x5013, 0x5017, 0x5018, 0x501B, 0x501C, 0x501D, 0x501E,
- 0x5022, 0x5027, 0x502E, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040,
- 0x5041, 0x5042, 0x5045, 0x5046, 0x504A, 0x504C, 0x504E, 0x5051,
- 0x5052, 0x5053, 0x5057, 0x5059, 0x505F, 0x5060, 0x5062, 0x5063,
- 0x5066, 0x5067, 0x506A, 0x506D, 0x5070, 0x5071, 0x503B, 0x5081,
- 0x5083, 0x5084, 0x5086, 0x508A, 0x508E, 0x508F, 0x5090,
-};
-const unsigned short euc_to_utf8_8FB2[] = {
- 0x5092, 0x5093, 0x5094, 0x5096, 0x509B, 0x509C, 0x509E,
- 0x509F, 0x50A0, 0x50A1, 0x50A2, 0x50AA, 0x50AF, 0x50B0, 0x50B9,
- 0x50BA, 0x50BD, 0x50C0, 0x50C3, 0x50C4, 0x50C7, 0x50CC, 0x50CE,
- 0x50D0, 0x50D3, 0x50D4, 0x50D8, 0x50DC, 0x50DD, 0x50DF, 0x50E2,
- 0x50E4, 0x50E6, 0x50E8, 0x50E9, 0x50EF, 0x50F1, 0x50F6, 0x50FA,
- 0x50FE, 0x5103, 0x5106, 0x5107, 0x5108, 0x510B, 0x510C, 0x510D,
- 0x510E, 0x50F2, 0x5110, 0x5117, 0x5119, 0x511B, 0x511C, 0x511D,
- 0x511E, 0x5123, 0x5127, 0x5128, 0x512C, 0x512D, 0x512F, 0x5131,
- 0x5133, 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514A, 0x514F,
- 0x5153, 0x5155, 0x5157, 0x5158, 0x515F, 0x5164, 0x5166, 0x517E,
- 0x5183, 0x5184, 0x518B, 0x518E, 0x5198, 0x519D, 0x51A1, 0x51A3,
- 0x51AD, 0x51B8, 0x51BA, 0x51BC, 0x51BE, 0x51BF, 0x51C2,
-};
-const unsigned short euc_to_utf8_8FB3[] = {
- 0x51C8, 0x51CF, 0x51D1, 0x51D2, 0x51D3, 0x51D5, 0x51D8,
- 0x51DE, 0x51E2, 0x51E5, 0x51EE, 0x51F2, 0x51F3, 0x51F4, 0x51F7,
- 0x5201, 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218,
- 0x5222, 0x5228, 0x5231, 0x5232, 0x5235, 0x523C, 0x5245, 0x5249,
- 0x5255, 0x5257, 0x5258, 0x525A, 0x525C, 0x525F, 0x5260, 0x5261,
- 0x5266, 0x526E, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285,
- 0x528A, 0x528C, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529A,
- 0x529C, 0x52A4, 0x52A5, 0x52A6, 0x52A7, 0x52AF, 0x52B0, 0x52B6,
- 0x52B7, 0x52B8, 0x52BA, 0x52BB, 0x52BD, 0x52C0, 0x52C4, 0x52C6,
- 0x52C8, 0x52CC, 0x52CF, 0x52D1, 0x52D4, 0x52D6, 0x52DB, 0x52DC,
- 0x52E1, 0x52E5, 0x52E8, 0x52E9, 0x52EA, 0x52EC, 0x52F0, 0x52F1,
- 0x52F4, 0x52F6, 0x52F7, 0x5300, 0x5303, 0x530A, 0x530B,
-};
-const unsigned short euc_to_utf8_8FB4[] = {
- 0x530C, 0x5311, 0x5313, 0x5318, 0x531B, 0x531C, 0x531E,
- 0x531F, 0x5325, 0x5327, 0x5328, 0x5329, 0x532B, 0x532C, 0x532D,
- 0x5330, 0x5332, 0x5335, 0x533C, 0x533D, 0x533E, 0x5342, 0x534C,
- 0x534B, 0x5359, 0x535B, 0x5361, 0x5363, 0x5365, 0x536C, 0x536D,
- 0x5372, 0x5379, 0x537E, 0x5383, 0x5387, 0x5388, 0x538E, 0x5393,
- 0x5394, 0x5399, 0x539D, 0x53A1, 0x53A4, 0x53AA, 0x53AB, 0x53AF,
- 0x53B2, 0x53B4, 0x53B5, 0x53B7, 0x53B8, 0x53BA, 0x53BD, 0x53C0,
- 0x53C5, 0x53CF, 0x53D2, 0x53D3, 0x53D5, 0x53DA, 0x53DD, 0x53DE,
- 0x53E0, 0x53E6, 0x53E7, 0x53F5, 0x5402, 0x5413, 0x541A, 0x5421,
- 0x5427, 0x5428, 0x542A, 0x542F, 0x5431, 0x5434, 0x5435, 0x5443,
- 0x5444, 0x5447, 0x544D, 0x544F, 0x545E, 0x5462, 0x5464, 0x5466,
- 0x5467, 0x5469, 0x546B, 0x546D, 0x546E, 0x5474, 0x547F,
-};
-const unsigned short euc_to_utf8_8FB5[] = {
- 0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548D, 0x5491,
- 0x5495, 0x5496, 0x549C, 0x549F, 0x54A1, 0x54A6, 0x54A7, 0x54A9,
- 0x54AA, 0x54AD, 0x54AE, 0x54B1, 0x54B7, 0x54B9, 0x54BA, 0x54BB,
- 0x54BF, 0x54C6, 0x54CA, 0x54CD, 0x54CE, 0x54E0, 0x54EA, 0x54EC,
- 0x54EF, 0x54F6, 0x54FC, 0x54FE, 0x54FF, 0x5500, 0x5501, 0x5505,
- 0x5508, 0x5509, 0x550C, 0x550D, 0x550E, 0x5515, 0x552A, 0x552B,
- 0x5532, 0x5535, 0x5536, 0x553B, 0x553C, 0x553D, 0x5541, 0x5547,
- 0x5549, 0x554A, 0x554D, 0x5550, 0x5551, 0x5558, 0x555A, 0x555B,
- 0x555E, 0x5560, 0x5561, 0x5564, 0x5566, 0x557F, 0x5581, 0x5582,
- 0x5586, 0x5588, 0x558E, 0x558F, 0x5591, 0x5592, 0x5593, 0x5594,
- 0x5597, 0x55A3, 0x55A4, 0x55AD, 0x55B2, 0x55BF, 0x55C1, 0x55C3,
- 0x55C6, 0x55C9, 0x55CB, 0x55CC, 0x55CE, 0x55D1, 0x55D2,
-};
-const unsigned short euc_to_utf8_8FB6[] = {
- 0x55D3, 0x55D7, 0x55D8, 0x55DB, 0x55DE, 0x55E2, 0x55E9,
- 0x55F6, 0x55FF, 0x5605, 0x5608, 0x560A, 0x560D, 0x560E, 0x560F,
- 0x5610, 0x5611, 0x5612, 0x5619, 0x562C, 0x5630, 0x5633, 0x5635,
- 0x5637, 0x5639, 0x563B, 0x563C, 0x563D, 0x563F, 0x5640, 0x5641,
- 0x5643, 0x5644, 0x5646, 0x5649, 0x564B, 0x564D, 0x564F, 0x5654,
- 0x565E, 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566D,
- 0x566F, 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568B,
- 0x568C, 0x5695, 0x5699, 0x569A, 0x569D, 0x569E, 0x569F, 0x56A6,
- 0x56A7, 0x56A8, 0x56A9, 0x56AB, 0x56AC, 0x56AD, 0x56B1, 0x56B3,
- 0x56B7, 0x56BE, 0x56C5, 0x56C9, 0x56CA, 0x56CB, 0x56CF, 0x56D0,
- 0x56CC, 0x56CD, 0x56D9, 0x56DC, 0x56DD, 0x56DF, 0x56E1, 0x56E4,
- 0x56E5, 0x56E6, 0x56E7, 0x56E8, 0x56F1, 0x56EB, 0x56ED,
-};
-const unsigned short euc_to_utf8_8FB7[] = {
- 0x56F6, 0x56F7, 0x5701, 0x5702, 0x5707, 0x570A, 0x570C,
- 0x5711, 0x5715, 0x571A, 0x571B, 0x571D, 0x5720, 0x5722, 0x5723,
- 0x5724, 0x5725, 0x5729, 0x572A, 0x572C, 0x572E, 0x572F, 0x5733,
- 0x5734, 0x573D, 0x573E, 0x573F, 0x5745, 0x5746, 0x574C, 0x574D,
- 0x5752, 0x5762, 0x5765, 0x5767, 0x5768, 0x576B, 0x576D, 0x576E,
- 0x576F, 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779,
- 0x577A, 0x577B, 0x577C, 0x577E, 0x5781, 0x5783, 0x578C, 0x5794,
- 0x5797, 0x5799, 0x579A, 0x579C, 0x579D, 0x579E, 0x579F, 0x57A1,
- 0x5795, 0x57A7, 0x57A8, 0x57A9, 0x57AC, 0x57B8, 0x57BD, 0x57C7,
- 0x57C8, 0x57CC, 0x57CF, 0x57D5, 0x57DD, 0x57DE, 0x57E4, 0x57E6,
- 0x57E7, 0x57E9, 0x57ED, 0x57F0, 0x57F5, 0x57F6, 0x57F8, 0x57FD,
- 0x57FE, 0x57FF, 0x5803, 0x5804, 0x5808, 0x5809, 0x57E1,
-};
-const unsigned short euc_to_utf8_8FB8[] = {
- 0x580C, 0x580D, 0x581B, 0x581E, 0x581F, 0x5820, 0x5826,
- 0x5827, 0x582D, 0x5832, 0x5839, 0x583F, 0x5849, 0x584C, 0x584D,
- 0x584F, 0x5850, 0x5855, 0x585F, 0x5861, 0x5864, 0x5867, 0x5868,
- 0x5878, 0x587C, 0x587F, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889,
- 0x588A, 0x588C, 0x588D, 0x588F, 0x5890, 0x5894, 0x5896, 0x589D,
- 0x58A0, 0x58A1, 0x58A2, 0x58A6, 0x58A9, 0x58B1, 0x58B2, 0x58C4,
- 0x58BC, 0x58C2, 0x58C8, 0x58CD, 0x58CE, 0x58D0, 0x58D2, 0x58D4,
- 0x58D6, 0x58DA, 0x58DD, 0x58E1, 0x58E2, 0x58E9, 0x58F3, 0x5905,
- 0x5906, 0x590B, 0x590C, 0x5912, 0x5913, 0x5914, 0x8641, 0x591D,
- 0x5921, 0x5923, 0x5924, 0x5928, 0x592F, 0x5930, 0x5933, 0x5935,
- 0x5936, 0x593F, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595B,
- 0x595D, 0x595E, 0x595F, 0x5961, 0x5963, 0x596B, 0x596D,
-};
-const unsigned short euc_to_utf8_8FB9[] = {
- 0x596F, 0x5972, 0x5975, 0x5976, 0x5979, 0x597B, 0x597C,
- 0x598B, 0x598C, 0x598E, 0x5992, 0x5995, 0x5997, 0x599F, 0x59A4,
- 0x59A7, 0x59AD, 0x59AE, 0x59AF, 0x59B0, 0x59B3, 0x59B7, 0x59BA,
- 0x59BC, 0x59C1, 0x59C3, 0x59C4, 0x59C8, 0x59CA, 0x59CD, 0x59D2,
- 0x59DD, 0x59DE, 0x59DF, 0x59E3, 0x59E4, 0x59E7, 0x59EE, 0x59EF,
- 0x59F1, 0x59F2, 0x59F4, 0x59F7, 0x5A00, 0x5A04, 0x5A0C, 0x5A0D,
- 0x5A0E, 0x5A12, 0x5A13, 0x5A1E, 0x5A23, 0x5A24, 0x5A27, 0x5A28,
- 0x5A2A, 0x5A2D, 0x5A30, 0x5A44, 0x5A45, 0x5A47, 0x5A48, 0x5A4C,
- 0x5A50, 0x5A55, 0x5A5E, 0x5A63, 0x5A65, 0x5A67, 0x5A6D, 0x5A77,
- 0x5A7A, 0x5A7B, 0x5A7E, 0x5A8B, 0x5A90, 0x5A93, 0x5A96, 0x5A99,
- 0x5A9C, 0x5A9E, 0x5A9F, 0x5AA0, 0x5AA2, 0x5AA7, 0x5AAC, 0x5AB1,
- 0x5AB2, 0x5AB3, 0x5AB5, 0x5AB8, 0x5ABA, 0x5ABB, 0x5ABF,
-};
-const unsigned short euc_to_utf8_8FBA[] = {
- 0x5AC4, 0x5AC6, 0x5AC8, 0x5ACF, 0x5ADA, 0x5ADC, 0x5AE0,
- 0x5AE5, 0x5AEA, 0x5AEE, 0x5AF5, 0x5AF6, 0x5AFD, 0x5B00, 0x5B01,
- 0x5B08, 0x5B17, 0x5B34, 0x5B19, 0x5B1B, 0x5B1D, 0x5B21, 0x5B25,
- 0x5B2D, 0x5B38, 0x5B41, 0x5B4B, 0x5B4C, 0x5B52, 0x5B56, 0x5B5E,
- 0x5B68, 0x5B6E, 0x5B6F, 0x5B7C, 0x5B7D, 0x5B7E, 0x5B7F, 0x5B81,
- 0x5B84, 0x5B86, 0x5B8A, 0x5B8E, 0x5B90, 0x5B91, 0x5B93, 0x5B94,
- 0x5B96, 0x5BA8, 0x5BA9, 0x5BAC, 0x5BAD, 0x5BAF, 0x5BB1, 0x5BB2,
- 0x5BB7, 0x5BBA, 0x5BBC, 0x5BC0, 0x5BC1, 0x5BCD, 0x5BCF, 0x5BD6,
- 0x5BD7, 0x5BD8, 0x5BD9, 0x5BDA, 0x5BE0, 0x5BEF, 0x5BF1, 0x5BF4,
- 0x5BFD, 0x5C0C, 0x5C17, 0x5C1E, 0x5C1F, 0x5C23, 0x5C26, 0x5C29,
- 0x5C2B, 0x5C2C, 0x5C2E, 0x5C30, 0x5C32, 0x5C35, 0x5C36, 0x5C59,
- 0x5C5A, 0x5C5C, 0x5C62, 0x5C63, 0x5C67, 0x5C68, 0x5C69,
-};
-const unsigned short euc_to_utf8_8FBB[] = {
- 0x5C6D, 0x5C70, 0x5C74, 0x5C75, 0x5C7A, 0x5C7B, 0x5C7C,
- 0x5C7D, 0x5C87, 0x5C88, 0x5C8A, 0x5C8F, 0x5C92, 0x5C9D, 0x5C9F,
- 0x5CA0, 0x5CA2, 0x5CA3, 0x5CA6, 0x5CAA, 0x5CB2, 0x5CB4, 0x5CB5,
- 0x5CBA, 0x5CC9, 0x5CCB, 0x5CD2, 0x5CDD, 0x5CD7, 0x5CEE, 0x5CF1,
- 0x5CF2, 0x5CF4, 0x5D01, 0x5D06, 0x5D0D, 0x5D12, 0x5D2B, 0x5D23,
- 0x5D24, 0x5D26, 0x5D27, 0x5D31, 0x5D34, 0x5D39, 0x5D3D, 0x5D3F,
- 0x5D42, 0x5D43, 0x5D46, 0x5D48, 0x5D55, 0x5D51, 0x5D59, 0x5D4A,
- 0x5D5F, 0x5D60, 0x5D61, 0x5D62, 0x5D64, 0x5D6A, 0x5D6D, 0x5D70,
- 0x5D79, 0x5D7A, 0x5D7E, 0x5D7F, 0x5D81, 0x5D83, 0x5D88, 0x5D8A,
- 0x5D92, 0x5D93, 0x5D94, 0x5D95, 0x5D99, 0x5D9B, 0x5D9F, 0x5DA0,
- 0x5DA7, 0x5DAB, 0x5DB0, 0x5DB4, 0x5DB8, 0x5DB9, 0x5DC3, 0x5DC7,
- 0x5DCB, 0x5DD0, 0x5DCE, 0x5DD8, 0x5DD9, 0x5DE0, 0x5DE4,
-};
-const unsigned short euc_to_utf8_8FBC[] = {
- 0x5DE9, 0x5DF8, 0x5DF9, 0x5E00, 0x5E07, 0x5E0D, 0x5E12,
- 0x5E14, 0x5E15, 0x5E18, 0x5E1F, 0x5E20, 0x5E2E, 0x5E28, 0x5E32,
- 0x5E35, 0x5E3E, 0x5E4B, 0x5E50, 0x5E49, 0x5E51, 0x5E56, 0x5E58,
- 0x5E5B, 0x5E5C, 0x5E5E, 0x5E68, 0x5E6A, 0x5E6B, 0x5E6C, 0x5E6D,
- 0x5E6E, 0x5E70, 0x5E80, 0x5E8B, 0x5E8E, 0x5EA2, 0x5EA4, 0x5EA5,
- 0x5EA8, 0x5EAA, 0x5EAC, 0x5EB1, 0x5EB3, 0x5EBD, 0x5EBE, 0x5EBF,
- 0x5EC6, 0x5ECC, 0x5ECB, 0x5ECE, 0x5ED1, 0x5ED2, 0x5ED4, 0x5ED5,
- 0x5EDC, 0x5EDE, 0x5EE5, 0x5EEB, 0x5F02, 0x5F06, 0x5F07, 0x5F08,
- 0x5F0E, 0x5F19, 0x5F1C, 0x5F1D, 0x5F21, 0x5F22, 0x5F23, 0x5F24,
- 0x5F28, 0x5F2B, 0x5F2C, 0x5F2E, 0x5F30, 0x5F34, 0x5F36, 0x5F3B,
- 0x5F3D, 0x5F3F, 0x5F40, 0x5F44, 0x5F45, 0x5F47, 0x5F4D, 0x5F50,
- 0x5F54, 0x5F58, 0x5F5B, 0x5F60, 0x5F63, 0x5F64, 0x5F67,
-};
-const unsigned short euc_to_utf8_8FBD[] = {
- 0x5F6F, 0x5F72, 0x5F74, 0x5F75, 0x5F78, 0x5F7A, 0x5F7D,
- 0x5F7E, 0x5F89, 0x5F8D, 0x5F8F, 0x5F96, 0x5F9C, 0x5F9D, 0x5FA2,
- 0x5FA7, 0x5FAB, 0x5FA4, 0x5FAC, 0x5FAF, 0x5FB0, 0x5FB1, 0x5FB8,
- 0x5FC4, 0x5FC7, 0x5FC8, 0x5FC9, 0x5FCB, 0x5FD0, 0x5FD1, 0x5FD2,
- 0x5FD3, 0x5FD4, 0x5FDE, 0x5FE1, 0x5FE2, 0x5FE8, 0x5FE9, 0x5FEA,
- 0x5FEC, 0x5FED, 0x5FEE, 0x5FEF, 0x5FF2, 0x5FF3, 0x5FF6, 0x5FFA,
- 0x5FFC, 0x6007, 0x600A, 0x600D, 0x6013, 0x6014, 0x6017, 0x6018,
- 0x601A, 0x601F, 0x6024, 0x602D, 0x6033, 0x6035, 0x6040, 0x6047,
- 0x6048, 0x6049, 0x604C, 0x6051, 0x6054, 0x6056, 0x6057, 0x605D,
- 0x6061, 0x6067, 0x6071, 0x607E, 0x607F, 0x6082, 0x6086, 0x6088,
- 0x608A, 0x608E, 0x6091, 0x6093, 0x6095, 0x6098, 0x609D, 0x609E,
- 0x60A2, 0x60A4, 0x60A5, 0x60A8, 0x60B0, 0x60B1, 0x60B7,
-};
-const unsigned short euc_to_utf8_8FBE[] = {
- 0x60BB, 0x60BE, 0x60C2, 0x60C4, 0x60C8, 0x60C9, 0x60CA,
- 0x60CB, 0x60CE, 0x60CF, 0x60D4, 0x60D5, 0x60D9, 0x60DB, 0x60DD,
- 0x60DE, 0x60E2, 0x60E5, 0x60F2, 0x60F5, 0x60F8, 0x60FC, 0x60FD,
- 0x6102, 0x6107, 0x610A, 0x610C, 0x6110, 0x6111, 0x6112, 0x6113,
- 0x6114, 0x6116, 0x6117, 0x6119, 0x611C, 0x611E, 0x6122, 0x612A,
- 0x612B, 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141,
- 0x6145, 0x6146, 0x6149, 0x615E, 0x6160, 0x616C, 0x6172, 0x6178,
- 0x617B, 0x617C, 0x617F, 0x6180, 0x6181, 0x6183, 0x6184, 0x618B,
- 0x618D, 0x6192, 0x6193, 0x6197, 0x6198, 0x619C, 0x619D, 0x619F,
- 0x61A0, 0x61A5, 0x61A8, 0x61AA, 0x61AD, 0x61B8, 0x61B9, 0x61BC,
- 0x61C0, 0x61C1, 0x61C2, 0x61CE, 0x61CF, 0x61D5, 0x61DC, 0x61DD,
- 0x61DE, 0x61DF, 0x61E1, 0x61E2, 0x61E7, 0x61E9, 0x61E5,
-};
-const unsigned short euc_to_utf8_8FBF[] = {
- 0x61EC, 0x61ED, 0x61EF, 0x6201, 0x6203, 0x6204, 0x6207,
- 0x6213, 0x6215, 0x621C, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229,
- 0x622B, 0x6239, 0x623D, 0x6242, 0x6243, 0x6244, 0x6246, 0x624C,
- 0x6250, 0x6251, 0x6252, 0x6254, 0x6256, 0x625A, 0x625C, 0x6264,
- 0x626D, 0x626F, 0x6273, 0x627A, 0x627D, 0x628D, 0x628E, 0x628F,
- 0x6290, 0x62A6, 0x62A8, 0x62B3, 0x62B6, 0x62B7, 0x62BA, 0x62BE,
- 0x62BF, 0x62C4, 0x62CE, 0x62D5, 0x62D6, 0x62DA, 0x62EA, 0x62F2,
- 0x62F4, 0x62FC, 0x62FD, 0x6303, 0x6304, 0x630A, 0x630B, 0x630D,
- 0x6310, 0x6313, 0x6316, 0x6318, 0x6329, 0x632A, 0x632D, 0x6335,
- 0x6336, 0x6339, 0x633C, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346,
- 0x634A, 0x634B, 0x634E, 0x6352, 0x6353, 0x6354, 0x6358, 0x635B,
- 0x6365, 0x6366, 0x636C, 0x636D, 0x6371, 0x6374, 0x6375,
-};
-const unsigned short euc_to_utf8_8FC0[] = {
- 0x6378, 0x637C, 0x637D, 0x637F, 0x6382, 0x6384, 0x6387,
- 0x638A, 0x6390, 0x6394, 0x6395, 0x6399, 0x639A, 0x639E, 0x63A4,
- 0x63A6, 0x63AD, 0x63AE, 0x63AF, 0x63BD, 0x63C1, 0x63C5, 0x63C8,
- 0x63CE, 0x63D1, 0x63D3, 0x63D4, 0x63D5, 0x63DC, 0x63E0, 0x63E5,
- 0x63EA, 0x63EC, 0x63F2, 0x63F3, 0x63F5, 0x63F8, 0x63F9, 0x6409,
- 0x640A, 0x6410, 0x6412, 0x6414, 0x6418, 0x641E, 0x6420, 0x6422,
- 0x6424, 0x6425, 0x6429, 0x642A, 0x642F, 0x6430, 0x6435, 0x643D,
- 0x643F, 0x644B, 0x644F, 0x6451, 0x6452, 0x6453, 0x6454, 0x645A,
- 0x645B, 0x645C, 0x645D, 0x645F, 0x6460, 0x6461, 0x6463, 0x646D,
- 0x6473, 0x6474, 0x647B, 0x647D, 0x6485, 0x6487, 0x648F, 0x6490,
- 0x6491, 0x6498, 0x6499, 0x649B, 0x649D, 0x649F, 0x64A1, 0x64A3,
- 0x64A6, 0x64A8, 0x64AC, 0x64B3, 0x64BD, 0x64BE, 0x64BF,
-};
-const unsigned short euc_to_utf8_8FC1[] = {
- 0x64C4, 0x64C9, 0x64CA, 0x64CB, 0x64CC, 0x64CE, 0x64D0,
- 0x64D1, 0x64D5, 0x64D7, 0x64E4, 0x64E5, 0x64E9, 0x64EA, 0x64ED,
- 0x64F0, 0x64F5, 0x64F7, 0x64FB, 0x64FF, 0x6501, 0x6504, 0x6508,
- 0x6509, 0x650A, 0x650F, 0x6513, 0x6514, 0x6516, 0x6519, 0x651B,
- 0x651E, 0x651F, 0x6522, 0x6526, 0x6529, 0x652E, 0x6531, 0x653A,
- 0x653C, 0x653D, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554,
- 0x655F, 0x6560, 0x6567, 0x656B, 0x657A, 0x657D, 0x6581, 0x6585,
- 0x658A, 0x6592, 0x6595, 0x6598, 0x659D, 0x65A0, 0x65A3, 0x65A6,
- 0x65AE, 0x65B2, 0x65B3, 0x65B4, 0x65BF, 0x65C2, 0x65C8, 0x65C9,
- 0x65CE, 0x65D0, 0x65D4, 0x65D6, 0x65D8, 0x65DF, 0x65F0, 0x65F2,
- 0x65F4, 0x65F5, 0x65F9, 0x65FE, 0x65FF, 0x6600, 0x6604, 0x6608,
- 0x6609, 0x660D, 0x6611, 0x6612, 0x6615, 0x6616, 0x661D,
-};
-const unsigned short euc_to_utf8_8FC2[] = {
- 0x661E, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629,
- 0x662A, 0x662B, 0x662C, 0x662E, 0x6630, 0x6631, 0x6633, 0x6639,
- 0x6637, 0x6640, 0x6645, 0x6646, 0x664A, 0x664C, 0x6651, 0x664E,
- 0x6657, 0x6658, 0x6659, 0x665B, 0x665C, 0x6660, 0x6661, 0x66FB,
- 0x666A, 0x666B, 0x666C, 0x667E, 0x6673, 0x6675, 0x667F, 0x6677,
- 0x6678, 0x6679, 0x667B, 0x6680, 0x667C, 0x668B, 0x668C, 0x668D,
- 0x6690, 0x6692, 0x6699, 0x669A, 0x669B, 0x669C, 0x669F, 0x66A0,
- 0x66A4, 0x66AD, 0x66B1, 0x66B2, 0x66B5, 0x66BB, 0x66BF, 0x66C0,
- 0x66C2, 0x66C3, 0x66C8, 0x66CC, 0x66CE, 0x66CF, 0x66D4, 0x66DB,
- 0x66DF, 0x66E8, 0x66EB, 0x66EC, 0x66EE, 0x66FA, 0x6705, 0x6707,
- 0x670E, 0x6713, 0x6719, 0x671C, 0x6720, 0x6722, 0x6733, 0x673E,
- 0x6745, 0x6747, 0x6748, 0x674C, 0x6754, 0x6755, 0x675D,
-};
-const unsigned short euc_to_utf8_8FC3[] = {
- 0x6766, 0x676C, 0x676E, 0x6774, 0x6776, 0x677B, 0x6781,
- 0x6784, 0x678E, 0x678F, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799,
- 0x679B, 0x67B0, 0x67B1, 0x67B2, 0x67B5, 0x67BB, 0x67BC, 0x67BD,
- 0x67F9, 0x67C0, 0x67C2, 0x67C3, 0x67C5, 0x67C8, 0x67C9, 0x67D2,
- 0x67D7, 0x67D9, 0x67DC, 0x67E1, 0x67E6, 0x67F0, 0x67F2, 0x67F6,
- 0x67F7, 0x6852, 0x6814, 0x6819, 0x681D, 0x681F, 0x6828, 0x6827,
- 0x682C, 0x682D, 0x682F, 0x6830, 0x6831, 0x6833, 0x683B, 0x683F,
- 0x6844, 0x6845, 0x684A, 0x684C, 0x6855, 0x6857, 0x6858, 0x685B,
- 0x686B, 0x686E, 0x686F, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879,
- 0x687A, 0x687B, 0x687C, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896,
- 0x6898, 0x689A, 0x689C, 0x68A1, 0x68A3, 0x68A5, 0x68A9, 0x68AA,
- 0x68AE, 0x68B2, 0x68BB, 0x68C5, 0x68C8, 0x68CC, 0x68CF,
-};
-const unsigned short euc_to_utf8_8FC4[] = {
- 0x68D0, 0x68D1, 0x68D3, 0x68D6, 0x68D9, 0x68DC, 0x68DD,
- 0x68E5, 0x68E8, 0x68EA, 0x68EB, 0x68EC, 0x68ED, 0x68F0, 0x68F1,
- 0x68F5, 0x68F6, 0x68FB, 0x68FC, 0x68FD, 0x6906, 0x6909, 0x690A,
- 0x6910, 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935,
- 0x6938, 0x693B, 0x6942, 0x6945, 0x6949, 0x694E, 0x6957, 0x695B,
- 0x6963, 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696C, 0x6970,
- 0x6971, 0x6972, 0x697A, 0x697B, 0x697F, 0x6980, 0x698D, 0x6992,
- 0x6996, 0x6998, 0x69A1, 0x69A5, 0x69A6, 0x69A8, 0x69AB, 0x69AD,
- 0x69AF, 0x69B7, 0x69B8, 0x69BA, 0x69BC, 0x69C5, 0x69C8, 0x69D1,
- 0x69D6, 0x69D7, 0x69E2, 0x69E5, 0x69EE, 0x69EF, 0x69F1, 0x69F3,
- 0x69F5, 0x69FE, 0x6A00, 0x6A01, 0x6A03, 0x6A0F, 0x6A11, 0x6A15,
- 0x6A1A, 0x6A1D, 0x6A20, 0x6A24, 0x6A28, 0x6A30, 0x6A32,
-};
-const unsigned short euc_to_utf8_8FC5[] = {
- 0x6A34, 0x6A37, 0x6A3B, 0x6A3E, 0x6A3F, 0x6A45, 0x6A46,
- 0x6A49, 0x6A4A, 0x6A4E, 0x6A50, 0x6A51, 0x6A52, 0x6A55, 0x6A56,
- 0x6A5B, 0x6A64, 0x6A67, 0x6A6A, 0x6A71, 0x6A73, 0x6A7E, 0x6A81,
- 0x6A83, 0x6A86, 0x6A87, 0x6A89, 0x6A8B, 0x6A91, 0x6A9B, 0x6A9D,
- 0x6A9E, 0x6A9F, 0x6AA5, 0x6AAB, 0x6AAF, 0x6AB0, 0x6AB1, 0x6AB4,
- 0x6ABD, 0x6ABE, 0x6ABF, 0x6AC6, 0x6AC9, 0x6AC8, 0x6ACC, 0x6AD0,
- 0x6AD4, 0x6AD5, 0x6AD6, 0x6ADC, 0x6ADD, 0x6AE4, 0x6AE7, 0x6AEC,
- 0x6AF0, 0x6AF1, 0x6AF2, 0x6AFC, 0x6AFD, 0x6B02, 0x6B03, 0x6B06,
- 0x6B07, 0x6B09, 0x6B0F, 0x6B10, 0x6B11, 0x6B17, 0x6B1B, 0x6B1E,
- 0x6B24, 0x6B28, 0x6B2B, 0x6B2C, 0x6B2F, 0x6B35, 0x6B36, 0x6B3B,
- 0x6B3F, 0x6B46, 0x6B4A, 0x6B4D, 0x6B52, 0x6B56, 0x6B58, 0x6B5D,
- 0x6B60, 0x6B67, 0x6B6B, 0x6B6E, 0x6B70, 0x6B75, 0x6B7D,
-};
-const unsigned short euc_to_utf8_8FC6[] = {
- 0x6B7E, 0x6B82, 0x6B85, 0x6B97, 0x6B9B, 0x6B9F, 0x6BA0,
- 0x6BA2, 0x6BA3, 0x6BA8, 0x6BA9, 0x6BAC, 0x6BAD, 0x6BAE, 0x6BB0,
- 0x6BB8, 0x6BB9, 0x6BBD, 0x6BBE, 0x6BC3, 0x6BC4, 0x6BC9, 0x6BCC,
- 0x6BD6, 0x6BDA, 0x6BE1, 0x6BE3, 0x6BE6, 0x6BE7, 0x6BEE, 0x6BF1,
- 0x6BF7, 0x6BF9, 0x6BFF, 0x6C02, 0x6C04, 0x6C05, 0x6C09, 0x6C0D,
- 0x6C0E, 0x6C10, 0x6C12, 0x6C19, 0x6C1F, 0x6C26, 0x6C27, 0x6C28,
- 0x6C2C, 0x6C2E, 0x6C33, 0x6C35, 0x6C36, 0x6C3A, 0x6C3B, 0x6C3F,
- 0x6C4A, 0x6C4B, 0x6C4D, 0x6C4F, 0x6C52, 0x6C54, 0x6C59, 0x6C5B,
- 0x6C5C, 0x6C6B, 0x6C6D, 0x6C6F, 0x6C74, 0x6C76, 0x6C78, 0x6C79,
- 0x6C7B, 0x6C85, 0x6C86, 0x6C87, 0x6C89, 0x6C94, 0x6C95, 0x6C97,
- 0x6C98, 0x6C9C, 0x6C9F, 0x6CB0, 0x6CB2, 0x6CB4, 0x6CC2, 0x6CC6,
- 0x6CCD, 0x6CCF, 0x6CD0, 0x6CD1, 0x6CD2, 0x6CD4, 0x6CD6,
-};
-const unsigned short euc_to_utf8_8FC7[] = {
- 0x6CDA, 0x6CDC, 0x6CE0, 0x6CE7, 0x6CE9, 0x6CEB, 0x6CEC,
- 0x6CEE, 0x6CF2, 0x6CF4, 0x6D04, 0x6D07, 0x6D0A, 0x6D0E, 0x6D0F,
- 0x6D11, 0x6D13, 0x6D1A, 0x6D26, 0x6D27, 0x6D28, 0x6C67, 0x6D2E,
- 0x6D2F, 0x6D31, 0x6D39, 0x6D3C, 0x6D3F, 0x6D57, 0x6D5E, 0x6D5F,
- 0x6D61, 0x6D65, 0x6D67, 0x6D6F, 0x6D70, 0x6D7C, 0x6D82, 0x6D87,
- 0x6D91, 0x6D92, 0x6D94, 0x6D96, 0x6D97, 0x6D98, 0x6DAA, 0x6DAC,
- 0x6DB4, 0x6DB7, 0x6DB9, 0x6DBD, 0x6DBF, 0x6DC4, 0x6DC8, 0x6DCA,
- 0x6DCE, 0x6DCF, 0x6DD6, 0x6DDB, 0x6DDD, 0x6DDF, 0x6DE0, 0x6DE2,
- 0x6DE5, 0x6DE9, 0x6DEF, 0x6DF0, 0x6DF4, 0x6DF6, 0x6DFC, 0x6E00,
- 0x6E04, 0x6E1E, 0x6E22, 0x6E27, 0x6E32, 0x6E36, 0x6E39, 0x6E3B,
- 0x6E3C, 0x6E44, 0x6E45, 0x6E48, 0x6E49, 0x6E4B, 0x6E4F, 0x6E51,
- 0x6E52, 0x6E53, 0x6E54, 0x6E57, 0x6E5C, 0x6E5D, 0x6E5E,
-};
-const unsigned short euc_to_utf8_8FC8[] = {
- 0x6E62, 0x6E63, 0x6E68, 0x6E73, 0x6E7B, 0x6E7D, 0x6E8D,
- 0x6E93, 0x6E99, 0x6EA0, 0x6EA7, 0x6EAD, 0x6EAE, 0x6EB1, 0x6EB3,
- 0x6EBB, 0x6EBF, 0x6EC0, 0x6EC1, 0x6EC3, 0x6EC7, 0x6EC8, 0x6ECA,
- 0x6ECD, 0x6ECE, 0x6ECF, 0x6EEB, 0x6EED, 0x6EEE, 0x6EF9, 0x6EFB,
- 0x6EFD, 0x6F04, 0x6F08, 0x6F0A, 0x6F0C, 0x6F0D, 0x6F16, 0x6F18,
- 0x6F1A, 0x6F1B, 0x6F26, 0x6F29, 0x6F2A, 0x6F2F, 0x6F30, 0x6F33,
- 0x6F36, 0x6F3B, 0x6F3C, 0x6F2D, 0x6F4F, 0x6F51, 0x6F52, 0x6F53,
- 0x6F57, 0x6F59, 0x6F5A, 0x6F5D, 0x6F5E, 0x6F61, 0x6F62, 0x6F68,
- 0x6F6C, 0x6F7D, 0x6F7E, 0x6F83, 0x6F87, 0x6F88, 0x6F8B, 0x6F8C,
- 0x6F8D, 0x6F90, 0x6F92, 0x6F93, 0x6F94, 0x6F96, 0x6F9A, 0x6F9F,
- 0x6FA0, 0x6FA5, 0x6FA6, 0x6FA7, 0x6FA8, 0x6FAE, 0x6FAF, 0x6FB0,
- 0x6FB5, 0x6FB6, 0x6FBC, 0x6FC5, 0x6FC7, 0x6FC8, 0x6FCA,
-};
-const unsigned short euc_to_utf8_8FC9[] = {
- 0x6FDA, 0x6FDE, 0x6FE8, 0x6FE9, 0x6FF0, 0x6FF5, 0x6FF9,
- 0x6FFC, 0x6FFD, 0x7000, 0x7005, 0x7006, 0x7007, 0x700D, 0x7017,
- 0x7020, 0x7023, 0x702F, 0x7034, 0x7037, 0x7039, 0x703C, 0x7043,
- 0x7044, 0x7048, 0x7049, 0x704A, 0x704B, 0x7054, 0x7055, 0x705D,
- 0x705E, 0x704E, 0x7064, 0x7065, 0x706C, 0x706E, 0x7075, 0x7076,
- 0x707E, 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097,
- 0x7098, 0x709B, 0x70A4, 0x70AB, 0x70B0, 0x70B1, 0x70B4, 0x70B7,
- 0x70CA, 0x70D1, 0x70D3, 0x70D4, 0x70D5, 0x70D6, 0x70D8, 0x70DC,
- 0x70E4, 0x70FA, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710B,
- 0x710C, 0x710F, 0x711E, 0x7120, 0x712B, 0x712D, 0x712F, 0x7130,
- 0x7131, 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714A, 0x714B,
- 0x7150, 0x7152, 0x7157, 0x715A, 0x715C, 0x715E, 0x7160,
-};
-const unsigned short euc_to_utf8_8FCA[] = {
- 0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718C, 0x7192,
- 0x719A, 0x719B, 0x71A0, 0x71A2, 0x71AF, 0x71B0, 0x71B2, 0x71B3,
- 0x71BA, 0x71BF, 0x71C0, 0x71C1, 0x71C4, 0x71CB, 0x71CC, 0x71D3,
- 0x71D6, 0x71D9, 0x71DA, 0x71DC, 0x71F8, 0x71FE, 0x7200, 0x7207,
- 0x7208, 0x7209, 0x7213, 0x7217, 0x721A, 0x721D, 0x721F, 0x7224,
- 0x722B, 0x722F, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243,
- 0x7245, 0x724E, 0x724F, 0x7250, 0x7253, 0x7255, 0x7256, 0x725A,
- 0x725C, 0x725E, 0x7260, 0x7263, 0x7268, 0x726B, 0x726E, 0x726F,
- 0x7271, 0x7277, 0x7278, 0x727B, 0x727C, 0x727F, 0x7284, 0x7289,
- 0x728D, 0x728E, 0x7293, 0x729B, 0x72A8, 0x72AD, 0x72AE, 0x72B1,
- 0x72B4, 0x72BE, 0x72C1, 0x72C7, 0x72C9, 0x72CC, 0x72D5, 0x72D6,
- 0x72D8, 0x72DF, 0x72E5, 0x72F3, 0x72F4, 0x72FA, 0x72FB,
-};
-const unsigned short euc_to_utf8_8FCB[] = {
- 0x72FE, 0x7302, 0x7304, 0x7305, 0x7307, 0x730B, 0x730D,
- 0x7312, 0x7313, 0x7318, 0x7319, 0x731E, 0x7322, 0x7324, 0x7327,
- 0x7328, 0x732C, 0x7331, 0x7332, 0x7335, 0x733A, 0x733B, 0x733D,
- 0x7343, 0x734D, 0x7350, 0x7352, 0x7356, 0x7358, 0x735D, 0x735E,
- 0x735F, 0x7360, 0x7366, 0x7367, 0x7369, 0x736B, 0x736C, 0x736E,
- 0x736F, 0x7371, 0x7377, 0x7379, 0x737C, 0x7380, 0x7381, 0x7383,
- 0x7385, 0x7386, 0x738E, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398,
- 0x739C, 0x739E, 0x739F, 0x73A0, 0x73A2, 0x73A5, 0x73A6, 0x73AA,
- 0x73AB, 0x73AD, 0x73B5, 0x73B7, 0x73B9, 0x73BC, 0x73BD, 0x73BF,
- 0x73C5, 0x73C6, 0x73C9, 0x73CB, 0x73CC, 0x73CF, 0x73D2, 0x73D3,
- 0x73D6, 0x73D9, 0x73DD, 0x73E1, 0x73E3, 0x73E6, 0x73E7, 0x73E9,
- 0x73F4, 0x73F5, 0x73F7, 0x73F9, 0x73FA, 0x73FB, 0x73FD,
-};
-const unsigned short euc_to_utf8_8FCC[] = {
- 0x73FF, 0x7400, 0x7401, 0x7404, 0x7407, 0x740A, 0x7411,
- 0x741A, 0x741B, 0x7424, 0x7426, 0x7428, 0x7429, 0x742A, 0x742B,
- 0x742C, 0x742D, 0x742E, 0x742F, 0x7430, 0x7431, 0x7439, 0x7440,
- 0x7443, 0x7444, 0x7446, 0x7447, 0x744B, 0x744D, 0x7451, 0x7452,
- 0x7457, 0x745D, 0x7462, 0x7466, 0x7467, 0x7468, 0x746B, 0x746D,
- 0x746E, 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487,
- 0x7489, 0x748F, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749A,
- 0x749C, 0x749F, 0x74A0, 0x74A1, 0x74A3, 0x74A6, 0x74A8, 0x74A9,
- 0x74AA, 0x74AB, 0x74AE, 0x74AF, 0x74B1, 0x74B2, 0x74B5, 0x74B9,
- 0x74BB, 0x74BF, 0x74C8, 0x74C9, 0x74CC, 0x74D0, 0x74D3, 0x74D8,
- 0x74DA, 0x74DB, 0x74DE, 0x74DF, 0x74E4, 0x74E8, 0x74EA, 0x74EB,
- 0x74EF, 0x74F4, 0x74FA, 0x74FB, 0x74FC, 0x74FF, 0x7506,
-};
-const unsigned short euc_to_utf8_8FCD[] = {
- 0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527,
- 0x7529, 0x752A, 0x752F, 0x7536, 0x7539, 0x753D, 0x753E, 0x753F,
- 0x7540, 0x7543, 0x7547, 0x7548, 0x754E, 0x7550, 0x7552, 0x7557,
- 0x755E, 0x755F, 0x7561, 0x756F, 0x7571, 0x7579, 0x757A, 0x757B,
- 0x757C, 0x757D, 0x757E, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593,
- 0x7595, 0x7599, 0x759C, 0x75A2, 0x75A4, 0x75B4, 0x75BA, 0x75BF,
- 0x75C0, 0x75C1, 0x75C4, 0x75C6, 0x75CC, 0x75CE, 0x75CF, 0x75D7,
- 0x75DC, 0x75DF, 0x75E0, 0x75E1, 0x75E4, 0x75E7, 0x75EC, 0x75EE,
- 0x75EF, 0x75F1, 0x75F9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607,
- 0x7608, 0x760A, 0x760C, 0x760F, 0x7612, 0x7613, 0x7615, 0x7616,
- 0x7619, 0x761B, 0x761C, 0x761D, 0x761E, 0x7623, 0x7625, 0x7626,
- 0x7629, 0x762D, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639,
-};
-const unsigned short euc_to_utf8_8FCE[] = {
- 0x763A, 0x763C, 0x764A, 0x7640, 0x7641, 0x7643, 0x7644,
- 0x7645, 0x7649, 0x764B, 0x7655, 0x7659, 0x765F, 0x7664, 0x7665,
- 0x766D, 0x766E, 0x766F, 0x7671, 0x7674, 0x7681, 0x7685, 0x768C,
- 0x768D, 0x7695, 0x769B, 0x769C, 0x769D, 0x769F, 0x76A0, 0x76A2,
- 0x76A3, 0x76A4, 0x76A5, 0x76A6, 0x76A7, 0x76A8, 0x76AA, 0x76AD,
- 0x76BD, 0x76C1, 0x76C5, 0x76C9, 0x76CB, 0x76CC, 0x76CE, 0x76D4,
- 0x76D9, 0x76E0, 0x76E6, 0x76E8, 0x76EC, 0x76F0, 0x76F1, 0x76F6,
- 0x76F9, 0x76FC, 0x7700, 0x7706, 0x770A, 0x770E, 0x7712, 0x7714,
- 0x7715, 0x7717, 0x7719, 0x771A, 0x771C, 0x7722, 0x7728, 0x772D,
- 0x772E, 0x772F, 0x7734, 0x7735, 0x7736, 0x7739, 0x773D, 0x773E,
- 0x7742, 0x7745, 0x7746, 0x774A, 0x774D, 0x774E, 0x774F, 0x7752,
- 0x7756, 0x7757, 0x775C, 0x775E, 0x775F, 0x7760, 0x7762,
-};
-const unsigned short euc_to_utf8_8FCF[] = {
- 0x7764, 0x7767, 0x776A, 0x776C, 0x7770, 0x7772, 0x7773,
- 0x7774, 0x777A, 0x777D, 0x7780, 0x7784, 0x778C, 0x778D, 0x7794,
- 0x7795, 0x7796, 0x779A, 0x779F, 0x77A2, 0x77A7, 0x77AA, 0x77AE,
- 0x77AF, 0x77B1, 0x77B5, 0x77BE, 0x77C3, 0x77C9, 0x77D1, 0x77D2,
- 0x77D5, 0x77D9, 0x77DE, 0x77DF, 0x77E0, 0x77E4, 0x77E6, 0x77EA,
- 0x77EC, 0x77F0, 0x77F1, 0x77F4, 0x77F8, 0x77FB, 0x7805, 0x7806,
- 0x7809, 0x780D, 0x780E, 0x7811, 0x781D, 0x7821, 0x7822, 0x7823,
- 0x782D, 0x782E, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847,
- 0x7848, 0x784C, 0x784E, 0x7852, 0x785C, 0x785E, 0x7860, 0x7861,
- 0x7863, 0x7864, 0x7868, 0x786A, 0x786E, 0x787A, 0x787E, 0x788A,
- 0x788F, 0x7894, 0x7898, 0x78A1, 0x789D, 0x789E, 0x789F, 0x78A4,
- 0x78A8, 0x78AC, 0x78AD, 0x78B0, 0x78B1, 0x78B2, 0x78B3,
-};
-const unsigned short euc_to_utf8_8FD0[] = {
- 0x78BB, 0x78BD, 0x78BF, 0x78C7, 0x78C8, 0x78C9, 0x78CC,
- 0x78CE, 0x78D2, 0x78D3, 0x78D5, 0x78D6, 0x78E4, 0x78DB, 0x78DF,
- 0x78E0, 0x78E1, 0x78E6, 0x78EA, 0x78F2, 0x78F3, 0x7900, 0x78F6,
- 0x78F7, 0x78FA, 0x78FB, 0x78FF, 0x7906, 0x790C, 0x7910, 0x791A,
- 0x791C, 0x791E, 0x791F, 0x7920, 0x7925, 0x7927, 0x7929, 0x792D,
- 0x7931, 0x7934, 0x7935, 0x793B, 0x793D, 0x793F, 0x7944, 0x7945,
- 0x7946, 0x794A, 0x794B, 0x794F, 0x7951, 0x7954, 0x7958, 0x795B,
- 0x795C, 0x7967, 0x7969, 0x796B, 0x7972, 0x7979, 0x797B, 0x797C,
- 0x797E, 0x798B, 0x798C, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996,
- 0x7998, 0x799B, 0x799C, 0x79A1, 0x79A8, 0x79A9, 0x79AB, 0x79AF,
- 0x79B1, 0x79B4, 0x79B8, 0x79BB, 0x79C2, 0x79C4, 0x79C7, 0x79C8,
- 0x79CA, 0x79CF, 0x79D4, 0x79D6, 0x79DA, 0x79DD, 0x79DE,
-};
-const unsigned short euc_to_utf8_8FD1[] = {
- 0x79E0, 0x79E2, 0x79E5, 0x79EA, 0x79EB, 0x79ED, 0x79F1,
- 0x79F8, 0x79FC, 0x7A02, 0x7A03, 0x7A07, 0x7A09, 0x7A0A, 0x7A0C,
- 0x7A11, 0x7A15, 0x7A1B, 0x7A1E, 0x7A21, 0x7A27, 0x7A2B, 0x7A2D,
- 0x7A2F, 0x7A30, 0x7A34, 0x7A35, 0x7A38, 0x7A39, 0x7A3A, 0x7A44,
- 0x7A45, 0x7A47, 0x7A48, 0x7A4C, 0x7A55, 0x7A56, 0x7A59, 0x7A5C,
- 0x7A5D, 0x7A5F, 0x7A60, 0x7A65, 0x7A67, 0x7A6A, 0x7A6D, 0x7A75,
- 0x7A78, 0x7A7E, 0x7A80, 0x7A82, 0x7A85, 0x7A86, 0x7A8A, 0x7A8B,
- 0x7A90, 0x7A91, 0x7A94, 0x7A9E, 0x7AA0, 0x7AA3, 0x7AAC, 0x7AB3,
- 0x7AB5, 0x7AB9, 0x7ABB, 0x7ABC, 0x7AC6, 0x7AC9, 0x7ACC, 0x7ACE,
- 0x7AD1, 0x7ADB, 0x7AE8, 0x7AE9, 0x7AEB, 0x7AEC, 0x7AF1, 0x7AF4,
- 0x7AFB, 0x7AFD, 0x7AFE, 0x7B07, 0x7B14, 0x7B1F, 0x7B23, 0x7B27,
- 0x7B29, 0x7B2A, 0x7B2B, 0x7B2D, 0x7B2E, 0x7B2F, 0x7B30,
-};
-const unsigned short euc_to_utf8_8FD2[] = {
- 0x7B31, 0x7B34, 0x7B3D, 0x7B3F, 0x7B40, 0x7B41, 0x7B47,
- 0x7B4E, 0x7B55, 0x7B60, 0x7B64, 0x7B66, 0x7B69, 0x7B6A, 0x7B6D,
- 0x7B6F, 0x7B72, 0x7B73, 0x7B77, 0x7B84, 0x7B89, 0x7B8E, 0x7B90,
- 0x7B91, 0x7B96, 0x7B9B, 0x7B9E, 0x7BA0, 0x7BA5, 0x7BAC, 0x7BAF,
- 0x7BB0, 0x7BB2, 0x7BB5, 0x7BB6, 0x7BBA, 0x7BBB, 0x7BBC, 0x7BBD,
- 0x7BC2, 0x7BC5, 0x7BC8, 0x7BCA, 0x7BD4, 0x7BD6, 0x7BD7, 0x7BD9,
- 0x7BDA, 0x7BDB, 0x7BE8, 0x7BEA, 0x7BF2, 0x7BF4, 0x7BF5, 0x7BF8,
- 0x7BF9, 0x7BFA, 0x7BFC, 0x7BFE, 0x7C01, 0x7C02, 0x7C03, 0x7C04,
- 0x7C06, 0x7C09, 0x7C0B, 0x7C0C, 0x7C0E, 0x7C0F, 0x7C19, 0x7C1B,
- 0x7C20, 0x7C25, 0x7C26, 0x7C28, 0x7C2C, 0x7C31, 0x7C33, 0x7C34,
- 0x7C36, 0x7C39, 0x7C3A, 0x7C46, 0x7C4A, 0x7C55, 0x7C51, 0x7C52,
- 0x7C53, 0x7C59, 0x7C5A, 0x7C5B, 0x7C5C, 0x7C5D, 0x7C5E,
-};
-const unsigned short euc_to_utf8_8FD3[] = {
- 0x7C61, 0x7C63, 0x7C67, 0x7C69, 0x7C6D, 0x7C6E, 0x7C70,
- 0x7C72, 0x7C79, 0x7C7C, 0x7C7D, 0x7C86, 0x7C87, 0x7C8F, 0x7C94,
- 0x7C9E, 0x7CA0, 0x7CA6, 0x7CB0, 0x7CB6, 0x7CB7, 0x7CBA, 0x7CBB,
- 0x7CBC, 0x7CBF, 0x7CC4, 0x7CC7, 0x7CC8, 0x7CC9, 0x7CCD, 0x7CCF,
- 0x7CD3, 0x7CD4, 0x7CD5, 0x7CD7, 0x7CD9, 0x7CDA, 0x7CDD, 0x7CE6,
- 0x7CE9, 0x7CEB, 0x7CF5, 0x7D03, 0x7D07, 0x7D08, 0x7D09, 0x7D0F,
- 0x7D11, 0x7D12, 0x7D13, 0x7D16, 0x7D1D, 0x7D1E, 0x7D23, 0x7D26,
- 0x7D2A, 0x7D2D, 0x7D31, 0x7D3C, 0x7D3D, 0x7D3E, 0x7D40, 0x7D41,
- 0x7D47, 0x7D48, 0x7D4D, 0x7D51, 0x7D53, 0x7D57, 0x7D59, 0x7D5A,
- 0x7D5C, 0x7D5D, 0x7D65, 0x7D67, 0x7D6A, 0x7D70, 0x7D78, 0x7D7A,
- 0x7D7B, 0x7D7F, 0x7D81, 0x7D82, 0x7D83, 0x7D85, 0x7D86, 0x7D88,
- 0x7D8B, 0x7D8C, 0x7D8D, 0x7D91, 0x7D96, 0x7D97, 0x7D9D,
-};
-const unsigned short euc_to_utf8_8FD4[] = {
- 0x7D9E, 0x7DA6, 0x7DA7, 0x7DAA, 0x7DB3, 0x7DB6, 0x7DB7,
- 0x7DB9, 0x7DC2, 0x7DC3, 0x7DC4, 0x7DC5, 0x7DC6, 0x7DCC, 0x7DCD,
- 0x7DCE, 0x7DD7, 0x7DD9, 0x7E00, 0x7DE2, 0x7DE5, 0x7DE6, 0x7DEA,
- 0x7DEB, 0x7DED, 0x7DF1, 0x7DF5, 0x7DF6, 0x7DF9, 0x7DFA, 0x7E08,
- 0x7E10, 0x7E11, 0x7E15, 0x7E17, 0x7E1C, 0x7E1D, 0x7E20, 0x7E27,
- 0x7E28, 0x7E2C, 0x7E2D, 0x7E2F, 0x7E33, 0x7E36, 0x7E3F, 0x7E44,
- 0x7E45, 0x7E47, 0x7E4E, 0x7E50, 0x7E52, 0x7E58, 0x7E5F, 0x7E61,
- 0x7E62, 0x7E65, 0x7E6B, 0x7E6E, 0x7E6F, 0x7E73, 0x7E78, 0x7E7E,
- 0x7E81, 0x7E86, 0x7E87, 0x7E8A, 0x7E8D, 0x7E91, 0x7E95, 0x7E98,
- 0x7E9A, 0x7E9D, 0x7E9E, 0x7F3C, 0x7F3B, 0x7F3D, 0x7F3E, 0x7F3F,
- 0x7F43, 0x7F44, 0x7F47, 0x7F4F, 0x7F52, 0x7F53, 0x7F5B, 0x7F5C,
- 0x7F5D, 0x7F61, 0x7F63, 0x7F64, 0x7F65, 0x7F66, 0x7F6D,
-};
-const unsigned short euc_to_utf8_8FD5[] = {
- 0x7F71, 0x7F7D, 0x7F7E, 0x7F7F, 0x7F80, 0x7F8B, 0x7F8D,
- 0x7F8F, 0x7F90, 0x7F91, 0x7F96, 0x7F97, 0x7F9C, 0x7FA1, 0x7FA2,
- 0x7FA6, 0x7FAA, 0x7FAD, 0x7FB4, 0x7FBC, 0x7FBF, 0x7FC0, 0x7FC3,
- 0x7FC8, 0x7FCE, 0x7FCF, 0x7FDB, 0x7FDF, 0x7FE3, 0x7FE5, 0x7FE8,
- 0x7FEC, 0x7FEE, 0x7FEF, 0x7FF2, 0x7FFA, 0x7FFD, 0x7FFE, 0x7FFF,
- 0x8007, 0x8008, 0x800A, 0x800D, 0x800E, 0x800F, 0x8011, 0x8013,
- 0x8014, 0x8016, 0x801D, 0x801E, 0x801F, 0x8020, 0x8024, 0x8026,
- 0x802C, 0x802E, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803A,
- 0x803C, 0x803E, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806D,
- 0x8071, 0x8075, 0x8081, 0x8088, 0x808E, 0x809C, 0x809E, 0x80A6,
- 0x80A7, 0x80AB, 0x80B8, 0x80B9, 0x80C8, 0x80CD, 0x80CF, 0x80D2,
- 0x80D4, 0x80D5, 0x80D7, 0x80D8, 0x80E0, 0x80ED, 0x80EE,
-};
-const unsigned short euc_to_utf8_8FD6[] = {
- 0x80F0, 0x80F2, 0x80F3, 0x80F6, 0x80F9, 0x80FA, 0x80FE,
- 0x8103, 0x810B, 0x8116, 0x8117, 0x8118, 0x811C, 0x811E, 0x8120,
- 0x8124, 0x8127, 0x812C, 0x8130, 0x8135, 0x813A, 0x813C, 0x8145,
- 0x8147, 0x814A, 0x814C, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167,
- 0x8168, 0x8169, 0x816D, 0x816F, 0x8177, 0x8181, 0x8190, 0x8184,
- 0x8185, 0x8186, 0x818B, 0x818E, 0x8196, 0x8198, 0x819B, 0x819E,
- 0x81A2, 0x81AE, 0x81B2, 0x81B4, 0x81BB, 0x81CB, 0x81C3, 0x81C5,
- 0x81CA, 0x81CE, 0x81CF, 0x81D5, 0x81D7, 0x81DB, 0x81DD, 0x81DE,
- 0x81E1, 0x81E4, 0x81EB, 0x81EC, 0x81F0, 0x81F1, 0x81F2, 0x81F5,
- 0x81F6, 0x81F8, 0x81F9, 0x81FD, 0x81FF, 0x8200, 0x8203, 0x820F,
- 0x8213, 0x8214, 0x8219, 0x821A, 0x821D, 0x8221, 0x8222, 0x8228,
- 0x8232, 0x8234, 0x823A, 0x8243, 0x8244, 0x8245, 0x8246,
-};
-const unsigned short euc_to_utf8_8FD7[] = {
- 0x824B, 0x824E, 0x824F, 0x8251, 0x8256, 0x825C, 0x8260,
- 0x8263, 0x8267, 0x826D, 0x8274, 0x827B, 0x827D, 0x827F, 0x8280,
- 0x8281, 0x8283, 0x8284, 0x8287, 0x8289, 0x828A, 0x828E, 0x8291,
- 0x8294, 0x8296, 0x8298, 0x829A, 0x829B, 0x82A0, 0x82A1, 0x82A3,
- 0x82A4, 0x82A7, 0x82A8, 0x82A9, 0x82AA, 0x82AE, 0x82B0, 0x82B2,
- 0x82B4, 0x82B7, 0x82BA, 0x82BC, 0x82BE, 0x82BF, 0x82C6, 0x82D0,
- 0x82D5, 0x82DA, 0x82E0, 0x82E2, 0x82E4, 0x82E8, 0x82EA, 0x82ED,
- 0x82EF, 0x82F6, 0x82F7, 0x82FD, 0x82FE, 0x8300, 0x8301, 0x8307,
- 0x8308, 0x830A, 0x830B, 0x8354, 0x831B, 0x831D, 0x831E, 0x831F,
- 0x8321, 0x8322, 0x832C, 0x832D, 0x832E, 0x8330, 0x8333, 0x8337,
- 0x833A, 0x833C, 0x833D, 0x8342, 0x8343, 0x8344, 0x8347, 0x834D,
- 0x834E, 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378,
-};
-const unsigned short euc_to_utf8_8FD8[] = {
- 0x837D, 0x837F, 0x8380, 0x8382, 0x8384, 0x8386, 0x838D,
- 0x8392, 0x8394, 0x8395, 0x8398, 0x8399, 0x839B, 0x839C, 0x839D,
- 0x83A6, 0x83A7, 0x83A9, 0x83AC, 0x83BE, 0x83BF, 0x83C0, 0x83C7,
- 0x83C9, 0x83CF, 0x83D0, 0x83D1, 0x83D4, 0x83DD, 0x8353, 0x83E8,
- 0x83EA, 0x83F6, 0x83F8, 0x83F9, 0x83FC, 0x8401, 0x8406, 0x840A,
- 0x840F, 0x8411, 0x8415, 0x8419, 0x83AD, 0x842F, 0x8439, 0x8445,
- 0x8447, 0x8448, 0x844A, 0x844D, 0x844F, 0x8451, 0x8452, 0x8456,
- 0x8458, 0x8459, 0x845A, 0x845C, 0x8460, 0x8464, 0x8465, 0x8467,
- 0x846A, 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847C, 0x847D,
- 0x8481, 0x8485, 0x8492, 0x8493, 0x8495, 0x849E, 0x84A6, 0x84A8,
- 0x84A9, 0x84AA, 0x84AF, 0x84B1, 0x84B4, 0x84BA, 0x84BD, 0x84BE,
- 0x84C0, 0x84C2, 0x84C7, 0x84C8, 0x84CC, 0x84CF, 0x84D3,
-};
-const unsigned short euc_to_utf8_8FD9[] = {
- 0x84DC, 0x84E7, 0x84EA, 0x84EF, 0x84F0, 0x84F1, 0x84F2,
- 0x84F7, 0x8532, 0x84FA, 0x84FB, 0x84FD, 0x8502, 0x8503, 0x8507,
- 0x850C, 0x850E, 0x8510, 0x851C, 0x851E, 0x8522, 0x8523, 0x8524,
- 0x8525, 0x8527, 0x852A, 0x852B, 0x852F, 0x8533, 0x8534, 0x8536,
- 0x853F, 0x8546, 0x854F, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556,
- 0x8559, 0x855C, 0x855D, 0x855E, 0x855F, 0x8560, 0x8561, 0x8562,
- 0x8564, 0x856B, 0x856F, 0x8579, 0x857A, 0x857B, 0x857D, 0x857F,
- 0x8581, 0x8585, 0x8586, 0x8589, 0x858B, 0x858C, 0x858F, 0x8593,
- 0x8598, 0x859D, 0x859F, 0x85A0, 0x85A2, 0x85A5, 0x85A7, 0x85B4,
- 0x85B6, 0x85B7, 0x85B8, 0x85BC, 0x85BD, 0x85BE, 0x85BF, 0x85C2,
- 0x85C7, 0x85CA, 0x85CB, 0x85CE, 0x85AD, 0x85D8, 0x85DA, 0x85DF,
- 0x85E0, 0x85E6, 0x85E8, 0x85ED, 0x85F3, 0x85F6, 0x85FC,
-};
-const unsigned short euc_to_utf8_8FDA[] = {
- 0x85FF, 0x8600, 0x8604, 0x8605, 0x860D, 0x860E, 0x8610,
- 0x8611, 0x8612, 0x8618, 0x8619, 0x861B, 0x861E, 0x8621, 0x8627,
- 0x8629, 0x8636, 0x8638, 0x863A, 0x863C, 0x863D, 0x8640, 0x8642,
- 0x8646, 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865D,
- 0x8660, 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866C, 0x866F,
- 0x8675, 0x8676, 0x8677, 0x867A, 0x868D, 0x8691, 0x8696, 0x8698,
- 0x869A, 0x869C, 0x86A1, 0x86A6, 0x86A7, 0x86A8, 0x86AD, 0x86B1,
- 0x86B3, 0x86B4, 0x86B5, 0x86B7, 0x86B8, 0x86B9, 0x86BF, 0x86C0,
- 0x86C1, 0x86C3, 0x86C5, 0x86D1, 0x86D2, 0x86D5, 0x86D7, 0x86DA,
- 0x86DC, 0x86E0, 0x86E3, 0x86E5, 0x86E7, 0x8688, 0x86FA, 0x86FC,
- 0x86FD, 0x8704, 0x8705, 0x8707, 0x870B, 0x870E, 0x870F, 0x8710,
- 0x8713, 0x8714, 0x8719, 0x871E, 0x871F, 0x8721, 0x8723,
-};
-const unsigned short euc_to_utf8_8FDB[] = {
- 0x8728, 0x872E, 0x872F, 0x8731, 0x8732, 0x8739, 0x873A,
- 0x873C, 0x873D, 0x873E, 0x8740, 0x8743, 0x8745, 0x874D, 0x8758,
- 0x875D, 0x8761, 0x8764, 0x8765, 0x876F, 0x8771, 0x8772, 0x877B,
- 0x8783, 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878B,
- 0x878C, 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879E,
- 0x87A0, 0x87A3, 0x87A7, 0x87AC, 0x87AD, 0x87AE, 0x87B1, 0x87B5,
- 0x87BE, 0x87BF, 0x87C1, 0x87C8, 0x87C9, 0x87CA, 0x87CE, 0x87D5,
- 0x87D6, 0x87D9, 0x87DA, 0x87DC, 0x87DF, 0x87E2, 0x87E3, 0x87E4,
- 0x87EA, 0x87EB, 0x87ED, 0x87F1, 0x87F3, 0x87F8, 0x87FA, 0x87FF,
- 0x8801, 0x8803, 0x8806, 0x8809, 0x880A, 0x880B, 0x8810, 0x8819,
- 0x8812, 0x8813, 0x8814, 0x8818, 0x881A, 0x881B, 0x881C, 0x881E,
- 0x881F, 0x8828, 0x882D, 0x882E, 0x8830, 0x8832, 0x8835,
-};
-const unsigned short euc_to_utf8_8FDC[] = {
- 0x883A, 0x883C, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849,
- 0x884A, 0x884B, 0x884E, 0x8851, 0x8855, 0x8856, 0x8858, 0x885A,
- 0x885C, 0x885F, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887B,
- 0x8880, 0x8898, 0x889A, 0x889B, 0x889C, 0x889F, 0x88A0, 0x88A8,
- 0x88AA, 0x88BA, 0x88BD, 0x88BE, 0x88C0, 0x88CA, 0x88CB, 0x88CC,
- 0x88CD, 0x88CE, 0x88D1, 0x88D2, 0x88D3, 0x88DB, 0x88DE, 0x88E7,
- 0x88EF, 0x88F0, 0x88F1, 0x88F5, 0x88F7, 0x8901, 0x8906, 0x890D,
- 0x890E, 0x890F, 0x8915, 0x8916, 0x8918, 0x8919, 0x891A, 0x891C,
- 0x8920, 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935,
- 0x8939, 0x893A, 0x893E, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949,
- 0x894F, 0x8952, 0x8957, 0x895A, 0x895B, 0x895C, 0x8961, 0x8962,
- 0x8963, 0x896B, 0x896E, 0x8970, 0x8973, 0x8975, 0x897A,
-};
-const unsigned short euc_to_utf8_8FDD[] = {
- 0x897B, 0x897C, 0x897D, 0x8989, 0x898D, 0x8990, 0x8994,
- 0x8995, 0x899B, 0x899C, 0x899F, 0x89A0, 0x89A5, 0x89B0, 0x89B4,
- 0x89B5, 0x89B6, 0x89B7, 0x89BC, 0x89D4, 0x89D5, 0x89D6, 0x89D7,
- 0x89D8, 0x89E5, 0x89E9, 0x89EB, 0x89ED, 0x89F1, 0x89F3, 0x89F6,
- 0x89F9, 0x89FD, 0x89FF, 0x8A04, 0x8A05, 0x8A07, 0x8A0F, 0x8A11,
- 0x8A12, 0x8A14, 0x8A15, 0x8A1E, 0x8A20, 0x8A22, 0x8A24, 0x8A26,
- 0x8A2B, 0x8A2C, 0x8A2F, 0x8A35, 0x8A37, 0x8A3D, 0x8A3E, 0x8A40,
- 0x8A43, 0x8A45, 0x8A47, 0x8A49, 0x8A4D, 0x8A4E, 0x8A53, 0x8A56,
- 0x8A57, 0x8A58, 0x8A5C, 0x8A5D, 0x8A61, 0x8A65, 0x8A67, 0x8A75,
- 0x8A76, 0x8A77, 0x8A79, 0x8A7A, 0x8A7B, 0x8A7E, 0x8A7F, 0x8A80,
- 0x8A83, 0x8A86, 0x8A8B, 0x8A8F, 0x8A90, 0x8A92, 0x8A96, 0x8A97,
- 0x8A99, 0x8A9F, 0x8AA7, 0x8AA9, 0x8AAE, 0x8AAF, 0x8AB3,
-};
-const unsigned short euc_to_utf8_8FDE[] = {
- 0x8AB6, 0x8AB7, 0x8ABB, 0x8ABE, 0x8AC3, 0x8AC6, 0x8AC8,
- 0x8AC9, 0x8ACA, 0x8AD1, 0x8AD3, 0x8AD4, 0x8AD5, 0x8AD7, 0x8ADD,
- 0x8ADF, 0x8AEC, 0x8AF0, 0x8AF4, 0x8AF5, 0x8AF6, 0x8AFC, 0x8AFF,
- 0x8B05, 0x8B06, 0x8B0B, 0x8B11, 0x8B1C, 0x8B1E, 0x8B1F, 0x8B0A,
- 0x8B2D, 0x8B30, 0x8B37, 0x8B3C, 0x8B42, 0x8B43, 0x8B44, 0x8B45,
- 0x8B46, 0x8B48, 0x8B52, 0x8B53, 0x8B54, 0x8B59, 0x8B4D, 0x8B5E,
- 0x8B63, 0x8B6D, 0x8B76, 0x8B78, 0x8B79, 0x8B7C, 0x8B7E, 0x8B81,
- 0x8B84, 0x8B85, 0x8B8B, 0x8B8D, 0x8B8F, 0x8B94, 0x8B95, 0x8B9C,
- 0x8B9E, 0x8B9F, 0x8C38, 0x8C39, 0x8C3D, 0x8C3E, 0x8C45, 0x8C47,
- 0x8C49, 0x8C4B, 0x8C4F, 0x8C51, 0x8C53, 0x8C54, 0x8C57, 0x8C58,
- 0x8C5B, 0x8C5D, 0x8C59, 0x8C63, 0x8C64, 0x8C66, 0x8C68, 0x8C69,
- 0x8C6D, 0x8C73, 0x8C75, 0x8C76, 0x8C7B, 0x8C7E, 0x8C86,
-};
-const unsigned short euc_to_utf8_8FDF[] = {
- 0x8C87, 0x8C8B, 0x8C90, 0x8C92, 0x8C93, 0x8C99, 0x8C9B,
- 0x8C9C, 0x8CA4, 0x8CB9, 0x8CBA, 0x8CC5, 0x8CC6, 0x8CC9, 0x8CCB,
- 0x8CCF, 0x8CD6, 0x8CD5, 0x8CD9, 0x8CDD, 0x8CE1, 0x8CE8, 0x8CEC,
- 0x8CEF, 0x8CF0, 0x8CF2, 0x8CF5, 0x8CF7, 0x8CF8, 0x8CFE, 0x8CFF,
- 0x8D01, 0x8D03, 0x8D09, 0x8D12, 0x8D17, 0x8D1B, 0x8D65, 0x8D69,
- 0x8D6C, 0x8D6E, 0x8D7F, 0x8D82, 0x8D84, 0x8D88, 0x8D8D, 0x8D90,
- 0x8D91, 0x8D95, 0x8D9E, 0x8D9F, 0x8DA0, 0x8DA6, 0x8DAB, 0x8DAC,
- 0x8DAF, 0x8DB2, 0x8DB5, 0x8DB7, 0x8DB9, 0x8DBB, 0x8DC0, 0x8DC5,
- 0x8DC6, 0x8DC7, 0x8DC8, 0x8DCA, 0x8DCE, 0x8DD1, 0x8DD4, 0x8DD5,
- 0x8DD7, 0x8DD9, 0x8DE4, 0x8DE5, 0x8DE7, 0x8DEC, 0x8DF0, 0x8DBC,
- 0x8DF1, 0x8DF2, 0x8DF4, 0x8DFD, 0x8E01, 0x8E04, 0x8E05, 0x8E06,
- 0x8E0B, 0x8E11, 0x8E14, 0x8E16, 0x8E20, 0x8E21, 0x8E22,
-};
-const unsigned short euc_to_utf8_8FE0[] = {
- 0x8E23, 0x8E26, 0x8E27, 0x8E31, 0x8E33, 0x8E36, 0x8E37,
- 0x8E38, 0x8E39, 0x8E3D, 0x8E40, 0x8E41, 0x8E4B, 0x8E4D, 0x8E4E,
- 0x8E4F, 0x8E54, 0x8E5B, 0x8E5C, 0x8E5D, 0x8E5E, 0x8E61, 0x8E62,
- 0x8E69, 0x8E6C, 0x8E6D, 0x8E6F, 0x8E70, 0x8E71, 0x8E79, 0x8E7A,
- 0x8E7B, 0x8E82, 0x8E83, 0x8E89, 0x8E90, 0x8E92, 0x8E95, 0x8E9A,
- 0x8E9B, 0x8E9D, 0x8E9E, 0x8EA2, 0x8EA7, 0x8EA9, 0x8EAD, 0x8EAE,
- 0x8EB3, 0x8EB5, 0x8EBA, 0x8EBB, 0x8EC0, 0x8EC1, 0x8EC3, 0x8EC4,
- 0x8EC7, 0x8ECF, 0x8ED1, 0x8ED4, 0x8EDC, 0x8EE8, 0x8EEE, 0x8EF0,
- 0x8EF1, 0x8EF7, 0x8EF9, 0x8EFA, 0x8EED, 0x8F00, 0x8F02, 0x8F07,
- 0x8F08, 0x8F0F, 0x8F10, 0x8F16, 0x8F17, 0x8F18, 0x8F1E, 0x8F20,
- 0x8F21, 0x8F23, 0x8F25, 0x8F27, 0x8F28, 0x8F2C, 0x8F2D, 0x8F2E,
- 0x8F34, 0x8F35, 0x8F36, 0x8F37, 0x8F3A, 0x8F40, 0x8F41,
-};
-const unsigned short euc_to_utf8_8FE1[] = {
- 0x8F43, 0x8F47, 0x8F4F, 0x8F51, 0x8F52, 0x8F53, 0x8F54,
- 0x8F55, 0x8F58, 0x8F5D, 0x8F5E, 0x8F65, 0x8F9D, 0x8FA0, 0x8FA1,
- 0x8FA4, 0x8FA5, 0x8FA6, 0x8FB5, 0x8FB6, 0x8FB8, 0x8FBE, 0x8FC0,
- 0x8FC1, 0x8FC6, 0x8FCA, 0x8FCB, 0x8FCD, 0x8FD0, 0x8FD2, 0x8FD3,
- 0x8FD5, 0x8FE0, 0x8FE3, 0x8FE4, 0x8FE8, 0x8FEE, 0x8FF1, 0x8FF5,
- 0x8FF6, 0x8FFB, 0x8FFE, 0x9002, 0x9004, 0x9008, 0x900C, 0x9018,
- 0x901B, 0x9028, 0x9029, 0x902F, 0x902A, 0x902C, 0x902D, 0x9033,
- 0x9034, 0x9037, 0x903F, 0x9043, 0x9044, 0x904C, 0x905B, 0x905D,
- 0x9062, 0x9066, 0x9067, 0x906C, 0x9070, 0x9074, 0x9079, 0x9085,
- 0x9088, 0x908B, 0x908C, 0x908E, 0x9090, 0x9095, 0x9097, 0x9098,
- 0x9099, 0x909B, 0x90A0, 0x90A1, 0x90A2, 0x90A5, 0x90B0, 0x90B2,
- 0x90B3, 0x90B4, 0x90B6, 0x90BD, 0x90CC, 0x90BE, 0x90C3,
-};
-const unsigned short euc_to_utf8_8FE2[] = {
- 0x90C4, 0x90C5, 0x90C7, 0x90C8, 0x90D5, 0x90D7, 0x90D8,
- 0x90D9, 0x90DC, 0x90DD, 0x90DF, 0x90E5, 0x90D2, 0x90F6, 0x90EB,
- 0x90EF, 0x90F0, 0x90F4, 0x90FE, 0x90FF, 0x9100, 0x9104, 0x9105,
- 0x9106, 0x9108, 0x910D, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118,
- 0x911A, 0x911C, 0x911E, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127,
- 0x9129, 0x912E, 0x912F, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139,
- 0x913A, 0x913C, 0x913D, 0x9143, 0x9147, 0x9148, 0x914F, 0x9153,
- 0x9157, 0x9159, 0x915A, 0x915B, 0x9161, 0x9164, 0x9167, 0x916D,
- 0x9174, 0x9179, 0x917A, 0x917B, 0x9181, 0x9183, 0x9185, 0x9186,
- 0x918A, 0x918E, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919E,
- 0x91A1, 0x91A6, 0x91A8, 0x91AC, 0x91AD, 0x91AE, 0x91B0, 0x91B1,
- 0x91B2, 0x91B3, 0x91B6, 0x91BB, 0x91BC, 0x91BD, 0x91BF,
-};
-const unsigned short euc_to_utf8_8FE3[] = {
- 0x91C2, 0x91C3, 0x91C5, 0x91D3, 0x91D4, 0x91D7, 0x91D9,
- 0x91DA, 0x91DE, 0x91E4, 0x91E5, 0x91E9, 0x91EA, 0x91EC, 0x91ED,
- 0x91EE, 0x91EF, 0x91F0, 0x91F1, 0x91F7, 0x91F9, 0x91FB, 0x91FD,
- 0x9200, 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920A,
- 0x920C, 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921C, 0x921D,
- 0x9223, 0x9224, 0x9225, 0x9226, 0x9228, 0x922E, 0x922F, 0x9230,
- 0x9233, 0x9235, 0x9236, 0x9238, 0x9239, 0x923A, 0x923C, 0x923E,
- 0x9240, 0x9242, 0x9243, 0x9246, 0x9247, 0x924A, 0x924D, 0x924E,
- 0x924F, 0x9251, 0x9258, 0x9259, 0x925C, 0x925D, 0x9260, 0x9261,
- 0x9265, 0x9267, 0x9268, 0x9269, 0x926E, 0x926F, 0x9270, 0x9275,
- 0x9276, 0x9277, 0x9278, 0x9279, 0x927B, 0x927C, 0x927D, 0x927F,
- 0x9288, 0x9289, 0x928A, 0x928D, 0x928E, 0x9292, 0x9297,
-};
-const unsigned short euc_to_utf8_8FE4[] = {
- 0x9299, 0x929F, 0x92A0, 0x92A4, 0x92A5, 0x92A7, 0x92A8,
- 0x92AB, 0x92AF, 0x92B2, 0x92B6, 0x92B8, 0x92BA, 0x92BB, 0x92BC,
- 0x92BD, 0x92BF, 0x92C0, 0x92C1, 0x92C2, 0x92C3, 0x92C5, 0x92C6,
- 0x92C7, 0x92C8, 0x92CB, 0x92CC, 0x92CD, 0x92CE, 0x92D0, 0x92D3,
- 0x92D5, 0x92D7, 0x92D8, 0x92D9, 0x92DC, 0x92DD, 0x92DF, 0x92E0,
- 0x92E1, 0x92E3, 0x92E5, 0x92E7, 0x92E8, 0x92EC, 0x92EE, 0x92F0,
- 0x92F9, 0x92FB, 0x92FF, 0x9300, 0x9302, 0x9308, 0x930D, 0x9311,
- 0x9314, 0x9315, 0x931C, 0x931D, 0x931E, 0x931F, 0x9321, 0x9324,
- 0x9325, 0x9327, 0x9329, 0x932A, 0x9333, 0x9334, 0x9336, 0x9337,
- 0x9347, 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357,
- 0x9358, 0x935A, 0x935E, 0x9364, 0x9365, 0x9367, 0x9369, 0x936A,
- 0x936D, 0x936F, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376,
-};
-const unsigned short euc_to_utf8_8FE5[] = {
- 0x937A, 0x937D, 0x937F, 0x9380, 0x9381, 0x9382, 0x9388,
- 0x938A, 0x938B, 0x938D, 0x938F, 0x9392, 0x9395, 0x9398, 0x939B,
- 0x939E, 0x93A1, 0x93A3, 0x93A4, 0x93A6, 0x93A8, 0x93AB, 0x93B4,
- 0x93B5, 0x93B6, 0x93BA, 0x93A9, 0x93C1, 0x93C4, 0x93C5, 0x93C6,
- 0x93C7, 0x93C9, 0x93CA, 0x93CB, 0x93CC, 0x93CD, 0x93D3, 0x93D9,
- 0x93DC, 0x93DE, 0x93DF, 0x93E2, 0x93E6, 0x93E7, 0x93F9, 0x93F7,
- 0x93F8, 0x93FA, 0x93FB, 0x93FD, 0x9401, 0x9402, 0x9404, 0x9408,
- 0x9409, 0x940D, 0x940E, 0x940F, 0x9415, 0x9416, 0x9417, 0x941F,
- 0x942E, 0x942F, 0x9431, 0x9432, 0x9433, 0x9434, 0x943B, 0x943F,
- 0x943D, 0x9443, 0x9445, 0x9448, 0x944A, 0x944C, 0x9455, 0x9459,
- 0x945C, 0x945F, 0x9461, 0x9463, 0x9468, 0x946B, 0x946D, 0x946E,
- 0x946F, 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579,
-};
-const unsigned short euc_to_utf8_8FE6[] = {
- 0x957E, 0x9584, 0x9588, 0x958C, 0x958D, 0x958E, 0x959D,
- 0x959E, 0x959F, 0x95A1, 0x95A6, 0x95A9, 0x95AB, 0x95AC, 0x95B4,
- 0x95B6, 0x95BA, 0x95BD, 0x95BF, 0x95C6, 0x95C8, 0x95C9, 0x95CB,
- 0x95D0, 0x95D1, 0x95D2, 0x95D3, 0x95D9, 0x95DA, 0x95DD, 0x95DE,
- 0x95DF, 0x95E0, 0x95E4, 0x95E6, 0x961D, 0x961E, 0x9622, 0x9624,
- 0x9625, 0x9626, 0x962C, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639,
- 0x963A, 0x963C, 0x963D, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657,
- 0x9658, 0x9661, 0x966E, 0x9674, 0x967B, 0x967C, 0x967E, 0x967F,
- 0x9681, 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969A,
- 0x969D, 0x969F, 0x96A4, 0x96A5, 0x96A6, 0x96A9, 0x96AE, 0x96AF,
- 0x96B3, 0x96BA, 0x96CA, 0x96D2, 0x5DB2, 0x96D8, 0x96DA, 0x96DD,
- 0x96DE, 0x96DF, 0x96E9, 0x96EF, 0x96F1, 0x96FA, 0x9702,
-};
-const unsigned short euc_to_utf8_8FE7[] = {
- 0x9703, 0x9705, 0x9709, 0x971A, 0x971B, 0x971D, 0x9721,
- 0x9722, 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974A,
- 0x974E, 0x974F, 0x9755, 0x9757, 0x9758, 0x975A, 0x975B, 0x9763,
- 0x9767, 0x976A, 0x976E, 0x9773, 0x9776, 0x9777, 0x9778, 0x977B,
- 0x977D, 0x977F, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799,
- 0x979A, 0x979E, 0x979F, 0x97A2, 0x97AC, 0x97AE, 0x97B1, 0x97B2,
- 0x97B5, 0x97B6, 0x97B8, 0x97B9, 0x97BA, 0x97BC, 0x97BE, 0x97BF,
- 0x97C1, 0x97C4, 0x97C5, 0x97C7, 0x97C9, 0x97CA, 0x97CC, 0x97CD,
- 0x97CE, 0x97D0, 0x97D1, 0x97D4, 0x97D7, 0x97D8, 0x97D9, 0x97DD,
- 0x97DE, 0x97E0, 0x97DB, 0x97E1, 0x97E4, 0x97EF, 0x97F1, 0x97F4,
- 0x97F7, 0x97F8, 0x97FA, 0x9807, 0x980A, 0x9819, 0x980D, 0x980E,
- 0x9814, 0x9816, 0x981C, 0x981E, 0x9820, 0x9823, 0x9826,
-};
-const unsigned short euc_to_utf8_8FE8[] = {
- 0x982B, 0x982E, 0x982F, 0x9830, 0x9832, 0x9833, 0x9835,
- 0x9825, 0x983E, 0x9844, 0x9847, 0x984A, 0x9851, 0x9852, 0x9853,
- 0x9856, 0x9857, 0x9859, 0x985A, 0x9862, 0x9863, 0x9865, 0x9866,
- 0x986A, 0x986C, 0x98AB, 0x98AD, 0x98AE, 0x98B0, 0x98B4, 0x98B7,
- 0x98B8, 0x98BA, 0x98BB, 0x98BF, 0x98C2, 0x98C5, 0x98C8, 0x98CC,
- 0x98E1, 0x98E3, 0x98E5, 0x98E6, 0x98E7, 0x98EA, 0x98F3, 0x98F6,
- 0x9902, 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991A,
- 0x991B, 0x991C, 0x991F, 0x9922, 0x9926, 0x9927, 0x992B, 0x9931,
- 0x9932, 0x9933, 0x9934, 0x9935, 0x9939, 0x993A, 0x993B, 0x993C,
- 0x9940, 0x9941, 0x9946, 0x9947, 0x9948, 0x994D, 0x994E, 0x9954,
- 0x9958, 0x9959, 0x995B, 0x995C, 0x995E, 0x995F, 0x9960, 0x999B,
- 0x999D, 0x999F, 0x99A6, 0x99B0, 0x99B1, 0x99B2, 0x99B5,
-};
-const unsigned short euc_to_utf8_8FE9[] = {
- 0x99B9, 0x99BA, 0x99BD, 0x99BF, 0x99C3, 0x99C9, 0x99D3,
- 0x99D4, 0x99D9, 0x99DA, 0x99DC, 0x99DE, 0x99E7, 0x99EA, 0x99EB,
- 0x99EC, 0x99F0, 0x99F4, 0x99F5, 0x99F9, 0x99FD, 0x99FE, 0x9A02,
- 0x9A03, 0x9A04, 0x9A0B, 0x9A0C, 0x9A10, 0x9A11, 0x9A16, 0x9A1E,
- 0x9A20, 0x9A22, 0x9A23, 0x9A24, 0x9A27, 0x9A2D, 0x9A2E, 0x9A33,
- 0x9A35, 0x9A36, 0x9A38, 0x9A47, 0x9A41, 0x9A44, 0x9A4A, 0x9A4B,
- 0x9A4C, 0x9A4E, 0x9A51, 0x9A54, 0x9A56, 0x9A5D, 0x9AAA, 0x9AAC,
- 0x9AAE, 0x9AAF, 0x9AB2, 0x9AB4, 0x9AB5, 0x9AB6, 0x9AB9, 0x9ABB,
- 0x9ABE, 0x9ABF, 0x9AC1, 0x9AC3, 0x9AC6, 0x9AC8, 0x9ACE, 0x9AD0,
- 0x9AD2, 0x9AD5, 0x9AD6, 0x9AD7, 0x9ADB, 0x9ADC, 0x9AE0, 0x9AE4,
- 0x9AE5, 0x9AE7, 0x9AE9, 0x9AEC, 0x9AF2, 0x9AF3, 0x9AF5, 0x9AF9,
- 0x9AFA, 0x9AFD, 0x9AFF, 0x9B00, 0x9B01, 0x9B02, 0x9B03,
-};
-const unsigned short euc_to_utf8_8FEA[] = {
- 0x9B04, 0x9B05, 0x9B08, 0x9B09, 0x9B0B, 0x9B0C, 0x9B0D,
- 0x9B0E, 0x9B10, 0x9B12, 0x9B16, 0x9B19, 0x9B1B, 0x9B1C, 0x9B20,
- 0x9B26, 0x9B2B, 0x9B2D, 0x9B33, 0x9B34, 0x9B35, 0x9B37, 0x9B39,
- 0x9B3A, 0x9B3D, 0x9B48, 0x9B4B, 0x9B4C, 0x9B55, 0x9B56, 0x9B57,
- 0x9B5B, 0x9B5E, 0x9B61, 0x9B63, 0x9B65, 0x9B66, 0x9B68, 0x9B6A,
- 0x9B6B, 0x9B6C, 0x9B6D, 0x9B6E, 0x9B73, 0x9B75, 0x9B77, 0x9B78,
- 0x9B79, 0x9B7F, 0x9B80, 0x9B84, 0x9B85, 0x9B86, 0x9B87, 0x9B89,
- 0x9B8A, 0x9B8B, 0x9B8D, 0x9B8F, 0x9B90, 0x9B94, 0x9B9A, 0x9B9D,
- 0x9B9E, 0x9BA6, 0x9BA7, 0x9BA9, 0x9BAC, 0x9BB0, 0x9BB1, 0x9BB2,
- 0x9BB7, 0x9BB8, 0x9BBB, 0x9BBC, 0x9BBE, 0x9BBF, 0x9BC1, 0x9BC7,
- 0x9BC8, 0x9BCE, 0x9BD0, 0x9BD7, 0x9BD8, 0x9BDD, 0x9BDF, 0x9BE5,
- 0x9BE7, 0x9BEA, 0x9BEB, 0x9BEF, 0x9BF3, 0x9BF7, 0x9BF8,
-};
-const unsigned short euc_to_utf8_8FEB[] = {
- 0x9BF9, 0x9BFA, 0x9BFD, 0x9BFF, 0x9C00, 0x9C02, 0x9C0B,
- 0x9C0F, 0x9C11, 0x9C16, 0x9C18, 0x9C19, 0x9C1A, 0x9C1C, 0x9C1E,
- 0x9C22, 0x9C23, 0x9C26, 0x9C27, 0x9C28, 0x9C29, 0x9C2A, 0x9C31,
- 0x9C35, 0x9C36, 0x9C37, 0x9C3D, 0x9C41, 0x9C43, 0x9C44, 0x9C45,
- 0x9C49, 0x9C4A, 0x9C4E, 0x9C4F, 0x9C50, 0x9C53, 0x9C54, 0x9C56,
- 0x9C58, 0x9C5B, 0x9C5D, 0x9C5E, 0x9C5F, 0x9C63, 0x9C69, 0x9C6A,
- 0x9C5C, 0x9C6B, 0x9C68, 0x9C6E, 0x9C70, 0x9C72, 0x9C75, 0x9C77,
- 0x9C7B, 0x9CE6, 0x9CF2, 0x9CF7, 0x9CF9, 0x9D0B, 0x9D02, 0x9D11,
- 0x9D17, 0x9D18, 0x9D1C, 0x9D1D, 0x9D1E, 0x9D2F, 0x9D30, 0x9D32,
- 0x9D33, 0x9D34, 0x9D3A, 0x9D3C, 0x9D45, 0x9D3D, 0x9D42, 0x9D43,
- 0x9D47, 0x9D4A, 0x9D53, 0x9D54, 0x9D5F, 0x9D63, 0x9D62, 0x9D65,
- 0x9D69, 0x9D6A, 0x9D6B, 0x9D70, 0x9D76, 0x9D77, 0x9D7B,
-};
-const unsigned short euc_to_utf8_8FEC[] = {
- 0x9D7C, 0x9D7E, 0x9D83, 0x9D84, 0x9D86, 0x9D8A, 0x9D8D,
- 0x9D8E, 0x9D92, 0x9D93, 0x9D95, 0x9D96, 0x9D97, 0x9D98, 0x9DA1,
- 0x9DAA, 0x9DAC, 0x9DAE, 0x9DB1, 0x9DB5, 0x9DB9, 0x9DBC, 0x9DBF,
- 0x9DC3, 0x9DC7, 0x9DC9, 0x9DCA, 0x9DD4, 0x9DD5, 0x9DD6, 0x9DD7,
- 0x9DDA, 0x9DDE, 0x9DDF, 0x9DE0, 0x9DE5, 0x9DE7, 0x9DE9, 0x9DEB,
- 0x9DEE, 0x9DF0, 0x9DF3, 0x9DF4, 0x9DFE, 0x9E0A, 0x9E02, 0x9E07,
- 0x9E0E, 0x9E10, 0x9E11, 0x9E12, 0x9E15, 0x9E16, 0x9E19, 0x9E1C,
- 0x9E1D, 0x9E7A, 0x9E7B, 0x9E7C, 0x9E80, 0x9E82, 0x9E83, 0x9E84,
- 0x9E85, 0x9E87, 0x9E8E, 0x9E8F, 0x9E96, 0x9E98, 0x9E9B, 0x9E9E,
- 0x9EA4, 0x9EA8, 0x9EAC, 0x9EAE, 0x9EAF, 0x9EB0, 0x9EB3, 0x9EB4,
- 0x9EB5, 0x9EC6, 0x9EC8, 0x9ECB, 0x9ED5, 0x9EDF, 0x9EE4, 0x9EE7,
- 0x9EEC, 0x9EED, 0x9EEE, 0x9EF0, 0x9EF1, 0x9EF2, 0x9EF5,
-};
-const unsigned short euc_to_utf8_8FED[] = {
- 0x9EF8, 0x9EFF, 0x9F02, 0x9F03, 0x9F09, 0x9F0F, 0x9F10,
- 0x9F11, 0x9F12, 0x9F14, 0x9F16, 0x9F17, 0x9F19, 0x9F1A, 0x9F1B,
- 0x9F1F, 0x9F22, 0x9F26, 0x9F2A, 0x9F2B, 0x9F2F, 0x9F31, 0x9F32,
- 0x9F34, 0x9F37, 0x9F39, 0x9F3A, 0x9F3C, 0x9F3D, 0x9F3F, 0x9F41,
- 0x9F43, 0x9F44, 0x9F45, 0x9F46, 0x9F47, 0x9F53, 0x9F55, 0x9F56,
- 0x9F57, 0x9F58, 0x9F5A, 0x9F5D, 0x9F5E, 0x9F68, 0x9F69, 0x9F6D,
- 0x9F6E, 0x9F6F, 0x9F70, 0x9F71, 0x9F73, 0x9F75, 0x9F7A, 0x9F7D,
- 0x9F8F, 0x9F90, 0x9F91, 0x9F92, 0x9F94, 0x9F96, 0x9F97, 0x9F9E,
- 0x9FA1, 0x9FA2, 0x9FA3, 0x9FA5, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short euc_to_utf8_8FF3[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174,
- 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x2160, 0x2161,
-};
-const unsigned short euc_to_utf8_8FF4[] = {
- 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168,
- 0x2169, 0xff07, 0xff02, 0x3231, 0x2116, 0x2121, 0x70bb, 0x4efc,
- 0x50f4, 0x51ec, 0x5307, 0x5324, 0xfa0e, 0x548a, 0x5759, 0xfa0f,
- 0xfa10, 0x589e, 0x5bec, 0x5cf5, 0x5d53, 0xfa11, 0x5fb7, 0x6085,
- 0x6120, 0x654e, 0x663b, 0x6665, 0xfa12, 0xf929, 0x6801, 0xfa13,
- 0xfa14, 0x6a6b, 0x6ae2, 0x6df8, 0x6df2, 0x7028, 0xfa15, 0xfa16,
- 0x7501, 0x7682, 0x769e, 0xfa17, 0x7930, 0xfa18, 0xfa19, 0xfa1a,
- 0xfa1b, 0x7ae7, 0xfa1c, 0xfa1d, 0x7da0, 0x7dd6, 0xfa1e, 0x8362,
- 0xfa1f, 0x85b0, 0xfa20, 0xfa21, 0x8807, 0xfa22, 0x8b7f, 0x8cf4,
- 0x8d76, 0xfa23, 0xfa24, 0xfa25, 0x90de, 0xfa26, 0x9115, 0xfa27,
- 0xfa28, 0x9592, 0xf9dc, 0xfa29, 0x973b, 0x974d, 0x9751, 0xfa2a,
- 0xfa2b, 0xfa2c, 0x999e, 0x9ad9, 0x9b72, 0xfa2d, 0x9ed1,
-};
-#endif /* X0212_ENABLE */
-
-const unsigned short euc_to_utf8_1byte[] = {
+unsigned short euc_to_utf8_1byte[] = {
0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0xFF66, 0xFF67,
0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F,
0xFF70, 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF76, 0xFF77,
@@ -2293,7 +1294,7 @@ const unsigned short euc_to_utf8_1byte[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x00A9, 0x2122,
};
-const unsigned short *const euc_to_utf8_2bytes[] = {
+unsigned short * euc_to_utf8_2bytes[] = {
euc_to_utf8_A1, euc_to_utf8_A2, euc_to_utf8_A3,
euc_to_utf8_A4, euc_to_utf8_A5, euc_to_utf8_A6, euc_to_utf8_A7,
euc_to_utf8_A8, euc_to_utf8_A9, euc_to_utf8_AA, euc_to_utf8_AB,
@@ -2320,8 +1321,8 @@ const unsigned short *const euc_to_utf8_2bytes[] = {
euc_to_utf8_FC, 0, 0,
};
/* Microsoft UCS Mapping Compatible */
-const unsigned short *const euc_to_utf8_2bytes_ms[] = {
- euc_to_utf8_A1_ms, euc_to_utf8_A2_ms, euc_to_utf8_A3,
+unsigned short * euc_to_utf8_2bytes_ms[] = {
+ euc_to_utf8_A1_ms,euc_to_utf8_A2_ms, euc_to_utf8_A3,
euc_to_utf8_A4, euc_to_utf8_A5, euc_to_utf8_A6, euc_to_utf8_A7,
euc_to_utf8_A8, euc_to_utf8_A9, euc_to_utf8_AA, euc_to_utf8_AB,
euc_to_utf8_AC, euc_to_utf8_AD, euc_to_utf8_AE, euc_to_utf8_AF,
@@ -2344,142 +1345,44 @@ const unsigned short *const euc_to_utf8_2bytes_ms[] = {
euc_to_utf8_F0, euc_to_utf8_F1, euc_to_utf8_F2, euc_to_utf8_F3,
euc_to_utf8_F4, euc_to_utf8_F5, 0, 0,
0, euc_to_utf8_F9, euc_to_utf8_FA, euc_to_utf8_FB,
- euc_to_utf8_FC_ms, 0, 0,
+ euc_to_utf8_FC, 0, 0,
};
-
-#ifdef X0212_ENABLE
-const unsigned short *const x0212_to_utf8_2bytes[] = {
- 0, euc_to_utf8_8FA2, 0,
- 0, 0, euc_to_utf8_8FA6, euc_to_utf8_8FA7,
- 0, euc_to_utf8_8FA9, euc_to_utf8_8FAA, euc_to_utf8_8FAB,
- 0, 0, 0, 0,
- euc_to_utf8_8FB0, euc_to_utf8_8FB1, euc_to_utf8_8FB2, euc_to_utf8_8FB3,
- euc_to_utf8_8FB4, euc_to_utf8_8FB5, euc_to_utf8_8FB6, euc_to_utf8_8FB7,
- euc_to_utf8_8FB8, euc_to_utf8_8FB9, euc_to_utf8_8FBA, euc_to_utf8_8FBB,
- euc_to_utf8_8FBC, euc_to_utf8_8FBD, euc_to_utf8_8FBE, euc_to_utf8_8FBF,
- euc_to_utf8_8FC0, euc_to_utf8_8FC1, euc_to_utf8_8FC2, euc_to_utf8_8FC3,
- euc_to_utf8_8FC4, euc_to_utf8_8FC5, euc_to_utf8_8FC6, euc_to_utf8_8FC7,
- euc_to_utf8_8FC8, euc_to_utf8_8FC9, euc_to_utf8_8FCA, euc_to_utf8_8FCB,
- euc_to_utf8_8FCC, euc_to_utf8_8FCD, euc_to_utf8_8FCE, euc_to_utf8_8FCF,
- euc_to_utf8_8FD0, euc_to_utf8_8FD1, euc_to_utf8_8FD2, euc_to_utf8_8FD3,
- euc_to_utf8_8FD4, euc_to_utf8_8FD5, euc_to_utf8_8FD6, euc_to_utf8_8FD7,
- euc_to_utf8_8FD8, euc_to_utf8_8FD9, euc_to_utf8_8FDA, euc_to_utf8_8FDB,
- euc_to_utf8_8FDC, euc_to_utf8_8FDD, euc_to_utf8_8FDE, euc_to_utf8_8FDF,
- euc_to_utf8_8FE0, euc_to_utf8_8FE1, euc_to_utf8_8FE2, euc_to_utf8_8FE3,
- euc_to_utf8_8FE4, euc_to_utf8_8FE5, euc_to_utf8_8FE6, euc_to_utf8_8FE7,
- euc_to_utf8_8FE8, euc_to_utf8_8FE9, euc_to_utf8_8FEA, euc_to_utf8_8FEB,
- euc_to_utf8_8FEC, euc_to_utf8_8FED, 0, 0,
- 0, 0, 0, euc_to_utf8_8FF3,
- euc_to_utf8_8FF4, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0,};
-#endif /* X0212_ENABLE */
#endif /* UTF8_OUTPUT_ENABLE */
#ifdef UTF8_INPUT_ENABLE
-const unsigned short utf8_to_euc_C2[] = {
+unsigned short utf8_to_euc_C2[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xA242, 0x2171, 0x2172, 0xA270, 0x216F, 0xA243, 0x2178,
- 0x212F, 0xA26D, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234,
+ 0x0E20, 0, 0x2171, 0x2172, 0, 0, 0, 0x2178,
+ 0x212F, 0x0E7D, 0, 0, 0x224C, 0, 0, 0,
0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0,
- 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244,
-};
-const unsigned short utf8_to_euc_C2_ms[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xA242, 0x2171, 0x2172, 0xA270, 0x5C, 0xA243, 0x2178,
- 0x212F, 0xA26D, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234,
- 0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0,
- 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244,
};
-const unsigned short utf8_to_euc_C2_932[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+unsigned short utf8_to_euc_C3[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x21, 0x2171, 0x2172, 0, 0x5C, 0x7C, 0x2178,
- 0x212F, 0x63, 0x61, 0x2263, 0x224C, 0x2D, 0x52, 0x2131,
- 0x216B, 0x215E, 0x32, 0x33, 0x212D, 0x264C, 0x2279, 0x2126,
- 0x2124, 0x31, 0x6F, 0x2264, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_C3[] = {
- 0xAA22, 0xAA21, 0xAA24, 0xAA2A, 0xAA23, 0xAA29, 0xA921, 0xAA2E,
- 0xAA32, 0xAA31, 0xAA34, 0xAA33, 0xAA40, 0xAA3F, 0xAA42, 0xAA41,
- 0, 0xAA50, 0xAA52, 0xAA51, 0xAA54, 0xAA58, 0xAA53, 0x215F,
- 0xA92C, 0xAA63, 0xAA62, 0xAA65, 0xAA64, 0xAA72, 0xA930, 0xA94E,
- 0xAB22, 0xAB21, 0xAB24, 0xAB2A, 0xAB23, 0xAB29, 0xA941, 0xAB2E,
- 0xAB32, 0xAB31, 0xAB34, 0xAB33, 0xAB40, 0xAB3F, 0xAB42, 0xAB41,
- 0xA943, 0xAB50, 0xAB52, 0xAB51, 0xAB54, 0xAB58, 0xAB53, 0x2160,
- 0xA94C, 0xAB63, 0xAB62, 0xAB65, 0xAB64, 0xAB72, 0xA950, 0xAB73,
-};
-const unsigned short utf8_to_euc_C3_932[] = {
- 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43,
- 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49,
- 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x215F,
- 0x4F, 0x55, 0x55, 0x55, 0x55, 0x59, 0x54, 0x73,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x63,
- 0x65, 0x65, 0x65, 0x65, 0x69, 0x69, 0x69, 0x69,
- 0x64, 0x6E, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x2160,
- 0x6F, 0x75, 0x75, 0x75, 0x75, 0x79, 0x74, 0x79,
-};
-const unsigned short utf8_to_euc_C4[] = {
- 0xAA27, 0xAB27, 0xAA25, 0xAB25, 0xAA28, 0xAB28, 0xAA2B, 0xAB2B,
- 0xAA2C, 0xAB2C, 0xAA2F, 0xAB2F, 0xAA2D, 0xAB2D, 0xAA30, 0xAB30,
- 0xA922, 0xA942, 0xAA37, 0xAB37, 0, 0, 0xAA36, 0xAB36,
- 0xAA38, 0xAB38, 0xAA35, 0xAB35, 0xAA3A, 0xAB3A, 0xAA3B, 0xAB3B,
- 0xAA3D, 0xAB3D, 0xAA3C, 0, 0xAA3E, 0xAB3E, 0xA924, 0xA944,
- 0xAA47, 0xAB47, 0xAA45, 0xAB45, 0, 0, 0xAA46, 0xAB46,
- 0xAA44, 0xA945, 0xA926, 0xA946, 0xAA48, 0xAB48, 0xAA49, 0xAB49,
- 0xA947, 0xAA4A, 0xAB4A, 0xAA4C, 0xAB4C, 0xAA4B, 0xAB4B, 0xA929,
-};
-const unsigned short utf8_to_euc_C5[] = {
- 0xA949, 0xA928, 0xA948, 0xAA4D, 0xAB4D, 0xAA4F, 0xAB4F, 0xAA4E,
- 0xAB4E, 0xA94A, 0xA92B, 0xA94B, 0xAA57, 0xAB57, 0, 0,
- 0xAA56, 0xAB56, 0xA92D, 0xA94D, 0xAA59, 0xAB59, 0xAA5B, 0xAB5B,
- 0xAA5A, 0xAB5A, 0xAA5C, 0xAB5C, 0xAA5D, 0xAB5D, 0xAA5F, 0xAB5F,
- 0xAA5E, 0xAB5E, 0xAA61, 0xAB61, 0xAA60, 0xAB60, 0xA92F, 0xA94F,
- 0xAA6C, 0xAB6C, 0xAA69, 0xAB69, 0xAA66, 0xAB66, 0xAA6B, 0xAB6B,
- 0xAA68, 0xAB68, 0xAA6A, 0xAB6A, 0xAA71, 0xAB71, 0xAA74, 0xAB74,
- 0xAA73, 0xAA75, 0xAB75, 0xAA77, 0xAB77, 0xAA76, 0xAB76, 0,
-};
-const unsigned short utf8_to_euc_C7[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x215F,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xAA26, 0xAB26, 0xAA43,
- 0xAB43, 0xAA55, 0xAB55, 0xAA67, 0xAB67, 0xAA70, 0xAB70, 0xAA6D,
- 0xAB6D, 0xAA6F, 0xAB6F, 0xAA6E, 0xAB6E, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xAB39, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x2160,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_CB[] = {
- 0, 0, 0, 0, 0, 0, 0, 0xA230,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xA22F, 0xA232, 0xA236, 0xA235, 0, 0xA233, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+unsigned short utf8_to_euc_CE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_CE[] = {
- 0, 0, 0, 0, 0xA238, 0xA239, 0xA661, 0,
- 0xA662, 0xA663, 0xA664, 0, 0xA667, 0, 0xA669, 0xA66C,
- 0xA676, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627,
+ 0, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627,
0x2628, 0x2629, 0x262A, 0x262B, 0x262C, 0x262D, 0x262E, 0x262F,
0x2630, 0x2631, 0, 0x2632, 0x2633, 0x2634, 0x2635, 0x2636,
- 0x2637, 0x2638, 0xA665, 0xA66A, 0xA671, 0xA672, 0xA673, 0xA674,
- 0xA67B, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647,
+ 0x2637, 0x2638, 0, 0, 0, 0, 0, 0,
+ 0, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647,
0x2648, 0x2649, 0x264A, 0x264B, 0x264C, 0x264D, 0x264E, 0x264F,
};
-const unsigned short utf8_to_euc_CF[] = {
- 0x2650, 0x2651, 0xA678, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656,
- 0x2657, 0x2658, 0xA675, 0xA67A, 0xA677, 0xA679, 0xA67C, 0,
+unsigned short utf8_to_euc_CF[] = {
+ 0x2650, 0x2651, 0, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656,
+ 0x2657, 0x2658, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2487,9 +1390,9 @@ const unsigned short utf8_to_euc_CF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_D0[] = {
- 0, 0x2727, 0xA742, 0xA743, 0xA744, 0xA745, 0xA746, 0xA747,
- 0xA748, 0xA749, 0xA74A, 0xA74B, 0xA74C, 0, 0xA74D, 0xA74E,
+unsigned short utf8_to_euc_D0[] = {
+ 0, 0x2727, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2728, 0x2729,
0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, 0x2730, 0x2731,
0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739,
@@ -2497,27 +1400,17 @@ const unsigned short utf8_to_euc_D0[] = {
0x2751, 0x2752, 0x2753, 0x2754, 0x2755, 0x2756, 0x2758, 0x2759,
0x275A, 0x275B, 0x275C, 0x275D, 0x275E, 0x275F, 0x2760, 0x2761,
};
-const unsigned short utf8_to_euc_D1[] = {
+unsigned short utf8_to_euc_D1[] = {
0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2768, 0x2769,
0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, 0x2770, 0x2771,
- 0, 0x2757, 0xA772, 0xA773, 0xA774, 0xA775, 0xA776, 0xA777,
- 0xA778, 0xA779, 0xA77A, 0xA77B, 0xA77C, 0, 0xA77D, 0xA77E,
+ 0, 0x2757, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E280[] = {
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0x213E, 0, 0, 0, 0x213D, 0x213D, 0x2142, 0,
- 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0,
- 0x2277, 0x2278, 0, 0, 0, 0x2145, 0x2144, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
- 0, 0, 0, 0x2228, 0, 0, 0x2131, 0,
};
-const unsigned short utf8_to_euc_E280_ms[] = {
+unsigned short utf8_to_euc_E280[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x213E, 0, 0, 0, 0x213D, 0x213D, 0x2142, 0,
@@ -2525,39 +1418,29 @@ const unsigned short utf8_to_euc_E280_ms[] = {
0x2277, 0x2278, 0, 0, 0, 0x2145, 0x2144, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
- 0, 0, 0, 0x2228, 0, 0, 0x7E, 0,
-};
-const unsigned short utf8_to_euc_E280_932[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0x213E, 0, 0, 0, 0, 0x213D, 0, 0,
- 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0,
- 0x2277, 0x2278, 0, 0, 0, 0x2145, 0x2144, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
0, 0, 0, 0x2228, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E284[] = {
+unsigned short utf8_to_euc_E284[] = {
0, 0, 0, 0x216E, 0, 0, 0, 0,
+ 0, 0x2B37, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x2B31, 0, 0, 0x2D62, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0x2D62, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x2D64, 0xA26F, 0, 0, 0, 0, 0,
+ 0, 0x2D64, 0x0E7E, 0, 0, 0, 0, 0,
0, 0, 0, 0x2272, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E285[] = {
+unsigned short utf8_to_euc_E285[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x2D35, 0x2D36, 0x2D37, 0x2D38, 0x2D39, 0x2D3A, 0x2D3B, 0x2D3C,
- 0x2D3D, 0x2D3E, 0, 0, 0, 0, 0, 0,
- 0xF373, 0xF374, 0xF375, 0xF376, 0xF377, 0xF378, 0xF379, 0xF37A,
- 0xF37B, 0xF37C, 0, 0, 0, 0, 0, 0,
+ 0x2D3D, 0x2D3E, 0x2A2B, 0x2A2C, 0, 0, 0, 0,
+ 0x7C71, 0x7C72, 0x7C73, 0x7C74, 0x7C75, 0x7C76, 0x7C77, 0x7C78,
+ 0x7C79, 0x7C7A, 0x2A3F, 0x2A40, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E286[] = {
+unsigned short utf8_to_euc_E286[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x222B, 0x222C, 0x222A, 0x222D, 0, 0, 0, 0,
@@ -2567,17 +1450,17 @@ const unsigned short utf8_to_euc_E286[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E287[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
+unsigned short utf8_to_euc_E287[] = {
+ 0, 0, 0, 0, 0x2C4E, 0x2C4F, 0x2C4D, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x224D, 0, 0x224E, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2C52, 0x2C53,
+ 0x2C51, 0x2C54, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E288[] = {
+unsigned short utf8_to_euc_E288[] = {
0x224F, 0, 0x225F, 0x2250, 0, 0, 0, 0x2260,
0x223A, 0, 0, 0x223B, 0, 0, 0, 0,
0, 0x2D74, 0x215D, 0, 0, 0, 0, 0,
@@ -2587,17 +1470,7 @@ const unsigned short utf8_to_euc_E288[] = {
0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
0, 0, 0, 0, 0, 0x2266, 0, 0,
};
-const unsigned short utf8_to_euc_E288_932[] = {
- 0x224F, 0, 0x225F, 0x2250, 0, 0, 0, 0x2260,
- 0x223A, 0, 0, 0x223B, 0, 0, 0, 0,
- 0, 0x2D74, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x2265, 0, 0, 0x2267, 0x2167, 0x2D78,
- 0x225C, 0, 0, 0, 0, 0x2142, 0, 0x224A,
- 0x224B, 0x2241, 0x2240, 0x2269, 0x226A, 0, 0x2D73, 0,
- 0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
- 0, 0, 0, 0, 0, 0x2266, 0, 0,
-};
-const unsigned short utf8_to_euc_E289[] = {
+unsigned short utf8_to_euc_E289[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x2262, 0, 0, 0, 0, 0,
@@ -2607,7 +1480,7 @@ const unsigned short utf8_to_euc_E289[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E28A[] = {
+unsigned short utf8_to_euc_E28A[] = {
0, 0, 0x223E, 0x223F, 0, 0, 0x223C, 0x223D,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2617,7 +1490,7 @@ const unsigned short utf8_to_euc_E28A[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x2D79,
};
-const unsigned short utf8_to_euc_E28C[] = {
+unsigned short utf8_to_euc_E28C[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x225E, 0, 0, 0, 0, 0,
@@ -2627,17 +1500,27 @@ const unsigned short utf8_to_euc_E28C[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E291[] = {
+unsigned short utf8_to_euc_E291[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x2D21, 0x2D22, 0x2D23, 0x2D24, 0x2D25, 0x2D26, 0x2D27, 0x2D28,
0x2D29, 0x2D2A, 0x2D2B, 0x2D2C, 0x2D2D, 0x2D2E, 0x2D2F, 0x2D30,
- 0x2D31, 0x2D32, 0x2D33, 0x2D34, 0, 0, 0, 0,
+ 0x2D31, 0x2D32, 0x2D33, 0x2D34, 0x293F, 0x2940, 0x2941, 0x2942,
+ 0x2943, 0x2944, 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, 0x294A,
+};
+unsigned short utf8_to_euc_E292[] = {
+ 0x294B, 0x294C, 0x294D, 0x294E, 0x294F, 0x2950, 0x2951, 0x2952,
+ 0x2972, 0x2973, 0x2974, 0x2975, 0x2976, 0x2977, 0x2978, 0x2979,
+ 0x297A, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x2A5D, 0x2A5E, 0x2A5F, 0x2A60,
+ 0x2A61, 0x2A62, 0x2A63, 0x2A64, 0x2A65, 0x2A66, 0x2A67, 0x2A68,
+ 0x2A69, 0x2A6A, 0x2A6B, 0x2A6C, 0x2A6D, 0x2A6E, 0x2A6F, 0x2A70,
+ 0x2A71, 0x2A72, 0x2A73, 0x2A74, 0x2A75, 0x2A76, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E294[] = {
+unsigned short utf8_to_euc_E294[] = {
0x2821, 0x282C, 0x2822, 0x282D, 0, 0, 0, 0,
0, 0, 0, 0, 0x2823, 0, 0, 0x282E,
0x2824, 0, 0, 0x282F, 0x2826, 0, 0, 0x2831,
@@ -2647,7 +1530,7 @@ const unsigned short utf8_to_euc_E294[] = {
0x283D, 0, 0, 0x2833, 0x282A, 0, 0, 0x283A,
0x283F, 0, 0, 0x2835, 0x282B, 0, 0, 0x283B,
};
-const unsigned short utf8_to_euc_E295[] = {
+unsigned short utf8_to_euc_E295[] = {
0, 0, 0x2840, 0, 0, 0, 0, 0,
0, 0, 0, 0x2836, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2657,7 +1540,7 @@ const unsigned short utf8_to_euc_E295[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E296[] = {
+unsigned short utf8_to_euc_E296[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2667,7 +1550,7 @@ const unsigned short utf8_to_euc_E296[] = {
0, 0, 0x2225, 0x2224, 0, 0, 0, 0,
0, 0, 0, 0, 0x2227, 0x2226, 0, 0,
};
-const unsigned short utf8_to_euc_E297[] = {
+unsigned short utf8_to_euc_E297[] = {
0, 0, 0, 0, 0, 0, 0x2221, 0x217E,
0, 0, 0, 0x217B, 0, 0, 0x217D, 0x217C,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -2677,47 +1560,47 @@ const unsigned short utf8_to_euc_E297[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E298[] = {
+unsigned short utf8_to_euc_E298[] = {
0, 0, 0, 0, 0, 0x217A, 0x2179, 0,
+ 0, 0, 0, 0, 0, 0, 0x2C36, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x2C4A, 0x2C4B, 0x2C49, 0x2C4C,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E299[] = {
+unsigned short utf8_to_euc_E299[] = {
0x216A, 0, 0x2169, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2C25, 0x2C23, 0x2C24, 0x2C26, 0x2C21, 0x2C27, 0x2C28, 0x2C22,
0, 0, 0x2276, 0, 0, 0x2275, 0, 0x2274,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E380[] = {
- 0x2121, 0x2122, 0x2123, 0x2137, 0, 0x2139, 0x213A, 0x213B,
- 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159,
- 0x215A, 0x215B, 0x2229, 0x222E, 0x214C, 0x214D, 0, 0,
- 0, 0, 0, 0, 0x2141, 0x2D60, 0, 0x2D61,
+unsigned short utf8_to_euc_E29D[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x295D, 0x295E,
+ 0x295F, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965, 0,
};
-const unsigned short utf8_to_euc_E380_932[] = {
- 0x2121, 0x2122, 0x2123, 0x2137, 0, 0x2139, 0x213A, 0x213B,
+unsigned short utf8_to_euc_E380[] = {
+ 0x2121, 0x2122, 0x2123, 0x2137, 0x2C37, 0x2139, 0x213A, 0x213B,
0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159,
0x215A, 0x215B, 0x2229, 0x222E, 0x214C, 0x214D, 0, 0,
- 0, 0, 0, 0, 0, 0x2D60, 0, 0x2D61,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x2141, 0x2D60, 0, 0x2D61,
+ 0x2C35, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E381[] = {
+unsigned short utf8_to_euc_E381[] = {
0, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427,
0x2428, 0x2429, 0x242A, 0x242B, 0x242C, 0x242D, 0x242E, 0x242F,
0x2430, 0x2431, 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437,
@@ -2727,2047 +1610,2047 @@ const unsigned short utf8_to_euc_E381[] = {
0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457,
0x2458, 0x2459, 0x245A, 0x245B, 0x245C, 0x245D, 0x245E, 0x245F,
};
-const unsigned short utf8_to_euc_E382[] = {
- 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
- 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F,
- 0x2470, 0x2471, 0x2472, 0x2473, 0, 0, 0, 0,
- 0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0,
- 0, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
- 0x2528, 0x2529, 0x252A, 0x252B, 0x252C, 0x252D, 0x252E, 0x252F,
- 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
- 0x2538, 0x2539, 0x253A, 0x253B, 0x253C, 0x253D, 0x253E, 0x253F,
-};
-const unsigned short utf8_to_euc_E382_932[] = {
+unsigned short utf8_to_euc_E382[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F,
- 0x2470, 0x2471, 0x2472, 0x2473, 0x2574, 0, 0, 0,
- 0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0,
+ 0x2470, 0x2471, 0x2472, 0x2473, 0x2F49, 0, 0, 0,
+ 0, 0x0E5E, 0x0E5F, 0x212B, 0x212C, 0x2135, 0x2136, 0,
0, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
0x2528, 0x2529, 0x252A, 0x252B, 0x252C, 0x252D, 0x252E, 0x252F,
0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
0x2538, 0x2539, 0x253A, 0x253B, 0x253C, 0x253D, 0x253E, 0x253F,
};
-const unsigned short utf8_to_euc_E383[] = {
+unsigned short utf8_to_euc_E383[] = {
0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547,
0x2548, 0x2549, 0x254A, 0x254B, 0x254C, 0x254D, 0x254E, 0x254F,
0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557,
0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, 0x255F,
0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567,
0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x256D, 0x256E, 0x256F,
- 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0,
- 0, 0, 0, 0x2126, 0x213C, 0x2133, 0x2134, 0,
+ 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2F4B,
+ 0x2F4C, 0x2F4D, 0x2F4E, 0x2126, 0x213C, 0x2133, 0x2134, 0,
};
-const unsigned short utf8_to_euc_E388[] = {
+unsigned short utf8_to_euc_E388[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x2D6A, 0x2D6B, 0, 0, 0, 0, 0,
- 0, 0x2D6C, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x2D22, 0x2D23, 0x2D24, 0x2D25, 0x2D26, 0x2D27,
+ 0x2D21, 0x2D6A, 0x2D6B, 0x2D34, 0x2D30, 0x2D35, 0x2D33, 0x2D29,
+ 0x2D39, 0x2D6C, 0x2D2D, 0x2D32, 0x2D36, 0x2D37, 0x2D2F, 0x2D38,
};
-const unsigned short utf8_to_euc_E38A[] = {
+unsigned short utf8_to_euc_E389[] = {
+ 0x2D28, 0, 0x2D2A, 0x2D2B, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E38A[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2D79, 0,
+ 0x2D7B, 0x2D7E, 0, 0, 0, 0x2D7A, 0x2D7C, 0,
0, 0, 0, 0, 0x2D65, 0x2D66, 0x2D67, 0x2D68,
- 0x2D69, 0, 0, 0, 0, 0, 0, 0,
+ 0x2D69, 0x2D78, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E38C[] = {
- 0, 0, 0, 0x2D46, 0, 0, 0, 0,
+unsigned short utf8_to_euc_E38C[] = {
+ 0x2E3F, 0, 0, 0x2D46, 0, 0x2E26, 0, 0,
0, 0, 0, 0, 0, 0x2D4A, 0, 0,
- 0, 0, 0, 0, 0x2D41, 0, 0, 0,
- 0x2D44, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x2D41, 0x2E2C, 0x2E25, 0,
+ 0x2D44, 0, 0, 0, 0, 0, 0x2E40, 0,
0, 0, 0x2D42, 0x2D4C, 0, 0, 0x2D4B, 0x2D45,
- 0, 0, 0, 0x2D4D, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0x2D47, 0,
- 0, 0, 0, 0x2D4F, 0, 0, 0, 0,
+ 0, 0, 0x2E41, 0x2D4D, 0, 0, 0, 0,
+ 0, 0x2E42, 0, 0x2E27, 0, 0, 0x2D47, 0,
+ 0, 0x2E30, 0, 0x2D4F, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E38D[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x2D40, 0x2D4E, 0, 0, 0x2D43, 0, 0,
+unsigned short utf8_to_euc_E38D[] = {
+ 0, 0, 0x2E33, 0, 0, 0, 0, 0x2E43,
+ 0, 0x2D40, 0x2D4E, 0, 0, 0x2D43, 0x2E28, 0,
0, 0x2D48, 0, 0, 0, 0, 0, 0x2D49,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x2D5F, 0x2D6F, 0x2D6E, 0x2D6D, 0,
+ 0, 0, 0, 0x2D5F, 0x2D6F, 0x2D6E, 0x2D6D, 0x2E7C,
};
-const unsigned short utf8_to_euc_E38E[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
+unsigned short utf8_to_euc_E38E[] = {
+ 0, 0, 0, 0, 0, 0x2B3B, 0x2B3C, 0x2B3D,
0, 0, 0, 0, 0, 0, 0x2D53, 0x2D54,
+ 0x2B3A, 0, 0, 0, 0, 0, 0x2B2F, 0x2B30,
+ 0x2B32, 0, 0, 0, 0x2D50, 0x2D51, 0x2D52, 0x2B22,
+ 0x2B24, 0x2D56, 0x2B2A, 0, 0x2B25, 0x2B28, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0x2D50, 0x2D51, 0x2D52, 0,
- 0, 0x2D56, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2B36, 0x2B35, 0x2B34, 0x2B33, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E38F[] = {
+unsigned short utf8_to_euc_E38F[] = {
0, 0, 0, 0, 0x2D55, 0, 0, 0,
- 0, 0, 0, 0, 0, 0x2D63, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x2B39, 0, 0x2D63, 0, 0,
+ 0, 0, 0, 0, 0x2B38, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E4B8[] = {
- 0x306C, 0x437A, 0xB021, 0x3C37, 0xB022, 0xB023, 0, 0x4B7C,
- 0x3E66, 0x3B30, 0x3E65, 0x323C, 0xB024, 0x4954, 0x4D3F, 0,
- 0x5022, 0x312F, 0xB025, 0, 0x336E, 0x5023, 0x4024, 0x5242,
- 0x3556, 0x4A3A, 0, 0, 0, 0, 0x3E67, 0xB026,
- 0, 0x4E3E, 0, 0xB027, 0xB028, 0, 0x4A42, 0,
- 0xB029, 0, 0x5024, 0xB02A, 0, 0x4366, 0xB02B, 0xB02C,
- 0xB02D, 0x5025, 0x367A, 0, 0, 0xB02E, 0x5026, 0,
+unsigned short utf8_to_euc_E4B8[] = {
+ 0x306C, 0x437A, 0, 0x3C37, 0, 0, 0, 0x4B7C,
+ 0x3E66, 0x3B30, 0x3E65, 0x323C, 0, 0x4954, 0x4D3F, 0,
+ 0x5022, 0x312F, 0, 0, 0x336E, 0x5023, 0x4024, 0x5242,
+ 0x3556, 0x4A3A, 0, 0, 0, 0, 0x3E67, 0,
+ 0, 0x4E3E, 0, 0, 0, 0, 0x4A42, 0,
+ 0x792D, 0, 0x5024, 0, 0, 0x4366, 0, 0,
+ 0, 0x5025, 0x367A, 0, 0, 0, 0x5026, 0,
0x345D, 0x4330, 0, 0x3C67, 0x5027, 0, 0, 0x5028,
};
-const unsigned short utf8_to_euc_E4B9[] = {
- 0xB02F, 0xB030, 0x5029, 0x4735, 0xB031, 0x3557, 0, 0xB032,
+unsigned short utf8_to_euc_E4B9[] = {
+ 0, 0, 0x5029, 0x4735, 0, 0x3557, 0, 0,
0, 0, 0, 0x4737, 0, 0x4663, 0x3843, 0x4B33,
- 0, 0xB033, 0, 0, 0, 0x6949, 0x502A, 0x3E68,
- 0x502B, 0x3235, 0xB034, 0, 0xB035, 0x3665, 0x3870, 0x4C69,
- 0, 0, 0x5626, 0xB036, 0, 0, 0, 0,
- 0xB037, 0xB038, 0, 0, 0, 0, 0, 0,
- 0, 0x4D70, 0, 0x467D, 0xB039, 0xB03A, 0, 0,
- 0, 0xB03B, 0, 0, 0, 0, 0x3425, 0xB03C,
-};
-const unsigned short utf8_to_euc_E4BA[] = {
+ 0, 0, 0, 0, 0, 0x6949, 0x502A, 0x3E68,
+ 0x502B, 0x3235, 0, 0, 0, 0x3665, 0x3870, 0x4C69,
+ 0, 0, 0x5626, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x4D70, 0, 0x467D, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3425, 0,
+};
+unsigned short utf8_to_euc_E4BA[] = {
0x3535, 0, 0x502C, 0, 0, 0x502D, 0x4E3B, 0,
- 0x4D3D, 0x4168, 0x502F, 0x3B76, 0x4673, 0xB03D, 0x5032, 0,
- 0, 0x313E, 0x385F, 0, 0x385E, 0x3066, 0xB03E, 0xB03F,
- 0x4F4B, 0x4F4A, 0, 0x3A33, 0x3021, 0xB040, 0x5033, 0x5034,
+ 0x4D3D, 0x4168, 0x502F, 0x3B76, 0x4673, 0, 0x5032, 0,
+ 0, 0x313E, 0x385F, 0, 0x385E, 0x3066, 0, 0,
+ 0x4F4B, 0x4F4A, 0, 0x3A33, 0x3021, 0, 0x5033, 0x5034,
0x5035, 0x4B34, 0x5036, 0, 0x3872, 0x3067, 0x4B72, 0,
- 0x357C, 0, 0, 0x357D, 0x357E, 0x4462, 0x4E3C, 0xB041,
+ 0x357C, 0, 0, 0x357D, 0x357E, 0x4462, 0x4E3C, 0,
0x5037, 0, 0, 0x5038, 0, 0, 0x5039, 0,
- 0, 0xB042, 0x3F4D, 0, 0, 0, 0, 0,
+ 0, 0, 0x3F4D, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E4BB[] = {
- 0x3D3A, 0x3F4E, 0x503E, 0xB043, 0x503C, 0, 0x503D, 0x3558,
+unsigned short utf8_to_euc_E4BB[] = {
+ 0x3D3A, 0x3F4E, 0x503E, 0, 0x503C, 0, 0x503D, 0x3558,
0, 0, 0x3A23, 0x3270, 0, 0x503B, 0x503A, 0x4A29,
- 0xB044, 0, 0, 0, 0x3B46, 0x3B45, 0x423E, 0x503F,
- 0x4955, 0x4067, 0xB045, 0xB046, 0, 0x2138, 0x5040, 0x5042,
- 0xB047, 0xB048, 0xB049, 0x4265, 0x4E61, 0x304A, 0, 0,
- 0xB04A, 0, 0, 0, 0, 0x5041, 0x323E, 0xB04B,
- 0x3644, 0xB04C, 0x4367, 0xB04D, 0, 0xB04E, 0x376F, 0x5043,
- 0, 0, 0, 0x4724, 0xF42F, 0xB04F, 0xB050, 0xB051,
-};
-const unsigned short utf8_to_euc_E4BC[] = {
- 0xB052, 0x346B, 0xB053, 0xB054, 0, 0, 0, 0,
- 0xB055, 0x5044, 0x304B, 0xB056, 0xB057, 0x3860, 0x346C, 0x497A,
- 0x4832, 0x3559, 0xB058, 0, 0, 0xB059, 0xB05A, 0xB05B,
- 0, 0xB05C, 0x3271, 0, 0x5067, 0x4541, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xB05D, 0x476C,
- 0x5046, 0xB05E, 0, 0xB060, 0x483C, 0xB061, 0x4E62, 0xB062,
- 0x3F2D, 0xB063, 0x3B47, 0xB064, 0x3B77, 0x3240, 0xB065, 0,
-};
-const unsigned short utf8_to_euc_E4BD[] = {
- 0xB066, 0, 0xB067, 0x4451, 0, 0, 0x4322, 0x504A,
- 0xB068, 0xB069, 0, 0xB06A, 0xB06B, 0x304C, 0x4463, 0x3D3B,
- 0x3A34, 0x4D24, 0xB06C, 0x424E, 0xB06D, 0x323F, 0xB06E, 0x5049,
- 0xB06F, 0x4D3E, 0x5045, 0x5047, 0x3A6E, 0x5048, 0x5524, 0xB070,
- 0xB05F, 0, 0, 0xB071, 0, 0, 0, 0,
- 0, 0x5050, 0xB072, 0, 0xB073, 0, 0xB074, 0x5053,
- 0x5051, 0xB075, 0, 0x3242, 0, 0x4A3B, 0x504B, 0xB076,
- 0xB077, 0xB078, 0xB079, 0x504F, 0x3873, 0xB07A, 0xB07B, 0x3B48,
-};
-const unsigned short utf8_to_euc_E4BE[] = {
- 0, 0xB07C, 0xB07D, 0x3426, 0xB07E, 0xB121, 0x5054, 0,
- 0x504C, 0xB122, 0xB123, 0x4E63, 0xB124, 0x3B78, 0xB125, 0x504D,
- 0xB126, 0x5052, 0xB127, 0xB128, 0xB129, 0, 0x5055, 0xB12A,
- 0x504E, 0xB12B, 0xB12C, 0x3621, 0, 0x304D, 0xB12D, 0xB12E,
+ 0, 0, 0, 0, 0x3B46, 0x3B45, 0x423E, 0x503F,
+ 0x4955, 0x4067, 0, 0, 0, 0x2138, 0x5040, 0x5042,
+ 0, 0x792E, 0, 0x4265, 0x4E61, 0x304A, 0, 0,
+ 0, 0, 0, 0, 0, 0x5041, 0x323E, 0,
+ 0x3644, 0, 0x4367, 0, 0, 0, 0x376F, 0x5043,
+ 0, 0, 0, 0x4724, 0x792F, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E4BC[] = {
+ 0x7930, 0x346B, 0, 0x7931, 0, 0, 0, 0,
+ 0, 0x5044, 0x304B, 0, 0, 0x3860, 0x346C, 0x497A,
+ 0x4832, 0x3559, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3271, 0, 0x5067, 0x4541, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x476C,
+ 0x5046, 0, 0, 0, 0x483C, 0, 0x4E62, 0,
+ 0x3F2D, 0x7932, 0x3B47, 0, 0x3B77, 0x3240, 0, 0,
+};
+unsigned short utf8_to_euc_E4BD[] = {
+ 0, 0, 0, 0x4451, 0, 0, 0x4322, 0x504A,
+ 0, 0, 0, 0, 0, 0x304C, 0x4463, 0x3D3B,
+ 0x3A34, 0x4D24, 0, 0x424E, 0, 0x323F, 0x7933, 0x5049,
+ 0, 0x4D3E, 0x5045, 0x5047, 0x3A6E, 0x5048, 0x5524, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x5050, 0, 0, 0, 0, 0, 0x5053,
+ 0x5051, 0, 0, 0x3242, 0, 0x4A3B, 0x504B, 0,
+ 0, 0, 0, 0x504F, 0x3873, 0, 0, 0x3B48,
+};
+unsigned short utf8_to_euc_E4BE[] = {
+ 0, 0, 0, 0x3426, 0, 0, 0x5054, 0,
+ 0x504C, 0, 0x7935, 0x4E63, 0, 0x3B78, 0, 0x504D,
+ 0, 0x5052, 0x7934, 0, 0x7937, 0, 0x5055, 0,
+ 0x504E, 0, 0x7936, 0x3621, 0, 0x304D, 0, 0,
0x3622, 0x3241, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x5525, 0, 0x4B79, 0x496E, 0x3874,
- 0, 0, 0xB12F, 0, 0, 0x3F2F, 0x4E37, 0xB130,
- 0, 0xB131, 0, 0xB132, 0xB133, 0xB134, 0xB135, 0x4A58,
-};
-const unsigned short utf8_to_euc_E4BF[] = {
- 0xB136, 0xB137, 0x3738, 0x4225, 0x3264, 0xB138, 0xB139, 0,
- 0xB13A, 0xB13B, 0x3D53, 0xB13C, 0xB13D, 0xB13E, 0x5059, 0xB13F,
- 0x505E, 0x505C, 0xB140, 0, 0x5057, 0, 0, 0x422F,
- 0x505A, 0, 0x505D, 0x505B, 0xB141, 0x4A5D, 0, 0x5058,
- 0xB142, 0x3F2E, 0xB143, 0x4B73, 0x505F, 0x5060, 0, 0,
+ 0, 0, 0, 0, 0, 0x3F2F, 0x4E37, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4A58,
+};
+unsigned short utf8_to_euc_E4BF[] = {
+ 0, 0, 0x3738, 0x4225, 0x3264, 0, 0, 0,
+ 0, 0x7926, 0x3D53, 0, 0, 0x7938, 0x5059, 0,
+ 0x505E, 0x505C, 0, 0, 0x5057, 0, 0, 0x422F,
+ 0x505A, 0, 0x505D, 0x505B, 0, 0x4A5D, 0, 0x5058,
+ 0, 0x3F2E, 0, 0x4B73, 0x505F, 0x5060, 0, 0,
0, 0, 0, 0, 0, 0, 0x3D24, 0x506D,
- 0xB144, 0, 0xB145, 0x4750, 0, 0x4936, 0x5068, 0,
- 0x4A70, 0, 0x3236, 0, 0xB146, 0xB147, 0x506C, 0xB148,
-};
-const unsigned short utf8_to_euc_E580[] = {
- 0xB149, 0xB14A, 0, 0, 0xB14B, 0x5066, 0x506F, 0xB14C,
- 0, 0x4152, 0xB14D, 0x3844, 0xB14E, 0x475C, 0xB14F, 0x6047,
- 0xB150, 0x506E, 0x455D, 0xB151, 0x5063, 0, 0x3876, 0xB152,
- 0xB153, 0x3875, 0x5061, 0xB154, 0xB155, 0xB156, 0xB157, 0x3C5A,
- 0, 0x5069, 0xB158, 0x4A6F, 0x434D, 0x5065, 0x3771, 0xB159,
- 0x5062, 0x506A, 0x5064, 0x4E51, 0x506B, 0x4F41, 0xB15A, 0,
- 0xB15B, 0, 0xB15C, 0xB15D, 0, 0xB15E, 0x3666, 0,
- 0, 0x3770, 0, 0xB176, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E581[] = {
- 0xB15F, 0xB160, 0xB161, 0x5070, 0, 0xB162, 0xB163, 0x5071,
- 0x5075, 0x304E, 0xB164, 0, 0xB165, 0, 0xB166, 0x4A50,
- 0x5074, 0xB167, 0xB168, 0xB169, 0, 0x5073, 0x5077, 0xB16A,
- 0, 0xB16B, 0x5076, 0, 0x4464, 0, 0, 0xB16C,
- 0xB16D, 0, 0xB16E, 0xB16F, 0, 0x3772, 0xB170, 0xB171,
- 0, 0, 0xB172, 0, 0x5078, 0xB173, 0, 0,
- 0xB174, 0xB175, 0x3C45, 0, 0x4226, 0x4465, 0x3676, 0,
+ 0, 0, 0, 0x4750, 0, 0x4936, 0x5068, 0,
+ 0x4A70, 0, 0x3236, 0, 0, 0, 0x506C, 0x793B,
+};
+unsigned short utf8_to_euc_E580[] = {
+ 0, 0, 0, 0, 0, 0x5066, 0x506F, 0,
+ 0, 0x4152, 0, 0x3844, 0, 0x475C, 0, 0x6047,
+ 0, 0x506E, 0x455D, 0, 0x5063, 0, 0x3876, 0,
+ 0, 0x3875, 0x5061, 0, 0, 0, 0x793C, 0x3C5A,
+ 0, 0x5069, 0x793A, 0x4A6F, 0x434D, 0x5065, 0x3771, 0,
+ 0x5062, 0x506A, 0x5064, 0x4E51, 0x506B, 0x4F41, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3666, 0,
+ 0, 0x3770, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E581[] = {
+ 0x7939, 0, 0x793F, 0x5070, 0, 0, 0x793D, 0x5071,
+ 0x5075, 0x304E, 0, 0, 0, 0, 0, 0x4A50,
+ 0x5074, 0, 0, 0, 0, 0x5073, 0x5077, 0,
+ 0, 0, 0x5076, 0, 0x4464, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x3772, 0, 0,
+ 0, 0, 0, 0, 0x5078, 0, 0, 0,
+ 0x793E, 0, 0x3C45, 0, 0x4226, 0x4465, 0x3676, 0,
0x5079, 0, 0, 0, 0, 0x3536, 0, 0,
};
-const unsigned short utf8_to_euc_E582[] = {
- 0x507A, 0xB177, 0, 0xB178, 0xB179, 0x507C, 0xB17A, 0,
- 0, 0, 0xB17B, 0, 0, 0x4B35, 0xB17C, 0xB17D,
- 0xB17E, 0x3766, 0xB221, 0xB222, 0xB223, 0, 0xB224, 0,
- 0x3B31, 0x4877, 0x507B, 0xB225, 0xB226, 0, 0xB227, 0xB228,
- 0xB229, 0xB22A, 0xB22B, 0, 0, 0, 0, 0,
- 0, 0, 0xB22C, 0, 0x3A45, 0x4D43, 0, 0xB22D,
- 0xB22E, 0, 0x507E, 0x5123, 0x507D, 0x3A44, 0, 0x3D7D,
- 0, 0xB22F, 0xB230, 0, 0, 0xB231, 0x3739, 0,
-};
-const unsigned short utf8_to_euc_E583[] = {
- 0xB232, 0, 0x5124, 0xB233, 0xB234, 0x364F, 0, 0xB235,
- 0, 0x5121, 0x5122, 0, 0xB236, 0x462F, 0xB237, 0x417C,
- 0xB238, 0x3623, 0, 0xB239, 0xB23A, 0x4B4D, 0x5125, 0,
- 0xB23B, 0, 0x4E3D, 0, 0xB23C, 0xB23D, 0x5126, 0xB23E,
- 0, 0, 0xB23F, 0x5129, 0xB240, 0x5127, 0xB241, 0x414E,
- 0xB242, 0xB243, 0, 0, 0, 0x5128, 0x512A, 0xB244,
- 0, 0xB245, 0xB251, 0, 0xF430, 0x512C, 0xB246, 0,
- 0, 0x512B, 0xB247, 0x4A48, 0, 0, 0xB248, 0,
-};
-const unsigned short utf8_to_euc_E584[] = {
- 0x3537, 0x512E, 0x512F, 0xB249, 0x322F, 0, 0xB24A, 0xB24B,
- 0xB24C, 0x512D, 0, 0xB24D, 0xB24E, 0xB24F, 0xB250, 0,
- 0xB252, 0, 0x3C74, 0, 0x5132, 0x5131, 0x5130, 0xB253,
- 0x5056, 0xB254, 0x5133, 0xB255, 0xB256, 0xB257, 0xB258, 0x3D7E,
- 0, 0x5134, 0, 0xB259, 0, 0, 0, 0xB25A,
- 0xB25B, 0, 0x4D25, 0, 0xB25C, 0xB25D, 0, 0xB25E,
- 0, 0xB25F, 0x4C59, 0xB260, 0xB261, 0xB262, 0, 0x5136,
- 0xB263, 0xB264, 0x5135, 0x5138, 0x5137, 0, 0, 0x5139,
-};
-const unsigned short utf8_to_euc_E585[] = {
- 0x513A, 0x3074, 0xB265, 0x3835, 0x373B, 0x3D3C, 0x437B, 0x3624,
- 0x4068, 0x3877, 0xB266, 0x396E, 0x513C, 0x4C48, 0x4546, 0xB267,
- 0x3B79, 0, 0x513B, 0xB268, 0x513D, 0xB269, 0, 0xB26A,
- 0xB26B, 0, 0x455E, 0, 0x3375, 0, 0, 0xB26C,
- 0, 0, 0x513E, 0, 0xB26D, 0x467E, 0xB26E, 0,
+unsigned short utf8_to_euc_E582[] = {
+ 0x507A, 0, 0, 0, 0, 0x507C, 0, 0,
+ 0, 0, 0, 0, 0, 0x4B35, 0, 0,
+ 0, 0x3766, 0, 0, 0x7940, 0, 0, 0,
+ 0x3B31, 0x4877, 0x507B, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x3A45, 0x4D43, 0, 0,
+ 0, 0, 0x507E, 0x5123, 0x507D, 0x3A44, 0, 0x3D7D,
+ 0, 0, 0, 0, 0, 0, 0x3739, 0,
+};
+unsigned short utf8_to_euc_E583[] = {
+ 0, 0, 0x5124, 0, 0, 0x364F, 0, 0,
+ 0, 0x5121, 0x5122, 0, 0, 0x462F, 0, 0x417C,
+ 0, 0x3623, 0, 0, 0, 0x4B4D, 0x5125, 0,
+ 0x7942, 0, 0x4E3D, 0, 0, 0, 0x5126, 0,
+ 0, 0, 0, 0x5129, 0, 0x5127, 0, 0x414E,
+ 0, 0, 0, 0, 0, 0x5128, 0x512A, 0,
+ 0, 0, 0, 0, 0x7941, 0x512C, 0, 0,
+ 0, 0x512B, 0, 0x4A48, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E584[] = {
+ 0x3537, 0x512E, 0x512F, 0, 0x322F, 0, 0, 0,
+ 0, 0x512D, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3C74, 0, 0x5132, 0x5131, 0x5130, 0,
+ 0x5056, 0, 0x5133, 0, 0, 0, 0, 0x3D7E,
+ 0, 0x5134, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4D25, 0, 0, 0, 0, 0,
+ 0, 0, 0x4C59, 0, 0, 0, 0, 0x5136,
+ 0, 0, 0x5135, 0x5138, 0x5137, 0, 0, 0x5139,
+};
+unsigned short utf8_to_euc_E585[] = {
+ 0x513A, 0x3074, 0, 0x3835, 0x373B, 0x3D3C, 0x437B, 0x3624,
+ 0x4068, 0x3877, 0x7943, 0x396E, 0x513C, 0x4C48, 0x4546, 0,
+ 0x3B79, 0, 0x513B, 0, 0x513D, 0, 0, 0,
+ 0, 0, 0x455E, 0, 0x3375, 0, 0, 0,
+ 0, 0, 0x513E, 0, 0x7944, 0x467E, 0, 0,
0x4134, 0x5140, 0x5141, 0x482C, 0x3878, 0x4F3B, 0x5142, 0,
0, 0x3626, 0, 0, 0, 0x4A3C, 0x4236, 0x3671,
- 0x4535, 0, 0, 0, 0x3773, 0, 0xB26F, 0,
+ 0x4535, 0, 0, 0, 0x3773, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E586[] = {
- 0x5143, 0, 0x5144, 0xB270, 0xB271, 0x4662, 0x315F, 0,
- 0, 0x5147, 0x3A7D, 0xB272, 0x5146, 0x3A46, 0xB273, 0x5148,
+unsigned short utf8_to_euc_E586[] = {
+ 0x5143, 0, 0x5144, 0, 0, 0x4662, 0x315F, 0,
+ 0, 0x5147, 0x3A7D, 0, 0x5146, 0x3A46, 0, 0x5148,
0x666E, 0x5149, 0x4B41, 0x514A, 0, 0x514B, 0x514C, 0x3E69,
- 0xB274, 0x3C4C, 0, 0, 0, 0xB275, 0, 0,
- 0x3427, 0xB276, 0x514F, 0xB277, 0x514D, 0x4C3D, 0x514E, 0,
- 0x495A, 0x5150, 0x5151, 0x5152, 0x455F, 0xB278, 0, 0,
+ 0, 0x3C4C, 0, 0, 0, 0x7945, 0, 0,
+ 0x3427, 0, 0x514F, 0, 0x514D, 0x4C3D, 0x514E, 0,
+ 0x495A, 0x5150, 0x5151, 0x5152, 0x455F, 0, 0, 0,
0x5156, 0x5154, 0x5155, 0x5153, 0x3A63, 0x5157, 0x4C6A, 0x4E64,
- 0xB279, 0, 0xB27A, 0, 0xB27B, 0x5158, 0xB27C, 0xB27D,
-};
-const unsigned short utf8_to_euc_E587[] = {
- 0, 0, 0xB27E, 0, 0x4028, 0x5159, 0x3D5A, 0,
- 0xB321, 0x515A, 0, 0x437C, 0x4E3F, 0x4560, 0, 0xB322,
- 0, 0xB323, 0xB324, 0xB325, 0, 0xB326, 0x5245, 0,
- 0xB327, 0, 0, 0x515B, 0x7425, 0x3645, 0xB328, 0,
- 0x515C, 0x4B5E, 0xB329, 0, 0, 0xB32A, 0x3D68, 0x427C,
- 0, 0x515E, 0x4664, 0, 0xF431, 0x515F, 0xB32B, 0,
- 0x5160, 0x332E, 0xB32C, 0xB32D, 0xB32E, 0x5161, 0x3627, 0xB32F,
+ 0, 0, 0, 0, 0, 0x5158, 0x7946, 0,
+};
+unsigned short utf8_to_euc_E587[] = {
+ 0, 0, 0, 0, 0x4028, 0x5159, 0x3D5A, 0,
+ 0, 0x515A, 0, 0x437C, 0x4E3F, 0x4560, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x5245, 0,
+ 0, 0, 0, 0x515B, 0x7425, 0x3645, 0, 0,
+ 0x515C, 0x4B5E, 0, 0, 0, 0, 0x3D68, 0x427C,
+ 0, 0x515E, 0x4664, 0, 0x7947, 0x515F, 0, 0,
+ 0x5160, 0x332E, 0, 0, 0, 0x5161, 0x3627, 0,
0x464C, 0x317A, 0x3D50, 0, 0, 0x4821, 0x5162, 0,
};
-const unsigned short utf8_to_euc_E588[] = {
- 0x4561, 0xB330, 0xB331, 0x3F4F, 0x5163, 0xB332, 0x4A2C, 0x405A,
+unsigned short utf8_to_euc_E588[] = {
+ 0x4561, 0, 0, 0x3F4F, 0x5163, 0, 0x4A2C, 0x405A,
0x3422, 0, 0x3429, 0x5164, 0, 0, 0x5166, 0,
- 0, 0x373A, 0xB333, 0xB334, 0x5165, 0xB335, 0xB336, 0x4E73,
- 0xB337, 0, 0, 0, 0, 0x3D69, 0, 0,
- 0, 0, 0xB338, 0, 0x483D, 0x4A4C, 0, 0x5167,
- 0xB339, 0x4D78, 0x5168, 0, 0, 0, 0x5169, 0,
- 0x457E, 0xB33A, 0xB33B, 0x516A, 0, 0xB33C, 0x4029, 0x3A7E,
- 0x3774, 0x516B, 0x3B49, 0x396F, 0xB33D, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E589[] = {
- 0, 0, 0, 0x4466, 0x516D, 0xB33E, 0, 0x4227,
- 0, 0xB33F, 0x3A6F, 0x516E, 0x516F, 0x4130, 0, 0x516C,
- 0, 0, 0, 0, 0x5171, 0xB340, 0x4B36, 0xB341,
- 0xB342, 0, 0xB343, 0x3964, 0xB344, 0, 0x5170, 0xB345,
- 0xB346, 0xB347, 0, 0x3775, 0x3A5E, 0x476D, 0xB348, 0,
- 0, 0x5174, 0x5172, 0, 0, 0, 0xB349, 0x497B,
- 0x3E6A, 0x517B, 0x3364, 0x5175, 0x5173, 0x414F, 0, 0xB34A,
- 0xB34B, 0xB34C, 0, 0, 0, 0x5177, 0, 0x5176,
-};
-const unsigned short utf8_to_euc_E58A[] = {
- 0xB34D, 0, 0xB34E, 0x3344, 0, 0xB34F, 0, 0x3760,
- 0x517C, 0x4E2D, 0xB350, 0, 0xB351, 0x5178, 0, 0,
- 0, 0x517D, 0x517A, 0xB352, 0x5179, 0xB353, 0xB354, 0xB355,
- 0xB356, 0, 0xB357, 0x4E4F, 0xB358, 0, 0, 0x3879,
- 0x3243, 0, 0, 0x4E74, 0xB359, 0xB35A, 0xB35B, 0xB35C,
- 0, 0x3D75, 0x4558, 0x3965, 0x5222, 0x5223, 0, 0xB35D,
- 0xB35E, 0x4E65, 0, 0, 0x4F2B, 0x5225, 0xB35F, 0xB360,
- 0xB361, 0x387A, 0xB362, 0xB363, 0x5224, 0xB364, 0x332F, 0,
-};
-const unsigned short utf8_to_euc_E58B[] = {
- 0xB365, 0x5226, 0, 0x4B56, 0xB366, 0x443C, 0xB367, 0x4D26,
- 0xB368, 0x4A59, 0, 0, 0xB369, 0x5227, 0, 0xB36A,
- 0, 0xB36B, 0x7055, 0, 0xB36C, 0x4630, 0xB36D, 0x5228,
- 0x342A, 0x4C33, 0, 0xB36E, 0xB36F, 0x3E21, 0x5229, 0x4A67,
- 0x522D, 0xB370, 0x402A, 0x522A, 0x3650, 0xB371, 0x522B, 0x342B,
- 0xB372, 0xB373, 0xB374, 0, 0xB375, 0, 0, 0,
- 0xB376, 0xB377, 0x372E, 0x522E, 0xB378, 0x522F, 0xB379, 0xB37A,
+ 0, 0x373A, 0, 0, 0x5165, 0x7948, 0, 0x4E73,
+ 0, 0, 0, 0, 0, 0x3D69, 0, 0,
+ 0, 0, 0, 0, 0x483D, 0x4A4C, 0, 0x5167,
+ 0, 0x4D78, 0x5168, 0, 0, 0, 0x5169, 0,
+ 0x457E, 0, 0, 0x516A, 0, 0, 0x4029, 0x3A7E,
+ 0x3774, 0x516B, 0x3B49, 0x396F, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E589[] = {
+ 0, 0, 0, 0x4466, 0x516D, 0, 0, 0x4227,
+ 0, 0, 0x3A6F, 0x516E, 0x516F, 0x4130, 0, 0x516C,
+ 0, 0, 0, 0, 0x5171, 0, 0x4B36, 0,
+ 0, 0, 0, 0x3964, 0, 0, 0x5170, 0,
+ 0, 0, 0, 0x3775, 0x3A5E, 0x476D, 0, 0,
+ 0, 0x5174, 0x5172, 0, 0, 0, 0, 0x497B,
+ 0x3E6A, 0x517B, 0x3364, 0x5175, 0x5173, 0x414F, 0, 0,
+ 0, 0, 0, 0, 0, 0x5177, 0, 0x5176,
+};
+unsigned short utf8_to_euc_E58A[] = {
+ 0, 0, 0, 0x3344, 0, 0, 0, 0x3760,
+ 0x517C, 0x4E2D, 0, 0, 0, 0x5178, 0, 0,
+ 0, 0x517D, 0x517A, 0, 0x5179, 0, 0, 0,
+ 0, 0, 0, 0x4E4F, 0x7949, 0, 0, 0x3879,
+ 0x3243, 0, 0, 0x4E74, 0, 0, 0x794A, 0,
+ 0, 0x3D75, 0x4558, 0x3965, 0x5222, 0x5223, 0, 0x7B3C,
+ 0, 0x4E65, 0, 0, 0x4F2B, 0x5225, 0, 0,
+ 0, 0x387A, 0, 0, 0x5224, 0, 0x332F, 0,
+};
+unsigned short utf8_to_euc_E58B[] = {
+ 0x794B, 0x5226, 0, 0x4B56, 0, 0x443C, 0, 0x4D26,
+ 0, 0x4A59, 0, 0, 0, 0x5227, 0, 0,
+ 0, 0, 0x7055, 0, 0, 0x4630, 0, 0x5228,
+ 0x342A, 0x4C33, 0, 0x794C, 0, 0x3E21, 0x5229, 0x4A67,
+ 0x522D, 0, 0x402A, 0x522A, 0x3650, 0, 0x522B, 0x342B,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x372E, 0x522E, 0, 0x522F, 0, 0,
0x5230, 0x5231, 0x3C5B, 0, 0, 0, 0x387B, 0x4C5E,
};
-const unsigned short utf8_to_euc_E58C[] = {
- 0xB37B, 0x4C68, 0x4677, 0xB37C, 0, 0x4A71, 0x5232, 0xF432,
- 0x5233, 0, 0xB37D, 0xB37E, 0xB421, 0x5235, 0, 0x5237,
- 0x5236, 0xB422, 0, 0xB423, 0, 0x5238, 0x323D, 0x4B4C,
- 0xB424, 0x3A7C, 0x5239, 0xB425, 0xB426, 0x4159, 0xB427, 0xB428,
- 0x3E22, 0x3629, 0, 0x523A, 0xF433, 0xB429, 0, 0xB42A,
- 0xB42B, 0xB42C, 0x485B, 0xB42D, 0xB42E, 0xB42F, 0, 0x523B,
- 0xB430, 0x523C, 0xB431, 0x523D, 0, 0xB432, 0, 0,
- 0x523E, 0x4924, 0x3668, 0x3065, 0xB433, 0xB434, 0xB435, 0x463F,
-};
-const unsigned short utf8_to_euc_E58D[] = {
- 0x523F, 0x3D3D, 0xB436, 0x4069, 0, 0x5241, 0x5240, 0x3E23,
- 0x3861, 0x5243, 0x483E, 0xB438, 0xB437, 0x5244, 0, 0,
+unsigned short utf8_to_euc_E58C[] = {
+ 0x794D, 0x4C68, 0x4677, 0, 0, 0x4A71, 0x5232, 0x794E,
+ 0x5233, 0, 0, 0, 0, 0x5235, 0, 0x5237,
+ 0x5236, 0, 0, 0, 0, 0x5238, 0x323D, 0x4B4C,
+ 0, 0x3A7C, 0x5239, 0, 0, 0x4159, 0, 0,
+ 0x3E22, 0x3629, 0, 0x523A, 0x794F, 0, 0, 0,
+ 0, 0, 0x485B, 0, 0, 0, 0, 0x523B,
+ 0, 0x523C, 0, 0x523D, 0, 0, 0, 0,
+ 0x523E, 0x4924, 0x3668, 0x3065, 0, 0, 0, 0x463F,
+};
+unsigned short utf8_to_euc_E58D[] = {
+ 0x523F, 0x3D3D, 0, 0x4069, 0, 0x5241, 0x5240, 0x3E23,
+ 0x3861, 0x5243, 0x483E, 0, 0, 0x5244, 0, 0,
0, 0x485C, 0x4234, 0x426E, 0x3628, 0, 0, 0x466E,
- 0x4331, 0xB439, 0x476E, 0xB43A, 0x4B4E, 0, 0x5246, 0,
- 0x406A, 0xB43B, 0, 0xB43C, 0, 0xB43D, 0x3735, 0,
- 0, 0x5247, 0, 0, 0xB43E, 0xB43F, 0x5248, 0x312C,
- 0x3075, 0x346D, 0xB440, 0x4228, 0x3551, 0x4D71, 0, 0x524B,
- 0x3237, 0xB441, 0, 0x524A, 0, 0, 0xB442, 0x362A,
-};
-const unsigned short utf8_to_euc_E58E[] = {
- 0, 0, 0x524C, 0xB443, 0x4C71, 0, 0, 0xB444,
- 0xB445, 0, 0, 0, 0, 0, 0xB446, 0,
- 0, 0, 0, 0xB447, 0xB448, 0, 0x524D, 0,
- 0x4E52, 0xB449, 0x387C, 0, 0, 0xB44A, 0, 0x3836,
- 0x524E, 0xB44B, 0, 0, 0xB44C, 0x5250, 0x524F, 0,
- 0x3F5F, 0x3139, 0xB44D, 0xB44E, 0, 0x315E, 0x5251, 0xB44F,
- 0x5252, 0, 0xB450, 0x3837, 0xB451, 0xB452, 0x5253, 0xB453,
- 0xB454, 0, 0xB455, 0x356E, 0, 0xB456, 0, 0,
-};
-const unsigned short utf8_to_euc_E58F[] = {
- 0xB457, 0, 0x3B32, 0x5254, 0, 0xB458, 0, 0,
- 0x4B74, 0x3A35, 0x355A, 0x4D27, 0x4150, 0x483F, 0x3C7D, 0xB459,
- 0, 0, 0xB45A, 0xB45B, 0x3D47, 0xB45C, 0x3C68, 0x3C75,
- 0, 0x3D76, 0xB45D, 0x4840, 0, 0xB45E, 0xB45F, 0x5257,
- 0xB460, 0x3143, 0x4151, 0x387D, 0x3845, 0x3667, 0xB461, 0xB462,
+ 0x4331, 0, 0x476E, 0, 0x4B4E, 0, 0x5246, 0,
+ 0x406A, 0, 0, 0, 0, 0, 0x3735, 0,
+ 0, 0x5247, 0, 0, 0, 0, 0x5248, 0x312C,
+ 0x3075, 0x346D, 0x7950, 0x4228, 0x3551, 0x4D71, 0, 0x524B,
+ 0x3237, 0, 0, 0x524A, 0, 0, 0, 0x362A,
+};
+unsigned short utf8_to_euc_E58E[] = {
+ 0, 0, 0x524C, 0, 0x4C71, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x7951, 0, 0, 0x524D, 0,
+ 0x4E52, 0, 0x387C, 0, 0, 0, 0, 0x3836,
+ 0x524E, 0, 0, 0, 0, 0x5250, 0x524F, 0,
+ 0x3F5F, 0x3139, 0, 0, 0, 0x315E, 0x5251, 0,
+ 0x5252, 0, 0x7952, 0x3837, 0, 0, 0x5253, 0,
+ 0, 0, 0, 0x356E, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E58F[] = {
+ 0, 0, 0x3B32, 0x5254, 0, 0, 0, 0,
+ 0x4B74, 0x3A35, 0x355A, 0x4D27, 0x4150, 0x483F, 0x3C7D, 0,
+ 0, 0, 0, 0, 0x3D47, 0, 0x3C68, 0x3C75,
+ 0, 0x3D76, 0, 0x4840, 0, 0x7953, 0, 0x5257,
+ 0, 0x3143, 0x4151, 0x387D, 0x3845, 0x3667, 0, 0,
0x525B, 0x4321, 0x427E, 0x362B, 0x3E24, 0x525C, 0x525A, 0x3244,
- 0x4266, 0x3C38, 0x3B4B, 0x3126, 0, 0xB463, 0x3370, 0x3966,
+ 0x4266, 0x3C38, 0x3B4B, 0x3126, 0, 0, 0x3370, 0x3966,
0x3B4A, 0, 0x525D, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E590[] = {
- 0, 0x525E, 0xB464, 0x3549, 0x3346, 0, 0, 0,
+unsigned short utf8_to_euc_E590[] = {
+ 0, 0x525E, 0, 0x3549, 0x3346, 0, 0, 0,
0x3967, 0x3548, 0x445F, 0x3125, 0x4631, 0x4C3E, 0x3921, 0x4D79,
- 0x4547, 0x387E, 0, 0xB465, 0, 0, 0, 0,
- 0, 0, 0xB466, 0x372F, 0, 0x5267, 0, 0x3663,
- 0x4B4A, 0xB467, 0, 0, 0, 0, 0x485D, 0xB468,
- 0xB469, 0x5266, 0xB46A, 0x345E, 0x5261, 0x5262, 0x5264, 0xB46B,
- 0, 0xB46C, 0, 0, 0xB46D, 0xB46E, 0x5265, 0,
+ 0x4547, 0x387E, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x372F, 0, 0x5267, 0, 0x3663,
+ 0x4B4A, 0, 0, 0, 0, 0, 0x485D, 0,
+ 0, 0x5266, 0, 0x345E, 0x5261, 0x5262, 0x5264, 0,
+ 0, 0, 0, 0, 0, 0, 0x5265, 0,
0x355B, 0x3F61, 0, 0x4A2D, 0x5263, 0x525F, 0x3863, 0,
};
-const unsigned short utf8_to_euc_E591[] = {
- 0x5260, 0, 0x4F24, 0xB46F, 0xB470, 0, 0x4A72, 0xB471,
- 0x4468, 0x3862, 0x3970, 0, 0, 0xB472, 0x5268, 0xB473,
+unsigned short utf8_to_euc_E591[] = {
+ 0x5260, 0, 0x4F24, 0, 0, 0, 0x4A72, 0,
+ 0x4468, 0x3862, 0x3970, 0, 0, 0, 0x5268, 0,
0, 0x465D, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xB474, 0x526C,
- 0, 0, 0xB475, 0, 0xB476, 0, 0xB477, 0xB478,
- 0x3C7E, 0xB479, 0x3C76, 0xB47A, 0, 0xB47B, 0xB47C, 0,
- 0x526F, 0x526D, 0, 0x4C23, 0xB47D, 0x526A, 0x5273, 0x526E,
- 0, 0, 0, 0x5271, 0x3846, 0x4C3F, 0, 0xB47E,
-};
-const unsigned short utf8_to_euc_E592[] = {
- 0x5272, 0xB521, 0, 0xB522, 0x5274, 0xB523, 0x5276, 0,
- 0xB524, 0xB525, 0xF435, 0x3A70, 0x4F42, 0xB526, 0x526B, 0x5269,
- 0x5275, 0xB527, 0x5270, 0, 0, 0xB528, 0xB529, 0,
- 0, 0, 0, 0, 0xB52A, 0, 0, 0xB52B,
- 0, 0xB52C, 0x5278, 0, 0x5323, 0x527A, 0xB52D, 0xB52E,
- 0x527E, 0xB52F, 0xB530, 0x5321, 0x527B, 0xB531, 0xB532, 0x533E,
- 0, 0xB533, 0x3A69, 0x3331, 0, 0, 0, 0xB534,
- 0x5279, 0xB535, 0xB536, 0xB537, 0x5325, 0x3076, 0x5324, 0xB538,
-};
-const unsigned short utf8_to_euc_E593[] = {
- 0x3025, 0x494A, 0x5322, 0, 0x527C, 0, 0xB539, 0x5277,
- 0x527D, 0x3A48, 0xB53A, 0, 0, 0xB53B, 0xB53C, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x526C,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x3C7E, 0, 0x3C76, 0, 0, 0, 0, 0,
+ 0x526F, 0x526D, 0, 0x4C23, 0, 0x526A, 0x5273, 0x526E,
+ 0, 0, 0, 0x5271, 0x3846, 0x4C3F, 0, 0,
+};
+unsigned short utf8_to_euc_E592[] = {
+ 0x5272, 0, 0, 0, 0x5274, 0, 0x5276, 0,
+ 0, 0, 0x7956, 0x3A70, 0x4F42, 0, 0x526B, 0x5269,
+ 0x5275, 0, 0x5270, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x7955, 0, 0, 0,
+ 0, 0, 0x5278, 0, 0x5323, 0x527A, 0, 0,
+ 0x527E, 0x7957, 0, 0x5321, 0x527B, 0, 0, 0x533E,
+ 0, 0, 0x3A69, 0x3331, 0, 0, 0, 0,
+ 0x5279, 0, 0, 0, 0x5325, 0x3076, 0x5324, 0,
+};
+unsigned short utf8_to_euc_E593[] = {
+ 0x3025, 0x494A, 0x5322, 0, 0x527C, 0, 0, 0x5277,
+ 0x527D, 0x3A48, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x5326, 0, 0, 0, 0, 0, 0, 0,
- 0xB53D, 0x3077, 0x532F, 0, 0, 0x5327, 0x5328, 0,
- 0x3E25, 0x4B69, 0xB53E, 0, 0xB53F, 0x532D, 0x532C, 0xB540,
- 0, 0, 0x452F, 0, 0, 0, 0xB541, 0,
- 0, 0, 0x532E, 0, 0xB542, 0x532B, 0xB543, 0xB544,
+ 0, 0x3077, 0x532F, 0, 0, 0x5327, 0x5328, 0,
+ 0x3E25, 0x4B69, 0, 0, 0, 0x532D, 0x532C, 0,
+ 0, 0, 0x452F, 0, 0, 0, 0, 0,
+ 0, 0, 0x532E, 0, 0, 0x532B, 0, 0x7958,
};
-const unsigned short utf8_to_euc_E594[] = {
- 0xB545, 0xB546, 0, 0, 0x3134, 0xB547, 0x3A36, 0x3F30,
- 0xB548, 0xB549, 0, 0, 0xB54A, 0xB54B, 0xB54C, 0x5329,
- 0x4562, 0, 0, 0, 0x532A, 0xB54D, 0x3022, 0,
+unsigned short utf8_to_euc_E594[] = {
+ 0, 0, 0, 0, 0x3134, 0, 0x3A36, 0x3F30,
+ 0, 0, 0, 0, 0, 0, 0, 0x5329,
+ 0x4562, 0, 0, 0, 0x532A, 0, 0x3022, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xB54E, 0xB54F, 0, 0, 0x5334, 0x4D23,
- 0, 0x3E27, 0xB550, 0x533A, 0, 0xB551, 0xB552, 0,
- 0x5339, 0x5330, 0, 0xB553, 0xB554, 0xB555, 0x4243, 0,
+ 0, 0, 0, 0, 0, 0, 0x5334, 0x4D23,
+ 0, 0x3E27, 0, 0x533A, 0, 0, 0, 0,
+ 0x5339, 0x5330, 0, 0, 0, 0, 0x4243, 0,
};
-const unsigned short utf8_to_euc_E595[] = {
- 0x5331, 0xB556, 0, 0, 0x426F, 0x5336, 0x3E26, 0xB557,
- 0, 0xB558, 0xB559, 0, 0x5333, 0xB55A, 0, 0x4C64,
- 0xB55B, 0xB55C, 0, 0x373C, 0, 0, 0x5337, 0x5338,
- 0xB55D, 0, 0xB55E, 0xB55F, 0x5335, 0x533B, 0xB560, 0,
- 0xB561, 0xB562, 0, 0x5332, 0xB563, 0, 0xB564, 0,
+unsigned short utf8_to_euc_E595[] = {
+ 0x5331, 0, 0, 0, 0x426F, 0x5336, 0x3E26, 0,
+ 0, 0, 0, 0, 0x5333, 0, 0, 0x4C64,
+ 0, 0, 0, 0x373C, 0, 0, 0x5337, 0x5338,
+ 0, 0, 0, 0, 0x5335, 0x533B, 0, 0,
+ 0, 0, 0, 0x5332, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x5341, 0x5346, 0, 0x5342, 0xB565,
+ 0, 0, 0, 0x5341, 0x5346, 0, 0x5342, 0,
};
-const unsigned short utf8_to_euc_E596[] = {
- 0x533D, 0xB566, 0xB567, 0x5347, 0x4131, 0, 0xB568, 0x5349,
- 0xB569, 0x3922, 0x533F, 0x437D, 0, 0, 0xB56A, 0xB56B,
- 0, 0xB56C, 0xB56D, 0xB56E, 0xB56F, 0, 0, 0xB570,
+unsigned short utf8_to_euc_E596[] = {
+ 0x533D, 0, 0, 0x5347, 0x4131, 0, 0x7959, 0x5349,
+ 0, 0x3922, 0x533F, 0x437D, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0x5343, 0x533C, 0x342D, 0, 0x346E, 0x3365, 0x5344, 0x5340,
- 0, 0, 0, 0xB571, 0xB572, 0, 0, 0x3776,
- 0x534A, 0x5348, 0x4153, 0x354A, 0x362C, 0xB573, 0x5345, 0,
- 0x3674, 0, 0xB574, 0, 0, 0, 0x3144, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xB575,
-};
-const unsigned short utf8_to_euc_E597[] = {
- 0, 0xB576, 0, 0xB577, 0x534E, 0x534C, 0xB578, 0x5427,
- 0, 0xB579, 0, 0xB57A, 0xB57B, 0, 0xB57C, 0,
- 0, 0xB57D, 0xB57E, 0xB621, 0x5351, 0, 0, 0xB622,
- 0xB623, 0, 0x534B, 0xB624, 0x534F, 0, 0xB625, 0x534D,
- 0, 0, 0xB626, 0x3B4C, 0x5350, 0, 0, 0,
- 0, 0xB627, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xB628, 0x5353,
- 0, 0x5358, 0, 0, 0, 0x5356, 0x5355, 0xB629,
-};
-const unsigned short utf8_to_euc_E598[] = {
- 0, 0, 0, 0, 0, 0xB62A, 0x4332, 0,
- 0xB62B, 0x3245, 0xB62C, 0, 0, 0xB62D, 0xB62E, 0xB62F,
- 0xB630, 0xB631, 0xB632, 0, 0x5352, 0, 0x5354, 0x3E28,
- 0x3133, 0xB633, 0, 0x5357, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x325E, 0, 0, 0xB634, 0, 0, 0x5362,
- 0xB635, 0x3E7C, 0x535E, 0xB636, 0x535C, 0xB637, 0x535D, 0xB638,
- 0x535F, 0xB639, 0, 0xB63A, 0xB63B, 0xB63C, 0, 0xB63D,
-};
-const unsigned short utf8_to_euc_E599[] = {
- 0xB63E, 0xB63F, 0x313D, 0xB640, 0xB641, 0, 0xB642, 0,
- 0, 0xB643, 0, 0xB644, 0x4139, 0xB645, 0x5359, 0xB646,
- 0x535A, 0, 0, 0, 0xB647, 0, 0, 0,
- 0, 0, 0, 0x337A, 0, 0, 0xB648, 0,
- 0xB649, 0xB64A, 0xB64B, 0xB64C, 0x5361, 0, 0xB64D, 0,
- 0x346F, 0xB64E, 0x5364, 0x5360, 0x5363, 0xB64F, 0, 0xB650,
- 0, 0xB651, 0xB652, 0, 0x4A2E, 0xB653, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x3776,
+ 0x534A, 0x5348, 0x4153, 0x354A, 0x362C, 0, 0x5345, 0,
+ 0x3674, 0, 0, 0, 0, 0, 0x3144, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E597[] = {
+ 0, 0, 0, 0, 0x534E, 0x534C, 0, 0x5427,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5351, 0, 0, 0,
+ 0, 0, 0x534B, 0, 0x534F, 0, 0, 0x534D,
+ 0, 0, 0, 0x3B4C, 0x5350, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x5353,
+ 0, 0x5358, 0, 0, 0, 0x5356, 0x5355, 0,
+};
+unsigned short utf8_to_euc_E598[] = {
+ 0, 0, 0, 0, 0, 0, 0x4332, 0,
+ 0, 0x3245, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5352, 0, 0x5354, 0x3E28,
+ 0x3133, 0, 0, 0x5357, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x325E, 0, 0, 0, 0, 0, 0x5362,
+ 0, 0x3E7C, 0x535E, 0, 0x535C, 0, 0x535D, 0,
+ 0x535F, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E599[] = {
+ 0, 0, 0x313D, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x4139, 0, 0x5359, 0,
+ 0x535A, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x337A, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5361, 0, 0, 0,
+ 0x346F, 0, 0x5364, 0x5360, 0x5363, 0, 0, 0,
+ 0, 0, 0, 0, 0x4A2E, 0, 0, 0,
0x4655, 0, 0x4838, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E59A[] = {
- 0x5366, 0, 0, 0, 0xB654, 0xB655, 0x5365, 0x3345,
- 0xB656, 0, 0x5367, 0xB657, 0xB658, 0, 0, 0x536A,
- 0, 0, 0, 0, 0x5369, 0xB659, 0, 0,
- 0, 0xB65A, 0xB65B, 0, 0, 0xB65C, 0xB65D, 0xB65E,
- 0x5368, 0, 0x4739, 0, 0, 0x536B, 0xB65F, 0xB660,
- 0xB661, 0xB662, 0, 0xB663, 0xB664, 0xB665, 0x536C, 0,
- 0, 0xB666, 0, 0xB667, 0x536E, 0, 0x536D, 0xB668,
- 0, 0, 0, 0, 0x5370, 0, 0xB669, 0,
-};
-const unsigned short utf8_to_euc_E59B[] = {
- 0x5373, 0x5371, 0x536F, 0x5372, 0, 0xB66A, 0, 0,
- 0x5374, 0xB66B, 0xB66C, 0xB66D, 0xB670, 0xB671, 0x5375, 0xB66E,
- 0xB66F, 0x5376, 0, 0x5377, 0, 0, 0, 0x5378,
- 0x5145, 0xB672, 0x3C7C, 0x3B4D, 0xB673, 0xB674, 0x3273, 0xB675,
- 0x3078, 0xB676, 0, 0x4344, 0xB677, 0xB678, 0xB679, 0xB67A,
- 0xB67B, 0, 0, 0xB67D, 0, 0xB67E, 0x5379, 0,
- 0x3A24, 0xB67C, 0x304F, 0x3F5E, 0, 0, 0xB721, 0xB722,
+unsigned short utf8_to_euc_E59A[] = {
+ 0x5366, 0, 0, 0, 0, 0, 0x5365, 0x3345,
+ 0, 0, 0x5367, 0, 0, 0, 0, 0x536A,
+ 0, 0, 0, 0, 0x5369, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5368, 0, 0x4739, 0, 0, 0x536B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x536C, 0,
+ 0, 0, 0, 0, 0x536E, 0, 0x536D, 0,
+ 0, 0, 0, 0, 0x5370, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E59B[] = {
+ 0x5373, 0x5371, 0x536F, 0x5372, 0, 0, 0, 0,
+ 0x5374, 0, 0, 0, 0, 0, 0x5375, 0,
+ 0, 0x5376, 0, 0x5377, 0, 0, 0, 0x5378,
+ 0x5145, 0, 0x3C7C, 0x3B4D, 0, 0, 0x3273, 0,
+ 0x3078, 0, 0, 0x4344, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x5379, 0,
+ 0x3A24, 0, 0x304F, 0x3F5E, 0, 0, 0, 0,
0, 0x537A, 0x3847, 0, 0, 0x3971, 0, 0x537C,
};
-const unsigned short utf8_to_euc_E59C[] = {
- 0x537B, 0xB723, 0xB724, 0x4A60, 0x537D, 0, 0, 0xB725,
- 0x5421, 0x537E, 0xB726, 0x5422, 0xB727, 0x5423, 0, 0x3777,
- 0, 0xB728, 0x3160, 0x5424, 0, 0xB729, 0x5426, 0,
- 0x5425, 0, 0xB72A, 0xB72B, 0x5428, 0xB72C, 0, 0x455A,
- 0xB72D, 0, 0xB72E, 0xB72F, 0xB730, 0xB731, 0x5429, 0x3035,
- 0x3A5F, 0xB732, 0xB733, 0, 0xB734, 0x373D, 0xB735, 0xB736,
- 0x434F, 0, 0, 0xB737, 0xB738, 0, 0, 0x542A,
- 0x542B, 0, 0, 0x542D, 0, 0xB739, 0xB73A, 0xB73B,
-};
-const unsigned short utf8_to_euc_E59D[] = {
- 0x542E, 0, 0x3A64, 0, 0, 0xB73C, 0xB73D, 0x3651,
- 0, 0, 0x4B37, 0, 0xB73E, 0xB73F, 0x542C, 0x542F,
- 0x3A41, 0x3923, 0xB740, 0, 0, 0, 0, 0,
- 0, 0xF436, 0, 0, 0, 0, 0, 0,
- 0, 0x5433, 0xB741, 0, 0x3A25, 0xB742, 0x4333, 0xB743,
- 0xB744, 0x5430, 0x445A, 0xB745, 0, 0xB746, 0xB747, 0xB748,
- 0xB749, 0xB74A, 0, 0xB74B, 0xB74C, 0xB74D, 0, 0xB74E,
- 0, 0xB74F, 0xB750, 0xB751, 0xB752, 0, 0xB753, 0x5434,
-};
-const unsigned short utf8_to_euc_E59E[] = {
- 0, 0xB754, 0x3F62, 0xB755, 0, 0, 0, 0,
- 0x5432, 0x5435, 0, 0x373F, 0xB756, 0, 0, 0,
- 0, 0, 0, 0x5436, 0xB757, 0xB760, 0, 0xB758,
- 0, 0xB759, 0xB75A, 0, 0xB75B, 0xB75C, 0xB75D, 0xB75E,
- 0x5437, 0xB75F, 0x3924, 0x3340, 0x5439, 0, 0, 0xB761,
- 0xB762, 0xB763, 0x543A, 0, 0xB764, 0, 0, 0,
+unsigned short utf8_to_euc_E59C[] = {
+ 0x537B, 0, 0, 0x4A60, 0x537D, 0, 0, 0,
+ 0x5421, 0x537E, 0, 0x5422, 0, 0x5423, 0, 0x3777,
+ 0, 0, 0x3160, 0x5424, 0, 0, 0x5426, 0,
+ 0x5425, 0, 0, 0, 0x5428, 0, 0, 0x455A,
+ 0, 0, 0, 0, 0, 0, 0x5429, 0x3035,
+ 0x3A5F, 0, 0, 0, 0, 0x373D, 0, 0,
+ 0x434F, 0, 0, 0, 0, 0, 0, 0x542A,
+ 0x542B, 0, 0, 0x542D, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E59D[] = {
+ 0x542E, 0, 0x3A64, 0, 0, 0, 0, 0x3651,
+ 0, 0, 0x4B37, 0, 0, 0, 0x542C, 0x542F,
+ 0x3A41, 0x3923, 0, 0, 0, 0, 0, 0,
+ 0, 0x795A, 0, 0, 0, 0, 0, 0,
+ 0, 0x5433, 0, 0, 0x3A25, 0x795B, 0x4333, 0,
+ 0, 0x5430, 0x445A, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x5434,
+};
+unsigned short utf8_to_euc_E59E[] = {
+ 0, 0, 0x3F62, 0, 0, 0, 0, 0,
+ 0x5432, 0x5435, 0, 0x373F, 0, 0, 0, 0,
+ 0, 0, 0, 0x5436, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5437, 0, 0x3924, 0x3340, 0x5439, 0, 0, 0,
+ 0, 0, 0x543A, 0, 0x795C, 0, 0, 0,
0x543B, 0, 0, 0x5438, 0, 0, 0, 0,
- 0xB765, 0, 0, 0, 0, 0xB766, 0, 0,
-};
-const unsigned short utf8_to_euc_E59F[] = {
- 0x5431, 0, 0, 0x543C, 0, 0, 0x543D, 0xB767,
- 0xB768, 0, 0, 0x4B64, 0xB769, 0, 0x3E6B, 0xB76A,
- 0, 0, 0x543F, 0x5440, 0x543E, 0xB76B, 0x5442, 0,
- 0, 0, 0, 0, 0x4738, 0xB76C, 0xB76D, 0x3068,
- 0x4956, 0xB77E, 0, 0x5443, 0xB76E, 0, 0xB76F, 0xB770,
- 0, 0xB771, 0, 0, 0, 0xB772, 0, 0,
- 0xB773, 0, 0, 0, 0x3E7D, 0xB774, 0xB775, 0x3C39,
- 0xB776, 0x475D, 0x3470, 0, 0x3A6B, 0xB777, 0xB778, 0xB779,
-};
-const unsigned short utf8_to_euc_E5A0[] = {
- 0x4B59, 0, 0x4632, 0xB77A, 0xB77B, 0x3778, 0x424F, 0,
- 0xB77C, 0xB77D, 0x5441, 0x5444, 0xB821, 0xB822, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E59F[] = {
+ 0x5431, 0, 0, 0x543C, 0, 0, 0x543D, 0x795E,
+ 0x795D, 0, 0, 0x4B64, 0, 0, 0x3E6B, 0,
+ 0, 0, 0x543F, 0x5440, 0x543E, 0, 0x5442, 0,
+ 0, 0, 0, 0, 0x4738, 0, 0, 0x3068,
+ 0x4956, 0, 0, 0x5443, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x3E7D, 0, 0, 0x3C39,
+ 0, 0x475D, 0x3470, 0, 0x3A6B, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E5A0[] = {
+ 0x4B59, 0, 0x4632, 0, 0, 0x3778, 0x424F, 0,
+ 0, 0, 0x5441, 0x5444, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x4244, 0, 0,
- 0, 0x5445, 0, 0xB823, 0, 0x5446, 0xB824, 0xB825,
- 0xB826, 0x5448, 0, 0, 0x4469, 0, 0xB827, 0xB828,
- 0, 0, 0x342E, 0, 0, 0xB829, 0, 0x7421,
- 0x3161, 0x4A73, 0xB82A, 0, 0x3E6C, 0x4548, 0, 0,
- 0, 0xB82B, 0x3A66, 0, 0, 0x544E, 0, 0xB82C,
+ 0, 0x5445, 0, 0, 0, 0x5446, 0, 0,
+ 0, 0x5448, 0, 0, 0x4469, 0, 0, 0,
+ 0, 0, 0x342E, 0, 0, 0, 0, 0x7421,
+ 0x3161, 0x4A73, 0, 0, 0x3E6C, 0x4548, 0, 0,
+ 0, 0, 0x3A66, 0, 0, 0x544E, 0, 0,
};
-const unsigned short utf8_to_euc_E5A1[] = {
+unsigned short utf8_to_euc_E5A1[] = {
0x4A3D, 0x4E5D, 0, 0, 0, 0, 0, 0,
- 0, 0xB82D, 0x3274, 0x544A, 0xB82E, 0xB82F, 0, 0xB830,
- 0xB831, 0x413A, 0x544D, 0, 0x4563, 0xB832, 0, 0x4549,
- 0x4564, 0x4839, 0x444D, 0, 0, 0, 0x3A49, 0xB833,
- 0, 0xB834, 0x5449, 0, 0xB835, 0, 0, 0xB836,
- 0xB837, 0x3176, 0, 0x4536, 0, 0, 0, 0,
+ 0, 0, 0x3274, 0x544A, 0, 0, 0, 0,
+ 0, 0x413A, 0x544D, 0, 0x4563, 0, 0, 0x4549,
+ 0x4564, 0x4839, 0x444D, 0, 0, 0, 0x3A49, 0,
+ 0, 0, 0x5449, 0, 0, 0, 0, 0,
+ 0, 0x3176, 0, 0x4536, 0, 0, 0, 0,
0x544B, 0, 0x5447, 0, 0, 0x3F50, 0, 0,
- 0xB838, 0x544F, 0, 0, 0xB839, 0, 0x3D4E, 0xB83A,
-};
-const unsigned short utf8_to_euc_E5A2[] = {
- 0xB83B, 0xB83C, 0, 0x362D, 0, 0x5450, 0, 0xB83D,
- 0xB83E, 0xB83F, 0xB840, 0, 0xB841, 0xB842, 0, 0xB843,
- 0xB844, 0, 0, 0x4A68, 0xB845, 0, 0xB846, 0x417D,
- 0, 0, 0, 0, 0x4446, 0xB847, 0xF439, 0x5452,
- 0xB848, 0xB849, 0xB84A, 0, 0, 0, 0xB84B, 0,
- 0x4B4F, 0xB84C, 0, 0x5453, 0, 0, 0x5458, 0,
- 0, 0xB84D, 0xB84E, 0x4A2F, 0, 0, 0, 0,
- 0x5457, 0x5451, 0x5454, 0x5456, 0xB850, 0, 0x3A26, 0,
-};
-const unsigned short utf8_to_euc_E5A3[] = {
- 0, 0x4A49, 0xB851, 0, 0xB84F, 0x5459, 0, 0x4345,
- 0xB852, 0, 0x3275, 0, 0x3E6D, 0xB853, 0xB854, 0,
- 0xB855, 0x545B, 0xB856, 0x545A, 0xB857, 0x3968, 0xB858, 0x545C,
- 0x545E, 0x545D, 0xB859, 0, 0x5460, 0xB85A, 0x5455, 0x5462,
- 0, 0xB85B, 0xB85C, 0, 0x5461, 0x545F, 0, 0,
- 0, 0xB85D, 0, 0x3B4E, 0x3F51, 0, 0x4154, 0x5463,
- 0x403C, 0x306D, 0x4764, 0xB85E, 0, 0, 0, 0x445B,
+ 0, 0x544F, 0, 0, 0, 0, 0x3D4E, 0,
+};
+unsigned short utf8_to_euc_E5A2[] = {
+ 0, 0, 0, 0x362D, 0, 0x5450, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4A68, 0, 0, 0, 0x417D,
+ 0, 0, 0, 0, 0x4446, 0, 0x7961, 0x5452,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x4B4F, 0, 0, 0x5453, 0, 0, 0x5458, 0,
+ 0, 0, 0x7962, 0x4A2F, 0, 0, 0, 0,
+ 0x5457, 0x5451, 0x5454, 0x5456, 0, 0, 0x3A26, 0,
+};
+unsigned short utf8_to_euc_E5A3[] = {
+ 0, 0x4A49, 0, 0, 0, 0x5459, 0, 0x4345,
+ 0, 0, 0x3275, 0, 0x3E6D, 0, 0, 0,
+ 0, 0x545B, 0, 0x545A, 0, 0x3968, 0, 0x545C,
+ 0x545E, 0x545D, 0, 0, 0x5460, 0, 0x5455, 0x5462,
+ 0, 0, 0, 0, 0x5461, 0x545F, 0, 0,
+ 0, 0, 0, 0x3B4E, 0x3F51, 0, 0x4154, 0x5463,
+ 0x403C, 0x306D, 0x4764, 0, 0, 0, 0, 0x445B,
0, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, 0, 0,
};
-const unsigned short utf8_to_euc_E5A4[] = {
- 0, 0, 0x5469, 0, 0, 0xB85F, 0xB860, 0,
- 0, 0x4A51, 0x546A, 0xB861, 0xB862, 0, 0, 0x3246,
- 0x546B, 0, 0xB863, 0xB864, 0xB865, 0x4D3C, 0x3330, 0,
- 0x5249, 0x3D48, 0x423F, 0x546C, 0x4C6B, 0xB867, 0, 0,
- 0, 0xB868, 0x4C34, 0xB869, 0xB86A, 0x546E, 0, 0x4267,
- 0xB86B, 0x4537, 0x4240, 0x4957, 0x546F, 0x5470, 0x317B, 0xB86C,
- 0xB86D, 0x3C3A, 0x5471, 0xB86E, 0, 0xB86F, 0xB870, 0x3050,
- 0x5472, 0, 0, 0, 0, 0, 0x5473, 0xB871,
-};
-const unsigned short utf8_to_euc_E5A5[] = {
- 0, 0, 0, 0xB872, 0x3162, 0, 0xB873, 0x3471,
+unsigned short utf8_to_euc_E5A4[] = {
+ 0, 0, 0x5469, 0, 0, 0, 0, 0,
+ 0, 0x4A51, 0x546A, 0x7963, 0, 0, 0, 0x3246,
+ 0x546B, 0, 0, 0, 0, 0x4D3C, 0x3330, 0,
+ 0x5249, 0x3D48, 0x423F, 0x546C, 0x4C6B, 0, 0, 0,
+ 0, 0, 0x4C34, 0, 0, 0x546E, 0, 0x4267,
+ 0, 0x4537, 0x4240, 0x4957, 0x546F, 0x5470, 0x317B, 0,
+ 0, 0x3C3A, 0x5471, 0, 0, 0, 0, 0x3050,
+ 0x5472, 0, 0, 0, 0, 0, 0x5473, 0,
+};
+unsigned short utf8_to_euc_E5A5[] = {
+ 0, 0, 0, 0, 0x3162, 0, 0, 0x3471,
0x4660, 0x4A74, 0, 0, 0, 0, 0x5477, 0x4155,
- 0x5476, 0x3740, 0xB874, 0xB875, 0x4B5B, 0x5475, 0, 0x4565,
- 0x5479, 0xB876, 0x5478, 0xB877, 0, 0xB878, 0xB879, 0xB87A,
- 0x547B, 0xB87B, 0x547A, 0xB87C, 0, 0x317C, 0, 0x547C,
- 0x3E29, 0x547E, 0x4325, 0xB87D, 0x547D, 0xB87E, 0x4A33, 0xB921,
- 0, 0, 0xB922, 0x3D77, 0x455B, 0xB923, 0xB924, 0,
- 0x5521, 0xB925, 0, 0xB926, 0xB927, 0x3925, 0, 0,
-};
-const unsigned short utf8_to_euc_E5A6[] = {
+ 0x5476, 0x3740, 0, 0x7964, 0x4B5B, 0x5475, 0, 0x4565,
+ 0x5479, 0, 0x5478, 0x7965, 0, 0x7966, 0, 0,
+ 0x547B, 0, 0x547A, 0x7967, 0, 0x317C, 0, 0x547C,
+ 0x3E29, 0x547E, 0x4325, 0, 0x547D, 0, 0x4A33, 0,
+ 0, 0, 0, 0x3D77, 0x455B, 0, 0, 0,
+ 0x5521, 0, 0, 0, 0, 0x3925, 0, 0,
+};
+unsigned short utf8_to_euc_E5A6[] = {
0, 0x5522, 0x4721, 0x485E, 0x4C51, 0, 0, 0,
- 0, 0, 0x4725, 0xB928, 0xB929, 0x552B, 0xB92A, 0,
- 0, 0, 0xB92B, 0x3538, 0, 0xB92C, 0x4D45, 0xB92D,
- 0, 0x4C2F, 0, 0x562C, 0, 0x5523, 0, 0xB92E,
- 0, 0, 0, 0x5526, 0xB92F, 0x4245, 0, 0xB930,
- 0x4B38, 0, 0, 0, 0x454A, 0xB931, 0xB932, 0xB933,
- 0xB934, 0, 0x5527, 0xB935, 0, 0, 0, 0xB936,
- 0, 0x4B65, 0xB937, 0x3A4A, 0xB938, 0, 0x3E2A, 0,
-};
-const unsigned short utf8_to_euc_E5A7[] = {
- 0, 0xB939, 0, 0xB93A, 0xB93B, 0, 0x5528, 0,
- 0xB93C, 0x3B50, 0xB93D, 0x3B4F, 0, 0xB93E, 0, 0,
- 0x3039, 0x3848, 0xB93F, 0x402B, 0x3051, 0, 0, 0,
- 0, 0x552C, 0x552D, 0, 0x552A, 0xB940, 0xB941, 0xB942,
- 0, 0, 0, 0xB943, 0xB944, 0x3138, 0x342F, 0xB945,
- 0x5529, 0, 0x4C45, 0x4931, 0, 0, 0xB946, 0xB947,
- 0, 0xB948, 0xB949, 0, 0xB94A, 0, 0x3028, 0xB94B,
+ 0, 0, 0x4725, 0, 0, 0x552B, 0, 0,
+ 0, 0, 0, 0x3538, 0, 0, 0x4D45, 0,
+ 0, 0x4C2F, 0, 0x562C, 0, 0x5523, 0, 0,
+ 0, 0, 0, 0x5526, 0x7968, 0x4245, 0, 0,
+ 0x4B38, 0, 0, 0, 0x454A, 0, 0, 0,
+ 0, 0, 0x5527, 0, 0, 0, 0, 0,
+ 0, 0x4B65, 0x7969, 0x3A4A, 0, 0, 0x3E2A, 0,
+};
+unsigned short utf8_to_euc_E5A7[] = {
+ 0, 0, 0, 0, 0, 0, 0x5528, 0,
+ 0, 0x3B50, 0, 0x3B4F, 0, 0, 0, 0,
+ 0x3039, 0x3848, 0, 0x402B, 0x3051, 0, 0, 0,
+ 0, 0x552C, 0x552D, 0, 0x552A, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x3138, 0x342F, 0,
+ 0x5529, 0, 0x4C45, 0x4931, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3028, 0,
0, 0, 0, 0x3079, 0, 0, 0, 0x3B51,
};
-const unsigned short utf8_to_euc_E5A8[] = {
- 0xB94C, 0x3052, 0, 0x3023, 0xB94D, 0, 0, 0,
- 0, 0x5532, 0, 0, 0xB94E, 0xB94F, 0xB950, 0,
- 0, 0x5530, 0xB951, 0xB952, 0, 0, 0, 0,
- 0x4C3C, 0, 0x5533, 0, 0x5531, 0, 0xB953, 0x552F,
- 0x3F31, 0, 0, 0xB954, 0xB955, 0x552E, 0, 0xB956,
- 0xB957, 0x4A5A, 0xB958, 0, 0, 0xB959, 0, 0x3864,
- 0xB95A, 0, 0, 0, 0, 0x5537, 0x5538, 0,
+unsigned short utf8_to_euc_E5A8[] = {
+ 0, 0x3052, 0, 0x3023, 0, 0, 0, 0,
+ 0, 0x5532, 0, 0, 0, 0, 0, 0,
+ 0, 0x5530, 0, 0, 0, 0, 0, 0,
+ 0x4C3C, 0, 0x5533, 0, 0x5531, 0, 0, 0x552F,
+ 0x3F31, 0, 0, 0, 0, 0x552E, 0, 0,
+ 0, 0x4A5A, 0, 0, 0, 0, 0, 0x3864,
+ 0, 0, 0, 0, 0, 0x5537, 0x5538, 0,
0, 0, 0, 0, 0x3E2B, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E5A9[] = {
- 0x5534, 0x4F2C, 0, 0, 0xB95B, 0xB95C, 0x474C, 0xB95D,
- 0xB95E, 0x5536, 0, 0, 0xB95F, 0, 0, 0,
- 0xB960, 0, 0, 0, 0, 0xB961, 0, 0,
- 0, 0, 0x3A27, 0, 0, 0, 0xB962, 0,
- 0, 0, 0x5539, 0xB963, 0, 0xB964, 0x4958, 0xB965,
- 0, 0, 0x553A, 0, 0x5535, 0xB966, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xB967,
- 0, 0, 0xB968, 0xB969, 0, 0, 0xB96A, 0x4C3B,
-};
-const unsigned short utf8_to_euc_E5AA[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xB96B, 0, 0, 0, 0,
- 0xB96C, 0, 0x475E, 0xB96D, 0, 0, 0xB96E, 0,
- 0, 0xB96F, 0x553B, 0x4932, 0xB970, 0, 0xB971, 0xB972,
- 0xB973, 0, 0xB974, 0, 0, 0, 0, 0xB975,
- 0, 0, 0, 0, 0xB976, 0, 0, 0,
- 0, 0xB977, 0xB978, 0xB979, 0, 0xB97A, 0, 0,
- 0xB97B, 0, 0xB97C, 0xB97D, 0x553C, 0x5540, 0x553D, 0xB97E,
-};
-const unsigned short utf8_to_euc_E5AB[] = {
- 0, 0x3247, 0x553F, 0, 0xBA21, 0, 0xBA22, 0,
- 0xBA23, 0x3C3B, 0, 0x553E, 0x3779, 0, 0, 0xBA24,
+unsigned short utf8_to_euc_E5A9[] = {
+ 0x5534, 0x4F2C, 0, 0, 0, 0, 0x474C, 0,
+ 0, 0x5536, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3A27, 0, 0, 0, 0, 0,
+ 0, 0, 0x5539, 0, 0, 0, 0x4958, 0,
+ 0, 0, 0x553A, 0, 0x5535, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4C3B,
+};
+unsigned short utf8_to_euc_E5AA[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x475E, 0, 0, 0, 0, 0,
+ 0, 0, 0x553B, 0x4932, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x553C, 0x5540, 0x553D, 0,
+};
+unsigned short utf8_to_euc_E5AB[] = {
+ 0, 0x3247, 0x553F, 0, 0, 0, 0, 0,
+ 0, 0x3C3B, 0, 0x553E, 0x3779, 0, 0, 0,
0x554C, 0, 0, 0, 0, 0, 0x5545, 0x5542,
- 0, 0, 0xBA25, 0, 0xBA26, 0, 0, 0,
- 0xBA27, 0x4364, 0, 0x5541, 0, 0xBA28, 0x5543, 0,
- 0, 0x5544, 0xBA29, 0, 0, 0, 0xBA2A, 0,
- 0, 0, 0, 0, 0, 0xBA2B, 0xBA2C, 0,
- 0, 0, 0x5546, 0x5547, 0, 0xBA2D, 0, 0,
-};
-const unsigned short utf8_to_euc_E5AC[] = {
- 0xBA2E, 0xBA2F, 0, 0, 0, 0, 0, 0,
- 0xBA30, 0x3472, 0, 0x5549, 0x5548, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0x554A, 0xBA31,
- 0, 0xBA33, 0, 0xBA34, 0, 0xBA35, 0, 0,
- 0, 0xBA36, 0x3E6E, 0, 0, 0xBA37, 0, 0,
- 0, 0, 0x554D, 0, 0x445C, 0xBA38, 0, 0,
- 0x3145, 0, 0x554B, 0, 0xBA32, 0, 0x554E, 0,
- 0xBA39, 0, 0, 0, 0, 0, 0x554F, 0,
-};
-const unsigned short utf8_to_euc_E5AD[] = {
- 0x5552, 0xBA3A, 0, 0x5550, 0, 0x5551, 0, 0,
- 0, 0, 0, 0xBA3B, 0xBA3C, 0, 0, 0,
- 0x3B52, 0x5553, 0xBA3D, 0, 0x3926, 0x5554, 0xBA3E, 0x3B7A,
- 0x4238, 0, 0x5555, 0x5556, 0x3B5A, 0x3927, 0xBA3F, 0x4C52,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x4364, 0, 0x5541, 0, 0, 0x5543, 0,
+ 0, 0x5544, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x5546, 0x5547, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E5AC[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x3472, 0, 0x5549, 0x5548, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x554A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3E6E, 0, 0, 0, 0, 0,
+ 0, 0, 0x554D, 0, 0x445C, 0, 0, 0,
+ 0x3145, 0, 0x554B, 0, 0, 0, 0x554E, 0,
+ 0, 0, 0, 0, 0, 0, 0x554F, 0,
+};
+unsigned short utf8_to_euc_E5AD[] = {
+ 0x5552, 0, 0, 0x5550, 0, 0x5551, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x3B52, 0x5553, 0, 0, 0x3926, 0x5554, 0x796A, 0x3B7A,
+ 0x4238, 0, 0x5555, 0x5556, 0x3B5A, 0x3927, 0, 0x4C52,
0, 0, 0, 0x3528, 0x3849, 0x5557, 0x3358, 0,
- 0xBA40, 0x5558, 0, 0x4239, 0, 0, 0xBA41, 0xBA42,
+ 0, 0x5558, 0, 0x4239, 0, 0, 0, 0,
0x5559, 0x5623, 0, 0x555A, 0, 0x555B, 0, 0,
- 0x555C, 0, 0x555E, 0, 0xBA43, 0xBA44, 0xBA45, 0xBA46,
+ 0x555C, 0, 0x555E, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E5AE[] = {
- 0x555F, 0xBA47, 0, 0x5560, 0xBA48, 0x4270, 0xBA49, 0x3127,
- 0x3C69, 0x3042, 0xBA4A, 0x4157, 0x3430, 0x3C35, 0xBA4B, 0x3928,
- 0xBA4C, 0xBA4D, 0, 0xBA4E, 0xBA4F, 0x4566, 0xBA50, 0x3D21,
+unsigned short utf8_to_euc_E5AE[] = {
+ 0x555F, 0, 0, 0x5560, 0, 0x4270, 0, 0x3127,
+ 0x3C69, 0x3042, 0, 0x4157, 0x3430, 0x3C35, 0, 0x3928,
+ 0, 0, 0, 0, 0, 0x4566, 0, 0x3D21,
0x3431, 0x4368, 0x446A, 0x3038, 0x3539, 0x4A75, 0, 0x3C42,
0, 0, 0x3552, 0x406B, 0x3C3C, 0x4D28, 0x5561, 0,
- 0xBA51, 0xBA52, 0, 0, 0xBA53, 0xBA54, 0x355C, 0xBA55,
- 0x3A4B, 0xBA56, 0xBA57, 0x3332, 0x3163, 0x3E2C, 0x3248, 0xBA58,
- 0x5562, 0x4D46, 0xBA59, 0, 0xBA5A, 0, 0, 0x3D49,
-};
-const unsigned short utf8_to_euc_E5AF[] = {
- 0xBA5B, 0xBA5C, 0x3C64, 0x5563, 0x3473, 0x4652, 0x4C29, 0x5564,
- 0, 0x5565, 0, 0, 0x4959, 0xBA5D, 0, 0xBA5E,
- 0x5567, 0, 0x3428, 0x3677, 0x5566, 0, 0xBA5F, 0xBA60,
- 0xBA61, 0xBA62, 0xBA63, 0x3432, 0, 0x3F32, 0x556B, 0x3B21,
- 0xBA64, 0x3249, 0x556A, 0, 0x5568, 0x556C, 0x5569, 0x472B,
- 0x5C4D, 0x3F33, 0, 0x556D, 0xF43A, 0, 0x4E40, 0xBA65,
- 0x556E, 0xBA66, 0, 0x5570, 0xBA67, 0x437E, 0x556F, 0,
- 0x4023, 0, 0x3B7B, 0, 0, 0xBA68, 0x4250, 0x3C77,
-};
-const unsigned short utf8_to_euc_E5B0[] = {
+ 0, 0, 0, 0, 0, 0, 0x355C, 0,
+ 0x3A4B, 0, 0, 0x3332, 0x3163, 0x3E2C, 0x3248, 0,
+ 0x5562, 0x4D46, 0, 0, 0, 0, 0, 0x3D49,
+};
+unsigned short utf8_to_euc_E5AF[] = {
+ 0x796B, 0, 0x3C64, 0x5563, 0x3473, 0x4652, 0x4C29, 0x5564,
+ 0, 0x5565, 0, 0, 0x4959, 0, 0, 0,
+ 0x5567, 0, 0x3428, 0x3677, 0x5566, 0, 0, 0,
+ 0x796D, 0, 0, 0x3432, 0, 0x3F32, 0x556B, 0x3B21,
+ 0, 0x3249, 0x556A, 0, 0x5568, 0x556C, 0x5569, 0x472B,
+ 0x5C4D, 0x3F33, 0, 0x556D, 0x796E, 0, 0x4E40, 0,
+ 0x556E, 0, 0, 0x5570, 0, 0x437E, 0x556F, 0,
+ 0x4023, 0, 0x3B7B, 0, 0, 0, 0x4250, 0x3C77,
+};
+unsigned short utf8_to_euc_E5B0[] = {
0, 0x4975, 0x406C, 0, 0x3C4D, 0x5571, 0x3E2D, 0x5572,
- 0x5573, 0x3053, 0x423A, 0x3F52, 0xBA69, 0x5574, 0x4633, 0x3E2E,
- 0, 0x3E2F, 0, 0x5575, 0, 0, 0x406D, 0xBA6A,
- 0, 0, 0x3E30, 0, 0, 0, 0xBA6B, 0xBA6C,
- 0x5576, 0, 0x5577, 0xBA6D, 0x4C60, 0, 0xBA6E, 0,
- 0x5578, 0xBA6F, 0, 0xBA70, 0xBA71, 0x3646, 0xBA72, 0,
- 0xBA73, 0x3D22, 0xBA74, 0, 0, 0xBA75, 0xBA76, 0,
+ 0x5573, 0x3053, 0x423A, 0x3F52, 0, 0x5574, 0x4633, 0x3E2E,
+ 0, 0x3E2F, 0, 0x5575, 0, 0, 0x406D, 0,
+ 0, 0, 0x3E30, 0, 0, 0, 0x796F, 0,
+ 0x5576, 0, 0x5577, 0, 0x4C60, 0, 0, 0,
+ 0x5578, 0, 0, 0, 0, 0x3646, 0, 0,
+ 0, 0x3D22, 0, 0, 0, 0, 0, 0,
0x5579, 0x557A, 0x3C5C, 0x3F2C, 0x4674, 0x3F54, 0x4878, 0x4722,
};
-const unsigned short utf8_to_euc_E5B1[] = {
+unsigned short utf8_to_euc_E5B1[] = {
0x3649, 0x557B, 0, 0, 0, 0x356F, 0x557C, 0,
0x367E, 0, 0x464F, 0x3230, 0, 0x3B53, 0x557D, 0x5622,
0x5621, 0x367D, 0, 0x557E, 0, 0x4538, 0, 0,
- 0, 0xBA77, 0xBA78, 0, 0xBA79, 0, 0x4230, 0,
- 0x454B, 0x3C48, 0xBA7A, 0xBA7B, 0x4158, 0x4D7A, 0, 0xBA7C,
- 0xBA7D, 0xBA7E, 0, 0, 0x5624, 0xBB21, 0x5625, 0x4656,
- 0xBB22, 0x3B33, 0, 0, 0xBB23, 0xBB24, 0x5627, 0,
- 0, 0x5628, 0xBB25, 0xBB26, 0xBB27, 0xBB28, 0, 0,
-};
-const unsigned short utf8_to_euc_E5B2[] = {
- 0, 0, 0, 0, 0, 0, 0, 0xBB29,
- 0xBB2A, 0, 0xBB2B, 0, 0x5629, 0, 0, 0xBB2C,
- 0x3474, 0x562A, 0xBB2D, 0, 0x562B, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xBB2E, 0, 0xBB2F,
- 0xBB30, 0x322C, 0xBB31, 0xBB32, 0, 0, 0xBB33, 0,
- 0x413B, 0x3464, 0xBB34, 0x562D, 0x4C28, 0, 0, 0,
- 0, 0x4252, 0xBB35, 0x3359, 0xBB36, 0xBB37, 0x562F, 0x5631,
- 0x345F, 0, 0xBB38, 0x562E, 0x5630, 0, 0x5633, 0,
-};
-const unsigned short utf8_to_euc_E5B3[] = {
+ 0, 0, 0, 0, 0, 0, 0x4230, 0,
+ 0x454B, 0x3C48, 0, 0, 0x4158, 0x4D7A, 0, 0,
+ 0, 0, 0, 0, 0x5624, 0, 0x5625, 0x4656,
+ 0, 0x3B33, 0, 0, 0, 0, 0x5627, 0,
+ 0, 0x5628, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E5B2[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5629, 0, 0, 0,
+ 0x3474, 0x562A, 0, 0, 0x562B, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x322C, 0, 0, 0, 0, 0x7970, 0,
+ 0x413B, 0x3464, 0, 0x562D, 0x4C28, 0, 0, 0,
+ 0, 0x4252, 0, 0x3359, 0, 0, 0x562F, 0x5631,
+ 0x345F, 0, 0x7971, 0x562E, 0x5630, 0, 0x5633, 0,
+};
+unsigned short utf8_to_euc_E5B3[] = {
0, 0, 0, 0, 0, 0x5632, 0, 0x5634,
- 0, 0xBB39, 0, 0xBB3A, 0, 0, 0, 0,
- 0, 0, 0xBB3B, 0, 0, 0, 0, 0xBB3D,
- 0, 0x5635, 0, 0, 0, 0xBB3C, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x5635, 0, 0, 0, 0, 0, 0,
0x463D, 0x362E, 0, 0, 0, 0, 0, 0,
- 0x3265, 0x5636, 0x563B, 0, 0, 0x5639, 0xBB3E, 0x4A77,
- 0x4A76, 0xBB3F, 0xBB40, 0, 0xBB41, 0xF43B, 0x4567, 0,
+ 0x3265, 0x5636, 0x563B, 0, 0, 0x5639, 0, 0x4A77,
+ 0x4A76, 0, 0, 0, 0, 0x7972, 0x4567, 0,
0, 0, 0x5638, 0x3D54, 0, 0x5637, 0, 0,
};
-const unsigned short utf8_to_euc_E5B4[] = {
- 0, 0xBB42, 0, 0, 0, 0, 0xBB43, 0x3F72,
- 0, 0, 0, 0x563C, 0, 0xBB44, 0x3A6A, 0,
- 0, 0x5642, 0xBB45, 0, 0x5643, 0x563D, 0x3333, 0x563E,
+unsigned short utf8_to_euc_E5B4[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x3F72,
+ 0, 0, 0, 0x563C, 0, 0, 0x3A6A, 0,
+ 0, 0x5642, 0, 0, 0x5643, 0x563D, 0x3333, 0x563E,
0x5647, 0x5646, 0x5645, 0x5641, 0, 0, 0, 0x5640,
- 0, 0, 0x5644, 0xBB47, 0xBB48, 0, 0xBB49, 0xBB4A,
- 0, 0x4A78, 0, 0xBB46, 0, 0, 0, 0,
- 0, 0xBB4B, 0, 0, 0xBB4C, 0, 0, 0,
- 0, 0xBB4D, 0, 0, 0, 0xBB4E, 0, 0xBB4F,
-};
-const unsigned short utf8_to_euc_E5B5[] = {
- 0, 0, 0xBB50, 0xBB51, 0, 0, 0xBB52, 0,
- 0xBB53, 0, 0xBB57, 0x564B, 0x5648, 0, 0x564A, 0,
- 0x4D72, 0xBB55, 0x5649, 0xF43C, 0, 0xBB54, 0, 0,
- 0, 0xBB56, 0, 0, 0x563F, 0, 0, 0xBB58,
- 0xBB59, 0xBB5A, 0xBB5B, 0, 0xBB5C, 0, 0, 0,
- 0, 0x3F73, 0xBB5D, 0, 0x564C, 0xBB5E, 0, 0x3A37,
- 0xBB5F, 0, 0, 0x564D, 0, 0, 0x564E, 0,
- 0, 0xBB60, 0xBB61, 0, 0, 0, 0xBB62, 0xBB63,
-};
-const unsigned short utf8_to_euc_E5B6[] = {
- 0, 0xBB64, 0x5651, 0xBB65, 0x5650, 0, 0, 0x564F,
- 0xBB66, 0, 0xBB67, 0x4568, 0x563A, 0, 0, 0,
- 0x5657, 0, 0xBB68, 0xBB69, 0xBB6A, 0xBB6B, 0, 0,
- 0, 0xBB6C, 0, 0xBB6D, 0, 0x5653, 0, 0xBB6E,
- 0xBB6F, 0, 0x5652, 0, 0, 0, 0, 0xBB70,
- 0, 0, 0, 0xBB71, 0x5654, 0, 0x5655, 0,
- 0xBB72, 0, 0xE674, 0, 0xBB73, 0, 0, 0x5658,
- 0xBB74, 0xBB75, 0x4E66, 0, 0x5659, 0x5656, 0, 0,
-};
-const unsigned short utf8_to_euc_E5B7[] = {
- 0, 0, 0, 0xBB76, 0, 0, 0, 0xBB77,
- 0, 0x565A, 0, 0xBB78, 0x3460, 0x565B, 0xBB7A, 0,
- 0xBB79, 0, 0x565D, 0x565C, 0, 0, 0x565E, 0,
- 0xBB7B, 0xBB7C, 0, 0x565F, 0, 0x406E, 0x3D23, 0,
- 0xBB7D, 0x3D64, 0, 0x4163, 0xBB7E, 0x3929, 0x3A38, 0x392A,
- 0x3570, 0xBC21, 0, 0x5660, 0, 0, 0x3A39, 0,
+ 0, 0, 0x5644, 0, 0, 0, 0, 0x7973,
+ 0, 0x4A78, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E5B5[] = {
+ 0, 0, 0x7976, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x564B, 0x5648, 0, 0x564A, 0,
+ 0x4D72, 0, 0x5649, 0x7974, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x563F, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x3F73, 0, 0, 0x564C, 0x7977, 0, 0x3A37,
+ 0, 0, 0, 0x564D, 0, 0, 0x564E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E5B6[] = {
+ 0, 0, 0x5651, 0, 0x5650, 0, 0, 0x564F,
+ 0, 0, 0, 0x4568, 0x563A, 0, 0, 0,
+ 0x5657, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x5653, 0, 0,
+ 0, 0, 0x5652, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5654, 0, 0x5655, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x5658,
+ 0x7978, 0x7979, 0x4E66, 0, 0x5659, 0x5656, 0, 0,
+};
+unsigned short utf8_to_euc_E5B7[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x565A, 0, 0, 0x3460, 0x565B, 0, 0,
+ 0x797A, 0, 0x565D, 0x565C, 0, 0, 0x565E, 0,
+ 0, 0, 0, 0x565F, 0, 0x406E, 0x3D23, 0,
+ 0, 0x3D64, 0, 0x4163, 0, 0x3929, 0x3A38, 0x392A,
+ 0x3570, 0, 0, 0x5660, 0, 0, 0x3A39, 0,
0, 0x384A, 0x5661, 0x4C26, 0x4743, 0x5662, 0, 0x392B,
- 0xBC22, 0xBC23, 0, 0x342C, 0, 0x4327, 0x3652, 0,
-};
-const unsigned short utf8_to_euc_E5B8[] = {
- 0xBC24, 0, 0x3B54, 0x495B, 0, 0, 0x4841, 0xBC25,
- 0, 0, 0, 0x5663, 0x3475, 0xBC26, 0, 0,
- 0, 0x5666, 0xBC27, 0, 0xBC28, 0xBC29, 0x4421, 0,
- 0xBC2A, 0x5665, 0x5664, 0x5667, 0, 0x446B, 0, 0xBC2B,
- 0xBC2C, 0, 0, 0, 0, 0x3F63, 0, 0,
- 0xBC2E, 0, 0, 0x3B55, 0, 0x404A, 0xBC2D, 0x4253,
- 0x3522, 0, 0xBC2F, 0x4422, 0, 0xBC30, 0x5668, 0x5669,
- 0x3E6F, 0, 0, 0, 0, 0x4B39, 0xBC31, 0,
-};
-const unsigned short utf8_to_euc_E5B9[] = {
+ 0, 0, 0, 0x342C, 0, 0x4327, 0x3652, 0,
+};
+unsigned short utf8_to_euc_E5B8[] = {
+ 0, 0, 0x3B54, 0x495B, 0, 0, 0x4841, 0,
+ 0, 0, 0, 0x5663, 0x3475, 0, 0, 0,
+ 0, 0x5666, 0, 0, 0, 0, 0x4421, 0,
+ 0, 0x5665, 0x5664, 0x5667, 0, 0x446B, 0, 0,
+ 0, 0, 0, 0, 0, 0x3F63, 0, 0,
+ 0, 0, 0, 0x3B55, 0, 0x404A, 0, 0x4253,
+ 0x3522, 0, 0, 0x4422, 0, 0, 0x5668, 0x5669,
+ 0x3E6F, 0, 0, 0, 0, 0x4B39, 0, 0,
+};
+unsigned short utf8_to_euc_E5B9[] = {
0x566C, 0, 0, 0x566B, 0x566A, 0x497D, 0, 0x5673,
- 0, 0xBC34, 0, 0xBC32, 0x4B5A, 0, 0x566D, 0,
- 0xBC33, 0xBC35, 0, 0, 0x566F, 0x4B6B, 0xBC36, 0x566E,
- 0xBC37, 0, 0, 0xBC38, 0xBC39, 0, 0xBC3A, 0x5670,
+ 0, 0, 0, 0, 0x4B5A, 0, 0x566D, 0,
+ 0, 0, 0, 0, 0x566F, 0x4B6B, 0, 0x566E,
+ 0, 0, 0, 0, 0, 0, 0, 0x5670,
0, 0x4828, 0x5671, 0x4A3E, 0x5672, 0, 0, 0,
- 0xBC3B, 0, 0xBC3C, 0xBC3D, 0xBC3E, 0xBC3F, 0xBC40, 0,
- 0xBC41, 0, 0x3433, 0x4A3F, 0x472F, 0x5674, 0x5675, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3433, 0x4A3F, 0x472F, 0x5674, 0x5675, 0,
0x392C, 0x3434, 0x5676, 0x3838, 0x4D44, 0x4D29, 0x3476, 0x5678,
};
-const unsigned short utf8_to_euc_E5BA[] = {
- 0xBC42, 0x4423, 0, 0x392D, 0x3E31, 0, 0, 0x485F,
- 0, 0, 0x3E32, 0xBC43, 0, 0, 0xBC44, 0x3D78,
+unsigned short utf8_to_euc_E5BA[] = {
+ 0, 0x4423, 0, 0x392D, 0x3E31, 0, 0, 0x485F,
+ 0, 0, 0x3E32, 0, 0, 0, 0, 0x3D78,
0, 0, 0, 0, 0, 0x446C, 0x4A79, 0x4539,
0, 0, 0x392E, 0, 0x495C, 0, 0, 0,
- 0x5679, 0, 0xBC45, 0, 0xBC46, 0xBC47, 0x4559, 0x3A42,
- 0xBC48, 0, 0xBC49, 0x384B, 0xBC4A, 0x446D, 0, 0,
- 0, 0xBC4B, 0, 0xBC4C, 0, 0x3043, 0x3D6E, 0x392F,
- 0x4D47, 0, 0, 0, 0, 0xBC4D, 0xBC4E, 0xBC4F,
-};
-const unsigned short utf8_to_euc_E5BB[] = {
- 0, 0x567A, 0x567B, 0x4751, 0, 0, 0xBC50, 0,
- 0x567C, 0x4E77, 0x4F2D, 0xBC52, 0xBC51, 0, 0xBC53, 0x567E,
- 0x567D, 0xBC54, 0xBC55, 0x3347, 0xBC56, 0xBC57, 0x5721, 0,
- 0, 0, 0x5724, 0x5725, 0xBC58, 0x5723, 0xBC59, 0x4940,
- 0x3E33, 0x5727, 0x5726, 0x5722, 0, 0xBC5A, 0, 0,
- 0x5728, 0x5729, 0, 0xBC5B, 0x572A, 0, 0, 0,
+ 0x5679, 0, 0, 0, 0, 0, 0x4559, 0x3A42,
+ 0, 0, 0, 0x384B, 0, 0x446D, 0, 0,
+ 0, 0, 0, 0, 0, 0x3043, 0x3D6E, 0x392F,
+ 0x4D47, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E5BB[] = {
+ 0, 0x567A, 0x567B, 0x4751, 0, 0, 0, 0,
+ 0x567C, 0x4E77, 0x4F2D, 0, 0, 0, 0, 0x567E,
+ 0x567D, 0, 0, 0x3347, 0, 0, 0x5721, 0,
+ 0, 0, 0x5724, 0x5725, 0, 0x5723, 0, 0x4940,
+ 0x3E33, 0x5727, 0x5726, 0x5722, 0, 0, 0, 0,
+ 0x5728, 0x5729, 0, 0, 0x572A, 0, 0, 0,
0x572D, 0x572B, 0, 0x572C, 0x572E, 0, 0x3164, 0x446E,
0x572F, 0, 0x377A, 0x3276, 0x4736, 0, 0x5730, 0x467B,
};
-const unsigned short utf8_to_euc_E5BC[] = {
- 0, 0x4A5B, 0xBC5C, 0x5731, 0x4F2E, 0, 0xBC5D, 0xBC5E,
- 0xBC5F, 0x5732, 0x4A40, 0x5735, 0x5021, 0x5031, 0xBC60, 0x3C30,
+unsigned short utf8_to_euc_E5BC[] = {
+ 0, 0x4A5B, 0, 0x5731, 0x4F2E, 0, 0, 0,
+ 0, 0x5732, 0x4A40, 0x5735, 0x5021, 0x5031, 0, 0x3C30,
0x4675, 0x5736, 0, 0x355D, 0x4424, 0x307A, 0x5737, 0x4A26,
- 0x3930, 0xBC61, 0, 0x4350, 0xBC62, 0xBC63, 0, 0x446F,
- 0, 0xBC64, 0xBC65, 0xBC66, 0xBC67, 0x4C6F, 0x3839, 0x384C,
- 0xBC68, 0x5738, 0, 0xBC69, 0xBC6A, 0x5739, 0xBC6B, 0x573F,
- 0xBC6C, 0x3C65, 0, 0, 0xBC6D, 0x4425, 0xBC6E, 0x362F,
- 0x573A, 0, 0, 0xBC6F, 0x492B, 0xBC70, 0x4346, 0xBC71,
-};
-const unsigned short utf8_to_euc_E5BD[] = {
- 0xBC72, 0x573B, 0, 0, 0xBC73, 0xBC74, 0, 0xBC75,
- 0x573C, 0, 0x3630, 0, 0x573D, 0xBC76, 0x573E, 0,
- 0xBC77, 0x5740, 0, 0x4576, 0xBC78, 0, 0x5741, 0x5742,
- 0xBC79, 0x5743, 0, 0xBC7A, 0x5734, 0x5733, 0, 0,
- 0xBC7B, 0x5744, 0x3741, 0xBC7C, 0xBC7D, 0, 0x4927, 0xBC7E,
- 0, 0x3A4C, 0x4937, 0x4426, 0x494B, 0x5745, 0, 0xBD21,
- 0x3E34, 0x3146, 0xBD22, 0x5746, 0xBD23, 0xBD24, 0, 0x5747,
- 0xBD25, 0x4C72, 0xBD26, 0, 0x4860, 0xBD27, 0xBD28, 0x574A,
-};
-const unsigned short utf8_to_euc_E5BE[] = {
+ 0x3930, 0, 0, 0x4350, 0, 0, 0, 0x446F,
+ 0, 0x797B, 0, 0, 0, 0x4C6F, 0x3839, 0x384C,
+ 0, 0x5738, 0, 0, 0, 0x5739, 0, 0x573F,
+ 0, 0x3C65, 0, 0, 0x797C, 0x4425, 0, 0x362F,
+ 0x573A, 0, 0, 0, 0x492B, 0, 0x4346, 0,
+};
+unsigned short utf8_to_euc_E5BD[] = {
+ 0, 0x573B, 0, 0, 0, 0x792C, 0, 0,
+ 0x573C, 0, 0x3630, 0, 0x573D, 0, 0x573E, 0,
+ 0, 0x5740, 0, 0x4576, 0, 0, 0x5741, 0x5742,
+ 0, 0x5743, 0, 0, 0x5734, 0x5733, 0, 0,
+ 0, 0x5744, 0x3741, 0, 0, 0, 0x4927, 0x797D,
+ 0, 0x3A4C, 0x4937, 0x4426, 0x494B, 0x5745, 0, 0,
+ 0x3E34, 0x3146, 0, 0x5746, 0, 0, 0, 0x5747,
+ 0, 0x4C72, 0, 0, 0x4860, 0, 0, 0x574A,
+};
+unsigned short utf8_to_euc_E5BE[] = {
0x317D, 0x402C, 0x5749, 0x5748, 0x3742, 0x4254, 0, 0x574E,
- 0x574C, 0xBD29, 0x574B, 0x4E27, 0x3865, 0xBD2A, 0, 0xBD2B,
- 0x3D79, 0x574D, 0x454C, 0x3D3E, 0, 0, 0xBD2C, 0x4640,
- 0x5751, 0x5750, 0, 0, 0xBD2D, 0xBD2E, 0x574F, 0,
- 0x5752, 0x3866, 0xBD2F, 0, 0xBD32, 0, 0, 0xBD30,
- 0x5753, 0x497C, 0x3D5B, 0xBD31, 0xBD33, 0x5754, 0x4879, 0xBD34,
- 0xBD35, 0xBD36, 0, 0x4641, 0x4427, 0, 0, 0xF43E,
- 0xBD37, 0x4530, 0, 0, 0x5755, 0x352B, 0, 0,
-};
-const unsigned short utf8_to_euc_E5BF[] = {
- 0, 0, 0, 0x3F34, 0xBD38, 0x492C, 0, 0xBD39,
- 0xBD3A, 0xBD3B, 0, 0xBD3C, 0x3477, 0x4726, 0, 0,
- 0xBD3D, 0xBD3E, 0xBD3F, 0xBD40, 0xBD41, 0, 0x5756, 0x3B56,
- 0x4B3A, 0x4B3B, 0, 0, 0x317E, 0x575B, 0xBD42, 0,
- 0x4369, 0xBD43, 0xBD44, 0, 0x5758, 0, 0, 0,
- 0xBD45, 0xBD46, 0xBD47, 0x3277, 0xBD48, 0xBD49, 0xBD4A, 0xBD4B,
- 0x582D, 0x575A, 0xBD4C, 0xBD4D, 0, 0x4730, 0xBD4E, 0,
- 0x5759, 0, 0xBD4F, 0x5757, 0xBD50, 0x397A, 0, 0x575D,
-};
-const unsigned short utf8_to_euc_E680[] = {
- 0, 0, 0, 0, 0, 0, 0, 0xBD51,
- 0, 0, 0xBD52, 0, 0, 0xBD53, 0x5763, 0x5769,
- 0x5761, 0, 0x455C, 0xBD54, 0xBD55, 0x5766, 0x495D, 0xBD56,
- 0xBD57, 0x5760, 0xBD58, 0x5765, 0x4E67, 0x3B57, 0, 0xBD59,
- 0x4255, 0x575E, 0, 0, 0xBD5A, 0x355E, 0x5768, 0x402D,
- 0x3165, 0x5762, 0x3278, 0x5767, 0, 0xBD5B, 0, 0x3631,
- 0, 0x5764, 0, 0xBD5C, 0, 0xBD5D, 0, 0,
+ 0x574C, 0, 0x574B, 0x4E27, 0x3865, 0, 0, 0,
+ 0x3D79, 0x574D, 0x454C, 0x3D3E, 0, 0, 0, 0x4640,
+ 0x5751, 0x5750, 0, 0, 0, 0, 0x574F, 0,
+ 0x5752, 0x3866, 0, 0, 0, 0, 0, 0,
+ 0x5753, 0x497C, 0x3D5B, 0, 0, 0x5754, 0x4879, 0,
+ 0, 0, 0, 0x4641, 0x4427, 0, 0, 0x797E,
+ 0, 0x4530, 0, 0, 0x5755, 0x352B, 0, 0,
+};
+unsigned short utf8_to_euc_E5BF[] = {
+ 0, 0, 0, 0x3F34, 0, 0x492C, 0, 0,
+ 0, 0, 0, 0, 0x3477, 0x4726, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x5756, 0x3B56,
+ 0x4B3A, 0x4B3B, 0, 0, 0x317E, 0x575B, 0x7A21, 0,
+ 0x4369, 0, 0, 0, 0x5758, 0, 0, 0,
+ 0, 0, 0, 0x3277, 0, 0, 0, 0,
+ 0x582D, 0x575A, 0, 0, 0, 0x4730, 0, 0,
+ 0x5759, 0, 0, 0x5757, 0, 0x397A, 0, 0x575D,
+};
+unsigned short utf8_to_euc_E680[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x5763, 0x5769,
+ 0x5761, 0, 0x455C, 0, 0, 0x5766, 0x495D, 0,
+ 0, 0x5760, 0, 0x5765, 0x4E67, 0x3B57, 0, 0,
+ 0x4255, 0x575E, 0, 0, 0, 0x355E, 0x5768, 0x402D,
+ 0x3165, 0x5762, 0x3278, 0x5767, 0, 0, 0, 0x3631,
+ 0, 0x5764, 0, 0, 0, 0, 0, 0,
0, 0, 0x576A, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E681[] = {
- 0xBD5E, 0x576C, 0x5776, 0x5774, 0, 0, 0x5771, 0xBD5F,
- 0xBD60, 0xBD61, 0x5770, 0x4E78, 0xBD62, 0x5772, 0, 0,
- 0x3632, 0xBD63, 0x3931, 0, 0xBD64, 0x3D7A, 0xBD65, 0xBD66,
- 0, 0x5779, 0x576B, 0, 0, 0xBD67, 0, 0x576F,
- 0x575F, 0xBD68, 0x327A, 0x5773, 0x5775, 0x4351, 0, 0xBD69,
+unsigned short utf8_to_euc_E681[] = {
+ 0, 0x576C, 0x5776, 0x5774, 0, 0, 0x5771, 0,
+ 0, 0, 0x5770, 0x4E78, 0, 0x5772, 0, 0,
+ 0x3632, 0, 0x3931, 0, 0, 0x3D7A, 0, 0,
+ 0, 0x5779, 0x576B, 0, 0, 0x7A22, 0, 0x576F,
+ 0x575F, 0, 0x327A, 0x5773, 0x5775, 0x4351, 0, 0,
0x3A28, 0x3238, 0x576D, 0x5778, 0x5777, 0x3633, 0, 0x4229,
- 0x3366, 0xBD6A, 0, 0, 0, 0x3743, 0, 0x576E,
- 0, 0, 0, 0, 0, 0, 0xBD6B, 0xBD6C,
-};
-const unsigned short utf8_to_euc_E682[] = {
- 0, 0x577A, 0xBD6D, 0x577D, 0x5821, 0xF43F, 0xBD6E, 0,
- 0xBD6F, 0x3C3D, 0xBD70, 0x5827, 0x4470, 0x577B, 0xBD71, 0,
- 0, 0xBD72, 0x5825, 0xBD73, 0x3279, 0xBD74, 0x5823, 0x5824,
- 0xBD75, 0, 0x577E, 0x5822, 0, 0xBD76, 0xBD77, 0x3867,
- 0x4D2A, 0, 0xBD78, 0x3435, 0xBD79, 0xBD7A, 0x3159, 0x5826,
- 0xBD7B, 0x473A, 0x302D, 0, 0, 0, 0, 0,
- 0xBD7C, 0xBD7D, 0x4861, 0x575C, 0x582C, 0x5830, 0x4C65, 0xBD7E,
- 0x5829, 0, 0, 0xBE21, 0x4569, 0x582E, 0xBE22, 0,
-};
-const unsigned short utf8_to_euc_E683[] = {
- 0, 0, 0xBE23, 0, 0xBE24, 0x3E70, 0x582F, 0x4657,
- 0xBE25, 0xBE26, 0xBE27, 0xBE28, 0, 0, 0xBE29, 0xBE2A,
- 0, 0x4F47, 0, 0x582B, 0xBE2B, 0xBE2C, 0, 0,
- 0x5831, 0xBE2D, 0x397B, 0xBE2E, 0x404B, 0xBE2F, 0xBE30, 0x3054,
- 0x582A, 0x5828, 0xBE31, 0x415A, 0, 0xBE32, 0, 0x577C,
+ 0x3366, 0, 0, 0, 0, 0x3743, 0, 0x576E,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E682[] = {
+ 0, 0x577A, 0, 0x577D, 0x5821, 0x7A23, 0, 0,
+ 0, 0x3C3D, 0x7A24, 0x5827, 0x4470, 0x577B, 0, 0,
+ 0, 0, 0x5825, 0, 0x3279, 0, 0x5823, 0x5824,
+ 0, 0, 0x577E, 0x5822, 0, 0, 0, 0x3867,
+ 0x4D2A, 0, 0, 0x3435, 0, 0, 0x3159, 0x5826,
+ 0, 0x473A, 0x302D, 0, 0, 0, 0, 0,
+ 0, 0, 0x4861, 0x575C, 0x582C, 0x5830, 0x4C65, 0,
+ 0x5829, 0, 0, 0, 0x4569, 0x582E, 0, 0,
+};
+unsigned short utf8_to_euc_E683[] = {
+ 0, 0, 0, 0, 0, 0x3E70, 0x582F, 0x4657,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x4F47, 0, 0x582B, 0, 0x7A26, 0, 0,
+ 0x5831, 0, 0x397B, 0, 0x404B, 0, 0x7A25, 0x3054,
+ 0x582A, 0x5828, 0, 0x415A, 0, 0, 0, 0x577C,
0x3B34, 0, 0, 0, 0, 0, 0, 0,
- 0x4246, 0x583D, 0xBE33, 0x415B, 0x5838, 0xBE34, 0x5835, 0x5836,
- 0xBE35, 0x3C66, 0x5839, 0x583C, 0xBE36, 0xBE37, 0, 0,
-};
-const unsigned short utf8_to_euc_E684[] = {
- 0x5837, 0x3D25, 0xBE38, 0x583A, 0, 0, 0x5834, 0xBE39,
- 0x4C7C, 0x4C7B, 0xBE3A, 0, 0xBE3B, 0x583E, 0x583F, 0x3055,
- 0xBE3C, 0xBE3D, 0xBE3E, 0xBE3F, 0xBE40, 0x5833, 0xBE41, 0xBE42,
- 0, 0xBE43, 0x3672, 0x3026, 0xBE44, 0, 0xBE45, 0x3436,
- 0xF440, 0x583B, 0xBE46, 0, 0, 0, 0, 0x5843,
- 0x5842, 0, 0xBE47, 0xBE48, 0x5847, 0, 0, 0,
- 0xBE49, 0xBE4A, 0, 0, 0x5848, 0xBE4B, 0xBE4C, 0xBE4D,
- 0, 0xBE4E, 0, 0, 0x5846, 0x5849, 0x5841, 0x5845,
-};
-const unsigned short utf8_to_euc_E685[] = {
- 0, 0xBE4F, 0x584A, 0, 0x584B, 0xBE50, 0xBE51, 0x5840,
- 0x3B7C, 0xBE52, 0x5844, 0x4256, 0x3932, 0x5832, 0x3F35, 0,
+ 0x4246, 0x583D, 0x7A28, 0x415B, 0x5838, 0, 0x5835, 0x5836,
+ 0, 0x3C66, 0x5839, 0x583C, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E684[] = {
+ 0x5837, 0x3D25, 0, 0x583A, 0, 0, 0x5834, 0,
+ 0x4C7C, 0x4C7B, 0, 0, 0, 0x583E, 0x583F, 0x3055,
+ 0, 0x7A29, 0, 0, 0, 0x5833, 0, 0,
+ 0, 0, 0x3672, 0x3026, 0, 0, 0, 0x3436,
+ 0x7A27, 0x583B, 0, 0, 0, 0, 0, 0x5843,
+ 0x5842, 0, 0, 0, 0x5847, 0, 0, 0,
+ 0x7A2B, 0, 0, 0, 0x5848, 0, 0, 0x7A2A,
+ 0, 0, 0, 0, 0x5846, 0x5849, 0x5841, 0x5845,
+};
+unsigned short utf8_to_euc_E685[] = {
+ 0, 0, 0x584A, 0, 0x584B, 0, 0, 0x5840,
+ 0x3B7C, 0, 0x5844, 0x4256, 0x3932, 0x5832, 0x3F35, 0,
0, 0, 0, 0x5858, 0, 0x4A69, 0, 0,
- 0x584E, 0x584F, 0x5850, 0, 0, 0x5857, 0xBE53, 0x5856,
- 0xBE54, 0, 0x4B7D, 0x3437, 0, 0x5854, 0, 0x3745,
- 0x3334, 0, 0, 0x5851, 0xBE55, 0, 0x4E38, 0x5853,
- 0x3056, 0x5855, 0xBE56, 0x584C, 0x5852, 0x5859, 0x3744, 0x584D,
- 0xBE57, 0, 0, 0xBE58, 0xBE59, 0, 0x4D5D, 0xBE5A,
-};
-const unsigned short utf8_to_euc_E686[] = {
- 0xBE5B, 0xBE5C, 0x4D2B, 0xBE5D, 0xBE5E, 0, 0, 0x585C,
- 0, 0, 0x5860, 0xBE5F, 0, 0xBE60, 0x417E, 0,
- 0x4E79, 0x5861, 0xBE61, 0xBE62, 0x585E, 0, 0x585B, 0xBE63,
- 0xBE64, 0x585A, 0x585F, 0, 0xBE65, 0xBE66, 0, 0xBE67,
- 0xBE68, 0, 0, 0, 0x4A30, 0xBE69, 0, 0x4634,
- 0xBE6A, 0x3746, 0xBE6B, 0x5862, 0x585D, 0xBE6C, 0x5863, 0,
+ 0x584E, 0x584F, 0x5850, 0, 0, 0x5857, 0, 0x5856,
+ 0, 0, 0x4B7D, 0x3437, 0, 0x5854, 0, 0x3745,
+ 0x3334, 0, 0, 0x5851, 0, 0, 0x4E38, 0x5853,
+ 0x3056, 0x5855, 0, 0x584C, 0x5852, 0x5859, 0x3744, 0x584D,
+ 0, 0, 0, 0, 0, 0, 0x4D5D, 0,
+};
+unsigned short utf8_to_euc_E686[] = {
+ 0, 0, 0x4D2B, 0, 0, 0, 0, 0x585C,
+ 0, 0, 0x5860, 0, 0, 0, 0x417E, 0,
+ 0x4E79, 0x5861, 0, 0, 0x585E, 0, 0x585B, 0,
+ 0x7A2C, 0x585A, 0x585F, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x4A30, 0, 0, 0x4634,
+ 0, 0x3746, 0, 0x5862, 0x585D, 0, 0x5863, 0,
0, 0, 0x377B, 0, 0, 0, 0x3231, 0,
- 0xBE6D, 0xBE6E, 0x586B, 0, 0xBE6F, 0, 0x3438, 0,
-};
-const unsigned short utf8_to_euc_E687[] = {
- 0xBE70, 0xBE71, 0xBE72, 0x5869, 0, 0, 0x586A, 0x3A29,
- 0x5868, 0x5866, 0x5865, 0x586C, 0x5864, 0x586E, 0xBE73, 0xBE74,
- 0x327B, 0, 0, 0, 0, 0xBE75, 0, 0,
- 0, 0, 0, 0, 0xBE76, 0xBE77, 0xBE78, 0xBE79,
- 0, 0xBE7A, 0xBE7B, 0x5870, 0, 0xBE7E, 0x586F, 0xBE7C,
- 0, 0xBE7D, 0, 0, 0xBF21, 0xBF22, 0, 0xBF23,
+ 0, 0, 0x586B, 0, 0, 0, 0x3438, 0,
+};
+unsigned short utf8_to_euc_E687[] = {
+ 0, 0, 0, 0x5869, 0, 0, 0x586A, 0x3A29,
+ 0x5868, 0x5866, 0x5865, 0x586C, 0x5864, 0x586E, 0, 0,
+ 0x327B, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x5870, 0, 0, 0x586F, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x4428, 0, 0x5873, 0, 0x5871, 0x5867,
0x377C, 0, 0x5872, 0, 0x5876, 0x5875, 0x5877, 0x5874,
};
-const unsigned short utf8_to_euc_E688[] = {
- 0x5878, 0xBF24, 0, 0xBF25, 0xBF26, 0, 0, 0xBF27,
+unsigned short utf8_to_euc_E688[] = {
+ 0x5878, 0, 0, 0, 0, 0, 0, 0,
0x5879, 0x587A, 0x4A6A, 0, 0x587C, 0x587B, 0x3D3F, 0,
- 0x402E, 0x3266, 0x327C, 0xBF28, 0x587D, 0xBF29, 0x303F, 0,
- 0, 0, 0x404C, 0x587E, 0xBF2A, 0x6C43, 0x5921, 0x3761,
- 0xBF2B, 0x5922, 0xBF2C, 0xBF2D, 0, 0, 0x406F, 0xBF2E,
- 0, 0xBF2F, 0x5923, 0xBF30, 0, 0, 0x5924, 0x353A,
+ 0x402E, 0x3266, 0x327C, 0x7A2D, 0x587D, 0, 0x303F, 0,
+ 0, 0, 0x404C, 0x587E, 0, 0x6C43, 0x5921, 0x3761,
+ 0, 0x5922, 0, 0, 0, 0, 0x406F, 0,
+ 0, 0, 0x5923, 0, 0, 0, 0x5924, 0x353A,
0x5925, 0, 0x5926, 0x5927, 0x4257, 0, 0, 0,
- 0x384D, 0xBF31, 0, 0x4C61, 0, 0xBF32, 0, 0x4B3C,
-};
-const unsigned short utf8_to_euc_E689[] = {
- 0x3D6A, 0x5928, 0xBF33, 0xBF34, 0xBF35, 0, 0xBF36, 0x4070,
- 0x6E3D, 0x4862, 0, 0x3C6A, 0xBF37, 0x3A4D, 0x5929, 0,
- 0xBF38, 0xBF39, 0xBF3A, 0x4247, 0xBF3B, 0x4A27, 0xBF3C, 0,
- 0x4271, 0, 0xBF3D, 0x592C, 0xBF3E, 0, 0x592A, 0,
- 0x592D, 0, 0, 0x592B, 0xBF3F, 0, 0, 0,
- 0x592E, 0, 0, 0, 0, 0xBF40, 0x4A31, 0xBF41,
- 0, 0x3037, 0, 0xBF42, 0, 0, 0x495E, 0,
- 0, 0x4863, 0xBF43, 0, 0x592F, 0xBF44, 0x5932, 0x3E35,
-};
-const unsigned short utf8_to_euc_E68A[] = {
+ 0x384D, 0, 0, 0x4C61, 0, 0, 0, 0x4B3C,
+};
+unsigned short utf8_to_euc_E689[] = {
+ 0x3D6A, 0x5928, 0, 0, 0, 0, 0, 0x4070,
+ 0x6E3D, 0x4862, 0, 0x3C6A, 0, 0x3A4D, 0x5929, 0,
+ 0, 0, 0, 0x4247, 0, 0x4A27, 0, 0,
+ 0x4271, 0, 0, 0x592C, 0, 0, 0x592A, 0,
+ 0x592D, 0, 0, 0x592B, 0, 0, 0, 0,
+ 0x592E, 0, 0, 0, 0, 0, 0x4A31, 0,
+ 0, 0x3037, 0, 0, 0, 0, 0x495E, 0,
+ 0, 0x4863, 0, 0, 0x592F, 0, 0x5932, 0x3E35,
+};
+unsigned short utf8_to_euc_E68A[] = {
0x353B, 0, 0x5930, 0x5937, 0x3E36, 0, 0, 0,
- 0, 0x5931, 0x4744, 0, 0, 0xBF45, 0xBF46, 0xBF47,
- 0xBF48, 0x4D5E, 0x5933, 0x5934, 0x5938, 0x456A, 0x5935, 0x3933,
+ 0, 0x5931, 0x4744, 0, 0, 0, 0, 0,
+ 0, 0x4D5E, 0x5933, 0x5934, 0x5938, 0x456A, 0x5935, 0x3933,
0x405E, 0, 0, 0x5946, 0x4834, 0, 0x4272, 0,
- 0, 0, 0, 0, 0, 0, 0xBF49, 0,
- 0xBF4A, 0, 0, 0x4864, 0x5A2D, 0, 0, 0,
- 0, 0x4A7A, 0, 0xBF4B, 0, 0x4471, 0xBF4C, 0xBF4D,
- 0, 0x4B75, 0xBF4E, 0x593B, 0x3221, 0x436A, 0xBF4F, 0xBF50,
-};
-const unsigned short utf8_to_euc_E68B[] = {
- 0, 0, 0x5944, 0, 0xBF51, 0x4334, 0x593E, 0x5945,
- 0x5940, 0x5947, 0x5943, 0, 0x5942, 0x476F, 0xBF52, 0x593C,
- 0x327D, 0x593A, 0x3571, 0x4273, 0x5936, 0xBF53, 0xBF54, 0x5939,
- 0x3934, 0x405B, 0xBF55, 0x3E37, 0x5941, 0x4752, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x7A2E, 0,
+ 0, 0, 0, 0x4864, 0x5A2D, 0, 0, 0,
+ 0, 0x4A7A, 0, 0, 0, 0x4471, 0, 0,
+ 0, 0x4B75, 0, 0x593B, 0x3221, 0x436A, 0, 0,
+};
+unsigned short utf8_to_euc_E68B[] = {
+ 0, 0, 0x5944, 0, 0, 0x4334, 0x593E, 0x5945,
+ 0x5940, 0x5947, 0x5943, 0, 0x5942, 0x476F, 0, 0x593C,
+ 0x327D, 0x593A, 0x3571, 0x4273, 0x5936, 0, 0, 0x5939,
+ 0x3934, 0x405B, 0, 0x3E37, 0x5941, 0x4752, 0, 0,
0x3572, 0x3348, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xBF56, 0, 0x3367, 0x3F21, 0x5949, 0x594E,
- 0, 0x594A, 0xBF57, 0x377D, 0xBF58, 0x594F, 0x3B22, 0x3969,
- 0, 0, 0, 0, 0xBF59, 0xBF5A, 0x3D26, 0x593D,
-};
-const unsigned short utf8_to_euc_E68C[] = {
- 0, 0x3B7D, 0x594C, 0xBF5B, 0xBF5C, 0, 0, 0x3B58,
- 0x594D, 0x3044, 0xBF5D, 0xBF5E, 0x5948, 0xBF5F, 0, 0,
- 0xBF60, 0x4429, 0, 0xBF61, 0, 0, 0xBF62, 0,
- 0xBF63, 0x3573, 0, 0, 0, 0, 0, 0x3634,
+ 0, 0, 0, 0, 0x3367, 0x3F21, 0x5949, 0x594E,
+ 0, 0x594A, 0, 0x377D, 0, 0x594F, 0x3B22, 0x3969,
+ 0, 0, 0, 0, 0, 0, 0x3D26, 0x593D,
+};
+unsigned short utf8_to_euc_E68C[] = {
+ 0, 0x3B7D, 0x594C, 0, 0, 0, 0, 0x3B58,
+ 0x594D, 0x3044, 0, 0, 0x5948, 0, 0, 0,
+ 0, 0x4429, 0, 0, 0, 0, 0, 0,
+ 0, 0x3573, 0, 0, 0, 0, 0, 0x3634,
0, 0, 0, 0, 0, 0, 0, 0x594B,
- 0x3027, 0xBF64, 0xBF65, 0x3A43, 0, 0xBF66, 0, 0x3F36,
- 0, 0, 0, 0, 0, 0xBF67, 0xBF68, 0,
- 0, 0xBF69, 0x4472, 0, 0xBF6A, 0x4854, 0x5951, 0x415E,
-};
-const unsigned short utf8_to_euc_E68D[] = {
- 0, 0xBF6B, 0xBF6C, 0xBF6D, 0xBF6E, 0, 0xBF6F, 0,
- 0, 0x422A, 0xBF70, 0xBF71, 0x3B2B, 0x5952, 0xBF72, 0x5954,
- 0x5950, 0, 0xBF73, 0xBF74, 0xBF75, 0x4A61, 0, 0x443D,
- 0xBF76, 0, 0, 0xBF77, 0x415C, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xBF78, 0xBF79, 0x4A7B,
- 0x3C4E, 0x5960, 0, 0x595F, 0xBF7A, 0xBF7B, 0x3F78, 0,
- 0, 0xBF7C, 0x377E, 0, 0xBF7D, 0xBF7E, 0x5959, 0x3E39,
- 0xC021, 0, 0x4668, 0x4731, 0xC022, 0xC023, 0, 0xC024,
-};
-const unsigned short utf8_to_euc_E68E[] = {
- 0x5957, 0, 0xC025, 0x415D, 0xC026, 0, 0, 0xC027,
- 0x3C78, 0x595C, 0xC028, 0, 0x3E38, 0, 0x5956, 0x595B,
- 0xC029, 0, 0x4753, 0, 0xC02A, 0xC02B, 0x5955, 0,
- 0x3721, 0xC02C, 0xC02D, 0x335D, 0, 0, 0xC02E, 0x595D,
- 0x4E2B, 0x3A4E, 0x4335, 0x595A, 0xC02F, 0x405C, 0xC030, 0x3935,
- 0x3F64, 0x3166, 0x413C, 0x5958, 0x3545, 0xC031, 0xC032, 0xC033,
+ 0x3027, 0, 0, 0x3A43, 0, 0, 0, 0x3F36,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4472, 0, 0, 0x4854, 0x5951, 0x415E,
+};
+unsigned short utf8_to_euc_E68D[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x422A, 0, 0, 0x3B2B, 0x5952, 0, 0x5954,
+ 0x5950, 0, 0, 0, 0, 0x4A61, 0, 0x443D,
+ 0, 0, 0, 0, 0x415C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4A7B,
+ 0x3C4E, 0x5960, 0, 0x595F, 0, 0, 0x3F78, 0,
+ 0, 0, 0x377E, 0, 0, 0, 0x5959, 0x3E39,
+ 0, 0, 0x4668, 0x4731, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E68E[] = {
+ 0x5957, 0, 0, 0x415D, 0, 0, 0, 0,
+ 0x3C78, 0x595C, 0, 0, 0x3E38, 0, 0x5956, 0x595B,
+ 0, 0, 0x4753, 0, 0, 0, 0x5955, 0,
+ 0x3721, 0, 0, 0x335D, 0, 0, 0, 0x595D,
+ 0x4E2B, 0x3A4E, 0x4335, 0x595A, 0, 0x405C, 0, 0x3935,
+ 0x3F64, 0x3166, 0x413C, 0x5958, 0x3545, 0, 0, 0,
0, 0, 0x3747, 0, 0x444F, 0x595E, 0, 0,
- 0, 0, 0, 0x415F, 0, 0xC034, 0x5961, 0,
-};
-const unsigned short utf8_to_euc_E68F[] = {
- 0x5963, 0xC035, 0, 0x4237, 0x5969, 0xC036, 0x5964, 0,
- 0xC037, 0x5966, 0, 0, 0, 0, 0xC038, 0x4941,
- 0x4473, 0xC039, 0x5967, 0xC03A, 0xC03B, 0xC03C, 0x4D2C, 0,
- 0, 0, 0x4D48, 0x3439, 0xC03D, 0, 0, 0,
- 0xC03E, 0x302E, 0, 0x5965, 0, 0xC03F, 0, 0,
- 0, 0x5962, 0xC040, 0, 0xC041, 0, 0x3478, 0,
- 0, 0, 0xC042, 0xC043, 0x3167, 0xC044, 0x5968, 0,
- 0xC045, 0xC046, 0x4D49, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E690[] = {
+ 0, 0, 0, 0x415F, 0, 0, 0x5961, 0,
+};
+unsigned short utf8_to_euc_E68F[] = {
+ 0x5963, 0, 0, 0x4237, 0x5969, 0, 0x5964, 0,
+ 0, 0x5966, 0, 0, 0, 0, 0, 0x4941,
+ 0x4473, 0, 0x5967, 0, 0, 0, 0x4D2C, 0,
+ 0, 0, 0x4D48, 0x3439, 0, 0, 0, 0,
+ 0, 0x302E, 0, 0x5965, 0, 0, 0, 0,
+ 0, 0x5962, 0, 0, 0, 0, 0x3478, 0,
+ 0, 0, 0, 0, 0x3167, 0x7A2F, 0x5968, 0,
+ 0, 0, 0x4D49, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E690[] = {
0, 0, 0, 0, 0, 0, 0x596C, 0,
- 0, 0xC047, 0xC048, 0, 0, 0x423B, 0, 0x5973,
- 0xC049, 0, 0xC04A, 0x596D, 0xC04B, 0, 0x596A, 0x5971,
- 0xC04C, 0, 0, 0, 0x5953, 0, 0xC04D, 0,
- 0xC04E, 0, 0xC04F, 0, 0xC050, 0xC051, 0x596E, 0,
- 0x5972, 0xC052, 0xC053, 0, 0x4842, 0x456B, 0, 0xC054,
- 0xC055, 0, 0, 0, 0x596B, 0xC056, 0x596F, 0,
- 0, 0, 0x3748, 0, 0, 0xC057, 0x3A71, 0xC058,
-};
-const unsigned short utf8_to_euc_E691[] = {
+ 0, 0, 0, 0, 0, 0x423B, 0, 0x5973,
+ 0, 0, 0, 0x596D, 0, 0, 0x596A, 0x5971,
+ 0, 0, 0, 0, 0x5953, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x596E, 0,
+ 0x5972, 0, 0, 0, 0x4842, 0x456B, 0, 0,
+ 0, 0, 0, 0, 0x596B, 0, 0x596F, 0,
+ 0, 0, 0x3748, 0, 0, 0, 0x3A71, 0,
+};
+unsigned short utf8_to_euc_E691[] = {
0, 0, 0x405D, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xC059, 0, 0, 0x5977, 0xC05A,
- 0, 0xC05B, 0xC05C, 0xC05D, 0xC05E, 0, 0, 0,
- 0x4526, 0, 0xC05F, 0xC060, 0xC061, 0xC062, 0, 0xC063,
- 0xC064, 0xC065, 0, 0xC066, 0, 0, 0, 0x5974,
- 0, 0x4B60, 0, 0, 0, 0xC067, 0, 0x5975,
- 0, 0, 0, 0xC068, 0xC069, 0, 0x5976, 0,
- 0x4C4E, 0, 0x4022, 0xC06A, 0, 0xC06B, 0, 0,
-};
-const unsigned short utf8_to_euc_E692[] = {
- 0, 0, 0, 0x3762, 0, 0xC06C, 0, 0xC06D,
- 0x597D, 0, 0, 0, 0, 0, 0, 0xC06E,
- 0xC06F, 0xC070, 0x3B35, 0x597A, 0, 0x5979, 0, 0,
- 0xC071, 0xC072, 0x4732, 0xC073, 0, 0xC074, 0x4635, 0xC075,
- 0, 0xC076, 0, 0xC077, 0x4531, 0x597B, 0xC078, 0,
- 0xC079, 0x597C, 0, 0x496F, 0xC07A, 0x4745, 0x3B23, 0,
- 0x4071, 0, 0x4B50, 0xC07B, 0, 0, 0, 0,
- 0, 0x3349, 0, 0x5A25, 0x597E, 0xC07C, 0xC07D, 0xC07E,
-};
-const unsigned short utf8_to_euc_E693[] = {
- 0, 0x4D4A, 0x5A27, 0, 0xC121, 0x5A23, 0, 0x5A24,
- 0, 0xC122, 0xC123, 0xC124, 0xC125, 0x4160, 0xC126, 0,
- 0xC127, 0xC128, 0x5A22, 0, 0x593F, 0xC129, 0, 0xC12A,
+ 0, 0, 0, 0, 0, 0, 0x5977, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x4526, 0, 0, 0, 0, 0, 0, 0,
+ 0x7A30, 0, 0, 0, 0, 0, 0, 0x5974,
+ 0, 0x4B60, 0, 0, 0, 0, 0, 0x5975,
+ 0, 0, 0, 0, 0, 0, 0x5976, 0,
+ 0x4C4E, 0, 0x4022, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E692[] = {
+ 0, 0, 0, 0x3762, 0, 0, 0, 0,
+ 0x597D, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3B35, 0x597A, 0, 0x5979, 0, 0,
+ 0, 0, 0x4732, 0, 0, 0x7A31, 0x4635, 0,
+ 0, 0, 0, 0, 0x4531, 0x597B, 0, 0,
+ 0, 0x597C, 0, 0x496F, 0, 0x4745, 0x3B23, 0,
+ 0x4071, 0, 0x4B50, 0, 0, 0, 0, 0,
+ 0, 0x3349, 0, 0x5A25, 0x597E, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E693[] = {
+ 0, 0x4D4A, 0x5A27, 0, 0, 0x5A23, 0, 0x5A24,
+ 0, 0, 0, 0, 0, 0x4160, 0x7A32, 0,
+ 0, 0, 0x5A22, 0, 0x593F, 0, 0, 0,
0x5A26, 0, 0x5A21, 0, 0, 0, 0, 0,
- 0x5A2B, 0x5A2C, 0x4527, 0x5A2E, 0xC12B, 0xC12C, 0x3B24, 0x5A29,
- 0, 0xC12D, 0xC12E, 0, 0x353C, 0xC12F, 0, 0x5A2F,
- 0xC130, 0x5A28, 0x5A33, 0, 0x5A32, 0xC131, 0x5A31, 0xC132,
- 0, 0, 0x5A34, 0xC133, 0, 0x5A36, 0x3E71, 0xC134,
-};
-const unsigned short utf8_to_euc_E694[] = {
- 0x5A35, 0xC135, 0, 0, 0xC136, 0x5A39, 0, 0,
- 0xC137, 0xC138, 0xC139, 0, 0, 0, 0, 0xC13A,
- 0, 0, 0, 0xC13B, 0xC13C, 0, 0xC13D, 0,
- 0x5A37, 0xC13E, 0, 0xC13F, 0x5A38, 0x5970, 0xC140, 0xC141,
- 0, 0, 0xC142, 0x5A3B, 0x5A3A, 0, 0xC143, 0,
- 0, 0xC144, 0x5978, 0x5A3C, 0x5A30, 0, 0xC145, 0x3B59,
- 0, 0xC146, 0, 0, 0x5A3D, 0x5A3E, 0x5A40, 0x5A3F,
- 0x5A41, 0x327E, 0xC147, 0x3936, 0xC148, 0xC149, 0x4A7C, 0x402F,
-};
-const unsigned short utf8_to_euc_E695[] = {
- 0, 0, 0, 0xC14A, 0, 0x384E, 0, 0xC14B,
- 0x5A43, 0xC14C, 0, 0, 0, 0x5A46, 0xF441, 0x4952,
- 0xC14D, 0x355F, 0xC14E, 0, 0xC14F, 0x5A45, 0x5A44, 0x4754,
- 0x5A47, 0x3635, 0, 0, 0, 0x5A49, 0x5A48, 0xC150,
- 0xC151, 0, 0x343A, 0x3B36, 0, 0, 0x4658, 0xC152,
- 0, 0, 0, 0xC153, 0x3749, 0, 0, 0,
+ 0x5A2B, 0x5A2C, 0x4527, 0x5A2E, 0, 0, 0x3B24, 0x5A29,
+ 0, 0, 0, 0, 0x353C, 0, 0, 0x5A2F,
+ 0, 0x5A28, 0x5A33, 0, 0x5A32, 0, 0x5A31, 0,
+ 0, 0, 0x5A34, 0, 0, 0x5A36, 0x3E71, 0,
+};
+unsigned short utf8_to_euc_E694[] = {
+ 0x5A35, 0, 0, 0, 0, 0x5A39, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5A37, 0, 0, 0, 0x5A38, 0x5970, 0, 0,
+ 0, 0, 0, 0x5A3B, 0x5A3A, 0, 0, 0,
+ 0, 0, 0x5978, 0x5A3C, 0x5A30, 0, 0, 0x3B59,
+ 0, 0, 0, 0, 0x5A3D, 0x5A3E, 0x5A40, 0x5A3F,
+ 0x5A41, 0x327E, 0, 0x3936, 0, 0, 0x4A7C, 0x402F,
+};
+unsigned short utf8_to_euc_E695[] = {
+ 0, 0, 0, 0, 0, 0x384E, 0, 0,
+ 0x5A43, 0, 0, 0, 0, 0x5A46, 0x7A33, 0x4952,
+ 0, 0x355F, 0, 0, 0, 0x5A45, 0x5A44, 0x4754,
+ 0x5A47, 0x3635, 0, 0, 0, 0x5A49, 0x5A48, 0,
+ 0, 0, 0x343A, 0x3B36, 0, 0, 0x4658, 0,
+ 0, 0, 0, 0, 0x3749, 0, 0, 0,
0x3F74, 0, 0x5A4A, 0, 0x4030, 0x4528, 0, 0x495F,
- 0x5A4B, 0, 0xC154, 0, 0, 0xC155, 0, 0,
-};
-const unsigned short utf8_to_euc_E696[] = {
- 0, 0xC156, 0x5A4C, 0x5A4D, 0, 0xC157, 0, 0x4A38,
- 0x555D, 0x4046, 0xC158, 0, 0x494C, 0, 0x3A58, 0,
- 0x4865, 0x4843, 0xC159, 0, 0, 0xC15A, 0, 0x454D,
- 0xC15B, 0x4E41, 0, 0x5A4F, 0x3C50, 0xC15C, 0, 0x5A50,
- 0xC15D, 0x3036, 0, 0xC15E, 0x3654, 0x404D, 0xC15F, 0x4960,
- 0, 0, 0, 0x5A51, 0x3B42, 0x4347, 0xC160, 0x3B5B,
- 0x3F37, 0, 0xC161, 0xC162, 0xC163, 0, 0, 0x5A52,
- 0, 0x4A7D, 0, 0, 0x3177, 0x3B5C, 0, 0xC164,
-};
-const unsigned short utf8_to_euc_E697[] = {
- 0, 0x5A55, 0xC165, 0x5A53, 0x5A56, 0x4E39, 0x5A54, 0,
- 0xC166, 0xC167, 0, 0x407B, 0x5A57, 0, 0xC168, 0x4232,
- 0xC169, 0, 0x5A58, 0, 0xC16A, 0, 0xC16B, 0x347A,
- 0xC16C, 0x5A5A, 0, 0x5A59, 0, 0, 0, 0xC16D,
+ 0x5A4B, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E696[] = {
+ 0, 0, 0x5A4C, 0x5A4D, 0, 0, 0, 0x4A38,
+ 0x555D, 0x4046, 0, 0, 0x494C, 0, 0x3A58, 0,
+ 0x4865, 0x4843, 0, 0, 0, 0, 0, 0x454D,
+ 0, 0x4E41, 0, 0x5A4F, 0x3C50, 0, 0, 0x5A50,
+ 0, 0x3036, 0, 0, 0x3654, 0x404D, 0, 0x4960,
+ 0, 0, 0, 0x5A51, 0x3B42, 0x4347, 0, 0x3B5B,
+ 0x3F37, 0, 0, 0, 0, 0, 0, 0x5A52,
+ 0, 0x4A7D, 0, 0, 0x3177, 0x3B5C, 0, 0,
+};
+unsigned short utf8_to_euc_E697[] = {
+ 0, 0x5A55, 0, 0x5A53, 0x5A56, 0x4E39, 0x5A54, 0,
+ 0, 0, 0, 0x407B, 0x5A57, 0, 0, 0x4232,
+ 0, 0, 0x5A58, 0, 0, 0, 0, 0x347A,
+ 0, 0x5A5A, 0, 0x5A59, 0, 0, 0, 0,
0x5A5B, 0x5A5C, 0x347B, 0, 0, 0x467C, 0x4336, 0x356C,
0x3B5D, 0x4161, 0, 0, 0x3D5C, 0x3030, 0, 0,
- 0xC16E, 0x5A5D, 0xC16F, 0, 0xC170, 0xC171, 0, 0,
- 0, 0xC172, 0x3222, 0x5A61, 0, 0, 0xC173, 0xC174,
-};
-const unsigned short utf8_to_euc_E698[] = {
- 0xC175, 0, 0x3937, 0x5A60, 0xC176, 0, 0x3A2B, 0x3E3A,
- 0xC177, 0xC178, 0x5A5F, 0, 0x3E3B, 0xC179, 0x4C40, 0x3A2A,
- 0, 0xC17A, 0xC17B, 0x3057, 0x404E, 0xC17C, 0xC17D, 0,
- 0, 0, 0, 0, 0x5A66, 0xC17E, 0xC221, 0x4031,
- 0x3147, 0xC222, 0xC223, 0xC224, 0xC225, 0x3D55, 0xC226, 0x4B66,
- 0x3A72, 0xC227, 0xC228, 0xC229, 0xC22A, 0x3E3C, 0xC22B, 0x4027,
- 0xC22C, 0xC22D, 0, 0xC22E, 0x5A65, 0x5A63, 0x5A64, 0xC230,
- 0, 0xC22F, 0, 0xF442, 0x436B, 0, 0, 0x5B26,
-};
-const unsigned short utf8_to_euc_E699[] = {
- 0xC231, 0x5A6A, 0x3B7E, 0x3938, 0x5A68, 0xC232, 0xC233, 0,
- 0, 0x5A69, 0xC234, 0x3F38, 0xC235, 0, 0xC237, 0x5A67,
- 0, 0xC236, 0x3B2F, 0, 0, 0, 0, 0xC238,
- 0xC239, 0xC23A, 0, 0xC23B, 0xC23C, 0x5A6C, 0x5A6B, 0x5A70,
- 0xC23D, 0xC23E, 0x5A71, 0, 0x5A6D, 0xF443, 0x3322, 0x5A6E,
- 0x5A6F, 0x4855, 0xC240, 0xC241, 0xC242, 0, 0x4961, 0x374A,
- 0x5A72, 0, 0, 0xC244, 0x4032, 0xC245, 0x3E3D, 0xC247,
- 0xC248, 0xC249, 0x4352, 0xC24A, 0xC24C, 0, 0xC243, 0xC246,
-};
-const unsigned short utf8_to_euc_E69A[] = {
- 0xC24B, 0x3647, 0, 0x5A73, 0x5A77, 0, 0, 0x324B,
- 0x5A74, 0x5A76, 0, 0xC24D, 0xC24E, 0xC24F, 0x5A75, 0,
- 0xC250, 0x3D6B, 0xC251, 0, 0, 0, 0x4348, 0x3045,
- 0x5A78, 0xC252, 0xC253, 0xC254, 0xC255, 0x5A79, 0, 0xC256,
- 0xC257, 0, 0x442A, 0, 0xC258, 0, 0x4E71, 0,
- 0, 0, 0, 0x3B43, 0, 0xC259, 0x4A6B, 0,
- 0, 0xC25A, 0xC25B, 0, 0x4B3D, 0xC25C, 0, 0,
- 0x5B22, 0x5A7B, 0, 0xC25D, 0x5A7E, 0, 0x5A7D, 0xC25E,
-};
-const unsigned short utf8_to_euc_E69B[] = {
- 0xC25F, 0x5A7A, 0xC260, 0xC261, 0x5B21, 0, 0, 0x465E,
- 0xC262, 0x5A7C, 0, 0, 0xC263, 0, 0xC264, 0xC265,
- 0, 0, 0, 0, 0xC266, 0, 0x5B23, 0,
- 0, 0x3D6C, 0x5B24, 0xC267, 0x4D4B, 0x4778, 0, 0xC268,
+ 0, 0x5A5D, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3222, 0x5A61, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E698[] = {
+ 0x7A34, 0, 0x3937, 0x5A60, 0, 0, 0x3A2B, 0x3E3A,
+ 0, 0x7A37, 0x5A5F, 0, 0x3E3B, 0, 0x4C40, 0x3A2A,
+ 0, 0, 0, 0x3057, 0x404E, 0x7A35, 0, 0,
+ 0, 0, 0, 0, 0x5A66, 0, 0x7A39, 0x4031,
+ 0x3147, 0, 0, 0, 0x7A3A, 0x3D55, 0, 0x4B66,
+ 0x3A72, 0, 0, 0, 0, 0x3E3C, 0x7A38, 0x4027,
+ 0, 0x7928, 0, 0, 0x5A65, 0x5A63, 0x5A64, 0,
+ 0, 0, 0, 0x7A36, 0x436B, 0, 0, 0x5B26,
+};
+unsigned short utf8_to_euc_E699[] = {
+ 0, 0x5A6A, 0x3B7E, 0x3938, 0x5A68, 0, 0, 0,
+ 0, 0x5A69, 0, 0x3F38, 0, 0, 0, 0x5A67,
+ 0, 0, 0x3B2F, 0, 0, 0, 0, 0x7A3C,
+ 0, 0x7A3D, 0, 0, 0, 0x5A6C, 0x5A6B, 0x5A70,
+ 0, 0, 0x5A71, 0, 0x5A6D, 0x7A3B, 0x3322, 0x5A6E,
+ 0x5A6F, 0x4855, 0, 0, 0, 0, 0x4961, 0x374A,
+ 0x5A72, 0, 0, 0x7A3F, 0x4032, 0, 0x3E3D, 0,
+ 0, 0, 0x4352, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E69A[] = {
+ 0, 0x3647, 0, 0x5A73, 0x5A77, 0, 0, 0x324B,
+ 0x5A74, 0x5A76, 0, 0, 0, 0, 0x5A75, 0,
+ 0, 0x3D6B, 0, 0, 0, 0, 0x4348, 0x3045,
+ 0x5A78, 0x7A40, 0, 0, 0, 0x5A79, 0, 0,
+ 0x7A41, 0, 0x442A, 0, 0, 0, 0x4E71, 0,
+ 0, 0, 0, 0x3B43, 0, 0, 0x4A6B, 0,
+ 0, 0, 0x7A42, 0, 0x4B3D, 0, 0, 0,
+ 0x5B22, 0x5A7B, 0, 0, 0x5A7E, 0, 0x5A7D, 0x7A43,
+};
+unsigned short utf8_to_euc_E69B[] = {
+ 0, 0x5A7A, 0, 0, 0x5B21, 0, 0, 0x465E,
+ 0, 0x5A7C, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x5B23, 0,
+ 0, 0x3D6C, 0x5B24, 0, 0x4D4B, 0x4778, 0, 0,
0x5B25, 0, 0, 0, 0, 0, 0x5B27, 0,
- 0xC269, 0x5B28, 0, 0xC26A, 0xC26B, 0, 0xC26C, 0,
+ 0, 0x5B28, 0, 0, 0, 0, 0, 0,
0x5B29, 0, 0x364A, 0x3148, 0x3939, 0x5B2A, 0, 0x5B2B,
- 0x3D71, 0x4162, 0xC26D, 0xC23F, 0x5258, 0x413E, 0x413D, 0x4258,
-};
-const unsigned short utf8_to_euc_E69C[] = {
- 0x3A47, 0, 0, 0x5072, 0, 0xC26E, 0, 0xC26F,
- 0x376E, 0x4D2D, 0, 0x4A7E, 0, 0x497E, 0xC270, 0x5B2C,
- 0, 0, 0, 0xC271, 0x3A73, 0x443F, 0x5B2D, 0x4F2F,
- 0, 0xC272, 0, 0x4B3E, 0xC273, 0x442B, 0x5B2E, 0x347C,
- 0xC274, 0, 0xC275, 0, 0, 0, 0x5B2F, 0x5B30,
+ 0x3D71, 0x4162, 0x7A44, 0x792B, 0x5258, 0x413E, 0x413D, 0x4258,
+};
+unsigned short utf8_to_euc_E69C[] = {
+ 0x3A47, 0, 0, 0x5072, 0, 0, 0, 0,
+ 0x376E, 0x4D2D, 0, 0x4A7E, 0, 0x497E, 0x7A45, 0x5B2C,
+ 0, 0, 0, 0, 0x3A73, 0x443F, 0x5B2D, 0x4F2F,
+ 0, 0, 0, 0x4B3E, 0, 0x442B, 0x5B2E, 0x347C,
+ 0, 0, 0, 0, 0, 0, 0x5B2F, 0x5B30,
0x4C5A, 0, 0x4C24, 0x4B76, 0x4B5C, 0x3B25, 0x5B32, 0,
- 0, 0x3C6B, 0, 0xC276, 0x4B51, 0, 0x5B34, 0x5B37,
- 0x5B36, 0, 0x3479, 0, 0, 0x3560, 0xC277, 0x5B33,
-};
-const unsigned short utf8_to_euc_E69D[] = {
- 0, 0x5B35, 0, 0, 0, 0xC278, 0x5B38, 0xC279,
- 0xC27A, 0x3F79, 0, 0, 0xC27B, 0, 0x4D7B, 0x3049,
- 0x3A60, 0x423C, 0, 0x3C5D, 0xC27C, 0xC27D, 0x3E73, 0,
- 0, 0x5B3B, 0, 0, 0x454E, 0xC27E, 0x5B39, 0x422B,
- 0x5B3A, 0x3E72, 0x4C5D, 0x5B3C, 0x5B3D, 0x4D68, 0xC321, 0,
- 0, 0, 0x5B42, 0, 0xC322, 0x393A, 0xC323, 0x4755,
- 0x5B3F, 0x456C, 0x5A5E, 0x5A62, 0xC324, 0x354F, 0xC325, 0x4747,
- 0, 0, 0, 0xC326, 0x5B41, 0, 0x3E3E, 0x4844,
-};
-const unsigned short utf8_to_euc_E69E[] = {
- 0, 0xC327, 0, 0, 0xC328, 0x5B47, 0, 0x487A,
- 0, 0x5B3E, 0, 0x5B44, 0x5B43, 0, 0xC329, 0xC32A,
- 0x404F, 0xC32B, 0, 0xC32C, 0, 0x4B6D, 0xC32D, 0x4E53,
- 0xC32E, 0xC32F, 0x4B67, 0xC330, 0x324C, 0x3B5E, 0, 0,
+ 0, 0x3C6B, 0, 0, 0x4B51, 0, 0x5B34, 0x5B37,
+ 0x5B36, 0, 0x3479, 0, 0, 0x3560, 0, 0x5B33,
+};
+unsigned short utf8_to_euc_E69D[] = {
+ 0, 0x5B35, 0, 0, 0, 0, 0x5B38, 0,
+ 0, 0x3F79, 0, 0, 0, 0, 0x4D7B, 0x3049,
+ 0x3A60, 0x423C, 0, 0x3C5D, 0, 0, 0x3E73, 0,
+ 0, 0x5B3B, 0, 0, 0x454E, 0, 0x5B39, 0x422B,
+ 0x5B3A, 0x3E72, 0x4C5D, 0x5B3C, 0x5B3D, 0x4D68, 0x7A47, 0,
+ 0, 0, 0x5B42, 0, 0, 0x393A, 0, 0x4755,
+ 0x5B3F, 0x456C, 0x5A5E, 0x5A62, 0, 0x354F, 0, 0x4747,
+ 0, 0, 0, 0, 0x5B41, 0, 0x3E3E, 0x4844,
+};
+unsigned short utf8_to_euc_E69E[] = {
+ 0, 0, 0, 0, 0, 0x5B47, 0, 0x487A,
+ 0, 0x5B3E, 0, 0x5B44, 0x5B43, 0, 0, 0,
+ 0x404F, 0, 0, 0, 0, 0x4B6D, 0, 0x4E53,
+ 0, 0, 0x4B67, 0, 0x324C, 0x3B5E, 0, 0,
0x4F48, 0x5B46, 0x3F75, 0, 0, 0, 0x5B45, 0,
0, 0x5B40, 0, 0, 0, 0, 0, 0x384F,
- 0xC331, 0xC332, 0xC333, 0x5B4C, 0x5B4A, 0xC334, 0x324D, 0x5B48,
- 0x5B4E, 0x5B54, 0, 0xC335, 0xC336, 0xC337, 0, 0,
-};
-const unsigned short utf8_to_euc_E69F[] = {
- 0xC339, 0x4248, 0xC33A, 0xC33B, 0x4A41, 0xC33C, 0x5B56, 0,
- 0xC33D, 0xC33E, 0x4922, 0, 0, 0, 0x5B55, 0x4770,
- 0x4B3F, 0x343B, 0xC33F, 0x4077, 0x3D40, 0, 0, 0xC340,
- 0x4453, 0xC341, 0x4D2E, 0, 0xC342, 0x5B51, 0x5B50, 0,
- 0, 0xC343, 0x5B52, 0, 0x5B4F, 0, 0xC344, 0x5B57,
+ 0, 0, 0, 0x5B4C, 0x5B4A, 0, 0x324D, 0x5B48,
+ 0x5B4E, 0x5B54, 0, 0x7A48, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E69F[] = {
+ 0x7A4A, 0x4248, 0, 0, 0x4A41, 0, 0x5B56, 0,
+ 0, 0, 0x4922, 0, 0, 0, 0x5B55, 0x4770,
+ 0x4B3F, 0x343B, 0, 0x4077, 0x3D40, 0, 0, 0,
+ 0x4453, 0, 0x4D2E, 0, 0, 0x5B51, 0x5B50, 0,
+ 0, 0, 0x5B52, 0, 0x5B4F, 0, 0, 0x5B57,
0, 0x5B4D, 0, 0, 0x5B4B, 0, 0x5B53, 0x5B49,
- 0xC345, 0x436C, 0xC346, 0x4C78, 0x3C46, 0x3A74, 0xC347, 0xC348,
- 0, 0xC338, 0, 0x3A3A, 0, 0, 0x4B6F, 0x3341,
-};
-const unsigned short utf8_to_euc_E6A0[] = {
- 0, 0xF446, 0x444E, 0x464A, 0x3149, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x4072, 0xC34A, 0, 0x4034, 0x372A,
- 0, 0xC34B, 0, 0, 0, 0xC34C, 0x5B59, 0xC34D,
- 0, 0x393B, 0x337C, 0, 0, 0, 0, 0xC34F,
- 0xC34E, 0x5B5B, 0x3374, 0x5B61, 0xC350, 0xC351, 0, 0xC352,
- 0xC353, 0xC354, 0x5B5E, 0xC355, 0x4073, 0, 0, 0,
- 0x334B, 0x3A2C, 0, 0xC356, 0x334A, 0x3A4F, 0, 0xC357,
-};
-const unsigned short utf8_to_euc_E6A1[] = {
- 0x5B5C, 0x3765, 0x374B, 0x456D, 0xC358, 0xC359, 0x5B5A, 0,
- 0x3046, 0, 0xC35A, 0, 0xC35B, 0x5B5D, 0x5B5F, 0,
- 0x364D, 0x372C, 0xC349, 0x343C, 0x354B, 0xC35C, 0, 0xC35D,
- 0xC35E, 0x5B62, 0, 0xC35F, 0x3A79, 0x4B71, 0, 0x3B37,
+ 0, 0x436C, 0, 0x4C78, 0x3C46, 0x3A74, 0, 0,
+ 0, 0, 0, 0x3A3A, 0, 0, 0x4B6F, 0x3341,
+};
+unsigned short utf8_to_euc_E6A0[] = {
+ 0, 0x7A4B, 0x444E, 0x464A, 0x3149, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4072, 0, 0, 0x4034, 0x372A,
+ 0, 0, 0, 0, 0, 0, 0x5B59, 0,
+ 0, 0x393B, 0x337C, 0, 0, 0, 0, 0,
+ 0, 0x5B5B, 0x3374, 0x5B61, 0, 0, 0, 0,
+ 0, 0, 0x5B5E, 0, 0x4073, 0, 0, 0,
+ 0x334B, 0x3A2C, 0, 0, 0x334A, 0x3A4F, 0, 0,
+};
+unsigned short utf8_to_euc_E6A1[] = {
+ 0x5B5C, 0x3765, 0x374B, 0x456D, 0x7A4C, 0, 0x5B5A, 0,
+ 0x3046, 0, 0, 0, 0, 0x5B5D, 0x5B5F, 0,
+ 0x364D, 0x372C, 0x7A49, 0x343C, 0x354B, 0, 0, 0,
+ 0, 0x5B62, 0, 0, 0x3A79, 0x4B71, 0, 0x3B37,
0, 0, 0, 0x5B63, 0, 0, 0, 0x4930,
- 0, 0, 0, 0xC360, 0, 0, 0xC361, 0xC362,
- 0xC363, 0xC364, 0xC365, 0, 0x5B6F, 0xC366, 0x3233, 0x5B64,
- 0, 0xC367, 0xC368, 0xC369, 0xC36A, 0, 0x5B75, 0x5B65,
-};
-const unsigned short utf8_to_euc_E6A2[] = {
- 0, 0x4E42, 0xC36B, 0x5B6C, 0xC36C, 0x475F, 0xC36D, 0,
- 0xC36E, 0, 0, 0, 0, 0x5B74, 0, 0x5B67,
- 0, 0, 0, 0x3034, 0x5B69, 0, 0xC36F, 0x393C,
- 0xC370, 0, 0xC371, 0x5B6B, 0xC372, 0x5B6A, 0, 0x5B66,
- 0x5B71, 0xC373, 0x3E3F, 0xC374, 0, 0xC375, 0x546D, 0x3868,
- 0x4D7C, 0xC376, 0xC377, 0, 0, 0x5B68, 0xC378, 0x4474,
- 0x3323, 0x3A2D, 0xC379, 0x5B60, 0, 0x5B70, 0x3361, 0,
- 0, 0x5B6E, 0x5B72, 0xC37A, 0x456E, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E6A3[] = {
- 0, 0, 0, 0, 0x347E, 0xC37B, 0x5C32, 0,
- 0xC37C, 0x4C49, 0x5B77, 0x347D, 0xC37D, 0x5B7E, 0, 0xC37E,
- 0xC421, 0xC422, 0x4B40, 0xC423, 0x5C21, 0x5C23, 0xC424, 0x5C27,
- 0x5B79, 0xC425, 0x432A, 0, 0xC426, 0xC427, 0, 0x456F,
- 0x5C2B, 0x5B7C, 0, 0x5C28, 0, 0xC428, 0, 0x5C22,
- 0xC429, 0, 0xC42A, 0xC42B, 0xC42C, 0xC42D, 0x3F39, 0x5C2C,
- 0xC42E, 0xC42F, 0x4033, 0, 0, 0xC430, 0xC431, 0,
- 0, 0x5C2A, 0x343D, 0xC432, 0xC433, 0xC434, 0, 0,
-};
-const unsigned short utf8_to_euc_E6A4[] = {
- 0x4F50, 0x5B76, 0, 0, 0x5C26, 0x3058, 0xC435, 0,
- 0x5B78, 0xC436, 0xC437, 0x4C3A, 0x5B7D, 0x3F22, 0x4447, 0x5B73,
- 0xC438, 0xC439, 0x5C25, 0xC43A, 0, 0, 0xC43B, 0xC43C,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5B6F, 0, 0x3233, 0x5B64,
+ 0, 0, 0, 0, 0, 0, 0x5B75, 0x5B65,
+};
+unsigned short utf8_to_euc_E6A2[] = {
+ 0, 0x4E42, 0, 0x5B6C, 0, 0x475F, 0, 0,
+ 0, 0, 0, 0, 0, 0x5B74, 0, 0x5B67,
+ 0, 0, 0, 0x3034, 0x5B69, 0, 0, 0x393C,
+ 0, 0, 0, 0x5B6B, 0, 0x5B6A, 0, 0x5B66,
+ 0x5B71, 0, 0x3E3F, 0, 0, 0, 0x546D, 0x3868,
+ 0x4D7C, 0, 0, 0, 0, 0x5B68, 0, 0x4474,
+ 0x3323, 0x3A2D, 0, 0x5B60, 0, 0x5B70, 0x3361, 0,
+ 0, 0x5B6E, 0x5B72, 0, 0x456E, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6A3[] = {
+ 0, 0, 0, 0, 0x347E, 0, 0x5C32, 0,
+ 0x7929, 0x4C49, 0x5B77, 0x347D, 0, 0x5B7E, 0, 0x7A4D,
+ 0, 0, 0x4B40, 0, 0x5C21, 0x5C23, 0, 0x5C27,
+ 0x5B79, 0, 0x432A, 0, 0, 0, 0, 0x456F,
+ 0x5C2B, 0x5B7C, 0, 0x5C28, 0, 0, 0, 0x5C22,
+ 0, 0, 0, 0, 0, 0, 0x3F39, 0x5C2C,
+ 0, 0, 0x4033, 0, 0, 0, 0, 0,
+ 0, 0x5C2A, 0x343D, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6A4[] = {
+ 0x4F50, 0x5B76, 0, 0, 0x5C26, 0x3058, 0, 0,
+ 0x5B78, 0, 0, 0x4C3A, 0x5B7D, 0x3F22, 0x4447, 0x5B73,
+ 0, 0, 0x5C25, 0, 0, 0, 0, 0,
0, 0x3F7A, 0x5C2F, 0x3371, 0x3821, 0, 0, 0,
0, 0x5C31, 0x5B7A, 0x5C30, 0, 0x5C29, 0x5B7B, 0,
0x5C2D, 0, 0x5C2E, 0, 0, 0, 0, 0,
- 0x5C3F, 0xC43D, 0, 0xC43E, 0x464E, 0xC43F, 0x5C24, 0,
- 0xC440, 0x5C3B, 0, 0xC441, 0, 0x5C3D, 0, 0x4458,
-};
-const unsigned short utf8_to_euc_E6A5[] = {
- 0, 0, 0xC442, 0, 0, 0xC443, 0, 0,
- 0, 0xC444, 0x4D4C, 0, 0, 0, 0xC445, 0,
- 0, 0, 0, 0x4976, 0x5C38, 0x424A, 0, 0xC446,
- 0, 0x5C3E, 0x413F, 0xC447, 0x5C35, 0x5C42, 0x5C41, 0,
- 0x466F, 0x5C40, 0x466A, 0xC448, 0xC449, 0xC44A, 0xC44B, 0,
- 0xC44C, 0xC44D, 0x5C44, 0x5C37, 0xC44E, 0x3648, 0x5C3A, 0x3D5D,
- 0xC44F, 0xC450, 0xC451, 0x4760, 0x5C3C, 0x364B, 0, 0x5C34,
- 0x5C36, 0x5C33, 0xC452, 0xC453, 0x4F30, 0x335A, 0x5C39, 0xC454,
-};
-const unsigned short utf8_to_euc_E6A6[] = {
- 0xC455, 0x5C43, 0x3335, 0, 0, 0, 0, 0,
- 0, 0, 0x3A67, 0, 0, 0xC456, 0x315D, 0,
- 0, 0x5C54, 0xC457, 0, 0x4F31, 0x5C57, 0xC458, 0,
- 0xC459, 0, 0, 0x3F3A, 0x5C56, 0, 0, 0,
- 0x5C55, 0xC45A, 0, 0, 0, 0xC45B, 0xC45C, 0x5C52,
- 0xC45D, 0, 0, 0xC45E, 0, 0xC45F, 0x5C46, 0xC460,
- 0, 0x5C63, 0x5C45, 0, 0x5C58, 0, 0, 0xC461,
- 0xC462, 0, 0xC463, 0x5C50, 0xC464, 0, 0x5C4B, 0x5C48,
-};
-const unsigned short utf8_to_euc_E6A7[] = {
- 0, 0x5C49, 0, 0x5C51, 0, 0xC465, 0, 0x7422,
- 0xC466, 0, 0x5C4E, 0x393D, 0x4448, 0x4164, 0x5C4C, 0,
- 0x5C47, 0xC467, 0, 0x5C4A, 0, 0, 0xC468, 0xC469,
+ 0x5C3F, 0, 0, 0, 0x464E, 0, 0x5C24, 0,
+ 0, 0x5C3B, 0, 0, 0, 0x5C3D, 0, 0x4458,
+};
+unsigned short utf8_to_euc_E6A5[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4D4C, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4976, 0x5C38, 0x424A, 0, 0,
+ 0, 0x5C3E, 0x413F, 0, 0x5C35, 0x5C42, 0x5C41, 0,
+ 0x466F, 0x5C40, 0x466A, 0, 0, 0, 0, 0,
+ 0x7A4F, 0, 0x5C44, 0x5C37, 0, 0x3648, 0x5C3A, 0x3D5D,
+ 0, 0, 0, 0x4760, 0x5C3C, 0x364B, 0, 0x5C34,
+ 0x5C36, 0x5C33, 0, 0, 0x4F30, 0x335A, 0x5C39, 0,
+};
+unsigned short utf8_to_euc_E6A6[] = {
+ 0, 0x5C43, 0x3335, 0, 0, 0, 0, 0,
+ 0, 0, 0x3A67, 0, 0, 0, 0x315D, 0,
+ 0, 0x5C54, 0, 0, 0x4F31, 0x5C57, 0, 0,
+ 0x7A51, 0, 0, 0x3F3A, 0x5C56, 0, 0, 0,
+ 0x5C55, 0, 0, 0, 0, 0, 0, 0x5C52,
+ 0, 0, 0, 0, 0, 0, 0x5C46, 0,
+ 0, 0x5C63, 0x5C45, 0, 0x5C58, 0, 0, 0,
+ 0, 0, 0, 0x5C50, 0, 0, 0x5C4B, 0x5C48,
+};
+unsigned short utf8_to_euc_E6A7[] = {
+ 0, 0x5C49, 0, 0x5C51, 0, 0, 0, 0x7422,
+ 0, 0, 0x5C4E, 0x393D, 0x4448, 0x4164, 0x5C4C, 0,
+ 0x5C47, 0, 0, 0x5C4A, 0, 0, 0, 0,
0x4D4D, 0x4B6A, 0, 0, 0, 0x5C4F, 0x5C59, 0,
- 0, 0, 0xC46A, 0, 0, 0xC46B, 0, 0x5C61,
- 0x5C5A, 0, 0, 0x5C67, 0, 0x5C65, 0xC46C, 0xC46D,
- 0, 0xC46E, 0x5C60, 0xC46F, 0, 0xC470, 0, 0,
- 0, 0x5C5F, 0, 0x4450, 0, 0x4165, 0xC471, 0x5C5D,
-};
-const unsigned short utf8_to_euc_E6A8[] = {
- 0xC472, 0xC473, 0x5C5B, 0xC474, 0, 0x5C62, 0, 0,
- 0, 0, 0x5C68, 0x4875, 0x5C6E, 0, 0, 0xC475,
- 0, 0xC476, 0x5C69, 0x5C6C, 0x5C66, 0xC477, 0, 0x4374,
- 0, 0x4938, 0xC478, 0x5C5C, 0, 0xC479, 0x5C64, 0x3E40,
- 0xC47A, 0x4C4F, 0x5C78, 0x5C6B, 0xC47B, 0, 0, 0,
- 0xC47C, 0x3822, 0x3223, 0x335F, 0, 0, 0x5C53, 0,
- 0xC47D, 0, 0xC47E, 0, 0xC521, 0x3E41, 0x5C70, 0xC522,
- 0x5C77, 0x3C79, 0x3372, 0xC523, 0, 0x432E, 0xC524, 0xC525,
-};
-const unsigned short utf8_to_euc_E6A9[] = {
- 0, 0, 0, 0, 0x5C6D, 0xC526, 0xC527, 0x5C72,
- 0x5C76, 0xC528, 0xC529, 0x3636, 0, 0, 0xC52A, 0,
- 0xC52B, 0xC52C, 0xC52D, 0, 0, 0xC52E, 0xC52F, 0,
- 0x354C, 0x5C74, 0, 0xC530, 0, 0, 0, 0x3521,
- 0, 0x464B, 0x5C73, 0, 0xC531, 0, 0x5C75, 0xC532,
- 0, 0, 0xC533, 0xF449, 0, 0, 0, 0,
- 0, 0xC534, 0x5C6F, 0xC535, 0, 0, 0, 0,
- 0x5C71, 0, 0, 0, 0, 0, 0xC536, 0x3360,
-};
-const unsigned short utf8_to_euc_E6AA[] = {
- 0x4349, 0xC537, 0, 0xC538, 0x5C7C, 0, 0xC539, 0xC53A,
- 0, 0xC53B, 0, 0xC53C, 0, 0x5C7A, 0x3869, 0,
- 0x5C79, 0xC53D, 0, 0, 0, 0, 0, 0x5D21,
- 0, 0, 0, 0xC53E, 0x5B58, 0xC53F, 0xC540, 0xC541,
- 0x5C7B, 0, 0x5C7D, 0x5C7E, 0, 0xC542, 0, 0,
- 0, 0, 0x5D2C, 0xC543, 0x5D28, 0, 0x5B6D, 0xC544,
- 0xC545, 0xC546, 0, 0x5D27, 0xC547, 0, 0, 0,
- 0x5D26, 0, 0, 0x5D23, 0, 0xC548, 0xC549, 0xC54A,
-};
-const unsigned short utf8_to_euc_E6AB[] = {
- 0, 0x5C6A, 0x5D25, 0x5D24, 0, 0, 0xC54B, 0,
- 0xC54D, 0xC54C, 0, 0, 0xC54E, 0, 0, 0,
- 0xC54F, 0x5D2A, 0, 0x4F26, 0xC550, 0xC551, 0xC552, 0,
- 0, 0, 0x5D2D, 0x367B, 0xC553, 0xC554, 0x5D29, 0x5D2B,
- 0, 0, 0xF44A, 0, 0xC555, 0, 0, 0xC556,
- 0x4827, 0, 0x5D2E, 0, 0xC557, 0, 0, 0,
- 0xC558, 0xC559, 0xC55A, 0, 0, 0, 0, 0,
- 0, 0, 0x5D32, 0x5D2F, 0xC55B, 0xC55C, 0, 0,
-};
-const unsigned short utf8_to_euc_E6AC[] = {
- 0, 0, 0xC55D, 0xC55E, 0x4D73, 0x5D30, 0xC55F, 0xC560,
- 0, 0xC561, 0x5C5E, 0, 0, 0, 0, 0xC562,
- 0xC563, 0xC564, 0x5D33, 0, 0, 0, 0x5D34, 0xC565,
- 0, 0, 0, 0xC566, 0, 0x3135, 0xC567, 0x5D36,
- 0x3767, 0x3C21, 0, 0x3655, 0xC568, 0, 0, 0x3224,
- 0xC569, 0, 0, 0xC56A, 0xC56B, 0, 0, 0xC56C,
- 0, 0, 0x4D5F, 0, 0, 0xC56D, 0xC56E, 0x5D38,
- 0x5D37, 0x5D3A, 0x353D, 0xC56F, 0, 0x3656, 0x343E, 0xC570,
-};
-const unsigned short utf8_to_euc_E6AD[] = {
- 0, 0, 0, 0x5D3D, 0, 0, 0xC571, 0x5D3C,
- 0, 0x5D3E, 0xC572, 0, 0x324E, 0xC573, 0x4337, 0,
- 0x5D3F, 0, 0xC574, 0x343F, 0x5D41, 0, 0xC575, 0,
- 0xC576, 0x5D40, 0, 0x5D42, 0, 0xC577, 0, 0x5D43,
- 0xC578, 0x5D44, 0x3B5F, 0x4035, 0x3A21, 0, 0x4970, 0xC579,
- 0, 0x4A62, 0x4F44, 0xC57A, 0, 0, 0xC57B, 0x3B75,
- 0xC57C, 0, 0, 0x3A50, 0x4E72, 0xC57D, 0, 0,
- 0x5D45, 0x5D46, 0, 0x3B60, 0, 0xC57E, 0xC621, 0x5D47,
-};
-const unsigned short utf8_to_euc_E6AE[] = {
- 0x5D48, 0, 0xC622, 0x5D4A, 0x5D49, 0xC623, 0x4B58, 0,
+ 0, 0, 0x7A52, 0, 0, 0, 0, 0x5C61,
+ 0x5C5A, 0, 0, 0x5C67, 0, 0x5C65, 0, 0,
+ 0, 0, 0x5C60, 0, 0, 0, 0, 0,
+ 0, 0x5C5F, 0, 0x4450, 0, 0x4165, 0, 0x5C5D,
+};
+unsigned short utf8_to_euc_E6A8[] = {
+ 0, 0, 0x5C5B, 0, 0, 0x5C62, 0, 0,
+ 0, 0, 0x5C68, 0x4875, 0x5C6E, 0, 0, 0,
+ 0, 0, 0x5C69, 0x5C6C, 0x5C66, 0, 0, 0x4374,
+ 0, 0x4938, 0, 0x5C5C, 0, 0, 0x5C64, 0x3E40,
+ 0, 0x4C4F, 0x5C78, 0x5C6B, 0, 0, 0, 0,
+ 0, 0x3822, 0x3223, 0x335F, 0, 0, 0x5C53, 0,
+ 0x7A53, 0, 0, 0, 0, 0x3E41, 0x5C70, 0,
+ 0x5C77, 0x3C79, 0x3372, 0, 0, 0x432E, 0, 0,
+};
+unsigned short utf8_to_euc_E6A9[] = {
+ 0, 0, 0, 0, 0x5C6D, 0, 0x7A55, 0x5C72,
+ 0x5C76, 0, 0, 0x3636, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x354C, 0x5C74, 0, 0, 0, 0, 0, 0x3521,
+ 0, 0x464B, 0x5C73, 0, 0, 0, 0x5C75, 0,
+ 0, 0, 0, 0x7A54, 0, 0, 0, 0,
+ 0, 0, 0x5C6F, 0x7A56, 0, 0, 0, 0,
+ 0x5C71, 0, 0, 0, 0, 0, 0x7A57, 0x3360,
+};
+unsigned short utf8_to_euc_E6AA[] = {
+ 0x4349, 0, 0, 0, 0x5C7C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x5C7A, 0x3869, 0,
+ 0x5C79, 0, 0, 0, 0, 0, 0, 0x5D21,
+ 0, 0, 0, 0, 0x5B58, 0, 0, 0,
+ 0x5C7B, 0, 0x5C7D, 0x5C7E, 0, 0, 0, 0,
+ 0, 0, 0x5D2C, 0, 0x5D28, 0, 0x5B6D, 0,
+ 0, 0, 0, 0x5D27, 0, 0, 0, 0,
+ 0x5D26, 0, 0, 0x5D23, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6AB[] = {
+ 0, 0x5C6A, 0x5D25, 0x5D24, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x5D2A, 0, 0x4F26, 0, 0, 0, 0,
+ 0, 0, 0x5D2D, 0x367B, 0, 0, 0x5D29, 0x5D2B,
+ 0, 0, 0x7A58, 0, 0x7A59, 0, 0, 0,
+ 0x4827, 0, 0x5D2E, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x5D32, 0x5D2F, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6AC[] = {
+ 0, 0, 0, 0, 0x4D73, 0x5D30, 0, 0,
+ 0, 0, 0x5C5E, 0, 0, 0, 0, 0,
+ 0, 0, 0x5D33, 0, 0, 0, 0x5D34, 0,
+ 0, 0, 0, 0, 0, 0x3135, 0, 0x5D36,
+ 0x3767, 0x3C21, 0, 0x3655, 0, 0, 0, 0x3224,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4D5F, 0, 0, 0, 0, 0x5D38,
+ 0x5D37, 0x5D3A, 0x353D, 0, 0, 0x3656, 0x343E, 0,
+};
+unsigned short utf8_to_euc_E6AD[] = {
+ 0, 0, 0, 0x5D3D, 0, 0, 0, 0x5D3C,
+ 0, 0x5D3E, 0, 0, 0x324E, 0, 0x4337, 0,
+ 0x5D3F, 0, 0, 0x343F, 0x5D41, 0, 0, 0,
+ 0, 0x5D40, 0, 0x5D42, 0, 0, 0, 0x5D43,
+ 0, 0x5D44, 0x3B5F, 0x4035, 0x3A21, 0, 0x4970, 0,
+ 0, 0x4A62, 0x4F44, 0, 0, 0, 0, 0x3B75,
+ 0, 0, 0, 0x3A50, 0x4E72, 0, 0, 0,
+ 0x5D45, 0x5D46, 0, 0x3B60, 0, 0, 0, 0x5D47,
+};
+unsigned short utf8_to_euc_E6AE[] = {
+ 0x5D48, 0, 0, 0x5D4A, 0x5D49, 0, 0x4B58, 0,
0, 0x3D5E, 0x3C6C, 0x3B44, 0, 0x5D4B, 0, 0,
- 0, 0, 0, 0, 0, 0x5D4D, 0x3F23, 0xC624,
- 0x5D4C, 0, 0, 0xC625, 0, 0, 0x5D4E, 0xC626,
- 0xC627, 0, 0xC628, 0xC629, 0x5D4F, 0, 0, 0,
- 0xC62A, 0xC62B, 0x5D50, 0x5D51, 0xC62C, 0xC62D, 0xC62E, 0x5D52,
- 0xC62F, 0x5D54, 0x5D53, 0x5D55, 0x3225, 0x434A, 0, 0x5D56,
- 0xC630, 0xC631, 0x3B26, 0x334C, 0x5D57, 0xC632, 0xC633, 0x4542,
-};
-const unsigned short utf8_to_euc_E6AF[] = {
- 0x544C, 0, 0, 0xC634, 0xC635, 0x3523, 0x5D58, 0,
- 0, 0xC636, 0, 0x5D59, 0xC637, 0x4A6C, 0x4B68, 0,
- 0, 0, 0x4647, 0x5D5A, 0x4866, 0, 0xC638, 0,
- 0x487B, 0, 0xC639, 0x4C53, 0, 0, 0, 0x5D5B,
- 0, 0xC63A, 0, 0xC63B, 0, 0, 0xC63C, 0xC63D,
- 0, 0, 0, 0x5D5D, 0x5D5C, 0, 0xC63E, 0x5D5F,
- 0, 0xC63F, 0, 0x5D5E, 0, 0, 0, 0xC640,
- 0, 0xC641, 0, 0, 0, 0, 0, 0xC642,
-};
-const unsigned short utf8_to_euc_E6B0[] = {
- 0, 0, 0xC643, 0, 0xC644, 0xC645, 0, 0,
- 0x5D61, 0xC646, 0, 0, 0, 0xC647, 0xC648, 0x3B61,
- 0xC649, 0x4C31, 0xC64A, 0x5D62, 0x5D63, 0, 0, 0x3524,
- 0, 0xC64B, 0, 0x5D64, 0, 0, 0, 0xC64C,
- 0, 0, 0, 0x5D66, 0x5D65, 0, 0xC64D, 0xC64E,
- 0xC64F, 0, 0, 0, 0xC650, 0, 0xC651, 0,
- 0, 0, 0, 0xC652, 0x3F65, 0xC653, 0xC654, 0x4939,
- 0x314A, 0, 0xC655, 0xC656, 0, 0, 0x4845, 0xC657,
-};
-const unsigned short utf8_to_euc_E6B1[] = {
+ 0, 0, 0, 0, 0, 0x5D4D, 0x3F23, 0,
+ 0x5D4C, 0, 0, 0, 0, 0, 0x5D4E, 0,
+ 0, 0, 0, 0, 0x5D4F, 0, 0, 0,
+ 0, 0, 0x5D50, 0x5D51, 0, 0, 0, 0x5D52,
+ 0, 0x5D54, 0x5D53, 0x5D55, 0x3225, 0x434A, 0, 0x5D56,
+ 0, 0, 0x3B26, 0x334C, 0x5D57, 0, 0, 0x4542,
+};
+unsigned short utf8_to_euc_E6AF[] = {
+ 0x544C, 0, 0, 0, 0, 0x3523, 0x5D58, 0,
+ 0, 0, 0, 0x5D59, 0, 0x4A6C, 0x4B68, 0,
+ 0, 0, 0x4647, 0x5D5A, 0x4866, 0, 0x7A5A, 0,
+ 0x487B, 0, 0, 0x4C53, 0, 0, 0, 0x5D5B,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x5D5D, 0x5D5C, 0, 0, 0x5D5F,
+ 0, 0, 0, 0x5D5E, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6B0[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5D61, 0, 0, 0, 0, 0, 0, 0x3B61,
+ 0, 0x4C31, 0, 0x5D62, 0x5D63, 0, 0, 0x3524,
+ 0, 0, 0, 0x5D64, 0, 0, 0, 0,
+ 0, 0, 0, 0x5D66, 0x5D65, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x3F65, 0, 0, 0x4939,
+ 0x314A, 0, 0, 0, 0, 0, 0x4845, 0x7A5B,
+};
+unsigned short utf8_to_euc_E6B1[] = {
0x4475, 0x3D41, 0x3561, 0, 0, 0, 0, 0,
- 0, 0, 0xC658, 0xC659, 0, 0xC65A, 0x4846, 0xC65B,
- 0x3C2E, 0, 0xC65C, 0, 0xC65D, 0x5D68, 0, 0x3440,
- 0, 0xC65E, 0x3178, 0xC65F, 0xC660, 0x4672, 0x5D67, 0x393E,
- 0x4353, 0, 0x5D69, 0, 0, 0, 0, 0xC736,
- 0x5D71, 0, 0x5D6A, 0xC661, 0, 0xC662, 0, 0xC663,
- 0x4241, 0, 0x3562, 0x5D72, 0xC664, 0, 0xC665, 0,
- 0xC666, 0xC667, 0x3768, 0xC668, 0, 0x3525, 0x5D70, 0,
-};
-const unsigned short utf8_to_euc_E6B2[] = {
- 0, 0x5D6E, 0x5D6B, 0x4D60, 0, 0xC669, 0xC66A, 0xC66B,
- 0x4440, 0xC66C, 0, 0, 0x4659, 0x5D6C, 0, 0,
- 0x5D74, 0, 0x5D73, 0x3723, 0xC66D, 0xC66E, 0x322D, 0xC66F,
- 0xC670, 0x3A3B, 0x5D6D, 0x5D6F, 0xC671, 0, 0, 0xC672,
+ 0, 0, 0, 0, 0, 0, 0x4846, 0,
+ 0x3C2E, 0, 0, 0, 0, 0x5D68, 0, 0x3440,
+ 0, 0, 0x3178, 0, 0x7A5C, 0x4672, 0x5D67, 0x393E,
+ 0x4353, 0, 0x5D69, 0, 0, 0, 0, 0,
+ 0x5D71, 0, 0x5D6A, 0, 0, 0, 0, 0x7A5E,
+ 0x4241, 0, 0x3562, 0x5D72, 0, 0, 0, 0,
+ 0, 0, 0x3768, 0, 0, 0x3525, 0x5D70, 0,
+};
+unsigned short utf8_to_euc_E6B2[] = {
+ 0, 0x5D6E, 0x5D6B, 0x4D60, 0, 0, 0x7A5D, 0,
+ 0x4440, 0, 0, 0, 0x4659, 0x5D6C, 0, 0,
+ 0x5D74, 0, 0x5D73, 0x3723, 0, 0, 0x322D, 0,
+ 0, 0x3A3B, 0x5D6D, 0x5D6F, 0, 0, 0, 0,
0, 0x4B57, 0x4274, 0, 0, 0, 0, 0,
0, 0, 0, 0x4B77, 0, 0, 0x5D7C, 0,
- 0xC673, 0x5D7D, 0xC674, 0x324F, 0xC675, 0, 0, 0,
+ 0, 0x5D7D, 0, 0x324F, 0, 0, 0, 0,
0x4A28, 0x4C7D, 0x5E21, 0x3C23, 0x3E42, 0x5D78, 0x5D7E, 0x3168,
};
-const unsigned short utf8_to_euc_E6B3[] = {
- 0, 0x3637, 0xC676, 0, 0x5D75, 0x5D7A, 0xC677, 0,
- 0, 0x4074, 0x4771, 0, 0x4867, 0xC678, 0, 0xC679,
- 0xC67A, 0xC67B, 0xC67C, 0x5D77, 0xC67D, 0x4B21, 0xC67E, 0x5D79,
- 0, 0x5E24, 0xC721, 0x5E22, 0xC722, 0x5D7B, 0, 0,
- 0xC723, 0x4B22, 0x4748, 0x3563, 0, 0x4525, 0, 0xC724,
- 0x436D, 0xC725, 0x5E25, 0xC726, 0xC727, 0, 0xC728, 0x5E23,
- 0x4259, 0x5D76, 0xC729, 0x314B, 0xC72A, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E6B4[] = {
- 0, 0, 0, 0, 0xC72B, 0, 0, 0xC72C,
- 0, 0, 0xC72D, 0x4D4E, 0x5E30, 0, 0xC72E, 0xC72F,
- 0, 0xC730, 0x5E2F, 0xC731, 0, 0, 0, 0x4076,
- 0, 0x5E2C, 0xC732, 0x4D6C, 0, 0, 0x4636, 0x5E26,
- 0, 0, 0, 0, 0, 0x4445, 0xC733, 0xC734,
- 0xC735, 0x314C, 0x393F, 0x5E29, 0, 0, 0xC737, 0xC738,
- 0, 0xC739, 0x3D27, 0x5E2E, 0, 0x5E2D, 0x5E28, 0,
- 0x5E2B, 0xC73A, 0, 0x3368, 0xC73B, 0x5E2A, 0x4749, 0xC73C,
-};
-const unsigned short utf8_to_euc_E6B5[] = {
+unsigned short utf8_to_euc_E6B3[] = {
+ 0, 0x3637, 0, 0, 0x5D75, 0x5D7A, 0, 0,
+ 0, 0x4074, 0x4771, 0, 0x4867, 0, 0, 0,
+ 0, 0, 0, 0x5D77, 0, 0x4B21, 0, 0x5D79,
+ 0, 0x5E24, 0x7A5F, 0x5E22, 0, 0x5D7B, 0, 0,
+ 0, 0x4B22, 0x4748, 0x3563, 0, 0x4525, 0, 0,
+ 0x436D, 0, 0x5E25, 0, 0, 0, 0, 0x5E23,
+ 0x4259, 0x5D76, 0, 0x314B, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6B4[] = {
+ 0, 0, 0, 0, 0x7A60, 0, 0, 0,
+ 0, 0, 0, 0x4D4E, 0x5E30, 0, 0, 0,
+ 0, 0, 0x5E2F, 0, 0, 0, 0, 0x4076,
+ 0, 0x5E2C, 0, 0x4D6C, 0, 0, 0x4636, 0x5E26,
+ 0, 0, 0, 0, 0, 0x4445, 0, 0,
+ 0, 0x314C, 0x393F, 0x5E29, 0, 0, 0, 0,
+ 0, 0, 0x3D27, 0x5E2E, 0, 0x5E2D, 0x5E28, 0,
+ 0x5E2B, 0, 0, 0x3368, 0, 0x5E2A, 0x4749, 0,
+};
+unsigned short utf8_to_euc_E6B5[] = {
0, 0x4E2E, 0, 0, 0x3E74, 0x4075, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xC73D,
- 0, 0x5E36, 0x5E34, 0, 0x494D, 0, 0xC73E, 0xC73F,
- 0, 0xC740, 0, 0x5E31, 0x5E33, 0xC741, 0x313A, 0xC742,
- 0, 0x3940, 0x4F32, 0, 0x333D, 0, 0x4962, 0xC743,
- 0xC744, 0, 0, 0, 0x4D61, 0, 0, 0x3324,
- 0x3F3B, 0x5E35, 0, 0, 0xC745, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x5E36, 0x5E34, 0, 0x494D, 0, 0, 0,
+ 0, 0, 0, 0x5E31, 0x5E33, 0, 0x313A, 0,
+ 0, 0x3940, 0x4F32, 0, 0x333D, 0, 0x4962, 0x7A62,
+ 0, 0, 0, 0, 0x4D61, 0, 0, 0x3324,
+ 0x3F3B, 0x5E35, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E6B6[] = {
- 0, 0, 0xC746, 0, 0, 0x5E3A, 0, 0xC747,
+unsigned short utf8_to_euc_E6B6[] = {
+ 0, 0, 0, 0, 0, 0x5E3A, 0, 0x7A61,
0x3E43, 0, 0, 0, 0x4D30, 0, 0x5E37, 0,
- 0, 0xC748, 0xC749, 0x5E32, 0xC74A, 0x5E38, 0xC74B, 0xC74C,
- 0xC74D, 0x4E5E, 0, 0x4573, 0x4642, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xC74E, 0, 0xC74F, 0, 0, 0x3336,
- 0, 0, 0x3155, 0, 0xC750, 0x5E3E, 0, 0xC751,
- 0x5E41, 0xC752, 0, 0, 0x4E43, 0xC753, 0, 0xC754,
-};
-const unsigned short utf8_to_euc_E6B7[] = {
- 0x4D64, 0, 0, 0, 0xC755, 0x5E48, 0x5E42, 0x5E3F,
- 0xC756, 0, 0xC757, 0x4E54, 0x5E45, 0, 0xC758, 0xC759,
- 0, 0x3D4A, 0x5E47, 0, 0, 0x5E4C, 0xC75A, 0,
- 0x4571, 0x5E4A, 0, 0xC75B, 0, 0xC75C, 0x5E44, 0xC75D,
- 0xC75E, 0x4338, 0xC75F, 0, 0x5E4B, 0xC760, 0x5E40, 0,
- 0x5E46, 0xC761, 0x5E4D, 0x307C, 0x5E43, 0, 0x5E4E, 0xC762,
- 0xC763, 0x3F3C, 0xF44C, 0x3D5F, 0xC764, 0x4A25, 0xC765, 0x3A2E,
- 0xF44B, 0x5E3B, 0x5E49, 0x453A, 0xC766, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E6B8[] = {
- 0xC767, 0, 0, 0, 0xC768, 0x4036, 0, 0x3369,
+ 0, 0, 0, 0x5E32, 0, 0x5E38, 0x7A63, 0,
+ 0, 0x4E5E, 0, 0x4573, 0x4642, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x7A64, 0, 0, 0x3336,
+ 0, 0, 0x3155, 0, 0, 0x5E3E, 0, 0,
+ 0x5E41, 0, 0, 0, 0x4E43, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6B7[] = {
+ 0x4D64, 0, 0, 0, 0, 0x5E48, 0x5E42, 0x5E3F,
+ 0, 0, 0, 0x4E54, 0x5E45, 0, 0, 0x7A65,
+ 0, 0x3D4A, 0x5E47, 0, 0, 0x5E4C, 0, 0,
+ 0x4571, 0x5E4A, 0, 0, 0, 0, 0x5E44, 0,
+ 0, 0x4338, 0, 0, 0x5E4B, 0, 0x5E40, 0,
+ 0x5E46, 0, 0x5E4D, 0x307C, 0x5E43, 0, 0x5E4E, 0,
+ 0, 0x3F3C, 0x7A67, 0x3D5F, 0, 0x4A25, 0, 0x3A2E,
+ 0x7A66, 0x5E3B, 0x5E49, 0x453A, 0x7A68, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6B8[] = {
+ 0, 0, 0, 0, 0, 0x4036, 0, 0x3369,
0x3A51, 0x3E44, 0x5E3D, 0x3D42, 0, 0, 0, 0,
0, 0, 0, 0x374C, 0, 0x5E3C, 0, 0,
- 0, 0x5E52, 0x3D6D, 0x383A, 0, 0x5E61, 0xC769, 0x5E5B,
- 0x3574, 0x454F, 0xC76A, 0x5E56, 0x5E5F, 0x302F, 0x3132, 0xC76B,
+ 0, 0x5E52, 0x3D6D, 0x383A, 0, 0x5E61, 0, 0x5E5B,
+ 0x3574, 0x454F, 0, 0x5E56, 0x5E5F, 0x302F, 0x3132, 0x7A6B,
0, 0x3239, 0, 0x5E58, 0x422C, 0x5E4F, 0x5E51, 0x3941,
- 0, 0, 0xC76C, 0, 0, 0, 0xC76D, 0,
- 0x5E62, 0xC76E, 0x5E5D, 0xC76F, 0xC770, 0, 0x5E55, 0,
-};
-const unsigned short utf8_to_euc_E6B9[] = {
- 0, 0, 0, 0x5E5C, 0xC771, 0xC772, 0, 0,
- 0xC773, 0xC774, 0x4C2B, 0xC775, 0, 0x5E5A, 0x5E5E, 0xC776,
- 0, 0xC777, 0xC778, 0xC779, 0xC77A, 0, 0x3850, 0xC77B,
- 0x3E45, 0, 0, 0x4339, 0xC77C, 0xC77D, 0xC77E, 0x5E54,
- 0, 0, 0xC821, 0xC822, 0, 0, 0, 0x4D2F,
- 0xC823, 0, 0, 0x5E57, 0, 0, 0x5E50, 0x4572,
- 0, 0, 0x5E53, 0xC824, 0, 0, 0x5E59, 0,
- 0, 0, 0, 0xC825, 0, 0xC826, 0x4F51, 0x3C3E,
-};
-const unsigned short utf8_to_euc_E6BA[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5E62, 0x7A69, 0x5E5D, 0, 0x7A6C, 0, 0x5E55, 0,
+};
+unsigned short utf8_to_euc_E6B9[] = {
+ 0, 0, 0, 0x5E5C, 0, 0, 0, 0,
+ 0, 0, 0x4C2B, 0, 0, 0x5E5A, 0x5E5E, 0,
+ 0, 0, 0, 0, 0, 0, 0x3850, 0,
+ 0x3E45, 0, 0, 0x4339, 0x7A6A, 0, 0, 0x5E54,
+ 0, 0, 0, 0, 0, 0, 0, 0x4D2F,
+ 0, 0, 0, 0x5E57, 0, 0, 0x5E50, 0x4572,
+ 0, 0, 0x5E53, 0, 0, 0, 0x5E59, 0,
+ 0, 0, 0, 0, 0, 0, 0x4F51, 0x3C3E,
+};
+unsigned short utf8_to_euc_E6BA[] = {
0x4B7E, 0, 0x5E63, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0x482E, 0xC827, 0, 0x5E6F,
- 0x383B, 0, 0, 0xC828, 0, 0, 0x3D60, 0,
- 0x5E65, 0xC829, 0, 0, 0x4E2F, 0x3942, 0, 0x5E72,
- 0xC82A, 0, 0x306E, 0, 0, 0x5E70, 0, 0xC82B,
- 0, 0, 0x5E64, 0, 0, 0xC82C, 0xC82D, 0x5E6A,
- 0, 0xC82E, 0x5E6C, 0xC82F, 0, 0, 0x4D4F, 0x5E67,
- 0, 0, 0x452E, 0xC830, 0, 0x5E69, 0, 0xC831,
-};
-const unsigned short utf8_to_euc_E6BB[] = {
- 0xC832, 0xC833, 0x5E71, 0xC834, 0x5E6B, 0x4C47, 0, 0xC835,
- 0xC836, 0x5E66, 0xC837, 0x3C22, 0x5E7E, 0xC838, 0xC839, 0xC83A,
+ 0, 0, 0, 0, 0x482E, 0, 0, 0x5E6F,
+ 0x383B, 0, 0, 0, 0, 0, 0x3D60, 0,
+ 0x5E65, 0, 0, 0, 0x4E2F, 0x3942, 0, 0x5E72,
+ 0, 0, 0x306E, 0, 0, 0x5E70, 0, 0,
+ 0, 0, 0x5E64, 0, 0, 0, 0, 0x5E6A,
+ 0, 0, 0x5E6C, 0, 0, 0, 0x4D4F, 0x5E67,
+ 0, 0, 0x452E, 0, 0, 0x5E69, 0, 0x7A6D,
+};
+unsigned short utf8_to_euc_E6BB[] = {
+ 0, 0, 0x5E71, 0, 0x5E6B, 0x4C47, 0, 0,
+ 0, 0x5E66, 0, 0x3C22, 0x5E7E, 0, 0, 0,
0, 0x336A, 0, 0x5E68, 0x5E6D, 0x5E6E, 0, 0,
0, 0, 0, 0, 0, 0x426C, 0x425A, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xC83B, 0x5E76, 0xC83C, 0xC83D, 0x5E7C,
+ 0, 0, 0, 0, 0x5E76, 0, 0, 0x5E7C,
0, 0, 0x5E7A, 0, 0x4529, 0, 0, 0x5F23,
- 0x5E77, 0xC83E, 0, 0xC83F, 0, 0xC840, 0x5E78, 0x5E60,
-};
-const unsigned short utf8_to_euc_E6BC[] = {
- 0, 0x3579, 0x493A, 0, 0xC841, 0, 0x3C3F, 0,
- 0xC842, 0x3977, 0xC843, 0, 0xC844, 0xC845, 0, 0x4F33,
- 0, 0x5E74, 0, 0x5F22, 0x3169, 0x4166, 0xC846, 0,
- 0xC847, 0, 0xC848, 0xC849, 0, 0, 0, 0,
- 0x4779, 0, 0x3441, 0x4E7A, 0, 0, 0xC84A, 0,
- 0, 0xC84B, 0xC84C, 0x4C21, 0x4452, 0xC853, 0, 0xC84D,
- 0xC84E, 0x5E7B, 0x5E7D, 0xC84F, 0, 0, 0xC850, 0,
- 0x4132, 0, 0, 0xC851, 0xC852, 0, 0x5F21, 0x5E79,
-};
-const unsigned short utf8_to_euc_E6BD[] = {
+ 0x5E77, 0, 0, 0, 0, 0, 0x5E78, 0x5E60,
+};
+unsigned short utf8_to_euc_E6BC[] = {
+ 0, 0x3579, 0x493A, 0, 0, 0, 0x3C3F, 0,
+ 0, 0x3977, 0, 0, 0, 0, 0, 0x4F33,
+ 0, 0x5E74, 0, 0x5F22, 0x3169, 0x4166, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x4779, 0, 0x3441, 0x4E7A, 0, 0, 0, 0,
+ 0, 0, 0, 0x4C21, 0x4452, 0, 0, 0,
+ 0, 0x5E7B, 0x5E7D, 0, 0, 0, 0, 0,
+ 0x4132, 0, 0, 0, 0, 0, 0x5F21, 0x5E79,
+};
+unsigned short utf8_to_euc_E6BD[] = {
0, 0x5E73, 0, 0, 0, 0x3443, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xC854,
- 0, 0xC855, 0xC856, 0xC857, 0x3769, 0, 0, 0xC858,
- 0x5F2F, 0xC859, 0xC85A, 0x5F2A, 0x4078, 0xC85B, 0xC85C, 0x3363,
- 0, 0xC85D, 0xC85E, 0, 0x3D61, 0, 0x5F33, 0,
- 0xC85F, 0, 0, 0, 0xC860, 0x5F2C, 0x442C, 0x5F29,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x3769, 0, 0, 0,
+ 0x5F2F, 0, 0, 0x5F2A, 0x4078, 0, 0, 0x3363,
+ 0, 0, 0, 0, 0x3D61, 0, 0x5F33, 0,
+ 0, 0, 0, 0, 0, 0x5F2C, 0x442C, 0x5F29,
0x4459, 0, 0, 0, 0x5F4C, 0, 0, 0,
- 0x5F26, 0, 0x5F25, 0, 0x5F2E, 0xC861, 0xC862, 0,
-};
-const unsigned short utf8_to_euc_E6BE[] = {
- 0x5F28, 0x5F27, 0x5F2D, 0xC863, 0x4021, 0, 0x5F24, 0xC864,
- 0xC865, 0, 0, 0xC866, 0xC867, 0xC868, 0x5F30, 0,
- 0xC869, 0x5F31, 0xC86A, 0xC86B, 0xC86C, 0, 0xC86D, 0x3442,
- 0, 0, 0xC86E, 0, 0, 0, 0, 0xC86F,
- 0xC870, 0x5F36, 0, 0x5F35, 0x5F37, 0xC871, 0xC872, 0xC873,
- 0xC874, 0, 0x5F3A, 0, 0, 0, 0xC875, 0xC876,
- 0xC877, 0x4543, 0, 0x5F34, 0, 0xC878, 0xC879, 0,
- 0, 0x5F38, 0, 0, 0xC87A, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E6BF[] = {
- 0x3763, 0x4279, 0x5F32, 0x473B, 0, 0xC87B, 0x5F39, 0xC87C,
- 0xC87D, 0, 0xC87E, 0, 0, 0, 0, 0,
+ 0x5F26, 0, 0x5F25, 0, 0x5F2E, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6BE[] = {
+ 0x5F28, 0x5F27, 0x5F2D, 0, 0x4021, 0, 0x5F24, 0,
+ 0x7A6E, 0, 0, 0, 0, 0, 0x5F30, 0,
+ 0, 0x5F31, 0, 0, 0, 0, 0, 0x3442,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x5F36, 0, 0x5F35, 0x5F37, 0, 0, 0,
+ 0, 0, 0x5F3A, 0, 0, 0, 0, 0,
+ 0, 0x4543, 0, 0x5F34, 0, 0x7A6F, 0, 0,
+ 0, 0x5F38, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E6BF[] = {
+ 0x3763, 0x4279, 0x5F32, 0x473B, 0, 0, 0x5F39, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x5F3E, 0x5F3C, 0, 0,
- 0x5F3F, 0, 0xC921, 0x5F42, 0, 0, 0xC922, 0x5F3B,
+ 0x5F3F, 0, 0, 0x5F42, 0, 0, 0, 0x5F3B,
0x396A, 0x4728, 0, 0, 0x5E39, 0, 0, 0,
- 0xC923, 0xC924, 0, 0x4D74, 0x5F3D, 0, 0x5F41, 0x4275,
- 0xC925, 0x5F40, 0, 0x5F2B, 0, 0xC926, 0x6F69, 0,
- 0, 0xC927, 0x5F45, 0, 0xC928, 0xC929, 0x5F49, 0,
-};
-const unsigned short utf8_to_euc_E780[] = {
- 0xC92A, 0x5F47, 0, 0, 0, 0xC92B, 0xC92C, 0xC92D,
- 0, 0x5F43, 0, 0x5F44, 0, 0xC92E, 0, 0x5F48,
- 0, 0x5F46, 0, 0, 0, 0x494E, 0, 0xC92F,
+ 0, 0, 0, 0x4D74, 0x5F3D, 0, 0x5F41, 0x4275,
+ 0, 0x5F40, 0, 0x5F2B, 0, 0x7A70, 0x6F69, 0,
+ 0, 0, 0x5F45, 0, 0, 0, 0x5F49, 0,
+};
+unsigned short utf8_to_euc_E780[] = {
+ 0, 0x5F47, 0, 0, 0, 0x7A71, 0, 0x7A72,
+ 0, 0x5F43, 0, 0x5F44, 0, 0, 0, 0x5F48,
+ 0, 0x5F46, 0, 0, 0, 0x494E, 0, 0,
0x5F4E, 0, 0x5F4B, 0x5F4A, 0, 0x5F4D, 0x4654, 0x5F4F,
- 0xC930, 0, 0, 0xC931, 0, 0, 0x4375, 0x426D,
- 0xF44D, 0, 0, 0, 0x4025, 0, 0, 0xC932,
- 0x5F50, 0, 0x5F52, 0, 0xC933, 0, 0, 0xC934,
- 0, 0xC935, 0, 0, 0xC936, 0, 0x5F51, 0,
-};
-const unsigned short utf8_to_euc_E781[] = {
- 0, 0, 0, 0xC937, 0xC938, 0, 0, 0,
- 0xC939, 0xC93A, 0xC93B, 0xC93C, 0x5E75, 0, 0xC941, 0,
- 0, 0x5F53, 0, 0, 0xC93D, 0xC93E, 0, 0,
- 0x4667, 0, 0, 0, 0, 0xC93F, 0xC940, 0,
- 0, 0, 0, 0x5F54, 0xC942, 0xC943, 0, 0,
- 0, 0, 0, 0x3250, 0xC944, 0, 0xC945, 0x4574,
- 0x3325, 0, 0, 0, 0, 0xC946, 0xC947, 0,
- 0x3564, 0, 0, 0, 0x3C5E, 0x3A52, 0xC948, 0,
-};
-const unsigned short utf8_to_euc_E782[] = {
- 0, 0xC949, 0, 0, 0, 0xC94A, 0xC94B, 0,
+ 0, 0, 0, 0, 0, 0, 0x4375, 0x426D,
+ 0x7A73, 0, 0, 0, 0x4025, 0, 0, 0,
+ 0x5F50, 0, 0x5F52, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x5F51, 0,
+};
+unsigned short utf8_to_euc_E781[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x5E75, 0, 0, 0,
+ 0, 0x5F53, 0, 0, 0, 0, 0, 0,
+ 0x4667, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x5F54, 0, 0, 0, 0,
+ 0, 0, 0, 0x3250, 0, 0, 0, 0x4574,
+ 0x3325, 0, 0, 0, 0, 0, 0, 0,
+ 0x3564, 0, 0, 0, 0x3C5E, 0x3A52, 0, 0,
+};
+unsigned short utf8_to_euc_E782[] = {
+ 0, 0, 0, 0, 0, 0x7A74, 0, 0,
0, 0x4F27, 0x3F66, 0, 0, 0, 0x316A, 0,
- 0, 0, 0x5F56, 0, 0xC94C, 0xC94D, 0xC94E, 0xC94F,
- 0xC950, 0x5F55, 0, 0xC951, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xC952, 0, 0, 0,
- 0, 0, 0, 0xC953, 0x5F59, 0x433A, 0x5F5C, 0x5F57,
- 0xC954, 0xC955, 0, 0x5F5B, 0xC956, 0, 0, 0xC957,
- 0x5F5A, 0x4540, 0x3059, 0xF42E, 0, 0, 0, 0,
+ 0, 0, 0x5F56, 0, 0, 0, 0, 0,
+ 0, 0x5F55, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x7A75, 0x5F59, 0x433A, 0x5F5C, 0x5F57,
+ 0, 0, 0, 0x5F5B, 0, 0, 0, 0,
+ 0x5F5A, 0x4540, 0x3059, 0x7927, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E783[] = {
+unsigned short utf8_to_euc_E783[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x4E75, 0, 0, 0x5F5E, 0, 0, 0, 0x3128,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x5F60, 0, 0, 0, 0x5F5F, 0, 0x5F5D,
0, 0, 0, 0, 0, 0, 0, 0,
- 0x4E75, 0, 0xC958, 0x5F5E, 0, 0, 0, 0x3128,
- 0, 0xC959, 0, 0xC95A, 0xC95B, 0xC95C, 0xC95D, 0,
- 0xC95E, 0x5F60, 0, 0, 0xC95F, 0x5F5F, 0, 0x5F5D,
- 0, 0, 0, 0, 0xC960, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0x5F58, 0, 0, 0, 0, 0, 0,
- 0, 0x4B23, 0xC961, 0, 0, 0x5F62, 0, 0,
+ 0, 0x4B23, 0, 0, 0, 0x5F62, 0, 0,
};
-const unsigned short utf8_to_euc_E784[] = {
- 0, 0, 0, 0xC962, 0xC963, 0xC964, 0xC965, 0xC966,
- 0, 0x5F61, 0, 0xC967, 0xC968, 0, 0, 0xC969,
+unsigned short utf8_to_euc_E784[] = {
+ 0, 0, 0, 0, 0x7A77, 0, 0, 0,
+ 0, 0x5F61, 0, 0, 0, 0, 0, 0x7A76,
0, 0, 0, 0, 0x316B, 0, 0, 0,
- 0, 0x5F64, 0x4A32, 0, 0x5F63, 0, 0xC96A, 0,
- 0xC96B, 0x4C35, 0, 0, 0, 0, 0x3E47, 0,
- 0, 0, 0, 0xC96C, 0, 0xC96D, 0, 0xC96E,
- 0xC96F, 0xC970, 0, 0, 0, 0, 0x4133, 0,
- 0xC971, 0, 0, 0, 0x3E46, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E785[] = {
- 0, 0xC972, 0, 0, 0, 0xC973, 0xC974, 0xC975,
- 0, 0x4E7B, 0xC976, 0xC977, 0x5F6A, 0, 0x4079, 0,
- 0xC978, 0, 0xC979, 0, 0, 0x5F66, 0x5F6B, 0xC97A,
- 0, 0x316C, 0xC97B, 0, 0xC97C, 0, 0xC97D, 0,
- 0xC97E, 0, 0x5F69, 0, 0x4761, 0x5F65, 0x5F68, 0x3E48,
- 0xCA21, 0x4851, 0, 0, 0x5F6C, 0, 0x3C51, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xCA22, 0, 0, 0, 0x407A, 0, 0,
-};
-const unsigned short utf8_to_euc_E786[] = {
- 0xCA23, 0, 0, 0, 0x5F6F, 0xCA24, 0, 0xCA25,
- 0x5F67, 0, 0x3727, 0, 0xCA26, 0, 0, 0x5F6D,
- 0, 0, 0xCA27, 0, 0x4D50, 0x5F70, 0, 0,
- 0, 0x7426, 0xCA28, 0xCA29, 0, 0, 0, 0x3D4F,
- 0xCA2A, 0, 0xCA2B, 0, 0, 0, 0, 0,
- 0x5F71, 0, 0, 0, 0x5F72, 0, 0, 0xCA2C,
- 0xCA2D, 0x472E, 0xCA2E, 0xCA2F, 0, 0, 0, 0,
- 0, 0x5F74, 0xCA30, 0, 0, 0, 0x5F75, 0xCA31,
-};
-const unsigned short utf8_to_euc_E787[] = {
- 0xCA32, 0xCA33, 0, 0x4733, 0xCA34, 0, 0, 0,
- 0x4575, 0x5F77, 0, 0xCA35, 0xCA36, 0, 0x5F79, 0,
- 0x4E55, 0, 0x5F76, 0xCA37, 0x5F78, 0x316D, 0xCA38, 0x5F73,
- 0, 0xCA39, 0xCA3A, 0, 0xCA3B, 0, 0, 0x535B,
+ 0, 0x5F64, 0x4A32, 0, 0x5F63, 0, 0, 0,
+ 0, 0x4C35, 0, 0, 0, 0, 0x3E47, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x4133, 0,
+ 0, 0, 0, 0, 0x3E46, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E785[] = {
+ 0, 0, 0, 0, 0, 0, 0x7A79, 0x7A7A,
+ 0, 0x4E7B, 0, 0, 0x5F6A, 0, 0x4079, 0,
+ 0, 0, 0, 0, 0, 0x5F66, 0x5F6B, 0,
+ 0, 0x316C, 0, 0, 0x7A78, 0, 0, 0,
+ 0, 0, 0x5F69, 0, 0x4761, 0x5F65, 0x5F68, 0x3E48,
+ 0, 0x4851, 0, 0, 0x5F6C, 0, 0x3C51, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x407A, 0, 0,
+};
+unsigned short utf8_to_euc_E786[] = {
+ 0, 0, 0, 0, 0x5F6F, 0, 0, 0,
+ 0x5F67, 0, 0x3727, 0, 0, 0, 0, 0x5F6D,
+ 0, 0, 0, 0, 0x4D50, 0x5F70, 0, 0,
+ 0, 0x7426, 0, 0, 0, 0, 0, 0x3D4F,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x5F71, 0, 0, 0, 0x5F72, 0, 0, 0,
+ 0, 0x472E, 0, 0, 0, 0, 0, 0,
+ 0, 0x5F74, 0, 0, 0, 0, 0x5F75, 0,
+};
+unsigned short utf8_to_euc_E787[] = {
+ 0, 0x7A7C, 0, 0x4733, 0, 0, 0, 0,
+ 0x4575, 0x5F77, 0, 0, 0, 0, 0x5F79, 0,
+ 0x4E55, 0, 0x5F76, 0, 0x5F78, 0x316D, 0, 0x5F73,
+ 0, 0, 0, 0, 0, 0, 0, 0x535B,
0x5F7A, 0, 0, 0, 0, 0x4167, 0x3B38, 0x5F7C,
0, 0, 0, 0, 0x5F7B, 0x3F24, 0x5259, 0,
0, 0, 0, 0, 0, 0x5F7D, 0, 0,
- 0xCA3C, 0x6021, 0, 0x5F6E, 0x5F7E, 0, 0xCA3D, 0x6022,
-};
-const unsigned short utf8_to_euc_E788[] = {
- 0xCA3E, 0, 0, 0, 0, 0, 0x477A, 0xCA3F,
- 0xCA40, 0xCA41, 0, 0, 0, 0x6023, 0, 0,
- 0x6024, 0, 0, 0xCA42, 0, 0, 0, 0xCA43,
- 0, 0, 0xCA44, 0x6025, 0, 0xCA45, 0, 0xCA46,
- 0, 0, 0, 0, 0xCA47, 0, 0, 0,
- 0x6026, 0, 0x445E, 0xCA48, 0x6028, 0x6027, 0, 0xCA49,
- 0x6029, 0, 0x602A, 0, 0xCA4A, 0x3C5F, 0x4963, 0,
- 0xCA4B, 0xCA4C, 0x4C6C, 0x602B, 0x602C, 0x4156, 0x3C24, 0x602D,
-};
-const unsigned short utf8_to_euc_E789[] = {
- 0x602E, 0xCA4D, 0xCA4E, 0xCA4F, 0, 0xCA50, 0x602F, 0x4A52,
- 0x4847, 0, 0, 0x6030, 0x4757, 0, 0xCA51, 0xCA52,
- 0xCA53, 0, 0x442D, 0xCA54, 0, 0xCA55, 0xCA56, 0,
- 0x6031, 0x3267, 0xCA57, 0x356D, 0xCA58, 0x4C46, 0xCA59, 0x4C36,
- 0xCA5A, 0x3234, 0x4F34, 0xCA5B, 0, 0, 0, 0x4B52,
- 0xCA5C, 0x4A2A, 0, 0xCA5D, 0, 0, 0xCA5E, 0xCA5F,
- 0, 0xCA60, 0x4037, 0, 0x6032, 0, 0, 0xCA61,
- 0xCA62, 0x4643, 0, 0xCA63, 0xCA64, 0x3823, 0x6033, 0xCA65,
-};
-const unsigned short utf8_to_euc_E78A[] = {
- 0x3A54, 0x6035, 0x6034, 0, 0xCA66, 0, 0, 0x6036,
- 0, 0xCA67, 0, 0, 0, 0xCA68, 0xCA69, 0,
- 0, 0, 0x6037, 0xCA6A, 0, 0, 0x6038, 0,
- 0, 0, 0, 0xCA6B, 0, 0, 0, 0,
+ 0, 0x6021, 0, 0x5F6E, 0x5F7E, 0, 0x7A7D, 0x6022,
+};
+unsigned short utf8_to_euc_E788[] = {
+ 0, 0, 0, 0, 0, 0, 0x477A, 0,
+ 0, 0, 0, 0, 0, 0x6023, 0, 0,
+ 0x6024, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6025, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6026, 0, 0x445E, 0, 0x6028, 0x6027, 0, 0,
+ 0x6029, 0, 0x602A, 0, 0, 0x3C5F, 0x4963, 0,
+ 0, 0, 0x4C6C, 0x602B, 0x602C, 0x4156, 0x3C24, 0x602D,
+};
+unsigned short utf8_to_euc_E789[] = {
+ 0x602E, 0, 0, 0, 0, 0, 0x602F, 0x4A52,
+ 0x4847, 0, 0, 0x6030, 0x4757, 0, 0, 0,
+ 0, 0, 0x442D, 0, 0, 0, 0, 0,
+ 0x6031, 0x3267, 0, 0x356D, 0, 0x4C46, 0, 0x4C36,
+ 0, 0x3234, 0x4F34, 0, 0, 0, 0, 0x4B52,
+ 0, 0x4A2A, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4037, 0, 0x6032, 0, 0, 0,
+ 0, 0x4643, 0, 0, 0, 0x3823, 0x6033, 0,
+};
+unsigned short utf8_to_euc_E78A[] = {
+ 0x3A54, 0x6035, 0x6034, 0, 0, 0, 0, 0x6036,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x6037, 0, 0, 0, 0x6038, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0x353E, 0, 0x6039, 0, 0, 0, 0, 0x603A,
- 0xCA6C, 0, 0, 0, 0x3824, 0xCA6D, 0xCA6E, 0x4848,
- 0, 0xCA6F, 0x603C, 0, 0xCA70, 0, 0x3E75, 0,
- 0, 0x603B, 0, 0, 0, 0, 0xCA71, 0,
-};
-const unsigned short utf8_to_euc_E78B[] = {
- 0, 0xCA72, 0x3638, 0x603D, 0x603F, 0, 0x603E, 0xCA73,
- 0, 0xCA74, 0, 0, 0xCA75, 0, 0x6040, 0,
- 0x3851, 0, 0x6041, 0, 0, 0xCA76, 0xCA77, 0x3669,
- 0xCA78, 0x4140, 0, 0x397D, 0, 0, 0, 0xCA79,
- 0x6043, 0x6044, 0x6042, 0, 0, 0xCA7A, 0, 0,
+ 0, 0, 0, 0, 0x3824, 0, 0, 0x4848,
+ 0, 0x7A7E, 0x603C, 0, 0, 0, 0x3E75, 0,
+ 0, 0x603B, 0, 0, 0, 0, 0x7B21, 0,
+};
+unsigned short utf8_to_euc_E78B[] = {
+ 0, 0, 0x3638, 0x603D, 0x603F, 0, 0x603E, 0,
+ 0, 0, 0, 0, 0, 0, 0x6040, 0,
+ 0x3851, 0, 0x6041, 0, 0, 0, 0, 0x3669,
+ 0, 0x4140, 0, 0x397D, 0, 0, 0, 0,
+ 0x6043, 0x6044, 0x6042, 0, 0, 0, 0, 0,
0, 0x3C6D, 0, 0, 0x4648, 0x3639, 0, 0,
- 0, 0, 0, 0xCA7B, 0xCA7C, 0, 0, 0x6046,
- 0x432C, 0x6045, 0xCA7D, 0xCA7E, 0x4F35, 0x4762, 0xCB21, 0,
-};
-const unsigned short utf8_to_euc_E78C[] = {
- 0, 0, 0xCB22, 0, 0xCB23, 0xCB24, 0, 0xCB25,
- 0, 0, 0x6049, 0xCB26, 0, 0xCB27, 0, 0,
- 0, 0, 0xCB28, 0xCB29, 0, 0, 0x604B, 0x6048,
- 0xCB2A, 0xCB2B, 0, 0x4C54, 0x604A, 0x604C, 0xCB2C, 0x4E44,
- 0, 0, 0xCB2D, 0, 0xCB2E, 0x6050, 0, 0xCB2F,
- 0xCB30, 0x604F, 0x4376, 0x472D, 0xCB31, 0, 0x3825, 0x604E,
- 0, 0xCB32, 0xCB33, 0, 0x604D, 0xCB34, 0x4D31, 0x4D32,
- 0, 0, 0xCB35, 0xCB36, 0, 0xCB37, 0x6051, 0x316E,
-};
-const unsigned short utf8_to_euc_E78D[] = {
- 0, 0, 0, 0xCB38, 0x3976, 0x3B62, 0, 0,
- 0, 0, 0, 0, 0, 0xCB39, 0x6052, 0x6053,
- 0xCB3A, 0, 0xCB3B, 0, 0, 0, 0xCB3C, 0x6055,
- 0xCB3D, 0, 0, 0, 0, 0xCB3E, 0xCB3F, 0xCB40,
- 0xCB41, 0, 0, 0x3D43, 0, 0, 0xCB42, 0xCB43,
- 0x6057, 0xCB44, 0x6056, 0xCB45, 0xCB46, 0, 0xCB47, 0xCB48,
- 0x6058, 0xCB49, 0x334D, 0, 0, 0x605A, 0, 0xCB4A,
- 0x6059, 0xCB4B, 0x605C, 0x605B, 0xCB4C, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E78E[] = {
- 0xCB4D, 0xCB4E, 0, 0xCB4F, 0x383C, 0xCB50, 0xCB51, 0x4E28,
- 0, 0x364C, 0, 0x3226, 0, 0, 0xCB52, 0,
- 0xCB53, 0, 0, 0xCB54, 0, 0xCB55, 0x366A, 0xCB56,
- 0xCB57, 0, 0, 0, 0xCB58, 0, 0xCB59, 0xCB5A,
- 0xCB5B, 0, 0xCB5C, 0, 0, 0xCB5D, 0xCB5E, 0,
- 0, 0x3461, 0xCB5F, 0xCB60, 0, 0xCB61, 0, 0,
- 0, 0, 0x4E68, 0x605E, 0, 0xCB62, 0, 0xCB63,
- 0, 0xCB64, 0, 0x6060, 0xCB65, 0xCB66, 0, 0xCB67,
-};
-const unsigned short utf8_to_euc_E78F[] = {
- 0x6061, 0, 0x3251, 0, 0, 0xCB68, 0xCB69, 0,
- 0x605D, 0xCB6A, 0x3B39, 0xCB6B, 0xCB6C, 0x4441, 0x605F, 0xCB6D,
- 0, 0, 0xCB6E, 0xCB6F, 0, 0, 0xCB70, 0,
- 0, 0xCB71, 0, 0, 0, 0xCB72, 0x6064, 0,
- 0x3C6E, 0xCB73, 0, 0xCB74, 0, 0x6062, 0xCB75, 0xCB76,
- 0, 0xCB77, 0x373E, 0, 0, 0x4849, 0x6063, 0,
- 0, 0x607E, 0, 0, 0xCB78, 0xCB79, 0, 0xCB7A,
- 0x6069, 0xCB7B, 0xCB7C, 0xCB7D, 0, 0xCB7E, 0x383D, 0xCC21,
-};
-const unsigned short utf8_to_euc_E790[] = {
- 0xCC22, 0xCC23, 0, 0x3565, 0xCC24, 0x6066, 0x4D7D, 0xCC25,
- 0, 0x4E30, 0xCC26, 0, 0, 0, 0, 0,
- 0, 0xCC27, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xCC28, 0xCC29, 0, 0, 0, 0,
- 0, 0, 0x4276, 0, 0xCC2A, 0x6068, 0xCC2B, 0,
- 0xCC2C, 0xCC2D, 0xCC2E, 0xCC2F, 0xCC30, 0xCC31, 0xCC32, 0xCC33,
- 0xCC34, 0xCC35, 0x606A, 0x4E56, 0x3657, 0x487C, 0x474A, 0,
- 0, 0xCC36, 0x606B, 0, 0, 0, 0, 0x606D,
-};
-const unsigned short utf8_to_euc_E791[] = {
- 0xCC37, 0x6070, 0, 0xCC38, 0xCC39, 0, 0xCC3A, 0xCC3B,
- 0, 0, 0, 0xCC3C, 0, 0xCC3D, 0, 0,
- 0, 0xCC3E, 0xCC3F, 0, 0, 0x606C, 0, 0xCC40,
- 0, 0x606F, 0x386A, 0x314D, 0x6071, 0xCC41, 0x3F70, 0x606E,
- 0x4E5C, 0, 0xCC42, 0x6074, 0x7424, 0, 0xCC43, 0xCC44,
- 0xCC45, 0x6072, 0x6075, 0xCC46, 0, 0xCC47, 0xCC48, 0x6067,
- 0x6073, 0xCC49, 0xCC4A, 0x3A3C, 0, 0, 0x6076, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6046,
+ 0x432C, 0x6045, 0, 0, 0x4F35, 0x4762, 0, 0,
+};
+unsigned short utf8_to_euc_E78C[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x6049, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x604B, 0x6048,
+ 0, 0, 0, 0x4C54, 0x604A, 0x604C, 0, 0x4E44,
+ 0, 0, 0, 0, 0x7B22, 0x6050, 0, 0,
+ 0, 0x604F, 0x4376, 0x472D, 0, 0, 0x3825, 0x604E,
+ 0, 0, 0, 0, 0x604D, 0, 0x4D31, 0x4D32,
+ 0, 0, 0, 0, 0, 0, 0x6051, 0x316E,
+};
+unsigned short utf8_to_euc_E78D[] = {
+ 0, 0, 0, 0, 0x3976, 0x3B62, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6052, 0x6053,
+ 0, 0, 0, 0, 0, 0, 0, 0x6055,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3D43, 0, 0, 0, 0,
+ 0x6057, 0, 0x6056, 0, 0, 0, 0, 0,
+ 0x6058, 0, 0x334D, 0, 0, 0x605A, 0, 0x7B24,
+ 0x6059, 0, 0x605C, 0x605B, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E78E[] = {
+ 0, 0, 0, 0, 0x383C, 0, 0, 0x4E28,
+ 0, 0x364C, 0, 0x3226, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x366A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x3461, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4E68, 0x605E, 0, 0, 0, 0,
+ 0, 0, 0, 0x6060, 0, 0x7B25, 0, 0,
+};
+unsigned short utf8_to_euc_E78F[] = {
+ 0x6061, 0, 0x3251, 0, 0, 0, 0, 0,
+ 0x605D, 0x7B26, 0x3B39, 0, 0, 0x4441, 0x605F, 0,
+ 0, 0, 0x7B29, 0, 0, 0, 0x7B27, 0,
+ 0, 0, 0, 0, 0, 0, 0x6064, 0,
+ 0x3C6E, 0, 0, 0x7B28, 0, 0x6062, 0, 0,
+ 0, 0, 0x373E, 0, 0, 0x4849, 0x6063, 0,
+ 0, 0x607E, 0, 0, 0, 0x7B2B, 0, 0,
+ 0x6069, 0, 0, 0, 0, 0, 0x383D, 0,
+};
+unsigned short utf8_to_euc_E790[] = {
+ 0, 0, 0, 0x3565, 0, 0x6066, 0x4D7D, 0x7B2A,
+ 0, 0x4E30, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4276, 0, 0, 0x6068, 0x7B2C, 0,
+ 0, 0x7B2E, 0x7B2D, 0, 0, 0, 0x7B2F, 0,
+ 0, 0, 0x606A, 0x4E56, 0x3657, 0x487C, 0x474A, 0,
+ 0, 0, 0x606B, 0, 0, 0, 0, 0x606D,
+};
+unsigned short utf8_to_euc_E791[] = {
+ 0, 0x6070, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x606C, 0, 0,
+ 0, 0x606F, 0x386A, 0x314D, 0x6071, 0, 0x3F70, 0x606E,
+ 0x4E5C, 0, 0x7B30, 0x6074, 0x7424, 0, 0, 0,
+ 0, 0x6072, 0x6075, 0, 0, 0, 0, 0x6067,
+ 0x6073, 0, 0, 0x3A3C, 0, 0, 0x6076, 0,
0, 0, 0, 0, 0, 0, 0x6077, 0,
};
-const unsigned short utf8_to_euc_E792[] = {
- 0xCC4B, 0xCC4C, 0, 0x4D7E, 0, 0xCC4D, 0xCC4E, 0xCC4F,
- 0, 0xCC50, 0, 0x6078, 0, 0, 0, 0xCC51,
- 0xCC52, 0xCC53, 0xCC54, 0, 0, 0, 0, 0,
- 0xCC55, 0xCC56, 0xCC57, 0, 0xCC58, 0, 0x6079, 0xCC59,
- 0xCC5A, 0xCC5B, 0x6065, 0xCC5C, 0, 0, 0xCC5D, 0x607A,
- 0xCC5E, 0xCC5F, 0xCC60, 0xCC61, 0, 0, 0xCC62, 0xCC63,
- 0x3444, 0xCC64, 0xCC65, 0, 0, 0xCC66, 0, 0,
- 0, 0xCC67, 0, 0xCC68, 0, 0x3C25, 0, 0xCC69,
-};
-const unsigned short utf8_to_euc_E793[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xCC6A, 0xCC6B, 0x607B, 0, 0xCC6C, 0, 0, 0x607C,
- 0xCC6D, 0, 0, 0xCC6E, 0x607D, 0, 0, 0,
- 0xCC6F, 0, 0xCC70, 0xCC71, 0x313B, 0, 0xCC72, 0xCC73,
- 0x6121, 0, 0x493B, 0x6122, 0xCC74, 0, 0x3424, 0x6123,
- 0xCC75, 0x6124, 0xCC76, 0xCC77, 0, 0, 0x6125, 0xCC78,
- 0x6127, 0x6128, 0x6126, 0, 0xCC79, 0, 0x4953, 0x612A,
- 0x6129, 0, 0xCC7A, 0xCC7B, 0xCC7C, 0, 0, 0xCC7D,
-};
-const unsigned short utf8_to_euc_E794[] = {
- 0, 0xF450, 0, 0x612C, 0x612B, 0x612D, 0xCC7E, 0,
+unsigned short utf8_to_euc_E792[] = {
+ 0, 0, 0, 0x4D7E, 0, 0, 0, 0,
+ 0, 0x7B31, 0, 0x6078, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6079, 0x7B32,
+ 0, 0, 0x6065, 0, 0, 0, 0, 0x607A,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x3444, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x3C25, 0, 0,
+};
+unsigned short utf8_to_euc_E793[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x607B, 0, 0, 0, 0, 0x607C,
+ 0, 0, 0, 0, 0x607D, 0, 0, 0,
+ 0, 0, 0, 0, 0x313B, 0, 0, 0,
+ 0x6121, 0, 0x493B, 0x6122, 0, 0, 0x3424, 0x6123,
+ 0, 0x6124, 0, 0, 0, 0, 0x6125, 0,
+ 0x6127, 0x6128, 0x6126, 0, 0, 0, 0x4953, 0x612A,
+ 0x6129, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E794[] = {
+ 0, 0x7B33, 0, 0x612C, 0x612B, 0x612D, 0, 0,
0, 0, 0, 0, 0x612E, 0x6130, 0x612F, 0,
- 0, 0x3979, 0xCD21, 0x6132, 0, 0x6131, 0xCD22, 0xCD23,
+ 0, 0x3979, 0, 0x6132, 0, 0x6131, 0, 0,
0x3445, 0, 0x3F53, 0, 0x453C, 0, 0x6133, 0x4038,
- 0xCD24, 0xCD25, 0, 0x3B3A, 0xCD26, 0x3179, 0x6134, 0xCD27,
- 0x4D51, 0xCD28, 0xCD29, 0x4A63, 0x6135, 0, 0, 0xCD2A,
- 0x4544, 0x4D33, 0x3943, 0x3F3D, 0, 0, 0xCD2B, 0x434B,
- 0x5234, 0xCD2C, 0x442E, 0x3268, 0x6136, 0xCD2D, 0xCD2E, 0xCD2F,
-};
-const unsigned short utf8_to_euc_E795[] = {
- 0xCD30, 0, 0, 0xCD31, 0x6137, 0, 0x613C, 0xCD32,
- 0xCD33, 0x613A, 0x6139, 0x5A42, 0x3326, 0x6138, 0xCD34, 0x305A,
- 0xCD35, 0x482A, 0xCD36, 0, 0x484A, 0, 0, 0xCD37,
- 0, 0x4E31, 0x613D, 0x613B, 0x435C, 0x4026, 0xCD38, 0xCD39,
- 0x482B, 0xCD3A, 0x492D, 0, 0x613F, 0x4E2C, 0x374D, 0x6140,
- 0, 0x613E, 0x4856, 0x6141, 0, 0x6142, 0, 0xCD3B,
- 0x305B, 0xCD3C, 0, 0x3E76, 0x6147, 0, 0x6144, 0x466D,
- 0x6143, 0xCD3D, 0xCD3E, 0xCD3F, 0xCD40, 0xCD41, 0xCD42, 0x3526,
-};
-const unsigned short utf8_to_euc_E796[] = {
- 0, 0xCD43, 0x614A, 0, 0, 0xCD44, 0x6145, 0x6146,
+ 0, 0, 0, 0x3B3A, 0, 0x3179, 0x6134, 0,
+ 0x4D51, 0, 0, 0x4A63, 0x6135, 0, 0, 0x796C,
+ 0x4544, 0x4D33, 0x3943, 0x3F3D, 0, 0, 0, 0x434B,
+ 0x5234, 0, 0x442E, 0x3268, 0x6136, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E795[] = {
+ 0, 0, 0, 0, 0x6137, 0, 0x613C, 0,
+ 0, 0x613A, 0x6139, 0x5A42, 0x3326, 0x6138, 0, 0x305A,
+ 0, 0x482A, 0, 0, 0x484A, 0, 0, 0,
+ 0, 0x4E31, 0x613D, 0x613B, 0x435C, 0x4026, 0, 0,
+ 0x482B, 0, 0x492D, 0, 0x613F, 0x4E2C, 0x374D, 0x6140,
+ 0, 0x613E, 0x4856, 0x6141, 0, 0x6142, 0, 0x7B34,
+ 0x305B, 0, 0, 0x3E76, 0x6147, 0, 0x6144, 0x466D,
+ 0x6143, 0, 0, 0, 0, 0, 0, 0x3526,
+};
+unsigned short utf8_to_euc_E796[] = {
+ 0, 0, 0x614A, 0, 0, 0, 0x6145, 0x6146,
0, 0x6149, 0x6148, 0x4925, 0, 0, 0x4142, 0x4141,
- 0xCD45, 0x353F, 0xCD46, 0xCD47, 0x614B, 0xCD48, 0, 0,
- 0, 0xCD49, 0x614C, 0, 0xCD4A, 0x614D, 0, 0,
- 0, 0, 0xCD4B, 0x614F, 0xCD4C, 0x614E, 0, 0,
+ 0, 0x353F, 0, 0, 0x614B, 0, 0, 0,
+ 0, 0, 0x614C, 0, 0, 0x614D, 0, 0,
+ 0, 0, 0, 0x614F, 0, 0x614E, 0, 0,
0, 0, 0, 0x3156, 0, 0, 0, 0,
- 0, 0x6157, 0x4868, 0x6151, 0xCD4D, 0x6153, 0, 0,
- 0x6155, 0x3F3E, 0xCD4E, 0, 0x6156, 0x6154, 0x3C40, 0xCD4F,
-};
-const unsigned short utf8_to_euc_E797[] = {
- 0xCD50, 0xCD51, 0x6150, 0x6152, 0xCD52, 0x4942, 0xCD53, 0x3E49,
- 0, 0, 0x6159, 0, 0xCD54, 0x6158, 0xCD55, 0xCD56,
- 0, 0, 0x615A, 0, 0x3C26, 0x3A2F, 0, 0xCD57,
- 0x4577, 0x615B, 0, 0x444B, 0xCD58, 0, 0x615D, 0xCD59,
- 0xCD5A, 0xCD5B, 0x4E21, 0x615C, 0xCD5C, 0, 0, 0xCD5D,
- 0, 0x4169, 0, 0, 0xCD5E, 0, 0xCD5F, 0xCD60,
- 0x6162, 0xCD61, 0x6164, 0x6165, 0x4354, 0, 0, 0,
- 0, 0xCD62, 0x6163, 0, 0x6160, 0, 0x615E, 0x615F,
-};
-const unsigned short utf8_to_euc_E798[] = {
- 0xCD63, 0x6161, 0xCD64, 0xCD65, 0xCD66, 0, 0, 0xCD67,
- 0xCD68, 0x6168, 0xCD69, 0x6166, 0xCD6A, 0x6167, 0, 0xCD6B,
- 0, 0, 0xCD6C, 0xCD6D, 0, 0xCD6E, 0xCD6F, 0,
- 0, 0xCD70, 0, 0xCD71, 0xCD72, 0xCD73, 0xCD74, 0x6169,
- 0x616B, 0x616C, 0x616D, 0xCD75, 0x616E, 0xCD76, 0xCD77, 0x616A,
- 0, 0xCD78, 0, 0, 0, 0xCD79, 0, 0,
- 0x6170, 0, 0xCD7A, 0xCD7B, 0x616F, 0xCD7C, 0, 0,
- 0xCD7D, 0xCD7E, 0xCE21, 0x6171, 0xCE22, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E799[] = {
- 0xCE24, 0xCE25, 0x4E45, 0xCE26, 0xCE27, 0xCE28, 0x6174, 0x6172,
- 0x6173, 0xCE29, 0xCE23, 0xCE2A, 0x3462, 0, 0, 0,
- 0, 0, 0x4C7E, 0, 0, 0xCE2B, 0x4A4A, 0,
- 0x6176, 0xCE2C, 0, 0, 0x6175, 0, 0, 0xCE2D,
- 0, 0x6177, 0x6178, 0, 0xCE2E, 0xCE2F, 0, 0x617C,
- 0x6179, 0x617A, 0x617B, 0, 0x617D, 0xCE30, 0xCE31, 0xCE32,
- 0x617E, 0xCE33, 0x6221, 0, 0xCE34, 0, 0x6222, 0,
+ 0, 0x6157, 0x4868, 0x6151, 0, 0x6153, 0, 0,
+ 0x6155, 0x3F3E, 0, 0, 0x6156, 0x6154, 0x3C40, 0,
+};
+unsigned short utf8_to_euc_E797[] = {
+ 0, 0, 0x6150, 0x6152, 0, 0x4942, 0, 0x3E49,
+ 0, 0, 0x6159, 0, 0, 0x6158, 0, 0,
+ 0, 0, 0x615A, 0, 0x3C26, 0x3A2F, 0, 0,
+ 0x4577, 0x615B, 0, 0x444B, 0, 0, 0x615D, 0,
+ 0, 0, 0x4E21, 0x615C, 0, 0, 0, 0,
+ 0, 0x4169, 0, 0, 0, 0, 0, 0,
+ 0x6162, 0, 0x6164, 0x6165, 0x4354, 0, 0, 0,
+ 0, 0, 0x6163, 0, 0x6160, 0, 0x615E, 0x615F,
+};
+unsigned short utf8_to_euc_E798[] = {
+ 0, 0x6161, 0, 0, 0, 0, 0, 0,
+ 0, 0x6168, 0, 0x6166, 0, 0x6167, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6169,
+ 0x616B, 0x616C, 0x616D, 0, 0x616E, 0, 0, 0x616A,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6170, 0, 0, 0, 0x616F, 0, 0, 0,
+ 0, 0, 0, 0x6171, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E799[] = {
+ 0, 0, 0x4E45, 0, 0, 0, 0x6174, 0x6172,
+ 0x6173, 0, 0, 0, 0x3462, 0, 0, 0,
+ 0, 0, 0x4C7E, 0, 0, 0, 0x4A4A, 0,
+ 0x6176, 0, 0, 0, 0x6175, 0, 0, 0,
+ 0, 0x6177, 0x6178, 0, 0, 0, 0, 0x617C,
+ 0x6179, 0x617A, 0x617B, 0, 0x617D, 0, 0, 0,
+ 0x617E, 0, 0x6221, 0, 0, 0, 0x6222, 0,
0x6223, 0, 0x482F, 0x4550, 0x6224, 0x4772, 0x4934, 0,
};
-const unsigned short utf8_to_euc_E79A[] = {
- 0x6225, 0xCE35, 0xF451, 0x6226, 0x452A, 0xCE36, 0x3327, 0x3944,
- 0x6227, 0, 0, 0x6228, 0xCE37, 0xCE38, 0x6229, 0,
- 0x3B29, 0, 0, 0x622B, 0, 0xCE39, 0x622A, 0,
- 0, 0x622C, 0x622D, 0xCE3A, 0xCE3B, 0xCE3C, 0xF452, 0xCE3D,
- 0xCE3E, 0, 0xCE3F, 0xCE40, 0xCE41, 0xCE42, 0xCE43, 0xCE44,
- 0xCE45, 0, 0xCE46, 0, 0, 0xCE47, 0x4869, 0,
+unsigned short utf8_to_euc_E79A[] = {
+ 0x6225, 0, 0x7B35, 0x6226, 0x452A, 0, 0x3327, 0x3944,
+ 0x6227, 0, 0, 0x6228, 0, 0, 0x6229, 0,
+ 0x3B29, 0, 0, 0x622B, 0, 0, 0x622A, 0,
+ 0, 0x622C, 0x622D, 0x7B38, 0x7B36, 0, 0x7B37, 0,
+ 0, 0, 0, 0, 0, 0, 0x7B39, 0,
+ 0, 0, 0, 0, 0, 0, 0x4869, 0,
0x622E, 0, 0, 0, 0x622F, 0, 0, 0x7369,
- 0x6230, 0x6231, 0x6232, 0, 0, 0xCE48, 0, 0x3B2E,
-};
-const unsigned short utf8_to_euc_E79B[] = {
- 0, 0xCE49, 0x6233, 0x4756, 0, 0xCE4A, 0x4B5F, 0,
- 0x314E, 0xCE4B, 0x3157, 0xCE4C, 0xCE4D, 0x6234, 0xCE4E, 0,
- 0, 0, 0x6236, 0, 0xCE4F, 0, 0x6235, 0x4570,
- 0, 0xCE50, 0, 0x4039, 0x5D39, 0, 0x6237, 0x4C41,
- 0xCE51, 0x6238, 0, 0x3446, 0x4857, 0x6239, 0xCE52, 0x623A,
- 0xCE53, 0, 0x623B, 0, 0xCE54, 0, 0x4C5C, 0,
- 0xCE55, 0xCE56, 0x4C55, 0, 0x443E, 0, 0xCE57, 0,
- 0x416A, 0xCE58, 0, 0x623D, 0xCE59, 0, 0x3D62, 0,
-};
-const unsigned short utf8_to_euc_E79C[] = {
- 0xCE5A, 0x3E4A, 0, 0, 0x6240, 0, 0xCE5B, 0x623F,
- 0x623E, 0x487D, 0xCE5C, 0x3447, 0x3829, 0, 0xCE5D, 0,
- 0, 0, 0xCE5E, 0, 0xCE5F, 0xCE60, 0, 0xCE61,
- 0, 0xCE62, 0xCE63, 0x6246, 0xCE64, 0, 0x6243, 0x3F3F,
- 0x4C32, 0, 0xCE65, 0, 0x6242, 0x6244, 0x6245, 0,
- 0xCE66, 0x6241, 0, 0, 0, 0xCE67, 0xCE68, 0xCE69,
- 0, 0, 0, 0, 0xCE6A, 0xCE6B, 0xCE6C, 0x6247,
- 0x6248, 0xCE6D, 0x442F, 0, 0x3463, 0xCE6E, 0xCE6F, 0,
-};
-const unsigned short utf8_to_euc_E79D[] = {
- 0x4365, 0, 0xCE70, 0, 0, 0xCE71, 0xCE72, 0x6249,
- 0, 0, 0xCE73, 0, 0, 0xCE74, 0xCE75, 0xCE76,
- 0, 0, 0xCE77, 0, 0, 0, 0xCE78, 0xCE79,
- 0, 0, 0x624A, 0x624D, 0xCE7A, 0, 0xCE7B, 0xCE7C,
- 0xCE7D, 0x3F67, 0xCE7E, 0x4644, 0xCF21, 0x624E, 0x4B53, 0xCF22,
- 0x624B, 0, 0xCF23, 0x624C, 0xCF24, 0, 0, 0,
- 0xCF25, 0, 0xCF26, 0xCF27, 0xCF28, 0, 0, 0,
- 0, 0x6251, 0xCF29, 0, 0, 0xCF2A, 0x6250, 0x624F,
-};
-const unsigned short utf8_to_euc_E79E[] = {
- 0xCF2B, 0, 0, 0, 0xCF2C, 0, 0, 0,
- 0, 0, 0, 0x6253, 0xCF2D, 0xCF2E, 0x6252, 0,
- 0, 0x6254, 0, 0, 0xCF2F, 0xCF30, 0xCF31, 0,
- 0, 0, 0xCF32, 0, 0, 0, 0x6256, 0xCF33,
- 0x6255, 0, 0xCF34, 0, 0, 0x4A4D, 0, 0xCF35,
- 0, 0, 0xCF36, 0, 0x3D56, 0x4E46, 0xCF37, 0xCF38,
- 0x6257, 0xCF39, 0, 0x4637, 0, 0xCF3A, 0x6258, 0,
- 0, 0x6259, 0, 0x625D, 0x625B, 0x625C, 0xCF3B, 0x625A,
-};
-const unsigned short utf8_to_euc_E79F[] = {
- 0, 0, 0, 0xCF3C, 0, 0, 0, 0x625E,
- 0, 0xCF3D, 0, 0, 0, 0x625F, 0, 0,
- 0, 0xCF3E, 0xCF3F, 0, 0, 0xCF40, 0, 0x6260,
- 0, 0xCF41, 0x6261, 0x4C37, 0x6262, 0, 0xCF42, 0xCF43,
- 0xCF44, 0, 0x4C70, 0x6263, 0xCF45, 0x434E, 0xCF46, 0x476A,
- 0, 0x366B, 0xCF47, 0, 0xCF48, 0x433B, 0x6264, 0x363A,
- 0xCF49, 0xCF4A, 0, 0x4050, 0xCF4B, 0, 0, 0,
- 0xCF4C, 0, 0, 0xCF4D, 0x6265, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E7A0[] = {
- 0, 0, 0x3A3D, 0, 0, 0xCF4E, 0xCF4F, 0,
- 0, 0xCF50, 0, 0, 0x6266, 0xCF51, 0xCF52, 0,
- 0, 0xCF53, 0x6267, 0, 0x3826, 0x3A55, 0, 0,
- 0, 0, 0, 0, 0, 0xCF54, 0, 0,
- 0x6269, 0xCF55, 0xCF56, 0xCF57, 0, 0x4556, 0x3A56, 0x354E,
- 0, 0, 0, 0, 0, 0xCF58, 0xCF59, 0,
- 0xCF5A, 0, 0x4B24, 0, 0x474B, 0xCF5B, 0, 0xCF5C,
+ 0x6230, 0x6231, 0x6232, 0, 0, 0, 0, 0x3B2E,
+};
+unsigned short utf8_to_euc_E79B[] = {
+ 0, 0, 0x6233, 0x4756, 0, 0, 0x4B5F, 0,
+ 0x314E, 0, 0x3157, 0, 0, 0x6234, 0, 0,
+ 0, 0, 0x6236, 0, 0, 0, 0x6235, 0x4570,
+ 0, 0, 0, 0x4039, 0x5D39, 0, 0x6237, 0x4C41,
+ 0, 0x6238, 0, 0x3446, 0x4857, 0x6239, 0, 0x623A,
+ 0, 0, 0x623B, 0, 0, 0, 0x4C5C, 0,
+ 0, 0, 0x4C55, 0, 0x443E, 0, 0, 0,
+ 0x416A, 0, 0, 0x623D, 0, 0, 0x3D62, 0,
+};
+unsigned short utf8_to_euc_E79C[] = {
+ 0, 0x3E4A, 0, 0, 0x6240, 0, 0, 0x623F,
+ 0x623E, 0x487D, 0, 0x3447, 0x3829, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6246, 0, 0, 0x6243, 0x3F3F,
+ 0x4C32, 0, 0, 0, 0x6242, 0x6244, 0x6245, 0,
+ 0, 0x6241, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6247,
+ 0x6248, 0, 0x442F, 0, 0x3463, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E79D[] = {
+ 0x4365, 0, 0, 0, 0, 0, 0x7B3B, 0x6249,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x624A, 0x624D, 0, 0, 0, 0,
+ 0, 0x3F67, 0, 0x4644, 0, 0x624E, 0x4B53, 0,
+ 0x624B, 0, 0, 0x624C, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6251, 0, 0, 0, 0, 0x6250, 0x624F,
+};
+unsigned short utf8_to_euc_E79E[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6253, 0, 0, 0x6252, 0,
+ 0, 0x6254, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6256, 0,
+ 0x6255, 0, 0, 0, 0, 0x4A4D, 0, 0,
+ 0, 0, 0, 0, 0x3D56, 0x4E46, 0, 0,
+ 0x6257, 0, 0, 0x4637, 0, 0, 0x6258, 0,
+ 0, 0x6259, 0, 0x625D, 0x625B, 0x625C, 0, 0x625A,
+};
+unsigned short utf8_to_euc_E79F[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x625E,
+ 0, 0, 0, 0, 0, 0x625F, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6260,
+ 0, 0, 0x6261, 0x4C37, 0x6262, 0, 0, 0,
+ 0, 0, 0x4C70, 0x6263, 0, 0x434E, 0, 0x476A,
+ 0, 0x366B, 0, 0, 0, 0x433B, 0x6264, 0x363A,
+ 0, 0, 0, 0x4050, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x6265, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7A0[] = {
+ 0, 0, 0x3A3D, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x6266, 0, 0, 0,
+ 0, 0, 0x6267, 0, 0x3826, 0x3A55, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6269, 0x7B3D, 0, 0, 0, 0x4556, 0x3A56, 0x354E,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4B24, 0, 0x474B, 0, 0, 0,
0, 0, 0x4557, 0, 0, 0, 0, 0x395C,
};
-const unsigned short utf8_to_euc_E7A1[] = {
- 0, 0, 0, 0xCF5D, 0xCF5E, 0x626B, 0, 0xCF5F,
- 0xCF60, 0, 0, 0, 0xCF61, 0, 0xCF62, 0,
- 0, 0, 0xCF63, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xCF64, 0x3E4B, 0xCF65, 0,
- 0xCF66, 0xCF67, 0, 0xCF68, 0xCF69, 0, 0, 0,
- 0xCF6A, 0, 0xCF6B, 0x4E32, 0x3945, 0, 0xCF6C, 0x3827,
+unsigned short utf8_to_euc_E7A1[] = {
+ 0, 0, 0, 0, 0, 0x626B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x7B3E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x3E4B, 0, 0,
+ 0, 0, 0, 0, 0x7B3F, 0, 0, 0,
+ 0, 0, 0, 0x4E32, 0x3945, 0, 0, 0x3827,
0, 0, 0x4823, 0, 0x626D, 0, 0, 0,
- 0, 0, 0xCF6D, 0, 0x626F, 0, 0xCF6E, 0,
+ 0, 0, 0x7B40, 0, 0x626F, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E7A2[] = {
+unsigned short utf8_to_euc_E7A2[] = {
0, 0x386B, 0, 0, 0, 0, 0x626E, 0x4476,
- 0, 0, 0xCF6F, 0, 0x6271, 0x3337, 0x626C, 0xCF70,
- 0, 0x486A, 0, 0x3130, 0xCF71, 0x3A6C, 0, 0x4F52,
- 0xCF72, 0, 0x6270, 0, 0, 0xCF74, 0xCF75, 0xCF76,
- 0, 0xCF73, 0, 0x6272, 0xCF77, 0, 0, 0x4A4B,
- 0xCF78, 0x4059, 0x6274, 0, 0xCF79, 0xCF7A, 0, 0x6275,
- 0xCF7B, 0xCF7C, 0xCF7D, 0xCF7E, 0, 0x6273, 0, 0,
- 0, 0, 0x334E, 0xD021, 0x627B, 0xD022, 0x627A, 0xD023,
-};
-const unsigned short utf8_to_euc_E7A3[] = {
- 0, 0x3C27, 0, 0, 0, 0x627C, 0x6277, 0xD024,
- 0xD025, 0xD026, 0x627D, 0x6278, 0xD027, 0, 0xD028, 0,
- 0x4858, 0x6276, 0xD029, 0xD02A, 0x6279, 0xD02B, 0xD02C, 0,
- 0, 0, 0x6322, 0xD02E, 0, 0, 0, 0xD02F,
- 0xD030, 0xD031, 0, 0, 0xD02D, 0, 0xD032, 0x6321,
- 0x4B61, 0, 0xD033, 0, 0x627E, 0, 0, 0x306B,
- 0, 0, 0xD034, 0xD035, 0x6324, 0, 0xD037, 0xD038,
- 0, 0, 0xD039, 0xD03A, 0, 0x6323, 0, 0xD03B,
-};
-const unsigned short utf8_to_euc_E7A4[] = {
- 0xD036, 0x3E4C, 0, 0, 0, 0, 0xD03C, 0x6325,
- 0, 0, 0, 0, 0xD03D, 0, 0x4143, 0,
- 0xD03E, 0x6327, 0x6326, 0, 0, 0, 0, 0,
- 0, 0x6328, 0xD03F, 0, 0xD040, 0, 0xD041, 0xD042,
- 0xD043, 0, 0, 0, 0, 0xD044, 0x6268, 0xD045,
- 0, 0xD046, 0x626A, 0x632A, 0x6329, 0xD047, 0, 0,
- 0xF454, 0xD048, 0, 0, 0xD049, 0xD04A, 0, 0,
- 0, 0, 0x3C28, 0xD04B, 0x4E69, 0xD04C, 0x3C52, 0xD04D,
-};
-const unsigned short utf8_to_euc_E7A5[] = {
- 0x632B, 0x3737, 0, 0, 0xD04E, 0xD04F, 0xD050, 0x3540,
- 0x3527, 0x3B63, 0xD051, 0xD052, 0, 0, 0, 0xD053,
- 0x4D34, 0xD054, 0, 0x6331, 0xD055, 0x6330, 0x4144, 0x632D,
- 0xD056, 0, 0x632F, 0xD057, 0xD058, 0x3D4B, 0x3F40, 0x632E,
- 0x632C, 0, 0x472A, 0, 0, 0x3E4D, 0, 0xD059,
- 0x493C, 0xD05A, 0, 0xD05B, 0, 0x3A57, 0, 0,
- 0, 0, 0xD05C, 0, 0, 0, 0, 0x4578,
- 0, 0xD05D, 0x6332, 0xD05E, 0xD05F, 0, 0xD060, 0x6333,
-};
-const unsigned short utf8_to_euc_E7A6[] = {
+ 0, 0, 0, 0, 0x6271, 0x3337, 0x626C, 0,
+ 0, 0x486A, 0, 0x3130, 0, 0x3A6C, 0, 0x4F52,
+ 0, 0, 0x6270, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6272, 0, 0, 0, 0x4A4B,
+ 0, 0x4059, 0x6274, 0, 0, 0, 0, 0x6275,
+ 0, 0, 0, 0, 0, 0x6273, 0, 0,
+ 0, 0, 0x334E, 0, 0x627B, 0, 0x627A, 0,
+};
+unsigned short utf8_to_euc_E7A3[] = {
+ 0, 0x3C27, 0, 0, 0, 0x627C, 0x6277, 0,
+ 0, 0, 0x627D, 0x6278, 0, 0, 0, 0,
+ 0x4858, 0x6276, 0, 0, 0x6279, 0, 0, 0,
+ 0, 0, 0x6322, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6321,
+ 0x4B61, 0, 0, 0, 0x627E, 0, 0, 0x306B,
+ 0, 0, 0, 0, 0x6324, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x6323, 0, 0,
+};
+unsigned short utf8_to_euc_E7A4[] = {
+ 0, 0x3E4C, 0, 0, 0, 0, 0, 0x6325,
+ 0, 0, 0, 0, 0, 0, 0x4143, 0,
+ 0, 0x6327, 0x6326, 0, 0, 0, 0, 0,
+ 0, 0x6328, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6268, 0,
+ 0, 0, 0x626A, 0x632A, 0x6329, 0, 0, 0,
+ 0x7B41, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3C28, 0, 0x4E69, 0, 0x3C52, 0,
+};
+unsigned short utf8_to_euc_E7A5[] = {
+ 0x632B, 0x3737, 0, 0, 0, 0, 0, 0x3540,
+ 0x3527, 0x3B63, 0, 0, 0, 0, 0, 0,
+ 0x4D34, 0, 0, 0x6331, 0, 0x6330, 0x4144, 0x632D,
+ 0, 0, 0x632F, 0, 0, 0x3D4B, 0x3F40, 0x632E,
+ 0x632C, 0, 0x472A, 0, 0, 0x3E4D, 0, 0,
+ 0x493C, 0, 0, 0, 0, 0x3A57, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4578,
+ 0, 0, 0x6332, 0, 0, 0, 0, 0x6333,
+};
+unsigned short utf8_to_euc_E7A6[] = {
0x6349, 0x3658, 0, 0, 0x4F3D, 0x4135, 0, 0,
- 0, 0, 0x6334, 0xD061, 0xD062, 0x3252, 0x4477, 0x4A21,
- 0, 0xD063, 0, 0xD064, 0xD065, 0xD066, 0xD067, 0,
- 0xD068, 0, 0, 0xD069, 0xD06A, 0x6335, 0, 0,
- 0, 0xD06B, 0, 0, 0, 0, 0x357A, 0x6336,
- 0xD06C, 0xD06D, 0x6338, 0xD06E, 0, 0, 0x6339, 0xD06F,
- 0x4729, 0xD070, 0, 0x633A, 0xD071, 0, 0, 0,
- 0xD072, 0x633B, 0x633C, 0xD073, 0, 0x3659, 0x3253, 0x4645,
-};
-const unsigned short utf8_to_euc_E7A7[] = {
- 0x3D28, 0x3B64, 0xD074, 0, 0xD075, 0, 0, 0xD076,
- 0xD077, 0x633D, 0xD078, 0x3D29, 0, 0, 0, 0xD079,
- 0, 0x324A, 0x4943, 0, 0xD07A, 0x633E, 0xD07B, 0,
- 0x486B, 0, 0xD07C, 0, 0, 0xD07D, 0xD07E, 0x4145,
- 0xD121, 0x6341, 0xD122, 0x6342, 0x4769, 0xD123, 0x3F41, 0x633F,
- 0, 0x4361, 0xD124, 0xD125, 0x6340, 0xD126, 0, 0,
- 0x3E4E, 0xD127, 0, 0, 0, 0, 0, 0,
- 0xD128, 0, 0, 0x305C, 0xD129, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E7A8[] = {
- 0x3529, 0, 0xD12A, 0xD12B, 0, 0, 0, 0xD12C,
- 0x6343, 0xD12D, 0xD12E, 0x4478, 0xD12F, 0x6344, 0x4047, 0,
- 0, 0xD130, 0, 0, 0x4C2D, 0xD131, 0, 0x4923,
- 0x6345, 0x6346, 0x4355, 0xD132, 0x4E47, 0, 0xD133, 0x6348,
- 0x6347, 0xD134, 0, 0, 0, 0, 0, 0xD135,
- 0, 0, 0, 0xD136, 0, 0xD137, 0x3C6F, 0xD138,
- 0xD139, 0x634A, 0x3070, 0, 0xD13A, 0xD13B, 0, 0x634D,
- 0xD13C, 0xD13D, 0xD13E, 0x634B, 0x3254, 0x374E, 0x634C, 0x3946,
-};
-const unsigned short utf8_to_euc_E7A9[] = {
- 0x3972, 0, 0x4A66, 0x634E, 0xD13F, 0xD140, 0x4B54, 0xD141,
- 0xD142, 0x6350, 0, 0, 0xD143, 0x4051, 0x314F, 0x323A,
- 0x302C, 0, 0, 0, 0, 0xD144, 0xD145, 0x634F,
- 0, 0xD146, 0, 0, 0xD147, 0xD148, 0, 0xD149,
- 0xD14A, 0x6351, 0x6352, 0x3E77, 0, 0xD14B, 0, 0xD14C,
- 0, 0x6353, 0xD14D, 0x334F, 0, 0xD14E, 0, 0,
- 0x6355, 0, 0, 0, 0x376A, 0xD14F, 0x3566, 0,
- 0xD150, 0x6356, 0x3675, 0, 0, 0x6357, 0xD151, 0x407C,
-};
-const unsigned short utf8_to_euc_E7AA[] = {
- 0xD152, 0x464D, 0xD153, 0x4060, 0x3A75, 0xD154, 0xD155, 0,
- 0x6358, 0, 0xD156, 0xD157, 0, 0, 0, 0,
- 0xD158, 0xD159, 0x4362, 0x416B, 0xD15A, 0x635A, 0x635C, 0x6359,
- 0x635B, 0, 0, 0, 0, 0, 0xD15B, 0x3722,
- 0xD15C, 0, 0, 0xD15D, 0, 0, 0, 0,
- 0, 0x635D, 0x3726, 0, 0xD15E, 0, 0x3567, 0x4D52,
- 0x635F, 0, 0, 0xD15F, 0, 0xD160, 0x6360, 0,
- 0, 0xD161, 0x312E, 0xD162, 0xD163, 0, 0, 0x6363,
-};
-const unsigned short utf8_to_euc_E7AB[] = {
- 0, 0, 0, 0x3376, 0x6362, 0x6361, 0xD164, 0x6365,
- 0x635E, 0xD165, 0x6366, 0x4E29, 0xD166, 0x6367, 0xD167, 0x6368,
- 0, 0xD168, 0x5474, 0x636A, 0, 0x6369, 0, 0,
- 0, 0x636B, 0x636C, 0xD169, 0x4E35, 0x636D, 0, 0x706F,
- 0x3E4F, 0x636E, 0x636F, 0x3D57, 0, 0x4638, 0x6370, 0xF459,
- 0xD16A, 0xD16B, 0x4328, 0xD16C, 0xD16D, 0x6371, 0, 0x433C,
- 0x6372, 0xD16E, 0, 0, 0xD16F, 0, 0x3625, 0,
- 0x513F, 0x435D, 0x3C33, 0xD170, 0, 0xD171, 0xD172, 0x3448,
-};
-const unsigned short utf8_to_euc_E7AC[] = {
- 0, 0, 0x6373, 0, 0x6422, 0, 0x6376, 0xD173,
+ 0, 0, 0x6334, 0, 0, 0x3252, 0x4477, 0x4A21,
+ 0, 0, 0, 0, 0x7B45, 0, 0, 0,
+ 0, 0, 0, 0x7B47, 0, 0x6335, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x357A, 0x6336,
+ 0, 0, 0x6338, 0, 0, 0, 0x6339, 0,
+ 0x4729, 0, 0, 0x633A, 0, 0, 0, 0,
+ 0, 0x633B, 0x633C, 0, 0, 0x3659, 0x3253, 0x4645,
+};
+unsigned short utf8_to_euc_E7A7[] = {
+ 0x3D28, 0x3B64, 0, 0, 0, 0, 0, 0,
+ 0, 0x633D, 0, 0x3D29, 0, 0, 0, 0,
+ 0, 0x324A, 0x4943, 0, 0, 0x633E, 0, 0,
+ 0x486B, 0, 0, 0, 0, 0, 0, 0x4145,
+ 0, 0x6341, 0, 0x6342, 0x4769, 0, 0x3F41, 0x633F,
+ 0, 0x4361, 0, 0, 0x6340, 0, 0, 0,
+ 0x3E4E, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x305C, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7A8[] = {
+ 0x3529, 0, 0, 0, 0, 0, 0, 0,
+ 0x6343, 0, 0, 0x4478, 0, 0x6344, 0x4047, 0,
+ 0, 0, 0, 0, 0x4C2D, 0, 0, 0x4923,
+ 0x6345, 0x6346, 0x4355, 0, 0x4E47, 0, 0, 0x6348,
+ 0x6347, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3C6F, 0,
+ 0, 0x634A, 0x3070, 0, 0, 0, 0, 0x634D,
+ 0, 0, 0, 0x634B, 0x3254, 0x374E, 0x634C, 0x3946,
+};
+unsigned short utf8_to_euc_E7A9[] = {
+ 0x3972, 0, 0x4A66, 0x634E, 0, 0, 0x4B54, 0,
+ 0, 0x6350, 0, 0, 0, 0x4051, 0x314F, 0x323A,
+ 0x302C, 0, 0, 0, 0, 0, 0, 0x634F,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6351, 0x6352, 0x3E77, 0, 0, 0, 0,
+ 0, 0x6353, 0, 0x334F, 0, 0, 0, 0,
+ 0x6355, 0, 0, 0, 0x376A, 0, 0x3566, 0,
+ 0, 0x6356, 0x3675, 0, 0, 0x6357, 0, 0x407C,
+};
+unsigned short utf8_to_euc_E7AA[] = {
+ 0, 0x464D, 0, 0x4060, 0x3A75, 0, 0, 0,
+ 0x6358, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4362, 0x416B, 0, 0x635A, 0x635C, 0x6359,
+ 0x635B, 0, 0, 0, 0, 0, 0, 0x3722,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x635D, 0x3726, 0, 0, 0, 0x3567, 0x4D52,
+ 0x635F, 0, 0, 0, 0, 0, 0x6360, 0,
+ 0, 0, 0x312E, 0, 0, 0, 0, 0x6363,
+};
+unsigned short utf8_to_euc_E7AB[] = {
+ 0, 0, 0, 0x3376, 0x6362, 0x6361, 0, 0x6365,
+ 0x635E, 0, 0x6366, 0x4E29, 0, 0x6367, 0, 0x6368,
+ 0, 0x7B48, 0x5474, 0x636A, 0, 0x6369, 0, 0,
+ 0, 0x636B, 0x636C, 0, 0x4E35, 0x636D, 0, 0x706F,
+ 0x3E4F, 0x636E, 0x636F, 0x3D57, 0, 0x4638, 0x6370, 0x7B49,
+ 0, 0, 0x4328, 0x7B4B, 0, 0x6371, 0, 0x433C,
+ 0x6372, 0, 0, 0, 0, 0, 0x3625, 0,
+ 0x513F, 0x435D, 0x3C33, 0, 0, 0, 0, 0x3448,
+};
+unsigned short utf8_to_euc_E7AC[] = {
+ 0, 0, 0x6373, 0, 0x6422, 0, 0x6376, 0,
0x3568, 0, 0x6375, 0x6424, 0, 0, 0, 0x6374,
- 0, 0x3E50, 0, 0, 0xD174, 0, 0, 0,
- 0x6378, 0x6379, 0, 0x452B, 0, 0, 0x637A, 0xD175,
- 0x335E, 0, 0, 0xD176, 0, 0x3F5A, 0x4964, 0xD177,
- 0x637C, 0xD178, 0xD179, 0xD17A, 0x4268, 0xD17B, 0xD17C, 0xD17D,
- 0xD17E, 0xD221, 0, 0x6377, 0xD222, 0x637B, 0x637D, 0,
- 0, 0x3A7B, 0, 0, 0, 0xD223, 0, 0xD224,
-};
-const unsigned short utf8_to_euc_E7AD[] = {
- 0xD225, 0xD226, 0, 0, 0, 0x6426, 0x492E, 0xD227,
- 0x4826, 0x4579, 0, 0x365A, 0x6425, 0x6423, 0xD228, 0x4835,
- 0x637E, 0x435E, 0x457B, 0, 0x457A, 0xD229, 0x3A76, 0,
+ 0, 0x3E50, 0, 0, 0, 0, 0, 0,
+ 0x6378, 0x6379, 0, 0x452B, 0, 0, 0x637A, 0,
+ 0x335E, 0, 0, 0, 0, 0x3F5A, 0x4964, 0,
+ 0x637C, 0, 0, 0, 0x4268, 0, 0, 0,
+ 0, 0, 0, 0x6377, 0, 0x637B, 0x637D, 0,
+ 0, 0x3A7B, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7AD[] = {
+ 0, 0, 0, 0, 0, 0x6426, 0x492E, 0,
+ 0x4826, 0x4579, 0, 0x365A, 0x6425, 0x6423, 0, 0x4835,
+ 0x637E, 0x435E, 0x457B, 0, 0x457A, 0, 0x3A76, 0,
0, 0, 0, 0, 0, 0x6438, 0, 0,
- 0xD22A, 0, 0, 0, 0xD22B, 0x6428, 0xD22C, 0x642A,
- 0, 0xD22D, 0xD22E, 0, 0x642D, 0xD22F, 0x642E, 0xD230,
- 0x642B, 0x642C, 0xD231, 0xD232, 0x6429, 0x6427, 0, 0xD233,
+ 0, 0, 0, 0, 0, 0x6428, 0, 0x642A,
+ 0, 0, 0, 0, 0x642D, 0, 0x642E, 0,
+ 0x642B, 0x642C, 0, 0, 0x6429, 0x6427, 0, 0,
0, 0, 0x6421, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E7AE[] = {
- 0, 0, 0, 0, 0xD234, 0, 0x4A4F, 0x3255,
- 0, 0xD235, 0, 0x6435, 0, 0x6432, 0xD236, 0x6437,
- 0xD237, 0xD238, 0x6436, 0, 0x4773, 0x4C27, 0xD239, 0x3B3B,
- 0x6430, 0x6439, 0x6434, 0xD23A, 0x6433, 0x642F, 0xD23B, 0x6431,
- 0xD23C, 0x3449, 0, 0, 0, 0xD23D, 0, 0,
- 0, 0, 0x433D, 0, 0xD23E, 0x407D, 0, 0xD23F,
- 0xD240, 0x4822, 0xD241, 0, 0x643E, 0xD242, 0xD243, 0,
- 0x4824, 0, 0xD244, 0xD245, 0xD246, 0xD247, 0, 0,
-};
-const unsigned short utf8_to_euc_E7AF[] = {
- 0x4061, 0x643B, 0xD248, 0, 0x484F, 0xD249, 0x643F, 0x4A53,
- 0xD24A, 0x435B, 0xD24B, 0x643A, 0x643C, 0, 0, 0x643D,
- 0, 0, 0, 0, 0xD24C, 0, 0xD24D, 0xD24E,
- 0, 0xD24F, 0xD250, 0xD251, 0, 0x6440, 0, 0,
+unsigned short utf8_to_euc_E7AE[] = {
+ 0, 0, 0, 0, 0, 0, 0x4A4F, 0x3255,
+ 0, 0, 0, 0x6435, 0, 0x6432, 0, 0x6437,
+ 0, 0, 0x6436, 0, 0x4773, 0x4C27, 0, 0x3B3B,
+ 0x6430, 0x6439, 0x6434, 0, 0x6433, 0x642F, 0x7B4C, 0x6431,
+ 0, 0x3449, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x433D, 0, 0, 0x407D, 0, 0,
+ 0, 0x4822, 0, 0, 0x643E, 0, 0, 0,
+ 0x4824, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7AF[] = {
+ 0x4061, 0x643B, 0, 0, 0x484F, 0, 0x643F, 0x4A53,
+ 0, 0x435B, 0, 0x643A, 0x643C, 0, 0, 0x643D,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x6440, 0, 0,
0x3C44, 0, 0, 0, 0x4646, 0x6445, 0x6444, 0,
- 0xD252, 0x6441, 0xD253, 0, 0, 0x4F36, 0, 0,
- 0, 0, 0xD254, 0x644A, 0xD255, 0xD256, 0x644E, 0x644B,
- 0xD257, 0xD258, 0xD259, 0, 0xD25A, 0, 0xD25B, 0,
+ 0, 0x6441, 0, 0, 0, 0x4F36, 0, 0,
+ 0, 0, 0, 0x644A, 0, 0, 0x644E, 0x644B,
+ 0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E7B0[] = {
- 0x6447, 0xD25C, 0xD25D, 0xD25E, 0xD25F, 0, 0xD260, 0x6448,
- 0, 0xD261, 0, 0xD262, 0xD263, 0x644D, 0xD264, 0xD265,
+unsigned short utf8_to_euc_E7B0[] = {
+ 0x6447, 0, 0, 0, 0, 0, 0, 0x6448,
+ 0, 0, 0, 0, 0, 0x644D, 0, 0,
0, 0x6442, 0x5255, 0x6449, 0x6443, 0, 0, 0x644C,
- 0, 0xD266, 0, 0xD267, 0, 0, 0, 0x6452,
- 0xD268, 0x344A, 0, 0x644F, 0, 0xD269, 0xD26A, 0x6450,
- 0xD26B, 0, 0x6451, 0x6454, 0xD26C, 0, 0, 0,
- 0, 0xD26D, 0, 0xD26E, 0xD26F, 0, 0xD270, 0x6453,
- 0x4876, 0xD271, 0xD272, 0, 0, 0x6455, 0x4E7C, 0x4A6D,
-};
-const unsigned short utf8_to_euc_E7B1[] = {
- 0x645A, 0, 0, 0x6457, 0, 0, 0xD273, 0,
- 0, 0, 0xD274, 0, 0x6456, 0x4052, 0, 0x6459,
- 0x645B, 0xD276, 0xD277, 0xD278, 0x6458, 0xD275, 0x645F, 0,
- 0x645C, 0xD279, 0xD27A, 0xD27B, 0xD27C, 0xD27D, 0xD27E, 0x645D,
- 0x6446, 0xD321, 0, 0xD322, 0x645E, 0x6460, 0, 0xD323,
- 0, 0xD324, 0, 0, 0x6461, 0xD325, 0xD326, 0,
- 0xD327, 0, 0xD328, 0x4A46, 0, 0x6462, 0, 0,
- 0, 0xD329, 0, 0, 0xD32A, 0xD32B, 0x4C62, 0,
-};
-const unsigned short utf8_to_euc_E7B2[] = {
- 0, 0x364E, 0x3729, 0x6463, 0, 0, 0xD32C, 0xD32D,
- 0, 0x4A34, 0, 0x3F68, 0, 0x4C30, 0, 0xD32E,
- 0x6464, 0, 0x4E33, 0, 0xD32F, 0x4774, 0, 0x4146,
- 0x4734, 0, 0, 0x3D4D, 0, 0, 0xD330, 0x3040,
- 0xD331, 0x6469, 0x6467, 0, 0x6465, 0x3421, 0xD332, 0x3E51,
+ 0, 0, 0, 0, 0, 0, 0, 0x6452,
+ 0, 0x344A, 0, 0x644F, 0, 0, 0, 0x6450,
+ 0, 0, 0x6451, 0x6454, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6453,
+ 0x4876, 0, 0, 0, 0, 0x6455, 0x4E7C, 0x4A6D,
+};
+unsigned short utf8_to_euc_E7B1[] = {
+ 0x645A, 0, 0, 0x6457, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x6456, 0x4052, 0, 0x6459,
+ 0x645B, 0, 0, 0, 0x6458, 0, 0x645F, 0,
+ 0x645C, 0, 0, 0, 0, 0, 0, 0x645D,
+ 0x6446, 0, 0, 0, 0x645E, 0x6460, 0, 0,
+ 0, 0, 0, 0, 0x6461, 0, 0, 0,
+ 0, 0, 0, 0x4A46, 0, 0x6462, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x4C62, 0,
+};
+unsigned short utf8_to_euc_E7B2[] = {
+ 0, 0x364E, 0x3729, 0x6463, 0, 0, 0, 0,
+ 0, 0x4A34, 0, 0x3F68, 0, 0x4C30, 0, 0,
+ 0x6464, 0, 0x4E33, 0, 0, 0x4774, 0, 0x4146,
+ 0x4734, 0, 0, 0x3D4D, 0, 0, 0, 0x3040,
+ 0, 0x6469, 0x6467, 0, 0x6465, 0x3421, 0, 0x3E51,
0x646A, 0, 0, 0x6468, 0, 0x6466, 0x646E, 0,
- 0xD333, 0x646D, 0x646C, 0x646B, 0, 0, 0xD334, 0xD335,
- 0, 0x646F, 0xD336, 0xD337, 0xD338, 0x6470, 0x403A, 0xD339,
-};
-const unsigned short utf8_to_euc_E7B3[] = {
- 0x6471, 0, 0x6473, 0, 0xD33A, 0x6472, 0, 0xD33B,
- 0xD33C, 0xD33D, 0x3852, 0, 0, 0xD33E, 0x4138, 0xD33F,
- 0, 0, 0x6475, 0xD340, 0xD341, 0xD342, 0x457C, 0xD343,
- 0x6474, 0xD344, 0xD345, 0, 0x6476, 0xD346, 0x4A35, 0x416C,
- 0x3947, 0, 0x6477, 0, 0, 0, 0xD347, 0x4E48,
- 0, 0xD348, 0, 0xD349, 0, 0, 0, 0x6479,
- 0, 0, 0x647A, 0, 0x647B, 0xD34A, 0x647C, 0,
+ 0, 0x646D, 0x646C, 0x646B, 0, 0, 0, 0,
+ 0, 0x646F, 0, 0, 0, 0x6470, 0x403A, 0,
+};
+unsigned short utf8_to_euc_E7B3[] = {
+ 0x6471, 0, 0x6473, 0, 0, 0x6472, 0, 0,
+ 0, 0, 0x3852, 0, 0, 0, 0x4138, 0,
+ 0, 0, 0x6475, 0, 0, 0, 0x457C, 0,
+ 0x6474, 0, 0, 0, 0x6476, 0, 0x4A35, 0x416C,
+ 0x3947, 0, 0x6477, 0, 0, 0, 0, 0x4E48,
+ 0, 0, 0, 0, 0, 0, 0, 0x6479,
+ 0, 0, 0x647A, 0, 0x647B, 0, 0x647C, 0,
0x3B65, 0, 0x647D, 0x374F, 0, 0, 0x356A, 0,
};
-const unsigned short utf8_to_euc_E7B4[] = {
- 0x352A, 0, 0x6521, 0xD34B, 0x4C73, 0x3948, 0x647E, 0xD34C,
- 0xD34D, 0xD34E, 0x6524, 0x4C66, 0, 0x473C, 0, 0xD34F,
- 0x4933, 0xD350, 0xD351, 0xD352, 0x3D63, 0x6523, 0xD353, 0x3C53,
- 0x3949, 0x3B66, 0x3569, 0x4A36, 0x6522, 0xD354, 0xD355, 0,
- 0x4147, 0x4B42, 0x3A77, 0xD356, 0, 0, 0xD357, 0,
- 0, 0, 0xD358, 0x3B67, 0x445D, 0xD359, 0x6527, 0x4E5F,
- 0x3A59, 0xD35A, 0x6528, 0x3F42, 0, 0x652A, 0, 0,
- 0, 0x3E52, 0x3A30, 0, 0xD35B, 0xD35C, 0xD35D, 0x6529,
-};
-const unsigned short utf8_to_euc_E7B5[] = {
- 0xD35E, 0xD35F, 0x3D2A, 0x383E, 0x4148, 0x6525, 0x652B, 0xD360,
- 0xD361, 0, 0, 0x6526, 0x3750, 0xD362, 0x652E, 0x6532,
- 0x376B, 0xD363, 0, 0xD364, 0, 0, 0x652D, 0xD365,
- 0, 0xD366, 0xD367, 0x6536, 0xD368, 0xD369, 0x394A, 0,
- 0, 0x4D6D, 0x303C, 0x6533, 0, 0xD36A, 0x356B, 0xD36B,
- 0x6530, 0, 0xD36C, 0, 0, 0, 0x6531, 0,
- 0xD36D, 0x457D, 0x652F, 0x652C, 0, 0x3328, 0x4064, 0,
- 0xD36E, 0x3828, 0xD36F, 0xD370, 0, 0x6538, 0, 0xD371,
-};
-const unsigned short utf8_to_euc_E7B6[] = {
- 0, 0xD372, 0xD373, 0xD374, 0, 0xD375, 0xD376, 0,
- 0xD377, 0x6535, 0, 0xD378, 0xD379, 0xD37A, 0, 0x6537,
- 0, 0xD37B, 0, 0x6534, 0, 0, 0xD37C, 0xD37D,
- 0, 0x3751, 0x4233, 0x6539, 0x416E, 0xD37E, 0xD421, 0x6546,
- 0xF45C, 0, 0x6542, 0x653C, 0, 0, 0xD422, 0xD423,
- 0, 0, 0xD424, 0x6540, 0x3C7A, 0x305D, 0x653B, 0x6543,
- 0x6547, 0x394B, 0x4C56, 0xD425, 0x4456, 0x653D, 0xD426, 0xD427,
- 0x6545, 0xD428, 0x653A, 0x433E, 0, 0x653F, 0x303D, 0x4C4A,
-};
-const unsigned short utf8_to_euc_E7B7[] = {
- 0, 0, 0xD429, 0xD42A, 0xD42B, 0xD42C, 0xD42D, 0x653E,
- 0, 0, 0x365B, 0x486C, 0xD42E, 0xD42F, 0xD430, 0x416D,
- 0, 0x4E50, 0x3D6F, 0, 0, 0x656E, 0xF45D, 0xD431,
- 0x6548, 0xD432, 0x407E, 0, 0x6544, 0x6549, 0x654B, 0,
- 0x4479, 0x654E, 0xD434, 0, 0x654A, 0xD435, 0xD436, 0,
- 0x4A54, 0x344B, 0xD437, 0xD438, 0x4C4B, 0xD439, 0, 0x305E,
- 0, 0xD43A, 0x654D, 0, 0x4E7D, 0xD43B, 0xD43C, 0,
- 0, 0xD43D, 0xD43E, 0x654C, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E7B8[] = {
- 0xD433, 0x316F, 0, 0, 0x466C, 0x654F, 0, 0,
- 0xD43F, 0x6556, 0x6550, 0x6557, 0, 0, 0, 0,
- 0xD440, 0xD441, 0x6553, 0, 0, 0xD442, 0, 0xD443,
- 0, 0, 0, 0x477B, 0xD444, 0xD445, 0x3C4A, 0x6555,
- 0xD446, 0x6552, 0x6558, 0x6551, 0, 0, 0x3D44, 0xD447,
- 0xD448, 0, 0, 0x4B25, 0xD449, 0xD44A, 0x3D4C, 0xD44B,
- 0, 0x6554, 0x6560, 0xD44C, 0, 0x655C, 0xD44D, 0x655F,
- 0, 0x655D, 0x6561, 0x655B, 0, 0x6541, 0x4053, 0xD44E,
-};
-const unsigned short utf8_to_euc_E7B9[] = {
- 0, 0x484B, 0, 0x655E, 0xD44F, 0xD450, 0x6559, 0xD451,
- 0, 0, 0x4121, 0x3752, 0, 0x3D2B, 0xD452, 0,
- 0xD453, 0, 0xD454, 0, 0x3F25, 0x4136, 0x6564, 0,
- 0xD455, 0x6566, 0x6567, 0, 0, 0x6563, 0x6565, 0xD456,
- 0, 0xD457, 0xD458, 0, 0, 0xD459, 0x655A, 0x6562,
- 0, 0x656A, 0x6569, 0xD45A, 0, 0x4B7A, 0xD45B, 0xD45C,
- 0x372B, 0, 0, 0xD45D, 0, 0, 0, 0,
- 0xD45E, 0x6568, 0, 0x656C, 0x656B, 0x656F, 0xD45F, 0x6571,
-};
-const unsigned short utf8_to_euc_E7BA[] = {
- 0, 0xD460, 0x3B3C, 0x656D, 0, 0, 0xD461, 0xD462,
- 0x6572, 0x6573, 0xD463, 0, 0x6574, 0xD464, 0x657A, 0x453B,
- 0x6576, 0xD465, 0x6575, 0x6577, 0x6578, 0xD466, 0x6579, 0,
- 0xD467, 0, 0xD468, 0x657B, 0x657C, 0xD469, 0xD46A, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E7BC[] = {
+unsigned short utf8_to_euc_E7B4[] = {
+ 0x352A, 0, 0x6521, 0, 0x4C73, 0x3948, 0x647E, 0,
+ 0, 0, 0x6524, 0x4C66, 0, 0x473C, 0, 0,
+ 0x4933, 0, 0, 0, 0x3D63, 0x6523, 0, 0x3C53,
+ 0x3949, 0x3B66, 0x3569, 0x4A36, 0x6522, 0, 0, 0,
+ 0x4147, 0x4B42, 0x3A77, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3B67, 0x445D, 0, 0x6527, 0x4E5F,
+ 0x3A59, 0, 0x6528, 0x3F42, 0, 0x652A, 0, 0,
+ 0, 0x3E52, 0x3A30, 0, 0, 0, 0, 0x6529,
+};
+unsigned short utf8_to_euc_E7B5[] = {
+ 0, 0, 0x3D2A, 0x383E, 0x4148, 0x6525, 0x652B, 0,
+ 0x7B4E, 0, 0, 0x6526, 0x3750, 0, 0x652E, 0x6532,
+ 0x376B, 0, 0, 0, 0, 0, 0x652D, 0,
+ 0, 0, 0, 0x6536, 0x7B4F, 0, 0x394A, 0,
+ 0, 0x4D6D, 0x303C, 0x6533, 0, 0, 0x356B, 0,
+ 0x6530, 0, 0, 0, 0, 0, 0x6531, 0,
+ 0, 0x457D, 0x652F, 0x652C, 0, 0x3328, 0x4064, 0,
+ 0, 0x3828, 0, 0, 0, 0x6538, 0, 0,
+};
+unsigned short utf8_to_euc_E7B6[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6535, 0, 0, 0, 0, 0, 0x6537,
+ 0, 0, 0, 0x6534, 0, 0, 0, 0,
+ 0, 0x3751, 0x4233, 0x6539, 0x416E, 0, 0, 0x6546,
+ 0x7B51, 0, 0x6542, 0x653C, 0, 0, 0, 0,
+ 0, 0, 0, 0x6540, 0x3C7A, 0x305D, 0x653B, 0x6543,
+ 0x6547, 0x394B, 0x4C56, 0, 0x4456, 0x653D, 0, 0x7B50,
+ 0x6545, 0, 0x653A, 0x433E, 0, 0x653F, 0x303D, 0x4C4A,
+};
+unsigned short utf8_to_euc_E7B7[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x653E,
+ 0, 0, 0x365B, 0x486C, 0, 0, 0, 0x416D,
+ 0, 0x4E50, 0x3D6F, 0, 0, 0x656E, 0x7B52, 0,
+ 0x6548, 0, 0x407E, 0, 0x6544, 0x6549, 0x654B, 0,
+ 0x4479, 0x654E, 0, 0, 0x654A, 0, 0, 0,
+ 0x4A54, 0x344B, 0, 0, 0x4C4B, 0, 0, 0x305E,
+ 0, 0, 0x654D, 0, 0x4E7D, 0, 0, 0,
+ 0, 0, 0, 0x654C, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7B8[] = {
+ 0, 0x316F, 0, 0, 0x466C, 0x654F, 0, 0,
+ 0, 0x6556, 0x6550, 0x6557, 0, 0, 0, 0,
+ 0, 0, 0x6553, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x477B, 0, 0, 0x3C4A, 0x6555,
+ 0, 0x6552, 0x6558, 0x6551, 0, 0, 0x3D44, 0,
+ 0, 0, 0, 0x4B25, 0, 0, 0x3D4C, 0,
+ 0, 0x6554, 0x6560, 0, 0, 0x655C, 0, 0x655F,
+ 0, 0x655D, 0x6561, 0x655B, 0, 0x6541, 0x4053, 0,
+};
+unsigned short utf8_to_euc_E7B9[] = {
+ 0, 0x484B, 0, 0x655E, 0, 0, 0x6559, 0,
+ 0, 0, 0x4121, 0x3752, 0, 0x3D2B, 0, 0,
+ 0, 0, 0x7B53, 0, 0x3F25, 0x4136, 0x6564, 0,
+ 0, 0x6566, 0x6567, 0, 0, 0x6563, 0x6565, 0,
+ 0, 0, 0, 0, 0, 0, 0x655A, 0x6562,
+ 0, 0x656A, 0x6569, 0, 0, 0x4B7A, 0, 0,
+ 0x372B, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6568, 0, 0x656C, 0x656B, 0x656F, 0, 0x6571,
+};
+unsigned short utf8_to_euc_E7BA[] = {
+ 0, 0, 0x3B3C, 0x656D, 0, 0, 0, 0,
+ 0x6572, 0x6573, 0x7921, 0, 0x6574, 0, 0x657A, 0x453B,
+ 0x6576, 0, 0x6575, 0x6577, 0x6578, 0, 0x6579, 0,
+ 0, 0, 0, 0x657B, 0x657C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7BC[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -4775,509 +3658,509 @@ const unsigned short utf8_to_euc_E7BC[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0x344C, 0,
- 0x657D, 0, 0x657E, 0xD46C, 0xD46B, 0xD46D, 0xD46E, 0xD46F,
-};
-const unsigned short utf8_to_euc_E7BD[] = {
- 0, 0, 0, 0xD470, 0xD471, 0x6621, 0, 0xD472,
- 0, 0, 0, 0, 0x6622, 0x6623, 0x6624, 0xD473,
- 0x6625, 0x6626, 0xD474, 0xD475, 0x6628, 0x6627, 0, 0,
- 0x6629, 0, 0, 0xD476, 0xD477, 0xD478, 0, 0x662A,
- 0x662B, 0xD479, 0, 0xD47A, 0xD47B, 0xD47C, 0xD47D, 0x662E,
- 0x662C, 0x662D, 0x3A61, 0x3753, 0, 0xD47E, 0x4356, 0,
- 0x4833, 0xD521, 0x3D70, 0, 0, 0x474D, 0, 0x486D,
- 0x662F, 0x586D, 0, 0, 0, 0xD522, 0xD523, 0xD524,
-};
-const unsigned short utf8_to_euc_E7BE[] = {
- 0xD525, 0, 0x6630, 0x6632, 0, 0x4D65, 0x6631, 0x6634,
- 0x6633, 0, 0x4D53, 0xD526, 0x6635, 0xD527, 0x487E, 0xD528,
- 0xD529, 0xD52A, 0, 0, 0x6636, 0, 0xD52B, 0xD52C,
- 0, 0, 0x6639, 0, 0xD52D, 0x6638, 0x6637, 0,
- 0, 0xD52E, 0xD52F, 0x663A, 0x3732, 0, 0xD530, 0,
- 0x4122, 0x3541, 0xD531, 0, 0, 0xD532, 0x663E, 0x663B,
- 0, 0, 0x663C, 0, 0xD533, 0, 0x663F, 0,
- 0x6640, 0x663D, 0, 0, 0xD534, 0x3129, 0, 0xD535,
-};
-const unsigned short utf8_to_euc_E7BF[] = {
- 0xD536, 0x3227, 0, 0xD537, 0, 0x6642, 0x6643, 0,
- 0xD538, 0, 0x6644, 0, 0x4D62, 0, 0xD539, 0xD53A,
+ 0x657D, 0, 0x657E, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7BD[] = {
+ 0, 0, 0, 0, 0, 0x6621, 0, 0x7B54,
+ 0, 0, 0, 0, 0x6622, 0x6623, 0x6624, 0,
+ 0x6625, 0x6626, 0, 0, 0x6628, 0x6627, 0, 0,
+ 0x6629, 0, 0, 0, 0, 0, 0, 0x662A,
+ 0x662B, 0, 0, 0, 0, 0, 0, 0x662E,
+ 0x662C, 0x662D, 0x3A61, 0x3753, 0, 0, 0x4356, 0,
+ 0x4833, 0, 0x3D70, 0, 0, 0x474D, 0, 0x486D,
+ 0x662F, 0x586D, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E7BE[] = {
+ 0, 0, 0x6630, 0x6632, 0, 0x4D65, 0x6631, 0x6634,
+ 0x6633, 0, 0x4D53, 0, 0x6635, 0, 0x487E, 0,
+ 0, 0, 0, 0, 0x6636, 0, 0, 0,
+ 0, 0, 0x6639, 0, 0, 0x6638, 0x6637, 0,
+ 0, 0x7B55, 0, 0x663A, 0x3732, 0, 0, 0,
+ 0x4122, 0x3541, 0, 0, 0, 0, 0x663E, 0x663B,
+ 0, 0, 0x663C, 0, 0, 0, 0x663F, 0,
+ 0x6640, 0x663D, 0, 0, 0, 0x3129, 0, 0,
+};
+unsigned short utf8_to_euc_E7BF[] = {
+ 0, 0x3227, 0, 0, 0, 0x6642, 0x6643, 0,
+ 0, 0, 0x6644, 0, 0x4D62, 0, 0, 0,
0, 0, 0x3D2C, 0, 0x6646, 0x6645, 0, 0,
- 0, 0, 0, 0xD53B, 0, 0, 0, 0xD53C,
- 0x3F69, 0x6647, 0, 0xD53D, 0, 0xD53E, 0x6648, 0,
- 0xD53F, 0x6649, 0, 0x3465, 0xD540, 0, 0xD541, 0xD542,
- 0x344D, 0, 0xD543, 0x664A, 0, 0, 0, 0,
- 0, 0x664B, 0xD544, 0x4B5D, 0x4D63, 0xD545, 0xD546, 0xD547,
-};
-const unsigned short utf8_to_euc_E880[] = {
- 0x4D54, 0x4F37, 0, 0x394D, 0x664E, 0x3C54, 0x664D, 0xD548,
- 0xD549, 0, 0xD54A, 0x664F, 0x3C29, 0xD54B, 0xD54C, 0xD54D,
- 0x4251, 0xD54E, 0x6650, 0xD54F, 0xD550, 0x394C, 0xD551, 0x4C57,
- 0x6651, 0x6652, 0, 0, 0x6653, 0xD552, 0xD553, 0xD554,
- 0xD555, 0x6654, 0, 0, 0xD556, 0, 0xD557, 0,
- 0x6655, 0, 0, 0, 0xD558, 0, 0xD559, 0,
- 0xD55A, 0, 0, 0x3C2A, 0xD55B, 0xD55C, 0x4C6D, 0xD55D,
- 0, 0xD55E, 0xD55F, 0x6657, 0xD560, 0x433F, 0xD561, 0x6656,
-};
-const unsigned short utf8_to_euc_E881[] = {
- 0xD562, 0, 0, 0, 0xD563, 0, 0x6659, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x3F69, 0x6647, 0, 0, 0, 0, 0x6648, 0,
+ 0, 0x6649, 0, 0x3465, 0, 0, 0, 0,
+ 0x344D, 0, 0, 0x664A, 0, 0, 0, 0,
+ 0, 0x664B, 0, 0x4B5D, 0x4D63, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E880[] = {
+ 0x4D54, 0x4F37, 0, 0x394D, 0x664E, 0x3C54, 0x664D, 0,
+ 0, 0, 0, 0x664F, 0x3C29, 0, 0, 0,
+ 0x4251, 0, 0x6650, 0, 0, 0x394C, 0, 0x4C57,
+ 0x6651, 0x6652, 0, 0, 0x6653, 0, 0, 0,
+ 0, 0x6654, 0, 0, 0, 0, 0, 0,
+ 0x6655, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3C2A, 0, 0, 0x4C6D, 0,
+ 0, 0, 0, 0x6657, 0, 0x433F, 0, 0x6656,
+};
+unsigned short utf8_to_euc_E881[] = {
+ 0, 0, 0, 0, 0, 0, 0x6659, 0,
0, 0, 0x6658, 0, 0, 0, 0, 0,
0, 0, 0x665A, 0, 0, 0, 0x403B, 0,
0x665B, 0, 0x665C, 0, 0, 0, 0x4A39, 0x665D,
- 0xD564, 0x416F, 0x665E, 0, 0xD565, 0, 0xD566, 0,
- 0x665F, 0, 0, 0, 0, 0xD567, 0, 0x4E7E,
- 0x6662, 0xD568, 0x6661, 0x6660, 0x4430, 0xD569, 0x6663, 0x3F26,
+ 0, 0x416F, 0x665E, 0, 0, 0, 0, 0,
+ 0x665F, 0, 0, 0, 0, 0, 0, 0x4E7E,
+ 0x6662, 0, 0x6661, 0x6660, 0x4430, 0, 0x6663, 0x3F26,
0, 0x6664, 0, 0, 0, 0x6665, 0x4F38, 0x6666,
};
-const unsigned short utf8_to_euc_E882[] = {
- 0, 0xD56A, 0, 0, 0x6667, 0x6669, 0x6668, 0x4825,
- 0xD56B, 0x4679, 0, 0x4F3E, 0x4829, 0, 0xD56C, 0,
+unsigned short utf8_to_euc_E882[] = {
+ 0, 0, 0, 0, 0x6667, 0x6669, 0x6668, 0x4825,
+ 0, 0x4679, 0, 0x4F3E, 0x4829, 0, 0, 0,
0, 0, 0, 0x666B, 0, 0, 0x3E53, 0,
- 0x492A, 0, 0x666C, 0x666A, 0xD56D, 0x344E, 0xD56E, 0,
- 0, 0x3854, 0x3B68, 0, 0, 0x486E, 0xD56F, 0xD570,
- 0, 0x382A, 0x4B43, 0xD571, 0x666F, 0x666D, 0, 0x394E,
+ 0x492A, 0, 0x666C, 0x666A, 0, 0x344E, 0, 0,
+ 0, 0x3854, 0x3B68, 0, 0, 0x486E, 0, 0,
+ 0, 0x382A, 0x4B43, 0, 0x666F, 0x666D, 0, 0x394E,
0, 0x394F, 0x3069, 0, 0x3A68, 0, 0, 0,
- 0xD572, 0xD573, 0x4759, 0, 0, 0, 0, 0,
+ 0, 0, 0x4759, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E883[] = {
+unsigned short utf8_to_euc_E883[] = {
0, 0, 0, 0x305F, 0x6674, 0, 0x4340, 0,
- 0xD574, 0, 0, 0, 0x4758, 0xD575, 0x425B, 0xD576,
- 0, 0, 0xD577, 0, 0xD578, 0xD579, 0x6676, 0xD57A,
- 0xD57B, 0x6672, 0x6675, 0x6670, 0, 0x6673, 0x4B26, 0,
- 0xD57C, 0x3855, 0, 0, 0x307D, 0x6671, 0, 0,
- 0, 0, 0, 0, 0, 0xD57D, 0xD57E, 0x6678,
- 0xD621, 0x6679, 0xD622, 0xD623, 0x4639, 0, 0xD624, 0,
- 0x363B, 0xD625, 0xD626, 0, 0x6726, 0x473D, 0xD627, 0,
-};
-const unsigned short utf8_to_euc_E884[] = {
- 0, 0, 0x3B69, 0xD628, 0, 0x363C, 0x4048, 0x4F46,
- 0x4C2E, 0x6677, 0x4054, 0xD629, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xD62A, 0xD62B,
- 0xD62C, 0, 0x3553, 0x667A, 0xD62D, 0, 0xD62E, 0,
- 0xD62F, 0, 0, 0x667C, 0xD630, 0, 0, 0xD631,
- 0, 0x667B, 0, 0, 0xD632, 0, 0, 0x667D,
- 0xD633, 0x4326, 0, 0x473E, 0, 0xD634, 0, 0,
- 0, 0x4431, 0xD635, 0, 0xD636, 0, 0x6723, 0,
-};
-const unsigned short utf8_to_euc_E885[] = {
- 0, 0, 0, 0, 0, 0xD637, 0x6722, 0xD638,
- 0, 0, 0xD639, 0x667E, 0xD63A, 0, 0x3F55, 0,
- 0x4965, 0x6725, 0xD63B, 0x6724, 0x3950, 0x4F53, 0, 0xD63C,
+ 0, 0, 0, 0, 0x4758, 0, 0x425B, 0,
+ 0, 0, 0, 0, 0, 0, 0x6676, 0,
+ 0, 0x6672, 0x6675, 0x6670, 0, 0x6673, 0x4B26, 0,
+ 0, 0x3855, 0, 0, 0x307D, 0x6671, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6678,
+ 0, 0x6679, 0, 0, 0x4639, 0, 0, 0,
+ 0x363B, 0, 0, 0, 0x6726, 0x473D, 0, 0,
+};
+unsigned short utf8_to_euc_E884[] = {
+ 0, 0, 0x3B69, 0, 0, 0x363C, 0x4048, 0x4F46,
+ 0x4C2E, 0x6677, 0x4054, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3553, 0x667A, 0, 0, 0, 0,
+ 0, 0, 0, 0x667C, 0, 0, 0, 0,
+ 0, 0x667B, 0, 0, 0, 0, 0, 0x667D,
+ 0, 0x4326, 0, 0x473E, 0, 0, 0, 0,
+ 0, 0x4431, 0, 0, 0, 0, 0x6723, 0,
+};
+unsigned short utf8_to_euc_E885[] = {
+ 0, 0, 0, 0, 0, 0, 0x6722, 0,
+ 0, 0, 0, 0x667E, 0, 0, 0x3F55, 0,
+ 0x4965, 0x6725, 0, 0x6724, 0x3950, 0x4F53, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x6735,
- 0xD63D, 0xD63E, 0, 0, 0, 0x6729, 0x672A, 0xD63F,
- 0xD640, 0xD641, 0, 0x3C70, 0, 0xD642, 0x6728, 0xD643,
- 0x3978, 0x6727, 0, 0, 0x672B, 0, 0, 0xD644,
+ 0, 0, 0, 0, 0, 0x6729, 0x672A, 0,
+ 0, 0, 0, 0x3C70, 0, 0, 0x6728, 0,
+ 0x3978, 0x6727, 0, 0, 0x672B, 0, 0, 0,
0x4432, 0x4A22, 0x4123, 0, 0, 0, 0, 0x425C,
};
-const unsigned short utf8_to_euc_E886[] = {
- 0x672F, 0xD645, 0x6730, 0x672C, 0xD647, 0xD648, 0xD649, 0,
- 0x672D, 0, 0x672E, 0xD64A, 0, 0, 0xD64B, 0x3951,
- 0xD646, 0, 0, 0x6736, 0, 0x6732, 0xD64C, 0,
- 0xD64D, 0, 0x4966, 0xD64E, 0x4B6C, 0x4928, 0xD64F, 0,
- 0x6731, 0, 0xD650, 0x6734, 0x6733, 0, 0, 0,
- 0x4B44, 0x6737, 0, 0, 0, 0, 0xD651, 0,
- 0x6738, 0, 0xD652, 0x4137, 0xD653, 0x6739, 0, 0,
- 0x673B, 0, 0x673F, 0xD654, 0, 0x673C, 0x673A, 0x473F,
-};
-const unsigned short utf8_to_euc_E887[] = {
- 0x673D, 0, 0x673E, 0xD656, 0, 0xD657, 0x3232, 0,
- 0x6745, 0x6740, 0xD658, 0xD655, 0, 0x6741, 0xD659, 0xD65A,
- 0, 0x6742, 0, 0x4221, 0, 0xD65B, 0, 0xD65C,
- 0x6744, 0x6743, 0x6746, 0xD65D, 0, 0xD65E, 0xD65F, 0x6747,
- 0x6748, 0xD660, 0, 0x3F43, 0xD661, 0x3269, 0, 0x6749,
- 0x4E57, 0, 0x3C2B, 0xD662, 0xD663, 0x3D2D, 0, 0,
- 0xD664, 0xD665, 0xD666, 0x3B6A, 0x4357, 0xD667, 0xD668, 0,
- 0xD669, 0xD66A, 0x674A, 0x674B, 0x3131, 0xD66B, 0x674C, 0xD66C,
-};
-const unsigned short utf8_to_euc_E888[] = {
- 0xD66D, 0x674D, 0x674E, 0xD66E, 0, 0x674F, 0, 0x6750,
- 0x363D, 0x5A2A, 0x6751, 0, 0x4065, 0x6752, 0x3C4B, 0xD66F,
- 0x6753, 0, 0x5030, 0xD670, 0xD671, 0, 0x6754, 0x4A5E,
- 0x345C, 0xD672, 0xD673, 0x4124, 0x3D58, 0xD674, 0x4971, 0x3D2E,
- 0, 0xD675, 0xD676, 0, 0, 0, 0, 0,
- 0xD677, 0x6755, 0x3952, 0x6756, 0x484C, 0, 0x6764, 0,
- 0, 0, 0xD678, 0x6758, 0xD679, 0x4249, 0x4775, 0x383F,
- 0x6757, 0x4125, 0xD67A, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E889[] = {
- 0x6759, 0, 0, 0xD67B, 0xD67C, 0xD67D, 0xD67E, 0x447A,
- 0, 0, 0, 0xD721, 0, 0, 0xD722, 0xD723,
- 0, 0xD724, 0, 0, 0, 0, 0xD725, 0,
- 0x675B, 0x675A, 0x675D, 0, 0xD726, 0x675C, 0, 0x675E,
- 0xD727, 0, 0x6760, 0xD728, 0x675F, 0, 0x344F, 0xD729,
- 0x6761, 0, 0x6762, 0x6763, 0, 0xD72A, 0x3A31, 0x4E49,
- 0, 0x6765, 0x3F27, 0, 0xD72B, 0, 0x3170, 0x6766,
- 0x6767, 0, 0, 0xD72C, 0, 0xD72D, 0x6768, 0xD72E,
-};
-const unsigned short utf8_to_euc_E88A[] = {
- 0xD72F, 0xD730, 0, 0xD731, 0xD732, 0, 0, 0xD733,
- 0, 0xD734, 0xD735, 0x3072, 0, 0x6769, 0xD736, 0,
- 0, 0xD737, 0x676A, 0, 0xD738, 0, 0xD739, 0,
- 0xD73A, 0x4967, 0xD73B, 0xD73C, 0, 0x3C47, 0, 0x676C,
- 0xD73D, 0xD73E, 0, 0xD73F, 0xD740, 0x3329, 0x3032, 0xD741,
- 0xD742, 0xD743, 0xD744, 0x676B, 0x676E, 0x474E, 0xD745, 0x3F44,
- 0xD746, 0x3256, 0xD747, 0x4B27, 0xD748, 0, 0, 0xD749,
- 0x375D, 0x365C, 0xD74A, 0x676D, 0xD74B, 0x326A, 0xD74C, 0xD74D,
-};
-const unsigned short utf8_to_euc_E88B[] = {
- 0, 0, 0, 0, 0, 0x3423, 0xD74E, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xD74F, 0x3171, 0x6772, 0x4E6A, 0x425D, 0xD750, 0, 0x4944,
- 0, 0x677E, 0xD751, 0x3257, 0x677C, 0, 0x677A, 0x6771,
- 0xD752, 0x676F, 0xD753, 0x6770, 0xD754, 0x3C63, 0x366C, 0x4377,
- 0xD755, 0, 0xD756, 0x4651, 0, 0xD757, 0, 0xD758,
- 0, 0x3151, 0, 0x6774, 0x6773, 0, 0xD759, 0xD75A,
- 0, 0x6779, 0x6775, 0x6778, 0, 0xD75B, 0xD75C, 0,
-};
-const unsigned short utf8_to_euc_E88C[] = {
- 0xD75D, 0xD75E, 0x4C50, 0x6777, 0x3258, 0x337D, 0x677B, 0xD75F,
- 0xD760, 0x677D, 0xD761, 0xD762, 0, 0, 0x3754, 0,
+unsigned short utf8_to_euc_E886[] = {
+ 0x672F, 0, 0x6730, 0x672C, 0, 0, 0, 0,
+ 0x672D, 0, 0x672E, 0, 0, 0, 0, 0x3951,
+ 0, 0, 0, 0x6736, 0, 0x6732, 0, 0,
+ 0, 0, 0x4966, 0, 0x4B6C, 0x4928, 0, 0,
+ 0x6731, 0, 0, 0x6734, 0x6733, 0, 0, 0,
+ 0x4B44, 0x6737, 0, 0, 0, 0, 0, 0,
+ 0x6738, 0, 0, 0x4137, 0, 0x6739, 0, 0,
+ 0x673B, 0, 0x673F, 0, 0, 0x673C, 0x673A, 0x473F,
+};
+unsigned short utf8_to_euc_E887[] = {
+ 0x673D, 0, 0x673E, 0, 0, 0, 0x3232, 0,
+ 0x6745, 0x6740, 0, 0, 0, 0x6741, 0, 0,
+ 0, 0x6742, 0, 0x4221, 0, 0, 0, 0,
+ 0x6744, 0x6743, 0x6746, 0, 0, 0, 0, 0x6747,
+ 0x6748, 0, 0, 0x3F43, 0, 0x3269, 0, 0x6749,
+ 0x4E57, 0, 0x3C2B, 0, 0, 0x3D2D, 0, 0,
+ 0, 0, 0, 0x3B6A, 0x4357, 0, 0, 0,
+ 0, 0, 0x674A, 0x674B, 0x3131, 0, 0x674C, 0,
+};
+unsigned short utf8_to_euc_E888[] = {
+ 0, 0x674D, 0x674E, 0, 0, 0x674F, 0, 0x6750,
+ 0x363D, 0x5A2A, 0x6751, 0, 0x4065, 0x6752, 0x3C4B, 0,
+ 0x6753, 0, 0x5030, 0, 0, 0, 0x6754, 0x4A5E,
+ 0x345C, 0, 0, 0x4124, 0x3D58, 0, 0x4971, 0x3D2E,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6755, 0x3952, 0x6756, 0x484C, 0, 0x6764, 0,
+ 0, 0, 0, 0x6758, 0, 0x4249, 0x4775, 0x383F,
+ 0x6757, 0x4125, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E889[] = {
+ 0x6759, 0, 0, 0, 0, 0, 0, 0x447A,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x675B, 0x675A, 0x675D, 0, 0, 0x675C, 0, 0x675E,
+ 0, 0, 0x6760, 0, 0x675F, 0, 0x344F, 0,
+ 0x6761, 0, 0x6762, 0x6763, 0, 0, 0x3A31, 0x4E49,
+ 0, 0x6765, 0x3F27, 0, 0, 0, 0x3170, 0x6766,
+ 0x6767, 0, 0, 0, 0, 0, 0x6768, 0,
+};
+unsigned short utf8_to_euc_E88A[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3072, 0, 0x6769, 0, 0,
+ 0, 0, 0x676A, 0, 0, 0, 0, 0,
+ 0, 0x4967, 0, 0, 0, 0x3C47, 0, 0x676C,
+ 0, 0, 0, 0, 0, 0x3329, 0x3032, 0,
+ 0, 0, 0, 0x676B, 0x676E, 0x474E, 0, 0x3F44,
+ 0, 0x3256, 0, 0x4B27, 0, 0, 0, 0,
+ 0x375D, 0x365C, 0, 0x676D, 0, 0x326A, 0, 0,
+};
+unsigned short utf8_to_euc_E88B[] = {
+ 0, 0, 0, 0, 0, 0x3423, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x3171, 0x6772, 0x4E6A, 0x425D, 0, 0, 0x4944,
+ 0, 0x677E, 0, 0x3257, 0x677C, 0, 0x677A, 0x6771,
+ 0, 0x676F, 0, 0x6770, 0, 0x3C63, 0x366C, 0x4377,
+ 0, 0, 0, 0x4651, 0, 0, 0, 0,
+ 0, 0x3151, 0, 0x6774, 0x6773, 0, 0, 0,
+ 0, 0x6779, 0x6775, 0x6778, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E88C[] = {
+ 0, 0x7B57, 0x4C50, 0x6777, 0x3258, 0x337D, 0x677B, 0,
+ 0, 0x677D, 0, 0, 0, 0, 0x3754, 0,
0, 0, 0, 0, 0, 0, 0x6823, 0x682C,
- 0x682D, 0, 0, 0xD764, 0x302B, 0xD765, 0xD766, 0xD767,
- 0, 0xD768, 0xD769, 0x6834, 0, 0, 0, 0,
- 0x3071, 0, 0, 0x682B, 0xD76A, 0xD76B, 0xD76C, 0x682A,
- 0xD76D, 0x6825, 0x6824, 0xD76E, 0x6822, 0x6821, 0x4363, 0xD76F,
- 0x427B, 0x6827, 0xD770, 0, 0xD771, 0xD772, 0, 0,
-};
-const unsigned short utf8_to_euc_E88D[] = {
- 0x6826, 0, 0xD773, 0xD774, 0xD775, 0x6829, 0, 0xD776,
- 0, 0x4170, 0x3755, 0, 0, 0xD777, 0xD778, 0x3141,
- 0x6828, 0xD779, 0x3953, 0xD83E, 0xD763, 0xD77A, 0xD77B, 0xD77C,
+ 0x682D, 0, 0, 0, 0x302B, 0, 0, 0,
+ 0, 0, 0, 0x6834, 0, 0, 0, 0,
+ 0x3071, 0, 0, 0x682B, 0, 0, 0, 0x682A,
+ 0, 0x6825, 0x6824, 0, 0x6822, 0x6821, 0x4363, 0,
+ 0x427B, 0x6827, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E88D[] = {
+ 0x6826, 0, 0, 0, 0, 0x6829, 0, 0,
+ 0, 0x4170, 0x3755, 0, 0, 0, 0, 0x3141,
+ 0x6828, 0, 0x3953, 0, 0, 0, 0, 0,
0x4171, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xF45F, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xD77D, 0, 0, 0x683A, 0, 0x683B, 0, 0x3259,
- 0xD77E, 0, 0, 0x322E, 0x6838, 0xD821, 0, 0xD822,
-};
-const unsigned short utf8_to_euc_E88E[] = {
- 0xD823, 0, 0xD824, 0, 0xD825, 0x682E, 0xD826, 0x6836,
- 0, 0x683D, 0x6837, 0, 0, 0xD827, 0x6835, 0,
- 0, 0, 0xD828, 0x6776, 0xD829, 0xD82A, 0x6833, 0,
- 0xD82B, 0xD82C, 0x682F, 0xD82D, 0xD82E, 0xD82F, 0x3450, 0x6831,
- 0x683C, 0, 0x6832, 0, 0, 0, 0xD830, 0xD831,
- 0x683E, 0xD832, 0x6830, 0x477C, 0xD833, 0xD84C, 0, 0,
+ 0, 0, 0x7B58, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x683A, 0, 0x683B, 0, 0x3259,
+ 0, 0, 0, 0x322E, 0x6838, 0, 0, 0x7B59,
+};
+unsigned short utf8_to_euc_E88E[] = {
+ 0, 0, 0, 0, 0, 0x682E, 0, 0x6836,
+ 0, 0x683D, 0x6837, 0, 0, 0, 0x6835, 0,
+ 0, 0, 0, 0x6776, 0, 0, 0x6833, 0,
+ 0, 0, 0x682F, 0, 0, 0, 0x3450, 0x6831,
+ 0x683C, 0, 0x6832, 0, 0, 0, 0, 0,
+ 0x683E, 0, 0x6830, 0x477C, 0, 0, 0, 0,
0, 0x4D69, 0, 0, 0, 0x6839, 0, 0,
- 0, 0, 0, 0, 0, 0x684F, 0xD834, 0xD835,
+ 0, 0, 0, 0, 0, 0x684F, 0, 0,
};
-const unsigned short utf8_to_euc_E88F[] = {
- 0xD836, 0x6847, 0, 0, 0, 0x3F7B, 0, 0xD837,
- 0, 0xD838, 0x3546, 0, 0x365D, 0, 0x6842, 0xD839,
- 0xD83A, 0xD83B, 0, 0x325B, 0xD83C, 0, 0x3E54, 0,
- 0x6845, 0, 0, 0, 0x3A5A, 0xD83D, 0, 0x4551,
+unsigned short utf8_to_euc_E88F[] = {
+ 0, 0x6847, 0, 0, 0, 0x3F7B, 0, 0x7B5A,
+ 0, 0, 0x3546, 0, 0x365D, 0, 0x6842, 0,
+ 0, 0, 0, 0x325B, 0, 0, 0x3E54, 0,
+ 0x6845, 0, 0, 0, 0x3A5A, 0, 0, 0x4551,
0x684A, 0, 0, 0, 0, 0, 0, 0,
- 0xD83F, 0x4A6E, 0xD840, 0x6841, 0, 0, 0, 0x325A,
- 0x3856, 0x4929, 0x684B, 0, 0x683F, 0, 0xD841, 0x6848,
- 0xD842, 0xD843, 0, 0x6852, 0xD844, 0x6843, 0, 0,
-};
-const unsigned short utf8_to_euc_E890[] = {
- 0, 0xD845, 0, 0x6844, 0x463A, 0, 0xD846, 0x6849,
- 0, 0, 0xD847, 0x6846, 0x4B28, 0x684C, 0x3060, 0xD848,
- 0, 0xD849, 0, 0x6840, 0, 0xD84A, 0, 0,
- 0, 0xD84B, 0, 0, 0, 0, 0, 0,
+ 0, 0x4A6E, 0, 0x6841, 0, 0, 0, 0x325A,
+ 0x3856, 0x4929, 0x684B, 0, 0x683F, 0, 0x7B5B, 0x6848,
+ 0, 0, 0, 0x6852, 0, 0x6843, 0, 0,
+};
+unsigned short utf8_to_euc_E890[] = {
+ 0, 0, 0, 0x6844, 0x463A, 0, 0, 0x6849,
+ 0, 0, 0, 0x6846, 0x4B28, 0x684C, 0x3060, 0,
+ 0, 0, 0, 0x6840, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0x684E, 0, 0x684D, 0, 0, 0, 0, 0,
- 0, 0x476B, 0x6854, 0, 0x685F, 0, 0, 0xD84D,
+ 0, 0x476B, 0x6854, 0, 0x685F, 0, 0, 0,
0, 0x337E, 0, 0, 0, 0x6862, 0, 0,
- 0x6850, 0xD84E, 0, 0, 0x6855, 0x4D6E, 0, 0,
-};
-const unsigned short utf8_to_euc_E891[] = {
- 0, 0, 0, 0, 0, 0xD84F, 0x685E, 0xD850,
- 0xD851, 0x4D55, 0xD852, 0, 0, 0xD853, 0x4E2A, 0xD854,
- 0, 0xD855, 0xD856, 0, 0, 0, 0xD857, 0x4378,
- 0xD858, 0xD859, 0xD85A, 0x336B, 0xD85B, 0, 0, 0,
- 0xD85C, 0x4972, 0x6864, 0x4621, 0xD85D, 0xD85E, 0x3031, 0xD85F,
- 0, 0x685D, 0xD860, 0x6859, 0x4172, 0x6853, 0x685B, 0x6860,
- 0xD861, 0x472C, 0, 0xD862, 0xD863, 0x302A, 0xD864, 0x6858,
- 0xD865, 0x6861, 0x4978, 0, 0xD866, 0xD867, 0, 0,
-};
-const unsigned short utf8_to_euc_E892[] = {
- 0, 0xD868, 0x685C, 0, 0x6857, 0xD869, 0, 0,
+ 0x6850, 0, 0, 0, 0x6855, 0x4D6E, 0, 0,
+};
+unsigned short utf8_to_euc_E891[] = {
+ 0, 0, 0, 0, 0, 0, 0x685E, 0,
+ 0x7B5C, 0x4D55, 0, 0, 0, 0, 0x4E2A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4378,
+ 0, 0, 0, 0x336B, 0, 0, 0, 0,
+ 0, 0x4972, 0x6864, 0x4621, 0, 0, 0x3031, 0,
+ 0, 0x685D, 0, 0x6859, 0x4172, 0x6853, 0x685B, 0x6860,
+ 0, 0x472C, 0, 0, 0, 0x302A, 0, 0x6858,
+ 0, 0x6861, 0x4978, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E892[] = {
+ 0, 0, 0x685C, 0, 0x6857, 0, 0, 0,
0, 0, 0, 0x3E55, 0, 0, 0, 0,
- 0x3D2F, 0, 0xD86A, 0xD86B, 0x3C2C, 0xD86C, 0, 0,
- 0, 0x4C58, 0, 0, 0x4947, 0, 0xD86D, 0x6867,
- 0, 0x6870, 0, 0, 0, 0, 0xD86E, 0,
- 0xD86F, 0xD870, 0xD871, 0, 0, 0x685A, 0, 0xD872,
- 0, 0xD873, 0x3377, 0, 0xD874, 0, 0, 0,
- 0x3E78, 0x6865, 0xD875, 0x686A, 0x4173, 0xD876, 0xD877, 0x6866,
-};
-const unsigned short utf8_to_euc_E893[] = {
- 0xD878, 0x686D, 0xD879, 0, 0x435F, 0, 0x686E, 0xD87A,
- 0xD87B, 0x4D56, 0x6863, 0x3338, 0xD87C, 0x6869, 0, 0xD87D,
- 0x686C, 0x4C2C, 0, 0xD87E, 0, 0, 0x686F, 0,
- 0, 0x6868, 0x686B, 0, 0xD921, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xD922,
- 0, 0, 0xD923, 0, 0x4B29, 0, 0x4F21, 0xD924,
- 0xD925, 0xD926, 0xD927, 0, 0x6873, 0, 0, 0xD928,
- 0, 0, 0xD92A, 0xD92B, 0x687A, 0xD92C, 0, 0x6872,
-};
-const unsigned short utf8_to_euc_E894[] = {
- 0x3C43, 0, 0xD92D, 0xD92E, 0, 0, 0x6851, 0xD92F,
- 0, 0, 0, 0, 0xD930, 0, 0xD931, 0,
- 0xD932, 0x4A4E, 0, 0x4C22, 0x6879, 0x6878, 0, 0x6874,
- 0x6875, 0, 0x3136, 0, 0xD933, 0, 0xD934, 0x6877,
- 0, 0x6871, 0xD935, 0xD936, 0xD937, 0xD938, 0x4455, 0xD939,
- 0, 0, 0xD93A, 0xD93B, 0x6876, 0x307E, 0, 0xD93C,
- 0, 0, 0xD929, 0xD93D, 0xD93E, 0x4222, 0xD93F, 0,
- 0, 0, 0, 0, 0, 0x4A43, 0, 0xD940,
-};
-const unsigned short utf8_to_euc_E895[] = {
- 0x687B, 0x6921, 0, 0x4859, 0, 0, 0xD941, 0,
- 0x687E, 0x3E56, 0x3C49, 0x6923, 0, 0, 0x363E, 0xD942,
- 0xD943, 0xD944, 0xD945, 0xD946, 0, 0x6924, 0xD947, 0x4979,
- 0x687D, 0xD948, 0x6856, 0, 0xD949, 0xD94A, 0xD94B, 0xD94C,
- 0xD94D, 0xD94E, 0xD94F, 0x687C, 0xD950, 0, 0, 0,
- 0x4F4F, 0x4622, 0x4973, 0xD951, 0, 0x692B, 0, 0xD952,
+ 0x3D2F, 0, 0, 0, 0x3C2C, 0, 0, 0,
+ 0, 0x4C58, 0, 0, 0x4947, 0, 0, 0x6867,
+ 0, 0x6870, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x685A, 0, 0,
+ 0, 0, 0x3377, 0, 0x7B5D, 0, 0, 0,
+ 0x3E78, 0x6865, 0, 0x686A, 0x4173, 0, 0, 0x6866,
+};
+unsigned short utf8_to_euc_E893[] = {
+ 0, 0x686D, 0, 0, 0x435F, 0, 0x686E, 0,
+ 0, 0x4D56, 0x6863, 0x3338, 0, 0x6869, 0, 0,
+ 0x686C, 0x4C2C, 0, 0, 0, 0, 0x686F, 0,
+ 0, 0x6868, 0x686B, 0, 0x7925, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x4B29, 0, 0x4F21, 0,
+ 0, 0, 0, 0, 0x6873, 0, 0, 0,
+ 0, 0, 0, 0, 0x687A, 0, 0, 0x6872,
+};
+unsigned short utf8_to_euc_E894[] = {
+ 0x3C43, 0, 0, 0, 0, 0, 0x6851, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x4A4E, 0, 0x4C22, 0x6879, 0x6878, 0, 0x6874,
+ 0x6875, 0, 0x3136, 0, 0, 0, 0, 0x6877,
+ 0, 0x6871, 0, 0, 0, 0, 0x4455, 0,
+ 0, 0, 0, 0, 0x6876, 0x307E, 0, 0,
+ 0, 0, 0, 0, 0, 0x4222, 0, 0,
+ 0, 0, 0, 0, 0, 0x4A43, 0, 0,
+};
+unsigned short utf8_to_euc_E895[] = {
+ 0x687B, 0x6921, 0, 0x4859, 0, 0, 0, 0,
+ 0x687E, 0x3E56, 0x3C49, 0x6923, 0, 0, 0x363E, 0,
+ 0, 0, 0, 0x7B5E, 0, 0x6924, 0, 0x4979,
+ 0x687D, 0x7B5F, 0x6856, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x687C, 0, 0, 0, 0,
+ 0x4F4F, 0x4622, 0x4973, 0x7B60, 0, 0x692B, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x6931,
- 0, 0xD953, 0xD954, 0xD955, 0, 0xD956, 0x6932, 0xD957,
-};
-const unsigned short utf8_to_euc_E896[] = {
- 0x6925, 0xD958, 0, 0, 0x4776, 0xD959, 0xD95A, 0x692F,
- 0x6927, 0xD95B, 0x6929, 0xD95C, 0xD95D, 0, 0, 0xD95E,
- 0x6933, 0x6928, 0, 0xD95F, 0x692C, 0, 0, 0x3172,
- 0xD960, 0x4665, 0, 0x692D, 0x6930, 0xD961, 0, 0xD962,
- 0xD963, 0, 0xD964, 0, 0x6926, 0xD965, 0x4126, 0xD966,
- 0x692A, 0x3B27, 0x3F45, 0x3730, 0x4C74, 0xD974, 0x4C79, 0x3D72,
- 0xF461, 0, 0, 0, 0xD967, 0, 0xD968, 0xD969,
- 0xD96A, 0x6937, 0x6935, 0, 0xD96B, 0xD96C, 0xD96D, 0xD96E,
-};
-const unsigned short utf8_to_euc_E897[] = {
- 0, 0x4F4E, 0xD96F, 0, 0, 0, 0, 0xD970,
- 0, 0x6934, 0xD971, 0xD972, 0, 0x4D75, 0xD973, 0x6936,
+ 0, 0, 0, 0, 0, 0, 0x6932, 0,
+};
+unsigned short utf8_to_euc_E896[] = {
+ 0x6925, 0, 0, 0, 0x4776, 0, 0, 0x692F,
+ 0x6927, 0, 0x6929, 0, 0, 0, 0, 0,
+ 0x6933, 0x6928, 0, 0, 0x692C, 0, 0, 0x3172,
+ 0, 0x4665, 0, 0x692D, 0x6930, 0, 0, 0,
+ 0, 0, 0, 0, 0x6926, 0, 0x4126, 0,
+ 0x692A, 0x3B27, 0x3F45, 0x3730, 0x4C74, 0, 0x4C79, 0x3D72,
+ 0x7B62, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6937, 0x6935, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E897[] = {
+ 0, 0x4F4E, 0, 0, 0, 0, 0, 0,
+ 0, 0x6934, 0, 0, 0, 0x4D75, 0, 0x6936,
0x6938, 0, 0, 0, 0, 0x6939, 0, 0,
- 0xD975, 0, 0xD976, 0, 0x693C, 0x693A, 0, 0xD977,
- 0xD978, 0, 0, 0, 0x4623, 0x693B, 0xD979, 0,
- 0xD97A, 0x484D, 0x692E, 0, 0, 0xD97B, 0, 0,
- 0, 0, 0, 0xD97C, 0, 0, 0xD97D, 0x3D73,
- 0, 0x693D, 0x6942, 0x4174, 0xD97E, 0, 0x6941, 0xDA21,
-};
-const unsigned short utf8_to_euc_E898[] = {
- 0xDA22, 0, 0x6922, 0, 0xDA23, 0xDA24, 0x6943, 0x4149,
- 0, 0, 0x693E, 0x6940, 0, 0xDA25, 0xDA26, 0,
- 0xDA27, 0xDA28, 0xDA29, 0x693F, 0, 0, 0x5D31, 0x5D22,
- 0xDA2A, 0xDA2B, 0x6945, 0xDA2C, 0, 0, 0xDA2D, 0,
- 0, 0xDA2E, 0x6944, 0, 0, 0, 0, 0xDA2F,
- 0, 0xDA30, 0, 0, 0, 0x4D76, 0, 0x623C,
- 0x6946, 0, 0, 0, 0, 0, 0xDA31, 0,
- 0xDA32, 0, 0xDA33, 0, 0xDA34, 0xDA35, 0, 0x6947,
-};
-const unsigned short utf8_to_euc_E899[] = {
- 0xDA36, 0xB866, 0xDA37, 0, 0, 0, 0xDA38, 0,
+ 0, 0, 0, 0, 0x693C, 0x693A, 0, 0,
+ 0, 0, 0, 0, 0x4623, 0x693B, 0, 0,
+ 0, 0x484D, 0x692E, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x3D73,
+ 0, 0x693D, 0x6942, 0x4174, 0, 0, 0x6941, 0,
+};
+unsigned short utf8_to_euc_E898[] = {
+ 0, 0, 0x6922, 0, 0, 0, 0x6943, 0x4149,
+ 0, 0, 0x693E, 0x6940, 0, 0, 0, 0,
+ 0, 0, 0, 0x693F, 0, 0, 0x5D31, 0x5D22,
+ 0, 0, 0x6945, 0, 0, 0, 0, 0,
+ 0, 0, 0x6944, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x4D76, 0, 0x623C,
+ 0x6946, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6947,
+};
+unsigned short utf8_to_euc_E899[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x6948, 0x3857, 0,
- 0x3554, 0, 0xDA39, 0xDA3A, 0x694A, 0x515D, 0xDA3B, 0xDA3C,
- 0xDA3D, 0xDA3E, 0x3575, 0, 0x4E3A, 0xDA3F, 0x3673, 0x694B,
- 0xDA40, 0xDA41, 0xDA42, 0xDA43, 0xDA44, 0, 0, 0x694C,
- 0, 0xDA45, 0, 0x436E, 0xDA46, 0, 0, 0xDA47,
- 0, 0x694D, 0, 0, 0, 0xDA48, 0xDA49, 0xDA4A,
- 0, 0x467A, 0xDA4B, 0x303A, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E89A[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xDA6D, 0, 0x3263, 0x6952, 0x6953, 0xDA4C, 0, 0,
- 0, 0xDA4D, 0, 0x694E, 0, 0x3B3D, 0xDA4E, 0,
- 0xDA4F, 0, 0xDA50, 0, 0xDA51, 0, 0, 0,
- 0, 0xDA52, 0, 0x694F, 0x4742, 0, 0xDA53, 0xDA54,
- 0xDA55, 0x6950, 0x6951, 0x695B, 0, 0xDA56, 0, 0x6955,
- 0x6958, 0xDA57, 0, 0xDA58, 0xDA59, 0xDA5A, 0x6954, 0xDA5B,
- 0xDA5C, 0xDA5D, 0, 0, 0, 0, 0, 0xDA5E,
-};
-const unsigned short utf8_to_euc_E89B[] = {
- 0xDA5F, 0xDA60, 0, 0xDA61, 0x6956, 0xDA62, 0x6957, 0x3C58,
+ 0x3554, 0, 0, 0, 0x694A, 0x515D, 0, 0,
+ 0, 0, 0x3575, 0, 0x4E3A, 0, 0x3673, 0x694B,
+ 0, 0, 0, 0, 0, 0, 0, 0x694C,
+ 0, 0, 0, 0x436E, 0, 0, 0, 0,
+ 0, 0x694D, 0, 0, 0, 0, 0, 0,
+ 0, 0x467A, 0, 0x303A, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E89A[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3263, 0x6952, 0x6953, 0, 0, 0,
+ 0, 0, 0, 0x694E, 0, 0x3B3D, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x694F, 0x4742, 0, 0, 0,
+ 0, 0x6950, 0x6951, 0x695B, 0, 0, 0, 0x6955,
+ 0x6958, 0, 0, 0, 0, 0, 0x6954, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E89B[] = {
+ 0, 0, 0, 0, 0x6956, 0, 0x6957, 0x3C58,
0, 0x6959, 0, 0x4341, 0, 0x3756, 0x3342, 0,
- 0, 0xDA63, 0xDA64, 0, 0x695C, 0xDA65, 0, 0xDA66,
- 0, 0x333F, 0xDA67, 0x6961, 0xDA68, 0, 0x695D, 0x6960,
- 0xDA69, 0, 0, 0xDA6A, 0x483A, 0xDA6B, 0, 0xDA6C,
+ 0, 0, 0, 0, 0x695C, 0, 0, 0,
+ 0, 0x333F, 0, 0x6961, 0, 0, 0x695D, 0x6960,
+ 0, 0, 0, 0, 0x483A, 0, 0, 0,
0, 0x695E, 0, 0, 0x695F, 0x4948, 0x485A, 0x6962,
0, 0, 0, 0, 0, 0, 0, 0,
- 0x427D, 0x696C, 0xDA6E, 0x6968, 0xDA6F, 0xDA70, 0x326B, 0,
-};
-const unsigned short utf8_to_euc_E89C[] = {
- 0x6966, 0, 0x4B2A, 0x6967, 0xDA71, 0xDA72, 0x6964, 0xDA73,
- 0x6965, 0x696A, 0x696D, 0xDA74, 0, 0x696B, 0xDA75, 0xDA76,
- 0xDA77, 0x6969, 0x6963, 0xDA78, 0xDA79, 0, 0, 0,
- 0x4358, 0xDA7A, 0x6974, 0, 0x4C2A, 0, 0xDA7B, 0xDA7C,
- 0, 0xDA7D, 0, 0xDA7E, 0, 0x6972, 0, 0,
- 0xDB21, 0x6973, 0, 0, 0, 0, 0xDB22, 0xDB23,
- 0, 0xDB24, 0xDB25, 0, 0x696E, 0, 0, 0x6970,
- 0, 0xDB26, 0xDB27, 0x6971, 0xDB28, 0xDB29, 0xDB2A, 0x696F,
-};
-const unsigned short utf8_to_euc_E89D[] = {
- 0xDB2B, 0, 0, 0xDB2C, 0, 0xDB2D, 0, 0,
- 0, 0x4066, 0, 0x4F39, 0x6978, 0xDB2E, 0x6979, 0,
+ 0x427D, 0x696C, 0, 0x6968, 0, 0, 0x326B, 0,
+};
+unsigned short utf8_to_euc_E89C[] = {
+ 0x6966, 0, 0x4B2A, 0x6967, 0, 0, 0x6964, 0,
+ 0x6965, 0x696A, 0x696D, 0, 0, 0x696B, 0, 0,
+ 0, 0x6969, 0x6963, 0, 0, 0, 0, 0,
+ 0x4358, 0, 0x6974, 0, 0x4C2A, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x6972, 0, 0,
+ 0, 0x6973, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x696E, 0, 0, 0x6970,
+ 0, 0, 0, 0x6971, 0, 0, 0, 0x696F,
+};
+unsigned short utf8_to_euc_E89D[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x4066, 0, 0x4F39, 0x6978, 0, 0x6979, 0,
0, 0, 0, 0x6A21, 0, 0x3F2A, 0, 0x697B,
- 0xDB2F, 0x697E, 0, 0, 0, 0xDB30, 0, 0x6976,
- 0x6975, 0xDB31, 0, 0x6A22, 0xDB32, 0xDB33, 0x325C, 0,
- 0x697C, 0, 0x6A23, 0, 0, 0, 0x697D, 0xDB34,
- 0, 0xDB35, 0xDB36, 0, 0x697A, 0, 0x4433, 0,
- 0x6977, 0, 0, 0xDB37, 0, 0, 0, 0x4768,
-};
-const unsigned short utf8_to_euc_E89E[] = {
- 0, 0, 0x6A27, 0xDB38, 0xDB39, 0xDB3A, 0xDB3B, 0xDB3C,
- 0xDB3D, 0xDB3E, 0, 0xDB3F, 0xDB40, 0x4D3B, 0, 0,
- 0xDB41, 0, 0, 0xDB42, 0, 0xDB43, 0, 0xDB44,
- 0xDB45, 0xDB46, 0, 0, 0, 0, 0xDB47, 0x6A26,
- 0xDB48, 0, 0x6A25, 0xDB49, 0, 0, 0, 0xDB4A,
- 0, 0, 0, 0x6A2E, 0xDB4B, 0xDB4C, 0xDB4D, 0x6A28,
- 0, 0xDB4E, 0, 0x6A30, 0, 0xDB4F, 0, 0,
- 0, 0, 0x4D66, 0x6A33, 0, 0x6A2A, 0xDB50, 0xDB51,
-};
-const unsigned short utf8_to_euc_E89F[] = {
- 0x6A2B, 0xDB52, 0, 0, 0x6A2F, 0, 0x6A32, 0x6A31,
- 0xDB53, 0xDB54, 0xDB55, 0x6A29, 0, 0, 0xDB56, 0,
- 0x6A2C, 0, 0x6A3D, 0, 0, 0xDB57, 0xDB58, 0,
- 0, 0xDB59, 0xDB5A, 0, 0xDB5B, 0, 0, 0xDB5C,
- 0x6A36, 0, 0xDB5D, 0xDB5E, 0xDB5F, 0, 0, 0,
- 0, 0, 0xDB60, 0xDB61, 0, 0xDB62, 0, 0x6A34,
- 0, 0xDB63, 0x6A35, 0xDB64, 0, 0, 0x6A3A, 0x6A3B,
- 0xDB65, 0x332A, 0xDB66, 0x3542, 0, 0, 0x6A39, 0xDB67,
-};
-const unsigned short utf8_to_euc_E8A0[] = {
- 0, 0xDB68, 0, 0xDB69, 0, 0x6A24, 0xDB6A, 0xF464,
- 0, 0xDB6B, 0xDB6C, 0xDB6D, 0, 0x6A38, 0x6A3C, 0x6A37,
- 0xDB6E, 0x6A3E, 0xDB70, 0xDB71, 0xDB72, 0x6A40, 0x6A3F, 0,
- 0xDB73, 0xDB6F, 0xDB74, 0xDB75, 0xDB76, 0, 0xDB77, 0xDB78,
+ 0, 0x697E, 0, 0, 0, 0, 0, 0x6976,
+ 0x6975, 0, 0, 0x6A22, 0, 0, 0x325C, 0,
+ 0x697C, 0, 0x6A23, 0, 0, 0, 0x697D, 0,
+ 0, 0, 0, 0, 0x697A, 0, 0x4433, 0,
+ 0x6977, 0, 0, 0, 0, 0, 0, 0x4768,
+};
+unsigned short utf8_to_euc_E89E[] = {
+ 0, 0, 0x6A27, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x4D3B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6A26,
+ 0, 0, 0x6A25, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6A2E, 0, 0, 0, 0x6A28,
+ 0, 0, 0, 0x6A30, 0, 0, 0, 0,
+ 0, 0, 0x4D66, 0x6A33, 0, 0x6A2A, 0, 0,
+};
+unsigned short utf8_to_euc_E89F[] = {
+ 0x6A2B, 0, 0, 0, 0x6A2F, 0, 0x6A32, 0x6A31,
+ 0, 0, 0, 0x6A29, 0, 0, 0, 0,
+ 0x6A2C, 0, 0x6A3D, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6A36, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6A34,
+ 0, 0, 0x6A35, 0, 0, 0, 0x6A3A, 0x6A3B,
+ 0, 0x332A, 0, 0x3542, 0, 0, 0x6A39, 0,
+};
+unsigned short utf8_to_euc_E8A0[] = {
+ 0, 0, 0, 0, 0, 0x6A24, 0, 0x7B65,
+ 0, 0, 0, 0, 0, 0x6A38, 0x6A3C, 0x6A37,
+ 0, 0x6A3E, 0, 0, 0, 0x6A40, 0x6A3F, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0x6A42, 0x6A41, 0x695A, 0, 0, 0, 0x6A46,
- 0xDB79, 0, 0, 0, 0, 0xDB7A, 0xDB7B, 0,
- 0xDB7C, 0x6A43, 0xDB7D, 0, 0, 0xDB7E, 0x6A44, 0,
- 0, 0x6A45, 0xDC21, 0x6A47, 0xDC22, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E8A1[] = {
- 0x376C, 0xDC23, 0x6A49, 0xDC24, 0x6A48, 0xDC25, 0x3D30, 0,
- 0xDC26, 0xDC27, 0xDC28, 0xDC29, 0x3954, 0x5E27, 0xDC2A, 0,
- 0, 0xDC2B, 0x6A4A, 0x3D51, 0, 0xDC2C, 0xDC2D, 0x3339,
- 0xDC2E, 0x6A4B, 0xDC2F, 0x3152, 0xDC30, 0x3E57, 0x6A4C, 0xDC31,
- 0xDC32, 0x3955, 0x6A4D, 0x3061, 0xDC33, 0, 0, 0,
- 0x493D, 0xDC34, 0, 0x6A4E, 0, 0, 0, 0,
- 0x3F6A, 0xDC35, 0x6A55, 0, 0, 0x6A52, 0, 0x436F,
- 0, 0xDC36, 0, 0xDC37, 0, 0x6A53, 0x6A50, 0x365E,
-};
-const unsigned short utf8_to_euc_E8A2[] = {
- 0xDC38, 0x6A4F, 0x6A56, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6A43, 0, 0, 0, 0, 0x6A44, 0,
+ 0, 0x6A45, 0, 0x6A47, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8A1[] = {
+ 0x376C, 0, 0x6A49, 0, 0x6A48, 0, 0x3D30, 0,
+ 0, 0, 0, 0, 0x3954, 0x5E27, 0, 0,
+ 0, 0, 0x6A4A, 0x3D51, 0, 0, 0, 0x3339,
+ 0, 0x6A4B, 0, 0x3152, 0, 0x3E57, 0x6A4C, 0,
+ 0, 0x3955, 0x6A4D, 0x3061, 0, 0, 0, 0,
+ 0x493D, 0, 0, 0x6A4E, 0, 0, 0, 0,
+ 0x3F6A, 0, 0x6A55, 0, 0, 0x6A52, 0, 0x436F,
+ 0, 0, 0, 0, 0, 0x6A53, 0x6A50, 0x365E,
+};
+unsigned short utf8_to_euc_E8A2[] = {
+ 0, 0x6A4F, 0x6A56, 0, 0, 0, 0, 0,
0x3736, 0, 0, 0x425E, 0, 0x6A5C, 0, 0,
0, 0, 0x6A58, 0, 0, 0, 0x4235, 0x6A57,
- 0xDC39, 0x6A5A, 0xDC3A, 0xDC3B, 0xDC3C, 0, 0x6A51, 0xDC3D,
- 0xDC3E, 0, 0x6A5B, 0, 0x6A5D, 0, 0, 0,
- 0xDC3F, 0, 0xDC40, 0x486F, 0, 0, 0x6A59, 0,
+ 0, 0x6A5A, 0, 0, 0, 0, 0x6A51, 0,
+ 0, 0, 0x6A5B, 0, 0x6A5D, 0, 0, 0,
+ 0, 0, 0, 0x486F, 0, 0, 0x6A59, 0,
0x6A5E, 0x6A60, 0, 0, 0x3853, 0x6A54, 0, 0x3041,
- 0, 0, 0xDC41, 0, 0, 0xDC42, 0xDC43, 0x6A5F,
-};
-const unsigned short utf8_to_euc_E8A3[] = {
- 0xDC44, 0x3A5B, 0x4E76, 0x6A61, 0x6A62, 0x4175, 0, 0,
- 0, 0, 0xDC45, 0xDC46, 0xDC47, 0xDC48, 0xDC49, 0x4E22,
- 0, 0xDC4A, 0xDC4B, 0xDC4C, 0x6A63, 0x4D35, 0, 0,
- 0x6A64, 0x6A65, 0, 0xDC4D, 0x4A64, 0x6A66, 0xDC4E, 0x3A40,
- 0, 0x4E23, 0, 0, 0, 0, 0, 0xDC4F,
- 0x6A6B, 0, 0, 0, 0, 0, 0, 0xDC50,
- 0xDC51, 0xDC52, 0x6A6C, 0x3E58, 0x6A6A, 0xDC53, 0, 0xDC54,
+ 0, 0, 0, 0, 0, 0, 0, 0x6A5F,
+};
+unsigned short utf8_to_euc_E8A3[] = {
+ 0, 0x3A5B, 0x4E76, 0x6A61, 0x6A62, 0x4175, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4E22,
+ 0, 0, 0, 0, 0x6A63, 0x4D35, 0, 0,
+ 0x6A64, 0x6A65, 0, 0, 0x4A64, 0x6A66, 0, 0x3A40,
+ 0, 0x4E23, 0, 0, 0, 0, 0, 0,
+ 0x6A6B, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x6A6C, 0x3E58, 0x6A6A, 0x7B66, 0, 0,
0x4D67, 0x6A67, 0, 0, 0x6A69, 0x403D, 0x3F7E, 0,
};
-const unsigned short utf8_to_euc_E8A4[] = {
- 0, 0xDC55, 0x6A68, 0, 0x6A6D, 0, 0xDC56, 0x4A23,
- 0, 0, 0x6A6F, 0, 0x6A6E, 0xDC57, 0xDC58, 0xDC59,
- 0x336C, 0, 0x4B2B, 0x6A70, 0, 0xDC5A, 0xDC5B, 0,
- 0xDC5C, 0xDC5D, 0xDC5E, 0, 0xDC5F, 0x6A7C, 0x6A72, 0,
- 0xDC60, 0, 0, 0, 0, 0x6A73, 0xDC61, 0xDC62,
- 0xDC63, 0, 0x6A74, 0x6A75, 0, 0, 0, 0,
- 0xDC64, 0xDC65, 0xDC66, 0, 0, 0xDC67, 0x6A79, 0,
- 0x6A7A, 0xDC68, 0xDC69, 0x6A78, 0, 0, 0xDC6A, 0,
-};
-const unsigned short utf8_to_euc_E8A5[] = {
- 0xDC6B, 0x6A76, 0xDC6C, 0x6A71, 0x6A77, 0xDC6D, 0xDC6E, 0,
- 0, 0xDC6F, 0, 0, 0x6A7B, 0x7037, 0, 0xDC70,
- 0, 0, 0xDC71, 0, 0, 0, 0x3228, 0xDC72,
- 0, 0, 0xDC73, 0xDC74, 0xDC75, 0, 0x6A7E, 0x365F,
- 0x6A7D, 0xDC76, 0xDC77, 0xDC78, 0x6B22, 0, 0x6B21, 0,
- 0, 0, 0x6B24, 0xDC79, 0, 0x6B23, 0xDC7A, 0x6B25,
- 0xDC7B, 0, 0x3D31, 0xDC7C, 0x6B26, 0xDC7D, 0, 0x6B27,
- 0, 0, 0xDC7E, 0xDD21, 0xDD22, 0xDD23, 0x6B28, 0x403E,
-};
-const unsigned short utf8_to_euc_E8A6[] = {
+unsigned short utf8_to_euc_E8A4[] = {
+ 0, 0, 0x6A68, 0, 0x6A6D, 0, 0, 0x4A23,
+ 0, 0, 0x6A6F, 0, 0x6A6E, 0, 0, 0,
+ 0x336C, 0, 0x4B2B, 0x6A70, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x7922, 0x6A7C, 0x6A72, 0,
+ 0, 0, 0, 0, 0, 0x6A73, 0, 0,
+ 0, 0, 0x6A74, 0x6A75, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6A79, 0,
+ 0x6A7A, 0, 0, 0x6A78, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8A5[] = {
+ 0, 0x6A76, 0, 0x6A71, 0x6A77, 0, 0, 0,
+ 0, 0, 0, 0, 0x6A7B, 0x7037, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3228, 0,
+ 0, 0, 0, 0, 0, 0, 0x6A7E, 0x365F,
+ 0x6A7D, 0, 0, 0, 0x6B22, 0, 0x6B21, 0,
+ 0, 0, 0x6B24, 0, 0, 0x6B23, 0, 0x6B25,
+ 0, 0, 0x3D31, 0, 0x6B26, 0, 0, 0x6B27,
+ 0, 0, 0, 0, 0, 0, 0x6B28, 0x403E,
+};
+unsigned short utf8_to_euc_E8A6[] = {
0, 0x4D57, 0, 0x6B29, 0, 0, 0x4A24, 0x4746,
- 0x6B2A, 0xDD24, 0x6B2B, 0x382B, 0, 0xDD25, 0, 0x352C,
- 0xDD26, 0, 0, 0x6B2C, 0xDD27, 0xDD28, 0x3B6B, 0x4741,
- 0x6B2D, 0, 0x3350, 0xDD29, 0xDD2A, 0, 0, 0xDD2B,
- 0xDD2C, 0x6B2E, 0, 0, 0, 0xDD2D, 0x6B30, 0x4D77,
+ 0x6B2A, 0, 0x6B2B, 0x382B, 0, 0, 0, 0x352C,
+ 0, 0, 0, 0x6B2C, 0, 0, 0x3B6B, 0x4741,
+ 0x6B2D, 0, 0x3350, 0, 0, 0, 0, 0,
+ 0, 0x6B2E, 0, 0, 0, 0, 0x6B30, 0x4D77,
0, 0x6B2F, 0x3F46, 0, 0x6B31, 0, 0, 0x6B32,
- 0xDD2E, 0, 0x6B33, 0x3451, 0xDD2F, 0xDD30, 0xDD31, 0xDD32,
- 0, 0, 0x6B34, 0, 0xDD33, 0x6B35, 0, 0x6B36,
+ 0, 0, 0x6B33, 0x3451, 0, 0, 0, 0,
+ 0, 0, 0x6B34, 0, 0, 0x6B35, 0, 0x6B36,
};
-const unsigned short utf8_to_euc_E8A7[] = {
+unsigned short utf8_to_euc_E8A7[] = {
0x6B37, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x3351, 0, 0xDD34, 0xDD35, 0xDD36, 0xDD37,
- 0xDD38, 0, 0x6B38, 0, 0x6B39, 0x6B3A, 0, 0,
- 0, 0, 0, 0x3272, 0, 0xDD39, 0x3F28, 0x6B3B,
- 0, 0xDD3A, 0, 0xDD3B, 0, 0xDD3C, 0, 0,
- 0, 0xDD3D, 0, 0xDD3E, 0x6B3C, 0, 0xDD3F, 0,
- 0x6B3D, 0xDD40, 0, 0, 0, 0xDD41, 0, 0xDD42,
-};
-const unsigned short utf8_to_euc_E8A8[] = {
- 0x3840, 0, 0x447B, 0x6B3E, 0xDD43, 0xDD44, 0, 0xDD45,
- 0x3757, 0, 0x3F56, 0, 0x6B41, 0, 0x4624, 0xDD46,
- 0x6B40, 0xDD47, 0xDD48, 0x3731, 0xDD49, 0xDD4A, 0x6B3F, 0x4277,
- 0x352D, 0, 0, 0x6B42, 0, 0x6B43, 0xDD4B, 0x3E59,
- 0xDD4C, 0, 0xDD4D, 0x376D, 0xDD4E, 0x6B44, 0xDD4F, 0,
- 0, 0, 0x4B2C, 0xDD50, 0xDD51, 0x405F, 0, 0xDD52,
- 0, 0x3576, 0, 0x4C75, 0x414A, 0xDD53, 0x6B45, 0xDD54,
- 0, 0, 0x3F47, 0x4370, 0x3E5A, 0xDD55, 0xDD56, 0,
-};
-const unsigned short utf8_to_euc_E8A9[] = {
- 0xDD57, 0x6B46, 0, 0xDD58, 0, 0xDD59, 0x6B49, 0xDD5A,
- 0x6B4A, 0xDD5B, 0, 0, 0, 0xDD5C, 0xDD5D, 0,
- 0x3A3E, 0x4242, 0x6B48, 0xDD5E, 0x3E5B, 0x493E, 0xDD5F, 0xDD60,
- 0xDD61, 0, 0, 0x6B47, 0xDD62, 0xDD63, 0x3B6C, 0,
- 0x3153, 0xDD64, 0x6B4E, 0x3758, 0, 0xDD65, 0x3B6E, 0xDD66,
+ 0, 0, 0x3351, 0, 0, 0, 0, 0,
+ 0, 0, 0x6B38, 0, 0x6B39, 0x6B3A, 0, 0,
+ 0, 0, 0, 0x3272, 0, 0, 0x3F28, 0x6B3B,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x6B3C, 0, 0, 0,
+ 0x6B3D, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8A8[] = {
+ 0x3840, 0, 0x447B, 0x6B3E, 0, 0, 0, 0,
+ 0x3757, 0, 0x3F56, 0, 0x6B41, 0, 0x4624, 0,
+ 0x6B40, 0, 0x7B67, 0x3731, 0, 0, 0x6B3F, 0x4277,
+ 0x352D, 0, 0, 0x6B42, 0, 0x6B43, 0, 0x3E59,
+ 0, 0, 0, 0x376D, 0, 0x6B44, 0, 0,
+ 0, 0, 0x4B2C, 0, 0, 0x405F, 0, 0,
+ 0, 0x3576, 0, 0x4C75, 0x414A, 0, 0x6B45, 0x7B68,
+ 0, 0, 0x3F47, 0x4370, 0x3E5A, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8A9[] = {
+ 0, 0x6B46, 0, 0, 0, 0, 0x6B49, 0,
+ 0x6B4A, 0, 0, 0, 0, 0, 0, 0,
+ 0x3A3E, 0x4242, 0x6B48, 0, 0x3E5B, 0x493E, 0, 0,
+ 0, 0, 0, 0x6B47, 0, 0, 0x3B6C, 0,
+ 0x3153, 0, 0x6B4E, 0x3758, 0, 0, 0x3B6E, 0,
0, 0x3B6D, 0, 0x4F4D, 0x6B4D, 0x6B4C, 0x4127, 0,
- 0x354D, 0x4F43, 0x333A, 0x3E5C, 0, 0xDD67, 0xDD68, 0xDD69,
- 0, 0xDD6A, 0xDD6B, 0xDD6C, 0x6B4B, 0, 0xDD6D, 0xDD6E,
-};
-const unsigned short utf8_to_euc_E8AA[] = {
- 0xDD6F, 0, 0x6B50, 0xDD70, 0x6B51, 0x6B4F, 0xDD71, 0x3858,
- 0, 0x4D40, 0, 0xDD72, 0x3B6F, 0x4727, 0, 0xDD73,
- 0xDD74, 0x6B54, 0xDD75, 0x4040, 0, 0x4342, 0xDD76, 0xDD77,
- 0x4D36, 0xDD78, 0x6B57, 0, 0, 0, 0x386C, 0xDD79,
- 0x403F, 0x6B53, 0, 0x6B58, 0x386D, 0x6B55, 0x6B56, 0xDD7A,
- 0x6B52, 0xDD7B, 0, 0, 0x4062, 0x4649, 0xDD7C, 0xDD7D,
- 0x432F, 0, 0x325D, 0xDD7E, 0, 0, 0xDE21, 0xDE22,
- 0, 0x4870, 0, 0xDE23, 0x3543, 0, 0xDE24, 0x4434,
-};
-const unsigned short utf8_to_euc_E8AB[] = {
- 0, 0, 0x6B5B, 0xDE25, 0x6B59, 0, 0xDE26, 0x434C,
- 0xDE27, 0xDE28, 0xDE29, 0x4041, 0x3452, 0x6B5A, 0, 0x3F5B,
- 0, 0xDE2A, 0x4E4A, 0xDE2B, 0xDE2C, 0xDE2D, 0x4F40, 0xDE2E,
- 0, 0, 0x6B5C, 0x6B67, 0x4435, 0xDE2F, 0x6B66, 0xDE30,
+ 0x354D, 0x4F43, 0x333A, 0x3E5C, 0, 0, 0, 0,
+ 0, 0x7B69, 0, 0, 0x6B4B, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8AA[] = {
+ 0, 0, 0x6B50, 0, 0x6B51, 0x6B4F, 0, 0x3858,
+ 0, 0x4D40, 0, 0, 0x3B6F, 0x4727, 0, 0,
+ 0, 0x6B54, 0, 0x4040, 0, 0x4342, 0, 0,
+ 0x4D36, 0, 0x6B57, 0, 0, 0, 0x386C, 0,
+ 0x403F, 0x6B53, 0, 0x6B58, 0x386D, 0x6B55, 0x6B56, 0x7B6A,
+ 0x6B52, 0, 0, 0, 0x4062, 0x4649, 0, 0,
+ 0x432F, 0, 0x325D, 0, 0, 0, 0, 0,
+ 0, 0x4870, 0, 0, 0x3543, 0, 0x7B6B, 0x4434,
+};
+unsigned short utf8_to_euc_E8AB[] = {
+ 0, 0, 0x6B5B, 0, 0x6B59, 0, 0, 0x434C,
+ 0, 0, 0, 0x4041, 0x3452, 0x6B5A, 0, 0x3F5B,
+ 0, 0, 0x4E4A, 0, 0, 0, 0x4F40, 0,
+ 0, 0, 0x6B5C, 0x6B67, 0x4435, 0, 0x6B66, 0x7B6C,
0x6B63, 0x6B6B, 0x6B64, 0, 0x6B60, 0, 0x447C, 0x6B5F,
- 0, 0, 0, 0x6B5D, 0xDE31, 0x4D21, 0x3B70, 0,
- 0xDE32, 0x6B61, 0, 0x6B5E, 0xDE33, 0xDE34, 0xDE35, 0x6B65,
- 0x3D74, 0, 0x3841, 0, 0xDE36, 0, 0x427A, 0xDE37,
-};
-const unsigned short utf8_to_euc_E8AC[] = {
- 0x4B45, 0x315A, 0x3062, 0, 0x4625, 0xDE38, 0xDE39, 0x6B69,
- 0, 0, 0xDE3F, 0xDE3A, 0x6B68, 0, 0x4666, 0,
- 0x6B6D, 0xDE3B, 0, 0, 0x6B62, 0, 0x6B6C, 0x6B6E,
- 0, 0x382C, 0x6B6A, 0x3956, 0xDE3C, 0x3C55, 0xDE3D, 0xDE3E,
+ 0, 0, 0, 0x6B5D, 0, 0x4D21, 0x3B70, 0,
+ 0, 0x6B61, 0, 0x6B5E, 0, 0, 0x7B6E, 0x6B65,
+ 0x3D74, 0, 0x3841, 0, 0, 0, 0x427A, 0,
+};
+unsigned short utf8_to_euc_E8AC[] = {
+ 0x4B45, 0x315A, 0x3062, 0, 0x4625, 0, 0, 0x6B69,
+ 0, 0, 0, 0, 0x6B68, 0, 0x4666, 0,
+ 0x6B6D, 0, 0, 0, 0x6B62, 0, 0x6B6C, 0x6B6E,
+ 0, 0x382C, 0x6B6A, 0x3956, 0, 0x3C55, 0, 0,
0x6B6F, 0x4D58, 0, 0, 0, 0, 0x6B72, 0,
- 0x6B75, 0, 0, 0x6B73, 0x4935, 0xDE40, 0, 0,
- 0xDE41, 0, 0, 0x6B70, 0, 0, 0, 0xDE42,
- 0, 0x3660, 0, 0, 0xDE43, 0, 0x6B74, 0,
+ 0x6B75, 0, 0, 0x6B73, 0x4935, 0, 0, 0,
+ 0, 0, 0, 0x6B70, 0, 0, 0, 0,
+ 0, 0x3660, 0, 0, 0, 0, 0x6B74, 0,
};
-const unsigned short utf8_to_euc_E8AD[] = {
- 0, 0x6B76, 0xDE44, 0xDE45, 0xDE46, 0xDE47, 0xDE48, 0,
- 0xDE49, 0x6B7A, 0, 0, 0x6B77, 0xDE4E, 0x6B79, 0x6B78,
- 0, 0, 0xDE4A, 0xDE4B, 0xDE4C, 0, 0x6B7B, 0,
- 0x3C31, 0xDE4D, 0x6B7D, 0x6B7C, 0x4968, 0, 0xDE4F, 0x6C21,
- 0, 0, 0, 0xDE50, 0, 0, 0x3759, 0,
- 0, 0, 0, 0x6B7E, 0x6C22, 0xDE51, 0, 0x6C23,
- 0x3544, 0x6641, 0x3E79, 0, 0x6C24, 0, 0xDE52, 0x386E,
- 0xDE53, 0xDE54, 0, 0, 0xDE55, 0x6C25, 0xDE56, 0xF466,
+unsigned short utf8_to_euc_E8AD[] = {
+ 0, 0x6B76, 0, 0, 0, 0, 0, 0,
+ 0, 0x6B7A, 0, 0, 0x6B77, 0, 0x6B79, 0x6B78,
+ 0, 0, 0, 0x7B6F, 0, 0, 0x6B7B, 0,
+ 0x3C31, 0, 0x6B7D, 0x6B7C, 0x4968, 0, 0, 0x6C21,
+ 0, 0, 0, 0, 0, 0, 0x3759, 0,
+ 0, 0, 0, 0x6B7E, 0x6C22, 0, 0, 0x6C23,
+ 0x3544, 0x6641, 0x3E79, 0, 0x6C24, 0, 0, 0x386E,
+ 0, 0, 0, 0, 0, 0x6C25, 0, 0x7B70,
};
-const unsigned short utf8_to_euc_E8AE[] = {
- 0x6C26, 0xDE57, 0, 0x3B3E, 0xDE58, 0xDE59, 0, 0,
- 0, 0, 0x5A4E, 0xDE5A, 0x6C27, 0xDE5B, 0x6C28, 0xDE5C,
- 0x3D32, 0, 0x6C29, 0x6C2A, 0xDE5D, 0xDE5E, 0x6C2B, 0,
- 0, 0x6C2C, 0x6C2D, 0, 0xDE5F, 0, 0xDE60, 0xDE61,
+unsigned short utf8_to_euc_E8AE[] = {
+ 0x6C26, 0, 0, 0x3B3E, 0, 0, 0, 0,
+ 0, 0, 0x5A4E, 0, 0x6C27, 0, 0x6C28, 0,
+ 0x3D32, 0, 0x6C29, 0x6C2A, 0, 0, 0x6C2B, 0,
+ 0, 0x6C2C, 0x6C2D, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E8B0[] = {
+unsigned short utf8_to_euc_E8B0[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5285,340 +4168,340 @@ const unsigned short utf8_to_euc_E8B0[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x432B,
- 0xDE62, 0xDE63, 0x6C2E, 0, 0, 0xDE64, 0xDE65, 0x6C30,
-};
-const unsigned short utf8_to_euc_E8B1[] = {
- 0, 0x6C2F, 0, 0, 0, 0xDE66, 0x4626, 0xDE67,
- 0x6C31, 0xDE68, 0x4B2D, 0xDE69, 0x6C32, 0, 0x6C33, 0xDE6A,
- 0x6C34, 0xDE6B, 0, 0xDE6C, 0xDE6D, 0x6C35, 0, 0xDE6E,
- 0xDE6F, 0xDE72, 0x465A, 0xDE70, 0, 0xDE71, 0, 0,
- 0, 0x3E5D, 0x6C36, 0xDE73, 0xDE74, 0, 0xDE75, 0,
- 0xDE76, 0xDE77, 0x396B, 0x502E, 0x6C37, 0xDE78, 0, 0,
- 0, 0, 0, 0xDE79, 0, 0xDE7A, 0xDE7B, 0,
- 0x6C38, 0x493F, 0x6C39, 0xDE7C, 0x6C41, 0, 0xDE7D, 0,
-};
-const unsigned short utf8_to_euc_E8B2[] = {
- 0, 0, 0x6C3A, 0, 0, 0x6C3C, 0xDE7E, 0xDF21,
- 0, 0x6C3B, 0x6C3D, 0xDF22, 0x4B46, 0x6C3E, 0x6C3F, 0,
- 0xDF23, 0, 0xDF24, 0xDF25, 0x6C40, 0, 0, 0,
- 0x6C42, 0xDF26, 0, 0xDF27, 0xDF28, 0x332D, 0x4467, 0,
- 0x4969, 0x3A62, 0x3957, 0, 0xDF29, 0, 0, 0x494F,
+ 0, 0, 0x6C2E, 0, 0, 0, 0, 0x6C30,
+};
+unsigned short utf8_to_euc_E8B1[] = {
+ 0, 0x6C2F, 0, 0, 0, 0, 0x4626, 0,
+ 0x6C31, 0, 0x4B2D, 0, 0x6C32, 0, 0x6C33, 0,
+ 0x6C34, 0, 0, 0, 0, 0x6C35, 0, 0,
+ 0, 0, 0x465A, 0, 0, 0, 0, 0,
+ 0, 0x3E5D, 0x6C36, 0, 0, 0, 0, 0,
+ 0, 0, 0x396B, 0x502E, 0x6C37, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6C38, 0x493F, 0x6C39, 0, 0x6C41, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8B2[] = {
+ 0, 0, 0x6C3A, 0, 0, 0x6C3C, 0, 0,
+ 0, 0x6C3B, 0x6C3D, 0, 0x4B46, 0x6C3E, 0x6C3F, 0,
+ 0, 0, 0, 0, 0x6C40, 0, 0, 0,
+ 0x6C42, 0, 0, 0, 0, 0x332D, 0x4467, 0,
+ 0x4969, 0x3A62, 0x3957, 0, 0, 0, 0, 0x494F,
0x325F, 0x484E, 0x6C45, 0x3453, 0x4055, 0x6C44, 0x6C49, 0x4379,
0x4C63, 0, 0x6C47, 0x6C48, 0x352E, 0, 0x6C4A, 0x4763,
- 0x425F, 0xDF2A, 0xDF2B, 0x4871, 0x453D, 0x6C46, 0, 0x4B47,
+ 0x425F, 0, 0, 0x4871, 0x453D, 0x6C46, 0, 0x4B47,
};
-const unsigned short utf8_to_euc_E8B3[] = {
- 0x326C, 0x6C4C, 0x4F28, 0x4442, 0x4F45, 0xDF2C, 0xDF2D, 0x3B71,
- 0x6C4B, 0xDF2E, 0x4231, 0xDF2F, 0, 0x6C5C, 0x4128, 0xDF30,
- 0, 0x4678, 0, 0x4950, 0, 0xDF32, 0xDF31, 0,
- 0, 0xDF33, 0x6C4F, 0x3B3F, 0x3B72, 0xDF34, 0x3E5E, 0,
- 0x4765, 0xDF35, 0x382D, 0x6C4E, 0x6C4D, 0, 0x496A, 0,
- 0xDF36, 0, 0x3C41, 0, 0xDF37, 0x4552, 0, 0xDF38,
- 0xDF39, 0, 0xDF3A, 0, 0xF467, 0xDF3B, 0, 0xDF3C,
- 0xDF3D, 0, 0x6C51, 0x6C52, 0x3958, 0x6C50, 0xDF3E, 0xDF3F,
+unsigned short utf8_to_euc_E8B3[] = {
+ 0x326C, 0x6C4C, 0x4F28, 0x4442, 0x4F45, 0, 0, 0x3B71,
+ 0x6C4B, 0, 0x4231, 0, 0, 0x6C5C, 0x4128, 0,
+ 0, 0x4678, 0, 0x4950, 0, 0, 0, 0,
+ 0, 0, 0x6C4F, 0x3B3F, 0x3B72, 0, 0x3E5E, 0,
+ 0x4765, 0, 0x382D, 0x6C4E, 0x6C4D, 0, 0x496A, 0,
+ 0, 0, 0x3C41, 0, 0, 0x4552, 0, 0,
+ 0x7B71, 0, 0, 0, 0x7B72, 0, 0, 0,
+ 0, 0, 0x6C51, 0x6C52, 0x3958, 0x6C50, 0, 0,
};
-const unsigned short utf8_to_euc_E8B4[] = {
- 0, 0xDF40, 0, 0xDF41, 0x6C53, 0x6C54, 0, 0x6C56,
- 0x4223, 0xDF42, 0x6C55, 0x3466, 0, 0x6C58, 0, 0x6C57,
- 0x6C59, 0, 0xDF43, 0x6C5B, 0x6C5D, 0, 0x6C5E, 0xDF44,
- 0, 0, 0, 0xDF45, 0, 0, 0, 0,
+unsigned short utf8_to_euc_E8B4[] = {
+ 0, 0, 0, 0, 0x6C53, 0x6C54, 0, 0x6C56,
+ 0x4223, 0, 0x6C55, 0x3466, 0, 0x6C58, 0, 0x6C57,
+ 0x6C59, 0, 0x7B73, 0x6C5B, 0x6C5D, 0, 0x6C5E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E8B5[] = {
+unsigned short utf8_to_euc_E8B5[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x4056, 0, 0x3C4F, 0x6C5F,
+ 0, 0, 0, 0x3352, 0, 0x6C60, 0, 0,
+ 0x4176, 0x6C61, 0, 0x6C62, 0x496B, 0, 0x7B74, 0x352F,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0x4056, 0xDF46, 0x3C4F, 0x6C5F,
- 0, 0xDF47, 0, 0x3352, 0xDF48, 0x6C60, 0xDF49, 0,
- 0x4176, 0x6C61, 0, 0x6C62, 0x496B, 0, 0xF468, 0x352F,
- 0, 0, 0, 0, 0, 0, 0, 0xDF4A,
};
-const unsigned short utf8_to_euc_E8B6[] = {
- 0, 0x6C63, 0xDF4B, 0, 0xDF4C, 0x4436, 0, 0,
- 0xDF4D, 0, 0x315B, 0, 0, 0xDF4E, 0, 0,
- 0xDF4F, 0xDF50, 0, 0, 0, 0xDF51, 0, 0,
- 0, 0x6C64, 0, 0, 0, 0, 0xDF52, 0xDF53,
- 0xDF54, 0, 0, 0x3C71, 0, 0, 0xDF55, 0,
- 0x3F76, 0, 0, 0xDF56, 0xDF57, 0, 0, 0xDF58,
- 0, 0, 0xDF59, 0x422D, 0, 0xDF5A, 0, 0xDF5B,
- 0, 0xDF5C, 0x6C67, 0xDF5D, 0xDF6F, 0, 0x6C66, 0,
+unsigned short utf8_to_euc_E8B6[] = {
+ 0, 0x6C63, 0, 0, 0, 0x4436, 0, 0,
+ 0, 0, 0x315B, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6C64, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3C71, 0, 0, 0, 0,
+ 0x3F76, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x422D, 0, 0, 0, 0,
+ 0, 0, 0x6C67, 0, 0, 0, 0x6C66, 0,
};
-const unsigned short utf8_to_euc_E8B7[] = {
- 0xDF5E, 0, 0x6C65, 0, 0, 0xDF5F, 0xDF60, 0xDF61,
- 0xDF62, 0, 0xDF63, 0x6C6D, 0x6C6B, 0, 0xDF64, 0x6C68,
- 0, 0xDF65, 0, 0, 0xDF66, 0xDF67, 0x6C6A, 0xDF68,
- 0, 0xDF69, 0x6C69, 0x6C6C, 0, 0x3577, 0, 0x6C70,
- 0, 0x4057, 0, 0x6C71, 0xDF6A, 0xDF6B, 0, 0xDF6C,
- 0x3859, 0, 0x6C6E, 0x6C6F, 0xDF6D, 0, 0, 0x4F29,
- 0xDF6E, 0xDF70, 0xDF71, 0x4437, 0xDF72, 0x4129, 0, 0,
- 0, 0, 0, 0, 0x6C72, 0xDF73, 0, 0x6C75,
+unsigned short utf8_to_euc_E8B7[] = {
+ 0, 0, 0x6C65, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6C6D, 0x6C6B, 0, 0, 0x6C68,
+ 0, 0, 0, 0, 0, 0, 0x6C6A, 0,
+ 0, 0, 0x6C69, 0x6C6C, 0, 0x3577, 0, 0x6C70,
+ 0, 0x4057, 0, 0x6C71, 0, 0, 0, 0,
+ 0x3859, 0, 0x6C6E, 0x6C6F, 0, 0, 0, 0x4F29,
+ 0, 0, 0, 0x4437, 0, 0x4129, 0, 0,
+ 0, 0, 0, 0, 0x6C72, 0, 0, 0x6C75,
};
-const unsigned short utf8_to_euc_E8B8[] = {
- 0, 0xDF74, 0, 0, 0xDF75, 0xDF76, 0xDF77, 0,
- 0x6C73, 0x6C74, 0x4D59, 0xDF78, 0, 0, 0, 0x4627,
- 0x6C78, 0xDF79, 0, 0, 0xDF7A, 0, 0xDF7B, 0,
+unsigned short utf8_to_euc_E8B8[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6C73, 0x6C74, 0x4D59, 0, 0, 0, 0, 0x4627,
+ 0x6C78, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x6C76, 0x6C77, 0x6C79,
- 0xDF7C, 0xDF7D, 0xDF7E, 0xE021, 0, 0, 0xE022, 0xE023,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x6D29, 0, 0, 0, 0, 0,
- 0x6C7C, 0xE024, 0, 0xE025, 0x6C7D, 0x6C7B, 0xE026, 0xE027,
- 0xE028, 0xE029, 0, 0, 0, 0xE02A, 0, 0,
-};
-const unsigned short utf8_to_euc_E8B9[] = {
- 0xE02B, 0xE02C, 0x6C7A, 0, 0x447D, 0, 0, 0x6D21,
- 0x6D25, 0x6D22, 0x6C7E, 0xE02D, 0x6D23, 0xE02E, 0xE02F, 0xE030,
- 0x6D24, 0, 0, 0, 0xE031, 0x6D2B, 0, 0,
- 0, 0x6D26, 0, 0xE032, 0xE033, 0xE034, 0xE035, 0x4058,
- 0x6D28, 0xE036, 0xE037, 0x6D2A, 0x6D27, 0, 0, 0,
- 0, 0xE038, 0, 0, 0xE039, 0xE03A, 0, 0xE03B,
- 0xE03C, 0xE03D, 0x6D2D, 0, 0x3D33, 0, 0x6D2C, 0,
- 0, 0xE03E, 0xE03F, 0xE040, 0x6D2E, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E8BA[] = {
- 0, 0x6D2F, 0xE041, 0xE042, 0x6D32, 0x6D31, 0, 0x6D30,
- 0, 0xE043, 0x6D34, 0x6D33, 0, 0x4C76, 0, 0,
- 0xE044, 0x6D36, 0xE045, 0x6D35, 0x6D37, 0xE046, 0, 0,
- 0, 0x6D38, 0xE047, 0xE048, 0, 0xE049, 0xE04A, 0,
- 0, 0x6D3A, 0xE04B, 0, 0, 0, 0, 0xE04C,
- 0, 0xE04D, 0x6D39, 0x3F48, 0x6D3B, 0xE04E, 0xE04F, 0x366D,
- 0x6D3C, 0x6D3E, 0, 0xE050, 0, 0xE051, 0, 0,
- 0, 0, 0xE052, 0xE053, 0, 0, 0x6D3F, 0,
-};
-const unsigned short utf8_to_euc_E8BB[] = {
- 0xE054, 0xE055, 0, 0xE056, 0xE057, 0x6D40, 0x6D3D, 0xE058,
- 0x6D41, 0, 0x3C56, 0x6D42, 0x3530, 0x3733, 0, 0xE059,
- 0, 0xE05A, 0x382E, 0, 0xE05B, 0, 0, 0,
- 0, 0, 0, 0x6D43, 0xE05C, 0, 0, 0x4670,
+ 0x6C7C, 0, 0, 0, 0x6C7D, 0x6C7B, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8B9[] = {
+ 0, 0, 0x6C7A, 0, 0x447D, 0, 0, 0x6D21,
+ 0x6D25, 0x6D22, 0x6C7E, 0, 0x6D23, 0, 0, 0,
+ 0x6D24, 0, 0, 0, 0, 0x6D2B, 0, 0,
+ 0, 0x6D26, 0, 0, 0, 0, 0, 0x4058,
+ 0x6D28, 0, 0, 0x6D2A, 0x6D27, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x6D2D, 0, 0x3D33, 0, 0x6D2C, 0,
+ 0, 0, 0, 0, 0x6D2E, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E8BA[] = {
+ 0, 0x6D2F, 0, 0, 0x6D32, 0x6D31, 0, 0x6D30,
+ 0, 0, 0x6D34, 0x6D33, 0, 0x4C76, 0, 0,
+ 0, 0x6D36, 0, 0x6D35, 0x6D37, 0, 0, 0,
+ 0, 0x6D38, 0, 0, 0, 0, 0, 0,
+ 0, 0x6D3A, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x6D39, 0x3F48, 0x6D3B, 0, 0, 0x366D,
+ 0x6D3C, 0x6D3E, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6D3F, 0,
+};
+unsigned short utf8_to_euc_E8BB[] = {
+ 0, 0, 0, 0, 0, 0x6D40, 0x6D3D, 0,
+ 0x6D41, 0, 0x3C56, 0x6D42, 0x3530, 0x3733, 0, 0x7B76,
+ 0, 0, 0x382E, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6D43, 0, 0, 0, 0x4670,
0, 0, 0x453E, 0x6D44, 0, 0, 0, 0,
- 0xE05D, 0, 0, 0x6D47, 0, 0xE064, 0xE05E, 0,
- 0xE05F, 0xE060, 0, 0, 0, 0, 0, 0xE061,
- 0x3C34, 0xE062, 0xE063, 0x6D46, 0x6D45, 0x375A, 0x6D48, 0,
+ 0, 0, 0, 0x6D47, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x3C34, 0, 0, 0x6D46, 0x6D45, 0x375A, 0x6D48, 0,
};
-const unsigned short utf8_to_euc_E8BC[] = {
- 0xE065, 0, 0xE066, 0x3353, 0, 0x6D4A, 0, 0xE067,
- 0xE068, 0x3A5C, 0x6D49, 0, 0x6D52, 0, 0, 0xE069,
- 0xE06A, 0, 0x6D4C, 0x6D4E, 0x4A65, 0x6D4B, 0xE06B, 0xE06C,
- 0xE06D, 0x6D4D, 0, 0x6D51, 0x6D4F, 0x3531, 0xE06E, 0x6D50,
- 0xE06F, 0xE070, 0, 0xE071, 0, 0xE072, 0x6D53, 0xE073,
- 0xE074, 0x475A, 0x4E58, 0, 0xE075, 0xE076, 0xE077, 0x3D34,
- 0, 0, 0, 0x6D54, 0xE078, 0xE079, 0xE07A, 0xE07B,
- 0x4D22, 0x6D56, 0xE07C, 0x6D55, 0, 0, 0x6D59, 0x4D41,
+unsigned short utf8_to_euc_E8BC[] = {
+ 0, 0, 0, 0x3353, 0, 0x6D4A, 0, 0,
+ 0, 0x3A5C, 0x6D49, 0, 0x6D52, 0, 0, 0,
+ 0, 0, 0x6D4C, 0x6D4E, 0x4A65, 0x6D4B, 0, 0,
+ 0, 0x6D4D, 0, 0x6D51, 0x6D4F, 0x3531, 0, 0x6D50,
+ 0, 0, 0, 0, 0, 0, 0x6D53, 0,
+ 0, 0x475A, 0x4E58, 0, 0, 0, 0, 0x3D34,
+ 0, 0, 0, 0x6D54, 0, 0, 0, 0,
+ 0x4D22, 0x6D56, 0, 0x6D55, 0, 0, 0x6D59, 0x4D41,
};
-const unsigned short utf8_to_euc_E8BD[] = {
- 0xE07D, 0xE07E, 0x6D58, 0xE121, 0x336D, 0x6D57, 0x6D5C, 0xE122,
- 0, 0x6D5B, 0, 0, 0x6D5A, 0x4532, 0x6D5D, 0xE123,
- 0, 0xE124, 0xE125, 0xE126, 0xE127, 0xE128, 0, 0x6D5E,
- 0xE129, 0, 0, 0, 0x6D5F, 0xE12A, 0xE12B, 0x396C,
- 0, 0x3725, 0x6D60, 0x6D61, 0x6D62, 0xE12C, 0, 0,
+unsigned short utf8_to_euc_E8BD[] = {
+ 0, 0, 0x6D58, 0, 0x336D, 0x6D57, 0x6D5C, 0,
+ 0, 0x6D5B, 0, 0, 0x6D5A, 0x4532, 0x6D5D, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6D5E,
+ 0, 0, 0, 0, 0x6D5F, 0, 0, 0x396C,
+ 0, 0x3725, 0x6D60, 0x6D61, 0x6D62, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E8BE[] = {
+unsigned short utf8_to_euc_E8BE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x3F49, 0x6D63, 0xE12D, 0x3C2D, 0x6D64,
- 0xE12E, 0xE12F, 0, 0x6D65, 0xE130, 0xE131, 0xE132, 0x5221,
+ 0, 0, 0, 0x3F49, 0x6D63, 0, 0x3C2D, 0x6D64,
+ 0, 0, 0, 0x6D65, 0, 0, 0, 0x5221,
0x517E, 0, 0, 0, 0, 0x6D66, 0x6570, 0x6D67,
- 0x4324, 0x3F2B, 0x4740, 0, 0, 0xE133, 0xE134, 0x6D68,
- 0xE135, 0, 0x4A55, 0x4454, 0x397E, 0, 0xE136, 0x4329,
+ 0x4324, 0x3F2B, 0x4740, 0, 0, 0, 0, 0x6D68,
+ 0, 0, 0x4A55, 0x4454, 0x397E, 0, 0, 0x4329,
};
-const unsigned short utf8_to_euc_E8BF[] = {
- 0xE137, 0xE138, 0x312A, 0, 0x4B78, 0x3F57, 0xE139, 0,
- 0, 0, 0xE13A, 0xE13B, 0, 0xE13C, 0x375E, 0,
- 0xE13D, 0x3661, 0xE13E, 0xE13F, 0x4A56, 0xE140, 0, 0,
+unsigned short utf8_to_euc_E8BF[] = {
+ 0, 0, 0x312A, 0, 0x4B78, 0x3F57, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x375E, 0,
+ 0, 0x3661, 0, 0, 0x4A56, 0, 0, 0,
0, 0, 0x6D69, 0, 0, 0, 0, 0,
- 0xE141, 0, 0x6D6B, 0xE142, 0xE143, 0x6D6A, 0x3260, 0,
- 0xE144, 0x4676, 0x6D6C, 0x4777, 0, 0x4533, 0xE145, 0x6D6D,
- 0x3D52, 0xE146, 0, 0, 0x6D6F, 0xE147, 0xE148, 0x4C42,
- 0x6D7E, 0x6D71, 0x6D72, 0xE149, 0, 0x4449, 0xE14A, 0,
-};
-const unsigned short utf8_to_euc_E980[] = {
- 0x4260, 0x4177, 0xE14B, 0x4628, 0xE14C, 0x6D70, 0x3555, 0,
- 0xE14D, 0, 0, 0x6D79, 0xE14E, 0x6D76, 0x6E25, 0x4629,
+ 0, 0, 0x6D6B, 0, 0, 0x6D6A, 0x3260, 0,
+ 0, 0x4676, 0x6D6C, 0x4777, 0, 0x4533, 0, 0x6D6D,
+ 0x3D52, 0, 0, 0, 0x6D6F, 0, 0, 0x4C42,
+ 0x6D7E, 0x6D71, 0x6D72, 0, 0, 0x4449, 0, 0,
+};
+unsigned short utf8_to_euc_E980[] = {
+ 0x4260, 0x4177, 0, 0x4628, 0, 0x6D70, 0x3555, 0,
+ 0, 0, 0, 0x6D79, 0, 0x6D76, 0x6E25, 0x4629,
0x4360, 0x6D73, 0, 0x447E, 0x4553, 0x6D74, 0x6D78, 0x3F60,
- 0xE14F, 0x4767, 0x444C, 0xE150, 0, 0x4042, 0x6D77, 0x422E,
+ 0, 0x4767, 0x444C, 0, 0, 0x4042, 0x6D77, 0x422E,
0x4224, 0x6D75, 0x3029, 0x4F22, 0, 0, 0, 0x6D7A,
- 0xE151, 0xE152, 0xE154, 0, 0xE155, 0xE156, 0x4261, 0xE153,
- 0, 0x3D35, 0x3F4A, 0xE157, 0xE158, 0x6D7C, 0x6D7B, 0xE159,
- 0x306F, 0x6D7D, 0, 0, 0x492F, 0, 0x6E27, 0xE15A,
+ 0, 0, 0, 0, 0, 0, 0x4261, 0,
+ 0, 0x3D35, 0x3F4A, 0, 0, 0x6D7C, 0x6D7B, 0,
+ 0x306F, 0x6D7D, 0, 0, 0x492F, 0, 0x6E27, 0,
};
-const unsigned short utf8_to_euc_E981[] = {
- 0, 0x465B, 0x3F6B, 0xE15B, 0xE15C, 0x4359, 0, 0x3678,
- 0, 0x6E26, 0x4D37, 0x313F, 0xE15D, 0x4A57, 0x3261, 0x6E21,
+unsigned short utf8_to_euc_E981[] = {
+ 0, 0x465B, 0x3F6B, 0, 0, 0x4359, 0, 0x3678,
+ 0, 0x6E26, 0x4D37, 0x313F, 0, 0x4A57, 0x3261, 0x6E21,
0x6E22, 0x6E23, 0x6E24, 0x463B, 0x4323, 0x3063, 0x6E28, 0,
- 0x6E29, 0x7423, 0, 0xE15E, 0x423D, 0xE15F, 0x6E2A, 0,
- 0x3173, 0x414C, 0xE160, 0x382F, 0, 0x4D5A, 0xE161, 0xE162,
- 0x6E2B, 0x452C, 0, 0, 0xE163, 0x4178, 0x3C57, 0x6E2C,
- 0xE164, 0, 0x6E2F, 0, 0xE165, 0x3D65, 0x6E2D, 0x412B,
- 0x412A, 0xE166, 0x3064, 0, 0x4E4B, 0x6E31, 0, 0x4872,
-};
-const unsigned short utf8_to_euc_E982[] = {
- 0x6E33, 0x6E32, 0x6E30, 0x6364, 0x3454, 0xE167, 0, 0x6D6E,
- 0xE168, 0x6E35, 0x6E34, 0xE169, 0xE16A, 0, 0xE16B, 0x6E36,
- 0xE16C, 0x4D38, 0, 0, 0, 0xE16D, 0, 0xE16E,
- 0xE16F, 0xE170, 0, 0xE171, 0, 0, 0, 0,
- 0xE172, 0xE173, 0xE174, 0x4661, 0, 0xE175, 0x4B2E, 0,
+ 0x6E29, 0x7423, 0, 0, 0x423D, 0, 0x6E2A, 0,
+ 0x3173, 0x414C, 0, 0x382F, 0, 0x4D5A, 0, 0x7B79,
+ 0x6E2B, 0x452C, 0, 0, 0, 0x4178, 0x3C57, 0x6E2C,
+ 0, 0, 0x6E2F, 0, 0, 0x3D65, 0x6E2D, 0x412B,
+ 0x412A, 0, 0x3064, 0, 0x4E4B, 0x6E31, 0, 0x4872,
+};
+unsigned short utf8_to_euc_E982[] = {
+ 0x6E33, 0x6E32, 0x6E30, 0x6364, 0x3454, 0, 0, 0x6D6E,
+ 0, 0x6E35, 0x6E34, 0, 0, 0, 0, 0x6E36,
+ 0, 0x4D38, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4661, 0, 0, 0x4B2E, 0,
0x6E37, 0, 0x3C59, 0, 0, 0, 0, 0x6E38,
- 0xE176, 0x6E39, 0xE177, 0xE178, 0xE179, 0x6E3A, 0xE17A, 0,
- 0x4521, 0, 0, 0, 0, 0xE17B, 0xE17D, 0,
-};
-const unsigned short utf8_to_euc_E983[] = {
- 0, 0x306A, 0, 0xE17E, 0xE221, 0xE222, 0, 0xE223,
- 0xE224, 0, 0x3959, 0, 0xE17C, 0, 0x4F3A, 0,
- 0, 0, 0xE22D, 0, 0, 0xE225, 0, 0xE226,
- 0xE227, 0xE228, 0, 0x6E3E, 0xE229, 0xE22A, 0xF46C, 0xE22B,
- 0, 0x3734, 0x6E3B, 0, 0x6E3C, 0xE22C, 0, 0,
- 0x4974, 0, 0, 0xE22F, 0, 0x3354, 0, 0xE230,
- 0xE231, 0, 0, 0, 0xE232, 0x4D39, 0xE22E, 0x363F,
- 0, 0, 0, 0, 0, 0x4554, 0xE233, 0xE234,
-};
-const unsigned short utf8_to_euc_E984[] = {
- 0xE235, 0, 0x6E3F, 0, 0xE236, 0xE237, 0xE238, 0,
- 0xE239, 0, 0, 0, 0, 0xE23A, 0, 0,
- 0xE23B, 0, 0x6E40, 0, 0xE23C, 0xF46E, 0xE23D, 0xE23E,
- 0xE23F, 0x6E41, 0xE240, 0, 0xE241, 0, 0xE242, 0,
- 0xE243, 0, 0xE245, 0xE246, 0, 0xE244, 0, 0xE247,
- 0, 0xE248, 0, 0, 0, 0x4522, 0xE249, 0xE24A,
- 0x6E43, 0xE24B, 0x6E42, 0, 0xE24C, 0, 0xE24D, 0xE24E,
- 0, 0xE24F, 0xE250, 0, 0xE251, 0xE252, 0, 0,
-};
-const unsigned short utf8_to_euc_E985[] = {
- 0, 0, 0, 0xE253, 0, 0, 0, 0xE254,
- 0xE255, 0x4653, 0x6E44, 0x3D36, 0x3C60, 0x475B, 0x4371, 0xE256,
- 0, 0, 0x3C72, 0xE257, 0x3F6C, 0, 0x6E45, 0xE258,
- 0x6E46, 0xE259, 0xE25A, 0xE25B, 0, 0, 0, 0,
- 0, 0xE25C, 0x3F5D, 0x6E47, 0xE25D, 0x6E48, 0, 0xE25E,
- 0, 0x6E49, 0x4D6F, 0, 0x3D37, 0xE25F, 0, 0,
- 0, 0, 0x6E4B, 0x6E4A, 0xE260, 0x395A, 0, 0x3973,
- 0x3B40, 0xE261, 0xE262, 0xE263, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E986[] = {
- 0, 0xE264, 0x6E4E, 0xE265, 0, 0xE266, 0xE267, 0x3D66,
- 0, 0x6E4D, 0xE268, 0x6E4C, 0, 0x4269, 0xE269, 0,
- 0x386F, 0xE26A, 0x4043, 0xE26B, 0xE26C, 0xE26D, 0, 0x4830,
- 0xE26E, 0, 0, 0, 0x3D39, 0, 0xE26F, 0,
- 0, 0xE270, 0x6E4F, 0, 0x3E5F, 0, 0xE271, 0,
- 0xE272, 0, 0x6E52, 0x6E50, 0xE273, 0xE274, 0xE275, 0x6E51,
- 0xE276, 0xE277, 0xE278, 0xE279, 0x6E54, 0x6E53, 0xE27A, 0,
- 0x3E7A, 0, 0x6E55, 0xE27B, 0xE27C, 0xE27D, 0, 0xE27E,
-};
-const unsigned short utf8_to_euc_E987[] = {
- 0x6E56, 0x6E57, 0xE321, 0xE322, 0, 0xE323, 0x4850, 0x3A53,
+ 0, 0x6E39, 0, 0, 0, 0x6E3A, 0, 0,
+ 0x4521, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E983[] = {
+ 0, 0x306A, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3959, 0, 0, 0, 0x4F3A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6E3E, 0, 0, 0x7B7A, 0,
+ 0, 0x3734, 0x6E3B, 0, 0x6E3C, 0, 0, 0,
+ 0x4974, 0, 0, 0, 0, 0x3354, 0, 0,
+ 0, 0, 0, 0, 0, 0x4D39, 0, 0x363F,
+ 0, 0, 0, 0, 0, 0x4554, 0, 0,
+};
+unsigned short utf8_to_euc_E984[] = {
+ 0, 0, 0x6E3F, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x6E40, 0, 0, 0x7B7C, 0, 0,
+ 0, 0x6E41, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7B7D,
+ 0, 0, 0, 0, 0, 0x4522, 0, 0,
+ 0x6E43, 0, 0x6E42, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E985[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x4653, 0x6E44, 0x3D36, 0x3C60, 0x475B, 0x4371, 0,
+ 0, 0, 0x3C72, 0, 0x3F6C, 0, 0x6E45, 0,
+ 0x6E46, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x3F5D, 0x6E47, 0, 0x6E48, 0, 0,
+ 0, 0x6E49, 0x4D6F, 0, 0x3D37, 0, 0, 0,
+ 0, 0, 0x6E4B, 0x6E4A, 0, 0x395A, 0, 0x3973,
+ 0x3B40, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E986[] = {
+ 0, 0, 0x6E4E, 0, 0, 0, 0, 0x3D66,
+ 0, 0x6E4D, 0, 0x6E4C, 0, 0x4269, 0, 0,
+ 0x386F, 0, 0x4043, 0, 0, 0, 0, 0x4830,
+ 0, 0, 0, 0, 0x3D39, 0, 0, 0,
+ 0, 0, 0x6E4F, 0, 0x3E5F, 0, 0, 0,
+ 0, 0, 0x6E52, 0x6E50, 0, 0, 0, 0x6E51,
+ 0, 0, 0, 0, 0x6E54, 0x6E53, 0, 0,
+ 0x3E7A, 0, 0x6E55, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E987[] = {
+ 0x6E56, 0x6E57, 0, 0, 0, 0, 0x4850, 0x3A53,
0x3C61, 0x6E58, 0, 0x6E59, 0x4E24, 0x3D45, 0x4C6E, 0x4E4C,
- 0x6E5A, 0x3662, 0, 0xE324, 0xE325, 0, 0x6E5B, 0xE326,
- 0x4523, 0xE327, 0xE328, 0x6E5E, 0x3378, 0x3F4B, 0xE329, 0x6E5C,
- 0, 0x6E5D, 0, 0x4460, 0xE32A, 0xE32B, 0x4B55, 0x367C,
- 0, 0xE32C, 0xE32D, 0, 0xE32E, 0xE32F, 0xE330, 0xE331,
- 0xE332, 0xE333, 0, 0, 0, 0x6E60, 0x6E61, 0xE334,
- 0, 0xE335, 0, 0xE336, 0x6E5F, 0xE337, 0, 0x6E63,
-};
-const unsigned short utf8_to_euc_E988[] = {
- 0xE338, 0xE339, 0, 0, 0xE33A, 0xE33B, 0xE33C, 0xE33D,
- 0, 0xE33E, 0xE33F, 0, 0xE340, 0x465F, 0x3343, 0,
- 0xE341, 0x6E67, 0xE342, 0xE343, 0x6E64, 0x6E66, 0xE344, 0,
- 0xE345, 0, 0, 0, 0xE346, 0xE347, 0x6E62, 0,
- 0, 0, 0, 0xE348, 0xE349, 0xE34A, 0xE34B, 0,
- 0xE34C, 0x6F4F, 0, 0, 0x6E65, 0, 0xE34D, 0xE34E,
- 0xE34F, 0, 0, 0xE350, 0x4E6B, 0xE351, 0xE352, 0x385A,
- 0xE353, 0xE354, 0xE355, 0, 0xE356, 0, 0xE357, 0x6E6F,
-};
-const unsigned short utf8_to_euc_E989[] = {
- 0xE358, 0, 0xE359, 0xE35A, 0x4534, 0x6E6A, 0xE35B, 0xE35C,
- 0x6E6D, 0x6E6B, 0xE35D, 0x6E70, 0, 0xE35E, 0xE35F, 0xE360,
- 0x6E71, 0xE361, 0, 0, 0, 0, 0, 0x6E69,
- 0xE362, 0xE363, 0x6E76, 0x3174, 0xE364, 0xE365, 0x6E68, 0,
- 0xE366, 0xE367, 0x482D, 0, 0x6E6C, 0xE368, 0x3E60, 0xE369,
- 0xE36A, 0xE36B, 0, 0, 0, 0, 0xE36C, 0xE36D,
- 0xE36E, 0x395B, 0, 0, 0, 0xE36F, 0xE370, 0xE371,
- 0xE372, 0xE373, 0, 0xE374, 0xE375, 0xE376, 0x4B48, 0xE377,
-};
-const unsigned short utf8_to_euc_E98A[] = {
+ 0x6E5A, 0x3662, 0, 0, 0, 0, 0x6E5B, 0x7C21,
+ 0x4523, 0, 0x7B7E, 0x6E5E, 0x3378, 0x3F4B, 0x7C22, 0x6E5C,
+ 0, 0x6E5D, 0, 0x4460, 0x7C25, 0x7C26, 0x4B55, 0x367C,
+ 0, 0, 0, 0, 0, 0x7C23, 0x7C24, 0,
+ 0, 0, 0, 0, 0, 0x6E60, 0x6E61, 0,
+ 0, 0, 0, 0, 0x6E5F, 0, 0, 0x6E63,
+};
+unsigned short utf8_to_euc_E988[] = {
+ 0, 0, 0, 0, 0, 0, 0x7C27, 0,
+ 0, 0, 0x7C29, 0, 0, 0x465F, 0x3343, 0,
+ 0x7C28, 0x6E67, 0, 0, 0x6E64, 0x6E66, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x6E62, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6F4F, 0, 0, 0x6E65, 0, 0, 0,
+ 0, 0, 0, 0, 0x4E6B, 0, 0, 0x385A,
+ 0, 0x7C30, 0x7C2A, 0, 0x7C2C, 0, 0, 0x6E6F,
+};
+unsigned short utf8_to_euc_E989[] = {
+ 0x7C2B, 0, 0, 0, 0x4534, 0x6E6A, 0, 0,
+ 0x6E6D, 0x6E6B, 0, 0x6E70, 0, 0, 0x7C2D, 0,
+ 0x6E71, 0x7C2F, 0, 0, 0, 0, 0, 0x6E69,
+ 0, 0x7C2E, 0x6E76, 0x3174, 0, 0, 0x6E68, 0,
+ 0, 0, 0x482D, 0, 0x6E6C, 0, 0x3E60, 0x7C31,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x395B, 0, 0, 0, 0, 0, 0x7C33,
+ 0x7C34, 0, 0, 0, 0, 0, 0x4B48, 0,
+};
+unsigned short utf8_to_euc_E98A[] = {
0x3664, 0, 0, 0x3D46, 0, 0x463C, 0, 0,
- 0xE378, 0xE379, 0xE37A, 0, 0, 0xE37B, 0xE37C, 0,
- 0, 0x412D, 0xE37D, 0x6E74, 0, 0x6E6E, 0x6E73, 0xE37E,
- 0x4C43, 0xE421, 0x4438, 0x6E75, 0x6E72, 0, 0, 0xE422,
- 0xE423, 0, 0, 0, 0xE424, 0xE425, 0, 0xE426,
- 0xE427, 0, 0, 0xE428, 0, 0x412C, 0, 0xE429,
- 0, 0, 0xE42A, 0, 0, 0, 0xE42B, 0x6E79,
- 0xE42C, 0x6E78, 0xE42D, 0xE42E, 0xE42F, 0xE430, 0, 0xE431,
-};
-const unsigned short utf8_to_euc_E98B[] = {
- 0xE432, 0xE433, 0xE434, 0xE435, 0, 0xE436, 0xE437, 0xE438,
- 0xE439, 0, 0, 0xE43A, 0xE43B, 0xE43C, 0xE43D, 0x6E77,
- 0xE43E, 0, 0x4B2F, 0xE43F, 0, 0xE440, 0, 0xE441,
- 0xE442, 0xE443, 0, 0, 0xE444, 0xE445, 0, 0xE446,
- 0xE447, 0xE448, 0, 0xE449, 0x3D7B, 0xE44A, 0, 0xE44B,
- 0xE44C, 0x6E7A, 0x4A5F, 0, 0xE44D, 0x3154, 0xE44E, 0,
- 0xE44F, 0, 0x4946, 0x4372, 0, 0, 0, 0,
- 0x3578, 0xE450, 0x6E7C, 0xE451, 0x395D, 0, 0, 0xE452,
-};
-const unsigned short utf8_to_euc_E98C[] = {
- 0xE453, 0, 0xE454, 0, 0, 0, 0x3B2C, 0,
- 0xE455, 0, 0, 0, 0, 0xE456, 0, 0x6E7B,
- 0x3F6D, 0xE457, 0, 0, 0xE458, 0xE459, 0, 0,
- 0x3F6E, 0x6F21, 0x6F23, 0, 0xE45A, 0xE45B, 0xE45C, 0xE45D,
- 0x3E7B, 0xE45E, 0x6F22, 0x6F24, 0xE45F, 0xE460, 0x3653, 0xE461,
- 0x4945, 0xE462, 0xE463, 0x3C62, 0x4F23, 0, 0x6E7E, 0x3A78,
- 0, 0, 0x4F3F, 0xE464, 0xE465, 0x6F26, 0xE466, 0xE467,
+ 0x7924, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x412D, 0, 0x6E74, 0, 0x6E6E, 0x6E73, 0,
+ 0x4C43, 0, 0x4438, 0x6E75, 0x6E72, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7C32,
+ 0, 0, 0, 0, 0, 0x412C, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6E79,
+ 0, 0x6E78, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E98B[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6E77,
+ 0x7C38, 0, 0x4B2F, 0x7C3C, 0, 0x7C3A, 0, 0x7C36,
+ 0, 0x7C37, 0, 0, 0, 0, 0, 0,
+ 0x7C3B, 0, 0, 0, 0x3D7B, 0, 0, 0x7C35,
+ 0, 0x6E7A, 0x4A5F, 0, 0, 0x3154, 0, 0,
+ 0, 0, 0x4946, 0x4372, 0, 0, 0, 0,
+ 0x3578, 0x792A, 0x6E7C, 0x7C3F, 0x395D, 0, 0, 0x7C42,
+};
+unsigned short utf8_to_euc_E98C[] = {
+ 0, 0, 0x7C44, 0, 0, 0, 0x3B2C, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x6E7B,
+ 0x3F6D, 0, 0, 0, 0, 0, 0, 0,
+ 0x3F6E, 0x6F21, 0x6F23, 0, 0, 0x7C43, 0x7C41, 0,
+ 0x3E7B, 0x7C3E, 0x6F22, 0x6F24, 0, 0x7C3D, 0x3653, 0,
+ 0x4945, 0, 0, 0x3C62, 0x4F23, 0, 0x6E7E, 0x3A78,
+ 0, 0, 0x4F3F, 0, 0, 0x6F26, 0, 0,
0, 0, 0x6F25, 0x6F27, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E98D[] = {
- 0, 0, 0, 0, 0x6E7D, 0, 0, 0xE468,
- 0xE469, 0xE46A, 0, 0x4669, 0, 0x4555, 0, 0,
- 0xE46B, 0xE46C, 0xE46D, 0, 0x4457, 0xE46E, 0x6F2C, 0xE46F,
- 0xE470, 0, 0xE471, 0x4343, 0x6F28, 0, 0xE472, 0,
- 0x6F29, 0, 0, 0, 0xE473, 0xE474, 0, 0xE475,
- 0, 0xE476, 0xE477, 0, 0x372D, 0xE478, 0x6F2B, 0xE479,
- 0xE47A, 0xE47B, 0, 0xE47C, 0xE47D, 0x3830, 0xE47E, 0,
- 0, 0, 0xE521, 0, 0x6F2A, 0xE522, 0x3E61, 0xE523,
-};
-const unsigned short utf8_to_euc_E98E[] = {
- 0xE524, 0xE525, 0xE526, 0, 0, 0, 0, 0,
- 0xE527, 0, 0xE528, 0xE529, 0x3379, 0xE52A, 0, 0xE52B,
- 0, 0, 0xE52C, 0, 0x6F30, 0xE52D, 0x3A3F, 0x4179,
- 0xE52E, 0, 0x444A, 0xE52F, 0, 0, 0xE530, 0,
- 0, 0xE531, 0, 0xE532, 0xE533, 0, 0xE534, 0x333B,
- 0xE535, 0xE53B, 0, 0xE536, 0x6F2E, 0x6F2F, 0x4443, 0,
- 0x6F2D, 0, 0, 0, 0xE537, 0xE538, 0xE539, 0,
- 0, 0x6F31, 0xE53A, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E98F[] = {
- 0, 0xE53C, 0, 0x6F37, 0xE53D, 0xE53E, 0xE53F, 0xE540,
- 0x6F3A, 0xE541, 0xE542, 0xE543, 0xE544, 0xE545, 0, 0,
- 0x6F39, 0x452D, 0, 0xE546, 0, 0, 0x6F32, 0x6F33,
- 0x6F36, 0xE547, 0, 0, 0xE548, 0x6F38, 0xE549, 0xE54A,
- 0, 0x3640, 0xE54B, 0, 0x6F3B, 0x6F35, 0xE54C, 0xE54D,
+unsigned short utf8_to_euc_E98D[] = {
+ 0, 0, 0, 0, 0x6E7D, 0, 0, 0,
+ 0x7923, 0, 0, 0x4669, 0, 0x4555, 0, 0,
+ 0, 0, 0, 0, 0x4457, 0, 0x6F2C, 0x7C46,
+ 0, 0, 0, 0x4343, 0x6F28, 0, 0, 0,
+ 0x6F29, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x372D, 0, 0x6F2B, 0,
+ 0x7C45, 0, 0, 0, 0, 0x3830, 0, 0,
+ 0, 0, 0, 0, 0x6F2A, 0, 0x3E61, 0,
+};
+unsigned short utf8_to_euc_E98E[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x3379, 0, 0, 0,
+ 0, 0, 0, 0, 0x6F30, 0, 0x3A3F, 0x4179,
+ 0, 0, 0x444A, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x7C47, 0, 0, 0x333B,
+ 0, 0, 0, 0, 0x6F2E, 0x6F2F, 0x4443, 0,
+ 0x6F2D, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x6F31, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E98F[] = {
+ 0, 0, 0, 0x6F37, 0, 0, 0x7C48, 0,
+ 0x6F3A, 0, 0, 0, 0, 0, 0, 0,
+ 0x6F39, 0x452D, 0, 0, 0, 0, 0x6F32, 0x6F33,
+ 0x6F36, 0, 0, 0, 0, 0x6F38, 0x7C49, 0,
+ 0, 0x3640, 0, 0, 0x6F3B, 0x6F35, 0, 0,
0x6F34, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xE54F,
- 0xE550, 0xE54E, 0xE551, 0xE552, 0, 0xE553, 0, 0,
-};
-const unsigned short utf8_to_euc_E990[] = {
- 0, 0xE554, 0xE555, 0x6F3F, 0xE556, 0, 0, 0x6F40,
- 0xE557, 0xE558, 0, 0, 0, 0xE559, 0xE55A, 0xE55B,
- 0x6F41, 0, 0, 0x6F3E, 0x6F3D, 0xE55C, 0xE55D, 0xE55E,
- 0x3E62, 0x462A, 0x6F3C, 0, 0, 0, 0, 0xE55F,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7C4A, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E990[] = {
+ 0, 0, 0, 0x6F3F, 0, 0, 0, 0x6F40,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x6F41, 0, 0, 0x6F3E, 0x6F3D, 0, 0, 0,
+ 0x3E62, 0x462A, 0x6F3C, 0, 0, 0, 0, 0,
0, 0x6F45, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x6F43, 0, 0, 0xE560, 0xE561,
- 0, 0xE562, 0xE563, 0xE564, 0xE565, 0x6F44, 0x6F42, 0,
- 0x4278, 0, 0x6F46, 0xE566, 0, 0xE568, 0, 0xE567,
-};
-const unsigned short utf8_to_euc_E991[] = {
- 0, 0x6F47, 0, 0xE569, 0x6F49, 0xE56A, 0, 0,
- 0xE56B, 0, 0xE56C, 0, 0xE56D, 0, 0, 0,
- 0, 0x3455, 0x6F48, 0x4C7A, 0, 0xE56E, 0, 0,
- 0, 0xE56F, 0x6F54, 0x6F4A, 0xE570, 0, 0x6F4D, 0xE571,
- 0x6F4B, 0xE572, 0x6F4C, 0xE573, 0, 0, 0, 0,
- 0xE574, 0, 0x6F4E, 0xE575, 0, 0xE576, 0xE577, 0xE578,
- 0x6F50, 0xE579, 0xE57A, 0, 0, 0x6F51, 0, 0x6F52,
+ 0, 0, 0, 0x6F43, 0, 0, 0, 0,
+ 0, 0x7C4B, 0, 0, 0, 0x6F44, 0x6F42, 0,
+ 0x4278, 0, 0x6F46, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E991[] = {
+ 0, 0x6F47, 0, 0, 0x6F49, 0x7C4C, 0, 0,
+ 0x7C4D, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x3455, 0x6F48, 0x4C7A, 0, 0, 0, 0,
+ 0, 0, 0x6F54, 0x6F4A, 0, 0, 0x6F4D, 0,
+ 0x6F4B, 0, 0x6F4C, 0, 0, 0, 0, 0,
+ 0, 0, 0x6F4E, 0, 0, 0, 0, 0,
+ 0x6F50, 0, 0, 0, 0, 0x6F51, 0, 0x6F52,
0, 0, 0, 0, 0x6F55, 0x6F53, 0x6F56, 0x6F58,
};
-const unsigned short utf8_to_euc_E992[] = {
- 0, 0x6F57, 0, 0xE57C, 0xE57B, 0, 0, 0,
+unsigned short utf8_to_euc_E992[] = {
+ 0, 0x6F57, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5627,7 +4510,7 @@ const unsigned short utf8_to_euc_E992[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E995[] = {
+unsigned short utf8_to_euc_E995[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5635,349 +4518,349 @@ const unsigned short utf8_to_euc_E995[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x4439,
- 0xE57D, 0xE57E, 0, 0, 0, 0, 0xE621, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E996[] = {
- 0x4C67, 0, 0x6F59, 0x412E, 0xE622, 0, 0, 0x6F5A,
- 0xE623, 0x4A44, 0x6F5B, 0x332B, 0xE624, 0xE625, 0xE626, 0x313C,
- 0, 0x3457, 0xF471, 0x3456, 0x6F5C, 0, 0x6F5D, 0,
- 0x6F5E, 0x6F5F, 0, 0, 0, 0xE627, 0xE628, 0xE629,
- 0x6F60, 0xE62A, 0x3458, 0x3355, 0x395E, 0x4836, 0xE62B, 0x6F62,
- 0x6F61, 0xE62C, 0, 0xE62D, 0xE62E, 0x6F63, 0, 0,
- 0, 0, 0x315C, 0, 0xE62F, 0, 0xE630, 0,
- 0, 0x6F66, 0xE631, 0x6F65, 0x6F64, 0xE632, 0x6F67, 0xE633,
+unsigned short utf8_to_euc_E996[] = {
+ 0x4C67, 0, 0x6F59, 0x412E, 0, 0, 0, 0x6F5A,
+ 0, 0x4A44, 0x6F5B, 0x332B, 0, 0, 0, 0x313C,
+ 0, 0x3457, 0x7C4E, 0x3456, 0x6F5C, 0, 0x6F5D, 0,
+ 0x6F5E, 0x6F5F, 0, 0, 0, 0, 0, 0,
+ 0x6F60, 0, 0x3458, 0x3355, 0x395E, 0x4836, 0, 0x6F62,
+ 0x6F61, 0, 0, 0, 0, 0x6F63, 0, 0,
+ 0, 0, 0x315C, 0, 0, 0, 0, 0,
+ 0, 0x6F66, 0, 0x6F65, 0x6F64, 0, 0x6F67, 0,
};
-const unsigned short utf8_to_euc_E997[] = {
- 0, 0, 0, 0x6F6A, 0, 0, 0xE634, 0x3047,
- 0xE635, 0xE636, 0x6F68, 0xE637, 0x6F6C, 0x6F6B, 0, 0,
- 0xE638, 0xE639, 0xE63A, 0xE63B, 0x6F6E, 0x6F6D, 0x6F6F, 0,
- 0x462E, 0xE63C, 0xE63D, 0, 0x6F70, 0xE63E, 0xE63F, 0xE640,
- 0xE641, 0x6F71, 0x6F73, 0, 0xE642, 0x6F72, 0xE643, 0,
+unsigned short utf8_to_euc_E997[] = {
+ 0, 0, 0, 0x6F6A, 0, 0, 0, 0x3047,
+ 0, 0, 0x6F68, 0, 0x6F6C, 0x6F6B, 0, 0,
+ 0, 0, 0, 0, 0x6F6E, 0x6F6D, 0x6F6F, 0,
+ 0x462E, 0, 0, 0, 0x6F70, 0, 0, 0,
+ 0, 0x6F71, 0x6F73, 0, 0, 0x6F72, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E998[] = {
+unsigned short utf8_to_euc_E998[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0x496C, 0xE644, 0xE645, 0,
- 0, 0x6F74, 0xE646, 0, 0xE647, 0xE648, 0xE649, 0,
- 0x6F75, 0, 0x3A65, 0, 0xE64A, 0, 0x6F76, 0x6F77,
- 0, 0xE64B, 0x4B49, 0xE64C, 0, 0, 0, 0xE64D,
- 0xE64E, 0xE64F, 0xE650, 0x414B, 0xE651, 0xE652, 0, 0x3024,
+ 0, 0, 0, 0, 0x496C, 0, 0, 0,
+ 0, 0x6F74, 0, 0, 0, 0, 0, 0,
+ 0x6F75, 0, 0x3A65, 0, 0, 0, 0x6F76, 0x6F77,
+ 0, 0, 0x4B49, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x414B, 0, 0, 0, 0x3024,
};
-const unsigned short utf8_to_euc_E999[] = {
- 0x424B, 0xE653, 0x6F78, 0, 0x496D, 0, 0, 0,
+unsigned short utf8_to_euc_E999[] = {
+ 0x424B, 0, 0x6F78, 0, 0x496D, 0, 0, 0,
0, 0, 0, 0x6F7B, 0x6F79, 0x395F, 0, 0x6F7A,
- 0x3842, 0, 0xE654, 0, 0xE655, 0, 0xE656, 0xE657,
- 0xE658, 0, 0, 0x4A45, 0x6F7D, 0x7021, 0x6F7E, 0x7022,
- 0, 0xE659, 0x3121, 0x3F58, 0x3D7C, 0x3459, 0x7023, 0,
- 0, 0, 0x4766, 0, 0x7025, 0, 0xE65A, 0,
- 0x3122, 0, 0x7024, 0x4444, 0xE65B, 0x4E4D, 0x462B, 0x6F7C,
- 0x4E26, 0, 0x3831, 0xE65C, 0xE65D, 0x4D5B, 0xE65E, 0xE65F,
-};
-const unsigned short utf8_to_euc_E99A[] = {
- 0, 0xE660, 0xE661, 0xE662, 0xE663, 0x3679, 0x4E34, 0,
- 0x3728, 0xE664, 0x4262, 0x6721, 0, 0x7026, 0x332C, 0x3F6F,
- 0, 0xE665, 0, 0, 0x3356, 0x7028, 0xE666, 0x7029,
- 0x7027, 0x3764, 0xE667, 0x3A5D, 0x3E63, 0xE668, 0, 0xE669,
- 0x3123, 0, 0, 0x4E59, 0xE66A, 0xE66B, 0xE66C, 0x702B,
- 0x6E2E, 0xE66D, 0x702A, 0, 0, 0, 0xE66E, 0xE66F,
- 0x702E, 0x702C, 0x702D, 0xE670, 0x702F, 0, 0x7030, 0x4E6C,
- 0x7031, 0x7032, 0xE671, 0x4049, 0x483B, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E99B[] = {
+ 0x3842, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4A45, 0x6F7D, 0x7021, 0x6F7E, 0x7022,
+ 0, 0, 0x3121, 0x3F58, 0x3D7C, 0x3459, 0x7023, 0,
+ 0, 0, 0x4766, 0, 0x7025, 0, 0, 0,
+ 0x3122, 0, 0x7024, 0x4444, 0, 0x4E4D, 0x462B, 0x6F7C,
+ 0x4E26, 0, 0x3831, 0, 0, 0x4D5B, 0, 0,
+};
+unsigned short utf8_to_euc_E99A[] = {
+ 0, 0, 0, 0, 0, 0x3679, 0x4E34, 0,
+ 0x3728, 0, 0x4262, 0x6721, 0, 0x7026, 0x332C, 0x3F6F,
+ 0, 0, 0, 0, 0x3356, 0x7028, 0, 0x7029,
+ 0x7027, 0x3764, 0, 0x3A5D, 0x3E63, 0x7C51, 0, 0,
+ 0x3123, 0, 0, 0x4E59, 0, 0, 0, 0x702B,
+ 0x6E2E, 0, 0x702A, 0, 0, 0, 0, 0x7C52,
+ 0x702E, 0x702C, 0x702D, 0, 0x702F, 0, 0x7030, 0x4E6C,
+ 0x7031, 0x7032, 0, 0x4049, 0x483B, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E99B[] = {
0x3F7D, 0x3467, 0, 0, 0x4D3A, 0x326D, 0x3D38, 0x385B,
- 0, 0x7035, 0xE672, 0x7034, 0x3B73, 0x7036, 0x7033, 0,
- 0, 0x3B28, 0xE673, 0, 0, 0x703A, 0x6A2D, 0,
- 0xE675, 0x5256, 0xE676, 0x3F77, 0x7038, 0xE677, 0xE678, 0xE679,
+ 0, 0x7035, 0, 0x7034, 0x3B73, 0x7036, 0x7033, 0,
+ 0, 0x3B28, 0, 0, 0, 0x703A, 0x6A2D, 0,
+ 0, 0x5256, 0, 0x3F77, 0x7038, 0, 0, 0,
0, 0, 0x4E25, 0x4671, 0, 0, 0, 0,
- 0x312B, 0xE67A, 0x4063, 0x3C36, 0, 0, 0, 0xE67B,
- 0x4A37, 0xE67C, 0x3140, 0, 0, 0, 0x4E6D, 0x4D6B,
- 0, 0x703B, 0xE67D, 0x4545, 0, 0, 0, 0,
+ 0x312B, 0, 0x4063, 0x3C36, 0, 0, 0, 0,
+ 0x4A37, 0, 0x3140, 0, 0, 0, 0x4E6D, 0x4D6B,
+ 0, 0x703B, 0, 0x4545, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E99C[] = {
- 0x3C7B, 0, 0xE67E, 0xE721, 0x703C, 0xE722, 0x703D, 0x3F4C,
- 0x703E, 0xE723, 0x4E6E, 0, 0, 0x7039, 0x7040, 0x7042,
+unsigned short utf8_to_euc_E99C[] = {
+ 0x3C7B, 0, 0, 0, 0x703C, 0, 0x703D, 0x3F4C,
+ 0x703E, 0, 0x4E6E, 0, 0, 0x7039, 0x7040, 0x7042,
0, 0x7041, 0, 0x703F, 0, 0, 0x7043, 0,
- 0, 0x7044, 0xE724, 0xE725, 0x417A, 0xE726, 0x3262, 0,
- 0, 0xE727, 0xE728, 0xE729, 0x7045, 0, 0, 0x4C38,
- 0xE72A, 0, 0x7046, 0, 0, 0, 0, 0,
- 0x7047, 0xE72B, 0x4F2A, 0xE72C, 0, 0, 0, 0,
- 0x5B31, 0x7048, 0, 0xF474, 0, 0x7049, 0x704A, 0,
-};
-const unsigned short utf8_to_euc_E99D[] = {
- 0, 0xE72D, 0x704E, 0xE72E, 0x704B, 0, 0x704C, 0,
- 0x704D, 0x704F, 0xE72F, 0, 0, 0xF475, 0xE730, 0xE731,
- 0, 0xF476, 0x4044, 0, 0, 0xE732, 0x4C77, 0xE733,
- 0xE734, 0x4045, 0xE735, 0xE736, 0x7050, 0, 0x4873, 0,
- 0x7051, 0x7353, 0x4C4C, 0xE737, 0x7052, 0, 0x7053, 0xE738,
- 0x7054, 0x3357, 0xE739, 0x7056, 0, 0x3F59, 0xE73A, 0,
- 0, 0x7057, 0, 0xE73B, 0x3724, 0, 0xE73C, 0xE73D,
- 0xE73E, 0x7058, 0x705C, 0xE73F, 0x705A, 0xE740, 0, 0xE741,
-};
-const unsigned short utf8_to_euc_E99E[] = {
- 0xE742, 0x705B, 0, 0, 0x3373, 0x7059, 0x705D, 0,
- 0, 0xE743, 0, 0x705E, 0, 0x3048, 0, 0x705F,
- 0x7060, 0, 0, 0, 0, 0xE744, 0xE745, 0xE746,
- 0x3E64, 0xE747, 0xE748, 0, 0x7061, 0, 0xE749, 0xE74A,
- 0x3547, 0, 0xE74B, 0x7064, 0, 0, 0x7063, 0,
- 0x7062, 0, 0, 0x6B71, 0xE74C, 0x4A5C, 0xE74D, 0,
- 0, 0xE74E, 0xE74F, 0x7065, 0x7066, 0xE750, 0xE751, 0,
- 0xE752, 0xE753, 0xE754, 0, 0xE755, 0, 0xE756, 0xE757,
-};
-const unsigned short utf8_to_euc_E99F[] = {
- 0, 0xE758, 0, 0x7067, 0xE759, 0xE75A, 0x7068, 0xE75B,
- 0x7069, 0xE75C, 0xE75D, 0x706A, 0xE75E, 0xE75F, 0xE760, 0,
- 0xE761, 0xE762, 0, 0x345A, 0xE763, 0, 0, 0xE764,
- 0xE765, 0xE766, 0, 0xE76A, 0x706B, 0xE767, 0xE768, 0,
- 0xE769, 0xE76B, 0, 0, 0xE76C, 0, 0, 0,
- 0, 0, 0, 0, 0, 0x706C, 0x4723, 0xE76D,
- 0, 0xE76E, 0x706E, 0x323B, 0xE76F, 0x7071, 0x7070, 0xE770,
- 0xE771, 0, 0xE772, 0x3124, 0, 0, 0, 0x3641,
-};
-const unsigned short utf8_to_euc_E9A0[] = {
- 0, 0x4A47, 0x443A, 0x3A22, 0, 0x3960, 0x3D67, 0xE773,
- 0x3F5C, 0, 0xE774, 0, 0x7073, 0xE776, 0xE777, 0x7072,
- 0x4D42, 0x3468, 0x4852, 0x465C, 0xE778, 0, 0xE779, 0x3F7C,
- 0x4E4E, 0xE775, 0x375B, 0, 0xE77A, 0, 0xE77B, 0,
- 0xE77C, 0x7076, 0, 0xE77D, 0x7075, 0xE828, 0xE77E, 0,
- 0, 0, 0, 0xE821, 0x4B4B, 0x462C, 0xE822, 0xE823,
- 0xE824, 0, 0xE825, 0xE826, 0x3150, 0xE827, 0, 0x7077,
- 0x7074, 0, 0, 0x4951, 0x4D6A, 0x7078, 0xE829, 0,
-};
-const unsigned short utf8_to_euc_E9A1[] = {
- 0, 0, 0, 0, 0xE82A, 0, 0x7079, 0xE82B,
- 0, 0, 0xE82C, 0x707B, 0x426A, 0x335B, 0x335C, 0x707A,
- 0, 0xE82D, 0xE82E, 0xE82F, 0x3469, 0x3832, 0xE830, 0xE831,
- 0x346A, 0xE832, 0xE833, 0x453F, 0, 0, 0x4E60, 0,
- 0, 0, 0xE834, 0xE835, 0, 0xE836, 0xE837, 0x385C,
- 0, 0, 0xE838, 0x707C, 0xE839, 0, 0, 0x707D,
+ 0, 0x7044, 0, 0, 0x417A, 0, 0x3262, 0,
+ 0, 0, 0, 0, 0x7045, 0, 0, 0x4C38,
+ 0, 0, 0x7046, 0, 0, 0, 0, 0,
+ 0x7047, 0, 0x4F2A, 0x7C53, 0, 0, 0, 0,
+ 0x5B31, 0x7048, 0, 0x7C54, 0, 0x7049, 0x704A, 0,
+};
+unsigned short utf8_to_euc_E99D[] = {
+ 0, 0, 0x704E, 0x7C55, 0x704B, 0, 0x704C, 0,
+ 0x704D, 0x704F, 0, 0, 0, 0x7C56, 0, 0x7C57,
+ 0, 0x7C58, 0x4044, 0, 0, 0x7C59, 0x4C77, 0,
+ 0, 0x4045, 0, 0, 0x7050, 0, 0x4873, 0,
+ 0x7051, 0x7353, 0x4C4C, 0, 0x7052, 0, 0x7053, 0,
+ 0x7054, 0x3357, 0, 0x7056, 0, 0x3F59, 0, 0,
+ 0, 0x7057, 0, 0, 0x3724, 0, 0, 0,
+ 0, 0x7058, 0x705C, 0, 0x705A, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E99E[] = {
+ 0, 0x705B, 0, 0, 0x3373, 0x7059, 0x705D, 0,
+ 0, 0, 0, 0x705E, 0, 0x3048, 0, 0x705F,
+ 0x7060, 0, 0, 0, 0, 0, 0, 0,
+ 0x3E64, 0, 0, 0, 0x7061, 0, 0, 0,
+ 0x3547, 0, 0, 0x7064, 0, 0, 0x7063, 0,
+ 0x7062, 0, 0, 0x6B71, 0, 0x4A5C, 0, 0,
+ 0, 0, 0, 0x7065, 0x7066, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E99F[] = {
+ 0, 0, 0, 0x7067, 0, 0, 0x7068, 0,
+ 0x7069, 0, 0, 0x706A, 0, 0, 0, 0,
+ 0, 0, 0, 0x345A, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x706B, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x706C, 0x4723, 0,
+ 0, 0, 0x706E, 0x323B, 0, 0x7071, 0x7070, 0,
+ 0, 0, 0, 0x3124, 0, 0, 0, 0x3641,
+};
+unsigned short utf8_to_euc_E9A0[] = {
+ 0, 0x4A47, 0x443A, 0x3A22, 0, 0x3960, 0x3D67, 0,
+ 0x3F5C, 0, 0, 0, 0x7073, 0, 0, 0x7072,
+ 0x4D42, 0x3468, 0x4852, 0x465C, 0, 0, 0, 0x3F7C,
+ 0x4E4E, 0, 0x375B, 0, 0, 0, 0, 0,
+ 0, 0x7076, 0, 0, 0x7075, 0, 0, 0,
+ 0, 0, 0, 0, 0x4B4B, 0x462C, 0, 0,
+ 0, 0, 0, 0, 0x3150, 0, 0, 0x7077,
+ 0x7074, 0, 0, 0x4951, 0x4D6A, 0x7078, 0, 0,
+};
+unsigned short utf8_to_euc_E9A1[] = {
+ 0, 0, 0, 0, 0, 0, 0x7079, 0,
+ 0, 0, 0, 0x707B, 0x426A, 0x335B, 0x335C, 0x707A,
+ 0, 0, 0, 0, 0x3469, 0x3832, 0, 0x7C5A,
+ 0x346A, 0, 0, 0x453F, 0, 0, 0x4E60, 0,
+ 0, 0, 0, 0, 0, 0x7C5B, 0, 0x385C,
+ 0, 0, 0, 0x707C, 0, 0, 0, 0x707D,
0x707E, 0x7121, 0, 0x7123, 0x7122, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9A2[] = {
+unsigned short utf8_to_euc_E9A2[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0x4977, 0, 0x7124, 0xE83A, 0, 0xE83B, 0xE83C, 0x7125,
- 0xE83D, 0x7126, 0, 0, 0xE83E, 0, 0x7127, 0xE83F,
- 0xE840, 0, 0xE841, 0xE842, 0, 0, 0, 0xE843,
+ 0x4977, 0, 0x7124, 0, 0, 0, 0, 0x7125,
+ 0, 0x7126, 0, 0, 0, 0, 0x7127, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9A3[] = {
- 0, 0, 0xE844, 0x7129, 0x7128, 0xE845, 0x712A, 0,
- 0xE846, 0, 0, 0, 0xE847, 0, 0, 0,
+unsigned short utf8_to_euc_E9A3[] = {
+ 0, 0, 0, 0x7129, 0x7128, 0, 0x712A, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x4874, 0x664C, 0, 0, 0x3F29,
- 0, 0xE848, 0x3532, 0xE849, 0, 0xE84A, 0xE84B, 0xE84C,
- 0, 0x712B, 0xE84D, 0x712C, 0, 0x522C, 0x5D3B, 0x4853,
- 0, 0, 0x307B, 0xE84E, 0x303B, 0, 0xE84F, 0,
+ 0, 0, 0x3532, 0, 0, 0, 0, 0,
+ 0, 0x712B, 0, 0x712C, 0, 0x522C, 0x5D3B, 0x4853,
+ 0, 0, 0x307B, 0, 0x303B, 0, 0, 0,
0, 0, 0, 0, 0x3B74, 0x4B30, 0x3E7E, 0,
};
-const unsigned short utf8_to_euc_E9A4[] = {
- 0, 0, 0xE850, 0x712D, 0, 0x4C5F, 0, 0xE851,
- 0xE852, 0x712E, 0x4D5C, 0, 0x3142, 0, 0, 0,
- 0x3B41, 0xE853, 0x712F, 0x326E, 0x7130, 0xE854, 0xE855, 0xE856,
- 0x7131, 0, 0xE857, 0xE858, 0xE859, 0x7133, 0x7134, 0xE85A,
- 0x7136, 0x7132, 0xE85B, 0, 0x7135, 0, 0xE85C, 0xE85D,
- 0x345B, 0, 0, 0xE85E, 0x7137, 0, 0x7138, 0,
- 0, 0xE85F, 0xE860, 0xE861, 0xE862, 0xE863, 0, 0,
- 0, 0xE864, 0xE865, 0xE866, 0xE867, 0x7139, 0x713A, 0,
+unsigned short utf8_to_euc_E9A4[] = {
+ 0, 0, 0, 0x712D, 0, 0x4C5F, 0, 0,
+ 0, 0x712E, 0x4D5C, 0, 0x3142, 0, 0, 0,
+ 0x3B41, 0, 0x712F, 0x326E, 0x7130, 0, 0, 0,
+ 0x7131, 0, 0, 0, 0, 0x7133, 0x7134, 0,
+ 0x7136, 0x7132, 0, 0, 0x7135, 0, 0, 0x7C5E,
+ 0x345B, 0, 0, 0, 0x7137, 0, 0x7138, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x7139, 0x713A, 0,
};
-const unsigned short utf8_to_euc_E9A5[] = {
- 0xE868, 0xE869, 0x713B, 0, 0, 0x713D, 0xE86A, 0xE86B,
- 0xE86C, 0x713C, 0, 0x713F, 0x7142, 0xE86D, 0xE86E, 0,
- 0x713E, 0x7140, 0x7141, 0, 0xE86F, 0x7143, 0, 0x3642,
- 0xE870, 0xE871, 0, 0xE872, 0xE873, 0, 0xE874, 0xE875,
- 0xE876, 0, 0, 0, 0, 0, 0, 0,
+unsigned short utf8_to_euc_E9A5[] = {
+ 0, 0, 0x713B, 0, 0, 0x713D, 0, 0,
+ 0, 0x713C, 0, 0x713F, 0x7142, 0, 0, 0,
+ 0x713E, 0x7140, 0x7141, 0, 0, 0x7143, 0, 0x3642,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9A6[] = {
+unsigned short utf8_to_euc_E9A6[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0x3C73, 0x7144,
- 0x7145, 0x3961, 0, 0xE877, 0, 0xE878, 0xF47A, 0xE879,
- 0, 0, 0, 0, 0, 0x7146, 0xE87A, 0,
+ 0x7145, 0x3961, 0, 0, 0, 0, 0x7C60, 0,
+ 0, 0, 0, 0, 0, 0x7146, 0, 0,
0x333E, 0, 0, 0, 0x474F, 0x7147, 0x7148, 0,
- 0xE87B, 0xE87C, 0xE87D, 0x435A, 0x466B, 0xE87E, 0, 0,
- 0, 0xE921, 0xE922, 0, 0x7149, 0xE923, 0, 0xE924,
-};
-const unsigned short utf8_to_euc_E9A7[] = {
- 0, 0x477D, 0, 0xE925, 0x424C, 0x3158, 0x366E, 0,
- 0x366F, 0xE926, 0, 0, 0, 0, 0, 0,
- 0x4373, 0x714E, 0x3670, 0xE927, 0xE928, 0x326F, 0, 0,
- 0x714D, 0xE929, 0xE92A, 0x714B, 0xE92B, 0x714C, 0xE92C, 0x714A,
- 0, 0, 0x7158, 0, 0, 0, 0, 0xE92D,
- 0, 0, 0xE92E, 0xE92F, 0xE930, 0x714F, 0x7150, 0,
- 0xE931, 0x7151, 0x7152, 0, 0xE932, 0xE933, 0, 0,
- 0x7154, 0xE934, 0, 0x7153, 0, 0xE935, 0xE936, 0x3D59,
-};
-const unsigned short utf8_to_euc_E9A8[] = {
- 0, 0x7155, 0xE937, 0xE938, 0xE939, 0x7157, 0, 0,
- 0, 0, 0, 0xE93A, 0xE93B, 0, 0x3533, 0x7156,
- 0xE93C, 0xE93D, 0x417B, 0x3833, 0, 0, 0xE93E, 0,
- 0, 0x7159, 0, 0, 0, 0, 0xE93F, 0,
- 0xE940, 0, 0xE941, 0xE942, 0xE943, 0, 0, 0xE944,
- 0x424D, 0, 0, 0x715A, 0, 0xE945, 0xE946, 0,
- 0x462D, 0, 0, 0xE947, 0, 0xE948, 0xE949, 0x715B,
- 0xE94A, 0, 0, 0, 0, 0, 0x7160, 0,
-};
-const unsigned short utf8_to_euc_E9A9[] = {
- 0x715E, 0xE94C, 0x715D, 0x715F, 0xE94D, 0x715C, 0, 0xE94B,
- 0, 0, 0xE94E, 0xE94F, 0xE950, 0x7162, 0xE951, 0,
- 0, 0xE952, 0, 0, 0xE953, 0x7161, 0xE954, 0x7164,
- 0, 0, 0x3643, 0x7163, 0, 0xE955, 0, 0x7165,
+ 0, 0, 0, 0x435A, 0x466B, 0, 0, 0,
+ 0, 0, 0, 0, 0x7149, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E9A7[] = {
+ 0, 0x477D, 0, 0, 0x424C, 0x3158, 0x366E, 0,
+ 0x366F, 0, 0, 0, 0, 0, 0, 0,
+ 0x4373, 0x714E, 0x3670, 0, 0, 0x326F, 0, 0,
+ 0x714D, 0, 0, 0x714B, 0, 0x714C, 0, 0x714A,
+ 0, 0, 0x7158, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x714F, 0x7150, 0,
+ 0, 0x7151, 0x7152, 0, 0, 0, 0, 0,
+ 0x7154, 0, 0, 0x7153, 0, 0, 0, 0x3D59,
+};
+unsigned short utf8_to_euc_E9A8[] = {
+ 0, 0x7155, 0, 0, 0, 0x7157, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x3533, 0x7156,
+ 0, 0, 0x417B, 0x3833, 0, 0, 0, 0,
+ 0, 0x7159, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x424D, 0, 0, 0x715A, 0, 0, 0, 0,
+ 0x462D, 0, 0, 0, 0, 0, 0, 0x715B,
+ 0, 0, 0, 0, 0, 0, 0x7160, 0,
+};
+unsigned short utf8_to_euc_E9A9[] = {
+ 0x715E, 0, 0x715D, 0x715F, 0, 0x715C, 0, 0,
+ 0, 0, 0, 0, 0, 0x7162, 0x7C61, 0,
+ 0, 0, 0, 0, 0, 0x7161, 0, 0x7164,
+ 0, 0, 0x3643, 0x7163, 0, 0, 0, 0x7165,
0, 0, 0x7166, 0, 0x7168, 0x7167, 0, 0,
0, 0x7169, 0x716B, 0x716A, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9AA[] = {
+unsigned short utf8_to_euc_E9AA[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0x397C, 0, 0xE956, 0, 0xE957, 0x716C, 0xE958, 0xE959,
- 0x716D, 0, 0xE95A, 0, 0xE95B, 0xE95C, 0xE95D, 0,
- 0x333C, 0xE95E, 0, 0xE95F, 0x716E, 0, 0xE960, 0xE961,
+ 0x397C, 0, 0, 0, 0, 0x716C, 0, 0,
+ 0x716D, 0, 0, 0, 0, 0, 0, 0,
+ 0x333C, 0, 0, 0, 0x716E, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9AB[] = {
- 0x716F, 0xE962, 0, 0xE963, 0x3F71, 0, 0xE964, 0,
- 0xE965, 0, 0, 0, 0, 0, 0xE966, 0x7170,
- 0xE967, 0x7171, 0xE968, 0x7172, 0x7173, 0xE969, 0xE96A, 0xE96B,
- 0x3962, 0xF47B, 0, 0xE96C, 0xE96D, 0, 0x7174, 0x7175,
- 0xE96E, 0, 0x7176, 0x7177, 0xE96F, 0xE970, 0x7178, 0xE971,
- 0, 0xE972, 0x4831, 0x717A, 0xE973, 0x4926, 0x717B, 0x7179,
- 0, 0x717D, 0xE974, 0xE975, 0x717C, 0xE976, 0, 0x717E,
- 0, 0xE977, 0xE978, 0x7221, 0, 0xE979, 0, 0xE97A,
+unsigned short utf8_to_euc_E9AB[] = {
+ 0x716F, 0, 0, 0, 0x3F71, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7170,
+ 0, 0x7171, 0, 0x7172, 0x7173, 0, 0, 0,
+ 0x3962, 0x7C62, 0, 0, 0x7C63, 0, 0x7174, 0x7175,
+ 0, 0, 0x7176, 0x7177, 0, 0, 0x7178, 0,
+ 0, 0, 0x4831, 0x717A, 0, 0x4926, 0x717B, 0x7179,
+ 0, 0x717D, 0, 0, 0x717C, 0, 0, 0x717E,
+ 0, 0, 0, 0x7221, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9AC[] = {
- 0xE97B, 0xE97C, 0xE97D, 0xE97E, 0xEA21, 0xEA22, 0x7222, 0,
- 0xEA23, 0xEA24, 0, 0xEA25, 0xEA26, 0xEA27, 0xEA28, 0,
- 0xEA29, 0, 0xEA2A, 0, 0, 0, 0xEA2B, 0,
- 0x7223, 0xEA2C, 0x7224, 0xEA2D, 0xEA2E, 0, 0, 0x7225,
- 0xEA2F, 0, 0x7226, 0x7227, 0, 0x7228, 0xEA30, 0x7229,
- 0x722A, 0x722B, 0x722C, 0xEA31, 0, 0xEA32, 0x722D, 0x722E,
- 0, 0x5D35, 0x722F, 0xEA33, 0xEA34, 0xEA35, 0, 0xEA36,
- 0, 0xEA37, 0xEA38, 0x6478, 0x3534, 0xEA39, 0, 0,
+unsigned short utf8_to_euc_E9AC[] = {
+ 0, 0, 0, 0, 0, 0, 0x7222, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7223, 0, 0x7224, 0, 0, 0, 0, 0x7225,
+ 0, 0, 0x7226, 0x7227, 0, 0x7228, 0, 0x7229,
+ 0x722A, 0x722B, 0x722C, 0, 0, 0, 0x722D, 0x722E,
+ 0, 0x5D35, 0x722F, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x6478, 0x3534, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9AD[] = {
+unsigned short utf8_to_euc_E9AD[] = {
0, 0x3321, 0x3A32, 0x7231, 0x7230, 0x4C25, 0, 0,
- 0xEA3A, 0, 0, 0xEA3B, 0xEA3C, 0x7233, 0x7234, 0x7232,
- 0, 0x7235, 0, 0, 0x4B62, 0xEA3D, 0xEA3E, 0xEA3F,
- 0x7236, 0, 0x357B, 0xEA40, 0, 0, 0xEA41, 0,
- 0, 0xEA42, 0, 0xEA43, 0, 0xEA44, 0xEA45, 0,
- 0xEA46, 0, 0xEA47, 0xEA48, 0xEA49, 0xEA4A, 0xEA4B, 0x4F25,
- 0, 0, 0xF47C, 0xEA4C, 0x7237, 0xEA4D, 0, 0xEA4E,
- 0xEA4F, 0xEA50, 0, 0, 0, 0, 0, 0xEA51,
-};
-const unsigned short utf8_to_euc_E9AE[] = {
- 0xEA52, 0, 0, 0x7239, 0xEA53, 0xEA54, 0xEA55, 0xEA56,
- 0, 0xEA57, 0xEA58, 0xEA59, 0, 0xEA5A, 0x303E, 0xEA5B,
- 0xEA5C, 0x723A, 0x4A2B, 0x7238, 0xEA5D, 0, 0x723B, 0x723C,
- 0, 0, 0xEA5E, 0, 0, 0xEA5F, 0xEA60, 0x723D,
- 0x723E, 0, 0, 0, 0, 0, 0xEA61, 0xEA62,
- 0x723F, 0xEA63, 0x4B6E, 0x3B2D, 0xEA64, 0x3A7A, 0x412F, 0,
- 0xEA65, 0xEA66, 0xEA67, 0, 0x7240, 0, 0, 0xEA68,
- 0xEA69, 0x7243, 0, 0xEA6A, 0xEA6B, 0, 0xEA6C, 0xEA6D,
-};
-const unsigned short utf8_to_euc_E9AF[] = {
- 0x7241, 0xEA6E, 0, 0, 0, 0, 0x7244, 0xEA6F,
- 0xEA70, 0x3871, 0x7242, 0, 0, 0, 0xEA71, 0x7245,
- 0xEA72, 0x7246, 0x7247, 0, 0x724B, 0, 0x3B2A, 0xEA73,
- 0xEA74, 0, 0, 0x4264, 0, 0xEA75, 0, 0xEA76,
- 0, 0x724C, 0x7249, 0x7248, 0x724A, 0xEA77, 0, 0xEA78,
- 0x375F, 0, 0xEA79, 0xEA7A, 0, 0, 0, 0xEA7B,
- 0x7250, 0x724F, 0x724E, 0xEA7C, 0, 0x3033, 0, 0xEA7D,
- 0xEA7E, 0xEB21, 0xEB22, 0, 0, 0xEB23, 0, 0xEB24,
-};
-const unsigned short utf8_to_euc_E9B0[] = {
- 0xEB25, 0, 0xEB26, 0, 0x725A, 0, 0x7256, 0,
- 0x7257, 0x7253, 0x7259, 0xEB27, 0x7255, 0x3362, 0, 0xEB28,
- 0x4F4C, 0xEB29, 0x7258, 0x7254, 0x7252, 0x7251, 0xEB2A, 0,
- 0xEB2B, 0xEB2C, 0xEB2D, 0x725C, 0xEB2E, 0, 0xEB2F, 0,
- 0, 0x725F, 0xEB30, 0xEB31, 0x725E, 0x725D, 0xEB32, 0xEB33,
- 0xEB34, 0xEB35, 0xEB36, 0, 0, 0x4949, 0x725B, 0x3073,
- 0x7260, 0xEB37, 0x7262, 0, 0, 0xEB38, 0xEB39, 0xEB3A,
- 0, 0x336F, 0x724D, 0x3137, 0, 0xEB3B, 0x7264, 0,
-};
-const unsigned short utf8_to_euc_E9B1[] = {
- 0, 0xEB3C, 0, 0xEB3D, 0xEB3E, 0xEB3F, 0x7263, 0x7261,
- 0x432D, 0xEB40, 0xEB41, 0, 0, 0, 0xEB42, 0xEB43,
- 0xEB44, 0, 0x4B70, 0xEB45, 0xEB46, 0, 0xEB47, 0x4E5A,
- 0xEB48, 0, 0x7265, 0xEB49, 0xEB50, 0xEB4A, 0xEB4B, 0xEB4C,
- 0x7266, 0, 0, 0xEB4D, 0, 0, 0, 0x7267,
- 0xEB52, 0xEB4E, 0xEB4F, 0xEB51, 0, 0, 0xEB53, 0,
- 0xEB54, 0, 0xEB55, 0, 0, 0xEB56, 0x7268, 0xEB57,
- 0x7269, 0, 0, 0xEB58, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E9B3[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0x443B, 0xEB59, 0x726A,
+ 0, 0, 0, 0, 0, 0x7233, 0x7234, 0x7232,
+ 0, 0x7235, 0, 0, 0x4B62, 0, 0, 0,
+ 0x7236, 0, 0x357B, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x4F25,
+ 0, 0, 0x7C65, 0, 0x7237, 0x7C64, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E9AE[] = {
+ 0, 0, 0, 0x7239, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x303E, 0x7C66,
+ 0, 0x723A, 0x4A2B, 0x7238, 0, 0, 0x723B, 0x723C,
+ 0, 0, 0, 0, 0, 0, 0, 0x723D,
+ 0x723E, 0, 0, 0, 0, 0, 0, 0,
+ 0x723F, 0, 0x4B6E, 0x3B2D, 0, 0x3A7A, 0x412F, 0,
+ 0, 0x7C67, 0, 0, 0x7240, 0, 0, 0,
+ 0, 0x7243, 0, 0x7C68, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E9AF[] = {
+ 0x7241, 0, 0, 0, 0, 0, 0x7244, 0,
+ 0, 0x3871, 0x7242, 0, 0, 0, 0, 0x7245,
+ 0, 0x7246, 0x7247, 0, 0x724B, 0, 0x3B2A, 0,
+ 0, 0, 0, 0x4264, 0, 0, 0, 0,
+ 0, 0x724C, 0x7249, 0x7248, 0x724A, 0, 0, 0,
+ 0x375F, 0, 0, 0, 0, 0, 0, 0,
+ 0x7250, 0x724F, 0x724E, 0, 0, 0x3033, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E9B0[] = {
+ 0x7C69, 0, 0, 0, 0x725A, 0, 0x7256, 0,
+ 0x7257, 0x7253, 0x7259, 0, 0x7255, 0x3362, 0, 0,
+ 0x4F4C, 0, 0x7258, 0x7254, 0x7252, 0x7251, 0, 0,
+ 0, 0, 0, 0x725C, 0, 0, 0, 0,
+ 0, 0x725F, 0, 0, 0x725E, 0x725D, 0, 0,
+ 0, 0, 0, 0, 0, 0x4949, 0x725B, 0x3073,
+ 0x7260, 0, 0x7262, 0, 0, 0, 0, 0,
+ 0, 0x336F, 0x724D, 0x3137, 0, 0, 0x7264, 0,
+};
+unsigned short utf8_to_euc_E9B1[] = {
+ 0, 0, 0, 0, 0, 0, 0x7263, 0x7261,
+ 0x432D, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x4B70, 0, 0, 0, 0, 0x4E5A,
+ 0, 0, 0x7265, 0, 0, 0, 0, 0,
+ 0x7266, 0, 0, 0, 0, 0, 0, 0x7267,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x7268, 0,
+ 0x7269, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E9B3[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x443B, 0, 0x726A,
0, 0x4837, 0, 0x726F, 0x726B, 0, 0, 0,
- 0x726C, 0, 0xEB5A, 0x4B31, 0x4C44, 0, 0x4650, 0xEB5B,
- 0, 0xEB5C, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short utf8_to_euc_E9B4[] = {
- 0, 0, 0xEB5E, 0x7270, 0, 0, 0x7271, 0x463E,
- 0x726E, 0x726D, 0, 0xEB5D, 0, 0, 0x322A, 0,
- 0, 0xEB5F, 0x7279, 0, 0, 0x7278, 0, 0xEB60,
- 0xEB61, 0, 0, 0x3175, 0xEB62, 0xEB63, 0xEB64, 0x7276,
+ 0x726C, 0, 0, 0x4B31, 0x4C44, 0, 0x4650, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_E9B4[] = {
+ 0, 0, 0, 0x7270, 0, 0, 0x7271, 0x463E,
+ 0x726E, 0x726D, 0, 0, 0, 0, 0x322A, 0,
+ 0, 0, 0x7279, 0, 0, 0x7278, 0, 0,
+ 0, 0, 0, 0x3175, 0, 0, 0, 0x7276,
0, 0, 0, 0x7275, 0, 0, 0x7273, 0,
- 0x337B, 0, 0x7272, 0x3C32, 0x3229, 0, 0, 0xEB65,
- 0xEB66, 0, 0xEB67, 0xEB68, 0xEB69, 0, 0, 0,
- 0, 0, 0xEB6A, 0x3963, 0xEB6B, 0xEB6D, 0x727C, 0x727B,
+ 0x337B, 0, 0x7272, 0x3C32, 0x3229, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x3963, 0, 0, 0x727C, 0x727B,
};
-const unsigned short utf8_to_euc_E9B5[] = {
- 0, 0x727A, 0xEB6E, 0xEB6F, 0x7277, 0xEB6C, 0x727D, 0xEB70,
- 0x727E, 0, 0xEB71, 0, 0, 0, 0, 0,
- 0x7325, 0x7324, 0, 0xEB72, 0xEB73, 0, 0, 0,
- 0, 0x7326, 0, 0, 0x312D, 0x7321, 0x7322, 0xEB74,
- 0x3974, 0x4C39, 0xEB76, 0xEB75, 0x7323, 0xEB77, 0, 0,
- 0, 0xEB78, 0xEB79, 0xEB7A, 0x4B32, 0, 0, 0x732B,
- 0xEB7B, 0, 0x7327, 0, 0, 0, 0xEB7C, 0xEB7D,
- 0, 0, 0x732C, 0xEB7E, 0xEC21, 0, 0xEC22, 0,
+unsigned short utf8_to_euc_E9B5[] = {
+ 0, 0x727A, 0, 0, 0x7277, 0, 0x727D, 0,
+ 0x727E, 0, 0, 0, 0, 0, 0, 0,
+ 0x7325, 0x7324, 0, 0, 0, 0, 0, 0,
+ 0, 0x7326, 0, 0, 0x312D, 0x7321, 0x7322, 0,
+ 0x3974, 0x4C39, 0, 0, 0x7323, 0, 0, 0,
+ 0, 0, 0, 0x7C6B, 0x4B32, 0, 0, 0x732B,
+ 0x7C6A, 0, 0x7327, 0, 0, 0, 0, 0,
+ 0, 0, 0x732C, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9B6[] = {
- 0, 0, 0, 0xEC23, 0xEC24, 0, 0xEC25, 0x7329,
- 0, 0x7328, 0xEC26, 0, 0, 0xEC27, 0xEC28, 0x375C,
- 0, 0, 0xEC29, 0xEC2A, 0, 0xEC2B, 0xEC2C, 0xEC2D,
- 0xEC2E, 0, 0x732D, 0, 0, 0, 0, 0,
- 0, 0xEC2F, 0, 0, 0x732E, 0, 0, 0,
- 0, 0x732F, 0xEC30, 0x732A, 0xEC31, 0, 0xEC32, 0x7274,
- 0, 0xEC33, 0x7330, 0, 0x4461, 0xEC34, 0, 0,
- 0x7334, 0xEC35, 0x7335, 0x7333, 0xEC36, 0, 0, 0xEC37,
+unsigned short utf8_to_euc_E9B6[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x7329,
+ 0, 0x7328, 0, 0, 0, 0, 0, 0x375C,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x732D, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x732E, 0, 0, 0,
+ 0, 0x732F, 0, 0x732A, 0, 0, 0, 0x7274,
+ 0, 0, 0x7330, 0, 0x4461, 0, 0, 0,
+ 0x7334, 0, 0x7335, 0x7333, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9B7[] = {
- 0, 0x7332, 0x7338, 0xEC38, 0x7331, 0, 0x7336, 0xEC39,
- 0, 0xEC3A, 0xEC3B, 0, 0, 0, 0, 0x7337,
- 0, 0, 0, 0x733A, 0xEC3C, 0xEC3D, 0xEC3E, 0xEC3F,
- 0, 0x7339, 0xEC40, 0, 0, 0, 0xEC41, 0xEC42,
- 0xEC43, 0, 0, 0, 0, 0xEC44, 0x733C, 0xEC45,
- 0, 0xEC46, 0, 0xEC47, 0, 0x733D, 0xEC48, 0x733E,
- 0xEC49, 0, 0x4F49, 0xEC4A, 0xEC4B, 0, 0, 0,
- 0x733B, 0x426B, 0x3A6D, 0, 0, 0x733F, 0xEC4C, 0,
+unsigned short utf8_to_euc_E9B7[] = {
+ 0, 0x7332, 0x7338, 0, 0x7331, 0, 0x7336, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7337,
+ 0, 0, 0, 0x733A, 0, 0, 0, 0,
+ 0, 0x7339, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x733C, 0,
+ 0, 0, 0, 0, 0, 0x733D, 0, 0x733E,
+ 0, 0, 0x4F49, 0, 0, 0, 0, 0,
+ 0x733B, 0x426B, 0x3A6D, 0, 0, 0x733F, 0, 0,
};
-const unsigned short utf8_to_euc_E9B8[] = {
- 0, 0, 0xEC4E, 0, 0, 0, 0, 0xEC4F,
- 0, 0, 0xEC4D, 0, 0, 0, 0xEC50, 0,
- 0xEC51, 0xEC52, 0xEC53, 0, 0, 0xEC54, 0xEC55, 0,
- 0, 0xEC56, 0x7340, 0x7341, 0xEC57, 0xEC58, 0x7342, 0,
+unsigned short utf8_to_euc_E9B8[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x7C6D, 0x7340, 0x7341, 0, 0, 0x7342, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9B9[] = {
+unsigned short utf8_to_euc_E9B9[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -5985,90 +4868,110 @@ const unsigned short utf8_to_euc_E9B9[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x7343, 0, 0,
- 0x3834, 0x7344, 0xEC59, 0xEC5A, 0xEC5B, 0x7345, 0, 0x3C2F,
-};
-const unsigned short utf8_to_euc_E9BA[] = {
- 0xEC5C, 0x7346, 0xEC5D, 0xEC5E, 0xEC5F, 0xEC60, 0, 0xEC61,
- 0x7347, 0, 0, 0x7348, 0x7349, 0, 0xEC62, 0xEC63,
- 0, 0x734C, 0x734A, 0x4F3C, 0, 0x734B, 0xEC64, 0x4E6F,
- 0xEC65, 0, 0, 0xEC66, 0, 0x734D, 0xEC67, 0x4E5B,
- 0, 0, 0, 0, 0xEC68, 0x734E, 0x477E, 0,
- 0xEC69, 0x734F, 0x7351, 0, 0xEC6A, 0x7352, 0xEC6B, 0xEC6C,
- 0xEC6D, 0, 0, 0xEC6E, 0xEC6F, 0xEC70, 0, 0,
+ 0x3834, 0x7344, 0, 0, 0, 0x7345, 0, 0x3C2F,
+};
+unsigned short utf8_to_euc_E9BA[] = {
+ 0, 0x7346, 0, 0, 0, 0, 0, 0,
+ 0x7347, 0, 0, 0x7348, 0x7349, 0, 0, 0,
+ 0, 0x734C, 0x734A, 0x4F3C, 0, 0x734B, 0, 0x4E6F,
+ 0, 0, 0, 0, 0, 0x734D, 0, 0x4E5B,
+ 0, 0, 0, 0, 0, 0x734E, 0x477E, 0,
+ 0, 0x734F, 0x7351, 0, 0, 0x7352, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0x7350, 0x396D, 0x4C4D, 0x4B63, 0x5677, 0, 0x5D60, 0x4B7B,
};
-const unsigned short utf8_to_euc_E9BB[] = {
- 0, 0, 0, 0, 0x322B, 0, 0xEC71, 0,
- 0xEC72, 0, 0, 0xEC73, 0x7354, 0x3550, 0x7355, 0x7356,
- 0x7357, 0xF47E, 0x3975, 0, 0x7358, 0xEC74, 0, 0,
- 0x6054, 0x4C5B, 0, 0x4263, 0x7359, 0x735B, 0x735A, 0xEC75,
- 0x735C, 0, 0, 0, 0xEC76, 0x735D, 0, 0xEC77,
- 0x735E, 0, 0, 0, 0xEC78, 0xEC79, 0xEC7A, 0x735F,
- 0xEC7B, 0xEC7C, 0xEC7D, 0, 0x7360, 0xEC7E, 0x7361, 0x7362,
- 0xED21, 0x7363, 0, 0x7364, 0x7365, 0x7366, 0, 0xED22,
-};
-const unsigned short utf8_to_euc_E9BC[] = {
- 0, 0, 0xED23, 0xED24, 0, 0, 0, 0x7367,
- 0x7368, 0xED25, 0, 0, 0, 0, 0x4524, 0xED26,
- 0xED27, 0xED28, 0xED29, 0x385D, 0xED2A, 0x736A, 0xED2B, 0xED2C,
- 0, 0xED2D, 0xED2E, 0xED2F, 0, 0, 0, 0xED30,
- 0x414D, 0x736B, 0xED31, 0, 0, 0, 0xED32, 0,
- 0, 0, 0xED33, 0xED34, 0x736C, 0, 0, 0xED35,
- 0, 0xED36, 0xED37, 0, 0xED38, 0, 0, 0xED39,
- 0, 0xED3A, 0xED3B, 0x4921, 0xED3C, 0xED3D, 0x736D, 0xED3E,
-};
-const unsigned short utf8_to_euc_E9BD[] = {
- 0, 0xED3F, 0, 0xED40, 0xED41, 0xED42, 0xED43, 0xED44,
+unsigned short utf8_to_euc_E9BB[] = {
+ 0, 0, 0, 0, 0x322B, 0, 0, 0,
+ 0, 0, 0, 0, 0x7354, 0x3550, 0x7355, 0x7356,
+ 0x7357, 0x7C6E, 0x3975, 0, 0x7358, 0, 0, 0,
+ 0x6054, 0x4C5B, 0, 0x4263, 0x7359, 0x735B, 0x735A, 0,
+ 0x735C, 0, 0, 0, 0, 0x735D, 0, 0,
+ 0x735E, 0, 0, 0, 0, 0, 0, 0x735F,
+ 0, 0, 0, 0, 0x7360, 0, 0x7361, 0x7362,
+ 0, 0x7363, 0, 0x7364, 0x7365, 0x7366, 0, 0,
+};
+unsigned short utf8_to_euc_E9BC[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0x7367,
+ 0x7368, 0, 0, 0, 0, 0, 0x4524, 0,
+ 0, 0, 0, 0x385D, 0, 0x736A, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x414D, 0x736B, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x736C, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0x4921, 0, 0, 0x736D, 0,
+};
+unsigned short utf8_to_euc_E9BD[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x736E, 0x6337, 0, 0, 0x6C5A, 0x706D,
- 0, 0, 0x736F, 0xED45, 0x7370, 0xED46, 0xED47, 0xED48,
- 0xED49, 0, 0xED4A, 0, 0, 0xED4B, 0xED4C, 0x7372,
+ 0, 0, 0x736F, 0, 0x7370, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x7372,
0x7373, 0x7374, 0x4E70, 0x7371, 0, 0, 0x7375, 0x7376,
- 0xED4D, 0xED4E, 0x7378, 0, 0x7377, 0xED4F, 0xED50, 0xED51,
- 0xED52, 0xED53, 0x737A, 0xED54, 0, 0xED55, 0x737B, 0x7379,
- 0, 0, 0xED56, 0, 0, 0xED57, 0, 0,
+ 0, 0, 0x7378, 0, 0x7377, 0, 0, 0,
+ 0, 0, 0x737A, 0, 0, 0, 0x737B, 0x7379,
+ 0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_E9BE[] = {
+unsigned short utf8_to_euc_E9BE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0x4E36, 0, 0xED58,
- 0xED59, 0xED5A, 0xED5B, 0, 0xED5C, 0x737C, 0xED5D, 0xED5E,
- 0, 0, 0, 0, 0x737D, 0x6354, 0xED5F, 0,
- 0x737E, 0xED60, 0xED61, 0xED62, 0, 0xED63, 0, 0,
+ 0, 0, 0, 0, 0, 0x4E36, 0, 0,
+ 0, 0, 0, 0, 0, 0x737C, 0, 0,
+ 0, 0, 0, 0, 0x737D, 0x6354, 0, 0,
+ 0x737E, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_EFA4[] = {
+unsigned short utf8_to_euc_EFA4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xF445, 0, 0, 0, 0, 0, 0,
+ 0, 0x7A46, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_EFA7[] = {
+unsigned short utf8_to_euc_EFA7[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xF472, 0, 0, 0,
+ 0, 0, 0, 0, 0x7C4F, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_EFA8[] = {
+unsigned short utf8_to_euc_EFA8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xF434, 0xF437,
- 0xF438, 0xF43D, 0xF444, 0xF447, 0xF448, 0xF44E, 0xF44F, 0xF453,
- 0xF455, 0xF456, 0xF457, 0xF458, 0xF45A, 0xF45B, 0xF45E, 0xF460,
- 0xF462, 0xF463, 0xF465, 0xF469, 0xF46A, 0xF46B, 0xF46D, 0xF46F,
- 0xF470, 0xF473, 0xF477, 0xF478, 0xF479, 0xF47D, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x7954, 0x795F,
+ 0x7960, 0x7975, 0x7A3E, 0x7A4E, 0x7A50, 0x7A7B, 0x7B23, 0x7B3A,
+ 0x7B42, 0x7B43, 0x7B44, 0x7B46, 0x7B4A, 0x7B4D, 0x7B56, 0x7B61,
+ 0x7B63, 0x7B64, 0x7B6D, 0x7B75, 0x7B77, 0x7B78, 0x7B7B, 0x7C39,
+ 0x7C40, 0x7C50, 0x7C5C, 0x7C5D, 0x7C5F, 0x7C6C, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_EFBC[] = {
- 0, 0x212A, 0xF42A, 0x2174, 0x2170, 0x2173, 0x2175, 0xF429,
+unsigned short utf8_to_euc_EFB8[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x7545, 0x753D, 0, 0x7532, 0, 0x754A, 0x754B, 0x7550,
+ 0x7551, 0x754C, 0x754D, 0x755A, 0x755B, 0x7554, 0x7555, 0x7552,
+};
+unsigned short utf8_to_euc_EFB9[] = {
+ 0x7553, 0x7556, 0x7557, 0x7558, 0x7559, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+unsigned short utf8_to_euc_EFBC[] = {
+ 0, 0x212A, 0x7C7E, 0x2174, 0x2170, 0x2173, 0x2175, 0x7C7D,
0x214A, 0x214B, 0x2176, 0x215C, 0x2124, 0x215D, 0x2125, 0x213F,
0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337,
0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129,
@@ -6077,17 +4980,7 @@ const unsigned short utf8_to_euc_EFBC[] = {
0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357,
0x2358, 0x2359, 0x235A, 0x214E, 0x2140, 0x214F, 0x2130, 0x2132,
};
-const unsigned short utf8_to_euc_EFBD[] = {
- 0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
- 0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
- 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
- 0x2378, 0x2379, 0x237A, 0x2150, 0x2143, 0x2151, 0xA237, 0,
- 0, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
- 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
- 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
- 0x0E38, 0x0E39, 0x0E3A, 0x0E3B, 0x0E3C, 0x0E3D, 0x0E3E, 0x0E3F,
-};
-const unsigned short utf8_to_euc_EFBD_ms[] = {
+unsigned short utf8_to_euc_EFBD[] = {
0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
@@ -6097,7 +4990,7 @@ const unsigned short utf8_to_euc_EFBD_ms[] = {
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
0x0E38, 0x0E39, 0x0E3A, 0x0E3B, 0x0E3C, 0x0E3D, 0x0E3E, 0x0E3F,
};
-const unsigned short utf8_to_euc_EFBE[] = {
+unsigned short utf8_to_euc_EFBE[] = {
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47,
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
@@ -6107,61 +5000,25 @@ const unsigned short utf8_to_euc_EFBE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short utf8_to_euc_EFBF[] = {
+unsigned short utf8_to_euc_EFBF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0x2171, 0x2172, 0x224C, 0x2131, 0xA243, 0x216F, 0, 0,
+ 0x2171, 0x2172, 0x224C, 0x2131, 0x7C7C, 0x216F, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-const unsigned short *const utf8_to_euc_E2[] = {
+unsigned short * utf8_to_euc_E2[] = {
utf8_to_euc_E280, 0, 0, 0,
utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287,
utf8_to_euc_E288, utf8_to_euc_E289, utf8_to_euc_E28A, 0,
utf8_to_euc_E28C, 0, 0, 0,
- 0, utf8_to_euc_E291, 0, 0,
- utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297,
- utf8_to_euc_E298, utf8_to_euc_E299, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
-const unsigned short *const utf8_to_euc_E2_ms[] = {
- utf8_to_euc_E280_ms, 0, 0, 0,
- utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287,
- utf8_to_euc_E288, utf8_to_euc_E289, utf8_to_euc_E28A, 0,
- utf8_to_euc_E28C, 0, 0, 0,
- 0, utf8_to_euc_E291, 0, 0,
- utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297,
- utf8_to_euc_E298, utf8_to_euc_E299, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
-const unsigned short *const utf8_to_euc_E2_932[] = {
- utf8_to_euc_E280_932, 0, 0, 0,
- utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287,
- utf8_to_euc_E288_932, utf8_to_euc_E289, utf8_to_euc_E28A, 0,
- utf8_to_euc_E28C, 0, 0, 0,
- 0, utf8_to_euc_E291, 0, 0,
+ 0, utf8_to_euc_E291, utf8_to_euc_E292, 0,
utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297,
utf8_to_euc_E298, utf8_to_euc_E299, 0, 0,
- 0, 0, 0, 0,
+ 0, utf8_to_euc_E29D, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6171,10 +5028,10 @@ const unsigned short *const utf8_to_euc_E2_932[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
-const unsigned short *const utf8_to_euc_E3[] = {
+unsigned short * utf8_to_euc_E3[] = {
utf8_to_euc_E380, utf8_to_euc_E381, utf8_to_euc_E382, utf8_to_euc_E383,
0, 0, 0, 0,
- utf8_to_euc_E388, 0, utf8_to_euc_E38A, 0,
+ utf8_to_euc_E388, utf8_to_euc_E389, utf8_to_euc_E38A, 0,
utf8_to_euc_E38C, utf8_to_euc_E38D, utf8_to_euc_E38E, utf8_to_euc_E38F,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6189,25 +5046,7 @@ const unsigned short *const utf8_to_euc_E3[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
-const unsigned short *const utf8_to_euc_E3_932[] = {
- utf8_to_euc_E380_932, utf8_to_euc_E381, utf8_to_euc_E382_932, utf8_to_euc_E383,
- 0, 0, 0, 0,
- utf8_to_euc_E388, 0, utf8_to_euc_E38A, 0,
- utf8_to_euc_E38C, utf8_to_euc_E38D, utf8_to_euc_E38E, utf8_to_euc_E38F,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
-const unsigned short *const utf8_to_euc_E4[] = {
+unsigned short * utf8_to_euc_E4[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6225,7 +5064,7 @@ const unsigned short *const utf8_to_euc_E4[] = {
utf8_to_euc_E4B8, utf8_to_euc_E4B9, utf8_to_euc_E4BA, utf8_to_euc_E4BB,
utf8_to_euc_E4BC, utf8_to_euc_E4BD, utf8_to_euc_E4BE, utf8_to_euc_E4BF,
};
-const unsigned short *const utf8_to_euc_E5[] = {
+unsigned short * utf8_to_euc_E5[] = {
utf8_to_euc_E580, utf8_to_euc_E581, utf8_to_euc_E582, utf8_to_euc_E583,
utf8_to_euc_E584, utf8_to_euc_E585, utf8_to_euc_E586, utf8_to_euc_E587,
utf8_to_euc_E588, utf8_to_euc_E589, utf8_to_euc_E58A, utf8_to_euc_E58B,
@@ -6243,7 +5082,7 @@ const unsigned short *const utf8_to_euc_E5[] = {
utf8_to_euc_E5B8, utf8_to_euc_E5B9, utf8_to_euc_E5BA, utf8_to_euc_E5BB,
utf8_to_euc_E5BC, utf8_to_euc_E5BD, utf8_to_euc_E5BE, utf8_to_euc_E5BF,
};
-const unsigned short *const utf8_to_euc_E6[] = {
+unsigned short * utf8_to_euc_E6[] = {
utf8_to_euc_E680, utf8_to_euc_E681, utf8_to_euc_E682, utf8_to_euc_E683,
utf8_to_euc_E684, utf8_to_euc_E685, utf8_to_euc_E686, utf8_to_euc_E687,
utf8_to_euc_E688, utf8_to_euc_E689, utf8_to_euc_E68A, utf8_to_euc_E68B,
@@ -6261,7 +5100,7 @@ const unsigned short *const utf8_to_euc_E6[] = {
utf8_to_euc_E6B8, utf8_to_euc_E6B9, utf8_to_euc_E6BA, utf8_to_euc_E6BB,
utf8_to_euc_E6BC, utf8_to_euc_E6BD, utf8_to_euc_E6BE, utf8_to_euc_E6BF,
};
-const unsigned short *const utf8_to_euc_E7[] = {
+unsigned short * utf8_to_euc_E7[] = {
utf8_to_euc_E780, utf8_to_euc_E781, utf8_to_euc_E782, utf8_to_euc_E783,
utf8_to_euc_E784, utf8_to_euc_E785, utf8_to_euc_E786, utf8_to_euc_E787,
utf8_to_euc_E788, utf8_to_euc_E789, utf8_to_euc_E78A, utf8_to_euc_E78B,
@@ -6279,7 +5118,7 @@ const unsigned short *const utf8_to_euc_E7[] = {
utf8_to_euc_E7B8, utf8_to_euc_E7B9, utf8_to_euc_E7BA, 0,
utf8_to_euc_E7BC, utf8_to_euc_E7BD, utf8_to_euc_E7BE, utf8_to_euc_E7BF,
};
-const unsigned short *const utf8_to_euc_E8[] = {
+unsigned short * utf8_to_euc_E8[] = {
utf8_to_euc_E880, utf8_to_euc_E881, utf8_to_euc_E882, utf8_to_euc_E883,
utf8_to_euc_E884, utf8_to_euc_E885, utf8_to_euc_E886, utf8_to_euc_E887,
utf8_to_euc_E888, utf8_to_euc_E889, utf8_to_euc_E88A, utf8_to_euc_E88B,
@@ -6297,7 +5136,7 @@ const unsigned short *const utf8_to_euc_E8[] = {
utf8_to_euc_E8B8, utf8_to_euc_E8B9, utf8_to_euc_E8BA, utf8_to_euc_E8BB,
utf8_to_euc_E8BC, utf8_to_euc_E8BD, utf8_to_euc_E8BE, utf8_to_euc_E8BF,
};
-const unsigned short *const utf8_to_euc_E9[] = {
+unsigned short * utf8_to_euc_E9[] = {
utf8_to_euc_E980, utf8_to_euc_E981, utf8_to_euc_E982, utf8_to_euc_E983,
utf8_to_euc_E984, utf8_to_euc_E985, utf8_to_euc_E986, utf8_to_euc_E987,
utf8_to_euc_E988, utf8_to_euc_E989, utf8_to_euc_E98A, utf8_to_euc_E98B,
@@ -6315,7 +5154,7 @@ const unsigned short *const utf8_to_euc_E9[] = {
utf8_to_euc_E9B8, utf8_to_euc_E9B9, utf8_to_euc_E9BA, utf8_to_euc_E9BB,
utf8_to_euc_E9BC, utf8_to_euc_E9BD, utf8_to_euc_E9BE, 0,
};
-const unsigned short *const utf8_to_euc_EF[] = {
+unsigned short * utf8_to_euc_EF[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6330,28 +5169,10 @@ const unsigned short *const utf8_to_euc_EF[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
- 0, 0, 0, 0,
+ utf8_to_euc_EFB8, utf8_to_euc_EFB9, 0, 0,
utf8_to_euc_EFBC, utf8_to_euc_EFBD, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
};
-const unsigned short *const utf8_to_euc_EF_ms[] = {
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- utf8_to_euc_EFA4, 0, 0, utf8_to_euc_EFA7,
- utf8_to_euc_EFA8, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- utf8_to_euc_EFBC, utf8_to_euc_EFBD_ms, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
-};
-const unsigned short *const utf8_to_euc_2bytes[] = {
+unsigned short * utf8_to_euc_2bytes[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6369,38 +5190,8 @@ const unsigned short *const utf8_to_euc_2bytes[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, utf8_to_euc_C2, utf8_to_euc_C3,
- utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7,
- 0, 0, 0, utf8_to_euc_CB,
- 0, 0, utf8_to_euc_CE, utf8_to_euc_CF,
- utf8_to_euc_D0, utf8_to_euc_D1, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
-const unsigned short *const utf8_to_euc_2bytes_ms[] = {
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, utf8_to_euc_C2_ms, utf8_to_euc_C3,
- utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7,
- 0, 0, 0, utf8_to_euc_CB,
0, 0, utf8_to_euc_CE, utf8_to_euc_CF,
utf8_to_euc_D0, utf8_to_euc_D1, 0, 0,
0, 0, 0, 0,
@@ -6411,7 +5202,8 @@ const unsigned short *const utf8_to_euc_2bytes_ms[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
-const unsigned short *const utf8_to_euc_2bytes_932[] = {
+unsigned short ** utf8_to_euc_3bytes[] = {
+ 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6428,11 +5220,6 @@ const unsigned short *const utf8_to_euc_2bytes_932[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
- 0, 0, utf8_to_euc_C2_932, utf8_to_euc_C3_932,
- utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7,
- 0, 0, 0, utf8_to_euc_CB,
- 0, 0, utf8_to_euc_CE, utf8_to_euc_CF,
- utf8_to_euc_D0, utf8_to_euc_D1, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -6440,980 +5227,15 @@ const unsigned short *const utf8_to_euc_2bytes_932[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
-};
-const unsigned short *const *const utf8_to_euc_3bytes[] = {
0, 0, utf8_to_euc_E2, utf8_to_euc_E3,
utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
0, 0, 0, utf8_to_euc_EF,
};
-const unsigned short *const *const utf8_to_euc_3bytes_ms[] = {
- 0, 0, utf8_to_euc_E2_ms, utf8_to_euc_E3,
- utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
- utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
- 0, 0, 0, utf8_to_euc_EF_ms,
-};
-const unsigned short *const *const utf8_to_euc_3bytes_932[] = {
- 0, 0, utf8_to_euc_E2_932, utf8_to_euc_E3_932,
- utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
- utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
- 0, 0, 0, utf8_to_euc_EF_ms,
-};
-
-#ifdef UNICODE_NORMALIZATION
-
-/* Normalization Table by Apple */
-/* http://developer.apple.com/technotes/tn/tn1150table.html */
-
-const struct normalization_pair normalization_table[] = {
- {{0xcd,0xbe}, {0x3b}},
- {{0xc3,0x80}, {0x41,0xcc,0x80,0x00}},
- {{0xc3,0x81}, {0x41,0xcc,0x81}},
- {{0xc3,0x82}, {0x41,0xcc,0x82}},
- {{0xe1,0xba,0xa6}, {0x41,0xcc,0x82,0xcc,0x80}},
- {{0xe1,0xba,0xa4}, {0x41,0xcc,0x82,0xcc,0x81}},
- {{0xe1,0xba,0xaa}, {0x41,0xcc,0x82,0xcc,0x83}},
- {{0xe1,0xba,0xa8}, {0x41,0xcc,0x82,0xcc,0x89}},
- {{0xc3,0x83}, {0x41,0xcc,0x83}},
- {{0xc4,0x80}, {0x41,0xcc,0x84}},
- {{0xc4,0x82}, {0x41,0xcc,0x86}},
- {{0xe1,0xba,0xb0}, {0x41,0xcc,0x86,0xcc,0x80}},
- {{0xe1,0xba,0xae}, {0x41,0xcc,0x86,0xcc,0x81}},
- {{0xe1,0xba,0xb4}, {0x41,0xcc,0x86,0xcc,0x83}},
- {{0xe1,0xba,0xb2}, {0x41,0xcc,0x86,0xcc,0x89}},
- {{0xc7,0xa0}, {0x41,0xcc,0x87,0xcc,0x84}},
- {{0xc3,0x84}, {0x41,0xcc,0x88}},
- {{0xc7,0x9e}, {0x41,0xcc,0x88,0xcc,0x84}},
- {{0xe1,0xba,0xa2}, {0x41,0xcc,0x89}},
- {{0xc3,0x85}, {0x41,0xcc,0x8a}},
- {{0xc7,0xba}, {0x41,0xcc,0x8a,0xcc,0x81}},
- {{0xc7,0x8d}, {0x41,0xcc,0x8c}},
- {{0xc8,0x80}, {0x41,0xcc,0x8f}},
- {{0xc8,0x82}, {0x41,0xcc,0x91}},
- {{0xe1,0xba,0xa0}, {0x41,0xcc,0xa3}},
- {{0xe1,0xba,0xac}, {0x41,0xcc,0xa3,0xcc,0x82}},
- {{0xe1,0xba,0xb6}, {0x41,0xcc,0xa3,0xcc,0x86}},
- {{0xe1,0xb8,0x80}, {0x41,0xcc,0xa5}},
- {{0xc4,0x84}, {0x41,0xcc,0xa8}},
- {{0xe1,0xb8,0x82}, {0x42,0xcc,0x87}},
- {{0xe1,0xb8,0x84}, {0x42,0xcc,0xa3}},
- {{0xe1,0xb8,0x86}, {0x42,0xcc,0xb1}},
- {{0xc4,0x86}, {0x43,0xcc,0x81}},
- {{0xc4,0x88}, {0x43,0xcc,0x82}},
- {{0xc4,0x8a}, {0x43,0xcc,0x87}},
- {{0xc4,0x8c}, {0x43,0xcc,0x8c}},
- {{0xc3,0x87}, {0x43,0xcc,0xa7}},
- {{0xe1,0xb8,0x88}, {0x43,0xcc,0xa7,0xcc,0x81}},
- {{0xe1,0xb8,0x8a}, {0x44,0xcc,0x87}},
- {{0xc4,0x8e}, {0x44,0xcc,0x8c}},
- {{0xe1,0xb8,0x8c}, {0x44,0xcc,0xa3}},
- {{0xe1,0xb8,0x90}, {0x44,0xcc,0xa7}},
- {{0xe1,0xb8,0x92}, {0x44,0xcc,0xad}},
- {{0xe1,0xb8,0x8e}, {0x44,0xcc,0xb1}},
- {{0xc3,0x88}, {0x45,0xcc,0x80}},
- {{0xc3,0x89}, {0x45,0xcc,0x81}},
- {{0xc3,0x8a}, {0x45,0xcc,0x82}},
- {{0xe1,0xbb,0x80}, {0x45,0xcc,0x82,0xcc,0x80}},
- {{0xe1,0xba,0xbe}, {0x45,0xcc,0x82,0xcc,0x81}},
- {{0xe1,0xbb,0x84}, {0x45,0xcc,0x82,0xcc,0x83}},
- {{0xe1,0xbb,0x82}, {0x45,0xcc,0x82,0xcc,0x89}},
- {{0xe1,0xba,0xbc}, {0x45,0xcc,0x83}},
- {{0xc4,0x92}, {0x45,0xcc,0x84}},
- {{0xe1,0xb8,0x94}, {0x45,0xcc,0x84,0xcc,0x80}},
- {{0xe1,0xb8,0x96}, {0x45,0xcc,0x84,0xcc,0x81}},
- {{0xc4,0x94}, {0x45,0xcc,0x86}},
- {{0xc4,0x96}, {0x45,0xcc,0x87}},
- {{0xc3,0x8b}, {0x45,0xcc,0x88}},
- {{0xe1,0xba,0xba}, {0x45,0xcc,0x89}},
- {{0xc4,0x9a}, {0x45,0xcc,0x8c}},
- {{0xc8,0x84}, {0x45,0xcc,0x8f}},
- {{0xc8,0x86}, {0x45,0xcc,0x91}},
- {{0xe1,0xba,0xb8}, {0x45,0xcc,0xa3}},
- {{0xe1,0xbb,0x86}, {0x45,0xcc,0xa3,0xcc,0x82}},
- {{0xe1,0xb8,0x9c}, {0x45,0xcc,0xa7,0xcc,0x86}},
- {{0xc4,0x98}, {0x45,0xcc,0xa8}},
- {{0xe1,0xb8,0x98}, {0x45,0xcc,0xad}},
- {{0xe1,0xb8,0x9a}, {0x45,0xcc,0xb0}},
- {{0xe1,0xb8,0x9e}, {0x46,0xcc,0x87}},
- {{0xc7,0xb4}, {0x47,0xcc,0x81}},
- {{0xc4,0x9c}, {0x47,0xcc,0x82}},
- {{0xe1,0xb8,0xa0}, {0x47,0xcc,0x84}},
- {{0xc4,0x9e}, {0x47,0xcc,0x86}},
- {{0xc4,0xa0}, {0x47,0xcc,0x87}},
- {{0xc7,0xa6}, {0x47,0xcc,0x8c}},
- {{0xc4,0xa2}, {0x47,0xcc,0xa7}},
- {{0xc4,0xa4}, {0x48,0xcc,0x82}},
- {{0xe1,0xb8,0xa2}, {0x48,0xcc,0x87}},
- {{0xe1,0xb8,0xa6}, {0x48,0xcc,0x88}},
- {{0xe1,0xb8,0xa4}, {0x48,0xcc,0xa3}},
- {{0xe1,0xb8,0xa8}, {0x48,0xcc,0xa7}},
- {{0xe1,0xb8,0xaa}, {0x48,0xcc,0xae}},
- {{0xc3,0x8c}, {0x49,0xcc,0x80}},
- {{0xc3,0x8d}, {0x49,0xcc,0x81}},
- {{0xc3,0x8e}, {0x49,0xcc,0x82}},
- {{0xc4,0xa8}, {0x49,0xcc,0x83}},
- {{0xc4,0xaa}, {0x49,0xcc,0x84}},
- {{0xc4,0xac}, {0x49,0xcc,0x86}},
- {{0xc4,0xb0}, {0x49,0xcc,0x87}},
- {{0xc3,0x8f}, {0x49,0xcc,0x88}},
- {{0xe1,0xb8,0xae}, {0x49,0xcc,0x88,0xcc,0x81}},
- {{0xe1,0xbb,0x88}, {0x49,0xcc,0x89}},
- {{0xc7,0x8f}, {0x49,0xcc,0x8c}},
- {{0xc8,0x88}, {0x49,0xcc,0x8f}},
- {{0xc8,0x8a}, {0x49,0xcc,0x91}},
- {{0xe1,0xbb,0x8a}, {0x49,0xcc,0xa3}},
- {{0xc4,0xae}, {0x49,0xcc,0xa8}},
- {{0xe1,0xb8,0xac}, {0x49,0xcc,0xb0}},
- {{0xc4,0xb4}, {0x4a,0xcc,0x82}},
- {{0xe1,0xb8,0xb0}, {0x4b,0xcc,0x81}},
- {{0xc7,0xa8}, {0x4b,0xcc,0x8c}},
- {{0xe1,0xb8,0xb2}, {0x4b,0xcc,0xa3}},
- {{0xc4,0xb6}, {0x4b,0xcc,0xa7}},
- {{0xe1,0xb8,0xb4}, {0x4b,0xcc,0xb1}},
- {{0xc4,0xb9}, {0x4c,0xcc,0x81}},
- {{0xc4,0xbd}, {0x4c,0xcc,0x8c}},
- {{0xe1,0xb8,0xb6}, {0x4c,0xcc,0xa3}},
- {{0xe1,0xb8,0xb8}, {0x4c,0xcc,0xa3,0xcc,0x84}},
- {{0xc4,0xbb}, {0x4c,0xcc,0xa7}},
- {{0xe1,0xb8,0xbc}, {0x4c,0xcc,0xad}},
- {{0xe1,0xb8,0xba}, {0x4c,0xcc,0xb1}},
- {{0xe1,0xb8,0xbe}, {0x4d,0xcc,0x81}},
- {{0xe1,0xb9,0x80}, {0x4d,0xcc,0x87}},
- {{0xe1,0xb9,0x82}, {0x4d,0xcc,0xa3}},
- {{0xc5,0x83}, {0x4e,0xcc,0x81}},
- {{0xc3,0x91}, {0x4e,0xcc,0x83}},
- {{0xe1,0xb9,0x84}, {0x4e,0xcc,0x87}},
- {{0xc5,0x87}, {0x4e,0xcc,0x8c}},
- {{0xe1,0xb9,0x86}, {0x4e,0xcc,0xa3}},
- {{0xc5,0x85}, {0x4e,0xcc,0xa7}},
- {{0xe1,0xb9,0x8a}, {0x4e,0xcc,0xad}},
- {{0xe1,0xb9,0x88}, {0x4e,0xcc,0xb1}},
- {{0xc3,0x92}, {0x4f,0xcc,0x80}},
- {{0xc3,0x93}, {0x4f,0xcc,0x81}},
- {{0xc3,0x94}, {0x4f,0xcc,0x82}},
- {{0xe1,0xbb,0x92}, {0x4f,0xcc,0x82,0xcc,0x80}},
- {{0xe1,0xbb,0x90}, {0x4f,0xcc,0x82,0xcc,0x81}},
- {{0xe1,0xbb,0x96}, {0x4f,0xcc,0x82,0xcc,0x83}},
- {{0xe1,0xbb,0x94}, {0x4f,0xcc,0x82,0xcc,0x89}},
- {{0xc3,0x95}, {0x4f,0xcc,0x83}},
- {{0xe1,0xb9,0x8c}, {0x4f,0xcc,0x83,0xcc,0x81}},
- {{0xe1,0xb9,0x8e}, {0x4f,0xcc,0x83,0xcc,0x88}},
- {{0xc5,0x8c}, {0x4f,0xcc,0x84}},
- {{0xe1,0xb9,0x90}, {0x4f,0xcc,0x84,0xcc,0x80}},
- {{0xe1,0xb9,0x92}, {0x4f,0xcc,0x84,0xcc,0x81}},
- {{0xc5,0x8e}, {0x4f,0xcc,0x86}},
- {{0xc3,0x96}, {0x4f,0xcc,0x88}},
- {{0xe1,0xbb,0x8e}, {0x4f,0xcc,0x89}},
- {{0xc5,0x90}, {0x4f,0xcc,0x8b}},
- {{0xc7,0x91}, {0x4f,0xcc,0x8c}},
- {{0xc8,0x8c}, {0x4f,0xcc,0x8f}},
- {{0xc8,0x8e}, {0x4f,0xcc,0x91}},
- {{0xc6,0xa0}, {0x4f,0xcc,0x9b}},
- {{0xe1,0xbb,0x9c}, {0x4f,0xcc,0x9b,0xcc,0x80}},
- {{0xe1,0xbb,0x9a}, {0x4f,0xcc,0x9b,0xcc,0x81}},
- {{0xe1,0xbb,0xa0}, {0x4f,0xcc,0x9b,0xcc,0x83}},
- {{0xe1,0xbb,0x9e}, {0x4f,0xcc,0x9b,0xcc,0x89}},
- {{0xe1,0xbb,0xa2}, {0x4f,0xcc,0x9b,0xcc,0xa3}},
- {{0xe1,0xbb,0x8c}, {0x4f,0xcc,0xa3}},
- {{0xe1,0xbb,0x98}, {0x4f,0xcc,0xa3,0xcc,0x82}},
- {{0xc7,0xaa}, {0x4f,0xcc,0xa8}},
- {{0xc7,0xac}, {0x4f,0xcc,0xa8,0xcc,0x84}},
- {{0xe1,0xb9,0x94}, {0x50,0xcc,0x81}},
- {{0xe1,0xb9,0x96}, {0x50,0xcc,0x87}},
- {{0xc5,0x94}, {0x52,0xcc,0x81}},
- {{0xe1,0xb9,0x98}, {0x52,0xcc,0x87}},
- {{0xc5,0x98}, {0x52,0xcc,0x8c}},
- {{0xc8,0x90}, {0x52,0xcc,0x8f}},
- {{0xc8,0x92}, {0x52,0xcc,0x91}},
- {{0xe1,0xb9,0x9a}, {0x52,0xcc,0xa3}},
- {{0xe1,0xb9,0x9c}, {0x52,0xcc,0xa3,0xcc,0x84}},
- {{0xc5,0x96}, {0x52,0xcc,0xa7}},
- {{0xe1,0xb9,0x9e}, {0x52,0xcc,0xb1}},
- {{0xc5,0x9a}, {0x53,0xcc,0x81}},
- {{0xe1,0xb9,0xa4}, {0x53,0xcc,0x81,0xcc,0x87}},
- {{0xc5,0x9c}, {0x53,0xcc,0x82}},
- {{0xe1,0xb9,0xa0}, {0x53,0xcc,0x87}},
- {{0xc5,0xa0}, {0x53,0xcc,0x8c}},
- {{0xe1,0xb9,0xa6}, {0x53,0xcc,0x8c,0xcc,0x87}},
- {{0xe1,0xb9,0xa2}, {0x53,0xcc,0xa3}},
- {{0xe1,0xb9,0xa8}, {0x53,0xcc,0xa3,0xcc,0x87}},
- {{0xc5,0x9e}, {0x53,0xcc,0xa7}},
- {{0xe1,0xb9,0xaa}, {0x54,0xcc,0x87}},
- {{0xc5,0xa4}, {0x54,0xcc,0x8c}},
- {{0xe1,0xb9,0xac}, {0x54,0xcc,0xa3}},
- {{0xc5,0xa2}, {0x54,0xcc,0xa7}},
- {{0xe1,0xb9,0xb0}, {0x54,0xcc,0xad}},
- {{0xe1,0xb9,0xae}, {0x54,0xcc,0xb1}},
- {{0xc3,0x99}, {0x55,0xcc,0x80}},
- {{0xc3,0x9a}, {0x55,0xcc,0x81}},
- {{0xc3,0x9b}, {0x55,0xcc,0x82}},
- {{0xc5,0xa8}, {0x55,0xcc,0x83}},
- {{0xe1,0xb9,0xb8}, {0x55,0xcc,0x83,0xcc,0x81}},
- {{0xc5,0xaa}, {0x55,0xcc,0x84}},
- {{0xe1,0xb9,0xba}, {0x55,0xcc,0x84,0xcc,0x88}},
- {{0xc5,0xac}, {0x55,0xcc,0x86}},
- {{0xc3,0x9c}, {0x55,0xcc,0x88}},
- {{0xc7,0x9b}, {0x55,0xcc,0x88,0xcc,0x80}},
- {{0xc7,0x97}, {0x55,0xcc,0x88,0xcc,0x81}},
- {{0xc7,0x95}, {0x55,0xcc,0x88,0xcc,0x84}},
- {{0xc7,0x99}, {0x55,0xcc,0x88,0xcc,0x8c}},
- {{0xe1,0xbb,0xa6}, {0x55,0xcc,0x89}},
- {{0xc5,0xae}, {0x55,0xcc,0x8a}},
- {{0xc5,0xb0}, {0x55,0xcc,0x8b}},
- {{0xc7,0x93}, {0x55,0xcc,0x8c}},
- {{0xc8,0x94}, {0x55,0xcc,0x8f}},
- {{0xc8,0x96}, {0x55,0xcc,0x91}},
- {{0xc6,0xaf}, {0x55,0xcc,0x9b}},
- {{0xe1,0xbb,0xaa}, {0x55,0xcc,0x9b,0xcc,0x80}},
- {{0xe1,0xbb,0xa8}, {0x55,0xcc,0x9b,0xcc,0x81}},
- {{0xe1,0xbb,0xae}, {0x55,0xcc,0x9b,0xcc,0x83}},
- {{0xe1,0xbb,0xac}, {0x55,0xcc,0x9b,0xcc,0x89}},
- {{0xe1,0xbb,0xb0}, {0x55,0xcc,0x9b,0xcc,0xa3}},
- {{0xe1,0xbb,0xa4}, {0x55,0xcc,0xa3}},
- {{0xe1,0xb9,0xb2}, {0x55,0xcc,0xa4}},
- {{0xc5,0xb2}, {0x55,0xcc,0xa8}},
- {{0xe1,0xb9,0xb6}, {0x55,0xcc,0xad}},
- {{0xe1,0xb9,0xb4}, {0x55,0xcc,0xb0}},
- {{0xe1,0xb9,0xbc}, {0x56,0xcc,0x83}},
- {{0xe1,0xb9,0xbe}, {0x56,0xcc,0xa3}},
- {{0xe1,0xba,0x80}, {0x57,0xcc,0x80}},
- {{0xe1,0xba,0x82}, {0x57,0xcc,0x81}},
- {{0xc5,0xb4}, {0x57,0xcc,0x82}},
- {{0xe1,0xba,0x86}, {0x57,0xcc,0x87}},
- {{0xe1,0xba,0x84}, {0x57,0xcc,0x88}},
- {{0xe1,0xba,0x88}, {0x57,0xcc,0xa3}},
- {{0xe1,0xba,0x8a}, {0x58,0xcc,0x87}},
- {{0xe1,0xba,0x8c}, {0x58,0xcc,0x88}},
- {{0xe1,0xbb,0xb2}, {0x59,0xcc,0x80}},
- {{0xc3,0x9d}, {0x59,0xcc,0x81}},
- {{0xc5,0xb6}, {0x59,0xcc,0x82}},
- {{0xe1,0xbb,0xb8}, {0x59,0xcc,0x83}},
- {{0xe1,0xba,0x8e}, {0x59,0xcc,0x87}},
- {{0xc5,0xb8}, {0x59,0xcc,0x88}},
- {{0xe1,0xbb,0xb6}, {0x59,0xcc,0x89}},
- {{0xe1,0xbb,0xb4}, {0x59,0xcc,0xa3}},
- {{0xc5,0xb9}, {0x5a,0xcc,0x81}},
- {{0xe1,0xba,0x90}, {0x5a,0xcc,0x82}},
- {{0xc5,0xbb}, {0x5a,0xcc,0x87}},
- {{0xc5,0xbd}, {0x5a,0xcc,0x8c}},
- {{0xe1,0xba,0x92}, {0x5a,0xcc,0xa3}},
- {{0xe1,0xba,0x94}, {0x5a,0xcc,0xb1}},
- {{0xe1,0xbf,0xaf}, {0x60}},
- {{0xc3,0xa0}, {0x61,0xcc,0x80}},
- {{0xc3,0xa1}, {0x61,0xcc,0x81}},
- {{0xc3,0xa2}, {0x61,0xcc,0x82}},
- {{0xe1,0xba,0xa7}, {0x61,0xcc,0x82,0xcc,0x80}},
- {{0xe1,0xba,0xa5}, {0x61,0xcc,0x82,0xcc,0x81}},
- {{0xe1,0xba,0xab}, {0x61,0xcc,0x82,0xcc,0x83}},
- {{0xe1,0xba,0xa9}, {0x61,0xcc,0x82,0xcc,0x89}},
- {{0xc3,0xa3}, {0x61,0xcc,0x83}},
- {{0xc4,0x81}, {0x61,0xcc,0x84}},
- {{0xc4,0x83}, {0x61,0xcc,0x86}},
- {{0xe1,0xba,0xb1}, {0x61,0xcc,0x86,0xcc,0x80}},
- {{0xe1,0xba,0xaf}, {0x61,0xcc,0x86,0xcc,0x81}},
- {{0xe1,0xba,0xb5}, {0x61,0xcc,0x86,0xcc,0x83}},
- {{0xe1,0xba,0xb3}, {0x61,0xcc,0x86,0xcc,0x89}},
- {{0xc7,0xa1}, {0x61,0xcc,0x87,0xcc,0x84}},
- {{0xc3,0xa4}, {0x61,0xcc,0x88}},
- {{0xc7,0x9f}, {0x61,0xcc,0x88,0xcc,0x84}},
- {{0xe1,0xba,0xa3}, {0x61,0xcc,0x89}},
- {{0xc3,0xa5}, {0x61,0xcc,0x8a}},
- {{0xc7,0xbb}, {0x61,0xcc,0x8a,0xcc,0x81}},
- {{0xc7,0x8e}, {0x61,0xcc,0x8c}},
- {{0xc8,0x81}, {0x61,0xcc,0x8f}},
- {{0xc8,0x83}, {0x61,0xcc,0x91}},
- {{0xe1,0xba,0xa1}, {0x61,0xcc,0xa3}},
- {{0xe1,0xba,0xad}, {0x61,0xcc,0xa3,0xcc,0x82}},
- {{0xe1,0xba,0xb7}, {0x61,0xcc,0xa3,0xcc,0x86}},
- {{0xe1,0xb8,0x81}, {0x61,0xcc,0xa5}},
- {{0xc4,0x85}, {0x61,0xcc,0xa8}},
- {{0xe1,0xb8,0x83}, {0x62,0xcc,0x87}},
- {{0xe1,0xb8,0x85}, {0x62,0xcc,0xa3}},
- {{0xe1,0xb8,0x87}, {0x62,0xcc,0xb1}},
- {{0xc4,0x87}, {0x63,0xcc,0x81}},
- {{0xc4,0x89}, {0x63,0xcc,0x82}},
- {{0xc4,0x8b}, {0x63,0xcc,0x87}},
- {{0xc4,0x8d}, {0x63,0xcc,0x8c}},
- {{0xc3,0xa7}, {0x63,0xcc,0xa7}},
- {{0xe1,0xb8,0x89}, {0x63,0xcc,0xa7,0xcc,0x81}},
- {{0xe1,0xb8,0x8b}, {0x64,0xcc,0x87}},
- {{0xc4,0x8f}, {0x64,0xcc,0x8c}},
- {{0xe1,0xb8,0x8d}, {0x64,0xcc,0xa3}},
- {{0xe1,0xb8,0x91}, {0x64,0xcc,0xa7}},
- {{0xe1,0xb8,0x93}, {0x64,0xcc,0xad}},
- {{0xe1,0xb8,0x8f}, {0x64,0xcc,0xb1}},
- {{0xc3,0xa8}, {0x65,0xcc,0x80}},
- {{0xc3,0xa9}, {0x65,0xcc,0x81}},
- {{0xc3,0xaa}, {0x65,0xcc,0x82}},
- {{0xe1,0xbb,0x81}, {0x65,0xcc,0x82,0xcc,0x80}},
- {{0xe1,0xba,0xbf}, {0x65,0xcc,0x82,0xcc,0x81}},
- {{0xe1,0xbb,0x85}, {0x65,0xcc,0x82,0xcc,0x83}},
- {{0xe1,0xbb,0x83}, {0x65,0xcc,0x82,0xcc,0x89}},
- {{0xe1,0xba,0xbd}, {0x65,0xcc,0x83}},
- {{0xc4,0x93}, {0x65,0xcc,0x84}},
- {{0xe1,0xb8,0x95}, {0x65,0xcc,0x84,0xcc,0x80}},
- {{0xe1,0xb8,0x97}, {0x65,0xcc,0x84,0xcc,0x81}},
- {{0xc4,0x95}, {0x65,0xcc,0x86}},
- {{0xc4,0x97}, {0x65,0xcc,0x87}},
- {{0xc3,0xab}, {0x65,0xcc,0x88}},
- {{0xe1,0xba,0xbb}, {0x65,0xcc,0x89}},
- {{0xc4,0x9b}, {0x65,0xcc,0x8c}},
- {{0xc8,0x85}, {0x65,0xcc,0x8f}},
- {{0xc8,0x87}, {0x65,0xcc,0x91}},
- {{0xe1,0xba,0xb9}, {0x65,0xcc,0xa3}},
- {{0xe1,0xbb,0x87}, {0x65,0xcc,0xa3,0xcc,0x82}},
- {{0xe1,0xb8,0x9d}, {0x65,0xcc,0xa7,0xcc,0x86}},
- {{0xc4,0x99}, {0x65,0xcc,0xa8}},
- {{0xe1,0xb8,0x99}, {0x65,0xcc,0xad}},
- {{0xe1,0xb8,0x9b}, {0x65,0xcc,0xb0}},
- {{0xe1,0xb8,0x9f}, {0x66,0xcc,0x87}},
- {{0xc7,0xb5}, {0x67,0xcc,0x81}},
- {{0xc4,0x9d}, {0x67,0xcc,0x82}},
- {{0xe1,0xb8,0xa1}, {0x67,0xcc,0x84}},
- {{0xc4,0x9f}, {0x67,0xcc,0x86}},
- {{0xc4,0xa1}, {0x67,0xcc,0x87}},
- {{0xc7,0xa7}, {0x67,0xcc,0x8c}},
- {{0xc4,0xa3}, {0x67,0xcc,0xa7}},
- {{0xc4,0xa5}, {0x68,0xcc,0x82}},
- {{0xe1,0xb8,0xa3}, {0x68,0xcc,0x87}},
- {{0xe1,0xb8,0xa7}, {0x68,0xcc,0x88}},
- {{0xe1,0xb8,0xa5}, {0x68,0xcc,0xa3}},
- {{0xe1,0xb8,0xa9}, {0x68,0xcc,0xa7}},
- {{0xe1,0xb8,0xab}, {0x68,0xcc,0xae}},
- {{0xe1,0xba,0x96}, {0x68,0xcc,0xb1}},
- {{0xc3,0xac}, {0x69,0xcc,0x80}},
- {{0xc3,0xad}, {0x69,0xcc,0x81}},
- {{0xc3,0xae}, {0x69,0xcc,0x82}},
- {{0xc4,0xa9}, {0x69,0xcc,0x83}},
- {{0xc4,0xab}, {0x69,0xcc,0x84}},
- {{0xc4,0xad}, {0x69,0xcc,0x86}},
- {{0xc3,0xaf}, {0x69,0xcc,0x88}},
- {{0xe1,0xb8,0xaf}, {0x69,0xcc,0x88,0xcc,0x81}},
- {{0xe1,0xbb,0x89}, {0x69,0xcc,0x89}},
- {{0xc7,0x90}, {0x69,0xcc,0x8c}},
- {{0xc8,0x89}, {0x69,0xcc,0x8f}},
- {{0xc8,0x8b}, {0x69,0xcc,0x91}},
- {{0xe1,0xbb,0x8b}, {0x69,0xcc,0xa3}},
- {{0xc4,0xaf}, {0x69,0xcc,0xa8}},
- {{0xe1,0xb8,0xad}, {0x69,0xcc,0xb0}},
- {{0xc4,0xb5}, {0x6a,0xcc,0x82}},
- {{0xc7,0xb0}, {0x6a,0xcc,0x8c}},
- {{0xe1,0xb8,0xb1}, {0x6b,0xcc,0x81}},
- {{0xc7,0xa9}, {0x6b,0xcc,0x8c}},
- {{0xe1,0xb8,0xb3}, {0x6b,0xcc,0xa3}},
- {{0xc4,0xb7}, {0x6b,0xcc,0xa7}},
- {{0xe1,0xb8,0xb5}, {0x6b,0xcc,0xb1}},
- {{0xc4,0xba}, {0x6c,0xcc,0x81}},
- {{0xc4,0xbe}, {0x6c,0xcc,0x8c}},
- {{0xe1,0xb8,0xb7}, {0x6c,0xcc,0xa3}},
- {{0xe1,0xb8,0xb9}, {0x6c,0xcc,0xa3,0xcc,0x84}},
- {{0xc4,0xbc}, {0x6c,0xcc,0xa7}},
- {{0xe1,0xb8,0xbd}, {0x6c,0xcc,0xad}},
- {{0xe1,0xb8,0xbb}, {0x6c,0xcc,0xb1}},
- {{0xe1,0xb8,0xbf}, {0x6d,0xcc,0x81}},
- {{0xe1,0xb9,0x81}, {0x6d,0xcc,0x87}},
- {{0xe1,0xb9,0x83}, {0x6d,0xcc,0xa3}},
- {{0xc5,0x84}, {0x6e,0xcc,0x81}},
- {{0xc3,0xb1}, {0x6e,0xcc,0x83}},
- {{0xe1,0xb9,0x85}, {0x6e,0xcc,0x87}},
- {{0xc5,0x88}, {0x6e,0xcc,0x8c}},
- {{0xe1,0xb9,0x87}, {0x6e,0xcc,0xa3}},
- {{0xc5,0x86}, {0x6e,0xcc,0xa7}},
- {{0xe1,0xb9,0x8b}, {0x6e,0xcc,0xad}},
- {{0xe1,0xb9,0x89}, {0x6e,0xcc,0xb1}},
- {{0xc3,0xb2}, {0x6f,0xcc,0x80}},
- {{0xc3,0xb3}, {0x6f,0xcc,0x81}},
- {{0xc3,0xb4}, {0x6f,0xcc,0x82}},
- {{0xe1,0xbb,0x93}, {0x6f,0xcc,0x82,0xcc,0x80}},
- {{0xe1,0xbb,0x91}, {0x6f,0xcc,0x82,0xcc,0x81}},
- {{0xe1,0xbb,0x97}, {0x6f,0xcc,0x82,0xcc,0x83}},
- {{0xe1,0xbb,0x95}, {0x6f,0xcc,0x82,0xcc,0x89}},
- {{0xc3,0xb5}, {0x6f,0xcc,0x83}},
- {{0xe1,0xb9,0x8d}, {0x6f,0xcc,0x83,0xcc,0x81}},
- {{0xe1,0xb9,0x8f}, {0x6f,0xcc,0x83,0xcc,0x88}},
- {{0xc5,0x8d}, {0x6f,0xcc,0x84}},
- {{0xe1,0xb9,0x91}, {0x6f,0xcc,0x84,0xcc,0x80}},
- {{0xe1,0xb9,0x93}, {0x6f,0xcc,0x84,0xcc,0x81}},
- {{0xc5,0x8f}, {0x6f,0xcc,0x86}},
- {{0xc3,0xb6}, {0x6f,0xcc,0x88}},
- {{0xe1,0xbb,0x8f}, {0x6f,0xcc,0x89}},
- {{0xc5,0x91}, {0x6f,0xcc,0x8b}},
- {{0xc7,0x92}, {0x6f,0xcc,0x8c}},
- {{0xc8,0x8d}, {0x6f,0xcc,0x8f}},
- {{0xc8,0x8f}, {0x6f,0xcc,0x91}},
- {{0xc6,0xa1}, {0x6f,0xcc,0x9b}},
- {{0xe1,0xbb,0x9d}, {0x6f,0xcc,0x9b,0xcc,0x80}},
- {{0xe1,0xbb,0x9b}, {0x6f,0xcc,0x9b,0xcc,0x81}},
- {{0xe1,0xbb,0xa1}, {0x6f,0xcc,0x9b,0xcc,0x83}},
- {{0xe1,0xbb,0x9f}, {0x6f,0xcc,0x9b,0xcc,0x89}},
- {{0xe1,0xbb,0xa3}, {0x6f,0xcc,0x9b,0xcc,0xa3}},
- {{0xe1,0xbb,0x8d}, {0x6f,0xcc,0xa3}},
- {{0xe1,0xbb,0x99}, {0x6f,0xcc,0xa3,0xcc,0x82}},
- {{0xc7,0xab}, {0x6f,0xcc,0xa8}},
- {{0xc7,0xad}, {0x6f,0xcc,0xa8,0xcc,0x84}},
- {{0xe1,0xb9,0x95}, {0x70,0xcc,0x81}},
- {{0xe1,0xb9,0x97}, {0x70,0xcc,0x87}},
- {{0xc5,0x95}, {0x72,0xcc,0x81}},
- {{0xe1,0xb9,0x99}, {0x72,0xcc,0x87}},
- {{0xc5,0x99}, {0x72,0xcc,0x8c}},
- {{0xc8,0x91}, {0x72,0xcc,0x8f}},
- {{0xc8,0x93}, {0x72,0xcc,0x91}},
- {{0xe1,0xb9,0x9b}, {0x72,0xcc,0xa3}},
- {{0xe1,0xb9,0x9d}, {0x72,0xcc,0xa3,0xcc,0x84}},
- {{0xc5,0x97}, {0x72,0xcc,0xa7}},
- {{0xe1,0xb9,0x9f}, {0x72,0xcc,0xb1}},
- {{0xc5,0x9b}, {0x73,0xcc,0x81}},
- {{0xe1,0xb9,0xa5}, {0x73,0xcc,0x81,0xcc,0x87}},
- {{0xc5,0x9d}, {0x73,0xcc,0x82}},
- {{0xe1,0xb9,0xa1}, {0x73,0xcc,0x87}},
- {{0xc5,0xa1}, {0x73,0xcc,0x8c}},
- {{0xe1,0xb9,0xa7}, {0x73,0xcc,0x8c,0xcc,0x87}},
- {{0xe1,0xb9,0xa3}, {0x73,0xcc,0xa3}},
- {{0xe1,0xb9,0xa9}, {0x73,0xcc,0xa3,0xcc,0x87}},
- {{0xc5,0x9f}, {0x73,0xcc,0xa7}},
- {{0xe1,0xb9,0xab}, {0x74,0xcc,0x87}},
- {{0xe1,0xba,0x97}, {0x74,0xcc,0x88}},
- {{0xc5,0xa5}, {0x74,0xcc,0x8c}},
- {{0xe1,0xb9,0xad}, {0x74,0xcc,0xa3}},
- {{0xc5,0xa3}, {0x74,0xcc,0xa7}},
- {{0xe1,0xb9,0xb1}, {0x74,0xcc,0xad}},
- {{0xe1,0xb9,0xaf}, {0x74,0xcc,0xb1}},
- {{0xc3,0xb9}, {0x75,0xcc,0x80}},
- {{0xc3,0xba}, {0x75,0xcc,0x81}},
- {{0xc3,0xbb}, {0x75,0xcc,0x82}},
- {{0xc5,0xa9}, {0x75,0xcc,0x83}},
- {{0xe1,0xb9,0xb9}, {0x75,0xcc,0x83,0xcc,0x81}},
- {{0xc5,0xab}, {0x75,0xcc,0x84}},
- {{0xe1,0xb9,0xbb}, {0x75,0xcc,0x84,0xcc,0x88}},
- {{0xc5,0xad}, {0x75,0xcc,0x86}},
- {{0xc3,0xbc}, {0x75,0xcc,0x88}},
- {{0xc7,0x9c}, {0x75,0xcc,0x88,0xcc,0x80}},
- {{0xc7,0x98}, {0x75,0xcc,0x88,0xcc,0x81}},
- {{0xc7,0x96}, {0x75,0xcc,0x88,0xcc,0x84}},
- {{0xc7,0x9a}, {0x75,0xcc,0x88,0xcc,0x8c}},
- {{0xe1,0xbb,0xa7}, {0x75,0xcc,0x89}},
- {{0xc5,0xaf}, {0x75,0xcc,0x8a}},
- {{0xc5,0xb1}, {0x75,0xcc,0x8b}},
- {{0xc7,0x94}, {0x75,0xcc,0x8c}},
- {{0xc8,0x95}, {0x75,0xcc,0x8f}},
- {{0xc8,0x97}, {0x75,0xcc,0x91}},
- {{0xc6,0xb0}, {0x75,0xcc,0x9b}},
- {{0xe1,0xbb,0xab}, {0x75,0xcc,0x9b,0xcc,0x80}},
- {{0xe1,0xbb,0xa9}, {0x75,0xcc,0x9b,0xcc,0x81}},
- {{0xe1,0xbb,0xaf}, {0x75,0xcc,0x9b,0xcc,0x83}},
- {{0xe1,0xbb,0xad}, {0x75,0xcc,0x9b,0xcc,0x89}},
- {{0xe1,0xbb,0xb1}, {0x75,0xcc,0x9b,0xcc,0xa3}},
- {{0xe1,0xbb,0xa5}, {0x75,0xcc,0xa3}},
- {{0xe1,0xb9,0xb3}, {0x75,0xcc,0xa4}},
- {{0xc5,0xb3}, {0x75,0xcc,0xa8}},
- {{0xe1,0xb9,0xb7}, {0x75,0xcc,0xad}},
- {{0xe1,0xb9,0xb5}, {0x75,0xcc,0xb0}},
- {{0xe1,0xb9,0xbd}, {0x76,0xcc,0x83}},
- {{0xe1,0xb9,0xbf}, {0x76,0xcc,0xa3}},
- {{0xe1,0xba,0x81}, {0x77,0xcc,0x80}},
- {{0xe1,0xba,0x83}, {0x77,0xcc,0x81}},
- {{0xc5,0xb5}, {0x77,0xcc,0x82}},
- {{0xe1,0xba,0x87}, {0x77,0xcc,0x87}},
- {{0xe1,0xba,0x85}, {0x77,0xcc,0x88}},
- {{0xe1,0xba,0x98}, {0x77,0xcc,0x8a}},
- {{0xe1,0xba,0x89}, {0x77,0xcc,0xa3}},
- {{0xe1,0xba,0x8b}, {0x78,0xcc,0x87}},
- {{0xe1,0xba,0x8d}, {0x78,0xcc,0x88}},
- {{0xe1,0xbb,0xb3}, {0x79,0xcc,0x80}},
- {{0xc3,0xbd}, {0x79,0xcc,0x81}},
- {{0xc5,0xb7}, {0x79,0xcc,0x82}},
- {{0xe1,0xbb,0xb9}, {0x79,0xcc,0x83}},
- {{0xe1,0xba,0x8f}, {0x79,0xcc,0x87}},
- {{0xc3,0xbf}, {0x79,0xcc,0x88}},
- {{0xe1,0xbb,0xb7}, {0x79,0xcc,0x89}},
- {{0xe1,0xba,0x99}, {0x79,0xcc,0x8a}},
- {{0xe1,0xbb,0xb5}, {0x79,0xcc,0xa3}},
- {{0xc5,0xba}, {0x7a,0xcc,0x81}},
- {{0xe1,0xba,0x91}, {0x7a,0xcc,0x82}},
- {{0xc5,0xbc}, {0x7a,0xcc,0x87}},
- {{0xc5,0xbe}, {0x7a,0xcc,0x8c}},
- {{0xe1,0xba,0x93}, {0x7a,0xcc,0xa3}},
- {{0xe1,0xba,0x95}, {0x7a,0xcc,0xb1}},
- {{0xe1,0xbf,0xad}, {0xc2,0xa8,0xcc,0x80}},
- {{0xe1,0xbf,0xae}, {0xc2,0xa8,0xcc,0x81}},
- {{0xce,0x85}, {0xc2,0xa8,0xcc,0x8d}},
- {{0xe1,0xbf,0x81}, {0xc2,0xa8,0xcd,0x82}},
- {{0xe1,0xbf,0xbd}, {0xc2,0xb4}},
- {{0xce,0x87}, {0xc2,0xb7}},
- {{0xd3,0x94}, {0xc3,0x86}},
- {{0xc7,0xbc}, {0xc3,0x86,0xcc,0x81}},
- {{0xc7,0xa2}, {0xc3,0x86,0xcc,0x84}},
- {{0xc7,0xbe}, {0xc3,0x98,0xcc,0x81}},
- {{0xd3,0x95}, {0xc3,0xa6}},
- {{0xc7,0xbd}, {0xc3,0xa6,0xcc,0x81}},
- {{0xc7,0xa3}, {0xc3,0xa6,0xcc,0x84}},
- {{0xc7,0xbf}, {0xc3,0xb8,0xcc,0x81}},
- {{0xe1,0xba,0x9b}, {0xc5,0xbf,0xcc,0x87}},
- {{0xd3,0x98}, {0xc6,0x8f}},
- {{0xd3,0x9a}, {0xc6,0x8f,0xcc,0x88}},
- {{0xd3,0xa8}, {0xc6,0x9f}},
- {{0xd3,0xaa}, {0xc6,0x9f,0xcc,0x88}},
- {{0xd3,0xa0}, {0xc6,0xb7}},
- {{0xc7,0xae}, {0xc6,0xb7,0xcc,0x8c}},
- {{0xd3,0x99}, {0xc9,0x99}},
- {{0xd3,0x9b}, {0xc9,0x99,0xcc,0x88}},
- {{0xd3,0xa9}, {0xc9,0xb5}},
- {{0xd3,0xab}, {0xc9,0xb5,0xcc,0x88}},
- {{0xd3,0xa1}, {0xca,0x92}},
- {{0xc7,0xaf}, {0xca,0x92,0xcc,0x8c}},
- {{0xcd,0xb4}, {0xca,0xb9}},
- {{0xcd,0x80}, {0xcc,0x80}},
- {{0xcd,0x81}, {0xcc,0x81}},
- {{0xcc,0x90}, {0xcc,0x86,0xcc,0x87}},
- {{0xcd,0x84}, {0xcc,0x88,0xcc,0x8d}},
- {{0xcd,0x83}, {0xcc,0x93}},
- {{0xe1,0xbe,0xba}, {0xce,0x91,0xcc,0x80}},
- {{0xe1,0xbe,0xbb}, {0xce,0x91,0xcc,0x81}},
- {{0xe1,0xbe,0xb9}, {0xce,0x91,0xcc,0x84}},
- {{0xe1,0xbe,0xb8}, {0xce,0x91,0xcc,0x86}},
- {{0xce,0x86}, {0xce,0x91,0xcc,0x8d}},
- {{0xe1,0xbc,0x88}, {0xce,0x91,0xcc,0x93}},
- {{0xe1,0xbc,0x8a}, {0xce,0x91,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0x8c}, {0xce,0x91,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0x8e}, {0xce,0x91,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbc,0x89}, {0xce,0x91,0xcc,0x94}},
- {{0xe1,0xbc,0x8b}, {0xce,0x91,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0x8d}, {0xce,0x91,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbc,0x8f}, {0xce,0x91,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbe,0xbc}, {0xce,0x91,0xcd,0x85}},
- {{0xe1,0xbe,0x88}, {0xce,0x91,0xcd,0x85,0xcc,0x93}},
- {{0xe1,0xbe,0x8a}, {0xce,0x91,0xcd,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbe,0x8c}, {0xce,0x91,0xcd,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbe,0x8e}, {0xce,0x91,0xcd,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbe,0x89}, {0xce,0x91,0xcd,0x85,0xcc,0x94}},
- {{0xe1,0xbe,0x8b}, {0xce,0x91,0xcd,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbe,0x8d}, {0xce,0x91,0xcd,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbe,0x8f}, {0xce,0x91,0xcd,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0x88}, {0xce,0x95,0xcc,0x80}},
- {{0xe1,0xbf,0x89}, {0xce,0x95,0xcc,0x81}},
- {{0xce,0x88}, {0xce,0x95,0xcc,0x8d}},
- {{0xe1,0xbc,0x98}, {0xce,0x95,0xcc,0x93}},
- {{0xe1,0xbc,0x9a}, {0xce,0x95,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0x9c}, {0xce,0x95,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0x99}, {0xce,0x95,0xcc,0x94}},
- {{0xe1,0xbc,0x9b}, {0xce,0x95,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0x9d}, {0xce,0x95,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbf,0x8a}, {0xce,0x97,0xcc,0x80}},
- {{0xe1,0xbf,0x8b}, {0xce,0x97,0xcc,0x81}},
- {{0xce,0x89}, {0xce,0x97,0xcc,0x8d}},
- {{0xe1,0xbc,0xa8}, {0xce,0x97,0xcc,0x93}},
- {{0xe1,0xbc,0xaa}, {0xce,0x97,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0xac}, {0xce,0x97,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0xae}, {0xce,0x97,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbc,0xa9}, {0xce,0x97,0xcc,0x94}},
- {{0xe1,0xbc,0xab}, {0xce,0x97,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0xad}, {0xce,0x97,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbc,0xaf}, {0xce,0x97,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0x8c}, {0xce,0x97,0xcd,0x85}},
- {{0xe1,0xbe,0x98}, {0xce,0x97,0xcd,0x85,0xcc,0x93}},
- {{0xe1,0xbe,0x9a}, {0xce,0x97,0xcd,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbe,0x9c}, {0xce,0x97,0xcd,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbe,0x9e}, {0xce,0x97,0xcd,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbe,0x99}, {0xce,0x97,0xcd,0x85,0xcc,0x94}},
- {{0xe1,0xbe,0x9b}, {0xce,0x97,0xcd,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbe,0x9d}, {0xce,0x97,0xcd,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbe,0x9f}, {0xce,0x97,0xcd,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0x9a}, {0xce,0x99,0xcc,0x80}},
- {{0xe1,0xbf,0x9b}, {0xce,0x99,0xcc,0x81}},
- {{0xe1,0xbf,0x99}, {0xce,0x99,0xcc,0x84}},
- {{0xe1,0xbf,0x98}, {0xce,0x99,0xcc,0x86}},
- {{0xce,0xaa}, {0xce,0x99,0xcc,0x88}},
- {{0xce,0x8a}, {0xce,0x99,0xcc,0x8d}},
- {{0xe1,0xbc,0xb8}, {0xce,0x99,0xcc,0x93}},
- {{0xe1,0xbc,0xba}, {0xce,0x99,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0xbc}, {0xce,0x99,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0xbe}, {0xce,0x99,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbc,0xb9}, {0xce,0x99,0xcc,0x94}},
- {{0xe1,0xbc,0xbb}, {0xce,0x99,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0xbd}, {0xce,0x99,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbc,0xbf}, {0xce,0x99,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0xb8}, {0xce,0x9f,0xcc,0x80}},
- {{0xe1,0xbf,0xb9}, {0xce,0x9f,0xcc,0x81}},
- {{0xce,0x8c}, {0xce,0x9f,0xcc,0x8d}},
- {{0xe1,0xbd,0x88}, {0xce,0x9f,0xcc,0x93}},
- {{0xe1,0xbd,0x8a}, {0xce,0x9f,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbd,0x8c}, {0xce,0x9f,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbd,0x89}, {0xce,0x9f,0xcc,0x94}},
- {{0xe1,0xbd,0x8b}, {0xce,0x9f,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbd,0x8d}, {0xce,0x9f,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbf,0xac}, {0xce,0xa1,0xcc,0x94}},
- {{0xe1,0xbf,0xaa}, {0xce,0xa5,0xcc,0x80}},
- {{0xe1,0xbf,0xab}, {0xce,0xa5,0xcc,0x81}},
- {{0xe1,0xbf,0xa9}, {0xce,0xa5,0xcc,0x84}},
- {{0xe1,0xbf,0xa8}, {0xce,0xa5,0xcc,0x86}},
- {{0xce,0xab}, {0xce,0xa5,0xcc,0x88}},
- {{0xce,0x8e}, {0xce,0xa5,0xcc,0x8d}},
- {{0xe1,0xbd,0x99}, {0xce,0xa5,0xcc,0x94}},
- {{0xe1,0xbd,0x9b}, {0xce,0xa5,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbd,0x9d}, {0xce,0xa5,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbd,0x9f}, {0xce,0xa5,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0xba}, {0xce,0xa9,0xcc,0x80}},
- {{0xe1,0xbf,0xbb}, {0xce,0xa9,0xcc,0x81}},
- {{0xce,0x8f}, {0xce,0xa9,0xcc,0x8d}},
- {{0xe1,0xbd,0xa8}, {0xce,0xa9,0xcc,0x93}},
- {{0xe1,0xbd,0xaa}, {0xce,0xa9,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbd,0xac}, {0xce,0xa9,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbd,0xae}, {0xce,0xa9,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbd,0xa9}, {0xce,0xa9,0xcc,0x94}},
- {{0xe1,0xbd,0xab}, {0xce,0xa9,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbd,0xad}, {0xce,0xa9,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbd,0xaf}, {0xce,0xa9,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0xbc}, {0xce,0xa9,0xcd,0x85}},
- {{0xe1,0xbe,0xa8}, {0xce,0xa9,0xcd,0x85,0xcc,0x93}},
- {{0xe1,0xbe,0xaa}, {0xce,0xa9,0xcd,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbe,0xac}, {0xce,0xa9,0xcd,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbe,0xae}, {0xce,0xa9,0xcd,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbe,0xa9}, {0xce,0xa9,0xcd,0x85,0xcc,0x94}},
- {{0xe1,0xbe,0xab}, {0xce,0xa9,0xcd,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbe,0xad}, {0xce,0xa9,0xcd,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbe,0xaf}, {0xce,0xa9,0xcd,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbd,0xb0}, {0xce,0xb1,0xcc,0x80}},
- {{0xe1,0xbd,0xb1}, {0xce,0xb1,0xcc,0x81}},
- {{0xe1,0xbe,0xb1}, {0xce,0xb1,0xcc,0x84}},
- {{0xe1,0xbe,0xb0}, {0xce,0xb1,0xcc,0x86}},
- {{0xce,0xac}, {0xce,0xb1,0xcc,0x8d}},
- {{0xe1,0xbc,0x80}, {0xce,0xb1,0xcc,0x93}},
- {{0xe1,0xbc,0x82}, {0xce,0xb1,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0x84}, {0xce,0xb1,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0x86}, {0xce,0xb1,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbc,0x81}, {0xce,0xb1,0xcc,0x94}},
- {{0xe1,0xbc,0x83}, {0xce,0xb1,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0x85}, {0xce,0xb1,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbc,0x87}, {0xce,0xb1,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbe,0xb6}, {0xce,0xb1,0xcd,0x82}},
- {{0xe1,0xbe,0xb3}, {0xce,0xb1,0xcd,0x85}},
- {{0xe1,0xbe,0xb2}, {0xce,0xb1,0xcd,0x85,0xcc,0x80}},
- {{0xe1,0xbe,0xb4}, {0xce,0xb1,0xcd,0x85,0xcc,0x81}},
- {{0xe1,0xbe,0x80}, {0xce,0xb1,0xcd,0x85,0xcc,0x93}},
- {{0xe1,0xbe,0x82}, {0xce,0xb1,0xcd,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbe,0x84}, {0xce,0xb1,0xcd,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbe,0x86}, {0xce,0xb1,0xcd,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbe,0x81}, {0xce,0xb1,0xcd,0x85,0xcc,0x94}},
- {{0xe1,0xbe,0x83}, {0xce,0xb1,0xcd,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbe,0x85}, {0xce,0xb1,0xcd,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbe,0x87}, {0xce,0xb1,0xcd,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbe,0xb7}, {0xce,0xb1,0xcd,0x85,0xcd,0x82}},
- {{0xe1,0xbd,0xb2}, {0xce,0xb5,0xcc,0x80}},
- {{0xe1,0xbd,0xb3}, {0xce,0xb5,0xcc,0x81}},
- {{0xce,0xad}, {0xce,0xb5,0xcc,0x8d}},
- {{0xe1,0xbc,0x90}, {0xce,0xb5,0xcc,0x93}},
- {{0xe1,0xbc,0x92}, {0xce,0xb5,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0x94}, {0xce,0xb5,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0x91}, {0xce,0xb5,0xcc,0x94}},
- {{0xe1,0xbc,0x93}, {0xce,0xb5,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0x95}, {0xce,0xb5,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbd,0xb4}, {0xce,0xb7,0xcc,0x80}},
- {{0xe1,0xbd,0xb5}, {0xce,0xb7,0xcc,0x81}},
- {{0xce,0xae}, {0xce,0xb7,0xcc,0x8d}},
- {{0xe1,0xbc,0xa0}, {0xce,0xb7,0xcc,0x93}},
- {{0xe1,0xbc,0xa2}, {0xce,0xb7,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0xa4}, {0xce,0xb7,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0xa6}, {0xce,0xb7,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbc,0xa1}, {0xce,0xb7,0xcc,0x94}},
- {{0xe1,0xbc,0xa3}, {0xce,0xb7,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0xa5}, {0xce,0xb7,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbc,0xa7}, {0xce,0xb7,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0x86}, {0xce,0xb7,0xcd,0x82}},
- {{0xe1,0xbf,0x83}, {0xce,0xb7,0xcd,0x85}},
- {{0xe1,0xbf,0x82}, {0xce,0xb7,0xcd,0x85,0xcc,0x80}},
- {{0xe1,0xbf,0x84}, {0xce,0xb7,0xcd,0x85,0xcc,0x81}},
- {{0xe1,0xbe,0x90}, {0xce,0xb7,0xcd,0x85,0xcc,0x93}},
- {{0xe1,0xbe,0x92}, {0xce,0xb7,0xcd,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbe,0x94}, {0xce,0xb7,0xcd,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbe,0x96}, {0xce,0xb7,0xcd,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbe,0x91}, {0xce,0xb7,0xcd,0x85,0xcc,0x94}},
- {{0xe1,0xbe,0x93}, {0xce,0xb7,0xcd,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbe,0x95}, {0xce,0xb7,0xcd,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbe,0x97}, {0xce,0xb7,0xcd,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0x87}, {0xce,0xb7,0xcd,0x85,0xcd,0x82}},
- {{0xe1,0xbe,0xbe}, {0xce,0xb9}},
- {{0xe1,0xbd,0xb6}, {0xce,0xb9,0xcc,0x80}},
- {{0xe1,0xbd,0xb7}, {0xce,0xb9,0xcc,0x81}},
- {{0xe1,0xbf,0x91}, {0xce,0xb9,0xcc,0x84}},
- {{0xe1,0xbf,0x90}, {0xce,0xb9,0xcc,0x86}},
- {{0xcf,0x8a}, {0xce,0xb9,0xcc,0x88}},
- {{0xe1,0xbf,0x92}, {0xce,0xb9,0xcc,0x88,0xcc,0x80}},
- {{0xe1,0xbf,0x93}, {0xce,0xb9,0xcc,0x88,0xcc,0x81}},
- {{0xce,0x90}, {0xce,0xb9,0xcc,0x88,0xcc,0x8d}},
- {{0xe1,0xbf,0x97}, {0xce,0xb9,0xcc,0x88,0xcd,0x82}},
- {{0xce,0xaf}, {0xce,0xb9,0xcc,0x8d}},
- {{0xe1,0xbc,0xb0}, {0xce,0xb9,0xcc,0x93}},
- {{0xe1,0xbc,0xb2}, {0xce,0xb9,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbc,0xb4}, {0xce,0xb9,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbc,0xb6}, {0xce,0xb9,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbc,0xb1}, {0xce,0xb9,0xcc,0x94}},
- {{0xe1,0xbc,0xb3}, {0xce,0xb9,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbc,0xb5}, {0xce,0xb9,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbc,0xb7}, {0xce,0xb9,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0x96}, {0xce,0xb9,0xcd,0x82}},
- {{0xe1,0xbd,0xb8}, {0xce,0xbf,0xcc,0x80}},
- {{0xe1,0xbd,0xb9}, {0xce,0xbf,0xcc,0x81}},
- {{0xcf,0x8c}, {0xce,0xbf,0xcc,0x8d}},
- {{0xe1,0xbd,0x80}, {0xce,0xbf,0xcc,0x93}},
- {{0xe1,0xbd,0x82}, {0xce,0xbf,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbd,0x84}, {0xce,0xbf,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbd,0x81}, {0xce,0xbf,0xcc,0x94}},
- {{0xe1,0xbd,0x83}, {0xce,0xbf,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbd,0x85}, {0xce,0xbf,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbf,0xb4}, {0xce,0xbf,0xcd,0x85,0xcc,0x81}},
- {{0xe1,0xbf,0xa4}, {0xcf,0x81,0xcc,0x93}},
- {{0xe1,0xbf,0xa5}, {0xcf,0x81,0xcc,0x94}},
- {{0xe1,0xbd,0xba}, {0xcf,0x85,0xcc,0x80}},
- {{0xe1,0xbd,0xbb}, {0xcf,0x85,0xcc,0x81}},
- {{0xe1,0xbf,0xa1}, {0xcf,0x85,0xcc,0x84}},
- {{0xe1,0xbf,0xa0}, {0xcf,0x85,0xcc,0x86}},
- {{0xcf,0x8b}, {0xcf,0x85,0xcc,0x88}},
- {{0xe1,0xbf,0xa2}, {0xcf,0x85,0xcc,0x88,0xcc,0x80}},
- {{0xe1,0xbf,0xa3}, {0xcf,0x85,0xcc,0x88,0xcc,0x81}},
- {{0xce,0xb0}, {0xcf,0x85,0xcc,0x88,0xcc,0x8d}},
- {{0xe1,0xbf,0xa7}, {0xcf,0x85,0xcc,0x88,0xcd,0x82}},
- {{0xcf,0x8d}, {0xcf,0x85,0xcc,0x8d}},
- {{0xe1,0xbd,0x90}, {0xcf,0x85,0xcc,0x93}},
- {{0xe1,0xbd,0x92}, {0xcf,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbd,0x94}, {0xcf,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbd,0x96}, {0xcf,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbd,0x91}, {0xcf,0x85,0xcc,0x94}},
- {{0xe1,0xbd,0x93}, {0xcf,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbd,0x95}, {0xcf,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbd,0x97}, {0xcf,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0xa6}, {0xcf,0x85,0xcd,0x82}},
- {{0xe1,0xbd,0xbc}, {0xcf,0x89,0xcc,0x80}},
- {{0xe1,0xbd,0xbd}, {0xcf,0x89,0xcc,0x81}},
- {{0xcf,0x8e}, {0xcf,0x89,0xcc,0x8d}},
- {{0xe1,0xbd,0xa0}, {0xcf,0x89,0xcc,0x93}},
- {{0xe1,0xbd,0xa2}, {0xcf,0x89,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbd,0xa4}, {0xcf,0x89,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbd,0xa6}, {0xcf,0x89,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbd,0xa1}, {0xcf,0x89,0xcc,0x94}},
- {{0xe1,0xbd,0xa3}, {0xcf,0x89,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbd,0xa5}, {0xcf,0x89,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbd,0xa7}, {0xcf,0x89,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0xb6}, {0xcf,0x89,0xcd,0x82}},
- {{0xe1,0xbf,0xb3}, {0xcf,0x89,0xcd,0x85}},
- {{0xe1,0xbf,0xb2}, {0xcf,0x89,0xcd,0x85,0xcc,0x80}},
- {{0xe1,0xbe,0xa0}, {0xcf,0x89,0xcd,0x85,0xcc,0x93}},
- {{0xe1,0xbe,0xa2}, {0xcf,0x89,0xcd,0x85,0xcc,0x93,0xcc,0x80}},
- {{0xe1,0xbe,0xa4}, {0xcf,0x89,0xcd,0x85,0xcc,0x93,0xcc,0x81}},
- {{0xe1,0xbe,0xa6}, {0xcf,0x89,0xcd,0x85,0xcc,0x93,0xcd,0x82}},
- {{0xe1,0xbe,0xa1}, {0xcf,0x89,0xcd,0x85,0xcc,0x94}},
- {{0xe1,0xbe,0xa3}, {0xcf,0x89,0xcd,0x85,0xcc,0x94,0xcc,0x80}},
- {{0xe1,0xbe,0xa5}, {0xcf,0x89,0xcd,0x85,0xcc,0x94,0xcc,0x81}},
- {{0xe1,0xbe,0xa7}, {0xcf,0x89,0xcd,0x85,0xcc,0x94,0xcd,0x82}},
- {{0xe1,0xbf,0xb7}, {0xcf,0x89,0xcd,0x85,0xcd,0x82}},
- {{0xcf,0x94}, {0xcf,0x92,0xcc,0x88}},
- {{0xcf,0x93}, {0xcf,0x92,0xcc,0x8d}},
- {{0xd0,0x87}, {0xd0,0x86,0xcc,0x88}},
- {{0xd3,0x90}, {0xd0,0x90,0xcc,0x86}},
- {{0xd3,0x92}, {0xd0,0x90,0xcc,0x88}},
- {{0xd0,0x83}, {0xd0,0x93,0xcc,0x81}},
- {{0xd3,0x96}, {0xd0,0x95,0xcc,0x86}},
- {{0xd0,0x81}, {0xd0,0x95,0xcc,0x88}},
- {{0xd3,0x81}, {0xd0,0x96,0xcc,0x86}},
- {{0xd3,0x9c}, {0xd0,0x96,0xcc,0x88}},
- {{0xd3,0x9e}, {0xd0,0x97,0xcc,0x88}},
- {{0xd3,0xa2}, {0xd0,0x98,0xcc,0x84}},
- {{0xd0,0x99}, {0xd0,0x98,0xcc,0x86}},
- {{0xd3,0xa4}, {0xd0,0x98,0xcc,0x88}},
- {{0xd0,0x8c}, {0xd0,0x9a,0xcc,0x81}},
- {{0xd3,0xa6}, {0xd0,0x9e,0xcc,0x88}},
- {{0xd3,0xae}, {0xd0,0xa3,0xcc,0x84}},
- {{0xd0,0x8e}, {0xd0,0xa3,0xcc,0x86}},
- {{0xd3,0xb0}, {0xd0,0xa3,0xcc,0x88}},
- {{0xd3,0xb2}, {0xd0,0xa3,0xcc,0x8b}},
- {{0xd3,0xb4}, {0xd0,0xa7,0xcc,0x88}},
- {{0xd3,0xb8}, {0xd0,0xab,0xcc,0x88}},
- {{0xd3,0x91}, {0xd0,0xb0,0xcc,0x86}},
- {{0xd3,0x93}, {0xd0,0xb0,0xcc,0x88}},
- {{0xd1,0x93}, {0xd0,0xb3,0xcc,0x81}},
- {{0xd3,0x97}, {0xd0,0xb5,0xcc,0x86}},
- {{0xd1,0x91}, {0xd0,0xb5,0xcc,0x88}},
- {{0xd3,0x82}, {0xd0,0xb6,0xcc,0x86}},
- {{0xd3,0x9d}, {0xd0,0xb6,0xcc,0x88}},
- {{0xd3,0x9f}, {0xd0,0xb7,0xcc,0x88}},
- {{0xd3,0xa3}, {0xd0,0xb8,0xcc,0x84}},
- {{0xd0,0xb9}, {0xd0,0xb8,0xcc,0x86}},
- {{0xd3,0xa5}, {0xd0,0xb8,0xcc,0x88}},
- {{0xd1,0x9c}, {0xd0,0xba,0xcc,0x81}},
- {{0xd3,0xa7}, {0xd0,0xbe,0xcc,0x88}},
- {{0xd3,0xaf}, {0xd1,0x83,0xcc,0x84}},
- {{0xd1,0x9e}, {0xd1,0x83,0xcc,0x86}},
- {{0xd3,0xb1}, {0xd1,0x83,0xcc,0x88}},
- {{0xd3,0xb3}, {0xd1,0x83,0xcc,0x8b}},
- {{0xd3,0xb5}, {0xd1,0x87,0xcc,0x88}},
- {{0xd3,0xb9}, {0xd1,0x8b,0xcc,0x88}},
- {{0xd1,0x97}, {0xd1,0x96,0xcc,0x88}},
- {{0xd1,0xb6}, {0xd1,0xb4,0xcc,0x8f}},
- {{0xd1,0xb7}, {0xd1,0xb5,0xcc,0x8f}},
- {{0xef,0xac,0xae}, {0xd7,0x90,0xd6,0xb7}},
- {{0xef,0xac,0xaf}, {0xd7,0x90,0xd6,0xb8}},
- {{0xef,0xac,0xb0}, {0xd7,0x90,0xd6,0xbc}},
- {{0xef,0xac,0xb1}, {0xd7,0x91,0xd6,0xbc}},
- {{0xef,0xad,0x8c}, {0xd7,0x91,0xd6,0xbf}},
- {{0xef,0xac,0xb2}, {0xd7,0x92,0xd6,0xbc}},
- {{0xef,0xac,0xb3}, {0xd7,0x93,0xd6,0xbc}},
- {{0xef,0xac,0xb4}, {0xd7,0x94,0xd6,0xbc}},
- {{0xef,0xad,0x8b}, {0xd7,0x95,0xd6,0xb9}},
- {{0xef,0xac,0xb5}, {0xd7,0x95,0xd6,0xbc}},
- {{0xef,0xac,0xb6}, {0xd7,0x96,0xd6,0xbc}},
- {{0xef,0xac,0xb8}, {0xd7,0x98,0xd6,0xbc}},
- {{0xef,0xac,0xb9}, {0xd7,0x99,0xd6,0xbc}},
- {{0xef,0xac,0xba}, {0xd7,0x9a,0xd6,0xbc}},
- {{0xef,0xac,0xbb}, {0xd7,0x9b,0xd6,0xbc}},
- {{0xef,0xad,0x8d}, {0xd7,0x9b,0xd6,0xbf}},
- {{0xef,0xac,0xbc}, {0xd7,0x9c,0xd6,0xbc}},
- {{0xef,0xac,0xbe}, {0xd7,0x9e,0xd6,0xbc}},
- {{0xef,0xad,0x80}, {0xd7,0xa0,0xd6,0xbc}},
- {{0xef,0xad,0x81}, {0xd7,0xa1,0xd6,0xbc}},
- {{0xef,0xad,0x83}, {0xd7,0xa3,0xd6,0xbc}},
- {{0xef,0xad,0x84}, {0xd7,0xa4,0xd6,0xbc}},
- {{0xef,0xad,0x8e}, {0xd7,0xa4,0xd6,0xbf}},
- {{0xef,0xad,0x86}, {0xd7,0xa6,0xd6,0xbc}},
- {{0xef,0xad,0x87}, {0xd7,0xa7,0xd6,0xbc}},
- {{0xef,0xad,0x88}, {0xd7,0xa8,0xd6,0xbc}},
- {{0xef,0xad,0x89}, {0xd7,0xa9,0xd6,0xbc}},
- {{0xef,0xac,0xac}, {0xd7,0xa9,0xd6,0xbc,0xd7,0x81}},
- {{0xef,0xac,0xad}, {0xd7,0xa9,0xd6,0xbc,0xd7,0x82}},
- {{0xef,0xac,0xaa}, {0xd7,0xa9,0xd7,0x81}},
- {{0xef,0xac,0xab}, {0xd7,0xa9,0xd7,0x82}},
- {{0xef,0xad,0x8a}, {0xd7,0xaa,0xd6,0xbc}},
- {{0xef,0xac,0x9f}, {0xd7,0xb2,0xd6,0xb7}},
- {{0xe0,0xa5,0x98}, {0xe0,0xa4,0x95,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x99}, {0xe0,0xa4,0x96,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x9a}, {0xe0,0xa4,0x97,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x9b}, {0xe0,0xa4,0x9c,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x9c}, {0xe0,0xa4,0xa1,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x9d}, {0xe0,0xa4,0xa2,0xe0,0xa4,0xbc}},
- {{0xe0,0xa4,0xa9}, {0xe0,0xa4,0xa8,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x9e}, {0xe0,0xa4,0xab,0xe0,0xa4,0xbc}},
- {{0xe0,0xa5,0x9f}, {0xe0,0xa4,0xaf,0xe0,0xa4,0xbc}},
- {{0xe0,0xa4,0xb1}, {0xe0,0xa4,0xb0,0xe0,0xa4,0xbc}},
- {{0xe0,0xa4,0xb4}, {0xe0,0xa4,0xb3,0xe0,0xa4,0xbc}},
- {{0xe0,0xa7,0x9c}, {0xe0,0xa6,0xa1,0xe0,0xa6,0xbc}},
- {{0xe0,0xa7,0x9d}, {0xe0,0xa6,0xa2,0xe0,0xa6,0xbc}},
- {{0xe0,0xa6,0xb0}, {0xe0,0xa6,0xac,0xe0,0xa6,0xbc}},
- {{0xe0,0xa7,0x9f}, {0xe0,0xa6,0xaf,0xe0,0xa6,0xbc}},
- {{0xe0,0xa7,0x8b}, {0xe0,0xa7,0x87,0xe0,0xa6,0xbe}},
- {{0xe0,0xa7,0x8c}, {0xe0,0xa7,0x87,0xe0,0xa7,0x97}},
- {{0xe0,0xa9,0x99}, {0xe0,0xa8,0x96,0xe0,0xa8,0xbc}},
- {{0xe0,0xa9,0x9a}, {0xe0,0xa8,0x97,0xe0,0xa8,0xbc}},
- {{0xe0,0xa9,0x9b}, {0xe0,0xa8,0x9c,0xe0,0xa8,0xbc}},
- {{0xe0,0xa9,0x9c}, {0xe0,0xa8,0xa1,0xe0,0xa8,0xbc}},
- {{0xe0,0xa9,0x9e}, {0xe0,0xa8,0xab,0xe0,0xa8,0xbc}},
- {{0xe0,0xad,0x9c}, {0xe0,0xac,0xa1,0xe0,0xac,0xbc}},
- {{0xe0,0xad,0x9d}, {0xe0,0xac,0xa2,0xe0,0xac,0xbc}},
- {{0xe0,0xad,0x9f}, {0xe0,0xac,0xaf,0xe0,0xac,0xbc}},
- {{0xe0,0xad,0x8b}, {0xe0,0xad,0x87,0xe0,0xac,0xbe}},
- {{0xe0,0xad,0x88}, {0xe0,0xad,0x87,0xe0,0xad,0x96}},
- {{0xe0,0xad,0x8c}, {0xe0,0xad,0x87,0xe0,0xad,0x97}},
- {{0xe0,0xae,0x94}, {0xe0,0xae,0x92,0xe0,0xaf,0x97}},
- {{0xe0,0xaf,0x8a}, {0xe0,0xaf,0x86,0xe0,0xae,0xbe}},
- {{0xe0,0xaf,0x8c}, {0xe0,0xaf,0x86,0xe0,0xaf,0x97}},
- {{0xe0,0xaf,0x8b}, {0xe0,0xaf,0x87,0xe0,0xae,0xbe}},
- {{0xe0,0xb1,0x88}, {0xe0,0xb1,0x86,0xe0,0xb1,0x96}},
- {{0xe0,0xb3,0x80}, {0xe0,0xb2,0xbf,0xe0,0xb3,0x95}},
- {{0xe0,0xb3,0x8a}, {0xe0,0xb3,0x86,0xe0,0xb3,0x82}},
- {{0xe0,0xb3,0x8b}, {0xe0,0xb3,0x86,0xe0,0xb3,0x82,0xe0,0xb3,0x95}},
- {{0xe0,0xb3,0x87}, {0xe0,0xb3,0x86,0xe0,0xb3,0x95}},
- {{0xe0,0xb3,0x88}, {0xe0,0xb3,0x86,0xe0,0xb3,0x96}},
- {{0xe0,0xb5,0x8a}, {0xe0,0xb5,0x86,0xe0,0xb4,0xbe}},
- {{0xe0,0xb5,0x8c}, {0xe0,0xb5,0x86,0xe0,0xb5,0x97}},
- {{0xe0,0xb5,0x8b}, {0xe0,0xb5,0x87,0xe0,0xb4,0xbe}},
- {{0xe0,0xb8,0xb3}, {0xe0,0xb9,0x8d,0xe0,0xb8,0xb2}},
- {{0xe0,0xba,0xb3}, {0xe0,0xbb,0x8d,0xe0,0xba,0xb2}},
- {{0xe0,0xbd,0xa9}, {0xe0,0xbd,0x80,0xe0,0xbe,0xb5}},
- {{0xe0,0xbd,0x83}, {0xe0,0xbd,0x82,0xe0,0xbe,0xb7}},
- {{0xe0,0xbd,0x8d}, {0xe0,0xbd,0x8c,0xe0,0xbe,0xb7}},
- {{0xe0,0xbd,0x92}, {0xe0,0xbd,0x91,0xe0,0xbe,0xb7}},
- {{0xe0,0xbd,0x97}, {0xe0,0xbd,0x96,0xe0,0xbe,0xb7}},
- {{0xe0,0xbd,0x9c}, {0xe0,0xbd,0x9b,0xe0,0xbe,0xb7}},
- {{0xe0,0xbd,0xb3}, {0xe0,0xbd,0xb2,0xe0,0xbd,0xb1}},
- {{0xe0,0xbd,0xb5}, {0xe0,0xbd,0xb4,0xe0,0xbd,0xb1}},
- {{0xe0,0xbe,0x81}, {0xe0,0xbe,0x80,0xe0,0xbd,0xb1}},
- {{0xe0,0xbe,0xb9}, {0xe0,0xbe,0x90,0xe0,0xbe,0xb5}},
- {{0xe0,0xbe,0x93}, {0xe0,0xbe,0x92,0xe0,0xbe,0xb7}},
- {{0xe0,0xbe,0x9d}, {0xe0,0xbe,0x9c,0xe0,0xbe,0xb7}},
- {{0xe0,0xbe,0xa2}, {0xe0,0xbe,0xa1,0xe0,0xbe,0xb7}},
- {{0xe0,0xbe,0xa7}, {0xe0,0xbe,0xa6,0xe0,0xbe,0xb7}},
- {{0xe0,0xbe,0xac}, {0xe0,0xbe,0xab,0xe0,0xbe,0xb7}},
- {{0xe0,0xbd,0xb6}, {0xe0,0xbe,0xb2,0xe0,0xbe,0x80}},
- {{0xe0,0xbd,0xb7}, {0xe0,0xbe,0xb2,0xe0,0xbe,0x80,0xe0,0xbd,0xb1}},
- {{0xe0,0xbd,0xb8}, {0xe0,0xbe,0xb3,0xe0,0xbe,0x80}},
- {{0xe0,0xbd,0xb9}, {0xe0,0xbe,0xb3,0xe0,0xbe,0x80,0xe0,0xbd,0xb1}},
- {{0xe1,0xbf,0x8d}, {0xe1,0xbe,0xbf,0xcc,0x80}},
- {{0xe1,0xbf,0x8e}, {0xe1,0xbe,0xbf,0xcc,0x81}},
- {{0xe1,0xbf,0x8f}, {0xe1,0xbe,0xbf,0xcd,0x82}},
- {{0xe1,0xbf,0x9d}, {0xe1,0xbf,0xbe,0xcc,0x80}},
- {{0xe1,0xbf,0x9e}, {0xe1,0xbf,0xbe,0xcc,0x81}},
- {{0xe1,0xbf,0x9f}, {0xe1,0xbf,0xbe,0xcd,0x82}},
- {{0xe3,0x82,0x94}, {0xe3,0x81,0x86,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x8c}, {0xe3,0x81,0x8b,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x8e}, {0xe3,0x81,0x8d,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x90}, {0xe3,0x81,0x8f,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x92}, {0xe3,0x81,0x91,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x94}, {0xe3,0x81,0x93,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x96}, {0xe3,0x81,0x95,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x98}, {0xe3,0x81,0x97,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x9a}, {0xe3,0x81,0x99,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x9c}, {0xe3,0x81,0x9b,0xe3,0x82,0x99}},
- {{0xe3,0x81,0x9e}, {0xe3,0x81,0x9d,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xa0}, {0xe3,0x81,0x9f,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xa2}, {0xe3,0x81,0xa1,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xa5}, {0xe3,0x81,0xa4,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xa7}, {0xe3,0x81,0xa6,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xa9}, {0xe3,0x81,0xa8,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xb0}, {0xe3,0x81,0xaf,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xb1}, {0xe3,0x81,0xaf,0xe3,0x82,0x9a}},
- {{0xe3,0x81,0xb3}, {0xe3,0x81,0xb2,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xb4}, {0xe3,0x81,0xb2,0xe3,0x82,0x9a}},
- {{0xe3,0x81,0xb6}, {0xe3,0x81,0xb5,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xb7}, {0xe3,0x81,0xb5,0xe3,0x82,0x9a}},
- {{0xe3,0x81,0xb9}, {0xe3,0x81,0xb8,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xba}, {0xe3,0x81,0xb8,0xe3,0x82,0x9a}},
- {{0xe3,0x81,0xbc}, {0xe3,0x81,0xbb,0xe3,0x82,0x99}},
- {{0xe3,0x81,0xbd}, {0xe3,0x81,0xbb,0xe3,0x82,0x9a}},
- {{0xe3,0x82,0x9e}, {0xe3,0x82,0x9d,0xe3,0x82,0x99}},
- {{0xe3,0x83,0xb4}, {0xe3,0x82,0xa6,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xac}, {0xe3,0x82,0xab,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xae}, {0xe3,0x82,0xad,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xb0}, {0xe3,0x82,0xaf,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xb2}, {0xe3,0x82,0xb1,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xb4}, {0xe3,0x82,0xb3,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xb6}, {0xe3,0x82,0xb5,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xb8}, {0xe3,0x82,0xb7,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xba}, {0xe3,0x82,0xb9,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xbc}, {0xe3,0x82,0xbb,0xe3,0x82,0x99}},
- {{0xe3,0x82,0xbe}, {0xe3,0x82,0xbd,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x80}, {0xe3,0x82,0xbf,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x82}, {0xe3,0x83,0x81,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x85}, {0xe3,0x83,0x84,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x87}, {0xe3,0x83,0x86,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x89}, {0xe3,0x83,0x88,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x90}, {0xe3,0x83,0x8f,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x91}, {0xe3,0x83,0x8f,0xe3,0x82,0x9a}},
- {{0xe3,0x83,0x93}, {0xe3,0x83,0x92,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x94}, {0xe3,0x83,0x92,0xe3,0x82,0x9a}},
- {{0xe3,0x83,0x96}, {0xe3,0x83,0x95,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x97}, {0xe3,0x83,0x95,0xe3,0x82,0x9a}},
- {{0xe3,0x83,0x99}, {0xe3,0x83,0x98,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x9a}, {0xe3,0x83,0x98,0xe3,0x82,0x9a}},
- {{0xe3,0x83,0x9c}, {0xe3,0x83,0x9b,0xe3,0x82,0x99}},
- {{0xe3,0x83,0x9d}, {0xe3,0x83,0x9b,0xe3,0x82,0x9a}},
- {{0xe3,0x83,0xb7}, {0xe3,0x83,0xaf,0xe3,0x82,0x99}},
- {{0xe3,0x83,0xb8}, {0xe3,0x83,0xb0,0xe3,0x82,0x99}},
- {{0xe3,0x83,0xb9}, {0xe3,0x83,0xb1,0xe3,0x82,0x99}},
- {{0xe3,0x83,0xba}, {0xe3,0x83,0xb2,0xe3,0x82,0x99}},
- {{0xe3,0x83,0xbe}, {0xe3,0x83,0xbd,0xe3,0x82,0x99}},
-};
-#endif /* UNICODE_NORMALIZATION */
#endif /* UTF8_INPUT_ENABLE */
#ifdef SHIFTJIS_CP932
-const unsigned short shiftjis_cp932[3][189] = {
+unsigned short shiftjis_cp932[3][189] = {
{
0xEEEF, 0xEEF0, 0xEEF1, 0xEEF2, 0xEEF3, 0xEEF4, 0xEEF5, 0xEEF6,
0xEEF7, 0xEEF8, 0x8754, 0x8755, 0x8756, 0x8757, 0x8758, 0x8759,
@@ -7493,7 +5315,7 @@ const unsigned short shiftjis_cp932[3][189] = {
0, 0, 0, 0, 0,
},
};
-const unsigned short cp932inv[2][189] = {
+unsigned short cp932inv[2][189] = {
{
0xFA5C, 0xFA5D, 0xFA5E, 0xFA5F, 0xFA60, 0xFA61, 0xFA62, 0xFA63,
0xFA64, 0xFA65, 0xFA66, 0xFA67, 0xFA68, 0xFA69, 0xFA6A, 0xFA6B,
@@ -7547,954 +5369,5 @@ const unsigned short cp932inv[2][189] = {
0xFA49, 0, 0xFA55, 0xFA56, 0xFA57,
},
};
-#endif /* SHIFTJIS_CP932 */
-
-#ifdef X0212_ENABLE
-const unsigned short shiftjis_x0212[3][189] = {
- {
- 0xF373, 0xF374, 0xF375, 0xF376, 0xF377, 0xF378, 0xF379, 0xF37A,
- 0xF37B, 0xF37C, 0xF37D, 0xF37E, 0xF421, 0xF422, 0xF423, 0xF424,
- 0xF425, 0xF426, 0xF427, 0xF428, 0x224C, 0xA243, 0xF429, 0xF42A,
- 0xF42B, 0xF42C, 0xF42D, 0x2268, 0xD463, 0xDC5F, 0xE469, 0xE378,
- 0xD921, 0xB13B, 0xF42E, 0xC22D, 0xC37C, 0xE450, 0xC23F, 0xBC74,
- 0xB029, 0xB048, 0xF42F, 0xB052, 0xB054, 0xB063, 0xB06E, 0xB127,
- 0xB123, 0xB12C, 0xB129, 0xB13E, 0xB15F, 0xB158, 0xB148, 0xB157,
- 0xB163, 0xB174, 0xB161, 0xB223, 0xF430, 0xB23B, 0xB266, 0,
- 0xB26D, 0xB275, 0xB27C, 0xF431, 0xB335, 0xB358, 0xB35B, 0xB365,
- 0xB36E, 0xB37B, 0xF432, 0xF433, 0xB440, 0xB447, 0xB450, 0xB45E,
- 0xF434, 0xB52A, 0xF435, 0xB52F, 0xB544, 0xB568, 0xF436, 0xB742,
- 0xB764, 0xB768, 0xB767, 0xF437, 0xF438, 0xF439, 0xB84E, 0xB861,
- 0xB875, 0xB877, 0xB878, 0xB87C, 0xB92F, 0xB937, 0xBA3E, 0xBA5B,
- 0xCD2A, 0xBA61, 0xF43A, 0xBA6B, 0xBB33, 0xBB38, 0xF43B, 0xBB4A,
- 0xF43C, 0xF43D, 0xBB50, 0xBB5E, 0xBB74, 0xBB75, 0xBB79, 0xBC64,
- 0xBC6D, 0xBC7E, 0xF43E, 0xBD42, 0xBD67, 0xF43F, 0xBD70, 0xBE30,
- 0xBE2C, 0xF440, 0xBE33, 0xBE3D, 0xBE4D, 0xBE49, 0xBE64, 0xBF28,
- 0xBF49, 0xC044, 0xC064, 0xC074, 0xC126, 0xF441, 0xC175, 0xC17C,
- 0xF442, 0xC178, 0xC22B, 0xC221, 0xC225, 0xF443, 0xC238, 0xC23A,
- 0xF444, 0xC244, 0xC252, 0xC257, 0xC25B, 0xC25E, 0xC26D, 0xC270,
- 0xF445, 0xC321, 0xC335, 0xC349, 0xC339, 0xF446, 0xC358, 0xC37E,
- 0xF447, 0xC44C, 0xF448, 0xC459, 0xC46A, 0xC47D, 0xF449, 0xC527,
- 0xC535, 0xC536, 0xF44A, 0xC555, 0xC638, 0xC657, 0xC660, 0xC66A,
- 0xC663, 0xC721, 0xC72B, 0xC747, 0xC743,
- },
- {
- 0xC74B, 0xC74F, 0xC759, 0xF44B, 0xF44C, 0xC766, 0xC76E, 0xC77C,
- 0xC76B, 0xC770, 0xC831, 0xC865, 0xC878, 0xC926, 0xC92B, 0xC92D,
- 0xF44D, 0xC94A, 0xC953, 0xC969, 0xC963, 0xC97C, 0xC974, 0xC975,
- 0xF44E, 0xCA33, 0xCA3D, 0xCA6F, 0xCA71, 0xCB2E, 0xF44F, 0xCB4A,
- 0xCB66, 0xCB6A, 0xCB70, 0xCB74, 0xCB6E, 0xCC25, 0xCB79, 0xCC2B,
- 0xCC2E, 0xCC2D, 0xCC32, 0xCC42, 0xCC50, 0xCC59, 0xF450, 0xCD3B,
- 0xF451, 0xCE3B, 0xF452, 0xCE3A, 0xCE43, 0xF453, 0xCE72, 0xB35D,
- 0xCF55, 0xCF62, 0xCF69, 0xCF6D, 0xF454, 0xF455, 0xF456, 0,
- 0xF457, 0xD065, 0xF458, 0xD069, 0xD168, 0xF459, 0xF45A, 0xD16C,
- 0xD23B, 0xF45B, 0xD361, 0xD368, 0xD427, 0xF45C, 0xF45D, 0xD454,
- 0xD472, 0xD52E, 0xF45E, 0xD75E, 0xF45F, 0xD822, 0xD837, 0xD841,
- 0xD851, 0xD874, 0xD946, 0xD948, 0xD951, 0xF460, 0xF461, 0xF462,
- 0xF463, 0xF464, 0xDC53, 0xDD48, 0xDD54, 0xDD6A, 0xDD7A, 0xDE24,
- 0xDE30, 0xF465, 0xDE35, 0xDE4B, 0xF466, 0xDF39, 0xF467, 0xDF43,
- 0xF468, 0xF469, 0xE059, 0xF46A, 0xF46B, 0xE162, 0xF46C, 0xF46D,
- 0xF46E, 0xE247, 0xE328, 0xE326, 0xE329, 0xE32F, 0xE330, 0xE32A,
- 0xE32B, 0xE33C, 0xE341, 0xE33F, 0xE355, 0xE358, 0xE356, 0xE35F,
- 0xE363, 0xE361, 0xE354, 0xE369, 0xE426, 0xE371, 0xE372, 0xE44B,
- 0xE441, 0xE443, 0xE43E, 0xF46F, 0xE440, 0xE447, 0xE43F, 0xE460,
- 0xE45E, 0xE451, 0xF470, 0xE45C, 0xE452, 0xE45B, 0xE454, 0xE47A,
- 0xE46F, 0xE533, 0xE53F, 0xE549, 0xE550, 0xE562, 0xE56A, 0xE56B,
- 0xF471, 0xF472, 0xF473, 0xE668, 0xE66F, 0xE72C, 0xF474, 0xE72E,
- 0xF475, 0xE731, 0xF476, 0xE732, 0xE831, 0xE836, 0xF477, 0xF478,
- 0xE85D, 0xF479, 0xF47A, 0xE951, 0xF47B,
- },
- {
- 0xE96D, 0xEA4D, 0xF47C, 0xEA5B, 0xEA66, 0xEA6A, 0xEB25, 0xEB7B,
- 0xEB7A, 0xF47D, 0xEC56, 0xF47E, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- },
-};
-
-const unsigned short x0212_shiftjis_A2[] = {
- 0x819F, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x8143, 0, 0, 0x8150, 0, 0, 0x8160,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA55, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B0[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFA68, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFA69, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFA6B, 0, 0xFA6C, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA6D, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFA6E, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B1[] = {
- 0, 0, 0xFA70, 0, 0, 0, 0xFA6F,
- 0, 0xFA72, 0, 0, 0xFA71, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA61, 0, 0, 0xFA73, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFA76, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFA77,
- 0xFA75, 0, 0, 0, 0, 0, 0, 0xFA74,
- 0, 0xFA7A, 0, 0xFA78, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFA79, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B2[] = {
- 0, 0, 0xFA7B, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA7D, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFA7E, 0,
- 0, 0, 0, 0, 0, 0xFA80, 0, 0,
- 0, 0, 0, 0, 0, 0xFA81, 0, 0,
- 0, 0, 0, 0, 0xFA82, 0, 0,
-};
-const unsigned short x0212_shiftjis_B3[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFA84, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFA85, 0, 0, 0xFA86, 0, 0xFB77, 0, 0,
- 0, 0, 0, 0, 0, 0xFA87, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFA88, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA89, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B4[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFA8C, 0, 0, 0, 0, 0, 0, 0xFA8D,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFA8E, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFA8F, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B5[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFA91, 0, 0, 0, 0, 0xFA93,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFA94, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFA95, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B7[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFA97, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFA98, 0, 0, 0xFA9A,
- 0xFA99, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_B8[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFA9E, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFA9F, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAA0, 0, 0xFAA1,
- 0xFAA2, 0, 0, 0, 0xFAA3, 0, 0,
-};
-const unsigned short x0212_shiftjis_B9[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFAA4,
- 0, 0, 0, 0, 0, 0, 0, 0xFAA5,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_BA[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFAA6, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFAA7, 0, 0, 0, 0,
- 0, 0xFAA9, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFAAB, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_BB[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFAAC, 0, 0, 0, 0,
- 0xFAAD, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFAAF, 0, 0, 0, 0, 0,
- 0xFAB2, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFAB3, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFAB4, 0xFAB5, 0, 0,
- 0, 0xFAB6, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_BC[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFAB7, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAB8, 0, 0,
- 0, 0, 0, 0, 0xFA67, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFAB9,
-};
-const unsigned short x0212_shiftjis_BD[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFABB, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFABC,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFABE, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_BE[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFAC0, 0, 0, 0,
- 0xFABF, 0, 0, 0xFAC2, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAC3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFAC5, 0, 0, 0, 0xFAC4, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFAC6, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_BF[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0xFAC7, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFAC8, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_C0[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFAC9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFACA, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFACB, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_C1[] = {
- 0, 0, 0, 0, 0, 0xFACC, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFACE, 0, 0,
- 0xFAD1, 0, 0, 0, 0xFACF, 0, 0,
-};
-const unsigned short x0212_shiftjis_C2[] = {
- 0xFAD3, 0, 0, 0, 0xFAD4, 0, 0,
- 0, 0, 0, 0xFAD2, 0, 0xFA63, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFAD6, 0, 0xFAD7, 0, 0, 0, 0, 0xFA66,
- 0, 0, 0, 0, 0xFAD9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFADA, 0, 0, 0, 0, 0xFADB,
- 0, 0, 0, 0xFADC, 0, 0, 0xFADD, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFADE, 0, 0,
- 0xFADF, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_C3[] = {
- 0xFAE1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAE2, 0, 0,
- 0, 0xFAE4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFAE3, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFAE6, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFA64, 0, 0xFAE7,
-};
-const unsigned short x0212_shiftjis_C4[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFAE9, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFAEB, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFAEC, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAED, 0,
-};
-const unsigned short x0212_shiftjis_C5[] = {
- 0, 0, 0, 0, 0, 0, 0xFAEF,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAF0, 0xFAF1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFAF3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_C6[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFAF4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFAF5,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFAF6, 0, 0, 0xFAF8, 0, 0, 0, 0,
- 0, 0, 0xFAF7, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_C7[] = {
- 0xFAF9, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFAFA, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFAFC, 0, 0, 0, 0xFAFB,
- 0, 0, 0, 0xFB40, 0, 0, 0, 0xFB41,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB42, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFB45, 0,
- 0, 0, 0, 0xFB48, 0, 0, 0xFB46, 0,
- 0xFB49, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFB47, 0, 0,
-};
-const unsigned short x0212_shiftjis_C8[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB4A, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFB4B, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFB4C, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_C9[] = {
- 0, 0, 0, 0, 0, 0xFB4D, 0,
- 0, 0, 0, 0xFB4E, 0, 0xFB4F, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB51, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFB52, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFB54, 0, 0, 0, 0,
- 0, 0xFB53, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFB56, 0xFB57, 0, 0,
- 0, 0, 0, 0, 0xFB55, 0, 0,
-};
-const unsigned short x0212_shiftjis_CA[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFB59, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFB5A, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFB5B,
- 0, 0xFB5C, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_CB[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFB5D, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB5F, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFB60, 0,
- 0, 0, 0xFB61, 0, 0, 0, 0xFB64, 0,
- 0xFB62, 0, 0, 0, 0xFB63, 0, 0, 0,
- 0, 0xFB66, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_CC[] = {
- 0, 0, 0, 0, 0xFB65, 0, 0,
- 0, 0, 0, 0xFB67, 0, 0xFB69, 0xFB68, 0,
- 0, 0, 0xFB6A, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB6B, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFB6C, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB6D, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_CD[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFAA8, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFB6F, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_CE[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB73, 0xFB71, 0, 0, 0, 0,
- 0, 0, 0, 0xFB74, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB76, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_CF[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFB78, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB79, 0, 0, 0, 0, 0,
- 0, 0xFB7A, 0, 0, 0, 0xFB7B, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D0[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFB81, 0, 0,
- 0, 0xFB83, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D1[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFB84, 0, 0, 0, 0xFB87, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D2[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFB88, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D3[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB8A, 0, 0, 0, 0, 0, 0,
- 0xFB8B, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D4[] = {
- 0, 0, 0, 0, 0, 0, 0xFB8C,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFB8F, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA5C, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFB90, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D5[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFB91, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D7[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFB93, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D8[] = {
- 0, 0xFB95, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFB96,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB97, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB98, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFB99, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_D9[] = {
- 0xFA60, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFB9A, 0,
- 0xFB9B, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFB9C, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_DC[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFBA2, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFA5D,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_DD[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFBA3, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFBA4, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFBA5, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFBA6, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_DE[] = {
- 0, 0, 0, 0xFBA7, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFBA8, 0, 0, 0, 0, 0xFBAA, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFBAB, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_DF[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFBAD, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFBAF, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E0[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFBB2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E1[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFBB5, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E2[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFBB9,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E3[] = {
- 0, 0, 0, 0, 0, 0xFBBB, 0,
- 0xFBBA, 0xFBBC, 0xFBBF, 0xFBC0, 0, 0, 0, 0xFBBD,
- 0xFBBE, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFBC1, 0, 0, 0xFBC3,
- 0, 0xFBC2, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFBCA, 0xFBC4, 0xFBC6, 0,
- 0xFBC5, 0, 0, 0, 0, 0, 0, 0xFBC7,
- 0, 0xFBC9, 0, 0xFBC8, 0, 0, 0, 0,
- 0, 0xFBCB, 0, 0, 0, 0, 0, 0,
- 0, 0xFBCD, 0xFBCE, 0, 0, 0, 0, 0,
- 0xFA5F, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E4[] = {
- 0, 0, 0, 0, 0, 0xFBCC, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFBD2, 0xFBD6,
- 0xFBD4, 0xFBD0, 0, 0xFBD1, 0, 0, 0, 0xFBD5,
- 0, 0, 0, 0xFBCF, 0, 0, 0, 0,
- 0xFA65, 0xFBD9, 0xFBDC, 0, 0xFBDE, 0, 0, 0,
- 0, 0, 0, 0xFBDD, 0xFBDB, 0, 0xFBD8, 0,
- 0xFBD7, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFA5E, 0, 0, 0, 0, 0, 0xFBE0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFBDF, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E5[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFBE1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0xFBE2,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFBE3, 0, 0, 0, 0, 0, 0,
- 0xFBE4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFBE5, 0, 0, 0, 0, 0,
- 0, 0, 0xFBE6, 0xFBE7, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E6[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xFBEB, 0, 0, 0, 0, 0, 0, 0xFBEC,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E7[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0xFBED, 0, 0xFBEF, 0,
- 0, 0xFBF1, 0xFBF3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E8[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFBF4, 0, 0, 0, 0, 0xFBF5, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFBF8, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_E9[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0xFBFB, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFC40, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_EA[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0xFC41, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFC43, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFC44, 0,
- 0, 0, 0xFC45, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_EB[] = {
- 0, 0, 0, 0, 0xFC46, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0xFC48, 0xFC47, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_EC[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0xFC4A, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_F3[] = {
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0xFA40, 0xFA41, 0xFA42, 0xFA43, 0xFA44,
- 0xFA45, 0xFA46, 0xFA47, 0xFA48, 0xFA49, 0xFA4A, 0xFA4B,
-};
-const unsigned short x0212_shiftjis_F4[] = {
- 0xFA4C, 0xFA4D, 0xFA4E, 0xFA4F, 0xFA50, 0xFA51, 0xFA52,
- 0xFA53, 0xFA56, 0xFA57, 0xFA58, 0xFA59, 0xFA5A, 0xFA62, 0xFA6A,
- 0xFA7C, 0xFA83, 0xFA8A, 0xFA8B, 0xFA90, 0xFA92, 0xFA96, 0xFA9B,
- 0xFA9C, 0xFA9D, 0xFAAA, 0xFAAE, 0xFAB0, 0xFAB1, 0xFABA, 0xFABD,
- 0xFAC1, 0xFACD, 0xFAD0, 0xFAD5, 0xFAD8, 0xFAE0, 0xFAE5, 0xFAE8,
- 0xFAEA, 0xFAEE, 0xFAF2, 0xFB43, 0xFB44, 0xFB50, 0xFB58, 0xFB5E,
- 0xFB6E, 0xFB70, 0xFB72, 0xFB75, 0xFB7C, 0xFB7D, 0xFB7E, 0xFB80,
- 0xFB82, 0xFB85, 0xFB86, 0xFB89, 0xFB8D, 0xFB8E, 0xFB92, 0xFB94,
- 0xFB9D, 0xFB9E, 0xFB9F, 0xFBA0, 0xFBA1, 0xFBA9, 0xFBAC, 0xFBAE,
- 0xFBB0, 0xFBB1, 0xFBB3, 0xFBB4, 0xFBB6, 0xFBB7, 0xFBB8, 0xFBD3,
- 0xFBDA, 0xFBE8, 0xFBE9, 0xFBEA, 0xFBEE, 0xFBF0, 0xFBF2, 0xFBF6,
- 0xFBF7, 0xFBF9, 0xFBFA, 0xFBFC, 0xFC42, 0xFC49, 0xFC4B,
-};
-const unsigned short *const x0212_shiftjis[] = {
- 0, x0212_shiftjis_A2, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- x0212_shiftjis_B0, x0212_shiftjis_B1, x0212_shiftjis_B2, x0212_shiftjis_B3,
- x0212_shiftjis_B4, x0212_shiftjis_B5, 0, x0212_shiftjis_B7,
- x0212_shiftjis_B8, x0212_shiftjis_B9, x0212_shiftjis_BA, x0212_shiftjis_BB,
- x0212_shiftjis_BC, x0212_shiftjis_BD, x0212_shiftjis_BE, x0212_shiftjis_BF,
- x0212_shiftjis_C0, x0212_shiftjis_C1, x0212_shiftjis_C2, x0212_shiftjis_C3,
- x0212_shiftjis_C4, x0212_shiftjis_C5, x0212_shiftjis_C6, x0212_shiftjis_C7,
- x0212_shiftjis_C8, x0212_shiftjis_C9, x0212_shiftjis_CA, x0212_shiftjis_CB,
- x0212_shiftjis_CC, x0212_shiftjis_CD, x0212_shiftjis_CE, x0212_shiftjis_CF,
- x0212_shiftjis_D0, x0212_shiftjis_D1, x0212_shiftjis_D2, x0212_shiftjis_D3,
- x0212_shiftjis_D4, x0212_shiftjis_D5, 0, x0212_shiftjis_D7,
- x0212_shiftjis_D8, x0212_shiftjis_D9, 0, 0,
- x0212_shiftjis_DC, x0212_shiftjis_DD, x0212_shiftjis_DE, x0212_shiftjis_DF,
- x0212_shiftjis_E0, x0212_shiftjis_E1, x0212_shiftjis_E2, x0212_shiftjis_E3,
- x0212_shiftjis_E4, x0212_shiftjis_E5, x0212_shiftjis_E6, x0212_shiftjis_E7,
- x0212_shiftjis_E8, x0212_shiftjis_E9, x0212_shiftjis_EA, x0212_shiftjis_EB,
- x0212_shiftjis_EC, 0, 0, 0,
- 0, 0, 0, x0212_shiftjis_F3,
- x0212_shiftjis_F4, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0,
-};
-#endif /* X0212_ENABLE */
+#endif /* SHIFTJIS_CP932_TRANS */
+;
diff --git a/ext/nkf/nkf-utf8/utf8tbl.h b/ext/nkf/nkf-utf8/utf8tbl.h
deleted file mode 100644
index 1f40f0b363..0000000000
--- a/ext/nkf/nkf-utf8/utf8tbl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _UTF8TBL_H_
-#define _UTF8TBL_H_
-
-#ifdef UTF8_OUTPUT_ENABLE
-extern const unsigned short euc_to_utf8_1byte[];
-extern const unsigned short *const euc_to_utf8_2bytes[];
-extern const unsigned short *const euc_to_utf8_2bytes_ms[];
-extern const unsigned short *const x0212_to_utf8_2bytes[];
-#endif /* UTF8_OUTPUT_ENABLE */
-
-#ifdef UTF8_INPUT_ENABLE
-extern const unsigned short *const utf8_to_euc_2bytes[];
-extern const unsigned short *const utf8_to_euc_2bytes_ms[];
-extern const unsigned short *const utf8_to_euc_2bytes_932[];
-extern const unsigned short *const *const utf8_to_euc_3bytes[];
-extern const unsigned short *const *const utf8_to_euc_3bytes_ms[];
-extern const unsigned short *const *const utf8_to_euc_3bytes_932[];
-#endif /* UTF8_INPUT_ENABLE */
-
-#ifdef UNICODE_NORMALIZATION
-extern const struct normalization_pair normalization_table[];
-#endif
-
-#ifdef SHIFTJIS_CP932
-extern const unsigned short shiftjis_cp932[3][189];
-extern const unsigned short cp932inv[2][189];
-#endif /* SHIFTJIS_CP932 */
-
-#ifdef X0212_ENABLE
-extern const unsigned short shiftjis_x0212[3][189];
-extern const unsigned short *const x0212_shiftjis[];
-#endif /* X0212_ENABLE */
-
-#endif
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 8bcb6d15f7..65442a130c 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -1,13 +1,13 @@
/*
- * NKF - Ruby extension for Network Kanji Filter
+ * NKF Module for Ruby base on nkf 2.x
*
- * original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/
+ * original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/
*
- * $Id: nkf.c,v 1.9.2.4 2006/03/27 13:28:14 naruse Exp $
+ * $Id$
*
*/
-#define RUBY_NKF_REVISION "$Revision: 1.9.2.4 $"
+#define RUBY_NKF_REVISION "$Revision$"
#define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")"
#include "ruby.h"
@@ -78,69 +78,6 @@ rb_nkf_putchar(c)
#include "nkf-utf8/utf8tbl.c"
#include "nkf-utf8/nkf.c"
-int nkf_split_options(arg)
- const char* arg;
-{
- int count = 0;
- char option[256];
- int i = 0, j = 0;
- int is_escaped = FALSE;
- int is_single_quoted = FALSE;
- int is_double_quoted = FALSE;
- for(i = 0; arg[i]; i++){
- if(j == 255){
- return -1;
- }else if(is_single_quoted){
- if(arg[i] == '\''){
- is_single_quoted = FALSE;
- }else{
- option[j++] = arg[i];
- }
- }else if(is_escaped){
- is_escaped = FALSE;
- option[j++] = arg[i];
- }else if(arg[i] == '\\'){
- is_escaped = TRUE;
- }else if(is_double_quoted){
- if(arg[i] == '"'){
- is_double_quoted = FALSE;
- }else{
- option[j++] = arg[i];
- }
- }else if(arg[i] == '\''){
- is_single_quoted = TRUE;
- }else if(arg[i] == '"'){
- is_double_quoted = TRUE;
- }else if(arg[i] == ' '){
- option[j] = '\0';
- options(option);
- j = 0;
- }else{
- option[j++] = arg[i];
- }
- }
- if(j){
- option[j] = '\0';
- options(option);
- }
- return count;
-}
-
-/*
- * call-seq:
- * NKF.nkf(opt, str) -> string
- *
- * Convert _str_ and return converted result.
- * Conversion details are specified by _opt_ as String.
- *
- * require 'nkf'
- * output = NKF.nkf("-s", input)
- *
- * *Note*
- * By default, nkf decodes MIME encoded string.
- * If you want not to decode input, use NKF.nkf with <b>-m0</b> flag.
- */
-
static VALUE
rb_nkf_kconv(obj, opt, src)
VALUE obj, opt, src;
@@ -152,7 +89,7 @@ rb_nkf_kconv(obj, opt, src)
StringValue(opt);
opt_ptr = RSTRING(opt)->ptr;
opt_end = opt_ptr + RSTRING(opt)->len;
- nkf_split_options(opt_ptr);
+ options(opt_ptr);
incsize = INCSIZE;
@@ -181,27 +118,11 @@ rb_nkf_kconv(obj, opt, src)
/*
- * call-seq:
- * NKF.guess1(str) -> integer
- *
- * Returns guessed encoding of _str_ as integer.
- *
- * Algorithm described in:
- * Ken Lunde. `Understanding Japanese Information Processing'
- * Sebastopol, CA: O'Reilly & Associates.
+ * NKF.guess1
*
- * case NKF.guess1(input)
- * when NKF::JIS
- * "ISO-2022-JP"
- * when NKF::SJIS
- * "Shift_JIS"
- * when NKF::EUC
- * "EUC-JP"
- * when NKF::UNKNOWN
- * "UNKNOWN(ASCII)"
- * when NKF::BINARY
- * "BINARY"
- * end
+ * Character code detection - Algorithm described in:
+ * Ken Lunde. `Understanding Japanese Information Processing'
+ * Sebastopol, CA: O'Reilly & Associates.
*/
static VALUE
@@ -293,29 +214,9 @@ rb_nkf_guess1(obj, src)
/*
- * call-seq:
- * NKF.guess2(str) -> integer
+ * NKF.guess2
*
- * Returns guessed encoding of _str_ as integer by nkf routine.
- *
- * case NKF.guess(input)
- * when NKF::ASCII
- * "ASCII"
- * when NKF::JIS
- * "ISO-2022-JP"
- * when NKF::SJIS
- * "Shift_JIS"
- * when NKF::EUC
- * "EUC-JP"
- * when NKF::UTF8
- * "UTF-8"
- * when NKF::UTF16
- * "UTF-16"
- * when NKF::UNKNOWN
- * "UNKNOWN"
- * when NKF::BINARY
- * "BINARY"
- * end
+ * Guess Encoding By NKF2.0 Routine
*/
static VALUE
@@ -360,295 +261,32 @@ rb_nkf_guess2(obj, src)
}
-/*
- * NKF - Ruby extension for Network Kanji Filter
- *
- * == Description
- *
- * This is a Ruby Extension version of nkf (Netowrk Kanji Filter).
- * It converts the first argument and return converted result. Conversion
- * details are specified by flags as the first argument.
- *
- * *Nkf* is a yet another kanji code converter among networks, hosts and terminals.
- * It converts input kanji code to designated kanji code
- * such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16.
- *
- * One of the most unique faculty of *nkf* is the guess of the input kanji encodings.
- * It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16.
- * So users needn't set the input kanji code explicitly.
- *
- * By default, X0201 kana is converted into X0208 kana.
- * For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported.
- * For automatic code detection, nkf assumes no X0201 kana in Shift_JIS.
- * To accept X0201 in Shift_JIS, use <b>-X</b>, <b>-x</b> or <b>-S</b>.
- *
- * == Flags
- *
- * === -b -u
- *
- * Output is buffered (DEFAULT), Output is unbuffered.
- *
- * === -j -s -e -w -w16
- *
- * Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP,
- * UTF-8N, UTF-16BE.
- * Without this option and compile option, ISO-2022-JP is assumed.
- *
- * === -J -S -E -W -W16
- *
- * Input assumption is JIS 7 bit, Shift_JIS, EUC-JP,
- * UTF-8, UTF-16LE.
- *
- * ==== -J
- *
- * Assume JIS input. It also accepts EUC-JP.
- * This is the default. This flag does not exclude Shift_JIS.
- *
- * ==== -S
- *
- * Assume Shift_JIS and X0201 kana input. It also accepts JIS.
- * EUC-JP is recognized as X0201 kana. Without <b>-x</b> flag,
- * X0201 kana (halfwidth kana) is converted into X0208.
- *
- * ==== -E
- *
- * Assume EUC-JP input. It also accepts JIS.
- * Same as -J.
- *
- * === -t
- *
- * No conversion.
- *
- * === -i_
- *
- * Output sequence to designate JIS-kanji. (DEFAULT B)
- *
- * === -o_
- *
- * Output sequence to designate ASCII. (DEFAULT B)
- *
- * === -r
- *
- * {de/en}crypt ROT13/47
- *
- * === -h[123] --hiragana --katakana --katakana-hiragana
- *
- * [-h1 --hiragana] Katakana to Hiragana conversion.
- *
- * [-h2 --katakana] Hiragana to Katakana conversion.
- *
- * [-h3 --katakana-hiragana] Katakana to Hiragana and Hiragana to Katakana conversion.
- *
- * === -T
- *
- * Text mode output (MS-DOS)
- *
- * === -l
- *
- * ISO8859-1 (Latin-1) support
- *
- * === -f[<code>m</code> [- <code>n</code>]]
- *
- * Folding on <code>m</code> length with <code>n</code> margin in a line.
- * Without this option, fold length is 60 and fold margin is 10.
- *
- * === -F
- *
- * New line preserving line folding.
- *
- * === -Z[0-3]
- *
- * Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
- *
- * [-Z -Z0] Convert X0208 alphabet to ASCII.
- *
- * [-Z1] Converts X0208 kankaku to single ASCII space.
- *
- * [-Z2] Converts X0208 kankaku to double ASCII spaces.
- *
- * [-Z3] Replacing Fullwidth >, <, ", & into '&gt;', '&lt;', '&quot;', '&amp;' as in HTML.
- *
- * === -X -x
- *
- * Assume X0201 kana in MS-Kanji.
- * With <b>-X</b> or without this option, X0201 is converted into X0208 Kana.
- * With <b>-x</b>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
- * In JIS output, ESC-(-I is used. In EUC output, SSO is used.
- *
- * === -B[0-2]
- *
- * Assume broken JIS-Kanji input, which lost ESC.
- * Useful when your site is using old B-News Nihongo patch.
- *
- * [-B1] allows any char after ESC-( or ESC-$.
- *
- * [-B2] forces ASCII after NL.
- *
- * === -I
- *
- * Replacing non iso-2022-jp char into a geta character
- * (substitute character in Japanese).
- *
- * === -d -c
- *
- * Delete \r in line feed, Add \r in line feed.
- *
- * === -m[BQN0]
- *
- * MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
- * To see ISO8859-1 (Latin-1) -l is necessary.
- *
- * [-mB] Decode MIME base64 encoded stream. Remove header or other part before
- * conversion.
- *
- * [-mQ] Decode MIME quoted stream. '_' in quoted stream is converted to space.
- *
- * [-mN] Non-strict decoding.
- * It allows line break in the middle of the base64 encoding.
- *
- * [-m0] No MIME decode.
- *
- * === -M
- *
- * MIME encode. Header style. All ASCII code and control characters are intact.
- * Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
- *
- * [-MB] MIME encode Base64 stream.
- *
- * [-MQ] Perfome quoted encoding.
- *
- * === -l
- *
- * Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
- * <b>-s</b>, <b>-e</b> and <b>-x</b> are not compatible with this option.
- *
- * === -L[uwm]
- *
- * new line mode
- * Without this option, nkf doesn't convert line breaks.
- *
- * [-Lu] unix (LF)
- *
- * [-Lw] windows (CRLF)
- *
- * [-Lm] mac (CR)
- *
- * === --fj --unix --mac --msdos --windows
- *
- * convert for these system
- *
- * === --jis --euc --sjis --mime --base64
- *
- * convert for named code
- *
- * === --jis-input --euc-input --sjis-input --mime-input --base64-input
- *
- * assume input system
- *
- * === --ic=<code>input codeset</code> --oc=<code>output codeset</code>
- *
- * Set the input or output codeset.
- * NKF supports following codesets and those codeset name are case insensitive.
- *
- * [ISO-2022-JP] a.k.a. RFC1468, 7bit JIS, JUNET
- *
- * [EUC-JP (eucJP-nkf)] a.k.a. AT&T JIS, Japanese EUC, UJIS
- *
- * [eucJP-ascii] a.k.a. x-eucjp-open-19970715-ascii
- *
- * [eucJP-ms] a.k.a. x-eucjp-open-19970715-ms
- *
- * [CP51932] Microsoft Version of EUC-JP.
- *
- * [Shift_JIS] SJIS, MS-Kanji
- *
- * [CP932] a.k.a. Windows-31J
- *
- * [UTF-8] same as UTF-8N
- *
- * [UTF-8N] UTF-8 without BOM
- *
- * [UTF-8-BOM] UTF-8 with BOM
- *
- * [UTF-16] same as UTF-16BE
- *
- * [UTF-16BE] UTF-16 Big Endian without BOM
- *
- * [UTF-16BE-BOM] UTF-16 Big Endian with BOM
- *
- * [UTF-16LE] UTF-16 Little Endian without BOM
- *
- * [UTF-16LE-BOM] UTF-16 Little Endian with BOM
- *
- * [UTF8-MAC] NKDed UTF-8, a.k.a. UTF8-NFD (input only)
- *
- * === --fb-{skip, html, xml, perl, java, subchar}
- *
- * Specify the way that nkf handles unassigned characters.
- * Without this option, --fb-skip is assumed.
- *
- * === --prefix= <code>escape character</code> <code>target character</code> ..
- *
- * When nkf converts to Shift_JIS,
- * nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
- * 1st byte of argument is the escape character and following bytes are target characters.
- *
- * === --disable-cp932ext
- *
- * Handle the characters extended in CP932 as unassigned characters.
- *
- * === --cap-input
- *
- * Decode hex encoded characters.
- *
- * === --url-input
- *
- * Unescape percent escaped characters.
- *
- * === --
- *
- * Ignore rest of -option.
- */
+/* Initialize NKF Module */
void
Init_nkf()
{
- /* hoge */
- VALUE mKconv = rb_define_module("NKF");
- /* hoge */
-
- rb_define_module_function(mKconv, "nkf", rb_nkf_kconv, 2);
- rb_define_module_function(mKconv, "guess1", rb_nkf_guess1, 1);
- rb_define_module_function(mKconv, "guess2", rb_nkf_guess2, 1);
- rb_define_alias(mKconv, "guess", "guess2");
- rb_define_alias(rb_singleton_class(mKconv), "guess", "guess2");
-
- /* Auto-Detect */
- rb_define_const(mKconv, "AUTO", INT2FIX(_AUTO));
- /* ISO-2022-JP */
- rb_define_const(mKconv, "JIS", INT2FIX(_JIS));
- /* EUC-JP */
- rb_define_const(mKconv, "EUC", INT2FIX(_EUC));
- /* Shift_JIS */
- rb_define_const(mKconv, "SJIS", INT2FIX(_SJIS));
- /* BINARY */
- rb_define_const(mKconv, "BINARY", INT2FIX(_BINARY));
- /* No conversion */
- rb_define_const(mKconv, "NOCONV", INT2FIX(_NOCONV));
- /* ASCII */
- rb_define_const(mKconv, "ASCII", INT2FIX(_ASCII));
- /* UTF-8 */
- rb_define_const(mKconv, "UTF8", INT2FIX(_UTF8));
- /* UTF-16 */
- rb_define_const(mKconv, "UTF16", INT2FIX(_UTF16));
- /* UTF-32 */
- rb_define_const(mKconv, "UTF32", INT2FIX(_UTF32));
- /* UNKNOWN */
- rb_define_const(mKconv, "UNKNOWN", INT2FIX(_UNKNOWN));
- /* Full version string of nkf */
- rb_define_const(mKconv, "VERSION", rb_str_new2(RUBY_NKF_VERSION));
- /* Version of nkf */
- rb_define_const(mKconv, "NKF_VERSION", rb_str_new2(NKF_VERSION));
- /* Release date of nkf */
- rb_define_const(mKconv, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE));
+ VALUE mKconv = rb_define_module("NKF");
+
+ rb_define_module_function(mKconv, "nkf", rb_nkf_kconv, 2);
+ rb_define_module_function(mKconv, "guess", rb_nkf_guess2, 1);
+ rb_define_module_function(mKconv, "guess1", rb_nkf_guess1, 1);
+ rb_define_module_function(mKconv, "guess2", rb_nkf_guess2, 1);
+
+ rb_define_const(mKconv, "AUTO", INT2FIX(_AUTO));
+ rb_define_const(mKconv, "JIS", INT2FIX(_JIS));
+ rb_define_const(mKconv, "EUC", INT2FIX(_EUC));
+ rb_define_const(mKconv, "SJIS", INT2FIX(_SJIS));
+ rb_define_const(mKconv, "BINARY", INT2FIX(_BINARY));
+ rb_define_const(mKconv, "NOCONV", INT2FIX(_NOCONV));
+ rb_define_const(mKconv, "ASCII", INT2FIX(_ASCII));
+ rb_define_const(mKconv, "UTF8", INT2FIX(_UTF8));
+ rb_define_const(mKconv, "UTF16", INT2FIX(_UTF16));
+ rb_define_const(mKconv, "UTF32", INT2FIX(_UTF32));
+ rb_define_const(mKconv, "UNKNOWN", INT2FIX(_UNKNOWN));
+ rb_define_const(mKconv, "VERSION", rb_str_new2(RUBY_NKF_VERSION));
+ /* for debug */
+ rb_define_const(mKconv, "NKF_VERSION", rb_str_new2(NKF_VERSION));
+ rb_define_const(mKconv, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE));
+ rb_define_const(mKconv, "REVISION", rb_str_new2(RUBY_NKF_REVISION));
}
diff --git a/ext/nkf/test.rb b/ext/nkf/test.rb
new file mode 100644
index 0000000000..b3406cbb6c
--- /dev/null
+++ b/ext/nkf/test.rb
@@ -0,0 +1,864 @@
+#!/usr/local/bin/ruby
+#
+# nkf test program for nkf-2
+#
+# $Id$
+#
+# Shinji KONO <kono@ie.u-ryukyu.ac.jp>
+# Sun Aug 18 12:25:40 JST 1996
+# Sun Nov 8 00:16:06 JST 1998
+#
+# This is useful when you add new patch on nkf.
+# Since this test is too strict, faileurs may not mean
+# wrong conversion.
+#
+# nkf 1.5 differs on MIME decoding
+# nkf 1.4 passes Basic Conversion tests
+# nkf PDS version passes Basic Conversion tests using "nkf -iB -oB "
+#
+
+$counter = 0
+def result(result, message = nil)
+ $counter += 1
+ printf("%s %d%s\n",
+ result ? 'ok' : 'no',
+ $counter,
+ message ? ' ... ' + message : '')
+end
+
+begin
+ require 'nkf'
+ include NKF
+rescue LoadError
+ result(false)
+end
+result(true)
+
+if nkf('-me', '1')
+ result(true);
+else
+ result(false);
+end
+
+output = nkf('-e', "\033\$@#1#3#2%B")
+if output
+ # print output, "\n"
+ result(true, output)
+else
+ result(false)
+end
+
+output = nkf('-Zj', "\033\$@#1#3#2%B")
+if output
+ # print output, "\n"
+ result(true, output)
+else
+ result(false)
+end
+
+output = "\244\306 " * 1024
+old = output.length
+output = nkf("-j", output)
+if output
+ # print output, "\n"
+ result(true, "#{old} #{output.length}")
+else
+ result(false)
+end
+
+
+$detail = false
+def test(opt, input, expects)
+ print "\nINPUT:\n", input if $detail
+ print "\nEXPECT:\n", expects.to_s if $detail
+ result = nkf(opt, input)
+ result.delete!(' ') if opt.include?('-m')
+ print "\nGOT:\n", result if $detail
+
+ expects.each do |e|
+ e.delete!(' ') if opt.include?('-m')
+ if result == e then
+ puts "Ok"
+ return result
+ end
+ end
+ puts "Fail"
+ puts result.unpack('H*').first
+ puts expects.map{|x|x.unpack('H*').first}.join("\n\n")
+end
+
+
+$example = Hash.new
+
+
+# Basic Conversion
+print "\nBasic Conversion test\n\n";
+
+# I gave up simple literal quote because there are big difference
+# on perl4 and perl5 on literal quote. Of course we cannot use
+# jperl.
+
+$example['jis'] = <<'eofeof'.unpack('u')[0]
+M1FER<W0@4W1A9V4@&R1"(3DQ(3%^2R%+?D]3&RA"(%-E8V]N9"!3=&%G92`;
+M)$)0)TU:&RA"($AI<F%G86YA(!LD0B0B)"0D)B0H)"HD;R1R)',;*$(*2V%T
+M86MA;F$@&R1")2(E)"4F)2@E*B5O)7(E<QLH0B!+:6=O=2`;)$(A)B%G(S`C
+/029!)E@G(B=!*$`;*$(*
+eofeof
+
+$example['sjis'] = <<'eofeof'.unpack('u')[0]
+M1FER<W0@4W1A9V4@@5B)0(F>ED"6GIAR(%-E8V]N9"!3=&%G92"8I9=Y($AI
+M<F%G86YA((*@@J*"I(*F@JB"[8+P@O$*2V%T86MA;F$@@T&#0X-%@T>#28./
+>@Y*#DR!+:6=O=2"!18&'@D^"8(._@]:$081@A+X*
+eofeof
+
+$example['euc'] = <<'eofeof'.unpack('u')[0]
+M1FER<W0@4W1A9V4@H;FQH;'^RZ'+_L_3(%-E8V]N9"!3=&%G92#0I\W:($AI
+M<F%G86YA(*2BI*2DIJ2HI*JD[Z3RI/,*2V%T86MA;F$@I:*EI*6FI:BEJJ7O
+>I?*E\R!+:6=O=2"AIJ'GH["CP:;!IMBGHJ?!J,`*
+eofeof
+
+$example['utf8'] = <<'eofeof'.unpack('u')[0]
+M[[N_1FER<W0@4W1A9V4@XX"%Z9FBY;^<YK.5YKJ`Z(65(%-E8V]N9"!3=&%G
+M92#DN+SI@:4@2&ER86=A;F$@XX&"XX&$XX&&XX&(XX&*XX*/XX*2XX*3"DMA
+M=&%K86YA(.."HN."I.."IN."J.."JN.#K^.#LN.#LR!+:6=O=2#C@[OBB)[O
+1O)#OO*'.L<^)T)'0K^*5@@H`
+eofeof
+
+$example['utf8N'] = <<'eofeof'.unpack('u')[0]
+M1FER<W0@4W1A9V4@XX"%Z9FBY;^<YK.5YKJ`Z(65(%-E8V]N9"!3=&%G92#D
+MN+SI@:4@2&ER86=A;F$@XX&"XX&$XX&&XX&(XX&*XX*/XX*2XX*3"DMA=&%K
+M86YA(.."HN."I.."IN."J.."JN.#K^.#LN.#LR!+:6=O=2#C@[OBB)[OO)#O
+.O*'.L<^)T)'0K^*5@@H`
+eofeof
+
+$example['u16L'] = <<'eofeof'.unpack('u')[0]
+M__Y&`&D`<@!S`'0`(`!3`'0`80!G`&4`(``%,&*6W%_5;(!N58$@`%,`90!C
+M`&\`;@!D`"``4P!T`&$`9P!E`"``/$YED"``2`!I`'(`80!G`&$`;@!A`"``
+M0C!$,$8P2#!*,(\PDC"3,`H`2P!A`'0`80!K`&$`;@!A`"``HC"D,*8PJ#"J
+I,.\P\C#S,"``2P!I`&<`;P!U`"``^S`>(A#_(?^Q`\D#$00O!$(E"@``
+eofeof
+
+$example['u16L0'] = <<'eofeof'.unpack('u')[0]
+M1@!I`'(`<P!T`"``4P!T`&$`9P!E`"``!3!BEMQ?U6R`;E6!(`!3`&4`8P!O
+M`&X`9``@`%,`=`!A`&<`90`@`#Q.99`@`$@`:0!R`&$`9P!A`&X`80`@`$(P
+M1#!&,$@P2C"/,)(PDS`*`$L`80!T`&$`:P!A`&X`80`@`*(PI#"F,*@PJC#O
+G,/(P\S`@`$L`:0!G`&\`=0`@`/LP'B(0_R'_L0/)`Q$$+P1")0H`
+eofeof
+
+$example['u16B'] = <<'eofeof'.unpack('u')[0]
+M_O\`1@!I`'(`<P!T`"``4P!T`&$`9P!E`"`P!99B7]QLU6Z`@54`(`!3`&4`
+M8P!O`&X`9``@`%,`=`!A`&<`90`@3CR090`@`$@`:0!R`&$`9P!A`&X`80`@
+M,$(P1#!&,$@P2C"/,)(PDP`*`$L`80!T`&$`:P!A`&X`80`@,*(PI#"F,*@P
+IJC#O,/(P\P`@`$L`:0!G`&\`=0`@,/LB'O\0_R$#L0/)!!$$+R5"``H`
+eofeof
+
+$example['u16B0'] = <<'eofeof'.unpack('u')[0]
+M`$8`:0!R`',`=``@`%,`=`!A`&<`90`@,`668E_<;-5N@(%5`"``4P!E`&,`
+M;P!N`&0`(`!3`'0`80!G`&4`($X\D&4`(`!(`&D`<@!A`&<`80!N`&$`(#!"
+M,$0P1C!(,$HPCS"2,),`"@!+`&$`=`!A`&L`80!N`&$`(#"B,*0PIC"H,*HP
+G[S#R,/,`(`!+`&D`9P!O`'4`(##[(A[_$/\A`[$#R001!"\E0@`*
+eofeof
+
+$example['jis1'] = <<'eofeof'.unpack('u')[0]
+M&R1";3%Q<$$L&RA""ALD0F4Z3F\;*$(*&R1"<FT;*$()&R1"/F5.3D]+&RA"
+#"0D*
+eofeof
+
+$example['sjis1'] = <<'eofeof'.unpack('u')[0]
+8YU#ID)%+"N-9E^T*Z>L)C^.7S)AJ"0D*
+eofeof
+
+$example['euc1'] = <<'eofeof'.unpack('u')[0]
+8[;'Q\,&L"N6ZSN\*\NT)ON7.SL_+"0D*
+eofeof
+
+$example['utf1'] = <<'eofeof'.unpack('u')[0]
+AZ+J%Z:N/Z8JM"N>VNNFZEPKIM(D)Y+B*Z:"8Y+J8"0D*
+eofeof
+
+$example['jis2'] = <<'eofeof'.unpack('u')[0]
++&R1".EA&(QLH0@H`
+eofeof
+
+$example['sjis2'] = <<'eofeof'.unpack('u')[0]
+%C=:3H0H`
+eofeof
+
+$example['euc2'] = <<'eofeof'.unpack('u')[0]
+%NMC&HPH`
+eofeof
+
+$example['utf2'] = <<'eofeof'.unpack('u')[0]
+'YI:.Z)>D"@``
+eofeof
+
+# From JIS
+
+print "JIS to JIS ... ";test("-j",$example['jis'],[$example['jis']])
+print "JIS to SJIS... ";test("-s",$example['jis'],[$example['sjis']])
+print "JIS to EUC ... ";test("-e",$example['jis'],[$example['euc']])
+print "JIS to UTF8... ";test("-w",$example['jis'],[$example['utf8N']])
+print "JIS to U16L... ";test("-w16L",$example['jis'],[$example['u16L']])
+print "JIS to U16B... ";test("-w16B",$example['jis'],[$example['u16B']])
+
+# From SJIS
+
+print "SJIS to JIS ... ";test("-j",$example['sjis'],[$example['jis']])
+print "SJIS to SJIS... ";test("-s",$example['sjis'],[$example['sjis']])
+print "SJIS to EUC ... ";test("-e",$example['sjis'],[$example['euc']])
+print "SJIS to UTF8... ";test("-w",$example['sjis'],[$example['utf8N']])
+print "SJIS to U16L... ";test("-w16L",$example['sjis'],[$example['u16L']])
+print "SJIS to U16B... ";test("-w16B",$example['sjis'],[$example['u16B']])
+
+# From EUC
+
+print "EUC to JIS ... ";test("-j",$example['euc'],[$example['jis']])
+print "EUC to SJIS... ";test("-s",$example['euc'],[$example['sjis']])
+print "EUC to EUC ... ";test("-e",$example['euc'],[$example['euc']])
+print "EUC to UTF8... ";test("-w",$example['euc'],[$example['utf8N']])
+print "EUC to U16L... ";test("-w16L",$example['euc'],[$example['u16L']])
+print "EUC to U16B... ";test("-w16B",$example['euc'],[$example['u16B']])
+
+# From UTF8
+
+print "UTF8 to JIS ... ";test("-j", $example['utf8N'],[$example['jis']])
+print "UTF8 to SJIS... ";test("-s", $example['utf8N'],[$example['sjis']])
+print "UTF8 to EUC ... ";test("-e", $example['utf8N'],[$example['euc']])
+print "UTF8 to UTF8N.. ";test("-w", $example['utf8N'],[$example['utf8N']])
+print "UTF8 to UTF8... ";test("-w8", $example['utf8N'],[$example['utf8']])
+print "UTF8 to UTF8N.. ";test("-w80", $example['utf8N'],[$example['utf8N']])
+print "UTF8 to U16L... ";test("-w16L", $example['utf8N'],[$example['u16L']])
+print "UTF8 to U16L0.. ";test("-w16L0", $example['utf8N'],[$example['u16L0']])
+print "UTF8 to U16B... ";test("-w16B", $example['utf8N'],[$example['u16B']])
+print "UTF8 to U16B0.. ";test("-w16B0", $example['utf8N'],[$example['u16B0']])
+
+
+
+# From JIS
+
+print "JIS to JIS ... ";test("-j",$example['jis1'],[$example['jis1']])
+print "JIS to SJIS... ";test("-s",$example['jis1'],[$example['sjis1']])
+print "JIS to EUC ... ";test("-e",$example['jis1'],[$example['euc1']])
+print "JIS to UTF8... ";test("-w",$example['jis1'],[$example['utf1']])
+
+# From SJIS
+
+print "SJIS to JIS ... ";test("-j",$example['sjis1'],[$example['jis1']])
+print "SJIS to SJIS... ";test("-s",$example['sjis1'],[$example['sjis1']])
+print "SJIS to EUC ... ";test("-e",$example['sjis1'],[$example['euc1']])
+print "SJIS to UTF8... ";test("-w",$example['sjis1'],[$example['utf1']])
+
+# From EUC
+
+print "EUC to JIS ... ";test("-j",$example['euc1'],[$example['jis1']])
+print "EUC to SJIS... ";test("-s",$example['euc1'],[$example['sjis1']])
+print "EUC to EUC ... ";test("-e",$example['euc1'],[$example['euc1']])
+print "EUC to UTF8... ";test("-w",$example['euc1'],[$example['utf1']])
+
+# From UTF8
+
+print "UTF8 to JIS ... ";test("-j",$example['utf1'],[$example['jis1']])
+print "UTF8 to SJIS... ";test("-s",$example['utf1'],[$example['sjis1']])
+print "UTF8 to EUC ... ";test("-e",$example['utf1'],[$example['euc1']])
+print "UTF8 to UTF8... ";test("-w",$example['utf1'],[$example['utf1']])
+
+# Ambigous Case
+
+$example['amb'] = <<'eofeof'.unpack('u')[0]
+MI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&E
+MPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*P
+ML:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&E
+MPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"
+ML+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"Q
+MI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"
+ML+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*
+eofeof
+
+$example['amb.euc'] = <<'eofeof'.unpack('u')[0]
+M&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25"
+M,#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P,25"
+M,#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;
+M*$(*&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P
+M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P
+M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
+M)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
+>)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*
+eofeof
+
+$example['amb.sjis'] = <<'eofeof'.unpack('u')[0]
+M&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25"
+M,#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P,25"
+M,#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;
+M*$(*&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P
+M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P
+M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
+M)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
+>)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*
+eofeof
+
+print "Ambiguous Case. ";
+ test("-j",$example['amb'],[$example['amb.euc']])
+
+# Input assumption
+
+print "SJIS Input assumption ";
+ test("-jSx",$example['amb'],[$example['amb.sjis']])
+
+# Broken JIS
+
+print "Broken JIS ";
+ $input = $example['jis'];
+ $input.gsub!("\033",'')
+ test("-Be",$input,[$example['euc']]);
+print "Broken JIS is safe on Normal JIS? ";
+ $input = $example['jis'];
+ test("-Be",$input,[$example['euc']]);
+
+# test_data/cp932
+
+$example['test_data/cp932'] = <<'eofeof'.unpack('u')[0]
+%^D`@_$L`
+eofeof
+
+$example['test_data/cp932.ans'] = <<'eofeof'.unpack('u')[0]
+%_/$@_.X`
+eofeof
+
+print "test_data/cp932 ";
+ test("-eS",$example['test_data/cp932'],[$example['test_data/cp932.ans']])
+
+# test_data/cp932inv
+print "test_data/cp932inv ";
+ test("-sE --cp932inv",$example['test_data/cp932.ans'],[$example['test_data/cp932']])
+
+# test_data/no-cp932inv
+
+$example['test_data/no-cp932inv.ans'] = <<'eofeof'.unpack('u')[0]
+%[N\@[NP`
+eofeof
+
+print "test_data/no-cp932inv ";
+test("-sE --no-cp932",$example['test_data/cp932.ans'],[$example['test_data/no-cp932inv.ans']])
+
+# test_data/irv
+
+# $example['test_data/irv'] = <<'eofeof'.unpack('u')[0]
+# %#B`/(!L`
+# eofeof
+#
+# $example['test_data/irv.ans'] = <<'eofeof'.unpack('u')[0]
+# %#B`/(!L`
+# eofeof
+#
+# print "test_data/irv ";
+# test("-wE",$example['test_data/irv'],[$example['test_data/irv.ans']])
+
+
+# UCS Mapping Test
+print "\n\nUCS Mapping Test\n";
+
+print "Shift_JIS to UTF-16\n";
+$example['ms_ucs_map_1_sjis'] = "\x81\x60\x81\x61\x81\x7C\x81\x91\x81\x92\x81\xCA";
+$example['ms_ucs_map_1_utf16'] = "\x30\x1C\x20\x16\x22\x12\x00\xA2\x00\xA3\x00\xAC";
+$example['ms_ucs_map_1_utf16_ms'] = "\xFF\x5E\x22\x25\xFF\x0D\xFF\xE0\xFF\xE1\xFF\xE2";
+
+print "Normal UCS Mapping : ";
+ test("-w16B0 -S",$example['ms_ucs_map_1_sjis'],[$example['ms_ucs_map_1_utf16']])
+
+print "Microsoft UCS Mapping : ";
+ test("-w16B0 -S --ms-ucs-map",$example['ms_ucs_map_1_sjis'],[$example['ms_ucs_map_1_utf16_ms']])
+
+print"\n";
+
+# X0201 ²¾Ì¾
+# X0201->X0208 conversion
+# X0208 aphabet -> ASCII
+# X0201 Áê¸ßÊÑ´¹
+
+print "\nX0201 test\n\n";
+
+$example['x0201.sjis'] = <<'eofeof'.unpack('u')[0]
+MD5.*<(-*@TR#3H-0@U*#2X--@T^#48-3"I%3B7""8()A@F*"8X)D@F6"9H*!
+M@H*"@X*$@H6"AH*'"I%3BTR-AH%)@9>!E(&0@9.!3X&5@9:!:8%J@7R!>X&!
+M@6V!;H%O@7"!CPJ4O(IPMK>X/;FZMMZWWKC>N=ZZWH+&"I2\BG#*W\O?S-_-
+MW\[?M]^QW@K*W\O?S`IH86YK86MU(,K?R]_,I`K*W\O?S-VA"I2\BG""S(SC
+!"@!"
+eofeof
+
+$example['x0201.euc'] = <<'eofeof'.unpack('u')[0]
+MP;2ST:6KI:VEKZ6QI;.EK*6NI;"ELJ6T"L&TL=&CP:/"H\.CQ*/%H\:CQZ/A
+MH^*CXZ/DH^6CYJ/G"L&TM:VYYJ&JH?>A]*'PH?.AL*'UH?:ARJ'+H=VAW*'A
+MH<ZASZ'0H=&A[PK(OK/1CK:.MXZX/8ZYCKJ.MH[>CK>.WHZXCMZ.N8[>CKJ.
+MWJ3("LB^L]&.RH[?CLN.WX[,CM^.S8[?CLZ.WXZWCM^.L8[>"H[*CM^.RX[?
+MCLP*:&%N:V%K=2".RH[?CLN.WX[,CJ0*CLJ.WX[+CM^.S([=CJ$*R+ZST:3.
+#N.4*
+eofeof
+
+$example['x0201.utf'] = <<'eofeof'.unpack('u')[0]
+MY86HZ*>2XX*KXX*MXX*OXX*QXX*SXX*LXX*NXX*PXX*RXX*T"N6%J.B+L>^\
+MH>^\HN^\H^^\I.^\I>^\IN^\I^^]@>^]@N^]@^^]A.^]A>^]AN^]APKEA:CH
+MJ)CEC[?OO('OO*#OO(/OO(3OO(7OO+[OO(;OO(KOO(COO(GBB)+OO(OOO)WO
+MO+OOO+WOO9OOO9WOOZ4*Y8V*Z*>2[[VV[[VW[[VX/>^]N>^]NN^]MN^^GN^]
+MM^^^GN^]N.^^GN^]N>^^GN^]NN^^GN.!J`KEC8KHIY+OOHKOOI_OOHOOOI_O
+MOHSOOI_OOHWOOI_OOH[OOI_OO;?OOI_OO;'OOIX*[[Z*[[Z?[[Z+[[Z?[[Z,
+M"FAA;FMA:W4@[[Z*[[Z?[[Z+[[Z?[[Z,[[VD"N^^BN^^G^^^B^^^G^^^C.^^
+2G>^]H0KEC8KHIY+C@:[EOHP*
+eofeof
+
+$example['x0201.jis'] = <<'eofeof'.unpack('u')[0]
+M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA""ALD0D$T,5$C02-"(T,C
+M1"-%(T8C1R-A(V(C8R-D(V4C9B-G&RA""ALD0D$T-2TY9B$J(7<A="%P(7,A
+M,"%U(78A2B%+(5TA7"%A(4XA3R%0(5$A;QLH0@H;)$)(/C-1&RA)-C<X&RA"
+M/1LH23DZ-EXW7CA>.5XZ7ALD0B1(&RA""ALD0D@^,U$;*$E*7TM?3%]-7TY?
+M-U\Q7ALH0@H;*$E*7TM?3!LH0@IH86YK86MU(!LH24I?2U],)!LH0@H;*$E*
+97TM?3%TA&RA""ALD0D@^,U$D3CAE&RA""@``
+eofeof
+
+$example['x0201.sosi'] = <<'eofeof'.unpack('u')[0]
+M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA*"ALD0D$T,5$C02-"(T,C
+M1"-%(T8C1R-A(V(C8R-D(V4C9B-G&RA*"ALD0D$T-2TY9B$J(7<A="%P(7,A
+M,"%U(78A2B%+(5TA7"%A(4XA3R%0(5$A;QLH2@H;)$)(/C-1&RA*#C8W.`\;
+M*$H]#CDZ-EXW7CA>.5XZ7@\;)$(D2!LH2@H;)$)(/C-1&RA*#DI?2U],7TU?
+M3E\W7S%>#PH.2E]+7TP/&RA*"FAA;FMA:W4@#DI?2U],)`\;*$H*#DI?2U],
+672$/&RA*"ALD0D@^,U$D3CAE&RA""@``
+eofeof
+
+$example['x0201.x0208'] = <<'eofeof'.unpack('u')[0]
+M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA""ALD0D$T,5$;*$)!0D-$
+M149'86)C9&5F9PH;)$)!-#4M.68;*$(A0",D)5XF*B@I+2L]6UU[?1LD0B%O
+M&RA""ALD0D@^,U$E*R4M)2\;*$(]&R1")3$E,R4L)2XE,"4R)30D2!LH0@H;
+M)$)(/C-1)5$E5"57)5HE724M(2PE(B$K&RA""ALD0B51)50E51LH0@IH86YK
+M86MU(!LD0B51)50E52$B&RA""ALD0B51)50E525S(2,;*$(*&R1"2#XS421.
+&.&4;*$(*
+eofeof
+
+# -X is necessary to allow X0201 in SJIS
+# -Z convert X0208 alphabet to ASCII
+print "X0201 conversion: SJIS ";
+ test("-jXZ",$example['x0201.sjis'],[$example['x0201.x0208']])
+print "X0201 conversion: JIS ";
+ test("-jZ",$example['x0201.jis'],[$example['x0201.x0208']])
+print "X0201 conversion:SI/SO ";
+ test("-jZ",$example['x0201.sosi'],[$example['x0201.x0208']])
+print "X0201 conversion: EUC ";
+ test("-jZ",$example['x0201.euc'],[$example['x0201.x0208']])
+print "X0201 conversion: UTF8 ";
+ test("-jZ",$example['x0201.utf'],[$example['x0201.x0208']])
+# -x means X0201 output
+print "X0201 output: SJIS ";
+ test("-xs",$example['x0201.euc'],[$example['x0201.sjis']])
+print "X0201 output: JIS ";
+ test("-xj",$example['x0201.sjis'],[$example['x0201.jis']])
+print "X0201 output: EUC ";
+ test("-xe",$example['x0201.jis'],[$example['x0201.euc']])
+print "X0201 output: UTF8 ";
+ test("-xw",$example['x0201.jis'],[$example['x0201.utf']])
+
+# MIME decode
+
+print "\nMIME test\n\n";
+
+# MIME ISO-2022-JP
+
+$example['mime.iso2022'] = <<'eofeof'.unpack('u')[0]
+M/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23TI566Q/4U9)1WEH2S\]"CT_
+M:7-O+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]*55EL3U-624=Y:$L_/0H]/VES
+M;RTR,#(R+4I0/U$_/3%")$(D1B11/3%"*$)?96YD/ST*&R1`)#TD)B0K)$H;
+M*$H@/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D:'-O4V<]/3\]
+M(&5N9"!O9B!L:6YE"CT_25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]0>6LW
+M9&AS;U-G/3T_/2`]/TE33RTR,#(R+4I0/T(_1WE204Y%13=E:5)/4'EK-V1H
+M<V]39ST]/ST*0G)O:V5N(&-A<V4*/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W
+M96E23U!Y:S=D"FAS;U-G/3T_/2`]/TE33RTR,`HR,BU*4#]"/T=Y4D%.144W
+M96E23U!Y:S=D:'-O4V<]/3\]"CT_25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I
+44D]*55EL3QM;2U-624=Y:$L_/0H_
+eofeof
+
+$example['mime.ans.strict'] = <<'eofeof'.unpack('u')[0]
+M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
+M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
+M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
+M/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D"FAS;U-G/3T_/2`]
+M/TE33RTR,`HR,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D:'-O4V<]/3\]"CT_
+L25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]*55EL3QM;2U-624=Y:$L_/0H_
+eofeof
+
+$example['mime.unbuf.strict'] = <<'eofeof'.unpack('u')[0]
+M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
+M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
+M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
+M&R1"-$$[>B1./RD;*$)H<V]39ST]/ST@/3])4T\M,C`*,C(M2E`_0C]'>5)!
+M3D5%-V5I4D]0>6LW9&AS;U-G/3T_/0H;)$(T03MZ)$XE1ALH0EM+4U9)1WEH
+$2S\]"F5I
+eofeof
+
+$example['mime.ans'] = <<'eofeof'.unpack('u')[0]
+M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
+M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
+M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
+M&R1"-$$[>B1./RD;*$)H<V]39ST]/ST@&R1"-$$[>B1./RD[=ALH0@H;)$(T
+603MZ)$XE1ALH0EM+4U9)1WEH2S\]"@`*
+eofeof
+
+$example['mime.unbuf'] = <<'eofeof'.unpack('u')[0]
+M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
+M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
+M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
+M&R1"-$$[>B1./RD;*$)H<V]39ST]/ST@&R1"-$$[>B1./RD[=ALH0@H;)$(T
+603MZ)$XE1ALH0EM+4U9)1WEH2S\]"@`*
+eofeof
+
+$example['mime.base64'] = <<'eofeof'.unpack('u')[0]
+M9W-M5"])3&YG<FU#>$I+-&=Q=4,S24LS9W%Q0E%:3TUI-39,,S0Q-&=S5T)1
+M43!+9VUA1%9O3T@*9S)+1%1O3'=K8C)1;$E+;V=Q2T-X24MG9W5M0W%*3EEG
+<<T=#>$E+9V=U;4,X64Q&9W)70S592VMG<6U""F=Q
+eofeof
+
+$example['mime.base64.ans'] = <<'eofeof'.unpack('u')[0]
+M&R1")$M&?B1I)#LD1D0Z)"TD7B0Y)"PA(D5L-7XV83E9)$<A(ALH0@T*&R1"
+M(T<E-R5G)4,E+R1R0C\_="0J)"0D1B0B)&LD*D4Y)$,D1B0B)&LD<R1')#<D
+(9R0F)"L;*$(E
+eofeof
+
+# print "Next test is expected to Fail.\n";
+print "MIME decode (strict) ";
+ $tmp = test("-j -mS",$example['mime.iso2022'],[$example['mime.ans.strict']])
+
+$example['mime.ans.alt'] = <<'eofeof'.unpack('u')[0]
+M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
+M&RA"96YD"ALD0B0])"8D*R1*&RA"&R1"-$$[>B1./RD[=ALH0F5N9&]F;&EN
+M90H;)$(T03MZ)$X_*3MV-$$[>B1./RD[=ALH0@I"<F]K96YC87-E"ALD0C1!
+H.WHD3C\I.W8T03MZ)$X_*3MV&RA""ALD0C1!.WHD3B5&)3DE)!LH0@``
+eofeof
+
+$example['mime.unbuf.alt'] = <<'eofeof'.unpack('u')[0]
+M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
+M&RA"96YD"ALD0B0])"8D*R1*&RA"&R1"-$$[>B1./RD[=ALH0F5N9&]F;&EN
+M90H;)$(T03MZ)$X_*3MV-$$[>B1./RD[=ALH0@I"<F]K96YC87-E"ALD0C1!
+H.WHD3C\I.W8T03MZ)$X_*3MV&RA""ALD0C1!.WHD3B5&)3DE)!LH0@``
+eofeof
+
+print "MIME decode (nonstrict)";
+ $tmp = test("-j -mN",$example['mime.iso2022'],[$example['mime.ans'],$example['mime.ans.alt']])
+ # open(OUT,">tmp1");print OUT pack('u',$tmp);close(OUT);
+# unbuf mode implies more pessimistic decode
+print "MIME decode (unbuf) ";
+ $tmp = test("-j -mNu",$example['mime.iso2022'],[$example['mime.unbuf'],$example['mime.unbuf.alt']])
+ # open(OUT,">tmp2");print OUT pack('u',$tmp);close(OUT);
+print "MIME decode (base64) ";
+ test("-j -mB",$example['mime.base64'],[$example['mime.base64.ans']])
+
+# MIME ISO-8859-1
+
+$example['mime.is8859'] = <<'eofeof'.unpack('u')[0]
+M/3])4T\M.#@U.2TQ/U$_*CU#-V%V83\_/2`*4&5E<B!4]G)N9W)E;@I,87-S
+M92!(:6QL97+X92!0971E<G-E;B`@7"`B36EN(&MA97!H97-T(&AA<B!F86%E
+M="!E="!F;V5L(2(*06%R:'5S(%5N:79E<G-I='DL($1%3DU!4DL@(%P@(DUI
+<;B!KYG!H97-T(&AA<B!FY65T(&5T(&;X;"$B"@!K
+eofeof
+
+$example['mime.is8859.ans'] = <<'eofeof'.unpack('u')[0]
+M*L=A=F$_(`I0965R(%3V<FYG<F5N"DQA<W-E($AI;&QE<OAE(%!E=&5R<V5N
+M("!<(")-:6X@:V%E<&AE<W0@:&%R(&9A865T(&5T(&9O96PA(@I!87)H=7,@
+M56YI=F5R<VET>2P@1$5.34%22R`@7"`B36EN(&OF<&AE<W0@:&%R(&;E970@
+)970@9OAL(2(*
+eofeof
+
+# Without -l, ISO-8859-1 was handled as X0201.
+
+print "MIME ISO-8859-1 (Q) ";
+ test("-ml",$example['mime.is8859'],[$example['mime.is8859.ans']])
+
+# test for -f is not so simple.
+
+print "\nBug Fixes\n\n";
+
+# test_data/cr
+
+$example['test_data/cr'] = <<'eofeof'.unpack('u')[0]
+1I,:DN:3(#71E<W0-=&5S=`T`
+eofeof
+
+$example['test_data/cr.ans'] = <<'eofeof'.unpack('u')[0]
+7&R1")$8D.21(&RA""G1E<W0*=&5S=`H`
+eofeof
+
+print "test_data/cr ";
+ test("-jd",$example['test_data/cr'],[$example['test_data/cr.ans']])
+# test_data/fixed-qencode
+
+$example['test_data/fixed-qencode'] = <<'eofeof'.unpack('u')[0]
+M("`@("`@("`],4(D0CYE/STS1#TQ0BA""B`@("`@("`@/3%")$(^93TS1CTS
+'1#TQ0BA""@``
+eofeof
+
+$example['test_data/fixed-qencode.ans'] = <<'eofeof'.unpack('u')[0]
+F("`@("`@("`;)$(^93\]&RA""B`@("`@("`@&R1"/F4_/1LH0@H`
+eofeof
+
+print "test_data/fixed-qencode ";
+ test("-jmQ",$example['test_data/fixed-qencode'],[$example['test_data/fixed-qencode.ans']])
+# test_data/long-fold-1
+
+$example['test_data/long-fold-1'] = <<'eofeof'.unpack('u')[0]
+MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AHJ2SI.RD
+M\J2]I,ZDWJ3>I**DQ*2KI*:DR*&BI,FDIJ3BI-^DT*2HI*RD[Z3KI*2DMZ&B
+MI,BDP:3EI*:DQZ3!I.>D\Z2NI.RDZZ2KI.*DMZ3SI,JDI*&C"J2SI+.DSR!#
+M4B],1B"DSKG4H:,-"J2SI+.DSR!#4B"DSKG4H:,-I+.DLZ3/($Q&+T-2(*3.
+9N=2AHPH-"J2SI+.DSR!,1B"DSKG4H:,*"@``
+eofeof
+
+$example['test_data/long-fold-1.ans'] = <<'eofeof'.unpack('u')[0]
+M&R1")$HD+"0D)$HD+"0D)$HD+"%!)"0D+B1G)"8D+"0B)&HD7B0W)$8A(B0S
+M)&PD<B0])$XD7B1>)"(D1"0K&RA""ALD0B0F)$@A(B1))"8D8B1?)%`D*"0L
+M)&\D:R0D)#<A(B1()$$D920F)$<D021G)',D+B1L)&LD*R1B)#<D<QLH0@H;
+M)$(D2B0D(2,;*$(*&R1")#,D,R1/&RA"($-2+TQ&(!LD0B1..50A(QLH0@H;
+M)$(D,R0S)$\;*$(@0U(@&R1")$XY5"$C&RA""ALD0B0S)#,D3QLH0B!,1B]#
+M4B`;)$(D3CE4(2,;*$(*"ALD0B0S)#,D3QLH0B!,1B`;)$(D3CE4(2,;*$(*
+!"@``
+eofeof
+
+print "test_data/long-fold-1 ";
+ test("-jF60",$example['test_data/long-fold-1'],[$example['test_data/long-fold-1.ans']])
+# test_data/long-fold
+
+$example['test_data/long-fold'] = <<'eofeof'.unpack('u')[0]
+MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AHJ2SI.RD
+M\J2]I,ZDWJ3>I**DQ*2KI*:DR*&BI,FDIJ3BI-^DT*2HI*RD[Z3KI*2DMZ&B
+MI,BDP:3EI*:DQZ3!I.>D\Z2NI.RDZZ2KI.*DMZ3SI,JDI*&C"J2SI+.DS\.[
+'I*2YU*&C"@``
+eofeof
+
+$example['test_data/long-fold.ans'] = <<'eofeof'.unpack('u')[0]
+M&R1")$HD+"0D)$HD+"0D)$HD+"%!)"0D+B1G)"8D+"0B)&HD7B0W)$8A(B0S
+M)&PD<B0])$XD7B1>)"(D1"0K&RA""ALD0B0F)$@A(B1))"8D8B1?)%`D*"0L
+M)&\D:R0D)#<A(B1()$$D920F)$<D021G)',D+B1L)&LD*R1B)#<D<QLH0@H;
+:)$(D2B0D(2,D,R0S)$]#.R0D.50A(QLH0@H`
+eofeof
+
+print "test_data/long-fold ";
+ test("-jf60",$example['test_data/long-fold'],[$example['test_data/long-fold.ans']])
+# test_data/mime_out
+
+$example['test_data/mime_out'] = <<'eofeof'.unpack('u')[0]
+M"BTM+2T*4W5B:F5C=#H@86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$@
+M86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$@86%A82!A86%A"BTM+2T*
+M4W5B:F5C=#H@I**DI*2FI*BDJJ2KI*VDKZ2QI+.DM:2WI+FDNZ2]I+^DP:3$
+MI,:DR*3*I,NDS*3-I,ZDSZ32I-6DV*3;I-ZDWZ3@I.&DXJ3DI*2DYJ2HI.@*
+M+2TM+0I3=6)J96-T.B!A86%A(&%A86$@86%A82!A86%A(&%A86$@86%A82!A
+I86%A(*2BI*2DIJ2HI*H@86%A82!A86%A(&%A86$@86%A80HM+2TM"@H`
+eofeof
+
+$example['test_data/mime_out.ans'] = <<'eofeof'.unpack('u')[0]
+M"BTM+2T*4W5B:F5C=#H@86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$@
+M86%A82!A86%A(&%A86$@86%A80H@86%A82!A86%A(&%A86$@86%A82!A86%A
+M"BTM+2T*4W5B:F5C=#H@/3])4T\M,C`R,BU*4#]"/T=Y4D-*0TEK2D-1;4I#
+M9VM+:5%R2D,P:TQY47A*1$UK3E-1,T=Y:$,_/0H@/3])4T\M,C`R,BU*4#]"
+M/T=Y4D-*1&MK3WE1.4I$.&M14U)%2D59:U-#4DM*17-K5$-23DI%-&M4>5)3
+M2D95:U=#4F)'>6A#/ST*(#T_25-/+3(P,C(M2E`_0C]'>5)#2D8T:UAY4F=*
+M1T5K66E2:TI#46M::5%O2D=G8DM%23T_/0HM+2TM"E-U8FIE8W0Z(&%A86$@
+M86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$*(#T_25-/+3(P,C(M2E`_
+M0C]'>5)#2D-):TI#46U*0V=K2VAS;U%G/3T_/2!A86%A(&%A86$@86%A82!A
+086%A"B!A86%A"BTM+2T*"@``
+eofeof
+
+print "test_data/mime_out ";
+ test("-jM",$example['test_data/mime_out'],[$example['test_data/mime_out.ans']])
+# test_data/mime_out2
+
+$example['test_data/mime_out2'] = <<'eofeof'.unpack('u')[0]
+M5&AI<R!M96UO(&1E<V-R:6)E<R!S:6UI;&%R('1E8VAN:7%U97,@=&\@86QL
+M;W<@=&AE(&5N8V]D:6YG(&]F(&YO;BU!4T-)22!T97AT(&EN('9A<FEO=7,@
+M<&]R=&EO;G,@;V8@82!21D,@.#(R(%LR72!M97-S86=E(&AE861E<BP@:6X@
+M82!M86YN97(@=VAI8V@@:7,@=6YL:6ME;'D@=&\@8V]N9G5S92!E>&ES=&EN
+M9R!M97-S86=E(&AA;F1L:6YG('-O9G1W87)E+@H*4W5B:F5C=#H@=&5S=#$@
+M=&5S=#(@@L2"MX+&@J<@=&5S=#,@@L2"MX+&@O$@=&5S=#0*"E-U8FIE8W0Z
+M('1E<W0Q("!T97-T,B""Q"""MR""QB""IR!T97-T,R`@@L2"MX+&@O$@('1E
+M<W0T"@I!4T-)22"3^I9[C.H@05-#24D@05-#24D@D_J6>XSJ()/ZEGN,ZB!!
+M4T-)22!!4T-)29/ZEGN,ZB!!4T-)20H*@J`@@J(@@J0@@J8@@J@@@JD@@JL@
+M@JT@@J\@@K$@@K,@@K4@@K<@@KD@@KL@@KT@@K\@@L(@@L0@@L8@@L@@@LD@
+8@LH@@LL@@LP*"@H*"@H*"@H*"@H*"@H*
+eofeof
+
+$example['test_data/mime_out2.ans'] = <<'eofeof'.unpack('u')[0]
+M5&AI<R!M96UO(&1E<V-R:6)E<R!S:6UI;&%R('1E8VAN:7%U97,@=&\@86QL
+M;W<@=&AE(&5N8V]D:6YG(&5N8V]D:6YG"B!O9B!N;VXM05-#24D@=&5X="!I
+M;B!V87)I;W5S('!O<G1I;VYS(&]F(&$@80H@4D9#(#@R,B!;,ET@;65S<V%G
+M92!H96%D97(L(&EN(&$@;6%N;F5R('=H:6-H(&ES('5N;&EK96QY('5N;&EK
+M96QY"B!T;R!C;VYF=7-E(&5X:7-T:6YG(&UE<W-A9V4@:&%N9&QI;F<@<V]F
+M='=A<F4N"@I3=6)J96-T.B!T97-T,2!T97-T,B`]/TE33RTR,#(R+4I0/T(_
+M1WE20TI%66M/4U))2D-K8DM%23T_/2!T97-T,PH@/3])4T\M,C`R,BU*4#]"
+M/T=Y4D-*15EK3U-224I(36)+14D]/ST@=&5S=#0*"E-U8FIE8W0Z('1E<W0Q
+M("!T97-T,B`]/TE33RTR,#(R+4I0/T(_1WE20TI%66)+14EG1WE20TI$:V)+
+M14EG1WE20TI%9V)+14D]/ST*(#T_25-/+3(P,C(M2E`_0C]'>5)#1WEH0TE"
+M<VM1:5%P1WEH0S\]('1E<W0S(`H@/3])4T\M,C`R,BU*4#]"/T=Y4D-*15EK
+M3U-224I(36)+14D]/ST@('1E<W0T"@I!4T-)22`]/TE33RTR,#(R+4I0/T(_
+M1WE20U)N>$Q81&AS1WEH0S\]($%30TE)($%30TE)"B`]/TE33RTR,#(R+4I0
+M/T(_1WE20U)N>$Q81&AS1WEH0TE"<VM1:UHX4S%W-&)"<V]19ST]/ST@05-#
+M24D*(#T_25-/+3(P,C(M2E`_0C]15DY$4U5K8DI%2D=F171C3T=W8DM%23T_
+M/2!!4T-)20H*/3])4T\M,C`R,BU*4#]"/T=Y4D-*0TEB2T5)9T=Y4D-*0U%B
+M2T5)9T=Y4D-*0UEB2T5)9T=Y4D-*0V=B2T5)/3\]"B`]/TE33RTR,#(R+4I0
+M/T(_24)S:U%I47%'>6A#24)S:U%I47)'>6A#24)S:U%I471'>6A#24)S:U%I
+M479'>6A#/ST*(#T_25-/+3(P,C(M2E`_0C])0G-K46E1>$=Y:$-)0G-K46E1
+M>D=Y:$-)0G-K46E1,4=Y:$-)0G-K46E1,T=Y:$,_/0H@/3])4T\M,C`R,BU*
+M4#]"/TE"<VM1:5$U1WEH0TE"<VM1:5$W1WEH0TE"<VM1:5$Y1WEH0TE"<VM1
+M:5$O1WEH0S\]"B`]/TE33RTR,#(R+4I0/T(_24)S:U%I4D)'>6A#24)S:U%I
+M4D5'>6A#24)S:U%I4D='>6A#24)S:U%I4DE'>6A#/ST*(#T_25-/+3(P,C(M
+M2E`_0C])0G-K46E22T=Y:$-)0G-K46E23$=Y:$-)0G-K46E234=Y:$-)0G-K
+M46E23D=Y:$,_/0H@/3])4T\M,C`R,BU*4#]"/TE"<VM1:5)/1WEH0S\]"@H*
+-"@H*"@H*"@H*"@H*"@``
+eofeof
+
+print "test_data/mime_out2 ";
+ test("-jM",$example['test_data/mime_out2'],[$example['test_data/mime_out2.ans']])
+# test_data/multi-line
+
+$example['test_data/multi-line'] = <<'eofeof'.unpack('u')[0]
+MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AH@"DLZ3L
+MI/*DO:3.I-ZDWJ2BI,2DJZ2FI,BAHJ3)I*:DXJ3?I-"DJ*2LI.^DZZ2DI+>A
+MHJ3(I,&DY:2FI,>DP:3GI/.DKJ3LI.NDJZ3BI+>D\Z3*I*2AHPJDLZ2SI,_#
+8NZ2DN=2AHP`*I+.DLZ3/P[NDI+G4H:,*
+eofeof
+
+$example['test_data/multi-line.ans'] = <<'eofeof'.unpack('u')[0]
+MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AH@"DLZ3L
+MI/*DO:3.I-ZDWJ2BI,2DJZ2FI,BAHJ3)I*:DXJ3?I-"DJ*2LI.^DZZ2DI+>A
+MHJ3(I,&DY:2FI,>DP:3GI/.DKJ3LI.NDJZ3BI+>D\Z3*I*2AHPJDLZ2SI,_#
+8NZ2DN=2AHP`*I+.DLZ3/P[NDI+G4H:,*
+eofeof
+
+print "test_data/multi-line ";
+ test("-e",$example['test_data/multi-line'],[$example['test_data/multi-line.ans']])
+# test_data/nkf-19-bug-1
+
+$example['test_data/nkf-19-bug-1'] = <<'eofeof'.unpack('u')[0]
+,I*:DJZ2D"KK8QJ,*
+eofeof
+
+$example['test_data/nkf-19-bug-1.ans'] = <<'eofeof'.unpack('u')[0]
+8&R1")"8D*R0D&RA""ALD0CI81B,;*$(*
+eofeof
+
+print "test_data/nkf-19-bug-1 ";
+ test("-Ej",$example['test_data/nkf-19-bug-1'],[$example['test_data/nkf-19-bug-1.ans']])
+# test_data/nkf-19-bug-2
+
+$example['test_data/nkf-19-bug-2'] = <<'eofeof'.unpack('u')[0]
+%I-NDL@H`
+eofeof
+
+$example['test_data/nkf-19-bug-2.ans'] = <<'eofeof'.unpack('u')[0]
+%I-NDL@H`
+eofeof
+
+print "test_data/nkf-19-bug-2 ";
+ test("-Ee",$example['test_data/nkf-19-bug-2'],[$example['test_data/nkf-19-bug-2.ans']])
+# test_data/nkf-19-bug-3
+
+$example['test_data/nkf-19-bug-3'] = <<'eofeof'.unpack('u')[0]
+8[;'Q\,&L"N6ZSN\*\NT)ON7.SL_+"0D*
+eofeof
+
+$example['test_data/nkf-19-bug-3.ans'] = <<'eofeof'.unpack('u')[0]
+8[;'Q\,&L"N6ZSN\*\NT)ON7.SL_+"0D*
+eofeof
+
+print "test_data/nkf-19-bug-3 ";
+ test("-e",$example['test_data/nkf-19-bug-3'],[$example['test_data/nkf-19-bug-3.ans']])
+# test_data/non-strict-mime
+
+$example['test_data/non-strict-mime'] = <<'eofeof'.unpack('u')[0]
+M/3])4T\M,C`R,BU*4#]"/PIG<U-#;V]+.6=R-D-O;TQ%9W1Y0W0T1D-$46].
+M0V\V16=S,D]N;T999S1Y1%=)3$IG=4-0:UD*2W!G<FU#>$E+:6=R,D-V;TMI
+,9W-30V]O3&,*/ST*
+eofeof
+
+$example['test_data/non-strict-mime.ans'] = <<'eofeof'.unpack('u')[0]
+M&R1")$8D)"0_)$`D)"1&)%XD.2$C&RA"#0H-"ALD0CMD)$\[?B$Y)6PE.21+
+<)&(]<20K)#LD1B0D)#\D0"0D)$8D)"1>&RA""@``
+eofeof
+
+print "test_data/non-strict-mime ";
+ test("-jmN",$example['test_data/non-strict-mime'],[$example['test_data/non-strict-mime.ans']])
+# test_data/q-encode-softrap
+
+$example['test_data/q-encode-softrap'] = <<'eofeof'.unpack('u')[0]
+H/3%")$(T03MZ)3T*,R$\)4DD3CTQ0BA""CTQ0B1"2E$T.3TQ0BA""@``
+eofeof
+
+$example['test_data/q-encode-softrap.ans'] = <<'eofeof'.unpack('u')[0]
+>&R1"-$$[>B4S(3PE221.&RA""ALD0DI1-#D;*$(*
+eofeof
+
+print "test_data/q-encode-softrap ";
+ test("-jmQ",$example['test_data/q-encode-softrap'],[$example['test_data/q-encode-softrap.ans']])
+# test_data/rot13
+
+$example['test_data/rot13'] = <<'eofeof'.unpack('u')[0]
+MI+.D\Z3+I,&DSZ&BS:W"]*3(I*2DI*3>I+FAHPH*;FMF('9E<BXQ+CDR(*3R
+MS?C-T:2UI+NDQJ2DI+^DP*2DI,:DI*3>I+FDK*&B05-#24D@I,O"T*2WI,8@
+M4D]4,3,@I*P*P+6DMZ2OQK"DI*3&I*2DRJ2DI.BDIJ3'H:*PRK*\I,ZDZ*2F
+MI,O*T;2YI+6D[*3>I+ND\Z&C"@HE(&5C:&\@)VAO9V4G('P@;FMF("UR"FAO
+#9V4*
+eofeof
+
+$example['test_data/rot13.ans'] = <<'eofeof'.unpack('u')[0]
+M&R1"4V)31%-Z4W!3?E!1?%QQ15-W4U-34U,O4VA04ALH0@H*87AS(&ER92XQ
+M+CDR(!LD0E-#?$E\(E-D4VI3=5-34VY3;U-34W534U,O4VA36U!1&RA"3D90
+M5E8@&R1"4WIQ(5-F4W4;*$(@14)',3,@&R1"4UL;*$(*&R1";V139E->=5]3
+M4U-U4U-3>5-34SE355-V4%%?>6%K4WU3.5-54WIY(F-H4V13/5,O4VI31%!2
+A&RA""@HE(')P=6(@)W5B='(G('P@87AS("UE"G5B='(*
+eofeof
+
+print "test_data/rot13 ";
+ test("-jr",$example['test_data/rot13'],[$example['test_data/rot13.ans']])
+# test_data/slash
+
+$example['test_data/slash'] = <<'eofeof'.unpack('u')[0]
+7("`]/U8\5"U5.5=%2RTK.U<U32LE+PH`
+eofeof
+
+$example['test_data/slash.ans'] = <<'eofeof'.unpack('u')[0]
+7("`]/U8\5"U5.5=%2RTK.U<U32LE+PH`
+eofeof
+
+print "test_data/slash ";
+ test(" ",$example['test_data/slash'],[$example['test_data/slash.ans']])
+# test_data/z1space-0
+
+$example['test_data/z1space-0'] = <<'eofeof'.unpack('u')[0]
+"H:$`
+eofeof
+
+$example['test_data/z1space-0.ans'] = <<'eofeof'.unpack('u')[0]
+"H:$`
+eofeof
+
+print "test_data/z1space-0 ";
+ test("-e -Z",$example['test_data/z1space-0'],[$example['test_data/z1space-0.ans']])
+# test_data/z1space-1
+
+$example['test_data/z1space-1'] = <<'eofeof'.unpack('u')[0]
+"H:$`
+eofeof
+
+$example['test_data/z1space-1.ans'] = <<'eofeof'.unpack('u')[0]
+!(```
+eofeof
+
+print "test_data/z1space-1 ";
+ test("-e -Z1",$example['test_data/z1space-1'],[$example['test_data/z1space-1.ans']])
+# test_data/z1space-2
+
+$example['test_data/z1space-2'] = <<'eofeof'.unpack('u')[0]
+"H:$`
+eofeof
+
+$example['test_data/z1space-2.ans'] = <<'eofeof'.unpack('u')[0]
+"("``
+eofeof
+
+print "test_data/z1space-2 ";
+ test("-e -Z2",$example['test_data/z1space-2'],[$example['test_data/z1space-2.ans']])
+
+
+# end
diff --git a/ext/openssl/.cvsignore b/ext/openssl/.cvsignore
index 3a9a9f341f..dfb8bfb8bb 100644
--- a/ext/openssl/.cvsignore
+++ b/ext/openssl/.cvsignore
@@ -2,4 +2,3 @@ GNUmakefile
Makefile
mkmf.log
dep
-extconf.h
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index b2c5ca5ef8..d587116c82 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: extconf.rb,v $ -- Generator for Makefile
+= $RCSfile$ -- Generator for Makefile
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: extconf.rb,v 1.21.2.9 2006/06/20 11:18:15 gotoyuzo Exp $
+ $Id$
=end
require "mkmf"
@@ -62,7 +62,6 @@ unless have_header("openssl/conf_api.h")
end
message "=== Checking for OpenSSL features... ===\n"
-have_func("ERR_peek_last_error")
have_func("BN_mod_add")
have_func("BN_mod_sqr")
have_func("BN_mod_sub")
@@ -84,15 +83,12 @@ have_func("HMAC_CTX_copy")
have_func("HMAC_CTX_init")
have_func("PEM_def_callback")
have_func("X509V3_set_nconf")
-have_func("X509V3_EXT_nconf_nid")
have_func("X509_CRL_add0_revoked")
have_func("X509_CRL_set_issuer_name")
have_func("X509_CRL_set_version")
have_func("X509_CRL_sort")
have_func("X509_STORE_get_ex_data")
have_func("X509_STORE_set_ex_data")
-have_func("OBJ_NAME_do_all_sorted")
-have_func("OPENSSL_cleanse")
if try_compile("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1);FOO(1,2);FOO(1,2,3);}\n")
$defs.push("-DHAVE_VA_ARGS_MACRO")
end
@@ -117,7 +113,33 @@ have_struct_member("EVP_CIPHER_CTX", "engine", "openssl/evp.h")
have_struct_member("X509_ATTRIBUTE", "single", "openssl/x509.h")
message "=== Checking done. ===\n"
-
-create_header
+$distcleanfiles << "GNUmakefile" << "dep"
create_makefile("openssl")
+if /gcc/ =~ CONFIG["CC"]
+ File.open("GNUmakefile", "w") {|f|
+ f.print <<EOD
+include Makefile
+
+SRCS = $(OBJS:.o=.c)
+
+test-link: $(OBJS)
+ $(CC) $(DLDFLAGS) #{OUTFLAG}.testlink $(OBJS) $(LIBPATH) $(LIBS) $(LOCAL_LIBS)
+ @$(RM) .testlink
+ @echo "Done."
+
+dep:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(SRCS) -MM | \\
+ $(RUBY) -p -e 'BEGIN{S = []' \\
+ -e 'while !ARGV.empty? and /^(\\w+)=(.*)/ =~ ARGV[0]' \\
+ -e 'S << [/\#{Regexp.quote($$2)}\\//, "$$(\#{$$1})/"]' \\
+ -e 'ARGV.shift' \\
+ -e 'end' \\
+ -e '}' -e 'S.each(&method(:gsub!))' -- \\
+ 'topdir=$(topdir)' 'srcdir=$(srcdir)' 'hdrdir=$(hdrdir)' \\
+ > dep
+
+include dep
+EOD
+ }
+end
message "Done.\n"
diff --git a/ext/openssl/lib/net/ftptls.rb b/ext/openssl/lib/net/ftptls.rb
index 43cc136bf6..f433457923 100644
--- a/ext/openssl/lib/net/ftptls.rb
+++ b/ext/openssl/lib/net/ftptls.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: ftptls.rb,v $ -- SSL/TLS enhancement for Net::HTTP.
+= $RCSfile$ -- SSL/TLS enhancement for Net::HTTP.
= Info
'OpenSSL for Ruby 2' project
@@ -13,7 +13,7 @@
= Requirements
= Version
- $Id: ftptls.rb,v 1.1 2003/07/23 16:11:30 gotoyuzo Exp $
+ $Id$
= Notes
Tested on FreeBSD 5-CURRENT and 4-STABLE
diff --git a/ext/openssl/lib/net/https.rb b/ext/openssl/lib/net/https.rb
new file mode 100644
index 0000000000..9d24635f2f
--- /dev/null
+++ b/ext/openssl/lib/net/https.rb
@@ -0,0 +1,182 @@
+=begin
+= $RCSfile$ -- SSL/TLS enhancement for Net::HTTP.
+
+= Info
+ 'OpenSSL for Ruby 2' project
+ Copyright (C) 2001 GOTOU Yuuzou <gotoyuzo@notwork.org>
+ All rights reserved.
+
+= Licence
+ This program is licenced under the same licence as Ruby.
+ (See the file 'LICENCE'.)
+
+= Requirements
+ This program requires Net 1.2.0 or higher version.
+ You can get it from RAA or Ruby's CVS repository.
+
+= Version
+ $Id$
+
+ 2001/11/06: Contiributed to Ruby/OpenSSL project.
+
+== class Net::HTTP
+
+== Example
+
+Simple HTTP client is here:
+
+ require 'net/http'
+ host, port, path = "localhost", 80, "/"
+ if %r!http://(.*?)(?::(\d+))?(/.*)! =~ ARGV[0]
+ host = $1
+ port = $2.to_i if $2
+ path = $3
+ end
+ h = Net::HTTP.new(host, port)
+ h.get2(path){ |resp| print resp.body }
+
+It can be replaced by follow one:
+
+ require 'net/https'
+ host, port, path = "localhost", 80, "/"
+ if %r!(https?)://(.*?)(?::(\d+))?(/.*)! =~ ARGV[0]
+ scheme = $1
+ host = $2
+ port = $3 ? $3.to_i : ((scheme == "http") ? 80 : 443)
+ path = $4
+ end
+ h = Net::HTTP.new(host, port)
+ h.use_ssl = true if scheme == "https" # enable SSL/TLS
+ h.get2(path){ |resp| print resp.body }
+
+=== Instance Methods
+
+: use_ssl
+ returns ture if use SSL/TLS with HTTP.
+
+: use_ssl=((|true_or_false|))
+ sets use_ssl.
+
+: peer_cert
+ return the X.509 certificates the server presented.
+
+: key=((|key|))
+ Sets an OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
+ (This method is appeared in Michal Rokos's OpenSSL extention.)
+
+: cert=((|cert|))
+ Sets an OpenSSL::X509::Certificate object as client certificate.
+ (This method is appeared in Michal Rokos's OpenSSL extention.)
+
+: ca_file=((|path|))
+ Sets path of a CA certification file in PEM format.
+ The file can contrain several CA certificats.
+
+: ca_path=((|path|))
+ Sets path of a CA certification directory containing certifications
+ in PEM format.
+
+: verify_mode=((|mode|))
+ Sets the flags for server the certification verification at
+ begining of SSL/TLS session.
+ OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER is acceptable.
+
+: verify_callback=((|proc|))
+ Sets the verify callback for the server certification verification.
+
+: verify_depth=((|num|))
+ Sets the maximum depth for the certificate chain verification.
+
+: cert_store=((|store|))
+ Sets the X509::Store to verify peer certificate.
+
+=end
+
+require 'net/protocols'
+require 'net/http'
+
+module Net
+ class HTTP
+ class Conn < HTTPRequest
+ REQUEST_HAS_BODY=false
+ RESPONSE_HAS_BODY=false
+ METHOD="connect"
+
+ def initialize
+ super nil, nil
+ end
+
+ def exec( sock, addr, port, ver )
+ @socket = sock
+ request(addr, port, ver)
+ end
+
+ def request( addr, port, ver )
+ @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', addr, port, ver)
+ @socket.writeline ''
+ end
+ end
+
+ module ProxyMod
+ def edit_path( path )
+ if use_ssl
+ 'https://' + addr_port + path
+ else
+ 'http://' + addr_port + path
+ end
+ end
+ end
+
+ def self.socket_type
+ SSLIO
+ end
+
+ attr_reader :use_ssl
+ attr_writer :key, :cert
+ attr_writer :ca_file, :ca_path
+ attr_writer :verify_mode, :verify_callback, :verify_depth
+ attr_writer :cert_store, :timeout
+ attr_reader :peer_cert
+
+ alias :default_initialize :initialize
+
+ def initialize(*args)
+ default_initialize(*args)
+ @key = @cert = @ca_file = @ca_path = @verify_mode =
+ @verify_callback = @verify_depth = @timeout = @cert_store = nil
+ @already_connected = false
+ end
+
+ def use_ssl=(flag)
+ if @already_connected && !@use_ssl
+ raise ProtocolError, "connection is alrady set up"
+ end
+ @use_ssl = flag
+ end
+
+ def on_connect
+ if use_ssl
+ if proxy?
+ Conn.new.exec(@socket, @address, @port, "1.0")
+ resp = HTTPResponse.read_new(@socket)
+ if resp.code != '200'
+ raise resp.message
+ end
+ end
+ @socket.key = @key if @key
+ @socket.cert = @cert if @cert
+ @socket.ca_file = @ca_file
+ @socket.ca_path = @ca_path
+ @socket.verify_mode = @verify_mode
+ @socket.verify_callback = @verify_callback
+ @socket.verify_depth = @verify_depth
+ @socket.timeout = @timeout
+ @socket.cert_store = @cert_store
+ @socket.ssl_connect
+ @peer_cert = @socket.peer_cert
+ end
+ @already_connected = true
+ end
+
+ end
+end
diff --git a/ext/openssl/lib/net/protocols.rb b/ext/openssl/lib/net/protocols.rb
new file mode 100644
index 0000000000..6fb270304a
--- /dev/null
+++ b/ext/openssl/lib/net/protocols.rb
@@ -0,0 +1,55 @@
+=begin
+= $RCSfile$ -- SSL/TLS enhancement for Net.
+
+= Info
+ 'OpenSSL for Ruby 2' project
+ Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
+ All rights reserved.
+
+= Licence
+ This program is licenced under the same licence as Ruby.
+ (See the file 'LICENCE'.)
+
+= Requirements
+ This program requires Net 1.2.0 or higher version.
+ You can get it from RAA or Ruby's CVS repository.
+
+= Version
+ $Id$
+
+ 2001/11/06: Contiributed to Ruby/OpenSSL project.
+=end
+
+require 'net/protocol'
+require 'forwardable'
+require 'openssl'
+
+module Net
+ class SSLIO < InternetMessageIO
+ extend Forwardable
+
+ def_delegators(:@ssl_context,
+ :key=, :cert=, :ca_file=, :ca_path=,
+ :verify_mode=, :verify_callback=, :verify_depth=,
+ :timeout=, :cert_store=)
+
+ def initialize(addr, port, otime = nil, rtime = nil, dout = nil)
+ super
+ @ssl_context = OpenSSL::SSL::SSLContext.new()
+ end
+
+ def ssl_connect()
+ unless @ssl_context.verify_mode
+ warn "warning: peer certificate won't be verified in this SSL session."
+ @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ end
+ @socket = OpenSSL::SSL::SSLSocket.new(@socket, @ssl_context)
+ @socket.sync_close = true
+ @socket.connect
+ end
+
+ def peer_cert
+ @socket.peer_cert
+ end
+ end
+end
diff --git a/ext/openssl/lib/net/telnets.rb b/ext/openssl/lib/net/telnets.rb
index d277a5c2a6..a872f41e6a 100644
--- a/ext/openssl/lib/net/telnets.rb
+++ b/ext/openssl/lib/net/telnets.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: telnets.rb,v $ -- SSL/TLS enhancement for Net::Telnet.
+= $RCSfile$ -- SSL/TLS enhancement for Net::Telnet.
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: telnets.rb,v 1.1.2.1 2004/12/20 03:49:16 gotoyuzo Exp $
+ $Id$
2001/11/06: Contiributed to Ruby/OpenSSL project.
diff --git a/ext/openssl/lib/openssl.rb b/ext/openssl/lib/openssl.rb
index 58fd3887e3..24a9eed136 100644
--- a/ext/openssl/lib/openssl.rb
+++ b/ext/openssl/lib/openssl.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: openssl.rb,v $ -- Loader for all OpenSSL C-space and Ruby-space definitions
+= $RCSfile$ -- Loader for all OpenSSL C-space and Ruby-space definitions
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: openssl.rb,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ $Id$
=end
require 'openssl.so'
diff --git a/ext/openssl/lib/openssl/bn.rb b/ext/openssl/lib/openssl/bn.rb
index 4a1595c7ab..e7cbf2cfaf 100644
--- a/ext/openssl/lib/openssl/bn.rb
+++ b/ext/openssl/lib/openssl/bn.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: bn.rb,v $ -- Ruby-space definitions that completes C-space funcs for BN
+= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for BN
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: bn.rb,v 1.1 2003/07/23 16:11:30 gotoyuzo Exp $
+ $Id$
=end
##
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index 9eeb19d959..31dcdf1f9a 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: buffering.rb,v $ -- Buffering mix-in module.
+= $RCSfile$ -- Buffering mix-in module.
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: buffering.rb,v 1.5.2.4 2005/09/04 22:03:24 gotoyuzo Exp $
+ $Id$
=end
module Buffering
@@ -20,8 +20,6 @@ module Buffering
BLOCK_SIZE = 1024*16
def initialize(*args)
- @eof = false
- @rbuffer = ""
@sync = @io.sync
end
@@ -31,17 +29,17 @@ module Buffering
private
def fill_rbuff
+ @rbuffer = "" unless defined? @rbuffer
begin
@rbuffer << self.sysread(BLOCK_SIZE)
- rescue Errno::EAGAIN
- retry
rescue EOFError
@eof = true
end
end
def consume_rbuff(size=nil)
- if @rbuffer.empty?
+ if @rbuffer.size == 0
+ @eof = nil
nil
else
size = @rbuffer.size unless size
@@ -54,14 +52,8 @@ module Buffering
public
def read(size=nil, buf=nil)
- if size == 0
- if buf
- buf.clear
- else
- buf = ""
- end
- return @eof ? nil : buf
- end
+ fill_rbuff unless defined? @rbuffer
+ @eof ||= nil
until @eof
break if size && size <= @rbuffer.size
fill_rbuff
@@ -74,33 +66,10 @@ module Buffering
(size && ret.empty?) ? nil : ret
end
- def readpartial(maxlen, buf=nil)
- if maxlen == 0
- if buf
- buf.clear
- else
- buf = ""
- end
- return @eof ? nil : buf
- end
- if @rbuffer.empty?
- begin
- return sysread(maxlen, buf)
- rescue Errno::EAGAIN
- retry
- end
- end
- ret = consume_rbuff(maxlen)
- if buf
- buf.replace(ret)
- ret = buf
- end
- raise EOFError if ret.empty?
- ret
- end
-
def gets(eol=$/)
+ fill_rbuff unless defined? @rbuffer
idx = @rbuffer.index(eol)
+ @eof ||= nil
until @eof
break if idx
fill_rbuff
@@ -115,7 +84,7 @@ module Buffering
end
def each(eol=$/)
- while line = self.gets(eol)
+ while line = self.gets(eol?)
yield line
end
end
@@ -130,13 +99,13 @@ module Buffering
end
def readline(eol=$/)
- raise EOFError if eof?
+ raise EOFErorr if eof?
gets(eol)
end
def getc
c = read(1)
- c ? c[0] : nil
+ c ? c.to_i : nil
end
def each_byte
@@ -146,7 +115,7 @@ module Buffering
end
def readchar
- raise EOFError if eof?
+ raise EOFErorr if eof?
getc
end
@@ -155,8 +124,8 @@ module Buffering
end
def eof?
- fill_rbuff if !@eof && @rbuffer.empty?
- @eof && @rbuffer.empty?
+ @eof ||= nil
+ @eof && @rbuffer.size == 0
end
alias eof eof?
@@ -173,16 +142,11 @@ module Buffering
remain = idx ? idx + $/.size : @wbuffer.length
nwritten = 0
while remain > 0
- str = @wbuffer[nwritten,remain]
- begin
- nwrote = syswrite(str)
- rescue Errno::EAGAIN
- retry
- end
+ nwrote = syswrite(@wbuffer[nwritten,remain])
remain -= nwrote
nwritten += nwrote
end
- @wbuffer[0,nwritten] = ""
+ @wbuffer = ""
end
end
@@ -200,13 +164,10 @@ module Buffering
def puts(*args)
s = ""
- if args.empty?
- s << "\n"
- end
args.each{|arg|
s << arg.to_s
- if $/ && /\n\z/ !~ s
- s << "\n"
+ unless /#{$/}\z/o =~ s
+ s << $/
end
}
do_write(s)
diff --git a/ext/openssl/lib/openssl/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index 7825e5e9e6..11153104ee 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: cipher.rb,v $ -- Ruby-space predefined Cipher subclasses
+= $RCSfile$ -- Ruby-space predefined Cipher subclasses
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: cipher.rb,v 1.1.2.2 2006/06/20 11:18:15 gotoyuzo Exp $
+ $Id$
=end
##
@@ -20,25 +20,19 @@
module OpenSSL
module Cipher
- %w(AES CAST5 BF DES IDEA RC2 RC4 RC5).each{|name|
- klass = Class.new(Cipher){
- define_method(:initialize){|*args|
- cipher_name = args.inject(name){|n, arg| "#{n}-#{arg}" }
- super(cipher_name)
- }
- }
- const_set(name, klass)
- }
-
- %w(128 192 256).each{|keylen|
- klass = Class.new(Cipher){
- define_method(:initialize){|mode|
- mode ||= "CBC"
- cipher_name = "AES-#{keylen}-#{mode}"
- super(cipher_name)
- }
- }
- const_set("AES#{keylen}", klass)
+ %w(AES Cast5 BF DES Idea RC2 RC4 RC5).each{|cipher|
+ eval(<<-EOD)
+ class #{cipher} < Cipher
+ def initialize(*args)
+ args = args.join('-')
+ if args.size == 0
+ super(\"#{cipher}\")
+ else
+ super(\"#{cipher}-#\{args\}\")
+ end
+ end
+ end
+ EOD
}
class Cipher
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb
index 6f2c998ff6..58622f543e 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: digest.rb,v $ -- Ruby-space predefined Digest subclasses
+= $RCSfile$ -- Ruby-space predefined Digest subclasses
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: digest.rb,v 1.1.2.2 2006/06/20 11:18:15 gotoyuzo Exp $
+ $Id$
=end
##
@@ -21,27 +21,22 @@
module OpenSSL
module Digest
- alg = %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1)
- if OPENSSL_VERSION_NUMBER > 0x00908000
- alg += %w(SHA224 SHA256 SHA384 SHA512)
- end
-
- alg.each{|name|
- klass = Class.new(Digest){
- define_method(:initialize){|*data|
- if data.length > 1
- raise ArgumentError,
- "wrong number of arguments (#{data.length} for 1)"
+ %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1).each{|digest|
+ eval(<<-EOD)
+ class #{digest} < Digest
+ def initialize(data=nil)
+ super(\"#{digest}\", data)
end
- super(name, data.first)
- }
- }
- singleton = (class <<klass; self; end)
- singleton.class_eval{
- define_method(:digest){|data| Digest.digest(name, data) }
- define_method(:hexdigest){|data| Digest.hexdigest(name, data) }
- }
- const_set(name, klass)
+
+ def #{digest}::digest(data)
+ Digest::digest(\"#{digest}\", data)
+ end
+
+ def #{digest}::hexdigest(data)
+ Digest::hexdigest(\"#{digest}\", data)
+ end
+ end
+ EOD
}
end # Digest
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index abef21d823..629109a1de 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: ssl.rb,v $ -- Ruby-space definitions that completes C-space funcs for SSL
+= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for SSL
= Info
'OpenSSL for Ruby 2' project
@@ -11,12 +11,11 @@
(See the file 'LICENCE'.)
= Version
- $Id: ssl.rb,v 1.5.2.6 2006/05/23 18:14:05 gotoyuzo Exp $
+ $Id$
=end
require "openssl"
require "openssl/buffering"
-require "fcntl"
module OpenSSL
module SSL
@@ -29,12 +28,12 @@ module OpenSSL
to_io.peeraddr
end
- def setsockopt(level, optname, optval)
+ def getsockopt(level, optname, optval)
to_io.setsockopt(level, optname, optval)
end
- def getsockopt(level, optname)
- to_io.getsockopt(level, optname)
+ def setsockopt(level, optname)
+ to_io.setsockopt(level, optname)
end
def fcntl(*args)
@@ -50,46 +49,9 @@ module OpenSSL
end
end
- module Nonblock
- def initialize(*args)
- flag = File::NONBLOCK
- flag |= @io.fcntl(Fcntl::F_GETFL) if defined?(Fcntl::F_GETFL)
- @io.fcntl(Fcntl::F_SETFL, flag)
- super
- end
- end
-
class SSLSocket
include Buffering
include SocketForwarder
- include Nonblock
-
- def post_connection_check(hostname)
- check_common_name = true
- cert = peer_cert
- cert.extensions.each{|ext|
- next if ext.oid != "subjectAltName"
- ext.value.split(/,\s+/).each{|general_name|
- if /\ADNS:(.*)/ =~ general_name
- check_common_name = false
- reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+")
- return true if /\A#{reg}\z/i =~ hostname
- elsif /\AIP Address:(.*)/ =~ general_name
- check_common_name = false
- return true if $1 == hostname
- end
- }
- }
- if check_common_name
- cert.subject.to_a.each{|oid, value|
- if oid == "CN"
- reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
- return true if /\A#{reg}\z/i =~ hostname
- end
- }
- end
- raise SSLError, "hostname not match"
- end
end
class SSLServer
@@ -99,10 +61,6 @@ module OpenSSL
def initialize(svr, ctx)
@svr = svr
@ctx = ctx
- unless ctx.session_id_context
- session_id = OpenSSL::Digest::MD5.hexdigest($0)
- @ctx.session_id_context = session_id
- end
@start_immediately = true
end
diff --git a/ext/openssl/lib/openssl/x509.rb b/ext/openssl/lib/openssl/x509.rb
index 2ad3f8e96e..e711bda39c 100644
--- a/ext/openssl/lib/openssl/x509.rb
+++ b/ext/openssl/lib/openssl/x509.rb
@@ -1,5 +1,5 @@
=begin
-= $RCSfile: x509.rb,v $ -- Ruby-space definitions that completes C-space funcs for X509 and subclasses
+= $RCSfile$ -- Ruby-space definitions that completes C-space funcs for X509 and subclasses
= Info
'OpenSSL for Ruby 2' project
@@ -11,7 +11,7 @@
(See the file 'LICENCE'.)
= Version
- $Id: x509.rb,v 1.4.2.2 2004/12/19 08:28:33 gotoyuzo Exp $
+ $Id$
=end
require "openssl"
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c
index 2c005f41e5..dfa5f90012 100644
--- a/ext/openssl/openssl_missing.c
+++ b/ext/openssl/openssl_missing.c
@@ -1,5 +1,5 @@
/*
- * $Id: openssl_missing.c,v 1.2.2.4 2006/06/02 10:02:56 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -8,19 +8,11 @@
* This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
*/
-#include RUBY_EXTCONF_H
-
-#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ST_ENGINE)
-# include <openssl/engine.h>
-#endif
-#include <openssl/x509_vfy.h>
#if !defined(OPENSSL_NO_HMAC)
#include <string.h> /* memcpy() */
#include <openssl/hmac.h>
-#include "openssl_missing.h"
-
#if !defined(HAVE_HMAC_CTX_COPY)
int
HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
@@ -38,6 +30,7 @@ HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
#endif /* NO_HMAC */
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
+#include <openssl/x509_vfy.h>
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data)
{
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index 8d580f5ee8..2a082f3fe0 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -1,5 +1,5 @@
/*
- * $Id: openssl_missing.h,v 1.2.2.2 2005/04/15 19:16:18 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -103,10 +103,6 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
#endif
-#if !defined(HAVE_OPENSSL_CLEANSE)
-#define OPENSSL_cleanse(p, l) memset(p, 0, l)
-#endif
-
void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
int X509_CRL_set_version(X509_CRL *x, long version);
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 01c5ca2a04..41659f0e81 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl.c,v 1.11.2.6 2005/11/01 01:52:13 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -278,14 +278,9 @@ ossl_raise(VALUE exc, const char *fmt, ...)
va_list args;
char buf[BUFSIZ];
const char *msg;
- long e;
+ long e = ERR_get_error();
int len = 0;
-#ifdef HAVE_ERR_PEEK_LAST_ERROR
- e = ERR_peek_last_error();
-#else
- e = ERR_peek_error();
-#endif
if (fmt) {
va_start(args, fmt);
len = vsnprintf(buf, BUFSIZ, fmt, args);
@@ -296,34 +291,15 @@ ossl_raise(VALUE exc, const char *fmt, ...)
msg = ERR_error_string(e, NULL);
else
msg = ERR_reason_error_string(e);
+ ERR_clear_error();
fmt = len ? ": %s" : "%s";
len += snprintf(buf+len, BUFSIZ-len, fmt, msg);
}
- if (dOSSL == Qtrue){ /* show all errors on the stack */
- while ((e = ERR_get_error()) != 0){
- rb_warn("error on stack: %s", ERR_error_string(e, NULL));
- }
- }
- ERR_clear_error();
if(len > BUFSIZ) len = strlen(buf);
rb_exc_raise(rb_exc_new(exc, buf, len));
}
-VALUE
-ossl_get_errors()
-{
- VALUE ary;
- long e;
-
- ary = rb_ary_new();
- while ((e = ERR_get_error()) != 0){
- rb_ary_push(ary, rb_str_new2(ERR_error_string(e, NULL)));
- }
-
- return ary;
-}
-
/*
* Debug
*/
@@ -387,7 +363,6 @@ Init_openssl()
*/
/* CRYPTO_malloc_init(); */
/* ENGINE_load_builtin_engines(); */
- OpenSSL_add_ssl_algorithms();
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
SSL_load_error_strings();
@@ -436,7 +411,6 @@ Init_openssl()
dOSSL = Qfalse;
rb_define_module_function(mOSSL, "debug", ossl_debug_get, 0);
rb_define_module_function(mOSSL, "debug=", ossl_debug_set, 1);
- rb_define_module_function(mOSSL, "errors", ossl_get_errors, 0);
/*
* Get ID of to_der
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index eaa1fe6eb2..c5054beba2 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl.h,v 1.14.2.4.2.1 2006/12/25 11:16:49 shyouhei Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -11,19 +11,11 @@
#if !defined(_OSSL_H_)
#define _OSSL_H_
-#include RUBY_EXTCONF_H
-
#if defined(__cplusplus)
extern "C" {
#endif
/*
- *_FILE_OFFSET_BITS needs to be defined before some system headers on
- * Solaris.
- */
-#include "config.h"
-
-/*
* Check the OpenSSL version
* The only supported are:
* OpenSSL >= 0.9.7
@@ -53,7 +45,7 @@ extern "C" {
#include <openssl/conf_api.h>
#undef X509_NAME
#undef PKCS7_SIGNER_INFO
-#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ST_ENGINE)
+#if defined(HAVE_OPENSSL_ENGINE_H) && !defined(OPENSSL_NO_ENGINE)
# define OSSL_ENGINE_ENABLED
# include <openssl/engine.h>
#endif
@@ -172,7 +164,7 @@ extern VALUE dOSSL;
if (dOSSL == Qtrue) { \
fprintf(stderr, "OSSL_DEBUG: "); \
fprintf(stderr, fmt, ##__VA_ARGS__); \
- fprintf(stderr, " [%s:%d]\n", __FILE__, __LINE__); \
+ fprintf(stderr, " [in %s (%s:%d)]\n", __func__, __FILE__, __LINE__); \
} \
} while (0)
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 6bc5b88e8f..1ce5fa50c5 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_asn1.c,v 1.5.2.9 2006/04/29 13:52:15 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
@@ -42,19 +42,21 @@ asn1time_to_time(ASN1_TIME *time)
} else {
tm.tm_year += 1900;
}
+ tm.tm_mon -= 1;
break;
case V_ASN1_GENERALIZEDTIME:
if (sscanf(time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
&tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" );
}
+ tm.tm_mon -= 1;
break;
default:
rb_warning("unknown time format");
return Qnil;
}
argv[0] = INT2NUM(tm.tm_year);
- argv[1] = INT2NUM(tm.tm_mon);
+ argv[1] = INT2NUM(tm.tm_mon+1);
argv[2] = INT2NUM(tm.tm_mday);
argv[3] = INT2NUM(tm.tm_hour);
argv[4] = INT2NUM(tm.tm_min);
@@ -75,15 +77,6 @@ time_to_time_t(VALUE time)
}
/*
- * STRING conversion
- */
-VALUE
-asn1str_to_str(ASN1_STRING *str)
-{
- return rb_str_new(str->data, str->length);
-}
-
-/*
* ASN1_INTEGER conversions
* TODO: Make a decision what's the right way to do this.
*/
@@ -766,7 +759,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth,
if(tag_class == sUNIVERSAL &&
tag < ossl_asn1_info_size && ossl_asn1_info[tag].klass){
VALUE klass = *ossl_asn1_info[tag].klass;
- long flag = 0;
+ long flag;
if(!rb_obj_is_kind_of(value, rb_cArray)){
switch(tag){
case V_ASN1_BOOLEAN:
diff --git a/ext/openssl/ossl_asn1.h b/ext/openssl/ossl_asn1.h
index 6a1c97b902..919ede0f3b 100644
--- a/ext/openssl/ossl_asn1.h
+++ b/ext/openssl/ossl_asn1.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_asn1.h,v 1.3.2.1 2005/09/10 01:17:00 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
@@ -18,11 +18,6 @@ VALUE asn1time_to_time(ASN1_TIME *);
time_t time_to_time_t(VALUE);
/*
- * ASN1_STRING conversions
- */
-VALUE asn1str_to_str(ASN1_STRING *);
-
-/*
* ASN1_INTEGER conversions
*/
VALUE asn1integer_to_num(ASN1_INTEGER *);
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index 4e3248eb1d..8e80f412ee 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_bio.c,v 1.2.2.1 2005/06/19 16:29:17 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
@@ -9,9 +9,6 @@
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
BIO *
ossl_obj2bio(VALUE obj)
diff --git a/ext/openssl/ossl_bio.h b/ext/openssl/ossl_bio.h
index ca312679fa..2d8f675c5b 100644
--- a/ext/openssl/ossl_bio.h
+++ b/ext/openssl/ossl_bio.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_bio.h,v 1.2 2003/09/17 09:05:01 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' team members
* Copyright (C) 2003
* All rights reserved.
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index fb86c8721c..47a607e60f 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_bn.c,v 1.5.2.1 2004/12/15 01:54:39 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Technorama team <oss-ruby@technorama.net>
* All rights reserved.
diff --git a/ext/openssl/ossl_bn.h b/ext/openssl/ossl_bn.h
index bccdbc0cd6..12aa484873 100644
--- a/ext/openssl/ossl_bn.h
+++ b/ext/openssl/ossl_bn.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_bn.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 8d96d0b35a..11edd9a32f 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_cipher.c,v 1.4.2.6 2006/06/20 11:18:15 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -94,7 +94,7 @@ ossl_cipher_initialize(VALUE self, VALUE str)
name = StringValuePtr(str);
GetCipher(self, ctx);
if (!(cipher = EVP_get_cipherbyname(name))) {
- ossl_raise(rb_eRuntimeError, "unsupported cipher algorithm (%s)", name);
+ ossl_raise(rb_eRuntimeError, "Unsupported cipher algorithm (%s).", name);
}
if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, -1) != 1)
ossl_raise(eCipherError, NULL);
@@ -117,30 +117,6 @@ ossl_cipher_copy(VALUE self, VALUE other)
return self;
}
-static void*
-add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary)
-{
- rb_ary_push(ary, rb_str_new2(name->name));
- return NULL;
-}
-
-static VALUE
-ossl_s_ciphers(VALUE self)
-{
-#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED
- VALUE ary;
-
- ary = rb_ary_new();
- OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
- (void(*)(const OBJ_NAME*,void*))add_cipher_name_to_ary,
- (void*)ary);
-
- return ary;
-#else
- rb_notimplement();
-#endif
-}
-
static VALUE
ossl_cipher_reset(VALUE self)
{
@@ -222,7 +198,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
if(!NIL_P(vsalt)){
StringValue(vsalt);
if(RSTRING(vsalt)->len != PKCS5_SALT_LEN)
- rb_raise(eCipherError, "salt must be an 8-octet string");
+ rb_raise(eCipherError, "salt must be an 8-octet string.");
salt = RSTRING(vsalt)->ptr;
}
iter = NIL_P(viter) ? 2048 : NUM2INT(viter);
@@ -248,8 +224,7 @@ ossl_cipher_update(VALUE self, VALUE data)
StringValue(data);
in = RSTRING(data)->ptr;
- if ((in_len = RSTRING(data)->len) == 0)
- rb_raise(rb_eArgError, "data must not be empty");
+ in_len = RSTRING(data)->len;
GetCipher(self, ctx);
str = rb_str_new(0, in_len+EVP_CIPHER_CTX_block_size(ctx));
if (!EVP_CipherUpdate(ctx, RSTRING(str)->ptr, &out_len, in, in_len))
@@ -386,7 +361,6 @@ Init_ossl_cipher(void)
rb_define_alloc_func(cCipher, ossl_cipher_alloc);
rb_define_copy_func(cCipher, ossl_cipher_copy);
- rb_define_module_function(mCipher, "ciphers", ossl_s_ciphers, 0);
rb_define_method(cCipher, "initialize", ossl_cipher_initialize, 1);
rb_define_method(cCipher, "reset", ossl_cipher_reset, 0);
rb_define_method(cCipher, "encrypt", ossl_cipher_encrypt, -1);
diff --git a/ext/openssl/ossl_cipher.h b/ext/openssl/ossl_cipher.h
index 870927c37c..63c7a875e8 100644
--- a/ext/openssl/ossl_cipher.h
+++ b/ext/openssl/ossl_cipher.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_cipher.h,v 1.2 2003/09/05 09:08:40 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index 1844022506..ef89fdfe0d 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_config.c,v 1.8.2.3 2004/12/15 01:54:39 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_config.h b/ext/openssl/ossl_config.h
index 452d430b5e..cb226b27e5 100644
--- a/ext/openssl/ossl_config.h
+++ b/ext/openssl/ossl_config.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_config.h,v 1.2 2003/09/08 10:31:38 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index 8b9c273f4d..d22f022442 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_digest.c,v 1.4.2.2 2004/12/15 01:54:39 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_digest.h b/ext/openssl/ossl_digest.h
index b35bd217b3..8a1f7964f2 100644
--- a/ext/openssl/ossl_digest.h
+++ b/ext/openssl/ossl_digest.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_digest.h,v 1.2 2003/09/05 09:08:40 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c
index 6cc0183c0e..71ab373223 100644
--- a/ext/openssl/ossl_engine.c
+++ b/ext/openssl/ossl_engine.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_engine.c,v 1.4.2.6 2005/09/18 22:56:11 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* All rights reserved.
@@ -55,12 +55,9 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
VALUE name;
rb_scan_args(argc, argv, "01", &name);
- if(NIL_P(name)){
- ENGINE_load_builtin_engines();
- return Qtrue;
- }
+ if(NIL_P(name)) ENGINE_load_builtin_engines();
StringValue(name);
-#ifndef OPENSSL_NO_STATIC_ENGINE
+ OSSL_ENGINE_LOAD_IF_MATCH(openssl);
OSSL_ENGINE_LOAD_IF_MATCH(dynamic);
OSSL_ENGINE_LOAD_IF_MATCH(cswift);
OSSL_ENGINE_LOAD_IF_MATCH(chil);
@@ -70,13 +67,10 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
OSSL_ENGINE_LOAD_IF_MATCH(aep);
OSSL_ENGINE_LOAD_IF_MATCH(sureware);
OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
-#endif
#ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO
OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
#endif
- OSSL_ENGINE_LOAD_IF_MATCH(openssl);
- rb_warning("no such builtin loader for `%s'", RSTRING(name)->ptr);
- return Qnil;
+ rb_raise(eEngineError, "no such engine `%s'", RSTRING(name)->ptr);
#endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
}
@@ -114,13 +108,12 @@ ossl_engine_s_by_id(VALUE klass, VALUE id)
ossl_engine_s_load(1, &id, klass);
if(!(e = ENGINE_by_id(RSTRING(id)->ptr)))
ossl_raise(eEngineError, NULL);
- WrapEngine(klass, obj, e);
- if(rb_block_given_p()) rb_yield(obj);
if(!ENGINE_init(e))
ossl_raise(eEngineError, NULL);
ENGINE_ctrl(e, ENGINE_CTRL_SET_PASSWORD_CALLBACK,
0, NULL, (void(*)())ossl_pem_passwd_cb);
ERR_clear_error();
+ WrapEngine(klass, obj, e);
return obj;
}
@@ -217,11 +210,11 @@ ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
{
ENGINE *e;
EVP_PKEY *pkey;
- VALUE id, data, obj;
+ VALUE id, data;
char *sid, *sdata;
- rb_scan_args(argc, argv, "02", &id, &data);
- sid = NIL_P(id) ? NULL : StringValuePtr(id);
+ rb_scan_args(argc, argv, "11", &id, &data);
+ sid = StringValuePtr(id);
sdata = NIL_P(data) ? NULL : StringValuePtr(data);
GetEngine(self, e);
#if OPENSSL_VERSION_NUMBER < 0x00907000L
@@ -230,10 +223,8 @@ ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
pkey = ENGINE_load_private_key(e, sid, NULL, sdata);
#endif
if (!pkey) ossl_raise(eEngineError, NULL);
- obj = ossl_pkey_new(pkey);
- OSSL_PKEY_SET_PRIVATE(obj);
- return obj;
+ return ossl_pkey_new(pkey);
}
static VALUE
@@ -244,8 +235,8 @@ ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
VALUE id, data;
char *sid, *sdata;
- rb_scan_args(argc, argv, "02", &id, &data);
- sid = NIL_P(id) ? NULL : StringValuePtr(id);
+ rb_scan_args(argc, argv, "11", &id, &data);
+ sid = StringValuePtr(id);
sdata = NIL_P(data) ? NULL : StringValuePtr(data);
GetEngine(self, e);
#if OPENSSL_VERSION_NUMBER < 0x00907000L
@@ -271,58 +262,6 @@ ossl_engine_set_default(VALUE self, VALUE flag)
}
static VALUE
-ossl_engine_ctrl_cmd(int argc, VALUE *argv, VALUE self)
-{
- ENGINE *e;
- VALUE cmd, val;
- int ret;
-
- GetEngine(self, e);
- rb_scan_args(argc, argv, "11", &cmd, &val);
- StringValue(cmd);
- if (!NIL_P(val)) StringValue(val);
- ret = ENGINE_ctrl_cmd_string(e, RSTRING(cmd)->ptr,
- NIL_P(val) ? NULL : RSTRING(val)->ptr, 0);
- if (!ret) ossl_raise(eEngineError, NULL);
-
- return self;
-}
-
-static VALUE
-ossl_engine_cmd_flag_to_name(int flag)
-{
- switch(flag){
- case ENGINE_CMD_FLAG_NUMERIC: return rb_str_new2("NUMERIC");
- case ENGINE_CMD_FLAG_STRING: return rb_str_new2("STRING");
- case ENGINE_CMD_FLAG_NO_INPUT: return rb_str_new2("NO_INPUT");
- case ENGINE_CMD_FLAG_INTERNAL: return rb_str_new2("INTERNAL");
- default: return rb_str_new2("UNKNOWN");
- }
-}
-
-static VALUE
-ossl_engine_get_cmds(VALUE self)
-{
- ENGINE *e;
- const ENGINE_CMD_DEFN *defn, *p;
- VALUE ary, tmp;
-
- GetEngine(self, e);
- ary = rb_ary_new();
- if ((defn = ENGINE_get_cmd_defns(e)) != NULL){
- for (p = defn; p->cmd_num > 0; p++){
- tmp = rb_ary_new();
- rb_ary_push(tmp, rb_str_new2(p->cmd_name));
- rb_ary_push(tmp, rb_str_new2(p->cmd_desc));
- rb_ary_push(tmp, ossl_engine_cmd_flag_to_name(p->cmd_flags));
- rb_ary_push(ary, tmp);
- }
- }
-
- return ary;
-}
-
-static VALUE
ossl_engine_inspect(VALUE self)
{
VALUE str;
@@ -362,8 +301,6 @@ Init_ossl_engine()
rb_define_method(cEngine, "load_private_key", ossl_engine_load_privkey, -1);
rb_define_method(cEngine, "load_public_key", ossl_engine_load_pubkey, -1);
rb_define_method(cEngine, "set_default", ossl_engine_set_default, 1);
- rb_define_method(cEngine, "ctrl_cmd", ossl_engine_ctrl_cmd, -1);
- rb_define_method(cEngine, "cmds", ossl_engine_get_cmds, 0);
rb_define_method(cEngine, "inspect", ossl_engine_inspect, 0);
DefEngineConst(METHOD_RSA);
diff --git a/ext/openssl/ossl_engine.h b/ext/openssl/ossl_engine.h
index ccc426481a..ea2f256912 100644
--- a/ext/openssl/ossl_engine.h
+++ b/ext/openssl/ossl_engine.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_engine.h,v 1.1 2003/10/02 08:47:11 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index cd66ab6e2c..ca5917518f 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_hmac.c,v 1.4.2.2 2004/12/15 01:54:39 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_hmac.h b/ext/openssl/ossl_hmac.h
index 2c8d69c177..1a2978b39a 100644
--- a/ext/openssl/ossl_hmac.h
+++ b/ext/openssl/ossl_hmac.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_hmac.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index bd8c59faf9..37fd88e3ba 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_ns_spki.c,v 1.3.2.5 2006/03/17 10:10:53 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -56,17 +56,12 @@ ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
{
NETSCAPE_SPKI *spki;
VALUE buffer;
- unsigned char *p;
if (rb_scan_args(argc, argv, "01", &buffer) == 0) {
return self;
}
- StringValue(buffer);
- if (!(spki = NETSCAPE_SPKI_b64_decode(RSTRING(buffer)->ptr, -1))) {
- p = RSTRING(buffer)->ptr;
- if (!(spki = d2i_NETSCAPE_SPKI(NULL, &p, RSTRING(buffer)->len))) {
- ossl_raise(eSPKIError, NULL);
- }
+ if (!(spki = NETSCAPE_SPKI_b64_decode(StringValuePtr(buffer), -1))) {
+ ossl_raise(eSPKIError, NULL);
}
NETSCAPE_SPKI_free(DATA_PTR(self));
DATA_PTR(self) = spki;
@@ -75,26 +70,6 @@ ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
}
static VALUE
-ossl_spki_to_der(VALUE self)
-{
- NETSCAPE_SPKI *spki;
- VALUE str;
- long len;
- unsigned char *p;
-
- GetSPKI(self, spki);
- if ((len = i2d_NETSCAPE_SPKI(spki, NULL)) <= 0)
- ossl_raise(eX509CertError, NULL);
- str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
- if (i2d_NETSCAPE_SPKI(spki, &p) <= 0)
- ossl_raise(eX509CertError, NULL);
- ossl_str_adjust(str, p);
-
- return str;
-}
-
-static VALUE
ossl_spki_to_pem(VALUE self)
{
NETSCAPE_SPKI *spki;
@@ -168,7 +143,7 @@ ossl_spki_get_challenge(VALUE self)
GetSPKI(self, spki);
if (spki->spkac->challenge->length <= 0) {
OSSL_Debug("Challenge.length <= 0?");
- return rb_str_new(0, 0);
+ return rb_str_new2(NULL);
}
return rb_str_new(spki->spkac->challenge->data,
@@ -180,8 +155,8 @@ ossl_spki_set_challenge(VALUE self, VALUE str)
{
NETSCAPE_SPKI *spki;
- StringValue(str);
GetSPKI(self, spki);
+ StringValue(str);
if (!ASN1_STRING_set(spki->spkac->challenge, RSTRING(str)->ptr,
RSTRING(str)->len)) {
ossl_raise(eSPKIError, NULL);
@@ -242,7 +217,6 @@ Init_ossl_ns_spki()
rb_define_alloc_func(cSPKI, ossl_spki_alloc);
rb_define_method(cSPKI, "initialize", ossl_spki_initialize, -1);
- rb_define_method(cSPKI, "to_der", ossl_spki_to_der, 0);
rb_define_method(cSPKI, "to_pem", ossl_spki_to_pem, 0);
rb_define_alias(cSPKI, "to_s", "to_pem");
rb_define_method(cSPKI, "to_text", ossl_spki_print, 0);
diff --git a/ext/openssl/ossl_ns_spki.h b/ext/openssl/ossl_ns_spki.h
index 2ca1fdcd62..9977035a9c 100644
--- a/ext/openssl/ossl_ns_spki.h
+++ b/ext/openssl/ossl_ns_spki.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_ns_spki.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c
index f2097b967e..f88f749941 100644
--- a/ext/openssl/ossl_ocsp.c
+++ b/ext/openssl/ossl_ocsp.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_ocsp.c,v 1.4.2.2 2005/01/22 20:28:02 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
@@ -261,11 +261,11 @@ ossl_ocspreq_to_der(VALUE self)
unsigned char *p;
long len;
- GetOCSPReq(self, req);
if((len = i2d_OCSP_REQUEST(req, NULL)) <= 0)
ossl_raise(eOCSPError, NULL);
str = rb_str_new(0, len);
p = RSTRING(str)->ptr;
+ GetOCSPReq(self, req);
if(i2d_OCSP_REQUEST(req, &p) <= 0)
ossl_raise(eOCSPError, NULL);
ossl_str_adjust(str, p);
diff --git a/ext/openssl/ossl_ocsp.h b/ext/openssl/ossl_ocsp.h
index 244fbb2a74..65b4f2e23f 100644
--- a/ext/openssl/ossl_ocsp.h
+++ b/ext/openssl/ossl_ocsp.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_ocsp.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
* Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c
index e4b334c67e..e7d9954c5a 100644
--- a/ext/openssl/ossl_pkcs12.c
+++ b/ext/openssl/ossl_pkcs12.c
@@ -1,7 +1,7 @@
/*
* This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
- * $Id: ossl_pkcs12.c,v 1.2 2003/12/15 00:30:12 usa Exp $
+ * $Id$
*/
#include "ossl.h"
diff --git a/ext/openssl/ossl_pkcs12.h b/ext/openssl/ossl_pkcs12.h
index 95b29de9b5..fa73c4bec5 100644
--- a/ext/openssl/ossl_pkcs12.h
+++ b/ext/openssl/ossl_pkcs12.h
@@ -1,10 +1,10 @@
/*
* This program is licenced under the same licence as Ruby.
* (See the file 'LICENCE'.)
- * $Id: ossl_pkcs12.h,v 1.1.2.1 2005/06/19 16:29:17 gotoyuzo Exp $
+ * $Id$
*/
#if !defined(_OSSL_PKCS12_H_)
-#define _OSSL_PKCS12_H_
+#define _OSSL_PKCS7_H_
extern VALUE mPKCS12;
extern VALUE cPKCS12;
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index 0fa85299aa..8d4b1f206e 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkcs7.c,v 1.5.2.3 2005/09/10 01:11:15 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -44,23 +44,6 @@
GetPKCS7si(obj, p7si); \
} while (0)
-#define WrapPKCS7ri(klass, obj, p7ri) do { \
- if (!p7ri) { \
- ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
- } \
- obj = Data_Wrap_Struct(klass, 0, PKCS7_RECIP_INFO_free, p7ri); \
-} while (0)
-#define GetPKCS7ri(obj, p7ri) do { \
- Data_Get_Struct(obj, PKCS7_RECIP_INFO, p7ri); \
- if (!p7ri) { \
- ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
- } \
-} while (0)
-#define SafeGetPKCS7ri(obj, p7ri) do { \
- OSSL_Check_Kind(obj, cPKCS7Recipient); \
- GetPKCS7ri(obj, p7ri); \
-} while (0)
-
#define numberof(ary) (sizeof(ary)/sizeof(ary[0]))
#define ossl_pkcs7_set_data(o,v) rb_iv_set((o), "@data", (v))
@@ -74,7 +57,6 @@
VALUE mPKCS7;
VALUE cPKCS7;
VALUE cPKCS7Signer;
-VALUE cPKCS7Recipient;
VALUE ePKCS7Error;
/*
@@ -107,32 +89,6 @@ DupPKCS7SignerPtr(VALUE obj)
return pkcs7;
}
-static VALUE
-ossl_pkcs7ri_new(PKCS7_RECIP_INFO *p7ri)
-{
- PKCS7_RECIP_INFO *pkcs7;
- VALUE obj;
-
- pkcs7 = p7ri ? PKCS7_RECIP_INFO_dup(p7ri) : PKCS7_RECIP_INFO_new();
- if (!pkcs7) ossl_raise(ePKCS7Error, NULL);
- WrapPKCS7ri(cPKCS7Recipient, obj, pkcs7);
-
- return obj;
-}
-
-static PKCS7_RECIP_INFO *
-DupPKCS7RecipientPtr(VALUE obj)
-{
- PKCS7_RECIP_INFO *p7ri, *pkcs7;
-
- SafeGetPKCS7ri(obj, p7ri);
- if (!(pkcs7 = PKCS7_RECIP_INFO_dup(p7ri))) {
- ossl_raise(ePKCS7Error, NULL);
- }
-
- return pkcs7;
-}
-
/*
* Private
*/
@@ -485,50 +441,30 @@ ossl_pkcs7_get_signer(VALUE self)
}
static VALUE
-ossl_pkcs7_add_recipient(VALUE self, VALUE recip)
+ossl_pkcs7_add_recipient(VALUE self, VALUE cert)
{
PKCS7 *pkcs7;
PKCS7_RECIP_INFO *ri;
-
- ri = DupPKCS7RecipientPtr(recip); /* NEED TO DUP */
+ X509 *x509;
+
+ x509 = GetX509CertPtr(cert); /* NO NEED TO DUP */
+ if (!(ri = PKCS7_RECIP_INFO_new())) {
+ ossl_raise(ePKCS7Error, NULL);
+ }
+ if (!PKCS7_RECIP_INFO_set(ri, x509)) {
+ PKCS7_RECIP_INFO_free(ri);
+ ossl_raise(ePKCS7Error, NULL);
+ }
GetPKCS7(self, pkcs7);
if (!PKCS7_add_recipient_info(pkcs7, ri)) {
PKCS7_RECIP_INFO_free(ri);
- ossl_raise(ePKCS7Error, "Could not add recipient.");
+ ossl_raise(ePKCS7Error, NULL);
}
return self;
}
static VALUE
-ossl_pkcs7_get_recipient(VALUE self)
-{
- PKCS7 *pkcs7;
- STACK_OF(PKCS7_RECIP_INFO) *sk;
- PKCS7_RECIP_INFO *si;
- int num, i;
- VALUE ary;
-
- GetPKCS7(self, pkcs7);
- if (PKCS7_type_is_enveloped(pkcs7))
- sk = pkcs7->d.enveloped->recipientinfo;
- else if (PKCS7_type_is_signedAndEnveloped(pkcs7))
- sk = pkcs7->d.signed_and_enveloped->recipientinfo;
- else sk = NULL;
- if (!sk) return rb_ary_new();
- if ((num = sk_PKCS7_RECIP_INFO_num(sk)) < 0) {
- ossl_raise(ePKCS7Error, "Negative number of recipient!");
- }
- ary = rb_ary_new2(num);
- for (i=0; i<num; i++) {
- si = sk_PKCS7_RECIP_INFO_value(sk, i);
- rb_ary_push(ary, ossl_pkcs7ri_new(si));
- }
-
- return ary;
-}
-
-static VALUE
ossl_pkcs7_add_certificate(VALUE self, VALUE cert)
{
PKCS7 *pkcs7;
@@ -814,7 +750,7 @@ ossl_pkcs7si_initialize(VALUE self, VALUE cert, VALUE key, VALUE digest)
}
static VALUE
-ossl_pkcs7si_get_issuer(VALUE self)
+ossl_pkcs7si_get_name(VALUE self)
{
PKCS7_SIGNER_INFO *p7si;
@@ -857,68 +793,6 @@ ossl_pkcs7si_get_signed_time(VALUE self)
}
/*
- * RECIPIENT INFO
- */
-static VALUE
-ossl_pkcs7ri_alloc(VALUE klass)
-{
- PKCS7_RECIP_INFO *p7ri;
- VALUE obj;
-
- if (!(p7ri = PKCS7_RECIP_INFO_new())) {
- ossl_raise(ePKCS7Error, NULL);
- }
- WrapPKCS7ri(klass, obj, p7ri);
-
- return obj;
-}
-
-static VALUE
-ossl_pkcs7ri_initialize(VALUE self, VALUE cert)
-{
- PKCS7_RECIP_INFO *p7ri;
- X509 *x509;
-
- x509 = GetX509CertPtr(cert); /* NO NEED TO DUP */
- GetPKCS7ri(self, p7ri);
- if (!PKCS7_RECIP_INFO_set(p7ri, x509)) {
- ossl_raise(ePKCS7Error, NULL);
- }
-
- return self;
-}
-
-static VALUE
-ossl_pkcs7ri_get_issuer(VALUE self)
-{
- PKCS7_RECIP_INFO *p7ri;
-
- GetPKCS7ri(self, p7ri);
-
- return ossl_x509name_new(p7ri->issuer_and_serial->issuer);
-}
-
-static VALUE
-ossl_pkcs7ri_get_serial(VALUE self)
-{
- PKCS7_RECIP_INFO *p7ri;
-
- GetPKCS7ri(self, p7ri);
-
- return asn1integer_to_num(p7ri->issuer_and_serial->serial);
-}
-
-static VALUE
-ossl_pkcs7ri_get_enc_key(VALUE self)
-{
- PKCS7_RECIP_INFO *p7ri;
-
- GetPKCS7ri(self, p7ri);
-
- return asn1str_to_str(p7ri->enc_key);
-}
-
-/*
* INIT
*/
void
@@ -947,7 +821,6 @@ Init_ossl_pkcs7()
rb_define_method(cPKCS7, "add_signer", ossl_pkcs7_add_signer, 1);
rb_define_method(cPKCS7, "signers", ossl_pkcs7_get_signer, 0);
rb_define_method(cPKCS7, "add_recipient", ossl_pkcs7_add_recipient, 1);
- rb_define_method(cPKCS7, "recipients", ossl_pkcs7_get_recipient, 0);
rb_define_method(cPKCS7, "add_certificate", ossl_pkcs7_add_certificate, 1);
rb_define_method(cPKCS7, "certificates=", ossl_pkcs7_set_certificates, 1);
rb_define_method(cPKCS7, "certificates", ossl_pkcs7_get_certificates, 0);
@@ -962,21 +835,12 @@ Init_ossl_pkcs7()
rb_define_alias(cPKCS7, "to_s", "to_pem");
rb_define_method(cPKCS7, "to_der", ossl_pkcs7_to_der, 0);
- cPKCS7Signer = rb_define_class_under(mPKCS7, "SignerInfo", rb_cObject);
- rb_define_const(mPKCS7, "Signer", cPKCS7Signer);
+ cPKCS7Signer = rb_define_class_under(mPKCS7, "Signer", rb_cObject);
rb_define_alloc_func(cPKCS7Signer, ossl_pkcs7si_alloc);
rb_define_method(cPKCS7Signer, "initialize", ossl_pkcs7si_initialize,3);
- rb_define_method(cPKCS7Signer, "issuer", ossl_pkcs7si_get_issuer, 0);
- rb_define_alias(cPKCS7Signer, "name", "issuer");
+ rb_define_method(cPKCS7Signer, "name", ossl_pkcs7si_get_name,0);
rb_define_method(cPKCS7Signer, "serial", ossl_pkcs7si_get_serial,0);
- rb_define_method(cPKCS7Signer,"signed_time",ossl_pkcs7si_get_signed_time,0);
-
- cPKCS7Recipient = rb_define_class_under(mPKCS7,"RecipientInfo",rb_cObject);
- rb_define_alloc_func(cPKCS7Recipient, ossl_pkcs7ri_alloc);
- rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1);
- rb_define_method(cPKCS7Recipient, "issuer", ossl_pkcs7ri_get_issuer,0);
- rb_define_method(cPKCS7Recipient, "serial", ossl_pkcs7ri_get_serial,0);
- rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0);
+ rb_define_method(cPKCS7Signer, "signed_time", ossl_pkcs7si_get_signed_time,0);
#define DefPKCS7Const(x) rb_define_const(mPKCS7, #x, INT2NUM(PKCS7_##x))
diff --git a/ext/openssl/ossl_pkcs7.h b/ext/openssl/ossl_pkcs7.h
index fdf0d9fb34..9378397f25 100644
--- a/ext/openssl/ossl_pkcs7.h
+++ b/ext/openssl/ossl_pkcs7.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkcs7.h,v 1.1.2.1 2005/09/10 01:17:00 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -13,8 +13,7 @@
extern VALUE mPKCS7;
extern VALUE cPKCS7;
-extern VALUE cPKCS7Signer;
-extern VALUE cPKCS7Recipient;
+extern VALUE cPKCS7SignerInfo;
extern VALUE ePKCS7Error;
void Init_ossl_pkcs7(void);
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index 5a061597f6..1a38a2c1d7 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkey.c,v 1.4.2.2 2005/04/08 09:26:54 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -96,21 +96,10 @@ GetPrivPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
- if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) {
+ SafeGetPKey(obj, pkey);
+ if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) { /* returns Qtrue */
ossl_raise(rb_eArgError, "Private key is needed.");
}
- SafeGetPKey(obj, pkey);
-
- return pkey;
-}
-
-EVP_PKEY *
-DupPKeyPtr(VALUE obj)
-{
- EVP_PKEY *pkey;
-
- SafeGetPKey(obj, pkey);
- CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
return pkey;
}
@@ -120,10 +109,10 @@ DupPrivPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
- if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) {
+ SafeGetPKey(obj, pkey);
+ if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) { /* returns Qtrue */
ossl_raise(rb_eArgError, "Private key is needed.");
}
- SafeGetPKey(obj, pkey);
CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
return pkey;
@@ -163,10 +152,10 @@ ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
int buf_len;
VALUE str;
+ GetPKey(self, pkey);
if (rb_funcall(self, id_private_q, 0, NULL) != Qtrue) {
ossl_raise(rb_eArgError, "Private key is needed.");
}
- GetPKey(self, pkey);
EVP_SignInit(&ctx, GetDigestPtr(digest));
StringValue(data);
EVP_SignUpdate(&ctx, RSTRING(data)->ptr, RSTRING(data)->len);
diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h
index 224f0f4634..189573546e 100644
--- a/ext/openssl/ossl_pkey.h
+++ b/ext/openssl/ossl_pkey.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkey.h,v 1.2.2.2 2005/09/18 22:56:11 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -16,16 +16,11 @@ extern VALUE cPKey;
extern VALUE ePKeyError;
extern ID id_private_q;
-#define OSSL_PKEY_SET_PRIVATE(obj) rb_iv_set((obj), "private", Qtrue)
-#define OSSL_PKEY_SET_PUBLIC(obj) rb_iv_set((obj), "private", Qfalse)
-#define OSSL_PKEY_IS_PRIVATE(obj) (rb_iv_get((obj), "private") == Qtrue)
-
#define WrapPKey(klass, obj, pkey) do { \
if (!pkey) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
} \
obj = Data_Wrap_Struct(klass, 0, EVP_PKEY_free, pkey); \
- OSSL_PKEY_SET_PUBLIC(obj); \
} while (0)
#define GetPKey(obj, pkey) do {\
Data_Get_Struct(obj, EVP_PKEY, pkey);\
@@ -43,7 +38,7 @@ void ossl_generate_cb(int, int, void *);
VALUE ossl_pkey_new(EVP_PKEY *);
VALUE ossl_pkey_new_from_file(VALUE);
EVP_PKEY *GetPKeyPtr(VALUE);
-EVP_PKEY *DupPKeyPtr(VALUE);
+/*EVP_PKEY *DupPKeyPtr(VALUE);*/
EVP_PKEY *GetPrivPKeyPtr(VALUE);
EVP_PKEY *DupPrivPKeyPtr(VALUE);
void Init_ossl_pkey(void);
@@ -71,8 +66,6 @@ void Init_ossl_dsa(void);
*/
extern VALUE cDH;
extern VALUE eDHError;
-extern DH *OSSL_DEFAULT_DH_512;
-extern DH *OSSL_DEFAULT_DH_1024;
VALUE ossl_dh_new(EVP_PKEY *);
void Init_ossl_dh(void);
@@ -111,10 +104,10 @@ static VALUE ossl_##keytype##_set_##name(VALUE self, VALUE bignum) \
return bignum; \
}
-#define DEF_OSSL_PKEY_BN(class, keytype, name) \
-do { \
+#define DEF_OSSL_PKEY_BN(class, keytype, name) \
+do { \
rb_define_method(class, #name, ossl_##keytype##_get_##name, 0); \
- rb_define_method(class, #name "=", ossl_##keytype##_set_##name, 1);\
+ rb_define_method(class, #name "=", ossl_##keytype##_set_##name, 1); \
} while (0)
#endif /* _OSSL_PKEY_H_ */
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index 79692f2f47..7070cf03f4 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkey_dh.c,v 1.4.2.3 2005/04/08 09:26:54 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -350,78 +350,18 @@ OSSL_PKEY_BN(dh, pub_key);
OSSL_PKEY_BN(dh, priv_key);
/*
- * -----BEGIN DH PARAMETERS-----
- * MEYCQQD0zXHljRg/mJ9PYLACLv58Cd8VxBxxY7oEuCeURMiTqEhMym16rhhKgZG2
- * zk2O9uUIBIxSj+NKMURHGaFKyIvLAgEC
- * -----END DH PARAMETERS-----
- */
-static unsigned char DEFAULT_DH_512_PRIM[] = {
- 0xf4, 0xcd, 0x71, 0xe5, 0x8d, 0x18, 0x3f, 0x98,
- 0x9f, 0x4f, 0x60, 0xb0, 0x02, 0x2e, 0xfe, 0x7c,
- 0x09, 0xdf, 0x15, 0xc4, 0x1c, 0x71, 0x63, 0xba,
- 0x04, 0xb8, 0x27, 0x94, 0x44, 0xc8, 0x93, 0xa8,
- 0x48, 0x4c, 0xca, 0x6d, 0x7a, 0xae, 0x18, 0x4a,
- 0x81, 0x91, 0xb6, 0xce, 0x4d, 0x8e, 0xf6, 0xe5,
- 0x08, 0x04, 0x8c, 0x52, 0x8f, 0xe3, 0x4a, 0x31,
- 0x44, 0x47, 0x19, 0xa1, 0x4a, 0xc8, 0x8b, 0xcb,
-};
-static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 };
-DH *OSSL_DEFAULT_DH_512 = NULL;
-
-/*
- * -----BEGIN DH PARAMETERS-----
- * MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ
- * AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR
- * T4h7KZ/2zmjvV+eF8kBUHBJAojUlzxKj4QeO2x20FP9X5xmNUXeDAgEC
- * -----END DH PARAMETERS-----
- */
-static unsigned char DEFAULT_DH_1024_PRIM[] = {
- 0x9d, 0x25, 0x39, 0x5c, 0xb4, 0x54, 0x8a, 0xff,
- 0x25, 0xe6, 0xd6, 0x9f, 0x4c, 0xc3, 0xc1, 0x8d,
- 0xa1, 0xfa, 0xba, 0x88, 0x4c, 0x53, 0xa9, 0x74,
- 0xda, 0xfa, 0xba, 0x0b, 0x20, 0xbe, 0x40, 0xd7,
- 0xba, 0xe7, 0x1d, 0x70, 0x28, 0x61, 0x60, 0x4c,
- 0x49, 0x01, 0x5f, 0xd9, 0x0f, 0x60, 0x16, 0x3d,
- 0xba, 0xd3, 0xa9, 0x5e, 0xfa, 0x98, 0x64, 0x60,
- 0x26, 0x0e, 0x04, 0x75, 0xd8, 0x13, 0xd7, 0x31,
- 0xb4, 0x8e, 0xad, 0xeb, 0x9c, 0x57, 0x4c, 0x8f,
- 0x65, 0xf3, 0x90, 0x16, 0x31, 0xdc, 0x15, 0x6f,
- 0x7d, 0x1d, 0x00, 0xae, 0x76, 0xf2, 0xd1, 0x11,
- 0xd1, 0x4f, 0x88, 0x7b, 0x29, 0x9f, 0xf6, 0xce,
- 0x68, 0xef, 0x57, 0xe7, 0x85, 0xf2, 0x40, 0x54,
- 0x1c, 0x12, 0x40, 0xa2, 0x35, 0x25, 0xcf, 0x12,
- 0xa3, 0xe1, 0x07, 0x8e, 0xdb, 0x1d, 0xb4, 0x14,
- 0xff, 0x57, 0xe7, 0x19, 0x8d, 0x51, 0x77, 0x83
-};
-static unsigned char DEFAULT_DH_1024_GEN[] = { 0x02 };
-DH *OSSL_DEFAULT_DH_1024 = NULL;
-
-static DH*
-ossl_create_dh(unsigned char *p, size_t plen, unsigned char *g, size_t glen)
-{
- DH *dh;
-
- if ((dh = DH_new()) == NULL) ossl_raise(eDHError, NULL);
- dh->p = BN_bin2bn(p, plen, NULL);
- dh->g = BN_bin2bn(g, glen, NULL);
- if (dh->p == NULL || dh->g == NULL){
- DH_free(dh);
- ossl_raise(eDHError, NULL);
- }
-
- return dh;
-}
-
-/*
* INIT
*/
void
Init_ossl_dh()
{
eDHError = rb_define_class_under(mPKey, "DHError", ePKeyError);
+
cDH = rb_define_class_under(mPKey, "DH", cPKey);
+
rb_define_singleton_method(cDH, "generate", ossl_dh_s_generate, -1);
rb_define_method(cDH, "initialize", ossl_dh_initialize, -1);
+
rb_define_method(cDH, "public?", ossl_dh_is_public, 0);
rb_define_method(cDH, "private?", ossl_dh_is_private, 0);
rb_define_method(cDH, "to_text", ossl_dh_to_text, 0);
@@ -430,25 +370,22 @@ Init_ossl_dh()
rb_define_alias(cDH, "to_s", "export");
rb_define_method(cDH, "to_der", ossl_dh_to_der, 0);
rb_define_method(cDH, "public_key", ossl_dh_to_public_key, 0);
+
rb_define_method(cDH, "params_ok?", ossl_dh_check_params, 0);
rb_define_method(cDH, "generate_key!", ossl_dh_generate_key, 0);
rb_define_method(cDH, "compute_key", ossl_dh_compute_key, 1);
+
DEF_OSSL_PKEY_BN(cDH, dh, p);
DEF_OSSL_PKEY_BN(cDH, dh, g);
DEF_OSSL_PKEY_BN(cDH, dh, pub_key);
DEF_OSSL_PKEY_BN(cDH, dh, priv_key);
- rb_define_method(cDH, "params", ossl_dh_get_params, 0);
- OSSL_DEFAULT_DH_512 = ossl_create_dh(
- DEFAULT_DH_512_PRIM, sizeof(DEFAULT_DH_512_PRIM),
- DEFAULT_DH_512_GEN, sizeof(DEFAULT_DH_512_GEN));
- OSSL_DEFAULT_DH_1024 = ossl_create_dh(
- DEFAULT_DH_1024_PRIM, sizeof(DEFAULT_DH_1024_PRIM),
- DEFAULT_DH_1024_GEN, sizeof(DEFAULT_DH_1024_GEN));
+ rb_define_method(cDH, "params", ossl_dh_get_params, 0);
}
#else /* defined NO_DH */
# warning >>> OpenSSL is compiled without DH support <<<
+
void
Init_ossl_dh()
{
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 2a6060fe77..daa0f4cd83 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkey_dsa.c,v 1.5.2.3 2005/09/18 22:56:11 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -20,7 +20,13 @@
} while (0)
#define DSA_HAS_PRIVATE(dsa) ((dsa)->priv_key)
-#define DSA_PRIVATE(obj,dsa) (DSA_HAS_PRIVATE(dsa)||OSSL_PKEY_IS_PRIVATE(obj))
+
+#ifdef OSSL_ENGINE_ENABLED
+# define DSA_PRIVATE(dsa) (DSA_HAS_PRIVATE(dsa) || (dsa)->engine)
+#else
+# define DSA_PRIVATE(dsa) DSA_HAS_PRIVATE(dsa)
+#endif
+
/*
* Classes
@@ -184,7 +190,7 @@ ossl_dsa_is_private(VALUE self)
GetPKeyDSA(self, pkey);
- return (DSA_PRIVATE(self, pkey->pkey.dsa)) ? Qtrue : Qfalse;
+ return (DSA_PRIVATE(pkey->pkey.dsa)) ? Qtrue : Qfalse;
}
static VALUE
@@ -330,7 +336,7 @@ ossl_dsa_sign(VALUE self, VALUE data)
GetPKeyDSA(self, pkey);
StringValue(data);
- if (!DSA_PRIVATE(self, pkey->pkey.dsa)) {
+ if (!DSA_PRIVATE(pkey->pkey.dsa)) {
ossl_raise(eDSAError, "Private DSA key needed!");
}
str = rb_str_new(0, ossl_dsa_buf_size(pkey));
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index 69d69c76f4..75b02d23ec 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_pkey_rsa.c,v 1.5.2.4 2005/09/18 22:56:11 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -20,7 +20,12 @@
} while (0)
#define RSA_HAS_PRIVATE(rsa) ((rsa)->p && (rsa)->q)
-#define RSA_PRIVATE(obj,rsa) (RSA_HAS_PRIVATE(rsa)||OSSL_PKEY_IS_PRIVATE(obj))
+
+#ifdef OSSL_ENGINE_ENABLED
+# define RSA_PRIVATE(rsa) (RSA_HAS_PRIVATE(rsa) || (rsa)->engine)
+#else
+# define RSA_PRIVATE(rsa) RSA_HAS_PRIVATE(rsa)
+#endif
/*
* Classes
@@ -176,8 +181,8 @@ ossl_rsa_is_private(VALUE self)
EVP_PKEY *pkey;
GetPKeyRSA(self, pkey);
-
- return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse;
+
+ return (RSA_PRIVATE(pkey->pkey.rsa)) ? Qtrue : Qfalse;
}
static VALUE
@@ -298,7 +303,7 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
+ if (!RSA_PRIVATE(pkey->pkey.rsa)) {
ossl_raise(eRSAError, "private key needed.");
}
rb_scan_args(argc, argv, "11", &buffer, &padding);
@@ -323,7 +328,7 @@ ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self)
VALUE str, buffer, padding;
GetPKeyRSA(self, pkey);
- if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
+ if (!RSA_PRIVATE(pkey->pkey.rsa)) {
ossl_raise(eRSAError, "private key needed.");
}
rb_scan_args(argc, argv, "11", &buffer, &padding);
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c
index ffd68966ca..ec9883d70a 100644
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_rand.c,v 1.2 2003/09/17 09:05:02 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_rand.h b/ext/openssl/ossl_rand.h
index 4895267fb6..ce2ae0d129 100644
--- a/ext/openssl/ossl_rand.h
+++ b/ext/openssl/ossl_rand.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_rand.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index e4889d6d3f..c73a160a94 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_ssl.c,v 1.13.2.11 2006/03/17 10:10:53 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2000-2002 GOTOU Yuuzou <gotoyuzo@notwork.org>
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
@@ -45,9 +45,6 @@ VALUE cSSLSocket;
#define ossl_sslctx_set_options(o,v) rb_iv_set((o),"@options",(v))
#define ossl_sslctx_set_cert_store(o,v) rb_iv_set((o),"@cert_store",(v))
#define ossl_sslctx_set_extra_cert(o,v) rb_iv_set((o),"@extra_chain_cert",(v))
-#define ossl_sslctx_set_client_cert_cb(o,v) rb_iv_set((o),"@client_cert_cb",(v))
-#define ossl_sslctx_set_tmp_dh_cb(o,v) rb_iv_set((o),"@tmp_dh_callback",(v))
-#define ossl_sslctx_set_sess_id_ctx(o, v) rb_iv_get((o),"@session_id_context"(v))
#define ossl_sslctx_get_cert(o) rb_iv_get((o),"@cert")
#define ossl_sslctx_get_key(o) rb_iv_get((o),"@key")
@@ -61,37 +58,13 @@ VALUE cSSLSocket;
#define ossl_sslctx_get_options(o) rb_iv_get((o),"@options")
#define ossl_sslctx_get_cert_store(o) rb_iv_get((o),"@cert_store")
#define ossl_sslctx_get_extra_cert(o) rb_iv_get((o),"@extra_chain_cert")
-#define ossl_sslctx_get_client_cert_cb(o) rb_iv_get((o),"@client_cert_cb")
-#define ossl_sslctx_get_tmp_dh_cb(o) rb_iv_get((o),"@tmp_dh_callback")
-#define ossl_sslctx_get_sess_id_ctx(o) rb_iv_get((o),"@session_id_context")
static char *ossl_sslctx_attrs[] = {
"cert", "key", "client_ca", "ca_file", "ca_path",
"timeout", "verify_mode", "verify_depth",
- "verify_callback", "options", "cert_store", "extra_chain_cert",
- "client_cert_cb", "tmp_dh_callback", "session_id_context",
+ "verify_callback", "options", "cert_store", "extra_chain_cert"
};
-#define ossl_ssl_get_io(o) rb_iv_get((o),"@io")
-#define ossl_ssl_get_ctx(o) rb_iv_get((o),"@context")
-#define ossl_ssl_get_sync_close(o) rb_iv_get((o),"@sync_close")
-#define ossl_ssl_get_x509(o) rb_iv_get((o),"@x509")
-#define ossl_ssl_get_key(o) rb_iv_get((o),"@key")
-#define ossl_ssl_get_tmp_dh(o) rb_iv_get((o),"@tmp_dh")
-
-#define ossl_ssl_set_io(o,v) rb_iv_set((o),"@io",(v))
-#define ossl_ssl_set_ctx(o,v) rb_iv_set((o),"@context",(v))
-#define ossl_ssl_set_sync_close(o,v) rb_iv_set((o),"@sync_close",(v))
-#define ossl_ssl_set_x509(o,v) rb_iv_set((o),"@x509",(v))
-#define ossl_ssl_set_key(o,v) rb_iv_set((o),"@key",(v))
-#define ossl_ssl_set_tmp_dh(o,v) rb_iv_set((o),"@tmp_dh",(v))
-
-static char *ossl_ssl_attr_readers[] = { "io", "context", };
-static char *ossl_ssl_attrs[] = { "sync_close", };
-
-/*
- * SSLContext class
- */
struct {
const char *name;
SSL_METHOD *(*func)(void);
@@ -114,9 +87,6 @@ struct {
int ossl_ssl_ex_vcb_idx;
int ossl_ssl_ex_store_p;
-int ossl_ssl_ex_ptr_idx;
-int ossl_ssl_ex_client_cert_cb_idx;
-int ossl_ssl_ex_tmp_dh_callback_idx;
static void
ossl_sslctx_free(SSL_CTX *ctx)
@@ -178,89 +148,6 @@ ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-static VALUE
-ossl_call_client_cert_cb(VALUE obj)
-{
- VALUE cb, ary, cert, key;
- SSL *ssl;
-
- Data_Get_Struct(obj, SSL, ssl);
- cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx);
- if (NIL_P(cb)) return Qfalse;
- ary = rb_funcall(cb, rb_intern("call"), 1, obj);
- Check_Type(ary, T_ARRAY);
- GetX509CertPtr(cert = rb_ary_entry(ary, 0));
- GetPKeyPtr(key = rb_ary_entry(ary, 1));
- ossl_ssl_set_x509(obj, cert);
- ossl_ssl_set_key(obj, key);
-
- return Qtrue;
-}
-
-static int
-ossl_client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
-{
- VALUE obj;
- int status, success;
-
- obj = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx);
- success = rb_protect((VALUE(*)_((VALUE)))ossl_call_client_cert_cb,
- obj, &status);
- if (status || !success) return 0;
- *x509 = DupX509CertPtr(ossl_ssl_get_x509(obj));
- *pkey = DupPKeyPtr(ossl_ssl_get_key(obj));
-
- return 1;
-}
-
-#if !defined(OPENSSL_NO_DH)
-static VALUE
-ossl_call_tmp_dh_callback(VALUE *args)
-{
- SSL *ssl;
- VALUE cb, dh;
- EVP_PKEY *pkey;
-
- Data_Get_Struct(args[0], SSL, ssl);
- cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx);
- if (NIL_P(cb)) return Qfalse;
- dh = rb_funcall(cb, rb_intern("call"), 3, args[0], args[1], args[2]);
- pkey = GetPKeyPtr(dh);
- if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DH) return Qfalse;
- ossl_ssl_set_tmp_dh(args[0], dh);
-
- return Qtrue;
-}
-
-static DH*
-ossl_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
-{
- VALUE args[3];
- int status, success;
-
- args[0] = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx);
- args[1] = INT2FIX(is_export);
- args[2] = INT2FIX(keylength);
- success = rb_protect((VALUE(*)_((VALUE)))ossl_call_tmp_dh_callback,
- (VALUE)args, &status);
- if (status || !success) return NULL;
-
- return GetPKeyPtr(ossl_ssl_get_tmp_dh(args[0]))->pkey.dh;
-}
-
-static DH*
-ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
-{
- switch(keylength){
- case 512:
- return OSSL_DEFAULT_DH_512;
- case 1024:
- return OSSL_DEFAULT_DH_1024;
- }
- return NULL;
-}
-#endif /* OPENSSL_NO_DH */
-
static int
ossl_ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
{
@@ -302,16 +189,6 @@ ossl_sslctx_setup(VALUE self)
if(OBJ_FROZEN(self)) return Qnil;
Data_Get_Struct(self, SSL_CTX, ctx);
-#if !defined(OPENSSL_NO_DH)
- if (RTEST(ossl_sslctx_get_tmp_dh_cb(self))){
- SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
- }
- else{
- rb_warning("using default DH parameters.");
- SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
- }
-#endif
-
val = ossl_sslctx_get_cert_store(self);
if(!NIL_P(val)){
/*
@@ -381,8 +258,6 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_verify_mode(self);
verify_mode = NIL_P(val) ? SSL_VERIFY_NONE : NUM2INT(val);
SSL_CTX_set_verify(ctx, verify_mode, ossl_ssl_verify_callback);
- if (RTEST(ossl_sslctx_get_client_cert_cb(self)))
- SSL_CTX_set_client_cert_cb(ctx, ossl_client_cert_cb);
val = ossl_sslctx_get_timeout(self);
if(!NIL_P(val)) SSL_CTX_set_timeout(ctx, NUM2LONG(val));
@@ -394,15 +269,6 @@ ossl_sslctx_setup(VALUE self)
if(!NIL_P(val)) SSL_CTX_set_options(ctx, NUM2LONG(val));
rb_obj_freeze(self);
- val = ossl_sslctx_get_sess_id_ctx(self);
- if (!NIL_P(val)){
- StringValue(val);
- if (!SSL_CTX_set_session_id_context(ctx, RSTRING(val)->ptr,
- RSTRING(val)->len)){
- ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:");
- }
- }
-
return Qtrue;
}
@@ -458,10 +324,8 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
int i;
rb_check_frozen(self);
- if (NIL_P(v))
- return v;
- else if (TYPE(v) == T_ARRAY) {
- str = rb_str_new(0, 0);
+ if (TYPE(v) == T_ARRAY) {
+ str = rb_str_new2(NULL);
for (i = 0; i < RARRAY(v)->len; i++) {
elem = rb_ary_entry(v, i);
if (TYPE(elem) == T_ARRAY) elem = rb_ary_entry(elem, 0);
@@ -480,15 +344,25 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
return Qnil;
}
if (!SSL_CTX_set_cipher_list(ctx, RSTRING(str)->ptr)) {
- ossl_raise(eSSLError, "SSL_CTX_set_cipher_list:");
+ ossl_raise(eSSLError, "SSL_CTX_set_ciphers:");
}
-
- return v;
+ return Qnil;
}
/*
* SSLSocket class
*/
+#define ossl_ssl_get_io(o) rb_iv_get((o),"@io")
+#define ossl_ssl_get_ctx(o) rb_iv_get((o),"@context")
+#define ossl_ssl_get_sync_close(o) rb_iv_get((o),"@sync_close")
+
+#define ossl_ssl_set_io(o,v) rb_iv_set((o),"@io",(v))
+#define ossl_ssl_set_ctx(o,v) rb_iv_set((o),"@context",(v))
+#define ossl_ssl_set_sync_close(o,v) rb_iv_set((o),"@sync_close",(v))
+
+static char *ossl_ssl_attr_readers[] = { "io", "context", };
+static char *ossl_ssl_attrs[] = { "sync_close", };
+
static void
ossl_ssl_shutdown(SSL *ssl)
{
@@ -533,7 +407,7 @@ ossl_ssl_initialize(int argc, VALUE *argv, VALUE self)
static VALUE
ossl_ssl_setup(VALUE self)
{
- VALUE io, v_ctx, cb;
+ VALUE io, v_ctx;
SSL_CTX *ctx;
SSL *ssl;
OpenFile *fptr;
@@ -554,65 +428,57 @@ ossl_ssl_setup(VALUE self)
rb_io_check_readable(fptr);
rb_io_check_writable(fptr);
SSL_set_fd(ssl, TO_SOCKET(fileno(fptr->f)));
- SSL_set_ex_data(ssl, ossl_ssl_ex_ptr_idx, (void*)self);
- cb = ossl_sslctx_get_verify_cb(v_ctx);
- SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void*)cb);
- cb = ossl_sslctx_get_client_cert_cb(v_ctx);
- SSL_set_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx, (void*)cb);
- cb = ossl_sslctx_get_tmp_dh_cb(v_ctx);
- SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx, (void*)cb);
}
return Qtrue;
}
-#ifdef _WIN32
-#define ssl_get_error(ssl, ret) \
- (errno = WSAGetLastError(), SSL_get_error(ssl, ret))
-#else
-#define ssl_get_error(ssl, ret) SSL_get_error(ssl, ret)
-#endif
-
-static VALUE
-ossl_start_ssl(VALUE self, int (*func)())
+static void
+ossl_start_ssl(SSL *ssl, int (*func)())
{
- SSL *ssl;
- OpenFile *fptr;
int ret;
- Data_Get_Struct(self, SSL, ssl);
- GetOpenFile(ossl_ssl_get_io(self), fptr);
for(;;){
if((ret = func(ssl)) > 0) break;
- switch(ssl_get_error(ssl, ret)){
+ switch(SSL_get_error(ssl, ret)){
case SSL_ERROR_WANT_WRITE:
- rb_io_wait_writable(fileno(fptr->f));
- continue;
case SSL_ERROR_WANT_READ:
- rb_io_wait_readable(fileno(fptr->f));
- continue;
- case SSL_ERROR_SYSCALL:
- if (errno) rb_sys_fail(0);
+ rb_thread_schedule();
+ continue;
default:
ossl_raise(eSSLError, NULL);
}
}
-
- return self;
}
static VALUE
ossl_ssl_connect(VALUE self)
{
+ SSL *ssl;
+ VALUE cb;
+
ossl_ssl_setup(self);
- return ossl_start_ssl(self, SSL_connect);
+ Data_Get_Struct(self, SSL, ssl);
+ cb = ossl_sslctx_get_verify_cb(ossl_ssl_get_ctx(self));
+ SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void *)cb);
+ ossl_start_ssl(ssl, SSL_connect);
+
+ return self;
}
static VALUE
ossl_ssl_accept(VALUE self)
{
+ SSL *ssl;
+ VALUE cb;
+
ossl_ssl_setup(self);
- return ossl_start_ssl(self, SSL_accept);
+ Data_Get_Struct(self, SSL, ssl);
+ cb = ossl_sslctx_get_verify_cb(ossl_ssl_get_ctx(self));
+ SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void *)cb);
+ ossl_start_ssl(ssl, SSL_accept);
+
+ return self;
}
static VALUE
@@ -640,20 +506,18 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self)
rb_thread_wait_fd(fileno(fptr->f));
for (;;){
nread = SSL_read(ssl, RSTRING(str)->ptr, RSTRING(str)->len);
- switch(ssl_get_error(ssl, nread)){
+ switch(SSL_get_error(ssl, nread)){
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_ZERO_RETURN:
rb_eof_error();
case SSL_ERROR_WANT_WRITE:
- rb_io_wait_writable(fileno(fptr->f));
- continue;
case SSL_ERROR_WANT_READ:
- rb_io_wait_readable(fileno(fptr->f));
+ rb_thread_schedule();
continue;
case SSL_ERROR_SYSCALL:
if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
- rb_sys_fail(0);
+ ossl_raise(eSSLError, "SSL_read: %s", strerror(errno));
default:
ossl_raise(eSSLError, "SSL_read:");
}
@@ -678,26 +542,21 @@ ossl_ssl_write(VALUE self, VALUE str)
{
SSL *ssl;
int nwrite = 0;
- OpenFile *fptr;
+ FILE *fp;
StringValue(str);
Data_Get_Struct(self, SSL, ssl);
- GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
for (;;){
nwrite = SSL_write(ssl, RSTRING(str)->ptr, RSTRING(str)->len);
- switch(ssl_get_error(ssl, nwrite)){
+ switch(SSL_get_error(ssl, nwrite)){
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_WANT_WRITE:
- rb_io_wait_writable(fileno(fptr->f));
- continue;
case SSL_ERROR_WANT_READ:
- rb_io_wait_readable(fileno(fptr->f));
- continue;
- case SSL_ERROR_SYSCALL:
- if (errno) rb_sys_fail(0);
+ rb_thread_schedule();
+ continue;
default:
ossl_raise(eSSLError, "SSL_write:");
}
@@ -857,11 +716,6 @@ Init_ossl_ssl()
ossl_ssl_ex_vcb_idx = SSL_get_ex_new_index(0,"ossl_ssl_ex_vcb_idx",0,0,0);
ossl_ssl_ex_store_p = SSL_get_ex_new_index(0,"ossl_ssl_ex_store_p",0,0,0);
- ossl_ssl_ex_ptr_idx = SSL_get_ex_new_index(0,"ossl_ssl_ex_ptr_idx",0,0,0);
- ossl_ssl_ex_client_cert_cb_idx =
- SSL_get_ex_new_index(0,"ossl_ssl_ex_client_cert_cb_idx",0,0,0);
- ossl_ssl_ex_tmp_dh_callback_idx =
- SSL_get_ex_new_index(0,"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0);
mSSL = rb_define_module_under(mOSSL, "SSL");
eSSLError = rb_define_class_under(mSSL, "SSLError", eOSSLError);
diff --git a/ext/openssl/ossl_ssl.h b/ext/openssl/ossl_ssl.h
index ba9ddb1985..5929eef856 100644
--- a/ext/openssl/ossl_ssl.h
+++ b/ext/openssl/ossl_ssl.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_ssl.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_version.h b/ext/openssl/ossl_version.h
index 6d43cdccbf..63878e0d8e 100644
--- a/ext/openssl/ossl_version.h
+++ b/ext/openssl/ossl_version.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_version.h,v 1.1 2003/07/23 16:11:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509.c b/ext/openssl/ossl_x509.c
index fa90e92d11..fd1d9b6c7e 100644
--- a/ext/openssl/ossl_x509.c
+++ b/ext/openssl/ossl_x509.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509.c,v 1.2 2003/09/08 10:31:38 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509.h b/ext/openssl/ossl_x509.h
index 8d1f77b302..1a43569073 100644
--- a/ext/openssl/ossl_x509.h
+++ b/ext/openssl/ossl_x509.h
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509.h,v 1.2 2003/11/01 09:24:55 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index 91a0795209..7b88e294a9 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509attr.c,v 1.4.2.2 2004/12/15 01:54:38 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c
index 3ac9c894da..fc587a31f3 100644
--- a/ext/openssl/ossl_x509cert.c
+++ b/ext/openssl/ossl_x509cert.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509cert.c,v 1.3.2.1 2004/12/15 01:54:38 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index 62d27fe7a4..0dc22416e7 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509crl.c,v 1.3.2.1 2004/12/15 01:54:38 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index 219f30d7e3..8ba555d3e0 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509ext.c,v 1.8.2.3 2005/11/22 22:28:51 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -26,12 +26,9 @@
OSSL_Check_Kind(obj, cX509Ext); \
GetX509Ext(obj, ext); \
} while (0)
-#define MakeX509ExtFactory(klass, obj, ctx) do { \
- if (!(ctx = OPENSSL_malloc(sizeof(X509V3_CTX)))) \
- ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \
- X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, 0); \
- obj = Data_Wrap_Struct(klass, 0, ossl_x509extfactory_free, ctx); \
-} while (0)
+
+#define MakeX509ExtFactory(klass, obj, ctx) \
+ obj = Data_Make_Struct(klass, X509V3_CTX, 0, ossl_x509extfactory_free, ctx)
#define GetX509ExtFactory(obj, ctx) do { \
Data_Get_Struct(obj, X509V3_CTX, ctx); \
if (!ctx) { \
@@ -217,12 +214,6 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
X509_EXTENSION *ext;
VALUE oid, value, critical, valstr, obj;
int nid;
-#ifdef HAVE_X509V3_EXT_NCONF_NID
- VALUE rconf;
- CONF *conf;
-#else
- static LHASH *empty_lhash;
-#endif
rb_scan_args(argc, argv, "21", &oid, &value, &critical);
StringValue(oid);
@@ -235,14 +226,7 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
valstr = rb_str_new2(RTEST(critical) ? "critical," : "");
rb_str_append(valstr, value);
GetX509ExtFactory(self, ctx);
-#ifdef HAVE_X509V3_EXT_NCONF_NID
- rconf = rb_iv_get(self, "@config");
- conf = NIL_P(rconf) ? NULL : GetConfigPtr(rconf);
- ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING(valstr)->ptr);
-#else
- if (!empty_lhash) empty_lhash = lh_new(NULL, NULL);
- ext = X509V3_EXT_conf_nid(empty_lhash, ctx, nid, RSTRING(valstr)->ptr);
-#endif
+ ext = X509V3_EXT_conf_nid(NULL, ctx, nid, RSTRING(valstr)->ptr);
if (!ext){
ossl_raise(eX509ExtError, "%s = %s",
RSTRING(oid)->ptr, RSTRING(value)->ptr);
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index 5c7e6e89a2..be1f1de662 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509name.c,v 1.4.2.8 2004/12/27 07:55:56 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -326,8 +326,7 @@ Init_ossl_x509name()
ptrstr = INT2NUM(V_ASN1_PRINTABLESTRING);
ia5str = INT2NUM(V_ASN1_IA5STRING);
rb_define_const(cX509Name, "DEFAULT_OBJECT_TYPE", utf8str);
- hash = rb_hash_new();
- RHASH(hash)->ifnone = utf8str;
+ hash = rb_funcall(rb_cHash, rb_intern("new"), 1, DEFAULT_OBJECT_TYPE);
rb_hash_aset(hash, rb_str_new2("C"), ptrstr);
rb_hash_aset(hash, rb_str_new2("countryName"), ptrstr);
rb_hash_aset(hash, rb_str_new2("serialNumber"), ptrstr);
diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c
index c1b1a3e619..35c520194a 100644
--- a/ext/openssl/ossl_x509req.c
+++ b/ext/openssl/ossl_x509req.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509req.c,v 1.5.2.2 2005/09/10 00:54:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -400,7 +400,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary)
X509_REQ *req;
X509_ATTRIBUTE *attr;
int i;
- VALUE item;
+ VALUE tmp, item;
Check_Type(ary, T_ARRAY);
for (i=0;i<RARRAY(ary)->len; i++) {
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c
index a0f2f00aa5..3ccac8d26a 100644
--- a/ext/openssl/ossl_x509revoked.c
+++ b/ext/openssl/ossl_x509revoked.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509revoked.c,v 1.2.2.1 2004/12/15 01:54:38 matz Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index 360769e612..cf1a2cdac4 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -1,5 +1,5 @@
/*
- * $Id: ossl_x509store.c,v 1.2.2.5 2005/09/10 00:54:29 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
@@ -137,7 +137,6 @@ ossl_x509store_initialize(int argc, VALUE *argv, VALUE self)
rb_iv_set(self, "@error", Qnil);
rb_iv_set(self, "@error_string", Qnil);
rb_iv_set(self, "@chain", Qnil);
- rb_iv_set(self, "@time", Qnil);
return self;
}
@@ -240,19 +239,6 @@ ossl_x509store_add_path(VALUE self, VALUE dir)
}
static VALUE
-ossl_x509store_set_default_paths(VALUE self)
-{
- X509_STORE *store;
-
- GetX509Store(self, store);
- if (X509_STORE_set_default_paths(store) != 1){
- ossl_raise(eX509StoreError, NULL);
- }
-
- return Qnil;
-}
-
-static VALUE
ossl_x509store_add_cert(VALUE self, VALUE arg)
{
X509_STORE *store;
@@ -260,9 +246,7 @@ ossl_x509store_add_cert(VALUE self, VALUE arg)
cert = GetX509CertPtr(arg); /* NO NEED TO DUP */
GetX509Store(self, store);
- if (X509_STORE_add_cert(store, cert) != 1){
- ossl_raise(eX509StoreError, NULL);
- }
+ X509_STORE_add_cert(store, cert);
return self;
}
@@ -275,9 +259,7 @@ ossl_x509store_add_crl(VALUE self, VALUE arg)
crl = GetX509CRLPtr(arg); /* NO NEED TO DUP */
GetX509Store(self, store);
- if (X509_STORE_add_crl(store, crl) != 1){
- ossl_raise(eX509StoreError, NULL);
- }
+ X509_STORE_add_crl(store, crl);
return self;
}
@@ -365,7 +347,7 @@ static VALUE ossl_x509stctx_set_time(VALUE, VALUE);
static VALUE
ossl_x509stctx_initialize(int argc, VALUE *argv, VALUE self)
{
- VALUE store, cert, chain, t;
+ VALUE store, cert, chain;
X509_STORE_CTX *ctx;
X509_STORE *x509st;
X509 *x509 = NULL;
@@ -387,8 +369,7 @@ ossl_x509stctx_initialize(int argc, VALUE *argv, VALUE self)
ossl_x509stctx_set_purpose(self, rb_iv_get(store, "@purpose"));
ossl_x509stctx_set_trust(self, rb_iv_get(store, "@trust"));
#endif
- if (!NIL_P(t = rb_iv_get(store, "@time")))
- ossl_x509stctx_set_time(self, t);
+ ossl_x509stctx_set_time(self, rb_iv_get(store, "@time"));
rb_iv_set(self, "@verify_callback", rb_iv_get(store, "@verify_callback"));
rb_iv_set(self, "@cert", cert);
@@ -554,11 +535,17 @@ static VALUE
ossl_x509stctx_set_time(VALUE self, VALUE time)
{
X509_STORE_CTX *store;
- long t;
- t = NUM2LONG(rb_Integer(time));
- GetX509StCtx(self, store);
- X509_STORE_CTX_set_time(store, 0, t);
+ if(NIL_P(time)) {
+ GetX509StCtx(self, store);
+ store->flags &= ~X509_V_FLAG_USE_CHECK_TIME;
+ }
+ else {
+ long t = NUM2LONG(rb_Integer(time));
+
+ GetX509StCtx(self, store);
+ X509_STORE_CTX_set_time(store, 0, t);
+ }
return time;
}
@@ -587,7 +574,6 @@ Init_ossl_x509store()
rb_define_method(cX509Store, "time=", ossl_x509store_set_time, 1);
rb_define_method(cX509Store, "add_path", ossl_x509store_add_path, 1);
rb_define_method(cX509Store, "add_file", ossl_x509store_add_file, 1);
- rb_define_method(cX509Store, "set_default_paths", ossl_x509store_set_default_paths, 0);
rb_define_method(cX509Store, "add_cert", ossl_x509store_add_cert, 1);
rb_define_method(cX509Store, "add_crl", ossl_x509store_add_crl, 1);
rb_define_method(cX509Store, "verify", ossl_x509store_verify, -1);
diff --git a/ext/openssl/ruby_missing.h b/ext/openssl/ruby_missing.h
index f673bb157a..4bd08890f8 100644
--- a/ext/openssl/ruby_missing.h
+++ b/ext/openssl/ruby_missing.h
@@ -1,5 +1,5 @@
/*
- * $Id: ruby_missing.h,v 1.3 2003/09/06 08:56:57 gotoyuzo Exp $
+ * $Id$
* 'OpenSSL for Ruby' project
* Copyright (C) 2001-2003 Michal Rokos <m.rokos@sh.cvut.cz>
* All rights reserved.
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 626898ae76..cfd7e4854e 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -103,6 +103,8 @@ char *MasterDevice = "/dev/pty%s",
static char SlaveName[DEVICELEN];
+extern int errno;
+
#ifndef HAVE_SETEUID
# ifdef HAVE_SETREUID
# define seteuid(e) setreuid(-1, (e))
@@ -126,7 +128,7 @@ echild_status(self)
struct pty_info {
int fd;
- rb_pid_t child_pid;
+ pid_t child_pid;
VALUE thread;
};
@@ -304,36 +306,40 @@ pty_finalize_syswait(info)
return Qnil;
}
-static int
-get_device_once(master, slave, fail)
- int *master, *slave, fail;
-{
-#if defined HAVE_OPENPTY
+#ifdef HAVE_OPENPTY
/*
* Use openpty(3) of 4.3BSD Reno and later,
* or the same interface function.
*/
+static void
+getDevice(master,slave)
+ int *master,*slave;
+{
if (openpty(master, slave, SlaveName,
(struct termios *)0, (struct winsize *)0) == -1) {
- if (!fail) return -1;
rb_raise(rb_eRuntimeError, "openpty() failed");
}
-
- return 0;
-#elif defined HAVE__GETPTY
+}
+#else /* HAVE_OPENPTY */
+#ifdef HAVE__GETPTY
+static void
+getDevice(master,slave)
+ int *master,*slave;
+{
char *name;
if (!(name = _getpty(master, O_RDWR, 0622, 0))) {
- if (!fail) return -1;
rb_raise(rb_eRuntimeError, "_getpty() failed");
}
*slave = open(name, O_RDWR);
strcpy(SlaveName, name);
-
- return 0;
}
#else /* HAVE__GETPTY */
+static void
+getDevice(master,slave)
+ int *master,*slave;
+{
int i,j;
#ifdef HAVE_PTSNAME
@@ -358,7 +364,7 @@ get_device_once(master, slave, fail)
*master = i;
*slave = j;
strcpy(SlaveName, pn);
- return 0;
+ return;
#if defined I_PUSH && !defined linux
}
}
@@ -369,8 +375,7 @@ get_device_once(master, slave, fail)
}
close(i);
}
- if (!fail) rb_raise(rb_eRuntimeError, "can't get Master/Slave device");
- return -1;
+ rb_raise(rb_eRuntimeError, "Cannot get Master/Slave device");
#else
char **p;
char MasterName[DEVICELEN];
@@ -384,26 +389,16 @@ get_device_once(master, slave, fail)
*slave = j;
chown(SlaveName, getuid(), getgid());
chmod(SlaveName, 0622);
- return 0;
+ return;
}
close(i);
}
}
- if (fail) rb_raise(rb_eRuntimeError, "can't get %s", SlaveName);
- return -1;
+ rb_raise(rb_eRuntimeError, "Cannot get %s", SlaveName);
#endif
-#endif
-}
-
-static void
-getDevice(master, slave)
- int *master, *slave;
-{
- if (get_device_once(master, slave, 0)) {
- rb_gc();
- get_device_once(master, slave, 1);
- }
}
+#endif /* HAVE__GETPTY */
+#endif /* HAVE_OPENPTY */
static void
freeDevice()
diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c
index 197a0eb40b..24c4e36f2b 100644
--- a/ext/racc/cparse/cparse.c
+++ b/ext/racc/cparse/cparse.c
@@ -1,24 +1,25 @@
/*
- cparse.c -- Racc Runtime Core
+ cparse.c -- racc runtime core
- Copyright (c) 1999-2006 Minero Aoki
+ Copyright (c) 1999-2003 Minero Aoki <aamine@loveruby.net>
This library is free software.
You can distribute/modify this program under the same terms of ruby.
- $originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $
+ $raccId: cparse.c,v 1.3 2003/11/03 12:20:54 aamine Exp $
*/
#include "ruby.h"
-#include "version.h"
+#include <stdio.h>
+
/* -----------------------------------------------------------------------
Important Constants
----------------------------------------------------------------------- */
-#define RACC_VERSION "1.4.5"
+#define RACC_VERSION "1.4.4"
#define DEFAULT_TOKEN -1
#define ERROR_TOKEN 1
@@ -28,6 +29,7 @@
#define vERROR_TOKEN INT2FIX(ERROR_TOKEN)
#define vFINAL_TOKEN INT2FIX(FINAL_TOKEN)
+
/* -----------------------------------------------------------------------
File Local Variables
----------------------------------------------------------------------- */
@@ -39,6 +41,8 @@ static ID id_yydebug;
static ID id_nexttoken;
static ID id_onerror;
static ID id_noreduce;
+static ID id_catch;
+static VALUE sym_raccjump;
static ID id_errstatus;
static ID id_d_shift;
@@ -48,41 +52,44 @@ static ID id_d_read_token;
static ID id_d_next_state;
static ID id_d_e_pop;
+
/* -----------------------------------------------------------------------
Utils
----------------------------------------------------------------------- */
-/* For backward compatibility */
-#ifndef ID2SYM
-# define ID2SYM(i) ULONG2NUM(i)
-#endif
-#ifndef SYM2ID
-# define SYM2ID(v) ((ID)NUM2ULONG(v))
-#endif
-#ifndef SYMBOL_P
-# define SYMBOL_P(v) FIXNUM_P(v)
-#endif
-#ifndef LONG2NUM
-# define LONG2NUM(i) INT2NUM(i)
-#endif
-#if RUBY_VERSION_CODE >= 190
-# define HAVE_RB_BLOCK_CALL 1
-#endif
-
static ID value_to_id _((VALUE v));
static inline long num_to_long _((VALUE n));
+#ifdef ID2SYM
+# define id_to_value(i) ID2SYM(i)
+#else
+# define id_to_value(i) ULONG2NUM(i)
+#endif
+
static ID
-value_to_id(VALUE v)
+value_to_id(v)
+ VALUE v;
{
+#ifndef SYMBOL_P
+# define SYMBOL_P(v) FIXNUM_P(v)
+#endif
if (! SYMBOL_P(v)) {
rb_raise(rb_eTypeError, "not symbol");
}
+#ifdef SYM2ID
return SYM2ID(v);
+#else
+ return (ID)NUM2ULONG(v);
+#endif
}
+#ifndef LONG2NUM
+# define LONG2NUM(i) INT2NUM(i)
+#endif
+
static inline long
-num_to_long(VALUE n)
+num_to_long(n)
+ VALUE n;
{
return NUM2LONG(n);
}
@@ -90,6 +97,7 @@ num_to_long(VALUE n)
#define AREF(s, idx) \
((0 <= idx && idx < RARRAY(s)->len) ? RARRAY(s)->ptr[idx] : Qnil)
+
/* -----------------------------------------------------------------------
Parser Stack Interfaces
----------------------------------------------------------------------- */
@@ -98,7 +106,9 @@ static VALUE get_stack_tail _((VALUE stack, long len));
static void cut_stack_tail _((VALUE stack, long len));
static VALUE
-get_stack_tail(VALUE stack, long len)
+get_stack_tail(stack, len)
+ VALUE stack;
+ long len;
{
if (len < 0) return Qnil; /* system error */
if (len > RARRAY(stack)->len) len = RARRAY(stack)->len;
@@ -106,7 +116,9 @@ get_stack_tail(VALUE stack, long len)
}
static void
-cut_stack_tail(VALUE stack, long len)
+cut_stack_tail(stack, len)
+ VALUE stack;
+ long len;
{
while (len > 0) {
rb_ary_pop(stack);
@@ -123,6 +135,7 @@ cut_stack_tail(VALUE stack, long len)
#define GET_TAIL(s, len) get_stack_tail(s, len)
#define CUT_TAIL(s, len) cut_stack_tail(s, len)
+
/* -----------------------------------------------------------------------
struct cparse_params
----------------------------------------------------------------------- */
@@ -180,6 +193,7 @@ struct cparse_params {
long i; /* table index */
};
+
/* -----------------------------------------------------------------------
Parser Main Routines
----------------------------------------------------------------------- */
@@ -189,14 +203,15 @@ static VALUE racc_yyparse _((VALUE parser, VALUE lexer, VALUE lexmid,
VALUE arg, VALUE sysdebug));
static void call_lexer _((struct cparse_params *v));
+static VALUE lexer_iter _((VALUE data));
static VALUE lexer_i _((VALUE block_args, VALUE data, VALUE self));
static VALUE assert_array _((VALUE a));
static long assert_integer _((VALUE n));
static VALUE assert_hash _((VALUE h));
-static VALUE initialize_params _((VALUE vparams, VALUE parser, VALUE arg,
+static void initialize_params _((struct cparse_params *v,
+ VALUE parser, VALUE arg,
VALUE lexer, VALUE lexmid));
-static void cparse_params_mark _((void *ptr));
static void parse_main _((struct cparse_params *v,
VALUE tok, VALUE val, int resume));
@@ -204,6 +219,7 @@ static void extract_user_token _((struct cparse_params *v,
VALUE block_args, VALUE *tok, VALUE *val));
static void shift _((struct cparse_params* v, long act, VALUE tok, VALUE val));
static int reduce _((struct cparse_params* v, long act));
+static VALUE catch_iter _((VALUE dummy));
static VALUE reduce0 _((VALUE block_args, VALUE data, VALUE self));
#ifdef DEBUG
@@ -215,16 +231,15 @@ static VALUE reduce0 _((VALUE block_args, VALUE data, VALUE self));
#endif
static VALUE
-racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug)
+racc_cparse(parser, arg, sysdebug)
+ VALUE parser, arg, sysdebug;
{
- volatile VALUE vparams;
- struct cparse_params *v;
+ struct cparse_params params;
+ struct cparse_params *v = &params;
- vparams = Data_Make_Struct(CparseParams, struct cparse_params,
- cparse_params_mark, -1, v);
D_puts("starting cparse");
v->sys_debug = RTEST(sysdebug);
- vparams = initialize_params(vparams, parser, arg, Qnil, Qnil);
+ initialize_params(v, parser, arg, Qnil, Qnil);
v->lex_is_iterator = Qfalse;
parse_main(v, Qnil, Qnil, 0);
@@ -232,16 +247,15 @@ racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug)
}
static VALUE
-racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug)
+racc_yyparse(parser, lexer, lexmid, arg, sysdebug)
+ VALUE parser, lexer, lexmid, arg, sysdebug;
{
- volatile VALUE vparams;
- struct cparse_params *v;
+ struct cparse_params params;
+ struct cparse_params *v = &params;
- vparams = Data_Make_Struct(CparseParams, struct cparse_params,
- cparse_params_mark, -1, v);
v->sys_debug = RTEST(sysdebug);
D_puts("start C yyparse");
- vparams = initialize_params(vparams, parser, arg, lexer, lexmid);
+ initialize_params(v, parser, arg, lexer, lexmid);
v->lex_is_iterator = Qtrue;
D_puts("params initialized");
parse_main(v, Qnil, Qnil, 0);
@@ -254,15 +268,16 @@ racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug)
return v->retval;
}
-#ifdef HAVE_RB_BLOCK_CALL
static void
-call_lexer(struct cparse_params *v)
+call_lexer(v)
+ struct cparse_params *v;
{
- rb_block_call(v->lexer, v->lexmid, 0, NULL, lexer_i, v->value_v);
+ rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);
}
-#else
+
static VALUE
-lexer_iter(VALUE data)
+lexer_iter(data)
+ VALUE data;
{
struct cparse_params *v;
@@ -271,15 +286,9 @@ lexer_iter(VALUE data)
return Qnil;
}
-static void
-call_lexer(struct cparse_params *v)
-{
- rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);
-}
-#endif
-
static VALUE
-lexer_i(VALUE block_args, VALUE data, VALUE self)
+lexer_i(block_args, data, self)
+ VALUE block_args, data, self;
{
struct cparse_params *v;
VALUE tok, val;
@@ -295,32 +304,35 @@ lexer_i(VALUE block_args, VALUE data, VALUE self)
}
static VALUE
-assert_array(VALUE a)
+assert_array(a)
+ VALUE a;
{
Check_Type(a, T_ARRAY);
return a;
}
static VALUE
-assert_hash(VALUE h)
+assert_hash(h)
+ VALUE h;
{
Check_Type(h, T_HASH);
return h;
}
static long
-assert_integer(VALUE n)
+assert_integer(n)
+ VALUE n;
{
return NUM2LONG(n);
}
-static VALUE
-initialize_params(VALUE vparams, VALUE parser, VALUE arg, VALUE lexer, VALUE lexmid)
-{
+static void
+initialize_params(v, parser, arg, lexer, lexmid)
struct cparse_params *v;
+ VALUE parser, arg, lexer, lexmid;
+{
+ v->value_v = Data_Wrap_Struct(CparseParams, 0, 0, v);
- Data_Get_Struct(vparams, struct cparse_params, v);
- v->value_v = vparams;
v->parser = parser;
v->lexer = lexer;
if (! NIL_P(lexmid))
@@ -365,50 +377,13 @@ initialize_params(VALUE vparams, VALUE parser, VALUE arg, VALUE lexer, VALUE lex
v->fin = 0;
v->lex_is_iterator = Qfalse;
-
- rb_iv_set(parser, "@vstack", v->vstack);
- if (v->debug) {
- rb_iv_set(parser, "@tstack", v->tstack);
- }
- else {
- rb_iv_set(parser, "@tstack", Qnil);
- }
-
- return vparams;
-}
-
-static void
-cparse_params_mark(void *ptr)
-{
- struct cparse_params *v = (struct cparse_params*)ptr;
-
- rb_gc_mark(v->value_v);
- rb_gc_mark(v->parser);
- rb_gc_mark(v->lexer);
- rb_gc_mark(v->action_table);
- rb_gc_mark(v->action_check);
- rb_gc_mark(v->action_default);
- rb_gc_mark(v->action_pointer);
- rb_gc_mark(v->goto_table);
- rb_gc_mark(v->goto_check);
- rb_gc_mark(v->goto_default);
- rb_gc_mark(v->goto_pointer);
- rb_gc_mark(v->goto_pointer);
- rb_gc_mark(v->goto_pointer);
- rb_gc_mark(v->goto_pointer);
- rb_gc_mark(v->goto_pointer);
- rb_gc_mark(v->reduce_table);
- rb_gc_mark(v->token_table);
- rb_gc_mark(v->state);
- rb_gc_mark(v->vstack);
- rb_gc_mark(v->tstack);
- rb_gc_mark(v->t);
- rb_gc_mark(v->retval);
}
static void
-extract_user_token(struct cparse_params *v, VALUE block_args,
- VALUE *tok, VALUE *val)
+extract_user_token(v, block_args, tok, val)
+ struct cparse_params *v;
+ VALUE block_args;
+ VALUE *tok, *val;
{
if (NIL_P(block_args)) {
/* EOF */
@@ -451,7 +426,10 @@ extract_user_token(struct cparse_params *v, VALUE block_args,
} while (0)
static void
-parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
+parse_main(v, tok, val, resume)
+ struct cparse_params *v;
+ VALUE tok, val;
+ int resume;
{
long i; /* table index */
long act; /* action type */
@@ -490,10 +468,8 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
extract_user_token(v, tmp, &tok, &val);
}
/* convert token */
- v->t = rb_hash_aref(v->token_table, tok);
- if (NIL_P(v->t)) {
- v->t = vERROR_TOKEN;
- }
+ tmp = rb_hash_aref(v->token_table, tok);
+ v->t = NIL_P(tmp) ? vERROR_TOKEN : tmp;
D_printf("(act) t(k2)=%ld\n", NUM2LONG(v->t));
if (v->debug) {
rb_funcall(v->parser, id_d_read_token,
@@ -660,7 +636,10 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
}
static void
-shift(struct cparse_params *v, long act, VALUE tok, VALUE val)
+shift(v, act, tok, val)
+ struct cparse_params *v;
+ long act;
+ VALUE tok, val;
{
PUSH(v->vstack, val);
if (v->debug) {
@@ -673,23 +652,33 @@ shift(struct cparse_params *v, long act, VALUE tok, VALUE val)
}
static int
-reduce(struct cparse_params *v, long act)
+reduce(v, act)
+ struct cparse_params *v;
+ long act;
{
VALUE code;
v->ruleno = -act * 3;
- code = rb_catch("racc_jump", reduce0, v->value_v);
+ code = rb_iterate(catch_iter, Qnil, reduce0, v->value_v);
v->errstatus = num_to_long(rb_ivar_get(v->parser, id_errstatus));
return NUM2INT(code);
}
static VALUE
-reduce0(VALUE val, VALUE data, VALUE self)
+catch_iter(dummy)
+ VALUE dummy;
+{
+ return rb_funcall(rb_mKernel, id_catch, 1, sym_raccjump);
+}
+
+static VALUE
+reduce0(val, data, self)
+ VALUE val, data, self;
{
struct cparse_params *v;
VALUE reduce_to, reduce_len, method_id;
long len;
ID mid;
- VALUE tmp, tmp_t = Qundef, tmp_v = Qundef;
+ VALUE tmp, tmp_t, tmp_v;
long i, k1, k2;
VALUE goto_state;
@@ -788,12 +777,13 @@ reduce0(VALUE val, VALUE data, VALUE self)
goto transit;
}
+
/* -----------------------------------------------------------------------
Ruby Interface
----------------------------------------------------------------------- */
void
-Init_cparse(void)
+Init_cparse()
{
VALUE Racc, Parser;
ID id_racc = rb_intern("Racc");
@@ -811,7 +801,7 @@ Init_cparse(void)
rb_define_const(Parser, "Racc_Runtime_Core_Version_C",
rb_str_new2(RACC_VERSION));
rb_define_const(Parser, "Racc_Runtime_Core_Id_C",
- rb_str_new2("$originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $"));
+ rb_str_new2("$raccId: cparse.c,v 1.3 2003/11/03 12:20:54 aamine Exp $"));
CparseParams = rb_define_class_under(Racc, "CparseParams", rb_cObject);
@@ -821,7 +811,9 @@ Init_cparse(void)
id_nexttoken = rb_intern("next_token");
id_onerror = rb_intern("on_error");
id_noreduce = rb_intern("_reduce_none");
+ id_catch = rb_intern("catch");
id_errstatus = rb_intern("@racc_error_status");
+ sym_raccjump = id_to_value(rb_intern("racc_jump"));
id_d_shift = rb_intern("racc_shift");
id_d_reduce = rb_intern("racc_reduce");
diff --git a/ext/racc/cparse/extconf.rb b/ext/racc/cparse/extconf.rb
index 8516c2998a..dd953a7e15 100644
--- a/ext/racc/cparse/extconf.rb
+++ b/ext/racc/cparse/extconf.rb
@@ -1,4 +1,4 @@
-# $Id: extconf.rb,v 1.1 2002/03/22 07:20:31 aamine Exp $
+# $Id$
require 'mkmf'
create_makefile 'racc/cparse'
diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index b67a443dad..d8d8643d08 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -1,63 +1,30 @@
require "mkmf"
-$readline_headers = ["stdio.h"]
-
-def have_readline_header(header)
- if have_header(header)
- $readline_headers.push(header)
- return true
- else
- return false
- end
-end
-
-def have_readline_var(var)
- return have_var(var, $readline_headers)
-end
-
dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
dir_config("readline")
-enable_libedit = enable_config("libedit")
have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
-have_library("ncurses", "tgetnum") ||
- have_library("termcap", "tgetnum") ||
+have_library("ncurses", "tgetnum") or
+ have_library("termcap", "tgetnum") or
have_library("curses", "tgetnum")
-if enable_libedit
- unless (have_readline_header("editline/readline.h") ||
- have_readline_header("readline/readline.h")) &&
- have_library("edit", "readline")
- exit
+if have_header("readline/readline.h") and
+ have_header("readline/history.h") and
+ have_library("readline", "readline")
+ if have_func("rl_filename_completion_function")
+ $CFLAGS += " -DREADLINE_42_OR_LATER"
end
-else
- unless ((have_readline_header("readline/readline.h") &&
- have_readline_header("readline/history.h")) &&
- (have_library("readline", "readline") ||
- have_library("edit", "readline"))) ||
- (have_readline_header("editline/readline.h") &&
- have_library("edit", "readline"))
- exit
+ if have_func("rl_cleanup_after_signal")
+ $CFLAGS += " -DREADLINE_40_OR_LATER"
end
+ if try_link(<<EOF, $libs)
+#include <stdio.h>
+#include <readline/readline.h>
+main() {rl_completion_append_character = 1;}
+EOF
+ # this feature is implemented in readline-2.1 or later.
+ $CFLAGS += " -DREADLINE_21_OR_LATER"
+ end
+ create_makefile("readline")
end
-
-have_readline_var("rl_filename_completion_function")
-have_readline_var("rl_deprep_term_function")
-have_readline_var("rl_completion_append_character")
-have_readline_var("rl_basic_word_break_characters")
-have_readline_var("rl_completer_word_break_characters")
-have_readline_var("rl_basic_quote_characters")
-have_readline_var("rl_completer_quote_characters")
-have_readline_var("rl_filename_quote_characters")
-have_readline_var("rl_attempted_completion_over")
-have_readline_var("rl_library_version")
-have_readline_var("rl_event_hook")
-have_func("rl_cleanup_after_signal")
-have_func("rl_clear_signals")
-have_func("rl_vi_editing_mode")
-have_func("rl_emacs_editing_mode")
-have_func("rl_clear_signals")
-have_func("replace_history_entry")
-have_func("remove_history")
-create_makefile("readline")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 4f840ee2c0..e3a1dcbf02 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1,23 +1,12 @@
/* readline.c -- GNU Readline module
Copyright (C) 1997-2001 Shugo Maeda */
-#include "config.h"
#include <errno.h>
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef HAVE_READLINE_READLINE_H
#include <readline/readline.h>
-#endif
-#ifdef HAVE_READLINE_HISTORY_H
#include <readline/history.h>
-#endif
-#ifdef HAVE_EDITLINE_READLINE_H
-#include <editline/readline.h>
-#endif
#include "ruby.h"
-#include "rubyio.h"
#include "rubysig.h"
#ifdef HAVE_UNISTD_H
@@ -30,18 +19,13 @@ static VALUE mReadline;
#define COMPLETION_PROC "completion_proc"
#define COMPLETION_CASE_FOLD "completion_case_fold"
-static ID completion_proc, completion_case_fold;
-#ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION
+#ifndef READLINE_42_OR_LATER
# define rl_filename_completion_function filename_completion_function
# define rl_username_completion_function username_completion_function
# define rl_completion_matches completion_matches
#endif
-static int readline_event(void);
-static char **readline_attempted_completion_function(const char *text,
- int start, int end);
-
static int
readline_event()
{
@@ -60,7 +44,6 @@ readline_readline(argc, argv, self)
char *prompt = NULL;
char *buff;
int status;
- OpenFile *ofp, *ifp;
rb_secure(4);
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
@@ -70,23 +53,15 @@ readline_readline(argc, argv, self)
if (!isatty(0) && errno == EBADF) rb_raise(rb_eIOError, "stdin closed");
- Check_Type(rb_stdout, T_FILE);
- GetOpenFile(rb_stdout, ofp);
- rl_outstream = GetWriteFile(ofp);
- Check_Type(rb_stdin, T_FILE);
- GetOpenFile(rb_stdin, ifp);
- rl_instream = GetReadFile(ifp);
buff = (char*)rb_protect((VALUE(*)_((VALUE)))readline, (VALUE)prompt,
&status);
if (status) {
-#if defined HAVE_RL_CLEANUP_AFTER_SIGNAL
+#if defined READLINE_40_OR_LATER
/* restore terminal mode and signal handler*/
rl_cleanup_after_signal();
-#elif defined HAVE_RL_DEPREP_TERM_FUNCTION
+#elif defined READLINE_21_OR_LATER
/* restore terminal mode */
- if (rl_deprep_term_function != NULL) /* NULL in libedit. [ruby-dev:29116] */
- (*rl_deprep_term_function)();
- else
+ (*rl_deprep_term_function)();
#else
rl_deprep_terminal();
#endif
@@ -112,7 +87,7 @@ readline_s_set_completion_proc(self, proc)
rb_secure(4);
if (!rb_respond_to(proc, rb_intern("call")))
rb_raise(rb_eArgError, "argument must respond to `call'");
- return rb_ivar_set(mReadline, completion_proc, proc);
+ return rb_iv_set(mReadline, COMPLETION_PROC, proc);
}
static VALUE
@@ -120,7 +95,7 @@ readline_s_get_completion_proc(self)
VALUE self;
{
rb_secure(4);
- return rb_attr_get(mReadline, completion_proc);
+ return rb_iv_get(mReadline, COMPLETION_PROC);
}
static VALUE
@@ -129,7 +104,7 @@ readline_s_set_completion_case_fold(self, val)
VALUE val;
{
rb_secure(4);
- return rb_ivar_set(mReadline, completion_case_fold, val);
+ return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val);
}
static VALUE
@@ -137,12 +112,12 @@ readline_s_get_completion_case_fold(self)
VALUE self;
{
rb_secure(4);
- return rb_attr_get(mReadline, completion_case_fold);
+ return rb_iv_get(mReadline, COMPLETION_CASE_FOLD);
}
static char **
readline_attempted_completion_function(text, start, end)
- const char *text;
+ char *text;
int start;
int end;
{
@@ -151,13 +126,11 @@ readline_attempted_completion_function(text, start, end)
int case_fold;
int i, matches;
- proc = rb_attr_get(mReadline, completion_proc);
+ proc = rb_iv_get(mReadline, COMPLETION_PROC);
if (NIL_P(proc))
return NULL;
-#ifdef HAVE_RL_ATTEMPTED_COMPLETION_OVER
rl_attempted_completion_over = 1;
-#endif
- case_fold = RTEST(rb_attr_get(mReadline, completion_case_fold));
+ case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD));
ary = rb_funcall(proc, rb_intern("call"), 1, rb_tainted_str_new2(text));
if (TYPE(ary) != T_ARRAY)
ary = rb_Array(ary);
@@ -173,9 +146,9 @@ readline_attempted_completion_function(text, start, end)
result[matches + 1] = NULL;
if (matches == 1) {
- result[0] = strdup(result[1]);
- }
- else {
+ result[0] = result[1];
+ result[1] = NULL;
+ } else {
register int i = 1;
int low = 100000;
@@ -211,35 +184,25 @@ static VALUE
readline_s_vi_editing_mode(self)
VALUE self;
{
-#ifdef HAVE_RL_VI_EDITING_MODE
rb_secure(4);
rl_vi_editing_mode(1,0);
return Qnil;
-#else
- rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_VI_EDITING_MODE */
}
static VALUE
readline_s_emacs_editing_mode(self)
VALUE self;
{
-#ifdef HAVE_RL_EMACS_EDITING_MODE
rb_secure(4);
rl_emacs_editing_mode(1,0);
return Qnil;
-#else
- rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_EMACS_EDITING_MODE */
}
static VALUE
readline_s_set_completion_append_character(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
+#ifdef READLINE_21_OR_LATER
rb_secure(4);
if (NIL_P(str)) {
rl_completion_append_character = '\0';
@@ -252,18 +215,18 @@ readline_s_set_completion_append_character(self, str)
rl_completion_append_character = RSTRING(str)->ptr[0];
}
}
+
return self;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_get_completion_append_character(self)
VALUE self;
{
-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
+#ifdef READLINE_21_OR_LATER
VALUE str;
rb_secure(4);
@@ -272,18 +235,18 @@ readline_s_get_completion_append_character(self)
str = rb_str_new("", 1);
RSTRING(str)->ptr[0] = rl_completion_append_character;
+
return str;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_set_basic_word_break_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS
+#ifdef READLINE_21_OR_LATER
static char *basic_word_break_characters = NULL;
rb_secure(4);
@@ -299,33 +262,32 @@ readline_s_set_basic_word_break_characters(self, str)
RSTRING(str)->ptr, RSTRING(str)->len);
basic_word_break_characters[RSTRING(str)->len] = '\0';
rl_basic_word_break_characters = basic_word_break_characters;
+
return self;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_get_basic_word_break_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS
+#ifdef READLINE_21_OR_LATER
rb_secure(4);
if (rl_basic_word_break_characters == NULL)
return Qnil;
return rb_tainted_str_new2(rl_basic_word_break_characters);
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_set_completer_word_break_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS
+#ifdef READLINE_21_OR_LATER
static char *completer_word_break_characters = NULL;
rb_secure(4);
@@ -341,33 +303,32 @@ readline_s_set_completer_word_break_characters(self, str)
RSTRING(str)->ptr, RSTRING(str)->len);
completer_word_break_characters[RSTRING(str)->len] = '\0';
rl_completer_word_break_characters = completer_word_break_characters;
+
return self;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_get_completer_word_break_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS
+#ifdef READLINE_21_OR_LATER
rb_secure(4);
if (rl_completer_word_break_characters == NULL)
return Qnil;
return rb_tainted_str_new2(rl_completer_word_break_characters);
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_set_basic_quote_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
+#ifdef READLINE_21_OR_LATER
static char *basic_quote_characters = NULL;
rb_secure(4);
@@ -387,30 +348,28 @@ readline_s_set_basic_quote_characters(self, str)
return self;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_get_basic_quote_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS
+#ifdef READLINE_21_OR_LATER
rb_secure(4);
if (rl_basic_quote_characters == NULL)
return Qnil;
return rb_tainted_str_new2(rl_basic_quote_characters);
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_set_completer_quote_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS
+#ifdef READLINE_21_OR_LATER
static char *completer_quote_characters = NULL;
rb_secure(4);
@@ -430,30 +389,28 @@ readline_s_set_completer_quote_characters(self, str)
return self;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_get_completer_quote_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS
+#ifdef READLINE_21_OR_LATER
rb_secure(4);
if (rl_completer_quote_characters == NULL)
return Qnil;
return rb_tainted_str_new2(rl_completer_quote_characters);
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_set_filename_quote_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS
+#ifdef READLINE_21_OR_LATER
static char *filename_quote_characters = NULL;
rb_secure(4);
@@ -473,23 +430,39 @@ readline_s_set_filename_quote_characters(self, str)
return self;
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
}
static VALUE
readline_s_get_filename_quote_characters(self, str)
VALUE self, str;
{
-#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS
+#ifdef READLINE_21_OR_LATER
rb_secure(4);
if (rl_filename_quote_characters == NULL)
return Qnil;
return rb_tainted_str_new2(rl_filename_quote_characters);
#else
rb_notimplement();
- return Qnil; /* not reached */
-#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */
+#endif /* READLINE_21_OR_LATER */
+}
+
+static VALUE
+rb_remove_history(index)
+ int index;
+{
+ HIST_ENTRY *entry;
+ VALUE val;
+
+ rb_secure(4);
+ entry = remove_history(index);
+ if (entry) {
+ val = rb_tainted_str_new2(entry->line);
+ free(entry->line);
+ free(entry);
+ return val;
+ }
+ return Qnil;
}
static VALUE
@@ -504,19 +477,19 @@ hist_get(self, index)
VALUE self;
VALUE index;
{
- HIST_ENTRY *entry;
+ HISTORY_STATE *state;
int i;
rb_secure(4);
+ state = history_get_history_state();
i = NUM2INT(index);
if (i < 0) {
- i += history_length;
+ i += state->length;
}
- entry = history_get(history_base + i);
- if (entry == NULL) {
- rb_raise(rb_eIndexError, "invalid index");
+ if (i < 0 || i > state->length - 1) {
+ rb_raise(rb_eIndexError, "Invalid index");
}
- return rb_tainted_str_new2(entry->line);
+ return rb_tainted_str_new2(state->entries[i]->line);
}
static VALUE
@@ -525,25 +498,22 @@ hist_set(self, index, str)
VALUE index;
VALUE str;
{
-#ifdef HAVE_REPLACE_HISTORY_ENTRY
- HIST_ENTRY *entry;
+ HISTORY_STATE *state;
+ VALUE s = str;
int i;
rb_secure(4);
+ state = history_get_history_state();
i = NUM2INT(index);
- SafeStringValue(str);
if (i < 0) {
- i += history_length;
+ i += state->length;
}
- entry = replace_history_entry(i, RSTRING(str)->ptr, NULL);
- if (entry == NULL) {
- rb_raise(rb_eIndexError, "invalid index");
+ if (i < 0 || i > state->length - 1) {
+ rb_raise(rb_eIndexError, "Invalid index");
}
+ SafeStringValue(str);
+ replace_history_entry(i, RSTRING(str)->ptr, NULL);
return str;
-#else
- rb_notimplement();
- return Qnil; /* not reached */
-#endif
}
static VALUE
@@ -575,35 +545,15 @@ hist_push_method(argc, argv, self)
}
static VALUE
-rb_remove_history(index)
- int index;
-{
-#ifdef HAVE_REMOVE_HISTORY
- HIST_ENTRY *entry;
- VALUE val;
-
- rb_secure(4);
- entry = remove_history(index);
- if (entry) {
- val = rb_tainted_str_new2(entry->line);
- free(entry->line);
- free(entry);
- return val;
- }
- return Qnil;
-#else
- rb_notimplement();
- return Qnil; /* not reached */
-#endif
-}
-
-static VALUE
hist_pop(self)
VALUE self;
{
+ HISTORY_STATE *state;
+
rb_secure(4);
- if (history_length > 0) {
- return rb_remove_history(history_length - 1);
+ state = history_get_history_state();
+ if (state->length > 0) {
+ return rb_remove_history(state->length - 1);
} else {
return Qnil;
}
@@ -613,8 +563,11 @@ static VALUE
hist_shift(self)
VALUE self;
{
+ HISTORY_STATE *state;
+
rb_secure(4);
- if (history_length > 0) {
+ state = history_get_history_state();
+ if (state->length > 0) {
return rb_remove_history(0);
} else {
return Qnil;
@@ -625,15 +578,13 @@ static VALUE
hist_each(self)
VALUE self;
{
- HIST_ENTRY *entry;
+ HISTORY_STATE *state;
int i;
rb_secure(4);
- for (i = 0; i < history_length; i++) {
- entry = history_get(history_base + i);
- if (entry == NULL)
- break;
- rb_yield(rb_tainted_str_new2(entry->line));
+ state = history_get_history_state();
+ for (i = 0; i < state->length; i++) {
+ rb_yield(rb_tainted_str_new2(state->entries[i]->line));
}
return self;
}
@@ -642,16 +593,25 @@ static VALUE
hist_length(self)
VALUE self;
{
+ HISTORY_STATE *state;
+
rb_secure(4);
- return INT2NUM(history_length);
+ state = history_get_history_state();
+ return INT2NUM(state->length);
}
static VALUE
hist_empty_p(self)
VALUE self;
{
+ HISTORY_STATE *state;
+
rb_secure(4);
- return history_length == 0 ? Qtrue : Qfalse;
+ state = history_get_history_state();
+ if (state->length == 0)
+ return Qtrue;
+ else
+ return Qfalse;
}
static VALUE
@@ -659,14 +619,16 @@ hist_delete_at(self, index)
VALUE self;
VALUE index;
{
+ HISTORY_STATE *state;
int i;
rb_secure(4);
+ state = history_get_history_state();
i = NUM2INT(index);
if (i < 0)
- i += history_length;
- if (i < 0 || i > history_length - 1) {
- rb_raise(rb_eIndexError, "invalid index");
+ i += state->length;
+ if (i < 0 || i > state->length - 1) {
+ rb_raise(rb_eIndexError, "Invalid index");
}
return rb_remove_history(i);
}
@@ -735,9 +697,6 @@ Init_readline()
using_history();
- completion_proc = rb_intern(COMPLETION_PROC);
- completion_case_fold = rb_intern(COMPLETION_CASE_FOLD);
-
mReadline = rb_define_module("Readline");
rb_define_module_function(mReadline, "readline",
readline_readline, -1);
@@ -790,6 +749,7 @@ Init_readline()
rb_define_singleton_method(history,"each", hist_each, 0);
rb_define_singleton_method(history,"length", hist_length, 0);
rb_define_singleton_method(history,"size", hist_length, 0);
+
rb_define_singleton_method(history,"empty?", hist_empty_p, 0);
rb_define_singleton_method(history,"delete_at", hist_delete_at, 1);
rb_define_const(mReadline, "HISTORY", history);
@@ -803,18 +763,21 @@ Init_readline()
rb_define_singleton_method(ucomp, "call",
username_completion_proc_call, 1);
rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp);
-#if defined HAVE_RL_LIBRARY_VERSION
+#if defined READLINE_21_OR_LATER
rb_define_const(mReadline, "VERSION", rb_str_new2(rl_library_version));
#else
rb_define_const(mReadline, "VERSION",
rb_str_new2("2.0 or before version"));
#endif
- rl_attempted_completion_function = readline_attempted_completion_function;
-#ifdef HAVE_RL_EVENT_HOOK
+#if defined READLINE_42_OR_LATER
+ rl_attempted_completion_function
+ = (rl_completion_func_t *)readline_attempted_completion_function;
+ rl_event_hook = (rl_hook_func_t *)readline_event;
+#else
+ rl_attempted_completion_function
+ = (CPPFunction *) readline_attempted_completion_function;
rl_event_hook = readline_event;
#endif
-#ifdef HAVE_RL_CLEAR_SIGNALS
rl_clear_signals();
-#endif
}
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 11353e2345..d8bfae80b2 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -8,7 +8,7 @@
*/
#ifndef lint
-/*char sdbm_rcsid[] = "$Id: _sdbm.c,v 1.5.2.1 2005/09/08 05:59:41 matz Exp $";*/
+/*char sdbm_rcsid[] = "$Id$";*/
#endif
#include "sdbm.h"
@@ -103,7 +103,7 @@ static int duppair proto((char *, datum));
/*
* externals
*/
-#if !defined sun && !defined MSDOS && !defined _WIN32 && !defined __CYGWIN__ && !defined(errno)
+#if !defined sun && !defined MSDOS && !defined _WIN32 && !defined __CYGWIN__
extern int errno;
#endif
@@ -626,7 +626,7 @@ register DBM *db;
*/
#ifndef lint
-/*char pair_rcsid[] = "$Id: _sdbm.c,v 1.5.2.1 2005/09/08 05:59:41 matz Exp $";*/
+/*char pair_rcsid[] = "$Id$";*/
#endif
#ifndef BSD42
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index ef4fb8ffbf..62ce478c4d 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -2,8 +2,8 @@
sdbminit.c -
- $Author: ocean $
- $Date: 2005/06/25 05:42:41 $
+ $Author$
+ $Date$
created at: Fri May 7 08:34:24 JST 1999
Copyright (C) 1995-2001 Yukihiro Matsumoto
@@ -62,21 +62,6 @@ fsdbm_close(obj)
return Qnil;
}
-static VALUE
-fsdbm_closed(obj)
- VALUE obj;
-{
- struct dbmdata *dbmp;
-
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp == 0)
- return Qtrue;
- if (dbmp->di_dbm == 0)
- return Qtrue;
-
- return Qfalse;
-}
-
static VALUE fsdbm_alloc _((VALUE));
static VALUE
fsdbm_alloc(klass)
@@ -259,6 +244,8 @@ fsdbm_select(argc, argv, obj)
rb_ary_push(new, assoc);
}
GetDBM2(obj, dbmp, dbm);
+ if (RTEST(rb_yield(assoc)))
+ rb_ary_push(new, assoc);
}
}
else {
@@ -747,7 +734,6 @@ Init_sdbm()
rb_define_method(rb_cDBM, "initialize", fsdbm_initialize, -1);
rb_define_method(rb_cDBM, "close", fsdbm_close, 0);
- rb_define_method(rb_cDBM, "closed?", fsdbm_closed, 0);
rb_define_method(rb_cDBM, "[]", fsdbm_aref, 1);
rb_define_method(rb_cDBM, "fetch", fsdbm_fetch_m, -1);
rb_define_method(rb_cDBM, "[]=", fsdbm_store, 2);
diff --git a/test/sdbm/test_sdbm.rb b/ext/sdbm/testsdbm.rb
index 8789d719dd..5a185fd5c4 100644
--- a/test/sdbm/test_sdbm.rb
+++ b/ext/sdbm/testsdbm.rb
@@ -1,42 +1,52 @@
-require 'test/unit'
+require 'runit/testcase'
+require 'runit/cui/testrunner'
-begin
- require 'sdbm'
-rescue LoadError
+if $".grep(/\bsdbm.so\b/).empty?
+ begin
+ require './sdbm'
+ rescue LoadError
+ require 'sdbm'
+ end
+end
+
+def uname_s
+ require 'rbconfig'
+ case Config::CONFIG['host_os']
+ when 'cygwin'
+ require 'Win32API'
+ uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
+ utsname = ' ' * 100
+ raise 'cannot get system name' if uname.call(utsname) == -1
+
+ utsname.unpack('A20' * 5)[0]
+ else
+ Config::CONFIG['host_os']
+ end
end
-class TestSDBM < Test::Unit::TestCase
+SYSTEM = uname_s
+
+class TestSDBM < RUNIT::TestCase
def setup
@path = "tmptest_sdbm_"
assert_instance_of(SDBM, @sdbm = SDBM.new(@path))
end
def teardown
assert_nil(@sdbm.close)
- ObjectSpace.each_object(SDBM) do |obj|
- obj.close unless obj.closed?
- end
+ GC.start
File.delete *Dir.glob("tmptest_sdbm*").to_a
p Dir.glob("tmptest_sdbm*") if $DEBUG
end
def check_size(expect, sdbm=@sdbm)
- assert_equal(expect, sdbm.size)
+ assert_equals(expect, sdbm.size)
n = 0
sdbm.each { n+=1 }
- assert_equal(expect, n)
+ assert_equals(expect, n)
if expect == 0
- assert_equal(true, sdbm.empty?)
+ assert_equals(true, sdbm.empty?)
else
- assert_equal(false, sdbm.empty?)
- end
- end
-
- def have_fork?
- begin
- fork{}
- true
- rescue NotImplementedError
- false
+ assert_equals(false, sdbm.empty?)
end
end
@@ -48,7 +58,7 @@ class TestSDBM < Test::Unit::TestCase
# SDBM.new ignore the block
foo = true
assert_instance_of(SDBM, sdbm = SDBM.new("tmptest_sdbm") { foo = false })
- assert_equal(foo, true)
+ assert_equals(foo, true)
assert_nil(sdbm.close)
end
def test_s_open_no_create
@@ -57,14 +67,14 @@ class TestSDBM < Test::Unit::TestCase
sdbm.close if sdbm
end
def test_s_open_with_block
- assert_equal(SDBM.open("tmptest_sdbm") { :foo }, :foo)
+ assert_equals(SDBM.open("tmptest_sdbm") { :foo }, :foo)
end
=begin
# Is it guaranteed on many OS?
def test_s_open_lock_one_process
# locking on one process
assert_instance_of(SDBM, sdbm = SDBM.open("tmptest_sdbm", 0644))
- assert_raise(Errno::EWOULDBLOCK) {
+ assert_exception(Errno::EWOULDBLOCK) {
begin
SDBM.open("tmptest_sdbm", 0644)
rescue Errno::EAGAIN
@@ -79,7 +89,6 @@ class TestSDBM < Test::Unit::TestCase
if not defined? SDBM::NOLOCK
return
end
- return unless have_fork? # snip this test
fork() {
assert_instance_of(SDBM, sdbm = SDBM.open("tmptest_sdbm", 0644,
@@ -118,9 +127,8 @@ class TestSDBM < Test::Unit::TestCase
end
def test_s_open_error
- return if /(ms|bcc)win|mingw|djgpp/ =~ RUBY_PLATFORM
assert_instance_of(SDBM, sdbm = SDBM.open("tmptest_sdbm", 0))
- assert_raise(Errno::EACCES) {
+ assert_exception(Errno::EACCES) {
SDBM.open("tmptest_sdbm", 0)
}
sdbm.close
@@ -131,76 +139,76 @@ class TestSDBM < Test::Unit::TestCase
assert_nil(sdbm.close)
# closed SDBM file
- assert_raise(SDBMError) { sdbm.close }
+ assert_exception(SDBMError) { sdbm.close }
end
def test_aref
- assert_equal('bar', @sdbm['foo'] = 'bar')
- assert_equal('bar', @sdbm['foo'])
+ assert_equals('bar', @sdbm['foo'] = 'bar')
+ assert_equals('bar', @sdbm['foo'])
assert_nil(@sdbm['bar'])
end
def test_fetch
- assert_equal('bar', @sdbm['foo']='bar')
- assert_equal('bar', @sdbm.fetch('foo'))
+ assert_equals('bar', @sdbm['foo']='bar')
+ assert_equals('bar', @sdbm.fetch('foo'))
# key not found
- assert_raise(IndexError) {
+ assert_exception(IndexError) {
@sdbm.fetch('bar')
}
# test for `ifnone' arg
- assert_equal('baz', @sdbm.fetch('bar', 'baz'))
+ assert_equals('baz', @sdbm.fetch('bar', 'baz'))
# test for `ifnone' block
- assert_equal('foobar', @sdbm.fetch('bar') {|key| 'foo' + key })
+ assert_equals('foobar', @sdbm.fetch('bar') {|key| 'foo' + key })
end
def test_aset
num = 0
2.times {|i|
- assert_equal('foo', @sdbm['foo'] = 'foo')
- assert_equal('foo', @sdbm['foo'])
- assert_equal('bar', @sdbm['foo'] = 'bar')
- assert_equal('bar', @sdbm['foo'])
+ assert_equals('foo', @sdbm['foo'] = 'foo')
+ assert_equals('foo', @sdbm['foo'])
+ assert_equals('bar', @sdbm['foo'] = 'bar')
+ assert_equals('bar', @sdbm['foo'])
num += 1 if i == 0
- assert_equal(num, @sdbm.size)
+ assert_equals(num, @sdbm.size)
# assign nil
- assert_equal('', @sdbm['bar'] = '')
- assert_equal('', @sdbm['bar'])
+ assert_equals('', @sdbm['bar'] = '')
+ assert_equals('', @sdbm['bar'])
num += 1 if i == 0
- assert_equal(num, @sdbm.size)
+ assert_equals(num, @sdbm.size)
# empty string
- assert_equal('', @sdbm[''] = '')
- assert_equal('', @sdbm[''])
+ assert_equals('', @sdbm[''] = '')
+ assert_equals('', @sdbm[''])
num += 1 if i == 0
- assert_equal(num, @sdbm.size)
+ assert_equals(num, @sdbm.size)
# Fixnum
- assert_equal('200', @sdbm['100'] = '200')
- assert_equal('200', @sdbm['100'])
+ assert_equals('200', @sdbm['100'] = '200')
+ assert_equals('200', @sdbm['100'])
num += 1 if i == 0
- assert_equal(num, @sdbm.size)
+ assert_equals(num, @sdbm.size)
# Big key and value
- assert_equal('y' * 100, @sdbm['x' * 100] = 'y' * 100)
- assert_equal('y' * 100, @sdbm['x' * 100])
+ assert_equals('y' * 100, @sdbm['x' * 100] = 'y' * 100)
+ assert_equals('y' * 100, @sdbm['x' * 100])
num += 1 if i == 0
- assert_equal(num, @sdbm.size)
+ assert_equals(num, @sdbm.size)
}
end
def test_index
- assert_equal('bar', @sdbm['foo'] = 'bar')
- assert_equal('foo', @sdbm.index('bar'))
+ assert_equals('bar', @sdbm['foo'] = 'bar')
+ assert_equals('foo', @sdbm.index('bar'))
assert_nil(@sdbm['bar'])
end
@@ -208,14 +216,14 @@ class TestSDBM < Test::Unit::TestCase
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
- assert_equal(values.reverse, @sdbm.indexes(*keys.reverse))
+ assert_equals(values.reverse, @sdbm.indexes(*keys.reverse))
end
def test_values_at
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
- assert_equal(values.reverse, @sdbm.values_at(*keys.reverse))
+ assert_equals(values.reverse, @sdbm.values_at(*keys.reverse))
end
def test_select_with_block
@@ -223,37 +231,37 @@ class TestSDBM < Test::Unit::TestCase
values = %w(FOO BAR BAZ)
@sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
ret = @sdbm.select {|k,v|
- assert_equal(k.upcase, v)
+ assert_equals(k.upcase, v)
k != "bar"
}
- assert_equal([['baz', 'BAZ'], ['foo', 'FOO']],
+ assert_equals([['baz', 'BAZ'], ['foo', 'FOO']],
ret.sort)
end
def test_length
num = 10
- assert_equal(0, @sdbm.size)
+ assert_equals(0, @sdbm.size)
num.times {|i|
i = i.to_s
@sdbm[i] = i
}
- assert_equal(num, @sdbm.size)
+ assert_equals(num, @sdbm.size)
@sdbm.shift
- assert_equal(num - 1, @sdbm.size)
+ assert_equals(num - 1, @sdbm.size)
end
def test_empty?
- assert_equal(true, @sdbm.empty?)
+ assert_equals(true, @sdbm.empty?)
@sdbm['foo'] = 'FOO'
- assert_equal(false, @sdbm.empty?)
+ assert_equals(false, @sdbm.empty?)
end
def test_each_pair
n = 0
@sdbm.each_pair { n += 1 }
- assert_equal(0, n)
+ assert_equals(0, n)
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@@ -263,18 +271,18 @@ class TestSDBM < Test::Unit::TestCase
n = 0
ret = @sdbm.each_pair {|key, val|
assert_not_nil(i = keys.index(key))
- assert_equal(val, values[i])
+ assert_equals(val, values[i])
n += 1
}
- assert_equal(keys.size, n)
- assert_equal(@sdbm, ret)
+ assert_equals(keys.size, n)
+ assert_equals(@sdbm, ret)
end
def test_each_value
n = 0
@sdbm.each_value { n += 1 }
- assert_equal(0, n)
+ assert_equals(0, n)
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@@ -285,18 +293,18 @@ class TestSDBM < Test::Unit::TestCase
ret = @sdbm.each_value {|val|
assert_not_nil(key = @sdbm.index(val))
assert_not_nil(i = keys.index(key))
- assert_equal(val, values[i])
+ assert_equals(val, values[i])
n += 1
}
- assert_equal(keys.size, n)
- assert_equal(@sdbm, ret)
+ assert_equals(keys.size, n)
+ assert_equals(@sdbm, ret)
end
def test_each_key
n = 0
@sdbm.each_key { n += 1 }
- assert_equal(0, n)
+ assert_equals(0, n)
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@@ -306,24 +314,24 @@ class TestSDBM < Test::Unit::TestCase
n = 0
ret = @sdbm.each_key {|key|
assert_not_nil(i = keys.index(key))
- assert_equal(@sdbm[key], values[i])
+ assert_equals(@sdbm[key], values[i])
n += 1
}
- assert_equal(keys.size, n)
- assert_equal(@sdbm, ret)
+ assert_equals(keys.size, n)
+ assert_equals(@sdbm, ret)
end
def test_keys
- assert_equal([], @sdbm.keys)
+ assert_equals([], @sdbm.keys)
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
- assert_equal(keys.sort, @sdbm.keys.sort)
- assert_equal(values.sort, @sdbm.values.sort)
+ assert_equals(keys.sort, @sdbm.keys.sort)
+ assert_equals(values.sort, @sdbm.values.sort)
end
def test_values
@@ -332,7 +340,7 @@ class TestSDBM < Test::Unit::TestCase
def test_shift
assert_nil(@sdbm.shift)
- assert_equal(0, @sdbm.size)
+ assert_equals(0, @sdbm.size)
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@@ -345,11 +353,11 @@ class TestSDBM < Test::Unit::TestCase
ret_keys.push ret[0]
ret_values.push ret[1]
- assert_equal(keys.size - ret_keys.size, @sdbm.size)
+ assert_equals(keys.size - ret_keys.size, @sdbm.size)
end
- assert_equal(keys.sort, ret_keys.sort)
- assert_equal(values.sort, ret_values.sort)
+ assert_equals(keys.sort, ret_keys.sort)
+ assert_equals(values.sort, ret_values.sort)
end
def test_delete
@@ -358,28 +366,28 @@ class TestSDBM < Test::Unit::TestCase
key = keys[1]
assert_nil(@sdbm.delete(key))
- assert_equal(0, @sdbm.size)
+ assert_equals(0, @sdbm.size)
@sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
- assert_equal('BAR', @sdbm.delete(key))
+ assert_equals('BAR', @sdbm.delete(key))
assert_nil(@sdbm[key])
- assert_equal(2, @sdbm.size)
+ assert_equals(2, @sdbm.size)
assert_nil(@sdbm.delete(key))
end
def test_delete_with_block
key = 'no called block'
@sdbm[key] = 'foo'
- assert_equal('foo', @sdbm.delete(key) {|k| k.replace 'called block'})
- assert_equal('no called block', key)
- assert_equal(0, @sdbm.size)
+ assert_equals('foo', @sdbm.delete(key) {|k| k.replace 'called block'})
+ assert_equals('no called block', key)
+ assert_equals(0, @sdbm.size)
key = 'no called block'
- assert_equal(:blockval,
+ assert_equals(:blockval,
@sdbm.delete(key) {|k| k.replace 'called block'; :blockval})
- assert_equal('called block', key)
- assert_equal(0, @sdbm.size)
+ assert_equals('called block', key)
+ assert_equals(0, @sdbm.size)
end
def test_delete_if
@@ -387,11 +395,11 @@ class TestSDBM < Test::Unit::TestCase
100.times {@sdbm[v] = v; v = v.next}
ret = @sdbm.delete_if {|key, val| key.to_i < 50}
- assert_equal(@sdbm, ret)
+ assert_equals(@sdbm, ret)
check_size(50, @sdbm)
ret = @sdbm.delete_if {|key, val| key.to_i >= 50}
- assert_equal(@sdbm, ret)
+ assert_equals(@sdbm, ret)
check_size(0, @sdbm)
# break
@@ -404,7 +412,7 @@ class TestSDBM < Test::Unit::TestCase
n+=1
true
}
- assert_equal(51, n)
+ assert_equals(51, n)
check_size(49, @sdbm)
@sdbm.clear
@@ -422,7 +430,7 @@ class TestSDBM < Test::Unit::TestCase
}
rescue
end
- assert_equal(51, n)
+ assert_equals(51, n)
check_size(49, @sdbm)
end
@@ -432,30 +440,30 @@ class TestSDBM < Test::Unit::TestCase
hash = @sdbm.reject {|key, val| key.to_i < 50}
assert_instance_of(Hash, hash)
- assert_equal(100, @sdbm.size)
+ assert_equals(100, @sdbm.size)
- assert_equal(50, hash.size)
+ assert_equals(50, hash.size)
hash.each_pair {|key,val|
- assert_equal(false, key.to_i < 50)
- assert_equal(key, val)
+ assert_equals(false, key.to_i < 50)
+ assert_equals(key, val)
}
hash = @sdbm.reject {|key, val| key.to_i < 100}
assert_instance_of(Hash, hash)
- assert_equal(true, hash.empty?)
+ assert_equals(true, hash.empty?)
end
def test_clear
v = "1"
100.times {v = v.next; @sdbm[v] = v}
- assert_equal(@sdbm, @sdbm.clear)
+ assert_equals(@sdbm, @sdbm.clear)
# validate SDBM#size
i = 0
@sdbm.each { i += 1 }
- assert_equal(@sdbm.size, i)
- assert_equal(0, i)
+ assert_equals(@sdbm.size, i)
+ assert_equals(0, i)
end
def test_invert
@@ -464,9 +472,9 @@ class TestSDBM < Test::Unit::TestCase
hash = @sdbm.invert
assert_instance_of(Hash, hash)
- assert_equal(100, hash.size)
+ assert_equals(100, hash.size)
hash.each_pair {|key, val|
- assert_equal(key.to_i, val.to_i)
+ assert_equals(key.to_i, val.to_i)
}
end
@@ -477,9 +485,9 @@ class TestSDBM < Test::Unit::TestCase
@sdbm["101"] = "101"
@sdbm.update hash
- assert_equal(101, @sdbm.size)
+ assert_equals(101, @sdbm.size)
@sdbm.each_pair {|key, val|
- assert_equal(key.to_i, val.to_i)
+ assert_equals(key.to_i, val.to_i)
}
end
@@ -490,22 +498,22 @@ class TestSDBM < Test::Unit::TestCase
@sdbm["101"] = "101"
@sdbm.replace hash
- assert_equal(100, @sdbm.size)
+ assert_equals(100, @sdbm.size)
@sdbm.each_pair {|key, val|
- assert_equal(key.to_i, val.to_i)
+ assert_equals(key.to_i, val.to_i)
}
end
def test_haskey?
- assert_equal('bar', @sdbm['foo']='bar')
- assert_equal(true, @sdbm.has_key?('foo'))
- assert_equal(false, @sdbm.has_key?('bar'))
+ assert_equals('bar', @sdbm['foo']='bar')
+ assert_equals(true, @sdbm.has_key?('foo'))
+ assert_equals(false, @sdbm.has_key?('bar'))
end
def test_has_value?
- assert_equal('bar', @sdbm['foo']='bar')
- assert_equal(true, @sdbm.has_value?('bar'))
- assert_equal(false, @sdbm.has_value?('foo'))
+ assert_equals('bar', @sdbm['foo']='bar')
+ assert_equals(true, @sdbm.has_value?('bar'))
+ assert_equals(false, @sdbm.has_value?('foo'))
end
def test_to_a
@@ -514,9 +522,9 @@ class TestSDBM < Test::Unit::TestCase
ary = @sdbm.to_a
assert_instance_of(Array, ary)
- assert_equal(100, ary.size)
+ assert_equals(100, ary.size)
ary.each {|key,val|
- assert_equal(key.to_i, val.to_i)
+ assert_equals(key.to_i, val.to_i)
}
end
@@ -526,9 +534,23 @@ class TestSDBM < Test::Unit::TestCase
hash = @sdbm.to_hash
assert_instance_of(Hash, hash)
- assert_equal(100, hash.size)
+ assert_equals(100, hash.size)
hash.each {|key,val|
- assert_equal(key.to_i, val.to_i)
+ assert_equals(key.to_i, val.to_i)
}
end
end
+
+if $0 == __FILE__
+ if ARGV.size == 0
+ suite = RUNIT::TestSuite.new
+ suite.add_test(TestSDBM.suite)
+ else
+ suite = RUNIT::TestSuite.new
+ ARGV.each do |testmethod|
+ suite.add_test(TestSDBM.new(testmethod))
+ end
+ end
+
+ RUNIT::CUI::TestRunner.run(suite)
+end
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 41b715e0af..4f7b49407f 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -4,13 +4,11 @@ case RUBY_PLATFORM
when /bccwin32/
test_func = "WSACleanup"
have_library("ws2_32", "WSACleanup")
+ have_func("closesocket")
when /mswin32|mingw/
test_func = "WSACleanup"
- if with_config("winsock2")
- have_library("ws2_32", "WSACleanup")
- else
- have_library("wsock32", "WSACleanup")
- end
+ have_library("wsock32", "WSACleanup")
+ have_func("closesocket")
when /cygwin/
test_func = "socket"
when /beos/
@@ -26,18 +24,10 @@ else
have_library("socket", "socket")
end
-unless $mswin or $bccwin or $mingw
- headers = %w<sys/types.h netdb.h string.h sys/socket.h netinet/in.h>
-end
-if /solaris/ =~ RUBY_PLATFORM and !try_compile("")
- # bug of gcc 3.0 on Solaris 8 ?
- headers << "sys/feature_tests.h"
-end
-
-ipv6 = false
+$ipv6 = false
default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
if enable_config("ipv6", default_ipv6)
- if checking_for("ipv6") {try_link(<<EOF)}
+ if try_link(<<EOF)
#include <sys/types.h>
#include <sys/socket.h>
main()
@@ -45,67 +35,160 @@ main()
socket(AF_INET6, SOCK_STREAM, 0);
}
EOF
- $defs << "-DENABLE_IPV6" << "-DINET6"
- ipv6 = true
+ $CFLAGS+=" -DENABLE_IPV6"
+ $ipv6 = true
end
end
-if ipv6
- ipv6lib = nil
- class << (fmt = "unknown")
- def %(s) s || self end
+$ipv6type = nil
+$ipv6lib = nil
+$ipv6libdir = nil
+$ipv6trylibc = nil
+if $ipv6
+ if macro_defined?("IPV6_INRIA_VERSION", <<EOF)
+#include <netinet/in.h>
+EOF
+ $ipv6type = "inria"
+ $CFLAGS="-DINET6 "+$CFLAGS
+ elsif macro_defined?("__KAME__", <<EOF)
+#include <netinet/in.h>
+EOF
+ $ipv6type = "kame"
+ $ipv6lib="inet6"
+ $ipv6libdir="/usr/local/v6/lib"
+ $ipv6trylibc=true
+ $CFLAGS="-DINET6 "+$CFLAGS
+ elsif File.directory? "/usr/inet6"
+ $ipv6type = "linux"
+ $ipv6lib="inet6"
+ $ipv6libdir="/usr/inet6/lib"
+ $CFLAGS="-DINET6 -I/usr/inet6/include "+$CFLAGS
+ elsif macro_defined?("_TOSHIBA_INET6", <<EOF)
+#include <sys/param.h>
+EOF
+ $ipv6type = "toshiba"
+ $ipv6lib="inet6"
+ $ipv6libdir="/usr/local/v6/lib"
+ $CFLAGS="-DINET6 "+$CFLAGS
+ elsif macro_defined?("__V6D__", <<EOF)
+#include </usr/local/v6/include/sys/v6config.h>
+EOF
+ $ipv6type = "v6d"
+ $ipv6lib="v6"
+ $ipv6libdir="/usr/local/v6/lib"
+ $CFLAGS="-DINET6 -I/usr/local/v6/include "+$CFLAGS
+ elsif macro_defined?("_ZETA_MINAMI_INET6", <<EOF)
+#include <sys/param.h>
+EOF
+ $ipv6type = "zeta"
+ $ipv6lib="inet6"
+ $ipv6libdir="/usr/local/v6/lib"
+ $CFLAGS="-DINET6 "+$CFLAGS
+ else
+ $ipv6lib=with_config("ipv6-lib", nil)
+ $ipv6libdir=with_config("ipv6-libdir", nil)
+ $CFLAGS="-DINET6 "+$CFLAGS
end
- idirs, ldirs = dir_config("inet6", %w[/usr/inet6 /usr/local/v6].find {|d| File.directory?(d)})
- checking_for("ipv6 type", fmt) do
- if have_macro("IPV6_INRIA_VERSION", "netinet/in.h")
- "inria"
- elsif have_macro("__KAME__", "netinet/in.h")
- have_library(ipv6lib = "inet6")
- "kame"
- elsif have_macro("_TOSHIBA_INET6", "sys/param.h")
- have_library(ipv6lib = "inet6") and "toshiba"
- elsif have_macro("__V6D__", "sys/v6config.h")
- have_library(ipv6lib = "v6") and "v6d"
- elsif have_macro("_ZETA_MINAMI_INET6", "sys/param.h")
- have_library(ipv6lib = "inet6") and "zeta"
- elsif ipv6lib = with_config("ipv6-lib")
- warn <<EOS
---with-ipv6-lib and --with-ipv6-libdir option will be obsolete, use
---with-inet6lib and --with-inet6-{include,lib} options instead.
-EOS
- find_library(ipv6lib, nil, with_config("ipv6-libdir", ldirs)) and
- ipv6lib
- elsif have_library("inet6")
- "inet6"
- end
- end or not ipv6lib or abort <<EOS
+
+ if $ipv6lib
+ if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a"
+ $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib"
+ elsif !$ipv6trylibc
+ print <<EOS
-Fatal: no #{ipv6lib} library found. cannot continue.
-You need to fetch lib#{ipv6lib}.a from appropriate
+Fatal: no #$ipv6lib library found. cannot continue.
+You need to fetch lib#{$ipv6lib}.a from appropriate
ipv6 kit and compile beforehand.
EOS
+ exit
+ end
+ end
end
-if have_struct_member("struct sockaddr_in", "sin_len", headers)
- $defs[-1] = "-DHAVE_SIN_LEN"
+ if try_link(<<EOF)
+#ifdef _WIN32
+# include <windows.h>
+# include <winsock.h>
+#else
+# include <sys/types.h>
+# include <netdb.h>
+# include <string.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+#endif
+int
+main()
+{
+ struct sockaddr_in sin;
+
+ sin.sin_len;
+ return 0;
+}
+EOF
+ $CFLAGS="-DHAVE_SIN_LEN "+$CFLAGS
end
-# doug's fix, NOW add -Dss_family... only if required!
-[nil, " -Dss_family=__ss_family -Dss_len=__ss_len"].each do |flags|
- if flags
- cppflags = $CPPFLAGS
- $CPPFLAGS += flags
- end
- if have_struct_member("struct sockaddr_storage", "ss_family", headers)
- $defs[-1] = "-DHAVE_SOCKADDR_STORAGE"
- break
- elsif flags
- $CPPFLAGS = cppflags
- end
+ if try_link(<<EOF)
+#ifdef _WIN32
+# include <windows.h>
+# include <winsock.h>
+#else
+# include <sys/types.h>
+# include <netdb.h>
+# include <string.h>
+# include <sys/socket.h>
+#endif
+int
+main()
+{
+ struct sockaddr_storage ss;
+
+ ss.ss_family;
+ return 0;
+}
+EOF
+ $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
+else # doug's fix, NOW add -Dss_family... only if required!
+$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
+ if try_link(<<EOF)
+#ifdef _WIN32
+# include <windows.h>
+# include <winsock.h>
+#else
+# include <sys/types.h>
+# include <netdb.h>
+# include <string.h>
+# include <sys/socket.h>
+#endif
+int
+main()
+{
+ struct sockaddr_storage ss;
+
+ ss.ss_family;
+ return 0;
+}
+EOF
+ $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
+end
end
-if have_struct_member("struct sockaddr", "sa_len", headers)
- $defs[-1] = "-DHAVE_SA_LEN "
+ if try_link(<<EOF)
+#include <sys/types.h>
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+int
+main()
+{
+ struct sockaddr sa;
+
+ sa.sa_len;
+ return 0;
+}
+EOF
+ $CFLAGS="-DHAVE_SA_LEN "+$CFLAGS
end
have_header("netinet/tcp.h") if not /cygwin/ =~ RUBY_PLATFORM # for cygwin 1.1.5
@@ -116,17 +199,13 @@ if have_func("sendmsg") | have_func("recvmsg")
have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h'])
end
-getaddr_info_ok = enable_config("wide-getaddrinfo") do
- checking_for("wide getaddrinfo") {try_run(<<EOF)}
-#{cpp_include(headers)}
-#include <stdlib.h>
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
+$getaddr_info_ok = false
+if !enable_config("wide-getaddrinfo", false) and try_run(<<EOF)
+#include <sys/types.h>
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#ifndef AF_LOCAL
#define AF_LOCAL AF_UNIX
@@ -150,13 +229,8 @@ main()
}
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family == AF_LOCAL) continue;
- if (ai->ai_addr == NULL)
- goto bad;
-#if defined(_AIX)
- ai->ai_addr->sa_len = ai->ai_addrlen;
- ai->ai_addr->sa_family = ai->ai_family;
-#endif
- if (ai->ai_addrlen == 0 ||
+ if (ai->ai_addr == NULL ||
+ ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
straddr, sizeof(straddr), strport, sizeof(strport),
NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
@@ -207,46 +281,79 @@ main()
if (aitop)
freeaddrinfo(aitop);
- exit(EXIT_SUCCESS);
+ exit(0);
bad:
if (aitop)
freeaddrinfo(aitop);
- exit(EXIT_FAILURE);
+ exit(1);
}
EOF
+ $getaddr_info_ok = true
end
-if ipv6 and not getaddr_info_ok
- abort <<EOS
+if $ipv6 and not $getaddr_info_ok
+ print <<EOS
Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature.
But your getaddrinfo() and getnameinfo() are appeared to be broken. Sorry,
you cannot compile IPv6 socket classes with broken these functions.
You can try --enable-wide-getaddrinfo.
EOS
+ exit
end
-
+
case with_config("lookup-order-hack", "UNSPEC")
when "INET"
- $defs << "-DLOOKUP_ORDER_HACK_INET"
+ $CFLAGS="-DLOOKUP_ORDER_HACK_INET "+$CFLAGS
when "INET6"
- $defs << "-DLOOKUP_ORDER_HACK_INET6"
+ $CFLAGS="-DLOOKUP_ORDER_HACK_INET6 "+$CFLAGS
when "UNSPEC"
# nothing special
else
- abort <<EOS
+ print <<EOS
Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPEC)
EOS
+ exit
end
$objs = ["socket.#{$OBJEXT}"]
-
-unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("getaddrinfo", "netdb.h")
- if have_struct_member("struct in6_addr", "s6_addr8", headers)
- $defs[-1] = "-DHAVE_ADDR8"
+
+if $getaddr_info_ok and have_func("getaddrinfo", "netdb.h") and have_func("getnameinfo", "netdb.h")
+ have_getaddrinfo = true
+else
+ if try_link(<<EOF)
+#ifndef _WIN32
+# include <sys/types.h>
+# include <netdb.h>
+# include <string.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+#else
+# include <windows.h>
+# ifdef _WIN32_WCE
+# include <winsock.h>
+# else
+# include <winsock.h>
+# endif
+#endif
+int
+main()
+{
+ struct in6_addr addr;
+ unsigned char c;
+ c = addr.s6_addr8;
+ return 0;
+}
+EOF
+ $CFLAGS="-DHAVE_ADDR8 "+$CFLAGS
end
- $CPPFLAGS="-I. "+$CPPFLAGS
+end
+
+if have_getaddrinfo
+ $CFLAGS="-DHAVE_GETADDRINFO "+$CFLAGS
+else
+ $CFLAGS="-I. "+$CFLAGS
$objs += ["getaddrinfo.#{$OBJEXT}"]
$objs += ["getnameinfo.#{$OBJEXT}"]
have_func("inet_ntop") or have_func("inet_ntoa")
@@ -257,8 +364,20 @@ unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("ge
have_header("resolv.h")
end
-unless have_type("socklen_t", headers)
- $defs << "-Dsocklen_t=int"
+if !try_link(<<EOF)
+#include <sys/types.h>
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+int
+main()
+{
+ socklen_t len;
+ return 0;
+}
+EOF
+ $CFLAGS="-Dsocklen_t=int "+$CFLAGS
end
have_header("sys/un.h")
@@ -267,15 +386,14 @@ have_header("sys/uio.h")
if have_func(test_func)
have_func("hsterror")
have_func("getipnodebyname") or have_func("gethostbyname2")
- have_func("socketpair")
unless have_func("gethostname")
have_func("uname")
end
if enable_config("socks", ENV["SOCKS_SERVER"])
if have_library("socks5", "SOCKSinit")
- $defs << "-DSOCKS5" << "-DSOCKS"
+ $CFLAGS+=" -DSOCKS5 -DSOCKS"
elsif have_library("socks", "Rconnect")
- $defs << "-DSOCKS"
+ $CFLAGS+=" -DSOCKS"
end
end
create_makefile("socket")
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 963f8e2d82..09355b473c 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -2,8 +2,8 @@
socket.c -
- $Author: matz $
- $Date: 2006/08/07 07:50:28 $
+ $Author$
+ $Date$
created at: Thu Mar 31 12:21:29 JST 1994
Copyright (C) 1993-2001 Yukihiro Matsumoto
@@ -30,7 +30,6 @@
# include <net/socket.h>
#else
# include <sys/socket.h>
-# define pseudo_AF_FTIP pseudo_AF_RTIP /* workaround for NetBSD and etc. */
#endif
#include <netinet/in.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
@@ -53,16 +52,10 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#endif
-#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK EAGAIN
#endif
@@ -173,36 +166,6 @@ ruby_getaddrinfo(nodename, servname, hints, res)
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res))
#endif
-#if defined(_AIX)
-static int
-ruby_getaddrinfo__aix(nodename, servname, hints, res)
- char *nodename;
- char *servname;
- struct addrinfo *hints;
- struct addrinfo **res;
-{
- int error = getaddrinfo(nodename, servname, hints, res);
- struct addrinfo *r;
- if (error)
- return error;
- for (r = *res; r != NULL; r = r->ai_next) {
- if (r->ai_addr->sa_family == 0)
- r->ai_addr->sa_family = r->ai_family;
- if (r->ai_addr->sa_len == 0)
- r->ai_addr->sa_len = r->ai_addrlen;
- }
- return 0;
-}
-#undef getaddrinfo
-#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
-#ifndef CMSG_SPACE
-# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
-#endif
-#ifndef CMSG_LEN
-# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
-#endif
-#endif
-
#ifdef HAVE_CLOSESOCKET
#undef close
#define close closesocket
@@ -303,51 +266,6 @@ bsock_close_write(sock)
return Qnil;
}
-/*
- * Document-method: setsockopt
- * call-seq: setsockopt(level, optname, optval)
- *
- * Sets a socket option. These are protocol and system specific, see your
- * local sytem documentation for details.
- *
- * === Parameters
- * * +level+ is an integer, usually one of the SOL_ constants such as
- * Socket::SOL_SOCKET, or a protocol level.
- * * +optname+ is an integer, usually one of the SO_ constants, such
- * as Socket::SO_REUSEADDR.
- * * +optval+ is the value of the option, it is passed to the underlying
- * setsockopt() as a pointer to a certain number of bytes. How this is
- * done depends on the type:
- * - Fixnum: value is assigned to an int, and a pointer to the int is
- * passed, with length of sizeof(int).
- * - true or false: 1 or 0 (respectively) is assigned to an int, and the
- * int is passed as for a Fixnum. Note that +false+ must be passed,
- * not +nil+.
- * - String: the string's data and length is passed to the socket.
- *
- * === Examples
- *
- * Some socket options are integers with boolean values, in this case
- * #setsockopt could be called like this:
- * sock.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
- *
- * Some socket options are integers with numeric values, in this case
- * #setsockopt could be called like this:
- * sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, 255)
- *
- * Option values may be structs. Passing them can be complex as it involves
- * examining your system headers to determine the correct definition. An
- * example is an +ip_mreq+, which may be defined in your system headers as:
- * struct ip_mreq {
- * struct in_addr imr_multiaddr;
- * struct in_addr imr_interface;
- * };
- *
- * In this case #setsockopt could be called like this:
- * optval = IPAddr.new("224.0.0.251") + Socket::INADDR_ANY
- * sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, optval)
- *
-*/
static VALUE
bsock_setsockopt(sock, lev, optname, val)
VALUE sock, lev, optname, val;
@@ -388,46 +306,6 @@ bsock_setsockopt(sock, lev, optname, val)
return INT2FIX(0);
}
-/*
- * Document-method: getsockopt
- * call-seq: getsockopt(level, optname)
- *
- * Gets a socket option. These are protocol and system specific, see your
- * local sytem documentation for details. The option is returned as
- * a String with the data being the binary value of the socket option.
- *
- * === Parameters
- * * +level+ is an integer, usually one of the SOL_ constants such as
- * Socket::SOL_SOCKET, or a protocol level.
- * * +optname+ is an integer, usually one of the SO_ constants, such
- * as Socket::SO_REUSEADDR.
- *
- * === Examples
- *
- * Some socket options are integers with boolean values, in this case
- * #getsockopt could be called like this:
- * optval = sock.getsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR)
- * optval = optval.unpack "i"
- * reuseaddr = optval[0] == 0 ? false : true
- *
- * Some socket options are integers with numeric values, in this case
- * #getsockopt could be called like this:
- * optval = sock.getsockopt(Socket::IPPROTO_IP, Socket::IP_TTL)
- * ipttl = optval.unpack("i")[0]
- *
- * Option values may be structs. Decoding them can be complex as it involves
- * examining your system headers to determine the correct definition. An
- * example is a +struct linger+, which may be defined in your system headers
- * as:
- * struct linger {
- * int l_onoff;
- * int l_linger;
- * };
- *
- * In this case #getsockopt could be called like this:
- * optval = sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER)
- * onoff, linger = optval.unpack "ii"
-*/
static VALUE
bsock_getsockopt(sock, lev, optname)
VALUE sock, lev, optname;
@@ -505,15 +383,11 @@ bsock_send(argc, argv, sock)
rb_thread_fd_writable(fd);
retry:
if (!NIL_P(to)) {
- TRAP_BEG;
n = sendto(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags),
(struct sockaddr*)RSTRING(to)->ptr, RSTRING(to)->len);
- TRAP_END;
}
else {
- TRAP_BEG;
n = send(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags));
- TRAP_END;
}
if (n < 0) {
if (rb_io_wait_writable(fd)) {
@@ -526,7 +400,7 @@ bsock_send(argc, argv, sock)
static VALUE ipaddr _((struct sockaddr*));
#ifdef HAVE_SYS_UN_H
-static VALUE unixaddr _((struct sockaddr_un*, socklen_t));
+static VALUE unixaddr _((struct sockaddr_un*));
#endif
enum sock_recv_type {
@@ -595,13 +469,12 @@ s_recvfrom(sock, argc, argv, from)
}
#endif
if (alen) /* OSX doesn't return a 'from' result from recvfrom for connection-oriented sockets */
- return rb_assoc_new(str, ipaddr((struct sockaddr*)buf));
+ return rb_assoc_new(str, ipaddr((struct sockaddr*)buf));
else
- return rb_assoc_new(str, Qnil);
-
+ return rb_assoc_new(str, Qnil);
#ifdef HAVE_SYS_UN_H
case RECV_UNIX:
- return rb_assoc_new(str, unixaddr((struct sockaddr_un*)buf, alen));
+ return rb_assoc_new(str, unixaddr((struct sockaddr_un*)buf));
#endif
case RECV_SOCKET:
return rb_assoc_new(str, rb_str_new(buf, alen));
@@ -611,70 +484,6 @@ s_recvfrom(sock, argc, argv, from)
}
static VALUE
-s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
-{
- OpenFile *fptr;
- VALUE str;
- char buf[1024];
- socklen_t alen = sizeof buf;
- VALUE len, flg;
- long buflen;
- long slen;
- int fd, flags;
- VALUE addr = Qnil;
-
- rb_scan_args(argc, argv, "11", &len, &flg);
-
- if (flg == Qnil) flags = 0;
- else flags = NUM2INT(flg);
- buflen = NUM2INT(len);
-
-#ifdef MSG_DONTWAIT
- /* MSG_DONTWAIT avoids the race condition between fcntl and recvfrom.
- It is not portable, though. */
- flags |= MSG_DONTWAIT;
-#endif
-
- GetOpenFile(sock, fptr);
- if (rb_read_pending(fptr->f)) {
- rb_raise(rb_eIOError, "recvfrom for buffered IO");
- }
- fd = fileno(fptr->f);
-
- str = rb_tainted_str_new(0, buflen);
-
- rb_io_check_closed(fptr);
- rb_io_set_nonblock(fptr);
- slen = recvfrom(fd, RSTRING(str)->ptr, buflen, flags, (struct sockaddr*)buf, &alen);
-
- if (slen < 0) {
- rb_sys_fail("recvfrom(2)");
- }
- if (slen < RSTRING(str)->len) {
- RSTRING(str)->len = slen;
- RSTRING(str)->ptr[slen] = '\0';
- }
- rb_obj_taint(str);
- switch (from) {
- case RECV_RECV:
- return str;
-
- case RECV_IP:
- if (alen) /* connection-oriented socket may not return a from result */
- addr = ipaddr((struct sockaddr*)buf);
- break;
-
- case RECV_SOCKET:
- addr = rb_str_new(buf, alen);
- break;
-
- default:
- rb_bug("s_recvfrom_nonblock called with bad value");
- }
- return rb_assoc_new(str, addr);
-}
-
-static VALUE
bsock_recv(argc, argv, sock)
int argc;
VALUE *argv;
@@ -683,52 +492,6 @@ bsock_recv(argc, argv, sock)
return s_recvfrom(sock, argc, argv, RECV_RECV);
}
-/*
- * call-seq:
- * basicsocket.recv_nonblock(maxlen) => mesg
- * basicsocket.recv_nonblock(maxlen, flags) => mesg
- *
- * Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
- * O_NONBLOCK is set for the underlying file descriptor.
- * _flags_ is zero or more of the +MSG_+ options.
- * The result, _mesg_, is the data received.
- *
- * When recvfrom(2) returns 0, Socket#recv_nonblock returns
- * an empty string as data.
- * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
- *
- * === Parameters
- * * +maxlen+ - the number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
- * === Example
- * serv = TCPServer.new("127.0.0.1", 0)
- * af, port, host, addr = serv.addr
- * c = TCPSocket.new(addr, port)
- * s = serv.accept
- * c.send "aaa", 0
- * IO.select([s])
- * p s.recv_nonblock(10) #=> "aaa"
- *
- * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- * to _recv_nonblock_ fails.
- *
- * BasicSocket#recv_nonblock may raise any error corresponding to recvfrom(2) failure,
- * including Errno::EAGAIN.
- *
- * === See
- * * Socket#recvfrom
- */
-
-static VALUE
-bsock_recv_nonblock(argc, argv, sock)
- int argc;
- VALUE *argv;
- VALUE sock;
-{
- return s_recvfrom_nonblock(sock, argc, argv, RECV_RECV);
-}
-
static VALUE
bsock_do_not_rev_lookup()
{
@@ -992,40 +755,15 @@ ruby_socket(domain, type, proto)
return fd;
}
-static int
-wait_connectable(fd)
+static void
+thread_write_select(fd)
int fd;
{
- int sockerr;
- socklen_t sockerrlen;
- fd_set fds_w;
- fd_set fds_e;
-
- for (;;) {
- FD_ZERO(&fds_w);
- FD_ZERO(&fds_e);
-
- FD_SET(fd, &fds_w);
- FD_SET(fd, &fds_e);
-
- rb_thread_select(fd+1, 0, &fds_w, &fds_e, 0);
-
- if (FD_ISSET(fd, &fds_w)) {
- return 0;
- }
- else if (FD_ISSET(fd, &fds_e)) {
- sockerrlen = sizeof(sockerr);
- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&sockerr,
- &sockerrlen) == 0) {
- if (sockerr == 0)
- continue; /* workaround for winsock */
- errno = sockerr;
- }
- return -1;
- }
- }
+ fd_set fds;
- return 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ rb_thread_select(fd+1, 0, &fds, 0, 0);
}
#ifdef __CYGWIN__
@@ -1058,11 +796,7 @@ ruby_connect(fd, sockaddr, len, socks)
#endif
#if defined(HAVE_FCNTL)
-# if defined(F_GETFL)
mode = fcntl(fd, F_GETFL, 0);
-# else
- mode = 0;
-# endif
#ifdef O_NDELAY
# define NONBLOCKING O_NDELAY
@@ -1111,11 +845,7 @@ ruby_connect(fd, sockaddr, len, socks)
#if WAIT_IN_PROGRESS > 0
wait_in_progress = WAIT_IN_PROGRESS;
#endif
- status = wait_connectable(fd);
- if (status) {
- break;
- }
- errno = 0;
+ thread_write_select(fd);
continue;
#if WAIT_IN_PROGRESS > 0
@@ -1214,7 +944,7 @@ init_inetsock_internal(arg)
}
arg->fd = fd;
if (type == INET_SERVER) {
-#if !defined(_WIN32) && !defined(__CYGWIN__)
+#ifndef _WIN32
status = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
(char*)&status, sizeof(status));
@@ -1367,13 +1097,7 @@ make_hostent_internal(arg)
rb_ary_push(ary, names);
rb_ary_push(ary, INT2NUM(addr->ai_family));
for (ai = addr; ai; ai = ai->ai_next) {
- /* Pushing all addresses regardless of address family is not the
- * behaviour expected of gethostbyname(). All the addresses in struct
- * hostent->h_addr_list must be of the same family.
- */
- if(ai->ai_family == addr->ai_family) {
- rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
- }
+ rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
}
return ary;
@@ -1425,20 +1149,6 @@ tcp_svr_init(argc, argv, sock)
}
static VALUE
-s_accept_nonblock(VALUE klass, OpenFile *fptr, struct sockaddr *sockaddr, socklen_t *len)
-{
- int fd2;
-
- rb_secure(3);
- rb_io_set_nonblock(fptr);
- fd2 = accept(fileno(fptr->f), (struct sockaddr*)sockaddr, len);
- if (fd2 < 0) {
- rb_sys_fail("accept(2)");
- }
- return init_sock(rb_obj_alloc(klass), fd2);
-}
-
-static VALUE
s_accept(klass, fd, sockaddr, len)
VALUE klass;
int fd;
@@ -1493,49 +1203,6 @@ tcp_accept(sock)
(struct sockaddr*)&from, &fromlen);
}
-/*
- * call-seq:
- * tcpserver.accept_nonblock => tcpsocket
- *
- * Accepts an incoming connection using accept(2) after
- * O_NONBLOCK is set for the underlying file descriptor.
- * It returns an accepted TCPSocket for the incoming connection.
- *
- * === Example
- * require 'socket'
- * serv = TCPServer.new(2202)
- * begin
- * sock = serv.accept_nonblock
- * rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
- * IO.select([serv])
- * retry
- * end
- * # sock is an accepted socket.
- *
- * Refer to Socket#accept for the exceptions that may be thrown if the call
- * to TCPServer#accept_nonblock fails.
- *
- * TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure,
- * including Errno::EAGAIN.
- *
- * === See
- * * TCPServer#accept
- * * Socket#accept
- */
-static VALUE
-tcp_accept_nonblock(sock)
- VALUE sock;
-{
- OpenFile *fptr;
- struct sockaddr_storage from;
- socklen_t fromlen;
-
- GetOpenFile(sock, fptr);
- fromlen = sizeof(from);
- return s_accept_nonblock(rb_cTCPSocket, fptr,
- (struct sockaddr *)&from, &fromlen);
-}
-
static VALUE
tcp_sysaccept(sock)
VALUE sock;
@@ -1581,11 +1248,8 @@ init_unixsock(sock, path, server)
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
- if (sizeof(sockaddr.sun_path) <= RSTRING(path)->len) {
- rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
- (int)sizeof(sockaddr.sun_path)-1);
- }
- strcpy(sockaddr.sun_path, StringValueCStr(path));
+ strncpy(sockaddr.sun_path, RSTRING(path)->ptr, sizeof(sockaddr.sun_path)-1);
+ sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0';
if (server) {
status = bind(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
@@ -1611,9 +1275,7 @@ init_unixsock(sock, path, server)
init_sock(sock, fd);
GetOpenFile(sock, fptr);
- if (server) {
- fptr->path = strdup(RSTRING(path)->ptr);
- }
+ fptr->path = strdup(RSTRING(path)->ptr);
return sock;
}
@@ -1794,52 +1456,6 @@ udp_send(argc, argv, sock)
return INT2FIX(n);
}
-/*
- * call-seq:
- * udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
- * udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
- *
- * Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after
- * O_NONBLOCK is set for the underlying file descriptor.
- * _flags_ is zero or more of the +MSG_+ options.
- * The first element of the results, _mesg_, is the data received.
- * The second element, _sender_inet_addr_, is an array to represent the sender address.
- *
- * When recvfrom(2) returns 0,
- * Socket#recvfrom_nonblock returns an empty string as data.
- * It means an empty packet.
- *
- * === Parameters
- * * +maxlen+ - the number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
- * === Example
- * require 'socket'
- * s1 = UDPSocket.new
- * s1.bind("127.0.0.1", 0)
- * s2 = UDPSocket.new
- * s2.bind("127.0.0.1", 0)
- * s2.connect(*s1.addr.values_at(3,1))
- * s1.connect(*s2.addr.values_at(3,1))
- * s1.send "aaa", 0
- * IO.select([s2])
- * p s2.recvfrom_nonblock(10) #=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
- *
- * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- * to _recvfrom_nonblock_ fails.
- *
- * UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
- * including Errno::EAGAIN.
- *
- * === See
- * * Socket#recvfrom
- */
-static VALUE
-udp_recvfrom_nonblock(int argc, VALUE *argv, VALUE sock)
-{
- return s_recvfrom_nonblock(sock, argc, argv, RECV_IP);
-}
-
#ifdef HAVE_SYS_UN_H
static VALUE
unix_init(sock, path)
@@ -1848,15 +1464,6 @@ unix_init(sock, path)
return init_unixsock(sock, path, 0);
}
-static char *
-unixpath(struct sockaddr_un *sockaddr, socklen_t len)
-{
- if (sockaddr->sun_path < (char*)sockaddr + len)
- return sockaddr->sun_path;
- else
- return "";
-}
-
static VALUE
unix_path(sock)
VALUE sock;
@@ -1869,7 +1476,7 @@ unix_path(sock)
socklen_t len = sizeof(addr);
if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail(0);
- fptr->path = strdup(unixpath(&addr, len));
+ fptr->path = strdup(addr.sun_path);
}
return rb_str_new2(fptr->path);
}
@@ -1929,7 +1536,7 @@ unix_send_io(sock, val)
fd = FIX2INT(val);
}
else {
- rb_raise(rb_eTypeError, "neither IO nor file descriptor");
+ rb_raise(rb_eTypeError, "IO nor file descriptor");
}
GetOpenFile(sock, fptr);
@@ -1946,9 +1553,9 @@ unix_send_io(sock, val)
#if FD_PASSING_BY_MSG_CONTROL
msg.msg_control = (caddr_t)&cmsg;
- msg.msg_controllen = CMSG_SPACE(sizeof(int));
+ msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int);
msg.msg_flags = 0;
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
+ cmsg.hdr.cmsg_len = sizeof(struct cmsghdr) + sizeof(int);
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_RIGHTS;
cmsg.fd = fd;
@@ -2021,9 +1628,9 @@ unix_recv_io(argc, argv, sock)
#if FD_PASSING_BY_MSG_CONTROL
msg.msg_control = (caddr_t)&cmsg;
- msg.msg_controllen = CMSG_SPACE(sizeof(int));
+ msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int);
msg.msg_flags = 0;
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
+ cmsg.hdr.cmsg_len = sizeof(struct cmsghdr) + sizeof(int);
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_RIGHTS;
cmsg.fd = -1;
@@ -2036,34 +1643,18 @@ unix_recv_io(argc, argv, sock)
if (recvmsg(fileno(fptr->f), &msg, 0) == -1)
rb_sys_fail("recvmsg(2)");
+ if (
#if FD_PASSING_BY_MSG_CONTROL
- if (msg.msg_controllen != CMSG_SPACE(sizeof(int))) {
- rb_raise(rb_eSocket,
- "file descriptor was not passed (msg_controllen : %d != %d)",
- msg.msg_controllen, CMSG_SPACE(sizeof(int)));
- }
- if (cmsg.hdr.cmsg_len != CMSG_SPACE(0) + sizeof(int)) {
- rb_raise(rb_eSocket,
- "file descriptor was not passed (cmsg_len : %d != %d)",
- cmsg.hdr.cmsg_len, CMSG_SPACE(0) + sizeof(int));
- }
- if (cmsg.hdr.cmsg_level != SOL_SOCKET) {
- rb_raise(rb_eSocket,
- "file descriptor was not passed (cmsg_level : %d != %d)",
- cmsg.hdr.cmsg_level, SOL_SOCKET);
- }
- if (cmsg.hdr.cmsg_type != SCM_RIGHTS) {
- rb_raise(rb_eSocket,
- "file descriptor was not passed (cmsg_type : %d != %d)",
- cmsg.hdr.cmsg_type, SCM_RIGHTS);
- }
+ msg.msg_controllen != sizeof(struct cmsghdr) + sizeof(int) ||
+ cmsg.hdr.cmsg_len != sizeof(struct cmsghdr) + sizeof(int) ||
+ cmsg.hdr.cmsg_level != SOL_SOCKET ||
+ cmsg.hdr.cmsg_type != SCM_RIGHTS
#else
- if (msg.msg_accrightslen != sizeof(fd)) {
- rb_raise(rb_eSocket,
- "file descriptor was not passed (accrightslen) : %d != %d",
- msg.msg_accrightslen, sizeof(fd));
- }
+ msg.msg_accrightslen != sizeof(fd)
#endif
+ ) {
+ rb_raise(rb_eSocket, "File descriptor was not passed");
+ }
#if FD_PASSING_BY_MSG_CONTROL
fd = cmsg.fd;
@@ -2102,49 +1693,6 @@ unix_accept(sock)
(struct sockaddr*)&from, &fromlen);
}
-/*
- * call-seq:
- * unixserver.accept_nonblock => unixsocket
- *
- * Accepts an incoming connection using accept(2) after
- * O_NONBLOCK is set for the underlying file descriptor.
- * It returns an accepted UNIXSocket for the incoming connection.
- *
- * === Example
- * require 'socket'
- * serv = UNIXServer.new("/tmp/sock")
- * begin
- * sock = serv.accept_nonblock
- * rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
- * IO.select([serv])
- * retry
- * end
- * # sock is an accepted socket.
- *
- * Refer to Socket#accept for the exceptions that may be thrown if the call
- * to UNIXServer#accept_nonblock fails.
- *
- * UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure,
- * including Errno::EAGAIN.
- *
- * === See
- * * UNIXServer#accept
- * * Socket#accept
- */
-static VALUE
-unix_accept_nonblock(sock)
- VALUE sock;
-{
- OpenFile *fptr;
- struct sockaddr_un from;
- socklen_t fromlen;
-
- GetOpenFile(sock, fptr);
- fromlen = sizeof(from);
- return s_accept_nonblock(rb_cUNIXSocket, fptr,
- (struct sockaddr *)&from, &fromlen);
-}
-
static VALUE
unix_sysaccept(sock)
VALUE sock;
@@ -2159,12 +1707,11 @@ unix_sysaccept(sock)
}
static VALUE
-unixaddr(sockaddr, len)
+unixaddr(sockaddr)
struct sockaddr_un *sockaddr;
- socklen_t len;
{
return rb_assoc_new(rb_str_new2("AF_UNIX"),
- rb_str_new2(unixpath(sockaddr, len)));
+ rb_str_new2(sockaddr->sun_path));
}
static VALUE
@@ -2179,7 +1726,9 @@ unix_addr(sock)
if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail("getsockname(2)");
- return unixaddr(&addr, len);
+ if (len == 0)
+ addr.sun_path[0] = '\0';
+ return unixaddr(&addr);
}
static VALUE
@@ -2194,7 +1743,9 @@ unix_peeraddr(sock)
if (getpeername(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail("getsockname(2)");
- return unixaddr(&addr, len);
+ if (len == 0)
+ addr.sun_path[0] = '\0';
+ return unixaddr(&addr);
}
#endif
@@ -2252,7 +1803,7 @@ setup_domain_and_type(domain, dv, type, tv)
*dv = PF_IPX;
#endif
else
- rb_raise(rb_eSocket, "unknown socket domain %s", ptr);
+ rb_raise(rb_eSocket, "Unknown socket domain %s", ptr);
}
else {
*dv = NUM2INT(domain);
@@ -2283,7 +1834,7 @@ setup_domain_and_type(domain, dv, type, tv)
*tv = SOCK_PACKET;
#endif
else
- rb_raise(rb_eSocket, "unknown socket type %s", ptr);
+ rb_raise(rb_eSocket, "Unknown socket type %s", ptr);
}
else {
*tv = NUM2INT(type);
@@ -2309,18 +1860,16 @@ static VALUE
sock_s_socketpair(klass, domain, type, protocol)
VALUE klass, domain, type, protocol;
{
-#if defined HAVE_SOCKETPAIR
- int d, t, p, sp[2];
- int ret;
+#if !defined(_WIN32) && !defined(__BEOS__) && !defined(__EMX__) && !defined(__QNXNTO__) && !defined(__VMS)
+ int d, t, sp[2];
setup_domain_and_type(domain, &d, type, &t);
- p = NUM2INT(protocol);
- ret = socketpair(d, t, p, sp);
- if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
- rb_gc();
- ret = socketpair(d, t, p, sp);
- }
- if (ret < 0) {
+ again:
+ if (socketpair(d, t, NUM2INT(protocol), sp) < 0) {
+ if (errno == EMFILE || errno == ENFILE) {
+ rb_gc();
+ goto again;
+ }
rb_sys_fail("socketpair(2)");
}
@@ -2351,117 +1900,6 @@ unix_s_socketpair(argc, argv, klass)
}
#endif
-/*
- * call-seq:
- * socket.connect(server_sockaddr) => 0
- *
- * Requests a connection to be made on the given +server_sockaddr+. Returns 0 if
- * successful, otherwise an exception is raised.
- *
- * === Parameter
- * * +server_sockaddr+ - the +struct+ sockaddr contained in a string
- *
- * === Example:
- * # Pull down Google's web page
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
- * socket.connect( sockaddr )
- * socket.write( "GET / HTTP/1.0\r\n\r\n" )
- * results = socket.read
- *
- * === Unix-based Exceptions
- * On unix-based systems the following system exceptions may be raised if
- * the call to _connect_ fails:
- * * Errno::EACCES - search permission is denied for a component of the prefix
- * path or write access to the +socket+ is denided
- * * Errno::EADDRINUSE - the _sockaddr_ is already in use
- * * Errno::EADDRNOTAVAIL - the specified _sockaddr_ is not available from the
- * local machine
- * * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for
- * the address family of the specified +socket+
- * * Errno::EALREADY - a connection is already in progress for the specified
- * socket
- * * Errno::EBADF - the +socket+ is not a valid file descriptor
- * * Errno::ECONNREFUSED - the target _sockaddr_ was not listening for connections
- * refused the connection request
- * * Errno::ECONNRESET - the remote host reset the connection request
- * * Errno::EFAULT - the _sockaddr_ cannot be accessed
- * * Errno::EHOSTUNREACH - the destination host cannot be reached (probably
- * because the host is down or a remote router cannot reach it)
- * * Errno::EINPROGRESS - the O_NONBLOCK is set for the +socket+ and the
- * connection cnanot be immediately established; the connection will be
- * established asynchronously
- * * Errno::EINTR - the attempt to establish the connection was interrupted by
- * delivery of a signal that was caught; the connection will be established
- * asynchronously
- * * Errno::EISCONN - the specified +socket+ is already connected
- * * Errno::EINVAL - the address length used for the _sockaddr_ is not a valid
- * length for the address family or there is an invalid family in _sockaddr_
- * * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
- * PATH_MAX
- * * Errno::ENETDOWN - the local interface used to reach the destination is down
- * * Errno::ENETUNREACH - no route to the network is present
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOSR - there were insufficient STREAMS resources available to
- * complete the operation
- * * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
- * * Errno::EOPNOTSUPP - the calling +socket+ is listening and cannot be connected
- * * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket
- * bound to the specified peer address
- * * Errno::ETIMEDOUT - the attempt to connect time out before a connection
- * was made.
- *
- * On unix-based systems if the address family of the calling +socket+ is
- * AF_UNIX the follow exceptions may be raised if the call to _connect_
- * fails:
- * * Errno::EIO - an i/o error occured while reading from or writing to the
- * file system
- * * Errno::ELOOP - too many symbolic links were encountered in translating
- * the pathname in _sockaddr_
- * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
- * characters, or an entired pathname exceeded PATH_MAX characters
- * * Errno::ENOENT - a component of the pathname does not name an existing file
- * or the pathname is an empty string
- * * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_
- * is not a directory
- *
- * === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
- * the call to _connect_ fails:
- * * Errno::ENETDOWN - the network is down
- * * Errno::EADDRINUSE - the socket's local address is already in use
- * * Errno::EINTR - the socket was cancelled
- * * Errno::EINPROGRESS - a blocking socket is in progress or the service provider
- * is still processing a callback function. Or a nonblocking connect call is
- * in progress on the +socket+.
- * * Errno::EALREADY - see Errno::EINVAL
- * * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as
- * ADDR_ANY TODO check ADDRANY TO INADDR_ANY
- * * Errno::EAFNOSUPPORT - addresses in the specified family cannot be used with
- * with this +socket+
- * * Errno::ECONNREFUSED - the target _sockaddr_ was not listening for connections
- * refused the connection request
- * * Errno::EFAULT - the socket's internal address or address length parameter
- * is too small or is not a valid part of the user space address
- * * Errno::EINVAL - the +socket+ is a listening socket
- * * Errno::EISCONN - the +socket+ is already connected
- * * Errno::ENETUNREACH - the network cannot be reached from this host at this time
- * * Errno::EHOSTUNREACH - no route to the network is present
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
- * * Errno::ETIMEDOUT - the attempt to connect time out before a connection
- * was made.
- * * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the
- * connection cannot be completed immediately
- * * Errno::EACCES - the attempt to connect the datagram socket to the
- * broadcast address failed
- *
- * === See
- * * connect manual pages on unix-based systems
- * * connect function in Microsoft's Winsock functions reference
- */
static VALUE
sock_connect(sock, addr)
VALUE sock, addr;
@@ -2480,142 +1918,6 @@ sock_connect(sock, addr)
return INT2FIX(0);
}
-/*
- * call-seq:
- * socket.connect_nonblock(server_sockaddr) => 0
- *
- * Requests a connection to be made on the given +server_sockaddr+ after
- * O_NONBLOCK is set for the underlying file descriptor.
- * Returns 0 if successful, otherwise an exception is raised.
- *
- * === Parameter
- * * +server_sockaddr+ - the +struct+ sockaddr contained in a string
- *
- * === Example:
- * # Pull down Google's web page
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- * sockaddr = Socket.sockaddr_in(80, 'www.google.com')
- * begin
- * socket.connect_nonblock(sockaddr)
- * rescue Errno::EINPROGRESS
- * IO.select(nil, [socket])
- * begin
- * socket.connect_nonblock(sockaddr)
- * rescue Errno::EISCONN
- * end
- * end
- * socket.write("GET / HTTP/1.0\r\n\r\n")
- * results = socket.read
- *
- * Refer to Socket#connect for the exceptions that may be thrown if the call
- * to _connect_nonblock_ fails.
- *
- * Socket#connect_nonblock may raise any error corresponding to connect(2) failure,
- * including Errno::EINPROGRESS.
- *
- * === See
- * * Socket#connect
- */
-static VALUE
-sock_connect_nonblock(sock, addr)
- VALUE sock, addr;
-{
- OpenFile *fptr;
- int n;
-
- StringValue(addr);
- addr = rb_str_new4(addr);
- GetOpenFile(sock, fptr);
- rb_io_set_nonblock(fptr);
- n = connect(fileno(fptr->f), (struct sockaddr*)RSTRING(addr)->ptr, RSTRING(addr)->len);
- if (n < 0) {
- rb_sys_fail("connect(2)");
- }
-
- return INT2FIX(n);
-}
-
-/*
- * call-seq:
- * socket.bind(server_sockaddr) => 0
- *
- * Binds to the given +struct+ sockaddr.
- *
- * === Parameter
- * * +server_sockaddr+ - the +struct+ sockaddr contained in a string
- *
- * === Example
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- *
- * === Unix-based Exceptions
- * On unix-based based systems the following system exceptions may be raised if
- * the call to _bind_ fails:
- * * Errno::EACCES - the specified _sockaddr_ is protected and the current
- * user does not have permission to bind to it
- * * Errno::EADDRINUSE - the specified _sockaddr_ is already in use
- * * Errno::EADDRNOTAVAIL - the specified _sockaddr_ is not available from the
- * local machine
- * * Errno::EAFNOSUPPORT - the specified _sockaddr_ isnot a valid address for
- * the family of the calling +socket+
- * * Errno::EBADF - the _sockaddr_ specified is not a valid file descriptor
- * * Errno::EFAULT - the _sockaddr_ argument cannot be accessed
- * * Errno::EINVAL - the +socket+ is already bound to an address, and the
- * protocol does not support binding to the new _sockaddr_ or the +socket+
- * has been shut down.
- * * Errno::EINVAL - the address length is not a valid length for the address
- * family
- * * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
- * PATH_MAX
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOSR - there were insufficient STREAMS resources available to
- * complete the operation
- * * Errno::ENOTSOCK - the +socket+ does not refer to a socket
- * * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support
- * binding to an address
- *
- * On unix-based based systems if the address family of the calling +socket+ is
- * Socket::AF_UNIX the follow exceptions may be raised if the call to _bind_
- * fails:
- * * Errno::EACCES - search permission is denied for a component of the prefix
- * path or write access to the +socket+ is denided
- * * Errno::EDESTADDRREQ - the _sockaddr_ argument is a null pointer
- * * Errno::EISDIR - same as Errno::EDESTADDRREQ
- * * Errno::EIO - an i/o error occurred
- * * Errno::ELOOP - too many symbolic links were encountered in translating
- * the pathname in _sockaddr_
- * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
- * characters, or an entired pathname exceeded PATH_MAX characters
- * * Errno::ENOENT - a component of the pathname does not name an existing file
- * or the pathname is an empty string
- * * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_
- * is not a directory
- * * Errno::EROFS - the name would reside on a read only filesystem
- *
- * === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
- * the call to _bind_ fails:
- * * Errno::ENETDOWN-- the network is down
- * * Errno::EACCES - the attempt to connect the datagram socket to the
- * broadcast address failed
- * * Errno::EADDRINUSE - the socket's local address is already in use
- * * Errno::EADDRNOTAVAIL - the specified address is not a valid address for this
- * computer
- * * Errno::EFAULT - the socket's internal address or address length parameter
- * is too small or is not a valid part of the user space addressed
- * * Errno::EINVAL - the +socket+ is already bound to an address
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
- *
- * === See
- * * bind manual pages on unix-based systems
- * * bind function in Microsoft's Winsock functions reference
- */
static VALUE
sock_bind(sock, addr)
VALUE sock, addr;
@@ -2630,76 +1932,6 @@ sock_bind(sock, addr)
return INT2FIX(0);
}
-/*
- * call-seq:
- * socket.listen( int ) => 0
- *
- * Listens for connections, using the specified +int+ as the backlog. A call
- * to _listen_ only applies if the +socket+ is of type SOCK_STREAM or
- * SOCK_SEQPACKET.
- *
- * === Parameter
- * * +backlog+ - the maximum length of the queue for pending connections.
- *
- * === Example 1
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
- *
- * === Example 2 (listening on an arbitary port, unix-based systems only):
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * socket.listen( 1 )
- *
- * === Unix-based Exceptions
- * On unix based systems the above will work because a new +sockaddr+ struct
- * is created on the address ADDR_ANY, for an arbitrary port number as handed
- * off by the kernel. It will not work on Windows, because Windows requires that
- * the +socket+ is bound by calling _bind_ before it can _listen_.
- *
- * If the _backlog_ amount exceeds the implementation-dependent maximum
- * queue length, the implementation's maximum queue length will be used.
- *
- * On unix-based based systems the following system exceptions may be raised if the
- * call to _listen_ fails:
- * * Errno::EBADF - the _socket_ argument is not a valid file descriptor
- * * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and
- * the protocol does not support listening on an unbound socket
- * * Errno::EINVAL - the _socket_ is already connected
- * * Errno::ENOTSOCK - the _socket_ argument does not refer to a socket
- * * Errno::EOPNOTSUPP - the _socket_ protocol does not support listen
- * * Errno::EACCES - the calling process does not have approriate privileges
- * * Errno::EINVAL - the _socket_ has been shut down
- * * Errno::ENOBUFS - insufficient resources are available in the system to
- * complete the call
- *
- * === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
- * the call to _listen_ fails:
- * * Errno::ENETDOWN - the network is down
- * * Errno::EADDRINUSE - the socket's local address is already in use. This
- * usually occurs during the execution of _bind_ but could be delayed
- * if the call to _bind_ was to a partially wildcard address (involving
- * ADDR_ANY) and if a specific address needs to be commmitted at the
- * time of the call to _listen_
- * * Errno::EINPROGRESS - a Windows Sockets 1.1 call is in progress or the
- * service provider is still processing a callback function
- * * Errno::EINVAL - the +socket+ has not been bound with a call to _bind_.
- * * Errno::EISCONN - the +socket+ is already connected
- * * Errno::EMFILE - no more socket descriptors are available
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOTSOC - +socket+ is not a socket
- * * Errno::EOPNOTSUPP - the referenced +socket+ is not a type that supports
- * the _listen_ method
- *
- * === See
- * * listen manual pages on unix-based systems
- * * listen function in Microsoft's Winsock functions reference
- */
static VALUE
sock_listen(sock, log)
VALUE sock, log;
@@ -2716,111 +1948,6 @@ sock_listen(sock, log)
return INT2FIX(0);
}
-/*
- * call-seq:
- * socket.recvfrom(maxlen) => [mesg, sender_sockaddr]
- * socket.recvfrom(maxlen, flags) => [mesg, sender_sockaddr]
- *
- * Receives up to _maxlen_ bytes from +socket+. _flags_ is zero or more
- * of the +MSG_+ options. The first element of the results, _mesg_, is the data
- * received. The second element, _sender_sockaddr_, contains protocol-specific information
- * on the sender.
- *
- * === Parameters
- * * +maxlen+ - the number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
- * === Example
- * # In one file, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
- * client, client_sockaddr = socket.accept
- * data = client.recvfrom( 20 )[0].chomp
- * puts "I only received 20 bytes '#{data}'"
- * sleep 1
- * socket.close
- *
- * # In another file, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.connect( sockaddr )
- * socket.puts "Watch this get cut short!"
- * socket.close
- *
- * === Unix-based Exceptions
- * On unix-based based systems the following system exceptions may be raised if the
- * call to _recvfrom_ fails:
- * * Errno::EAGAIN - the +socket+ file descriptor is marked as O_NONBLOCK and no
- * data is waiting to be received; or MSG_OOB is set and no out-of-band data
- * is available and either the +socket+ file descriptor is marked as
- * O_NONBLOCK or the +socket+ does not support blocking to wait for
- * out-of-band-data
- * * Errno::EWOULDBLOCK - see Errno::EAGAIN
- * * Errno::EBADF - the +socket+ is not a valid file descriptor
- * * Errno::ECONNRESET - a connection was forcibly closed by a peer
- * * Errno::EFAULT - the socket's internal buffer, address or address length
- * cannot be accessed or written
- * * Errno::EINTR - a signal interupted _recvfrom_ before any data was available
- * * Errno::EINVAL - the MSG_OOB flag is set and no out-of-band data is available
- * * Errno::EIO - an i/o error occurred while reading from or writing to the
- * filesystem
- * * Errno::ENOBUFS - insufficient resources were available in the system to
- * perform the operation
- * * Errno::ENOMEM - insufficient memory was available to fulfill the request
- * * Errno::ENOSR - there were insufficient STREAMS resources available to
- * complete the operation
- * * Errno::ENOTCONN - a receive is attempted on a connection-mode socket that
- * is not connected
- * * Errno::ENOTSOCK - the +socket+ does not refer to a socket
- * * Errno::EOPNOTSUPP - the specified flags are not supported for this socket type
- * * Errno::ETIMEDOUT - the connection timed out during connection establishment
- * or due to a transmission timeout on an active connection
- *
- * === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
- * the call to _recvfrom_ fails:
- * * Errno::ENETDOWN - the network is down
- * * Errno::EFAULT - the internal buffer and from parameters on +socket+ are not
- * part of the user address space, or the internal fromlen parameter is
- * too small to accomodate the peer address
- * * Errno::EINTR - the (blocking) call was cancelled by an internal call to
- * the WinSock function WSACancelBlockingCall
- * * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
- * the service provider is still processing a callback function
- * * Errno::EINVAL - +socket+ has not been bound with a call to _bind_, or an
- * unknown flag was specified, or MSG_OOB was specified for a socket with
- * SO_OOBINLINE enabled, or (for byte stream-style sockets only) the internal
- * len parameter on +socket+ was zero or negative
- * * Errno::EISCONN - +socket+ is already connected. The call to _recvfrom_ is
- * not permitted with a connected socket on a socket that is connetion
- * oriented or connectionless.
- * * Errno::ENETRESET - the connection has been broken due to the keep-alive
- * activity detecting a failure while the operation was in progress.
- * * Errno::EOPNOTSUPP - MSG_OOB was specified, but +socket+ is not stream-style
- * such as type SOCK_STREAM. OOB data is not supported in the communication
- * domain associated with +socket+, or +socket+ is unidirectional and
- * supports only send operations
- * * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to
- * call _recvfrom_ on a socket after _shutdown_ has been invoked.
- * * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to
- * _recvfrom_ would block.
- * * Errno::EMSGSIZE - the message was too large to fit into the specified buffer
- * and was truncated.
- * * Errno::ETIMEDOUT - the connection has been dropped, because of a network
- * failure or because the system on the other end went down without
- * notice
- * * Errno::ECONNRESET - the virtual circuit was reset by the remote side
- * executing a hard or abortive close. The application should close the
- * socket; it is no longer usable. On a UDP-datagram socket this error
- * indicates a previous send operation resulted in an ICMP Port Unreachable
- * message.
- */
static VALUE
sock_recvfrom(argc, argv, sock)
int argc;
@@ -2830,152 +1957,6 @@ sock_recvfrom(argc, argv, sock)
return s_recvfrom(sock, argc, argv, RECV_SOCKET);
}
-/*
- * call-seq:
- * socket.recvfrom_nonblock(maxlen) => [mesg, sender_sockaddr]
- * socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_sockaddr]
- *
- * Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
- * O_NONBLOCK is set for the underlying file descriptor.
- * _flags_ is zero or more of the +MSG_+ options.
- * The first element of the results, _mesg_, is the data received.
- * The second element, _sender_sockaddr_, contains protocol-specific information
- * on the sender.
- *
- * When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns
- * an empty string as data.
- * The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
- *
- * === Parameters
- * * +maxlen+ - the number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
- * === Example
- * # In one file, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- * sockaddr = Socket.sockaddr_in(2200, 'localhost')
- * socket.bind(sockaddr)
- * socket.listen(5)
- * client, client_sockaddr = socket.accept
- * begin
- * pair = client.recvfrom_nonblock(20)
- * rescue Errno::EAGAIN
- * IO.select([client])
- * retry
- * end
- * data = pair[0].chomp
- * puts "I only received 20 bytes '#{data}'"
- * sleep 1
- * socket.close
- *
- * # In another file, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- * sockaddr = Socket.sockaddr_in(2200, 'localhost')
- * socket.connect(sockaddr)
- * socket.puts "Watch this get cut short!"
- * socket.close
- *
- * Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- * to _recvfrom_nonblock_ fails.
- *
- * Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
- * including Errno::EAGAIN.
- *
- * === See
- * * Socket#recvfrom
- */
-static VALUE
-sock_recvfrom_nonblock(int argc, VALUE *argv, VALUE sock)
-{
- return s_recvfrom_nonblock(sock, argc, argv, RECV_SOCKET);
-}
-
-/*
- * call-seq:
- * socket.accept => [ socket, string ]
- *
- * Accepts an incoming connection returning an array containing a new
- * Socket object and a string holding the +struct+ sockaddr information about
- * the caller.
- *
- * === Example
- * # In one script, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
- * client, client_sockaddr = socket.accept
- * puts "The client said, '#{socket.readline.chomp}'"
- * client.puts "Hello from script one!"
- * socket.close
- *
- * # In another script, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.connect( sockaddr )
- * socket.puts "Hello from script 2."
- * puts "The server said, '#{socket.readline.chomp}'"
- * socket.close
- *
- * === Unix-based Exceptions
- * On unix-based based systems the following system exceptions may be raised if the
- * call to _accept_ fails:
- * * Errno::EAGAIN - O_NONBLOCK is set for the +socket+ file descriptor and no
- * connections are parent to be accepted
- * * Errno::EWOULDBLOCK - same as Errno::EAGAIN
- * * Errno::EBADF - the +socket+ is not a valid file descriptor
- * * Errno::ECONNABORTED - a connection has been aborted
- * * Errno::EFAULT - the socket's internal address or address length parameter
- * cannot be access or written
- * * Errno::EINTR - the _accept_ method was interrupted by a signal that was
- * caught before a valid connection arrived
- * * Errno::EINVAL - the +socket+ is not accepting connections
- * * Errno::EMFILE - OPEN_MAX file descriptors are currently open in the calling
- * process
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOMEM - there was insufficient memory available to complete the
- * operation
- * * Errno::ENOSR - there was insufficient STREAMS resources available to
- * complete the operation
- * * Errno::ENFILE - the maximum number of file descriptors in the system are
- * already open
- * * Errno::ENOTSOCK - the +socket+ does not refer to a socket
- * * Errno::EOPNOTSUPP - the socket type for the calling +socket+ does not
- * support accept connections
- * * Errno::EPROTO - a protocol error has occurred
- *
- * === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
- * the call to _accept_ fails:
- * * Errno::ECONNRESET - an incoming connection was indicated, but was
- * terminated by the remote peer prior to accepting the connection
- * * Errno::EFAULT - the socket's internal address or address length parameter
- * is too small or is not a valid part of the user space address
- * * Errno::EINVAL - the _listen_ method was not invoked prior to calling _accept_
- * * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
- * the service provider is still processing a callback function
- * * Errno::EMFILE - the queue is not empty, upong etry to _accept_ and there are
- * no socket descriptors available
- * * Errno::ENETDOWN - the network is down
- * * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOTSOCK - +socket+ is not a socket
- * * Errno::EOPNOTSUPP - +socket+ is not a type that supports connection-oriented
- * service.
- * * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and no connections are
- * present to be accepted
- *
- * === See
- * * accept manual pages on unix-based systems
- * * accept function in Microsoft's Winsock functions reference
- */
static VALUE
sock_accept(sock)
VALUE sock;
@@ -2991,107 +1972,6 @@ sock_accept(sock)
return rb_assoc_new(sock2, rb_str_new(buf, len));
}
-/*
- * call-seq:
- * socket.accept_nonblock => [client_socket, client_sockaddr]
- *
- * Accepts an incoming connection using accept(2) after
- * O_NONBLOCK is set for the underlying file descriptor.
- * It returns an array containg the accpeted socket
- * for the incoming connection, _client_socket_,
- * and a string that contains the +struct+ sockaddr information
- * about the caller, _client_sockaddr_.
- *
- * === Example
- * # In one script, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- * sockaddr = Socket.sockaddr_in(2200, 'localhost')
- * socket.bind(sockaddr)
- * socket.listen(5)
- * begin
- * client_socket, client_sockaddr = socket.accept_nonblock
- * rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
- * IO.select([socket])
- * retry
- * end
- * puts "The client said, '#{socket.readline.chomp}'"
- * client_socket.puts "Hello from script one!"
- * socket.close
- *
- * # In another script, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new(AF_INET, SOCK_STREAM, 0)
- * sockaddr = Socket.sockaddr_in(2200, 'localhost')
- * socket.connect(sockaddr)
- * socket.puts "Hello from script 2."
- * puts "The server said, '#{socket.readline.chomp}'"
- * socket.close
- *
- * Refer to Socket#accept for the exceptions that may be thrown if the call
- * to _accept_nonblock_ fails.
- *
- * Socket#accept_nonblock may raise any error corresponding to accept(2) failure,
- * including Errno::EAGAIN.
- *
- * === See
- * * Socket#accept
- */
-static VALUE
-sock_accept_nonblock(sock)
- VALUE sock;
-{
- OpenFile *fptr;
- VALUE sock2;
- char buf[1024];
- socklen_t len = sizeof buf;
-
- GetOpenFile(sock, fptr);
- sock2 = s_accept_nonblock(rb_cSocket, fptr, (struct sockaddr *)buf, &len);
- return rb_assoc_new(sock2, rb_str_new(buf, len));
-}
-
-/*
- * call-seq:
- * socket.sysaccept => [client_socket_fd, client_sockaddr]
- *
- * Accepts an incoming connection returnings an array containg the (integer)
- * file descriptor for the incoming connection, _client_socket_fd_,
- * and a string that contains the +struct+ sockaddr information
- * about the caller, _client_sockaddr_.
- *
- * === Example
- * # In one script, start this first
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.bind( sockaddr )
- * socket.listen( 5 )
- * client_fd, client_sockaddr = socket.sysaccept
- * puts "The client said, '#{socket.readline.chomp}'"
- * client_socket = Socket.for_fd( client_fd )
- * client_socket.puts "Hello from script one!"
- * socket.close
- *
- * # In another script, start this second
- * require 'socket'
- * include Socket::Constants
- * socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
- * sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
- * socket.connect( sockaddr )
- * socket.puts "Hello from script 2."
- * puts "The server said, '#{socket.readline.chomp}'"
- * socket.close
- *
- * Refer to Socket#accept for the exceptions that may be thrown if the call
- * to _sysaccept_ fails.
- *
- * === See
- * * Socket#accept
- */
static VALUE
sock_sysaccept(sock)
VALUE sock;
@@ -3167,7 +2047,6 @@ make_addrinfo(res0)
return base;
}
-/* Returns a String containing the binary value of a struct sockaddr. */
VALUE
sock_sockaddr(addr, len)
struct sockaddr *addr;
@@ -3193,102 +2072,6 @@ sock_sockaddr(addr, len)
return rb_str_new(ptr, len);
}
-/*
- * Document-class: IPSocket
- *
- * IPSocket is the parent of TCPSocket and UDPSocket and implements
- * functionality common to them.
- *
- * A number of APIs in IPSocket, Socket, and their descendants return an
- * address as an array. The members of that array are:
- * - address family: A string like "AF_INET" or "AF_INET6" if it is one of the
- * commonly used families, the string "unknown:#" (where `#' is the address
- * family number) if it is not one of the common ones. The strings map to
- * the Socket::AF_* constants.
- * - port: The port number.
- * - name: Either the canonical name from looking the address up in the DNS, or
- * the address in presentation format
- * - address: The address in presentation format (a dotted decimal string for
- * IPv4, a hex string for IPv6).
- *
- * The address and port can be used directly to create sockets and to bind or
- * connect them to the address.
- */
-
-/*
- * Document-class: Socket
- *
- * Socket contains a number of generally useful singleton methods and
- * constants, as well as offering low-level interfaces that can be used to
- * develop socket applications using protocols other than TCP, UDP, and UNIX
- * domain sockets.
- */
-
-/*
- * Document-method: gethostbyname
- * call-seq: Socket.gethostbyname(host) => hostent
- *
- * Resolve +host+ and return name and address information for it, similarly to
- * gethostbyname(3). +host+ can be a domain name or the presentation format of
- * an address.
- *
- * Returns an array of information similar to that found in a +struct hostent+:
- * - cannonical name: the cannonical name for host in the DNS, or a
- * string representing the address
- * - aliases: an array of aliases for the canonical name, there may be no aliases
- * - address family: usually one of Socket::AF_INET or Socket::AF_INET6
- * - address: a string, the binary value of the +struct sockaddr+ for this name, in
- * the indicated address family
- * - ...: if there are multiple addresses for this host, a series of
- * strings/+struct sockaddr+s may follow, not all necessarily in the same
- * address family. Note that the fact that they may not be all in the same
- * address family is a departure from the behaviour of gethostbyname(3).
- *
- * Note: I believe that the fact that the multiple addresses returned are not
- * necessarily in the same address family may be a bug, since if this function
- * actually called gethostbyname(3), ALL the addresses returned in the trailing
- * address list (h_addr_list from struct hostent) would be of the same address
- * family! Examples from my system, OS X 10.3:
- *
- * ["localhost", [], 30, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001", "\177\000\000\001"]
- * and
- * ["ensemble.local", [], 30, "\376\200\000\004\000\000\000\000\002\003\223\377\376\255\010\214", "\300\250{\232" ]
- *
- * Similar information can be returned by Socket.getaddrinfo if called as:
- *
- * Socket.getaddrinfo(+host+, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
- *
- * == Examples
- *
- * Socket.gethostbyname "example.com"
- * => ["example.com", [], 2, "\300\000\"\246"]
- *
- * This name has no DNS aliases, and a single IPv4 address.
- *
- * Socket.gethostbyname "smtp.telus.net"
- * => ["smtp.svc.telus.net", ["smtp.telus.net"], 2, "\307\271\334\371"]
- *
- * This name is an an alias so the canonical name is returned, as well as the
- * alias and a single IPv4 address.
- *
- * Socket.gethostbyname "localhost"
- * => ["localhost", [], 30, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001", "\177\000\000\001"]
- *
- * This machine has no aliases, returns an IPv6 address, and has an additional IPv4 address.
- *
- * +host+ can also be an IP address in presentation format, in which case a
- * reverse lookup is done on the address:
- *
- * Socket.gethostbyname("127.0.0.1")
- * => ["localhost", [], 2, "\177\000\000\001"]
- *
- * Socket.gethostbyname("192.0.34.166")
- * => ["www.example.com", [], 2, "\300\000\"\246"]
- *
- *
- * == See
- * See: Socket.getaddrinfo
- */
static VALUE
sock_s_gethostbyname(obj, host)
VALUE obj, host;
@@ -3349,18 +2132,6 @@ sock_s_gethostbyaddr(argc, argv)
return ary;
}
-/*
- * Document-method: getservbyname
- * call-seq: Socket.getservbyname(name, proto="tcp") => port
- *
- * +name+ is a service name ("ftp", "telnet", ...) and proto is a protocol name
- * ("udp", "tcp", ...). '/etc/services' (or your system's equivalent) is
- * searched for a service for +name+ and +proto+, and the port number is
- * returned.
- *
- * Note that unlike Socket.getaddrinfo, +proto+ may not be specified using the
- * Socket::SOCK_* constants, a string must must be used.
- */
static VALUE
sock_s_getservbyaname(argc, argv)
int argc;
@@ -3391,120 +2162,6 @@ sock_s_getservbyaname(argc, argv)
return INT2FIX(port);
}
-/*
-Documentation should explain the following:
-
- $ pp Socket.getaddrinfo("", 1, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
- [["AF_INET", 1, "0.0.0.0", "0.0.0.0", 2, 1, 6]]
-
- $ pp Socket.getaddrinfo(nil, 1, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
- [["AF_INET6", 1, "::", "::", 30, 1, 6],
- ["AF_INET", 1, "0.0.0.0", "0.0.0.0", 2, 1, 6]]
-
- $ pp Socket.getaddrinfo("localhost", 1, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
- [["AF_INET6", 1, "localhost", "::1", 30, 1, 6],
- ["AF_INET", 1, "localhost", "127.0.0.1", 2, 1, 6]]
-
- $ pp Socket.getaddrinfo("ensemble.local.", 1, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
- [["AF_INET", 1, "localhost", "192.168.123.154", 2, 1, 6]]
-
-Does it?
-
-API suggestion: this method has too many arguments, it would be backwards compatible and easier
-to understand if limit args were accepted as :family=>..., :flags=>...
-*/
-
-/*
- * Document-method: getaddrinfo
- * call-seq: Socket.getaddrinfo(host, service, family=nil, socktype=nil, protocol=nil, flags=nil) => addrinfo
- *
- * Return address information for +host+ and +port+. The remaining arguments
- * are hints that limit the address information returned.
- *
- * This method corresponds closely to the POSIX.1g getaddrinfo() definition.
- *
- * === Parameters
- * - +host+ is a host name or an address string (dotted decimal for IPv4, or a hex string
- * for IPv6) for which to return information. A nil is also allowed, its meaning
- * depends on +flags+, see below.
- * - +service+ is a service name ("http", "ssh", ...), or
- * a port number (80, 22, ...), see Socket.getservbyname for more
- * information. A nil is also allowed, meaning zero.
- * - +family+ limits the output to a specific address family, one of the
- * Socket::AF_* constants. Socket::AF_INET (IPv4) and Socket::AF_INET6 (IPv6)
- * are the most commonly used families. You will usually pass either nil or
- * Socket::AF_UNSPEC, allowing the IPv6 information to be returned first if
- * +host+ is reachable via IPv6, and IPv4 information otherwise. The two
- * strings "AF_INET" or "AF_INET6" are also allowed, they are converted to
- * their respective Socket::AF_* constants.
- * - +socktype+ limits the output to a specific type of socket, one of the
- * Socket::SOCK_* constants. Socket::SOCK_STREAM (for TCP) and
- * Socket::SOCK_DGRAM (for UDP) are the most commonly used socket types. If
- * nil, then information for all types of sockets supported by +service+ will
- * be returned. You will usually know what type of socket you intend to
- * create, and should pass that socket type in.
- * - +protocol+ limits the output to a specific protocol numpber, one of the
- * Socket::IPPROTO_* constants. It is usually implied by the socket type
- * (Socket::SOCK_STREAM => Socket::IPPROTO_TCP, ...), if you pass other than
- * nil you already know what this is for.
- * - +flags+ is one of the Socket::AI_* constants. They mean:
- * - Socket::AI_PASSIVE: when set, if +host+ is nil the 'any' address will be
- * returned, Socket::INADDR_ANY or 0 for IPv4, "0::0" or "::" for IPv6. This
- * address is suitable for use by servers that will bind their socket and do
- * a passive listen, thus the name of the flag. Otherwise the local or
- * loopback address will be returned, this is "127.0.0.1" for IPv4 and "::1'
- * for IPv6.
- * - ...
- *
- *
- * === Returns
- *
- * Returns an array of arrays, where each subarray contains:
- * - address family, a string like "AF_INET" or "AF_INET6"
- * - port number, the port number for +service+
- * - host name, either a canonical name for +host+, or it's address in presentation
- * format if the address could not be looked up.
- * - host IP, the address of +host+ in presentation format
- * - address family, as a numeric value (one of the Socket::AF_* constants).
- * - socket type, as a numeric value (one of the Socket::SOCK_* constants).
- * - protocol number, as a numeric value (one of the Socket::IPPROTO_* constants).
- *
- * The first four values are identical to what is commonly returned as an
- * address array, see IPSocket for more information.
- *
- * === Examples
- *
- * Not all input combinations are valid, and while there are many combinations,
- * only a few cases are common.
- *
- * A typical client will call getaddrinfo with the +host+ and +service+ it
- * wants to connect to. It knows that it will attempt to connect with either
- * TCP or UDP, and specifies +socktype+ accordingly. It loops through all
- * returned addresses, and try to connect to them in turn:
- *
- * addrinfo = Socket::getaddrinfo('www.example.com', 'www', nil, Socket::SOCK_STREAM)
- * addrinfo.each do |af, port, name, addr|
- * begin
- * sock = TCPSocket.new(addr, port)
- * # ...
- * exit 1
- * rescue
- * end
- * end
- *
- * With UDP you don't know if connect suceeded, but if communication fails,
- * the next address can be tried.
- *
- * A typical server will call getaddrinfo with a +host+ of nil, the +service+
- * it listens to, and a +flags+ of Socket::AI_PASSIVE. It will listen for
- * connections on the first returned address:
- * addrinfo = Socket::getaddrinfo(nil, 'www', nil, Socket::SOCK_STREAM, nil, Socket::AI_PASSIVE)
- * af, port, name, addr = addrinfo.first
- * sock = TCPServer(addr, port)
- * while( client = s.accept )
- * # ...
- * end
- */
static VALUE
sock_s_getaddrinfo(argc, argv)
int argc;
@@ -3632,9 +2289,7 @@ sock_s_getnameinfo(argc, argv)
* 4th element holds numeric form, don't resolve.
* see ipaddr().
*/
-#ifdef AI_NUMERICHOST /* AIX 4.3.3 doesn't have AI_NUMERICHOST. */
hints.ai_flags |= AI_NUMERICHOST;
-#endif
}
}
else {
@@ -3742,17 +2397,6 @@ sock_s_unpack_sockaddr_in(self, addr)
VALUE host;
sockaddr = (struct sockaddr_in*)StringValuePtr(addr);
- if (((struct sockaddr *)sockaddr)->sa_family != AF_INET
-#ifdef INET6
- && ((struct sockaddr *)sockaddr)->sa_family != AF_INET6
-#endif
- ) {
-#ifdef INET6
- rb_raise(rb_eArgError, "not an AF_INET/AF_INET6 sockaddr");
-#else
- rb_raise(rb_eArgError, "not an AF_INET sockaddr");
-#endif
- }
host = make_ipaddr((struct sockaddr*)sockaddr);
OBJ_INFECT(host, addr);
return rb_assoc_new(INT2NUM(ntohs(sockaddr->sin_port)), host);
@@ -3764,17 +2408,11 @@ sock_s_pack_sockaddr_un(self, path)
VALUE self, path;
{
struct sockaddr_un sockaddr;
- char *sun_path;
VALUE addr;
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
- sun_path = StringValueCStr(path);
- if (sizeof(sockaddr.sun_path) <= strlen(sun_path)) {
- rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
- (int)sizeof(sockaddr.sun_path)-1);
- }
- strncpy(sockaddr.sun_path, sun_path, sizeof(sockaddr.sun_path)-1);
+ strncpy(sockaddr.sun_path, StringValuePtr(path), sizeof(sockaddr.sun_path)-1);
addr = rb_str_new((char*)&sockaddr, sizeof(sockaddr));
OBJ_INFECT(addr, path);
@@ -3786,24 +2424,15 @@ sock_s_unpack_sockaddr_un(self, addr)
VALUE self, addr;
{
struct sockaddr_un * sockaddr;
- char *sun_path;
VALUE path;
sockaddr = (struct sockaddr_un*)StringValuePtr(addr);
- if (((struct sockaddr *)sockaddr)->sa_family != AF_UNIX) {
- rb_raise(rb_eArgError, "not an AF_UNIX sockaddr");
- }
- if (sizeof(struct sockaddr_un) < RSTRING(addr)->len) {
- rb_raise(rb_eTypeError, "too long sockaddr_un - %ld longer than %d",
+ if (RSTRING(addr)->len != sizeof(struct sockaddr_un)) {
+ rb_raise(rb_eTypeError, "sockaddr_un size differs - %ld required; %d given",
RSTRING(addr)->len, sizeof(struct sockaddr_un));
}
- sun_path = unixpath(sockaddr, RSTRING(addr)->len);
- if (sizeof(struct sockaddr_un) == RSTRING(addr)->len &&
- sun_path == sockaddr->sun_path &&
- sun_path + strlen(sun_path) == RSTRING(addr)->ptr + RSTRING(addr)->len) {
- rb_raise(rb_eArgError, "sockaddr_un.sun_path not NUL terminated");
- }
- path = rb_str_new2(sun_path);
+ /* xxx: should I check against sun_path size? */
+ path = rb_str_new2(sockaddr->sun_path);
OBJ_INFECT(path, addr);
return path;
}
@@ -3820,31 +2449,6 @@ sock_define_const(name, value)
rb_define_const(mConst, name, INT2FIX(value));
}
-/*
- * Class +Socket+ provides access to the underlying operating system
- * socket implementations. It can be used to provide more operating system
- * specific functionality than the protocol-specific socket classes but at the
- * expense of greater complexity. In particular, the class handles addresses
- * using +struct sockaddr+ structures packed into Ruby strings, which can be
- * a joy to manipulate.
- *
- * === Exception Handling
- * Ruby's implementation of +Socket+ causes an exception to be raised
- * based on the error generated by the system dependent implementation.
- * This is why the methods are documented in a way that isolate
- * Unix-based system exceptions from Windows based exceptions. If more
- * information on particular exception is needed please refer to the
- * Unix manual pages or the Windows WinSock reference.
- *
- *
- * === Documentation by
- * * Zach Dennis
- * * Sam Roberts
- * * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
- *
- * Much material in this documentation is taken with permission from
- * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
- */
void
Init_socket()
{
@@ -3868,7 +2472,6 @@ Init_socket()
rb_define_method(rb_cBasicSocket, "getpeername", bsock_getpeername, 0);
rb_define_method(rb_cBasicSocket, "send", bsock_send, -1);
rb_define_method(rb_cBasicSocket, "recv", bsock_recv, -1);
- rb_define_method(rb_cBasicSocket, "recv_nonblock", bsock_recv_nonblock, -1);
rb_cIPSocket = rb_define_class("IPSocket", rb_cBasicSocket);
rb_define_global_const("IPsocket", rb_cIPSocket);
@@ -3894,7 +2497,6 @@ Init_socket()
rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket);
rb_define_global_const("TCPserver", rb_cTCPServer);
rb_define_method(rb_cTCPServer, "accept", tcp_accept, 0);
- rb_define_method(rb_cTCPServer, "accept_nonblock", tcp_accept_nonblock, 0);
rb_define_method(rb_cTCPServer, "sysaccept", tcp_sysaccept, 0);
rb_define_method(rb_cTCPServer, "initialize", tcp_svr_init, -1);
rb_define_method(rb_cTCPServer, "listen", sock_listen, 1);
@@ -3905,7 +2507,6 @@ Init_socket()
rb_define_method(rb_cUDPSocket, "connect", udp_connect, 2);
rb_define_method(rb_cUDPSocket, "bind", udp_bind, 2);
rb_define_method(rb_cUDPSocket, "send", udp_send, -1);
- rb_define_method(rb_cUDPSocket, "recvfrom_nonblock", udp_recvfrom_nonblock, -1);
#ifdef HAVE_SYS_UN_H
rb_cUNIXSocket = rb_define_class("UNIXSocket", rb_cBasicSocket);
@@ -3924,7 +2525,6 @@ Init_socket()
rb_define_global_const("UNIXserver", rb_cUNIXServer);
rb_define_method(rb_cUNIXServer, "initialize", unix_svr_init, 1);
rb_define_method(rb_cUNIXServer, "accept", unix_accept, 0);
- rb_define_method(rb_cUNIXServer, "accept_nonblock", unix_accept_nonblock, 0);
rb_define_method(rb_cUNIXServer, "sysaccept", unix_sysaccept, 0);
rb_define_method(rb_cUNIXServer, "listen", sock_listen, 1);
#endif
@@ -3933,15 +2533,12 @@ Init_socket()
rb_define_method(rb_cSocket, "initialize", sock_initialize, 3);
rb_define_method(rb_cSocket, "connect", sock_connect, 1);
- rb_define_method(rb_cSocket, "connect_nonblock", sock_connect_nonblock, 1);
rb_define_method(rb_cSocket, "bind", sock_bind, 1);
rb_define_method(rb_cSocket, "listen", sock_listen, 1);
rb_define_method(rb_cSocket, "accept", sock_accept, 0);
- rb_define_method(rb_cSocket, "accept_nonblock", sock_accept_nonblock, 0);
rb_define_method(rb_cSocket, "sysaccept", sock_sysaccept, 0);
rb_define_method(rb_cSocket, "recvfrom", sock_recvfrom, -1);
- rb_define_method(rb_cSocket, "recvfrom_nonblock", sock_recvfrom_nonblock, -1);
rb_define_singleton_method(rb_cSocket, "socketpair", sock_s_socketpair, 3);
rb_define_singleton_method(rb_cSocket, "pair", sock_s_socketpair, 3);
@@ -4007,195 +2604,6 @@ Init_socket()
#ifdef INET6
sock_define_const("PF_INET6", PF_INET6);
#endif
-#ifdef AF_LOCAL
- sock_define_const("AF_LOCAL", AF_LOCAL);
-#endif
-#ifdef PF_LOCAL
- sock_define_const("PF_LOCAL", PF_LOCAL);
-#endif
-#ifdef AF_IMPLINK
- sock_define_const("AF_IMPLINK", AF_IMPLINK);
-#endif
-#ifdef PF_IMPLINK
- sock_define_const("PF_IMPLINK", PF_IMPLINK);
-#endif
-#ifdef AF_PUP
- sock_define_const("AF_PUP", AF_PUP);
-#endif
-#ifdef PF_PUP
- sock_define_const("PF_PUP", PF_PUP);
-#endif
-#ifdef AF_CHAOS
- sock_define_const("AF_CHAOS", AF_CHAOS);
-#endif
-#ifdef PF_CHAOS
- sock_define_const("PF_CHAOS", PF_CHAOS);
-#endif
-#ifdef AF_NS
- sock_define_const("AF_NS", AF_NS);
-#endif
-#ifdef PF_NS
- sock_define_const("PF_NS", PF_NS);
-#endif
-#ifdef AF_ISO
- sock_define_const("AF_ISO", AF_ISO);
-#endif
-#ifdef PF_ISO
- sock_define_const("PF_ISO", PF_ISO);
-#endif
-#ifdef AF_OSI
- sock_define_const("AF_OSI", AF_OSI);
-#endif
-#ifdef PF_OSI
- sock_define_const("PF_OSI", PF_OSI);
-#endif
-#ifdef AF_ECMA
- sock_define_const("AF_ECMA", AF_ECMA);
-#endif
-#ifdef PF_ECMA
- sock_define_const("PF_ECMA", PF_ECMA);
-#endif
-#ifdef AF_DATAKIT
- sock_define_const("AF_DATAKIT", AF_DATAKIT);
-#endif
-#ifdef PF_DATAKIT
- sock_define_const("PF_DATAKIT", PF_DATAKIT);
-#endif
-#ifdef AF_CCITT
- sock_define_const("AF_CCITT", AF_CCITT);
-#endif
-#ifdef PF_CCITT
- sock_define_const("PF_CCITT", PF_CCITT);
-#endif
-#ifdef AF_SNA
- sock_define_const("AF_SNA", AF_SNA);
-#endif
-#ifdef PF_SNA
- sock_define_const("PF_SNA", PF_SNA);
-#endif
-#ifdef AF_DEC
- sock_define_const("AF_DEC", AF_DEC);
-#endif
-#ifdef PF_DEC
- sock_define_const("PF_DEC", PF_DEC);
-#endif
-#ifdef AF_DLI
- sock_define_const("AF_DLI", AF_DLI);
-#endif
-#ifdef PF_DLI
- sock_define_const("PF_DLI", PF_DLI);
-#endif
-#ifdef AF_LAT
- sock_define_const("AF_LAT", AF_LAT);
-#endif
-#ifdef PF_LAT
- sock_define_const("PF_LAT", PF_LAT);
-#endif
-#ifdef AF_HYLINK
- sock_define_const("AF_HYLINK", AF_HYLINK);
-#endif
-#ifdef PF_HYLINK
- sock_define_const("PF_HYLINK", PF_HYLINK);
-#endif
-#ifdef AF_ROUTE
- sock_define_const("AF_ROUTE", AF_ROUTE);
-#endif
-#ifdef PF_ROUTE
- sock_define_const("PF_ROUTE", PF_ROUTE);
-#endif
-#ifdef AF_LINK
- sock_define_const("AF_LINK", AF_LINK);
-#endif
-#ifdef PF_LINK
- sock_define_const("PF_LINK", PF_LINK);
-#endif
-#ifdef AF_COIP
- sock_define_const("AF_COIP", AF_COIP);
-#endif
-#ifdef PF_COIP
- sock_define_const("PF_COIP", PF_COIP);
-#endif
-#ifdef AF_CNT
- sock_define_const("AF_CNT", AF_CNT);
-#endif
-#ifdef PF_CNT
- sock_define_const("PF_CNT", PF_CNT);
-#endif
-#ifdef AF_SIP
- sock_define_const("AF_SIP", AF_SIP);
-#endif
-#ifdef PF_SIP
- sock_define_const("PF_SIP", PF_SIP);
-#endif
-#ifdef AF_NDRV
- sock_define_const("AF_NDRV", AF_NDRV);
-#endif
-#ifdef PF_NDRV
- sock_define_const("PF_NDRV", PF_NDRV);
-#endif
-#ifdef AF_ISDN
- sock_define_const("AF_ISDN", AF_ISDN);
-#endif
-#ifdef PF_ISDN
- sock_define_const("PF_ISDN", PF_ISDN);
-#endif
-#ifdef AF_NATM
- sock_define_const("AF_NATM", AF_NATM);
-#endif
-#ifdef PF_NATM
- sock_define_const("PF_NATM", PF_NATM);
-#endif
-#ifdef AF_SYSTEM
- sock_define_const("AF_SYSTEM", AF_SYSTEM);
-#endif
-#ifdef PF_SYSTEM
- sock_define_const("PF_SYSTEM", PF_SYSTEM);
-#endif
-#ifdef AF_NETBIOS
- sock_define_const("AF_NETBIOS", AF_NETBIOS);
-#endif
-#ifdef PF_NETBIOS
- sock_define_const("PF_NETBIOS", PF_NETBIOS);
-#endif
-#ifdef AF_PPP
- sock_define_const("AF_PPP", AF_PPP);
-#endif
-#ifdef PF_PPP
- sock_define_const("PF_PPP", PF_PPP);
-#endif
-#ifdef AF_ATM
- sock_define_const("AF_ATM", AF_ATM);
-#endif
-#ifdef PF_ATM
- sock_define_const("PF_ATM", PF_ATM);
-#endif
-#ifdef AF_NETGRAPH
- sock_define_const("AF_NETGRAPH", AF_NETGRAPH);
-#endif
-#ifdef PF_NETGRAPH
- sock_define_const("PF_NETGRAPH", PF_NETGRAPH);
-#endif
-#ifdef AF_MAX
- sock_define_const("AF_MAX", AF_MAX);
-#endif
-#ifdef PF_MAX
- sock_define_const("PF_MAX", PF_MAX);
-#endif
-#ifdef AF_E164
- sock_define_const("AF_E164", AF_E164);
-#endif
-#ifdef PF_XTP
- sock_define_const("PF_XTP", PF_XTP);
-#endif
-#ifdef PF_RTIP
- sock_define_const("PF_RTIP", PF_RTIP);
-#endif
-#ifdef PF_PIP
- sock_define_const("PF_PIP", PF_PIP);
-#endif
-#ifdef PF_KEY
- sock_define_const("PF_KEY", PF_KEY);
-#endif
sock_define_const("MSG_OOB", MSG_OOB);
#ifdef MSG_PEEK
@@ -4204,42 +2612,6 @@ Init_socket()
#ifdef MSG_DONTROUTE
sock_define_const("MSG_DONTROUTE", MSG_DONTROUTE);
#endif
-#ifdef MSG_EOR
- sock_define_const("MSG_EOR", MSG_EOR);
-#endif
-#ifdef MSG_TRUNC
- sock_define_const("MSG_TRUNC", MSG_TRUNC);
-#endif
-#ifdef MSG_CTRUNC
- sock_define_const("MSG_CTRUNC", MSG_CTRUNC);
-#endif
-#ifdef MSG_WAITALL
- sock_define_const("MSG_WAITALL", MSG_WAITALL);
-#endif
-#ifdef MSG_DONTWAIT
- sock_define_const("MSG_DONTWAIT", MSG_DONTWAIT);
-#endif
-#ifdef MSG_EOF
- sock_define_const("MSG_EOF", MSG_EOF);
-#endif
-#ifdef MSG_FLUSH
- sock_define_const("MSG_FLUSH", MSG_FLUSH);
-#endif
-#ifdef MSG_HOLD
- sock_define_const("MSG_HOLD", MSG_HOLD);
-#endif
-#ifdef MSG_SEND
- sock_define_const("MSG_SEND", MSG_SEND);
-#endif
-#ifdef MSG_HAVEMORE
- sock_define_const("MSG_HAVEMORE", MSG_HAVEMORE);
-#endif
-#ifdef MSG_RCVMORE
- sock_define_const("MSG_RCVMORE", MSG_RCVMORE);
-#endif
-#ifdef MSG_COMPAT
- sock_define_const("MSG_COMPAT", MSG_COMPAT);
-#endif
sock_define_const("SOL_SOCKET", SOL_SOCKET);
#ifdef SOL_IP
@@ -4424,9 +2796,6 @@ Init_socket()
sock_define_const("SO_DEBUG", SO_DEBUG);
#endif
sock_define_const("SO_REUSEADDR", SO_REUSEADDR);
-#ifdef SO_REUSEPORT
- sock_define_const("SO_REUSEPORT", SO_REUSEPORT);
-#endif
#ifdef SO_TYPE
sock_define_const("SO_TYPE", SO_TYPE);
#endif
@@ -4478,33 +2847,6 @@ Init_socket()
#ifdef SO_SNDTIMEO
sock_define_const("SO_SNDTIMEO", SO_SNDTIMEO);
#endif
-#ifdef SO_ACCEPTCONN
- sock_define_const("SO_ACCEPTCONN", SO_ACCEPTCONN);
-#endif
-#ifdef SO_USELOOPBACK
- sock_define_const("SO_USELOOPBACK", SO_USELOOPBACK);
-#endif
-#ifdef SO_ACCEPTFILTER
- sock_define_const("SO_ACCEPTFILTER", SO_ACCEPTFILTER);
-#endif
-#ifdef SO_DONTTRUNC
- sock_define_const("SO_DONTTRUNC", SO_DONTTRUNC);
-#endif
-#ifdef SO_WANTMORE
- sock_define_const("SO_WANTMORE", SO_WANTMORE);
-#endif
-#ifdef SO_WANTOOBFLAG
- sock_define_const("SO_WANTOOBFLAG", SO_WANTOOBFLAG);
-#endif
-#ifdef SO_NREAD
- sock_define_const("SO_NREAD", SO_NREAD);
-#endif
-#ifdef SO_NKE
- sock_define_const("SO_NKE", SO_NKE);
-#endif
-#ifdef SO_NOSIGPIPE
- sock_define_const("SO_NOSIGPIPE", SO_NOSIGPIPE);
-#endif
#ifdef SO_SECURITY_AUTHENTICATION
sock_define_const("SO_SECURITY_AUTHENTICATION", SO_SECURITY_AUTHENTICATION);
diff --git a/ext/socket/sockport.h b/ext/socket/sockport.h
index 8c7bebf558..e1cddf53f4 100644
--- a/ext/socket/sockport.h
+++ b/ext/socket/sockport.h
@@ -2,8 +2,8 @@
sockport.h -
- $Author: eban $
- $Date: 2000/08/24 06:29:30 $
+ $Author$
+ $Date$
created at: Fri Apr 30 23:19:34 JST 1999
************************************************/
diff --git a/ext/stringio/README b/ext/stringio/README
index 190052309c..c4031f7e97 100644
--- a/ext/stringio/README
+++ b/ext/stringio/README
@@ -1,6 +1,6 @@
-*- rd -*-
-$Author: nobu $
-$Date: 2002/02/19 13:16:24 $
+$Author$
+$Date$
=begin
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 09867009b5..8750262c11 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -2,8 +2,8 @@
stringio.c -
- $Author: nobu $
- $Date: 2005/08/13 09:36:12 $
+ $Author$
+ $Date$
$RoughId: stringio.c,v 1.13 2002/03/14 03:24:18 nobu Exp $
created at: Tue Feb 19 04:10:38 JST 2002
@@ -98,9 +98,9 @@ get_strio(self)
#define StringIO(obj) get_strio(obj)
-#define CLOSED(ptr) (!((ptr)->flags & FMODE_READWRITE))
-#define READABLE(ptr) ((ptr)->flags & FMODE_READABLE)
-#define WRITABLE(ptr) ((ptr)->flags & FMODE_WRITABLE)
+#define CLOSED(ptr) NIL_P((ptr)->string)
+#define READABLE(ptr) (!CLOSED(ptr) && ((ptr)->flags & FMODE_READABLE))
+#define WRITABLE(ptr) (!CLOSED(ptr) && ((ptr)->flags & FMODE_WRITABLE))
static struct StringIO*
readable(ptr)
@@ -187,13 +187,6 @@ strio_s_allocate(klass)
return Data_Wrap_Struct(klass, strio_mark, strio_free, 0);
}
-/*
- * call-seq: StringIO.open(string=""[, mode]) {|strio| ...}
- *
- * Equivalent to StringIO.new except that when it is called with a block, it
- * yields with the new instance and closes it, and returns the result which
- * returned from the block.
- */
static VALUE
strio_s_open(argc, argv, klass)
int argc;
@@ -205,11 +198,6 @@ strio_s_open(argc, argv, klass)
return rb_ensure(rb_yield, obj, strio_finalize, obj);
}
-/*
- * call-seq: StringIO.new(string=""[, mode])
- *
- * Creates new StringIO instance from with _string_ and _mode_.
- */
static VALUE
strio_initialize(argc, argv, self)
int argc;
@@ -268,9 +256,6 @@ strio_finalize(self)
return self;
}
-/*
- * Returns +false+. Just for compatibility to IO.
- */
static VALUE
strio_false(self)
VALUE self;
@@ -279,9 +264,6 @@ strio_false(self)
return Qfalse;
}
-/*
- * Returns +nil+. Just for compatibility to IO.
- */
static VALUE
strio_nil(self)
VALUE self;
@@ -290,9 +272,6 @@ strio_nil(self)
return Qnil;
}
-/*
- * Returns *strio* itself. Just for compatibility to IO.
- */
static VALUE
strio_self(self)
VALUE self;
@@ -301,9 +280,6 @@ strio_self(self)
return self;
}
-/*
- * Returns 0. Just for compatibility to IO.
- */
static VALUE
strio_0(self)
VALUE self;
@@ -312,9 +288,6 @@ strio_0(self)
return INT2FIX(0);
}
-/*
- * Returns the argument unchanged. Just for compatibility to IO.
- */
static VALUE
strio_first(self, arg)
VALUE self, arg;
@@ -323,9 +296,6 @@ strio_first(self, arg)
return arg;
}
-/*
- * Raises NotImplementedError.
- */
static VALUE
strio_unimpl(argc, argv, self)
int argc;
@@ -337,11 +307,6 @@ strio_unimpl(argc, argv, self)
return Qnil; /* not reached */
}
-/*
- * call-seq: strio.string -> string
- *
- * Returns underlying String object, the subject of IO.
- */
static VALUE
strio_get_string(self)
VALUE self;
@@ -349,12 +314,6 @@ strio_get_string(self)
return StringIO(self)->string;
}
-/*
- * call-seq:
- * strio.string = string -> string
- *
- * Changes underlying String object, the subject of IO.
- */
static VALUE
strio_set_string(self, string)
VALUE self, string;
@@ -363,20 +322,15 @@ strio_set_string(self, string)
if (!OBJ_TAINTED(self)) rb_secure(4);
ptr->flags &= ~FMODE_READWRITE;
- StringValue(string);
- ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
+ if (!NIL_P(string)) {
+ StringValue(string);
+ ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
+ }
ptr->pos = 0;
ptr->lineno = 0;
return ptr->string = string;
}
-/*
- * call-seq:
- * strio.close -> nil
- *
- * Closes strio. The *strio* is unavailable for any further data
- * operations; an +IOError+ is raised if such an attempt is made.
- */
static VALUE
strio_close(self)
VALUE self;
@@ -385,17 +339,11 @@ strio_close(self)
if (CLOSED(ptr)) {
rb_raise(rb_eIOError, "closed stream");
}
+ ptr->string = Qnil;
ptr->flags &= ~FMODE_READWRITE;
- return Qnil;
+ return self;
}
-/*
- * call-seq:
- * strio.close_read -> nil
- *
- * Closes the read end of a StringIO. Will raise an +IOError+ if the
- * *strio* is not readable.
- */
static VALUE
strio_close_read(self)
VALUE self;
@@ -404,17 +352,12 @@ strio_close_read(self)
if (!READABLE(ptr)) {
rb_raise(rb_eIOError, "closing non-duplex IO for reading");
}
- ptr->flags &= ~FMODE_READABLE;
- return Qnil;
+ if (!((ptr->flags &= ~FMODE_READABLE) & FMODE_READWRITE)) {
+ ptr->string = Qnil;
+ }
+ return self;
}
-/*
- * call-seq:
- * strio.close_write -> nil
- *
- * Closes the write end of a StringIO. Will raise an +IOError+ if the
- * *strio* is not writeable.
- */
static VALUE
strio_close_write(self)
VALUE self;
@@ -423,16 +366,12 @@ strio_close_write(self)
if (!WRITABLE(ptr)) {
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
- ptr->flags &= ~FMODE_WRITABLE;
- return Qnil;
+ if (!((ptr->flags &= ~FMODE_WRITABLE) & FMODE_READWRITE)) {
+ ptr->string = Qnil;
+ }
+ return self;
}
-/*
- * call-seq:
- * strio.closed? -> true or false
- *
- * Returns +true+ if *strio* is completely closed, +false+ otherwise.
- */
static VALUE
strio_closed(self)
VALUE self;
@@ -442,12 +381,6 @@ strio_closed(self)
return Qtrue;
}
-/*
- * call-seq:
- * strio.closed_read? -> true or false
- *
- * Returns +true+ if *strio* is not readable, +false+ otherwise.
- */
static VALUE
strio_closed_read(self)
VALUE self;
@@ -457,12 +390,6 @@ strio_closed_read(self)
return Qtrue;
}
-/*
- * call-seq:
- * strio.closed_write? -> true or false
- *
- * Returns +true+ if *strio* is not writable, +false+ otherwise.
- */
static VALUE
strio_closed_write(self)
VALUE self;
@@ -472,14 +399,6 @@ strio_closed_write(self)
return Qtrue;
}
-/*
- * call-seq:
- * strio.eof -> true or false
- * strio.eof? -> true or false
- *
- * Returns true if *strio* is at end of file. The stringio must be
- * opened for reading or an +IOError+ will be raised.
- */
static VALUE
strio_eof(self)
VALUE self;
@@ -489,7 +408,6 @@ strio_eof(self)
return Qtrue;
}
-/* :nodoc: */
static VALUE
strio_copy(copy, orig)
VALUE copy, orig;
@@ -508,16 +426,6 @@ strio_copy(copy, orig)
return copy;
}
-/*
- * call-seq:
- * strio.lineno -> integer
- *
- * Returns the current line number in *strio*. The stringio must be
- * opened for reading. +lineno+ counts the number of times +gets+ is
- * called, rather than the number of newlines encountered. The two
- * values will differ if +gets+ is called with a separator other than
- * newline. See also the <code>$.</code> variable.
- */
static VALUE
strio_get_lineno(self)
VALUE self;
@@ -525,13 +433,6 @@ strio_get_lineno(self)
return LONG2NUM(StringIO(self)->lineno);
}
-/*
- * call-seq:
- * strio.lineno = integer -> integer
- *
- * Manually sets the current line number to the given value.
- * <code>$.</code> is updated only on the next read.
- */
static VALUE
strio_set_lineno(self, lineno)
VALUE self, lineno;
@@ -540,26 +441,14 @@ strio_set_lineno(self, lineno)
return lineno;
}
-/* call-seq: strio.binmode -> true */
#define strio_binmode strio_self
-/* call-seq: strio.fcntl */
#define strio_fcntl strio_unimpl
-/* call-seq: strio.flush -> strio */
#define strio_flush strio_self
-/* call-seq: strio.fsync -> 0 */
#define strio_fsync strio_0
-/*
- * call-seq:
- * strio.reopen(other_StrIO) -> strio
- * strio.reopen(string, mode) -> strio
- *
- * Reinitializes *strio* with the given <i>other_StrIO</i> or _string_
- * and _mode_ (see StringIO#new).
- */
static VALUE
strio_reopen(argc, argv, self)
int argc;
@@ -573,13 +462,6 @@ strio_reopen(argc, argv, self)
return strio_initialize(argc, argv, self);
}
-/*
- * call-seq:
- * strio.pos -> integer
- * strio.tell -> integer
- *
- * Returns the current offset (in bytes) of *strio*.
- */
static VALUE
strio_get_pos(self)
VALUE self;
@@ -587,12 +469,6 @@ strio_get_pos(self)
return LONG2NUM(StringIO(self)->pos);
}
-/*
- * call-seq:
- * strio.pos = integer -> integer
- *
- * Seeks to the given position (in bytes) in *strio*.
- */
static VALUE
strio_set_pos(self, pos)
VALUE self;
@@ -604,17 +480,9 @@ strio_set_pos(self, pos)
error_inval(0);
}
ptr->pos = p;
- ptr->flags &= ~STRIO_EOF;
return pos;
}
-/*
- * call-seq:
- * strio.rewind -> 0
- *
- * Positions *strio* to the beginning of input, resetting
- * +lineno+ to zero.
- */
static VALUE
strio_rewind(self)
VALUE self;
@@ -626,13 +494,6 @@ strio_rewind(self)
return INT2FIX(0);
}
-/*
- * call-seq:
- * strio.seek(amount, whence=SEEK_SET) -> 0
- *
- * Seeks to a given offset _amount_ in the stream according to
- * the value of _whence_ (see IO#seek).
- */
static VALUE
strio_seek(argc, argv, self)
int argc;
@@ -665,12 +526,6 @@ strio_seek(argc, argv, self)
return INT2FIX(0);
}
-/*
- * call-seq:
- * strio.sync -> true
- *
- * Returns +true+ always.
- */
static VALUE
strio_get_sync(self)
VALUE self;
@@ -679,17 +534,10 @@ strio_get_sync(self)
return Qtrue;
}
-/* call-seq: strio.sync = boolean -> boolean */
#define strio_set_sync strio_first
#define strio_tell strio_get_pos
-/*
- * call-seq:
- * strio.each_byte {|byte| block } -> strio
- *
- * See IO#each_byte.
- */
static VALUE
strio_each_byte(self)
VALUE self;
@@ -702,12 +550,6 @@ strio_each_byte(self)
return Qnil;
}
-/*
- * call-seq:
- * strio.getc -> fixnum or nil
- *
- * See IO#getc.
- */
static VALUE
strio_getc(self)
VALUE self;
@@ -722,35 +564,6 @@ strio_getc(self)
return CHR2FIX(c);
}
-static void
-strio_extend(ptr, pos, len)
- struct StringIO *ptr;
- long pos, len;
-{
- long olen;
-
- check_modifiable(ptr);
- olen = RSTRING(ptr->string)->len;
- if (pos + len > olen) {
- rb_str_resize(ptr->string, pos + len);
- if (pos > olen)
- MEMZERO(RSTRING(ptr->string)->ptr + olen, char, pos - olen);
- }
- else {
- rb_str_modify(ptr->string);
- }
-}
-
-/*
- * call-seq:
- * strio.ungetc(integer) -> nil
- *
- * Pushes back one character (passed as a parameter) onto *strio*
- * such that a subsequent buffered read will return it. Pushing back
- * behind the beginning of the buffer string is not possible. Nothing
- * will be done if such an attempt is made.
- * In other case, there is no limitation for multiple pushbacks.
- */
static VALUE
strio_ungetc(self, ch)
VALUE self, ch;
@@ -760,11 +573,18 @@ strio_ungetc(self, ch)
long len, pos = ptr->pos;
if (cc != EOF && pos > 0) {
- if ((len = RSTRING(ptr->string)->len) < pos-- ||
- (unsigned char)RSTRING(ptr->string)->ptr[pos] !=
+ if ((len = RSTRING(ptr->string)->len) < pos ||
+ (unsigned char)RSTRING(ptr->string)->ptr[pos - 1] !=
(unsigned char)cc) {
- strio_extend(ptr, pos, 1);
- RSTRING(ptr->string)->ptr[pos] = cc;
+ check_modifiable(ptr);
+ if (len < pos) {
+ rb_str_resize(ptr->string, pos);
+ MEMZERO(RSTRING(ptr->string)->ptr + len, char, pos - len - 1);
+ }
+ else {
+ rb_str_modify(ptr->string);
+ }
+ RSTRING(ptr->string)->ptr[pos - 1] = cc;
OBJ_INFECT(ptr->string, self);
}
--ptr->pos;
@@ -773,12 +593,6 @@ strio_ungetc(self, ch)
return Qnil;
}
-/*
- * call-seq:
- * strio.readchar -> fixnum
- *
- * See IO#readchar.
- */
static VALUE
strio_readchar(self)
VALUE self;
@@ -865,7 +679,8 @@ strio_getline(argc, argv, ptr)
}
}
s = p;
- while ((p = memchr(p, '\n', e - p)) && (p != e)) {
+ while (p = memchr(p, '\n', e - p)) {
+ if (p == e) break;
if (*++p == '\n') {
e = p;
break;
@@ -874,7 +689,7 @@ strio_getline(argc, argv, ptr)
str = rb_str_substr(ptr->string, s - RSTRING(ptr->string)->ptr, e - s);
}
else if (n == 1) {
- if ((p = memchr(s, RSTRING(str)->ptr[0], e - s)) != 0) {
+ if (p = memchr(s, RSTRING(str)->ptr[0], e - s)) {
e = p + 1;
}
str = rb_str_substr(ptr->string, ptr->pos, e - s);
@@ -905,12 +720,6 @@ strio_getline(argc, argv, ptr)
return str;
}
-/*
- * call-seq:
- * strio.gets(sep_string=$/) -> string or nil
- *
- * See IO#gets.
- */
static VALUE
strio_gets(argc, argv, self)
int argc;
@@ -923,12 +732,6 @@ strio_gets(argc, argv, self)
return str;
}
-/*
- * call-seq:
- * strio.readline(sep_string=$/) -> string
- *
- * See IO#readline.
- */
static VALUE
strio_readline(argc, argv, self)
int argc;
@@ -940,13 +743,6 @@ strio_readline(argc, argv, self)
return line;
}
-/*
- * call-seq:
- * strio.each(sep_string=$/) {|line| block } -> strio
- * strio.each_line(sep_string=$/) {|line| block } -> strio
- *
- * See IO#each.
- */
static VALUE
strio_each(argc, argv, self)
int argc;
@@ -962,12 +758,6 @@ strio_each(argc, argv, self)
return self;
}
-/*
- * call-seq:
- * strio.readlines(sep_string=$/) -> array
- *
- * See IO#readlines.
- */
static VALUE
strio_readlines(argc, argv, self)
int argc;
@@ -982,16 +772,6 @@ strio_readlines(argc, argv, self)
return ary;
}
-/*
- * call-seq:
- * strio.write(string) -> integer
- * strio.syswrite(string) -> integer
- *
- * Appends the given string to the underlying buffer string of *strio*.
- * The stream must be opened for writing. If the argument is not a
- * string, it will be converted to a string using <code>to_s</code>.
- * Returns the number of bytes written. See IO#write.
- */
static VALUE
strio_write(self, str)
VALUE self, str;
@@ -1012,7 +792,13 @@ strio_write(self, str)
rb_str_cat(ptr->string, RSTRING(str)->ptr, len);
}
else {
- strio_extend(ptr, ptr->pos, len);
+ if (ptr->pos + len > olen) {
+ rb_str_resize(ptr->string, ptr->pos + len);
+ MEMZERO(RSTRING(ptr->string)->ptr + olen, char, ptr->pos + len - olen);
+ }
+ else {
+ rb_str_modify(ptr->string);
+ }
rb_str_update(ptr->string, ptr->pos, len, str);
}
OBJ_INFECT(ptr->string, self);
@@ -1020,70 +806,36 @@ strio_write(self, str)
return LONG2NUM(len);
}
-/*
- * call-seq:
- * strio << obj -> strio
- *
- * See IO#<<.
- */
#define strio_addstr rb_io_addstr
-/*
- * call-seq:
- * strio.print() -> nil
- * strio.print(obj, ...) -> nil
- *
- * See IO#print.
- */
#define strio_print rb_io_print
-/*
- * call-seq:
- * strio.printf(format_string [, obj, ...] ) -> nil
- *
- * See IO#printf.
- */
#define strio_printf rb_io_printf
-/*
- * call-seq:
- * strio.putc(obj) -> obj
- *
- * See IO#putc.
- */
static VALUE
strio_putc(self, ch)
VALUE self, ch;
{
struct StringIO *ptr = writable(StringIO(self));
int c = NUM2CHR(ch);
- long olen;
check_modifiable(ptr);
- olen = RSTRING(ptr->string)->len;
if (ptr->flags & FMODE_APPEND) {
- ptr->pos = olen;
+ ptr->pos = RSTRING(ptr->string)->len;
+ }
+ if (ptr->pos >= RSTRING(ptr->string)->len) {
+ rb_str_resize(ptr->string, ptr->pos + 1);
+ }
+ else {
+ rb_str_modify(ptr->string);
}
- strio_extend(ptr, ptr->pos, 1);
RSTRING(ptr->string)->ptr[ptr->pos++] = c;
OBJ_INFECT(ptr->string, self);
return ch;
}
-/*
- * call-seq:
- * strio.puts(obj, ...) -> nil
- *
- * See IO#puts.
- */
#define strio_puts rb_io_puts
-/*
- * call-seq:
- * strio.read([length [, buffer]]) -> string, buffer, or nil
- *
- * See IO#read.
- */
static VALUE
strio_read(argc, argv, self)
int argc;
@@ -1157,13 +909,6 @@ strio_read(argc, argv, self)
return str;
}
-/*
- * call-seq:
- * strio.sysread(integer[, outbuf]) -> string
- *
- * Similar to #read, but raises +EOFError+ at end of string instead of
- * returning +nil+, as well as IO#sysread does.
- */
static VALUE
strio_sysread(argc, argv, self)
int argc;
@@ -1179,29 +924,14 @@ strio_sysread(argc, argv, self)
#define strio_syswrite strio_write
-/* call-seq: strio.path -> nil */
#define strio_path strio_nil
-/*
- * call-seq:
- * strio.isatty -> nil
- * strio.tty? -> nil
- *
- */
#define strio_isatty strio_false
-/* call-seq: strio.pid -> nil */
#define strio_pid strio_nil
-/* call-seq: strio.fileno -> nil */
#define strio_fileno strio_nil
-/*
- * call-seq:
- * strio.size -> integer
- *
- * Returns the size of the buffer string.
- */
static VALUE
strio_size(self)
VALUE self;
@@ -1213,33 +943,19 @@ strio_size(self)
return ULONG2NUM(RSTRING(string)->len);
}
-/*
- * call-seq:
- * strio.truncate(integer) -> 0
- *
- * Truncates the buffer string to at most _integer_ bytes. The *strio*
- * must be opened for writing.
- */
static VALUE
strio_truncate(self, len)
VALUE self, len;
{
VALUE string = writable(StringIO(self))->string;
long l = NUM2LONG(len);
- long plen = RSTRING(string)->len;
if (l < 0) {
error_inval("negative legnth");
}
rb_str_resize(string, l);
- if (plen < l) {
- MEMZERO(RSTRING(string)->ptr + plen, char, l - plen);
- }
return len;
}
-/*
- * Pseudo I/O on String object.
- */
void
Init_stringio()
{
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 5e5ab5db1f..227ed92305 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -1,15 +1,26 @@
/*
- $Id: strscan.c,v 1.7.2.8 2006/07/26 09:37:00 aamine Exp $
- Copyright (c) 1999-2006 Minero Aoki
+ strscan.c
+
+ Copyright (c) 1999-2004 Minero Aoki
This program is free software.
You can distribute/modify this program under the terms of
the Ruby License. For details, see the file COPYING.
+
+ $Id$
+
*/
+
#include "ruby.h"
#include "re.h"
+#include "version.h"
+
+#if (RUBY_VERSION_CODE < 150)
+# define rb_eRangeError rb_eArgError
+# define rb_obj_freeze(obj) rb_str_freeze(obj)
+#endif
#define STRSCAN_VERSION "0.7.0"
@@ -62,12 +73,10 @@ static VALUE infect _((VALUE str, struct strscanner *p));
static VALUE extract_range _((struct strscanner *p, long beg_i, long end_i));
static VALUE extract_beg_len _((struct strscanner *p, long beg_i, long len));
-static void check_strscan _((VALUE obj));
static void strscan_mark _((struct strscanner *p));
static void strscan_free _((struct strscanner *p));
static VALUE strscan_s_allocate _((VALUE klass));
static VALUE strscan_initialize _((int argc, VALUE *argv, VALUE self));
-static VALUE strscan_init_copy _((VALUE vself, VALUE vorig));
static VALUE strscan_s_mustc _((VALUE self));
static VALUE strscan_terminate _((VALUE self));
@@ -119,14 +128,18 @@ static VALUE inspect2 _((struct strscanner *p));
======================================================================= */
static VALUE
-infect(VALUE str, struct strscanner *p)
+infect(str, p)
+ VALUE str;
+ struct strscanner *p;
{
OBJ_INFECT(str, p->str);
return str;
}
static VALUE
-extract_range(struct strscanner *p, long beg_i, long end_i)
+extract_range(p, beg_i, end_i)
+ struct strscanner *p;
+ long beg_i, end_i;
{
if (beg_i > S_LEN(p)) return Qnil;
if (end_i > S_LEN(p))
@@ -135,7 +148,9 @@ extract_range(struct strscanner *p, long beg_i, long end_i)
}
static VALUE
-extract_beg_len(struct strscanner *p, long beg_i, long len)
+extract_beg_len(p, beg_i, len)
+ struct strscanner *p;
+ long beg_i, len;
{
if (beg_i > S_LEN(p)) return Qnil;
if (beg_i + len > S_LEN(p))
@@ -143,25 +158,31 @@ extract_beg_len(struct strscanner *p, long beg_i, long len)
return infect(rb_str_new(S_PBEG(p) + beg_i, len), p);
}
+
/* =======================================================================
Constructor
======================================================================= */
+
static void
-strscan_mark(struct strscanner *p)
+strscan_mark(p)
+ struct strscanner *p;
{
rb_gc_mark(p->str);
}
static void
-strscan_free(struct strscanner *p)
+strscan_free(p)
+ struct strscanner *p;
{
re_free_registers(&(p->regs));
+ memset(p, sizeof(struct strscanner), 0);
free(p);
}
static VALUE
-strscan_s_allocate(VALUE klass)
+strscan_s_allocate(klass)
+ VALUE klass;
{
struct strscanner *p;
@@ -180,7 +201,10 @@ strscan_s_allocate(VALUE klass)
* +dup+ argument is obsolete and not used now.
*/
static VALUE
-strscan_initialize(int argc, VALUE *argv, VALUE self)
+strscan_initialize(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
struct strscanner *p;
VALUE str, need_dup;
@@ -193,40 +217,6 @@ strscan_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-static void
-check_strscan(VALUE obj)
-{
- if (TYPE(obj) != T_DATA || RDATA(obj)->dmark != (RUBY_DATA_FUNC)strscan_mark) {
- rb_raise(rb_eTypeError,
- "wrong argument type %s (expected StringScanner)",
- rb_obj_classname(obj));
- }
-}
-
-/*
- * call-seq:
- * dup
- * clone
- *
- * Duplicates a StringScanner object.
- */
-static VALUE
-strscan_init_copy(VALUE vself, VALUE vorig)
-{
- struct strscanner *self, *orig;
-
- Data_Get_Struct(vself, struct strscanner, self);
- check_strscan(vorig);
- Data_Get_Struct(vorig, struct strscanner, orig);
- if (self != orig) {
- self->flags = orig->flags;
- self->str = orig->str;
- self->prev = orig->prev;
- self->curr = orig->curr;
- re_copy_registers(&self->regs, &orig->regs);
- }
- return vself;
-}
/* =======================================================================
Instance Methods
@@ -238,7 +228,8 @@ strscan_init_copy(VALUE vself, VALUE vorig)
* This method is defined for backward compatibility.
*/
static VALUE
-strscan_s_mustc(VALUE self)
+strscan_s_mustc(self)
+ VALUE self;
{
return self;
}
@@ -247,7 +238,8 @@ strscan_s_mustc(VALUE self)
* Reset the scan pointer (index 0) and clear matching data.
*/
static VALUE
-strscan_reset(VALUE self)
+strscan_reset(self)
+ VALUE self;
{
struct strscanner *p;
@@ -265,7 +257,8 @@ strscan_reset(VALUE self)
* Set the scan pointer to the end of the string and clear matching data.
*/
static VALUE
-strscan_terminate(VALUE self)
+strscan_terminate(self)
+ VALUE self;
{
struct strscanner *p;
@@ -276,21 +269,19 @@ strscan_terminate(VALUE self)
}
/*
- * Equivalent to #terminate.
- * This method is obsolete; use #terminate instead.
+ * Returns the string being scanned.
*/
static VALUE
-strscan_clear(VALUE self)
+strscan_clear(self)
+ VALUE self;
{
rb_warning("StringScanner#clear is obsolete; use #terminate instead");
return strscan_terminate(self);
}
-/*
- * Returns the string being scanned.
- */
static VALUE
-strscan_get_string(VALUE self)
+strscan_get_string(self)
+ VALUE self;
{
struct strscanner *p;
@@ -305,7 +296,8 @@ strscan_get_string(VALUE self)
* Returns +str+.
*/
static VALUE
-strscan_set_string(VALUE self, VALUE str)
+strscan_set_string(self, str)
+ VALUE self, str;
{
struct strscanner *p;
@@ -333,7 +325,8 @@ strscan_set_string(VALUE self, VALUE str)
* s.scan(/Dec/) # -> "Dec"
*/
static VALUE
-strscan_concat(VALUE self, VALUE str)
+strscan_concat(self, str)
+ VALUE self, str;
{
struct strscanner *p;
@@ -348,7 +341,7 @@ strscan_concat(VALUE self, VALUE str)
* value is zero. In the 'terminated' position (i.e. the string is exhausted),
* this value is the length of the string.
*
- * In short, it's a 0-based index into the string.
+ * In short, it's a 1-based index into the string.
*
* s = StringScanner.new('test string')
* s.pos # -> 0
@@ -358,7 +351,8 @@ strscan_concat(VALUE self, VALUE str)
* s.pos # -> 11
*/
static VALUE
-strscan_get_pos(VALUE self)
+strscan_get_pos(self)
+ VALUE self;
{
struct strscanner *p;
@@ -376,7 +370,8 @@ strscan_get_pos(VALUE self)
* s.rest # -> "ring"
*/
static VALUE
-strscan_set_pos(VALUE self, VALUE v)
+strscan_set_pos(self, v)
+ VALUE self, v;
{
struct strscanner *p;
long i;
@@ -390,8 +385,14 @@ strscan_set_pos(VALUE self, VALUE v)
return INT2NUM(i);
}
+
+/* I should implement this function? */
+#define strscan_prepare_re(re) /* none */
+
static VALUE
-strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
+strscan_do_scan(self, regex, succptr, getstr, headonly)
+ VALUE self, regex;
+ int succptr, getstr, headonly;
{
struct strscanner *p;
int ret;
@@ -400,9 +401,10 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
GET_SCANNER(self, p);
CLEAR_MATCH_STATUS(p);
- if (S_RESTLEN(p) < 0) {
+ if (EOS_P(p)) {
return Qnil;
}
+ strscan_prepare_re(regex);
if (headonly) {
ret = re_match(RREGEXP(regex)->ptr,
CURPTR(p), S_RESTLEN(p),
@@ -437,7 +439,13 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
}
/*
- * call-seq: scan(pattern) => String
+ * call-seq:
+ * scanner.scan(pattern) => String
+ *
+ */
+
+/*
+ * call-seq: scan(pattern)
*
* Tries to match with +pattern+ at the current position. If there's a match,
* the scanner advances the "scan pointer" and returns the matched string.
@@ -452,7 +460,8 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
*
*/
static VALUE
-strscan_scan(VALUE self, VALUE re)
+strscan_scan(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 1, 1, 1);
}
@@ -469,7 +478,8 @@ strscan_scan(VALUE self, VALUE re)
* p s.match?(/\s+/) # -> nil
*/
static VALUE
-strscan_match_p(VALUE self, VALUE re)
+strscan_match_p(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 0, 0, 1);
}
@@ -492,7 +502,8 @@ strscan_match_p(VALUE self, VALUE re)
*
*/
static VALUE
-strscan_skip(VALUE self, VALUE re)
+strscan_skip(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 1, 0, 1);
}
@@ -513,7 +524,8 @@ strscan_skip(VALUE self, VALUE re)
* Mnemonic: it "checks" to see whether a #scan will return a value.
*/
static VALUE
-strscan_check(VALUE self, VALUE re)
+strscan_check(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 0, 1, 1);
}
@@ -529,7 +541,8 @@ strscan_check(VALUE self, VALUE re)
* "full" means "#scan with full parameters".
*/
static VALUE
-strscan_scan_full(VALUE self, VALUE re, VALUE s, VALUE f)
+strscan_scan_full(self, re, s, f)
+ VALUE self, re, s, f;
{
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1);
}
@@ -548,7 +561,8 @@ strscan_scan_full(VALUE self, VALUE re, VALUE s, VALUE f)
* s.scan_until(/XYZ/) # -> nil
*/
static VALUE
-strscan_scan_until(VALUE self, VALUE re)
+strscan_scan_until(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 1, 1, 0);
}
@@ -567,7 +581,8 @@ strscan_scan_until(VALUE self, VALUE re)
* s.exist? /e/ # -> nil
*/
static VALUE
-strscan_exist_p(VALUE self, VALUE re)
+strscan_exist_p(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 0, 0, 0);
}
@@ -589,7 +604,8 @@ strscan_exist_p(VALUE self, VALUE re)
* s #
*/
static VALUE
-strscan_skip_until(VALUE self, VALUE re)
+strscan_skip_until(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 1, 0, 0);
}
@@ -608,7 +624,8 @@ strscan_skip_until(VALUE self, VALUE re)
* Mnemonic: it "checks" to see whether a #scan_until will return a value.
*/
static VALUE
-strscan_check_until(VALUE self, VALUE re)
+strscan_check_until(self, re)
+ VALUE self, re;
{
return strscan_do_scan(self, re, 0, 1, 0);
}
@@ -623,14 +640,16 @@ strscan_check_until(VALUE self, VALUE re)
* This method does affect the match register.
*/
static VALUE
-strscan_search_full(VALUE self, VALUE re, VALUE s, VALUE f)
+strscan_search_full(self, re, s, f)
+ VALUE self, re, s, f;
{
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 0);
}
/* DANGEROUS; need to synchronize with regex.c */
static void
-adjust_registers_to_matched(struct strscanner *p)
+adjust_registers_to_matched(p)
+ struct strscanner *p;
{
if (p->regs.allocated == 0) {
p->regs.beg = ALLOC_N(int, RE_NREGS);
@@ -644,21 +663,15 @@ adjust_registers_to_matched(struct strscanner *p)
/*
* Scans one character and returns it.
- * This method is multi-byte character sensitive.
- * See also #get_byte.
*
* s = StringScanner.new('ab')
* s.getch # => "a"
* s.getch # => "b"
* s.getch # => nil
- *
- * $KCODE = 'EUC'
- * s = StringScanner.new("\244\242")
- * s.getch # => "\244\242" # Japanese hira-kana "A" in EUC-JP
- * s.getch # => nil
*/
static VALUE
-strscan_getch(VALUE self)
+strscan_getch(self)
+ VALUE self;
{
struct strscanner *p;
long len;
@@ -667,10 +680,10 @@ strscan_getch(VALUE self)
CLEAR_MATCH_STATUS(p);
if (EOS_P(p))
return Qnil;
+
len = mbclen(*CURPTR(p));
- if (p->curr + len > S_LEN(p)) {
+ if (p->curr + len > S_LEN(p))
len = S_LEN(p) - p->curr;
- }
p->prev = p->curr;
p->curr += len;
MATCHED(p);
@@ -680,30 +693,24 @@ strscan_getch(VALUE self)
}
/*
- * Scans one byte and returns it.
- * This method is NOT multi-byte character sensitive.
- * See also #getch.
+ * Scans one byte and returns it. Similar to, but not the same as, #getch.
*
- * s = StringScanner.new('ab')
- * s.get_byte # => "a"
- * s.get_byte # => "b"
- * s.get_byte # => nil
- *
- * s = StringScanner.new("\244\242")
- * s.get_byte # => "\244"
- * s.get_byte # => "\242"
- * s.get_byte # => nil
+ * s = StringScanner.new('ab')
+ * s.get_byte # => "a"
+ * s.get_byte # => "b"
+ * s.get_byte # => nil
*/
static VALUE
-strscan_get_byte(VALUE self)
+strscan_get_byte(self)
+ VALUE self;
{
struct strscanner *p;
GET_SCANNER(self, p);
CLEAR_MATCH_STATUS(p);
- if (EOS_P(p)) {
+ if (EOS_P(p))
return Qnil;
- }
+
p->prev = p->curr;
p->curr++;
MATCHED(p);
@@ -712,12 +719,9 @@ strscan_get_byte(VALUE self)
p->prev + p->regs.end[0]);
}
-/*
- * Equivalent to #get_byte.
- * This method is obsolete; use #get_byte instead.
- */
static VALUE
-strscan_getbyte(VALUE self)
+strscan_getbyte(self)
+ VALUE self;
{
rb_warning("StringScanner#getbyte is obsolete; use #get_byte instead");
return strscan_get_byte(self);
@@ -735,34 +739,24 @@ strscan_getbyte(VALUE self)
*
*/
static VALUE
-strscan_peek(VALUE self, VALUE vlen)
+strscan_peek(self, vlen)
+ VALUE self, vlen;
{
struct strscanner *p;
long len;
GET_SCANNER(self, p);
+
len = NUM2LONG(vlen);
- if (EOS_P(p)) {
+ if (EOS_P(p))
return infect(rb_str_new("", 0), p);
- }
- if (p->curr + len > S_LEN(p)) {
+
+ if (p->curr + len > S_LEN(p))
len = S_LEN(p) - p->curr;
- }
return extract_beg_len(p, p->curr, len);
}
/*
- * Equivalent to #peek.
- * This method is obsolete; use #peek instead.
- */
-static VALUE
-strscan_peep(VALUE self, VALUE vlen)
-{
- rb_warning("StringScanner#peep is obsolete; use #peek instead");
- return strscan_peek(self, vlen);
-}
-
-/*
* Set the scan pointer to the previous position. Only one previous position is
* remembered, and it changes with each scanning operation.
*
@@ -771,17 +765,26 @@ strscan_peep(VALUE self, VALUE vlen)
* s.unscan
* s.scan(/../) # => "te"
* s.scan(/\d/) # => nil
- * s.unscan # ScanError: unscan failed: previous match had failed
+ * s.unscan # ScanError: cannot unscan: prev match had failed
*/
static VALUE
-strscan_unscan(VALUE self)
+strscan_peep(self, vlen)
+ VALUE self, vlen;
+{
+ rb_warning("StringScanner#peep is obsolete; use #peek instead");
+ return strscan_peek(self, vlen);
+}
+
+static VALUE
+strscan_unscan(self)
+ VALUE self;
{
struct strscanner *p;
GET_SCANNER(self, p);
- if (! MATCHED_P(p)) {
- rb_raise(ScanError, "unscan failed: previous match had failed");
- }
+ if (! MATCHED_P(p))
+ rb_raise(ScanError, "cannot unscan: prev match had failed");
+
p->curr = p->prev;
CLEAR_MATCH_STATUS(p);
return self;
@@ -800,7 +803,8 @@ strscan_unscan(VALUE self)
* s.bol? # => true
*/
static VALUE
-strscan_bol_p(VALUE self)
+strscan_bol_p(self)
+ VALUE self;
{
struct strscanner *p;
@@ -821,12 +825,16 @@ strscan_bol_p(VALUE self)
* p s.eos? # => true
*/
static VALUE
-strscan_eos_p(VALUE self)
+strscan_eos_p(self)
+ VALUE self;
{
struct strscanner *p;
GET_SCANNER(self, p);
- return EOS_P(p) ? Qtrue : Qfalse;
+ if (EOS_P(p))
+ return Qtrue;
+ else
+ return Qfalse;
}
/*
@@ -834,7 +842,8 @@ strscan_eos_p(VALUE self)
* This method is obsolete, use #eos? instead.
*/
static VALUE
-strscan_empty_p(VALUE self)
+strscan_empty_p(self)
+ VALUE self;
{
rb_warning("StringScanner#empty? is obsolete; use #eos? instead");
return strscan_eos_p(self);
@@ -849,12 +858,16 @@ strscan_empty_p(VALUE self)
* s.rest? # are opposites.
*/
static VALUE
-strscan_rest_p(VALUE self)
+strscan_rest_p(self)
+ VALUE self;
{
struct strscanner *p;
GET_SCANNER(self, p);
- return EOS_P(p) ? Qfalse : Qtrue;
+ if (EOS_P(p))
+ return Qfalse;
+ else
+ return Qtrue;
}
/*
@@ -867,12 +880,16 @@ strscan_rest_p(VALUE self)
* s.matched? # => false
*/
static VALUE
-strscan_matched_p(VALUE self)
+strscan_matched_p(self)
+ VALUE self;
{
struct strscanner *p;
GET_SCANNER(self, p);
- return MATCHED_P(p) ? Qtrue : Qfalse;
+ if (MATCHED_P(p))
+ return Qtrue;
+ else
+ return Qfalse;
}
/*
@@ -883,7 +900,8 @@ strscan_matched_p(VALUE self)
* s.matched # -> "test"
*/
static VALUE
-strscan_matched(VALUE self)
+strscan_matched(self)
+ VALUE self;
{
struct strscanner *p;
@@ -905,7 +923,8 @@ strscan_matched(VALUE self)
* s.matched_size # -> nil
*/
static VALUE
-strscan_matched_size(VALUE self)
+strscan_matched_size(self)
+ VALUE self;
{
struct strscanner *p;
@@ -920,7 +939,8 @@ strscan_matched_size(VALUE self)
* This method is obsolete; use #matched_size instead.
*/
static VALUE
-strscan_matchedsize(VALUE self)
+strscan_matchedsize(self)
+ VALUE self;
{
rb_warning("StringScanner#matchedsize is obsolete; use #matched_size instead");
return strscan_matched_size(self);
@@ -941,7 +961,8 @@ strscan_matchedsize(VALUE self)
* s.pre_match # -> ""
*/
static VALUE
-strscan_aref(VALUE self, VALUE idx)
+strscan_aref(self, idx)
+ VALUE self, idx;
{
struct strscanner *p;
long i;
@@ -970,7 +991,8 @@ strscan_aref(VALUE self, VALUE idx)
* s.post_match # -> "string"
*/
static VALUE
-strscan_pre_match(VALUE self)
+strscan_pre_match(self)
+ VALUE self;
{
struct strscanner *p;
@@ -990,7 +1012,8 @@ strscan_pre_match(VALUE self)
* s.post_match # -> "string"
*/
static VALUE
-strscan_post_match(VALUE self)
+strscan_post_match(self)
+ VALUE self;
{
struct strscanner *p;
@@ -1005,7 +1028,8 @@ strscan_post_match(VALUE self)
* If there is no more data (eos? = true), it returns <tt>""</tt>.
*/
static VALUE
-strscan_rest(VALUE self)
+strscan_rest(self)
+ VALUE self;
{
struct strscanner *p;
@@ -1020,7 +1044,8 @@ strscan_rest(VALUE self)
* <tt>s.rest_size</tt> is equivalent to <tt>s.rest.size</tt>.
*/
static VALUE
-strscan_rest_size(VALUE self)
+strscan_rest_size(self)
+ VALUE self;
{
struct strscanner *p;
long i;
@@ -1039,7 +1064,8 @@ strscan_rest_size(VALUE self)
* This method is obsolete; use #rest_size instead.
*/
static VALUE
-strscan_restsize(VALUE self)
+strscan_restsize(self)
+ VALUE self;
{
rb_warning("StringScanner#restsize is obsolete; use #rest_size instead");
return strscan_rest_size(self);
@@ -1060,7 +1086,8 @@ strscan_restsize(VALUE self)
* s.inspect # -> '#<StringScanner 10/21 "...ec 12" @ " 1975...">'
*/
static VALUE
-strscan_inspect(VALUE self)
+strscan_inspect(self)
+ VALUE self;
{
struct strscanner *p;
char buf[BUFSIZE];
@@ -1097,7 +1124,8 @@ strscan_inspect(VALUE self)
}
static VALUE
-inspect1(struct strscanner *p)
+inspect1(p)
+ struct strscanner *p;
{
char buf[BUFSIZE];
char *bp = buf;
@@ -1116,7 +1144,8 @@ inspect1(struct strscanner *p)
}
static VALUE
-inspect2(struct strscanner *p)
+inspect2(p)
+ struct strscanner *p;
{
char buf[BUFSIZE];
char *bp = buf;
@@ -1195,7 +1224,7 @@ inspect2(struct strscanner *p)
* === Advancing the Scan Pointer
*
* - #getch
- * - #get_byte
+ * - #getbyte
* - #scan
* - #scan_until
* - #skip
@@ -1211,7 +1240,7 @@ inspect2(struct strscanner *p)
*
* === Finding Where we Are
*
- * - #beginning_of_line? (#bol?)
+ * - #bol?
* - #eos?
* - #rest?
* - #rest_size
@@ -1243,7 +1272,7 @@ inspect2(struct strscanner *p)
* There are aliases to several of the methods.
*/
void
-Init_strscan(void)
+Init_strscan()
{
ID id_scanerr = rb_intern("ScanError");
VALUE tmp;
@@ -1256,13 +1285,12 @@ Init_strscan(void)
tmp = rb_str_new2(STRSCAN_VERSION);
rb_obj_freeze(tmp);
rb_const_set(StringScanner, rb_intern("Version"), tmp);
- tmp = rb_str_new2("$Id: strscan.c,v 1.7.2.8 2006/07/26 09:37:00 aamine Exp $");
+ tmp = rb_str_new2("$Id$");
rb_obj_freeze(tmp);
rb_const_set(StringScanner, rb_intern("Id"), tmp);
rb_define_alloc_func(StringScanner, strscan_s_allocate);
rb_define_private_method(StringScanner, "initialize", strscan_initialize, -1);
- rb_define_private_method(StringScanner, "initialize_copy", strscan_init_copy, 1);
rb_define_singleton_method(StringScanner, "must_C_version", strscan_s_mustc, 0);
rb_define_method(StringScanner, "reset", strscan_reset, 0);
rb_define_method(StringScanner, "terminate", strscan_terminate, 0);
@@ -1297,7 +1325,7 @@ Init_strscan(void)
rb_define_method(StringScanner, "unscan", strscan_unscan, 0);
rb_define_method(StringScanner, "beginning_of_line?", strscan_bol_p, 0);
- rb_alias(StringScanner, rb_intern("bol?"), rb_intern("beginning_of_line?"));
+ rb_define_method(StringScanner, "bol?", strscan_bol_p, 0);
rb_define_method(StringScanner, "eos?", strscan_eos_p, 0);
rb_define_method(StringScanner, "empty?", strscan_empty_p, 0);
rb_define_method(StringScanner, "rest?", strscan_rest_p, 0);
diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c
index acda3b15a4..ae5f19d7da 100644
--- a/ext/syck/bytecode.c
+++ b/ext/syck/bytecode.c
@@ -1,10 +1,10 @@
-/* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */
+/* Generated by re2c 0.9.3 on Fri Aug 13 11:47:50 2004 */
#line 1 "bytecode.re"
/*
* bytecode.re
*
- * $Author: why $
- * $Date: 2005/09/20 06:46:43 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -89,7 +89,7 @@ char *get_inline( SyckParser *parser );
#define ENSURE_YAML_IOPEN(last_lvl, lvl_type, to_len, reset) \
if ( last_lvl->spaces < to_len ) \
{ \
- if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \
+ if ( last_lvl->status == syck_lvl_inline ) \
{ \
goto Document; \
} \
@@ -135,6 +135,7 @@ int
sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
{
SyckLevel *lvl;
+ int doc_level = 0;
syck_parser_ptr = parser;
if ( YYCURSOR == NULL )
{
@@ -148,7 +149,7 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
return t;
}
-#line 172 "bytecode.re"
+#line 173 "bytecode.re"
lvl = CURRENT_LEVEL();
@@ -157,22 +158,22 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
goto Document;
}
-/* Header: */
+Header:
YYTOKEN = YYCURSOR;
-#line 165 "<stdout>"
+#line 7 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
- ++YYCURSOR;
+yy1: ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy2;
+ case '\000': goto yy2;
case 'D': goto yy3;
default: goto yy5;
}
@@ -183,22 +184,22 @@ yy2: YYCURSOR = YYMARKER;
yy3: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x0A: goto yy6;
- case 0x0D: goto yy8;
+ case '\n': goto yy6;
+ case '\r': goto yy8;
default: goto yy4;
}
yy4:
-#line 199 "bytecode.re"
+#line 200 "bytecode.re"
{ YYPOS(0);
goto Document;
}
-#line 195 "<stdout>"
+#line 37 "<stdout>"
yy5: yych = *++YYCURSOR;
goto yy4;
yy6: ++YYCURSOR;
goto yy7;
yy7:
-#line 186 "bytecode.re"
+#line 187 "bytecode.re"
{ if ( lvl->status == syck_lvl_header )
{
CHK_NL(YYCURSOR);
@@ -211,14 +212,14 @@ yy7:
return 0;
}
}
-#line 214 "<stdout>"
+#line 56 "<stdout>"
yy8: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy6;
+ case '\n': goto yy6;
default: goto yy2;
}
}
-#line 203 "bytecode.re"
+#line 204 "bytecode.re"
Document:
@@ -232,18 +233,19 @@ Document:
YYTOKEN = YYCURSOR;
-#line 235 "<stdout>"
+#line 65 "<stdout>"
{
YYCTYPE yych;
+ unsigned int yyaccept;
goto yy9;
- ++YYCURSOR;
+yy10: ++YYCURSOR;
yy9:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy30;
- case 0x0A: goto yy27;
- case 0x0D: goto yy29;
+ case '\000': goto yy30;
+ case '\n': goto yy27;
+ case '\r': goto yy29;
case 'A': goto yy19;
case 'D': goto yy12;
case 'E': goto yy16;
@@ -258,68 +260,68 @@ yy9:
}
yy11:yy12: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy41;
- case 0x0D: goto yy44;
+ case '\n': goto yy41;
+ case '\r': goto yy44;
default: goto yy11;
}
yy13: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy41;
- case 0x0D: goto yy43;
+ case '\n': goto yy41;
+ case '\r': goto yy43;
default: goto yy11;
}
yy14: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy38;
- case 0x0D: goto yy40;
+ case '\n': goto yy38;
+ case '\r': goto yy40;
default: goto yy11;
}
yy15: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy35;
- case 0x0D: goto yy37;
+ case '\n': goto yy35;
+ case '\r': goto yy37;
default: goto yy11;
}
yy16: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy32;
- case 0x0D: goto yy34;
+ case '\n': goto yy32;
+ case '\r': goto yy34;
default: goto yy11;
}
yy17: ++YYCURSOR;
goto yy18;
yy18:
-#line 288 "bytecode.re"
+#line 289 "bytecode.re"
{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
goto Scalar;
}
-#line 296 "<stdout>"
+#line 127 "<stdout>"
yy19: ++YYCURSOR;
goto yy20;
yy20:
-#line 292 "bytecode.re"
+#line 293 "bytecode.re"
{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
sycklval->name = get_inline( parser );
syck_hdlr_remove_anchor( parser, sycklval->name );
CHK_NL(YYCURSOR);
return YAML_ANCHOR;
}
-#line 307 "<stdout>"
+#line 138 "<stdout>"
yy21: ++YYCURSOR;
goto yy22;
yy22:
-#line 299 "bytecode.re"
+#line 300 "bytecode.re"
{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
sycklval->name = get_inline( parser );
POP_LEVEL();
if ( *( YYCURSOR - 1 ) == '\n' ) YYCURSOR--;
return YAML_ALIAS;
}
-#line 318 "<stdout>"
+#line 149 "<stdout>"
yy23: ++YYCURSOR;
goto yy24;
yy24:
-#line 306 "bytecode.re"
+#line 307 "bytecode.re"
{ char *qstr;
ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
qstr = get_inline( parser );
@@ -379,17 +381,17 @@ yy24:
sycklval->name = qstr;
return YAML_TAGURI;
}
-#line 382 "<stdout>"
+#line 213 "<stdout>"
yy25: ++YYCURSOR;
goto yy26;
yy26:
-#line 366 "bytecode.re"
+#line 367 "bytecode.re"
{ goto Comment; }
-#line 388 "<stdout>"
+#line 219 "<stdout>"
yy27: ++YYCURSOR;
goto yy28;
yy28:
-#line 368 "bytecode.re"
+#line 369 "bytecode.re"
{ CHK_NL(YYCURSOR);
if ( lvl->status == syck_lvl_seq )
{
@@ -402,25 +404,25 @@ yy28:
}
goto Document;
}
-#line 405 "<stdout>"
+#line 236 "<stdout>"
yy29: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy27;
+ case '\n': goto yy27;
default: goto yy11;
}
yy30: ++YYCURSOR;
goto yy31;
yy31:
-#line 381 "bytecode.re"
+#line 382 "bytecode.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 419 "<stdout>"
+#line 250 "<stdout>"
yy32: ++YYCURSOR;
goto yy33;
yy33:
-#line 252 "bytecode.re"
+#line 253 "bytecode.re"
{ if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 )
{
lvl->ncount++;
@@ -456,16 +458,16 @@ yy33:
CHK_NL(YYCURSOR);
return YAML_IEND;
}
-#line 459 "<stdout>"
+#line 290 "<stdout>"
yy34: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy32;
+ case '\n': goto yy32;
default: goto yy11;
}
yy35: ++YYCURSOR;
goto yy36;
yy36:
-#line 237 "bytecode.re"
+#line 238 "bytecode.re"
{ int complex = 0;
if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
{
@@ -480,16 +482,16 @@ yy36:
}
return YAML_IOPEN;
}
-#line 483 "<stdout>"
+#line 314 "<stdout>"
yy37: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy35;
+ case '\n': goto yy35;
default: goto yy11;
}
yy38: ++YYCURSOR;
goto yy39;
yy39:
-#line 222 "bytecode.re"
+#line 223 "bytecode.re"
{ int complex = 0;
if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
{
@@ -504,33 +506,33 @@ yy39:
}
return YAML_IOPEN;
}
-#line 507 "<stdout>"
+#line 338 "<stdout>"
yy40: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy38;
+ case '\n': goto yy38;
default: goto yy11;
}
yy41: ++YYCURSOR;
goto yy42;
yy42:
-#line 217 "bytecode.re"
+#line 218 "bytecode.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 521 "<stdout>"
+#line 352 "<stdout>"
yy43: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy41;
+ case '\n': goto yy41;
default: goto yy11;
}
yy44: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy41;
+ case '\n': goto yy41;
default: goto yy11;
}
}
-#line 386 "bytecode.re"
+#line 387 "bytecode.re"
}
@@ -540,17 +542,17 @@ Directive:
YYTOKEN = YYCURSOR;
-#line 543 "<stdout>"
+#line 366 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy45;
- ++YYCURSOR;
+yy46: ++YYCURSOR;
yy45:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy47;
+ case '\000': goto yy47;
case 'V': goto yy48;
default: goto yy50;
}
@@ -639,15 +641,15 @@ yy48: yyaccept = 0;
default: goto yy49;
}
yy49:
-#line 399 "bytecode.re"
+#line 400 "bytecode.re"
{ YYCURSOR = YYTOKEN;
return YAML_DOCSEP;
}
-#line 646 "<stdout>"
+#line 469 "<stdout>"
yy50: yych = *++YYCURSOR;
goto yy49;
yy51: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy52;
yy52: switch(yych){
@@ -807,12 +809,12 @@ yy53: yych = *++YYCURSOR;
default: goto yy47;
}
yy54: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy55;
yy55: switch(yych){
- case 0x0A: goto yy56;
- case 0x0D: goto yy58;
+ case '\n': goto yy56;
+ case '\r': goto yy58;
case '.':
case '/':
case '0':
@@ -893,17 +895,17 @@ yy55: switch(yych){
yy56: ++YYCURSOR;
goto yy57;
yy57:
-#line 396 "bytecode.re"
+#line 397 "bytecode.re"
{ CHK_NL(YYCURSOR);
goto Directive; }
-#line 899 "<stdout>"
+#line 724 "<stdout>"
yy58: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy56;
+ case '\n': goto yy56;
default: goto yy47;
}
}
-#line 402 "bytecode.re"
+#line 403 "bytecode.re"
}
@@ -913,43 +915,44 @@ Comment:
YYTOKEN = YYCURSOR;
-#line 916 "<stdout>"
+#line 733 "<stdout>"
{
YYCTYPE yych;
+ unsigned int yyaccept;
goto yy59;
- ++YYCURSOR;
+yy60: ++YYCURSOR;
yy59:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy61;
- case 0x0A: goto yy62;
- case 0x0D: goto yy64;
+ case '\000': goto yy61;
+ case '\n': goto yy62;
+ case '\r': goto yy64;
default: goto yy66;
}
yy61:yy62: ++YYCURSOR;
goto yy63;
yy63:
-#line 412 "bytecode.re"
+#line 413 "bytecode.re"
{ CHK_NL(YYCURSOR);
goto Document; }
-#line 936 "<stdout>"
+#line 754 "<stdout>"
yy64: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy67;
+ case '\n': goto yy67;
default: goto yy65;
}
yy65:
-#line 415 "bytecode.re"
+#line 416 "bytecode.re"
{ goto Comment; }
-#line 945 "<stdout>"
+#line 763 "<stdout>"
yy66: yych = *++YYCURSOR;
goto yy65;
yy67: ++YYCURSOR;
yych = *YYCURSOR;
goto yy63;
}
-#line 417 "bytecode.re"
+#line 418 "bytecode.re"
}
@@ -967,18 +970,19 @@ Scalar2:
tok = YYCURSOR;
-#line 970 "<stdout>"
+#line 771 "<stdout>"
{
YYCTYPE yych;
+ unsigned int yyaccept;
goto yy68;
- ++YYCURSOR;
+yy69: ++YYCURSOR;
yy68:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy74;
- case 0x0A: goto yy70;
- case 0x0D: goto yy72;
+ case '\000': goto yy74;
+ case '\n': goto yy70;
+ case '\r': goto yy72;
default: goto yy76;
}
yy70: ++YYCURSOR;
@@ -989,30 +993,30 @@ yy70: ++YYCURSOR;
default: goto yy71;
}
yy71:
-#line 461 "bytecode.re"
+#line 462 "bytecode.re"
{ YYCURSOR = tok;
goto ScalarEnd;
}
-#line 996 "<stdout>"
+#line 798 "<stdout>"
yy72: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy77;
+ case '\n': goto yy77;
default: goto yy73;
}
yy73:
-#line 469 "bytecode.re"
+#line 470 "bytecode.re"
{ CAT(str, cap, idx, tok[0]);
goto Scalar2;
}
-#line 1007 "<stdout>"
+#line 809 "<stdout>"
yy74: ++YYCURSOR;
goto yy75;
yy75:
-#line 465 "bytecode.re"
+#line 466 "bytecode.re"
{ YYCURSOR = tok;
goto ScalarEnd;
}
-#line 1015 "<stdout>"
+#line 817 "<stdout>"
yy76: yych = *++YYCURSOR;
goto yy73;
yy77: yych = *++YYCURSOR;
@@ -1025,10 +1029,10 @@ yy77: yych = *++YYCURSOR;
yy78: ++YYCURSOR;
goto yy79;
yy79:
-#line 435 "bytecode.re"
+#line 436 "bytecode.re"
{ CHK_NL(tok+1);
goto Scalar2; }
-#line 1031 "<stdout>"
+#line 833 "<stdout>"
yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1047,7 +1051,7 @@ yy81: switch(yych){
default: goto yy82;
}
yy82:
-#line 438 "bytecode.re"
+#line 439 "bytecode.re"
{ CHK_NL(tok+1);
if ( tok + 2 < YYCURSOR )
{
@@ -1065,18 +1069,18 @@ yy82:
}
goto Scalar2;
}
-#line 1068 "<stdout>"
+#line 871 "<stdout>"
yy83: ++YYCURSOR;
goto yy84;
yy84:
-#line 456 "bytecode.re"
+#line 457 "bytecode.re"
{ CHK_NL(tok+1);
CAT(str, cap, idx, '\0');
goto Scalar2;
}
-#line 1077 "<stdout>"
+#line 880 "<stdout>"
}
-#line 473 "bytecode.re"
+#line 474 "bytecode.re"
ScalarEnd:
@@ -1111,53 +1115,54 @@ Inline:
tok = YYCURSOR;
-#line 1114 "<stdout>"
+#line 884 "<stdout>"
{
YYCTYPE yych;
+ unsigned int yyaccept;
goto yy85;
- ++YYCURSOR;
+yy86: ++YYCURSOR;
yy85:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy91;
- case 0x0A: goto yy87;
- case 0x0D: goto yy89;
+ case '\000': goto yy91;
+ case '\n': goto yy87;
+ case '\r': goto yy89;
default: goto yy93;
}
yy87: ++YYCURSOR;
goto yy88;
yy88:
-#line 508 "bytecode.re"
+#line 509 "bytecode.re"
{ CHK_NL(YYCURSOR);
return str; }
-#line 1134 "<stdout>"
+#line 905 "<stdout>"
yy89: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy94;
+ case '\n': goto yy94;
default: goto yy90;
}
yy90:
-#line 515 "bytecode.re"
+#line 516 "bytecode.re"
{ CAT(str, cap, idx, tok[0]);
goto Inline;
}
-#line 1145 "<stdout>"
+#line 916 "<stdout>"
yy91: ++YYCURSOR;
goto yy92;
yy92:
-#line 511 "bytecode.re"
+#line 512 "bytecode.re"
{ YYCURSOR = tok;
return str;
}
-#line 1153 "<stdout>"
+#line 924 "<stdout>"
yy93: yych = *++YYCURSOR;
goto yy90;
yy94: ++YYCURSOR;
yych = *YYCURSOR;
goto yy88;
}
-#line 519 "bytecode.re"
+#line 520 "bytecode.re"
}
diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c
index 8d32784cd5..25437b230c 100644
--- a/ext/syck/emitter.c
+++ b/ext/syck/emitter.c
@@ -1,8 +1,8 @@
/*
* emitter.c
*
- * $Author: matz $
- * $Date: 2006/05/03 17:29:34 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*
@@ -18,11 +18,16 @@
#define DEFAULT_ANCHOR_FORMAT "id%03d"
-const char hex_table[] =
-"0123456789ABCDEF";
static char b64_table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+struct adjust_arg {
+ /* Position to start adjusting */
+ long startpos;
+ /* Adjusting by an offset */
+ int offset;
+};
+
/*
* Built-in base64 (from Ruby's pack.c)
*/
@@ -31,7 +36,7 @@ syck_base64enc( char *s, long len )
{
long i = 0;
int padding = '=';
- char *buff = S_ALLOC_N(char, len * 4 / 3 + 6);
+ char *buff = S_ALLOCA_N(char, len * 4 / 3 + 6);
while (len >= 3) {
buff[i++] = b64_table[077 & (*s >> 2)];
@@ -111,29 +116,25 @@ syck_new_emitter()
SyckEmitter *e;
e = S_ALLOC( SyckEmitter );
e->headless = 0;
+ e->seq_map = 0;
e->use_header = 0;
e->use_version = 0;
e->sort_keys = 0;
e->anchor_format = NULL;
e->explicit_typing = 0;
e->best_width = 80;
- e->style = scalar_none;
+ e->block_style = block_arbitrary;
e->stage = doc_open;
e->indent = 2;
e->level = -1;
+ e->ignore_id = 0;
e->anchors = NULL;
e->markers = NULL;
- e->anchored = NULL;
e->bufsize = SYCK_BUFFERSIZE;
e->buffer = NULL;
e->marker = NULL;
e->bufpos = 0;
- e->emitter_handler = NULL;
- e->output_handler = NULL;
- e->lvl_idx = 0;
- e->lvl_capa = ALLOC_CT;
- e->levels = S_ALLOC_N( SyckLevel, e->lvl_capa );
- syck_emitter_reset_levels( e );
+ e->handler = NULL;
e->bonus = NULL;
return e;
}
@@ -145,6 +146,13 @@ syck_st_free_anchors( char *key, char *name, char *arg )
return ST_CONTINUE;
}
+int
+syck_st_free_markers( char *key, SyckEmitterNode *n, char *arg )
+{
+ S_FREE( n );
+ return ST_CONTINUE;
+}
+
void
syck_emitter_st_free( SyckEmitter *e )
{
@@ -158,94 +166,27 @@ syck_emitter_st_free( SyckEmitter *e )
e->anchors = NULL;
}
- if ( e->anchored != NULL )
- {
- st_free_table( e->anchored );
- e->anchored = NULL;
- }
-
/*
* Free the markers tables
*/
if ( e->markers != NULL )
{
+ st_foreach( e->markers, syck_st_free_markers, 0 );
st_free_table( e->markers );
e->markers = NULL;
}
}
-SyckLevel *
-syck_emitter_current_level( SyckEmitter *e )
-{
- return &e->levels[e->lvl_idx-1];
-}
-
-SyckLevel *
-syck_emitter_parent_level( SyckEmitter *e )
-{
- return &e->levels[e->lvl_idx-2];
-}
-
void
-syck_emitter_pop_level( SyckEmitter *e )
+syck_emitter_ignore_id( SyckEmitter *e, SYMID id )
{
- ASSERT( e != NULL );
-
- /* The root level should never be popped */
- if ( e->lvl_idx <= 1 ) return;
-
- e->lvl_idx -= 1;
- free( e->levels[e->lvl_idx].domain );
-}
-
-void
-syck_emitter_add_level( SyckEmitter *e, int len, enum syck_level_status status )
-{
- ASSERT( e != NULL );
- if ( e->lvl_idx + 1 > e->lvl_capa )
- {
- e->lvl_capa += ALLOC_CT;
- S_REALLOC_N( e->levels, SyckLevel, e->lvl_capa );
- }
-
- ASSERT( len > e->levels[e->lvl_idx-1].spaces );
- e->levels[e->lvl_idx].spaces = len;
- e->levels[e->lvl_idx].ncount = 0;
- e->levels[e->lvl_idx].domain = syck_strndup( e->levels[e->lvl_idx-1].domain, strlen( e->levels[e->lvl_idx-1].domain ) );
- e->levels[e->lvl_idx].status = status;
- e->levels[e->lvl_idx].anctag = 0;
- e->lvl_idx += 1;
+ e->ignore_id = id;
}
void
-syck_emitter_reset_levels( SyckEmitter *e )
+syck_emitter_handler( SyckEmitter *e, SyckOutputHandler hdlr )
{
- while ( e->lvl_idx > 1 )
- {
- syck_emitter_pop_level( e );
- }
-
- if ( e->lvl_idx < 1 )
- {
- e->lvl_idx = 1;
- e->levels[0].spaces = -1;
- e->levels[0].ncount = 0;
- e->levels[0].domain = syck_strndup( "", 0 );
- e->levels[0].anctag = 0;
- }
- e->levels[0].status = syck_lvl_header;
-}
-
-void
-syck_emitter_handler( SyckEmitter *e, SyckEmitterHandler hdlr )
-{
- e->emitter_handler = hdlr;
-}
-
-void
-syck_output_handler( SyckEmitter *e, SyckOutputHandler hdlr )
-{
- e->output_handler = hdlr;
+ e->handler = hdlr;
}
void
@@ -255,9 +196,6 @@ syck_free_emitter( SyckEmitter *e )
* Free tables
*/
syck_emitter_st_free( e );
- syck_emitter_reset_levels( e );
- S_FREE( e->levels[0].domain );
- S_FREE( e->levels );
if ( e->buffer != NULL )
{
S_FREE( e->buffer );
@@ -338,905 +276,169 @@ syck_emitter_flush( SyckEmitter *e, long check_room )
}
/*
- * Commit buffer.
- */
- if ( check_room > e->marker - e->buffer )
- {
- check_room = e->marker - e->buffer;
- }
- (e->output_handler)( e, e->buffer, check_room );
- e->bufpos += check_room;
- e->marker -= check_room;
-}
-
-/*
- * Start emitting from the given node, check for anchoring and then
- * issue the callback to the emitter handler.
- */
-void
-syck_emit( SyckEmitter *e, st_data_t n )
-{
- SYMID oid;
- char *anchor_name = NULL;
- int indent = 0;
- long x = 0;
- SyckLevel *lvl = syck_emitter_current_level( e );
-
- /*
* Determine headers.
*/
- if ( e->stage == doc_open && ( e->headless == 0 || e->use_header == 1 ) )
+ if ( ( e->stage == doc_open && ( e->headless == 0 || e->use_header == 1 ) ) ||
+ e->stage == doc_need_header )
{
if ( e->use_version == 1 )
{
char *header = S_ALLOC_N( char, 64 );
S_MEMZERO( header, char, 64 );
sprintf( header, "--- %%YAML:%d.%d ", SYCK_YAML_MAJOR, SYCK_YAML_MINOR );
- syck_emitter_write( e, header, strlen( header ) );
+ (e->handler)( e, header, strlen( header ) );
S_FREE( header );
}
else
{
- syck_emitter_write( e, "--- ", 4 );
+ (e->handler)( e, "--- ", 4 );
}
e->stage = doc_processing;
}
- /* Add new level */
- if ( lvl->spaces >= 0 ) {
- indent = lvl->spaces + e->indent;
- }
- syck_emitter_add_level( e, indent, syck_lvl_open );
- lvl = syck_emitter_current_level( e );
-
- /* Look for anchor */
- if ( e->anchors != NULL &&
- st_lookup( e->markers, n, (st_data_t *)&oid ) &&
- st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) )
+ /*
+ * Commit buffer.
+ */
+ if ( check_room > e->marker - e->buffer )
{
- if ( e->anchored == NULL )
- {
- e->anchored = st_init_numtable();
- }
-
- if ( ! st_lookup( e->anchored, (st_data_t)anchor_name, (st_data_t *)&x ) )
- {
- char *an = S_ALLOC_N( char, strlen( anchor_name ) + 3 );
- sprintf( an, "&%s ", anchor_name );
- syck_emitter_write( e, an, strlen( anchor_name ) + 2 );
- free( an );
-
- x = 1;
- st_insert( e->anchored, (st_data_t)anchor_name, (st_data_t)x );
- lvl->anctag = 1;
- }
- else
- {
- char *an = S_ALLOC_N( char, strlen( anchor_name ) + 2 );
- sprintf( an, "*%s", anchor_name );
- syck_emitter_write( e, an, strlen( anchor_name ) + 1 );
- free( an );
-
- goto end_emit;
- }
- }
-
- (e->emitter_handler)( e, n );
-
- /* Pop the level */
-end_emit:
- syck_emitter_pop_level( e );
- if ( e->lvl_idx == 1 ) {
- syck_emitter_write( e, "\n", 1 );
- e->headless = 0;
- e->stage = doc_open;
+ check_room = e->marker - e->buffer;
}
+ (e->handler)( e, e->buffer, check_room );
+ e->bufpos += check_room;
+ e->marker -= check_room;
}
/*
- * Determine what tag needs to be written, based on the taguri of the node
- * and the implicit tag which would be assigned to this node. If a tag is
- * required, write the tag.
+ * Emit a simple, unquoted string.
*/
-void syck_emit_tag( SyckEmitter *e, char *tag, char *ignore )
-{
- SyckLevel *lvl;
- if ( tag == NULL ) return;
- if ( ignore != NULL && syck_tagcmp( tag, ignore ) == 0 && e->explicit_typing == 0 ) return;
- lvl = syck_emitter_current_level( e );
-
- /* implicit */
- if ( strlen( tag ) == 0 ) {
- syck_emitter_write( e, "! ", 2 );
-
- /* global types */
- } else if ( strncmp( tag, "tag:", 4 ) == 0 ) {
- int taglen = strlen( tag );
- syck_emitter_write( e, "!", 1 );
- if ( strncmp( tag + 4, YAML_DOMAIN, strlen( YAML_DOMAIN ) ) == 0 ) {
- int skip = 4 + strlen( YAML_DOMAIN ) + 1;
- syck_emitter_write( e, tag + skip, taglen - skip );
- } else {
- char *subd = tag + 4;
- while ( *subd != ':' && *subd != '\0' ) subd++;
- if ( *subd == ':' ) {
- if ( subd - tag > ( strlen( YAML_DOMAIN ) + 5 ) &&
- strncmp( subd - strlen( YAML_DOMAIN ), YAML_DOMAIN, strlen( YAML_DOMAIN ) ) == 0 ) {
- syck_emitter_write( e, tag + 4, subd - strlen( YAML_DOMAIN ) - ( tag + 4 ) - 1 );
- syck_emitter_write( e, "/", 1 );
- syck_emitter_write( e, subd + 1, ( tag + taglen ) - ( subd + 1 ) );
- } else {
- syck_emitter_write( e, tag + 4, subd - ( tag + 4 ) );
- syck_emitter_write( e, "/", 1 );
- syck_emitter_write( e, subd + 1, ( tag + taglen ) - ( subd + 1 ) );
- }
- } else {
- /* TODO: Invalid tag (no colon after domain) */
- return;
- }
- }
- syck_emitter_write( e, " ", 1 );
-
- /* private types */
- } else if ( strncmp( tag, "x-private:", 10 ) == 0 ) {
- syck_emitter_write( e, "!!", 2 );
- syck_emitter_write( e, tag + 10, strlen( tag ) - 10 );
- syck_emitter_write( e, " ", 1 );
- }
- lvl->anctag = 1;
-}
-
-/*
- * Emit a newline and an appropriately spaced indent.
- */
-void syck_emit_indent( SyckEmitter *e )
+void
+syck_emitter_simple( SyckEmitter *e, char *str, long len )
{
- int i;
- SyckLevel *lvl = syck_emitter_current_level( e );
- if ( e->bufpos == 0 && ( e->marker - e->buffer ) == 0 ) return;
- if ( lvl->spaces >= 0 ) {
- char *spcs = S_ALLOC_N( char, lvl->spaces + 2 );
-
- spcs[0] = '\n'; spcs[lvl->spaces + 1] = '\0';
- for ( i = 0; i < lvl->spaces; i++ ) spcs[i+1] = ' ';
- syck_emitter_write( e, spcs, lvl->spaces + 1 );
- free( spcs );
- }
+ e->seq_map = 0;
+ syck_emitter_write( e, str, len );
}
-/* Clear the scan */
-#define SCAN_NONE 0
-/* All printable characters? */
-#define SCAN_NONPRINT 1
-/* Any indented lines? */
-#define SCAN_INDENTED 2
-/* Larger than the requested width? */
-#define SCAN_WIDE 4
-/* Opens or closes with whitespace? */
-#define SCAN_WHITEEDGE 8
-/* Contains a newline */
-#define SCAN_NEWLINE 16
-/* Contains a single quote */
-#define SCAN_SINGLEQ 32
-/* Contains a double quote */
-#define SCAN_DOUBLEQ 64
-/* Starts with a token */
-#define SCAN_INDIC_S 128
-/* Contains a flow indicator */
-#define SCAN_INDIC_C 256
-/* Ends without newlines */
-#define SCAN_NONL_E 512
-/* Ends with many newlines */
-#define SCAN_MANYNL_E 1024
-/* Contains flow map indicators */
-#define SCAN_FLOWMAP 2048
-/* Contains flow seq indicators */
-#define SCAN_FLOWSEQ 4096
-/* Contains a valid doc separator */
-#define SCAN_DOCSEP 8192
-
/*
- * Basic printable test for LATIN-1 characters.
+ * Shift the offsets of all applicable anchors
*/
int
-syck_scan_scalar( int req_width, char *cursor, long len )
-{
- long i = 0, start = 0;
- int flags = SCAN_NONE;
-
- if ( len < 1 ) return flags;
-
- /* c-indicators from the spec */
- if ( cursor[0] == '[' || cursor[0] == ']' ||
- cursor[0] == '{' || cursor[0] == '}' ||
- cursor[0] == '!' || cursor[0] == '*' ||
- cursor[0] == '&' || cursor[0] == '|' ||
- cursor[0] == '>' || cursor[0] == '\'' ||
- cursor[0] == '"' || cursor[0] == '#' ||
- cursor[0] == '%' || cursor[0] == '@' ||
- cursor[0] == '&' ) {
- flags |= SCAN_INDIC_S;
- }
- if ( ( cursor[0] == '-' || cursor[0] == ':' ||
- cursor[0] == '?' || cursor[0] == ',' ) &&
- ( len == 1 || cursor[1] == ' ' || cursor[1] == '\n' ) )
- {
- flags |= SCAN_INDIC_S;
- }
-
- /* whitespace edges */
- if ( cursor[len-1] != '\n' ) {
- flags |= SCAN_NONL_E;
- } else if ( len > 1 && cursor[len-2] == '\n' ) {
- flags |= SCAN_MANYNL_E;
- }
- if (
- ( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' ) ) ||
- ( len > 1 && ( cursor[len-1] == ' ' || cursor[len-1] == '\t' ) )
- ) {
- flags |= SCAN_WHITEEDGE;
- }
-
- /* opening doc sep */
- if ( len >= 3 && strncmp( cursor, "---", 3 ) == 0 )
- flags |= SCAN_DOCSEP;
-
- /* scan string */
- for ( i = 0; i < len; i++ ) {
-
- if ( ! ( cursor[i] == 0x9 ||
- cursor[i] == 0xA ||
- cursor[i] == 0xD ||
- ( cursor[i] >= 0x20 && cursor[i] <= 0x7E ) )
- ) {
- flags |= SCAN_NONPRINT;
- }
- else if ( cursor[i] == '\n' ) {
- flags |= SCAN_NEWLINE;
- if ( len - i >= 3 && strncmp( &cursor[i+1], "---", 3 ) == 0 )
- flags |= SCAN_DOCSEP;
- if ( cursor[i+1] == ' ' || cursor[i+1] == '\t' )
- flags |= SCAN_INDENTED;
- if ( req_width > 0 && i - start > req_width )
- flags |= SCAN_WIDE;
- start = i;
- }
- else if ( cursor[i] == '\'' )
- {
- flags |= SCAN_SINGLEQ;
- }
- else if ( cursor[i] == '"' )
- {
- flags |= SCAN_DOUBLEQ;
- }
- else if ( cursor[i] == ']' )
- {
- flags |= SCAN_FLOWSEQ;
- }
- else if ( cursor[i] == '}' )
- {
- flags |= SCAN_FLOWMAP;
- }
- /* remember, if plain collections get implemented, to add nb-plain-flow-char */
- else if ( ( cursor[i] == ' ' && cursor[i+1] == '#' ) ||
- ( cursor[i] == ':' &&
- ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) )
- {
- flags |= SCAN_INDIC_C;
- }
- else if ( cursor[i] == ',' &&
- ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) )
- {
- flags |= SCAN_FLOWMAP;
- flags |= SCAN_FLOWSEQ;
- }
- }
-
- /* printf( "---STR---\n%s\nFLAGS: %d\n", cursor, flags ); */
- return flags;
-}
-/*
- * All scalars should be emitted through this function, which determines an appropriate style,
- * tag and indent.
- */
-void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style, int force_indent, int force_width,
- char keep_nl, char *str, long len )
-{
- enum scalar_style favor_style = scalar_literal;
- SyckLevel *parent = syck_emitter_parent_level( e );
- SyckLevel *lvl = syck_emitter_current_level( e );
- int scan = 0;
- char *implicit;
-
- if ( str == NULL ) str = "";
-
- /* No empty nulls as map keys */
- if ( len == 0 && ( parent->status == syck_lvl_map || parent->status == syck_lvl_imap ) &&
- parent->ncount % 2 == 1 && syck_tagcmp( tag, "tag:yaml.org,2002:null" ) == 0 )
- {
- str = "~";
- len = 1;
- }
-
- scan = syck_scan_scalar( force_width, str, len );
- implicit = syck_match_implicit( str, len );
-
- /* quote strings which default to implicits */
- implicit = syck_taguri( YAML_DOMAIN, implicit, strlen( implicit ) );
- if ( syck_tagcmp( tag, implicit ) != 0 && syck_tagcmp( tag, "tag:yaml.org,2002:str" ) == 0 ) {
- force_style = scalar_2quote;
- } else {
- /* complex key */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 &&
- ( !( tag == NULL ||
- ( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) )
- {
- syck_emitter_write( e, "? ", 2 );
- parent->status = syck_lvl_mapx;
- }
- syck_emit_tag( e, tag, implicit );
- }
- S_FREE( implicit );
-
- /* if still arbitrary, sniff a good block style. */
- if ( force_style == scalar_none ) {
- if ( scan & SCAN_NEWLINE ) {
- force_style = scalar_literal;
- } else {
- force_style = scalar_plain;
- }
- }
-
- if ( e->style == scalar_fold ) {
- favor_style = scalar_fold;
- }
-
- /* Determine block style */
- if ( scan & SCAN_NONPRINT ) {
- force_style = scalar_2quote;
- } else if ( scan & SCAN_WHITEEDGE ) {
- force_style = scalar_2quote;
- } else if ( force_style != scalar_fold && ( scan & SCAN_INDENTED ) ) {
- force_style = scalar_literal;
- } else if ( force_style == scalar_plain && ( scan & SCAN_NEWLINE ) ) {
- force_style = favor_style;
- } else if ( force_style == scalar_plain && parent->status == syck_lvl_iseq && ( scan & SCAN_FLOWSEQ ) ) {
- force_style = scalar_2quote;
- } else if ( force_style == scalar_plain && parent->status == syck_lvl_imap && ( scan & SCAN_FLOWMAP ) ) {
- force_style = scalar_2quote;
- /* } else if ( force_style == scalar_fold && ( ! ( scan & SCAN_WIDE ) ) ) {
- force_style = scalar_literal; */
- } else if ( force_style == scalar_plain && ( scan & SCAN_INDIC_S || scan & SCAN_INDIC_C ) ) {
- if ( scan & SCAN_NEWLINE ) {
- force_style = favor_style;
- } else {
- force_style = scalar_2quote;
- }
- }
-
- if ( force_indent > 0 ) {
- lvl->spaces = parent->spaces + force_indent;
- } else if ( scan & SCAN_DOCSEP ) {
- lvl->spaces = parent->spaces + e->indent;
- }
-
- /* For now, all ambiguous keys are going to be double-quoted */
- if ( ( parent->status == syck_lvl_map || parent->status == syck_lvl_mapx ) && parent->ncount % 2 == 1 ) {
- if ( force_style != scalar_plain ) {
- force_style = scalar_2quote;
- }
- }
-
- /* If the parent is an inline, double quote anything complex */
- if ( parent->status == syck_lvl_imap || parent->status == syck_lvl_iseq ) {
- if ( force_style != scalar_plain && force_style != scalar_1quote ) {
- force_style = scalar_2quote;
- }
- }
-
- /* Fix the ending newlines */
- if ( scan & SCAN_NONL_E ) {
- keep_nl = NL_CHOMP;
- } else if ( scan & SCAN_MANYNL_E ) {
- keep_nl = NL_KEEP;
- }
-
- /* Write the text node */
- switch ( force_style )
- {
- case scalar_1quote:
- syck_emit_1quoted( e, force_width, str, len );
- break;
-
- case scalar_none:
- case scalar_2quote:
- syck_emit_2quoted( e, force_width, str, len );
- break;
-
- case scalar_fold:
- syck_emit_folded( e, force_width, keep_nl, str, len );
- break;
-
- case scalar_literal:
- syck_emit_literal( e, keep_nl, str, len );
- break;
-
- case scalar_plain:
- syck_emitter_write( e, str, len );
- break;
- }
-
- if ( parent->status == syck_lvl_mapx )
- {
- syck_emitter_write( e, "\n", 1 );
- }
-}
-
-void
-syck_emitter_escape( SyckEmitter *e, char *src, long len )
+syck_adjust_anchors( char *key, SyckEmitterNode *n, struct adjust_arg *arg )
{
- int i;
- for( i = 0; i < len; i++ )
+ if ( arg->startpos < n->pos )
{
- if( (src[i] < 0x20) || (0x7E < src[i]) )
- {
- syck_emitter_write( e, "\\", 1 );
- if( '\0' == src[i] )
- syck_emitter_write( e, "0", 1 );
- else
- {
- syck_emitter_write( e, "x", 1 );
- syck_emitter_write( e, (char *)hex_table + ((src[i] & 0xF0) >> 4), 1 );
- syck_emitter_write( e, (char *)hex_table + (src[i] & 0x0F), 1 );
- }
- }
- else
- {
- syck_emitter_write( e, src + i, 1 );
- if( '\\' == src[i] )
- syck_emitter_write( e, "\\", 1 );
- }
- }
-}
-
-/*
- * Outputs a single-quoted block.
- */
-void syck_emit_1quoted( SyckEmitter *e, int width, char *str, long len )
-{
- char do_indent = 0;
- char *mark = str;
- char *start = str;
- char *end = str;
- syck_emitter_write( e, "'", 1 );
- while ( mark < str + len ) {
- if ( do_indent ) {
- syck_emit_indent( e );
- do_indent = 0;
- }
- switch ( *mark ) {
- case '\'': syck_emitter_write( e, "'", 1 ); break;
-
- case '\n':
- end = mark + 1;
- if ( *start != ' ' && *start != '\n' && *end != '\n' && *end != ' ' ) {
- syck_emitter_write( e, "\n\n", 2 );
- } else {
- syck_emitter_write( e, "\n", 1 );
- }
- do_indent = 1;
- start = mark + 1;
- break;
-
- case ' ':
- if ( width > 0 && *start != ' ' && mark - end > width ) {
- do_indent = 1;
- end = mark + 1;
- } else {
- syck_emitter_write( e, " ", 1 );
- }
- break;
-
- default:
- syck_emitter_write( e, mark, 1 );
- break;
- }
- mark++;
- }
- syck_emitter_write( e, "'", 1 );
-}
-
-/*
- * Outputs a double-quoted block.
- */
-void syck_emit_2quoted( SyckEmitter *e, int width, char *str, long len )
-{
- char do_indent = 0;
- char *mark = str;
- char *start = str;
- char *end = str;
- syck_emitter_write( e, "\"", 1 );
- while ( mark < str + len ) {
- if ( do_indent > 0 ) {
- if ( do_indent == 2 ) {
- syck_emitter_write( e, "\\", 1 );
- }
- syck_emit_indent( e );
- do_indent = 0;
- }
- switch ( *mark ) {
-
- /* Escape sequences allowed within double quotes. */
- case '"': syck_emitter_write( e, "\\\"", 2 ); break;
- case '\\': syck_emitter_write( e, "\\\\", 2 ); break;
- case '\0': syck_emitter_write( e, "\\0", 2 ); break;
- case '\a': syck_emitter_write( e, "\\a", 2 ); break;
- case '\b': syck_emitter_write( e, "\\b", 2 ); break;
- case '\f': syck_emitter_write( e, "\\f", 2 ); break;
- case '\r': syck_emitter_write( e, "\\r", 2 ); break;
- case '\t': syck_emitter_write( e, "\\t", 2 ); break;
- case '\v': syck_emitter_write( e, "\\v", 2 ); break;
- case 0x1b: syck_emitter_write( e, "\\e", 2 ); break;
-
- case '\n':
- end = mark + 1;
- syck_emitter_write( e, "\\n", 2 );
- do_indent = 2;
- start = mark + 1;
- if ( start < str + len && ( *start == ' ' || *start == '\n' ) ) {
- do_indent = 0;
- }
- break;
-
- case ' ':
- if ( width > 0 && *start != ' ' && mark - end > width ) {
- do_indent = 1;
- end = mark + 1;
- } else {
- syck_emitter_write( e, " ", 1 );
- }
- break;
-
- default:
- syck_emitter_escape( e, mark, 1 );
- break;
- }
- mark++;
- }
- syck_emitter_write( e, "\"", 1 );
-}
-
-/*
- * Outputs a literal block.
- */
-void syck_emit_literal( SyckEmitter *e, char keep_nl, char *str, long len )
-{
- char *mark = str;
- char *start = str;
- char *end = str;
- syck_emitter_write( e, "|", 1 );
- if ( keep_nl == NL_CHOMP ) {
- syck_emitter_write( e, "-", 1 );
- } else if ( keep_nl == NL_KEEP ) {
- syck_emitter_write( e, "+", 1 );
- }
- syck_emit_indent( e );
- while ( mark < str + len ) {
- if ( *mark == '\n' ) {
- end = mark;
- if ( *start != ' ' && *start != '\n' && *end != '\n' && *end != ' ' ) end += 1;
- syck_emitter_write( e, start, end - start );
- if ( mark + 1 == str + len ) {
- if ( keep_nl != NL_KEEP ) syck_emitter_write( e, "\n", 1 );
- } else {
- syck_emit_indent( e );
- }
- start = mark + 1;
- }
- mark++;
- }
- end = str + len;
- if ( start < end ) {
- syck_emitter_write( e, start, end - start );
- }
-}
-
-/*
- * Outputs a folded block.
- */
-void syck_emit_folded( SyckEmitter *e, int width, char keep_nl, char *str, long len )
-{
- char *mark = str;
- char *start = str;
- char *end = str;
- syck_emitter_write( e, ">", 1 );
- if ( keep_nl == NL_CHOMP ) {
- syck_emitter_write( e, "-", 1 );
- } else if ( keep_nl == NL_KEEP ) {
- syck_emitter_write( e, "+", 1 );
- }
- syck_emit_indent( e );
- if ( width <= 0 ) width = e->best_width;
- while ( mark < str + len ) {
- switch ( *mark ) {
- case '\n':
- syck_emitter_write( e, end, mark - end );
- end = mark + 1;
- if ( *start != ' ' && *start != '\n' && *end != '\n' && *end != ' ' ) {
- syck_emitter_write( e, "\n", 1 );
- }
- if ( mark + 1 == str + len ) {
- if ( keep_nl != NL_KEEP ) syck_emitter_write( e, "\n", 1 );
- } else {
- syck_emit_indent( e );
- }
- start = mark + 1;
- break;
-
- case ' ':
- if ( *start != ' ' ) {
- if ( mark - end > width ) {
- syck_emitter_write( e, end, mark - end );
- syck_emit_indent( e );
- end = mark + 1;
- }
- }
- break;
- }
- mark++;
- }
- if ( end < mark ) {
- syck_emitter_write( e, end, mark - end );
- }
-}
-
-/*
- * Begins emission of a sequence.
- */
-void syck_emit_seq( SyckEmitter *e, char *tag, enum seq_style style )
-{
- SyckLevel *parent = syck_emitter_parent_level( e );
- SyckLevel *lvl = syck_emitter_current_level( e );
- syck_emit_tag( e, tag, "tag:yaml.org,2002:seq" );
- if ( style == seq_inline || ( parent->status == syck_lvl_imap || parent->status == syck_lvl_iseq ) ) {
- syck_emitter_write( e, "[", 1 );
- lvl->status = syck_lvl_iseq;
- } else {
- /* complex key */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 ) {
- syck_emitter_write( e, "? ", 2 );
- parent->status = syck_lvl_mapx;
- }
- lvl->status = syck_lvl_seq;
+ n->pos += arg->offset;
}
+ return ST_CONTINUE;
}
/*
- * Begins emission of a mapping.
+ * call on start of an object's marshalling
+ * (handles anchors, returns an alias)
*/
-void syck_emit_map( SyckEmitter *e, char *tag, enum map_style style )
+char *
+syck_emitter_start_obj( SyckEmitter *e, SYMID oid )
{
- SyckLevel *parent = syck_emitter_parent_level( e );
- SyckLevel *lvl = syck_emitter_current_level( e );
- syck_emit_tag( e, tag, "tag:yaml.org,2002:map" );
- if ( style == map_inline || ( parent->status == syck_lvl_imap || parent->status == syck_lvl_iseq ) ) {
- syck_emitter_write( e, "{", 1 );
- lvl->status = syck_lvl_imap;
- } else {
- /* complex key */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 ) {
- syck_emitter_write( e, "? ", 2 );
- parent->status = syck_lvl_mapx;
- }
- lvl->status = syck_lvl_map;
- }
-}
+ SyckEmitterNode *n = NULL;
+ char *anchor_name = NULL;
-/*
- * Handles emitting of a collection item (for both
- * sequences and maps)
- */
-void syck_emit_item( SyckEmitter *e, st_data_t n )
-{
- SyckLevel *lvl = syck_emitter_current_level( e );
- switch ( lvl->status )
+ e->level++;
+ if ( oid != e->ignore_id )
{
- case syck_lvl_seq:
+ /*
+ * Look for anchors
+ */
+ if ( e->markers == NULL )
{
- SyckLevel *parent = syck_emitter_parent_level( e );
-
- /* seq-in-map shortcut -- the lvl->anctag check should be unneccesary but
- * there is a nasty shift/reduce in the parser on this point and
- * i'm not ready to tickle it. */
- if ( lvl->anctag == 0 && parent->status == syck_lvl_map && lvl->ncount == 0 ) {
- lvl->spaces = parent->spaces;
- }
-
- /* seq-in-seq shortcut */
- else if ( lvl->anctag == 0 && parent->status == syck_lvl_seq && lvl->ncount == 0 ) {
- int spcs = ( lvl->spaces - parent->spaces ) - 2;
- if ( spcs >= 0 ) {
- int i = 0;
- for ( i = 0; i < spcs; i++ ) {
- syck_emitter_write( e, " ", 1 );
- }
- syck_emitter_write( e, "- ", 2 );
- break;
- }
- }
-
- syck_emit_indent( e );
- syck_emitter_write( e, "- ", 2 );
+ e->markers = st_init_numtable();
}
- break;
- case syck_lvl_iseq:
+ /*
+ * Markers table initially marks the string position of the
+ * object. Doesn't yet create an anchor, simply notes the
+ * position.
+ */
+ if ( ! st_lookup( e->markers, (st_data_t)oid, (st_data_t *)&n ) )
{
- if ( lvl->ncount > 0 ) {
- syck_emitter_write( e, ", ", 2 );
- }
+ /*
+ * Store all markers
+ */
+ n = S_ALLOC( SyckEmitterNode );
+ n->is_shortcut = 0;
+ n->indent = e->level * e->indent;
+ n->pos = e->bufpos + ( e->marker - e->buffer );
+ st_insert( e->markers, (st_data_t)oid, (st_data_t)n );
}
- break;
-
- case syck_lvl_map:
+ else
{
- SyckLevel *parent = syck_emitter_parent_level( e );
-
- /* map-in-seq shortcut */
- if ( lvl->anctag == 0 && parent->status == syck_lvl_seq && lvl->ncount == 0 ) {
- int spcs = ( lvl->spaces - parent->spaces ) - 2;
- if ( spcs >= 0 ) {
- int i = 0;
- for ( i = 0; i < spcs; i++ ) {
- syck_emitter_write( e, " ", 1 );
- }
- break;
- }
- }
-
- if ( lvl->ncount % 2 == 0 ) {
- syck_emit_indent( e );
- } else {
- syck_emitter_write( e, ": ", 2 );
+ if ( e->anchors == NULL )
+ {
+ e->anchors = st_init_numtable();
}
- }
- break;
-
- case syck_lvl_mapx:
- {
- if ( lvl->ncount % 2 == 0 ) {
- syck_emit_indent( e );
- lvl->status = syck_lvl_map;
- } else {
- int i;
- if ( lvl->spaces > 0 ) {
- char *spcs = S_ALLOC_N( char, lvl->spaces + 1 );
- spcs[lvl->spaces] = '\0';
- for ( i = 0; i < lvl->spaces; i++ ) spcs[i] = ' ';
- syck_emitter_write( e, spcs, lvl->spaces );
- S_FREE( spcs );
+ if ( ! st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) )
+ {
+ int idx = 0;
+ /*
+ * Second time hitting this object, let's give it an anchor
+ */
+ idx = e->anchors->num_entries + 1;
+
+ /*
+ * Create the anchor tag
+ */
+ if ( n->pos >= e->bufpos )
+ {
+ int alen;
+ struct adjust_arg *args = S_ALLOC( struct adjust_arg );
+ char *start = e->buffer + ( n->pos - e->bufpos );
+
+ char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format );
+ anchor_name = S_ALLOC_N( char, strlen( anc ) + 10 );
+ S_MEMZERO( anchor_name, char, strlen( anc ) + 10 );
+ sprintf( anchor_name, anc, idx );
+
+ /*
+ * Need to flush the buffer some, if there is not room for the anchor.
+ */
+ alen = strlen( anchor_name ) + 2;
+ syck_emitter_flush( e, alen );
+
+ /*
+ * Write the anchor into the buffer
+ */
+ S_MEMMOVE( start + alen, start, char, e->marker - start );
+ S_MEMCPY( start + 1, anchor_name, char, strlen( anchor_name ) );
+ start[0] = '&';
+ start[alen - 1] = ' ';
+ e->marker += alen;
+
+ /*
+ * Cycle through anchors, modify for the size of the anchor.
+ */
+ args->startpos = n->pos;
+ args->offset = alen;
+ st_foreach( e->markers, syck_adjust_anchors, (st_data_t)args );
+ S_FREE( args );
+
+ /*
+ * Insert into anchors table
+ */
+ st_insert( e->anchors, (st_data_t)oid, (st_data_t)anchor_name );
}
- syck_emitter_write( e, ": ", 2 );
}
- }
- break;
- case syck_lvl_imap:
- {
- if ( lvl->ncount > 0 ) {
- if ( lvl->ncount % 2 == 0 ) {
- syck_emitter_write( e, ", ", 2 );
- } else {
- syck_emitter_write( e, ": ", 2 );
- }
- }
}
- break;
-
- default: break;
}
- lvl->ncount++;
-
- syck_emit( e, n );
-}
-
-/*
- * Closes emission of a collection.
- */
-void syck_emit_end( SyckEmitter *e )
-{
- SyckLevel *lvl = syck_emitter_current_level( e );
- SyckLevel *parent = syck_emitter_parent_level( e );
- switch ( lvl->status )
- {
- case syck_lvl_seq:
- if ( lvl->ncount == 0 ) {
- syck_emitter_write( e, "[]\n", 3 );
- } else if ( parent->status == syck_lvl_mapx ) {
- syck_emitter_write( e, "\n", 1 );
- }
- break;
- case syck_lvl_iseq:
- syck_emitter_write( e, "]\n", 1 );
- break;
-
- case syck_lvl_map:
- if ( lvl->ncount == 0 ) {
- syck_emitter_write( e, "{}\n", 3 );
- } else if ( lvl->ncount % 2 == 1 ) {
- syck_emitter_write( e, ":\n", 1 );
- } else if ( parent->status == syck_lvl_mapx ) {
- syck_emitter_write( e, "\n", 1 );
- }
- break;
-
- case syck_lvl_imap:
- syck_emitter_write( e, "}\n", 1 );
- break;
-
- default: break;
- }
+ return anchor_name;
}
/*
- * Fill markers table with emitter nodes in the
- * soon-to-be-emitted tree.
+ * call on completion of an object's marshalling
*/
-SYMID
-syck_emitter_mark_node( SyckEmitter *e, st_data_t n )
+void
+syck_emitter_end_obj( SyckEmitter *e )
{
- SYMID oid = 0;
- char *anchor_name = NULL;
-
- /*
- * Ensure markers table is initialized.
- */
- if ( e->markers == NULL )
- {
- e->markers = st_init_numtable();
- }
-
- /*
- * Markers table initially marks the string position of the
- * object. Doesn't yet create an anchor, simply notes the
- * position.
- */
- if ( ! st_lookup( e->markers, n, (st_data_t *)&oid ) )
- {
- /*
- * Store all markers
- */
- oid = e->markers->num_entries + 1;
- st_insert( e->markers, n, (st_data_t)oid );
- }
- else
- {
- if ( e->anchors == NULL )
- {
- e->anchors = st_init_numtable();
- }
-
- if ( ! st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) )
- {
- int idx = 0;
- char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format );
-
- /*
- * Second time hitting this object, let's give it an anchor
- */
- idx = e->anchors->num_entries + 1;
- anchor_name = S_ALLOC_N( char, strlen( anc ) + 10 );
- S_MEMZERO( anchor_name, char, strlen( anc ) + 10 );
- sprintf( anchor_name, anc, idx );
-
- /*
- * Insert into anchors table
- */
- st_insert( e->anchors, (st_data_t)oid, (st_data_t)anchor_name );
- }
- }
- return oid;
+ e->level--;
}
diff --git a/ext/syck/gram.c b/ext/syck/gram.c
index 615a594f61..dd65ea1deb 100644
--- a/ext/syck/gram.c
+++ b/ext/syck/gram.c
@@ -1,7 +1,7 @@
-/* A Bison parser, made by GNU Bison 1.875d. */
+/* A Bison parser, made from gram.y, by GNU bison 1.75. */
/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,13 +34,10 @@
USER NAME SPACE" below. */
/* Identify Bison output. */
-#define YYBISON 1
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
+#define YYBISON 1
/* Pure parsers. */
-#define YYPURE 1
+#define YYPURE 1
/* Using locations. */
#define YYLSP_NEEDED 0
@@ -98,8 +95,6 @@
#include "syck.h"
-void apply_seq_in_map( SyckParser *parser, SyckNode *n );
-
#define YYPARSE_PARAM parser
#define YYLEX_PARAM parser
@@ -128,49 +123,51 @@ void apply_seq_in_map( SyckParser *parser, SyckNode *n );
# define YYERROR_VERBOSE 0
#endif
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 35 "gram.y"
-typedef union YYSTYPE {
+#ifndef YYSTYPE
+#line 33 "gram.y"
+typedef union {
SYMID nodeId;
SyckNode *nodeData;
char *name;
-} YYSTYPE;
-/* Line 191 of yacc.c. */
-#line 140 "gram.c"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
+} yystype;
+/* Line 193 of /usr/local/share/bison/yacc.c. */
+#line 135 "y.tab.c"
+# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
-
+#ifndef YYLTYPE
+typedef struct yyltype
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} yyltype;
+# define YYLTYPE yyltype
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
/* Copy the second part of user declarations. */
-/* Line 214 of yacc.c. */
-#line 152 "gram.c"
+/* Line 213 of /usr/local/share/bison/yacc.c. */
+#line 156 "y.tab.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
-# ifndef YYFREE
-# define YYFREE free
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# endif
-
/* The parser invokes alloca or malloc; define the necessary symbols. */
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# endif
+# if YYSTACK_USE_ALLOCA
+# define YYSTACK_ALLOC alloca
# else
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
+# ifndef YYSTACK_USE_ALLOCA
+# if defined (alloca) || defined (_ALLOCA_H)
+# define YYSTACK_ALLOC alloca
+# else
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# endif
# endif
# endif
# endif
@@ -183,36 +180,36 @@ typedef union YYSTYPE {
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
+# define YYSTACK_ALLOC malloc
+# define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
- || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
+ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- short int yyss;
+ short yyss;
YYSTYPE yyvs;
};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
+ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAX)
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
-# if defined (__GNUC__) && 1 < __GNUC__
+# if 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
@@ -221,7 +218,7 @@ union yyalloc
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
+ (To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
@@ -238,7 +235,7 @@ union yyalloc
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
@@ -248,20 +245,19 @@ union yyalloc
#if defined (__STDC__) || defined (__cplusplus)
typedef signed char yysigned_char;
#else
- typedef short int yysigned_char;
+ typedef short yysigned_char;
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 52
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 396
+#define YYFINAL 38
+#define YYLAST 422
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 29
+#define YYNNTS 28
/* YYNRULES -- Number of rules. */
-#define YYNRULES 79
+#define YYNRULES 75
/* YYNRULES -- Number of states. */
#define YYNSTATES 128
@@ -269,8 +265,8 @@ union yyalloc
#define YYUNDEFTOK 2
#define YYMAXUTOK 269
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+#define YYTRANSLATE(X) \
+ ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const unsigned char yytranslate[] =
@@ -309,55 +305,54 @@ static const unsigned char yytranslate[] =
YYRHS. */
static const unsigned char yyprhs[] =
{
- 0, 0, 3, 5, 8, 9, 11, 13, 15, 18,
- 21, 24, 28, 30, 32, 36, 37, 40, 43, 46,
- 49, 51, 54, 56, 58, 60, 63, 66, 69, 72,
- 75, 77, 79, 81, 85, 87, 89, 91, 93, 95,
- 99, 103, 106, 110, 113, 117, 120, 124, 127, 129,
- 133, 136, 140, 143, 145, 149, 151, 153, 157, 161,
- 165, 168, 172, 175, 179, 182, 184, 188, 190, 194,
- 196, 200, 204, 207, 211, 215, 218, 220, 224, 226
+ 0, 0, 3, 5, 8, 9, 11, 13, 15, 19,
+ 21, 24, 27, 30, 34, 36, 39, 40, 42, 45,
+ 47, 49, 51, 54, 57, 60, 63, 66, 68, 70,
+ 72, 76, 78, 80, 82, 84, 86, 90, 93, 95,
+ 99, 102, 106, 109, 113, 116, 118, 122, 125, 129,
+ 132, 134, 138, 140, 142, 146, 150, 154, 157, 161,
+ 164, 168, 171, 175, 177, 183, 185, 189, 193, 196,
+ 200, 204, 207, 209, 213, 215
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
- 24, 0, -1, 25, -1, 11, 27, -1, -1, 33,
- -1, 26, -1, 34, -1, 5, 26, -1, 6, 26,
- -1, 3, 26, -1, 29, 26, 32, -1, 25, -1,
- 28, -1, 29, 28, 30, -1, -1, 7, 28, -1,
- 5, 28, -1, 6, 28, -1, 3, 28, -1, 12,
- -1, 29, 13, -1, 14, -1, 13, -1, 14, -1,
- 31, 32, -1, 5, 33, -1, 6, 33, -1, 7,
- 33, -1, 3, 33, -1, 4, -1, 8, -1, 9,
- -1, 29, 33, 32, -1, 10, -1, 35, -1, 39,
- -1, 42, -1, 49, -1, 29, 37, 30, -1, 29,
- 38, 30, -1, 15, 27, -1, 5, 31, 38, -1,
- 5, 37, -1, 6, 31, 38, -1, 6, 37, -1,
- 3, 31, 38, -1, 3, 37, -1, 36, -1, 38,
- 31, 36, -1, 38, 31, -1, 17, 40, 18, -1,
- 17, 18, -1, 41, -1, 40, 21, 41, -1, 25,
- -1, 48, -1, 29, 43, 30, -1, 29, 47, 30,
- -1, 5, 31, 47, -1, 5, 43, -1, 6, 31,
- 47, -1, 6, 43, -1, 3, 31, 47, -1, 3,
- 43, -1, 33, -1, 22, 25, 31, -1, 27, -1,
- 44, 16, 45, -1, 46, -1, 47, 31, 36, -1,
- 47, 31, 46, -1, 47, 31, -1, 25, 16, 27,
- -1, 19, 50, 20, -1, 19, 20, -1, 51, -1,
- 50, 21, 51, -1, 25, -1, 48, -1
+ 24, 0, -1, 26, -1, 11, 28, -1, -1, 33,
+ -1, 27, -1, 34, -1, 29, 26, 32, -1, 34,
+ -1, 5, 27, -1, 6, 27, -1, 3, 27, -1,
+ 29, 27, 32, -1, 25, -1, 29, 30, -1, -1,
+ 12, -1, 29, 13, -1, 14, -1, 13, -1, 14,
+ -1, 31, 32, -1, 5, 33, -1, 6, 33, -1,
+ 7, 33, -1, 3, 33, -1, 4, -1, 8, -1,
+ 9, -1, 29, 33, 32, -1, 10, -1, 35, -1,
+ 39, -1, 42, -1, 48, -1, 29, 37, 30, -1,
+ 15, 28, -1, 38, -1, 5, 31, 37, -1, 5,
+ 37, -1, 6, 31, 37, -1, 6, 37, -1, 3,
+ 31, 37, -1, 3, 37, -1, 36, -1, 38, 31,
+ 36, -1, 38, 31, -1, 17, 40, 18, -1, 17,
+ 18, -1, 41, -1, 40, 21, 41, -1, 25, -1,
+ 47, -1, 29, 43, 30, -1, 29, 46, 30, -1,
+ 5, 31, 46, -1, 5, 43, -1, 6, 31, 46,
+ -1, 6, 43, -1, 3, 31, 46, -1, 3, 43,
+ -1, 33, 16, 28, -1, 44, -1, 22, 25, 31,
+ 16, 28, -1, 45, -1, 46, 31, 36, -1, 46,
+ 31, 45, -1, 46, 31, -1, 25, 16, 28, -1,
+ 19, 49, 20, -1, 19, 20, -1, 50, -1, 49,
+ 21, 50, -1, 25, -1, 47, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned short int yyrline[] =
+static const unsigned short yyrline[] =
{
- 0, 56, 56, 60, 65, 70, 71, 74, 75, 80,
- 85, 94, 100, 101, 104, 109, 113, 121, 126, 131,
- 145, 146, 149, 152, 155, 156, 164, 169, 174, 182,
- 186, 194, 207, 208, 218, 219, 220, 221, 222, 228,
- 232, 238, 244, 249, 254, 259, 264, 268, 274, 278,
- 283, 292, 296, 302, 306, 313, 314, 320, 325, 332,
- 337, 342, 347, 352, 356, 362, 363, 369, 379, 396,
- 397, 409, 417, 426, 434, 438, 444, 445, 454, 461
+ 0, 54, 54, 58, 62, 68, 69, 72, 73, 79,
+ 80, 85, 90, 99, 105, 106, 111, 121, 122, 125,
+ 128, 131, 132, 140, 145, 150, 158, 162, 170, 183,
+ 184, 194, 195, 196, 197, 198, 204, 210, 216, 217,
+ 222, 227, 232, 237, 241, 247, 251, 256, 265, 269,
+ 275, 279, 286, 287, 293, 298, 305, 310, 315, 320,
+ 325, 329, 335, 350, 351, 368, 369, 381, 389, 398,
+ 406, 410, 416, 417, 426, 433
};
#endif
@@ -366,24 +361,24 @@ static const unsigned short int yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "YAML_ANCHOR", "YAML_ALIAS",
- "YAML_TRANSFER", "YAML_TAGURI", "YAML_ITRANSFER", "YAML_WORD",
- "YAML_PLAIN", "YAML_BLOCK", "YAML_DOCSEP", "YAML_IOPEN", "YAML_INDENT",
- "YAML_IEND", "'-'", "':'", "'['", "']'", "'{'", "'}'", "','", "'?'",
- "$accept", "doc", "atom", "ind_rep", "atom_or_empty", "empty",
- "indent_open", "indent_end", "indent_sep", "indent_flex_end", "word_rep",
- "struct_rep", "implicit_seq", "basic_seq", "top_imp_seq",
- "in_implicit_seq", "inline_seq", "in_inline_seq", "inline_seq_atom",
- "implicit_map", "top_imp_map", "complex_key", "complex_value",
- "complex_mapping", "in_implicit_map", "basic_mapping", "inline_map",
- "in_inline_map", "inline_map_atom", 0
+ "$end", "error", "$undefined", "YAML_ANCHOR", "YAML_ALIAS",
+ "YAML_TRANSFER", "YAML_TAGURI", "YAML_ITRANSFER", "YAML_WORD",
+ "YAML_PLAIN", "YAML_BLOCK", "YAML_DOCSEP", "YAML_IOPEN", "YAML_INDENT",
+ "YAML_IEND", "'-'", "':'", "'['", "']'", "'{'", "'}'", "','", "'?'",
+ "$accept", "doc", "atom", "doc_struct_rep", "ind_rep", "atom_or_empty",
+ "indent_open", "indent_end", "indent_sep", "indent_flex_end",
+ "word_rep", "struct_rep", "implicit_seq", "basic_seq", "top_imp_seq",
+ "in_implicit_seq", "inline_seq", "in_inline_seq", "inline_seq_atom",
+ "implicit_map", "top_imp_map", "basic_mapping", "complex_mapping",
+ "in_implicit_map", "basic_mapping2", "inline_map", "in_inline_map",
+ "inline_map_atom", 0
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
-static const unsigned short int yytoknum[] =
+static const unsigned short yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 45, 58, 91, 93, 123,
@@ -394,27 +389,27 @@ static const unsigned short int yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const unsigned char yyr1[] =
{
- 0, 23, 24, 24, 24, 25, 25, 26, 26, 26,
- 26, 26, 27, 27, 28, 28, 28, 28, 28, 28,
- 29, 29, 30, 31, 32, 32, 33, 33, 33, 33,
- 33, 33, 33, 33, 34, 34, 34, 34, 34, 35,
- 35, 36, 37, 37, 37, 37, 37, 37, 38, 38,
- 38, 39, 39, 40, 40, 41, 41, 42, 42, 43,
- 43, 43, 43, 43, 43, 44, 44, 45, 46, 47,
- 47, 47, 47, 48, 49, 49, 50, 50, 51, 51
+ 0, 23, 24, 24, 24, 25, 25, 26, 26, 27,
+ 27, 27, 27, 27, 28, 28, 28, 29, 29, 30,
+ 31, 32, 32, 33, 33, 33, 33, 33, 33, 33,
+ 33, 34, 34, 34, 34, 34, 35, 36, 37, 37,
+ 37, 37, 37, 37, 37, 38, 38, 38, 39, 39,
+ 40, 40, 41, 41, 42, 42, 43, 43, 43, 43,
+ 43, 43, 44, 45, 45, 46, 46, 46, 46, 47,
+ 48, 48, 49, 49, 50, 50
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const unsigned char yyr2[] =
{
- 0, 2, 1, 2, 0, 1, 1, 1, 2, 2,
- 2, 3, 1, 1, 3, 0, 2, 2, 2, 2,
- 1, 2, 1, 1, 1, 2, 2, 2, 2, 2,
- 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,
- 3, 2, 3, 2, 3, 2, 3, 2, 1, 3,
- 2, 3, 2, 1, 3, 1, 1, 3, 3, 3,
- 2, 3, 2, 3, 2, 1, 3, 1, 3, 1,
- 3, 3, 2, 3, 3, 2, 1, 3, 1, 1
+ 0, 2, 1, 2, 0, 1, 1, 1, 3, 1,
+ 2, 2, 2, 3, 1, 2, 0, 1, 2, 1,
+ 1, 1, 2, 2, 2, 2, 2, 1, 1, 1,
+ 3, 1, 1, 1, 1, 1, 3, 2, 1, 3,
+ 2, 3, 2, 3, 2, 1, 3, 2, 3, 2,
+ 1, 3, 1, 1, 3, 3, 3, 2, 3, 2,
+ 3, 2, 3, 1, 5, 1, 3, 3, 2, 3,
+ 3, 2, 1, 3, 1, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -422,167 +417,173 @@ static const unsigned char yyr2[] =
means the default is an error. */
static const unsigned char yydefact[] =
{
- 4, 0, 30, 0, 0, 0, 31, 32, 34, 15,
- 20, 0, 0, 0, 2, 6, 0, 5, 7, 35,
- 36, 37, 38, 10, 29, 8, 26, 9, 27, 0,
- 0, 0, 0, 28, 15, 15, 15, 15, 12, 3,
- 13, 15, 52, 55, 0, 53, 56, 75, 78, 79,
- 0, 76, 1, 0, 0, 0, 21, 15, 0, 0,
- 65, 48, 0, 0, 0, 0, 69, 0, 0, 19,
- 17, 18, 15, 15, 15, 16, 15, 15, 15, 15,
- 0, 15, 51, 0, 74, 0, 23, 0, 47, 64,
- 0, 43, 60, 0, 45, 62, 41, 0, 24, 0,
- 11, 33, 22, 39, 40, 50, 57, 15, 58, 72,
- 14, 73, 54, 77, 65, 46, 63, 42, 59, 44,
- 61, 66, 25, 49, 67, 68, 70, 71
+ 4, 31, 16, 17, 0, 0, 0, 2, 0, 7,
+ 32, 33, 34, 35, 0, 27, 0, 0, 0, 28,
+ 29, 14, 6, 3, 0, 5, 9, 49, 52, 0,
+ 0, 50, 53, 71, 74, 75, 0, 72, 1, 0,
+ 0, 0, 18, 16, 0, 0, 0, 0, 45, 0,
+ 38, 0, 63, 65, 0, 12, 26, 10, 23, 11,
+ 24, 0, 0, 0, 0, 25, 0, 0, 0, 19,
+ 0, 15, 0, 16, 48, 0, 70, 0, 20, 0,
+ 44, 61, 0, 40, 57, 0, 42, 59, 37, 0,
+ 21, 0, 8, 16, 36, 47, 54, 55, 68, 0,
+ 13, 30, 69, 51, 73, 0, 0, 0, 43, 60,
+ 39, 56, 41, 58, 0, 22, 62, 46, 66, 67,
+ 0, 0, 0, 16, 0, 0, 0, 64
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yysigned_char yydefgoto[] =
{
- -1, 13, 38, 15, 39, 40, 16, 103, 99, 101,
- 17, 18, 19, 61, 62, 63, 20, 44, 45, 21,
- 64, 65, 125, 66, 67, 46, 22, 50, 51
+ -1, 6, 21, 45, 22, 23, 64, 71, 91, 101,
+ 25, 26, 10, 48, 49, 50, 11, 30, 31, 12,
+ 51, 52, 53, 54, 32, 13, 36, 37
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -97
-static const short int yypact[] =
+#define YYPACT_NINF -77
+static const short yypact[] =
{
- 250, 318, -97, 318, 318, 374, -97, -97, -97, 335,
- -97, 267, 232, 7, -97, -97, 192, -97, -97, -97,
- -97, -97, -97, -97, -97, -97, -97, -97, -97, 374,
- 374, 374, 352, -97, 335, 335, 335, 384, -97, -97,
- -97, 212, -97, 10, 0, -97, -97, -97, 10, -97,
- -4, -97, -97, 284, 284, 284, -97, 335, 318, 30,
- 30, -97, -2, 36, -2, 16, -97, 36, 30, -97,
- -97, -97, 384, 384, 384, -97, 363, 301, 301, 301,
- -2, 335, -97, 318, -97, 318, -97, 158, -97, -97,
- 158, -97, -97, 158, -97, -97, -97, 24, -97, 30,
- -97, -97, -97, -97, -97, 26, -97, 335, -97, 158,
- -97, -97, -97, -97, -97, 24, 24, 24, 24, 24,
- 24, -97, -97, -97, -97, -97, -97, -97
+ 163, -77, 356, -77, 339, 304, 7, -77, 224, -77,
+ -77, -77, -77, -77, 356, -77, 356, 356, 410, -77,
+ -77, -77, -77, -77, 204, -77, -77, -77, -15, 244,
+ 24, -77, -77, -77, -15, -77, 30, -77, -77, 373,
+ 373, 373, -77, 356, 356, 41, 224, -3, -77, 18,
+ 21, 18, -77, -77, 46, -77, -77, -77, -77, -77,
+ -77, 410, 410, 410, 399, -77, 322, 322, 322, -77,
+ 41, -77, 14, 356, -77, 356, -77, 356, -77, 264,
+ -77, -77, 264, -77, -77, 264, -77, -77, -77, 21,
+ -77, 41, -77, 356, -77, 33, -77, -77, 284, 41,
+ -77, -77, -77, -77, -77, 386, 386, 386, -77, 21,
+ -77, 21, -77, 21, 22, -77, -77, -77, -77, -77,
+ 20, 20, 20, 356, 91, 91, 91, -77
};
/* YYPGOTO[NTERM-NUM]. */
-static const yysigned_char yypgoto[] =
+static const short yypgoto[] =
{
- -97, -97, 8, 81, -56, 109, 33, -53, 74, -54,
- -1, -97, -97, -96, -31, -32, -97, -97, -44, -97,
- 77, -97, -97, -52, 9, -6, -97, -97, -29
+ -77, -77, 5, 56, 138, -40, 0, 25, 59, -34,
+ 23, 12, -77, -76, 71, -77, -77, -77, -14, -77,
+ 75, -77, -33, -64, 1, -77, -77, -7
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ If YYTABLE_NINF, parse error. */
#define YYTABLE_NINF -1
static const unsigned char yytable[] =
{
- 24, 96, 26, 28, 33, 100, 49, 52, 14, 123,
- 104, 106, 102, 126, 108, 60, 84, 85, 82, 43,
- 48, 83, 88, 91, 94, 111, 81, 110, 24, 26,
- 28, 68, 107, 24, 26, 28, 33, 86, 32, 112,
- 60, 57, 41, 86, 98, 122, 88, 91, 94, 86,
- 102, 124, 24, 26, 28, 115, 113, 127, 117, 0,
- 0, 119, 32, 32, 32, 32, 97, 41, 41, 41,
- 76, 24, 26, 28, 41, 68, 24, 26, 28, 49,
- 0, 0, 23, 0, 25, 27, 114, 0, 0, 114,
- 41, 43, 114, 48, 0, 0, 116, 59, 0, 118,
- 0, 0, 120, 0, 0, 76, 76, 76, 114, 76,
- 41, 41, 41, 0, 41, 23, 25, 27, 0, 0,
- 32, 0, 59, 32, 0, 0, 32, 87, 90, 93,
- 89, 92, 95, 0, 23, 25, 27, 105, 0, 0,
- 41, 109, 32, 69, 70, 71, 75, 0, 0, 0,
- 80, 87, 90, 93, 89, 92, 95, 0, 23, 25,
- 27, 29, 2, 30, 31, 5, 6, 7, 0, 0,
- 10, 121, 0, 57, 0, 0, 0, 0, 0, 0,
- 58, 69, 70, 71, 0, 80, 69, 70, 71, 105,
- 109, 105, 109, 105, 109, 53, 2, 54, 55, 5,
- 6, 7, 8, 0, 10, 56, 0, 57, 0, 11,
- 0, 12, 0, 0, 58, 77, 2, 78, 79, 37,
- 6, 7, 8, 0, 10, 56, 0, 57, 0, 11,
- 0, 12, 0, 0, 58, 1, 2, 3, 4, 5,
- 6, 7, 8, 0, 10, 0, 0, 0, 0, 11,
- 0, 12, 47, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 0, 0, 0, 0, 11, 0, 12,
- 1, 2, 3, 4, 5, 6, 7, 8, 0, 10,
- 0, 0, 0, 0, 11, 42, 12, 53, 2, 54,
- 55, 5, 6, 7, 8, 0, 10, 86, 0, 0,
- 0, 11, 0, 12, 77, 2, 78, 79, 37, 6,
- 7, 8, 0, 10, 86, 0, 0, 0, 11, 0,
- 12, 1, 2, 3, 4, 5, 6, 7, 8, 0,
- 10, 0, 0, 0, 0, 11, 0, 12, 34, 2,
- 35, 36, 37, 6, 7, 8, 0, 10, 0, 0,
- 0, 0, 11, 0, 12, 29, 2, 30, 31, 5,
- 6, 7, 0, 0, 10, 56, 72, 2, 73, 74,
- 37, 6, 7, 0, 0, 10, 56, 29, 2, 30,
- 31, 5, 6, 7, 0, 0, 10, 72, 2, 73,
- 74, 37, 6, 7, 0, 0, 10
+ 8, 73, 24, 88, 29, 29, 35, 38, 46, 28,
+ 34, 92, 9, 93, 29, 109, 29, 29, 111, 117,
+ 9, 113, 118, 124, 29, 125, 126, 78, 90, 29,
+ 93, 47, 69, 102, 78, 43, 100, 56, 123, 58,
+ 60, 65, 74, 24, 29, 75, 46, 72, 43, 89,
+ 76, 77, 72, 116, 78, 90, 7, 115, 9, 78,
+ 69, 103, 56, 58, 60, 119, 29, 29, 29, 72,
+ 104, 0, 0, 24, 94, 29, 96, 29, 35, 97,
+ 28, 0, 34, 127, 56, 58, 60, 99, 0, 56,
+ 58, 60, 0, 24, 124, 0, 125, 126, 79, 82,
+ 85, 0, 47, 0, 78, 47, 43, 0, 47, 95,
+ 80, 83, 86, 98, 81, 84, 87, 0, 0, 0,
+ 0, 47, 0, 24, 0, 79, 82, 85, 56, 58,
+ 60, 0, 0, 0, 0, 0, 0, 80, 83, 86,
+ 0, 81, 84, 87, 0, 0, 0, 0, 114, 0,
+ 108, 0, 55, 110, 57, 59, 112, 0, 0, 0,
+ 0, 0, 70, 0, 120, 121, 122, 70, 98, 0,
+ 98, 0, 98, 1, 2, 3, 80, 83, 86, 0,
+ 4, 0, 5, 120, 121, 122, 0, 0, 0, 0,
+ 0, 108, 110, 112, 0, 80, 83, 86, 0, 0,
+ 0, 0, 0, 0, 55, 57, 59, 66, 15, 67,
+ 68, 18, 19, 20, 1, 0, 3, 42, 69, 43,
+ 0, 4, 0, 5, 0, 0, 44, 39, 15, 40,
+ 41, 18, 19, 20, 1, 0, 3, 42, 0, 43,
+ 0, 4, 0, 5, 0, 0, 44, 66, 15, 67,
+ 68, 18, 19, 20, 1, 0, 3, 42, 0, 43,
+ 0, 4, 0, 5, 0, 0, 44, 105, 15, 106,
+ 107, 18, 19, 20, 0, 0, 3, 0, 0, 43,
+ 0, 0, 0, 0, 0, 0, 44, 61, 15, 62,
+ 63, 18, 19, 20, 0, 0, 3, 0, 0, 43,
+ 0, 0, 0, 0, 0, 0, 44, 14, 15, 16,
+ 17, 18, 19, 20, 1, 0, 3, 0, 0, 0,
+ 0, 4, 0, 5, 33, 66, 15, 67, 68, 18,
+ 19, 20, 1, 0, 3, 78, 0, 43, 0, 4,
+ 0, 5, 14, 15, 16, 17, 18, 19, 20, 1,
+ 0, 3, 0, 0, 0, 0, 4, 27, 5, 14,
+ 15, 16, 17, 18, 19, 20, 1, 0, 3, 0,
+ 0, 0, 0, 4, 0, 5, 39, 15, 40, 41,
+ 18, 19, 20, 0, 0, 3, 78, 0, 43, 105,
+ 15, 106, 107, 18, 19, 20, 0, 0, 3, 78,
+ 0, 43, 61, 15, 62, 63, 18, 19, 20, 0,
+ 0, 3, 42, 61, 15, 62, 63, 18, 19, 20,
+ 0, 0, 3
};
static const yysigned_char yycheck[] =
{
- 1, 57, 3, 4, 5, 59, 12, 0, 0, 105,
- 63, 64, 14, 109, 67, 16, 20, 21, 18, 11,
- 12, 21, 53, 54, 55, 81, 16, 80, 29, 30,
- 31, 32, 16, 34, 35, 36, 37, 13, 5, 83,
- 41, 15, 9, 13, 14, 99, 77, 78, 79, 13,
- 14, 107, 53, 54, 55, 87, 85, 109, 90, -1,
- -1, 93, 29, 30, 31, 32, 58, 34, 35, 36,
- 37, 72, 73, 74, 41, 76, 77, 78, 79, 85,
- -1, -1, 1, -1, 3, 4, 87, -1, -1, 90,
- 57, 83, 93, 85, -1, -1, 87, 16, -1, 90,
- -1, -1, 93, -1, -1, 72, 73, 74, 109, 76,
- 77, 78, 79, -1, 81, 34, 35, 36, -1, -1,
- 87, -1, 41, 90, -1, -1, 93, 53, 54, 55,
- 53, 54, 55, -1, 53, 54, 55, 63, -1, -1,
- 107, 67, 109, 34, 35, 36, 37, -1, -1, -1,
- 41, 77, 78, 79, 77, 78, 79, -1, 77, 78,
- 79, 3, 4, 5, 6, 7, 8, 9, -1, -1,
- 12, 97, -1, 15, -1, -1, -1, -1, -1, -1,
- 22, 72, 73, 74, -1, 76, 77, 78, 79, 115,
- 116, 117, 118, 119, 120, 3, 4, 5, 6, 7,
- 8, 9, 10, -1, 12, 13, -1, 15, -1, 17,
- -1, 19, -1, -1, 22, 3, 4, 5, 6, 7,
+ 0, 16, 2, 43, 4, 5, 5, 0, 8, 4,
+ 5, 45, 0, 16, 14, 79, 16, 17, 82, 95,
+ 8, 85, 98, 3, 24, 5, 6, 13, 14, 29,
+ 16, 8, 14, 73, 13, 15, 70, 14, 16, 16,
+ 17, 18, 18, 43, 44, 21, 46, 24, 15, 44,
+ 20, 21, 29, 93, 13, 14, 0, 91, 46, 13,
+ 14, 75, 39, 40, 41, 98, 66, 67, 68, 46,
+ 77, -1, -1, 73, 49, 75, 51, 77, 77, 54,
+ 75, -1, 77, 123, 61, 62, 63, 64, -1, 66,
+ 67, 68, -1, 93, 3, -1, 5, 6, 39, 40,
+ 41, -1, 79, -1, 13, 82, 15, -1, 85, 50,
+ 39, 40, 41, 54, 39, 40, 41, -1, -1, -1,
+ -1, 98, -1, 123, -1, 66, 67, 68, 105, 106,
+ 107, -1, -1, -1, -1, -1, -1, 66, 67, 68,
+ -1, 66, 67, 68, -1, -1, -1, -1, 89, -1,
+ 79, -1, 14, 82, 16, 17, 85, -1, -1, -1,
+ -1, -1, 24, -1, 105, 106, 107, 29, 109, -1,
+ 111, -1, 113, 10, 11, 12, 105, 106, 107, -1,
+ 17, -1, 19, 124, 125, 126, -1, -1, -1, -1,
+ -1, 120, 121, 122, -1, 124, 125, 126, -1, -1,
+ -1, -1, -1, -1, 66, 67, 68, 3, 4, 5,
+ 6, 7, 8, 9, 10, -1, 12, 13, 14, 15,
+ -1, 17, -1, 19, -1, -1, 22, 3, 4, 5,
+ 6, 7, 8, 9, 10, -1, 12, 13, -1, 15,
+ -1, 17, -1, 19, -1, -1, 22, 3, 4, 5,
+ 6, 7, 8, 9, 10, -1, 12, 13, -1, 15,
+ -1, 17, -1, 19, -1, -1, 22, 3, 4, 5,
+ 6, 7, 8, 9, -1, -1, 12, -1, -1, 15,
+ -1, -1, -1, -1, -1, -1, 22, 3, 4, 5,
+ 6, 7, 8, 9, -1, -1, 12, -1, -1, 15,
+ -1, -1, -1, -1, -1, -1, 22, 3, 4, 5,
+ 6, 7, 8, 9, 10, -1, 12, -1, -1, -1,
+ -1, 17, -1, 19, 20, 3, 4, 5, 6, 7,
8, 9, 10, -1, 12, 13, -1, 15, -1, 17,
- -1, 19, -1, -1, 22, 3, 4, 5, 6, 7,
- 8, 9, 10, -1, 12, -1, -1, -1, -1, 17,
- -1, 19, 20, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, -1, -1, -1, -1, 17, -1, 19,
- 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
- -1, -1, -1, -1, 17, 18, 19, 3, 4, 5,
- 6, 7, 8, 9, 10, -1, 12, 13, -1, -1,
- -1, 17, -1, 19, 3, 4, 5, 6, 7, 8,
- 9, 10, -1, 12, 13, -1, -1, -1, 17, -1,
- 19, 3, 4, 5, 6, 7, 8, 9, 10, -1,
- 12, -1, -1, -1, -1, 17, -1, 19, 3, 4,
- 5, 6, 7, 8, 9, 10, -1, 12, -1, -1,
- -1, -1, 17, -1, 19, 3, 4, 5, 6, 7,
- 8, 9, -1, -1, 12, 13, 3, 4, 5, 6,
- 7, 8, 9, -1, -1, 12, 13, 3, 4, 5,
- 6, 7, 8, 9, -1, -1, 12, 3, 4, 5,
- 6, 7, 8, 9, -1, -1, 12
+ -1, 19, 3, 4, 5, 6, 7, 8, 9, 10,
+ -1, 12, -1, -1, -1, -1, 17, 18, 19, 3,
+ 4, 5, 6, 7, 8, 9, 10, -1, 12, -1,
+ -1, -1, -1, 17, -1, 19, 3, 4, 5, 6,
+ 7, 8, 9, -1, -1, 12, 13, -1, 15, 3,
+ 4, 5, 6, 7, 8, 9, -1, -1, 12, 13,
+ -1, 15, 3, 4, 5, 6, 7, 8, 9, -1,
+ -1, 12, 13, 3, 4, 5, 6, 7, 8, 9,
+ -1, -1, 12
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const unsigned char yystos[] =
{
- 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 17, 19, 24, 25, 26, 29, 33, 34, 35,
- 39, 42, 49, 26, 33, 26, 33, 26, 33, 3,
- 5, 6, 29, 33, 3, 5, 6, 7, 25, 27,
- 28, 29, 18, 25, 40, 41, 48, 20, 25, 48,
- 50, 51, 0, 3, 5, 6, 13, 15, 22, 26,
- 33, 36, 37, 38, 43, 44, 46, 47, 33, 28,
- 28, 28, 3, 5, 6, 28, 29, 3, 5, 6,
- 28, 16, 18, 21, 20, 21, 13, 31, 37, 43,
- 31, 37, 43, 31, 37, 43, 27, 25, 14, 31,
- 32, 32, 14, 30, 30, 31, 30, 16, 30, 31,
- 30, 27, 41, 51, 33, 38, 47, 38, 47, 38,
- 47, 31, 32, 36, 27, 45, 36, 46
+ 0, 10, 11, 12, 17, 19, 24, 26, 29, 34,
+ 35, 39, 42, 48, 3, 4, 5, 6, 7, 8,
+ 9, 25, 27, 28, 29, 33, 34, 18, 25, 29,
+ 40, 41, 47, 20, 25, 47, 49, 50, 0, 3,
+ 5, 6, 13, 15, 22, 26, 29, 33, 36, 37,
+ 38, 43, 44, 45, 46, 27, 33, 27, 33, 27,
+ 33, 3, 5, 6, 29, 33, 3, 5, 6, 14,
+ 27, 30, 33, 16, 18, 21, 20, 21, 13, 31,
+ 37, 43, 31, 37, 43, 31, 37, 43, 28, 25,
+ 14, 31, 32, 16, 30, 31, 30, 30, 31, 33,
+ 32, 32, 28, 41, 50, 3, 5, 6, 37, 46,
+ 37, 46, 37, 46, 31, 32, 28, 36, 36, 45,
+ 31, 31, 31, 16, 3, 5, 6, 28
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -603,13 +604,12 @@ static const unsigned char yystos[] =
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
+#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
+#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
@@ -625,13 +625,13 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
+ yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
- yyerror ("syntax error: cannot back up");\
+ yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
while (0)
@@ -643,19 +643,19 @@ while (0)
are run). */
#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- ((Current).first_line = (Rhs)[1].first_line, \
- (Current).first_column = (Rhs)[1].first_column, \
- (Current).last_line = (Rhs)[N].last_line, \
- (Current).last_column = (Rhs)[N].last_column)
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ Current.first_line = Rhs[1].first_line; \
+ Current.first_column = Rhs[1].first_column; \
+ Current.last_line = Rhs[N].last_line; \
+ Current.last_column = Rhs[N].last_column;
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
+# define YYLEX yylex (&yylval, YYLEX_PARAM)
#else
-# define YYLEX yylex (&yylval)
+# define YYLEX yylex (&yylval)
#endif
/* Enable debugging if requested. */
@@ -671,93 +671,19 @@ do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
-
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
} while (0)
-
-# define YYDSYMPRINTF(Title, Token, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Token, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_stack_print (short int *bottom, short int *top)
-#else
-static void
-yy_stack_print (bottom, top)
- short int *bottom;
- short int *top;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (/* Nothing. */; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_reduce_print (int yyrule)
-#else
-static void
-yy_reduce_print (yyrule)
- int yyrule;
-#endif
-{
- int yyi;
- unsigned int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
- yyrule - 1, yylno);
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
- YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
- YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (Rule); \
-} while (0)
-
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
-# define YYDSYMPRINTF(Title, Token, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
-
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
@@ -770,7 +696,7 @@ int yydebug;
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
-#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
+#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif
@@ -836,111 +762,102 @@ yystpcpy (yydest, yysrc)
#if YYDEBUG
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*-----------------------------.
+| Print this symbol on YYOUT. |
+`-----------------------------*/
-#if defined (__STDC__) || defined (__cplusplus)
static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
+#if defined (__STDC__) || defined (__cplusplus)
+yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
#else
-static void
-yysymprint (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
+yysymprint (yyout, yytype, yyvalue)
+ FILE* yyout;
int yytype;
- YYSTYPE *yyvaluep;
+ YYSTYPE yyvalue;
#endif
{
/* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
+ (void) yyvalue;
if (yytype < YYNTOKENS)
{
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ YYFPRINTF (yyout, "token %s (", yytname[yytype]);
# ifdef YYPRINT
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyout, yytoknum[yytype], yyvalue);
# endif
}
else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
switch (yytype)
{
default:
break;
}
- YYFPRINTF (yyoutput, ")");
+ YYFPRINTF (yyout, ")");
}
+#endif /* YYDEBUG. */
+
-#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-#if defined (__STDC__) || defined (__cplusplus)
static void
-yydestruct (int yytype, YYSTYPE *yyvaluep)
+#if defined (__STDC__) || defined (__cplusplus)
+yydestruct (int yytype, YYSTYPE yyvalue)
#else
-static void
-yydestruct (yytype, yyvaluep)
+yydestruct (yytype, yyvalue)
int yytype;
- YYSTYPE *yyvaluep;
+ YYSTYPE yyvalue;
#endif
{
/* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
+ (void) yyvalue;
switch (yytype)
{
-
default:
break;
}
}
+
-/* Prevent warnings from -Wmissing-prototypes. */
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into yyparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM);
+# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
+# define YYPARSE_PARAM_DECL
# else
-int yyparse ();
+# define YYPARSE_PARAM_ARG YYPARSE_PARAM
+# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
+#else /* !YYPARSE_PARAM */
+# define YYPARSE_PARAM_ARG
+# define YYPARSE_PARAM_DECL
+#endif /* !YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+# ifdef YYPARSE_PARAM
+int yyparse (void *);
+# else
int yyparse (void);
-#else
-int yyparse ();
+# endif
#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
+yyparse (YYPARSE_PARAM_ARG)
+ YYPARSE_PARAM_DECL
{
/* The lookahead symbol. */
int yychar;
@@ -948,7 +865,7 @@ int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
+/* Number of parse errors so far. */
int yynerrs;
register int yystate;
@@ -957,7 +874,7 @@ int yynerrs;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
+ int yychar1 = 0;
/* Three stacks and their tools:
`yyss': related to states,
@@ -968,9 +885,9 @@ int yynerrs;
to reallocate them elsewhere. */
/* The state stack. */
- short int yyssa[YYINITDEPTH];
- short int *yyss = yyssa;
- register short int *yyssp;
+ short yyssa[YYINITDEPTH];
+ short *yyss = yyssa;
+ register short *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
@@ -1007,7 +924,6 @@ int yynerrs;
yyssp = yyss;
yyvsp = yyvs;
-
goto yysetstate;
/*------------------------------------------------------------.
@@ -1022,7 +938,7 @@ int yynerrs;
yysetstate:
*yyssp = yystate;
- if (yyss + yystacksize - 1 <= yyssp)
+ if (yyssp >= yyss + yystacksize - 1)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
@@ -1033,7 +949,7 @@ int yynerrs;
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
- short int *yyss1 = yyss;
+ short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
@@ -1054,14 +970,14 @@ int yynerrs;
goto yyoverflowlab;
# else
/* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
+ if (yystacksize >= YYMAXDEPTH)
goto yyoverflowlab;
yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
+ if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
{
- short int *yyss1 = yyss;
+ short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
@@ -1083,7 +999,7 @@ int yynerrs;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
- if (yyss + yystacksize - 1 <= yyssp)
+ if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
@@ -1108,28 +1024,39 @@ yybackup:
/* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
- if (yychar <= YYEOF)
+ /* Convert token to internal form (in yychar1) for indexing tables with. */
+
+ if (yychar <= 0) /* This means end of input. */
{
- yychar = yytoken = YYEOF;
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more. */
+
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
- yytoken = YYTRANSLATE (yychar);
- YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
+ yychar1 = YYTRANSLATE (yychar);
+
+ /* We have to keep this `#if YYDEBUG', since we use variables
+ which are defined only if `YYDEBUG' is set. */
+ YYDPRINTF ((stderr, "Next token is "));
+ YYDSYMPRINT ((stderr, yychar1, yylval));
+ YYDPRINTF ((stderr, "\n"));
}
- /* If the proper action on seeing token YYTOKEN is to reduce or to
+ /* If the proper action on seeing token YYCHAR1 is to reduce or to
detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ yyn += yychar1;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
@@ -1144,7 +1071,8 @@ yybackup:
YYACCEPT;
/* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
+ YYDPRINTF ((stderr, "Shifting token %d (%s), ",
+ yychar, yytname[yychar1]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
@@ -1190,48 +1118,71 @@ yyreduce:
yyval = yyvsp[1-yylen];
- YY_REDUCE_PRINT (yyn);
+
+#if YYDEBUG
+ /* We have to keep this `#if YYDEBUG', since we use variables which
+ are defined only if `YYDEBUG' is set. */
+ if (yydebug)
+ {
+ int yyi;
+
+ YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
+ yyn - 1, yyrline[yyn]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
+ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
+ YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ }
+#endif
switch (yyn)
{
case 2:
-#line 57 "gram.y"
+#line 55 "gram.y"
{
((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
}
break;
case 3:
-#line 61 "gram.y"
+#line 59 "gram.y"
{
((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
}
break;
case 4:
-#line 65 "gram.y"
+#line 63 "gram.y"
{
((SyckParser *)parser)->eof = 1;
}
break;
case 8:
-#line 76 "gram.y"
+#line 74 "gram.y"
+ {
+ yyval.nodeData = yyvsp[-1].nodeData;
+ }
+ break;
+
+ case 10:
+#line 81 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 9:
-#line 81 "gram.y"
+ case 11:
+#line 86 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 10:
-#line 86 "gram.y"
+ case 12:
+#line 91 "gram.y"
{
/*
* _Anchors_: The language binding must keep a separate symbol table
@@ -1242,22 +1193,15 @@ yyreduce:
}
break;
- case 11:
-#line 95 "gram.y"
+ case 13:
+#line 100 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 14:
-#line 105 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
case 15:
-#line 109 "gram.y"
+#line 107 "gram.y"
{
NULL_NODE( parser, n );
yyval.nodeData = n;
@@ -1265,62 +1209,31 @@ yyreduce:
break;
case 16:
-#line 114 "gram.y"
- {
- if ( ((SyckParser *)parser)->implicit_typing == 1 )
- {
- try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- }
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 17:
-#line 122 "gram.y"
- {
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 18:
-#line 127 "gram.y"
+#line 112 "gram.y"
{
- syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
- yyval.nodeData = yyvsp[0].nodeData;
- }
- break;
-
- case 19:
-#line 132 "gram.y"
- {
- /*
- * _Anchors_: The language binding must keep a separate symbol table
- * for anchors. The actual ID in the symbol table is returned to the
- * higher nodes, though.
- */
- yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
+ NULL_NODE( parser, n );
+ yyval.nodeData = n;
}
break;
- case 26:
-#line 165 "gram.y"
+ case 23:
+#line 141 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 27:
-#line 170 "gram.y"
+ case 24:
+#line 146 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 28:
-#line 175 "gram.y"
+ case 25:
+#line 151 "gram.y"
{
if ( ((SyckParser *)parser)->implicit_typing == 1 )
{
@@ -1330,15 +1243,15 @@ yyreduce:
}
break;
- case 29:
-#line 183 "gram.y"
+ case 26:
+#line 159 "gram.y"
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
}
break;
- case 30:
-#line 187 "gram.y"
+ case 27:
+#line 163 "gram.y"
{
/*
* _Aliases_: The anchor symbol table is scanned for the anchor name.
@@ -1348,8 +1261,8 @@ yyreduce:
}
break;
- case 31:
-#line 195 "gram.y"
+ case 28:
+#line 171 "gram.y"
{
SyckNode *n = yyvsp[0].nodeData;
if ( ((SyckParser *)parser)->taguri_expansion == 1 )
@@ -1364,212 +1277,207 @@ yyreduce:
}
break;
- case 33:
-#line 209 "gram.y"
+ case 30:
+#line 185 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 39:
-#line 229 "gram.y"
+ case 36:
+#line 205 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 40:
-#line 233 "gram.y"
- {
- yyval.nodeData = yyvsp[-1].nodeData;
- }
- break;
-
- case 41:
-#line 239 "gram.y"
+ case 37:
+#line 211 "gram.y"
{
yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
}
break;
- case 42:
-#line 245 "gram.y"
+ case 39:
+#line 218 "gram.y"
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 43:
-#line 250 "gram.y"
+ case 40:
+#line 223 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 44:
-#line 255 "gram.y"
+ case 41:
+#line 228 "gram.y"
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 45:
-#line 260 "gram.y"
+ case 42:
+#line 233 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 46:
-#line 265 "gram.y"
+ case 43:
+#line 238 "gram.y"
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
}
break;
- case 47:
-#line 269 "gram.y"
+ case 44:
+#line 242 "gram.y"
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
}
break;
- case 48:
-#line 275 "gram.y"
+ case 45:
+#line 248 "gram.y"
{
yyval.nodeData = syck_new_seq( yyvsp[0].nodeId );
}
break;
- case 49:
-#line 279 "gram.y"
+ case 46:
+#line 252 "gram.y"
{
syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId );
yyval.nodeData = yyvsp[-2].nodeData;
}
break;
- case 50:
-#line 284 "gram.y"
+ case 47:
+#line 257 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 51:
-#line 293 "gram.y"
+ case 48:
+#line 266 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 52:
-#line 297 "gram.y"
+ case 49:
+#line 270 "gram.y"
{
yyval.nodeData = syck_alloc_seq();
}
break;
- case 53:
-#line 303 "gram.y"
+ case 50:
+#line 276 "gram.y"
{
yyval.nodeData = syck_new_seq( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
}
break;
- case 54:
-#line 307 "gram.y"
+ case 51:
+#line 280 "gram.y"
{
syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
yyval.nodeData = yyvsp[-2].nodeData;
}
break;
- case 57:
-#line 321 "gram.y"
+ case 54:
+#line 294 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 58:
-#line 326 "gram.y"
+ case 55:
+#line 299 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 59:
-#line 333 "gram.y"
+ case 56:
+#line 306 "gram.y"
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 60:
-#line 338 "gram.y"
+ case 57:
+#line 311 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 61:
-#line 343 "gram.y"
+ case 58:
+#line 316 "gram.y"
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 62:
-#line 348 "gram.y"
+ case 59:
+#line 321 "gram.y"
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
break;
- case 63:
-#line 353 "gram.y"
+ case 60:
+#line 326 "gram.y"
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
}
break;
- case 64:
-#line 357 "gram.y"
+ case 61:
+#line 330 "gram.y"
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
}
break;
- case 66:
-#line 364 "gram.y"
+ case 62:
+#line 336 "gram.y"
{
- yyval.nodeData = yyvsp[-1].nodeData;
+ yyval.nodeData = syck_new_map(
+ syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
+ syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
}
break;
- case 68:
-#line 380 "gram.y"
+ case 64:
+#line 352 "gram.y"
{
yyval.nodeData = syck_new_map(
- syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
+ syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-3].nodeData ),
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
}
break;
- case 70:
-#line 398 "gram.y"
- {
+ case 66:
+#line 370 "gram.y"
+ {
if ( yyvsp[-2].nodeData->shortcut == NULL )
{
yyvsp[-2].nodeData->shortcut = syck_new_seq( yyvsp[0].nodeId );
@@ -1582,9 +1490,9 @@ yyreduce:
}
break;
- case 71:
-#line 410 "gram.y"
- {
+ case 67:
+#line 382 "gram.y"
+ {
apply_seq_in_map( (SyckParser *)parser, yyvsp[-2].nodeData );
syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
syck_free_node( yyvsp[0].nodeData );
@@ -1593,15 +1501,15 @@ yyreduce:
}
break;
- case 72:
-#line 418 "gram.y"
- {
+ case 68:
+#line 390 "gram.y"
+ {
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 73:
-#line 427 "gram.y"
+ case 69:
+#line 399 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
@@ -1609,22 +1517,22 @@ yyreduce:
}
break;
- case 74:
-#line 435 "gram.y"
+ case 70:
+#line 407 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 75:
-#line 439 "gram.y"
+ case 71:
+#line 411 "gram.y"
{
yyval.nodeData = syck_alloc_map();
}
break;
- case 77:
-#line 446 "gram.y"
+ case 73:
+#line 418 "gram.y"
{
syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
syck_free_node( yyvsp[0].nodeData );
@@ -1633,8 +1541,8 @@ yyreduce:
}
break;
- case 78:
-#line 455 "gram.y"
+ case 74:
+#line 427 "gram.y"
{
NULL_NODE( parser, n );
yyval.nodeData = syck_new_map(
@@ -1646,14 +1554,23 @@ yyreduce:
}
-/* Line 1010 of yacc.c. */
-#line 1651 "gram.c"
+/* Line 1016 of /usr/local/share/bison/yacc.c. */
+#line 1559 "y.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
- YY_STACK_PRINT (yyss, yyssp);
+#if YYDEBUG
+ if (yydebug)
+ {
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
+ }
+#endif
*++yyvsp = yyval;
@@ -1688,118 +1605,88 @@ yyerrlab:
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
- const char* yyprefix;
char *yymsg;
- int yyx;
+ int yyx, yycount;
+ yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 0;
-
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
- yycount += 1;
- if (yycount == 5)
- {
- yysize = 0;
- break;
- }
- }
- yysize += (sizeof ("syntax error, unexpected ")
- + yystrlen (yytname[yytype]));
+ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
+ yysize += yystrlen ("parse error, unexpected ") + 1;
+ yysize += yystrlen (yytname[yytype]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
- char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
+ char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
if (yycount < 5)
{
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ yycount = 0;
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *));
+ yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
- yyp = yystpcpy (yyp, yyprefix);
+ const char *yyq = ! yycount ? ", expecting " : " or ";
+ yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
- yyprefix = " or ";
+ yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
- yyerror ("syntax error; also virtual memory exhausted");
+ yyerror ("parse error; also virtual memory exhausted");
}
else
#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
+ yyerror ("parse error");
}
+ goto yyerrlab1;
-
+/*----------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action. |
+`----------------------------------------------------*/
+yyerrlab1:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
- if (yychar <= YYEOF)
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
{
- /* If at end of input, pop the error token,
- then the rest of the stack, then return failure. */
- if (yychar == YYEOF)
- for (;;)
- {
- YYPOPSTACK;
- if (yyssp == yyss)
- YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[*yyssp], yyvsp);
- }
+ /* Pop the error token. */
+ YYPOPSTACK;
+ /* Pop the rest of the stack. */
+ while (yyssp > yyss)
+ {
+ YYDPRINTF ((stderr, "Error: popping "));
+ YYDSYMPRINT ((stderr,
+ yystos[*yyssp],
+ *yyvsp));
+ YYDPRINTF ((stderr, "\n"));
+ yydestruct (yystos[*yyssp], *yyvsp);
+ YYPOPSTACK;
+ }
+ YYABORT;
}
- else
- {
- YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
- yydestruct (yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
+ yychar, yytname[yychar1]));
+ yydestruct (yychar1, yylval);
+ yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
-#ifdef __GNUC__
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
- if (0)
- goto yyerrorlab;
-#endif
-
- yyvsp -= yylen;
- yyssp -= yylen;
- yystate = *yyssp;
- goto yyerrlab1;
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
@@ -1820,11 +1707,26 @@ yyerrlab1:
if (yyssp == yyss)
YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[yystate], yyvsp);
- YYPOPSTACK;
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
+ YYDPRINTF ((stderr, "Error: popping "));
+ YYDSYMPRINT ((stderr,
+ yystos[*yyssp], *yyvsp));
+ YYDPRINTF ((stderr, "\n"));
+
+ yydestruct (yystos[yystate], *yyvsp);
+ yyvsp--;
+ yystate = *--yyssp;
+
+
+#if YYDEBUG
+ if (yydebug)
+ {
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "Error: state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
+ }
+#endif
}
if (yyn == YYFINAL)
@@ -1872,7 +1774,7 @@ yyreturn:
}
-#line 464 "gram.y"
+#line 436 "gram.y"
void
diff --git a/ext/syck/gram.h b/ext/syck/gram.h
index 547149ab4b..4c0e199832 100644
--- a/ext/syck/gram.h
+++ b/ext/syck/gram.h
@@ -1,7 +1,7 @@
-/* A Bison parser, made by GNU Bison 1.875d. */
+/* A Bison parser, made from gram.y, by GNU bison 1.75. */
/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,9 @@
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
+#ifndef BISON_Y_TAB_H
+# define BISON_Y_TAB_H
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -59,21 +62,20 @@
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 35 "gram.y"
-typedef union YYSTYPE {
+#ifndef YYSTYPE
+#line 33 "gram.y"
+typedef union {
SYMID nodeId;
SyckNode *nodeData;
char *name;
-} YYSTYPE;
-/* Line 1285 of yacc.c. */
-#line 71 "gram.h"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
+} yystype;
+/* Line 1281 of /usr/local/share/bison/yacc.c. */
+#line 74 "y.tab.h"
+# define YYSTYPE yystype
#endif
+#endif /* not BISON_Y_TAB_H */
diff --git a/ext/syck/handler.c b/ext/syck/handler.c
index 26fb258318..563feb10ae 100644
--- a/ext/syck/handler.c
+++ b/ext/syck/handler.c
@@ -1,8 +1,8 @@
/*
* handler.c
*
- * $Author: why $
- * $Date: 2005/09/20 06:46:43 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -31,8 +31,6 @@ syck_hdlr_add_node( SyckParser *p, SyckNode *n )
SyckNode *
syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
{
- SyckNode *ntmp = NULL;
-
n->anchor = a;
if ( p->bad_anchors != NULL )
{
@@ -50,13 +48,6 @@ syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
{
p->anchors = st_init_strtable();
}
- if ( st_lookup( p->anchors, (st_data_t)a, (st_data_t *)&ntmp ) )
- {
- if ( ntmp != (void *)1 )
- {
- syck_free_node( ntmp );
- }
- }
st_insert( p->anchors, (st_data_t)a, (st_data_t)n );
return n;
}
@@ -64,19 +55,10 @@ syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
void
syck_hdlr_remove_anchor( SyckParser *p, char *a )
{
- char *atmp = a;
- SyckNode *ntmp;
if ( p->anchors == NULL )
{
p->anchors = st_init_strtable();
}
- if ( st_delete( p->anchors, (st_data_t *)&atmp, (st_data_t *)&ntmp ) )
- {
- if ( ntmp != (void *)1 )
- {
- syck_free_node( ntmp );
- }
- }
st_insert( p->anchors, (st_data_t)a, (st_data_t)1 );
}
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c
index 0f922f4d1b..66f0520233 100644
--- a/ext/syck/implicit.c
+++ b/ext/syck/implicit.c
@@ -1,10 +1,10 @@
-/* Generated by re2c 0.9.10 on Mon Sep 19 21:46:50 2005 */
+/* Generated by re2c 0.9.3 on Fri Aug 13 11:47:51 2004 */
#line 1 "implicit.re"
/*
* implicit.re
*
- * $Author: ocean $
- * $Date: 2005/10/26 00:28:39 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -36,7 +36,6 @@ try_tag_implicit( SyckNode *n, int taguri )
tid = "map";
break;
}
- if ( n->type_id != NULL ) S_FREE( n->type_id );
if ( taguri == 1 )
{
n->type_id = syck_taguri( YAML_DOMAIN, tid, strlen( tid ) );
@@ -52,17 +51,17 @@ char *syck_match_implicit( char *str, size_t len )
limit = str + len;
-#line 55 "<stdout>"
+#line 6 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
- ++YYCURSOR;
+yy1: ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 26) YYFILL(26);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy6;
+ case '\000': goto yy6;
case '+': goto yy16;
case '-': goto yy17;
case '.': goto yy20;
@@ -92,12 +91,12 @@ yy0:
default: goto yy23;
}
yy2: ++YYCURSOR;
- if((yych = *YYCURSOR) <= 0x00) goto yy6;
+ if((yych = *YYCURSOR) <= '\000') goto yy6;
goto yy3;
yy3:
-#line 123 "implicit.re"
+#line 122 "implicit.re"
{ return "str"; }
-#line 100 "<stdout>"
+#line 51 "<stdout>"
yy4: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -116,9 +115,9 @@ yy5: yyaccept = 0;
yy6: ++YYCURSOR;
goto yy7;
yy7:
-#line 85 "implicit.re"
+#line 84 "implicit.re"
{ return "null"; }
-#line 121 "<stdout>"
+#line 72 "<stdout>"
yy8: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -208,7 +207,7 @@ yy17: yyaccept = 0;
yy18: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x00: goto yy52;
+ case '\000': goto yy52;
case ',': goto yy142;
case '.': goto yy50;
case '0':
@@ -228,7 +227,7 @@ yy18: yyaccept = 0;
yy19: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x00: goto yy52;
+ case '\000': goto yy52;
case ',': goto yy47;
case '.': goto yy50;
case '0':
@@ -254,7 +253,7 @@ yy20: yyaccept = 0;
default: goto yy3;
}
yy21: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy28;
+ if(yych <= '\000') goto yy28;
goto yy3;
yy22: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -265,7 +264,7 @@ yy22: yyaccept = 0;
yy23: yych = *++YYCURSOR;
goto yy3;
yy24: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy26;
+ if(yych <= '\000') goto yy26;
goto yy25;
yy25: YYCURSOR = YYMARKER;
switch(yyaccept){
@@ -274,15 +273,15 @@ yy25: YYCURSOR = YYMARKER;
yy26: ++YYCURSOR;
goto yy27;
yy27:
-#line 121 "implicit.re"
+#line 120 "implicit.re"
{ return "merge"; }
-#line 279 "<stdout>"
+#line 230 "<stdout>"
yy28: ++YYCURSOR;
goto yy29;
yy29:
-#line 119 "implicit.re"
+#line 118 "implicit.re"
{ return "default"; }
-#line 285 "<stdout>"
+#line 236 "<stdout>"
yy30: yych = *++YYCURSOR;
switch(yych){
case 'a': goto yy45;
@@ -316,14 +315,14 @@ yy35: yych = *++YYCURSOR;
default: goto yy25;
}
yy36: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
+ if(yych >= '\001') goto yy25;
goto yy37;
yy37: ++YYCURSOR;
goto yy38;
yy38:
-#line 105 "implicit.re"
+#line 104 "implicit.re"
{ return "float#inf"; }
-#line 326 "<stdout>"
+#line 277 "<stdout>"
yy39: yych = *++YYCURSOR;
switch(yych){
case 'f': goto yy36;
@@ -340,14 +339,14 @@ yy41: yych = *++YYCURSOR;
default: goto yy25;
}
yy42: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
+ if(yych >= '\001') goto yy25;
goto yy43;
yy43: ++YYCURSOR;
goto yy44;
yy44:
-#line 109 "implicit.re"
+#line 108 "implicit.re"
{ return "float#nan"; }
-#line 350 "<stdout>"
+#line 301 "<stdout>"
yy45: yych = *++YYCURSOR;
switch(yych){
case 'n': goto yy42;
@@ -372,7 +371,7 @@ yy47: ++YYCURSOR;
yych = *YYCURSOR;
goto yy48;
yy48: switch(yych){
- case 0x00: goto yy52;
+ case '\000': goto yy52;
case ',': case '0':
case '1':
case '2':
@@ -404,11 +403,11 @@ yy49: ++YYCURSOR;
default: goto yy25;
}
yy50: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy51;
yy51: switch(yych){
- case 0x00: goto yy56;
+ case '\000': goto yy56;
case ',': goto yy54;
case '.': goto yy58;
case '0':
@@ -427,15 +426,15 @@ yy51: switch(yych){
yy52: ++YYCURSOR;
goto yy53;
yy53:
-#line 97 "implicit.re"
+#line 96 "implicit.re"
{ return "int"; }
-#line 432 "<stdout>"
+#line 386 "<stdout>"
yy54: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy55;
yy55: switch(yych){
- case 0x00: goto yy56;
+ case '\000': goto yy56;
case ',': case '0':
case '1':
case '2':
@@ -451,11 +450,11 @@ yy55: switch(yych){
yy56: ++YYCURSOR;
goto yy57;
yy57:
-#line 99 "implicit.re"
+#line 98 "implicit.re"
{ return "float#fix"; }
-#line 456 "<stdout>"
+#line 411 "<stdout>"
yy58: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy59;
yy59: switch(yych){
@@ -478,14 +477,14 @@ yy60: yych = *++YYCURSOR;
default: goto yy25;
}
yy61: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy25;
+ if(yych <= '\000') goto yy25;
goto yy63;
yy62: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy63;
yy63: switch(yych){
- case 0x00: goto yy64;
+ case '\000': goto yy64;
case '0':
case '1':
case '2':
@@ -501,14 +500,14 @@ yy63: switch(yych){
yy64: ++YYCURSOR;
goto yy65;
yy65:
-#line 101 "implicit.re"
+#line 100 "implicit.re"
{ return "float#exp"; }
-#line 506 "<stdout>"
+#line 463 "<stdout>"
yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy70;
+ case '\000': goto yy70;
case '.': goto yy68;
case '0':
case '1':
@@ -527,7 +526,7 @@ yy67: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy70;
+ case '\000': goto yy70;
case '.': goto yy68;
case ':': goto yy49;
default: goto yy25;
@@ -537,7 +536,7 @@ yy68: ++YYCURSOR;
yych = *YYCURSOR;
goto yy69;
yy69: switch(yych){
- case 0x00: goto yy72;
+ case '\000': goto yy72;
case ',': case '0':
case '1':
case '2':
@@ -553,15 +552,15 @@ yy69: switch(yych){
yy70: ++YYCURSOR;
goto yy71;
yy71:
-#line 95 "implicit.re"
+#line 94 "implicit.re"
{ return "int#base60"; }
-#line 558 "<stdout>"
+#line 518 "<stdout>"
yy72: ++YYCURSOR;
goto yy73;
yy73:
-#line 103 "implicit.re"
+#line 102 "implicit.re"
{ return "float#base60"; }
-#line 564 "<stdout>"
+#line 524 "<stdout>"
yy74: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -644,7 +643,7 @@ yy80: yych = *++YYCURSOR;
}
yy81: yych = *++YYCURSOR;
switch(yych){
- case 0x00: goto yy82;
+ case '\000': goto yy82;
case '0':
case '1':
case '2':
@@ -662,9 +661,9 @@ yy81: yych = *++YYCURSOR;
yy82: ++YYCURSOR;
goto yy83;
yy83:
-#line 111 "implicit.re"
+#line 110 "implicit.re"
{ return "timestamp#ymd"; }
-#line 667 "<stdout>"
+#line 627 "<stdout>"
yy84: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -694,11 +693,11 @@ yy85: yych = *++YYCURSOR;
default: goto yy25;
}
yy86: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 9) YYFILL(9);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy87;
yy87: switch(yych){
- case 0x09: case ' ': goto yy86;
+ case '\t': case ' ': goto yy86;
case '0':
case '1':
case '2':
@@ -793,7 +792,7 @@ yy94: yych = *++YYCURSOR;
}
yy95: yych = *++YYCURSOR;
switch(yych){
- case 0x09: case ' ': goto yy98;
+ case '\t': case ' ': goto yy98;
case '.': goto yy96;
default: goto yy25;
}
@@ -802,7 +801,7 @@ yy96: ++YYCURSOR;
yych = *YYCURSOR;
goto yy97;
yy97: switch(yych){
- case 0x09: case ' ': goto yy98;
+ case '\t': case ' ': goto yy98;
case '0':
case '1':
case '2':
@@ -816,17 +815,17 @@ yy97: switch(yych){
default: goto yy25;
}
yy98: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy99;
yy99: switch(yych){
- case 0x09: case ' ': goto yy98;
+ case '\t': case ' ': goto yy98;
case '+': case '-': goto yy101;
case 'Z': goto yy100;
default: goto yy25;
}
yy100: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy105;
+ if(yych <= '\000') goto yy105;
goto yy25;
yy101: yych = *++YYCURSOR;
switch(yych){
@@ -858,7 +857,7 @@ yy102: yych = *++YYCURSOR;
}
yy103: yych = *++YYCURSOR;
switch(yych){
- case 0x00: goto yy105;
+ case '\000': goto yy105;
case ':': goto yy104;
default: goto yy25;
}
@@ -879,9 +878,9 @@ yy104: yych = *++YYCURSOR;
yy105: ++YYCURSOR;
goto yy106;
yy106:
-#line 115 "implicit.re"
+#line 114 "implicit.re"
{ return "timestamp#spaced"; }
-#line 884 "<stdout>"
+#line 847 "<stdout>"
yy107: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -992,7 +991,7 @@ yy115: yych = *++YYCURSOR;
default: goto yy117;
}
yy116: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy117;
yy117: switch(yych){
@@ -1011,7 +1010,7 @@ yy117: switch(yych){
default: goto yy25;
}
yy118: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy123;
+ if(yych <= '\000') goto yy123;
goto yy25;
yy119: yych = *++YYCURSOR;
switch(yych){
@@ -1043,7 +1042,7 @@ yy120: yych = *++YYCURSOR;
}
yy121: yych = *++YYCURSOR;
switch(yych){
- case 0x00: goto yy123;
+ case '\000': goto yy123;
case ':': goto yy122;
default: goto yy25;
}
@@ -1064,9 +1063,9 @@ yy122: yych = *++YYCURSOR;
yy123: ++YYCURSOR;
goto yy124;
yy124:
-#line 113 "implicit.re"
+#line 112 "implicit.re"
{ return "timestamp#iso8601"; }
-#line 1069 "<stdout>"
+#line 1033 "<stdout>"
yy125: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -1197,7 +1196,7 @@ yy135: switch(yych){
default: goto yy25;
}
yy136: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
+ if(yych >= '\001') goto yy25;
goto yy137;
yy137: yych = *++YYCURSOR;
goto yy124;
@@ -1253,7 +1252,7 @@ yy142: ++YYCURSOR;
yych = *YYCURSOR;
goto yy143;
yy143: switch(yych){
- case 0x00: goto yy149;
+ case '\000': goto yy149;
case ',': case '0':
case '1':
case '2':
@@ -1269,14 +1268,14 @@ yy143: switch(yych){
default: goto yy25;
}
yy144: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy25;
+ if(yych <= '\000') goto yy25;
goto yy146;
yy145: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy146;
yy146: switch(yych){
- case 0x00: goto yy147;
+ case '\000': goto yy147;
case ',': case '0':
case '1':
case '2':
@@ -1302,15 +1301,15 @@ yy146: switch(yych){
yy147: ++YYCURSOR;
goto yy148;
yy148:
-#line 91 "implicit.re"
+#line 90 "implicit.re"
{ return "int#hex"; }
-#line 1307 "<stdout>"
+#line 1275 "<stdout>"
yy149: ++YYCURSOR;
goto yy150;
yy150:
-#line 93 "implicit.re"
+#line 92 "implicit.re"
{ return "int#oct"; }
-#line 1313 "<stdout>"
+#line 1281 "<stdout>"
yy151: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1376,7 +1375,7 @@ yy157: yych = *++YYCURSOR;
}
yy158: yych = *++YYCURSOR;
switch(yych){
- case 0x00: goto yy52;
+ case '\000': goto yy52;
case 'x': goto yy144;
default: goto yy143;
}
@@ -1402,14 +1401,14 @@ yy162: yych = *++YYCURSOR;
default: goto yy25;
}
yy163: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
+ if(yych >= '\001') goto yy25;
goto yy164;
yy164: ++YYCURSOR;
goto yy165;
yy165:
-#line 107 "implicit.re"
+#line 106 "implicit.re"
{ return "float#neginf"; }
-#line 1412 "<stdout>"
+#line 1381 "<stdout>"
yy166: yych = *++YYCURSOR;
switch(yych){
case 'f': goto yy163;
@@ -1442,14 +1441,14 @@ yy171: yych = *++YYCURSOR;
default: goto yy25;
}
yy172: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
+ if(yych >= '\001') goto yy25;
goto yy173;
yy173: ++YYCURSOR;
goto yy174;
yy174:
-#line 89 "implicit.re"
+#line 88 "implicit.re"
{ return "bool#no"; }
-#line 1452 "<stdout>"
+#line 1421 "<stdout>"
yy175: yych = *++YYCURSOR;
switch(yych){
case 'S': goto yy176;
@@ -1486,14 +1485,14 @@ yy181: yych = *++YYCURSOR;
default: goto yy25;
}
yy182: yych = *++YYCURSOR;
- if(yych >= 0x01) goto yy25;
+ if(yych >= '\001') goto yy25;
goto yy183;
yy183: ++YYCURSOR;
goto yy184;
yy184:
-#line 87 "implicit.re"
+#line 86 "implicit.re"
{ return "bool#yes"; }
-#line 1496 "<stdout>"
+#line 1465 "<stdout>"
yy185: yych = *++YYCURSOR;
switch(yych){
case 'f': goto yy172;
@@ -1560,7 +1559,7 @@ yy197: yych = *++YYCURSOR;
default: goto yy25;
}
yy198: yych = *++YYCURSOR;
- if(yych <= 0x00) goto yy6;
+ if(yych <= '\000') goto yy6;
goto yy25;
yy199: yych = *++YYCURSOR;
switch(yych){
@@ -1578,34 +1577,9 @@ yy201: ++YYCURSOR;
default: goto yy25;
}
}
-#line 125 "implicit.re"
-
+#line 124 "implicit.re"
-}
-/* Remove ending fragment and compare types */
-int
-syck_tagcmp( char *tag1, char *tag2 )
-{
- if ( tag1 == tag2 ) return 1;
- if ( tag1 == NULL || tag2 == NULL ) return 0;
- else {
- int i;
- char *othorpe;
- char *tmp1 = syck_strndup( tag1, strlen( tag1 ) );
- char *tmp2 = syck_strndup( tag2, strlen( tag2 ) );
- othorpe = strstr( tmp1, "#" );
- if ( othorpe != NULL ) {
- othorpe[0] = '\0';
- }
- othorpe = strstr( tmp2, "#" );
- if ( othorpe != NULL ) {
- othorpe[0] = '\0';
- }
- i = strcmp( tmp1, tmp2 );
- S_FREE( tmp1 ); S_FREE( tmp2 );
- return i;
- }
}
char *
@@ -1617,17 +1591,17 @@ syck_type_id_to_uri( char *type_id )
limit = type_id + strlen( type_id );
-#line 1620 "<stdout>"
+#line 1552 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy202;
- ++YYCURSOR;
+yy203: ++YYCURSOR;
yy202:
- if((YYLIMIT - YYCURSOR) < 11) YYFILL(11);
+ if((YYLIMIT - YYCURSOR) < 21) YYFILL(21);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy204;
+ case '\000': goto yy204;
case '!': goto yy208;
case '0':
case '1':
@@ -1763,9 +1737,9 @@ yy205: yyaccept = 0;
default: goto yy206;
}
yy206:
-#line 202 "implicit.re"
+#line 176 "implicit.re"
{ return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); }
-#line 1768 "<stdout>"
+#line 1700 "<stdout>"
yy207: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -1837,9 +1811,9 @@ yy207: yyaccept = 0;
yy208: ++YYCURSOR;
goto yy209;
yy209:
-#line 176 "implicit.re"
+#line 150 "implicit.re"
{ return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); }
-#line 1842 "<stdout>"
+#line 1774 "<stdout>"
yy210: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -1980,7 +1954,7 @@ yy213: switch(yych){
default: goto yy204;
}
yy214: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy215;
yy215: switch(yych){
@@ -2133,7 +2107,7 @@ yy217: ++YYCURSOR;
yy218: ++YYCURSOR;
goto yy219;
yy219:
-#line 178 "implicit.re"
+#line 152 "implicit.re"
{ char *domain = S_ALLOC_N( char, ( YYCURSOR - type_id ) + 15 );
char *uri;
@@ -2146,9 +2120,9 @@ yy219:
S_FREE( domain );
return uri;
}
-#line 2149 "<stdout>"
+#line 2084 "<stdout>"
yy220: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 12) YYFILL(12);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy221;
yy221: switch(yych){
@@ -2351,7 +2325,7 @@ yy228: yych = *++YYCURSOR;
yy229: ++YYCURSOR;
goto yy230;
yy230:
-#line 191 "implicit.re"
+#line 165 "implicit.re"
{ char *domain = S_ALLOC_N( char, YYCURSOR - type_id );
char *uri;
@@ -2362,7 +2336,7 @@ yy230:
S_FREE( domain );
return uri;
}
-#line 2365 "<stdout>"
+#line 2302 "<stdout>"
yy231: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -2480,9 +2454,9 @@ yy243: yych = *++YYCURSOR;
yy244: ++YYCURSOR;
goto yy245;
yy245:
-#line 174 "implicit.re"
-{ return syck_strndup( type_id, strlen( type_id ) ); }
-#line 2485 "<stdout>"
+#line 148 "implicit.re"
+{ return type_id; }
+#line 2422 "<stdout>"
yy246: yych = *++YYCURSOR;
switch(yych){
case ',': goto yy216;
@@ -2507,7 +2481,7 @@ yy248: yych = *++YYCURSOR;
default: goto yy250;
}
yy249: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy250;
yy250: switch(yych){
@@ -2725,7 +2699,7 @@ yy254: ++YYCURSOR;
default: goto yy204;
}
yy255: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 12) YYFILL(12);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy256;
yy256: switch(yych){
@@ -2927,9 +2901,9 @@ yy263: yych = *++YYCURSOR;
yy264: ++YYCURSOR;
goto yy265;
yy265:
-#line 172 "implicit.re"
-{ return syck_strndup( type_id, strlen( type_id ) ); }
-#line 2932 "<stdout>"
+#line 146 "implicit.re"
+{ return type_id; }
+#line 2874 "<stdout>"
yy266: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -2984,7 +2958,8 @@ yy270: ++YYCURSOR;
default: goto yy204;
}
}
-#line 204 "implicit.re"
+#line 178 "implicit.re"
}
+
diff --git a/ext/syck/node.c b/ext/syck/node.c
index 724f747e99..500ede2a4c 100644
--- a/ext/syck/node.c
+++ b/ext/syck/node.c
@@ -1,8 +1,8 @@
/*
* node.c
*
- * $Author: matz $
- * $Date: 2005/09/16 09:35:23 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -33,15 +33,9 @@ syck_free_node( SyckNode *n )
{
syck_free_members( n );
if ( n->type_id != NULL )
- {
S_FREE( n->type_id );
- n->type_id = NULL;
- }
if ( n->anchor != NULL )
- {
S_FREE( n->anchor );
- n->anchor = NULL;
- }
S_FREE( n );
}
@@ -52,7 +46,6 @@ syck_alloc_map()
struct SyckMap *m;
m = S_ALLOC( struct SyckMap );
- m->style = map_none;
m->idx = 0;
m->capa = ALLOC_CT;
m->keys = S_ALLOC_N( SYMID, m->capa );
@@ -71,7 +64,6 @@ syck_alloc_seq()
struct SyckSeq *s;
s = S_ALLOC( struct SyckSeq );
- s->style = seq_none;
s->idx = 0;
s->capa = ALLOC_CT;
s->items = S_ALLOC_N( SYMID, s->capa );
@@ -121,28 +113,6 @@ syck_new_str2( char *str, long len, enum scalar_style style )
}
void
-syck_replace_str( SyckNode *n, char *str, enum scalar_style style )
-{
- syck_replace_str2( n, str, strlen( str ), style );
-}
-
-void
-syck_replace_str2( SyckNode *n, char *str, long len, enum scalar_style style )
-{
- if ( n->data.str != NULL )
- {
- S_FREE( n->data.str->ptr );
- n->data.str->ptr = NULL;
- n->data.str->len = 0;
- }
- n->data.str->ptr = S_ALLOC_N( char, len + 1 );
- n->data.str->len = len;
- n->data.str->style = style;
- memcpy( n->data.str->ptr, str, len );
- n->data.str->ptr[len] = '\0';
-}
-
-void
syck_str_blow_away_commas( SyckNode *n )
{
char *go, *end;
@@ -179,22 +149,6 @@ syck_new_map( SYMID key, SYMID value )
}
void
-syck_map_empty( SyckNode *n )
-{
- struct SyckMap *m;
- ASSERT( n != NULL );
- ASSERT( n->data.list != NULL );
-
- S_FREE( n->data.pairs->keys );
- S_FREE( n->data.pairs->values );
- m = n->data.pairs;
- m->idx = 0;
- m->capa = ALLOC_CT;
- m->keys = S_ALLOC_N( SYMID, m->capa );
- m->values = S_ALLOC_N( SYMID, m->capa );
-}
-
-void
syck_map_add( SyckNode *map, SYMID key, SYMID value )
{
struct SyckMap *m;
@@ -304,20 +258,6 @@ syck_new_seq( SYMID value )
}
void
-syck_seq_empty( SyckNode *n )
-{
- struct SyckSeq *s;
- ASSERT( n != NULL );
- ASSERT( n->data.list != NULL );
-
- S_FREE( n->data.list->items );
- s = n->data.list;
- s->idx = 0;
- s->capa = ALLOC_CT;
- s->items = S_ALLOC_N( SYMID, s->capa );
-}
-
-void
syck_seq_add( SyckNode *arr, SYMID value )
{
struct SyckSeq *s;
@@ -345,17 +285,6 @@ syck_seq_count( SyckNode *seq )
return seq->data.list->idx;
}
-void
-syck_seq_assign( SyckNode *seq, long idx, SYMID id )
-{
- struct SyckSeq *s;
-
- ASSERT( map != NULL );
- s = seq->data.list;
- ASSERT( m != NULL );
- s->items[idx] = id;
-}
-
SYMID
syck_seq_read( SyckNode *seq, long idx )
{
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
index e2de4bbfd0..c54deea618 100644
--- a/ext/syck/rubyext.c
+++ b/ext/syck/rubyext.c
@@ -1,11 +1,11 @@
-/* -*- indent-tabs-mode: nil -*- */
+/* -*- indent-tabs-mode: nil -*-
/*
* rubyext.c
*
- * $Author: ocean $
- * $Date: 2006/01/30 15:11:57 $
+ * $Author$
+ * $Date$
*
- * Copyright (C) 2003-2005 why the lucky stiff
+ * Copyright (C) 2003 why the lucky stiff
*/
#include "ruby.h"
@@ -16,23 +16,23 @@
typedef struct RVALUE {
union {
#if 0
- struct {
- unsigned long flags; /* always 0 for freed obj */
- struct RVALUE *next;
- } free;
+ struct {
+ unsigned long flags; /* always 0 for freed obj */
+ struct RVALUE *next;
+ } free;
#endif
- struct RBasic basic;
- struct RObject object;
- struct RClass klass;
- /*struct RFloat flonum;*/
- /*struct RString string;*/
- struct RArray array;
- /*struct RRegexp regexp;*/
- struct RHash hash;
- /*struct RData data;*/
- struct RStruct rstruct;
- /*struct RBignum bignum;*/
- /*struct RFile file;*/
+ struct RBasic basic;
+ struct RObject object;
+ struct RClass klass;
+ /*struct RFloat flonum;*/
+ /*struct RString string;*/
+ struct RArray array;
+ /*struct RRegexp regexp;*/
+ struct RHash hash;
+ /*struct RData data;*/
+ struct RStruct rstruct;
+ /*struct RBignum bignum;*/
+ /*struct RFile file;*/
} as;
} RVALUE;
@@ -49,13 +49,12 @@ typedef struct {
/*
* symbols and constants
*/
-static ID s_new, s_utc, s_at, s_to_f, s_to_i, s_read, s_binmode, s_call, s_cmp, s_transfer, s_update, s_dup, s_haskey, s_match, s_keys, s_unpack, s_tr_bang, s_default_set, s_tag_read_class, s_tag_subclasses, s_resolver, s_push, s_emitter, s_level, s_detect_implicit, s_node_import, s_out, s_input, s_intern, s_transform, s_yaml_new, s_yaml_initialize, s_node_export, s_to_yaml, s_write, s_set_resolver;
-static ID s_tags, s_domain, s_kind, s_name, s_options, s_type_id, s_type_id_set, s_style, s_style_set, s_value, s_value_set;
+static ID s_new, s_utc, s_at, s_to_f, s_to_i, s_read, s_binmode, s_call, s_cmp, s_transfer, s_update, s_dup, s_match, s_keys, s_to_str, s_unpack, s_tr_bang, s_anchors, s_default_set;
+static ID s_anchors, s_domain, s_families, s_kind, s_name, s_options, s_private_types, s_type_id, s_value;
static VALUE sym_model, sym_generic, sym_input, sym_bytecode;
static VALUE sym_scalar, sym_seq, sym_map;
-static VALUE sym_1quote, sym_2quote, sym_fold, sym_literal, sym_plain, sym_inline;
-static VALUE cDate, cNode, cMap, cSeq, cScalar, cOut, cParser, cResolver, cPrivateType, cDomainType, cYObject, cBadAlias, cDefaultKey, cMergeKey, cEmitter;
-static VALUE oDefaultResolver, oGenericResolver;
+VALUE cDate, cParser, cLoader, cNode, cPrivateType, cDomainType, cBadAlias, cDefaultKey, cMergeKey, cEmitter;
+VALUE oDefaultLoader;
/*
* my private collection of numerical oddities.
@@ -70,35 +69,25 @@ static VALUE syck_node_transform( VALUE );
/*
* handler prototypes
*/
+SYMID rb_syck_parse_handler _((SyckParser *, SyckNode *));
SYMID rb_syck_load_handler _((SyckParser *, SyckNode *));
void rb_syck_err_handler _((SyckParser *, char *));
SyckNode * rb_syck_bad_anchor_handler _((SyckParser *, char *));
void rb_syck_output_handler _((SyckEmitter *, char *, long));
-void rb_syck_emitter_handler _((SyckEmitter *, st_data_t));
-int syck_parser_assign_io _((SyckParser *, VALUE *));
-VALUE syck_scalar_alloc _((VALUE class));
-VALUE syck_seq_alloc _((VALUE class));
-VALUE syck_map_alloc _((VALUE class));
+int syck_parser_assign_io _((SyckParser *, VALUE));
struct parser_xtra {
VALUE data; /* Borrowed this idea from marshal.c to fix [ruby-core:8067] problem */
VALUE proc;
- VALUE resolver;
int taint;
};
-struct emitter_xtra {
- VALUE oid;
- VALUE data;
- VALUE port;
-};
-
/*
* Convert YAML to bytecode
*/
VALUE
rb_syck_compile(self, port)
- VALUE self, port;
+ VALUE self, port;
{
SYMID oid;
int taint;
@@ -107,7 +96,7 @@ rb_syck_compile(self, port)
bytestring_t *sav;
SyckParser *parser = syck_new_parser();
- taint = syck_parser_assign_io(parser, &port);
+ taint = syck_parser_assign_io(parser, port);
syck_parser_handler( parser, syck_yaml2byte_handler );
syck_parser_error_handler( parser, NULL );
syck_parser_implicit_typing( parser, 0 );
@@ -115,7 +104,7 @@ rb_syck_compile(self, port)
oid = syck_parse( parser );
syck_lookup_sym( parser, oid, (char **)&sav );
- ret = S_ALLOCA_N( char, strlen( sav->buffer ) + 3 );
+ ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
ret[0] = '\0';
strcat( ret, "D\n" );
strcat( ret, sav->buffer );
@@ -149,7 +138,6 @@ rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
VALUE str2 = rb_funcall2(src, s_read, 1, &n);
if (!NIL_P(str2))
{
- StringValue(str2);
len = RSTRING(str2)->len;
memcpy( buf + skip, RSTRING(str2)->ptr, len );
}
@@ -164,16 +152,15 @@ rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
* (returns tainted? boolean)
*/
int
-syck_parser_assign_io(parser, pport)
- SyckParser *parser;
- VALUE *pport;
+syck_parser_assign_io(parser, port)
+ SyckParser *parser;
+ VALUE port;
{
int taint = Qtrue;
- VALUE tmp, port = *pport;
- if (!NIL_P(tmp = rb_check_string_type(port))) {
- taint = OBJ_TAINTED(port); /* original taintedness */
- port = tmp;
- syck_parser_str( parser, RSTRING(port)->ptr, RSTRING(port)->len, NULL );
+ if (rb_respond_to(port, s_to_str)) {
+ taint = OBJ_TAINTED(port); /* original taintedness */
+ StringValue(port); /* possible conversion */
+ syck_parser_str( parser, RSTRING(port)->ptr, RSTRING(port)->len, NULL );
}
else if (rb_respond_to(port, s_read)) {
if (rb_respond_to(port, s_binmode)) {
@@ -184,7 +171,6 @@ syck_parser_assign_io(parser, pport)
else {
rb_raise(rb_eTypeError, "instance of IO needed");
}
- *pport = port;
return taint;
}
@@ -208,65 +194,48 @@ syck_get_hash_aref(hsh, key)
* creating timestamps
*/
SYMID
-rb_syck_mktime(str, len)
+rb_syck_mktime(str)
char *str;
- long len;
{
VALUE time;
char *ptr = str;
- VALUE year = INT2FIX(0);
- VALUE mon = INT2FIX(0);
- VALUE day = INT2FIX(0);
- VALUE hour = INT2FIX(0);
- VALUE min = INT2FIX(0);
- VALUE sec = INT2FIX(0);
+ VALUE year, mon, day, hour, min, sec;
long usec;
/* Year*/
- if ( ptr[0] != '\0' && len > 0 ) {
- year = INT2FIX(strtol(ptr, NULL, 10));
- }
+ ptr[4] = '\0';
+ year = INT2FIX(strtol(ptr, NULL, 10));
/* Month*/
ptr += 4;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- mon = INT2FIX(strtol(ptr, NULL, 10));
- }
+ while ( !ISDIGIT( *ptr ) ) ptr++;
+ mon = INT2FIX(strtol(ptr, NULL, 10));
/* Day*/
ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- day = INT2FIX(strtol(ptr, NULL, 10));
- }
+ while ( !ISDIGIT( *ptr ) ) ptr++;
+ day = INT2FIX(strtol(ptr, NULL, 10));
/* Hour*/
ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- hour = INT2FIX(strtol(ptr, NULL, 10));
- }
+ while ( !ISDIGIT( *ptr ) ) ptr++;
+ hour = INT2FIX(strtol(ptr, NULL, 10));
/* Minute */
ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- min = INT2FIX(strtol(ptr, NULL, 10));
- }
+ while ( !ISDIGIT( *ptr ) ) ptr++;
+ min = INT2FIX(strtol(ptr, NULL, 10));
/* Second */
ptr += 2;
- if ( ptr[0] != '\0' && len > ptr - str ) {
- while ( !ISDIGIT( *ptr ) ) ptr++;
- sec = INT2FIX(strtol(ptr, NULL, 10));
- }
+ while ( !ISDIGIT( *ptr ) ) ptr++;
+ sec = INT2FIX(strtol(ptr, NULL, 10));
/* Millisecond */
ptr += 2;
- if ( len > ptr - str && *ptr == '.' )
+ if ( *ptr == '.' )
{
- char padded[] = "000000";
+ char *padded = syck_strndup( "000000", 6 );
char *end = ptr + 1;
while ( isdigit( *end ) ) end++;
MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
@@ -278,10 +247,10 @@ rb_syck_mktime(str, len)
}
/* Time Zone*/
- while ( len > ptr - str && *ptr != 'Z' && *ptr != '+' && *ptr != '-' && *ptr != '\0' ) ptr++;
- if ( len > ptr - str && ( *ptr == '-' || *ptr == '+' ) )
+ while ( *ptr != 'Z' && *ptr != '+' && *ptr != '-' && *ptr != '\0' ) ptr++;
+ if ( *ptr == '-' || *ptr == '+' )
{
- time_t tz_offset = strtol(ptr, NULL, 10) * 3600;
+ time_t tz_offset = strtol(ptr, NULL, 10) * 3600;
time_t tmp;
while ( *ptr != ':' && *ptr != '\0' ) ptr++;
@@ -299,15 +268,76 @@ rb_syck_mktime(str, len)
}
/* Make TZ time*/
- time = rb_funcall(rb_cTime, s_utc, 6, year, mon, day, hour, min, sec);
- tmp = NUM2LONG(rb_funcall(time, s_to_i, 0)) - tz_offset;
- return rb_funcall(rb_cTime, s_at, 2, LONG2NUM(tmp), LONG2NUM(usec));
+ time = rb_funcall(rb_cTime, s_utc, 6, year, mon, day, hour, min, sec);
+ tmp = NUM2LONG(rb_funcall(time, s_to_i, 0)) - tz_offset;
+ return rb_funcall(rb_cTime, s_at, 2, LONG2NUM(tmp), LONG2NUM(usec));
+ }
+ else
+ {
+ /* Make UTC time*/
+ return rb_funcall(rb_cTime, s_utc, 7, year, mon, day, hour, min, sec, LONG2NUM(usec));
+
}
- else
+}
+
+/*
+ * {generic mode} node handler
+ * - Loads data into Node classes
+ */
+SYMID
+rb_syck_parse_handler(p, n)
+ SyckParser *p;
+ SyckNode *n;
+{
+ VALUE t, obj, v = Qnil;
+ int i;
+ struct parser_xtra *bonus;
+
+ obj = rb_obj_alloc(cNode);
+ if ( n->type_id != NULL )
{
- /* Make UTC time*/
- return rb_funcall(rb_cTime, s_utc, 7, year, mon, day, hour, min, sec, LONG2NUM(usec));
+ t = rb_str_new2(n->type_id);
+ rb_ivar_set(obj, s_type_id, t);
}
+
+ switch (n->kind)
+ {
+ case syck_str_kind:
+ rb_ivar_set(obj, s_kind, sym_scalar);
+ v = rb_str_new( n->data.str->ptr, n->data.str->len );
+ break;
+
+ case syck_seq_kind:
+ rb_ivar_set(obj, s_kind, sym_seq);
+ v = rb_ary_new2( n->data.list->idx );
+ for ( i = 0; i < n->data.list->idx; i++ )
+ {
+ rb_ary_store( v, i, syck_seq_read( n, i ) );
+ }
+ break;
+
+ case syck_map_kind:
+ rb_ivar_set(obj, s_kind, sym_map);
+ v = rb_hash_new();
+ for ( i = 0; i < n->data.pairs->idx; i++ )
+ {
+ VALUE key = syck_node_transform( syck_map_read( n, map_key, i ) );
+ VALUE val = rb_ary_new();
+ rb_ary_push(val, syck_map_read( n, map_key, i ));
+ rb_ary_push(val, syck_map_read( n, map_value, i ));
+
+ rb_hash_aset( v, key, val );
+ }
+ break;
+ }
+
+ bonus = (struct parser_xtra *)p->bonus;
+ if ( bonus->taint) OBJ_TAINT( obj );
+ if ( bonus->proc != 0 ) rb_funcall(bonus->proc, s_call, 1, v);
+
+ rb_ivar_set(obj, s_value, v);
+ rb_hash_aset(bonus->data, INT2FIX(RHASH(bonus->data)->tbl->num_entries), obj);
+ return obj;
}
/*
@@ -318,13 +348,57 @@ VALUE
syck_merge_i( entry, hsh )
VALUE entry, hsh;
{
- VALUE tmp;
- if ( !NIL_P(tmp = rb_check_convert_type(entry, T_HASH, "Hash", "to_hash")) )
+ if ( rb_obj_is_kind_of( entry, rb_cHash ) )
+ {
+ rb_funcall( hsh, s_update, 1, entry );
+ }
+ return Qnil;
+}
+
+/*
+ * build a syck node from a Ruby VALUE
+ */
+SyckNode *
+rb_new_syck_node( obj, type_id )
+ VALUE obj, type_id;
+{
+ long i = 0;
+ SyckNode *n = NULL;
+
+ if (rb_respond_to(obj, s_to_str))
{
- entry = tmp;
- rb_funcall( hsh, s_update, 1, entry );
+ StringValue(obj); /* possible conversion */
+ n = syck_alloc_str();
+ n->data.str->ptr = RSTRING(obj)->ptr;
+ n->data.str->len = RSTRING(obj)->len;
}
- return Qnil;
+ else if ( rb_obj_is_kind_of( obj, rb_cArray ) )
+ {
+ n = syck_alloc_seq();
+ for ( i = 0; i < RARRAY(obj)->len; i++ )
+ {
+ syck_seq_add(n, rb_ary_entry(obj, i));
+ }
+ }
+ else if ( rb_obj_is_kind_of( obj, rb_cHash ) )
+ {
+ VALUE keys;
+ n = syck_alloc_map();
+ keys = rb_funcall( obj, s_keys, 0 );
+ for ( i = 0; i < RARRAY(keys)->len; i++ )
+ {
+ VALUE key = rb_ary_entry(keys, i);
+ syck_map_add(n, key, rb_hash_aref(obj, key));
+ }
+ }
+
+ if ( n!= NULL && rb_respond_to( type_id, s_to_str ) )
+ {
+ StringValue(type_id);
+ n->type_id = syck_strndup( RSTRING(type_id)->ptr, RSTRING(type_id)->len );
+ }
+
+ return n;
}
/*
@@ -340,11 +414,6 @@ yaml_org_handler( n, ref )
long i = 0;
VALUE obj = Qnil;
- if ( type_id != NULL && strncmp( type_id, "tag:yaml.org,2002:", 18 ) == 0 )
- {
- type_id += 18;
- }
-
switch (n->kind)
{
case syck_str_kind:
@@ -399,7 +468,7 @@ yaml_org_handler( n, ref )
{
colon--;
}
- if ( colon >= ptr && *colon == ':' ) *colon = '\0';
+ if ( *colon == ':' ) *colon = '\0';
bnum = strtol( colon + 1, NULL, 10 );
total += bnum * sixty;
@@ -429,7 +498,7 @@ yaml_org_handler( n, ref )
{
colon--;
}
- if ( colon >= ptr && *colon == ':' ) *colon = '\0';
+ if ( *colon == ':' ) *colon = '\0';
bnum = strtod( colon + 1, NULL );
total += bnum * sixty;
@@ -459,11 +528,11 @@ yaml_org_handler( n, ref )
}
else if ( strcmp( type_id, "timestamp#iso8601" ) == 0 )
{
- obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
+ obj = rb_syck_mktime( n->data.str->ptr );
}
else if ( strcmp( type_id, "timestamp#spaced" ) == 0 )
{
- obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
+ obj = rb_syck_mktime( n->data.str->ptr );
}
else if ( strcmp( type_id, "timestamp#ymd" ) == 0 )
{
@@ -496,22 +565,22 @@ yaml_org_handler( n, ref )
}
else if ( strncmp( type_id, "timestamp", 9 ) == 0 )
{
- obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
- }
- else if ( strncmp( type_id, "merge", 5 ) == 0 )
- {
- obj = rb_funcall( cMergeKey, s_new, 0 );
- }
- else if ( strncmp( type_id, "default", 7 ) == 0 )
- {
- obj = rb_funcall( cDefaultKey, s_new, 0 );
+ obj = rb_syck_mktime( n->data.str->ptr );
}
+ else if ( strncmp( type_id, "merge", 5 ) == 0 )
+ {
+ obj = rb_funcall( cMergeKey, s_new, 0 );
+ }
+ else if ( strncmp( type_id, "default", 7 ) == 0 )
+ {
+ obj = rb_funcall( cDefaultKey, s_new, 0 );
+ }
else if ( n->data.str->style == scalar_plain &&
n->data.str->len > 1 &&
strncmp( n->data.str->ptr, ":", 1 ) == 0 )
{
- obj = rb_funcall( oDefaultResolver, s_transfer, 2,
- rb_str_new2( "tag:ruby.yaml.org,2002:sym" ),
+ obj = rb_funcall( oDefaultLoader, s_transfer, 2,
+ rb_str_new2( "ruby/sym" ),
rb_str_new( n->data.str->ptr + 1, n->data.str->len - 1 ) );
}
else if ( strcmp( type_id, "str" ) == 0 )
@@ -545,48 +614,46 @@ yaml_org_handler( n, ref )
obj = rb_hash_new();
for ( i = 0; i < n->data.pairs->idx; i++ )
{
- VALUE k = syck_map_read( n, map_key, i );
- VALUE v = syck_map_read( n, map_value, i );
- int skip_aset = 0;
-
- /*
- * Handle merge keys
- */
- if ( rb_obj_is_kind_of( k, cMergeKey ) )
- {
- VALUE tmp;
- if ( !NIL_P(tmp = rb_check_convert_type(v, T_HASH, "Hash", "to_hash")) )
- {
- VALUE dup = rb_funcall( tmp, s_dup, 0 );
- rb_funcall( dup, s_update, 1, obj );
- obj = dup;
- skip_aset = 1;
- }
- else if ( !NIL_P(tmp = rb_check_array_type(v)) )
- {
- VALUE end = rb_ary_pop( tmp );
- VALUE tmph = rb_check_convert_type(end, T_HASH, "Hash", "to_hash");
- if ( !NIL_P(tmph) )
- {
- VALUE dup = rb_funcall( tmph, s_dup, 0 );
- tmp = rb_ary_reverse( tmp );
- rb_ary_push( tmp, obj );
- rb_iterate( rb_each, tmp, syck_merge_i, dup );
- obj = dup;
- skip_aset = 1;
- }
- }
- }
+ VALUE k = syck_map_read( n, map_key, i );
+ VALUE v = syck_map_read( n, map_value, i );
+ int skip_aset = 0;
+
+ /*
+ * Handle merge keys
+ */
+ if ( rb_obj_is_kind_of( k, cMergeKey ) )
+ {
+ if ( rb_obj_is_kind_of( v, rb_cHash ) )
+ {
+ VALUE dup = rb_funcall( v, s_dup, 0 );
+ rb_funcall( dup, s_update, 1, obj );
+ obj = dup;
+ skip_aset = 1;
+ }
+ else if ( rb_obj_is_kind_of( v, rb_cArray ) )
+ {
+ VALUE end = rb_ary_pop( v );
+ if ( rb_obj_is_kind_of( end, rb_cHash ) )
+ {
+ VALUE dup = rb_funcall( end, s_dup, 0 );
+ v = rb_ary_reverse( v );
+ rb_ary_push( v, obj );
+ rb_iterate( rb_each, v, syck_merge_i, dup );
+ obj = dup;
+ skip_aset = 1;
+ }
+ }
+ }
else if ( rb_obj_is_kind_of( k, cDefaultKey ) )
{
rb_funcall( obj, s_default_set, 1, v );
skip_aset = 1;
}
- if ( ! skip_aset )
- {
- rb_hash_aset( obj, k, v );
- }
+ if ( ! skip_aset )
+ {
+ rb_hash_aset( obj, k, v );
+ }
}
break;
}
@@ -595,8 +662,6 @@ yaml_org_handler( n, ref )
return transferred;
}
-static void syck_node_mark( SyckNode *n );
-
/*
* {native mode} node handler
* - Converts data into native Ruby types
@@ -607,17 +672,16 @@ rb_syck_load_handler(p, n)
SyckNode *n;
{
VALUE obj = Qnil;
- struct parser_xtra *bonus = (struct parser_xtra *)p->bonus;
- VALUE resolver = bonus->resolver;
- if ( NIL_P( resolver ) )
- {
- resolver = oDefaultResolver;
- }
+ struct parser_xtra *bonus;
/*
- * Create node,
+ * Attempt common transfers
*/
- obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, NULL, NULL, n ) );
+ int transferred = yaml_org_handler(n, &obj);
+ if ( transferred == 0 && n->type_id != NULL )
+ {
+ obj = rb_funcall( oDefaultLoader, s_transfer, 2, rb_str_new2( n->type_id ), obj );
+ }
/*
* ID already set, let's alter the symbol table to accept the new object
@@ -629,8 +693,9 @@ rb_syck_load_handler(p, n)
obj = n->id;
}
+ bonus = (struct parser_xtra *)p->bonus;
if ( bonus->taint) OBJ_TAINT( obj );
- if ( bonus->proc != 0 ) rb_funcall(bonus->proc, s_call, 1, obj);
+ if ( bonus->proc != 0 ) rb_funcall(bonus->proc, s_call, 1, obj);
rb_hash_aset(bonus->data, INT2FIX(RHASH(bonus->data)->tbl->num_entries), obj);
return obj;
@@ -675,43 +740,30 @@ rb_syck_bad_anchor_handler(p, a)
* data loaded based on the model requested.
*/
void
-syck_set_model( p, input, model )
- VALUE p, input, model;
-{
- SyckParser *parser;
- Data_Get_Struct(p, SyckParser, parser);
- syck_parser_handler( parser, rb_syck_load_handler );
- /* WARN: gonna be obsoleted soon!! */
- if ( model == sym_generic )
- {
- rb_funcall( p, s_set_resolver, 1, oGenericResolver );
- }
- syck_parser_implicit_typing( parser, 1 );
- syck_parser_taguri_expansion( parser, 1 );
-
- if ( NIL_P( input ) )
- {
- input = rb_ivar_get( p, s_input );
- }
+syck_set_model( parser, input, model )
+ SyckParser *parser;
+ VALUE input, model;
+{
+ if ( model == sym_generic )
+ {
+ syck_parser_handler( parser, rb_syck_parse_handler );
+ syck_parser_implicit_typing( parser, 1 );
+ syck_parser_taguri_expansion( parser, 1 );
+ }
+ else
+ {
+ syck_parser_handler( parser, rb_syck_load_handler );
+ syck_parser_implicit_typing( parser, 1 );
+ syck_parser_taguri_expansion( parser, 0 );
+ }
if ( input == sym_bytecode )
{
syck_parser_set_input_type( parser, syck_bytecode_utf8 );
}
- else
- {
- syck_parser_set_input_type( parser, syck_yaml_utf8 );
- }
syck_parser_error_handler( parser, rb_syck_err_handler );
syck_parser_bad_anchor_handler( parser, rb_syck_bad_anchor_handler );
}
-static int
-syck_st_mark_nodes( char *key, SyckNode *n, char *arg )
-{
- if ( n != (void *)1 ) syck_node_mark( n );
- return ST_CONTINUE;
-}
-
/*
* mark parser nodes
*/
@@ -719,76 +771,45 @@ static void
syck_mark_parser(parser)
SyckParser *parser;
{
- struct parser_xtra *bonus = (struct parser_xtra *)parser->bonus;
- rb_gc_mark_maybe(parser->root);
- rb_gc_mark_maybe(parser->root_on_error);
- rb_gc_mark( bonus->data );
- rb_gc_mark( bonus->proc );
- rb_gc_mark( bonus->resolver );
-
- if ( parser->anchors != NULL )
- {
- st_foreach( parser->anchors, syck_st_mark_nodes, 0 );
- }
- if ( parser->bad_anchors != NULL )
- {
- st_foreach( parser->bad_anchors, syck_st_mark_nodes, 0 );
- }
+ rb_gc_mark(parser->root);
+ rb_gc_mark(parser->root_on_error);
}
/*
- * Free the parser and any bonus attachment.
+ * YAML::Syck::Parser.new
*/
-void
-rb_syck_free_parser(p)
- SyckParser *p;
-{
- S_FREE( p->bonus );
- syck_free_parser(p);
-}
-
-/*
- * YAML::Syck::Parser.allocate
- */
-VALUE syck_parser_s_alloc _((VALUE));
VALUE
-syck_parser_s_alloc(class)
- VALUE class;
+syck_parser_new(argc, argv, class)
+ int argc;
+ VALUE *argv;
+ VALUE class;
{
- VALUE pobj;
+ VALUE pobj, options, init_argv[1];
SyckParser *parser = syck_new_parser();
- parser->bonus = S_ALLOC( struct parser_xtra );
- S_MEMZERO( parser->bonus, struct parser_xtra, 1 );
-
- pobj = Data_Wrap_Struct( class, syck_mark_parser, rb_syck_free_parser, parser );
+ rb_scan_args(argc, argv, "01", &options);
+ pobj = Data_Wrap_Struct( class, syck_mark_parser, syck_free_parser, parser );
syck_parser_set_root_on_error( parser, Qnil );
- return pobj;
+ if ( ! rb_obj_is_instance_of( options, rb_cHash ) )
+ {
+ options = rb_hash_new();
+ }
+ init_argv[0] = options;
+ rb_obj_call_init(pobj, 1, init_argv);
+ return pobj;
}
/*
- * YAML::Syck::Parser.initialize( resolver, options )
+ * YAML::Syck::Parser.initialize( options )
*/
static VALUE
-syck_parser_initialize(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+syck_parser_initialize( self, options )
+ VALUE self, options;
{
- VALUE options;
- if (rb_scan_args(argc, argv, "01", &options) == 0)
- {
- options = rb_hash_new();
- }
- else
- {
- Check_Type(options, T_HASH);
- }
rb_ivar_set(self, s_options, options);
- rb_ivar_set(self, s_input, Qnil);
- return self;
+ return self;
}
/*
@@ -798,14 +819,13 @@ static VALUE
syck_parser_bufsize_set( self, size )
VALUE self, size;
{
- SyckParser *parser;
+ SyckParser *parser;
+ Data_Get_Struct(self, SyckParser, parser);
if ( rb_respond_to( size, s_to_i ) ) {
- int n = NUM2INT(rb_funcall(size, s_to_i, 0));
- Data_Get_Struct(self, SyckParser, parser);
- parser->bufsize = n;
+ parser->bufsize = NUM2INT(rb_funcall(size, s_to_i, 0));
}
- return self;
+ return self;
}
/*
@@ -815,10 +835,10 @@ static VALUE
syck_parser_bufsize_get( self )
VALUE self;
{
- SyckParser *parser;
+ SyckParser *parser;
- Data_Get_Struct(self, SyckParser, parser);
- return INT2FIX( parser->bufsize );
+ Data_Get_Struct(self, SyckParser, parser);
+ return INT2FIX( parser->bufsize );
}
/*
@@ -828,25 +848,26 @@ VALUE
syck_parser_load(argc, argv, self)
int argc;
VALUE *argv;
- VALUE self;
+ VALUE self;
{
VALUE port, proc, model, input;
- SyckParser *parser;
- struct parser_xtra *bonus;
+ SyckParser *parser;
+ struct parser_xtra bonus;
+ volatile VALUE hash; /* protect from GC */
rb_scan_args(argc, argv, "11", &port, &proc);
+ Data_Get_Struct(self, SyckParser, parser);
input = rb_hash_aref( rb_attr_get( self, s_options ), sym_input );
model = rb_hash_aref( rb_attr_get( self, s_options ), sym_model );
- Data_Get_Struct(self, SyckParser, parser);
- syck_set_model( self, input, model );
+ syck_set_model( parser, input, model );
- bonus = (struct parser_xtra *)parser->bonus;
- bonus->taint = syck_parser_assign_io(parser, &port);
- bonus->data = rb_hash_new();
- bonus->resolver = rb_attr_get( self, s_resolver );
- if ( NIL_P( proc ) ) bonus->proc = 0;
- else bonus->proc = proc;
+ bonus.taint = syck_parser_assign_io(parser, port);
+ bonus.data = hash = rb_hash_new();
+ if ( NIL_P( proc ) ) bonus.proc = 0;
+ else bonus.proc = proc;
+
+ parser->bonus = (void *)&bonus;
return syck_parse( parser );
}
@@ -858,381 +879,155 @@ VALUE
syck_parser_load_documents(argc, argv, self)
int argc;
VALUE *argv;
- VALUE self;
+ VALUE self;
{
VALUE port, proc, v, input, model;
- SyckParser *parser;
- struct parser_xtra *bonus;
+ SyckParser *parser;
+ struct parser_xtra bonus;
+ volatile VALUE hash;
rb_scan_args(argc, argv, "1&", &port, &proc);
+ Data_Get_Struct(self, SyckParser, parser);
input = rb_hash_aref( rb_attr_get( self, s_options ), sym_input );
model = rb_hash_aref( rb_attr_get( self, s_options ), sym_model );
- Data_Get_Struct(self, SyckParser, parser);
- syck_set_model( self, input, model );
+ syck_set_model( parser, input, model );
- bonus = (struct parser_xtra *)parser->bonus;
- bonus->taint = syck_parser_assign_io(parser, &port);
- bonus->resolver = rb_attr_get( self, s_resolver );
- bonus->proc = 0;
-
+ bonus.taint = syck_parser_assign_io(parser, port);
while ( 1 )
- {
+ {
/* Reset hash for tracking nodes */
- bonus->data = rb_hash_new();
+ bonus.data = hash = rb_hash_new();
+ bonus.proc = 0;
+ parser->bonus = (void *)&bonus;
/* Parse a document */
- v = syck_parse( parser );
+ v = syck_parse( parser );
if ( parser->eof == 1 )
{
break;
}
/* Pass document to block */
- rb_funcall( proc, s_call, 1, v );
- }
+ rb_funcall( proc, s_call, 1, v );
+ }
return Qnil;
}
/*
- * YAML::Syck::Parser#set_resolver
- */
-VALUE
-syck_parser_set_resolver( self, resolver )
- VALUE self, resolver;
-{
- rb_ivar_set( self, s_resolver, resolver );
- return self;
-}
-
-/*
- * YAML::Syck::Resolver.initialize
+ * YAML::Syck::Loader.initialize
*/
static VALUE
-syck_resolver_initialize( self )
+syck_loader_initialize( self )
VALUE self;
{
- VALUE tags = rb_hash_new();
- rb_ivar_set(self, s_tags, rb_hash_new());
+ VALUE families;
+
+ families = rb_hash_new();
+ rb_ivar_set(self, s_families, families);
+ rb_ivar_set(self, s_private_types, rb_hash_new());
+ rb_ivar_set(self, s_anchors, rb_hash_new());
+
+ rb_hash_aset(families, rb_str_new2( YAML_DOMAIN ), rb_hash_new());
+ rb_hash_aset(families, rb_str_new2( RUBY_DOMAIN ), rb_hash_new());
+
return self;
}
/*
- * YAML::Syck::Resolver#add_type
+ * Add type family, used by add_*_type methods.
*/
VALUE
-syck_resolver_add_type( self, taguri, cls )
- VALUE self, taguri, cls;
+syck_loader_add_type_family( self, domain, type_re, proc )
+ VALUE self, domain, type_re, proc;
{
- VALUE tags = rb_attr_get(self, s_tags);
- rb_hash_aset( tags, taguri, cls );
+ VALUE families, domain_types;
+
+ families = rb_attr_get(self, s_families);
+ domain_types = syck_get_hash_aref(families, domain);
+ rb_hash_aset( domain_types, type_re, proc );
return Qnil;
}
/*
- * YAML::Syck::Resolver#use_types_at
+ * YAML::Syck::Loader.add_domain_type
*/
VALUE
-syck_resolver_use_types_at( self, hsh )
- VALUE self, hsh;
+syck_loader_add_domain_type( argc, argv, self )
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
- rb_ivar_set( self, s_tags, hsh );
+ VALUE domain, type_re, proc;
+
+ rb_scan_args(argc, argv, "2&", &domain, &type_re, &proc);
+ syck_loader_add_type_family( self, domain, type_re, proc );
return Qnil;
}
-/*
- * YAML::Syck::Resolver#detect_implicit
- */
-VALUE
-syck_resolver_detect_implicit( self, val )
- VALUE self, val;
-{
- char *type_id;
- return rb_str_new2( "" );
-}
/*
- * YAML::Syck::Resolver#node_import
+ * YAML::Syck::Loader.add_builtin_type
*/
VALUE
-syck_resolver_node_import( self, node )
- VALUE self, node;
+syck_loader_add_builtin_type( argc, argv, self )
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
- SyckNode *n;
- VALUE obj;
- int i = 0;
- Data_Get_Struct(node, SyckNode, n);
-
- switch (n->kind)
- {
- case syck_str_kind:
- obj = rb_str_new( n->data.str->ptr, n->data.str->len );
- break;
-
- case syck_seq_kind:
- obj = rb_ary_new2( n->data.list->idx );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_ary_store( obj, i, syck_seq_read( n, i ) );
- }
- break;
-
- case syck_map_kind:
- obj = rb_hash_new();
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- VALUE k = syck_map_read( n, map_key, i );
- VALUE v = syck_map_read( n, map_value, i );
- int skip_aset = 0;
-
- /*
- * Handle merge keys
- */
- if ( rb_obj_is_kind_of( k, cMergeKey ) )
- {
- if ( rb_obj_is_kind_of( v, rb_cHash ) )
- {
- VALUE dup = rb_funcall( v, s_dup, 0 );
- rb_funcall( dup, s_update, 1, obj );
- obj = dup;
- skip_aset = 1;
- }
- else if ( rb_obj_is_kind_of( v, rb_cArray ) )
- {
- VALUE end = rb_ary_pop( v );
- if ( rb_obj_is_kind_of( end, rb_cHash ) )
- {
- VALUE dup = rb_funcall( end, s_dup, 0 );
- v = rb_ary_reverse( v );
- rb_ary_push( v, obj );
- rb_iterate( rb_each, v, syck_merge_i, dup );
- obj = dup;
- skip_aset = 1;
- }
- }
- }
- else if ( rb_obj_is_kind_of( k, cDefaultKey ) )
- {
- rb_funcall( obj, s_default_set, 1, v );
- skip_aset = 1;
- }
-
- if ( ! skip_aset )
- {
- rb_hash_aset( obj, k, v );
- }
- }
- break;
- }
-
- if ( n->type_id != NULL )
- {
- obj = rb_funcall( self, s_transfer, 2, rb_str_new2( n->type_id ), obj );
- }
- return obj;
-}
+ VALUE type_re, proc;
-/*
- * Set instance variables
- */
-VALUE
-syck_set_ivars( vars, obj )
- VALUE vars, obj;
-{
- VALUE ivname = rb_ary_entry( vars, 0 );
- char *ivn;
- StringValue( ivname );
- ivn = S_ALLOCA_N( char, RSTRING(ivname)->len + 2 );
- ivn[0] = '@';
- ivn[1] = '\0';
- strncat( ivn, RSTRING(ivname)->ptr, RSTRING(ivname)->len );
- rb_iv_set( obj, ivn, rb_ary_entry( vars, 1 ) );
+ rb_scan_args(argc, argv, "1&", &type_re, &proc);
+ syck_loader_add_type_family( self, rb_str_new2( YAML_DOMAIN ), type_re, proc );
return Qnil;
}
/*
- * YAML::Syck::Resolver#const_find
- */
-VALUE
-syck_const_find( const_name )
- VALUE const_name;
-{
- VALUE tclass = rb_cObject;
- VALUE tparts = rb_str_split( const_name, "::" );
- int i = 0;
- for ( i = 0; i < RARRAY(tparts)->len; i++ ) {
- VALUE tpart = rb_to_id( rb_ary_entry( tparts, i ) );
- if ( !rb_const_defined( tclass, tpart ) ) return Qnil;
- tclass = rb_const_get( tclass, tpart );
- }
- return tclass;
-}
-
-/*
- * YAML::Syck::Resolver#transfer
+ * YAML::Syck::Loader.add_ruby_type
*/
VALUE
-syck_resolver_transfer( self, type, val )
- VALUE self, type, val;
+syck_loader_add_ruby_type( argc, argv, self )
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
- if (NIL_P(type) || RSTRING(StringValue(type))->len == 0)
- {
- type = rb_funcall( self, s_detect_implicit, 1, val );
- }
-
- if ( ! (NIL_P(type) || RSTRING(StringValue(type))->len == 0) )
- {
- VALUE str_xprivate = rb_str_new2( "x-private" );
- VALUE colon = rb_str_new2( ":" );
- VALUE tags = rb_attr_get(self, s_tags);
- VALUE target_class = rb_hash_aref( tags, type );
- VALUE subclass = target_class;
- VALUE obj = Qnil;
-
- /*
- * Should no tag match exactly, check for subclass format
- */
- if ( NIL_P( target_class ) )
- {
- VALUE subclass_parts = rb_ary_new();
- VALUE parts = rb_str_split( type, ":" );
+ VALUE type_re, proc;
- while ( RARRAY(parts)->len > 1 )
- {
- VALUE partial;
- rb_ary_unshift( subclass_parts, rb_ary_pop( parts ) );
- partial = rb_ary_join( parts, colon );
- target_class = rb_hash_aref( tags, partial );
- if ( NIL_P( target_class ) )
- {
- rb_str_append( partial, colon );
- target_class = rb_hash_aref( tags, partial );
- }
-
- /*
- * Possible subclass found, see if it supports subclassing
- */
- if ( ! NIL_P( target_class ) )
- {
- subclass = target_class;
- if ( RARRAY(subclass_parts)->len > 0 && rb_respond_to( target_class, s_tag_subclasses ) &&
- RTEST( rb_funcall( target_class, s_tag_subclasses, 0 ) ) )
- {
- VALUE subclass_v;
- subclass = rb_ary_join( subclass_parts, colon );
- subclass = rb_funcall( target_class, s_tag_read_class, 1, subclass );
- subclass_v = syck_const_find( subclass );
-
- if ( subclass_v != Qnil )
- {
- subclass = subclass_v;
- }
- else if ( rb_cObject == target_class && subclass_v == Qnil )
- {
- target_class = cYObject;
- type = subclass;
- subclass = cYObject;
- }
- else /* workaround for SEGV. real fix please */
- {
- rb_raise( rb_eTypeError, "invalid subclass" );
- }
- }
- break;
- }
- }
- }
-
- /* rb_raise(rb_eTypeError, "invalid typing scheme: %s given",
- * scheme);
- */
-
- if ( rb_respond_to( target_class, s_call ) )
- {
- obj = rb_funcall( target_class, s_call, 2, type, val );
- }
- else
- {
- if ( rb_respond_to( target_class, s_yaml_new ) )
- {
- obj = rb_funcall( target_class, s_yaml_new, 3, subclass, type, val );
- }
- else if ( !NIL_P( target_class ) )
- {
- if ( subclass == rb_cBignum )
- {
- obj = rb_str2inum( val, 10 ); /* for yaml dumped by 1.8.3 [ruby-core:6159] */
- }
- else
- {
- obj = rb_obj_alloc( subclass );
- }
-
- if ( rb_respond_to( obj, s_yaml_initialize ) )
- {
- rb_funcall( obj, s_yaml_initialize, 2, type, val );
- }
- else if ( !NIL_P( obj ) && rb_obj_is_instance_of( val, rb_cHash ) )
- {
- rb_iterate( rb_each, val, syck_set_ivars, obj );
- }
- }
- else
- {
- VALUE parts = rb_str_split( type, ":" );
- VALUE scheme = rb_ary_shift( parts );
- if ( rb_str_cmp( scheme, str_xprivate ) == 0 )
- {
- VALUE name = rb_ary_join( parts, colon );
- obj = rb_funcall( cPrivateType, s_new, 2, name, val );
- }
- else
- {
- VALUE domain = rb_ary_shift( parts );
- VALUE name = rb_ary_join( parts, colon );
- obj = rb_funcall( cDomainType, s_new, 3, domain, name, val );
- }
- }
- }
- val = obj;
- }
-
- return val;
+ rb_scan_args(argc, argv, "1&", &type_re, &proc);
+ syck_loader_add_type_family( self, rb_str_new2( RUBY_DOMAIN ), type_re, proc );
+ return Qnil;
}
/*
- * YAML::Syck::Resolver#tagurize
+ * YAML::Syck::Loader.add_private_type
*/
VALUE
-syck_resolver_tagurize( self, val )
- VALUE self, val;
+syck_loader_add_private_type( argc, argv, self )
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
- VALUE tmp = rb_check_string_type(val);
+ VALUE type_re, proc, priv_types;
- if ( !NIL_P(tmp) )
- {
- char *taguri = syck_type_id_to_uri( RSTRING(tmp)->ptr );
- val = rb_str_new2( taguri );
- S_FREE( taguri );
- }
+ rb_scan_args(argc, argv, "1&", &type_re, &proc);
- return val;
+ priv_types = rb_attr_get(self, s_private_types);
+ rb_hash_aset( priv_types, type_re, proc );
+ return Qnil;
}
/*
- * YAML::Syck::DefaultResolver#detect_implicit
+ * YAML::Syck::Loader#detect
*/
VALUE
-syck_defaultresolver_detect_implicit( self, val )
+syck_loader_detect_implicit( self, val )
VALUE self, val;
{
char *type_id;
- VALUE tmp = rb_check_string_type(val);
- if ( !NIL_P(tmp) )
+ if ( TYPE(val) == T_STRING )
{
- val = tmp;
type_id = syck_match_implicit( RSTRING(val)->ptr, RSTRING(val)->len );
return rb_str_new2( type_id );
}
@@ -1241,98 +1036,129 @@ syck_defaultresolver_detect_implicit( self, val )
}
/*
- * YAML::Syck::DefaultResolver#node_import
+ * iterator to search a type hash for a match.
*/
-VALUE
-syck_defaultresolver_node_import( self, node )
- VALUE self, node;
-{
- SyckNode *n;
- VALUE obj;
- Data_Get_Struct( node, SyckNode, n );
- if ( !yaml_org_handler( n, &obj ) )
- {
- obj = rb_funcall( self, s_transfer, 2, rb_str_new2( n->type_id ), obj );
- }
- return obj;
+static VALUE
+transfer_find_i(entry, col)
+ VALUE entry, col;
+{
+ VALUE key = rb_ary_entry( entry, 0 );
+ VALUE tid = rb_ary_entry( col, 0 );
+ if ( rb_respond_to( key, s_match ) )
+ {
+ VALUE match = rb_funcall( key, rb_intern("match"), 1, tid );
+ if ( ! NIL_P( match ) )
+ {
+ rb_ary_push( col, rb_ary_entry( entry, 1 ) );
+ rb_iter_break();
+ }
+ }
+ return Qnil;
}
/*
- * YAML::Syck::GenericResolver#node_import
+ * YAML::Syck::Loader#transfer
*/
VALUE
-syck_genericresolver_node_import( self, node )
- VALUE self, node;
+syck_loader_transfer( self, type, val )
+ VALUE self, type, val;
{
- SyckNode *n;
- int i = 0;
- VALUE t = Qnil, obj = Qnil, v = Qnil, style = Qnil;
- Data_Get_Struct(node, SyckNode, n);
+ char *taguri = NULL;
- if ( n->type_id != NULL )
+ if (NIL_P(type) || !RSTRING(type)->ptr || RSTRING(type)->len == 0)
{
- t = rb_str_new2(n->type_id);
+ /*
+ * Empty transfer, detect type
+ */
+ if ( TYPE(val) == T_STRING )
+ {
+ StringValue(val);
+ taguri = syck_match_implicit( RSTRING(val)->ptr, RSTRING(val)->len );
+ taguri = syck_taguri( YAML_DOMAIN, taguri, strlen( taguri ) );
+ }
+ }
+ else
+ {
+ taguri = syck_type_id_to_uri( RSTRING(type)->ptr );
}
- switch (n->kind)
+ if ( taguri != NULL )
{
- case syck_str_kind:
+ int transferred = 0;
+ VALUE scheme, name, type_hash, domain = Qnil, type_proc = Qnil;
+ VALUE type_uri = rb_str_new2( taguri );
+ VALUE str_taguri = rb_str_new2("tag");
+ VALUE str_xprivate = rb_str_new2("x-private");
+ VALUE str_yaml_domain = rb_str_new2(YAML_DOMAIN);
+ VALUE parts = rb_str_split( type_uri, ":" );
+
+ scheme = rb_ary_shift( parts );
+
+ if ( rb_str_cmp( scheme, str_xprivate ) == 0 )
{
- v = rb_str_new( n->data.str->ptr, n->data.str->len );
- if ( n->data.str->style == scalar_1quote )
- {
- style = sym_1quote;
- }
- else if ( n->data.str->style == scalar_2quote )
- {
- style = sym_2quote;
- }
- else if ( n->data.str->style == scalar_fold )
- {
- style = sym_fold;
- }
- else if ( n->data.str->style == scalar_literal )
- {
- style = sym_literal;
- }
- else if ( n->data.str->style == scalar_plain )
+ name = rb_ary_join( parts, rb_str_new2( ":" ) );
+ type_hash = rb_attr_get(self, s_private_types);
+ }
+ else if ( rb_str_cmp( scheme, str_taguri ) == 0 )
+ {
+ domain = rb_ary_shift( parts );
+ name = rb_ary_join( parts, rb_str_new2( ":" ) );
+ type_hash = rb_attr_get(self, s_families);
+ type_hash = rb_hash_aref(type_hash, domain);
+
+ /*
+ * Route yaml.org types through the transfer
+ * method here in this extension
+ */
+ if ( rb_str_cmp( domain, str_yaml_domain ) == 0 )
{
- style = sym_plain;
+ SyckNode *n = rb_new_syck_node(val, name);
+ if ( n != NULL )
+ {
+ transferred = yaml_org_handler(n, &val);
+ S_FREE( n );
+ }
}
- obj = rb_funcall( cScalar, s_new, 3, t, v, style );
+
+ }
+ else
+ {
+ rb_raise(rb_eTypeError, "invalid typing scheme: %s given",
+ scheme);
}
- break;
- case syck_seq_kind:
- rb_iv_set(obj, "@kind", sym_seq);
- v = rb_ary_new2( syck_seq_count( n ) );
- for ( i = 0; i < syck_seq_count( n ); i++ )
+ if ( ! transferred )
+ {
+ if ( rb_obj_is_instance_of( type_hash, rb_cHash ) )
{
- rb_ary_store( v, i, syck_seq_read( n, i ) );
+ type_proc = rb_hash_aref( type_hash, name );
+ if ( NIL_P( type_proc ) )
+ {
+ VALUE col = rb_ary_new();
+ rb_ary_push( col, name );
+ rb_iterate(rb_each, type_hash, transfer_find_i, col );
+ name = rb_ary_shift( col );
+ type_proc = rb_ary_shift( col );
+ }
}
- if ( n->data.list->style == seq_inline )
- {
- style = sym_inline;
- }
- obj = rb_funcall( cSeq, s_new, 3, t, v, style );
- break;
- case syck_map_kind:
- rb_iv_set(obj, "@kind", sym_map);
- v = rb_hash_new();
- for ( i = 0; i < syck_map_count( n ); i++ )
+ if ( rb_respond_to( type_proc, s_call ) )
{
- rb_hash_aset( v, syck_map_read( n, map_key, i ), syck_map_read( n, map_value, i ) );
+ val = rb_funcall(type_proc, s_call, 2, type_uri, val);
}
- if ( n->data.pairs->style == map_inline )
+ else if ( rb_str_cmp( scheme, str_xprivate ) == 0 )
{
- style = sym_inline;
- }
- obj = rb_funcall( cMap, s_new, 3, t, v, style );
- break;
+ val = rb_funcall(cPrivateType, s_new, 2, name, val);
+ }
+ else
+ {
+ val = rb_funcall(cDomainType, s_new, 3, domain, name, val);
+ }
+ transferred = 1;
+ }
}
- return obj;
+ return val;
}
/*
@@ -1342,7 +1168,7 @@ VALUE
syck_badalias_initialize( self, val )
VALUE self, val;
{
- rb_iv_set( self, "@name", val );
+ rb_ivar_set( self, s_name, val );
return self;
}
@@ -1360,427 +1186,60 @@ syck_badalias_cmp( alias1, alias2 )
}
/*
- * YAML::DomainType.initialize
+ * YAML::Syck::DomainType.initialize
*/
VALUE
syck_domaintype_initialize( self, domain, type_id, val )
- VALUE self, domain, type_id, val;
-{
- rb_iv_set( self, "@domain", domain );
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-/*
- * YAML::Object.initialize
- */
-VALUE
-syck_yobject_initialize( self, klass, ivars )
- VALUE self, klass, ivars;
+ VALUE self, type_id, val;
{
- rb_iv_set( self, "@class", klass );
- rb_iv_set( self, "@ivars", ivars );
+ rb_ivar_set( self, s_domain, domain );
+ rb_ivar_set( self, s_type_id, type_id );
+ rb_ivar_set( self, s_value, val );
return self;
}
/*
- * YAML::PrivateType.initialize
+ * YAML::Syck::PrivateType.initialize
*/
VALUE
syck_privatetype_initialize( self, type_id, val )
VALUE self, type_id, val;
{
- rb_iv_set( self, "@type_id", type_id );
- rb_iv_set( self, "@value", val );
- return self;
-}
-
-/*
- * Mark node contents.
- */
-static void
-syck_node_mark( n )
- SyckNode *n;
-{
- int i;
- rb_gc_mark_maybe( n->id );
- switch ( n->kind )
- {
- case syck_seq_kind:
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- rb_gc_mark( syck_seq_read( n, i ) );
- }
- break;
-
- case syck_map_kind:
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- rb_gc_mark( syck_map_read( n, map_key, i ) );
- rb_gc_mark( syck_map_read( n, map_value, i ) );
- }
- break;
- }
-#if 0 /* maybe needed */
- if ( n->shortcut ) syck_node_mark( n->shortcut ); /* caution: maybe cyclic */
-#endif
-}
-
-/*
- * YAML::Syck::Scalar.allocate
- */
-VALUE
-syck_scalar_alloc( class )
- VALUE class;
-{
- SyckNode *node = syck_alloc_str();
- VALUE obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
- node->id = obj;
- return obj;
-}
-
-/*
- * YAML::Syck::Scalar.initialize
- */
-VALUE
-syck_scalar_initialize( self, type_id, val, style )
- VALUE self, type_id, val, style;
-{
- rb_iv_set( self, "@kind", sym_scalar );
- rb_funcall( self, s_type_id_set, 1, type_id );
- rb_funcall( self, s_value_set, 1, val );
- rb_funcall( self, s_style_set, 1, style );
- return self;
-}
-
-/*
- * YAML::Syck::Scalar.style=
- */
-VALUE
-syck_scalar_style_set( self, style )
- VALUE self, style;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( NIL_P( style ) )
- {
- node->data.str->style = scalar_none;
- }
- else if ( style == sym_1quote )
- {
- node->data.str->style = scalar_1quote;
- }
- else if ( style == sym_2quote )
- {
- node->data.str->style = scalar_2quote;
- }
- else if ( style == sym_fold )
- {
- node->data.str->style = scalar_fold;
- }
- else if ( style == sym_literal )
- {
- node->data.str->style = scalar_literal;
- }
- else if ( style == sym_plain )
- {
- node->data.str->style = scalar_plain;
- }
-
- rb_iv_set( self, "@style", style );
- return self;
-}
-
-/*
- * YAML::Syck::Scalar.value=
- */
-VALUE
-syck_scalar_value_set( self, val )
- VALUE self, val;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- StringValue( val );
- node->data.str->ptr = syck_strndup( RSTRING(val)->ptr, RSTRING(val)->len );
- node->data.str->len = RSTRING(val)->len;
- node->data.str->style = scalar_none;
-
- rb_iv_set( self, "@value", val );
- return val;
-}
-
-/*
- * YAML::Syck::Seq.allocate
- */
-VALUE
-syck_seq_alloc( class )
- VALUE class;
-{
- SyckNode *node;
- VALUE obj;
- node = syck_alloc_seq();
- obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
- node->id = obj;
- return obj;
-}
-
-/*
- * YAML::Syck::Seq.initialize
- */
-VALUE
-syck_seq_initialize( self, type_id, val, style )
- VALUE self, type_id, val, style;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- rb_iv_set( self, "@kind", sym_seq );
- rb_funcall( self, s_type_id_set, 1, type_id );
- rb_funcall( self, s_value_set, 1, val );
- rb_funcall( self, s_style_set, 1, style );
- return self;
-}
-
-/*
- * YAML::Syck::Seq.value=
- */
-VALUE
-syck_seq_value_set( self, val )
- VALUE self, val;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- val = rb_check_array_type( val );
- if ( !NIL_P( val ) ) {
- int i;
- syck_seq_empty( node );
- for ( i = 0; i < RARRAY( val )->len; i++ )
- {
- syck_seq_add( node, rb_ary_entry(val, i) );
- }
- }
-
- rb_iv_set( self, "@value", val );
- return val;
-}
-
-/*
- * YAML::Syck::Seq.add
- */
-VALUE
-syck_seq_add_m( self, val )
- VALUE self, val;
-{
- SyckNode *node;
- VALUE emitter = rb_ivar_get( self, s_emitter );
- Data_Get_Struct( self, SyckNode, node );
-
- if ( rb_respond_to( emitter, s_node_export ) ) {
- val = rb_funcall( emitter, s_node_export, 1, val );
- }
- syck_seq_add( node, val );
- rb_ary_push( rb_ivar_get( self, s_value ), val );
-
- return self;
-}
-
-/*
- * YAML::Syck::Seq.style=
- */
-VALUE
-syck_seq_style_set( self, style )
- VALUE self, style;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( style == sym_inline )
- {
- node->data.list->style = seq_inline;
- }
- else
- {
- node->data.list->style = seq_none;
- }
-
- rb_iv_set( self, "@style", style );
- return self;
-}
-
-/*
- * YAML::Syck::Map.allocate
- */
-VALUE
-syck_map_alloc( class )
- VALUE class;
-{
- SyckNode *node;
- VALUE obj;
- node = syck_alloc_map();
- obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
- node->id = obj;
- return obj;
-}
-
-/*
- * YAML::Syck::Map.initialize
- */
-VALUE
-syck_map_initialize( self, type_id, val, style )
- VALUE self, type_id, val, style;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( !NIL_P( val ) )
- {
- VALUE hsh = rb_check_convert_type(val, T_HASH, "Hash", "to_hash");
- VALUE keys;
- int i;
- if ( NIL_P(hsh) )
- {
- rb_raise( rb_eTypeError, "wrong argument type" );
- }
-
- keys = rb_funcall( hsh, s_keys, 0 );
- for ( i = 0; i < RARRAY(keys)->len; i++ )
- {
- VALUE key = rb_ary_entry(keys, i);
- syck_map_add( node, key, rb_hash_aref(hsh, key) );
- }
- }
-
- rb_iv_set( self, "@kind", sym_seq );
- rb_funcall( self, s_type_id_set, 1, type_id );
- rb_funcall( self, s_value_set, 1, val );
- rb_funcall( self, s_style_set, 1, style );
- return self;
-}
-
-/*
- * YAML::Syck::Map.value=
- */
-VALUE
-syck_map_value_set( self, val )
- VALUE self, val;
-{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( !NIL_P( val ) )
- {
- VALUE hsh = rb_check_convert_type(val, T_HASH, "Hash", "to_hash");
- VALUE keys;
- int i;
- if ( NIL_P(hsh) )
- {
- rb_raise( rb_eTypeError, "wrong argument type" );
- }
-
- syck_map_empty( node );
- keys = rb_funcall( hsh, s_keys, 0 );
- for ( i = 0; i < RARRAY(keys)->len; i++ )
- {
- VALUE key = rb_ary_entry(keys, i);
- syck_map_add( node, key, rb_hash_aref(hsh, key) );
- }
- }
-
- rb_iv_set( self, "@value", val );
- return val;
-}
-
-/*
- * YAML::Syck::Map.add
- */
-VALUE
-syck_map_add_m( self, key, val )
- VALUE self, key, val;
-{
- SyckNode *node;
- VALUE emitter = rb_ivar_get( self, s_emitter );
- Data_Get_Struct( self, SyckNode, node );
-
- if ( rb_respond_to( emitter, s_node_export ) ) {
- key = rb_funcall( emitter, s_node_export, 1, key );
- val = rb_funcall( emitter, s_node_export, 1, val );
- }
- syck_map_add( node, key, val );
- rb_hash_aset( rb_ivar_get( self, s_value ), key, val );
-
+ rb_ivar_set( self, s_type_id, type_id );
+ rb_ivar_set( self, s_value, val );
return self;
}
/*
- * YAML::Syck::Map.style=
+ * YAML::Syck::Node.initialize
*/
VALUE
-syck_map_style_set( self, style )
- VALUE self, style;
+syck_node_initialize( self, type_id, val )
+ VALUE self, type_id, val;
{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- if ( style == sym_inline )
- {
- node->data.pairs->style = map_inline;
- }
- else
- {
- node->data.pairs->style = map_none;
- }
-
- rb_iv_set( self, "@style", style );
+ rb_ivar_set( self, s_type_id, type_id );
+ rb_ivar_set( self, s_value, val );
return self;
}
-/*
- * Cloning method for all node types
- */
VALUE
-syck_node_init_copy( copy, orig )
- VALUE copy, orig;
+syck_node_thash( entry, t )
+ VALUE entry, t;
{
- SyckNode *copy_n;
- SyckNode *orig_n;
-
- if ( copy == orig )
- return copy;
-
- if ( TYPE( orig ) != T_DATA )
- {
- rb_raise( rb_eTypeError, "wrong argument type" );
- }
-
- Data_Get_Struct( orig, SyckNode, orig_n );
- Data_Get_Struct( copy, SyckNode, copy_n );
- MEMCPY( copy_n, orig_n, SyckNode, 1 );
- return copy;
+ VALUE key, val;
+ key = rb_ary_entry( entry, 0 );
+ val = syck_node_transform( rb_ary_entry( rb_ary_entry( entry, 1 ), 1 ) );
+ rb_hash_aset( t, key, val );
+ return Qnil;
}
-/*
- * YAML::Syck::Node#type_id=
- */
VALUE
-syck_node_type_id_set( self, type_id )
- VALUE self, type_id;
+syck_node_ahash( entry, t )
+ VALUE entry, t;
{
- SyckNode *node;
- Data_Get_Struct( self, SyckNode, node );
-
- S_FREE( node->type_id );
-
- if ( !NIL_P( type_id ) ) {
- StringValue( type_id );
- node->type_id = syck_strndup( RSTRING(type_id)->ptr, RSTRING(type_id)->len );
- }
-
- rb_iv_set( self, "@type_id", type_id );
- return type_id;
+ VALUE val = syck_node_transform( entry );
+ rb_ary_push( t, val );
+ return Qnil;
}
/*
@@ -1790,100 +1249,24 @@ VALUE
syck_node_transform( self )
VALUE self;
{
- VALUE t;
- SyckNode *n;
- SyckNode *orig_n;
- Data_Get_Struct(self, SyckNode, orig_n);
- t = Data_Wrap_Struct( cNode, syck_node_mark, syck_free_node, 0 );
-
- switch (orig_n->kind)
- {
- case syck_map_kind:
- {
- int i;
- DATA_PTR(t) = n = syck_alloc_map();
- for ( i = 0; i < orig_n->data.pairs->idx; i++ )
- {
- syck_map_add( n, rb_funcall( syck_map_read( orig_n, map_key, i ), s_transform, 0 ),
- rb_funcall( syck_map_read( orig_n, map_value, i ), s_transform, 0 ) );
- }
- }
- break;
-
- case syck_seq_kind:
- {
- int i;
- DATA_PTR(t) = n = syck_alloc_seq();
- for ( i = 0; i < orig_n->data.list->idx; i++ )
- {
- syck_seq_add( n, rb_funcall( syck_seq_read( orig_n, i ), s_transform, 0 ) );
- }
- }
- break;
-
- case syck_str_kind:
- DATA_PTR(t) = n = syck_new_str2( orig_n->data.str->ptr, orig_n->data.str->len, orig_n->data.str->style );
- break;
- }
-
- if ( orig_n->type_id != NULL )
+ VALUE t = Qnil;
+ VALUE type_id = rb_attr_get( self, s_type_id );
+ VALUE val = rb_attr_get( self, s_value );
+ if ( rb_obj_is_instance_of( val, rb_cHash ) )
{
- n->type_id = syck_strndup( orig_n->type_id, strlen( orig_n->type_id ) );
+ t = rb_hash_new();
+ rb_iterate( rb_each, val, syck_node_thash, t );
}
- if ( orig_n->anchor != NULL )
+ else if ( rb_obj_is_instance_of( val, rb_cArray ) )
{
- n->anchor = syck_strndup( orig_n->anchor, strlen( orig_n->anchor ) );
+ t = rb_ary_new();
+ rb_iterate( rb_each, val, syck_node_ahash, t );
}
- n->id = t;
- return rb_funcall( oDefaultResolver, s_node_import, 1, t );
-}
-
-/*
- * Emitter callback: assembles YAML document events from
- * Ruby symbols. This is a brilliant way to do it.
- * No one could possibly object.
- */
-void
-rb_syck_emitter_handler(e, data)
- SyckEmitter *e;
- st_data_t data;
-{
- SyckNode *n;
- Data_Get_Struct((VALUE)data, SyckNode, n);
-
- switch (n->kind)
+ else
{
- case syck_map_kind:
- {
- int i;
- syck_emit_map( e, n->type_id, n->data.pairs->style );
- for ( i = 0; i < n->data.pairs->idx; i++ )
- {
- syck_emit_item( e, syck_map_read( n, map_key, i ) );
- syck_emit_item( e, syck_map_read( n, map_value, i ) );
- }
- syck_emit_end( e );
- }
- break;
-
- case syck_seq_kind:
- {
- int i;
- syck_emit_seq( e, n->type_id, n->data.list->style );
- for ( i = 0; i < n->data.list->idx; i++ )
- {
- syck_emit_item( e, syck_seq_read( n, i ) );
- }
- syck_emit_end( e );
- }
- break;
-
- case syck_str_kind:
- {
- syck_emit_scalar( e, n->type_id, n->data.str->style, 0, 0, 0, n->data.str->ptr, n->data.str->len );
- }
- break;
+ t = val;
}
+ return rb_funcall( oDefaultLoader, s_transfer, 2, type_id, t );
}
/*
@@ -1895,9 +1278,8 @@ rb_syck_output_handler( emitter, str, len )
char *str;
long len;
{
- struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
- VALUE dest = bonus->port;
- if (TYPE(dest) == T_STRING) {
+ VALUE dest = (VALUE)emitter->bonus;
+ if ( rb_respond_to( dest, s_to_str ) ) {
rb_str_cat( dest, str, len );
} else {
rb_io_write( dest, rb_str_new( str, len ) );
@@ -1905,247 +1287,152 @@ rb_syck_output_handler( emitter, str, len )
}
/*
- * Helper function for marking nodes in the anchor
- * symbol table.
- */
-void
-syck_out_mark( emitter, node )
- VALUE emitter, node;
-{
- SyckEmitter *emitterPtr;
- struct emitter_xtra *bonus;
- Data_Get_Struct(emitter, SyckEmitter, emitterPtr);
- bonus = (struct emitter_xtra *)emitterPtr->bonus;
- rb_ivar_set( node, s_emitter, emitter );
- /* syck_emitter_mark_node( emitterPtr, (st_data_t)node ); */
- if ( !NIL_P( bonus->oid ) ) {
- rb_hash_aset( bonus->data, bonus->oid, node );
- }
-}
-
-/*
* Mark emitter values.
*/
static void
syck_mark_emitter(emitter)
SyckEmitter *emitter;
{
- struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
- rb_gc_mark( bonus->oid );
- rb_gc_mark( bonus->data );
- rb_gc_mark( bonus->port );
-}
-
-/*
- * Free the emitter and any bonus attachment.
- */
-void
-rb_syck_free_emitter(e)
- SyckEmitter *e;
-{
- S_FREE( e->bonus );
- syck_free_emitter(e);
+ rb_gc_mark(emitter->ignore_id);
+ if ( emitter->bonus != NULL )
+ {
+ rb_gc_mark( (VALUE)emitter->bonus );
+ }
}
/*
- * YAML::Syck::Emitter.allocate
+ * YAML::Syck::Emitter.new
*/
-VALUE syck_emitter_s_alloc _((VALUE));
VALUE
-syck_emitter_s_alloc(class)
- VALUE class;
-{
- VALUE pobj;
- SyckEmitter *emitter = syck_new_emitter();
-
- emitter->bonus = S_ALLOC( struct emitter_xtra );
- S_MEMZERO( emitter->bonus, struct emitter_xtra, 1 );
-
- pobj = Data_Wrap_Struct( class, syck_mark_emitter, rb_syck_free_emitter, emitter );
- syck_emitter_handler( emitter, rb_syck_emitter_handler );
- syck_output_handler( emitter, rb_syck_output_handler );
-
- rb_ivar_set( pobj, s_out, rb_funcall( cOut, s_new, 1, pobj ) );
- return pobj;
-}
-
-/*
- * YAML::Syck::Emitter.reset( options )
- */
-VALUE
-syck_emitter_reset( argc, argv, self )
+syck_emitter_new(argc, argv, class)
int argc;
VALUE *argv;
- VALUE self;
+ VALUE class;
{
- VALUE options, tmp;
- SyckEmitter *emitter;
- struct emitter_xtra *bonus;
-
- Data_Get_Struct(self, SyckEmitter, emitter);
- bonus = (struct emitter_xtra *)emitter->bonus;
+ VALUE pobj, options, init_argv[1];
+ SyckEmitter *emitter = syck_new_emitter();
+ rb_scan_args(argc, argv, "01", &options);
- bonus->oid = Qnil;
- bonus->port = rb_str_new2( "" );
- bonus->data = rb_hash_new();
+ pobj = Data_Wrap_Struct( class, syck_mark_emitter, syck_free_emitter, emitter );
+ syck_emitter_ignore_id( emitter, Qnil );
+ syck_emitter_handler( emitter, rb_syck_output_handler );
+ emitter->bonus = (void *)rb_str_new2( "" );
- if (rb_scan_args(argc, argv, "01", &options) == 0)
+ if ( ! rb_obj_is_instance_of( options, rb_cHash ) )
{
options = rb_hash_new();
- rb_ivar_set(self, s_options, options);
}
- else if ( !NIL_P(tmp = rb_check_string_type(options)) )
- {
- bonus->port = tmp;
- }
- else if ( rb_respond_to( options, s_write ) )
- {
- bonus->port = options;
- }
- else
- {
- Check_Type(options, T_HASH);
- rb_ivar_set(self, s_options, options);
- }
-
- emitter->headless = 0;
- rb_ivar_set(self, s_level, INT2FIX(0));
- rb_ivar_set(self, s_resolver, Qnil);
- return self;
+ init_argv[0] = options;
+ rb_obj_call_init(pobj, 1, init_argv);
+ return pobj;
}
/*
- * YAML::Syck::Emitter.emit( object_id ) { |out| ... }
+ * YAML::Syck::Emitter.initialize( options )
*/
-VALUE
-syck_emitter_emit( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
+static VALUE
+syck_emitter_initialize( self, options )
+ VALUE self, options;
{
- VALUE oid, proc;
- char *anchor_name;
- SyckEmitter *emitter;
- struct emitter_xtra *bonus;
- SYMID symple;
- int level = FIX2INT(rb_ivar_get(self, s_level)) + 1;
- rb_ivar_set(self, s_level, INT2FIX(level));
-
- rb_scan_args(argc, argv, "1&", &oid, &proc);
- Data_Get_Struct(self, SyckEmitter, emitter);
- bonus = (struct emitter_xtra *)emitter->bonus;
-
- /* Calculate anchors, normalize nodes, build a simpler symbol table */
- bonus->oid = oid;
- if ( !NIL_P( oid ) && RTEST( rb_funcall( bonus->data, s_haskey, 1, oid ) ) ) {
- symple = rb_hash_aref( bonus->data, oid );
- } else {
- symple = rb_funcall( proc, s_call, 1, rb_ivar_get( self, s_out ) );
- }
- syck_emitter_mark_node( emitter, (st_data_t)symple );
-
- /* Second pass, build emitted string */
- level -= 1;
- rb_ivar_set(self, s_level, INT2FIX(level));
- if ( level == 0 )
- {
- syck_emit(emitter, (st_data_t)symple);
- syck_emitter_flush(emitter, 0);
-
- return bonus->port;
- }
-
- return symple;
+ rb_ivar_set(self, s_options, options);
+ return self;
}
/*
- * YAML::Syck::Emitter#node_export
+ * YAML::Syck::Emitter.level
*/
VALUE
-syck_emitter_node_export( self, node )
- VALUE self, node;
+syck_emitter_level_m( self )
+ VALUE self;
{
- return rb_funcall( node, s_to_yaml, 1, self );
+ SyckEmitter *emitter;
+
+ Data_Get_Struct(self, SyckEmitter, emitter);
+ return LONG2NUM( emitter->level );
}
/*
- * YAML::Syck::Emitter#set_resolver
+ * YAML::Syck::Emitter.flush
*/
VALUE
-syck_emitter_set_resolver( self, resolver )
- VALUE self, resolver;
+syck_emitter_flush_m( self )
+ VALUE self;
{
- rb_ivar_set( self, s_resolver, resolver );
+ SyckEmitter *emitter;
+
+ Data_Get_Struct(self, SyckEmitter, emitter);
+ syck_emitter_flush( emitter, 0 );
return self;
}
/*
- * YAML::Syck::Out::initialize
+ * YAML::Syck::Emitter.write( str )
*/
VALUE
-syck_out_initialize( self, emitter )
- VALUE self, emitter;
+syck_emitter_write_m( self, str )
+ VALUE self, str;
{
- rb_ivar_set( self, s_emitter, emitter );
+ SyckEmitter *emitter;
+
+ Data_Get_Struct(self, SyckEmitter, emitter);
+ StringValue(str);
+ syck_emitter_write( emitter, RSTRING(str)->ptr, RSTRING(str)->len );
return self;
}
/*
- * YAML::Syck::Out::map
+ * YAML::Syck::Emitter.simple( str )
*/
VALUE
-syck_out_map( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
+syck_emitter_simple_write( self, str )
+ VALUE self, str;
{
- VALUE type_id, style, map;
- if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
- style = Qnil;
- }
- map = rb_funcall( cMap, s_new, 3, type_id, rb_hash_new(), style );
- syck_out_mark( rb_ivar_get( self, s_emitter ), map );
- rb_yield( map );
- return map;
+ SyckEmitter *emitter;
+
+ Data_Get_Struct(self, SyckEmitter, emitter);
+ StringValue(str);
+ syck_emitter_simple( emitter, RSTRING(str)->ptr, RSTRING(str)->len );
+ return self;
}
/*
- * YAML::Syck::Out::seq
+ * YAML::Syck::Emitter.start_object( object_id )
*/
VALUE
-syck_out_seq( argc, argv, self )
- int argc;
- VALUE *argv;
- VALUE self;
+syck_emitter_start_object( self, oid )
+ VALUE self, oid;
{
- VALUE type_id, style, seq;
- if (rb_scan_args(argc, argv, "11", &type_id, &style) == 1) {
- style = Qnil;
+ char *anchor_name;
+ SyckEmitter *emitter;
+
+ Data_Get_Struct(self, SyckEmitter, emitter);
+ anchor_name = syck_emitter_start_obj( emitter, oid );
+
+ if ( anchor_name == NULL )
+ {
+ return Qnil;
}
- seq = rb_funcall( cSeq, s_new, 3, type_id, rb_ary_new(), style );
- syck_out_mark( rb_ivar_get( self, s_emitter ), seq );
- rb_yield( seq );
- return seq;
+
+ return rb_str_new2( anchor_name );
}
/*
- * YAML::Syck::Out::scalar
-syck_out_scalar( self, type_id, str, style )
- VALUE self, type_id, str, style;
+ * YAML::Syck::Emitter.end_object
*/
VALUE
-syck_out_scalar( argc, argv, self )
- int argc;
- VALUE *argv;
+syck_emitter_end_object( self )
VALUE self;
{
- VALUE type_id, str, style, scalar;
- if (rb_scan_args(argc, argv, "21", &type_id, &str, &style) == 2) {
- style = Qnil;
+ SyckEmitter *emitter;
+
+ Data_Get_Struct(self, SyckEmitter, emitter);
+ syck_emitter_end_obj( emitter );
+
+ if ( emitter->level < 0 )
+ {
+ syck_emitter_flush( emitter, 0 );
}
- scalar = rb_funcall( cScalar, s_new, 3, type_id, str, style );
- syck_out_mark( rb_ivar_get( self, s_emitter ), scalar );
- return scalar;
+ return (VALUE)emitter->bonus;
}
/*
@@ -2159,171 +1446,106 @@ Init_syck()
rb_define_const( rb_syck, "VERSION", rb_str_new2( SYCK_VERSION ) );
rb_define_module_function( rb_syck, "compile", rb_syck_compile, 1 );
- /*
- * Global symbols
- */
+ /*
+ * Global symbols
+ */
s_new = rb_intern("new");
s_utc = rb_intern("utc");
s_at = rb_intern("at");
s_to_f = rb_intern("to_f");
s_to_i = rb_intern("to_i");
s_read = rb_intern("read");
+ s_anchors = rb_intern("anchors");
s_binmode = rb_intern("binmode");
s_transfer = rb_intern("transfer");
s_call = rb_intern("call");
s_cmp = rb_intern("<=>");
- s_intern = rb_intern("intern");
- s_update = rb_intern("update");
- s_detect_implicit = rb_intern("detect_implicit");
- s_dup = rb_intern("dup");
+ s_update = rb_intern("update");
+ s_dup = rb_intern("dup");
s_default_set = rb_intern("default=");
- s_match = rb_intern("match");
- s_push = rb_intern("push");
- s_haskey = rb_intern("has_key?");
- s_keys = rb_intern("keys");
- s_node_import = rb_intern("node_import");
- s_tr_bang = rb_intern("tr!");
+ s_match = rb_intern("match");
+ s_keys = rb_intern("keys");
+ s_to_str = rb_intern("to_str");
+ s_tr_bang = rb_intern("tr!");
s_unpack = rb_intern("unpack");
- s_write = rb_intern("write");
- s_tag_read_class = rb_intern( "yaml_tag_read_class" );
- s_tag_subclasses = rb_intern( "yaml_tag_subclasses?" );
- s_emitter = rb_intern( "emitter" );
- s_set_resolver = rb_intern( "set_resolver" );
- s_node_export = rb_intern( "node_export" );
- s_to_yaml = rb_intern( "to_yaml" );
- s_transform = rb_intern( "transform" );
- s_yaml_new = rb_intern("yaml_new");
- s_yaml_initialize = rb_intern("yaml_initialize");
-
- s_tags = rb_intern("@tags");
+
+ s_anchors = rb_intern("@anchors");
+ s_domain = rb_intern("@domain");
+ s_families = rb_intern("@families");
+ s_kind = rb_intern("@kind");
s_name = rb_intern("@name");
s_options = rb_intern("@options");
- s_kind = rb_intern("@kind");
+ s_private_types = rb_intern("@private_types");
s_type_id = rb_intern("@type_id");
- s_type_id_set = rb_intern("type_id=");
- s_resolver = rb_intern("@resolver");
- s_level = rb_intern( "@level" );
- s_style = rb_intern("@style");
- s_style_set = rb_intern("style=");
s_value = rb_intern("@value");
- s_value_set = rb_intern("value=");
- s_out = rb_intern("@out");
- s_input = rb_intern("@input");
- sym_model = ID2SYM(rb_intern("Model"));
- sym_generic = ID2SYM(rb_intern("Generic"));
- sym_bytecode = ID2SYM(rb_intern("bytecode"));
+ sym_model = ID2SYM(rb_intern("Model"));
+ sym_generic = ID2SYM(rb_intern("Generic"));
+ sym_input = ID2SYM(rb_intern("Input"));
+ sym_bytecode = ID2SYM(rb_intern("Bytecode"));
sym_map = ID2SYM(rb_intern("map"));
sym_scalar = ID2SYM(rb_intern("scalar"));
sym_seq = ID2SYM(rb_intern("seq"));
- sym_1quote = ID2SYM(rb_intern("quote1"));
- sym_2quote = ID2SYM(rb_intern("quote2"));
- sym_fold = ID2SYM(rb_intern("fold"));
- sym_literal = ID2SYM(rb_intern("literal"));
- sym_plain = ID2SYM(rb_intern("plain"));
- sym_inline = ID2SYM(rb_intern("inline"));
/*
- * Define YAML::Syck::Resolver class
+ * Define YAML::Syck::Loader class
*/
- cResolver = rb_define_class_under( rb_syck, "Resolver", rb_cObject );
- rb_define_attr( cResolver, "tags", 1, 1 );
- rb_define_method( cResolver, "initialize", syck_resolver_initialize, 0 );
- rb_define_method( cResolver, "add_type", syck_resolver_add_type, 2 );
- rb_define_method( cResolver, "use_types_at", syck_resolver_use_types_at, 1 );
- rb_define_method( cResolver, "detect_implicit", syck_resolver_detect_implicit, 1 );
- rb_define_method( cResolver, "transfer", syck_resolver_transfer, 2 );
- rb_define_method( cResolver, "node_import", syck_resolver_node_import, 1 );
- rb_define_method( cResolver, "tagurize", syck_resolver_tagurize, 1 );
-
- rb_global_variable( &oDefaultResolver );
- oDefaultResolver = rb_funcall( cResolver, rb_intern( "new" ), 0 );
- rb_define_singleton_method( oDefaultResolver, "node_import", syck_defaultresolver_node_import, 1 );
- rb_define_singleton_method( oDefaultResolver, "detect_implicit", syck_defaultresolver_detect_implicit, 1 );
- rb_define_const( rb_syck, "DefaultResolver", oDefaultResolver );
- rb_global_variable( &oGenericResolver );
- oGenericResolver = rb_funcall( cResolver, rb_intern( "new" ), 0 );
- rb_define_singleton_method( oGenericResolver, "node_import", syck_genericresolver_node_import, 1 );
- rb_define_const( rb_syck, "GenericResolver", oGenericResolver );
+ cLoader = rb_define_class_under( rb_syck, "Loader", rb_cObject );
+ rb_define_attr( cLoader, "families", 1, 1 );
+ rb_define_attr( cLoader, "private_types", 1, 1 );
+ rb_define_attr( cLoader, "anchors", 1, 1 );
+ rb_define_method( cLoader, "initialize", syck_loader_initialize, 0 );
+ rb_define_method( cLoader, "add_domain_type", syck_loader_add_domain_type, -1 );
+ rb_define_method( cLoader, "add_builtin_type", syck_loader_add_builtin_type, -1 );
+ rb_define_method( cLoader, "add_ruby_type", syck_loader_add_ruby_type, -1 );
+ rb_define_method( cLoader, "add_private_type", syck_loader_add_private_type, -1 );
+ rb_define_method( cLoader, "bufsize=", syck_parser_bufsize_set, 1 );
+ rb_define_method( cLoader, "bufsize", syck_parser_bufsize_get, 0 );
+ rb_define_method( cLoader, "detect_implicit", syck_loader_detect_implicit, 1 );
+ rb_define_method( cLoader, "transfer", syck_loader_transfer, 2 );
+
+ oDefaultLoader = rb_funcall( cLoader, rb_intern( "new" ), 0 );
+ rb_define_const( rb_syck, "DefaultLoader", oDefaultLoader );
/*
* Define YAML::Syck::Parser class
*/
cParser = rb_define_class_under( rb_syck, "Parser", rb_cObject );
rb_define_attr( cParser, "options", 1, 1 );
- rb_define_attr( cParser, "resolver", 1, 1 );
- rb_define_attr( cParser, "input", 1, 1 );
- rb_define_alloc_func( cParser, syck_parser_s_alloc );
- rb_define_method(cParser, "initialize", syck_parser_initialize, -1 );
- rb_define_method(cParser, "bufsize=", syck_parser_bufsize_set, 1 );
- rb_define_method(cParser, "bufsize", syck_parser_bufsize_get, 0 );
+ rb_define_singleton_method( cParser, "new", syck_parser_new, -1 );
+ rb_define_method(cParser, "initialize", syck_parser_initialize, 1);
rb_define_method(cParser, "load", syck_parser_load, -1);
rb_define_method(cParser, "load_documents", syck_parser_load_documents, -1);
- rb_define_method(cParser, "set_resolver", syck_parser_set_resolver, 1);
/*
* Define YAML::Syck::Node class
*/
cNode = rb_define_class_under( rb_syck, "Node", rb_cObject );
- rb_define_method( cNode, "initialize_copy", syck_node_init_copy, 1 );
- rb_define_attr( cNode, "emitter", 1, 1 );
- rb_define_attr( cNode, "resolver", 1, 1 );
- rb_define_attr( cNode, "kind", 1, 0 );
- rb_define_attr( cNode, "type_id", 1, 0 );
- rb_define_attr( cNode, "value", 1, 0 );
- rb_define_method( cNode, "type_id=", syck_node_type_id_set, 1 );
+ rb_define_attr( cNode, "kind", 1, 1 );
+ rb_define_attr( cNode, "type_id", 1, 1 );
+ rb_define_attr( cNode, "value", 1, 1 );
+ rb_define_attr( cNode, "anchor", 1, 1 );
+ rb_define_method( cNode, "initialize", syck_node_initialize, 2);
rb_define_method( cNode, "transform", syck_node_transform, 0);
/*
- * Define YAML::Syck::Scalar, YAML::Syck::Seq, YAML::Syck::Map --
- * all are the publicly usable variants of YAML::Syck::Node
- */
- cScalar = rb_define_class_under( rb_syck, "Scalar", cNode );
- rb_define_alloc_func( cScalar, syck_scalar_alloc );
- rb_define_attr( cNode, "value", 1, 0 );
- rb_define_method( cScalar, "initialize", syck_scalar_initialize, 3 );
- rb_define_method( cScalar, "value=", syck_scalar_value_set, 1 );
- rb_define_method( cScalar, "style=", syck_scalar_style_set, 1 );
- cSeq = rb_define_class_under( rb_syck, "Seq", cNode );
- rb_define_alloc_func( cSeq, syck_seq_alloc );
- rb_define_method( cSeq, "initialize", syck_seq_initialize, 3 );
- rb_define_method( cSeq, "value=", syck_seq_value_set, 1 );
- rb_define_method( cSeq, "add", syck_seq_add_m, 1 );
- rb_define_method( cSeq, "style=", syck_seq_style_set, 1 );
- cMap = rb_define_class_under( rb_syck, "Map", cNode );
- rb_define_alloc_func( cMap, syck_map_alloc );
- rb_define_method( cMap, "initialize", syck_map_initialize, 3 );
- rb_define_method( cMap, "value=", syck_map_value_set, 1 );
- rb_define_method( cMap, "add", syck_map_add_m, 2 );
- rb_define_method( cMap, "style=", syck_map_style_set, 1 );
-
- /*
- * Define YAML::PrivateType class
+ * Define YAML::Syck::PrivateType class
*/
- cPrivateType = rb_define_class_under( rb_yaml, "PrivateType", rb_cObject );
+ cPrivateType = rb_define_class_under( rb_syck, "PrivateType", rb_cObject );
rb_define_attr( cPrivateType, "type_id", 1, 1 );
rb_define_attr( cPrivateType, "value", 1, 1 );
rb_define_method( cPrivateType, "initialize", syck_privatetype_initialize, 2);
/*
- * Define YAML::DomainType class
+ * Define YAML::Syck::DomainType class
*/
- cDomainType = rb_define_class_under( rb_yaml, "DomainType", rb_cObject );
+ cDomainType = rb_define_class_under( rb_syck, "DomainType", rb_cObject );
rb_define_attr( cDomainType, "domain", 1, 1 );
rb_define_attr( cDomainType, "type_id", 1, 1 );
rb_define_attr( cDomainType, "value", 1, 1 );
rb_define_method( cDomainType, "initialize", syck_domaintype_initialize, 3);
/*
- * Define YAML::Object class
- */
- cYObject = rb_define_class_under( rb_yaml, "Object", rb_cObject );
- rb_define_attr( cYObject, "class", 1, 1 );
- rb_define_attr( cYObject, "ivars", 1, 1 );
- rb_define_method( cYObject, "initialize", syck_yobject_initialize, 2);
- rb_define_method( cYObject, "yaml_initialize", syck_yobject_initialize, 2);
-
- /*
* Define YAML::Syck::BadAlias class
*/
cBadAlias = rb_define_class_under( rb_syck, "BadAlias", rb_cObject );
@@ -2332,36 +1554,28 @@ Init_syck()
rb_define_method( cBadAlias, "<=>", syck_badalias_cmp, 1);
rb_include_module( cBadAlias, rb_const_get( rb_cObject, rb_intern("Comparable") ) );
- /*
- * Define YAML::Syck::MergeKey class
- */
- cMergeKey = rb_define_class_under( rb_syck, "MergeKey", rb_cObject );
-
- /*
- * Define YAML::Syck::DefaultKey class
- */
- cDefaultKey = rb_define_class_under( rb_syck, "DefaultKey", rb_cObject );
+ /*
+ * Define YAML::Syck::MergeKey class
+ */
+ cMergeKey = rb_define_class_under( rb_syck, "MergeKey", rb_cObject );
- /*
- * Define YAML::Syck::Out classes
- */
- cOut = rb_define_class_under( rb_syck, "Out", rb_cObject );
- rb_define_attr( cOut, "emitter", 1, 1 );
- rb_define_method( cOut, "initialize", syck_out_initialize, 1 );
- rb_define_method( cOut, "map", syck_out_map, -1 );
- rb_define_method( cOut, "seq", syck_out_seq, -1 );
- rb_define_method( cOut, "scalar", syck_out_scalar, -1 );
+ /*
+ * Define YAML::Syck::DefaultKey class
+ */
+ cDefaultKey = rb_define_class_under( rb_syck, "DefaultKey", rb_cObject );
/*
* Define YAML::Syck::Emitter class
*/
cEmitter = rb_define_class_under( rb_syck, "Emitter", rb_cObject );
- rb_define_attr( cEmitter, "level", 1, 1 );
- rb_define_alloc_func( cEmitter, syck_emitter_s_alloc );
- rb_define_method( cEmitter, "initialize", syck_emitter_reset, -1 );
- rb_define_method( cEmitter, "reset", syck_emitter_reset, -1 );
- rb_define_method( cEmitter, "emit", syck_emitter_emit, -1 );
- rb_define_method( cEmitter, "set_resolver", syck_emitter_set_resolver, 1);
- rb_define_method( cEmitter, "node_export", syck_emitter_node_export, 1);
+ rb_define_singleton_method( cEmitter, "new", syck_emitter_new, -1 );
+ rb_define_method( cEmitter, "initialize", syck_emitter_initialize, 1 );
+ rb_define_method( cEmitter, "level", syck_emitter_level_m, 0 );
+ rb_define_method( cEmitter, "write", syck_emitter_write_m, 1 );
+ rb_define_method( cEmitter, "<<", syck_emitter_write_m, 1 );
+ rb_define_method( cEmitter, "simple", syck_emitter_simple_write, 1 );
+ rb_define_method( cEmitter, "flush", syck_emitter_flush_m, 0 );
+ rb_define_method( cEmitter, "start_object", syck_emitter_start_object, 1 );
+ rb_define_method( cEmitter, "end_object", syck_emitter_end_object, 0 );
}
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
index ac5427bc1b..5a15ab4947 100644
--- a/ext/syck/syck.c
+++ b/ext/syck/syck.c
@@ -1,8 +1,8 @@
/*
* syck.c
*
- * $Author: matz $
- * $Date: 2006/08/07 08:09:34 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -209,6 +209,15 @@ void
syck_st_free( SyckParser *p )
{
/*
+ * Free the adhoc symbol table
+ */
+ if ( p->syms != NULL )
+ {
+ st_free_table( p->syms );
+ p->syms = NULL;
+ }
+
+ /*
* Free the anchor tables
*/
if ( p->anchors != NULL )
@@ -230,15 +239,6 @@ void
syck_free_parser( SyckParser *p )
{
/*
- * Free the adhoc symbol table
- */
- if ( p->syms != NULL )
- {
- st_free_table( p->syms );
- p->syms = NULL;
- }
-
- /*
* Free tables, levels
*/
syck_st_free( p );
@@ -410,10 +410,12 @@ syck_move_tokens( SyckParser *p )
return 0;
skip = p->limit - p->token;
+ if ( skip < 1 )
+ return 0;
+
if ( ( count = p->token - p->buffer ) )
{
- if (skip > 0)
- S_MEMMOVE( p->buffer, p->token, char, skip );
+ S_MEMMOVE( p->buffer, p->token, char, skip );
p->token = p->buffer;
p->marker -= count;
p->cursor -= count;
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
index 51a0f0aa9c..02dbce9835 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -1,8 +1,8 @@
/*
* syck.h
*
- * $Author: ocean $
- * $Date: 2005/12/20 04:13:26 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -13,7 +13,7 @@
#define SYCK_YAML_MAJOR 1
#define SYCK_YAML_MINOR 0
-#define SYCK_VERSION "0.60"
+#define SYCK_VERSION "0.45"
#define YAML_DOMAIN "yaml.org,2002"
#include <stdio.h>
@@ -51,7 +51,7 @@ extern "C" {
#define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
#define S_ALLOC(type) (type*)malloc(sizeof(type))
#define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
-#define S_FREE(n) if (n) { free(n); n = NULL; }
+#define S_FREE(n) free(n); n = NULL;
#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
@@ -63,16 +63,12 @@ extern "C" {
#define BLOCK_FOLD 10
#define BLOCK_LIT 20
#define BLOCK_PLAIN 30
-#define NL_CHOMP 40
-#define NL_KEEP 50
+#define NL_CHOMP 130
+#define NL_KEEP 140
/*
* Node definitions
*/
-#ifndef ST_DATA_T_DEFINED
-typedef long st_data_t;
-#endif
-
#define SYMID unsigned long
typedef struct _syck_node SyckNode;
@@ -88,23 +84,12 @@ enum map_part {
map_value
};
-enum map_style {
- map_none,
- map_inline
-};
-
-enum seq_style {
- seq_none,
- seq_inline
-};
-
enum scalar_style {
scalar_none,
+ scalar_plain,
scalar_1quote,
scalar_2quote,
- scalar_fold,
- scalar_literal,
- scalar_plain
+ scalar_block
};
/*
@@ -122,7 +107,6 @@ struct _syck_node {
union {
/* Storage for map data */
struct SyckMap {
- enum map_style style;
SYMID *keys;
SYMID *values;
long capa;
@@ -130,7 +114,6 @@ struct _syck_node {
} *pairs;
/* Storage for sequence data */
struct SyckSeq {
- enum seq_style style;
SYMID *items;
long capa;
long idx;
@@ -180,13 +163,9 @@ enum syck_level_status {
syck_lvl_map,
syck_lvl_block,
syck_lvl_str,
- syck_lvl_iseq,
- syck_lvl_imap,
+ syck_lvl_inline,
syck_lvl_end,
- syck_lvl_pause,
- syck_lvl_anctag,
- syck_lvl_mapx,
- syck_lvl_seqx
+ syck_lvl_pause
};
/*
@@ -207,16 +186,9 @@ struct _syck_str {
};
struct _syck_level {
- /* Indent */
int spaces;
- /* Counts nodes emitted at this level, useful for parsing
- * keys and pairs in bytecode */
int ncount;
- /* Does node have anchors or tags? */
- int anctag;
- /* Domain prefixing at the given level */
char *domain;
- /* Keeps a node status */
enum syck_level_status status;
};
@@ -259,7 +231,6 @@ struct _syck_parser {
SyckLevel *levels;
int lvl_idx;
int lvl_capa;
- /* Pointer for extension's use */
void *bonus;
};
@@ -270,19 +241,27 @@ typedef struct _syck_emitter SyckEmitter;
typedef struct _syck_emitter_node SyckEmitterNode;
typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long);
-typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t);
enum doc_stage {
doc_open,
+ doc_need_header,
doc_processing
};
+enum block_styles {
+ block_arbitrary,
+ block_fold,
+ block_literal
+};
+
/*
* Emitter struct
*/
struct _syck_emitter {
/* Headerless doc flag */
int headless;
+ /* Sequence map shortcut flag */
+ int seq_map;
/* Force header? */
int use_header;
/* Force version? */
@@ -296,7 +275,7 @@ struct _syck_emitter {
/* Best width on folded scalars */
int best_width;
/* Use literal[1] or folded[2] blocks on all text? */
- enum scalar_style style;
+ enum block_styles block_style;
/* Stage of written document */
enum doc_stage stage;
/* Level counter */
@@ -306,21 +285,15 @@ struct _syck_emitter {
/* Object ignore ID */
SYMID ignore_id;
/* Symbol table for anchors */
- st_table *markers, *anchors, *anchored;
+ st_table *markers, *anchors;
/* Custom buffer size */
size_t bufsize;
/* Buffer */
char *buffer, *marker;
/* Absolute position of the buffer */
long bufpos;
- /* Handler for emitter nodes */
- SyckEmitterHandler emitter_handler;
/* Handler for output */
- SyckOutputHandler output_handler;
- /* Levels of indentation */
- SyckLevel *levels;
- int lvl_idx;
- int lvl_capa;
+ SyckOutputHandler handler;
/* Pointer for extension's use */
void *bonus;
};
@@ -347,7 +320,6 @@ SyckNode *syck_hdlr_get_anchor( SyckParser *, char * );
void syck_add_transfer( char *, SyckNode *, int );
char *syck_xprivate( char *, int );
char *syck_taguri( char *, char *, int );
-int syck_tagcmp( char *, char * );
int syck_add_sym( SyckParser *, char * );
int syck_lookup_sym( SyckParser *, SYMID, char ** );
int syck_try_implicit( SyckNode * );
@@ -364,38 +336,20 @@ long syck_io_str_read( char *, SyckIoStr *, long, long );
char *syck_base64enc( char *, long );
char *syck_base64dec( char *, long );
SyckEmitter *syck_new_emitter();
-SYMID syck_emitter_mark_node( SyckEmitter *, st_data_t );
void syck_emitter_ignore_id( SyckEmitter *, SYMID );
-void syck_output_handler( SyckEmitter *, SyckOutputHandler );
-void syck_emitter_handler( SyckEmitter *, SyckEmitterHandler );
+void syck_emitter_handler( SyckEmitter *, SyckOutputHandler );
void syck_free_emitter( SyckEmitter * );
void syck_emitter_clear( SyckEmitter * );
+void syck_emitter_simple( SyckEmitter *, char *, long );
void syck_emitter_write( SyckEmitter *, char *, long );
-void syck_emitter_escape( SyckEmitter *, char *, long );
void syck_emitter_flush( SyckEmitter *, long );
-void syck_emit( SyckEmitter *, st_data_t );
-void syck_emit_scalar( SyckEmitter *, char *, enum scalar_style, int, int, char, char *, long );
-void syck_emit_1quoted( SyckEmitter *, int, char *, long );
-void syck_emit_2quoted( SyckEmitter *, int, char *, long );
-void syck_emit_folded( SyckEmitter *, int, char, char *, long );
-void syck_emit_literal( SyckEmitter *, char, char *, long );
-void syck_emit_seq( SyckEmitter *, char *, enum seq_style );
-void syck_emit_item( SyckEmitter *, st_data_t );
-void syck_emit_map( SyckEmitter *, char *, enum map_style );
-void syck_emit_end( SyckEmitter * );
-void syck_emit_tag( SyckEmitter *, char *, char * );
-void syck_emit_indent( SyckEmitter * );
-SyckLevel *syck_emitter_current_level( SyckEmitter * );
-SyckLevel *syck_emitter_parent_level( SyckEmitter * );
-void syck_emitter_pop_level( SyckEmitter * );
-void syck_emitter_add_level( SyckEmitter *, int, enum syck_level_status );
-void syck_emitter_reset_levels( SyckEmitter * );
+char *syck_emitter_start_obj( SyckEmitter *, SYMID );
+void syck_emitter_end_obj( SyckEmitter * );
SyckParser *syck_new_parser();
void syck_free_parser( SyckParser * );
void syck_parser_set_root_on_error( SyckParser *, SYMID );
void syck_parser_implicit_typing( SyckParser *, int );
void syck_parser_taguri_expansion( SyckParser *, int );
-int syck_scan_scalar( int, char *, long );
void syck_parser_handler( SyckParser *, SyckNodeHandler );
void syck_parser_error_handler( SyckParser *, SyckErrorHandler );
void syck_parser_bad_anchor_handler( SyckParser *, SyckBadAnchorHandler );
@@ -408,6 +362,7 @@ void syck_parser_pop_level( SyckParser * );
void free_any_io( SyckParser * );
long syck_parser_read( SyckParser * );
long syck_parser_readlen( SyckParser *, long );
+void syck_parser_init( SyckParser *, int );
SYMID syck_parse( SyckParser * );
void syck_default_error_handler( SyckParser *, char * );
SYMID syck_yaml2byte_handler( SyckParser *, SyckNode * );
@@ -423,31 +378,29 @@ void syck_free_node( SyckNode * );
void syck_free_members( SyckNode * );
SyckNode *syck_new_str( char *, enum scalar_style );
SyckNode *syck_new_str2( char *, long, enum scalar_style );
-void syck_replace_str( SyckNode *, char *, enum scalar_style );
-void syck_replace_str2( SyckNode *, char *, long, enum scalar_style );
void syck_str_blow_away_commas( SyckNode * );
char *syck_str_read( SyckNode * );
SyckNode *syck_new_map( SYMID, SYMID );
-void syck_map_empty( SyckNode * );
void syck_map_add( SyckNode *, SYMID, SYMID );
SYMID syck_map_read( SyckNode *, enum map_part, long );
void syck_map_assign( SyckNode *, enum map_part, long, SYMID );
long syck_map_count( SyckNode * );
void syck_map_update( SyckNode *, SyckNode * );
SyckNode *syck_new_seq( SYMID );
-void syck_seq_empty( SyckNode * );
void syck_seq_add( SyckNode *, SYMID );
-void syck_seq_assign( SyckNode *, long, SYMID );
SYMID syck_seq_read( SyckNode *, long );
long syck_seq_count( SyckNode * );
+void apply_seq_in_map( SyckParser *, SyckNode * );
+
/*
* Lexer prototypes
*/
void syckerror( char * );
-int syckparse( void * );
-union YYSTYPE;
-int sycklex( union YYSTYPE *, SyckParser * );
+
+#ifndef ST_DATA_T_DEFINED
+typedef long st_data_t;
+#endif
#if defined(__cplusplus)
} /* extern "C" { */
diff --git a/ext/syck/token.c b/ext/syck/token.c
index e7b0414f74..85a4e103ab 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,10 +1,10 @@
-/* Generated by re2c 0.9.10 on Tue Sep 20 17:46:17 2005 */
+/* Generated by re2c 0.9.3 on Fri Aug 13 11:47:50 2004 */
#line 1 "token.re"
/*
* token.re
*
- * $Author: why $
- * $Date: 2005/09/20 23:56:24 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff
*/
@@ -61,7 +61,7 @@
#define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \
if ( last_lvl->spaces < to_len ) \
{ \
- if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \
+ if ( last_lvl->status == syck_lvl_inline ) \
{ \
goto Document; \
} \
@@ -131,25 +131,6 @@
return YAML_PLAIN; \
}
-/* concat the inline characters to the plain scalar */
-#define PLAIN_NOT_INL() \
- if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) ) \
- { \
- YYCURSOR--; \
- } \
- QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); \
- goto Plain2;
-
-/* trim spaces off the end in case of indent */
-#define PLAIN_IS_INL() \
- char *walker = qstr + qidx - 1; \
- while ( walker > qstr && ( *walker == '\n' || *walker == ' ' || *walker == '\t' ) ) \
- { \
- qidx--; \
- walker[0] = '\0'; \
- walker--; \
- }
-
/*
* Keep or chomp block?
* * Use only in "ScalarBlock" section *
@@ -157,21 +138,10 @@
#define RETURN_YAML_BLOCK() \
{ \
SyckNode *n = syck_alloc_str(); \
- if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \
- { \
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); \
- } \
- else \
- { \
- n->type_id = syck_strndup( "str", 3 ); \
- } \
+ n->type_id = syck_strndup( "str", 3 ); \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
- if ( blockType == BLOCK_LIT ) { \
- n->data.str->style = scalar_literal; \
- } else { \
- n->data.str->style = scalar_fold; \
- } \
+ n->data.str->style = scalar_block; \
if ( qidx > 0 ) \
{ \
if ( nlDoWhat != NL_KEEP ) \
@@ -218,7 +188,7 @@
{ \
SyckLevel *lvl_deep = CURRENT_LEVEL(); \
indt_len = lvl_deep->spaces; \
- if ( lvl_deep->status == syck_lvl_seq || ( indt_len == YYCURSOR - YYLINEPTR && lvl_deep->status != syck_lvl_map ) ) \
+ if ( indt_len == YYTOKEN - YYLINEPTR ) \
{ \
SyckLevel *lvl_over; \
parser->lvl_idx--; \
@@ -268,7 +238,6 @@ sycklex( YYSTYPE *sycklval, SyckParser *parser )
case syck_bytecode_utf8:
return sycklex_bytecode_utf8( sycklval, parser );
}
- return YAML_DOCSEP;
}
/*
@@ -291,7 +260,7 @@ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser )
return t;
}
-#line 315 "token.re"
+#line 279 "token.re"
if ( YYLINEPTR != YYCURSOR )
@@ -304,20 +273,20 @@ Header:
YYTOKEN = YYCURSOR;
-#line 307 "<stdout>"
+#line 7 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
- ++YYCURSOR;
+yy1: ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy7;
- case 0x09: case ' ': goto yy12;
- case 0x0A: goto yy9;
- case 0x0D: goto yy11;
+ case '\000': goto yy7;
+ case '\n': goto yy9;
+ case '\r': goto yy11;
+ case ' ': goto yy12;
case '#': goto yy5;
case '-': goto yy2;
case '.': goto yy4;
@@ -330,11 +299,11 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 374 "token.re"
+#line 338 "token.re"
{ YYPOS(0);
goto Document;
}
-#line 337 "<stdout>"
+#line 37 "<stdout>"
yy4: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -344,44 +313,44 @@ yy4: yyaccept = 0;
yy5: ++YYCURSOR;
goto yy6;
yy6:
-#line 356 "token.re"
+#line 320 "token.re"
{ eat_comments( parser );
goto Header;
}
-#line 351 "<stdout>"
+#line 51 "<stdout>"
yy7: ++YYCURSOR;
goto yy8;
yy8:
-#line 360 "token.re"
+#line 324 "token.re"
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 361 "<stdout>"
+#line 61 "<stdout>"
yy9: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy18;
yy10:
-#line 366 "token.re"
+#line 330 "token.re"
{ GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN );
goto Header;
}
-#line 370 "<stdout>"
+#line 70 "<stdout>"
yy11: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy17;
+ case '\n': goto yy17;
default: goto yy3;
}
yy12: ++YYCURSOR;
yych = *YYCURSOR;
goto yy16;
yy13:
-#line 370 "token.re"
+#line 334 "token.re"
{ doc_level = YYCURSOR - YYLINEPTR;
goto Header;
}
-#line 384 "<stdout>"
+#line 83 "<stdout>"
yy14: yych = *++YYCURSOR;
goto yy3;
yy15: ++YYCURSOR;
@@ -389,7 +358,7 @@ yy15: ++YYCURSOR;
yych = *YYCURSOR;
goto yy16;
yy16: switch(yych){
- case 0x09: case ' ': goto yy15;
+ case ' ': goto yy15;
default: goto yy13;
}
yy17: yyaccept = 1;
@@ -398,15 +367,15 @@ yy17: yyaccept = 1;
yych = *YYCURSOR;
goto yy18;
yy18: switch(yych){
- case 0x0A: case ' ': goto yy17;
- case 0x0D: goto yy19;
+ case '\n': case ' ': goto yy17;
+ case '\r': goto yy19;
default: goto yy10;
}
yy19: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy17;
+ case '\n': goto yy17;
default: goto yy20;
}
yy20: YYCURSOR = YYMARKER;
@@ -421,15 +390,15 @@ yy21: yych = *++YYCURSOR;
}
yy22: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy23;
- case 0x0D: goto yy27;
+ case '\n': goto yy23;
+ case '\r': goto yy27;
case ' ': goto yy25;
default: goto yy20;
}
yy23: ++YYCURSOR;
goto yy24;
yy24:
-#line 342 "token.re"
+#line 306 "token.re"
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -443,7 +412,7 @@ yy24:
}
return 0;
}
-#line 446 "<stdout>"
+#line 147 "<stdout>"
yy25: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -454,7 +423,7 @@ yy26: switch(yych){
}
yy27: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy23;
+ case '\n': goto yy23;
default: goto yy20;
}
yy28: yych = *++YYCURSOR;
@@ -464,15 +433,15 @@ yy28: yych = *++YYCURSOR;
}
yy29: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy30;
- case 0x0D: goto yy34;
+ case '\n': goto yy30;
+ case '\r': goto yy34;
case ' ': goto yy32;
default: goto yy20;
}
yy30: ++YYCURSOR;
goto yy31;
yy31:
-#line 328 "token.re"
+#line 292 "token.re"
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -486,7 +455,7 @@ yy31:
return 0;
}
}
-#line 489 "<stdout>"
+#line 191 "<stdout>"
yy32: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -497,11 +466,11 @@ yy33: switch(yych){
}
yy34: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy30;
+ case '\n': goto yy30;
default: goto yy20;
}
}
-#line 378 "token.re"
+#line 342 "token.re"
Document:
@@ -515,39 +484,38 @@ Document:
YYTOKEN = YYCURSOR;
-#line 518 "<stdout>"
+#line 209 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy35;
- ++YYCURSOR;
+yy36: ++YYCURSOR;
yy35:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy62;
- case 0x09: case ' ': goto yy60;
- case 0x0A: goto yy37;
- case 0x0D: goto yy39;
- case '!': goto yy51;
- case '"': goto yy55;
- case '#': goto yy58;
- case '&': goto yy49;
- case '\'': goto yy53;
- case '*': goto yy50;
- case ',': case ':': goto yy47;
- case '-': case '?': goto yy48;
- case '>': case '|': goto yy57;
- case '[': goto yy41;
- case ']': case '}': goto yy45;
- case '{': goto yy43;
- default: goto yy64;
+ case '\000': goto yy60;
+ case '\n': goto yy37;
+ case '\r': goto yy39;
+ case ' ': goto yy58;
+ case '!': goto yy49;
+ case '"': goto yy53;
+ case '#': goto yy56;
+ case '&': goto yy47;
+ case '\'': goto yy51;
+ case '*': goto yy48;
+ case ',': case ':': goto yy45;
+ case '-': case '?': goto yy46;
+ case '>': case '|': goto yy55;
+ case '[': case '{': goto yy41;
+ case ']': case '}': goto yy43;
+ default: goto yy62;
}
yy37: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy92;
+ goto yy90;
yy38:
-#line 392 "token.re"
+#line 356 "token.re"
{ /* Isolate spaces */
int indt_len;
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
@@ -561,7 +529,7 @@ yy38:
}
/* Ignore indentation inside inlines */
- if ( lvl->status == syck_lvl_iseq || lvl->status == syck_lvl_imap )
+ if ( lvl->status == syck_lvl_inline )
{
goto Document;
}
@@ -575,63 +543,53 @@ yy38:
}
return YAML_INDENT;
}
-#line 578 "<stdout>"
+#line 268 "<stdout>"
yy39: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy91;
+ case '\n': goto yy89;
default: goto yy40;
}
yy40:
-#line 497 "token.re"
+#line 454 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto Plain;
}
-#line 589 "<stdout>"
+#line 279 "<stdout>"
yy41: ++YYCURSOR;
goto yy42;
yy42:
-#line 420 "token.re"
+#line 384 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
lvl = CURRENT_LEVEL();
- ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq);
+ ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
return YYTOKEN[0];
}
-#line 599 "<stdout>"
+#line 289 "<stdout>"
yy43: ++YYCURSOR;
goto yy44;
yy44:
-#line 426 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- lvl = CURRENT_LEVEL();
- ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap);
- return YYTOKEN[0];
- }
-#line 609 "<stdout>"
-yy45: ++YYCURSOR;
- goto yy46;
-yy46:
-#line 432 "token.re"
+#line 390 "token.re"
{ POP_LEVEL();
return YYTOKEN[0];
}
-#line 617 "<stdout>"
-yy47: yyaccept = 1;
+#line 297 "<stdout>"
+yy45: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x0A: goto yy86;
- case 0x0D: goto yy90;
- case ' ': goto yy88;
+ case '\n': goto yy84;
+ case '\r': goto yy88;
+ case ' ': goto yy86;
default: goto yy40;
}
-yy48: yyaccept = 1;
+yy46: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x0A: goto yy81;
- case 0x0D: goto yy85;
- case ' ': goto yy83;
+ case '\n': goto yy79;
+ case '\r': goto yy83;
+ case ' ': goto yy81;
default: goto yy40;
}
-yy49: yych = *++YYCURSOR;
+yy47: yych = *++YYCURSOR;
switch(yych){
case '-': case '0':
case '1':
@@ -692,10 +650,10 @@ yy49: yych = *++YYCURSOR;
case 'w':
case 'x':
case 'y':
- case 'z': goto yy78;
+ case 'z': goto yy76;
default: goto yy40;
}
-yy50: yych = *++YYCURSOR;
+yy48: yych = *++YYCURSOR;
switch(yych){
case '-': case '0':
case '1':
@@ -756,35 +714,35 @@ yy50: yych = *++YYCURSOR;
case 'w':
case 'x':
case 'y':
- case 'z': goto yy75;
+ case 'z': goto yy73;
default: goto yy40;
}
+yy49: ++YYCURSOR;
+ goto yy50;
+yy50:
+#line 428 "token.re"
+{ goto TransferMethod; }
+#line 447 "<stdout>"
yy51: ++YYCURSOR;
goto yy52;
yy52:
-#line 471 "token.re"
-{ goto TransferMethod; }
-#line 767 "<stdout>"
+#line 430 "token.re"
+{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
+ goto SingleQuote; }
+#line 454 "<stdout>"
yy53: ++YYCURSOR;
goto yy54;
yy54:
-#line 473 "token.re"
-{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
- goto SingleQuote; }
-#line 774 "<stdout>"
-yy55: ++YYCURSOR;
- goto yy56;
-yy56:
-#line 476 "token.re"
+#line 433 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto DoubleQuote; }
-#line 781 "<stdout>"
-yy57: yyaccept = 1;
+#line 461 "<stdout>"
+yy55: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x0A: goto yy70;
- case 0x0D: goto yy74;
- case ' ': goto yy72;
+ case '\n': goto yy68;
+ case '\r': goto yy72;
+ case ' ': goto yy70;
case '+': case '-': case '0':
case '1':
case '2':
@@ -794,51 +752,51 @@ yy57: yyaccept = 1;
case '6':
case '7':
case '8':
- case '9': goto yy67;
+ case '9': goto yy65;
default: goto yy40;
}
-yy58: ++YYCURSOR;
- goto yy59;
-yy59:
-#line 486 "token.re"
+yy56: ++YYCURSOR;
+ goto yy57;
+yy57:
+#line 443 "token.re"
{ eat_comments( parser );
goto Document;
}
-#line 807 "<stdout>"
-yy60: ++YYCURSOR;
+#line 487 "<stdout>"
+yy58: ++YYCURSOR;
yych = *YYCURSOR;
- goto yy66;
-yy61:
-#line 490 "token.re"
+ goto yy64;
+yy59:
+#line 447 "token.re"
{ goto Document; }
-#line 814 "<stdout>"
-yy62: ++YYCURSOR;
- goto yy63;
-yy63:
-#line 492 "token.re"
+#line 493 "<stdout>"
+yy60: ++YYCURSOR;
+ goto yy61;
+yy61:
+#line 449 "token.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 823 "<stdout>"
-yy64: yych = *++YYCURSOR;
+#line 502 "<stdout>"
+yy62: yych = *++YYCURSOR;
goto yy40;
+yy63: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy64;
+yy64: switch(yych){
+ case ' ': goto yy63;
+ default: goto yy59;
+ }
yy65: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy66;
yy66: switch(yych){
- case 0x09: case ' ': goto yy65;
- default: goto yy61;
- }
-yy67: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy68;
-yy68: switch(yych){
- case 0x0A: goto yy70;
- case 0x0D: goto yy74;
- case ' ': goto yy72;
+ case '\n': goto yy68;
+ case '\r': goto yy72;
+ case ' ': goto yy70;
case '+': case '-': case '0':
case '1':
case '2':
@@ -848,43 +806,43 @@ yy68: switch(yych){
case '6':
case '7':
case '8':
- case '9': goto yy67;
- default: goto yy69;
+ case '9': goto yy65;
+ default: goto yy67;
}
-yy69: YYCURSOR = YYMARKER;
+yy67: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy38;
case 1: goto yy40;
}
-yy70: ++YYCURSOR;
- goto yy71;
-yy71:
-#line 479 "token.re"
+yy68: ++YYCURSOR;
+ goto yy69;
+yy69:
+#line 436 "token.re"
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
}
goto ScalarBlock;
}
-#line 869 "<stdout>"
-yy72: ++YYCURSOR;
+#line 550 "<stdout>"
+yy70: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy73;
-yy73: switch(yych){
- case ' ': goto yy72;
- default: goto yy71;
+ goto yy71;
+yy71: switch(yych){
+ case ' ': goto yy70;
+ default: goto yy69;
}
-yy74: yych = *++YYCURSOR;
+yy72: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy70;
- default: goto yy69;
+ case '\n': goto yy68;
+ default: goto yy67;
}
-yy75: ++YYCURSOR;
+yy73: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy76;
-yy76: switch(yych){
+ goto yy74;
+yy74: switch(yych){
case '-': case '0':
case '1':
case '2':
@@ -944,21 +902,21 @@ yy76: switch(yych){
case 'w':
case 'x':
case 'y':
- case 'z': goto yy75;
- default: goto yy77;
+ case 'z': goto yy73;
+ default: goto yy75;
}
-yy77:
-#line 466 "token.re"
+yy75:
+#line 423 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return YAML_ALIAS;
}
-#line 956 "<stdout>"
-yy78: ++YYCURSOR;
+#line 639 "<stdout>"
+yy76: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy79;
-yy79: switch(yych){
+ goto yy77;
+yy77: switch(yych){
case '-': case '0':
case '1':
case '2':
@@ -1018,11 +976,11 @@ yy79: switch(yych){
case 'w':
case 'x':
case 'y':
- case 'z': goto yy78;
- default: goto yy80;
+ case 'z': goto yy76;
+ default: goto yy78;
}
-yy80:
-#line 455 "token.re"
+yy78:
+#line 412 "token.re"
{ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
/*
@@ -1033,79 +991,78 @@ yy80:
syck_hdlr_remove_anchor(parser, sycklval->name);
return YAML_ANCHOR;
}
-#line 1036 "<stdout>"
-yy81: ++YYCURSOR;
- goto yy82;
-yy82:
-#line 441 "token.re"
+#line 720 "<stdout>"
+yy79: ++YYCURSOR;
+ goto yy80;
+yy80:
+#line 398 "token.re"
{ ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(YAML_IOPEN);
if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
- ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_seq);
+ ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_doc);
}
else /* spaces followed by content uses the space as indentation */
{
- ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_seq);
+ ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_doc);
}
return YYTOKEN[0];
}
-#line 1054 "<stdout>"
-yy83: ++YYCURSOR;
+#line 738 "<stdout>"
+yy81: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy84;
-yy84: switch(yych){
- case ' ': goto yy83;
- default: goto yy82;
+ goto yy82;
+yy82: switch(yych){
+ case ' ': goto yy81;
+ default: goto yy80;
}
-yy85: yych = *++YYCURSOR;
+yy83: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy81;
- default: goto yy69;
- }
-yy86: ++YYCURSOR;
- goto yy87;
-yy87:
-#line 436 "token.re"
-{ if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map;
- YYPOS(1);
+ case '\n': goto yy79;
+ default: goto yy67;
+ }
+yy84: ++YYCURSOR;
+ goto yy85;
+yy85:
+#line 394 "token.re"
+{ YYPOS(1);
return YYTOKEN[0];
}
-#line 1076 "<stdout>"
-yy88: ++YYCURSOR;
+#line 760 "<stdout>"
+yy86: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy89;
-yy89: switch(yych){
- case ' ': goto yy88;
- default: goto yy87;
+ goto yy87;
+yy87: switch(yych){
+ case ' ': goto yy86;
+ default: goto yy85;
}
-yy90: yych = *++YYCURSOR;
+yy88: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy86;
- default: goto yy69;
+ case '\n': goto yy84;
+ default: goto yy67;
}
-yy91: yyaccept = 0;
+yy89: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy92;
-yy92: switch(yych){
- case 0x0A: case ' ': goto yy91;
- case 0x0D: goto yy93;
+ goto yy90;
+yy90: switch(yych){
+ case '\n': case ' ': goto yy89;
+ case '\r': goto yy91;
default: goto yy38;
}
-yy93: ++YYCURSOR;
+yy91: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy91;
- default: goto yy69;
+ case '\n': goto yy89;
+ default: goto yy67;
}
}
-#line 501 "token.re"
+#line 458 "token.re"
}
@@ -1114,26 +1071,26 @@ Directive:
YYTOKTMP = YYCURSOR;
-#line 1117 "<stdout>"
+#line 796 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy94;
- ++YYCURSOR;
-yy94:
+ goto yy92;
+yy93: ++YYCURSOR;
+yy92:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy96;
- case 0x09: case ' ': goto yy99;
- case '%': goto yy97;
- default: goto yy101;
+ case '\000': goto yy94;
+ case ' ': goto yy97;
+ case '%': goto yy95;
+ default: goto yy99;
}
-yy96: YYCURSOR = YYMARKER;
+yy94: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy98;
+ case 0: goto yy96;
}
-yy97: yyaccept = 0;
+yy95: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
case '.':
@@ -1210,37 +1167,37 @@ yy97: yyaccept = 0;
case 'w':
case 'x':
case 'y':
- case 'z': goto yy104;
- default: goto yy98;
+ case 'z': goto yy102;
+ default: goto yy96;
}
-yy98:
-#line 514 "token.re"
+yy96:
+#line 471 "token.re"
{ YYCURSOR = YYTOKTMP;
return YAML_DOCSEP;
}
-#line 1221 "<stdout>"
-yy99: ++YYCURSOR;
+#line 900 "<stdout>"
+yy97: ++YYCURSOR;
yych = *YYCURSOR;
- goto yy103;
-yy100:
-#line 512 "token.re"
+ goto yy101;
+yy98:
+#line 469 "token.re"
{ goto Directive; }
-#line 1228 "<stdout>"
-yy101: yych = *++YYCURSOR;
- goto yy98;
+#line 906 "<stdout>"
+yy99: yych = *++YYCURSOR;
+ goto yy96;
+yy100: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy101;
+yy101: switch(yych){
+ case ' ': goto yy100;
+ default: goto yy98;
+ }
yy102: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy103;
yy103: switch(yych){
- case 0x09: case ' ': goto yy102;
- default: goto yy100;
- }
-yy104: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- goto yy105;
-yy105: switch(yych){
case '.':
case '/':
case '0':
@@ -1313,11 +1270,11 @@ yy105: switch(yych){
case 'w':
case 'x':
case 'y':
- case 'z': goto yy104;
- case ':': goto yy106;
- default: goto yy96;
+ case 'z': goto yy102;
+ case ':': goto yy104;
+ default: goto yy94;
}
-yy106: yych = *++YYCURSOR;
+yy104: yych = *++YYCURSOR;
switch(yych){
case '.':
case '/':
@@ -1393,14 +1350,14 @@ yy106: yych = *++YYCURSOR;
case 'w':
case 'x':
case 'y':
- case 'z': goto yy107;
- default: goto yy96;
+ case 'z': goto yy105;
+ default: goto yy94;
}
-yy107: ++YYCURSOR;
+yy105: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy108;
-yy108: switch(yych){
+ goto yy106;
+yy106: switch(yych){
case '.':
case '/':
case '0':
@@ -1475,15 +1432,15 @@ yy108: switch(yych){
case 'w':
case 'x':
case 'y':
- case 'z': goto yy107;
- default: goto yy109;
+ case 'z': goto yy105;
+ default: goto yy107;
}
-yy109:
-#line 510 "token.re"
+yy107:
+#line 467 "token.re"
{ goto Directive; }
-#line 1484 "<stdout>"
+#line 1165 "<stdout>"
}
-#line 517 "token.re"
+#line 474 "token.re"
}
@@ -1506,32 +1463,30 @@ Plain2:
Plain3:
-#line 1509 "<stdout>"
+#line 1169 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy110;
- ++YYCURSOR;
-yy110:
+ goto yy108;
+yy109: ++YYCURSOR;
+yy108:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy124;
- case 0x09: goto yy126;
- case 0x0A: goto yy112;
- case 0x0D: goto yy114;
- case ' ': goto yy122;
+ case '\000': goto yy120;
+ case '\n': goto yy110;
+ case '\r': goto yy112;
+ case ' ': goto yy118;
case ',': goto yy117;
- case ':': goto yy116;
- case ']': goto yy120;
- case '}': goto yy118;
- default: goto yy127;
+ case ':': goto yy114;
+ case ']': case '}': goto yy115;
+ default: goto yy122;
}
-yy112: yyaccept = 0;
+yy110: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy142;
-yy113:
-#line 540 "token.re"
+ goto yy136;
+yy111:
+#line 497 "token.re"
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKEN;
@@ -1545,8 +1500,8 @@ yy113:
while ( YYTOKEN < YYCURSOR )
{
- int nl_len = newline_len( YYTOKEN++ );
- if ( nl_len )
+ int nl_len = 0;
+ if ( nl_len = newline_len( YYTOKEN++ ) )
{
nl_count++;
YYTOKEN += nl_len - 1;
@@ -1567,114 +1522,112 @@ yy113:
goto Plain2;
}
-#line 1570 "<stdout>"
-yy114: ++YYCURSOR;
+#line 1228 "<stdout>"
+yy112: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy141;
- default: goto yy115;
+ case '\n': goto yy135;
+ default: goto yy113;
}
-yy115:
-#line 627 "token.re"
+yy113:
+#line 566 "token.re"
{ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
goto Plain2;
}
-#line 1581 "<stdout>"
-yy116: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- switch(yych){
- case 0x0A: goto yy136;
- case 0x0D: goto yy140;
- case ' ': goto yy138;
- default: goto yy115;
- }
-yy117: yyaccept = 1;
+#line 1239 "<stdout>"
+yy114: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x0A: goto yy130;
- case 0x0D: goto yy134;
+ case '\n': goto yy130;
+ case '\r': goto yy134;
case ' ': goto yy132;
- default: goto yy115;
+ default: goto yy113;
}
-yy118: ++YYCURSOR;
- goto yy119;
-yy119:
-#line 589 "token.re"
-{ if ( plvl->status != syck_lvl_imap )
+yy115: ++YYCURSOR;
+ goto yy116;
+yy116:
+#line 535 "token.re"
+{ if ( plvl->status != syck_lvl_inline )
{
- PLAIN_NOT_INL();
+ if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
+ {
+ YYCURSOR--;
+ }
+ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
+ goto Plain2;
}
else
{
- PLAIN_IS_INL();
+ /* trim spaces off the end in case of indent */
+ char *walker = qstr + qidx - 1;
+ while ( walker > qstr && ( *walker == '\n' || *walker == ' ' ) )
+ {
+ qidx--;
+ walker[0] = '\0';
+ walker--;
+ }
}
RETURN_IMPLICIT();
}
-#line 1612 "<stdout>"
+#line 1274 "<stdout>"
+yy117: yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ switch(yych){
+ case '\n': goto yy125;
+ case '\r': goto yy128;
+ case ' ': goto yy126;
+ default: goto yy113;
+ }
+yy118: ++YYCURSOR;
+ switch((yych = *YYCURSOR)) {
+ case '#': goto yy123;
+ default: goto yy119;
+ }
+yy119:
+#line 564 "token.re"
+{ goto Plain3; }
+#line 1291 "<stdout>"
yy120: ++YYCURSOR;
goto yy121;
yy121:
-#line 600 "token.re"
-{ if ( plvl->status != syck_lvl_iseq )
- {
- PLAIN_NOT_INL();
- }
- else
- {
- PLAIN_IS_INL();
- }
- RETURN_IMPLICIT();
- }
-#line 1627 "<stdout>"
-yy122: ++YYCURSOR;
- switch((yych = *YYCURSOR)) {
- case '#': goto yy128;
- default: goto yy123;
- }
-yy123:
-#line 617 "token.re"
-{ if ( qidx == 0 )
- {
- goto Plain2;
- }
- else
- {
- goto Plain3;
- }
- }
-#line 1644 "<stdout>"
-yy124: ++YYCURSOR;
- goto yy125;
-yy125:
-#line 615 "token.re"
+#line 562 "token.re"
{ RETURN_IMPLICIT(); }
-#line 1650 "<stdout>"
-yy126: yych = *++YYCURSOR;
- goto yy123;
-yy127: yych = *++YYCURSOR;
- goto yy115;
-yy128: ++YYCURSOR;
- goto yy129;
-yy129:
-#line 611 "token.re"
+#line 1297 "<stdout>"
+yy122: yych = *++YYCURSOR;
+ goto yy113;
+yy123: ++YYCURSOR;
+ goto yy124;
+yy124:
+#line 558 "token.re"
{ eat_comments( parser );
RETURN_IMPLICIT();
}
-#line 1662 "<stdout>"
+#line 1307 "<stdout>"
+yy125: yych = *++YYCURSOR;
+ goto yy116;
+yy126: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy127;
+yy127: switch(yych){
+ case ' ': goto yy126;
+ default: goto yy116;
+ }
+yy128: yych = *++YYCURSOR;
+ switch(yych){
+ case '\n': goto yy125;
+ default: goto yy129;
+ }
+yy129: YYCURSOR = YYMARKER;
+ switch(yyaccept){
+ case 0: goto yy111;
+ case 1: goto yy113;
+ }
yy130: ++YYCURSOR;
goto yy131;
yy131:
-#line 578 "token.re"
-{ if ( plvl->status != syck_lvl_iseq && plvl->status != syck_lvl_imap )
- {
- PLAIN_NOT_INL();
- }
- else
- {
- PLAIN_IS_INL();
- }
- RETURN_IMPLICIT();
- }
-#line 1677 "<stdout>"
+#line 533 "token.re"
+{ RETURN_IMPLICIT(); }
+#line 1334 "<stdout>"
yy132: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1685,52 +1638,28 @@ yy133: switch(yych){
}
yy134: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy130;
- default: goto yy135;
- }
-yy135: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy113;
- case 1: goto yy115;
- }
-yy136: ++YYCURSOR;
- goto yy137;
-yy137:
-#line 576 "token.re"
-{ RETURN_IMPLICIT(); }
-#line 1701 "<stdout>"
-yy138: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- goto yy139;
-yy139: switch(yych){
- case ' ': goto yy138;
- default: goto yy137;
- }
-yy140: yych = *++YYCURSOR;
- switch(yych){
- case 0x0A: goto yy136;
- default: goto yy135;
+ case '\n': goto yy130;
+ default: goto yy129;
}
-yy141: yyaccept = 0;
+yy135: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy142;
-yy142: switch(yych){
- case 0x0A: case ' ': goto yy141;
- case 0x0D: goto yy143;
- default: goto yy113;
+ goto yy136;
+yy136: switch(yych){
+ case '\n': case ' ': goto yy135;
+ case '\r': goto yy137;
+ default: goto yy111;
}
-yy143: ++YYCURSOR;
+yy137: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy141;
- default: goto yy135;
+ case '\n': goto yy135;
+ default: goto yy129;
}
}
-#line 631 "token.re"
+#line 570 "token.re"
}
@@ -1744,27 +1673,27 @@ SingleQuote2:
YYTOKEN = YYCURSOR;
-#line 1747 "<stdout>"
+#line 1370 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy144;
- ++YYCURSOR;
-yy144:
+ goto yy138;
+yy139: ++YYCURSOR;
+yy138:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy152;
- case 0x0A: goto yy146;
- case 0x0D: goto yy148;
- case '\'': goto yy150;
- default: goto yy153;
+ case '\000': goto yy146;
+ case '\n': goto yy140;
+ case '\r': goto yy142;
+ case '\'': goto yy144;
+ default: goto yy147;
}
-yy146: yyaccept = 0;
+yy140: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy157;
-yy147:
-#line 645 "token.re"
+ goto yy151;
+yy141:
+#line 584 "token.re"
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1782,8 +1711,8 @@ yy147:
while ( YYTOKEN < YYCURSOR )
{
- int nl_len = newline_len( YYTOKEN++ );
- if ( nl_len )
+ int nl_len = 0;
+ if ( nl_len = newline_len( YYTOKEN++ ) )
{
nl_count++;
YYTOKEN += nl_len - 1;
@@ -1804,25 +1733,25 @@ yy147:
goto SingleQuote2;
}
-#line 1807 "<stdout>"
-yy148: ++YYCURSOR;
+#line 1430 "<stdout>"
+yy142: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy156;
- default: goto yy149;
+ case '\n': goto yy150;
+ default: goto yy143;
}
-yy149:
-#line 712 "token.re"
+yy143:
+#line 644 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
-#line 1818 "<stdout>"
-yy150: ++YYCURSOR;
+#line 1441 "<stdout>"
+yy144: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\'': goto yy154;
- default: goto yy151;
+ case '\'': goto yy148;
+ default: goto yy145;
}
-yy151:
-#line 689 "token.re"
+yy145:
+#line 628 "token.re"
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1831,56 +1760,49 @@ yy151:
{
POP_LEVEL();
}
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
- }
- else
- {
- n->type_id = syck_strndup( "str", 3 );
- }
+ n->type_id = syck_strndup( "str", 3 );
n->data.str->ptr = qstr;
n->data.str->len = qidx;
n->data.str->style = scalar_1quote;
sycklval->nodeData = n;
return YAML_PLAIN;
}
-#line 1848 "<stdout>"
-yy152: yych = *++YYCURSOR;
- goto yy151;
-yy153: yych = *++YYCURSOR;
+#line 1464 "<stdout>"
+yy146: yych = *++YYCURSOR;
+ goto yy145;
+yy147: yych = *++YYCURSOR;
+ goto yy143;
+yy148: ++YYCURSOR;
goto yy149;
-yy154: ++YYCURSOR;
- goto yy155;
-yy155:
-#line 685 "token.re"
+yy149:
+#line 624 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
-#line 1860 "<stdout>"
-yy156: yyaccept = 0;
+#line 1476 "<stdout>"
+yy150: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy157;
-yy157: switch(yych){
- case 0x0A: case ' ': goto yy156;
- case 0x0D: goto yy158;
- default: goto yy147;
+ goto yy151;
+yy151: switch(yych){
+ case '\n': case ' ': goto yy150;
+ case '\r': goto yy152;
+ default: goto yy141;
}
-yy158: ++YYCURSOR;
+yy152: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy156;
- default: goto yy159;
+ case '\n': goto yy150;
+ default: goto yy153;
}
-yy159: YYCURSOR = YYMARKER;
+yy153: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy147;
+ case 0: goto yy141;
}
}
-#line 716 "token.re"
+#line 648 "token.re"
}
@@ -1898,28 +1820,28 @@ DoubleQuote2:
-#line 1901 "<stdout>"
+#line 1502 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy160;
- ++YYCURSOR;
-yy160:
+ goto yy154;
+yy155: ++YYCURSOR;
+yy154:
if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy167;
- case 0x0A: goto yy162;
- case 0x0D: goto yy164;
- case '"': goto yy169;
- case '\\': goto yy166;
- default: goto yy170;
- }
-yy162: yyaccept = 0;
+ case '\000': goto yy161;
+ case '\n': goto yy156;
+ case '\r': goto yy158;
+ case '"': goto yy163;
+ case '\\': goto yy160;
+ default: goto yy164;
+ }
+yy156: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy184;
-yy163:
-#line 734 "token.re"
+ goto yy178;
+yy157:
+#line 666 "token.re"
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1939,8 +1861,8 @@ yy163:
{
while ( YYTOKEN < YYCURSOR )
{
- int nl_len = newline_len( YYTOKEN++ );
- if ( nl_len )
+ int nl_len = 0;
+ if ( nl_len = newline_len( YYTOKEN++ ) )
{
nl_count++;
YYTOKEN += nl_len - 1;
@@ -1963,34 +1885,34 @@ yy163:
keep_nl = 1;
goto DoubleQuote2;
}
-#line 1966 "<stdout>"
-yy164: ++YYCURSOR;
+#line 1567 "<stdout>"
+yy158: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy183;
- default: goto yy165;
+ case '\n': goto yy177;
+ default: goto yy159;
}
-yy165:
-#line 820 "token.re"
+yy159:
+#line 745 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
-#line 1977 "<stdout>"
-yy166: yyaccept = 1;
+#line 1578 "<stdout>"
+yy160: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case 0x0A: goto yy174;
- case 0x0D: goto yy176;
- case ' ': goto yy171;
+ case '\n': goto yy168;
+ case '\r': goto yy170;
+ case ' ': goto yy165;
case '"': case '0': case '\\': case 'a':
case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy178;
- case 'x': goto yy177;
- default: goto yy165;
- }
-yy167: ++YYCURSOR;
- goto yy168;
-yy168:
-#line 797 "token.re"
+ case 'f': case 'n': case 'r': case 't': case 'v': goto yy172;
+ case 'x': goto yy171;
+ default: goto yy159;
+ }
+yy161: ++YYCURSOR;
+ goto yy162;
+yy162:
+#line 729 "token.re"
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1999,55 +1921,48 @@ yy168:
{
POP_LEVEL();
}
- if ( ((SyckParser *)parser)->taguri_expansion == 1 )
- {
- n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
- }
- else
- {
- n->type_id = syck_strndup( "str", 3 );
- }
+ n->type_id = syck_strndup( "str", 3 );
n->data.str->ptr = qstr;
n->data.str->len = qidx;
n->data.str->style = scalar_2quote;
sycklval->nodeData = n;
return YAML_PLAIN;
}
-#line 2016 "<stdout>"
-yy169: yych = *++YYCURSOR;
- goto yy168;
-yy170: yych = *++YYCURSOR;
- goto yy165;
-yy171: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+#line 1610 "<stdout>"
+yy163: yych = *++YYCURSOR;
+ goto yy162;
+yy164: yych = *++YYCURSOR;
+ goto yy159;
+yy165: ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy172;
-yy172: switch(yych){
- case 0x0A: goto yy174;
- case 0x0D: goto yy176;
- case ' ': goto yy171;
- default: goto yy173;
- }
-yy173: YYCURSOR = YYMARKER;
+ goto yy166;
+yy166: switch(yych){
+ case '\n': goto yy168;
+ case '\r': goto yy170;
+ case ' ': goto yy165;
+ default: goto yy167;
+ }
+yy167: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy163;
- case 1: goto yy165;
+ case 0: goto yy157;
+ case 1: goto yy159;
}
-yy174: ++YYCURSOR;
- goto yy175;
-yy175:
-#line 792 "token.re"
+yy168: ++YYCURSOR;
+ goto yy169;
+yy169:
+#line 724 "token.re"
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
}
-#line 2044 "<stdout>"
-yy176: yych = *++YYCURSOR;
+#line 1639 "<stdout>"
+yy170: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy174;
- default: goto yy173;
+ case '\n': goto yy168;
+ default: goto yy167;
}
-yy177: yych = *++YYCURSOR;
+yy171: yych = *++YYCURSOR;
switch(yych){
case '0':
case '1':
@@ -2068,19 +1983,19 @@ yy177: yych = *++YYCURSOR;
case 'c':
case 'd':
case 'e':
- case 'f': goto yy180;
- default: goto yy173;
+ case 'f': goto yy174;
+ default: goto yy167;
}
-yy178: ++YYCURSOR;
- goto yy179;
-yy179:
-#line 778 "token.re"
+yy172: ++YYCURSOR;
+ goto yy173;
+yy173:
+#line 710 "token.re"
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto DoubleQuote2;
}
-#line 2082 "<stdout>"
-yy180: yych = *++YYCURSOR;
+#line 1677 "<stdout>"
+yy174: yych = *++YYCURSOR;
switch(yych){
case '0':
case '1':
@@ -2101,13 +2016,13 @@ yy180: yych = *++YYCURSOR;
case 'c':
case 'd':
case 'e':
- case 'f': goto yy181;
- default: goto yy173;
+ case 'f': goto yy175;
+ default: goto yy167;
}
-yy181: ++YYCURSOR;
- goto yy182;
-yy182:
-#line 783 "token.re"
+yy175: ++YYCURSOR;
+ goto yy176;
+yy176:
+#line 715 "token.re"
{ long ch;
char *chr_text = syck_strndup( YYTOKEN, 4 );
chr_text[0] = '0';
@@ -2116,26 +2031,26 @@ yy182:
QUOTECAT(qstr, qcapa, qidx, ch);
goto DoubleQuote2;
}
-#line 2119 "<stdout>"
-yy183: yyaccept = 0;
+#line 1714 "<stdout>"
+yy177: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy184;
-yy184: switch(yych){
- case 0x0A: case ' ': goto yy183;
- case 0x0D: goto yy185;
- default: goto yy163;
+ goto yy178;
+yy178: switch(yych){
+ case '\n': case ' ': goto yy177;
+ case '\r': goto yy179;
+ default: goto yy157;
}
-yy185: ++YYCURSOR;
+yy179: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy183;
- default: goto yy173;
+ case '\n': goto yy177;
+ default: goto yy167;
}
}
-#line 824 "token.re"
+#line 749 "token.re"
}
@@ -2149,27 +2064,31 @@ TransferMethod2:
YYTOKTMP = YYCURSOR;
-#line 2152 "<stdout>"
+#line 1736 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy186;
- ++YYCURSOR;
-yy186:
+ goto yy180;
+yy181: ++YYCURSOR;
+yy180:
if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy188;
- case 0x0A: goto yy190;
- case 0x0D: goto yy192;
- case ' ': goto yy191;
- case '\\': goto yy194;
- default: goto yy195;
- }
-yy188: ++YYCURSOR;
- goto yy189;
-yy189:
-#line 838 "token.re"
+ case '\000': goto yy182;
+ case '\n': goto yy183;
+ case '\r': goto yy186;
+ case ' ': goto yy185;
+ case '\\': goto yy188;
+ default: goto yy189;
+ }
+yy182: YYCURSOR = YYMARKER;
+ switch(yyaccept){
+ case 0: goto yy187;
+ }
+yy183: ++YYCURSOR;
+ goto yy184;
+yy184:
+#line 763 "token.re"
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -2219,34 +2138,32 @@ yy189:
return YAML_TRANSFER;
}
-#line 2222 "<stdout>"
-yy190: yych = *++YYCURSOR;
- goto yy189;
-yy191: yych = *++YYCURSOR;
- goto yy204;
-yy192: ++YYCURSOR;
+#line 1810 "<stdout>"
+yy185: yych = *++YYCURSOR;
+ goto yy198;
+yy186: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy188;
- default: goto yy193;
+ case '\n': goto yy196;
+ default: goto yy187;
}
-yy193:
-#line 905 "token.re"
+yy187:
+#line 830 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
-#line 2237 "<stdout>"
-yy194: yyaccept = 0;
+#line 1823 "<stdout>"
+yy188: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
case '"': case '0': case '\\': case 'a':
case 'b': case 'e':
- case 'f': case 'n': case 'r': case 't': case 'v': goto yy198;
- case 'x': goto yy196;
- default: goto yy193;
+ case 'f': case 'n': case 'r': case 't': case 'v': goto yy191;
+ case 'x': goto yy190;
+ default: goto yy187;
}
-yy195: yych = *++YYCURSOR;
- goto yy193;
-yy196: yych = *++YYCURSOR;
+yy189: yych = *++YYCURSOR;
+ goto yy187;
+yy190: yych = *++YYCURSOR;
switch(yych){
case '0':
case '1':
@@ -2267,23 +2184,19 @@ yy196: yych = *++YYCURSOR;
case 'c':
case 'd':
case 'e':
- case 'f': goto yy200;
- default: goto yy197;
- }
-yy197: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy193;
+ case 'f': goto yy193;
+ default: goto yy182;
}
-yy198: ++YYCURSOR;
- goto yy199;
-yy199:
-#line 891 "token.re"
+yy191: ++YYCURSOR;
+ goto yy192;
+yy192:
+#line 816 "token.re"
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto TransferMethod2;
}
-#line 2285 "<stdout>"
-yy200: yych = *++YYCURSOR;
+#line 1867 "<stdout>"
+yy193: yych = *++YYCURSOR;
switch(yych){
case '0':
case '1':
@@ -2304,13 +2217,13 @@ yy200: yych = *++YYCURSOR;
case 'c':
case 'd':
case 'e':
- case 'f': goto yy201;
- default: goto yy197;
+ case 'f': goto yy194;
+ default: goto yy182;
}
-yy201: ++YYCURSOR;
- goto yy202;
-yy202:
-#line 896 "token.re"
+yy194: ++YYCURSOR;
+ goto yy195;
+yy195:
+#line 821 "token.re"
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -2319,17 +2232,19 @@ yy202:
QUOTECAT(qstr, qcapa, qidx, ch);
goto TransferMethod2;
}
-#line 2322 "<stdout>"
-yy203: ++YYCURSOR;
+#line 1904 "<stdout>"
+yy196: yych = *++YYCURSOR;
+ goto yy184;
+yy197: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy204;
-yy204: switch(yych){
- case ' ': goto yy203;
- default: goto yy189;
+ goto yy198;
+yy198: switch(yych){
+ case ' ': goto yy197;
+ default: goto yy184;
}
}
-#line 910 "token.re"
+#line 835 "token.re"
}
@@ -2344,7 +2259,8 @@ ScalarBlock:
int forceIndent = -1;
char *yyt = YYTOKEN;
SyckLevel *lvl = CURRENT_LEVEL();
- int parentIndent = -1;
+ int parentIndent;
+ GET_TRUE_YAML_INDENT(parentIndent);
switch ( *yyt )
{
@@ -2364,7 +2280,7 @@ ScalarBlock:
}
else if ( isdigit( *yyt ) )
{
- forceIndent = strtol( yyt, NULL, 10 );
+ forceIndent = strtol( yyt, NULL, 10 ) + parentIndent;
}
}
@@ -2375,51 +2291,46 @@ ScalarBlock2:
YYTOKEN = YYCURSOR;
-#line 2378 "<stdout>"
+#line 1919 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy205;
- ++YYCURSOR;
-yy205:
+ goto yy199;
+yy200: ++YYCURSOR;
+yy199:
if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy213;
- case 0x0A: goto yy207;
- case 0x0D: goto yy209;
- case '#': goto yy211;
- case '-': goto yy215;
- default: goto yy216;
- }
-yy207: yyaccept = 0;
+ case '\000': goto yy207;
+ case '\n': goto yy201;
+ case '\r': goto yy203;
+ case '#': goto yy205;
+ case '-': goto yy209;
+ default: goto yy210;
+ }
+yy201: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy226;
-yy208:
-#line 956 "token.re"
+ goto yy220;
+yy202:
+#line 882 "token.re"
{ char *pacer;
char *tok = YYTOKEN;
int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
GOBBLE_UP_YAML_INDENT( indt_len, tok );
lvl = CURRENT_LEVEL();
- if ( lvl->status != syck_lvl_block )
+ if ( indt_len > parentIndent && lvl->status != syck_lvl_block )
{
- GET_TRUE_YAML_INDENT(parentIndent);
- if ( forceIndent > 0 ) forceIndent += parentIndent;
- if ( indt_len > parentIndent )
- {
- int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
- ADD_LEVEL( new_spaces, syck_lvl_block );
- lastIndent = indt_len - new_spaces;
- nl_begin = 1;
- lvl = CURRENT_LEVEL();
- }
- else
- {
- YYCURSOR = YYTOKEN;
- RETURN_YAML_BLOCK();
- }
+ int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
+ ADD_LEVEL( new_spaces, syck_lvl_block );
+ lastIndent = indt_len - new_spaces;
+ nl_begin = 1;
+ lvl = CURRENT_LEVEL();
+ }
+ else if ( lvl->status != syck_lvl_block )
+ {
+ YYCURSOR = YYTOKEN;
+ RETURN_YAML_BLOCK();
}
/*
@@ -2434,8 +2345,8 @@ yy208:
pacer = YYTOKEN;
while ( pacer < YYCURSOR )
{
- int nl_len = newline_len( pacer++ );
- if ( nl_len )
+ int nl_len = 0;
+ if ( nl_len = newline_len( pacer++ ) )
{
nl_count++;
pacer += nl_len - 1;
@@ -2471,22 +2382,22 @@ yy208:
}
goto ScalarBlock2;
}
-#line 2474 "<stdout>"
-yy209: ++YYCURSOR;
+#line 2010 "<stdout>"
+yy203: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy225;
- default: goto yy210;
+ case '\n': goto yy219;
+ default: goto yy204;
}
-yy210:
-#line 1070 "token.re"
+yy204:
+#line 991 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
goto ScalarBlock2;
}
-#line 2485 "<stdout>"
-yy211: ++YYCURSOR;
- goto yy212;
-yy212:
-#line 1032 "token.re"
+#line 2021 "<stdout>"
+yy205: ++YYCURSOR;
+ goto yy206;
+yy206:
+#line 953 "token.re"
{ lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_block )
{
@@ -2499,45 +2410,45 @@ yy212:
}
goto ScalarBlock2;
}
-#line 2502 "<stdout>"
-yy213: ++YYCURSOR;
- goto yy214;
-yy214:
-#line 1046 "token.re"
+#line 2038 "<stdout>"
+yy207: ++YYCURSOR;
+ goto yy208;
+yy208:
+#line 967 "token.re"
{ YYCURSOR--;
POP_LEVEL();
RETURN_YAML_BLOCK();
}
-#line 2511 "<stdout>"
-yy215: yyaccept = 1;
+#line 2047 "<stdout>"
+yy209: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '-': goto yy217;
- default: goto yy210;
+ case '-': goto yy211;
+ default: goto yy204;
}
-yy216: yych = *++YYCURSOR;
- goto yy210;
-yy217: yych = *++YYCURSOR;
+yy210: yych = *++YYCURSOR;
+ goto yy204;
+yy211: yych = *++YYCURSOR;
switch(yych){
- case '-': goto yy219;
- default: goto yy218;
+ case '-': goto yy213;
+ default: goto yy212;
}
-yy218: YYCURSOR = YYMARKER;
+yy212: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy208;
- case 1: goto yy210;
+ case 0: goto yy202;
+ case 1: goto yy204;
}
-yy219: yych = *++YYCURSOR;
+yy213: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy220;
- case 0x0D: goto yy224;
- case ' ': goto yy222;
- default: goto yy218;
- }
-yy220: ++YYCURSOR;
- goto yy221;
-yy221:
-#line 1051 "token.re"
+ case '\n': goto yy214;
+ case '\r': goto yy218;
+ case ' ': goto yy216;
+ default: goto yy212;
+ }
+yy214: ++YYCURSOR;
+ goto yy215;
+yy215:
+#line 972 "token.re"
{ if ( YYTOKEN == YYLINEPTR )
{
if ( blockType == BLOCK_FOLD && qidx > 0 )
@@ -2556,39 +2467,39 @@ yy221:
goto ScalarBlock2;
}
}
-#line 2559 "<stdout>"
-yy222: ++YYCURSOR;
+#line 2095 "<stdout>"
+yy216: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy223;
-yy223: switch(yych){
- case ' ': goto yy222;
- default: goto yy221;
+ goto yy217;
+yy217: switch(yych){
+ case ' ': goto yy216;
+ default: goto yy215;
}
-yy224: yych = *++YYCURSOR;
+yy218: yych = *++YYCURSOR;
switch(yych){
- case 0x0A: goto yy220;
- default: goto yy218;
+ case '\n': goto yy214;
+ default: goto yy212;
}
-yy225: yyaccept = 0;
+yy219: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy226;
-yy226: switch(yych){
- case 0x0A: case ' ': goto yy225;
- case 0x0D: goto yy227;
- default: goto yy208;
+ goto yy220;
+yy220: switch(yych){
+ case '\n': case ' ': goto yy219;
+ case '\r': goto yy221;
+ default: goto yy202;
}
-yy227: ++YYCURSOR;
+yy221: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy225;
- default: goto yy218;
+ case '\n': goto yy219;
+ default: goto yy212;
}
}
-#line 1075 "token.re"
+#line 996 "token.re"
}
@@ -2604,67 +2515,67 @@ Comment:
YYTOKEN = YYCURSOR;
-#line 2607 "<stdout>"
+#line 2131 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
- goto yy228;
- ++YYCURSOR;
-yy228:
+ goto yy222;
+yy223: ++YYCURSOR;
+yy222:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case 0x00: goto yy230;
- case 0x0A: goto yy232;
- case 0x0D: goto yy233;
- default: goto yy235;
- }
-yy230: ++YYCURSOR;
- goto yy231;
-yy231:
-#line 1091 "token.re"
+ case '\000': goto yy224;
+ case '\n': goto yy226;
+ case '\r': goto yy227;
+ default: goto yy229;
+ }
+yy224: ++YYCURSOR;
+ goto yy225;
+yy225:
+#line 1012 "token.re"
{ YYCURSOR = YYTOKEN;
return;
}
-#line 2629 "<stdout>"
-yy232: yyaccept = 0;
+#line 2153 "<stdout>"
+yy226: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy237;
-yy233: ++YYCURSOR;
+ goto yy231;
+yy227: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case 0x0A: goto yy236;
- default: goto yy234;
+ case '\n': goto yy230;
+ default: goto yy228;
}
-yy234:
-#line 1095 "token.re"
+yy228:
+#line 1016 "token.re"
{ goto Comment;
}
-#line 2642 "<stdout>"
-yy235: yych = *++YYCURSOR;
- goto yy234;
-yy236: yyaccept = 0;
+#line 2166 "<stdout>"
+yy229: yych = *++YYCURSOR;
+ goto yy228;
+yy230: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- goto yy237;
-yy237: switch(yych){
- case 0x0A: goto yy236;
- case 0x0D: goto yy238;
- default: goto yy231;
+ goto yy231;
+yy231: switch(yych){
+ case '\n': goto yy230;
+ case '\r': goto yy232;
+ default: goto yy225;
}
-yy238: ++YYCURSOR;
+yy232: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case 0x0A: goto yy236;
- default: goto yy239;
+ case '\n': goto yy230;
+ default: goto yy233;
}
-yy239: YYCURSOR = YYMARKER;
+yy233: YYCURSOR = YYMARKER;
switch(yyaccept){
- case 0: goto yy231;
+ case 0: goto yy225;
}
}
-#line 1098 "token.re"
+#line 1019 "token.re"
}
diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c
index 01a3aaf652..b2dc450ffa 100644
--- a/ext/syck/yaml2byte.c
+++ b/ext/syck/yaml2byte.c
@@ -1,8 +1,8 @@
/*
- * yaml2byte.c
+ * ybext.c
*
- * $Author: matz $
- * $Date: 2006/05/03 17:41:10 $
+ * $Author$
+ * $Date$
*
* Copyright (C) 2003 why the lucky stiff, clark evans
*
@@ -145,7 +145,6 @@ syck_yaml2byte_handler(p, n)
strcat( type_tag, "!" );
strcat( type_tag, n->type_id );
bytestring_append( val, YAMLBYTE_TRANSFER, type_tag, NULL);
- S_FREE(type_tag);
}
}
switch (n->kind)
@@ -227,17 +226,12 @@ syck_yaml2byte(char *yamlstr)
syck_parser_implicit_typing( parser, 1 );
syck_parser_taguri_expansion( parser, 1 );
oid = syck_parse( parser );
+ syck_lookup_sym( parser, oid, (char **)&sav );
- if ( syck_lookup_sym( parser, oid, (char **)&sav ) == 1 ) {
- ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
- ret[0] = '\0';
- strcat( ret, "D\n" );
- strcat( ret, sav->buffer );
- }
- else
- {
- ret = NULL;
- }
+ ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
+ ret[0] = '\0';
+ strcat( ret, "D\n" );
+ strcat( ret, sav->buffer );
syck_free_parser( parser );
return ret;
diff --git a/ext/syslog/extconf.rb b/ext/syslog/extconf.rb
index d47ed8fd61..0fa0bc339b 100644
--- a/ext/syslog/extconf.rb
+++ b/ext/syslog/extconf.rb
@@ -1,5 +1,5 @@
# $RoughId: extconf.rb,v 1.3 2001/11/24 17:49:26 knu Exp $
-# $Id: extconf.rb,v 1.1 2001/11/26 12:00:40 knu Exp $
+# $Id$
require 'mkmf'
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index 99e4215a95..477489ddfe 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -4,7 +4,7 @@
* <amos+ruby@utdallas.edu>
*
* $RoughId: syslog.c,v 1.21 2002/02/25 12:21:17 knu Exp $
- * $Id: syslog.c,v 1.8.2.1 2004/04/05 07:45:24 matz Exp $
+ * $Id$
*/
#include "ruby.h"
diff --git a/ext/syslog/syslog.txt b/ext/syslog/syslog.txt
index b134ed2a40..9aed35133d 100644
--- a/ext/syslog/syslog.txt
+++ b/ext/syslog/syslog.txt
@@ -1,6 +1,6 @@
.\" syslog.txt - -*- Indented-Text -*-
$RoughId: syslog.txt,v 1.18 2002/02/25 08:20:14 knu Exp $
-$Id: syslog.txt,v 1.2 2002/02/25 12:13:30 knu Exp $
+$Id$
UNIX Syslog extension for Ruby
Amos Gouaux, University of Texas at Dallas
diff --git a/ext/syslog/test.rb b/ext/syslog/test.rb
index 907602c21d..cfa33eff8f 100644
--- a/ext/syslog/test.rb
+++ b/ext/syslog/test.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# $RoughId: test.rb,v 1.9 2002/02/25 08:20:14 knu Exp $
-# $Id: test.rb,v 1.4 2002/11/27 08:36:22 knu Exp $
+# $Id$
# Please only run this test on machines reasonable for testing.
# If in doubt, ask your admin.
diff --git a/ext/tk/tkutil/.cvsignore b/ext/tcltklib/.cvsignore
index 90c83ed9b1..90c83ed9b1 100644
--- a/ext/tk/tkutil/.cvsignore
+++ b/ext/tcltklib/.cvsignore
diff --git a/ext/tk/MANUAL_tcltklib.eng b/ext/tcltklib/MANUAL.eng
index 1db61f228e..d3417f5dff 100644
--- a/ext/tk/MANUAL_tcltklib.eng
+++ b/ext/tcltklib/MANUAL.eng
@@ -1,5 +1,5 @@
(tof)
- 2005/07/05 Hidetoshi NAGAI
+ 2004/03/28 Hidetoshi NAGAI
This document discribes about the 'tcltklib' library. Although there
is the 'tcltk' library (tcltk.rb) under this directory, no description
@@ -132,16 +132,6 @@ module TclTklib
: If 'check_root' is false, doen't return by the other
: reasons than exceptions.
- mainloop_thread?
- : Returns whether the current thread executes the eventloop.
- : If true, the eventloop is working on the current thread.
- : If no eventloop is working, this method returns nil.
- : And if the other thread executes the eventloop, returns false.
- :
- : *** ATTENTION ***
- : When this methods returns false, it is dangerous to call a Tk
- : interpreter directly.
-
mainloop_watchdog(check_root = true)
: On the normal eventloop, some kinds of callback operations
: cause deadlock. To avoid some of such deadlocks, this
@@ -227,8 +217,8 @@ module TclTklib
: Convert the argument to a valid Tcl list element with
: Tcl/Tk's library function.
- _toUTF8(str, encoding=nil)
- _fromUTF8(str, encoding=nil)
+ _toUTF8(str, encoding)
+ _fromUTF8(str, encoding)
: Call the function (which is internal function of Tcl/Tk) to
: convert to/from a UTF8 string.
@@ -239,16 +229,6 @@ module TclTklib
: _subst_Tcl_backslash method parses all backslash sequence.
: _subst_UTF_backslash method parses \uhhhh only.
- encoding_system
- encoding_system=(encoding)
- : Get and set Tcl's system encoding.
-
- encoding
- encoding=(encoding)
- : alias of encoding_system / encoding_system=
- : ( probably, Ruby/Tk's tk.rb will override them )
-
-
class TclTkIp
[class methods]
new(ip_name=nil, options='')
@@ -310,11 +290,6 @@ class TclTkIp
: Check whether the interpreter is already deleted.
: If deleted, returns true.
- has_mainwindow?
- : Check whether the interpreter has a MainWindow (root widget).
- : If has, returns true. If doesn't, returns false.
- : If IP is already deleted, returns nil.
-
restart
: Restart Tk part of the interpreter.
: Use this when you need Tk functions after destroying the
@@ -337,8 +312,8 @@ class TclTkIp
: to _eval and regist the command once, after that, the
: command can be called by _invoke.
- _toUTF8(str, encoding=nil)
- _fromUTF8(str, encoding=nil)
+ _toUTF8(str, encoding)
+ _fromUTF8(str, encoding)
: Call the function (which is internal function of Tcl/Tk) to
: convert to/from a UTF8 string.
diff --git a/ext/tk/MANUAL_tcltklib.eucj b/ext/tcltklib/MANUAL.euc
index 5dd36726ba..a0d7e42307 100644
--- a/ext/tk/MANUAL_tcltklib.eucj
+++ b/ext/tcltklib/MANUAL.euc
@@ -1,5 +1,5 @@
(tof)
- 2005/07/05 Hidetoshi NAGAI
+ 2004/03/28 Hidetoshi NAGAI
Ëܥɥ­¥å¥á¥ó¥È¤Ë¤Ï¸Å¤¤ tcltk ¥é¥¤¥Ö¥é¥ê¡¤tcltklib ¥é¥¤¥Ö¥é¥ê¤ÎÀâÌÀ
¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¤¤½¤Îµ­½ÒÆâÍÆ¤Ï¸Å¤¤¤â¤Î¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥
@@ -230,15 +230,6 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: WINDOW °Ê³°¤Î¥¤¥Ù¥ó¥È¤ÏȯÀ¸¤·¤¦¤ë¤¿¤á )¡¥½ªÎ»¤Ë¤Ï¡¤³°Éô
: ¤«¤é¤ÎƯ¤­³Ý¤± ( ¥¹¥ì¥Ã¥É¤ò³èÍѤ¹¤ë¤Ê¤É ) ¤¬É¬Íס¥
- mainloop_thread?
- : ¥«¥ì¥ó¥È¥¹¥ì¥Ã¥É¤¬¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É
- : ¤«¤É¤¦¤«¤òÊÖ¤¹¡¥
- : ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¤Ç¤¢¤ì¤Ð true ¤ò¡¤
- : ¤É¤Î¥¹¥ì¥Ã¥É¤Ç¤â¥¤¥Ù¥ó¥È¥ë¡¼¥×¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï
- : nil ¤ò¡¤Â¾¤Î¥¹¥ì¥Ã¥É¤Ç¥¤¥Ù¥ó¥È¥ë¡¼¥×¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¾ì
- : ¹ç¤Ï false ¤òÊÖ¤¹¡¥
- : false ¤ÎºÝ¤Ë Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤òľÀÜ¸Æ¤Ö¤Î¤Ï´í¸±¤Ç¤¢¤ë¡¥
-
mainloop_watchdog(check_root = true)
: Ä̾ï¤Î¥¤¥Ù¥ó¥È¥ë¡¼¥×¤Ç¤Ï¡¤¥¤¥Ù¥ó¥È½èÍý¤ÎÆâÍÆ¤Ë¤è¤Ã¤Æ¤Ï
: ¥Ç¥Ã¥É¥í¥Ã¥¯¤ò°ú¤­µ¯¤³¤¹²ÄǽÀ­¤¬¤¢¤ë (Î㤨¤Ð¥¤¥Ù¥ó¥È¤Ë
@@ -341,8 +332,8 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: °ì¤Ä¤Î¥ê¥¹¥ÈÍ×ÁǤȤ·¤ÆÅ¬ÀÚ¤Êɽ¸½¤Ë¤Ê¤ë¤è¤¦¤ËÊÑ´¹¤·¤¿Ê¸
: »úÎó¤òÊÖ¤¹¡¥
- _toUTF8(str, encoding=nil)
- _fromUTF8(str, encoding=nil)
+ _toUTF8(str, encoding)
+ _fromUTF8(str, encoding)
: Tcl/Tk ¤¬Æâ¢¤·¤Æ¤¤¤ë UTF8 ÊÑ´¹½èÍý¤ò¸Æ¤Ó½Ð¤¹¡¥
_subst_UTF_backslash(str)
@@ -353,16 +344,6 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: ÃÖ¤­´¹¤¨¤ë¤Î¤ËÂФ·¡¤_subst_UTF_backslash ¤Ï \uhhhh
: ¤Ë¤è¤ë Unicode ʸ»úɽ¸½¤À¤±¤òÃÖ¤­´¹¤¨¤ë¡¥
- encoding_system
- encoding_system=(encoding)
- : Tcl ¤Î system encoding ¤Î³ÍÆÀ¤ª¤è¤ÓÀßÄê
-
- encoding
- encoding=(encoding)
- : encoding_system / encoding_system= ¤Î alias
- : ( Ruby/Tk ¤Î tk.rb ¤Ç¤ÏÃÖ¤­´¹¤¨¤é¤ì¤ëͽÄê¤Î¤â¤Î¡¥)
-
-
¥¯¥é¥¹ TclTkIp
¥¯¥é¥¹¥á¥½¥Ã¥É
new(ip_name=nil, options='')
@@ -396,7 +377,7 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï RuntimeError ¤ÎÎã³°¤òȯÀ¸¤¹¤ë¡¥
safe?
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬ safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ç¤¢¤ë¤«¤òÄ´¤Ù¤ë¡¥
+ : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤ò safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ç¤¢¤ë¤«¤òÄ´¤Ù¤ë¡¥
: safe ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ç¤¢¤ì¤Ð true ¤òÊÖ¤¹¡¥
allow_ruby_exit?
@@ -422,11 +403,6 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: delete ºÑ¤ß¤Ç¥³¥Þ¥ó¥É¤ò¼õ¤±ÉÕ¤±¤Ê¤¤¾õÂ֤ˤʤäƤ¤¤ë¤Ê¤é¤Ð
: true ¤òÊÖ¤¹¡¥
- has_mainwindow?
- : Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Ë¥á¥¤¥ó¥¦¥£¥ó¥É¥¦ (root widget) ¤¬
- : ¸ºß¤¹¤ì¤Ð true ¤ò¡¤Â¸ºß¤·¤Ê¤±¤ì¤Ð false ¤òÊÖ¤¹¡¥
- : ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬´û¤Ë delete ºÑ¤ß¤Ç¤¢¤ì¤Ð nil ¤òÊÖ¤¹¡¥
-
restart
: Tcl/Tk ¥¤¥ó¥¿¡¼¥×¥ê¥¿¤Î Tk Éôʬ¤Î½é´ü²½¡¤ºÆµ¯Æ°¤ò¹Ô¤¦¡¥
: °ìö root widget ¤òÇ˲õ¤·¤¿¸å¤ËºÆÅÙ Tk ¤Îµ¡Ç½¤¬É¬ÍפÈ
@@ -448,8 +424,8 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: ¤·¤ÆÅÐÏ¿¤ËÀ®¸ù¤·¤µ¤¨¤¹¤ì¤Ð¡¤°Ê¹ß¤Ï _invoke ¤Ç¤âÍøÍѤÇ
: ¤­¤ë¤è¤¦¤Ë¤Ê¤ë¡¥
- _toUTF8(str, encoding=nil)
- _fromUTF8(str, encoding=nil)
+ _toUTF8(str, encoding)
+ _fromUTF8(str, encoding)
: Tcl/Tk ¤¬Æâ¢¤·¤Æ¤¤¤ë UTF8 ÊÑ´¹½èÍý¤ò¸Æ¤Ó½Ð¤¹¡¥
_thread_vwait(var_name)
diff --git a/ext/tk/README.tcltklib b/ext/tcltklib/README.1st
index 5d1da48a45..4d5cd93283 100644
--- a/ext/tk/README.tcltklib
+++ b/ext/tcltklib/README.1st
@@ -22,24 +22,7 @@ some or all of the following options.
--with-tcl-lib=<dir> the directry containts 'libtcl<version>.so'
--with-tk-lib=<dir> the directry containts 'libtk<version>.so'
- --enable-mac-tcltk-framework (MacOS X) use Tcl/Tk framework
- (Obsolete. Please use '--enable-tcltk-framework'.)
-
- --enable-tcltk-framework use Tcl/Tk framework
-
- --with-tcltk-framework=<dir> the directory containts Tcl/Tk framework;
- "<dir>/Tcl.framework" and "<dir>/Tk.framework".
- When this option is given, it is assumed that
- --enable-tcltk-framework option is given also.
-
- --with-tcl-framework-header=<dir>
- Tcl framework headers directory
- (e.g. "/Library/Frameworks/Tcl.framework/Headers")
-
- --with-tk-framework-header=<dir>
- Tk framework headers directory
- (e.g. "/Library/Frameworks/Tk.framework/Headers")
-
+ --enable-mac-tcltk-framework (Mac OSX only) use Tcl/Tk framework
If you forgot to give the options when do 'configure' on toplevel
directry of Ruby sources, please try something like as the followings.
diff --git a/ext/tk/README.ActiveTcl b/ext/tcltklib/README.ActiveTcl
index 3afb3f4cf6..3afb3f4cf6 100644
--- a/ext/tk/README.ActiveTcl
+++ b/ext/tcltklib/README.ActiveTcl
diff --git a/ext/tk/old-README.tcltklib.eucj b/ext/tcltklib/README.euc
index fd75202c18..fd75202c18 100644
--- a/ext/tk/old-README.tcltklib.eucj
+++ b/ext/tcltklib/README.euc
diff --git a/ext/tk/sample/tcltklib/lines0.tcl b/ext/tcltklib/demo/lines0.tcl
index 8ed3c5e1c1..8ed3c5e1c1 100644
--- a/ext/tk/sample/tcltklib/lines0.tcl
+++ b/ext/tcltklib/demo/lines0.tcl
diff --git a/ext/tk/sample/tcltklib/lines1.rb b/ext/tcltklib/demo/lines1.rb
index 9f21ae6377..9f21ae6377 100644
--- a/ext/tk/sample/tcltklib/lines1.rb
+++ b/ext/tcltklib/demo/lines1.rb
diff --git a/ext/tk/sample/tcltklib/lines2.rb b/ext/tcltklib/demo/lines2.rb
index e459589f50..e459589f50 100644
--- a/ext/tk/sample/tcltklib/lines2.rb
+++ b/ext/tcltklib/demo/lines2.rb
diff --git a/ext/tk/sample/tcltklib/lines3.rb b/ext/tcltklib/demo/lines3.rb
index caa50f92e7..caa50f92e7 100644
--- a/ext/tk/sample/tcltklib/lines3.rb
+++ b/ext/tcltklib/demo/lines3.rb
diff --git a/ext/tk/sample/tcltklib/lines4.rb b/ext/tcltklib/demo/lines4.rb
index 7a1175bce0..7a1175bce0 100644
--- a/ext/tk/sample/tcltklib/lines4.rb
+++ b/ext/tcltklib/demo/lines4.rb
diff --git a/ext/tk/sample/tcltklib/safeTk.rb b/ext/tcltklib/demo/safeTk.rb
index 5d2c60e700..5d2c60e700 100644
--- a/ext/tk/sample/tcltklib/safeTk.rb
+++ b/ext/tcltklib/demo/safeTk.rb
diff --git a/ext/tcltklib/depend b/ext/tcltklib/depend
new file mode 100644
index 0000000000..2cd9c400f7
--- /dev/null
+++ b/ext/tcltklib/depend
@@ -0,0 +1,2 @@
+tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
new file mode 100644
index 0000000000..0635eea9e0
--- /dev/null
+++ b/ext/tcltklib/extconf.rb
@@ -0,0 +1,250 @@
+# extconf.rb for tcltklib
+
+require 'mkmf'
+
+is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
+is_macosx = (/darwin/ =~ RUBY_PLATFORM)
+
+mac_need_framework =
+ is_macosx &&
+ enable_config("mac-tcltk-framework", false) &&
+ FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
+ FileTest.directory?("/Library/Frameworks/Tk.framework/")
+
+unless is_win32
+ have_library("nsl", "t_open")
+ have_library("socket", "socket")
+ have_library("dl", "dlopen")
+ have_library("m", "log")
+end
+
+dir_config("tk")
+dir_config("tcl")
+dir_config("X11")
+
+tklib = with_config("tklib")
+tcllib = with_config("tcllib")
+stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
+
+def find_tcl(tcllib, stubs)
+ paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ if stubs
+ func = "Tcl_InitStubs"
+ lib = "tclstub"
+ else
+ func = "Tcl_FindExecutable"
+ lib = "tcl"
+ end
+ if tcllib
+ find_library(tcllib, func, *paths)
+ elsif find_library(lib, func, *paths)
+ true
+ else
+ %w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("tcl#{ver}", func, *paths) or
+ find_library("tcl#{ver.delete('.')}", func, *paths)
+ }
+ end
+end
+
+def find_tk(tklib, stubs)
+ paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ if stubs
+ func = "Tk_InitStubs"
+ lib = "tkstub"
+ else
+ func = "Tk_Init"
+ lib = "tk"
+ end
+ if tklib
+ find_library(tklib, func, *paths)
+ elsif find_library(lib, func, *paths)
+ true
+ else
+ %w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("tk#{ver}", func, *paths) or
+ find_library("tk#{ver.delete('.')}", func, *paths)
+ }
+ end
+end
+
+def pthread_check()
+ tcl_major_ver = nil
+ tcl_minor_ver = nil
+
+ # Is tcl-thread given by user ?
+ case enable_config("tcl-thread")
+ when true
+ tcl_enable_thread = true
+ when false
+ tcl_enable_thread = false
+ else
+ tcl_enable_thread = nil
+ end
+
+ if (tclConfig = with_config("tclConfig-file"))
+ if tcl_enable_thread == true
+ puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.")
+ elsif tcl_enable_thread == false
+ puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.")
+ else
+ # tcl-thread is unknown and tclConfig.sh is given
+ begin
+ open(tclConfig, "r") do |cfg|
+ while line = cfg.gets()
+ if line =~ /^\s*TCL_THREADS=(0|1)/
+ tcl_enable_thread = ($1 == "1")
+ break
+ end
+
+ if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/
+ tcl_major_ver = $2
+ if tcl_major_ver =~ /^[1-7]$/
+ tcl_enable_thread = false
+ break
+ end
+ if tcl_major_ver == "8" && tcl_minor_ver == "0"
+ tcl_enable_thread = false
+ break
+ end
+ end
+
+ if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/
+ tcl_minor_ver = $2
+ if tcl_major_ver == "8" && tcl_minor_ver == "0"
+ tcl_enable_thread = false
+ break
+ end
+ end
+ end
+ end
+
+ if tcl_enable_thread == nil
+ # not find definition
+ if tcl_major_ver
+ puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.")
+ else
+ puts("Warning: '#{tclConfig}' may not be a tclConfig file.")
+ end
+ tclConfig = false
+ end
+ rescue Exception
+ puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file")
+ tclConfig = false
+ end
+ end
+ end
+
+ if tcl_enable_thread == nil && !tclConfig
+ # tcl-thread is unknown and tclConfig is unavailable
+ begin
+ try_run_available = try_run("int main() { exit(0); }")
+ rescue Exception
+ # cannot try_run. Is CROSS-COMPILE environment?
+ puts(%Q'\
+*****************************************************************************
+**
+** PTHREAD SUPPORT CHECK WARNING:
+**
+** We cannot check the consistency of pthread support between Ruby
+** and Tcl/Tk library on your environment (do coss-compile?). If the
+** consistency is not kept, some memory troubles (e.g. "Hang-up" or
+** "Segmentation Fault") may bother you. We strongly you to check the
+** consistency by your own hand.
+**
+*****************************************************************************
+')
+ return true
+ end
+ end
+
+ if tcl_enable_thread == nil
+ # tcl-thread is unknown
+ if try_run(<<EOF)
+#include <tcl.h>
+static Tcl_ThreadDataKey dataKey;
+int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
+EOF
+ tcl_enable_thread = true
+ else
+ tcl_enable_thread = false
+ end
+ end
+
+ # check pthread mode
+ if (macro_defined?('HAVE_LIBPTHREAD', '#include "ruby.h"'))
+ # ruby -> enable
+ unless tcl_enable_thread
+ # ruby -> enable && tcl -> disable
+ puts(%Q'\
+*****************************************************************************
+**
+** PTHREAD SUPPORT MODE WARNING:
+**
+** Ruby is compiled with --enable-pthread, but your Tcl/Tk libraries
+** seems to be compiled without "pthread support". Although You can
+** create tcltklib library, this combination may cause memory trouble
+** (e.g. "Hang-up" or "Segmentation Fault"). If you have no reason you
+** must have to keep current pthread support status, we recommend you
+** to make both or neither libraries to support pthread.
+**
+** If you want change the status of pthread support, please recompile
+** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk
+** with "--enable-threads" configure option (if your Tcl/Tk is later
+** than or equal to Tcl/Tk8.1).
+**
+*****************************************************************************
+')
+ end
+
+ # ruby -> enable && tcl -> enable/disable
+ return true
+
+ else
+ # ruby -> disable
+ if tcl_enable_thread
+ # ruby -> disable && tcl -> enable
+ puts(%Q'\
+*****************************************************************************
+**
+** PTHREAD SUPPORT MODE ERRROR:
+**
+** Ruby is not compiled with --enable-pthread, but your Tcl/Tk
+** libararies seems to be compiled with "pthread support". This
+** combination possibly cause "Hang-up" or "Segmentation Fault"
+** frequently when Ruby/Tk is working. We NEVER recommend you to
+** create the library under such combination of pthread support.
+**
+** Please recompile Ruby with "--enable-pthread" configure option
+** or recompile Tcl/Tk with "--disable-threads" configure option.
+**
+*****************************************************************************
+')
+ return false
+ else
+ # ruby -> disable && tcl -> disable
+ return true
+ end
+ end
+end
+
+if mac_need_framework ||
+ (have_header("tcl.h") && have_header("tk.h") &&
+ (is_win32 || find_library("X11", "XOpenDisplay",
+ "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
+ find_tcl(tcllib, stubs) &&
+ find_tk(tklib, stubs))
+ $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
+ $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
+
+ if mac_need_framework
+ $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
+ $LDFLAGS += ' -framework Tk -framework Tcl'
+ end
+
+ create_makefile("tcltklib") if stubs or pthread_check
+end
diff --git a/ext/tk/lib/tcltk.rb b/ext/tcltklib/lib/tcltk.rb
index 1a6694dbff..1a6694dbff 100644
--- a/ext/tk/lib/tcltk.rb
+++ b/ext/tcltklib/lib/tcltk.rb
diff --git a/ext/tk/sample/tcltklib/batsu.gif b/ext/tcltklib/sample/batsu.gif
index 880cc73e09..880cc73e09 100644
--- a/ext/tk/sample/tcltklib/batsu.gif
+++ b/ext/tcltklib/sample/batsu.gif
Binary files differ
diff --git a/ext/tk/sample/tcltklib/maru.gif b/ext/tcltklib/sample/maru.gif
index 2c0202892e..2c0202892e 100644
--- a/ext/tk/sample/tcltklib/maru.gif
+++ b/ext/tcltklib/sample/maru.gif
Binary files differ
diff --git a/ext/tk/sample/tcltklib/sample0.rb b/ext/tcltklib/sample/sample0.rb
index cd4c8069b4..cd4c8069b4 100644
--- a/ext/tk/sample/tcltklib/sample0.rb
+++ b/ext/tcltklib/sample/sample0.rb
diff --git a/ext/tk/sample/tcltklib/sample1.rb b/ext/tcltklib/sample/sample1.rb
index 13df440751..77b79e6dbf 100644
--- a/ext/tk/sample/tcltklib/sample1.rb
+++ b/ext/tcltklib/sample/sample1.rb
@@ -24,7 +24,7 @@ class Test1
c = ip.commands()
# »ÈÍѤ¹¤ë¥³¥Þ¥ó¥É¤ËÂбþ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ÏÊÑ¿ô¤ËÆþ¤ì¤Æ¤ª¤¯.
append, bind, button, destroy, incr, info, label, place, set, wm =
- c.values_at(
+ c.indexes(
"append", "bind", "button", "destroy", "incr", "info", "label", "place",
"set", "wm")
@@ -136,7 +136,7 @@ class Test1
# ¥µ¥ó¥×¥ë¤Î¤¿¤á¤Î¥¦¥£¥¸¥§¥Ã¥È¤òÀ¸À®¤¹¤ë.
def sample(ip, parent)
- bind, button, destroy, grid, toplevel, wm = ip.commands().values_at(
+ bind, button, destroy, grid, toplevel, wm = ip.commands().indexes(
"bind", "button", "destroy", "grid", "toplevel", "wm")
## toplevel
@@ -207,7 +207,7 @@ class Test1
# parent: ¿Æ¥¦¥£¥¸¥§¥Ã¥È
# title: toplevel ¥¦¥£¥¸¥§¥Ã¥È¤Î¥¦¥¤¥ó¥É¥¦¤Î¥¿¥¤¥È¥ë
def inittoplevel(ip, parent, title)
- bind, button, destroy, toplevel, wm = ip.commands().values_at(
+ bind, button, destroy, toplevel, wm = ip.commands().indexes(
"bind", "button", "destroy", "toplevel", "wm")
# ¿·¤·¤¤¥¦¥¤¥ó¥É¥¦¤ò³«¤¯¤Ë¤Ï, toplevel ¤ò»È¤¦.
@@ -229,7 +229,7 @@ class Test1
# label ¤Î¥µ¥ó¥×¥ë.
def test_label(ip, parent)
- button, global, label, pack = ip.commands().values_at(
+ button, global, label, pack = ip.commands().indexes(
"button", "global", "label", "pack")
t1, b1, cb = inittoplevel(ip, parent, "label")
@@ -272,7 +272,7 @@ class Test1
# button ¤Î¥µ¥ó¥×¥ë.
def test_button(ip, parent)
- button, pack = ip.commands().values_at("button", "pack")
+ button, pack = ip.commands().indexes("button", "pack")
t1, b1, cb = inittoplevel(ip, parent, "button")
## button
@@ -290,7 +290,7 @@ class Test1
# checkbutton ¤Î¥µ¥ó¥×¥ë.
def test_checkbutton(ip, parent)
- checkbutton, global, pack = ip.commands().values_at(
+ checkbutton, global, pack = ip.commands().indexes(
"checkbutton", "global", "pack")
t1, b1, cb = inittoplevel(ip, parent, "checkbutton")
@@ -306,7 +306,7 @@ class Test1
# radiobutton ¤Î¥µ¥ó¥×¥ë.
def test_radiobutton(ip, parent)
- global, label, pack, radiobutton = ip.commands().values_at(
+ global, label, pack, radiobutton = ip.commands().indexes(
"global", "label", "pack", "radiobutton")
t1, b1, cb = inittoplevel(ip, parent, "radiobutton")
@@ -330,7 +330,7 @@ class Test1
# scale ¤Î¥µ¥ó¥×¥ë.
def test_scale(ip, parent)
- global, pack, scale = ip.commands().values_at(
+ global, pack, scale = ip.commands().indexes(
"global", "pack", "scale")
t1, b1, cb = inittoplevel(ip, parent, "scale")
@@ -350,7 +350,7 @@ class Test1
# entry ¤Î¥µ¥ó¥×¥ë.
def test_entry(ip, parent)
- button, entry, global, pack = ip.commands().values_at(
+ button, entry, global, pack = ip.commands().indexes(
"button", "entry", "global", "pack")
t1, b1, cb = inittoplevel(ip, parent, "entry")
@@ -369,7 +369,7 @@ class Test1
# text ¤Î¥µ¥ó¥×¥ë.
def test_text(ip, parent)
- button, pack, text = ip.commands().values_at(
+ button, pack, text = ip.commands().indexes(
"button", "pack", "text")
t1, b1, cb = inittoplevel(ip, parent, "text")
@@ -385,7 +385,7 @@ class Test1
# raise/lower ¤Î¥µ¥ó¥×¥ë.
def test_raise(ip, parent)
- button, frame, lower, pack, raise = ip.commands().values_at(
+ button, frame, lower, pack, raise = ip.commands().indexes(
"button", "frame", "lower", "pack", "raise")
t1, b1, cb = inittoplevel(ip, parent, "raise/lower")
@@ -408,7 +408,7 @@ class Test1
# modal ¤Ê¥¦¥£¥¸¥§¥Ã¥È¤Î¥µ¥ó¥×¥ë.
def test_modal(ip, parent)
button, frame, message, pack, tk_chooseColor, tk_getOpenFile,
- tk_messageBox = ip.commands().values_at(
+ tk_messageBox = ip.commands().indexes(
"button", "frame", "message", "pack", "tk_chooseColor",
"tk_getOpenFile", "tk_messageBox")
# ºÇ½é¤Ë load ¤µ¤ì¤Æ¤¤¤Ê¤¤¥é¥¤¥Ö¥é¥ê¤Ï ip.commands() ¤Ë¸ºß¤·¤Ê¤¤¤Î¤Ç,
@@ -451,7 +451,7 @@ class Test1
# menu ¤Î¥µ¥ó¥×¥ë.
def test_menu(ip, parent)
- global, menu, menubutton, pack = ip.commands().values_at(
+ global, menu, menubutton, pack = ip.commands().indexes(
"global", "menu", "menubutton", "pack")
tk_optionMenu = TclTkLibCommand.new(ip, "tk_optionMenu")
t1, b1, cb = inittoplevel(ip, parent, "menu")
@@ -498,7 +498,7 @@ class Test1
# listbox ¤Î¥µ¥ó¥×¥ë.
def test_listbox(ip, parent)
clipboard, frame, grid, listbox, lower, menu, menubutton, pack, scrollbar,
- selection = ip.commands().values_at(
+ selection = ip.commands().indexes(
"clipboard", "frame", "grid", "listbox", "lower", "menu", "menubutton",
"pack", "scrollbar", "selection")
t1, b1, cb = inittoplevel(ip, parent, "listbox")
@@ -559,7 +559,7 @@ class Test1
# canvas ¤Î¥µ¥ó¥×¥ë.
def test_canvas(ip, parent)
- canvas, lower, pack = ip.commands().values_at("canvas", "lower", "pack")
+ canvas, lower, pack = ip.commands().indexes("canvas", "lower", "pack")
t1, b1, cb = inittoplevel(ip, parent, "canvas")
## canvas
diff --git a/ext/tk/sample/tcltklib/sample2.rb b/ext/tcltklib/sample/sample2.rb
index 444bb1eef7..5d43470de3 100644
--- a/ext/tk/sample/tcltklib/sample2.rb
+++ b/ext/tcltklib/sample/sample2.rb
@@ -19,7 +19,7 @@ require "tcltk"
$ip = TclTkInterpreter.new()
$root = $ip.rootwidget()
$button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm =
- $ip.commands().values_at(
+ $ip.commands().indexes(
"button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm")
class Othello
@@ -196,12 +196,10 @@ class Othello
def initialize(view, row, col)
@view = view
- @id = @view.e("create rectangle",
- *(view.tk_rect(view.left + col,
- view.top + row,
- view.left + col + 1,
- view.top + row + 1) \
- << "-fill #{BACK_GROUND_COLOR}") )
+ @id = @view.e("create rectangle", *view.tk_rect(view.left + col,
+ view.top + row,
+ view.left + col + 1,
+ view.top + row + 1))
@row = row
@col = col
@view.e("itemconfigure", @id,
diff --git a/ext/tcltklib/stubs.c b/ext/tcltklib/stubs.c
new file mode 100644
index 0000000000..3913abb570
--- /dev/null
+++ b/ext/tcltklib/stubs.c
@@ -0,0 +1,104 @@
+int ruby_tcltk_stubs();
+
+#if defined USE_TCL_STUBS && defined USE_TK_STUBS
+#include "ruby.h"
+
+#if defined _WIN32 || defined __CYGWIN__
+# include "util.h"
+# include <windows.h>
+ typedef HINSTANCE DL_HANDLE;
+# define DL_OPEN LoadLibrary
+# define DL_SYM GetProcAddress
+# define TCL_INDEX 4
+# define TK_INDEX 3
+# define TCL_NAME "tcl89%s"
+# define TK_NAME "tk89%s"
+# undef DLEXT
+# define DLEXT ".dll"
+#elif defined HAVE_DLOPEN
+# include <dlfcn.h>
+ typedef void *DL_HANDLE;
+# define DL_OPEN(file) dlopen(file, RTLD_LAZY|RTLD_GLOBAL)
+# define DL_SYM dlsym
+# define TCL_INDEX 8
+# define TK_INDEX 7
+# define TCL_NAME "libtcl8.9%s"
+# define TK_NAME "libtk8.9%s"
+#endif
+
+#include <tcl.h>
+#include <tk.h>
+
+int
+ruby_tcltk_stubs()
+{
+ DL_HANDLE tcl_dll;
+ DL_HANDLE tk_dll;
+ void (*p_Tcl_FindExecutable)(const char *);
+ Tcl_Interp *(*p_Tcl_CreateInterp)();
+ int (*p_Tk_Init)(Tcl_Interp *);
+ Tcl_Interp *tcl_ip;
+ int n;
+ char *ruby_tcl_dll = 0;
+ char *ruby_tk_dll = 0;
+ char tcl_name[20];
+ char tk_name[20];
+
+ ruby_tcl_dll = getenv("RUBY_TCL_DLL");
+#if defined _WIN32
+ if (ruby_tcl_dll) ruby_tcl_dll = ruby_strdup(ruby_tcl_dll);
+#endif
+ ruby_tk_dll = getenv("RUBY_TK_DLL");
+ if (ruby_tcl_dll && ruby_tk_dll) {
+ tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
+ tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
+ } else {
+ snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
+ snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
+ /* examine from 8.9 to 8.1 */
+ for (n = '9'; n > '0'; n--) {
+ tcl_name[TCL_INDEX] = n;
+ tk_name[TK_INDEX] = n;
+ tcl_dll = (DL_HANDLE)DL_OPEN(tcl_name);
+ tk_dll = (DL_HANDLE)DL_OPEN(tk_name);
+ if (tcl_dll && tk_dll)
+ break;
+ }
+ }
+
+#if defined _WIN32
+ if (ruby_tcl_dll) ruby_xfree(ruby_tcl_dll);
+#endif
+
+ if (!tcl_dll || !tk_dll)
+ return -1;
+
+ p_Tcl_FindExecutable = (void (*)(const char *))DL_SYM(tcl_dll, "Tcl_FindExecutable");
+ if (!p_Tcl_FindExecutable)
+ return -7;
+
+ p_Tcl_FindExecutable("ruby");
+
+ p_Tcl_CreateInterp = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_CreateInterp");
+ if (!p_Tcl_CreateInterp)
+ return -2;
+
+ tcl_ip = (*p_Tcl_CreateInterp)();
+ if (!tcl_ip)
+ return -3;
+
+ p_Tk_Init = (int (*)(Tcl_Interp *))DL_SYM(tk_dll, "Tk_Init");
+ if (!p_Tk_Init)
+ return -4;
+ (*p_Tk_Init)(tcl_ip);
+
+ if (!Tcl_InitStubs(tcl_ip, "8.1", 0))
+ return -5;
+ if (!Tk_InitStubs(tcl_ip, "8.1", 0))
+ return -6;
+
+ Tcl_DeleteInterp(tcl_ip);
+
+ return 0;
+}
+#endif
diff --git a/ext/tk/tcltklib.c b/ext/tcltklib/tcltklib.c
index 10b79f2970..a80b4530f1 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -4,11 +4,8 @@
* Oct. 24, 1997 Y. Matsumoto
*/
-#define TCLTKLIB_RELEASE_DATE "2006-12-01"
-
#include "ruby.h"
#include "rubysig.h"
-#include "version.h"
#undef EXTERN /* avoid conflict with tcl.h of tcl8.2 or before */
#include <stdio.h>
#ifdef HAVE_STDARG_PROTOTYPES
@@ -22,12 +19,9 @@
#include <tcl.h>
#include <tk.h>
-#include "stubs.h"
-
-#ifndef TCL_ALPHA_RELEASE
-#define TCL_ALPHA_RELEASE 0
-#define TCL_BETA_RELEASE 1
-#define TCL_FINAL_RELEASE 2
+#ifdef __MACOS__
+# include <tkMac.h>
+# include <Quickdraw.h>
#endif
#if TCL_MAJOR_VERSION >= 8
@@ -65,25 +59,14 @@
#define DUMP1(ARG1) if (ruby_debug) { fprintf(stderr, "tcltklib: %s\n", ARG1); fflush(stderr); }
#define DUMP2(ARG1, ARG2) if (ruby_debug) { fprintf(stderr, "tcltklib: ");\
fprintf(stderr, ARG1, ARG2); fprintf(stderr, "\n"); fflush(stderr); }
-#define DUMP3(ARG1, ARG2, ARG3) if (ruby_debug) { fprintf(stderr, "tcltklib: ");\
-fprintf(stderr, ARG1, ARG2, ARG3); fprintf(stderr, "\n"); fflush(stderr); }
/*
#define DUMP1(ARG1)
#define DUMP2(ARG1, ARG2)
-#define DUMP3(ARG1, ARG2, ARG3)
*/
-/* release date */
-const char tcltklib_release_date[] = TCLTKLIB_RELEASE_DATE;
-
-/* finalize_proc_name */
+/*finalize_proc_name */
static char *finalize_hook_name = "INTERP_FINALIZE_HOOK";
-static void ip_finalize _((Tcl_Interp*));
-
-static int at_exit = 0;
-
-
/* for callback break & continue */
static VALUE eTkCallbackReturn;
static VALUE eTkCallbackBreak;
@@ -91,21 +74,12 @@ static VALUE eTkCallbackContinue;
static VALUE eLocalJumpError;
-static VALUE eTkLocalJumpError;
-static VALUE eTkCallbackRetry;
-static VALUE eTkCallbackRedo;
-static VALUE eTkCallbackThrow;
-
-static VALUE tcltkip_class;
-
static ID ID_at_enc;
static ID ID_at_interp;
static ID ID_stop_p;
-static ID ID_alive_p;
static ID ID_kill;
static ID ID_join;
-static ID ID_value;
static ID ID_call;
static ID ID_backtrace;
@@ -122,114 +96,6 @@ static ID ID_inspect;
static VALUE ip_invoke_real _((int, VALUE*, VALUE));
static VALUE ip_invoke _((int, VALUE*, VALUE));
-static VALUE tk_funcall _((VALUE(), int, VALUE*, VALUE));
-
-/* safe Tcl_Eval and Tcl_GlobalEval */
-static int
-tcl_eval(interp, cmd)
- Tcl_Interp *interp;
- const char *cmd; /* don't have to be writable */
-{
- char *buf = strdup(cmd);
- int ret;
-
- Tcl_AllowExceptions(interp);
- ret = Tcl_Eval(interp, buf);
- free(buf);
- return ret;
-}
-
-#undef Tcl_Eval
-#define Tcl_Eval tcl_eval
-
-static int
-tcl_global_eval(interp, cmd)
- Tcl_Interp *interp;
- const char *cmd; /* don't have to be writable */
-{
- char *buf = strdup(cmd);
- int ret;
-
- Tcl_AllowExceptions(interp);
- ret = Tcl_GlobalEval(interp, buf);
- free(buf);
- return ret;
-}
-
-#undef Tcl_GlobalEval
-#define Tcl_GlobalEval tcl_global_eval
-
-/* Tcl_{Incr|Decr}RefCount for tcl7.x or earlier */
-#if TCL_MAJOR_VERSION < 8
-#define Tcl_IncrRefCount(obj) (1)
-#define Tcl_DecrRefCount(obj) (1)
-#endif
-
-/* Tcl_GetStringResult for tcl7.x or earlier */
-#if TCL_MAJOR_VERSION < 8
-#define Tcl_GetStringResult(interp) ((interp)->result)
-#endif
-
-/* Tcl_[GS]etVar2Ex for tcl8.0 */
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
-static Tcl_Obj *
-Tcl_GetVar2Ex(interp, name1, name2, flags)
- Tcl_Interp *interp;
- CONST char *name1;
- CONST char *name2;
- int flags;
-{
- Tcl_Obj *nameObj1, *nameObj2 = NULL, *retObj;
-
- nameObj1 = Tcl_NewStringObj((char*)name1, -1);
- Tcl_IncrRefCount(nameObj1);
-
- if (name2) {
- nameObj2 = Tcl_NewStringObj((char*)name2, -1);
- Tcl_IncrRefCount(nameObj2);
- }
-
- retObj = Tcl_ObjGetVar2(interp, nameObj1, nameObj2, flags);
-
- if (name2) {
- Tcl_DecrRefCount(nameObj2);
- }
-
- Tcl_DecrRefCount(nameObj1);
-
- return retObj;
-}
-
-static Tcl_Obj *
-Tcl_SetVar2Ex(interp, name1, name2, newValObj, flags)
- Tcl_Interp *interp;
- CONST char *name1;
- CONST char *name2;
- Tcl_Obj *newValObj;
- int flags;
-{
- Tcl_Obj *nameObj1, *nameObj2 = NULL, *retObj;
-
- nameObj1 = Tcl_NewStringObj((char*)name1, -1);
- Tcl_IncrRefCount(nameObj1);
-
- if (name2) {
- nameObj2 = Tcl_NewStringObj((char*)name2, -1);
- Tcl_IncrRefCount(nameObj2);
- }
-
- retObj = Tcl_ObjSetVar2(interp, nameObj1, nameObj2, newValObj, flags);
-
- if (name2) {
- Tcl_DecrRefCount(nameObj2);
- }
-
- Tcl_DecrRefCount(nameObj1);
-
- return retObj;
-}
-#endif
-
/* from tkAppInit.c */
#if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4)
@@ -272,18 +138,6 @@ struct eval_queue {
VALUE thread;
};
-struct call_queue {
- Tcl_Event ev;
- VALUE (*func)();
- int argc;
- VALUE *argv;
- VALUE interp;
- int *done;
- int safe_level;
- VALUE result;
- VALUE thread;
-};
-
void
invoke_queue_mark(struct invoke_queue *q)
{
@@ -300,28 +154,10 @@ eval_queue_mark(struct eval_queue *q)
rb_gc_mark(q->thread);
}
-void
-call_queue_mark(struct call_queue *q)
-{
- int i;
-
- for(i = 0; i < q->argc; i++) {
- rb_gc_mark(q->argv[i]);
- }
-
- rb_gc_mark(q->interp);
- rb_gc_mark(q->result);
- rb_gc_mark(q->thread);
-}
-
-
+
static VALUE eventloop_thread;
-static VALUE eventloop_stack;
-
static VALUE watchdog_thread;
-
Tcl_Interp *current_interp;
-
/*
* 'event_loop_max' is a maximum events which the eventloop processes in one
@@ -350,8 +186,6 @@ static int loop_counter = 0;
static int check_rootwidget_flag = 0;
-
-/* call ruby interpreter */
#if TCL_MAJOR_VERSION >= 8
static int ip_ruby_eval _((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST*));
static int ip_ruby_cmd _((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST*));
@@ -360,221 +194,14 @@ static int ip_ruby_eval _((ClientData, Tcl_Interp *, int, char **));
static int ip_ruby_cmd _((ClientData, Tcl_Interp *, int, char **));
#endif
-struct cmd_body_arg {
- VALUE receiver;
- ID method;
- VALUE args;
-};
-
-
-/*----------------------------*/
-/* use Tcl internal functions */
-/*----------------------------*/
-#ifndef TCL_NAMESPACE_DEBUG
-#define TCL_NAMESPACE_DEBUG 0
-#endif
-
-#if TCL_NAMESPACE_DEBUG
-
-#if TCL_MAJOR_VERSION >= 8
-EXTERN struct TclIntStubs *tclIntStubsPtr;
-#endif
-
-/*-- Tcl_GetCurrentNamespace --*/
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5
-/* Tcl7.x doesn't have namespace support. */
-/* Tcl8.5+ has definition of Tcl_GetCurrentNamespace() in tclDecls.h */
-# ifndef Tcl_GetCurrentNamespace
-EXTERN Tcl_Namespace * Tcl_GetCurrentNamespace _((Tcl_Interp *));
-# endif
-# if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
-# ifndef Tcl_GetCurrentNamespace
-# ifndef FunctionNum_of_GetCurrentNamespace
-#define FunctionNum_of_GetCurrentNamespace 124
-# endif
-struct DummyTclIntStubs_for_GetCurrentNamespace {
- int magic;
- struct TclIntStubHooks *hooks;
- void (*func[FunctionNum_of_GetCurrentNamespace])();
- Tcl_Namespace * (*tcl_GetCurrentNamespace) _((Tcl_Interp *));
-};
-
-#define Tcl_GetCurrentNamespace \
- (((struct DummyTclIntStubs_for_GetCurrentNamespace *)tclIntStubsPtr)->tcl_GetCurrentNamespace)
-# endif
-# endif
-#endif
-
-/* namespace check */
-/* ip_null_namespace(Tcl_Interp *interp) */
-#if TCL_MAJOR_VERSION < 8
-#define ip_null_namespace(interp) (0)
-#else /* support namespace */
-#define ip_null_namespace(interp) \
- (Tcl_GetCurrentNamespace(interp) == (Tcl_Namespace *)NULL)
-#endif
-
-/* rbtk_invalid_namespace(tcltkip *ptr) */
-#if TCL_MAJOR_VERSION < 8
-#define rbtk_invalid_namespace(ptr) (0)
-#else /* support namespace */
-#define rbtk_invalid_namespace(ptr) \
- ((ptr)->default_ns == (Tcl_Namespace*)NULL || Tcl_GetCurrentNamespace((ptr)->ip) != (ptr)->default_ns)
-#endif
-
-/*-- Tcl_PopCallFrame & Tcl_PushCallFrame --*/
-#if TCL_MAJOR_VERSION >= 8
-# ifndef CallFrame
-typedef struct CallFrame {
- Tcl_Namespace *nsPtr;
- int dummy1;
- int dummy2;
- char *dummy3;
- struct CallFrame *callerPtr;
- struct CallFrame *callerVarPtr;
- int level;
- char *dummy7;
- char *dummy8;
- int dummy9;
- char* dummy10;
-} CallFrame;
-# endif
-
-# if !defined(TclGetFrame) && !defined(TclGetFrame_TCL_DECLARED)
-EXTERN int TclGetFrame _((Tcl_Interp *, CONST char *, CallFrame **));
-# endif
-# if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
-# ifndef TclGetFrame
-# ifndef FunctionNum_of_GetFrame
-#define FunctionNum_of_GetFrame 32
-# endif
-struct DummyTclIntStubs_for_GetFrame {
- int magic;
- struct TclIntStubHooks *hooks;
- void (*func[FunctionNum_of_GetFrame])();
- int (*tclGetFrame) _((Tcl_Interp *, CONST char *, CallFrame **));
-};
-#define TclGetFrame \
- (((struct DummyTclIntStubs_for_GetFrame *)tclIntStubsPtr)->tclGetFrame)
-# endif
-# endif
-
-# if !defined(Tcl_PopCallFrame) && !defined(Tcl_PopCallFrame_TCL_DECLARED)
-EXTERN void Tcl_PopCallFrame _((Tcl_Interp *));
-EXTERN int Tcl_PushCallFrame _((Tcl_Interp *, Tcl_CallFrame *, Tcl_Namespace *, int));
-# endif
-# if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
-# ifndef Tcl_PopCallFrame
-# ifndef FunctionNum_of_PopCallFrame
-#define FunctionNum_of_PopCallFrame 128
-# endif
-struct DummyTclIntStubs_for_PopCallFrame {
- int magic;
- struct TclIntStubHooks *hooks;
- void (*func[FunctionNum_of_PopCallFrame])();
- void (*tcl_PopCallFrame) _((Tcl_Interp *));
- int (*tcl_PushCallFrame) _((Tcl_Interp *, Tcl_CallFrame *, Tcl_Namespace *, int));
-};
-
-#define Tcl_PopCallFrame \
- (((struct DummyTclIntStubs_for_PopCallFrame *)tclIntStubsPtr)->tcl_PopCallFrame)
-#define Tcl_PushCallFrame \
- (((struct DummyTclIntStubs_for_PopCallFrame *)tclIntStubsPtr)->tcl_PushCallFrame)
-# endif
-# endif
-
-#else /* Tcl7.x */
-# ifndef CallFrame
-typedef struct CallFrame {
- Tcl_HashTable varTable;
- int level;
- int argc;
- char **argv;
- struct CallFrame *callerPtr;
- struct CallFrame *callerVarPtr;
-} CallFrame;
-# endif
-# ifndef Tcl_CallFrame
-#define Tcl_CallFrame CallFrame
-# endif
-
-# if !defined(TclGetFrame) && !defined(TclGetFrame_TCL_DECLARED)
-EXTERN int TclGetFrame _((Tcl_Interp *, CONST char *, CallFrame **));
-# endif
-
-# if !defined(Tcl_PopCallFrame) && !defined(Tcl_PopCallFrame_TCL_DECLARED)
-typedef struct DummyInterp {
- char *dummy1;
- char *dummy2;
- int dummy3;
- Tcl_HashTable dummy4;
- Tcl_HashTable dummy5;
- Tcl_HashTable dummy6;
- int numLevels;
- int maxNestingDepth;
- CallFrame *framePtr;
- CallFrame *varFramePtr;
-} DummyInterp;
-
-static void
-Tcl_PopCallFrame(interp)
- Tcl_Interp *interp;
-{
- DummyInterp *iPtr = (DummyInterp*)interp;
- CallFrame *frame = iPtr->varFramePtr;
-
- /* **** DUMMY **** */
- iPtr->framePtr = frame.callerPtr;
- iPtr->varFramePtr = frame.callerVarPtr;
-
- return TCL_OK;
-}
-
-/* dummy */
-#define Tcl_Namespace char
-
-static int
-Tcl_PushCallFrame(interp, framePtr, nsPtr, isProcCallFrame)
- Tcl_Interp *interp;
- Tcl_CallFrame *framePtr;
- Tcl_Namespace *nsPtr;
- int isProcCallFrame;
-{
- DummyInterp *iPtr = (DummyInterp*)interp;
- CallFrame *frame = (CallFrame *)framePtr;
-
- /* **** DUMMY **** */
- Tcl_InitHashTable(&frame.varTable, TCL_STRING_KEYS);
- if (iPtr->varFramePtr != NULL) {
- frame.level = iPtr->varFramePtr->level + 1;
- } else {
- frame.level = 1;
- }
- frame.callerPtr = iPtr->framePtr;
- frame.callerVarPtr = iPtr->varFramePtr;
- iPtr->framePtr = &frame;
- iPtr->varFramePtr = &frame;
-
- return TCL_OK;
-}
-# endif
-
-#endif
-
-#endif /* TCL_NAMESPACE_DEBUG */
-
-
/*---- class TclTkIp ----*/
struct tcltkip {
- Tcl_Interp *ip; /* the interpreter */
-#if TCL_NAMESPACE_DEBUG
- Tcl_Namespace *default_ns; /* default namespace */
-#endif
- int has_orig_exit; /* has original 'exit' command ? */
- Tcl_CmdInfo orig_exit_info; /* command info of original 'exit' command */
- int ref_count; /* reference count of rbtk_preserve_ip call */
- int allow_ruby_exit; /* allow exiting ruby by 'exit' function */
- int return_value; /* return value */
+ Tcl_Interp *ip; /* the interpreter */
+ int has_orig_exit; /* has original 'exit' command ? */
+ Tcl_CmdInfo orig_exit_info; /* command info of original 'exit' command */
+ int ref_count; /* reference count of rbtk_preserve_ip call */
+ int allow_ruby_exit; /* allow exiting ruby by 'exit' function */
+ int return_value; /* return value */
};
static struct tcltkip *
@@ -585,43 +212,18 @@ get_ip(self)
Data_Get_Struct(self, struct tcltkip, ptr);
if (ptr == 0) {
- /* rb_raise(rb_eTypeError, "uninitialized TclTkIp"); */
- return((struct tcltkip *)NULL);
- }
- if (ptr->ip == (Tcl_Interp*)NULL) {
- /* rb_raise(rb_eRuntimeError, "deleted IP"); */
- return((struct tcltkip *)NULL);
+ rb_raise(rb_eTypeError, "uninitialized TclTkIp");
}
return ptr;
}
-static int
-deleted_ip(ptr)
- struct tcltkip *ptr;
-{
- if (!ptr || !ptr->ip || Tcl_InterpDeleted(ptr->ip)
-#if TCL_NAMESPACE_DEBUG
- || rbtk_invalid_namespace(ptr)
-#endif
- ) {
- DUMP1("ip is deleted");
- return Qtrue;
- }
- return Qfalse;
-}
-
/* increment/decrement reference count of tcltkip */
static int
rbtk_preserve_ip(ptr)
struct tcltkip *ptr;
{
ptr->ref_count++;
- if (ptr->ip == (Tcl_Interp*)NULL) {
- /* deleted IP */
- ptr->ref_count = 0;
- } else {
- Tcl_Preserve((ClientData)ptr->ip);
- }
+ Tcl_Preserve((ClientData)ptr->ip);
return(ptr->ref_count);
}
@@ -632,213 +234,12 @@ rbtk_release_ip(ptr)
ptr->ref_count--;
if (ptr->ref_count < 0) {
ptr->ref_count = 0;
- } else if (ptr->ip == (Tcl_Interp*)NULL) {
- /* deleted IP */
- ptr->ref_count = 0;
} else {
Tcl_Release((ClientData)ptr->ip);
}
return(ptr->ref_count);
}
-
-static VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
-create_ip_exc(VALUE interp, VALUE exc, const char *fmt, ...)
-#else
-create_ip_exc(interp, exc, fmt, va_alist)
- VALUE interp:
- VALUE exc;
- const char *fmt;
- va_dcl
-#endif
-{
- va_list args;
- char buf[BUFSIZ];
- VALUE einfo;
- struct tcltkip *ptr = get_ip(interp);
-
- va_init_list(args,fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
- buf[BUFSIZ - 1] = '\0';
- va_end(args);
- einfo = rb_exc_new2(exc, buf);
- rb_ivar_set(einfo, ID_at_interp, interp);
- if (ptr) {
- Tcl_ResetResult(ptr->ip);
- }
-
- return einfo;
-}
-
-
-/* stub status */
-static void
-tcl_stubs_check()
-{
- if (!tcl_stubs_init_p()) {
- int st = ruby_tcl_stubs_init();
- switch(st) {
- case TCLTK_STUBS_OK:
- break;
- case NO_TCL_DLL:
- rb_raise(rb_eLoadError, "tcltklib: fail to open tcl_dll");
- case NO_FindExecutable:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_FindExecutable");
- case NO_CreateInterp:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_CreateInterp()");
- case NO_DeleteInterp:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_DeleteInterp()");
- case FAIL_CreateInterp:
- rb_raise(rb_eRuntimeError, "tcltklib: fail to create a new IP to call Tcl_InitStubs()");
- case FAIL_Tcl_InitStubs:
- rb_raise(rb_eRuntimeError, "tcltklib: fail to Tcl_InitStubs()");
- default:
- rb_raise(rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tcl_stubs_init()", st);
- }
- }
-}
-
-
-static VALUE
-tcltkip_init_tk(interp)
- VALUE interp;
-{
- struct tcltkip *ptr = get_ip(interp);
-
-#if TCL_MAJOR_VERSION >= 8
- int st;
-
- if (Tcl_IsSafe(ptr->ip)) {
- DUMP1("Tk_SafeInit");
- st = ruby_tk_stubs_safeinit(ptr->ip);
- switch(st) {
- case TCLTK_STUBS_OK:
- break;
- case NO_Tk_Init:
- return rb_exc_new2(rb_eLoadError,
- "tcltklib: can't find Tk_SafeInit()");
- case FAIL_Tk_Init:
- return create_ip_exc(interp, rb_eRuntimeError,
- "tcltklib: fail to Tk_SafeInit(). %s",
- Tcl_GetStringResult(ptr->ip));
- case FAIL_Tk_InitStubs:
- return create_ip_exc(interp, rb_eRuntimeError,
- "tcltklib: fail to Tk_InitStubs(). %s",
- Tcl_GetStringResult(ptr->ip));
- default:
- return create_ip_exc(interp, rb_eRuntimeError,
- "tcltklib: unknown error(%d) on ruby_tk_stubs_safeinit", st);
- }
- } else {
- DUMP1("Tk_Init");
- st = ruby_tk_stubs_init(ptr->ip);
- switch(st) {
- case TCLTK_STUBS_OK:
- break;
- case NO_Tk_Init:
- return rb_exc_new2(rb_eLoadError,
- "tcltklib: can't find Tk_Init()");
- case FAIL_Tk_Init:
- return create_ip_exc(interp, rb_eRuntimeError,
- "tcltklib: fail to Tk_Init(). %s",
- Tcl_GetStringResult(ptr->ip));
- case FAIL_Tk_InitStubs:
- return create_ip_exc(interp, rb_eRuntimeError,
- "tcltklib: fail to Tk_InitStubs(). %s",
- Tcl_GetStringResult(ptr->ip));
- default:
- return create_ip_exc(interp, rb_eRuntimeError,
- "tcltklib: unknown error(%d) on ruby_tk_stubs_init", st);
- }
- }
-
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tk_Init");
- if (ruby_tk_stubs_init(ptr->ip) != TCLTK_STUBS_OK) {
- return rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
- }
-#endif
-
- return Qnil;
-}
-
-
-/* treat excetiopn on Tcl side */
-static VALUE rbtk_pending_exception;
-static int rbtk_eventloop_depth = 0;
-
-
-static int
-pending_exception_check0()
-{
- volatile VALUE exc = rbtk_pending_exception;
-
- if (!NIL_P(exc) && rb_obj_is_kind_of(exc, rb_eException)) {
- DUMP1("find a pending exception");
- if (rbtk_eventloop_depth > 0) {
- return 1; /* pending */
- } else {
- rbtk_pending_exception = Qnil;
-
- if (rb_obj_is_kind_of(exc, eTkCallbackRetry)) {
- DUMP1("pending_exception_check0: call rb_jump_tag(retry)");
- rb_jump_tag(TAG_RETRY);
- } else if (rb_obj_is_kind_of(exc, eTkCallbackRedo)) {
- DUMP1("pending_exception_check0: call rb_jump_tag(redo)");
- rb_jump_tag(TAG_REDO);
- } else if (rb_obj_is_kind_of(exc, eTkCallbackThrow)) {
- DUMP1("pending_exception_check0: call rb_jump_tag(throw)");
- rb_jump_tag(TAG_THROW);
- }
-
- rb_exc_raise(exc);
- }
- } else {
- return 0;
- }
-}
-
-static int
-pending_exception_check1(thr_crit_bup, ptr)
- int thr_crit_bup;
- struct tcltkip *ptr;
-{
- volatile VALUE exc = rbtk_pending_exception;
-
- if (!NIL_P(exc) && rb_obj_is_kind_of(exc, rb_eException)) {
- DUMP1("find a pending exception");
-
- if (rbtk_eventloop_depth > 0) {
- return 1; /* pending */
- } else {
- rbtk_pending_exception = Qnil;
-
- if (ptr != (struct tcltkip *)NULL) {
- /* Tcl_Release(ptr->ip); */
- rbtk_release_ip(ptr);
- }
-
- rb_thread_critical = thr_crit_bup;
-
- if (rb_obj_is_kind_of(exc, eTkCallbackRetry)) {
- DUMP1("pending_exception_check1: call rb_jump_tag(retry)");
- rb_jump_tag(TAG_RETRY);
- } else if (rb_obj_is_kind_of(exc, eTkCallbackRedo)) {
- DUMP1("pending_exception_check1: call rb_jump_tag(redo)");
- rb_jump_tag(TAG_REDO);
- } else if (rb_obj_is_kind_of(exc, eTkCallbackThrow)) {
- DUMP1("pending_exception_check1: call rb_jump_tag(throw)");
- rb_jump_tag(TAG_THROW);
- }
- rb_exc_raise(exc);
- }
- } else {
- return 0;
- }
-}
-
-
/* call original 'exit' command */
static void
call_original_exit(ptr, state)
@@ -882,8 +283,7 @@ call_original_exit(ptr, state)
char **argv;
argv = (char **)ALLOC_N(char *, 3);
argv[0] = "exit";
- /* argv[1] = Tcl_GetString(state_obj); */
- argv[1] = Tcl_GetStringFromObj(state_obj, (int*)NULL);
+ argv[1] = Tcl_GetString(state_obj);
argv[2] = (char *)NULL;
ptr->return_value = (*(info->proc))(info->clientData, ptr->ip,
@@ -927,18 +327,18 @@ _timer_for_tcl(clientData)
/* struct invoke_queue *q, *tmp; */
/* VALUE thread; */
- DUMP1("call _timer_for_tcl");
+ DUMP1("called timer_for_tcl");
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- Tcl_DeleteTimerHandler(timer_token);
+ Tk_DeleteTimerHandler(timer_token);
run_timer_flag = 1;
if (timer_tick > 0) {
- timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl,
- (ClientData)0);
+ timer_token = Tk_CreateTimerHandler(timer_tick, _timer_for_tcl,
+ (ClientData)0);
} else {
timer_token = (Tcl_TimerToken)NULL;
}
@@ -968,13 +368,13 @@ set_eventloop_tick(self, tick)
rb_thread_critical = Qtrue;
/* delete old timer callback */
- Tcl_DeleteTimerHandler(timer_token);
+ Tk_DeleteTimerHandler(timer_token);
timer_tick = req_timer_tick = ttick;
if (timer_tick > 0) {
/* start timer callback */
- timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl,
- (ClientData)0);
+ timer_token = Tk_CreateTimerHandler(timer_tick, _timer_for_tcl,
+ (ClientData)0);
} else {
timer_token = (Tcl_TimerToken)NULL;
}
@@ -999,7 +399,8 @@ ip_set_eventloop_tick(self, tick)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return get_eventloop_tick(self);
}
@@ -1051,7 +452,8 @@ ip_set_no_event_wait(self, wait)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return get_no_event_wait(self);
}
@@ -1106,7 +508,8 @@ ip_set_eventloop_weight(self, loop_max, no_event)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return get_eventloop_weight(self);
}
@@ -1148,11 +551,8 @@ set_max_block_time(self, time)
tcl_time.usec = (long)(NUM2DBL(RARRAY(divmod)->ptr[1]) * 1000000);
default:
- {
- VALUE tmp = rb_funcall(time, ID_inspect, 0, 0);
- rb_raise(rb_eArgError, "invalid value for time: '%s'",
- StringValuePtr(tmp));
- }
+ rb_raise(rb_eArgError, "invalid value for time: '%s'",
+ RSTRING(rb_funcall(time, ID_inspect, 0, 0))->ptr);
}
Tcl_SetMaxBlockTime(&tcl_time);
@@ -1161,19 +561,6 @@ set_max_block_time(self, time)
}
static VALUE
-lib_evloop_thread_p(self)
- VALUE self;
-{
- if (NIL_P(eventloop_thread)) {
- return Qnil; /* no eventloop */
- } else if (rb_thread_current() == eventloop_thread) {
- return Qtrue; /* is eventloop */
- } else {
- return Qfalse; /* not eventloop */
- }
-}
-
-static VALUE
lib_evloop_abort_on_exc(self)
VALUE self;
{
@@ -1217,7 +604,8 @@ ip_evloop_abort_on_exc_set(self, val)
rb_secure(4);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return lib_evloop_abort_on_exc(self);
}
@@ -1232,69 +620,20 @@ static VALUE
lib_num_of_mainwindows(self)
VALUE self;
{
- if (tk_stubs_init_p()) {
- return INT2FIX(Tk_GetNumMainWindows());
- } else {
- return INT2FIX(0);
- }
-}
-
-
-static VALUE
-call_DoOneEvent(flag_val)
- VALUE flag_val;
-{
- int flag;
-
- flag = FIX2INT(flag_val);
- if (Tcl_DoOneEvent(flag)) {
- return Qtrue;
- } else {
- return Qfalse;
- }
-}
-
-static VALUE
-eventloop_sleep(dummy)
- VALUE dummy;
-{
- struct timeval t;
-
- t.tv_sec = (time_t)0;
- t.tv_usec = (time_t)(no_event_wait*1000.0);
-
-#ifdef HAVE_NATIVETHREAD
- if (!is_ruby_native_thread()) {
- rb_bug("cross-thread violation on eventloop_sleep()");
- }
-#endif
-
- rb_thread_wait_for(t);
-
-#ifdef HAVE_NATIVETHREAD
- if (!is_ruby_native_thread()) {
- rb_bug("cross-thread violation on eventloop_sleep()");
- }
-#endif
-
- return Qnil;
+ return INT2FIX(Tk_GetNumMainWindows());
}
-
static int
-lib_eventloop_core(check_root, update_flag, check_var, interp)
+lib_eventloop_core(check_root, update_flag, check_var)
int check_root;
int update_flag;
int *check_var;
- Tcl_Interp *interp;
{
volatile VALUE current = eventloop_thread;
int found_event = 1;
int event_flag;
struct timeval t;
int thr_crit_bup;
- int status;
- int depth = rbtk_eventloop_depth;
if (update_flag) DUMP1("update loop start!!");
@@ -1302,13 +641,13 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
t.tv_sec = (time_t)0;
t.tv_usec = (time_t)(no_event_wait*1000.0);
- Tcl_DeleteTimerHandler(timer_token);
+ Tk_DeleteTimerHandler(timer_token);
run_timer_flag = 0;
if (timer_tick > 0) {
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- timer_token = Tcl_CreateTimerHandler(timer_tick, _timer_for_tcl,
- (ClientData)0);
+ timer_token = Tk_CreateTimerHandler(timer_tick, _timer_for_tcl,
+ (ClientData)0);
rb_thread_critical = thr_crit_bup;
} else {
timer_token = (Tcl_TimerToken)NULL;
@@ -1327,69 +666,18 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
if (timer_tick == 0 && update_flag == 0) {
timer_tick = NO_THREAD_INTERRUPT_TIME;
- timer_token = Tcl_CreateTimerHandler(timer_tick,
- _timer_for_tcl,
- (ClientData)0);
+ timer_token = Tk_CreateTimerHandler(timer_tick,
+ _timer_for_tcl,
+ (ClientData)0);
}
if (check_var != (int *)NULL) {
if (*check_var || !found_event) {
return found_event;
}
- if (interp != (Tcl_Interp*)NULL
- && Tcl_InterpDeleted(interp)) {
- /* IP for check_var is deleted */
- return 0;
- }
}
- /* found_event = Tcl_DoOneEvent(event_flag); */
- found_event = RTEST(rb_protect(call_DoOneEvent,
- INT2FIX(event_flag), &status));
- if (status) {
- switch (status) {
- case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception
- = rb_exc_new2(rb_eException, "unknown exception");
- } else {
- rbtk_pending_exception = ruby_errinfo;
-
- if (!NIL_P(rbtk_pending_exception)) {
- if (rbtk_eventloop_depth == 0) {
- VALUE exc = rbtk_pending_exception;
- rbtk_pending_exception = Qnil;
- rb_exc_raise(exc);
- } else {
- return 0;
- }
- }
- }
- break;
-
- case TAG_FATAL:
- if (NIL_P(ruby_errinfo)) {
- rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL"));
- } else {
- rb_exc_raise(ruby_errinfo);
- }
- }
- }
-
- if (depth != rbtk_eventloop_depth) {
- DUMP2("DoOneEvent(1) abnormal exit!! %d",
- rbtk_eventloop_depth);
- }
-
- if (check_var != (int*)NULL && !NIL_P(rbtk_pending_exception)) {
- DUMP1("exception on wait");
- return 0;
- }
-
- if (pending_exception_check0()) {
- /* pending -> upper level */
- return 0;
- }
+ found_event = Tcl_DoOneEvent(event_flag);
if (update_flag != 0) {
if (found_event) {
@@ -1401,27 +689,11 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
}
}
- DUMP1("trap check");
- if (rb_trap_pending) {
- run_timer_flag = 0;
- if (rb_prohibit_interrupt || check_var != (int*)NULL) {
- /* pending or on wait command */
- return 0;
- } else {
- rb_trap_exec();
- }
- }
-
DUMP1("check Root Widget");
- if (check_root && tk_stubs_init_p() && Tk_GetNumMainWindows() == 0) {
+ if (check_root && Tk_GetNumMainWindows() == 0) {
run_timer_flag = 0;
- if (rb_trap_pending) {
- if (rb_prohibit_interrupt || check_var != (int*)NULL) {
- /* pending or on wait command */
- return 0;
- } else {
- rb_trap_exec();
- }
+ if (!rb_prohibit_interrupt) {
+ if (rb_trap_pending) rb_trap_exec();
}
return 1;
}
@@ -1452,160 +724,37 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
if (*check_var || !found_event) {
return found_event;
}
- if (interp != (Tcl_Interp*)NULL
- && Tcl_InterpDeleted(interp)) {
- /* IP for check_var is deleted */
- return 0;
- }
}
- if (NIL_P(eventloop_thread) || current == eventloop_thread) {
- int st;
- int status;
-
- /* st = Tcl_DoOneEvent(event_flag); */
- st = RTEST(rb_protect(call_DoOneEvent,
- INT2FIX(event_flag), &status));
- if (status) {
- switch (status) {
- case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception
- = rb_exc_new2(rb_eException,
- "unknown exception");
- } else {
- rbtk_pending_exception = ruby_errinfo;
-
- if (!NIL_P(rbtk_pending_exception)) {
- if (rbtk_eventloop_depth == 0) {
- VALUE exc = rbtk_pending_exception;
- rbtk_pending_exception = Qnil;
- rb_exc_raise(exc);
- } else {
- return 0;
- }
- }
- }
- break;
-
- case TAG_FATAL:
- if (NIL_P(ruby_errinfo)) {
- rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL"));
- } else {
- rb_exc_raise(ruby_errinfo);
- }
- }
- }
-
- if (depth != rbtk_eventloop_depth) {
- DUMP2("DoOneEvent(2) abnormal exit!! %d",
- rbtk_eventloop_depth);
- return 0;
- }
-
- DUMP1("trap check");
- if (rb_trap_pending) {
- run_timer_flag = 0;
- if (rb_prohibit_interrupt || check_var != (int*)NULL) {
- /* pending or on wait command */
- return 0;
- } else {
- rb_trap_exec();
- }
- }
-
- if (check_var != (int*)NULL
- && !NIL_P(rbtk_pending_exception)) {
- DUMP1("exception on wait");
- return 0;
- }
-
- if (pending_exception_check0()) {
- /* pending -> upper level */
+ if (Tcl_DoOneEvent(event_flag)) {
+ tick_counter++;
+ } else {
+ if (update_flag != 0) {
+ DUMP1("update complete");
return 0;
}
-
- if (st) {
- tick_counter++;
- } else {
- if (update_flag != 0) {
- DUMP1("update complete");
- return 0;
- }
-
- tick_counter += no_event_tick;
-
- /* rb_thread_wait_for(t); */
- rb_protect(eventloop_sleep, Qnil, &status);
-
- if (status) {
- switch (status) {
- case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception
- = rb_exc_new2(rb_eException,
- "unknown exception");
- } else {
- rbtk_pending_exception = ruby_errinfo;
-
- if (!NIL_P(rbtk_pending_exception)) {
- if (rbtk_eventloop_depth == 0) {
- VALUE exc = rbtk_pending_exception;
- rbtk_pending_exception = Qnil;
- rb_exc_raise(exc);
- } else {
- return 0;
- }
- }
- }
- break;
-
- case TAG_FATAL:
- if (NIL_P(ruby_errinfo)) {
- rb_exc_raise(rb_exc_new2(rb_eFatal,
- "FATAL"));
- } else {
- rb_exc_raise(ruby_errinfo);
- }
- }
- }
- }
-
- } else {
- DUMP2("sleep eventloop %lx", current);
- DUMP2("eventloop thread is %lx", eventloop_thread);
- rb_thread_stop();
+ tick_counter += no_event_tick;
+ rb_thread_wait_for(t);
}
- if (!NIL_P(watchdog_thread) && eventloop_thread != current) {
+ if (watchdog_thread != 0 && eventloop_thread != current) {
return 1;
}
- DUMP1("trap check");
- if (rb_trap_pending) {
- run_timer_flag = 0;
- if (rb_prohibit_interrupt || check_var != (int*)NULL) {
- /* pending or on wait command */
- return 0;
- } else {
- rb_trap_exec();
- }
- }
-
DUMP1("check Root Widget");
- if (check_root && tk_stubs_init_p() && Tk_GetNumMainWindows() == 0) {
+ if (check_root && Tk_GetNumMainWindows() == 0) {
run_timer_flag = 0;
- if (rb_trap_pending) {
- if (rb_prohibit_interrupt || check_var != (int*)NULL) {
- /* pending or on wait command */
- return 0;
- } else {
- rb_trap_exec();
- }
+ if (!rb_prohibit_interrupt) {
+ if (rb_trap_pending) rb_trap_exec();
}
return 1;
}
+ DUMP1("trap check");
+ if (!rb_prohibit_interrupt) {
+ if (rb_trap_pending) rb_trap_exec();
+ }
+
if (loop_counter++ > 30000) {
/* fprintf(stderr, "loop_counter > 30000\n"); */
loop_counter = 0;
@@ -1628,27 +777,13 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
return 1;
}
-
-struct evloop_params {
- int check_root;
- int update_flag;
- int *check_var;
- Tcl_Interp *interp;
- int thr_crit_bup;
-};
-
VALUE
-lib_eventloop_main_core(args)
- VALUE args;
+lib_eventloop_main(check_rootwidget)
+ VALUE check_rootwidget;
{
- struct evloop_params *params = (struct evloop_params *)args;
+ check_rootwidget_flag = RTEST(check_rootwidget);
- check_rootwidget_flag = params->check_root;
-
- if (lib_eventloop_core(params->check_root,
- params->update_flag,
- params->check_var,
- params->interp)) {
+ if (lib_eventloop_core(check_rootwidget_flag, 0, (int *)NULL)) {
return Qtrue;
} else {
return Qfalse;
@@ -1656,139 +791,35 @@ lib_eventloop_main_core(args)
}
VALUE
-lib_eventloop_main(args)
- VALUE args;
+lib_eventloop_ensure(parent_evloop)
+ VALUE parent_evloop;
{
- return lib_eventloop_main_core(args);
-
-#if 0
- volatile VALUE ret;
- int status = 0;
-
- ret = rb_protect(lib_eventloop_main_core, args, &status);
-
- switch (status) {
- case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception
- = rb_exc_new2(rb_eException, "unknown exception");
- } else {
- rbtk_pending_exception = ruby_errinfo;
- }
- return Qnil;
-
- case TAG_FATAL:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL");
- } else {
- rbtk_pending_exception = ruby_errinfo;
- }
- return Qnil;
+ Tk_DeleteTimerHandler(timer_token);
+ timer_token = (Tcl_TimerToken)NULL;
+ DUMP2("eventloop-ensure: current-thread : %lx\n", rb_thread_current());
+ DUMP2("eventloop-ensure: eventloop-thread : %lx\n", eventloop_thread);
+ if (eventloop_thread == rb_thread_current()) {
+ DUMP2("eventloop-thread -> %lx\n", parent_evloop);
+ eventloop_thread = parent_evloop;
}
-
- return ret;
-#endif
-}
-
-VALUE
-lib_eventloop_ensure(args)
- VALUE args;
-{
- struct evloop_params *ptr = (struct evloop_params *)args;
- volatile VALUE current_evloop = rb_thread_current();
-
- DUMP2("eventloop_ensure: current-thread : %lx", current_evloop);
- DUMP2("eventloop_ensure: eventloop-thread : %lx", eventloop_thread);
- if (eventloop_thread != current_evloop) {
- DUMP2("finish eventloop %lx (NOT current eventloop)", current_evloop);
-
- rb_thread_critical = ptr->thr_crit_bup;
-
- free(ptr);
-
- return Qnil;
- }
-
- while((eventloop_thread = rb_ary_pop(eventloop_stack))) {
- DUMP2("eventloop-ensure: new eventloop-thread -> %lx",
- eventloop_thread);
-
- if (eventloop_thread == current_evloop) {
- rbtk_eventloop_depth--;
- DUMP2("eventloop %lx : back from recursive call", current_evloop);
- break;
- }
-
- if (NIL_P(eventloop_thread)) {
- Tcl_DeleteTimerHandler(timer_token);
- timer_token = (Tcl_TimerToken)NULL;
-
- break;
- }
-
- if (RTEST(rb_funcall(eventloop_thread, ID_alive_p, 0, 0))) {
- DUMP2("eventloop-enshure: wake up parent %lx", eventloop_thread);
- rb_thread_wakeup(eventloop_thread);
-
- break;
- }
- }
-
- rb_thread_critical = ptr->thr_crit_bup;
-
- free(ptr);
-
- DUMP2("finish current eventloop %lx", current_evloop);
return Qnil;
}
static VALUE
-lib_eventloop_launcher(check_root, update_flag, check_var, interp)
- int check_root;
- int update_flag;
- int *check_var;
- Tcl_Interp *interp;
+lib_eventloop_launcher(check_rootwidget)
+ VALUE check_rootwidget;
{
- volatile VALUE parent_evloop = eventloop_thread;
- struct evloop_params *args = ALLOC(struct evloop_params);
-
- tcl_stubs_check();
+ VALUE parent_evloop = eventloop_thread;
eventloop_thread = rb_thread_current();
- if (parent_evloop == eventloop_thread) {
- DUMP2("eventloop: recursive call on %lx", parent_evloop);
- rbtk_eventloop_depth++;
- }
-
- if (!NIL_P(parent_evloop) && parent_evloop != eventloop_thread) {
- DUMP2("wait for stop of parent_evloop %lx", parent_evloop);
- while(!RTEST(rb_funcall(parent_evloop, ID_stop_p, 0))) {
- DUMP2("parent_evloop %lx doesn't stop", parent_evloop);
- rb_thread_run(parent_evloop);
- }
- DUMP1("succeed to stop parent");
- }
-
- rb_ary_push(eventloop_stack, parent_evloop);
-
- DUMP3("tcltklib: eventloop-thread : %lx -> %lx\n",
+ if (ruby_debug) {
+ fprintf(stderr, "tcltklib: eventloop-thread : %lx -> %lx\n",
parent_evloop, eventloop_thread);
+ }
- args->check_root = check_root;
- args->update_flag = update_flag;
- args->check_var = check_var;
- args->interp = interp;
- args->thr_crit_bup = rb_thread_critical;
-
- rb_thread_critical = Qfalse;
-
-#if 0
- return rb_ensure(lib_eventloop_main, (VALUE)args,
- lib_eventloop_ensure, (VALUE)args);
-#endif
- return rb_ensure(lib_eventloop_main_core, (VALUE)args,
- lib_eventloop_ensure, (VALUE)args);
+ return rb_ensure(lib_eventloop_main, check_rootwidget,
+ lib_eventloop_ensure, parent_evloop);
}
/* execute Tk_MainLoop */
@@ -1808,8 +839,7 @@ lib_mainloop(argc, argv, self)
check_rootwidget = Qfalse;
}
- return lib_eventloop_launcher(RTEST(check_rootwidget), 0,
- (int*)NULL, (Tcl_Interp*)NULL);
+ return lib_eventloop_launcher(check_rootwidget);
}
static VALUE
@@ -1821,7 +851,8 @@ ip_mainloop(argc, argv, self)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return Qnil;
}
@@ -1832,18 +863,7 @@ ip_mainloop(argc, argv, self)
return lib_mainloop(argc, argv, self);
}
-
-static VALUE
-watchdog_evloop_launcher(check_rootwidget)
- VALUE check_rootwidget;
-{
- return lib_eventloop_launcher(RTEST(check_rootwidget), 0,
- (int*)NULL, (Tcl_Interp*)NULL);
-}
-
-#define EVLOOP_WAKEUP_CHANCE 3
-
-static VALUE
+VALUE
lib_watchdog_core(check_rootwidget)
VALUE check_rootwidget;
{
@@ -1859,7 +879,7 @@ lib_watchdog_core(check_rootwidget)
t1.tv_usec = (time_t)((WATCHDOG_INTERVAL)*1000.0);
/* check other watchdog thread */
- if (!NIL_P(watchdog_thread)) {
+ if (watchdog_thread != 0) {
if (RTEST(rb_funcall(watchdog_thread, ID_stop_p, 0))) {
rb_funcall(watchdog_thread, ID_kill, 0);
} else {
@@ -1870,24 +890,23 @@ lib_watchdog_core(check_rootwidget)
/* watchdog start */
do {
- if (NIL_P(eventloop_thread)
- || (loop_counter == prev_val && chance >= EVLOOP_WAKEUP_CHANCE)) {
+ if (eventloop_thread == 0
+ || (loop_counter == prev_val
+ && RTEST(rb_funcall(eventloop_thread, ID_stop_p, 0))
+ && ++chance >= 3 )
+ ) {
/* start new eventloop thread */
DUMP2("eventloop thread %lx is sleeping or dead",
eventloop_thread);
- evloop = rb_thread_create(watchdog_evloop_launcher,
+ evloop = rb_thread_create(lib_eventloop_launcher,
(void*)&check_rootwidget);
DUMP2("create new eventloop thread %lx", evloop);
loop_counter = -1;
chance = 0;
rb_thread_run(evloop);
} else {
- prev_val = loop_counter;
- if (RTEST(rb_funcall(eventloop_thread, ID_stop_p, 0))) {
- ++chance;
- } else {
- chance = 0;
- }
+ loop_counter = prev_val;
+ chance = 0;
if (event_loop_wait_event) {
rb_thread_wait_for(t0);
} else {
@@ -1895,7 +914,7 @@ lib_watchdog_core(check_rootwidget)
}
/* rb_thread_schedule(); */
}
- } while(!check || !tk_stubs_init_p() || Tk_GetNumMainWindows() != 0);
+ } while(!check || Tk_GetNumMainWindows() != 0);
return Qnil;
}
@@ -1904,7 +923,7 @@ VALUE
lib_watchdog_ensure(arg)
VALUE arg;
{
- eventloop_thread = Qnil; /* stop eventloops */
+ eventloop_thread = 0; /* stop eventloops */
return Qnil;
}
@@ -1937,7 +956,8 @@ ip_mainloop_watchdog(argc, argv, self)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return Qnil;
}
@@ -1948,108 +968,6 @@ ip_mainloop_watchdog(argc, argv, self)
return lib_mainloop_watchdog(argc, argv, self);
}
-
-/* thread-safe(?) interaction between Ruby and Tk */
-struct thread_call_proc_arg {
- VALUE proc;
- int *done;
-};
-
-void
-_thread_call_proc_arg_mark(struct thread_call_proc_arg *q)
-{
- rb_gc_mark(q->proc);
-}
-
-static VALUE
-_thread_call_proc_core(arg)
- VALUE arg;
-{
- struct thread_call_proc_arg *q = (struct thread_call_proc_arg*)arg;
- return rb_funcall(q->proc, ID_call, 0);
-}
-
-static VALUE
-_thread_call_proc_ensure(arg)
- VALUE arg;
-{
- struct thread_call_proc_arg *q = (struct thread_call_proc_arg*)arg;
- *(q->done) = 1;
- return Qnil;
-}
-
-static VALUE
-_thread_call_proc(arg)
- VALUE arg;
-{
- struct thread_call_proc_arg *q = (struct thread_call_proc_arg*)arg;
-
- return rb_ensure(_thread_call_proc_core, (VALUE)q,
- _thread_call_proc_ensure, (VALUE)q);
-}
-
-static VALUE
-_thread_call_proc_value(th)
- VALUE th;
-{
- return rb_funcall(th, ID_value, 0);
-}
-
-static VALUE
-lib_thread_callback(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
-{
- struct thread_call_proc_arg *q;
- VALUE proc, th, ret;
- int status, foundEvent;
-
- if (rb_scan_args(argc, argv, "01", &proc) == 0) {
- proc = rb_block_proc();
- }
-
- q = (struct thread_call_proc_arg *)ALLOC(struct thread_call_proc_arg);
- q->proc = proc;
- q->done = (int*)ALLOC(int);
- *(q->done) = 0;
-
- /* create call-proc thread */
- th = rb_thread_create(_thread_call_proc, (void*)q);
-
- rb_thread_schedule();
-
- /* start sub-eventloop */
- foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0,
- q->done, (Tcl_Interp*)NULL));
-
- if (RTEST(rb_funcall(th, ID_alive_p, 0))) {
- rb_funcall(th, ID_kill, 0);
- ret = Qnil;
- } else {
- ret = rb_protect(_thread_call_proc_value, th, &status);
- }
-
- free(q->done);
- free(q);
-
- if (NIL_P(rbtk_pending_exception)) {
- /* return ruby_errinfo; */
- if (status) {
- rb_exc_raise(ruby_errinfo);
- }
- } else {
- VALUE exc = rbtk_pending_exception;
- rbtk_pending_exception = Qnil;
- /* return exc; */
- rb_exc_raise(exc);
- }
-
- return ret;
-}
-
-
-/* do_one_event */
static VALUE
lib_do_one_event_core(argc, argv, self, is_ip)
int argc;
@@ -2061,12 +979,6 @@ lib_do_one_event_core(argc, argv, self, is_ip)
int flags;
int found_event;
- if (!NIL_P(eventloop_thread)) {
- rb_raise(rb_eRuntimeError, "eventloop is already running");
- }
-
- tcl_stubs_check();
-
if (rb_scan_args(argc, argv, "01", &vflags) == 0) {
flags = TCL_ALL_EVENTS | TCL_DONT_WAIT;
} else {
@@ -2083,7 +995,8 @@ lib_do_one_event_core(argc, argv, self, is_ip)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return Qfalse;
}
@@ -2096,10 +1009,6 @@ lib_do_one_event_core(argc, argv, self, is_ip)
/* found_event = Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT); */
found_event = Tcl_DoOneEvent(flags);
- if (pending_exception_check0()) {
- return Qfalse;
- }
-
if (found_event) {
return Qtrue;
} else {
@@ -2145,12 +1054,14 @@ ip_set_exc_message(interp, exc)
rb_thread_critical = Qtrue;
msg = rb_funcall(exc, ID_message, 0, 0);
- StringValue(msg);
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
- enc = rb_attr_get(exc, ID_at_enc);
- if (NIL_P(enc)) {
- enc = rb_attr_get(msg, ID_at_enc);
+ enc = Qnil;
+ if (RTEST(rb_ivar_defined(exc, ID_at_enc))) {
+ enc = rb_ivar_get(exc, ID_at_enc);
+ }
+ if (NIL_P(enc) && RTEST(rb_ivar_defined(msg, ID_at_enc))) {
+ enc = rb_ivar_get(msg, ID_at_enc);
}
if (NIL_P(enc)) {
encoding = (Tcl_Encoding)NULL;
@@ -2163,7 +1074,7 @@ ip_set_exc_message(interp, exc)
/* to avoid a garbled error message dialog */
buf = ALLOC_N(char, (RSTRING(msg)->len)+1);
- memcpy(buf, RSTRING(msg)->ptr, RSTRING(msg)->len);
+ strncpy(buf, RSTRING(msg)->ptr, RSTRING(msg)->len);
buf[RSTRING(msg)->len] = 0;
Tcl_DStringInit(&dstr);
@@ -2172,7 +1083,6 @@ ip_set_exc_message(interp, exc)
Tcl_AppendResult(interp, Tcl_DStringValue(&dstr), (char*)NULL);
DUMP2("error message:%s", Tcl_DStringValue(&dstr));
- Tcl_DStringFree(&dstr);
free(buf);
#else /* TCL_VERSION <= 8.0 */
@@ -2211,88 +1121,130 @@ TkStringValue(obj)
return rb_funcall(obj, ID_inspect, 0, 0);
}
-static int
-tcl_protect_core(interp, proc, data) /* should not raise exception */
- Tcl_Interp *interp;
- VALUE (*proc)();
- VALUE data;
+/* Tcl command `ruby'|`ruby_eval' */
+static VALUE
+ip_ruby_eval_rescue(failed, einfo)
+ VALUE failed;
+ VALUE einfo;
{
- volatile VALUE ret, exc = Qnil;
+ DUMP1("call ip_ruby_eval_rescue");
+ RARRAY(failed)->ptr[0] = einfo;
+ return Qnil;
+}
+
+struct eval_body_arg {
+ char *string;
+ VALUE failed;
+};
+
+static VALUE
+ip_ruby_eval_body(arg)
+ struct eval_body_arg *arg;
+{
+ volatile VALUE ret;
int status = 0;
- int thr_crit_bup = rb_thread_critical;
+ int thr_crit_bup;
+
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ DUMP1("call ip_ruby_eval_body");
+ rb_trap_immediate = 0;
+
+#if 0
+ ret = rb_rescue2(rb_eval_string, (VALUE)arg->string,
+ ip_ruby_eval_rescue, arg->failed,
+ rb_eStandardError, rb_eScriptError, rb_eSystemExit,
+ (VALUE)0);
+#else
rb_thread_critical = Qfalse;
- ret = rb_protect(proc, data, &status);
+ ret = rb_eval_string_protect(arg->string, &status);
rb_thread_critical = Qtrue;
if (status) {
- char *buf;
- VALUE old_gc, type, str;
+ char *errtype, *buf;
+ int errtype_len, len;
+ VALUE old_gc;
old_gc = rb_gc_disable();
switch(status) {
case TAG_RETURN:
- type = eTkCallbackReturn;
- goto error;
+ errtype = "LocalJumpError: ";
+ errtype_len = strlen(errtype);
+ len = errtype_len + RSTRING(rb_obj_as_string(ruby_errinfo))->len;
+ buf = ALLOC_N(char, len + 1);
+ strncpy(buf, errtype, errtype_len);
+ strncpy(buf + errtype_len,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->ptr,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->len);
+ *(buf + len) = 0;
+
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(eTkCallbackReturn, buf);
+ free(buf);
+ break;
+
case TAG_BREAK:
- type = eTkCallbackBreak;
- goto error;
- case TAG_NEXT:
- type = eTkCallbackContinue;
- goto error;
- error:
- str = rb_str_new2("LocalJumpError: ");
- rb_str_append(str, rb_obj_as_string(ruby_errinfo));
- exc = rb_exc_new3(type, str);
+ errtype = "LocalJumpError: ";
+ errtype_len = strlen(errtype);
+ len = errtype_len + RSTRING(rb_obj_as_string(ruby_errinfo))->len;
+ buf = ALLOC_N(char, len + 1);
+ strncpy(buf, errtype, errtype_len);
+ strncpy(buf + errtype_len,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->ptr,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->len);
+ *(buf + len) = 0;
+
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(eTkCallbackBreak, buf);
+ free(buf);
break;
- case TAG_RETRY:
- if (NIL_P(ruby_errinfo)) {
- DUMP1("rb_protect: retry");
- exc = rb_exc_new2(eTkCallbackRetry, "retry jump error");
- } else {
- exc = ruby_errinfo;
- }
+ case TAG_NEXT:
+ errtype = "LocalJumpError: ";
+ errtype_len = strlen(errtype);
+ len = errtype_len + RSTRING(rb_obj_as_string(ruby_errinfo))->len;
+ buf = ALLOC_N(char, len + 1);
+ strncpy(buf, errtype, errtype_len);
+ strncpy(buf + errtype_len,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->ptr,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->len);
+ *(buf + len) = 0;
+
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(eTkCallbackContinue,buf);
+ free(buf);
break;
+ case TAG_RETRY:
case TAG_REDO:
if (NIL_P(ruby_errinfo)) {
- DUMP1("rb_protect: redo");
- exc = rb_exc_new2(eTkCallbackRedo, "redo jump error");
+ rb_jump_tag(status);
} else {
- exc = ruby_errinfo;
+ RARRAY(arg->failed)->ptr[0] = ruby_errinfo;
}
break;
case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- exc = rb_exc_new2(rb_eException, "unknown exception");
- } else {
- exc = ruby_errinfo;
- }
- break;
-
case TAG_FATAL:
if (NIL_P(ruby_errinfo)) {
- exc = rb_exc_new2(rb_eFatal, "FATAL");
+ RARRAY(arg->failed)->ptr[0]
+ = rb_exc_new2(rb_eException, "unknown exception");
} else {
- exc = ruby_errinfo;
+ RARRAY(arg->failed)->ptr[0] = ruby_errinfo;
}
break;
case TAG_THROW:
if (NIL_P(ruby_errinfo)) {
- DUMP1("rb_protect: throw");
- exc = rb_exc_new2(eTkCallbackThrow, "throw jump error");
+ rb_jump_tag(TAG_THROW);
} else {
- exc = ruby_errinfo;
+ RARRAY(arg->failed)->ptr[0] = ruby_errinfo;
}
break;
default:
buf = ALLOC_N(char, 256);
sprintf(buf, "unknown loncaljmp status %d", status);
- exc = rb_exc_new2(rb_eException, buf);
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(rb_eException, buf);
free(buf);
break;
}
@@ -2301,108 +1253,22 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
ret = Qnil;
}
+#endif
rb_thread_critical = thr_crit_bup;
- Tcl_ResetResult(interp);
-
- /* status check */
- if (!NIL_P(exc)) {
- volatile VALUE eclass = rb_obj_class(exc);
- volatile VALUE backtrace;
-
- DUMP1("(failed)");
-
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- DUMP1("set backtrace");
- if (!NIL_P(backtrace = rb_funcall(exc, ID_backtrace, 0, 0))) {
- backtrace = rb_ary_join(backtrace, rb_str_new2("\n"));
- Tcl_AddErrorInfo(interp, StringValuePtr(backtrace));
- }
-
- rb_thread_critical = thr_crit_bup;
-
- ip_set_exc_message(interp, exc);
-
- if (eclass == eTkCallbackReturn)
- return TCL_RETURN;
-
- if (eclass == eTkCallbackBreak)
- return TCL_BREAK;
-
- if (eclass == eTkCallbackContinue)
- return TCL_CONTINUE;
-
- if (eclass == rb_eSystemExit || eclass == rb_eInterrupt) {
- rbtk_pending_exception = exc;
- return TCL_RETURN;
- }
-
- if (rb_obj_is_kind_of(exc, eTkLocalJumpError)) {
- rbtk_pending_exception = exc;
- return TCL_ERROR;
- }
-
- if (rb_obj_is_kind_of(exc, eLocalJumpError)) {
- VALUE reason = rb_ivar_get(exc, ID_at_reason);
-
- if (TYPE(reason) == T_SYMBOL) {
- if (SYM2ID(reason) == ID_return)
- return TCL_RETURN;
-
- if (SYM2ID(reason) == ID_break)
- return TCL_BREAK;
-
- if (SYM2ID(reason) == ID_next)
- return TCL_CONTINUE;
- }
- }
-
- return TCL_ERROR;
- }
-
- /* result must be string or nil */
- if (!NIL_P(ret)) {
- /* copy result to the tcl interpreter */
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- ret = TkStringValue(ret);
- DUMP1("Tcl_AppendResult");
- Tcl_AppendResult(interp, RSTRING(ret)->ptr, (char *)NULL);
-
- rb_thread_critical = thr_crit_bup;
- }
-
- DUMP2("(result) %s", NIL_P(ret) ? "nil" : RSTRING(ret)->ptr);
-
- return TCL_OK;
+ return ret;
}
-static int
-tcl_protect(interp, proc, data)
- Tcl_Interp *interp;
- VALUE (*proc)();
- VALUE data;
+static VALUE
+ip_ruby_eval_ensure(trapflag)
+ VALUE trapflag;
{
- int old_trapflag = rb_trap_immediate;
- int code;
-
-#ifdef HAVE_NATIVETHREAD
- if (!is_ruby_native_thread()) {
- rb_bug("cross-thread violation on tcl_protect()");
- }
-#endif
-
- rb_trap_immediate = 0;
- code = tcl_protect_core(interp, proc, data);
- rb_trap_immediate = old_trapflag;
-
- return code;
+ rb_trap_immediate = NUM2INT(trapflag);
+ return Qnil;
}
+
static int
#if TCL_MAJOR_VERSION >= 8
ip_ruby_eval(clientData, interp, argc, argv)
@@ -2418,33 +1284,21 @@ ip_ruby_eval(clientData, interp, argc, argv)
char *argv[];
#endif
{
- char *arg;
+ volatile VALUE res;
+ volatile VALUE exception = rb_ary_new2(1);
+ int old_trapflag;
+ struct eval_body_arg *arg;
int thr_crit_bup;
- int code;
-
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
/* ruby command has 1 arg. */
if (argc != 2) {
-#if 0
- rb_raise(rb_eArgError,
- "wrong number of arguments (%d for 1)", argc - 1);
-#else
- char buf[sizeof(int)*8 + 1];
- Tcl_ResetResult(interp);
- sprintf(buf, "%d", argc-1);
- Tcl_AppendResult(interp, "wrong number of arguments (",
- buf, " for 1)", (char *)NULL);
- rbtk_pending_exception = rb_exc_new2(rb_eArgError,
- Tcl_GetStringResult(interp));
- return TCL_ERROR;
-#endif
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
+ argc - 1);
}
+ /* allocate */
+ arg = ALLOC(struct eval_body_arg);
+
/* get C string from Tcl object */
#if TCL_MAJOR_VERSION >= 8
{
@@ -2455,31 +1309,158 @@ ip_ruby_eval(clientData, interp, argc, argv)
rb_thread_critical = Qtrue;
str = Tcl_GetStringFromObj(argv[1], &len);
- arg = ALLOC_N(char, len + 1);
- memcpy(arg, str, len);
- arg[len] = 0;
+ arg->string = ALLOC_N(char, len + 1);
+ strncpy(arg->string, str, len);
+ arg->string[len] = 0;
rb_thread_critical = thr_crit_bup;
}
#else /* TCL_MAJOR_VERSION < 8 */
- arg = argv[1];
+ arg->string = argv[1];
#endif
+ /* arg.failed = 0; */
+ RARRAY(exception)->ptr[0] = Qnil;
+ RARRAY(exception)->len = 1;
+ arg->failed = exception;
/* evaluate the argument string by ruby */
- DUMP2("rb_eval_string(%s)", arg);
-
- code = tcl_protect(interp, rb_eval_string, (VALUE)arg);
+ DUMP2("rb_eval_string(%s)", arg->string);
+ old_trapflag = rb_trap_immediate;
+#ifdef HAVE_NATIVETHREAD
+ if (!is_ruby_native_thread()) {
+ rb_bug("cross-thread violation on ip_ruby_eval()");
+ }
+#endif
+ res = rb_ensure(ip_ruby_eval_body, (VALUE)arg,
+ ip_ruby_eval_ensure, INT2FIX(old_trapflag));
#if TCL_MAJOR_VERSION >= 8
- free(arg);
+ free(arg->string);
#endif
- return code;
+ free(arg);
+
+ /* status check */
+ /* if (arg.failed) { */
+ if (!NIL_P(RARRAY(exception)->ptr[0])) {
+ VALUE eclass;
+ volatile VALUE bt_ary;
+ volatile VALUE backtrace;
+
+ DUMP1("(rb_eval_string result) failed");
+
+ Tcl_ResetResult(interp);
+
+ res = RARRAY(exception)->ptr[0];
+ eclass = rb_obj_class(res);
+
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ DUMP1("set backtrace");
+ if (!NIL_P(bt_ary = rb_funcall(res, ID_backtrace, 0, 0))) {
+ backtrace = rb_ary_join(bt_ary, rb_str_new2("\n"));
+ StringValue(backtrace);
+ Tcl_AddErrorInfo(interp, RSTRING(backtrace)->ptr);
+ }
+
+ rb_thread_critical = thr_crit_bup;
+
+ if (eclass == eTkCallbackReturn) {
+ ip_set_exc_message(interp, res);
+ return TCL_RETURN;
+
+ } else if (eclass == eTkCallbackBreak) {
+ ip_set_exc_message(interp, res);
+ return TCL_BREAK;
+
+ } else if (eclass == eTkCallbackContinue) {
+ ip_set_exc_message(interp, res);
+ return TCL_CONTINUE;
+
+ } else if (eclass == rb_eSystemExit) {
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ /* Tcl_Eval(interp, "destroy ."); */
+ if (Tk_GetNumMainWindows() > 0) {
+ Tk_Window main_win = Tk_MainWindow(interp);
+ if (main_win != (Tk_Window)NULL) {
+ Tk_DestroyWindow(main_win);
+ }
+ }
+
+ /* StringValue(res); */
+ res = rb_funcall(res, ID_message, 0, 0);
+
+ Tcl_AppendResult(interp, RSTRING(res)->ptr, (char*)NULL);
+
+ rb_thread_critical = thr_crit_bup;
+
+ rb_raise(rb_eSystemExit, RSTRING(res)->ptr);
+
+ } else if (rb_obj_is_kind_of(res, eLocalJumpError)) {
+ VALUE reason = rb_ivar_get(res, ID_at_reason);
+
+ if (TYPE(reason) != T_SYMBOL) {
+ ip_set_exc_message(interp, res);
+ return TCL_ERROR;
+ }
+
+ if (SYM2ID(reason) == ID_return) {
+ ip_set_exc_message(interp, res);
+ return TCL_RETURN;
+
+ } else if (SYM2ID(reason) == ID_break) {
+ ip_set_exc_message(interp, res);
+ return TCL_BREAK;
+
+ } else if (SYM2ID(reason) == ID_next) {
+ ip_set_exc_message(interp, res);
+ return TCL_CONTINUE;
+
+ } else {
+ ip_set_exc_message(interp, res);
+ return TCL_ERROR;
+ }
+ } else {
+ ip_set_exc_message(interp, res);
+ return TCL_ERROR;
+ }
+ }
+
+ /* result must be string or nil */
+ if (NIL_P(res)) {
+ DUMP1("(rb_eval_string result) nil");
+ Tcl_ResetResult(interp);
+ return TCL_OK;
+ }
+
+ /* copy result to the tcl interpreter */
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ res = TkStringValue(res);
+ DUMP2("(rb_eval_string result) %s", RSTRING(res)->ptr);
+ DUMP1("Tcl_AppendResult");
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, RSTRING(res)->ptr, (char *)NULL);
+
+ rb_thread_critical = thr_crit_bup;
+
+ return TCL_OK;
}
/* Tcl command `ruby_cmd' */
+struct cmd_body_arg {
+ VALUE receiver;
+ ID method;
+ VALUE args;
+ VALUE failed;
+};
+
static VALUE
ip_ruby_cmd_core(arg)
struct cmd_body_arg *arg;
@@ -2497,6 +1478,150 @@ ip_ruby_cmd_core(arg)
return ret;
}
+static VALUE
+ip_ruby_cmd_rescue(failed, einfo)
+ VALUE failed;
+ VALUE einfo;
+{
+ DUMP1("call ip_ruby_cmd_rescue");
+ RARRAY(failed)->ptr[0] = einfo;
+ return Qnil;
+}
+
+static VALUE
+ip_ruby_cmd_body(arg)
+ struct cmd_body_arg *arg;
+{
+ volatile VALUE ret;
+ int status = 0;
+ int thr_crit_bup;
+ VALUE old_gc;
+
+ volatile VALUE receiver = arg->receiver;
+ volatile VALUE args = arg->args;
+ volatile VALUE failed = arg->failed;
+
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ DUMP1("call ip_ruby_cmd_body");
+ rb_trap_immediate = 0;
+
+#if 0
+ ret = rb_rescue2(ip_ruby_cmd_core, (VALUE)arg,
+ ip_ruby_cmd_rescue, arg->failed,
+ rb_eStandardError, rb_eScriptError, rb_eSystemExit,
+ (VALUE)0);
+#else
+ ret = rb_protect(ip_ruby_cmd_core, (VALUE)arg, &status);
+
+ if (status) {
+ char *errtype, *buf;
+ int errtype_len, len;
+
+ old_gc = rb_gc_disable();
+
+ switch(status) {
+ case TAG_RETURN:
+ errtype = "LocalJumpError: ";
+ errtype_len = strlen(errtype);
+ len = errtype_len + RSTRING(rb_obj_as_string(ruby_errinfo))->len;
+ buf = ALLOC_N(char, len + 1);
+ strncpy(buf, errtype, errtype_len);
+ strncpy(buf + errtype_len,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->ptr,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->len);
+ *(buf + len) = 0;
+
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(eTkCallbackReturn, buf);
+ free(buf);
+ break;
+
+ case TAG_BREAK:
+ errtype = "LocalJumpError: ";
+ errtype_len = strlen(errtype);
+ len = errtype_len + RSTRING(rb_obj_as_string(ruby_errinfo))->len;
+ buf = ALLOC_N(char, len + 1);
+ strncpy(buf, errtype, errtype_len);
+ strncpy(buf + errtype_len,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->ptr,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->len);
+ *(buf + len) = 0;
+
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(eTkCallbackBreak, buf);
+ free(buf);
+ break;
+
+ case TAG_NEXT:
+ errtype = "LocalJumpError: ";
+ errtype_len = strlen(errtype);
+ len = errtype_len + RSTRING(rb_obj_as_string(ruby_errinfo))->len;
+ buf = ALLOC_N(char, len + 1);
+ strncpy(buf, errtype, errtype_len);
+ strncpy(buf + errtype_len,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->ptr,
+ RSTRING(rb_obj_as_string(ruby_errinfo))->len);
+ *(buf + len) = 0;
+
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(eTkCallbackContinue,buf);
+ free(buf);
+ break;
+
+ case TAG_RETRY:
+ case TAG_REDO:
+ if (NIL_P(ruby_errinfo)) {
+ rb_jump_tag(status);
+ } else {
+ RARRAY(arg->failed)->ptr[0] = ruby_errinfo;
+ }
+ break;
+
+ case TAG_RAISE:
+ case TAG_FATAL:
+ if (NIL_P(ruby_errinfo)) {
+ RARRAY(arg->failed)->ptr[0]
+ = rb_exc_new2(rb_eException, "unknown exception");
+ } else {
+ RARRAY(arg->failed)->ptr[0] = ruby_errinfo;
+ }
+ break;
+
+ case TAG_THROW:
+ if (NIL_P(ruby_errinfo)) {
+ rb_jump_tag(TAG_THROW);
+ } else {
+ RARRAY(arg->failed)->ptr[0] = ruby_errinfo;
+ }
+ break;
+
+ default:
+ buf = ALLOC_N(char, 256);
+ rb_warn(buf, "unknown loncaljmp status %d", status);
+ RARRAY(arg->failed)->ptr[0] = rb_exc_new2(rb_eException, buf);
+ free(buf);
+ break;
+ }
+
+ if (old_gc == Qfalse) rb_gc_enable();
+
+ ret = Qnil;
+ }
+#endif
+
+ rb_thread_critical = thr_crit_bup;
+ DUMP1("finish ip_ruby_cmd_body");
+
+ return ret;
+}
+
+static VALUE
+ip_ruby_cmd_ensure(trapflag)
+ VALUE trapflag;
+{
+ rb_trap_immediate = NUM2INT(trapflag);
+ return Qnil;
+}
+
/* ruby_cmd receiver method arg ... */
static int
#if TCL_MAJOR_VERSION >= 8
@@ -2513,33 +1638,21 @@ ip_ruby_cmd(clientData, interp, argc, argv)
char *argv[];
#endif
{
+ volatile VALUE res;
volatile VALUE receiver;
volatile ID method;
- volatile VALUE args;
+ volatile VALUE args = rb_ary_new2(argc - 2);
+ volatile VALUE exception = rb_ary_new2(1);
char *str;
int i;
int len;
+ int old_trapflag;
struct cmd_body_arg *arg;
int thr_crit_bup;
VALUE old_gc;
- int code;
-
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
if (argc < 3) {
-#if 0
rb_raise(rb_eArgError, "too few arguments");
-#else
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "too few arguments", (char *)NULL);
- rbtk_pending_exception = rb_exc_new2(rb_eArgError,
- Tcl_GetStringResult(interp));
- return TCL_ERROR;
-#endif
}
/* allocate */
@@ -2570,23 +1683,14 @@ ip_ruby_cmd(clientData, interp, argc, argv)
len = strlen(str);
buf = ALLOC_N(char, len + 2);
buf[0] = '$';
- memcpy(buf + 1, str, len);
+ strncpy(buf + 1, str, len);
buf[len + 1] = 0;
receiver = rb_gv_get(buf);
free(buf);
}
if (NIL_P(receiver)) {
-#if 0
- rb_raise(rb_eArgError,
- "unknown class/module/global-variable '%s'", str);
-#else
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "unknown class/module/global-variable '",
- str, "'", (char *)NULL);
- rbtk_pending_exception = rb_exc_new2(rb_eArgError,
- Tcl_GetStringResult(interp));
- return TCL_ERROR;
-#endif
+ rb_raise(rb_eArgError, "unknown class/module/global-variable '%s'",
+ str);
}
/* get metrhod */
@@ -2598,7 +1702,6 @@ ip_ruby_cmd(clientData, interp, argc, argv)
method = rb_intern(str);
/* get args */
- args = rb_ary_new2(argc - 2);
RARRAY(args)->len = 0;
for(i = 3; i < argc; i++) {
#if TCL_MAJOR_VERSION >= 8
@@ -2614,22 +1717,145 @@ ip_ruby_cmd(clientData, interp, argc, argv)
if (old_gc == Qfalse) rb_gc_enable();
rb_thread_critical = thr_crit_bup;
+ RARRAY(exception)->ptr[0] = Qnil;
+ RARRAY(exception)->len = 1;
+
arg->receiver = receiver;
arg->method = method;
arg->args = args;
+ arg->failed = exception;
/* evaluate the argument string by ruby */
- code = tcl_protect(interp, ip_ruby_cmd_core, (VALUE)arg);
+ old_trapflag = rb_trap_immediate;
+#ifdef HAVE_NATIVETHREAD
+ if (!is_ruby_native_thread()) {
+ rb_bug("cross-thread violation on ip_ruby_cmd()");
+ }
+#endif
+
+ res = rb_ensure(ip_ruby_cmd_body, (VALUE)arg,
+ ip_ruby_cmd_ensure, INT2FIX(old_trapflag));
free(arg);
- return code;
+ /* status check */
+ /* if (arg.failed) { */
+ if (!NIL_P(RARRAY(exception)->ptr[0])) {
+ VALUE eclass;
+ volatile VALUE bt_ary;
+ volatile VALUE backtrace;
+
+ DUMP1("(rb_eval_cmd result) failed");
+
+ Tcl_ResetResult(interp);
+
+ res = RARRAY(exception)->ptr[0];
+ eclass = rb_obj_class(res);
+
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ DUMP1("set backtrace");
+ if (!NIL_P(bt_ary = rb_funcall(res, ID_backtrace, 0, 0))) {
+ backtrace = rb_ary_join(bt_ary, rb_str_new2("\n"));
+ StringValue(backtrace);
+ Tcl_AddErrorInfo(interp, RSTRING(backtrace)->ptr);
+ }
+
+ rb_thread_critical = thr_crit_bup;
+
+ if (eclass == eTkCallbackReturn) {
+ ip_set_exc_message(interp, res);
+ return TCL_RETURN;
+
+ } else if (eclass == eTkCallbackBreak) {
+ ip_set_exc_message(interp, res);
+ return TCL_BREAK;
+
+ } else if (eclass == eTkCallbackContinue) {
+ ip_set_exc_message(interp, res);
+ return TCL_CONTINUE;
+
+ } else if (eclass == rb_eSystemExit) {
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ /* Tcl_Eval(interp, "destroy ."); */
+ if (Tk_GetNumMainWindows() > 0) {
+ Tk_Window main_win = Tk_MainWindow(interp);
+ if (main_win != (Tk_Window)NULL) {
+ Tk_DestroyWindow(main_win);
+ }
+ }
+
+ /* StringValue(res); */
+ res = rb_funcall(res, ID_message, 0, 0);
+
+ Tcl_AppendResult(interp, RSTRING(res)->ptr, (char*)NULL);
+
+ rb_thread_critical = thr_crit_bup;
+
+ rb_raise(rb_eSystemExit, RSTRING(res)->ptr);
+
+ } else if (rb_obj_is_kind_of(res, eLocalJumpError)) {
+ VALUE reason = rb_ivar_get(res, ID_at_reason);
+
+ if (TYPE(reason) != T_SYMBOL) {
+ ip_set_exc_message(interp, res);
+ return TCL_ERROR;
+ }
+
+ if (SYM2ID(reason) == ID_return) {
+ ip_set_exc_message(interp, res);
+ return TCL_RETURN;
+
+ } else if (SYM2ID(reason) == ID_break) {
+ ip_set_exc_message(interp, res);
+ return TCL_BREAK;
+
+ } else if (SYM2ID(reason) == ID_next) {
+ ip_set_exc_message(interp, res);
+ return TCL_CONTINUE;
+
+ } else {
+ ip_set_exc_message(interp, res);
+ return TCL_ERROR;
+ }
+ } else {
+ ip_set_exc_message(interp, res);
+ return TCL_ERROR;
+ }
+ }
+
+ /* result must be string or nil */
+ if (NIL_P(res)) {
+ DUMP1("(rb_eval_cmd result) nil");
+ Tcl_ResetResult(interp);
+ return TCL_OK;
+ }
+
+
+ /* copy result to the tcl interpreter */
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ old_gc = rb_gc_disable();
+
+ res = TkStringValue(res);
+
+ if (old_gc == Qfalse) rb_gc_enable();
+ DUMP2("(rb_eval_cmd result) '%s'", RSTRING(res)->ptr);
+ DUMP1("Tcl_AppendResult");
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, RSTRING(res)->ptr, (char *)NULL);
+
+ rb_thread_critical = thr_crit_bup;
+
+ DUMP1("end of ip_ruby_cmd");
+ return TCL_OK;
}
-/*****************************/
-/* relpace of 'exit' command */
-/*****************************/
static int
#if TCL_MAJOR_VERSION >= 8
ip_InterpExitObjCmd(clientData, interp, argc, argv)
@@ -2645,18 +1871,9 @@ ip_InterpExitCommand(clientData, interp, argc, argv)
char *argv[];
#endif
{
- DUMP1("start ip_InterpExitCommand");
- if (interp != (Tcl_Interp*)NULL
- && !Tcl_InterpDeleted(interp)
-#if TCL_NAMESPACE_DEBUG
- && !ip_null_namespace(interp)
-#endif
- ) {
- Tcl_ResetResult(interp);
- /* Tcl_Preserve(interp); */
- /* Tcl_Eval(interp, "interp eval {} {destroy .}; interp delete {}"); */
- ip_finalize(interp);
- Tcl_DeleteInterp(interp);
+ if (!Tcl_InterpDeleted(interp)) {
+ Tcl_Preserve(interp);
+ Tcl_Eval(interp, "interp eval {} {destroy .}; interp delete {}");
Tcl_Release(interp);
}
return TCL_OK;
@@ -2679,77 +1896,62 @@ ip_RubyExitCommand(clientData, interp, argc, argv)
{
int state;
char *cmd, *param;
-#if TCL_MAJOR_VERSION < 8
+
+#if TCL_MAJOR_VERSION >= 8
+ cmd = Tcl_GetString(argv[0]);
+
+#else /* TCL_MAJOR_VERSION < 8 */
char *endptr;
cmd = argv[0];
#endif
- DUMP1("start ip_RubyExitCommand");
-
-#if TCL_MAJOR_VERSION >= 8
- /* cmd = Tcl_GetString(argv[0]); */
- cmd = Tcl_GetStringFromObj(argv[0], (int*)NULL);
+ if (rb_safe_level() >= 4) {
+ rb_raise(rb_eSecurityError,
+ "Insecure operation `exit' at level %d",
+ rb_safe_level());
+ } else if (Tcl_IsSafe(interp)) {
+ rb_raise(rb_eSecurityError,
+ "Insecure operation `exit' on a safe interpreter");
+#if 0
+ } else if (Tcl_GetMaster(interp) != (Tcl_Interp *)NULL) {
+ Tcl_Preserve(interp);
+ Tcl_Eval(interp, "interp eval {} {destroy .}");
+ Tcl_Eval(interp, "interp delete {}");
+ Tcl_Release(interp);
+ return TCL_OK;
#endif
-
- if (argc < 1 || argc > 2) {
- /* arguemnt error */
- Tcl_AppendResult(interp,
- "wrong number of arguments: should be \"",
- cmd, " ?returnCode?\"", (char *)NULL);
- return TCL_ERROR;
}
- if (interp == (Tcl_Interp*)NULL) return TCL_OK;
-
Tcl_ResetResult(interp);
- if (rb_safe_level() >= 4 || Tcl_IsSafe(interp)) {
- ip_finalize(interp);
- Tcl_DeleteInterp(interp);
- Tcl_Release(interp);
- return TCL_OK;
- }
-
switch(argc) {
case 1:
- /* rb_exit(0); */ /* not return if succeed */
+ rb_exit(0); /* not return if succeed */
+
Tcl_AppendResult(interp,
"fail to call \"", cmd, "\"", (char *)NULL);
-
- rbtk_pending_exception = rb_exc_new2(rb_eSystemExit,
- Tcl_GetStringResult(interp));
- rb_iv_set(rbtk_pending_exception, "status", INT2FIX(0));
-
- return TCL_RETURN;
+ return TCL_ERROR;
case 2:
#if TCL_MAJOR_VERSION >= 8
- if (Tcl_GetIntFromObj(interp, argv[1], &state) == TCL_ERROR) {
+ if (!Tcl_GetIntFromObj(interp, argv[1], &state)) {
return TCL_ERROR;
}
- /* param = Tcl_GetString(argv[1]); */
- param = Tcl_GetStringFromObj(argv[1], (int*)NULL);
+ param = Tcl_GetString(argv[1]);
#else /* TCL_MAJOR_VERSION < 8 */
state = (int)strtol(argv[1], &endptr, 0);
- if (*endptr) {
+ if (endptr) {
Tcl_AppendResult(interp,
"expected integer but got \"",
argv[1], "\"", (char *)NULL);
- return TCL_ERROR;
}
param = argv[1];
#endif
- /* rb_exit(state); */ /* not return if succeed */
+ rb_exit(state); /* not return if succeed */
Tcl_AppendResult(interp, "fail to call \"", cmd, " ",
param, "\"", (char *)NULL);
-
- rbtk_pending_exception = rb_exc_new2(rb_eSystemExit,
- Tcl_GetStringResult(interp));
- rb_iv_set(rbtk_pending_exception, "status", INT2FIX(state));
-
- return TCL_RETURN;
-
+ return TCL_ERROR;
default:
/* arguemnt error */
Tcl_AppendResult(interp,
@@ -2764,6 +1966,13 @@ ip_RubyExitCommand(clientData, interp, argc, argv)
/* based on tclEvent.c */
/**************************/
+#if 0 /*
+ Disable the following "update" and "thread_update". Bcause,
+ they don't work in a callback-proc. After calling update in
+ a callback-proc, the callback proc never be worked.
+ If the problem will be fixed in the future, may enable the
+ functions.
+ */
/*********************/
/* replace of update */
/*********************/
@@ -2787,55 +1996,36 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
#endif
{
int optionIndex;
- int ret;
+ int ret, done;
int flags = 0;
static CONST char *updateOptions[] = {"idletasks", (char *) NULL};
enum updateOptions {REGEXP_IDLETASKS};
+ char *nameString;
+ int dummy;
DUMP1("Ruby's 'update' is called");
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
-#ifdef HAVE_NATIVETHREAD
- if (!is_ruby_native_thread()) {
- rb_bug("cross-thread violation on ip_ruby_eval()");
- }
-#endif
-
if (objc == 1) {
- flags = TCL_DONT_WAIT;
+ flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
} else if (objc == 2) {
-#if TCL_MAJOR_VERSION >= 8
- if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
+ if (Tcl_GetIndexFromObj(interp, objv[1], updateOptions,
"option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum updateOptions) optionIndex) {
case REGEXP_IDLETASKS: {
- flags = TCL_IDLE_EVENTS;
+ flags = TCL_WINDOW_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT;
break;
}
default: {
- rb_bug("ip_rbUpdateObjCmd: bad option index to UpdateOptions");
+ Tcl_Panic("ip_rbUpdateObjCmd: bad option index to UpdateOptions");
}
}
-#else
- if (strncmp(objv[1], "idletasks", strlen(objv[1])) != 0) {
- Tcl_AppendResult(interp, "bad option \"", objv[1],
- "\": must be idletasks", (char *) NULL);
- return TCL_ERROR;
- }
- flags = TCL_IDLE_EVENTS;
-#endif
} else {
#ifdef Tcl_WrongNumArgs
Tcl_WrongNumArgs(interp, 1, objv, "[ idletasks ]");
#else
# if TCL_MAJOR_VERSION >= 8
- int dummy;
Tcl_AppendResult(interp, "wrong number of arguments: should be \"",
Tcl_GetStringFromObj(objv[0], &dummy),
" [ idletasks ]\"",
@@ -2848,33 +2038,12 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
return TCL_ERROR;
}
- Tcl_Preserve(interp);
-
/* call eventloop */
- /* ret = lib_eventloop_core(0, flags, (int *)NULL);*/ /* ignore result */
- ret = RTEST(lib_eventloop_launcher(0, flags, (int *)NULL, interp)); /* ignore result */
-
- /* exception check */
- if (!NIL_P(rbtk_pending_exception)) {
- Tcl_Release(interp);
-
- /*
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)) {
- */
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)
- || rb_obj_is_kind_of(rbtk_pending_exception, rb_eInterrupt)) {
- return TCL_RETURN;
- } else{
- return TCL_ERROR;
- }
- }
-
- /* trap check */
- if (rb_trap_pending) {
- Tcl_Release(interp);
-
- return TCL_RETURN;
- }
+#if 1
+ ret = lib_eventloop_core(0, flags, (int *)NULL); /* ignore result */
+#else
+ Tcl_UpdateObjCmd(clientData, interp, objc, objv);
+#endif
/*
* Must clear the interpreter's result because event handlers could
@@ -2883,8 +2052,6 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
DUMP2("last result '%s'", Tcl_GetStringResult(interp));
Tcl_ResetResult(interp);
- Tcl_Release(interp);
-
DUMP1("finish Ruby's 'update'");
return TCL_OK;
}
@@ -2933,69 +2100,61 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
#endif
{
int optionIndex;
+ int ret, done;
int flags = 0;
+ int dummy;
struct th_update_param *param;
static CONST char *updateOptions[] = {"idletasks", (char *) NULL};
enum updateOptions {REGEXP_IDLETASKS};
volatile VALUE current_thread = rb_thread_current();
DUMP1("Ruby's 'thread_update' is called");
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
-#ifdef HAVE_NATIVETHREAD
- if (!is_ruby_native_thread()) {
- rb_bug("cross-thread violation on ip_ruby_eval()");
- }
-#endif
- if (rb_thread_alone()
- || NIL_P(eventloop_thread) || eventloop_thread == current_thread) {
+ if (rb_thread_alone() || eventloop_thread == current_thread) {
+#define USE_TCL_UPDATE 0
#if TCL_MAJOR_VERSION >= 8
+# if USE_TCL_UPDATE
+ DUMP1("call Tcl_UpdateObjCmd");
+ return Tcl_UpdateObjCmd(clientData, interp, objc, objv);
+# else
DUMP1("call ip_rbUpdateObjCmd");
return ip_rbUpdateObjCmd(clientData, interp, objc, objv);
+# endif
#else /* TCL_MAJOR_VERSION < 8 */
+# if USE_TCL_UPDATE
+ DUMP1("call ip_rbUpdateCommand");
+ return Tcl_UpdateCommand(clientData, interp, objc, objv);
+# else
DUMP1("call ip_rbUpdateCommand");
return ip_rbUpdateCommand(clientData, interp, objc, objv);
+# endif
#endif
}
DUMP1("start Ruby's 'thread_update' body");
if (objc == 1) {
- flags = TCL_DONT_WAIT;
+ flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
} else if (objc == 2) {
-#if TCL_MAJOR_VERSION >= 8
- if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
+ if (Tcl_GetIndexFromObj(interp, objv[1], updateOptions,
"option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum updateOptions) optionIndex) {
case REGEXP_IDLETASKS: {
- flags = TCL_IDLE_EVENTS;
+ flags = TCL_WINDOW_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT;
break;
}
default: {
- rb_bug("ip_rb_threadUpdateObjCmd: bad option index to UpdateOptions");
+ Tcl_Panic("ip_rb_threadUpdateObjCmd: bad option index to UpdateOptions");
}
}
-#else
- if (strncmp(objv[1], "idletasks", strlen(objv[1])) != 0) {
- Tcl_AppendResult(interp, "bad option \"", objv[1],
- "\": must be idletasks", (char *) NULL);
- return TCL_ERROR;
- }
- flags = TCL_IDLE_EVENTS;
-#endif
} else {
#ifdef Tcl_WrongNumArgs
Tcl_WrongNumArgs(interp, 1, objv, "[ idletasks ]");
#else
# if TCL_MAJOR_VERSION >= 8
- int dummy;
Tcl_AppendResult(interp, "wrong number of arguments: should be \"",
Tcl_GetStringFromObj(objv[0], &dummy),
" [ idletasks ]\"",
@@ -3029,30 +2188,13 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
DUMP1("finish Ruby's 'thread_update'");
return TCL_OK;
}
+#endif /* update and thread_update don't work */
/***************************/
/* replace of vwait/tkwait */
/***************************/
#if TCL_MAJOR_VERSION >= 8
-static int ip_rbVwaitObjCmd _((ClientData, Tcl_Interp *, int,
- Tcl_Obj *CONST []));
-static int ip_rb_threadVwaitObjCmd _((ClientData, Tcl_Interp *, int,
- Tcl_Obj *CONST []));
-static int ip_rbTkWaitObjCmd _((ClientData, Tcl_Interp *, int,
- Tcl_Obj *CONST []));
-static int ip_rb_threadTkWaitObjCmd _((ClientData, Tcl_Interp *, int,
- Tcl_Obj *CONST []));
-#else
-static int ip_rbVwaitCommand _((ClientData, Tcl_Interp *, int, char *[]));
-static int ip_rb_threadVwaitCommand _((ClientData, Tcl_Interp *, int,
- char *[]));
-static int ip_rbTkWaitCommand _((ClientData, Tcl_Interp *, int, char *[]));
-static int ip_rb_threadTkWaitCommand _((ClientData, Tcl_Interp *, int,
- char *[]));
-#endif
-
-#if TCL_MAJOR_VERSION >= 8
static char *VwaitVarProc _((ClientData, Tcl_Interp *,
CONST84 char *,CONST84 char *, int));
static char *
@@ -3080,6 +2222,8 @@ VwaitVarProc(clientData, interp, name1, name2, flags)
}
#if TCL_MAJOR_VERSION >= 8
+static int ip_rbVwaitObjCmd _((ClientData, Tcl_Interp *, int,
+ Tcl_Obj *CONST []));
static int
ip_rbVwaitObjCmd(clientData, interp, objc, objv)
ClientData clientData;
@@ -3087,6 +2231,7 @@ ip_rbVwaitObjCmd(clientData, interp, objc, objv)
int objc;
Tcl_Obj *CONST objv[];
#else /* TCL_MAJOR_VERSION < 8 */
+static int ip_rbVwaitCommand _((ClientData, Tcl_Interp *, int, char *[]));
static int
ip_rbVwaitCommand(clientData, interp, objc, objv)
ClientData clientData;
@@ -3101,32 +2246,7 @@ ip_rbVwaitCommand(clientData, interp, objc, objv)
int thr_crit_bup;
DUMP1("Ruby's 'vwait' is called");
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
-
-#if 0
- if (!rb_thread_alone()
- && eventloop_thread != Qnil
- && eventloop_thread != rb_thread_current()) {
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("call ip_rb_threadVwaitObjCmd");
- return ip_rb_threadVwaitObjCmd(clientData, interp, objc, objv);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("call ip_rb_threadVwaitCommand");
- return ip_rb_threadVwaitCommand(clientData, interp, objc, objv);
-#endif
- }
-#endif
-
Tcl_Preserve(interp);
-#ifdef HAVE_NATIVETHREAD
- if (!is_ruby_native_thread()) {
- rb_bug("cross-thread violation on ip_ruby_eval()");
- }
-#endif
if (objc != 2) {
#ifdef Tcl_WrongNumArgs
@@ -3182,11 +2302,8 @@ ip_rbVwaitCommand(clientData, interp, objc, objv)
Tcl_Release(interp);
return TCL_ERROR;
}
-
done = 0;
-
- foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0,
- 0, &done, interp));
+ foundEvent = lib_eventloop_core(/* not check root-widget */0, 0, &done);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -3197,34 +2314,6 @@ ip_rbVwaitCommand(clientData, interp, objc, objv)
rb_thread_critical = thr_crit_bup;
- /* exception check */
- if (!NIL_P(rbtk_pending_exception)) {
-#if TCL_MAJOR_VERSION >= 8
- Tcl_DecrRefCount(objv[1]);
-#endif
- Tcl_Release(interp);
-
-/*
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)) {
-*/
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)
- || rb_obj_is_kind_of(rbtk_pending_exception, rb_eInterrupt)) {
- return TCL_RETURN;
- } else{
- return TCL_ERROR;
- }
- }
-
- /* trap check */
- if (rb_trap_pending) {
-#if TCL_MAJOR_VERSION >= 8
- Tcl_DecrRefCount(objv[1]);
-#endif
- Tcl_Release(interp);
-
- return TCL_RETURN;
- }
-
/*
* Clear out the interpreter's result, since it may have been set
* by event handlers.
@@ -3316,6 +2405,8 @@ WaitWindowProc(clientData, eventPtr)
}
#if TCL_MAJOR_VERSION >= 8
+static int ip_rbTkWaitObjCmd _((ClientData, Tcl_Interp *, int,
+ Tcl_Obj *CONST []));
static int
ip_rbTkWaitObjCmd(clientData, interp, objc, objv)
ClientData clientData;
@@ -3323,6 +2414,7 @@ ip_rbTkWaitObjCmd(clientData, interp, objc, objv)
int objc;
Tcl_Obj *CONST objv[];
#else /* TCL_MAJOR_VERSION < 8 */
+static int ip_rbTkWaitCommand _((ClientData, Tcl_Interp *, int, char *[]));
static int
ip_rbTkWaitCommand(clientData, interp, objc, objv)
ClientData clientData;
@@ -3342,25 +2434,6 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
int thr_crit_bup;
DUMP1("Ruby's 'tkwait' is called");
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
-
-#if 0
- if (!rb_thread_alone()
- && eventloop_thread != Qnil
- && eventloop_thread != rb_thread_current()) {
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("call ip_rb_threadTkWaitObjCmd");
- return ip_rb_threadTkWaitObjCmd(clientData, interp, objc, objv);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("call ip_rb_threadTkWaitCommand");
- return ip_rb_threadTkWwaitCommand(clientData, interp, objc, objv);
-#endif
- }
-#endif
Tcl_Preserve(interp);
@@ -3470,10 +2543,8 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
Tcl_Release(interp);
return TCL_ERROR;
}
-
done = 0;
- /* lib_eventloop_core(check_rootwidget_flag, 0, &done); */
- lib_eventloop_launcher(check_rootwidget_flag, 0, &done, interp);
+ lib_eventloop_core(check_rootwidget_flag, 0, &done);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -3488,44 +2559,19 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
rb_thread_critical = thr_crit_bup;
- /* exception check */
- if (!NIL_P(rbtk_pending_exception)) {
- Tcl_Release(interp);
-
- /*
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)) {
- */
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)
- || rb_obj_is_kind_of(rbtk_pending_exception, rb_eInterrupt)) {
- return TCL_RETURN;
- } else{
- return TCL_ERROR;
- }
- }
-
- /* trap check */
- if (rb_trap_pending) {
- Tcl_Release(interp);
-
- return TCL_RETURN;
- }
-
break;
case TKWAIT_VISIBILITY:
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- if (!tk_stubs_init_p() || Tk_MainWindow(interp) == (Tk_Window)NULL) {
+ if (Tk_MainWindow(interp) == (Tk_Window)NULL) {
window = NULL;
} else {
window = Tk_NameToWindow(interp, nameString, tkwin);
}
if (window == NULL) {
- Tcl_AppendResult(interp, "tkwait: ",
- "no main-window (not Tk application?)",
- (char*)NULL);
rb_thread_critical = thr_crit_bup;
#if TCL_MAJOR_VERSION >= 8
Tcl_DecrRefCount(objv[2]);
@@ -3541,37 +2587,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
rb_thread_critical = thr_crit_bup;
done = 0;
- /* lib_eventloop_core(check_rootwidget_flag, 0, &done); */
- lib_eventloop_launcher(check_rootwidget_flag, 0, &done, interp);
-
- /* exception check */
- if (!NIL_P(rbtk_pending_exception)) {
-#if TCL_MAJOR_VERSION >= 8
- Tcl_DecrRefCount(objv[2]);
-#endif
- Tcl_Release(interp);
-
- /*
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)) {
- */
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)
- || rb_obj_is_kind_of(rbtk_pending_exception, rb_eInterrupt)) {
- return TCL_RETURN;
- } else{
- return TCL_ERROR;
- }
- }
-
- /* trap check */
- if (rb_trap_pending) {
-#if TCL_MAJOR_VERSION >= 8
- Tcl_DecrRefCount(objv[2]);
-#endif
- Tcl_Release(interp);
-
- return TCL_RETURN;
- }
-
+ lib_eventloop_core(check_rootwidget_flag, 0, &done);
if (done != 1) {
/*
* Note that we do not delete the event handler because it
@@ -3613,7 +2629,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- if (!tk_stubs_init_p() || Tk_MainWindow(interp) == (Tk_Window)NULL) {
+ if (Tk_MainWindow(interp) == (Tk_Window)NULL) {
window = NULL;
} else {
window = Tk_NameToWindow(interp, nameString, tkwin);
@@ -3624,9 +2640,6 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
#endif
if (window == NULL) {
- Tcl_AppendResult(interp, "tkwait: ",
- "no main-window (not Tk application?)",
- (char*)NULL);
rb_thread_critical = thr_crit_bup;
Tcl_Release(interp);
return TCL_ERROR;
@@ -3638,31 +2651,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
rb_thread_critical = thr_crit_bup;
done = 0;
- /* lib_eventloop_core(check_rootwidget_flag, 0, &done); */
- lib_eventloop_launcher(check_rootwidget_flag, 0, &done, interp);
-
- /* exception check */
- if (!NIL_P(rbtk_pending_exception)) {
- Tcl_Release(interp);
-
- /*
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)) {
- */
- if (rb_obj_is_kind_of(rbtk_pending_exception, rb_eSystemExit)
- || rb_obj_is_kind_of(rbtk_pending_exception, rb_eInterrupt)) {
- return TCL_RETURN;
- } else{
- return TCL_ERROR;
- }
- }
-
- /* trap check */
- if (rb_trap_pending) {
- Tcl_Release(interp);
-
- return TCL_RETURN;
- }
-
+ lib_eventloop_core(check_rootwidget_flag, 0, &done);
/*
* Note: there's no need to delete the event handler. It was
* deleted automatically when the window was destroyed.
@@ -3757,6 +2746,8 @@ rb_threadWaitWindowProc(clientData, eventPtr)
}
#if TCL_MAJOR_VERSION >= 8
+static int ip_rb_threadVwaitObjCmd _((ClientData, Tcl_Interp *, int,
+ Tcl_Obj *CONST []));
static int
ip_rb_threadVwaitObjCmd(clientData, interp, objc, objv)
ClientData clientData;
@@ -3764,6 +2755,8 @@ ip_rb_threadVwaitObjCmd(clientData, interp, objc, objv)
int objc;
Tcl_Obj *CONST objv[];
#else /* TCL_MAJOR_VERSION < 8 */
+static int ip_rb_threadVwaitCommand _((ClientData, Tcl_Interp *, int,
+ char *[]));
static int
ip_rb_threadVwaitCommand(clientData, interp, objc, objv)
ClientData clientData;
@@ -3779,11 +2772,6 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv)
volatile VALUE current_thread = rb_thread_current();
DUMP1("Ruby's 'thread_vwait' is called");
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
if (rb_thread_alone() || eventloop_thread == current_thread) {
#if TCL_MAJOR_VERSION >= 8
@@ -3849,9 +2837,6 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv)
rb_thread_critical = thr_crit_bup;
if (ret != TCL_OK) {
- Tcl_Release(param);
- Tcl_Free((char *)param);
-
#if TCL_MAJOR_VERSION >= 8
Tcl_DecrRefCount(objv[1]);
#endif
@@ -3886,6 +2871,8 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv)
}
#if TCL_MAJOR_VERSION >= 8
+static int ip_rb_threadTkWaitObjCmd _((ClientData, Tcl_Interp *, int,
+ Tcl_Obj *CONST []));
static int
ip_rb_threadTkWaitObjCmd(clientData, interp, objc, objv)
ClientData clientData;
@@ -3893,6 +2880,8 @@ ip_rb_threadTkWaitObjCmd(clientData, interp, objc, objv)
int objc;
Tcl_Obj *CONST objv[];
#else /* TCL_MAJOR_VERSION < 8 */
+static int ip_rb_threadTkWaitCommand _((ClientData, Tcl_Interp *, int,
+ char *[]));
static int
ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
ClientData clientData;
@@ -3914,11 +2903,6 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
volatile VALUE current_thread = rb_thread_current();
DUMP1("Ruby's 'thread_tkwait' is called");
- if (interp == (Tcl_Interp*)NULL) {
- rbtk_pending_exception = rb_exc_new2(rb_eRuntimeError,
- "IP is deleted");
- return TCL_ERROR;
- }
if (rb_thread_alone() || eventloop_thread == current_thread) {
#if TCL_MAJOR_VERSION >= 8
@@ -4078,17 +3062,13 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- if (!tk_stubs_init_p() || Tk_MainWindow(interp) == (Tk_Window)NULL) {
+ if (Tk_MainWindow(interp) == (Tk_Window)NULL) {
window = NULL;
} else {
window = Tk_NameToWindow(interp, nameString, tkwin);
}
if (window == NULL) {
- Tcl_AppendResult(interp, "thread_tkwait: ",
- "no main-window (not Tk application?)",
- (char*)NULL);
-
rb_thread_critical = thr_crit_bup;
Tcl_Release(param);
@@ -4167,7 +3147,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- if (!tk_stubs_init_p() || Tk_MainWindow(interp) == (Tk_Window)NULL) {
+ if (Tk_MainWindow(interp) == (Tk_Window)NULL) {
window = NULL;
} else {
window = Tk_NameToWindow(interp, nameString, tkwin);
@@ -4178,10 +3158,6 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv)
#endif
if (window == NULL) {
- Tcl_AppendResult(interp, "thread_tkwait: ",
- "no main-window (not Tk application?)",
- (char*)NULL);
-
rb_thread_critical = thr_crit_bup;
Tcl_Release(param);
@@ -4249,7 +3225,6 @@ ip_thread_vwait(self, var)
argv[0] = cmd_str;
argv[1] = var;
-
return ip_invoke_real(2, argv, self);
}
@@ -4265,297 +3240,154 @@ ip_thread_tkwait(self, mode, target)
argv[0] = cmd_str;
argv[1] = mode;
argv[2] = target;
-
return ip_invoke_real(3, argv, self);
}
-
-/* delete slave interpreters */
-#if TCL_MAJOR_VERSION >= 8
-static void
-delete_slaves(ip)
+/* destroy interpreter */
+VALUE del_root(ip)
Tcl_Interp *ip;
{
- int thr_crit_bup;
- Tcl_Interp *slave;
- Tcl_Obj *slave_list, *elem;
- char *slave_name;
- int i, len;
-
- DUMP1("delete slaves");
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- if (!Tcl_InterpDeleted(ip) && Tcl_Eval(ip, "interp slaves") == TCL_OK) {
- slave_list = Tcl_GetObjResult(ip);
- Tcl_IncrRefCount(slave_list);
-
- if (Tcl_ListObjLength((Tcl_Interp*)NULL, slave_list, &len) == TCL_OK) {
- for(i = 0; i < len; i++) {
- Tcl_ListObjIndex((Tcl_Interp*)NULL, slave_list, i, &elem);
-
- if (elem == (Tcl_Obj*)NULL) continue;
-
- Tcl_IncrRefCount(elem);
-
- /* get slave */
- /* slave_name = Tcl_GetString(elem); */
- slave_name = Tcl_GetStringFromObj(elem, (int*)NULL);
- DUMP2("delete slave:'%s'", slave_name);
-
- Tcl_DecrRefCount(elem);
+ Tk_Window main_win;
- slave = Tcl_GetSlave(ip, slave_name);
- if (slave == (Tcl_Interp*)NULL) continue;
-
- /* call ip_finalize */
- ip_finalize(slave);
-
- Tcl_DeleteInterp(slave);
- /* Tcl_Release(slave); */
- }
+ if (!Tcl_InterpDeleted(ip)) {
+ Tcl_Preserve(ip);
+ while((main_win = Tk_MainWindow(ip)) != (Tk_Window)NULL) {
+ DUMP1("wait main_win is destroyed");
+ Tk_DestroyWindow(main_win);
}
-
- Tcl_DecrRefCount(slave_list);
+ Tcl_Release(ip);
}
-
- rb_thread_critical = thr_crit_bup;
+ return Qnil;
}
-#else /* TCL_MAJOR_VERSION < 8 */
+
+
static void
delete_slaves(ip)
Tcl_Interp *ip;
{
- int thr_crit_bup;
Tcl_Interp *slave;
- int argc;
- char **argv;
- char *slave_list;
+ Tcl_Obj *slave_list, *elem;
char *slave_name;
int i, len;
- DUMP1("delete slaves");
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- if (!Tcl_InterpDeleted(ip) && Tcl_Eval(ip, "interp slaves") == TCL_OK) {
- slave_list = ip->result;
- if (Tcl_SplitList((Tcl_Interp*)NULL,
- slave_list, &argc, &argv) == TCL_OK) {
- for(i = 0; i < argc; i++) {
- slave_name = argv[i];
-
- DUMP2("delete slave:'%s'", slave_name);
+ DUMP2("delete slaves of ip(%lx)", ip);
- slave = Tcl_GetSlave(ip, slave_name);
- if (slave == (Tcl_Interp*)NULL) continue;
-
- /* call ip_finalize */
- ip_finalize(slave);
+ Tcl_Preserve(ip);
- Tcl_DeleteInterp(slave);
- }
- }
+ if (Tcl_Eval(ip, "info slaves") == TCL_ERROR) {
+ DUMP2("ip(%lx) cannot get a list of slave IPs", ip);
+ return;
}
- rb_thread_critical = thr_crit_bup;
-}
-#endif
-
+ slave_list = Tcl_GetObjResult(ip);
+ Tcl_IncrRefCount(slave_list);
-/* finalize operation */
-static VALUE
-lib_mark_at_exit(self)
- VALUE self;
-{
- at_exit = 1;
- return Qnil;
-}
-
-static int
-#if TCL_MAJOR_VERSION >= 8
-ip_null_proc(clientData, interp, argc, argv)
- ClientData clientData;
- Tcl_Interp *interp;
- int argc;
- Tcl_Obj *CONST argv[];
-#else /* TCL_MAJOR_VERSION < 8 */
-ip_null_proc(clientData, interp, argc, argv)
- ClientData clientData;
- Tcl_Interp *interp;
- int argc;
- char *argv[];
-#endif
-{
- Tcl_ResetResult(interp);
- return TCL_OK;
-}
+ if (Tcl_ListObjLength((Tcl_Interp*)NULL, slave_list, &len) == TCL_ERROR) {
+ DUMP1("slave_list is not a list object");
+ Tcl_DecrRefCount(slave_list);
+ return;
+ }
-static void
-ip_finalize(ip)
- Tcl_Interp *ip;
-{
- Tcl_CmdInfo info;
- int thr_crit_bup;
+ for(i = 0; i < len; i++) {
+ Tcl_ListObjIndex((Tcl_Interp*)NULL, slave_list, i, &elem);
+ Tcl_IncrRefCount(elem);
- VALUE rb_debug_bup, rb_verbose_bup;
- /* When ruby is exiting, printing debug messages in some callback
- operations from Tcl-IP sometimes cause SEGV. I don't know the
- reason. But I got SEGV when calling "rb_io_write(rb_stdout, ...)".
- So, in some part of this function, debug mode and verbose mode
- are disabled. If you know the reason, please fix it.
- -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) */
+ if (elem == (Tcl_Obj*)NULL) continue;
- DUMP1("start ip_finalize");
+ /* get slave */
+ slave_name = Tcl_GetString(elem);
+ slave = Tcl_GetSlave(ip, slave_name);
+ if (slave == (Tcl_Interp*)NULL) {
+ DUMP2("slave \"%s\" does not exist", slave_name);
+ continue;
+ }
- if (ip == (Tcl_Interp*)NULL) {
- DUMP1("ip is NULL");
- return;
- }
+ Tcl_DecrRefCount(elem);
- if (Tcl_InterpDeleted(ip)) {
- DUMP2("ip(%lx) is already deleted", ip);
- return;
- }
+ Tcl_Preserve(slave);
-#if TCL_NAMESPACE_DEBUG
- if (ip_null_namespace(ip)) {
- DUMP2("ip(%lx) has null namespace", ip);
- return;
- }
+#if TCL_MAJOR_VERSION < 8 || ( TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4)
+#else
+ if (!Tcl_InterpDeleted(slave)) {
+ Tcl_Eval(slave, "foreach i [after info] { after cancel $i }");
+ }
#endif
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- rb_debug_bup = ruby_debug;
- rb_verbose_bup = ruby_verbose;
-
- Tcl_Preserve(ip);
+ /* delete slaves of slave */
+ delete_slaves(slave);
- /* delete slaves */
- delete_slaves(ip);
+ /* delete slave */
+ del_root(slave);
+ while(!Tcl_InterpDeleted(slave)) {
+ DUMP1("wait ip is deleted");
+ Tcl_DeleteInterp(slave);
+ }
- /* shut off some connections from Tcl-proc to Ruby */
- if (at_exit) {
- /* NOTE: Only when at exit.
- Because, ruby removes objects, which depends on the deleted
- interpreter, on some callback operations.
- It is important for GC. */
-#if TCL_MAJOR_VERSION >= 8
- Tcl_CreateObjCommand(ip, "ruby", ip_null_proc,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(ip, "ruby_eval", ip_null_proc,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(ip, "ruby_cmd", ip_null_proc,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- Tcl_CreateCommand(ip, "ruby", ip_null_proc,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateCommand(ip, "ruby_eval", ip_null_proc,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateCommand(ip, "ruby_cmd", ip_null_proc,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-#endif
+ Tcl_Release(slave);
}
- /* delete root widget */
-#if 0
- DUMP1("check `destroy'");
- if (Tcl_GetCommandInfo(ip, "destroy", &info)) {
- DUMP1("call `destroy'");
- Tcl_GlobalEval(ip, "destroy .");
- }
-#endif
-#if 1
- DUMP1("destroy root widget");
- if (tk_stubs_init_p() && Tk_MainWindow(ip) != (Tk_Window)NULL) {
- DUMP1("call Tk_DestroyWindow");
- ruby_debug = Qfalse;
- ruby_verbose = Qnil;
- Tk_DestroyWindow(Tk_MainWindow(ip));
- ruby_debug = rb_debug_bup;
- ruby_verbose = rb_verbose_bup;
- }
-#endif
-
- /* call finalize-hook-proc */
- DUMP1("check `finalize-hook-proc'");
- if ( Tcl_GetCommandInfo(ip, finalize_hook_name, &info)) {
- DUMP2("call finalize hook proc '%s'", finalize_hook_name);
- ruby_debug = Qfalse;
- ruby_verbose = Qnil;
- Tcl_GlobalEval(ip, finalize_hook_name);
- ruby_debug = rb_debug_bup;
- ruby_verbose = rb_verbose_bup;
- }
-
- DUMP1("check `foreach' & `after'");
- if ( Tcl_GetCommandInfo(ip, "foreach", &info)
- && Tcl_GetCommandInfo(ip, "after", &info) ) {
- DUMP1("cancel after callbacks");
- ruby_debug = Qfalse;
- ruby_verbose = Qnil;
- Tcl_GlobalEval(ip, "foreach id [after info] {after cancel $id}");
- ruby_debug = rb_debug_bup;
- ruby_verbose = rb_verbose_bup;
- }
+ Tcl_DecrRefCount(slave_list);
Tcl_Release(ip);
-
- DUMP1("finish ip_finalize");
- ruby_debug = rb_debug_bup;
- ruby_verbose = rb_verbose_bup;
- rb_thread_critical = thr_crit_bup;
}
-
-/* destroy interpreter */
static void
ip_free(ptr)
struct tcltkip *ptr;
{
- int thr_crit_bup;
+ Tcl_CmdInfo info;
+ int thr_crit_bup;
- DUMP2("free Tcl Interp %lx", (unsigned long)ptr->ip);
+ DUMP2("free Tcl Interp %lx", ptr->ip);
if (ptr) {
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- if ( ptr->ip != (Tcl_Interp*)NULL
- && !Tcl_InterpDeleted(ptr->ip)
- && Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL
- && !Tcl_InterpDeleted(Tcl_GetMaster(ptr->ip)) ) {
- DUMP2("parent IP(%lx) is not deleted",
- (unsigned long)Tcl_GetMaster(ptr->ip));
- DUMP2("slave IP(%lx) should not be deleted",
- (unsigned long)ptr->ip);
- free(ptr);
- rb_thread_critical = thr_crit_bup;
- return;
- }
+ DUMP2("IP ref_count = %d", ptr->ref_count);
- if (ptr->ip == (Tcl_Interp*)NULL) {
- DUMP1("ip_free is called for deleted IP");
- free(ptr);
- rb_thread_critical = thr_crit_bup;
- return;
+ if (!Tcl_InterpDeleted(ptr->ip)) {
+ DUMP2("IP(%lx) is not deleted", ptr->ip);
+ /* Tcl_Preserve(ptr->ip); */
+ rbtk_preserve_ip(ptr);
+
+ delete_slaves(ptr->ip);
+
+ Tcl_ResetResult(ptr->ip);
+
+ if (Tcl_GetCommandInfo(ptr->ip, finalize_hook_name, &info)) {
+ DUMP2("call finalize hook proc '%s'", finalize_hook_name);
+ Tcl_Eval(ptr->ip, finalize_hook_name);
+ }
+
+#if TCL_MAJOR_VERSION < 8 || ( TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4)
+#else
+ if (!Tcl_InterpDeleted(ptr->ip)) {
+ Tcl_Eval(ptr->ip, "foreach i [after info] {after cancel $i}");
+ }
+#endif
+
+ del_root(ptr->ip);
+
+ DUMP1("delete interp");
+ while(!Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("wait ip is deleted");
+ Tcl_DeleteInterp(ptr->ip);
+ }
+
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
}
- ip_finalize(ptr->ip);
- Tcl_DeleteInterp(ptr->ip);
- Tcl_Release(ptr->ip);
+ rbtk_release_ip(ptr);
+ DUMP2("IP ref_count = %d", ptr->ref_count);
- ptr->ip = (Tcl_Interp*)NULL;
free(ptr);
rb_thread_critical = thr_crit_bup;
}
-
DUMP1("complete freeing Tcl Interp");
}
-
/* create and initialize interpreter */
static VALUE ip_alloc _((VALUE));
static VALUE
@@ -4565,178 +3397,6 @@ ip_alloc(self)
return Data_Wrap_Struct(self, 0, ip_free, 0);
}
-static void
-ip_replace_wait_commands(interp, mainWin)
- Tcl_Interp *interp;
- Tk_Window mainWin;
-{
- /* replace 'vwait' command */
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("Tcl_CreateObjCommand(\"vwait\")");
- Tcl_CreateObjCommand(interp, "vwait", ip_rbVwaitObjCmd,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tcl_CreateCommand(\"vwait\")");
- Tcl_CreateCommand(interp, "vwait", ip_rbVwaitCommand,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#endif
-
- /* replace 'tkwait' command */
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("Tcl_CreateObjCommand(\"tkwait\")");
- Tcl_CreateObjCommand(interp, "tkwait", ip_rbTkWaitObjCmd,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tcl_CreateCommand(\"tkwait\")");
- Tcl_CreateCommand(interp, "tkwait", ip_rbTkWaitCommand,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#endif
-
- /* add 'thread_vwait' command */
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("Tcl_CreateObjCommand(\"thread_vwait\")");
- Tcl_CreateObjCommand(interp, "thread_vwait", ip_rb_threadVwaitObjCmd,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tcl_CreateCommand(\"thread_vwait\")");
- Tcl_CreateCommand(interp, "thread_vwait", ip_rb_threadVwaitCommand,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#endif
-
- /* add 'thread_tkwait' command */
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("Tcl_CreateObjCommand(\"thread_tkwait\")");
- Tcl_CreateObjCommand(interp, "thread_tkwait", ip_rb_threadTkWaitObjCmd,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tcl_CreateCommand(\"thread_tkwait\")");
- Tcl_CreateCommand(interp, "thread_tkwait", ip_rb_threadTkWaitCommand,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#endif
-
- /* replace 'update' command */
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("Tcl_CreateObjCommand(\"update\")");
- Tcl_CreateObjCommand(interp, "update", ip_rbUpdateObjCmd,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tcl_CreateCommand(\"update\")");
- Tcl_CreateCommand(interp, "update", ip_rbUpdateCommand,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#endif
-
- /* add 'thread_update' command */
-#if TCL_MAJOR_VERSION >= 8
- DUMP1("Tcl_CreateObjCommand(\"thread_update\")");
- Tcl_CreateObjCommand(interp, "thread_update", ip_rb_threadUpdateObjCmd,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#else /* TCL_MAJOR_VERSION < 8 */
- DUMP1("Tcl_CreateCommand(\"thread_update\")");
- Tcl_CreateCommand(interp, "thread_update", ip_rb_threadUpdateCommand,
- (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
-#endif
-}
-
-
-
-#if TCL_MAJOR_VERSION >= 8
-static int ip_rbNamespaceObjCmd _((ClientData, Tcl_Interp *, int,
- Tcl_Obj *CONST []));
-static int
-ip_rbNamespaceObjCmd(clientData, interp, objc, objv)
- ClientData clientData;
- Tcl_Interp *interp;
- int objc;
- Tcl_Obj *CONST objv[];
-{
- Tcl_CmdInfo info;
- int ret;
-
- if (!Tcl_GetCommandInfo(interp, "__orig_namespace_command__", &(info))) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp,
- "invalid command name \"namespace\"", (char*)NULL);
- return TCL_ERROR;
- }
-
- rbtk_eventloop_depth++;
- DUMP2("namespace wrapper enter depth == %d", rbtk_eventloop_depth);
-
- if (info.isNativeObjectProc) {
- ret = (*(info.objProc))(info.objClientData, interp, objc, objv);
- } else {
- /* string interface */
- int i;
- char **argv;
-
- argv = (char **)Tcl_Alloc(sizeof(char *) * (objc + 1));
-
- for(i = 0; i < objc; i++) {
- /* argv[i] = Tcl_GetString(objv[i]); */
- argv[i] = Tcl_GetStringFromObj(objv[i], (int*)NULL);
- }
- argv[objc] = (char *)NULL;
-
- ret = (*(info.proc))(info.clientData, interp,
- objc, (CONST84 char **)argv);
-
- Tcl_Free((char*)argv);
- }
-
- DUMP2("namespace wrapper exit depth == %d", rbtk_eventloop_depth);
- rbtk_eventloop_depth--;
-
- return ret;
-}
-#endif
-
-static void
-ip_wrap_namespace_command(interp)
- Tcl_Interp *interp;
-{
-#if TCL_MAJOR_VERSION >= 8
- Tcl_CmdInfo orig_info;
-
- if (!Tcl_GetCommandInfo(interp, "namespace", &(orig_info))) {
- return;
- }
-
- if (orig_info.isNativeObjectProc) {
- Tcl_CreateObjCommand(interp, "__orig_namespace_command__",
- orig_info.objProc, orig_info.objClientData,
- orig_info.deleteProc);
- } else {
- Tcl_CreateCommand(interp, "__orig_namespace_command__",
- orig_info.proc, orig_info.clientData,
- orig_info.deleteProc);
- }
-
- Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *)NULL);
-#endif
-}
-
-
-/* call when interpreter is deleted */
-static void
-ip_CallWhenDeleted(clientData, ip)
- ClientData clientData;
- Tcl_Interp *ip;
-{
- int thr_crit_bup;
- /* Tk_Window main_win = (Tk_Window) clientData; */
-
- DUMP1("start ip_CallWhenDeleted");
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- ip_finalize(ip);
-
- DUMP1("finish ip_CallWhenDeleted");
- rb_thread_critical = thr_crit_bup;
-}
-
-/* initialize interpreter */
static VALUE
ip_init(argc, argv, self)
int argc;
@@ -4746,15 +3406,12 @@ ip_init(argc, argv, self)
struct tcltkip *ptr; /* tcltkip data struct */
VALUE argv0, opts;
int cnt;
- int st;
int with_tk = 1;
- Tk_Window mainWin = (Tk_Window)NULL;
+ Tk_Window mainWin;
/* security check */
if (ruby_safe_level >= 4) {
- rb_raise(rb_eSecurityError,
- "Cannot create a TclTkIp object at level %d",
- ruby_safe_level);
+ rb_raise(rb_eSecurityError, "Cannot create a TclTkIp object at level %d", ruby_safe_level);
}
/* create object */
@@ -4767,38 +3424,11 @@ ip_init(argc, argv, self)
/* from Tk_Main() */
DUMP1("Tcl_CreateInterp");
- ptr->ip = ruby_tcl_create_ip_and_stubs_init(&st);
+ ptr->ip = Tcl_CreateInterp();
if (ptr->ip == NULL) {
- switch(st) {
- case TCLTK_STUBS_OK:
- break;
- case NO_TCL_DLL:
- rb_raise(rb_eLoadError, "tcltklib: fail to open tcl_dll");
- case NO_FindExecutable:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_FindExecutable");
- case NO_CreateInterp:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_CreateInterp()");
- case NO_DeleteInterp:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_DeleteInterp()");
- case FAIL_CreateInterp:
- rb_raise(rb_eRuntimeError, "tcltklib: fail to create a new IP");
- case FAIL_Tcl_InitStubs:
- rb_raise(rb_eRuntimeError, "tcltklib: fail to Tcl_InitStubs()");
- default:
- rb_raise(rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tcl_create_ip_and_stubs_init", st);
- }
+ rb_raise(rb_eRuntimeError, "fail to create a new Tk interpreter");
}
-#if TCL_MAJOR_VERSION >= 8
-#if TCL_NAMESPACE_DEBUG
- DUMP1("get current namespace");
- if ((ptr->default_ns = Tcl_GetCurrentNamespace(ptr->ip))
- == (Tcl_Namespace*)NULL) {
- rb_raise(rb_eRuntimeError, "a new Tk interpreter has a NULL namespace");
- }
-#endif
-#endif
-
rbtk_preserve_ip(ptr);
DUMP2("IP ref_count = %d", ptr->ref_count);
current_interp = ptr->ip;
@@ -4809,7 +3439,11 @@ ip_init(argc, argv, self)
/* from Tcl_AppInit() */
DUMP1("Tcl_Init");
if (Tcl_Init(ptr->ip) == TCL_ERROR) {
+#if TCL_MAJOR_VERSION >= 8
rb_raise(rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
+#endif
}
/* set variables */
@@ -4844,22 +3478,13 @@ ip_init(argc, argv, self)
/* from Tcl_AppInit() */
if (with_tk) {
DUMP1("Tk_Init");
- st = ruby_tk_stubs_init(ptr->ip);
- switch(st) {
- case TCLTK_STUBS_OK:
- break;
- case NO_Tk_Init:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tk_Init()");
- case FAIL_Tk_Init:
- rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_Init(). %s",
- Tcl_GetStringResult(ptr->ip));
- case FAIL_Tk_InitStubs:
- rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_InitStubs(). %s",
- Tcl_GetStringResult(ptr->ip));
- default:
- rb_raise(rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tk_stubs_init", st);
+ if (Tk_Init(ptr->ip) == TCL_ERROR) {
+#if TCL_MAJOR_VERSION >= 8
+ rb_raise(rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
+#endif
}
-
DUMP1("Tcl_StaticPackage(\"Tk\")");
#if TCL_MAJOR_VERSION >= 8
Tcl_StaticPackage(ptr->ip, "Tk", Tk_Init, Tk_SafeInit);
@@ -4867,12 +3492,12 @@ ip_init(argc, argv, self)
Tcl_StaticPackage(ptr->ip, "Tk", Tk_Init,
(Tcl_PackageInitProc *) NULL);
#endif
-
- /* get main window */
- mainWin = Tk_MainWindow(ptr->ip);
- Tk_Preserve((ClientData)mainWin);
}
+ /* get main window */
+ mainWin = Tk_MainWindow(ptr->ip);
+ Tk_Preserve((ClientData)mainWin);
+
/* add ruby command to the interpreter */
#if TCL_MAJOR_VERSION >= 8
DUMP1("Tcl_CreateObjCommand(\"ruby\")");
@@ -4919,29 +3544,92 @@ ip_init(argc, argv, self)
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#endif
- /* replace vwait and tkwait */
- ip_replace_wait_commands(ptr->ip, mainWin);
+#if 0 /*
+ Disable the following "update" and "thread_update". Bcause,
+ they don't work in a callback-proc. After calling update in
+ a callback-proc, the callback proc never be worked.
+ If the problem will be fixed in the future, may enable the
+ functions.
+ */
+ /* replace 'update' command */
+# if TCL_MAJOR_VERSION >= 8
+ DUMP1("Tcl_CreateObjCommand(\"update\")");
+ Tcl_CreateObjCommand(ptr->ip, "update", ip_rbUpdateObjCmd,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+# else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tcl_CreateCommand(\"update\")");
+ Tcl_CreateCommand(ptr->ip, "update", ip_rbUpdateCommand,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+# endif
+
+ /* add 'thread_update' command */
+# if TCL_MAJOR_VERSION >= 8
+ DUMP1("Tcl_CreateObjCommand(\"thread_update\")");
+ Tcl_CreateObjCommand(ptr->ip, "thread_update", ip_rb_threadUpdateObjCmd,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+# else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tcl_CreateCommand(\"thread_update\")");
+ Tcl_CreateCommand(ptr->ip, "thread_update", ip_rb_threadUpdateCommand,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+# endif
+#endif
+
+ /* replace 'vwait' command */
+#if TCL_MAJOR_VERSION >= 8
+ DUMP1("Tcl_CreateObjCommand(\"vwait\")");
+ Tcl_CreateObjCommand(ptr->ip, "vwait", ip_rbVwaitObjCmd,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tcl_CreateCommand(\"vwait\")");
+ Tcl_CreateCommand(ptr->ip, "vwait", ip_rbVwaitCommand,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#endif
- /* wrap namespace command */
- ip_wrap_namespace_command(ptr->ip);
+ /* replace 'tkwait' command */
+#if TCL_MAJOR_VERSION >= 8
+ DUMP1("Tcl_CreateObjCommand(\"tkwait\")");
+ Tcl_CreateObjCommand(ptr->ip, "tkwait", ip_rbTkWaitObjCmd,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tcl_CreateCommand(\"tkwait\")");
+ Tcl_CreateCommand(ptr->ip, "tkwait", ip_rbTkWaitCommand,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#endif
- /* set finalizer */
- Tcl_CallWhenDeleted(ptr->ip, ip_CallWhenDeleted, (ClientData)mainWin);
+ /* add 'thread_vwait' command */
+#if TCL_MAJOR_VERSION >= 8
+ DUMP1("Tcl_CreateObjCommand(\"thread_vwait\")");
+ Tcl_CreateObjCommand(ptr->ip, "thread_vwait", ip_rb_threadVwaitObjCmd,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tcl_CreateCommand(\"thread_vwait\")");
+ Tcl_CreateCommand(ptr->ip, "thread_vwait", ip_rb_threadVwaitCommand,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#endif
- if (mainWin != (Tk_Window)NULL) {
- Tk_Release((ClientData)mainWin);
- }
+ /* add 'thread_tkwait' command */
+#if TCL_MAJOR_VERSION >= 8
+ DUMP1("Tcl_CreateObjCommand(\"thread_tkwait\")");
+ Tcl_CreateObjCommand(ptr->ip, "thread_tkwait", ip_rb_threadTkWaitObjCmd,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tcl_CreateCommand(\"thread_tkwait\")");
+ Tcl_CreateCommand(ptr->ip, "thread_tkwait", ip_rb_threadTkWaitCommand,
+ (ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
+#endif
+
+ Tk_Release((ClientData)mainWin);
return self;
}
static VALUE
-ip_create_slave_core(interp, argc, argv)
- VALUE interp;
+ip_create_slave(argc, argv, self)
int argc;
VALUE *argv;
+ VALUE self;
{
- struct tcltkip *master = get_ip(interp);
+ struct tcltkip *master = get_ip(self);
struct tcltkip *slave = ALLOC(struct tcltkip);
VALUE safemode;
VALUE name;
@@ -4949,20 +3637,15 @@ ip_create_slave_core(interp, argc, argv)
int thr_crit_bup;
Tk_Window mainWin;
- /* ip is deleted? */
- if (deleted_ip(master)) {
- return rb_exc_new2(rb_eRuntimeError,
- "deleted master cannot create a new slave");
+ /* safe-mode check */
+ if (rb_scan_args(argc, argv, "11", &name, &safemode) == 1) {
+ safemode = Qfalse;
}
-
- name = argv[0];
- safemode = argv[1];
-
if (Tcl_IsSafe(master->ip) == 1) {
safe = 1;
} else if (safemode == Qfalse || NIL_P(safemode)) {
safe = 0;
- /* rb_secure(4); */ /* already checked */
+ rb_secure(4);
} else {
safe = 1;
}
@@ -4970,19 +3653,12 @@ ip_create_slave_core(interp, argc, argv)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
-#if 0
- /* init Tk */
- if (RTEST(with_tk)) {
- volatile VALUE exc;
- if (!tk_stubs_init_p()) {
- exc = tcltkip_init_tk(interp);
- if (!NIL_P(exc)) {
- rb_thread_critical = thr_crit_bup;
- return exc;
- }
- }
+ /* ip is deleted? */
+ if (Tcl_InterpDeleted(master->ip)) {
+ DUMP1("master-ip is deleted");
+ rb_thread_critical = thr_crit_bup;
+ rb_raise(rb_eRuntimeError, "deleted master cannot create a new slave interpreter");
}
-#endif
/* create slave-ip */
slave->ref_count = 0;
@@ -4992,21 +3668,15 @@ ip_create_slave_core(interp, argc, argv)
slave->ip = Tcl_CreateSlave(master->ip, StringValuePtr(name), safe);
if (slave->ip == NULL) {
rb_thread_critical = thr_crit_bup;
- return rb_exc_new2(rb_eRuntimeError,
- "fail to create the new slave interpreter");
+ rb_raise(rb_eRuntimeError, "fail to create the new slave interpreter");
}
-#if TCL_MAJOR_VERSION >= 8
-#if TCL_NAMESPACE_DEBUG
- slave->default_ns = Tcl_GetCurrentNamespace(slave->ip);
-#endif
-#endif
rbtk_preserve_ip(slave);
slave->has_orig_exit
= Tcl_GetCommandInfo(slave->ip, "exit", &(slave->orig_exit_info));
/* replace 'exit' command --> 'interp_exit' command */
- mainWin = (tk_stubs_init_p())? Tk_MainWindow(slave->ip): (Tk_Window)NULL;
+ mainWin = Tk_MainWindow(slave->ip);
#if TCL_MAJOR_VERSION >= 8
DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\"");
Tcl_CreateObjCommand(slave->ip, "exit", ip_InterpExitObjCmd,
@@ -5017,177 +3687,37 @@ ip_create_slave_core(interp, argc, argv)
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#endif
- /* replace vwait and tkwait */
- ip_replace_wait_commands(slave->ip, mainWin);
-
- /* wrap namespace command */
- ip_wrap_namespace_command(slave->ip);
-
- /* set finalizer */
- Tcl_CallWhenDeleted(slave->ip, ip_CallWhenDeleted, (ClientData)mainWin);
-
rb_thread_critical = thr_crit_bup;
- return Data_Wrap_Struct(CLASS_OF(interp), 0, ip_free, slave);
-}
-
-static VALUE
-ip_create_slave(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
-{
- struct tcltkip *master = get_ip(self);
- VALUE safemode;
- VALUE name;
- VALUE callargv[2];
-
- /* ip is deleted? */
- if (deleted_ip(master)) {
- rb_raise(rb_eRuntimeError,
- "deleted master cannot create a new slave interpreter");
- }
-
- /* argument check */
- if (rb_scan_args(argc, argv, "11", &name, &safemode) == 1) {
- safemode = Qfalse;
- }
- if (Tcl_IsSafe(master->ip) != 1
- && (safemode == Qfalse || NIL_P(safemode))) {
- rb_secure(4);
- }
-
- StringValue(name);
- callargv[0] = name;
- callargv[1] = safemode;
-
- return tk_funcall(ip_create_slave_core, 2, callargv, self);
-}
-
-
-/* self is slave of master? */
-static VALUE
-ip_is_slave_of_p(self, master)
- VALUE self, master;
-{
- if (!rb_obj_is_kind_of(master, tcltkip_class)) {
- rb_raise(rb_eArgError, "expected TclTkIp object");
- }
-
- if (Tcl_GetMaster(get_ip(self)->ip) == get_ip(master)->ip) {
- return Qtrue;
- } else {
- return Qfalse;
- }
-}
-
-
-/* create console (if supported) */
-#if defined(MAC_TCL) || defined(__WIN32__)
-#if TCL_MAJOR_VERSION < 8 \
- || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0) \
- || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 1 \
- && (TCL_RELEASE_LEVEL == TCL_ALPHA_RELEASE \
- || (TCL_RELEASE_LEVEL == TCL_BETA_RELEASE \
- && TCL_RELEASE_SERIAL < 2) ) )
-EXTERN void TkConsoleCreate _((void));
-#endif
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 1 \
- && ( (TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE \
- && TCL_RELEASE_SERIAL == 0) \
- || (TCL_RELEASE_LEVEL == TCL_BETA_RELEASE \
- && TCL_RELEASE_SERIAL >= 2) )
-EXTERN void TkConsoleCreate_ _((void));
-#endif
-#endif
-static VALUE
-ip_create_console_core(interp, argc, argv)
- VALUE interp;
- int argc; /* dummy */
- VALUE *argv; /* dummy */
-{
- struct tcltkip *ptr = get_ip(interp);
-
- if (!tk_stubs_init_p()) {
- tcltkip_init_tk(interp);
- }
-
- if (Tcl_GetVar(ptr->ip,"tcl_interactive",TCL_GLOBAL_ONLY) == (char*)NULL) {
- Tcl_SetVar(ptr->ip, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
- }
-
-#if TCL_MAJOR_VERSION > 8 \
- || (TCL_MAJOR_VERSION == 8 \
- && (TCL_MINOR_VERSION > 1 \
- || (TCL_MINOR_VERSION == 1 \
- && TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE \
- && TCL_RELEASE_SERIAL >= 1) ) )
- Tk_InitConsoleChannels(ptr->ip);
-
- if (Tk_CreateConsoleWindow(ptr->ip) != TCL_OK) {
- rb_raise(rb_eRuntimeError, "fail to create console-window");
- }
-#else
-#if defined(MAC_TCL) || defined(__WIN32__)
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 1 \
- && ( (TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE && TCL_RELEASE_SERIAL == 0) \
- || (TCL_RELEASE_LEVEL == TCL_BETA_RELEASE && TCL_RELEASE_SERIAL >= 2) )
- TkConsoleCreate_();
-#else
- TkConsoleCreate();
-#endif
-
- if (TkConsoleInit(ptr->ip) != TCL_OK) {
- rb_raise(rb_eRuntimeError, "fail to create console-window");
- }
-#else
- rb_notimplement();
-#endif
-#endif
-
- return interp;
+ return Data_Wrap_Struct(CLASS_OF(self), 0, ip_free, slave);
}
+/* make ip "safe" */
static VALUE
-ip_create_console(self)
+ip_make_safe(self)
VALUE self;
{
struct tcltkip *ptr = get_ip(self);
-
- /* ip is deleted? */
- if (deleted_ip(ptr)) {
- rb_raise(rb_eRuntimeError, "interpreter is deleted");
- }
-
- return tk_funcall(ip_create_console_core, 0, (VALUE*)NULL, self);
-}
-
-/* make ip "safe" */
-static VALUE
-ip_make_safe_core(interp, argc, argv)
- VALUE interp;
- int argc; /* dummy */
- VALUE *argv; /* dummy */
-{
- struct tcltkip *ptr = get_ip(interp);
Tk_Window mainWin;
/* ip is deleted? */
- if (deleted_ip(ptr)) {
- return rb_exc_new2(rb_eRuntimeError, "interpreter is deleted");
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
if (Tcl_MakeSafe(ptr->ip) == TCL_ERROR) {
- /* return rb_exc_new2(rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip)); */
- return create_ip_exc(interp, rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip));
+#if TCL_MAJOR_VERSION >= 8
+ rb_raise(rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
+#endif
}
ptr->allow_ruby_exit = 0;
/* replace 'exit' command --> 'interp_exit' command */
- mainWin = (tk_stubs_init_p())? Tk_MainWindow(ptr->ip): (Tk_Window)NULL;
+ mainWin = Tk_MainWindow(ptr->ip);
#if TCL_MAJOR_VERSION >= 8
DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\"");
Tcl_CreateObjCommand(ptr->ip, "exit", ip_InterpExitObjCmd,
@@ -5198,21 +3728,7 @@ ip_make_safe_core(interp, argc, argv)
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#endif
- return interp;
-}
-
-static VALUE
-ip_make_safe(self)
- VALUE self;
-{
- struct tcltkip *ptr = get_ip(self);
-
- /* ip is deleted? */
- if (deleted_ip(ptr)) {
- rb_raise(rb_eRuntimeError, "interpreter is deleted");
- }
-
- return tk_funcall(ip_make_safe_core, 0, (VALUE*)NULL, self);
+ return self;
}
/* is safe? */
@@ -5223,7 +3739,8 @@ ip_is_safe_p(self)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
@@ -5242,7 +3759,8 @@ ip_allow_ruby_exit_p(self)
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
@@ -5264,7 +3782,8 @@ ip_allow_ruby_exit_set(self, val)
rb_secure(4);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
@@ -5273,7 +3792,7 @@ ip_allow_ruby_exit_set(self, val)
"insecure operation on a safe interpreter");
}
- mainWin = (tk_stubs_init_p())? Tk_MainWindow(ptr->ip): (Tk_Window)NULL;
+ mainWin = Tk_MainWindow(ptr->ip);
if (RTEST(val)) {
ptr->allow_ruby_exit = 1;
@@ -5308,358 +3827,119 @@ static VALUE
ip_delete(self)
VALUE self;
{
- int thr_crit_bup;
struct tcltkip *ptr = get_ip(self);
- if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp*)NULL) {
- DUMP1("delete deleted IP");
- return Qnil;
- }
+ /* Tcl_Preserve(ptr->ip); */
+ rbtk_preserve_ip(ptr);
- thr_crit_bup = rb_thread_critical;
- rb_thread_critical = Qtrue;
+#if TCL_MAJOR_VERSION < 8 || ( TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4)
+#else
+ if (!Tcl_InterpDeleted(ptr->ip)) {
+ Tcl_Eval(ptr->ip, "foreach i [after info] { after cancel $i }");
+ }
+#endif
- DUMP1("call ip_finalize");
- ip_finalize(ptr->ip);
+ del_root(ptr->ip);
DUMP1("delete interp");
- Tcl_DeleteInterp(ptr->ip);
- Tcl_Release(ptr->ip);
+ while(!Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("wait ip is deleted");
+ Tcl_DeleteInterp(ptr->ip);
+ }
- rb_thread_critical = thr_crit_bup;
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
return Qnil;
}
-
/* is deleted? */
static VALUE
-ip_has_invalid_namespace_p(self)
- VALUE self;
-{
- struct tcltkip *ptr = get_ip(self);
-
- if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp *)NULL) {
- /* deleted IP */
- return Qtrue;
- }
-
-#if TCL_NAMESPACE_DEBUG
- if (rbtk_invalid_namespace(ptr)) {
- return Qtrue;
- } else {
- return Qfalse;
- }
-#else
- return Qfalse;
-#endif
-}
-
-static VALUE
ip_is_deleted_p(self)
VALUE self;
{
struct tcltkip *ptr = get_ip(self);
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
return Qtrue;
} else {
return Qfalse;
}
}
-static VALUE
-ip_has_mainwindow_p(self)
- VALUE self;
-{
- struct tcltkip *ptr = get_ip(self);
-
- if (deleted_ip(ptr) || !tk_stubs_init_p()) {
- return Qnil;
- } else if (Tk_MainWindow(ptr->ip) == (Tk_Window)NULL) {
- return Qfalse;
- } else {
- return Qtrue;
- }
-}
-/*** ruby string <=> tcl object ***/
-#if TCL_MAJOR_VERSION >= 8
static VALUE
-get_str_from_obj(obj)
- Tcl_Obj *obj;
-{
- int len, binary = 0;
- const char *s;
- volatile VALUE str;
-
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
- s = Tcl_GetStringFromObj(obj, &len);
-#else /* TCL_VERSION >= 8.1 */
- if (Tcl_GetCharLength(obj) != Tcl_UniCharLen(Tcl_GetUnicode(obj))) {
- /* possibly binary string */
- s = Tcl_GetByteArrayFromObj(obj, &len);
- binary = 1;
- } else {
- /* possibly text string */
- s = Tcl_GetStringFromObj(obj, &len);
- }
+#ifdef HAVE_STDARG_PROTOTYPES
+create_ip_exc(VALUE interp, VALUE exc, const char *fmt, ...)
+#else
+create_ip_exc(interp, exc, fmt, va_alist)
+ VALUE interp:
+ VALUE exc;
+ const char *fmt;
+ va_dcl
#endif
- str = s ? rb_str_new(s, len) : rb_str_new2("");
- if (binary) rb_ivar_set(str, ID_at_enc, rb_str_new2("binary"));
- return str;
-}
-
-static Tcl_Obj *
-get_obj_from_str(str)
- VALUE str;
{
- const char *s = StringValuePtr(str);
+ va_list args;
+ char buf[BUFSIZ];
+ VALUE einfo;
-#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
- return Tcl_NewStringObj((char*)s, RSTRING(str)->len);
-#else /* TCL_VERSION >= 8.1 */
- VALUE enc = rb_attr_get(str, ID_at_enc);
+ va_init_list(args,fmt);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ buf[BUFSIZ - 1] = '\0';
+ va_end(args);
+ einfo = rb_exc_new2(exc, buf);
+ rb_ivar_set(einfo, ID_at_interp, interp);
+ Tcl_ResetResult(get_ip(interp)->ip);
- if (!NIL_P(enc)) {
- StringValue(enc);
- if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
- /* binary string */
- return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
- } else {
- /* text string */
- return Tcl_NewStringObj(s, RSTRING(str)->len);
- }
- } else if (strlen(s) != RSTRING(str)->len) {
- /* probably binary string */
- return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
- } else {
- /* probably text string */
- return Tcl_NewStringObj(s, RSTRING(str)->len);
- }
-#endif
+ return einfo;
}
-#endif /* ruby string <=> tcl object */
static VALUE
ip_get_result_string_obj(interp)
Tcl_Interp *interp;
{
#if TCL_MAJOR_VERSION >= 8
- Tcl_Obj *retObj;
- volatile VALUE strval;
-
- retObj = Tcl_GetObjResult(interp);
- Tcl_IncrRefCount(retObj);
- strval = get_str_from_obj(retObj);
- OBJ_TAINT(strval);
- Tcl_DecrRefCount(retObj);
- return strval;
-#else
- return rb_tainted_str_new2(interp->result);
-#endif
-}
-
-/* call Tcl/Tk functions on the eventloop thread */
-static VALUE
-callq_safelevel_handler(arg, callq)
- VALUE arg;
- VALUE callq;
-{
- struct call_queue *q;
-
- Data_Get_Struct(callq, struct call_queue, q);
- DUMP2("(safe-level handler) $SAFE = %d", q->safe_level);
- rb_set_safe_level(q->safe_level);
- return((q->func)(q->interp, q->argc, q->argv));
-}
-
-static int call_queue_handler _((Tcl_Event *, int));
-static int
-call_queue_handler(evPtr, flags)
- Tcl_Event *evPtr;
- int flags;
-{
- struct call_queue *q = (struct call_queue *)evPtr;
- volatile VALUE ret;
- volatile VALUE q_dat;
- struct tcltkip *ptr;
-
- DUMP2("do_call_queue_handler : evPtr = %p", evPtr);
- DUMP2("queue_handler thread : %lx", rb_thread_current());
- DUMP2("added by thread : %lx", q->thread);
-
- if (*(q->done)) {
- DUMP1("processed by another event-loop");
- return 0;
- } else {
- DUMP1("process it on current event-loop");
- }
-
- /* process it */
- *(q->done) = 1;
-
- /* deleted ipterp ? */
- ptr = get_ip(q->interp);
- if (deleted_ip(ptr)) {
- /* deleted IP --> ignore */
- return 1;
- }
-
- /* check safe-level */
- if (rb_safe_level() != q->safe_level) {
- /* q_dat = Data_Wrap_Struct(rb_cData,0,0,q); */
- q_dat = Data_Wrap_Struct(rb_cData,call_queue_mark,0,q);
- ret = rb_funcall(rb_proc_new(callq_safelevel_handler, q_dat),
- ID_call, 0);
- rb_gc_force_recycle(q_dat);
- } else {
- DUMP2("call function (for caller thread:%lx)", q->thread);
- DUMP2("call function (current thread:%lx)", rb_thread_current());
- ret = (q->func)(q->interp, q->argc, q->argv);
- }
-
- /* set result */
- RARRAY(q->result)->ptr[0] = ret;
-
- /* complete */
- *(q->done) = -1;
-
- /* back to caller */
- if (RTEST(rb_funcall(q->thread, ID_alive_p, 0, 0))) {
- DUMP2("back to caller (caller thread:%lx)", q->thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
- rb_thread_run(q->thread);
- DUMP1("finish back to caller");
- } else {
- DUMP2("caller is dead (caller thread:%lx)", q->thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
- }
-
- /* end of handler : remove it */
- return 1;
-}
-
-static VALUE
-tk_funcall(func, argc, argv, obj)
- VALUE (*func)();
- int argc;
- VALUE *argv;
- VALUE obj;
-{
- struct call_queue *callq;
- int *alloc_done;
- int thr_crit_bup;
- volatile VALUE current = rb_thread_current();
- volatile VALUE ip_obj = obj;
- volatile VALUE result;
- volatile VALUE ret;
-
+ int len;
+ char *s;
- if (!NIL_P(ip_obj) && deleted_ip(get_ip(ip_obj))) {
- return Qnil;
- }
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ s = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &len);
+ return(rb_tainted_str_new(s, len));
- if (NIL_P(eventloop_thread) || current == eventloop_thread) {
- if (NIL_P(eventloop_thread)) {
- DUMP2("tk_funcall from thread:%lx but no eventloop", current);
- } else {
- DUMP2("tk_funcall from current eventloop %lx", current);
- }
- result = (func)(ip_obj, argc, argv);
- if (rb_obj_is_kind_of(result, rb_eException)) {
- rb_exc_raise(result);
- }
- return result;
- }
+# else /* TCL_VERSION >= 8.1 */
+ volatile VALUE strval;
+ Tcl_Obj *retobj = Tcl_GetObjResult(interp);
+ int thr_crit_bup;
- DUMP2("tk_funcall from thread %lx (NOT current eventloop)", current);
+ Tcl_IncrRefCount(retobj);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- /* allocate memory (argv cross over thread : must be in heap) */
- if (argv) {
- VALUE *temp = ALLOC_N(VALUE, argc);
- MEMCPY(temp, argv, VALUE, argc);
- argv = temp;
+ if (Tcl_GetCharLength(retobj) != Tcl_UniCharLen(Tcl_GetUnicode(retobj))) {
+ /* possibly binary string */
+ s = Tcl_GetByteArrayFromObj(retobj, &len);
+ strval = rb_tainted_str_new(s, len);
+ rb_ivar_set(strval, ID_at_enc, rb_str_new2("binary"));
+ } else {
+ /* possibly text string */
+ s = Tcl_GetStringFromObj(retobj, &len);
+ strval = rb_tainted_str_new(s, len);
}
- /* allocate memory (keep result) */
- alloc_done = (int*)ALLOC(int);
- *alloc_done = 0;
-
- /* allocate memory (freed by Tcl_ServiceEvent) */
- callq = (struct call_queue *)Tcl_Alloc(sizeof(struct call_queue));
- Tcl_Preserve(callq);
-
- /* allocate result obj */
- result = rb_ary_new2(1);
- RARRAY(result)->ptr[0] = Qnil;
- RARRAY(result)->len = 1;
-
- /* construct event data */
- callq->done = alloc_done;
- callq->func = func;
- callq->argc = argc;
- callq->argv = argv;
- callq->interp = ip_obj;
- callq->result = result;
- callq->thread = current;
- callq->safe_level = rb_safe_level();
- callq->ev.proc = call_queue_handler;
-
- /* add the handler to Tcl event queue */
- DUMP1("add handler");
- Tcl_QueueEvent(&(callq->ev), TCL_QUEUE_HEAD);
-
rb_thread_critical = thr_crit_bup;
- /* wait for the handler to be processed */
- DUMP2("wait for handler (current thread:%lx)", current);
- while(*alloc_done >= 0) {
- rb_thread_stop();
- }
- DUMP2("back from handler (current thread:%lx)", current);
-
- /* get result & free allocated memory */
- ret = RARRAY(result)->ptr[0];
- free(alloc_done);
- if (argv) free(argv);
-
- Tcl_Release(callq);
+ Tcl_DecrRefCount(retobj);
- /* exception? */
- if (rb_obj_is_kind_of(ret, rb_eException)) {
- DUMP1("raise exception");
- rb_exc_raise(ret);
- }
+ return(strval);
- DUMP1("exit tk_funcall");
- return ret;
+# endif
+#else /* TCL_MAJOR_VERSION < 8 */
+ return(rb_tainted_str_new2(interp->result));
+#endif
}
-
/* eval string in tcl by Tcl_Eval() */
-#if TCL_MAJOR_VERSION >= 8
-struct call_eval_info {
- struct tcltkip *ptr;
- Tcl_Obj *cmd;
-};
-
-static VALUE
-call_tcl_eval(arg)
- VALUE arg;
-{
- struct call_eval_info *inf = (struct call_eval_info *)arg;
-
- Tcl_AllowExceptions(inf->ptr->ip);
- inf->ptr->return_value = Tcl_EvalObj(inf->ptr->ip, inf->cmd);
-
- return Qnil;
-}
-#endif
-
static VALUE
ip_eval_real(self, cmd_str, cmd_len)
VALUE self;
@@ -5667,6 +3947,8 @@ ip_eval_real(self, cmd_str, cmd_len)
int cmd_len;
{
volatile VALUE ret;
+ char *s;
+ int len;
struct tcltkip *ptr = get_ip(self);
int thr_crit_bup;
@@ -5682,77 +3964,39 @@ ip_eval_real(self, cmd_str, cmd_len)
Tcl_IncrRefCount(cmd);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
Tcl_DecrRefCount(cmd);
rb_thread_critical = thr_crit_bup;
ptr->return_value = TCL_OK;
return rb_tainted_str_new2("");
} else {
- int status;
- struct call_eval_info inf;
-
/* Tcl_Preserve(ptr->ip); */
rbtk_preserve_ip(ptr);
-
-#if 0
+
ptr->return_value = Tcl_EvalObj(ptr->ip, cmd);
/* ptr->return_value = Tcl_GlobalEvalObj(ptr->ip, cmd); */
-#else
- inf.ptr = ptr;
- inf.cmd = cmd;
- ret = rb_protect(call_tcl_eval, (VALUE)&inf, &status);
- switch(status) {
- case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception = rb_exc_new2(rb_eException,
- "unknown exception");
- } else {
- rbtk_pending_exception = ruby_errinfo;
- }
- break;
-
- case TAG_FATAL:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL");
- } else {
- rbtk_pending_exception = ruby_errinfo;
- }
- }
-#endif
}
Tcl_DecrRefCount(cmd);
}
- if (pending_exception_check1(thr_crit_bup, ptr)) {
+ if (ptr->return_value == TCL_ERROR) {
+ volatile VALUE exc;
+ exc = create_ip_exc(self, rb_eRuntimeError,
+ "%s", Tcl_GetStringResult(ptr->ip));
+ /* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
- return rbtk_pending_exception;
- }
- if (ptr->return_value == TCL_ERROR) {
- if (event_loop_abort_on_exc > 0 && !Tcl_InterpDeleted(ptr->ip)) {
- volatile VALUE exc;
- exc = create_ip_exc(self, rb_eRuntimeError,
- "%s", Tcl_GetStringResult(ptr->ip));
- rbtk_release_ip(ptr);
- rb_thread_critical = thr_crit_bup;
- return exc;
- } else {
- if (event_loop_abort_on_exc < 0) {
- rb_warning("%s (ignore)", Tcl_GetStringResult(ptr->ip));
- } else {
- rb_warn("%s (ignore)", Tcl_GetStringResult(ptr->ip));
- }
- Tcl_ResetResult(ptr->ip);
- rbtk_release_ip(ptr);
- rb_thread_critical = thr_crit_bup;
- return rb_tainted_str_new2("");
- }
+ rb_thread_critical = thr_crit_bup;
+ rb_exc_raise(exc);
}
+ DUMP2("(TCL_Eval result) %d", ptr->return_value);
/* pass back the result (as string) */
ret = ip_get_result_string_obj(ptr->ip);
+ /* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
return ret;
@@ -5761,7 +4005,8 @@ ip_eval_real(self, cmd_str, cmd_len)
DUMP2("Tcl_Eval(%s)", cmd_str);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
ptr->return_value = TCL_OK;
return rb_tainted_str_new2("");
} else {
@@ -5771,23 +4016,18 @@ ip_eval_real(self, cmd_str, cmd_len)
/* ptr->return_value = Tcl_GlobalEval(ptr->ip, cmd_str); */
}
- if (pending_exception_check1(thr_crit_bup, ptr)) {
- rbtk_release_ip(ptr);
- return rbtk_pending_exception;
- }
-
if (ptr->return_value == TCL_ERROR) {
volatile VALUE exc;
-
exc = create_ip_exc(self, rb_eRuntimeError, "%s", ptr->ip->result);
-
+ /* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
- return exc;
+ rb_exc_raise(exc);
}
DUMP2("(TCL_Eval result) %d", ptr->return_value);
/* pass back the result (as string) */
ret = ip_get_result_string_obj(ptr->ip);
+ /* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
return ret;
#endif
@@ -5816,6 +4056,10 @@ eval_queue_handler(evPtr, flags)
volatile VALUE ret;
volatile VALUE q_dat;
+ DUMP2("do_eval_queue_handler : evPtr = %p", evPtr);
+ DUMP2("eval queue_thread : %lx", rb_thread_current());
+ DUMP2("added by thread : %lx", q->thread);
+
if (*(q->done)) {
DUMP1("processed by another event-loop");
return 0;
@@ -5839,6 +4083,8 @@ eval_queue_handler(evPtr, flags)
ID_call, 0);
rb_gc_force_recycle(q_dat);
} else {
+ DUMP2("call eval_real (for caller thread:%lx)", q->thread);
+ DUMP2("call eval_real (current thread:%lx)", rb_thread_current());
ret = ip_eval_real(q->interp, q->str, q->len);
}
@@ -5849,15 +4095,10 @@ eval_queue_handler(evPtr, flags)
*(q->done) = -1;
/* back to caller */
- if (RTEST(rb_funcall(q->thread, ID_alive_p, 0, 0))) {
- DUMP2("back to caller (caller thread:%lx)", q->thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
- rb_thread_run(q->thread);
- DUMP1("finish back to caller");
- } else {
- DUMP2("caller is dead (caller thread:%lx)", q->thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
- }
+ DUMP2("back to caller (caller thread:%lx)", q->thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
+ rb_thread_run(q->thread);
+ DUMP1("finish back to caller");
/* end of handler : remove it */
return 1;
@@ -5883,11 +4124,11 @@ ip_eval(self, str)
StringValue(str);
rb_thread_critical = thr_crit_bup;
- if (NIL_P(eventloop_thread) || current == eventloop_thread) {
- if (NIL_P(eventloop_thread)) {
- DUMP2("eval from thread:%lx but no eventloop", current);
- } else {
+ if (eventloop_thread == 0 || current == eventloop_thread) {
+ if (eventloop_thread) {
DUMP2("eval from current eventloop %lx", current);
+ } else {
+ DUMP2("eval from thread:%lx but no eventloop", current);
}
result = ip_eval_real(self, RSTRING(str)->ptr, RSTRING(str)->len);
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -5906,7 +4147,7 @@ ip_eval(self, str)
*alloc_done = 0;
eval_str = ALLOC_N(char, RSTRING(str)->len + 1);
- memcpy(eval_str, RSTRING(str)->ptr, RSTRING(str)->len);
+ strncpy(eval_str, RSTRING(str)->ptr, RSTRING(str)->len);
eval_str[RSTRING(str)->len] = 0;
/* allocate memory (freed by Tcl_ServiceEvent) */
@@ -5927,7 +4168,6 @@ ip_eval(self, str)
evq->thread = current;
evq->safe_level = rb_safe_level();
evq->ev.proc = eval_queue_handler;
-
position = TCL_QUEUE_TAIL;
/* add the handler to Tcl event queue */
@@ -5960,22 +4200,19 @@ ip_eval(self, str)
/* restart Tk */
static VALUE
-lib_restart_core(interp, argc, argv)
- VALUE interp;
- int argc; /* dummy */
- VALUE *argv; /* dummy */
+lib_restart(self)
+ VALUE self;
{
volatile VALUE exc;
- struct tcltkip *ptr = get_ip(interp);
+ struct tcltkip *ptr = get_ip(self);
int thr_crit_bup;
- /* rb_secure(4); */ /* already checked */
-
- /* tcl_stubs_check(); */ /* already checked */
+ rb_secure(4);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
- return rb_exc_new2(rb_eRuntimeError, "interpreter is deleted");
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
thr_crit_bup = rb_thread_critical;
@@ -5990,13 +4227,11 @@ lib_restart_core(interp, argc, argv)
DUMP2("(TCL_Eval result) %d", ptr->return_value);
Tcl_ResetResult(ptr->ip);
-#if TCL_MAJOR_VERSION >= 8
/* delete namespace ( tested on tk8.4.5 ) */
ptr->return_value = Tcl_Eval(ptr->ip, "namespace delete ::tk::msgcat");
/* ignore ERROR */
DUMP2("(TCL_Eval result) %d", ptr->return_value);
Tcl_ResetResult(ptr->ip);
-#endif
/* delete trace proc ( tested on tk8.4.5 ) */
ptr->return_value = Tcl_Eval(ptr->ip, "trace vdelete ::tk_strictMotif w ::tk::EventMotifBindings");
@@ -6004,39 +4239,43 @@ lib_restart_core(interp, argc, argv)
DUMP2("(TCL_Eval result) %d", ptr->return_value);
Tcl_ResetResult(ptr->ip);
- /* execute Tk_Init or Tk_SafeInit */
- exc = tcltkip_init_tk(interp);
- if (!NIL_P(exc)) {
- rb_thread_critical = thr_crit_bup;
+ /* execute Tk_Init of Tk_SafeInit */
+#if TCL_MAJOR_VERSION >= 8
+ if (Tcl_IsSafe(ptr->ip)) {
+ DUMP1("Tk_SafeInit");
+ if (Tk_SafeInit(ptr->ip) == TCL_ERROR) {
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ rb_exc_raise(exc);
+ }
+ } else {
+ DUMP1("Tk_Init");
+ if (Tk_Init(ptr->ip) == TCL_ERROR) {
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ rb_exc_raise(exc);
+ }
+ }
+#else /* TCL_MAJOR_VERSION < 8 */
+ DUMP1("Tk_Init");
+ if (Tk_Init(ptr->ip) == TCL_ERROR) {
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+ /* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
- return exc;
+ rb_exc_raise(exc);
}
+#endif
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
- /* return Qnil; */
- return interp;
-}
-
-static VALUE
-lib_restart(self)
- VALUE self;
-{
- struct tcltkip *ptr = get_ip(self);
-
- rb_secure(4);
-
- tcl_stubs_check();
-
- /* ip is deleted? */
- if (deleted_ip(ptr)) {
- rb_raise(rb_eRuntimeError, "interpreter is deleted");
- }
-
- return tk_funcall(lib_restart_core, 0, (VALUE*)NULL, self);
+ return Qnil;
}
@@ -6048,10 +4287,9 @@ ip_restart(self)
rb_secure(4);
- tcl_stubs_check();
-
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
@@ -6078,25 +4316,16 @@ lib_toUTF8_core(ip_obj, src, encodename)
struct tcltkip *ptr;
char *buf;
int thr_crit_bup;
-#endif
-
- tcl_stubs_check();
- if (NIL_P(src)) {
- return rb_str_new2("");
- }
-
-#ifdef TCL_UTF_MAX
if (NIL_P(ip_obj)) {
interp = (Tcl_Interp *)NULL;
} else {
- ptr = get_ip(ip_obj);
+ interp = get_ip(ip_obj)->ip;
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(interp)) {
+ DUMP1("ip is deleted");
interp = (Tcl_Interp *)NULL;
- } else {
- interp = ptr->ip;
}
}
@@ -6106,12 +4335,18 @@ lib_toUTF8_core(ip_obj, src, encodename)
if (NIL_P(encodename)) {
if (TYPE(str) == T_STRING) {
volatile VALUE enc;
- enc = rb_attr_get(str, ID_at_enc);
+
+ enc = Qnil;
+ if (RTEST(rb_ivar_defined(str, ID_at_enc))) {
+ enc = rb_ivar_get(str, ID_at_enc);
+ }
if (NIL_P(enc)) {
if (NIL_P(ip_obj)) {
encoding = (Tcl_Encoding)NULL;
} else {
- enc = rb_attr_get(ip_obj, ID_at_enc);
+ if (RTEST(rb_ivar_defined(ip_obj, ID_at_enc))) {
+ enc = rb_ivar_get(ip_obj, ID_at_enc);
+ }
if (NIL_P(enc)) {
encoding = (Tcl_Encoding)NULL;
} else {
@@ -6154,8 +4389,9 @@ lib_toUTF8_core(ip_obj, src, encodename)
rb_thread_critical = thr_crit_bup;
return str;
}
+
buf = ALLOC_N(char,(RSTRING(str)->len)+1);
- memcpy(buf, RSTRING(str)->ptr, RSTRING(str)->len);
+ strncpy(buf, RSTRING(str)->ptr, RSTRING(str)->len);
buf[RSTRING(str)->len] = 0;
Tcl_DStringInit(&dstr);
@@ -6164,8 +4400,7 @@ lib_toUTF8_core(ip_obj, src, encodename)
Tcl_ExternalToUtfDString(encoding, buf, RSTRING(str)->len, &dstr);
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
- /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
- str = rb_str_new(Tcl_DStringValue(&dstr), Tcl_DStringLength(&dstr));
+ str = rb_str_new2(Tcl_DStringValue(&dstr));
rb_ivar_set(str, ID_at_enc, rb_tainted_str_new2("utf-8"));
if (taint_flag) OBJ_TAINT(str);
@@ -6225,19 +4460,9 @@ lib_fromUTF8_core(ip_obj, src, encodename)
int taint_flag = OBJ_TAINTED(str);
char *buf;
int thr_crit_bup;
-#endif
- tcl_stubs_check();
-
- if (NIL_P(src)) {
- return rb_str_new2("");
- }
-
-#ifdef TCL_UTF_MAX
if (NIL_P(ip_obj)) {
interp = (Tcl_Interp *)NULL;
- } else if (get_ip(ip_obj) == (struct tcltkip *)NULL) {
- interp = (Tcl_Interp *)NULL;
} else {
interp = get_ip(ip_obj)->ip;
}
@@ -6249,20 +4474,23 @@ lib_fromUTF8_core(ip_obj, src, encodename)
volatile VALUE enc;
if (TYPE(str) == T_STRING) {
- enc = rb_attr_get(str, ID_at_enc);
- if (!NIL_P(enc)) {
- StringValue(enc);
- if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
- rb_thread_critical = thr_crit_bup;
- return str;
- }
+ enc = Qnil;
+ if (RTEST(rb_ivar_defined(str, ID_at_enc))) {
+ enc = rb_ivar_get(str, ID_at_enc);
+ }
+ if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
+ rb_thread_critical = thr_crit_bup;
+ return str;
}
}
if (NIL_P(ip_obj)) {
encoding = (Tcl_Encoding)NULL;
} else {
- enc = rb_attr_get(ip_obj, ID_at_enc);
+ enc = Qnil;
+ if (RTEST(rb_ivar_defined(ip_obj, ID_at_enc))) {
+ enc = rb_ivar_get(ip_obj, ID_at_enc);
+ }
if (NIL_P(enc)) {
encoding = (Tcl_Encoding)NULL;
} else {
@@ -6283,7 +4511,6 @@ lib_fromUTF8_core(ip_obj, src, encodename)
char *s;
int len;
- StringValue(str);
s = Tcl_GetByteArrayFromObj(Tcl_NewStringObj(RSTRING(str)->ptr,
RSTRING(str)->len),
&len);
@@ -6314,7 +4541,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
}
buf = ALLOC_N(char,strlen(RSTRING(str)->ptr)+1);
- memcpy(buf, RSTRING(str)->ptr, RSTRING(str)->len);
+ strncpy(buf, RSTRING(str)->ptr, RSTRING(str)->len);
buf[RSTRING(str)->len] = 0;
Tcl_DStringInit(&dstr);
@@ -6323,8 +4550,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
Tcl_UtfToExternalDString(encoding,buf,RSTRING(str)->len,&dstr);
/* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
- /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
- str = rb_str_new(Tcl_DStringValue(&dstr), Tcl_DStringLength(&dstr));
+ str = rb_str_new2(Tcl_DStringValue(&dstr));
rb_ivar_set(str, ID_at_enc, encodename);
if (taint_flag) OBJ_TAINT(str);
@@ -6382,8 +4608,6 @@ lib_UTF_backslash_core(self, str, all_bs)
int taint_flag = OBJ_TAINTED(str);
int thr_crit_bup;
- tcl_stubs_check();
-
StringValue(str);
if (!RSTRING(str)->len) {
return str;
@@ -6393,7 +4617,7 @@ lib_UTF_backslash_core(self, str, all_bs)
rb_thread_critical = Qtrue;
src_buf = ALLOC_N(char,(RSTRING(str)->len)+1);
- memcpy(src_buf, RSTRING(str)->ptr, RSTRING(str)->len);
+ strncpy(src_buf, RSTRING(str)->ptr, RSTRING(str)->len);
src_buf[RSTRING(str)->len] = 0;
dst_buf = ALLOC_N(char,(RSTRING(str)->len)+1);
@@ -6436,111 +4660,6 @@ lib_Tcl_backslash(self, str)
return lib_UTF_backslash_core(self, str, 1);
}
-static VALUE
-lib_get_system_encoding(self)
- VALUE self;
-{
-#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
- tcl_stubs_check();
- return rb_str_new2(Tcl_GetEncodingName((Tcl_Encoding)NULL));
-#else
- return Qnil;
-#endif
-}
-
-static VALUE
-lib_set_system_encoding(self, enc_name)
- VALUE self;
- VALUE enc_name;
-{
-#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
- tcl_stubs_check();
-
- if (NIL_P(enc_name)) {
- Tcl_SetSystemEncoding((Tcl_Interp *)NULL, (CONST char *)NULL);
- return lib_get_system_encoding(self);
- }
-
- enc_name = rb_funcall(enc_name, ID_to_s, 0, 0);
- if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
- StringValuePtr(enc_name)) != TCL_OK) {
- rb_raise(rb_eArgError, "unknown encoding name '%s'",
- RSTRING(enc_name)->ptr);
- }
-
- return enc_name;
-#else
- return Qnil;
-#endif
-}
-
-
-/* invoke Tcl proc */
-struct invoke_info {
- struct tcltkip *ptr;
- Tcl_CmdInfo cmdinfo;
-#if TCL_MAJOR_VERSION >= 8
- int objc;
- Tcl_Obj **objv;
-#else
- int argc;
- char **argv;
-#endif
-};
-
-static VALUE
-invoke_tcl_proc(arg)
- VALUE arg;
-{
- struct invoke_info *inf = (struct invoke_info *)arg;
- int i, len;
-#if TCL_MAJOR_VERSION >= 8
- int argc = inf->objc;
- char **argv = (char **)NULL;
-#endif
-
- /* memory allocation for arguments of this command */
-#if TCL_MAJOR_VERSION >= 8
- if (!inf->cmdinfo.isNativeObjectProc) {
- /* string interface */
- argv = (char **)ALLOC_N(char *, argc+1);
- for (i = 0; i < argc; ++i) {
- argv[i] = Tcl_GetStringFromObj(inf->objv[i], &len);
- }
- argv[argc] = (char *)NULL;
- }
-#endif
-
- Tcl_ResetResult(inf->ptr->ip);
-
- /* Invoke the C procedure */
-#if TCL_MAJOR_VERSION >= 8
- if (inf->cmdinfo.isNativeObjectProc) {
- inf->ptr->return_value
- = (*(inf->cmdinfo.objProc))(inf->cmdinfo.objClientData,
- inf->ptr->ip, inf->objc, inf->objv);
- }
- else
-#endif
- {
-#if TCL_MAJOR_VERSION >= 8
- inf->ptr->return_value
- = (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip,
- argc, (CONST84 char **)argv);
-
- free(argv);
-
-#else /* TCL_MAJOR_VERSION < 8 */
- inf->ptr->return_value
- = (*(inf->cmdinfo.proc))(inf->cmdinfo.clientData, inf->ptr->ip,
- inf->argc, inf->argv);
-#endif
- }
-
- return Qnil;
-}
-
-
#if TCL_MAJOR_VERSION >= 8
static VALUE
ip_invoke_core(interp, objc, objv)
@@ -6556,22 +4675,17 @@ ip_invoke_core(interp, argc, argv)
#endif
{
struct tcltkip *ptr;
+ int i;
Tcl_CmdInfo info;
char *cmd;
+ char *s;
int len;
int thr_crit_bup;
- int unknown_flag = 0;
-#if 1 /* wrap tcl-proc call */
- struct invoke_info inf;
- int status;
- VALUE ret;
-#else
#if TCL_MAJOR_VERSION >= 8
int argc = objc;
char **argv = (char **)NULL;
- /* Tcl_Obj *resultPtr; */
-#endif
+ Tcl_Obj *resultPtr;
#endif
/* get the command name string */
@@ -6585,67 +4699,28 @@ ip_invoke_core(interp, argc, argv)
ptr = get_ip(interp);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return rb_tainted_str_new2("");
}
- /* Tcl_Preserve(ptr->ip); */
- rbtk_preserve_ip(ptr);
-
/* map from the command name to a C procedure */
DUMP2("call Tcl_GetCommandInfo, %s", cmd);
if (!Tcl_GetCommandInfo(ptr->ip, cmd, &info)) {
DUMP1("error Tcl_GetCommandInfo");
- DUMP1("try auto_load (call 'unknown' command)");
- if (!Tcl_GetCommandInfo(ptr->ip,
-#if TCL_MAJOR_VERSION >= 8
- "::unknown",
-#else
- "unknown",
-#endif
- &info)) {
- DUMP1("fail to get 'unknown' command");
- /* if (event_loop_abort_on_exc || cmd[0] != '.') { */
- if (event_loop_abort_on_exc > 0) {
- /* Tcl_Release(ptr->ip); */
- rbtk_release_ip(ptr);
- /*rb_ip_raise(obj,rb_eNameError,"invalid command name `%s'",cmd);*/
- return create_ip_exc(interp, rb_eNameError,
- "invalid command name `%s'", cmd);
+ /* if (event_loop_abort_on_exc || cmd[0] != '.') { */
+ if (event_loop_abort_on_exc > 0) {
+ /*rb_ip_raise(obj,rb_eNameError,"invalid command name `%s'",cmd);*/
+ return create_ip_exc(interp, rb_eNameError,
+ "invalid command name `%s'", cmd);
+ } else {
+ if (event_loop_abort_on_exc < 0) {
+ rb_warning("invalid command name `%s' (ignore)", cmd);
} else {
- if (event_loop_abort_on_exc < 0) {
- rb_warning("invalid command name `%s' (ignore)", cmd);
- } else {
- rb_warn("invalid command name `%s' (ignore)", cmd);
- }
- Tcl_ResetResult(ptr->ip);
- /* Tcl_Release(ptr->ip); */
- rbtk_release_ip(ptr);
- return rb_tainted_str_new2("");
+ rb_warn("invalid command name `%s' (ignore)", cmd);
}
- } else {
-#if TCL_MAJOR_VERSION >= 8
- Tcl_Obj **unknown_objv;
-#else
- char **unknown_argv;
-#endif
- DUMP1("find 'unknown' command -> set arguemnts");
- unknown_flag = 1;
-
-#if TCL_MAJOR_VERSION >= 8
- unknown_objv = (Tcl_Obj **)ALLOC_N(Tcl_Obj *, objc+2);
- unknown_objv[0] = Tcl_NewStringObj("::unknown", 9);
- Tcl_IncrRefCount(unknown_objv[0]);
- memcpy(unknown_objv + 1, objv, sizeof(Tcl_Obj *)*objc);
- unknown_objv[++objc] = (Tcl_Obj*)NULL;
- objv = unknown_objv;
-#else
- unknown_argv = (char **)ALLOC_N(char *, argc+2);
- unknown_argv[0] = strdup("unknown");
- memcpy(unknown_argv + 1, argv, sizeof(char *)*argc);
- unknown_argv[++argc] = (char *)NULL;
- argv = unknown_argv;
-#endif
+ Tcl_ResetResult(ptr->ip);
+ return rb_tainted_str_new2("");
}
}
DUMP1("end Tcl_GetCommandInfo");
@@ -6653,46 +4728,9 @@ ip_invoke_core(interp, argc, argv)
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
-
-#if 1 /* wrap tcl-proc call */
- /* setup params */
- inf.ptr = ptr;
- inf.cmdinfo = info;
-#if TCL_MAJOR_VERSION >= 8
- inf.objc = objc;
- inf.objv = objv;
-#else
- inf.argc = argc;
- inf.argv = argv;
-#endif
-
- /* invoke tcl-proc */
- ret = rb_protect(invoke_tcl_proc, (VALUE)&inf, &status);
- switch(status) {
- case TAG_RAISE:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception = rb_exc_new2(rb_eException,
- "unknown exception");
- } else {
- rbtk_pending_exception = ruby_errinfo;
- }
- break;
-
- case TAG_FATAL:
- if (NIL_P(ruby_errinfo)) {
- rbtk_pending_exception = rb_exc_new2(rb_eFatal, "FATAL");
- } else {
- rbtk_pending_exception = ruby_errinfo;
- }
- }
-
-#else /* !wrap tcl-proc call */
-
/* memory allocation for arguments of this command */
#if TCL_MAJOR_VERSION >= 8
if (!info.isNativeObjectProc) {
- int i;
-
/* string interface */
argv = (char **)ALLOC_N(char *, argc+1);
for (i = 0; i < argc; ++i) {
@@ -6730,36 +4768,32 @@ ip_invoke_core(interp, argc, argv)
argc, argv);
#endif
}
-#endif /* ! wrap tcl-proc call */
-
- /* free allocated memory for calling 'unknown' command */
- if (unknown_flag) {
-#if TCL_MAJOR_VERSION >= 8
- Tcl_DecrRefCount(objv[0]);
- free(objv);
-#else
- free(argv[0]);
- free(argv);
-#endif
- }
-
- /* exception on mainloop */
- if (pending_exception_check1(thr_crit_bup, ptr)) {
- return rbtk_pending_exception;
- }
rb_thread_critical = thr_crit_bup;
+ /* exception on mainloop */
if (ptr->return_value == TCL_ERROR) {
if (event_loop_abort_on_exc > 0 && !Tcl_InterpDeleted(ptr->ip)) {
-
+#if TCL_MAJOR_VERSION >= 8
return create_ip_exc(interp, rb_eRuntimeError,
"%s", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ return create_ip_exc(interp, rb_eRuntimeError,
+ "%s", ptr->ip->result);
+#endif
} else {
if (event_loop_abort_on_exc < 0) {
+#if TCL_MAJOR_VERSION >= 8
rb_warning("%s (ignore)", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_warning("%s (ignore)", ptr->ip->result);
+#endif
} else {
+#if TCL_MAJOR_VERSION >= 8
rb_warn("%s (ignore)", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_warn("%s (ignore)", ptr->ip->result);
+#endif
}
Tcl_ResetResult(ptr->ip);
return rb_tainted_str_new2("");
@@ -6781,12 +4815,15 @@ alloc_invoke_arguments(argc, argv)
VALUE *argv;
{
int i;
+ VALUE v;
+ char *s;
int thr_crit_bup;
#if TCL_MAJOR_VERSION >= 8
- Tcl_Obj **av;
+ Tcl_Obj **av = (Tcl_Obj **)NULL;
+ Tcl_Obj *resultPtr;
#else /* TCL_MAJOR_VERSION < 8 */
- char **av;
+ char **av = (char **)NULL;
#endif
thr_crit_bup = rb_thread_critical;
@@ -6794,20 +4831,45 @@ alloc_invoke_arguments(argc, argv)
/* memory allocation */
#if TCL_MAJOR_VERSION >= 8
- av = ALLOC_N(Tcl_Obj *, argc+1);
+ av = (Tcl_Obj **)ALLOC_N(Tcl_Obj *, argc+1);
for (i = 0; i < argc; ++i) {
- av[i] = get_obj_from_str(argv[i]);
+ VALUE enc;
+
+ v = argv[i];
+ s = StringValuePtr(v);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ av[i] = Tcl_NewStringObj(s, RSTRING(v)->len);
+# else /* TCL_VERSION >= 8.1 */
+ enc = Qnil;
+ if (RTEST(rb_ivar_defined(v, ID_at_enc))) {
+ enc = rb_ivar_get(v, ID_at_enc);
+ }
+ if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
+ /* binary string */
+ av[i] = Tcl_NewByteArrayObj(s, RSTRING(v)->len);
+ } else if (strlen(s) != RSTRING(v)->len) {
+ /* probably binary string */
+ av[i] = Tcl_NewByteArrayObj(s, RSTRING(v)->len);
+ } else {
+ /* probably text string */
+ av[i] = Tcl_NewStringObj(s, RSTRING(v)->len);
+ }
+# endif
Tcl_IncrRefCount(av[i]);
}
- av[argc] = NULL;
+ av[argc] = (Tcl_Obj *)NULL;
#else /* TCL_MAJOR_VERSION < 8 */
/* string interface */
- av = ALLOC_N(char *, argc+1);
+ av = (char **)ALLOC_N(char *, argc+1);
for (i = 0; i < argc; ++i) {
- av[i] = strdup(StringValuePtr(argv[i]));
+ v = argv[i];
+ s = StringValuePtr(v);
+ av[i] = ALLOC_N(char, strlen(s)+1);
+ strcpy(av[i], s);
}
- av[argc] = NULL;
+ av[argc] = (char *)NULL;
#endif
rb_thread_critical = thr_crit_bup;
@@ -6844,26 +4906,33 @@ ip_invoke_real(argc, argv, interp)
{
VALUE v;
struct tcltkip *ptr; /* tcltkip data struct */
+ int i;
+ Tcl_CmdInfo info;
+ char *s;
+ int len;
+ int thr_crit_bup;
#if TCL_MAJOR_VERSION >= 8
Tcl_Obj **av = (Tcl_Obj **)NULL;
+ Tcl_Obj *resultPtr;
#else /* TCL_MAJOR_VERSION < 8 */
char **av = (char **)NULL;
#endif
DUMP2("invoke_real called by thread:%lx", rb_thread_current());
+ /* allocate memory for arguments */
+ av = alloc_invoke_arguments(argc, argv);
+
/* get the data struct */
ptr = get_ip(interp);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return rb_tainted_str_new2("");
}
- /* allocate memory for arguments */
- av = alloc_invoke_arguments(argc, argv);
-
/* Invoke the C procedure */
Tcl_ResetResult(ptr->ip);
v = ip_invoke_core(interp, argc, av);
@@ -6931,15 +5000,10 @@ invoke_queue_handler(evPtr, flags)
*(q->done) = -1;
/* back to caller */
- if (RTEST(rb_funcall(q->thread, ID_alive_p, 0, 0))) {
- DUMP2("back to caller (caller thread:%lx)", q->thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
- rb_thread_run(q->thread);
- DUMP1("finish back to caller");
- } else {
- DUMP2("caller is dead (caller thread:%lx)", q->thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
- }
+ DUMP2("back to caller (caller thread:%lx)", q->thread);
+ DUMP2(" (current thread:%lx)", rb_thread_current());
+ rb_thread_run(q->thread);
+ DUMP1("finish back to caller");
/* end of handler : remove it */
return 1;
@@ -6953,6 +5017,9 @@ ip_invoke_with_position(argc, argv, obj, position)
Tcl_QueuePosition position;
{
struct invoke_queue *ivq;
+ char *s;
+ int len;
+ int i;
int *alloc_done;
int thr_crit_bup;
volatile VALUE current = rb_thread_current();
@@ -6969,11 +5036,11 @@ ip_invoke_with_position(argc, argv, obj, position)
if (argc < 1) {
rb_raise(rb_eArgError, "command name missing");
}
- if (NIL_P(eventloop_thread) || current == eventloop_thread) {
- if (NIL_P(eventloop_thread)) {
- DUMP2("invoke from thread:%lx but no eventloop", current);
- } else {
+ if (eventloop_thread == 0 || current == eventloop_thread) {
+ if (eventloop_thread) {
DUMP2("invoke from current eventloop %lx", current);
+ } else {
+ DUMP2("invoke from thread:%lx but no eventloop", current);
}
result = ip_invoke_real(argc, argv, ip_obj);
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -7057,7 +5124,8 @@ ip_retval(self)
ptr = get_ip(self);
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return rb_tainted_str_new2("");
}
@@ -7079,97 +5147,125 @@ ip_invoke_immediate(argc, argv, obj)
VALUE *argv;
VALUE obj;
{
- /* POTENTIALY INSECURE : can create infinite loop */
- rb_secure(4);
return ip_invoke_with_position(argc, argv, obj, TCL_QUEUE_HEAD);
}
-
/* access Tcl variables */
static VALUE
-ip_get_variable2_core(interp, argc, argv)
- VALUE interp;
- int argc;
- VALUE *argv;
+ip_get_variable(self, varname_arg, flag_arg)
+ VALUE self;
+ VALUE varname_arg;
+ VALUE flag_arg;
{
- struct tcltkip *ptr = get_ip(interp);
+ struct tcltkip *ptr = get_ip(self);
int thr_crit_bup;
- volatile VALUE varname, index, flag;
+ volatile VALUE varname, flag;
- varname = argv[0];
- index = argv[1];
- flag = argv[2];
+ varname = varname_arg;
+ flag = flag_arg;
- /*
StringValue(varname);
- if (!NIL_P(index)) StringValue(index);
- */
#if TCL_MAJOR_VERSION >= 8
{
- Tcl_Obj *ret;
+ Tcl_Obj *nameobj, *ret;
+ char *s;
+ int len;
volatile VALUE strval;
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
+ nameobj = Tcl_NewStringObj(RSTRING(varname)->ptr,
+ RSTRING(varname)->len);
+ Tcl_IncrRefCount(nameobj);
+
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ Tcl_DecrRefCount(nameobj);
rb_thread_critical = thr_crit_bup;
return rb_tainted_str_new2("");
} else {
/* Tcl_Preserve(ptr->ip); */
rbtk_preserve_ip(ptr);
- ret = Tcl_GetVar2Ex(ptr->ip, RSTRING(varname)->ptr,
- NIL_P(index) ? NULL : RSTRING(index)->ptr,
- FIX2INT(flag));
+ ret = Tcl_ObjGetVar2(ptr->ip, nameobj, (Tcl_Obj*)NULL,
+ FIX2INT(flag));
}
+ Tcl_DecrRefCount(nameobj);
+
if (ret == (Tcl_Obj*)NULL) {
volatile VALUE exc;
- /* exc = rb_exc_new2(rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip)); */
- exc = create_ip_exc(interp, rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip));
+#if TCL_MAJOR_VERSION >= 8
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+#endif
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
- return exc;
+ rb_exc_raise(exc);
}
Tcl_IncrRefCount(ret);
- strval = get_str_from_obj(ret);
- OBJ_TAINT(strval);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
Tcl_DecrRefCount(ret);
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ return(strval);
+
+# else /* TCL_VERSION >= 8.1 */
+ if (Tcl_GetCharLength(ret)
+ != Tcl_UniCharLen(Tcl_GetUnicode(ret))) {
+ /* possibly binary string */
+ s = Tcl_GetByteArrayFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ rb_ivar_set(strval, ID_at_enc, rb_tainted_str_new2("binary"));
+ } else {
+ /* possibly text string */
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ }
+ Tcl_DecrRefCount(ret);
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
+
return(strval);
+# endif
}
#else /* TCL_MAJOR_VERSION < 8 */
{
char *ret;
- volatile VALUE strval;
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return rb_tainted_str_new2("");
} else {
/* Tcl_Preserve(ptr->ip); */
rbtk_preserve_ip(ptr);
ret = Tcl_GetVar2(ptr->ip, RSTRING(varname)->ptr,
- NIL_P(index) ? NULL : RSTRING(index)->ptr,
- FIX2INT(flag));
+ (char*)NULL, FIX2INT(flag));
}
if (ret == (char*)NULL) {
volatile VALUE exc;
+#if TCL_MAJOR_VERSION >= 8
exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+#endif
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
- return exc;
+ rb_exc_raise(exc);
}
strval = rb_tainted_str_new2(ret);
@@ -7183,102 +5279,260 @@ ip_get_variable2_core(interp, argc, argv)
}
static VALUE
-ip_get_variable2(self, varname, index, flag)
+ip_get_variable2(self, varname_arg, index_arg, flag_arg)
VALUE self;
- VALUE varname;
- VALUE index;
- VALUE flag;
+ VALUE varname_arg;
+ VALUE index_arg;
+ VALUE flag_arg;
{
- VALUE argv[3];
- VALUE retval;
+ struct tcltkip *ptr = get_ip(self);
+ int thr_crit_bup;
+ volatile VALUE varname, index, flag;
+
+ if (NIL_P(index_arg)) {
+ return ip_get_variable(self, varname_arg, flag_arg);
+ }
+
+ varname = varname_arg;
+ index = index_arg;
+ flag = flag_arg;
StringValue(varname);
- if (!NIL_P(index)) StringValue(index);
+ StringValue(index);
+
+#if TCL_MAJOR_VERSION >= 8
+ {
+ Tcl_Obj *nameobj, *idxobj, *ret;
+ char *s;
+ int len;
+ volatile VALUE strval;
- argv[0] = varname;
- argv[1] = index;
- argv[2] = flag;
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
- retval = tk_funcall(ip_get_variable2_core, 3, argv, self);
+ nameobj = Tcl_NewStringObj(RSTRING(varname)->ptr,
+ RSTRING(varname)->len);
+ Tcl_IncrRefCount(nameobj);
+ idxobj = Tcl_NewStringObj(RSTRING(index)->ptr, RSTRING(index)->len);
+ Tcl_IncrRefCount(idxobj);
- if (NIL_P(retval)) {
- return rb_tainted_str_new2("");
- } else {
- return retval;
+ /* ip is deleted? */
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ Tcl_DecrRefCount(nameobj);
+ Tcl_DecrRefCount(idxobj);
+ rb_thread_critical = thr_crit_bup;
+ return rb_tainted_str_new2("");
+ } else {
+ /* Tcl_Preserve(ptr->ip); */
+ rbtk_preserve_ip(ptr);
+ ret = Tcl_ObjGetVar2(ptr->ip, nameobj, idxobj, FIX2INT(flag));
+ }
+
+ Tcl_DecrRefCount(nameobj);
+ Tcl_DecrRefCount(idxobj);
+
+ if (ret == (Tcl_Obj*)NULL) {
+ volatile VALUE exc;
+#if TCL_MAJOR_VERSION >= 8
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+#endif
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ rb_exc_raise(exc);
+ }
+
+ Tcl_IncrRefCount(ret);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ Tcl_DecrRefCount(ret);
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ return(strval);
+
+# else /* TCL_VERSION >= 8.1 */
+ if (Tcl_GetCharLength(ret)
+ != Tcl_UniCharLen(Tcl_GetUnicode(ret))) {
+ /* possibly binary string */
+ s = Tcl_GetByteArrayFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ rb_ivar_set(strval, ID_at_enc, rb_tainted_str_new2("binary"));
+ } else {
+ /* possibly text string */
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ }
+
+ Tcl_DecrRefCount(ret);
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+
+ return(strval);
+# endif
}
-}
+#else /* TCL_MAJOR_VERSION < 8 */
+ {
+ char *ret;
-static VALUE
-ip_get_variable(self, varname, flag)
- VALUE self;
- VALUE varname;
- VALUE flag;
-{
- return ip_get_variable2(self, varname, Qnil, flag);
+ /* ip is deleted? */
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ return rb_tainted_str_new2("");
+ } else {
+ /* Tcl_Preserve(ptr->ip); */
+ rbtk_preserve_ip(ptr);
+ ret = Tcl_GetVar2(ptr->ip, RSTRING(varname)->ptr,
+ RSTRING(index)->ptr, FIX2INT(flag));
+ }
+
+ if (ret == (char*)NULL) {
+ volatile VALUE exc;
+#if TCL_MAJOR_VERSION >= 8
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+#endif
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ rb_exc_raise(exc);
+ }
+
+ strval = rb_tainted_str_new2(ret);
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+
+ return(strval);
+ }
+#endif
}
static VALUE
-ip_set_variable2_core(interp, argc, argv)
- VALUE interp;
- int argc;
- VALUE *argv;
+ip_set_variable(self, varname_arg, value_arg, flag_arg)
+ VALUE self;
+ VALUE varname_arg;
+ VALUE value_arg;
+ VALUE flag_arg;
{
- struct tcltkip *ptr = get_ip(interp);
+ struct tcltkip *ptr = get_ip(self);
int thr_crit_bup;
- volatile VALUE varname, index, value, flag;
+ volatile VALUE varname, value, flag;
- varname = argv[0];
- index = argv[1];
- value = argv[2];
- flag = argv[3];
-
- /*
+ varname = varname_arg;
+ value = value_arg;
+ flag = flag_arg;
+
StringValue(varname);
- if (!NIL_P(index)) StringValue(index);
StringValue(value);
- */
#if TCL_MAJOR_VERSION >= 8
{
- Tcl_Obj *valobj, *ret;
+ Tcl_Obj *nameobj, *valobj, *ret;
+ char *s;
+ int len;
volatile VALUE strval;
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
- valobj = get_obj_from_str(value);
+ nameobj = Tcl_NewStringObj(RSTRING(varname)->ptr,
+ RSTRING(varname)->len);
+
+ Tcl_IncrRefCount(nameobj);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ valobj = Tcl_NewStringObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
Tcl_IncrRefCount(valobj);
+# else /* TCL_VERSION >= 8.1 */
+ {
+ volatile VALUE enc = Qnil;
+
+ if (RTEST(rb_ivar_defined(value, ID_at_enc))) {
+ enc = rb_ivar_get(value, ID_at_enc);
+ }
+
+ if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
+ /* binary string */
+ valobj = Tcl_NewByteArrayObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+ } else if (strlen(RSTRING(value)->ptr) != RSTRING(value)->len) {
+ /* probably binary string */
+ valobj = Tcl_NewByteArrayObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+ } else {
+ /* probably text string */
+ valobj = Tcl_NewStringObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+ }
+
+ Tcl_IncrRefCount(valobj);
+ }
+# endif
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ Tcl_DecrRefCount(nameobj);
Tcl_DecrRefCount(valobj);
rb_thread_critical = thr_crit_bup;
return rb_tainted_str_new2("");
} else {
/* Tcl_Preserve(ptr->ip); */
rbtk_preserve_ip(ptr);
- ret = Tcl_SetVar2Ex(ptr->ip, RSTRING(varname)->ptr,
- NIL_P(index) ? NULL : RSTRING(index)->ptr,
- valobj, FIX2INT(flag));
+ ret = Tcl_ObjSetVar2(ptr->ip, nameobj, (Tcl_Obj*)NULL, valobj,
+ FIX2INT(flag));
}
+ Tcl_DecrRefCount(nameobj);
Tcl_DecrRefCount(valobj);
if (ret == (Tcl_Obj*)NULL) {
volatile VALUE exc;
- /* exc = rb_exc_new2(rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip)); */
- exc = create_ip_exc(interp, rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip));
+#if TCL_MAJOR_VERSION >= 8
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+#endif
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
- return exc;
+ rb_exc_raise(exc);
}
Tcl_IncrRefCount(ret);
- strval = get_str_from_obj(ret);
- OBJ_TAINT(strval);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+# else /* TCL_VERSION >= 8.1 */
+ {
+ VALUE old_gc;
+
+ old_gc = rb_gc_disable();
+
+ if (Tcl_GetCharLength(ret) != Tcl_UniCharLen(Tcl_GetUnicode(ret))) {
+ /* possibly binary string */
+ s = Tcl_GetByteArrayFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ rb_ivar_set(strval, ID_at_enc, rb_str_new2("binary"));
+ } else {
+ /* possibly text string */
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ }
+ if (old_gc == Qfalse) rb_gc_enable();
+ }
+# endif
+
Tcl_DecrRefCount(ret);
/* Tcl_Release(ptr->ip); */
@@ -7290,25 +5544,23 @@ ip_set_variable2_core(interp, argc, argv)
#else /* TCL_MAJOR_VERSION < 8 */
{
CONST char *ret;
- volatile VALUE strval;
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return rb_tainted_str_new2("");
} else {
/* Tcl_Preserve(ptr->ip); */
rbtk_preserve_ip(ptr);
- ret = Tcl_SetVar2(ptr->ip, RSTRING(varname)->ptr,
- NIL_P(index) ? NULL : RSTRING(index)->ptr,
- RSTRING(value)->ptr, FIX2INT(flag));
+ ret = Tcl_SetVar2(ptr->ip, RSTRING(varname)->ptr, (char*)NULL,
+ RSTRING(value)->ptr, (int)FIX2INT(flag));
}
- if (ret == (char*)NULL) {
- return rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+ if (ret == NULL) {
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
}
strval = rb_tainted_str_new2(ret);
-
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
rb_thread_critical = thr_crit_bup;
@@ -7319,77 +5571,197 @@ ip_set_variable2_core(interp, argc, argv)
}
static VALUE
-ip_set_variable2(self, varname, index, value, flag)
+ip_set_variable2(self, varname_arg, index_arg, value_arg, flag_arg)
VALUE self;
- VALUE varname;
- VALUE index;
- VALUE value;
- VALUE flag;
+ VALUE varname_arg;
+ VALUE index_arg;
+ VALUE value_arg;
+ VALUE flag_arg;
{
- VALUE argv[4];
- VALUE retval;
+ struct tcltkip *ptr = get_ip(self);
+ int thr_crit_bup;
+ volatile VALUE varname, index, value, flag;
+
+ if (NIL_P(index_arg)) {
+ return ip_set_variable(self, varname_arg, value_arg, flag_arg);
+ }
+
+ varname = varname_arg;
+ index = index_arg;
+ value = value_arg;
+ flag = flag_arg;
StringValue(varname);
- if (!NIL_P(index)) StringValue(index);
+ StringValue(index);
StringValue(value);
- argv[0] = varname;
- argv[1] = index;
- argv[2] = value;
- argv[3] = flag;
+#if TCL_MAJOR_VERSION >= 8
+ {
+ Tcl_Obj *nameobj, *idxobj, *valobj, *ret;
+ char *s;
+ int len;
+ volatile VALUE strval;
- retval = tk_funcall(ip_set_variable2_core, 4, argv, self);
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
- if (NIL_P(retval)) {
- return rb_tainted_str_new2("");
- } else {
- return retval;
+ nameobj = Tcl_NewStringObj(RSTRING(varname)->ptr,
+ RSTRING(varname)->len);
+ Tcl_IncrRefCount(nameobj);
+
+ idxobj = Tcl_NewStringObj(RSTRING(index)->ptr,
+ RSTRING(index)->len);
+ Tcl_IncrRefCount(idxobj);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ valobj = Tcl_NewStringObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+# else /* TCL_VERSION >= 8.1 */
+ {
+ VALUE enc = Qnil;
+
+ if (RTEST(rb_ivar_defined(value, ID_at_enc))) {
+ enc = rb_ivar_get(value, ID_at_enc);
+ }
+
+ if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
+ /* binary string */
+ valobj = Tcl_NewByteArrayObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+ } else if (strlen(RSTRING(value)->ptr) != RSTRING(value)->len) {
+ /* probably binary string */
+ valobj = Tcl_NewByteArrayObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+ } else {
+ /* probably text string */
+ valobj = Tcl_NewStringObj(RSTRING(value)->ptr,
+ RSTRING(value)->len);
+ }
+ }
+
+# endif
+ Tcl_IncrRefCount(valobj);
+
+ /* ip is deleted? */
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ Tcl_DecrRefCount(nameobj);
+ Tcl_DecrRefCount(idxobj);
+ Tcl_DecrRefCount(valobj);
+ rb_thread_critical = thr_crit_bup;
+ return rb_tainted_str_new2("");
+ } else {
+ /* Tcl_Preserve(ptr->ip); */
+ rbtk_preserve_ip(ptr);
+ ret = Tcl_ObjSetVar2(ptr->ip, nameobj, idxobj, valobj,
+ FIX2INT(flag));
+ }
+
+ Tcl_DecrRefCount(nameobj);
+ Tcl_DecrRefCount(idxobj);
+ Tcl_DecrRefCount(valobj);
+
+ if (ret == (Tcl_Obj*)NULL) {
+ volatile VALUE exc;
+#if TCL_MAJOR_VERSION >= 8
+ exc = rb_exc_new2(rb_eRuntimeError, Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ exc = rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
+#endif
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+ rb_exc_raise(exc);
+ }
+
+ Tcl_IncrRefCount(ret);
+
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+# else /* TCL_VERSION >= 8.1 */
+ if (Tcl_GetCharLength(ret) != Tcl_UniCharLen(Tcl_GetUnicode(ret))) {
+ /* possibly binary string */
+ s = Tcl_GetByteArrayFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ rb_ivar_set(strval, ID_at_enc, rb_str_new2("binary"));
+ } else {
+ /* possibly text string */
+ s = Tcl_GetStringFromObj(ret, &len);
+ strval = rb_tainted_str_new(s, len);
+ }
+# endif
+
+ Tcl_DecrRefCount(ret);
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+
+ return(strval);
}
-}
+#else /* TCL_MAJOR_VERSION < 8 */
+ {
+ CONST char *ret;
-static VALUE
-ip_set_variable(self, varname, value, flag)
- VALUE self;
- VALUE varname;
- VALUE value;
- VALUE flag;
-{
- return ip_set_variable2(self, varname, Qnil, value, flag);
+ /* ip is deleted? */
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ return rb_tainted_str_new2("");
+ } else {
+ /* Tcl_Preserve(ptr->ip); */
+ rbtk_preserve_ip(ptr);
+ ret = Tcl_SetVar2(ptr->ip, RSTRING(varname)->ptr,
+ RSTRING(index)->ptr,
+ RSTRING(value)->ptr, FIX2INT(flag));
+ }
+
+ if (ret == (char*)NULL) {
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
+ }
+
+ Tcl_IncrRefCount(ret);
+
+ strval = rb_tainted_str_new2(ret);
+
+ Tcl_DecrRefCount(ret);
+ /* Tcl_Release(ptr->ip); */
+ rbtk_release_ip(ptr);
+ rb_thread_critical = thr_crit_bup;
+
+ return(strval);
+ }
+#endif
}
static VALUE
-ip_unset_variable2_core(interp, argc, argv)
- VALUE interp;
- int argc;
- VALUE *argv;
+ip_unset_variable(self, varname_arg, flag_arg)
+ VALUE self;
+ VALUE varname_arg;
+ VALUE flag_arg;
{
- struct tcltkip *ptr = get_ip(interp);
- volatile VALUE varname, index, flag;
+ struct tcltkip *ptr = get_ip(self);
+ volatile VALUE varname, value, flag;
- varname = argv[0];
- index = argv[1];
- flag = argv[2];
+ varname = varname_arg;
+ flag = flag_arg;
- /*
StringValue(varname);
- if (!NIL_P(index)) StringValue(index);
- */
/* ip is deleted? */
- if (deleted_ip(ptr)) {
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
return Qtrue;
}
- ptr->return_value = Tcl_UnsetVar2(ptr->ip, RSTRING(varname)->ptr,
- NIL_P(index) ? NULL : RSTRING(index)->ptr,
- FIX2INT(flag));
-
+ ptr->return_value = Tcl_UnsetVar(ptr->ip, RSTRING(varname)->ptr,
+ FIX2INT(flag));
if (ptr->return_value == TCL_ERROR) {
if (FIX2INT(flag) & TCL_LEAVE_ERR_MSG) {
- /* return rb_exc_new2(rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip)); */
- return create_ip_exc(interp, rb_eRuntimeError,
- Tcl_GetStringResult(ptr->ip));
+#if TCL_MAJOR_VERSION >= 8
+ rb_raise(rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
+#endif
}
return Qfalse;
}
@@ -7397,38 +5769,45 @@ ip_unset_variable2_core(interp, argc, argv)
}
static VALUE
-ip_unset_variable2(self, varname, index, flag)
+ip_unset_variable2(self, varname_arg, index_arg, flag_arg)
VALUE self;
- VALUE varname;
- VALUE index;
- VALUE flag;
+ VALUE varname_arg;
+ VALUE index_arg;
+ VALUE flag_arg;
{
- VALUE argv[3];
- VALUE retval;
+ struct tcltkip *ptr = get_ip(self);
+ volatile VALUE varname, index, value, flag;
- StringValue(varname);
- if (!NIL_P(index)) StringValue(index);
+ if (NIL_P(index_arg)) {
+ return ip_unset_variable(self, varname_arg, flag_arg);
+ }
- argv[0] = varname;
- argv[1] = index;
- argv[2] = flag;
+ varname = varname_arg;
+ index = index_arg;
+ flag = flag_arg;
- retval = tk_funcall(ip_unset_variable2_core, 3, argv, self);
+ StringValue(varname);
+ StringValue(index);
- if (NIL_P(retval)) {
- return rb_tainted_str_new2("");
- } else {
- return retval;
+ /* ip is deleted? */
+ if (Tcl_InterpDeleted(ptr->ip)) {
+ DUMP1("ip is deleted");
+ return Qtrue;
}
-}
-static VALUE
-ip_unset_variable(self, varname, flag)
- VALUE self;
- VALUE varname;
- VALUE flag;
-{
- return ip_unset_variable2(self, varname, Qnil, flag);
+ ptr->return_value = Tcl_UnsetVar2(ptr->ip, RSTRING(varname)->ptr,
+ RSTRING(index)->ptr, FIX2INT(flag));
+ if (ptr->return_value == TCL_ERROR) {
+ if (FIX2INT(flag) & TCL_LEAVE_ERR_MSG) {
+#if TCL_MAJOR_VERSION >= 8
+ rb_raise(rb_eRuntimeError, "%s", Tcl_GetStringResult(ptr->ip));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
+#endif
+ }
+ return Qfalse;
+ }
+ return Qtrue;
}
static VALUE
@@ -7504,12 +5883,8 @@ lib_split_tklist_core(ip_obj, list_str)
int result;
VALUE old_gc;
- tcl_stubs_check();
-
if (NIL_P(ip_obj)) {
interp = (Tcl_Interp *)NULL;
- } else if (get_ip(ip_obj) == (struct tcltkip *)NULL) {
- interp = (Tcl_Interp *)NULL;
} else {
interp = get_ip(ip_obj)->ip;
}
@@ -7524,7 +5899,43 @@ lib_split_tklist_core(ip_obj, list_str)
Tcl_Obj **objv;
int thr_crit_bup;
- listobj = get_obj_from_str(list_str);
+# if 1
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ listobj = Tcl_NewStringObj(RSTRING(list_str)->ptr,
+ RSTRING(list_str)->len);
+# else /* TCL_VERSION >= 8.1 */
+ thr_crit_bup = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+
+ {
+ VALUE enc = Qnil;
+
+ if (RTEST(rb_ivar_defined(list_str, ID_at_enc))) {
+ enc = rb_ivar_get(list_str, ID_at_enc);
+ }
+
+ if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
+ /* binary string */
+ listobj = Tcl_NewByteArrayObj(RSTRING(list_str)->ptr,
+ RSTRING(list_str)->len);
+ } else if (strlen(RSTRING(list_str)->ptr)
+ != RSTRING(list_str)->len) {
+ /* probably binary string */
+ listobj = Tcl_NewByteArrayObj(RSTRING(list_str)->ptr,
+ RSTRING(list_str)->len);
+ } else {
+ /* probably text string */
+ listobj = Tcl_NewStringObj(RSTRING(list_str)->ptr,
+ RSTRING(list_str)->len);
+ }
+ }
+
+ rb_thread_critical = thr_crit_bup;
+# endif
+# else
+ listobj = Tcl_NewStringObj(RSTRING(list_str)->ptr,
+ RSTRING(list_str)->len);
+# endif
Tcl_IncrRefCount(listobj);
@@ -7533,9 +5944,13 @@ lib_split_tklist_core(ip_obj, list_str)
if (result == TCL_ERROR) {
Tcl_DecrRefCount(listobj);
if (interp == (Tcl_Interp*)NULL) {
- rb_raise(rb_eRuntimeError, "can't get elements from list");
+ rb_raise(rb_eRuntimeError, "cannot get elements from list");
} else {
+#if TCL_MAJOR_VERSION >= 8
rb_raise(rb_eRuntimeError, "%s", Tcl_GetStringResult(interp));
+#else /* TCL_MAJOR_VERSION < 8 */
+ rb_raise(rb_eRuntimeError, "%s", interp->result);
+#endif
}
}
@@ -7552,7 +5967,31 @@ lib_split_tklist_core(ip_obj, list_str)
old_gc = rb_gc_disable();
for(idx = 0; idx < objc; idx++) {
- elem = get_str_from_obj(objv[idx]);
+ char *str;
+ int len;
+
+# if 1
+# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
+ str = Tcl_GetStringFromObj(objv[idx], &len);
+ elem = rb_str_new(str, len);
+# else /* TCL_VERSION >= 8.1 */
+ if (Tcl_GetCharLength(objv[idx])
+ != Tcl_UniCharLen(Tcl_GetUnicode(objv[idx]))) {
+ /* possibly binary string */
+ str = Tcl_GetByteArrayFromObj(objv[idx], &len);
+ elem = rb_str_new(str, len);
+ rb_ivar_set(elem, ID_at_enc, rb_tainted_str_new2("binary"));
+ } else {
+ /* possibly text string */
+ str = Tcl_GetStringFromObj(objv[idx], &len);
+ elem = rb_str_new(str, len);
+ }
+# endif
+# else
+ str = Tcl_GetStringFromObj(objv[idx], &len);
+ elem = rb_str_new(str, len);
+# endif
+
if (taint_flag) OBJ_TAINT(elem);
RARRAY(ary)->ptr[idx] = elem;
}
@@ -7577,7 +6016,7 @@ lib_split_tklist_core(ip_obj, list_str)
if (Tcl_SplitList(interp, RSTRING(list_str)->ptr,
&argc, &argv) == TCL_ERROR) {
if (interp == (Tcl_Interp*)NULL) {
- rb_raise(rb_eRuntimeError, "can't get elements from list");
+ rb_raise(rb_eRuntimeError, "cannot get elements from list");
} else {
rb_raise(rb_eRuntimeError, "%s", interp->result);
}
@@ -7639,8 +6078,6 @@ lib_merge_tklist(argc, argv, obj)
if (argc == 0) return rb_str_new2("");
- tcl_stubs_check();
-
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
old_gc = rb_gc_disable();
@@ -7705,8 +6142,6 @@ lib_conv_listelement(self, src)
int taint_flag = OBJ_TAINTED(src);
int thr_crit_bup;
- tcl_stubs_check();
-
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -7734,164 +6169,20 @@ lib_conv_listelement(self, src)
}
-static VALUE
-tcltklib_compile_info()
+#ifdef __MACOS__
+static void
+_macinit()
{
- volatile VALUE ret;
- int size;
- char form[]
- = "tcltklib %s :: Ruby%s (%s) %s pthread :: Tcl%s(%s)/Tk%s(%s) %s";
- char *info;
-
- size = strlen(form)
- + strlen(TCLTKLIB_RELEASE_DATE)
- + strlen(RUBY_VERSION)
- + strlen(RUBY_RELEASE_DATE)
- + strlen("without")
- + strlen(TCL_PATCH_LEVEL)
- + strlen("without stub")
- + strlen(TK_PATCH_LEVEL)
- + strlen("without stub")
- + strlen("unknown tcl_threads");
-
- info = ALLOC_N(char, size);
-
- sprintf(info, form,
- TCLTKLIB_RELEASE_DATE,
- RUBY_VERSION, RUBY_RELEASE_DATE,
-#ifdef HAVE_NATIVETHREAD
- "with",
-#else
- "without",
-#endif
- TCL_PATCH_LEVEL,
-#ifdef USE_TCL_STUBS
- "with stub",
-#else
- "without stub",
-#endif
- TK_PATCH_LEVEL,
-#ifdef USE_TK_STUBS
- "with stub",
-#else
- "without stub",
-#endif
-#ifdef WITH_TCL_ENABLE_THREAD
-# if WITH_TCL_ENABLE_THREAD
- "with tcl_threads"
-# else
- "without tcl_threads"
-# endif
-#else
- "unknown tcl_threads"
-#endif
- );
-
- ret = rb_obj_freeze(rb_str_new2(info));
-
- free(info);
-
- return ret;
+ tcl_macQdPtr = &qd; /* setup QuickDraw globals */
+ Tcl_MacSetEventProc(TkMacConvertEvent); /* setup event handler */
}
-
-/*###############################################*/
-
-/*
- * The following is based on tkMenu.[ch]
- * of Tcl/Tk (>=8.0) source code.
- */
-#if TCL_MAJOR_VERSION >= 8
-
-#define MASTER_MENU 0
-#define TEAROFF_MENU 1
-#define MENUBAR 2
-
-struct dummy_TkMenuEntry {
- int type;
- struct dummy_TkMenu *menuPtr;
- /* , and etc. */
-};
-
-struct dummy_TkMenu {
- Tk_Window tkwin;
- Display *display;
- Tcl_Interp *interp;
- Tcl_Command widgetCmd;
- struct dummy_TkMenuEntry **entries;
- int numEntries;
- int active;
- int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR */
- Tcl_Obj *menuTypePtr;
- /* , and etc. */
-};
-
-struct dummy_TkMenuRef {
- struct dummy_TkMenu *menuPtr;
- char *dummy1;
- char *dummy2;
- char *dummy3;
-};
-
-EXTERN struct dummy_TkMenuRef *TkFindMenuReferences(Tcl_Interp*, char*);
-
#endif
-static VALUE
-ip_make_menu_embeddable(interp, menu_path)
- VALUE interp;
- VALUE menu_path;
-{
-#if TCL_MAJOR_VERSION >= 8
- struct tcltkip *ptr = get_ip(interp);
- struct dummy_TkMenuRef *menuRefPtr;
-
- StringValue(menu_path);
-
- menuRefPtr = TkFindMenuReferences(ptr->ip, RSTRING(menu_path)->ptr);
- if (menuRefPtr == (struct dummy_TkMenuRef *) NULL) {
- rb_raise(rb_eArgError, "not a menu widget, or invalid widget path");
- }
-
- if (menuRefPtr->menuPtr == (struct dummy_TkMenu *) NULL) {
- rb_raise(rb_eRuntimeError,
- "invalid menu widget (maybe already destroyed)");
- }
-
- if ((menuRefPtr->menuPtr)->menuType != MENUBAR) {
- rb_raise(rb_eRuntimeError,
- "target menu widget must be a MENUBAR type");
- }
-
- (menuRefPtr->menuPtr)->menuType = TEAROFF_MENU;
-#if 0 /* cause SEGV */
- {
- /* char *s = "tearoff"; */
- char *s = "normal";
- /* Tcl_SetStringObj((menuRefPtr->menuPtr)->menuTypePtr, s, strlen(s));*/
- (menuRefPtr->menuPtr)->menuTypePtr = Tcl_NewStringObj(s, strlen(s));
- /* (menuRefPtr->menuPtr)->menuType = TEAROFF_MENU; */
- (menuRefPtr->menuPtr)->menuType = MASTER_MENU;
- }
-#endif
-
- TkEventuallyRecomputeMenu(menuRefPtr->menuPtr);
- TkEventuallyRedrawMenu(menuRefPtr->menuPtr,
- (struct dummy_TkMenuEntry *)NULL);
-
-#else /* TCL_MAJOR_VERSION <= 7 */
- rb_notimplement();
-#endif
-
- return interp;
-}
-
-/*###############################################*/
-
/*---- initialization ----*/
void
Init_tcltklib()
{
- int ret;
+ int thr_crit_bup;
VALUE lib = rb_define_module("TclTkLib");
VALUE ip = rb_define_class("TclTkIp", rb_cObject);
@@ -7901,7 +6192,13 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
- tcltkip_class = ip;
+#if defined USE_TCL_STUBS && defined USE_TK_STUBS
+ extern int ruby_tcltk_stubs();
+ int ret = ruby_tcltk_stubs();
+
+ if (ret)
+ rb_raise(rb_eLoadError, "tcltklib: tcltk_stubs init error(%d)", ret);
+#endif
/* --------------------------------------------------------------- */
@@ -7910,18 +6207,10 @@ Init_tcltklib()
rb_global_variable(&eTkCallbackContinue);
rb_global_variable(&eventloop_thread);
- rb_global_variable(&eventloop_stack);
rb_global_variable(&watchdog_thread);
- rb_global_variable(&rbtk_pending_exception);
-
/* --------------------------------------------------------------- */
- rb_define_const(lib, "COMPILE_INFO", tcltklib_compile_info());
-
- rb_define_const(lib, "RELEASE_DATE",
- rb_obj_freeze(rb_str_new2(tcltklib_release_date)));
-
rb_define_const(lib, "FINALIZE_PROC_NAME",
rb_str_new2(finalize_hook_name));
@@ -7955,7 +6244,7 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
- eTkCallbackReturn = rb_define_class("TkCallbackReturn", rb_eStandardError);
+ eTkCallbackBreak = rb_define_class("TkCallbackReturn", rb_eStandardError);
eTkCallbackBreak = rb_define_class("TkCallbackBreak", rb_eStandardError);
eTkCallbackContinue = rb_define_class("TkCallbackContinue",
rb_eStandardError);
@@ -7964,22 +6253,12 @@ Init_tcltklib()
eLocalJumpError = rb_const_get(rb_cObject, rb_intern("LocalJumpError"));
- eTkLocalJumpError = rb_define_class("TkLocalJumpError", eLocalJumpError);
-
- eTkCallbackRetry = rb_define_class("TkCallbackRetry", eTkLocalJumpError);
- eTkCallbackRedo = rb_define_class("TkCallbackRedo", eTkLocalJumpError);
- eTkCallbackThrow = rb_define_class("TkCallbackThrow", eTkLocalJumpError);
-
- /* --------------------------------------------------------------- */
-
ID_at_enc = rb_intern("@encoding");
ID_at_interp = rb_intern("@interp");
ID_stop_p = rb_intern("stop?");
- ID_alive_p = rb_intern("alive?");
ID_kill = rb_intern("kill");
ID_join = rb_intern("join");
- ID_value = rb_intern("value");
ID_call = rb_intern("call");
ID_backtrace = rb_intern("backtrace");
@@ -7995,15 +6274,9 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
- rb_define_module_function(lib, "_mark_at_exit", lib_mark_at_exit, 0);
-
rb_define_module_function(lib, "mainloop", lib_mainloop, -1);
- rb_define_module_function(lib, "mainloop_thread?",
- lib_evloop_thread_p, 0);
rb_define_module_function(lib, "mainloop_watchdog",
lib_mainloop_watchdog, -1);
- rb_define_module_function(lib, "do_thread_callback",
- lib_thread_callback, -1);
rb_define_module_function(lib, "do_one_event", lib_do_one_event, -1);
rb_define_module_function(lib, "mainloop_abort_on_exception",
lib_evloop_abort_on_exc, 0);
@@ -8034,40 +6307,25 @@ Init_tcltklib()
rb_define_module_function(lib, "_subst_Tcl_backslash",
lib_Tcl_backslash, 1);
- rb_define_module_function(lib, "encoding_system",
- lib_get_system_encoding, 0);
- rb_define_module_function(lib, "encoding_system=",
- lib_set_system_encoding, 1);
- rb_define_module_function(lib, "encoding",
- lib_get_system_encoding, 0);
- rb_define_module_function(lib, "encoding=",
- lib_set_system_encoding, 1);
-
/* --------------------------------------------------------------- */
rb_define_alloc_func(ip, ip_alloc);
rb_define_method(ip, "initialize", ip_init, -1);
rb_define_method(ip, "create_slave", ip_create_slave, -1);
- rb_define_method(ip, "slave_of?", ip_is_slave_of_p, 1);
rb_define_method(ip, "make_safe", ip_make_safe, 0);
rb_define_method(ip, "safe?", ip_is_safe_p, 0);
rb_define_method(ip, "allow_ruby_exit?", ip_allow_ruby_exit_p, 0);
rb_define_method(ip, "allow_ruby_exit=", ip_allow_ruby_exit_set, 1);
rb_define_method(ip, "delete", ip_delete, 0);
rb_define_method(ip, "deleted?", ip_is_deleted_p, 0);
- rb_define_method(ip, "has_mainwindow?", ip_has_mainwindow_p, 0);
- rb_define_method(ip, "invalid_namespace?", ip_has_invalid_namespace_p, 0);
rb_define_method(ip, "_eval", ip_eval, 1);
rb_define_method(ip, "_toUTF8", ip_toUTF8, -1);
rb_define_method(ip, "_fromUTF8", ip_fromUTF8, -1);
rb_define_method(ip, "_thread_vwait", ip_thread_vwait, 1);
rb_define_method(ip, "_thread_tkwait", ip_thread_tkwait, 2);
rb_define_method(ip, "_invoke", ip_invoke, -1);
- rb_define_method(ip, "_immediate_invoke", ip_invoke_immediate, -1);
rb_define_method(ip, "_return_value", ip_retval, 0);
- rb_define_method(ip, "_create_console", ip_create_console, 0);
-
/* --------------------------------------------------------------- */
rb_define_method(ip, "_get_variable", ip_get_variable, 2);
@@ -8085,10 +6343,6 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
- rb_define_method(ip, "_make_menu_embeddable", ip_make_menu_embeddable, 1);
-
- /* --------------------------------------------------------------- */
-
rb_define_method(ip, "_split_tklist", ip_split_tklist, 1);
rb_define_method(ip, "_merge_tklist", lib_merge_tklist, -1);
rb_define_method(ip, "_conv_listelement", lib_conv_listelement, 1);
@@ -8113,41 +6367,18 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
- eventloop_thread = Qnil;
-
-#ifndef DEFAULT_EVENTLOOP_DEPTH
-#define DEFAULT_EVENTLOOP_DEPTH 7
-#endif
- eventloop_stack = rb_ary_new2(DEFAULT_EVENTLOOP_DEPTH);
- OBJ_TAINT(eventloop_stack);
-
- watchdog_thread = Qnil;
-
- rbtk_pending_exception = Qnil;
+ eventloop_thread = 0;
+ watchdog_thread = 0;
/* --------------------------------------------------------------- */
- /* if ruby->nativethread-supprt and tcltklib->doen't,
- the following will cause link-error. */
- is_ruby_native_thread();
-
- /* --------------------------------------------------------------- */
-
- rb_eval_string("at_exit{ TclTkLib._mark_at_exit }");
-
- /* --------------------------------------------------------------- */
+#ifdef __MACOS__
+ _macinit();
+#endif
- ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
- switch(ret) {
- case TCLTK_STUBS_OK:
- break;
- case NO_TCL_DLL:
- rb_raise(rb_eLoadError, "tcltklib: fail to open tcl_dll");
- case NO_FindExecutable:
- rb_raise(rb_eLoadError, "tcltklib: can't find Tcl_FindExecutable");
- default:
- rb_raise(rb_eLoadError, "tcltklib: unknown error(%d) on ruby_open_tcl_dll", ret);
- }
+ /* from Tk_Main() */
+ DUMP1("Tcl_FindExecutable");
+ Tcl_FindExecutable(RSTRING(rb_argv0)->ptr);
/* --------------------------------------------------------------- */
}
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib
index fa5524da01..83989c1a8e 100644
--- a/ext/tk/ChangeLog.tkextlib
+++ b/ext/tk/ChangeLog.tkextlib
@@ -1,815 +1,113 @@
-2005-12-11 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/SUPPORT_STATUS: update to support libraries in
- ActiveTcl8.4.12.0.
-
- * lib/tkextlib/tile/tnotebook.rb: add Tk::Tile::TNotebook#insert.
-
- * sample/tkextlib/tile/demo.rb: improve the look of a part of the demo.
-
-2005-11-25 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/tile/demo.rb: bug fix
-
- * sample/tkextlib/tile/themes/*: add some themes (blue,
- keramik, and plastik; require Tile-0.5 or later).
-
-2005-11-22 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tile.rb: bug fix (Tk::Tile::USE_TTK_NAMESPACE
- is not defined).
-
-2005-11-19 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/treectrl/demo.rb: remove dependency on Ruby's
- version (1.8 or 1.9).
-
-2005-10-23 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/*: update to support ActiveTcl8.4.11.2
-
- * lib/tkextlib/trofs/*: support Trofs 0.4.3
-
- * lib/tkextlib/tile/*: support Tile 0.7.2
-
- * lib/tkextlib/vu/*: support vu 2.3.0
-
- * lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3 part only)
-
- * lib/tkextlib/*: improve conversion of option values
-
-2005-10-04 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tktable/tktable.rb: border_* instance methods
- don't call 'border' subcommands.
-
-2005-08-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/component.rb: didn't check
- __item_ruby2val_optkeys().
-
-2005-08-09 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/barchart.rb: support to treat tkvariable-type
- configure options.
-
- * lib/tkextlib/blt/component.rb: ditto.
-
- * lib/tkextlib/blt/dragdrop.rb: ditto.
-
- * lib/tkextlib/blt/treeview.rb: ditto.
-
- * lib/tkextlib/bwidget/button.rb: ditto.
-
- * lib/tkextlib/bwidget/entry.rb: ditto.
-
- * lib/tkextlib/bwidget/label.rb: ditto.
-
- * lib/tkextlib/bwidget/labelentry.rb: ditto.
-
- * lib/tkextlib/bwidget/labelframe.rb: ditto.
-
- * lib/tkextlib/bwidget/mainframe.rb: ditto.
-
- * lib/tkextlib/bwidget/passwddlg.rb: ditto.
-
- * lib/tkextlib/bwidget/spinbox.rb: ditto.
-
- * lib/tkextlib/bwidget/tree.rb: ditto.
-
- * lib/tkextlib/iwidgets/calendar.rb: ditto.
-
- * lib/tkextlib/iwidgets/entryfield.rb: ditto.
-
- * lib/tkextlib/iwidgets/hierarchy.rb: ditto.
-
- * lib/tkextlib/iwidgets/labeledframe.rb: ditto.
-
- * lib/tkextlib/iwidgets/labeledwidget.rb: ditto.
-
- * lib/tkextlib/iwidgets/menubar.rb: ditto.
-
- * lib/tkextlib/iwidgets/scrolledlistbox.rb: ditto.
-
- * lib/tkextlib/iwidgets/spinner.rb: ditto.
-
- * lib/tkextlib/iwidgets/toolbar.rb: ditto.
-
- * lib/tkextlib/tkimg/pixmap.rb: ditto.
-
- * lib/tkextlib/tktable/tktable.rb: ditto.
-
-2005-08-06 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/demo.rb: use Tk::Tile::Scale#variable.
-
-2005-08-04 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/demo.rb: followed previous changes.
-
-2005-08-04 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tile/t*.rb: aliased class names starting with 'T'
- to non 'T' ones. (ie. Tk::Tile::TButton -> Tk::Tile::Button)
- [ruby-dev:26724]
-
- * lib/tkextlib/tile.rb: ditto. (autoload support)
-
-2005-08-04 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/demo.rb: fixed: Tk::Tile::TProgressbar is
- supported on tile 0.6 or later, not tile 0.5.
-
- * sample/tkextlib/tile/demo.rb: updated scales demo to use
- Tk::Tile::TProgressbar for tile 0.6 or later.
-
- * sample/tkextlib/tile/demo.rb: set some TkVariable default values.
-
-2005-08-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tile/treeview.rb: Tk::Tile::Treeview#headingconfigure
- is now working and more. [ruby-dev:26716]
-
- * sample/tkextlib/tile/demo.rb: use Tk::Tile::Treeview#headingconfigure instead of direct Tk.tk_call.
-
-2005-08-02 ocean <ocean@ruby-lang.org>
-
- * lib/tkextlib/tile/tprogressbar.rb: Tk::Tile::TProgressbar#start
- takes optional argument `interval'.
-
- * sample/tkextlib/tile/demo.rb: emulate Tk::Tile::TProgressbar
- with Tk::Tile::TProgress in tile 0.4. (repeating buttons demo)
-
-2005-08-02 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/demo.rb: added repeating buttons demo.
-
- * sample/tkextlib/tile/repeater.tcl: ditto. (new file)
-
-2005-08-01 ocean <ocean@ruby-lang.org>
-
- * lib/tkextlib/tile.rb: fixed autoload for Treeview.
-
- * lib/tkextlib/tile/treeview.rb: replaced `ary2tk_list(items)' with
- `*items'.
-
- * sample/tkextlib/tile/demo.rb: added treeview demo. (tile 0.5 or
- later is required) [ruby-dev:26668]
-
-2005-08-01 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/demo.rb: added combobox demo.
-
-2005-07-27 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/demo.rb: fixed typo.
-
-2005-06-16 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/SUPPOPRT_STATUS: add RELEASE_DATE information.
-
- * lib/tkextlib/tile/style.rb: add "style element options <elem>"
- command support.
-
-2005-06-08 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/ICONS/icons.rb: fail to create instances of
- Tk::ICONS [ruby-dev:26305].
-
-2005-06-07 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/themes/kroc.{rb,tcl}: also support tile 0.4.
-
-2005-06-07 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/tile/themes/kroc.{rb,tcl}: support tile 0.5 or later.
- ("pixmap" element constructor replaced by "image")
-
-2005-06-05 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/tile/demo.rb: fix TypeError & create Console
-
-2005-05-30 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt.rb: add PACKAGE_NAME information of Tcl/Tk
- Extension.
-
- * lib/tkextlib/bwidget.rb: ditto.
-
- * lib/tkextlib/iwidgets.rb: ditto.
-
- * lib/tkextlib/tile.rb: ditto.
-
- * lib/tkextlib/tkimg.rb: ditto.
-
- * lib/tkextlib/vu.rb: ditto.
-
- * lib/tkextlib/ICONS/icons.rb: ditto.
-
- * lib/tkextlib/itcl/incr_tcl.rb: ditto.
-
- * lib/tkextlib/itk/incr_tk.rb: ditto.
-
- * lib/tkextlib/tcllib/autoscroll.rb: ditto.
-
- * lib/tkextlib/tcllib/ctext.rb: ditto.
-
- * lib/tkextlib/tcllib/cursor.rb: ditto.
-
- * lib/tkextlib/tcllib/datefield.rb: ditto.
-
- * lib/tkextlib/tcllib/ico.rb: ditto.
-
- * lib/tkextlib/tcllib/ip_entry.rb: ditto.
-
- * lib/tkextlib/tcllib/plotchart.rb: ditto.
-
- * lib/tkextlib/tcllib/style.rb: ditto.
-
- * lib/tkextlib/tcllib/tkpiechart.rb: ditto.
-
- * lib/tkextlib/tclx/tclx.rb: ditto.
-
- * lib/tkextlib/tkDND/shape.rb: ditto.
-
- * lib/tkextlib/tkDND/tkdnd.rb: ditto.
-
- * lib/tkextlib/tkHTML/htmlwidget.rb: ditto.
-
- * lib/tkextlib/tkimg/bmp.rb: ditto.
-
- * lib/tkextlib/tkimg/gif.rb: ditto.
-
- * lib/tkextlib/tkimg/ico.rb: ditto.
-
- * lib/tkextlib/tkimg/jpeg.rb: ditto.
-
- * lib/tkextlib/tkimg/pcx.rb: ditto.
-
- * lib/tkextlib/tkimg/pixmap.rb: ditto.
-
- * lib/tkextlib/tkimg/png.rb: ditto.
-
- * lib/tkextlib/tkimg/ppm.rb: ditto.
-
- * lib/tkextlib/tkimg/ps.rb: ditto.
-
- * lib/tkextlib/tkimg/sgi.rb: ditto.
-
- * lib/tkextlib/tkimg/sun.rb: ditto.
-
- * lib/tkextlib/tkimg/tga.rb: ditto.
-
- * lib/tkextlib/tkimg/tiff.rb: ditto.
-
- * lib/tkextlib/tkimg/window.rb: ditto.
-
- * lib/tkextlib/tkimg/xbm.rb: ditto.
-
- * lib/tkextlib/tkimg/xpm.rb: ditto.
-
- * lib/tkextlib/tktable/tktable.rb: ditto.
-
- * lib/tkextlib/tktrans/tktrans.rb: ditto.
-
- * lib/tkextlib/treectrl/tktreectrl.rb: ditto.
-
- * lib/tkextlib/winico/winico.rb: ditto.
-
-2005-05-25 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/iwidgets/scrolledlistbox.rb: follow the change
- of tk.rb. modify to attend encoding.
-
- * lib/tkextlib/iwidgets/scrolledtext.rb: ditto.
-
- * lib/tkextlib/iwidgets/scrolledcanvas.rb: bug fix on
- TkCanvas#delete when given non-TkcItem arguments.
-
-2005-05-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/winop.rb: fix typo
-
-2005-05-08 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/vu/pie.rb: fix typo
-
-2005-04-10 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/mailwasher.rb: fixed typo. [ruby-dev:26008]
-
-2005-04-09 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/tile/demo.rb: new demo of Tile extension.
-
- * sample/tkextlib/tile/iconlib.tcl: part of the demo.
-
- * sample/tkextlib/tile/toolbutton.tcl: ditto.
-
- * sample/tkextlib/tile/readme.txt: document of the demo.
-
- * sample/tkextlib/tile/Orig_LICENSE.txt: ditto.
-
- * sample/tkextlib/tile/themes/kroc.tcl: sample theme written with Tcl.
-
- * sample/tkextlib/tile/themes/pkgIndex.tcl: pkgIndex of kroc.tcl.
-
- * sample/tkextlib/tile/themes/kroc.rb: Kroc theme written with Ruby.
-
- * sample/tkextlib/tile/themes/kroc/button-h.gif: images for Kroc theme.
-
- * sample/tkextlib/tile/themes/kroc/button-n.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/button-p.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/check-hc.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/check-hu.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/check-nc.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/check-nu.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/radio-hc.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/radio-hu.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/radio-nc.gif: ditto.
-
- * sample/tkextlib/tile/themes/kroc/radio-nu.gif: ditto.
-
- * lib/tkextlib/tile.rb: bug fix (tested on the new demo).
-
- * lib/tkextlib/tile/style.rb: ditto.
-
- * lib/tkextlib/tile/tbutton.rb: ditto.
-
- * lib/tkextlib/tile/tcheckbutton.rb: ditto.
-
- * lib/tkextlib/tile/tcombobox.rb: ditto.
-
- * lib/tkextlib/tile/tentry.rb: ditto.
-
- * lib/tkextlib/tile/tframe.rb: ditto.
-
- * lib/tkextlib/tile/tlabel.rb: ditto.
-
- * lib/tkextlib/tile/tlabelframe.rb: ditto.
-
- * lib/tkextlib/tile/tmenubutton.rb: ditto.
-
- * lib/tkextlib/tile/tnotebook.rb: ditto.
-
- * lib/tkextlib/tile/tprogressbar.rb: ditto.
-
- * lib/tkextlib/tile/tradiobutton.rb: ditto.
-
- * lib/tkextlib/tile/treeview.rb: ditto.
-
- * lib/tkextlib/tile/tscrollbar.rb: ditto.
-
- * lib/tkextlib/tile/tseparator.rb: ditto.
-
- * lib/tkextlib/tile/tsquare.rb: ditto.
-
- * lib/tkextlib/tile/tpaned.rb: new library
-
- * lib/tkextlib/tile/tscale.rb: ditto.
-
- * lib/tkextlib/SUPPORT_STATUS: update support status of Tile extension.
-
- * lib/tkextlib/tcllib/ctext.rb: use TkCommandNames on create_self().
-
- * lib/tkextlib/tcllib/datefield.rb: ditto.
-
- * lib/tkextlib/tcllib/ip_entry.rb: ditto.
-
- * lib/tkextlib/tkHTML/htmlwidget.rb: ditto.
-
- * lib/tkextlib/treectrl/tktreectrl.rb: ditto.
-
-2005-04-09 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/explorer.rb: File.executable? returns true
- even if it's plain text file. (this function only checks access right)
-
-2005-04-09 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/{help,www-options}.rb: fixed typo.
- (click or resize column header)
-
-2005-04-09 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/imovie.rb: fixed typo. (click on clip title)
-
-2005-04-08 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/random.rb: fixed typo. (drop node outside of
- widget, or reenter widget while draggging)
-
-2005-04-08 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/outlook-newgrounp.rb: image had disappered when
- node was selected.
-
-2005-04-08 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/{random,outlook-newgroup}.rb:
- tk::treectrl uses 'afterId' not 'afterID'.
-
- * sample/tkextlib/treectrl/{random,outlook-newgroup}.rb:
- item_firstchild can return empty string. (drop node to leaf node)
-
- * sample/tkextlib/treectrl/random.rb: Enumerable#find didn't work properly
- because tried to compare String with Integer. (drag node and leave widget)
-
- * sample/tkextlib/treectrl/random.rb: and some fixes.
-
-2005-04-08 ocean <ocean@ruby-lang.org>
-
- * lib/tkextlib/treectrl/tktreectrl.rb (selection_clear): fixed typo.
-
- * sample/tkextlib/treectrl/random.rb: node deselection now works.
-
- * sample/tkextlib/treectrl/demo.rb: fixed typo. (popup menu on column header)
-
-2005-04-08 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/help.rb: fixed typo. (wrong color)
-
-2005-04-08 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/random.rb: fixed typo. (wrong itemheight)
-
- * sample/tkextlib/treectrl/outlook-newgroup.rb: ditto.
-
- * sample/tkextlib/treectrl/explorer.rb: ditto.
-
- * sample/tkextlib/treectrl/help.rb: ditto.
-
-2005-04-07 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/*.rb: some speed up... cache the result of
- version checking.
-
-2005-04-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/treectrl/tktreectrl.rb: performance tuning by calling
- tk_send_without_enc. [ruby-dev:25997]
-
-2005-04-04 ocean <ocean@ruby-lang.org>
-
- * lib/tkextlib/tktable/tktable.rb: added Tk::TkTable#selection_present.
-
-2005-04-02 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/treectrl/tktreectrl.rb: support TreeCtrl's cvs head.
-
-2005-04-02 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/component.rb: add TreeCtrl#legend_window_create().
-
- * sample/tkextlib/blt/graph6.rb: use legend_window_create().
-
- * lib/tkextlib/blt/tree.rb: forget to call tagid().
-
- * lib/tkextlib/blt/treeview.rb: ditto.
-
-2005-04-01 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/treectrl/demo.rb: bridge the gap of
- Hash#index or Hash#key between ruby 1.8 and 1.9
-
-2005-04-01 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/component.rb: bug fix on treatment of
- component objects.
-
- * sample/tkextlib/blt/graph6.rb: a new sample script.
-
-2005-03-31 ocean <ocean@ruby-lang.org>
-
- * sample/tkextlib/treectrl/demo.rb: should use Hash#index.
-
- * sample/tkextlib/treectrl/demo.rb: TkImage was not
- cached properly.
-
- * sample/tkextlib/treectrl/random.rb: fixed typo.
-
-2005-03-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename
- only [ruby-dev:25970]
-
- * sample/tkextlib/treectrl/demo.rb: add check for existence of
- 'backgroundimage' option.
-
- * sample/tkextlib/treectrl/bitmaps.rb: ditto.
-
- * sample/tkextlib/treectrl/outlook-newgroup.rb: lack of '%I'
- event callback argument.
-
-2005-03-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/iwidgets/sample/hierarchy.rb: fail to treat
- Japanese (i18n?) filenames.
-
-2005-03-30 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/bwidget/tree.rb: use 'return' in the Proc object.
-
- * sample/tkextlib/tkHTML/hv.rb: ditto.
-
- * sample/tkextlib/tkHTML/ss.rb: ditto.
-
- * sample/tkextlib/tktable/basic.rb: ditto.
-
- * sample/tkextlib/tktable/command.rb: ditto.
-
- * sample/tkextlib/tktable/debug.rb: ditto.
-
- * sample/tkextlib/tktable/maxsize.rb: ditto.
-
- * sample/tkextlib/treectrl/demo.rb: ditto.
-
-2005-03-29 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/component.rb: cannot create elements except
- default type of element.
-
- * lib/tkextlib/blt/barchart.rb: ditto.
-
- * lib/tkextlib/blt/graph.rb: ditto.
-
- * lib/tkextlib/blt/stripchart.rb: ditto.
-
- * lib/tkextlib/blt/component.rb: axis command option gets
- proper object type of arguments.
-
- * sample/tkextlib/blt/calendar.rb: new sample.
-
- * sample/tkextlib/blt/pareto.rb: ditto.
-
-2005-03-28 ocean <ocean@ruby-lang.org>
-
- * lib/tkextlib/iwidgets/notebook.rb: fixed typo.
-
-2005-03-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt.rb: add commands for zooming.
-
- * lib/tkextlib/blt/bitmap.rb (new_with_name): add for using
- given name.
-
- * lib/tkextlib/blt/busy.rb: bug fix on Tk::BLT::Busy::Shild class.
-
- * lib/tkextlib/blt/component.rb: typo fix.
-
- * lib/tkextlib/blt/component.rb: fix lack of *_create methods
-
- * lib/tkextlib/blt/component.rb: proper call on xaxis_* and so on.
-
- * lib/tkextlib/blt/htext.rb: add TkVariable object to access
- special Tcl variables.
-
- * lib/tkextlib/treectrl/tktreectrl.rb: typo fix.
-
- * lib/tkextlib/treectrl/tktreectrl.rb: proper treatment
- of 'font' option of element_configure.
-
- * lib/tkextlib/treectrl/tktreectrl.rb: bug fix on item_sort.
-
- * lib/tkextlib/treectrl/tktreectrl.rb: add methods to
- call TreeCtrl commands for bindings.
-
- * sample/tkextlib/blt/*: add some sample scripts.
-
- * sample/tkextlib/treectrl/*: add some sample scripts.
-
-2005-03-18 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/treectrl/tktreectrl.rb: bug fix and define some
- classes for components of Tk::TreeCtrl
-
-2005-03-17 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/treectrl/tktreectrl.rb: call wrong method in
- Tk::TreeCtrl#*_configinfo and current_*_configinfo method
-
-2005-03-16 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/SUPPORT_STATUS: change the status of TkImg
-
- * lib/tkextlib/treectrl/tktreectrl.rb: bug fix and support
- TkTreeCtrl-1.1
-
- * lib/tkextlib/SUPPORT_STATUS: change the supported version of
- TkTreeCtrl
-
-2005-03-15 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * sample/tkextlib/tkimg: add sample
-
-2005-03-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/SUPPORT_STATUS: add version info of each extension
-
-2005-03-05 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tile.rb: lack of "autoload TProgressbar"
-
-2005-03-05 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tile.rb: support tile-0.6
-
- * lib/tkextlib/tile/tbutton.rb: ditto
-
- * lib/tkextlib/tile/tcheckbutton.rb: ditto
-
- * lib/tkextlib/tile/tlabel.rb: ditto
-
- * lib/tkextlib/tile/tmenubutton.rb: ditto
-
- * lib/tkextlib/tile/tnotebook.rb: ditto
-
- * lib/tkextlib/tile/tradiobutton.rb: ditto
-
- * lib/tkextlib/tile/tcombobox.rb: [new] ditto
-
- * lib/tkextlib/tile/tentry.rb: [new] ditto
-
- * lib/tkextlib/tile/tframe.rb: [new] ditto
-
- * lib/tkextlib/tile/tlabelframe.rb: [new] ditto
-
- * lib/tkextlib/tile/tprogressbar.rb: [new] ditto
-
- * lib/tkextlib/tile/treeview.rb: [new] ditto
-
- * lib/tkextlib/tile/tscrollbar.rb: [new] ditto
-
- * lib/tkextlib/tile/tseparator.rb: [new] ditto
-
- * lib/tkextlib/tile/tsquare.rb: [new] ditto
-
-2005-02-20 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/tclx/tclx.rb: warning TclX's 'signal' command.
-
-2005-01-25 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt/component.rb: bug fix. cannot accept
- a callback ID string for a command argument. [ruby-dev:25479]
-
- * lib/tkextlib/blt/tabset.rb: ditto
-
- * lib/tkextlib/blt/treeview.rb: ditto
-
- * lib/tkextlib/bwidget/labelentry.rb: ditto
-
- * lib/tkextlib/bwidget/listbox.rb: ditto
-
- * lib/tkextlib/bwidget/notebook.rb: ditto
-
- * lib/tkextlib/bwidget/spinbox.rb: ditto
-
- * lib/tkextlib/bwidget/tree.rb: ditto
-
- * lib/tkextlib/itk/incr_tk.rb: ditto
-
- * lib/tkextlib/iwidgets/scrolledcanvas.rb: ditto
-
- * lib/tkextlib/tkDND/tkdnd.rb: ditto
-
- * lib/tkextlib/treectrl/tktreectrl.rb: ditto
-
- * sample/tkextlib/tkHTML/ss.rb: local variable scope bug fix
- [ruby-dev:25479]
-
- * sample/tkextlib/vu/vu_demo.rb: rename from vu.rb; avoid the bug on
- Windows version of Tcl/Tk. The trouble based on the bug occurs when
- the script name (without extension) is a same name as a Tcl/Tk's
- library file name (without extension) required in the script.
-
-2004-12-24 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-
- * lib/tkextlib/blt: add BLT extension support
-
2004-12-16 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/bwidget/labelentry.rb: use TkCore.callback_obj?()
+ * bwidget/labelentry.rb: use TkCore.callback_obj?()
- * lib/tkextlib/bwidget/listbox.rb: ditto
+ * bwidget/listbox.rb: ditto
- * lib/tkextlib/bwidget/notebook.rb: ditto
+ * bwidget/notebook.rb: ditto
- * lib/tkextlib/bwidget/spinbox.rb: ditto
+ * bwidget/spinbox.rb: ditto
- * lib/tkextlib/itk/incr_tk.rb: ditto
+ * itk/incr_tk.rb: ditto
- * lib/tkextlib/iwidgets/scrolledcanvas.rb: ditto
+ * iwidgets/scrolledcanvas.rb: ditto
- * lib/tkextlib/tkDND/tkdnd.rb: ditto
+ * tkDND/tkdnd.rb: ditto
- * lib/tkextlib/treectrl/tktreectrl.rb: ditto
+ * treectrl/tktreectrl.rb: ditto
- * lib/tkextlib/winico/winico.rb: ditto
+ * winico/winico.rb: ditto
2004-12-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/tile/style.rb: 'theme_use' method bug fix
+ * tile/style.rb: 'theme_use' method bug fix
2004-12-08 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/bwidget/notebook.rb: raise method cannot return
- the raised page.
+ * bwidget/notebook.rb: raise method cannot return the raised page.
- * lib/tkextlib/bwidget/labelentry.rb: bind methods accept
- subst_args + block
+ * bwidget/labelentry.rb: bind methods accept subst_args + block
- * lib/tkextlib/bwidget/listbox.rb: ditto
+ * bwidget/listbox.rb: ditto
- * lib/tkextlib/bwidget/notebook.rb: ditto
+ * bwidget/notebook.rb: ditto
- * lib/tkextlib/bwidget/spinbox.rb: ditto
+ * bwidget/spinbox.rb: ditto
- * lib/tkextlib/bwidget/tree.rb: ditto
+ * bwidget/tree.rb: ditto
- * lib/tkextlib/itk/incr_tk.rb: ditto
+ * itk/incr_tk.rb: ditto
- * lib/tkextlib/iwidgets/scrolledcanvas.rb: ditto
+ * iwidgets/scrolledcanvas.rb: ditto
- * lib/tkextlib/tkDND/tkdnd.rb: ditto
+ * tkDND/tkdnd.rb: ditto
- * lib/tkextlib/treectrl/tktreectrl.rb: ditto
+ * treectrl/tktreectrl.rb: ditto
2004-11-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/bwidget/notebook.rb: uses epath
+ * bwidget/notebook.rb: uses epath
- * lib/tkextlib/bwidget/widget.rb: ditto
+ * bwidget/widget.rb: ditto
- * lib/tkextlib/tktable/tktable.rb: ditto
+ * tktable/tktable.rb: ditto
- * lib/tkextlib/tcllib/cursor.rb: ditto, and bug fix
+ * tcllib/cursor.rb: ditto, and bug fix
2004-11-10 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/tile/style.rb: bug fix
+ * tile/style.rb: bug fix
2004-11-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/iwidgets/scrolledcanvas.rb: bind-event methods
- accept multi substitution arguments.
+ * iwidgets/scrolledcanvas.rb: bind-event methods accept multi
+ substitution arguments.
- * lib/tkextlib/tktable/tktable.rb: ditto.
+ * tktable/tktable.rb: ditto.
- * lib/tkextlib/treectrl/tktreectrl.rb: ditto
+ * treectrl/tktreectrl.rb: ditto
2004-11-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/SUPPORT_STATUS: BLT moves to 'plan to support'
- from 'not determined'
+ * SUPPORT_STATUS: BLT moves to 'plan to support' from 'not determined'
- * lib/tkextlib/itk/incr_tk.rb: __cget_cmd and __config_cmd are
- private methods
+ * itk/incr_tk.rb: __cget_cmd and __config_cmd are private methods
- * lib/tkextlib/tcllib/autoscroll.rb: extend TkCore
+ * tcllib/autoscroll.rb: extend TkCore
- * lib/tkextlib/tcllib/cursor.rb: ditto.
+ * tcllib/cursor.rb: ditto.
- * lib/tkextlib/tcllib/plotchart.rb: ditto.
+ * tcllib/plotchart.rb: ditto.
- * lib/tkextlib/tcllib/style.rb: ditto.
+ * tcllib/style.rb: ditto.
- * lib/tkextlib/tile/style.rb: ditto.
+ * tile/style.rb: ditto.
- * lib/tkextlib/tkDND/shape.rb: ditto.
+ * tkDND/shape.rb: ditto.
2004-10-24 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/bwidget/tree.rb: bug fix on Windows
+ * bwidget/tree.rb: bug fix on Windows
2004-10-16 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/tcllib/ico.rb: new library (Tk::Tcllib:ICO)
+ * tcllib/ico.rb: new library (Tk::Tcllib:ICO)
- * lib/tkextlib/tcllib.rb: add Tk::Tcllib::ICO (based on tcllib 1.7)
+ * tcllib.rb: add Tk::Tcllib::ICO (based on tcllib 1.7)
2004-10-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/bwidget.rb (BWidget.grab): bug fix
+ * bwidget.rb (BWidget.grab): bug fix
- * lib/tkextlib/tcllib.rb: typo fix
+ * tcllib.rb: typo fix
2004-07-28 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/add winico support
+ * add winico support
2004-07-23 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * lib/tkextlib/add TclX support (partially; infox command and
- XPG/3 MsgCat only)
+ * add TclX support (partially; infox command and XPG/3 MsgCat only)
2004-07-15 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
diff --git a/ext/tk/README.1st b/ext/tk/README.1st
index df6c819d26..038528e553 100644
--- a/ext/tk/README.1st
+++ b/ext/tk/README.1st
@@ -1,22 +1,23 @@
-If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so
-which is working correctly. If you fail to call 'require "tcltklib"',
-you may not have tcltklib.so. When you have some troubles on compiling
-tcltklib, please read README files on tcltklib.
-Even if there is a tcltklib.so on your Ruby library directry, it will not
-work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment.
-You must also check that your Tcl/Tk is installed properly.
+If you want to use Ruby/Tk (tk.rb and so on), you must have
+tcltklib.so which is working collectry. If you fail to call
+'require "tcltklib"', you may not have tcltklib.so.
+( see also README files of tcltklib )
+Even if there is a tcltklib.so on your Ruby library directry,
+it will not work without Tcl/Tk libraries (e.g. libtcl8.4.so)
+on your environment. You must also check that your Tcl/Tk is
+installed properly.
--------------------------------------------
( the following is written in EUC-JP )
-Ruby/Tk (tk.rb ¤Ê¤É) ¤ò»È¤¤¤¿¤¤¾ì¹ç¤Ë¤Ï¡¤tcltklib.so ¤¬Àµ¤·¤¯Æ°¤¤¤Æ
-¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡¥¤â¤· 'require "tcltklib"' ¤Ë¼ºÇÔ¤¹¤ë¤è¤¦¤Ê¤é¡¤
-tcltklib.so ¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¡¥tcltklib ¤Î
-¥³¥ó¥Ñ¥¤¥ë»þ¤Ë²¿¤«ÌäÂ꤬À¸¤¸¤Æ¤¤¤ë¾ì¹ç¤Ï¡¤tcltklib ¤Î README ¥Õ¥¡¥¤¥ë
-¤ò¸«¤Æ¤¯¤À¤µ¤¤¡¥
-¤¿¤È¤¨ Ruby ¤Î¥é¥¤¥Ö¥é¥ê¥Ç¥£¥ì¥¯¥È¥ê¤Ë tcltklib.so ¤¬Â¸ºß¤·¤Æ¤¤¤¿¤È¤·¤Æ
-¤â¡¤¼Â¹Ô´Ä¶­¤Ë Tcl/Tk ¥é¥¤¥Ö¥é¥ê (libtcl8.4.so ¤Ê¤É) ¤¬¤Ê¤±¤ì¤Ðµ¡Ç½¤·¤Þ
-¤»¤ó¡¥Tcl/Tk ¤¬Àµ¤·¤¯¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤«¤â¥Á¥§¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡¥
+Ruby/Tk (tk.rb ¤Ê¤É) ¤ò»È¤¤¤¿¤¤¾ì¹ç¤Ë¤Ï¡¤tcltklib.so ¤¬Àµ¤·¤¯
+ư¤¤¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡¥¤â¤· require "tcltklib" ¤Ë¼ºÇÔ¤¹¤ë
+¤è¤¦¤Ê¤é¡¤tcltklib.so ¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤¤¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¡¥
+( tcltklib ¤Î README ¥Õ¥¡¥¤¥ë¤â¸«¤Æ¤¯¤À¤µ¤¤ )
+¤¿¤È¤¨ Ruby ¤Î¥é¥¤¥Ö¥é¥ê¥Ç¥£¥ì¥¯¥È¥ê¤Ë tcltklib.so ¤¬Â¸ºß¤·¤Æ
+¤¤¤¿¤È¤·¤Æ¤â¡¤¼Â¹Ô´Ä¶­¤Ë Tcl/Tk ¥é¥¤¥Ö¥é¥ê (libtcl8.4.so ¤Ê¤É)
+¤¬¤Ê¤±¤ì¤Ðµ¡Ç½¤·¤Þ¤»¤ó¡¥Tcl/Tk ¤¬Àµ¤·¤¯¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤«
+¤É¤¦¤«¤â¥Á¥§¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡¥
==========================================================
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/README.macosx-aqua b/ext/tk/README.macosx-aqua
deleted file mode 100644
index 25a8ed827c..0000000000
--- a/ext/tk/README.macosx-aqua
+++ /dev/null
@@ -1,67 +0,0 @@
-
- *** for MacOS X Aqua (Tcl/Tk Aqua) users ***
-
-First of all, please read README.tcltklib to use Tcl/Tk Aqua Framework.
-
-With Tcl/Tk Aqua libraries, current tcltklib somtimes freezes when
-using Aqua specific dialogs (e.g. Tk.messageBox).
-This is a known bug of Ruby-1.8.4 release.
-
-When you meet the trouble on your GUI, you'll be able to avoid the trouble
-by Tcl/Tk's traditional dialogs.
-If you want to do that, please call some of the following bits of script
-after "reqruie 'tk'".
-
-=================================================================
-# use a traditional dialog for Tk.chooseColor()
-Tk.ip_eval(<<'EOS')
- proc ::tk_chooseColor {args} {
- return [eval tk::dialog::color:: $args]
- }
-EOS
-
-# use a traditional dialog for Tk.getOpenFile() and Tk.getMultipleOpenFile()
-Tk.ip_eval(<<'EOS')
- proc ::tk_getOpenFile {args} {
- if {$::tk_strictMotif} {
- return [eval tk::MotifFDialog open $args]
- } else {
- return [eval ::tk::dialog::file:: open $args]
- }
- }
-EOS
-
-# use a traditional dialog for Tk.getSaveFile() and Tk.getMultipleSaveFile()
-Tk.ip_eval(<<'EOS')
- proc ::tk_getSaveFile {args} {
- if {$::tk_strictMotif} {
- return [eval tk::MotifFDialog save $args]
- } else {
- return [eval ::tk::dialog::file:: save $args]
- }
- }
-EOS
-
-# use a traditional dialog for Tk.messageBox()
-Tk.ip_eval(<<'EOS')
- proc ::tk_messageBox {args} {
- return [eval tk::MessageBox $args]
- }
-EOS
-
-# use a traditional dialog for Tk.chooseDirectory()
-Tk.ip_eval(<<'EOS')
- proc ::tk_chooseDirectory {args} {
- return [eval ::tk::dialog::file::chooseDir:: $args]
- }
-EOS
-=================================================================
-
-Each of them replaces the platform specific dialog command to the
-traditional one.
-
-If you use some MultiTkIp objects, probably, you'll have to call the
-bits of script for each MultiTkIp object.
-
---
-Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/depend b/ext/tk/depend
index 2cd9c400f7..fd63e230f0 100644
--- a/ext/tk/depend
+++ b/ext/tk/depend
@@ -1,2 +1 @@
-tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
-stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
index 8c8d833481..8b10353d1a 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -1,309 +1,4 @@
-# extconf.rb for tcltklib
-
require 'mkmf'
-
-is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
-#is_macosx = (/darwin/ =~ RUBY_PLATFORM)
-
-def find_framework(tcl_hdr, tk_hdr)
- if framework_dir = with_config("tcltk-framework")
- paths = [framework_dir]
- else
- unless tcl_hdr || tk_hdr ||
- enable_config("tcltk-framework", false) ||
- enable_config("mac-tcltk-framework", false)
- return false
- end
- paths = ["/Library/Frameworks", "/System/Library/Frameworks"]
- end
-
- checking_for('Tcl/Tk Framework') {
- paths.find{|dir|
- dir.strip!
- dir.chomp!('/')
- (tcl_hdr || FileTest.directory?(dir + "/Tcl.framework/") ) &&
- (tk_hdr || FileTest.directory?(dir + "/Tk.framework/") )
- }
- }
-end
-
-tcl_framework_header = with_config("tcl-framework-header")
-tk_framework_header = with_config("tk-framework-header")
-
-tcltk_framework = find_framework(tcl_framework_header, tk_framework_header)
-
-unless is_win32
- have_library("nsl", "t_open")
- have_library("socket", "socket")
- have_library("dl", "dlopen")
- have_library("m", "log")
-end
-
-dir_config("tk")
-dir_config("tcl")
-dir_config("X11")
-
-tklib = with_config("tklib")
-tcllib = with_config("tcllib")
-stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
-
-def find_tcl(tcllib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
- if stubs
- func = "Tcl_InitStubs"
- lib = "tclstub"
- else
- func = "Tcl_FindExecutable"
- lib = "tcl"
- end
- if tcllib
- find_library(tcllib, func, *paths)
- elsif find_library(lib, func, *paths)
- true
- else
- %w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
- find_library("#{lib}#{ver}", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}", func, *paths) or
- find_library("tcl#{ver}", func, *paths) or
- find_library("tcl#{ver.delete('.')}", func, *paths)
- }
- end
-end
-
-def find_tk(tklib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
- if stubs
- func = "Tk_InitStubs"
- lib = "tkstub"
- else
- func = "Tk_Init"
- lib = "tk"
- end
- if tklib
- find_library(tklib, func, *paths)
- elsif find_library(lib, func, *paths)
- true
- else
- %w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
- find_library("#{lib}#{ver}", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}", func, *paths) or
- find_library("tk#{ver}", func, *paths) or
- find_library("tk#{ver.delete('.')}", func, *paths)
- }
- end
-end
-
-def pthread_check()
- tcl_major_ver = nil
- tcl_minor_ver = nil
-
- # Is tcl-thread given by user ?
- case enable_config("tcl-thread")
- when true
- tcl_enable_thread = true
- when false
- tcl_enable_thread = false
- else
- tcl_enable_thread = nil
- end
-
- if (tclConfig = with_config("tclConfig-file"))
- if tcl_enable_thread == true
- puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.")
- elsif tcl_enable_thread == false
- puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.")
- else
- # tcl-thread is unknown and tclConfig.sh is given
- begin
- open(tclConfig, "r") do |cfg|
- while line = cfg.gets()
- if line =~ /^\s*TCL_THREADS=(0|1)/
- tcl_enable_thread = ($1 == "1")
- break
- end
-
- if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/
- tcl_major_ver = $2
- if tcl_major_ver =~ /^[1-7]$/
- tcl_enable_thread = false
- break
- end
- if tcl_major_ver == "8" && tcl_minor_ver == "0"
- tcl_enable_thread = false
- break
- end
- end
-
- if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/
- tcl_minor_ver = $2
- if tcl_major_ver == "8" && tcl_minor_ver == "0"
- tcl_enable_thread = false
- break
- end
- end
- end
- end
-
- if tcl_enable_thread == nil
- # not find definition
- if tcl_major_ver
- puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.")
- else
- puts("Warning: '#{tclConfig}' may not be a tclConfig file.")
- end
- tclConfig = false
- end
- rescue Exception
- puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file")
- tclConfig = false
- end
- end
- end
-
- if tcl_enable_thread == nil && !tclConfig
- # tcl-thread is unknown and tclConfig is unavailable
- begin
- try_run_available = try_run("int main() { exit(0); }")
- rescue Exception
- # cannot try_run. Is CROSS-COMPILE environment?
- puts(%Q'\
-*****************************************************************************
-**
-** PTHREAD SUPPORT CHECK WARNING:
-**
-** We cannot check the consistency of pthread support between Ruby
-** and the Tcl/Tk library in your environment (are you perhaps
-** cross-compiling?). If pthread support for these 2 packages is
-** inconsistent you may find you get errors when running Ruby/Tk
-** (e.g. hangs or segmentation faults). We strongly recommend
-** you to check the consistency manually.
-**
-*****************************************************************************
-')
- return true
- end
- end
-
- if tcl_enable_thread == nil
- # tcl-thread is unknown
- if try_run(<<EOF)
-#include <tcl.h>
-int main() {
- Tcl_Interp *ip;
- ip = Tcl_CreateInterp();
- exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1);
-}
-EOF
- tcl_enable_thread = true
- elsif try_run(<<EOF)
-#include <tcl.h>
-static Tcl_ThreadDataKey dataKey;
-int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
-EOF
- tcl_enable_thread = true
- else
- tcl_enable_thread = false
- end
- end
-
- # check pthread mode
- if (macro_defined?('HAVE_NATIVETHREAD', '#include "ruby.h"'))
- # ruby -> enable
- unless tcl_enable_thread
- # ruby -> enable && tcl -> disable
- puts(%Q'\
-*****************************************************************************
-**
-** PTHREAD SUPPORT MODE WARNING:
-**
-** Ruby is compiled with --enable-pthread, but your Tcl/Tk library
-** seems to be compiled without pthread support. Although you can
-** create the tcltklib library, this combination may cause errors
-** (e.g. hangs or segmentation faults). If you have no reason to
-** keep the current pthread support status, we recommend you reconfigure
-** and recompile the libraries so that both or neither support pthreads.
-**
-** If you want change the status of pthread support, please recompile
-** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk
-** with "--enable-threads" configure option (if your Tcl/Tk is later
-** than or equal to Tcl/Tk 8.1).
-**
-*****************************************************************************
-')
- end
-
- # ruby -> enable && tcl -> enable/disable
- if tcl_enable_thread
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
- else
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
- end
-
- return true
-
- else
- # ruby -> disable
- if tcl_enable_thread
- # ruby -> disable && tcl -> enable
- puts(%Q'\
-*****************************************************************************
-**
-** PTHREAD SUPPORT MODE ERROR:
-**
-** Ruby is not compiled with --enable-pthread, but your Tcl/Tk
-** library seems to be compiled with pthread support. This
-** combination may cause frequent hang or segmentation fault
-** errors when Ruby/Tk is working. We recommend that you NEVER
-** create the library with such a combination of pthread support.
-**
-** Please recompile Ruby with the "--enable-pthread" configure option
-** or recompile Tcl/Tk with the "--disable-threads" configure option.
-**
-*****************************************************************************
-')
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
- return false
- else
- # ruby -> disable && tcl -> disable
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
- return true
- end
- end
-end
-
-if tcltk_framework ||
- (have_header("tcl.h") && have_header("tk.h") &&
- (is_win32 || find_library("X11", "XOpenDisplay",
- "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
- find_tcl(tcllib, stubs) &&
- find_tk(tklib, stubs))
- $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
- $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
-
- if tcltk_framework
- if tcl_framework_header
- $CPPFLAGS += " -I#{tcl_framework_header}"
- else
- $CPPFLAGS += " -I#{tcltk_framework}/Tcl.framework/Headers"
- end
-
- if tk_framework_header
- $CPPFLAGS += " -I#{tk_framework_header}"
- else
- $CPPFLAGS += " -I#{tcltk_framework}/Tk.framework/Headers"
- end
-
- $LDFLAGS += ' -framework Tk -framework Tcl'
- end
-
- if stubs or pthread_check
- # create Makefile
-
- # for SUPPORT_STATUS
- $INSTALLFILES ||= []
- $INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
-
- # create
- create_makefile("tcltklib")
- end
-end
+$preload = ["tcltklib"]
+($INSTALLFILES||=[]) << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
+create_makefile("tkutil")
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index 78ed1aa6ee..f44f576626 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -7,7 +7,7 @@ require 'tkutil'
require 'thread'
if defined? Tk
- fail RuntimeError,"'multi-tk' library must be required before requiring 'tk'"
+ fail RuntimeError, "'multi-tk' library must be required before requiring 'tk'"
end
################################################
@@ -34,64 +34,6 @@ end
################################################
-# use pseudo-toplevel feature of MultiTkIp ?
-if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) ||
- Use_PseudoToplevel_Feature_of_MultiTkIp)
- module MultiTkIp_PseudoToplevel_Evaluable
- #def pseudo_toplevel_eval(body = Proc.new)
- # Thread.current[:TOPLEVEL] = self
- # begin
- # body.call
- # ensure
- # Thread.current[:TOPLEVEL] = nil
- # end
- #end
-
- def pseudo_toplevel_evaluable?
- @pseudo_toplevel_evaluable
- end
-
- def pseudo_toplevel_evaluable=(mode)
- @pseudo_toplevel_evaluable = (mode)? true: false
- end
-
- def self.extended(mod)
- mod.__send__(:extend_object, mod)
- mod.instance_variable_set('@pseudo_toplevel_evaluable', true)
- end
- end
-
- class Object
- alias __method_missing_alias_for_MultiTkIp__ method_missing
- private :__method_missing_alias_for_MultiTkIp__
-
- def method_missing(id, *args)
- begin
- has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) &&
- top.respond_to?(:pseudo_toplevel_evaluable?) &&
- top.pseudo_toplevel_evaluable? &&
- top.respond_to?(id)
- rescue Exception => e
- has_top = false
- end
-
- if has_top
- top.__send__(id, *args)
- else
- __method_missing_alias_for_MultiTkIp__(id, *args)
- end
- end
- end
-else
- # dummy
- module MultiTkIp_PseudoToplevel_Evaluable
- def pseudo_toplevel_evaluable?
- false
- end
- end
-end
-
-################################################
# exceptiopn to treat the return value from IP
class MultiTkIp_OK < Exception
def self.send(thread, ret=nil)
@@ -112,9 +54,7 @@ MultiTkIp_OK.freeze
################################################
# methods for construction
class MultiTkIp
- BASE_DIR = File.dirname(__FILE__)
-
- @@SLAVE_IP_ID = ['slave'.freeze, '0'.taint].freeze
+ SLAVE_IP_ID = ['slave'.freeze, '0'.taint].freeze
@@IP_TABLE = {}.taint unless defined?(@@IP_TABLE)
@@ -123,133 +63,31 @@ class MultiTkIp
@@TK_TABLE_LIST = [].taint unless defined?(@@TK_TABLE_LIST)
- unless defined?(@@TK_CMD_TBL)
- @@TK_CMD_TBL = Object.new.taint
-
- @@TK_CMD_TBL.instance_variable_set('@tbl', {}.taint)
-
- class << @@TK_CMD_TBL
- allow = [
- '__send__', '__id__', 'freeze', 'inspect', 'kind_of?',
- '[]', '[]=', 'delete', 'each', 'has_key?'
- ]
- instance_methods.each{|m| undef_method(m) unless allow.index(m)}
-
- def kind_of?(klass)
- @tbl.kind_of?(klass)
- end
-
- def inspect
- if Thread.current.group == ThreadGroup::Default
- @tbl.inspect
- else
- ip = MultiTkIp.__getip
- @tbl.reject{|idx, ent| ent.respond_to?(:ip) && ent.ip != ip}.inspect
- end
- end
-
- def [](idx)
- return unless (ent = @tbl[idx])
- if Thread.current.group == ThreadGroup::Default
- ent
- elsif ent.respond_to?(:ip)
- (ent.ip == MultiTkIp.__getip)? ent: nil
- else
- ent
- end
- end
-
- def []=(idx,val)
- if self.has_key?(idx) && Thread.current.group != ThreadGroup::Default
- fail SecurityError,"cannot change the entried command"
- end
- @tbl[idx] = val
- end
-
- def delete(idx, &blk)
- # if gets an entry, is permited to delete
- if self[idx]
- @tbl.delete(idx)
- elsif blk
- blk.call(idx)
- else
- nil
- end
- end
-
- def each(&blk)
- if Thread.current.group == ThreadGroup::Default
- @tbl.each(&blk)
- else
- ip = MultiTkIp.__getip
- @tbl.each{|idx, ent|
- blk.call(idx, ent) unless ent.respond_to?(:ip) && ent.ip != ip
- }
- end
- self
- end
-
- def has_key?(k)
- @tbl.has_key?(k)
- end
- alias include? has_key?
- alias key? has_key?
- alias member? has_key?
- end
-
- @@TK_CMD_TBL.freeze
- end
+ @@TK_CMD_TBL = {}.taint unless defined?(@@TK_CMD_TBL)
######################################
- @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){
+ @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){|c|
def initialize(ip, cmd)
@ip = ip
@cmd = cmd
- freeze
end
attr_reader :ip, :cmd
def inspect
cmd.inspect
end
def call(*args)
- unless @ip.deleted?
- current = Thread.current
- backup_ip = current['callback_ip']
- current['callback_ip'] = @ip
- begin
- ret = @ip.cb_eval(@cmd, *args)
- fail ret if ret.kind_of?(Exception)
- ret
- rescue TkCallbackBreak, TkCallbackContinue => e
+ begin
+ unless @ip.deleted?
+ @ip.cb_eval(@cmd, *args)
+ end
+ rescue TkCallbackBreak, TkCallbackContinue => e
+ fail e
+ rescue Exception => e
+ if @ip.safe?
+ # ignore
+ else
fail e
- rescue SecurityError => e
- # in 'exit', 'exit!', and 'abort' : security error --> delete IP
- if e.backtrace[0] =~ /^(.+?):(\d+):in `(exit|exit!|abort)'/
- @ip.delete
- elsif @ip.safe?
- if @ip.respond_to?(:cb_error)
- @ip.cb_error(e)
- else
- nil # ignore
- end
- else
- fail e
- end
- rescue Exception => e
- fail e if e.message =~ /^TkCallback/
-
- if @ip.safe?
- if @ip.respond_to?(:cb_error)
- @ip.cb_error(e)
- else
- nil # ignore
- end
- else
- fail e
- end
- ensure
- current['callback_ip'] = backup_ip
end
end
end
@@ -267,23 +105,19 @@ class MultiTkIp
def _check_and_return(thread, exception, wait=0)
unless thread
- unless exception.kind_of?(MultiTkIp_OK)
+ unless exception.kind_of?(MultiTkIp_OK) || safe?
msg = "#{exception.class}: #{exception.message}"
-
- if @interp.deleted?
- warn("Warning (#{self}): " + msg)
- return nil
- end
-
- if safe?
- warn("Warning (#{self}): " + msg) if $DEBUG
- return nil
- end
-
begin
- @interp._eval_without_enc(@interp._merge_tklist('bgerror', msg))
+ if @interp.deleted?
+ warn('Warning: ' + msg)
+ elsif @interp._eval_without_enc('info command bgerror').size != 0
+ @interp._eval(@interp._merge_tklist('bgerror', msg))
+ else
+ warn('Warning: ' + msg)
+ end
rescue Exception => e
- warn("Warning (#{self}): " + msg)
+ warn('Warning: ' + msg)
+ warn('Warning: ' + e.message)
end
end
return nil
@@ -317,18 +151,6 @@ class MultiTkIp
######################################
- def set_cb_error(cmd = Proc.new)
- @cb_error_proc[0] = cmd
- end
-
- def cb_error(e)
- if @cb_error_proc[0].respond_to?(:call)
- @cb_error_proc[0].call(e)
- end
- end
-
- ######################################
-
def set_safe_level(safe)
if safe > @safe_level[0]
@safe_level[0] = safe
@@ -360,18 +182,14 @@ class MultiTkIp
end
def running_mainloop?
- @wait_on_mainloop[1] > 0
+ @wait_on_mainloop[1]
end
def _destroy_slaves_of_slaveIP(ip)
unless ip.deleted?
- # ip._split_tklist(ip._invoke('interp', 'slaves')).each{|name|
- ip._split_tklist(ip._invoke_without_enc('interp', 'slaves')).each{|name|
- name = _fromUTF8(name)
+ ip._split_tklist(ip._invoke('interp', 'slaves')).each{|name|
begin
- # ip._eval_without_enc("#{name} eval {foreach i [after info] {after cancel $i}}")
- after_ids = ip._eval_without_enc("#{name} eval {after info}")
- ip._eval_without_enc("#{name} eval {foreach i {#{after_ids}} {after cancel $i}}")
+ ip._eval_without_enc("#{name} eval {foreach i [after info] {after cancel $i}}")
rescue Exception
end
begin
@@ -410,27 +228,15 @@ class MultiTkIp
def _receiver_eval_proc_core(safe_level, thread, cmd, *args)
begin
#ret = proc{$SAFE = safe_level; cmd.call(*args)}.call
- #ret = cmd.call(safe_level, *args)
- normal_ret = false
- ret = catch(:IRB_EXIT) do # IRB hack
- retval = cmd.call(safe_level, *args)
- normal_ret = true
- retval
- end
- unless normal_ret
- # catch IRB_EXIT
- exit(ret)
- end
- ret
+ ret = cmd.call(safe_level, *args)
+
rescue SystemExit => e
# delete IP
unless @interp.deleted?
@slave_ip_tbl.each{|name, subip|
_destroy_slaves_of_slaveIP(subip)
begin
- # subip._eval_without_enc("foreach i [after info] {after cancel $i}")
- after_ids = subip._eval_without_enc("after info")
- subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
+ subip._eval_without_enc("foreach i [after info] {after cancel $i}")
rescue Exception
end
=begin
@@ -464,9 +270,7 @@ class MultiTkIp
}
begin
- # @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
- after_ids = @interp._eval_without_enc("after info")
- @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
+ @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
rescue Exception
end
begin
@@ -487,8 +291,7 @@ class MultiTkIp
_check_and_return(thread, MultiTkIp_OK.new(nil))
end
- # if master? && !safe? && allow_ruby_exit?
- if !@interp.deleted? && master? && !safe? && allow_ruby_exit?
+ if master? && !safe? && allow_ruby_exit?
=begin
ObjectSpace.each_object(TclTkIp){|obj|
obj.delete unless obj.deleted?
@@ -507,9 +310,7 @@ class MultiTkIp
@slave_ip_tbl.each{|name, subip|
_destroy_slaves_of_slaveIP(subip)
begin
- # subip._eval_without_enc("foreach i [after info] {after cancel $i}")
- after_ids = subip._eval_without_enc("after info")
- subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
+ subip._eval_without_enc("foreach i [after info] {after cancel $i}")
rescue Exception
end
=begin
@@ -543,9 +344,7 @@ class MultiTkIp
}
begin
- # @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
- after_ids = @interp._eval_without_enc("after info")
- @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
+ @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
rescue Exception
end
=begin
@@ -571,16 +370,6 @@ class MultiTkIp
rescue Exception => e
# raise exception
- begin
- bt = _toUTF8(e.backtrace.join("\n"))
- bt.instance_variable_set(:@encoding, 'utf-8')
- rescue Exception
- bt = e.backtrace.join("\n")
- end
- begin
- @interp._set_global_var('errorInfo', bt)
- rescue Exception
- end
_check_and_return(thread, e)
else
@@ -610,21 +399,12 @@ class MultiTkIp
private :_receiver_eval_proc, :_receiver_eval_proc_core
def _receiver_mainloop(check_root)
- if @evloop_thread[0] && @evloop_thread[0].alive?
- @evloop_thread[0]
- else
- @evloop_thread[0] = Thread.new{
- while !@interp.deleted?
- #if check_root
- # inf = @interp._invoke_without_enc('info', 'command', '.')
- # break if !inf.kind_of?(String) || inf != '.'
- #end
- break if check_root && !@interp.has_mainwindow?
- sleep 0.5
- end
- }
- @evloop_thread[0]
- end
+ Thread.new{
+ while !@interp.deleted?
+ break if @interp._invoke_without_enc('info', 'command', '.').size == 0
+ sleep 0.5
+ end
+ }
end
def _create_receiver_and_watchdog(lvl = $SAFE)
@@ -632,7 +412,7 @@ class MultiTkIp
# command-procedures receiver
receiver = Thread.new(lvl){|safe_level|
- last_thread = {}
+ last_thread = nil
loop do
break if @interp.deleted?
@@ -655,9 +435,8 @@ class MultiTkIp
else
# procedure
- last_thread[thread] = _receiver_eval_proc(last_thread[thread],
- safe_level, thread,
- cmd, *args)
+ last_thread = _receiver_eval_proc(last_thread, safe_level,
+ thread, cmd, *args)
end
end
}
@@ -667,7 +446,6 @@ class MultiTkIp
begin
loop do
sleep 1
- receiver.kill if @interp.deleted?
break unless receiver.alive?
end
rescue Exception
@@ -717,8 +495,6 @@ class MultiTkIp
@slave_ip_top = {}.taint
- @evloop_thread = [].taint
-
unless keys.kind_of? Hash
fail ArgumentError, "expecting a Hash object for the 2nd argument"
end
@@ -726,11 +502,9 @@ class MultiTkIp
@interp = TclTkIp.new(name, _keys2opts(keys))
@ip_name = nil
- @callback_status = [].taint
-
@system = Object.new
- @wait_on_mainloop = [true, 0].taint
+ @wait_on_mainloop = [true, false]
@threadgroup = Thread.current.group
@@ -752,49 +526,6 @@ class MultiTkIp
#################################
- @pseudo_toplevel = [false, nil]
-
- def self.__pseudo_toplevel
- Thread.current.group == ThreadGroup::Default &&
- MultiTkIp.__getip == @@DEFAULT_MASTER &&
- self.__pseudo_toplevel_evaluable? && @pseudo_toplevel[1]
- end
-
- def self.__pseudo_toplevel=(m)
- unless (Thread.current.group == ThreadGroup::Default &&
- MultiTkIp.__getip == @@DEFAULT_MASTER)
- fail SecurityError, "no permission to manipulate"
- end
-
- # if m.kind_of?(Module) && m.respond_to?(:pseudo_toplevel_evaluable?)
- if m.respond_to?(:pseudo_toplevel_evaluable?)
- @pseudo_toplevel[0] = true
- @pseudo_toplevel[1] = m
- else
- fail ArgumentError, 'fail to set pseudo-toplevel'
- end
- self
- end
-
- def self.__pseudo_toplevel_evaluable?
- begin
- @pseudo_toplevel[0] && @pseudo_toplevel[1].pseudo_toplevel_evaluable?
- rescue Exception
- false
- end
- end
-
- def self.__pseudo_toplevel_evaluable=(mode)
- unless (Thread.current.group == ThreadGroup::Default &&
- MultiTkIp.__getip == @@DEFAULT_MASTER)
- fail SecurityError, "no permission to manipulate"
- end
-
- @pseudo_toplevel[0] = (mode)? true: false
- end
-
- #################################
-
@assign_request = Class.new(Exception){
def self.new(target, ret)
obj = super()
@@ -849,40 +580,10 @@ class MultiTkIp
#################################
- @init_ip_env_queue = Queue.new
- Thread.new{
- current = Thread.current
- loop {
- mtx, ret, table, script = @init_ip_env_queue.deq
- begin
- ret[0] = table.each{|tg, ip| ip._init_ip_env(script) }
- rescue Exception => e
- ret[0] = e
- ensure
- mtx.unlock
- end
- }
- }
-
- def self.__init_ip_env__(table, script)
- ret = []
- mtx = Mutex.new.lock
- @init_ip_env_queue.enq([mtx, ret, table, script])
- mtx.lock
- if ret[0].kind_of?(Exception)
- raise ret[0]
- else
- ret[0]
- end
- end
-
- #################################
-
class << self
undef :instance_eval
end
}
-
@@DEFAULT_MASTER.freeze # defend against modification
######################################
@@ -912,7 +613,7 @@ class MultiTkIp
######################################
- @@SAFE_OPT_LIST = [
+ SAFE_OPT_LIST = [
'accessPath'.freeze,
'statics'.freeze,
'nested'.freeze,
@@ -931,7 +632,7 @@ class MultiTkIp
name = v
elsif k_str == 'safe'
safe = v
- elsif @@SAFE_OPT_LIST.member?(k_str)
+ elsif SAFE_OPT_LIST.member?(k_str)
safe_opts[k_str] = v
else
tk_opts[k_str] = v
@@ -947,9 +648,9 @@ class MultiTkIp
private :_parse_slaveopts
def _create_slave_ip_name
- name = @@SLAVE_IP_ID.join('')
- @@SLAVE_IP_ID[1].succ!
- name.freeze
+ name = SLAVE_IP_ID.join('')
+ SLAVE_IP_ID[1].succ!
+ name
end
private :_create_slave_ip_name
@@ -989,7 +690,7 @@ class MultiTkIp
else
begin
pathname = @interp._invoke('winfo', 'pathname', new_keys['use'])
- assoc_display = @interp._invoke('winfo', 'screen', pathname)
+ assco_display = @interp._invoke('winfo', 'screen', pathname)
rescue
assoc_display = new_keys['display']
end
@@ -997,7 +698,7 @@ class MultiTkIp
# match display?
if assoc_display != new_keys['display']
- if optkeys.key?(:display) || optkeys.key?('display')
+ if optkeys.keys?(:display) || optkeys.keys?('display')
fail RuntimeError,
"conflicting 'display'=>#{new_keys['display']} " +
"and display '#{assoc_display}' on 'use'=>#{new_keys['use']}"
@@ -1031,8 +732,8 @@ class MultiTkIp
# create toplevel widget
begin
top = TkToplevel.new(toplevel_keys)
- rescue NameError => e
- fail e unless @interp.safe?
+ rescue NameError
+ fail unless @interp.safe?
fail SecurityError, "unable create toplevel on the safe interpreter"
end
msg = "Untrusted Ruby/Tk applet (#{slave_name})"
@@ -1051,11 +752,7 @@ class MultiTkIp
#slave_ip.delete
slave_ip._eval_without_enc('exit')
end
- begin
- top.destroy if top.winfo_exist?
- rescue
- # ignore
- end
+ top.destroy if top.winfo_exist?
}
tag = TkBindTag.new.bind('Destroy', slave_delete_proc)
@@ -1083,7 +780,6 @@ class MultiTkIp
dup_keys['fill'] = :both unless dup_keys.key?('fill')
dup_keys['expand'] = true unless dup_keys.key?('expand')
c = TkFrame.new(top, :container=>true).pack(dup_keys)
- c.bind('Destroy', proc{top.destroy})
# return keys
loadTk_keys['use'] = TkWinfo.id(c)
@@ -1092,8 +788,6 @@ class MultiTkIp
private :__create_safetk_frame
def __create_safe_slave_obj(safe_opts, app_name, tk_opts)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
# safe interpreter
ip_name = _create_slave_ip_name
slave_ip = @interp.create_slave(ip_name, true)
@@ -1135,8 +829,6 @@ class MultiTkIp
end
def __create_trusted_slave_obj(name, keys)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
ip_name = _create_slave_ip_name
slave_ip = @interp.create_slave(ip_name, false)
slave_ip._invoke('set', 'argv0', name) if name.kind_of?(String)
@@ -1149,8 +841,6 @@ class MultiTkIp
######################################
def _create_slave_object(keys={})
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
ip = MultiTkIp.new_slave(self, keys={})
@slave_ip_tbl[ip.name] = ip
end
@@ -1166,11 +856,7 @@ class MultiTkIp
fail SecurityError, "cannot create a master-ip at level #{$SAFE}"
end
- if master.deleted? && safeip == nil
- fail RuntimeError, "cannot create a slave of a deleted interpreter"
- end
-
- if !master.deleted? && !master.master? && master.safe?
+ if !master.master? && master.safe?
fail SecurityError, "safe-slave-ip cannot create a new interpreter"
end
@@ -1186,17 +872,11 @@ class MultiTkIp
@tk_table_list = []
@slave_ip_tbl = {}
@slave_ip_top = {}
- @cb_error_proc = []
- @evloop_thread = []
@tk_windows.taint unless @tk_windows.tainted?
@tk_table_list.taint unless @tk_table_list.tainted?
@slave_ip_tbl.taint unless @slave_ip_tbl.tainted?
@slave_ip_top.taint unless @slave_ip_top.tainted?
- @cb_error_proc.taint unless @cb_error_proc.tainted?
- @evloop_thread.taint unless @evloop_thread.tainted?
-
- @callback_status = []
name, safe, safe_opts, tk_opts = _parse_slaveopts(keys)
@@ -1243,13 +923,10 @@ class MultiTkIp
@system = Object.new
- @wait_on_mainloop = [true, 0].taint
- # @wait_on_mainloop = [false, 0].taint
+ @wait_on_mainloop = [true, false]
@threadgroup = ThreadGroup.new
- @pseudo_toplevel = [false, nil]
-
@cmd_queue = Queue.new
=begin
@@ -1273,21 +950,15 @@ class MultiTkIp
undef :instance_eval
end
- # dummy call for initialization
- self.eval_proc{ Tk.tk_call('set', 'tcl_patchLevel') }
-
self.freeze # defend against modification
end
######################################
def _default_delete_hook(slave)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- @slave_ip_tbl.delete(slave)
- top = @slave_ip_top.delete(slave)
- if top.kind_of?(String)
+ if @slave_ip_top[slave].kind_of?(String)
# call default hook of safetk.tcl (ignore exceptions)
- if top == ''
+ if @slave_ip_top[slave] == ''
begin
@interp._eval("::safe::disallowTk #{slave}")
rescue
@@ -1295,19 +966,20 @@ class MultiTkIp
end
else # toplevel path
begin
- @interp._eval("::safe::tkDelete {} #{top} #{slave}")
+ @interp._eval("::safe::tkDelete {} #{@slave_ip_top[slave]} #{slave}")
rescue
warn("Waring: fail to call '::safe::tkDelete'") if $DEBUG
begin
- @interp._eval("destroy #{top}")
+ @interp._eval("destroy #{@slave_ip_top[slave]}")
rescue
warn("Waring: fail to destroy toplevel") if $DEBUG
end
end
end
end
+ @slave_ip_tbl.delete(slave)
+ @slave_ip_top.delete(slave)
end
-
end
@@ -1317,19 +989,14 @@ class MultiTkIp
__getip._ip_id_
end
def _ip_id_
- # for RemoteTkIp
''
end
def self.__getip
- current = Thread.current
- if TclTkLib.mainloop_thread? != false && current['callback_ip']
- return current['callback_ip']
- end
- if current.group == ThreadGroup::Default
+ if Thread.current.group == ThreadGroup::Default
@@DEFAULT_MASTER
else
- ip = @@IP_TABLE[current.group]
+ ip = @@IP_TABLE[Thread.current.group]
unless ip
fail SecurityError,
"cannot call Tk methods on #{Thread.current.inspect}"
@@ -1361,10 +1028,7 @@ class << MultiTkIp
end
ip = __new(__getip, nil, keys)
- #ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
- if block_given?
- Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
- end
+ ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
ip
end
@@ -1385,10 +1049,7 @@ class << MultiTkIp
end
ip = __new(__getip, false, keys)
- # ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
- if block_given?
- Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
- end
+ ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
ip
end
alias new_trusted_slave new_slave
@@ -1406,10 +1067,7 @@ class << MultiTkIp
end
ip = __new(__getip, true, keys)
- # ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
- if block_given?
- Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
- end
+ ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
ip
end
alias new_safeTk new_safe_slave
@@ -1420,21 +1078,13 @@ end
class MultiTkIp
def inspect
s = self.to_s.chop!
- if self.manipulable?
- if master?
- if @interp.deleted?
- s << ':deleted-master'
- else
- s << ':master'
- end
+ if master?
+ s << ':master'
+ else
+ if @interp.safe?
+ s << ':safe-slave'
else
- if @interp.deleted?
- s << ':deleted-slave'
- elsif @interp.safe?
- s << ':safe-slave'
- else
- s << ':trusted-slave'
- end
+ s << ':trusted-slave'
end
end
s << '>'
@@ -1459,7 +1109,6 @@ class MultiTkIp
end
def alive?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
begin
return false unless @cmd_receiver.alive?
return false if @interp.deleted?
@@ -1493,7 +1142,6 @@ class MultiTkIp
end
def slaves(all = false)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp','slaves').split.map!{|name|
if @slave_ip_tbl.key?(name)
@slave_ip_tbl[name]
@@ -1507,20 +1155,6 @@ class MultiTkIp
def self.slaves(all = false)
__getip.slaves(all)
end
-
- def manipulable?
- return true if (Thread.current.group == ThreadGroup::Default)
- ip = MultiTkIp.__getip
- (ip == self) || ip._is_master_of?(@interp)
- end
- def self.manipulable?
- true
- end
-
- def _is_master_of?(tcltkip_obj)
- tcltkip_obj.slave_of?(@interp)
- end
- protected :_is_master_of?
end
@@ -1548,7 +1182,7 @@ class MultiTkIp
end
def _init_ip_env(script)
- self.eval_proc{script.call(self)}
+ script.call(self)
end
def _add_tk_procs(name, args, body)
@@ -1559,20 +1193,8 @@ class MultiTkIp
}
end
- def _remove_tk_procs(*names)
- return if slave?
- names.each{|name|
- name = name.to_s
- @interp._invoke('rename', name, '')
- @interp._invoke('interp', 'slaves').split.each{|slave|
- @interp._invoke('interp', 'alias', slave, name, '') rescue nil
- }
- }
- end
-
def _init_ip_internal(init_ip_env, add_tk_procs)
- #init_ip_env.each{|script| self.eval_proc{script.call(self)}}
- init_ip_env.each{|script| self._init_ip_env(script)}
+ init_ip_env.each{|script| script.call(self)}
add_tk_procs.each{|name, args, body|
if master?
@interp._invoke('proc', name, args, body) if args && body
@@ -1596,21 +1218,9 @@ class MultiTkIp
__getip._tk_table_list[id]
end
def self.create_table
- if __getip.slave?
- begin
- raise SecurityError, "slave-IP has no permission creating a new table"
- rescue SecurityError => e
- #p e.backtrace
- # Is called on a Ruby/Tk library?
- caller_info = e.backtrace[1]
- if caller_info =~ %r{^#{MultiTkIp::BASE_DIR}/(tk|tkextlib)/[^:]+\.rb:}
- # Probably, caller is a Ruby/Tk library --> allow creating
- else
- raise e
- end
- end
- end
-
+ #if __getip.slave?
+ # raise SecurityError, "slave-IP has no permission creating a new table"
+ #end
id = @@TK_TABLE_LIST.size
obj = Object.new
@@TK_TABLE_LIST << obj
@@ -1626,48 +1236,15 @@ class MultiTkIp
def self.init_ip_env(script = Proc.new)
@@INIT_IP_ENV << script
- if __getip.slave?
- begin
- raise SecurityError, "slave-IP has no permission initializing IP env"
- rescue SecurityError => e
- #p e.backtrace
- # Is called on a Ruby/Tk library?
- caller_info = e.backtrace[1]
- if caller_info =~ %r{^#{MultiTkIp::BASE_DIR}/(tk|tkextlib)/[^:]+\.rb:}
- # Probably, caller is a Ruby/Tk library --> allow creating
- else
- raise e
- end
- end
- end
-
- # @@IP_TABLE.each{|tg, ip|
- # ip._init_ip_env(script)
- # }
- @@DEFAULT_MASTER.__init_ip_env__(@@IP_TABLE, script)
+ @@IP_TABLE.each{|tg, ip|
+ ip._init_ip_env(script)
+ }
end
def self.add_tk_procs(name, args=nil, body=nil)
- if name.kind_of?(Array) # => an array of [name, args, body]
- name.each{|param| self.add_tk_procs(*param)}
- else
- name = name.to_s
- @@ADD_TK_PROCS << [name, args, body]
- @@IP_TABLE.each{|tg, ip|
- ip._add_tk_procs(name, args, body)
- }
- end
- end
-
- def self.remove_tk_procs(*names)
- names.each{|name|
- name = name.to_s
- @@ADD_TK_PROCS.delete_if{|elem|
- elem.kind_of?(Array) && elem[0].to_s == name
- }
- }
+ @@ADD_TK_PROCS << [name, args, body]
@@IP_TABLE.each{|tg, ip|
- ip._remove_tk_procs(*names)
+ ip._add_tk_procs(name, args, body)
}
end
@@ -1686,135 +1263,33 @@ class MultiTkIp
@@CB_ENTRY_CLASS.new(__getip, cmd).freeze
end
-=begin
def cb_eval(cmd, *args)
#self.eval_callback{ TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *args)) }
#ret = self.eval_callback{ TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *args)) }
ret = self.eval_callback(*args){|safe, *params|
- $SAFE=safe if $SAFE < safe
- TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
+ $SAFE=safe; TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
}
if ret.kind_of?(Exception)
- raise ret
+ raise ret
end
- ret
end
-=end
- def cb_eval(cmd, *args)
- self.eval_callback(*args){|safe, *params|
- $SAFE=safe if $SAFE < safe
- # TkUtil.eval_cmd(cmd, *params)
- TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
- }
- end
-=begin
- def cb_eval(cmd, *args)
- @callback_status[0] ||= TkVariable.new
- @callback_status[1] ||= TkVariable.new
- st, val = @callback_status
- th = Thread.new{
- self.eval_callback(*args){|safe, *params|
- #p [status, val, safe, *params]
- $SAFE=safe if $SAFE < safe
- begin
- TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
- rescue TkCallbackContinue
- st.value = 4
- rescue TkCallbackBreak
- st.value = 3
- rescue TkCallbackReturn
- st.value = 2
- rescue Exception => e
- val.value = e.message
- st.value = 1
- else
- st.value = 0
- end
- }
- }
- begin
- st.wait
- status = st.numeric
- retval = val.value
- rescue => e
- fail e
- end
-
- if status == 1
- fail RuntimeError, retval
- elsif status == 2
- fail TkCallbackReturn, "Tk callback returns 'return' status"
- elsif status == 3
- fail TkCallbackBreak, "Tk callback returns 'break' status"
- elsif status == 4
- fail TkCallbackContinue, "Tk callback returns 'continue' status"
- else
- ''
- end
- end
-=end
-
end
-# pseudo-toplevel operation support
-class MultiTkIp
- # instance method
- def __pseudo_toplevel
- ip = MultiTkIp.__getip
- (ip == @@DEFAULT_MASTER || ip == self) &&
- self.__pseudo_toplevel_evaluable? && @pseudo_toplevel[1]
- end
-
- def __pseudo_toplevel=(m)
- unless (Thread.current.group == ThreadGroup::Default &&
- MultiTkIp.__getip == @@DEFAULT_MASTER)
- fail SecurityError, "no permission to manipulate"
- end
-
- # if m.kind_of?(Module) && m.respond_to?(:pseudo_toplevel_evaluable?)
- if m.respond_to?(:pseudo_toplevel_evaluable?)
- @pseudo_toplevel[0] = true
- @pseudo_toplevel[1] = m
- else
- fail ArgumentError, 'fail to set pseudo-toplevel'
- end
- self
- end
-
- def __pseudo_toplevel_evaluable?
- begin
- @pseudo_toplevel[0] && @pseudo_toplevel[1].pseudo_toplevel_evaluable?
- rescue Exception
- false
- end
- end
-
- def __pseudo_toplevel_evaluable=(mode)
- unless (Thread.current.group == ThreadGroup::Default &&
- MultiTkIp.__getip == @@DEFAULT_MASTER)
- fail SecurityError, "no permission to manipulate"
- end
-
- @pseudo_toplevel[0] = (mode)? true: false
- end
-end
# evaluate a procedure on the proper interpreter
class MultiTkIp
# instance method
def eval_proc_core(req_val, cmd, *args)
# check
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
unless cmd.kind_of?(Proc) || cmd.kind_of?(Method)
raise RuntimeError, "A Proc/Method object is expected for the 'cmd' argument"
end
# on IP thread
- if @cmd_receiver == Thread.current ||
- (!req_val && TclTkLib.mainloop_thread? != false) # callback
+ if (@cmd_receiver == Thread.current)
begin
- ret = cmd.call(safe_level, *args)
- rescue SystemExit => e
+ ret = cmd.call(*args)
+ rescue SystemExit
# exit IP
warn("Warning: "+ $! + " on " + self.inspect) if $DEBUG
begin
@@ -1829,18 +1304,6 @@ class MultiTkIp
((e.message.length > 0)? ' "' + e.message + '"': '') +
" on " + self.inspect)
end
-=begin
- begin
- bt = _toUTF8(e.backtrace.join("\n"))
- bt.instance_variable_set(:@encoding, 'utf-8')
- rescue Exception
- bt = e.backtrace.join("\n")
- end
- begin
- @interp._set_global_var('errorInfo', bt)
- rescue Exception
- end
-=end
ret = e
end
return ret
@@ -1852,7 +1315,7 @@ class MultiTkIp
@cmd_queue.enq([nil, cmd, *args])
rescue Exception => e
# ignore
- if $DEBUG
+ if $DEBUG || true
warn("Warning: " + e.class.inspect +
((e.message.length > 0)? ' "' + e.message + '"': '') +
" on " + self.inspect)
@@ -1876,7 +1339,7 @@ class MultiTkIp
self._eval_without_enc('exit')
rescue Exception
end
- if !self.deleted? && !safe? && allow_ruby_exit?
+ if !safe? && allow_ruby_exit?
self.delete
fail e
else
@@ -1894,25 +1357,35 @@ class MultiTkIp
end
private :eval_proc_core
+=begin
def eval_callback(*args)
if block_given?
- cmd = Proc.new
+ eval_proc_core(false, proc{$SAFE=@safe_level[0]; Proc.new}.call, *args)
else
- cmd = args.shift
+ eval_proc_core(false, *args)
end
- current = Thread.current
- backup_ip = current['callback_ip']
- current['callback_ip'] = self
- begin
- eval_proc_core(false, cmd, *args)
- ensure
- current['callback_ip'] = backup_ip
+ end
+=end
+ def eval_callback(*args)
+ if block_given?
+ eval_proc_core(false, Proc.new, *args)
+ else
+ eval_proc_core(false, *args)
end
end
+=begin
+ def eval_proc(*args)
+ if block_given?
+ eval_proc_core(true, proc{$SAFE=@safe_level[0]; Proc.new}.call, *args)
+ else
+ eval_proc_core(true, *args)
+ end
+ end
+=end
def eval_proc(*args)
# The scope of the eval-block of 'eval_proc' method is different from
- # the external. If you want to pass local values to the eval-block,
+ # the enternal. If you want to pass local values to the eval-block,
# use arguments of eval_proc method. They are passed to block-arguments.
if block_given?
cmd = Proc.new
@@ -1921,28 +1394,11 @@ class MultiTkIp
fail ArgumentError, "A Proc or Method object is expected for 1st argument"
end
end
- if TclTkLib.mainloop_thread? == true
- # call from eventloop
- current = Thread.current
- backup_ip = current['callback_ip']
- current['callback_ip'] = self
- begin
- eval_proc_core(false,
- proc{|safe, *params|
- $SAFE=safe if $SAFE < safe
- cmd.call(*params)
- }, *args)
- ensure
- current['callback_ip'] = backup_ip
- end
- else
- eval_proc_core(true,
- proc{|safe, *params|
- $SAFE=safe if $SAFE < safe
- Thread.new(*params, &cmd).value
- },
- *args)
- end
+ eval_proc_core(true,
+ proc{|safe, *params|
+ $SAFE=safe; Thread.new(*params, &cmd).value
+ },
+ *args)
end
alias call eval_proc
@@ -1955,19 +1411,14 @@ class MultiTkIp
end
end
Thread.new{
- eval_proc(cmd, *args)
-=begin
eval_proc_core(false,
proc{|safe, *params|
- $SAFE=safe if $SAFE < safe
- Thread.new(*params, &cmd).value
+ $SAFE=safe; Thread.new(*params, &cmd).value
},
- safe_level, *args)
-=end
+ *args)
}
end
alias background_eval_proc bg_eval_proc
- alias thread_eval_proc bg_eval_proc
alias bg_call bg_eval_proc
alias background_call bg_eval_proc
@@ -1977,101 +1428,51 @@ class MultiTkIp
raise RuntimeError, "A String object is expected for the 'cmd' argument"
end
- eval_proc_core(true,
- proc{|safe|
- Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd,
- *eval_args)
- })
+ eval_proc_core(true, proc{|safe| $SAFE=safe; Kernel.eval(cmd, *eval_args)})
end
alias eval_str eval_string
- def bg_eval_string(cmd, *eval_args)
+ def bg_eval_string(*args)
# cmd string ==> proc
unless cmd.kind_of?(String)
raise RuntimeError, "A String object is expected for the 'cmd' argument"
end
Thread.new{
eval_proc_core(true,
- proc{|safe|
- Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd,
- *eval_args)
- })
+ proc{|safe| $SAFE=safe; Kernel.eval(cmd, *eval_args)})
}
end
alias background_eval_string bg_eval_string
alias bg_eval_str bg_eval_string
alias background_eval_str bg_eval_string
+end
- def eval(*args, &blk)
- if block_given?
- eval_proc(*args, &blk)
- elsif args[0]
- if args[0].respond_to?(:call)
- eval_proc(*args)
- else
- eval_string(*args)
- end
- else
- fail ArgumentError, "no argument to eval"
- end
+class << MultiTkIp
+ # class method
+=begin
+ def eval_proc(cmd = proc{$SAFE=__getip.safe_level; Proc.new}.call, *args)
+ # class ==> interp object
+ __getip.eval_proc(cmd, *args)
end
-
- def bg_eval(*args, &blk)
+=end
+=begin
+ def eval_proc(*args)
+ # class ==> interp object
if block_given?
- bg_eval_proc(*args, &blk)
- elsif args[0]
- if args[0].respond_to?(:call)
- bg_eval_proc(*args)
- else
- bg_eval_string(*args)
- end
+ __getip.eval_proc(proc{$SAFE=__getip.safe_level; Proc.new}.call, *args)
else
- fail ArgumentError, "no argument to eval"
+ __getip.eval_proc(*args)
end
end
- alias background_eval bg_eval
-end
-
-class << MultiTkIp
- # class method
+=end
+#=begin
def eval_proc(*args, &blk)
# class ==> interp object
__getip.eval_proc(*args, &blk)
end
+#=end
alias call eval_proc
-
- def bg_eval_proc(*args, &blk)
- # class ==> interp object
- __getip.bg_eval_proc(*args, &blk)
- end
- alias background_eval_proc bg_eval_proc
- alias thread_eval_proc bg_eval_proc
- alias bg_call bg_eval_proc
- alias background_call bg_eval_proc
-
- def eval_string(cmd, *eval_args)
- # class ==> interp object
- __getip.eval_string(cmd, *eval_args)
- end
- alias eval_str eval_string
-
- def bg_eval_string(cmd, *eval_args)
- # class ==> interp object
- __getip.bg_eval_string(cmd, *eval_args)
- end
- alias background_eval_string bg_eval_string
- alias bg_eval_str bg_eval_string
- alias background_eval_str bg_eval_string
-
- def eval(*args, &blk)
- # class ==> interp object
- __getip.eval(*args, &blk)
- end
- def bg_eval(*args, &blk)
- # class ==> interp object
- __getip.bg_eval(*args, &blk)
- end
- alias background_eval bg_eval
+ alias eval_string eval_proc
end
@@ -2149,18 +1550,10 @@ class << MultiTkIp
__getip.delete
end
- def deleted?
+ def deleteed?
__getip.deleted?
end
- def has_mainwindow?
- __getip.has_mainwindow?
- end
-
- def invalid_namespace?
- __getip.invalid_namespace?
- end
-
def abort(msg = nil)
__getip.abort(msg)
end
@@ -2208,11 +1601,11 @@ class << MultiTkIp
__getip._invoke_with_enc(*args)
end
- def _toUTF8(str, encoding=nil)
+ def _toUTF8(str, encoding)
__getip._toUTF8(str, encoding)
end
- def _fromUTF8(str, encoding=nil)
+ def _fromUTF8(str, encoding)
__getip._fromUTF8(str, encoding)
end
@@ -2266,10 +1659,6 @@ class << MultiTkIp
__getip._unset_global_var2(var, idx)
end
- def _make_menu_embeddable(menu_path)
- __getip._make_menu_embeddable(menu_path)
- end
-
def _split_tklist(str)
__getip._split_tklist(str)
end
@@ -2279,10 +1668,6 @@ class << MultiTkIp
def _conv_listelement(arg)
__getip._conv_listelement(arg)
end
-
- def _create_console
- __getip._create_console
- end
end
@@ -2336,142 +1721,97 @@ end
# depend on TclTkIp
class MultiTkIp
- def mainloop(check_root = true, restart_on_dead = true)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ def mainloop(check_root = true, restart_on_dead = false)
#return self if self.slave?
#return self if self != @@DEFAULT_MASTER
if self != @@DEFAULT_MASTER
if @wait_on_mainloop[0]
begin
- @wait_on_mainloop[1] += 1
- if $SAFE >= 4
- _receiver_mainloop(check_root).join
- else
- @cmd_queue.enq([@system, 'call_mainloop',
- Thread.current, check_root])
- Thread.stop
- end
+ @wait_on_mainloop[1] = true
+ @cmd_queue.enq([@system, 'call_mainloop',
+ Thread.current, check_root])
+ Thread.stop
rescue MultiTkIp_OK => ret
# return value
- if ret.value.kind_of?(Thread)
- return ret.value.value
- else
- return ret.value
- end
- rescue SystemExit => e
+ @wait_on_mainloop[1] = false
+ return ret.value.value
+ rescue SystemExit
# exit IP
warn("Warning: " + $! + " on " + self.inspect) if $DEBUG
+ @wait_on_mainloop[1] = false
begin
self._eval_without_enc('exit')
rescue Exception
end
self.delete
- rescue StandardError => e
+ rescue Exception => e
if $DEBUG
warn("Warning: " + e.class.inspect +
((e.message.length > 0)? ' "' + e.message + '"': '') +
" on " + self.inspect)
end
+ @wait_on_mainloop[1] = false
return e
- rescue Exception => e
- return e
ensure
- @wait_on_mainloop[1] -= 1
+ @wait_on_mainloop[1] = false
end
end
return
end
unless restart_on_dead
- @wait_on_mainloop[1] += 1
-=begin
- begin
- @interp.mainloop(check_root)
- rescue StandardError => e
- if $DEBUG
- warn("Warning: " + e.class.inspect +
- ((e.message.length > 0)? ' "' + e.message + '"': '') +
- " on " + self.inspect)
- end
- end
-=end
- begin
- @interp.mainloop(check_root)
- ensure
- @wait_on_mainloop[1] -= 1
- end
+ @wait_on_mainloop[1] = true
+ @interp.mainloop(check_root)
+ @wait_on_mainloop[1] = false
else
- loop do
- break unless self.alive?
- if check_root
- begin
- break if TclTkLib.num_of_mainwindows == 0
- rescue StandardError
- break
- end
- end
- break if @interp.deleted?
- begin
- @wait_on_mainloop[1] += 1
- @interp.mainloop(check_root)
- rescue StandardError => e
- if TclTkLib.mainloop_abort_on_exception != nil
- #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect,
- # " exception (ignore) : ", $!.message, "\n");
- if $DEBUG
- warn("Warning: Tk mainloop receives " << e.class.inspect <<
- " exception (ignore) : " << e.message);
- end
- end
- #raise e
- rescue Exception => e
-=begin
- if TclTkLib.mainloop_abort_on_exception != nil
- #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect,
- # " exception (ignore) : ", $!.message, "\n");
- if $DEBUG
- warn("Warning: Tk mainloop receives " << e.class.inspect <<
- " exception (ignore) : " << e.message);
+ begin
+ @wait_on_mainloop[1] = true
+ loop do
+ break unless self.alive?
+ if check_root
+ begin
+ break if TclTkLib.num_of_mainwindows == 0
+ rescue Exception
+ break
end
end
-=end
- raise e
- ensure
- @wait_on_mainloop[1] -= 1
- Thread.pass # avoid eventloop conflict
+ @interp.mainloop(check_root)
+ end
+ #rescue StandardError
+ rescue Exception
+ if TclTkLib.mainloop_abort_on_exception != nil
+ STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect,
+ " exception (ignore) : ", $!.message, "\n");
end
+ retry
+ ensure
+ @wait_on_mainloop[1] = false
end
end
self
end
def make_safe
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.make_safe
end
def safe?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.safe?
end
def safe_base?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@safe_base
end
def allow_ruby_exit?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.allow_ruby_exit?
end
def allow_ruby_exit= (mode)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.allow_ruby_exit = mode
end
def delete
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@slave_ip_tbl.each{|name, subip|
_destroy_slaves_of_slaveIP(subip)
=begin
@@ -2481,11 +1821,7 @@ class MultiTkIp
end
=end
begin
- # subip._eval_without_enc("foreach i [after info] {after cancel $i}")
- unless subip.deleted?
- after_ids = subip._eval_without_enc("after info")
- subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
- end
+ subip._eval_without_enc("foreach i [after info] {after cancel $i}")
rescue Exception
end
@@ -2514,43 +1850,30 @@ class MultiTkIp
}
begin
- # @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
- after_ids = @interp._eval_without_enc("after info")
- @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
+ @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
rescue Exception
end
-
+=begin
begin
@interp._invoke('destroy', '.') unless @interp.deleted?
rescue Exception
end
-
+=end
if @safe_base && !@interp.deleted?
# do 'exit' to call the delete_hook procedure
@interp._eval_without_enc('exit')
+ else
+ @interp.delete unless @interp.deleted?
end
- @interp.delete
self
end
def deleted?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.deleted?
end
- def has_mainwindow?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- @interp.has_mainwindow?
- end
-
- def invalid_namespace?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- @interp.invalid_namespace?
- end
-
def abort(msg = nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- if master? && !safe? && allow_ruby_exit?
+ if master?
if msg
Kernel.abort(msg)
else
@@ -2564,8 +1887,7 @@ class MultiTkIp
end
def exit(st = true)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- if master? && !safe? && allow_ruby_exit?
+ if master?
Kernel.exit(st)
else
delete
@@ -2574,7 +1896,6 @@ class MultiTkIp
end
def exit!(st = false)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
if master? && !safe? && allow_ruby_exit?
Kernel.exit!(st)
else
@@ -2584,8 +1905,6 @@ class MultiTkIp
end
def restart(app_name = nil, keys = {})
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
_init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
@interp._invoke('set', 'argv0', app_name) if app_name
@@ -2597,135 +1916,102 @@ class MultiTkIp
end
def __eval(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.__eval(str)
end
def __invoke(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.__invoke(*args)
end
def _eval(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._eval(str)
end
def _invoke(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke(*args)
end
def _eval_without_enc(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._eval_without_enc(str)
end
def _invoke_without_enc(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke_without_enc(*args)
end
def _eval_with_enc(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._eval_with_enc(str)
end
def _invoke_with_enc(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke_with_enc(*args)
end
- def _toUTF8(str, encoding=nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ def _toUTF8(str, encoding)
@interp._toUTF8(str, encoding)
end
- def _fromUTF8(str, encoding=nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ def _fromUTF8(str, encoding)
@interp._fromUTF8(str, encoding)
end
def _thread_vwait(var)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._thread_vwait(var)
end
def _thread_tkwait(mode, target)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._thread_tkwait(mode, target)
end
def _return_value
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._return_value
end
def _get_variable(var, flag)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._get_variable(var, flag)
end
def _get_variable2(var, idx, flag)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._get_variable2(var, idx, flag)
end
def _set_variable(var, value, flag)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._set_variable(var, value, flag)
end
def _set_variable2(var, idx, value, flag)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._set_variable2(var, idx, value, flag)
end
def _unset_variable(var, flag)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._unset_variable(var, flag)
end
def _unset_variable2(var, idx, flag)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._unset_variable2(var, idx, flag)
end
def _get_global_var(var)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._get_global_var(var)
end
def _get_global_var2(var, idx)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._get_global_var2(var, idx)
end
def _set_global_var(var, value)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._set_global_var(var, value)
end
def _set_global_var2(var, idx, value)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._set_global_var2(var, idx, value)
end
def _unset_global_var(var)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._unset_global_var(var)
end
def _unset_global_var2(var, idx)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._unset_global_var2(var, idx)
end
- def _make_menu_embeddable(menu_path)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- @interp._make_menu_embeddable(menu_path)
- end
-
def _split_tklist(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._split_tklist(str)
end
def _merge_tklist(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._merge_tklist(*args)
end
def _conv_listelement(arg)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._conv_listelement(arg)
end
end
@@ -2776,7 +2062,6 @@ class MultiTkIp
private :_slavearg
def alias_info(slave, cmd_name)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
_lst2ary(@interp._invoke('interp', 'alias', _slavearg(slave), cmd_name))
end
def self.alias_info(slave, cmd_name)
@@ -2784,7 +2069,6 @@ class MultiTkIp
end
def alias_delete(slave, cmd_name)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'alias', _slavearg(slave), cmd_name, '')
self
end
@@ -2794,7 +2078,6 @@ class MultiTkIp
end
def def_alias(slave, new_cmd, org_cmd, *args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd,
'', org_cmd, *args)
(ret == new_cmd)? self: nil
@@ -2805,7 +2088,6 @@ class MultiTkIp
end
def aliases(slave = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
_lst2ary(@interp._invoke('interp', 'aliases', _slavearg(slave)))
end
def self.aliases(slave = '')
@@ -2813,7 +2095,6 @@ class MultiTkIp
end
def delete_slaves(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
slaves = args.collect{|s| _slavearg(s)}
@interp._invoke('interp', 'delete', *slaves) if slaves.size > 0
self
@@ -2824,7 +2105,6 @@ class MultiTkIp
end
def exist?(slave = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
ret = @interp._invoke('interp', 'exists', _slavearg(slave))
(ret == '1')? true: false
end
@@ -2833,7 +2113,6 @@ class MultiTkIp
end
def delete_cmd(slave, cmd)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
slave_invoke = @interp._invoke('list', 'rename', cmd, '')
@interp._invoke('interp', 'eval', _slavearg(slave), slave_invoke)
self
@@ -2844,7 +2123,6 @@ class MultiTkIp
end
def expose_cmd(slave, cmd, aliasname = nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
if aliasname
@interp._invoke('interp', 'expose', _slavearg(slave), cmd, aliasname)
else
@@ -2858,7 +2136,6 @@ class MultiTkIp
end
def hide_cmd(slave, cmd, aliasname = nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
if aliasname
@interp._invoke('interp', 'hide', _slavearg(slave), cmd, aliasname)
else
@@ -2872,7 +2149,6 @@ class MultiTkIp
end
def hidden_cmds(slave = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
_lst2ary(@interp._invoke('interp', 'hidden', _slavearg(slave)))
end
def self.hidden_cmds(slave = '')
@@ -2880,18 +2156,16 @@ class MultiTkIp
end
def invoke_hidden(slave, cmd, *args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
if args[-1].kind_of?(Hash)
keys = _symbolkey2str(args.pop)
else
keys = []
end
- keys << _slavearg(slave)
if Tk::TCL_MAJOR_VERSION > 8 ||
(Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
keys << '--'
end
- keys << cmd
+ keys << _slavearg(slave) << cmd
keys.concat(args)
@interp._invoke('interp', 'invokehidden', *keys)
end
@@ -2900,19 +2174,17 @@ class MultiTkIp
end
def invoke_hidden_on_global(slave, cmd, *args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
if args[-1].kind_of?(Hash)
keys = _symbolkey2str(args.pop)
else
keys = []
end
- keys << _slavearg(slave)
keys << '-global'
if Tk::TCL_MAJOR_VERSION > 8 ||
(Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
keys << '--'
end
- keys << cmd
+ keys << _slavearg(slave) << cmd
keys.concat(args)
@interp._invoke('interp', 'invokehidden', *keys)
end
@@ -2920,26 +2192,7 @@ class MultiTkIp
__getip.invoke_hidden_on_global(slave, cmd, *args)
end
- def invoke_hidden_on_namespace(slave, ns, cmd, *args)
- # for Tcl8.5 or later
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
- if args[-1].kind_of?(Hash)
- keys = _symbolkey2str(args.pop)
- else
- keys = []
- end
- keys << _slavearg(slave)
- keys << '-namespace' << TkComm._get_eval_string(ns)
- keys << '--' << cmd
- keys.concat(args)
- @interp._invoke('interp', 'invokehidden', *keys)
- end
- def self.invoke_hidden_on_namespace(slave, ns, cmd, *args)
- __getip.invoke_hidden_on_namespace(slave, ns, cmd, *args)
- end
-
def mark_trusted(slave = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'marktrusted', _slavearg(slave))
self
end
@@ -2949,10 +2202,8 @@ class MultiTkIp
end
def set_bgerror_handler(cmd = Proc.new, slave = nil, &b)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
unless TkComm._callback_entry?(cmd)
- if !slave && b
+ unless slave
slave = cmd
cmd = Proc.new(&b)
end
@@ -2966,7 +2217,6 @@ class MultiTkIp
end
def get_bgerror_handler(slave = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
procedure(@interp._invoke('interp', 'bgerror', _slavearg(slave)))
end
def self.bgerror(slave = '')
@@ -2974,7 +2224,6 @@ class MultiTkIp
end
def set_limit(limit_type, slave = '', opts = {})
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'limit', _slavearg(slave), limit_type, opts)
end
def self.set_limit(limit_type, slave = '', opts = {})
@@ -2982,16 +2231,12 @@ class MultiTkIp
end
def get_limit(limit_type, slave = '', slot = nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
if slot
num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave),
limit_type, slot))
else
- l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit',
- _slavearg(slave),
- limit_type))
- l.map!{|s| _fromUTF8(s)}
+ l = @interp._split_tklist(@interp._invoke('interp', 'limit',
+ _slavearg(slave), limit_type))
r = {}
until l.empty?
key = l.shift[1..-1]
@@ -3007,7 +2252,6 @@ class MultiTkIp
end
def recursion_limit(slave = '', limit = None)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
number(@interp._invoke('interp', 'recursionlimit',
_slavearg(slave), limit))
end
@@ -3016,7 +2260,6 @@ class MultiTkIp
end
def alias_target(aliascmd, slave = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'target', _slavearg(slave), aliascmd)
end
def self.alias_target(aliascmd, slave = '')
@@ -3024,7 +2267,6 @@ class MultiTkIp
end
def share_stdin(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'share', src, 'stdin', dist)
self
end
@@ -3034,7 +2276,6 @@ class MultiTkIp
end
def share_stdout(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'share', src, 'stdout', dist)
self
end
@@ -3044,7 +2285,6 @@ class MultiTkIp
end
def share_stderr(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'share', src, 'stderr', dist)
self
end
@@ -3054,7 +2294,6 @@ class MultiTkIp
end
def transfer_stdin(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'transfer', src, 'stdin', dist)
self
end
@@ -3064,7 +2303,6 @@ class MultiTkIp
end
def transfer_stdout(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'transfer', src, 'stdout', dist)
self
end
@@ -3074,7 +2312,6 @@ class MultiTkIp
end
def transfer_stderr(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'transfer', src, 'stderr', dist)
self
end
@@ -3084,7 +2321,6 @@ class MultiTkIp
end
def share_stdio(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'share', src, 'stdin', dist)
@interp._invoke('interp', 'share', src, 'stdout', dist)
@interp._invoke('interp', 'share', src, 'stderr', dist)
@@ -3096,7 +2332,6 @@ class MultiTkIp
end
def transfer_stdio(dist, src = '')
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'transfer', src, 'stdin', dist)
@interp._invoke('interp', 'transfer', src, 'stdout', dist)
@interp._invoke('interp', 'transfer', src, 'stderr', dist)
@@ -3131,12 +2366,8 @@ class MultiTkIp
conf = _lst2ary(ip._eval("::safe::interpConfigure " +
@ip_name + " -#{slot}"))
if conf[0] == '-deleteHook'
-=begin
if conf[1] =~ /^rb_out\S* (c(_\d+_)?\d+)/
ret[conf[0][1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
-=end
- if conf[1] =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
- ret[conf[0][1..-1]] = MultiTkIp._tk_cmd_tbl[$4]
else
ret[conf[0][1..-1]] = conf[1]
end
@@ -3147,12 +2378,8 @@ class MultiTkIp
Hash[*_lst2ary(ip._eval("::safe::interpConfigure " +
@ip_name))].each{|k, v|
if k == '-deleteHook'
-=begin
if v =~ /^rb_out\S* (c(_\d+_)?\d+)/
ret[k[1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
-=end
- if v =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
- ret[k[1..-1]] = MultiTkIp._tk_cmd_tbl[$4]
else
ret[k[1..-1]] = v
end
@@ -3189,22 +2416,18 @@ end
# encoding convert
class MultiTkIp
def encoding
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.encoding
end
def encoding=(enc)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.encoding = enc
end
def encoding_convertfrom(str, enc=None)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.encoding_convertfrom(str, enc)
end
alias encoding_convert_from encoding_convertfrom
def encoding_convertto(str, enc=None)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.encoding_convertto(str, enc)
end
alias encoding_convert_to encoding_convertto
diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb
index 70115a60aa..1ef5310bde 100644
--- a/ext/tk/lib/remote-tk.rb
+++ b/ext/tk/lib/remote-tk.rb
@@ -60,20 +60,17 @@ class << RemoteTkIp
end
class RemoteTkIp
+ include TkUtil
+
def initialize(remote_ip, displayof=nil, timeout=5)
if $SAFE >= 4
fail SecurityError, "cannot access another interpreter at level #{$SAFE}"
end
@interp = MultiTkIp.__getip
- if @interp.safe?
- fail SecurityError, "safe-IP cannot create RemoteTkIp"
- end
-
-
@interp.allow_ruby_exit = false
@appname = @interp._invoke('tk', 'appname')
- @remote = remote_ip.to_s.dup.freeze
+ @remote = remote_ip.dup.freeze
if displayof.kind_of?(TkWindow)
@displayof = displayof.path.dup.freeze
else
@@ -99,7 +96,7 @@ class RemoteTkIp
@safe_level = [$SAFE]
- @wait_on_mainloop = [true, 0]
+ @wait_on_mainloop = [true, false]
@cmd_queue = Queue.new
@@ -132,26 +129,11 @@ class RemoteTkIp
self.freeze # defend against modification
end
- def manipulable?
- return true if (Thread.current.group == ThreadGroup::Default)
- MultiTkIp.__getip == @interp && ! @interp.safe?
- end
- def self.manipulable?
- true
- end
-
- def _is_master_of?(tcltkip_obj)
- tcltkip_obj == @interp
- end
- protected :_is_master_of?
-
def _ip_id_
@ip_id
end
def _available_check(timeout = 5)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
return nil if timeout < 1
@ret_val.value = ''
@interp._invoke('send', '-async', @remote,
@@ -170,8 +152,6 @@ class RemoteTkIp
private :_available_check
def _create_connection
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
ip_id = '_' + @interp._invoke('send', @remote, <<-'EOS') + '_'
if {[catch {set _rubytk_control_ip_id_} ret] != 0} {
set _rubytk_control_ip_id_ 0
@@ -192,8 +172,6 @@ class RemoteTkIp
private :_create_connection
def _appsend(enc_mode, async, *cmds)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
p ['_appsend', [@remote, @displayof], enc_mode, async, cmds] if $DEBUG
if $SAFE >= 4
fail SecurityError, "cannot send commands at level 4"
@@ -201,7 +179,7 @@ class RemoteTkIp
fail SecurityError, "cannot send tainted commands at level #{$SAFE}"
end
- cmds = @interp._merge_tklist(*TkUtil::_conv_args([], enc_mode, *cmds))
+ cmds = @interp._merge_tklist(*_conv_args([], enc_mode, *cmds))
if @displayof
if async
@interp.__invoke('send', '-async', '-displayof', @displayof,
@@ -234,8 +212,6 @@ class RemoteTkIp
end
def appsend(async, *args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
if async != true && async != false && async != nil
args.unshift(async)
async = false
@@ -248,8 +224,6 @@ class RemoteTkIp
end
def rb_appsend(async, *args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
if async != true && async != false && async != nil
args.unshift(async)
async = false
@@ -295,41 +269,19 @@ class RemoteTkIp
end
def deleted?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
if @displayof
lst = @interp._invoke_without_enc('winfo', 'interps',
'-displayof', @displayof)
else
lst = @interp._invoke_without_enc('winfo', 'interps')
end
- # unless @interp._split_tklist(lst).index(@remote)
- unless @interp._split_tklist(lst).index(_toUTF8(@remote))
+ unless @interp._split_tklist(lst).index(@remote)
true
else
false
end
end
- def has_mainwindow?
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
-
- begin
- inf = @interp._invoke_without_enc('info', 'command', '.')
- rescue Exception
- return nil
- end
- if !inf.kind_of?(String) || inf != '.'
- false
- else
- true
- end
- end
-
- def invalid_namespace?
- false
- end
-
def restart
fail RuntimeError, 'cannot restart the remote interpreter'
end
@@ -364,13 +316,11 @@ class RemoteTkIp
_appsend(true, false, *args)
end
- def _toUTF8(str, encoding=nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ def _toUTF8(str, encoding)
@interp._toUTF8(str, encoding)
end
- def _fromUTF8(str, encoding=nil)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ def _fromUTF8(str, encoding)
@interp._fromUTF8(str, encoding)
end
@@ -383,31 +333,30 @@ class RemoteTkIp
end
def _return_value
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._return_value
end
def _get_variable(var_name, flag)
# ignore flag
- _appsend(false, 'set', TkComm::_get_eval_string(var_name))
+ _appsend(false, 'set', _get_eval_string(var_name))
end
def _get_variable2(var_name, index_name, flag)
# ignore flag
- _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})")
+ _appsend(false, 'set', "#{_get_eval_string(var_name)}(#{_get_eval_string(index_name)})")
end
def _set_variable(var_name, value, flag)
# ignore flag
- _appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value))
+ _appsend(false, 'set', _get_eval_string(var_name), _get_eval_string(value))
end
def _set_variable2(var_name, index_name, value, flag)
# ignore flag
- _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})", TkComm::_get_eval_string(value))
+ _appsend(false, 'set', "#{_get_eval_string(var_name)}(#{_get_eval_string(index_name)})", _get_eval_string(value))
end
def _unset_variable(var_name, flag)
# ignore flag
- _appsend(false, 'unset', TkComm::_get_eval_string(var_name))
+ _appsend(false, 'unset', _get_eval_string(var_name))
end
def _unset_variable2(var_name, index_name, flag)
# ignore flag
@@ -415,45 +364,38 @@ class RemoteTkIp
end
def _get_global_var(var_name)
- _appsend(false, 'set', TkComm::_get_eval_string(var_name))
+ _appsend(false, 'set', _get_eval_string(var_name))
end
def _get_global_var2(var_name, index_name)
- _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})")
+ _appsend(false, 'set', "#{_get_eval_string(var_name)}(#{_get_eval_string(index_name)})")
end
def _set_global_var(var_name, value)
- _appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value))
+ _appsend(false, 'set', _get_eval_string(var_name), _get_eval_string(value))
end
def _set_global_var2(var_name, index_name, value)
- _appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})", TkComm::_get_eval_string(value))
+ _appsend(false, 'set', "#{_get_eval_string(var_name)}(#{_get_eval_string(index_name)})", _get_eval_string(value))
end
def _unset_global_var(var_name)
- _appsend(false, 'unset', TkComm::_get_eval_string(var_name))
+ _appsend(false, 'unset', _get_eval_string(var_name))
end
def _unset_global_var2(var_name, index_name)
_appsend(false, 'unset', "#{var_name}(#{index_name})")
end
def _split_tklist(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._split_tklist(str)
end
def _merge_tklist(*args)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._merge_tklist(*args)
end
def _conv_listelement(str)
- raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._conv_listelement(str)
end
- def _create_console
- fail RuntimeError, 'not support "_create_console" on the remote interpreter'
- end
-
def mainloop
fail RuntimeError, 'not support "mainloop" on the remote interpreter'
end
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index eba2f72f29..97535af124 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1,6 +1,6 @@
#
# tk.rb - Tk interface module using tcltklib
-# $Date: 2006/07/14 04:10:49 $
+# $Date$
# by Yukihiro Matsumoto <matz@netlab.jp>
# use Shigehiro's tcltklib
@@ -16,7 +16,6 @@ class TclTkIp
alias _invoke_without_enc _invoke
def _ip_id_
- # for RemoteTkIp
''
end
end
@@ -190,7 +189,6 @@ module TkComm
module_function :_at
def tk_tcl2ruby(val, enc_mode = false, listobj = true)
-=begin
if val =~ /^rb_out\S* (c(_\d+_)?\d+)/
#return Tk_CMDTBL[$1]
return TkCore::INTERP.tk_cmd_tbl[$1]
@@ -201,36 +199,28 @@ module TkComm
# cmd_obj.cmd
#end
end
-=end
- if val =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
- return TkCore::INTERP.tk_cmd_tbl[$4]
- end
#if val.include? ?\s
# return val.split.collect{|v| tk_tcl2ruby(v)}
#end
case val
- when /\A@font\S+\z/
+ when /^@font/
TkFont.get_obj(val)
- when /\A-?\d+\z/
+ when /^-?\d+$/
val.to_i
- when /\A\.\S*\z/
+ when /^\./
#Tk_WINDOWS[val] ? Tk_WINDOWS[val] : _genobj_for_tkwidget(val)
TkCore::INTERP.tk_windows[val]?
TkCore::INTERP.tk_windows[val] : _genobj_for_tkwidget(val)
- when /\Ai(_\d+_)?\d+\z/
+ when /^i(_\d+_)?\d+$/
TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
- when /\A-?\d+\.?\d*(e[-+]?\d+)?\z/
+ when /^-?\d+\.?\d*(e[-+]?\d+)?$/
val.to_f
when /\\ /
val.gsub(/\\ /, ' ')
when /[^\\] /
if listobj
- #tk_split_escstr(val).collect{|elt|
- # tk_tcl2ruby(elt, enc_mode, listobj)
- #}
- val = _toUTF8(val) unless enc_mode
- tk_split_escstr(val, false, false).collect{|elt|
- tk_tcl2ruby(elt, true, listobj)
+ tk_split_escstr(val).collect{|elt|
+ tk_tcl2ruby(elt, enc_mode, listobj)
}
elsif enc_mode
_fromUTF8(val)
@@ -259,20 +249,13 @@ if USE_TCLs_LIST_FUNCTIONS
# use Tcl function version of split_list
###########################################################################
- def tk_split_escstr(str, src_enc=true, dst_enc=true)
- str = _toUTF8(str) if src_enc
- if dst_enc
- TkCore::INTERP._split_tklist(str).map!{|s| _fromUTF8(s)}
- else
- TkCore::INTERP._split_tklist(str)
- end
+ def tk_split_escstr(str)
+ TkCore::INTERP._split_tklist(str)
end
- def tk_split_sublist(str, depth=-1, src_enc=true, dst_enc=true)
+ def tk_split_sublist(str, depth=-1)
# return [] if str == ""
# list = TkCore::INTERP._split_tklist(str)
- str = _toUTF8(str) if src_enc
-
if depth == 0
return "" if str == ""
list = [str]
@@ -281,82 +264,45 @@ if USE_TCLs_LIST_FUNCTIONS
list = TkCore::INTERP._split_tklist(str)
end
if list.size == 1
- # tk_tcl2ruby(list[0], nil, false)
- tk_tcl2ruby(list[0], dst_enc, false)
+ tk_tcl2ruby(list[0], nil, false)
else
- list.collect{|token| tk_split_sublist(token, depth - 1, false, dst_enc)}
+ list.collect{|token| tk_split_sublist(token, depth - 1)}
end
end
- def tk_split_list(str, depth=0, src_enc=true, dst_enc=true)
+ def tk_split_list(str, depth=0)
return [] if str == ""
- str = _toUTF8(str) if src_enc
- TkCore::INTERP._split_tklist(str).map!{|token|
- tk_split_sublist(token, depth - 1, false, dst_enc)
+ TkCore::INTERP._split_tklist(str).collect{|token|
+ tk_split_sublist(token, depth - 1)
}
end
- def tk_split_simplelist(str, src_enc=true, dst_enc=true)
+ def tk_split_simplelist(str)
#lst = TkCore::INTERP._split_tklist(str)
#if (lst.size == 1 && lst =~ /^\{.*\}$/)
# TkCore::INTERP._split_tklist(str[1..-2])
#else
# lst
#end
-
- str = _toUTF8(str) if src_enc
- if dst_enc
- TkCore::INTERP._split_tklist(str).map!{|s| _fromUTF8(s)}
- else
- TkCore::INTERP._split_tklist(str)
- end
+ TkCore::INTERP._split_tklist(str)
end
- def array2tk_list(ary, enc=nil)
+ def array2tk_list(ary)
return "" if ary.size == 0
- sys_enc = TkCore::INTERP.encoding
- sys_enc = TclTkLib.encoding_system unless sys_enc
-
- dst_enc = (enc == nil)? sys_enc: enc
-
dst = ary.collect{|e|
if e.kind_of? Array
- s = array2tk_list(e, enc)
+ array2tk_list(e)
elsif e.kind_of? Hash
tmp_ary = []
#e.each{|k,v| tmp_ary << k << v }
e.each{|k,v| tmp_ary << "-#{_get_eval_string(k)}" << v }
- s = array2tk_list(tmp_ary, enc)
+ array2tk_list(tmp_ary)
else
- s = _get_eval_string(e, enc)
- end
-
- if dst_enc != true && dst_enc != false
- if (s_enc = s.instance_variable_get(:@encoding))
- s_enc = s_enc.to_s
- else
- s_enc = sys_enc
- end
- dst_enc = true if s_enc != dst_enc
+ _get_eval_string(e)
end
-
- s
}
-
- if sys_enc && dst_enc
- dst.map!{|s| _toUTF8(s)}
- ret = TkCore::INTERP._merge_tklist(*dst)
- if dst_enc.kind_of?(String)
- ret = _fromUTF8(ret, dst_enc)
- ret.instance_variable_set(:@encoding, dst_enc)
- else
- ret.instance_variable_set(:@encoding, 'utf-8')
- end
- ret
- else
- TkCore::INTERP._merge_tklist(*dst)
- end
+ TkCore::INTERP._merge_tklist(*dst)
end
else
@@ -364,7 +310,7 @@ else
# use Ruby script version of split_list (traditional methods)
###########################################################################
- def tk_split_escstr(str, src_enc=true, dst_enc=true)
+ def tk_split_escstr(str)
return [] if str == ""
list = []
token = nil
@@ -385,7 +331,7 @@ else
list
end
- def tk_split_sublist(str, depth=-1, src_enc=true, dst_enc=true)
+ def tk_split_sublist(str, depth=-1)
#return [] if str == ""
#return [tk_split_sublist(str[1..-2])] if str =~ /^\{.*\}$/
#list = tk_split_escstr(str)
@@ -405,11 +351,9 @@ else
end
end
- def tk_split_list(str, depth=0, src_enc=true, dst_enc=true)
+ def tk_split_list(str, depth=0)
return [] if str == ""
- tk_split_escstr(str).collect{|token|
- tk_split_sublist(token, depth - 1)
- }
+ tk_split_escstr(str).collect{|token| tk_split_sublist(token, depth - 1)}
end
=begin
def tk_split_list(str)
@@ -452,7 +396,7 @@ else
end
=end
- def tk_split_simplelist(str, src_enc=true, dst_enc=true)
+ def tk_split_simplelist(str)
return [] if str == ""
list = []
token = nil
@@ -478,16 +422,16 @@ else
list
end
- def array2tk_list(ary, enc=nil)
+ def array2tk_list(ary)
ary.collect{|e|
if e.kind_of? Array
- "{#{array2tk_list(e, enc)}}"
+ "{#{array2tk_list(e)}}"
elsif e.kind_of? Hash
# "{#{e.to_a.collect{|ee| array2tk_list(ee)}.join(' ')}}"
e.each{|k,v| tmp_ary << "-#{_get_eval_string(k)}" << v }
- array2tk_list(tmp_ary, enc)
+ array2tk_list(tmp_ary)
else
- s = _get_eval_string(e, enc)
+ s = _get_eval_string(e)
(s.index(/\s/) || s.size == 0)? "{#{s}}": s
end
}.join(" ")
@@ -504,7 +448,7 @@ end
private_class_method :tk_split_escstr, :tk_split_sublist
private_class_method :tk_split_list, :tk_split_simplelist
-# private_class_method :array2tk_list
+ private_class_method :array2tk_list
=begin
### --> definition is moved to TkUtil module
@@ -584,11 +528,11 @@ end
end
=end
- def list(val, depth=0, enc=true)
- tk_split_list(val, depth, enc, enc)
+ def list(val, depth=0)
+ tk_split_list(val, depth)
end
- def simplelist(val, src_enc=true, dst_enc=true)
- tk_split_simplelist(val, src_enc, dst_enc)
+ def simplelist(val)
+ tk_split_simplelist(val)
end
def window(val)
if val =~ /^\./
@@ -607,14 +551,10 @@ end
end
end
def procedure(val)
-=begin
if val =~ /^rb_out\S* (c(_\d+_)?\d+)/
#Tk_CMDTBL[$1]
#TkCore::INTERP.tk_cmd_tbl[$1]
TkCore::INTERP.tk_cmd_tbl[$1].cmd
-=end
- if val =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
- return TkCore::INTERP.tk_cmd_tbl[$4].cmd
else
#nil
val
@@ -625,15 +565,6 @@ end
module_function :bool, :number, :num_or_str, :string
module_function :list, :simplelist, :window, :image_obj, :procedure
- def subst(str, *opts)
- # opts := :nobackslashes | :nocommands | novariables
- tk_call('subst',
- *(opts.collect{|opt|
- opt = opt.to_s
- (opt[0] == ?-)? opt: '-' << opt
- } << str))
- end
-
def _toUTF8(str, encoding = nil)
TkCore::INTERP._toUTF8(str, encoding)
end
@@ -643,12 +574,6 @@ end
private :_toUTF8, :_fromUTF8
module_function :_toUTF8, :_fromUTF8
- def _callback_entry_class?(cls)
- cls <= Proc || cls <= Method || cls <= TkCallbackEntry
- end
- private :_callback_entry_class?
- module_function :_callback_entry_class?
-
def _callback_entry?(obj)
obj.kind_of?(Proc) || obj.kind_of?(Method) || obj.kind_of?(TkCallbackEntry)
end
@@ -793,13 +718,6 @@ end
def install_cmd(cmd)
return '' if cmd == ''
- begin
- ns = TkCore::INTERP._invoke_without_enc('namespace', 'current')
- ns = nil if ns == '::' # for backward compatibility
- rescue
- # probably, Tcl7.6
- ns = nil
- end
id = _next_cmd_id
#Tk_CMDTBL[id] = cmd
if cmd.kind_of?(TkCallbackEntry)
@@ -811,15 +729,10 @@ end
@cmdtbl.taint unless @cmdtbl.tainted?
@cmdtbl.push id
#return Kernel.format("rb_out %s", id);
- if ns
- 'rb_out' << TkCore::INTERP._ip_id_ << ' ' << ns << ' ' << id
- else
- 'rb_out' << TkCore::INTERP._ip_id_ << ' ' << id
- end
+ return 'rb_out' + TkCore::INTERP._ip_id_ + ' ' + id
end
def uninstall_cmd(id)
- #id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
- id = $4 if id =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
+ id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
#Tk_CMDTBL.delete(id)
TkCore::INTERP.tk_cmd_tbl.delete(id)
end
@@ -937,13 +850,9 @@ module TkComm
def _bindinfo(what, context=nil)
if context
tk_call_without_enc(*what+["<#{tk_event_sequence(context)}>"]) .collect {|cmdline|
-=begin
if cmdline =~ /^rb_out\S* (c(?:_\d+_)?\d+)\s+(.*)$/
#[Tk_CMDTBL[$1], $2]
[TkCore::INTERP.tk_cmd_tbl[$1], $2]
-=end
- if cmdline =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
- [TkCore::INTERP.tk_cmd_tbl[$4], $5]
else
cmdline
end
@@ -1004,7 +913,7 @@ module TkComm
#end
def bind(tagOrClass, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -1019,7 +928,7 @@ module TkComm
#end
def bind_append(tagOrClass, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -1043,7 +952,7 @@ module TkComm
#end
def bind_all(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -1058,7 +967,7 @@ module TkComm
#end
def bind_append_all(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -1107,13 +1016,6 @@ module TkCore
INTERP.instance_eval{
@tk_cmd_tbl = {}.taint
- def @tk_cmd_tbl.[]=(idx,val)
- if self.has_key?(idx) && Thread.current.group != ThreadGroup::Default
- fail SecurityError,"cannot change the entried command"
- end
- super(idx,val)
- end
-
@tk_windows = {}.taint
@tk_table_list = [].taint
@@ -1121,8 +1023,8 @@ module TkCore
@init_ip_env = [].taint # table of Procs
@add_tk_procs = [].taint # table of [name, args, body]
- @cb_entry_class = Class.new(TkCallbackEntry){
- class << self
+ @cb_entry_class = Class.new(TkCallbackEntry){|c|
+ class << c
def inspect
sprintf("#<Class(TkCallbackEntry):%0x>", self.__id__)
end
@@ -1192,22 +1094,8 @@ module TkCore
script.call(self)
end
def INTERP.add_tk_procs(name, args = nil, body = nil)
- if name.kind_of?(Array)
- name.each{|param| self.add_tk_procs(*param)}
- else
- name = name.to_s
- @add_tk_procs << [name, args, body]
- self._invoke('proc', name, args, body) if args && body
- end
- end
- def INTERP.remove_tk_procs(*names)
- names.each{|name|
- name = name.to_s
- @add_tk_procs.delete_if{|elem|
- elem.kind_of?(Array) && elem[0].to_s == name
- }
- self._invoke('rename', name, '')
- }
+ @add_tk_procs << [name, args, body]
+ self._invoke('proc', name, args, body) if args && body
end
def INTERP.init_ip_internal
ip = self
@@ -1222,14 +1110,13 @@ module TkCore
INTERP._invoke_without_enc('bind', 'all', "<#{WIDGET_DESTROY_HOOK}>",
install_cmd(proc{|path|
unless TkCore::INTERP.deleted?
- begin
- if (widget=TkCore::INTERP.tk_windows[path])
- if widget.respond_to?(:__destroy_hook__)
+ if (widget = TkCore::INTERP.tk_windows[path])
+ if widget.respond_to?(:__destroy_hook__)
+ begin
widget.__destroy_hook__
+ rescue Exception
end
end
- rescue Exception=>e
- p e if $DEBUG
end
end
}) << ' %W')
@@ -1237,28 +1124,6 @@ module TkCore
INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '',
"bind all <#{WIDGET_DESTROY_HOOK}> {}")
- INTERP.add_tk_procs('rb_out', 'ns args', <<-'EOL')
- if [regexp {^::} $ns] {
- set cmd {namespace eval $ns {ruby_cmd TkCore callback} $args}
- } else {
- set cmd {eval {ruby_cmd TkCore callback} $ns $args}
- }
- if {[set st [catch $cmd ret]] != 0} {
- #return -code $st $ret
- set idx [string first "\n\n" $ret]
- if {$idx > 0} {
- return -code $st \
- -errorinfo [string range $ret [expr $idx + 2] \
- [string length $ret]] \
- [string range $ret 0 [expr $idx - 1]]
- } else {
- return -code $st $ret
- }
- } else {
- return $ret
- }
- EOL
-=begin
INTERP.add_tk_procs('rb_out', 'args', <<-'EOL')
if {[set st [catch {eval {ruby_cmd TkCore callback} $args} ret]] != 0} {
#return -code $st $ret
@@ -1275,7 +1140,6 @@ module TkCore
return $ret
}
EOL
-=end
=begin
INTERP.add_tk_procs('rb_out', 'args', <<-'EOL')
#regsub -all {\\} $args {\\\\} args
@@ -1299,8 +1163,6 @@ module TkCore
EOL
=end
- at_exit{ INTERP.remove_tk_procs(TclTkLib::FINALIZE_PROC_NAME) }
-
EventFlag = TclTkLib::EventFlag
def callback_break
@@ -1311,30 +1173,13 @@ module TkCore
fail TkCallbackContinue, "Tk callback returns 'continue' status"
end
- def callback_return
- fail TkCallbackReturn, "Tk callback returns 'return' status"
- end
-
def TkCore.callback(*arg)
begin
- if TkCore::INTERP.tk_cmd_tbl.kind_of?(Hash)
- #TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg)
- normal_ret = false
- ret = catch(:IRB_EXIT) do # IRB hack
- retval = TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg)
- normal_ret = true
- retval
- end
- unless normal_ret
- # catch IRB_EXIT
- exit(ret)
- end
- ret
- end
- rescue SystemExit=>e
- exit(e.status)
- rescue Interrupt=>e
- fail(e)
+ TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg)
+ rescue SystemExit
+ exit(0)
+ rescue Interrupt
+ exit!(1)
rescue Exception => e
begin
msg = _toUTF8(e.class.inspect) + ': ' +
@@ -1349,8 +1194,6 @@ module TkCore
e.backtrace.join("\n") +
"\n---< backtrace of Tk side >-------"
end
- # TkCore::INTERP._set_global_var('errorInfo', msg)
- # fail(e)
fail(e, msg)
end
end
@@ -1433,10 +1276,6 @@ module TkCore
tk_call_without_enc('after','idle',cmdid)
end
- def after_cancel(afterId)
- tk_call_without_enc('after','cancel',afterId)
- end
-
def windowingsystem
tk_call_without_enc('tk', 'windowingsystem')
end
@@ -1456,19 +1295,6 @@ module TkCore
end
end
- def inactive
- Integer(tk_call_without_enc('tk', 'inactive'))
- end
- def inactive_displayof(win)
- Integer(tk_call_without_enc('tk', 'inactive', '-displayof', win))
- end
- def reset_inactive
- tk_call_without_enc('tk', 'inactive', 'reset')
- end
- def reset_inactive_displayof(win)
- tk_call_without_enc('tk', 'inactive', '-displayof', win, 'reset')
- end
-
def appname(name=None)
tk_call('tk', 'appname', name)
end
@@ -1557,22 +1383,6 @@ module TkCore
TclTkLib.mainloop(check_root)
end
- def mainloop_thread?
- # true : current thread is mainloop
- # nil : there is no mainloop
- # false : mainloop is running on the other thread
- # ( At then, it is dangerous to call Tk interpreter directly. )
- TclTkLib.mainloop_thread?
- end
-
- def mainloop_exist?
- TclTkLib.mainloop_thread? != nil
- end
-
- def is_mainloop?
- TclTkLib.mainloop_thread? == true
- end
-
def mainloop_watchdog(check_root = true)
# watchdog restarts mainloop when mainloop is dead
TclTkLib.mainloop_watchdog(check_root)
@@ -1619,16 +1429,14 @@ module TkCore
nil
end
- def event_generate(win, context, keys=nil)
- #win = win.path if win.kind_of?(TkObject)
- if context.kind_of?(TkEvent::Event)
- context.generate(win, ((keys)? keys: {}))
- elsif keys
- tk_call_without_enc('event', 'generate', win,
+ def event_generate(window, context, keys=nil)
+ #window = window.path if window.kind_of?(TkObject)
+ if keys
+ tk_call_without_enc('event', 'generate', window,
"<#{tk_event_sequence(context)}>",
*hash_kv(keys, true))
else
- tk_call_without_enc('event', 'generate', win,
+ tk_call_without_enc('event', 'generate', window,
"<#{tk_event_sequence(context)}>")
end
nil
@@ -1641,16 +1449,10 @@ module TkCore
def getOpenFile(keys = nil)
tk_call('tk_getOpenFile', *hash_kv(keys))
end
- def getMultipleOpenFile(keys = nil)
- simplelist(tk_call('tk_getOpenFile', '-multiple', '1', *hash_kv(keys)))
- end
def getSaveFile(keys = nil)
tk_call('tk_getSaveFile', *hash_kv(keys))
end
- def getMultipleSaveFile(keys = nil)
- simplelist(tk_call('tk_getSaveFile', '-multiple', '1', *hash_kv(keys)))
- end
def chooseColor(keys = nil)
tk_call('tk_chooseColor', *hash_kv(keys))
@@ -1761,41 +1563,6 @@ module TkCore
def tk_call_with_enc(*args)
_tk_call_core(true, *args)
end
-
- def _tk_call_to_list_core(depth, arg_enc, val_enc, *args)
- args = _conv_args([], arg_enc, *args)
- val = _tk_call_core(false, *args)
- if !depth.kind_of?(Integer) || depth == 0
- tk_split_simplelist(val, false, val_enc)
- else
- tk_split_list(val, depth, false, val_enc)
- end
- end
- #private :_tk_call_to_list_core
-
- def tk_call_to_list(*args)
- _tk_call_to_list_core(-1, nil, true, *args)
- end
-
- def tk_call_to_list_without_enc(*args)
- _tk_call_to_list_core(-1, false, false, *args)
- end
-
- def tk_call_to_list_with_enc(*args)
- _tk_call_to_list_core(-1, true, true, *args)
- end
-
- def tk_call_to_simplelist(*args)
- _tk_call_to_list_core(0, nil, true, *args)
- end
-
- def tk_call_to_simplelist_without_enc(*args)
- _tk_call_to_list_core(0, false, false, *args)
- end
-
- def tk_call_to_simplelist_with_enc(*args)
- _tk_call_to_list_core(0, true, true, *args)
- end
end
@@ -1909,10 +1676,6 @@ module Tk
code
end
- def Tk.has_mainwindow?
- INTERP.has_mainwindow?
- end
-
def root
TkRoot.new
end
@@ -1941,62 +1704,6 @@ module Tk
end
end
- def Tk.pkgconfig_list(mod)
- # Tk8.5 feature
- if mod.kind_of?(Module)
- if mod.respond_to?(:package_name)
- pkgname = mod.package_name
- elsif mod.const_defined?(:PACKAGE_NAME)
- pkgname = mod::PACKAGE_NAME
- else
- fail NotImplementedError, 'may not be a module for a Tcl extension'
- end
- else
- pkgname = mod.to_s
- end
-
- pkgname = '::' << pkgname unless pkgname =~ /^::/
-
- tk_split_list(tk_call(pkgname + '::pkgconfig', 'list'))
- end
-
- def Tk.pkgconfig_get(mod, key)
- # Tk8.5 feature
- if mod.kind_of?(Module)
- if mod.respond_to?(:package_name)
- pkgname = mod.package_name
- else
- fail NotImplementedError, 'may not be a module for a Tcl extension'
- end
- else
- pkgname = mod.to_s
- end
-
- pkgname = '::' << pkgname unless pkgname =~ /^::/
-
- tk_call(pkgname + '::pkgconfig', 'get', key)
- end
-
- def Tk.tcl_pkgconfig_list
- # Tk8.5 feature
- Tk.pkgconfig_list('::tcl')
- end
-
- def Tk.tcl_pkgconfig_get(key)
- # Tk8.5 feature
- Tk.pkgconfig_get('::tcl', key)
- end
-
- def Tk.tk_pkgconfig_list
- # Tk8.5 feature
- Tk.pkgconfig_list('::tk')
- end
-
- def Tk.tk_pkgconfig_get(key)
- # Tk8.5 feature
- Tk.pkgconfig_get('::tk', key)
- end
-
def Tk.bell(nice = false)
if nice
tk_call_without_enc('bell', '-nice')
@@ -2031,34 +1738,13 @@ module Tk
end
def Tk.pack(*args)
- TkPack.configure(*args)
- end
- def Tk.pack_forget(*args)
- TkPack.forget(*args)
- end
- def Tk.unpack(*args)
- TkPack.forget(*args)
+ #TkPack.configure(*args)
+ TkPack(*args)
end
def Tk.grid(*args)
TkGrid.configure(*args)
end
- def Tk.grid_forget(*args)
- TkGrid.forget(*args)
- end
- def Tk.ungrid(*args)
- TkGrid.forget(*args)
- end
-
- def Tk.place(*args)
- TkPlace.configure(*args)
- end
- def Tk.place_forget(*args)
- TkPlace.forget(*args)
- end
- def Tk.unplace(*args)
- TkPlace.forget(*args)
- end
def Tk.update(idle=nil)
if idle
@@ -2076,10 +1762,8 @@ module Tk
self
end
- # NOTE::
- # If no eventloop-thread is running, "thread_update" method is same
- # to "update" method. Else, "thread_update" method waits to complete
- # idletask operation on the eventloop-thread.
+=begin
+ # See tcltklib.c for the reason of why the following methods are disabled.
def Tk.thread_update(idle=nil)
if idle
tk_call_without_enc('thread_update', 'idletasks')
@@ -2090,15 +1774,7 @@ module Tk
def Tk.thread_update_idletasks
thread_update(true)
end
-
- def Tk.lower_window(win, below=None)
- tk_call('lower', _epath(win), _epath(below))
- nil
- end
- def Tk.raise_window(win, above=None)
- tk_call('raise', _epath(win), _epath(above))
- nil
- end
+=end
def Tk.current_grabs(win = nil)
if win
@@ -2136,8 +1812,8 @@ module Tk
TkManageFocus.prev(win)
end
- def Tk.strictMotif(mode=None)
- bool(tk_call_without_enc('set', 'tk_strictMotif', mode))
+ def Tk.strictMotif(bool=None)
+ bool(tk_call_without_enc('set', 'tk_strictMotif', bool))
end
def Tk.show_kinsoku(mode='both')
@@ -2329,19 +2005,6 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
=end
end
- module TclTkLib
- class << self
- alias _encoding encoding
- alias _encoding= encoding=
- def encoding=(name)
- TkCore::INTERP.encoding = name
- end
- def encoding
- TkCore::INTERP.encoding
- end
- end
- end
-
module Tk
module Encoding
extend Encoding
@@ -2357,25 +2020,22 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
end
def encoding_names
- TkComm.simplelist(Tk.tk_call('encoding', 'names'))
+ tk_split_simplelist(tk_call('encoding', 'names'))
end
def encoding_system
- Tk.tk_call('encoding', 'system')
+ tk_call('encoding', 'system')
end
def encoding_system=(enc)
- Tk.tk_call('encoding', 'system', enc)
+ tk_call('encoding', 'system', enc)
end
def encoding_convertfrom(str, enc=nil)
- # str is an usual enc string or a Tcl's internal string expression
- # in enc (which is returned from 'encoding_convertto' method).
+ # str must be a Tcl's internal string expression in enc.
# the return value is a UTF-8 string.
enc = encoding_system unless enc
- ret = TkCore::INTERP.__invoke('encoding', 'convertfrom', enc, str)
- ret.instance_variable_set('@encoding', 'utf-8')
- ret
+ TkCore::INTERP.__invoke('encoding', 'convertfrom', enc, str)
end
alias encoding_convert_from encoding_convertfrom
@@ -2384,21 +2044,9 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
# The return value is a Tcl's internal string expression in enc.
# To get an usual enc string, use Tk.fromUTF8(ret_val, enc).
enc = encoding_system unless enc
- ret = TkCore::INTERP.__invoke('encoding', 'convertto', enc, str)
- ret.instance_variable_set('@encoding', 'binary')
- ret
+ TkCore::INTERP.__invoke('encoding', 'convertto', enc, str)
end
alias encoding_convert_to encoding_convertto
-
- def encoding_dirs
- # Tcl8.5 feature
- TkComm.simplelist(Tk.tk_call_without_enc('encoding', 'dirs'))
- end
-
- def encoding_dirs=(dir_list) # an array or a Tcl's list string
- # Tcl8.5 feature
- Tk.tk_call_without_enc('encoding', 'dirs', dir_list)
- end
end
extend Encoding
@@ -2425,9 +2073,6 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
Tk.encoding = 'utf-8'
Tk.encoding_system = 'utf-8'
else # NONE
- if defined? DEFAULT_TK_ENCODING
- Tk.encoding_system = DEFAULT_TK_ENCODING
- end
begin
Tk.encoding = Tk.encoding_system
rescue StandardError, NameError
@@ -2439,8 +2084,6 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
else
# dummy methods
class TclTkIp
- attr_accessor :encoding
-
alias __eval _eval
alias __invoke _invoke
@@ -2477,15 +2120,7 @@ else
str
end
alias encoding_convert_to encoding_convertto
- def encoding_dirs
- nil
- end
- def encoding_dirs=(dir_array)
- nil
- end
end
-
- extend Encoding
end
end
@@ -2496,7 +2131,7 @@ module TkBindCore
#end
def bind(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -2509,7 +2144,7 @@ module TkBindCore
#end
def bind_append(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -2738,18 +2373,18 @@ module TkTreatFont
self
end
- def font_copy(win, wintag=nil, winkey=nil, targetkey=nil)
+ def font_copy(window, wintag=nil, winkey=nil, targetkey=nil)
if wintag
if winkey
- fnt = win.tagfontobj(wintag, winkey).dup
+ fnt = window.tagfontobj(wintag, winkey).dup
else
- fnt = win.tagfontobj(wintag).dup
+ fnt = window.tagfontobj(wintag).dup
end
else
if winkey
- fnt = win.fontobj(winkey).dup
+ fnt = window.fontobj(winkey).dup
else
- fnt = win.fontobj.dup
+ fnt = window.fontobj.dup
end
end
@@ -2761,7 +2396,7 @@ module TkTreatFont
self
end
- def latinfont_copy(win, wintag=nil, winkey=nil, targetkey=nil)
+ def latinfont_copy(window, wintag=nil, winkey=nil, targetkey=nil)
if targetkey
fontobj(targetkey).dup.call_font_configure([__pathname, targetkey],
*(__config_cmd << {}))
@@ -2771,22 +2406,22 @@ module TkTreatFont
if wintag
if winkey
- fontobj.latin_replace(win.tagfontobj(wintag, winkey).latin_font_id)
+ fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
else
- fontobj.latin_replace(win.tagfontobj(wintag).latin_font_id)
+ fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
end
else
if winkey
- fontobj.latin_replace(win.fontobj(winkey).latin_font_id)
+ fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
else
- fontobj.latin_replace(win.fontobj.latin_font_id)
+ fontobj.latin_replace(window.fontobj.latin_font_id)
end
end
self
end
alias asciifont_copy latinfont_copy
- def kanjifont_copy(win, wintag=nil, winkey=nil, targetkey=nil)
+ def kanjifont_copy(window, wintag=nil, winkey=nil, targetkey=nil)
if targetkey
fontobj(targetkey).dup.call_font_configure([__pathname, targetkey],
*(__config_cmd << {}))
@@ -2796,15 +2431,15 @@ module TkTreatFont
if wintag
if winkey
- fontobj.kanji_replace(win.tagfontobj(wintag, winkey).kanji_font_id)
+ fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
else
- fontobj.kanji_replace(win.tagfontobj(wintag).kanji_font_id)
+ fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
end
else
if winkey
- fontobj.kanji_replace(win.fontobj(winkey).kanji_font_id)
+ fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
else
- fontobj.kanji_replace(win.fontobj.kanji_font_id)
+ fontobj.kanji_replace(window.fontobj.kanji_font_id)
end
end
self
@@ -2848,18 +2483,12 @@ module TkConfigMethod
private :__numstrval_optkeys
def __boolval_optkeys
- ['exportselection', 'jump', 'setgrid', 'takefocus']
+ []
end
private :__boolval_optkeys
def __strval_optkeys
- [
- 'text', 'label', 'show', 'data', 'file',
- 'activebackground', 'activeforeground', 'background',
- 'disabledforeground', 'disabledbackground', 'foreground',
- 'highlightbackground', 'highlightcolor', 'insertbackground',
- 'selectbackground', 'selectforeground', 'troughcolor'
- ]
+ ['text', 'label', 'show', 'data', 'file']
end
private :__strval_optkeys
@@ -2873,29 +2502,7 @@ module TkConfigMethod
end
private :__numlistval_optkeys
- def __tkvariable_optkeys
- ['variable', 'textvariable']
- end
- private :__tkvariable_optkeys
-
- def __val2ruby_optkeys # { key=>proc, ... }
- # The method is used to convert a opt-value to a ruby's object.
- # When get the value of the option "key", "proc.call(value)" is called.
- {}
- end
- private :__val2ruby_optkeys
-
- def __ruby2val_optkeys # { key=>proc, ... }
- # The method is used to convert a ruby's object to a opt-value.
- # When set the value of the option "key", "proc.call(value)" is called.
- # That is, "-#{key} #{proc.call(value)}".
- {}
- end
- private :__ruby2val_optkeys
-
def __methodcall_optkeys # { key=>method, ... }
- # The method is used to both of get and set.
- # Usually, the 'key' will not be a widget option.
{}
end
private :__methodcall_optkeys
@@ -2943,22 +2550,7 @@ module TkConfigMethod
end
def cget(slot)
- orig_slot = slot
slot = slot.to_s
-
- if slot.length == 0
- fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
- end
-
- if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
- optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
- begin
- return method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- return optval
- end
- end
if ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
return self.__send__(method)
@@ -3010,10 +2602,6 @@ module TkConfigMethod
fnt
end
- when /^(#{__tkvariable_optkeys.join('|')})$/
- v = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
- (v.empty?)? nil: TkVarAccess.new(v)
-
else
tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{slot}")), true)
end
@@ -3028,11 +2616,6 @@ module TkConfigMethod
self.__send__(method, value) if value
}
- __ruby2val_optkeys.each{|key, method|
- key = key.to_s
- slot[key] = method.call(slot[key]) if slot.has_key?(key)
- }
-
__keyonly_optkeys.each{|defkey, undefkey|
conf = slot.find{|kk, vv| kk == defkey.to_s}
if conf
@@ -3053,12 +2636,7 @@ module TkConfigMethod
end
else
- orig_slot = slot
slot = slot.to_s
- if slot.length == 0
- fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
- end
-
if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
defkey, undefkey = conf
if value
@@ -3066,8 +2644,6 @@ module TkConfigMethod
elsif undefkey
tk_call(*(__config_cmd << "-#{undefkey}"))
end
- elsif ( method = _symbolkey2str(__ruby2val_optkeys)[slot] )
- tk_call(*(__config_cmd << "-#{slot}" << method.call(value)))
elsif ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
self.__send__(method, value)
elsif (slot =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
@@ -3089,11 +2665,9 @@ module TkConfigMethod
def configinfo(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
- if (slot &&
- slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
fontkey = $2
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}"))))
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]
if ( ! __configinfo_struct[:alias] \
@@ -3110,38 +2684,12 @@ module TkConfigMethod
if slot
slot = slot.to_s
case slot
- when /^(#{__val2ruby_optkeys().keys.join('|')})$/
- method = _symbolkey2str(__val2ruby_optkeys())[slot]
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd() << "-#{slot}")), false, true)
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- optval = conf[__configinfo_struct[:default_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:default_value]] = val
- end
- if ( conf[__configinfo_struct[:current_value]] )
- optval = conf[__configinfo_struct[:current_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:current_value]] = val
- end
-
when /^(#{__methodcall_optkeys.keys.join('|')})$/
method = _symbolkey2str(__methodcall_optkeys)[slot]
return [slot, '', '', '', self.__send__(method)]
when /^(#{__numval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]])
@@ -3162,8 +2710,7 @@ module TkConfigMethod
end
when /^(#{__numstrval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]])
@@ -3176,8 +2723,7 @@ module TkConfigMethod
end
when /^(#{__boolval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]])
@@ -3198,8 +2744,7 @@ module TkConfigMethod
end
when /^(#{__listval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]])
@@ -3212,8 +2757,7 @@ module TkConfigMethod
end
when /^(#{__numlistval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] \
@@ -3228,33 +2772,9 @@ module TkConfigMethod
end
when /^(#{__strval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
-
- when /^(#{__tkvariable_optkeys.join('|')})$/
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
-
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]])
- v = conf[__configinfo_struct[:default_value]]
- if v.empty?
- conf[__configinfo_struct[:default_value]] = nil
- else
- conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__configinfo_struct[:current_value]] )
- v = conf[__configinfo_struct[:current_value]]
- if v.empty?
- conf[__configinfo_struct[:current_value]] = nil
- else
- conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
- end
- end
-
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
else
- # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
end
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]
@@ -3269,39 +2789,12 @@ module TkConfigMethod
conf
else
- # ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__confinfo_cmd))).collect{|conflist|
- # conf = tk_split_simplelist(conflist)
- ret = tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).collect{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__confinfo_cmd))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]
- optkey = conf[__configinfo_struct[:key]]
- case optkey
- when /^(#{__val2ruby_optkeys().keys.join('|')})$/
- method = _symbolkey2str(__val2ruby_optkeys())[optkey]
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- optval = conf[__configinfo_struct[:default_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:default_value]] = val
- end
- if ( conf[__configinfo_struct[:current_value]] )
- optval = conf[__configinfo_struct[:current_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:current_value]] = val
- end
-
+ case conf[__configinfo_struct[:key]]
when /^(#{__strval_optkeys.join('|')})$/
# do nothing
@@ -3378,25 +2871,6 @@ module TkConfigMethod
list(conf[__configinfo_struct[:current_value]])
end
- when /^(#{__tkvariable_optkeys.join('|')})$/
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- v = conf[__configinfo_struct[:default_value]]
- if v.empty?
- conf[__configinfo_struct[:default_value]] = nil
- else
- conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__configinfo_struct[:current_value]] )
- v = conf[__configinfo_struct[:current_value]]
- if v.empty?
- conf[__configinfo_struct[:current_value]] = nil
- else
- conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
- end
- end
-
else
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] )
@@ -3448,11 +2922,9 @@ module TkConfigMethod
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- if (slot &&
- slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
fontkey = $2
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}"))))
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]
@@ -3474,38 +2946,12 @@ module TkConfigMethod
if slot
slot = slot.to_s
case slot
- when /^(#{__val2ruby_optkeys().keys.join('|')})$/
- method = _symbolkey2str(__val2ruby_optkeys())[slot]
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- optval = conf[__configinfo_struct[:default_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:default_value]] = val
- end
- if ( conf[__configinfo_struct[:current_value]] )
- optval = conf[__configinfo_struct[:current_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:current_value]] = val
- end
-
when /^(#{__methodcall_optkeys.keys.join('|')})$/
method = _symbolkey2str(__methodcall_optkeys)[slot]
return {slot => ['', '', '', self.__send__(method)]}
when /^(#{__numval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] )
@@ -3526,8 +2972,7 @@ module TkConfigMethod
end
when /^(#{__numstrval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] )
@@ -3540,8 +2985,7 @@ module TkConfigMethod
end
when /^(#{__boolval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] )
@@ -3562,8 +3006,7 @@ module TkConfigMethod
end
when /^(#{__listval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] )
@@ -3576,8 +3019,7 @@ module TkConfigMethod
end
when /^(#{__numlistval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] \
@@ -3591,33 +3033,10 @@ module TkConfigMethod
list(conf[__configinfo_struct[:current_value]])
end
- when /^(#{__tkvariable_optkeys.join('|')})$/
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
-
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- v = conf[__configinfo_struct[:default_value]]
- if v.empty?
- conf[__configinfo_struct[:default_value]] = nil
- else
- conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__configinfo_struct[:current_value]] )
- v = conf[__configinfo_struct[:current_value]]
- if v.empty?
- conf[__configinfo_struct[:current_value]] = nil
- else
- conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
- end
- end
-
when /^(#{__strval_optkeys.join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
else
- # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
- conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc(*(__confinfo_cmd << "-#{slot}"))))
end
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]
@@ -3635,39 +3054,12 @@ module TkConfigMethod
else
ret = {}
- # tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__confinfo_cmd))).each{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).each{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__confinfo_cmd))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]
- optkey = conf[__configinfo_struct[:key]]
- case optkey
- when /^(#{__val2ruby_optkeys().keys.join('|')})$/
- method = _symbolkey2str(__val2ruby_optkeys())[optkey]
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- optval = conf[__configinfo_struct[:default_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:default_value]] = val
- end
- if ( conf[__configinfo_struct[:current_value]] )
- optval = conf[__configinfo_struct[:current_value]]
- begin
- val = method.call(optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__configinfo_struct[:current_value]] = val
- end
-
+ case conf[__configinfo_struct[:key]]
when /^(#{__strval_optkeys.join('|')})$/
# do nothing
@@ -3744,25 +3136,6 @@ module TkConfigMethod
list(conf[__configinfo_struct[:current_value]])
end
- when /^(#{__tkvariable_optkeys.join('|')})$/
- if ( __configinfo_struct[:default_value] \
- && conf[__configinfo_struct[:default_value]] )
- v = conf[__configinfo_struct[:default_value]]
- if v.empty?
- conf[__configinfo_struct[:default_value]] = nil
- else
- conf[__configinfo_struct[:default_value]] = TkVarAccess.new
- end
- end
- if ( conf[__configinfo_struct[:current_value]] )
- v = conf[__configinfo_struct[:current_value]]
- if v.empty?
- conf[__configinfo_struct[:current_value]] = nil
- else
- conf[__configinfo_struct[:current_value]] = TkVarAccess.new
- end
- end
-
else
if ( __configinfo_struct[:default_value] \
&& conf[__configinfo_struct[:default_value]] )
@@ -3884,25 +3257,6 @@ class TkObject<TkKernel
end
# private :tk_send, :tk_send_without_enc, :tk_send_with_enc
- def tk_send_to_list(cmd, *rest)
- tk_call_to_list(path, cmd, *rest)
- end
- def tk_send_to_list_without_enc(cmd, *rest)
- tk_call_to_list_without_enc(path, cmd, *rest)
- end
- def tk_send_to_list_with_enc(cmd, *rest)
- tk_call_to_list_with_enc(path, cmd, *rest)
- end
- def tk_send_to_simplelist(cmd, *rest)
- tk_call_to_simplelist(path, cmd, *rest)
- end
- def tk_send_to_simplelist_without_enc(cmd, *rest)
- tk_call_to_simplelist_without_enc(path, cmd, *rest)
- end
- def tk_send_to_simplelist_with_enc(cmd, *rest)
- tk_call_to_simplelist_with_enc(path, cmd, *rest)
- end
-
def method_missing(id, *args)
name = id.id2name
case args.length
@@ -3918,14 +3272,12 @@ class TkObject<TkKernel
begin
cget(name)
rescue
- super(id, *args)
-# fail NameError,
-# "undefined local variable or method `#{name}' for #{self.to_s}",
-# error_at
+ fail NameError,
+ "undefined local variable or method `#{name}' for #{self.to_s}",
+ error_at
end
else
- super(id, *args)
-# fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
end
end
@@ -3941,9 +3293,7 @@ class TkObject<TkKernel
=end
def event_generate(context, keys=nil)
- if context.kind_of?(TkEvent::Event)
- context.generate(self, ((keys)? keys: {}))
- elsif keys
+ if keys
#tk_call('event', 'generate', path,
# "<#{tk_event_sequence(context)}>", *hash_kv(keys))
tk_call_without_enc('event', 'generate', path,
@@ -3991,19 +3341,19 @@ class TkWindow<TkObject
widgetname = keys.delete('widgetname')
install_win(if parent then parent.path end, widgetname)
without_creating = keys.delete('without_creating')
- # if without_creating && !widgetname
- # fail ArgumentError,
- # "if set 'without_creating' to true, need to define 'widgetname'"
- # end
+ if without_creating && !widgetname
+ fail ArgumentError,
+ "if set 'without_creating' to true, need to define 'widgetname'"
+ end
elsif keys
keys = _symbolkey2str(keys)
widgetname = keys.delete('widgetname')
install_win(if parent then parent.path end, widgetname)
without_creating = keys.delete('without_creating')
- # if without_creating && !widgetname
- # fail ArgumentError,
- # "if set 'without_creating' to true, need to define 'widgetname'"
- # end
+ if without_creating && !widgetname
+ fail ArgumentError,
+ "if set 'without_creating' to true, need to define 'widgetname'"
+ end
else
install_win(if parent then parent.path end)
end
@@ -4040,11 +3390,6 @@ class TkWindow<TkObject
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
}
-
- __ruby2val_optkeys.each{|key, method|
- key = key.to_s
- keys[key] = method.call(keys[key]) if keys.has_key?(key)
- }
end
if without_creating && keys
#configure(keys)
@@ -4196,7 +3541,7 @@ class TkWindow<TkObject
self
end
- def grid_forget
+ def grid_forget
#tk_call('grid', 'forget', epath)
TkGrid.forget(self)
self
@@ -4280,9 +3625,9 @@ class TkWindow<TkObject
# self
#end
if mode == None
- TkGrid.propagate(self)
+ TkGrid.propagete(self)
else
- TkGrid.propagate(self, mode)
+ TkGrid.propagete(self, mode)
self
end
end
@@ -4433,14 +3778,12 @@ class TkWindow<TkObject
tk_call 'lower', epath, below
self
end
- alias lower_window lower
def raise(above=None)
#above = above.epath if above.kind_of?(TkObject)
above = _epath(above)
tk_call 'raise', epath, above
self
end
- alias raise_window raise
def command(cmd=nil, &b)
if cmd
@@ -4597,8 +3940,6 @@ end
#Tk.freeze
module Tk
- RELEASE_DATE = '2006-07-14'.freeze
-
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
autoload :PACKAGE_PATH, 'tk/variable'
@@ -4607,6 +3948,7 @@ module Tk
autoload :TCL_PRECISION, 'tk/variable'
end
+
# call setup script for Tk extension libraries (base configuration)
begin
require 'tkextlib/setup.rb'
diff --git a/ext/tk/lib/tk/after.rb b/ext/tk/lib/tk/after.rb
index 24a048ee32..8c58210331 100644
--- a/ext/tk/lib/tk/after.rb
+++ b/ext/tk/lib/tk/after.rb
@@ -1,6 +1,6 @@
#
# tk/after.rb : methods for Tcl/Tk after command
#
-# $Id: after.rb,v 1.1.2.1 2004/05/01 16:09:49 nagai Exp $
+# $Id$
#
require 'tk/timer'
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index 6b3773f4ea..3006b559d6 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -47,10 +47,8 @@ autoload :TkConsole, 'tk/console'
autoload :TkDialog, 'tk/dialog'
autoload :TkDialog2, 'tk/dialog'
-autoload :TkDialogObj, 'tk/dialog'
autoload :TkWarning, 'tk/dialog'
autoload :TkWarning2, 'tk/dialog'
-autoload :TkWarningObj, 'tk/dialog'
autoload :TkEntry, 'tk/entry'
@@ -150,7 +148,6 @@ autoload :TkTextWindow, 'tk/textwindow'
autoload :TkAfter, 'tk/timer'
autoload :TkTimer, 'tk/timer'
-autoload :TkRTTimer, 'tk/timer'
autoload :TkToplevel, 'tk/toplevel'
@@ -162,7 +159,6 @@ autoload :TkVariable, 'tk/variable'
autoload :TkVarAccess, 'tk/variable'
autoload :TkVirtualEvent, 'tk/virtevent'
-autoload :TkNamedVirtualEvent,'tk/virtevent'
autoload :TkWinfo, 'tk/winfo'
diff --git a/ext/tk/lib/tk/bindtag.rb b/ext/tk/lib/tk/bindtag.rb
index 9023a08e06..737223e3df 100644
--- a/ext/tk/lib/tk/bindtag.rb
+++ b/ext/tk/lib/tk/bindtag.rb
@@ -23,7 +23,6 @@ class TkBindTag
@id = name
BTagID_TBL[@id] = self
bind(*args, &b) if args != []
- self
}
end
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index 0f55bff4ed..a0543cc42d 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -1,6 +1,6 @@
#
# tk/canvas.rb - Tk canvas classes
-# $Date: 2005/10/24 00:07:00 $
+# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
require 'tk'
@@ -11,25 +11,11 @@ require 'tk/scrollable'
module TkCanvasItemConfig
include TkItemConfigMethod
- def __item_strval_optkeys(id)
- # maybe need to override
- super(id) + [
- 'fill', 'activefill', 'disabledfill',
- 'outline', 'activeoutline', 'disabledoutline'
- ]
- end
- private :__item_strval_optkeys
-
def __item_methodcall_optkeys(id)
{'coords'=>'coords'}
end
private :__item_methodcall_optkeys
- def __item_val2ruby_optkeys(id) # { key=>proc, ... }
- super(id).update('window'=>proc{|i, v| window(v)})
- end
- private :__item_val2ruby_optkeys
-
def __item_pathname(tagOrId)
if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
self.path + ';' + tagOrId.id.to_s
@@ -61,16 +47,6 @@ class TkCanvas<TkWindow
#end
#private :create_self
- def __numval_optkeys
- super() + ['closeenough']
- end
- private :__numval_optkeys
-
- def __boolval_optkeys
- super() + ['confine']
- end
- private :__boolval_optkeys
-
def tagid(tag)
if tag.kind_of?(TkcItem) || tag.kind_of?(TkcTag)
tag.id
@@ -88,10 +64,6 @@ class TkCanvas<TkWindow
def addtag(tag, mode, *args)
- mode = mode.to_s
- if args[0] && mode =~ /^(above|below|with(tag)?)$/
- args[0] = tagid(args[0])
- end
tk_send_without_enc('addtag', tagid(tag), mode, *args)
self
end
@@ -128,7 +100,7 @@ class TkCanvas<TkWindow
#end
def itembind(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -143,7 +115,7 @@ class TkCanvas<TkWindow
#end
def itembind_append(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -187,12 +159,8 @@ class TkCanvas<TkWindow
def delete(*args)
if TkcItem::CItemID_TBL[self.path]
- args.each{|tag|
- find('withtag', tag).each{|item|
- if item.kind_of?(TkcItem)
- TkcItem::CItemID_TBL[self.path].delete(item.id)
- end
- }
+ find('withtag', *args).each{|item|
+ TkcItem::CItemID_TBL[self.path].delete(item.id)
}
end
tk_send_without_enc('delete', *args.collect{|t| tagid(t)})
@@ -201,10 +169,9 @@ class TkCanvas<TkWindow
alias remove delete
def dtag(tag, tag_to_del=None)
- tk_send_without_enc('dtag', tagid(tag), tagid(tag_to_del))
+ tk_send_without_enc('dtag', tagid(tag), tag_to_del)
self
end
- alias deltag dtag
def find(mode, *args)
list(tk_send_without_enc('find', mode, *args)).collect!{|id|
@@ -258,8 +225,8 @@ class TkCanvas<TkWindow
self
end
- def index(tagOrId, idx)
- number(tk_send_without_enc('index', tagid(tagOrId), idx))
+ def index(tagOrId, index)
+ number(tk_send_without_enc('index', tagid(tagOrId), index))
end
def insert(tagOrId, index, string)
@@ -630,11 +597,6 @@ class TkcItem<TkObject
methodkeys[key] = keys.delete(key) if keys.key?(key)
}
- __item_ruby2val_optkeys(nil).each{|key, method|
- key = key.to_s
- keys[key] = method.call(keys[key]) if keys.has_key?(key)
- }
-
#args = args.flatten.concat(hash_kv(keys))
args = args.flatten.concat(itemconfig_hash_kv(nil, keys))
else
@@ -659,7 +621,7 @@ class TkcItem<TkObject
def initialize(parent, *args)
#unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ # fail ArguemntError, "expect TkCanvas for 1st argument"
#end
@parent = @c = parent
@path = parent.path
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
index a5650ee68b..2eec6e3ca1 100644
--- a/ext/tk/lib/tk/canvastag.rb
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -13,7 +13,7 @@ require 'tk/canvas'
module TkcTagAccess
def addtag(tag)
- @c.addtag(tag, 'withtag', @id)
+ @c.addtag(tag, 'with', @id)
self
end
@@ -27,7 +27,7 @@ module TkcTagAccess
#end
def bind(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -42,7 +42,7 @@ module TkcTagAccess
#end
def bind_append(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -93,7 +93,6 @@ module TkcTagAccess
@c.dtag(@id, tag_to_del)
self
end
- alias deltag dtag
def find
@c.find('withtag', @id)
@@ -113,8 +112,8 @@ module TkcTagAccess
self
end
- def index(idx)
- @c.index(@id, idx)
+ def index(index)
+ @c.index(@id, index)
end
def insert(beforethis, string)
@@ -211,7 +210,7 @@ class TkcTag<TkObject
def initialize(parent, mode=nil, *args)
#unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ # fail ArguemntError, "expect TkCanvas for 1st argument"
#end
@c = parent
@cpath = parent.path
@@ -298,7 +297,7 @@ class TkcTagString<TkcTag
def initialize(parent, name, mode=nil, *args)
#unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ # fail ArguemntError, "expect TkCanvas for 1st argument"
#end
@c = parent
@cpath = parent.path
@@ -315,7 +314,7 @@ TkcNamedTag = TkcTagString
class TkcTagAll<TkcTag
def initialize(parent)
#unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ # fail ArguemntError, "expect TkCanvas for 1st argument"
#end
@c = parent
@cpath = parent.path
@@ -328,7 +327,7 @@ end
class TkcTagCurrent<TkcTag
def initialize(parent)
#unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ # fail ArguemntError, "expect TkCanvas for 1st argument"
#end
@c = parent
@cpath = parent.path
@@ -343,7 +342,7 @@ class TkcGroup<TkcTag
#def create_self(parent, *args)
def initialize(parent, *args)
#unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ # fail ArguemntError, "expect TkCanvas for 1st argument"
#end
@c = parent
@cpath = parent.path
@@ -352,23 +351,20 @@ class TkcGroup<TkcTag
CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
CTagID_TBL[@cpath][@id] = self
Tk_cGroup_ID[1].succ!
- include(*args) if args != []
+ add(*args) if args != []
end
#private :create_self
def include(*tags)
for i in tags
- #i.addtag(@id)
- @c.addtag_withtag(@id, i)
+ i.addtag(@id)
end
self
end
- alias add include
def exclude(*tags)
for i in tags
- #i.dtag(@id)
- @c.dtag(i, @id)
+ i.delete(@id)
end
self
end
diff --git a/ext/tk/lib/tk/clock.rb b/ext/tk/lib/tk/clock.rb
index 4e9438f5ab..3581152c8b 100644
--- a/ext/tk/lib/tk/clock.rb
+++ b/ext/tk/lib/tk/clock.rb
@@ -5,17 +5,13 @@ require 'tk'
module Tk
module Clock
- include Tk
- extend TkCore
-
def self.add(clk, *args)
tk_call_without_enc('clock','add', clk, *args).to_i
end
def self.clicks(ms=nil)
- ms = ms.to_s if ms.kind_of?(Symbol)
case ms
- when nil, ''
+ when nil
tk_call_without_enc('clock','clicks').to_i
when /^mic/
tk_call_without_enc('clock','clicks','-microseconds').to_i
diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb
index eaed8ed363..d85b815dd7 100644
--- a/ext/tk/lib/tk/composite.rb
+++ b/ext/tk/lib/tk/composite.rb
@@ -7,7 +7,6 @@ module TkComposite
include Tk
extend Tk
-=begin
def initialize(parent=nil, *args)
@delegates = {}
@option_methods = {}
@@ -25,106 +24,6 @@ module TkComposite
initialize_composite(*args)
end
end
-=end
-
- def _choice_classname_of_baseframe
- base_class_name = nil
-
- klass = WidgetClassNames[self.class::WidgetClassName]
-
- if klass
- # WidgetClassName is a known class
- if klass <= TkFrame || klass < TkComposite
- # klass is valid for the base frame
- if self.class <= klass
- # use my classname
- base_class_name = self.class.name
- if base_class_name == ''
- # anonymous class -> use ancestor's name
- base_class_name = klass.name
- end
- else
- # not subclass -> use WidgetClassName
- base_class_name = klass.name
- end
-
- else
- # klass is invalid for the base frame
- if self.class < TkFrame || self.class.superclass < TkComposite
- # my class name is valid for the base frame -> use my classname
- base_class_name = self.class.name
- if base_class_name == ''
- # anonymous class -> use TkFrame
- base_class_name = nil
- end
- else
- # no idea for the base frame -> use TkFrame
- base_class_name = nil
- end
- end
-
- elsif self.class::WidgetClassName && ! self.class::WidgetClassName.empty?
- # unknown WidgetClassName is defined -> use it for the base frame
- base_class_name = self.class::WidgetClassName
-
- else
- # no valid WidgetClassName
- if self.class < TkFrame || self.class.superclass < TkComposite
- # my class name is valid for the base frame -> use my classname
- base_class_name = self.class.name
- if base_class_name == ''
- # anonymous class -> use TkFrame
- base_class_name = nil
- end
- else
- # no idea for the base frame -> use TkFrame
- base_class_name = nil
- end
- end
-
- base_class_name
- end
- private :_choice_classname_of_baseframe
-
- # def initialize(parent=nil, *args)
- def initialize(*args)
- @delegates = {}
- @option_methods = {}
- @option_setting = {}
-
- if args[-1].kind_of?(Hash)
- keys = _symbolkey2str(args.pop)
- else
- keys = {}
- end
- parent = args.shift
- parent = keys.delete('parent') if keys.has_key?('parent')
-
- if keys.key?('classname')
- keys['class'] = keys.delete('classname')
- end
- if (base_class_name = (keys.delete('class')).to_s).empty?
- base_class_name = _choice_classname_of_baseframe
- end
-
- if base_class_name
- @frame = TkFrame.new(parent, :class=>base_class_name)
- else
- @frame = TkFrame.new(parent)
- end
- @path = @epath = @frame.path
-
- args.push(keys) unless keys.empty?
- initialize_composite(*args)
- end
-
- def database_classname
- @frame.database_classname
- end
-
- def database_class
- @frame.database_class
- end
def epath
@epath
@@ -198,7 +97,7 @@ module TkComposite
rescue
end
- super(slot)
+ super
end
def configure(slot, value=None)
@@ -235,7 +134,7 @@ module TkComposite
rescue
end
- super(slot, value)
+ super
end
def configinfo(slot = nil)
@@ -272,10 +171,10 @@ module TkComposite
rescue
end
- super(slot)
+ super
else # slot == nil
- info_list = super(slot)
+ info_list = super
tbl = @delegates['DEFAULT']
if tbl
@@ -351,10 +250,10 @@ module TkComposite
rescue
end
- super(slot)
+ super
else # slot == nil
- info_list = super(slot)
+ info_list = super
tbl = @delegates['DEFAULT']
if tbl
diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb
index 26ce262caa..f0d2c7aa87 100644
--- a/ext/tk/lib/tk/console.rb
+++ b/ext/tk/lib/tk/console.rb
@@ -7,12 +7,7 @@ module TkConsole
include Tk
extend Tk
- TkCommandNames = ['console'.freeze, 'consoleinterp'.freeze].freeze
-
- def self.create
- TkCore::INTERP._create_console
- end
- self.create # initialize console
+ TkCommandNames = ['console'.freeze].freeze
def self.title(str=None)
tk_call 'console', str
@@ -31,22 +26,4 @@ module TkConsole
_fromUTF8(tk_call_without_enc('console', 'eval',
_get_eval_enc_str(tcl_script)))
end
- def self.maininterp_eval(tcl_script)
- #
- # supports a Tcl script only
- # I have no idea to support a Ruby script seamlessly.
- #
- _fromUTF8(tk_call_without_enc('consoleinterp', 'eval',
- _get_eval_enc_str(tcl_script)))
-
- end
- def self.maininterp_record(tcl_script)
- #
- # supports a Tcl script only
- # I have no idea to support a Ruby script seamlessly.
- #
- _fromUTF8(tk_call_without_enc('consoleinterp', 'record',
- _get_eval_enc_str(tcl_script)))
-
- end
end
diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb
index 180da101e3..5b627d7c03 100644
--- a/ext/tk/lib/tk/dialog.rb
+++ b/ext/tk/lib/tk/dialog.rb
@@ -2,7 +2,6 @@
# tk/dialog.rb : create dialog boxes
#
require 'tk'
-require 'tk/variable.rb'
class TkDialogObj < TkWindow
extend Tk
@@ -50,14 +49,13 @@ class TkDialogObj < TkWindow
end
}
end
- # @config = 'after idle {' + @config + '};' if @config != ""
- @config = array2tk_list(['after', 'idle', @config]) << ';' if @config != ""
+ @config = 'after idle {' + @config + '};' if @config != ""
end
private :_set_button_config
# initialize tk_dialog
def create_self(keys)
- # @var = TkVariable.new
+ #@var = TkVariable.new
@val = nil
@title = title
@@ -84,8 +82,7 @@ class TkDialogObj < TkWindow
@title = keys['title'] if keys.key? 'title'
@message = keys['message'] if keys.key? 'message'
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
- # @bitmap = '{}' if @bitmap == nil || @bitmap == ""
- @bitmap = '' unless @bitmap
+ @bitmap = '{}' if @bitmap == nil || @bitmap == ""
@default_button = keys['default'] if keys.key? 'default'
@buttons = keys['buttons'] if keys.key? 'buttons'
@@ -98,9 +95,9 @@ class TkDialogObj < TkWindow
@btnframe_config = keys['btnframe_config'] if keys.key? 'btnframe_config'
end
- #if @title.include? ?\s
- # @title = '{' + @title + '}'
- #end
+ if @title.include? ?\s
+ @title = '{' + @title + '}'
+ end
if @buttons.kind_of?(Array)
_set_button_config(@buttons.collect{|cfg|
@@ -112,8 +109,6 @@ class TkDialogObj < TkWindow
@buttons = @buttons.keys
end
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of?(String)
- @buttons = [] unless @buttons
-=begin
@buttons = @buttons.collect{|s|
if s.kind_of?(Array)
s = s.join(' ')
@@ -124,7 +119,6 @@ class TkDialogObj < TkWindow
s
end
}
-=end
if @message_config.kind_of?(Hash)
# @config << Kernel.format("%s.msg configure %s;",
@@ -173,8 +167,7 @@ class TkDialogObj < TkWindow
else
default_button = @default_button
end
- # default_button = '{}' if default_button == nil
- default_button = '' if default_button == nil
+ default_button = '{}' if default_button == nil
#Tk.ip_eval('eval {global '+@var.id+';'+@config+
# 'set '+@var.id+' [tk_dialog '+
# @path+" "+@title+" {#{@message}} "+@bitmap+" "+
@@ -183,14 +176,9 @@ class TkDialogObj < TkWindow
# @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title +
# ' {' + @message + '} ' + @bitmap + ' ' +
# String(default_button) + ' ' + @buttons.join(' ')).to_i
- # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
- # @title + ' {' + @message + '} ' + @bitmap + ' ' +
- # String(default_button) + ' ' + @buttons.join(' ')).to_i
- @val = Tk.ip_eval(array2tk_list([
- self.class::TkCommandNames[0],
- @path, @title, @message, @bitmap,
- String(default_button)
- ].concat(@buttons))).to_i
+ @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
+ @title + ' {' + @message + '} ' + @bitmap + ' ' +
+ String(default_button) + ' ' + @buttons.join(' ')).to_i
end
def value
@@ -199,14 +187,13 @@ class TkDialogObj < TkWindow
end
def name
- (@val)? @buttons[@val]: nil
+ @buttons[@val]
end
-
- ############################################################
- # #
- # following methods should be overridden for each dialog #
- # #
- ############################################################
+ ######################################################
+ # #
+ # these methods must be overridden for each dialog #
+ # #
+ ######################################################
private
def title
diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb
index 797e514a4c..aed0e7524e 100644
--- a/ext/tk/lib/tk/encodedstr.rb
+++ b/ext/tk/lib/tk/encodedstr.rb
@@ -67,13 +67,9 @@ module Tk
def initialize(str, enc = nil)
super(str)
- # @encoding = ( enc ||
- # ((self.class::Encoding)?
- # self.class::Encoding : Tk.encoding_system) )
@encoding = ( enc ||
- ((self.class::Encoding)?
- self.class::Encoding :
- ((Tk.encoding)? Tk.encoding : Tk.encoding_system) ) )
+ ((self.class::Encoding)?
+ self.class::Encoding : Tk.encoding_system) )
end
attr_reader :encoding
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
index e4d69eb7bf..a3c0e51cdd 100644
--- a/ext/tk/lib/tk/entry.rb
+++ b/ext/tk/lib/tk/entry.rb
@@ -1,6 +1,6 @@
#
# tk/entry.rb - Tk entry classes
-# $Date: 2005/10/22 22:16:24 $
+# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
@@ -21,26 +21,19 @@ class TkEntry<TkLabel
#end
#private :create_self
- def __strval_optkeys
- super() + ['show', 'disabledbackground', 'readonlybackground']
- end
- private :__strval_optkeys
-
def bbox(index)
list(tk_send_without_enc('bbox', index))
end
def cursor
number(tk_send_without_enc('index', 'insert'))
end
- alias icursor cursor
def cursor=(index)
tk_send_without_enc('icursor', index)
#self
index
end
- alias icursor= cursor=
- def index(idx)
- number(tk_send_without_enc('index', idx))
+ def index(index)
+ number(tk_send_without_enc('index', index))
end
def insert(pos,text)
tk_send_without_enc('insert', pos, _get_eval_enc_str(text))
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index 70a1e38bbe..dd01ba6309 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -8,289 +8,48 @@ end
########################
require 'tkutil'
-require 'tk'
+# require 'tk'
########################
module TkEvent
class Event < TkUtil::CallbackSubst
- module Grp
- KEY = 0x1
- BUTTON = 0x2
- MOTION = 0x4
- CROSSING = 0x8
- FOCUS = 0x10
- EXPOSE = 0x20
- VISIBILITY = 0x40
- CREATE = 0x80
- DESTROY = 0x100
- UNMAP = 0x200
- MAP = 0x400
- REPARENT = 0x800
- CONFIG = 0x1000
- GRAVITY = 0x2000
- CIRC = 0x4000
- PROP = 0x8000
- COLORMAP = 0x10000
- VIRTUAL = 0x20000
- ACTIVATE = 0x40000
- MAPREQ = 0x80000
- CONFIGREQ = 0x100000
- RESIZEREQ = 0x200000
- CIRCREQ = 0x400000
-
- MWHEEL = 0x10000000
-
- ALL = 0xFFFFFFFF
-
- KEY_BUTTON_MOTION_VIRTUAL = (KEY|MWHEEL|BUTTON|MOTION|VIRTUAL)
- KEY_BUTTON_MOTION_CROSSING = (KEY|MWHEEL|BUTTON|MOTION|CROSSING|VIRTUAL)
- end
-
- type_data = [
- #-----+-------------------+------------------+-----------------------#
- # ID | const | group_flag | context_name #
- #-----+-------------------+------------------+-----------------------#
- [ 2, :KeyPress, Grp::KEY, 'KeyPress', 'Key' ],
- [ 3, :KeyRelease, Grp::KEY, 'KeyRelease' ],
- [ 4, :ButtonPress, Grp::BUTTON, 'ButtonPress', 'Button' ],
- [ 5, :ButtonRelease, Grp::BUTTON, 'ButtonRelease' ],
- [ 6, :MotionNotify, Grp::MOTION, 'Motion' ],
- [ 7, :EnterNotify, Grp::CROSSING, 'Enter' ],
- [ 8, :LeaveNotify, Grp::CROSSING, 'Leave' ],
- [ 9, :FocusIn, Grp::FOCUS, 'FocusIn' ],
- [ 10, :FocusOut, Grp::FOCUS, 'FocusOut' ],
- [ 11, :KeymapNotify, 0, ],
- [ 12, :Expose, Grp::EXPOSE, 'Expose' ],
- [ 13, :GraphicsExpose, Grp::EXPOSE, ],
- [ 14, :NoExpose, 0, ],
- [ 15, :VisibilityNotify, Grp::VISIBILITY, 'Visibility' ],
- [ 16, :CreateNotify, Grp::CREATE, 'Create' ],
- [ 17, :DestroyNotify, Grp::DESTROY, 'Destroy' ],
- [ 18, :UnmapNotify, Grp::UNMAP, 'Unmap' ],
- [ 19, :MapNotify, Grp::MAP, 'Map' ],
- [ 20, :MapRequest, Grp::MAPREQ, 'MapRequest' ],
- [ 21, :ReparentNotify, Grp::REPARENT, 'Reparent' ],
- [ 22, :ConfigureNotify, Grp::CONFIG, 'Configure' ],
- [ 23, :ConfigureRequest, Grp::CONFIGREQ, 'ConfigureRequest' ],
- [ 24, :GravityNotify, Grp::GRAVITY, 'Gravity' ],
- [ 25, :ResizeRequest, Grp::RESIZEREQ, 'ResizeRequest' ],
- [ 26, :CirculateNotify, Grp::CIRC, 'Circulate' ],
- [ 27, :CirculateRequest, 0, 'CirculateRequest' ],
- [ 28, :PropertyNotify, Grp::PROP, 'Property' ],
- [ 29, :SelectionClear, 0, ],
- [ 30, :SelectionRequest, 0, ],
- [ 31, :SelectionNotify, 0, ],
- [ 32, :ColormapNotify, Grp::COLORMAP, 'Colormap' ],
- [ 33, :ClientMessage, 0, ],
- [ 34, :MappingNotify, 0, ],
- [ 35, :VirtualEvent, Grp::VIRTUAL, ],
- [ 36, :ActivateNotify, Grp::ACTIVATE, 'Activate' ],
- [ 37, :DeactivateNotify, Grp::ACTIVATE, 'Deactivate' ],
- [ 38, :MouseWheelEvent, Grp::MWHEEL, 'MouseWheel' ],
- [ 39, :TK_LASTEVENT, 0, ]
- ]
-
module TypeNum
+ KeyPress = 2
+ KeyRelease = 3
+ ButtonPress = 4
+ ButtonRelease = 5
+ MotionNotify = 6
+ EnterNotify = 7
+ LeaveNotify = 8
+ FocusIn = 9
+ FocusOut = 10
+ KeymapNotify = 11
+ Expose = 12
+ GraphicsExpose = 13
+ NoExpose = 14
+ VisibilityNotify = 15
+ CreateNotify = 16
+ DestroyNotify = 17
+ UnmapNotify = 18
+ MapNotify = 19
+ MapRequest = 20
+ ReparentNotify = 21
+ ConfigureNotify = 22
+ ConfigureRequest = 23
+ GravityNotify = 24
+ ResizeRequest = 25
+ CirculateNotify = 26
+ CirculateRequest = 27
+ PropertyNotify = 28
+ SelectionClear = 29
+ SelectionRequest = 30
+ SelectionNotify = 31
+ ColormapNotify = 32
+ ClientMessage = 33
+ MappingNotify = 34
end
- TYPE_NAME_TBL = Hash.new
- TYPE_ID_TBL = Hash.new
- TYPE_GROUP_TBL = Hash.new
-
- type_data.each{|id, c_name, g_flag, *t_names|
- TypeNum.const_set(c_name, id)
- t_names.each{|t_name| t_name.freeze; TYPE_NAME_TBL[t_name] = id }
- TYPE_ID_TBL[id] = t_names
- TYPE_GROUP_TBL[id] = g_flag
- }
-
- TYPE_NAME_TBL.freeze
- TYPE_ID_TBL.freeze
-
- def self.type_id(name)
- TYPE_NAME_TBL[name.to_s]
- end
-
- def self.type_name(id)
- TYPE_ID_TBL[id] && TYPE_ID_TBL[id][0]
- end
-
- def self.group_flag(id)
- TYPE_GROUP_TBL[id] || 0
- end
-
- #############################################
-
- module StateMask
- ShiftMask = (1<<0)
- LockMask = (1<<1)
- ControlMask = (1<<2)
- Mod1Mask = (1<<3)
- Mod2Mask = (1<<4)
- Mod3Mask = (1<<5)
- Mod4Mask = (1<<6)
- Mod5Mask = (1<<7)
- Button1Mask = (1<<8)
- Button2Mask = (1<<9)
- Button3Mask = (1<<10)
- Button4Mask = (1<<11)
- Button5Mask = (1<<12)
-
- AnyModifier = (1<<15)
-
- META_MASK = (AnyModifier<<1)
- ALT_MASK = (AnyModifier<<2)
- EXTENDED_MASK = (AnyModifier<<3)
-
- CommandMask = Mod1Mask
- OptionMask = Mod2Mask
- end
-
- #############################################
-
- FIELD_FLAG = {
- # key => flag
- 'above' => Grp::CONFIG,
- 'borderwidth' => (Grp::CREATE|Grp::CONFIG),
- 'button' => Grp::BUTTON,
- 'count' => Grp::EXPOSE,
- 'data' => Grp::VIRTUAL,
- 'delta' => Grp::MWHEEL,
- 'detail' => (Grp::FOCUS|Grp::CROSSING),
- 'focus' => Grp::CROSSING,
- 'height' => (Grp::EXPOSE|Grp::CONFIG),
- 'keycode' => Grp::KEY,
- 'keysym' => Grp::KEY,
- 'mode' => (Grp::CROSSING|Grp::FOCUS),
- 'override' => (Grp::CREATE|Grp::MAP|Grp::REPARENT|Grp::CONFIG),
- 'place' => Grp::CIRC,
- 'root' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
- 'rootx' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
- 'rooty' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
- 'sendevent' => Grp::ALL,
- 'serial' => Grp::ALL,
- 'state' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|
- Grp::CROSSING|Grp::VISIBILITY),
- 'subwindow' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
- 'time' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING|
- Grp::PROP),
- 'warp' => Grp::KEY_BUTTON_MOTION_VIRTUAL,
- 'width' => (Grp::EXPOSE|Grp::CREATE|Grp::CONFIG),
- 'window' => (Grp::CREATE|Grp::UNMAP|Grp::MAP|Grp::REPARENT|
- Grp::CONFIG|Grp::GRAVITY|Grp::CIRC),
- 'when' => Grp::ALL,
- 'x' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING|
- Grp::EXPOSE|Grp::CREATE|Grp::CONFIG|Grp::GRAVITY|
- Grp::REPARENT),
- 'y' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING|
- Grp::EXPOSE|Grp::CREATE|Grp::CONFIG|Grp::GRAVITY|
- Grp::REPARENT),
- }
-
- FIELD_OPERATION = {
- 'root' => proc{|val|
- begin
- Tk.tk_call_without_enc('winfo', 'pathname', val)
- val
- rescue
- nil
- end
- },
-
- 'subwindow' => proc{|val|
- begin
- Tk.tk_call_without_enc('winfo', 'pathname', val)
- val
- rescue
- nil
- end
- },
-
- 'window' => proc{|val| nil}
- }
-
- #-------------------------------------------
-
- def valid_fields(group_flag=nil)
- group_flag = self.class.group_flag(self.type) unless group_flag
-
- fields = {}
- FIELD_FLAG.each{|key, flag|
- next if (flag & group_flag) == 0
- begin
- val = self.__send__(key)
- rescue
- next
- end
- next if !val || val == '??'
- fields[key] = val
- }
-
- fields
- end
-
- def valid_for_generate(group_flag=nil)
- fields = valid_fields(group_flag)
-
- FIELD_OPERATION.each{|key, cmd|
- next unless fields.has_key?(key)
- val = FIELD_OPERATION[key].call(fields[key])
- if val
- fields[key] = val
- else
- fields.delete(key)
- end
- }
-
- fields
- end
-
- def generate(win, modkeys={})
- klass = self.class
-
- if modkeys.has_key?(:type) || modkeys.has_key?('type')
- modkeys = TkComm._symbolkey2str(modkeys)
- type_id = modkeys.delete('type')
- else
- type_id = self.type
- end
-
- type_name = klass.type_name(type_id)
- unless type_name
- fail RuntimeError, "type_id #{type_id} is invalid"
- end
-
- group_flag = klass.group_flag(type_id)
-
- opts = valid_for_generate(group_flag)
-
- modkeys.each{|key, val|
- if val
- opts[key.to_s] = val
- else
- opts.delete(key.to_s)
- end
- }
-
- if group_flag != Grp::KEY
- Tk.event_generate(win, type_name, opts)
- else
- # If type is KEY event, focus should be set to target widget.
- # If not set, original widget will get the same event.
- # That will make infinite loop.
- w = Tk.tk_call_without_enc('focus')
- begin
- Tk.tk_call_without_enc('focus', win)
- Tk.event_generate(win, type_name, opts)
- ensure
- Tk.tk_call_without_enc('focus', w)
- end
- end
- end
-
- #############################################
-
# [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
KEY_TBL = [
[ ?#, ?n, :serial ],
@@ -316,7 +75,6 @@ module TkEvent
[ ?E, ?b, :send_event ],
[ ?K, ?s, :keysym ],
[ ?N, ?n, :keysym_num ],
- [ ?P, ?s, :property ],
[ ?R, ?s, :rootwin_id ],
[ ?S, ?s, :subwindow ],
[ ?T, ?n, :type ],
@@ -372,7 +130,6 @@ module TkEvent
# []
#end
-=begin
alias button num
alias delta wheel_delta
alias root rootwin_id
@@ -381,21 +138,6 @@ module TkEvent
alias rooty y_root
alias root_y y_root
alias sendevent send_event
-=end
- ALIAS_TBL = {
- :button => :num,
- :data => :detail,
- :delta => :wheel_delta,
- :root => :rootwin_id,
- :rootx => :x_root,
- :root_x => :x_root,
- :rooty => :y_root,
- :root_y => :y_root,
- :sendevent => :send_event,
- :window => :widget
- }
-
- _define_attribute_aliases(ALIAS_TBL)
end
@@ -416,18 +158,10 @@ module TkEvent
id = install_cmd(proc{|*arg|
ex_args = []
extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- begin
- TkUtil.eval_cmd(cmd, *(ex_args.concat(klass.scan_args(keys, arg))))
- rescue Exception=>e
- if TkCore::INTERP.kind_of?(TclTkIp)
- fail e
- else
- # MultiTkIp
- fail Exception, "#{e.class}: #{e.message.dup}"
- end
- end
+ TkUtil.eval_cmd(cmd, *(ex_args.concat(klass.scan_args(keys, arg))))
})
end
+ id + ' ' + args
else
keys, args = klass._get_all_subst_keys
@@ -439,46 +173,11 @@ module TkEvent
id = install_cmd(proc{|*arg|
ex_args = []
extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- begin
- TkUtil.eval_cmd(cmd, *(ex_args << klass.new(*klass.scan_args(keys, arg))))
- rescue Exception=>e
- if TkCore::INTERP.kind_of?(TclTkIp)
- fail e
- else
- # MultiTkIp
- fail Exception, "#{e.class}: #{e.message.dup}"
- end
- end
+ TkUtil.eval_cmd(cmd,
+ *(ex_args << klass.new(*klass.scan_args(keys, arg))))
})
end
- end
-
- if TkCore::INTERP.kind_of?(TclTkIp)
id + ' ' + args
- else
- # MultiTkIp
- "if {[set st [catch {#{id} #{args}} ret]] != 0} {
- if {$st == 4} {
- return -code continue $ret
- } elseif {$st == 3} {
- return -code break $ret
- } elseif {$st == 2} {
- return -code return $ret
- } elseif {[regexp {^Exception: (TkCallbackContinue: .*)$} \
- $ret m msg]} {
- return -code continue $msg
- } elseif {[regexp {^Exception: (TkCallbackBreak: .*)$} $ret m msg]} {
- return -code break $msg
- } elseif {[regexp {^Exception: (TkCallbackReturn: .*)$} $ret m msg]} {
- return -code return $msg
- } elseif {[regexp {^Exception: (\\S+: .*)$} $ret m msg]} {
- return -code return $msg
- } else {
- return -code error $ret
- }
- } else {
- set ret
- }"
end
end
diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb
index de02d4957c..790537ef8d 100644
--- a/ext/tk/lib/tk/font.rb
+++ b/ext/tk/lib/tk/font.rb
@@ -163,96 +163,14 @@ class TkFont
###################################
# class methods
###################################
- def TkFont.actual(fnt, option=nil)
- fnt = '{}' if fnt == ''
- if fnt.kind_of?(TkFont)
- fnt.actual(option)
- else
- actual_core(fnt, nil, option)
- end
- end
-
- def TkFont.actual_displayof(fnt, win, option=nil)
- fnt = '{}' if fnt == ''
- if fnt.kind_of?(TkFont)
- fnt.actual_displayof(win, option)
- else
- win = '.' unless win
- actual_core(fnt, win, option)
- end
- end
-
- def TkFont.configure(fnt, slot, value=None)
- if fnt.kind_of?(TkFont)
- fnt.configure(fnt, slot, value)
- else
- configure_core(fnt, slot, value)
- end
- fnt
- end
-
- def TkFont.configinfo(fnt, slot=nil)
- if fnt.kind_of?(TkFont)
- fnt.configinfo(fnt, slot)
- else
- configinfo_core(fnt, slot)
- end
- end
-
- def TkFont.current_configinfo(fnt, slot=nil)
- if fnt.kind_of?(TkFont)
- fnt.current_configinfo(fnt, slot)
- else
- current_configinfo_core(fnt, slot)
- end
- end
-
- def TkFont.measure(fnt, text)
- fnt = '{}' if fnt == ''
- if fnt.kind_of?(TkFont)
- fnt.measure(text)
- else
- measure_core(fnt, nil, text)
- end
- end
-
- def TkFont.measure_displayof(fnt, win, text)
- fnt = '{}' if fnt == ''
- if fnt.kind_of?(TkFont)
- fnt.measure_displayof(win, text)
- else
- win = '.' unless win
- measure_core(fnt, win, text)
- end
- end
-
- def TkFont.metrics(fnt, option=nil)
- fnt = '{}' if fnt == ''
- if fnt.kind_of?(TkFont)
- fnt.metrics(option)
- else
- metrics_core(fnt, nil, option)
- end
- end
-
- def TkFont.metrics_displayof(fnt, win, option=nil)
- fnt = '{}' if fnt == ''
- if fnt.kind_of?(TkFont)
- font.metrics_displayof(win, option=nil)
- else
- win = '.' unless win
- metrics_core(fnt, win, option)
- end
- end
-
- def TkFont.families(win=nil)
+ def TkFont.families(window=nil)
case (Tk::TK_VERSION)
when /^4\.*/
['fixed']
when /^8\.*/
- if win
- tk_split_simplelist(tk_call('font', 'families', '-displayof', win))
+ if window
+ tk_split_simplelist(tk_call('font', 'families', '-displayof', window))
else
tk_split_simplelist(tk_call('font', 'families'))
end
@@ -344,17 +262,13 @@ class TkFont
fnt = nil if fnt == [] || fnt == ""
unless fnt
- # create dummy
- # TkFont.new(nil, nil).call_font_configure([path, key], *args)
- dummy_fnt = TkFont.allocate
- dummy_fnt.instance_eval{ init_dummy_fontobj() }
- dummy_fnt
+ TkFont.new(nil, nil).call_font_configure([path, key], *args)
else
begin
compound = tk_split_simplelist(
Hash[*tk_split_simplelist(tk_call('font', 'configure',
- fnt))].collect{|k,v|
- [k[1..-1], v]
+ fnt))].collect{|key,value|
+ [key[1..-1], value]
}.assoc('compound')[1])
rescue
compound = []
@@ -391,51 +305,7 @@ class TkFont
###################################
private
###################################
- def init_dummy_fontobj
- @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
- Tk_FontID[1].succ!
- Tk_FontNameTBL[@id] = self
-
- @latin_desscendant = nil
- @kanji_desscendant = nil
-
- case (Tk::TK_VERSION)
- when /^4\.*/
- @latinfont = ""
- @kanjifont = ""
- if JAPANIZED_TK
- @compoundfont = [[@latinfont], [@kanjifont]]
- @fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
- else
- @compoundfont = @latinfont
- @fontslot = {'font'=>@latinfont}
- end
- else
- @latinfont = @id + 'l'
- @kanjifont = @id + 'k'
- @compoundfont = @id + 'c'
-
- if JAPANIZED_TK
- tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
- tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont])
- else
- tk_call('font', 'create', @latinfont)
- tk_call('font', 'create', @kanjifont)
- tk_call('font', 'create', @compoundfont)
- end
-
- @fontslot = {'font'=>@compoundfont}
- end
-
- self
- end
-
def initialize(ltn=nil, knj=nil, keys=nil)
- ltn = '{}' if ltn == ''
- knj = '{}' if knj == ''
-
# @id = Tk_FontID.join('')
@id = Tk_FontID.join(TkCore::INTERP._ip_id_)
Tk_FontID[1].succ!
@@ -488,19 +358,6 @@ class TkFont
create_compoundfont(ltn, knj, keys)
end
- def initialize_copy(font)
- unless font.kind_of?(TkFont)
- fail TypeError, '"initialize_copy should take same class object'
- end
- if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
- keys = {}
- font.configinfo.each{|key,value| keys[key] = value }
- initialize(font.latin_font_id, font.kanji_font_id, keys)
- else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
- initialize(font.latin_font_id, font.kanji_font_id, font.configinfo)
- end
- end
-
def _get_font_info_from_hash(font)
font = _symbolkey2str(font)
foundry = (info = font['foundry'] .to_s)? info: '*'
@@ -724,17 +581,10 @@ class TkFont
end
def create_compoundfont_tk8x(ltn, knj, keys)
- if knj
- create_latinfont(ltn)
- create_kanjifont(knj)
- else
- cfnt = ltn
- create_kanjifont(cfnt)
- create_latinfont(cfnt)
- end
+ create_latinfont(ltn)
+ create_kanjifont(knj)
@compoundfont = @id + 'c'
-
if JAPANIZED_TK
unless keys
keys = {}
@@ -809,7 +659,6 @@ class TkFont
end
if knj
- compoundkeys = nil
kanjikeys = {}
begin
actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
@@ -821,404 +670,17 @@ class TkFont
end
end
- if cfnt
- if cfnt.kind_of?(Hash)
- compoundkeys = cfnt.dup
- else
- compoundkeys = {}
- actual_core(cfnt).each{|key,val| compoundkeys[key] = val}
- end
- compoundkeys.update(_symbolkey2str(keys))
- keys = compoundkeys
- end
-
@fontslot = {'font'=>@compoundfont}
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
end
end
- ###################################
- public
- ###################################
- def inspect
- sprintf("#<%s:%0x:%s>", self.class.inspect, self.__id__, @compoundfont)
- end
-
- def method_missing(id, *args)
- name = id.id2name
- case args.length
- when 1
- if name[-1] == ?=
- configure name[0..-2], args[0]
- args[0]
- else
- configure name, args[0]
- self
- end
- when 0
- begin
- configinfo name
- rescue
- super(id, *args)
-# fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
- end
- else
- super(id, *args)
-# fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
- end
- end
-
- def call_font_configure(path, *args)
- if path.kind_of?(Array)
- # [path, optkey]
- win, tag = path[0].split(';')
- optkey = path[1].to_s
- else
- win, tag, optkey = path.split(';')
- end
-
- fontslot = _symbolkey2str(@fontslot)
- if optkey && optkey != ""
- ltn = fontslot.delete('font')
- knj = fontslot.delete('kanjifont')
- fontslot[optkey] = ltn if ltn
- fontslot["kanji#{optkey}"] = knj if knj
- end
-
- keys = _symbolkey2str(args.pop).update(fontslot)
- args.concat(hash_kv(keys))
- tk_call(*args)
- Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
- self
- end
-
- def used
- ret = []
- Tk_FontUseTBL.each{|key,value|
- next unless self == value
- if key.include?(';')
- win, tag, optkey = key.split(';')
- winobj = tk_tcl2ruby(win)
- if winobj.kind_of? TkText
- if optkey
- ret.push([winobj, winobj.tagid2obj(tag), optkey])
- else
- ret.push([winobj, winobj.tagid2obj(tag)])
- end
- elsif winobj.kind_of? TkCanvas
- if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
- if optkey
- ret.push([winobj, tagobj, optkey])
- else
- ret.push([winobj, tagobj])
- end
- elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
- if optkey
- ret.push([winobj, tagobj, optkey])
- else
- ret.push([winobj, tagobj])
- end
- else
- if optkey
- ret.push([winobj, tag, optkey])
- else
- ret.push([winobj, tag])
- end
- end
- elsif winobj.kind_of? TkMenu
- if optkey
- ret.push([winobj, tag, optkey])
- else
- ret.push([winobj, tag])
- end
- else
- if optkey
- ret.push([win, tag, optkey])
- else
- ret.push([win, tag])
- end
- end
- else
- ret.push(tk_tcl2ruby(key))
- end
- }
- ret
- end
-
- def id
- @id
- end
-
- def to_eval
- font
- end
-
- def font
- @compoundfont
- end
- alias font_id font
-
- def latin_font_id
- @latinfont
- end
-
- def latin_font
- # @latinfont
- if @latin_descendant
- @latin_descendant
- else
- @latin_descendant = DescendantFont.new(self, 'latin')
- end
- end
- alias latinfont latin_font
-
- def kanji_font_id
- @kanjifont
- end
-
- def kanji_font
- # @kanjifont
- if @kanji_descendant
- @kanji_descendant
- else
- @kanji_descendant = DescendantFont.new(self, 'kanji')
- end
- end
- alias kanjifont kanji_font
-
- def actual(option=nil)
- actual_core(@compoundfont, nil, option)
- end
-
- def actual_displayof(win, option=nil)
- win = '.' unless win
- actual_core(@compoundfont, win, option)
- end
-
- def latin_actual(option=nil)
- actual_core(@latinfont, nil, option)
- end
-
- def latin_actual_displayof(win, option=nil)
- win = '.' unless win
- actual_core(@latinfont, win, option)
- end
-
- def kanji_actual(option=nil)
- #if JAPANIZED_TK
- if @kanjifont != ""
- actual_core(@kanjifont, nil, option)
- else
- actual_core_tk4x(nil, nil, option)
- end
- end
-
- def kanji_actual_displayof(win, option=nil)
- #if JAPANIZED_TK
- if @kanjifont != ""
- win = '.' unless win
- actual_core(@kanjifont, win, option)
- else
- actual_core_tk4x(nil, win, option)
- end
- end
-
- def [](slot)
- configinfo slot
- end
-
- def []=(slot, val)
- configure slot, val
- val
- end
-
- def configure(slot, value=None)
- configure_core(@compoundfont, slot, value)
- self
- end
-
- def configinfo(slot=nil)
- configinfo_core(@compoundfont, slot)
- end
-
- def current_configinfo(slot=nil)
- current_configinfo_core(@compoundfont, slot)
- end
-
- def delete
- delete_core
- end
-
- def latin_configure(slot, value=None)
- if JAPANIZED_TK
- configure_core(@latinfont, slot, value)
- else
- configure(slot, value)
- end
- self
- end
-
- def latin_configinfo(slot=nil)
- if JAPANIZED_TK
- configinfo_core(@latinfont, slot)
- else
- configinfo(slot)
- end
- end
-
- def kanji_configure(slot, value=None)
- #if JAPANIZED_TK
- if @kanjifont != ""
- configure_core(@kanjifont, slot, value)
- configure('size'=>configinfo('size')) # to reflect new configuration
- else
- #""
- configure(slot, value)
- end
- self
- end
-
- def kanji_configinfo(slot=nil)
- #if JAPANIZED_TK
- if @kanjifont != ""
- configinfo_core(@kanjifont, slot)
- else
- #[]
- configinfo(slot)
- end
- end
-
- def replace(ltn, knj=None)
- knj = ltn if knj == None
- latin_replace(ltn)
- kanji_replace(knj)
- self
- end
-
- def latin_replace(ltn)
- latin_replace_core(ltn)
- reset_pointadjust
- self
- end
-
- def kanji_replace(knj)
- kanji_replace_core(knj)
- reset_pointadjust
- self
- end
-
- def measure(text)
- measure_core(@compoundfont, nil, text)
- end
-
- def measure_displayof(win, text)
- win = '.' unless win
- measure_core(@compoundfont, win, text)
- end
-
- def metrics(option=nil)
- metrics_core(@compoundfont, nil, option)
- end
-
- def metrics_displayof(win, option=nil)
- win = '.' unless win
- metrics_core(@compoundfont, win, option)
- end
-
- def latin_metrics(option=nil)
- metrics_core(@latinfont, nil, option)
- end
-
- def latin_metrics_displayof(win, option=nil)
- win = '.' unless win
- metrics_core(@latinfont, win, option)
- end
-
- def kanji_metrics(option=nil)
- if JAPANIZED_TK
- metrics_core(@kanjifont, nil, option)
- else
- metrics_core_tk4x(nil, nil, option)
- end
- end
-
- def kanji_metrics_displayof(win, option=nil)
- if JAPANIZED_TK
- win = '.' unless win
- metrics_core(@kanjifont, win, option)
- else
- metrics_core_tk4x(nil, win, option)
- end
- end
-
- def reset_pointadjust
- begin
- if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
- configure('pointadjust' => latin_actual.assoc('size')[1].to_f /
- kanji_actual.assoc('size')[1].to_f )
- end
- rescue
- end
- self
- end
-
- ###################################
- # private alias
- ###################################
- case (Tk::TK_VERSION)
- when /^4\.*/
- alias create_latinfont create_latinfont_tk4x
- alias create_kanjifont create_kanjifont_tk4x
- alias create_compoundfont create_compoundfont_tk4x
-
- when /^8\.[0-5]/
- alias create_latinfont create_latinfont_tk8x
- alias create_kanjifont create_kanjifont_tk8x
- alias create_compoundfont create_compoundfont_tk8x
-
- else
- alias create_latinfont create_latinfont_tk8x
- alias create_kanjifont create_kanjifont_tk8x
- alias create_compoundfont create_compoundfont_tk8x
-
- end
-
- ###################################
- # public alias
- ###################################
- alias ascii_font latin_font
- alias asciifont latinfont
- alias create_asciifont create_latinfont
- alias ascii_actual latin_actual
- alias ascii_actual_displayof latin_actual_displayof
- alias ascii_configure latin_configure
- alias ascii_configinfo latin_configinfo
- alias ascii_replace latin_replace
- alias ascii_metrics latin_metrics
-
- ###################################
-=begin
- def dup
- TkFont.new(self)
- end
- def clone
- TkFont.new(self)
- end
-=end
-end
-
-module TkFont::CoreMethods
- include Tk
- extend TkCore
-
- private
-
- def actual_core_tk4x(font, win=nil, option=nil)
+ def actual_core_tk4x(font, window=nil, option=nil)
# dummy
if option == 'pointadjust' || option == :pointadjust
1.0
elsif option
- case TkFont::OptionType[option.to_s]
+ case OptionType[option.to_s]
when ?n
0
when ?b
@@ -1233,19 +695,17 @@ module TkFont::CoreMethods
end
end
- def actual_core_tk8x(font, win=nil, option=nil)
- font = '{}' if font == ''
-
+ def actual_core_tk8x(font, window=nil, option=nil)
if option == 'compound' || option == :compound
""
elsif option
- if win
+ if window
val = tk_call('font', 'actual', font,
- "-displayof", win, "-#{option}")
+ "-displayof", window, "-#{option}")
else
val = tk_call('font', 'actual', font, "-#{option}")
end
- case TkFont::OptionType[option.to_s]
+ case OptionType[option.to_s]
when ?n
num_or_str(val)
when ?b
@@ -1254,9 +714,9 @@ module TkFont::CoreMethods
val
end
else
- l = tk_split_simplelist(if win
+ l = tk_split_simplelist(if window
tk_call('font', 'actual', font,
- "-displayof", win)
+ "-displayof", window)
else
tk_call('font', 'actual', font)
end)
@@ -1267,7 +727,7 @@ module TkFont::CoreMethods
else
key = key[1..-1]
val = l.shift
- case TkFont::OptionType[key]
+ case OptionType[key]
when ?n
r.push [key, num_or_str(val)]
when ?b
@@ -1292,7 +752,7 @@ module TkFont::CoreMethods
if option == 'pointadjust' || option == :pointadjust
1.0
elsif option
- case TkFont::OptionType[option.to_s]
+ case OptionType[option.to_s]
when ?n
0
when ?b
@@ -1312,7 +772,7 @@ module TkFont::CoreMethods
def current_configinfo_core_tk4x(font, option=nil)
if option
- case TkFont::OptionType[option.to_s]
+ case OptionType[option.to_s]
when ?n
0
when ?b
@@ -1400,7 +860,7 @@ module TkFont::CoreMethods
""
elsif option
val = tk_call('font', 'configure', font, "-#{option}")
- case TkFont::OptionType[option.to_s]
+ case OptionType[option.to_s]
when ?n
num_or_str(val)
when ?b
@@ -1417,7 +877,7 @@ module TkFont::CoreMethods
else
key = key[1..-1]
val = l.shift
- case TkFont::OptionType[key]
+ case OptionType[key]
when ?n
r.push [key, num_or_str(val)]
when ?b
@@ -1439,7 +899,7 @@ module TkFont::CoreMethods
""
elsif option
val = tk_call('font', 'configure', font, "-#{option}")
- case TkFont::OptionType[option.to_s]
+ case OptionType[option.to_s]
when ?n
num_or_str(val)
when ?b
@@ -1456,7 +916,7 @@ module TkFont::CoreMethods
else
key = key[1..-1]
val = l.shift
- case TkFont::OptionType[key]
+ case OptionType[key]
when ?n
r.push [key, num_or_str(val)]
when ?b
@@ -1471,8 +931,8 @@ module TkFont::CoreMethods
end
def delete_core_tk4x
- TkFont::Tk_FontNameTBL.delete(@id)
- TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
+ Tk_FontNameTBL.delete(@id)
+ Tk_FontUseTBL.delete_if{|key,value| value == self}
end
def delete_core_tk8x
@@ -1488,15 +948,15 @@ module TkFont::CoreMethods
tk_call('font', 'delete', @compoundfont)
rescue
end
- TkFont::Tk_FontNameTBL.delete(@id)
- TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
+ Tk_FontNameTBL.delete(@id)
+ Tk_FontUseTBL.delete_if{|key,value| value == self}
end
def latin_replace_core_tk4x(ltn)
create_latinfont_tk4x(ltn)
@compoundfont[0] = [@latinfont] if JAPANIZED_TK
@fontslot['font'] = @latinfont
- TkFont::Tk_FontUseTBL.dup.each{|w, fobj|
+ Tk_FontUseTBL.dup.each{|w, fobj|
if self == fobj
begin
if w.include?(';')
@@ -1518,7 +978,7 @@ module TkFont::CoreMethods
tk_call(w, 'configure', '-font', @latinfont)
end
rescue
- TkFont::Tk_FontUseTBL.delete(w)
+ Tk_FontUseTBL.delete(w)
end
end
}
@@ -1531,7 +991,7 @@ module TkFont::CoreMethods
create_kanjifont_tk4x(knj)
@compoundfont[1] = [@kanjifont]
@fontslot['kanjifont'] = @kanjifont
- TkFont::Tk_FontUseTBL.dup.each{|w, fobj|
+ Tk_FontUseTBL.dup.each{|w, fobj|
if self == fobj
begin
if w.include?(';')
@@ -1553,7 +1013,7 @@ module TkFont::CoreMethods
tk_call(w, 'configure', '-kanjifont', @kanjifont)
end
rescue
- TkFont::Tk_FontUseTBL.delete(w)
+ Tk_FontUseTBL.delete(w)
end
end
}
@@ -1561,8 +1021,6 @@ module TkFont::CoreMethods
end
def latin_replace_core_tk8x(ltn)
- ltn = '{}' if ltn == ''
-
if JAPANIZED_TK
begin
tk_call('font', 'delete', '@font_tmp')
@@ -1572,7 +1030,7 @@ module TkFont::CoreMethods
fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @latinfont)
rescue
#fnt_bup = ''
- fnt_bup = TkFont::DEFAULT_LATIN_FONT_NAME
+ fnt_bup = DEFAULT_LATIN_FONT_NAME
end
end
@@ -1626,8 +1084,6 @@ module TkFont::CoreMethods
end
def kanji_replace_core_tk8x(knj)
- knj = '{}' if knj == ''
-
if JAPANIZED_TK
begin
tk_call('font', 'delete', '@font_tmp')
@@ -1637,7 +1093,7 @@ module TkFont::CoreMethods
fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @kanjifont)
rescue
#fnt_bup = ''
- fnt_bup = TkFont::DEFAULT_KANJI_FONT_NAME
+ fnt_bup = DEFAULT_KANJI_FONT_NAME
end
end
@@ -1668,22 +1124,20 @@ module TkFont::CoreMethods
self
end
- def measure_core_tk4x(font, win, text)
+ def measure_core_tk4x(window, text)
0
end
- def measure_core_tk8x(font, win, text)
- font = '{}' if font == ''
-
- if win
- number(tk_call('font', 'measure', font,
- '-displayof', win, text))
+ def measure_core_tk8x(window, text)
+ if window
+ number(tk_call('font', 'measure', @compoundfont,
+ '-displayof', window, text))
else
- number(tk_call('font', 'measure', font, text))
+ number(tk_call('font', 'measure', @compoundfont, text))
end
end
- def metrics_core_tk4x(font, win, option=nil)
+ def metrics_core_tk4x(font, window, option=nil)
# dummy
if option
""
@@ -1692,19 +1146,17 @@ module TkFont::CoreMethods
end
end
- def metrics_core_tk8x(font, win, option=nil)
- font = '{}' if font == ''
-
+ def metrics_core_tk8x(font, window, option=nil)
if option
- if win
+ if window
number(tk_call('font', 'metrics', font,
- "-displayof", win, "-#{option}"))
+ "-displayof", window, "-#{option}"))
else
number(tk_call('font', 'metrics', font, "-#{option}"))
end
else
- l = tk_split_list(if win
- tk_call('font','metrics',font,"-displayof",win)
+ l = tk_split_list(if window
+ tk_call('font','metrics',font,"-displayof",window)
else
tk_call('font','metrics',font)
end)
@@ -1721,6 +1173,9 @@ module TkFont::CoreMethods
###################################
case (Tk::TK_VERSION)
when /^4\.*/
+ alias create_latinfont create_latinfont_tk4x
+ alias create_kanjifont create_kanjifont_tk4x
+ alias create_compoundfont create_compoundfont_tk4x
alias actual_core actual_core_tk4x
alias configure_core configure_core_tk4x
alias configinfo_core configinfo_core_tk4x
@@ -1732,6 +1187,9 @@ module TkFont::CoreMethods
alias metrics_core metrics_core_tk4x
when /^8\.[0-5]/
+ alias create_latinfont create_latinfont_tk8x
+ alias create_kanjifont create_kanjifont_tk8x
+ alias create_compoundfont create_compoundfont_tk8x
alias actual_core actual_core_tk8x
alias configure_core configure_core_tk8x
alias configinfo_core configinfo_core_tk8x
@@ -1743,6 +1201,9 @@ module TkFont::CoreMethods
alias metrics_core metrics_core_tk8x
else
+ alias create_latinfont create_latinfont_tk8x
+ alias create_kanjifont create_kanjifont_tk8x
+ alias create_compoundfont create_compoundfont_tk8x
alias actual_core actual_core_tk8x
alias configure_core configure_core_tk8x
alias configinfo_core configinfo_core_tk8x
@@ -1754,9 +1215,344 @@ module TkFont::CoreMethods
alias metrics_core metrics_core_tk8x
end
-end
-class TkFont
- include TkFont::CoreMethods
- extend TkFont::CoreMethods
+ ###################################
+ public
+ ###################################
+ def method_missing(id, *args)
+ name = id.id2name
+ case args.length
+ when 1
+ configure name, args[0]
+ when 0
+ begin
+ configinfo name
+ rescue
+ fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
+ end
+ else
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+ end
+ end
+
+ def call_font_configure(path, *args)
+ if path.kind_of?(Array)
+ # [path, optkey]
+ win, tag = path[0].split(';')
+ optkey = path[1].to_s
+ else
+ win, tag, optkey = path.split(';')
+ end
+
+ fontslot = _symbolkey2str(@fontslot)
+ if optkey && optkey != ""
+ ltn = fontslot.delete('font')
+ knj = fontslot.delete('kanjifont')
+ fontslot[optkey] = ltn if ltn
+ fontslot["kanji#{optkey}"] = knj if knj
+ end
+
+ keys = _symbolkey2str(args.pop).update(fontslot)
+ args.concat(hash_kv(keys))
+ tk_call(*args)
+ Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
+ self
+ end
+
+ def used
+ ret = []
+ Tk_FontUseTBL.each{|key,value|
+ next unless self == value
+ if key.include?(';')
+ win, tag, optkey = key.split(';')
+ winobj = tk_tcl2ruby(win)
+ if winobj.kind_of? TkText
+ if optkey
+ ret.push([winobj, winobj.tagid2obj(tag), optkey])
+ else
+ ret.push([winobj, winobj.tagid2obj(tag)])
+ end
+ elsif winobj.kind_of? TkCanvas
+ if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
+ if optkey
+ ret.push([winobj, tagobj, optkey])
+ else
+ ret.push([winobj, tagobj])
+ end
+ elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
+ if optkey
+ ret.push([winobj, tagobj, optkey])
+ else
+ ret.push([winobj, tagobj])
+ end
+ else
+ if optkey
+ ret.push([winobj, tag, optkey])
+ else
+ ret.push([winobj, tag])
+ end
+ end
+ elsif winobj.kind_of? TkMenu
+ if optkey
+ ret.push([winobj, tag, optkey])
+ else
+ ret.push([winobj, tag])
+ end
+ else
+ if optkey
+ ret.push([win, tag, optkey])
+ else
+ ret.push([win, tag])
+ end
+ end
+ else
+ ret.push(tk_tcl2ruby(key))
+ end
+ }
+ ret
+ end
+
+ def id
+ @id
+ end
+
+ def to_eval
+ font
+ end
+
+ def font
+ @compoundfont
+ end
+ alias font_id font
+
+ def latin_font_id
+ @latinfont
+ end
+
+ def latin_font
+ # @latinfont
+ if @latin_descendant
+ @latin_descendant
+ else
+ @latin_descendant = DescendantFont.new(self, 'latin')
+ end
+ end
+ alias latinfont latin_font
+
+ def kanji_font_id
+ @kanjifont
+ end
+
+ def kanji_font
+ # @kanjifont
+ if @kanji_descendant
+ @kanji_descendant
+ else
+ @kanji_descendant = DescendantFont.new(self, 'kanji')
+ end
+ end
+ alias kanjifont kanji_font
+
+ def actual(option=nil)
+ actual_core(@compoundfont, nil, option)
+ end
+
+ def actual_displayof(window, option=nil)
+ window = '.' unless window
+ actual_core(@compoundfont, window, option)
+ end
+
+ def latin_actual(option=nil)
+ actual_core(@latinfont, nil, option)
+ end
+
+ def latin_actual_displayof(window, option=nil)
+ window = '.' unless window
+ actual_core(@latinfont, window, option)
+ end
+
+ def kanji_actual(option=nil)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ actual_core(@kanjifont, nil, option)
+ else
+ actual_core_tk4x(nil, nil, option)
+ end
+ end
+
+ def kanji_actual_displayof(window, option=nil)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ window = '.' unless window
+ actual_core(@kanjifont, window, option)
+ else
+ actual_core_tk4x(nil, window, option)
+ end
+ end
+
+ def [](slot)
+ configinfo slot
+ end
+
+ def []=(slot, val)
+ configure slot, val
+ val
+ end
+
+ def configure(slot, value=None)
+ configure_core(@compoundfont, slot, value)
+ self
+ end
+
+ def configinfo(slot=nil)
+ configinfo_core(@compoundfont, slot)
+ end
+
+ def current_configinfo(slot=nil)
+ current_configinfo_core(@compoundfont, slot)
+ end
+
+ def delete
+ delete_core
+ end
+
+ def latin_configure(slot, value=None)
+ if JAPANIZED_TK
+ configure_core(@latinfont, slot, value)
+ else
+ configure(slot, value)
+ end
+ self
+ end
+
+ def latin_configinfo(slot=nil)
+ if JAPANIZED_TK
+ configinfo_core(@latinfont, slot)
+ else
+ configinfo(slot)
+ end
+ end
+
+ def kanji_configure(slot, value=None)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ configure_core(@kanjifont, slot, value)
+ configure('size'=>configinfo('size')) # to reflect new configuration
+ else
+ #""
+ configure(slot, value)
+ end
+ self
+ end
+
+ def kanji_configinfo(slot=nil)
+ #if JAPANIZED_TK
+ if @kanjifont != ""
+ configinfo_core(@kanjifont, slot)
+ else
+ #[]
+ configinfo(slot)
+ end
+ end
+
+ def replace(ltn, knj=None)
+ knj = ltn if knj == None
+ latin_replace(ltn)
+ kanji_replace(knj)
+ self
+ end
+
+ def latin_replace(ltn)
+ latin_replace_core(ltn)
+ reset_pointadjust
+ self
+ end
+
+ def kanji_replace(knj)
+ kanji_replace_core(knj)
+ reset_pointadjust
+ self
+ end
+
+ def measure(text)
+ measure_core(nil, text)
+ end
+
+ def measure_displayof(window, text)
+ window = '.' unless window
+ measure_core(window, text)
+ end
+
+ def metrics(option=nil)
+ metrics_core(@compoundfont, nil, option)
+ end
+
+ def metrics_displayof(window, option=nil)
+ window = '.' unless window
+ metrics_core(@compoundfont, window, option)
+ end
+
+ def latin_metrics(option=nil)
+ metrics_core(@latinfont, nil, option)
+ end
+
+ def latin_metrics_displayof(window, option=nil)
+ window = '.' unless window
+ metrics_core(@latinfont, window, option)
+ end
+
+ def kanji_metrics(option=nil)
+ if JAPANIZED_TK
+ metrics_core(@kanjifont, nil, option)
+ else
+ metrics_core_tk4x(nil, nil, option)
+ end
+ end
+
+ def kanji_metrics_displayof(window, option=nil)
+ if JAPANIZED_TK
+ window = '.' unless window
+ metrics_core(@kanjifont, window, option)
+ else
+ metrics_core_tk4x(nil, window, option)
+ end
+ end
+
+ def reset_pointadjust
+ begin
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ configure('pointadjust' => latin_actual.assoc('size')[1].to_f /
+ kanji_actual.assoc('size')[1].to_f )
+ end
+ rescue
+ end
+ self
+ end
+
+ ###################################
+ # public alias
+ ###################################
+ alias ascii_font latin_font
+ alias asciifont latinfont
+ alias create_asciifont create_latinfont
+ alias ascii_actual latin_actual
+ alias ascii_actual_displayof latin_actual_displayof
+ alias ascii_configure latin_configure
+ alias ascii_configinfo latin_configinfo
+ alias ascii_replace latin_replace
+ alias ascii_metrics latin_metrics
+
+ ###################################
+ def dup
+ src = self
+ obj = super()
+ obj.instance_eval{ initialize(src) }
+ obj
+ end
+ def clone
+ src = self
+ obj = super()
+ obj.instance_eval{ initialize(src) }
+ obj
+ end
end
diff --git a/ext/tk/lib/tk/frame.rb b/ext/tk/lib/tk/frame.rb
index 6636fef5b5..519b9ae8a6 100644
--- a/ext/tk/lib/tk/frame.rb
+++ b/ext/tk/lib/tk/frame.rb
@@ -30,11 +30,6 @@ class TkFrame<TkWindow
# end
#################
- def __boolval_optkeys
- super() << 'container'
- end
- private :__boolval_optkeys
-
def initialize(parent=nil, keys=nil)
my_class_name = nil
if self.class < WidgetClassNames[self.class::WidgetClassName]
diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb
index 10fdf3569b..499101f1bb 100644
--- a/ext/tk/lib/tk/grid.rb
+++ b/ext/tk/lib/tk/grid.rb
@@ -158,13 +158,13 @@ module TkGrid
list(tk_call_without_enc('grid', 'location', master, x, y))
end
- def propagate(master, mode=None)
+ def propagate(master, bool=None)
# master = master.epath if master.kind_of?(TkObject)
master = _epath(master)
- if mode == None
+ if bool == None
bool(tk_call_without_enc('grid', 'propagate', master))
else
- tk_call_without_enc('grid', 'propagate', master, mode)
+ tk_call_without_enc('grid', 'propagate', master, bool)
end
end
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index 35e2c4e394..6eb7b98d6c 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -14,55 +14,11 @@ class TkImage<TkObject
TkCore::INTERP.init_ip_env{ Tk_IMGTBL.clear }
- def self.new(keys=nil)
- if keys.kind_of?(Hash)
- name = nil
- if keys.key?(:imagename)
- name = keys[:imagename]
- elsif keys.key?('imagename')
- name = keys['imagename']
- end
- if name
- if name.kind_of?(TkImage)
- obj = name
- else
- name = _get_eval_string(name)
- obj = Tk_IMGTBL[name]
- end
- if obj
- if !(keys[:without_creating] || keys['without_creating'])
- keys = _symbolkey2str(keys)
- keys.delete('imagename')
- keys.delete('without_creating')
- obj.instance_eval{
- tk_call_without_enc('image', 'create',
- @type, @path, *hash_kv(keys, true))
- }
- end
- return obj
- end
- end
- end
- super(keys)
- end
-
def initialize(keys=nil)
- @path = nil
- without_creating = false
- if keys.kind_of?(Hash)
- keys = _symbolkey2str(keys)
- @path = keys.delete('imagename')
- without_creating = keys.delete('without_creating')
- end
- unless @path
- # @path = Tk_Image_ID.join('')
- @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
- Tk_Image_ID[1].succ!
- end
- unless without_creating
- tk_call_without_enc('image', 'create',
- @type, @path, *hash_kv(keys, true))
- end
+ # @path = Tk_Image_ID.join('')
+ @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
+ Tk_Image_ID[1].succ!
+ tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true))
Tk_IMGTBL[@path] = self
end
@@ -96,14 +52,9 @@ class TkImage<TkObject
end
class TkBitmapImage<TkImage
- def __strval_optkeys
- super() + ['maskdata', 'maskfile']
- end
- private :__strval_optkeys
-
def initialize(*args)
@type = 'bitmap'
- super(*args)
+ super
end
end
@@ -127,7 +78,7 @@ class TkPhotoImage<TkImage
def initialize(*args)
@type = 'photo'
- super(*args)
+ super
end
def blank
@@ -138,9 +89,9 @@ class TkPhotoImage<TkImage
def cget(option)
case option.to_s
when 'data', 'file'
- tk_send 'cget', '-' << option.to_s
+ tk_send 'cget', option
else
- tk_tcl2ruby(tk_send('cget', '-' << option.to_s))
+ tk_tcl2ruby(tk_send('cget', option))
end
end
diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb
index 0b84be38b8..f0f13e63bd 100644
--- a/ext/tk/lib/tk/itemconfig.rb
+++ b/ext/tk/lib/tk/itemconfig.rb
@@ -6,8 +6,6 @@ require 'tkutil'
require 'tk/itemfont.rb'
module TkItemConfigOptkeys
- include TkUtil
-
def __item_numval_optkeys(id)
[]
end
@@ -19,19 +17,13 @@ module TkItemConfigOptkeys
private :__item_numstrval_optkeys
def __item_boolval_optkeys(id)
- ['exportselection', 'jump', 'setgrid', 'takefocus']
+ []
end
private :__item_boolval_optkeys
def __item_strval_optkeys(id)
# maybe need to override
- [
- 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile',
- 'activebackground', 'activeforeground', 'background',
- 'disabledforeground', 'disabledbackground', 'foreground',
- 'highlightbackground', 'highlightcolor', 'insertbackground',
- 'selectbackground', 'selectforeground', 'troughcolor'
- ]
+ ['text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile']
end
private :__item_strval_optkeys
@@ -46,30 +38,7 @@ module TkItemConfigOptkeys
end
private :__item_numlistval_optkeys
- def __item_tkvariable_optkeys(id)
- ['variable', 'textvariable']
- end
- private :__item_tkvariable_optkeys
-
- def __item_val2ruby_optkeys(id) # { key=>method, ... }
- # The method is used to convert a opt-value to a ruby's object.
- # When get the value of the option "key", "method.call(id, val)" is called.
- {}
- end
- private :__item_val2ruby_optkeys
-
- def __item_ruby2val_optkeys(id) # { key=>method, ... }
- # The method is used to convert a ruby's object to a opt-value.
- # When set the value of the option "key", "method.call(id, val)" is called.
- # That is, "-#{key} #{method.call(id, value)}".
- {}
- end
- private :__item_ruby2val_optkeys
-
def __item_methodcall_optkeys(id) # { key=>method, ... }
- # Use the method for both of get and set.
- # Usually, the 'key' will not be a widget option.
- #
# maybe need to override
# {'coords'=>'coords'}
{}
@@ -150,23 +119,8 @@ module TkItemConfigMethod
################################################
def itemcget(tagOrId, option)
- orig_opt = option
option = option.to_s
- if option.length == 0
- fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
- end
-
- if ( method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[option] )
- optval = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
- begin
- return method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- return optval
- end
- end
-
if ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[option] )
return self.__send__(method, tagOrId)
end
@@ -200,10 +154,6 @@ module TkItemConfigMethod
conf
end
- when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
- v = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
- (v.empty?)? nil: TkVarAccess.new(v)
-
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
_fromUTF8(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
@@ -234,11 +184,6 @@ module TkItemConfigMethod
self.__send__(method, tagOrId, value) if value
}
- __item_ruby2val_optkeys(tagid(tagOrId)).each{|key, method|
- key = key.to_s
- slot[key] = method.call(tagOrId, slot[key]) if slot.has_key?(key)
- }
-
__item_keyonly_optkeys(tagid(tagOrId)).each{|defkey, undefkey|
conf = slot.find{|kk, vv| kk == defkey.to_s}
if conf
@@ -259,12 +204,7 @@ module TkItemConfigMethod
end
else
- orig_slot = slot
slot = slot.to_s
- if slot.length == 0
- fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
- end
-
if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
defkey, undefkey = conf
if value
@@ -272,8 +212,6 @@ module TkItemConfigMethod
elsif undefkey
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
end
- elsif ( method = _symbolkey2str(__item_ruby2val_optkeys(tagid(tagOrId)))[slot] )
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}" << method.call(tagOrId, value)))
elsif ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot] )
self.__send__(method, tagOrId, value)
elsif (slot =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
@@ -291,10 +229,9 @@ module TkItemConfigMethod
def itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
- if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
fontkey = $2
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
@@ -311,38 +248,12 @@ module TkItemConfigMethod
if slot
slot = slot.to_s
case slot
- when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
- method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
- end
-
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
return [slot, '', '', '', self.__send__(method, tagOrId)]
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -363,8 +274,7 @@ module TkItemConfigMethod
end
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -377,8 +287,7 @@ module TkItemConfigMethod
end
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -399,8 +308,7 @@ module TkItemConfigMethod
end
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -413,8 +321,7 @@ module TkItemConfigMethod
end
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
@@ -429,33 +336,10 @@ module TkItemConfigMethod
end
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
-
- when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
- end
- end
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
else
- # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
end
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
@@ -470,39 +354,12 @@ module TkItemConfigMethod
conf
else
- # ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))))).collect{|conflist|
- # conf = tk_split_simplelist(conflist)
- ret = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).collect{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
- optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
- case optkey
- when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
- method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- begin
- val = method(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
- end
-
+ case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
# do nothing
@@ -579,25 +436,6 @@ module TkItemConfigMethod
list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
end
- when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new
- end
- end
-
else
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -649,10 +487,9 @@ module TkItemConfigMethod
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
fontkey = $2
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
@@ -674,38 +511,12 @@ module TkItemConfigMethod
if slot
slot = slot.to_s
case slot
- when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
- method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
- end
-
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
return {slot => ['', '', '', self.__send__(method, tagOrId)]}
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -726,8 +537,7 @@ module TkItemConfigMethod
end
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -740,8 +550,7 @@ module TkItemConfigMethod
end
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -762,8 +571,7 @@ module TkItemConfigMethod
end
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -776,8 +584,7 @@ module TkItemConfigMethod
end
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
@@ -792,33 +599,10 @@ module TkItemConfigMethod
end
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
- # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
-
- when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
- end
- end
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
else
- # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
- conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
end
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
@@ -836,39 +620,12 @@ module TkItemConfigMethod
else
ret = {}
- # tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))))).each{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).each{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
- optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
- case optkey
- when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
- method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- begin
- val = method.call(tagOrId, optval)
- rescue => e
- warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
- val = optval
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
- end
-
+ case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
# do nothing
@@ -945,25 +702,6 @@ module TkItemConfigMethod
list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
end
- when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- if v.empty?
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
- end
- end
-
else
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
index ab9e3ff6c9..e4a1a50912 100644
--- a/ext/tk/lib/tk/itemfont.rb
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -221,18 +221,18 @@ module TkTreatItemFont
self
end
- def tagfont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil)
+ def tagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if wintag
if winkey
- fnt = win.tagfontobj(wintag, winkey).dup
+ fnt = window.tagfontobj(wintag, winkey).dup
else
- fnt = win.tagfontobj(wintag).dup
+ fnt = window.tagfontobj(wintag).dup
end
else
if winkey
- fnt = win.fontobj(winkey).dup
+ fnt = window.fontobj(winkey).dup
else
- fnt = win.fontobj.dup
+ fnt = window.fontobj.dup
end
end
@@ -247,7 +247,7 @@ module TkTreatItemFont
end
- def latintagfont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil)
+ def latintagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if targetkey
fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
*(__item_config_cmd(tagid(tagOrId)) << {}))
@@ -258,22 +258,22 @@ module TkTreatItemFont
if wintag
if winkey
- fontobj.latin_replace(win.tagfontobj(wintag, winkey).latin_font_id)
+ fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
else
- fontobj.latin_replace(win.tagfontobj(wintag).latin_font_id)
+ fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
end
else
if winkey
- fontobj.latin_replace(win.fontobj(winkey).latin_font_id)
+ fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
else
- fontobj.latin_replace(win.fontobj.latin_font_id)
+ fontobj.latin_replace(window.fontobj.latin_font_id)
end
end
self
end
alias asciitagfont_copy latintagfont_copy
- def kanjifont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil)
+ def kanjifont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if targetkey
fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
*(__item_config_cmd(tagid(tagOrId)) << {}))
@@ -284,15 +284,15 @@ module TkTreatItemFont
if wintag
if winkey
- fontobj.kanji_replace(win.tagfontobj(wintag, winkey).kanji_font_id)
+ fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
else
- fontobj.kanji_replace(win.tagfontobj(wintag).kanji_font_id)
+ fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
end
else
if winkey
- fontobj.kanji_replace(win.fontobj(winkey).kanji_font_id)
+ fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
else
- fontobj.kanji_replace(win.fontobj.kanji_font_id)
+ fontobj.kanji_replace(window.fontobj.kanji_font_id)
end
end
self
diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb
index a29dbcdb72..fc731b6569 100644
--- a/ext/tk/lib/tk/kinput.rb
+++ b/ext/tk/lib/tk/kinput.rb
@@ -13,46 +13,46 @@ module TkKinput
'kanjiInput'.freeze
].freeze
- def TkKinput.start(win, style=None)
- tk_call('kinput_start', win, style)
+ def TkKinput.start(window, style=None)
+ tk_call('kinput_start', window, style)
end
def kinput_start(style=None)
TkKinput.start(self, style)
end
- def TkKinput.send_spot(win)
- tk_call('kinput_send_spot', win)
+ def TkKinput.send_spot(window)
+ tk_call('kinput_send_spot', window)
end
def kinput_send_spot
TkKinput.send_spot(self)
end
- def TkKinput.input_start(win, keys=nil)
- tk_call('kanjiInput', 'start', win, *hash_kv(keys))
+ def TkKinput.input_start(window, keys=nil)
+ tk_call('kanjiInput', 'start', window, *hash_kv(keys))
end
def kanji_input_start(keys=nil)
TkKinput.input_start(self, keys)
end
- def TkKinput.attribute_config(win, slot, value=None)
+ def TkKinput.attribute_config(window, slot, value=None)
if slot.kind_of? Hash
- tk_call('kanjiInput', 'attribute', win, *hash_kv(slot))
+ tk_call('kanjiInput', 'attribute', window, *hash_kv(slot))
else
- tk_call('kanjiInput', 'attribute', win, "-#{slot}", value)
+ tk_call('kanjiInput', 'attribute', window, "-#{slot}", value)
end
end
def kinput_attribute_config(slot, value=None)
TkKinput.attribute_config(self, slot, value)
end
- def TkKinput.attribute_info(win, slot=nil)
+ def TkKinput.attribute_info(window, slot=nil)
if slot
conf = tk_split_list(tk_call('kanjiInput', 'attribute',
- win, "-#{slot}"))
+ window, "-#{slot}"))
conf[0] = conf[0][1..-1]
conf
else
- tk_split_list(tk_call('kanjiInput', 'attribute', win)).collect{|conf|
+ tk_split_list(tk_call('kanjiInput', 'attribute', window)).collect{|conf|
conf[0] = conf[0][1..-1]
conf
}
@@ -62,8 +62,8 @@ module TkKinput
TkKinput.attribute_info(self, slot)
end
- def TkKinput.input_end(win)
- tk_call('kanjiInput', 'end', win)
+ def TkKinput.input_end(window)
+ tk_call('kanjiInput', 'end', window)
end
def kanji_input_end
TkKinput.input_end(self)
diff --git a/ext/tk/lib/tk/label.rb b/ext/tk/lib/tk/label.rb
index 8b45db9b30..ea669d576e 100644
--- a/ext/tk/lib/tk/label.rb
+++ b/ext/tk/lib/tk/label.rb
@@ -15,4 +15,8 @@ class TkLabel<TkWindow
# end
#end
#private :create_self
+
+ def textvariable(v)
+ configure 'textvariable', tk_trace_variable(v)
+ end
end
diff --git a/ext/tk/lib/tk/labelframe.rb b/ext/tk/lib/tk/labelframe.rb
index 73d5603200..fd16d3419d 100644
--- a/ext/tk/lib/tk/labelframe.rb
+++ b/ext/tk/lib/tk/labelframe.rb
@@ -16,10 +16,5 @@ class TkLabelFrame<TkFrame
# end
#end
#private :create_self
-
- def __val2ruby_optkeys # { key=>proc, ... }
- super().update('labelwidget'=>proc{|v| window(v)})
- end
- private :__val2ruby_optkeys
end
TkLabelframe = TkLabelFrame
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb
index 41d02d279e..f00db19239 100644
--- a/ext/tk/lib/tk/listbox.rb
+++ b/ext/tk/lib/tk/listbox.rb
@@ -32,11 +32,6 @@ class TkListbox<TkTextWin
#end
#private :create_self
- def __tkvariable_optkeys
- super() << 'listvariable'
- end
- private :__tkvariable_optkeys
-
def tagid(id)
#id.to_s
_get_eval_string(id)
@@ -51,8 +46,7 @@ class TkListbox<TkTextWin
end
def get(first, last=nil)
if last
- # tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
- tk_split_simplelist(tk_send_without_enc('get', first, last), false, true)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
else
_fromUTF8(tk_send_without_enc('get', first))
end
@@ -79,8 +73,8 @@ class TkListbox<TkTextWin
self
end
- def index(idx)
- tk_send_without_enc('index', idx).to_i
+ def index(index)
+ tk_send_without_enc('index', index).to_i
end
def value
diff --git a/ext/tk/lib/tk/macpkg.rb b/ext/tk/lib/tk/macpkg.rb
index 1802073f46..d67a19745b 100644
--- a/ext/tk/lib/tk/macpkg.rb
+++ b/ext/tk/lib/tk/macpkg.rb
@@ -26,11 +26,6 @@ module TkMacResource
TkCommandNames = ['resource'.freeze].freeze
- PACKAGE_NAME = 'resource'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
tk_call_without_enc('package', 'require', 'resource')
def close(rsrcRef)
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index ddddc8e53e..8a33b482c7 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -18,21 +18,11 @@ module TkMenuEntryConfig
end
private :__item_config_cmd
- def __item_strval_optkeys(id)
- super(id) << 'selectcolor'
- end
- private :__item_strval_optkeys
-
def __item_listval_optkeys(id)
[]
end
private :__item_listval_optkeys
- def __item_val2ruby_optkeys(id) # { key=>proc, ... }
- super(id).update('menu'=>proc{|i, v| window(v)})
- end
- private :__item_val2ruby_optkeys
-
alias entrycget itemcget
alias entryconfigure itemconfigure
alias entryconfiginfo itemconfiginfo
@@ -43,7 +33,6 @@ module TkMenuEntryConfig
end
class TkMenu<TkWindow
- include Wm
include TkMenuEntryConfig
extend TkMenuSpec
@@ -60,16 +49,6 @@ class TkMenu<TkWindow
#end
#private :create_self
- def __strval_optkeys
- super() << 'selectcolor' << 'title'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'tearoff'
- end
- private :__boolval_optkeys
-
def self.new_menuspec(menu_spec, parent = nil, tearoff = false, keys = nil)
if parent.kind_of?(Hash)
keys = _symbolkey2str(parent)
@@ -116,38 +95,8 @@ class TkMenu<TkWindow
def add_separator(keys=nil)
add('separator', keys)
end
-
- def clone_menu(*args)
- if args[0].kind_of?(TkWindow)
- parent = args.shift
- else
- parent = self
- end
-
- if args[0].kind_of?(String) || args[0].kind_of?(Symbol) # menu type
- type = args.shift
- else
- type = None # 'normal'
- end
-
- if args[0].kind_of?(Hash)
- keys = _symbolkey2str(args.shift)
- else
- keys = {}
- end
-
- parent = keys.delete('parent') if keys.has_key?('parent')
- type = keys.delete('type') if keys.has_key?('type')
-
- if keys.empty?
- TkMenuClone.new(self, parent, type)
- else
- TkMenuClone.new(self, parent, type, keys)
- end
- end
-
- def index(idx)
- ret = tk_send_without_enc('index', _get_eval_enc_str(idx))
+ def index(index)
+ ret = tk_send_without_enc('index', _get_eval_enc_str(index))
(ret == 'none')? nil: number(ret)
end
def invoke(index)
@@ -383,7 +332,6 @@ end
class TkMenuClone<TkMenu
-=begin
def initialize(parent, type=None)
widgetname = nil
if parent.kind_of? Hash
@@ -399,44 +347,8 @@ class TkMenuClone<TkMenu
install_win(@parent.path, widgetname)
tk_call_without_enc(@parent.path, 'clone', @path, type)
end
-=end
- def initialize(src_menu, *args)
- widgetname = nil
-
- if args[0].kind_of?(TkWindow) # parent window
- parent = args.shift
- else
- parent = src_menu
- end
-
- if args[0].kind_of?(String) || args[0].kind_of?(Symbol) # menu type
- type = args.shift
- else
- type = None # 'normal'
- end
-
- if args[0].kind_of?(Hash)
- keys = _symbolkey2str(args.shift)
- parent = keys.delete('parent') if keys.has_key?('parent')
- widgetname = keys.delete('widgetname')
- type = keys.delete('type') if keys.has_key?('type')
- else
- keys = nil
- end
-
- @src_menu = src_menu
- @parent = parent
- @type = type
- install_win(@parent.path, widgetname)
- tk_call_without_enc(@src_menu.path, 'clone', @path, @type)
- configure(keys) if keys && !keys.empty?
- end
-
- def source_menu
- @src_menu
- end
end
-TkCloneMenu = TkMenuClone
+
module TkSystemMenu
def initialize(parent, keys=nil)
@@ -490,21 +402,12 @@ class TkMenubutton<TkLabel
WidgetClassNames[WidgetClassName] = self
def create_self(keys)
if keys and keys != None
- # tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
else
- # tk_call_without_enc('menubutton', @path)
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ tk_call_without_enc('menubutton', @path)
end
end
private :create_self
-
- def __boolval_optkeys
- super() << 'indicatoron'
- end
- private :__boolval_optkeys
-
end
TkMenuButton = TkMenubutton
@@ -535,7 +438,6 @@ class TkOptionMenubutton<TkMenubutton
parent = nil
if args[0].kind_of?(TkWindow) || args[0] == nil
- keys.delete('parent') # ignore
parent = args.shift
else
parent = keys.delete('parent')
@@ -543,7 +445,6 @@ class TkOptionMenubutton<TkMenubutton
@variable = nil
if args[0].kind_of?(TkVariable) || args[0] == nil
- keys.delete('variable') # ignore
@variable = args.shift
else
@variable = keys.delete('variable')
diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb
index 118a4f42b1..c8819f8e41 100644
--- a/ext/tk/lib/tk/menuspec.rb
+++ b/ext/tk/lib/tk/menuspec.rb
@@ -12,12 +12,12 @@
# And the format of the menu_info is:
# [
# [text, underline, configs], # menu button/entry (*1)
-# [label, command, underline, accelerator, configs], # command entry
-# [label, TkVar_obj, underline, accelerator, configs], # checkbutton entry
+# [label, command, underline, accelerator, configs], # command entry
+# [label, TkVar_obj, underline, accelerator, configs], # checkbutton entry
# [label, [TkVar_obj, value],
-# underline, accelerator, configs], # radiobutton entry
+# underline, accelerator, configs], # radiobutton entry
# [label, [[...menu_info...], [...menu_info...], ...],
-# underline, accelerator, configs], # cascade entry (*2)
+# underline, accelerator, configs], # cascade entry
# '---', # separator
# ...
# ]
@@ -33,10 +33,6 @@
# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX,
# 'system' for Win, and 'apple' for Mac) option to the configs hash of
# menu button/entry information.
-#
-# NOTE: (*2)
-# If you want to configure a cascade menu, add :menu_config=>{...configs..}
-# to the configs of the cascade entry.
module TkMenuSpec
def _create_menu(parent, menu_info, menu_name = nil,
diff --git a/ext/tk/lib/tk/mngfocus.rb b/ext/tk/lib/tk/mngfocus.rb
index 1a2049c8a8..a0f18233be 100644
--- a/ext/tk/lib/tk/mngfocus.rb
+++ b/ext/tk/lib/tk/mngfocus.rb
@@ -17,15 +17,15 @@ module TkManageFocus
tk_call_without_enc('tk_focusFollowsMouse')
end
- def TkManageFocus.next(win)
- tk_tcl2ruby(tk_call('tk_focusNext', win))
+ def TkManageFocus.next(window)
+ tk_tcl2ruby(tk_call('tk_focusNext', window))
end
def focusNext
TkManageFocus.next(self)
end
- def TkManageFocus.prev(win)
- tk_tcl2ruby(tk_call('tk_focusPrev', win))
+ def TkManageFocus.prev(window)
+ tk_tcl2ruby(tk_call('tk_focusPrev', window))
end
def focusPrev
TkManageFocus.prev(self)
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index 061e43fd89..4e095c6fc0 100644
--- a/ext/tk/lib/tk/msgcat.rb
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -23,11 +23,6 @@ class TkMsgCatalog < TkObject
tk_call_without_enc('package', 'require', 'Tcl', '8.2')
- PACKAGE_NAME = 'msgcat'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
if self.const_defined? :FORCE_VERSION
tk_call_without_enc('package', 'require', 'msgcat', FORCE_VERSION)
else
@@ -130,8 +125,7 @@ class TkMsgCatalog < TkObject
self.set_translation(loc, *args)
else
- super(id, *args)
-# fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
end
end
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index 5bf6474c5b..a236fb6a99 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -14,114 +14,6 @@ class TkNamespace < TkObject
Tk_Namespace_ID_TBL = TkCore::INTERP.create_table
Tk_Namespace_ID = ["ns".freeze, "00000".taint].freeze
- Tk_NsCode_RetObjID_TBL = TkCore::INTERP.create_table
-
- TkCore::INTERP.init_ip_env{
- Tk_Namespace_ID_TBL.clear
- Tk_NsCode_RetObjID_TBL.clear
- }
-
- def TkNamespace.id2obj(id)
- Tk_Namespace_ID_TBL[id]? Tk_Namespace_ID_TBL[id]: id
- end
-
- #####################################
-
- class Ensemble < TkObject
- def __cget_cmd
- ['namespace', 'ensemble', 'configure', self.path]
- end
- private :__cget_cmd
-
- def __config_cmd
- ['namespace', 'ensemble', 'configure', self.path]
- end
- private :__config_cmd
-
- def __configinfo_struct
- {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
- :default_value=>nil, :current_value=>2}
- end
- private :__configinfo_struct
-
- def __boolval_optkeys
- ['prefixes']
- end
- private :__boolval_optkeys
-
- def __listval_optkeys
- ['map', 'subcommands', 'unknown']
- end
- private :__listval_optkeys
-
- def self.exist?(ensemble)
- bool(tk_call('namespace', 'ensemble', 'exists', ensemble))
- end
-
- def initialize(keys = {})
- @ensemble = @path = tk_call('namespace', 'ensemble', 'create', keys)
- end
-
- def cget(slot)
- if slot == :namespace || slot == 'namespace'
- ns = super(slot)
- if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
- TkNamespace::Tk_Namespace_ID_TBL[ns]
- else
- ns
- end
- else
- super(slot)
- end
- end
-
- def configinfo(slot = nil)
- if slot
- if slot == :namespace || slot == 'namespace'
- val = super(slot)
- if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
- val = TkNamespace::Tk_Namespace_ID_TBL[val]
- end
- else
- val = super(slot)
- end
-
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- [slot.to_s, val]
- else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- {slot.to_s => val}
- end
-
- else
- info = super()
-
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- info.map!{|inf|
- if inf[0] == 'namespace' &&
- TkNamespace::Tk_Namespace_ID_TBL.key?(inf[-1])
- [inf[0], TkNamespace::Tk_Namespace_ID_TBL[inf[-1]]]
- else
- inf
- end
- }
- else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- val = info['namespace']
- if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
- info['namespace'] = TkNamespace::Tk_Namespace_ID_TBL[val]
- end
- end
-
- info
- end
- end
-
- def exists?
- bool(tk_call('namespace', 'ensemble', 'exists', @path))
- end
- end
-
- #####################################
-
class ScopeArgs < Array
include Tk
@@ -130,19 +22,19 @@ class TkNamespace < TkObject
# alias __tk_call_with_enc tk_call_with_enc
def tk_call(*args)
#super('namespace', 'eval', @namespace, *args)
- args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''}
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @namespace,
TkCore::INTERP._merge_tklist(*args))
end
def tk_call_without_enc(*args)
#super('namespace', 'eval', @namespace, *args)
- args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''}
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @namespace,
TkCore::INTERP._merge_tklist(*args))
end
def tk_call_with_enc(*args)
#super('namespace', 'eval', @namespace, *args)
- args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''}
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @namespace,
TkCore::INTERP._merge_tklist(*args))
end
@@ -154,12 +46,9 @@ class TkNamespace < TkObject
end
end
- #####################################
-
class NsCode < TkObject
- def initialize(scope, use_obj_id = false)
+ def initialize(scope)
@scope = scope + ' '
- @use_obj_id = use_obj_id
end
def path
@scope
@@ -168,44 +57,28 @@ class TkNamespace < TkObject
@scope
end
def call(*args)
- ret = TkCore::INTERP._eval_without_enc(@scope + array2tk_list(args))
- if @use_obj_id
- ret = TkNamespace::Tk_NsCode_RetObjID_TBL.delete(ret.to_i)
- end
- ret
+ TkCore::INTERP._eval_without_enc(@scope + array2tk_list(args))
end
end
- #####################################
-
- def install_cmd(cmd)
- lst = tk_split_simplelist(super(cmd), false, false)
- if lst[1] =~ /^::/
- lst[1] = @fullname
- else
- lst.insert(1, @fullname)
- end
- TkCore::INTERP._merge_tklist(*lst)
- end
-
alias __tk_call tk_call
alias __tk_call_without_enc tk_call_without_enc
alias __tk_call_with_enc tk_call_with_enc
def tk_call(*args)
#super('namespace', 'eval', @fullname, *args)
- args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''}
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @fullname,
TkCore::INTERP._merge_tklist(*args))
end
def tk_call_without_enc(*args)
#super('namespace', 'eval', @fullname, *args)
- args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''}
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @fullname,
TkCore::INTERP._merge_tklist(*args))
end
def tk_call_with_enc(*args)
#super('namespace', 'eval', @fullname, *args)
- args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''}
+ args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @fullname,
TkCore::INTERP._merge_tklist(*args))
end
@@ -274,7 +147,6 @@ class TkNamespace < TkObject
def self.code(script = Proc.new)
TkNamespace.new('').code(script)
end
-=begin
def code(script = Proc.new)
if script.kind_of?(String)
cmd = proc{|*args| ScopeArgs.new(@fullname,*args).instance_eval(script)}
@@ -286,61 +158,18 @@ class TkNamespace < TkObject
TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code',
_get_eval_string(cmd, false)))
end
-=end
- def code(script = Proc.new)
- if script.kind_of?(String)
- cmd = proc{|*args|
- ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
- id = ret.object_id
- TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
- id
- }
- elsif script.kind_of?(Proc)
- cmd = proc{|*args|
- ret = ScopeArgs.new(@fullname,*args).instance_eval(&script)
- id = ret.object_id
- TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
- id
- }
- else
- fail ArgumentError, "String or Proc is expected"
- end
- TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code',
- _get_eval_string(cmd, false)),
- true)
- end
-
- def self.current_path
- tk_call('namespace', 'current')
- end
- def current_path
- @fullname
- end
def self.current
- ns = self.current_path
- if Tk_Namespace_ID_TBL.key?(ns)
- Tk_Namespace_ID_TBL[ns]
- else
- ns
- end
+ tk_call('namespace', 'current')
end
def current_namespace
# ns_tk_call('namespace', 'current')
- # @fullname
- self
+ @fullname
end
alias current current_namespace
def self.delete(*ns_list)
tk_call('namespace', 'delete', *ns_list)
- ns_list.each{|ns|
- if ns.kind_of?(TkNamespace)
- Tk_Namespace_ID_TBL.delete(ns.path)
- else
- Tk_Namespace_ID_TBL.delete(ns.to_s)
- end
- }
end
def delete
TkNamespece.delete(@fullname)
@@ -373,21 +202,12 @@ class TkNamespace < TkObject
#tk_call('namespace', 'eval', namespace, cmd, *args)
TkNamespace.new(namespece).eval(cmd, *args)
end
-=begin
def eval(cmd = Proc.new, *args)
#TkNamespace.eval(@fullname, cmd, *args)
#ns_tk_call(cmd, *args)
code_obj = code(cmd)
ret = code_obj.call(*args)
- # uninstall_cmd(TkCore::INTERP._split_tklist(code_obj.path)[-1])
- uninstall_cmd(_fromUTF8(TkCore::INTERP._split_tklist(_toUTF8(code_obj.path))[-1]))
- tk_tcl2ruby(ret)
- end
-=end
- def eval(cmd = Proc.new, *args)
- code_obj = code(cmd)
- ret = code_obj.call(*args)
- uninstall_cmd(_fromUTF8(TkCore::INTERP._split_tklist(_toUTF8(code_obj.path))[-1]))
+ uninstall_cmd(TkCore::INTERP._split_tklist(code_obj.path)[-1])
ret
end
@@ -395,7 +215,7 @@ class TkNamespace < TkObject
bool(tk_call('namespace', 'exists', ns))
end
def exist?
- TkNamespece.exist?(@fullname)
+ TkNamespece.delete(@fullname)
end
def self.export(*patterns)
@@ -435,7 +255,7 @@ class TkNamespace < TkObject
tk_call('namespace', 'inscope', namespace, script, *args)
end
def inscope(script, *args)
- TkNamespace.inscope(@fullname, script, *args)
+ TkNamespace(@fullname, script, *args)
end
def self.origin(cmd)
@@ -454,16 +274,6 @@ class TkNamespace < TkObject
tk_call('namespace', 'parent', @fullname)
end
- def self.get_path
- tk_call('namespace', 'path')
- end
- def self.set_path(*namespace_list)
- tk_call('namespace', 'path', array2tk_list(namespace_list))
- end
- def set_path
- tk_call('namespace', 'path', @fullname)
- end
-
def self.qualifiers(str)
tk_call('namespace', 'qualifiers', str)
end
@@ -472,20 +282,6 @@ class TkNamespace < TkObject
tk_call('namespace', 'tail', str)
end
- def self.upvar(namespace, *var_pairs)
- tk_call('namespace', 'upvar', namespace, *(var_pairs.flatten))
- end
- def upvar(*var_pairs)
- TkNamespace.inscope(@fullname, *(var_pairs.flatten))
- end
-
- def self.get_unknown_handler
- tk_tcl2ruby(tk_call('namespace', 'unknown'))
- end
- def self.set_unknown_handler(cmd = Proc.new)
- tk_call('namespace', 'unknown', cmd)
- end
-
def self.which(name)
tk_call('namespace', 'which', name)
end
@@ -496,5 +292,3 @@ class TkNamespace < TkObject
tk_call('namespace', 'which', '-variable', name)
end
end
-
-TkNamespace::Global = TkNamespace.new('::')
diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb
index a806f3971d..fe79de123c 100644
--- a/ext/tk/lib/tk/optiondb.rb
+++ b/ext/tk/lib/tk/optiondb.rb
@@ -44,7 +44,7 @@ module TkOptionDB
"can't call 'TkOptionDB.read_entries' on a safe interpreter"
end
- i_enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
+ i_enc = Tk.encoding()
unless f_enc
f_enc = i_enc
diff --git a/ext/tk/lib/tk/pack.rb b/ext/tk/lib/tk/pack.rb
index 8fab363121..d592fa1c80 100644
--- a/ext/tk/lib/tk/pack.rb
+++ b/ext/tk/lib/tk/pack.rb
@@ -51,13 +51,13 @@ module TkPack
return info
end
- def propagate(master, mode=None)
+ def propagate(master, bool=None)
# master = master.epath if master.kind_of?(TkObject)
master = _epath(master)
- if mode == None
+ if bool == None
bool(tk_call_without_enc('pack', 'propagate', master))
else
- tk_call_without_enc('pack', 'propagate', master, mode)
+ tk_call_without_enc('pack', 'propagate', master, bool)
end
end
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
index 2b6fdf5d90..dfe46940f3 100644
--- a/ext/tk/lib/tk/palette.rb
+++ b/ext/tk/lib/tk/palette.rb
@@ -30,23 +30,22 @@ module TkPalette
tk_call('tkDarken', color, percent)
end
- def TkPalette.recolorTree(win, colors)
+ def TkPalette.recolorTree(window, colors)
if not colors.kind_of?(Hash)
fail "2nd arg need to be Hash"
end
- tk_call('global', "tkPalette")
colors.each{|key, value|
begin
- if win.cget(key) == tk_call('set', "tkPalette(#{key})")
- win[key] = colors[key]
+ if window.cget(key) == tk_call('set', "tkPalette(#{key})")
+ window[key] = colors[key]
end
rescue
# ignore
end
}
- TkWinfo.children(win).each{|w| TkPalette.recolorTree(w, colors)}
+ TkWinfo.children(window).each{|w| TkPalette.recolorTree(w, colors)}
end
def recolorTree(colors)
diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb
index c6cf3cd11f..4932478ba0 100644
--- a/ext/tk/lib/tk/panedwindow.rb
+++ b/ext/tk/lib/tk/panedwindow.rb
@@ -63,7 +63,7 @@ class TkPanedWindow<TkWindow
def sash_coord(index)
list(tk_send('sash', 'coord', index))
end
- def sash_dragto(index, x, y)
+ def sash_dragto(index)
tk_send('sash', 'dragto', index, x, y)
self
end
@@ -107,11 +107,8 @@ class TkPanedWindow<TkWindow
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if key
- #conf = tk_split_list(tk_send_without_enc('paneconfigure',
- # win, "-#{key}"))
conf = tk_split_list(tk_send_without_enc('paneconfigure',
- win, "-#{key}"),
- false, true)
+ win, "-#{key}"))
conf[0] = conf[0][1..-1]
if conf[0] == 'hide'
conf[3] = bool(conf[3]) unless conf[3].empty?
@@ -119,12 +116,9 @@ class TkPanedWindow<TkWindow
end
conf
else
- #tk_split_simplelist(tk_send_without_enc('paneconfigure',
- # win)).collect{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_send_without_enc('paneconfigure', win),
- false, false).collect{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(tk_send_without_enc('paneconfigure',
+ win)).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
if conf[3]
if conf[0] == 'hide'
@@ -152,11 +146,8 @@ class TkPanedWindow<TkWindow
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if key
- #conf = tk_split_list(tk_send_without_enc('paneconfigure',
- # win, "-#{key}"))
conf = tk_split_list(tk_send_without_enc('paneconfigure',
- win, "-#{key}"),
- false, true)
+ win, "-#{key}"))
key = conf.shift[1..-1]
if key == 'hide'
conf[2] = bool(conf[2]) unless conf[2].empty?
@@ -165,12 +156,9 @@ class TkPanedWindow<TkWindow
{ key => conf }
else
ret = {}
- #tk_split_simplelist(tk_send_without_enc('paneconfigure',
- # win)).each{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_send_without_enc('paneconfigure', win),
- false, false).each{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(tk_send_without_enc('paneconfigure',
+ win)).each{|conflist|
+ conf = tk_split_simplelist(conflist)
key = conf.shift[1..-1]
if key
if key == 'hide'
diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb
index f8f67d709a..5649a5c447 100644
--- a/ext/tk/lib/tk/radiobutton.rb
+++ b/ext/tk/lib/tk/radiobutton.rb
@@ -17,24 +17,6 @@ class TkRadioButton<TkButton
#end
#private :create_self
- def __boolval_optkeys
- super() << 'indicatoron'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'selectcolor'
- end
- private :__strval_optkeys
-
- def __ruby2val_optkeys # { key=>proc, ... }
- {
- 'variable'=>proc{|v| tk_trace_variable(v)} # for backward compatibility
- }
- end
- private :__ruby2val_optkeys
-
-
def deselect
tk_send_without_enc('deselect')
self
@@ -43,6 +25,9 @@ class TkRadioButton<TkButton
tk_send_without_enc('select')
self
end
+ def variable(v)
+ configure 'variable', tk_trace_variable(v)
+ end
def get_value
var = tk_send_without_enc('cget', '-variable')
diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb
index 0e5584c7c1..24a5cf1ea0 100644
--- a/ext/tk/lib/tk/root.rb
+++ b/ext/tk/lib/tk/root.rb
@@ -9,11 +9,6 @@ class TkRoot<TkWindow
include Wm
include TkMenuSpec
- def __methodcall_optkeys # { key=>method, ... }
- TOPLEVEL_METHODCALL_OPTKEYS
- end
- private :__methodcall_optkeys
-
=begin
ROOT = []
def TkRoot.new(keys=nil)
@@ -41,18 +36,7 @@ class TkRoot<TkWindow
super(:without_creating=>true, :widgetname=>'.'){}
end
root = TkCore::INTERP.tk_windows['.']
-
- keys = _symbolkey2str(keys)
-
- # wm commands
- root.instance_eval{
- __methodcall_optkeys.each{|key, method|
- value = keys.delete(key.to_s)
- self.__send__(method, value) if value
- }
- }
-
- if keys # wm commands ( for backward comaptibility )
+ if keys # wm commands
keys.each{|k,v|
if v.kind_of? Array
root.__send__(k,*v)
@@ -61,7 +45,6 @@ class TkRoot<TkWindow
end
}
end
-
root.instance_eval(&b) if block_given?
root
end
@@ -69,11 +52,6 @@ class TkRoot<TkWindow
WidgetClassName = 'Tk'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.to_eval
- # self::WidgetClassName
- '.'
- end
-
def create_self
@path = '.'
end
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
index 0b703aa055..7214c46f5e 100644
--- a/ext/tk/lib/tk/scale.rb
+++ b/ext/tk/lib/tk/scale.rb
@@ -24,11 +24,6 @@ class TkScale<TkWindow
end
private :create_self
- def __strval_optkeys
- super() << 'label'
- end
- private :__strval_optkeys
-
def _wrap_command_arg(cmd)
proc{|val|
if val.kind_of?(String)
diff --git a/ext/tk/lib/tk/scrollbox.rb b/ext/tk/lib/tk/scrollbox.rb
index 833505be17..fd04057fb6 100644
--- a/ext/tk/lib/tk/scrollbox.rb
+++ b/ext/tk/lib/tk/scrollbox.rb
@@ -1,7 +1,7 @@
#
# tk/scrollbox.rb - Tk Listbox with Scrollbar
# as an example of Composite Widget
-# $Date: 2004/10/11 04:51:07 $
+# $Date$
# by Yukihiro Matsumoto <matz@netlab.co.jp>
#
require 'tk'
diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
index 1eed4d1dc4..fe50d85e43 100644
--- a/ext/tk/lib/tk/spinbox.rb
+++ b/ext/tk/lib/tk/spinbox.rb
@@ -1,6 +1,6 @@
#
# tk/spinbox.rb - Tk spinbox classes
-# $Date: 2005/10/22 22:16:24 $
+# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
require 'tk'
@@ -25,8 +25,7 @@ class TkSpinbox<TkEntry
[ ?w, TkComm.method(:window) ],
[ ?e, proc{|val|
- #enc = Tk.encoding
- enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
+ enc = Tk.encoding
if enc
Tk.fromUTF8(TkComm::string(val), enc)
else
@@ -51,7 +50,7 @@ class TkSpinbox<TkEntry
end
def __validation_class_list
- super() << SpinCommand
+ super << SpinCommand
end
Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
@@ -64,21 +63,6 @@ class TkSpinbox<TkEntry
#end
#private :create_self
- def __boolval_optkeys
- super() << 'wrap'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'buttonbackground' << 'format'
- end
- private :__strval_optkeys
-
- def __listval_optkeys
- super() << 'values'
- end
- private :__listval_optkeys
-
def identify(x, y)
tk_send_without_enc('identify', x, y)
end
diff --git a/ext/tk/lib/tk/tagfont.rb b/ext/tk/lib/tk/tagfont.rb
index a1807395d2..a106f814be 100644
--- a/ext/tk/lib/tk/tagfont.rb
+++ b/ext/tk/lib/tk/tagfont.rb
@@ -25,19 +25,19 @@ module TkTreatTagFont
self
end
- def font_copy(win, wintag=nil)
- @parent.tagfont_copy(@id, win, wintag)
+ def font_copy(window, wintag=nil)
+ @parent.tagfont_copy(@id, window, wintag)
self
end
- def latinfont_copy(win, wintag=nil)
- @parent.latintagfont_copy(@id, win, wintag)
+ def latinfont_copy(window, wintag=nil)
+ @parent.latintagfont_copy(@id, window, wintag)
self
end
alias asciifont_copy latinfont_copy
- def kanjifont_copy(win, wintag=nil)
- @parent.kanjitagfont_copy(@id, win, wintag)
+ def kanjifont_copy(window, wintag=nil)
+ @parent.kanjitagfont_copy(@id, window, wintag)
self
end
end
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index 0db10a653f..8069adc57a 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -1,6 +1,6 @@
#
# tk/text.rb - Tk text classes
-# $Date: 2005/11/23 12:01:05 $
+# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
require 'tk/itemfont'
@@ -69,164 +69,44 @@ class TkText<TkTextWin
#######################################
module IndexModMethods
- def +(mod)
- return chars(mod) if mod.kind_of?(Numeric)
-
- mod = mod.to_s
- if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(String.new(id) << ' + ' << mod)
- else
- TkText::IndexString.new(String.new(id) << ' ' << mod)
- end
- end
-
- def -(mod)
- return chars(-mod) if mod.kind_of?(Numeric)
-
- mod = mod.to_s
- if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(String.new(id) << ' - ' << mod)
- elsif mod =~ /^\s*[-]\s+(\d.*)$/
- TkText::IndexString.new(String.new(id) << ' - -' << $1)
- else
- TkText::IndexString.new(String.new(id) << ' ' << mod)
- end
- end
-
def chars(mod)
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars')
+ TkText::IndexString.new(id + ' ' << mod.to_s << ' chars')
else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars')
+ TkText::IndexString.new(id + ' + ' << mod.to_s << ' chars')
end
end
alias char chars
- def display_chars(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display chars')
- end
- end
- alias display_char display_chars
-
- def any_chars(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any chars')
- end
- end
- alias any_char any_chars
-
- def indices(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' indices')
- end
- end
-
- def display_indices(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display indices')
- end
- end
-
- def any_indices(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any indices')
- end
- end
-
def lines(mod)
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines')
+ TkText::IndexString.new(id + ' ' << mod.to_s << ' lines')
else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines')
+ TkText::IndexString.new(id + ' + ' << mod.to_s << ' lines')
end
end
alias line lines
- def display_lines(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display lines')
- end
- end
- alias display_line display_lines
-
- def any_lines(mod)
- # Tk8.5 feature
- fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
- if mod < 0
- TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines')
- else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any lines')
- end
- end
- alias any_line any_lines
-
def linestart
- TkText::IndexString.new(String.new(id) << ' linestart')
+ TkText::IndexString.new(id + ' linestart')
end
def lineend
- TkText::IndexString.new(String.new(id) << ' lineend')
- end
-
- def display_linestart
- # Tk8.5 feature
- TkText::IndexString.new(String.new(id) << ' display linestart')
- end
- def display_lineend
- # Tk8.5 feature
- TkText::IndexString.new(String.new(id) << ' display lineend')
+ TkText::IndexString.new(id + ' lineend')
end
def wordstart
- TkText::IndexString.new(String.new(id) << ' wordstart')
+ TkText::IndexString.new(id + ' wordstart')
end
def wordend
- TkText::IndexString.new(String.new(id) << ' wordend')
- end
-
- def display_wordstart
- # Tk8.5 feature
- TkText::IndexString.new(String.new(id) << ' display wordstart')
- end
- def display_wordend
- # Tk8.5 feature
- TkText::IndexString.new(String.new(id) << ' display wordend')
+ TkText::IndexString.new(id + ' wordend')
end
end
class IndexString < String
include IndexModMethods
- def self.at(x,y)
- self.new("@#{x},#{y}")
- end
-
def self.new(str)
if str.kind_of?(String)
super(str)
@@ -279,22 +159,9 @@ class TkText<TkTextWin
end
private :create_self
- def __strval_optkeys
- super() << 'inactiveseletcionbackground'
- end
- private :__strval_optkeys
-
- def self.at(x, y)
- TkText::IndexString.at(x, y)
- end
-
- def at(x, y)
- TkText::IndexString.at(x, y)
- end
-
- def index(idx)
+ def index(index)
TkText::IndexString.new(tk_send_without_enc('index',
- _get_eval_enc_str(idx)))
+ _get_eval_enc_str(index)))
end
def get_displaychars(*index)
@@ -347,15 +214,13 @@ class TkText<TkTextWin
end
def tag_names(index=None)
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag', 'names', _get_eval_enc_str(index)))).collect{|elt|
- tk_split_simplelist(tk_send_without_enc('tag', 'names', _get_eval_enc_str(index)), false, true).collect{|elt|
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag', 'names', _get_eval_enc_str(index)))).collect{|elt|
tagid2obj(elt)
}
end
def mark_names
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('mark', 'names'))).collect{|elt|
- tk_split_simplelist(tk_send_without_enc('mark', 'names'), false, true).collect{|elt|
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('mark', 'names'))).collect{|elt|
tagid2obj(elt)
}
end
@@ -427,19 +292,15 @@ class TkText<TkTextWin
if slot
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
- #conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
else
- #conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
end
conf[0] = conf[0][1..-1]
conf
else
- # tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).collect{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'file'
@@ -467,20 +328,16 @@ class TkText<TkTextWin
if slot
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
- #conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
else
- #conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
end
key = conf.shift[1..-1]
{ key => conf }
else
ret = {}
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).each{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
key = conf.shift[1..-1]
case key
when 'text', 'label', 'show', 'data', 'file'
@@ -533,8 +390,7 @@ class TkText<TkTextWin
end
def image_names
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'names'))).collect{|elt|
- tk_split_simplelist(tk_send_without_enc('image', 'names'), false, true).collect{|elt|
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'names'))).collect{|elt|
tagid2obj(elt)
}
end
@@ -557,13 +413,13 @@ class TkText<TkTextWin
args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
args << tags.shift if tags.size > 0 # chars
end
- super(index, *args)
+ super index, *args
else
# single chars-taglist argument :: str, tag, tag, ...
if tags.size == 0
- super(index, chars)
+ super index, chars
else
- super(index, chars, tags.collect{|x|_get_eval_string(x)}.join(' '))
+ super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
end
end
end
@@ -573,7 +429,7 @@ class TkText<TkTextWin
@tags.each_value do |t|
t.destroy
end
- super()
+ super
end
def backspace
@@ -733,7 +589,7 @@ class TkText<TkTextWin
#end
def tag_bind(tag, seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -748,7 +604,7 @@ class TkText<TkTextWin
#end
def tag_bind_append(tag, seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -961,11 +817,8 @@ class TkText<TkTextWin
end
def tag_ranges(tag)
- #l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges',
- # _get_eval_enc_str(tag)))
l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges',
- _get_eval_enc_str(tag)),
- false, true)
+ _get_eval_enc_str(tag)))
r = []
while key=l.shift
r.push [TkText::IndexString.new(key), TkText::IndexString.new(l.shift)]
@@ -1176,8 +1029,7 @@ class TkText<TkTextWin
=end
def window_names
- # tk_split_simplelist(_fromUTF8(tk_send_without_enc('window', 'names'))).collect{|elt|
- tk_split_simplelist(tk_send_without_enc('window', 'names'), false, true).collect{|elt|
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('window', 'names'))).collect{|elt|
tagid2obj(elt)
}
end
diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb
index a29b23c7dd..982cb2ecf9 100644
--- a/ext/tk/lib/tk/textimage.rb
+++ b/ext/tk/lib/tk/textimage.rb
@@ -9,7 +9,7 @@ class TkTextImage<TkObject
def initialize(parent, index, keys)
#unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # fail ArguemntError, "expect TkText for 1st argument"
#end
@t = parent
if index == 'end' || index == :end
diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb
index 650d95af70..9dff764eca 100644
--- a/ext/tk/lib/tk/textmark.rb
+++ b/ext/tk/lib/tk/textmark.rb
@@ -20,7 +20,7 @@ class TkTextMark<TkObject
def initialize(parent, index)
#unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # fail ArguemntError, "expect TkText for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
@@ -40,47 +40,18 @@ class TkTextMark<TkObject
end
def exist?
- #if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'names'))).find{|id| id == @id } )
- if ( tk_split_simplelist(tk_call_without_enc(@t.path, 'mark', 'names'), false, true).find{|id| id == @id } )
+ if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'names'))).find{|id| id == @id } )
true
else
false
end
end
-=begin
- # move to TkText::IndexModMethods module
def +(mod)
- return chars(mod) if mod.kind_of?(Numeric)
-
- mod = mod.to_s
- if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(@id + ' + ' + mod)
- else
- TkText::IndexString.new(@id + ' ' + mod)
- end
+ TkText::IndexString.new(@id + ' + ' + mod)
end
-
def -(mod)
- return chars(-mod) if mod.kind_of?(Numeric)
-
- mod = mod.to_s
- if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(@id + ' - ' + mod)
- elsif mod =~ /^\s*[-]\s+(\d.*)$/
- TkText::IndexString.new(@id + ' - -' + $1)
- else
- TkText::IndexString.new(@id + ' ' + mod)
- end
- end
-=end
-
- def pos
- @t.index(@id)
- end
-
- def pos=(where)
- set(where)
+ TkText::IndexString.new(@id + ' - ' + mod)
end
def set(where)
@@ -133,7 +104,7 @@ class TkTextNamedMark<TkTextMark
def initialize(parent, name, index=nil)
#unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # fail ArguemntError, "expect TkText for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index cc2c56210f..1e3a2d7e41 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -22,7 +22,7 @@ class TkTextTag<TkObject
def initialize(parent, *args)
#unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # fail ArguemntError, "expect TkText for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
@@ -51,8 +51,7 @@ class TkTextTag<TkObject
end
def exist?
- #if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'names'))).find{|id| id == @id } )
- if ( tk_split_simplelist(tk_call_without_enc(@t.path, 'tag', 'names'), false, true).find{|id| id == @id } )
+ if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'names'))).find{|id| id == @id } )
true
else
false
@@ -174,7 +173,7 @@ class TkTextTag<TkObject
#end
def bind(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -189,7 +188,7 @@ class TkTextTag<TkObject
#end
def bind_append(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -248,7 +247,7 @@ class TkTextNamedTag<TkTextTag
def initialize(parent, name, *args)
#unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # fail ArguemntError, "expect TkText for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index 605c40addd..7c97313582 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -9,7 +9,7 @@ class TkTextWindow<TkObject
def initialize(parent, index, keys = {})
#unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # fail ArguemntError, "expect TkText for 1st argument"
#end
@t = parent
if index == 'end' || index == :end
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index 49b7f1b06a..a1f43fa864 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -1,7 +1,7 @@
#
# tk/timer.rb : methods for Tcl/Tk after command
#
-# $Id: timer.rb,v 1.1.2.15 2005/05/08 14:20:53 nagai Exp $
+# $Id$
#
require 'tk'
@@ -249,7 +249,7 @@ class TkTimer
# && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
if interval != 'idle' && interval != :idle \
&& !interval.kind_of?(Integer) && !TkComm._callback_entry?(interval)
- fail ArgumentError, "expect Integer or Proc"
+ fail ArguemntError, "expect Integer or Proc"
end
@sleep_time = interval
end
@@ -259,7 +259,7 @@ class TkTimer
# && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
if interval != 'idle' && interval != :idle \
&& !interval.kind_of?(Integer) && !TkComm._callback_entry?(interval)
- fail ArgumentError, "expect Integer or Proc for 1st argument"
+ fail ArguemntError, "expect Integer or Proc for 1st argument"
end
@sleep_time = interval
@@ -283,7 +283,7 @@ class TkTimer
@loop_exec = 0
else
if not loop_exec.kind_of?(Integer)
- fail ArgumentError, "expect Integer for 2nd argument"
+ fail ArguemntError, "expect Integer for 2nd argument"
end
@loop_exec = loop_exec
end
@@ -334,7 +334,7 @@ class TkTimer
sleep = @init_sleep unless sleep
if sleep != 'idle' && sleep != :idle && !sleep.kind_of?(Integer)
- fail ArgumentError, "expect Integer or 'idle' for 1st argument"
+ fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
@@ -353,7 +353,6 @@ class TkTimer
Tk_CBTBL[@id] = self
@do_loop = @loop_exec
@current_pos = 0
- @return_value = nil
@after_id = nil
@init_sleep = 0
@@ -364,7 +363,7 @@ class TkTimer
if argc > 0
sleep = init_args.shift
if sleep != 'idle' && sleep != :idle && !sleep.kind_of?(Integer)
- fail ArgumentError, "expect Integer or 'idle' for 1st argument"
+ fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
end
@@ -402,8 +401,6 @@ class TkTimer
@current_pos = 0
@current_args = @init_args
- @current_script = []
-
@set_next = false if @in_callback
self
@@ -423,7 +420,6 @@ class TkTimer
@wait_var.value = 0
tk_call 'after', 'cancel', @after_id if @after_id
@after_id = nil
-
Tk_CBTBL.delete(@id) ;# for GC
self
end
@@ -431,12 +427,11 @@ class TkTimer
def continue(wait=nil)
fail RuntimeError, "is already running" if @running
- return restart() if @current_script.empty?
sleep, cmd = @current_script
fail RuntimeError, "no procedure to continue" unless cmd
if wait
unless wait.kind_of?(Integer)
- fail ArgumentError, "expect Integer for 1st argument"
+ fail ArguemntError, "expect Integer for 1st argument"
end
sleep = wait
end
@@ -502,133 +497,3 @@ class TkTimer
end
TkAfter = TkTimer
-
-
-class TkRTTimer < TkTimer
- DEFAULT_OFFSET_LIST_SIZE = 5
-
- def initialize(*args, &b)
- super(*args, &b)
-
- @offset_list = Array.new(DEFAULT_OFFSET_LIST_SIZE){ [0, 0] }
- @offset_s = 0
- @offset_u = 0
- @est_time = nil
- end
-
- def start(*args, &b)
- return nil if @running
- @est_time = nil
- @cb_start_time = Time.now
- super(*args, &b)
- end
-
- def cancel
- super()
- @est_time = nil
- @cb_start_time = Time.now
- self
- end
- alias stop cancel
-
- def continue(wait=nil)
- fail RuntimeError, "is already running" if @running
- @cb_start_time = Time.now
- super(wait)
- end
-
- def set_interval(interval)
- super(interval)
- @est_time = nil
- end
-
- def _offset_ave
- size = 0
- d_sec = 0; d_usec = 0
- @offset_list.each_with_index{|offset, idx|
- # weight = 1
- weight = idx + 1
- size += weight
- d_sec += offset[0] * weight
- d_usec += offset[1] * weight
- }
- offset_s, mod = d_sec.divmod(size)
- offset_u = ((mod * 1000000 + d_usec) / size.to_f).round
- [offset_s, offset_u]
- end
- private :_offset_ave
-
- def set_next_callback(args)
- if @running == false || @proc_max == 0 || @do_loop == 0
- Tk_CBTBL.delete(@id) ;# for GC
- @running = false
- @wait_var.value = 0
- return
- end
- if @current_pos >= @proc_max
- if @do_loop < 0 || (@do_loop -= 1) > 0
- @current_pos = 0
- else
- Tk_CBTBL.delete(@id) ;# for GC
- @running = false
- @wait_var.value = 0
- return
- end
- end
-
- @current_args = args
-
- cmd, *cmd_args = @loop_proc[@current_pos]
- @current_pos += 1
- @current_proc = cmd
-
- @offset_s, @offset_u = _offset_ave
-
- if TkComm._callback_entry?(@sleep_time)
- sleep = @sleep_time.call(self)
- else
- sleep = @sleep_time
- end
-
- if @est_time
- @est_time = Time.at(@est_time.to_i, @est_time.usec + sleep*1000)
- else
- @est_time = Time.at(@cb_start_time.to_i,
- @cb_start_time.usec + sleep*1000)
- end
-
- now = Time.now
- real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 +
- (@est_time.usec - now.usec + @offset_u)/1000.0).round
- if real_sleep <= 0
- real_sleep = 0
- @offset_s = now.to_i
- @offset_u = now.usec
- end
- @current_sleep = real_sleep
-
- set_callback(real_sleep, cmd_args)
- end
-
- def cb_call
- if @est_time
- @offset_list.shift
-
- @cb_start_time = Time.now
-
- if @current_sleep == 0
- @offset_list.push([
- @offset_s - @cb_start_time.to_i,
- @offset_u - @cb_start_time.usec
- ])
- else
- @offset_list.push([
- @offset_s + (@est_time.to_i - @cb_start_time.to_i),
- @offset_u + (@est_time.usec - @cb_start_time.usec)
- ])
- end
- end
-
- @cb_cmd.call
- end
-end
diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb
index 5e199e1330..95d6366ea3 100644
--- a/ext/tk/lib/tk/toplevel.rb
+++ b/ext/tk/lib/tk/toplevel.rb
@@ -45,37 +45,12 @@ class TkToplevel<TkWindow
# end
#################
- def __boolval_optkeys
- super() << 'container'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'screen'
- end
- private :__strval_optkeys
-
- def __val2ruby_optkeys # { key=>proc, ... }
- super().update('menu'=>proc{|v| window(v)})
- end
- private :__val2ruby_optkeys
-
- def __methodcall_optkeys # { key=>method, ... }
- TOPLEVEL_METHODCALL_OPTKEYS
- end
- private :__methodcall_optkeys
-
def _wm_command_option_chk(keys)
keys = {} unless keys
new_keys = {}
wm_cmds = {}
-
- conf_methods = _symbolkey2str(__methodcall_optkeys())
-
keys.each{|k,v|
- if conf_methods.key?(k)
- wm_cmds[conf_methods[k]] = v
- elsif Wm.method_defined?(k)
+ if Wm.method_defined?(k)
case k
when 'screen','class','colormap','container','use','visual'
new_keys[k] = v
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index 0c5b5c61b9..eeb0163ee4 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -226,8 +226,7 @@ class TkValidateCommand
[ ?w, TkComm.method(:window) ],
[ ?e, proc{|val|
- #enc = Tk.encoding
- enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
+ enc = Tk.encoding
if enc
Tk.fromUTF8(TkComm::string(val), enc)
else
@@ -337,7 +336,7 @@ module TkValidation
#####################################
def __validation_class_list
- super() << ValidateCmd
+ super << ValidateCmd
end
Tk::ValidateConfigure.__def_validcmd(binding, ValidateCmd)
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index e5cacadc1a..62d4ec29ae 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -41,13 +41,13 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
EOL
#def TkVariable.callback(args)
- def TkVariable.callback(id, name1, name2, op)
+ def TkVariable.callback(name1, name2, op)
#name1,name2,op = tk_split_list(args)
#name1,name2,op = tk_split_simplelist(args)
- if TkVar_CB_TBL[id]
+ if TkVar_CB_TBL[name1]
#_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
begin
- _get_eval_string(TkVar_CB_TBL[id].trace_callback(name2, op))
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
rescue SystemExit
exit(0)
rescue Interrupt
@@ -109,12 +109,11 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
end
self
end
- def set_default_value(val)
+ def default_value=(val)
@def_default = :val
@default_val = val
self
end
- alias default_value= set_default_value
def default_proc(cmd = Proc.new)
@def_default = :proc
@default_val = cmd
@@ -127,155 +126,12 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
self
end
- def default_value_type
- @type
- end
- def default_element_value_type(idxs)
- if idxs.kind_of?(Array)
- index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
- else
- index = _get_eval_string(idxs, true)
- end
- @element_type[index]
- end
-
- def _set_default_value_type_core(type, idxs)
- if type.kind_of?(Class)
- if type == NilClass
- type = nil
- elsif type == Numeric
- type = :numeric
- elsif type == TrueClass || type == FalseClass
- type = :bool
- elsif type == String
- type = :string
- elsif type == Symbol
- type = :symbol
- elsif type == Array
- type = :list
- elsif type <= TkVariable
- type = :variable
- elsif type <= TkWindow
- type = :window
- elsif TkComm._callback_entry_class?(type)
- type = :procedure
- else
- type = nil
- end
- else
- case(type)
- when nil
- type = nil
- when :numeric, 'numeric'
- type = :numeric
- when true, false, :bool, 'bool'
- type = :bool
- when :string, 'string'
- type = :string
- when :symbol, 'symbol'
- type = :symbol
- when :list, 'list'
- type = :list
- when :numlist, 'numlist'
- type = :numlist
- when :variable, 'variable'
- type = :variable
- when :window, 'window'
- type = :window
- when :procedure, 'procedure'
- type = :procedure
- else
- return _set_default_value_type_core(type.class, idxs)
- end
- end
- if idxs
- if idxs.kind_of?(Array)
- index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
- else
- index = _get_eval_string(idxs, true)
- end
- @element_type[index] = type
- else
- @type = type
- end
- type
- end
- private :_set_default_value_type_core
-
- def set_default_value_type(type)
- _set_default_value_type_core(type, nil)
- self
- end
- alias default_value_type= set_default_value_type
-
- def set_default_element_value_type(idxs, type)
- _set_default_value_type_core(type, idxs)
- self
- end
-
- def _to_default_type(val, idxs = nil)
- if idxs
- if idxs.kind_of?(Array)
- index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
- else
- index = _get_eval_string(idxs, true)
- end
- type = @element_type[index]
- else
- type = @type
- end
- return val unless type
- if val.kind_of?(Hash)
- val.keys.each{|k| val[k] = _to_default_type(val[k], idxs) }
- val
- else
- begin
- case(type)
- when :numeric
- number(val)
- when :bool
- TkComm.bool(val)
- when :string
- val
- when :symbol
- val.intern
- when :list
- tk_split_simplelist(val)
- when :numlist
- tk_split_simplelist(val).collect!{|v| number(v)}
- when :variable
- TkVarAccess.new(val)
- when :window
- TkComm.window(val)
- when :procedure
- TkComm.procedure(val)
- else
- val
- end
- rescue
- val
- end
- end
- end
- private :_to_default_type
-
- def _to_default_element_type(idxs, val)
- _to_default_type(val, idxs)
- end
- private :_to_default_element_type
-
- def initialize(val="", type=nil)
+ def initialize(val="")
# @id = Tk_VARIABLE_ID.join('')
- begin
- @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
- Tk_VARIABLE_ID[1].succ!
- end until INTERP._invoke_without_enc('info', 'globals', @id).empty?
-
+ @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
+ Tk_VARIABLE_ID[1].succ!
TkVar_ID_TBL[@id] = self
- @var = @id
- @elem = nil
-
@def_default = false
@default_val = nil
@@ -283,11 +139,10 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
@trace_elem = nil
@trace_opts = nil
- @type = nil
- var = self
- @element_type = Hash.new{|k,v| var.default_value_type }
-
- self.default_value_type = type
+ begin
+ INTERP._unset_global_var(@id)
+ rescue
+ end
# teach Tk-ip that @id is global var
INTERP._invoke_without_enc('global', @id)
@@ -387,40 +242,20 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
def is_hash?
#ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
INTERP._invoke_without_enc('global', @id)
- # INTERP._invoke_without_enc('array', 'exist', @id) == '1'
- TkComm.bool(INTERP._invoke_without_enc('array', 'exist', @id))
+ INTERP._invoke_without_enc('array', 'exist', @id) == '1'
end
def is_scalar?
! is_hash?
end
- def exist?(*elems)
- INTERP._invoke_without_enc('global', @id)
- if elems.empty?
- TkComm.bool(tk_call('info', 'exist', @id))
- else
- # array
- index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
- TkComm.bool(tk_call('info', 'exist', "#{@id}")) &&
- TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})"))
- end
- end
-
def keys
if (is_scalar?)
fail RuntimeError, 'cannot get keys from a scalar variable'
end
#tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
INTERP._invoke_without_enc('global', @id)
- #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id)))
- tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id),
- false, true)
- end
-
- def size
- INTERP._invoke_without_enc('global', @id)
- TkComm.number(INTERP._invoke_without_enc('array', 'size', @id))
+ tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id)))
end
def clear
@@ -439,6 +274,7 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
self
end
+
unless const_defined?(:USE_TCLs_SET_VARIABLE_FUNCTIONS)
USE_TCLs_SET_VARIABLE_FUNCTIONS = true
end
@@ -448,11 +284,10 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
# use Tcl function version of set tkvariable
###########################################################################
- def _value
+ def value
#if INTERP._eval("global #{@id}; array exist #{@id}") == '1'
INTERP._invoke_without_enc('global', @id)
- # if INTERP._invoke('array', 'exist', @id) == '1'
- if TkComm.bool(INTERP._invoke('array', 'exist', @id))
+ if INTERP._invoke('array', 'exist', @id) == '1'
#Hash[*tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))]
Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', @id))]
else
@@ -461,7 +296,6 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
end
def value=(val)
- val = val._value if !@type && @type != :variable && val.kind_of?(TkVariable)
if val.kind_of?(Hash)
self.clear
val.each{|k, v|
@@ -471,8 +305,7 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
_get_eval_string(v, true))
}
self.value
-# elsif val.kind_of?(Array)
-=begin
+ elsif val.kind_of?(Array)
INTERP._set_global_var(@id, '')
val.each{|v|
#INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
@@ -483,15 +316,13 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
TclTkLib::VarAccessFlag::LIST_ELEMENT)
}
self.value
-=end
-# _fromUTF8(INTERP._set_global_var(@id, array2tk_list(val, true)))
else
#_fromUTF8(INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val))))
_fromUTF8(INTERP._set_global_var(@id, _get_eval_string(val, true)))
end
end
- def _element_value(*idxs)
+ def [](*idxs)
index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
begin
_fromUTF8(INTERP._get_global_var2(@id, index))
@@ -512,8 +343,6 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
def []=(*args)
val = args.pop
- type = default_element_value_type(args)
- val = val._value if !type && type != :variable && val.kind_of?(TkVariable)
index = args.collect{|idx| _get_eval_string(idx, true)}.join(',')
_fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true)))
#_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)),
@@ -522,12 +351,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
# _get_eval_string(val, true)))
end
- def unset(*elems)
- if elems.empty?
- INTERP._unset_global_var(@id)
+ def unset(elem=nil)
+ if elem
+ INTERP._unset_global_var2(@id, _get_eval_string(elem, true))
else
- index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
- INTERP._unset_global_var2(@id, index)
+ INTERP._unset_global_var(@id)
end
end
alias remove unset
@@ -537,7 +365,7 @@ else
# use Ruby script version of set tkvariable (traditional methods)
###########################################################################
- def _value
+ def value
begin
INTERP._eval(Kernel.format('global %s; set %s', @id, @id))
#INTERP._eval(Kernel.format('set %s', @id))
@@ -556,7 +384,6 @@ else
end
def value=(val)
- val = val._value if !@type && @type != :variable && val.kind_of?(TkVariable)
begin
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
@@ -579,7 +406,7 @@ else
#INTERP._invoke_without_enc('unset', @id+'(0)')
elsif val.kind_of?(Array)
a = []
- val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e, true))}
+ val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
#s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
@@ -591,7 +418,7 @@ else
elsif val.kind_of?(Hash)
#s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
# .gsub(/[\[\]$"]/, '\\\\\&') + '"'
- s = '"' + val.to_a.collect{|e| array2tk_list(e, true)}.join(" ")\
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
.gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
@id, @id, @id, s))
@@ -606,7 +433,7 @@ else
end
end
- def _element_value(*idxs)
+ def [](*idxs)
index = idxs.collect{|idx| _get_eval_string(idx)}.join(',')
begin
INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index))
@@ -629,8 +456,6 @@ else
def []=(*args)
val = args.pop
- type = default_element_value_type(args)
- val = val._value if !type && type != :variable && val.kind_of?(TkVariable)
index = args.collect{|idx| _get_eval_string(idx)}.join(',')
INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
index, _get_eval_string(val)))
@@ -642,73 +467,26 @@ else
# _get_eval_string(val))
end
- def unset(*elems)
- if elems.empty?
+ def unset(elem=nil)
+ if elem
+ INTERP._eval(Kernel.format('global %s; unset %s(%s)',
+ @id, @id, _get_eval_string(elem)))
+ #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
+ #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
+ else
INTERP._eval(Kernel.format('global %s; unset %s', @id, @id))
#INTERP._eval(Kernel.format('unset %s', @id))
#INTERP._eval('unset ' + @id)
- else
- index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
- INTERP._eval(Kernel.format('global %s; unset %s(%s)', @id, @id, index))
- #INTERP._eval(Kernel.format('global %s; unset %s(%s)',
- # @id, @id, _get_eval_string(elem)))
- #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
- #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
end
end
alias remove unset
end
- protected :_value, :_element_value
-
- def value
- _to_default_type(_value)
- end
-
- def [](*idxs)
- _to_default_element_type(idxs, _element_value(*idxs))
- end
-
- def set_value(val)
- self.value = val
- self
- end
-
- def set_element_value(idxs, val)
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
-
- def set_value_type(val)
- self.default_value_type = val.class
- self.value = val
- self
- end
-
- alias value_type= set_value_type
-
- def set_element_value_type(idxs, val)
- self.set_default_element_value_type(idxs, val.class)
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
-
def numeric
- number(_value)
+ number(value)
end
- def numeric_element(*idxs)
- number(_element_value(*idxs))
- end
- def set_numeric(val)
+ def numeric=(val)
case val
when Numeric
self.value=(val)
@@ -717,52 +495,20 @@ end
else
raise ArgumentError, "Numeric is expected"
end
- self
- end
- alias numeric= set_numeric
- def set_numeric_element(idxs, val)
- case val
- when Numeric
- val
- when TkVariable
- val = val.numeric
- else
- raise ArgumentError, "Numeric is expected"
- end
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
- def set_numeric_type(val)
- @type = :numeric
- self.numeric=(val)
- self
- end
- alias numeric_type= set_numeric_type
- def set_numeric_element_type(idxs, val)
- self.set_default_element_value_type(idxs, :numeric)
- self.set_numeric_element(idxs, val)
+ val
end
def bool
- TkComm.bool(_value)
-=begin
# see Tcl_GetBoolean man-page
- case _value.downcase
+ case value.downcase
when '0', 'false', 'no', 'off'
false
else
true
end
-=end
end
- def bool_element(*idxs)
- TkComm.bool(_element_value(*idxs))
- end
- def set_bool(val)
+
+ def bool=(val)
if ! val
self.value = '0'
else
@@ -773,238 +519,32 @@ end
self.value = '1'
end
end
- self
- end
- alias bool= set_bool
- def set_bool_element(idxs, val)
- if ! val
- val = '0'
- else
- case val.to_s.downcase
- when 'false', '0', 'no', 'off'
- val = '0'
- else
- val = '1'
- end
- end
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
- def set_bool_type(val)
- @type = :bool
- self.bool=(val)
- self
- end
- alias bool_type= set_bool_type
- def set_bool_element_type(idxs, val)
- self.set_default_element_value_type(idxs, :bool)
- self.set_bool_element(idxs, val)
- end
-
- def variable
- # keeps a Tcl's variable name
- TkVarAccess.new(self._value)
- end
- def variable_element(*idxs)
- TkVarAccess.new(_element_value(*idxs))
- end
- def set_variable(var)
- var = var.id if var.kind_of?(TkVariable)
- self.value = var
- self
- end
- alias variable= set_variable
- def set_variable_element(idxs, var)
- var = var.id if var.kind_of?(TkVariable)
- if idxs.kind_of?(Array)
- self[*idxs]=var
- else
- self[idxs]=var
- end
- self
- end
- def set_variable_type(var)
- @type = :variable
- var = var.id if var.kind_of?(TkVariable)
- self.value = var
- self
- end
- alias variable_type= set_variable_type
- def set_variable_element_type(idxs, var)
- self.set_default_element_value_type(idxs, :variable)
- self.set_variable_element(idxs, var)
- end
-
- def window
- TkComm.window(self._value)
- end
- def window_element(*idxs)
- TkComm.window(_element_value(*idxs))
- end
- def set_window(win)
- win = win._value if win.kind_of?(TkVariable)
- self.value = win
- self
- end
- alias window= set_window
- def set_window_element(idxs, win)
- win = win._value if win.kind_of?(TkVariable)
- if idxs.kind_of?(Array)
- self[*idxs]=win
- else
- self[idxs]=win
- end
- self
- end
- def set_window_type(win)
- @type = :window
- self.window=(win)
- self
- end
- alias window_type= set_window_type
- def set_window_element_type(idxs, win)
- self.set_default_element_value_type(idxs, :window)
- self.set_window_element(idxs, win)
- end
-
- def procedure
- TkComm.procedure(self._value)
- end
- def procedure_element(*idxs)
- TkComm.procedure(_element_value(*idxs))
- end
- def set_procedure(cmd)
- self.value = cmd
- self
- end
- alias procedure= set_procedure
- def set_procedure_element(idxs, cmd)
- cmd = cmd._value if cmd.kind_of?(TkVariable)
- if idxs.kind_of?(Array)
- self[*idxs]=cmd
- else
- self[idxs]=cmd
- end
- self
- end
- def set_procedure_type(cmd)
- @type = :procedure
- self.procedure=(cmd)
- self
- end
- alias procedure_type= set_procedure_type
- def set_procedure_element_type(idxs, cmd)
- self.set_default_element_value_type(idxs, :procedure)
- self.set_proceure_element(idxs, cmd)
end
def to_i
- number(_value).to_i
- end
- def element_to_i(*idxs)
- number(_element_value(*idxs)).to_i
+ number(value).to_i
end
def to_f
- number(_value).to_f
- end
- def element_to_f(*idxs)
- number(_element_value(*idxs)).to_f
+ number(value).to_f
end
def to_s
#string(value).to_s
- _value
- end
- alias string to_s
- def element_to_s(*idxs)
- _element_value(*idxs)
- end
- def string_element(*idxs)
- _element_value(*idxs)
- end
- def set_string(val)
- val = val._value if val.kind_of?(TkVariable)
- self.value=val
- self
- end
- alias string= set_string
- def set_string_element(idxs, val)
- val = val._value if val.kind_of?(TkVariable)
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
- def set_string_type(val)
- @type = :string
- self.string=(val)
- self
- end
- alias string_type= set_string_type
- def set_string_element_type(idxs, val)
- self.set_default_element_value_type(idxs, :string)
- self.set_string_element(idxs, val)
+ value
end
def to_sym
- _value.intern
- end
- alias symbol to_sym
- def element_to_sym(*idxs)
- _element_value(*idxs).intern
- end
- alias symbol_element element_to_sym
- def set_symbol(val)
- val = val._value if val.kind_of?(TkVariable)
- self.value=val
- self
- end
- alias symbol= set_symbol
- def set_symbol_element(idxs, val)
- val = val._value if val.kind_of?(TkVariable)
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
- def set_symbol_type(val)
- @type = :symbol
- self.value=(val)
- self
- end
- alias symbol_type= set_symbol_type
- def set_symbol_element_type(idxs, val)
- self.set_default_element_value_type(idxs, :symbol)
- self.set_symbol_element(idxs, val)
+ value.intern
end
def list
#tk_split_list(value)
- tk_split_simplelist(_value)
+ tk_split_simplelist(value)
end
alias to_a list
- def list_element(*idxs)
- tk_split_simplelist(_element_value(*idxs))
- end
- alias element_to_a list_element
- def numlist
- list.collect!{|val| number(val)}
- end
- def numlist_element(*idxs)
- list_element(*idxs).collect!{|val| number(val)}
- end
-
- def set_list(val)
+ def list=(val)
case val
when Array
self.value=(val)
@@ -1013,102 +553,7 @@ end
else
raise ArgumentError, "Array is expected"
end
- self
- end
- alias list= set_list
-
- alias set_numlist set_list
- alias numlist= set_numlist
-
- def set_list_element(idxs, val)
- case val
- when Array
- val
- when TkVariable
- val = val.list
- else
- raise ArgumentError, "Array is expected"
- end
- if idxs.kind_of?(Array)
- self[*idxs]=val
- else
- self[idxs]=val
- end
- self
- end
- alias set_numlist_element set_list_element
-
- def set_list_type(val)
- @type = :list
- self.list=(val)
- self
- end
- alias list_type= set_list_type
- def set_list_element_type(idxs, val)
- self.set_default_element_value_type(idxs, :list)
- self.set_list_element(idxs, val)
- end
- def set_numlist_type(val)
- @type = :numlist
- self.numlist=(val)
- self
- end
- alias numlist_type= set_numlist_type
- def set_numlist_element_type(idxs, val)
- self.set_default_element_value_type(idxs, :numlist)
- self.set_numlist_element(idxs, val)
- end
-
- def lappend(*elems)
- tk_call('lappend', @id, *elems)
- self
- end
- def element_lappend(idxs, *elems)
- if idxs.kind_of?(Array)
- idxs = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
- end
- tk_call('lappend', "#{@id}(#{idxs})", *elems)
- self
- end
-
- def lindex(idx)
- tk_call('lindex', self._value, idx)
- end
- alias lget lindex
- def element_lindex(elem_idxs, idx)
- if elem_idxs.kind_of?(Array)
- val = _element_value(*elem_idxs)
- else
- val = _element_value(elem_idxs)
- end
- tk_call('lindex', val, idx)
- end
- alias element_lget element_lindex
-
- def lget_i(idx)
- number(lget(idx)).to_i
- end
- def element_lget_i(elem_idxs, idx)
- number(element_lget(elem_idxs, idx)).to_i
- end
-
- def lget_f(idx)
- number(lget(idx)).to_f
- end
- def element_lget_f(elem_idxs, idx)
- number(element_lget(elem_idxs, idx)).to_f
- end
-
- def lset(idx, val)
- tk_call('lset', @id, idx, val)
- self
- end
- def element_lset(elem_idxs, idx, val)
- if elem_idxs.kind_of?(Array)
- idxs = elem_idxs.collect{|i| _get_eval_string(i, true)}.join(',')
- end
- tk_call('lset', "#{@id}(#{idxs})", idx, val)
- self
+ val
end
def inspect
@@ -1119,7 +564,7 @@ end
def coerce(other)
case other
when TkVariable
- [other._value, self._value]
+ [other.value, self.value]
when String
[other, self.to_s]
when Symbol
@@ -1131,7 +576,7 @@ end
when Array
[other, self.to_a]
else
- [other, self._value]
+ [other, self.value]
end
end
@@ -1154,12 +599,12 @@ end
when Array
self.to_a + other
when String
- self._value + other
+ self.value + other
else
begin
- number(self._value) + other
+ number(self.value) + other
rescue
- self._value + other.to_s
+ self.value + other.to_s
end
end
end
@@ -1167,40 +612,37 @@ end
if other.kind_of?(Array)
self.to_a - other
else
- number(self._value) - other
+ number(self.value) - other
end
end
def *(other)
- num_or_str(self._value) * other.to_i
- #begin
- # number(self._value) * other
- #rescue
- # self._value * other
- #end
+ begin
+ number(self.value) * other
+ rescue
+ self.value * other
+ end
end
def /(other)
- number(self._value) / other
+ number(self.value) / other
end
def %(other)
- num_or_str(self._value) % other.to_i
- #begin
- # number(self._value) % other
- #rescue
- # self._value % other
- #end
+ begin
+ number(self.value) % other
+ rescue
+ self.value % other
+ end
end
def **(other)
- number(self._value) ** other
+ number(self.value) ** other
end
def =~(other)
- self._value =~ other
+ self.value =~ other
end
def ==(other)
case other
when TkVariable
- #self.equal?(other)
- self._value == other._value
+ self.equal?(other)
when String
self.to_s == other
when Symbol
@@ -1212,11 +654,9 @@ end
when Array
self.to_a == other
when Hash
- # false if self is not an assoc array
- self._value == other
+ self.value == other
else
- # false
- self._value == _get_eval_string(other)
+ false
end
end
@@ -1233,18 +673,17 @@ end
val = other.numeric
other = val
rescue
- other = other._value
+ other = other.value
end
- elsif other.kind_of?(Numeric)
+ end
+ if other.kind_of?(Numeric)
begin
return self.numeric <=> other
rescue
- return self._value <=> other.to_s
+ return self.value <=> other.to_s
end
- elsif other.kind_of?(Array)
- return self.list <=> other
else
- return self._value <=> other
+ return self.value <=> other
end
end
@@ -1266,14 +705,12 @@ end
def trace(opts, cmd = Proc.new)
@trace_var = [] if @trace_var == nil
#opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
- opts = opts.to_s
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
@trace_var.unshift([opts,cmd])
if @trace_opts == nil
TkVar_CB_TBL[@id] = self
@trace_opts = opts.dup
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1289,11 +726,9 @@ end
#opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
@trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1317,20 +752,15 @@ end
end
def trace_element(elem, opts, cmd = Proc.new)
- if @elem
- fail(RuntimeError,
- "invalid for a TkVariable which denotes an element of Tcl's array")
- end
@trace_elem = {} if @trace_elem == nil
@trace_elem[elem] = [] if @trace_elem[elem] == nil
- opts = opts.to_s
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
@trace_elem[elem].unshift([opts,cmd])
if @trace_opts == nil
TkVar_CB_TBL[@id] = self
@trace_opts = opts.dup
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1347,11 +777,9 @@ end
# opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
@trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1378,12 +806,7 @@ end
return [] unless @trace_var
@trace_var.dup
end
-
- def _trace_vinfo_for_element(elem)
- if @elem
- fail(RuntimeError,
- "invalid for a TkVariable which denotes an element of Tcl's array")
- end
+ def trace_vinfo_for_element(elem)
return [] unless @trace_elem
return [] unless @trace_elem[elem]
@trace_elem[elem].dup
@@ -1391,8 +814,8 @@ end
def trace_vdelete(opts,cmd)
return self unless @trace_var.kind_of? Array
- opts = opts.to_s
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
idx = -1
newopts = ''
@trace_var.each_with_index{|e,i|
@@ -1416,11 +839,10 @@ end
}
}
- newopts = newopts.to_s
- newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1434,8 +856,7 @@ end
=end
@trace_opts.replace(newopts)
if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1454,14 +875,10 @@ end
end
def trace_vdelete_for_element(elem,opts,cmd)
- if @elem
- fail(RuntimeError,
- "invalid for a TkVariable which denotes an element of Tcl's array")
- end
return self unless @trace_elem.kind_of? Hash
return self unless @trace_elem[elem].kind_of? Array
- opts = opts.to_s
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ # opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
idx = -1
@trace_elem[elem].each_with_index{|e,i|
if idx < 0 && e[0] == opts && e[1] == cmd
@@ -1487,11 +904,10 @@ end
}
}
- newopts = newopts.to_s
- newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1505,8 +921,7 @@ end
=end
@trace_opts.replace(newopts)
if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
# TCL_VERSION >= 8.4
@@ -1525,38 +940,15 @@ end
end
end
+
class TkVarAccess<TkVariable
def self.new(name, *args)
- if name.kind_of?(TkVariable)
- name.value = args[0] unless args.empty?
- return name
- end
-
- if v = TkVar_ID_TBL[name]
- v.value = args[0] unless args.empty?
- return v
- end
-
+ return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
super(name, *args)
end
def self.new_hash(name, *args)
- if name.kind_of?(TkVariable)
- unless name.is_hash?
- fail ArgumentError, "already exist as a scalar variable"
- end
- name.value = args[0] unless args.empty?
- return name
- end
-
- if v = TkVar_ID_TBL[name]
- unless v.is_hash?
- fail ArgumentError, "already exist as a scalar variable"
- end
- v.value = args[0] unless args.empty?
- return v
- end
-
+ return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
INTERP._invoke_without_enc('global', name)
if args.empty? && INTERP._invoke_without_enc('array', 'exist', name) == '0'
self.new(name, {}) # force creating
@@ -1569,9 +961,6 @@ class TkVarAccess<TkVariable
@id = varname
TkVar_ID_TBL[@id] = self
- @var = @id
- @elem = nil
-
@def_default = false
@default_val = nil
@@ -1579,31 +968,8 @@ class TkVarAccess<TkVariable
@trace_elem = nil
@trace_opts = nil
- @type = nil
- var = self
- @element_type = Hash.new{|k,v| var.default_value_type }
-
- # is an element?
- if @id =~ /^([^(]+)\((.+)\)$/
- # is an element --> var == $1, elem == $2
- @var = $1
- @elem = $2
- end
-
# teach Tk-ip that @id is global var
- INTERP._invoke_without_enc('global', @var)
-=begin
- begin
- INTERP._invoke_without_enc('global', @id)
- rescue => e
- if @id =~ /^(.+)\([^()]+\)$/
- # is an element --> varname == $1
- INTERP._invoke_without_enc('global', $1)
- else
- fail e
- end
- end
-=end
+ INTERP._invoke_without_enc('global', @id)
if val
if val.kind_of?(Hash)
@@ -1620,15 +986,14 @@ class TkVarAccess<TkVariable
end
end
+
module Tk
begin
- INTERP._invoke_without_enc('global', 'auto_path')
auto_path = INTERP._invoke('set', 'auto_path')
- rescue => e
+ rescue
begin
- INTERP._invoke_without_enc('global', 'env')
auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
- rescue => e
+ rescue
auto_path = Tk::LIBRARY
end
end
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
index d47e80aecd..a1a94d3c55 100644
--- a/ext/tk/lib/tk/virtevent.rb
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -15,19 +15,6 @@ class TkVirtualEvent<TkObject
TkCore::INTERP.init_ip_env{ TkVirtualEventTBL.clear }
class PreDefVirtEvent<self
- def self.new(event, *sequences)
- if event =~ /^<(<.*>)>$/
- event = $1
- elsif event !~ /^<.*>$/
- event = '<' + event + '>'
- end
- if TkVirtualEvent::TkVirtualEventTBL.has_key?(event)
- TkVirtualEvent::TkVirtualEventTBL[event]
- else
- super(event, *sequences)
- end
- end
-
def initialize(event, *sequences)
@path = @id = event
TkVirtualEvent::TkVirtualEventTBL[@id] = self
@@ -102,5 +89,3 @@ class TkVirtualEvent<TkObject
}
end
end
-
-TkNamedVirtualEvent = TkVirtualEvent::PreDefVirtEvent
diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb
index c649b4a0c9..948042558d 100644
--- a/ext/tk/lib/tk/winfo.rb
+++ b/ext/tk/lib/tk/winfo.rb
@@ -36,30 +36,30 @@ module TkWinfo
TkWinfo.atomname(id, self)
end
- def TkWinfo.cells(win)
- number(tk_call_without_enc('winfo', 'cells', win))
+ def TkWinfo.cells(window)
+ number(tk_call_without_enc('winfo', 'cells', window))
end
def winfo_cells
TkWinfo.cells self
end
- def TkWinfo.children(win)
- list(tk_call_without_enc('winfo', 'children', win))
+ def TkWinfo.children(window)
+ list(tk_call_without_enc('winfo', 'children', window))
end
def winfo_children
TkWinfo.children self
end
- def TkWinfo.classname(win)
- tk_call_without_enc('winfo', 'class', win)
+ def TkWinfo.classname(window)
+ tk_call_without_enc('winfo', 'class', window)
end
def winfo_classname
TkWinfo.classname self
end
alias winfo_class winfo_classname
- def TkWinfo.colormapfull(win)
- bool(tk_call_without_enc('winfo', 'colormapfull', win))
+ def TkWinfo.colormapfull(window)
+ bool(tk_call_without_enc('winfo', 'colormapfull', window))
end
def winfo_colormapfull
TkWinfo.colormapfull self
@@ -77,88 +77,83 @@ module TkWinfo
TkWinfo.containing(x, y, self)
end
- def TkWinfo.depth(win)
- number(tk_call_without_enc('winfo', 'depth', win))
+ def TkWinfo.depth(window)
+ number(tk_call_without_enc('winfo', 'depth', window))
end
def winfo_depth
TkWinfo.depth self
end
- def TkWinfo.exist?(win)
- bool(tk_call_without_enc('winfo', 'exists', win))
+ def TkWinfo.exist?(window)
+ bool(tk_call_without_enc('winfo', 'exists', window))
end
def winfo_exist?
TkWinfo.exist? self
end
- def TkWinfo.fpixels(win, dist)
- number(tk_call_without_enc('winfo', 'fpixels', win, dist))
+ def TkWinfo.fpixels(window, dist)
+ number(tk_call_without_enc('winfo', 'fpixels', window, dist))
end
def winfo_fpixels(dist)
TkWinfo.fpixels self, dist
end
- def TkWinfo.geometry(win)
- tk_call_without_enc('winfo', 'geometry', win)
+ def TkWinfo.geometry(window)
+ tk_call_without_enc('winfo', 'geometry', window)
end
def winfo_geometry
TkWinfo.geometry self
end
- def TkWinfo.height(win)
- number(tk_call_without_enc('winfo', 'height', win))
+ def TkWinfo.height(window)
+ number(tk_call_without_enc('winfo', 'height', window))
end
def winfo_height
TkWinfo.height self
end
- def TkWinfo.id(win)
- tk_call_without_enc('winfo', 'id', win)
+ def TkWinfo.id(window)
+ tk_call_without_enc('winfo', 'id', window)
end
def winfo_id
TkWinfo.id self
end
- def TkWinfo.interps(win=nil)
- if win
- #tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
- # '-displayof', win))
+ def TkWinfo.interps(window=nil)
+ if window
tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
- '-displayof', win),
- false, true)
+ '-displayof', window))
else
- #tk_split_simplelist(tk_call_without_enc('winfo', 'interps'))
- tk_split_simplelist(tk_call_without_enc('winfo', 'interps'),
- false, true)
+ tk_split_simplelist(tk_call_without_enc('winfo', 'interps'))
end
end
def winfo_interps
TkWinfo.interps self
end
- def TkWinfo.mapped?(win)
- bool(tk_call_without_enc('winfo', 'ismapped', win))
+ def TkWinfo.mapped?(window)
+ bool(tk_call_without_enc('winfo', 'ismapped', window))
end
def winfo_mapped?
TkWinfo.mapped? self
end
- def TkWinfo.manager(win)
- tk_call_without_enc('winfo', 'manager', win)
+ def TkWinfo.manager(window)
+ tk_call_without_enc('winfo', 'manager', window)
end
def winfo_manager
TkWinfo.manager self
end
- def TkWinfo.appname(win)
- tk_call('winfo', 'name', win)
+ def TkWinfo.appname(window)
+ tk_call('winfo', 'name', window)
end
def winfo_appname
TkWinfo.appname self
end
- def TkWinfo.parent(win)
- window(tk_call_without_enc('winfo', 'parent', win))
+ def TkWinfo.parent(window)
+ window(tk_call_without_enc('winfo', 'parent', window))
end
def winfo_parent
TkWinfo.parent self
@@ -175,216 +170,216 @@ module TkWinfo
TkWinfo.widget id, self
end
- def TkWinfo.pixels(win, dist)
- number(tk_call_without_enc('winfo', 'pixels', win, dist))
+ def TkWinfo.pixels(window, dist)
+ number(tk_call_without_enc('winfo', 'pixels', window, dist))
end
def winfo_pixels(dist)
TkWinfo.pixels self, dist
end
- def TkWinfo.reqheight(win)
- number(tk_call_without_enc('winfo', 'reqheight', win))
+ def TkWinfo.reqheight(window)
+ number(tk_call_without_enc('winfo', 'reqheight', window))
end
def winfo_reqheight
TkWinfo.reqheight self
end
- def TkWinfo.reqwidth(win)
- number(tk_call_without_enc('winfo', 'reqwidth', win))
+ def TkWinfo.reqwidth(window)
+ number(tk_call_without_enc('winfo', 'reqwidth', window))
end
def winfo_reqwidth
TkWinfo.reqwidth self
end
- def TkWinfo.rgb(win, color)
- list(tk_call_without_enc('winfo', 'rgb', win, color))
+ def TkWinfo.rgb(window, color)
+ list(tk_call_without_enc('winfo', 'rgb', window, color))
end
def winfo_rgb(color)
TkWinfo.rgb self, color
end
- def TkWinfo.rootx(win)
- number(tk_call_without_enc('winfo', 'rootx', win))
+ def TkWinfo.rootx(window)
+ number(tk_call_without_enc('winfo', 'rootx', window))
end
def winfo_rootx
TkWinfo.rootx self
end
- def TkWinfo.rooty(win)
- number(tk_call_without_enc('winfo', 'rooty', win))
+ def TkWinfo.rooty(window)
+ number(tk_call_without_enc('winfo', 'rooty', window))
end
def winfo_rooty
TkWinfo.rooty self
end
- def TkWinfo.screen(win)
- tk_call('winfo', 'screen', win)
+ def TkWinfo.screen(window)
+ tk_call('winfo', 'screen', window)
end
def winfo_screen
TkWinfo.screen self
end
- def TkWinfo.screencells(win)
- number(tk_call_without_enc('winfo', 'screencells', win))
+ def TkWinfo.screencells(window)
+ number(tk_call_without_enc('winfo', 'screencells', window))
end
def winfo_screencells
TkWinfo.screencells self
end
- def TkWinfo.screendepth(win)
- number(tk_call_without_enc('winfo', 'screendepth', win))
+ def TkWinfo.screendepth(window)
+ number(tk_call_without_enc('winfo', 'screendepth', window))
end
def winfo_screendepth
TkWinfo.screendepth self
end
- def TkWinfo.screenheight (win)
- number(tk_call_without_enc('winfo', 'screenheight', win))
+ def TkWinfo.screenheight (window)
+ number(tk_call_without_enc('winfo', 'screenheight', window))
end
def winfo_screenheight
TkWinfo.screenheight self
end
- def TkWinfo.screenmmheight(win)
- number(tk_call_without_enc('winfo', 'screenmmheight', win))
+ def TkWinfo.screenmmheight(window)
+ number(tk_call_without_enc('winfo', 'screenmmheight', window))
end
def winfo_screenmmheight
TkWinfo.screenmmheight self
end
- def TkWinfo.screenmmwidth(win)
- number(tk_call_without_enc('winfo', 'screenmmwidth', win))
+ def TkWinfo.screenmmwidth(window)
+ number(tk_call_without_enc('winfo', 'screenmmwidth', window))
end
def winfo_screenmmwidth
TkWinfo.screenmmwidth self
end
- def TkWinfo.screenvisual(win)
- tk_call_without_enc('winfo', 'screenvisual', win)
+ def TkWinfo.screenvisual(window)
+ tk_call_without_enc('winfo', 'screenvisual', window)
end
def winfo_screenvisual
TkWinfo.screenvisual self
end
- def TkWinfo.screenwidth(win)
- number(tk_call_without_enc('winfo', 'screenwidth', win))
+ def TkWinfo.screenwidth(window)
+ number(tk_call_without_enc('winfo', 'screenwidth', window))
end
def winfo_screenwidth
TkWinfo.screenwidth self
end
- def TkWinfo.server(win)
- tk_call('winfo', 'server', win)
+ def TkWinfo.server(window)
+ tk_call('winfo', 'server', window)
end
def winfo_server
TkWinfo.server self
end
- def TkWinfo.toplevel(win)
- window(tk_call_without_enc('winfo', 'toplevel', win))
+ def TkWinfo.toplevel(window)
+ window(tk_call_without_enc('winfo', 'toplevel', window))
end
def winfo_toplevel
TkWinfo.toplevel self
end
- def TkWinfo.visual(win)
- tk_call_without_enc('winfo', 'visual', win)
+ def TkWinfo.visual(window)
+ tk_call_without_enc('winfo', 'visual', window)
end
def winfo_visual
TkWinfo.visual self
end
- def TkWinfo.visualid(win)
- tk_call_without_enc('winfo', 'visualid', win)
+ def TkWinfo.visualid(window)
+ tk_call_without_enc('winfo', 'visualid', window)
end
def winfo_visualid
TkWinfo.visualid self
end
- def TkWinfo.visualsavailable(win, includeids=false)
+ def TkWinfo.visualsavailable(window, includeids=false)
if includeids
list(tk_call_without_enc('winfo', 'visualsavailable',
- win, "includeids"))
+ window, "includeids"))
else
- list(tk_call_without_enc('winfo', 'visualsavailable', win))
+ list(tk_call_without_enc('winfo', 'visualsavailable', window))
end
end
def winfo_visualsavailable(includeids=false)
TkWinfo.visualsavailable self, includeids
end
- def TkWinfo.vrootheight(win)
- number(tk_call_without_enc('winfo', 'vrootheight', win))
+ def TkWinfo.vrootheight(window)
+ number(tk_call_without_enc('winfo', 'vrootheight', window))
end
def winfo_vrootheight
TkWinfo.vrootheight self
end
- def TkWinfo.vrootwidth(win)
- number(tk_call_without_enc('winfo', 'vrootwidth', win))
+ def TkWinfo.vrootwidth(window)
+ number(tk_call_without_enc('winfo', 'vrootwidth', window))
end
def winfo_vrootwidth
TkWinfo.vrootwidth self
end
- def TkWinfo.vrootx(win)
- number(tk_call_without_enc('winfo', 'vrootx', win))
+ def TkWinfo.vrootx(window)
+ number(tk_call_without_enc('winfo', 'vrootx', window))
end
def winfo_vrootx
TkWinfo.vrootx self
end
- def TkWinfo.vrooty(win)
- number(tk_call_without_enc('winfo', 'vrooty', win))
+ def TkWinfo.vrooty(window)
+ number(tk_call_without_enc('winfo', 'vrooty', window))
end
def winfo_vrooty
TkWinfo.vrooty self
end
- def TkWinfo.width(win)
- number(tk_call_without_enc('winfo', 'width', win))
+ def TkWinfo.width(window)
+ number(tk_call_without_enc('winfo', 'width', window))
end
def winfo_width
TkWinfo.width self
end
- def TkWinfo.x(win)
- number(tk_call_without_enc('winfo', 'x', win))
+ def TkWinfo.x(window)
+ number(tk_call_without_enc('winfo', 'x', window))
end
def winfo_x
TkWinfo.x self
end
- def TkWinfo.y(win)
- number(tk_call_without_enc('winfo', 'y', win))
+ def TkWinfo.y(window)
+ number(tk_call_without_enc('winfo', 'y', window))
end
def winfo_y
TkWinfo.y self
end
- def TkWinfo.viewable(win)
- bool(tk_call_without_enc('winfo', 'viewable', win))
+ def TkWinfo.viewable(window)
+ bool(tk_call_without_enc('winfo', 'viewable', window))
end
def winfo_viewable
TkWinfo.viewable self
end
- def TkWinfo.pointerx(win)
- number(tk_call_without_enc('winfo', 'pointerx', win))
+ def TkWinfo.pointerx(window)
+ number(tk_call_without_enc('winfo', 'pointerx', window))
end
def winfo_pointerx
TkWinfo.pointerx self
end
- def TkWinfo.pointery(win)
- number(tk_call_without_enc('winfo', 'pointery', win))
+ def TkWinfo.pointery(window)
+ number(tk_call_without_enc('winfo', 'pointery', window))
end
def winfo_pointery
TkWinfo.pointery self
end
- def TkWinfo.pointerxy(win)
- list(tk_call_without_enc('winfo', 'pointerxy', win))
+ def TkWinfo.pointerxy(window)
+ list(tk_call_without_enc('winfo', 'pointerxy', window))
end
def winfo_pointerxy
TkWinfo.pointerxy self
diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb
index 737fb959b5..d6f7a0e9d4 100644
--- a/ext/tk/lib/tk/winpkg.rb
+++ b/ext/tk/lib/tk/winpkg.rb
@@ -13,11 +13,6 @@ module TkWinDDE
TkCommandNames = ['dde'.freeze].freeze
- PACKAGE_NAME = 'dde'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
if self.const_defined? :FORCE_VERSION
tk_call_without_enc('package', 'require', 'dde', FORCE_VERSION)
else
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
index 1f432a3848..a2be51248d 100644
--- a/ext/tk/lib/tk/wm.rb
+++ b/ext/tk/lib/tk/wm.rb
@@ -9,18 +9,14 @@ module Tk
TkCommandNames = ['wm'.freeze].freeze
- TOPLEVEL_METHODCALL_OPTKEYS = {}
-
def aspect(*args)
if args.length == 0
list(tk_call_without_enc('wm', 'aspect', path))
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call('wm', 'aspect', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['aspect'] = 'aspect'
def attributes(slot=nil,value=None)
if slot == nil
@@ -40,7 +36,6 @@ module Tk
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['attributes'] = 'attributes'
def client(name=None)
if name == None
@@ -51,18 +46,15 @@ module Tk
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['client'] = 'client'
def colormapwindows(*args)
if args.size == 0
list(tk_call_without_enc('wm', 'colormapwindows', path))
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call_without_enc('wm', 'colormapwindows', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['colormapwindows'] = 'colormapwindows'
def wm_command(value=nil)
if value
@@ -73,14 +65,9 @@ module Tk
tk_call('wm', 'command', path)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['wm_command'] = 'wm_command'
def deiconify(ex = true)
- if ex
- tk_call_without_enc('wm', 'deiconify', path)
- else
- self.iconify
- end
+ tk_call_without_enc('wm', 'deiconify', path) if ex
self
end
@@ -92,7 +79,6 @@ module Tk
tk_call_without_enc('wm', 'focusmodel', path)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['focusmodel'] = 'focusmodel'
def frame
tk_call_without_enc('wm', 'frame', path)
@@ -106,18 +92,15 @@ module Tk
tk_call_without_enc('wm', 'geometry', path)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['geometry'] = 'geometry'
def wm_grid(*args)
if args.size == 0
list(tk_call_without_enc('wm', 'grid', path))
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call_without_enc('wm', 'grid', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['wm_grid'] = 'wm_grid'
def group(leader = nil)
if leader
@@ -127,7 +110,6 @@ module Tk
window(tk_call('wm', 'group', path))
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['group'] = 'group'
def iconbitmap(bmp=nil)
if bmp
@@ -137,33 +119,21 @@ module Tk
image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['iconbitmap'] = 'iconbitmap'
def iconphoto(*imgs)
- if imgs.empty?
- @wm_iconphoto = nil unless defined? @wm_iconphoto
- return @wm_iconphoto
- end
-
- imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
+ # Windows only
tk_call_without_enc('wm', 'iconphoto', path, *imgs)
- @wm_iconphoto = imgs
self
end
- TOPLEVEL_METHODCALL_OPTKEYS['iconphoto'] = 'iconphoto'
def iconphoto_default(*imgs)
- imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
+ # Windows only
tk_call_without_enc('wm', 'iconphoto', path, '-default', *imgs)
self
end
def iconify(ex = true)
- if ex
- tk_call_without_enc('wm', 'iconify', path)
- else
- self.deiconify
- end
+ tk_call_without_enc('wm', 'iconify', path) if ex
self
end
@@ -175,7 +145,6 @@ module Tk
image_obj(tk_call_without_enc('wm', 'iconmask', path))
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['iconmask'] = 'iconmask'
def iconname(name=nil)
if name
@@ -185,18 +154,15 @@ module Tk
tk_call('wm', 'iconname', path)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['iconname'] = 'iconname'
def iconposition(*args)
if args.size == 0
list(tk_call_without_enc('wm', 'iconposition', path))
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call_without_enc('wm', 'iconposition', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['iconposition'] = 'iconposition'
def iconwindow(win = nil)
if win
@@ -207,39 +173,33 @@ module Tk
(w == '')? nil: window(w)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['iconwindow'] = 'iconwindow'
def maxsize(*args)
if args.size == 0
list(tk_call_without_enc('wm', 'maxsize', path))
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call_without_enc('wm', 'maxsize', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['maxsize'] = 'maxsize'
def minsize(*args)
if args.size == 0
list(tk_call_without_enc('wm', 'minsize', path))
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call_without_enc('wm', 'minsize', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['minsize'] = 'minsize'
- def overrideredirect(mode=None)
- if mode == None
+ def overrideredirect(bool=None)
+ if bool == None
bool(tk_call_without_enc('wm', 'overrideredirect', path))
else
- tk_call_without_enc('wm', 'overrideredirect', path, mode)
+ tk_call_without_enc('wm', 'overrideredirect', path, bool)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['overrideredirect'] = 'overrideredirect'
def positionfrom(who=None)
if who == None
@@ -250,7 +210,6 @@ module Tk
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['positionfrom'] = 'positionfrom'
def protocol(name=nil, cmd=nil, &b)
if cmd
@@ -267,33 +226,14 @@ module Tk
end
end
- def protocols(kv=nil)
- unless kv
- ret = {}
- self.protocol.each{|name|
- ret[name] = self.protocol(name)
- }
- return ret
- end
-
- unless kv.kind_of?(Hash)
- fail ArgumentError, 'expect a hash of protocol=>command'
- end
- kv.each{|k, v| self.protocol(k, v)}
- self
- end
- TOPLEVEL_METHODCALL_OPTKEYS['protocols'] = 'protocols'
-
def resizable(*args)
if args.length == 0
list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
else
- args = args[0] if args.length == 1 && args[0].kind_of?(Array)
tk_call_without_enc('wm', 'resizable', path, *args)
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['resizable'] = 'resizable'
def sizefrom(who=None)
if who == None
@@ -304,7 +244,6 @@ module Tk
self
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['sizefrom'] = 'sizefrom'
def stackorder
list(tk_call('wm', 'stackorder', path))
@@ -318,15 +257,14 @@ module Tk
bool(tk_call('wm', 'stackorder', path, 'isbelow', win))
end
- def state(st=nil)
- if st
- tk_call_without_enc('wm', 'state', path, st)
+ def state(state=nil)
+ if state
+ tk_call_without_enc('wm', 'state', path, state)
self
else
tk_call_without_enc('wm', 'state', path)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['state'] = 'state'
def title(str=nil)
if str
@@ -336,7 +274,6 @@ module Tk
tk_call('wm', 'title', path)
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['title'] = 'title'
def transient(master=nil)
if master
@@ -346,14 +283,9 @@ module Tk
window(tk_call_without_enc('wm', 'transient', path))
end
end
- TOPLEVEL_METHODCALL_OPTKEYS['transient'] = 'transient'
def withdraw(ex = true)
- if ex
- tk_call_without_enc('wm', 'withdraw', path)
- else
- self.deiconify
- end
+ tk_call_without_enc('wm', 'withdraw', path) if ex
self
end
end
diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb
index 0ac8559bb9..701cd7531c 100644
--- a/ext/tk/lib/tk/xim.rb
+++ b/ext/tk/lib/tk/xim.rb
@@ -9,34 +9,34 @@ module TkXIM
TkCommandNames = ['imconfigure'.freeze].freeze
- def TkXIM.useinputmethods(value = None, win = nil)
+ def TkXIM.useinputmethods(value = None, window = nil)
if value == None
- if win
+ if window
bool(tk_call_without_enc('tk', 'useinputmethods',
- '-displayof', win))
+ '-displayof', window))
else
bool(tk_call_without_enc('tk', 'useinputmethods'))
end
else
- if win
+ if window
bool(tk_call_without_enc('tk', 'useinputmethods',
- '-displayof', win, value))
+ '-displayof', window, value))
else
bool(tk_call_without_enc('tk', 'useinputmethods', value))
end
end
end
- def TkXIM.useinputmethods_displayof(win, value = None)
- TkXIM.useinputmethods(value, win)
+ def TkXIM.useinputmethods_displayof(window, value = None)
+ TkXIM.useinputmethods(value, window)
end
- def TkXIM.caret(win, keys=nil)
+ def TkXIM.caret(window, keys=nil)
if keys
- tk_call_without_enc('tk', 'caret', win, *hash_kv(keys))
+ tk_call_without_enc('tk', 'caret', window, *hash_kv(keys))
self
else
- lst = tk_split_list(tk_call_without_enc('tk', 'caret', win))
+ lst = tk_split_list(tk_call_without_enc('tk', 'caret', window))
info = {}
while key = lst.shift
info[key[1..-1]] = lst.shift
@@ -45,29 +45,29 @@ module TkXIM
end
end
- def TkXIM.configure(win, slot, value=None)
+ def TkXIM.configure(window, slot, value=None)
begin
if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
if slot.kind_of? Hash
- tk_call('imconfigure', win, *hash_kv(slot))
+ tk_call('imconfigure', window, *hash_kv(slot))
else
- tk_call('imconfigure', win, "-#{slot}", value)
+ tk_call('imconfigure', window, "-#{slot}", value)
end
end
rescue
end
end
- def TkXIM.configinfo(win, slot=nil)
+ def TkXIM.configinfo(window, slot=nil)
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
begin
if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
if slot
- conf = tk_split_list(tk_call('imconfigure', win, "-#{slot}"))
+ conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
conf[0] = conf[0][1..-1]
conf
else
- tk_split_list(tk_call('imconfigure', win)).collect{|conf|
+ tk_split_list(tk_call('imconfigure', window)).collect{|conf|
conf[0] = conf[0][1..-1]
conf
}
@@ -79,19 +79,19 @@ module TkXIM
[]
end
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
- TkXIM.current_configinfo(win, slot)
+ TkXIM.current_configinfo(window, slot)
end
end
- def TkXIM.current_configinfo(win, slot=nil)
+ def TkXIM.current_configinfo(window, slot=nil)
begin
if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
if slot
- conf = tk_split_list(tk_call('imconfigure', win, "-#{slot}"))
+ conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
{ conf[0][1..-1] => conf[1] }
else
ret = {}
- tk_split_list(tk_call('imconfigure', win)).each{|conf|
+ tk_split_list(tk_call('imconfigure', window)).each{|conf|
ret[conf[0][1..-1]] = conf[1]
}
ret
diff --git a/ext/tk/lib/tkclass.rb b/ext/tk/lib/tkclass.rb
index 355b1a1b1d..87f5acc453 100644
--- a/ext/tk/lib/tkclass.rb
+++ b/ext/tk/lib/tkclass.rb
@@ -3,7 +3,7 @@
# Date: 2000/11/27 09:23:36
# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
-# $Id: tkclass.rb,v 1.6.2.1 2004/10/11 04:51:06 nagai Exp $
+# $Id$
require "tk"
diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb
index b430bae55d..20d706df65 100644
--- a/ext/tk/lib/tkextlib/ICONS/icons.rb
+++ b/ext/tk/lib/tkextlib/ICONS/icons.rb
@@ -18,11 +18,6 @@ module Tk
class ICONS < TkImage
extend Tk
- PACKAGE_NAME = 'icons'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('icons')
@@ -75,26 +70,10 @@ module Tk
##########################################
- class << self
- alias _new new
-
- def new(name, keys=nil)
- if obj = Tk_IMGTBL["::icon::#{name}"]
- if keys
- keys = _symbolkey2str(keys)
- unless keys.delete('without_creating')
- tk_call('::icons::icons', 'create', *(hash_kv(keys) << obj.name))
- end
- end
- else
- obj = _new(name, keys)
- end
- obj
- end
+ def self.new(name, keys=nil)
+ Tk_IMGTBL["::icon::#{name}"] || super
end
- ##########################################
-
def initialize(name, keys=nil)
if name.kind_of?(String) && name =~ /^::icon::(.+)$/
@name = $1
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index 8d7b6fc44a..6bc87bab98 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -1,8 +1,6 @@
[ current support status of Tcl/Tk extensions ]
- *******<<< RELEASE_DATE of the libraries : 2005/12/11 >>>*******
-
The following list shows *CURRENT* status when this file was modifyed
at last. If you want to add other Tcl/Tk extensions to the planed list
(or change its status position), please request them at the ruby-talk,
@@ -20,13 +18,6 @@ script may give you some hints about that.
'not support' does *NOT* mean that the extension doesn't work
on Ruby/Tk.
- The version number of each extension means the latest version
- which is checked its feature. That is, it does NOT means only
- version of working. Library files maybe include some features
- which is included in the former version but removed from the
- latest, and maybe able to support the later version then the
- shown version.
-
Even if the status of the extension is 'not support', you can
control the functions/widgets of the extension without wrapper
libraries by Tk.tk_call(), Tk.ip_eval(), and so on.
@@ -55,142 +46,128 @@ script may give you some hints about that.
===< support with some examples (may be beta quality) >=======================
-Tcllib 1.8
-Tklib 0.4.1 http://sf.net/projects/tcllib ==> tcllib
-
-IWidgets 4.0.2 http://sf.net/projects/incrTcl ==> iwidgets
-
-BWidgets 1.7 http://sf.net/projects/tcllib ==> bwidget
-
-TkTable 2.9 http://sf.net/projects/tktable ==> tktable
- * see also <http://www.korus.hu/~fery/ruby/tktable.rb>
- written by Ferenc Engard (ferenc@engard.hu)
+Tcllib http://sf.net/projects/tcllib
+ ==> tcllib (partial support; Tklib part only)
-vu 2.3.0 http://tktable.sourceforge.net ==> vu
+IWidgets http://sf.net/projects/incrTcl ==> iwidgets
-TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/index.html ==> tkHTML
+BWidgets http://sf.net/projects/tcllib ==> bwidget
-ICONS 1.0 http://www.satisoft.com/tcltk/icons/ ==> ICONS
+TkTable http://sf.net/projects/tktable ==> tktable
+ [ * see also <http://www.korus.hu/~fery/ruby/tktable.rb>
+ written by Ferenc Engard (ferenc@engard.hu) ]
-TkImg 1.3 http://sf.net/projects/tkimg ==> tkimg
+vu http://tktable.sourceforge.net ==> vu
+TkHTML http://www.hwaci.com/sw/tkhtml/index.html ==> tkHTML
-BLT 2.4z http://sourceforge.net/projects/blt
- * see also tcltk-ext library on RAA
- (http://raa.ruby-lang.org/)
- ==> blt
+ICONS http://www.satisoft.com/tcltk/icons/ ==> ICONS
-TkTreeCtrl CVS/Hd(2005-12-02)
- http://tktreectrl.sourceforge.net/ ==> treectrl
-Tile CVS/Hd(2005-12-07)
- http://tktable.sourceforge.net/tile/ ==> tile
+===< support (may be alpha or beta quality) >=================================
+IncrTcl http://sf.net/projects/incrTcl ==> itcl, itk
-===< support (may be alpha or beta quality) >=================================
+TclX http://sf.net/projects/tclx
+ ==> tclx (partial support; infox command and
+ XPG/3 message catalogs only)
-IncrTcl CVS/Hd(2005-02-14)
- http://sf.net/projects/incrTcl ==> itcl, itk
+TkImg http://sf.net/projects/tkimg ==> tkimg
-TclX CVS/Hd(2005-02-07)
- http://sf.net/projects/tclx
- ==> tclx (partial support; infox command and
- XPG/3 message catalogs only)
+TkTreeCtrl http://tktreectrl.sourceforge.net/ ==> treectrl
-Trofs 0.4.3 http://math.nist.gov/~DPorter/tcltk/trofs/
+Tile http://tktable.sourceforge.net/tile/ ==> tile
===< possibly available (not tested; alpha quality) >=========================
-winico 0.6
- http://tktable.sourceforge.net
- ==> winico (win32 only)
+winico http://tktable.sourceforge.net
+ ==> winico (win32 only)
-TkTrans latest(2004-10-11)
- http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html
- ==> tktrans (win32 only)
+TkTrans http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html
+ ==> tktrans (win32 only)
-TkDND 1.0a2 http://sourceforge.net/projects/tkdnd ==> tkDND
+TkDND http://sourceforge.net/projects/tkdnd ==> tkDND
===< plan to support (alpha quality libraries may be included) >==============
-GraphViz *** http://www.graphviz.org/
+BLT http://sourceforge.net/projects/blt
+ * see tcltk-ext library on RAA (http://raa.ruby-lang.org/)
-Tkgeomap *** http://tkgeomap.sourceforge.net/index.html
+GraphViz http://www.graphviz.org/
+
+Tkgeomap http://tkgeomap.sourceforge.net/index.html
===< not determined to supprt or not >========================================
-Tix *** http://tixlibrary.sourceforge.net/
- * see also tcltk-ext library on RAA
- (http://raa.ruby-lang.org/)
+Tix http://tixlibrary.sourceforge.net/
+ * see tcltk-ext library on RAA (http://raa.ruby-lang.org/)
-TkZinc *** http://www.tkzinc.org/
+TkZinc http://www.tkzinc.org/
-Wbc *** http://home.t-online.de/home/csaba.nemethi/
+Wbc http://home.t-online.de/home/csaba.nemethi/
-Mentry *** http://home.t-online.de/home/csaba.nemethi/
+Mentry http://home.t-online.de/home/csaba.nemethi/
-Tablelist *** http://home.t-online.de/home/csaba.nemethi/
+Tablelist http://home.t-online.de/home/csaba.nemethi/
-ANIGIF *** http://cardtable.sourceforge.net/tcltk/
+ANIGIF http://cardtable.sourceforge.net/tcltk/
-IMG_ROTATE *** http://cardtable.sourceforge.net/tcltk/
+IMG_ROTATE http://cardtable.sourceforge.net/tcltk/
-TclVfs *** http://sourceforge.net/projects/tclvfs/
+TclVfs http://sourceforge.net/projects/tclvfs/
-vfwtcl *** http://sourceforge.net/projects/avicaptcl
- * Win32 only
+vfwtcl http://sourceforge.net/projects/avicaptcl
+ * Win32 only
-multicast *** http://sourceforge.net/projects/avicaptcl
- * Win32 only
+multicast http://sourceforge.net/projects/avicaptcl
+ * Win32 only
-XBit *** http://www.geocities.com/~chengye/
- * current implementation is for Windows only
+XBit http://www.geocities.com/~chengye/
+ * current implementation is for Windows only
-QuickTimeTcl *** http://hem.fyristorg.com/matben/qt/
- * works under Mac OS (8,9,X) or Windows
+QuickTimeTcl http://hem.fyristorg.com/matben/qt/
+ * works under Mac OS (8,9,X) or Windows
===< may not support (already exist, out of Ruby/Tk scope, and so on) >=======
-TkCon *** http://sf.net/projects/tkcon
+TkCon http://sf.net/projects/tkcon
-Expect *** http://sf.net/projects/expect
+Expect http://sf.net/projects/expect
-TclXML *** http://sf.net/projects/tclxml
+TclXML http://sf.net/projects/tclxml
-TclXSLT *** http://sf.net/projects/tclxml
+TclXSLT http://sf.net/projects/tclxml
-TclDOM *** http://sf.net/projects/tclxml
+TclDOM http://sf.net/projects/tclxml
-TclSOAP *** http://sf.net/projects/tclsoap
+TclSOAP http://sf.net/projects/tclsoap
-Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz
- * use Snack for Ruby
- (see http://rbsnack.sourceforge.net/)
+Snack http://www.speech.kth.se/~kare/snack2.2.tar.gz
+ * use Snack for Ruby (see http://rbsnack.sourceforge.net/)
-Tcom *** http://www.vex.net/~cthuang/tcom/
+Tcom http://www.vex.net/~cthuang/tcom/
-tDOM *** http://www.tdom.org
+tDOM http://www.tdom.org
-Mk4tcl *** http://www.equi4.com/metakit/tcl.html
+Mk4tcl http://www.equi4.com/metakit/tcl.html
-Memchan *** http://memchan.sourceforge.net/
+Memchan http://memchan.sourceforge.net/
-XOTcl *** http://www.xotcl.org/
===< tool (may not supprt) >==================================================
-tbcload/tclcompiler
- *** http://www.tcl.tk/software/tclpro/
+tbcload/tclcompiler http://www.tcl.tk/software/tclpro/
+
-(End of List)
+(End of List) \ No newline at end of file
diff --git a/ext/tk/lib/tkextlib/blt.rb b/ext/tk/lib/tkextlib/blt.rb
deleted file mode 100644
index 8ac8605513..0000000000
--- a/ext/tk/lib/tkextlib/blt.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-#
-# BLT support
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/variable'
-
-# call setup script for general 'tkextlib' libraries
-require 'tkextlib/setup.rb'
-
-# call setup script
-require 'tkextlib/blt/setup.rb'
-
-# load all image format handlers
-#TkPackage.require('BLT', '2.4')
-TkPackage.require('BLT')
-
-module Tk
- module BLT
- TkComm::TkExtlibAutoloadModule.unshift(self)
-
- extend TkCore
-
- VERSION = tk_call('set', 'blt_version')
- PATCH_LEVEL = tk_call('set', 'blt_patchLevel')
-
- begin
- lib = INTERP._invoke('set', 'blt_library')
- rescue
- lib = ''
- end
- LIBRARY = TkVarAccess.new('blt_library', lib)
-
- begin
- lib = INTERP._invoke('set', 'blt_libPath')
- rescue
- lib = ''
- end
- LIB_PATH = TkVarAccess.new('blt_libPath', lib)
-
- PACKAGE_NAME = 'BLT'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('BLT')
- rescue
- ''
- end
- end
-
- ####################################################
-
- def self.beep(percent = 50)
- tk_call('::blt::beep', percent)
- end
-
- def self.bgexec(*args)
- if args[0].kind_of?(TkVariable)
- var = args.shift
- else
- var = TkVariable.new
- end
- params = [var]
-
- params.concat(hash_kv(args.shift, true)) if args[0].kind_of?(Hash)
-
- params << '--'
- params.concat(args)
-
- tk_call('::blt::bgexec', *params)
- var
- end
-
- def self.detach_bgexec(*args)
- if args[0].kind_of?(TkVariable)
- var = args.shift
- else
- var = TkVariable.new
- end
- params = [var]
-
- params.concat(hash_kv(args.shift, true)) if args[0].kind_of?(Hash)
-
- params << '--'
- params.concat(args)
- params << '&'
-
- [var, tk_split_list(tk_call('::blt::bgexec', *params))]
- end
-
- def self.bltdebug(lvl = nil)
- if lvl
- tk_call('::blt::bltdebug', lvl)
- else
- number(tk_call('::blt::bltdebug'))
- end
- end
-
- def self.crc32_file(name)
- tk_call_without_enc('::blt::crc32', name)
- end
- def self.crc32_data(dat)
- tk_call_without_enc('::blt::crc32', '-data', dat)
- end
-
- ####################################################
-
- def self.active_legend(graph)
- tk_call_without_enc('Blt_ActiveLegend', graph)
- end
- def self.crosshairs(graph)
- tk_call_without_enc('Blt_Crosshairs', graph)
- end
- def self.zoom_stack(graph)
- tk_call_without_enc('Blt_ZoomStack', graph)
- end
- def self.print_key(graph)
- tk_call_without_enc('Blt_PrintKey', graph)
- end
- def self.closest_point(graph)
- tk_call_without_enc('Blt_ClosestPoint', graph)
- end
-
- module GraphCommand
- def active_legend
- tk_call_without_enc('Blt_ActiveLegend', @path)
- self
- end
- def crosshairs
- tk_call_without_enc('Blt_Crosshairs', @path)
- self
- end
- def zoom_stack
- tk_call_without_enc('Blt_ZoomStack', @path)
- self
- end
- def print_key
- tk_call_without_enc('Blt_PrintKey', @path)
- self
- end
- def closest_point
- tk_call_without_enc('Blt_ClosestPoint', @path)
- self
- end
- end
-
- ####################################################
-
- autoload :PlotComponent,'tkextlib/blt/component.rb'
-
- autoload :Barchart, 'tkextlib/blt/barchart.rb'
- autoload :Bitmap, 'tkextlib/blt/bitmap.rb'
- autoload :Busy, 'tkextlib/blt/busy.rb'
- autoload :Container, 'tkextlib/blt/container.rb'
- autoload :CutBuffer, 'tkextlib/blt/cutbuffer.rb'
- autoload :DragDrop, 'tkextlib/blt/dragdrop.rb'
- autoload :EPS, 'tkextlib/blt/eps.rb'
- autoload :Htext, 'tkextlib/blt/htext.rb'
- autoload :Graph, 'tkextlib/blt/graph.rb'
- autoload :Spline, 'tkextlib/blt/spline.rb'
- autoload :Stripchart, 'tkextlib/blt/stripchart.rb'
- autoload :Table, 'tkextlib/blt/table.rb'
- autoload :Tabnotebook, 'tkextlib/blt/tabnotebook.rb'
- autoload :Tabset, 'tkextlib/blt/tabset.rb'
- autoload :Ted, 'tkextlib/blt/ted.rb'
- autoload :Tile, 'tkextlib/blt/tile.rb'
- autoload :Tree, 'tkextlib/blt/tree.rb'
- autoload :TreeView, 'tkextlib/blt/treeview.rb'
- autoload :Hiertable, 'tkextlib/blt/treeview.rb'
- # Hierbox is obsolete
- autoload :Vector, 'tkextlib/blt/vector.rb'
- autoload :VectorAccess, 'tkextlib/blt/vector.rb'
- autoload :Watch, 'tkextlib/blt/watch.rb'
- autoload :Winop, 'tkextlib/blt/winop.rb'
- autoload :WinOp, 'tkextlib/blt/winop.rb'
-
- # Unix only
- autoload :DnD, 'tkextlib/blt/unix_dnd.rb'
-
- # Windows only
- autoload :Printer, 'tkextlib/blt/win_printer.rb'
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/barchart.rb b/ext/tk/lib/tkextlib/blt/barchart.rb
deleted file mode 100644
index cb481c5889..0000000000
--- a/ext/tk/lib/tkextlib/blt/barchart.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# tkextlib/blt/barchart.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-require 'tkextlib/blt/component.rb'
-
-module Tk::BLT
- class Barchart < TkWindow
- TkCommandNames = ['::blt::barchart'.freeze].freeze
- WidgetClassName = 'Barchart'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- include PlotComponent
- include GraphCommand
-
- def __boolval_optkeys
- ['bufferelements', 'buffergraph', 'invertxy']
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- ['text', 'label', 'title', 'file',
- 'background', 'plotbackground']
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'colormap' << 'fontmap'
- end
- private :__tkvariable_optkeys
-
-=begin
- BarElement_ID = ['blt_barchart_bar'.freeze, '00000'.taint].freeze
-
- def bar(elem=nil, keys={})
- if elem.kind_of?(Hash)
- keys = elem
- elem = nil
- end
- unless elem
- elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
- BarElement_ID[1].succ!
- end
- tk_send('bar', elem, keys)
- Element.new(self, elem, :without_creating=>true)
- end
-=end
-
- def extents(item)
- num_or_str(tk_send_without_enc('extents', item))
- end
-
- def invtransform(x, y)
- list(tk_send_without_enc('invtransform', x, y))
- end
-
- def inside(x, y)
- bool(tk_send_without_enc('inside', x, y))
- end
-
- def metafile(file=None)
- # Windows only
- tk_send('metafile', file)
- self
- end
-
- def snap(output, keys={})
- tk_send_without_enc('snap', *(hash_kv(keys, false) + output))
- self
- end
-
- def transform(x, y)
- list(tk_send_without_enc('transform', x, y))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/bitmap.rb b/ext/tk/lib/tkextlib/blt/bitmap.rb
deleted file mode 100644
index 31cf8d4229..0000000000
--- a/ext/tk/lib/tkextlib/blt/bitmap.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# tkextlib/blt/bitmap.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Bitmap < TkObject
- extend TkCore
-
- TkCommandNames = ['::blt::bitmap'.freeze].freeze
-
- BITMAP_ID_TBL = TkCore::INTERP.create_table
- BITMAP_ID = ['blt_bitmap_id'.freeze, '00000'.taint].freeze
-
- def self.data(name)
- dat = tk_simple_list(tk_call('::blt::bitmap', 'data', name))
- [ tk_split_list(dat[0]), tk_simple_list(dat[1]) ]
- end
-
- def self.exist?(name)
- bool(tk_call('::blt::bitmap', 'exists', name))
- end
-
- def self.height(name)
- number(tk_call('::blt::bitmap', 'height', name))
- end
-
- def self.width(name)
- number(tk_call('::blt::bitmap', 'width', name))
- end
-
- def self.source(name)
- tk_simple_list(tk_call('::blt::bitmap', 'source', name))
- end
-
- #################################
-
- class << self
- alias _new new
-
- def new(data, keys={})
- _new(:data, nil, data, keys)
- end
- alias define new
-
- def new_with_name(name, data, keys={})
- _new(:data, name, data, keys)
- end
- alias define_with_name new_with_name
-
- def compose(text, keys={})
- _new(:text, nil, text, keys)
- end
-
- def compose_with_name(name, text, keys={})
- _new(:text, name, text, keys)
- end
- end
-
- def initialize(type, name, data, keys = {})
- if name
- @id = name
- else
- @id = BITMAP_ID.join(TkCore::INTERP._ip_id_)
- BITMAP_ID[1].succ!
- BITMAP_ID_TBL[@id] = self
- end
-
- @path = @id
-
- unless bool(tk_call('::blt::bitmap', 'exists', @id))
- if type == :text
- tk_call('::blt::bitmap', 'compose', @id, data, *hash_kv(keys))
- else # :data
- tk_call('::blt::bitmap', 'define', @id, data, *hash_kv(keys))
- end
- end
- end
-
- def exist?
- bool(tk_call('::blt::bitmap', 'exists', @id))
- end
-
- def height
- number(tk_call('::blt::bitmap', 'height', @id))
- end
-
- def width
- number(tk_call('::blt::bitmap', 'width', @id))
- end
-
- def source
- tk_simple_list(tk_call('::blt::bitmap', 'source', @id))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/busy.rb b/ext/tk/lib/tkextlib/blt/busy.rb
deleted file mode 100644
index 4726e466f4..0000000000
--- a/ext/tk/lib/tkextlib/blt/busy.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# tkextlib/blt/busy.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/itemconfig.rb'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module Busy
- extend TkCore
- extend TkItemConfigMethod
-
- TkCommandNames = ['::blt::busy'.freeze].freeze
-
- ###########################
-
- class Shield < TkWindow
- def self.shield_path(win)
- win = window(win) unless win.kind_of?(TkWindow)
- if win.kind_of?(TkToplevel)
- win.path + '._Busy'
- else
- win.path + '_Busy'
- end
- end
-
- def initialize(win)
- @path = self.class.shield_path(win)
- end
- end
-
- def self.shield_path(win)
- Tk::BLT::Busy::Shield.shield_path(win)
- end
- end
-end
-
-class << Tk::BLT::Busy
- def __item_config_cmd(win)
- ['::blt::busy', 'configure', win]
- end
- private :__item_config_cmd
-
- undef itemcget
- alias configure itemconfigure
- alias configinfo itemconfiginfo
- alias current_configinfo current_itemconfiginfo
- private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
-
- ##################################
-
- def hold(win, keys={})
- tk_call('::blt::busy', 'hold', win, *hash_kv(keys))
- end
-
- def release(*wins)
- tk_call('::blt::busy', 'release', *wins)
- end
-
- def forget(*wins)
- tk_call('::blt::busy', 'forget', *wins)
- end
-
- def is_busy(pat=None)
- tk_split_list(tk_call('::blt::busy', 'isbusy', pat))
- end
-
- def names(pat=None)
- tk_split_list(tk_call('::blt::busy', 'names', pat))
- end
- alias windows names
-
- def check(win)
- bool(tk_call('::blt::busy', 'check', win))
- end
-
- def status(win)
- bool(tk_call('::blt::busy', 'status', win))
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb
deleted file mode 100644
index ad78a5430b..0000000000
--- a/ext/tk/lib/tkextlib/blt/component.rb
+++ /dev/null
@@ -1,1835 +0,0 @@
-#
-# tkextlib/blt/component.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module PlotComponent
- include TkItemConfigMethod
-
- module OptKeys
- def __item_font_optkeys(id)
- ['font', 'tickfont', 'titlefont']
- end
- private :__item_font_optkeys
-
- def __item_numstrval_optkeys(id)
- ['xoffset', 'yoffset']
- end
- private :__item_numstrval_optkeys
-
- def __item_boolval_optkeys(id)
- ['hide', 'under', 'descending', 'logscale', 'loose', 'showticks',
- 'titlealternate', 'scalesymbols', 'minor', 'raised',
- 'center', 'decoration', 'landscape', 'maxpect']
- end
- private :__item_boolval_optkeys
-
- def __item_strval_optkeys(id)
- ['text', 'label', 'limits', 'title',
- 'show', 'file', 'maskdata', 'maskfile',
- 'color', 'titlecolor', 'fill', 'outline', 'offdash']
- end
- private :__item_strval_optkeys
-
- def __item_listval_optkeys(id)
- ['bindtags']
- end
- private :__item_listval_optkeys
-
- def __item_numlistval_optkeys(id)
- ['dashes', 'majorticks', 'minorticks']
- end
- private :__item_numlistval_optkeys
-
- def __item_tkvariable_optkeys(id)
- ['variable', 'textvariable', 'colormap', 'fontmap']
- end
- private :__item_tkvariable_optkeys
- end
-
- include OptKeys
-
- def __item_cget_cmd(id)
- if id.kind_of?(Array)
- # id := [ type, name ]
- [self.path, id[0], 'cget', id[1]]
- else
- [self.path, id, 'cget']
- end
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id)
- if id.kind_of?(Array)
- # id := [ type, name, ... ]
- type, *names = id
- [self.path, type, 'configure'].concat(names)
- else
- [self.path, id, 'configure']
- end
- end
- private :__item_config_cmd
-
- def __item_pathname(id)
- if id.kind_of?(Array)
- id = tagid(id[1])
- end
- [self.path, id].join(';')
- end
- private :__item_pathname
-
- def axis_cget(id, option)
- ret = itemcget(['axis', tagid(id)], option)
- end
- def axis_configure(*args)
- slot = args.pop
- if slot.kind_of?(Hash)
- value = None
- slot = _symbolkey2str(slot)
- if cmd = slot.delete('command')
- slot['command'] = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- else
- value = slot
- slot = args.pop
- if slot == :command || slot == 'command'
- cmd = value
- value = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- end
- id_list = args.flatten.collect!{|id| tagid(id)}.unshift('axis')
- itemconfigure(id_list, slot, value)
- end
- def axis_configinfo(id, slot=nil)
- itemconfiginfo(['axis', tagid(id)], slot)
- end
- def current_axis_configinfo(id, slot=nil)
- current_itemconfiginfo(['axis', tagid(id)], slot)
- end
-
- def crosshairs_cget(option)
- itemcget('crosshairs', option)
- end
- def crosshairs_configure(slot, value=None)
- itemconfigure('crosshairs', slot, value)
- end
- def crosshairs_configinfo(slot=nil)
- itemconfiginfo('crosshairs', slot)
- end
- def current_crosshairs_configinfo(slot=nil)
- current_itemconfiginfo('crosshairs', slot)
- end
-
- def element_cget(id, option)
- itemcget(['element', tagid(id)], option)
- end
- def element_configure(*args)
- slot = args.pop
- if slot.kind_of?(Hash)
- value = None
- else
- value = slot
- slot = args.pop
- end
- id_list = args.flatten.collect!{|id| tagid(id)}.unshift('element')
- itemconfigure(id_list, slot, value)
- end
- def element_configinfo(id, slot=nil)
- itemconfiginfo(['element', tagid(id)], slot)
- end
- def current_element_configinfo(id, slot=nil)
- current_itemconfiginfo(['element', tagid(id)], slot)
- end
-
- def bar_cget(id, option)
- itemcget(['bar', tagid(id)], option)
- end
- def bar_configure(*args)
- slot = args.pop
- if slot.kind_of?(Hash)
- value = None
- else
- value = slot
- slot = args.pop
- end
- id_list = args.flatten.collect!{|id| tagid(id)}.unshift('bar')
- itemconfigure(id_list, slot, value)
- end
- def bar_configinfo(id, slot=nil)
- itemconfiginfo(['bar', tagid(id)], slot)
- end
- def current_bar_configinfo(id, slot=nil)
- current_itemconfiginfo(['bar', tagid(id)], slot)
- end
-
- def line_cget(id, option)
- itemcget(['line', tagid(id)], option)
- end
- def line_configure(*args)
- slot = args.pop
- if slot.kind_of?(Hash)
- value = None
- else
- value = slot
- slot = args.pop
- end
- id_list = args.flatten.collect!{|id| tagid(id)}.unshift('line')
- itemconfigure(id_list, slot, value)
- end
- def line_configinfo(id, slot=nil)
- itemconfiginfo(['line', tagid(id)], slot)
- end
- def current_line_configinfo(id, slot=nil)
- current_itemconfiginfo(['line', tagid(id)], slot)
- end
-
- def gridline_cget(option)
- itemcget('grid', option)
- end
- def gridline_configure(slot, value=None)
- itemconfigure('grid', slot, value)
- end
- def gridline_configinfo(slot=nil)
- itemconfiginfo('grid', slot)
- end
- def current_gridline_configinfo(slot=nil)
- current_itemconfiginfo('grid', slot)
- end
-
- def legend_cget(option)
- itemcget('legend', option)
- end
- def legend_configure(slot, value=None)
- itemconfigure('legend', slot, value)
- end
- def legend_configinfo(slot=nil)
- itemconfiginfo('legend', slot)
- end
- def current_legend_configinfo(slot=nil)
- current_itemconfiginfo('legend', slot)
- end
-
- def pen_cget(id, option)
- itemcget(['pen', tagid(id)], option)
- end
- def pen_configure(*args)
- slot = args.pop
- if slot.kind_of?(Hash)
- value = None
- else
- value = slot
- slot = args.pop
- end
- id_list = args.flatten.collect!{|id| tagid(id)}.unshift('pen')
- itemconfigure(id_list, slot, value)
- end
- def pen_configinfo(id, slot=nil)
- itemconfiginfo(['pen', tagid(id)], slot)
- end
- def current_pen_configinfo(id, slot=nil)
- current_itemconfiginfo(['pen', tagid(id)], slot)
- end
-
- def postscript_cget(option)
- itemcget('postscript', option)
- end
- def postscript_configure(slot, value=None)
- itemconfigure('postscript', slot, value)
- end
- def postscript_configinfo(slot=nil)
- itemconfiginfo('postscript', slot)
- end
- def current_postscript_configinfo(slot=nil)
- current_itemconfiginfo('postscript', slot)
- end
-
- def marker_cget(id, option)
- itemcget(['marker', tagid(id)], option)
- end
- def marker_configure(*args)
- slot = args.pop
- if slot.kind_of?(Hash)
- value = None
- else
- value = slot
- slot = args.pop
- end
- id_list = args.flatten.collect!{|id| tagid(id)}.unshift('marker')
- itemconfigure(id_list, slot, value)
- end
- def marker_configinfo(id, slot=nil)
- itemconfiginfo(['marker', tagid(id)], slot)
- end
- def current_marker_configinfo(id, slot=nil)
- current_itemconfiginfo(['marker', tagid(id)], slot)
- end
-
- alias __itemcget itemcget
- alias __itemconfiginfo itemconfiginfo
- alias __current_itemconfiginfo current_itemconfiginfo
- private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo
-
- def itemcget(tagOrId, option)
- ret = __itemcget(tagid(tagOrId), option)
- if option == 'bindtags' || option == :bindtags
- ret.collect{|tag| TkBindTag.id2obj(tag)}
- else
- ret
- end
- end
- def itemconfiginfo(tagOrId, slot = nil)
- ret = __itemconfiginfo(tagid(tagOrId), slot)
-
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- if slot
- if slot == 'bindtags' || slot == :bindtags
- ret[-2] = ret[-2].collect{|tag| TkBindTag.id2obj(tag)}
- ret[-1] = ret[-1].collect{|tag| TkBindTag.id2obj(tag)}
- end
- else
- if (inf = ret.assoc('bindtags'))
- inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
- inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
- end
- end
-
- else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- if (inf = ret['bindtags'])
- inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
- inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
- ret['bindtags'] = inf
- end
- end
-
- ret
- end
- def current_itemconfiginfo(tagOrId, slot = nil)
- ret = __current_itemconfiginfo(tagid(tagOrId), slot)
-
- if (val = ret['bindtags'])
- ret['bindtags'] = val.collect{|tag| TkBindTag.id2obj(tag)}
- end
-
- ret
- end
-
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
-
- #################
-
- class Axis < TkObject
- OBJ_ID = ['blt_chart_axis'.freeze, '00000'.taint].freeze
- OBJ_TBL={}
-
- def self.id2obj(chart, id)
- cpath = chart.path
- return id unless OBJ_TBL[cpath]
- OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
- end
-
- def self.new(chart, axis=nil, keys={})
- if axis.kind_of?(Hash)
- keys = axis
- axis = nil
- end
- OBJ_TBL[chart.path] = {} unless OBJ_TBL[chart.path]
- return OBJ_TBL[chart.path][axis] if axis && OBJ_TBL[chart.path][axis]
- super(chart, axis, keys)
- end
-
- def initialize(chart, axis=nil, keys={})
- if axis.kind_of?(Hash)
- keys = axis
- axis = nil
- end
- if axis
- @axis = @id = axis.to_s
- else
- @axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
- OBJ_ID[1].succ!
- end
- @path = @id
- @parent = @chart = chart
- @cpath = @chart.path
- Axis::OBJ_TBL[@cpath][@axis] = self
- keys = _symbolkey2str(keys)
- unless keys.delete('without_creating')
- # @chart.axis_create(@axis, keys)
- tk_call(@chart, 'axis', 'create', @axis, keys)
- end
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.axis_cget(@id, option)
- end
- def configure(key, value=None)
- @chart.axis_configure(@id, key, value)
- self
- end
- def configinfo(key=nil)
- @chart.axis_configinfo(@id, key)
- end
- def current_configinfo(key=nil)
- @chart.current_axis_configinfo(@id, key)
- end
-
- def command(cmd=nil, &b)
- if cmd
- configure('command', cmd)
- elsif b
- configure('command', Proc.new(&b))
- else
- cget('command')
- end
- end
-
- def delete
- @chart.axis_delete(@id)
- self
- end
-
- def invtransform(val)
- @chart.axis_invtransform(@id, val)
- end
-
- def limits
- @chart.axis_limits(@id)
- end
-
- def name
- @axis
- end
-
- def transform(val)
- @chart.axis_transform(@id, val)
- end
-
- def view
- @chart.axis_view(@id)
- self
- end
-
- def use(name=None) # if @id == xaxis | x2axis | yaxis | y2axis
- @chart.axis_use(@id, name)
- end
-
- def use_as(axis) # axis := xaxis | x2axis | yaxis | y2axis
- @chart.axis_use(axis, @id)
- end
- end
-
- #################
-
- class Crosshairs < TkObject
- OBJ_TBL={}
-
- def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
- end
-
- def initialize(chart, keys={})
- @parent = @chart = chart
- @cpath = @chart.path
- Crosshairs::OBJ_TBL[@cpath] = self
- @chart.crosshair_configure(keys) unless keys.empty?
- @path = @id = 'crosshairs'
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.crosshair_cget(option)
- end
- def configure(key, value=None)
- @chart.crosshair_configure(key, value)
- self
- end
- def configinfo(key=nil)
- @chart.crosshair_configinfo(key)
- end
- def current_configinfo(key=nil)
- @chart.current_crosshair_configinfo(key)
- end
-
- def off
- @chart.crosshair_off
- self
- end
- def on
- @chart.crosshair_on
- self
- end
- def toggle
- @chart.crosshair_toggle
- self
- end
- end
-
- #################
-
- class Element < TkObject
- extend Tk
- extend TkItemFontOptkeys
- extend TkItemConfigOptkeys
-
- extend Tk::BLT::PlotComponent::OptKeys
-
- ElementTypeName = 'element'
- ElementTypeToClass = { ElementTypeName=>self }
- ElementID_TBL = TkCore::INTERP.create_table
-
- TkCore::INTERP.init_ip_env{ ElementID_TBL.clear }
-
- OBJ_ID = ['blt_chart_element'.freeze, '00000'.taint].freeze
- OBJ_TBL={}
-
- def Element.type2class(type)
- ElementTypeToClass[type]
- end
-
- def Element.id2obj(chart, id)
- cpath = chart.path
- return id unless OBJ_TBL[cpath]
- OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
- end
-
- def self.new(chart, element=nil, keys={})
- if element.kind_of?(Hash)
- keys = element
- element = nil
- end
- OBJ_TBL[chart.path] = {} unless OBJ_TBL[chart.path]
- if element && OBJ_TBL[chart.path][element]
- return OBJ_TBL[chart.path][element]
- end
- super(chart, element, keys)
- end
-
- def initialize(chart, element=nil, keys={})
- if element.kind_of?(Hash)
- keys = element
- element = nil
- end
- if element
- @element = @id = element.to_s
- else
- @element = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
- OBJ_ID[1].succ!
- end
- @path = @id
- @parent = @chart = chart
- @cpath = @chart.path
- @typename = self.class::ElementTypeName
- Element::OBJ_TBL[@cpath][@element] = self
- keys = _symbolkey2str(keys)
- unless keys.delete('without_creating')
- # @chart.element_create(@element, keys)
- tk_call(@chart, @typename, 'create', @element, keys)
- end
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- # @chart.element_cget(@id, option)
- @chart.__send__(@typename + '_cget', @id, option)
- end
- def configure(key, value=None)
- # @chart.element_configure(@id, key, value)
- @chart.__send__(@typename + '_configure', @id, key, value)
- self
- end
- def configinfo(key=nil)
- # @chart.element_configinfo(@id, key)
- @chart.__send__(@typename + '_configinfo', @id, key)
- end
- def current_configinfo(key=nil)
- # @chart.current_element_configinfo(@id, key)
- @chart.__send__('current_' << @typename << '_configinfo', @id, key)
- end
-
- def activate(*args)
- @chart.element_activate(@id, *args)
- end
-
- def closest(x, y, var, keys={})
- # @chart.element_closest(x, y, var, @id, keys)
- @chart.__send__(@typename + '_closest', x, y, var, @id, keys)
- end
-
- def deactivate
- @chart.element_deactivate(@id)
- self
- end
-
- def delete
- @chart.element_delete(@id)
- self
- end
-
- def exist?
- @chart.element_exist?(@id)
- end
-
- def name
- @element
- end
-
- def type
- @chart.element_type(@id)
- end
- end
-
- class Bar < Element
- ElementTypeName = 'bar'.freeze
- ElementTypeToClass[ElementTypeName] = self
- end
- class Line < Element
- ElementTypeName = 'line'.freeze
- ElementTypeToClass[ElementTypeName] = self
- end
-
- #################
-
- class GridLine < TkObject
- OBJ_TBL={}
-
- def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
- end
-
- def initialize(chart, keys={})
- @parent = @chart = chart
- @cpath = @chart.path
- GridLine::OBJ_TBL[@cpath] = self
- @chart.gridline_configure(keys) unless keys.empty?
- @path = @id = 'grid'
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.gridline_cget(option)
- end
- def configure(key, value=None)
- @chart.gridline_configure(key, value)
- self
- end
- def configinfo(key=nil)
- @chart.gridline_configinfo(key)
- end
- def current_configinfo(key=nil)
- @chart.current_gridline_configinfo(key)
- end
-
- def off
- @chart.gridline_off
- self
- end
- def on
- @chart.gridline_on
- self
- end
- def toggle
- @chart.gridline_toggle
- self
- end
- end
-
- #################
-
- class Legend < TkObject
- OBJ_TBL={}
-
- def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
- end
-
- def initialize(chart, keys={})
- @parent = @chart = chart
- @cpath = @chart.path
- Crosshairs::OBJ_TBL[@cpath] = self
- @chart.crosshair_configure(keys) unless keys.empty?
- @path = @id = 'legend'
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.legend_cget(option)
- end
- def configure(key, value=None)
- @chart.legend_configure(key, value)
- self
- end
- def configinfo(key=nil)
- @chart.legend_configinfo(key)
- end
- def current_configinfo(key=nil)
- @chart.current_legend_configinfo(key)
- end
-
- def activate(*args)
- @chart.legend_activate(*args)
- end
-
- def deactivate(*args)
- @chart.legend_deactivate(*args)
- end
-
- def get(pos, y=nil)
- @chart.legend_get(pos, y)
- end
- end
-
- #################
-
- class Pen < TkObject
- OBJ_ID = ['blt_chart_pen'.freeze, '00000'.taint].freeze
- OBJ_TBL={}
-
- def self.id2obj(chart, id)
- cpath = chart.path
- return id unless OBJ_TBL[cpath]
- OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
- end
-
- def self.new(chart, pen=nil, keys={})
- if pen.kind_of?(Hash)
- keys = pen
- pen = nil
- end
- OBJ_TBL[chart.path] = {} unless OBJ_TBL[chart.path]
- return OBJ_TBL[chart.path][pen] if pen && OBJ_TBL[chart.path][pen]
- super(chart, pen, keys)
- end
-
- def initialize(chart, pen=nil, keys={})
- if pen.kind_of?(Hash)
- keys = pen
- pen = nil
- end
- if pen
- @pen = @id = pen.to_s
- else
- @pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
- OBJ_ID[1].succ!
- end
- @path = @id
- @parent = @chart = chart
- @cpath = @chart.path
- Pen::OBJ_TBL[@cpath][@pen] = self
- keys = _symbolkey2str(keys)
- unless keys.delete('without_creating')
- # @chart.pen_create(@pen, keys)
- tk_call(@chart, 'pen', 'create', @pen, keys)
- end
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.pen_cget(@id, option)
- end
- def configure(key, value=None)
- @chart.pen_configure(@id, key, value)
- self
- end
- def configinfo(key=nil)
- @chart.pen_configinfo(@id, key)
- end
- def current_configinfo(key=nil)
- @chart.current_pen_configinfo(@id, key)
- end
-
- def delete
- @chart.pen_delete(@id)
- self
- end
-
- def name
- @pen
- end
- end
-
- #################
-
- class Postscript < TkObject
- OBJ_TBL={}
-
- def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
- end
-
- def initialize(chart, keys={})
- @parent = @chart = chart
- @cpath = @chart.path
- Postscript::OBJ_TBL[@cpath] = self
- @chart.postscript_configure(keys) unless keys.empty?
- @path = @id = 'postscript'
- end
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.postscript_cget(option)
- end
- def configure(key, value=None)
- @chart.postscript_configure(key, value)
- self
- end
- def configinfo(key=nil)
- @chart.postscript_configinfo(key)
- end
- def current_configinfo(key=nil)
- @chart.current_postscript_configinfo(key)
- end
-
- def output(file=nil, keys={})
- if file.kind_of?(Hash)
- keys = file
- file = nil
- end
-
- ret = @chart.postscript_output(file, keys)
-
- if file
- self
- else
- ret
- end
- end
- end
-
- #################
- class Marker < TkObject
- extend Tk
- extend TkItemFontOptkeys
- extend TkItemConfigOptkeys
-
- extend Tk::BLT::PlotComponent::OptKeys
-
- MarkerTypeName = nil
- MarkerTypeToClass = {}
- MarkerID_TBL = TkCore::INTERP.create_table
-
- TkCore::INTERP.init_ip_env{ MarkerID_TBL.clear }
-
- def Marker.type2class(type)
- MarkerTypeToClass[type]
- end
-
- def Marker.id2obj(chart, id)
- cpath = chart.path
- return id unless MarkerID_TBL[cpath]
- MarkerID_TBL[cpath][id]? MarkerID_TBL[cpath][id]: id
- end
-
- def self._parse_create_args(keys)
- fontkeys = {}
- methodkeys = {}
- if keys.kind_of? Hash
- keys = _symbolkey2str(keys)
-
- __item_font_optkeys(nil).each{|key|
- fkey = key.to_s
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
-
- fkey = "kanji#{key}"
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
-
- fkey = "latin#{key}"
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
-
- fkey = "ascii#{key}"
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
- }
-
- __item_methodcall_optkeys(nil).each{|key|
- key = key.to_s
- methodkeys[key] = keys.delete(key) if keys.key?(key)
- }
-
- __item_ruby2val_optkeys(nil).each{|key, method|
- key = key.to_s
- keys[key] = method.call(keys[key]) if keys.has_key?(key)
- }
-
- args = itemconfig_hash_kv(nil, keys)
- else
- args = []
- end
-
- [args, fontkeys]
- end
- private_class_method :_parse_create_args
-
- def self.create(chart, keys={})
- unless self::MarkerTypeName
- fail RuntimeError, "#{self} is an abstract class"
- end
- args, fontkeys = _parse_create_args(keys)
- idnum = tk_call_without_enc(chart.path, 'marker', 'create',
- self::MarkerTypeName, *args)
- chart.marker_configure(idnum, fontkeys) unless fontkeys.empty?
- idnum.to_i # 'item id' is an integer number
- end
-
- def self.create_type(chart, type, keys={})
- args, fontkeys = _parse_create_args(keys)
- idnum = tk_call_without_enc(chart.path, 'marker', 'create',
- type, *args)
- chart.marker_configure(idnum, fontkeys) unless fontkeys.empty?
- id = idnum.to_i # 'item id' is an integer number
- obj = self.allocate
- obj.instance_eval{
- @parent = @chart = chart
- @cpath = chart.path
- @id = id
- unless Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath]
- Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath] = {}
- end
- Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath][@id] = self
- }
- obj
- end
-
- def initialize(parent, *args)
- @parent = @chart = parent
- @cpath = parent.path
-
- @path = @id = create_self(*args) # an integer number as 'item id'
- unless Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath]
- Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath] = {}
- end
- Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath][@id] = self
- end
- def create_self(*args)
- self.class.create(@chart, *args) # return an integer as 'item id'
- end
- private :create_self
-
- def id
- @id
- end
-
- def to_eval
- @id
- end
-
- def cget(option)
- @chart.marker_cget(@id, option)
- end
- def configure(key, value=None)
- @chart.marker_configure(@id, key, value)
- self
- end
- def configinfo(key=nil)
- @chart.marker_configinfo(@id, key)
- end
- def current_configinfo(key=nil)
- @chart.current_marker_configinfo(@id, key)
- end
-
- def after(target=None)
- @chart.marker_after(@id, target)
- end
-
- def before(target=None)
- @chart.marker_before(@id, target)
- end
-
- def delete
- @chart.marker_delete(@id)
- end
-
- def exist?
- @chart.marker_exist(@id)
- end
-
- def type
- @chart.marker_type(@id)
- end
- end
-
- class TextMarker < Marker
- MarkerTypeName = 'text'.freeze
- MarkerTypeToClass[MarkerTypeName] = self
- end
- class LineMarker < Marker
- MarkerTypeName = 'line'.freeze
- MarkerTypeToClass[MarkerTypeName] = self
- end
- class BitmapMarker < Marker
- MarkerTypeName = 'bitmap'.freeze
- MarkerTypeToClass[MarkerTypeName] = self
- end
- class ImageMarker < Marker
- MarkerTypeName = 'image'.freeze
- MarkerTypeToClass[MarkerTypeName] = self
- end
- class PolygonMarker < Marker
- MarkerTypeName = 'polygon'.freeze
- MarkerTypeToClass[MarkerTypeName] = self
- end
- class WindowMarker < Marker
- MarkerTypeName = 'window'.freeze
- MarkerTypeToClass[MarkerTypeName] = self
- end
-
- #################
-
- def __destroy_hook__
- Axis::OBJ_TBL.delete(@path)
- Crosshairs::OBJ_TBL.delete(@path)
- Element::OBJ_TBL.delete(@path)
- GridLine::OBJ_TBL.delete(@path)
- Legend::OBJ_TBL.delete(@path)
- Pen::OBJ_TBL.delete(@path)
- Postscript::OBJ_TBL.delete(@path)
- Marker::OBJ_TBL.delete(@path)
- super()
- end
-
- #################
-
- def tagid(tag)
- if tag.kind_of?(Axis) ||
- tag.kind_of?(Crosshairs) ||
- tag.kind_of?(Element) ||
- tag.kind_of?(GridLine) ||
- tag.kind_of?(Legend) ||
- tag.kind_of?(Pen) ||
- tag.kind_of?(Postscript) ||
- tag.kind_of?(Marker)
- tag.id
- else
- tag # maybe an Array of configure paramters
- end
- end
-
- def _component_bind(target, tag, context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([path, target, 'bind', tagid(tag)], context, cmd, *args)
- self
- end
- def _component_bind_append(target, tag, context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([path, target, 'bind', tagid(tag)], context, cmd, *args)
- self
- end
- def _component_bind_remove(target, tag, context)
- _bind_remove([path, target, 'bind', tagid(tag)], context)
- self
- end
- def _component_bindinfo(target, tag, context=nil)
- _bindinfo([path, target, 'bind', tagid(tag)], context)
- end
- private :_component_bind, :_component_bind_append
- private :_component_bind_remove, :_component_bindinfo
-
- def axis_bind(tag, context, *args)
- _component_bind('axis', tag, context, *args)
- end
- def axis_bind_append(tag, context, *args)
- _component_bind_append('axis', tag, context, *args)
- end
- def axis_bind_remove(tag, context)
- _component_bind_remove('axis', tag, context)
- end
- def axis_bindinfo(tag, context=nil)
- _component_bindinfo('axis', tag, context)
- end
-
- def element_bind(tag, context, *args)
- _component_bind('element', tag, context, *args)
- end
- def element_bind_append(tag, context, *args)
- _component_bind_append('element', tag, context, *args)
- end
- def element_bind_remove(tag, context)
- _component_bind_remove('element', tag, context)
- end
- def element_bindinfo(tag, context=nil)
- _component_bindinfo('element', tag, context)
- end
-
- def bar_bind(tag, context, *args)
- _component_bind('bar', tag, context, *args)
- end
- def bar_bind_append(tag, context, *args)
- _component_bind_append('bar', tag, context, *args)
- end
- def bar_bind_remove(tag, context)
- _component_bind_remove('bar', tag, context)
- end
- def bar_bindinfo(tag, context=nil)
- _component_bindinfo('bar', tag, context)
- end
-
- def line_bind(tag, context, *args)
- _component_bind('line', tag, context, *args)
- end
- def line_bind_append(tag, context, *args)
- _component_bind_append('line', tag, context, *args)
- end
- def line_bind_remove(tag, context)
- _component_bind_remove('line', tag, context)
- end
- def line_bindinfo(tag, context=nil)
- _component_bindinfo('line', tag, context)
- end
-
- def legend_bind(tag, context, *args)
- _component_bind('legend', tag, context, *args)
- end
- def legend_bind_append(tag, context, *args)
- _component_bind_append('legend', tag, context, *args)
- end
- def legend_bind_remove(tag, context)
- _component_bind_remove('legend', tag, context)
- end
- def legend_bindinfo(tag, context=nil)
- _component_bindinfo('legend', tag, context)
- end
-
- def marker_bind(tag, context, *args)
- _component_bind('marker', tag, context, *args)
- end
- def marker_bind_append(tag, context, *args)
- _component_bind_append('marker', tag, context, *args)
- end
- def marker_bind_remove(tag, context)
- _component_bind_remove('marker', tag, context)
- end
- def marker_bindinfo(tag, context=nil)
- _component_bindinfo('marker', tag, context)
- end
-
- ###################
-
- def axis_create(id=nil, keys={})
- # tk_send('axis', 'create', tagid(id), keys)
- Tk::BLT::PlotComponent::Axis.new(self, tagid(id), keys)
- end
- def axis_delete(*ids)
- tk_send('axis', 'delete', *(ids.collect{|id| tagid(id)}))
- self
- end
- def axis_invtransform(id, val)
- list(tk_send('axis', 'invtransform', tagid(id), val))
- end
- def axis_limits(id)
- list(tk_send('axis', 'limits', tagid(id)))
- end
- def axis_names(*pats)
- simplelist(tk_send('axis', 'names',
- *(pats.collect{|pat| tagid(pat)}))).collect{|axis|
- Tk::BLT::PlotComponent::Axis.id2obj(self, axis)
- }
- end
- def axis_transform(id, val)
- list(tk_send('axis', 'transform', tagid(id), val))
- end
- def axis_view(id)
- tk_send('axis', 'view', tagid(id))
- self
- end
- def axis_use(id, target=nil)
- if target
- Tk::BLT::PlotComponent::Axis.id2obj(self,
- tk_send('axis', 'use',
- tagid(id), tagid(target)))
- else
- Tk::BLT::PlotComponent::Axis.id2obj(self,
- tk_send('axis', 'use', tagid(id)))
- end
- end
-
- ###################
-
- def crosshairs_off
- tk_send_without_enc('crosshairs', 'off')
- self
- end
- def crosshairs_on
- tk_send_without_enc('crosshairs', 'on')
- self
- end
- def crosshairs_toggle
- tk_send_without_enc('crosshairs', 'toggle')
- self
- end
-
- ###################
-
- def element_create(id=nil, keys={})
- # tk_send('element', 'create', tagid(id), keys)
- Tk::BLT::PlotComponent::Element.new(self, tagid(id), keys)
- end
- def element_activate(*args)
- if args.empty?
- list(tk_send('element', 'activate')).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- else
- # id, *indices
- id = args.shift
- tk_send('element', 'activate', tagid(id), *args)
- end
- end
- def element_closest(x, y, var, *args)
- if args[-1].kind_of?(Hash)
- keys = args.pop
- bool(tk_send('element', 'closest', x, y, var,
- *(hash_kv(keys).concat(args.collect{|id| tagid(id)}))))
- else
- bool(tk_send('element', 'closest', x, y, var,
- *(args.collect{|id| tagid(id)})))
- end
- end
- def element_deactivate(*ids)
- tk_send('element', 'deactivate', *(ids.collect{|id| tagid(id)}))
- self
- end
- def element_delete(*ids)
- tk_send('element', 'delete', *(ids.collect{|id| tagid(id)}))
- self
- end
- def element_exist?(id)
- bool(tk_send('element', 'exists', tagid(id)))
- end
- def element_names(*pats)
- simplelist(tk_send('element', 'names',
- *(pats.collect{|pat| tagid(pat)}))).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- end
- def element_show(*names)
- if names.empty?
- simplelist(tk_send('element', 'show'))
- else
- tk_send('element', 'show', *(names.collect{|n| tagid(n)}))
- self
- end
- end
- def element_type(id)
- tk_send('element', 'type', tagid(id))
- end
-
- ###################
-
- def bar_create(id=nil, keys={})
- # tk_send('bar', 'create', tagid(id), keys)
- Tk::BLT::PlotComponent::Bar.new(self, tagid(id), keys)
- end
- alias bar bar_create
- def bar_activate(*args)
- if args.empty?
- list(tk_send('bar', 'activate')).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- else
- # id, *indices
- id = args.shift
- tk_send('bar', 'activate', tagid(id), *args)
- end
- end
- def bar_closest(x, y, var, *args)
- if args[-1].kind_of?(Hash)
- keys = args.pop
- bool(tk_send('bar', 'closest', x, y, var,
- *(hash_kv(keys).concat(args.collect{|id| tagid(id)}))))
- else
- bool(tk_send('bar', 'closest', x, y, var,
- *(args.collect{|id| tagid(id)})))
- end
- end
- def bar_deactivate(*ids)
- tk_send('bar', 'deactivate', *(ids.collect{|id| tagid(id)}))
- self
- end
- def bar_delete(*ids)
- tk_send('bar', 'delete', *(ids.collect{|id| tagid(id)}))
- self
- end
- def bar_exist?(id)
- bool(tk_send('bar', 'exists', tagid(id)))
- end
- def bar_names(*pats)
- simplelist(tk_send('bar', 'names',
- *(pats.collect{|pat| tagid(pat)}))).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- end
- def bar_show(*names)
- if names.empty?
- simplelist(tk_send('bar', 'show'))
- else
- tk_send('bar', 'show', *(names.collect{|n| tagid(n)}))
- self
- end
- end
- def bar_type(id)
- tk_send('bar', 'type', tagid(id))
- end
-
- ###################
-
- def line_create(id=nil, keys={})
- # tk_send('line', 'create', tagid(id), keys)
- Tk::BLT::PlotComponent::Line.new(self, tagid(id), keys)
- end
- alias bar line_create
- def line_activate(*args)
- if args.empty?
- list(tk_send('line', 'activate')).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- else
- # id, *indices
- id = args.shift
- tk_send('line', 'activate', tagid(id), *args)
- end
- end
- def line_closest(x, y, var, *args)
- if args[-1].kind_of?(Hash)
- keys = args.pop
- bool(tk_send('line', 'closest', x, y, var,
- *(hash_kv(keys).concat(args.collect{|id| tagid(id)}))))
- else
- bool(tk_send('line', 'closest', x, y, var,
- *(args.collect{|id| tagid(id)})))
- end
- end
- def line_deactivate(*ids)
- tk_send('line', 'deactivate', *(ids.collect{|id| tagid(id)}))
- self
- end
- def line_delete(*ids)
- tk_send('line', 'delete', *(ids.collect{|id| tagid(id)}))
- self
- end
- def line_exist?(id)
- bool(tk_send('line', 'exists', tagid(id)))
- end
- def line_names(*pats)
- simplelist(tk_send('line', 'names',
- *(pats.collect{|pat| tagid(pat)}))).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- end
- def line_show(*names)
- if names.empty?
- simplelist(tk_send('line', 'show'))
- else
- tk_send('line', 'show', *(names.collect{|n| tagid(n)}))
- self
- end
- end
- def line_type(id)
- tk_send('line', 'type', tagid(id))
- end
-
- ###################
-
- def gridline_off
- tk_send_without_enc('grid', 'off')
- self
- end
- def gridline_on
- tk_send_without_enc('grid', 'on')
- self
- end
- def gridline_toggle
- tk_send_without_enc('grid', 'toggle')
- self
- end
-
- ###################
-
- def legend_window_create(parent=nil, keys=nil)
- if parent.kind_of?(Hash)
- keys = _symbolkey2str(parent)
- parent = keys.delete('parent')
- widgetname = keys.delete('widgetname')
- keys.delete('without_creating')
- elsif keys
- keys = _symbolkey2str(keys)
- widgetname = keys.delete('widgetname')
- keys.delete('without_creating')
- end
-
- legend = self.class.new(parent, :without_creating=>true,
- :widgetname=>widgetname)
- class << legend
- def __destroy_hook__
- TkCore::INTERP.tk_windows.delete(@path)
- end
- end
-
- if keys
- self.legend_configure(keys.update('position'=>legend))
- else
- self.legend_configure('position'=>legend)
- end
- legend
- end
-
- def legend_activate(*pats)
- list(tk_send('legend', 'activate',
- *(pats.collect{|pat| tagid(pat)}))).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- end
- def legend_deactivate(*pats)
- list(tk_send('legend', 'deactivate',
- *(pats.collect{|pat| tagid(pat)}))).collect{|elem|
- Tk::BLT::PlotComponent::Element.id2obj(self, elem)
- }
- end
- def legend_get(pos, y=nil)
- if y
- Tk::BLT::PlotComponent::Element.id2obj(self,
- tk_send('legend', 'get',
- _at(pos, y)))
- else
- Tk::BLT::PlotComponent::Element.id2obj(self,
- tk_send('legend', 'get', pos))
- end
- end
-
- ###################
-
- def pen_create(id=nil, keys={})
- # tk_send('pen', 'create', tagid(id), keys)
- Tk::BLT::PlotComponent::Pen.new(self, tagid(id), keys)
- end
- def pen_delete(*ids)
- tk_send('pen', 'delete', *(ids.collect{|id| tagid(id)}))
- self
- end
- def pen_names(*pats)
- simplelist(tk_send('pen', 'names',
- *(pats.collect{|pat| tagid(pat)}))).collect{|pen|
- Tk::BLT::PlotComponent::Pen.id2obj(self, pen)
- }
- end
-
- ###################
-
- def postscript_output(file=nil, keys={})
- if file.kind_of?(Hash)
- keys = file
- file = nil
- end
-
- if file
- tk_send('postscript', 'output', file, keys)
- self
- else
- tk_send('postscript', 'output', keys)
- end
- end
-
- ###################
-
- def marker_create(type, keys={})
- case type
- when :text, 'text'
- Tk::BLT::PlotComponent::TextMarker.new(self, keys)
- when :line, 'line'
- Tk::BLT::PlotComponent::LineMarker.new(self, keys)
- when :bitmap, 'bitmap'
- Tk::BLT::PlotComponent::BitmapMarker.new(self, keys)
- when :image, 'image'
- Tk::BLT::PlotComponent::ImageMarker.new(self, keys)
- when :polygon, 'polygon'
- Tk::BLT::PlotComponent::PolygonMarker.new(self, keys)
- when :window, 'window'
- Tk::BLT::PlotComponent::WindowMarker.new(self, keys)
- else
- if type.kind_of?(Tk::BLT::PlotComponent::Marker)
- type.new(self, keys)
- else
- Tk::BLT::PlotComponent::Marker.create_type(self, type, keys)
- end
- end
- end
- def marker_after(id, target=nil)
- if target
- tk_send_without_enc('marker', 'after', tagid(id), tagid(target))
- else
- tk_send_without_enc('marker', 'after', tagid(id))
- end
- self
- end
- def marker_before(id, target=None)
- if target
- tk_send_without_enc('marker', 'before', tagid(id), tagid(target))
- else
- tk_send_without_enc('marker', 'before', tagid(id))
- end
- self
- end
- def marker_delete(*ids)
- tk_send('marker', 'delete', *(ids.collect{|id| tagid(id)}))
- self
- end
- def marker_exist?(id)
- bool(tk_send('marker', 'exists', tagid(id)))
- end
- def marker_names(*pats)
- simplelist(tk_send('marker', 'names',
- *(pats.collect{|pat| tagid(pat)}))).collect{|id|
- Tk::BLT::PlotComponent::Marker.id2obj(self, id)
- }
- end
- def marker_type(id)
- tk_send('marker', 'type', tagid(id))
- end
-
- ###################
-
- def xaxis_cget(option)
- itemcget('xaxis', option)
- end
- def xaxis_configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot = _symbolkey2str(slot)
- if cmd = slot.delete('command')
- slot['command'] = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- elsif slot == :command || slot == 'command'
- cmd = value
- value = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- itemconfigure('xaxis', slot, value)
- end
- def xaxis_configinfo(slot=nil)
- itemconfiginfo('xaxis', slot)
- end
- def current_xaxis_configinfo(slot=nil)
- current_itemconfiginfo('xaxis', slot)
- end
- def xaxis_bind(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([path, 'xaxis', 'bind'], context, cmd, *args)
- self
- end
- def xaxis_bind_append(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([path, 'xaxis', 'bind'], context, cmd, *args)
- self
- end
- def xaxis_bind_remove(context)
- _bind_remove([path, 'xaxis', 'bind'], context)
- self
- end
- def xaxis_bindinfo(context=nil)
- _bindinfo([path, 'xaxis', 'bind'], context)
- end
- def xaxis_invtransform(val)
- list(tk_send('xaxis', 'invtransform', val))
- end
- def xaxis_limits
- list(tk_send('xaxis', 'limits'))
- end
- def xaxis_transform(val)
- list(tk_send('xaxis', 'transform', val))
- end
- def xaxis_use(target=nil)
- if target
- Tk::BLT::PlotComponent::Axis.id2obj(self,
- tk_send('xaxis', 'use',
- tagid(target)))
- else
- Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('xaxis', 'use'))
- end
- end
-
- def x2axis_cget(option)
- itemcget('x2axis', option)
- end
- def x2axis_configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot = _symbolkey2str(slot)
- if cmd = slot.delete('command')
- slot['command'] = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- elsif slot == :command || slot == 'command'
- cmd = value
- value = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- itemconfigure('x2axis', slot, value)
- end
- def x2axis_configinfo(slot=nil)
- itemconfiginfo('x2axis', slot)
- end
- def current_x2axis_configinfo(slot=nil)
- current_itemconfiginfo('x2axis', slot)
- end
- def x2axis_bind(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([path, 'x2axis', 'bind'], context, cmd, *args)
- self
- end
- def x2axis_bind_append(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([path, 'x2axis', 'bind'], context, cmd, *args)
- self
- end
- def x2axis_bind_remove(context)
- _bind_remove([path, 'x2axis', 'bind'], context)
- self
- end
- def x2axis_bindinfo(context=nil)
- _bindinfo([path, 'x2axis', 'bind'], context)
- end
- def x2axis_invtransform(val)
- list(tk_send('x2axis', 'invtransform', val))
- end
- def x2axis_limits
- list(tk_send('x2axis', 'limits'))
- end
- def x2axis_transform(val)
- list(tk_send('x2axis', 'transform', val))
- end
- def x2axis_use(target=nil)
- if target
- Tk::BLT::PlotComponent::Axis.id2obj(self,
- tk_send('x2axis', 'use',
- tagid(target)))
- else
- Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('x2axis', 'use'))
- end
- end
-
- def yaxis_cget(option)
- itemcget('yaxis', option)
- end
- def yaxis_configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot = _symbolkey2str(slot)
- if cmd = slot.delete('command')
- slot['command'] = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- elsif slot == :command || slot == 'command'
- cmd = value
- value = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- itemconfigure('yaxis', slot, value)
- end
- def yaxis_configinfo(slot=nil)
- itemconfiginfo('yaxis', slot)
- end
- def current_yaxis_configinfo(slot=nil)
- current_itemconfiginfo('yaxis', slot)
- end
- def yaxis_bind(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([path, 'yaxis', 'bind'], context, cmd, *args)
- self
- end
- def yaxis_bind_append(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([path, 'yaxis', 'bind'], context, cmd, *args)
- self
- end
- def yaxis_bind_remove(context)
- _bind_remove([path, 'yaxis', 'bind'], context)
- self
- end
- def yaxis_bindinfo(context=nil)
- _bindinfo([path, 'yaxis', 'bind'], context)
- end
- def yaxis_invtransform(val)
- list(tk_send('yaxis', 'invtransform', val))
- end
- def yaxis_limits
- list(tk_send('yaxis', 'limits'))
- end
- def yaxis_transform(val)
- list(tk_send('yaxis', 'transform', val))
- end
- def yaxis_use(target=nil)
- if target
- Tk::BLT::PlotComponent::Axis.id2obj(self,
- tk_send('yaxis', 'use',
- tagid(target)))
- else
- Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('yaxis', 'use'))
- end
- end
-
- def y2axis_cget(option)
- itemcget('y2axis', option)
- end
- def y2axis_configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot = _symbolkey2str(slot)
- if cmd = slot.delete('command')
- slot['command'] = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- elsif slot == :command || slot == 'command'
- cmd = value
- value = proc{|w, tick|
- cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
- }
- end
- itemconfigure('y2axis', slot, value)
- end
- def y2axis_configinfo(slot=nil)
- axis_configinfo('y2axis', slot)
- end
- def current_y2axis_configinfo(slot=nil)
- current_itemconfiginfo('y2axis', slot)
- end
- def y2axis_bind(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([path, 'y2axis', 'bind'], context, cmd, *args)
- self
- end
- def y2axis_bind_append(context, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([path, 'y2axis', 'bind'], context, cmd, *args)
- self
- end
- def y2axis_bind_remove(context)
- _bind_remove([path, 'y2axis', 'bind'], context)
- self
- end
- def y2axis_bindinfo(context=nil)
- _bindinfo([path, 'y2axis', 'bind'], context)
- end
- def y2axis_invtransform(val)
- list(tk_send('y2axis', 'invtransform', val))
- end
- def y2axis_limits
- list(tk_send('y2axis', 'limits'))
- end
- def y2axis_transform(val)
- list(tk_send('y2axis', 'transform', val))
- end
- def y2axis_use(target=nil)
- if target
- Tk::BLT::PlotComponent::Axis.id2obj(self,
- tk_send('y2axis', 'use',
- tagid(target)))
- else
- Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('y2axis', 'use'))
- end
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/container.rb b/ext/tk/lib/tkextlib/blt/container.rb
deleted file mode 100644
index 60ba1dec1e..0000000000
--- a/ext/tk/lib/tkextlib/blt/container.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# tkextlib/blt/container.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Container < TkWindow
- TkCommandNames = ['::blt::container'.freeze].freeze
- WidgetClassName = 'Container'.freeze
- WidgetClassNames[WidgetClassName] = self
- end
-
- def __strval_optkeys
- super() << 'name'
- end
- private :__strval_optkeys
-
- def find_command(pat)
- list(tk_send_without_enc(tk_call(self.path, 'find', '-command', pat)))
- end
-
- def find_name(pat)
- list(tk_send_without_enc(tk_call(self.path, 'find', '-name', pat)))
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/cutbuffer.rb b/ext/tk/lib/tkextlib/blt/cutbuffer.rb
deleted file mode 100644
index 1cc39dfb94..0000000000
--- a/ext/tk/lib/tkextlib/blt/cutbuffer.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# tkextlib/blt/cutbuffer.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module CutBuffer
- TkCommandNames = ['::blt::cutbuffer'.freeze].freeze
-
- def self.get(num = 0)
- Tk.tk_call('::blt::cutbuffer', 'get', num)
- end
- def self.rotate(count = 1)
- Tk.tk_call('::blt::cutbuffer', 'rotate', count)
- end
- def self.set(val, num = 0)
- Tk.tk_call('::blt::cutbuffer', 'set', val, num)
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb
deleted file mode 100644
index 68fb9e591a..0000000000
--- a/ext/tk/lib/tkextlib/blt/dragdrop.rb
+++ /dev/null
@@ -1,214 +0,0 @@
-#
-# tkextlib/blt/dragdrop.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/itemconfig'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module DragDrop
- extend TkCore
-
- TkCommandNames = ['::blt::drag&drop'.freeze].freeze
-
- class Token < TkWindow
- WidgetClassName = 'DragDropToken'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def initialize(arg)
- if arg.kind_of?(Hash) # arg is a hash includes the widgetpath of token
- arg = _symbolkey2str(arg)
- install_win(nil, arg['widgetname'])
- else # arg is a drag&drop source
- tk_call('::blt::drag&drop', 'source', arg)
- install_win(nil, tk_call('::blt::drag&drop', 'token', arg))
- end
- end
- end
-
- ###################################
-
- extend TkItemConfigMethod
- extend Tk::ValidateConfigure
-
- class << self
- def __item_config_cmd(id) # id := ['source'|'target', win]
- ['::blt::drag&drop', id[0], id[1]]
- end
- private :__item_config_cmd
-
- def __item_boolval_optkeys(id)
- super(id) << 'selftarget'
- end
- private :__item_boolval_optkeys
-
- def __item_listval_optkeys(id)
- super(id) << 'send'
- end
- private :__item_listval_optkeys
-
- def __item_strval_optkeys(id)
- super(id) << 'rejectbg' << 'rejectfg' << 'tokenbg'
- end
- private :__item_strval_optkeys
-
- undef itemcget
- private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
-
- def source_configure(win, slot, value=None)
- itemconfigure(['source', win], slot, value)
- end
- def source_configinfo(win, slot=nil)
- itemconfiginfo(['source', win], slot)
- end
- def current_source_configinfo(win, slot=nil)
- current_itemconfiginfo(['source', win], slot)
- end
- end
-
- class PackageCommand < TkValidateCommand
- class ValidateArgs < TkUtil::CallbackSubst
- KEY_TBL = [
- [ ?t, ?w, :token ],
- [ ?W, ?w, :widget ],
- nil
- ]
-
- PROC_TBL = [
- [ ?w, TkComm.method(:window) ],
- nil
- ]
-
- _setup_subst_table(KEY_TBL, PROC_TBL)
-
- def self.ret_val(val)
- val
- end
- end
-
- def self._config_keys
- ['packagecmd']
- end
- end
-
- class SiteCommand < TkValidateCommand
- class ValidateArgs < TkUtil::CallbackSubst
- KEY_TBL = [
- [ ?s, ?b, :compatible ],
- [ ?t, ?w, :token ],
- nil
- ]
-
- PROC_TBL = [
- [ ?b, TkComm.method(:bool) ],
- [ ?w, TkComm.method(:window) ],
- nil
- ]
-
- _setup_subst_table(KEY_TBL, PROC_TBL)
-
- def self.ret_val(val)
- val
- end
- end
-
- def self._config_keys
- ['sitecmd']
- end
- end
-
- def self.__validation_class_list
- super() << PackageCommand << SiteCommand
- end
-
- class << self
- Tk::ValidateConfigure.__def_validcmd(binding, PackageCommand)
- Tk::ValidateConfigure.__def_validcmd(binding, SiteCommand)
- end
-
- ###################################
-
- class DnD_Handle < TkUtil::CallbackSubst
- KEY_TBL = [
- [ ?i, ?s, :ip_name ],
- [ ?v, ?v, :value ],
- [ ?W, ?w, :widget ],
- nil
- ]
-
- PROC_TBL = [
- [ ?i, TkComm.method(:string) ],
- [ ?v, TkComm.method(:tk_tcl2ruby) ],
- [ ?w, TkComm.method(:window) ],
- nil
- ]
-
- _setup_subst_table(KEY_TBL, PROC_TBL)
- end
-
- def self.source_handler(win, datatype, cmd=Proc.new, *args)
- _bind_for_event_class(DnD_Handle,
- ['::blt::drag&drop', 'source', win, 'handler'],
- cmd, *args)
- end
-
- def self.target_handler(win, datatype, cmd=Proc.new, *args)
- _bind_for_event_class(DnD_Handle,
- ['::blt::drag&drop', 'target', win, 'handler'],
- cmd, *args)
- end
-
- ###################################
-
- def self.init_source(win)
- tk_call('::blt::drag&drop', 'source', win)
- end
-
- def self.source()
- list(tk_call('::blt::drag&drop', 'source'))
- end
-
- def self.source_handler_list(win)
- simplelist(tk_call('::blt::drag&drop', 'source', win, 'handler'))
- end
- def self.source_handler_info(win, type)
- tk_tcl2ruby(tk_call('::blt::drag&drop', 'source', win, 'handler', type))
- end
-
- def self.target
- list(tk_call('::blt::drag&drop', 'target'))
- end
- def self.target_handler_list(win)
- simplelist(tk_call('::blt::drag&drop', 'target', win, 'handler'))
- end
-
- def self.handle_target(win, type, val=None)
- tk_call('::blt::drag&drop', 'target', win, 'handle', type, val)
- end
-
- def self.token(win)
- window(tk_call('::blt::drag&drop', 'token', win))
- end
-
- def self.drag(win, x, y)
- tk_call('::blt::drag&drop', 'drag', win, x, y)
- end
- def self.drop(win, x, y)
- tk_call('::blt::drag&drop', 'drop', win, x, y)
- end
-
- def self.errors(cmd=Proc.new)
- tk_call('::blt::drag&drop', 'errors', cmd)
- end
-
- def self.active
- bool(tk_call('::blt::drag&drop', 'active'))
- end
-
- def self.location(x=None, y=None)
- list(tk_call('::blt::drag&drop', 'location', x, y))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/eps.rb b/ext/tk/lib/tkextlib/blt/eps.rb
deleted file mode 100644
index 586a42470c..0000000000
--- a/ext/tk/lib/tkextlib/blt/eps.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# tkextlib/blt/eps.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/canvas'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class EPS < TkcItem
- CItemTypeName = 'eps'.freeze
- CItemTypeToClass[CItemTypeName] = self
- end
-end
-
-class TkCanvas
- alias __BLT_EPS_item_strval_optkeys __item_strval_optkeys
- def __item_strval_optkeys(id)
- __BLT_EPS_item_strval_optkeys(id) + [
- 'shadowcolor', 'title', 'titlecolor'
- ]
- end
- private :__item_strval_optkeys
-
- alias __BLT_EPS_item_boolval_optkeys __item_boolval_optkeys
- def __item_boolval_optkeys(id)
- __BLT_EPS_item_boolval_optkeys(id) + ['showimage']
- end
- private :__item_boolval_optkeys
-end
-
diff --git a/ext/tk/lib/tkextlib/blt/graph.rb b/ext/tk/lib/tkextlib/blt/graph.rb
deleted file mode 100644
index 9ae99bff5c..0000000000
--- a/ext/tk/lib/tkextlib/blt/graph.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# tkextlib/blt/graph.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-require 'tkextlib/blt/component.rb'
-
-module Tk::BLT
- class Graph < TkWindow
- TkCommandNames = ['::blt::graph'.freeze].freeze
- WidgetClassName = 'Graph'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- include PlotComponent
- include GraphCommand
-
- def __boolval_optkeys
- ['bufferelements', 'invertxy']
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- ['text', 'label', 'title', 'file', 'plotbackground']
- end
- private :__strval_optkeys
-
-=begin
- BarElement_ID = ['blt_graph_bar'.freeze, '00000'.taint].freeze
-
- def bar(elem=nil, keys={})
- if elem.kind_of?(Hash)
- keys = elem
- elem = nil
- end
- unless elem
- elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
- BarElement_ID[1].succ!
- end
- tk_send('bar', elem, keys)
- Element.new(self, elem, :without_creating=>true)
- end
-=end
-
- def extents(item)
- num_or_str(tk_send_without_enc('extents', item))
- end
-
- def invtransform(x, y)
- list(tk_send_without_enc('invtransform', x, y))
- end
-
- def inside(x, y)
- bool(tk_send_without_enc('inside', x, y))
- end
-
- def snap(output, keys={})
- tk_send_without_enc('snap', *(hash_kv(keys, false) + output))
- self
- end
-
- def transform(x, y)
- list(tk_send_without_enc('transform', x, y))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb
deleted file mode 100644
index a0cf3dc036..0000000000
--- a/ext/tk/lib/tkextlib/blt/htext.rb
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-# tkextlib/blt/htext.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/itemconfig.rb'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Htext<TkWindow
- Htext_Var = TkVarAccess.new_hash('htext')
- Htext_Widget = TkVarAccess.new('htext(widget)', :window)
- Htext_File = TkVarAccess.new('htext(file)')
- Htext_Line = TkVarAccess.new('htext(line)')
-
- include TkItemConfigMethod
- include Scrollable
-
- TkCommandNames = ['::blt::htext'.freeze].freeze
- WidgetClassName = 'Htext'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- alias window_cget itemcget
- alias window_configure itemconfigure
- alias window_configuinfo itemconfiginfo
- alias current_window_configuinfo current_itemconfiginfo
-
- def __strval_optkeys
- super() << 'filename'
- end
- private :__strval_optkeys
-
- def append(win, keys={})
- tk_send('append', _epath(win), keys)
- self
- end
-
- def goto_line(idx)
- tk_send_without_enc('gotoline', idx)
- self
- end
- def current_line
- number(tk_send_without_enc('gotoline'))
- end
-
- def index(str)
- number(tk_send('index', str))
- end
-
- def line_pos(str)
- tk_send('linepos', str)
- end
-
- def range(from=None, to=None)
- tk_send_without_enc('range', from, to)
- end
-
- def scan_mark(pos)
- tk_send_without_enc('scan', 'mark', pos)
- self
- end
-
- def scan_dragto(pos)
- tk_send_without_enc('scan', 'dragto', pos)
- self
- end
-
- def search(pat, from=None, to=None)
- num = number(tk_send('search', pat, from, to))
- (num < 0)? nil: num
- end
-
- def selection_adjust(index)
- tk_send_without_enc('selection', 'adjust', index)
- self
- end
- def selection_clear()
- tk_send_without_enc('selection', 'clear')
- self
- end
- def selection_from(index)
- tk_send_without_enc('selection', 'from', index)
- self
- end
- def selection_line(index)
- tk_send_without_enc('selection', 'line', index)
- self
- end
- def selection_present()
- bool(tk_send_without_enc('selection', 'present'))
- end
- def selection_range(first, last)
- tk_send_without_enc('selection', 'range', first, last)
- self
- end
- def selection_to(index)
- tk_send_without_enc('selection', 'to', index)
- self
- end
- def selection_word(index)
- tk_send_without_enc('selection', 'word', index)
- self
- end
-
- def windows(pat=None)
- list(tk_send('windows', pat))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/setup.rb b/ext/tk/lib/tkextlib/blt/setup.rb
deleted file mode 100644
index ce0f0bd4d4..0000000000
--- a/ext/tk/lib/tkextlib/blt/setup.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# setup.rb -- setup script before calling TkPackage.require()
-#
-# If you need some setup operations (for example, add a library path
-# to the library search path) before using Tcl/Tk library packages
-# wrapped by Ruby scripts in this directory, please write the setup
-# operations in this file.
-#
diff --git a/ext/tk/lib/tkextlib/blt/spline.rb b/ext/tk/lib/tkextlib/blt/spline.rb
deleted file mode 100644
index 9f75a0b217..0000000000
--- a/ext/tk/lib/tkextlib/blt/spline.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# tkextlib/blt/spline.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module Spline
- extend TkCore
-
- TkCommandNames = ['::blt::spline'.freeze].freeze
-
- def self.natural(x, y, sx, sy)
- tk_call('::blt::spline', 'natural', x, y, sx, sy)
- end
-
- def self.quadratic(x, y, sx, sy)
- tk_call('::blt::spline', 'quadratic', x, y, sx, sy)
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/stripchart.rb b/ext/tk/lib/tkextlib/blt/stripchart.rb
deleted file mode 100644
index fe5afbb095..0000000000
--- a/ext/tk/lib/tkextlib/blt/stripchart.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# tkextlib/blt/stripchart.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-require 'tkextlib/blt/component.rb'
-
-module Tk::BLT
- class Stripchart < TkWindow
- TkCommandNames = ['::blt::stripchart'.freeze].freeze
- WidgetClassName = 'Stripchart'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- include PlotComponent
- include GraphCommand
-
- def __boolval_optkeys
- ['bufferelements', 'buffergraph', 'invertxy']
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- ['text', 'label', 'title', 'file',
- 'background', 'plotbackground']
- end
- private :__strval_optkeys
-
-=begin
- BarElement_ID = ['blt_stripchart_bar'.freeze, '00000'.taint].freeze
-
- def bar(elem=nil, keys={})
- if elem.kind_of?(Hash)
- keys = elem
- elem = nil
- end
- unless elem
- elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
- BarElement_ID[1].succ!
- end
- tk_send('bar', elem, keys)
- Element.new(self, elem, :without_creating=>true)
- end
-=end
-
- def extents(item)
- num_or_str(tk_send_without_enc('extents', item))
- end
-
- def invtransform(x, y)
- list(tk_send_without_enc('invtransform', x, y))
- end
-
- def inside(x, y)
- bool(tk_send_without_enc('inside', x, y))
- end
-
- def metafile(file=None)
- # Windows only
- tk_send('metafile', file)
- self
- end
-
- def snap(output, keys={})
- tk_send_without_enc('snap', *(hash_kv(keys, false) + output))
- self
- end
-
- def transform(x, y)
- list(tk_send_without_enc('transform', x, y))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb
deleted file mode 100644
index fc1bf54e65..0000000000
--- a/ext/tk/lib/tkextlib/blt/table.rb
+++ /dev/null
@@ -1,344 +0,0 @@
-#
-# tkextlib/blt/table.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/itemconfig.rb'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module Table
- include Tk
- extend Tk
- extend TkItemConfigMethod
-
- TkCommandNames = ['::blt::table'.freeze].freeze
-
- module TableContainer
- def blt_table_add(*args)
- Tk::BLT::Table.add(@path, *args)
- self
- end
-
- def blt_table_arrange()
- Tk::BLT::Table.arrange(@path)
- self
- end
-
- def blt_table_cget(*args)
- Tk::BLT::Table.cget(@path, *args)
- end
-
- def blt_table_configure(*args)
- Tk::BLT::Table.configure(@path, *args)
- self
- end
-
- def blt_table_configinfo(*args)
- Tk::BLT::Table.configinfo(@path, *args)
- end
-
- def blt_table_current_configinfo(*args)
- Tk::BLT::Table.current_configinfo(@path, *args)
- end
-
- def blt_table_locate(x, y)
- Tk::BLT::Table.locate(@path, x, y)
- end
-
- def blt_table_delete(*args)
- Tk::BLT::Table.delete(@path, *args)
- self
- end
-
- def blt_table_extents(item)
- Tk::BLT::Table.extents(@path, item)
- end
-
- def blt_table_insert(*args)
- Tk::BLT::Table.insert(@path, *args)
- self
- end
-
- def blt_table_insert_before(*args)
- Tk::BLT::Table.insert_before(@path, *args)
- self
- end
-
- def blt_table_insert_after(*args)
- Tk::BLT::Table.insert_after(@path, *args)
- self
- end
-
- def blt_table_join(first, last)
- Tk::BLT::Table.join(@path, first, last)
- self
- end
-
- def blt_table_save()
- Tk::BLT::Table.save(@path)
- end
-
- def blt_table_search(*args)
- Tk::BLT::Table.search(@path, *args)
- end
-
- def blt_table_split(*args)
- Tk::BLT::Table.split(@path, *args)
- self
- end
-
- def blt_table_itemcget(*args)
- Tk::BLT::Table.itemcget(@path, *args)
- end
-
- def blt_table_itemconfigure(*args)
- Tk::BLT::Table.itemconfigure(@path, *args)
- self
- end
-
- def blt_table_itemconfiginfo(*args)
- Tk::BLT::Table.itemconfiginfo(@path, *args)
- end
-
- def blt_table_current_itemconfiginfo(*args)
- Tk::BLT::Table.current_itemconfiginfo(@path, *args)
- end
-
- def blt_table_iteminfo(item)
- Tk::BLT::Table.iteminfo(@path, item)
- end
- end
- end
-end
-
-
-############################################
-class << Tk::BLT::Table
- def __item_cget_cmd(id) # id := [ container, item ]
- ['::blt::table', 'cget', id[0].path, id[1]]
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id) # id := [ container, item, ... ]
- container, *items = id
- ['::blt::table', 'configure', container.path, *items]
- end
- private :__item_config_cmd
-
- def __item_pathname(id)
- id[0].path + ';'
- end
- private :__item_pathname
-
- alias __itemcget itemcget
- alias __itemconfigure itemconfigure
- alias __itemconfiginfo itemconfiginfo
- alias __current_itemconfiginfo current_itemconfiginfo
-
- private :__itemcget, :__itemconfigure
- private :__itemconfiginfo, :__current_itemconfiginfo
-
- def __boolval_optkeys
- super() << 'propagate'
- end
- private :__boolval_optkeys
-
- def tagid(tag)
- if tag.kind_of?(Array)
- case tag[0]
- when Integer
- # [row, col]
- tag.join(',')
- when :c, :C, 'c', 'C', :r, :R, 'r', 'R'
- # c0 or r1 or C*, and so on
- tag.collect{|elem| elem.to_s}.join('')
- else
- tag
- end
- elsif tag.kind_of?(TkWindow)
- _epath(tag)
- else
- tag
- end
- end
-
- def tagid2obj(tagid)
- tagid
- end
-
- ############################################
-
- def cget(container, option)
- __itemcget([container], option)
- end
-
- def configure(container, *args)
- __itemconfigure([container], *args)
- end
-
- def configinfo(container, *args)
- __itemconfiginfo([container], *args)
- end
-
- def current_configinfo(container, *args)
- __current_itemconfiginfo([container], *args)
- end
-
- def itemcget(container, item, option)
- __itemcget([container, tagid(item)], option)
- end
-
- def itemconfigure(container, *args)
- if args[-1].kind_of?(Hash)
- # container, item, item, ... , hash_optkeys
- keys = args.pop
- id = [container]
- args.each{|item| id << tagid(item)}
- __itemconfigure(id, keys)
- else
- # container, item, item, ... , option, value
- val = args.pop
- opt = args.pop
- id = [container]
- args.each{|item| id << tagid(item)}
- __itemconfigure(id, opt, val)
- end
- end
-
- def itemconfiginfo(container, *args)
- slot = args[-1]
- if slot.kind_of?(String) || slot.kind_of?(Symbol)
- slot = slot.to_s
- if slot[0] == ?. || slot =~ /^\d+,\d+$/ || slot =~ /^(c|C|r|R)(\*|\d+)/
- # widget || row,col || Ci or Ri
- slot = nil
- else
- # option
- slot = args.pop
- end
- else
- slot = nil
- end
-
- id = [container]
- args.each{|item| id << tagid(item)}
- __itemconfiginfo(id, slot)
- end
-
- def info(container)
- ret = {}
- inf = list(tk_call('::blt::table', 'info', container))
- until inf.empty?
- opt = inf.slice!(0..1)
- ret[opt[1..-1]] = opt[1]
- end
- ret
- end
-
- def iteminfo(container, item)
- ret = {}
- inf = list(tk_call('::blt::table', 'info', container, tagid(item)))
- until inf.empty?
- opt = inf.slice!(0..1)
- ret[opt[1..-1]] = opt[1]
- end
- ret
- end
-
- ############################################
-
- def create_container(container)
- tk_call('::blt::table', container)
- begin
- class << container
- include Tk::BLT::TABLE::TableContainer
- end
- rescue
- warn('fail to include TableContainer methods (frozen object?)')
- end
- container
- end
-
- def add(container, *args)
- if args.empty?
- tk_call('::blt::table', container)
- else
- args = args.collect{|arg|
- if arg.kind_of?(TkWindow)
- _epath(arg)
- elsif arg.kind_of?(Array) # index
- arg.join(',')
- else
- arg
- end
- }
- tk_call('::blt::table', container, *args)
- end
- end
-
- def arrange(container)
- tk_call('::blt::table', 'arrange', container)
- end
-
- def delete(container, *args)
- tk_call('::blt::table', 'delete', container, *args)
- end
-
- def extents(container, item)
- ret = []
- inf = list(tk_call('::blt::table', 'extents', container, item))
- ret << inf.slice!(0..4) until inf.empty?
- ret
- end
-
- def forget(*wins)
- wins = wins.collect{|win| _epath(win)}
- tk_call('::blt::table', 'forget', *wins)
- end
-
- def insert(container, *args)
- tk_call('::blt::table', 'insert', container, *args)
- end
-
- def insert_before(container, *args)
- tk_call('::blt::table', 'insert', container, '-before', *args)
- end
-
- def insert_after(container, *args)
- tk_call('::blt::table', 'insert', container, '-after', *args)
- end
-
- def join(container, first, last)
- tk_call('::blt::table', 'join', container, first, last)
- end
-
- def locate(container, x, y)
- tk_call('::blt::table', 'locate', container, x, y)
- end
-
- def containers(arg={})
- list(tk_call('::blt::table', 'containers', *hash_kv(arg)))
- end
-
- def containers_pattern(pat)
- list(tk_call('::blt::table', 'containers', '-pattern', pat))
- end
-
- def containers_slave(win)
- list(tk_call('::blt::table', 'containers', '-slave', win))
- end
-
- def save(container)
- tk_call('::blt::table', 'save', container)
- end
-
- def search(container, keys={})
- list(tk_call('::blt::table', 'containers', *hash_kv(keys)))
- end
-
- def split(container, *args)
- tk_call('::blt::table', 'split', container, *args)
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tabnotebook.rb b/ext/tk/lib/tkextlib/blt/tabnotebook.rb
deleted file mode 100644
index 508fa2b82f..0000000000
--- a/ext/tk/lib/tkextlib/blt/tabnotebook.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# tkextlib/blt/tabnotebook.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-require 'tkextlib/blt/tabset.rb'
-
-module Tk::BLT
- class Tabnotebook < Tabset
- TkCommandNames = ['::blt::tabnotebook'.freeze].freeze
- WidgetClassName = 'Tabnotebook'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def get_tab(index)
- Tk::BLT::Tabset::Tab.id2obj(tk_send_without_enc('id', tagindex(index)))
- end
- alias get_id get_tab
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb
deleted file mode 100644
index c26b6ee001..0000000000
--- a/ext/tk/lib/tkextlib/blt/tabset.rb
+++ /dev/null
@@ -1,401 +0,0 @@
-#
-# tkextlib/blt/tabset.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Tabset < TkWindow
- class Tab < TkObject
- include TkTreatItemFont
-
- TabID_TBL = TkCore::INTERP.create_table
- TabsetTab_ID = ['blt_tabset_tab'.freeze, '00000'.taint].freeze
-
- TkCore::INTERP.init_ip_env{ TabID_TBL.clear }
-
- def self.id2obj(tabset, id)
- tpath = tabset.path
- return id unless TabID_TBL[tpath]
- TabID_TBL[tpath][id]? TabID_TBL[tpath]: id
- end
-
- def self.new(parent, pos=nil, name=nil, keys={})
- if pos.kind_of?(Hash)
- keys = pos
- name = nil
- pos = nil
- end
- if name.kind_of?(Hash)
- keys = name
- name = nil
- end
-
- if name && TabID_TBL[parent.path] && TabID_TBL[parent.path][name]
- TabID_TBL[parent.path][name]
- else
- super(parent, pos, name, keys)
- end
- end
-
- def initialize(parent, pos, name, keys)
- @t = parent
- @tpath = parent.path
- if name
- @path = @id = name
- TabID_TBL[@tpath] = {} unless TabID_TBL[@tpath]
- TabID_TBL[@tpath][@id] = self
-
- unless (list(tk_call(@tpath, 'tab', 'names', @id)).empty?)
- if pos
- idx = tk_call(@tpath, 'index', '-name', @id)
- if pos.to_s == 'end'
- tk_call(@tpath, idx, 'moveto', 'after', 'end')
- else
- tk_call(@tpath, idx, 'moveto', 'before', pos)
- end
- end
- tk_call(@tpath, 'tab', 'configure', @id, keys)
- return
- end
-
- else
- @path = @id = TabsetTab_ID.join(TkCore::INTERP._ip_id_)
- TabID_TBL[@tpath] = {} unless TabID_TBL[@tpath]
- TabID_TBL[@tpath][@id] = self
- TabsetTab_ID[1].succ!
- end
-
- pos = 'end' unless pos
- tk_call(@tpath, 'insert', pos, @id, keys)
- end
-
- #def bind(context, cmd=Proc.new, *args)
- # @t.tab_bind(@id, context, cmd, *args)
- # self
- #end
- def bind(context, *args)
- # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- @t.tab_bind(@id, context, cmd, *args)
- self
- end
- #def bind_append(context, cmd=Proc.new, *args)
- # @t.tab_bind_append(@id, context, cmd, *args)
- # self
- #end
- def bind_append(context, *args)
- # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- @t.tab_bind_append(@id, context, cmd, *args)
- self
- end
- def bind_remove(context)
- @t.tab_bind_remove(@id, context)
- self
- end
- def bindinfo(context=nil)
- @t.tab_bindinfo(@id, context)
- end
-
- def cget(*args)
- @t.tab_cget(@id, *args)
- end
- def configure(*args)
- @t.tab_configure(@id, *args)
- end
- def configinfo(*args)
- @t.tab_configinfo(@id, *args)
- end
- def current_configinfo(*args)
- @t.current_tab_configinfo(@id, *args)
- end
-
- def delete()
- @t.delete(@id)
- TabID_TBL[@tpath].delete(@id)
- self
- end
-
- def get_name()
- @id.dup
- end
-
- def focus()
- @t.focus(self.index)
- end
-
- def index()
- @t.index_name(@id)
- end
-
- def invoke()
- @t.invoke(self.index)
- end
-
- def move_before(idx)
- @t.move_before(self.index, idx)
- end
- def move_after(idx)
- @t.move_after(self.index, idx)
- end
-
- def perforation_highlight(mode)
- @t.perforation.highlight(self.index, mode)
- end
- def perforation_invoke()
- @t.perforation.invoke(self.index)
- end
-
- def see()
- @t.see(self.index)
- end
-
- def tearoff(name=None)
- @t.tab_tearoff(self.index, *args)
- end
- end
-
- ########################################
-
- class NamedTab < Tab
- def self.new(parent, name)
- super(parent, nil, name, {})
- end
- end
-
- ########################################
-
- include X_Scrollable
- include TkItemConfigMethod
-
- TkCommandNames = ['::blt::tabset'.freeze].freeze
- WidgetClassName = 'Tabset'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def __destroy_hook__
- Tk::BLT::Tabset::Tab::TabID_TBL.delete(@path)
- end
-
- ########################################
-
- def __boolval_optkeys
- super() << 'samewidth' << 'tearoff'
- end
- private :__strval_optkeys
-
- def __strval_optkeys
- super() << 'tabbackground' << 'tabforeground'
- end
- private :__strval_optkeys
-
- def __item_cget_cmd(id)
- [self.path, 'tab', 'cget', id]
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id)
- [self.path, 'tab', 'configure', id]
- end
- private :__item_config_cmd
-
- def __item_pathname(tagOrId)
- if tagOrId.kind_of?(Tk::BLT::Tabset::Tab)
- self.path + ';' + tagOrId.id.to_s
- else
- self.path + ';' + tagOrId.to_s
- end
- end
- private :__item_pathname
-
- alias tab_cget itemcget
- alias tab_configure itemconfigure
- alias tab_configinfo itemconfiginfo
- alias current_tab_configinfo current_itemconfiginfo
-
- def __item_strval_optkeys(id)
- super(id) << 'shadow'
- end
- private :__item_strval_optkeys
-
- def tagid(tab)
- if tab.kind_of?(Tk::BLT::Tabset::Tab)
- tab.id
- else
- tab
- end
- end
-
- def tagindex(tab)
- if tab.kind_of?(Tk::BLT::Tabset::Tab)
- tab.index
- else
- tab
- end
- end
-
- ########################################
-
- def activate(index)
- tk_send('activate', tagindex(index))
- self
- end
- alias highlight activate
-
- #def tabbind(tag, context, cmd=Proc.new, *args)
- # _bind([path, "bind", tagid(tag)], context, cmd, *args)
- # self
- #end
- def tabbind(tag, context, *args)
- # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([path, "bind", tagid(tag)], context, cmd, *args)
- self
- end
- #def tabbind_append(tag, context, cmd=Proc.new, *args)
- # _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
- # self
- #end
- def tabbind_append(tag, context, *args)
- # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
- self
- end
- def tabbind_remove(tag, context)
- _bind_remove([path, "bind", tagid(tag)], context)
- self
- end
- def tabbindinfo(tag, context=nil)
- _bindinfo([path, "bind", tagid(tag)], context)
- end
-
- def delete(first, last=None)
- tk_send('delete', tagindex(first), tagindex(last))
- if first.kind_of?(Tk::BLT::Tabset::Tab)
- TabID_TBL[@path].delete(first.id)
- end
- # middle tabs of the range are unknown
- if last.kind_of?(Tk::BLT::Tabset::Tab)
- TabID_TBL[@path].delete(last.id)
- end
- self
- end
-
- def focus(index)
- tk_send('focus', tagindex(index))
- self
- end
-
- def get_tab(index)
- Tk::BLT::Tabset::Tab.id2obj(tk_send_without_enc('get', tagindex(index)))
- end
-
- def index(str)
- num_or_str(tk_send('index', str))
- end
- def index_name(tab)
- num_or_str(tk_send('index', '-mame', tagid(tab)))
- end
-
- def insert(pos, tab, keys={})
- Tk::BLT::Tabset::Tab.new(self, tagindex(pos), tagid(tab), keys)
- end
-
- def invoke(index)
- tk_send('invoke', tagindex(index))
- end
-
- def move_before(index, base_idx)
- tk_send('move', tagindex(index), 'before', tagindex(base_idx))
- self
- end
- def move_after(index, base_idx)
- tk_send('move', tagindex(index), 'after', tagindex(base_idx))
- self
- end
-
- def nearest(x, y)
- Tk::BLT::Tabset::Tab.id2obj(num_or_str(tk_send_without_enc('nearest', x, y)))
- end
-
- def perforation_highlight(index, mode)
- tk_send('perforation', 'highlight', tagindex(index), mode)
- self
- end
- def perforation_invoke(index)
- tk_send('perforation', 'invoke', tagindex(index))
- end
-
- def scan_mark(x, y)
- tk_send_without_enc('scan', 'mark', x, y)
- self
- end
- def scan_dragto(x, y)
- tk_send_without_enc('scan', 'dragto', x, y)
- self
- end
-
- def see(index)
- tk_send('see', tagindex(index))
- self
- end
-
- def size()
- number(tk_send_without_enc('size'))
- end
-
- def select(index)
- tk_send('select', tagindex(index))
- self
- end
-
- def tab_names(pat=None)
- simplelist(tk_send('tab', 'names', pat)).collect{|name|
- Tk::BLT::Tabset::Tab.id2obj(name)
- }
- end
-
- def tab_tearoff(index, name=None)
- window(tk_send('tab', 'tearoff', tagindex(index), name))
- end
-
- def xscrollcommand(cmd=Proc.new)
- configure_cmd 'scrollcommand', cmd
- self
- end
- alias scrollcommand xscrollcommand
-
- def xview(*index)
- if index.empty?
- list(tk_send_without_enc('view'))
- else
- tk_send_without_enc('view', *index)
- self
- end
- end
- alias view xview
- alias view_moveto xview_moveto
- alias view_scroll xview_scroll
-
- alias scrollbar xscrollbar
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/ted.rb b/ext/tk/lib/tkextlib/blt/ted.rb
deleted file mode 100644
index 39495842b4..0000000000
--- a/ext/tk/lib/tkextlib/blt/ted.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# tkextlib/blt/ted.rb
-#
-# *** This is alpha version, because there is no document on BLT. ***
-#
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module Ted
- extend TkCore
-
- TkCommandNames = ['::blt::ted'.freeze].freeze
-
- ##############################
-
- extend TkItemConfigMethod
-
- class << self
- def __item_cget_cmd(id)
- ['::blt::ted', 'cget', id]
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id)
- ['::blt::ted', 'configure', id]
- end
- private :__item_config_cmd
-
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
-
- def cget(master, option)
- itemconfigure(master, slot, value)
- end
- def configure(master, slot, value=None)
- itemconfigure(master, slot, value)
- end
- def configinfo(master, slot=nil)
- itemconfiginfo(master, slot)
- end
- def current_configinfo(master, slot=nil)
- current_itemconfiginfo(master, slot)
- end
- end
-
- ##############################
-
- def self.edit(master, *args)
- tk_call('::blt::ted', 'edit', master, *args)
- end
- def self.rep(master, *args)
- tk_call('::blt::ted', 'rep', master, *args)
- end
- def self.select(master, *args)
- tk_call('::blt::ted', 'select', master, *args)
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile.rb b/ext/tk/lib/tkextlib/blt/tile.rb
deleted file mode 100644
index 5f5242f299..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# tkextlib/blt/tile.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module Tile
- autoload :Button, 'tkextlib/blt/tile/button.rb'
- autoload :CheckButton, 'tkextlib/blt/tile/checkbutton.rb'
- autoload :Checkbutton, 'tkextlib/blt/tile/checkbutton.rb'
- autoload :Radiobutton, 'tkextlib/blt/tile/radiobutton.rb'
- autoload :RadioButton, 'tkextlib/blt/tile/radiobutton.rb'
- autoload :Frame, 'tkextlib/blt/tile/frame.rb'
- autoload :Label, 'tkextlib/blt/tile/label.rb'
- autoload :Scrollbar, 'tkextlib/blt/tile/scrollbar.rb'
- autoload :Toplevel, 'tkextlib/blt/tile/toplevel.rb'
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/button.rb b/ext/tk/lib/tkextlib/blt/tile/button.rb
deleted file mode 100644
index dd715c8b98..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/button.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# tkextlib/blt/tile/button.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/button'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Button < TkButton
- TkCommandNames = ['::blt::tile::button'.freeze].freeze
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb b/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb
deleted file mode 100644
index ebe79179a5..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/checkbutton.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# tkextlib/blt/tile/checkbutton.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/checkbutton'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Checkbutton < TkCheckbutton
- TkCommandNames = ['::blt::tile::checkbutton'.freeze].freeze
- end
- CheckButton = Checkbutton
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/frame.rb b/ext/tk/lib/tkextlib/blt/tile/frame.rb
deleted file mode 100644
index 10469fd35f..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/frame.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# tkextlib/blt/tile/frame.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/frame'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Frame < TkFrame
- TkCommandNames = ['::blt::tile::frame'.freeze].freeze
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/label.rb b/ext/tk/lib/tkextlib/blt/tile/label.rb
deleted file mode 100644
index ec67babd58..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/label.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# tkextlib/blt/tile/label.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/label'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Label < TkLabel
- TkCommandNames = ['::blt::tile::label'.freeze].freeze
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb b/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb
deleted file mode 100644
index 7573aa08d6..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/radiobutton.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# tkextlib/blt/tile/radiobutton.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/radiobutton'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Radiobutton < TkRadiobutton
- TkCommandNames = ['::blt::tile::radiobutton'.freeze].freeze
- end
- RadioButton = Radiobutton
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb b/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb
deleted file mode 100644
index ba3bf316f0..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/scrollbar.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# tkextlib/blt/tile/scrollbar.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/scrollbar'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Scrollbar < TkScrollbar
- TkCommandNames = ['::blt::tile::scrollbar'.freeze].freeze
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tile/toplevel.rb b/ext/tk/lib/tkextlib/blt/tile/toplevel.rb
deleted file mode 100644
index 6cc2c91415..0000000000
--- a/ext/tk/lib/tkextlib/blt/tile/toplevel.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# tkextlib/blt/tile/toplevel.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/toplevel'
-require 'tkextlib/blt/tile.rb'
-
-module Tk::BLT
- module Tile
- class Toplevel < TkToplevel
- TkCommandNames = ['::blt::tile::toplevel'.freeze].freeze
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/tree.rb b/ext/tk/lib/tkextlib/blt/tree.rb
deleted file mode 100644
index 07dc7ef7e8..0000000000
--- a/ext/tk/lib/tkextlib/blt/tree.rb
+++ /dev/null
@@ -1,923 +0,0 @@
-#
-# tkextlib/blt/tree.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Tree < TkObject
- TkCommandNames = ['::blt::tree'.freeze].freeze
-
- ###################################
-
- class Node < TkObject
- TreeNodeID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ TreeNodeID_TBL.clear }
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless TreeNodeID_TBL[tpath]
- if TreeNodeID_TBL[tpath][id]
- TreeNodeID_TBL[tpath][id]
- else
- begin
- self.new(tree, nil, 'node'=>Integer(id))
- rescue
- id
- end
- end
- end
-
- def self.new(tree, parent, keys={})
- keys = _symbolkey2str(keys)
- tpath = tree.path
-
- if (id = keys['node']) && (obj = TreeNodeID_TBL[tpath][id])
- keys.delete('node')
- tk_call(tree.path, 'move', id, parent, keys) if parent
- return obj
- end
-
- super(tree, parent, keys)
- end
-
- def initialize(tree, parent, keys={})
- @parent = @tree = tree
- @tpath = @parent.path
-
- parent = tk_call(@tpath, 'root') unless parent
-
- if (id = keys['node']) && bool(tk_call(@tpath, 'exists', id))
- @path = @id = id
- keys.delete('node')
- tk_call(@tpath, 'move', @id, parent, keys) if parent
- else
- @path = @id = tk_call(@tpath, 'insert', parent, keys)
- end
-
- TreeNodeID_TBL[@tpath] = {} unless TreeNodeID_TBL[@tpath]
- TreeNodeID_TBL[@tpath][@id] = self
- end
-
- def id
- @id
- end
-
- def apply(keys={})
- @tree.apply(@id, keys)
- self
- end
-
- def children()
- @tree.children(@id)
- end
-
- def copy(parent, keys={})
- @tree.copy(@id, parent, keys)
- end
- def copy_to(dest_tree, parent, keys={})
- @tree.copy_to(@id, dest_tree, parent, keys)
- end
-
- def degree()
- @tree.degree(@id)
- end
-
- def delete()
- @tree.delete(@id)
- self
- end
-
- def depth()
- @tree.depth(@id)
- end
-
- def dump()
- @tree.dump(@id)
- end
-
- def dump_to_file(file)
- @tree.dump_to_file(@id, file)
- self
- end
-
- def exist?(keys={})
- @tree.exist?(@id, keys)
- end
-
- def find(keys={})
- @tree.find(@id, keys)
- end
-
- def find_child(label)
- @tree.find_child(@id, label)
- end
-
- def first_child()
- @tree.first_child(@id)
- end
-
- def get()
- @tree.get(@id)
- end
- def get_value(key, default_val=None)
- @tree.get_value(@id, key, default_val)
- end
-
- def index()
- @tree.index(@id)
- end
-
- def leaf?()
- @tree.leaf?(@id)
- end
- def link?()
- @tree.link?(@id)
- end
- def root?()
- @tree.root?(@id)
- end
-
- def keys()
- @tree.keys(@id)
- end
-
- def label(text = nil)
- @tree.label(@id, nil)
- end
- def label=(text)
- @tree.label(@id, text)
- end
-
- def last_child()
- @tree.last_child(@id)
- end
-
- def move(dest, keys={})
- @tree.keys(@id, dest, keys)
- self
- end
-
- def next()
- @tree.next(@id)
- end
-
- def next_sibling()
- @tree.next_sibling(@id)
- end
-
- def parent()
- @tree.parent(@id)
- end
-
- def fullpath()
- @tree.fullpath(@id)
- end
-
- def position()
- @tree.position(@id)
- end
-
- def previous()
- @tree.previous(@id)
- end
-
- def prev_sibling()
- @tree.prev_sibling(@id)
- end
-
- def restore(str, keys={})
- @tree.restore(@id, str, keys)
- self
- end
- def restore_overwrite(str, keys={})
- @tree.restore_overwrite(@id, str, keys)
- self
- end
-
- def restore_from_file(file, keys={})
- @tree.restore_from_file(@id, file, keys)
- self
- end
- def restore_overwrite_from_file(file, keys={})
- @tree.restore_overwrite_from_file(@id, file, keys)
- self
- end
-
- def root()
- @tree.root(@id)
- self
- end
-
- def set(data)
- @tree.set(@id, data)
- self
- end
-
- def size()
- @tree.size(@id)
- end
-
- def sort(keys={})
- @tree.sort(@id, keys)
- self
- end
-
- def type(key)
- @tree.type(@id, key)
- end
-
- def unset(*keys)
- @tree.unset(@id, *keys)
- self
- end
-
- def values(key=None)
- @tree.values(@id, key)
- end
- end
-
- ###################################
-
- class Tag < TkObject
- TreeTagID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ TreeTagID_TBL.clear }
- TreeTag_ID = ['blt_tree_tag'.freeze, '00000'.taint].freeze
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless TreeTagID_TBL[tpath]
- if TreeTagID_TBL[tpath][id]
- TreeTagID_TBL[tpath][id]
- else
- self.new(tree, id)
- end
- end
-
- def initialize(tree, tag_str = nil)
- @parent = @tree = tree
- @tpath = @parent.path
-
- if tag_str
- @path = @id = tag_str.dup.freeze
- else
- @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_)
- TreeTagID_TBL[@id] = self
- TreeTag_ID[1].succ!
- end
- TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
- TreeTagID_TBL[@tpath][@id] = self
- end
-
- def id
- @id
- end
-
- def add(*nodes)
- tk_call(@tpath, 'tag', 'add', @id, *nodes)
- self
- end
-
- def delete(*nodes)
- tk_call(@tpath, 'tag', 'delete', @id, *nodes)
- self
- end
-
- def forget()
- tk_call(@tpath, 'tag', 'forget', @id)
- TreeTagID_TBL[@tpath].delete(@id)
- self
- end
-
- def nodes()
- simplelist(tk_call(@tpath, 'tag', 'nodes', @id)).collect{|node|
- Tk::BLT::Tree::Node.id2obj(@path, node)
- }
- end
-
- def set(node)
- tk_call(@tpath, 'tag', 'set', node, @id)
- self
- end
-
- def unset(node)
- tk_call(@tpath, 'tag', 'unset', node, @id)
- self
- end
- end
-
- ###################################
-
- class Notify < TkObject
- NotifyID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ NotifyID_TBL.clear }
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless NotifyID_TBL[tpath]
- if NotifyID_TBL[tpath][id]
- NotifyID_TBL[tpath][id]
- else
- begin
- self.new([tree, id])
- rescue
- id
- end
- end
- end
-
- def self.new(tree, *args, &b)
- if tree.kind_of?(Array)
- # not create
- if obj = NotifyID_TBL[tree[0].path][tree[1]]
- return obj
- else
- return super(false, tree[0], tree[1])
- end
- end
-
- super(true, tree, *args, &b)
- end
-
- def initialize(create, tree, *args, &b)
- @parent = @tree = tree
- @tpath = @parent.path
-
- unless create
- @path = @id = args[0]
- return
- end
-
- # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
- cmd = args.shift
- # elsif args[-1].kind_of?(Proc) || args[-1].kind_of?(Method)
- elsif TkComm._callback_entry?(args[-1])
- cmd = args.pop
- elsif b
- cmd = Proc.new(&b)
- else
- fail ArgumentError, "lack of 'command' argument"
- end
-
- args = args.collect{|arg| '-' << arg.to_s}
-
- args << proc{|id, type|
- cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id),
- ((type[0] == ?-)? type[1..-1]: type))
- }
-
- @path = @id = tk_call(@tpath, 'notify', 'create', *args)
- end
-
- def id
- @id
- end
-
- def delete()
- tk_call(@tpath, 'notify', 'delete', @id)
- NotifyID_TBL[tpath].delete(@id)
- self
- end
-
- def info()
- lst = simplelist(tk_call(@tpath, 'notify', 'info', id))
- lst[0] = Tk::BLT::Tree::Notify.id2obj(@tree, lst[0])
- lst[1] = simplelist(lst[1]).collect{|flag| flag[1..-1]}
- lst[2] = tk_tcl2ruby(lst[2])
- lst
- end
- end
-
- ###################################
-
- class Trace < TkObject
- TraceID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ TraceID_TBL.clear }
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless TraceID_TBL[tpath]
- if TraceID_TBL[tpath][id]
- TraceID_TBL[tpath][id]
- else
- begin
- self.new([tree, id])
- rescue
- id
- end
- end
- end
-
- def self.new(tree, *args, &b)
- if tree.kind_of?(Array)
- # not create
- if obj = TraceID_TBL[tree[0].path][tree[1]]
- return obj
- else
- return super(false, tree[0], tree[1])
- end
- end
-
- super(true, tree, *args, &b)
- end
-
- def initialize(create, tree, node, key, opts, cmd=nil, &b)
- @parent = @tree = tree
- @tpath = @parent.path
-
- unless create
- @path = @id = node # == traceID
- return
- end
-
- if !cmd
- if b
- cmd = Proc.new(&b)
- else
- fail ArgumentError, "lack of 'command' argument"
- end
- end
-
- @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts,
- proc{|t, id, k, ops|
- tobj = Tk::BLT::Tree.id2obj(t)
- if tobj.kind_of?(Tk::BLT::Tree)
- nobj = Tk::BLT::Tree::Node.id2obj(tobj, id)
- else
- nobj = id
- end
- cmd.call(tobj, nobj, k, ops)
- })
- end
-
- def id
- @id
- end
-
- def delete()
- tk_call(@tpath, 'trace', 'delete', @id)
- TraceID_TBL[tpath].delete(@id)
- self
- end
-
- def info()
- lst = simplelist(tk_call(@tpath, 'trace', 'info', id))
- lst[0] = Tk::BLT::Tree::Trace.id2obj(@tree, lst[0])
- lst[2] = simplelist(lst[2])
- lst[3] = tk_tcl2ruby(lst[3])
- lst
- end
- end
-
- ###################################
-
- TreeID_TBL = TkCore::INTERP.create_table
- Tree_ID = ['blt_tree'.freeze, '00000'.taint].freeze
-
- def __keyonly_optkeys
- {
- # apply / find command
- 'invert'=>nil, 'leafonly'=>nil, 'nocase'=>nil,
-
- # apply / find / sort command
- 'path'=>nil,
-
- # copy / restore / restorefile command
- 'overwrite'=>nil,
-
- # copy command
- 'recurse'=>nil, 'tags'=>nil,
-
- # sort command
- 'ascii'=>nil, 'decreasing'=>nil, 'disctionary'=>nil,
- 'integer'=>nil, 'real'=>nil, 'recurse'=>nil, 'reorder'=>nil,
- }
- end
-
- def self.id2obj(id)
- TreeID_TBL[id]? TreeID_TBL[id]: id
- end
-
- def self.names(pat = None)
- simplelist(tk_call('::blt::tree', 'names', pat)).collect{|name|
- id2obj(name)
- }
- end
-
- def self.destroy(*names)
- tk_call('::blt::tree', 'destroy',
- *(names.collect{|n| (n.kind_of?(Tk::BLT::Tree))? n.id: n }) )
- end
-
- def self.new(name = nil)
- return TreeID_TBL[name] if name && TreeID_TBL[name]
- super(name)
- end
-
- def initialzie(name = nil)
- if name
- @path = @id = name
- else
- @path = @id = Tree_ID.join(TkCore::INTERP._ip_id_)
- TreeID_TBL[@id] = self
- Tree_ID[1].succ!
- end
- TreeID_TBL[@id] = self
- tk_call('::blt::tree', 'create', @id)
- end
-
- def __destroy_hook__
- Tk::BLT::Tree::Node::TreeNodeID_TBL.delete(@path)
- Tk::BLT::Tree::Tag::TreeTagID_TBL.delete(@path)
- Tk::BLT::Tree::Notify::NotifyID_TBL.delete(@path)
- Tk::BLT::Tree::Trace::TraceID_TBL.delete(@path)
- end
-
- def tagid(tag)
- if tag.kind_of?(Tk::BLT::Tree::Node) ||
- tag.kind_of?(Tk::BLT::Tree::Tag) ||
- tag.kind_of?(Tk::BLT::Tree::Notify) ||
- tag.kind_of?(Tk::BLT::Tree::Trace)
- tag.id
- else
- tag # maybe an Array of configure paramters
- end
- end
-
- def destroy()
- tk_call('::blt::tree', 'destroy', @id)
- self
- end
-
- def ancestor(node1, node2)
- Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'ancestor',
- tagid(node1), tagid(node2)))
- end
-
- def apply(node, keys={})
- tk_call('::blt::tree', 'apply', tagid(node), __conv_keyonly_opts(keys))
- self
- end
-
- def attach(tree_obj)
- tk_call('::blt::tree', 'attach', tree_obj)
- self
- end
-
- def children(node)
- simplelist(tk_call('::blt::tree', 'children', tagid(node))).collect{|n|
- Tk::BLT::Tree::Node.id2obj(self, n)
- }
- end
-
- def copy(src, parent, keys={})
- id = tk_call('::blt::tree', 'copy', tagid(src), tagid(parent),
- __conv_keyonly_opts(keys))
- Tk::BLT::Tree::Node.new(self, nil, 'node'=>id)
- end
- def copy_to(src, dest_tree, parent, keys={})
- return copy(src, parent, keys={}) unless dest_tree
-
- id = tk_call('::blt::tree', 'copy', tagid(src), dest_tree,
- tagid(parent), __conv_keyonly_opts(keys))
- Tk::BLT::Tree::Node.new(dest_tree, nil, 'node'=>id)
- end
-
- def degree(node)
- number(tk_call('::blt::tree', 'degree', tagid(node)))
- end
-
- def delete(*nodes)
- tk_call('::blt::tree', 'delete', *(nodes.collect{|node| tagid(node)}))
- nodes.each{|node|
- if node.kind_of?(Tk::BLT::Tree::Node)
- Tk::BLT::Tree::Node::TreeNodeID_TBL[@path].delete(node.id)
- else
- Tk::BLT::Tree::Node::TreeNodeID_TBL[@path].delete(node.to_s)
- end
- }
- self
- end
-
- def depth(node)
- number(tk_call('::blt::tree', 'depth', tagid(node)))
- end
-
- def dump(node)
- simplelist(tk_call('::blt::tree', 'dump', tagid(node))).collect{|n|
- simplelist(n)
- }
- end
-
- def dump_to_file(node, file)
- tk_call('::blt::tree', 'dumpfile', tagid(node), file)
- self
- end
-
- def exist?(node, key=None)
- bool(tk_call('::blt::tree', 'exists', tagid(node), key))
- end
-
- def find(node, keys={})
- simplelist(tk_call('::blt::tree', 'find', tagid(node),
- __conv_keyonly_opts(keys))).collect{|n|
- Tk::BLT::Tree::Node.id2obj(self, n)
- }
- end
-
- def find_child(node, label)
- ret = tk_call('::blt::tree', 'findchild', tagid(node), label)
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def first_child(node)
- ret = tk_call('::blt::tree', 'firstchild', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def get(node)
- Hash[*simplelist(tk_call('::blt::tree', 'get', tagid(node)))]
- end
- def get_value(node, key, default_val=None)
- tk_call('::blt::tree', 'get', tagid(node), key, default_val)
- end
-
- def index(node)
- Tk::BLT::Tree::Node.id2obj(self,
- tk_call('::blt::tree', 'index', tagid(node)))
- end
-
- def insert(parent, keys={})
- id = tk_call('::blt::tree', 'insert', tagid(parent), keys)
- Tk::BLT::Tree::Node.new(self, nil, 'node'=>id)
- end
-
- def ancestor?(node1, node2)
- bool(tk_call('::blt::tree', 'is', 'ancestor',
- tagid(node1), tagid(node2)))
- end
- def before?(node1, node2)
- bool(tk_call('::blt::tree', 'is', 'before',
- tagid(node1), tagid(node2)))
- end
- def leaf?(node)
- bool(tk_call('::blt::tree', 'is', 'leaf', tagid(node)))
- end
- def link?(node)
- bool(tk_call('::blt::tree', 'is', 'link', tagid(node)))
- end
- def root?(node)
- bool(tk_call('::blt::tree', 'is', 'root', tagid(node)))
- end
-
- def keys(node, *nodes)
- if nodes.empty?
- simplelist(tk_call('blt::tree', 'keys', tagid(node)))
- else
- simplelist(tk_call('blt::tree', 'keys', tagid(node),
- *(nodes.collect{|n| tagid(n)}))).collect{|lst|
- simplelist(lst)
- }
- end
- end
-
- def label(node, text=nil)
- if text
- tk_call('::blt::tree', 'label', tagid(node), text)
- text
- else
- tk_call('::blt::tree', 'label', tagid(node))
- end
- end
-
- def last_child(node)
- ret = tk_call('::blt::tree', 'lastchild', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def link(parent, node, keys={})
- ret = tk_call('::blt::tree', 'link', tagid(parent), tagid(node),
- __conv_keyonly_opts(keys))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def move(node, dest, keys={})
- tk_call('::blt::tree', 'move', tagid(node), tagid(dest), keys)
- self
- end
-
- def next(node)
- ret = tk_call('::blt::tree', 'next', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def next_sibling(node)
- ret = tk_call('::blt::tree', 'nextsibling', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def notify_create(*args, &b)
- Tk::BLT::Tree::Notify.new(self, *args, &b)
- end
-
- def notify_delete(id)
- if id.kind_of?(Tk::BLT::Tree::Notify)
- id.delete
- else
- tk_call(@path, 'notify', 'delete', id)
- Tk::BLT::Tree::Notify::NotifyID_TBL[@path].delete(id.to_s)
- end
- self
- end
-
- def notify_info(id)
- lst = simplelist(tk_call(@path, 'notify', 'info', tagid(id)))
- lst[0] = Tk::BLT::Tree::Notify.id2obj(self, lst[0])
- lst[1] = simplelist(lst[1]).collect{|flag| flag[1..-1]}
- lst[2] = tk_tcl2ruby(lst[2])
- lst
- end
-
- def notify_names()
- tk_call(@path, 'notify', 'names').collect{|id|
- Tk::BLT::Tree::Notify.id2obj(self, id)
- }
- end
-
- def parent(node)
- ret = tk_call('::blt::tree', 'parent', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def fullpath(node)
- tk_call('::blt::tree', 'path', tagid(node))
- end
-
- def position(node)
- number(tk_call('::blt::tree', 'position', tagid(node)))
- end
-
- def previous(node)
- ret = tk_call('::blt::tree', 'previous', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def prev_sibling(node)
- ret = tk_call('::blt::tree', 'prevsibling', tagid(node))
- (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
- end
-
- def restore(node, str, keys={})
- tk_call('::blt::tree', 'restore', tagid(node), str,
- __conv_keyonly_opts(keys))
- self
- end
- def restore_overwrite(node, str, keys={})
- keys = __conv_keyonly_opts(keys)
- keys.delete('overwrite')
- keys.delete(:overwrite)
- tk_call('::blt::tree', 'restore', tagid(node), str, '-overwrite', keys)
- self
- end
-
- def restore_from_file(node, file, keys={})
- tk_call('::blt::tree', 'restorefile', tagid(node), file,
- __conv_keyonly_opts(keys))
- self
- end
- def restore_overwrite_from_file(node, file, keys={})
- keys = __conv_keyonly_opts(keys)
- keys.delete('overwrite')
- keys.delete(:overwrite)
- tk_call('::blt::tree', 'restorefile', tagid(node), file,
- '-overwrite', keys)
- self
- end
-
- def root(node=None)
- Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'root',
- tagid(node)))
- end
-
- def set(node, data)
- unless data.kind_of?(Hash)
- fail ArgumentError, 'Hash is expected for data'
- end
- args = []
- data.each{|k, v| args << k << v}
- tk_call('::blt::tree', 'set', tagid(node), *args)
- self
- end
-
- def size(node)
- number(tk_call('::blt::tree', 'size', tagid(node)))
- end
-
- def sort(node, keys={})
- tk_call('::blt::tree', 'sort', tagid(node), __conv_keyonly_opts(keys))
- self
- end
-
- def tag_add(tag, *nodes)
- tk_call(@path, 'tag', 'add', tagid(tag), *(nodes.collect{|n| tagid(n)}))
- self
- end
-
- def tag_delete(tag, *nodes)
- tk_call(@path, 'tag', 'delete', tagid(tag),
- *(nodes.collect{|n| tagid(n)}))
- self
- end
-
- def tag_forget(tag)
- tag = tag.id if tag.kind_of?(Tk::BLT::Tree::Tag)
- tk_call(@path, 'tag', 'forget', tag)
- TreeTagID_TBL[@path].delete(tag)
- self
- end
-
- def tag_get(node, *patterns)
- simplelist(tk_call(@tpath, 'tag', 'get', tagid(node),
- *(patterns.collect{|pat| tagid(pat)}))).collect{|str|
- Tk::BLT::Tree::Tag.id2obj(self, str)
- }
- end
-
- def tag_names(node = None)
- simplelist(tk_call(@tpath, 'tag', 'names', tagid(node))).collect{|str|
- Tk::BLT::Tree::Tag.id2obj(self, str)
- }
- end
-
- def tag_nodes(tag)
- simplelist(tk_call(@tpath, 'tag', 'nodes', tagid(tag))).collect{|node|
- Tk::BLT::Tree::Node.id2obj(self, node)
- }
- end
-
- def tag_set(node, *tags)
- tk_call(@path, 'tag', 'set', tagid(node), *(tags.collect{|t| tagid(t)}))
- self
- end
-
- def tag_unset(node, *tags)
- tk_call(@path, 'tag', 'unset', tagid(node),
- *(tags.collect{|t| tagid(t)}))
- self
- end
-
- def trace_create(*args, &b)
- Tk::BLT::Tree::Trace.new(self, *args, &b)
- end
-
-=begin
- def trace_delete(*args)
- args.each{|id|
- if id.kind_of?(Tk::BLT::Tree::Trace)
- id.delete
- else
- tk_call(@path, 'trace', 'delete', id)
- Tk::BLT::Tree::Trace::TraceID_TBL[@path].delete(id.to_s)
- end
- self
- }
- end
-=end
- def trace_delete(*args)
- args = args.collect{|id| tagid(id)}
- tk_call(@path, 'trace', 'delete', *args)
- args.each{|id| Tk::BLT::Tree::Trace::TraceID_TBL[@path].delete(id.to_s)}
- self
- end
-
- def trace_info(id)
- lst = simplelist(tk_call(@path, 'trace', 'info', tagid(id)))
- lst[0] = Tk::BLT::Tree::Trace.id2obj(self, lst[0])
- lst[2] = simplelist(lst[2])
- lst[3] = tk_tcl2ruby(lst[3])
- lst
- end
-
- def trace_names()
- tk_call(@path, 'trace', 'names').collect{|id|
- Tk::BLT::Tree::Trace.id2obj(self, id)
- }
- end
-
- def type(node, key)
- tk_call('::blt::tree', 'type', tagid(node), key)
- end
-
- def unset(node, *keys)
- tk_call('::blt::tree', 'unset', tagid(node), *keys)
- self
- end
-
- def values(node, key=None)
- simplelist(tk_call('::blt::tree', 'values', tagid(node), key))
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb
deleted file mode 100644
index 0343d28b9c..0000000000
--- a/ext/tk/lib/tkextlib/blt/treeview.rb
+++ /dev/null
@@ -1,1146 +0,0 @@
-#
-# tkextlib/blt/treeview.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-require 'tk/validation.rb'
-
-module Tk::BLT
- class Treeview < TkWindow
- module ConfigMethod
- end
-
- module TagOrID_Methods
- end
-
- class Node < TkObject
- end
-
- class Tag < TkObject
- end
- end
-
- class Hiertable < Treeview
- end
-end
-
-######################################
-
-module Tk::BLT::Treeview::ConfigMethod
- include TkItemConfigMethod
-
- def __item_boolval_optkeys(id)
- case id
- when Array
- # id := [ 'column', name ]
- ['edit', 'hide']
- when 'sort'
- ['decreasing']
- else
- []
- end
- end
- private :__item_boolval_optkeys
-
- def __item_strval_optkeys(id)
- case id
- when Array
- # id := [ 'column', name ]
- super() << 'titleforeground' << 'titleshadow'
- when 'sort'
- ['decreasing']
- else
- []
- end
- end
- private :__item_strval_optkeys
-
- def __item_listval_optkeys(id)
- case id
- when 'entry'
- ['bindtags']
- else
- []
- end
- end
- private :__item_listval_optkeys
-
- def __item_cget_cmd(id)
- if id.kind_of?(Array)
- # id := [ type, name ]
- [self.path, id[0], 'cget', id[1]]
- else
- [self.path, id, 'cget']
- end
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id)
- if id.kind_of?(Array)
- # id := [ type, name ]
- [self.path, id[0], 'configure', id[1]]
- else
- [self.path, id, 'configure']
- end
- end
- private :__item_config_cmd
-
- def __item_pathname(id)
- if id.kind_of?(Array)
- id = tagid(id[1])
- end
- [self.path, id].join(';')
- end
- private :__item_pathname
-
- def column_cget(name, option)
- itemcget(['column', name], option)
- end
- def column_configure(name, slot, value=None)
- itemconfigure(['column', name], slot, value)
- end
- def column_configinfo(name, slot=nil)
- itemconfiginfo(['column', name], slot)
- end
- def current_column_configinfo(name, slot=nil)
- current_itemconfiginfo(['column', name], slot)
- end
-
- def button_cget(option)
- itemcget('button', option)
- end
- def button_configure(slot, value=None)
- itemconfigure('button', slot, value)
- end
- def button_configinfo(slot=nil)
- itemconfiginfo('button', slot)
- end
- def current_button_configinfo(slot=nil)
- current_itemconfiginfo('button', slot)
- end
-
- def entry_cget(option)
- ret = itemcget('entry', option)
- if option == 'bindtags' || option == :bindtags
- ret.collect{|tag| TkBindTag.id2obj(tag)}
- else
- ret
- end
- end
- def entry_configure(slot, value=None)
- itemconfigure('entry', slot, value)
- end
- def entry_configinfo(slot=nil)
- ret = itemconfiginfo('entry', slot)
-
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- if slot
- if slot == 'bindtags' || slot == :bindtags
- ret[-2] = ret[-2].collect{|tag| TkBindTag.id2obj(tag)}
- ret[-1] = ret[-1].collect{|tag| TkBindTag.id2obj(tag)}
- end
- else
- inf = ret.assoc('bindtags')
- inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
- inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
- end
-
- else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- if (inf = ret['bindtags'])
- inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
- inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
- ret['bindtags'] = inf
- end
- end
-
- ret
- end
- def current_entry_configinfo(slot=nil)
- ret = current_itemconfiginfo('entry', slot)
-
- if (val = ret['bindtags'])
- ret['bindtags'] = val.collect{|tag| TkBindTag.id2obj(tag)}
- end
-
- ret
- end
-
- def sort_cget(option)
- itemcget('sort', option)
- end
- def sort_configure(slot, value=None)
- itemconfigure('sort', slot, value)
- end
- def sort_configinfo(slot=nil)
- itemconfiginfo('sort', slot)
- end
- def current_sort_configinfo(slot=nil)
- current_itemconfiginfo('sort', slot)
- end
-
- def text_cget(option)
- itemcget('text', option)
- end
- def text_configure(slot, value=None)
- itemconfigure('text', slot, value)
- end
- def text_configinfo(slot=nil)
- itemconfiginfo('text', slot)
- end
- def current_text_configinfo(slot=nil)
- current_itemconfiginfo('text', slot)
- end
-
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
-end
-
-class Tk::BLT::Treeview
- TkCommandNames = ['::blt::treeview'.freeze].freeze
- WidgetClassName = 'TreeView'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- include Scrollable
- include ValidateConfigure
- include ItemValidateConfigure
- include Tk::BLT::Treeview::ConfigMethod
-
- ########################
-
- def __boolval_optkeys
- ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot',
- 'newtags', 'showtitles', 'sortselection']
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() + ['focusforeground', 'linecolor', 'separator', 'trim']
- end
- private :__strval_optkeys
-
- ########################
-
- class OpenCloseCommand < TkValidateCommand
- class ValidateArgs < TkUtil::CallbackSubst
- KEY_TBL = [
- [ ?W, ?w, :widget ],
- [ ?p, ?s, :name ],
- [ ?P, ?s, :fullpath ],
- [ ?#, ?x, :node_id ],
- nil
- ]
-
- PROC_TBL = [
- [ ?x, TkComm.method(:num_or_str) ],
- [ ?s, TkComm.method(:string) ],
- [ ?w, TkComm.method(:window) ],
- nil
- ]
-
- _setup_subst_table(KEY_TBL, PROC_TBL);
-
- def self.ret_val(val)
- val
- end
- end
-
- def self._config_keys
- ['opencommand', 'closecomand']
- end
- end
-
- def __validation_class_list
- super() << OpenCloseCommand
- end
-
- Tk::ValidateConfigure.__def_validcmd(binding, OpenCloseCommand)
-
- ########################
-
- def __item_validation_class_list(id)
- case id
- when 'entry'
- super(id) << OpenCloseCommand
- else
- super(id)
- end
- end
-
- Tk::ItemValidateConfigure.__def_validcmd(binding, OpenCloseCommand)
-
- ########################
-
- def __destroy_hook__
- Tk::BLT::Treeview::Node::TreeNodeID_TBL.delete(@path)
- Tk::BLT::Treeview::Tag::TreeTagID_TBL.delete(@path)
- end
-
- def tagid(tag)
- if tag.kind_of?(Tk::BLT::Treeview::Node) \
- || tag.kind_of?(Tk::BLT::Treeview::Tag)
- tag.id
- else
- tag # maybe an Array of configure paramters
- end
- end
- private :tagid
-
- def tagid2obj(tagid)
- if tagid.kind_of?(Integer)
- Tk::BLT::Treeview::Node.id2obj(self, tagid.to_s)
- elsif tagid.kind_of?(String)
- if tagid =~ /^\d+$/
- Tk::BLT::Treeview::Node.id2obj(self, tagid)
- else
- Tk::BLT::Treeview::Tag.id2obj(self, tagid)
- end
- else
- tagid
- end
- end
-
- def bbox(*tags)
- list(tk_send('bbox', *(tags.collect{|tag| tagid(tag)})))
- end
-
- def screen_bbox(*tags)
- list(tk_send('bbox', '-screen', *(tags.collect{|tag| tagid(tag)})))
- end
-
- def tag_bind(tag, seq, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([@path, 'bind', tagid(tag)], seq, cmd, *args)
- self
- end
- def tag_bind_append(tag, seq, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([@path, 'bind', tagid(tag)], seq, cmd, *args)
- self
- end
- def tag_bind_remove(tag, seq)
- _bind_remove([@path, 'bind', tagid(tag)], seq)
- self
- end
- def tag_bindinfo(tag, seq=nil)
- _bindinfo([@path, 'bind', tagid(tag)], seq)
- end
-
- def button_activate(tag)
- tk_send('button', 'activate', tagid(tag))
- self
- end
-
- def button_bind(tag, seq, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind([@path, 'button', 'bind', tagid(tag)], seq, cmd, *args)
- self
- end
- def button_bind_append(tag, seq, *args)
- if TkComm._callback_entry?(args[0]) || !block_given?
- cmd = args.shift
- else
- cmd = Proc.new
- end
- _bind_append([@path, 'button', 'bind', tagid(tag)], seq, cmd, *args)
- self
- end
- def button_bind_remove(tag, seq)
- _bind_remove([@path, 'button', 'bind', tagid(tag)], seq)
- self
- end
- def button_bindinfo(tag, seq=nil)
- _bindinfo([@path, 'button', 'bind', tagid(tag)], seq)
- end
-
- def close(*tags)
- tk_send('close', *(tags.collect{|tag| tagid(tag)}))
- self
- end
- def close_recurse(*tags)
- tk_send('close', '-recurse', *(tags.collect{|tag| tagid(tag)}))
- self
- end
-
- def column_activate(column=None)
- if column == None
- tk_send('column', 'activate')
- else
- tk_send('column', 'activate', column)
- self
- end
- end
-
- def column_delete(*fields)
- tk_send('column', 'delete', *fields)
- self
- end
- def column_insert(pos, field, *opts)
- tk_send('column', 'insert', pos, field, *opts)
- self
- end
- def column_invoke(field)
- tk_send('column', 'invoke', field)
- self
- end
- def column_move(name, dest)
- tk_send('column', 'move', name, dest)
- self
- end
- def column_names()
- simplelist(tk_send('column', 'names'))
- end
- def column_nearest(x, y=None)
- tk_send('column', 'nearest', x, y)
- end
-
- def curselection
- simplelist(tk_send('curselection')).collect{|id| tagid2obj(id)}
- end
-
- def delete(*tags)
- tk_send('delete', *(tags.collect{|tag| tagid(tag)}))
- self
- end
-
- def entry_activate(tag)
- tk_send('entry', 'activate', tagid(tag))
- self
- end
- def entry_children(tag, first=None, last=None)
- simplelist(tk_send('entry', 'children', tagid(tag),
- first, last)).collect{|id| tagid2obj(id)}
- end
- def entry_delete(tag, first=None, last=None)
- tk_send('entry', 'delete', tagid(tag), first, last)
- end
- def entry_before?(tag1, tag2)
- bool(tk_send('entry', 'isbefore', tagid(tag1), tagid(tag2)))
- end
- def entry_hidden?(tag)
- bool(tk_send('entry', 'ishidden', tagid(tag)))
- end
- def entry_open?(tag)
- bool(tk_send('entry', 'isopen', tagid(tag)))
- end
-
- def entry_size(tag)
- number(tk_send('entry', 'size', tagid(tag)))
- end
- def entry_size_recurse(tag)
- number(tk_send('entry', 'size', '-recurse', tagid(tag)))
- end
-
- def _search_flags(keys)
- keys = _symbolkey2str(keys)
- keys['exact'] = None if keys.delete('exact')
- keys['glob'] = None if keys.delete('glob')
- keys['regexp'] = None if keys.delete('regexp')
- keys['nonmatching'] = None if keys.delete('nonmatching')
- end
- private :_search_flags
-
- ################################
-
- class FindExecFlagValue < TkValidateCommand
- class ValidateArgs < TkUtil::CallbackSubst
- KEY_TBL = [
- [ ?W, ?w, :widget ],
- [ ?p, ?s, :name ],
- [ ?P, ?s, :fullpath ],
- [ ?#, ?x, :node_id ],
- nil
- ]
-
- PROC_TBL = [
- [ ?x, TkComm.method(:num_or_str) ],
- [ ?s, TkComm.method(:string) ],
- [ ?w, TkComm.method(:window) ],
- nil
- ]
-
- _setup_subst_table(KEY_TBL, PROC_TBL);
-
- def self.ret_val(val)
- val
- end
- end
-
- def self._config_keys
- []
- end
- end
-
- def _find_exec_flag_value(val)
- if val.kind_of?(Array)
- cmd, *args = val
- FindExecFlagValue.new(cmd, args.join(' '))
- elsif TkComm._callback_entry?(val)
- FindExecFlagValue.new(val)
- else
- val
- end
- end
-
- ################################
-
- def find(first, last, keys={})
- keys = _search_flags(keys)
- keys['exec'] = _find_exec_flag_value(keys['exec']) if keys.key?('exec')
- args = hash_kv(keys) << '--' << tagid(first) << tagid(last)
- simplelist(tk_send('find', *args)).collect{|id| tagid2obj(id)}
- end
-
- def tag_focus(tag)
- tk_send('focus', tagid(tag))
- self
- end
- def get(*tags)
- simplelist(tk_send('get', *(tags.collect{|tag| tagid(tag)})))
- end
- def get_full(*tags)
- simplelist(tk_send('get', '-full', *(tags.collect{|tag| tagid(tag)})))
- end
-
- def hide(*tags)
- if tags[-1].kind_of?(Hash)
- keys = tags.pop
- else
- keys = {}
- end
- keys = _search_flags(keys)
- args = hash_kv(keys) << '--'
- args.concat(tags.collect{|t| tagid(t)})
- tk_send('hide', *args)
- self
- end
-
- def index(str)
- tagid2obj(tk_send('index', str))
- end
- def index_at(tag, str)
- tagid2obj(tk_send('index', '-at', tagid(tag), str))
- end
- def index_at_path(tag, str)
- tagid2obj(tk_send('index', '-at', tagid(tag), '-path', str))
- end
-
- def insert(pos, parent=nil, keys={})
- Tk::BLT::Treeview::Node.new(pos, parent, keys)
- end
- def insert_at(tag, pos, parent=nil, keys={})
- if parent.kind_of?(Hash)
- keys = parent
- parent = nil
- end
-
- keys = _symbolkey2str(keys)
- keys['at'] = tagid(tag)
-
- Tk::BLT::Treeview::Node.new(pos, parent, keys)
- end
-
- def move_before(tag, dest)
- tk_send('move', tagid(tag), 'before', tagid(dest))
- self
- end
- def move_after(tag, dest)
- tk_send('move', tagid(tag), 'after', tagid(dest))
- self
- end
- def move_into(tag, dest)
- tk_send('move', tagid(tag), 'into', tagid(dest))
- self
- end
-
- def nearest(x, y, var=None)
- tagid2obj(tk_send('nearest', x, y, var))
- end
-
- def open(*tags)
- tk_send('open', *(tags.collect{|tag| tagid(tag)}))
- self
- end
- def open_recurse(*tags)
- tk_send('open', '-recurse', *(tags.collect{|tag| tagid(tag)}))
- self
- end
-
- def range(first, last)
- simplelist(tk_send('range', tagid(first), tagid(last))).collect{|id|
- tagid2obj(id)
- }
- end
- def range_open(first, last)
- simplelist(tk_send('range', '-open',
- tagid(first), tagid(last))).collect{|id|
- tagid2obj(id)
- }
- end
-
- def scan_mark(x, y)
- tk_send_without_enc('scan', 'mark', x, y)
- self
- end
- def scan_dragto(x, y)
- tk_send_without_enc('scan', 'dragto', x, y)
- self
- end
-
- def see(tag)
- tk_send_without_enc('see', tagid(tag))
- self
- end
- def see_anchor(anchor, tag)
- tk_send_without_enc('see', '-anchor', anchor, tagid(tag))
- self
- end
-
- def selection_anchor(tag)
- tk_send_without_enc('selection', 'anchor', tagid(tag))
- self
- end
- def selection_cancel()
- tk_send_without_enc('selection', 'cancel')
- self
- end
- def selection_clear(first, last=None)
- tk_send_without_enc('selection', 'clear', tagid(first), tagid(last))
- self
- end
- def selection_clear_all()
- tk_send_without_enc('selection', 'clearall')
- self
- end
- def selection_mark(tag)
- tk_send_without_enc('selection', 'mark', tagid(tag))
- self
- end
- def selection_include?(tag)
- bool(tk_send('selection', 'include', tagid(tag)))
- end
- def selection_present?()
- bool(tk_send('selection', 'present'))
- end
- def selection_set(first, last=None)
- tk_send_without_enc('selection', 'set', tagid(first), tagid(last))
- self
- end
- def selection_toggle(first, last=None)
- tk_send_without_enc('selection', 'toggle', tagid(first), tagid(last))
- self
- end
-
- def show(*tags)
- if tags[-1].kind_of?(Hash)
- keys = tags.pop
- else
- keys = {}
- end
- keys = _search_flags(keys)
- args = hash_kv(keys) << '--'
- args.concat(tags.collect{|t| tagid(t)})
- tk_send('show', *args)
- self
- end
-
- def sort_auto(mode)
- tk_send('sort', 'auto', mode)
- self
- end
- def sort_auto=(mode)
- tk_send('sort', 'auto', mode)
- mode
- end
- def sort_auto?
- bool(tk_send('sort', 'auto'))
- end
- def sort_once(*tags)
- tk_send('sort', 'once', *(tags.collect{|tag| tagid(tag)}))
- self
- end
- def sort_once_recurse(*tags)
- tk_send('sort', 'once', '-recurse', *(tags.collect{|tag| tagid(tag)}))
- self
- end
-
- def tag_add(tag, *ids)
- tk_send('tag', 'add', tagid(tag), *ids)
- self
- end
- def tag_delete(tag, *ids)
- tk_send('tag', 'delete', tagid(tag), *ids)
- self
- end
- def tag_forget(tag)
- tk_send('tag', 'forget', tagid(tag))
- self
- end
- def tag_names(id=nil)
- id = (id)? tagid(id): None
-
- simplelist(tk_send('tag', 'nodes', id)).collect{|tag|
- Tk::BLT::Treeview::Tag.id2obj(self, tag)
- }
- end
- def tag_nodes(tag)
- simplelist(tk_send('tag', 'nodes', tagid(tag))).collect{|id|
- Tk::BLT::Treeview::Node.id2obj(self, id)
- }
- end
-
- def text_apply
- tk_send('text', 'apply')
- self
- end
- def text_cancel
- tk_send('text', 'cancel')
- self
- end
-
- def text_delete(first, last)
- tk_send('text', 'delete', first, last)
- self
- end
- def text_get(x, y)
- tk_send('text', 'get', x, y)
- end
- def text_get_root(x, y)
- tk_send('text', 'get', '-root', x, y)
- end
- def text_icursor(idx)
- tk_send('text', 'icursor', idx)
- self
- end
- def text_index(idx)
- num_or_str(tk_send('text', 'index', idx))
- end
- def text_insert(idx, str)
- tk_send('text', 'insert', idx, str)
- self
- end
-
- def text_selection_adjust(idx)
- tk_send('text', 'selection', 'adjust', idx)
- self
- end
- def text_selection_clear
- tk_send('text', 'selection', 'clear')
- self
- end
- def text_selection_from(idx)
- tk_send('text', 'selection', 'from', idx)
- self
- end
- def text_selection_present
- num_or_str(tk_send('text', 'selection', 'present'))
- end
- def text_selection_range(start, last)
- tk_send('text', 'selection', 'range', start, last)
- self
- end
- def text_selection_to(idx)
- tk_send('text', 'selection', 'to', idx)
- self
- end
-
- def toggle(tag)
- tk_send('toggle', tagid(tag))
- self
- end
-end
-
-######################################
-
-module Tk::BLT::Treeview::TagOrID_Methods
- def bbox
- @tree.bbox(self)
- end
- def screen_bbox
- @tree.screen_bbox(self)
- end
-
- def bind(seq, *args)
- @tree.tag_bind(self, seq, *args)
- self
- end
- def bind_append(seq, *args)
- @tree.tag_bind_append(self, seq, *args)
- self
- end
- def bind_remove(seq)
- @tree.tag_bind_remove(self, seq)
- self
- end
- def bindinfo(seq=nil)
- @tree.tag_bindinfo(self, seq)
- end
-
- def button_activate
- @tree.button_activate(self)
- self
- end
-
- def button_bind(seq, *args)
- @tree.button_bind(self, seq, *args)
- self
- end
- def button_bind_append(seq, *args)
- @tree.button_bind_append(self, seq, *args)
- self
- end
- def button_bind_remove(seq)
- @tree.button_bind_remove(self, seq)
- self
- end
- def button_bindinfo(seq=nil)
- @tree.button_bindinfo(self, seq)
- end
-
- def close
- @tree.close(self)
- self
- end
- def close_recurse
- @tree.close_recurse(self)
- self
- end
-
- def delete
- @tree.delete(self)
- self
- end
-
- def entry_activate
- @tree.entry_activate(self)
- self
- end
- def entry_children(first=None, last=None)
- @tree.entry_children(self, first, last)
- end
- def entry_delete(first=None, last=None)
- @tree.entry_delete(self, first, last)
- end
- def entry_before?(tag)
- @tree.entry_before?(self, tag)
- end
- def entry_hidden?
- @tree.entry_before?(self)
- end
- def entry_open?
- @tree.entry_open?(self)
- end
-
- def entry_size
- @tree.entry_size(self)
- end
- def entry_size_recurse
- @tree.entry_size_recurse(self)
- end
-
- def focus
- @tree.tag_focus(self)
- self
- end
-
- def get
- @tree.get(self)
- end
- def get_full
- @tree.get_full(self)
- end
-
- def hide
- @tree.hide(self)
- self
- end
-
- def index(str)
- @tree.index_at(self, str)
- end
- def index_path(str)
- @tree.index_at_path(self, str)
- end
-
- def insert(pos, parent=nil, keys={})
- @tree.insert_at(self, pos, parent, keys)
- end
-
- def move_before(dest)
- @tree.move_before(self, dest)
- self
- end
- def move_after(dest)
- @tree.move_after(self, dest)
- self
- end
- def move_into(dest)
- @tree.move_into(self, dest)
- self
- end
-
- def open
- @tree.open(self)
- self
- end
- def open_recurse
- @tree.open_recurse(self)
- self
- end
-
- def range_to(tag)
- @tree.range(self, tag)
- end
- def range_open_to(tag)
- @tree.range(self, tag)
- end
-
- def see
- @tree.see(self)
- self
- end
- def see_anchor(anchor)
- @tree.see_anchor(anchor, self)
- self
- end
-
- def selection_anchor
- @tree.selection_anchor(self)
- self
- end
- def selection_clear
- @tree.selection_clear(self)
- self
- end
- def selection_mark
- @tree.selection_mark(self)
- self
- end
- def selection_include?
- @tree.selection_include?(self)
- end
- def selection_set
- @tree.selection_set(self)
- self
- end
- def selection_toggle
- @tree.selection_toggle(self)
- self
- end
-
- def show
- @tree.show(self)
- self
- end
-
- def sort_once
- @tree.sort_once(self)
- self
- end
- def sort_once_recurse
- @tree.sort_once_recurse(self)
- self
- end
-
- def toggle
- @tree.toggle(self)
- self
- end
-end
-
-######################################
-
-class Tk::BLT::Treeview::Node < TkObject
- include Tk::BLT::Treeview::TagOrID_Methods
-
- TreeNodeID_TBL = TkCore::INTERP.create_table
- TreeNode_ID = ['blt_treeview_node'.freeze, '00000'.taint].freeze
-
- TkCore::INTERP.init_ip_env{ TreeNodeID_TBL.clear }
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless TreeNodeID_TBL[tpath]
- if TreeNodeID_TBL[tpath][id]
- TreeNodeID_TBL[tpath][id]
- else
- begin
- self.new(tree, nil, nil, 'node'=>Integer(id))
- rescue
- id
- end
- end
- end
-
- def self.new(tree, pos, parent=nil, keys={})
- if parent.kind_of?(Hash)
- keys = parent
- parent = nil
- end
-
- keys = _symbolkey2str(keys)
- tpath = tree.path
-
- if (id = keys['node']) && (obj = TreeNodeID_TBL[tpath][id])
- keys.delete('node')
- tk_call(tree.path, 'move', id, pos, parent) if parent
- return obj
- end
-
- super(tree, pos, parent, keys)
- end
-
- def initialize(tree, pos, parent, keys)
- @parent = @tree = tree
- @tpath = @parent.path
-
- if (id = keys['node'])
- @path = @id = id
- tk_call(@tpath, 'move', @id, pos, tagid(parent)) if parent
- else
- name = TreeNode_ID.join(TkCore::INTERP._ip_id_).freeze
- TreeNode_ID[1].succ!
-
- at = keys.delete['at']
-
- if parent
- if parent.kind_of?(Tk::BLT::Treeview::Node) ||
- parent.kind_of?(Tk::BLT::Treeview::Tag)
- path = [get_full(parent.id)[0], name]
- at = nil # ignore 'at' option
- else
- path = [parent.to_s, name]
- end
- else
- path = name
- end
-
- if at
- @id = tk_call(@tpath, 'insert', '-at', tagid(at), pos, path, keys)
- else
- @id = tk_call(@tpath, 'insert', pos, path, keys)
- end
- @path = @id
- end
-
- TreeNodeID_TBL[@tpath] = {} unless TreeNodeID_TBL[@tpath]
- TreeNodeID_TBL[@tpath][@id] = self
- end
-
- def id
- @id
- end
-end
-
-######################################
-
-class Tk::BLT::Treeview::Tag < TkObject
- include Tk::BLT::Treeview::TagOrID_Methods
-
- TreeTagID_TBL = TkCore::INTERP.create_table
- TreeTag_ID = ['blt_treeview_tag'.freeze, '00000'.taint].freeze
-
- TkCore::INTERP.init_ip_env{ TreeTagID_TBL.clear }
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless TreeTagID_TBL[tpath]
- if TreeTagID_TBL[tpath][id]
- TreeTagID_TBL[tpath][id]
- else
- begin
- self.new(tree, nil, nil, 'name'=>Integer(id))
- rescue
- id
- end
- end
- end
-
- def self.new_by_name(tree, name, *ids)
- if (obj = TreeTagID_TBL[tree.path][name])
- return obj
- end
- new([tree, name], ids)
- end
-
- def self.new(tree, *ids)
- if tree.kind_of?(Array)
- super(tree[0], tree[1], ids)
- else
- super(tree, nil, ids)
- end
- end
-
- def initialize(tree, name, ids)
- @parent = @tree = tree
- @tpath = @parent.path
-
- if name
- @path = @id = name
- else
- @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_).freeze
- TreeTag_ID[1].succ!
- end
-
- TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
- TreeTagID_TBL[@tpath][@id] = self
-
- unless ids.empty?
- tk_call(@tpath, 'tag', 'add', @id, *(ids.collect{|id| tagid(id)}))
- end
- end
-
- def tagid(tag)
- if tag.kind_of?(Tk::BLT::Treeview::Node) \
- || tag.kind_of?(Tk::BLT::Treeview::Tag)
- tag.id
- else
- tag
- end
- end
- private :tagid
-
- def id
- @id
- end
-
- def add(*ids)
- tk_call(@tpath, 'tag', 'add', @id, *(ids{|id| tagid(id)}))
- self
- end
-
- def remove(*ids)
- tk_call(@tpath, 'tag', 'delete', @id, *(ids{|id| tagid(id)}))
- self
- end
-
- def forget
- tk_call(@tpath, 'tag', 'forget', @id)
- self
- end
-
- def nodes
- simplelist(tk_call(@tpath, 'tag', 'nodes', @id)).collect{|id|
- Tk::BLT::Treeview::Node.id2obj(@tree, id)
- }
- end
-end
-
-class Tk::BLT::Hiertable
- TkCommandNames = ['::blt::hiertable'.freeze].freeze
- WidgetClassName = 'Hiertable'.freeze
- WidgetClassNames[WidgetClassName] = self
-end
diff --git a/ext/tk/lib/tkextlib/blt/unix_dnd.rb b/ext/tk/lib/tkextlib/blt/unix_dnd.rb
deleted file mode 100644
index 3130c1e56f..0000000000
--- a/ext/tk/lib/tkextlib/blt/unix_dnd.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# tkextlib/blt/unix_dnd.rb
-#
-# *** This is alpha version, because there is no document on BLT. ***
-#
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module DnD
- extend TkCore
-
- TkCommandNames = ['::blt::dnd'.freeze].freeze
-
- ##############################
-
- extend TkItemConfigMethod
-
- class << self
- def __item_cget_cmd(id)
- ['::blt::dnd', *id]
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id)
- ['::blt::dnd', *id]
- end
- private :__item_config_cmd
-
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
-
- def cget(win, option)
- itemconfigure(['cget', win], slot, value)
- end
- def configure(win, slot, value=None)
- itemconfigure(['configure', win], slot, value)
- end
- def configinfo(win, slot=nil)
- itemconfiginfo(['configure', win], slot)
- end
- def current_configinfo(win, slot=nil)
- current_itemconfiginfo(['configure', win], slot)
- end
-
- def tokwn_cget(win, option)
- itemconfigure(['token', 'cget', win], slot, value)
- end
- def token_configure(win, slot, value=None)
- itemconfigure(['token', 'configure', win], slot, value)
- end
- def token_configinfo(win, slot=nil)
- itemconfiginfo(['token', 'configure', win], slot)
- end
- def current_token_configinfo(win, slot=nil)
- current_itemconfiginfo(['token', 'configure', win], slot)
- end
-
- def token_windowconfigure(win, slot, value=None)
- itemconfigure(['token', 'window', win], slot, value)
- end
- def token_windowconfiginfo(win, slot=nil)
- itemconfiginfo(['token', 'window', win], slot)
- end
- def current_token_windowconfiginfo(win, slot=nil)
- current_itemconfiginfo(['token', 'window', win], slot)
- end
- end
-
- ##############################
-
- def self.cancel(win)
- tk_call('::blt::dnd', 'cancel', *wins)
- end
- def self.delete(*wins)
- tk_call('::blt::dnd', 'delete', *wins)
- end
- def self.delete_source(*wins)
- tk_call('::blt::dnd', 'delete', '-source', *wins)
- end
- def self.delete_target(*wins)
- tk_call('::blt::dnd', 'delete', '-target', *wins)
- end
- def self.drag(win, x, y, token=None)
- tk_call('::blt::dnd', 'drag', win, x, y, token)
- end
- def self.drop(win, x, y, token=None)
- tk_call('::blt::dnd', 'drop', win, x, y, token)
- end
- def self.get_data(win, fmt=nil, cmd=nil)
- if fmt
- tk_call('::blt::dnd', 'getdata', win, fmt, cmd)
- else
- list(tk_call('::blt::dnd', 'getdata', win))
- end
- end
- def self.names(pat=None)
- list(tk_call('::blt::dnd', 'names', pat))
- end
- def self.source_names(pat=None)
- list(tk_call('::blt::dnd', 'names', '-source', pat))
- end
- def self.target_names(pat=None)
- list(tk_call('::blt::dnd', 'names', '-target', pat))
- end
- def self.pull(win, fmt)
- tk_call('::blt::dnd', 'pull', win, fmt)
- end
- def self.register(win, keys={})
- tk_call('::blt::dnd', 'register', win, keys)
- end
- def self.select(win, x, y, timestamp)
- tk_call('::blt::dnd', 'select', win, x, y, timestamp)
- end
- def self.set_data(win, fmt=nil, cmd=nil)
- if fmt
- tk_call('::blt::dnd', 'setdata', win, fmt, cmd)
- else
- list(tk_call('::blt::dnd', 'setdata', win))
- end
- end
- def self.token(*args)
- tk_call('::blt::dnd', 'token', *args)
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/vector.rb b/ext/tk/lib/tkextlib/blt/vector.rb
deleted file mode 100644
index 540b6b9102..0000000000
--- a/ext/tk/lib/tkextlib/blt/vector.rb
+++ /dev/null
@@ -1,243 +0,0 @@
-#
-# tkextlib/blt/vector.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Vector < TkVariable
- TkCommandNames = ['::blt::vector'.freeze].freeze
-
- def self.create(*args)
- tk_call('::blt::vector', 'create', *args)
- end
-
- def self.destroy(*args)
- tk_call('::blt::vector', 'destroy', *args)
- end
-
- def self.expr(expression)
- tk_call('::blt::vector', 'expr', expression)
- end
-
- def self.names(pat=None)
- simplelist(tk_call('::blt::vector', 'names', pat)).collect{|name|
- if TkVar_ID_TBL[name]
- TkVar_ID_TBL[name]
- elsif name[0..1] == '::' && TkVar_ID_TBL[name[2..-1]]
- TkVar_ID_TBL[name[2..-1]]
- else
- name
- end
- }
- end
-
- ####################################
-
- def initialize(size=nil, keys={})
- if size.kind_of?(Hash)
- keys = size
- size = nil
- end
- if size.kind_of?(Array)
- # [first, last]
- size = size.join(':')
- end
- if size
- @id = INTERP._invoke('::blt::vector', 'create',
- "#auto(#{size})", *hash_kv(keys))
- else
- @id = INTERP._invoke('::blt::vector', 'create',
- "#auto", *hash_kv(keys))
- end
-
- TkVar_ID_TBL[@id] = self
-
- @def_default = false
- @default_val = nil
-
- @trace_var = nil
- @trace_elem = nil
- @trace_opts = nil
-
- # teach Tk-ip that @id is global var
- INTERP._invoke_without_enc('global', @id)
- end
-
- def destroy
- tk_call('::blt::vector', 'destroy', @id)
- end
-
- def inspect
- '#<Tk::BLT::Vector: ' + @id + '>'
- end
-
- def to_s
- @id
- end
-
- def *(item)
- list(tk_call(@id, '*', item))
- end
-
- def +(item)
- list(tk_call(@id, '+', item))
- end
-
- def -(item)
- list(tk_call(@id, '-', item))
- end
-
- def /(item)
- list(tk_call(@id, '/', item))
- end
-
- def append(*vectors)
- tk_call(@id, 'append', *vectors)
- end
-
- def binread(channel, len=None, keys={})
- if len.kind_of?(Hash)
- keys = len
- len = None
- end
- keys = _symbolkey2str(keys)
- keys['swap'] = None if keys.delete('swap')
- tk_call(@id, 'binread', channel, len, keys)
- end
-
- def clear()
- tk_call(@id, 'clear')
- self
- end
-
- def delete(*indices)
- tk_call(@id, 'delete', *indices)
- self
- end
-
- def dup_vector(vec)
- tk_call(@id, 'dup', vec)
- self
- end
-
- def expr(expression)
- tk_call(@id, 'expr', expression)
- self
- end
-
- def index(idx, val=None)
- number(tk_call(@id, 'index', idx, val))
- end
-
- def [](idx)
- index(idx)
- end
-
- def []=(idx, val)
- index(idx, val)
- end
-
- def length()
- number(tk_call(@id, 'length'))
- end
-
- def length=(size)
- number(tk_call(@id, 'length', size))
- end
-
- def merge(*vectors)
- tk_call(@id, 'merge', *vectors)
- self
- end
-
- def normalize(vec=None)
- tk_call(@id, 'normalize', vec)
- self
- end
-
- def notify(keyword)
- tk_call(@id, 'notify', keyword)
- self
- end
-
- def offset()
- number(tk_call(@id, 'offset'))
- end
-
- def offset=(val)
- number(tk_call(@id, 'offset', val))
- end
-
- def random()
- tk_call(@id, 'random')
- end
-
- def populate(vector, density=None)
- tk_call(@id, 'populate', vector, density)
- self
- end
-
- def range(first, last=None)
- list(tk_call(@id, 'range', first, last))
- end
-
- def search(val1, val2=None)
- list(tk_call(@id, 'search', val1, val2))
- end
-
- def set(item)
- tk_call(@id, 'set', item)
- self
- end
-
- def seq(start, finish=None, step=None)
- tk_call(@id, 'seq', start, finish, step)
- self
- end
-
- def sort(*vectors)
- tk_call(@id, 'sort', *vectors)
- self
- end
-
- def sort_reverse(*vectors)
- tk_call(@id, 'sort', '-reverse', *vectors)
- self
- end
-
- def split(*vectors)
- tk_call(@id, 'split', *vectors)
- self
- end
-
- def variable(var)
- tk_call(@id, 'variable', var)
- self
- end
- end
-
- class VectorAccess < Vector
- def self.new(name)
- return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
- super(name, size=nil, keys={})
- end
-
- def initialize(vec_name)
- @id = vec_name
- TkVar_ID_TBL[@id] = self
-
- @def_default = false
- @default_val = nil
-
- @trace_var = nil
- @trace_elem = nil
- @trace_opts = nil
-
- # teach Tk-ip that @id is global var
- INTERP._invoke_without_enc('global', @id)
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/watch.rb b/ext/tk/lib/tkextlib/blt/watch.rb
deleted file mode 100644
index ae5e50f126..0000000000
--- a/ext/tk/lib/tkextlib/blt/watch.rb
+++ /dev/null
@@ -1,142 +0,0 @@
-#
-# tkextlib/blt/watch.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Watch < TkObject
- extend TkCore
-
- TkCommandNames = ['::blt::watch'.freeze].freeze
-
- WATCH_ID_TBL = TkCore::INTERP.create_table
- BLT_WATCH_ID = ['blt_watch_id'.freeze, '00000'.taint].freeze
-
- def self.names(state = None)
- tk_split_list(tk_call('::blt::watch', 'names', state)).collect{|name|
- WATCH_ID_TBL[name] || name
- }
- end
-
- def __numval_optkeys
- ['maxlevel']
- end
- private :__numval_optkeys
-
- def __boolval_optkeys
- ['active']
- end
- private :__boolval_optkeys
-
- def __config_cmd
- ['::blt::watch', 'configure', self.path]
- end
- private :__config_cmd
-
- def initialize(name = nil, keys = {})
- if name.kind_of?(Hash)
- keys = name
- name = nil
- end
-
- if name
- @id = name.to_s
- else
- @id = BLT_WATCH_ID.join(TkCore::INTERP._ip_id_)
- BLT_WATCH_ID[1].succ!
- end
-
- @path = @id
-
- WATCH_ID_TBL[@id] = self
- tk_call('::blt::watch', 'create', @id, *hash_kv(keys))
- end
-
- def activate
- tk_call('::blt::watch', 'activate', @id)
- self
- end
- def deactivate
- tk_call('::blt::watch', 'deactivate', @id)
- self
- end
- def delete
- tk_call('::blt::watch', 'delete', @id)
- self
- end
- def info
- ret = []
- lst = tk_split_simplelist(tk_call('::blt::watch', 'info', @id))
- until lst.empty?
- k, v, *lst = lst
- k = k[1..-1]
- case k
- when /^(#{__strval_optkeys.join('|')})$/
- # do nothing
-
- when /^(#{__numval_optkeys.join('|')})$/
- begin
- v = number(v)
- rescue
- v = nil
- end
-
- when /^(#{__numstrval_optkeys.join('|')})$/
- v = num_or_str(v)
-
- when /^(#{__boolval_optkeys.join('|')})$/
- begin
- v = bool(v)
- rescue
- v = nil
- end
-
- when /^(#{__listval_optkeys.join('|')})$/
- v = simplelist(v)
-
- when /^(#{__numlistval_optkeys.join('|')})$/
- v = list(v)
-
- else
- if v.index('{')
- v = tk_split_list(v)
- else
- v = tk_tcl2ruby(v)
- end
- end
-
- ret << [k, v]
- end
-
- ret
- end
- def configinfo(slot = nil)
- if slot
- slot = slot.to_s
- v = cget(slot)
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- [slot, v]
- else
- {slot=>v}
- end
- else
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- info
- else
- Hash[*(info.flatten)]
- end
- end
- end
- def cget(key)
- key = key.to_s
- begin
- info.assoc(key)[1]
- rescue
- fail ArgumentError, "unknown option '#{key}'"
- end
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/win_printer.rb b/ext/tk/lib/tkextlib/blt/win_printer.rb
deleted file mode 100644
index 7ac6a0dcfc..0000000000
--- a/ext/tk/lib/tkextlib/blt/win_printer.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# tkextlib/blt/win_printer.rb
-#
-# *** Windows only ***
-#
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- class Printer < TkObject
- extend TkCore
-
- TkCommandNames = ['::blt::printer'.freeze].freeze
-
- def self.enum(attribute)
- simplelist(tk_call('::blt::printer', 'enum', attribute))
- end
-
- def self.names(pat=None)
- simplelist(tk_call('::blt::printer', 'names', pat))
- end
-
- def self.open(printer)
- self.new(printer)
- end
-
- #################################
-
- def initialize(printer)
- @printer_id = tk_call('::blt::printer', 'open', printer)
- end
-
- def close
- tk_call('::blt::print', 'close', @printer_id)
- self
- end
- def get_attrs(var)
- tk_call('::blt::print', 'getattrs', @printer_id, var)
- var
- end
- def set_attrs(var)
- tk_call('::blt::print', 'setattrs', @printer_id, var)
- self
- end
- def snap(win)
- tk_call('::blt::print', 'snap', @printer_id, win)
- self
- end
- def write(str)
- tk_call('::blt::print', 'write', @printer_id, str)
- self
- end
- def write_with_title(title, str)
- tk_call('::blt::print', 'write', @printer_id, title, str)
- self
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/blt/winop.rb b/ext/tk/lib/tkextlib/blt/winop.rb
deleted file mode 100644
index e371d28ab7..0000000000
--- a/ext/tk/lib/tkextlib/blt/winop.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# tkextlib/blt/winop.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tkextlib/blt.rb'
-
-module Tk::BLT
- module Winop
- extend TkCore
-
- TkCommandNames = ['::blt::winop'.freeze].freeze
- end
- WinOp = Winop
-end
-
-class << Tk::BLT::Winop
- def changes(win)
- tk_call('::blt::winop', 'changes', win)
- end
-
- def colormap(win)
- Hash[*list(tk_call('::blt::winop', 'colormap', win))]
- end
-
- def convolve(src, dest, filter)
- tk_call('::blt::winop', 'convolve', src, dest, filter)
- end
-
- def image_convolve(src, dest, filter)
- tk_call('::blt::winop', 'image', 'convolve', src, dest, filter)
- end
- def image_gradient(photo, left, right, type)
- tk_call('::blt::winop', 'image', 'gradient', photo, left, right, type)
- end
- def image_read_jpeg(file, photo)
- tk_call('::blt::winop', 'image', 'readjpeg', file, photo)
- end
- def image_resample(src, dest, horiz_filter=None, vert_filter=None)
- tk_call('::blt::winop', 'image', 'resample',
- src, dest, horiz_filter, vert_filter)
- end
- def image_rotate(src, dest, angle)
- tk_call('::blt::winop', 'image', 'rotate', src, dest, angle)
- end
- def image_snap(win, photo, width=None, height=None)
- tk_call('::blt::winop', 'image', 'snap', win, photo, width, height)
- end
- def image_subsample(src, dest, x, y, width, height,
- horiz_filter=None, vert_filter=None)
- tk_call('::blt::winop', 'image', 'subsample',
- src, dest, x, y, width, height, horiz_filter, vert_filter)
- end
-
- def quantize(src, dest, colors)
- tk_call('::blt::winop', 'quantize', src, dest, colors)
- end
-
- def query()
- tk_call('::blt::winop', 'query')
- end
-
- def read_jpeg(file, photo)
- tk_call('::blt::winop', 'readjpeg', file, photo)
- end
-
- def resample(src, dest, horiz_filter=None, vert_filter=None)
- tk_call('::blt::winop', 'resample',
- src, dest, horiz_filter, vert_filter)
- end
-
- def subsample(src, dest, x, y, width, height,
- horiz_filter=None, vert_filter=None)
- tk_call('::blt::winop', 'subsample',
- src, dest, x, y, width, height, horiz_filter, vert_filter)
- end
-
- def raise(*wins)
- tk_call('::blt::winop', 'raise', *wins)
- end
-
- def lower(*wins)
- tk_call('::blt::winop', 'lower', *wins)
- end
-
- def map(*wins)
- tk_call('::blt::winop', 'map', *wins)
- end
-
- def unmap(*wins)
- tk_call('::blt::winop', 'unmap', *wins)
- end
-
- def move(win, x, y)
- tk_call('::blt::winop', 'move', win, x, y)
- end
-
- def snap(win, photo)
- tk_call('::blt::winop', 'snap', win, photo)
- end
-
- def warpto(win = None)
- tk_call('::blt::winop', 'warpto', win)
- end
- alias warp_to warpto
-end
diff --git a/ext/tk/lib/tkextlib/bwidget.rb b/ext/tk/lib/tkextlib/bwidget.rb
index 62631d8b54..56009f4694 100644
--- a/ext/tk/lib/tkextlib/bwidget.rb
+++ b/ext/tk/lib/tkextlib/bwidget.rb
@@ -23,11 +23,6 @@ module Tk
LIBRARY = tk_call('set', '::BWIDGET::LIBRARY')
- PACKAGE_NAME = 'BWidget'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('BWidget')
diff --git a/ext/tk/lib/tkextlib/bwidget/button.rb b/ext/tk/lib/tkextlib/bwidget/button.rb
index 4a9d4a7948..246afebe29 100644
--- a/ext/tk/lib/tkextlib/bwidget/button.rb
+++ b/ext/tk/lib/tkextlib/bwidget/button.rb
@@ -18,14 +18,4 @@ class Tk::BWidget::Button
TkCommandNames = ['Button'.freeze].freeze
WidgetClassName = 'Button'.freeze
WidgetClassNames[WidgetClassName] = self
-
- def __strval_optkeys
- super() << 'helptext'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
end
diff --git a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
index ef999239f9..477de8a61f 100644
--- a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb
@@ -21,11 +21,6 @@ class Tk::BWidget::ButtonBox
include TkItemConfigMethod
- def __boolval_optkeys
- super() << 'homogeneous'
- end
- private :__boolval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::BWidget::Button)
name = tagOrId[:name]
diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb
index 2790d88d24..d175a2d8bb 100644
--- a/ext/tk/lib/tkextlib/bwidget/dialog.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb
@@ -22,16 +22,6 @@ class Tk::BWidget::Dialog
include TkItemConfigMethod
- def __strval_optkeys
- super() << 'title'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'transient' << 'homogeneous'
- end
- private :__boolval_optkeys
-
def initialize(parent=nil, keys=nil)
@relative = ''
if parent.kind_of?(Hash)
diff --git a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
index 224304f2ab..4766a1ec6d 100644
--- a/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
+++ b/ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
@@ -21,11 +21,6 @@ module Tk::BWidget::DynamicHelp
'DynamicHelp::configure'
end
- def __strval_optkeys
- super() << 'topbackground'
- end
- private :__strval_optkeys
-
def self.__cget_cmd
['DynamicHelp::configure']
end
diff --git a/ext/tk/lib/tkextlib/bwidget/entry.rb b/ext/tk/lib/tkextlib/bwidget/entry.rb
index aafb4aa7ff..9867a1ac36 100644
--- a/ext/tk/lib/tkextlib/bwidget/entry.rb
+++ b/ext/tk/lib/tkextlib/bwidget/entry.rb
@@ -21,21 +21,6 @@ class Tk::BWidget::Entry
WidgetClassName = 'Entry'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'helptext' << 'insertbackground'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'dragenabled' << 'dropenabled' << 'editable'
- end
- private :__boolval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
-
def invoke
tk_send_without_enc('invoke')
self
diff --git a/ext/tk/lib/tkextlib/bwidget/label.rb b/ext/tk/lib/tkextlib/bwidget/label.rb
index ce10ecaf8b..1d4c638705 100644
--- a/ext/tk/lib/tkextlib/bwidget/label.rb
+++ b/ext/tk/lib/tkextlib/bwidget/label.rb
@@ -19,21 +19,6 @@ class Tk::BWidget::Label
WidgetClassName = 'Label'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'helptext'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'dragenabled' << 'dropenabled'
- end
- private :__boolval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
-
def set_focus
tk_send_without_enc('setfocus')
self
diff --git a/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ext/tk/lib/tkextlib/bwidget/labelentry.rb
index 931feb9b48..19e92d7ae4 100644
--- a/ext/tk/lib/tkextlib/bwidget/labelentry.rb
+++ b/ext/tk/lib/tkextlib/bwidget/labelentry.rb
@@ -23,28 +23,13 @@ class Tk::BWidget::LabelEntry
WidgetClassName = 'LabelEntry'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
-
- def __font_optkeys
- super() << 'labelfont'
- end
- private :__font_optkeys
-
#def entrybind(*args)
# _bind([path, 'bind'], *args)
# self
#end
def entrybind(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -59,7 +44,7 @@ class Tk::BWidget::LabelEntry
#end
def entrybind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/bwidget/labelframe.rb b/ext/tk/lib/tkextlib/bwidget/labelframe.rb
index f7b267eebb..453756a163 100644
--- a/ext/tk/lib/tkextlib/bwidget/labelframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/labelframe.rb
@@ -6,7 +6,6 @@
require 'tk'
require 'tk/frame'
require 'tkextlib/bwidget.rb'
-require 'tkextlib/bwidget/label'
module Tk
module BWidget
@@ -20,21 +19,6 @@ class Tk::BWidget::LabelFrame
WidgetClassName = 'LabelFrame'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'helptext'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'dragenabled' << 'dropenabled'
- end
- private :__boolval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
-
def self.align(*args)
tk_call('LabelFrame::align', *args)
end
diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb
index 1267500661..178866f699 100644
--- a/ext/tk/lib/tkextlib/bwidget/listbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb
@@ -35,11 +35,6 @@ class Tk::BWidget::ListBox
end
end
- def __boolval_optkeys
- super() << 'autofocus' << 'dragenabled' << 'dropenabled' << 'selectfill'
- end
- private :__boolval_optkeys
-
def tagid(tag)
if tag.kind_of?(Tk::BWidget::ListBox::Item)
tag.id
@@ -55,7 +50,7 @@ class Tk::BWidget::ListBox
#end
def imagebind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -71,7 +66,7 @@ class Tk::BWidget::ListBox
#end
def imagebind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -96,7 +91,7 @@ class Tk::BWidget::ListBox
#end
def textbind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -112,7 +107,7 @@ class Tk::BWidget::ListBox
#end
def textbind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/bwidget/mainframe.rb b/ext/tk/lib/tkextlib/bwidget/mainframe.rb
index c54e878557..e52f4b2f4c 100644
--- a/ext/tk/lib/tkextlib/bwidget/mainframe.rb
+++ b/ext/tk/lib/tkextlib/bwidget/mainframe.rb
@@ -20,25 +20,6 @@ class Tk::BWidget::MainFrame
WidgetClassName = 'MainFrame'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'progressfg'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'progressvar'
- end
- private :__tkvariable_optkeys
-
- def __val2ruby_optkeys # { key=>proc, ... }
- # The method is used to convert a opt-value to a ruby's object.
- # When get the value of the option "key", "proc.call(value)" is called.
- {
- 'menu'=>proc{|v| simplelist(v).collect!{|elem| simplelist(v)}}
- }
- end
- private :__val2ruby_optkeys
-
def add_indicator(keys={}, &b)
win = window(tk_send('addindicator', *hash_kv(keys)))
win.instance_eval(&b) if b
diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
index 9c946d0630..d7b2bbc32b 100644
--- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
+++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb
@@ -5,7 +5,6 @@
require 'tk'
require 'tkextlib/bwidget.rb'
-require 'tkextlib/bwidget/dialog.rb'
module Tk
module BWidget
@@ -44,16 +43,6 @@ class Tk::BWidget::MessageDlg
end
private :create_self
- def __strval_optkeys
- super() << 'message' << 'title'
- end
- private :__strval_optkeys
-
- def __listval_optkeys
- super() << 'buttons'
- end
- private :__listval_optkeys
-
def cget(slot)
slot = slot.to_s
if slot == 'relative'
diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb
index 5146d4915d..01299d2de8 100644
--- a/ext/tk/lib/tkextlib/bwidget/notebook.rb
+++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb
@@ -29,11 +29,6 @@ class Tk::BWidget::NoteBook
end
end
- def __boolval_optkeys
- super() << 'homogeneous'
- end
- private :__boolval_optkeys
-
def tagid(id)
if id.kind_of?(TkWindow)
#id.path
@@ -52,7 +47,7 @@ class Tk::BWidget::NoteBook
#end
def tabbind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -68,7 +63,7 @@ class Tk::BWidget::NoteBook
#end
def tabbind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/bwidget/panelframe.rb b/ext/tk/lib/tkextlib/bwidget/panelframe.rb
deleted file mode 100644
index 13f8817d74..0000000000
--- a/ext/tk/lib/tkextlib/bwidget/panelframe.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# tkextlib/bwidget/panelframe.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/frame'
-require 'tkextlib/bwidget.rb'
-
-module Tk
- module BWidget
- class PanelFrame < TkWindow
- end
- end
-end
-
-class Tk::BWidget::PanelFrame
- TkCommandNames = ['PanelFrame'.freeze].freeze
- WidgetClassName = 'PanelFrame'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def __strval_optkeys
- super() + ['panelforeground', 'panelbackground']
- end
- private :__strval_optkeys
-
- def add(win, keys={})
- tk_send('add', win, keys)
- self
- end
-
- def delete(*wins)
- tk_send('delete', *wins)
- self
- end
-
- def get_frame(&b)
- win = window(tk_send_without_enc('getframe'))
- win.instance_eval(&b) if b
- win
- end
-
- def items
- list(tk_send('items'))
- end
-
- def remove(*wins)
- tk_send('remove', *wins)
- self
- end
-end
diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
index 0b635d97bb..7136ae8d72 100644
--- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
+++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb
@@ -19,23 +19,6 @@ class Tk::BWidget::PasswdDlg
WidgetClassName = 'PasswdDlg'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'loginhelptext' << 'loginlabel' << 'logintext' <<
- 'passwdlabel' << 'passwdtext'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'passwdeditable' << 'homogeneous'
- end
- private :__boolval_optkeys
-
- def __tkvariable_optkeys
- super() << 'loginhelpvar' << 'logintextvariable' <<
- 'passwdhelpvar' << 'passwdtextvariable'
- end
- private :__tkvariable_optkeys
-
def create
login, passwd = simplelist(tk_call(self.class::TkCommandNames[0],
@path, *hash_kv(@keys)))
diff --git a/ext/tk/lib/tkextlib/bwidget/scrollview.rb b/ext/tk/lib/tkextlib/bwidget/scrollview.rb
index 0546af2c43..5da528bd49 100644
--- a/ext/tk/lib/tkextlib/bwidget/scrollview.rb
+++ b/ext/tk/lib/tkextlib/bwidget/scrollview.rb
@@ -17,9 +17,4 @@ class Tk::BWidget::ScrollView
TkCommandNames = ['ScrollView'.freeze].freeze
WidgetClassName = 'ScrollView'.freeze
WidgetClassNames[WidgetClassName] = self
-
- def __strval_optkeys
- super() << 'fill'
- end
- private :__strval_optkeys
end
diff --git a/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ext/tk/lib/tkextlib/bwidget/selectfont.rb
index 478787602a..46ca0dbca8 100644
--- a/ext/tk/lib/tkextlib/bwidget/selectfont.rb
+++ b/ext/tk/lib/tkextlib/bwidget/selectfont.rb
@@ -25,15 +25,9 @@ class Tk::BWidget::SelectFont
WidgetClassName = 'SelectFont'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'sampletext' << 'title'
- end
- private :__strval_optkeys
-
def __font_optkeys
[] # without fontobj operation
end
- private :__font_optkeys
def create
tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))
diff --git a/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ext/tk/lib/tkextlib/bwidget/spinbox.rb
index ca4c046e5c..52dfa30abc 100644
--- a/ext/tk/lib/tkextlib/bwidget/spinbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/spinbox.rb
@@ -22,33 +22,13 @@ class Tk::BWidget::SpinBox
WidgetClassName = 'SpinBox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'dragenabled' << 'dropenabled' << 'editable'
- end
- private :__boolval_optkeys
-
- def __listval_optkeys
- super() << 'values'
- end
- private :__listval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
-
#def entrybind(*args)
# _bind([path, 'bind'], *args)
# self
#end
def entrybind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -63,7 +43,7 @@ class Tk::BWidget::SpinBox
#end
def entrybind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/bwidget/statusbar.rb b/ext/tk/lib/tkextlib/bwidget/statusbar.rb
deleted file mode 100644
index df16e4c0b7..0000000000
--- a/ext/tk/lib/tkextlib/bwidget/statusbar.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# tkextlib/bwidget/statusbar.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-require 'tk/frame'
-require 'tkextlib/bwidget.rb'
-
-module Tk
- module BWidget
- class StatusBar < TkWindow
- end
- end
-end
-
-class Tk::BWidget::StatusBar
- TkCommandNames = ['StatusBar'.freeze].freeze
- WidgetClassName = 'StatusBar'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def __boolval_optkeys
- super() << 'showresize'
- end
- private :__boolval_optkeys
-
- def add(win, keys={})
- tk_send('add', win, keys)
- self
- end
-
- def delete(*wins)
- tk_send('delete', *wins)
- self
- end
-
- def get_frame(&b)
- win = window(tk_send_without_enc('getframe'))
- win.instance_eval(&b) if b
- win
- end
-
- def items
- list(tk_send('items'))
- end
-end
diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb
index e7178debe2..dadf3d5161 100644
--- a/ext/tk/lib/tkextlib/bwidget/tree.rb
+++ b/ext/tk/lib/tkextlib/bwidget/tree.rb
@@ -32,22 +32,6 @@ class Tk::BWidget::Tree
end
end
- def __strval_optkeys
- super() << 'crossfill' << 'linesfill'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'dragenabled' << 'dropenabled' <<
- 'redraw' << 'selectfill' << 'showlines'
- end
- private :__boolval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvar'
- end
- private :__tkvariable_optkeys
-
def tagid(tag)
if tag.kind_of?(Tk::BWidget::Tree::Node)
tag.id
@@ -63,7 +47,7 @@ class Tk::BWidget::Tree
#end
def imagebind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -79,7 +63,7 @@ class Tk::BWidget::Tree
#end
def imagebind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -104,7 +88,7 @@ class Tk::BWidget::Tree
#end
def textbind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -120,7 +104,7 @@ class Tk::BWidget::Tree
#end
def textbind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
index 07abf3a7bf..c03f3c36cb 100644
--- a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
+++ b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb
@@ -22,11 +22,6 @@ module Tk
VERSION = TkCore::INTERP._invoke("set", "::itcl::version").freeze
PATCHLEVEL = TkCore::INTERP._invoke("set", "::itcl::patchLevel").freeze
- PACKAGE_NAME = 'Itcl'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Itcl')
diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb
index 0626536e36..1d80e1cd6b 100644
--- a/ext/tk/lib/tkextlib/itk/incr_tk.rb
+++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb
@@ -20,11 +20,6 @@ module Tk
LIBRARY = TkVarAccess.new('::itk::library')
- PACKAGE_NAME = 'Itk'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Itk')
@@ -115,11 +110,6 @@ module Tk
include Wm
include TkMenuSpec
-
- def __strval_optkeys
- super() << 'title'
- end
- private :__strval_optkeys
end
############################
@@ -289,8 +279,7 @@ module Tk
end
# unknown method
- super(id, *args)
- # fail RuntimeError, "unknown method '#{name}' for #{self.inspect}"
+ fail RuntimeError, "unknown method '#{name}' for #{self.inspect}"
end
def tk_send(cmd, *rest)
@@ -362,7 +351,7 @@ module Tk
end
end
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -391,7 +380,7 @@ module Tk
end
end
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/iwidgets.rb b/ext/tk/lib/tkextlib/iwidgets.rb
index ebd4cf7507..5ef82f68ca 100644
--- a/ext/tk/lib/tkextlib/iwidgets.rb
+++ b/ext/tk/lib/tkextlib/iwidgets.rb
@@ -23,11 +23,6 @@ module Tk
extend TkCore
- PACKAGE_NAME = 'Iwidgets'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Iwidgets')
diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
index a055e07ac9..1ff190b9ff 100644
--- a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
@@ -32,11 +32,6 @@ class Tk::Iwidgets::Buttonbox
end
private :__item_config_cmd
- def __item_boolval_optkeys(id)
- super(id) << 'defaultring'
- end
- private :__item_boolval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
index 0152f8593a..f382cfd143 100644
--- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb
@@ -18,24 +18,6 @@ class Tk::Iwidgets::Calendar
WidgetClassName = 'Calendar'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() + [
- 'buttonforeground', 'outline', 'selectcolor',
- 'weekdaybackground', 'weekendbackground'
- ]
- end
- private :__strval_optkeys
-
- def __listval_optkeys
- super() << 'days'
- end
- private :__listval_optkeys
-
- def __font_optkeys
- super() + ['currentdatefont', 'datefont', 'dayfont', 'titlefont']
- end
- private :__font_optkeys
-
####################################
include Tk::ValidateConfigure
@@ -63,7 +45,7 @@ class Tk::Iwidgets::Calendar
end
def __validation_class_list
- super() << CalendarCommand
+ super << CalendarCommand
end
Tk::ValidateConfigure.__def_validcmd(binding, CalendarCommand)
diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
index fa5e90ad05..1e2a476591 100644
--- a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Canvasprintbox
WidgetClassName = 'Canvasprintbox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'filename'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'stretch'
- end
- private :__boolval_optkeys
-
def get_output
tk_call(@path, 'getoutput')
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
index abd23299a8..05d0e1d813 100644
--- a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb
@@ -32,11 +32,6 @@ class Tk::Iwidgets::Checkbox
end
private :__item_config_cmd
- def __item_boolval_optkeys(id)
- super(id) << 'defaultring'
- end
- private :__item_boolval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
diff --git a/ext/tk/lib/tkextlib/iwidgets/combobox.rb b/ext/tk/lib/tkextlib/iwidgets/combobox.rb
index a6d54d78fa..1cf10b4004 100644
--- a/ext/tk/lib/tkextlib/iwidgets/combobox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/combobox.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Combobox
WidgetClassName = 'Combobox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'completion' << 'dropdown' << 'editable' << 'unique'
- end
- private :__boolval_optkeys
-
def clear(component=None)
tk_call(@path, 'clear', component)
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/datefield.rb b/ext/tk/lib/tkextlib/iwidgets/datefield.rb
index 632f3334dc..924aef9c4d 100644
--- a/ext/tk/lib/tkextlib/iwidgets/datefield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/datefield.rb
@@ -18,21 +18,6 @@ class Tk::Iwidgets::Datefield
WidgetClassName = 'Datefield'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'gmt'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'textbackground'
- end
- private :__strval_optkeys
-
- def __font_optkeys
- super() << 'textfont'
- end
- private :__font_optkeys
-
def get_string
tk_call(@path, 'get', '-string')
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
index d6c668621d..88b9a97094 100644
--- a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
@@ -32,11 +32,6 @@ class Tk::Iwidgets::Dialogshell
end
private :__item_config_cmd
- def __item_boolval_optkeys(id)
- super(id) << 'defaultring'
- end
- private :__item_boolval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
diff --git a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
index 9bc063ba69..8418467925 100644
--- a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Disjointlistbox
WidgetClassName = 'Disjointlistbox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'lhslabeltext' << 'rhslabeltext' << 'lhsbuttonlabel' << 'rhsbuttonlabel'
- end
- private :__strval_optkeys
-
def set_lhs(*items)
tk_call(@path, 'setlhs', items)
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
index 6aa933ce06..ae7d63f3f3 100644
--- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Entryfield
WidgetClassName = 'Entryfield'.freeze
WidgetClassNames[WidgetClassName] = self
- def __font_optkeys
- super() << 'textfont'
- end
- private :__font_optkeys
-
####################################
include Tk::ValidateConfigure
@@ -51,7 +46,7 @@ class Tk::Iwidgets::Entryfield
end
def __validation_class_list
- super() << EntryfieldValidate
+ super << EntryfieldValidate
end
Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
diff --git a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
index 158d9d474a..7b1e35aa2d 100644
--- a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Extbutton
WidgetClassName = 'Extbutton'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'bitmapforeground' << 'ringbackground'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'defaultring'
- end
- private :__boolval_optkeys
-
def invoke
tk_call(@path, 'invoke')
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
index 501f4c90a0..282647893c 100644
--- a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
@@ -18,19 +18,6 @@ class Tk::Iwidgets::Extfileselectionbox
WidgetClassName = 'Extfileselectionbox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() + [
- 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring',
- 'selectionlabel'
- ]
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() + ['dirson', 'fileson', 'filteron', 'selectionon']
- end
- private :__boolval_optkeys
-
def child_site
window(tk_call(@path, 'childsite'))
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/feedback.rb b/ext/tk/lib/tkextlib/iwidgets/feedback.rb
index 0a25237a24..d7439d818a 100644
--- a/ext/tk/lib/tkextlib/iwidgets/feedback.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/feedback.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Feedback
WidgetClassName = 'Feedback'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'barcolor'
- end
- private :__strval_optkeys
-
def reset
tk_call(@path, 'reset')
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
index 7b331d0b40..46de13d1b2 100644
--- a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
@@ -18,19 +18,6 @@ class Tk::Iwidgets::Fileselectionbox
WidgetClassName = 'Fileselectionbox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() + [
- 'directory', 'dirslabel', 'fileslabel', 'filterlabel', 'mask',
- 'nomatchstring', 'selectionlabel'
- ]
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() + ['dirson', 'fileson', 'filteron', 'selectionon']
- end
- private :__boolval_optkeys
-
def child_site
window(tk_call(@path, 'childsite'))
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
index 75e219c37e..a161c3c2a4 100644
--- a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb
@@ -18,19 +18,6 @@ class Tk::Iwidgets::Finddialog
WidgetClassName = 'Finddialog'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() + [
- 'patternbackground', 'patternforeground',
- 'searchbackground', 'searchforeground'
- ]
- end
- private :__strval_optkeys
-
- def __val2ruby_optkeys # { key=>proc, ... }
- super().update('textwidget'=>proc{|v| window(v)})
- end
- private :__val2ruby_optkeys
-
def clear
tk_call(@path, 'clear')
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
index 4cc6aeecbd..077d84c7a4 100644
--- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
@@ -92,7 +92,7 @@ class Tk::Iwidgets::Hierarchy
end
def __validation_class_list
- super() << QueryCommand << IndicatorCommand << IconCommand
+ super << QueryCommand << IndicatorCommand << IconCommand
end
Tk::ValidateConfigure.__def_validcmd(binding, QueryCommand)
@@ -101,21 +101,6 @@ class Tk::Iwidgets::Hierarchy
####################################
- def __boolval_optkeys
- super() << 'alwaysquery' << 'expanded' << 'filter'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'markbackground' << 'markforeground' << 'textbackground'
- end
- private :__strval_optkeys
-
- def __font_optkeys
- super() << 'textfont'
- end
- private :__font_optkeys
-
def clear
tk_call(@path, 'clear')
self
@@ -252,13 +237,13 @@ class Tk::Iwidgets::Hierarchy
args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
args << tags.shift if tags.size > 0 # chars
end
- super(index, *args)
+ super index, *args
else
# single chars-taglist argument :: str, tag, tag, ...
if tags.size == 0
- super(index, chars)
+ super index, chars
else
- super(index, chars, tags.collect{|x|_get_eval_string(x)}.join(' '))
+ super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
end
end
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb
index 77b0e090cd..22e86339a6 100644
--- a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Hyperhelp
WidgetClassName = 'Hyperhelp'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'helpdir'
- end
- private :__strval_optkeys
-
- def __listval_optkeys
- super() << 'topics'
- end
- private :__listval_optkeys
-
def show_topic(topic)
tk_call(@path, 'showtopic', topic)
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
index e77e85045d..89669ea815 100644
--- a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb
@@ -18,21 +18,6 @@ class Tk::Iwidgets::Labeledframe
WidgetClassName = 'Labeledframe'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'labeltext'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'labelvariable'
- end
- private :__tkvariable_optkeys
-
- def __font_optkeys
- super() << 'labelfont'
- end
- private :__font_optkeys
-
def child_site
window(tk_call(@path, 'childsite'))
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
index 99387710cb..f847922386 100644
--- a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb
@@ -20,21 +20,6 @@ class Tk::Iwidgets::Labeledwidget
WidgetClassName = 'Labeledwidget'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'labeltext'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'labelvariable'
- end
- private :__tkvariable_optkeys
-
- def __font_optkeys
- super() << 'labelfont'
- end
- private :__font_optkeys
-
def self.alignlabels(*wins)
tk_call('::iwidgets::Labeledwidget::alignlabels', *wins)
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb
index 4b2541b997..4570afc6d0 100644
--- a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb
@@ -18,21 +18,6 @@ class Tk::Iwidgets::Mainwindow
WidgetClassName = 'Mainwindow'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'helpline' << 'statusline'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'menubarbackground' << 'menubarforeground' << 'toolbarforeground'
- end
- private :__strval_optkeys
-
- def __font_optkeys
- super() << 'menubarfont' << 'toolbarfont'
- end
- private :__font_optkeys
-
def child_site
window(tk_call(@path, 'childsite'))
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
index dea3d34c2a..b60349be17 100644
--- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Menubar
WidgetClassName = 'Menubar'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'menubuttons'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvariable'
- end
- private :__tkvariable_optkeys
-
####################################
include TkItemConfigMethod
@@ -42,16 +32,6 @@ class Tk::Iwidgets::Menubar
end
private :__item_config_cmd
- def __item_strval_optkeys(id)
- super(id) << 'selectcolor'
- end
- private :__item_strval_optkeys
-
- def __item_tkvariable_optkeys(id)
- super(id) << 'helpstr'
- end
- private :__item_tkvariable_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
diff --git a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
index 2bbbec7666..608f6f7adb 100644
--- a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb
@@ -41,11 +41,6 @@ class Tk::Iwidgets::Messagebox
end
end
- def __item_boolval_optkeys(id)
- super(id) << 'bell' << 'show'
- end
- private :__item_boolval_optkeys
-
alias typecget itemcget
alias typeconfigure itemconfigure
alias typeconfiginfo itemconfiginfo
@@ -56,11 +51,6 @@ class Tk::Iwidgets::Messagebox
####################################
- def __strval_optkeys
- super() << 'filename' << 'savedir'
- end
- private :__strval_optkeys
-
def type_add(tag=nil, keys={})
if tag.kind_of?(Hash)
keys = tag
diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
index 0f9d713ea1..d9abf1b02b 100644
--- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb
@@ -23,12 +23,12 @@ class Tk::Iwidgets::Notebook
include TkItemConfigMethod
def __item_cget_cmd(id)
- [self.path, 'pagecget', id]
+ [self.path, 'tabcget', id]
end
private :__item_cget_cmd
def __item_config_cmd(id)
- [self.path, 'pageconfigure', id]
+ [self.path, 'tabconfigure', id]
end
private :__item_config_cmd
@@ -51,11 +51,6 @@ class Tk::Iwidgets::Notebook
####################################
- def __boolval_optkeys
- super() << 'auto'
- end
- private :__boolval_optkeys
-
def add(keys={})
window(tk_call(@path, 'add', *hash_kv(keys)))
end
@@ -144,24 +139,24 @@ class Tk::Iwidgets::Notebook
end
alias scrollbar yscrollbar
- def view(*idxs)
- if idxs.size == 0
+ def view(*index)
+ if index.size == 0
window(tk_send_without_enc('view'))
else
- tk_send_without_enc('view', *idxs)
+ tk_send_without_enc('view', *index)
self
end
end
alias xview view
alias yview view
- def view_moveto(*idxs)
- view('moveto', *idxs)
+ def view_moveto(*index)
+ view('moveto', *index)
end
alias xview_moveto view_moveto
alias yview_moveto view_moveto
- def view_scroll(*idxs)
- view('scroll', *idxs)
+ def view_scroll(*index)
+ view('scroll', *index)
end
alias xview_scroll view_scroll
alias yview_scroll view_scroll
diff --git a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb
index 0c74440be7..226163a150 100644
--- a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Optionmenu
WidgetClassName = 'Optionmenu'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'cyclicon'
- end
- private :__boolval_optkeys
-
def delete(first, last=nil)
if last
tk_call(@path, 'delete', first, last)
diff --git a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
index 035df0a5b8..a205036239 100644
--- a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
@@ -51,11 +51,6 @@ class Tk::Iwidgets::Panedwindow
####################################
- def __boolval_optkeys
- super() << 'showhandle'
- end
- private :__boolval_optkeys
-
def add(tag=nil, keys={})
if tag.kind_of?(Hash)
keys = tag
diff --git a/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb b/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb
index 620b14b5d5..ec18647511 100644
--- a/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb
@@ -73,8 +73,8 @@ class Tk::Iwidgets::Promptdialog
end
alias icursor cursor=
- def index(idx)
- number(tk_send_without_enc('index', idx))
+ def index(index)
+ number(tk_send_without_enc('index', index))
end
def insert(pos,text)
diff --git a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb
index c21007ca6c..25d3633507 100644
--- a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Pushbutton
WidgetClassName = 'Pushbutton'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'defaultring'
- end
- private :__boolval_optkeys
-
def invoke
tk_call_without_enc(@path, 'invoke')
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
index d4316754f2..84c15082d6 100644
--- a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb
@@ -32,11 +32,6 @@ class Tk::Iwidgets::Radiobox
end
private :__item_config_cmd
- def __item_boolval_optkeys(id)
- super(id) << 'defaultring'
- end
- private :__item_boolval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
index 407c8f2aad..939d97de67 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
@@ -21,16 +21,6 @@ class Tk::Iwidgets::Scrolledcanvas
################################
- def __boolval_optkeys
- super() << 'autoresize'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'textbackground'
- end
- private :__strval_optkeys
-
def initialize(*args)
super(*args)
@canvas = component_widget('canvas')
@@ -113,7 +103,7 @@ class Tk::Iwidgets::Scrolledcanvas
#end
def itembind(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -128,7 +118,7 @@ class Tk::Iwidgets::Scrolledcanvas
#end
def itembind_append(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -173,9 +163,7 @@ class Tk::Iwidgets::Scrolledcanvas
def delete(*args)
if TkcItem::CItemID_TBL[self.path]
find('withtag', *args).each{|item|
- if item.kind_of?(TkcItem)
- TkcItem::CItemID_TBL[self.path].delete(item.id)
- end
+ TkcItem::CItemID_TBL[self.path].delete(item.id)
}
end
tk_send_without_enc('delete', *args.collect{|t| tagid(t)})
@@ -240,8 +228,8 @@ class Tk::Iwidgets::Scrolledcanvas
self
end
- def index(tagOrId, idx)
- number(tk_send_without_enc('index', tagid(tagOrId), idx))
+ def index(tagOrId, index)
+ number(tk_send_without_enc('index', tagid(tagOrId), index))
end
def insert(tagOrId, index, string)
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb
index 9b69ef07fe..7023d889d1 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb
@@ -18,21 +18,6 @@ class Tk::Iwidgets::Scrolledhtml
WidgetClassName = 'Scrolledhtml'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'update'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'fontname' << 'link' << 'alink' << 'textbackground'
- end
- private :__strval_optkeys
-
- def __font_optkeys
- super() << 'fixedfont'
- end
- private :__font_optkeys
-
def import(href)
tk_call(@path, 'import', href)
self
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
index cd1f6f0f79..9fe23b4edc 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
@@ -19,21 +19,6 @@ class Tk::Iwidgets::Scrolledlistbox
WidgetClassName = 'Scrolledlistbox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'textbackground'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'listvariable'
- end
- private :__tkvariable_optkeys
-
- def __font_optkeys
- super() << 'textfont'
- end
- private :__font_optkeys
-
################################
def initialize(*args)
@@ -140,9 +125,7 @@ class Tk::Iwidgets::Scrolledlistbox
end
def get(first, last=nil)
if last
- # tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
- tk_split_simplelist(tk_send_without_enc('get', first, last),
- false, true)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
else
_fromUTF8(tk_send_without_enc('get', first))
end
@@ -169,8 +152,8 @@ class Tk::Iwidgets::Scrolledlistbox
self
end
- def index(idx)
- tk_send_without_enc('index', idx).to_i
+ def index(index)
+ tk_send_without_enc('index', index).to_i
end
#####################################
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
index fdafc8dc7f..39a9ed63c8 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
@@ -19,16 +19,6 @@ class Tk::Iwidgets::Scrolledtext
WidgetClassName = 'Scrolledtext'.freeze
WidgetClassNames[WidgetClassName] = self
- def __strval_optkeys
- super() << 'textbackground'
- end
- private :__strval_optkeys
-
- def __font_optkeys
- super() << 'textfont'
- end
- private :__font_optkeys
-
################################
def initialize(*args)
@@ -147,19 +137,15 @@ class Tk::Iwidgets::Scrolledtext
if slot
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
- #conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
else
- #conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
end
conf[0] = conf[0][1..-1]
conf
else
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).collect{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'file'
@@ -187,20 +173,16 @@ class Tk::Iwidgets::Scrolledtext
if slot
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
- #conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
else
- #conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
- conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
end
key = conf.shift[1..-1]
{ key => conf }
else
ret = {}
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
- # conf = tk_split_simplelist(conflist)
- tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).each{|conflist|
- conf = tk_split_simplelist(conflist, false, true)
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
key = conf.shift[1..-1]
case key
when 'text', 'label', 'show', 'data', 'file'
@@ -253,14 +235,13 @@ class Tk::Iwidgets::Scrolledtext
end
def image_names
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'names'))).collect{|elt|
- tk_split_simplelist(tk_send_without_enc('image', 'names'), false, true).collect{|elt|
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'names'))).collect{|elt|
tagid2obj(elt)
}
end
- def index(idx)
- tk_send_without_enc('index', _get_eval_enc_str(idx))
+ def index(index)
+ tk_send_without_enc('index', _get_eval_enc_str(index))
end
def insert(index, *args)
@@ -269,8 +250,7 @@ class Tk::Iwidgets::Scrolledtext
end
def mark_names
- #tk_split_simplelist(_fromUTF8(tk_send_without_enc('mark', 'names'))).collect{|elt|
- tk_split_simplelist(tk_send_without_enc('mark', 'names'), false, true).collect{|elt|
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('mark', 'names'))).collect{|elt|
tagid2obj(elt)
}
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb
index bb81fcca5e..91ba9248e1 100644
--- a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Selectionbox
WidgetClassName = 'Selectionbox'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'itemson' << 'selectionon'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'itemslabel' << 'selectionlabel'
- end
- private :__strval_optkeys
-
def child_site
window(tk_call(@path, 'childsite'))
end
@@ -67,8 +57,8 @@ class Tk::Iwidgets::Selectionbox
tk_send_without_enc('delete', first, last)
self
end
- def index(idx)
- tk_send_without_enc('index', idx).to_i
+ def index(index)
+ tk_send_without_enc('index', index).to_i
end
def nearest(y)
tk_send_without_enc('nearest', y).to_i
diff --git a/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb
index ab790e97a6..794da5d61c 100644
--- a/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb
@@ -57,8 +57,8 @@ class Tk::Iwidgets::Selectiondialog
tk_send_without_enc('delete', first, last)
self
end
- def index(idx)
- tk_send_without_enc('index', idx).to_i
+ def index(index)
+ tk_send_without_enc('index', index).to_i
end
def nearest(y)
tk_send_without_enc('nearest', y).to_i
diff --git a/ext/tk/lib/tkextlib/iwidgets/spindate.rb b/ext/tk/lib/tkextlib/iwidgets/spindate.rb
index 2c98eb4629..6099ba77b9 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spindate.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spindate.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Spindate
WidgetClassName = 'Spindate'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'dayon' << 'monthon' << 'yearon'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'daylabel' << 'monthformat' << 'monthlabel' << 'yearlabel'
- end
- private :__strval_optkeys
-
def get_string
tk_call(@path, 'get', '-string')
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/spinint.rb b/ext/tk/lib/tkextlib/iwidgets/spinint.rb
index 5eb944d081..071b6ab8f7 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spinint.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spinint.rb
@@ -17,14 +17,4 @@ class Tk::Iwidgets::Spinint
TkCommandNames = ['::iwidgets::spinint'.freeze].freeze
WidgetClassName = 'Spinint'.freeze
WidgetClassNames[WidgetClassName] = self
-
- def __boolval_optkeys
- super() << 'wrap'
- end
- private :__boolval_optkeys
-
- def __numlistval_optkeys
- super() << 'range'
- end
- private :__numlistval_optkeys
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
index 174b9bd506..b5c72b4df8 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb
@@ -46,7 +46,7 @@ class Tk::Iwidgets::Spinner
end
def __validation_class_list
- super() << EntryfieldValidate
+ super << EntryfieldValidate
end
Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
@@ -91,8 +91,8 @@ class Tk::Iwidgets::Spinner
end
alias icursor cursor=
- def index(idx)
- number(tk_send_without_enc('index', idx))
+ def index(index)
+ number(tk_send_without_enc('index', index))
end
def insert(pos,text)
diff --git a/ext/tk/lib/tkextlib/iwidgets/spintime.rb b/ext/tk/lib/tkextlib/iwidgets/spintime.rb
index 0ff683ab56..c1e1f5e5f1 100644
--- a/ext/tk/lib/tkextlib/iwidgets/spintime.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/spintime.rb
@@ -18,16 +18,6 @@ class Tk::Iwidgets::Spintime
WidgetClassName = 'Spintime'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'houron' << 'militaryon' << 'minutelabel' << 'secondlabel'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'hourlabel' << 'minuteon' << 'secondon'
- end
- private :__strval_optkeys
-
def get_string
tk_call(@path, 'get', '-string')
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
index 0d9715f87b..5321331551 100644
--- a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
@@ -23,20 +23,15 @@ class Tk::Iwidgets::Tabnotebook
include TkItemConfigMethod
def __item_cget_cmd(id)
- [self.path, 'pagecget', id]
+ [self.path, 'tabcget', id]
end
private :__item_cget_cmd
def __item_config_cmd(id)
- [self.path, 'pageconfigure', id]
+ [self.path, 'tabconfigure', id]
end
private :__item_config_cmd
- def __item_strval_optkeys(id)
- super(id) << 'tabbackground' << 'tabforeground'
- end
- private :__item_strval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
@@ -56,16 +51,6 @@ class Tk::Iwidgets::Tabnotebook
####################################
- def __boolval_optkeys
- super() << 'auto' << 'equaltabs' << 'raiseselect' << 'tabborders'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'backdrop' << 'tabbackground' << 'tabforeground'
- end
- private :__strval_optkeys
-
def initialize(*args)
super(*args)
@tabset = self.component_widget('tabset')
diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb
index 54e56d0514..1b76916ab7 100644
--- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb
@@ -51,16 +51,6 @@ class Tk::Iwidgets::Tabset
####################################
- def __boolval_optkeys
- super() << 'equaltabs' << 'raiseselect' << 'tabborders'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'backdrop'
- end
- private :__strval_optkeys
-
def add(keys={})
window(tk_call(@path, 'add', *hash_kv(keys)))
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb
index 588da77dc8..987cddc1e0 100644
--- a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb
@@ -17,9 +17,4 @@ class Tk::Iwidgets::Timeentry
TkCommandNames = ['::iwidgets::timeentry'.freeze].freeze
WidgetClassName = 'Timeentry'.freeze
WidgetClassNames[WidgetClassName] = self
-
- def __strval_optkeys
- super() << 'closetext'
- end
- private :__strval_optkeys
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/timefield.rb b/ext/tk/lib/tkextlib/iwidgets/timefield.rb
index 28e1504797..602093eb7e 100644
--- a/ext/tk/lib/tkextlib/iwidgets/timefield.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/timefield.rb
@@ -18,21 +18,6 @@ class Tk::Iwidgets::Timefield
WidgetClassName = 'Timefield'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'gmt'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'textbackground'
- end
- private :__strval_optkeys
-
- def __font_optkeys
- super() << 'textfont'
- end
- private :__font_optkeys
-
def get_string
tk_call(@path, 'get', '-string')
end
diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
index 17cfa62156..a2a7f31627 100644
--- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb
@@ -18,11 +18,6 @@ class Tk::Iwidgets::Toolbar
WidgetClassName = 'Toolbar'.freeze
WidgetClassNames[WidgetClassName] = self
- def __tkvariable_optkeys
- super() << 'helpvariable'
- end
- private :__tkvariable_optkeys
-
####################################
include TkItemConfigMethod
@@ -37,11 +32,6 @@ class Tk::Iwidgets::Toolbar
end
private :__item_config_cmd
- def __item_strval_optkeys(id)
- super(id) << 'helpstr' << 'balloonstr'
- end
- private :__item_strval_optkeys
-
def tagid(tagOrId)
if tagOrId.kind_of?(Tk::Itk::Component)
tagOrId.name
@@ -53,21 +43,6 @@ class Tk::Iwidgets::Toolbar
####################################
- def __strval_optkeys
- super() << 'balloonbackground' << 'balloonforeground'
- end
- private :__strval_optkeys
-
- def __tkvariable_optkeys
- super() << 'helpvariable'
- end
- private :__tkvariable_optkeys
-
- def __font_optkeys
- super() << 'balloonfont'
- end
- private :__font_optkeys
-
def add(type, tag=nil, keys={})
if tag.kind_of?(Hash)
keys = tag
diff --git a/ext/tk/lib/tkextlib/iwidgets/watch.rb b/ext/tk/lib/tkextlib/iwidgets/watch.rb
index ab2b687cf9..f62c0b931e 100644
--- a/ext/tk/lib/tkextlib/iwidgets/watch.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/watch.rb
@@ -18,17 +18,6 @@ class Tk::Iwidgets::Watch
WidgetClassName = 'Watch'.freeze
WidgetClassNames[WidgetClassName] = self
- def __boolval_optkeys
- super() << 'showampm'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'clockcolor' << 'hourcolor' << 'minutecolor' <<
- 'pivotcolor' << 'secondcolor' << 'tickcolor'
- end
- private :__strval_optkeys
-
def get_string
tk_call(@path, 'get', '-string')
end
diff --git a/ext/tk/lib/tkextlib/tcllib.rb b/ext/tk/lib/tkextlib/tcllib.rb
index c6138f4275..f238a975a4 100644
--- a/ext/tk/lib/tkextlib/tcllib.rb
+++ b/ext/tk/lib/tkextlib/tcllib.rb
@@ -43,45 +43,24 @@ module Tk
TkComm::TkExtlibAutoloadModule.unshift(self)
# package:: ctext
- autoload :CText, 'tkextlib/tcllib/ctext'
-
- # package:: getstring
- autoload :GetString_Dialog, 'tkextlib/tcllib/getstring'
-
- # package:: history
- autoload :History, 'tkextlib/tcllib/history'
+ autoload :CText, 'tkextlib/tcllib/ctext'
# package:: datefield
- autoload :Datefield, 'tkextlib/tcllib/datefield'
- autoload :DateField, 'tkextlib/tcllib/datefield'
+ autoload :Datefield, 'tkextlib/tcllib/datefield'
+ autoload :DateField, 'tkextlib/tcllib/datefield'
# package:: ico
- autoload :ICO, 'tkextlib/tcllib/ico'
+ autoload :ICO, 'tkextlib/tcllib/ico'
# package:: ipentry
- autoload :IP_Entry, 'tkextlib/tcllib/ip_entry'
- autoload :IPEntry, 'tkextlib/tcllib/ip_entry'
-
- # package:: swaplist
- autoload :Swaplist_Dialog, 'tkextlib/tcllib/swaplist'
+ autoload :IP_Entry, 'tkextlib/tcllib/ip_entry'
+ autoload :IPEntry, 'tkextlib/tcllib/ip_entry'
# package:: Plotchart
- autoload :Plotchart, 'tkextlib/tcllib/plotchart'
-
- # package:: tablelist
- autoload :Tablelist, 'tkextlib/tcllib/tablelist'
- autoload :TableList, 'tkextlib/tcllib/tablelist'
- autoload :Tablelist_Tile, 'tkextlib/tcllib/tablelist_tile'
- autoload :TableList_Tile, 'tkextlib/tcllib/tablelist_tile'
+ autoload :Plotchart, 'tkextlib/tcllib/plotchart'
# package:: tkpiechart
- autoload :Tkpiechart, 'tkextlib/tcllib/tkpiechart'
-
- # package:: tooltip
- autoload :Tooltip, 'tkextlib/tcllib/tooltip'
-
- # package:: widget
- autoload :Wdiget, 'tkextlib/tcllib/widget'
+ autoload :Tkpiechart, 'tkextlib/tcllib/tkpiechart'
end
end
diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
index 6940a9174c..256b01ba87 100644
--- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
+++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
@@ -31,11 +31,6 @@ require 'tkextlib/tcllib.rb'
module Tk
module Tcllib
module Autoscroll
- PACKAGE_NAME = 'autoscroll'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('autoscroll')
@@ -125,7 +120,6 @@ class TkScrollbar
end
# TkPackage.require('autoscroll', '1.0')
-# TkPackage.require('autoscroll', '1.1')
TkPackage.require('autoscroll')
module Tk
@@ -143,16 +137,7 @@ module Tk
def self.unautoscroll(win)
tk_call_without_enc('::autoscroll::unautoscroll', win.path)
end
-
- def self.wrap
- # v1.1
- tk_call_without_enc('::autoscroll::wrap')
- end
-
- def self.unwrap
- # v1.1
- tk_call_without_enc('::autoscroll::unwrap')
- end
end
end
end
+
diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb
index 70a45dd8e7..89bfeff0f3 100644
--- a/ext/tk/lib/tkextlib/tcllib/ctext.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb
@@ -16,11 +16,6 @@ TkPackage.require('ctext')
module Tk
module Tcllib
class CText < TkText
- PACKAGE_NAME = 'ctext'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('ctext')
@@ -39,25 +34,13 @@ class Tk::Tcllib::CText
def create_self(keys)
if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ tk_call_without_enc('ctext', @path, *hash_kv(keys, true))
else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ tk_call_without_enc('ctext', @path)
end
end
private :create_self
- def __strval_optkeys
- super() << 'linemapfg' << 'linemapbg' <<
- 'linemap_select_fg' << 'linemap_select_bg'
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() << 'highlight' << 'linemap_markable'
- end
- private :__boolval_optkeys
-
def append(*args)
tk_send('append', *args)
end
diff --git a/ext/tk/lib/tkextlib/tcllib/cursor.rb b/ext/tk/lib/tkextlib/tcllib/cursor.rb
index 9bb828e8dd..86a68497b4 100644
--- a/ext/tk/lib/tkextlib/tcllib/cursor.rb
+++ b/ext/tk/lib/tkextlib/tcllib/cursor.rb
@@ -12,11 +12,6 @@ require 'tkextlib/tcllib.rb'
module Tk
module Tcllib
module Cursor
- PACKAGE_NAME = 'cursor'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('cursor')
diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb
index bd84488101..1d029e4569 100644
--- a/ext/tk/lib/tkextlib/tcllib/datefield.rb
+++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb
@@ -25,11 +25,6 @@ TkPackage.require('datefield')
module Tk
module Tcllib
class Datefield < TkEntry
- PACKAGE_NAME = 'datefield'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('datefield')
@@ -47,10 +42,10 @@ class Tk::Tcllib::Datefield
def create_self(keys)
if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ tk_call_without_enc('::datefield::datefield', @path,
*hash_kv(keys, true))
else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ tk_call_without_enc('::datefield::datefield', @path)
end
end
private :create_self
diff --git a/ext/tk/lib/tkextlib/tcllib/dialog.rb b/ext/tk/lib/tkextlib/tcllib/dialog.rb
deleted file mode 100644
index 825621b5a1..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/dialog.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# tkextlib/tcllib/dialog.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Generic dialog widget (themed)
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::dialog', '1.2')
-TkPackage.require('widget::dialog')
-
-module Tk::Tcllib
- module Widget
- class Dialog < TkWindow
- PACKAGE_NAME = 'widget::dialog'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::dialog')
- rescue
- ''
- end
- end
- end
- end
-end
-
-class Tk::Tcllib::Widget::Dialog
- TkCommandNames = ['::widget::dialog'.freeze].freeze
-
- def __boolval_optkeys
- ['separator', 'synchronous', 'transient']
- end
- private :__boolval_optkeys
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- def add(what, *args)
- window(tk_send('add', *args))
- end
-
- def get_frame
- window(tk_send('getframe'))
- end
-
- def set_widget(widget)
- tk_send('setwidget', widget)
- self
- end
-
- def display
- tk_send('display')
- self
- end
- alias show display
-
- def cancel
- tk_send('cancel')
- self
- end
-
- def close(reason = None)
- tk_send('close', reason)
- end
-
- def withdraw
- tk_send('withdraw')
- self
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb
deleted file mode 100644
index bf5e54e8cf..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/getstring.rb
+++ /dev/null
@@ -1,131 +0,0 @@
-#
-# tkextlib/tcllib/getstring.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * A dialog which consists of an Entry, OK, and Cancel buttons.
-#
-
-require 'tk'
-require 'tk/entry'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('getstring', '0.1')
-TkPackage.require('getstring')
-
-module Tk::Tcllib
- class GetString_Dialog < TkWindow
- PACKAGE_NAME = 'getstring'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('getstring')
- rescue
- ''
- end
- end
- end
-end
-
-
-class Tk::Tcllib::GetString_Dialog
- TkCommandNames = ['::getstring::tk_getString'.freeze].freeze
- WidgetClassName = 'TkSDialog'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.show(*args)
- dialog = self.new(*args)
- dialog.show
- [dialog.status, dialog.value]
- end
- def self.display(*args)
- self.show(*args)
- end
-
- def initialize(*args) # args = (parent=nil, text='', keys=nil)
- keys = args.pop
- if keys.kind_of?(Hash)
- text = args.pop
- @keys = _symbolkey2str(keys)
- args.push(keys)
- else
- text = keys
- @keys = {}
- end
- if text
- @text = text.dup
- else
- @text = ''
- end
-
- @variable = TkVariable.new
- @status = nil
-
- super(*args)
- end
-
- def create_self(keys)
- # dummy
- end
- private :create_self
-
- def show
- @variable.value = ''
- @status = bool(tk_call(self.class::TkCommandNames[0],
- @path, @variable, @text, *hash_kv(@keys)))
- end
- alias display show
-
- def status
- @status
- end
-
- def value
- @variable.value
- end
-
- def cget(slot)
- slot = slot.to_s
- if slot == 'text'
- @text
- else
- @keys[slot]
- end
- end
-
- def configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot.each{|k, v| configure(k, v)}
- else
- slot = slot.to_s
- value = _symbolkey2str(value) if value.kind_of?(Hash)
- if value && value != None
- if slot == 'text'
- @text = value.to_s
- else
- @keys[slot] = value
- end
- else
- if slot == 'text'
- @text = ''
- else
- @keys.delete(slot)
- end
- end
- end
- self
- end
-
- def configinfo(slot = nil)
- if slot
- slot = slot.to_s
- [ slot, nil, nil, nil, ( (slot == 'text')? @text: @keys[slot] ) ]
- else
- @keys.collect{|k, v| [ k, nil, nil, nil, v ] } \
- << [ 'text', nil, nil, nil, @text ]
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/history.rb b/ext/tk/lib/tkextlib/tcllib/history.rb
deleted file mode 100644
index a01a4ebfcc..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/history.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# tkextlib/tcllib/history.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Provides a history for Entry widgets
-#
-
-require 'tk'
-require 'tk/entry'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('history', '0.1')
-TkPackage.require('history')
-
-module Tk::Tcllib
- module History
- PACKAGE_NAME = 'history'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('history')
- rescue
- ''
- end
- end
- end
-end
-
-module Tk::Tcllib::History
- extend TkCore
-
- def self.init(entry, length=None)
- tk_call_without_enc('::history::init', entry.path, length)
- entry.extend(self) # add methods to treat history to the entry widget
- end
-
- def self.remove(entry)
- tk_call_without_enc('::history::remove', entry.path)
- entry
- end
-
- def history_remove
- tk_call_without_enc('::history::remove', @path)
- self
- end
-
- def history_add(text)
- tk_call('::history::add', @path, text)
- self
- end
-
- def history_get
- simplelist(tk_call_without_enc('::history::get', @path))
- end
-
- def history_clear
- tk_call_without_enc('::history::clear', @path)
- self
- end
-
- def history_configure(opt, value)
- tk_call('::history::configure', @path, opt, value)
- self
- end
-
- def history_configinfo(opt)
- tk_call('::history::configure', @path, opt)
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/ico.rb b/ext/tk/lib/tkextlib/tcllib/ico.rb
index 3beeb11a4d..c87275126e 100644
--- a/ext/tk/lib/tkextlib/tcllib/ico.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ico.rb
@@ -16,11 +16,6 @@ TkPackage.require('ico')
module Tk
module Tcllib
class ICO < TkImage
- PACKAGE_NAME = 'ico'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('ico')
diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
index 8c9e0bd683..da9f1eb3a8 100644
--- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
+++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
@@ -19,11 +19,6 @@ TkPackage.require('ipentry')
module Tk
module Tcllib
class IP_Entry < TkEntry
- PACKAGE_NAME = 'ipentry'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('ipentry')
@@ -43,19 +38,13 @@ class Tk::Tcllib::IP_Entry
def create_self(keys)
if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ tk_call_without_enc('::ipentry::ipentry', @path, *hash_kv(keys, true))
else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ tk_call_without_enc('::ipentry::ipentry', @path)
end
end
private :create_self
- def __strval_optkeys
- super() << 'fg' << 'bg' << 'insertbackground'
- end
- private :__strval_optkeys
-
def complete?
bool(tk_send_without_enc('complete'))
end
diff --git a/ext/tk/lib/tkextlib/tcllib/panelframe.rb b/ext/tk/lib/tkextlib/tcllib/panelframe.rb
deleted file mode 100644
index 2a4562e779..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/panelframe.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# tkextlib/tcllib/panelframe.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Create PanelFrame widgets.
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::panelframe', '1.0')
-TkPackage.require('widget::panelframe')
-
-module Tk::Tcllib
- module Widget
- class PanelFrame < TkWindow
- PACKAGE_NAME = 'widget::panelframe'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::panelframe')
- rescue
- ''
- end
- end
- end
- Panelframe = PanelFrame
- end
-end
-
-class Tk::Tcllib::Widget::PanelFrame
- TkCommandNames = ['::widget::panelframe'.freeze].freeze
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- def add(what, *args)
- window(tk_send('add', *args))
- end
-
- #def get_frame
- # window(tk_send('getframe'))
- #end
-
- def set_widget(widget)
- tk_send('setwidget', widget)
- self
- end
-
- def remove(*wins)
- tk_send('remove', *wins)
- end
- def remove_destroy(*wins)
- tk_send('remove', '-destroy', *wins)
- end
- alias delete remove_destroy
-
- def items
- simplelist(tk_send('items')).collect!{|w| window(w)}
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
index f5f344ceb3..5603ce1283 100644
--- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
@@ -61,17 +61,11 @@ require 'tk'
require 'tkextlib/tcllib.rb'
# TkPackage.require('Plotchart', '0.9')
-# TkPackage.require('Plotchart', '1.1')
TkPackage.require('Plotchart')
module Tk
module Tcllib
module Plotchart
- PACKAGE_NAME = 'Plotchart'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Plotchart')
@@ -273,51 +267,6 @@ module Tk::Tcllib::Plotchart
self
end
- def contourlines(xcrd, ycrd, vals, clss=None)
- xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
- ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
- vals = array2tk_list(vals) if vals.kind_of?(Array)
- clss = array2tk_list(clss) if clss.kind_of?(Array)
-
- tk_call_without_enc(@chart, 'contourlines', xcrd, ycrd, vals, clss)
- self
- end
-
- def contourfill(xcrd, ycrd, vals, klasses=None)
- xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
- ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
- vals = array2tk_list(vals) if vals.kind_of?(Array)
- clss = array2tk_list(clss) if clss.kind_of?(Array)
-
- tk_call_without_enc(@chart, 'contourfill', xcrd, ycrd, vals, clss)
- self
- end
-
- def contourbox(xcrd, ycrd, vals, klasses=None)
- xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
- ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
- vals = array2tk_list(vals) if vals.kind_of?(Array)
- clss = array2tk_list(clss) if clss.kind_of?(Array)
-
- tk_call_without_enc(@chart, 'contourbox', xcrd, ycrd, vals, clss)
- self
- end
-
- def color_map(colors)
- colors = array2tk_list(colors) if colors.kind_of?(Array)
-
- tk_call_without_enc(@chart, 'colorMap', colors)
- self
- end
-
- def grid_cells(xcrd, ycrd)
- xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array)
- ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array)
-
- tk_call_without_enc(@chart, 'grid', xcrd, ycrd)
- self
- end
-
def dataconfig(series, key, value=None)
if key.kind_of?(Hash)
tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true))
@@ -525,13 +474,6 @@ module Tk::Tcllib::Plotchart
self
end
- def plot_funcont(conts, cmd=Proc.new)
- conts = array2tk_list(conts) if conts.kind_of?(Array)
- Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd)} $x $y}")
- tk_call_without_enc(@chart, 'plotfuncont', "#{@path}_#{@chart}", conts)
- self
- end
-
def grid_size(nxcells, nycells)
tk_call_without_enc(@chart, 'gridsize', nxcells, nycells)
self
@@ -686,7 +628,7 @@ module Tk::Tcllib::Plotchart
# time_end := String of time format (e.g. "1 january 2004")
# items := Expected/maximum number of items
# ( This determines the vertical spacing. )
- if args[0].kind_of?(String)
+ if args[0].kind_of?(Array)
@time_begin = args.shift
@time_end = args.shift
@items = args.shift
@@ -733,105 +675,6 @@ module Tk::Tcllib::Plotchart
end
############################
- class Gnattchart < TkCanvas
- include ChartMethod
-
- TkCommandNames = [
- 'canvas'.freeze,
- '::Plotchart::createGnattchart'.freeze
- ].freeze
-
- def initialize(*args)
- # args := ([parent,] time_begin, time_end, items [, text_width] [, keys])
- # time_begin := String of time format (e.g. "1 january 2004")
- # time_end := String of time format (e.g. "1 january 2004")
- # items := Expected/maximum number of items
- # ( This determines the vertical spacing. )
- if args[0].kind_of?(String)
- @time_begin = args.shift
- @time_end = args.shift
- @items = args.shift
-
- if args[0].kind_of?(Fixnum)
- @text_width = args.shift
- else
- @text_width = None
- end
-
- super(*args) # create canvas widget
- else
- parent = args.shift
-
- @time_begin = args.shift
- @time_end = args.shift
- @items = args.shift
-
- if args[0].kind_of?(Fixnum)
- @text_width = args.shift
- else
- @text_width = None
- end
-
- if parent.kind_of?(TkCanvas)
- @path = parent.path
- else
- super(parent, *args) # create canvas widget
- end
- end
-
- @chart = _create_chart
- end
-
- def _create_chart
- p self.class::TkCommandNames[1] if $DEBUG
- tk_call_without_enc(self.class::TkCommandNames[1], @path,
- @time_begin, @time_end, @items, @text_width)
- end
- private :_create_chart
-
- def task(txt, time_begin, time_end, completed=0.0)
- list(tk_call_without_enc(@chart, 'task', txt, time_begin, time_end,
- completed)).collect!{|id|
- TkcItem.id2obj(self, id)
- }
- end
-
- def milestone(txt, time, col=None)
- tk_call_without_enc(@chart, 'milestone', txt, time, col)
- self
- end
-
- def vertline(txt, time)
- tk_call_without_enc(@chart, 'vertline', txt, time)
- self
- end
-
- def connect(from_task, to_task)
- from_task = array2tk_list(from_task) if from_task.kind_of?(Array)
- to_task = array2tk_list(to_task) if to_task.kind_of?(Array)
-
- tk_call_without_enc(@chart, 'connect', from_task, to_task)
- self
- end
-
- def summary(txt, tasks)
- tasks = array2tk_list(tasks) if tasks.kind_of?(Array)
- tk_call_without_enc(@chart, 'summary', tasks)
- self
- end
-
- def color_of_part(keyword, newcolor)
- tk_call_without_enc(@chart, 'color', keyword, newcolor)
- self
- end
-
- def font_of_part(keyword, newfont)
- tk_call_without_enc(@chart, 'font', keyword, newfont)
- self
- end
- end
-
- ############################
class PlotSeries < TkObject
SeriesID_TBL = TkCore::INTERP.create_table
Series_ID = ['series'.freeze, '00000'.taint].freeze
diff --git a/ext/tk/lib/tkextlib/tcllib/ruler.rb b/ext/tk/lib/tkextlib/tcllib/ruler.rb
deleted file mode 100644
index 88ffb2c912..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/ruler.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# tkextlib/tcllib/ruler.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * ruler widget
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::ruler', '1.0')
-TkPackage.require('widget::ruler')
-
-module Tk::Tcllib
- module Widget
- class Ruler < TkWindow
- PACKAGE_NAME = 'widget::ruler'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::ruler')
- rescue
- ''
- end
- end
- end
- end
-end
-
-class Tk::Tcllib::Widget::Ruler
- TkCommandNames = ['::widget::ruler'.freeze].freeze
-
- def __boolval_optkeys
- ['showvalues', 'outline', 'grid']
- end
- private :__boolval_optkeys
-
- def __numlistval_optkeys
- ['interval', 'sizes']
- end
- private :__numlistval_optkeys
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- def redraw
- tk_send('redraw')
- self
- end
-
- def shade(org, dest, frac)
- tk_send('shade', org, dest, frac)
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/screenruler.rb b/ext/tk/lib/tkextlib/tcllib/screenruler.rb
deleted file mode 100644
index 1b4067e2f0..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/screenruler.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# tkextlib/tcllib/screenruler.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * screenruler dialog
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::screenruler', '1.1')
-TkPackage.require('widget::screenruler')
-
-module Tk::Tcllib
- module Widget
- class ScreenRuler < TkWindow
- PACKAGE_NAME = 'widget::ruler'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::screenruler')
- rescue
- ''
- end
- end
- end
- Screenruler = ScreenRuler
- end
-end
-
-class Tk::Tcllib::Widget::ScreenRuler
- TkCommandNames = ['::widget::screenruler'.freeze].freeze
-
- def __boolval_optkeys
- ['topmost', 'reflect']
- end
- private :__boolval_optkeys
-
- def __numlistval_optkeys
- ['alpha']
- end
- private :__numlistval_optkeys
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- def display
- tk_send('display')
- self
- end
- alias show display
-
- def hide
- tk_send('hide')
- self
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
deleted file mode 100644
index 717728e34a..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# tkextlib/tcllib/scrollwin.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Scrolled widget
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::scrolledwindow', '1.0')
-TkPackage.require('widget::scrolledwindow')
-
-module Tk::Tcllib
- module Widget
- class ScrolledWindow < TkWindow
- PACKAGE_NAME = 'widget::scrolledwindow'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::scrolledwindow')
- rescue
- ''
- end
- end
- end
- Scrolledwindow = ScrolledWindow
- end
-end
-
-class Tk::Tcllib::Widget::ScrolledWindow
- TkCommandNames = ['::widget::scrolledwindow'.freeze].freeze
-
- def __numlistval_optkeys
- ['ipad']
- end
- private :__numlistval_optkeys
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- def get_frame
- window(tk_send('getframe'))
- end
-
- def set_widget(widget)
- tk_send('setwidget', widget)
- self
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/style.rb b/ext/tk/lib/tkextlib/tcllib/style.rb
index dac6916e46..72a99d80fc 100644
--- a/ext/tk/lib/tkextlib/tcllib/style.rb
+++ b/ext/tk/lib/tkextlib/tcllib/style.rb
@@ -11,11 +11,6 @@ require 'tkextlib/tcllib.rb'
module Tk::Tcllib
module Style
- PACKAGE_NAME = 'style'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('style')
@@ -39,7 +34,6 @@ module Tk::Tcllib
end
# TkPackage.require('style', '0.1')
-# TkPackage.require('style', '0.3')
TkPackage.require('style')
module Tk::Tcllib
diff --git a/ext/tk/lib/tkextlib/tcllib/superframe.rb b/ext/tk/lib/tkextlib/tcllib/superframe.rb
deleted file mode 100644
index 35da37efbf..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/superframe.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# tkextlib/tcllib/superframe.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Superframe widget - enhanced labelframe widget
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget::superframe', '1.0')
-TkPackage.require('widget::superframe')
-
-module Tk::Tcllib
- module Widget
- class SuperFrame < TkWindow
- PACKAGE_NAME = 'widget::superframe'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget::superframe')
- rescue
- ''
- end
- end
- end
- Superframe = SuperlFrame
- end
-end
-
-class Tk::Tcllib::Widget::SuperFrame
- TkCommandNames = ['::widget::superframe'.freeze].freeze
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- def labelwidget
- window(tk_send('labelwidget'))
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb
deleted file mode 100644
index 97de0a27c1..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/swaplist.rb
+++ /dev/null
@@ -1,147 +0,0 @@
-#
-# tkextlib/tcllib/swaplist.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * A dialog which allows a user to move options between two lists
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('swaplist', '0.1')
-TkPackage.require('swaplist')
-
-module Tk::Tcllib
- class Swaplist_Dialog < TkWindow
- PACKAGE_NAME = 'swaplist'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('swaplist')
- rescue
- ''
- end
- end
- end
-end
-
-
-class Tk::Tcllib::Swaplist_Dialog
- TkCommandNames = ['::swaplist::swaplist'.freeze].freeze
- WidgetClassName = 'Swaplist'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.show(*args)
- dialog = self.new(*args)
- dialog.show
- [dialog.status, dialog.value]
- end
- def self.display(*args)
- self.show(*args)
- end
-
- def initialize(*args)
- # args = (parent=nil, complete_list=[], selected_list=[], keys=nil)
- keys = args.pop
- if keys.kind_of?(Hash)
- @selected_list = args.pop
- @complete_list = args.pop
- @keys = _symbolkey2str(keys)
- args.push(keys)
- else
- @selected_list = keys
- @complete_list = args.pop
- @keys = {}
- end
-
- @selected_list = [] unless @selected_list
- @complete_list = [] unless @complete_list
-
- @variable = TkVariable.new
- @status = nil
-
- super(*args)
- end
-
- def create_self(keys)
- # dummy
- end
- private :create_self
-
- def show
- @variable.value = ''
- @status = bool(tk_call(self.class::TkCommandNames[0],
- @path, @variable,
- @complete_list, @selected_list,
- *hash_kv(@keys)))
- end
- alias display show
-
- def status
- @status
- end
-
- def value
- @variable.list
- end
- alias selected value
-
- def cget(slot)
- slot = slot.to_s
- if slot == 'complete_list'
- @complete_list
- elsif slot == 'selected_list'
- @selected_list
- else
- @keys[slot]
- end
- end
-
- def configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot.each{|k, v| configure(k, v)}
- else
- slot = slot.to_s
- value = _symbolkey2str(value) if value.kind_of?(Hash)
- if value && value != None
- if slot == 'complete_list'
- @complete_list = value
- elsif slot == 'selected_list'
- @selected_list = value
- else
- @keys[slot] = value
- end
- else
- if slot == 'complete_list'
- @complete_list = []
- elsif slot == 'selected_list'
- @selected_list = []
- else
- @keys.delete(slot)
- end
- end
- end
- self
- end
-
- def configinfo(slot = nil)
- if slot
- slot = slot.to_s
- if slot == 'complete_list'
- [ slot, nil, nil, nil, @complete_list ]
- elsif slot == 'selected_list'
- [ slot, nil, nil, nil, @selected_list ]
- else
- [ slot, nil, nil, nil, @keys[slot] ]
- end
- else
- @keys.collect{|k, v| [ k, nil, nil, nil, v ] } \
- << [ 'complete_list', nil, nil, nil, @complete_list ] \
- << [ 'selected_list', nil, nil, nil, @selected_list ]
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist.rb b/ext/tk/lib/tkextlib/tcllib/tablelist.rb
deleted file mode 100644
index 42435a1971..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/tablelist.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# tkextlib/tcllib/tablelist.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * A multi-column listbox
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# check Tile extension :: If already loaded, use tablelist_tile.
-unless defined? Tk::Tcllib::Tablelist_usingTile
- Tk::Tcllib::Tablelist_usingTile = TkPackage.provide('tile')
-end
-
-if Tk::Tcllib::Tablelist_usingTile
- # with Tile
- require 'tkextlib/tcllib/tablelist_tile'
-
-else
- # without Tile
-
- # TkPackage.require('Tablelist', '4.2')
- TkPackage.require('Tablelist')
-
- requrie 'tkextlib/tcllib/tablelist_core'
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
deleted file mode 100644
index a939a58331..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
+++ /dev/null
@@ -1,770 +0,0 @@
-#
-# tkextlib/tcllib/tablelist_core.rb
-#
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * This file is required by 'tkextlib/tcllib/tablelist.rb' or
-# 'tkextlib/tcllib/tablelist_tile.rb'.
-#
-
-module Tk
- module Tcllib
- class Tablelist < TkWindow
- if Tk::Tcllib::Tablelist_usingTile
- PACKAGE_NAME = 'Tablelist_tile'.freeze
- else
- PACKAGE_NAME = 'Tablelist'.freeze
- end
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require(self.package_name)
- rescue
- ''
- end
- end
-
- def self.use_Tile?
- (Tk::Tcllib::Tablelist_usingTile)? true: false
- end
- end
- TableList = Tablelist
- end
-end
-
-module Tk::Tcllib::TablelistItemConfig
- include TkItemConfigMethod
-
- def _to_idx(idx)
- if idx.kind_of?(Array)
- idx.collect{|elem| _get_eval_string(elem)}.join(',')
- else
- idx
- end
- end
- def _from_idx(idx)
- return idx unless idx.kind_of?(String)
-
- if idx[0] == ?@ # '@x,y'
- idx
- elsif idx =~ /([^,]+),([^,]+)/
- row = $1, column = $2
- [num_or_str(row), num_or_str(column)]
- else
- num_or_str(idx)
- end
- end
- private :_to_idx, :_from_idx
-
- def __item_cget_cmd(mixed_id)
- [self.path, mixed_id[0] + 'cget', _to_idx(mixed_id[1])]
- end
- def __item_config_cmd(mixed_id)
- [self.path, mixed_id[0] + 'configure', _to_idx(mixed_id[1])]
- end
-
- def cell_cget(tagOrId, option)
- itemcget(['cell', tagOrId], option)
- end
- def cell_configure(tagOrId, slot, value=None)
- itemconfigure(['cell', tagOrId], slot, value)
- end
- def cell_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['cell', tagOrId], slot)
- end
- def current_cell_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['cell', tagOrId], slot)
- end
- alias cellcget cell_cget
- alias cellconfigure cell_configure
- alias cellconfiginfo cell_configinfo
- alias current_cellconfiginfo current_cell_configinfo
-
- def column_cget(tagOrId, option)
- itemcget(['column', tagOrId], option)
- end
- def column_configure(tagOrId, slot, value=None)
- itemconfigure(['column', tagOrId], slot, value)
- end
- def column_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['column', tagOrId], slot)
- end
- def current_column_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['column', tagOrId], slot)
- end
- alias columncget column_cget
- alias columnconfigure column_configure
- alias columnconfiginfo column_configinfo
- alias current_columnconfiginfo current_column_configinfo
-
- def row_cget(tagOrId, option)
- itemcget(['row', tagOrId], option)
- end
- def row_configure(tagOrId, slot, value=None)
- itemconfigure(['row', tagOrId], slot, value)
- end
- def row_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['row', tagOrId], slot)
- end
- def current_row_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['row', tagOrId], slot)
- end
- alias rowcget row_cget
- alias rowconfigure row_configure
- alias rowconfiginfo row_configinfo
- alias current_rowconfiginfo current_row_configinfo
-
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
-end
-
-class Tk::Tcllib::Tablelist
- include Tk::Tcllib::TablelistItemConfig
- include Scrollable
-
- TkCommandNames = ['::tablelist::tablelist'.freeze].freeze
- WidgetClassName = 'Tablelist'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def create_self(keys)
- if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
- else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
- end
- end
- private :create_self
-
- ##########################
-
- def __numval_optkeys
- super() + ['titlecolumns']
- end
- private :__numval_optkeys
-
- def __strval_optkeys
- super() + ['snipstring']
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- super() + [
- 'forceeditendcommand', 'movablecolumns', 'movablerows',
- 'protecttitlecolumns', 'resizablecolumns',
- 'showarrow', 'showlabels', 'showseparators'
- ]
- end
- private :__boolval_optkeys
-
- def __listval_optkeys
- super() + ['columns']
- end
- private :__listval_optkeys
-
- def __tkvariable_optkeys
- super() + ['listvariable']
- end
- private :__tkvariable_optkeys
-
- def __val2ruby_optkeys # { key=>proc, ... }
- # The method is used to convert a opt-value to a ruby's object.
- # When get the value of the option "key", "proc.call(value)" is called.
- super().update('stretch'=>proc{|v| (v == 'all')? v: simplelist(v)})
- end
- private :__val2ruby_optkeys
-
- def __ruby2val_optkeys # { key=>proc, ... }
- # The method is used to convert a ruby's object to a opt-value.
- # When set the value of the option "key", "proc.call(value)" is called.
- # That is, "-#{key} #{proc.call(value)}".
- super().update('stretch'=>proc{|v|
- (v.kind_of?(Array))? v.collect{|e| _to_idx(e)}: v
- })
- end
- private :__ruby2val_optkeys
-
- def __font_optkeys
- super() + ['labelfont']
- end
- private :__font_optkeys
-
- ##########################
-
- def __item_strval_optkeys(id)
- if id[0] == 'cell'
- super(id) + ['title']
- else
- super(id) - ['text'] + ['title']
- end
- end
- private :__item_strval_optkeys
-
- def __item_boolval_optkeys(id)
- super(id) + [
- 'editable', 'hide', 'resizable', 'showarrow', 'stretchable',
- ]
- end
- private :__item_boolval_optkeys
-
- def __item_listval_optkeys(id)
- if id[0] == 'cell'
- super(id)
- else
- super(id) + ['text']
- end
- end
- private :__item_listval_optkeys
-
- def __item_font_optkeys(id)
- # maybe need to override
- super(id) + ['labelfont']
- end
- private :__item_font_optkeys
-
- ##########################
-
- def activate(index)
- tk_send('activate', _to_idx(index))
- self
- end
-
- def activate_cell(index)
- tk_send('activatecell', _to_idx(index))
- self
- end
- alias activatecell activate_cell
-
- def get_attrib(name=nil)
- if name && name != None
- tk_send('attrib', name)
- else
- ret = []
- lst = simplelist(tk_send('attrib'))
- until lst.empty?
- ret << ( [lst.shift] << lst.shift )
- end
- ret
- end
- end
- def set_attrib(*args)
- tk_send('attrib', *(args.flatten))
- self
- end
-
- def bbox(index)
- list(tk_send('bbox', _to_idx(index)))
- end
-
- def bodypath
- window(tk_send('bodypath'))
- end
-
- def bodytag
- TkBindTag.new_by_name(tk_send('bodytag'))
- end
-
- def cancel_editing
- tk_send('cancelediting')
- self
- end
- alias cancelediting cancel_editing
-
- def cellindex(idx)
- _from_idx(tk_send('cellindex', _to_idx(idx)))
- end
-
- def cellselection_anchor(idx)
- tk_send('cellselection', 'anchor', _to_idx(idx))
- self
- end
-
- def cellselection_clear(first, last=nil)
- if first.kind_of?(Array)
- tk_send('cellselection', 'clear', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('cellselection', 'clear', first, last)
- end
- self
- end
-
- def cellselection_includes(idx)
- bool(tk_send('cellselection', 'includes', _to_idx(idx)))
- end
-
- def cellselection_set(first, last=nil)
- if first.kind_of?(Array)
- tk_send('cellselection', 'set', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('cellselection', 'set', first, last)
- end
- self
- end
-
- def columncount
- number(tk_send('columncount'))
- end
-
- def columnindex(idx)
- number(tk_send('columnindex', _to_idx(idx)))
- end
-
- def containing(y)
- idx = num_or_str(tk_send('containing', y))
- (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
- end
-
- def containing_cell(x, y)
- idx = _from_idx(tk_send('containingcell', x, y))
- if idx.kind_of?(Array)
- [
- ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]),
- ((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1])
- ]
- else
- idx
- end
- end
- alias containingcell containing_cell
-
- def containing_column(x)
- idx = num_or_str(tk_send('containingcolumn', x))
- (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
- end
- alias containingcolumn containing_column
-
- def curcellselection
- simplelist(tk_send('curcellselection')).collect!{|idx| _from_idx(idx)}
- end
-
- def curselection
- list(tk_send('curselection'))
- end
-
- def delete_items(first, last=nil)
- if first.kind_of?(Array)
- tk_send('delete', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('delete', first, last)
- end
- self
- end
- alias delete delete_items
- alias deleteitems delete_items
-
- def delete_columns(first, last=nil)
- if first.kind_of?(Array)
- tk_send('deletecolumns', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('deletecolumns', first, last)
- end
- self
- end
- alias deletecolumns delete_columns
-
- def edit_cell(idx)
- tk_send('editcell', _to_idx(idx))
- self
- end
- alias editcell edit_cell
-
- def editwinpath
- window(tk_send('editwinpath'))
- end
-
- def entrypath
- window(tk_send('entrypath'))
- end
-
- def fill_column(idx, txt)
- tk_send('fillcolumn', _to_idx(idx), txt)
- self
- end
- alias fillcolumn fill_column
-
- def finish_editing
- tk_send('finishediting')
- self
- end
- alias finishediting finish_editing
-
- def get(first, last=nil)
- if first.kind_of?(Array)
- simplelist(tk_send('get', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- simplelist(tk_send('get', first, last))
- end
- end
-
- def get_cells(first, last=nil)
- if first.kind_of?(Array)
- simplelist(tk_send('getcells', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- simplelist(tk_send('getcells', first, last))
- end
- end
- alias getcells get_cells
-
- def get_columns(first, last=nil)
- if first.kind_of?(Array)
- simplelist(tk_send('getcolumns', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- simplelist(tk_send('getcolumns', first, last))
- end
- end
- alias getcolumns get_columns
-
- def get_keys(first, last=nil)
- if first.kind_of?(Array)
- simplelist(tk_send('getkeys', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) }
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- simplelist(tk_send('getkeys', first, last))
- end
- end
- alias getkeys get_keys
-
- def imagelabelpath(idx)
- window(tk_send('imagelabelpath', _to_idx(idx)))
- end
-
- def index(idx)
- number(tk_send('index', _to_idx(idx)))
- end
-
- def insert(idx, *items)
- tk_send('insert', _to_idx(idx), *items)
- self
- end
-
- def insert_columnlist(idx, columnlist)
- tk_send('insertcolumnlist', _to_idx(idx), columnlist)
- self
- end
- alias insertcolumnlist insert_columnlist
-
- def insert_columns(idx, *args)
- tk_send('insertcolums', _to_idx(idx), *args)
- self
- end
- alias insertcolumns insert_columns
-
- def insert_list(idx, list)
- tk_send('insertlist', _to_idx(idx), list)
- self
- end
- alias insertlist insert_list
-
- def itemlistvar
- TkVarAccess.new(tk_send('itemlistvar'))
- end
-
- def labelpath(idx)
- window(tk_send('labelpath', _to_idx(idx)))
- end
-
- def labels
- simplelist(tk_send('labels'))
- end
-
- def move(src, target)
- tk_send('move', _to_idx(src), _to_idx(target))
- self
- end
-
- def move_column(src, target)
- tk_send('movecolumn', _to_idx(src), _to_idx(target))
- self
- end
- alias movecolumn move_column
-
- def nearest(y)
- _from_idx(tk_send('nearest', y))
- end
-
- def nearest_cell(x, y)
- _from_idx(tk_send('nearestcell', x, y))
- end
- alias nearestcell nearest_cell
-
- def nearest_column(x)
- _from_idx(tk_send('nearestcolumn', x))
- end
- alias nearestcolumn nearest_column
-
- def reject_input
- tk_send('rejectinput')
- self
- end
- alias rejectinput reject_input
-
- def reset_sortinfo
- tk_send('resetsortinfo')
- self
- end
- alias resetsortinfo reset_sortinfo
-
- def scan_mark(x, y)
- tk_send('scan', 'mark', x, y)
- self
- end
-
- def scan_dragto(x, y)
- tk_send('scan', 'dragto', x, y)
- self
- end
-
- def see(idx)
- tk_send('see', _to_idx(idx))
- self
- end
-
- def see_cell(idx)
- tk_send('seecell', _to_idx(idx))
- self
- end
- alias seecell see_cell
-
- def see_column(idx)
- tk_send('seecolumn', _to_idx(idx))
- self
- end
- alias seecolumn see_column
-
- def selection_anchor(idx)
- tk_send('selection', 'anchor', _to_idx(idx))
- self
- end
-
- def selection_clear(first, last=nil)
- if first.kind_of?(Array)
- tk_send('selection', 'clear', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('selection', 'clear', first, last)
- end
- self
- end
-
- def selection_includes(idx)
- bool(tk_send('selection', 'includes', _to_idx(idx)))
- end
-
- def selection_set(first, last=nil)
- if first.kind_of?(Array)
- tk_send('selection', 'set', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('selection', 'set', first, last)
- end
- self
- end
-
- def separatorpath(idx=nil)
- if idx
- window(tk_send('separatorpath', _to_idx(idx)))
- else
- window(tk_send('separatorpath'))
- end
- end
-
- def separators
- simplelist(tk_send('separators')).collect!{|w| window(w)}
- end
-
- def size
- number(tk_send('size'))
- end
-
- def sort(order=nil)
- if order
- order = order.to_s
- order = '-' << order if order[0] != ?-
- if order.length < 2
- order = nil
- end
- end
- if order
- tk_send('sort', order)
- else
- tk_send('sort')
- end
- self
- end
- def sort_increasing
- tk_send('sort', '-increasing')
- self
- end
- def sort_decreasing
- tk_send('sort', '-decreasing')
- self
- end
-
- DEFAULT_sortByColumn_cmd = '::tablelist::sortByColumn'
-
- def sort_by_column(idx, order=nil)
- if order
- order = order.to_s
- order = '-' << order if order[0] != ?-
- if order.length < 2
- order = nil
- end
- end
- if order
- tk_send('sortbycolumn', _to_idx(idx), order)
- else
- tk_send('sortbycolumn', _to_idx(idx))
- end
- self
- end
- def sort_by_column_increasing(idx)
- tk_send('sortbycolumn', _to_idx(idx), '-increasing')
- self
- end
- def sort_by_column_decreasing(idx)
- tk_send('sortbycolumn', _to_idx(idx), '-decreasing')
- self
- end
-
- def sortcolumn
- idx = num_or_str(tk_send('sortcolum'))
- (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
- end
-
- def sortorder
- tk_send('sortorder')
- end
-
- def toggle_visibility(first, last=nil)
- if first.kind_of?(Array)
- tk_send('togglevisibility', first.collect{|idx| _to_idx(idx)})
- else
- first = _to_idx(first)
- last = (last)? _to_idx(last): first
- tk_send('togglevisibility', first, last)
- end
- self
- end
- alias togglevisibility toggle_visibility
-
- def windowpath(idx)
- window(tk_send('windowpath', _to_idx(idx)))
- end
-end
-
-class << Tk::Tcllib::Tablelist
- ############################################################
- # helper commands
- def getTablelistPath(descendant)
- window(Tk.tk_call('::tablelist::getTablelistPath', descendant))
- end
-
- def convEventFields(descendant, x, y)
- window(Tk.tk_call('::tablelist::convEventFields', descendant, x, y))
- end
-
-
- ############################################################
- # with the BWidget package
- def addBWidgetEntry(name=None)
- Tk.tk_call('::tablelist::addBWidgetEntry', name)
- end
-
- def addBWidgetSpinBox(name=None)
- Tk.tk_call('::tablelist::addBWidgetSpinBox', name)
- end
-
- def addBWidgetComboBox(name=None)
- Tk.tk_call('::tablelist::addBWidgetComboBox', name)
- end
-
-
- ############################################################
- # with the Iwidgets ([incr Widgets]) package
- def addIncrEntryfield(name=None)
- Tk.tk_call('::tablelist::addIncrEntry', name)
- end
-
- def addIncrDateTimeWidget(type, seconds=false, name=None)
- # type := 'datefield'|'dateentry'|timefield'|'timeentry'
- if seconds && seconds != None
- seconds = '-seconds'
- else
- seconds = None
- end
- Tk.tk_call('::tablelist::addDateTimeWidget', type, seconds, name)
- end
-
- def addIncrSpinner(name=None)
- Tk.tk_call('::tablelist::addIncrSpinner', name)
- end
-
- def addIncrSpinint(name=None)
- Tk.tk_call('::tablelist::addIncrSpinint', name)
- end
-
- def addIncrCombobox(name=None)
- Tk.tk_call('::tablelist::addIncrCombobox', name)
- end
-
-
- ############################################################
- # with Bryan Oakley's combobox package
- def addOakleyCombobox(name=None)
- Tk.tk_call('::tablelist::addOakleyCombobox', name)
- end
-
- ############################################################
- # with the multi-entry package Mentry is a library extension
- def addDateMentry(format, separator, gmt=false, name=None)
- if gmt && gmt != None
- gmt = '-gmt'
- else
- gmt = None
- end
- Tk.tk_call('::tablelist::addDateMentry', format, separator, gmt, name)
- end
-
- def addTimeMentry(format, separator, gmt=false, name=None)
- if gmt && gmt != None
- gmt = '-gmt'
- else
- gmt = None
- end
- Tk.tk_call('::tablelist::addTimeMentry', format, separator, gmt, name)
- end
-
- def addFixedPointMentry(count1, count2, comma=false, name=None)
- if comma && comma != None
- comma = '-comma'
- else
- comma = None
- end
- Tk.tk_call('::tablelist::addFixedPoingMentry', count1, count2, comma, name)
- end
-
- def addIPAddrMentry(name=None)
- Tk.tk_call('::tablelist::addIPAddrMentry', name)
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
deleted file mode 100644
index 0cb4eb735d..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# tkextlib/tcllib/tablelist_tlie.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * A multi-column listbox
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('tablelist_tile', '4.2')
-TkPackage.require('Tablelist_tile')
-
-unless defined? Tk::Tcllib::Tablelist_usingTile
- Tk::Tcllib::Tablelist_usingTile = true
-end
-
-requrie 'tkextlib/tcllib/tablelist_core'
-
-module Tk
- module Tcllib
- Tablelist_Tile = Tablelist
- TableList_Tile = Tablelist
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
index 92dde65ce7..4e6008bb3b 100644
--- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
@@ -21,11 +21,6 @@ module Tk
end
module Tk::Tcllib::Tkpiechart
- PACKAGE_NAME = 'tkpiechart'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('tkpiechart')
@@ -56,22 +51,6 @@ module Tk::Tcllib::Tkpiechart
:default_value=>1, :current_value=>2}
end
private :__configinfo_struct
-
- def __boolval_optkeys
- super() << 'select' << 'autoupdate' << 'selectable'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'bordercolor' << 'textbackground' <<
- 'widestvaluetext' << 'title'
- end
- private :__strval_optkeys
-
- def __listval_optkeys
- super() << 'colors'
- end
- private :__listval_optkeys
end
####################################
diff --git a/ext/tk/lib/tkextlib/tcllib/tooltip.rb b/ext/tk/lib/tkextlib/tcllib/tooltip.rb
deleted file mode 100644
index 4301b39fd3..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/tooltip.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# tkextlib/tcllib/tooltip.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * Provides tooltips, a small text message that is displayed when the
-# mouse hovers over a widget.
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('tooltip', '1.1')
-TkPackage.require('tooltip')
-
-module Tk::Tcllib
- module Tooltip
- PACKAGE_NAME = 'tooltip'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('tooltip')
- rescue
- ''
- end
- end
- end
-end
-
-module Tk::Tcllib::Tooltip
- extend TkCore
-
- WidgetClassName = 'Tooltip'.freeze
- def self.database_classname
- self::WidgetClassName
- end
- def self.database_class
- WidgetClassNames[self::WidgetClassName]
- end
-
- def self.clear(glob_path_pat = None)
- self.clear_glob(glob_path_pat)
- end
-
- def self.clear_glob(glob_path_pat)
- tk_call_without_enc('::tooltip::tooltip', 'clear', glob_path_pat)
- end
-
- def self.clear_widgets(*args)
- self.clear_glob("{#{args.collect{|w| _get_eval_string(w)}.join(',')}}")
- end
-
- def self.clear_children(*args)
- self.clear_glob("{#{args.collect{|w| s = _get_eval_string(w); "#{s},#{s}.*"}.join(',')}}")
- end
-
- def self.delay(millisecs=None)
- number(tk_call_without_enc('::tooltip::tooltip', 'delay', millisecs))
- end
- def self.delay=(millisecs)
- self.delay(millisecs)
- end
-
- def self.disable
- tk_call_without_enc('::tooltip::tooltip', 'disable')
- false
- end
- def self.off
- self.disable
- end
-
- def self.enable
- tk_call_without_enc('::tooltip::tooltip', 'enable')
- true
- end
- def self.on
- self.enable
- end
-
- def self.register(widget, msg, keys=nil)
- if keys.kind_of?(Hash)
- args = hash_kv(keys) << msg
- else
- args = msg
- end
- tk_call_without_enc('::tooltip::tooltip', widget.path, *args)
- end
-
- def self.erase(widget)
- tk_call_without_enc('::tooltip::tooltip', widget.path, '')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tcllib/widget.rb b/ext/tk/lib/tkextlib/tcllib/widget.rb
deleted file mode 100644
index ed69f67ce6..0000000000
--- a/ext/tk/lib/tkextlib/tcllib/widget.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# tkextlib/tcllib/widget.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-# * Part of tcllib extension
-# * megawidget package that uses snit as the object system (snidgets)
-#
-
-require 'tk'
-require 'tkextlib/tcllib.rb'
-
-# TkPackage.require('widget', '3.0')
-TkPackage.require('widget')
-
-module Tk::Tcllib
- module Widget
- PACKAGE_NAME = 'widget'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('widget')
- rescue
- ''
- end
- end
- end
-end
-
-module Tk::Tcllib::Widget
- autoload :Dialog, 'tkextlib/tcllib/dialog'
-
- autoload :Panelframe, 'tkextlib/tcllib/panelframe'
- autoload :PanelFrame, 'tkextlib/tcllib/panelframe'
-
- autoload :Ruler, 'tkextlib/tcllib/ruler'
-
- autoload :Screenruler, 'tkextlib/tcllib/screenruler'
- autoload :ScreenRuler, 'tkextlib/tcllib/screenruler'
-
- autoload :Scrolledwindow, 'tkextlib/tcllib/scrollwin'
- autoload :ScrolledWindow, 'tkextlib/tcllib/scrollwin'
-
- autoload :Superframe, 'tkextlib/tcllib/superframe'
- autoload :SuperFrame, 'tkextlib/tcllib/superframe'
-end
diff --git a/ext/tk/lib/tkextlib/tclx/tclx.rb b/ext/tk/lib/tkextlib/tclx/tclx.rb
index 5a908fcd0b..760ebd92b1 100644
--- a/ext/tk/lib/tkextlib/tclx/tclx.rb
+++ b/ext/tk/lib/tkextlib/tclx/tclx.rb
@@ -15,11 +15,6 @@ TkPackage.require('Tclx')
module Tk
module TclX
- PACKAGE_NAME = 'Tclx'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Tclx')
@@ -32,16 +27,6 @@ module Tk
Tk.tk_call('infox', *args)
end
- def self.signal(*args)
- warn("Warning: Don't recommend to use TclX's 'signal' command. Please use Ruby's 'Signal.trap' method")
- Tk.tk_call('signal', *args)
- end
-
- def self.signal_restart(*args)
- warn("Warning: Don't recommend to use TclX's 'signal' command. Please use Ruby's 'Signal.trap' method")
- Tk.tk_call('signal', '-restart', *args)
- end
-
##############################
class XPG3_MsgCat
diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb
index 690f93f029..80a9083694 100644
--- a/ext/tk/lib/tkextlib/tile.rb
+++ b/ext/tk/lib/tkextlib/tile.rb
@@ -13,49 +13,13 @@ require 'tkextlib/tile/setup.rb'
# load package
# TkPackage.require('tile', '0.4')
-# TkPackage.require('tile', '0.6')
-# TkPackage.require('tile', '0.7')
-verstr = TkPackage.require('tile')
-ver = verstr.split('.')
-if ver[0].to_i == 0 && ver[1].to_i <= 4
- # version 0.4 or former
- module Tk
- module Tile
- USE_TILE_NAMESPACE = true
- USE_TTK_NAMESPACE = false
- TILE_SPEC_VERSION_ID = 0
- end
- end
-elsif ver[0].to_i == 0 && ver[1].to_i <= 6
- # version 0.5 -- version 0.6
- module Tk
- module Tile
- USE_TILE_NAMESPACE = true
- USE_TTK_NAMESPACE = true
- TILE_SPEC_VERSION_ID = 5
- end
- end
-else
- # version 0.7 or later
- module Tk
- module Tile
- USE_TILE_NAMESPACE = false
- USE_TTK_NAMESPACE = true
- TILE_SPEC_VERSION_ID = 7
- end
- end
-end
+TkPackage.require('tile')
# autoload
module Tk
module Tile
TkComm::TkExtlibAutoloadModule.unshift(self)
- PACKAGE_NAME = 'tile'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('tile')
@@ -64,83 +28,7 @@ module Tk
end
end
- def self.__Import_Tile_Widgets__!
- Tk.tk_call('namespace', 'import', '-force', 'ttk::*')
- end
-
- def self.load_images(imgdir, pat=TkComm::None)
- images = Hash[*TkComm.simplelist(Tk.tk_call('::tile::LoadImages',
- imgdir, pat))]
- images.keys.each{|k|
- images[k] = TkPhotoImage.new(:imagename=>images[k],
- :without_creating=>true)
- }
-
- images
- end
-
- def self.style(*args)
- args.map!{|arg| TkComm._get_eval_string(arg)}.join('.')
- end
-
- module KeyNav
- def self.enableMnemonics(w)
- Tk.tk_call('::keynav::enableMnemonics', w)
- end
- def self.defaultButton(w)
- Tk.tk_call('::keynav::defaultButton', w)
- end
- end
-
- module Font
- Default = 'TkDefaultFont'
- Text = 'TkTextFont'
- Heading = 'TkHeadingFont'
- Caption = 'TkCaptionFont'
- Tooltip = 'TkTooltipFont'
-
- Fixed = 'TkFixedFont'
- Menu = 'TkMenuFont'
- SmallCaption = 'TkSmallCaptionFont'
- Icon = 'TkIconFont'
- end
-
- module ParseStyleLayout
- def _style_layout(lst)
- ret = []
- until lst.empty?
- sub = [lst.shift]
- keys = {}
-
- until lst.empty?
- if lst[0][0] == ?-
- k = lst.shift[1..-1]
- children = lst.shift
- children = _style_layout(children) if children.kind_of?(Array)
- keys[k] = children
- else
- break
- end
- end
-
- sub << keys unless keys.empty?
- ret << sub
- end
- ret
- end
- private :_style_layout
- end
-
module TileWidget
- include Tk::Tile::ParseStyleLayout
-
- def __val2ruby_optkeys # { key=>proc, ... }
- # The method is used to convert a opt-value to a ruby's object.
- # When get the value of the option "key", "proc.call(value)" is called.
- super().update('style'=>proc{|v| _style_layout(list(v))})
- end
- private :__val2ruby_optkeys
-
def instate(state, script=nil, &b)
if script
tk_send('instate', state, script)
@@ -163,62 +51,18 @@ module Tk
######################################
autoload :TButton, 'tkextlib/tile/tbutton'
- autoload :Button, 'tkextlib/tile/tbutton'
autoload :TCheckButton, 'tkextlib/tile/tcheckbutton'
- autoload :CheckButton, 'tkextlib/tile/tcheckbutton'
autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton'
- autoload :Checkbutton, 'tkextlib/tile/tcheckbutton'
-
- autoload :Dialog, 'tkextlib/tile/dialog'
-
- autoload :TEntry, 'tkextlib/tile/tentry'
- autoload :Entry, 'tkextlib/tile/tentry'
-
- autoload :TCombobox, 'tkextlib/tile/tcombobox'
- autoload :Combobox, 'tkextlib/tile/tcombobox'
-
- autoload :TFrame, 'tkextlib/tile/tframe'
- autoload :Frame, 'tkextlib/tile/tframe'
-
- autoload :TLabelframe, 'tkextlib/tile/tlabelframe'
- autoload :Labelframe, 'tkextlib/tile/tlabelframe'
autoload :TLabel, 'tkextlib/tile/tlabel'
- autoload :Label, 'tkextlib/tile/tlabel'
autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
- autoload :Menubutton, 'tkextlib/tile/tmenubutton'
autoload :TNotebook, 'tkextlib/tile/tnotebook'
- autoload :Notebook, 'tkextlib/tile/tnotebook'
-
- autoload :TPaned, 'tkextlib/tile/tpaned'
- autoload :Paned, 'tkextlib/tile/tpaned'
-
- autoload :TProgressbar, 'tkextlib/tile/tprogressbar'
- autoload :Progressbar, 'tkextlib/tile/tprogressbar'
autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
- autoload :RadioButton, 'tkextlib/tile/tradiobutton'
autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
- autoload :Radiobutton, 'tkextlib/tile/tradiobutton'
-
- autoload :TScale, 'tkextlib/tile/tscale'
- autoload :Scale, 'tkextlib/tile/tscale'
- autoload :TProgress, 'tkextlib/tile/tscale'
- autoload :Progress, 'tkextlib/tile/tscale'
-
- autoload :TScrollbar, 'tkextlib/tile/tscrollbar'
- autoload :Scrollbar, 'tkextlib/tile/tscrollbar'
-
- autoload :TSeparator, 'tkextlib/tile/tseparator'
- autoload :Separator, 'tkextlib/tile/tseparator'
-
- autoload :TSquare, 'tkextlib/tile/tsquare'
- autoload :Square, 'tkextlib/tile/tsquare'
-
- autoload :Treeview, 'tkextlib/tile/treeview'
autoload :Style, 'tkextlib/tile/style'
end
diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb
deleted file mode 100644
index f8ddf62598..0000000000
--- a/ext/tk/lib/tkextlib/tile/dialog.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# ttk::dialog (tile-0.7+)
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class Dialog < TkWindow
- end
- end
-end
-
-class Tk::Tile::Dialog
- TkCommandNames = ['::ttk::dialog'.freeze].freeze
-
- def self.show(*args)
- dialog = self.new(*args)
- dialog.show
- [dialog.status, dialog.value]
- end
- def self.display(*args)
- self.show(*args)
- end
-
- def self.define_dialog_type(name, keys)
- Tk.tk_call('::ttk::dialog::define', name, keys)
- name
- end
-
- def self.style(*args)
- ['Dialog', *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-
- #########################
-
- def initialize(keys={})
- @keys = _symbolkey2str(keys)
- super(*args)
- end
-
- def create_self(keys)
- # dummy
- end
- private :create_self
-
- def show
- tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))
- end
- alias display show
-
- def client_frame
- window(tk_call_without_enc('::ttk::dialog::clientframe'))
- end
-
- def cget(slot)
- @keys[slot]
- end
-
- def configure(slot, value=None)
- if slot.kind_of?(Hash)
- slot.each{|k, v| configure(k, v)}
- else
- slot = slot.to_s
- value = _symbolkey2str(value) if value.kind_of?(Hash)
- if value && value != None
- @keys[slot] = value
- else
- @keys.delete(slot)
- end
- end
- self
- end
-
- def configinfo(slot = nil)
- if slot
- slot = slot.to_s
- [ slot, nil, nil, nil, @keys[slot] ]
- else
- @keys.collect{|k, v| [ k, nil, nil, nil, v ] }
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index 485a36d7d6..c8c0a802df 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -17,34 +17,15 @@ module Tk::Tile::Style
end
class << Tk::Tile::Style
- def configure(style=nil, keys=nil)
- if style.kind_of?(Hash)
- keys = style
- style = nil
- end
- style = '.' unless style
-
- if Tk::Tile::TILE_SPEC_VERSION_ID < 7
- sub_cmd = 'default'
- else
- sub_cmd = 'configure'
- end
-
+ def default(style, keys=nil)
if keys && keys != None
- tk_call('style', sub_cmd, style, *hash_kv(keys))
+ tk_call('style', 'default', style, *hash_kv(keys))
else
- tk_call('style', sub_cmd, style)
+ tk_call('style', 'default', style)
end
end
- alias default configure
-
- def map(style=nil, keys=nil)
- if style.kind_of?(Hash)
- keys = style
- style = nil
- end
- style = '.' unless style
+ def map(style, keys=nil)
if keys && keys != None
tk_call('style', 'map', style, *hash_kv(keys))
else
@@ -52,19 +33,11 @@ class << Tk::Tile::Style
end
end
- include Tk::Tile::ParseStyleLayout
-
- def layout(style=nil, spec=nil)
- if style.kind_of?(Hash)
- spec = style
- style = nil
- end
- style = '.' unless style
-
+ def layout(style, spec=nil)
if spec
tk_call('style', 'layout', style, spec)
else
- _style_layout(list(tk_call('style', 'layout', style)))
+ tk_call('style', 'layout', style)
end
end
@@ -76,15 +49,11 @@ class << Tk::Tile::Style
list(tk_call('style', 'element', 'names'))
end
- def element_options(elem)
- simplelist(tk_call('style', 'element', 'options', elem))
- end
-
def theme_create(name, keys=nil)
if keys && keys != None
- tk_call('style', 'theme', 'create', name, *hash_kv(keys))
+ tk_call('style', 'theme', 'create', name, type, *hash_kv(keys))
else
- tk_call('style', 'theme', 'create', name)
+ tk_call('style', 'theme', 'create', name, type)
end
end
diff --git a/ext/tk/lib/tkextlib/tile/tbutton.rb b/ext/tk/lib/tkextlib/tile/tbutton.rb
index 1142a27100..b5c3475692 100644
--- a/ext/tk/lib/tkextlib/tile/tbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -9,22 +9,22 @@ module Tk
module Tile
class TButton < TkButton
end
- Button = TButton
end
end
class Tk::Tile::TButton < TkButton
include Tk::Tile::TileWidget
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::button'.freeze].freeze
- else
- TkCommandNames = ['::tbutton'.freeze].freeze
- end
+ TkCommandNames = ['tbutton'.freeze].freeze
WidgetClassName = 'TButton'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tbutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tbutton', @path)
+ end
end
+ private :create_self
end
diff --git a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
index fce799683d..4ba77d95d3 100644
--- a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -10,23 +10,22 @@ module Tk
class TCheckButton < TkCheckButton
end
TCheckbutton = TCheckButton
- CheckButton = TCheckButton
- Checkbutton = TCheckButton
end
end
class Tk::Tile::TCheckButton < TkCheckButton
include Tk::Tile::TileWidget
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::checkbutton'.freeze].freeze
- else
- TkCommandNames = ['::tcheckbutton'.freeze].freeze
- end
+ TkCommandNames = ['tcheckbutton'.freeze].freeze
WidgetClassName = 'TCheckbutton'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tcheckbutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tcheckbutton', @path)
+ end
end
+ private :create_self
end
diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb
deleted file mode 100644
index c63ab94dbe..0000000000
--- a/ext/tk/lib/tkextlib/tile/tcombobox.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# tcombobox widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TCombobox < Tk::Tile::TEntry
- end
- Combobox = TCombobox
- end
-end
-
-class Tk::Tile::TCombobox < Tk::Tile::TEntry
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::combobox'.freeze].freeze
- else
- TkCommandNames = ['::tcombobox'.freeze].freeze
- end
- WidgetClassName = 'TCombobox'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def __boolval_optkeys
- super() << 'exportselection'
- end
- private :__boolval_optkeys
-
- def __listval_optkeys
- super() << 'values'
- end
- private :__listval_optkeys
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-
- def current
- number(tk_send_without_enc('current', idx))
- end
- def current=(idx)
- tk_send_without_enc('current', idx)
- end
-
- def identify(x, y)
- tk_send_without_enc('identify', x, y)
- end
-
- def set(val)
- tk_send('set', val)
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb
deleted file mode 100644
index 4d57ce7756..0000000000
--- a/ext/tk/lib/tkextlib/tile/tentry.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# tentry widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TEntry < TkEntry
- end
- Entry = TEntry
- end
-end
-
-class Tk::Tile::TEntry < TkEntry
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::entry'.freeze].freeze
- else
- TkCommandNames = ['::tentry'.freeze].freeze
- end
- WidgetClassName = 'TEntry'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def __boolval_optkeys
- super() << 'exportselection'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'show'
- end
- private :__strval_optkeys
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tframe.rb b/ext/tk/lib/tkextlib/tile/tframe.rb
deleted file mode 100644
index 691c9c42af..0000000000
--- a/ext/tk/lib/tkextlib/tile/tframe.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# tframe widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TFrame < TkFrame
- end
- Frame = TFrame
- end
-end
-
-class Tk::Tile::TFrame < TkFrame
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::frame'.freeze].freeze
- else
- TkCommandNames = ['::tframe'.freeze].freeze
- end
- WidgetClassName = 'TFrame'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tlabel.rb b/ext/tk/lib/tkextlib/tile/tlabel.rb
index 4111d1906a..d2eaf45273 100644
--- a/ext/tk/lib/tkextlib/tile/tlabel.rb
+++ b/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -9,22 +9,22 @@ module Tk
module Tile
class TLabel < TkLabel
end
- Label = TLabel
end
end
class Tk::Tile::TLabel < TkLabel
include Tk::Tile::TileWidget
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::label'.freeze].freeze
- else
- TkCommandNames = ['::tlabel'.freeze].freeze
- end
+ TkCommandNames = ['tlabel'.freeze].freeze
WidgetClassName = 'TLabel'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tlabel', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tlabel', @path)
+ end
end
+ private :create_self
end
diff --git a/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ext/tk/lib/tkextlib/tile/tlabelframe.rb
deleted file mode 100644
index 8981232b25..0000000000
--- a/ext/tk/lib/tkextlib/tile/tlabelframe.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# tlabelframe widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TLabelframe < Tk::Tile::TFrame
- end
- Labelframe = TLabelframe
- end
-end
-
-class Tk::Tile::TLabelframe < Tk::Tile::TFrame
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::labelframe'.freeze].freeze
- else
- TkCommandNames = ['::tlabelframe'.freeze].freeze
- end
- WidgetClassName = 'TLabelframe'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
index 4b81fa1c81..332db2b74e 100644
--- a/ext/tk/lib/tkextlib/tile/tmenubutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -9,22 +9,22 @@ module Tk
module Tile
class TMenubutton < TkMenubutton
end
- Menubutton = TMenubutton
end
end
class Tk::Tile::TMenubutton < TkMenubutton
include Tk::Tile::TileWidget
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::menubutton'.freeze].freeze
- else
- TkCommandNames = ['::tmenubutton'.freeze].freeze
- end
+ TkCommandNames = ['tmenubutton'.freeze].freeze
WidgetClassName = 'TMenubutton'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tmenubutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tmenubutton', @path)
+ end
end
+ private :create_self
end
diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
index abaed8ee9c..c693d5ce2b 100644
--- a/ext/tk/lib/tkextlib/tile/tnotebook.rb
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -9,7 +9,6 @@ module Tk
module Tile
class TNotebook < TkWindow
end
- Notebook = TNotebook
end
end
@@ -18,15 +17,16 @@ class Tk::Tile::TNotebook < TkWindow
include TkItemConfigMethod
def __item_cget_cmd(id)
- [self.path, 'tab', id]
+ [self.path, 'tabcget', id]
end
private :__item_cget_cmd
def __item_config_cmd(id)
- [self.path, 'tab', id]
+ [self.path, 'tabconfigure', id]
end
private :__item_config_cmd
+
def __item_listval_optkeys
[]
end
@@ -37,38 +37,29 @@ class Tk::Tile::TNotebook < TkWindow
end
private :__item_listval_optkeys
- #alias tabcget itemcget
+ alias tabcget itemcget
alias tabconfigure itemconfigure
alias tabconfiginfo itemconfiginfo
alias current_tabconfiginfo current_itemconfiginfo
-
- def tabcget(tagOrId, option)
- tabconfigure(tagOrId, option)[-1]
- end
################################
include Tk::Tile::TileWidget
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::notebook'.freeze].freeze
- else
- TkCommandNames = ['::tnotebook'.freeze].freeze
- end
+ TkCommandNames = ['tnotebook'.freeze].freeze
WidgetClassName = 'TNotebook'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tnotebook', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tnotebook', @path)
+ end
end
+ private :create_self
def enable_traversal()
- if Tk::Tile::TILE_SPEC_VERSION_ID < 5
- tk_call_without_enc('::tile::enableNotebookTraversal', @path)
- elsif Tk::Tile::TILE_SPEC_VERSION_ID < 7
- tk_call_without_enc('::tile::notebook::enableTraversal', @path)
- else
- tk_call_without_enc('::ttk::notebook::enableTraversal', @path)
- end
+ tk_call_without_end('tile::enableNotebookTraversal', @path)
self
end
@@ -90,15 +81,6 @@ class Tk::Tile::TNotebook < TkWindow
number(tk_send('index', idx))
end
- def insert(idx, subwin, keys=nil)
- if keys && keys != None
- tk_send('insert', idx, subwin, *hash_kv(keys))
- else
- tk_send('insert', idx, subwin)
- end
- self
- end
-
def select(idx)
tk_send('select', idx)
self
diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb
deleted file mode 100644
index 11178b19d3..0000000000
--- a/ext/tk/lib/tkextlib/tile/tpaned.rb
+++ /dev/null
@@ -1,188 +0,0 @@
-#
-# tpaned widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TPaned < TkWindow
- end
- Paned = TPaned
- end
-end
-
-class Tk::Tile::TPaned < TkWindow
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::paned'.freeze].freeze
- else
- TkCommandNames = ['::tpaned'.freeze].freeze
- end
- WidgetClassName = 'TPaned'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-
- def add(win, keys)
- win = _epath(win)
- tk_send_without_enc('add', win, *hash_kv(keys))
- self
- end
-
- def forget(pane)
- pane = _epath(pane)
- tk_send_without_enc('forget', pane)
- self
- end
-
- def insert(pos, win, keys)
- win = _epath(win)
- tk_send_without_enc('insert', pos, win, *hash_kv(keys))
- self
- end
-
- def panecget(pane, slot)
- pane = _epath(pane)
- tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}"))
- end
- alias pane_cget panecget
-
- def paneconfigure(pane, key, value=nil)
- pane = _epath(pane)
- if key.kind_of? Hash
- params = []
- key.each{|k, v|
- params.push("-#{k}")
- # params.push((v.kind_of?(TkObject))? v.epath: v)
- params.push(_epath(v))
- }
- tk_send_without_enc('pane', pane, *params)
- else
- # value = value.epath if value.kind_of?(TkObject)
- value = _epath(value)
- tk_send_without_enc('pane', pane, "-#{key}", value)
- end
- self
- end
- alias pane_config paneconfigure
- alias pane_configure paneconfigure
-
- def paneconfiginfo(win)
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- win = _epath(win)
- if key
- conf = tk_split_list(tk_send_without_enc('pane', win, "-#{key}"))
- conf[0] = conf[0][1..-1]
- if conf[0] == 'hide'
- conf[3] = bool(conf[3]) unless conf[3].empty?
- conf[4] = bool(conf[4]) unless conf[4].empty?
- end
- conf
- else
- tk_split_simplelist(tk_send_without_enc('pane',
- win)).collect{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[0] = conf[0][1..-1]
- if conf[3]
- if conf[0] == 'hide'
- conf[3] = bool(conf[3]) unless conf[3].empty?
- elsif conf[3].index('{')
- conf[3] = tk_split_list(conf[3])
- else
- conf[3] = tk_tcl2ruby(conf[3])
- end
- end
- if conf[4]
- if conf[0] == 'hide'
- conf[4] = bool(conf[4]) unless conf[4].empty?
- elsif conf[4].index('{')
- conf[4] = tk_split_list(conf[4])
- else
- conf[4] = tk_tcl2ruby(conf[4])
- end
- end
- conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
- conf
- }
- end
- else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- win = _epath(win)
- if key
- conf = tk_split_list(tk_send_without_enc('pane', win, "-#{key}"))
- key = conf.shift[1..-1]
- if key == 'hide'
- conf[2] = bool(conf[2]) unless conf[2].empty?
- conf[3] = bool(conf[3]) unless conf[3].empty?
- end
- { key => conf }
- else
- ret = {}
- tk_split_simplelist(tk_send_without_enc('pane',
- win)).each{|conflist|
- conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- if key
- if key == 'hide'
- conf[2] = bool(conf[2]) unless conf[2].empty?
- elsif conf[2].index('{')
- conf[2] = tk_split_list(conf[2])
- else
- conf[2] = tk_tcl2ruby(conf[2])
- end
- end
- if conf[3]
- if key == 'hide'
- conf[3] = bool(conf[3]) unless conf[3].empty?
- elsif conf[3].index('{')
- conf[3] = tk_split_list(conf[3])
- else
- conf[3] = tk_tcl2ruby(conf[3])
- end
- end
- if conf.size == 1
- ret[key] = conf[0][1..-1] # alias info
- else
- ret[key] = conf
- end
- }
- ret
- end
- end
- end
- alias pane_configinfo paneconfiginfo
-
- def current_paneconfiginfo(win, key=nil)
- if TkComm::GET_CONFIGINFO_AS_ARRAY
- if key
- conf = paneconfiginfo(win, key)
- {conf[0] => conf[4]}
- else
- ret = {}
- paneconfiginfo(win).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
- end
- else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- ret = {}
- paneconfiginfo(win, key).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
- }
- ret
- end
- end
- alias current_pane_configinfo current_paneconfiginfo
-
- def identify(x, y)
- list(tk_send_without_enc('identify', x, y))
- end
-
- def sashpos(idx, newpos=None)
- num_or_str(tk_send_without_enc('sashpos', idx, newpos))
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ext/tk/lib/tkextlib/tile/tprogressbar.rb
deleted file mode 100644
index 36c1c75c23..0000000000
--- a/ext/tk/lib/tkextlib/tile/tprogressbar.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# tprogressbar widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TProgressbar < TkWindow
- end
- Progressbar = TProgressbar
- end
-end
-
-class Tk::Tile::TProgressbar
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::progressbar'.freeze].freeze
- else
- TkCommandNames = ['::tprogressbar'.freeze].freeze
- end
- WidgetClassName = 'TProgressbar'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-
- def step(amount=None)
- tk_send_without_enc('step', amount).to_f
- end
- #def step=(amount)
- # tk_send_without_enc('step', amount)
- #end
-
- def start(interval=None)
- if Tk::Tile::TILE_SPEC_VERSION_ID < 5
- tk_call_without_enc('::tile::progressbar::start', @path, interval)
- else
- tk_send_without_enc('start', interval)
- end
- end
-
- def stop(amount=None)
- if Tk::Tile::TILE_SPEC_VERSION_ID < 5
- tk_call_without_enc('::tile::progressbar::stop', @path)
- else
- tk_send_without_enc('stop', amount)
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
index e2f614cb97..66cba62960 100644
--- a/ext/tk/lib/tkextlib/tile/tradiobutton.rb
+++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -10,23 +10,22 @@ module Tk
class TRadioButton < TkRadioButton
end
TRadiobutton = TRadioButton
- RadioButton = TRadioButton
- Radiobutton = TRadioButton
end
end
class Tk::Tile::TRadioButton < TkRadioButton
include Tk::Tile::TileWidget
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::radiobutton'.freeze].freeze
- else
- TkCommandNames = ['::tradiobutton'.freeze].freeze
- end
+ TkCommandNames = ['tradiobutton'.freeze].freeze
WidgetClassName = 'TRadiobutton'.freeze
WidgetClassNames[WidgetClassName] = self
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tradiobutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tradiobutton', @path)
+ end
end
+ private :create_self
end
diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb
deleted file mode 100644
index d3ffbbfa6b..0000000000
--- a/ext/tk/lib/tkextlib/tile/treeview.rb
+++ /dev/null
@@ -1,280 +0,0 @@
-#
-# treeview widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class Treeview < TkWindow
- end
-
- module TreeviewConfig
- include TkItemConfigMethod
-
- def __item_cget_cmd(id)
- [self.path, id[0], id[1]]
- end
- private :__item_cget_cmd
-
- def __item_config_cmd(id)
- [self.path, id[0], id[1]]
- end
- private :__item_config_cmd
-
- def __item_numstrval_optkeys(id)
- case id[0]
- when :item, 'item'
- ['width']
- when :column, 'column'
- super(id[1])
- when :heading, 'heading'
- super(id[1])
- end
- end
- private :__item_numstrval_optkeys
-
- def __item_strval_optkeys(id)
- case id[0]
- when :item, 'item'
- super(id) + ['id']
- when :column, 'column'
- super(id[1])
- when :heading, 'heading'
- super(id[1])
- end
- end
- private :__item_strval_optkeys
-
- def __item_boolval_optkeys(id)
- case id[0]
- when :item, 'item'
- ['open']
- when :column, 'column'
- super(id[1])
- when :heading, 'heading'
- super(id[1])
- end
- end
- private :__item_boolval_optkeys
-
- def __item_listval_optkeys(id)
- case id[0]
- when :item, 'item'
- ['values']
- when :column, 'column'
- []
- when :heading, 'heading'
- []
- end
- end
- private :__item_listval_optkeys
-
- alias __itemcget itemcget
- alias __itemconfigure itemconfigure
- alias __itemconfiginfo itemconfiginfo
- alias __current_itemconfiginfo current_itemconfiginfo
-
- private :__itemcget, :__itemconfigure
- private :__itemconfiginfo, :__current_itemconfiginfo
-
- # Treeview Item
- def itemcget(tagOrId, option)
- __itemcget([:item, tagOrId], option)
- end
- def itemconfigure(tagOrId, slot, value=None)
- __itemconfigure([:item, tagOrId], slot, value)
- end
- def itemconfiginfo(tagOrId, slot=nil)
- __itemconfiginfo([:item, tagOrId], slot)
- end
- def current_itemconfiginfo(tagOrId, slot=nil)
- __current_itemconfiginfo([:item, tagOrId], slot)
- end
-
- # Treeview Column
- def columncget(tagOrId, option)
- __itemcget([:column, tagOrId], option)
- end
- def columnconfigure(tagOrId, slot, value=None)
- __itemconfigure([:column, tagOrId], slot, value)
- end
- def columnconfiginfo(tagOrId, slot=nil)
- __itemconfiginfo([:column, tagOrId], slot)
- end
- def current_columnconfiginfo(tagOrId, slot=nil)
- __current_itemconfiginfo([:column, tagOrId], slot)
- end
- alias column_cget columncget
- alias column_configure columnconfigure
- alias column_configinfo columnconfiginfo
- alias current_column_configinfo current_columnconfiginfo
-
- # Treeview Heading
- def headingcget(tagOrId, option)
- __itemcget([:heading, tagOrId], option)
- end
- def headingconfigure(tagOrId, slot, value=None)
- __itemconfigure([:heading, tagOrId], slot, value)
- end
- def headingconfiginfo(tagOrId, slot=nil)
- __itemconfiginfo([:heading, tagOrId], slot)
- end
- def current_headingconfiginfo(tagOrId, slot=nil)
- __current_itemconfiginfo([:heading, tagOrId], slot)
- end
- alias heading_cget headingcget
- alias heading_configure headingconfigure
- alias heading_configinfo headingconfiginfo
- alias current_heading_configinfo current_headingconfiginfo
- end
- end
-end
-
-class Tk::Tile::Treeview < TkWindow
- include Tk::Tile::TileWidget
- include Scrollable
-
- include Tk::Tile::TreeviewConfig
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::treeview'.freeze].freeze
- else
- TkCommandNames = ['::treeview'.freeze].freeze
- end
- WidgetClassName = 'Treeview'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-
- def tagid(id)
- if id.kind_of?(Array)
- [id[0], _get_eval_string(id[1])]
- else
- _get_eval_string(id)
- end
- end
-
- def children(item)
- simplelist(tk_send_without_enc('children', item))
- end
- def set_children(item, *items)
- tk_send_without_enc('children', item,
- array2tk_list(items.flatten, true))
- self
- end
-
- def delete(*items)
- tk_send_without_enc('delete', array2tk_list(items.flatten, true))
- self
- end
-
- def detach(*items)
- tk_send_without_enc('detach', array2tk_list(items.flatten, true))
- self
- end
-
- def exist?(item)
- bool(tk_send_without_enc('exists', _get_eval_enc_str(item)))
- end
-
- def focus_item(item = None)
- tk_send('focus', item)
- end
-
- def identify(x, y)
- ret = simplelist(tk_send('identify', x, y))
- case ret[0]
- when 'heading', 'separator', 'cell'
- ret[-1] = num_or_str(ret[-1])
- end
- end
-
- def index(item)
- number(tk_send('index', item))
- end
-
- def insert(parent, idx, keys={})
- keys = _symbolkey2str(keys)
- id = keys.delete('id')
- if id
- tk_send('insert', parent, idx, '-id', id, *hash_kv(keys))
- else
- tk_send('insert', parent, idx, *hash_kv(keys))
- end
- self
- end
-
- def instate(spec, cmd=Proc.new)
- tk_send('instate', spec, cmd)
- end
- def state(spec=None)
- tk_send('state', spec)
- end
-
- def move(item, parent, idx)
- tk_send('move', item, parent, idx)
- self
- end
-
- def next(item)
- tk_send('next', item)
- end
-
- def parent(item)
- tk_send('parent', item)
- end
-
- def prev(item)
- tk_send('prev', item)
- end
-
- def see(item)
- tk_send('see', item)
- self
- end
-
- def selection
- simplelist(tk_send('selection'))
- end
- alias selection_get selection
-
- def selection_add(*items)
- tk_send('selection', 'add', array2tk_list(items.flatten, true))
- self
- end
- def selection_remove(*items)
- tk_send('selection', 'remove', array2tk_list(items.flatten, true))
- self
- end
- def selection_set(*items)
- tk_send('selection', 'set', array2tk_list(items.flatten, true))
- self
- end
- def selection_toggle(*items)
- tk_send('selection', 'toggle', array2tk_list(items.flatten, true))
- self
- end
-
- def get_directory(item)
- # tile-0.7+
- ret = []
- lst = simplelist(tk_send('set', item))
- until lst.empty?
- col = lst.shift
- val = lst.shift
- ret << [col, val]
- end
- ret
- end
- def get(item, col)
- tk_send('set', item, col)
- end
- def set(item, col, value)
- tk_send('set', item, col, value)
- self
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tscale.rb b/ext/tk/lib/tkextlib/tile/tscale.rb
deleted file mode 100644
index 7ec72e3515..0000000000
--- a/ext/tk/lib/tkextlib/tile/tscale.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# tscale & tprogress widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TScale < TkScale
- end
- Scale = TScale
-
- class TProgress < TScale
- end
- Progress = TProgress
- end
-end
-
-class Tk::Tile::TScale < TkScale
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::scale'.freeze].freeze
- else
- TkCommandNames = ['::tscale'.freeze].freeze
- end
- WidgetClassName = 'TScale'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
-
-class Tk::Tile::TProgress < Tk::Tile::TScale
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::progress'.freeze].freeze
- else
- TkCommandNames = ['::tprogress'.freeze].freeze
- end
- WidgetClassName = 'TProgress'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/ext/tk/lib/tkextlib/tile/tscrollbar.rb
deleted file mode 100644
index bd49ae18e3..0000000000
--- a/ext/tk/lib/tkextlib/tile/tscrollbar.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# tscrollbar widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TScrollbar < TkScrollbar
- end
- Scrollbar = TScrollbar
- end
-end
-
-class Tk::Tile::TScrollbar < TkScrollbar
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::scrollbar'.freeze].freeze
- else
- TkCommandNames = ['::tscrollbar'.freeze].freeze
- end
- WidgetClassName = 'TScrollbar'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tseparator.rb b/ext/tk/lib/tkextlib/tile/tseparator.rb
deleted file mode 100644
index ca731d4e5b..0000000000
--- a/ext/tk/lib/tkextlib/tile/tseparator.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# tseparator widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TSeparator < TkWindow
- end
- Separator = TSeparator
- end
-end
-
-class Tk::Tile::TSeparator < TkWindow
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::separator'.freeze].freeze
- else
- TkCommandNames = ['::tseparator'.freeze].freeze
- end
- WidgetClassName = 'TSeparator'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tile/tsquare.rb b/ext/tk/lib/tkextlib/tile/tsquare.rb
deleted file mode 100644
index 600b55e4e7..0000000000
--- a/ext/tk/lib/tkextlib/tile/tsquare.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# tsquare widget
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-require 'tkextlib/tile.rb'
-
-module Tk
- module Tile
- class TSquare < TkWindow
- end
- Square = TSquare
- end
-end
-
-class Tk::Tile::TSquare < TkWindow
- include Tk::Tile::TileWidget
-
- if Tk::Tile::USE_TTK_NAMESPACE
- TkCommandNames = ['::ttk::square'.freeze].freeze
- else
- TkCommandNames = ['::tsquare'.freeze].freeze
- end
- WidgetClassName = 'TSquare'.freeze
- WidgetClassNames[WidgetClassName] = self
-
- def self.style(*args)
- [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
- end
-end
diff --git a/ext/tk/lib/tkextlib/tkDND/shape.rb b/ext/tk/lib/tkextlib/tkDND/shape.rb
index 570c93b0d9..0f6a5f0a30 100644
--- a/ext/tk/lib/tkextlib/tkDND/shape.rb
+++ b/ext/tk/lib/tkextlib/tkDND/shape.rb
@@ -18,12 +18,6 @@ module Tk
module TkDND
module Shape
extend TkCore
-
- PACKAGE_NAME = 'shape'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
=begin
def self.package_version
begin
diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
index a040532eb6..375ac89518 100644
--- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
+++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
@@ -15,11 +15,6 @@ TkPackage.require('tkdnd')
module Tk
module TkDND
- PACKAGE_NAME = 'tkdnd'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('tkdnd')
@@ -94,7 +89,7 @@ module Tk
#end
def dnd_bindtarget(type, event, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -134,7 +129,7 @@ module Tk
#end
def dnd_bindsource(type, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
index 8527f61df1..b9a203575a 100644
--- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
+++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
@@ -16,11 +16,6 @@ TkPackage.require('Tkhtml')
module Tk
class HTML_Widget < TkWindow
- PACKAGE_NAME = 'Tkhtml'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Tkhtml')
@@ -96,19 +91,13 @@ class Tk::HTML_Widget
def create_self(keys)
if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ tk_call_without_enc('html', @path, *hash_kv(keys, true))
else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ tk_call_without_enc('html', @path)
end
end
private :create_self
- def __strval_optkeys
- super() << 'base' << 'selectioncolor' << 'unvisitedcolor' << 'visitedcolor'
- end
- private :__strval_optkeys
-
###################################
# class methods
###################################
diff --git a/ext/tk/lib/tkextlib/tkimg.rb b/ext/tk/lib/tkextlib/tkimg.rb
index c01359d3ef..ffeafbb58e 100644
--- a/ext/tk/lib/tkextlib/tkimg.rb
+++ b/ext/tk/lib/tkextlib/tkimg.rb
@@ -17,11 +17,6 @@ TkPackage.require('Img')
module Tk
module Img
- PACKAGE_NAME = 'Img'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Img')
diff --git a/ext/tk/lib/tkextlib/tkimg/bmp.rb b/ext/tk/lib/tkextlib/tkimg/bmp.rb
index ea90181aa3..581483f8f4 100644
--- a/ext/tk/lib/tkextlib/tkimg/bmp.rb
+++ b/ext/tk/lib/tkextlib/tkimg/bmp.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::bmp')
module Tk
module Img
module BMP
- PACKAGE_NAME = 'img::bmp'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::bmp')
diff --git a/ext/tk/lib/tkextlib/tkimg/gif.rb b/ext/tk/lib/tkextlib/tkimg/gif.rb
index d542d47561..6ef18f8e90 100644
--- a/ext/tk/lib/tkextlib/tkimg/gif.rb
+++ b/ext/tk/lib/tkextlib/tkimg/gif.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::gif')
module Tk
module Img
module GIF
- PACKAGE_NAME = 'img::gif'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::gif')
diff --git a/ext/tk/lib/tkextlib/tkimg/ico.rb b/ext/tk/lib/tkextlib/tkimg/ico.rb
index e79bdf45e9..1e3cb5f497 100644
--- a/ext/tk/lib/tkextlib/tkimg/ico.rb
+++ b/ext/tk/lib/tkextlib/tkimg/ico.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::ico')
module Tk
module Img
module ICO
- PACKAGE_NAME = 'img::ico'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::ico')
diff --git a/ext/tk/lib/tkextlib/tkimg/jpeg.rb b/ext/tk/lib/tkextlib/tkimg/jpeg.rb
index 2126120161..017c93ee0e 100644
--- a/ext/tk/lib/tkextlib/tkimg/jpeg.rb
+++ b/ext/tk/lib/tkextlib/tkimg/jpeg.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::jpeg')
module Tk
module Img
module JPEG
- PACKAGE_NAME = 'img::jpeg'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::jpeg')
diff --git a/ext/tk/lib/tkextlib/tkimg/pcx.rb b/ext/tk/lib/tkextlib/tkimg/pcx.rb
index 6831f4d35b..e924d48869 100644
--- a/ext/tk/lib/tkextlib/tkimg/pcx.rb
+++ b/ext/tk/lib/tkextlib/tkimg/pcx.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::pcx')
module Tk
module Img
module PCX
- PACKAGE_NAME = 'img::pcx'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::pcx')
diff --git a/ext/tk/lib/tkextlib/tkimg/pixmap.rb b/ext/tk/lib/tkextlib/tkimg/pixmap.rb
index bd1b870af7..f9aaa65a9b 100644
--- a/ext/tk/lib/tkextlib/tkimg/pixmap.rb
+++ b/ext/tk/lib/tkextlib/tkimg/pixmap.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::pixmap')
module Tk
module Img
module PIXMAP
- PACKAGE_NAME = 'img::pixmap'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::pixmap')
@@ -39,6 +34,6 @@ class TkPixmapImage<TkImage
def initialize(*args)
@type = 'pixmap'
- super(*args)
+ super
end
end
diff --git a/ext/tk/lib/tkextlib/tkimg/png.rb b/ext/tk/lib/tkextlib/tkimg/png.rb
index 5c829f48d2..b155836395 100644
--- a/ext/tk/lib/tkextlib/tkimg/png.rb
+++ b/ext/tk/lib/tkextlib/tkimg/png.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::png')
module Tk
module Img
module PNG
- PACKAGE_NAME = 'img::png'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::png')
diff --git a/ext/tk/lib/tkextlib/tkimg/ppm.rb b/ext/tk/lib/tkextlib/tkimg/ppm.rb
index eacfae467d..df56baee4a 100644
--- a/ext/tk/lib/tkextlib/tkimg/ppm.rb
+++ b/ext/tk/lib/tkextlib/tkimg/ppm.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::ppm')
module Tk
module Img
module PPM
- PACKAGE_NAME = 'img::ppm'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::ppm')
diff --git a/ext/tk/lib/tkextlib/tkimg/ps.rb b/ext/tk/lib/tkextlib/tkimg/ps.rb
index 68e9178ac0..3025066eb4 100644
--- a/ext/tk/lib/tkextlib/tkimg/ps.rb
+++ b/ext/tk/lib/tkextlib/tkimg/ps.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::ps')
module Tk
module Img
module PS
- PACKAGE_NAME = 'img::ps'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::ps')
diff --git a/ext/tk/lib/tkextlib/tkimg/sgi.rb b/ext/tk/lib/tkextlib/tkimg/sgi.rb
index ec7038bf0e..e505c87e8b 100644
--- a/ext/tk/lib/tkextlib/tkimg/sgi.rb
+++ b/ext/tk/lib/tkextlib/tkimg/sgi.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::sgi')
module Tk
module Img
module SGI
- PACKAGE_NAME = 'img::sgi'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::sgi')
diff --git a/ext/tk/lib/tkextlib/tkimg/sun.rb b/ext/tk/lib/tkextlib/tkimg/sun.rb
index 651f946497..25bfea8fb7 100644
--- a/ext/tk/lib/tkextlib/tkimg/sun.rb
+++ b/ext/tk/lib/tkextlib/tkimg/sun.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::sun')
module Tk
module Img
module SUN
- PACKAGE_NAME = 'img::sun'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::sun')
diff --git a/ext/tk/lib/tkextlib/tkimg/tga.rb b/ext/tk/lib/tkextlib/tkimg/tga.rb
index 1eae407c0a..e3f84c3714 100644
--- a/ext/tk/lib/tkextlib/tkimg/tga.rb
+++ b/ext/tk/lib/tkextlib/tkimg/tga.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::tga')
module Tk
module Img
module TGA
- PACKAGE_NAME = 'img::tga'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::tga')
diff --git a/ext/tk/lib/tkextlib/tkimg/tiff.rb b/ext/tk/lib/tkextlib/tkimg/tiff.rb
index ed271c2600..e7e12406ac 100644
--- a/ext/tk/lib/tkextlib/tkimg/tiff.rb
+++ b/ext/tk/lib/tkextlib/tkimg/tiff.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::tiff')
module Tk
module Img
module TIFF
- PACKAGE_NAME = 'img::tiff'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::tiff')
diff --git a/ext/tk/lib/tkextlib/tkimg/window.rb b/ext/tk/lib/tkextlib/tkimg/window.rb
index 3b5906fab6..00ed7d1b86 100644
--- a/ext/tk/lib/tkextlib/tkimg/window.rb
+++ b/ext/tk/lib/tkextlib/tkimg/window.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::window')
module Tk
module Img
module WINDOW
- PACKAGE_NAME = 'img::window'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::window')
diff --git a/ext/tk/lib/tkextlib/tkimg/xbm.rb b/ext/tk/lib/tkextlib/tkimg/xbm.rb
index f4bea030be..08b1b9876b 100644
--- a/ext/tk/lib/tkextlib/tkimg/xbm.rb
+++ b/ext/tk/lib/tkextlib/tkimg/xbm.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::xbm')
module Tk
module Img
module XBM
- PACKAGE_NAME = 'img::xbm'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::xbm')
diff --git a/ext/tk/lib/tkextlib/tkimg/xpm.rb b/ext/tk/lib/tkextlib/tkimg/xpm.rb
index 5119c8710b..e29c1d554f 100644
--- a/ext/tk/lib/tkextlib/tkimg/xpm.rb
+++ b/ext/tk/lib/tkextlib/tkimg/xpm.rb
@@ -16,11 +16,6 @@ TkPackage.require('img::xpm')
module Tk
module Img
module XPM
- PACKAGE_NAME = 'img::xpm'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('img::xpm')
diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb
index 4edaabc847..da78ca3fbb 100644
--- a/ext/tk/lib/tkextlib/tktable/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable/tktable.rb
@@ -17,11 +17,6 @@ TkPackage.require('Tktable')
module Tk
class TkTable < TkWindow
- PACKAGE_NAME = 'Tktable'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('Tktable')
@@ -59,21 +54,6 @@ module Tk::TkTable::ConfigMethod
end
private :__item_pathname
- def __item_boolval_optkeys(id)
- super(id) << 'multiline' << 'showtext' << 'wrap'
- end
- private :__item_boolval_optkeys
-
- def __item_strval_optkeys(id)
- super(id) << 'ellipsis'
- end
- private :__item_strval_optkeys
-
- def __item_val2ruby_optkeys(id) # { key=>method, ... }
- super(id).update('window'=>proc{|v| window(v)})
- end
- private :__item_val2ruby_optkeys
-
def tag_cget(tagOrId, option)
itemcget(['tag', tagid(tagOrId)], option)
end
@@ -223,18 +203,6 @@ class Tk::TkTable
Tk::TkTable::CelTag::CellTagID_TBL.delete(@path)
end
- def __boolval_optkeys
- super() << 'autoclear' << 'flashmode' << 'invertselected' <<
- 'multiline' << 'selecttitle' << 'wrap'
- end
- private :__boolval_optkeys
-
- def __strval_optkeys
- super() << 'colseparator' << 'ellipsis' << 'rowseparator' << 'sparsearray'
- end
- private :__strval_optkeys
-
-
#################################
class BrowseCommand < TkValidateCommand
@@ -367,7 +335,7 @@ class Tk::TkTable
#################################
def __validation_class_list
- super() <<
+ super <<
BrowseCommand << CellCommand << SelectionCommand << ValidateCommand
end
@@ -387,16 +355,16 @@ class Tk::TkTable
end
def border_mark(x, y)
- simplelist(tk_send('border', 'mark', x, y))
+ simplelist(tk_send('scan', 'mark', x, y))
end
def border_mark_row(x, y)
- tk_send('border', 'mark', x, y, 'row')
+ tk_send('scan', 'mark', x, y, 'row')
end
def border_mark_col(x, y)
- tk_send('border', 'mark', x, y, 'col')
+ tk_send('scan', 'mark', x, y, 'col')
end
def border_dragto(x, y)
- tk_send('border', 'dragto', x, y)
+ tk_send('scan', 'dragto', x, y)
end
def clear_cache(first=None, last=None)
@@ -579,9 +547,6 @@ class Tk::TkTable
def selection_include?(idx)
bool(tk_send('selection', 'includes', tagid(idx)))
end
- def selection_present
- bool(tk_send('selection', 'present'))
- end
def selection_set(first, last=None)
tk_send('selection', 'set', tagid(first), tagid(last))
self
diff --git a/ext/tk/lib/tkextlib/tktrans/tktrans.rb b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
index 665c57af0c..55ac03e563 100644
--- a/ext/tk/lib/tkextlib/tktrans/tktrans.rb
+++ b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
@@ -14,11 +14,6 @@ TkPackage.require('tktrans') rescue Tk.load_tcllibrary('tktrans')
module Tk
module TkTrans
- PACKAGE_NAME = 'tktrans'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('tktrans')
diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
index 12f7cffabf..9c1e977d14 100644
--- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
+++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
@@ -12,18 +12,10 @@ require 'tkextlib/setup.rb'
require 'tkextlib/treectrl/setup.rb'
# TkPackage.require('treectrl', '1.0')
-# TkPackage.require('treectrl', '1.1')
TkPackage.require('treectrl')
module Tk
class TreeCtrl < TkWindow
- BindTag_FileList = TkBindTag.new_by_name('TreeCtrlFileList')
-
- PACKAGE_NAME = 'treectrl'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('treectrl')
@@ -32,9 +24,6 @@ module Tk
end
end
- HasColumnCreateCommand =
- (TkPackage.vcompare(self.package_version, '1.1') >= 0)
-
# dummy ::
# pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for
# 'loupe' command (probably it is bug, I think).
@@ -54,14 +43,6 @@ module Tk
Tk.tk_call_without_enc('loupe', img, x, y, w, h, zoom)
end
- def self.text_layout(font, text, keys={})
- TkComm.list(Tk.tk_call_without_enc('textlayout', font, text, keys))
- end
-
- def self.image_tint(img, color, alpha)
- Tk.tk_call_without_enc('imagetint', img, color, alpha)
- end
-
class NotifyEvent < TkUtil::CallbackSubst
end
@@ -81,14 +62,12 @@ class Tk::TreeCtrl::NotifyEvent
[ ?D, ?l, :items ],
[ ?e, ?e, :event ],
[ ?I, ?n, :id ],
- [ ?l, ?n, :lower_bound ],
+ [ ?l, ?b, :lower_bound ],
[ ?p, ?n, :active_id ],
- [ ?P, ?e, :pattern ],
[ ?S, ?l, :sel_items ],
[ ?T, ?w, :widget ],
- [ ?u, ?n, :upper_bound ],
+ [ ?U, ?b, :upper_bound ],
[ ?W, ?o, :object ],
- [ ??, ?x, :parm_info ],
nil
]
@@ -99,6 +78,8 @@ class Tk::TreeCtrl::NotifyEvent
[ ?l, TkComm.method(:list) ],
[ ?w, TkComm.method(:window) ],
+ [ ?b, proc{|val| list(val)} ],
+
[ ?e, proc{|val|
case val
when /^<<[^<>]+>>$/
@@ -111,28 +92,7 @@ class Tk::TreeCtrl::NotifyEvent
}
],
- [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ],
-
- [ ?x, proc{|val|
- begin
- inf = {}
- Hash[*(TkComm.list(val))].each{|k, v|
- if keyinfo = KEY_TBL.assoc(k[0])
- if cmd = PROC_TBL.assoc(keyinfo[1])
- begin
- new_v = cmd.call(v)
- v = new_v
- rescue
- end
- end
- end
- inf[k] = v
- }
- inf
- rescue
- val
- end
- } ],
+ [ ?o, proc{|val| tk_tcl2ruby(val)} ],
nil
]
@@ -164,22 +124,12 @@ module Tk::TreeCtrl::ConfigMethod
key = key.to_s
end
- if (obj.kind_of?(Tk::TreeCtrl::Column) ||
- obj.kind_of?(Tk::TreeCtrl::Element) ||
- obj.kind_of?(Tk::TreeCtrl::Item) ||
- obj.kind_of?(Tk::TreeCtrl::Style))
- obj = obj.id
- end
-
case key
when 'column'
obj
- when 'debug'
- None
-
when 'dragimage'
- None
+ obj
when 'element'
obj
@@ -188,7 +138,7 @@ module Tk::TreeCtrl::ConfigMethod
obj
when 'marquee'
- None
+ obj
when 'notify'
obj
@@ -202,24 +152,15 @@ module Tk::TreeCtrl::ConfigMethod
end
def tagid(mixed_id)
- if mixed_id == 'debug'
- ['debug', None]
- elsif mixed_id == 'dragimage'
- ['dragimage', None]
- elsif mixed_id == 'marquee'
- ['marquee', None]
- elsif mixed_id.kind_of?(Array)
+ if mixed_id.kind_of?(Array)
[mixed_id[0], treectrl_tagid(*mixed_id)]
else
tagid(mixed_id.split(':'))
end
+ fail ArgumentError, "unknown id format"
end
def __item_cget_cmd(mixed_id)
- if mixed_id[0] == 'column' && mixed_id[1] == 'drag'
- return [self.path, 'column', 'dragcget']
- end
-
if mixed_id[1].kind_of?(Array)
id = mixed_id[1]
else
@@ -235,10 +176,6 @@ module Tk::TreeCtrl::ConfigMethod
private :__item_cget_cmd
def __item_config_cmd(mixed_id)
- if mixed_id[0] == 'column' && mixed_id[1] == 'drag'
- return [self.path, 'column', 'dragconfigure']
- end
-
if mixed_id[1].kind_of?(Array)
id = mixed_id[1]
else
@@ -282,104 +219,8 @@ module Tk::TreeCtrl::ConfigMethod
end
private :__item_configinfo_struct
-
- def __item_font_optkeys(id)
- if id.kind_of?(Array) && (id[0] == 'element' ||
- (id[0].kind_of?(Array) && id[0][1] == 'element'))
- []
- else
- ['font']
- end
- end
- private :__item_font_optkeys
-
- def __item_numstrval_optkeys(id)
- if id == 'debug'
- ['displaydelay']
- else
- super(id)
- end
- end
- private :__item_numstrval_optkeys
-
- def __item_boolval_optkeys(id)
- if id == 'debug'
- ['data', 'display', 'enable']
- elsif id == 'dragimage'
- ['visible']
- elsif id == 'marquee'
- ['visible']
- elsif id.kind_of?(Array)
- case id[0]
- when 'item'
- ['button', 'visible']
- when 'column'
- if id[1] == 'drag'
- ['enable']
- else
- ['button', 'expand', 'resize', 'squeeze', 'sunken',
- 'visible', 'widthhack']
- end
- when 'element'
- ['draw', 'filled', 'showfocus', 'destroy']
- when 'notify'
- ['active']
- when 'style'
- ['detach']
- else
- if id[0].kind_of?(Array) && id[0][1] == 'element'
- ['filled', 'showfocus']
- else
- super(id)
- end
- end
- else
- super(id)
- end
- end
- private :__item_boolval_optkeys
-
- def __item_strval_optkeys(id)
- if id == 'debug'
- ['erasecolor']
- elsif id.kind_of?(Array)
- case id[0]
- when 'column'
- if id[1] == 'drag'
- ['indicatorcolor']
- else
- super(id) << 'textcolor'
- end
- when 'element'
- super(id) << 'fill' << 'outline' << 'format'
- else
- super(id)
- end
- else
- super(id)
- end
- end
- private :__item_strval_optkeys
-
def __item_listval_optkeys(id)
- if id.kind_of?(Array)
- case id[0]
- when 'column'
- ['itembackground']
- when 'element'
- ['relief']
- when 'style'
- ['union']
- else
- if id[0].kind_of?(Array) && id[0][1] == 'element'
- ['relief']
- else
- []
- end
- end
- else
- []
- end
+ []
end
private :__item_listval_optkeys
@@ -403,49 +244,23 @@ module Tk::TreeCtrl::ConfigMethod
itemconfigure(['column', tagOrId], slot, value)
end
def column_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['column', tagOrId], slot)
+ itemconfigure(['column', tagOrId], slot)
end
def current_column_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['column', tagOrId], slot)
- end
-
- def column_dragcget(option)
- itemcget(['column', 'drag'], option)
- end
- def column_dragconfigure(slot, value=None)
- itemconfigure(['column', 'drag'], slot, value)
- end
- def column_dragconfiginfo(slot=nil)
- itemconfiginfo(['column', 'drag'], slot)
- end
- def current_column_dragconfiginfo(slot=nil)
- current_itemconfiginfo(['column', 'drag'], slot)
+ itemconfigure(['column', tagOrId], slot)
end
- def debug_cget(option)
- itemcget('debug', option)
+ def dragimage_cget(tagOrId, option)
+ itemcget(['dragimage', tagOrId], option)
end
- def debug_configure(slot, value=None)
- itemconfigure('debug', slot, value)
+ def dragimage_configure(tagOrId, slot, value=None)
+ itemconfigure(['dragimage', tagOrId], slot, value)
end
- def debug_configinfo(slot=nil)
- itemconfiginfo('debug', slot)
+ def dragimage_configinfo(tagOrId, slot=nil)
+ itemconfigure(['dragimage', tagOrId], slot)
end
- def current_debug_configinfo(slot=nil)
- current_itemconfiginfo('debug', slot)
- end
-
- def dragimage_cget(option)
- itemcget('dragimage', option)
- end
- def dragimage_configure(slot, value=None)
- itemconfigure('dragimage', slot, value)
- end
- def dragimage_configinfo(slot=nil)
- itemconfiginfo('dragimage', slot)
- end
- def current_dragimage_configinfo(slot=nil)
- current_itemconfiginfo('dragimage', slot)
+ def current_dragimage_configinfo(tagOrId, slot=nil)
+ itemconfigure(['dragimage', tagOrId], slot)
end
def element_cget(tagOrId, option)
@@ -455,62 +270,46 @@ module Tk::TreeCtrl::ConfigMethod
itemconfigure(['element', tagOrId], slot, value)
end
def element_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['element', tagOrId], slot)
+ itemconfigure(['element', tagOrId], slot)
end
def current_element_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['element', tagOrId], slot)
- end
-
- def item_cget(tagOrId, option)
- itemcget(['item', tagOrId], option)
- end
- def item_configure(tagOrId, slot, value=None)
- itemconfigure(['item', tagOrId], slot, value)
- end
- def item_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['item', tagOrId], slot)
- end
- def current_item_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['item', tagOrId], slot)
+ itemconfigure(['element', tagOrId], slot)
end
- def item_element_cget(item, column, elem, option)
- itemcget([['item', 'element'], [item, column, elem]], option)
+ def item_element_cget(tagOrId, option)
+ itemcget([['item', 'element'], tagOrId], option)
end
- def item_element_configure(item, column, elem, slot, value=None)
- itemconfigure([['item', 'element'], [item, column, elem]], slot, value)
+ def item_element_configure(tagOrId, slot, value=None)
+ itemconfigure([['item', 'element'], tagOrId], slot, value)
end
- def item_element_configinfo(item, column, elem, slot=nil)
- itemconfiginfo([['item', 'element'], [item, column, elem]], slot)
+ def item_element_configinfo(tagOrId, slot=nil)
+ itemconfigure([['item', 'element'], tagOrId], slot)
end
- def current_item_element_configinfo(item, column, elem, slot=nil)
- current_itemconfiginfo([['item', 'element'], [item, column, elem]], slot)
+ def current_item_element_configinfo(tagOrId, slot=nil)
+ itemconfigure([['item', 'element'], tagOrId], slot)
end
- def marquee_cget(option)
- itemcget('marquee', option)
+ def marquee_cget(tagOrId, option)
+ itemcget(['marquee', tagOrId], option)
end
- def marquee_configure(slot, value=None)
- itemconfigure('marquee', slot, value)
+ def marquee_configure(tagOrId, slot, value=None)
+ itemconfigure(['marquee', tagOrId], slot, value)
end
- def marquee_configinfo(slot=nil)
- itemconfiginfo('marquee', slot)
+ def marquee_configinfo(tagOrId, slot=nil)
+ itemconfigure(['marquee', tagOrId], slot)
end
- def current_marquee_configinfo(slot=nil)
- current_itemconfiginfo('marquee', slot)
+ def current_marquee_configinfo(tagOrId, slot=nil)
+ itemconfigure(['marquee', tagOrId], slot)
end
def notify_cget(win, pattern, option)
- pattern = "<#{pattern}>"
itemconfigure(['notify', [win, pattern]], option)
end
def notify_configure(win, pattern, slot, value=None)
- pattern = "<#{pattern}>"
itemconfigure(['notify', [win, pattern]], slot, value)
end
def notify_configinfo(win, pattern, slot=nil)
- pattern = "<#{pattern}>"
- itemconfiginfo(['notify', [win, pattern]], slot)
+ itemconfigure(['notify', [win, pattern]], slot)
end
alias current_notify_configinfo notify_configinfo
@@ -521,10 +320,10 @@ module Tk::TreeCtrl::ConfigMethod
itemconfigure(['style', tagOrId], slot, value)
end
def style_configinfo(tagOrId, slot=nil)
- itemconfiginfo(['style', tagOrId], slot)
+ itemconfigure(['style', tagOrId], slot)
end
def current_style_configinfo(tagOrId, slot=nil)
- current_itemconfiginfo(['style', tagOrId], slot)
+ itemconfigure(['style', tagOrId], slot)
end
private :itemcget, :itemconfigure
@@ -538,43 +337,9 @@ class Tk::TreeCtrl
include Scrollable
TkCommandNames = ['treectrl'.freeze].freeze
- WidgetClassName = 'TreeCtrl'.freeze
+ WidgetClassName = ''.freeze
WidgetClassNames[WidgetClassName] = self
- #########################
-
- def __destroy_hook__
- Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.delete(@path)
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.delete(@path)
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.delete(@path)
- Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.delete(@path)
- end
-
- #########################
-
- def __strval_optkeys
- super() + [
- 'buttoncolor', 'columnprefix', 'itemprefix', 'linecolor'
- ]
- end
- private :__strval_optkeys
-
- def __boolval_optkeys
- [
- 'itemwidthequal', 'usetheme',
- 'showbuttons', 'showheader', 'showlines', 'showroot',
- 'showrootbutton', 'showrootlines',
- ]
- end
- private :__boolval_optkeys
-
- def __listval_optkeys
- [ 'defaultstyle' ]
- end
- private :__listval_optkeys
-
- #########################
-
def install_bind(cmd, *args)
install_bind_for_event_class(Tk::TreeCtrl::NotifyEvent, cmd, *args)
end
@@ -583,10 +348,9 @@ class Tk::TreeCtrl
def create_self(keys)
if keys and keys != None
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ tk_call_without_enc('treectrl', @path, *hash_kv(keys, true))
else
- tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ tk_call_without_enc('treectrl', @path)
end
end
private :create_self
@@ -607,13 +371,12 @@ class Tk::TreeCtrl
end
def collapse(*dsc)
- tk_send_without_enc('collapse', *(dsc.map!{|d| _get_eval_string(d, true)}))
+ tk_send('collapse', *dsc)
self
end
def collapse_recurse(*dsc)
- tk_send_without_enc('collapse', '-recurse',
- *(dsc.map!{|d| _get_eval_string(d, true)}))
+ tk_send('collapse', '-recurse', *dsc)
self
end
@@ -621,26 +384,7 @@ class Tk::TreeCtrl
list(tk_send('column', 'bbox', idx))
end
- def column_compare(column1, op, column2)
- bool(tk_send('column', 'compare', column1, op, column2))
- end
-
- def column_count
- num_or_str(tk_send('column', 'count'))
- end
-
- def column_create(keys=nil)
- if keys && keys.kind_of?(Hash)
- num_or_str(tk_send('column', 'create', *hash_kv(keys)))
- else
- num_or_str(tk_send('column', 'create'))
- end
- end
-
def column_delete(idx)
- if Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[self.path]
- Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[self.path].delete(idx)
- end
tk_send('column', 'delete', idx)
self
end
@@ -649,23 +393,8 @@ class Tk::TreeCtrl
num_or_str(tk_send('column', 'index', idx))
end
- def column_id(idx)
- tk_send('column', 'id', idx)
- end
-
- def column_list(visible=false)
- if visible
- simplelist(tk_send('column', 'list', '-visible'))
- else
- simplelist(tk_send('column', 'list'))
- end
- end
- def column_visible_list
- column_list(true)
- end
-
- def column_move(idx, before)
- tk_send('column', 'move', idx, before)
+ def column_move(idx, to)
+ tk_send('column', 'move', idx, to)
self
end
@@ -674,23 +403,12 @@ class Tk::TreeCtrl
end
alias column_neededwidth column_needed_width
- def column_order(column, visible=false)
- if visible
- num_or_str(tk_send('column', 'order', column, '-visible'))
- else
- num_or_str(tk_send('column', 'order', column))
- end
- end
- def column_visible_order(column)
- column_order(column, true)
- end
-
def column_width(idx)
num_or_str(tk_send('column', 'width', idx))
end
def compare(item1, op, item2)
- bool(tk_send('compare', item1, op, item2))
+ number(tk_send('compare', item1, op, item2))
end
def contentbox()
@@ -698,7 +416,7 @@ class Tk::TreeCtrl
end
def depth(item=None)
- num_or_str(tk_send_without_enc('depth', _get_eval_string(item, true)))
+ num_or_str(tk_send('depth', item))
end
def dragimage_add(item, *args)
@@ -732,15 +450,6 @@ class Tk::TreeCtrl
dragimage_visible()
end
- def debug_dinfo
- tk_send('debug', 'dinfo')
- self
- end
-
- def debug_scroll
- tk_send('debug', 'scroll')
- end
-
def element_create(elem, type, keys=nil)
if keys && keys.kind_of?(Hash)
tk_send('element', 'create', elem, type, *hash_kv(keys))
@@ -750,45 +459,18 @@ class Tk::TreeCtrl
end
def element_delete(*elems)
- if Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[self.path]
- elems.each{|elem|
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[self.path].delete(elem)
- }
- end
tk_send('element', 'delete', *elems)
self
end
def element_names()
- list(tk_send('element', 'names')).collect!{|elem|
- Tk::TreeCtrl::Element.id2obj(self, elem)
- }
- end
-
- def _conv_element_perstate_val(opt, val)
- case opt
- when 'background', 'foreground', 'fill', 'outline', 'format'
- val
- when 'draw', 'filled', 'showfocus', 'destroy'
- bool(val)
- else
- tk_tcl2ruby(val)
- end
- end
- private :_conv_element_perstate_val
-
- def element_perstate(elem, opt, st_list)
- tk_send('element', 'perstate', elem, "-{opt}", st_list)
+ list(tk_send('element', 'names'))
end
def element_type(elem)
tk_send('element', 'type', elem)
end
- def element_class(elem)
- Tk::TreeCtrl::Element.type2class(element_type(elem))
- end
-
def expand(*dsc)
tk_send('expand', *dsc)
self
@@ -800,37 +482,7 @@ class Tk::TreeCtrl
end
def identify(x, y)
- lst = list(tk_send('identify', x, y))
-
- if lst[0] == 'item'
- lst[1] = Tk::TreeCtrl::Item.id2obj(self, lst[1])
- size = lst.size
- i = 2
- while i < size
- case lst[i]
- when 'line'
- i += 1
- lst[i] = Tk::TreeCtrl::Item.id2obj(self, lst[i])
- i += 1
-
- when 'button'
- i += 1
-
- when 'column'
- i += 2
-
- when 'elem'
- i += 1
- lst[i] = Tk::TreeCtrl::Element.id2obj(self, lst[i])
- i += 1
-
- else
- i += 1
- end
- end
- end
-
- lst
+ list(tk_send('identify', x, y))
end
def index(idx)
@@ -838,9 +490,7 @@ class Tk::TreeCtrl
end
def item_ancestors(item)
- list(tk_send('item', 'ancestors', item)).collect!{|id|
- Tk::TreeCtrl::Item.id2obj(self, id)
- }
+ list(tk_send('item', 'ancestors', item))
end
def item_bbox(item, *args)
@@ -848,59 +498,19 @@ class Tk::TreeCtrl
end
def item_children(item)
- list(tk_send('item', 'children', item)).collect!{|id|
- Tk::TreeCtrl::Item.id2obj(self, id)
- }
- end
-
- def item_collapse(item)
- tk_send_without_enc('item', 'collapse', _get_eval_string(item, true))
- self
- end
-
- def item_collapse_recurse(item)
- tk_send_without_enc('item', 'collapse',
- _get_eval_string(item, true), '-recurse')
- self
- end
-
- def item_compare(item1, op, item2)
- bool(tk_send('item', 'compare', item1, op, item2))
+ list(tk_send('item', 'children', item))
end
def item_complex(item, *args)
- tk_send_without_enc('item', 'complex',
- _get_eval_string(item, true),
- *(args.map!{|arg| _get_eval_string(arg, true)}))
+ tk_send('item', 'complex', item, *args)
self
end
- def item_count
- num_or_str(tk_send('item', 'count'))
- end
-
- def item_create(keys={})
- num_or_str(tk_send_without_enc('item', 'create', *hash_kv(keys, true)))
+ def item_create()
+ num_or_str(tk_send('item', 'create'))
end
- def _erase_children(item)
- item_children(item).each{|i| _erase_children(i)}
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path].delete(item)
- end
- private :_erase_children
-
def item_delete(first, last=None)
- if Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path]
- if first == 'all' || first == :all || last == 'all' || last == :all
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path].clear
- elsif last == None
- _erase_children(first)
- else
- self.range(first, last).each{|id|
- _erase_children(id)
- }
- end
- end
tk_send('item', 'delete', first, last)
self
end
@@ -909,84 +519,30 @@ class Tk::TreeCtrl
list(tk_send('item', 'dump', item))
end
- def item_dump_hash(item)
- Hash[*list(tk_send('item', 'dump', item))]
- end
-
def item_element_actual(item, column, elem, key)
tk_send('item', 'element', 'actual', item, column, elem, "-#{key}")
end
- def item_element_perstate(elem, opt, st_list)
- tk_send('item', 'element', 'perstate', elem, "-{opt}", st_list)
- end
-
- def item_expand(item)
- tk_send('item', 'expand', item)
- self
- end
-
- def item_expand_recurse(item)
- tk_send('item', 'expand', item, '-recurse')
- self
- end
-
def item_firstchild(parent, child=nil)
if child
- tk_send_without_enc('item', 'firstchild',
- _get_eval_string(parent, true),
- _get_eval_string(child, true))
+ tk_send('item', 'firstchild', parent, child)
self
else
- id = num_or_str(tk_send_without_enc('item', 'firstchild',
- _get_eval_string(parent, true)))
- Tk::TreeCtrl::Item.id2obj(self, id)
+ num_or_str(tk_send('item', 'firstchild', parent))
end
end
alias item_first_child item_firstchild
- def item_hasbutton(item, st=None)
+ def item_hashbutton(item, st=None)
if st == None
- bool(tk_send_without_enc('item', 'hasbutton',
- _get_eval_string(item, true)))
+ bool(tk_send('item', 'hashbutton'))
else
- tk_send_without_enc('item', 'hasbutton',
- _get_eval_string(item, true),
- _get_eval_string(st))
+ tk_send('item', 'hashbutton', st)
self
end
end
- alias item_has_button item_hasbutton
-
- def item_hasbutton?(item)
- item_hasbutton(item)
- end
- alias item_has_button? item_hasbutton?
-
- def item_id(item)
- tk_send('item', 'id', item)
- end
-
- def item_image(item, column=nil, *args)
- if args.empty?
- if column
- img = tk_send('item', 'image', item, column)
- TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
- else
- simplelist(tk_send('item', 'image', item)).collect!{|img|
- TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
- }
- end
- else
- tk_send('item', 'image', item, column, *args)
- self
- end
- end
- def get_item_image(item, column=nil)
- item_image(item, column)
- end
- def set_item_image(item, col, img, *args)
- item_image(item, col, img, *args)
+ def item_hashbutton?(item)
+ item_hashbutton(item)
end
def item_index(item)
@@ -1011,14 +567,10 @@ class Tk::TreeCtrl
def item_lastchild(parent, child=nil)
if child
- tk_send_without_enc('item', 'lastchild',
- _get_eval_string(parent, true),
- _get_eval_string(child, true))
+ tk_send('item', 'lastchild', parent, child)
self
else
- id = num_or_str(tk_send_without_enc('item', 'lastchild',
- _get_eval_string(parent, true)))
- Tk::TreeCtrl::Item.id2obj(self, id)
+ num_or_str(tk_send('item', 'lastchild', parent))
end
end
alias item_last_child item_lastchild
@@ -1028,35 +580,19 @@ class Tk::TreeCtrl
tk_send('item', 'nextsibling', sibling, nxt)
self
else
- id = num_or_str(tk_send('item', 'nextsibling', sibling))
- Tk::TreeCtrl::Item.id2obj(self, id)
+ num_or_str(tk_send('item', 'nextsibling', sibling))
end
end
alias item_next_sibling item_nextsibling
- def item_numchildren(item)
- number(tk_send_without_enc('item', 'numchildren',
- _get_eval_string(item, true)))
+ def item_numchildren()
+ number(tk_send('item', 'numchildren'))
end
alias item_num_children item_numchildren
alias item_children_size item_numchildren
- def item_order(item, visible=false)
- if visible
- ret = num_or_str(tk_send('item', 'order', item, '-visible'))
- else
- ret = num_or_str(tk_send('item', 'order', item))
- end
-
- (ret.kind_of?(Fixnum) && ret < 0)? nil: ret
- end
- def item_visible_order(item)
- item_order(item, true)
- end
-
def item_parent(item)
- id = num_or_str(tk_send('item', 'parent', item))
- Tk::TreeCtrl::Item.id2obj(self, id)
+ num_or_str(tk_send('item', 'parent', item))
end
def item_prevsibling(sibling, prev=nil)
@@ -1064,111 +600,44 @@ class Tk::TreeCtrl
tk_send('item', 'prevsibling', sibling, prev)
self
else
- id = num_or_str(tk_send('item', 'prevsibling', sibling))
- Tk::TreeCtrl::Item.id2obj(self, id)
+ num_or_str(tk_send('item', 'prevsibling', sibling))
end
end
alias item_prev_sibling item_prevsibling
- def item_range(first, last)
- simplelist(tk_send('item', 'range', first, last))
- end
-
def item_remove(item)
- tk_send('item', 'remove', item)
- self
+ list(tk_send('item', 'remove', item))
end
def item_rnc(item)
list(tk_send('item', 'rnc', item))
end
- def _item_sort_core(real_sort, item, *opts)
- # opts ::= sort_param [, sort_param, ... ]
- # sort_param ::= {key=>val, ...}
- # [type, desc, {key=>val, ...}]
- # param
- opts = opts.collect{|param|
- if param.kind_of?(Hash)
- param = _symbolkey2str(param)
- if param.key?('column')
- key = '-column'
- desc = param.delete('column')
- elsif param.key?('element')
- key = '-element'
- desc = param.delete('element')
- else
- key = nil
- end
-
- if param.empty?
- param = None
- else
- param = hash_kv(__conv_item_keyonly_opts(item, param))
- end
-
- if key
- [key, desc].concat(param)
- else
- param
- end
-
- elsif param.kind_of?(Array)
- if param[2].kind_of?(Hash)
- param[2] = hash_kv(__conv_item_keyonly_opts(item, param[2]))
- end
- param
-
- elsif param.kind_of?(String) && param =~ /\A[a-z]+\Z/
- '-' << param
-
- elsif param.kind_of?(Symbol)
- '-' << param.to_s
+ def item_sort(item, *opts)
+ flag = false
+ if opts[-1].kind_of?(Hash)
+ opts[-1,1] = __conv_item_keyonly_opts(item, opts[-1]).to_a
+ end
+ opts = opts.collect{|opt|
+ if opt.kind_of?(Array)
+ key = "-#{opt[0]}"
+ flag = true if key == '-notreally'
+ ["-#{opt[0]}", opt[1]]
else
- param
+ key = "-#{opt}"
+ flag = true if key == '-notreally'
+ key
end
}.flatten
- if real_sort
- tk_send('item', 'sort', item, *opts)
- self
- else
- list(tk_send('item', 'sort', item, '-notreally', *opts))
- end
- end
- private :_item_sort_core
-
- def item_sort(item, *opts)
- _item_sort_core(true, item, *opts)
- end
- def item_sort_not_really(item, *opts)
- _item_sort_core(false, item, *opts)
- end
-
- def item_span(item, column=nil, *args)
- if args.empty?
- if column
- list(tk_send('item', 'span', item, column))
- else
- simplelist(tk_send('item', 'span', item)).collect!{|elem| list(elem)}
- end
+ ret = tk_send('item', 'sort', item, *opts)
+ if flag
+ list(ret)
else
- tk_send('item', 'span', item, column, *args)
- self
+ ret
end
end
- def get_item_span(item, column=nil)
- item_span(item, column)
- end
- def set_item_span(item, col, num, *args)
- item_span(item, col, num, *args)
- end
-
- def item_state_forcolumn(item, column, *args)
- tk_send('item', 'state', 'forcolumn', item, column, *args)
- end
- alias item_state_for_column item_state_forcolumn
def item_state_get(item, *args)
if args.empty?
@@ -1179,13 +648,12 @@ class Tk::TreeCtrl
end
def item_state_set(item, *args)
- tk_send('item', 'state', 'set', item, *args)
+ tk_send('item', 'state', 'set', *args)
+ self
end
- def item_style_elements(item, column)
- list(tk_send('item', 'style', 'elements', item, column)).collect!{|id|
- Tk::TreeCtrl::Style.id2obj(self, id)
- }
+ def item_style_elements(item, colun)
+ list(tk_send('item', 'style', 'elements', item, column))
end
def item_style_map(item, column, style, map)
@@ -1196,23 +664,12 @@ class Tk::TreeCtrl
def item_style_set(item, column=nil, *args)
if args.empty?
if column
- id = tk_send_without_enc('item', 'style', 'set',
- _get_eval_string(item, true),
- _get_eval_string(column, true))
- Tk::TreeCtrl::Style.id2obj(self, id)
+ tk_send('item', 'style', 'set', item, column)
else
- list(tk_send_without_enc('item', 'style', 'set',
- _get_eval_string(item, true))).collect!{|id|
- Tk::TreeCtrl::Style.id2obj(self, id)
- }
+ list(tk_send('item', 'style', 'set', item))
end
else
- tk_send_without_enc('item', 'style', 'set',
- _get_eval_string(item, true),
- _get_eval_string(column, true),
- *(args.flatten.map!{|arg|
- _get_eval_string(arg, true)
- }))
+ tk_send('item', 'style', 'set', item, *(args.flatten))
self
end
end
@@ -1226,21 +683,11 @@ class Tk::TreeCtrl
tk_send('item', 'text', item, column)
end
else
- tk_send('item', 'text', item, column, txt, *args)
+ tk_send('item', 'text', item, txt, *args)
self
end
end
- def item_toggle(item)
- tk_send('item', 'toggle', item)
- self
- end
-
- def item_toggle_recurse(item)
- tk_send('item', 'toggle', item, '-recurse')
- self
- end
-
def item_visible(item, st=None)
if st == None
bool(tk_send('item', 'visible', item))
@@ -1281,9 +728,7 @@ class Tk::TreeCtrl
end
def marquee_identify()
- list(tk_send('marquee', 'identify')).collect!{|id|
- Tk::TreeCtrl::Item.id2obj(self, id)
- }
+ list(tk_send('marquee', 'identify'))
end
def marquee_visible(st=None)
@@ -1304,7 +749,7 @@ class Tk::TreeCtrl
#end
def notify_bind(obj, event, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -1314,21 +759,21 @@ class Tk::TreeCtrl
end
#def notify_bind_append(obj, event, cmd=Proc.new, *args)
- # _bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
+ # _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
# self
#end
def notify_bind_append(obj, event, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0]) || !block_given?
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
end
- _bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
+ _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
self
end
- def notify_bind_remove(obj, event)
+ def notify_bindremove(obj, event)
_bind_remove([@path, 'notify', 'bind', obj], event)
self
end
@@ -1345,22 +790,11 @@ class Tk::TreeCtrl
list(tk_send('notify', 'eventnames'))
end
- def notify_generate(pattern, char_map=None, percents_cmd=None)
- pattern = "<#{pattern}>"
- tk_send('notify', 'generate', pattern, char_map, percents_cmd)
+ def notify_generate(pattern, char_map=None)
+ tk_send('notify', 'generate', pattern, char_map)
self
end
- def notify_install(pattern, percents_cmd=nil, &b)
- pattern = "<#{pattern}>"
- percents_cmd = Proc.new(&b) if !percents_cmd && b
- if percents_cmd
- procedure(tk_send('notify', 'install', pattern, percents_cmd))
- else
- procedure(tk_send('notify', 'install', pattern))
- end
- end
-
def notify_install_detail(event, detail, percents_cmd=nil, &b)
percents_cmd = Proc.new(&b) if !percents_cmd && b
if percents_cmd
@@ -1379,45 +813,8 @@ class Tk::TreeCtrl
end
end
- def notify_linkage(pattern, detail=None)
- if detail != None
- tk_send('notify', 'linkage', pattern, detail)
- else
- begin
- if pattern.to_s.index(?-)
- # TreeCtrl 1.1 format?
- begin
- tk_send('notify', 'linkage', "<#{pattern}>")
- rescue
- # TreeCtrl 1.0?
- tk_send('notify', 'linkage', pattern)
- end
- else
- # TreeCtrl 1.0 format?
- begin
- tk_send('notify', 'linkage', pattern)
- rescue
- # TreeCtrl 1.1?
- tk_send('notify', 'linkage', "<#{pattern}>")
- end
- end
- end
- end
- end
-
- def notify_unbind(pattern=nil)
- if pattern
- tk_send('notify', 'unbind', "<#{pattern}>")
- else
- tk_send('notify', 'unbind')
- end
- self
- end
-
- def notify_uninstall(pattern)
- pattern = "<#{pattern}>"
- tk_send('notify', 'uninstall', pattern)
- self
+ def notify_linkage(event, detail=None)
+ tk_send('notify', 'linkage', event, detail)
end
def notify_uninstall_detail(event, detail)
@@ -1433,25 +830,17 @@ class Tk::TreeCtrl
def numcolumns()
num_or_str(tk_send('numcolumns'))
end
- alias num_columns numcolumns
- alias columns_size numcolumns
def numitems()
num_or_str(tk_send('numitems'))
end
- alias num_items numitems
- alias items_size numitems
def orphans()
- list(tk_send('orphans')).collect!{|id|
- Tk::TreeCtrl::Item.id2obj(self, id)
- }
+ list(tk_send('orphans'))
end
def range(first, last)
- list(tk_send('range', first, last)).collect!{|id|
- Tk::TreeCtrl::Item.id2obj(self, id)
- }
+ list(tk_send('range', first, last))
end
def state_define(name)
@@ -1483,12 +872,11 @@ class Tk::TreeCtrl
end
def selection_anchor(item=None)
- id = num_or_str(tk_send('selection', 'anchor', item))
- Tk::TreeCtrl::Item.id2obj(self, id)
+ num_or_str(tk_send('selection', 'anchor', item))
end
def selection_clear(*args) # first, last
- tk_send('selection', 'clear', *args)
+ tk_send('selection', 'clear' *args)
self
end
@@ -1497,9 +885,7 @@ class Tk::TreeCtrl
end
def selection_get()
- list(tk_send('selection', 'get')).collect!{|id|
- Tk::TreeCtrl::Item.id2obj(self, id)
- }
+ list(tk_send('selection', 'get'))
end
def selection_includes(item)
@@ -1520,77 +906,34 @@ class Tk::TreeCtrl
end
def style_delete(*args)
- if Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[self.path]
- args.each{|sty|
- Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[self.path].delete(sty)
- }
- end
tk_send('style', 'delete', *args)
self
end
def style_elements(style, *elems)
if elems.empty?
- list(tk_send('style', 'elements', style)).collect!{|id|
- Tk::TreeCtrl::Element.id2obj(self, id)
- }
+ list(tk_send('style', 'elements', style))
else
tk_send('style', 'elements', style, elems.flatten)
self
end
end
- def _conv_style_layout_val(sty, val)
- case sty.to_s
- when 'padx', 'pady', 'ipadx', 'ipady'
- lst = list(val)
- (lst.size == 1)? lst[0]: lst
- when 'detach', 'indent'
- bool(val)
- when 'union'
- simplelist(val).collect!{|elem|
- Tk::TreeCtrl::Element.id2obj(self, elem)
- }
- else
- val
- end
- end
- private :_conv_style_layout_val
-
def style_layout(style, elem, keys=None)
if keys && keys != None
if keys.kind_of?(Hash)
tk_send('style', 'layout', style, elem, *hash_kv(keys))
self
else
- _conv_style_layout_val(keys,
- tk_send('style', 'layout',
- style, elem, "-#{keys}"))
+ tk_send('style', 'layout', style, elem, "-#{keys}")
end
else
- ret = Hash.new
- Hash[*simplelist(tk_send('style', 'layout', style, elem))].each{|k, v|
- k = k[1..-1]
- ret[k] = _conv_style_layout_val(k, v)
- }
- ret
- end
- end
- def get_style_layout(style, elem, opt=None)
- style_layout(style, elem, opt)
- end
- def set_style_layout(style, elem, slot, value=None)
- if slot.kind_of?(Hash)
- style_layout(style, elem, slot)
- else
- style_layout(style, elem, {slot=>value})
+ list(tk_send('style', 'layout', style, elem))
end
end
def style_names()
- list(tk_send('style', 'names')).collect!{|id|
- Tk::TreeCtrl::Style.id2obj(self, id)
- }
+ list(tk_send('style', 'names'))
end
def toggle(*items)
@@ -1603,709 +946,3 @@ class Tk::TreeCtrl
self
end
end
-
-#####################
-
-class Tk::TreeCtrl::Column < TkObject
- TreeCtrlColumnID_TBL = TkCore::INTERP.create_table
- TreeCtrlColumnID = ['treectrl_column'.freeze, '00000'.taint].freeze
-
- TkCore::INTERP.init_ip_env{Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.clear}
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[tpath]
- Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[tpath][id]? \
- Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[tpath][id] : id
- end
-
- def initialize(parent, keys={})
- @tree = parent
- @tpath = parent.path
-
- keys = _symbolkey2str(keys)
-
- @path = @id =
- keys.delete('tag') ||
- Tk::TreeCtrl::Column::TreeCtrlColumnID.join(TkCore::INTERP._ip_id_)
-
- keys['tag'] = @id
-
- unless Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath]
- Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath] = {}
- end
- Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath][@id] = self
- Tk::TreeCtrl::Column::TreeCtrlColumnID[1].succ!
-
- @tree.column_create(keys)
- end
-
- def id
- @id
- end
-
- def to_s
- @id.to_s.dup
- end
-
- def cget(opt)
- @tree.column_cget(@tree.column_index(@id), opt)
- end
-
- def configure(*args)
- @tree.column_configure(@tree.column_index(@id), *args)
- end
-
- def configinfo(*args)
- @tree.column_configinfo(@tree.column_index(@id), *args)
- end
-
- def current_configinfo(*args)
- @tree.current_column_configinfo(@tree.column_index(@id), *args)
- end
-
- def delete
- @tree.column_delete(@tree.column_index(@id))
- self
- end
-
- def index
- @tree.column_index(@id)
- end
-
- def move(before)
- @tree.column_move(@tree.column_index(@id), before)
- self
- end
-
- def needed_width
- @tree.column_needed_width(@tree.column_index(@id))
- end
- alias neededwidth needed_width
-
- def current_width
- @tree.column_width(@tree.column_index(@id))
- end
-end
-
-#####################
-
-class Tk::TreeCtrl::Element < TkObject
- TreeCtrlElementID_TBL = TkCore::INTERP.create_table
- TreeCtrlElementID = ['treectrl_element'.freeze, '00000'.taint].freeze
- TreeCtrlElemTypeToClass = {}
-
- TkCore::INTERP.init_ip_env{
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.clear
- }
-
- def self.type2class(type)
- TreeCtrlElemTypeToClass[type] || type
- end
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[tpath]
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[tpath][id]? \
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[tpath][id] : id
- end
-
- def initialize(parent, type, keys=nil)
- @tree = parent
- @tpath = parent.path
- @type = type.to_s
- @path = @id =
- Tk::TreeCtrl::Element::TreeCtrlElementID.join(TkCore::INTERP._ip_id_)
- unless Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath]
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath] = {}
- end
- Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath][@id] = self
- Tk::TreeCtrl::Element::TreeCtrlElementID[1].succ!
-
- @tree.element_create(@id, @type, keys)
- end
-
- def id
- @id
- end
-
- def to_s
- @id.dup
- end
-
- def cget(opt)
- @tree.element_cget(@id, opt)
- end
-
- def configure(*args)
- @tree.element_configure(@id, *args)
- end
-
- def configinfo(*args)
- @tree.element_configinfo(@id, *args)
- end
-
- def current_configinfo(*args)
- @tree.current_element_configinfo(@id, *args)
- end
-
- def delete
- @tree.element_delete(@id)
- self
- end
-
- def element_type
- @tree.element_type(@id)
- end
-
- def element_class
- @tree.element_class(@id)
- end
-end
-
-class Tk::TreeCtrl::BitmapElement < Tk::TreeCtrl::Element
- TreeCtrlElemTypeToClass['bitmap'] = self
-
- def initialize(parent, keys=nil)
- super(parent, 'bitmap', keys)
- end
-end
-
-class Tk::TreeCtrl::BorderElement < Tk::TreeCtrl::Element
- TreeCtrlElemTypeToClass['border'] = self
-
- def initialize(parent, keys=nil)
- super(parent, 'border', keys)
- end
-end
-
-class Tk::TreeCtrl::ImageElement < Tk::TreeCtrl::Element
- TreeCtrlElemTypeToClass['image'] = self
-
- def initialize(parent, keys=nil)
- super(parent, 'image', keys)
- end
-end
-
-class Tk::TreeCtrl::RectangleElement < Tk::TreeCtrl::Element
- TreeCtrlElemTypeToClass['rect'] = self
-
- def initialize(parent, keys=nil)
- super(parent, 'rect', keys)
- end
-end
-
-#####################
-
-class Tk::TreeCtrl::Item < TkObject
- TreeCtrlItemID_TBL = TkCore::INTERP.create_table
-
- TkCore::INTERP.init_ip_env{Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.clear}
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath]
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id]? \
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id] : id
- end
-
- def initialize(parent, keys={})
- @tree = parent
- @tpath = parent.path
- @path = @id = @tree.item_create(keys)
-
- unless Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath]
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] = {}
- end
- Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath][@id] = self
- end
-
- def id
- @id
- end
-
- def to_s
- @id.to_s.dup
- end
-
- def ancestors
- @tree.item_ancestors(@id)
- end
-
- def bbox(*args)
- @tree.item_bbox(@id, *args)
- end
-
- def children
- @tree.item_children(@id)
- end
-
- def collapse
- @tree.item_collapse(@id)
- self
- end
-
- def collapse_recurse
- @tree.item_collapse_recurse(@id)
- self
- end
-
- def complex(*args)
- @tree.item_complex(@id, *args)
- self
- end
-
- def cget(opt)
- @tree.item_cget(@id, opt)
- end
-
- def configure(*args)
- @tree.item_configure(@id, *args)
- end
-
- def configinfo(*args)
- @tree.item_configinfo(@id, *args)
- end
-
- def current_configinfo(*args)
- @tree.current_item_configinfo(@id, *args)
- end
-
- def delete
- @tree.item_delete(@id)
- self
- end
-
- def element_dump
- @tree.item_dump(@id)
- end
-
- def element_dump_hash
- @tree.item_dump_hash(@id)
- end
-
- def element_actual(column, elem, key)
- @tree.item_element_actual(@id, column, elem, key)
- end
-
- def element_cget(opt)
- @tree.item_element_cget(@id, opt)
- end
-
- def element_configure(*args)
- @tree.item_element_configure(@id, *args)
- end
-
- def element_configinfo(*args)
- @tree.item_element_configinfo(@id, *args)
- end
-
- def current_element_configinfo(*args)
- @tree.current_item_element_configinfo(@id, *args)
- end
-
- def expand
- @tree.item_expand(@id)
- self
- end
-
- def expand_recurse
- @tree.item_expand_recurse(@id)
- self
- end
-
- def firstchild(child=nil)
- if child
- @tree.item_firstchild(@id, child)
- self
- else
- @tree.item_firstchild(@id)
- end
- end
- alias first_child firstchild
-
- def hasbutton(st=None)
- if st == None
- @tree.item_hasbutton(@id)
- else
- @tree.item_hasbutton(@id, st)
- self
- end
- end
- alias has_button hasbutton
-
- def hasbutton?
- @tree.item_hasbutton(@id)
- end
- alias has_button? hasbutton?
-
- def index
- @tree.item_index(@id)
- end
-
- def isancestor(des)
- @tree.item_isancestor(@id, des)
- end
- alias is_ancestor isancestor
- alias isancestor? isancestor
- alias is_ancestor? isancestor
- alias ancestor? isancestor
-
- def isopen
- @tree.item_isopen(@id)
- end
- alias is_open isopen
- alias isopen? isopen
- alias is_open? isopen
- alias isopened? isopen
- alias is_opened? isopen
- alias open? isopen
-
- def lastchild(child=nil)
- if child
- @tree.item_lastchild(@id, child)
- self
- else
- @tree.item_lastchild(@id)
- end
- end
- alias last_child lastchild
-
- def nextsibling(nxt=nil)
- if nxt
- @tree.item_nextsibling(@id, nxt)
- self
- else
- @tree.item_nextsibling(@id)
- end
- end
- alias next_sibling nextsibling
-
- def numchildren
- @tree.item_numchildren(@id)
- end
- alias num_children numchildren
- alias children_size numchildren
-
- def parent_index
- @tree.item_parent(@id)
- end
-
- def prevsibling(nxt=nil)
- if nxt
- @tree.item_prevsibling(@id, nxt)
- self
- else
- @tree.item_prevsibling(@id)
- end
- end
- alias prev_sibling prevsibling
-
- def remove
- @tree.item_remove(@id)
- end
-
- def rnc
- @tree.item_rnc(@id)
- end
-
- def sort(*opts)
- @tree.item_sort(@id, *opts)
- end
- def sort_not_really(*opts)
- @tree.item_sort_not_really(@id, *opts)
- self
- end
-
- def state_forcolumn(column, *args)
- @tree.item_state_forcolumn(@id, column, *args)
- self
- end
- alias state_for_column state_forcolumn
-
- def state_get(*args)
- @tree.item_state_get(@id, *args)
- end
-
- def state_set(*args)
- @tree.item_state_set(@id, *args)
- self
- end
-
- def style_elements(column)
- @tree.item_style_elements(@id, column)
- end
-
- def style_map(column, style, map)
- @tree.item_style_map(@id, column, style, map)
- self
- end
-
- def style_set(column=nil, *args)
- if args.empty?
- @tree.item_style_set(@id, column)
- else
- @tree.item_style_set(@id, column, *args)
- self
- end
- end
-
- def item_text(column, txt=nil, *args)
- if args.empty?
- if txt
- @tree.item_text(@id, column, txt)
- self
- else
- @tree.item_text(@id, column)
- end
- else
- @tree.item_text(@id, column, txt, *args)
- self
- end
- end
-
- def toggle
- @tree.item_toggle(@id)
- self
- end
-
- def toggle_recurse
- @tree.item_toggle_recurse(@id)
- self
- end
-
- def visible(st=None)
- if st == None
- @tree.item_visible(@id)
- else
- @tree.item_visible(@id, st)
- self
- end
- end
-end
-
-#####################
-
-class Tk::TreeCtrl::Style < TkObject
- TreeCtrlStyleID_TBL = TkCore::INTERP.create_table
- TreeCtrlStyleID = ['treectrl_style'.freeze, '00000'.taint].freeze
-
- TkCore::INTERP.init_ip_env{ Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.clear }
-
- def self.id2obj(tree, id)
- tpath = tree.path
- return id unless Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[tpath]
- Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[tpath][id]? \
- Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[tpath][id] : id
- end
-
- def initialize(parent, keys=nil)
- @tree = parent
- @tpath = parent.path
- @path = @id =
- Tk::TreeCtrl::Style::TreeCtrlStyleID.join(TkCore::INTERP._ip_id_)
- unless Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath]
- Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath] = {}
- end
- Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath][@id] = self
- Tk::TreeCtrl::Style::TreeCtrlStyleID[1].succ!
-
- @tree.style_create(@id, keys)
- end
-
- def id
- @id
- end
-
- def to_s
- @id.dup
- end
-
- def cget(opt)
- @tree.style_cget(@id, opt)
- end
-
- def configure(*args)
- @tree.style_configure(@id, *args)
- end
-
- def configinfo(*args)
- @tree.style_configinfo(@id, *args)
- end
-
- def current_configinfo(*args)
- @tree.current_style_configinfo(@id, *args)
- end
-
- def delete
- @tree.style_delete(@id)
- self
- end
-
- def elements(*elems)
- if elems.empty?
- @tree.style_elements(@id)
- else
- @tree.style_elements(@id, *elems)
- self
- end
- end
-
- def layout(elem, keys=None)
- if keys && keys != None && keys.kind_of?(Hash)
- @tree.style_layout(@id, elem, keys)
- self
- else
- @tree.style_layout(@id, elem, keys)
- end
- end
-end
-
-module Tk::TreeCtrl::BindCallback
- include Tk
- extend Tk
-end
-
-class << Tk::TreeCtrl::BindCallback
- def percentsCmd(*args)
- tk_call('::TreeCtrl::PercentsCmd', *args)
- end
- def cursorCheck(w, x, y)
- tk_call('::TreeCtrl::CursorCheck', w, x, y)
- end
- def cursorCheckAux(w)
- tk_call('::TreeCtrl::CursorCheckAux', w)
- end
- def cursorCancel(w)
- tk_call('::TreeCtrl::CursorCancel', w)
- end
- def buttonPress1(w, x, y)
- tk_call('::TreeCtrl::ButtonPress1', w, x, y)
- end
- def doubleButton1(w, x, y)
- tk_call('::TreeCtrl::DoubleButton1', w, x, y)
- end
- def motion1(w, x, y)
- tk_call('::TreeCtrl::Motion1', w, x, y)
- end
- def leave1(w, x, y)
- tk_call('::TreeCtrl::Leave1', w, x, y)
- end
- def release1(w, x, y)
- tk_call('::TreeCtrl::Release1', w, x, y)
- end
- def beginSelect(w, el)
- tk_call('::TreeCtrl::BeginSelect', w, el)
- end
- def motion(w, le)
- tk_call('::TreeCtrl::Motion', w, el)
- end
- def beginExtend(w, el)
- tk_call('::TreeCtrl::BeginExtend', w, el)
- end
- def beginToggle(w, el)
- tk_call('::TreeCtrl::BeginToggle', w, el)
- end
- def cancelRepeat
- tk_call('::TreeCtrl::CancelRepeat')
- end
- def autoScanCheck(w, x, y)
- tk_call('::TreeCtrl::AutoScanCheck', w, x, y)
- end
- def autoScanCheckAux(w)
- tk_call('::TreeCtrl::AutoScanCheckAux', w)
- end
- def autoScanCancel(w)
- tk_call('::TreeCtrl::AutoScanCancel', w)
- end
- def up_down(w, n)
- tk_call('::TreeCtrl::UpDown', w, n)
- end
- def left_right(w, n)
- tk_call('::TreeCtrl::LeftRight', w, n)
- end
- def setActiveItem(w, idx)
- tk_call('::TreeCtrl::SetActiveItem', w, idx)
- end
- def extendUpDown(w, amount)
- tk_call('::TreeCtrl::ExtendUpDown', w, amount)
- end
- def dataExtend(w, el)
- tk_call('::TreeCtrl::DataExtend', w, el)
- end
- def cancel(w)
- tk_call('::TreeCtrl::Cancel', w)
- end
- def selectAll(w)
- tk_call('::TreeCtrl::selectAll', w)
- end
- def marqueeBegin(w, x, y)
- tk_call('::TreeCtrl::MarqueeBegin', w, x, y)
- end
- def marqueeUpdate(w, x, y)
- tk_call('::TreeCtrl::MarqueeUpdate', w, x, y)
- end
- def marqueeEnd(w, x, y)
- tk_call('::TreeCtrl::MarqueeEnd', w, x, y)
- end
- def scanMark(w, x, y)
- tk_call('::TreeCtrl::ScanMark', w, x, y)
- end
- def scanDrag(w, x, y)
- tk_call('::TreeCtrl::ScanDrag', w, x, y)
- end
-
- # filelist-bindings
- def fileList_button1(w, x, y)
- tk_call('::TreeCtrl::FileListButton1', w, x, y)
- end
- def fileList_motion1(w, x, y)
- tk_call('::TreeCtrl::FileListMotion1', w, x, y)
- end
- def fileList_motion(w, x, y)
- tk_call('::TreeCtrl::FileListMotion', w, x, y)
- end
- def fileList_leave1(w, x, y)
- tk_call('::TreeCtrl::FileListLeave1', w, x, y)
- end
- def fileList_release1(w, x, y)
- tk_call('::TreeCtrl::FileListRelease1', w, x, y)
- end
- def fileList_edit(w, i, s, e)
- tk_call('::TreeCtrl::FileListEdit', w, i, s, e)
- end
- def fileList_editCancel(w)
- tk_call('::TreeCtrl::FileListEditCancel', w)
- end
- def fileList_autoScanCheck(w, x, y)
- tk_call('::TreeCtrl::FileListAutoScanCheck', w, x, y)
- end
- def fileList_autoScanCheckAux(w)
- tk_call('::TreeCtrl::FileListAutoScanCheckAux', w)
- end
-
- def entryOpen(w, item, col, elem)
- tk_call('::TreeCtrl::EntryOpen', w, item, col, elem)
- end
- def entryExpanderOpen(w, item, col, elem)
- tk_call('::TreeCtrl::EntryExpanderOpen', w, item, col, elem)
- end
- def entryClose(w, accept)
- tk_call('::TreeCtrl::EntryClose', w, accept)
- end
- def entryExpanderKeypress(w)
- tk_call('::TreeCtrl::EntryExpanderKeypress', w)
- end
- def textOpen(w, item, col, elem, width=0, height=0)
- tk_call('::TreeCtrl::TextOpen', w, item, col, elem, width, height)
- end
- def textExpanderOpen(w, item, col, elem, width)
- tk_call('::TreeCtrl::TextOpen', w, item, col, elem, width)
- end
- def textClose(w, accept)
- tk_call('::TreeCtrl::TextClose', w, accept)
- end
- def textExpanderKeypress(w)
- tk_call('::TreeCtrl::TextExpanderKeypress', w)
- end
-end
diff --git a/ext/tk/lib/tkextlib/trofs.rb b/ext/tk/lib/tkextlib/trofs.rb
deleted file mode 100644
index 5914e5165f..0000000000
--- a/ext/tk/lib/tkextlib/trofs.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# trofs support
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-# call setup script for general 'tkextlib' libraries
-require 'tkextlib/setup.rb'
-
-# call setup script
-require 'tkextlib/trofs/setup.rb'
-
-# load library
-require 'tkextlib/trofs/trofs.rb'
diff --git a/ext/tk/lib/tkextlib/trofs/setup.rb b/ext/tk/lib/tkextlib/trofs/setup.rb
deleted file mode 100644
index ce0f0bd4d4..0000000000
--- a/ext/tk/lib/tkextlib/trofs/setup.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# setup.rb -- setup script before calling TkPackage.require()
-#
-# If you need some setup operations (for example, add a library path
-# to the library search path) before using Tcl/Tk library packages
-# wrapped by Ruby scripts in this directory, please write the setup
-# operations in this file.
-#
diff --git a/ext/tk/lib/tkextlib/trofs/trofs.rb b/ext/tk/lib/tkextlib/trofs/trofs.rb
deleted file mode 100644
index 7a2606a275..0000000000
--- a/ext/tk/lib/tkextlib/trofs/trofs.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# tkextlib/trofs/trofs.rb
-# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-
-require 'tk'
-
-# call setup script for general 'tkextlib' libraries
-require 'tkextlib/setup.rb'
-
-# call setup script
-require 'tkextlib/trofs/setup.rb'
-
-# TkPackage.require('trofs', '0.4')
-TkPackage.require('trofs')
-
-module Tk
- module Trofs
- extend TkCore
-
- PACKAGE_NAME = 'trofs'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
- def self.package_version
- begin
- TkPackage.require('trofs')
- rescue
- ''
- end
- end
-
- ##############################################
-
- def self.create_archive(dir, archive)
- tk_call('::trofs::archive', dir, archive)
- archive
- end
-
- def self.mount(archive, mountpoint=None)
- # returns the normalized path to mountpoint
- tk_call('::trofs::mount', archive, mountpoint)
- end
-
- def self.umount(mountpoint)
- tk_call('::trofs::umount', mountpoint)
- mountpoint
- end
- end
-end
diff --git a/ext/tk/lib/tkextlib/vu.rb b/ext/tk/lib/tkextlib/vu.rb
index d2234eb2a8..c4ea1b86e6 100644
--- a/ext/tk/lib/tkextlib/vu.rb
+++ b/ext/tk/lib/tkextlib/vu.rb
@@ -20,11 +20,6 @@ module Tk
module Vu
TkComm::TkExtlibAutoloadModule.unshift(self)
- PACKAGE_NAME = 'vu'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('vu')
diff --git a/ext/tk/lib/tkextlib/vu/bargraph.rb b/ext/tk/lib/tkextlib/vu/bargraph.rb
index 27ff3c7cd0..3ac08a26a5 100644
--- a/ext/tk/lib/tkextlib/vu/bargraph.rb
+++ b/ext/tk/lib/tkextlib/vu/bargraph.rb
@@ -28,16 +28,6 @@ class Tk::Vu::Bargraph < TkWindow
end
private :__boolval_optkeys
- def __strval_optkeys
- super() + [
- 'title',
- 'barbackground', 'barcolor', 'barcolour',
- 'tickcolor', 'tickcolour',
- 'textcolor', 'textcolour',
- ]
- end
- private :__strval_optkeys
-
def __listval_optkeys
['alabels', 'blabels']
end
diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb
index ee4298fa1c..a578c6979b 100644
--- a/ext/tk/lib/tkextlib/vu/charts.rb
+++ b/ext/tk/lib/tkextlib/vu/charts.rb
@@ -17,12 +17,6 @@ module Tk
end
private :__item_boolval_optkeys
- def __item_strval_optkeys(id)
- super(id) << 'bar' << 'color' << 'outline' <<
- 'fill' << 'scaleline' << 'stripline'
- end
- private :__item_strval_optkeys
-
def __item_listval_optkeys(id)
super(id) << 'values' << 'tags'
end
diff --git a/ext/tk/lib/tkextlib/vu/pie.rb b/ext/tk/lib/tkextlib/vu/pie.rb
index 78f3fa54da..dc676ad765 100644
--- a/ext/tk/lib/tkextlib/vu/pie.rb
+++ b/ext/tk/lib/tkextlib/vu/pie.rb
@@ -127,7 +127,7 @@ class Tk::Vu::PieSlice
def initialize(parent, *args)
unless parent.kind_of?(Tk::Vu::Pie)
- fail ArgumentError, "expect a Tk::Vu::Pie instance for 1st argument"
+ fail ArguemntError, "expect a Tk::Vu::Pie instance for 1st argument"
end
@parent = @pie = parent
@ppath = parent.path
@@ -218,7 +218,7 @@ class Tk::Vu::NamedPieSlice
def initialize(parent, name, *args)
unless parent.kind_of?(Tk::Vu::Pie)
- fail ArgumentError, "expect a Tk::Vu::Pie instance for 1st argument"
+ fail ArguemntError, "expect a Tk::Vu::Pie instance for 1st argument"
end
@parent = @pie = parent
@ppath = parent.path
diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb
index c53a3ff48c..1e2f1c0062 100644
--- a/ext/tk/lib/tkextlib/winico/winico.rb
+++ b/ext/tk/lib/tkextlib/winico/winico.rb
@@ -12,16 +12,10 @@ require 'tkextlib/setup.rb'
require 'tkextlib/winico/setup.rb'
# TkPackage.require('winico', '0.5')
-# TkPackage.require('winico', '0.6')
TkPackage.require('winico')
module Tk
class Winico < TkObject
- PACKAGE_NAME = 'winico'.freeze
- def self.package_name
- PACKAGE_NAME
- end
-
def self.package_version
begin
TkPackage.require('winico')
diff --git a/ext/tk/sample/24hr_clock.rb b/ext/tk/sample/24hr_clock.rb
deleted file mode 100644
index 60d8072c57..0000000000
--- a/ext/tk/sample/24hr_clock.rb
+++ /dev/null
@@ -1,286 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'tk'
-
-class Clock
- def initialize(clock24 = true)
- @clock = (clock24)? 24: 12
-
- @size = 200
- @cdot_size = 5
-
- @cdot_color = 'black'
- @hour_hand_color = 'black'
- @minute_hand_color = 'gray25'
- @second_hand_color = 'gray50'
-
- @mark_font = 'Helvetica -14'
- @mark_width = 3
- @mark_color = 'black'
- @submark_color = 'gray50'
-
- @c = TkCanvas.new(:width=>2*@size, :height=>2*@size,
- :scrollregion=>[-@size, -@size, @size, @size]
- ).pack(:fill=>:both, :expand=>true)
-
- @tag = TkcTag.new(@c)
- @hand_tag = TkcTag.new(@c)
-
- @circle_coords = [[-0.9*@size, -0.9*@size], [0.9*@size, 0.9*@size]]
- @oval = TkcOval.new(@c, @circle_coords, :fill=>'white', :tags=>[@tag])
-
- f = TkFrame.new.pack
- TkLabel.new(f, :text=>'CURRENT:').pack(:side=>:left)
- @now = TkLabel.new(f, :text=>'00:00:00').pack(:side=>:left, :padx=>2)
- TkLabel.new(f, :text=>' ').pack(:side=>:left)
- TkLabel.new(f, :text=>' ').pack(:side=>:right)
- @l = TkLabel.new(f, :text=>'00:00').pack(:side=>:right, :padx=>2)
- TkLabel.new(f, :text=>'MOUSE-POINTER:').pack(:side=>:right)
-
- cmd = proc{|x, y|
- @l.text = '%02d:%02d' % coords_to_time(@c.canvasx(x), @c.canvasy(y))
- }
- @c.bind('Motion', cmd, '%x %y')
- @tag.bind('Motion', cmd, '%x %y')
-
- _create_hands
- _create_marks
-
- timer_proc = proc{
- t = Time.now
- @now.text = '%02d:%02d:%02d' % [t.hour, t.min, t.sec]
- set_hands(t.hour, t.min, t.sec)
- }
-
- timer_proc.call
- @timer = TkRTTimer.start(100, -1, timer_proc)
- end
-
- def _create_marks
- @mark_tag = TkcTag.new(@c)
-
- TkcLine.new(@c, 0, -0.90*@size, 0, -0.85*@size,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
- TkcLine.new(@c, 0.90*@size, 0, 0.85*@size, 0,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
- TkcLine.new(@c, 0, 0.90*@size, 0, 0.85*@size,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
- TkcLine.new(@c, -0.90*@size, 0, -0.85*@size, 0,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
-
- TkcText.new(@c, [0, -0.92*@size], :text=>0,
- :anchor=>'s', :fill=>@mark_color)
- TkcText.new(@c, [0.92*@size, 0], :text=>@clock.div(4),
- :anchor=>'w', :fill=>@mark_color)
- TkcText.new(@c, [0, 0.92*@size], :text=>@clock.div(2),
- :anchor=>'n', :fill=>@mark_color)
- TkcText.new(@c, [-0.92*@size, 0], :text=>@clock.div(4)*3,
- :anchor=>'e', :fill=>@mark_color)
-
- [30.0, 60.0].each{|angle|
- rad = Math::PI * angle / 180.0
- x_base = @size*Math::sin(rad)
- y_base = @size*Math::cos(rad)
-
- x1 = 0.90*x_base
- y1 = 0.90*y_base
-
- x2 = 0.85*x_base
- y2 = 0.85*y_base
-
- TkcLine.new(@c, x1, y1, x2, y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
- TkcLine.new(@c, x1, -y1, x2, -y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
- TkcLine.new(@c, -x1, y1, -x2, y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
- TkcLine.new(@c, -x1, -y1, -x2, -y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@mark_color)
-
- x3 = 0.92*x_base
- y3 = 0.92*y_base
-
- if @clock == 24
- dh = angle.to_i/15
- else # @clock == 12
- dh = angle.to_i/30
- end
-
- TkcText.new(@c, x3, -y3, :text=>dh,
- :anchor=>'sw', :fill=>@mark_color)
- TkcText.new(@c, x3, y3, :text=>@clock.div(2)-dh,
- :anchor=>'nw', :fill=>@mark_color)
- TkcText.new(@c, -x3, y3, :text=>@clock.div(2)+dh,
- :anchor=>'ne', :fill=>@mark_color)
- TkcText.new(@c, -x3, -y3, :text=>@clock-dh,
- :anchor=>'se', :fill=>@mark_color)
- }
-
- if @clock == 24
- [15.0, 45.0, 75.0].each{|angle|
- rad = Math::PI * angle / 180.0
- x_base = @size*Math::sin(rad)
- y_base = @size*Math::cos(rad)
-
- x1 = 0.90*x_base
- y1 = 0.90*y_base
-
- x2 = 0.875*x_base
- y2 = 0.875*y_base
-
- TkcLine.new(@c, x1, y1, x2, y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@submark_color)
- TkcLine.new(@c, x1, -y1, x2, -y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@submark_color)
- TkcLine.new(@c, -x1, y1, -x2, y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@submark_color)
- TkcLine.new(@c, -x1, -y1, -x2, -y2,
- :tags=>[@tag, @mark_tag],
- :width=>@mark_width, :fill=>@submark_color)
- }
- end
- end
-
- def _create_hands
- hour_hand_len = 0.55*@size
- minute_hand_len = 0.85*@size
- second_hand_len = 0.88*@size
-
- hour_hand_width = 1.8*@cdot_size
- minute_hand_width = 1.0*@cdot_size
- second_hand_width = 1 # 0.4*@cdot_size
-
- @hour_hand_coords = [
- [0, -0.5*@cdot_size],
- [hour_hand_width, -0.5*@cdot_size-hour_hand_width],
- [hour_hand_width, -hour_hand_len+hour_hand_width],
- [0, -hour_hand_len],
- [-hour_hand_width, -hour_hand_len+hour_hand_width],
- [-hour_hand_width, -0.5*@cdot_size-hour_hand_width],
- ]
- @minute_hand_coords = [
- [0, -0.5*@cdot_size],
- [minute_hand_width, -0.5*@cdot_size - minute_hand_width],
- [minute_hand_width, -minute_hand_len+minute_hand_width],
- [0, -minute_hand_len],
- [-minute_hand_width, -minute_hand_len+minute_hand_width],
- [-minute_hand_width, -0.5*@cdot_size-minute_hand_width],
- ]
- @second_hand_coords = [
- [0, -0.5*@cdot_size],
- [second_hand_width, -0.5*@cdot_size - second_hand_width],
- [second_hand_width, -second_hand_len+second_hand_width],
- [0, -second_hand_len],
- [-second_hand_width, -second_hand_len+second_hand_width],
- [-second_hand_width, -0.5*@cdot_size-second_hand_width],
- ]
-
- @hour_hand = TkcPolygon.new(@c, @hour_hand_coords,
- :tags=>[@tag, @hand_tag],
- :outline=>@hour_hand_color,
- :fill=>@hour_hand_color)
-
- @minute_hand = TkcPolygon.new(@c, @minute_hand_coords,
- :tags=>[@tag, @hand_tag],
- :outline=>@minute_hand_color,
- :fill=>@minute_hand_color)
-
- @second_hand = TkcPolygon.new(@c, @second_hand_coords,
- :tags=>[@tag, @hand_tag],
- :outline=>@second_hand_color,
- :fill=>@second_hand_color)
-
- @center_dot = TkcOval.new(@c,
- [-@cdot_size, -@cdot_size],
- [@cdot_size, @cdot_size],
- :outline=>@cdot_color, :fill=>@cdot_color)
- end
- private :_create_hands
-
- def _raise_hands
- @hour_hand.raise
- @minute_hand.raise
- @second_hand.raise
- @center_dot.raise
- end
- private :_raise_hands
-
- def _raise_marks
- @mark_tag.raise
- end
- private :_raise_marks
-
- def set_hands(hh, mm, ss)
- ss_angle = Math::PI * ss / 30.0
- mm_angle = Math::PI * (mm + ss/60.0) / 30.0
- hh_angle = Math::PI * (hh + (mm + ss/60.0)/60.0) / (@clock.div(2))
-
- @second_hand.coords = @second_hand_coords.collect{|x, y|
- r = Math::hypot(y, x)
- a = Math::atan2(y, x) + ss_angle
- [Math::cos(a) * r, Math::sin(a) * r]
- }
-
- @minute_hand.coords = @minute_hand_coords.collect{|x, y|
- r = Math::hypot(y, x)
- a = Math::atan2(y, x) + mm_angle
- [Math::cos(a) * r, Math::sin(a) * r]
- }
-
- @hour_hand.coords = @hour_hand_coords.collect{|x, y|
- r = Math::hypot(y, x)
- a = Math::atan2(y, x) + hh_angle
- [Math::cos(a) * r, Math::sin(a) * r]
- }
-
- _raise_hands
- _raise_marks
- end
-
- def coords_to_time(x, y)
- return ((y < 0)? [0, 0]: [@clock.div(2), 0]) if x == 0
- if @clock == 24
- offset = (x<0&&y<0)? 1800.0: 360.0
- m_half = 720.0
- else # @clock == 12
- offset = (x<0&&y<0)? 900.0: 180.0
- m_half = 360.0
- end
- (offset + m_half*Math.atan2(y,x)/Math::PI).round.divmod(60)
- end
-
- def create_pie(hh, mm, span, color='red')
- if @clock == 24
- start = 90.0 - (hh*60 + mm)/4.0 # 360.0*(hh*60+mm)/(24*60)
- extent = -span/4.0
- else # @clock == 12
- start = 90.0 - (hh*60 + mm)/2.0 # 360.0*(hh*60+mm)/(12*60)
- extent = -span/2.0
- end
-
- pie = TkcArc.new(@c, @circle_coords, :tags=>[@tag],
- :outline=>'black', 'fill'=>color,
- :start=>start, :extent=>extent)
- _raise_hands
- _raise_marks
- pie
- end
-end
-
-sched = Clock.new
-sched.create_pie(0,0, 60) # 60 minutes from 00:00
-sched.create_pie(6,30, 280, 'green') # 280 minutes from 06:30
-sched.create_pie(15,20, 90, 'blue') # 90 minutes from 15:20
-
-Tk.mainloop
diff --git a/ext/tk/sample/cd_timer.rb b/ext/tk/sample/cd_timer.rb
deleted file mode 100644
index 9154e89bfe..0000000000
--- a/ext/tk/sample/cd_timer.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env ruby
-#
-# countdown timer
-# usage: cd_timer min [, min ... ]
-# ( e.g. cd_timer 0.5 1 3 5 10 )
-#
-require 'tk'
-
-if ARGV.empty?
- $stderr.puts 'Error:: No time arguments for counting down'
- exit(1)
-end
-
-width = 10
-
-TkButton.new(:text=>'exit',
- :command=>proc{exit}).pack(:side=>:bottom, :fill=>:x)
-
-b = TkButton.new(:text=>'start').pack(:side=>:top, :fill=>:x)
-
-f = TkFrame.new(:relief=>:ridge, :borderwidth=>2).pack(:fill=>:x)
-TkLabel.new(f, :relief=>:flat, :pady=>3,
- :background=>'black', :foreground=>'white',
- :text=>' elapsed: ').pack(:fill=>:x, :side=>:left, :expand=>true)
-now = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w,
- :background=>'black', :foreground=>'white',
- :text=>'%4d:%02d.00' % [0, 0]).pack(:side=>:right)
-
-timers = [ TkRTTimer.new(10){|tm|
- t = (tm.return_value || 0) + 1
- s, u = t.divmod(100)
- m, s = s.divmod(60)
- now.text('%4d:%02d.%02d' % [m, s, u])
- t
- }.set_start_proc(0, proc{
- now.text('%4d:%02d.00' % [0,0])
- now.foreground('white')
- 0
- })
-]
-
-ARGV.collect{|arg| (Float(arg) * 60).to_i}.sort.each_with_index{|time, idx|
- f = TkFrame.new(:relief=>:ridge, :borderwidth=>2).pack(:fill=>:x)
- TkLabel.new(f, :relief=>:flat, :pady=>3,
- :text=>' %4d:%02d --> ' % (time.divmod(60))).pack(:side=>:left)
- l = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w,
- :text=>'%4d:%02d' % (time.divmod(60))).pack(:side=>:right)
- timers << TkRTTimer.new(1000){|tm|
- t = (tm.return_value || time) - 1
- if t < 0
- l.text('%4d:%02d' % ((-t).divmod(60)))
- else
- l.text('%4d:%02d' % (t.divmod(60)))
- end
- if t.zero?
- l.foreground('red')
- idx.times{Tk.bell}
- end
- t
- }.set_start_proc(0, proc{
- l.text('%4d:%02d' % (time.divmod(60)))
- l.foreground('black')
- time
- })
-}
-
-mode = :start
-b.command(proc{
- if mode == :start
- timers.each{|timer| timer.restart}
- b.text('reset')
- mode = :reset
- else
- timers.each{|timer| timer.stop.reset}
- b.text('start')
- mode = :start
- end
- })
-
-Tk.mainloop
-
diff --git a/ext/tk/sample/demos-en/anilabel.rb b/ext/tk/sample/demos-en/anilabel.rb
deleted file mode 100644
index f063bc53a4..0000000000
--- a/ext/tk/sample/demos-en/anilabel.rb
+++ /dev/null
@@ -1,172 +0,0 @@
-#
-# animated label widget demo (called by 'widget')
-#
-# based on Tcl/Tk8.5a2 widget demos
-
-if defined?($anilabel_demo) && $anilabel_demo
- $anilabel_demo.destroy
- $anilabel_demo = nil
-end
-
-# demo toplevel widget
-$anilabel_demo = TkToplevel.new {|w|
- title("Animated Label Demonstration")
- iconname("anilabel")
- positionWindow(w)
-}
-
-# label
-msg = TkLabel.new($anilabel_demo) {
- font $font
- wraplength '4i'
- justify 'left'
- text "Four animated labels are displayed below; each of the labels on the left is animated by making the text message inside it appear to scroll, and the label on the right is animated by animating the image that it displays."
-}
-msg.pack('side'=>'top')
-
-# frame
-TkFrame.new($anilabel_demo) {|frame|
- TkButton.new(frame) {
- text 'Dismiss'
- command proc{
- tmppath = $anilabel_demo
- $anilabel_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text 'See Code'
- command proc{showCode 'anilabel'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-
-# create frame for label demo
-f_left = TkLabelFrame.new($anilabel_demo, :text=>'Scrolling Texts')
-f_right = TkLabelFrame.new($anilabel_demo, :text=>'GIF Image')
-Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both',
- 'padx'=>10, 'pady'=>10)
-
-# animated label
-class AnimatedTextLabel < TkLabel
- def initialize(*args)
- super(*args)
- @timer = TkTimer.new{ _animation_callback }
- @timer.loop_exec = -1
- # bind('Destroy'){ @timer.stop }
- @btag = TkBindTag.new('Destroy'){ @timer.stop }
- self.bindtags_unshift(@btag)
- end
-
- def _animation_callback()
- txt = self.text
- self.text = (txt[1..-1] << txt[0])
- end
- private :_animation_callback
-
- def start(interval)
- @timer.set_interval(interval)
- @timer.start
- end
-
- def stop
- @timer.stop
- end
-end
-
-# animated image
-class AnimatedImageLabel < AnimatedTextLabel
- def initialize(*args)
- super(*args)
- @destroy_image = false
- @btag.bind_append('Destroy'){
- if @destroy_image
- begin
- self.image.delete
- rescue
- end
- end
- }
- end
- attr_accessor :destroy_image
-
- def _animation_callback()
- img = self.image
-
- fmt = img.format
- if fmt.kind_of?(Array)
- if fmt[1].kind_of?(Hash)
- # fmt == ['GIF', {'index'=>idx}]
- idx = fmt[1]['index']
- else
- # fmt == ['GIF', '-index', idx] :: Ruby1.8.2 returns this.
- idx = fmt[2]
- end
- elsif fmt.kind_of?(String) && fmt =~ /GIF -index (\d+)/
- idx = $1.to_i
- else
- idx = -1
- end
-
- begin
- img.format("GIF -index #{idx + 1}")
- rescue => e
- img.format("GIF -index 0")
- end
- end
- private :_animation_callback
-end
-
-# create labels
-l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge,
- :font=>{:family=>'Courier', :size=>10})
-l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove,
- :font=>{:family=>'Courier', :size=>10})
-l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat,
- :font=>{:family=>'Courier', :size=>10}, :width=>18)
-Tk.pack(l1, l2, l3,
- :side=>:top, :expand=>true, :anchor=>:w, :padx=>10, :pady=>10)
-
-limg = AnimatedImageLabel.new(f_right, :borderwidth=>0)
-limg.pack(:side=>:top, :expand=>true, :padx=>10, :pady=>10)
-
-# base64-encoded animated GIF file
-tclPowerdData = <<EOD
- R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM
- zMyZmcyZZsxmZsxmAMwzAJnMzJmZzJmZmZlmmZlmZplmM5kzM2aZzGZmzGZm
- mWZmZmYzZmYzMzNmzDMzZgAzmSH+IE1hZGUgd2l0aCBHSU1QIGJ5IExARGVt
- YWlsbHkuY29tACH5BAVkAAEALAAAAAAqAEAAAAX+YCCOZEkyTKM2jOm66yPP
- dF03bx7YcuHIDkGBR7SZeIyhTID4FZ+4Es8nQyCe2EeUNJ0peY2s9mi7PhAM
- ngEAMGRbUpvzSxskLh1J+Hkg134OdDIDEB+GHxtYMEQMTjMGEYeGFoomezaC
- DZGSHFmLXTQKkh8eNQVpZ2afmDQGHaOYSoEyhhcklzVmMpuHnaZmDqiGJbg0
- qFqvh6UNAwB7VA+OwydEjgujkgrPNhbTI8dFvNgEYcHcHx0lB1kX2IYeA2G6
- NN0YfkXJ2BsAMuAzHB9cZMk3qoEbRzUACsRCUBK5JxsC3iMiKd8GN088SIyT
- 0RAFSROyeEg38caDiB/+JEgqxsODrZJ1BkT0oHKSmI0ceQxo94HDpg0qsuDk
- UmRAMgu8OgwQ+uIJgUMVeGXA+IQkzEeHGvD8cIGlDXsLiRjQ+EHroQhea7xY
- 8IQBSgYYDi1IS+OFBCgaDMGVS3fGi5BPJpBaENdQ0EomKGD56IHwO39EXiSC
- Ysgxor5+Xfgq0qByYUpiXmwuoredB2aYH4gWWda0B7SeNENpEJHC1ghi+pS4
- AJpIAwWvKPBi+8YEht5EriEqpFfMlhEdkBNpx0HUhwypx5T4IB1MBg/Ws2sn
- wV3MSQOkzI8fUd48Aw3dOZto71x85hHtHijYv18Gf/3GqCdDCXHNoICBobSo
- IqBqJLyCoH8JPrLgdh88CKCFD0CGmAiGYPgffwceZh6FC2ohIIklnkhehTNY
- 4CIHHGzgwYw01ujBBhvAqKOLLq5AAk9kuSPkkKO40NB+h1gnypJIIvkBf09a
- N5QIRz5p5ZJXJpmlIVhOGQA2TmIJZZhKKmmll2BqyWSXWUrZpQtpatlmk1c2
- KaWRHeTZEJF8SqLDn/hhsOeQgBbqAh6DGqronxeARUIIACH5BAUeAAAALAUA
- LgAFAAUAAAUM4CeKz/OV5YmqaRkCACH5BAUeAAEALAUALgAKAAUAAAUUICCK
- z/OdJVCaa7p+7aOWcDvTZwgAIfkEBR4AAQAsCwAuAAkABQAABRPgA4zP95zA
- eZqoWqqpyqLkZ38hACH5BAUKAAEALAcALgANAA4AAAU7ICA+jwiUJEqeKau+
- r+vGaTmac63v/GP9HM7GQyx+jsgkkoRUHJ3Qx0cK/VQVTKtWwbVKn9suNunc
- WkMAIfkEBQoAAAAsBwA3AAcABQAABRGgIHzk842j+Yjlt5KuO8JmCAAh+QQF
- CgAAACwLADcABwAFAAAFEeAnfN9TjqP5oOWziq05lmUIACH5BAUKAAAALA8A
- NwAHAAUAAAUPoPCJTymS3yiQj4qOcPmEACH5BAUKAAAALBMANwAHAAUAAAUR
- oCB+z/MJX2o+I2miKimiawgAIfkEBQoAAAAsFwA3AAcABQAABRGgIHzfY47j
- Q4qk+aHl+pZmCAAh+QQFCgAAACwbADcABwAFAAAFEaAgfs/zCV9qPiNJouo7
- ll8IACH5BAUKAAAALB8ANwADAAUAAAUIoCB8o0iWZggAOw==
-EOD
-
-l1.text('* Slow Animation *').start(300)
-l2.text('* Fast Animation *').start(80)
-l3.text('This is a longer scrolling text in a widget that will not show the whole message at once. ').start(150)
-
-limg.destroy_image = true
-limg.image(TkPhotoImage.new(:format=>'GIF', :data=>tclPowerdData)).start(100)
diff --git a/ext/tk/sample/demos-en/aniwave.rb b/ext/tk/sample/demos-en/aniwave.rb
deleted file mode 100644
index ebe27b875f..0000000000
--- a/ext/tk/sample/demos-en/aniwave.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-#
-# animated wave demo (called by 'widget')
-#
-# based on Tcl/Tk8.5a2 widget demos
-
-# destroy toplevel widget for this demo script
-if defined?($aniwave_demo) && $aniwave_demo
- $aniwave_demo.destroy
- $aniwave_demo = nil
-end
-
-# create toplevel widget
-$aniwave_demo = TkToplevel.new {|w|
- title("Animated Wave Demonstration")
- iconname("aniwave")
- positionWindow(w)
-}
-
-# create label
-msg = TkLabel.new($aniwave_demo) {
- font $font
- wraplength '4i'
- justify 'left'
- text 'This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line.'
-}
-msg.pack('side'=>'top')
-
-# create frame
-TkFrame.new($aniwave_demo) {|frame|
- TkButton.new(frame) {
- text 'Dismiss'
- command proc{
- tmppath = $aniwave_demo
- $aniwave_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text 'See Code'
- command proc{showCode 'aniwave'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-
-# animated wave
-class AnimatedWaveDemo
- def initialize(frame, dir=:left)
- @direction = dir
-
- # create canvas widget
- @c = TkCanvas.new(frame, :width=>300, :height=>200,
- :background=>'black')
- @c.pack(:padx=>10, :pady=>10, :expand=>true)
-
- # Creates a coordinates list of a wave.
- @waveCoords = []
- @backupCoords = []
- n = 0
- (-10..300).step(5){|n| @waveCoords << [n, 100]; @backupCoords << [n, 100] }
- @waveCoords << [n, 0]; @backupCoords << [n, 0]
- @waveCoords << [n+5, 200]; @backupCoords << [n+5, 200]
- @coordsLen = @waveCoords.length
-
- # Create a smoothed line and arrange for its coordinates to be the
- # contents of the variable waveCoords.
- @line = TkcLine.new(@c, @waveCoords,
- :width=>1, :fill=>'green', :smooth=>true)
-
- # Main animation "loop".
- # Theoretically 100 frames-per-second (==10ms between frames)
- @timer = TkTimer.new(10){ basicMotion; reverser }
-
- # Arrange for the animation loop to stop when the canvas is deleted
- @c.bindtags_unshift(TkBindTag.new('Destroy'){ @timer.stop })
- end
-
- # Basic motion handler. Given what direction the wave is travelling
- # in, it advances the y coordinates in the coordinate-list one step in
- # that direction.
- def basicMotion
- @backupCoords, @waveCoords = @waveCoords, @backupCoords
- (0...@coordsLen).each{|idx|
- if @direction == :left
- @waveCoords[idx][1] = @backupCoords[(idx+1 == @coordsLen)? 0: idx+1][1]
- else
- @waveCoords[idx][1] = @backupCoords[(idx == 0)? -1: idx-1][1]
- end
- }
- @line.coords(@waveCoords)
- end
-
- # Oscillation handler. This detects whether to reverse the direction
- # of the wave by checking to see if the peak of the wave has moved off
- # the screen (whose size we know already.)
- def reverser
- if @waveCoords[0][1] < 10
- @direction = :right
- elsif @waveCoords[-1][1] < 10
- @direction = :left
- end
- end
-
- # animation control
- def move
- @timer.start
- end
-
- def stop
- @timer.stop
- end
-end
-
-# Start the animation processing
-AnimatedWaveDemo.new($aniwave_demo, :left).move
diff --git a/ext/tk/sample/demos-en/bind.rb b/ext/tk/sample/demos-en/bind.rb
index aabe7f0849..0bd1f0ca6f 100644
--- a/ext/tk/sample/demos-en/bind.rb
+++ b/ext/tk/sample/demos-en/bind.rb
@@ -93,35 +93,17 @@ TkText.new($bind_demo){|t|
tag_binding_for_bind_demo(tag, tagstyle_bold, tagstyle_normal)
}
d1.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'items.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'items.rb'].join(File::Separator)}`})
d2.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`})
d3.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`})
d4.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`})
d5.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`})
d6.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`})
TkTextMarkInsert.new(t, '0.0')
configure('state','disabled')
diff --git a/ext/tk/sample/demos-en/check2.rb b/ext/tk/sample/demos-en/check2.rb
index 97d61fba0c..e2d5982d2d 100644
--- a/ext/tk/sample/demos-en/check2.rb
+++ b/ext/tk/sample/demos-en/check2.rb
@@ -76,31 +76,31 @@ TkCheckButton.new($check2_demo, :text=>'Safety Check', :variable=>safety,
# tristate check
in_check = false
tristate_check = proc{|n1,n2,op|
- unless in_check
- in_check = true
- begin
- if n1 == safety
- if safety == 'none'
- wipers.value = 0
- brakes.value = 0
- sober.value = 0
- elsif safety == 'all'
- wipers.value = 1
- brakes.value = 1
- sober.value = 1
- end
+ return if in_check
+
+ in_check = true
+ begin
+ if n1 == safety
+ if safety == 'none'
+ wipers.value = 0
+ brakes.value = 0
+ sober.value = 0
+ elsif safety == 'all'
+ wipers.value = 1
+ brakes.value = 1
+ sober.value = 1
+ end
+ else
+ if wipers == 1 && brakes == 1 && sober == 1
+ safety.value = 'all'
+ elsif wipers == 1 || brakes == 1 || sober == 1
+ safety.value = 'partial'
else
- if wipers == 1 && brakes == 1 && sober == 1
- safety.value = 'all'
- elsif wipers == 1 || brakes == 1 || sober == 1
- safety.value = 'partial'
- else
- safety.value = 'none'
- end
+ safety.value = 'none'
end
- ensure
- in_check = false
end
+ ensure
+ in_check = false
end
}
diff --git a/ext/tk/sample/demos-en/floor.rb b/ext/tk/sample/demos-en/floor.rb
index 53adcf96b6..15c56a154e 100644
--- a/ext/tk/sample/demos-en/floor.rb
+++ b/ext/tk/sample/demos-en/floor.rb
@@ -1667,8 +1667,8 @@ else
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
- v.command(proc{|*args| $floor_canvas.yview(*args)})
- h.command(proc{|*args| $floor_canvas.xview(*args)})
+ v.command(proc{|*args| c.yview(*args)})
+ h.command(proc{|*args| c.xview(*args)})
}
end
diff --git a/ext/tk/sample/demos-en/floor2.rb b/ext/tk/sample/demos-en/floor2.rb
index efaf9e250d..ab8659a628 100644
--- a/ext/tk/sample/demos-en/floor2.rb
+++ b/ext/tk/sample/demos-en/floor2.rb
@@ -1667,8 +1667,8 @@ else
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
- v.command(proc{|*args| $floor2_canvas.yview(*args)})
- h.command(proc{|*args| $floor2_canvas.xview(*args)})
+ v.command(proc{|*args| c.yview(*args)})
+ h.command(proc{|*args| c.xview(*args)})
}
end
diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb
deleted file mode 100644
index 8d3f6d14f7..0000000000
--- a/ext/tk/sample/demos-en/goldberg.rb
+++ /dev/null
@@ -1,1999 +0,0 @@
-#
-# Ruby/Tk Goldverg demo (called by 'widget')
-#
-# Based on Tcl/Tk8.5a2 widget demos.
-# The following is the original comment of TkGoldberg.tcl.
-#
-#>>##+#################################################################
-#>>#
-#>># TkGoldberg.tcl
-#>># by Keith Vetter, March 13, 2003
-#>>#
-#>># "Man will always find a difficult means to perform a simple task"
-#>># Rube Goldberg
-#>>#
-#>># Reproduced here with permission.
-#>>#
-#>>##+#################################################################
-#>>#
-#>># Keith Vetter 2003-03-21: this started out as a simple little program
-#>># but was so much fun that it grew and grew. So I apologize about the
-#>># size but I just couldn't resist sharing it.
-#>>#
-#>># This is a whizzlet that does a Rube Goldberg type animation, the
-#>># design of which comes from an New Years e-card from IncrediMail.
-#>># That version had nice sound effects which I eschewed. On the other
-#>># hand, that version was in black and white (actually dark blue and
-#>># light blue) and this one is fully colorized.
-#>>#
-#>># One thing I learned from this project is that drawing filled complex
-#>># objects on a canvas is really hard. More often than not I had to
-#>># draw each item twice--once with the desired fill color but no
-#>># outline, and once with no fill but with the outline. Another trick
-#>># is erasing by drawing with the background color. Having a flood fill
-#>># command would have been extremely helpful.
-#>>#
-#>># Two wiki pages were extremely helpful: Drawing rounded rectangles
-#>># which I generalized into Drawing rounded polygons, and regular
-#>># polygons which allowed me to convert ovals and arcs into polygons
-#>># which could then be rotated (see Canvas Rotation). I also wrote
-#>># Named Colors to aid in the color selection.
-#>>#
-#>># I could comment on the code, but it's just 26 state machines with
-#>># lots of canvas create and move calls.
-
-if defined?($goldberg_demo) && $goldberg_demo
- $goldberg_demo.destroy
- $goldberg_demo = nil
-end
-
-# demo toplevel widget
-$goldberg_demo = TkToplevel.new {|w|
- title("Tk Goldberg (demonstration)")
- iconname("goldberg")
-# positionWindow(w)
-}
-
-=begin
-# label
-msg = TkLabel.new($goldberg_demo) {
- font 'Arial 10'
- wraplength '4i'
- justify 'left'
- text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
-}
-msg.pack('side'=>'top')
-=end
-
-=begin
-# frame
-TkFrame.new($goldberg_demo) {|frame|
- TkButton.new(frame) {
- text 'Dismiss'
- command proc{
- tmppath = $goldberg_demo
- $goldberg_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text 'See Code'
- command proc{showCode 'goldberg'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-=end
-
-#########################################
-
-class TkGoldberg_Demo
- def initialize(parent)
- @parent = parent
-
- @S = {}
- @S['title'] = 'Tk Goldberg'
- @S['speed'] = TkVariable.new(5)
- @S['cnt'] = TkVariable.new(0)
- @S['message'] = TkVariable.new("\\nWelcome\\nto\\nRuby/Tk")
- @S['pause'] = TkVariable.new
- @S['details'] = TkVariable.new(true)
-
- @S['mode'] = TkVariable.new(:MSTART, :symbol)
- # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG
-
- # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- @speed = [1, 10, 20, 50, 80, 100, 150, 200, 300, 400, 500]
-
- # colors
- @C = {}
- @C['fg'] = 'black'
- # @C['bg'] = 'gray75'
- @C['bg'] = 'cornflowerblue'
-
- @C['0'] = 'white'; @C['1a'] = 'darkgreen'; @C['1b'] = 'yellow'
- @C['2'] = 'red'; @C['3a'] = 'green'; @C['3b'] = 'darkblue'
- @C['4'] = @C['fg']; @C['5a'] = 'brown'; @C['5b'] = 'white'
- @C['6'] = 'magenta'; @C['7'] = 'green'; @C['8'] = @C['fg']
- @C['9'] = 'blue4'; @C['10a'] = 'white'; @C['10b'] = 'cyan'
- @C['11a'] = 'yellow'; @C['11b'] = 'mediumblue'; @C['12'] = 'tan2'
- @C['13a'] = 'yellow'; @C['13b'] = 'red'; @C['14'] = 'white'
- @C['15a'] = 'green'; @C['15b'] = 'yellow'; @C['16'] = 'gray65'
- @C['17'] = '#A65353'; @C['18'] = @C['fg']; @C['19'] = 'gray50'
- @C['20'] = 'cyan'; @C['21'] = 'gray65'; @C['22'] = @C['20']
- @C['23a'] = 'blue'; @C['23b'] = 'red'; @C['23c'] = 'yellow'
- @C['24a'] = 'red'; @C['24b'] = 'white';
-
- @STEP = TkVariable.new_hash
- @STEP.default_value_type = :numeric
-
- @XY = {}
-
- @XY6 = {
- '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192],
- '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176],
- '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164],
- '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151],
- '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219],
- '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324],
- '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346],
- '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391],
- '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456],
- '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443],
- '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437],
- '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424],
- '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412],
- '13,15'=>[376, 410], '13,16'=>[360, 403]
- }
-
- @timer = TkTimer.new(@speed[@S['speed'].numeric]){|timer|
- timer.set_interval(go)
- }
-
- do_display
- reset
-
- # Start everything going
- @timer.start
- end
-
- def do_display()
- @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5)
- @screen = TkFrame.new(@parent, :bd=>2,
- :relief=>:raised).pack(:side=>:left, :fill=>:both,
- :expand=>true)
-
- @canvas = TkCanvas.new(@parent, :width=>850, :height=>700,
- :bg=>@C['bg'], :highlightthickness=>0){
- scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up
- yview_moveto(0.05)
- }.pack(:in=>@screen, :side=>:top, :fill=>:both, :expand=>true)
-
- @canvas.bind('3'){ @pause.invoke }
- @canvas.bind('Destroy'){ @timer.stop }
-
- do_ctrl_frame
- do_detail_frame
-
- msg = TkLabel.new(@parent, :bg=>@C['bg'], :fg=>'white') {
- font 'Arial 10'
- wraplength 600
- justify 'left'
- text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg"
- }
- msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw)
-
- frame = TkFrame.new(@parent, :bg=>@C['bg'])
-
- TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
- text 'Dismiss'
- command proc{
- tmppath = $goldberg_demo
- $goldberg_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left')
-
- TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
- text 'See Code'
- command proc{showCode 'goldberg'}
- }.pack('side'=>'left', 'padx'=>5)
-
- @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl},
- :bg=>@C['bg'], :activebackground=>@C['bg'])
- @show.pack('side'=>'left')
- frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne)
-
- Tk.update
- end
-
- def do_ctrl_frame
- @start = TkButton.new(@parent, :text=>'Start', :bd=>6,
- :command=>proc{do_button(0)})
- @start.font(@start['font'].weight('bold'))
- font = @start['font']
-
- @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font,
- :command=>proc{do_button(1)}, :relief=>:raised,
- :variable=>@S['pause'])
-
- @step = TkButton.new(@parent, :text=>'Single Step', :font=>font,
- :command=>proc{do_button(2)})
- @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font,
- :command=>proc{do_button(4)})
- @reset = TkButton.new(@parent, :text=>'Reset', :font=>font,
- :command=>proc{do_button(3)})
-
- @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge)
- @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font,
- :relief=>:raised, :variable=>@S['details'])
-
- @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'],
- :justify=>:center)
- @speed_scale = TkScale.new(@parent, :orient=>:horizontal,
- :from=>1, :to=>10, :font=>font,
- :variable=>@S['speed'], :bd=>2,
- :relief=>:ridge, :showvalue=>false)
- @about = TkButton.new(@parent, :text=>'About',
- :command=>proc{about}, :font=>font)
-
- Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew)
- @ctrl.grid_rowconfigure(1, :minsize=>10)
- Tk.grid(@pause, :in=>@ctrl, :row=>2, :sticky=>:ew)
- Tk.grid(@step, :in=>@ctrl, :sticky=>:ew)
- Tk.grid(@bstep, :in=>@ctrl, :sticky=>:ew)
- Tk.grid(@reset, :in=>@ctrl, :sticky=>:ew)
- @ctrl.grid_rowconfigure(10, :minsize=>20)
- Tk.grid(@details, :in=>@ctrl, :row=>11, :sticky=>:ew)
- Tk.grid(@detail, :in=>@details, :row=>0, :sticky=>:ew)
- @ctrl.grid_rowconfigure(50, :weight=>1)
-
- @S['mode'].trace('w', proc{|*args| active_GUI(*args)})
- @S['details'].trace('w', proc{|*args| active_GUI(*args)})
- @S['speed'].trace('w', proc{|*args| active_GUI(*args)})
-
- Tk.grid(@msg_entry, :in=>@ctrl, :row=>98, :sticky=>:ew, :pady=>5)
- Tk.grid(@speed_scale, :in=>@ctrl, :row=>99, :sticky=>:ew)
- Tk.grid(@about, :in=>@ctrl, :row=>100, :sticky=>:ew)
-
- @reset.bind('3'){@S['mode'].value = -1} # Debugging
- end
-
- def do_detail_frame
- @f_details = TkFrame.new(@details)
-
- @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'],
- :bd=>1, :relief=>:solid, :bg=>'white')
- Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0)
-
- idx = 1
- loop {
- break unless respond_to?("move#{idx}")
- l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e,
- :width=>2, :bd=>1, :relief=>:solid, :bg=>'white')
- @STEP[idx] = 0
- ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx),
- :width=>5, :bd=>1, :relief=>:solid, :bg=>'white')
- row = (idx + 1)/2
- col = ((idx + 1) & 1) * 2
- Tk.grid(l, :sticky=>:ew, :row=>row, :column=>col)
- Tk.grid(ll, :sticky=>:ew, :row=>row, :column=>(col + 1))
- idx += 1
- }
- @f_details.grid_columnconfigure(1, :weight=>1)
- end
-
- def show_ctrl
- if @ctrl.winfo_mapped?
- @ctrl.pack_forget
- @show.text('>>')
- else
- @ctrl.pack(:side=>:right, :fill=>:both, :ipady=>5)
- @show.text('<<')
- end
- end
-
- def draw_all
- reset_step
- @canvas.delete(:all)
- idx = 0
- loop{
- m = "draw#{idx}"
- break unless respond_to?(m)
- send(m)
- idx += 1
- }
- end
-
- def active_GUI(var1, var2, op)
- st = {false=>:disabled, true=>:normal}
-
- m = @S['mode'].to_sym
- @S['pause'].value = (m == :MPAUSE)
- @start.state(st[m != :MGO])
- @pause.state(st[m != :MSTART && m != :MDONE])
- @step.state(st[m != :MGO && m != :MDONE])
- @bstep.state(st[m != :MGO && m != :MDONE])
- @reset.state(st[m != :MSTART])
-
- if @S['details'].bool
- Tk.grid(@f_details, :in=>@details, :row=>2, :sticky=>:ew)
- else
- Tk.grid_forget(@f_details)
- end
- @speed_scale.label("Speed: #{@S['speed'].value}")
- end
-
- def start
- @S['mode'].value = :MGO
- end
-
- def do_button(what)
- case what
- when 0 # Start
- reset if @S['mode'].to_sym == :MDONE
- @S['mode'].value = :MGO
-
- when 1 # Pause
- @S['mode'].value = ((@S['pause'].bool)? :MPAUSE: :MGO)
-
- when 2 # Step
- @S['mode'].value = :MSSTEP
-
- when 3 # Reset
- reset
-
- when 4 # Big step
- @S['mode'].value = :MBSTEP
- end
- end
-
- def go(who = nil)
- now = Tk::Clock.clicks(:miliseconds)
- if who # Start here for debugging
- @S['active'] = [who]
- @S['mode'].value = :MGO
- end
- return if @S['mode'].to_sym == :MDEBUG # Debugging
- # If not paused, do the next move
- n = next_step if @S['mode'].to_sym != :MPAUSE
- @S['mode'].value = :MPAUSE if @S['mode'].to_sym == :MSSTEP # Single step
- @S['mode'].value = :MSSTEP if @S['mode'].to_sym == :MBSTEP && n # big step
- elapsed = Tk::Clock.clicks(:miliseconds) - now
- delay = @speed[@S['speed'].to_i] - elapsed
- delay = 1 if delay <= 0
- return delay
- end
-
- def next_step
- retval = false # Return value
-
- if @S['mode'].to_sym != :MSTART && @S['mode'].to_sym != :MDONE
- @S['cnt'].numeric += 1
- end
- alive = []
- @S['active'].each{|who|
- who = who.to_i
- n = send("move#{who}")
- if (n & 1).nonzero? # This guy still alive
- alive << who
- end
- if (n & 2).nonzero? # Next guy is active
- alive << (who + 1)
- retval = true
- end
- if (n & 4).nonzero? # End of puzzle flag
- @S['mode'].value = :MDONE # Done mode
- @S['active'] = [] # No more animation
- return true
- end
- }
- @S['active'] = alive
- return retval
- end
-
- def about
- msg = "Ruby/Tk Version ::\nby Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)\n\n"
- msg += "Original Version ::\n"
- msg += "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n"
- msg += "Man will always find a difficult means to perform a simple task"
- msg += "\nRube Goldberg"
- Tk.messageBox(:message=>msg, :title=>'About')
- end
-
- ################################################################
- #
- # All the drawing and moving routines
- #
-
- # START HERE! banner
- def draw0
- color = @C['0']
- TkcText.new(@canvas, [579, 119], :text=>'START HERE!',
- :fill=>color, :anchor=>:w,
- :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold])
- TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color,
- :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5])
- @canvas.itembind('I0', '1'){ start }
- end
-
- def move0(step = nil)
- step = get_step(0, step)
-
- if @S['mode'].to_sym != :MSTART # Start the ball rolling
- move_abs('I0', [-100, -100]) # Hide the banner
- return 2
- end
-
- pos = [
- [673, 119], [678, 119], [683, 119], [688, 119],
- [693, 119], [688, 119], [683, 119], [678, 119]
- ]
- step = step % pos.length
- move_abs('I0', pos[step])
- return 1
- end
-
- # Dropping ball
- def draw1
- color = @C['1a']
- color2 = @C['1b']
- TkcPolygon.new(@canvas,
- [ 844, 133, 800, 133, 800, 346, 820, 346,
- 820, 168, 844, 168, 844, 133 ],
- :width=>3, :fill=>color, :outline=>'')
- TkcPolygon.new(@canvas,
- [ 771, 133, 685, 133, 685, 168, 751, 168,
- 751, 346, 771, 346, 771, 133 ],
- :width=>3, :fill=>color, :outline=>'')
- TkcOval.new(@canvas, box(812, 122, 9),
- :tag=>'I1', :fill=>color2, :outline=>'')
-
- @canvas.itembind('I1', '1'){ start }
- end
-
- def move1(step = nil)
- step = get_step(1, step)
- pos = [
- [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153],
- [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438],
- [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601],
- [-100, -100]
- ]
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I1', where)
- move15a if where[2] == :y
- return 3 if where[2] == :x
- return 1
- end
-
- # Lighting the match
- def draw2
- color = @C['2']
-
- # Fulcrum
- TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392],
- :fill=>@C['fg'], :outline=>@C['fg'])
-
- # Strike box
- TkcRectangle.new(@canvas, [628, 335, 660, 383],
- :fill=>'', :outline=>@C['fg'])
- (0..2).each{|y|
- yy = 335 + y*16
- TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25',
- :anchor=>:nw, :foreground=>@C['fg'])
- TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25',
- :anchor=>:nw, :foreground=>@C['fg'])
- }
-
- # Lever
- TkcLine.new(@canvas, [702, 366, 798, 366],
- :fill=>@C['fg'], :width=>6, :tag=>'I2_0')
-
- # R strap
- TkcLine.new(@canvas, [712, 363, 712, 355],
- :fill=>@C['fg'], :width=>3, :tag=>'I2_1')
-
- # L strap
- TkcLine.new(@canvas, [705, 363, 705, 355],
- :fill=>@C['fg'], :width=>3, :tag=>'I2_2')
-
- # Match stick
- TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356],
- :fill=>@C['fg'], :width=>3, :tag=>'I2_3')
-
- # Match head
- TkcPolygon.new(@canvas,
- [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1,
- 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ],
- :fill=>color, :outline=>color, :tag=>'I2_4')
- end
-
- def move2(step = nil)
- step = get_step(2, step)
-
- stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1]
- xy = []
- xy[0] = [
- 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307,
- 662, 318, 662, 328, 671, 336
- ]
- xy[1] = [
- 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311,
- 661, 327, 671, 335
- ]
- xy[2] = [
- 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298,
- 666, 309, 660, 324, 672, 336
- ]
-
- if step >= stages.length
- @canvas.delete('I2')
- return 0
- end
-
- if step == 0 # Rotate the match
- beta = 20
-
- ox, oy = anchor('I2_0', :s) # Where to pivot
-
- i = 0
- until @canvas.find_withtag("I2_#{i}").empty?
- rotate_item("I2_#{i}", ox, oy, beta)
- i += 1
- end
-
- # For the flame
- TkcPolygon.new(@canvas, [], :tag=>'I2', :smooth=>true, :fill=>@C['2'])
-
- return 1
- end
- @canvas.coords('I2', xy[stages[step]])
- return ((step == 7)? 3: 1)
- end
-
- # Weight and pulleys
- def draw3
- color = @C['3a']
- color2 = @C['3b']
-
- xy = [ [602, 296], [577, 174], [518, 174] ]
- xy.each{|x, y| # 3 Pulleys
- TkcOval.new(@canvas, box(x, y, 13),
- :fill=>color, :outline=>@C['fg'], :width=>3)
- TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg'])
- }
-
- # Wall to flame
- TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s',
- :width=>3, :fill=>@C['fg'], :smooth=>true)
-
- # Flame to pulley 1
- TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0',
- :width=>3, :fill=>@C['fg'], :smooth=>true)
- TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1',
- :width=>3, :fill=>@C['fg'], :smooth=>true)
-
- # Pulley 1 half way to 2
- TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2',
- :width=>3, :fill=>@C['fg'])
-
- # Pulley 1 other half to 2
- TkcLine.new(@canvas, [589, 235, 589, 174], :width=>3, :fill=>@C['fg'])
-
- # Across the top
- TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg'])
-
- # Down to weight
- TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w',
- :width=>3, :fill=>@C['fg'])
-
- # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
- x1, y1, x2, y2 = [515, 207, 495, 207]
- TkcOval.new(@canvas, box(x1, y1, 6),
- :tag=>'I3_', :fill=>color2, :outline=>color2)
- TkcOval.new(@canvas, box(x2, y2, 6),
- :tag=>'I3_', :fill=>color2, :outline=>color2)
- TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6,
- :tag=>'I3_', :fill=>color2, :outline=>color2)
-
- TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15),
- :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2)
-
- TkcLine.new(@canvas, [500, 217, 511, 217],
- :tag=>'I3_', :fill=>color2, :width=>10)
-
- # Bottom weight target
- TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465],
- :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10)
- end
-
- def move3(step = nil)
- step = get_step(3, step)
-
- pos = [ [505, 247], [505, 297], [505, 386.5], [505, 386.5] ]
- rope = []
- rope[0] = [750, 309, 729, 301, 711, 324, 690, 300]
- rope[1] = [750, 309, 737, 292, 736, 335, 717, 315, 712, 320]
- rope[2] = [750, 309, 737, 309, 740, 343, 736, 351, 725, 340]
- rope[3] = [750, 309, 738, 321, 746, 345, 742, 356]
-
- return 0 if step >= pos.length
-
- @canvas.delete("I3_#{step}") # Delete part of the rope
- move_abs('I3_', pos[step]) # Move weight down
- @canvas.coords('I3_s', rope[step]) # Flapping rope end
- @canvas.coords('I3_w', [505, 174].concat(pos[step]))
- if step == 2
- @canvas.move('I3__', 0, 30)
- return 2
- end
- return 1
- end
-
- # Cage and door
- def draw4
- color = @C['4']
- x0, y0, x1, y1 = [527, 356, 611, 464]
-
- # Horizontal bars
- y0.step(y1, 12){|y|
- TkcLine.new(@canvas, [x0, y, x1, y], :fill=>color, :width=>1)
- }
-
- # Vertical bars
- x0.step(x1, 12){|x|
- TkcLine.new(@canvas, [x, y0, x, y1], :fill=>color, :width=>1)
- }
-
- # Swing gate
- TkcLine.new(@canvas, [518, 464, 518, 428],
- :tag=>'I4', :fill=>color, :width=>1)
- end
-
- def move4(step = nil)
- step = get_step(4, step)
-
- angles = [-10, -20, -30, -30]
- return 0 if step >= angles.length
-
- rotate_item('I4', 518, 464, angles[step])
- @canvas.raise('I4')
-
- return((step == 3)? 3: 1)
- end
-
- # Mouse
- def draw5
- color = @C['5a']
- color2 = @C['5b']
-
- xy = [377, 248, 410, 248, 410, 465, 518, 465] # Mouse course
- xy.concat [518, 428, 451, 428, 451, 212, 377, 212]
-
- TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3)
-
- xy = [
- 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446,
- 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452
- ]
- TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color)
-
- TkcLine.new(@canvas, [573, 452, 592, 458, 601, 460, 613, 456], # Tail
- :tag=>['I5', 'I5_1'], :fill=>color, :smooth=>true, :width=>3)
-
- xy = box(540, 446, 2) # Eye
- xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445]
- TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'],
- :outline=>'', :smooth=>true)
-
- xy = [538, 454, 535, 461] # Front leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_3'], :fill=>color, :width=>2)
-
- xy = [566, 455, 569, 462] # Back leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_4'], :fill=>color, :width=>2)
-
- xy = [544, 455, 545, 460] # 2nd front leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_5'], :fill=>color, :width=>2)
-
- xy = [560, 455, 558, 460] # 2nd back leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_6'], :fill=>color, :width=>2)
- end
-
- def move5(step = nil)
- step = get_step(5, step)
-
- pos = [
- [553, 452], [533, 452], [513, 452], [493, 452], [473, 452],
- [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414],
- [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294],
- [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237]
- ]
-
- return 0 if step >= pos.length
-
- x, y, beta, nxt = pos[step]
- move_abs('I5', [x, y])
- if beta
- ox, oy = centroid('I5_0')
- (0..6).each{|id| rotate_item("I5_#{id}", ox, oy, beta) }
- end
- return 3 if nxt == :x
- return 1
- end
-
- # Dropping gumballs
- def draw6
- color = @C['6']
- xy = [324, 130, 391, 204] # Ball holder
- xy = round_rect(xy, 10)
- TkcPolygon.new(@canvas, xy, :smooth=>true,
- :outline=>@C['fg'], :width=>3, :fill=>color)
- xy = [339, 204, 376, 253] # Below the ball holder
- TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
- :fill=>color, :tag=>'I6c')
- xy = box(346, 339, 28)
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
- :start=>80, :extent=>205)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
- :start=>-41, :extent=>85)
-
- xy = box(346, 339, 15) # Center of rotor
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['fg'], :tag=>'I6m')
- xy = [352, 312, 352, 254, 368, 254, 368, 322] # Top drop to rotor
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'')
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
-
- xy = [353, 240, 367, 300] # Poke bottom hole
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
- xy = [341, 190, 375, 210] # Poke another hole
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
-
- xy = [
- 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403,
- 352, 403, 352, 366
- ]
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'',
- :width=>2) # Below rotor
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
- xy = box(275, 342, 7) # On/off rotor
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['fg'])
- xy = [276, 334, 342, 325] # Fan belt top
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = [276, 349, 342, 353] # Fan belt bottom
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
-
- xy = [337, 212, 337, 247] # What the mouse pushes
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I6_')
- xy = [392, 212, 392, 247]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I6_')
- xy = [337, 230, 392, 230]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>7, :tag=>'I6_')
-
- who = -1 # All the balls
- colors = %w(red cyan orange green blue darkblue)
- colors *= 3
-
- (0..16).each{|i|
- loc = -i
- color = colors[i]
- x, y = @XY6["#{loc}"]
- TkcOval.new(@canvas, box(x, y, 5),
- :fill=>color, :outline=>color, :tag=>"I6_b#{i}")
- }
- draw6a(12) # The wheel
- end
-
- def draw6a(beta)
- @canvas.delete('I6_0')
- ox, oy = [346, 339]
- (0..3).each{|i|
- b = beta + i * 45
- x, y = rotate_c(28, 0, 0, 0, b)
- xy = [ox + x, oy + y, ox - x, oy - y]
- TkcLine.new(@canvas, xy, :tag=>'I6_0', :fill=>@C['fg'], :width=>2)
- }
- end
-
- def move6(step = nil)
- step = get_step(6, step)
-
- return 0 if step > 62
-
- if step < 2 # Open gate for balls to drop
- @canvas.move('I6_', -7, 0)
- if step == 1 # Poke a hole
- xy = [348, 226, 365, 240]
- TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill),
- :outline=>'')
- end
- return 1
- end
-
- s = step - 1 # Do the gumball drop dance
- (0..(((s - 1)/3).to_i)).each{|i|
- tag = "I6_b#{i}"
- break if @canvas.find_withtag(tag).empty?
- loc = s - 3*i
-
- if @XY6["#{loc},#{i}"]
- move_abs(tag, @XY6["#{loc},#{i}"])
- elsif @XY6["#{loc}"]
- move_abs(tag, @XY6["#{loc}"])
- end
- }
- if s % 3 == 1
- first = (s + 2)/3
- i = first
- loop {
- tag = "I6_b#{i}"
- break if @canvas.find_withtag(tag).empty?
- loc = first - i
- move_abs(tag, @XY6["#{loc}"])
- i += 1
- }
- end
- if s >= 3 # Rotate the motor
- idx = s % 3
- draw6a(12 + s * 15)
- end
- return((s == 3)? 3 : 1)
- end
-
- # On/off switch
- def draw7
- color = @C['7']
- xy = [198, 306, 277, 374] # Box
- TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2,
- :fill=>color, :tag=>'I7z')
- @canvas.lower('I7z')
- xy = [275, 343, 230, 349]
- TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last,
- :arrowshape=>[23, 23, 8], :width=>6)
- xy = [225, 324] # On button
- x, y = xy
- TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
- xy = [218, 323] # On text
- font = ['Times Roman', 8]
- TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e,
- :fill=>@C['fg'], :font=>font)
- xy = [225, 350] # Off button
- x, y = xy
- TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
- xy = [218, 349] # Off text
- TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e,
- :fill=>@C['fg'], :font=>font)
- end
-
- def move7(step = nil)
- step = get_step(7, step)
-
- numsteps = 30
- return 0 if step > numsteps
- beta = 30.0 / numsteps
- rotate_item('I7', 275, 343, beta)
-
- return((step == numsteps)? 3: 1)
- end
-
- # Electricity to the fan
- def draw8
- sine([271, 248, 271, 306], 5, 8, :tag=>'I8_s', :fill=>@C['8'], :width=>3)
- end
-
- def move8(step = nil)
- step = get_step(8, step)
-
- return 0 if step > 3
- if step == 0
- sparkle(anchor('I8_s', :s), 'I8')
- return 1
- elsif step == 1
- move_abs('I8', anchor('I8_s', :c))
- elsif step == 2
- move_abs('I8', anchor('I8_s', :n))
- else
- @canvas.delete('I8')
- end
- return((step == 2)? 3: 1)
- end
-
- # Fan
- def draw9
- color = @C['9']
- xy = [266, 194, 310, 220]
- TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
- xy = [280, 209, 296, 248]
- TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
- xy = [
- 288, 249, 252, 249, 260, 240, 280, 234,
- 296, 234, 316, 240, 324, 249, 288, 249
- ]
- TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true)
-
- xy = [248, 205, 265, 214, 264, 205, 265, 196] # Spinner
- TkcPolygon.new(@canvas, xy, :fill=>color)
-
- xy = [255, 206, 265, 234] # Fan blades
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I9_0')
- xy = [255, 176, 265, 204]
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I9_0')
- xy = [255, 206, 265, 220]
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>1, :tag=>'I9_1')
- xy = [255, 190, 265, 204]
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>1, :tag=>'I9_1')
- end
-
- def move9(step = nil)
- step = get_step(9, step)
-
- if (step & 1).nonzero?
- @canvas.itemconfigure('I9_0', :width=>4)
- @canvas.itemconfigure('I9_1', :width=>1)
- @canvas.lower('I9_1', 'I9_0')
- else
- @canvas.itemconfigure('I9_0', :width=>1)
- @canvas.itemconfigure('I9_1', :width=>4)
- @canvas.lower('I9_0', 'I9_1')
- end
- return 3 if step == 0
- return 1
- end
-
- # Boat
- def draw10
- color = @C['10a']
- color2 = @C['10b']
- xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail
- TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'],
- :tag=>'I10')
- xy = box(209, 204, 31) # Front
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie,
- :start=>120, :extent=>120, :tag=>'I10')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>120, :extent=>120, :tag=>'I10')
- xy = box(249, 204, 31) # Back
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3,
- :style=>:pie, :start=>120, :extent=>120, :tag=>'I10')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>120, :extent=>120, :tag=>'I10')
-
- xy = [200, 171, 200, 249] # Mast
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I10')
- xy = [159, 234, 182, 234] # Bow sprit
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I10')
- xy = [180, 234, 180, 251, 220, 251] # Hull
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>6, :tag=>'I10')
-
- xy = [92, 255, 221, 255] # Waves
- sine(xy, 2, 25, :fill=>color2, :width=>1, :tag=>'I10w')
-
- xy = @canvas.coords('I10w')[4..-5] # Water
- xy.concat([222, 266, 222, 277, 99, 277])
- TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>color2)
- xy = [222, 266, 222, 277, 97, 277, 97, 266] # Water bottom
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
-
- xy = box(239, 262, 17)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>95, :extent=>103)
- xy = box(76, 266, 21)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :extent=>190)
- end
-
- def move10(step = nil)
- step = get_step(10, step)
-
- pos = [
- [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212],
- [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212],
- [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212],
- [116, 212], [111, 212]
- ]
-
- return 0 if step >= pos.length
-
- where = pos[step]
- move_abs('I10', where)
-
- return 3 if where[2] == :x
- return 1
- end
-
- # 2nd ball drop
- def draw11
- color = @C['11a']
- color2 = @C['11b']
- xy = [23, 264, 55, 591] # Color the down tube
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
- xy = box(71, 460, 48) # Color the outer loop
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
-
- xy = [55, 264, 55, 458] # Top right side
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = [55, 504, 55, 591] # Bottom right side
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = box(71, 460, 48) # Outer loop
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>110, :extent=>-290, :tag=>'I11i')
- xy = box(71, 460, 16) # Inner loop
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'',
- :width=>3, :tag=>'I11i')
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3)
-
- xy = [23, 264, 23, 591] # Left side
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = box(1, 266, 23) # Top left curve
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
- :style=>:arc, :extent=>90)
-
- xy = box(75, 235, 9) # The ball
- TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'',
- :width=>3, :tag=>'I11')
- end
-
- def move11(step = nil)
- step = get_step(11, step)
-
- pos = [
- [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266],
- [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472],
- [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591]
- ]
-
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I11', where)
- return 3 if where[2] == :x
- return 1
- end
-
- # Hand
- def draw12
- xy = [
- 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590,
- 60, 590, 60, 610, 60, 610
- ]
- xy.concat([60, 610, 65, 620, 60, 631]) # Thumb
- xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669,
- 56, 669, 50, 669, 50, 662, 50, 637])
-
- y0 = 637 # Bumps for fingers
- y1 = 645
- 50.step(21, -10){|x|
- x1 = x - 5
- x2 = x - 10
- xy << x << y0 << x1 << y1 << x2 << y0
- }
- TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'],
- :smooth=>true, :tag=>'I12', :width=>3)
- end
-
- def move12(step = nil)
- step = get_step(12, step)
-
- pos = [[42.5, 641, :x]]
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I12', where)
- return 3 if where[2] == :x
- return 1
- end
-
- # Fax
- def draw13
- color = @C['13a']
- xy = [86, 663, 149, 663, 149, 704, 50, 704, 50, 681, 64, 681, 86, 671]
- xy2 = [
- 784, 663, 721, 663, 721, 704, 820, 704, 820, 681, 806, 681, 784, 671
- ]
- radii = [2, 9, 9, 8, 5, 5, 2]
-
- round_poly(@canvas, xy, radii, :width=>3,
- :outline=>@C['fg'], :fill=>color)
- round_poly(@canvas, xy2, radii, :width=>3,
- :outline=>@C['fg'], :fill=>color)
-
- xy = [56, 677]
- x, y = xy
- TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I13')
- xy = [809, 677]
- x, y = xy
- TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I13R')
-
- xy = [112, 687] # Label
- TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
- :font=>['Times Roman', 12, :bold])
- xy = [762, 687]
- TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
- :font=>['Times Roman', 12, :bold])
-
- xy = [138, 663, 148, 636, 178, 636] # Paper guide
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
- xy = [732, 663, 722, 636, 692, 636]
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
-
- sine([149, 688, 720, 688], 5, 15,
- :tag=>'I13_s', :fill=>@C['fg'], :width=>3)
- end
-
- def move13(step = nil)
- step = get_step(13, step)
-
- numsteps = 7
-
- if step == numsteps + 2
- move_abs('I13_star', [-100, -100])
- @canvas.itemconfigure('I13R', :fill=>@C['13b'], :width=>2)
- return 2
- end
- if step == 0 # Button down
- @canvas.delete('I13')
- sparkle([-100, -100], 'I13_star') # Create off screen
- return 1
- end
- x0, y0 = anchor('I13_s', :w)
- x1, y1 = anchor('I13_s', :e)
- x = x0 + (x1 - x0) * (step - 1) / numsteps.to_f
- move_abs('I13_star', [x, y0])
- return 1
- end
-
- # Paper in fax
- def draw14
- color = @C['14']
- xy = [102, 661, 113, 632, 130, 618] # Left paper edge
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14L_0')
- xy = [148, 629, 125, 640, 124, 662] # Right paper edge
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14L_1')
- draw14a('L')
-
- xy = [
- 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171
- ]
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14R_0')
- @canvas.lower('I14R_0')
- # NB. these numbers are VERY sensitive, you must start with final size
- # and shrink down to get the values
- xy = [
- 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5
- ]
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14R_1')
- @canvas.lower('I14R_1')
- end
-
- def draw14a(side)
- color = @C['14']
- xy = @canvas.coords("I14#{side}_0")
- xy2 = @canvas.coords("I14#{side}_1")
- x0, y0, x1, y1, x2, y2 = xy
- x3, y3, x4, y4, x5, y5 = xy2
-
- zz = [
- x0, y0, x0, y0, xy, x2, y2, x2, y2,
- x3, y3, x3, y3, xy2, x5, y5, x5, y5
- ].flatten
- @canvas.delete("I14#{side}")
- TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true,
- :fill=>color, :outline=>color, :width=>3)
- @canvas.lower("I14#{side}")
- end
-
- def move14(step = nil)
- step = get_step(14, step)
-
- # Paper going down
- sc = 0.9 - 0.05*step
- if sc < 0.3
- @canvas.delete('I14L')
- return 0
- end
-
- ox, oy = @canvas.coords('I14L_0')
- @canvas.scale('I14L_0', ox, oy, sc, sc)
- ox, oy = @canvas.coords('I14L_1')[-2..-1]
- @canvas.scale('I14L_1', ox, oy, sc, sc)
- draw14a('L')
-
- # Paper going up
- sc = 0.35 + 0.05*step
- sc = 1/sc
-
- ox, oy = @canvas.coords('I14R_0')
- @canvas.scale('I14R_0', ox, oy, sc, sc)
- ox, oy = @canvas.coords('I14R_1')[-2..-1]
- @canvas.scale('I14R_1', ox, oy, sc, sc)
- draw14a('R')
-
- return((step == 10)? 3: 1)
- end
-
- # Light beam
- def draw15
- color = @C['15a']
- xy = [824, 599, 824, 585, 820, 585, 829, 585]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I15a')
- xy = [789, 599, 836, 643]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
- xy = [778, 610, 788, 632]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
- xy = [766, 617, 776, 625]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
-
- xy = [633, 600, 681, 640]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
- xy = [635, 567, 657, 599]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
- xy = [765, 557, 784, 583]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
-
- sine([658, 580, 765, 580], 3, 15,
- :tag=>'I15_s', :fill=>@C['fg'], :width=>3)
- end
-
- def move15a
- color = @C['15b']
- @canvas.scale('I15a', 824, 599, 1, 0.3) # Button down
- xy = [765, 621, 681, 621]
- TkcLine.new(@canvas, xy, :dash=>'-', :width=>3, :fill=>color, :tag=>'I15')
- end
-
- def move15(step = nil)
- step = get_step(15, step)
-
- numsteps = 6
-
- if step == numsteps + 2
- move_abs('I15_star', [-100, -100])
- return 2
- end
- if step == 0 # Break the light beam
- sparkle([-100, -100], 'I15_star')
- xy = [765, 621, 745, 621]
- @canvas.coords('I15', xy)
- return 1
- end
- x0, y0 = anchor('I15_s', :w)
- x1, y1 = anchor('I15_s', :e)
- x = x0 + (x1 - x0) * (step - 1) / numsteps.to_f
- move_abs('I15_star', [x, y0])
- return 1
- end
-
- # Bell
- def draw16
- color = @C['16']
- xy = [722, 485, 791, 556]
- TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3)
- xy = box(752, 515, 25) # Bell
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black',
- :tag=>'I16b', :width=>2)
- xy = box(752, 515, 5) # Bell button
- TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b')
-
- xy = [784, 523, 764, 549] # Clapper
- TkcLine.new(@canvas, xy, :width=>3, :tag=>'I16c', :fill=>@C['fg'])
- xy = box(784, 523, 4)
- TkcOval.new(@canvas, xy, :fill=>@C['fg'], :outline=>@C['fg'], :tag=>'I16d')
- end
-
- def move16(step = nil)
- step = get_step(16, step)
-
- # Note: we never stop
- ox, oy = [760, 553]
- if (step & 1).nonzero?
- beta = 12
- @canvas.move('I16b', 3, 0)
- else
- beta = -12
- @canvas.move('I16b', -3, 0)
- end
- rotate_item('I16c', ox, oy, beta)
- rotate_item('I16d', ox, oy, beta)
-
- return ((step == 1)? 3: 1)
- end
-
- # Cat
- def draw17
- color = @C['17']
-
- xy = [584, 556, 722, 556]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = [584, 485, 722, 485]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
-
- xy = [664, 523, 717, 549] # Body
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3,
- :style=>:chord, :start=>128, :extent=>260, :tag=>'I17')
-
- xy = [709, 554, 690, 543] # Paw
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
- :width=>3, :tag=>'I17')
- xy = [657, 544, 676, 555]
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
- :width=>3, :tag=>'I17')
-
- xy = box(660, 535, 15) # Lower face
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>150, :extent=>240, :tag=>'I17_')
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_')
- xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1,
- :tag=>['I17_', 'I17_c'])
- xy = [652, 542, 628, 539] # Whiskers
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [652, 543, 632, 545]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [652, 546, 632, 552]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
-
- xy = [668, 543, 687, 538]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :tag=>['I17_', 'I17_w'])
- xy = [668, 544, 688, 546]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :tag=>['I17_', 'I17_w'])
- xy = [668, 547, 688, 553]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :tag=>['I17_', 'I17_w'])
-
- xy = [649, 530, 654, 538, 659, 530] # Left eye
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
- :smooth=>true, :tag=>'I17')
- xy = [671, 530, 666, 538, 661, 530] # Right eye
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
- :smooth=>true, :tag=>'I17')
- xy = [655, 543, 660, 551, 665, 543] # Mouth
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
- :smooth=>true, :tag=>'I17')
- end
-
- def move17(step = nil)
- step = get_step(17, step)
-
- if step == 0
- @canvas.delete('I17') # Delete most of the cat
- xy = [655, 543, 660, 535, 665, 543] # Mouth
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :smooth=>true, :tag=>'I17_')
- xy = box(654, 530, 4) # Left eye
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
- :tag=>'I17_')
- xy = box(666, 530, 4) # Right eye
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
- :tag=>'I17_')
-
- @canvas.move('I17_', 0, -20) # Move face up
- xy = [652, 528, 652, 554] # Front leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [670, 528, 670, 554] # 2nd front leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
-
- xy = [ # Body
- 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525,
- 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527,
- 668, 527, 668, 527, 675, 522, 676, 517, 677, 512
- ]
- TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill),
- :outline=>@C['fg'], :width=>3, :smooth=>true,
- :tag=>'I17_')
- xy = [716, 514, 716, 554] # Back leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [694, 532, 694, 554] # 2nd back leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :smooth=>true, :tag=>'I17_')
-
- @canvas.raise('I17w') # Make whiskers visible
- @canvas.move('I17_', -5, 0) # Move away from the wall a bit
- return 2
- end
- return 0
- end
-
- # Sling shot
- def draw18
- color = @C['18']
- xy = [721, 506, 627, 506] # Sling hold
- TkcLine.new(@canvas, xy, :width=>4, :fill=>@C['fg'], :tag=>'I18')
-
- xy = [607, 500, 628, 513] # Sling rock
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :tag=>'I18a')
-
- xy = [526, 513, 606, 507, 494, 502] # Sling band
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>4, :tag=>'I18b')
- xy = [485, 490, 510, 540, 510, 575, 510, 540, 535, 491] # Sling
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>6)
- end
-
- def move18(step = nil)
- step = get_step(18, step)
-
- pos = [
- [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x],
- [136, 506], [16, 506], [-100, -100]
- ]
-
- b = []
- b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing
- b[1] = [
- 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525,
- 553, 536, 538, 534, 532, 519, 529, 499
- ]
- b[2] = [
- 491, 503, 508, 563, 542, 533, 551, 526, 561, 539, 549, 550, 530, 500
- ]
- b[3] = [
- 491, 503, 508, 563, 530, 554, 541, 562, 525, 568, 519, 544, 530, 501
- ]
-
- return 0 if step >= pos.length
-
- if step == 0
- @canvas.delete('I18')
- @canvas.itemconfigure('I18b', :smooth=>true)
- end
- if b[step]
- @canvas.coords('I18b', b[step])
- end
-
- where = pos[step]
- move_abs('I18a', where)
- return 3 if where[2] == :x
- return 1
- end
-
- # Water pipe
- def draw19
- color = @C['19']
- xx = [[249, 181], [155, 118], [86, 55], [22, 0]]
- xx.each{|x1, x2|
- TkcRectangle.new(@canvas, x1, 453, x2, 467,
- :fill=>color, :outline=>'', :tag=>'I19')
- TkcLine.new(@canvas, x1, 453, x2, 453,
- :fill=>@C['fg'], :width=>1) # Pipe top
- TkcLine.new(@canvas, x1, 467, x2, 467,
- :fill=>@C['fg'], :width=>1) # Pipe bottom
- }
- @canvas.raise('I11i')
-
- xy = box(168, 460, 16) # Bulge by the joint
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
- :start=>21, :extent=>136)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
- :start=>-21, :extent=>-130)
-
- xy = [249, 447, 255, 473] # First joint 26x6
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
-
- xy = box(257, 433, 34) # Bend up
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:pie, :start=>0, :extent=>-91)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>-90)
- xy = box(257, 433, 20)
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
- :style=>:pie, :start=>0, :extent=>-92)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>-90)
- xy = box(257, 421, 34) # Bend left
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:pie, :start=>0, :extent=>91)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>90)
- xy = box(257, 421, 20)
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
- :style=>:pie, :start=>0, :extent=>90)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>90)
- xy = box(243, 421, 34) # Bend down
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:pie, :start=>90, :extent=>90)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>90, :extent=>90)
- xy = box(243, 421, 20)
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
- :style=>:pie, :start=>90, :extent=>90)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>90, :extent=>90)
-
- xy = [270, 427, 296, 433] # 2nd joint bottom
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [270, 421, 296, 427] # 2nd joint top
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [249, 382, 255, 408] # Third joint right
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [243, 382, 249, 408] # Third joint left
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [203, 420, 229, 426] # Last joint
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
-
- xy = box(168, 460, 6) # Handle joint
- TkcOval.new(@canvas, xy, :fill=>@C['fg'], :outline=>'', :tag=>'I19a')
- xy = [168, 460, 168, 512] # Handle bar
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>5, :tag=>'I19b')
- end
-
- def move19(step = nil)
- step = get_step(19, step)
-
- angles = [30, 30, 30]
- return 2 if step == angles.length
- ox, oy = centroid('I19a')
- rotate_item('I19b', ox, oy, angles[step])
-
- return 1
- end
-
- # Water pouring
- def draw20
- # do nothing
- end
-
- def move20(step = nil)
- step = get_step(20, step)
-
- pos = [451, 462, 473, 484, 496, 504, 513, 523, 532]
- freq = [20, 40, 40, 40, 40, 40, 40, 40, 40]
- pos = [
- [451, 20], [462, 40], [473, 40], [484, 40], [496, 40],
- [504, 40], [513, 40], [523, 40], [532, 40, :x]
- ]
- return 0 if step >= pos.length
-
- @canvas.delete('I20')
- where = pos[step]
- y, f = where
- h20(y, f)
- return 3 if where[2] == :x
- return 1
- end
-
- def h20(y, f)
- color = @C['20']
- @canvas.delete('I20')
-
- sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'],
- :width=>3, :fill=>color, :smooth=>true)
- TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
- :fill=>color, :smooth=>1, :tag=>['I20', 'I20a'])
- TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
- :fill=>color, :smooth=>1, :tag=>['I20', 'I20b'])
- @canvas.move('I20a', 8, 0)
- @canvas.move('I20b', 16, 0)
- end
-
- # Bucket
- def draw21
- color = @C['21']
- xy = [217, 451, 244, 490] # Right handle
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21_a')
- xy = [201, 467, 182, 490] # Left handle
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21_a')
-
- xy = [245, 490, 237, 535] # Right side
- xy2 = [189, 535, 181, 490] # Left side
- TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'',
- :tag=>['I21', 'I21f'])
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21')
- TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21')
-
- xy = [182, 486, 244, 498] # Top
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2,
- :tag=>['I21', 'I21f'])
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2,
- :tag=>['I21', 'I21t'])
- xy = [189, 532, 237, 540] # Bottom
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2,
- :tag=>['I21', 'I21b'])
- end
-
- def move21(step = nil)
- step = get_step(21, step)
-
- numsteps = 30
- return 0 if step >= numsteps
-
- x1, y1, x2, y2 = @canvas.coords('I21b')
- # lx1, ly1, lx2, ly2 = @canvas.coords('I21t')
- lx1, ly1, lx2, ly2 = [183, 492, 243, 504]
-
- f = step / numsteps.to_f
- y2 = y2 - 3
- xx1 = x1 + (lx1 - x1) * f
- yy1 = y1 + (ly1 - y1) * f
- xx2 = x2 + (lx2 - x2) * f
- yy2 = y2 + (ly2 - y2) * f
-
- @canvas.itemconfigure('I21b', :fill=>@C['20'])
- @canvas.delete('I21w')
- TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1,
- :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20'])
- @canvas.lower('I21w', 'I21')
- @canvas.raise('I21b')
- @canvas.lower('I21f')
-
- return((step == numsteps - 1)? 3: 1)
- end
-
- # Bucket drop
- def draw22
- # do nothing
- end
-
- def move22(step = nil)
- step = get_step(22, step)
- pos = [[213, 513], [213, 523], [213, 543, :x], [213, 583], [213, 593]]
-
- @canvas.itemconfigure('I21f', :fill=>@C['22']) if step == 0
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I21', where)
- h20(where[1], 40)
- @canvas.delete('I21_a') # Delete handles
-
- return 3 if where[2] == :x
- return 1
- end
-
- # Blow dart
- def draw23
- color = @C['23a']
- color2 = @C['23b']
- color3 = @C['23c']
-
- xy = [185, 623, 253, 650] # Block
- TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'],
- :width=>2, :tag=>'I23a')
- xy = [187, 592, 241, 623] # Balloon
- TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b',
- :style=>:arc, :start=>12, :extent=>336)
- xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle
- TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b')
-
- xy = [285, 611, 250, 603] # Dart body
- TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'],
- :width=>3, :tag=>'I23d')
- xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail
- TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'],
- :width=>3, :tag=>'I23d')
- xy = [249, 607, 268, 607] # Dart detail
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
- xy = [285, 607, 305, 607] # Dart needle
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
- end
-
- def move23(step = nil)
- step = get_step(23, step)
-
- pos = [
- [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607],
- [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100]
- ]
-
- return 0 if step >= pos.length
- if step <= 1
- ox, oy = anchor('I23a', :n)
- @canvas.scale('I23b', ox, oy, 0.9, 0.5)
- end
- where = pos[step]
- move_abs('I23d', where)
-
- return 3 if where[2] == :x
- return 1
- end
-
- # Balloon
- def draw24
- color = @C['24a']
- xy = [366, 518, 462, 665] # Balloon
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
- :width=>3, :tag=>'I24')
- xy = [414, 666, 414, 729] # String
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24')
- xy = [410, 666, 404, 673, 422, 673, 418, 666] # Nozzle
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
- :width=>3, :tag=>'I24')
-
- xy = [387, 567, 390, 549, 404, 542] # Reflections
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- xy = [395, 568, 399, 554, 413, 547]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- xy = [403, 570, 396, 555, 381, 553]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- xy = [408, 564, 402, 547, 386, 545]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- end
-
- def move24(step = nil)
- step = get_step(24, step)
-
- return 0 if step > 4
- return 2 if step == 4
-
- if step == 0
- @canvas.delete('I24') # Exploding balloon
- xy = [
- 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594,
- 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738,
- 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613,
- 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508,
- 431, 441, 431, 440, 400, 502, 347, 465, 347, 465
- ]
- TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'],
- :outline=>@C['24a'], :width=>10, :smooth=>true)
- msg = Tk.subst(@S['message'].value)
- TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'],
- :justify=>:center, :font=>['Times Roman', 18, :bold])
- return 1
- end
-
- @canvas.itemconfigure('I24t', :font=>['Times Roman', 18 + 6*step, :bold])
- @canvas.move('I24', 0, -60)
- ox, oy = centroid('I24')
- @canvas.scale('I24', ox, oy, 1.25, 1.25)
- return 1
- end
-
- # Displaying the message
- def move25(step = nil)
- step = get_step(25, step)
-
- if step == 0
- @XY['25'] = Tk::Clock.clicks(:miliseconds)
- return 1
- end
- elapsed = Tk::Clock.clicks(:miliseconds) - @XY['25']
- return 1 if elapsed < 5000
- return 2
- end
-
- # Collapsing balloon
- def move26(step = nil)
- step = get_step(26, step)
-
- if step >= 3
- @canvas.delete('I24', 'I26')
- TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26',
- :text=>'click to continue',
- :font=>['Times Roman', 24, :bold])
- @canvas.bind('1', proc{reset})
- return 4
- end
-
- ox, oy = centroid('I24')
- @canvas.scale('I24', ox, oy, 0.8, 0.8)
- @canvas.move('I24', 0, 60)
- @canvas.itemconfigure('I24t', :font=>['Times Roman', 30 - 6*step, :bold])
- return 1
- end
-
- ################################################################
- #
- # Helper functions
- #
- def box(x, y, r)
- [x - r, y - r, x + r, y + r]
- end
-
- def move_abs(item, xy)
- x, y = xy
- ox, oy = centroid(item)
- dx = x - ox
- dy = y - oy
- @canvas.move(item, dx, dy)
- end
-
- def rotate_item(item, ox, oy, beta)
- xy = @canvas.coords(item)
- xy2 = []
- 0.step(xy.length - 1, 2){|idx|
- x, y = xy[idx, 2]
- xy2.concat(rotate_c(x, y, ox, oy, beta))
- }
- @canvas.coords(item, xy2)
- end
-
- def rotate_c(x, y, ox, oy, beta)
- # rotates vector (ox,oy)->(x,y) by beta degrees clockwise
-
- x -= ox # Shift to origin
- y -= oy
-
- beta = beta * Math.atan(1) * 4 / 180.0 # Radians
- xx = x * Math.cos(beta) - y * Math.sin(beta) # Rotate
- yy = x * Math.sin(beta) + y * Math.cos(beta)
-
- xx += ox # Shift back
- yy += oy
-
- [xx, yy]
- end
-
- def reset
- draw_all
- @canvas.bind_remove('1')
- @S['mode'].value = :MSTART
- @S['active'] = [0]
- end
-
- # Each Move## keeps its state info in STEP, this retrieves and increments it
- def get_step(who, step)
- if step
- @STEP[who] = step
- else
- if !@STEP.exist?(who) || @STEP[who] == ""
- @STEP[who] = 0
- else
- @STEP[who] += 1
- end
- end
- @STEP[who]
- end
-
- def reset_step
- @S['cnt'].value = 0
- @STEP.keys.each{|k| @STEP[k] = ''}
- end
-
- def sine(xy0, amp, freq, opts = {})
- x0, y0, x1, y1 = xy0
- step = 2
- xy = []
- if y0 == y1 # Horizontal
- x0.step(x1, step){|x|
- beta = (x - x0) * 2 * Math::PI / freq
- y = y0 + amp * Math.sin(beta)
- xy << x << y
- }
- else
- y0.step(y1, step){|y|
- beta = (y - y0) * 2 * Math::PI / freq
- x = x0 + amp * Math.sin(beta)
- xy << x << y
- }
- end
- TkcLine.new(@canvas, xy, opts)
- end
-
- def round_rect(xy, radius, opts={})
- x0, y0, x3, y3 = xy
- r = @canvas.winfo_pixels(radius)
- d = 2 * r
-
- # Make sure that the radius of the curve is less than 3/8 size of the box!
- maxr = 0.75
- if d > maxr * (x3 - x0)
- d = maxr * (x3 - x0)
- end
- if d > maxr * (y3 - y0)
- d = maxr * (y3 - y0)
- end
-
- x1 = x0 + d
- x2 = x3 - d
- y1 = y0 + d
- y2 = y3 - d
-
- xy = [x0, y0, x1, y0, x2, y0, x3, y0, x3, y1, x3, y2]
- xy.concat([x3, y3, x2, y3, x1, y3, x0, y3, x0, y2, x0, y1])
- return xy
- end
-
- def round_poly(canv, xy, radii, opts)
- lenXY = xy.length
- lenR = radii.length
- if lenXY != 2*lenR
- raise "wrong number of vertices and radii"
- end
-
- knots = []
- x0 = xy[-2]; y0 = xy[-1]
- x1 = xy[0]; y1 = xy[1]
- xy << xy[0] << xy[1]
-
- 0.step(lenXY - 1, 2){|i|
- radius = radii[i/2]
- r = canv.winfo_pixels(radius)
-
- x2 = xy[i+2]; y2 = xy[i+3]
- z = _round_poly2(x0, y0, x1, y1, x2, y2, r)
- knots.concat(z)
-
- x0 = x1; y0 = y1
- x1 = x2; y1 = y2
- }
- TkcPolygon.new(canv, knots, {:smooth=>true}.update(opts))
- end
-
- def _round_poly2(x0, y0, x1, y1, x2, y2, radius)
- d = 2 * radius
- maxr = 0.75
-
- v1x = x0 - x1
- v1y = y0 - y1
- v2x = x2 - x1
- v2y = y2 - y1
-
- vlen1 = Math.sqrt(v1x*v1x + v1y*v1y)
- vlen2 = Math.sqrt(v2x*v2x + v2y*v2y)
-
- if d > maxr * vlen1
- d = maxr * vlen1
- end
- if d > maxr * vlen2
- d = maxr * vlen2
- end
-
- xy = []
- xy << (x1 + d * v1x / vlen1) << (y1 + d * v1y / vlen1)
- xy << x1 << y1
- xy << (x1 + d * v2x / vlen2) << (y1 + d * v2y / vlen2)
-
- return xy
- end
-
- def sparkle(oxy, tag)
- xy = [
- [299, 283], [298, 302], [295, 314], [271, 331],
- [239, 310], [242, 292], [256, 274], [281, 273]
- ]
- xy.each{|x, y|
- TkcLine.new(@canvas, 271, 304, x, y,
- :fill=>'white', :width=>3, :tag=>tag)
- }
- move_abs(tag, oxy)
- end
-
- def centroid(item)
- anchor(item, :c)
- end
-
- def anchor(item, where)
- x1, y1, x2, y2 = @canvas.bbox(item)
- case(where)
- when :n
- y = y1
- when :s
- y = y2
- else
- y = (y1 + y2) / 2.0
- end
- case(where)
- when :w
- x = x1
- when :e
- x = x2
- else
- x = (x1 + x2) / 2.0
- end
- return [x, y]
- end
-end
-
-TkGoldberg_Demo.new($goldberg_demo)
diff --git a/ext/tk/sample/demos-en/image3.rb b/ext/tk/sample/demos-en/image3.rb
index e46d3796f2..d77cc0f99c 100644
--- a/ext/tk/sample/demos-en/image3.rb
+++ b/ext/tk/sample/demos-en/image3.rb
@@ -35,8 +35,7 @@ end
# Arguments:
# w - Name of the toplevel window of the demo.
def selectAndLoadDir(w, lbox)
- dir = Tk.chooseDirectory(:initialdir=>$dirName.value,
- :parent=>w, :mustexist=>true)
+ dir = Tk.chooseDirectory(:initialdir=>$dirName, :parent=>w, :mustexist=>true)
if dir.length > 0
$dirName.value = dir
loadDir(lbox)
diff --git a/ext/tk/sample/demos-en/menu.rb b/ext/tk/sample/demos-en/menu.rb
index 8370d2f5f0..d835d145eb 100644
--- a/ext/tk/sample/demos-en/menu.rb
+++ b/ext/tk/sample/demos-en/menu.rb
@@ -19,16 +19,9 @@ $menu_demo = TkToplevel.new {|w|
$menu_frame = TkFrame.new($menu_demo, 'relief'=>'raised', 'bd'=>2)
$menu_frame.pack('side'=>'top', 'fill'=>'x')
-begin
- windowingsystem = Tk.windowingsystem()
-rescue
- windowingsystem = ""
-end
-
# label
TkLabel.new($menu_demo,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
- if $tk_platform['platform'] == 'macintosh' ||
- windowingsystem == "classic" || windowingsystem == "aqua"
+ if $tk_platform['platform'] == 'macintosh'
text("This window contains a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by dragging outside of its bounds and releasing the mouse.")
else
text("This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu.")
@@ -69,8 +62,7 @@ TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m|
}
}
-if $tk_platform['platform'] == 'macintosh' ||
- windowingsystem == "classic" || windowingsystem == "aqua"
+if $tk_platform['platform'] == 'macintosh'
modifier = 'Command'
elsif $tk_platform['platform'] == 'windows'
modifier = 'Control'
diff --git a/ext/tk/sample/demos-en/pendulum.rb b/ext/tk/sample/demos-en/pendulum.rb
deleted file mode 100644
index 36bb44edec..0000000000
--- a/ext/tk/sample/demos-en/pendulum.rb
+++ /dev/null
@@ -1,223 +0,0 @@
-#
-# This demonstration illustrates how Tcl/Tk can be used to construct
-# simulations of physical systems.
-# (called by 'widget')
-#
-# based on Tcl/Tk8.5a2 widget demos
-
-# destroy toplevel widget for this demo script
-if defined?($pendulum_demo) && $pendulum_demo
- $pendulum_demo.destroy
- $pendulum_demo = nil
-end
-
-# create toplevel widget
-$pendulum_demo = TkToplevel.new {|w|
- title("Pendulum Animation Demonstration")
- iconname("pendulum")
- positionWindow(w)
-}
-
-# create label
-msg = TkLabel.new($pendulum_demo) {
- font $font
- wraplength '4i'
- justify 'left'
- text 'This demonstration shows how Ruby/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas.'
-}
-msg.pack('side'=>'top')
-
-# create frame
-TkFrame.new($pendulum_demo) {|frame|
- TkButton.new(frame) {
- text 'Dismiss'
- command proc{
- tmppath = $pendulum_demo
- $pendulum_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text 'See Code'
- command proc{showCode 'pendulum'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-
-# animated wave
-class PendulumAnimationDemo
- def initialize(frame)
- # Create some structural widgets
- pane = TkPanedWindow.new(frame).pack(:fill=>:both, :expand=>true)
- pane.add(@lf1 = TkLabelFrame.new(pane, :text=>'Pendulum Simulation'))
- pane.add(@lf2 = TkLabelFrame.new(pane, :text=>'Phase Space'))
-
- # Create the canvas containing the graphical representation of the
- # simulated system.
- @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white',
- :borderwidth=>2, :relief=>:sunken)
- TkcText.new(@c, 5, 5, :anchor=>:nw,
- :text=>'Click to Adjust Bob Start Position')
- # Coordinates of these items don't matter; they will be set properly below
- @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50')
- @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black')
- @bob = TkcOval.new(@c, 1, 1, 2, 2,
- :width=>3, :fill=>'yellow', :outline=>'black')
- TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'')
-
- # pack
- @c.pack(:fill=>:both, :expand=>true)
-
- # Create the canvas containing the phase space graph; this consists of
- # a line that gets gradually paler as it ages, which is an extremely
- # effective visual trick.
- @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white',
- :borderwidth=>2, :relief=>:sunken)
- @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last)
- @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last)
-
- @graph = {}
- 90.step(0, -10){|i|
- # Coordinates of these items don't matter;
- # they will be set properly below
- @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}")
- }
-
- # labels
- @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne,
- :text=>'q', :font=>'Symbol 8')
- @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne,
- :text=>'dq', :font=>'Symbol 8')
-
- # pack
- @k.pack(:fill=>:both, :expand=>true)
-
- # Initialize some variables
- @points = []
- @theta = 45.0
- @dTheta = 0.0
- @length = 150
-
- # init display
- showPendulum
-
- # animation loop
- @timer = TkTimer.new(15){ repeat }
-
- # binding
- @c.bindtags_unshift(btag = TkBindTag.new)
- btag.bind('Destroy'){ @timer.stop }
- btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x, y)}, '%x %y')
- btag.bind('B1-Motion', proc{|x, y| showPendulum(x, y)}, '%x %y')
- btag.bind('ButtonRelease-1',
- proc{|x, y| showPendulum(x, y); @timer.start }, '%x %y')
-
- btag.bind('Configure', proc{|w| @plate.coords(0, 25, w, 25)}, '%w')
-
- @k.bind('Configure', proc{|h, w|
- @psh = h/2;
- @psw = w/2
- @x_axis.coords(2, @psh, w-2, @psh)
- @y_axis.coords(@psw, h-2, @psw, 2)
- @label_theta.coords(@psw-4, 6)
- @label_dtheta.coords(w-6, @psh+4)
- }, '%h %w')
-
- # animation start
- @timer.start(500)
- end
-
- # This procedure makes the pendulum appear at the correct place on the
- # canvas. If the additional arguments x, y are passed instead of computing
- # the position of the pendulum from the length of the pendulum rod and its
- # angle, the length and angle are computed in reverse from the given
- # location (which is taken to be the centre of the pendulum bob.)
- def showPendulum(x=nil, y=nil)
- if x && y && (x != 160 || y != 25)
- @dTheta = 0.0
- x2 = x - 160
- y2 = y - 25
- @length = Math.hypot(x2, y2)
- @theta = Math.atan2(x2,y2)*180/Math::PI
- else
- angle = @theta*Math::PI/180
- x = 160 + @length*Math.sin(angle)
- y = 25 + @length*Math.cos(angle)
- end
-
- @rod.coords(160, 25, x, y)
- @bob.coords(x-15, y-15, x+15, y+15)
- end
-
- # Update the phase-space graph according to the current angle and the
- # rate at which the angle is changing (the first derivative with
- # respect to time.)
- def showPhase
- @points << @theta + @psw << -20*@dTheta + @psh
- if @points.length > 100
- @points = @points[-100..-1]
- end
- (0...100).step(10){|i|
- first = - i
- last = 11 - i
- last = -1 if last >= 0
- next if first > last
- lst = @points[first..last]
- @graph[i].coords(lst) if lst && lst.length >= 4
- }
- end
-
- # This procedure is the "business" part of the simulation that does
- # simple numerical integration of the formula for a simple rotational
- # pendulum.
- def recomputeAngle
- scaling = 3000.0/@length/@length
-
- # To estimate the integration accurately, we really need to
- # compute the end-point of our time-step. But to do *that*, we
- # need to estimate the integration accurately! So we try this
- # technique, which is inaccurate, but better than doing it in a
- # single step. What we really want is bound up in the
- # differential equation:
- # .. - sin theta
- # theta + theta = -----------
- # length
- # But my math skills are not good enough to solve this!
-
- # first estimate
- firstDDTheta = -Math.sin(@theta * Math::PI/180) * scaling
- midDTheta = @dTheta + firstDDTheta
- midTheta = @theta + (@dTheta + midDTheta)/2
- # second estimate
- midDDTheta = -Math.sin(midTheta * Math::PI/180) * scaling
- midDTheta = @dTheta + (firstDDTheta + midDDTheta)/2
- midTheta = @theta + (@dTheta + midDTheta)/2
- # Now we do a double-estimate approach for getting the final value
- # first estimate
- midDDTheta = -Math.sin(midTheta * Math::PI/180) * scaling
- lastDTheta = midDTheta + midDDTheta
- lastTheta = midTheta + (midDTheta+ lastDTheta)/2
- # second estimate
- lastDDTheta = -Math.sin(lastTheta * Math::PI/180) * scaling
- lastDTheta = midDTheta + (midDDTheta + lastDDTheta)/2
- lastTheta = midTheta + (midDTheta + lastDTheta)/2
- # Now put the values back in our globals
- @dTheta = lastDTheta
- @theta = lastTheta
- end
-
- # This method ties together the simulation engine and the graphical
- # display code that visualizes it.
- def repeat
- # Simulate
- recomputeAngle
-
- # Update the display
- showPendulum
- showPhase
- end
-end
-
-# Start the animation processing
-PendulumAnimationDemo.new($pendulum_demo)
diff --git a/ext/tk/sample/demos-en/tcolor b/ext/tk/sample/demos-en/tcolor
index 3c63d6730d..5b29797906 100644
--- a/ext/tk/sample/demos-en/tcolor
+++ b/ext/tk/sample/demos-en/tcolor
@@ -121,14 +121,9 @@ def hsbToRgb(hue,sat,value)
end
-def _null_binding
- Module.new.instance_eval{binding}
-end
-private :_null_binding
-
def doUpdate
newCmd = $command.to_s.gsub("%%","\"#{$color}\"")
- eval(newCmd, _null_binding)
+ eval(newCmd)
end
@@ -213,21 +208,21 @@ def tc_loadNamedColor(name)
else
case name.length
when 4
- fmt = /#(.{1})(.{1})(.{1})/
+ format = /#(.{1})(.{1})(.{1})/
shift = 12
when 7
- fmt = /#(.{2})(.{2})(.{2})/
+ format = /#(.{2})(.{2})(.{2})/
shift = 8
when 10
- fmt = /#(.{3})(.{3})(.{3})/
+ format = /#(.{3})(.{3})(.{3})/
shift = 4
when 13
- fmt = /#(.{4})(.{4})(.{4})/
+ format = /#(.{4})(.{4})(.{4})/
shift = 0
else
raise(eException,"syntax error in color name \"#{name}\"")
end
- name.scan(fmt){|strlist|
+ name.scan(format){|strlist|
if strlist.length != 3
raise(eException,"syntax error in color name \"#{name}\"")
end
diff --git a/ext/tk/sample/demos-en/tcolor.bak b/ext/tk/sample/demos-en/tcolor.bak
new file mode 100644
index 0000000000..5464aebae2
--- /dev/null
+++ b/ext/tk/sample/demos-en/tcolor.bak
@@ -0,0 +1,513 @@
+#!/usr/local/bin/ruby
+#
+# tcolor --
+# ¤³¤Î¥¹¥¯¥ê¥×¥È¤ÏRGB,HSB,CYM·Á¼°¤ò¥µ¥Ý¡¼¥È¤¹¤ë
+# ´Ê°×¥«¥é¡¼¥¨¥Ç¥£¥¿¤Ç¤¹¡£
+#
+# Copyright (C) 1998 Takaaki Tateishi(ttate@jaist.ac.jp)
+# last update: Thu Jun 18 06:32:35 JST 1998
+#
+
+# ¤Þ¤º¤Ïtk.rb¤òÆÉ¤ß¹þ¤à¡£
+
+require "tk"
+
+
+# Tk¤Ë¤è¤Ã¤ÆÊѹ¹¤µ¤ì¤ëÊÑ¿ô¤ÏTkVariable¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò»È¤¦¡£
+
+$colorSpace = TkVariable.new(:rgb)
+$red = 65535
+$green = 0
+$blue = 0
+$color = "#ffff00000000"
+$updating = TkVariable.new(0)
+$autoUpdate = TkVariable.new(1)
+$name = TkVariable.new("")
+# $command = TkVariable.new("print(%%,\"\n\")")
+$command = TkVariable.new("")
+$label1 = TkVariable.new("label1")
+$label2 = TkVariable.new("label2")
+$label3 = TkVariable.new("label3")
+
+
+# ³Æ¥¤¥Ù¥ó¥ÈÍѤΥ᥽¥Ã¥É
+
+def rgbToHsv(red,green,blue)
+
+ if ( red > green )
+ max = red
+ min = green
+ else
+ max = green
+ min = red
+ end
+
+ if ( blue > max )
+ max = blue
+ else
+ if ( blue < min )
+ min = blue
+ end
+ end
+
+ range = max - min
+
+ if ( max == 0 )
+ sat = 0.0
+ else
+ sat = (max-min)/max
+ end
+
+ if ( sat == 0 )
+ hue = 0.0
+ else
+ rc = (max-red)/range
+ gc = (max-green)/range
+ bc = (max-blue)/range
+ if ( red == max )
+ hue = 0.166667 * (bc - gc)
+ else
+ if ( green == max )
+ hue = 0.166667 * (2.0 + rc - bc)
+ else
+ hue = 0.166667 * (4.0 + gc - rc)
+ end
+ end
+ if ( hue < 0.0 )
+ hue = hue + 1.0
+ end
+ end
+
+ [hue,sat,max/65535]
+end
+
+
+def hsbToRgb(hue,sat,value)
+ v = 65535.0 * value
+ if( sat == 0 )
+ ans = [v,v,v]
+ else
+ hue = hue*6.0
+ if ( hue >= 6 )
+ hue = 0.0
+ end
+ i = hue.to_i
+ f = hue - i
+ p = 65535.0 * value * (1.0 - sat)
+ q = 65535.0 * value * (1.0 - (sat * f))
+ t = 65535.0 * value * (1.0 - (sat * (1.0 - f)))
+ case i
+ when 0
+ ans = [v,t,p]
+ when 1
+ ans = [q,v,p]
+ when 2
+ ans = [p,v,t]
+ when 3
+ ans = [p,q,v]
+ when 4
+ ans = [t,p,v]
+ when 5
+ ans = [v,p,q]
+ else
+ raise(eException,"i value #{i} is out of range")
+ end
+ end
+ return ans
+end
+
+
+def doUpdate
+ newCmd = $command.to_s.gsub("%%","\"#{$color}\"")
+ eval(newCmd)
+end
+
+
+def tc_scaleChanged
+ if( $updating.to_i == 1 )
+ return
+ end
+
+ scale1 = $root.middle.middle.scale1
+ scale2 = $root.middle.middle.scale2
+ scale3 = $root.middle.middle.scale3
+
+ case $colorSpace.to_i
+ when :rgb
+ $red = (scale1.get * 65.535).to_i
+ $green = (scale2.get * 65.535).to_i
+ $blue = (scale3.get * 65.535).to_i
+ when :cmy
+ $red = (65535 - scale1.get * 65.535).to_i
+ $green = (65535 - scale2.get * 65.535).to_i
+ $blue = (65535 - scale3.get * 65.535).to_i
+ when :hsb
+ list = hsbToRgb(scale1.get / 1000.0,
+ scale2.get / 1000.0,
+ scale3.get / 1000.0)
+ $red = list[0]
+ $green = list[1]
+ $blue = list[2]
+ else
+ raise(Exception,"unknown colorSpace")
+ end
+ $color = format("#%04x%04x%04x",$red.to_i,$green.to_i,$blue.to_i)
+ $root.middle.right.set_color($color)
+ if( $autoUpdate.to_i == 1 )
+ doUpdate
+ end
+ Tk.update(TRUE)
+end
+
+
+def tc_setScales
+ $updating.value = 1
+
+ scale1 = $root.middle.middle.scale1
+ scale2 = $root.middle.middle.scale2
+ scale3 = $root.middle.middle.scale3
+
+ case $colorSpace.to_i
+ when :rgb
+ scale1.set($red / 65.535)
+ scale2.set($green / 65.535)
+ scale3.set($blue / 65.535)
+ when :cmy
+ scale1.set((65535 - $red) / 65.535)
+ scale2.set((65535 - $green) / 65.535)
+ scale3.set((65535 - $blue) / 65.535)
+ when :hsb
+ list = rgbToHsv($red,$green,$blue)
+ scale1.set( list[0] * 1000.0 )
+ scale2.set( list[1] * 1000.0 )
+ scale3.set( list[2] * 1000.0 )
+ else
+ raise(Exception,"unknown colorSpace")
+ end
+
+ $updating.value = 0
+end
+
+
+def tc_loadNamedColor(name)
+ if name[0,1] != "#"
+ list = TkWinfo.rgb($root.middle.right.swatch,name)
+ $red = list[0]
+ $green = list[1]
+ $blue = list[2]
+ else
+ case name.length
+ when 4
+ format = /#(.{1})(.{1})(.{1})/
+ shift = 12
+ when 7
+ format = /#(.{2})(.{2})(.{2})/
+ shift = 8
+ when 10
+ format = /#(.{3})(.{3})(.{3})/
+ shift = 4
+ when 13
+ format = /#(.{4})(.{4})(.{4})/
+ shift = 0
+ else
+ raise(eException,"syntax error in color name \"#{name}\"")
+ end
+ name.scan(format){|strlist|
+ if strlist.length != 3
+ raise(eException,"syntax error in color name \"#{name}\"")
+ end
+ $red = strlist[0].to_i
+ $green = strlist[1].to_i
+ $blue = strlist[2].to_i
+ }
+ $red = $red << shift
+ $green = $green << shift
+ $blue = $blue << shift
+ end
+
+ tc_setScales
+ $color = format("#%04x%04x%04x",$red,$green,$blue)
+ $root.middle.right.set_color($color)
+ if $autoUpdate.to_i == 1
+ doUpdate
+ end
+end
+
+
+def changeColorSpace(space)
+ case space
+ when :rgb
+ $label1.value = "Red"
+ $label2.value = "Green"
+ $label3.value = "Blue"
+ when :cmy
+ $label1.value = "Cyan"
+ $label2.value = "Magenta"
+ $label3.value = "Yellow"
+ when :hsb
+ $label1.value = "Hue"
+ $label2.value = "Saturation"
+ $label3.value = "Brightness"
+ end
+ tc_setScales
+end
+
+
+
+
+
+# tcolorÍѤΥá¥Ë¥å¡¼
+
+class TkColorMenuFrame<TkFrame
+ def initialize(parent)
+ super(parent,
+ "relief"=>"raised",
+ "borderwidth"=>"2")
+
+ # File¥á¥Ë¥å¡¼¥Ü¥¿¥ó¤ÎÀ¸À®
+ @file = TkMenubutton.new(self){|button|
+
+ # File¥á¥Ë¥å¡¼¤ÎºîÀ®
+ @file_menu = TkMenu.new(button){
+ add "radio",
+ "label" => "RGB color space",
+ "variable" => $colorSpace,
+ "value" => :rgb,
+ "underline" => "0",
+ "command" => proc{changeColorSpace(:rgb)}
+ add "radio",
+ "label" => "CMY color space",
+ "variable" => $colorSpace,
+ "value" => :cmy,
+ "underline" => "0",
+ "command" => proc{changeColorSpace(:cmy)}
+ add "radio",
+ "label" => "HSB color space",
+ "variable" => $colorSpace,
+ "value" => :hsb,
+ "underline" => "0",
+ "command" => proc{changeColorSpace(:hsb)}
+ add "separator"
+ add "radio",
+ "label" => "Qutomatic updates",
+ "variable" => $autoUpdate,
+ "value" => "1",
+ "underline" => "0"
+ add "radio",
+ "label" => "Manual updates",
+ "variable" => $autoUpdate,
+ "value" => "0",
+ "underline" => "0"
+ add "separator"
+ add "command",
+ "label" => "Exit program",
+ "underline" => "0",
+ "command" => proc{exit}
+ }
+
+ # File¥á¥Ë¥å¡¼¤ÈFile¥Ü¥¿¥ó¤ò´ØÏ¢ÉÕ¤±¤ë
+ menu @file_menu
+
+ text "File"
+ underline "0"
+ }.pack("side"=>"left")
+
+ self
+ end
+end
+
+
+# ²¼Éô¤Î¥Õ¥ì¡¼¥à¤Î¤¿¤á¤Î¥¯¥é¥¹
+class TkColorBotFrame<TkFrame
+ def initialize(parent)
+ super(parent,
+ "relief"=> "raised",
+ "borderwidth"=> 2)
+
+ @commandLabel = TkLabel.new(self,
+ "text"=> "Command:")
+ @command = TkEntry.new(self,
+ "relief"=> "sunken",
+ "borderwidth"=> "2",
+ "textvariable"=> $command,
+ "font"=> "-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*")
+ @update = TkButton.new(self,
+ "text"=> "Update",
+ "command"=> proc{doUpdate})
+ @commandLabel.pack("side"=>"left")
+ @update.pack("side"=>"right","pady"=>".1c","padx"=>".25c")
+ @command.pack("expand"=>"yes","fill"=>"x","ipadx"=>".25c")
+
+ self
+ end
+end
+
+
+# ÃæÃʺ¸¤Î¥Õ¥ì¡¼¥à
+class TkColorMiddleLeftFrame<TkFrame
+ def initialize(parent)
+ super(parent)
+
+ for i in ["/usr/local/lib/X11rgb.txt","/usr/lib/X11/rgb.txt",
+ "/X11/R5/lib/X11/rgb.txt","/X11/R4/lib/rgb/rgb.txt",
+ "/usr/openwin/lib/X11/rgb.txt"]
+ if !File.readable?(i)
+ next
+ end
+ f = File.open(i)
+ @scroll = TkScrollbar.new(self,
+ "orient"=>"vertical",
+ "relief"=>"sunken",
+ "borderwidth"=>"2")
+ @scroll.pack("side"=>"right","fill"=>"y")
+ @names = TkListbox.new(self,
+ "width"=>"20",
+ "height"=>"12",
+ "yscrollcommand"=> proc{|first,last| @scroll.set first,last},
+ "relief"=>"sunken",
+ "borderwidth"=>"2",
+ "exportselection"=>"false")
+ @scroll.command(proc{|*args| @names.yview *args})
+ @names.bind("Double-1",proc{
+ tc_loadNamedColor(@names.get(@names.curselection))})
+ @names.pack("side"=>"left")
+ while (line = f.gets)
+ line.chop!
+ linelist = line.split(/[ \t]+/)
+ if linelist.length == 4
+ @names.insert("end",linelist[3])
+ end
+ end
+ f.close
+ break
+ end
+
+ self
+ end
+end
+
+
+# ÃæÃÊÃæ±û¤Î¥Õ¥ì¡¼¥à
+class TkColorMiddleMiddleFrame<TkFrame
+ # @scale1,@scale2,@scale3¤ò³°Éô¤«¤é»²¾È¤Î¤ßµö²Ä¤¹¤ë¡£(Êѹ¹ÉÔ²Ä)
+ attr_reader :scale1, :scale2, :scale3
+
+ def initialize(parent)
+ super(parent)
+
+ @f1 = TkFrame.new(self)
+ @f2 = TkFrame.new(self)
+ @f3 = TkFrame.new(self)
+ @f4 = TkFrame.new(self)
+
+ for f in [@f1,@f2,@f3]
+ f.pack("side"=>"top","expand"=>"yes")
+ end
+ @f4.pack("side"=>"top","expand"=>"yes","fill"=>"x")
+
+ @label1 = TkLabel.new(self,"textvariable"=>$label1)
+ @scale1 = TkScale.new(self,"from"=>"0","to"=>"1000","length"=>"6c",
+ "orient"=>"horizontal",
+ "command"=>proc{tc_scaleChanged})
+ @scale1.pack("side"=>"top","anchor"=>"w")
+ @label1.pack("side"=>"top","anchor"=>"w")
+
+ @label2 = TkLabel.new(self,"textvariable"=>$label2)
+ @scale2 = TkScale.new(self,"from"=>"0","to"=>"1000","length"=>"6c",
+ "orient"=>"horizontal",
+ "command"=>proc{tc_scaleChanged})
+ @scale2.pack("side"=>"top","anchor"=>"w")
+ @label2.pack("side"=>"top","anchor"=>"w")
+
+ @label3 = TkLabel.new(self,"textvariable"=>$label3)
+ @scale3 = TkScale.new(self,"from"=>"0","to"=>"1000","length"=>"6c",
+ "orient"=>"horizontal",
+ "command"=>proc{tc_scaleChanged})
+ @scale3.pack("side"=>"top","anchor"=>"w")
+ @label3.pack("side"=>"top","anchor"=>"w")
+
+ @nameLabel = TkLabel.new(self,"text"=>"Name:")
+ @name = TkEntry.new(self,"relief"=>"sunken","borderwidth"=>"2",
+ "textvariable"=>$name,"width"=>"10",
+ "font"=>"-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*")
+ @nameLabel.pack("side"=>"left")
+ @name.pack("side"=>"right", "expand"=>"1", "fill"=>"x")
+ @name.bind("Return",proc{tc_loadNamedColor $name.to_s})
+
+ self
+ end
+end
+
+
+class TkColorMiddleRightFrame<TkFrame
+ attr_reader :swatch
+
+ def initialize(parent)
+ super(parent)
+ @swatch = TkFrame.new(self, "width"=>"2c", "height"=>"5c",
+ "background"=>$color)
+ @value = TkLabel.new(self,
+ "text"=>$color,
+ "width"=>"13",
+ "font"=>"-Adobe-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*")
+ @swatch.pack("side"=>"top","expand"=>"yes","fill"=>"both")
+ @value.pack("side"=>"bottom","pady"=>".25c")
+
+ self
+ end
+
+ def set_color(color)
+ @swatch["background"] = color
+ @value["text"] = color
+ end
+end
+
+
+
+# ÃæÃʤΥե졼¥à
+class TkColorMiddleFrame<TkFrame
+ attr_reader :left, :middle, :right
+
+ def initialize(parent)
+ super(parent,
+ "relief"=> "raised",
+ "borderwidth"=> "2")
+
+ @left = TkColorMiddleLeftFrame.new(self)
+ @left.pack("side"=>"left","padx"=>".25c","pady"=>".25c")
+
+ @middle = TkColorMiddleMiddleFrame.new(self)
+ @middle.pack("side"=>"left","expand"=>"yes","fill"=>"y")
+
+ @right = TkColorMiddleRightFrame.new(self)
+ @right.pack("side"=>"left","padx"=>".25c","pady"=>".25c","anchor"=>"s")
+
+ self
+ end
+end
+
+
+class TkColor<TkRoot
+ attr_reader :menu, :bottom, :middle
+
+ def initialize
+ super
+ @menu = TkColorMenuFrame.new(self)
+ @menu.pack("side"=>"top", "fill"=>"x")
+
+ @bottom = TkColorBotFrame.new(self)
+ @bottom.pack("side"=>"bottom","fill"=>"x")
+
+ @middle = TkColorMiddleFrame.new(self)
+ @middle.pack("side"=>"top","fill"=>"both")
+
+ self
+ end
+end
+
+
+$root = TkColor.new
+
+# ¥¤¥Ù¥ó¥È¤òÂԤİ٤˥롼¥×¤ËÆþ¤ë¡£
+changeColorSpace :rgb
+Tk.mainloop
diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget
index 3c50582211..9df91c467b 100644
--- a/ext/tk/sample/demos-en/widget
+++ b/ext/tk/sample/demos-en/widget
@@ -389,17 +389,6 @@ txt.insert('end', "3. Color picker.\n", tag_demo, "demo-clrpick")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-txt.insert('end', "Animation\n", tag_title)
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. Animated labels (if supported)\n", tag_demo, "demo-anilabel")
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. Animated wave (if supported)\n", tag_demo, "demo-aniwave")
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. Pendulum simulation (if supported)\n", tag_demo, "demo-pendulum")
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. A celebration of Rube Goldberg (if supported)\n", tag_demo, "demo-goldberg")
-
-txt.insert('end', "\n")
txt.insert('end', "Miscellaneous\n", tag_title)
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. The built-in bitmaps.\n", tag_demo, "demo-bitmap")
@@ -509,93 +498,6 @@ else # ver >= 8.4
alias showVars showVars2
end
-# Pseudo-Toplevel support
-module PseudoToplevel_Evaluable
- def pseudo_toplevel_eval(body = Proc.new)
- Thread.current[:TOPLEVEL] = self
- begin
- body.call
- ensure
- Thread.current[:TOPLEVEL] = nil
- end
- end
-
- def pseudo_toplevel_evaluable?
- @pseudo_toplevel_evaluable
- end
- def pseudo_toplevel_evaluable=(mode)
- @pseudo_toplevel_evaluable = (mode)? true: false
- end
-
- def self.extended(mod)
- mod.__send__(:extend_object, mod)
- mod.instance_variable_set('@pseudo_toplevel_evaluable', true)
- end
-end
-
-class Object
- alias __method_missing__ method_missing
- private :__method_missing__
-
- def method_missing(id, *args)
- begin
- has_top = (top = Thread.current[:TOPLEVEL]) &&
- top.respond_to?(:pseudo_toplevel_evaluable?) &&
- top.pseudo_toplevel_evaluable? &&
- top.respond_to?(id)
- rescue Exception => e
- has_top = false
- end
-
- if has_top
- top.__send__(id, *args)
- else
- __method_missing__(id, *args)
- end
- end
-end
-
-class Proc
- def initialize(*args, &b)
- super
- @__pseudo_toplevel__ = Thread.current[:TOPLEVEL]
- end
-
- alias __call__ call
- def call(*args, &b)
- if top = @__pseudo_toplevel__
- orig_top = Thread.current[:TOPLEVEL]
- Thread.current[:TOPLEVEL] = top
- begin
- __call__(*args, &b)
- ensure
- Thread.current[:TOPLEVEL] = orig_top
- end
- else
- __call__(*args, &b)
- end
- end
-end
-
-def proc(&b)
- Proc.new(&b)
-end
-def lambda(&b)
- Proc.new(&b)
-end
-
-def _null_binding
- Module.new.instance_eval{extend PseudoToplevel_Evaluable}
- # binding
- # Module.new.instance_eval{binding}
-end
-private :_null_binding
-
-def eval_samplecode(code)
- Thread.new{ _null_binding.pseudo_toplevel_eval{ eval(code) } }.run
- Tk.update
-end
-
# invoke --
# This procedure is called when the user clicks on a demo description.
# It is responsible for invoking the demonstration.
@@ -603,25 +505,11 @@ end
# Arguments:
# txt - Name of text widget
# index - The index of the character that the user clicked on.
-def invoke(txt, idx)
- tag = txt.tag_names(idx).find{|t| t.kind_of?(String) && t =~ /^demo-/}
- return unless tag
- cursor = txt.cget('cursor')
- txt.cursor('watch')
- Tk.update
- # eval(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, _null_binding)
- # Tk.update
- eval_samplecode(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join)
- txt.cursor(cursor)
-
- $tag_visited.add("#{idx} linestart +1 chars", "#{idx} lineend +1 chars")
-end
-=begin
-def invoke (txt, idx)
- tag = txt.tag_names(idx).find{|t| t.kind_of?(String) && t =~ /^demo-/}
+def invoke (txt, index)
+ tag = txt.tag_names(index).find{|t| t.kind_of?(String) && t =~ /^demo-/}
return unless tag
- current_cursor = txt.cget('cursor')
+ cursor = txt.cget('cursor')
txt.cursor('watch')
Tk.update
# eval `cat #{tag[5..-1]}.rb`
@@ -629,11 +517,11 @@ def invoke (txt, idx)
eval IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join
Tk.update
# txt.cursor('xterm')
- txt.cursor(current_cursor)
+ txt.cursor(cursor)
- $tag_visited.add("#{idx} linestart +1 chars", "#{idx} lineend +1 chars")
+ $tag_visited.add("#{index} linestart +1 chars", "#{index} lineend +1 chars")
end
-=end
+
# showStatus --
#
# Show the name of the demo program in the status bar. This procedure
@@ -678,8 +566,7 @@ def showCode1(demo)
}.pack('side'=>'left', 'expand'=>'yes', 'pady'=>2)
TkButton.new(f) {
text "Rerun Demo"
- # command proc{eval($code_text.get('1.0','end'), _null_binding)}
- command proc{eval_samplecode($code_text.get('1.0','end'))}
+ command proc{eval($code_text.get('1.0','end'))}
}.pack('side'=>'left', 'expand'=>'yes', 'pady'=>2)
# f.pack('side'=>'bottom', 'expand'=>'yes', 'fill'=>'x')
f.pack('side'=>'bottom', 'fill'=>'x')
@@ -772,10 +659,7 @@ def showCode2(demo)
:command=>proc{printCode($code_text, file)},
:image=>$image['print'], :compound=>:left)
b_run = TkButton.new(bf, :text=>'Rerun Demo',
- :command=>proc{
- # eval($code_text.get('1.0','end'), _null_binding)
- eval_samplecode($code_text.get('1.0','end'))
- },
+ :command=>proc{eval($code_text.get('1.0','end'))},
:image=>$image['refresh'], :compound=>:left)
TkGrid('x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4])
@@ -896,15 +780,14 @@ end
#
def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
- 'message'=>"Ruby/Tk widget demonstration Ver.1.6.0-en\n\n" +
+ 'message'=>"Ruby/Tk widget demonstration Ver.1.4.4-en\n\n" +
"based on demos of Tk8.1 -- 8.5 " +
"( Copyright:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " +
"(c) 1997-2000 Ajuba Solutions, Inc. / " +
"(c) 2001-2003 Donal K. Fellows )\n\n" +
"Your Ruby & Tk Version ::\n" +
- "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}\n\n" +
- "Ruby/Tk release date :: tcltklib #{TclTkLib::RELEASE_DATE}; tk #{Tk::RELEASE_DATE}")
+ "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}")
end
#########################################
@@ -913,20 +796,15 @@ no_launcher = false
if ARGV[0] == '-n'
ARGV.shift
no_launcher = true if ARGV.size > 0
-else
- # show the root widget to make it lower then demo windows
- Tk.update
end
ARGV.each{|cmd|
if cmd =~ /(.*).rb/
cmd = $1
end
- #eval(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join,
- # _null_binding)
- eval_samplecode(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join)
+ eval IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join
}
if no_launcher
- $root.withdraw # hide root window
+ $root.withdraw # hide root window
Thread.start{
loop do
count = 0
diff --git a/ext/tk/sample/demos-jp/anilabel.rb b/ext/tk/sample/demos-jp/anilabel.rb
deleted file mode 100644
index 97781fbe77..0000000000
--- a/ext/tk/sample/demos-jp/anilabel.rb
+++ /dev/null
@@ -1,174 +0,0 @@
-#
-# animated label widget demo (called by 'widget')
-#
-# based on Tcl/Tk8.5a2 widget demos
-
-# toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë
-if defined?($anilabel_demo) && $anilabel_demo
- $anilabel_demo.destroy
- $anilabel_demo = nil
-end
-
-# demo ÍѤΠtoplevel widget ¤òÀ¸À®
-$anilabel_demo = TkToplevel.new {|w|
- title("Animated Label Demonstration")
- iconname("anilabel")
- positionWindow(w)
-}
-
-# label À¸À®
-msg = TkLabel.new($anilabel_demo) {
- font $font
- wraplength '4i'
- justify 'left'
- text "²¼¤Ë¤Ï4¤Ä¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¥é¥Ù¥ë¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Ë¤¢¤ë¥é¥Ù¥ë¤Ï¡¢ÆâÉô¤Î¥Æ¥­¥¹¥È¥á¥Ã¥»¡¼¥¸¤ò¥¹¥¯¥í¡¼¥ë¤·¤¿¤è¤¦¤Ë¸«¤»¤ë¤³¤È¤Çư¤­¤òÉÕ¤±¤Æ¤¤¤Þ¤¹¡£±¦Â¦¤Î¥é¥Ù¥ë¤Ï¡¢É½¼¨¤¹¤ë¥¤¥á¡¼¥¸¤òÊѲ½¤µ¤»¤ë¤³¤È¤Çư¤­¤òÍ¿¤¨¤Æ¤¤¤Þ¤¹¡£"
-}
-msg.pack('side'=>'top')
-
-# frame À¸À®
-TkFrame.new($anilabel_demo) {|frame|
- TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
- command proc{
- tmppath = $anilabel_demo
- $anilabel_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
- command proc{showCode 'anilabel'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-
-# label demo Íѥե졼¥àÀ¸À®
-f_left = TkLabelFrame.new($anilabel_demo, :text=>'Scrolling Texts')
-f_right = TkLabelFrame.new($anilabel_demo, :text=>'GIF Image')
-Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both',
- 'padx'=>10, 'pady'=>10)
-
-# animated label
-class AnimatedTextLabel < TkLabel
- def initialize(*args)
- super(*args)
- @timer = TkTimer.new{ _animation_callback }
- @timer.loop_exec = -1
- # bind('Destroy'){ @timer.stop }
- @btag = TkBindTag.new('Destroy'){ @timer.stop }
- self.bindtags_unshift(@btag)
- end
-
- def _animation_callback()
- txt = self.text
- self.text = (txt[1..-1] << txt[0])
- end
- private :_animation_callback
-
- def start(interval)
- @timer.set_interval(interval)
- @timer.start
- end
-
- def stop
- @timer.stop
- end
-end
-
-# animated image
-class AnimatedImageLabel < AnimatedTextLabel
- def initialize(*args)
- super(*args)
- @destroy_image = false
- @btag.bind_append('Destroy'){
- if @destroy_image
- begin
- self.image.delete
- rescue
- end
- end
- }
- end
- attr_accessor :destroy_image
-
- def _animation_callback()
- img = self.image
-
- fmt = img.format
- if fmt.kind_of?(Array)
- if fmt[1].kind_of?(Hash)
- # fmt == ['GIF', {'index'=>idx}]
- idx = fmt[1]['index']
- else
- # fmt == ['GIF', '-index', idx] :: Ruby1.8.2 returns this.
- idx = fmt[2]
- end
- elsif fmt.kind_of?(String) && fmt =~ /GIF -index (\d+)/
- idx = $1.to_i
- else
- idx = -1
- end
-
- begin
- img.format("GIF -index #{idx + 1}")
- rescue => e
- img.format("GIF -index 0")
- end
- end
- private :_animation_callback
-end
-
-# label À¸À®
-l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge,
- :font=>{:family=>'Courier', :size=>10})
-l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove,
- :font=>{:family=>'Courier', :size=>10})
-l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat,
- :font=>{:family=>'Courier', :size=>10}, :width=>18)
-Tk.pack(l1, l2, l3,
- :side=>:top, :expand=>true, :anchor=>:w, :padx=>10, :pady=>10)
-
-limg = AnimatedImageLabel.new(f_right, :borderwidth=>0)
-limg.pack(:side=>:top, :expand=>true, :padx=>10, :pady=>10)
-
-# base64-encoded animated GIF file
-tclPowerdData = <<EOD
- R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM
- zMyZmcyZZsxmZsxmAMwzAJnMzJmZzJmZmZlmmZlmZplmM5kzM2aZzGZmzGZm
- mWZmZmYzZmYzMzNmzDMzZgAzmSH+IE1hZGUgd2l0aCBHSU1QIGJ5IExARGVt
- YWlsbHkuY29tACH5BAVkAAEALAAAAAAqAEAAAAX+YCCOZEkyTKM2jOm66yPP
- dF03bx7YcuHIDkGBR7SZeIyhTID4FZ+4Es8nQyCe2EeUNJ0peY2s9mi7PhAM
- ngEAMGRbUpvzSxskLh1J+Hkg134OdDIDEB+GHxtYMEQMTjMGEYeGFoomezaC
- DZGSHFmLXTQKkh8eNQVpZ2afmDQGHaOYSoEyhhcklzVmMpuHnaZmDqiGJbg0
- qFqvh6UNAwB7VA+OwydEjgujkgrPNhbTI8dFvNgEYcHcHx0lB1kX2IYeA2G6
- NN0YfkXJ2BsAMuAzHB9cZMk3qoEbRzUACsRCUBK5JxsC3iMiKd8GN088SIyT
- 0RAFSROyeEg38caDiB/+JEgqxsODrZJ1BkT0oHKSmI0ceQxo94HDpg0qsuDk
- UmRAMgu8OgwQ+uIJgUMVeGXA+IQkzEeHGvD8cIGlDXsLiRjQ+EHroQhea7xY
- 8IQBSgYYDi1IS+OFBCgaDMGVS3fGi5BPJpBaENdQ0EomKGD56IHwO39EXiSC
- Ysgxor5+Xfgq0qByYUpiXmwuoredB2aYH4gWWda0B7SeNENpEJHC1ghi+pS4
- AJpIAwWvKPBi+8YEht5EriEqpFfMlhEdkBNpx0HUhwypx5T4IB1MBg/Ws2sn
- wV3MSQOkzI8fUd48Aw3dOZto71x85hHtHijYv18Gf/3GqCdDCXHNoICBobSo
- IqBqJLyCoH8JPrLgdh88CKCFD0CGmAiGYPgffwceZh6FC2ohIIklnkhehTNY
- 4CIHHGzgwYw01ujBBhvAqKOLLq5AAk9kuSPkkKO40NB+h1gnypJIIvkBf09a
- N5QIRz5p5ZJXJpmlIVhOGQA2TmIJZZhKKmmll2BqyWSXWUrZpQtpatlmk1c2
- KaWRHeTZEJF8SqLDn/hhsOeQgBbqAh6DGqronxeARUIIACH5BAUeAAAALAUA
- LgAFAAUAAAUM4CeKz/OV5YmqaRkCACH5BAUeAAEALAUALgAKAAUAAAUUICCK
- z/OdJVCaa7p+7aOWcDvTZwgAIfkEBR4AAQAsCwAuAAkABQAABRPgA4zP95zA
- eZqoWqqpyqLkZ38hACH5BAUKAAEALAcALgANAA4AAAU7ICA+jwiUJEqeKau+
- r+vGaTmac63v/GP9HM7GQyx+jsgkkoRUHJ3Qx0cK/VQVTKtWwbVKn9suNunc
- WkMAIfkEBQoAAAAsBwA3AAcABQAABRGgIHzk842j+Yjlt5KuO8JmCAAh+QQF
- CgAAACwLADcABwAFAAAFEeAnfN9TjqP5oOWziq05lmUIACH5BAUKAAAALA8A
- NwAHAAUAAAUPoPCJTymS3yiQj4qOcPmEACH5BAUKAAAALBMANwAHAAUAAAUR
- oCB+z/MJX2o+I2miKimiawgAIfkEBQoAAAAsFwA3AAcABQAABRGgIHzfY47j
- Q4qk+aHl+pZmCAAh+QQFCgAAACwbADcABwAFAAAFEaAgfs/zCV9qPiNJouo7
- ll8IACH5BAUKAAAALB8ANwADAAUAAAUIoCB8o0iWZggAOw==
-EOD
-
-l1.text('* Slow Animation *').start(300)
-l2.text('* Fast Animation *').start(80)
-l3.text('This is a longer scrolling text in a widget that will not show the whole message at once. ').start(150)
-
-limg.destroy_image = true
-limg.image(TkPhotoImage.new(:format=>'GIF', :data=>tclPowerdData)).start(100)
diff --git a/ext/tk/sample/demos-jp/aniwave.rb b/ext/tk/sample/demos-jp/aniwave.rb
deleted file mode 100644
index 81e2d76b30..0000000000
--- a/ext/tk/sample/demos-jp/aniwave.rb
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# animated wave demo (called by 'widget')
-#
-# based on Tcl/Tk8.5a2 widget demos
-
-# destroy toplevel widget for this demo script
-if defined?($aniwave_demo) && $aniwave_demo
- $aniwave_demo.destroy
- $aniwave_demo = nil
-end
-
-# create toplevel widget
-$aniwave_demo = TkToplevel.new {|w|
- title("Animated Wave Demonstration")
- iconname("aniwave")
- positionWindow(w)
-}
-
-# create label
-msg = TkLabel.new($aniwave_demo) {
- font $font
- wraplength '4i'
- justify 'left'
- text '¤³¤Î¥Ç¥â¤Ç¤Ï¡¢¥é¥¤¥ó¥¢¥¤¥Æ¥à¤¬°ì¤Ä¤À¤±ÉÁ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹¥¦¥£¥¸¥§¥Ã¥È¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥¢¥Ë¥á¡¼¥·¥ç¥ó½èÍý¤Ï¡¢¤½¤Î¥é¥¤¥ó¥¢¥¤¥Æ¥à¤ÎºÂɸÃͤòÊѹ¹¤¹¤ë¤³¤È¤Ç¼Â¸½¤·¤Æ¤¤¤Þ¤¹¡£'
-}
-msg.pack('side'=>'top')
-
-# create frame
-TkFrame.new($aniwave_demo) {|frame|
- TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
- command proc{
- tmppath = $aniwave_demo
- $aniwave_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
- command proc{showCode 'aniwave'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-
-# animated wave
-class AnimatedWaveDemo
- def initialize(frame, dir=:left)
- @direction = dir
-
- # create canvas widget
- @c = TkCanvas.new(frame, :width=>300, :height=>200,
- :background=>'black')
- @c.pack(:padx=>10, :pady=>10, :expand=>true)
-
- # Creates a coordinates list of a wave.
- @waveCoords = []
- @backupCoords = []
- n = 0
- (-10..300).step(5){|n| @waveCoords << [n, 100]; @backupCoords << [n, 100] }
- @waveCoords << [n, 0]; @backupCoords << [n, 0]
- @waveCoords << [n+5, 200]; @backupCoords << [n+5, 200]
- @coordsLen = @waveCoords.length
-
- # Create a smoothed line and arrange for its coordinates to be the
- # contents of the variable waveCoords.
- @line = TkcLine.new(@c, @waveCoords,
- :width=>1, :fill=>'green', :smooth=>true)
-
- # Main animation "loop".
- # Theoretically 100 frames-per-second (==10ms between frames)
- @timer = TkTimer.new(10){ basicMotion; reverser }
-
- # Arrange for the animation loop to stop when the canvas is deleted
- @c.bindtags_unshift(TkBindTag.new('Destroy'){ @timer.stop })
- end
-
- # Basic motion handler. Given what direction the wave is travelling
- # in, it advances the y coordinates in the coordinate-list one step in
- # that direction.
- def basicMotion
- @backupCoords, @waveCoords = @waveCoords, @backupCoords
- (0...@coordsLen).each{|idx|
- if @direction == :left
- @waveCoords[idx][1] = @backupCoords[(idx+1 == @coordsLen)? 0: idx+1][1]
- else
- @waveCoords[idx][1] = @backupCoords[(idx == 0)? -1: idx-1][1]
- end
- }
- @line.coords(@waveCoords)
- end
-
- # Oscillation handler. This detects whether to reverse the direction
- # of the wave by checking to see if the peak of the wave has moved off
- # the screen (whose size we know already.)
- def reverser
- if @waveCoords[0][1] < 10
- @direction = :right
- elsif @waveCoords[-1][1] < 10
- @direction = :left
- end
- end
-
- # animation control
- def move
- @timer.start
- end
-
- def stop
- @timer.stop
- end
-end
-
-# Start the animation processing
-AnimatedWaveDemo.new($aniwave_demo, :left).move
diff --git a/ext/tk/sample/demos-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb
index e1e23b9893..70127424c5 100644
--- a/ext/tk/sample/demos-jp/bind.rb
+++ b/ext/tk/sample/demos-jp/bind.rb
@@ -90,35 +90,17 @@ TkText.new($bind_demo){|t|
tag_binding_for_bind_demo(tag, tagstyle_bold, tagstyle_normal)
}
d1.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'items.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'items.rb'].join(File::Separator)}`})
d2.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`})
d3.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`})
d4.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`})
d5.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`})
d6.bind('1',
- proc{
- eval(`cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`,
- _null_binding)
- })
+ proc{eval `cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`})
TkTextMarkInsert.new(t, '0.0')
configure('state','disabled')
diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb
index f681a4d684..5d0c74a743 100644
--- a/ext/tk/sample/demos-jp/check2.rb
+++ b/ext/tk/sample/demos-jp/check2.rb
@@ -76,31 +76,31 @@ TkCheckButton.new($check2_demo, :text=>'°ÂÁ´À­¸¡ºº', :variable=>safety,
# tristate check
in_check = false
tristate_check = proc{|n1,n2,op|
- unless in_check
- in_check = true
- begin
- if n1 == safety
- if safety == 'none'
- wipers.value = 0
- brakes.value = 0
- sober.value = 0
- elsif safety == 'all'
- wipers.value = 1
- brakes.value = 1
- sober.value = 1
- end
+ return if in_check
+
+ in_check = true
+ begin
+ if n1 == safety
+ if safety == 'none'
+ wipers.value = 0
+ brakes.value = 0
+ sober.value = 0
+ elsif safety == 'all'
+ wipers.value = 1
+ brakes.value = 1
+ sober.value = 1
+ end
+ else
+ if wipers == 1 && brakes == 1 && sober == 1
+ safety.value = 'all'
+ elsif wipers == 1 || brakes == 1 || sober == 1
+ safety.value = 'partial'
else
- if wipers == 1 && brakes == 1 && sober == 1
- safety.value = 'all'
- elsif wipers == 1 || brakes == 1 || sober == 1
- safety.value = 'partial'
- else
- safety.value = 'none'
- end
+ safety.value = 'none'
end
- ensure
- in_check = false
end
+ ensure
+ in_check = false
end
}
diff --git a/ext/tk/sample/demos-jp/ctext.rb b/ext/tk/sample/demos-jp/ctext.rb
index 66e1fe8107..a71b6f2cb0 100644
--- a/ext/tk/sample/demos-jp/ctext.rb
+++ b/ext/tk/sample/demos-jp/ctext.rb
@@ -60,7 +60,7 @@ TkcRectangle.new($ctext_canvas, 245, 195, 255, 205,
$ctag_text = TkcTag.new($ctext_canvas)
$ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200,
- 'text'=>"¤³¤ì¤Ï¥­¥ã¥ó¥Ð¥¹widget¤Î¥Æ¥­¥¹¥Èµ¡Ç½¤ò¥Ç¥â¤¹¤ë¤¿¤á¤Îʸ»úÎó¤Ç¤¹¡£\n¾å¤Ç½Ò¤Ù¤¿¤è¤¦¤ÊÊÔ½¸¤ò²Äǽ¤È¤¹¤ë¤¿¤á¤Î¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ò»Ü¤·¤Æ¤¤¤Þ¤¹¡£",
+ 'text'=>"¤³¤ì¤Ï¥­¥ã¥ó¥Ð¥¹widget¤Î¥Æ¥­¥¹¥Èµ¡Ç½¤ò¥Ç¥â¤¹¤ë¤¿¤á¤Îʸ»úÎó¤Ç¤¹¡£¥Þ¥¦¥¹¤ò»ý¤Ã¤Æ¤¤¤­¡¢¥¯¥ê¥Ã¥¯¤·¤ÆÆþÎϤǤ­¤Þ¤¹¡£ÁªÂò¤·¤Æ¥³¥ó¥È¥í¡¼¥ë-D¤Ç¾Ãµî¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£",
'width'=>440, 'anchor'=>'n',
'font'=>'-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*',
'kanjifont'=>'-*-r-*--24-*-jisx0208.1983-0',
diff --git a/ext/tk/sample/demos-jp/floor.rb b/ext/tk/sample/demos-jp/floor.rb
index b029580bd6..517600de92 100644
--- a/ext/tk/sample/demos-jp/floor.rb
+++ b/ext/tk/sample/demos-jp/floor.rb
@@ -1664,8 +1664,8 @@ else
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
- v.command(proc{|*args| $floor_canvas.yview(*args)})
- h.command(proc{|*args| $floor_canvas.xview(*args)})
+ v.command(proc{|*args| c.yview(*args)})
+ h.command(proc{|*args| c.xview(*args)})
}
end
diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb
index a20b31d45c..fcf208b61f 100644
--- a/ext/tk/sample/demos-jp/floor2.rb
+++ b/ext/tk/sample/demos-jp/floor2.rb
@@ -1664,8 +1664,8 @@ else
pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
- v.command(proc{|*args| $floor2_canvas.yview(*args)})
- h.command(proc{|*args| $floor2_canvas.xview(*args)})
+ v.command(proc{|*args| c.yview(*args)})
+ h.command(proc{|*args| c.xview(*args)})
}
end
diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb
deleted file mode 100644
index 592b69f775..0000000000
--- a/ext/tk/sample/demos-jp/goldberg.rb
+++ /dev/null
@@ -1,2003 +0,0 @@
-#
-# Ruby/Tk Goldverg demo (called by 'widget')
-#
-# Based on Tcl/Tk8.5a2 widget demos.
-# The following is the original comment of TkGoldberg.tcl.
-#
-#>>##+#################################################################
-#>>#
-#>># TkGoldberg.tcl
-#>># by Keith Vetter, March 13, 2003
-#>>#
-#>># "Man will always find a difficult means to perform a simple task"
-#>># Rube Goldberg
-#>>#
-#>># Reproduced here with permission.
-#>>#
-#>>##+#################################################################
-#>>#
-#>># Keith Vetter 2003-03-21: this started out as a simple little program
-#>># but was so much fun that it grew and grew. So I apologize about the
-#>># size but I just couldn't resist sharing it.
-#>>#
-#>># This is a whizzlet that does a Rube Goldberg type animation, the
-#>># design of which comes from an New Years e-card from IncrediMail.
-#>># That version had nice sound effects which I eschewed. On the other
-#>># hand, that version was in black and white (actually dark blue and
-#>># light blue) and this one is fully colorized.
-#>>#
-#>># One thing I learned from this project is that drawing filled complex
-#>># objects on a canvas is really hard. More often than not I had to
-#>># draw each item twice--once with the desired fill color but no
-#>># outline, and once with no fill but with the outline. Another trick
-#>># is erasing by drawing with the background color. Having a flood fill
-#>># command would have been extremely helpful.
-#>>#
-#>># Two wiki pages were extremely helpful: Drawing rounded rectangles
-#>># which I generalized into Drawing rounded polygons, and regular
-#>># polygons which allowed me to convert ovals and arcs into polygons
-#>># which could then be rotated (see Canvas Rotation). I also wrote
-#>># Named Colors to aid in the color selection.
-#>>#
-#>># I could comment on the code, but it's just 26 state machines with
-#>># lots of canvas create and move calls.
-
-if defined?($goldberg_demo) && $goldberg_demo
- $goldberg_demo.destroy
- $goldberg_demo = nil
-end
-
-# demo toplevel widget
-$goldberg_demo = TkToplevel.new {|w|
- title("Tk Goldberg (demonstration)")
- iconname("goldberg")
-# positionWindow(w)
-}
-
-=begin
-# label
-msg = TkLabel.new($goldberg_demo) {
- font 'Arial 10'
- wraplength '4i'
- justify 'left'
- text "¤³¤ì¤Ï¡¢¤¢¤Ê¤¿¤¬¼«Ê¬¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¤¤¤«¤ËÆþ¤êÁȤó¤À¤â¤Î¤Ë¤Ç¤­¤ë¤«¤ò¼¨¤¹¤È¤¤¤¦¤À¤±¤Î¤¿¤á¤Î¥Ç¥â¤Ç¤¹¡£¥Ü¡¼¥ë¤ò¥¯¥ê¥Ã¥¯¤¹¤ì¤Ðʪ¤¬Æ°¤­»Ï¤á¤Þ¤¹¡ª\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
-}
-msg.pack('side'=>'top')
-=end
-
-=begin
-# frame
-TkFrame.new($goldberg_demo) {|frame|
- TkButton.new(frame) {
- text 'ÊĤ¸¤ë'
- command proc{
- tmppath = $goldberg_demo
- $goldberg_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
- command proc{showCode 'goldberg'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-=end
-
-#########################################
-
-class TkGoldberg_Demo
- def initialize(parent)
- @parent = parent
-
- @S = {}
- @S['title'] = 'Tk Goldberg'
- @S['speed'] = TkVariable.new(5)
- @S['cnt'] = TkVariable.new(0)
- # @S['message'] = TkVariable.new("\\nWelcome\\nto\\nRuby/Tk")
- @S['message'] = TkVariable.new("\\n ¤è¤¦¤³¤½¡ª\\nRuby/Tk\\n¤Î\\nÀ¤³¦¤Ø")
- @S['pause'] = TkVariable.new
- @S['details'] = TkVariable.new(true)
-
- @S['mode'] = TkVariable.new(:MSTART, :symbol)
- # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG
-
- # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- @speed = [1, 10, 20, 50, 80, 100, 150, 200, 300, 400, 500]
-
- # colors
- @C = {}
- @C['fg'] = 'black'
- # @C['bg'] = 'gray75'
- @C['bg'] = 'cornflowerblue'
-
- @C['0'] = 'white'; @C['1a'] = 'darkgreen'; @C['1b'] = 'yellow'
- @C['2'] = 'red'; @C['3a'] = 'green'; @C['3b'] = 'darkblue'
- @C['4'] = @C['fg']; @C['5a'] = 'brown'; @C['5b'] = 'white'
- @C['6'] = 'magenta'; @C['7'] = 'green'; @C['8'] = @C['fg']
- @C['9'] = 'blue4'; @C['10a'] = 'white'; @C['10b'] = 'cyan'
- @C['11a'] = 'yellow'; @C['11b'] = 'mediumblue'; @C['12'] = 'tan2'
- @C['13a'] = 'yellow'; @C['13b'] = 'red'; @C['14'] = 'white'
- @C['15a'] = 'green'; @C['15b'] = 'yellow'; @C['16'] = 'gray65'
- @C['17'] = '#A65353'; @C['18'] = @C['fg']; @C['19'] = 'gray50'
- @C['20'] = 'cyan'; @C['21'] = 'gray65'; @C['22'] = @C['20']
- @C['23a'] = 'blue'; @C['23b'] = 'red'; @C['23c'] = 'yellow'
- @C['24a'] = 'red'; @C['24b'] = 'white';
-
- @STEP = TkVariable.new_hash
- @STEP.default_value_type = :numeric
-
- @XY = {}
-
- @XY6 = {
- '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192],
- '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176],
- '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164],
- '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151],
- '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219],
- '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324],
- '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346],
- '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391],
- '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456],
- '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443],
- '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437],
- '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424],
- '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412],
- '13,15'=>[376, 410], '13,16'=>[360, 403]
- }
-
- @timer = TkTimer.new(@speed[@S['speed'].numeric]){|timer|
- timer.set_interval(go)
- }
-
- do_display
- reset
-
- # Start everything going
- @timer.start
- end
-
- def do_display()
- @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5)
- @screen = TkFrame.new(@parent, :bd=>2,
- :relief=>:raised).pack(:side=>:left, :fill=>:both,
- :expand=>true)
-
- @canvas = TkCanvas.new(@parent, :width=>850, :height=>700,
- :bg=>@C['bg'], :highlightthickness=>0){
- scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up
- yview_moveto(0.05)
- }.pack(:in=>@screen, :side=>:top, :fill=>:both, :expand=>true)
-
- @canvas.bind('3'){ @pause.invoke }
- @canvas.bind('Destroy'){ @timer.stop }
-
- do_ctrl_frame
- do_detail_frame
-
- msg = TkLabel.new(@parent, :bg=>@C['bg'], :fg=>'white') {
- font 'Arial 10'
- wraplength 600
- justify 'left'
- text "¤³¤ì¤Ï¡¢¤¢¤Ê¤¿¤¬¼«Ê¬¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¤¤¤«¤ËÆþ¤êÁȤó¤À¤â¤Î¤Ë¤Ç¤­¤ë¤«¤ò¼¨¤¹¤È¤¤¤¦¤À¤±¤Î¤¿¤á¤Î¥Ç¥â¤Ç¤¹¡£¥Ü¡¼¥ë¤ò¥¯¥ê¥Ã¥¯¤¹¤ì¤Ðʪ¤¬Æ°¤­»Ï¤á¤Þ¤¹¡ª\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg"
- }
- msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw)
-
- frame = TkFrame.new(@parent, :bg=>@C['bg'])
-
- TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
- text 'ÊĤ¸¤ë'
- command proc{
- tmppath = $goldberg_demo
- $goldberg_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left')
-
- TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
- text '¥³¡¼¥É»²¾È'
- command proc{showCode 'goldberg'}
- }.pack('side'=>'left', 'padx'=>5)
-
- @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl},
- :bg=>@C['bg'], :activebackground=>@C['bg'])
- @show.pack('side'=>'left')
- frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne)
-
- Tk.update
- end
-
- def do_ctrl_frame
- @start = TkButton.new(@parent, :text=>'Start', :bd=>6,
- :command=>proc{do_button(0)})
- @start.font(@start['font'].weight('bold'))
- font = @start['font']
-
- @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font,
- :command=>proc{do_button(1)}, :relief=>:raised,
- :variable=>@S['pause'])
-
- @step = TkButton.new(@parent, :text=>'Single Step', :font=>font,
- :command=>proc{do_button(2)})
- @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font,
- :command=>proc{do_button(4)})
- @reset = TkButton.new(@parent, :text=>'Reset', :font=>font,
- :command=>proc{do_button(3)})
-
- @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge)
- @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font,
- :relief=>:raised, :variable=>@S['details'])
-
- @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'],
- :justify=>:center)
- @speed_scale = TkScale.new(@parent, :orient=>:horizontal,
- :from=>1, :to=>10, :font=>font,
- :variable=>@S['speed'], :bd=>2,
- :relief=>:ridge, :showvalue=>false)
- @about = TkButton.new(@parent, :text=>'About',
- :command=>proc{about}, :font=>font)
-
- Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew)
- @ctrl.grid_rowconfigure(1, :minsize=>10)
- Tk.grid(@pause, :in=>@ctrl, :row=>2, :sticky=>:ew)
- Tk.grid(@step, :in=>@ctrl, :sticky=>:ew)
- Tk.grid(@bstep, :in=>@ctrl, :sticky=>:ew)
- Tk.grid(@reset, :in=>@ctrl, :sticky=>:ew)
- @ctrl.grid_rowconfigure(10, :minsize=>20)
- Tk.grid(@details, :in=>@ctrl, :row=>11, :sticky=>:ew)
- Tk.grid(@detail, :in=>@details, :row=>0, :sticky=>:ew)
- @ctrl.grid_rowconfigure(50, :weight=>1)
-
- @S['mode'].trace('w', proc{|*args| active_GUI(*args)})
- @S['details'].trace('w', proc{|*args| active_GUI(*args)})
- @S['speed'].trace('w', proc{|*args| active_GUI(*args)})
-
- Tk.grid(@msg_entry, :in=>@ctrl, :row=>98, :sticky=>:ew, :pady=>5)
- Tk.grid(@speed_scale, :in=>@ctrl, :row=>99, :sticky=>:ew)
- Tk.grid(@about, :in=>@ctrl, :row=>100, :sticky=>:ew)
-
- @reset.bind('3'){@S['mode'].value = -1} # Debugging
- end
-
- def do_detail_frame
- @f_details = TkFrame.new(@details)
-
- @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'],
- :bd=>1, :relief=>:solid, :bg=>'white')
- Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0)
-
- idx = 1
- loop {
- break unless respond_to?("move#{idx}")
- l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e,
- :width=>2, :bd=>1, :relief=>:solid, :bg=>'white')
- @STEP[idx] = 0
- ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx),
- :width=>5, :bd=>1, :relief=>:solid, :bg=>'white')
- row = (idx + 1)/2
- col = ((idx + 1) & 1) * 2
- Tk.grid(l, :sticky=>:ew, :row=>row, :column=>col)
- Tk.grid(ll, :sticky=>:ew, :row=>row, :column=>(col + 1))
- idx += 1
- }
- @f_details.grid_columnconfigure(1, :weight=>1)
- end
-
- def show_ctrl
- if @ctrl.winfo_mapped?
- @ctrl.pack_forget
- @show.text('>>')
- else
- @ctrl.pack(:side=>:right, :fill=>:both, :ipady=>5)
- @show.text('<<')
- end
- end
-
- def draw_all
- reset_step
- @canvas.delete(:all)
- idx = 0
- loop{
- m = "draw#{idx}"
- break unless respond_to?(m)
- send(m)
- idx += 1
- }
- end
-
- def active_GUI(var1, var2, op)
- st = {false=>:disabled, true=>:normal}
-
- m = @S['mode'].to_sym
- @S['pause'].value = (m == :MPAUSE)
- @start.state(st[m != :MGO])
- @pause.state(st[m != :MSTART && m != :MDONE])
- @step.state(st[m != :MGO && m != :MDONE])
- @bstep.state(st[m != :MGO && m != :MDONE])
- @reset.state(st[m != :MSTART])
-
- if @S['details'].bool
- Tk.grid(@f_details, :in=>@details, :row=>2, :sticky=>:ew)
- else
- Tk.grid_forget(@f_details)
- end
- @speed_scale.label("Speed: #{@S['speed'].value}")
- end
-
- def start
- @S['mode'].value = :MGO
- end
-
- def do_button(what)
- case what
- when 0 # Start
- reset if @S['mode'].to_sym == :MDONE
- @S['mode'].value = :MGO
-
- when 1 # Pause
- @S['mode'].value = ((@S['pause'].bool)? :MPAUSE: :MGO)
-
- when 2 # Step
- @S['mode'].value = :MSSTEP
-
- when 3 # Reset
- reset
-
- when 4 # Big step
- @S['mode'].value = :MBSTEP
- end
- end
-
- def go(who = nil)
- now = Tk::Clock.clicks(:miliseconds)
- if who # Start here for debugging
- @S['active'] = [who]
- @S['mode'].value = :MGO
- end
- return if @S['mode'].to_sym == :MDEBUG # Debugging
- # If not paused, do the next move
- n = next_step if @S['mode'].to_sym != :MPAUSE
- @S['mode'].value = :MPAUSE if @S['mode'].to_sym == :MSSTEP # Single step
- @S['mode'].value = :MSSTEP if @S['mode'].to_sym == :MBSTEP && n # big step
- elapsed = Tk::Clock.clicks(:miliseconds) - now
- delay = @speed[@S['speed'].to_i] - elapsed
- delay = 1 if delay <= 0
- return delay
- end
-
- def next_step
- retval = false # Return value
-
- if @S['mode'].to_sym != :MSTART && @S['mode'].to_sym != :MDONE
- @S['cnt'].numeric += 1
- end
- alive = []
- @S['active'].each{|who|
- who = who.to_i
- n = send("move#{who}")
- if (n & 1).nonzero? # This guy still alive
- alive << who
- end
- if (n & 2).nonzero? # Next guy is active
- alive << (who + 1)
- retval = true
- end
- if (n & 4).nonzero? # End of puzzle flag
- @S['mode'].value = :MDONE # Done mode
- @S['active'] = [] # No more animation
- return true
- end
- }
- @S['active'] = alive
- return retval
- end
-
- def about
- msg = "Ruby/Tk Version ::\nby Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)\n\n"
- msg += "Original Version ::\n"
- msg += "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n"
- msg += "Man will always find a difficult means to perform a simple task"
- msg += "\nRube Goldberg"
- Tk.messageBox(:message=>msg, :title=>'About')
- end
-
- ################################################################
- #
- # All the drawing and moving routines
- #
-
- # START HERE! banner
- def draw0
- color = @C['0']
- TkcText.new(@canvas,
- # [579, 119], :text=>'START HERE!',
- [558, 119], :text=>'¤³¤³¤«¤é¥¹¥¿¡¼¥È¡ª',
- :fill=>color, :anchor=>:w,
- :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold])
- TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color,
- :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5])
- @canvas.itembind('I0', '1'){ start }
- end
-
- def move0(step = nil)
- step = get_step(0, step)
-
- if @S['mode'].to_sym != :MSTART # Start the ball rolling
- move_abs('I0', [-100, -100]) # Hide the banner
- return 2
- end
-
- pos = [
- [673, 119], [678, 119], [683, 119], [688, 119],
- [693, 119], [688, 119], [683, 119], [678, 119]
- ]
- step = step % pos.length
- move_abs('I0', pos[step])
- return 1
- end
-
- # Dropping ball
- def draw1
- color = @C['1a']
- color2 = @C['1b']
- TkcPolygon.new(@canvas,
- [ 844, 133, 800, 133, 800, 346, 820, 346,
- 820, 168, 844, 168, 844, 133 ],
- :width=>3, :fill=>color, :outline=>'')
- TkcPolygon.new(@canvas,
- [ 771, 133, 685, 133, 685, 168, 751, 168,
- 751, 346, 771, 346, 771, 133 ],
- :width=>3, :fill=>color, :outline=>'')
- TkcOval.new(@canvas, box(812, 122, 9),
- :tag=>'I1', :fill=>color2, :outline=>'')
-
- @canvas.itembind('I1', '1'){ start }
- end
-
- def move1(step = nil)
- step = get_step(1, step)
- pos = [
- [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153],
- [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438],
- [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601],
- [-100, -100]
- ]
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I1', where)
- move15a if where[2] == :y
- return 3 if where[2] == :x
- return 1
- end
-
- # Lighting the match
- def draw2
- color = @C['2']
-
- # Fulcrum
- TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392],
- :fill=>@C['fg'], :outline=>@C['fg'])
-
- # Strike box
- TkcRectangle.new(@canvas, [628, 335, 660, 383],
- :fill=>'', :outline=>@C['fg'])
- (0..2).each{|y|
- yy = 335 + y*16
- TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25',
- :anchor=>:nw, :foreground=>@C['fg'])
- TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25',
- :anchor=>:nw, :foreground=>@C['fg'])
- }
-
- # Lever
- TkcLine.new(@canvas, [702, 366, 798, 366],
- :fill=>@C['fg'], :width=>6, :tag=>'I2_0')
-
- # R strap
- TkcLine.new(@canvas, [712, 363, 712, 355],
- :fill=>@C['fg'], :width=>3, :tag=>'I2_1')
-
- # L strap
- TkcLine.new(@canvas, [705, 363, 705, 355],
- :fill=>@C['fg'], :width=>3, :tag=>'I2_2')
-
- # Match stick
- TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356],
- :fill=>@C['fg'], :width=>3, :tag=>'I2_3')
-
- # Match head
- TkcPolygon.new(@canvas,
- [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1,
- 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ],
- :fill=>color, :outline=>color, :tag=>'I2_4')
- end
-
- def move2(step = nil)
- step = get_step(2, step)
-
- stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1]
- xy = []
- xy[0] = [
- 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307,
- 662, 318, 662, 328, 671, 336
- ]
- xy[1] = [
- 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311,
- 661, 327, 671, 335
- ]
- xy[2] = [
- 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298,
- 666, 309, 660, 324, 672, 336
- ]
-
- if step >= stages.length
- @canvas.delete('I2')
- return 0
- end
-
- if step == 0 # Rotate the match
- beta = 20
-
- ox, oy = anchor('I2_0', :s) # Where to pivot
-
- i = 0
- until @canvas.find_withtag("I2_#{i}").empty?
- rotate_item("I2_#{i}", ox, oy, beta)
- i += 1
- end
-
- # For the flame
- TkcPolygon.new(@canvas, [], :tag=>'I2', :smooth=>true, :fill=>@C['2'])
-
- return 1
- end
- @canvas.coords('I2', xy[stages[step]])
- return ((step == 7)? 3: 1)
- end
-
- # Weight and pulleys
- def draw3
- color = @C['3a']
- color2 = @C['3b']
-
- xy = [ [602, 296], [577, 174], [518, 174] ]
- xy.each{|x, y| # 3 Pulleys
- TkcOval.new(@canvas, box(x, y, 13),
- :fill=>color, :outline=>@C['fg'], :width=>3)
- TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg'])
- }
-
- # Wall to flame
- TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s',
- :width=>3, :fill=>@C['fg'], :smooth=>true)
-
- # Flame to pulley 1
- TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0',
- :width=>3, :fill=>@C['fg'], :smooth=>true)
- TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1',
- :width=>3, :fill=>@C['fg'], :smooth=>true)
-
- # Pulley 1 half way to 2
- TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2',
- :width=>3, :fill=>@C['fg'])
-
- # Pulley 1 other half to 2
- TkcLine.new(@canvas, [589, 235, 589, 174], :width=>3, :fill=>@C['fg'])
-
- # Across the top
- TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg'])
-
- # Down to weight
- TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w',
- :width=>3, :fill=>@C['fg'])
-
- # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
- x1, y1, x2, y2 = [515, 207, 495, 207]
- TkcOval.new(@canvas, box(x1, y1, 6),
- :tag=>'I3_', :fill=>color2, :outline=>color2)
- TkcOval.new(@canvas, box(x2, y2, 6),
- :tag=>'I3_', :fill=>color2, :outline=>color2)
- TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6,
- :tag=>'I3_', :fill=>color2, :outline=>color2)
-
- TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15),
- :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2)
-
- TkcLine.new(@canvas, [500, 217, 511, 217],
- :tag=>'I3_', :fill=>color2, :width=>10)
-
- # Bottom weight target
- TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465],
- :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10)
- end
-
- def move3(step = nil)
- step = get_step(3, step)
-
- pos = [ [505, 247], [505, 297], [505, 386.5], [505, 386.5] ]
- rope = []
- rope[0] = [750, 309, 729, 301, 711, 324, 690, 300]
- rope[1] = [750, 309, 737, 292, 736, 335, 717, 315, 712, 320]
- rope[2] = [750, 309, 737, 309, 740, 343, 736, 351, 725, 340]
- rope[3] = [750, 309, 738, 321, 746, 345, 742, 356]
-
- return 0 if step >= pos.length
-
- @canvas.delete("I3_#{step}") # Delete part of the rope
- move_abs('I3_', pos[step]) # Move weight down
- @canvas.coords('I3_s', rope[step]) # Flapping rope end
- @canvas.coords('I3_w', [505, 174].concat(pos[step]))
- if step == 2
- @canvas.move('I3__', 0, 30)
- return 2
- end
- return 1
- end
-
- # Cage and door
- def draw4
- color = @C['4']
- x0, y0, x1, y1 = [527, 356, 611, 464]
-
- # Horizontal bars
- y0.step(y1, 12){|y|
- TkcLine.new(@canvas, [x0, y, x1, y], :fill=>color, :width=>1)
- }
-
- # Vertical bars
- x0.step(x1, 12){|x|
- TkcLine.new(@canvas, [x, y0, x, y1], :fill=>color, :width=>1)
- }
-
- # Swing gate
- TkcLine.new(@canvas, [518, 464, 518, 428],
- :tag=>'I4', :fill=>color, :width=>1)
- end
-
- def move4(step = nil)
- step = get_step(4, step)
-
- angles = [-10, -20, -30, -30]
- return 0 if step >= angles.length
-
- rotate_item('I4', 518, 464, angles[step])
- @canvas.raise('I4')
-
- return((step == 3)? 3: 1)
- end
-
- # Mouse
- def draw5
- color = @C['5a']
- color2 = @C['5b']
-
- xy = [377, 248, 410, 248, 410, 465, 518, 465] # Mouse course
- xy.concat [518, 428, 451, 428, 451, 212, 377, 212]
-
- TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3)
-
- xy = [
- 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446,
- 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452
- ]
- TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color)
-
- TkcLine.new(@canvas, [573, 452, 592, 458, 601, 460, 613, 456], # Tail
- :tag=>['I5', 'I5_1'], :fill=>color, :smooth=>true, :width=>3)
-
- xy = box(540, 446, 2) # Eye
- xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445]
- TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'],
- :outline=>'', :smooth=>true)
-
- xy = [538, 454, 535, 461] # Front leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_3'], :fill=>color, :width=>2)
-
- xy = [566, 455, 569, 462] # Back leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_4'], :fill=>color, :width=>2)
-
- xy = [544, 455, 545, 460] # 2nd front leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_5'], :fill=>color, :width=>2)
-
- xy = [560, 455, 558, 460] # 2nd back leg
- TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_6'], :fill=>color, :width=>2)
- end
-
- def move5(step = nil)
- step = get_step(5, step)
-
- pos = [
- [553, 452], [533, 452], [513, 452], [493, 452], [473, 452],
- [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414],
- [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294],
- [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237]
- ]
-
- return 0 if step >= pos.length
-
- x, y, beta, nxt = pos[step]
- move_abs('I5', [x, y])
- if beta
- ox, oy = centroid('I5_0')
- (0..6).each{|id| rotate_item("I5_#{id}", ox, oy, beta) }
- end
- return 3 if nxt == :x
- return 1
- end
-
- # Dropping gumballs
- def draw6
- color = @C['6']
- xy = [324, 130, 391, 204] # Ball holder
- xy = round_rect(xy, 10)
- TkcPolygon.new(@canvas, xy, :smooth=>true,
- :outline=>@C['fg'], :width=>3, :fill=>color)
- xy = [339, 204, 376, 253] # Below the ball holder
- TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
- :fill=>color, :tag=>'I6c')
- xy = box(346, 339, 28)
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
- :start=>80, :extent=>205)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
- :start=>-41, :extent=>85)
-
- xy = box(346, 339, 15) # Center of rotor
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['fg'], :tag=>'I6m')
- xy = [352, 312, 352, 254, 368, 254, 368, 322] # Top drop to rotor
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'')
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
-
- xy = [353, 240, 367, 300] # Poke bottom hole
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
- xy = [341, 190, 375, 210] # Poke another hole
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
-
- xy = [
- 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403,
- 352, 403, 352, 366
- ]
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'',
- :width=>2) # Below rotor
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
- xy = box(275, 342, 7) # On/off rotor
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['fg'])
- xy = [276, 334, 342, 325] # Fan belt top
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = [276, 349, 342, 353] # Fan belt bottom
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
-
- xy = [337, 212, 337, 247] # What the mouse pushes
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I6_')
- xy = [392, 212, 392, 247]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I6_')
- xy = [337, 230, 392, 230]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>7, :tag=>'I6_')
-
- who = -1 # All the balls
- colors = %w(red cyan orange green blue darkblue)
- colors *= 3
-
- (0..16).each{|i|
- loc = -i
- color = colors[i]
- x, y = @XY6["#{loc}"]
- TkcOval.new(@canvas, box(x, y, 5),
- :fill=>color, :outline=>color, :tag=>"I6_b#{i}")
- }
- draw6a(12) # The wheel
- end
-
- def draw6a(beta)
- @canvas.delete('I6_0')
- ox, oy = [346, 339]
- (0..3).each{|i|
- b = beta + i * 45
- x, y = rotate_c(28, 0, 0, 0, b)
- xy = [ox + x, oy + y, ox - x, oy - y]
- TkcLine.new(@canvas, xy, :tag=>'I6_0', :fill=>@C['fg'], :width=>2)
- }
- end
-
- def move6(step = nil)
- step = get_step(6, step)
-
- return 0 if step > 62
-
- if step < 2 # Open gate for balls to drop
- @canvas.move('I6_', -7, 0)
- if step == 1 # Poke a hole
- xy = [348, 226, 365, 240]
- TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill),
- :outline=>'')
- end
- return 1
- end
-
- s = step - 1 # Do the gumball drop dance
- (0..(((s - 1)/3).to_i)).each{|i|
- tag = "I6_b#{i}"
- break if @canvas.find_withtag(tag).empty?
- loc = s - 3*i
-
- if @XY6["#{loc},#{i}"]
- move_abs(tag, @XY6["#{loc},#{i}"])
- elsif @XY6["#{loc}"]
- move_abs(tag, @XY6["#{loc}"])
- end
- }
- if s % 3 == 1
- first = (s + 2)/3
- i = first
- loop {
- tag = "I6_b#{i}"
- break if @canvas.find_withtag(tag).empty?
- loc = first - i
- move_abs(tag, @XY6["#{loc}"])
- i += 1
- }
- end
- if s >= 3 # Rotate the motor
- idx = s % 3
- draw6a(12 + s * 15)
- end
- return((s == 3)? 3 : 1)
- end
-
- # On/off switch
- def draw7
- color = @C['7']
- xy = [198, 306, 277, 374] # Box
- TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2,
- :fill=>color, :tag=>'I7z')
- @canvas.lower('I7z')
- xy = [275, 343, 230, 349]
- TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last,
- :arrowshape=>[23, 23, 8], :width=>6)
- xy = [225, 324] # On button
- x, y = xy
- TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
- xy = [218, 323] # On text
- font = ['Times Roman', 8]
- TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e,
- :fill=>@C['fg'], :font=>font)
- xy = [225, 350] # Off button
- x, y = xy
- TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
- xy = [218, 349] # Off text
- TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e,
- :fill=>@C['fg'], :font=>font)
- end
-
- def move7(step = nil)
- step = get_step(7, step)
-
- numsteps = 30
- return 0 if step > numsteps
- beta = 30.0 / numsteps
- rotate_item('I7', 275, 343, beta)
-
- return((step == numsteps)? 3: 1)
- end
-
- # Electricity to the fan
- def draw8
- sine([271, 248, 271, 306], 5, 8, :tag=>'I8_s', :fill=>@C['8'], :width=>3)
- end
-
- def move8(step = nil)
- step = get_step(8, step)
-
- return 0 if step > 3
- if step == 0
- sparkle(anchor('I8_s', :s), 'I8')
- return 1
- elsif step == 1
- move_abs('I8', anchor('I8_s', :c))
- elsif step == 2
- move_abs('I8', anchor('I8_s', :n))
- else
- @canvas.delete('I8')
- end
- return((step == 2)? 3: 1)
- end
-
- # Fan
- def draw9
- color = @C['9']
- xy = [266, 194, 310, 220]
- TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
- xy = [280, 209, 296, 248]
- TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
- xy = [
- 288, 249, 252, 249, 260, 240, 280, 234,
- 296, 234, 316, 240, 324, 249, 288, 249
- ]
- TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true)
-
- xy = [248, 205, 265, 214, 264, 205, 265, 196] # Spinner
- TkcPolygon.new(@canvas, xy, :fill=>color)
-
- xy = [255, 206, 265, 234] # Fan blades
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I9_0')
- xy = [255, 176, 265, 204]
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I9_0')
- xy = [255, 206, 265, 220]
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>1, :tag=>'I9_1')
- xy = [255, 190, 265, 204]
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
- :width=>1, :tag=>'I9_1')
- end
-
- def move9(step = nil)
- step = get_step(9, step)
-
- if (step & 1).nonzero?
- @canvas.itemconfigure('I9_0', :width=>4)
- @canvas.itemconfigure('I9_1', :width=>1)
- @canvas.lower('I9_1', 'I9_0')
- else
- @canvas.itemconfigure('I9_0', :width=>1)
- @canvas.itemconfigure('I9_1', :width=>4)
- @canvas.lower('I9_0', 'I9_1')
- end
- return 3 if step == 0
- return 1
- end
-
- # Boat
- def draw10
- color = @C['10a']
- color2 = @C['10b']
- xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail
- TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'],
- :tag=>'I10')
- xy = box(209, 204, 31) # Front
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie,
- :start=>120, :extent=>120, :tag=>'I10')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>120, :extent=>120, :tag=>'I10')
- xy = box(249, 204, 31) # Back
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3,
- :style=>:pie, :start=>120, :extent=>120, :tag=>'I10')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>120, :extent=>120, :tag=>'I10')
-
- xy = [200, 171, 200, 249] # Mast
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I10')
- xy = [159, 234, 182, 234] # Bow sprit
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I10')
- xy = [180, 234, 180, 251, 220, 251] # Hull
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>6, :tag=>'I10')
-
- xy = [92, 255, 221, 255] # Waves
- sine(xy, 2, 25, :fill=>color2, :width=>1, :tag=>'I10w')
-
- xy = @canvas.coords('I10w')[4..-5] # Water
- xy.concat([222, 266, 222, 277, 99, 277])
- TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>color2)
- xy = [222, 266, 222, 277, 97, 277, 97, 266] # Water bottom
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
-
- xy = box(239, 262, 17)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>95, :extent=>103)
- xy = box(76, 266, 21)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :extent=>190)
- end
-
- def move10(step = nil)
- step = get_step(10, step)
-
- pos = [
- [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212],
- [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212],
- [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212],
- [116, 212], [111, 212]
- ]
-
- return 0 if step >= pos.length
-
- where = pos[step]
- move_abs('I10', where)
-
- return 3 if where[2] == :x
- return 1
- end
-
- # 2nd ball drop
- def draw11
- color = @C['11a']
- color2 = @C['11b']
- xy = [23, 264, 55, 591] # Color the down tube
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
- xy = box(71, 460, 48) # Color the outer loop
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
-
- xy = [55, 264, 55, 458] # Top right side
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = [55, 504, 55, 591] # Bottom right side
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = box(71, 460, 48) # Outer loop
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>110, :extent=>-290, :tag=>'I11i')
- xy = box(71, 460, 16) # Inner loop
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'',
- :width=>3, :tag=>'I11i')
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3)
-
- xy = [23, 264, 23, 591] # Left side
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = box(1, 266, 23) # Top left curve
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
- :style=>:arc, :extent=>90)
-
- xy = box(75, 235, 9) # The ball
- TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'',
- :width=>3, :tag=>'I11')
- end
-
- def move11(step = nil)
- step = get_step(11, step)
-
- pos = [
- [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266],
- [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472],
- [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591]
- ]
-
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I11', where)
- return 3 if where[2] == :x
- return 1
- end
-
- # Hand
- def draw12
- xy = [
- 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590,
- 60, 590, 60, 610, 60, 610
- ]
- xy.concat([60, 610, 65, 620, 60, 631]) # Thumb
- xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669,
- 56, 669, 50, 669, 50, 662, 50, 637])
-
- y0 = 637 # Bumps for fingers
- y1 = 645
- 50.step(21, -10){|x|
- x1 = x - 5
- x2 = x - 10
- xy << x << y0 << x1 << y1 << x2 << y0
- }
- TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'],
- :smooth=>true, :tag=>'I12', :width=>3)
- end
-
- def move12(step = nil)
- step = get_step(12, step)
-
- pos = [[42.5, 641, :x]]
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I12', where)
- return 3 if where[2] == :x
- return 1
- end
-
- # Fax
- def draw13
- color = @C['13a']
- xy = [86, 663, 149, 663, 149, 704, 50, 704, 50, 681, 64, 681, 86, 671]
- xy2 = [
- 784, 663, 721, 663, 721, 704, 820, 704, 820, 681, 806, 681, 784, 671
- ]
- radii = [2, 9, 9, 8, 5, 5, 2]
-
- round_poly(@canvas, xy, radii, :width=>3,
- :outline=>@C['fg'], :fill=>color)
- round_poly(@canvas, xy2, radii, :width=>3,
- :outline=>@C['fg'], :fill=>color)
-
- xy = [56, 677]
- x, y = xy
- TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I13')
- xy = [809, 677]
- x, y = xy
- TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
- :width=>3, :tag=>'I13R')
-
- xy = [112, 687] # Label
- TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
- :font=>['Times Roman', 12, :bold])
- xy = [762, 687]
- TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
- :font=>['Times Roman', 12, :bold])
-
- xy = [138, 663, 148, 636, 178, 636] # Paper guide
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
- xy = [732, 663, 722, 636, 692, 636]
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
-
- sine([149, 688, 720, 688], 5, 15,
- :tag=>'I13_s', :fill=>@C['fg'], :width=>3)
- end
-
- def move13(step = nil)
- step = get_step(13, step)
-
- numsteps = 7
-
- if step == numsteps + 2
- move_abs('I13_star', [-100, -100])
- @canvas.itemconfigure('I13R', :fill=>@C['13b'], :width=>2)
- return 2
- end
- if step == 0 # Button down
- @canvas.delete('I13')
- sparkle([-100, -100], 'I13_star') # Create off screen
- return 1
- end
- x0, y0 = anchor('I13_s', :w)
- x1, y1 = anchor('I13_s', :e)
- x = x0 + (x1 - x0) * (step - 1) / numsteps.to_f
- move_abs('I13_star', [x, y0])
- return 1
- end
-
- # Paper in fax
- def draw14
- color = @C['14']
- xy = [102, 661, 113, 632, 130, 618] # Left paper edge
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14L_0')
- xy = [148, 629, 125, 640, 124, 662] # Right paper edge
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14L_1')
- draw14a('L')
-
- xy = [
- 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171
- ]
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14R_0')
- @canvas.lower('I14R_0')
- # NB. these numbers are VERY sensitive, you must start with final size
- # and shrink down to get the values
- xy = [
- 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5
- ]
- TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
- :width=>3, :tag=>'I14R_1')
- @canvas.lower('I14R_1')
- end
-
- def draw14a(side)
- color = @C['14']
- xy = @canvas.coords("I14#{side}_0")
- xy2 = @canvas.coords("I14#{side}_1")
- x0, y0, x1, y1, x2, y2 = xy
- x3, y3, x4, y4, x5, y5 = xy2
-
- zz = [
- x0, y0, x0, y0, xy, x2, y2, x2, y2,
- x3, y3, x3, y3, xy2, x5, y5, x5, y5
- ].flatten
- @canvas.delete("I14#{side}")
- TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true,
- :fill=>color, :outline=>color, :width=>3)
- @canvas.lower("I14#{side}")
- end
-
- def move14(step = nil)
- step = get_step(14, step)
-
- # Paper going down
- sc = 0.9 - 0.05*step
- if sc < 0.3
- @canvas.delete('I14L')
- return 0
- end
-
- ox, oy = @canvas.coords('I14L_0')
- @canvas.scale('I14L_0', ox, oy, sc, sc)
- ox, oy = @canvas.coords('I14L_1')[-2..-1]
- @canvas.scale('I14L_1', ox, oy, sc, sc)
- draw14a('L')
-
- # Paper going up
- sc = 0.35 + 0.05*step
- sc = 1/sc
-
- ox, oy = @canvas.coords('I14R_0')
- @canvas.scale('I14R_0', ox, oy, sc, sc)
- ox, oy = @canvas.coords('I14R_1')[-2..-1]
- @canvas.scale('I14R_1', ox, oy, sc, sc)
- draw14a('R')
-
- return((step == 10)? 3: 1)
- end
-
- # Light beam
- def draw15
- color = @C['15a']
- xy = [824, 599, 824, 585, 820, 585, 829, 585]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I15a')
- xy = [789, 599, 836, 643]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
- xy = [778, 610, 788, 632]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
- xy = [766, 617, 776, 625]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
-
- xy = [633, 600, 681, 640]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
- xy = [635, 567, 657, 599]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
- xy = [765, 557, 784, 583]
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
-
- sine([658, 580, 765, 580], 3, 15,
- :tag=>'I15_s', :fill=>@C['fg'], :width=>3)
- end
-
- def move15a
- color = @C['15b']
- @canvas.scale('I15a', 824, 599, 1, 0.3) # Button down
- xy = [765, 621, 681, 621]
- TkcLine.new(@canvas, xy, :dash=>'-', :width=>3, :fill=>color, :tag=>'I15')
- end
-
- def move15(step = nil)
- step = get_step(15, step)
-
- numsteps = 6
-
- if step == numsteps + 2
- move_abs('I15_star', [-100, -100])
- return 2
- end
- if step == 0 # Break the light beam
- sparkle([-100, -100], 'I15_star')
- xy = [765, 621, 745, 621]
- @canvas.coords('I15', xy)
- return 1
- end
- x0, y0 = anchor('I15_s', :w)
- x1, y1 = anchor('I15_s', :e)
- x = x0 + (x1 - x0) * (step - 1) / numsteps.to_f
- move_abs('I15_star', [x, y0])
- return 1
- end
-
- # Bell
- def draw16
- color = @C['16']
- xy = [722, 485, 791, 556]
- TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3)
- xy = box(752, 515, 25) # Bell
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black',
- :tag=>'I16b', :width=>2)
- xy = box(752, 515, 5) # Bell button
- TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b')
-
- xy = [784, 523, 764, 549] # Clapper
- TkcLine.new(@canvas, xy, :width=>3, :tag=>'I16c', :fill=>@C['fg'])
- xy = box(784, 523, 4)
- TkcOval.new(@canvas, xy, :fill=>@C['fg'], :outline=>@C['fg'], :tag=>'I16d')
- end
-
- def move16(step = nil)
- step = get_step(16, step)
-
- # Note: we never stop
- ox, oy = [760, 553]
- if (step & 1).nonzero?
- beta = 12
- @canvas.move('I16b', 3, 0)
- else
- beta = -12
- @canvas.move('I16b', -3, 0)
- end
- rotate_item('I16c', ox, oy, beta)
- rotate_item('I16d', ox, oy, beta)
-
- return ((step == 1)? 3: 1)
- end
-
- # Cat
- def draw17
- color = @C['17']
-
- xy = [584, 556, 722, 556]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
- xy = [584, 485, 722, 485]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
-
- xy = [664, 523, 717, 549] # Body
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3,
- :style=>:chord, :start=>128, :extent=>260, :tag=>'I17')
-
- xy = [709, 554, 690, 543] # Paw
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
- :width=>3, :tag=>'I17')
- xy = [657, 544, 676, 555]
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
- :width=>3, :tag=>'I17')
-
- xy = box(660, 535, 15) # Lower face
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
- :start=>150, :extent=>240, :tag=>'I17_')
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_')
- xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1,
- :tag=>['I17_', 'I17_c'])
- xy = [652, 542, 628, 539] # Whiskers
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [652, 543, 632, 545]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [652, 546, 632, 552]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
-
- xy = [668, 543, 687, 538]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :tag=>['I17_', 'I17_w'])
- xy = [668, 544, 688, 546]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :tag=>['I17_', 'I17_w'])
- xy = [668, 547, 688, 553]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :tag=>['I17_', 'I17_w'])
-
- xy = [649, 530, 654, 538, 659, 530] # Left eye
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
- :smooth=>true, :tag=>'I17')
- xy = [671, 530, 666, 538, 661, 530] # Right eye
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
- :smooth=>true, :tag=>'I17')
- xy = [655, 543, 660, 551, 665, 543] # Mouth
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
- :smooth=>true, :tag=>'I17')
- end
-
- def move17(step = nil)
- step = get_step(17, step)
-
- if step == 0
- @canvas.delete('I17') # Delete most of the cat
- xy = [655, 543, 660, 535, 665, 543] # Mouth
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :smooth=>true, :tag=>'I17_')
- xy = box(654, 530, 4) # Left eye
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
- :tag=>'I17_')
- xy = box(666, 530, 4) # Right eye
- TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
- :tag=>'I17_')
-
- @canvas.move('I17_', 0, -20) # Move face up
- xy = [652, 528, 652, 554] # Front leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [670, 528, 670, 554] # 2nd front leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
-
- xy = [ # Body
- 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525,
- 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527,
- 668, 527, 668, 527, 675, 522, 676, 517, 677, 512
- ]
- TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill),
- :outline=>@C['fg'], :width=>3, :smooth=>true,
- :tag=>'I17_')
- xy = [716, 514, 716, 554] # Back leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [694, 532, 694, 554] # 2nd back leg
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
- xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
- :smooth=>true, :tag=>'I17_')
-
- @canvas.raise('I17w') # Make whiskers visible
- @canvas.move('I17_', -5, 0) # Move away from the wall a bit
- return 2
- end
- return 0
- end
-
- # Sling shot
- def draw18
- color = @C['18']
- xy = [721, 506, 627, 506] # Sling hold
- TkcLine.new(@canvas, xy, :width=>4, :fill=>@C['fg'], :tag=>'I18')
-
- xy = [607, 500, 628, 513] # Sling rock
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :tag=>'I18a')
-
- xy = [526, 513, 606, 507, 494, 502] # Sling band
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>4, :tag=>'I18b')
- xy = [485, 490, 510, 540, 510, 575, 510, 540, 535, 491] # Sling
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>6)
- end
-
- def move18(step = nil)
- step = get_step(18, step)
-
- pos = [
- [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x],
- [136, 506], [16, 506], [-100, -100]
- ]
-
- b = []
- b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing
- b[1] = [
- 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525,
- 553, 536, 538, 534, 532, 519, 529, 499
- ]
- b[2] = [
- 491, 503, 508, 563, 542, 533, 551, 526, 561, 539, 549, 550, 530, 500
- ]
- b[3] = [
- 491, 503, 508, 563, 530, 554, 541, 562, 525, 568, 519, 544, 530, 501
- ]
-
- return 0 if step >= pos.length
-
- if step == 0
- @canvas.delete('I18')
- @canvas.itemconfigure('I18b', :smooth=>true)
- end
- if b[step]
- @canvas.coords('I18b', b[step])
- end
-
- where = pos[step]
- move_abs('I18a', where)
- return 3 if where[2] == :x
- return 1
- end
-
- # Water pipe
- def draw19
- color = @C['19']
- xx = [[249, 181], [155, 118], [86, 55], [22, 0]]
- xx.each{|x1, x2|
- TkcRectangle.new(@canvas, x1, 453, x2, 467,
- :fill=>color, :outline=>'', :tag=>'I19')
- TkcLine.new(@canvas, x1, 453, x2, 453,
- :fill=>@C['fg'], :width=>1) # Pipe top
- TkcLine.new(@canvas, x1, 467, x2, 467,
- :fill=>@C['fg'], :width=>1) # Pipe bottom
- }
- @canvas.raise('I11i')
-
- xy = box(168, 460, 16) # Bulge by the joint
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
- :start=>21, :extent=>136)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
- :start=>-21, :extent=>-130)
-
- xy = [249, 447, 255, 473] # First joint 26x6
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
-
- xy = box(257, 433, 34) # Bend up
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:pie, :start=>0, :extent=>-91)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>-90)
- xy = box(257, 433, 20)
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
- :style=>:pie, :start=>0, :extent=>-92)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>-90)
- xy = box(257, 421, 34) # Bend left
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:pie, :start=>0, :extent=>91)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>90)
- xy = box(257, 421, 20)
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
- :style=>:pie, :start=>0, :extent=>90)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>0, :extent=>90)
- xy = box(243, 421, 34) # Bend down
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
- :style=>:pie, :start=>90, :extent=>90)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>90, :extent=>90)
- xy = box(243, 421, 20)
- TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
- :style=>:pie, :start=>90, :extent=>90)
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
- :style=>:arc, :start=>90, :extent=>90)
-
- xy = [270, 427, 296, 433] # 2nd joint bottom
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [270, 421, 296, 427] # 2nd joint top
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [249, 382, 255, 408] # Third joint right
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [243, 382, 249, 408] # Third joint left
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
- xy = [203, 420, 229, 426] # Last joint
- TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
-
- xy = box(168, 460, 6) # Handle joint
- TkcOval.new(@canvas, xy, :fill=>@C['fg'], :outline=>'', :tag=>'I19a')
- xy = [168, 460, 168, 512] # Handle bar
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>5, :tag=>'I19b')
- end
-
- def move19(step = nil)
- step = get_step(19, step)
-
- angles = [30, 30, 30]
- return 2 if step == angles.length
- ox, oy = centroid('I19a')
- rotate_item('I19b', ox, oy, angles[step])
-
- return 1
- end
-
- # Water pouring
- def draw20
- # do nothing
- end
-
- def move20(step = nil)
- step = get_step(20, step)
-
- pos = [451, 462, 473, 484, 496, 504, 513, 523, 532]
- freq = [20, 40, 40, 40, 40, 40, 40, 40, 40]
- pos = [
- [451, 20], [462, 40], [473, 40], [484, 40], [496, 40],
- [504, 40], [513, 40], [523, 40], [532, 40, :x]
- ]
- return 0 if step >= pos.length
-
- @canvas.delete('I20')
- where = pos[step]
- y, f = where
- h20(y, f)
- return 3 if where[2] == :x
- return 1
- end
-
- def h20(y, f)
- color = @C['20']
- @canvas.delete('I20')
-
- sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'],
- :width=>3, :fill=>color, :smooth=>true)
- TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
- :fill=>color, :smooth=>1, :tag=>['I20', 'I20a'])
- TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
- :fill=>color, :smooth=>1, :tag=>['I20', 'I20b'])
- @canvas.move('I20a', 8, 0)
- @canvas.move('I20b', 16, 0)
- end
-
- # Bucket
- def draw21
- color = @C['21']
- xy = [217, 451, 244, 490] # Right handle
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21_a')
- xy = [201, 467, 182, 490] # Left handle
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21_a')
-
- xy = [245, 490, 237, 535] # Right side
- xy2 = [189, 535, 181, 490] # Left side
- TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'',
- :tag=>['I21', 'I21f'])
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21')
- TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21')
-
- xy = [182, 486, 244, 498] # Top
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2,
- :tag=>['I21', 'I21f'])
- TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2,
- :tag=>['I21', 'I21t'])
- xy = [189, 532, 237, 540] # Bottom
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2,
- :tag=>['I21', 'I21b'])
- end
-
- def move21(step = nil)
- step = get_step(21, step)
-
- numsteps = 30
- return 0 if step >= numsteps
-
- x1, y1, x2, y2 = @canvas.coords('I21b')
- # lx1, ly1, lx2, ly2 = @canvas.coords('I21t')
- lx1, ly1, lx2, ly2 = [183, 492, 243, 504]
-
- f = step / numsteps.to_f
- y2 = y2 - 3
- xx1 = x1 + (lx1 - x1) * f
- yy1 = y1 + (ly1 - y1) * f
- xx2 = x2 + (lx2 - x2) * f
- yy2 = y2 + (ly2 - y2) * f
-
- @canvas.itemconfigure('I21b', :fill=>@C['20'])
- @canvas.delete('I21w')
- TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1,
- :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20'])
- @canvas.lower('I21w', 'I21')
- @canvas.raise('I21b')
- @canvas.lower('I21f')
-
- return((step == numsteps - 1)? 3: 1)
- end
-
- # Bucket drop
- def draw22
- # do nothing
- end
-
- def move22(step = nil)
- step = get_step(22, step)
- pos = [[213, 513], [213, 523], [213, 543, :x], [213, 583], [213, 593]]
-
- @canvas.itemconfigure('I21f', :fill=>@C['22']) if step == 0
- return 0 if step >= pos.length
- where = pos[step]
- move_abs('I21', where)
- h20(where[1], 40)
- @canvas.delete('I21_a') # Delete handles
-
- return 3 if where[2] == :x
- return 1
- end
-
- # Blow dart
- def draw23
- color = @C['23a']
- color2 = @C['23b']
- color3 = @C['23c']
-
- xy = [185, 623, 253, 650] # Block
- TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'],
- :width=>2, :tag=>'I23a')
- xy = [187, 592, 241, 623] # Balloon
- TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
- TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b',
- :style=>:arc, :start=>12, :extent=>336)
- xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle
- TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b')
-
- xy = [285, 611, 250, 603] # Dart body
- TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'],
- :width=>3, :tag=>'I23d')
- xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail
- TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'],
- :width=>3, :tag=>'I23d')
- xy = [249, 607, 268, 607] # Dart detail
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
- xy = [285, 607, 305, 607] # Dart needle
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
- end
-
- def move23(step = nil)
- step = get_step(23, step)
-
- pos = [
- [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607],
- [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100]
- ]
-
- return 0 if step >= pos.length
- if step <= 1
- ox, oy = anchor('I23a', :n)
- @canvas.scale('I23b', ox, oy, 0.9, 0.5)
- end
- where = pos[step]
- move_abs('I23d', where)
-
- return 3 if where[2] == :x
- return 1
- end
-
- # Balloon
- def draw24
- color = @C['24a']
- xy = [366, 518, 462, 665] # Balloon
- TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
- :width=>3, :tag=>'I24')
- xy = [414, 666, 414, 729] # String
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24')
- xy = [410, 666, 404, 673, 422, 673, 418, 666] # Nozzle
- TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
- :width=>3, :tag=>'I24')
-
- xy = [387, 567, 390, 549, 404, 542] # Reflections
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- xy = [395, 568, 399, 554, 413, 547]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- xy = [403, 570, 396, 555, 381, 553]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- xy = [408, 564, 402, 547, 386, 545]
- TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
- :width=>2, :tag=>'I24')
- end
-
- def move24(step = nil)
- step = get_step(24, step)
-
- return 0 if step > 4
- return 2 if step == 4
-
- if step == 0
- @canvas.delete('I24') # Exploding balloon
- xy = [
- 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594,
- 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738,
- 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613,
- 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508,
- 431, 441, 431, 440, 400, 502, 347, 465, 347, 465
- ]
- TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'],
- :outline=>@C['24a'], :width=>10, :smooth=>true)
- msg = Tk.subst(@S['message'].value)
- TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'],
- :justify=>:center, :font=>['Times Roman', 18, :bold])
- return 1
- end
-
- @canvas.itemconfigure('I24t', :font=>['Times Roman', 18 + 6*step, :bold])
- @canvas.move('I24', 0, -60)
- ox, oy = centroid('I24')
- @canvas.scale('I24', ox, oy, 1.25, 1.25)
- return 1
- end
-
- # Displaying the message
- def move25(step = nil)
- step = get_step(25, step)
-
- if step == 0
- @XY['25'] = Tk::Clock.clicks(:miliseconds)
- return 1
- end
- elapsed = Tk::Clock.clicks(:miliseconds) - @XY['25']
- return 1 if elapsed < 5000
- return 2
- end
-
- # Collapsing balloon
- def move26(step = nil)
- step = get_step(26, step)
-
- if step >= 3
- @canvas.delete('I24', 'I26')
- TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26',
- #:text=>'click to continue',
- :text=>'¥¯¥ê¥Ã¥¯¤Ç¥ê¥»¥Ã¥È¤·¤Þ¤¹',
- :font=>['Times Roman', 20, :bold])
- @canvas.bind('1', proc{reset})
- return 4
- end
-
- ox, oy = centroid('I24')
- @canvas.scale('I24', ox, oy, 0.8, 0.8)
- @canvas.move('I24', 0, 60)
- @canvas.itemconfigure('I24t', :font=>['Times Roman', 30 - 6*step, :bold])
- return 1
- end
-
- ################################################################
- #
- # Helper functions
- #
- def box(x, y, r)
- [x - r, y - r, x + r, y + r]
- end
-
- def move_abs(item, xy)
- x, y = xy
- ox, oy = centroid(item)
- dx = x - ox
- dy = y - oy
- @canvas.move(item, dx, dy)
- end
-
- def rotate_item(item, ox, oy, beta)
- xy = @canvas.coords(item)
- xy2 = []
- 0.step(xy.length - 1, 2){|idx|
- x, y = xy[idx, 2]
- xy2.concat(rotate_c(x, y, ox, oy, beta))
- }
- @canvas.coords(item, xy2)
- end
-
- def rotate_c(x, y, ox, oy, beta)
- # rotates vector (ox,oy)->(x,y) by beta degrees clockwise
-
- x -= ox # Shift to origin
- y -= oy
-
- beta = beta * Math.atan(1) * 4 / 180.0 # Radians
- xx = x * Math.cos(beta) - y * Math.sin(beta) # Rotate
- yy = x * Math.sin(beta) + y * Math.cos(beta)
-
- xx += ox # Shift back
- yy += oy
-
- [xx, yy]
- end
-
- def reset
- draw_all
- @canvas.bind_remove('1')
- @S['mode'].value = :MSTART
- @S['active'] = [0]
- end
-
- # Each Move## keeps its state info in STEP, this retrieves and increments it
- def get_step(who, step)
- if step
- @STEP[who] = step
- else
- if !@STEP.exist?(who) || @STEP[who] == ""
- @STEP[who] = 0
- else
- @STEP[who] += 1
- end
- end
- @STEP[who]
- end
-
- def reset_step
- @S['cnt'].value = 0
- @STEP.keys.each{|k| @STEP[k] = ''}
- end
-
- def sine(xy0, amp, freq, opts = {})
- x0, y0, x1, y1 = xy0
- step = 2
- xy = []
- if y0 == y1 # Horizontal
- x0.step(x1, step){|x|
- beta = (x - x0) * 2 * Math::PI / freq
- y = y0 + amp * Math.sin(beta)
- xy << x << y
- }
- else
- y0.step(y1, step){|y|
- beta = (y - y0) * 2 * Math::PI / freq
- x = x0 + amp * Math.sin(beta)
- xy << x << y
- }
- end
- TkcLine.new(@canvas, xy, opts)
- end
-
- def round_rect(xy, radius, opts={})
- x0, y0, x3, y3 = xy
- r = @canvas.winfo_pixels(radius)
- d = 2 * r
-
- # Make sure that the radius of the curve is less than 3/8 size of the box!
- maxr = 0.75
- if d > maxr * (x3 - x0)
- d = maxr * (x3 - x0)
- end
- if d > maxr * (y3 - y0)
- d = maxr * (y3 - y0)
- end
-
- x1 = x0 + d
- x2 = x3 - d
- y1 = y0 + d
- y2 = y3 - d
-
- xy = [x0, y0, x1, y0, x2, y0, x3, y0, x3, y1, x3, y2]
- xy.concat([x3, y3, x2, y3, x1, y3, x0, y3, x0, y2, x0, y1])
- return xy
- end
-
- def round_poly(canv, xy, radii, opts)
- lenXY = xy.length
- lenR = radii.length
- if lenXY != 2*lenR
- raise "wrong number of vertices and radii"
- end
-
- knots = []
- x0 = xy[-2]; y0 = xy[-1]
- x1 = xy[0]; y1 = xy[1]
- xy << xy[0] << xy[1]
-
- 0.step(lenXY - 1, 2){|i|
- radius = radii[i/2]
- r = canv.winfo_pixels(radius)
-
- x2 = xy[i+2]; y2 = xy[i+3]
- z = _round_poly2(x0, y0, x1, y1, x2, y2, r)
- knots.concat(z)
-
- x0 = x1; y0 = y1
- x1 = x2; y1 = y2
- }
- TkcPolygon.new(canv, knots, {:smooth=>true}.update(opts))
- end
-
- def _round_poly2(x0, y0, x1, y1, x2, y2, radius)
- d = 2 * radius
- maxr = 0.75
-
- v1x = x0 - x1
- v1y = y0 - y1
- v2x = x2 - x1
- v2y = y2 - y1
-
- vlen1 = Math.sqrt(v1x*v1x + v1y*v1y)
- vlen2 = Math.sqrt(v2x*v2x + v2y*v2y)
-
- if d > maxr * vlen1
- d = maxr * vlen1
- end
- if d > maxr * vlen2
- d = maxr * vlen2
- end
-
- xy = []
- xy << (x1 + d * v1x / vlen1) << (y1 + d * v1y / vlen1)
- xy << x1 << y1
- xy << (x1 + d * v2x / vlen2) << (y1 + d * v2y / vlen2)
-
- return xy
- end
-
- def sparkle(oxy, tag)
- xy = [
- [299, 283], [298, 302], [295, 314], [271, 331],
- [239, 310], [242, 292], [256, 274], [281, 273]
- ]
- xy.each{|x, y|
- TkcLine.new(@canvas, 271, 304, x, y,
- :fill=>'white', :width=>3, :tag=>tag)
- }
- move_abs(tag, oxy)
- end
-
- def centroid(item)
- anchor(item, :c)
- end
-
- def anchor(item, where)
- x1, y1, x2, y2 = @canvas.bbox(item)
- case(where)
- when :n
- y = y1
- when :s
- y = y2
- else
- y = (y1 + y2) / 2.0
- end
- case(where)
- when :w
- x = x1
- when :e
- x = x2
- else
- x = (x1 + x2) / 2.0
- end
- return [x, y]
- end
-end
-
-TkGoldberg_Demo.new($goldberg_demo)
diff --git a/ext/tk/sample/demos-jp/image3.rb b/ext/tk/sample/demos-jp/image3.rb
index d9f378c116..549152514b 100644
--- a/ext/tk/sample/demos-jp/image3.rb
+++ b/ext/tk/sample/demos-jp/image3.rb
@@ -35,8 +35,7 @@ end
# Arguments:
# w - Name of the toplevel window of the demo.
def selectAndLoadDir3(w, lbox)
- dir = Tk.chooseDirectory(:initialdir=>$dirName.value,
- :parent=>w, :mustexist=>true)
+ dir = Tk.chooseDirectory(:initialdir=>$dirName, :parent=>w, :mustexist=>true)
if dir.length > 0
$dirName.value = dir
loadDir3(lbox)
diff --git a/ext/tk/sample/demos-jp/menu.rb b/ext/tk/sample/demos-jp/menu.rb
index add85f7f7b..50152cead3 100644
--- a/ext/tk/sample/demos-jp/menu.rb
+++ b/ext/tk/sample/demos-jp/menu.rb
@@ -19,16 +19,9 @@ $menu_demo = TkToplevel.new {|w|
$menu_frame = TkFrame.new($menu_demo, 'relief'=>'raised', 'bd'=>2)
$menu_frame.pack('side'=>'top', 'fill'=>'x')
-begin
- windowingsystem = Tk.windowingsystem()
-rescue
- windowingsystem = ""
-end
-
# label À¸À®
TkLabel.new($menu_demo,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
- if $tk_platform['platform'] == 'macintosh' ||
- windowingsystem == "classic" || windowingsystem == "aqua"
+ if $tk_platform['platform'] == 'macintosh'
text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Command-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥³¥Þ¥ó¥É¥­¡¼µ­¹æ¤Ë³¤¤¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»È¤Ã¤¿¹àÌܵ¯Æ°¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
else
text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Alt-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥á¥Ë¥å¡¼¤Ë¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥­¡¼¥Ü¡¼¥É¤«¤é¤Î»ØÄ꤬¤Ç¤­¤Þ¤¹¡£Ìð°õ¥­¡¼¤Ç¥á¥Ë¥å¡¼¤Î¥È¥é¥Ð¡¼¥¹¤â²Äǽ¤Ç¤¹¡£¥á¥Ë¥å¡¼¤¬»ØÄꤵ¤ì¤¿ºÝ¤Ë¤Ï¡¢¥¹¥Ú¡¼¥¹¥­¡¼¤Ç¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¢¤ë¤¤¤Ï¡¢¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Îʸ»ú¤òÆþÎϤ¹¤ë¤³¤È¤Ç¤â¼Â¹Ô¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼¤Î¥¨¥ó¥È¥ê¤¬¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤½¤Î¥¢¥¯¥»¥é¥ì¡¼¥¿¤òÆþÎϤ¹¤ë¤³¤È¤Ç¥á¥Ë¥å¡¼¤ò»ØÄꤹ¤ë¤³¤È¤Ê¤·¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
@@ -70,8 +63,7 @@ TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m|
}
}
-if $tk_platform['platform'] == 'macintosh' ||
- windowingsystem == "classic" || windowingsystem == "aqua"
+if $tk_platform['platform'] == 'macintosh'
modifier = 'Command'
elsif $tk_platform['platform'] == 'windows'
modifier = 'Control'
diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb
index 050f0decb4..ab691a42b5 100644
--- a/ext/tk/sample/demos-jp/menu8x.rb
+++ b/ext/tk/sample/demos-jp/menu8x.rb
@@ -43,16 +43,9 @@ TkFrame.new($menu8x_demo) {|frame|
else ; # Tk8.x
-begin
- windowingsystem = Tk.windowingsystem()
-rescue
- windowingsystem = ""
-end
-
# label À¸À®
TkLabel.new($menu8x_demo,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
- if $tk_platform['platform'] == 'macintosh' ||
- windowingsystem == "classic" || windowingsystem == "aqua"
+ if $tk_platform['platform'] == 'macintosh'
text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Command-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥³¥Þ¥ó¥É¥­¡¼µ­¹æ¤Ë³¤¤¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»È¤Ã¤¿¹àÌܵ¯Æ°¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
else
text("¤³¤Î¥¦¥£¥ó¥É¥¦¤ÏÍÍ¡¹¤Ê¥á¥Ë¥å¡¼¤È¥«¥¹¥±¡¼¥É¥á¥Ë¥å¡¼¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Alt-X ¤òÆþÎϤ¹¤ë¤È¡¢X¤¬¥á¥Ë¥å¡¼¤Ë¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ëʸ»ú¤Ê¤é¤Ð¡¢¥­¡¼¥Ü¡¼¥É¤«¤é¤Î»ØÄ꤬¤Ç¤­¤Þ¤¹¡£Ìð°õ¥­¡¼¤Ç¥á¥Ë¥å¡¼¤Î¥È¥é¥Ð¡¼¥¹¤â²Äǽ¤Ç¤¹¡£¥á¥Ë¥å¡¼¤¬»ØÄꤵ¤ì¤¿ºÝ¤Ë¤Ï¡¢¥¹¥Ú¡¼¥¹¥­¡¼¤Ç¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¢¤ë¤¤¤Ï¡¢¥¢¥ó¥À¡¼¥é¥¤¥óÉÕ¤­¤Îʸ»ú¤òÆþÎϤ¹¤ë¤³¤È¤Ç¤â¼Â¹Ô¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼¤Î¥¨¥ó¥È¥ê¤¬¥¢¥¯¥»¥é¥ì¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤½¤Î¥¢¥¯¥»¥é¥ì¡¼¥¿¤òÆþÎϤ¹¤ë¤³¤È¤Ç¥á¥Ë¥å¡¼¤ò»ØÄꤹ¤ë¤³¤È¤Ê¤·¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥á¥Ë¥å¡¼Í×ÁÇÃæ¡¢ºÇ¸å¤Î¤â¤Î¤Ï¡¢¤½¤Î¥á¥Ë¥å¡¼¤ÎºÇ½é¤Î¹àÌܤòÁªÂò¤¹¤ë¤³¤È¤ÇÆÈΩ¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£")
@@ -100,8 +93,7 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
add('command', 'label'=>'½ªÎ»', 'command'=>proc{$menu8x_demo.destroy})
}
- if $tk_platform['platform'] == 'macintosh' ||
- windowingsystem == "classic" || windowingsystem == "aqua"
+ if $tk_platform['platform'] == 'macintosh'
modifier = 'Command'
elsif $tk_platform['platform'] == 'windows'
modifier = 'Control'
diff --git a/ext/tk/sample/demos-jp/pendulum.rb b/ext/tk/sample/demos-jp/pendulum.rb
deleted file mode 100644
index d703c74d5a..0000000000
--- a/ext/tk/sample/demos-jp/pendulum.rb
+++ /dev/null
@@ -1,224 +0,0 @@
-#
-# This demonstration illustrates how Tcl/Tk can be used to construct
-# simulations of physical systems.
-# (called by 'widget')
-#
-# based on Tcl/Tk8.5a2 widget demos
-
-# destroy toplevel widget for this demo script
-if defined?($pendulum_demo) && $pendulum_demo
- $pendulum_demo.destroy
- $pendulum_demo = nil
-end
-
-# create toplevel widget
-$pendulum_demo = TkToplevel.new {|w|
- title("Pendulum Animation Demonstration")
- iconname("pendulum")
- positionWindow(w)
-}
-
-# create label
-msg = TkLabel.new($pendulum_demo) {
- font $font
- wraplength '4i'
- justify 'left'
- text '¤³¤Î¥Ç¥â¤Ï¡¢ÊªÍý·Ï¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Ë´Ø¤ï¤ë¤è¤¦¤Ê¥¢¥Ë¥á¡¼¥·¥ç¥ó¼Â¹Ô¤¹¤ë¤¿¤á¤Ë Ruby/Tk ¤ò¤É¤Î¤è¤¦¤ËÍѤ¤¤ë¤³¤È¤¬¤Ç¤­¤ë¤«¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Î¥­¥ã¥ó¥Ð¥¹¤Ïñ½ã¤Ê¿¶¤ê»Ò¤Ç¤¢¤ëʪÍý·Ï¼«ÂΤΥ°¥é¥Õ¥£¥«¥ëɽ¸½¤Ç¤¢¤ë¤Î¤ËÂФ·¡¢±¦Â¦¤Î¥­¥ã¥ó¥Ð¥¹¤Ï·Ï¤Î°ÌÁê¶õ´Ö¤Î¥°¥é¥Õ¡Ê³Ñ®Å٤ȳÑÅ٤Ȥò¥×¥í¥Ã¥È¤·¤¿¤â¤Î¡Ë¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£º¸Â¦¤Î¥­¥ã¥ó¥Ð¥¹¾å¤Ç¥¯¥ê¥Ã¥¯¤ª¤è¤Ó¥É¥é¥Ã¥°¤ò¹Ô¤Ã¤Æ¿¶¤ê»Ò¤Î½Å¤ê¤Î°ÌÃÖ¤òÊѤ¨¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£'
-}
-msg.pack('side'=>'top')
-
-# create frame
-TkFrame.new($pendulum_demo) {|frame|
- TkButton.new(frame) {
- #text 'λ²ò'
- text 'ÊĤ¸¤ë'
- command proc{
- tmppath = $pendulum_demo
- $pendulum_demo = nil
- tmppath.destroy
- }
- }.pack('side'=>'left', 'expand'=>'yes')
-
- TkButton.new(frame) {
- text '¥³¡¼¥É»²¾È'
- command proc{showCode 'pendulum'}
- }.pack('side'=>'left', 'expand'=>'yes')
-
-}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-
-# animated wave
-class PendulumAnimationDemo
- def initialize(frame)
- # Create some structural widgets
- pane = TkPanedWindow.new(frame).pack(:fill=>:both, :expand=>true)
- pane.add(@lf1 = TkLabelFrame.new(pane, :text=>'Pendulum Simulation'))
- pane.add(@lf2 = TkLabelFrame.new(pane, :text=>'Phase Space'))
-
- # Create the canvas containing the graphical representation of the
- # simulated system.
- @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white',
- :borderwidth=>2, :relief=>:sunken)
- TkcText.new(@c, 5, 5, :anchor=>:nw,
- :text=>'Click to Adjust Bob Start Position')
- # Coordinates of these items don't matter; they will be set properly below
- @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50')
- @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black')
- @bob = TkcOval.new(@c, 1, 1, 2, 2,
- :width=>3, :fill=>'yellow', :outline=>'black')
- TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'')
-
- # pack
- @c.pack(:fill=>:both, :expand=>true)
-
- # Create the canvas containing the phase space graph; this consists of
- # a line that gets gradually paler as it ages, which is an extremely
- # effective visual trick.
- @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white',
- :borderwidth=>2, :relief=>:sunken)
- @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last)
- @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last)
-
- @graph = {}
- 90.step(0, -10){|i|
- # Coordinates of these items don't matter;
- # they will be set properly below
- @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}")
- }
-
- # labels
- @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne,
- :text=>'q', :font=>'Symbol 8')
- @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne,
- :text=>'dq', :font=>'Symbol 8')
-
- # pack
- @k.pack(:fill=>:both, :expand=>true)
-
- # Initialize some variables
- @points = []
- @theta = 45.0
- @dTheta = 0.0
- @length = 150
-
- # init display
- showPendulum
-
- # animation loop
- @timer = TkTimer.new(15){ repeat }
-
- # binding
- @c.bindtags_unshift(btag = TkBindTag.new)
- btag.bind('Destroy'){ @timer.stop }
- btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x, y)}, '%x %y')
- btag.bind('B1-Motion', proc{|x, y| showPendulum(x, y)}, '%x %y')
- btag.bind('ButtonRelease-1',
- proc{|x, y| showPendulum(x, y); @timer.start }, '%x %y')
-
- btag.bind('Configure', proc{|w| @plate.coords(0, 25, w, 25)}, '%w')
-
- @k.bind('Configure', proc{|h, w|
- @psh = h/2;
- @psw = w/2
- @x_axis.coords(2, @psh, w-2, @psh)
- @y_axis.coords(@psw, h-2, @psw, 2)
- @label_theta.coords(@psw-4, 6)
- @label_dtheta.coords(w-6, @psh+4)
- }, '%h %w')
-
- # animation start
- @timer.start(500)
- end
-
- # This procedure makes the pendulum appear at the correct place on the
- # canvas. If the additional arguments x, y are passed instead of computing
- # the position of the pendulum from the length of the pendulum rod and its
- # angle, the length and angle are computed in reverse from the given
- # location (which is taken to be the centre of the pendulum bob.)
- def showPendulum(x=nil, y=nil)
- if x && y && (x != 160 || y != 25)
- @dTheta = 0.0
- x2 = x - 160
- y2 = y - 25
- @length = Math.hypot(x2, y2)
- @theta = Math.atan2(x2,y2)*180/Math::PI
- else
- angle = @theta*Math::PI/180
- x = 160 + @length*Math.sin(angle)
- y = 25 + @length*Math.cos(angle)
- end
-
- @rod.coords(160, 25, x, y)
- @bob.coords(x-15, y-15, x+15, y+15)
- end
-
- # Update the phase-space graph according to the current angle and the
- # rate at which the angle is changing (the first derivative with
- # respect to time.)
- def showPhase
- @points << @theta + @psw << -20*@dTheta + @psh
- if @points.length > 100
- @points = @points[-100..-1]
- end
- (0...100).step(10){|i|
- first = - i
- last = 11 - i
- last = -1 if last >= 0
- next if first > last
- lst = @points[first..last]
- @graph[i].coords(lst) if lst && lst.length >= 4
- }
- end
-
- # This procedure is the "business" part of the simulation that does
- # simple numerical integration of the formula for a simple rotational
- # pendulum.
- def recomputeAngle
- scaling = 3000.0/@length/@length
-
- # To estimate the integration accurately, we really need to
- # compute the end-point of our time-step. But to do *that*, we
- # need to estimate the integration accurately! So we try this
- # technique, which is inaccurate, but better than doing it in a
- # single step. What we really want is bound up in the
- # differential equation:
- # .. - sin theta
- # theta + theta = -----------
- # length
- # But my math skills are not good enough to solve this!
-
- # first estimate
- firstDDTheta = -Math.sin(@theta * Math::PI/180) * scaling
- midDTheta = @dTheta + firstDDTheta
- midTheta = @theta + (@dTheta + midDTheta)/2
- # second estimate
- midDDTheta = -Math.sin(midTheta * Math::PI/180) * scaling
- midDTheta = @dTheta + (firstDDTheta + midDDTheta)/2
- midTheta = @theta + (@dTheta + midDTheta)/2
- # Now we do a double-estimate approach for getting the final value
- # first estimate
- midDDTheta = -Math.sin(midTheta * Math::PI/180) * scaling
- lastDTheta = midDTheta + midDDTheta
- lastTheta = midTheta + (midDTheta+ lastDTheta)/2
- # second estimate
- lastDDTheta = -Math.sin(lastTheta * Math::PI/180) * scaling
- lastDTheta = midDTheta + (midDDTheta + lastDDTheta)/2
- lastTheta = midTheta + (midDTheta + lastDTheta)/2
- # Now put the values back in our globals
- @dTheta = lastDTheta
- @theta = lastTheta
- end
-
- # This method ties together the simulation engine and the graphical
- # display code that visualizes it.
- def repeat
- # Simulate
- recomputeAngle
-
- # Update the display
- showPendulum
- showPhase
- end
-end
-
-# Start the animation processing
-PendulumAnimationDemo.new($pendulum_demo)
diff --git a/ext/tk/sample/demos-jp/tcolor b/ext/tk/sample/demos-jp/tcolor
index c7f7ec7289..fc697df63e 100644
--- a/ext/tk/sample/demos-jp/tcolor
+++ b/ext/tk/sample/demos-jp/tcolor
@@ -124,14 +124,9 @@ def hsbToRgb(hue,sat,value)
end
-def _null_binding
- Module.new.instance_eval{binding}
-end
-private :_null_binding
-
def doUpdate
newCmd = $command.to_s.gsub("%%","\"#{$color}\"")
- eval(newCmd, _null_binding)
+ eval(newCmd)
end
@@ -216,21 +211,21 @@ def tc_loadNamedColor(name)
else
case name.length
when 4
- fmt = /#(.{1})(.{1})(.{1})/
+ format = /#(.{1})(.{1})(.{1})/
shift = 12
when 7
- fmt = /#(.{2})(.{2})(.{2})/
+ format = /#(.{2})(.{2})(.{2})/
shift = 8
when 10
- fmt = /#(.{3})(.{3})(.{3})/
+ format = /#(.{3})(.{3})(.{3})/
shift = 4
when 13
- fmt = /#(.{4})(.{4})(.{4})/
+ format = /#(.{4})(.{4})(.{4})/
shift = 0
else
raise(eException,"syntax error in color name \"#{name}\"")
end
- name.scan(fmt){|strlist|
+ name.scan(format){|strlist|
if strlist.length != 3
raise(eException,"syntax error in color name \"#{name}\"")
end
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget
index 11495dda54..6eaaece4c4 100644
--- a/ext/tk/sample/demos-jp/widget
+++ b/ext/tk/sample/demos-jp/widget
@@ -11,7 +11,7 @@ require 'tk'
$demo_dir = File.dirname($0)
# root ¤ÎÀ¸À®
-$root = TkRoot.new{title "Ruby/Tk Widget Demonstration"}
+$root = TkRoot.new{title "Widget Demonstration"}
# tk ¥Ð¡¼¥¸¥ç¥ó¤Î¼èÆÀ
$tk_version = Tk::TK_VERSION
@@ -438,18 +438,6 @@ txt.insert('end', "3. ¿§ÁªÂò¥À¥¤¥¢¥í¥°\n", tag_demo, "demo-clrpick")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
-#txt.insert('end', "¥¢¥Ë¥á¡¼¥·¥ç¥ó\n", tag_middle)
-txt.insert('end', "¥¢¥Ë¥á¡¼¥·¥ç¥ó\n", tag_kanji_title)
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "1. ¥¢¥Ë¥á¡¼¥·¥ç¥ó¥é¥Ù¥ë (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-anilabel")
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "2. ÇÈ·Á¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-aniwave")
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "3. ¿¶¤ê»Ò¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-pendulum")
-txt.insert('end', " \n ", tag_demospace)
-txt.insert('end', "4. A celebration of Rube Goldberg (µ¡Ç½¤ËÂбþ¤·¤¿¥Ð¡¼¥¸¥ç¥ó¤ÎTk¤¬É¬Í×)\n", tag_demo, "demo-goldberg")
-
-txt.insert('end', "\n")
#txt.insert('end', "¤½¤Î¾\n", tag_middle)
txt.insert('end', "¤½¤Î¾\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
@@ -551,125 +539,22 @@ else # ver >= 8.4
alias showVars showVars2
end
-# µ¿»÷¥È¥Ã¥×¥ì¥Ù¥ë¥µ¥Ý¡¼¥È
-module PseudoToplevel_Evaluable
- def pseudo_toplevel_eval(body = Proc.new)
- Thread.current[:TOPLEVEL] = self
- begin
- body.call
- ensure
- Thread.current[:TOPLEVEL] = nil
- end
- end
-
- def pseudo_toplevel_evaluable?
- @pseudo_toplevel_evaluable
- end
- def pseudo_toplevel_evaluable=(mode)
- @pseudo_toplevel_evaluable = (mode)? true: false
- end
-
- def self.extended(mod)
- mod.__send__(:extend_object, mod)
- mod.instance_variable_set('@pseudo_toplevel_evaluable', true)
- end
-end
-
-class Object
- alias __method_missing__ method_missing
- private :__method_missing__
-
- def method_missing(id, *args)
- begin
- has_top = (top = Thread.current[:TOPLEVEL]) &&
- top.respond_to?(:pseudo_toplevel_evaluable?) &&
- top.pseudo_toplevel_evaluable? &&
- top.respond_to?(id)
- rescue Exception => e
- has_top = false
- end
-
- if has_top
- top.__send__(id, *args)
- else
- __method_missing__(id, *args)
- end
- end
-end
-
-class Proc
- def initialize(*args, &b)
- super
- @__pseudo_toplevel__ = Thread.current[:TOPLEVEL]
- end
-
- alias __call__ call
- def call(*args, &b)
- if top = @__pseudo_toplevel__
- orig_top = Thread.current[:TOPLEVEL]
- Thread.current[:TOPLEVEL] = top
- begin
- __call__(*args, &b)
- ensure
- Thread.current[:TOPLEVEL] = orig_top
- end
- else
- __call__(*args, &b)
- end
- end
-end
-
-def proc(&b)
- Proc.new(&b)
-end
-def lambda(&b)
- Proc.new(&b)
-end
-
-def _null_binding
- Module.new.instance_eval{extend PseudoToplevel_Evaluable}
- # binding
- # Module.new.instance_eval{binding}
-end
-private :_null_binding
-
-def eval_samplecode(code)
- Thread.new{ _null_binding.pseudo_toplevel_eval{ eval(code) } }.run
- Tk.update
-end
-
# ¥Æ¥­¥¹¥È¾å¤Ç¤Î click ¤ËÂФ¹¤ëưºî
-def invoke(txt, idx)
- tag = txt.tag_names(idx).find{|t| t.kind_of?(String) && t =~ /^demo-/}
+def invoke (txt, index)
+ tag = txt.tag_names(index).find{|t| t.kind_of?(String) && t =~ /^demo-/}
return unless tag
-
cursor = txt.cget('cursor')
txt.cursor('watch')
Tk.update
- # eval(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join, _null_binding)
- # Tk.update
- eval_samplecode(IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join)
- txt.cursor(cursor)
-
- $tag_visited.add("#{idx} linestart +1 chars", "#{idx} lineend +1 chars")
-end
-=begin
-def invoke (txt, idx)
- tag = txt.tag_names(idx).find{|t| t.kind_of?(String) && t =~ /^demo-/}
- return unless tag
- current_cursor = txt.cget('cursor')
- txt.cursor('watch')
- Tk.update
# eval `cat #{tag[5..-1]}.rb`
# eval `cat #{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb`
eval IO.readlines("#{[$demo_dir, tag[5..-1]].join(File::Separator)}.rb").join
Tk.update
# txt.cursor('xterm')
- txt.cursor(current_cursor)
+ txt.cursor(cursor)
- $tag_visited.add("#{idx} linestart +1 chars", "#{idx} lineend +1 chars")
+ $tag_visited.add("#{index} linestart +1 chars", "#{index} lineend +1 chars")
end
-=end
# ¾õÂÖɽ¼¨
def showStatus (txt, index)
@@ -704,8 +589,7 @@ def showCode1(demo)
}.pack('side'=>'left', 'expand'=>'yes', 'pady'=>2)
TkButton.new(f) {
text "ºÆ¼Â¹Ô"
- # command proc{eval($code_text.get('1.0','end'), _null_binding)}
- command proc{eval_samplecode($code_text.get('1.0','end'))}
+ command proc{eval($code_text.get('1.0','end'))}
}.pack('side'=>'left', 'expand'=>'yes', 'pady'=>2)
# f.pack('side'=>'bottom', 'expand'=>'yes', 'fill'=>'x')
f.pack('side'=>'bottom', 'fill'=>'x')
@@ -798,10 +682,7 @@ def showCode2(demo)
:command=>proc{printCode($code_text, file)},
:image=>$image['print'], :compound=>:left)
b_run = TkButton.new(bf, :text=>'ºÆ¼Â¹Ô',
- :command=>proc{
- # eval($code_text.get('1.0','end'), _null_binding)
- eval_samplecode($code_text.get('1.0','end'))
- },
+ :command=>proc{eval($code_text.get('1.0','end'))},
:image=>$image['refresh'], :compound=>:left)
TkGrid('x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4])
@@ -926,15 +807,14 @@ end
#
def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
- 'message'=>"Ruby/Tk ¥¦¥£¥¸¥§¥Ã¥È¥Ç¥â Ver.1.6.0-jp\n\n" +
+ 'message'=>"Ruby/Tk ¥¦¥£¥¸¥§¥Ã¥È¥Ç¥â Ver.1.4.4-jp\n\n" +
"based on demos of Tk8.1 -- 8.5 " +
"( Copyright:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " +
"(c) 1997-2000 Ajuba Solutions, Inc. / " +
"(c) 2001-2003 Donal K. Fellows )\n\n" +
"Your Ruby & Tk Version ::\n" +
- "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}\n\n" +
- "Ruby/Tk release date :: tcltklib #{TclTkLib::RELEASE_DATE}; tk #{Tk::RELEASE_DATE}")
+ "Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}")
end
####################################
@@ -943,17 +823,12 @@ no_launcher = false
if ARGV[0] == '-n'
ARGV.shift
no_launcher = true if ARGV.size > 0
-else
- # show the root widget to make it lower then demo windows
- Tk.update
end
ARGV.each{|cmd|
if cmd =~ /(.*).rb/
cmd = $1
end
- #eval(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join,
- # _null_binding)
- eval_samplecode(IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join)
+ eval IO.readlines("#{[$demo_dir, cmd].join(File::Separator)}.rb").join
}
if no_launcher
$root.withdraw # hide root window
diff --git a/ext/tk/sample/irbtk.rb b/ext/tk/sample/irbtk.rb
deleted file mode 100644
index 53ef10d0d1..0000000000
--- a/ext/tk/sample/irbtk.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/local/bin/ruby
-#
-# irbtk.rb - irb with Ruby/Tk
-#
-# If you want to use 'multi-tk.rb', give option '--multi-tk'.
-# And if you want to use 'remote-tk.rb', give option '--remote-tk'.
-# If you want both, you don't need to give both options, because
-# 'remote-tk.rb' includes 'multi-tk.rb'.
-# ( There is no trouble even if you give both options. )
-#
-require 'remote-tk' if ARGV.delete('--remote-tk')
-require 'multi-tk' if ARGV.delete('--multi-tk')
-
-require "tk"
-module Tk
- MAINLOOP = Thread.new{ mainloop }
-end
-
-require "irb"
-
-if __FILE__ == $0
- IRB.start(__FILE__)
-else
- # check -e option
- if /^-e$/ =~ $0
- IRB.start(__FILE__)
- else
- IRB.setup(__FILE__)
- end
-end
diff --git a/ext/tk/sample/scrollframe.rb b/ext/tk/sample/scrollframe.rb
deleted file mode 100644
index b0ac6d3874..0000000000
--- a/ext/tk/sample/scrollframe.rb
+++ /dev/null
@@ -1,237 +0,0 @@
-#
-# Tk::ScrollFrame class
-#
-# This widget class is a frame widget with scrollbars.
-# The ScrollFrame doesn't propagate the size of embedded widgets.
-# When it is configured, scrollregion of the container is changed.
-#
-# Scrollbars can be toggled by Tk::ScrollFrame#vscroll & hscroll.
-# If horizontal or virtical scrollbar is turned off, the horizontal
-# or virtical size of embedded widgets is propagated.
-#
-# Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
-#
-require 'tk'
-
-class Tk::ScrollFrame < TkFrame
- include TkComposite
-
- DEFAULT_WIDTH = 200
- DEFAULT_HEIGHT = 200
-
- def initialize_composite(keys={})
- @frame.configure(:width=>DEFAULT_WIDTH, :height=>DEFAULT_HEIGHT)
-
- # create scrollbars
- @h_scroll = TkScrollbar.new(@frame, 'orient'=>'horizontal')
- @v_scroll = TkScrollbar.new(@frame, 'orient'=>'vertical')
-
- # create a canvas widget
- @canvas = TkCanvas.new(@frame,
- :borderwidth=>0, :selectborderwidth=>0,
- :highlightthickness=>0)
-
- # allignment
- TkGrid.rowconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0)
- TkGrid.columnconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0)
- @canvas.grid('row'=>0, 'column'=>0, 'sticky'=>'news')
- @frame.grid_propagate(false)
-
- # assign scrollbars
- @canvas.xscrollbar(@h_scroll)
- @canvas.yscrollbar(@v_scroll)
-
- # convert hash keys
- keys = _symbolkey2str(keys)
-
- # check options for the frame
- framekeys = {}
- if keys.key?('classname')
- keys['class'] = keys.delete('classname')
- end
- if @classname = keys.delete('class')
- framekeys['class'] = @classname
- end
- if @colormap = keys.delete('colormap')
- framekeys['colormap'] = @colormap
- end
- if @container = keys.delete('container')
- framekeys['container'] = @container
- end
- if @visual = keys.delete('visual')
- framekeys['visual'] = @visual
- end
- if @classname.kind_of? TkBindTag
- @db_class = @classname
- @classname = @classname.id
- elsif @classname
- @db_class = TkDatabaseClass.new(@classname)
- else
- @db_class = self.class
- @classname = @db_class::WidgetClassName
- end
-
- # create base frame
- @base = TkFrame.new(@canvas, framekeys)
-
- # embed base frame
- @cwin = TkcWindow.new(@canvas, [0, 0], :window=>@base, :anchor=>'nw')
- @canvas.scrollregion(@cwin.bbox)
-
- # binding to reset scrollregion
- @base.bind('Configure'){ _reset_scrollregion(nil, nil) }
-
- # set default receiver of method calls
- @path = @base.path
-
- # scrollbars ON
- vscroll(keys.delete('vscroll'){true})
- hscroll(keys.delete('hscroll'){true})
-
- # please check the differences of the following definitions
- option_methods(
- :scrollbarwidth
- )
-
- # set receiver widgets for configure methods (with alias)
- delegate_alias('scrollbarrelief', 'relief', @h_scroll, @v_scroll)
-
- # set receiver widgets for configure methods
- delegate('DEFAULT', @base)
- delegate('background', @frame, @base, @canvas, @h_scroll, @v_scroll)
- delegate('width', @frame)
- delegate('height', @frame)
- delegate('activebackground', @h_scroll, @v_scroll)
- delegate('troughcolor', @h_scroll, @v_scroll)
- delegate('repeatdelay', @h_scroll, @v_scroll)
- delegate('repeatinterval', @h_scroll, @v_scroll)
- delegate('borderwidth', @frame)
- delegate('relief', @frame)
-
- # do configure
- configure keys unless keys.empty?
- end
-
- # callback for Configure event
- def _reset_scrollregion(h_mod=nil, v_mod=nil)
- cx1, cy1, cx2, cy2 = @canvas.scrollregion
- x1, y1, x2, y2 = @cwin.bbox
- @canvas.scrollregion([x1, y1, x2, y2])
-
- if h_mod.nil? && v_mod.nil?
- if x2 != cx2 && TkGrid.info(@h_scroll).size == 0
- @frame.grid_propagate(true)
- @canvas.width = x2
- Tk.update_idletasks
- @frame.grid_propagate(false)
- end
- if y2 != cy2 && TkGrid.info(@v_scroll).size == 0
- @frame.grid_propagate(true)
- @canvas.height = y2
- Tk.update_idletasks
- @frame.grid_propagate(false)
- end
- else
- @h_scroll.ungrid if h_mod == false
- @v_scroll.ungrid if v_mod == false
-
- h_flag = (TkGrid.info(@h_scroll).size == 0)
- v_flag = (TkGrid.info(@v_scroll).size == 0)
-
- @frame.grid_propagate(true)
-
- @canvas.width = (h_flag)? x2: @canvas.winfo_width
- @canvas.height = (v_flag)? y2: @canvas.winfo_height
-
- @h_scroll.grid('row'=>1, 'column'=>0, 'sticky'=>'ew') if h_mod
- @v_scroll.grid('row'=>0, 'column'=>1, 'sticky'=>'ns') if v_mod
-
- Tk.update_idletasks
-
- @frame.grid_propagate(false)
- end
- end
- private :_reset_scrollregion
-
- # forbid to change binding of @base frame
- def bind(*args)
- @frame.bind(*args)
- end
- def bind_append(*args)
- @frame.bind_append(*args)
- end
- def bind_remove(*args)
- @frame.bind_remove(*args)
- end
- def bindinfo(*args)
- @frame.bindinfo(*args)
- end
-
- # set width of scrollbar
- def scrollbarwidth(width = nil)
- if width
- @h_scroll.width(width)
- @v_scroll.width(width)
- else
- @h_scroll.width
- end
- end
-
- # vertical scrollbar : ON/OFF
- def vscroll(mode)
- Tk.update_idletasks
- st = TkGrid.info(@v_scroll)
- if mode && st.size == 0 then
- @v_scroll.grid('row'=>0, 'column'=>1, 'sticky'=>'ns')
- _reset_scrollregion(nil, true)
- elsif !mode && st.size != 0 then
- _reset_scrollregion(nil, false)
- else
- _reset_scrollregion(nil, nil)
- end
- self
- end
-
- # horizontal scrollbar : ON/OFF
- def hscroll(mode)
- Tk.update_idletasks
- st = TkGrid.info(@h_scroll)
- if mode && st.size == 0 then
- _reset_scrollregion(true, nil)
- elsif !mode && st.size != 0 then
- _reset_scrollregion(false, nil)
- else
- _reset_scrollregion(nil, nil)
- end
- self
- end
-end
-
-# test
-if __FILE__ == $0
- f = Tk::ScrollFrame.new(:scrollbarwidth=>10, :width=>300, :height=>200)
- f.pack(:expand=>true, :fill=>:both)
-
- TkButton.new(f, :text=>'foo button', :command=>proc{puts 'foo'}).pack
- TkButton.new(f, :text=>'baaar button', :command=>proc{puts 'baaar'}).pack
- TkButton.new(f, :text=>'baz button', :command=>proc{puts 'baz'}).pack
- TkButton.new(f, :text=>'hoge hoge button',
- :command=>proc{puts 'hoge hoge'}).pack(:side=>:bottom)
-
- # f.hscroll(false)
-
- Tk.after(3000){
- t = TkText.new(f).pack(:expand=>true, :fill=>:both)
- t.insert(:end, 'Here is a text widget')
- }
-
- Tk.after(6000){ f.vscroll(false) }
-
- Tk.after(9000){ f.vscroll(true) }
-
- Tk.after(12000){ f.hscroll(false) }
-
- Tk.after(15000){ f.hscroll(true) }
-
- Tk.mainloop
-end
diff --git a/ext/tk/sample/tkballoonhelp.rb b/ext/tk/sample/tkballoonhelp.rb
index c2c95f771d..d66bc35a88 100644
--- a/ext/tk/sample/tkballoonhelp.rb
+++ b/ext/tk/sample/tkballoonhelp.rb
@@ -24,17 +24,13 @@ class TkBalloonHelp<TkLabel
@bindtag.bind('Leave', proc{@timer.stop; erase})
tags = @parent.bindtags
idx = tags.index(@parent)
- unless idx
- ppath = TkComm.window(@parent.path)
- idx = tags.index(ppath) || 0
- end
tags[idx,0] = @bindtag
@parent.bindtags(tags)
end
private :_balloon_binding
def initialize(parent=nil, keys={})
- @parent = parent || Tk.root
+ @parent = parent
@frame = TkToplevel.new(@parent)
@frame.withdraw
@@ -42,13 +38,7 @@ class TkBalloonHelp<TkLabel
@frame.transient(TkWinfo.toplevel(@parent))
@epath = @frame.path
- if keys
- keys = _symbolkey2str(keys)
- else
- keys = {}
- end
-
- @command = keys.delete('command')
+ keys = {} unless keys
@interval = keys.delete('interval'){1000}
_balloon_binding(@interval)
@@ -70,31 +60,10 @@ class TkBalloonHelp<TkLabel
end
end
- def command(cmd = Proc.new)
- @command = cmd
- self
- end
-
def show
x = TkWinfo.pointerx(@parent)
y = TkWinfo.pointery(@parent)
@frame.geometry("+#{x+1}+#{y+1}")
-
- if @command
- case @command.arity
- when 0
- @command.call
- when 2
- @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent))
- when 3
- @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent),
- self)
- else
- @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent),
- self, @parent)
- end
- end
-
@frame.deiconify
@frame.raise
@@ -126,69 +95,5 @@ if __FILE__ == $0
'interval'=>200, 'font'=>'courier',
'background'=>'gray', 'foreground'=>'red')
}
-
- sb = TkScrollbox.new.pack(:fill=>:x)
- sb.insert(:end, *%w(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm))
-=begin
- # CASE1 : command takes no arguemnt
- bh = TkBalloonHelp.new(sb, :interval=>500,
- :relief=>:ridge, :background=>'white',
- :command=>proc{
- y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb)
- bh.text "current index == #{sb.nearest(y)}"
- })
-=end
-=begin
- # CASE2 : command takes 2 arguemnts
- bh = TkBalloonHelp.new(sb, :interval=>500,
- :relief=>:ridge, :background=>'white',
- :command=>proc{|x, y|
- bh.text "current index == #{sb.nearest(y)}"
- })
-=end
-=begin
- # CASE3 : command takes 3 arguemnts
- TkBalloonHelp.new(sb, :interval=>500,
- :relief=>:ridge, :background=>'white',
- :command=>proc{|x, y, bhelp|
- bhelp.text "current index == #{sb.nearest(y)}"
- })
-=end
-=begin
- # CASE4a : command is a Proc object and takes 4 arguemnts
- cmd = proc{|x, y, bhelp, parent|
- bhelp.text "current index == #{parent.nearest(y)}"
- }
-
- TkBalloonHelp.new(sb, :interval=>500,
- :relief=>:ridge, :background=>'white',
- :command=>cmd)
-
- sb2 = TkScrollbox.new.pack(:fill=>:x)
- sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM))
- TkBalloonHelp.new(sb2, :interval=>500,
- :padx=>5, :relief=>:raised,
- :background=>'gray25', :foreground=>'white',
- :command=>cmd)
-=end
-#=begin
- # CASE4b : command is a Method object and takes 4 arguemnts
- def set_msg(x, y, bhelp, parent)
- bhelp.text "current index == #{parent.nearest(y)}"
- end
- cmd = self.method(:set_msg)
-
- TkBalloonHelp.new(sb, :interval=>500,
- :relief=>:ridge, :background=>'white',
- :command=>cmd)
-
- sb2 = TkScrollbox.new.pack(:fill=>:x)
- sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM))
- TkBalloonHelp.new(sb2, :interval=>500,
- :padx=>5, :relief=>:raised,
- :background=>'gray25', :foreground=>'white',
- :command=>cmd)
-#=end
-
Tk.mainloop
end
diff --git a/ext/tk/sample/tkextlib/blt/barchart5.rb b/ext/tk/sample/tkextlib/blt/barchart5.rb
deleted file mode 100644
index db181d10ca..0000000000
--- a/ext/tk/sample/tkextlib/blt/barchart5.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-load File.join(File.dirname(File.expand_path(__FILE__)),
- 'scripts', 'stipples.rb')
-
-TkOption.add('*graph.x.Title', 'X Axis Label')
-TkOption.add('*graph.y.Title', 'Y Axis Label')
-TkOption.add('*graph.title', 'A Simple Barchart')
-TkOption.add('*graph.x.Font', 'Times 10')
-TkOption.add('*graph.Element.Relief', :raised)
-
-visual = Tk.root.winfo_screenvisual
-if visual != 'staticgray' && visual != 'grayscale'
- TkOption.add('*graph.LineMarker.color', 'yellow')
- TkOption.add('*graph.Element.Background', 'white')
- TkOption.add('*graph.Legend.activeForeground', 'pink')
- TkOption.add('*print.background', 'yellow')
- TkOption.add('*quit.background', 'red')
- TkOption.add('*graph.background', 'palegreen')
- TkOption.add('*graph.plotBackground', 'lightblue')
-end
-
-htext = Tk::BLT::Htext.new(:widgetname=>'.htext', :text=><<EOD)
- This is an example of the barchart widget. The barchart has
- many components; x and y axis, legend, crosshairs, elements, etc.
- To create a postscript file "bar.ps", press the %%
-
- ruby {
- b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window,
- :widgetname=>'print', :text=>'Print',
- :command=>proc{
- $graph.postsript(:output=>'bar.ps')
- })
- Tk::BLT::Htext::Htext_Widget.window.append(b)
- }
-
-%% button.
-%%
-
- ruby {
- $graph = Tk::BLT::Barchart.new(:widgetname=>'.htext.graph',
- :relief=>:raised, :borderwidth=>2)
- $graph.xaxis_configure(:rotate=>90, :stepsize=>0)
- Tk::BLT::Htext::Htext_Widget.window.append($graph,
- :fill=>:both, :padx=>4)
- }
-
-%%
- Hit the %%
-
- ruby {
- b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window,
- :widgetname=>'quit', :text=>'Quit',
- :command=>proc{ exit })
- Tk::BLT::Htext::Htext_Widget.window.append(b)
- }
-
-%% button when you've seen enough.%%
-
- ruby {
- l = TkLabel.new(Tk::BLT::Htext::Htext_Widget.window, :bitmap=>'BLT')
- Tk::BLT::Htext::Htext_Widget.window.append(l, :padx=>20)
- }
-
-%%
-EOD
-
-names = %w(One Two Three Four Five Six Seven Eight)
-if visual == 'staticgray' || visual == 'grayscale'
- fgcolors = %w(white white white white white white white white)
- bgcolors = %w(black black black black black black black black)
-else
- fgcolors = %w(yellow orange red magenta purple blue cyan green)
- bgcolors = %w(yellow4 orange4 red4 magenta4 purple4 blue4 cyan4 green4)
-end
-
-numColors = names.length
-
-Tk::TCL_PRECISION.value = 15
-
-x = Tk::BLT::Vector.new
-y = Tk::BLT::Vector.new
-x.seq(-5.0, 5.0, 0.2)
-y.expr("sin(#{x})")
-barWidth = 0.19
-
-$graph.element_create('sin', :relief=>:raised, :borderwidth=>1,
- :x=>x, :y=>y, :barwidth=>barWidth)
-
-Tk::BLT::Table.add(Tk.root, htext, :fill=>:both)
-
-Tk.root.minsize(0, 0)
-
-Tk::BLT.zoom_stack($graph)
-Tk::BLT.crosshairs($graph)
-Tk::BLT.active_legend($graph)
-Tk::BLT.closest_point($graph)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/calendar.rb b/ext/tk/sample/tkextlib/blt/calendar.rb
deleted file mode 100644
index 4fc6d64d9e..0000000000
--- a/ext/tk/sample/tkextlib/blt/calendar.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'tk'
-require 'tkextlib/blt'
-
-require 'date'
-
-dir = File.join(File.dirname(File.expand_path(__FILE__)), 'images')
-file = File.join(dir, 'chalk.gif')
-active = File.join(dir, 'rain.gif')
-
-texture1 = TkPhotoImage.new(:file=>file)
-texture2 = TkPhotoImage.new(:file=>active)
-
-TkOption.add('*Tile', texture1)
-
-TkOption.add('*HighlightThickness', 0)
-TkOption.add('*calendar.weekframe*Tile', texture2)
-TkOption.add('*Calendar.Label.borderWidth', 0)
-TkOption.add('*Calendar.Label.relief', :sunken)
-TkOption.add('*Calendar.Frame.borderWidth', 2)
-TkOption.add('*Calendar.Frame.relief', :raised)
-TkOption.add('*Calendar.Label.font', 'Helvetica 11')
-TkOption.add('*Calendar.Label.foreground', 'navyblue')
-TkOption.add('*button.foreground', 'navyblue')
-TkOption.add('*background', 'grey85')
-TkOption.add('*Label.ipadX', 200)
-
-TkOption.add('*tile', texture2)
-
-class BLT_Calendar_sample
- @@monthInfo = [
- nil, # dummy
- ['January', 31],
- ['February', 28],
- ['March', 31],
- ['April', 30],
- ['May', 31],
- ['June', 30],
- ['July', 31],
- ['August', 31],
- ['Septembar', 30],
- ['October', 31],
- ['November', 30],
- ['December', 31]
- ]
-
- @@abbrDays = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
-
- def initialize()
- today = Date.today
-
- if TkComm.bool(Tk.info(:commands, '.calendar'))
- Tk.destroy('.calendar')
- end
- cal = Tk::BLT::Tile::Frame.new(:widgetname=>'.calendar',
- :classname=>'Calendar',
- :width=>'3i', :height=>'3i')
-
- mon = Tk::BLT::Tile::Label.new(cal, :font=>'Courier 14 bold',
- :text=>"#{@@monthInfo[today.month][0]} " +
- "#{today.year}")
- Tk::BLT::Table.add(cal, mon, [1, 0], :cspan=>7, :pady=>10)
-
- week_f = Tk::BLT::Tile::Frame.new(cal, :widgetname=>'weekframe',
- :relief=>:sunken, :borderwidth=>1)
- Tk::BLT::Table.add(cal, week_f, [2, 0], :columnspan=>7, :fill=>:both)
-
- @@abbrDays.each_with_index{|dayName, idx|
- Tk::BLT::Table.add(cal,
- Tk::BLT::Tile::Label.new(cal, :text=>dayName,
- :font=>'Helvetica 12'),
- [2, idx], :pady=>2, :padx=>2)
- }
-
- Tk::BLT::Table.itemconfigure(cal, 'c*', 'r2', :pad=>4)
-
- numDays = @@monthInfo[today.month][1]
- week = 0
- cnt = 1
-
- wkday = today.wday - ((today.day - 1) % 7)
- wkday += 7 if wkday < 0
-
- while cnt <= numDays
- Tk::BLT::Table.add(cal,
- Tk::BLT::Tile::Label.new(cal, :text=>cnt){
- self.configure(:borderwidth=>1,
- :relief=>:sunken) if cnt == today.day
- },
- [week+3, wkday], :fill=>:both, :ipadx=>10, :ipady=>4)
- cnt += 1
- wkday += 1
- if wkday == 7
- week += 1
- wkday = 0
- end
- end
-
- Tk::BLT::Tile::Frame.new(cal, :borderwidth=>1, :relief=>:sunken){|f|
- Tk::BLT::Table.add(f,
- Tk::BLT::Tile::Button.new(f, :widgetname=>'button',
- :command=>proc{exit},
- :borderwidth=>2,
- :text=>'Quit'),
- :padx=>4, :pady=>4)
- Tk::BLT::Table.add(cal, f, [week+4, 5], :cspan=>2, :pady=>4)
- }
-
- Tk::BLT::Table.add(Tk.root, cal, :fill=>:both)
- Tk::BLT::Table.itemconfigure(cal, 'r0', :resize=>:none)
- end
-end
-
-BLT_Calendar_sample.new
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph6.rb b/ext/tk/sample/tkextlib/blt/graph6.rb
deleted file mode 100644
index f899b44115..0000000000
--- a/ext/tk/sample/tkextlib/blt/graph6.rb
+++ /dev/null
@@ -1,2222 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'tk'
-require 'tkextlib/blt'
-
-Tk::TCL_PRECISION.value = 15
-
-[
- ['*Graph.Width', '10i'],
- ['*Graph.leftMargin', '.75i'],
- ['*Graph.Height', '6i'],
- ['*Graph.plotBackground', 'black'],
- ['*LineMarker.color', 'white'],
- ['*LineMarker.Dashes', 5],
- ['*TextMarker.foreground', 'white'],
- ['*TextMarker.Background', ''],
-
- ['*Graph.x.hide', true],
- ['*Graph.x.title', ''],
- ['*Graph.y.rotate', 90],
- # ['*Graph.y.stepSize', 2.0],
- ['*Graph.title', ''],
- ['*graph.Title', 'Example s27'],
- ['*graph.x.hide', false],
- ['*graph.topMargin', 0],
- ['*graph.bottomMargin', 0],
- ['*x.Title', 'Time'],
- ['*y.Title', 'Signals'],
- ['*Pixels', 1],
-
- ['*Reduce', 0.5],
- ['*bufferElements', false],
-
- ['*Element.color', 'green4'],
- ['*Element.ScaleSymbols', true],
- ['*Element.Color', 'grey70'],
- ['*Element.Symbol', :none],
- ['*Element.LineWidth', 1],
- # ['*Element.Smooth', :natural],
- ['*Element.Smooth', :catrom],
-
- ['*activeLine.LineWidth', 2],
- ['*activeLine.Color', 'white'],
- ['*activeLine.Color', 'green1'],
-
- # ['*Legend.Hide', true],
- ['*Legend.Position', :right],
- ['*Legend.Relief', :flat],
- ['*Legend.activeRelief', :sunken],
- ['*Legend.borderWidth', 2],
- #['*Legend.Font', '-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*'],
- ['*Legend.Font', 'Helvetica -10'],
- ['*Grid.hide', false],
- ['*Grid.dashes', [1, 5]],
-
- # ['*foreground', 'white'],
- ['*zoomOutline.outline', 'yellow'],
-].each{|k, v| TkOption.add(k, v)}
-
-##############################
-
-class BLT_Graph_Demo
- def initialize
- @graph = Tk::BLT::Graph.new(:widgetname=>'graph')
-
- @root = Tk.root
- @root.minsize(0, 0)
-
- _set_vectors()
- (1..39).each{|i| @graph.element_create("V#{i}", :x=>@x, :y=>@v[i])}
-
- @top = Tk::BLT::Tile::Toplevel.new
-=begin
- legend = Tk::BLT::Graph.new(@top, :widgetname=>'legend',
- :without_creating=>true)
- @graph.legend_configure(:position=>legend)
-=end
- # legend = @graph.legend_window_create(@top, :widgetname=>'legend')
- legend = @graph.legend_window_create(@top)
- legend.pack(:fill=>:both, :expand=>true)
-
- Tk::BLT::Table.add(@root, @graph, [0,0], :fill=>:both)
-
- @quit_btn = Tk::BLT::Tile::Button.new(:text=>' quit ', :background=>'red',
- :command=>proc{exit})
- Tk::BLT::Table.add(@root, @quit_btn, [1,0], :anchor=>:e, :padx=>10)
-
- @graph.zoom_stack
- @graph.crosshairs
- @graph.closest_point
- @graph.print_key
-
- @graph.legend_bind(:all, 'ButtonRelease-1',
- proc{|w| highlightTrace(w)}, '%W')
- @graph.legend_bind(:all, 'ButtonRelease-3',
- proc{|w|
- w.legend_deactivate('*')
- active = w.element_activate
- w.element_deactivate(*active)
- }, '%W')
- end
-
- private
-
- def _set_vectors
- @x = Tk::BLT::Vector.new(:variable=>'')
- @v = []
- (1..39).each{|i| @v[i] = Tk::BLT::Vector.new(:variable=>'')}
-
- @x.set(<<-'EOD')
- 0 1e-10 2e-10 3e-10 4e-10 5e-10 6e-10 7e-10 8e-10 9e-10
- 1e-09 1.1e-09 1.2e-09 1.3e-09 1.4e-09 1.5e-09 1.6e-09 1.7e-09
- 1.8e-09 1.9e-09 2e-09 2.1e-09 2.2e-09 2.3e-09 2.4e-09 2.5e-09
- 2.6e-09 2.7e-09 2.8e-09 2.9e-09 3e-09 3.1e-09 3.2e-09 3.3e-09
- 3.4e-09 3.5e-09 3.6e-09 3.7e-09 3.8e-09 3.9e-09 4e-09 4.1e-09
- 4.2e-09 4.3e-09 4.4e-09 4.5e-09 4.6e-09 4.7e-09 4.8e-09
- 4.9e-09 5e-09 5.1e-09 5.2e-09 5.3e-09 5.4e-09 5.5e-09 5.6e-09
- 5.7e-09 5.8e-09 5.9e-09 6e-09 6.1e-09 6.2e-09 6.3e-09 6.4e-09
- 6.5e-09 6.6e-09 6.7e-09 6.8e-09 6.9e-09 7e-09 7.1e-09 7.2e-09
- 7.3e-09 7.4e-09 7.5e-09 7.6e-09 7.7e-09 7.8e-09 7.9e-09
- 8e-09 8.1e-09 8.2e-09 8.3e-09 8.4e-09 8.5e-09 8.6e-09 8.7e-09
- 8.8e-09 8.9e-09 9e-09 9.1e-09 9.2e-09 9.3e-09 9.4e-09 9.5e-09
- 9.6e-09 9.7e-09 9.8e-09 9.9e-09 1e-08 1.01e-08 1.02e-08
- 1.03e-08 1.04e-08 1.05e-08 1.06e-08 1.07e-08 1.08e-08 1.09e-08
- 1.1e-08 1.11e-08 1.12e-08 1.13e-08 1.14e-08 1.15e-08 1.16e-08
- 1.17e-08 1.18e-08 1.19e-08 1.2e-08 1.21e-08 1.22e-08 1.23e-08
- 1.24e-08 1.25e-08 1.26e-08 1.27e-08 1.28e-08 1.29e-08 1.3e-08
- 1.31e-08 1.32e-08 1.33e-08 1.34e-08 1.35e-08 1.36e-08 1.37e-08
- 1.38e-08 1.39e-08 1.4e-08 1.41e-08 1.42e-08 1.43e-08 1.44e-08
- 1.45e-08 1.46e-08 1.47e-08 1.48e-08 1.49e-08 1.5e-08 1.51e-08
- 1.52e-08 1.53e-08 1.54e-08 1.55e-08 1.56e-08 1.57e-08 1.58e-08
- 1.59e-08 1.6e-08 1.61e-08 1.62e-08 1.63e-08 1.64e-08 1.65e-08
- 1.66e-08 1.67e-08 1.68e-08 1.69e-08 1.7e-08 1.71e-08 1.72e-08
- 1.73e-08 1.74e-08 1.75e-08 1.76e-08 1.77e-08 1.78e-08 1.79e-08
- 1.8e-08 1.81e-08 1.82e-08 1.83e-08 1.84e-08 1.85e-08 1.86e-08
- 1.87e-08 1.88e-08 1.89e-08 1.9e-08 1.91e-08 1.92e-08 1.93e-08
- 1.94e-08 1.95e-08 1.96e-08 1.97e-08 1.98e-08 1.99e-08 2e-08
- 2.01e-08 2.02e-08 2.03e-08 2.04e-08 2.05e-08 2.06e-08 2.07e-08
- 2.08e-08 2.09e-08 2.1e-08 2.11e-08 2.12e-08 2.13e-08 2.14e-08
- 2.15e-08 2.16e-08 2.17e-08 2.18e-08 2.19e-08 2.2e-08 2.21e-08
- 2.22e-08 2.23e-08 2.24e-08 2.25e-08 2.26e-08 2.27e-08 2.28e-08
- 2.29e-08 2.3e-08 2.31e-08 2.32e-08 2.33e-08 2.34e-08 2.35e-08
- 2.36e-08 2.37e-08 2.38e-08 2.39e-08 2.4e-08 2.41e-08 2.42e-08
- 2.43e-08 2.44e-08 2.45e-08 2.46e-08 2.47e-08 2.48e-08 2.49e-08
- 2.5e-08 2.51e-08 2.52e-08 2.53e-08 2.54e-08 2.55e-08 2.56e-08
- 2.57e-08 2.58e-08 2.59e-08 2.6e-08 2.61e-08 2.62e-08 2.63e-08
- 2.64e-08 2.65e-08 2.66e-08 2.67e-08 2.68e-08 2.69e-08 2.7e-08
- 2.71e-08 2.72e-08 2.73e-08 2.74e-08 2.75e-08 2.76e-08 2.77e-08
- 2.78e-08 2.79e-08 2.8e-08 2.81e-08 2.82e-08 2.83e-08 2.84e-08
- 2.85e-08 2.86e-08 2.87e-08 2.88e-08 2.89e-08 2.9e-08 2.91e-08
- 2.92e-08 2.93e-08 2.94e-08 2.95e-08 2.96e-08 2.97e-08 2.98e-08
- 2.99e-08 3e-08 3.01e-08 3.02e-08 3.03e-08 3.04e-08 3.05e-08
- 3.06e-08 3.07e-08 3.08e-08 3.09e-08 3.1e-08 3.11e-08 3.12e-08
- 3.13e-08 3.14e-08 3.15e-08 3.16e-08 3.17e-08 3.18e-08 3.19e-08
- 3.2e-08 3.21e-08 3.22e-08 3.23e-08 3.24e-08 3.25e-08 3.26e-08
- 3.27e-08 3.28e-08 3.29e-08 3.3e-08 3.31e-08 3.32e-08 3.33e-08
- 3.34e-08 3.35e-08 3.36e-08 3.37e-08 3.38e-08 3.39e-08 3.4e-08
- 3.41e-08 3.42e-08 3.43e-08 3.44e-08 3.45e-08 3.46e-08 3.47e-08
- 3.48e-08 3.49e-08 3.5e-08 3.51e-08 3.52e-08 3.53e-08 3.54e-08
- 3.55e-08 3.56e-08 3.57e-08 3.58e-08 3.59e-08 3.6e-08
- EOD
-
- @v[1].set(<<-'EOD')
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- EOD
-
- @v[2].set(<<-'EOD')
- 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1
- 5.32907e-15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5
- 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0
- EOD
-
- @v[3].set(<<-'EOD')
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0
- EOD
-
- @v[4].set(<<-'EOD')
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- EOD
-
- @v[5].set(<<-'EOD')
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- EOD
-
- @v[6].set(<<-'EOD')
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0
- EOD
-
- @v[7].set(<<-'EOD')
- 5 5.16904 4.84159 3.34542 0.317102 0.103304 0.0275721 0.0221534
- 0.017689 0.0142639 0.0113974 0.00918238 0.00742541 0.00616602
- 0.00481195 0.00397049 -0.0659889 -0.025671 0.165495 0.986891
- 3.05229 4.55511 4.91611 4.98192 4.99428 4.99833 4.99095
- 4.97295 4.95493 4.93428 4.90723 4.94799 4.98584 4.99566
- 4.99813 4.99907 4.99947 4.99965 4.99976 4.99984 4.99989
- 4.99992 4.99994 4.99996 4.99998 5.00002 5.00006 5.00002
- 4.99996 4.99994 4.99999 5.00003 5.00002 5 4.99997 4.99997
- 4.99997 4.99997 4.99997 4.99996 4.99997 4.99997 4.99998
- 4.99998 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99998 4.99998 4.99998 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.16575
- 4.69986 2.43862 0.0230224 0.035229 -0.0210607 -0.0292766
- -0.0172693 -0.00271479 -0.000912251 -0.000349106 -0.000116866
- -4.24733e-05 -1.39536e-05 -3.01179e-05 -0.0657192 -0.0204835
- 0.183378 1.07181 3.118 4.46472 4.84158 4.94795 4.98173 4.99236
- 4.99762 5.01939 5.0433 5.05332 5.04959 5.03955 5.02851 5.02052
- 5.01422 5.00965 5.00631 5.00405 5.00248 5.00083 5.00012
- 5.00209 5.00387 5.00347 4.99917 4.99213 4.98411 4.97521
- 4.96332 4.94601 4.9304 4.94633 4.97936 4.99264 4.99685 4.99857
- 4.99925 4.99954 4.9997 4.99973 4.9997 4.99973 4.99979 4.99983
- 4.99986 4.99988 4.9999 4.9999 4.99992 4.99993 4.99994 4.99995
- 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002
- 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 5 5 5.14242 4.76101 3.16003 0.299374
- 0.0645506 -0.000498424 -2.45108e-05 -2.27986e-05 -5.24401e-05
- -4.9884e-05 -4.92491e-05 -2.93354e-05 -3.21402e-05 -2.11851e-05
- -3.37925e-05 -0.0657892 -0.020563 0.182582 1.06058 3.12484
- 4.46552 4.84146 4.95102 4.98556 4.99472 4.99806 4.99909
- 4.99955 4.99976 4.99994 4.99992 5.00029 4.99967 4.99849
- 4.99736 4.99884 5.00099 5.00377 5.00215 4.99994 4.99893
- 4.99788 4.99862 5.00055 5.00134 5.00127 5.00073 5.00039
- 5.00018 5.00006 5.00001 4.99985 5.00026 5.00018 5.00003
- 4.99981 4.99985 4.99987 4.99985 4.99982 4.99982 4.99982
- 4.99983 4.99985 4.99987 4.99989 4.99991 4.99992 4.99994
- 4.99995 4.99995 4.99994 4.99994 4.99996 4.99999 5.00002
- 5.00008 5.00009 5.00006 5.00001 5 4.99999 4.99998 4.99997
- 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999
- 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 4.99998
- 4.99998
- EOD
-
- @v[8].set(<<-'EOD')
- 5 5.03758 5.04711 4.96911 4.20882 3.96295 4.01117 4.15521
- 4.2967 4.42274 4.5295 4.6176 4.69014 4.74831 4.7966 4.83537
- 4.80526 4.787 4.79295 4.88588 5.08978 5.15615 5.10778 5.07718
- 5.06652 5.08225 4.9744 4.52977 3.77452 2.69426 1.15294 0.245509
- 0.0981544 0.0567527 0.0367487 0.0252578 0.0180599 0.0133837
- 0.0101497 0.0078616 0.00620186 0.00499056 0.0041027 0.00344223
- 0.00295808 0.00260089 0.00229887 0.00200817 0.00176397 0.00160116
- 0.00147381 0.00134645 0.00125029 0.00116043 0.00107371 0.00101981
- 0.000965921 0.000912028 0.000858135 0.000804242 0.000761669
- 0.00072672 0.000691771 0.000656823 0.000621874 0.000588722
- 0.00057041 0.000552098 0.000533785 0.000515473 0.000497162
- 0.00047885 0.000460537 0.000442226 0.000423914 0.000405601
- 0.000388399 0.000378694 0.000368989 0.000359284 0.00034958
- 0.000339875 0.00033017 0.000320465 0.00031076 0.000301055
- 0.00029135 0.000282207 0.000276247 0.000270287 0.000264327
- 0.000258367 0.000252407 0.000246447 0.000240487 0.000234527
- 0.000228567 0.000222607 0.000217086 0.000213696 0.000210307
- 0.000206918 0.000203528 0.000200139 0.00019675 0.00019336
- 0.000189971 0.000186582 0.000183192 0.000179803 0.000176414
- 0.000173025 0.000169635 0.000166246 0.000162857 0.000159467
- 0.000156078 0.000152689 0.000149299 0.00014591 0.00014255
- 0.0316021 0.163272 0.348732 0.603651 0.35745 0.135965 0.0707354
- 0.0314595 0.0201047 0.00994945 0.00389601 0.00138839 0.00060778
- 0.000329648 0.000492396 -0.0732035 -0.0844077 -0.0789062
- -0.0390837 0.0197559 0.0183094 -0.00180099 -0.0189565 -0.0424144
- -0.0735904 -0.0892423 0.285039 1.13702 2.10809 2.95826 3.60164
- 4.0435 4.35771 4.57254 4.71769 4.81329 4.87534 4.91487 4.94264
- 4.97375 5.01526 5.06517 5.10154 5.06259 4.89005 4.5787 4.12226
- 3.46151 2.49023 1.2586 0.32725 0.116753 0.0701865 0.0455509
- 0.0286914 0.0178176 0.0117599 0.00902715 0.00760583 0.00637745
- 0.00543811 0.00439377 0.00352448 0.0030151 0.00285771 0.002465
- 0.00203114 0.00173004 0.0014839 0.00125177 0.00105327 0.000894905
- 0.000766372 0.000658894 0.000569105 0.000492114 0.000427938
- 0.000370217 0.000314758 0.000266569 0.000233726 0.000209048
- 0.000191957 0.000177169 0.000166604 0.000161 0.000157314
- 0.000143828 0.000130342 0.000116857 0.000103371 8.98855e-05
- 7.63998e-05 6.29141e-05 5.76583e-05 5.30027e-05 4.8347e-05
- 4.36913e-05 3.90357e-05 3.438e-05 2.97243e-05 2.72507e-05
- 2.59083e-05 2.45659e-05 2.32235e-05 2.18811e-05 2.05387e-05
- 1.91963e-05 1.78539e-05 1.65115e-05 1.51691e-05 1.38267e-05
- 1.24843e-05 1.11419e-05 9.79954e-06 8.51574e-06 7.69807e-06
- 6.8804e-06 6.06273e-06 5.24506e-06 0.0287318 0.0317111 -0.0320087
- -0.103609 0.0369639 0.0121128 0.00961197 0.00934971 0.00820853
- 0.00699769 0.00607002 0.00535541 0.00476552 0.00427601 0.00376357
- -0.073012 -0.0866964 -0.0809538 -0.038005 0.0277001 0.0188906
- 0.00614597 0.00373629 0.00489787 0.0146573 0.0191052 0.0151708
- 0.0124224 0.0105859 0.00879272 0.00729464 0.0070047 0.00449575
- -0.00626652 -0.0252417 -0.0147287 0.022538 0.0822905 0.0947372
- 0.0657516 0.0445506 0.0316753 0.0220971 0.0158101 0.0140971
- 0.0161498 0.0139876 0.0122447 0.0106994 0.009397 0.00822236
- 0.00686509 0.00797431 0.00751269 0.00671173 0.00595243 0.00524633
- 0.00459528 0.00401688 0.00350109 0.00303954 0.00260569 0.00222792
- 0.00191033 0.00163917 0.00140949 0.00121464 0.0010471 0.000900638
- 0.000768847 0.000645236 0.000524807 0.000460275 0.000442237
- 0.000446775 0.000397026 0.000301585 0.000228994 0.000190894
- 0.000166569 0.000152261 0.000137953 0.000123644 0.000109336
- 9.50281e-05 8.56557e-05 7.78437e-05 7.00318e-05 6.22198e-05
- 5.44079e-05 4.87539e-05 4.57761e-05 4.27982e-05 3.98203e-05
- 3.68425e-05 3.38646e-05 3.08868e-05 2.79089e-05 2.4931e-05
- 2.19532e-05 1.89753e-05 1.75244e-05 1.64095e-05 1.52946e-05
- 1.41797e-05 1.30648e-05 1.19499e-05 1.0835e-05 9.72011e-06
- 8.60521e-06 7.4903e-06 6.5117e-06 6.10334e-06 5.69497e-06
- 5.2866e-06 4.87824e-06 4.46987e-06 4.06151e-06 3.65314e-06
- 3.24477e-06
- EOD
-
- @v[9].set(<<-'EOD')
- 1.86175 1.99708 2.07867 2.01211 2.43309 3.27194 3.63896
- 3.90426 4.11074 4.27932 4.41496 4.52543 4.61491 4.68862
- 4.7479 4.79666 4.72895 4.68886 4.70354 4.81353 5.01568 5.14184
- 5.10482 5.07362 5.05143 5.03638 5.02323 5.01465 5.00853
- 5.00383 4.99985 5.00454 5.00652 5.00546 5.00411 5.003 5.00214
- 5.00151 5.00106 5.00073 5.0005 5.00034 5.00023 5.00015 5.0001
- 5.00005 5 5.00001 5.00005 5.00005 5.00003 5 4.99998 4.99996
- 4.99994 4.99995 4.99997 4.99998 5 5.00001 5.00002 5.00002
- 5.00003 5.00003 5.00003 5.00003 5.00003 5.00003 5.00002
- 5.00002 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998
- 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.17392 4.94828 3.78491
- 1.52079 0.608874 0.244031 0.127087 0.0552995 0.0361032 0.0169025
- 0.006364 0.00217624 0.000921391 0.000457305 0.000786754
- -0.120016 -0.148054 -0.15898 -0.0801463 0.16463 0.174017
- 0.0799249 0.0318788 0.0129696 0.00483397 0.0025677 0.0042079
- 0.00350003 0.00178404 -8.72902e-05 -0.00128497 -0.00142213
- -0.00130018 -0.00106874 -0.000789207 -0.000824335 -0.00104518
- -0.00136799 -0.004366 -0.0102621 -0.0109254 -0.00649259
- -0.00194842 0.00029793 0.00148673 0.00221085 0.00228291
- 0.00185261 0.00139687 0.00148183 0.00562266 0.00844119 0.00754627
- 0.00657396 0.00591212 0.00539269 0.0049282 0.00448417 0.0040572
- 0.00363719 0.00320392 0.00279607 0.00243938 0.00211505 0.00182302
- 0.00156254 0.0013341 0.00113834 0.000971865 0.00082776 0.000706193
- 0.000602499 0.000515059 0.000441401 0.00037897 0.000325459
- 0.00028083 0.000242096 0.000207274 0.000176444 0.000150372
- 0.000126407 0.000103373 9.05522e-05 8.53555e-05 8.63685e-05
- 9.02593e-05 8.37346e-05 7.72099e-05 7.06852e-05 6.41605e-05
- 5.76358e-05 5.11112e-05 4.45865e-05 4.08176e-05 3.72497e-05
- 3.36818e-05 3.01138e-05 2.65459e-05 2.2978e-05 1.94101e-05
- 1.76154e-05 1.67399e-05 1.58645e-05 1.4989e-05 1.41136e-05
- 1.32381e-05 1.23626e-05 1.14872e-05 1.06117e-05 9.73629e-06
- 8.86083e-06 7.98538e-06 7.10993e-06 6.23447e-06 5.44363e-06
- 5.32578e-06 5.20792e-06 5.09007e-06 4.97222e-06 0.0784323
- 0.0474527 -0.0764232 -0.151146 0.0615785 0.0144489 0.00974161
- 0.00947176 0.00849005 0.00728201 0.00630581 0.00554032 0.00487809
- 0.00441504 0.00384139 -0.118943 -0.149894 -0.161173 -0.0825299
- 0.171686 0.176912 0.0816085 0.0335236 0.013791 0.0056976
- 0.00238833 0.00105348 0.000526199 0.00025969 0.000396026
- 0.000837835 0.00170131 0.00196699 -0.000553314 -0.0061621
- -0.0111895 -0.0142698 -0.0124608 -0.00795847 -0.00467822
- -0.0043058 -0.00874449 -0.0118584 -0.00871386 -0.00377892
- 1.95244e-05 0.00218952 0.00325486 0.00386497 0.00422837
- 0.00446883 0.00447065 0.00486647 0.00547838 0.00565398 0.00559092
- 0.00538752 0.00507015 0.00466305 0.00420756 0.00373465 0.00328404
- 0.00287059 0.00250057 0.00216124 0.00184861 0.00156815 0.00134624
- 0.00117857 0.00103412 0.0008948 0.000761012 0.000619853
- 0.000462614 0.000319965 0.000287666 0.000356415 0.000379946
- 0.000339183 0.00027972 0.000252982 0.000226244 0.000199507
- 0.000172769 0.000146031 0.000130097 0.000117578 0.000105059
- 9.25401e-05 8.00213e-05 7.11204e-05 6.67061e-05 6.22918e-05
- 5.78775e-05 5.34632e-05 4.90489e-05 4.46346e-05 4.02203e-05
- 3.5806e-05 3.13916e-05 2.69773e-05 2.4827e-05 2.31747e-05
- 2.15225e-05 1.98702e-05 1.8218e-05 1.65658e-05 1.49135e-05
- 1.32613e-05 1.1609e-05 9.95678e-06 8.50108e-06 7.86765e-06
- 7.23422e-06 6.60079e-06 5.96736e-06 5.33393e-06 4.7005e-06
- 4.06707e-06 3.43363e-06
- EOD
-
- @v[10].set(<<-'EOD')
- 1.86175 1.99308 2.16619 2.46661 3.09359 3.76864 4.31299
- 4.65564 4.83425 4.92153 4.96157 4.98063 4.98649 4.99039
- 4.9945 4.9972 4.96206 4.89882 4.83865 4.83202 4.91016 5.04479
- 5.06078 5.04827 5.03474 5.0246 5.01639 5.00996 5.00569 5.00239
- 5.00043 5.00296 5.00437 5.00382 5.00287 5.00208 5.00148
- 5.00104 5.00073 5.0005 5.00034 5.00023 5.00016 5.00011 5.00008
- 5.00007 5.00007 5.00004 5 4.99998 4.99998 4.99997 4.99998
- 4.99999 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001
- 5.00001 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5.10081
- 5.10949 4.98359 5.00733 5.15145 4.37298 2.36126 0.470759
- 0.0577238 0.0115884 0.00262611 0.000671499 0.000389038 0.000291291
- 0.000317347 -0.0167823 -0.0158344 -0.0140559 0.0104849 0.0865874
- 0.107813 0.0524688 0.0214369 0.00876443 0.00341595 0.00170778
- 0.00259042 0.0022241 0.00118519 1.10217e-06 -0.000784506
- -0.000948169 -0.000856256 -0.000696719 -0.000485987 -0.000724787
- -0.000981491 -0.001454 -0.00552498 -0.0114992 -0.0105266
- -0.00543527 -0.000982798 0.00127356 0.00224212 0.00275439
- 0.00281098 0.0025471 0.00230368 0.00222576 0.00485522 0.00729453
- 0.00691796 0.0062615 0.00573987 0.0052688 0.00481185 0.00436934
- 0.00394326 0.00352712 0.00309978 0.00270038 0.00235335 0.00203742
- 0.00175256 0.00150067 0.00128126 0.00109323 0.000933619
- 0.000795113 0.000678182 0.00057843 0.000494345 0.000423609
- 0.000363821 0.000312766 0.000269856 0.000232389 0.000198382
- 0.000168126 0.00014267 0.000119293 9.69034e-05 8.5669e-05
- 8.26828e-05 8.64066e-05 9.26665e-05 8.5454e-05 7.82416e-05
- 7.10291e-05 6.38167e-05 5.66043e-05 4.93918e-05 4.21794e-05
- 3.86073e-05 3.53007e-05 3.19941e-05 2.86876e-05 2.5381e-05
- 2.20744e-05 1.87678e-05 1.70933e-05 1.62648e-05 1.54363e-05
- 1.46079e-05 1.37794e-05 1.2951e-05 1.21225e-05 1.12941e-05
- 1.04656e-05 9.63716e-06 8.80871e-06 7.98026e-06 7.1518e-06
- 6.32335e-06 5.5374e-06 5.08959e-06 4.64178e-06 4.19397e-06
- 3.74616e-06 0.0438026 0.0242078 -0.0602019 -0.0840866 0.00148461
- -0.00292489 0.000442098 0.00219489 0.00281478 0.00290756
- 0.00277945 0.00263896 0.00240099 0.00223283 0.001947 -0.0153629
- -0.0148815 -0.0128673 0.0126017 0.0905161 0.11051 0.0538958
- 0.022562 0.00935726 0.00397422 0.00172534 0.000790207 0.000416322
- 0.000191632 0.000469721 0.0009779 0.00192566 0.00200688
- -0.0016502 -0.00733932 -0.0128113 -0.0147608 -0.0115456
- -0.00668995 -0.00401368 -0.00463908 -0.0101197 -0.0118993
- -0.0076276 -0.00262656 0.000813059 0.00264455 0.00350796
- 0.00399494 0.0043049 0.00451658 0.00444739 0.00503842 0.00559516
- 0.00568213 0.00556459 0.0053176 0.00496654 0.00454337 0.00408592
- 0.00362171 0.00317793 0.00277001 0.00240394 0.00207009 0.00176575
- 0.00149725 0.00129045 0.00114257 0.00101135 0.000871672
- 0.000723764 0.000580438 0.000427507 0.000296956 0.000281834
- 0.000376628 0.000412266 0.000367547 0.000295305 0.000264513
- 0.000233721 0.000202929 0.000172137 0.000141345 0.000124721
- 0.000112577 0.000100433 8.82893e-05 7.61453e-05 6.75517e-05
- 6.33609e-05 5.91701e-05 5.49792e-05 5.07884e-05 4.65976e-05
- 4.24067e-05 3.82159e-05 3.40251e-05 2.98342e-05 2.56434e-05
- 2.36401e-05 2.21181e-05 2.05961e-05 1.90741e-05 1.75521e-05
- 1.60301e-05 1.45081e-05 1.29861e-05 1.14641e-05 9.94208e-06
- 8.59252e-06 7.96439e-06 7.33626e-06 6.70813e-06 6.07999e-06
- 5.45186e-06 4.82373e-06 4.1956e-06 3.56747e-06
- EOD
-
- @v[11].set(<<-'EOD')
- 1.86175 1.73419 1.42874 1.04055 0.943004 0.268275 0.0826455
- 0.0388346 0.0214104 0.0135431 0.00961322 0.00712846 0.00588262
- 0.00432397 0.00377774 0.00270134 -0.00393731 -0.00542187
- -0.00126596 0.0113777 0.0134522 0.00477056 -0.00211067 -0.00229253
- -0.00173355 -0.00122404 -0.00113426 -0.000744931 -0.000520112
- -0.000410048 -0.000220439 0.000508104 5.15856e-05 -0.000112593
- -0.000118917 -9.57394e-05 -7.15727e-05 -5.11847e-05 -3.58275e-05
- -2.47166e-05 -1.68866e-05 -1.14082e-05 -7.66646e-06 -5.12139e-06
- -3.63426e-06 -3.01815e-06 -2.64862e-06 -1.4947e-06 -1.91403e-07
- -2.5763e-08 -7.73699e-07 -1.52164e-06 -1.07268e-06 -3.81696e-07
- 2.6727e-07 4.75489e-07 6.83708e-07 8.91926e-07 1.10014e-06
- 1.30836e-06 1.2482e-06 1.00726e-06 7.66311e-07 5.25364e-07
- 2.84417e-07 6.27857e-08 7.43904e-10 -6.12979e-08 -1.2334e-07
- -1.85382e-07 -2.47423e-07 -3.09465e-07 -3.71507e-07 -4.33549e-07
- -4.95591e-07 -5.57633e-07 -6.04571e-07 -5.4944e-07 -4.9431e-07
- -4.3918e-07 -3.84049e-07 -3.28919e-07 -2.73789e-07 -2.18659e-07
- -1.63528e-07 -1.08398e-07 -5.32678e-08 1.062e-09 5.08502e-08
- 1.00638e-07 1.50427e-07 2.00215e-07 2.50003e-07 2.99791e-07
- 3.4958e-07 3.99368e-07 4.49156e-07 4.98944e-07 5.34512e-07
- 5.01032e-07 4.67553e-07 4.34073e-07 4.00593e-07 3.67113e-07
- 3.33633e-07 3.00153e-07 2.66674e-07 2.33194e-07 1.99714e-07
- 1.66234e-07 1.32754e-07 9.92744e-08 6.57945e-08 3.23147e-08
- -1.16513e-09 -3.4645e-08 -6.81248e-08 -1.01605e-07 -1.35084e-07
- -1.68564e-07 -2.18729e-07 0.0114926 -0.0245378 -0.111828
- 0.0964775 1.61491 3.22668 4.22041 4.54492 4.82845 4.94868
- 4.98588 4.99609 4.9981 4.99908 4.99788 4.98395 4.99294 4.99724
- 5.01939 5.0471 5.00902 4.98194 4.98496 4.99188 4.99623 4.99862
- 5.00025 4.99974 4.99953 4.99946 4.99958 5.00012 4.99997
- 4.99992 4.99988 4.99985 4.9998 4.9997 4.9988 4.99806 4.99982
- 5.00143 5.00159 5.00098 5.00053 5.00028 5.00007 4.99977
- 4.99992 5.00005 5.00133 5.0009 4.99993 4.99972 4.99975 4.9998
- 4.99982 4.99983 4.99983 4.99983 4.99983 4.99984 4.99986
- 4.99987 4.99989 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995
- 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99998
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 5 5 5.01457 4.99482 4.96561 4.99326
- 5.03452 5.00424 5.00101 5.00045 5.00004 4.99965 4.99997
- 4.99994 4.99958 4.99999 4.99936 4.9839 4.99248 4.99717 5.01976
- 5.04869 5.0087 4.98143 4.98488 4.99199 4.99622 4.9983 4.99928
- 4.99971 4.99986 5.00031 5.00022 5.00035 5.0001 4.99884 4.99811
- 4.99803 4.99887 5.00078 5.00151 5.00116 5.00007 4.99843
- 4.99915 5.00107 5.00168 5.00141 5.00092 5.00055 5.0003 5.00016
- 5.0001 5.00001 5.00016 5.0002 5.00009 4.99993 4.99975 4.99984
- 4.99991 4.99991 4.99982 4.99974 4.99974 4.99985 4.99995
- 4.99999 4.99998 5.00004 5.00013 5.00015 5.00007 4.99988
- 4.99982 4.99985 4.99995 5.00006 5.0002 5.00025 5.0002 5.00009
- 5.00006 5.00004 5.00002 5 4.99998 4.99997 4.99998 4.99998
- 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999
- 4.99998 4.99998 4.99998
- EOD
-
- @v[12].set(<<-'EOD')
- 5 5.16975 4.78685 2.94241 0.126698 0.0487004 -0.00422591
- -0.00130689 -0.000486756 -0.000195875 -0.000108988 -6.66736e-05
- -7.26005e-05 -5.63608e-05 -3.81859e-05 -2.123e-05 -0.0646846
- -0.0184474 0.182248 1.06731 3.10988 4.46133 4.84133 4.95113
- 4.98364 4.99455 4.99694 4.99727 4.9994 4.99975 5.0001 5.00132
- 5.00089 5.00039 5.00019 5.00011 5.00006 5.00005 5.00004
- 5.00001 4.99992 4.99992 5.00002 5.00013 5.00017 5.00009
- 4.99992 4.99991 4.99994 4.99996 4.99998 4.99999 5.00001
- 5.00004 5.00006 5.00005 5.00004 5.00003 5.00002 5.00001
- 5 4.99999 4.99999 4.99998 4.99998 4.99997 4.99997 4.99998
- 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999
- 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 5 5.14699 4.78074
- 3.19424 0.305663 0.0611255 -0.00179951 -0.0012032 0.000405978
- 0.000989399 0.000445194 0.000191447 8.30476e-05 3.96236e-05
- 1.91866e-05 1.70665e-05 -0.0655239 -0.0210234 0.1827 1.06848
- 3.11554 4.46518 4.84212 4.94853 4.98244 4.99434 4.9997 5.00081
- 5.00009 4.99972 4.99985 4.99974 4.9995 4.99949 4.99958 4.99973
- 4.99948 4.99914 4.99874 4.99946 5.00309 5.0091 5.01576 5.01835
- 5.01852 5.0176 5.01625 5.01479 5.01345 5.01264 5.011 5.01092
- 5.01344 5.01363 5.01289 5.01184 5.01071 5.00956 5.00848
- 5.00751 5.00663 5.00577 5.00497 5.00427 5.00365 5.0031 5.00264
- 5.00224 5.00191 5.00163 5.00138 5.00117 5.00099 5.00083
- 5.00071 5.00061 5.00053 5.00045 5.00037 5.00029 5.00022
- 5.00019 5.0002 5.00023 5.00024 5.00023 5.00023 5.00022 5.0002
- 5.00018 5.00016 5.00014 5.00011 5.00009 5.00007 5.00006
- 5.00005 5.00005 5.00004 5.00003 5.00002 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00001 5.00001 5.00001 5.14298 4.79809 3.32704
- 0.498385 0.105773 0.0160646 0.0319912 0.0299434 0.0240102
- 0.0185844 0.0130411 0.0106532 0.00864871 0.00744519 0.00660887
- -0.0612913 -0.0203719 0.174998 0.991787 3.06292 4.60005
- 4.93058 4.98917 5.00033 4.9999 4.99909 4.9966 4.9955 4.99488
- 4.99374 4.9943 5.00131 5.00506 4.99311 4.96288 4.93567 4.92439
- 4.94236 4.9732 4.98864 4.99458 5.00031 5.00694 5.01525 5.01945
- 5.01998 5.01953 5.01874 5.01766 5.0164 5.01509 5.01326 5.01423
- 5.01455 5.01361 5.01245 5.01122 5.01002 5.00888 5.00783
- 5.00687 5.00596 5.00514 5.00442 5.00379 5.00325 5.00279
- 5.0024 5.00208 5.0018 5.00153 5.00126 5.00107 5.00094 5.00085
- 5.00078 5.00072 5.00063 5.00053 5.00042 5.00038 5.00034
- 5.0003 5.00027 5.00023 5.00021 5.00019 5.00017 5.00015 5.00013
- 5.00012 5.00011 5.0001 5.0001 5.00009 5.00008 5.00007 5.00007
- 5.00006 5.00005 5.00005 5.00004 5.00004 5.00003 5.00003
- 5.00002 5.00002 5.00002 5.00001 5.00001 5 5 5 5.00001 5.00001
- 5.00001 5.00002 5.00002 5.00002 5.00002
- EOD
-
- @v[13].set(<<-'EOD')
- 9.73784e-10 0.0189926 0.0926769 0.206309 0.111533 0.0953491
- 0.0426966 0.0214177 0.0117943 0.00741442 0.00528816 0.00398417
- 0.0032967 0.00266499 0.00206647 0.00158788 -0.0371391 -0.0439528
- -0.0408653 -0.0188706 0.0150241 0.0126852 0.00209817 -0.000239206
- -5.31488e-05 0.000876324 -0.00451221 -0.0165223 -0.0284127
- -0.0427584 -0.0502453 -0.0257366 -0.00903938 -0.00376456
- -0.00233385 -0.00169922 -0.00130397 -0.00102542 -0.000811435
- -0.000648115 -0.000529266 -0.00043795 -0.00036574 -0.00030716
- -0.00026221 -0.000229662 -0.000205112 -0.000181038 -0.000162045
- -0.000148988 -0.000137633 -0.000126278 -0.000115562 -0.000104976
- -9.49324e-05 -9.0585e-05 -8.62375e-05 -8.18901e-05 -7.75426e-05
- -7.31952e-05 -6.93752e-05 -6.59106e-05 -6.24461e-05 -5.89815e-05
- -5.55169e-05 -5.22412e-05 -5.05263e-05 -4.88114e-05 -4.70966e-05
- -4.53817e-05 -4.36668e-05 -4.19519e-05 -4.0237e-05 -3.85222e-05
- -3.68073e-05 -3.50924e-05 -3.34782e-05 -3.25442e-05 -3.16102e-05
- -3.06763e-05 -2.97423e-05 -2.88083e-05 -2.78744e-05 -2.69404e-05
- -2.60064e-05 -2.50725e-05 -2.41385e-05 -2.32635e-05 -2.27232e-05
- -2.21829e-05 -2.16426e-05 -2.11023e-05 -2.0562e-05 -2.00217e-05
- -1.94814e-05 -1.89411e-05 -1.84007e-05 -1.78604e-05 -1.73647e-05
- -1.70853e-05 -1.68059e-05 -1.65265e-05 -1.62471e-05 -1.59677e-05
- -1.56883e-05 -1.54089e-05 -1.51295e-05 -1.48501e-05 -1.45707e-05
- -1.42913e-05 -1.40119e-05 -1.37325e-05 -1.34531e-05 -1.31737e-05
- -1.28943e-05 -1.26149e-05 -1.23355e-05 -1.20561e-05 -1.17767e-05
- -1.14973e-05 -1.10954e-05 0.0152675 0.0228237 -0.00460678
- -0.0341525 0.0232109 -0.0138039 -0.0416538 -0.0458764 -0.0201967
- -0.00878316 -0.00379173 -0.00164621 -0.000785131 -0.00037575
- -0.000352375 -0.0545586 -0.0746881 -0.0771865 -0.05386 -0.0022199
- 0.0136703 0.00633526 0.00138826 -0.00108934 0.0038886 0.0298077
- 0.0475776 0.0481003 0.0464167 0.047818 0.042789 0.035207
- 0.0264423 0.0193959 0.0151614 0.00624257 -0.00913057 -0.0310696
- -0.0430238 0.016426 0.189762 0.49025 0.820116 1.13919 1.43549
- 1.70658 1.95183 2.17414 2.38506 2.5657 2.73958 2.97905 3.21403
- 3.43025 3.62645 3.8028 3.96002 4.09996 4.22443 4.33427 4.42886
- 4.51097 4.5817 4.64326 4.6957 4.74132 4.7797 4.81298 4.84102
- 4.86512 4.88523 4.90224 4.91649 4.92846 4.93868 4.94755
- 4.95483 4.96114 4.96682 4.97161 4.97502 4.9776 4.97944 4.98141
- 4.98319 4.98467 4.98585 4.9869 4.98796 4.98902 4.99008 4.99114
- 4.9922 4.99326 4.9938 4.99429 4.99479 4.99528 4.99578 4.99628
- 4.99677 4.99704 4.99718 4.99733 4.99747 4.99762 4.99777
- 4.99791 4.99806 4.9982 4.99835 4.9985 4.99864 4.99879 4.99893
- 4.99907 4.99916 4.99925 4.99934 4.99943 5.01473 4.92293
- 4.61974 4.0316 3.7835 3.74195 3.78344 3.87272 3.97386 4.07319
- 4.16686 4.25256 4.33126 4.40264 4.46697 4.49249 4.51807
- 4.55803 4.64055 4.78574 4.86074 4.88334 4.8999 4.91455 4.92814
- 4.93926 4.94761 4.95433 4.95907 4.9654 4.98317 5.0208 5.05134
- 4.85852 4.16041 3.00077 1.68376 0.672707 0.240838 0.0794725
- -0.0106347 -0.00879443 0.107196 0.368163 0.701424 1.03581
- 1.3601 1.6678 1.95731 2.22701 2.47544 2.69099 2.92327 3.16648
- 3.3877 3.59067 3.77344 3.93584 4.08066 4.20863 4.32065 4.41791
- 4.50211 4.57423 4.63614 4.68888 4.73377 4.7721 4.80519 4.83338
- 4.85732 4.87815 4.89514 4.90927 4.92108 4.93122 4.94014
- 4.94845 4.95601 4.96251 4.96576 4.969 4.97225 4.9755 4.97874
- 4.98087 4.98265 4.98442 4.9862 4.98797 4.98924 4.9899 4.99055
- 4.9912 4.99186 4.99251 4.99316 4.99381 4.99447 4.99512 4.99577
- 4.99609 4.99634 4.99659 4.99683 4.99708 4.99732 4.99757
- 4.99782 4.99806 4.99831 4.99853 4.99863 4.99873 4.99883
- 4.99893 4.99903 4.99913 4.99923 4.99933
- EOD
-
- @v[14].set(<<-'EOD')
- 1.86175 2.00147 1.85141 1.0654 0.275481 0.205547 0.0712627
- 0.0313387 0.0151431 0.00864531 0.00593861 0.00438111 0.0037479
- 0.00305857 0.00221221 0.0017081 -0.0896128 -0.109079 -0.121356
- -0.0542001 0.175821 0.177442 0.0814591 0.0333042 0.0134909
- 0.00625777 0.00100092 -0.00552776 -0.00411139 -0.00150395
- -0.000564784 3.48169e-05 -0.000287014 -0.000538515 -0.000456537
- -0.000325677 -0.000275468 -0.000166452 -8.27481e-05 -8.28704e-05
- -7.47644e-05 -4.60552e-05 -2.61481e-06 2.26359e-05 2.53852e-05
- -1.39853e-06 -4.23456e-05 -4.0907e-05 -2.8501e-05 -1.5945e-05
- -9.01122e-06 -2.07747e-06 1.49328e-06 4.38398e-06 6.84248e-06
- 4.76711e-06 2.69173e-06 6.16362e-07 -1.45901e-06 -3.53438e-06
- -4.14256e-06 -3.76238e-06 -3.3822e-06 -3.00202e-06 -2.62184e-06
- -2.24878e-06 -1.93456e-06 -1.62033e-06 -1.3061e-06 -9.91867e-07
- -6.77638e-07 -3.63409e-07 -4.91792e-08 2.6505e-07 5.7928e-07
- 8.93509e-07 1.16076e-06 1.11055e-06 1.06034e-06 1.01014e-06
- 9.59927e-07 9.09719e-07 8.59511e-07 8.09302e-07 7.59094e-07
- 7.08886e-07 6.58678e-07 5.99251e-07 4.87523e-07 3.75795e-07
- 2.64068e-07 1.5234e-07 4.06119e-08 -7.1116e-08 -1.82844e-07
- -2.94572e-07 -4.063e-07 -5.18027e-07 -6.08517e-07 -5.95879e-07
- -5.83241e-07 -5.70604e-07 -5.57966e-07 -5.45328e-07 -5.3269e-07
- -5.20053e-07 -5.07415e-07 -4.94777e-07 -4.8214e-07 -4.69502e-07
- -4.56864e-07 -4.44226e-07 -4.31589e-07 -4.18951e-07 -4.06313e-07
- -3.93676e-07 -3.81038e-07 -3.684e-07 -3.55762e-07 -3.43125e-07
- 1.06736e-05 0.0797407 0.0437947 -0.0645098 -0.0877312 0.0653203
- -0.00621184 -0.0353188 -0.0491378 -0.0251957 -0.0110996
- -0.00481123 -0.0020941 -0.000998038 -0.000478747 -0.000445332
- -0.102046 -0.135753 -0.154351 -0.0827509 0.163348 0.174012
- 0.0794822 0.0310624 0.0112213 0.00249061 0.00130764 0.00181315
- 0.00163875 0.00101454 0.000497435 0.000195258 5.31901e-05
- 2.4607e-05 6.62736e-05 7.90718e-05 4.0372e-05 -0.000141184
- -0.000280623 5.5608e-05 0.000799565 0.000920189 0.000931616
- 0.000494527 0.000162303 -8.24884e-05 -0.000183938 -0.000203899
- -0.000144788 -9.87063e-05 -0.000227929 2.93932e-05 0.000208563
- 1.88958e-06 -7.6335e-05 -0.000172472 -0.000165656 -0.000145889
- -0.000177311 -0.000191058 -0.000168287 -0.00015755 -0.00013142
- -8.10488e-05 -6.36115e-05 -7.8699e-05 -8.11282e-05 -7.98625e-05
- -5.98807e-05 -3.40879e-05 -1.95464e-05 -1.79247e-05 -4.45514e-05
- -7.47995e-05 -8.7682e-05 -7.50806e-05 -3.25561e-05 -4.34114e-05
- -7.69099e-05 -0.000141101 -0.00018743 -0.000148471 -5.06546e-05
- 0.000120195 0.000177635 0.000177052 0.000146344 9.75126e-05
- 8.31233e-05 6.8734e-05 5.43447e-05 3.99554e-05 2.55661e-05
- 1.11768e-05 -3.21253e-06 -3.88937e-06 -3.56628e-06 -3.24318e-06
- -2.92008e-06 -2.59699e-06 -2.27389e-06 -1.9508e-06 -1.73227e-06
- -1.56796e-06 -1.40365e-06 -1.23934e-06 -1.07503e-06 -9.10722e-07
- -7.46412e-07 -5.82101e-07 -4.1779e-07 -2.5348e-07 -8.91694e-08
- 7.51412e-08 2.39452e-07 4.03762e-07 5.95733e-07 1.00771e-06
- 1.41969e-06 1.83167e-06 2.24365e-06 0.0828257 0.231038 0.465438
- 1.54516 2.8461 3.19221 3.40395 3.6382 3.80758 3.93848 4.04882
- 4.15428 4.247 4.32917 4.40235 4.36941 4.397 4.48862 4.64552
- 4.86595 5.03475 5.0348 5.02627 5.01967 5.01542 5.00925 4.98613
- 4.9519 4.91581 4.87357 4.82302 4.80403 4.82565 4.86102 4.89483
- 4.92253 4.94428 4.96257 4.97608 4.98373 4.98823 4.99182
- 4.99437 4.99635 4.99745 4.99802 4.99843 4.99873 4.99895
- 4.99912 4.99925 4.99931 4.99962 4.99973 4.99972 4.99971
- 4.9997 4.99969 4.9997 4.99971 4.99973 4.99974 4.99976 4.99978
- 4.9998 4.99982 4.99985 4.99987 4.99989 4.9999 4.99991 4.99991
- 4.99993 4.99994 4.99997 5.00001 5.00006 5.00008 5.00006
- 5.00002 5 4.99999 4.99998 4.99997 4.99995 4.99995 4.99995
- 4.99995 4.99995 4.99995 4.99995 4.99996 4.99997 4.99997
- 4.99998 4.99999 5 5 5.00001 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001
- 5.00001 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999
- EOD
-
- @v[15].set(<<-'EOD')
- 1.86175 2.00199 2.08919 1.84314 1.08254 0.214737 0.0377351
- 0.00952455 0.00232763 0.000563614 0.000263477 0.000148642
- 0.000285086 0.000242592 7.34699e-05 -1.53467e-05 -0.0161874
- -0.0157876 -0.0141194 0.0132576 0.0903272 0.109938 0.0535295
- 0.0224216 0.00940945 0.00466825 -0.000649972 -0.00654752
- -0.00333248 -0.00103671 -0.000508276 -5.8896e-05 -0.00043938
- -0.000544704 -0.00044444 -0.000307093 -0.00024517 -0.000154538
- -8.78602e-05 -7.10461e-05 -6.06485e-05 -3.91039e-05 -8.45988e-06
- 9.43442e-06 1.28351e-05 -2.16734e-06 -2.6142e-05 -2.54768e-05
- -1.88997e-05 -1.17906e-05 -7.3808e-06 -2.97101e-06 1.19146e-07
- 2.94246e-06 5.38942e-06 3.88851e-06 2.38761e-06 8.86704e-07
- -6.14201e-07 -2.11511e-06 -2.59565e-06 -2.38885e-06 -2.18205e-06
- -1.97525e-06 -1.76845e-06 -1.56241e-06 -1.36258e-06 -1.16276e-06
- -9.62939e-07 -7.63116e-07 -5.63293e-07 -3.6347e-07 -1.63647e-07
- 3.61756e-08 2.35999e-07 4.35822e-07 6.07653e-07 5.90323e-07
- 5.72994e-07 5.55665e-07 5.38336e-07 5.21007e-07 5.03678e-07
- 4.86349e-07 4.6902e-07 4.51691e-07 4.34361e-07 4.11899e-07
- 3.60315e-07 3.08731e-07 2.57146e-07 2.05562e-07 1.53977e-07
- 1.02393e-07 5.08082e-08 -7.76222e-10 -5.23607e-08 -1.03945e-07
- -1.47815e-07 -1.54225e-07 -1.60635e-07 -1.67045e-07 -1.73455e-07
- -1.79864e-07 -1.86274e-07 -1.92684e-07 -1.99094e-07 -2.05504e-07
- -2.11914e-07 -2.18324e-07 -2.24734e-07 -2.31144e-07 -2.37554e-07
- -2.43964e-07 -2.50373e-07 -2.56783e-07 -2.63193e-07 -2.69603e-07
- -2.76013e-07 -2.82423e-07 2.92534e-06 0.0446777 0.024278
- -0.0518987 -0.0636547 0.00983929 -0.000518204 -0.000265194
- 0.000154772 0.000299538 3.12715e-05 -3.18225e-05 -2.48268e-05
- -1.16701e-05 -6.05117e-06 7.61116e-06 -0.0163668 -0.0158244
- -0.0141177 0.0100085 0.0857144 0.107784 0.051862 0.0204448
- 0.00629858 0.000967736 0.00121674 0.00190276 0.00154009
- 0.000860922 0.000410386 0.000164585 3.99493e-05 1.93797e-05
- 5.67594e-05 0.000110126 2.49925e-05 -7.17815e-05 -0.000142299
- -1.63109e-05 0.000439529 0.000562489 0.000594599 0.000326164
- 0.000126423 -4.26063e-05 -0.000122927 -0.000114152 -6.72706e-05
- -6.41242e-05 -0.000135588 2.61507e-05 0.000134036 6.43734e-06
- -4.6223e-05 -0.000112047 -0.000101388 -8.67847e-05 -0.000117664
- -0.000133957 -0.000116558 -0.000100873 -7.65448e-05 -4.44964e-05
- -3.6677e-05 -5.26632e-05 -5.45172e-05 -5.13545e-05 -3.73869e-05
- -1.99732e-05 -1.0907e-05 -1.10081e-05 -3.02609e-05 -5.18517e-05
- -6.13597e-05 -5.30706e-05 -2.39572e-05 -3.24146e-05 -5.70062e-05
- -0.000103448 -0.000135376 -0.0001024 -2.39007e-05 0.000110929
- 0.000151226 0.000142044 0.000105922 5.62834e-05 4.78476e-05
- 3.94117e-05 3.09759e-05 2.25401e-05 1.41042e-05 5.66837e-06
- -2.76747e-06 -3.08639e-06 -2.81341e-06 -2.54043e-06 -2.26745e-06
- -1.99447e-06 -1.72149e-06 -1.44851e-06 -1.26226e-06 -1.12096e-06
- -9.79661e-07 -8.38363e-07 -6.97065e-07 -5.55768e-07 -4.1447e-07
- -2.73173e-07 -1.31875e-07 9.42259e-09 1.5072e-07 2.92018e-07
- 4.33315e-07 5.74613e-07 7.10363e-07 8.01984e-07 8.93604e-07
- 9.85225e-07 1.07685e-06 0.04474 0.0928765 0.141327 0.0176048
- -0.071675 -0.0124613 0.989022 2.28104 3.40619 4.21417 4.67173
- 4.87438 4.96044 4.98996 4.99858 4.96672 4.89502 4.79391
- 4.76433 4.8387 4.98612 5.0161 5.01722 5.01437 5.01256 4.99827
- 4.95807 4.9209 4.88217 4.83006 4.78461 4.80759 4.85548 4.89604
- 4.9254 4.94617 4.96126 4.97374 4.98255 4.98792 4.99126 4.99361
- 4.99554 4.99699 4.99792 4.99846 4.99881 4.99905 4.99924
- 4.99938 4.99949 4.99955 4.9997 4.9998 4.99982 4.99982 4.99982
- 4.99982 4.99982 4.99983 4.99984 4.99985 4.99986 4.99987
- 4.99988 4.99989 4.9999 4.99992 4.99993 4.99994 4.99995 4.99995
- 4.99996 4.99996 4.99998 4.99999 5.00001 5.00002 5.00002
- 5.00001 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99998
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- EOD
-
- @v[16].set(<<-'EOD')
- 1.86175 1.73073 1.50572 1.89001 3.39004 4.36034 4.79012
- 4.93798 4.98305 4.99539 4.9979 4.99904 4.99772 4.9983 4.99935
- 4.99975 4.98837 4.99456 4.99728 5.01838 5.04568 5.00759
- 4.98112 4.98479 4.99197 4.99641 4.99747 4.99775 5.00043
- 5.0007 5.00035 5.00023 4.99976 5.00002 5.00007 5.0002 4.99993
- 5.00003 5.00021 5.00006 4.99993 4.99992 5.00002 5.00013
- 5.00017 5.00009 4.99992 4.99991 4.99993 4.99996 4.99998
- 4.99999 5.00001 5.00003 5.00005 5.00004 5.00004 5.00003
- 5.00002 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99997
- 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999
- 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 5 5.01498 4.99342 4.96899 5.00301 5.02627 4.9977
- 4.99548 4.99757 5.00277 5.00245 5.0014 5.00069 5.00032 5.00014
- 5.00009 4.9867 4.99262 4.99607 5.01805 5.04713 5.00927 4.98184
- 4.98483 4.9914 4.99616 4.99902 4.9999 4.99987 4.99979 4.99981
- 4.99989 4.99994 4.99998 5.0002 5.00001 5.00008 5.00008 5.0001
- 5.00021 5.00032 5.00025 5.00019 5.00006 5.00007 4.99994
- 4.99997 4.99999 5.00023 5.00008 4.99993 4.99998 4.99986
- 4.99982 5.00003 4.99985 4.99996 5.00014 5 4.99984 4.99979
- 4.99982 4.99993 5.00008 5.00011 5.00002 4.99996 4.9999 4.99994
- 5.00001 5.00007 5.00009 4.99995 4.99978 4.99971 4.99976
- 4.99997 4.99996 4.99989 4.99972 4.99955 4.99953 4.99959
- 4.99976 4.9999 5.00005 5.00023 5.00039 5.00034 5.00029 5.00024
- 5.00019 5.00014 5.00009 5.00004 5.00003 5.00002 5.00001
- 5 5 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5
- 5.00001 5.00002 5.00003 5.00004 5.01564 5.03395 5.04932
- 5.11868 3.92502 1.31888 0.163888 0.0946876 0.0789578 0.0565084
- 0.0260333 0.0156986 0.00907667 0.00613629 0.00468417 -0.00174008
- -0.0021422 0.000586962 0.0124937 0.0147977 0.00838454 0.00039383
- -0.000522021 -0.000426598 -0.000290214 -0.00173713 -0.00384132
- -0.00382945 -0.00429219 -0.00580193 -0.00393246 0.0017543
- 0.00423045 0.00408931 0.0031976 0.00245457 0.00187293 0.00159068
- 0.00105697 0.000609902 0.000358825 0.000334125 0.000212708
- 0.000168116 8.97349e-05 5.21578e-05 3.84527e-05 2.93033e-05
- 2.10067e-05 1.59954e-05 1.13917e-05 5.49738e-06 2.77217e-05
- 6.51259e-06 -6.65468e-06 2.09837e-06 -6.617e-06 -4.80187e-06
- 1.55031e-06 4.26536e-06 7.69457e-07 -1.46213e-06 -7.25202e-07
- 3.26501e-06 6.55807e-06 7.524e-06 6.07209e-06 6.00701e-06
- 5.41166e-06 3.86573e-06 1.10651e-06 -2.74603e-06 -2.18566e-06
- 2.3658e-06 8.59956e-06 8.35046e-06 2.90621e-06 -8.75982e-07
- -1.87189e-06 -2.1528e-06 -1.94875e-06 -1.74471e-06 -1.54067e-06
- -1.33662e-06 -1.13258e-06 -8.40567e-07 -5.20743e-07 -2.00918e-07
- 1.18906e-07 4.38731e-07 6.11382e-07 6.01529e-07 5.91675e-07
- 5.81822e-07 5.71968e-07 5.62115e-07 5.52261e-07 5.42407e-07
- 5.32554e-07 5.227e-07 5.12847e-07 4.72812e-07 4.26137e-07
- 3.79462e-07 3.32786e-07 2.86111e-07 2.39436e-07 1.92761e-07
- 1.46086e-07 9.94107e-08 5.27356e-08 -2.77779e-10 -7.98079e-08
- -1.59338e-07 -2.38868e-07 -3.18398e-07 -3.97928e-07 -4.77458e-07
- -5.56988e-07 -6.36519e-07
- EOD
-
- @v[17].set(<<-'EOD')
- 5 5.16963 4.84136 3.33754 0.316206 0.103113 0.0273341 0.0221102
- 0.0177008 0.0143758 0.0115203 0.00929231 0.00752716 0.00625439
- 0.00489872 0.00403656 -0.0657317 -0.0256467 0.165394 0.985963
- 3.05067 4.55799 4.89728 4.92464 4.8882 4.90592 4.97315 4.99241
- 4.99694 4.99845 4.99905 4.99939 4.99959 4.99971 4.9998 4.99986
- 4.9999 4.99993 4.99995 4.99996 4.99997 4.99998 4.99998 4.99999
- 4.99999 4.99999 4.99999 4.99999 5 5.00001 5.00003 5.00005
- 5.00004 5.00002 5 4.99999 4.99999 4.99998 4.99998 4.99997
- 4.99997 4.99998 4.99998 4.99999 4.99999 5 5 5 5 5 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5
- 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998
- 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 5 5 5 5 5 5 5.00025 5.1657 4.69981 2.43895
- 0.0229743 0.0351406 -0.0211974 -0.0312063 -0.0160331 -0.0021718
- -0.000766597 -0.000251052 -5.49363e-05 -3.36364e-06 -2.01983e-06
- -9.70575e-06 -0.0657007 -0.0205247 0.183332 1.07163 3.11839
- 4.46213 4.84163 4.95195 4.99159 5.02084 5.04029 5.04138
- 5.0271 5.00445 4.97957 4.95702 4.95231 4.97819 4.99191 4.9963
- 4.99822 4.99878 4.99903 4.99925 4.99942 4.9995 4.99954 4.99957
- 4.99961 4.99966 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986
- 4.99988 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 4.99996
- 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001
- 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.14239 4.76219
- 3.16574 0.299969 0.0631609 -0.00118611 -0.00026052 -5.96333e-05
- -1.44904e-05 -4.3859e-06 -2.99454e-06 1.10547e-06 4.84662e-06
- 1.30971e-05 2.23082e-05 -0.0655844 -0.0204818 0.182507 1.05954
- 3.12277 4.46735 4.83915 4.94512 4.97679 4.98654 4.9966 5.00833
- 5.00776 5.00432 5.00199 5.00086 5.00033 5.00008 5 5.00001
- 5 5.00005 5.00002 4.99981 4.99991 4.99998 4.99979 4.99979
- 4.99984 4.9998 4.9998 5.00006 5.00002 5.00001 5 5 4.99992
- 4.99998 4.99999 5.00002 5.00014 4.99999 4.99987 4.99993
- 5.00003 5.00011 5.00005 4.99996 4.99987 4.99985 4.99994
- 5.00009 5.0001 5 4.99993 4.99997 5.00008 5.00015 5.00021
- 5.00021 5.00007 4.99978 4.99965 4.99973 4.9999 4.99992 4.99995
- 4.99997 4.99999 5.00001 5.00002 5.00001 5.00001 5.00001
- 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 5.00002
- 5.00002 5.00002
- EOD
-
- @v[18].set(<<-'EOD')
- 5 5.0333 5.02472 4.92559 4.18383 3.93923 3.9961 4.14293
- 4.28591 4.41336 4.52157 4.61101 4.68472 4.7439 4.79294 4.83239
- 4.80697 4.78808 4.79322 4.8838 5.08529 5.21863 4.88852 3.90198
- 2.14586 0.383977 0.101103 0.0525711 0.0318287 0.020895 0.0146908
- 0.010831 0.00830272 0.00656377 0.00532066 0.00440078 0.00369956
- 0.00315713 0.00272614 0.00237965 0.00209659 0.00186339 0.00167014
- 0.0015081 0.00137172 0.00125607 0.00115393 0.00106076 0.000980166
- 0.000918015 0.000862837 0.00080766 0.000763488 0.000721541
- 0.000680825 0.000653026 0.000625226 0.000597426 0.000569627
- 0.000541827 0.000519087 0.000499756 0.000480424 0.000461093
- 0.000441761 0.000423291 0.000411941 0.00040059 0.00038924
- 0.000377889 0.000366539 0.000355188 0.000343838 0.000332487
- 0.000321137 0.000309786 0.000299055 0.000292509 0.000285963
- 0.000279417 0.000272871 0.000266325 0.000259779 0.000253233
- 0.000246686 0.00024014 0.000233594 0.000227387 0.0002231
- 0.000218813 0.000214526 0.00021024 0.000205953 0.000201666
- 0.000197379 0.000193092 0.000188805 0.000184519 0.000180526
- 0.000177963 0.0001754 0.000172837 0.000170274 0.000167711
- 0.000165148 0.000162585 0.000160022 0.000157459 0.000154895
- 0.000152332 0.000149769 0.000147206 0.000144643 0.00014208
- 0.000139517 0.000136954 0.000134391 0.000131828 0.000129265
- 0.000126702 0.000132838 0.0311184 0.163151 0.34986 0.604501
- 0.357125 0.136137 0.0711304 0.0346959 0.0212674 0.00872193
- 0.00252206 0.000455269 7.59332e-05 2.91532e-05 0.000320562
- -0.0720911 -0.0840491 -0.0791345 -0.0404143 0.0182035 -0.0235871
- -0.0426072 -0.0597501 0.00824773 0.481404 1.32496 2.11949
- 2.57317 2.58202 2.15054 1.33786 0.45702 0.153772 0.0913584
- 0.0604989 0.0421591 0.0271456 0.0170021 0.0115815 0.00907886
- 0.00742466 0.00626096 0.00531127 0.00450501 0.00381927 0.00323718
- 0.00274374 0.00232494 0.00196885 0.00166686 0.00141134 0.00119437
- 0.0010109 0.000855534 0.000723378 0.000611408 0.000516704
- 0.000436769 0.000369523 0.000313026 0.00026526 0.000223976
- 0.000188972 0.000159042 0.000134148 0.000112688 9.49738e-05
- 7.97877e-05 6.721e-05 5.65115e-05 4.77194e-05 4.03591e-05
- 3.42848e-05 2.92627e-05 2.50435e-05 2.1412e-05 1.84532e-05
- 1.58624e-05 1.34673e-05 1.14461e-05 1.00935e-05 9.12375e-06
- 8.50202e-06 7.81431e-06 7.20729e-06 6.73936e-06 6.3702e-06
- 5.90049e-06 5.43077e-06 4.96105e-06 4.49133e-06 4.02162e-06
- 3.5519e-06 3.08218e-06 2.79099e-06 2.51281e-06 2.23463e-06
- 1.95645e-06 1.67827e-06 1.40009e-06 1.12191e-06 1.01376e-06
- 9.9375e-07 9.73741e-07 9.53733e-07 9.33724e-07 9.13715e-07
- 8.93707e-07 8.73698e-07 8.5369e-07 8.33681e-07 8.13673e-07
- 7.93664e-07 7.73655e-07 7.53647e-07 7.21781e-07 5.956e-07
- 4.69419e-07 3.43239e-07 2.17058e-07 0.0284032 0.0374438
- -0.0157543 -0.0680497 0.0504768 0.0100294 0.00222261 0.000528697
- 0.000132929 3.99489e-05 2.46066e-05 4.56327e-06 -6.54853e-06
- 1.33783e-05 -3.68221e-05 -0.0724498 -0.0843663 -0.0792935
- -0.0406426 0.0200019 0.0426259 0.0220753 0.00668555 -0.000968483
- 0.024662 0.0383437 0.0911513 0.087848 0.0602076 0.0390559
- 0.0260573 0.0180444 0.012974 0.00985409 0.00788132 0.0064228
- 0.005545 0.00453571 0.00364245 0.00310278 0.00270523 0.00236439
- 0.0020945 0.00186808 0.00167493 0.00151731 0.00138594 0.00126945
- 0.00116695 0.0010762 0.000996366 0.000928387 0.000864414
- 0.000808258 0.000759574 0.000713865 0.000666712 0.000632716
- 0.000601262 0.000572163 0.000543986 0.000515253 0.0004897
- 0.000468112 0.000449313 0.000432981 0.000417911 0.000401307
- 0.000382712 0.000366678 0.000355736 0.000349171 0.000335727
- 0.000317091 0.000296086 0.000283543 0.000277366 0.000272233
- 0.000267001 0.000263147 0.000256699 0.000250251 0.000243803
- 0.000237355 0.000230907 0.000225424 0.000220247 0.000215069
- 0.000209892 0.000204714 0.000200213 0.000196548 0.000192884
- 0.00018922 0.000185556 0.000181892 0.000178228 0.000174564
- 0.0001709 0.000167236 0.000163572 0.000160824 0.000158279
- 0.000155733 0.000153187 0.000150641 0.000148095 0.000145549
- 0.000143003 0.000140457 0.000137911 0.000135457 0.000133386
- 0.000131315 0.000129245 0.000127174 0.000125103 0.000123032
- 0.000120961 0.000118891
- EOD
-
- @v[19].set(<<-'EOD')
- 1.86175 1.99994 2.0833 2.01627 2.42503 3.25769 3.62134 3.88827
- 4.09688 4.26773 4.40529 4.51734 4.60827 4.68313 4.74346
- 4.79302 4.72815 4.68959 4.70421 4.81316 5.01375 5.14493
- 5.10305 5.0699 5.04484 5.03751 5.03348 5.02504 5.01799 5.01271
- 5.00895 5.00628 5.0044 5.00309 5.00216 5.00151 5.00105 5.00073
- 5.00051 5.00034 5.00023 5.00015 5.0001 5.00007 5.00003 4.99998
- 4.99993 4.99993 4.99995 4.99999 5.00001 5.00003 5.00002
- 5.00001 5 5 5 5 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00017 5.17398
- 4.94779 3.78508 1.52302 0.608808 0.244311 0.126053 0.0597175
- 0.038422 0.0158174 0.00481338 0.00107847 0.000301256 0.000114861
- 0.00059489 -0.118904 -0.147478 -0.158986 -0.080544 0.165361
- 0.171378 0.0776087 0.0435738 0.0428235 0.0423755 0.0347695
- 0.0225061 0.0155539 0.0121357 0.0107997 0.0103976 0.0124406
- 0.016814 0.0167556 0.0149852 0.01459 0.0141182 0.0131934
- 0.0120286 0.0108692 0.0097184 0.00855881 0.00744912 0.00643877
- 0.00554044 0.00475165 0.00406535 0.00347158 0.00295981 0.00251995
- 0.00214318 0.00182101 0.00154613 0.00131196 0.0011119 0.000941587
- 0.000796999 0.000674582 0.000571283 0.000484276 0.000410649
- 0.000347005 0.000292984 0.000246715 0.000208143 0.00017489
- 0.000147412 0.000123854 0.000104332 8.77229e-05 7.40686e-05
- 6.2637e-05 5.32e-05 4.53946e-05 3.88343e-05 3.31864e-05
- 2.85905e-05 2.45725e-05 2.08671e-05 1.77301e-05 1.55911e-05
- 1.40153e-05 1.29421e-05 1.18693e-05 1.09815e-05 1.03484e-05
- 9.87664e-06 9.14446e-06 8.41228e-06 7.68011e-06 6.94793e-06
- 6.21575e-06 5.48357e-06 4.7514e-06 4.38454e-06 4.04432e-06
- 3.7041e-06 3.36388e-06 3.02366e-06 2.68344e-06 2.34322e-06
- 2.15196e-06 2.03791e-06 1.92386e-06 1.80982e-06 1.69577e-06
- 1.58173e-06 1.46768e-06 1.35363e-06 1.23959e-06 1.12554e-06
- 1.0115e-06 8.9745e-07 7.83404e-07 6.69358e-07 4.76113e-07
- -3.47071e-07 -1.17025e-06 -1.99344e-06 -2.81662e-06 0.0783754
- 0.0500262 -0.0659563 -0.120914 0.0815957 0.0154255 0.00347177
- 0.000840357 0.000214582 6.54655e-05 3.91709e-05 8.07396e-06
- -4.44265e-07 1.74384e-05 -4.52725e-05 -0.119379 -0.147984
- -0.159247 -0.0824604 0.169014 0.177628 0.0758742 0.010558
- -0.0346506 -0.0710288 -0.0838952 -0.0599521 -0.034568 -0.0181615
- -0.00968034 -0.00547115 -0.00333511 -0.00232468 -0.00181159
- -0.00143841 -0.00116601 -0.000839755 -0.000569764 -0.000578683
- -0.000490551 -0.000411712 -0.000437859 -0.000408185 -0.000356644
- -0.000311332 -0.000269006 -0.000221396 -0.000210054 -0.0001923
- -0.000175122 -0.000161039 -0.0001428 -0.000126123 -0.000127893
- -8.14516e-05 -0.000120166 -0.000154909 -0.000112733 -8.40377e-05
- -7.11342e-05 -8.09538e-05 -9.77789e-05 -9.82402e-05 -7.73531e-05
- -5.28255e-05 -3.1096e-05 -1.87967e-05 -1.96552e-05 -4.16655e-05
- -5.77185e-05 -5.24142e-05 -2.83153e-05 -1.90012e-05 -1.54415e-05
- -2.52569e-05 -6.23747e-05 -0.000130543 -0.000149394 -0.000110886
- -4.35517e-05 -4.17084e-05 -3.98651e-05 -3.80218e-05 -3.61785e-05
- -3.43352e-05 -3.36249e-05 -3.32729e-05 -3.29208e-05 -3.25687e-05
- -3.22166e-05 -3.17143e-05 -3.10258e-05 -3.03372e-05 -2.96486e-05
- -2.89601e-05 -2.82715e-05 -2.75829e-05 -2.68944e-05 -2.62058e-05
- -2.55173e-05 -2.48287e-05 -2.43043e-05 -2.38159e-05 -2.33276e-05
- -2.28393e-05 -2.2351e-05 -2.18626e-05 -2.13743e-05 -2.0886e-05
- -2.03977e-05 -1.99093e-05 -1.945e-05 -1.91122e-05 -1.87744e-05
- -1.84366e-05 -1.80987e-05 -1.77609e-05 -1.74231e-05 -1.70853e-05
- -1.67474e-05
- EOD
-
- @v[20].set(<<-'EOD')
- 1.86175 1.99724 2.17266 2.48439 3.15933 3.85231 4.38091
- 4.69033 4.85034 4.92851 4.96453 4.98188 4.98736 4.991 4.99482
- 4.9973 4.96422 4.89989 4.83907 4.83151 4.90868 5.04854 5.06104
- 5.04571 5.03219 5.03025 5.02273 5.01707 5.0123 5.0087 5.00611
- 5.00429 5.00301 5.00211 5.00148 5.00103 5.00072 5.0005 5.00035
- 5.00024 5.00016 5.00011 5.00007 5.00005 5.00003 5.00001
- 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999
- 5 5 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5
- 5 5 4.99981 5.10081 5.10903 4.98404 5.00999 5.14946 4.36501
- 2.23938 0.325144 0.00660272 -0.0102186 -0.0082401 -0.00556785
- -0.00374178 -0.00264763 -0.00202823 -0.0182241 -0.0169551
- -0.0150395 0.0103736 0.0877592 0.104382 0.0515938 0.0373818
- 0.0411547 0.0397009 0.0308946 0.0205793 0.0154037 0.0129191
- 0.0119327 0.011527 0.0124295 0.0161152 0.0161076 0.0145391
- 0.0144541 0.0139287 0.0129215 0.0117239 0.0105795 0.00942983
- 0.00827423 0.00718354 0.00619954 0.00532868 0.00456631 0.00390448
- 0.00333254 0.00284003 0.00241714 0.00205524 0.0017458 0.00148202
- 0.00125739 0.0010655 0.000902213 0.000763611 0.000646279
- 0.000547291 0.000463934 0.000393401 0.000332424 0.000280655
- 0.000236328 0.000199386 0.000167536 0.000141218 0.000118654
- 9.99559e-05 8.40479e-05 7.09694e-05 6.00188e-05 5.09786e-05
- 4.3502e-05 3.72191e-05 3.18114e-05 2.74071e-05 2.35539e-05
- 1.99967e-05 1.69871e-05 1.49449e-05 1.3451e-05 1.24492e-05
- 1.14256e-05 1.05669e-05 9.94487e-06 9.47514e-06 8.77318e-06
- 8.07123e-06 7.36927e-06 6.66731e-06 5.96536e-06 5.2634e-06
- 4.56144e-06 4.23044e-06 3.92649e-06 3.62254e-06 3.31858e-06
- 3.01463e-06 2.71068e-06 2.40673e-06 2.23063e-06 2.12082e-06
- 2.01102e-06 1.90121e-06 1.7914e-06 1.68159e-06 1.57178e-06
- 1.46197e-06 1.35216e-06 1.24235e-06 1.13255e-06 1.02274e-06
- 9.12929e-07 8.0312e-07 6.33171e-07 -1.51288e-08 -6.63428e-07
- -1.31173e-06 -1.96003e-06 0.0437517 0.0265689 -0.0515377
- -0.0658688 0.010727 -0.000511921 -8.36924e-05 2.13278e-05
- 1.45207e-05 4.54862e-06 -6.14726e-06 2.0062e-06 1.02709e-06
- 1.4152e-05 -3.08225e-05 -0.0166501 -0.0157139 -0.013957
- 0.0107537 0.0873717 0.111302 0.0454129 -0.00530142 -0.0468336
- -0.0790063 -0.0826944 -0.0534753 -0.0288705 -0.0149009 -0.00801592
- -0.0046342 -0.00291835 -0.00213019 -0.00170055 -0.001352
- -0.00110593 -0.000742655 -0.000532042 -0.000544742 -0.000479206
- -0.000407307 -0.000403575 -0.000366209 -0.000324161 -0.000286183
- -0.000247579 -0.000214281 -0.000203435 -0.000186896 -0.000171033
- -0.00015779 -0.000145259 -0.000128069 -0.000122647 -9.89398e-05
- -0.000114926 -0.000132195 -0.000107872 -8.91015e-05 -7.87996e-05
- -8.14061e-05 -8.9098e-05 -8.83368e-05 -7.6122e-05 -6.14668e-05
- -4.75402e-05 -3.81855e-05 -3.69696e-05 -4.78656e-05 -5.61346e-05
- -5.35007e-05 -4.1459e-05 -3.35411e-05 -2.52374e-05 -2.37479e-05
- -4.6406e-05 -9.41884e-05 -0.000109222 -8.52676e-05 -4.25166e-05
- -4.10125e-05 -3.95085e-05 -3.80045e-05 -3.65004e-05 -3.49964e-05
- -3.41627e-05 -3.3541e-05 -3.29193e-05 -3.22976e-05 -3.16758e-05
- -3.10334e-05 -3.03653e-05 -2.96971e-05 -2.9029e-05 -2.83609e-05
- -2.76928e-05 -2.70246e-05 -2.63565e-05 -2.56884e-05 -2.50203e-05
- -2.43521e-05 -2.38716e-05 -2.34324e-05 -2.29932e-05 -2.25539e-05
- -2.21147e-05 -2.16755e-05 -2.12362e-05 -2.0797e-05 -2.03578e-05
- -1.99186e-05 -1.95079e-05 -1.9217e-05 -1.8926e-05 -1.8635e-05
- -1.8344e-05 -1.8053e-05 -1.7762e-05 -1.74711e-05 -1.71801e-05
- EOD
-
- @v[21].set(<<-'EOD')
- 1.86175 1.73273 1.42016 1.02483 0.944013 0.274107 0.0823742
- 0.0379366 0.020816 0.0132952 0.00955525 0.00717008 0.00592286
- 0.00437379 0.00383557 0.00273694 -0.0037467 -0.0054191 -0.00131454
- 0.0112179 0.0133918 0.00519747 -0.00260113 -0.00252847 -0.00181292
- 0.000183398 -0.000667607 -0.000750747 -0.000594314 -0.000433904
- -0.000308985 -0.000217858 -0.000152926 -0.000107454 -7.54076e-05
- -5.2675e-05 -3.66299e-05 -2.54341e-05 -1.75095e-05 -1.18848e-05
- -7.97289e-06 -5.30239e-06 -3.53615e-06 -2.38504e-06 -2.40158e-06
- -3.84485e-06 -5.29435e-06 -2.57099e-06 1.95189e-06 3.55083e-06
- 2.06179e-06 5.72753e-07 3.30469e-07 3.40296e-07 3.60221e-07
- 4.86081e-07 6.1194e-07 7.37799e-07 8.63659e-07 9.89518e-07
- 9.21274e-07 7.22275e-07 5.23276e-07 3.24277e-07 1.25278e-07
- -5.59467e-08 -9.03265e-08 -1.24706e-07 -1.59086e-07 -1.93466e-07
- -2.27846e-07 -2.62226e-07 -2.96605e-07 -3.30985e-07 -3.65365e-07
- -3.99745e-07 -4.24266e-07 -3.82163e-07 -3.40061e-07 -2.97959e-07
- -2.55857e-07 -2.13755e-07 -1.71652e-07 -1.2955e-07 -8.7448e-08
- -4.53457e-08 -3.24353e-09 3.76901e-08 7.19937e-08 1.06297e-07
- 1.40601e-07 1.74904e-07 2.09208e-07 2.43512e-07 2.77815e-07
- 3.12119e-07 3.46422e-07 3.80726e-07 4.04507e-07 3.77191e-07
- 3.49876e-07 3.22561e-07 2.95246e-07 2.67931e-07 2.40616e-07
- 2.13301e-07 1.85986e-07 1.58671e-07 1.31356e-07 1.04041e-07
- 7.67256e-08 4.94105e-08 2.20955e-08 -5.21962e-09 -3.25347e-08
- -5.98498e-08 -8.71649e-08 -1.1448e-07 -1.41795e-07 -1.6911e-07
- 7.87893e-06 0.0114592 -0.0245712 -0.111637 0.0961324 1.61168
- 3.22343 4.20442 4.53535 4.83834 4.95464 4.98874 4.99746
- 4.99883 4.99948 4.99815 4.98431 4.99298 4.99718 5.01948
- 5.04749 5.008 4.98243 4.98985 4.99781 4.99887 4.99679 4.99616
- 4.99743 4.99859 4.99936 4.99972 5.00058 5.00123 5.0002 4.99945
- 4.99983 4.9998 4.99966 4.99958 4.99956 4.99956 4.99956 4.99958
- 4.99961 4.99965 4.99969 4.99973 4.99977 4.9998 4.99983 4.99985
- 4.99987 4.99989 4.99991 4.99992 4.99993 4.99994 4.99995
- 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001
- 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.01454
- 4.99566 4.96796 4.99819 5.03232 5.00034 4.99867 4.99937
- 4.99977 4.99992 4.99997 4.99999 5.00001 5.00021 4.99974
- 4.98462 4.99301 4.99723 5.01936 5.04807 5.00929 4.9789 4.97876
- 4.98244 4.9863 4.99575 5.0069 5.00863 5.00624 5.00357 5.0019
- 5.00098 5.00048 5.00025 5.00016 5.00011 5.00013 5.00009
- 4.99982 4.99994 5.00005 4.99994 4.99988 4.99989 4.99997
- 5.00003 5.00005 5.00002 5.00001 5.00001 5.00001 4.99993
- 4.99999 5 5.00021 4.99997 4.99981 5 5.00009 5.0001 5.00001
- 4.99991 4.9999 5 5.00011 5.00017 5.00018 5.00018 5.00014
- 5.00007 4.99999 4.9999 4.9999 5.00001 5.00016 5.00014 4.99999
- 4.99993 4.99999 5.00009 5.00007 5.00006 5.00004 5.00003
- 5.00001 5.00001 5 4.99999 4.99998 4.99997 4.99997 4.99997
- 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999
- 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002
- 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5 5
- EOD
-
- @v[22].set(<<-'EOD')
- 7.10441e-10 0.00107105 0.000637109 -0.00236346 -0.018079
- -0.0120077 -0.00217059 0.00266679 0.00403383 0.00403836
- 0.00356705 0.00303303 0.00244716 0.00198586 0.0016855 0.00136497
- -3.96022e-05 -0.000367409 -3.77079e-05 0.00194085 0.00506964
- -0.0400214 -0.0402572 0.0524434 0.286234 0.803011 1.44795
- 2.02473 2.54768 3.02748 3.4415 3.78287 4.09667 4.35152 4.53987
- 4.67614 4.77407 4.84319 4.89227 4.92702 4.95119 4.96764
- 4.97846 4.98557 4.98982 4.99209 4.99371 4.99569 4.99727
- 4.99802 4.99834 4.99867 4.99892 4.99915 4.99936 4.99939
- 4.99943 4.99946 4.9995 4.99953 4.99957 4.9996 4.99963 4.99967
- 4.9997 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 4.9998
- 4.99981 4.99982 4.99983 4.99984 4.99985 4.99986 4.99986
- 4.99986 4.99987 4.99987 4.99988 4.99988 4.99989 4.99989
- 4.9999 4.9999 4.9999 4.9999 4.99991 4.99991 4.99991 4.99991
- 4.99992 4.99992 4.99992 4.99992 4.99993 4.99993 4.99993
- 4.99993 4.99993 4.99993 4.99993 4.99993 4.99994 4.99994
- 4.99994 4.99994 4.99994 4.99994 4.99994 4.99994 4.99995
- 4.99995 4.99995 4.99995 4.99995 4.99995 4.99995 5.00145
- 5.00659 5.01209 5.01931 5.00279 4.99273 4.99217 4.99295
- 4.99471 4.99594 4.99696 4.9978 4.99844 4.99891 4.99924 4.99635
- 4.99699 4.99813 5.00068 5.00307 5.0588 4.96365 4.54012 3.6307
- 2.35176 1.0322 0.354379 0.115986 0.0435668 0.0245112 0.020786
- 0.0164656 0.0118409 0.00849698 0.00597078 0.0040105 0.0026076
- 0.0016597 0.00118185 0.00121067 0.00153587 0.00174836 0.00136519
- -0.000189116 -0.00315555 -0.00646603 -0.00898042 -0.010203
- -0.0110896 -0.0123764 -0.00953841 -0.00225795 0.000818314
- 0.00152252 0.00150269 0.00119025 0.000767068 0.000308852
- -3.79272e-05 -0.00019691 -0.000186642 -9.73653e-05 -8.49784e-06
- 2.04147e-05 -9.91086e-06 -1.55959e-05 -1.80499e-05 -1.77097e-05
- -1.51548e-05 -1.1978e-05 -9.84916e-06 -1.29728e-05 -1.67235e-05
- -1.74153e-05 -1.39958e-05 -5.92272e-06 -8.08216e-06 -1.53077e-05
- -2.92531e-05 -3.91049e-05 -2.98935e-05 -7.32122e-06 3.18534e-05
- 4.39134e-05 4.18753e-05 3.22759e-05 1.86766e-05 1.58432e-05
- 1.30098e-05 1.01765e-05 7.34312e-06 4.50975e-06 1.67639e-06
- -1.15697e-06 -1.23877e-06 -1.11991e-06 -1.00106e-06 -8.82208e-07
- -7.63355e-07 -6.44502e-07 -5.2565e-07 -4.29318e-07 -3.44661e-07
- -2.60004e-07 -1.75347e-07 -9.06904e-08 -6.03349e-09 7.86234e-08
- 1.6328e-07 2.47937e-07 3.32594e-07 4.17251e-07 5.01908e-07
- 5.86565e-07 6.71222e-07 7.36123e-07 6.43886e-07 5.5165e-07
- 4.59414e-07 3.67178e-07 0.000334759 -4.60833e-05 -0.00106139
- -0.00166624 0.000859563 0.00102606 0.00410037 0.00419931
- 0.00518997 0.00459791 0.00503125 0.00523877 0.00452158 0.00339924
- 0.00233399 0.000876915 0.000546439 0.000444299 0.000983968
- 0.00119304 -0.0429422 -0.0403983 0.0534896 0.288013 0.807345
- 1.44247 2.03448 2.57021 3.05049 3.47332 3.8131 4.1009 4.34677
- 4.53512 4.67127 4.76531 4.82526 4.86593 4.89586 4.91904
- 4.93806 4.95348 4.96597 4.97629 4.9843 4.98983 4.99335 4.9957
- 4.99741 4.99864 4.99946 4.99994 5.00047 5.00073 5.00086
- 5.00092 5.00094 5.00091 5.00087 5.00081 5.00074 5.00067
- 5.00059 5.00052 5.00046 5.0004 5.00034 5.0003 5.00026 5.00022
- 5.00019 5.00016 5.00014 5.00012 5.0001 5.00009 5.00007 5.00006
- 5.00006 5.00005 5.00004 5.00004 5.00004 5.00003 5.00003
- 5.00003 5.00002 5.00002 5.00002 5.00002 5.00001 5.00001
- 5.00001 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001
- 5.00001 5.00001 5.00002 5.00002
- EOD
-
- @v[23].set(<<-'EOD')
- 5 5.00284 5.01266 5.01895 4.98936 4.99575 4.99217 4.99545
- 4.99775 4.99894 4.99946 4.99968 4.99975 4.99977 4.99986
- 4.9999 4.99528 4.99808 5.00039 5.00392 5.00512 4.99985 4.99863
- 4.99942 4.99992 5.00017 4.99897 4.99803 4.99784 4.99739
- 4.99883 5.00365 5.00298 5.00133 5.00048 5.00019 5.00008
- 5.00005 5.00004 5.00003 5.00002 5.00002 5.00001 5.00001
- 5.00001 5.00001 5.00001 5 5 4.99999 4.99997 4.99995 4.99996
- 4.99998 5 5.00001 5.00001 5.00002 5.00002 5.00003 5.00003
- 5.00002 5.00002 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99998 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002
- 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5 5 5 5 5 5 5 5.00217 5.00108 4.99547 4.99658 5.00667
- 4.99641 4.99532 4.99938 5.00328 5.00222 5.00114 5.00052
- 5.00024 5.00011 5.00009 4.99285 4.99591 4.99897 5.00403
- 5.00786 5.00318 4.99942 4.9992 4.99949 5.001 5.00408 5.00319
- 5.00063 4.99995 5.00014 4.99982 4.99832 4.99838 4.99865
- 4.99912 4.99836 4.99735 4.99606 4.99814 5.00958 5.02973
- 5.05293 5.06103 4.99342 4.80726 4.50744 4.07509 3.41358
- 2.37924 1.03194 0.261552 0.142392 0.0904482 0.0555071 0.0322869
- 0.018289 0.0113802 0.00875182 0.00757055 0.00629906 0.00523
- 0.00403349 0.0031953 0.00280864 0.00286119 0.00250389 0.00202815
- 0.001723 0.00147312 0.0012411 0.00104401 0.000886204 0.000758277
- 0.000651915 0.00056348 0.000487966 0.000424048 0.000365613
- 0.000308178 0.000258725 0.000228061 0.000207976 0.000198491
- 0.00018518 0.000172716 0.000163197 0.000155007 0.000141734
- 0.000128461 0.000115188 0.000101915 8.86417e-05 7.53686e-05
- 6.20956e-05 5.69164e-05 5.23275e-05 4.77385e-05 4.31495e-05
- 3.85605e-05 3.39716e-05 2.93826e-05 2.69449e-05 2.56224e-05
- 2.42999e-05 2.29774e-05 2.16549e-05 2.03324e-05 1.90099e-05
- 1.76873e-05 1.63648e-05 1.50423e-05 1.37198e-05 1.23973e-05
- 1.10748e-05 9.75232e-06 8.48447e-06 7.65129e-06 6.81811e-06
- 5.98494e-06 5.15176e-06 0.00056893 -0.00787906 -0.0217381
- -0.0370066 -0.00770505 0.00659312 0.00975477 0.00949456
- 0.00777552 0.00655645 0.00568776 0.00508782 0.00458121 0.00410187
- 0.00365665 0.0015121 0.00160863 0.00263181 0.00638941 0.00772607
- 0.00225583 0.0010843 0.000882939 0.000801563 0.00075632
- 0.000554992 0.000435131 0.0003474 0.000217667 0.000491602
- 0.0012267 0.00250446 0.000212058 -0.0174972 -0.0527527 -0.0479071
- 0.194908 1.45838 3.40677 4.49242 4.86894 4.97215 5.01218
- 5.04342 5.06228 5.03069 4.87169 4.57056 4.11523 3.38264
- 2.19691 0.715839 0.172818 0.102162 0.0627162 0.0363388 0.020289
- 0.0119414 0.00826608 0.0066417 0.00549092 0.00492505 0.00439443
- 0.0037156 0.00306471 0.00247451 0.00195965 0.0014822 0.0010815
- 0.000904464 0.0010514 0.00152308 0.00120752 0.000228447
- -0.00102833 -0.00116644 -0.00042067 4.78758e-05 5.09599e-05
- -4.45756e-05 -3.22966e-06 3.81163e-05 7.94622e-05 0.000120808
- 0.000162154 0.000161895 0.000148481 0.000135068 0.000121654
- 0.000108241 9.81453e-05 9.2164e-05 8.61827e-05 8.02014e-05
- 7.42201e-05 6.82388e-05 6.22576e-05 5.62763e-05 5.0295e-05
- 4.43137e-05 3.83324e-05 3.54323e-05 3.321e-05 3.09877e-05
- 2.87654e-05 2.65431e-05 2.43209e-05 2.20986e-05 1.98763e-05
- 1.7654e-05 1.54317e-05 1.34612e-05 1.25441e-05 1.1627e-05
- 1.07099e-05 9.79276e-06 8.87564e-06 7.95851e-06 7.04139e-06
- 6.12427e-06
- EOD
-
- @v[24].set(<<-'EOD')
- 5 5.01099 5.00866 4.97845 4.92369 4.9273 4.97413 4.9929
- 4.99826 4.99958 4.99978 5.00005 4.99968 4.99959 5.00014
- 4.99979 4.99914 4.99982 5.00023 5.00295 5.00664 4.99854
- 4.99647 5.00438 5.01722 5.03681 5.04766 5.04799 5.04867
- 5.04873 5.04685 5.04413 5.0367 5.02505 5.01726 5.01183 5.00806
- 5.00549 5.00371 5.00246 5.00162 5.00105 5.00069 5.00045
- 5.00031 5.00024 5.00019 5.00012 5.00007 5.00004 5.00001
- 4.99998 4.99999 4.99999 5 5.00001 5.00001 5.00002 5.00002
- 5.00003 5.00003 5.00003 5.00002 5.00002 5.00001 5.00001
- 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5.00418 4.99953 4.99152
- 4.99807 5.00497 5.00112 5.00055 5.00038 5.00018 5.00006
- 5.00006 5.00007 5.00006 5.00004 5.00004 4.99853 4.99945
- 4.99998 5.00304 5.00935 5.00742 4.99181 4.97421 4.93603
- 4.8853 4.8927 4.93984 4.97458 4.99039 4.99614 4.99801 4.99851
- 4.99869 4.99924 5.00108 5.00181 5.00119 5.00059 5.00031
- 5.00022 5.00018 5.00011 5.00001 5.00006 4.99981 4.99977
- 4.99982 5.00012 4.99993 5.00008 5.00043 5.00048 5.00024
- 5.00008 4.99984 4.99993 5.00011 4.99996 4.9998 4.99977 4.9998
- 4.99993 5.00008 5.00011 5.00002 4.99995 4.99989 4.99993
- 5 5.00007 5.00009 4.99994 4.99977 4.9997 4.99975 4.99996
- 4.99996 4.99988 4.9997 4.99952 4.9995 4.99956 4.99973 4.99988
- 5.00005 5.00025 5.00042 5.00036 5.00031 5.00025 5.0002 5.00014
- 5.00009 5.00003 5.00002 5.00001 5.00001 5 4.99999 4.99998
- 4.99998 4.99997 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5.00284
- 5.00442 5.00381 4.98997 4.99092 5.00733 5.07791 4.98237
- 4.86434 4.76835 4.74067 4.79278 4.85094 4.90068 4.93603
- 4.95698 4.96984 4.97856 4.98869 4.99904 5.0005 4.99524 5.00181
- 5.01878 5.05177 5.07986 4.98917 4.56217 3.68 2.3539 1.18541
- 0.505772 0.221044 0.115287 0.0760938 0.0589194 0.0476784
- 0.0457213 0.0412911 0.033889 0.0259741 0.0191452 0.0139018
- 0.0100235 0.00711788 0.00497657 0.00349368 0.00250021 0.00176179
- 0.00121843 0.000838368 0.000582711 0.000423458 0.000294608
- 0.000201251 0.000133748 8.6227e-05 5.44252e-05 3.30514e-05
- 1.93926e-05 1.09814e-05 5.29857e-06 1.92247e-06 3.08708e-07
- -3.74311e-07 -6.11121e-07 -7.27807e-07 -4.87604e-07 -4.80493e-07
- -9.15925e-07 -2.03774e-06 -4.01128e-06 -2.46644e-06 2.10626e-06
- 8.22422e-06 1.04922e-05 9.83047e-06 7.27106e-06 3.29654e-06
- -2.06736e-06 -2.18019e-06 -2.29303e-06 -2.40586e-06 -2.51869e-06
- -2.63153e-06 -2.24615e-06 -1.70325e-06 -1.16036e-06 -6.17468e-07
- -7.45754e-08 2.45198e-07 2.88285e-07 3.31373e-07 3.7446e-07
- 4.17548e-07 4.60635e-07 5.03723e-07 5.4681e-07 5.89898e-07
- 6.32985e-07 6.76073e-07 6.19054e-07 5.4001e-07 4.60967e-07
- 3.81923e-07 3.02879e-07 2.23836e-07 1.44792e-07 6.57488e-08
- -1.32948e-08 -9.23383e-08 -1.6698e-07 -2.23206e-07 -2.79432e-07
- -3.35658e-07 -3.91884e-07 -4.48109e-07 -5.04335e-07 -5.60561e-07
- -6.16787e-07
- EOD
-
- @v[25].set(<<-'EOD')
- 1.34824 1.35838 1.36465 1.34675 1.29167 1.23161 1.2201 1.2185
- 1.2181 1.21798 1.21793 1.21788 1.21785 1.21782 1.21779 1.21776
- 1.21655 1.21656 1.21669 1.21871 1.22421 1.22247 1.21858
- 1.2228 1.23803 1.27737 1.10647 0.395248 0.0600669 0.027687
- 0.0192374 0.015425 0.0130881 0.00977445 0.00696598 0.00491122
- 0.00341952 0.00237078 0.00162339 0.00109178 0.000726647
- 0.000478886 0.00031568 0.000207902 0.000143494 0.000109768
- 8.62987e-05 5.69775e-05 3.36547e-05 2.30356e-05 1.86108e-05
- 1.41861e-05 1.08293e-05 7.68835e-06 4.79593e-06 4.51019e-06
- 4.22444e-06 3.9387e-06 3.65295e-06 3.36721e-06 3.04559e-06
- 2.69981e-06 2.35403e-06 2.00825e-06 1.66247e-06 1.34508e-06
- 1.26225e-06 1.17941e-06 1.09657e-06 1.01373e-06 9.30893e-07
- 8.48054e-07 7.65216e-07 6.82378e-07 5.9954e-07 5.16702e-07
- 4.37489e-07 3.82774e-07 3.2806e-07 2.73346e-07 2.18632e-07
- 1.63917e-07 1.09203e-07 5.4489e-08 -2.2523e-10 -5.49395e-08
- -1.09654e-07 -1.52862e-07 -1.3079e-07 -1.08718e-07 -8.6646e-08
- -6.45739e-08 -4.25019e-08 -2.04298e-08 1.64229e-09 2.37144e-08
- 4.57864e-08 6.78585e-08 8.71693e-08 9.30725e-08 9.89758e-08
- 1.04879e-07 1.10782e-07 1.16685e-07 1.22589e-07 1.28492e-07
- 1.34395e-07 1.40298e-07 1.46201e-07 1.52105e-07 1.58008e-07
- 1.63911e-07 1.69814e-07 1.75718e-07 1.81621e-07 1.87524e-07
- 1.93427e-07 1.9933e-07 2.05234e-07 2.11137e-07 2.19788e-07
- 0.000393944 -0.000218983 -0.00105784 0.00172403 -0.00027134
- -0.000204147 8.79968e-06 5.93762e-05 5.83554e-05 4.13815e-05
- 3.71369e-05 3.03372e-05 2.25336e-05 1.5986e-05 1.07284e-05
- -7.5239e-05 5.60593e-05 6.97571e-05 0.000667617 0.000960856
- 0.00131749 -0.00759564 -0.0217897 -0.0450321 -0.076646 -0.128569
- -0.186391 -0.202175 -0.206953 -0.2082 -0.208416 -0.208669
- -0.208934 -0.209111 -0.209234 -0.209329 -0.209389 -0.209416
- -0.2094 -0.209329 -0.20926 -0.209204 -0.209208 -0.209285
- -0.209454 -0.209641 -0.20977 -0.209811 -0.209833 -0.209887
- -0.209653 -0.209127 -0.208893 -0.208811 -0.208777 -0.208758
- -0.208747 -0.20874 -0.208726 -0.208697 -0.208657 -0.208611
- -0.208565 -0.208524 -0.208488 -0.208451 -0.208412 -0.208373
- -0.208333 -0.208294 -0.208256 -0.208219 -0.208183 -0.208145
- -0.208107 -0.208066 -0.208029 -0.207993 -0.207959 -0.207923
- -0.207883 -0.207838 -0.207789 -0.207747 -0.20771 -0.207675
- -0.207642 -0.207605 -0.207568 -0.207531 -0.207494 -0.207457
- -0.20742 -0.207383 -0.207346 -0.207308 -0.207271 -0.207233
- -0.207196 -0.207158 -0.207121 -0.207084 -0.207046 -0.207009
- -0.206972 -0.206935 -0.206898 -0.206861 -0.206823 -0.206786
- -0.206749 -0.206712 -0.206675 -0.206638 -0.2066 -0.206563
- -0.206526 -0.206489 -0.206452 -0.206415 -0.203384 -0.20015
- -0.196872 -0.205024 -0.210727 -0.206779 -0.0685263 0.586138
- 1.4665 2.22945 2.77554 3.076 3.24926 3.34515 3.40164 3.43006
- 3.43713 3.43075 3.42886 3.4384 3.46567 3.49025 3.51287 3.53821
- 3.57841 3.39846 2.80753 2.22947 1.7549 1.30429 0.707786
- 0.303206 0.131352 0.0671706 0.0429955 0.032461 0.0257161
- 0.0239521 0.0217397 0.0179705 0.0138745 0.0102813 0.00749643
- 0.0054328 0.00386817 0.0027004 0.00189442 0.00135552 0.000954715
- 0.000659981 0.000453435 0.000313993 0.000231347 0.000159665
- 0.000108122 7.10528e-05 4.50233e-05 2.77892e-05 1.62765e-05
- 8.9893e-06 4.5471e-06 1.54614e-06 -1.6542e-07 -8.68508e-07
- -1.04369e-06 -9.63086e-07 -8.44294e-07 -6.57339e-07 -7.35885e-07
- -9.80056e-07 -1.39772e-06 -2.10199e-06 -1.37474e-06 6.13269e-07
- 3.3028e-06 4.60941e-06 4.91053e-06 4.14186e-06 2.45258e-06
- -8.7388e-09 -3.59647e-07 -7.10554e-07 -1.06146e-06 -1.41237e-06
- -1.76328e-06 -1.63073e-06 -1.34534e-06 -1.05995e-06 -7.74561e-07
- -4.8917e-07 -2.95733e-07 -2.16326e-07 -1.3692e-07 -5.75135e-08
- 2.18929e-08 1.01299e-07 1.80706e-07 2.60112e-07 3.39519e-07
- 4.18925e-07 4.98332e-07 4.83984e-07 4.4901e-07 4.14035e-07
- 3.79061e-07 3.44087e-07 3.09112e-07 2.74138e-07 2.39163e-07
- 2.04189e-07 1.69215e-07 1.26002e-07 4.83213e-08 -2.9359e-08
- -1.07039e-07 -1.8472e-07 -2.624e-07 -3.4008e-07 -4.1776e-07
- -4.95441e-07
- EOD
-
- @v[26].set(<<-'EOD')
- 7.10441e-10 0.000309731 -0.000308186 -0.001694 -0.00360784
- 8.40909e-05 0.00203175 0.0012896 0.000596548 0.000277191
- 0.000161134 0.000120439 8.4915e-05 9.49929e-05 6.18812e-05
- 1.65433e-05 1.89682e-05 3.97578e-05 4.95446e-05 0.000225325
- 0.000214579 -0.00230134 -0.000451102 0.00997237 0.0341443
- 0.0449314 0.0424411 0.0341996 0.0315315 0.0308892 0.0291614
- 0.024365 0.0190282 0.0188976 0.017238 0.0138526 0.0105645
- 0.00778548 0.00561753 0.0039871 0.00279554 0.00194075 0.0013468
- 0.000934775 0.000664723 0.000498911 0.000377384 0.000254183
- 0.000163421 0.000120773 9.65058e-05 7.22384e-05 5.60316e-05
- 4.14549e-05 2.79516e-05 2.57096e-05 2.34677e-05 2.12257e-05
- 1.89837e-05 1.67417e-05 1.46737e-05 1.27228e-05 1.07719e-05
- 8.82099e-06 6.87009e-06 5.0896e-06 4.71705e-06 4.34451e-06
- 3.97196e-06 3.59941e-06 3.22686e-06 2.85431e-06 2.48176e-06
- 2.10921e-06 1.73666e-06 1.36411e-06 1.02855e-06 9.42931e-07
- 8.57316e-07 7.71701e-07 6.86086e-07 6.00471e-07 5.14856e-07
- 4.29241e-07 3.43626e-07 2.58011e-07 1.72396e-07 9.85409e-08
- 9.14091e-08 8.42773e-08 7.71456e-08 7.00138e-08 6.2882e-08
- 5.57503e-08 4.86185e-08 4.14867e-08 3.4355e-08 2.72232e-08
- 2.05821e-08 1.63235e-08 1.2065e-08 7.80643e-09 3.54786e-09
- -7.10696e-10 -4.96926e-09 -9.22782e-09 -1.34864e-08 -1.77449e-08
- -2.20035e-08 -2.62621e-08 -3.05206e-08 -3.47792e-08 -3.90378e-08
- -4.32963e-08 -4.75549e-08 -5.18134e-08 -5.6072e-08 -6.03306e-08
- -6.45891e-08 -6.88477e-08 -8.76373e-06 0.000131607 -0.00021685
- -0.000433027 0.00047234 0.000211593 -0.000189601 3.2492e-05
- 0.000575955 7.72235e-05 -0.000285172 -0.000242061 -0.000135112
- -3.50117e-05 -2.75868e-05 5.48974e-05 1.80604e-07 5.48911e-05
- 3.97478e-05 0.000192909 0.000297932 0.00402253 -0.0122366
- -0.047853 -0.0963082 -0.108071 -0.0567275 -0.0239271 -0.0178628
- -0.0233027 -0.031853 -0.0400843 -0.0482725 -0.0576154 -0.0627218
- -0.0511236 -0.0279524 -0.0150986 -0.00931091 -0.00652876
- -0.00479286 -0.00344346 -0.00249578 -0.0019532 -0.00157977
- -0.00131848 -0.00111251 -0.000939229 -0.000797445 -0.000708384
- -0.000630452 -0.000539722 -0.000508862 -0.000480596 -0.000439484
- -0.000407217 -0.000363866 -0.000329506 -0.000318642 -0.000307362
- -0.000286511 -0.000266253 -0.000242943 -0.000218107 -0.000204661
- -0.00020241 -0.000194435 -0.000185062 -0.000173042 -0.000160549
- -0.000151407 -0.000145626 -0.000145976 -0.000147342 -0.000145288
- -0.000137979 -0.000124481 -0.000123218 -0.000127453 -0.000139006
- -0.000145486 -0.000129764 -9.82749e-05 -4.72596e-05 -3.08671e-05
- -3.28834e-05 -4.52254e-05 -6.25389e-05 -6.32516e-05 -6.39643e-05
- -6.4677e-05 -6.53897e-05 -6.61023e-05 -6.6815e-05 -6.75277e-05
- -6.61005e-05 -6.45173e-05 -6.29341e-05 -6.13509e-05 -5.97676e-05
- -5.81844e-05 -5.66012e-05 -5.54231e-05 -5.4455e-05 -5.3487e-05
- -5.25189e-05 -5.15508e-05 -5.05828e-05 -4.96147e-05 -4.86466e-05
- -4.76785e-05 -4.67105e-05 -4.57424e-05 -4.47743e-05 -4.38063e-05
- -4.28382e-05 -4.18821e-05 -4.10211e-05 -4.016e-05 -3.9299e-05
- -3.8438e-05 4.29885e-05 5.14113e-05 -0.000127986 -0.000611463
- -0.000149428 0.000882394 0.00297059 -0.00405825 -0.00591067
- -0.00546997 -0.00158744 0.00190677 0.00298403 0.00268595
- 0.00196161 0.00130289 0.000783347 0.000520683 0.000565306
- 0.00053419 -0.00224696 -0.000920818 0.0132755 0.0322504
- 0.0442808 0.0638615 0.0701007 0.0539356 0.0247771 0.056244
- 0.294266 0.831368 1.45424 2.02898 2.54559 2.9937 3.35333
- 3.72609 4.06363 4.32789 4.52413 4.66504 4.7652 4.83637 4.88631
- 4.92109 4.94464 4.96046 4.97218 4.98079 4.98679 4.99076
- 4.99361 4.99555 4.99686 4.99783 4.99853 4.99902 4.99936
- 4.99959 4.99973 4.99983 4.9999 4.99993 4.99996 4.99998 5
- 5.00001 5 4.99999 4.99997 4.99994 4.99993 4.99994 4.99996
- 4.99999 5.00004 5.00006 5.00005 5.00003 5.00002 5.00001
- 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998
- EOD
-
- @v[27].set(<<-'EOD')
- 5 4.99984 4.99796 4.99478 4.9889 4.98738 4.98896 4.99087
- 4.99262 4.99419 4.99552 4.99659 4.99743 4.99807 4.99855
- 4.9989 4.99894 4.99908 4.99935 5.00001 5.0007 5.00132 5.00032
- 4.99976 5.00134 5.00339 5.00315 5.00157 5.00091 5.00058
- 5.00012 4.99944 4.99886 4.9994 4.99934 4.99899 4.99876 4.99868
- 4.99872 4.99883 4.99898 4.99914 4.9993 4.99944 4.99956 4.99967
- 4.99976 4.99982 4.99986 4.9999 4.99993 4.99997 4.99997 4.99998
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00009 5.00028 5.00015 4.99983
- 5.00036 4.99996 4.99834 4.99783 5.00383 5.00734 5.00387
- 5.00058 4.99893 4.99836 4.99832 4.99854 4.99873 4.99905
- 4.99927 4.99952 4.99969 4.99834 4.99536 4.99163 4.99073
- 5.0053 5.03631 5.03103 4.9008 4.62503 4.21887 3.70902 3.09967
- 2.35791 1.41912 0.519675 0.210458 0.131362 0.0980819 0.0708209
- 0.0471701 0.0323272 0.0253535 0.0199144 0.0152615 0.0117228
- 0.00917696 0.00738117 0.00609292 0.00512664 0.00436184 0.0037961
- 0.00331639 0.00289006 0.0025477 0.00226529 0.00202925 0.00182793
- 0.00165474 0.00150531 0.00137529 0.00125983 0.00115603 0.00106455
- 0.000982977 0.000911255 0.000846819 0.000790092 0.000738698
- 0.000692816 0.00065107 0.000613595 0.000579642 0.000548935
- 0.00052106 0.000495598 0.000472174 0.000450849 0.000431118
- 0.000412667 0.000395868 0.000381319 0.000368487 0.000357327
- 0.000344212 0.000330334 0.00031622 0.000303298 0.000295809
- 0.00028832 0.000280831 0.000273342 0.000265853 0.000258364
- 0.000250875 0.000245118 0.000239488 0.000233857 0.000228227
- 0.000222596 0.000216966 0.000211336 0.000207047 0.000203455
- 0.000199863 0.00019627 0.000192678 0.000189085 0.000185493
- 0.0001819 0.000178308 0.000174716 0.000171123 0.000167531
- 0.000163938 0.000160346 0.000156835 0.000153973 0.00015111
- 0.000148248 0.000145385 0.000296579 -3.96718e-05 -0.000449085
- 0.000323433 0.000750086 0.000268264 0.000149028 -0.000100249
- 7.00956e-05 0.00012605 0.00022592 0.000193036 0.000120453
- 8.07865e-05 7.65771e-05 -3.27828e-05 0.000116759 0.000169498
- 0.000409804 0.000414965 0.00092323 -0.00590633 -0.0175477
- -0.032433 -0.0559842 -0.0820373 0.0688484 0.626629 1.32929
- 2.01657 2.60925 3.12329 3.38952 3.14128 2.38463 1.23802
- 0.316019 0.107832 0.0694707 0.051837 0.035247 0.0209999
- 0.0116618 0.00967674 0.00789182 0.00574566 0.00386872 0.00258612
- 0.00167126 0.00104169 0.000641093 0.000401246 0.000277928
- 0.000171775 0.000102266 5.89376e-05 3.29258e-05 1.80463e-05
- 1.0057e-05 6.4571e-06 5.10093e-06 4.06791e-06 3.62716e-06
- 3.63321e-06 3.99625e-06 4.64368e-06 5.20886e-06 4.77728e-06
- 3.23919e-06 1.14113e-06 -1.29416e-06 -4.15607e-06 -1.88532e-06
- 5.24411e-06 1.38678e-05 1.28823e-05 3.6758e-06 -2.52285e-06
- -3.97133e-06 -4.03071e-06 -3.37154e-06 -2.71238e-06 -2.05321e-06
- -1.39404e-06 -7.34872e-07 -3.73325e-07 -1.05873e-07 1.61578e-07
- 4.2903e-07 6.96482e-07 8.18468e-07 7.60065e-07 7.01662e-07
- 6.43258e-07 5.84855e-07 5.26452e-07 4.68049e-07 4.09646e-07
- 3.51243e-07 2.9284e-07 2.34437e-07 1.71213e-07 1.06928e-07
- 4.2644e-08 -2.16403e-08 -8.59247e-08 -1.50209e-07 -2.14493e-07
- -2.78778e-07 -3.43062e-07 -4.07346e-07 -4.55065e-07 -4.3348e-07
- -4.11896e-07 -3.90311e-07 -3.68726e-07 -3.47141e-07 -3.25556e-07
- -3.03971e-07 -2.82386e-07
- EOD
-
- @v[28].set(<<-'EOD')
- 0.368163 0.361756 0.327463 0.269513 0.149476 0.0805716 0.0501146
- 0.03403 0.0230886 0.0160474 0.0116071 0.00870013 0.00679614
- 0.00542384 0.00432512 0.00340653 -0.00129719 -0.00399429
- -0.00318719 0.00443085 0.0150156 0.0334147 0.0132288 -0.0189751
- -0.0508377 -0.0252174 -0.0142489 -0.00675908 -0.0038653
- -0.00243423 -0.00168891 -0.00120901 -0.000900426 -0.000685575
- -0.000557595 -0.000457268 -0.000377427 -0.000315269 -0.000266613
- -0.000228397 -0.000198283 -0.000174248 -0.000154886 -0.00013892
- -0.000125864 -0.000115189 -0.000105841 -9.66611e-05 -8.84262e-05
- -8.23872e-05 -7.74668e-05 -7.25463e-05 -6.79992e-05 -6.35276e-05
- -5.92413e-05 -5.68994e-05 -5.45574e-05 -5.22154e-05 -4.98735e-05
- -4.75315e-05 -4.54981e-05 -4.36726e-05 -4.18471e-05 -4.00216e-05
- -3.81961e-05 -3.64559e-05 -3.54209e-05 -3.43858e-05 -3.33508e-05
- -3.23157e-05 -3.12807e-05 -3.02456e-05 -2.92105e-05 -2.81755e-05
- -2.71404e-05 -2.61054e-05 -2.51232e-05 -2.44984e-05 -2.38736e-05
- -2.32487e-05 -2.26239e-05 -2.19991e-05 -2.13742e-05 -2.07494e-05
- -2.01246e-05 -1.94998e-05 -1.88749e-05 -1.82865e-05 -1.79044e-05
- -1.75224e-05 -1.71403e-05 -1.67582e-05 -1.63762e-05 -1.59941e-05
- -1.56121e-05 -1.523e-05 -1.4848e-05 -1.44659e-05 -1.41138e-05
- -1.39075e-05 -1.37011e-05 -1.34947e-05 -1.32883e-05 -1.30819e-05
- -1.28755e-05 -1.26691e-05 -1.24627e-05 -1.22563e-05 -1.205e-05
- -1.18436e-05 -1.16372e-05 -1.14308e-05 -1.12244e-05 -1.1018e-05
- -1.08116e-05 -1.06052e-05 -1.03988e-05 -1.01924e-05 -9.98605e-06
- -9.77966e-06 -2.85319e-05 0.00281092 0.00180106 -0.000981083
- 0.00551926 -0.00119763 -0.0295069 -0.0367677 0.064749 0.119022
- 0.0882007 0.0552062 0.03418 0.0223243 0.015545 0.011949
- 0.00757134 0.00667655 0.00583243 0.00644443 0.00650959 -0.0302575
- -0.0437806 -0.0355466 0.0381776 0.282109 0.674178 1.07582
- 1.45189 1.789 2.08649 2.34663 2.57245 2.81211 3.04778 3.2523
- 3.45877 3.65593 3.83396 3.9923 4.13368 4.25864 4.36719 4.46064
- 4.54086 4.60962 4.66835 4.71838 4.76094 4.79716 4.82796
- 4.85413 4.87634 4.89518 4.91116 4.92476 4.93631 4.94608
- 4.95434 4.9613 4.96715 4.97211 4.97638 4.98001 4.98312 4.98571
- 4.98795 4.98979 4.99138 4.99269 4.99381 4.99474 4.99551
- 4.99615 4.99668 4.99713 4.99752 4.99783 4.99811 4.99836
- 4.99858 4.99873 4.99884 4.99892 4.999 4.99907 4.99912 4.99916
- 4.99921 4.99926 4.99932 4.99937 4.99942 4.99948 4.99953
- 4.99956 4.99958 4.99961 4.99963 4.99966 4.99968 4.99971
- 4.99972 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978
- 4.99979 4.9998 4.9998 4.99981 4.99982 4.99983 4.99984 4.99985
- 4.99986 4.99986 4.99987 4.99987 5.00498 5.00354 4.99359
- 4.98981 5.00498 5.00099 5.00041 5.00022 5.00015 5.00012
- 5.0001 5.00008 5.00005 5.00003 5 4.99431 4.99459 4.99591
- 5.00087 5.01029 5.03935 4.92784 4.51643 3.78356 2.68745
- 1.43417 0.583128 0.205094 0.0777337 0.0391566 0.02723 0.023883
- 0.018808 0.010165 0.00254623 -0.00377463 -0.0038097 0.00144145
- 0.00267231 0.00193045 0.00144538 0.00121758 0.00112893 0.00109424
- 0.0010226 0.000948072 0.000882573 0.000826996 0.000776391
- 0.000729719 0.000686499 0.000647333 0.000610108 0.000575631
- 0.000545069 0.000515485 0.000488514 0.000465316 0.000443215
- 0.000422454 0.00040292 0.00038488 0.000368472 0.000353628
- 0.000339643 0.000326197 0.000313483 0.000302884 0.000294038
- 0.000284003 0.000270941 0.000254925 0.000246511 0.000244089
- 0.000245538 0.000242099 0.000235728 0.000227482 0.000218001
- 0.000207257 0.000202127 0.000196997 0.000191868 0.000186738
- 0.000181608 0.00017758 0.000173899 0.000170219 0.000166538
- 0.000162857 0.000159576 0.00015679 0.000154005 0.000151219
- 0.000148433 0.000145647 0.000142861 0.000140076 0.00013729
- 0.000134504 0.000131718 0.000129603 0.000127635 0.000125668
- 0.0001237 0.000121732 0.000119765 0.000117797 0.000115829
- 0.000113862 0.000111894 0.000109993 0.000108372 0.000106751
- 0.00010513 0.000103509 0.000101887 0.000100266 9.86449e-05
- 9.70237e-05
- EOD
-
- @v[29].set(<<-'EOD')
- 5 4.99899 4.99654 4.99327 4.9863 4.98954 4.99212 4.99378
- 4.9951 4.99624 4.99715 4.99786 4.99839 4.99879 4.99909 4.99931
- 4.99922 4.99933 4.99971 5.00064 5.00084 5.00123 4.99865
- 4.99853 4.99983 5.00457 5.00242 5.00105 5.00062 5.00042
- 4.99971 4.9994 4.9992 4.9996 4.99955 4.99932 4.99918 4.99915
- 4.99919 4.99927 4.99937 4.99948 4.99957 4.99966 4.99974
- 4.9998 4.99985 4.99989 4.99992 4.99993 4.99994 4.99994 4.99996
- 4.99998 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001
- 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99998 4.99998 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5
- 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5 5 5 5 5 5 4.9997 4.99998 4.99954 4.99963
- 5.00059 4.99945 4.99732 4.99957 5.00919 5.00558 5.00033
- 4.99851 4.9983 4.99854 4.99871 4.99928 4.99914 4.99939 4.99952
- 4.9998 4.99976 4.99744 4.99598 4.99478 4.99806 5.01911 5.04602
- 5.05469 5.01317 4.89484 4.69655 4.42036 4.06069 3.60793
- 3.12531 2.72975 2.45187 2.25081 2.09841 1.98509 1.90211
- 1.84084 1.79411 1.7574 1.72763 1.70283 1.68188 1.66389 1.64823
- 1.63438 1.62201 1.61088 1.60081 1.59163 1.58323 1.57549
- 1.56835 1.56173 1.55558 1.54985 1.54451 1.53951 1.53479
- 1.53035 1.52615 1.5222 1.51845 1.5149 1.51153 1.50834 1.50529
- 1.5024 1.49964 1.497 1.49449 1.49208 1.48977 1.48755 1.48542
- 1.48336 1.48138 1.47948 1.47765 1.4759 1.47419 1.47255 1.47096
- 1.46949 1.46823 1.46696 1.4657 1.46444 1.46317 1.46191 1.46065
- 1.45956 1.4585 1.45743 1.45636 1.45529 1.45422 1.45315 1.45226
- 1.45145 1.45064 1.44983 1.44902 1.44821 1.4474 1.44659 1.44579
- 1.44498 1.44417 1.44336 1.44255 1.44174 1.44094 1.44019
- 1.43944 1.43868 1.43793 1.43765 1.43679 1.43515 1.43405
- 1.43478 1.43387 1.43345 1.43184 1.43086 1.43021 1.43003
- 1.42988 1.42944 1.42883 1.42818 1.42702 1.42642 1.42595
- 1.42586 1.42616 1.42783 1.41733 1.38106 1.30738 1.3877 2.09819
- 3.05285 3.58059 3.77601 3.87609 4.02557 4.24887 4.4608 4.60411
- 4.72109 4.8255 4.90465 4.97379 5.01253 5.01532 5.01239 5.0092
- 5.00665 5.00474 5.00333 5.00232 5.00163 5.00117 5.00082
- 5.00057 5.00039 5.00027 5.00019 5.00013 5.00009 5.00006
- 5.00004 5.00003 5.00002 5.00001 5.00001 5 5 5 4.99998 4.99995
- 4.99992 4.99996 5.00005 5.00012 5.00008 4.99996 4.9999 4.99985
- 4.99986 4.99997 5.00021 5.0003 5.00024 5.00009 5.00007 5.00005
- 5.00003 5.00001 4.99998 4.99998 4.99998 4.99999 4.99999
- 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998
- 4.99998 4.99998
- EOD
-
- @v[30].set(<<-'EOD')
- 7.10441e-10 5.70385e-05 0.000226143 0.000131916 -0.000887764
- -8.01837e-05 -3.49653e-05 9.40039e-05 0.000118663 0.000108025
- 8.6059e-05 6.33268e-05 4.99295e-05 3.16843e-05 3.60692e-05
- 2.07572e-05 -8.6375e-05 3.44583e-05 8.07397e-05 0.000196296
- 0.000115615 -7.12768e-05 -0.000129812 -4.18679e-05 7.94364e-05
- 0.000182034 -5.41226e-05 -0.000451819 -0.000713937 -0.00129863
- -0.00262186 -0.00213417 -0.00133767 0.000775698 0.000969902
- 0.000549281 0.000280946 0.000140321 8.6919e-05 7.22446e-05
- 6.5631e-05 6.45263e-05 6.63087e-05 7.17391e-05 7.59042e-05
- 7.59172e-05 7.03353e-05 6.33558e-05 5.31136e-05 4.64278e-05
- 4.40594e-05 4.16909e-05 4.05674e-05 3.96957e-05 3.87875e-05
- 3.74977e-05 3.62079e-05 3.49181e-05 3.36283e-05 3.23385e-05
- 3.12427e-05 3.02775e-05 2.93124e-05 2.83472e-05 2.7382e-05
- 2.64613e-05 2.59077e-05 2.5354e-05 2.48004e-05 2.42468e-05
- 2.36931e-05 2.31395e-05 2.25859e-05 2.20322e-05 2.14786e-05
- 2.0925e-05 2.03916e-05 1.9995e-05 1.95984e-05 1.92019e-05
- 1.88053e-05 1.84087e-05 1.80122e-05 1.76156e-05 1.7219e-05
- 1.68225e-05 1.64259e-05 1.6051e-05 1.57991e-05 1.55471e-05
- 1.52952e-05 1.50433e-05 1.47913e-05 1.45394e-05 1.42875e-05
- 1.40356e-05 1.37836e-05 1.35317e-05 1.32978e-05 1.31513e-05
- 1.30048e-05 1.28583e-05 1.27118e-05 1.25653e-05 1.24188e-05
- 1.22724e-05 1.21259e-05 1.19794e-05 1.18329e-05 1.16864e-05
- 1.15399e-05 1.13934e-05 1.12469e-05 1.11005e-05 1.0954e-05
- 1.08075e-05 1.0661e-05 1.05145e-05 1.0368e-05 1.02215e-05
- 1.76447e-05 7.21516e-05 -3.59786e-05 -0.000159618 0.000156236
- 0.000135106 -0.000336402 -0.000302283 0.000699323 0.000473866
- -0.000156146 -0.000225625 -0.000123592 -3.78116e-05 8.47472e-06
- 2.43387e-06 -7.44762e-05 7.80111e-05 9.43608e-05 0.000170159
- 8.83919e-05 -0.00018802 -0.000373512 -0.000390597 0.000156875
- 0.0032343 0.00776304 -0.000566905 -0.00760695 -0.0159226
- -0.0245989 -0.0331402 -0.0100902 0.067837 0.266702 0.910818
- 1.82282 2.69714 3.43247 3.98325 4.32893 4.51529 4.67087
- 4.79288 4.87574 4.92797 4.95902 4.97655 4.98622 4.99195
- 4.99526 4.99735 4.9991 4.99974 4.99982 4.99974 4.99961 4.9995
- 4.99943 4.9994 4.9994 4.99942 4.99944 4.99948 4.99952 4.99956
- 4.99961 4.99965 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986
- 4.99988 4.9999 4.99991 4.99992 4.99993 4.99994 4.99995 4.99995
- 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999
- 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5
- 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 5 5.00019 4.99888 4.99663 4.99457 4.99902
- 5.00229 5.00323 5.00302 5.0023 5.0015 5.00085 5.00041 5.00013
- 4.99993 4.99979 4.99948 4.99954 4.99983 5.00055 5.00109
- 5.00009 4.9987 4.998 4.99755 4.99676 4.99618 5.01091 5.05272
- 5.04156 4.80112 4.27692 3.42343 2.23953 0.967179 0.429813
- 0.540757 1.32991 2.32147 3.14903 3.78143 4.22325 4.47978
- 4.59448 4.69875 4.79798 4.87419 4.92339 4.95249 4.97174
- 4.98408 4.99124 4.99478 4.99729 4.99868 4.9992 4.99941 4.99947
- 4.99946 4.99943 4.9994 4.99939 4.9994 4.99942 4.99946 4.99951
- 4.99956 4.99961 4.99967 4.99973 4.99977 4.9998 4.99981 4.99983
- 4.99984 4.99987 4.99992 5.00001 5.00005 5.00001 4.99994
- 4.99995 4.99995 4.99996 4.99996 4.99996 4.99997 4.99997
- 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999
- 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999
- 4.99998 4.99998 4.99998
- EOD
-
- @v[31].set(<<-'EOD')
- 1.8179e-09 -5.28841e-06 -1.44913e-05 -3.62932e-05 -9.75719e-05
- 0.000141781 3.73396e-05 -1.65603e-05 -1.5271e-05 -6.73884e-06
- 4.40157e-06 -4.85345e-06 -1.02964e-05 2.03126e-05 -1.89457e-05
- -8.75564e-06 7.67422e-06 4.71103e-06 1.29798e-05 6.13469e-06
- -1.14363e-05 -0.0394563 -0.0477298 -0.0622012 -0.0519225
- 0.262499 0.943611 1.67052 2.31017 2.84028 3.28467 3.61582
- 3.85887 4.13011 4.36511 4.54063 4.67013 4.76408 4.83263
- 4.8825 4.91837 4.94373 4.96117 4.97318 4.98093 4.98562 4.98906
- 4.99267 4.99539 4.99666 4.99731 4.99797 4.99844 4.99887
- 4.99927 4.99933 4.99938 4.99944 4.99949 4.99955 4.9996 4.99965
- 4.9997 4.99975 4.9998 4.99985 4.99986 4.99987 4.99989 4.9999
- 4.99991 4.99992 4.99993 4.99995 4.99996 4.99997 4.99998
- 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001
- 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99997 5.00002 5.00004 5.0001 5.0001 4.99987 5.00009
- 5.00021 5.00002 5.00004 4.99988 5.00013 4.99993 5.00026
- 4.99973 5 5.00006 5.00009 5.00004 5.00004 5.04854 4.82711
- 4.04208 2.64155 0.838902 0.19014 0.0982549 0.0723197 0.0576863
- 0.0427644 0.0301979 0.020146 0.0135728 0.00980358 0.00774482
- 0.00586604 0.0036687 0.00211511 0.00121906 0.000647581 0.000828436
- 0.00190938 0.00224254 0.00199956 0.00165488 0.00135612 0.00113715
- 0.000984181 0.000877175 0.000789973 0.000741139 0.000689338
- 0.000625676 0.000586082 0.000550152 0.000529573 0.000505606
- 0.000482117 0.000460574 0.000441649 0.000424674 0.000408398
- 0.000391914 0.000376272 0.000361487 0.000348181 0.000336045
- 0.000324466 0.000313545 0.000303046 0.000293056 0.00028356
- 0.000274586 0.000266155 0.000258279 0.000250938 0.000243789
- 0.000236912 0.000230244 0.000224186 0.000219291 0.000215346
- 0.000212468 0.000207291 0.000200862 0.00019368 0.000186767
- 0.000183515 0.000180263 0.00017701 0.000173758 0.000170506
- 0.000167253 0.000164001 0.000161164 0.000158357 0.00015555
- 0.000152743 0.000149936 0.000147129 0.000144322 0.000142066
- 0.000140096 0.000138127 0.000136157 0.000134187 0.000132218
- 0.000130248 0.000128278 0.000126308 0.000124339 0.000122369
- 0.000120399 0.000118429 0.00011646 0.000114527 0.000112892
- 0.000111258 0.000109623 0.000107988 0.000103598 6.86052e-05
- 3.337e-05 7.00783e-05 0.000218764 0.000221318 0.000118593
- -0.000113962 5.78552e-05 9.42068e-05 0.000237037 0.000171302
- 0.0001033 6.16066e-05 5.52908e-05 6.30233e-05 7.01897e-05
- 8.48573e-05 0.000106859 8.37213e-05 -0.0391541 -0.047722
- -0.0618454 -0.0169804 0.345725 1.03426 1.74825 2.37152 2.88737
- 3.32173 3.66761 3.9707 4.17762 3.98832 3.30483 2.09737 0.710892
- 0.148159 0.0707463 0.0555808 0.045618 0.0319116 0.0199589
- 0.0133357 0.00898528 0.00586075 0.00375478 0.00245443 0.00156038
- 0.000962344 0.000590953 0.000375107 0.000250243 0.00015882
- 0.000100203 6.18122e-05 3.7372e-05 2.23009e-05 1.32569e-05
- 8.29437e-06 5.72457e-06 3.96832e-06 2.98935e-06 2.59699e-06
- 2.75024e-06 3.38689e-06 4.0453e-06 3.50095e-06 1.64988e-06
- -3.84371e-07 -2.03828e-06 -3.46401e-06 -1.24301e-06 4.63458e-06
- 1.14104e-05 1.02619e-05 2.15487e-06 -2.98487e-06 -3.67221e-06
- -2.94279e-06 -2.58649e-06 -2.23019e-06 -1.87389e-06 -1.5176e-06
- -1.1613e-06 -7.92127e-07 -4.18889e-07 -4.56502e-08 3.27588e-07
- 7.00827e-07 8.79539e-07 8.17025e-07 7.5451e-07 6.91996e-07
- 6.29481e-07 5.66966e-07 5.04452e-07 4.41937e-07 3.79422e-07
- 3.16908e-07 2.54393e-07 1.90078e-07 1.25366e-07 6.0654e-08
- -4.05776e-09 -6.87696e-08 -1.33481e-07 -1.98193e-07 -2.62905e-07
- -3.27617e-07 -3.92329e-07 -4.40392e-07 -4.18802e-07 -3.97213e-07
- -3.75624e-07 -3.54035e-07 -3.32446e-07 -3.10856e-07 -2.89267e-07
- -2.67678e-07
- EOD
-
- @v[32].set(<<-'EOD')
- 1.10294 1.10297 1.10291 1.10277 1.10259 1.10294 1.10313
- 1.10306 1.10299 1.10296 1.10295 1.10295 1.10294 1.10294
- 1.10294 1.10294 1.10294 1.10294 1.10294 1.10296 1.10296
- 1.00547 0.998599 1.5201 2.49297 3.31258 3.73162 3.84757
- 3.92505 4.02965 4.16599 4.30294 4.41541 4.52886 4.64414
- 4.73865 4.81065 4.86391 4.90315 4.93188 4.95258 4.96726
- 4.97738 4.98436 4.98888 4.99162 4.99363 4.99573 4.99731
- 4.99804 4.99843 4.99881 4.99909 4.99934 4.99957 4.9996 4.99964
- 4.99967 4.9997 4.99973 4.99977 4.9998 4.99983 4.99986 4.99988
- 4.99991 4.99992 4.99992 4.99993 4.99994 4.99994 4.99995
- 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999
- 4.99999 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 5.00028 4.99988 4.99968
- 5.00019 4.99987 5.00021 4.99973 4.99977 4.99996 4.99997
- 5.0002 4.99957 5.00026 4.99947 5.00074 5.00003 4.99987 4.99979
- 5.00008 4.99997 5.08794 5.05993 4.76875 3.99197 3.10174
- 2.5197 2.21771 2.04 1.92235 1.83874 1.77592 1.72665 1.686
- 1.65276 1.6286 1.61299 1.60039 1.58934 1.57954 1.57083 1.56306
- 1.55604 1.54963 1.54375 1.53832 1.53331 1.52865 1.52432
- 1.52026 1.51645 1.51287 1.50949 1.50629 1.50327 1.50039
- 1.49766 1.49505 1.49257 1.49019 1.48792 1.48574 1.48365
- 1.48164 1.47971 1.47784 1.47604 1.47431 1.47264 1.47102
- 1.46945 1.46794 1.46647 1.46505 1.46367 1.46233 1.46103
- 1.45976 1.45853 1.45733 1.45616 1.45502 1.45392 1.45284
- 1.45179 1.45076 1.44975 1.4488 1.44795 1.44711 1.44626 1.44541
- 1.44457 1.44372 1.44287 1.44212 1.44138 1.44063 1.43989
- 1.43914 1.4384 1.43766 1.43701 1.43641 1.43581 1.43522 1.43462
- 1.43402 1.43342 1.43282 1.43223 1.43163 1.43103 1.43043
- 1.42984 1.42924 1.42865 1.42808 1.42752 1.42695 1.42639
- 1.42584 1.42529 1.42472 1.42412 1.42365 1.42326 1.42304
- 1.42162 1.42082 1.42032 1.42029 1.42026 1.41995 1.41947
- 1.41894 1.41841 1.4179 1.41742 1.41699 1.41656 1.32097 1.30963
- 1.78765 2.64656 3.35764 3.747 3.86589 3.94217 4.04185 4.18453
- 4.3561 4.53439 4.68621 4.74905 4.77848 4.84629 4.91261 4.97541
- 5.01284 5.01548 5.01248 5.00924 5.00666 5.00475 5.00334
- 5.00234 5.00164 5.00118 5.00083 5.00058 5.0004 5.00028 5.00019
- 5.00013 5.00009 5.00007 5.00004 5.00003 5.00002 5.00001
- 5.00001 5.00001 5 5 4.99999 4.99995 4.99992 4.99996 5.00006
- 5.00012 5.00009 4.99997 4.9999 4.99985 4.99986 4.99997 5.00021
- 5.00031 5.00024 5.0001 5.00007 5.00005 5.00003 5.00001 4.99998
- 4.99998 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5
- 5 4.99999 4.99999 4.99999 4.99998 4.99998 4.99998
- EOD
-
- @v[33].set(<<-'EOD')
- 5 5.00012 5.00023 5.0003 4.99972 4.99988 4.99984 4.99991
- 4.99996 4.99999 5.00008 5.00009 4.99986 5.00003 5.00007
- 4.99995 4.9999 4.99997 5.00013 5.00014 5.00013 4.99701 4.99763
- 4.99742 4.99998 5.02836 5.07262 4.96856 4.57267 3.85637
- 2.79544 1.45942 0.408016 0.084885 0.0271375 0.0119294 0.00707546
- 0.0051087 0.00373035 0.00264737 0.00186477 0.00130379 0.000915857
- 0.000653121 0.000483893 0.000380852 0.000302362 0.000219498
- 0.000154435 0.000121928 0.000104026 8.61242e-05 7.48526e-05
- 6.49216e-05 5.56238e-05 5.29689e-05 5.03139e-05 4.7659e-05
- 4.5004e-05 4.23491e-05 4.00356e-05 3.79522e-05 3.58687e-05
- 3.37852e-05 3.17018e-05 2.97592e-05 2.89804e-05 2.82016e-05
- 2.74228e-05 2.66441e-05 2.58653e-05 2.50865e-05 2.43077e-05
- 2.35289e-05 2.27501e-05 2.19714e-05 2.12346e-05 2.07821e-05
- 2.03295e-05 1.98769e-05 1.94244e-05 1.89718e-05 1.85192e-05
- 1.80667e-05 1.76141e-05 1.71615e-05 1.6709e-05 1.62828e-05
- 1.60061e-05 1.57294e-05 1.54527e-05 1.5176e-05 1.48993e-05
- 1.46226e-05 1.43459e-05 1.40692e-05 1.37925e-05 1.35158e-05
- 1.3262e-05 1.31191e-05 1.29761e-05 1.28332e-05 1.26903e-05
- 1.25474e-05 1.24045e-05 1.22615e-05 1.21186e-05 1.19757e-05
- 1.18328e-05 1.16898e-05 1.15469e-05 1.1404e-05 1.12611e-05
- 1.11182e-05 1.09752e-05 1.08323e-05 1.06894e-05 1.05465e-05
- 1.04036e-05 1.02606e-05 1.00185e-05 3.8343e-05 -3.06781e-05
- -0.000111758 0.000111673 0.000130815 -0.000210491 -0.000231304
- 0.000310226 0.000265303 3.0878e-05 -4.48405e-05 -1.2852e-05
- -7.84469e-06 3.29986e-05 -1.23286e-05 -6.07871e-05 5.35082e-05
- 7.69194e-05 0.000126221 6.57178e-05 0.00223349 -0.0148854
- -0.0476636 -0.0491447 0.220125 1.11174 2.03988 2.90209 3.61069
- 4.13554 4.50679 4.71501 4.83916 4.91027 4.95284 4.98086
- 4.99151 4.98651 4.97113 4.95075 4.93102 4.93683 4.95457
- 4.97071 4.98212 4.98948 4.99386 4.99636 4.99785 4.9987 4.99927
- 4.99989 5.00014 5.00007 4.99988 4.99982 4.99976 4.99973
- 4.99972 4.99972 4.99973 4.99974 4.99975 4.99977 4.99979
- 4.99981 4.99984 4.99986 4.99988 4.99989 4.99991 4.99992
- 4.99993 4.99994 4.99995 4.99996 4.99996 4.99997 4.99997
- 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999
- 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00001 5.00001
- 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999
- 4.99999 4.99999 4.99999 5 5.00012 4.99946 4.99839 4.99733
- 4.99948 5.00114 5.00158 5.00147 5.00113 5.00073 5.00043
- 5.0002 5.00006 4.99995 4.99986 4.99973 4.99976 4.9999 5.00029
- 5.00055 4.99704 4.99734 4.9972 5.00278 5.03354 5.07184 4.94057
- 4.51936 3.75638 2.60982 1.23803 0.315016 0.0796102 0.0252894
- 0.0165723 0.0827785 0.491298 1.40686 2.33436 3.1251 3.7691
- 4.22201 4.49976 4.68115 4.80513 4.88509 4.93208 4.95861
- 4.97579 4.98655 4.99268 4.99571 4.99771 4.99881 4.99929
- 4.99954 4.99965 4.9997 4.99971 4.99971 4.99971 4.99971 4.99972
- 4.99974 4.99976 4.99978 4.99981 4.99984 4.99987 4.99989
- 4.99991 4.99991 4.99992 4.99992 4.99993 4.99997 5.00003
- 5.00006 5.00004 5.00001 5 4.99999 4.99998 4.99998 4.99997
- 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999
- 4.99999 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 4.99999
- 4.99999 4.99999 4.99999 4.99998 4.99998
- EOD
-
- @v[34].set(<<-'EOD')
- 5 5.00207 5.00813 5.01486 5.00156 5.0018 4.99861 4.99844
- 4.99888 4.9993 4.99956 4.99971 4.99979 4.99983 4.99987 4.99989
- 4.99671 4.9974 4.99864 5.00131 5.00377 5.0021 5.00039 4.99993
- 5.00004 5.0009 5.00109 4.99636 4.98617 4.96778 4.92047 4.89528
- 4.91112 4.9559 4.98286 4.99369 4.99812 4.99951 4.99994 5.00014
- 5.00008 4.99994 4.99984 4.99989 4.99998 5.00004 5.00004
- 5.00006 5.00005 5.00001 4.99997 4.99992 4.99993 4.99994
- 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996
- 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996
- 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997
- 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997
- 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998
- 4.99998 4.99998 4.99998 4.99998 5.00131 5.00072 4.9977 4.99811
- 5.00325 4.99647 4.98948 4.99459 5.00262 5.00276 5.00156
- 5.00072 5.0003 5.00013 4.99995 4.99668 4.99775 4.99917 5.00173
- 5.00386 5.00188 4.99888 4.99757 4.99951 5.01712 5.0557 5.07088
- 5.07704 5.07758 5.06958 5.04223 5.03331 5.0279 5.03408 5.07611
- 5.01911 4.68594 3.99152 2.92195 1.69878 0.809 0.344091 0.154663
- 0.0788717 0.0467212 0.0336168 0.0280514 0.0254947 0.024173
- 0.0223567 0.0220555 0.0271514 0.0295872 0.0296052 0.0283971
- 0.0264726 0.0241813 0.0218244 0.0195349 0.017368 0.0152495
- 0.013295 0.0115444 0.00996982 0.00857091 0.00733891 0.00627261
- 0.0053494 0.00456316 0.00388373 0.00331073 0.00282181 0.00240991
- 0.00206389 0.00177187 0.00152283 0.00131167 0.00112558 0.000954373
- 0.000805726 0.00069326 0.000600991 0.000525743 0.00047355
- 0.00044359 0.000434815 0.000436053 0.000402511 0.000368969
- 0.000335427 0.000301886 0.000268344 0.000234802 0.00020126
- 0.000184967 0.000169932 0.000154896 0.000139861 0.000124825
- 0.00010979 9.47546e-05 8.67896e-05 8.24901e-05 7.81906e-05
- 7.38911e-05 6.95915e-05 6.5292e-05 6.09925e-05 5.66929e-05
- 5.23934e-05 4.80939e-05 4.37943e-05 3.94948e-05 3.51953e-05
- 3.08957e-05 2.67968e-05 2.42936e-05 2.17904e-05 1.92872e-05
- 1.6784e-05 0.00125927 -0.00794344 -0.0305499 -0.0621697
- -0.0463796 -0.0224608 -0.00538381 0.00546086 0.0108675 0.012883
- 0.0131787 0.0127271 0.0119702 0.0110398 0.0100635 0.00649617
- 0.00489388 0.00545863 0.0098351 0.0167428 0.0126563 0.00697542
- 0.00427027 0.00330002 0.00390774 0.00408999 -0.00259143
- -0.0160578 -0.0451849 -0.0409651 0.1301 0.597429 1.3848
- 2.63426 3.81272 4.51373 4.8412 4.98731 4.88165 4.37165 3.40034
- 2.17681 1.12217 0.505129 0.219703 0.104992 0.0622333 0.0448317
- 0.0355782 0.0311867 0.0293529 0.0274615 0.0288739 0.0307845
- 0.0304909 0.029245 0.0273602 0.0251006 0.022697 0.0202765
- 0.0179357 0.0157106 0.0136562 0.0117951 0.0101273 0.00865784
- 0.00739394 0.00634364 0.00551356 0.00480538 0.00415747 0.00356084
- 0.00297585 0.00236711 0.00181853 0.00160713 0.00169822 0.00166542
- 0.00145504 0.00120252 0.00109259 0.000982658 0.00087273
- 0.000762802 0.000652874 0.000584068 0.000528263 0.000472458
- 0.000416653 0.000360848 0.000321155 0.000301442 0.000281729
- 0.000262016 0.000242303 0.00022259 0.000202877 0.000183164
- 0.000163451 0.000143738 0.000124025 0.000114582 0.000107399
- 0.000100216 9.30332e-05 8.58502e-05 7.86672e-05 7.14841e-05
- 6.43011e-05 5.7118e-05 4.9935e-05 4.35378e-05 4.04281e-05
- 3.73184e-05 3.42088e-05 3.10991e-05 2.79894e-05 2.48798e-05
- 2.17701e-05 1.86604e-05
- EOD
-
- @v[35].set(<<-'EOD')
- 7.24585e-12 2.21843e-05 3.20014e-05 1.25076e-05 -2.44947e-05
- 1.8425e-05 5.50546e-06 3.53025e-05 -1.07551e-05 -3.94383e-06
- -2.27848e-06 -9.04789e-05 7.44215e-05 -2.7662e-05 0.000200038
- -2.11998e-05 -2.09011e-05 2.37098e-05 2.18751e-05 -2.28422e-05
- -6.23659e-05 3.58241e-05 1.76386e-05 -4.28311e-05 0.000355626
- 0.00156903 0.00100999 -0.0085304 -0.02067 -0.0389485 -0.0651568
- -0.128475 -0.314362 -0.406837 -0.421558 -0.421277 -0.418176
- -0.414481 -0.410845 -0.407348 -0.403971 -0.400716 -0.397582
- -0.394563 -0.391658 -0.388866 -0.386178 -0.383585 -0.381094
- -0.378789 -0.376569 -0.37435 -0.372256 -0.370188 -0.36815
- -0.366422 -0.364694 -0.362967 -0.361239 -0.359511 -0.357888
- -0.356334 -0.354781 -0.353227 -0.351674 -0.350152 -0.348888
- -0.347625 -0.346361 -0.345098 -0.343834 -0.342571 -0.341307
- -0.340044 -0.33878 -0.337517 -0.336279 -0.335215 -0.334152
- -0.333088 -0.332024 -0.330961 -0.329897 -0.328833 -0.32777
- -0.326706 -0.325642 -0.324601 -0.323683 -0.322766 -0.321849
- -0.320932 -0.320014 -0.319097 -0.31818 -0.317263 -0.316345
- -0.315428 -0.314545 -0.313825 -0.313106 -0.312387 -0.311667
- -0.310948 -0.310228 -0.309509 -0.308789 -0.30807 -0.307351
- -0.306631 -0.305912 -0.305192 -0.304473 -0.303754 -0.303034
- -0.302315 -0.301595 -0.300876 -0.300157 -0.299437 -0.298716
- -0.29798 -0.297329 -0.296691 -0.295837 -0.29516 -0.294725
- -0.294044 -0.292917 -0.292351 -0.291965 -0.291365 -0.290687
- -0.290027 -0.289376 -0.288772 -0.288193 -0.287505 -0.286892
- -0.28626 -0.285714 -0.284545 -0.289246 -0.298717 -0.298492
- -0.214163 0.181451 0.0749974 0.0454707 0.0292987 0.0196837
- 0.0124119 0.00884715 0.00527181 0.00585821 0.0296361 0.169856
- 0.361207 0.538856 0.67469 0.685933 0.392802 0.17772 0.0813085
- 0.0424601 0.0246654 0.0175258 0.0144256 0.0129859 0.012205
- 0.0112846 0.010933 0.0134813 0.0147254 0.0147981 0.0142156
- 0.0132732 0.0121355 0.0109587 0.00981238 0.00872731 0.00767007
- 0.00669346 0.00581341 0.00502167 0.00431819 0.00369842 0.00316168
- 0.00269663 0.00230035 0.00195801 0.00166928 0.00142286 0.00121522
- 0.00104072 0.000893384 0.000767675 0.000661268 0.000567659
- 0.000481766 0.000407101 0.000350044 0.000302721 0.000263424
- 0.000236813 0.00022199 0.000218182 0.000219548 0.0002027
- 0.000185853 0.000169006 0.000152158 0.000135311 0.000118463
- 0.000101616 9.33782e-05 8.57685e-05 7.81588e-05 7.0549e-05
- 6.29393e-05 5.53296e-05 4.77199e-05 4.36954e-05 4.15296e-05
- 3.93637e-05 3.71978e-05 3.50319e-05 3.28661e-05 3.07002e-05
- 2.85343e-05 2.63685e-05 2.42026e-05 2.20367e-05 1.98709e-05
- 1.7705e-05 1.55391e-05 1.34772e-05 1.22416e-05 1.10061e-05
- 9.77055e-06 8.535e-06 0.000631271 -0.00362586 -0.0146235
- -0.0308486 -0.0237466 -0.0117522 -0.00304171 0.00251033
- 0.00531986 0.0063897 0.00657351 0.00636494 0.00599705 0.00553442
- 0.00505994 0.00330925 0.00246671 0.0027006 0.00473161 0.00830333
- 0.00649147 0.00356815 0.00217448 0.00187579 0.00270447 0.00219543
- -0.00546118 -0.0179576 -0.0445306 -0.0649309 0.0197935 0.473629
- 0.87268 0.269542 0.0086094 0.0844602 0.606456 1.04929 0.906014
- 0.916205 0.919425 0.872867 0.556244 0.262457 0.11838 0.0571226
- 0.0333451 0.0237133 0.0185096 0.0159617 0.0148663 0.0138683
- 0.0144081 0.0153797 0.0152551 0.0146487 0.0137192 0.0125973
- 0.0113996 0.0101903 0.00901851 0.00790495 0.00687502 0.00593994
- 0.00510092 0.00436111 0.00372439 0.0031945 0.00277537 0.00241888
- 0.002095 0.00179943 0.00150419 0.00119264 0.00090934 0.000802394
- 0.000852816 0.000838368 0.000730842 0.000601028 0.000546616
- 0.000492205 0.000437793 0.000383381 0.000328969 0.00029454
- 0.000266428 0.000238317 0.000210205 0.000182093 0.000162091
- 0.000152145 0.000142198 0.000132252 0.000122306 0.000112359
- 0.000102413 9.24665e-05 8.25201e-05 7.25738e-05 6.26274e-05
- 5.78553e-05 5.42216e-05 5.05878e-05 4.69541e-05 4.33204e-05
- 3.96867e-05 3.60529e-05 3.24192e-05 2.87855e-05 2.51518e-05
- 2.19153e-05 2.03406e-05 1.8766e-05 1.71913e-05 1.56167e-05
- 1.4042e-05 1.24674e-05 1.08927e-05 9.31806e-06
- EOD
-
- @v[36].set(<<-'EOD')
- 5 5.01426 5.02852 5.01923 4.77685 4.56471 4.52338 4.56813
- 4.63122 4.693 4.74776 4.79385 4.83258 4.86358 4.88918 4.91021
- 4.90553 4.89733 4.89554 4.91953 5.00757 5.07101 5.06318
- 5.05241 5.05535 5.08042 5.07251 4.90973 4.56136 3.98637
- 3.237 2.67216 2.33678 2.13529 2.00544 1.91429 1.84638 1.79461
- 1.75338 1.71958 1.69175 1.6686 1.64918 1.63258 1.61836 1.60607
- 1.59506 1.58483 1.57575 1.56847 1.56193 1.55538 1.54968
- 1.54416 1.5388 1.53523 1.53165 1.52807 1.52449 1.52091 1.51771
- 1.51477 1.51182 1.50888 1.50593 1.50309 1.50113 1.49917
- 1.4972 1.49524 1.49328 1.49132 1.48935 1.48739 1.48543 1.48346
- 1.48157 1.48012 1.47868 1.47724 1.47579 1.47435 1.47291
- 1.47146 1.47002 1.46857 1.46713 1.46574 1.46462 1.4635 1.46238
- 1.46126 1.46014 1.45902 1.4579 1.45678 1.45567 1.45455 1.45349
- 1.45275 1.45201 1.45127 1.45053 1.44979 1.44905 1.44831
- 1.44757 1.44683 1.44609 1.44535 1.44461 1.44387 1.44313
- 1.44239 1.44165 1.44091 1.44017 1.43943 1.43869 1.43795
- 1.43721 1.43874 1.43976 1.43619 1.43182 1.43726 1.43084
- 1.42587 1.42383 1.42642 1.42728 1.42736 1.4271 1.42669 1.42621
- 1.42569 1.41703 1.41244 1.41019 1.41199 1.41833 1.42502
- 1.41504 1.37535 1.28381 1.44779 2.33713 3.25835 3.67554
- 3.84975 4.01125 4.2253 4.45433 4.62215 4.74478 4.82998 4.8868
- 4.92396 4.94768 4.96498 4.98537 5.0128 5.04467 5.06722 5.06535
- 5.01475 4.91956 4.80647 4.7242 4.7059 4.73552 4.76379 4.81684
- 4.87376 4.92276 4.96112 4.9884 5.0045 5.00999 5.00933 5.00619
- 5.00384 5.00342 5.00373 5.00362 5.00309 5.00272 5.00239
- 5.00204 5.00172 5.00146 5.00124 5.00105 5.00089 5.00076
- 5.00065 5.00057 5.00048 5.00041 5.00034 5.00028 5.00023
- 5.00019 5.00015 5.00015 5.00016 5.0002 5.00023 5.00021 5.00019
- 5.00017 5.00015 5.00012 5.0001 5.00008 5.00007 5.00006 5.00005
- 5.00004 5.00003 5.00002 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002
- 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001
- 5.00001 5.00001 5.00062 4.99506 4.9835 4.96726 4.9728 4.97877
- 4.98675 4.9966 5.00406 5.00679 5.00629 5.00561 5.00487 5.00429
- 5.00384 5.002 5.00164 5.00229 5.00484 5.00769 5.00019 5.00242
- 5.01319 5.0335 5.07265 5.10129 5.11485 5.12551 5.13953 5.16048
- 5.18862 5.22811 5.25656 5.25627 5.19975 4.9139 4.24745 3.43732
- 2.8202 2.43224 2.17409 2.01333 1.93951 1.94622 1.98861 2.02217
- 2.05383 2.08376 2.11184 2.13793 2.16191 2.18267 2.20502
- 2.22837 2.24958 2.26901 2.28648 2.302 2.31582 2.32802 2.33869
- 2.34795 2.35596 2.36282 2.3687 2.37371 2.37797 2.38161 2.38476
- 2.38743 2.3897 2.39168 2.39329 2.39463 2.39575 2.39671 2.39756
- 2.39835 2.39907 2.39968 2.39999 2.4003 2.40061 2.40091 2.40122
- 2.40142 2.40159 2.40176 2.40193 2.4021 2.40222 2.40228 2.40234
- 2.4024 2.40247 2.40253 2.40259 2.40265 2.40271 2.40277 2.40284
- 2.40287 2.40289 2.40291 2.40294 2.40296 2.40298 2.40301
- 2.40303 2.40305 2.40308 2.4031 2.40311 2.40312 2.40313 2.40314
- 2.40315 2.40316 2.40317 2.40318
- EOD
-
- @v[37].set(<<-'EOD')
- 5 5.01732 5.03181 5.05944 5.12686 5.20725 5.28103 5.31254
- 5.32901 5.33709 5.3408 5.34257 5.34311 5.34347 5.34386 5.34411
- 5.3406 5.33484 5.32942 5.32904 5.33644 5.34869 5.35001 5.34882
- 5.34758 5.34672 5.34599 5.34496 5.34364 5.34165 5.33712
- 5.33502 5.3366 5.34067 5.34306 5.34398 5.34434 5.34442 5.34443
- 5.34443 5.34441 5.34439 5.34437 5.34437 5.34438 5.34438
- 5.34438 5.34438 5.34438 5.34437 5.34437 5.34436 5.34436
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437
- 5.34437 5.34437 5.34437 5.34437 5.34437 5.35377 5.35451
- 5.34265 5.34488 5.35861 5.28622 4.90033 4.75027 4.89731
- 4.97098 4.99293 4.99832 4.99909 4.99956 4.99858 4.99829
- 4.9998 5.00035 5.0038 5.00989 5.00251 4.99438 4.9953 4.99761
- 4.99985 5.00152 5.0011 5.00046 4.99996 4.99925 4.99862 4.99919
- 4.99961 5.00048 5.00234 4.99654 4.98235 4.95936 4.83738
- 4.53021 4.21004 4.00593 3.91207 3.88059 3.87822 3.89117
- 3.91278 3.94044 3.97376 4.01152 4.05052 4.10679 4.17908
- 4.25673 4.33414 4.40875 4.47879 4.54342 4.60258 4.65595
- 4.70291 4.74414 4.78018 4.81185 4.83915 4.86291 4.88301
- 4.90048 4.91528 4.92802 4.9387 4.94777 4.95539 4.9618 4.96725
- 4.97195 4.97588 4.97932 4.98247 4.98512 4.98697 4.98831
- 4.98919 4.99015 4.99101 4.99169 4.99222 4.99282 4.99341
- 4.994 4.9946 4.99519 4.99578 4.99638 4.99667 4.99693 4.9972
- 4.99747 4.99773 4.998 4.99827 4.99841 4.99849 4.99856 4.99864
- 4.99872 4.9988 4.99888 4.99896 4.99904 4.99911 4.99919 4.99927
- 4.99935 4.99943 4.9995 4.99955 4.9996 4.99965 4.9997 5.00736
- 4.98252 4.87516 4.66727 4.49142 4.43103 4.4301 4.4571 4.49729
- 4.5407 4.5835 4.62363 4.66114 4.69577 4.72738 4.74632 4.75971
- 4.77576 4.80671 4.87073 4.91665 4.93252 4.94418 4.95331
- 4.96094 4.96727 4.97148 4.97471 4.97612 4.98276 5.00247
- 5.04086 5.08628 5.10673 5.08887 5.0564 5.02767 5.01336 4.99685
- 4.97422 4.90866 4.67035 4.33117 4.07888 3.94432 3.89105
- 3.88174 3.89292 3.91442 3.94564 3.98708 4.0355 4.09134 4.16315
- 4.24088 4.31918 4.39527 4.46693 4.53337 4.59405 4.6486 4.69693
- 4.73938 4.77617 4.80809 4.83551 4.85895 4.87894 4.89596
- 4.91081 4.92417 4.93651 4.94552 4.95198 4.9565 4.96096 4.96523
- 4.96972 4.97428 4.97868 4.98064 4.9826 4.98455 4.98651 4.98847
- 4.98967 4.99064 4.9916 4.99257 4.99353 4.99422 4.99457 4.99493
- 4.99528 4.99563 4.99598 4.99633 4.99668 4.99703 4.99738
- 4.99773 4.9979 4.99804 4.99817 4.9983 4.99843 4.99856 4.99869
- 4.99883 4.99896 4.99909 4.99921 4.99926 4.99931 4.99937
- 4.99942 4.99948 4.99953 4.99959 4.99964
- EOD
-
- @v[38].set(<<-'EOD')
- 4.49849 4.53282 4.58329 4.66625 4.83345 4.97823 5.0207 5.01816
- 5.01116 5.00595 5.00296 5.00148 5.00073 5.00062 5.00033
- 5.0003 4.99864 4.99661 4.99652 4.99928 5.00361 5.12573 5.17251
- 5.22612 5.33479 5.44503 5.44432 5.44379 5.44334 5.443 5.44276
- 5.44258 5.44246 5.44238 5.44232 5.44228 5.44225 5.44223
- 5.44221 5.4422 5.44219 5.44219 5.44218 5.44218 5.44218 5.44218
- 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217
- 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217
- 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44216
- 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216
- 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216
- 5.44216 5.44216 5.44216 5.44216 5.44215 5.44215 5.44215
- 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215
- 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215
- 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215
- 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214
- 5.44214 5.44214 5.44214 5.44214 5.44212 5.45159 5.45236
- 5.44064 5.44307 5.45616 5.38122 4.77163 3.53297 2.74466
- 2.34448 2.11802 1.9783 1.88656 1.82001 1.77389 1.72955 1.69632
- 1.66971 1.6526 1.65236 1.56034 1.53764 1.97139 2.75096 3.39212
- 3.74042 3.82345 3.85696 3.88547 3.91862 3.9585 4.00467 4.05903
- 4.1254 4.19533 4.26791 4.34517 4.42112 4.49238 4.55807 4.6179
- 4.6713 4.71815 4.75889 4.79418 4.82456 4.85062 4.87291 4.89196
- 4.90823 4.92209 4.93388 4.9439 4.95242 4.95968 4.96585 4.97108
- 4.9755 4.97923 4.98237 4.98503 4.98732 4.98927 4.99094 4.99233
- 4.99353 4.99452 4.99538 4.99608 4.99668 4.99718 4.9976 4.99794
- 4.99822 4.99847 4.99867 4.99884 4.99899 4.99913 4.99924
- 4.99932 4.99938 4.99943 4.99947 4.99951 4.99953 4.99955
- 4.99958 4.99961 4.99964 4.99967 4.99969 4.99972 4.99975
- 4.99977 4.99978 4.99979 4.99981 4.99982 4.99983 4.99985
- 4.99986 4.99986 4.99987 4.99987 4.99988 4.99988 4.99988
- 4.99989 4.99989 4.9999 4.9999 4.99991 4.99991 4.99992 4.99992
- 4.99993 4.99993 4.99993 4.99994 5.00381 5.00064 4.99246
- 4.99823 5.00349 5.00076 5.00033 5.00015 5.00009 5.00007
- 5.00005 5.00004 5.00003 5.00002 4.99988 4.99732 4.99728
- 4.9978 5.00187 5.00927 5.08712 5.07654 4.92855 4.4863 3.76162
- 3.00049 2.49834 2.20883 2.03492 1.92384 1.84676 1.79021
- 1.74716 1.7132 1.68576 1.66309 1.64406 1.62785 1.61383 1.60162
- 1.59081 1.58117 1.57253 1.56473 1.55765 1.55117 1.54527
- 1.53988 1.53485 1.53012 1.5257 1.5216 1.51773 1.51411 1.51071
- 1.50746 1.50438 1.50146 1.49868 1.49603 1.4935 1.49109 1.48878
- 1.48657 1.48445 1.48242 1.48046 1.47858 1.47677 1.47502
- 1.47333 1.4717 1.47012 1.46859 1.46711 1.46568 1.46428 1.46292
- 1.4616 1.46034 1.45923 1.45812 1.45701 1.4559 1.45479 1.45378
- 1.45279 1.45181 1.45082 1.44983 1.44893 1.44813 1.44732
- 1.44652 1.44571 1.44491 1.4441 1.4433 1.44249 1.44169 1.44089
- 1.44019 1.43951 1.43883 1.43815 1.43747 1.4368 1.43612 1.43544
- 1.43476 1.43408 1.43342 1.43283 1.43223 1.43163 1.43104
- 1.43044 1.42984 1.42924 1.42865
- EOD
-
- @v[39].set(<<-'EOD')
- 5 5.01048 5.01221 4.98887 4.76261 4.54943 4.51564 4.56249
- 4.62621 4.68843 4.74374 4.79044 4.82972 4.86127 4.88724
- 4.90862 4.90791 4.89858 4.89589 4.91767 5.00405 5.16956
- 5.12391 4.7557 3.87953 3.01124 2.48482 2.20424 2.03812 1.92679
- 1.84956 1.79256 1.74907 1.71487 1.68724 1.6644 1.64513 1.6287
- 1.61446 1.60197 1.59095 1.58117 1.57245 1.5646 1.55752 1.55109
- 1.54516 1.53958 1.53444 1.53008 1.52606 1.52205 1.51843
- 1.5149 1.51146 1.50893 1.50639 1.50387 1.50133 1.4988 1.49651
- 1.49436 1.49222 1.49007 1.48793 1.48585 1.48433 1.4828 1.48128
- 1.47975 1.47823 1.4767 1.47518 1.47365 1.47213 1.4706 1.46912
- 1.46795 1.46678 1.46561 1.46444 1.46327 1.4621 1.46093 1.45976
- 1.45859 1.45741 1.45628 1.45534 1.45441 1.45347 1.45254
- 1.4516 1.45067 1.44973 1.4488 1.44786 1.44693 1.44604 1.44539
- 1.44475 1.4441 1.44345 1.44281 1.44216 1.44151 1.44086 1.44022
- 1.43957 1.43892 1.43828 1.43763 1.43698 1.43633 1.43569
- 1.43504 1.43439 1.43375 1.4331 1.43245 1.4318 1.43157 1.43089
- 1.43001 1.43042 1.42899 1.42439 1.42216 1.43447 1.44048
- 1.43705 1.43314 1.43039 1.42861 1.42739 1.42651 1.42548
- 1.42488 1.4243 1.42392 1.4235 1.32443 1.31149 1.78169 2.64844
- 3.43211 3.95252 4.20231 4.3746 4.49948 4.58929 4.65742 4.71183
- 4.77057 4.83196 4.88354 4.92894 4.96625 4.99235 5.00651
- 5.00941 5.00813 5.00689 5.00588 5.00504 5.00431 5.00368
- 5.00314 5.00268 5.00228 5.00194 5.00165 5.0014 5.00118 5.001
- 5.00085 5.00072 5.00061 5.00052 5.00044 5.00037 5.00031
- 5.00027 5.00022 5.00019 5.00016 5.00013 5.00011 5.00009
- 5.00008 5.00007 5.00006 5.00005 5.00004 5.00003 5.00003
- 5.00003 5.00002 5.00002 5.00002 5.00001 5.00001 5.00001
- 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001
- 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99998
- 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999
- 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001
- 5.00002 5.00003 5.00004 5.00022 4.99974 4.99942 4.99997
- 5.00063 5.00002 5.00003 4.99994 4.99998 4.99999 5 5 5 5
- 5 4.99981 4.99998 5.00004 5.00036 5.00049 5.12012 5.16315
- 5.19712 5.21835 4.87874 4.10151 3.31555 2.74207 2.38075
- 2.15872 2.01614 1.91886 1.84852 1.79401 1.75052 1.71508
- 1.68672 1.66467 1.64602 1.62985 1.61576 1.60343 1.59256
- 1.58287 1.57418 1.56632 1.55922 1.55282 1.54687 1.54132
- 1.53618 1.53143 1.52698 1.52282 1.51895 1.51527 1.5118 1.50851
- 1.5054 1.50244 1.49963 1.49695 1.4944 1.49196 1.48963 1.4874
- 1.48527 1.48322 1.48124 1.47934 1.47751 1.47574 1.47403
- 1.47239 1.4708 1.46926 1.46777 1.46632 1.46491 1.46355 1.46237
- 1.4612 1.46002 1.45884 1.45766 1.45659 1.45555 1.45451 1.45346
- 1.45242 1.45147 1.45062 1.44978 1.44894 1.44809 1.44725
- 1.4464 1.44556 1.44472 1.44387 1.44303 1.4423 1.44159 1.44088
- 1.44017 1.43947 1.43876 1.43805 1.43734 1.43664 1.43593
- 1.43524 1.43462 1.434 1.43338 1.43276 1.43213 1.43151 1.43089
- 1.43027
- EOD
- end
-
- def highlightTrace(graph)
- entry = graph.legend_get(:current)
- active_list = graph.legend_activate
- if active_list.include?(entry)
- graph.legend_deactivate(entry)
- graph.element_deactivate(entry)
- else
- graph.legend_activate(entry)
- graph.element_activate(entry)
- end
- end
-
-end
-
-BLT_Graph_Demo.new
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7.rb b/ext/tk/sample/tkextlib/blt/graph7.rb
deleted file mode 100644
index 27fbe53d97..0000000000
--- a/ext/tk/sample/tkextlib/blt/graph7.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-length = 250000
-graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
-graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
-graph.yaxis_configure(:title=>'Y Axis Label')
-graph.legend_configure(:activerelief=>:sunken, :background=>'')
-
-Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
-
-v_x = Tk::BLT::Vector.new(length)
-v_y = Tk::BLT::Vector.new(length)
-v_x.expr("random(#{v_x})")
-v_y.expr("random(#{v_y})")
-v_x.sort(v_y)
-
-plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
- :color=>'green4', :fill=>'green2',
- :linewidth=>0, :outlinewidth=>1,
- :pixels=>4, :label=>'plot',
- :xdata=>v_x, :ydata=>v_y)
-
-Tk.root.minsize(0, 0)
-
-#graph.zoom_stack
-#graph.crosshairs
-#graph.active_legend
-#graph.closest_point
-Tk::BLT.zoom_stack(graph)
-Tk::BLT.crosshairs(graph)
-Tk::BLT.active_legend(graph)
-Tk::BLT.closest_point(graph)
-
-Tk::BLT::Busy.hold(graph)
-Tk.update
-Tk::BLT::Busy.release(graph)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7a.rb b/ext/tk/sample/tkextlib/blt/graph7a.rb
deleted file mode 100644
index a014f72fc7..0000000000
--- a/ext/tk/sample/tkextlib/blt/graph7a.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-file = File.join(File.dirname(File.expand_path(__FILE__)),
- 'images', 'buckskin.gif')
-bgTexture = TkPhotoImage.new(:file=>file)
-
-TkOption.add('*Graph.Tile', bgTexture)
-TkOption.add('*Label.Tile', bgTexture)
-TkOption.add('*Frame.Tile', bgTexture)
-TkOption.add('*Htext.Tile', bgTexture)
-TkOption.add('*TileOffset', 0)
-TkOption.add('*HighlightThickness', 0)
-TkOption.add('*Element.ScaleSybols', false)
-TkOption.add('*Element.Smooth', :linear)
-TkOption.add('*activeLine.Color', 'yellow4')
-TkOption.add('*activeLine.Fill', 'yellow')
-TkOption.add('*activeLine.LineWidth', 0)
-TkOption.add('*Element.Pixels', 3)
-TkOption.add('*Graph.halo', '7i')
-
-if Tk.root.winfo_screenvisual != 'staticgray'
- TkOption.add('*print.background', 'yellow')
- TkOption.add('*quit.background', 'red')
-end
-
-length = 250000
-graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
-graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
-graph.yaxis_configure(:title=>'Y Axis Label')
-graph.legend_configure(:activerelief=>:sunken, :background=>'')
-
-Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
-
-v_x = Tk::BLT::Vector.new(length)
-v_y = Tk::BLT::Vector.new(length)
-v_x.expr("random(#{v_x})")
-v_y.expr("random(#{v_y})")
-v_x.sort(v_y)
-
-plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
- :color=>'green4', :fill=>'green2',
- :linewidth=>0, :outlinewidth=>1,
- :pixels=>4, :label=>'plot',
- :xdata=>v_x, :ydata=>v_y)
-
-Tk.root.minsize(0, 0)
-
-#graph.zoom_stack
-#graph.crosshairs
-#graph.active_legend
-#graph.closest_point
-Tk::BLT.zoom_stack(graph)
-Tk::BLT.crosshairs(graph)
-Tk::BLT.active_legend(graph)
-Tk::BLT.closest_point(graph)
-
-Tk::BLT::Busy.hold(graph)
-Tk.update
-Tk::BLT::Busy.release(graph)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7b.rb b/ext/tk/sample/tkextlib/blt/graph7b.rb
deleted file mode 100644
index c589f18d86..0000000000
--- a/ext/tk/sample/tkextlib/blt/graph7b.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-length = 250000
-graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
-graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
-graph.yaxis_configure(:title=>'Y Axis Label')
-graph.legend_configure(:activerelief=>:sunken, :background=>'')
-
-Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
-
-x = Array.new(length)
-y = Array.new(length)
-(0...length).each{|i|
- x[i] = rand
- y[i] = rand
-}
-
-plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
- :color=>'green4', :fill=>'green2',
- :linewidth=>0, :outlinewidth=>1,
- :pixels=>4, :label=>'plot',
- :xdata=>x, :ydata=>y)
-
-Tk.root.minsize(0, 0)
-
-#graph.zoom_stack
-#graph.crosshairs
-#graph.active_legend
-#graph.closest_point
-Tk::BLT.zoom_stack(graph)
-Tk::BLT.crosshairs(graph)
-Tk::BLT.active_legend(graph)
-Tk::BLT.closest_point(graph)
-
-Tk::BLT::Busy.hold(graph)
-Tk.update
-Tk::BLT::Busy.release(graph)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7c.rb b/ext/tk/sample/tkextlib/blt/graph7c.rb
deleted file mode 100644
index 495b66f4af..0000000000
--- a/ext/tk/sample/tkextlib/blt/graph7c.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-length = 250000
-graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
-graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
-graph.yaxis_configure(:title=>'Y Axis Label')
-graph.legend_configure(:activerelief=>:sunken, :background=>'')
-
-Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
-
-v_x = Tk::BLT::Vector.new(length)
-v_y = Tk::BLT::Vector.new(length)
-x = Array.new(length)
-y = Array.new(length)
-(0...length).each{|i|
- x[i] = rand
- y[i] = rand
-}
-v_x.set(x)
-v_y.set(y)
-
-plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
- :color=>'green4', :fill=>'green2',
- :linewidth=>0, :outlinewidth=>1,
- :pixels=>4, :label=>'plot',
- :xdata=>v_x, :ydata=>v_y)
-
-Tk.root.minsize(0, 0)
-
-#graph.zoom_stack
-#graph.crosshairs
-#graph.active_legend
-#graph.closest_point
-Tk::BLT.zoom_stack(graph)
-Tk::BLT.crosshairs(graph)
-Tk::BLT.active_legend(graph)
-Tk::BLT.closest_point(graph)
-
-Tk::BLT::Busy.hold(graph)
-Tk.update
-Tk::BLT::Busy.release(graph)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/images/buckskin.gif b/ext/tk/sample/tkextlib/blt/images/buckskin.gif
deleted file mode 100644
index e2d7be9d62..0000000000
--- a/ext/tk/sample/tkextlib/blt/images/buckskin.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/images/chalk.gif b/ext/tk/sample/tkextlib/blt/images/chalk.gif
deleted file mode 100644
index 30d29a7221..0000000000
--- a/ext/tk/sample/tkextlib/blt/images/chalk.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/images/qv100.t.gif b/ext/tk/sample/tkextlib/blt/images/qv100.t.gif
deleted file mode 100644
index 1e738ee86b..0000000000
--- a/ext/tk/sample/tkextlib/blt/images/qv100.t.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/images/rain.gif b/ext/tk/sample/tkextlib/blt/images/rain.gif
deleted file mode 100644
index d7bb417939..0000000000
--- a/ext/tk/sample/tkextlib/blt/images/rain.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/images/sample.gif b/ext/tk/sample/tkextlib/blt/images/sample.gif
deleted file mode 100644
index 1d8a4010c3..0000000000
--- a/ext/tk/sample/tkextlib/blt/images/sample.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/pareto.rb b/ext/tk/sample/tkextlib/blt/pareto.rb
deleted file mode 100644
index 94d5f3f97f..0000000000
--- a/ext/tk/sample/tkextlib/blt/pareto.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'tk'
-require 'tkextlib/blt'
-
-# Example of a pareto chart.
-#
-# The pareto chart mixes line and bar elements in the same graph.
-# Each processing operating is represented by a bar element. The
-# total accumulated defects is displayed with a single line element.
-b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection',
- :font=>'Helvetica 12', :plotpady=>[12, 4],
- :width=>'6i', :height=>'5i')
-Tk::BLT::Table.add(Tk.root, b, :fill=>:both)
-
-data = [
- ["Spot Weld", 82, 'yellow'],
- ["Lathe", 49, 'orange'],
- ["Gear Cut", 38, 'green'],
- ["Drill", 24, 'blue'],
- ["Grind", 17, 'red'],
- ["Lapping", 12, 'brown'],
- ["Press", 8, 'purple'],
- ["De-burr", 4, 'pink'],
- ["Packaging", 3, 'cyan'],
- ["Other", 12, 'magenta']
-]
-
-# Create an X-Y graph line element to trace the accumulated defects.
-b.line_create('accum', :label=>'', :symbol=>:none, :color=>'red')
-
-# Define a bitmap to be used to stipple the background of each bar.
-pattern1 = Tk::BLT::Bitmap.define([ [4, 4], [1, 2, 4, 8] ])
-
-# For each process, create a bar element to display the magnitude.
-count = 0
-sum = 0
-ydata = [0]
-xdata = [0]
-labels = []
-
-data.each{|label, value, color|
- count += 1
- b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color,
- :relief=>:solid, :borderwidth=>1, :stipple=>pattern1,
- :background=>'lightblue')
- labels[count] = label
- # Get the total number of defects.
- sum += value
- ydata << sum
- xdata << count
-}
-
-# Configure the coordinates of the accumulated defects,
-# now that we know what they are.
-b.element_configure('accum', :xdata=>xdata, :ydata=>ydata)
-
-# Add text markers to label the percentage of total at each point.
-xdata.zip(ydata){|x, y|
- percent = (y * 100.0) / sum
- if x == 0
- text = ' 0%'
- else
- text = '%.1f' % percent
- end
- b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10',
- :foreground=>'red4', :anchor=>:center, :yoffset=>-5)
-}
-
-# Display an auxillary y-axis for percentages.
-b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0,
- :title=>'Percentage')
-
-# Title the y-axis
-b.axis_configure('y', :title=>'Defects')
-
-# Configure the x-axis to display the process names, instead of numbers.
-b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0,
- :command=>proc{|w, val|
- val = val.round
- labels[val]? labels[val]: val
- })
-
-# No legend needed.
-b.legend_configure(:hide=>true)
-
-# Configure the grid lines.
-b.gridline_configure(:mapx=>:x, :color=>'lightblue')
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/plot1.rb b/ext/tk/sample/tkextlib/blt/plot1.rb
deleted file mode 100644
index 07dff48292..0000000000
--- a/ext/tk/sample/tkextlib/blt/plot1.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-graph = Tk::BLT::Graph.new.pack
-plot = Tk::BLT::PlotComponent::Element.new(graph, :linewidth=>0, :label=>'foo')
-plot.data([[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/plot1b.rb b/ext/tk/sample/tkextlib/blt/plot1b.rb
deleted file mode 100644
index eb41e361f9..0000000000
--- a/ext/tk/sample/tkextlib/blt/plot1b.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-graph = Tk::BLT::Graph.new.pack
-plot = graph.element_create
-plot.configure(:linewidth=>0, :label=>'foo',
- :data=>[[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten)
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/readme.txt b/ext/tk/sample/tkextlib/blt/readme.txt
deleted file mode 100644
index fe12dd88a3..0000000000
--- a/ext/tk/sample/tkextlib/blt/readme.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-The scripts and image files in this directory are based on demo files
-of Tcl/Tk's BLT extention.
diff --git a/ext/tk/sample/tkextlib/blt/scripts/stipples.rb b/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
deleted file mode 100644
index 47f3c4d063..0000000000
--- a/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-$stipples = {} unless $stipples
-
-$stipples['bdiagonal1'] = Tk::BLT::Bitmap.new(<<EOD)
-#define bdiagonal1_width 8
-#define bdiagonal1_height 8
-static unsigned char bdiagonal1_bits[] = {
- 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11};
-EOD
-
-$stipples['bdiagonal2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define bdiagonal2_width 8
-#define bdiagonal2_height 8
-static unsigned char bdiagonal2_bits[] = {
- 0x08, 0x04, 0x02, 0x01, 0x80, 0x40, 0x20, 0x10};
-EOD
-
-$stipples['checker2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define checker2_width 8
-#define checker2_height 8
-static unsigned char checker2_bits[] = {
- 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc};
-EOD
-
-
-$stipples['checker3'] = Tk::BLT::Bitmap.new(<<EOD)
-#define checker3_width 8
-#define checker3_height 8
-static unsigned char checker3_bits[] = {
- 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0};
-EOD
-
-$stipples['cross1'] = Tk::BLT::Bitmap.new(<<EOD)
-#define cross1_width 8
-#define cross1_height 8
-static unsigned char cross_bits[] = {
- 0xff, 0xaa, 0xff, 0xaa, 0xff, 0xaa, 0xff, 0xaa};
-EOD
-
-$stipples['cross2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define cross2_width 8
-#define cross2_height 8
-static unsigned char cross2_bits[] = {
- 0xff, 0x88, 0x88, 0x88, 0xff, 0x88, 0x88, 0x88};
-EOD
-
-$stipples['cross3'] = Tk::BLT::Bitmap.new(<<EOD)
-#define cross3_width 8
-#define cross3_height 8
-static unsigned char cross3_bits[] = {
- 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
-EOD
-
-$stipples['crossdiag'] = Tk::BLT::Bitmap.new(<<EOD)
-#define crossdiag_width 8
-#define crossdiag_height 8
-static unsigned char crossdiag2_bits[] = {
- 0x18, 0x24, 0x42, 0x81, 0x81, 0x42, 0x24, 0x18};
-EOD
-
-$stipples['dot1'] = Tk::BLT::Bitmap.new(<<EOD)
-#define dot1_width 8
-#define dot1_height 8
-static unsigned char dot1_bits[] = {
- 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa};
-EOD
-
-$stipples['dot2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define dot2_width 8
-#define dot2_height 8
-static unsigned char dot2_bits[] = {
- 0x55, 0x00, 0x55, 0x00, 0x55, 0x00, 0x55, 0x00};
-EOD
-
-$stipples['dot3'] = Tk::BLT::Bitmap.new(<<EOD)
-#define dot3_width 8
-#define dot3_height 8
-static unsigned char dot3_bits[] = {
- 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00};
-EOD
-
-$stipples['dot4'] = Tk::BLT::Bitmap.new(<<EOD)
-#define dot4_width 8
-#define dot4_height 8
-static unsigned char dot4_bits[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-EOD
-
-$stipples['fdiagonal1'] = Tk::BLT::Bitmap.new(<<EOD)
-#define fdiagonal1_width 8
-#define fdiagonal1_height 8
-static unsigned char fdiagonal1_bits[] = {
- 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88};
-EOD
-
-$stipples['fdiagonal2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define fdiagonal2_width 8
-#define fdiagonal2_height 8
-static unsigned char fdiagonal2_bits[] = {
- 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08};
-EOD
-
-$stipples['hline1'] = Tk::BLT::Bitmap.new(<<EOD)
-#define hline1_width 8
-#define hline1_height 8
-static unsigned char hline1_bits[] = {
- 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00};
-EOD
-
-$stipples['hline2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define hline2_width 8
-#define hline2_height 8
-static unsigned char hline2_bits[] = {
- 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00};
-EOD
-
-$stipples['lbottom'] = Tk::BLT::Bitmap.new(<<EOD)
-#define lbottom_width 8
-#define lbottom_height 8
-static unsigned char lbottom_bits[] = {
- 0x00, 0x11, 0x11, 0x77, 0x00, 0x11, 0x11, 0x77};
-EOD
-
-$stipples['ltop'] = Tk::BLT::Bitmap.new(<<EOD)
-#define ltop_width 8
-#define ltop_height 8
-static unsigned char ltop_bits[] = {
- 0xee, 0x88, 0x88, 0x00, 0xee, 0x88, 0x88, 0x00};
-EOD
-
-$stipples['rbottom'] = Tk::BLT::Bitmap.new(<<EOD)
-#define rbottom_width 8
-#define rbottom_height 8
-static unsigned char rbottom_bits[] = {
- 0x00, 0x88, 0x88, 0xee, 0x00, 0x88, 0x88, 0xee};
-EOD
-
-$stipples['rtop'] = Tk::BLT::Bitmap.new(<<EOD)
-#define rtop_width 8
-#define rtop_height 8
-static unsigned char rtop_bits[] = {
- 0x77, 0x11, 0x11, 0x00, 0x77, 0x11, 0x11, 0x00};
-EOD
-
-$stipples['vline1'] = Tk::BLT::Bitmap.new(<<EOD)
-#define vline1_width 8
-#define vline1_height 8
-static unsigned char vline1_bits[] = {
- 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
-EOD
-
-$stipples['vline2'] = Tk::BLT::Bitmap.new(<<EOD)
-#define vline2_width 8
-#define vline2_height 8
-static unsigned char vline2_bits[] = {
- 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33};
-EOD
diff --git a/ext/tk/sample/tkextlib/blt/winop1.rb b/ext/tk/sample/tkextlib/blt/winop1.rb
deleted file mode 100644
index e94138cd94..0000000000
--- a/ext/tk/sample/tkextlib/blt/winop1.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-file = File.join(File.dirname(File.expand_path(__FILE__)),
- 'images', 'sample.gif')
-if File.exist?(file)
- src = TkPhotoImage.new(:file=>file)
-else
- fail RuntimeError, 'no image file'
-end
-
-width = src.width
-height = src.height
-
-TkOption.add('*Label.font', '*helvetica*10*')
-TkOption.add('*Label.background', 'white')
-
-l_img0 = TkLabel.new(:image=>src)
-l_hdr0 = TkLabel.new(:text=>"#{width} x #{height}")
-l_ftr0 = TkLabel.new(:text=>'100%')
-Tk.root.background('white')
-
-(2..10).each{|i|
- iw = width/i
- ih = height/i
- r = '%6g'%(100.0/i)
- dst = TkPhotoImage.new(:width=>iw, :height=>ih)
- Tk::BLT::Winop.image_resample(src, dst, :sinc)
- l_hdr = TkLabel.new(:text=>"#{iw} x #{ih}")
- l_ftr = TkLabel.new(:text=>"#{r}%")
- l_img = TkLabel.new(:image=>dst)
- Tk::BLT::Table.add(Tk.root,
- [0,i], l_hdr,
- [1,i], l_img,
- [2,i], l_ftr)
- Tk.update
-}
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/winop2.rb b/ext/tk/sample/tkextlib/blt/winop2.rb
deleted file mode 100644
index 1f674ee893..0000000000
--- a/ext/tk/sample/tkextlib/blt/winop2.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env ruby
-require 'tk'
-require 'tkextlib/blt'
-
-file = File.join(File.dirname(File.expand_path(__FILE__)),
- 'images', 'qv100.t.gif')
-if File.exist?(file)
- src = TkPhotoImage.new(:file=>file)
-else
- fail RuntimeError, 'no image file'
-end
-
-width = src.width
-height = src.height
-
-TkOption.add('*Label.font', '*helvetica*10*')
-TkOption.add('*Label.background', 'white')
-
-[0, 90, 180, 270, 360, 45].each_with_index{|r, i|
- dest = TkPhotoImage.new
- Tk::BLT::Winop.image_rotate(src, dest, r)
- l_txt = TkLabel.new(:text=>"#{r} degrees")
- l_img = TkLabel.new(:image=>dest)
- Tk::BLT::Table.add(Tk.root, [0,i], l_img, [1,i], l_txt)
- Tk.update
-}
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/bwidget/tree.rb b/ext/tk/sample/tkextlib/bwidget/tree.rb
index e1fcaa774f..2b33962fa6 100644
--- a/ext/tk/sample/tkextlib/bwidget/tree.rb
+++ b/ext/tk/sample/tkextlib/bwidget/tree.rb
@@ -119,7 +119,7 @@ module DemoTree
Tk.root.bind_remove('Unmap')
Tk.root.bind_remove('Map')
Tk.root.bind_remove('Configure')
- true
+ return true
})
end
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb
index ddb08d8b78..c83ae37248 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb
@@ -3,11 +3,11 @@ require 'tk'
require 'tkextlib/iwidgets'
def get_files(file)
- dir = (file.empty?)? ENV['HOME'] : TkComm._fromUTF8(file)
+ dir = (file.empty?)? ENV['HOME'] : file
Dir.chdir(dir) rescue return ''
- Dir['*'].sort.collect{|f|
- [TkComm._toUTF8(File.join(dir, f)), TkComm._toUTF8(f)]
- }
+ rlist = []
+ Dir['*'].sort.each{|f| rlist << File.join(dir, f) }
+ rlist
end
Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)},
diff --git a/ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt b/ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt
deleted file mode 100644
index 2326ef21fa..0000000000
--- a/ext/tk/sample/tkextlib/tile/Orig_LICENSE.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-
- ######################################################################
- ### The following text is the original 'license.terms' of tile ###
- ### extension. ###
- ######################################################################
-
-
-LICENSE ("MIT-style")
-
-This software is Copyright (C) 2003 Joe English and other parties.
-
-The following terms apply to all files associated with this software
-unless explicitly disclaimed in individual files.
-
-The author(s) hereby grant permission to use, copy, modify, distribute,
-and license this software and its documentation for any purpose, provided
-that existing copyright notices are retained in all copies and that this
-notice is included in any distributions. No written agreement,
-license, or royalty fee is required for any of the authorized uses.
-Modifications to this software may be copyrighted by their authors
-and need not follow the licensing terms described here, provided that
-the new terms are clearly indicated on the first page of each file where
-they apply.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS for a PARTICULAR PURPOSE. IN NO EVENT
-shall the AUTHORS of THIS SOFTWARE be LIABLE to ANY PARTY for
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, or CONSEQUENTIAL DAMAGES
-arising out of the USE of THIS SOFTWARE and its DOCUMENTATION.
diff --git a/ext/tk/sample/tkextlib/tile/demo.rb b/ext/tk/sample/tkextlib/tile/demo.rb
deleted file mode 100644
index b604410da4..0000000000
--- a/ext/tk/sample/tkextlib/tile/demo.rb
+++ /dev/null
@@ -1,972 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Demo for 'tile' package.
-#
-require 'tk'
-
-demodir = File.dirname($0)
-themesdir = File.join(demodir, 'themes')
-Tk::AUTO_PATH.lappend('.', demodir, themesdir)
-
-Dir.foreach(themesdir){|name|
- next if name == '.' || name == '..'
- dir = File.join(themesdir, name)
- Tk::AUTO_PATH.lappend(dir) if File.directory?(dir)
-}
-
-require 'tkextlib/tile'
-
-def version?(ver)
- TkPackage.vcompare(Tk::Tile.package_version, ver) >= 0
-end
-
-Tk.load_tclscript(File.join(demodir, 'toolbutton.tcl'))
-Tk.load_tclscript(File.join(demodir, 'repeater.tcl'))
-
-# This forces an update of the available packages list. It's required
-# for package names to find the themes in demos/themes/*.tcl
-## Tk.tk_call(TkPackage.unknown_proc, 'Tcl', TkPackage.provide('Tcl'))
-## --> This doesn't work.
-## Because, unknown_proc may be "command + some arguments".
-Tk.ip_eval("#{TkPackage.unknown_proc} Tcl #{TkPackage.provide('Tcl')}")
-
-TkRoot.new{
- title 'Tile demo'
- iconname 'Tile demo'
-}
-
-# The descriptive names of the builtin themes.
-$THEMELIST = [
- ['default', 'Default'],
- ['classic', 'Classic'],
- ['alt', 'Revitalized'],
- ['winnative', 'Windows native'],
- ['xpnative', 'XP Native'],
- ['aqua', 'Aqua'],
-]
-
-$V = TkVariable.new_hash(:THEME => 'default',
- :COMPOUND => 'top',
- :CONSOLE => false,
- :MENURADIO1 => 'One',
- :MENUCHECK1 => true,
- :PBMODE => 'determinate',
- :SELECTED => true,
- :CHOICE => 2)
-
-# Add in any available loadable themes.
-TkPackage.names.find_all{|n| n =~ /^tile::theme::/}.each{|pkg|
- name = pkg.split('::')[-1]
- unless $THEMELIST.assoc(name)
- $THEMELIST << [name, Tk.tk_call('string', 'totitle', name)]
- end
-}
-
-# Add theme definition written by ruby
-$RUBY_THEMELIST = []
-begin
- load(File.join(demodir, 'themes', 'kroc.rb'), true)
-rescue
- $RUBY_THEMELIST << ['kroc-rb', 'Kroc (by Ruby)', false]
-else
- $RUBY_THEMELIST << ['kroc-rb', 'Kroc (by Ruby)', true]
-end
-
-def makeThemeControl(parent)
- c = Tk::Tile::Labelframe.new(parent, :text=>'Theme')
- $THEMELIST.each{|theme, name|
- b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme,
- :variable=>$V.ref(:THEME),
- :command=>proc{setTheme(theme)})
- b.grid(:sticky=>:ew)
- unless (TkPackage.names.find{|n| n == "tile::theme::#{theme}"})
- b.state(:disabled)
- end
- }
- $RUBY_THEMELIST.each{|theme, name, available|
- b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme,
- :variable=>$V.ref(:THEME),
- :command=>proc{setTheme(theme)})
- b.grid(:sticky=>:ew)
- b.state(:disabled) unless available
- }
- c
-end
-
-def makeThemeMenu(parent)
- m = TkMenu.new(parent)
- $THEMELIST.each{|theme, name|
- m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME),
- :value=>theme, :command=>proc{setTheme(theme)})
- unless (TkPackage.names.find{|n| n == "tile::theme::#{theme}"})
- m.entryconfigure(:end, :state=>:disabled)
- end
- }
- $RUBY_THEMELIST.each{|theme, name, available|
- m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME),
- :value=>theme, :command=>proc{setTheme(theme)})
- m.entryconfigure(:end, :state=>:disabled) unless available
- }
- m
-end
-
-def setTheme(theme)
- if (TkPackage.names.find{|n| n == "tile::theme::#{theme}"})
- TkPackage.require("tile::theme::#{theme}")
- end
- Tk::Tile::Style.theme_use(theme)
-end
-
-#
-# Load icons...
-#
-$BUTTONS = ['open', 'new', 'save']
-$CHECKBOXES = ['bold', 'italic']
-$ICON = {}
-
-def loadIcons(file)
- Tk.load_tclscript(file)
- img_data = TkVarAccess.new('ImgData')
- img_data.keys.each{|icon|
- $ICON[icon] = TkPhotoImage.new(:data=>img_data[icon])
- }
-end
-
-loadIcons(File.join(demodir, 'iconlib.tcl'))
-
-#
-# Utilities:
-#
-def foreachWidget(wins, cmd)
- wins.each{|w|
- cmd.call(w)
- foreachWidget(w.winfo_children, cmd)
- }
-end
-
-# sbstub
-# Used as the :command option for a scrollbar,
-# updates the scrollbar's position.
-#
-def sbstub(sb, cmd, num, units = 'units')
- num = TkComm.number(num)
- case cmd.to_s
- when 'moveto'
- sb.set(num, num+0.5)
-
- when 'scroll'
- if units.to_s == 'pages'
- delta = 0.2
- else
- delta = 0.05
- end
- current = sb.get
- sb.set(current[0] + delta * num, current[1] + delta * num)
- end
-end
-
-# ... for debugging:
-TkBindTag::ALL.bind('ButtonPress-3', proc{|w| $W = w}, '%W')
-TkBindTag::ALL.bind('Control-ButtonPress-3', proc{|w| w.set_focus}, '%W')
-
-def showHelp()
- Tk.messageBox(:message=>'No help yet...')
-end
-
-#
-# See toolbutton.tcl.
-TkOption.add('*Toolbar.relief', :groove)
-TkOption.add('*Toolbar.borderWidth', 2)
-
-TkOption.add('*Toolbar.Button.Pad', 2)
-
-$ROOT = Tk.root
-$BASE = $ROOT
-Tk.destroy(*($ROOT.winfo_children))
-
-$TOOLBARS = []
-
-#
-# Toolbar button standard vs. tile comparison:
-#
-def makeToolbars
- #
- # Tile toolbar:
- #
- tb = Tk::Tile::Frame.new($BASE, :class=>'Toolbar')
- $TOOLBARS << tb
- i = 0
- $BUTTONS.each{|icon|
- i += 1
- Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon],
- :compound=>$V[:COMPOUND],
- :style=>:Toolbutton).grid(:row=>0, :column=>i,
- :sticky=>:news)
- }
- $CHECKBOXES.each{|icon|
- i += 1
- Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon],
- :variable=>$V.ref(icon),
- :compound=>$V[:COMPOUND],
- :style=>:Toolbutton).grid(:row=>0, :column=>i,
- :sticky=>:news)
- }
-
- mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'],
- :compound=>$V[:COMPOUND])
- mb.configure(:menu=>makeCompoundMenu(mb))
- i += 1
- mb.grid(:row=>0, :column=>i, :sticky=>:news)
-
- i += 1
- tb.grid_columnconfigure(i, :weight=>1)
-
- #
- # Standard toolbar:
- #
- tb = TkFrame.new($BASE, :class=>'Toolbar')
- $TOOLBARS << tb
- i = 0
- $BUTTONS.each{|icon|
- i += 1
- TkButton.new(tb, :text=>icon, :image=>$ICON[icon],
- :compound=>$V[:COMPOUND], :relief=>:flat,
- :overrelief=>:raised).grid(:row=>0, :column=>i,
- :sticky=>:news)
- }
- $CHECKBOXES.each{|icon|
- i += 1
- TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon],
- :variable=>$V.ref(icon), :compound=>$V[:COMPOUND],
- :indicatoron=>false, :selectcolor=>'', :relief=>:flat,
- :overrelief=>:raised).grid(:row=>0, :column=>i,
- :sticky=>:news)
- }
-
- mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'],
- :compound=>$V[:COMPOUND])
- mb.configure(:menu=>makeCompoundMenu(mb))
- i += 1
- mb.grid(:row=>0, :column=>i, :sticky=>:news)
-
- i += 1
- tb.grid_columnconfigure(i, :weight=>1)
-end
-
-#
-# Toolbar :compound control:
-#
-def makeCompoundMenu(mb)
- menu = TkMenu.new(mb)
- %w(text image none top bottom left right center).each{|str|
- menu.add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str),
- :variable=>$V.ref(:COMPOUND), :value=>str,
- :command=>proc{ changeToolbars() })
- }
- menu
-end
-
-makeToolbars()
-
-## CONTROLS
-control = Tk::Tile::Frame.new($BASE)
-
-#
-# Overall theme control:
-#
-makeThemeControl(control).grid(:sticky=>:news, :padx=>6, :ipadx=>6)
-control.grid_rowconfigure(99, :weight=>1)
-
-def changeToolbars
- foreachWidget($TOOLBARS,
- proc{|w|
- begin
- w.compound($V[:COMPOUND])
- rescue
- end
- })
-end
-
-def scrolledWidget(parent, klass, themed, *args)
- if themed
- f = Tk::Tile::Frame.new(parent)
- t = klass.new(f, *args)
- vs = Tk::Tile::Scrollbar.new(f)
- hs = Tk::Tile::Scrollbar.new(f)
- else
- f = TkFrame.new(parent)
- t = klass.new(f, *args)
- vs = TkScrollbar.new(f)
- hs = TkScrollbar.new(f)
- end
- t.yscrollbar(vs)
- t.xscrollbar(hs)
-
- TkGrid.configure(t, vs, :sticky=>:news)
- TkGrid.configure(hs, 'x', :sticky=>:news)
- TkGrid.rowconfigure(f, 0, :weight=>1)
- TkGrid.columnconfigure(f, 0, :weight=>1)
-
- [f, t]
-end
-
-#
-# Notebook demonstration:
-#
-def makeNotebook
- nb = Tk::Tile::Notebook.new($BASE, :padding=>6)
- nb.enable_traversal
- client = Tk::Tile::Frame.new(nb)
- nb.add(client, :text=>'Demo', :underline=>0)
- nb.select(client)
-
- scales = Tk::Tile::Frame.new(nb)
- nb.add(scales, :text=>'Scales')
- combo = Tk::Tile::Frame.new(nb)
- nb.add(combo, :text=>'Combobox', :underline=>7)
- tree = Tk::Tile::Frame.new(nb)
- nb.add(tree, :text=>'Tree')
- others = Tk::Tile::Frame.new(nb)
- nb.add(others, :text=>'Others', :underline=>4)
-
- [nb, client, scales, combo, tree, others]
-end
-
-nb, client, scales, combo, tree, others = makeNotebook()
-
-#
-# Side-by side check, radio, and menu button comparison:
-#
-def fillMenu(menu)
- %w(above below left right flush).each{|dir|
- menu.add(:command, :label=>Tk.tk_call('string', 'totitle', dir),
- :command=>proc{ menu.winfo_parent.direction(dir) })
- }
- menu.add(:cascade, :label=>'Submenu', :menu=>(submenu = TkMenu.new(menu)))
- submenu.add(:command, :label=>'Subcommand 1')
- submenu.add(:command, :label=>'Subcommand 2')
- submenu.add(:command, :label=>'Subcommand 3')
-
- menu.add(:separator)
- menu.add(:command, :label=>'Quit', :command=>proc{Tk.root.destroy})
-end
-
-l = Tk::Tile::Labelframe.new(client, :text=>'Themed', :padding=>6)
-r = TkLabelframe.new(client, :text=>'Standard', :padx=>6, :pady=>6)
-
-## Styled frame
-cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton',
- :variable=>$V.ref(:SELECTED), :underline=>2)
-rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE),
- :value=>1, :underline=>0)
-rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE),
- :value=>2)
-rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three',
- :variable=>$V.ref(:CHOICE),
- :value=>3, :underline=>0)
-btn = Tk::Tile::Button.new(l, :text=>'Button', :underline=>0)
-
-mb = Tk::Tile::Menubutton.new(l, :text=>'Menubutton', :underline=>2)
-m = TkMenu.new(mb)
-mb.menu(m)
-fillMenu(m)
-
-$entryText = TkVariable.new('Entry widget')
-e = Tk::Tile::Entry.new(l, :textvariable=>$entryText)
-e.selection_range(6, :end)
-
-ltext_f, ltext = scrolledWidget(l, TkText, true,
- :width=>12, :height=>5, :wrap=>:none)
-# NOTE TO MAINTAINERS:
-# The checkbuttons are -sticky ew / -expand x on purpose:
-# it demonstrates one of the differences between TCheckbuttons
-# and standard checkbuttons.
-#
-Tk.grid(cb, :sticky=>:ew)
-Tk.grid(rb1, :sticky=>:ew)
-Tk.grid(rb2, :sticky=>:ew)
-Tk.grid(rb3, :sticky=>:ew)
-Tk.grid(btn, :sticky=>:ew, :padx=>2, :pady=>2)
-Tk.grid(mb, :sticky=>:ew, :padx=>2, :pady=>2)
-Tk.grid(e, :sticky=>:ew, :padx=>2, :pady=>2)
-Tk.grid(ltext_f, :sticky=>:news)
-
-TkGrid.columnconfigure(l, 0, :weight=>1)
-TkGrid.rowconfigure(l, 7, :weight=>1) # text widget (grid is a PITA)
-
-## Orig frame
-cb = TkCheckbutton.new(r, :text=>'Checkbutton', :variable=>$V.ref(:SELECTED))
-rb1 = TkRadiobutton.new(r, :text=>'One',
- :variable=>$V.ref(:CHOICE), :value=>1)
-rb2 = TkRadiobutton.new(r, :text=>'Two', :variable=>$V.ref(:CHOICE),
- :value=>2, :underline=>1)
-rb3 = TkRadiobutton.new(r, :text=>'Three',
- :variable=>$V.ref(:CHOICE), :value=>3)
-btn = TkButton.new(r, :text=>'Button')
-
-mb = TkMenubutton.new(r, :text=>'Menubutton', :underline=>3, :takefocus=>true)
-m = TkMenu.new(mb)
-mb.menu(m)
-$V[:rmbIndicatoron] = mb.indicatoron
-m.add(:checkbutton, :label=>'Indicator?', #'
- :variable=>$V.ref(:rmbIndicatoron),
- :command=>proc{mb.indicatoron($V[:rmbIndicatoron])})
-m.add(:separator)
-fillMenu(m)
-
-e = TkEntry.new(r, :textvariable=>$entryText)
-
-rtext_f, rtext = scrolledWidget(r, TkText, false,
- :width=>12, :height=>5, :wrap=>:none)
-
-Tk.grid(cb, :sticky=>:ew)
-Tk.grid(rb1, :sticky=>:ew)
-Tk.grid(rb2, :sticky=>:ew)
-Tk.grid(rb3, :sticky=>:ew)
-Tk.grid(btn, :sticky=>:ew, :padx=>2, :pady=>2)
-Tk.grid(mb, :sticky=>:ew, :padx=>2, :pady=>2)
-Tk.grid(e, :sticky=>:ew, :padx=>2, :pady=>2)
-Tk.grid(rtext_f, :sticky=>:news)
-
-TkGrid.columnconfigure(l, 0, :weight=>1)
-TkGrid.rowconfigure(l, 7, :weight=>1) # text widget (grid is a PITA)
-
-Tk.grid(l, r, :sticky=>:news, :padx=>6, :pady=>6)
-TkGrid.rowconfigure(client, 0, :weight=>1)
-TkGrid.columnconfigure(client, [0, 1], :weight=>1)
-
-#
-# Add some text to the text boxes:
-#
-msgs = [
-"The cat crept into the crypt, crapped and crept out again",
-"Peter Piper picked a peck of pickled peppers",
-"How much wood would a woodchuck chuck if a woodchuck could chuck wood",
-"He thrusts his fists against the posts and still insists he sees the ghosts",
-"Who put the bomb in the bom-b-bom-b-bom,",
-"Is this your sister's sixth zither, sir?",
-"Who put the ram in the ramalamadingdong?",
-"I am not the pheasant plucker, I'm the pheasant plucker's mate."
-]
-
-nmsgs = msgs.size
-(0...50).each{|n|
- msg = msgs[n % nmsgs]
- ltext.insert(:end, "#{n}: #{msg}\n")
- rtext.insert(:end, "#{n}: #{msg}\n")
-}
-#
-# Scales and sliders pane:
-#
-l = Tk::Tile::Labelframe.new(scales, :text=>'Themed', :padding=>6)
-r = TkLabelframe.new(scales, :text=>'Standard', :padx=>6, :pady=>6)
-
-if version?('0.6')
-
- # thremed frame
- scale = Tk::Tile::Scale.new(l, :orient=>:horizontal, :from=>0, :to=>100,
- :variable=>$V.ref(:SCALE))
- vscale = Tk::Tile::Scale.new(l, :orient=>:vertical, :from=>0, :to=>100,
- :variable=>$V.ref(:VSCALE))
- progress = Tk::Tile::Progressbar.new(l, :orient=>:horizontal, :maximum=>100)
- vprogress = Tk::Tile::Progressbar.new(l, :orient=>:vertical, :maximum=>100)
-
- if true
- def progress.inverted(w, value)
- if w.mode == 'indeterminate'
- w.value(value)
- else
- w.value(w.maximum - value)
- end
- end
- scale.command {|value| progress.value(value)}
- vscale.command {|value| progress.inverted(vprogress, value) }
- else
- # This would also work, but the Tk scale widgets
- # in the right hand pane cause some interference when
- # in autoincrement/indeterminate mode.
- #
- progress.variable $V.ref(:SCALE)
- vprogress.variable $V.ref(:VSCALE)
- end
-
- scale.set(50)
- vscale.set(50)
-
- lmode = Tk::Tile::Label.new(l, :text=>'Progress bar mode')
- pbmode0 = Tk::Tile::Radiobutton.new(l, :variable=>$V.ref(:PBMODE),
- :text=>'determinate', :value=>'determinate',
- :command=>proc{pbMode(progress, vprogress)})
- pbmode1 = Tk::Tile::Radiobutton.new(l, :variable=>$V.ref(:PBMODE),
- :text=>'indeterminate', :value=>'indeterminate',
- :command=>proc{pbMode(progress, vprogress)})
- def pbMode(progress, vprogress)
- if vprogress.mode != $V[:PBMODE]
- vprogress.value(vprogress.maximum - vprogress.value)
- end
-
- progress.mode $V[:PBMODE]
- vprogress.mode $V[:PBMODE]
- end
-
- start = Tk::Tile::Button.new(l, :text=>"Start",
- :command=>proc{pbStart(progress, vprogress)})
- def pbStart(progress, vprogress)
- # $V[:PBMODE] = 'indeterminate'
- pbMode(progress, vprogress)
- progress.start 10
- vprogress.start
- end
-
- stop = Tk::Tile::Button.new(l, :text=>'Stop',
- :command=>proc{pbStop(progress, vprogress)})
- def pbStop(progress, vprogress)
- progress.stop
- vprogress.stop
- end
-
- Tk.grid(scale, :columnspan=>2, :sticky=>'ew')
- Tk.grid(progress, :columnspan=>2, :sticky=>'ew')
- Tk.grid(vscale, vprogress, :sticky=>'nws')
-
- Tk.grid(lmode, :sticky=>'we', :columnspan=>2)
- Tk.grid(pbmode0, :sticky=>'we', :columnspan=>2)
- Tk.grid(pbmode1, :sticky=>'we', :columnspan=>2)
- Tk.grid(start, :sticky=>'we', :columnspan=>2)
- Tk.grid(stop, :sticky=>'we', :columnspan=>2)
-
- l.grid_columnconfigure(0, :weight=>1)
- l.grid_columnconfigure(1, :weight=>1)
- l.grid_rowconfigure(99, :weight=>1)
-
- # standard frame
- TkScale.new(r, :orient=>:horizontal, :from=>0, :to=>100,
- :variable=>$V.ref(:SCALE)).grid(:sticky=>'news')
- TkScale.new(r, :orient=>:vertical, :from=>0, :to=>100,
- :variable=>$V.ref(:VSCALE)).grid(:sticky=>'nws')
-
- r.grid_columnconfigure(0, :weight=>1)
- r.grid_columnconfigure(1, :weight=>1)
- r.grid_rowconfigure(99, :weight=>1)
-
-else # tile 0.5 or earlier
-
- # themed frame
- scale = Tk::Tile::Scale.new(l, :variable=>$V.ref(:SCALE),
- :orient=>:horizontal, :from=>0, :to=>100)
- vscale = Tk::Tile::Scale.new(l, :variable=>$V.ref(:VSCALE),
- :orient=>:vertical, :from=>-25, :to=>25)
-
- progress = Tk::Tile::Progress.new(l,
- :orient=>:horizontal, :from=>0, :to=>100)
- vprogress = Tk::Tile::Progress.new(l,
- :orient=>:vertical, :from=>-25, :to=>25)
-
- if true
- scale.command{|value| progress.set(value)}
- vscale.command{|value| vprogress.set(value)}
- else # this would also work. (via TkVariable#trace)
- v1 = scale.variable
- v2 = vscale.variable
- v1.trace('w', proc{ progress.set(v1.value) })
- v2.trace('w', proc{ vprogress.set(v2.value) })
- end
-
- Tk.grid(scale, :columnspan=>2, :sticky=>:ew)
- Tk.grid(progress, :columnspan=>2, :sticky=>:ew)
- Tk.grid(vscale, vprogress, :sticky=>:nws)
- TkGrid.columnconfigure(l, 0, :weight=>1)
- TkGrid.columnconfigure(l, 1, :weight=>1)
-
- # standard frame
- TkScale.new(r, :variable=>$V.ref(:SCALE),
- :orient=>:horizontal, :from=>0, :to=>100).grid(:sticky=>'news')
- TkScale.new(r, :variable=>$V.ref(:VSCALE),
- :orient=>:vertical, :from=>-25, :to=>25).grid(:sticky=>'nws')
-
- TkGrid.columnconfigure(r, 0, :weight=>1)
- TkGrid.columnconfigure(r, 1, :weight=>1)
-end
-
-# layout frames
-Tk.grid(l, r, :sticky=>'nwes', :padx=>6, :pady=>6)
-scales.grid_columnconfigure(0, :weight=>1)
-scales.grid_columnconfigure(1, :weight=>1)
-scales.grid_rowconfigure(0, :weight=>1)
-
-#
-# Command box:
-#
-cmd = Tk::Tile::Frame.new($BASE)
-b_close = Tk::Tile::Button.new(cmd, :text=>'Close',
- :underline=>0, :default=>:normal,
- :command=>proc{Tk.root.destroy})
-b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0,
- :default=>:normal, :command=>proc{showHelp()})
-Tk.grid('x', b_close, b_help, :pady=>[6, 4], :padx=>4)
-TkGrid.columnconfigure(cmd, 0, :weight=>1)
-
-#
-# Set up accelerators:
-#
-$ROOT.bind('KeyPress-Escape', proc{Tk.event_generate(b_close, '<Invoke>')})
-$ROOT.bind('<Help>', proc{Tk.event_generate(b_help, '<Invoke>')})
-Tk::Tile::KeyNav.enableMnemonics($ROOT)
-Tk::Tile::KeyNav.defaultButton(b_help)
-
-Tk.grid($TOOLBARS[0], '-', :sticky=>:ew)
-Tk.grid($TOOLBARS[1], '-', :sticky=>:ew)
-Tk.grid(control, nb, :sticky=>:news)
-Tk.grid(cmd, '-', :sticky=>:ew)
-TkGrid.columnconfigure($ROOT, 1, :weight=>1)
-TkGrid.rowconfigure($ROOT, 2, :weight=>1)
-
-#
-# Add a menu
-#
-menu = TkMenu.new($BASE)
-$ROOT.menu(menu)
-m_file = TkMenu.new(menu, :tearoff=>0)
-menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file)
-m_file.add(:command, :label=>'Open', :underline=>0,
- :compound=>:left, :image=>$ICON['open'])
-m_file.add(:command, :label=>'Save', :underline=>0,
- :compound=>:left, :image=>$ICON['save'])
-m_file.add(:separator)
-m_f_test = TkMenu.new(menu, :tearoff=>0)
-m_file.add(:cascade, :label=>'Test submenu', :underline=>0, :menu=>m_f_test)
-m_file.add(:checkbutton, :label=>'Text check', :underline=>5,
- :variable=>$V.ref(:MENUCHECK1))
-m_file.insert(:end, :separator)
-
-if Tk.windowingsystem != 'x11'
- TkConsole.create
- m_file.insert(:end, :checkbutton, :label=>'Console', :underline=>5,
- :variable=>$V.ref(:CONSOLE), :command=>proc{toggle_console()})
- def toggle_console
- if TkComm.bool($V[:CONSOLE])
- TkConsole.show
- else
- TkConsole.hide
- end
- end
-end
-
-m_file.add(:command, :label=>'Exit', :underline=>1,
- :command=>proc{Tk.event_generate(b_close, '<Invoke>')})
-
-%w(One Two Three Four).each{|lbl|
- m_f_test.add(:radiobutton, :label=>lbl, :variable=>$V.ref(:MENURADIO1))
-}
-
-# Add Theme menu.
-#
-menu.add(:cascade, :label=>'Theme', :underline=>3,
- :menu=>makeThemeMenu(menu))
-
-setTheme($V[:THEME])
-
-#
-# Combobox demo pane:
-#
-values = %w(list abc def ghi jkl mno pqr stu vwx yz)
-2.times {|i|
- cb = Tk::Tile::Combobox.new(
- combo, :values=>values, :textvariable=>$V.ref(:COMBO))
- cb.pack(:side=>:top, :padx=>2, :pady=>2, :expand=>false, :fill=>:x)
- if i == 1
- cb.state :readonly
- begin
- cb.current = 3 # ignore if unsupported (tile0.4)
- rescue
- end
- end
-}
-
-#
-# Treeview widget demo pane:
-#
-if version?('0.5')
-
- treeview = nil # avoid 'undefined' error
- scrollbar = Tk::Tile::Scrollbar.new(tree,
- :command=>proc{|*args| treeview.yview(*args)})
- treeview = Tk::Tile::Treeview.new(tree, :columns=>%w(Class), :padding=>4,
- :yscrollcommand=>proc{|*args| scrollbar.set(*args)})
-
- Tk.grid(treeview, scrollbar, :sticky=>'news')
- tree.grid_columnconfigure(0, :weight=>1)
- tree.grid_rowconfigure(0, :weight=>1)
- tree.grid_propagate(0)
-
- # Add initial tree node:
- # Later nodes will be added in <<TreeviewOpen>> binding.
- treeview.insert('', 0, :id=>'.', :text=>'Main Window', :open=>false,
- :values=>[TkWinfo.classname('.')])
- treeview.headingconfigure('#0', :text=>'Widget')
- treeview.headingconfigure('Class', :text=>'Class')
- treeview.bind('<TreeviewOpen>', proc{fillTree(treeview)})
-
- def fillTree(treeview)
- id = treeview.focus_item
- unless TkWinfo.exist?(id)
- treeview.delete(id)
- end
- # Replace tree item children with current list of child windows.
- treeview.delete(treeview.children(id))
- for child in TkWinfo.children(id)
- treeview.insert(id, :end, :id=>child, :text=>TkWinfo.appname(child),
- :open=>false, :values=>[TkWinfo.classname(child)])
- unless TkWinfo.children(child).empty?
- # insert dummy child to show [+] indicator
- treeview.insert(child, :end)
- end
- end
- end
-
-else
- Tk::Tile::Label.new(tree,
- :text=>'Treeview is supported on tile 0.5 or later...').pack
-end
-
-#
-# Other demos:
-#
-$Timers = {:StateMonitor=>nil, :FocusMonitor=>nil}
-
-begin
- msg = Tk::Tile::Label.new(others, :justify=>:left, :wraplength=>300)
-rescue
- msg = TkMessage.new(others, :aspect=>200)
-end
-
-$Desc = {}
-
-showDescription = TkBindTag.new
-showDescription.bind('Enter', proc{|w| msg.text($Desc[w.path])}, '%W')
-showDescription.bind('Leave', proc{|w| msg.text('')}, '%W')
-
-[
- [ :trackStates, "Widget states...",
- "Display/modify widget state bits" ],
-
- [ :scrollbarResizeDemo, "Scrollbar resize behavior...",
- "Shows how Tile and standard scrollbars differ when they're sized too large" ],
-
- [ :trackFocus, "Track keyboard focus..." ,
- "Display the name of the widget that currently has focus" ],
-
- [ :repeatDemo, "Repeating buttons...",
- "Demonstrates custom classes (see demos/repeater.tcl)" ]
-
-].each{|demo_cmd, label, description|
- b = Tk::Tile::Button.new(others, :text=>label,
- :command=>proc{ self.__send__(demo_cmd) })
- $Desc[b.path] = description
- b.bindtags <<= showDescription
-
- b.pack(:side=>:top, :expand=>false, :fill=>:x, :padx=>6, :pady=>6)
-}
-
-msg.pack(:side=>:bottom, :expand=>true, :fill=>:both)
-
-
-#
-# Scrollbar resize demo:
-#
-$scrollbars = nil
-
-def scrollbarResizeDemo
- if $scrollbars
- begin
- $scrollbars.destroy
- rescue
- end
- end
- $scrollbars = TkToplevel.new(:title=>'Scrollbars', :geometry=>'200x200')
- f = TkFrame.new($scrollbars, :height=>200)
- tsb = Tk::Tile::Scrollbar.new(f, :command=>proc{|*args| sbstub(tsb, *args)})
- sb = TkScrollbar.new(f, :command=>proc{|*args| sbstub(sb, *args)})
- Tk.grid(tsb, sb, :sticky=>:news)
-
- sb.set(0, 0.5) # prevent backwards-compatibility mode for old SB
-
- f.grid_columnconfigure(0, :weight=>1)
- f.grid_columnconfigure(1, :weight=>1)
- f.grid_rowconfigure(0, :weight=>1)
-
- f.pack(:expand=>true, :fill=>:both)
-end
-
-#
-# Track focus demo:
-#
-$FocusInf = TkVariable.new_hash
-$focus = nil
-
-def trackFocus
- if $focus
- begin
- $focus.destroy
- rescue
- end
- end
- $focus = TkToplevel.new(:title=>'Keyboard focus')
- i = 0
- [
- ["Focus widget:", :Widget],
- ["Class:", :WidgetClass],
- ["Next:", :WidgetNext],
- ["Grab:", :Grab],
- ["Status:", :GrabStatus]
- ].each{|label, var_index|
- Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e),
- Tk::Tile::Label.new($focus,
- :textvariable=>$FocusInf.ref(var_index),
- :width=>40, :anchor=>:w, :relief=>:groove),
- :sticky=>:ew)
- i += 1
- }
- $focus.grid_columnconfigure(1, :weight=>1)
- $focus.grid_rowconfigure(i, :weight=>1)
-
- $focus.bind('Destroy', proc{Tk.after_cancel($Timers[:FocusMonitor])})
- focusMonitor
-end
-
-def focusMonitor
- $FocusInf[:Widget] = focus_win = Tk.focus
- if focus_win
- $FocusInf[:WidgetClass] = focus_win.winfo_classname
- $FocusInf[:WidgetNext] = Tk.focus_next(focus_win)
- else
- $FocusInf[:WidgetClass] = $FocusInf[:WidgetNext] = ''
- end
-
- $FocusInf[:Grab] = grab_wins = Tk.current_grabs
- unless grab_wins.empty?
- $FocusInf[:GrabStatus] = grab_wins[0].grab_status
- else
- $FocusInf[:GrabStatus] = ''
- end
-
- $Timers[:FocusMonitor] = Tk.after(200, proc{ focusMonitor() })
-end
-
-#
-# Widget state demo:
-#
-$Widget = TkVariable.new
-
-TkBindTag::ALL.bind('Control-Shift-ButtonPress-1',
- proc{|w|
- $Widget.value = w
- updateStates()
- Tk.callback_break
- }, '%W')
-$states_list = %w(active disabled focus pressed selected
- background indeterminate invalid default)
-$states_btns = {}
-$states = nil
-
-$State = TkVariable.new_hash
-
-def trackStates
- if $states
- begin
- $state.destroy
- rescue
- end
- end
- $states = TkToplevel.new(:title=>'Widget states')
-
- l_inf = Tk::Tile::Label.new($states, :text=>"Press Control-Shift-Button-1 on any widget")
-
- l_lw = Tk::Tile::Label.new($states, :text=>'Widget:',
- :anchor=>:e, :relief=>:groove)
- l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget,
- :anchor=>:w, :relief=>:groove)
-
- Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6)
- Tk.grid(l_lw, l_w, :sticky=>:ew)
-
- $states_list.each{|st|
- cb = Tk::Tile::Checkbutton.new($states, :text=>st,
- :variable=>$State.ref(st),
- :command=>proc{ changeState(st) })
- $states_btns[st] = cb
- Tk.grid('x', cb, :sticky=>:nsew)
- }
-
- $states.grid_columnconfigure(1, :weight=>1)
-
- f_cmd = Tk::Tile::Frame.new($states)
- Tk.grid('x', f_cmd, :sticky=>:nse)
-
- b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close',
- :command=>proc{ $states.destroy })
- Tk.grid('x', b_close, :padx=>4, :pady=>[6,4])
- f_cmd.grid_columnconfigure(0, :weight=>1)
-
- $states.bind('KeyPress-Escape', proc{Tk.event_generate(b_close, '<Invoke>')})
-
- $states.bind('Destroy', proc{Tk.after_cancel($Timers[:StateMonitor])})
- stateMonitor()
-end
-
-def stateMonitor
- updateStates() if $Widget.value != ''
- $Timers[:StateMonitor] = Tk.after(200, proc{ stateMonitor() })
-end
-
-def updateStates
- $states_list.each{|st|
- begin
- $State[st] = $Widget.window.instate(st)
- rescue
- $states_btns[st].state('disabled')
- else
- $states_btns[st].state('!disabled')
- end
- }
-end
-
-def changeState(st)
- if $Widget.value != ''
- if $State.bool_element(st)
- $Widget.window.state(st)
- else
- $Widget.window.state("!#{st}")
- end
- end
-end
-
-#
-# Repeating buttons demo:
-#
-def repeatDemo
- if defined?($repeatDemo) && $repeatDemo.exist?
- $repeatDemo.deiconify; return
- end
- $repeatDemo = TkToplevel.new(:title=>'Repeating button')
-
- f = Tk::Tile::Frame.new($repeatDemo)
- b = Tk::Tile::Button.new(f, :class=>'Repeater', :text=>'Press and hold')
- if version?('0.6')
- p = Tk::Tile::Progressbar.new(f, :orient=>:horizontal, :maximum=>10)
- else # progressbar is not supported
- p = Tk::Tile::Progress.new(f, :orient=>:horizontal, :from=>0, :to=>10)
- def p.step
- i = self.get + 1
- i = self.from if i > self.to
- self.set(i)
- end
- end
- b.command {p.step}
-
- b.pack(:side=>:left, :expand=>false, :fill=>:none, :padx=>6, :pady=>6)
- p.pack(:side=>:right, :expand=>true, :fill=>:x, :padx=>6, :pady=>6)
- f.pack(:expand=>true, :fill=>:both)
-end
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tile/iconlib.tcl b/ext/tk/sample/tkextlib/tile/iconlib.tcl
deleted file mode 100644
index 9a93ece504..0000000000
--- a/ext/tk/sample/tkextlib/tile/iconlib.tcl
+++ /dev/null
@@ -1,110 +0,0 @@
-array set ImgData {
-bold {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI6hI+py60U3wj+
-RYQFJYRvEWFBCeFbRFhQQvhG8YPgX0RYUEL4FhEWlBC+RYQFJYQPFN8IPqYut/8hBQA7}
-copy {R0lGODlhEAAQAJEAANnZ2QAAAP///wAAhCH5BAEAAAAALAAAAAAQABAAAAJUhI8JFJ/gY4iI
-UEL4FyIiFIXgW0iEUDgfACBI9pzMAAGRiIghWSMDECR7JEKGtkFIRFBG+TIQKDQxtgzcDcmX
-IfgwQrFlCD4MyZch+EDzj+Bj6mYBADs=}
-cut {R0lGODlhEAAQAJEAANnZ2QAAAAAAhP///yH5BAEAAAAALAAAAAAQABAAAAJFhI+pcUHwEeIi
-E0gACIKPEAFBIXy0gMg8EhM+YmQiKSL4eAIiJMI/EQEhQGYGYiQIQAg+iAkIATIzECMBIgT/
-RBARERlSADs=}
-dragfile {R0lGODlhGAAYAKIAANnZ2TMzM////wAAAJmZmf///////////yH5BAEAAAAALAAAAAAYABgA
-AAPACBi63IqgC4GiyxwogaAbKLrMgSKBoBoousyBogEACIGiyxwoKgGAECI4uiyCExMTOACB
-osuNpDoAGCI4uiyCIkREOACBosutSDoAgSI4usyCIjQAGCi63Iw0ACEoOLrMgiI0ABgoutyM
-NAAhKDi6zIIiNAAYKLrcjDQAISg4usyCIjQAGCi63Iw0AIGiiqPLIyhCA4CBosvNSAMQKKo4
-ujyCIjQAGCi63Iw0AIGiy81IAxCBpMu9GAMAgKPL3QgJADs=}
-dragicon {R0lGODlhGAAYALMAANnZ2TMzM/////8zM8zMzGYAAAAAAJmZmQCZMwAzZgCZzGZmZv//////
-/////////yH5BAEAAAAALAAAAAAYABgAAAT/EMAgJ60SAjlBgEJOSoMIEMgZoJCT0iADBFIG
-KOSkNMwAAABhwiHnIEKIIIQQAQIZhBBwyDmKEMIEE0yABoAghIBDzlGEENDIaQAIQgg45BwF
-CinPOccAECYcUiKEEBFCiHPgMQAEIcQYYyABBUGIQCHlMQCEScZAAhKEEApCECGOARAEIQQp
-BRGIpAyCJCGOASBAISdEcqJAVBLiGABggELOAJGUKyiVhDgGABigkJMEhNAKSqkEhTgGgCCl
-FCQEGIJSSiUhjgEgQCEnJVBJmYQ4BoAAhZyTQCVnEuIYAAIUckoCk5xSiGMACFDISSs9BoBg
-rRXQMQAEKOSklR4DEUAI8MhJ6wwGAACgkZNWCkAEADs=}
-error {R0lGODlhIAAgAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAgACAA
-AAP/CLoMGLqKoMvtGIqiqxEYCLrcioGiyxwIusyBgaLLLRiBoMsQKLrcjYGgu4Giy+2CAkFX
-A0WX2wXFIOgGii7trkCEohsDCACBoktEKLpKhISiGwAIECiqSKooukiqKKoxgACBooukKiIo
-SKooujGDECi6iqQqsopEV2MQAkV3kXQZRXdjEAJFl5F0FUWXY3ACRZcFSRdFlyVwJlB0WZB0
-UXRZAmcCRZeRdBVFl2NwAkV3kXQZRXdjcAJFV5FURVaR6GoMDgSKLpKqiKAgqaLoxgwOBIoq
-kiqKLpIqimrM4ECg6BIRiq4SIaHoxgyCBoou7a5AhKIbMzgAAIGiy+2CTWJmBhAAAkWX2wXF
-zCDoBooud2PMDIKuRqDocgtGzMwg6O4Eii5z4Kgi6DIMhqLoagQGjiqCLvPgYOgqji6CLrfi
-6DIj6HI7jq4i6DIkADs=}
-file {R0lGODlhCwANAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAALAA0AAAIyhI9G8Q0AguSH
-AMQdxQgxEyEFQfItICQokYgEBMm3gBCKLRIQJN8CQii2SECQfAug+FgAOw==}
-folder {R0lGODlhEAANAKIAANnZ2YSEhMbGxv//AP///wAAAP///////yH5BAEAAAAALAAAAAAQAA0A
-AANjCIqhiqDLITgyEgi6GoIjIyMYugCBpMsaWBA0giMjIzgyUYBBMjIoIyODEgVBODIygiMj
-E1gQJIMyMjIoI1GAQSMjODIyghMFQSgjI4MyMhJYEDSCIyMjODJRgKHLXAiApcucADs=}
-hourglass {R0lGODlhIAAgAKIAANnZ2YAAAAAAAP8AAP///8DAwICAgP///yH5BAEAAAAALAAAAAAgACAA
-AAPZCLrc/jDKSau9OGcUuqyCoMvNGENVhaMrCLrcjaLLgqDL7WhFVIVVZoKgy+1oRUSFVWaC
-oMvtaEVEhVVmgqDL7WhFRIVVZoKgy+1oVVaCJWaCoMvtgKxISrBMEHS5fZEVSRkKgi63NzIq
-EwRdbndkVCYIutzeyIqqDAVBl9sXWRFJYZkg6HI7ICsiKqwyEwRdbkcrIhKsMhMEXW5HKyIp
-lDITBF1uRysyEiwxEwRdbkcrIyuUEhMEXW5H0WVB0OVujKGqwtEVBF1uRtHlRdDl9odRTlrt
-xRmjBAA7}
-info {R0lGODlhIAAgAKIAANnZ2YSEhMbGxv///wAA/wAAAP///////yH5BAEAAAAALAAAAAAgACAA
-AAP/CLoMGLqKoMvtGCo4uhKBgaDLDRghOLqsghEIuryBgqPLPSiBoMsQOLojhEQkOLpTCLob
-OLqKpIujq4WgC4Gju0i6OLpbCKohOLorhEQkOLorhaAQOLrc3qgCIARHl9sbSQUEji4j6RKO
-Lk9hQODosiKp4ujyFIbi6LIiqeLo8hSG4uiyIqni6PIUhuLosiKp4ujyFIYKji4PkiqOLkth
-BASOLg+SKo4uV2AEhODoMpIqju5KYShA4Ogqku7i6E4FRgAAYOHocvugiohAUC0cXe7GiohA
-0IUSHF3uQamICATdrULB0WUVrIqIQNBlCCwVHF2pwsJQRdDlDYyoKsHRPMLQDQRdbsDQqBmc
-wlBF0OV2jJqZwggEXW5vVDMVgaDL7Y5qKgJBl9sfVUUg6HL7AxSKoMvtr1AEgi5DAgA7}
-italic {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAIrhI+py+1A4hN8
-hIjINBITPlpEZBqJCR8tIjKNxISPFhGZQOITfExdbv9FCgA7}
-new {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAJFhI95FN8IvgXJ
-jyD4ECQ/JAh+kPyICIIdJP+CYAfJvyDYQfIvCHaQ/AuCHST/gmAHyb8g2EHyLwh2kPwLgk3x
-MQg+pu4WADs=}
-open {R0lGODlhEAAQAKIAANnZ2QAAAP//AP///4SEAP///////////yH5BAEAAAAALAAAAAAQABAA
-AANZCLrczigUQZc1EDQgEHSZAwMgIhB0NQIDQkYwdANBNUZwZGQEJxBUQwZlZGRQAkE1RnAE
-Q5dVcCSQdDcAYySQdDcAISSQdDcAASKQdDcAAQBDlwNBl9sfApQAOw==}
-openfold {R0lGODlhEAANAKIAANnZ2YSEhP///8bGxv//AAAAAP///////yH5BAEAAAAALAAAAAAQAA0A
-AANgCIqhiqDLgaIaCLoagkNDIxi6AIFCQ0M4KKpRgCFDQzg0NIQThaHLSxgVKLochRMVMkhD
-Q4M0VBFYEDKEQ0NDOFFRgCE0NEhDQ4MVBRAoNDSEQ0NRWAAYuqyFBQBYurwJADs=}
-overstrike {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI3hI+py80Uh+Aj
-RFhQCP8iMILgWwRGEHyLwAiCbxEYQfCB4iPBhwiMIPgXYREEHyEiguBj6nI7FQA7}
-palette {R0lGODlhEAAQAKIAANnZ2QAAAP//AP////8A/4QAhP8AAAD//yH5BAEAAAAALAAAAAAQABAA
-AANtCLrcjqGBoMsRKCMTgaALMSgDAYMSCKoxgAFBITgSAIAQEhUIARCAEgAQOBAwghMQEwga
-MoIjIxAIEgCAEBEyKBAgg4GgGxAIYTGCgaALcRgQIIGgCwEYICODgaALITgyEoGguxiqCLrc
-/lChBAA7}
-passwd {R0lGODlhIAAgAMQAANnZ2QAAAICAgICAAP///7CwsMDAwMjIAPjIAOjo6Pj4AODg4HBwcMj4
-ANjY2JiYANDQ0MjIyPj4yKCgoMiYAMjImDAwAMjIMJiYmJCQkP//////////////////////
-/yH5BAEAAAAALAAAAAAgACAAAAX/ICCOIhiIIgiII1maZSCMQnCeJyAIQiAIAiAMwxCcJwkk
-EAQRCIUwGMSBDEEAAuJIlgKRJEEgGAMRBIGiDENQlqNAJAsYCEwgEEEgBAHSIEMAAuJIAgKR
-LEsgGEMgCEJgBMqhHENQlgJILMsSCMRABEFgGAESHMcRgIA4kgKxOIsTBAOhKAITKEGDHMhD
-kqIAEqAjisJAgIooBkpwNMcTgIA4jgLhOBAkEAOhKIoSKEGDIMcTkKQICgQEQQIxEIqiBEpw
-IMdxPAEIiCMJCEQUMUQ0EIqiHIfSIM3xBGUpCiABCUQyEMqhHMiBHMjxBCAgjuQoEAKxRANB
-HMqhHM1x/zxDUJajQIACsUTDQBAEIR3IcQRDAALiSIoCYQiEE03gII7HQR3BEICAOJICYRSC
-QDjRNE1CAAzVQR3WE5AkAAqEUQiFQEARBAUAAAzHQR3BEICAOI4CUQhFIBAREwXjUFUHdQRD
-QJJAABbCFAhEJBgBAADAMAwXdQRDAALiCAhEIRQCYRiCEZDjUFFHMAQkIBAFOAmTQBiFUAQg
-II7AUFXUEQwBCQjEJExBkBRCEZCjMIBD9RxDAALiGEzCFBBYIRTBOI7AQB1DMIoCMQkYGAjL
-JEwBCIgjOVDDEJCAQGACJiTTJEwBSY5BEJAiSCCwTAiCZBKmAATEkSzNQBCCYCDBJgELTNMk
-g0AMEgwTAhAQR7I0zYARgvM8TyAIznMMAQA7}
-paste {R0lGODlhEAAQAKIAANnZ2QAAAP//AISEAISEhP///wAAhP///yH5BAEAAAAALAAAAAAQABAA
-AANwCLrcjqGBoKsYqiKrCDSGBkMiJJCGAgCDKBB0gwYDIKYwdJUIAyBokIaGBmloAhBiaAgH
-TdcCEIKGBsmwVM0AIYaGcAxL1coQgoYGySoisMzMAoeGxrB01QJpaMiwMHTLAEPVsHTVEHTR
-dBlBlxswAQA7}
-print {R0lGODlhEAAQAKIAANnZ2QAAAP///4SEhP//AP///////////yH5BAEAAAAALAAAAAAQABAA
-AANZCLrcjqG7CLqBoquBoBuCoSqBoBsouhoIuiEYqrKBoIGiqwEYEIChyxAIEYGgywEYgKHL
-DAgRCLozgwABARgIukSEABEBGLq8gAEQCLobgAEAgKHLgaDLzZgAOw==}
-question {R0lGODlhIAAgAKIAANnZ2YSEhMbGxv///wAAAAAA/////////yH5BAEAAAAALAAAAAAgACAA
-AAP/CLoMGLqKoMvtGCo4uhKBgaDLDRghOLqsghEIuryBgqPLPSiBoMsQOLrcjYSgu4GjO4Kl
-Kzi6Qwi6EDi6I4UyU1VYgqM7hKAagqM7VTg6VYWFoztCCAqBo6tVWDVThVU4ukqBACE4ulqF
-VSNVWIWjq0IYEDi6K4UlU1VYOLpMgRA4uryCpTi6PIShOLq8hVU4uqyEoTi6vIUlOLqshKE4
-uryFhaPLSxgqOLrc3kgoAgJHl0ewSnB0eQhDIQRHl6uwCkeXhTAUIHB0uQqrcHSZAiMAAJBw
-dFcKS3B0lwIjAkGVcHS5GykiAkEXSHB0uQeFIiIQdJcIBUeXVZAoIgJBT5chkFRwdIUICUMV
-QZc3MIKIBEcJQzcQdLkBQ4NmcAhDFUGX2zFoZggjEHS5vRHNUASCLrc7oqEIBF1uf0QUgaDL
-7Q9QKIIut79CEQi6DAkAOw==}
-redo {R0lGODlhEAAQAJEAANnZ2QAAhP///////yH5BAEAAAAALAAAAAAQABAAAAIvhI+py+1vSByC
-jxAYQXDMwsyAggQAQBB8iwgMgg8REQgUwqbYBDsIPqYutz+MgBQAOw==}
-save {R0lGODlhEAAQAJEAANnZ2QAAAISEAP///yH5BAEAAAAALAAAAAAQABAAAAJWhI9pFB8RIIRC
-+BYQFqQQvkWEBSmEbyFhQQrhW0hYkEL4FhIWpBC+hYQFSYxvIgFAoXy0AAiSGP8kAIIkxgcI
-CSBEQvEBQgIIkVB8gJAAAhgfj+BjWgEAOw==}
-underline {R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAI3hI+py60UBy4I
-vkVcBMG/iIsg+BdxEQT/Ii6C4F/ERRD8i7gIgn8RF0HwkWITfExFin8EH1OXCwA7}
-undo {R0lGODlhEAAQAJEAANnZ2QAAhP///////yH5BAEAAAAALAAAAAAQABAAAAIuhI+py+2vSByC
-HxdxQCHsCIg7oAAAEUHwLTAiKIQPgRSbYMfd3VEIH1OX2x8mUgA7}
-warning {R0lGODlhIAAgAKIAANnZ2YSEAP//AMbGxgAAAISEhP///////yH5BAEAAAAALAAAAAAgACAA
-AAP/CLq8gREIutz+KESGEHS5vVGIiAxSIehy+6JAUaUqBF1uBxQoukOFhaDL7RgoukKFhaDL
-3RgoujqEVQi63IyBortUWAi63IuBostDWIWgy60YIjKERCMiSFUIutyAISKCpCoiOFSFoMsd
-KCpIqiKCQlUIusyBooqkKiIoQ1UIuryBooqkiqJKVQi6rIGii6SKojpUWAi6DIGiG0RIgaJL
-VQi6HCi6MoREg6I7VFgIuhsoukqEhKKrVFgIuhoouhuEgaKrQ1iFoAuBortDOCi6S4WFoBso
-uiyEostDWIWgGii63K6IqgAAIVB0WQaJBkV3h7AKAAJFl4WQiFB0mQoLRyBQdFkJiQhFl4ew
-CgJFl3WQaFB0WQirIFB0ud0RVVWg6HJ7o6GqAgwUXW5fNFRVhQCBpMvti0oVABCwdLndEehi
-6XI7I4AEADs=}
-}
diff --git a/ext/tk/sample/tkextlib/tile/readme.txt b/ext/tk/sample/tkextlib/tile/readme.txt
deleted file mode 100644
index a76b3338f7..0000000000
--- a/ext/tk/sample/tkextlib/tile/readme.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-All of *.tcl and under themes/ directory (except kroc.rb) are
-quoted from Tcl/Tk's Tile extension. Please read Orig_LICENSE.txt.
diff --git a/ext/tk/sample/tkextlib/tile/repeater.tcl b/ext/tk/sample/tkextlib/tile/repeater.tcl
deleted file mode 100644
index 1f403de537..0000000000
--- a/ext/tk/sample/tkextlib/tile/repeater.tcl
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# $Id: repeater.tcl,v 1.1.2.1 2005/08/02 06:51:26 ocean Exp $
-#
-# Demonstration of custom classes.
-#
-# The Tile button doesn't have built-in support for autorepeat.
-# Instead of adding -repeatdelay and -repeatinterval options,
-# and all the extra binding scripts required to deal with them,
-# we create a custom widget class for autorepeating buttons.
-#
-# Usage:
-# ttk::button .b -class Repeater [... other options ...]
-#
-# TODO:
-# Use system settings for repeat interval and initial delay.
-#
-# Notes:
-# Repeater buttons work more like scrollbar arrows than
-# Tk repeating buttons: they fire once immediately when
-# first pressed, and $State(delay) specifies the initial
-# interval before the button starts autorepeating.
-#
-
-namespace eval tile::Repeater {
- variable State
- set State(timer) {} ;# [after] id of repeat script
- set State(interval) 100 ;# interval between repetitions
- set State(delay) 300 ;# delay after initial invocation
-}
-
-### Class bindings.
-#
-
-bind Repeater <Enter> { %W state active }
-bind Repeater <Leave> { %W state !active }
-
-bind Repeater <Key-space> { tile::Repeater::Activate %W }
-bind Repeater <<Invoke>> { tile::Repeater::Activate %W }
-
-bind Repeater <ButtonPress-1> { tile::Repeater::Press %W }
-bind Repeater <ButtonRelease-1> { tile::Repeater::Release %W }
-bind Repeater <B1-Leave> { tile::Repeater::Pause %W }
-bind Repeater <B1-Enter> { tile::Repeater::Resume %W } ;# @@@ see below
-
-# @@@ Workaround for metacity-induced bug:
-bind Repeater <B1-Enter> \
- { if {"%d" ne "NotifyUngrab"} { tile::Repeater::Resume %W } }
-
-### Binding procedures.
-#
-
-## Activate -- Keyboard activation binding.
-# Simulate clicking the button, and invoke the command once.
-#
-proc tile::Repeater::Activate {w} {
- $w instate disabled { return }
- set oldState [$w state pressed]
- update idletasks; after 100
- $w state $oldState
- after idle [list $w invoke]
-}
-
-## Press -- ButtonPress-1 binding.
-# Invoke the command once and start autorepeating after
-# $State(delay) milliseconds.
-#
-proc tile::Repeater::Press {w} {
- variable State
- $w instate disabled { return }
- $w state pressed
- $w invoke
- after cancel $State(timer)
- set State(timer) [after $State(delay) [list tile::Repeater::Repeat $w]]
-}
-
-## Release -- ButtonRelease binding.
-# Stop repeating.
-#
-proc tile::Repeater::Release {w} {
- variable State
- $w state !pressed
- after cancel $State(timer)
-}
-
-## Pause -- B1-Leave binding
-# Temporarily suspend autorepeat.
-#
-proc tile::Repeater::Pause {w} {
- variable State
- $w state !pressed
- after cancel $State(timer)
-}
-
-## Resume -- B1-Enter binding
-# Resume autorepeat.
-#
-proc tile::Repeater::Resume {w} {
- variable State
- $w instate disabled { return }
- $w state pressed
- $w invoke
- after cancel $State(timer)
- set State(timer) [after $State(interval) [list tile::Repeater::Repeat $w]]
-}
-
-## Repeat -- Timer script
-# Invoke the command and reschedule another repetition
-# after $State(interval) milliseconds.
-#
-proc tile::Repeater::Repeat {w} {
- variable State
- $w instate disabled { return }
- $w invoke
- set State(timer) [after $State(interval) [list tile::Repeater::Repeat $w]]
-}
-
-#*EOF*
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl b/ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl
deleted file mode 100644
index 37e3d07ff7..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue.tcl
+++ /dev/null
@@ -1,149 +0,0 @@
-# blue.tcl - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# blue.tcl,v 1.27 2005/10/08 14:56:57 jenglish Exp
-#
-#
-
-namespace eval tile::theme::blue {
-
- package provide tile::theme::blue 0.7
-
- set imgdir [file join [file dirname [info script]] blue]
- array set I [tile::LoadImages $imgdir *.gif]
-
- array set colors {
- -frame "#6699cc"
- -lighter "#bcd2e8"
- -window "#e6f3ff"
- -selectbg "#ffff33"
- -selectfg "#000000"
- -disabledfg "#666666"
- }
-
- style theme create blue -settings {
-
- style default . \
- -borderwidth 1 \
- -background $colors(-frame) \
- -fieldbackground $colors(-window) \
- -troughcolor $colors(-lighter) \
- -selectbackground $colors(-selectbg) \
- -selectforeground $colors(-selectfg) \
- ;
- style map . -foreground [list disabled $colors(-disabledfg)]
-
- ## Buttons.
- #
- style default TButton -padding "10 0"
- style layout TButton {
- Button.button -children {
- Button.focus -children {
- Button.padding -children {
- Button.label
- }
- }
- }
- }
-
- style element create button image $I(button-n) \
- -map [list pressed $I(button-p) active $I(button-h)] \
- -border 4 -sticky ew
-
- style element create Checkbutton.indicator image $I(check-nu) \
- -width 24 -sticky w -map [list \
- {!disabled active selected} $I(check-hc) \
- {!disabled active} $I(check-hu) \
- {!disabled selected} $I(check-nc) ]
-
- style element create Radiobutton.indicator image $I(radio-nu) \
- -width 24 -sticky w -map [list \
- {!disabled active selected} $I(radio-hc) \
- {!disabled active} $I(radio-hu) \
- selected $I(radio-nc) ]
-
- style default TMenubutton -relief raised -padding {10 2}
-
- ## Toolbar buttons.
- #
- style default Toolbutton \
- -width 0 -relief flat -borderwidth 2 -padding 4 \
- -background $colors(-frame) -foreground #000000 ;
- style map Toolbutton -background [list active $colors(-selectbg)]
- style map Toolbutton -foreground [list active $colors(-selectfg)]
- style map Toolbutton -relief {
- disabled flat
- selected sunken
- pressed sunken
- active raised
- }
-
- ## Entry widgets.
- #
- style default TEntry \
- -selectborderwidth 1 -padding 2 -insertwidth 2 -font TkTextFont
- style default TCombobox \
- -selectborderwidth 1 -padding 2 -insertwidth 2 -font TkTextFont
-
- ## Notebooks.
- #
- style default TNotebook.Tab -padding {4 2 4 2}
- style map TNotebook.Tab \
- -background \
- [list selected $colors(-frame) active $colors(-lighter)] \
- -padding [list selected {4 4 4 2}]
-
- ## Labelframes.
- #
- style default TLabelframe -borderwidth 2 -relief groove
-
- ## Scrollbars.
- #
- style layout Vertical.TScrollbar {
- Scrollbar.trough -children {
- Scrollbar.uparrow -side top
- Scrollbar.downarrow -side bottom
- Scrollbar.uparrow -side bottom
- Vertical.Scrollbar.thumb -side top -expand true -sticky ns
- }
- }
-
- style layout Horizontal.TScrollbar {
- Scrollbar.trough -children {
- Scrollbar.leftarrow -side left
- Scrollbar.rightarrow -side right
- Scrollbar.leftarrow -side right
- Horizontal.Scrollbar.thumb -side left -expand true -sticky we
- }
- }
-
- style element create Horizontal.Scrollbar.thumb image $I(sb-thumb) \
- -map [list {pressed !disabled} $I(sb-thumb-p)] -border 3
-
- style element create Vertical.Scrollbar.thumb image $I(sb-vthumb) \
- -map [list {pressed !disabled} $I(sb-vthumb-p)] -border 3
-
- foreach dir {up down left right} {
- style element create ${dir}arrow image $I(arrow${dir}) \
- -map [list \
- disabled $I(arrow${dir}) \
- pressed $I(arrow${dir}-p) \
- active $I(arrow${dir}-h)] \
- -border 1 -sticky {}
- }
-
- ## Scales.
- #
- style element create Scale.slider \
- image $I(slider) -map [list {pressed !disabled} $I(slider-p)]
-
- style element create Vertical.Scale.slider \
- image $I(vslider) -map [list {pressed !disabled} $I(vslider-p)]
-
- style element create Horizontal.Progress.bar \
- image $I(sb-thumb) -border 2
- style element create Vertical.Progress.bar \
- image $I(sb-vthumb) -border 2
-
- }
-}
-
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif
deleted file mode 100644
index 3c1be9d880..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif
deleted file mode 100644
index 1cb36ec554..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif
deleted file mode 100644
index e363c362ed..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif
deleted file mode 100644
index cbc3db2756..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif
deleted file mode 100644
index 14d541b03e..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif
deleted file mode 100644
index 32584a34b2..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif
deleted file mode 100644
index 913e9da94b..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif
deleted file mode 100644
index d02208fcf7..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gif
deleted file mode 100644
index 2b0f1fd07b..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif
deleted file mode 100644
index 6059bae094..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif
deleted file mode 100644
index 20b6a824f4..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gif
deleted file mode 100644
index 5857616228..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gif
deleted file mode 100644
index 0947f43b90..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gif
deleted file mode 100644
index d9845283a5..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcf b/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcf
deleted file mode 100644
index e38ed19e61..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcf
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gif
deleted file mode 100644
index e819b1b951..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gif
deleted file mode 100644
index b753aead97..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gif
deleted file mode 100644
index 74dbb799a2..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gif
deleted file mode 100644
index 8f3d9114a3..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gif
deleted file mode 100644
index 6f360ffd62..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif
deleted file mode 100644
index f7c21fb0c3..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif
deleted file mode 100644
index a006630388..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif
deleted file mode 100644
index 0281de37d8..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif
deleted file mode 100644
index 58ec60c1db..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif
deleted file mode 100644
index 6cfaa416d1..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif
deleted file mode 100644
index d9bfc0a7be..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif
deleted file mode 100644
index 930d7fd9ff..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif
deleted file mode 100644
index 060be5dd41..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gif
deleted file mode 100644
index c1c089de3e..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gif
deleted file mode 100644
index 1805c2dc7c..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif
deleted file mode 100644
index bc37b31c3d..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gif b/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gif
deleted file mode 100644
index d3745c7f62..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl b/ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl
deleted file mode 100644
index 19ddda7c73..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl
+++ /dev/null
@@ -1,6 +0,0 @@
-# Package index for tile demo pixmap themes.
-
-if {[file isdirectory [file join $dir blue]]} {
- package ifneeded tile::theme::blue 0.0.1 \
- [list source [file join $dir blue.tcl]]
-}
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl
deleted file mode 100644
index c47a67b5a9..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik.tcl
+++ /dev/null
@@ -1,194 +0,0 @@
-# keramik.tcl -
-#
-# A sample pixmap theme for the tile package.
-#
-# Copyright (c) 2004 Googie
-# Copyright (c) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# $Id: keramik.tcl,v 1.1.2.1 2005/11/25 07:04:59 nagai Exp $
-
-package require Tk 8.4; # minimum version for Tile
-package require tile 0.5; # depends upon tile 0.5
-
-namespace eval tile {
- namespace eval theme {
- namespace eval keramik {
- variable version 0.3.2
- }
- }
-}
-
-namespace eval tile::theme::keramik {
-
- variable imgdir [file join [file dirname [info script]] keramik]
- variable I
- array set I [tile::LoadImages $imgdir *.gif]
-
- variable colors
- array set colors {
- -frame "#cccccc"
- -lighter "#cccccc"
- -window "#ffffff"
- -selectbg "#eeeeee"
- -selectfg "#000000"
- -disabledfg "#aaaaaa"
- }
-
- style theme create keramik -parent alt -settings {
-
-
- # -----------------------------------------------------------------
- # Theme defaults
- #
- style default . \
- -borderwidth 1 \
- -background $colors(-frame) \
- -troughcolor $colors(-lighter) \
- -font TkDefaultFont \
- ;
-
- style map . -foreground [list disabled $colors(-disabledfg)]
-
- # -----------------------------------------------------------------
- # Button elements
- # - the button has a large rounded border and needs a bit of
- # horizontal padding.
- # - the checkbutton and radiobutton have the focus drawn around
- # the whole widget - hence the new layouts.
- #
- style layout TButton {
- Button.background
- Button.button -children {
- Button.focus -children {
- Button.label
- }
- }
- }
- style layout Toolbutton {
- Toolbutton.background
- Toolbutton.button -children {
- Toolbutton.focus -children {
- Toolbutton.label
- }
- }
- }
- style element create button image $I(button-n) \
- -border {8 6 8 16} -padding {6 6} -sticky news \
- -map [list {pressed !disabled} $I(button-p) \
- {active !selected} $I(button-h) \
- selected $I(button-s) \
- disabled $I(button-d)]
- style default TButton -padding {10 6}
-
- style element create Toolbutton.button image $I(tbar-n) \
- -border {2 8 2 16} -padding {2 2} -sticky news \
- -map [list {pressed !disabled} $I(tbar-p) \
- {active !selected} $I(tbar-a) \
- selected $I(tbar-p)]
-
- style element create Checkbutton.indicator image $I(check-u) \
- -width 20 -sticky w \
- -map [list selected $I(check-c)]
-
- style element create Radiobutton.indicator image $I(radio-u) \
- -width 20 -sticky w \
- -map [list selected $I(radio-c)]
-
- # The layout for the menubutton is modified to have a button element
- # drawn on top of the background. This means we can have transparent
- # pixels in the button element. Also, the pixmap has a special
- # region on the right for the arrow. So we draw the indicator as a
- # sibling element to the button, and draw it after (ie on top of) the
- # button image.
- style layout TMenubutton {
- Menubutton.background
- Menubutton.button -children {
- Menubutton.focus -children {
- Menubutton.padding -children {
- Menubutton.label -side left -expand true
- }
- }
- }
- Menubutton.indicator -side right
- }
- style element create Menubutton.button image $I(mbut-n) \
- -map [list {active !disabled} $I(mbut-a) \
- {pressed !disabled} $I(mbut-a) \
- {disabled} $I(mbut-d)] \
- -border {7 10 29 15} -padding {7 4 29 4} -sticky news
- style element create Menubutton.indicator image $I(mbut-arrow-n) \
- -width 11 -sticky w -padding {0 0 18 0}
-
- # -----------------------------------------------------------------
- # Scrollbars, scale and progress elements
- # - the scrollbar has three arrow buttons, two at the bottom and
- # one at the top.
- #
- style layout Vertical.TScrollbar {
- Scrollbar.background
- Scrollbar.trough -children {
- Scrollbar.uparrow -side top
- Scrollbar.downarrow -side bottom
- Scrollbar.uparrow -side bottom
- Vertical.Scrollbar.thumb -side top -expand true -sticky ns
- }
- }
-
- style layout Horizontal.TScrollbar {
- Scrollbar.background
- Scrollbar.trough -children {
- Scrollbar.leftarrow -side left
- Scrollbar.rightarrow -side right
- Scrollbar.leftarrow -side right
- Horizontal.Scrollbar.thumb -side left -expand true -sticky we
- }
- }
-
- style default TScrollbar -width 16
-
- style element create Horizontal.Scrollbar.thumb image $I(hsb-n) \
- -border {6 4} -width 15 -height 16 -sticky news \
- -map [list {pressed !disabled} $I(hsb-p)]
-
- style element create Vertical.Scrollbar.thumb image $I(vsb-n) \
- -border {4 6} -width 16 -height 15 -sticky news \
- -map [list {pressed !disabled} $I(vsb-p)]
-
- style element create Scale.slider image $I(hslider-n) \
- -border 3
-
- style element create Vertical.Scale.slider image $I(vslider-n) \
- -border 3
-
- style element create Horizontal.Progress.bar image $I(hsb-n) \
- -border {6 4}
-
- style element create Vertical.Progress.bar image $I(vsb-n) \
- -border {4 6}
-
- style element create uparrow image $I(arrowup-n) \
- -map [list {pressed !disabled} $I(arrowup-p)]
-
- style element create downarrow image $I(arrowdown-n) \
- -map [list {pressed !disabled} $I(arrowdown-p)]
-
- style element create rightarrow image $I(arrowright-n) \
- -map [list {pressed !disabled} $I(arrowright-p)]
-
- style element create leftarrow image $I(arrowleft-n) \
- -map [list {pressed !disabled} $I(arrowleft-p)]
-
- # -----------------------------------------------------------------
- # Notebook elements
- #
- style element create tab image $I(tab-n) \
- -map [list selected $I(tab-p) active $I(tab-p)] \
- -border {6 6 6 2} -height 12
-
- ## Labelframes.
- #
- style default TLabelframe -borderwidth 2 -relief groove
- }
-}
-
-package provide tile::theme::keramik $::tile::theme::keramik::version
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif
deleted file mode 100644
index 2d84f29c60..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif
deleted file mode 100644
index 52ee752641..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif
deleted file mode 100644
index ff309c56f2..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif
deleted file mode 100644
index 2159f274a5..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif
deleted file mode 100644
index 905fa7ed1d..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif
deleted file mode 100644
index 0323332f30..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif
deleted file mode 100644
index 20dcadb30e..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif
deleted file mode 100644
index 129169e4c4..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif
deleted file mode 100644
index fe9bf98f81..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif
deleted file mode 100644
index 210734d1ae..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif
deleted file mode 100644
index 5e1eafa854..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif
deleted file mode 100644
index bfd74889f8..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif
deleted file mode 100644
index 1095ed7583..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif
deleted file mode 100644
index 06e8795df8..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif
deleted file mode 100644
index 3c02fcbe81..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif
deleted file mode 100644
index 1d93973c75..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif
deleted file mode 100644
index 18fbae08ab..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif
deleted file mode 100644
index 334e8e4a40..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif
deleted file mode 100644
index 2e2f1c2f10..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif
deleted file mode 100644
index 48197cbfc9..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif
deleted file mode 100644
index 4a294b4984..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif
deleted file mode 100644
index 65c0e4efa2..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif
deleted file mode 100644
index c8257c9336..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif
deleted file mode 100644
index 215a73821c..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif
deleted file mode 100644
index 03099a95be..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif
deleted file mode 100644
index abec6aba40..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif
deleted file mode 100644
index 2c223ba2c5..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif
deleted file mode 100644
index 77ef8a26cf..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif
deleted file mode 100644
index 3179b87ad9..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif
deleted file mode 100644
index be01e4a72a..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif
deleted file mode 100644
index 0bb39e91ff..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif b/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif
deleted file mode 100644
index cf03d7f325..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl b/ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl
deleted file mode 100644
index b66fa7fb31..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl
+++ /dev/null
@@ -1,15 +0,0 @@
-# pkgIndex.tcl for additional tile pixmap themes.
-#
-# We don't provide the package is the image subdirectory isn't present,
-# or we don't have the right version of Tcl/Tk
-#
-# To use this automatically within tile, the tile-using application should
-# use tile::availableThemes and tile::setTheme
-#
-# $Id: pkgIndex.tcl,v 1.1.2.1 2005/11/25 07:04:59 nagai Exp $
-
-if {![file isdirectory [file join $dir keramik]]} { return }
-if {![package vsatisfies [package provide Tcl] 8.4]} { return }
-
-package ifneeded tile::theme::keramik 0.3.2 \
- [list source [file join $dir keramik.tcl]]
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/ext/tk/sample/tkextlib/tile/themes/kroc.rb
deleted file mode 100644
index f67ce7a897..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc.rb
+++ /dev/null
@@ -1,200 +0,0 @@
-#
-# kroc.rb
-#
-# based on:
-# >> kroc.tcl - Copyright (C) 2004 David Zolli <kroc@kroc.tk>
-#
-
-imgdir = File.join(File.dirname(__FILE__), 'kroc', 'kroc')
-$images = Tk::Tile.load_images(imgdir, '*.gif')
-
-if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
- $TNotebook_Tab = Tk::Tile::TNotebook.style('Tab')
-else
- $TNotebook_Tab = 'Tab.TNotebook'
-end
-
-def kroc_rb_settings
- # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F',
- # :troughcolor=>'#F8C278', :borderwidth=>1)
- # or
- # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F',
- # :troughcolor=>'#F8C278', :borderwidth=>1)
- # or
- # Tk::Tile::Style.default('.', :background=>'#FCB64F',
- # :troughcolor=>'#F8C278', :borderwidth=>1)
- # or
- # Tk::Tile::Style.default(nil, :background=>'#FCB64F',
- # :troughcolor=>'#F8C278', :borderwidth=>1)
- # or
- Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278',
- :borderwidth=>1)
- # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default,
- # :borderwidth=>1)
- # or
- # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default,
- # :borderwidth=>1)
- # or
- # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default,
- # :borderwidth=>1)
- # or
- # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default,
- # :borderwidth=>1)
- # or
- Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1)
-
- # Tk::Tile::Style.map(TkRoot, :background=>[:active, '#694418'])
- # or
- # Tk::Tile::Style.map(Tk.root, :background=>[:active, '#694418'])
- # or
- # Tk::Tile::Style.map('.', :background=>[:active, '#694418'])
- # or
- # Tk::Tile::Style.map(nil, :background=>[:active, '#694418'])
- # or
- Tk::Tile::Style.map(:background=>[:active, '#694418'])
- Tk::Tile::Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB'])
-
- # Tk::Tile::Style.default('TButton', :padding=>[10,4])
- Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4])
-
- # Tk::Tile::Style.default('TNotebook.Tab',
- Tk::Tile::Style.default($TNotebook_Tab,
- :padding=>[10, 3], :font=>Tk::Tile::Font::Default)
- # Tk::Tile::Style.map('TNotebook.Tab',
- Tk::Tile::Style.map($TNotebook_Tab,
- :background=>[:selected, '#FCB64F', '', '#FFE6BA'],
- :foreground=>['', 'black'],
- :padding=>[:selected, [10, 6, 10, 3]])
-
- # Tk::Tile::Style.map('TScrollbar',
- Tk::Tile::Style.map(Tk::Tile::TScrollbar,
- :background=>[:pressed, '#694418'],
- :arrowcolor=>[:pressed, '#FEF7CB'],
- :relief=>[:pressed, :sunken])
-
- # Tk::Tile::Style.layout('Vertical.TScrollbar',
- Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar),
- ['Scrollbar.trough', {:children=>[
- 'Scrollbar.uparrow', {:side=>:top},
- 'Scrollbar.downarrow', {:side=>:bottom},
- 'Scrollbar.uparrow', {:side=>:bottom},
- 'Scrollbar.thumb', {:side=>:top, :expand=>true}
- ]}
- ])
-
- # Tk::Tile::Style.layout('Horizontal.TScrollbar',
- Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar),
- ['Scrollbar.trough', {:children=>[
- 'Scrollbar.leftarrow', {:side=>:left},
- 'Scrollbar.rightarrow', {:side=>:right},
- 'Scrollbar.leftarrow', {:side=>:right},
- 'Scrollbar.thumb', {:side=>:left, :expand=>true}
- ]}
- ])
-
- #
- # Elements:
- #
- if TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0
-
- Tk::Tile::Style.element_create('Button.button',
- :image, $images['button-n'],
- :map=>[
- :pressed, $images['button-p'],
- :active, $images['button-h'],
- ], :border=>3, :sticky=>:ew)
-
- Tk::Tile::Style.element_create('Checkbutton.indicator',
- :image, $images['check-nu'],
- :map=>[
- [:pressed, :selected],$images['check-nc'],
- :pressed, $images['check-nu'],
- [:active, :selected], $images['check-hc'],
- :active, $images['check-hu'],
- :selected, $images['check-nc'],
- ], :sticky=>:w)
-
- Tk::Tile::Style.element_create('Radiobutton.indicator',
- :image, $images['radio-nu'],
- :map=>[
- [:pressed, :selected],$images['radio-nc'],
- :pressed, $images['radio-nu'],
- [:active, :selected], $images['radio-hc'],
- :active, $images['radio-hu'],
- :selected, $images['radio-nc'],
- ], :sticky=>:w)
-
- else # tile 0.4 or earlier
-
- Tk::Tile::Style.element_create('Button.button', :pixmap,
- :images=>[
- :pressed, $images['button-p'],
- :active, $images['button-h'],
- '', $images['button-n']
- ], :border=>3, :tiling=>:tile)
-
- Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap,
- :images=>[
- [:pressed, :selected],$images['check-nc'],
- :pressed, $images['check-nu'],
- [:active, :selected], $images['check-hc'],
- :active, $images['check-hu'],
- :selected, $images['check-nc'],
- '', $images['check-nu'],
- ], :tiling=>:fixed)
-
- Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap,
- :images=>[
- [:pressed, :selected],$images['radio-nc'],
- :pressed, $images['radio-nu'],
- [:active, :selected], $images['radio-hc'],
- :active, $images['radio-hu'],
- :selected, $images['radio-nc'],
- '', $images['radio-nu'],
- ], :tiling=>:fixed)
-
- end
-
- #
- # Settings:
- #
- # Tk::Tile::Style.layout(Tk::Tile::TButton,
- Tk::Tile::Style.layout('TButton', [
- 'Button.button', {:children=>[
- 'Button.focus', {:children=>[
- 'Button.padding', {:children=>[
- 'Button.label', {:expand=>true, :sticky=>''}
- ]}
- ]}
- ]}
- ])
-
- # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton,
- Tk::Tile::Style.layout('TCheckbutton', [
- 'Checkbutton.background', # this is not needed in tile 0.5 or later
- 'Checkbutton.border', {:children=>[
- 'Checkbutton.padding', {:children=>[
- 'Checkbutton.indicator', {:side=>:left},
- 'Checkbutton.focus', {:side=>:left, :children=>[
- 'Checkbutton.label'
- ]}
- ]}
- ]}
- ])
-
- # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton,
- Tk::Tile::Style.layout('TRadiobutton', [
- 'Radiobutton.background', # this is not needed in tile 0.5 or later
- 'Radiobutton.border', {:children=>[
- 'Radiobutton.padding', {:children=>[
- 'Radiobutton.indicator', {:side=>:left},
- 'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[
- 'Radiobutton.label', {:side=>:right, :expand=>true}
- ]}
- ]}
- ]}
- ])
-end
-
-Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt',
- :settings=>proc{ kroc_rb_settings() })
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl
deleted file mode 100644
index 73548acef2..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl
+++ /dev/null
@@ -1,163 +0,0 @@
-# kroc.tcl - Copyright (C) 2004 David Zolli <kroc@kroc.tk>
-#
-# A sample pixmap theme for the tile package.
-
-#package require tile::pixmap
-
-namespace eval tile {
- namespace eval kroc {
- variable version 0.0.1
- }
-}
-
-namespace eval tile::kroc {
-
- set imgdir [file join [file dirname [info script]] kroc]
- array set Images [tile::LoadImages $imgdir *.gif]
-
- if {[package vsatisfies [package provide tile] 0.5]} {
- set TNoteBook_Tab TNotebook.Tab
- } else {
- set TNoteBook_Tab Tab.TNotebook
- }
-
- style theme create kroc -parent alt -settings {
-
- style default . -background #FCB64F -troughcolor #F8C278 -borderwidth 1
- style default . -font TkDefaultFont -borderwidth 1
- style map . -background [list active #694418]
- style map . -foreground [list disabled #B2B2B2 active #FFE7CB]
-
- style default TButton -padding "10 4"
-
- style default $TNoteBook_Tab -padding {10 3} -font TkDefaultFont
- style map $TNoteBook_Tab \
- -background [list selected #FCB64F {} #FFE6BA] \
- -foreground [list {} black] \
- -padding [list selected {10 6 10 3}]
-
- style map TScrollbar \
- -background { pressed #694418} \
- -arrowcolor { pressed #FFE7CB } \
- -relief { pressed sunken } \
- ;
-
- style layout Vertical.TScrollbar {
- Scrollbar.trough -children {
- Scrollbar.uparrow -side top
- Scrollbar.downarrow -side bottom
- Scrollbar.uparrow -side bottom
- Scrollbar.thumb -side top -expand true
- }
- }
-
- style layout Horizontal.TScrollbar {
- Scrollbar.trough -children {
- Scrollbar.leftarrow -side left
- Scrollbar.rightarrow -side right
- Scrollbar.leftarrow -side right
- Scrollbar.thumb -side left -expand true
- }
- }
-
- #
- # Elements:
- #
- if {[package vsatisfies [package provide tile] 0.5]} {
-
- style element create Button.button image $Images(button-n) \
- -map [list \
- pressed $Images(button-p) \
- active $Images(button-h) \
- ] -border 3 -sticky ew
-
- style element create Checkbutton.indicator image $Images(check-nu) \
- -map [list \
- {pressed selected} $Images(check-nc) \
- pressed $Images(check-nu) \
- {active selected} $Images(check-hc) \
- active $Images(check-hu) \
- selected $Images(check-nc) \
- ] -sticky w
-
- style element create Radiobutton.indicator image $Images(radio-nu) \
- -map [list \
- {pressed selected} $Images(radio-nc) \
- pressed $Images(radio-nu) \
- {active selected} $Images(radio-hc) \
- active $Images(radio-hu) \
- selected $Images(radio-nc) \
- ] -sticky w
-
- } else {
-
- style element create Button.button pixmap -images [list \
- pressed $Images(button-p) \
- active $Images(button-h) \
- {} $Images(button-n) \
- ] -border 3 -tiling tile
-
- style element create Checkbutton.indicator pixmap -images [list \
- {pressed selected} $Images(check-nc) \
- pressed $Images(check-nu) \
- {active selected} $Images(check-hc) \
- active $Images(check-hu) \
- selected $Images(check-nc) \
- {} $Images(check-nu) \
- ] -tiling fixed
-
- style element create Radiobutton.indicator pixmap -images [list \
- {pressed selected} $Images(radio-nc) \
- pressed $Images(radio-nu) \
- {active selected} $Images(radio-hc) \
- active $Images(radio-hu) \
- selected $Images(radio-nc) \
- {} $Images(radio-nu) \
- ] -tiling fixed
-
- }
-
- #
- # Settings: (*button.background is not needed in tile 0.5 or above)
- #
- style layout TButton {
- Button.button -children {
- Button.focus -children {
- Button.padding -children {
- Button.label -expand true -sticky {}
- }
- }
- }
- }
-
- style layout TCheckbutton {
- Checkbutton.border -children {
- Checkbutton.background
- Checkbutton.padding -children {
- Checkbutton.indicator -side left
- Checkbutton.focus -side left -children {
- Checkbutton.label
- }
- }
- }
- }
-
- style layout TRadiobutton {
- Radiobutton.border -children {
- Radiobutton.background
- Radiobutton.padding -children {
- Radiobutton.indicator -side left
- Radiobutton.focus -expand true -sticky w -children {
- Radiobutton.label -side right -expand true
- }
- }
- }
- }
-
- } }
-
-# -------------------------------------------------------------------------
-
-package provide tile::theme::kroc $::tile::kroc::version
-
-# -------------------------------------------------------------------------
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif
deleted file mode 100644
index e7a140dede..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif
deleted file mode 100644
index 78b506ddeb..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif
deleted file mode 100644
index a5a4e90be1..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif
deleted file mode 100644
index 41503c5ebd..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif
deleted file mode 100644
index b3e512ca67..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif
deleted file mode 100644
index a28c288fce..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif
deleted file mode 100644
index 5c23931bbc..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif
deleted file mode 100644
index 359fe1cc8b..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif
deleted file mode 100644
index 9f46b37926..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif
deleted file mode 100644
index 6437f33a7a..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif b/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif
deleted file mode 100644
index 2d2aac8597..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl b/ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl
deleted file mode 100644
index 4f188b77e0..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl
+++ /dev/null
@@ -1,15 +0,0 @@
-# pkgIndex.tcl for additional tile pixmap themes.
-#
-# We don't provide the package is the image subdirectory isn't present,
-# or we don't have the right version of Tcl/Tk
-#
-# To use this automatically within tile, the tile-using application should
-# use tile::availableThemes and tile::setTheme
-#
-# $Id: pkgIndex.tcl,v 1.1.2.1 2005/11/25 07:05:01 nagai Exp $
-
-if {![file isdirectory [file join $dir kroc]]} { return }
-if {![package vsatisfies [package provide Tcl] 8.4]} { return }
-
-package ifneeded tile::theme::kroc 0.0.1 \
- [list source [file join $dir kroc.tcl]]
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl b/ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl
deleted file mode 100644
index f7fd2a899d..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl
+++ /dev/null
@@ -1,16 +0,0 @@
-# pkgIndex.tcl for additional tile pixmap themes.
-#
-# We don't provide the package is the image subdirectory isn't present,
-# or we don't have the right version of Tcl/Tk
-#
-# To use this automatically within tile, the tile-using application should
-# use tile::availableThemes and tile::setTheme
-#
-# $Id: pkgIndex.tcl,v 1.1.2.1 2005/11/25 07:05:02 nagai Exp $
-
-if {![file isdirectory [file join $dir plastik]]} { return }
-if {![package vsatisfies [package provide Tcl] 8.4]} { return }
-
-package ifneeded tile::theme::plastik 0.3.1 \
- [list source [file join $dir plastik.tcl]]
-
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl
deleted file mode 100644
index 51fb7244f6..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik.tcl
+++ /dev/null
@@ -1,125 +0,0 @@
-# plastik.tcl - Copyright (C) 2004 Googie
-#
-# A sample pixmap theme for the tile package.
-#
-# Copyright (c) 2004 Googie
-# Copyright (c) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
-#
-# $Id: plastik.tcl,v 1.1.2.1 2005/11/25 07:05:02 nagai Exp $
-
-package require Tk 8.4
-package require tile 0.5
-
-namespace eval tile::theme::plastik {
-
- variable version 0.3.1
- package provide tile::theme::plastik $version
-
- variable imgdir [file join [file dirname [info script]] plastik]
- variable Images;
- array set Images [tile::LoadImages $imgdir *.gif]
-
- variable colors
- array set colors {
- -frame "#cccccc"
- -disabledfg "#aaaaaa"
- -selectbg "#657a9e"
- -selectfg "#ffffff"
- }
-
-style theme create plastik -parent default -settings {
- style default . \
- -background $colors(-frame) \
- -troughcolor $colors(-frame) \
- -selectbackground $colors(-selectbg) \
- -selectforeground $colors(-selectfg) \
- -font TkDefaultFont \
- -borderwidth 1 \
- ;
-
- style map . -foreground [list disabled $colors(-disabledfg)]
-
- #
- # Layouts:
- #
- style layout Vertical.TScrollbar {
- Scrollbar.background
- Scrollbar.trough -children {
- Scrollbar.uparrow -side top
- Scrollbar.downarrow -side bottom
- Scrollbar.uparrow -side bottom
- Vertical.Scrollbar.thumb -side top -expand true -sticky ns
- }
- }
-
- style layout Horizontal.TScrollbar {
- Scrollbar.background
- Scrollbar.trough -children {
- Scrollbar.leftarrow -side left
- Scrollbar.rightarrow -side right
- Scrollbar.leftarrow -side right
- Horizontal.Scrollbar.thumb -side left -expand true -sticky we
- }
- }
-
- style layout TButton {
- Button.button -children {
- Button.focus -children {
- Button.padding -children {
- Button.label -side left -expand true
- }
- }
- }
- }
-
- #
- # Elements:
- #
- style element create Button.button image $Images(button-n) \
- -border 4 -sticky ew \
- -map [list pressed $Images(button-p) active $Images(button-h)]
-
- style element create Checkbutton.indicator image $Images(check-nu) \
- -sticky {} -map [list \
- {active selected} $Images(check-hc) \
- {pressed selected} $Images(check-pc) \
- active $Images(check-hu) \
- selected $Images(check-nc) \
- ]
-
- style element create Radiobutton.indicator image $Images(radio-nu) \
- -sticky {} -map [list \
- {active selected} $Images(radio-hc) \
- {pressed selected} $Images(radio-pc) \
- active $Images(radio-hu) \
- selected $Images(radio-nc) \
- ]
-
- style element create Horizontal.Scrollbar.thumb \
- image $Images(hsb-n) -border 3 -sticky ew
- style element create Vertical.Scrollbar.thumb \
- image $Images(vsb-n) -border 3 -sticky ns
-
- style element create Scale.slider \
- image $Images(hslider-n) -sticky {}
- style element create Vertical.Scale.slider \
- image $Images(vslider-n) -sticky {}
-
- style element create Scrollbar.uparrow image $Images(arrowup-n) \
- -map [list pressed $Images(arrowup-p)] -sticky {}
- style element create Scrollbar.downarrow image $Images(arrowdown-n) \
- -map [list pressed $Images(arrowdown-p)] -sticky {}
- style element create Scrollbar.leftarrow image $Images(arrowleft-n) \
- -map [list pressed $Images(arrowleft-p)] -sticky {}
- style element create Scrollbar.rightarrow image $Images(arrowright-n) \
- -map [list pressed $Images(arrowright-p)] -sticky {}
-
- #
- # Settings:
- #
- style default TButton -width -10
- style default TNotebook.Tab -padding {6 2 6 2}
- style default TLabelframe -borderwidth 2 -relief groove
-
-} }
-
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif
deleted file mode 100644
index d914e7a3d3..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif
deleted file mode 100644
index abffaa49f6..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif
deleted file mode 100644
index 9939ae1d50..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif
deleted file mode 100644
index 1a45ef2e4b..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif
deleted file mode 100644
index f4b563fed2..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif
deleted file mode 100644
index 5459d5e615..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif
deleted file mode 100644
index 118290cd95..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif
deleted file mode 100644
index 89f9b38c73..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif
deleted file mode 100644
index 548f3769df..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif
deleted file mode 100644
index 49a25909f3..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif
deleted file mode 100644
index e83f7ed985..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif
deleted file mode 100644
index b279fa50d8..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif
deleted file mode 100644
index 5b4fb4f037..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif
deleted file mode 100644
index b139e02a09..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif
deleted file mode 100644
index fbe391f9d8..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif
deleted file mode 100644
index 75a3bd635c..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif
deleted file mode 100644
index b8ea07ea92..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif
deleted file mode 100644
index ce8f28404f..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif
deleted file mode 100644
index 33917715b0..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif
deleted file mode 100644
index 88925d0e1d..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif
deleted file mode 100644
index f8723d367a..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif
deleted file mode 100644
index fb5140e6a1..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif
deleted file mode 100644
index 176225d9e1..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif
deleted file mode 100644
index 85bac4579e..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif b/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif
deleted file mode 100644
index cf887f9855..0000000000
--- a/ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tile/toolbutton.tcl b/ext/tk/sample/tkextlib/tile/toolbutton.tcl
deleted file mode 100644
index 63b805d98b..0000000000
--- a/ext/tk/sample/tkextlib/tile/toolbutton.tcl
+++ /dev/null
@@ -1,152 +0,0 @@
-#
-# $Id: toolbutton.tcl,v 1.1.2.1 2005/04/09 09:27:28 nagai Exp $
-#
-# Demonstration of custom widget styles.
-#
-
-#
-# ~ BACKGROUND
-#
-# Checkbuttons in toolbars have a very different appearance
-# than regular checkbuttons: there's no indicator, they
-# "pop up" when the mouse is over them, and they appear sunken
-# when selected.
-#
-# Tk added partial support for toolbar-style buttons in 8.4
-# with the "-overrelief" option, and TIP #82 added further
-# support with the "-offrelief" option. So to get a toolbar-style
-# checkbutton, you can configure it with:
-#
-# checkbutton .cb \
-# -indicatoron false -selectcolor {} -relief flat -overrelief raised
-#
-# Behind the scenes, Tk has a lot of rather complicated logic
-# to implement this checkbutton style; see library/button.tcl,
-# generic/tkButton.c, and the platform-specific files unix/tkUnixButton.c
-# et al. for the full details.
-#
-# The tile widget set has a better way: custom styles.
-# Since the appearance is completely controlled by the theme engine,
-# we can define a new "Toolbutton" style and just use:
-#
-# checkbutton .cb -style Toolbutton
-#
-#
-# ~ DEMONSTRATION
-#
-# The tile built-in themes (default, "alt", windows, and XP)
-# already include Toolbutton styles. This script will add
-# them to the "step" and "blue" themes as a demonstration.
-#
-# (Note: Pushbuttons and radiobuttons can also use the "Toolbutton"
-# style; see demo.tcl.)
-#
-
-style theme settings "step" {
-
-#
-# First, we use [style layout] to define what elements to
-# use and how they're arranged. Toolbuttons are pretty
-# simple, consisting of a border, some internal padding,
-# and a label. (See also the TScrollbar layout definition
-# in demos/blue.tcl for a more complicated layout spec.)
-#
- style layout Toolbutton {
- Toolbutton.background
- Toolbutton.border -children {
- Toolbutton.padding -children {
- Toolbutton.label
- }
- }
- }
-
-# (Actually the above isn't strictly necessary, since the same layout
-# is defined in the default theme; we could have inherited it
-# instead.)
-#
-# Next, specify default values for element options.
-# For many options (like -background), the defaults
-# inherited from the parent style are sufficient.
-#
- style default Toolbutton -width 0 -padding 1 -relief flat -borderwidth 2
-
-#
-# Finally, use [style map] to specify state-specific
-# resource values. We want a flat relief if the widget is
-# disabled, sunken if it's selected (on) or pressed,
-# and raised when it's active (the mouse pointer is
-# over the widget). Each state-value pair is checked
-# in order, and the first matching state takes precedence.
-#
- style map Toolbutton -relief {
- disabled flat
- selected sunken
- pressed sunken
- active raised
- }
-}
-
-#
-# Now for the "blue" theme. (Since the purpose of this
-# theme is to show what *can* be done, not necessarily what
-# *should* be done, the following makes some questionable
-# design decisions from an aesthetic standpoint.)
-#
-if {![catch {package require tile::theme::blue}]} {
-style theme settings "blue" {
-
- #
- # Default values:
- #
- style default Toolbutton \
- -width 0 -relief flat -borderwidth 2 \
- -background #6699CC -foreground #000000 ;
-
- #
- # Configure state-specific values for -relief, as before:
- #
- style map Toolbutton -relief {
- disabled flat
- selected sunken
- pressed sunken
- active raised
- }
-
- #
- # Adjust the -padding at the same time, to enhance
- # the raised/sunken illusion:
- #
- style default Toolbutton -padding 4
- style map Toolbutton -padding {
- disabled {4}
- selected {6 6 2 2}
- pressed {6 6 2 2}
- active {2 2 6 6}
- }
-
- #
- # ... and change the foreground and background colors
- # when the mouse cursor is over the widget:
- #
- style map Toolbutton -background {
- active #008800
- } -foreground {
- active #FFFFFF
- }
-}
-
-}
-
-#
-# ~ A final note:
-#
-# TIP #82 also says: "When -indicatoron is off and the button itself
-# is on, the relief continues to be hard-coded to sunken. For symmetry,
-# we might consider adding another -onrelief option to cover this
-# case. But it is difficult to imagine ever wanting to change the
-# value of -onrelief so it has been omitted from this TIP.
-# If there as strong desire to have -onrelief, it can be added later."
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The Tile project aims to make sure that this never needs to happen.
-#
diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb
index a4d78ea5b1..d9f3ea7d7c 100644
--- a/ext/tk/sample/tkextlib/tkHTML/hv.rb
+++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb
@@ -78,43 +78,38 @@ big_imgs = {}
hotkey = {}
move_big_image = proc{|b|
- if big_imgs.key?(b)
- b.copy(big_imgs[b])
- big_imgs[b].delete
- big_imgs.delete(b)
- Tk.update
- end
+ return unless big_imgs.key?(b)
+ b.copy(big_imgs[b])
+ big_imgs[b].delete
+ big_imgs.delete(b)
+ Tk.update
}
image_cmd = proc{|*args|
- if show_img.bool
- smgray
- else
- fn = args[0]
+ return smgray unless show_img.bool
+ fn = args[0]
+ if old_imgs.key?(fn)
+ images[fn] = old_imgs[fn]
+ old_imgs.delete(fn)
+ return images[fn]
+ end
- if old_imgs.key?(fn)
- images[fn] = old_imgs[fn]
- old_imgs.delete(fn)
- images[fn]
+ begin
+ img = TkPhotoImage.new(:file=>fn)
+ rescue
+ return smgray
+ end
- else
- begin
- img = TkPhotoImage.new(:file=>fn)
- rescue
- smgray
- else
- if img.width * img.height > 20000
- b = TkPhotoImage.new(:width=>img.width, :height=>img.height)
- big_imgs[b] = img
- img = b
- Tk.after_idle(proc{ move_big_image.call(b) })
- end
-
- images[fn] = img
- img
- end
- end
+ if img.width * img.height > 20000
+ b = TkPhotoImage.new(:width=>img.width, :height=>img.height)
+ big_imgs[b] = img
+ img = b
+ Tk.after_idle(proc{ move_big_image.call(b) })
end
+
+ images[fn] = img
+
+ img
}
#
@@ -188,13 +183,12 @@ clear_screen = proc{
# Load a file into the HTML widget
#
load_file = proc{|name|
- if (doc = read_file.call(name))
- clear_screen.call
- last_file = name
- html.configure(:base=>name)
- html.parse(doc)
- old_imgs.clear
- end
+ return unless (doc = read_file.call(name))
+ clear_screen.call
+ last_file = name
+ html.configure(:base=>name)
+ html.parse(doc)
+ old_imgs.clear
}
href_binding = proc{|x, y|
@@ -202,16 +196,15 @@ href_binding = proc{|x, y|
html.selection_clear
priv['mark'] = "@#{x},#{y}"
lst = html.href(x, y)
+ return if lst.size.zero?
- unless lst.size.zero?
- lnk, target = lst
+ lnk, target = lst
- if lnk != ""
- if lnk =~ /^#{last_file}#(.*)$/
- html.yview($1)
- else
- load_file.call(lnk)
- end
+ if lnk != ""
+ if lnk =~ /^#{last_file}#(.*)$/
+ html.yview($1)
+ else
+ load_file.call(lnk)
end
end
}
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/index.html b/ext/tk/sample/tkextlib/tkHTML/page3/index.html
index d854bd5b8b..ce92e8a22e 100644
--- a/ext/tk/sample/tkextlib/tkHTML/page3/index.html
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/index.html
@@ -29,7 +29,7 @@
resources related to this tutorial<br>are available online at
<a href="http://www.hwaci.com/tcl2k/">
http://www.hwaci.com/tcl2k/</a></p>
- <p align="center"><small>$Id: index.html,v 1.1.2.1 2004/07/01 09:38:51 nagai Exp $</small></p></td></tr>
+ <p align="center"><small>$Id$</small></p></td></tr>
</table>
</center>
</p>
diff --git a/ext/tk/sample/tkextlib/tkHTML/ss.rb b/ext/tk/sample/tkextlib/tkHTML/ss.rb
index 1c13d7ac34..179bdc13cd 100644
--- a/ext/tk/sample/tkextlib/tkHTML/ss.rb
+++ b/ext/tk/sample/tkextlib/tkHTML/ss.rb
@@ -6,431 +6,399 @@
require 'tk'
require 'tkextlib/tkHTML'
+root = TkRoot.new(:title=>'HTML File Viewer', :iconname=>'HV')
+fswin = nil
+
+html = nil
+html_fs = nil
+
+hotkey = {}
+
file = ARGV[0]
-class TkHTML_File_Viewer
- include TkComm
# These are images to use with the actual image specified in a
# "<img>" markup can't be found.
#
-@@biggray = TkPhotoImage.new(:data=><<'EOD')
+biggray = TkPhotoImage.new(:data=><<'EOD')
R0lGODdhPAA+APAAALi4uAAAACwAAAAAPAA+AAACQISPqcvtD6OctNqLs968+w+G4kiW5omm
6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNFgsAO///
EOD
-@@smgray = TkPhotoImage.new(:data=><<'EOD')
+smgray = TkPhotoImage.new(:data=><<'EOD')
R0lGODdhOAAYAPAAALi4uAAAACwAAAAAOAAYAAACI4SPqcvtD6OctNqLs968+w+G4kiW5omm
6sq27gvH8kzX9m0VADv/
EOD
- def initialize(file = nil)
- @root = TkRoot.new(:title=>'HTML File Viewer', :iconname=>'HV')
- @fswin = nil
-
- @html = nil
- @html_fs = nil
-
- @hotkey = {}
-
- @applet_arg = TkVarAccess.new_hash('AppletArg')
-
- @images = {}
- @old_imgs = {}
- @big_imgs = {}
-
- @last_dir = Dir.pwd
-
- @last_file = ''
-
- @key_block = false
-
- Tk::HTML_Widget::ClippingWindow.bind('1',
- proc{|w, ksym| key_press(w, ksym)},
- '%W Down')
- Tk::HTML_Widget::ClippingWindow.bind('3',
- proc{|w, ksym| key_press(w, ksym)},
- '%W Up')
- Tk::HTML_Widget::ClippingWindow.bind('2',
- proc{|w, ksym| key_press(w, ksym)},
- '%W Down')
-
- Tk::HTML_Widget::ClippingWindow.bind('KeyPress',
- proc{|w, ksym| key_press(w, ksym)},
- '%W %K')
-
- ############################################
- #
- # Build the half-size view of the page
- #
- menu_spec = [
- [['File', 0],
- ['Open', proc{sel_load()}, 0],
- ['Full Screen', proc{fullscreen()}, 0],
- ['Refresh', proc{refresh()}, 0],
- '---',
- ['Exit', proc{exit}, 1]]
- ]
-
- mbar = @root.add_menubar(menu_spec)
-
- @html = Tk::HTML_Widget.new(:width=>512, :height=>384,
- :padx=>5, :pady=>9,
- :formcommand=>proc{|*args| form_cmd(*args)},
- :imagecommand=>proc{|*args|
- image_cmd(1, *args)
- },
- :scriptcommand=>proc{|*args|
- script_cmd(*args)
- },
- :appletcommand=>proc{|*args|
- applet_cmd(*args)
- },
- :hyperlinkcommand=>proc{|*args|
- hyper_cmd(*args)
- },
- :fontcommand=>proc{|*args|
- pick_font(*args)
- },
- :appletcommand=>proc{|*args|
- run_applet('small', *args)
- },
- :bg=>'white', :tablerelief=>:raised)
- @html.token_handler('meta', proc{|*args| meta(@html, *args)})
+#
+# A font chooser routine.
+#
+# html[:fontcommand] = pick_font
+pick_font = proc{|size, attrs|
+ # puts "FontCmd: #{size} #{attrs}"
+ [ ((attrs =~ /fixed/)? 'courier': 'charter'),
+ (12 * (1.2**(size.to_f - 4.0))).to_i,
+ ((attrs =~ /italic/)? 'italic': 'roman'),
+ ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ')
+}
+
+# This routine is called to pick fonts for the fullscreen view.
+#
+baseFontSize = 24
+pick_font_fs = proc{|size, attrs|
+ # puts "FontCmd: #{size} #{attrs}"
+ [ ((attrs =~ /fixed/)? 'courier': 'charter'),
+ (baseFontSize * (1.2**(size.to_f - 4.0))).to_i,
+ ((attrs =~ /italic/)? 'italic': 'roman'),
+ ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ')
+}
- vscr = @html.yscrollbar(TkScrollbar.new)
- hscr = @html.xscrollbar(TkScrollbar.new)
+#
+#
+hyper_cmd = proc{|*args|
+ puts "HyperlinkCommand: #{args.inspect}"
+}
- Tk.grid(@html, vscr, :sticky=>:news)
- Tk.grid(hscr, :sticky=>:ew)
- @root.grid_columnconfigure(0, :weight=>1)
- @root.grid_columnconfigure(1, :weight=>0)
- @root.grid_rowconfigure(0, :weight=>1)
- @root.grid_rowconfigure(1, :weight=>0)
+# This routine is called to run an applet
+#
+applet_arg = TkVarAccess.new_hash('AppletArg')
+run_applet = proc{|size, w, arglist|
+ applet_arg.value = Hash[*simplelist(arglist)]
- ############################################
+ return unless applet_arg.key?('src')
- @html.clipwin.focus
+ src = html.remove(applet_arg['src'])
- # If an arguent was specified, read it into the HTML widget.
- #
- Tk.update
- if file && file != ""
- load_file(file)
- end
- end
+ applet_arg['window'] = w
+ applet_arg['fontsize'] = size
- #
- # A font chooser routine.
- #
- # html[:fontcommand] = pick_font
- def pick_font(size, attrs)
- # puts "FontCmd: #{size} #{attrs}"
- [ ((attrs =~ /fixed/)? 'courier': 'charter'),
- (12 * (1.2**(size.to_f - 4.0))).to_i,
- ((attrs =~ /italic/)? 'italic': 'roman'),
- ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ')
+ begin
+ Tk.load_tclscript(src)
+ rescue => e
+ puts "Applet error: #{e.message}"
end
+}
- # This routine is called to pick fonts for the fullscreen view.
- #
- def pick_font_fs(size, attrs)
- baseFontSize = 24
+#
+#
+form_cmd = proc{|n, cmd, *args|
+}
- # puts "FontCmd: #{size} #{attrs}"
- [ ((attrs =~ /fixed/)? 'courier': 'charter'),
- (baseFontSize * (1.2**(size.to_f - 4.0))).to_i,
- ((attrs =~ /italic/)? 'italic': 'roman'),
- ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ')
- end
+#
+#
+images = {}
+old_imgs = {}
+big_imgs = {}
- #
- #
- def hyper_cmd(*args)
- puts "HyperlinkCommand: #{args.inspect}"
+#
+#
+move_big_image = proc{|b|
+ return unless big_imgs.key?(b)
+ b.copy(big_imgs[b])
+ big_imgs[b].delete
+ big_imgs.delete(b)
+}
+
+image_cmd = proc{|hs, *args|
+ fn = args[0]
+
+ if old_imgs.key?(fn)
+ return (images[fn] = old_imgs.delete(fn))
end
- # This routine is called to run an applet
- #
- def run_applet(size, w, arglist)
- applet_arg.value = Hash[*simplelist(arglist)]
-
- return unless @applet_arg.key?('src')
-
- src = @html.remove(@applet_arg['src'])
-
- @applet_arg['window'] = w
- @applet_arg['fontsize'] = size
-
- begin
- Tk.load_tclscript(src)
- rescue => e
- puts "Applet error: #{e.message}"
- end
+ begin
+ img = TkPhotoImage.new(:file=>fn)
+ rescue
+ return ((hs)? smallgray: biggray)
end
- #
- #
- def form_cmd(n, cmd, *args)
- # p [n, cmd, *args]
+ if hs
+ img2 = TkPhotoImage.new
+ img2.copy(img, :subsample=>[2,2])
+ img.delete
+ img = img2
end
- #
- #
- def move_big_image(b)
- return unless @big_imgs.key?(b)
- b.copy(@big_imgs[b])
- @big_imgs[b].delete
- @big_imgs.delete(b)
+ if img.width * img.height > 20000
+ b = TkPhotoImage.new(:width=>img.width, :height=>img.height)
+ big_imgs[b] = img
+ img = b
+ Tk.after_idle(proc{ move_big_image.call(b) })
end
- def image_cmd(hs, *args)
- fn = args[0]
+ images[fn] = img
- if @old_imgs.key?(fn)
- return (@images[fn] = @old_imgs.delete(fn))
- end
+ img
+}
- begin
- img = TkPhotoImage.new(:file=>fn)
- rescue
- return ((hs)? @@smallgray: @@biggray)
- end
- if hs
- img2 = TkPhotoImage.new
- img2.copy(img, :subsample=>[2,2])
- img.delete
- img = img2
- end
-
- if img.width * img.height > 20000
- b = TkPhotoImage.new(:width=>img.width, :height=>img.height)
- @big_imgs[b] = img
- img = b
- Tk.after_idle(proc{ move_big_image(b) })
- end
+#
+# This routine is called for every <SCRIPT> markup
+#
+script_cmd = proc{|*args|
+ # puts "ScriptCmd: #{args.inspect}"
+}
- @images[fn] = img
+# This routine is called for every <APPLET> markup
+#
+applet_cmd = proc{|w, arglist|
+ # puts "AppletCmd: w=#{w} arglist=#{arglist}"
+ #TkLabel.new(w, :text=>"The Applet #{w}", :bd=>2, :relief=>raised)
+}
- img
+# This binding fires when there is a click on a hyperlink
+#
+href_binding = proc{|w, x, y|
+ lst = w.href(x, y)
+ unless lst.empty?
+ process_url.call(lst)
end
+}
- #
- # This routine is called for every <SCRIPT> markup
- #
- def script_cmd(*args)
- # puts "ScriptCmd: #{args.inspect}"
+#
+#
+last_dir = Dir.pwd
+sel_load = proc{
+ filetypes = [
+ ['Html Files', ['.html', '.htm']],
+ ['All Files', '*']
+ ]
+
+ f = Tk.getOpenFile(:initialdir=>last_dir, :filetypes=>filetypes)
+ if f != ''
+ load_file.call(f)
+ last_dir = File.dirname(f)
end
+}
- # This routine is called for every <APPLET> markup
- #
- def applet_cmd(w, arglist)
- # puts "AppletCmd: w=#{w} arglist=#{arglist}"
- #TkLabel.new(w, :text=>"The Applet #{w}", :bd=>2, :relief=>raised)
+# Clear the screen.
+#
+clear_screen = proc{
+ if html_fs && html_fs.exist?
+ w = html_fs
+ else
+ w = html
end
-
- # This binding fires when there is a click on a hyperlink
- #
- def href_binding(w, x, y)
- lst = w.href(x, y)
- unless lst.empty?
- process_url(lst)
- end
+ w.clear
+ old_imgs.clear
+ big_imgs.clear
+ hotkey.clear
+ images.each{|k, v| old_imgs[k] = v }
+ images.clear
+}
+
+# Read a file
+#
+read_file = proc{|name|
+ begin
+ fp = open(name, 'r')
+ ret = fp.read(File.size(name))
+ rescue
+ ret = nil
+ fp = nil
+ Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'",
+ :type=>:ok)
+ ensure
+ fp.close if fp
end
+ ret
+}
- #
- #
- def sel_load
- filetypes = [
- ['Html Files', ['.html', '.htm']],
- ['All Files', '*']
- ]
-
- f = Tk.getOpenFile(:initialdir=>@last_dir, :filetypes=>filetypes)
- if f != ''
- load_file(f)
- @last_dir = File.dirname(f)
- end
+# Process the given URL
+#
+process_url = proc{|url|
+ case url[0]
+ when /^file:/
+ load_file.call(url[0][5..-1])
+ when /^exec:/
+ Tk.ip_eval(url[0][5..-1].tr('\\', ' '))
+ else
+ load_file.call(url[0])
end
+}
- # Clear the screen.
- #
- def clear_screen
- if @html_fs && @html_fs.exist?
- w = @html_fs
- else
- w = @html
- end
- w.clear
- @old_imgs.clear
- @big_imgs.clear
- @hotkey.clear
- @images.each{|k, v| @old_imgs[k] = v }
- @images.clear
+# Load a file into the HTML widget
+#
+last_file = ''
+
+load_file = proc{|name|
+ return unless (doc = read_file.call(name))
+ clear_screen.call
+ last_file = name
+ if html_fs && html_fs.exist?
+ w = html_fs
+ else
+ w = html
end
+ w.configure(:base=>name)
+ w.parse(doc)
+ w.configure(:cursor=>'top_left_arrow')
+ old_imgs.clear
+}
- # Read a file
- #
- def read_file(name)
- begin
- fp = open(name, 'r')
- ret = fp.read(File.size(name))
- rescue
- ret = nil
- fp = nil
- Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'",
- :type=>:ok)
- ensure
- fp.close if fp
- end
- ret
+# Refresh the current file.
+#
+refresh = proc{|*args|
+ load_file.call(last_file) if last_file
+}
+
+# This routine is called whenever a "<meta>" markup is seen.
+#
+meta = proc{|w, tag, alist|
+ v = Hash[*simplelist(alist)]
+
+ if v.kye?('key') && v.key?('href')
+ hotkey[v['key']] = w.resolve(v['href'])
end
- # Process the given URL
- #
- def process_url(url)
- case url[0]
- when /^file:/
- load_file(url[0][5..-1])
- when /^exec:/
- Tk.ip_eval(url[0][5..-1].tr('\\', ' '))
- else
- load_file(url[0])
- end
+ if v.kye?('next')
+ hotkey['Down'] =v['next']
end
- # Load a file into the HTML widget
- #
- def load_file(name)
- return unless (doc = read_file(name))
- clear_screen()
- @last_file = name
- if @html_fs && @html_fs.exist?
- w = @html_fs
- else
- w = @html
- end
- w.configure(:base=>name)
- w.parse(doc)
- w.configure(:cursor=>'top_left_arrow')
- @old_imgs.clear
+ if v.kye?('prev')
+ hotkey['Up'] =v['prev']
end
- # Refresh the current file.
- #
- def refresh(*args)
- load_file(@last_file) if @last_file
+ if v.kye?('other')
+ hotkey['o'] =v['other']
end
+}
- # This routine is called whenever a "<meta>" markup is seen.
- #
- def meta(w, tag, alist)
- v = Hash[*simplelist(alist)]
+# Go from full-screen mode back to window mode.
+#
+fullscreen_off = proc{
+ fswin.destroy
+ root.deiconify
+ Tk.update
+ root.raise
+ html.clipwin.focus
+ clear_screen.call
+ old_imgs.clear
+ refresh.call
+}
+
+# Go from window mode to full-screen mode.
+#
+fullscreen = proc{
+ if fswin && fswin.exist?
+ fswin.deiconify
+ Tk.update
+ fswin.raise
+ return
+ end
- if v.key?('key') && v.key?('href')
- @hotkey[v['key']] = w.resolve(v['href'])
- end
+ width = root.winfo_screenwidth
+ height = root.winfo_screenheight
+ fswin = TkToplevel.new(:overrideredirect=>true,
+ :geometry=>"#{width}x#{height}+0+0")
+
+ html_fs = Tk::HTML_Widget.new(fswin, :padx=>5, :pady=>9,
+ :formcommand=>form_cmd,
+ :imagecommand=>proc{image_cmd.call(0)},
+ :scriptcommand=>script_cmd,
+ :appletcommand=>applet_cmd,
+ :hyperlinkcommand=>hyper_cmd,
+ :bg=>'white', :tablerelief=>:raised,
+ :appletcommand=>proc{|*args|
+ run_applet('big', *args)
+ },
+ :fontcommand=>pick_font_fs,
+ :cursor=>:tcross) {
+ pack(:fill=>:both, :expand=>true)
+ token_handler('meta', proc{|*args| meta.call(self, *args)})
+ }
+
+ clear_screen.call
+ old_imgs.clear
+ refresh.call
+ Tk.update
+ html_fs.clipwin.focus
+}
- if v.key?('next')
- @hotkey['Down'] =v['next']
- end
+#
+#
+key_block = false
- if v.key?('prev')
- @hotkey['Up'] =v['prev']
- end
+key_press = proc{|w, keysym|
+ return if key_block
+ key_block = true
+ Tk.after(250, proc{key_block = false})
- if v.key?('other')
- @hotkey['o'] =v['other']
+ if hotkey.key?(keysym)
+ process_url.call(hotkey[keysym])
+ end
+ case keysym
+ when 'Escape'
+ if fswin && fswin.exist?
+ fullscreen_off.call
+ else
+ fullscreen.call
end
end
+}
- # Go from full-screen mode back to window mode.
- #
- def fullscreen_off
- @fswin.destroy
- @root.deiconify
- Tk.update
- @root.raise
- @html.clipwin.focus
- clear_screen()
- @old_imgs.clear
- refresh()
- end
+Tk::HTML_Widget::ClippingWindow.bind('1', key_press, '%W Down')
+Tk::HTML_Widget::ClippingWindow.bind('3', key_press, '%W Up')
+Tk::HTML_Widget::ClippingWindow.bind('2', key_press, '%w Down')
- # Go from window mode to full-screen mode.
- #
- def fullscreen
- if @fswin && @fswin.exist?
- @fswin.deiconify
- Tk.update
- @fswin.raise
- return
- end
+Tk::HTML_Widget::ClippingWindow.bind('KeyPress', key_press, '%W %K')
- width = @root.winfo_screenwidth
- height = @root.winfo_screenheight
- @fswin = TkToplevel.new(:overrideredirect=>true,
- :geometry=>"#{width}x#{height}+0+0")
-
- @html_fs = Tk::HTML_Widget.new(@fswin, :padx=>5, :pady=>9,
- :formcommand=>proc{|*args|
- form_cmd(*args)
- },
- :imagecommand=>proc{|*args|
- image_cmd(0, *args)
- },
- :scriptcommand=>proc{|*args|
- script_cmd(*args)
- },
- :appletcommand=>proc{|*args|
- applet_cmd(*args)
- },
- :hyperlinkcommand=>proc{|*args|
- hyper_cmd(*args)
- },
- :appletcommand=>proc{|*args|
- run_applet('big', *args)
- },
- :fontcommand=>proc{|*args|
- pick_font_fs(*args)
- },
- :bg=>'white', :tablerelief=>:raised,
- :cursor=>:tcross) {
- pack(:fill=>:both, :expand=>true)
- token_handler('meta', proc{|*args| meta(self, *args)})
- }
-
- clear_screen()
- @old_imgs.clear
- refresh()
- Tk.update
- @html_fs.clipwin.focus
- end
- #
- #
- def key_press(w, keysym)
- return if @key_block
- @key_block = true
- Tk.after(250, proc{@key_block = false})
+############################################
+#
+# Build the half-size view of the page
+#
+menu_spec = [
+ [['File', 0],
+ ['Open', sel_load, 0],
+ ['Full Screen', fullscreen, 0],
+ ['Refresh', refresh, 0],
+ '---',
+ ['Exit', proc{exit}, 1]]
+]
+
+mbar = root.add_menubar(menu_spec)
+
+html = Tk::HTML_Widget.new(:width=>512, :height=>384,
+ :padx=>5, :pady=>9,
+ :formcommand=>form_cmd,
+ :imagecommand=>proc{|*args|
+ image_cmd.call(1, *args)
+ },
+ :scriptcommand=>script_cmd,
+ :appletcommand=>applet_cmd,
+ :hyperlinkcommand=>hyper_cmd,
+ :fontcommand=>pick_font,
+ :appletcommand=>proc{|*args|
+ run_applet.call('small', *args)
+ },
+ :bg=>'white', :tablerelief=>:raised)
+
+html.token_handler('meta', proc{|*args| meta.call(html, *args)})
+
+vscr = html.yscrollbar(TkScrollbar.new)
+hscr = html.xscrollbar(TkScrollbar.new)
+
+Tk.grid(html, vscr, :sticky=>:news)
+Tk.grid(hscr, :sticky=>:ew)
+Tk.root.grid_columnconfigure(0, :weight=>1)
+Tk.root.grid_columnconfigure(1, :weight=>0)
+Tk.root.grid_rowconfigure(0, :weight=>1)
+Tk.root.grid_rowconfigure(1, :weight=>0)
+
- if @hotkey.key?(keysym)
- process_url(@hotkey[keysym])
- end
- case keysym
- when 'Escape'
- if @fswin && @fswin.exist?
- fullscreen_off()
- else
- fullscreen()
- end
- end
- end
-end
############################################
-TkHTML_File_Viewer.new(file)
+html.clipwin.focus
+
+# If an arguent was specified, read it into the HTML widget.
+#
+Tk.update
+if file && file != ""
+ load_file.call(file)
+end
+
+############################################
Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tkimg/demo.rb b/ext/tk/sample/tkextlib/tkimg/demo.rb
deleted file mode 100644
index a0c4d1b64f..0000000000
--- a/ext/tk/sample/tkextlib/tkimg/demo.rb
+++ /dev/null
@@ -1,1478 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Tk::Img demo
-#
-# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extention.
-# Image data in this script is those of demo.tcl.
-# Please read 'license_terms_of_Img_extension' file.
-#
-require 'tk'
-require 'tkextlib/tkimg'
-
-#
-# Make the Image format available.
-#
-class TkImg_demo
- def initialize
- img_version = Tk::Img.package_version
-
- @typeFrame = Hash.new
- @imgPriv = Hash.new
-
- root = TkRoot.new(:title=>'Tests for available image formats')
-
- root.winfo_children.each{|w| w.destroy}
- TkImage.names{|img| img.delete}
-
- f = TkFrame.new
- TkButton.new(f, :text=>'Dismiss', :command=>proc{exit}).pack(:side=>:left)
- f.pack(:side=>:top, :expand=>:y, :fill=>:both)
-
- TkMessage.new(:aspect=>900, :text=>format('This page shows the available image formats of the Img extension (Img version %s, using Tcl/Tk %s)', img_version, Tk::TK_PATCHLEVEL)).pack(:side=>:top, :expand=>:y, :fill=>:both)
- end
-
-##############################
-
- def update_animated_gif(w, method, num)
- return unless @imgPriv[w]
-
- if @imgPriv[w][:args]
- im = TkPhotoImage.new
- im.copy(@imgPriv[w][num])
- num += 1
- begin
- im.configure(@imgPriv[w][:args].merge(:format=>[:gif, {:index=>num}]))
- im.configure(:data=>'', :file=>'') #free storage
- @imgPriv[w][num] = im
- rescue
- @imgPriv[w].delete(:args)
- if num > 1
- num = 0
- im = @imgPriv[w][num]
- else
- # this is not an animated GIF; just stop
- @imgPriv[w].delete(0)
- return
- end
- end
- else
- num += 1
- num = 0 unless @imgPriv[w][num]
- im = @imgPriv[w][num]
- end
- begin
- w.__send__(method, im)
- Tk.update_idletasks
- Tk.after(20, proc{update_animated_gif(w, method, num)})
- rescue
- @imgPriv[w].delete(:args)
- @imgPriv[w].each{|im|
- @im.delete
- @imgPriv.delete(im)
- }
- end
- end
-
- def show_animated_gif(keys)
- w = TkLabel.new
- begin
- im = TkPhotoImage.new(keys.merge(:format=>[:gif, {:index=>0}]))
- im.configure(:data=>'', :file=>'', :format=>'') #free storage
- w.image(im)
- @imgPriv[w] ||= Hash.new
- @imgPriv[w][0] = im
- @imgPriv[w][:args] = keys
- Tk.update_idletasks
- Tk.after(20, proc{update_animated_gif(w, :image, 0)})
- rescue => e
- w.configure(:text=>"error displaying animated gif:\n#{e.message}",
- :image=>'', :relief=>:ridge)
- end
- w.pack
- end
-
- def show_image(fmt, type, data)
- fmt = fmt.to_s.capitalize
- unless @typeFrame[fmt]
- @typeFrame[fmt] = TkFrame.new.pack(:side=>:top, :expand=>true, :fill=>:x)
- TkLabel.new(@typeFrame[fmt], :text=>"#{fmt} : ").pack(:side=>:left)
- end
- begin
- f = TkFrame.new(@typeFrame[fmt],
- :borderwidth=>2, :relief=>:ridge).pack(:side=>:left)
- im = TkPhotoImage.new(:data=>data)
- im['data'] = ''
- TkLabel.new(f, :image=>im).pack
- TkLabel.new(f, :text=>type, :borderwidth=>0, :pady=>0, :padx=>2,
- :font=>'Helvetica 8').pack
- rescue => e
- TkMessage.new(f, :text=>"error displaying #{type} image: #{e.message}",
- :aspect=>250).pack
- end
- Tk.update
- end
-
-end
-
-##############
-
-demo = TkImg_demo.new
-
-##############
-
-demo.show_animated_gif(:data=><<'ENDofIMG')
-R0lGODlhYgIEAIIAAQAAACQAJEkASW0AbZIAkrYAttsA2/8A/yH/C05FVFNDQVBFMi4wAwEA
-AAAh+QQABgD/ACwAAAAAYgIEAAIDuUg63CMwwiCCvQAHwLv/YCiOZGmeaKqubOu+pZXNV03d
-kuAwysLoucjNlpFtYMikcslsOp+ijbRow1EiD12jtyA4INnJZGg8HmfQtHrNbrPP6KqlEgRq
-B17vzi6ukKVmHXBuhIWGh4RTcXJ0QQ8OeVx6XzlWVTRoiJqbnJ0tGmUXdDhgd1uTP2FCo5dT
-g56wsbKaoYBzVlimPJJ7QX9EirPCw8RttTZ1ul29Er81mMXR0tMvxzXJO1wAACH5BAAGAP8A
-LAAAAABiAgQAAgPdCLrc/jDKSau9OOuNAwjgB46kEJjnKazr0A5wTBDDbBc4buz74f/AoHBI
-LBqPSCGPh7M5abQYTOBysVYprAlFCo0+YI9CzCmbz+i0es1uu9/wOFrsqYtE3S73yq9SpTBP
-BDk5PEmHiImKRQYHTISDNjWTMX9UfFuZIFwkY3RhcqGio6SlpqeoqRt2dXmuWyqZV1Z/UjM1
-ToQFS46Lvr/AQUu6BYK4gJe0V7Eprl+sXqrS09TV1tfYbKxhziqxmFOAgYKDOrs9wenqSY07
-uznklFKXmCzN3aB22fv81AAAIfkEAAYA/wAspgAAABgBBAACA+YIEQrNS61Jg1hX6C2GHiBI
-DERpFkShFkZrHHAsz3Rt06/Lrqk5jqFQ58PheI5B0s+HWrFch9dtSp26dDyULwnqeIoay+Qi
-rkAcZ4YDrVY/IOaxGGz0IkPLknN3rfr/MToGTilaJSRcR3RgikF5JyuDfYCUVFeDKj0mSkle
-Q4sYcXFvaA1rDxIScKIZYUVfiUA+PU6Tlbc4US07PJs/nYqLQ4kieZkqki24yzJXe5qziEHD
-dHNloqqpbqfcbquiGK2MH0mzkJG2zLfOhObSQsHC1OVKTLVQUurrWL1biZ9grIFLs2YbNwAh
-+QQABgD/ACyHAAAAVwEEAAID/ggQy94uyCloFTgPsYf/AyGOYmGaRnoYR+u+cCzPcZqeJyl6
-xMdhm4zwUgkUJ8iFkqFgKptQCQRJMRqJwqAPtCMVCDhDwcaimc9mslhs0vXeoJ9caL1Q748n
-tMl89PFURURXQx4cH11eYChjKmiPkC5kOGCVIyCYWkN2VoB8fXtOS34RgJybGkCZbosnZJGw
-aCw3bF9tXSFxhqhXnb5JSUt6CsKlxneDqHIdqyEjOI0qZbHUMGq1bs6Yh3NDdb93U1Ki41Hi
-poSEqYZcuYphr9XykjbQrLnbHbwYEkd4xQ2GERvoZxQ6LIUOrWLlKtq8h5Ps6ci0SxknQOVE
-Ddy4HvGPQVMIC1Hk4QZavIfUZq3J8YUEPl0WL3qaIIwjMQAh+QQABgD/ACxlAAAAmwEEAAID
-/ggRCr1qSSlWDVXorYfwQxgSxECSBVGsheEaB3zMdG3feF7DbsumJ5JJJPpwjhnLZMloPp4M
-h3RKrVqv2KxW2nRGmBQlBnP0dD7EYfDne8l08DjcbfgFhaW0cX8ciy9LD05RUREOhQ2GYEoa
-ZGQbIGlDJmsqPy9ymZo0PD11Kyp3anogfX5igamGh1utrq+uhFBQYBm2j5CSIncnLHWYm8Fx
-bj52QZOSSBeNp2BfEIVeU4PUi0mOSJFoaXcpvnTC4TnExiejRdrK2IsSgrKIsPHyr4OJ7GHL
-thxmkSN4vZdauIghriCnF2yAmBOCzoiZPkkAOav3JEs0d+z0ZdPFMgvFJWAGCxL7pPBYHiJ8
-TElcNGuey5cwW97Dp6yDpBK82LgJaXAki47IGqq7xm4WPCoAACH5BAAGAP8ALEYAAADZAQQA
-AgP+GKC7yiHKGYSo1Wo9xPgfMYhEWRZoYaiGcbxwLM90Tbf4ihKFSYqgjnBDjFwuGMoD0Fgy
-n9CodEqtWq/YrHa7hTgaTSXySCZ6PMFQyJdC5Vy2uFz+VqV8pFH6czYfM0pKYF4MYE0OD4ET
-Y4BEfHt6eDt2OAdwc5iZLzhtO3iQIBYdGhgWpYoTYUxOXK2ur7CxrV5fqBR/GWZDaT9sPG4s
-l5rDNi4tdpOfQGlno6SmSEkUiISDT4mJtYpkubq7Qb0mbSuVwsTnmzltPJ96oY9+uNGKiLWy
-9/j5+l3YqrZl3UT12YPnxLg36BLCULdOmbt38bjNC3TISSEqSyRQE1M8yo8QXiMk/XJTSaFC
-hg19gIp4auI0Vhf3yZxJUx8EbP/K6EIDLqSvgy1MJlSno0cPlcsg+gEkTZBGVlMAACH5BAAG
-AP8ALCYAAAAXAgQAAgP+CAHaHQtKKGioV+itRx/gQIBESRTnWRRGexhHLM90bd9127Jrao7A
-kMfDKVommMnisYwwHM+odEqtWq/YrHbL7Xq/YIaTCVEoj5YiZ8gmiX6l1UrnguHu+DvdIEeh
-4EJsAkRqGBoXZxJmEU2NYo9mYoyJFRwZG22Bbz99LHR5oKEydDxyPiUimiCDrIeViK9ni4wP
-kGG3uLm6u7y9tmO1iRKuGZeYmUDJJn18OqLPoKQ9fyZuga2Er4fCioqRTVFlZWTcxJVFQx9u
-yioqPM7Q8TbSptRBI0KthRvF3OLitnwJHEiwoMErk5jMOmMIVqFMIdjFmeMJhh15GF/o6HRK
-qhq+VayyWYLlr5GTcVjAlTS0DyIJOBPlfMqI0WKzeoA+htCnph+3SFAOCh1KtGivk/+EnWs5
-KJDEFMzg0ZS3BydMVSL5aStJ6woAIfkEAAYA/wAsBwAAAFUCBAACA/4ICqEd8MUJRQ0i65GH
-F55HEMM4FkShFgZrHHAsz3Rt10aer6s5lqEQqKPRYI6WI+XBYDYYi+diSq1ar9isdsvter/g
-sHhMLkebUEhziUkai8ROMOQ78Vy6m37Pf+1aPXUlJEJCcG9ubGpOaWlPUowSSxYZbW1FHCBz
-g3V3eC98oaIwfi07KCkmQIQfH4eUsBdLa4tnUma4ubq7vL2+v1mPUGiKE7GVh4V0Pz53pjmj
-0X06LD2oqqxBG4dKiRS0TrdTkcURlBWwmJqaIqsmqDw6oNL0NPKeddnaHJlwl0qKGgkTB6yg
-wYMIEyq8Qm5RsXOW4PCbGIREp3jy5tXbWE4KUCBsm4aI5HYuSUBJDoZZgQTu4aVkm5ZdVCFv
-o01SB/589AFkzshXAE8KXEi0qNGjSMlEajnpJcxN+exUy3OTIzUeUXvue4WsXC0mWAAAIfkE
-AAYA/wAsAAAAAGICBAACA/4YotIuA8JBKxkk60KKN6BxiEdpnmiqrmhoeF6naVXdRI/DBAq/
-8MAAQDgsEgHIpHLJbDqf0Kh0Sq1ar9isdsvterdEIW8IJAfPv0XOEalZZjJYwcWq2++i0Fwu
-m2HcbWs5PWoMgm01F4obci90d5CRJS5yHBw0GX8UEpw6D4RnY0FGYUVfp6ipqqusra6vXKVk
-pqFBhYM5gYkYcJWOIZLBdnovMH2YbjcSOLc+hA2GyoB/cBmWe8DC2ivExpdw05vMn4W1o2Wi
-sOrr7O3u7/BVoujz5mrQhxNuF7zWHTCPtgmcNALEHmPg+NnohOvHs3yILPRjBBAYiYHaXBRD
-6CtnmiBP5mqZGhmvpMmTKFOqbBJGTEgg+D5GlFjt2pyAGIVR4lNNU7JxnhwCACH5BAAGAP8A
-LAAAAABiAgQAAgPtWLZ7/jDKSaU5rOhCuu9DKA5CKJRnGgjB6rJt3AIxDdzBbet87//AoHBI
-LBqPyKRyyWw6n9CodOrL8ay5rFa2YsG8qRNJXAoRRB8CZ6NgYCrweJxhUNjd8rz+QWevPwMg
-ImUoYWEtX1wzNFg2jVSQkZKTlJWWl5iZTo+OW4qIMYZhJKQjgWlqbHQXe61wFwt2bQ2utROw
-sX6oZqYoY4YvLp81WY47msjJysvMzc7PxjPEw2DVKWOmvKceaxurtuB8GLl1Dazhtn0bqGdn
-vb/AXsPE0dD29/j5+vvLVtHzJ7qIKpSNXSpVtNCly1AAACH5BAAGAP8ALAAAAABiAgQAAgPV
-eLq8diYWUwqxJJOx9/iDEIpCaZpBmQZs6wYAC8QwPd94ru987//AoHBILBqPyKRyyWw6n9Ao
-Elaj0l4tlYC1PZVCoHBnnLFUJpF0Y81uOyCTc0Wj4YRBJO9qu8LKqjaAUoOEhYaHiImKi4yN
-TzUxN1STflxZXiZgInccdGZyaQ9uo24PoXFmdHacJCOYKXx8lZRXM5COuLm6u7y9vr+KtJSz
-e1perpwZnRqfaGqk0GunZxd0yh54mq8qxFaRwODh4uPk5eaEVVbdxpibm3fWZXLOotEAADs=
-ENDofIMG
-
-demo.show_image('bmp', '1-bit', <<'ENDofIMG')
-Qk3OAQAAAAAAAD4AAAAoAAAAIgAAADIAAAABAAEAAAAAAJABAABtCwAAbQsAAAIAAAACAAAA
-MzPMAMwzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAZmTKAAAAAABIRIwAAAAAAEZAigAAAAAAQECIAAAAAAAAAAgAAAAAAAAEAA
-AAAAAAABQAAAAAAAAAPAAAAAAAAAB+AAAAAAAAAC4AAAAAAAAALgAAAAAAAAAsAAAAAAAAAC
-wAAAAAAAAALgAAAAAAAABuAAAAAAAAAG4AAAAAAAAAbgAAAAAAAABuAAAAAAAAAG4AAAAAAA
-AAfgAAAAAAAAA+AAAAAAAAADcAAAAAAAAAPwAAAAAAAAA/AAAAAAAAAD+AAAAAAAAAP4AAAA
-AAAAA/gAAAAAAAAD4AAAAAAAAAHgAAAAAAAAAfAAAAAAAAAA+AAAAAAAAAB8AAAAAAAAADgA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-ENDofIMG
-
-demo.show_image('bmp', '4-bit', <<'ENDofIMG')
-Qk1aBAAAAAAAAHIAAAAoAAAAIgAAADIAAAABAAQAAAAAAOgDAABtCwAAbQsAAA8AAAAPAAAA
-////AAD//wDMzP8AmZn/AGaZ/wAzM8wAmZnMAGaZzAAzZswAzMyZAJmZmQDMZjMAZjNmADMz
-ZgBmMzMABWMgAAAAAAAAAAAAAAAAAAAAAAAFVVVVVVVVVVVVVVVVVVVVUAAAAAVVVVVVVVVV
-VVVVVVVVVVVQAAAABVVVVVVVVVVVVVVVVVVVVVAAAAAFVVVVVVVVVVVVVVVVVVVVUAAAAAVV
-VVVVVVVVVVVVVVVVVVWAAAAABVVVVVVVVVVVVVVVVVVVVVAAAAAFVVBVU3VSVVNVB1UFBVVV
-UAAAAAVVUFU1VVNVVVUFVQBVVVVgAAAABVVQVVUFU1VVVQVVBVVVVTAAAAAIVVBVVVVTVXVV
-BVUFVVVVMAAAAAVVVVVVVVFVFVVVVQVVVVUgAAAABVVVVVVVVVUFVVVVVVVVVSAAAAAHVVVV
-VVVVW5tVVVVVVVVVAAAAAAZVVVVVVVW8u2VVVVVVVVUAAAAAA1VVVVVVW7W7tVVVVVVVVQAA
-AAADVVVVVVWCtbuzVVVVVVVVAAAAAANVVVVVVVW1vrJVVVVVVVUAAAAAAlVVVVVVWLW7UFVV
-VVVVVQAAAAACVVVVVVVatbtVVVVVVVVVAAAAAABVVVVVVVq3u8NVVVVVVVUAAAAAAFVVVVVV
-XrS74VVVVVVVVQAAAAAAVVVVVVWLtbuyVVVVVVVVAAAAAABVVVVVVUu1u7BVVVVVVVUAAAAA
-AFVVVVVVO7W7sFVVVVVVVQAAAAAAVVVVVVUbtbu6VVVVVVVVAAAAAABVVVVVVSu9u1VVVVVV
-VVUAAAAAAFVVVVVVJb67tVVVVVVVVQAAAAAAVVVVVVVVu6u7VVVVVVVVAAAAAABVVVVVVVW7
-u7slVVVVVVUAAAAAAFVVVVVVVbu7u1VVVVVVVQAAAAACVVVVVVVVu7u7wlRVVVVVAAAAAAJV
-VVVVVVW7u7uwV1VVVVUAAAAAA1VVVVVVVbu7u7BVhVVVVSAAAAADVVVVVYVVu7vFAFUVVVVV
-MAAAAAZVVVVVhVUbu7VVVRVXVVVgAAAAB1VVVVVVVVu7u1VVFVFVVVAAAAAFVVVVVVhVVLu7
-xVVVVVVVgAAAAAVVVVVVUVVVK7u1VVVVVVVQAAAACFVVVVhRVVVQq7VVVVVVVVAAAAAFVVVV
-VFV1VVUgBVVVVVVVUAAAAAVVVVVUVRVVVVVVVVVVVVVQAAAABVVVVViFUVVVVVVVVVVVVVAA
-AAAFVVVVVRVUFVVVVVVVVVVVUAAAAAVVVVVVVVVVVVVVVVVVVVVQAAAABVVVVVVVVVVVVVVV
-VVVVVVIAAAAFVVVVVVVVVVVVVVVVVVVVUQAAAAVVVVVVVVVVVVVVVTdVVVVWAAAAAAAhNnWF
-VVVVVVcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==}
-ENDofIMG
-
-if false
-demo.show_image('bmp', '4-bit-RLE', <<'ENDofIMG')
-Qk1sAwAAAAAAAHYAAAAoAAAAIgAAADIAAAABAAQAAgAAAPYCAAAAAAAAAAAAABAAAAAQAAAA
-////AMzM/wAA//8AmZn/AJmZzABmmcwAMzPMADNmzABmmf8AmZmZAMxmMwBmM2YAZjMzADMz
-ZgDMzJkAAAAAAAAGBkMQABwAAAACBh5mAmAAAAIGHmYCYAAAAgYeZgJgAAACBh5mAmAAAAIG
-HmYCcAAAAgYeZgJgAAAAIgZmYGZjVmFmY2YFZgYGZmZgAAAAACIGZmBmNmZjZmZmBmYAZmZm
-QAAAAAAiBmZgZmYGY2ZmZgZmBmZmZjAAAAAAIgdmYGZmZmNmVmYGZgZmZmYwAAAAAgYKZgAW
-YmYmZmZmBmZmZhAAAAACBg5mAgYOZgIQAAACBQxmAARq6g5mAgAAAAIEDGYABquqRgAMZgIA
-AAACAwpmAAhqpqqmDGYCAAAAAgMKZgAIcaaqowxmAgAAAAIDDGYABqasoQAMZgIAAAACAQpm
-AAhnpqpgDGYCAAAAAgEKZgAGaaaqAA5mAgAAAAIACmYACGmlqrMMZgIAAAACAApmAAhsqKrC
-DGYCAAAAAgAKZgAIeqaqoQxmAgAAAAIACmYACIqmqqAMZgIAAAACAApmAAg6pqqgDGYCAAAA
-AgAKZgAIKqaqqQxmAgAAAAIACmYABhqtqgAOZgIAAAACAApmAAgWrKqmDGYCAAAAAgAMZgAG
-qpqqAAxmAgAAAAIADGYACKqqqhYKZgIAAAACAAxmAAaqqqoADGYCAAAAAgEMZgAKqqqqsWgA
-CGYCAAAAAgEMZgAKqqqqoGUACGYCAAAAAgMMZgAUqqqqoGZ2ZmZmEAAAAgMIZgAYdmaqqrYA
-ZiZmZmYwAAACBAhmABh2ZiqqpmZmJmVmZkAAAAIFDGYAFGqqqmZmJmJmZmAAAAIGCGYADGdm
-aKqqtgpmAnAAAAIGCGYADGJmZhqqpgpmAmAAAAAWB2ZmZmdiZmZgmqYACmYCYAAAABYGZmZm
-aGZWZmYQBgAKZgJgAAAADgZmZmZoZiYAEmYCYAAAAA4GZmZmZ3ZiABJmAmAAAAIGCGYABiZo
-JgAQZgJgAAACBh5mAmAAAAIGHmYCYQAAAgYeZgJiAAACBhZmAAo1ZmZmZAAAAAAMAAASNFZ2
-CGYCZQwAAAAiAAAB
-ENDofIMG
-end
-
-demo.show_image('bmp', '8-bit', <<'ENDofIMG')
-Qk0CCAAAAAAAAPoAAAAoAAAAIgAAADIAAAABAAgAAAAAAAgHAABtCwAAbQsAADEAAAAxAAAA
-////AMz//wAA//8AzMz/AJnM/wAAzP8AmZn/AGaZ/wAAmf8AZmb/ADNm/wAzM/8A/8zMAMzM
-zACZmcwAZpnMAACZzABmZswAM2bMAABmzAAzM8wAADPMAAAAzAD/zJkAzMyZAMyZmQCZmZkA
-ZmaZAGYzmQAzM5kAzJlmAJlmZgBmZmYAZjNmADMzZgDMmTMAmWYzAJkzMwBmMzMAmWYAAJkz
-AAAAAN0A7u7uAN3d3QC7u7sAqqqqAIiIiAB3d3cAVVVVAAARDgYDKgAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAVFRUVFRUVFRUVFBQUFBQUFRUVFRUVFRUVFRUVFRUVFQAAAAAV
-FRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFQAAAAAVFRUVFRUVFRUVFRUVFRUVFRUV
-FRUVFRUVFRUVFRUVFAAAAAAVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFAAAAAAV
-FRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVEgAAAAAVFRUVFhUVFRYVFRUWFRUVERUV
-FhUVFRYVFhUVFRUVEQAAAAAUFRUWABEVFQYPFhUDERUWBhUVKg8VFAAUABQVFRUVEQAAAAAU
-FRUWABYVBhQWFRUGFBUWERUWABYVFgAAFRUVFRUVDgAAAAAUFRUVABUVFBEAFhUGFBUUFRUV
-ABUVFgARFRUVFRUVBgAAAAASFRUWABUVFRUVFRUGFBUPFhUWABYVFgAVFBUVFRUVBgAAAAAR
-FRUVFhUVFRUVFRUEFBUEFhUVFhUVFQAWFRUVFRUVAwAAAAARFRUVFRUVFRUVFRUVFRUrHRUV
-FRUVFRUVFRUVFRUVAwAAAAAPFRUVFRUVFRUVFRUVFCQYKBUVFRUVFRUVFRUVFRUVKgAAAAAO
-FRUVFRUVFRUVFRUUJyEeKA4VFRUVFRUVFRUVFRUVAAAAAAAGFRUVFRUVFRUVFRYeKB0kKCQU
-FRUVFRUVFRUVFRUVAAAAAAAGFRUVFRUVFRUVFRIDKBQnKCgGFRUVFRUVFRUVFRUVAAAAAAAG
-FRUVFRUVFRUVFRUVJxEnJigDFRUVFRUVFRUVFRUVAAAAAAADFRUVFRUVFRUVFRUSKBEnKAkq
-FRUVFRUVFRUVFRUVAAAAAAADFRUVFRUVFRUVFRUuJxEoKBEWFRUVFRUVFRUVFRUVAAAAAAAr
-FRUVFRUVFRUVFRYvKA8oKCEGFRUVFRUVFRUVFRUVAAAAAAAqFRUVFRUVFRUVFRQmKAcoKCYE
-FRUVFRUVFRUVFRUVAAAAAAAAFRUVFRUVFRUVFRIoJwkoKCgDFRUVFRUVFRUVFRUVAAAAAAAA
-FRUVFRUVFRUVFQcoJxEnKCgBFRUVFRUVFRUVFRUUAAAAAAAAFRUVFRUVFRUVFQYoKBQnKCgq
-FhUVFRUVFRUVFRUUAAAAAAAAFRUVFRUVFRUVFQQoKBQkKCgsFhUVFRUVFRUVFRUUAAAAAAAA
-FRUVFRUVFRUVFQMkKCIjKB0RFRUVFRUVFRUVFRUUAAAAAAAAFRUVFRUVFRUVFQMUKCYeKCgV
-FRUVFRUVFRUVFRUVAAAAAAAAFRUVFRUVFRUVFRUVKCgaKCgnFRUVFRUVFRUVFRUVAAAAAAAA
-FRUVFRUVFRUVFRUUKCgkKCgoAxYVFRUVFRUVFRUVAAAAAAArFRUVFRUVFRUVFRURKCgoKCgo
-ERQVFRUVFRUVFRUVAAAAAAADFRUVFRUVFRUVFRURKCgoKCgoIQMWCBUVFRUVFRUVAAAAAAAD
-FRUVFRUVFRUVFRURKCgoKCgoKAAWEBYVFRUVFRUVKgAAAAAGFRUVFRUVFRUVFRUUJygoKCgo
-KAAWFRMVFRUVFRUVAwAAAAAGFRUVFRUVFRUTFhUWHigoKCEUKgAWFgIVFRUVFRUVBgAAAAAO
-FRUVFRUVFRUTFRUVBCgoKCgUFRYVFgIWFRAWFRUVDgAAAAAPFRUVFRUVFRUVFRUVFR4oKCgo
-FRUVFQIVFQUVFRUVEQAAAAARFRUVFRUVFRUVExUVFQckKCgoIRUVFRYVFRUVFRUVEgAAAAAR
-FRUVFRUVFRUWAhYVFRYDJygoKB0VFRUVFRUVFRUVFAAAAAASFRUVFRUVFRMVBRUVFRUWKhko
-KBQVFRUVFRUVFRUVFQAAAAAUFRUVFRUVFQgWFRAVFRUVFgMAKxYVFRUVFRUVFRUVFQAAAAAU
-FRUVFRUVFQgWFQIWFRUVFRUWFhUVFRUVFRUVFRUVFQAAAAAUFRUVFRUVFRMTFRUFFhUVFRUV
-FRUVFRUVFRUVFRUVFQAAAAAVFRUVFRUVFRYFFhUIAhYVFRUVFRUVFRUVFRUVFRUVFQAAAAAV
-FRUVFRUVFRUVFRUVFhUVFRUVFRUVFRUVFRUVFRUVFQAAAAAVFRUVFRUVFRUVFRUVFRUVFRUV
-FRUVFRUVFRUVFRUVFQMAAAAVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFQQAAAAV
-FRUVFRUVFRUVFRUVFRUVFRUVFRUVFAYPEREUFBQVFQ4AAAAAACoDBAYODxESFBQVFRUVFRUV
-FQ8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
-ENDofIMG
-
-if false
-demo.show_image('bmp', '8-bit-RLE', <<'ENDofIMG')
-Qk22CAAAAAAAADYEAAAoAAAAIgAAADIAAAABAAgAAQAAAIAEAAAAAAAAAAAAAAABAAAAAQAA
-////AO7u7gDMzP8Amcz/AJmZ/wCZmcwAZpnMAGZmzAAzZswAMzPMAAAzzAAAAMwAAMz/AACZ
-/wAA//8AAGbMAACZzADd3d0AzJmZAJkzAACZZgAAMzOZAGaZ/wCZZjMAZjNmAMyZZgCZmZkA
-ZjMzADMzZgDMmTMAu7u7AMz//wBmZv8Ad3d3AIiIiADMzJkAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG
-AAcFBAIBHAAAAAEACgoGCRAKAQAAAAEAIAoBAAAAAQAfCgEJAQAAAAEAHwoBCQEAAAABAB8K
-AQgBAAAAAQAECgAWCwoKCgsKCgoLCgoKBwoKCwoKCgsKCwUKAQcBAAAAABwACQoKCwAHCgoE
-BgsKAgcKCwQKCgEGCgkACQAJBAoBBwEAAAAAGgAJCgoLAAsKBAkLCgoECQoLBwoLAAsKCwAA
-BgoBBQEAAAAAGgAJCgoKAAoKCQcACwoECQoJCgoKAAoKCwAHBgoBBAEAAAAABgAICgoLAAcK
-AA4ECQoGCwoLAAsKCwAKCQUKAQQBAAAAAAYABwoKCgsHCgANAwkKAwsKCgsKCgoACwAGCgEC
-AQAAAAEAAQcOCgERARUOCgECAQAAAAEAAQYMCgAECRcjEw4KAQEBAAAAAQABBQsKAAYJFBgZ
-EwUNCgEAAQAAAAEAAQQKCgAICxkTFRcTFwkMCgEAAQAAAAEAAQQKCgAICAITCRQTEwQMCgEA
-AQAAAAEAAQQMCgAGFAcUGxMCDAoBAAEAAAABAAECCwoABwgTBxQTIAEADAoBAAEAAAABAAEC
-CwoAByIUBxMTBwsADAoBAAEAAAABAAERCgoACAshEwYTExgEDAoBAAEAAAABAAEBCgoACAkb
-ExYTExsDDAoBAAEAAAABAAEACgoACAgTFCATExMCDAoBAAEAAAABAAEACgoACBYTFAcUExMf
-CwoAAwkAAAAAAAEAAQAKCgAJBBMTCRQTEwELAAoKAAMJAAAAAAABAAEACgoACQMTEwkXExMe
-CwAKCgADCQAAAAAAAQABAAoKAAgCFxMcHRMVBwsKAAMJAAAAAAABAAEACgoABwIJExsZExMA
-DQoBAAEAAAABAAEADAoABhMTGhMTFAwKAQABAAAAAQABAAsKAAkJExMXExMTAgsACgoBAAEA
-AAABAAERCwoBBwYTAQcBCQoKAQABAAAAAQABAgsKAQcGEwAEGAILDQgKAQABAAAAAQABAgsK
-AQcHEwAEAAsQCwcKAQEBAAAAAQABBAsKAQkBFAYTAAQACwoPBwoBAgEAAAABAAEECAoADw8L
-CgsZExMTGAkBAAsLDgAHCgEEAQAAAAEAAQUICgAFDwoKCgMABBMADwkKCwoLDgsKEAsKCgoF
-AAAAAAEAAQYNCgEZBBMECgAEDgoKDAQKAQcBAAAAAQABBwkKAA4PCgoKFhcTExMYCgoKCwcK
-AQgBAAAAAQABBwgKAAwLDgsKCgsCFBMTExUKCgEJAQAAAAEAAQgHCgADDwoMAAQKAAYLARIT
-EwkLCgEAAAABAAEJBwoABA0LChAECgAFCwIAEQsACwoBAAAAAQABCQcKAAUNCwoOCwAFCgEL
-AQsMCgEAAAABAAEJBwoABg8PCgoMCxIKAQAAAAEACAoABwsMCwoNDgsAEQoBAAAAAQANCgEL
-EgoBAAAAAQAgCgECAAABACAKAQMAAAEAFgoACwkEBgcHCQkJCgoFAAAAAA0AAAABAgMEBQYH
-CAkJAAgKAQYMAAAAIgAAAQ==
-ENDofIMG
-end
-
-demo.show_image('bmp', '32-bit', <<'ENDofIMG')
-Qk2GFAAAAAAAADYAAAAoAAAAIgAAADIAAAABABgAAAAAAFAUAABtCwAAbQsAAAAAAAAAAAAA
-////ZmbMmZnMmZn/zMz/7u7u////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////AAD///8A
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wzM8wzM8wzM8wzM8wzM8wzM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8z///8AAP///wAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzP///wAA////ADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMMzPM////AAD///8AM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wzM8z///8AAP///wAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzDNmzP///wAA////ADPMADPMADPMADPMAADMADPMADPM
-ADPMAADMADPMADPMADPMAADMADPMADPMADPMZmbMADPMADPMAADMADPMADPMADPMAADMADPM
-AADMADPMADPMADPMADPMADPMZmbM////AAD///8zM8wAM8wAM8wAAMz///9mZswAM8wAM8yZ
-mf9mmcwAAMwAM8zMzP9mZswAM8wAAMyZmf8AM8wAM8zu7u5mmcwAM8wzM8z///8zM8z///8z
-M8wAM8wAM8wAM8wAM8xmZsz///8AAP///zMzzAAzzAAzzAAAzP///wAAzAAzzJmZ/zMzzAAA
-zAAzzAAzzJmZ/zMzzAAzzAAAzGZmzAAzzAAAzP///wAAzAAzzAAAzP///////wAzzAAzzAAz
-zAAzzAAzzAAzzJmZzP///wAA////MzPMADPMADPMADPM////ADPMADPMMzPMZmbM////AADM
-ADPMmZn/MzPMADPMMzPMADPMADPMADPM////ADPMADPMAADM////ZmbMADPMADPMADPMADPM
-ADPMADPMmZn/////AAD///8zZswAM8wAM8wAAMz///8AM8wAM8wAM8wAM8wAM8wAM8wAM8yZ
-mf8zM8wAM8xmmcwAAMwAM8wAAMz///8AAMwAM8wAAMz///8AM8wzM8wAM8wAM8wAM8wAM8wA
-M8yZmf////8AAP///2ZmzAAzzAAzzAAzzAAAzAAzzAAzzAAzzAAzzAAzzAAzzAAzzJnM/zMz
-zAAzzJnM/wAAzAAzzAAzzAAAzAAzzAAzzAAzzP///wAAzAAzzAAzzAAzzAAzzAAzzAAzzMzM
-/////wAA////ZmbMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM
-3d3dMzOZADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMzMz/////
-AAD///9mmcwAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wzM8yZZjPMzJmZ
-MwAAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8zu7u7///8AAP//
-/5mZzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzDMzzJlmAGYzZsyZZpkzAJmZ
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzP///////wAA////mZn/
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMAADMzJlmmTMAMzOZmWYzmTMAmWYzMzPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM////////AAD///+Zmf8AM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wzZszMzP+ZMwAzM8yZZgCZMwCZMwCZmf8AM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8z///////8AAP///5mZ/wAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzJlmAGZmzJlmAGYzM5kzAMzM/wAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzP///////wAA////zMz/ADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMM2bMmTMAZmbMmWYAmTMAZmb/7u7uADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPM////////AAD////MzP8AM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8yIiIiZZgBmZsyZMwCZMwBmZswAAMwAM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8z///////8AAP///93d3QAzzAAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAAzHd3d5kzAGaZzJkzAJkzAGYzZpmZ/wAzzAAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzP///////wAA////7u7uADPMADPMADPMADPMADPMADPMADPMADPM
-ADPMADPMMzPMZjMzmTMAZpn/mTMAmTMAZjMzmcz/ADPMADPMADPMADPMADPMADPMADPMADPM
-ADPMADPMADPMADPM////////AAD///////8AM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wA
-M8wzZsyZMwCZZgBmZv+ZMwCZMwCZMwDMzP8AM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8z///////8AAP///////wAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzGaZ
-/5kzAJlmAGZmzJlmAJkzAJkzAMz//wAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAz
-zDMzzP///////wAA////////ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMmZn/mTMA
-mTMAMzPMmWYAmTMAmTMA7u7uAADMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMMzPM
-////////AAD///////8AM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8yZzP+ZMwCZMwAz
-M8yZZjOZMwCZMwC7u7sAAMwAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wzM8z/////
-//8AAP///////wAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzMzM/5lmM5kzADMzZsyZ
-M5kzADMzmWZmzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzDMzzP///////wAA
-////////ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMzMz/MzPMmTMAZjMzzJlmmTMA
-mTMAADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM////////AAD/////
-//8AM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8yZMwCZMwCZmZmZMwCZMwCZ
-ZgAAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8z///////8AAP///////wAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzDMzzJkzAJkzAJlmM5kzAJkzAJkzAMzM
-/wAAzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzP///////wAA////3d3dADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMZmbMmTMAmTMAmTMAmTMAmTMAmTMAZmbMMzPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM////////AAD////MzP8AM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8xmZsyZMwCZMwCZMwCZMwCZMwCZMwBmM2bMzP8AAMwA
-mf8AM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8z///////8AAP///8zM/wAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzGZmzJkzAJkzAJkzAJkzAJkzAJkzAJkzAP///wAAzACZzAAA
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzO7u7v///wAA////mZn/ADPMADPMADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMMzPMmWYAmTMAmTMAmTMAmTMAmTMAmTMA////AADMADPMAGbMADPM
-ADPMADPMADPMADPMADPMADPMzMz/////AAD///+Zmf8AM8wAM8wAM8wAM8wAM8wAM8wAM8wA
-M8wAZswAAMwAM8wAAMzMmWaZMwCZMwCZMwBmM2YzM8zu7u7///8AAMwAAMwA//8AM8wAM8wA
-M8wAM8wAM8wAM8wAM8yZmf////8AAP///5mZzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzABm
-zAAzzAAzzAAzzJnM/5kzAJkzAJkzAJkzADMzzAAzzAAAzAAzzAAAzAD//wAAzAAzzACZzAAA
-zAAzzAAzzAAzzJmZzP///wAA////ZpnMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM
-ADPMADPMADPMzJlmmTMAmTMAmTMAmTMAADPMADPMADPMADPMAP//ADPMADPMAMz/ADPMADPM
-ADPMADPMZmbM////AAD///9mZswAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAZswAM8wA
-M8wAM8xmmf+ZZjOZMwCZMwCZMwBmM2YAM8wAM8wAM8wAAMwAM8wAM8wAM8wAM8wAM8wAM8wA
-M8wzZsz///8AAP///2ZmzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAAzAD//wAAzAAzzAAz
-zAAAzMzM/5lmAJkzAJkzAJkzADMzmQAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzDMz
-zP///wAA////M2bMADPMADPMADPMADPMADPMADPMADPMAGbMADPMAMz/ADPMADPMADPMADPM
-AADM7u7uzJmZmTMAmTMAMzPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM////
-AAD///8zM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAmf8AAMwAM8wAmcwAM8wAM8wAM8wAM8wA
-AMzMzP/////d3d0AAMwAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8z///8AAP//
-/zMzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzACZ/wAAzAAzzAD//wAAzAAzzAAzzAAzzAAzzAAz
-zAAAzAAAzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzP///wAA////MzPM
-ADPMADPMADPMADPMADPMADPMADPMAGbMAGbMADPMADPMAMz/AADMADPMADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM////AAD///8AM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAAMwAzP8AAMwAM8wAmf8A//8AAMwAM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8z///8AAP///wAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAAzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzP///wAA////ADPMADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPMADPM
-ADPMADPMADPMADPMADPMADPMADPMADPMADPMzMz/AAD///8AM8wAM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wAM8wA
-M8wAM8wAM8wAM8wAM8wAM8wAM8wAM8yZzP8AAP///wAzzAAzzAAzzAAzzAAzzAAzzAAzzAAz
-zAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzDMzzJmZ/2aZzGZm
-zGZmzDMzzDMzzDMzzAAzzAAzzJmZzAAA////////////7u7uzMz/mcz/mZn/mZnMZpnMZmbM
-M2bMMzPMMzPMADPMADPMADPMADPMADPMADPMADPMADPMZpnM////////////////////////
-////////////////////////AAD/////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-//////////////////8AAA==
-ENDofIMG
-
-demo.show_image('gif', 'gif87a', <<'ENDofIMG')
-R0lGODdhQAAoAPcAAAAAADgoOHBgYJiIkIB4iJCAiIB4gGBIUGhggKiYmLCYoLiooHBocMCA
-eJBocLCYmMCooKiQkKCAgGBASIiAiGhYeLiQiIhoaJhwcJh4gMCYkMCgoMCoqKiQiEBAWEg4
-QMiwoMioqMComLCIiFhAWIBgaJhweHBgcLiQkIiAgDg4UIhwgHhgYJh4cMiooFBQcGBYeJiA
-iIBwgIh4iKCAiKB4eHhYYGhIWKiIiEhAWFBIYEhAaEhIaHBYcHBgeFBQeHBogHBQYHBQWGBA
-UFhQaGBYaFhYeKCIkLCQmHhYaGBIWLCYiFBAYEhAYFhQYFBIaFhYcKCIiKCQkKiIkLCIgHBQ
-aIhwcJiAeIBgcJBwcLCQiKiAeKB4gHhwgNCwqMiwqIBoeHBYaJh4eMCYmJBweGhYYNC4qEg4
-UEA4WGBQWEBAYFBQaHBoeFhQcGhgeGhYcMiwsJB4cGBIYNjIwEAwSMCgmHhocFBAWNDAuNDI
-uIBweGBYcHhoeDgwQGhgaKCIgNjQuKiAgNjIuKiIgKCAeKCQiEhIWFBIUGBQaNC4sGBQcGBY
-YMi4sGhYWFhIYFhIaFhQWHhoaLCQkDg4SHBgaJB4gJB4eLiYmLiomGhYaEhIYFhYaIh4gHho
-gGhgcIBoaGBIaHhgcNDAsFBAUGhQYLigoLioqJiIgGhQaFA4SFhIWHhweFBIWJiAgIh4eFhI
-UHBYYIhweEg4WLiYkDg4WGBQYEA4SEA4UMCwqIhocHhgaJB4iJCAgFhASEBAUEhAUIBocFhA
-UKCQmHhgeEgwSNjQwEg4SLCgmDgwUGhQWLCgoEAwUFBASLigmEAwQGhIUFg4SIhoeEgwQKiY
-kFA4UDgwSJiIiIBwcKiQmLCooLCYkDgoQP//////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-/////////////////////////////////ywAAAAAQAAoAAAI/gABCBxIsKDBggEEDBhAoICB
-AwcjSpxIMSKCBAoWIGDQoIGDBxAURJBAoKLJkwcnUKgQoYEFlxcwdOyYoYGGDRw6eEDJc+IH
-CSBCiHg5YiaJEjM7mjgBAkUKAip6Sh24YqYGmUkbYGDRwoWGlxocvIABI4aMGVN70qiRNSkL
-Gzda4BhhIoeOHTx6+PjxwwcCIGlPouiI4WUDFkFYCLlhYwiLBkU73iBShAgRAkaMHCGAIDBF
-JBpmXkiiZMiQCagzLEFRgi0GDUyaONHx5MkLKFFCSOns+eCUBlRKVIErxIYVG1ewsMiixYSW
-LVxQkIDRpDqRJF1gVPDyhQDg3gSB/mQAwyKMmBJjpoAhU6bKCjMgMGxZAuIMmjRq0KhpsmbN
-EjZtuHEEAgQ4Ad5ACLxRQhkZwBHHGHKMAcccdFxhBgpU1FGDHUzc0QESduDhxRx56DEHHnvs
-4R0ffRzYhREwYOHHH4BUEQgZYYlgoSBfjCHIBh0MAoEdAxBSiCGHIJLIHHCYwEEFQHRhx4Ew
-LLCHIm4sIggjc9RhgQhzgEAIIGSEAAIgjShhwhwN4MGEI4/sAIkjSEQiCRJYuAHEJL0RwMge
-ejzBBiV6VGKJFpcMskUcFyQygoiEbAABJn9kogkaa+RgwCZEMEEEBlNw4gMbiPQ2QyeefAKK
-GpT0cAIk/jjEgQIKggAiiAMgUAFZIkiEIkokozyigyakLFLBGzb8IcUDPXjSGxArlGJKKKcg
-sQAqdojAlQMaCDLGHIlk8EkqiFhQBxJL5BAGE0yo4gQaTBTAQAYc2NGDZ4UAYcoOhfBxwiql
-nFGGDQ3UwMIFGsyBAgs19MBKDg0IQUoroqCRgweO5OCKJjo4osEYBXjySmAE/JBCDHBMUUkT
-T6AxiktgvXTDDbDEUoEsF8ySQxl8LJEGLTugUUQtllBQyyqW8DFyWggY8UYoHPBxxh1O0PDA
-GA0g1ZEQQphQwhus2GJDEGh4cAstbjSBBhF7aEJEEzwYQUQnaQSWHQ+o4BIG/i5gPFIKHl8k
-ZYENGOSiixysqHHGLYbE4IQTt1TQhA6o8KDJGjy8YJkiJPOlCAw7OPKEB7LccYsQoUFWxwSq
-2EFJETo8ogoaThSRwy2y4KEGBaDwUIQfu1DiwyOBNc3DGrzI0cYdnNyRQx+vuCRIAyD0wokS
-aehgSw60+GIILbSoYMstpvwywxM88PAEETwQQTIMCOwBBjAdfMFIFBcEQ4IIDdTaAjAJgMQd
-UnGGJJTtdpMI3yRUAAEP4AUIT9DECRxhN2EoIAZ7IAUkAhECDgwDDLYgxgREgQk8FMNWcxAF
-BwjRhztEQRWtoIQdbHGGHOCBFmqAgRr2kIm6pWUC/p3wwRFAMYM/6IIUR0gAE+Rwh2DIwRgo
-wEMe5jAHQQhCFHFoBAAycYxXxMER27MBMtTACtkU4QyeUYACStGEO8QADA/wRAAEIoMsiOEK
-NxACCEAgiDwIAg+l+EQyAnCKDljAFLbghTHKp4Yi9IBznlEGBxLhiGUsgQOM+EQWAPABKkBC
-DBEIRC/iIApbCQICgxhCMERAiBZYwRLMmIAxFgAK7r3gCb1hAwXwYIUogKIMQSBEHprhDCVc
-4BNVnAMgABEm+hTgGYcoAzQWIAIsTOABaSBEFNIAiSfIAjwIYEQIZIGFMIAhDW/IAy6igYNE
-fEEUiWDEJcRgjBsEgRTM/pDDH5jRAUbgwhQJcIUkaAAEWvziQAjgQCnukIBW6KEWVsDDLFhA
-hQuEwAUjAMEsZnGBPwhBAtI4AAMaEYEOfAIAyjjGNOKgByLM8UADUAYnEmCJLwQBB3jAhRYG
-gTAN4CALWajDEWBxAV1MIBIMcIItjCEQSEShEqoYBTUOJBBbFACAqWjGBl5BhS+gQAs4mEYH
-COHPXmCBEBMYxjQC0IhbVEMglEgDKX5xBgpSVSAEqAAnTtGMB4CBEApAAS6yMIhmlMISlmjG
-IKxxjFnc4AgCsIMqXMEJXujhF7eABFPvKhAEsMENqliAFHpBCRvUAQKm4IAVxBCFBSijFA8Y
-2MQAjDENUrjCClaohB2KAAlWcJYgCLjGABKAjVYsIBsJuEQEmoGJbJjiuNpIQDY4UYAC8EEP
-kegEA9zwBk38tiAIMEB0swGBbGDjGM2QhDIeMItsONe9MrWGMKxhXU8Q4aDfLcgkCpCCCCRA
-G0hQQAKU4d4FGDgbyiBuBAZQAArIAAZ7yEF+IwIER8wAGxherwKOcQllTGMaSJBCBGLAi1Os
-gBJ2nbBEoFCAAUQhCtiIQASEIeMB0IAG1rAsH5ywDRWbJACdmEFDdlGAGMyAxF1gAwzuQNWA
-AAA7
-ENDofIMG
-
-demo.show_image('gif', 'gif89a', <<'ENDofIMG')
-R0lGODlhQAAoAPcAAMnJyTgoOHBgYJiIkIB4iJCAiIB4gGBIUGhggKiYmLCYoLiooHBocMCA
-eJBocLCYmMCooKiQkKCAgGBASIiAiGhYeLiQiIhoaJhwcJh4gMCYkMCgoMCoqKiQiEBAWEg4
-QMiwoMioqMComLCIiFhAWIBgaJhweHBgcLiQkIiAgDg4UIhwgHhgYJh4cMiooFBQcGBYeJiA
-iIBwgIh4iKCAiKB4eHhYYGhIWKiIiEhAWFBIYEhAaEhIaHBYcHBgeFBQeHBogHBQYHBQWGBA
-UFhQaGBYaFhYeKCIkLCQmHhYaGBIWLCYiFBAYEhAYFhQYFBIaFhYcKCIiKCQkKiIkLCIgHBQ
-aIhwcJiAeIBgcJBwcLCQiKiAeKB4gHhwgNCwqMiwqIBoeHBYaJh4eMCYmJBweGhYYNC4qEg4
-UEA4WGBQWEBAYFBQaHBoeFhQcGhgeGhYcMiwsJB4cGBIYNjIwEAwSMCgmHhocFBAWNDAuNDI
-uIBweGBYcHhoeDgwQGhgaKCIgNjQuKiAgNjIuKiIgKCAeKCQiEhIWFBIUGBQaNC4sGBQcGBY
-YMi4sGhYWFhIYFhIaFhQWHhoaLCQkDg4SHBgaJB4gJB4eLiYmLiomGhYaEhIYFhYaIh4gHho
-gGhgcIBoaGBIaHhgcNDAsFBAUGhQYLigoLioqJiIgGhQaFA4SFhIWHhweFBIWJiAgIh4eFhI
-UHBYYIhweEg4WLiYkDg4WGBQYEA4SEA4UMCwqIhocHhgaJB4iJCAgFhASEBAUEhAUIBocFhA
-UKCQmHhgeEgwSNjQwEg4SLCgmDgwUGhQWLCgoEAwUFBASLigmEAwQGhIUFg4SIhoeEgwQKiY
-kFA4UDgwSJiIiIBwcKiQmLCooLCYkDgoQP//////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-/////////////////////////////////yH5BAEAAAAALAAAAABAACgAAAj+AAEIHEiwoMGC
-AQQMGECggIEDByNKnEgxIoIEChYgYNCggYMHEBREkECgosmTBydQqBChgQWXFzB07JihgYYN
-HDp4QMlz4gcJIEKIeDliJokSMzuaOAECRQoCKnpKHbhipgaZSRtgYNHChYaXGhy8gAEjhowZ
-U3vSqJE1KQsbN1rgGGEih44dPHr4+PHDBwIgaU+i6IjhZQMWQVgIuWFjCIsGRTveIFKECBEC
-RowcIYAgMEUkGmZeSKJkyJAJqDMsQVGCLQYNTJo40fHkyQsoUUJI6ez54JQGVEpUgSvEhhUb
-V7CwyKLFhJYtXFCQgNGkOpEkXWBU8PKFAODeBIH+ZADDIoyYEmOmgCFTpsoKMyAwbFkC4gya
-NGrQqGmyZs0SNm24cQQCBDgB3kAIvFFCGRnAEccYcowBxxx0XGEGClTUUYMdTNzRARJ24OHF
-HHnoMQcee+zhHR99HNiFETBg4ccfgFQRCBlhiWChIF+MIcgGHQwCgR0DEFKIIYcgksgccJjA
-QQVAdGHHgTAssIcibiwiCCNz1GGBCHOAQAggZIQAAiCNKGHCHA3gwYQjj+wAiSNIRCIJEli4
-AcQkvRHAyB56PMEGJXpUYokWlwyyRRwXJDKCiIRsAAEmf2SiCRpr5GDAJkQwQQQGU3DiAxuI
-9DZDJ558AooalPRwAiT+OMSBAgqCACKIAyBQAVkiSIQiSiSjPKKDJqQsUsEbNvwhxQM9eNIb
-ECuUYkoopyCxACp2iMCVAxoIMsYciWTwSSqIWFAHEkvkEAYTTKjiBBpMFMBABhzY0YNnhQBh
-yg6F8HHCKqWcUYYNDdTAwgUazIECCzX0wEoODQhBSiuioJGDB47k4IomOjiiwRgFePJKYAT8
-kEIMcExRSRNPoDGKS2C9dMMNsMRSgSwXzJJDGXwskQYtO6BRRC2WUFDLKpbwMXJaCBjxRigc
-8HHGHU7Q8MAYDSDVkRBCmFDCG6zYYkMQaHhwCy1uNIEGEXtoQkQTPBhBRCdpBJYdD6jgEgb+
-LmA8UgoeXyRlgQ0Y5KKLHKyoccYthsTghBO3VNCEDqjwoMkaPLxgmSIk86UIDDs48oQHstxx
-ixChQVbHBKrYQUkROjyiChpOFJHDLbLgoQYFoPBQhB+7UOLDI4E1zcMavMjRxh2c3JFDH6+4
-JEgDIPTCiRJp6GBLDrT4YggttKhgyy2m/DLDEzzw8AQRPBBBMgwI7AEGMB18wUgUFwRDgggN
-1NoCMAmAxB1ScYYklO12kwjfJFQAAQ/gBQhP0MQJHGE3YSggBnsgBSQCEQIODAMMtiDGBESB
-CTwUw1ZzEAUHCNGHO0RBFa2ghB1scYYc4IEWaoCBGvaQibqlZQL+nfDBEUAxgz/oghRHSAAT
-5HCHYMjBGCjAQx7mMAdBCEIUcWgEADJxjFfEwRHbswEy1MAK2RThDJ5RgAJK0YQ7xAAMD/BE
-AAQigyyI4Qo3EAIIQCCIPAgCD6X4RDICcIoOWMAUtuCFMcqnhiL0gHOeUQYHEuGIZSyBA4z4
-RBYA8AEqQEIMEQhEL+IgClsJAgKDGEIwRECIFljBEsyYgDEWAAruveAJvWEDBfBghSiAogxB
-IEQemuEMJVzgE1WcAyAAESb6FOAZhygDNBYgAixM4AFpIEQU0gCJJ8gCPAhgRAhkgYUwgCEN
-b8gDLqKBg0R8QRSJYMQlxGCMGwSBFMz+kMMfmNEBRuDCFAlwhSRoAARa/OJACOBAKe6QgFbo
-oRZWwMMsWECFC4TABSMAwSxmcYE/CEEC0jgAAxoRgQ58AgDKOMY04qAHIszxQANQBicSYIkv
-BAEHeMCFFgaBMA3gIAtZqMMRYHEBXUwgEgxwgi2MIRBIRKESqhgFNQ4kEFsUAICpaMYGXkGF
-L6BACziYRgcI4c9eYIEQExjGNALQiFtUQyCUSAMpfnEGClJVIASoACdO0YwHgIEQCkABLrIw
-iGaUwhKWaMYgrHGMWdzgCAKwgypcwQle6OEXt4AEU+8qEASwwQ2qWIAUekEJG9QBAqbggBXE
-EIUFKKMUDxjYxACMMQ1SuMIKVqiEHYoACVZwliAIuMYAEoCNViwgGwm4RASagYlsmOK42khA
-NjhRgALwQQ+R6AQD3PAGTfy2IAgwQHSzAYFsYOMYzZCEMh4wi2w4170ytYYwrGFdTxDhoN8t
-yCQKkIIIJEAbSFBAApTh3gUYOBvKIG4EBlAACsgABnvIQX4jAgRHzAAbGF6vAo5xCWVMYxpI
-kEIEYsCLU6yAEnadsESgUIABRCEK2IhABIQh4wHQgAbWsCwfnLANFZskAJ2YQUN2UYAYzIDE
-XWADDO5A1YAAADs=
-ENDofIMG
-
-teapot = <<'ENDofIMG'
-",
-".. c #998074",
-"#. c #84aadc",
-"a. c #c47e55",
-"b. c #4c6ea0",
-"c. c #d48a64",
-"d. c #ecccbc",
-"e. c #8c6252",
-"f. c #b1a094",
-"g. c #714628",
-"h. c #af8a76",
-"i. c #2c5284",
-"j. c #98745f",
-"k. c #8f5124",
-"l. c #844614",
-"m. c #5074a6",
-"n. c #aeb2b9",
-"o. c #3e291c",
-"p. c #44689b",
-"q. c #4c2705",
-"r. c #1b2b43",
-"s. c #e1c8bb",
-"t. c #dd782d",
-"u. c #9c5824",
-"v. c #547aac",
-"w. c #906e5a",
-"x. c #545253",
-"y. c #e07e33",
-"z. c #bcaeac",
-"A. c #aeb6bc",
-"B. c #6f737b",
-"C. c #7e5942",
-"D. c #b55e1a",
-"E. c #7c5134",
-"F. c #8c7a70",
-"G. c #62524d",
-"H. c #bc8a6c",
-"I. c #936754",
-"J. c #6e6d75",
-"K. c #8cb0e2",
-"L. c #d4beb4",
-"M. c #2a201a",
-"N. c #c48664",
-"O. c #412105",
-"P. c #a95a19",
-"Q. c #747a7c",
-"R. c #2a2e33",
-"S. c #484c53",
-"T. c #8690a1",
-"U. c #6c524c",
-"V. c #505967",
-"W. c #040204",
-"X. c #8cb6e4",
-"Y. c #8f4912",
-"Z. c #846e5c",
-"0. c #244a7c",
-"1. c #dcc2b6",
-"2. c #33261b",
-"3. c #81736c",
-"4. c #3c3b46",
-"5. c #735f53",
-"6. c #545e69",
-"7. c #bc7c58",
-"8. c #4c2f1d",
-"9. c #a4806b",
-".# c #604c4c",
-"## c #d4916b",
-"a# c #5c80b2",
-"b# c #e3d3cd",
-"c# c #c8ad9a",
-"d# c #bf6c2e",
-"e# c #08121c",
-"f# c #9c5e34",
-"g# c #9298a1",
-"h# c #8b7f7c",
-"i# c #835f44",
-"j# c #a46e54",
-"k# c #474649",
-"l# c #a65d26",
-"m# c #be6420",
-"n# c #7c9ed2",
-"o# c #ac622c",
-"p# c #726e6c",
-"q# c #e1a684",
-"r# c #a48676",
-"s# c #54464c",
-"t# c #a0a4ac",
-"u# c #b37b5a",
-"v# c #947a70",
-"w# c #543d31",
-"x# c #743e12",
-"y# c #98bcee",
-"z# c #d49e7c",
-"A# c #64320c",
-"B# c #d4cac6",
-"C# c #2c3642",
-"D# c #6e686b",
-"E# c #5c463e",
-"F# c #7f7575",
-"G# c #bcb2b0",
-"H# c #979dac",
-"I# c #a47a61",
-"J# c #8c9094",
-"K# c #1c262c",
-"L# c #d3c3bc",
-"M# c #9cc2f4",
-"N# c #af7455",
-"O# c #fcad5f",
-"P# c #6486b8",
-"Q# c #d4742d",
-"R# c #6d4e3d",
-"S# c #242224",
-"T# c #3b444c",
-"U# c #181515",
-"V# c #6e4024",
-"W# c #749bcc",
-"X# c #afabac",
-"Y# c #7e6a64",
-"Z# c #343634",
-"0# c #e8ac8a",
-"1# c #343a44",
-"2# c #b18f7a",
-"3# c #dda07f",
-"4# c #6f380d",
-"5# c #2f5684",
-"6# c #a08d86",
-"7# c #5f6068",
-"8# c #625751",
-"9# c #16253b",
-".a c #94b6e9",
-"#a c #dfcec8",
-"aa c #3c6194",
-"ba c #ecdad3",
-"ca c #948a89",
-"da c #a4c8fa",
-"ea c #bcb6b8",
-"fa c #604432",
-"ga c #cc6d29",
-"ha c #949ea4",
-"ia c #413024",
-"ja c #a48a7a",
-"ka c #9a867d",
-"la c #1c1a1c",
-"ma c #342116",
-"na c #bc8364",
-"oa c #9c8674",
-"pa c #844e25",
-"qa c #3c4a5c",
-"ra c #582c0d",
-"sa c #c7835a",
-"ta c #613c24",
-"ua c #614b41",
-"va c #adaeb5",
-"wa c #805c4c",
-"xa c #0a0b0f",
-"ya c #c4b2ac",
-"za c #648abc",
-"Aa c #af846a",
-"Ba c #c68a69",
-"Ca c #483c39",
-"Da c #7f400d",
-"Ea c #646e74",
-"Fa c #a85515",
-"Ga c #042244",
-"Ha c #816759",
-"Ia c #95817c",
-"Ja c #9c9aa1",
-"Ka c #9c6b54",
-"La c #7e4924",
-"Ma c #0c1a2c",
-"Na c #5f595f",
-"Oa c #6f615e",
-"Pa c #474149",
-"Qa c #8c9aac",
-"Ra c #cbbeb8",
-"Sa c #806e68",
-"Ta c #82624e",
-"Ua c #949294",
-"Va c #b4652c",
-"Wa c #9c9ea4",
-"Xa c #72574c",
-"Ya c #2a303e",
-"Za c #bc9175",
-"0a c #9c7a64",
-"1a c #261a13",
-"2a c #aca6ac",
-"3a c #341a04",
-"4a c #593520",
-"5a c #d49878",
-"6a c #26282c",
-"7a c #475261",
-"8a c #3f3535",
-"9a c #63676f",
-".b c #a47255",
-"#b c #bc967c",
-"ab c #52433a",
-"bb c #80a4d6",
-"cb c #544c4c",
-"db c #bc723c",
-"eb c #645e54",
-"fb c #a4abb4",
-"gb c #c89070",
-"hb c #8c7469",
-"ib c #c7b8b3",
-" ",
-" ",
-" ",
-" wawae.e.wa ",
-" .#j#N#7.a.db.# ",
-" 8.g.x#C.o. ",
-" N#DaA#raY.Xa4aV#4aPas#q.W.W.6a ",
-" i#O.l.4.4.4.4.4.s#wa7.N#wawaXawawawaA#q.C. ",
-" 3a3a4#wawawae.e.e.I.j#m#d#VaN#KaI.e.e.e.e.waDaO..#j#j#N#N#j#fa ",
-" O.A#wae.e.I.e.I.I.Kal#m#m#D.u.KaKaKaKaI.e.I.e.Da3aXaE#C#W.o.C. ",
-" w#e.k.I.I.Kaf#KaKaKaKal#m#m#D.l#j#Kaj#KaKaKaKaKaFai#u. GaDaI. ",
-" .#waKaI.KaKaj#j#j#j#j#VaD.m#FaVaj#j#j#j#j#j#j#KaKae.U. 9#o.Ka ",
-" .#Xae.Kaj#j#N#N#N#N#N#j#N#j#N#N#N#N#N#dbdbN#N#N#I.waU. e#M.taPa ",
-" .#U.Xawae.Kaj#N#7.dbj#a.a.a.a.a.a.a.j#7.sa##naj#I.e.waXaU.Yama.# ",
-" .#U.Xawae.I.Ka.bna3#0#3###sasaa.sac.##Ba7.u#N#Kaf#f#waXaU.4.s#Pa ",
-" j#N#5aW.Y.u#j#R# 8a.#XaXae.e.I.KaN#naz#0#q#gb7.7.N#N#N#u#nau#N#N#Kaf#f#e.waU.LaU. ",
-" 4.Hahb.bI.j#KaY. s#U.XaXawae.KaKaN#na3#0#3#gbna7.N#u#u#N#7.u#N#.bj#KaI.e.waXa.# ",
-" G.2#e.KaI.E# .#U.Xawae.P.Kaj#N#H.z#q#3#gb7.7.7.7.N#N#u#u#N#.bj#KaI.e.TaXaU.0. ",
-" Ca.#e.j#Va 5#aa0.MaU.Xawak.d#I.j#I#N.5a3#5aBa7.dbN#N#dbN#N#u#I#j#KaKaI.e.waXaU.0.i.p. ",
-" abU.I.KapaaaaaxaGaU.C.wau.VaKaj#I#na5a5agbN.u#N#7.N#N#N#N#N#.bj#KaKaI.e.waXa.#R#m.m.m.p. ",
-" zaW#0.0.s#waKam#0.0.e#GaU.C.k.l#I.KaKa.bnagbgbBa7.u#7.N#N#N#N#N#.bj#j#KaKaI.e.waXa.#.#b.m.m.i.i.0. ",
-" 5#aaW#W#n#aaaa0.U..#e.Kau.ta4aLak.k.u.o#e.KaKa.bu#H.H.nau#N#N#N#N#N#N#j#N#j#KaKaI.I.e.waXa.#fab.m.i.i.i.i.i.0. ",
-"p.p.p.aan#W#0.0.0.0.p.uaU.KaKal#o#d#gal#o#o#e.I.Kaj#N#Aau#u#N#N#N#.bN#N#j#.bj#j#KaKaI.I.e.waXa.#E#m.m.v.m.i.i.m.n#bbn# ",
-"p.p.n#n#n#p.0.0.0.0.0.xa.#waKaKagaQ#t.y.d#dbi#e.I.Ka.bN#I#N#N#N#N#.bN#N#j#N#j#KaKaI.f#e.waXaU.U.w#5#m.m.i.i.i.m.bbbbbbbbaa ",
-"n#n#n#n#n#n#0.aaaap.aaaas#s#waKaj#na##O#dbl#wae.I.I.j.j#j#j#j#j#j#j#.bj#j#j#KaKaKaI.e.e.waXaE.Hai.m.m.i.i.i.i.p.p.bbb.b.p.p.aa ",
-"p.bbn#bbp.p.p.p.p.p.aaaaaaua..#be.Kaj#j#u.XawaTae.I.KaKaKaKaj#j#j#j#j#KaKaKaKaKaI.I.i#waXawaR#uav.m.m.v.v.i.b.bbbbbbbbp.p.b.p.p.",
-"bbp.p.p.p.p.p.n#p.0.0.0.0.p.8#Oa2#ZaZaZak.XaXawae.e.e.I.KaKaKaj#KaKaKaKaI.w.I.I.I.e.waXa0aXa5.5#i.m.m.v.v.p.p.#.#.#.#.#.#.b.bb#.",
-"bbW#p.p.p.n#bbbbp.0.0.0.0.0.0.0.x.D#3.3.w.waU.wawae.e.e.e.f#I.I.I.I.I.I.I.f#e.e.wawaXae.w.ua4.5#5#i.7ai.b.b.b.p.b.#.#.#.p.b.b.#.",
-"p.bbp.bbbbp.p.p.p.0.0.6.p.p.p.0.0.0.0.9#R#wae.9.j.wawae.Tae.e.e.e.I.e.Tai#e.wawaw.Aaw.hbOa6aC#5#m.v.v.#.p.p.b.b.p.#.#.b.b.p.p.b.",
-"0.0.0.p.p.p.p.aa0.0.p.p.p.p.p.p.0.0.p.qaT#s#Z.0a..h.I#I#ZaZaI#gbI#.bH..b.bH.h.j.r#HaU.PaV.V.Na1#v.m.K.K.K.#.b.#.#.#.#.K.p.b.m.p.",
-"0.0.0.0.p.0.0.0.0.0.0.p.p.p.p.0.0.p.p.qaqaqa2.iaR#HaY#ja2#2#I#Za2#0a2#2#h.jaoaF.8#V.6aC#C#C#CaNab.bbbbK.#.b.b.b.#.K.K.#.#.#.X.#.",
-"b.b.p.p.p.0.i.0.0.0.0.p.0.0.0.i.0.0.qaqak#6aR.6a3aiawaY#OaOaOaD#Iah#D#OaF#cbPa6a6aW.V.6.1#C#7ap#b.b.b.b.b.b.b.b.b.K.K.#.b.b.b.b.",
-"bb#.#.#.#.b.b.i.0.p.p.p.0.b.b.0.0.0.qar.YaYaYaR.K#Z#E.xa1a2.S#.#x.x.S.R.laU#1#W.W.9a6.J#J#T.7av#K.K.K.K.b.b.m.m.b.m.K.b.p.m.b.b.",
-"#.#.#.#.#.#.K.#.#.#.#.#.#.b.b.b.#.p.qaqaYaR.YaR.Pa6ak#S#lalaW.W.xaW.W.W.W.U#U#ebT.hag#g#haT.7ac#K.K.K.K.K.K.b.b.#.K.K.K.K.m.b.b.",
-"#.#.#.b.b.b.b.#.#.bb#.#.#.b.K.bbK.#.T.T.J#R.YaS.S.x.ebebR.2.S#S#S#T#S#S#S.9a7aEaEafbhag#6.7aV.m.K.K.K.K.X.K.m.X.K.K..a.aX.K.b.m.",
-"b.b.p.b.p.b.p.K.K.K.b.b.b.b.#.#.#.#.T.T.J#UaJ#J#g#g#haWaWa7#9a2at#fbA.t#9a6.9aJ.EaEafbV.6.V.Nam.b.m..a.am.b.m.m.m.K.X.K..a.a.am.",
-" p.b.p.p.b.p.K.b.b.p.b.b.b.b.K.#.K.7a7aV.9aWat#X#WahaH#ha6.t#n.n.n.n.fbfb9a9an.t#t#fbfb7aV.7#m.m.m..am.m.m.m.m.m.m..a.a.am.m.m.",
-" b.p.b.#.#.#.#.#.b.b.b.b.b.b.K.Pax.V.7aNa7#7#t#vafbB.B.B.B.B.n.A.A.A.fbfb9aA.t#t#fbfbQaH#7#D#m.X..a.a.aX.v.v.v.v.m.m..am.v.m.m.",
-" #.K.K.K.K.K.#.b.b.b.b.K.K.K.T.S.V.9aB.ebNaV.p#9a9aB.D#9a9aB.A.A.A.9aB.B.Eafbn.t#g#hat#X#m..ay#y#y#y#.ay#v.v.v..aX.y#.av.v.v.",
-" #.K.K.#.K.K.K.K.K.K.K.K.K.QaT.V.7#Ea9af.f.2at#OaD#F#Q.J.9aEaB.Ea9a6.Ea9aEaV.H#H#t#2aD#J.v.m.y#y#y#y#X..ay#y#y#y#y#y#.ay#.av.",
-" K.K.K.K.b.b.b.b.K.K.K.K.g#g#t#D#fbWag#c#X#2a2aeb7#D#Q.vaA.2at#p#9a6.V.7#7#9avaSaSaSav.m.v.v.y#.ay#X.v.v.v.v.y#y#y#y#y#y#y#",
-" K.K.b.m.b.b.b.b.K.K.K.K.Ja7#7#6.2az.#ac#z.G#eaG#p#2a2a2at#t#t#t#7#9aD#J.SaL#RaRaF#v.v.v.v.v.v.y#m.v.v.a#a#v.v.M#M#M#y#y# ",
-" b.b.m.b.m.b.b.b.K.X.7#7#7#7#D#3.1.z.yac#yaibh#caB#L#eaz.z.z.z.z.F#h##ab##aL#ibibv.a#m.m.v.y#M#y#a#v.v.v.a#a#a#a#M# ",
-" p.b.m.b.b.m.b.b.m.b.7#9a9aSahb..m..ayayahbhbF.h#Ias.RaRaibibL.L#kab#bab#1.L.L.y#y#a#v.v.M#y#y#M#y#v.a#a#a#v.a#a# ",
-" b.m.b.b.X.K..aK.b.7#D#F#hbv#m.b.m.m.F.F.F.v#v#F.v#L.L.L.L#..ka6#h.s.1.L#1.y#M#y#daM#M#day#y#M#M#M#a#a#a#a# ",
-" p.b.X.X.X.X.X.X.X.9aD#6#..m..aX.y#m.m.F.v#v#v#....1.Ia....kakar#r#r#1.s.M#M#y#a#a#a#M#M#y#y#daM#dadada ",
-" .a.aX..aX..aX..aD#SaF..ay#y#.aX..am.m.........s.s.9.9.r#r#r#r#kakar#M#M#a#a#a#a#a#a#M#M#M#M#dadada ",
-" K.X..a.a.a.a.aH#vab#1.y#X.X.y#y#y#y#v.v...s.d.d.d.s.r#r#h.jajajar#a#M#v.a#a#a#a#a#a#P#dadadaM# "};
-ENDofIMG
-
-demo.show_image('xpm', 'color', "/* XPM */
-static char * teapot[] = {
-\"64 48 204 2\",
-\" c #145ec4#{teapot}")
-
-demo.show_image('xpm', 'transparent', "/* XPM */
-static char * teapot[] = {
-\"64 48 204 2\",
-\" s None c None#{teapot}")
-
-demo.show_image('xbm', 'bitmap', <<'ENDofIMG')
-#define flagup_width 48
-#define flagup_height 48
-static char flagup_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00,
- 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xef, 0x6a, 0x00,
- 0x00, 0x00, 0xc0, 0x7b, 0x75, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x6a, 0x00,
- 0x00, 0x00, 0x30, 0x60, 0x75, 0x00, 0x00, 0x00, 0x18, 0xe0, 0x7f, 0x00,
- 0x00, 0x00, 0x0c, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x04, 0x00,
- 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x06, 0x00,
- 0x00, 0xc0, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0xe0, 0x07, 0x00,
- 0x00, 0x70, 0xe0, 0xe0, 0x05, 0x00, 0x00, 0x38, 0x80, 0xe1, 0x04, 0x00,
- 0x00, 0x18, 0x80, 0xf1, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xfb, 0x04, 0x00,
- 0x00, 0x0c, 0x00, 0xff, 0x04, 0x00, 0x00, 0x86, 0x1f, 0xee, 0x04, 0x00,
- 0x00, 0x06, 0x06, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00,
- 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x66, 0x04, 0x00,
- 0x7f, 0x56, 0x52, 0x06, 0xe4, 0xff, 0x00, 0x76, 0x55, 0x06, 0x04, 0x00,
- 0x00, 0x56, 0x57, 0x06, 0x04, 0x00, 0x00, 0x56, 0x55, 0x06, 0x06, 0x00,
- 0x00, 0x56, 0xd5, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00,
- 0x54, 0x06, 0x00, 0xc6, 0x54, 0x55, 0xaa, 0x06, 0x00, 0x66, 0xaa, 0x2a,
- 0x54, 0x06, 0x00, 0x36, 0x55, 0x55, 0xaa, 0x06, 0x00, 0xbe, 0xaa, 0x2a,
- 0x54, 0xfe, 0xff, 0x6f, 0x55, 0x55, 0xaa, 0xfc, 0xff, 0xa7, 0xaa, 0x2a,
- 0x54, 0x01, 0x88, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
- 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
- 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a,
- 0x54, 0x55, 0x8d, 0x50, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa8, 0xaa, 0x2a,
- 0x54, 0x55, 0x95, 0x54, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a,
- 0x54, 0x55, 0x55, 0x55, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-ENDofIMG
-
-demo.show_image('png', 'color', <<'ENDofIMG')
-iVBORw0KGgoAAAANSUhEUgAAAC4AAAAjCAIAAAETQp8oAAAIVklEQVR4nNVXPYgbSRb+xm7B
-K5CgC07QtaCDOvBCDeyAFAxIwQYdbKCBDeTgQBMqtOGCcTYOvXDBODjwHBzsBHcwExzMBAtW
-4GN7YQ1ScKAOBNPBLFcLHugGC7pgBf0WeuGC1vz6h7XZ4O5DIJp69dX3qr969Rp4A3erv69H
-YQn8aasDxh0Aw66JTtPU5ZIIhLsAvIZXw9rLJItfvd74vVzNepPx3Rh2DQAPwPFO3zqenaaO
-GcAdAAdRkuf50TQxyv8Q0gqh0ZWYNQDD0GRpHrbVJHFRYvtGE9H9nr7/dAwg8OkugLldmFaz
-1fDLtXKj1eytt76fv9JKKkkmaE5/yFbMD0IzDA2A3UEbQFsHH6bs7rsGvt0dnC9yu1heRTwZ
-dKPkHMDhTj9OXp0tXpelCBp0F8DXo/DLjp5ni+3uxou5fXT/c5Tl/HwxPcvO3dIDkOXFxGYA
-0tz+5/neNJooRSqVqi1DE3iXqyhJp2n+1dODooBjVpKKAm2t7gAIpCACgHUlD6IkXFfj2HaN
-YnBs3Ur2oK0BHO/030zqDgBmVpIAVPv924AI7cDvt3X16L0/usKzUcjAo4MIwKjftjb1SRAR
-g6/UVjje6T8bhXvDlZ/3Rt3Di/QOJ6fa9wEMu6arJJFwXGSOT6b2NsvEppPTNMnSZ6Owa4I0
-5Ulsn+8OAIABIh34WvuCKIotAN/Hg377293BDRZFBCDNmQABxNbN0vwwig93BrHNJnHS1TLL
-nE/U7xqfJBhp6m5rAdDTSkkaz6xWUitSvhCCRk9Pjnf6StHR1BYFGGwUSYLRgZKUZO4Gi1Ey
-shYAEQE4iJJwPSgKMLD1dEwQAI6myf2n469O4rZWSorxzD48iFAdxcsXEZ1aJfyJtbF1/bYO
-TaCV/ACD+PRrI//3MOzeOC+/yrvX4RM96Lcz50ah8Wm1EXfePwdAaIKvR/1RaKrHve0wSTMA
-RYHMrU7A26vTs2HY39Tj2AJAWdYEDqOkBPaGYbJ4XTKWS14syyRdnF33S1v7Twbdb3cHO/02
-gJP4FMVFCpKIiIFh15Agm7rM5Qykeb5a5pJlFJrT1B1ESdjWD/pmkmRK0ZNRtxpNUzfsmszl
-He0nNo2SbBzbyrWhCa4yapuWcywEqFZblmXLl2se/JpQ0h/HPypJZ855pbeh1d++m5vA37yn
-7in55+3eX17EZXmhRQkBIM/ZprkkAlAwj2d2Z9ADUDBCo9e1ZObK0NUsAno6uMpIXnhX+jSz
-WeZYK+kTJok9ffZA+qKtVV5wASYSBBARAbHNK8YVi80LBjsUbSUlyCcIwDEe7o/jxFa+cK5w
-edEzgZJUERWMauiCJXMdHez2e0+jxLq8ykJJGvXbjw8nWx2tCFGSHU+tUTItWCuSAiDW/jUt
-xxNLwMOjKCDSSkpJWVEUBZjZOpfmeWWvqc2Ysd0zVU49rR4eRVcsjpkgKmICigJ7J7GSlOYM
-4NHR1KZ5Fbm9P54kqSTR0XLromhcnSMGtCQGADqaxv22BiG68FXljgpPx/Etr1+dI1+AiHyi
-/SgGsN0zkogvRg+iBL8Gxzv9qlP4eFye8f8/mOBG87b2rrjfHMc7/cTlKKClJEJi87ZRW1+d
-XAZ8cNV9P9o6eDzojGN73RfPdwdpxvvjWeBLZrbSFQU62mfm63N/GymBTx2tQqOVpP1xEiUr
-u/fbOuxom7loZisjEVFeMDPGcWayj5XSb+vtnk7zQiv55GSyagcBAFW7l2SpL3Wlwye639OD
-rnHMB9GMIHySjlcbQQQi2NT5hIub6EJKtbG54ywviJAzJ9Z1dNA1KrZpynwysePYjmM7Co0v
-5eNBL0rS/atzTbkrtPI7WgEYdo0QSHN2jnPmwgFUZAygmNjs5mu5wg3b+oRHg24BuEoqMwP9
-ts6ZT2ZWCwJB+X7qeNDWmXM508ODVYnqmkAAu6P7+4djx4VPomeCtlbMvPVG79PVwVZXE4TR
-FCf545Mpbl3QXKL/WWtdSbtY4sJULSkWeWE+qb9IUikEL1n9rv7P6Q+b91SNsB1+/v08WXLZ
-8LyG8DbX1XfJebEsG1RrNuvlz7UFMzNMS36mpJLStOQ9JQXVXi+WX2xq55YP//GyWv12r/Dl
-5qcN8uz5AkAJnKZ506/XBVyBl/GP1bfd5sYn38/Ts9R58DqfNj/f3PhjGB6+mJIg5zhc18uC
-Pc9rCmop0fLrLxNb92oM1D14WP0AqIZYlgBwdqtBvY604CRnm7MAfCGUL2c26xrdM0oH0qVF
-1fjHNus9OuA8VUgPdwZEAFj7xMwMntnMpnnmOPBldR0QkZQkJVXI8sIE/uVX6u1dMcpvNRtl
-WTYEbbb8L3t/yF6X4/mZzYqax3WvweBwo5XY5e/qxMuyLPngu6Srm8uyXFcytouWlH+fzL1f
-vB/yZVPWWlK2pHDlUklyy7LRIM/zxFq5VoNjbjUbZVl7MbdvkcI/8eanzWWJhVvOX7lv/n02
-P89Vs9HAWp0aUlKNUfcECSzc8l7L9+u1+bn7JrZfbLSIoJpkAvnXf83P3dItueF5Rknlk1cT
-S8bPv/BPZck/lbJBql43SjouyxKVlLcU/mejkFEcRtYEghlEJASKAlIgL+CYcy62jE7ZEcgx
-XxZWE/ijsFP1G9cJCXgy7PpCAOACKedaSkEAsL1/Ffm2ElfAKGkCJyWBwcWqDhDRUbQqJI/6
-nTRxDEQzezkvydzjk2hvO7xeuAAw8Oho+paFbuItUqQkgACkqVOSSICIolliL+hHoUkd5znW
-FVl3o2Ax4+FB5BMB7yhkHyQFgGPurfs2ZRCc42tVFcPQnNr8/V2Qe1dBfS9ue2Vv2CUhiGia
-2Oczm7mPIf04/BfyDD1tMD0WfgAAAABJRU5ErkJggg==
-ENDofIMG
-
-demo.show_image('png', 'grayscale', <<'ENDofIMG')
-iVBORw0KGgoAAAANSUhEUgAAAC4AAAAjCAAAAAG5S1ejAAAEJElEQVR4nKWTXUwcZRiFH2YG
-ZpiBLsx2wW6ZpU1YC+3axWClf7ZKY5NVozHRxIYaL0xq1YuGeOFVRW40TXthk4aLxsT/xJjG
-+tdiGkUl1nQV6rYokuy2IFugy8/irp3dHXYGvFiwBdQ08Vx9+d73Oznfe84LAIjQNv+ELdBy
-aVqTRBSh/8p6aGMZWpDomBwwETg7020sL0NjG0XsTTT9GmlSdreji1xZ555bvzmyVvcNAI/s
-pRX/8lfi4uHoREIEnrnEKwNjcxUibdt+39PX6gwNTEkkB0l+3VPtdgclQI8fs0zd8gvoMkZX
-MBywY3B0Ox0FKoGcTvtKhQuQa5tBuvXmkHOCx4Y1xS7o6Qg29vFi6DvMe79paRjP5sIgAL/1
-jxwKJC4ewS72+kp7WfX4UQRgFUlBjA1/2R7t25DQdpbZiQJPU5V1xVMuqW+9ykc+X37WKJLC
-AmD8gkJX0HIOS3S3f+B3h48jAVNI0Viztbub4wCdC+rUf/3J7eEBOgr6l0Dbr4TUpffBl0Jw
-cARr5qYvL2wPM1d8bv65a3kzPTKKBHU7AuFT53eAS3FaSsdyynQcRGiNxXaVff9wfa+Of/rB
-T66OpgkmRNiYkkssj6CuDusJ6s4YDTUHTjsCuEiNauQu7MNqXJ8LekGoRwAVXNGkV+1/33Wn
-mVdERYx5EWDCttbJqpQ5NqCRSgV0UbE0BBjzP/XpBDn90Te3ll3q8aXXqGIVAvSInau8rrSV
-m5iaY9DaU6TUdyKAKVUhWh/qSU6Owmv9mv9wIQ+OxynqbpZ6IQ6cAgrzURXtc/ZoDnQtGWFH
-6z/OW/t/dhkARbfR2DGer5avbnyZZWleCv/+C13AkYmP3bkxqy73X+y6v9F9NgLNW8Sf7DJs
-yzI+X8ne3DK99r0YoDNSEUHbdb95RiozLWR5TM2ABP79fyRlc8gfiKZ7wuFQ5dOR01CU8vpp
-kZMp05St+UFrga4IQN3npMg7W2/8UCm5k9uT2TcgID7/rqkF/LnDANTvkNYNvlMIZn6L73re
-YfWMEdEynm8bSkIXs3Lppki21G3fsGpr3bU1yvS21InFHO8sjTMfryzNXIxbmyPXhPrm0Bkl
-fXdGKr/DfVl2ZEEQqJhl9O91SF+fFMtWR+8KeKdsogdSxe3ynCdnR0dn3IqmuFyKkqwxFtmN
-alutu2/qx3FRsZuGXFm7a8OsL+r5ikSFx53Vb5RJomBWO30L7WaDNTN8fthTrLrmZHnGVz58
-4Z4ST81nU3/Khl6SnbWy5ZVGxu5btOmQfa7GUmRLzZhmU0oyu8B4SOwEEJ/VsFJVCq/ftCm/
-xnDZOVC+gCd/dnqB+NsH1QzgnLzFxoX2CoGELiu9kxBKpo1JAOv4ygwvhsDcNC6lTgF7h25u
-g7mivaD9QKlyOZxcUVyJvwDv65E2xA9RYAAAAABJRU5ErkJggg==
-ENDofIMG
-
-demo.show_image('png', 'transparent color', <<'ENDofIMG')
-iVBORw0KGgoAAAANSUhEUgAAAC4AAAAjCAYAAAGcIAh/AAAIl0lEQVR4nOWYIXDjyNLHf7p6
-oMU0TIIDtcxhNhT0Mi9LoD+2y7JsF+6xhG3YBSYsYWt2gg6zWcS+gSM2w9RsPiDbiS/Z/e7u
-3b33ql5Xqcoujbp7unv+/+6B70i2//HLskn3G8f8xLJaO34COJ3WqX30+BgwIiCML7oYiKps
-Xcw+362pjDyp+Z6t/19Op3UC+AfA3fk8uahsHj1RFdgZv247QgjcPnRZXRV/3txBmtqmvecZ
-wGlTp94HmknFuou0nWNeW0SEdzPLu8tVBlAWkg4hnE9smtkSFyMAE1tx0z5y1rxh6zzDALcP
-3WE975s6nTbjlj8tJmn8qPwnAvh75NdPi9TUo5Wfnr/4spgeTN+cz5MtJF2u1kDO1JbpH/CU
-4AfnuTht0sfbNrNVxWJW03aOresz2KWwDwNr1wPgg+N/v12kh3ZNVQmVN1QTk5q6HBfvpTLC
-ow/8fHnNMEBUpTLCMIwh/QmgNDmyq7k3leG67bLmTcVq67JpXaEoWxefdryY2ARjVX0vMj8B
-6M4ccEjz3yoipElZpPnOQ+A4IL9Hvi6bpMDH6zYDWM4nyTlPITkigqKHtUdJvzufp6/LJl2c
-Ph3ci+U03TyL0836EVuMB+10WqdpZRDJiTrQR+X+wWWvKl87z/rR0/Wer8smTesyea+st45v
-nxajAR1jYMsiWVuQi9BuHQBFAe/nk/Trbu2R8mqXfx8UAXJg6yIbH7hpt9ycL9LW9ay3HVNr
-6PtIIcJ8WlOIAQXv4+thAZjZisoIq43DVgZbCVWRk+fC8vKeu/M5VSXcPrhsGEBR6kowArUt
-qYzQ9fGl8roytG7coux2MRZwyaiI7O3lKhNyYASNd5er7Of7bTaxFZXJWW0cH3bJPqrRr8sm
-tY+OKi9YO8fWxWw+sampS2xl/nxNF8LfjEz/qXI6fYkdf/iE/lYKkfR+PqGPkWVTp2IPZ7xS
-ij+Spi7TL8t5Wu6YBODirKHzI/AOA/Tx6fj/MPtfT5tEzqG0bCGpObHctB0K2cVpk1wMhKCo
-KlFBBFbbEQIOnk9skb4spunXT4t0Ph+57X77CMOzEBjZgRPZ6bROkgvOR/oYUMCHcFB8pHzZ
-1Dz6yHXb0Uws7+d1Wnc9VSV8WT6xmPeR02md+hg4sQWd87Rdn622Luv6mO3DB88S6nce5jm4
-PiIiLKY1nQ8Uec6ymaTrdpuZWpKPgQLBB8VFzeqySLYyByfPrlbHnlf5eKRDUJzfdVXAoMpq
-4zhfzHb/oaktb6xBVWnq8qAYQICZLY+Vm6cKwhTCxvX0UbGVoRBYd47Hr++TKXImtiIMyoAi
-kiOMWCTA1gX2xg7KXRhQlMjApDIYhEJG2I0KH65WbDvHvo5jHIhhYFaPSLg3MCiHNU/K+8iJ
-Lfk0n3HZdrgYDmGojLCcT/h8s+btiaUSaLs+u3tw1JXBD4qtBJMDotjiN57frR0CfLhtKUWw
-lcEYoR+GEW5VcTFmPoQDSz64PlOFs1kNjGU6sxUfbtvjOo+qmZAfrArjibu431KZsTIAPt4+
-ZM6HQ37OrlbZuvMYyTmxhrfPYPkIWxSwRnaeCbcP22w+sQnhwJPAgWn2crnavnrSj7ClyMek
-FCJcteMHZ7MaszuV+3XXbffHSePufJ72be1fKoXIfycT1WXxYuP/NBH9lXJ3Pk9dDDCANQYR
-6FxgUle8/fn+aO2/zPGJLdPnxQmrrXtRyN8+LZLvlavVhrIYsdaZyDDAiS1Q1Rf6/lbHy0LS
-ia1oaktlhKtVR9u5oyGzObG4PtJu3GEIEhHCoKjCattT93+h4/OJTWcziw8DtjJ8uV+zdfEo
-kvuZqes9hbEHpwuR9G5mWUxroirX7QYhpxBD1NHhcQPj43ykEFJUXgLiPpUhKn0YEIGgSudG
-/pjWFVvn8arcrx2rrctWWzc2WMbweTGj7Xy6OgJHIcQBWxWc2AoYp5w8H2eLGJWgyhABGRgD
-Ow62qj9up168LIT0cTFlAOK+KdNxOptPLEGV+43D5uNtS1UU+KgsJpY+RoIKH66fqGJalykH
-Pi3fcXWzIupAITmzumRiK1T1iFqey9SW6e3UIuTUVth2gc/3D8f8tpeoZAKc7JsQfRopVZUY
-BuZvSjY+oAq+j1SFcLnaIiKYAu4+LVNZjNgdd7yoGoiMTA8j3blecVFpapvmE5sWE5v2v+cT
-m0yRs+l6alsQox6cftVxANl1XTw7zY8+4MKA5BAH6H3k28axcYHC5Pg4cN12PLpAZeDq4xl3
-X86Tj0pQuG87Fic1tjTjEKdgCqjLAhiQ3WaKMZGHB8bgBB3P1Q8d34sflC4oLig5UOQ5VWHY
-uJ5pbZnVFbY0RD8cRv2t65l9vM40eCo8N+eLHVoothBUFUXZuB7nA31UysIc+gERwZjxkd3/
-PgzUZcHza7dXHd+3OnU1Lp7XJeeLE3SAm3WH6weiBoTxbqK2hkrM2BnqOHecXa6yR9fjY+Rs
-9gYfFB+VtfP4fmDrw+GurXlTYQzYaozx3mGT7xr5GMeLpOKph37V8XbjUFVyGSPUdj2fb9fc
-PDwiuWCLEbqMEQyC98pkRxS1LZjWI4L8z3WbqSoi0JyU2FLoo2YPrs9cH7POBQZVqkKoqwoQ
-8nxEsxAUEcEWBVNb4eMxln8XcsZboIGb1lGXOapjJPJ8bEpNDmF3pRZ04G1t8RoRZIfNT+xY
-l0VaNif7zvmFTYH05XRKsTtbOoDXgDWGfFfoZ1fH332fgIbxVqQuI8aMJaDD065FhNv2CbM/
-zk+S7yK6y9hz6fqYfb5v08VZ84JIYLxd+Xj78F1XXpPvOm7M07n2Po6Tzq6pbjcdLurB+LKp
-R/QI8KaSo3cH55Tsw3W7a3FfUvgflR9SflRl9qbAeQUZCenqN2PDaVOnRxd+9wQQ9eWm/oy8
-quTidJokH280HzrHt42jfyWK/075P4AQnUfVTZNLAAAAAElFTkSuQmCC
-ENDofIMG
-
-demo.show_image('png', 'transparent grayscale', <<'ENDofIMG')
-iVBORw0KGgoAAAANSUhEUgAAAC4AAAAjCAQAAAE2KcD0AAAFPElEQVR4nMXWXYicZxUH8N+z
-M3HezCy76axJzJrtR8jWVVc29IMtTTG6hUqqqL1QWlrxQmirXpTihRdSY4pUSws1IIEWBesH
-CAZFapNaSISgpUurJra2i7u2IWs+dpNMnbWzndfM9Hixs5tNmrYJCv7vHvi///ec85z/OQ/L
-kODeeMZ1fq+LsTjolIqixAejx3jqj5EFknfEWFBke5zwkga62O01+9LAO38INsW9QeKmmHG1
-vzrgapkttiWqkWA0hsziSr/1CX+T25fAp+Km4PZg8F2CfCseipGga+HwxYBvxur4hWQoigtp
-T7grHk3rbXHAVKJIzQRq9sZ+a/XpixHFBZGqaQ/LNVTlBnVRVcKAPWnEeBrWMrXw7+uD7WfF
-3EVTFdvSxaaiFJfFaGAxlLfinmj7fuIzcUhFpmUZfXvUND2a+Gr0uT+x1+cxFhsc1zDvQOrE
-CC97wWH3xHDM+JMHg5YV+uNSKz2PHrfEQ2eK24OaLgVTDnnKtpj0Rx8wo+IG3VpmLFNnSNW4
-futUZb7tW9b6Xcq1rFe2QdU/ztAHvIgMe9KIXDvdl4rYl7aln6VBfcbtSEupnkTRpKk0Grkt
-9mHHUsV3nl378kV31f8SH1/qkbe91UVU4hanbI0ylhXybIzE12JrwN0OI/caOqPgDL4SK+xI
-rI5rPK2d7opZdU3zSsYXC7kxNhs2blf6g82gV6adxmKlo5oyp0yf6Zmtpu1xrc/Gi9a6O2DG
-WJyy0SsOpvE0nRiJjvq/UHJUZovDun0ynkyVOKak5kQaiH7c7IFF9V7UHVFB07NuQ26TKzSN
-RH+nJkOL9HIn3kk1/cpe8NPodaWG0zIFmYIp/Yv0WS25y5WUFc172EsqqKsbVlWQyVUW6UcN
-utWvzVow9Kf9wHW6HUz7XWrOOmUFaxbp+xXs1KNfrzm5ptl00puYSLkbJZkhO1OH3khFa1CQ
-+7mqGh5LR8AD6QUVg+5Ly3qmbbW2ZF8ajaLnwXTnpnctu/lOz5RlKp5I3KiinWDP2w+k7XH7
-hVuk8v9008DSz9/VTBeG7XHMaWuVvOJDvv7fiA/GHZ5dKvODMeuX+jQdlduoucS7yMVQjUGb
-9Nndmd6jca2C57R0oyWXG/BEuoDIR2PMKe/3E1MdehWHrXIgUYmP+piGJxV1a8hRUnJUOebP
-NONg3OGfakoaXjVo2KQ5+42ncVvjEl9wIH6VFhKt6zeIsSipqWtoKMmFCfk5dVg6luM2bXWc
-1nad1z3jEkV9aq5X84bvJRiOgi/7sYaKYYOaHcssYCg2K7rchMfTslk6nwqu6EjTVHeVQ3Iz
-qnbJ9PhuVIM65v1bjrbjTtoUo3F9bIrRGI1eL9tgzuPL9ymsxGkwbVbJvBnjpqxSs9srqr7h
-kaiZt9cN+mVaeqwXCtrKCgoKOG7ewlPgnC0w57gTCrq916SPGNbvpBYm3ZnqVtim5E2rNbVM
-OuI1fTIVmV69Mpma9RYedcvEj2DAgKvcqmmvY15X1LJBr4qW1XF/+rtTblRTM2HWIbMY0WMd
-Mpmyklnz+s4Vf05TpumgH9ons1q3XiUzNmq6wjAeSU3vcY33qaWJdDS96g1Vl0lKGuoyawyp
-ndstcE+0PG29XKYkVzavoeFqdUWNjicH4maFZW+DQnxJBbm6NTJ853wmOm2dAb1aHQtnfpPg
-c/Fn7c4oZjr9KO5eMgrt9Jjz4yzxVbowo6ok87wTCbZGzZyBzgnytOOCBu859m/4sGOK6ktL
-4qZ49byboHEBU2kZ5c5YKfMX42oX/849L/4D4jD0vGNZ6YMAAAAASUVORK5CYII=
-ENDofIMG
-
-demo.show_image('jpeg', 'color', <<'ENDofIMG')
-/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
-Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwh
-MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAAR
-CAAmADkDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA
-AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK
-FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG
-h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl
-5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA
-AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk
-NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE
-hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk
-5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDzLyJSuV5FIsUm4DAzW1Ywpb3sbPhoQ4LA
-jPGea6jWdH0W6EdxYLJA78gICUb169KIq8JTutDWnSnUmqcFds4y2e5jkzGrOVGTt7Ct2aae
-ZFzGSR6cmni1t4RiFWCseRknJHf+f51MsZG4JHwP4hXmVaqctEfVYDLqsKbTla+43S7NZLkr
-dHamMEgg9R6isDVtDu7KdjFGZoOodOcD3rowWIVRkbDuUHI3DFbWnOs1n9pIIMZwwIzyBxwe
-v/16ujWs9iK+VQqfFN3W3Yo6Pp/n6LbXFx9rWeCNifLbjac9T6YxXN+a/wDzy/SvedC13S5/
-DtnZ3ckZmMQSVVTK8cYJ6HI96tfZvC3/AD42/wD35NdfM5dT5Pdtp3PBtEji1CVTtyR1U9vc
-11WpXOnRW9rYwWxB6O+/n2OOgrm40EZyg2n2rTm8M6xp+lrrk1q76bIu4hcMwB74zkD3/TFV
-KcXRcFHXudWGm6deM+axUmCQytGjrIi8Kyg81NFKrxqogVsMWk5OH78j8/YfnQ1hKlrbXU8F
-xCk43ws67d4/L3H5j1rLurqVLhhno2RXlKErn2f1qEIKV7xL77QN21VxwMdqdLdvBpbpDveS
-5cJGiHBzyMj8/wBB61i3OoySJjhR3C0+71FYYfIjncSgbSUOMj0J/mBW1OlJSuzz8fmsY0nG
-kvQ6qO4ubaLyt8fnR/Idh3AEdfyNQeVrH/QQuf8Avv8A+tWd4fu0j0dePnEjIM+vU/zqz/aq
-f8/J/wC/h/xotNSaifEO6bsVo1yy8DmvetkF3HbaW0INuYFMiYwpXA4wKKK7Y7HWtzSvNPs7
-ywezurdJLYrjyyOgx29D6EcivGviF4EtfDlnFqVpeSvFLMsPkSKCVJVjncO3y9MfjRRRUirX
-NKdWcfdi9DhbW3YRS3a7cW+GOepycDA+vWsaS3AcqScjvRRUU9zOcnLVlqx8+Elll43qoH1r
-K2L70UVaerMluf/Z
-ENDofIMG
-
-demo.show_image('jpeg', 'grayscale', <<'ENDofIMG')
-/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
-Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wAALCAAmADkBAREA/8QAHwAA
-AQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQR
-BRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RF
-RkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip
-qrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEB
-AAA/APMvIlK5XkUixSbgMDNX7Z7mOTMas5UZO3sK3Zpp5kXMZJHpyan0uzWS5K3R2pjBIIPU
-eorA1bQ7uynYxRmaDqHTnA966/R9P8/Rba4uPtazwRsT5bcbTnqfTGK5vzX/AOeX6VFYwpb3
-sbPhoQ4LAjPGea6jWdH0W6EdxYLJA78gICUb169KzBa28IxCrBWPIyTkjv8Az/OpljI3BI+B
-/EKcCxCqMjYdyg5G4Yra051ms/tJBBjOGBGeQOOD1/8Ar16PoWu6XP4ds7O7kjMxiCSqqZXj
-jBPQ5HvVr7N4W/58bf8A78mvBtEji1CVTtyR1U9vc11WpXOnRW9rYwWxB6O+/n2OOgrDmCQy
-tGjrIi8Kyg81NFKrxqogVsMWk5OH78j8/YfnUT7QN21VxwMdqdLdvBpbpDveS5cJGiHBzyMj
-8/0HrWnHcXNtF5W+Pzo/kOw7gCOv5GoPK1j/AKCFz/33/wDWrIjQRnKDafatObwzrGn6WuuT
-Wrvpsi7iFwzAHvjOQPf9MVE1hKlrbXU8FxCk43ws67d4/L3H5j1rLurqVLhhno2RVa51GSRM
-cKO4Wn3eorDD5Ec7iUDaShxkehP8wK0vD92kejrx84kZBn16n+dWf7VT/n5P/fw/41WjXLLw
-Oa962QXcdtpbQg25gUyJjClcDjArSvNPs7ywezurdJLYrjyyOgx29D6EcivGviF4EtfDlnFq
-VpeSvFLMsPkSKCVJVjncO3y9MfjXC2tuwilu124t8Mc9Tk4GB9etY0luA5Uk5HerVj58JLLL
-xvVQPrWVsX3r/9k=
-ENDofIMG
-
-demo.show_image('jpeg', 'progressive color', <<'ENDofIMG')
-/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
-Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwh
-MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wgAR
-CAAmADkDASIAAhEBAxEB/8QAGgAAAgMBAQAAAAAAAAAAAAAAAAQDBQYBAv/EABkBAAIDAQAA
-AAAAAAAAAAAAAAECAAMFBP/aAAwDAQACEAMQAAABzA7aRqV/vvl1eIWLrCCt3stuTgrWtaNs
-PsV5dljqXX57XwtLMSLehdazjQjUSQBZVQK//8QAHhAAAgIDAQEBAQAAAAAAAAAAAQIAAwQR
-EiEQBRP/2gAIAQEAAQUC0ZoxegSSZUm2toZDTXuncQcvdTS05UTXyv1KL6jj84spAsNjVhT4
-QfIW1UGZRq6DyHGurq4PLMemsJjWaGO2qf6wTxg9aOn6GCuOir4VibHz/8QAHxEAAgEEAgMA
-AAAAAAAAAAAAAQIAAwQQERIxEyFB/9oACAEDAQE/AVUseIlC3YL3HtQ3ZxTPFwdzygDfyV7o
-BdLlWI9CE7x//8QAGxEAAwEBAAMAAAAAAAAAAAAAAAECESEQEjH/2gAIAQIBAT8BXxsqukWb
-o2vTMMZMvTu8EUifH//EACgQAAEDAwIDCQAAAAAAAAAAAAIAAREQITESUQMiMhMjM0FScYGR
-of/aAAgBAQAGPwKllhcys0shItUs3ksJtkxBLKyxTVsgAnaYuugfqggwqMrHvS2SwotLLxCp
-27j3boSdiacVhnuvldX7QeFHLF1oIZHZNxBN4d4h05emmaf/xAAgEAEAAwACAgIDAAAAAAAA
-AAABABEhMUFRcWGBEJHx/9oACAEBAAE/IcshZFgLXiHkBRkjX2ZMMXcupaDQ7fZRlXxwzq2m
-HKvtNw8afMR+4nAyQDPwUhn1PcOblWCA4SAgq7fyjXNBFYupQJoHCzZ/Qg6ZDC0rzWJF3bSr
-hl7gHj1CvvTIIebEpAaSnHFp1UQioh8wNbjHv6jUa7TSpzzsEon/2gAMAwEAAgADAAAAEIb7
-MuvRaP43Yv/EABoRAQADAQEBAAAAAAAAAAAAAAEAETEhUXH/2gAIAQMBAT8QGjax8NL2bzZn
-k1Ubj8VKe1w5H5Gxahs6xyN0w2f/xAAaEQEBAQEBAQEAAAAAAAAAAAABABEhMUFR/9oACAEC
-AQE/EBu05G8Fg+WvqUj1+xtC02FE8QZt6h63/8QAJBABAAICAgIBBAMAAAAAAAAAAQARITFB
-UWGRcaGx0fCB4fH/2gAIAQEAAT8QvtkSkKLl8RFvQllJTrLEKYaUR2dkTm2mejzMlLHRa9vV
-VP3kopAoS8XmEZJwK929QBQEyWtpz9/cQpiOEFAWXobKVLxEVQS8hjDv+46IjecMUumzzP8A
-cRqyTa48sXGOt/w1ogxTIDmGiosjXPJ78HuVGgwVxK9tt03ks9/Q7nZ8b0E36Z+z/EFWbeJY
-AwKAPNXYefpUHWepPryezuBl6sSs4HJFYsll1Z0v3CYYxDfe37zz/b8yzAZldCmppUMURDFp
-Y0Vx09JklKrxFSl046V/MBjlFe22ij53AGls5lpwah8z5p//2Q==
-ENDofIMG
-
-demo.show_image('jpeg', 'progressive grayscale', <<'ENDofIMG')
-/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
-Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wgALCAAmADkBAREA/8QAGgAA
-AgMBAQAAAAAAAAAAAAAAAgQDBQYBAP/aAAgBAQAAAAHMenfNC3rRtFT67pJcFaomPWQTaBWP
-rMsW9ZxtElKr/8QAHhAAAgIDAQEBAQAAAAAAAAAAAQIAAwQREiEQBRP/2gAIAQEAAQUC0Zox
-egSSZUm2toZDTXuncQcvdTS05UTXyv1KL6jj84spAsNjVhT4QfIW1UGZRq6DyHGurq4PLMem
-sJjWaGO2qf6wTxg9aOn6GCuOir4VibHz/8QAKBAAAQMDAgMJAAAAAAAAAAAAAgABERAhMRJR
-AyIyEyMzQVJxgZGh/9oACAEBAAY/AqWWFzKzSyEi1SzeSwm2TEEsrLFNWyACdpi66B+qCDCo
-yse9LZLCi0svEKnbuPduhJ2JpxWGe6+V1ftB4UcsXWghkdk3EE3h3iHTl6aZp//EACAQAQAD
-AAICAgMAAAAAAAAAAAEAESExQVFxYYEQkfH/2gAIAQEAAT8hyyFkWAteIeQFGSNfZkwxdy6l
-oNDt9lGVfHDOraYcq+03Dxp8xH7icDJAM/BSGfU9w5uVYIDhICCrt/KNc0EVi6lAmgcLNn9C
-DpkMLSvNYkXdtKuGXuAePUK+9Mgh5sSkBpKccWnVRCKiHzA1uMe/qNRrtNKnPOwSif/aAAgB
-AQAAABCrPPK25v/EACQQAQACAgICAQQDAAAAAAAAAAEAESExQVFhkXGhsdHwgeHx/9oACAEB
-AAE/EL7ZEpCi5fERb0JZSU6yxCmGlEdnZE5tpno8zJSx0Wvb1VT95KKQKEvF5hGScCvdvUAU
-BMlrac/f3EKYjhBQFl6GylS8RFUEvIYw7/uOiI3nDFLps8z/AHEask2uPLFxjrf8NaIMUyA5
-hoqLI1zye/B7lRoMFcSvbbdN5LPf0O52fG9BN+mfs/xBVm3iWAMCgDzV2Hn6VB1nqT68ns7g
-ZerErOByRWLJZdWdL9wmGMQ33t+88/2/MswGZXQpqaVDFEQxaWNFcdPSZJSq8RUpdOOlfzAY
-5RXttoo+dwBpbOZacGofM+af/9k=
-ENDofIMG
-
-demo.show_image('tiff', 'uncompressed', <<'ENDofIMG')
-TU0AKgAAHggAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAADb///bttu2tv+Sttu2ttvb2/8AJEkAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////b//+229u2
-29vb2/+2ttttttu2ttu22//b//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAJAC229skbZLb//+2tv8AJEkkbZJtkrbb///b//9tktvb//8A
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACSttu2
-29u2ttvb2/8AAAC229skbZIAACSSttu229uSttsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAJCQAJCSSttsAAACS
-ttvb//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAASUkAAABJbZIAACQkAACStrYASQDb2/8AAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////29v//9v/29v///8AAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AABtJACSbSS2bUnbkm22km3btm22kkn/25L//9ttJAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACSSSSSSSTbkm2SSSSSSSSSJACSSSS2
-bUm2bUm2bUn/27b//9v/////////////27b/tm3btm3//9v/27b//////////////9skAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAkAABJAAAAAACSSSRJAABtJABtJACSbSSSSSTbtm22km3btm3btm3btm22km3/
-km22bUn/25L/27b/25Lbtm3btpLbkm3/27bbtpLbtm22km3/25L/27b//7b/27b//////9v/
-/////9v/////tpL/km1tJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABtAABJAABJAABJAACSJCRJ
-AABtJABtAACSSSRtJACSbSSSSSTbkm222222km22bUm2kknbtpLb25K2km22kknbtpLbtm3b
-tpLbtm22km3btpK2km3btpLb25L//9v/25L/25Lb29v//7b/27b//7b/27b/25Lb29v/27bb
-tpL//9v//////7b///////////////+2bUkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAABJAABJAABJAABJAABJJACSSSSSJABtSQCSSSSSSSSSSSSSJCSSSSS2
-bUmSSSSSJABtJABtAACSSSS2kkm2bUnbkkm2kkn/25K2kknbtm22km3bkm22km3/tm3btm3b
-tm3btpLbkm22km22kkm2kknbtm3bkpL/25L/27b//7b/27b//7b/////tm3btpL/27b/tm3b
-tpLbtm3//7b/25L//9v/////////////////////2/8AAAAAAAAAAAAAAACSSSQkAABtJABJ
-AABtJABJAABJAABJAACSSSRtSQBtJABtSSS2kkmSJCSSJCSSSSSSSSSSSSSSSSSSSSSSSSRt
-JACSSSSSSSS2bUm2km3//9u2bUm2bUm2bUm2SSS2bUm2bUm2km2SSSSSSSTbtm3btpL/25K2
-km3btkm2km3btm22km3bkm3btpL/25K2tm3bkm22km3btm22bUm2bUm2bUm2kkm2bUnbtm22
-tm3bkm3b25L//9v///////////8ADgEAAAMAAAABAEAAAAEBAAMAAAABACgAAAECAAMAAAAD
-AAAetgEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAESAAMAAAABAAEAAAEV
-AAMAAAABAAMAAAEWAAMAAAABACgAAAEXAAQAAAABAAAeAAEaAAUAAAABAAAevAEbAAUAAAAB
-AAAexAEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAAAAAAACAAIAAgSwAAAAAQAABLAAAAABAAA
-ENDofIMG
-
-demo.show_image('tiff', 'packbits compressed', <<'ENDofIMG')
-TU0AKgAABAqBAMEAgQDBAIEAwQCBAMEAgQDBAIEAwQCBAMEAgQDBAIEAwQCBAMEAgQDBAIEA
-wQCBAMEAgQDBAIEAwQCbAAvb///bttu2tv+Sttv/tv7bA/8AJEm8AKEA/v8G2///ttvbtv3b
-Df+2ttttttu2ttu22//b//+/AKMACCQAttvbJG2S2////7YR/wAkSSRtkm2Sttv//9v//22S
-/9v//8IAoQADkrbbtv/b/7b+2wD//gARttvbJG2SAAAkkrbbttvbkrbbwgCcAAAk9wD/JAUA
-JCSSttv+AAGStv/b///CAJcA/0n+AAJJbZL/AP8k/wAIkra2AEkA29v/wgCBAMEAgQDBAIEA
-wQCBAMEAgQDBAIEAwQCBAMEAgQDBAIEAwQCBAMEAgQDBAIEAwQD9///b//8B2///2/7/gQDQ
-AB5tJACSbSS2bUnbkm22km3btm22kkn/25L//9ttJAAkgQDgACOSSSSSSSTbkm2SSSSSSSSS
-JACSSSS2bUm2bUm2bUn/27b//9v3/w3btv+2bdu2bf//2//btvb/AdskigADJAAASfwAU5JJ
-JEkAAG0kAG0kAJJtJJJJJNu2bbaSbdu2bdu2bdu2bbaSbf+SbbZtSf/bkv/btv/bktu2bdu2
-ktuSbf/bttu2ktu2bbaSbf/bkv/btv//tv/btvz/ANv8/wDb/f8GtpL/km1tJLUAYm0AAEkA
-AEkAAEkAAJIkJEkAAG0kAG0AAJJJJG0kAJJtJJJJJNuSbbbbbbaSbbZtSbaSSdu2ktvbkraS
-bbaSSdu2ktu2bdu2ktu2bbaSbdu2kraSbdu2ktvbkv//2//bkv/bkv7b//8Mtv/btv//tv/b
-tv/bkv7bCP/bttu2kv//2/z/ALb1/wK2bUnXAH9JAABJAABJAABJAABJJACSSSSSJABtSQCS
-SSSSSSSSSSSSJCSSSSS2bUmSSSSSJABtJABtAACSSSS2kkm2bUnbkkm2kkn/25K2kknbtm22
-km3bkm22km3/tm3btm3btm3btpLbkm22km22kkm2kknbtm3bkpL/25L/27b//7b/2wO2//+2
-/f8Ztm3btpL/27b/tm3btpLbtm3//7b/25L//9vx/wHb//UAAZJJ/yT/AH9tJABJAABtJABJ
-AABJAABJAACSSSRtSQBtJABtSSS2kkmSJCSSJCSSSSSSSSSSSSSSSSSSSSSSSSRtJACSSSSS
-SSS2bUm2km3//9u2bUm2bUm2bUm2SSS2bUm2bUm2km2SSSSSSSTbtm3btpL/25K2km3btkm2
-km3btm22km3bkjBt27aS/9uStrZt25JttpJt27Zttm1Jtm1Jtm1JtpJJtm1J27ZttrZt25Jt
-29uS///b+P8ADgEAAAMAAAABAEAAAAEBAAMAAAABACgAAAECAAMAAAADAAAEuAEDAAMAAAAB
-gAUAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAESAAMAAAABAAEAAAEVAAMAAAABAAMAAAEW
-AAMAAAABACgAAAEXAAQAAAABAAAEAgEaAAUAAAABAAAEvgEbAAUAAAABAAAExgEcAAMAAAAB
-AAEAAAEoAAMAAAABAAIAAAAAAAAACAAIAAgSwAAAAAQAABLAAAAABAAA
-ENDofIMG
-
-if false
-demo.show_image('tiff', 'pixarlog compressed', <<'ENDofIMG')
-TU0AKgAAA3Z4nO2aIWzbUBCGz7HjYyVTNDAp0CgKDRorCauiSGFjRmWRxs0rlQ2FlUWKrLKQ
-sIDK1BoyjFRUjZSF7f13eYnjpZOmdeuU3Wc1se+dn17uf/ee5SuRYRiGYRiGYRiGYRiGYRiG
-YRg/YxVt3EG04IpLJkqocJ8VD6S1746ELsOP8UNMxO1J9MbDPQs2EvOKcV66uOsZoo34lwxb
-JraMfEsif+S06Lrj74/5XNi2iG6jdbCKruMRz3gdfKUbF/OFi/c0vHbzfNvqBDl1giENKHdt
-492dI/7sdIElMRV+i0l0G62igcx3ZMBhnUFc0ebV4fZzeBfDfx2ofyGr1DycOt+3/RXnALIB
-63rTqnYo9SVYBxptVS11+WDz//WZh/MQ8Z5E8/AiwjdmPnTg9qfg1sV+Hn7gabiK3gWbSDPl
-rcdsGIZhGIZhGIZhGIZhnCebXc1IKxeJ2LSGkbija+8G/zAXEd4LDqkTbFuo091T312l8iYd
-79JhK7ngGY+dNSfoklKP38eX4VOMt73NN77Gr4B3tP4NOeLbCWY84qfYt18x4ntPUCd133XG
-zv+RSOp5RD57DlRSiSo5Y59RY1HQV2fH1KRyunbDy/D/0VRjr3HVirQqMuJJxO2UvDY+R4hm
-DKUe3RXywudIHbVrdBe8lNzJJfK08y2kQr5k7RfXS0ZeZaJNIfYl+35S8dF7j1fI8dHV8fmC
-P7P23OO7+Dl8/idVvZCYz7hpz6VyNHKz/6ACxj8kqLNk5MWxIrkoktKhP0Re49uX+qtWxUtn
-1cjP2Nvhi8/h7vyg7FDUXLKe+7o6tEKs/bgrGUEiFfdTeqji6qN1evSaiLYH34X4/piVaOnx
-Qzx1Gr72f03MX9xdEdlcVh5dhZaMLBkS1XJCuZJxo1XXKOwWsOld6nPQbiC9asT70l+5+93Q
-cMFY//rSk1eBaj7IgaoxW3wGlXu710X7QetwpxnRqTxSEHlEupJZk+x3v2xnIRk1VMvk3oJp
-32tz7a2Du7svVNl0tUFdmtt+NiNWOuf1vE6+m/8aUR/5bSuTqBYu06/2UTjeLU7h8+h+r6nf
-ZfAMMKYbUaTH3+Lj+1Tf+n4E/6K2c+kKqS26Py0k7xDTmcz+tPZ04VUmyTLvX4p/wdR4Gsm4
-uV54beCT1Z5edCVNpc/TSn0HoOsh4gAOAQAAAwAAAAEAQAAAAQEAAwAAAAEAKAAAAQIAAwAA
-AAMAAAQkAQMAAwAAAAGAjQAAAQYAAwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAA
-ARUAAwAAAAEAAwAAARYAAwAAAAEAKAAAARcABAAAAAEAAANuARoABQAAAAEAAAQqARsABQAA
-AAEAAAQyARwAAwAAAAEAAQAAASgAAwAAAAEAAgAAAAAAAAAIAAgACBLAAAAABAAAEsAAAAAE
-AAA=
-ENDofIMG
-end
-
-if false
-demo.show_image('tiff', 'logluv compressed', <<'ENDofIMG')
-TU0AKgAAAAgADgEAAAMAAAABAEAAAAEBAAMAAAABACgAAAECAAMAAAADAAAAtgEDAAMAAAAB
-h3QAAAEGAAMAAAABAAIAAAERAAQAAAABAAAAAAESAAMAAAABAAEAAAEVAAMAAAABAAMAAAEW
-AAMAAAABACgAAAEXAAQAAAABAAAAAAEaAAUAAAABAAAAvAEbAAUAAAABAAAAxAEcAAMAAAAB
-AAEAAAEoAAMAAAABAAIAAAAAAAAAEAAQABASwAAAAAQAABLAAAAABAAA
-ENDofIMG
-end
-
-demo.show_image('tiff', 'jpeg compressed', <<'ENDofIMG')
-TU0AKgAABID/2P/AABEIACgAQAMAEQABEQACEQD/2gAMAwAAAQACAAA/APn+vn+vn+iiiiii
-iiiiiiiiiiiiiiiiiiiiiiiiiiitK28O63e28VxaaNqE8ExIilitXZXIODtIGDyCOPStO18O
-a5e28VxaaNqNxBLny5IrV3V8Eg4IGDyCPqDWtZ+FvEOo2kd3Y6Dql1bS/wCrmgs5HR+SOCBg
-8gj6g1m1mkEEgggjqDWUysjFWUqwOCCMEGikpKKKKKKKKKKKKKKUHBB449RRXdXHxU16+nt5
-Ll1j8li5MDOTIxdWJYOzKSMMF3KwG4jHTHo83xl8QXs8U92Y1aJWASAMAxZkO472ZSQA4G5W
-A3YwRjb6mfjj4guZ4pblYYhEr/u7VWHmMzIcszuwyAHC5Vgu7G054x/GPiGDxNqtvqEcLRz/
-AGcR3LFAvmSB3wwwTxsKcEnbjaCQorA8e+J7bxbrdvqcEDRzfZViunaNU82QM3zgAnjaUGCT
-jG0HAFcx8QfFlt4z1221aK18i4+yrFdt5ap50iu+HwCTymzgkkY25IUE87XLVydFFFFFFFFF
-FFFFFFFFFFFFFFFFFFe2vceH9WtktdR8KaRGsEu53hjW2Z8ZH3o1jP8AeG32B6/d7l/E9hqU
-ENvqHhjSkWKUNKUt47Z2IJHDRiM+oK5xx7Db0t34mjvrWK3u9F0vEcoeUxWkdvI2MjAaJUOO
-eV6d/TFlfhp4BvnlmZtYtCHG6G3uUKJk9F3Izce7ZP542IfDXgG5trm4uv7YtJlOfJhnURAs
-TiNMxuxwM43NkgZ61p2lh4Lube5muodVhmDMdlvdII0JJwqgxuxA46tkj8cT23wi+HtwIsat
-raF/veZcQx4PoN0QJ+vA4zV+x8C/Dm6it92rauJJOH33McIVs8gb4cnjvwDjOfS5p+geAZoo
-BcXuqmWRQGYXEcKo2eRhoiTgc54HB554zofgFayMfM8XeSp+ZC2nggr0/wCeo7+38jitB8H9
-OLAXfi9bVXXfG72PyuucZB8z1BH4fXEUHw70/wDdte+IzaxyLvjZrLO5ckZA3jnIx6Z79cNm
-+AEUkFwNO8YQXF3EuRFLYtGh/wB5w7bRjnODS3HwYtJYpF0fxfbXlzHgvHNZvEqg9CWVnwMc
-5x0/HEt18NNPc+VpPimG7uVAaRJ7NokQHHJZWf37c44zms4fs++JyCf7Y8P/AC5zi5lOB68R
-9ODVdfgZr7KP+J54fDEkbBcysw9yBGePft3qOH4S6lLGr/2/oCgnH/HxK2PQnbGeD69B3xkZ
-w7z4N+MrW8lgjs7O5RGwJor+FUf3AdlbGeOQOlYM/wAL/E0V08McdhOik7ZV1CGNZAP4gJGV
-sfUDofSsV/Aeti9kt4jYShSdsxvookcDuPNZTjnuAfbg1n6h8MPGumiMy+HbybzM4+x7brGM
-Z3eUW29e+M846GoL34aeMrHZu8P3dxuyM2O26C4x97yi23qOuM0tz8PPFlvs2aLNeb8/8g90
-vNuMfe8ktt68ZxnnHQ1//9kAAA8BAAADAAAAAQBAAAABAQADAAAAAQAoAAABAgADAAAAAwAA
-BToBAwADAAAAAQAHAAABBgADAAAAAQACAAABEQAEAAAAAQAAAAgBEgADAAAAAQABAAABFQAD
-AAAAAQADAAABFgADAAAAAQAoAAABFwAEAAAAAQAABHcBGgAFAAAAAQAABUABGwAFAAAAAQAA
-BUgBHAADAAAAAQABAAABKAADAAAAAQACAAABWwAHAAABIQAABVAAAAAAAAgACAAIEsAAAAAE
-AAASwAAAAAQAAP/Y/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQu
-JyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQF
-BgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0Kx
-wRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlq
-c3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT
-1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9k=
-ENDofIMG
-
-demo.show_image('tiff', 'deflate compressed', <<'ENDofIMG')
-TU0AKgAAAah4nO2Y643EMAiEXQzNUIyboRiaoRh2ADuP+7N70knZkxhZlmNH2fkMRPGO0Wq1
-Wq1Wq9Vqtb5L5m5qqi7Rm5kP4qdNfSSHc3dYDtfmMD8TQS3mn3b3TjRgm6YEgsaeYzwRg4TC
-9PcjRMLYzpmxcABW8+ifNviJ6DIktLKN/vv3/xRHwXJuPoV5HTwqKK1Wq9VqtVqtz+VxwMjv
-8ej/39fUpCGTdLLJVJmm6NlNQIQlev+AhyVMaDBfA6GYAU41nFrzqLSFSw3GjJf6ZeEpUvwu
-bxDOcFREAkpXRKph7IjRzOjAvEnOC9jzcC7rnlp13YB29ip4wvxT1Jn+qwlthMQ5QWDbwlsE
-RTis4uQX+cZl+zCPQfWWGZgsEkfHhaML3KyQN901lIjwL/6a4GvL5EEK4QErneKSKqPW0qaD
-+awarnpJlkTIOnI9Aic1o1LsuEHuMdIyHTgrPyVTVKsM/YfuRzY4odxz3v2KBfaf021aDQqi
-E2q3SYs0QxN1cdSOHnW0i8uWyYoR79dFIK95nedr5HhObRRmctXuUC9uNR31AAAOAQAAAwAA
-AAEAQAAAAQEAAwAAAAEAKAAAAQIAAwAAAAMAAAJWAQMAAwAAAAGAsgAAAQYAAwAAAAEAAgAA
-AREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAwAAARYAAwAAAAEAKAAAARcABAAA
-AAEAAAGfARoABQAAAAEAAAJcARsABQAAAAEAAAJkARwAAwAAAAEAAQAAASgAAwAAAAEAAgAA
-AAAAAAAIAAgACBLAAAAABAAAEsAAAAAEAAA=
-ENDofIMG
-
-if Tk::PLATFORM['platform'] != 'windows'
-demo.show_image('other', 'postscript', <<'ENDofIMG')
-%!PS-Adobe-3
-%%Title: postscript.ps
-%%BoundingBox: 66 648 146 720
-%%Pages: 1
-%%DocumentProcSets: Adobe_distill 0.96
-%%EndComments
-%%BeginProcSet: Adobe_distill 0.96
-/PROLOGUE 30 40 add dict def
- % 30 procedure entries + room for 40 cached font dictionaries
- PROLOGUE begin
- /clip { } def % causes problems. remove if "clip" is needed
- /bdef { bind def } bind def /ldef { load def } bdef
- /T { moveto show } bdef /A { moveto ashow } bdef
- /W { moveto widthshow } bdef /AW { moveto awidthshow } bdef
- /f /fill ldef /R { { rlineto } repeat } bdef
- /r /rlineto ldef /L { { lineto } repeat } bdef
- /m /moveto ldef /l { moveto lineto stroke } bdef
- /x { 0 rlineto } bdef /y { 0 exch rlineto } bdef
- /c /curveto ldef /cp /closepath ldef
- /s /stroke ldef /w /setlinewidth ldef
- /g /setgray ldef /j /setlinejoin ldef
- /d /setdash ldef /F /setfont ldef
- /C /setcmykcolor where { /setcmykcolor get }{ %ifelse
- { %def
- 1 sub 3 { 3 index add neg dup 0 lt { pop 0 } if 3 1 roll } repeat
- setrgbcolor
- } bind
- } ifelse def
- /selectfont where { pop }{ %ifelse
- /selectfont { exch findfont exch scalefont setfont } bdef
- } ifelse
- /MF { exch findfont exch makefont setfont } bdef
- /FF /selectfont ldef
- /DF { selectfont currentfont def } bdef
- /BEGINPAGE { pop /pagesave save def } bdef
- /ENDPAGE { pop pagesave restore showpage } def
- /REMAP { %def
- FontDirectory 2 index known { pop pop pop } { %ifelse
- findfont dup length dict begin
- { 1 index /FID ne {def}{pop pop} ifelse } forall
- exch dup length 0 gt { /Encoding exch def }{ pop } ifelse
- currentdict end definefont pop
- } ifelse
- } bdef
- /RECODE { %def
- 3 -1 roll 1 index findfont /Encoding get 256 array copy exch
- 0 exch { %forall
- dup type/nametype eq
- { 3 {2 index} repeat put pop 1 add }{ exch pop }ifelse
- } forall pop 3 1 roll REMAP
- } bdef
- end %PROLOGUE
-%%EndProcSet: Adobe_distill 0.96
-%%EndProlog
-%%BeginSetup
-PROLOGUE begin
-%%EndSetup
-%%Page: 1 1
-1 BEGINPAGE
-1 g
-2 setlinecap
-144 53 m
-390 x
--19 y
--390 x
-eofill
-0 g
-1.268 w
-0 setlinecap
-4 setmiterlimit
-[] 0 d
-109.698 714.182 m
-111.525 713.672 112.472 713.234 113.624 712.431 c
--22.3128 -25.8381 r
-97.4019 682.652 103.794 672.84 100.329 664.844 c
-102.034 675.687 90.7436 683.82 84.1099 684.842 c
-25.588 29.3407 r
-f
-1.0361 w
-f
-f
-91.8805 654.468 m
-96.0255 654.285 100.155 654.188 104.481 654.188 c
-113.804 654.188 122.752 654.636 131.141 655.44 c
-134.222 655.737 136.724 658.133 137.108 661.279 c
-137.79 666.855 138.107 672.696 138.107 678.705 c
-138.107 684.714 137.79 690.555 137.108 696.131 c
-136.724 699.277 134.222 701.674 131.141 701.97 c
-127.476 702.321 123.704 702.604 119.84 702.813 c
-119.84 702.813 103.842 668.373 102.231 664.827 c
-99.8549 659.595 96.601 655.765 91.8805 654.468 c
-f
-0.7851 w
-77.8202 655.44 m
-74.7171 655.948 72.2887 657.716 71.8525 661.279 c
-71.1725 666.855 70.8549 672.696 70.8549 678.705 c
-70.8549 684.714 71.1725 690.555 71.8525 696.131 c
-72.2381 699.277 74.7417 701.674 77.8202 701.97 c
-82.1335 702.383 86.5932 702.702 91.1764 702.916 c
-8.16241 9.07727 r
-99.2863 711.98 101.266 712.345 102.996 711.921 c
--28.4564 -32.9334 r
-80.6983 681.906 98.7446 677.354 98.7446 666.708 c
-98.7446 655.332 86.3243 654.054 77.8202 655.44 c
-f
-0.0843 w
-139.67 644.154 m
-140.194 644.154 140.619 644.576 140.619 645.098 c
-140.619 645.619 140.194 646.042 139.67 646.042 c
-139.146 646.042 138.721 645.619 138.721 645.098 c
-138.721 644.576 139.146 644.154 139.67 644.154 c
-1 ENDPAGE
-%%Trailer
-end %PROLOGUE
-%%Pages: 1
-%%EOF
-ENDofIMG
-end
-
-if false
-demo.show_image('other', 'pdf', <<'ENDofIMG')
-JVBERi0xLjIKJcfsj6IKNCAwIG9iago8PC9MZW5ndGggNSAwIFIvRmlsdGVyIC9GbGF0ZURl
-Y29kZT4+CnN0cmVhbQp4nF1TSY7cQAy7+xX1AkFbaXlG3jBAgAAzh/z/Esp2uyeDPhhUayEp
-FZMsnt/9/fg6/h6y/hzCHdS1UlyodH0dIrJJNyIWlLpE1OcLrGQOjLg6MOIm6+NoMULWiopN
-bevz6HRiaUQ0aKMHW1L7itQitGA2UvwdDuhoIaw8zSN3UOVqTnILNLAiXQVy3NNvCvQs+M57
-Zv4Gj6LivWK7UxS0dDCknBGl2jNY6MKoKmBkljwYfQUD2d8ZqjkKgINASEyEfCq208nc0Fon
-YSdZIiFy7IldQmbACe4FraKUfVYkzEAgarhgIBJyvIGi+IYrCWqm4I6UJ4mvV4PmfTW4J3TI
-tZCHQzdmDqeLY7Jgpf6IAG7KKVAsLAMBxWIEqrEvuAAc8xXp2Rtgkdhp038B7PfcCyQZ5WDV
-oXIuWGdCI387SO/GjezVgcZyuRaAP1b3gXVmopb1ZfXXkSM/z6Imx+4xpHAsseGHgD2abFzu
-2+qEzjwjl9fJN4vb6zd+ef1Ebq+fDrfZz4zH7GFhc0O32cPSJR+zXzIes0vnMPZlNk73ejWT
-gFNDYs/IOM3tkTXmGUbMsaPF9cAwq8KuyNwxFMc4gJY+d47S0Td/68nSNxkiUNpz159H8Twg
-g1LkcKyGBe6TkQYL3jhwTDwreSJ7gw9eZeBY3GZpPBU/FjY7/HX8A9+h3WJlbmRzdHJlYW0K
-ZW5kb2JqCjUgMCBvYmoKNTE2CmVuZG9iagozIDAgb2JqCjw8Ci9UeXBlIC9QYWdlCi9NZWRp
-YUJveCBbMCAwIDYxMiA3OTJdCi9QYXJlbnQgMiAwIFIKL1Jlc291cmNlcyA8PCAvUHJvY1Nl
-dCBbL1BERl0KPj4KL0NvbnRlbnRzIDQgMCBSCj4+CmVuZG9iagoyIDAgb2JqCjw8IC9UeXBl
-IC9QYWdlcyAvS2lkcyBbCjMgMCBSCl0gL0NvdW50IDEKPj4KZW5kb2JqCjEgMCBvYmoKPDwg
-L1R5cGUgL0NhdGFsb2cgL1BhZ2VzIDIgMCBSCj4+CmVuZG9iago2IDAgb2JqCjw8IC9DcmVh
-dGlvbkRhdGUgKEQ6MTk5NzEyMDUyMjU2MzcpCi9Qcm9kdWNlciAoQWxhZGRpbiBHaG9zdHNj
-cmlwdCA1LjEwKQo+PgplbmRvYmoKeHJlZgowIDcKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAw
-MDAwNzk5IDAwMDAwIG4gCjAwMDAwMDA3NDAgMDAwMDAgbiAKMDAwMDAwMDYyMCAwMDAwMCBu
-IAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDA2MDEgMDAwMDAgbiAKMDAwMDAwMDg0OCAw
-MDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDcgL1Jvb3QgMSAwIFIgL0luZm8gNiAwIFIKPj4K
-c3RhcnR4cmVmCjkzOQolJUVPRgo=
-ENDofIMG
-end
-
-#######################
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tkimg/license_terms_of_Img_extension b/ext/tk/sample/tkextlib/tkimg/license_terms_of_Img_extension
deleted file mode 100644
index 7f515feee8..0000000000
--- a/ext/tk/sample/tkextlib/tkimg/license_terms_of_Img_extension
+++ /dev/null
@@ -1,41 +0,0 @@
-This software is copyrighted by Jan Nijtmans (the maintainer)
-and a lot of other people who contributed code (most notably
-Andreas Kupries, Thomas G. Lane, Ioi K. Lam, Mario Weilguni
-and Roger E Critchlow Jr).
-The following terms apply to all files associated with the
-software unless explicitly disclaimed in individual files.
-
-The authors hereby grant permission to use, copy, modify, distribute,
-and license this software and its documentation for any purpose, provided
-that existing copyright notices are retained in all copies and that this
-notice is included verbatim in any distributions. No written agreement,
-license, or royalty fee is required for any of the authorized uses.
-Modifications to this software may be copyrighted by their authors
-and need not follow the licensing terms described here, provided that
-the new terms are clearly indicated on the first page of each file where
-they apply.
-
-IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
-IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-MODIFICATIONS.
-
-GOVERNMENT USE: If you are acquiring this software on behalf of the
-U.S. government, the Government shall have only "Restricted Rights"
-in the software and related documentation as defined in the Federal
-Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
-are acquiring the software on behalf of the Department of Defense, the
-software shall be classified as "Commercial Computer Software" and the
-Government shall have only "Restricted Rights" as defined in Clause
-252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
-authors grant the U.S. Government and others acting in its behalf
-permission to use and distribute the software in accordance with the
-terms specified in this license.
diff --git a/ext/tk/sample/tkextlib/tkimg/readme.txt b/ext/tk/sample/tkextlib/tkimg/readme.txt
deleted file mode 100644
index 4d9774492c..0000000000
--- a/ext/tk/sample/tkextlib/tkimg/readme.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-The script 'demo.rb' is based on 'demo.tcl' of Tcl/Tk's 'Img' extention.
-Image data in 'demo.rb' is those of 'demo.tcl'.
-Please read 'license_terms_of_Img_extension' file.
diff --git a/ext/tk/sample/tkextlib/tktable/basic.rb b/ext/tk/sample/tkextlib/tktable/basic.rb
index 0d2d48893a..ece46b318e 100644
--- a/ext/tk/sample/tkextlib/tktable/basic.rb
+++ b/ext/tk/sample/tkextlib/tktable/basic.rb
@@ -29,11 +29,11 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary,
:rowstretchmode=>:last, :colstretchmode=>:last,
:rowtagcommand=>proc{|row|
row = Integer(row)
- (row>0 && row%2 == 1)? 'OddRow': ''
+ return 'OddRow' if row>0 && row%2 == 1
},
:coltagcommand=>proc{|col|
col = Integer(col)
- (col>0 && col%2 == 1)? 'OddCol': ''
+ return 'OddCol' if col>0 && col%2 == 1
},
:selectmode=>:extended, :sparsearray=>false)
diff --git a/ext/tk/sample/tkextlib/tktable/command.rb b/ext/tk/sample/tkextlib/tktable/command.rb
index bf36159ccc..eb9ddffb78 100644
--- a/ext/tk/sample/tkextlib/tktable/command.rb
+++ b/ext/tk/sample/tkextlib/tktable/command.rb
@@ -45,11 +45,11 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols,
:rowstretchmode=>:last, :colstretchmode=>:last,
:rowtagcommand=>proc{|row|
row = Integer(row)
- (row>0 && row%2 == 1)? 'OddRow': ''
+ return 'OddRow' if row>0 && row%2 == 1
},
:coltagcommand=>proc{|col|
col = Integer(col)
- (col>0 && col%2 == 1)? 'OddCol': ''
+ return 'OddCol' if col>0 && col%2 == 1
},
:selectmode=>:extended, :flashmode=>true,
:rowstretch=>:unset, :colstretch=>:unset,
diff --git a/ext/tk/sample/tkextlib/tktable/debug.rb b/ext/tk/sample/tkextlib/tktable/debug.rb
index d5cd5e49ba..3200c1c77a 100644
--- a/ext/tk/sample/tkextlib/tktable/debug.rb
+++ b/ext/tk/sample/tkextlib/tktable/debug.rb
@@ -29,7 +29,7 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary,
:roworigin=>-5, :colorigin=>-2,
:coltagcommand=>proc{|col|
col = Integer(col)
- (col>0 && col%2 == 1)? 'OddCol': ''
+ return 'OddCol' if col>0 && col%2 == 1
},
:selectmode=>:extended, :flashmode=>true,
:rowstretch=>:unset, :colstretch=>:unset,
diff --git a/ext/tk/sample/tkextlib/tktable/maxsize.rb b/ext/tk/sample/tkextlib/tktable/maxsize.rb
index aff68ff377..c9ca745ee5 100644
--- a/ext/tk/sample/tkextlib/tktable/maxsize.rb
+++ b/ext/tk/sample/tkextlib/tktable/maxsize.rb
@@ -28,7 +28,7 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary,
:titlerows=>1, :titlecols=>1,
:coltagcommand=>proc{|col|
col = Integer(col)
- (col>0 && col%2 == 1)? 'OddCol': ''
+ return 'OddCol' if col>0 && col%2 == 1
},
:selectmode=>:extended,
:colstretch=>:unset, :rowstretch=>:unset,
diff --git a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb
deleted file mode 100644
index 745e6a2e5b..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Demo: Bitmaps
-#
-def demoBitmaps(t)
- #if $Version_1_1_OrLater
- if @has_bgimg
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
- :showheader=>false, :backgroundimage=>@images['sky'])
- else
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
- :showheader=>false)
- end
-
- if $HasColumnCreate
- t.column_create(:itembackground=>['gray90', []])
- else
- t.column_configure(0, :itembackground=>['gray90', []])
- end
-
- t.element_create('elemTxt', :text,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('elemSelTxt', :rect, :showfocus=>true,
- :fill=>[@SystemHighlight, ['selected', 'focus']])
- t.element_create('elemSelBmp', :rect, :outlinewidth=>4,
- :outline=>[@SystemHighlight, ['selected', 'focus']])
- t.element_create('elemBmp', :bitmap,
- :foreground=>[@SystemHighlight, ['selected', 'focus']],
- :background=>'linen',
- :bitmap=>['question' ['selected']])
-
- s = t.style_create('STYLE', :orient=>:vertical)
- t.style_elements(s, ['elemSelBmp', 'elemBmp', 'elemSelTxt', 'elemTxt'])
- t.style_layout(s, 'elemSelBmp', :union=>'elemBmp', :ipadx=>6, :ipady=>6)
- t.style_layout(s, 'elemBmp', :pady=>[0, 6], :expand=>:we)
- t.style_layout(s, 'elemSelTxt', :union=>'elemTxt', :ipadx=>2)
- t.style_layout(s, 'elemTxt', :expand=>:we)
-
- # Set default item style
- if $Version_1_1_OrLater
- t.defaultstyle = [s]
- end
-
- bitmap_names = %w(error gray75 gray50 gray25 gray12
- hourglass info questhead question warning)
-
- bitmap_names.each{|name|
- i = t.item_create
- unless $Version_1_1_OrLater
- t.item_style_set(i, 0, s)
- end
- t.item_text(i, 0, name)
- t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name)
- t.item_lastchild(:root, i)
- }
-
- bitmap_names.each{|name|
- i = t.item_create
- t.item_style_set(i, 0, s)
- t.item_text(i, 0, name)
- if true
- t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
- :foreground=>['brown', ''],
- :background=>['', ''])
- else
- t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name,
- :foreground=>[
- @SystemHighlight, ['selected', 'focus'],
- 'brown', []
- ],
- :background=>['', []])
- end
- t.item_lastchild(:root, i)
- }
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb
deleted file mode 100644
index 50ecde91f0..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/demo.rb
+++ /dev/null
@@ -1,1310 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'tk'
-require 'tkextlib/treectrl'
-
-$ScriptDir = File.dirname(File.expand_path(__FILE__))
-
-$HasColumnCreate = Tk::TreeCtrl::HasColumnCreateCommand
-
-$Version_1_1_OrLater = (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
-
-if Hash.instance_methods.include?('key')
- # probably ruby 1.9.x --> use Hash#key
- # Because Hash#index show warning "Hash#index is deprecated; use Hash#key".
-else
- # probably ruby 1.8.x --> use Hash#index
- class Hash
- alias key index
- end
-end
-
-class TkTreeCtrl_demo
- def initialize(dir)
- @ScriptDir = dir || '.'
-
- @thisPlatform = Tk::PLATFORM['platform']
- if @thisPlatform == 'unix' && Tk.windowingsystem == 'aqua'
- @thisPlatform = 'macosx'
- end
-
- @RandomN = [500]
-
- @images = Hash.new
- @sel_images = Hash.new
-
- @popup = Hash.new
- @mTree = Hash.new
- @mHeader = Hash.new
-
- @non_clear_list = []
-
- @demoCmd = Hash.new
- @demoFile = Hash.new
-
- # Get default colors
- w = TkListbox.new
- @SystemButtonFace = w[:highlightbackground]
- @SystemHighlight = w[:selectbackground]
- @SystemHighlightText = w[:selectforeground]
- w.destroy
-
- ####################
-
- make_source_window()
- make_menubar()
- make_main_window()
-
- if $Version_1_1_OrLater
- begin
- @tree2[:backgroundimage]
- @has_bgimg = true
- rescue
- @has_bgimg = false
- end
- else
- @has_bgimg = false
- end
-
- ####################
-
- make_list_popup()
- make_header_popup()
-
- init_pics('sky')
-
- ####################
-
- @tree2.bind('ButtonPress-3',
- proc{|w, x, y, rootx, rooty|
- show_list_popup(w, x, y, rootx, rooty)
- }, '%W %x %y %X %Y')
-
- # Allow "scan" bindings
- if @thisPlatform == 'windows'
- @tree2.bind_remove('Control-ButtonPress-3')
- end
-
- ####################
-
- init_demo_scripts_module()
- load_demo_scripts()
- init_demo_list()
-
- ####################
-
- @tree1.notify_bind(@tree1, 'Selection',
- proc{|c, t|
- if c == 1
- item = t.selection_get[0]
- demo_set(@demoCmd[item], @demoFile[item])
- end
- }, '%c %T')
-
- # When one item is selected in the demo list, display the styles in
- # that item.
- # See DemoClear for why the tag "DontDelete" is used
- @tree2.notify_bind('DontDelete', 'Selection',
- proc{|c, t|
- display_styles_in_item(t.selection_get[0]) if c == 1
- }, '%c %T')
- end
-
- ##########################
-
- def init_pics(*args)
- args.each{|pat|
- unless TkImage.names.find{|img| (name = @images.key(img)) && File.fnmatch(pat, name)}
- Dir.glob(File.join(@ScriptDir, 'pics', "#{pat}.gif")).each{|file|
- name = File.basename(file, '.gif')
- img = TkPhotoImage.new(:file=>file)
- @images[name] = img
- @sel_images[name] = TkPhotoImage.new
- @sel_images[name].copy(img)
- Tk::TreeCtrl.image_tint(@sel_images[name], @SystemHighlight, 128)
- }
- end
- }
- end
-
- ##########################
-
- private
-
- def make_menubar
- menuspec = [
- [['File']]
- ]
- if Tk::PLATFORM['platform'] != 'unix'
- TkConsole.create
- TkConsole.eval('.console conf -height 8')
- menuspec[0] << ['Console', proc{
- if TkComm.bool(TkConsole.eval('winfo ismapped .'))
- TkConsole.hide
- else
- TkConsole.show
- end
- }]
- end
- menuspec[0] << ['View Source', proc{toggle_source_window()}]
- menuspec[0] << ['Quit', proc{exit}]
- Tk.root.add_menubar(menuspec)
- end
-
- def make_source_window
- @src_top = TkToplevel.new
- f = TkFrame.new(@src_top, :borderwidth=>0)
- case @thisPlatform
- when 'macintosh', 'macos'
- font = TkFont.new(['Geneva', 9])
- when 'unix'
- font = TkFont.new(['Courier', -12])
- else
- font = TkFont.new(['Courier', 9])
- end
-
- @src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'),
- :wrap=>:none)
- xscr = @src_txt.xscrollbar(TkScrollbar.new(f))
- yscr = @src_txt.yscrollbar(TkScrollbar.new(f))
-
- f.pack(:expand=>true, :fill=>:both)
- f.grid_columnconfigure(0, :weight=>1)
- f.grid_rowconfigure(0, :weight=>1)
- @src_txt.grid(:row=>0, :column=>0, :sticky=>:news)
- xscr.grid(:row=>1, :column=>0, :sticky=>:we)
- yscr.grid(:row=>0, :column=>1, :sticky=>:ns)
-
- @src_top.protocol('WM_DELETE_WINDOW', proc{@src_top.withdraw})
- @src_top.geometry('-0+0')
- @src_top.withdraw
- end
-
- def show_source(file)
- @src_top.title("Demo Source: #{file}")
- @src_txt.value = IO.read(File.join(@ScriptDir, file))
- @src_txt.set_insert('1.0')
- end
-
- def toggle_source_window
- if @src_top.winfo_mapped?
- @src_top.withdraw
- else
- @src_top.deiconify
- end
- end
-
- def tree_plus_scrollbars_in_a_frame(parent, h, v)
- f = TkFrame.new(parent, :borderwidth=>1, :relief=>:sunken)
- case @thisPlatform
- when 'macintosh'
- font = TkFont.new(['Geneva', 9])
- when 'macos'
- font = TkFont.new(['Lucida Grande', 11])
- when 'unix'
- font = TkFont.new(['Helvetica', -12])
- else
- # There is a bug on my Win98 box with Tk_MeasureChars() and
- # MS Sans Serif 8.
- font = TkFont.new(['MS Sans', 8])
- end
-
- tree = Tk::TreeCtrl.new(f, :highlightthickness=>0,
- :borderwidth=>0, :font=>font)
- tree[:xscrollincrement] = 20
- tree.debug_configure(:enable=>false, :display=>false)
-
- if h
- h_scr = TkScrollbar.new(f, :orient=>:horizontal,
- :command=>proc{|*args| tree.xview(*args)})
- tree.notify_bind(h_scr, 'Scroll-x',
- proc{|w, l, u| w.set(l, u)}, '%W %l %u')
- h_scr.bind('ButtonPress-1', proc{tree.set_focus})
- end
-
- if v
- v_scr = TkScrollbar.new(f, :orient=>:vertical,
- :command=>proc{|*args| tree.yview(*args)})
- tree.notify_bind(v_scr, 'Scroll-y',
- proc{|w, l, u| w.set(l, u)}, '%W %l %u')
- v_scr.bind('ButtonPress-1', proc{tree.set_focus})
- end
-
- f.grid_columnconfigure(0, :weight=>1)
- f.grid_rowconfigure(0, :weight=>1)
- tree.grid(:row=>0, :column=>0, :sticky=>:news)
- h_scr.grid(:row=>1, :column=>0, :sticky=>:we) if h
- v_scr.grid(:row=>0, :column=>1, :sticky=>:ns) if v
-
- [f, tree]
- end
-
- def make_main_window
- Tk.root.title('Tk::TreeCtrl Demo')
-
- case @thisPlatform
- when 'macintosh', 'macosx'
- Tk.root.geometry('+40+40')
- else
- Tk.root.geometry('+0+30')
- end
-
- pane1 = TkPanedWindow.new(:orient=>:vertical, :borderwidth=>0)
- pane2 = TkPanedWindow.new(:orient=>:horizontal, :borderwidth=>0)
-
- # Tree + scrollbar: demos
- f1, @tree1 = tree_plus_scrollbars_in_a_frame(nil, false, true)
- @tree1.configure(:showbuttons=>false, :showlines=>:false,
- :showroot=>false, :height=>100)
- if $HasColumnCreate
- @tree1.column_create(:text=>'List of Demos',
- :expand=>true, :button=>false)
- else
- @tree1.column_configure(0, :text=>'List of Demos',
- :expand=>true, :button=>false)
- end
-
- # Tree + scrollbar: styles + elements in list
- f4, @tree4 = tree_plus_scrollbars_in_a_frame(nil, false, true)
- @tree4.configure(:showroot=>false, :height=>140)
- if $HasColumnCreate
- @tree4.column_create(:text=>'Elements and Styles',
- :expand=>true, :button=>false)
- else
- @tree4.column_configure(0, :text=>'Elements and Styles',
- :expand=>true, :button=>false)
- end
-
- # Tree + scrollbar: styles + elements in selected item
- f3, @tree3 = tree_plus_scrollbars_in_a_frame(nil, false, true)
- @tree3.configure(:showroot=>false)
- if $HasColumnCreate
- @tree3.column_create(:text=>'Styles in Item',
- :expand=>true, :button=>false)
- else
- @tree3.column_configure(0, :text=>'Styles in Item',
- :expand=>true, :button=>false)
- end
-
- pane1.add(f1, f4, f3, :height=>150)
- pane1.pack(:expand=>true, :fill=>:both)
-
- # Frame on right
- f2_base = TkFrame.new
-
- # Tree + scrollbars
- f2, @tree2 = tree_plus_scrollbars_in_a_frame(f2_base, true, true)
- @tree2.configure(:indent=>19)
- @tree2.debug_configure(:enable=>false, :display=>true,
- :erasecolor=>'pink', :displaydelay=>30)
-
- # Give it a big border to debug drawing
- @tree2.configure(:borderwidth=>6, :relief=>:ridge, :highlightthickness=>3)
-
- f2_base.grid_columnconfigure(0, :weight=>1)
- f2_base.grid_rowconfigure(0, :weight=>1)
- f2.grid(:row=>0, :column=>0, :sticky=>:news, :pady=>0)
-
- pane2.add(pane1, :width=>200)
- pane2.add(f2_base, :width=>450)
-
- pane2.pack(:expand=>true, :fill=>:both)
-
- ###
- # A treectrl widget can generate the following built-in events:
- # <ActiveItem> called when the active item changes
- # <Collapse-before> called before an item is closed
- # <Collapse-after> called after an item is closed
- # <Expand-before> called before an item is opened
- # <Expand-after> called after an item is opened
- # <Selection> called when items are added to or removed from the selection
- # <Scroll-x> called when horizontal scroll position changes
- # <Scroll-y> called when vertical scroll position changes
- #
- # The application programmer can define custom events to be
- # generated by the "T notify generate" command. The following events
- # are generated by the example bindings.
-
- @tree2.notify_install_event('Header')
- @tree2.notify_install_detail('Header', 'invoke')
-
- @tree2.notify_install_event('Drag')
- @tree2.notify_install_detail('Drag', 'begin')
- @tree2.notify_install_detail('Drag', 'end')
- @tree2.notify_install_detail('Drag', 'receive')
-
- @tree2.notify_install_event('Edit')
- @tree2.notify_install_detail('Edit', 'accept')
- end
-
- def make_list_popup
- @popup[:bgimg] = TkVariable.new
- @popup[:bgmode] = TkVariable.new
- @popup[:debug] = Hash.new{|h, k| h[k] = TkVariable.new}
- @popup[:doublebuffer] = TkVariable.new
- @popup[:linestyle] = TkVariable.new
- @popup[:orient] = TkVariable.new
- @popup[:selectmode] = TkVariable.new
- @popup[:show] = Hash.new{|h, k| h[k] = TkVariable.new}
-
- menuspec = [
- [ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ],
-
- [ 'Expand', [], nil, '', {:menu_config=>{:tearoff=>false}} ]
- ]
-
- # if $Version_1_1_OrLater
- if @has_bgimg
- menuspec << \
- [ 'Background Image',
- [
- [ 'none', [@popup[:bgimg], 'none'], nil, '',
- {:command=>proc{@tree2.backgroundimage = ''}} ],
- [ 'sky', [@popup[:bgimg], 'sky'], nil, '',
- {:command=>proc{
- @tree2.backgroundimage = @images[@popup[:bgimg].value]}} ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}}
- ]
- end
-
- menuspec.concat([
- [ 'Background Mode',
- %w(column index row visindex).collect{|val|
- [ val, [@popup[:bgmode], val] , nil, '',
- {:command=>proc{@tree2.backgroundmode = @popup[:bgmode].value}} ]
- },
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Debug',
- [
- [ 'Data', @popup[:debug][:data], nil, '',
- {:command=>proc{
- @tree2.debug_configure(:data=>@popup[:debug][:data].value)
- }
- } ],
- [ 'Display', @popup[:debug][:display], nil, '',
- {:command=>proc{
- @tree2.debug_configure(:display=>@popup[:debug][:display].value)
- }
- } ],
- [ 'Enable', @popup[:debug][:enable], nil, '',
- {:command=>proc{
- @tree2.debug_configure(:enable=>@popup[:debug][:enable].value)
- }
- } ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Buffering',
- [
- [ 'none', [@popup[:doublebuffer], 'none'], nil, '',
- {:command=>proc{
- @tree2.doublebuffer = @popup[:doublebuffer].value
- }
- } ],
- [ 'item', [@popup[:doublebuffer], 'item'], nil, '',
- {:command=>proc{
- @tree2.doublebuffer = @popup[:doublebuffer].value
- }
- } ],
- [ 'window', [@popup[:doublebuffer], 'window'], nil, '',
- {:command=>proc{
- @tree2.doublebuffer = @popup[:doublebuffer].value
- }
- } ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Line style',
- [
- [ 'dot', [@popup[:linestyle], 'dot'], nil, '',
- {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ],
- [ 'solid', [@popup[:linestyle], 'solid'], nil, '',
- {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Orient',
- [
- [ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '',
- {:command=>proc{@tree2.orient = @popup[:orient].value}} ],
- [ 'Vertical', [@popup[:orient], 'vertical'], nil, '',
- {:command=>proc{@tree2.orient = @popup[:orient].value}} ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Selectmode',
- %w(list browse extended multiple single).collect{|val|
- [ val, [@popup[:selectmode], val] , nil, '',
- {:command=>proc{@tree2.selectmode = @popup[:selectmode].value}} ]
- },
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Show',
- [
- [ 'Buttons', @popup[:show][:buttons], nil, '',
- {:command=>proc{
- @tree2.showbuttons = @popup[:show][:buttons].value
- }
- } ],
- [ 'Header', @popup[:show][:header], nil, '',
- {:command=>proc{
- @tree2.showheader = @popup[:show][:header].value
- }
- } ],
- [ 'Lines', @popup[:show][:lines], nil, '',
- {:command=>proc{
- @tree2.showlines = @popup[:show][:lines].value
- }
- } ],
- [ 'Root', @popup[:show][:root], nil, '',
- {:command=>proc{
- @tree2.showroot = @popup[:show][:root].value
- }
- } ],
- [ 'Root Button', @popup[:show][:rootbutton], nil, '',
- {:command=>proc{
- @tree2.showrootbutton = @popup[:show][:rootbutton].value
- }
- } ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}}
- ],
-
- [ 'Visible', [], nil, '', {:menu_config=>{:tearoff=>false}} ]
- ])
-
- m = TkMenu.new_menuspec(menuspec, @tree2, false)
- @non_clear_list << m
- @mTree[@tree2] = m
- end
-
- def show_list_popup(w, x, y, rootx, rooty)
- id = w.identify(x, y)
- unless id.empty?
- if id[0] == 'header'
- col = id[1]
- @popup[:column].value = col
- @popup[:arrow].value = w.column_cget(col, :arrow)
- @popup[:arrowside].value = w.column_cget(col, :arrowside)
- @popup[:arrowgravity].value = w.column_cget(col, :arrowgravity)
- @popup[:expand].value = w.column_cget(col, :expand)
- @popup[:squeeze].value = w.column_cget(col, :squeeze)
- @popup[:justify].value = w.column_cget(col, :justify)
- @mHeader[w].popup(rootx, rooty)
- return
- end
- end
-
- m = @mTree[w].entrycget('Collapse', :menu)
- m.delete(0, :end)
- if $Version_1_1_OrLater
- m.add_command(:label=>'All', :command=>proc{w.item_collapse(:all)})
- else
- m.add_command(:label=>'All', :command=>proc{w.collapse(:all)})
- end
- unless id.empty?
- if id[0] == 'item'
- item = id[1]
- if $Version_1_1_OrLater
- m.add_command(:label=>"Item #{item}",
- :command=>proc{w.item_collapse(item)})
- m.add_command(:label=>"Item #{item} (recurse)",
- :command=>proc{w.item_collapse_recurse(item)})
- else
- m.add_command(:label=>"Item #{item}",
- :command=>proc{w.collapse(item)})
- m.add_command(:label=>"Item #{item} (recurse)",
- :command=>proc{w.collapse_recurse(item)})
- end
- end
- end
-
- m = @mTree[w].entrycget('Expand', :menu)
- m.delete(0, :end)
- if $Version_1_1_OrLater
- m.add_command(:label=>'All', :command=>proc{w.item_expand(:all)})
- else
- m.add_command(:label=>'All', :command=>proc{w.expand(:all)})
- end
- unless id.empty?
- if id[0] == 'item'
- item = id[1]
- if $Version_1_1_OrLater
- m.add_command(:label=>"Item #{item}",
- :command=>proc{w.item_expand(item)})
- m.add_command(:label=>"Item #{item} (recurse)",
- :command=>proc{w.item_expand_recurse(item)})
- else
- m.add_command(:label=>"Item #{item}",
- :command=>proc{w.expand(item)})
- m.add_command(:label=>"Item #{item} (recurse)",
- :command=>proc{w.expand_recurse(item)})
- end
- end
- end
-
- [:data, :display, :enable].each{|k|
- @popup[:debug][k].value = w.debug_cget(k)
- }
- # if $Version_1_1_OrLater
- if @has_bgimg
- @popup[:bgimg].value = @images.key(w[:backgroundimage])
- end
- @popup[:bgmode].value = w[:backgroundmode]
- @popup[:doublebuffer].value = w[:doublebuffer]
- @popup[:linestyle].value = w[:linestyle]
- @popup[:orient].value = w[:orient]
- @popup[:selectmode].value = w[:selectmode]
- @popup[:show][:buttons].value = w[:showbuttons]
- @popup[:show][:header].value = w[:showheader]
- @popup[:show][:lines].value = w[:showlines]
- @popup[:show][:root].value = w[:showroot]
- @popup[:show][:rootbutton].value = w[:showrootbutton]
-
- m = @mTree[w].entrycget('Visible', :menu)
- m.delete(0, :end)
- @popup[:visible] = []
- (0...(w.numcolumns)).each{|i|
- @popup[:visible][i] = TkVariable.new(w.column_cget(i, :visible))
- txt = w.column_cget(i, :text)
- img_name = w.column_cget(i, :image)
- img_name = @images.key(img_name) if img_name.kind_of?(TkImage)
- m.add_checkbutton(:variable=>@popup[:visible][i],
- :label=>"Column #{i} \"#{txt}\" [#{img_name}]",
- :command=>proc{w.column_configure(i, :visible=>@popup[:visible][i].value)})
- }
-
- @mTree[w].popup(rootx, rooty)
- end
-
- def make_header_popup
- @popup[:column] = TkVariable.new unless @popup[:column]
- @popup[:arrow] = TkVariable.new
- @popup[:arrowside] = TkVariable.new
- @popup[:arrowgravity] = TkVariable.new
- @popup[:expand] = TkVariable.new
- @popup[:squeeze] = TkVariable.new
- @popup[:justify] = TkVariable.new
-
- menuspec = [
- [ 'Arrow',
- [
- [ 'None', [@popup[:arrow], 'none'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value, :arrow=>:none)
- }
- } ],
- [ 'Up', [@popup[:arrow], 'up'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value, :arrow=>:up)
- }
- } ],
- [ 'Down', [@popup[:arrow], 'down'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value, :arrow=>:down)
- }
- } ],
-
- '---',
-
- [ 'Side Left', [@popup[:arrowside], 'left'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :arrowside=>:left)
- }
- } ],
- [ 'Side Right', [@popup[:arrowside], 'right'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :arrowside=>:right)
- }
- } ],
-
- '---',
-
- [ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :arrowgravity=>:left)
- }
- } ],
- [ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :arrowgravity=>:right)
- }
- } ],
- ],
- nil, '', {:menu_config=>{:tearoff=>false}} ],
-
- [ 'Expand', @popup[:expand], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :expand=>@popup[:expand].value)
- }
- } ],
-
- [ 'Squeeze', @popup[:squeeze], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :squeeze=>@popup[:squeeze].value)
- }
- } ],
-
- [ 'Justify',
- [
- [ 'Left', [@popup[:justify], 'left'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value, :justify=>:left)
- }
- } ],
- [ 'Center', [@popup[:justify], 'center'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :justify=>:center)
- }
- } ],
- [ 'Right', [@popup[:justify], 'right'], nil, '',
- {:command=>proc{
- @tree2.column_configure(@popup[:column].value,
- :justify=>:right)
- }
- } ]
- ],
- nil, '', {:menu_config=>{:tearoff=>false}} ]
- ]
-
- m = TkMenu.new_menuspec(menuspec, @tree2, false)
- @non_clear_list << m
- @mHeader[@tree2] = m
- end
-
- ###########################
-
- def init_demo_scripts_module
- @demo_scripts = Module.new
-
- master = self
-
- has_bgimg = @has_bgimg
-
- scriptDir = @ScriptDir
-
- thisPlatform = @thisPlatform
-
- randomN = @RandomN
-
- images = @images
- sel_images = @sel_images
-
- systemButtonFace = @SystemButtonFace
- systemHighlight = @SystemHighlight
- systemHighlightText = @SystemHighlightText
-
- def master._pub_display_styles_in_item(item)
- display_styles_in_item(item)
- end
- proc_disp_styles_in_item = proc{|item|
- master._pub_display_styles_in_item(item)
- }
-
- @demo_scripts.instance_eval{
- @master = master
-
- @has_bgimg = has_bgimg
-
- @display_styles_in_item = proc_disp_styles_in_item
-
- @Priv = TkVarAccess.new('::TreeCtrl::Priv')
-
- @ScriptDir = scriptDir
-
- @thisPlatform = thisPlatform
-
- @RandomN = randomN
-
- @images = images
- @sel_images = sel_images
-
- @SystemButtonFace = systemButtonFace
- @SystemHighlight = systemHighlight
- @SystemHighlightText = systemHighlightText
- }
-
- class << @demo_scripts
- def _get_binding
- binding
- end
- private :_get_binding
-
- def load_demo(file)
- puts "load \"#{file}\"" if $DEBUG
- begin
- eval(IO.readlines(file).join, _get_binding())
- rescue Exception => e
- bt = e.backtrace
-
- if bt[0] =~ /^([^:]+):(\d+):/
- errline = $2.to_i
- else
- raise e
- end
-
- if bt[1] =~ /^([^:]+):(\d+):/
- bt.unshift("#{file}:#{errline - $2.to_i + 1}")
- raise e
- else
- raise e
- end
- end
- end
-
- def init_pics(*args)
- @master.init_pics(*args)
- end
- end
- end
-
- def load_demo_scripts
- # demo sources
- [
- 'bitmaps',
- 'explorer',
- 'help',
- 'imovie',
- 'layout',
- 'mailwasher',
- 'outlook-folders',
- 'outlook-newgroup',
- 'random',
- 'www-options'
- ].each{|f|
- @demo_scripts.load_demo(File.join(@ScriptDir, "#{f}.rb"))
- }
- end
-
- ###########################
-
- def init_demo_list
- @tree1.element_create('e1', :text,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- @tree1.element_create('e2', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus'],
- ])
- @tree1.style_create('s1')
- @tree1.style_elements('s1', ['e2', 'e1'])
-
- # Tk listbox has linespace + 1 height
- @tree1.style_layout('s1', 'e2', :union=>['e1'],
- :ipadx=>2, :ipady=>[0, 1], :iexpand=>:e)
-
- if $Version_1_1_OrLater
- @tree1.defaultstyle = 's1'
- end
-
- ###
- [
- ["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'],
- ["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'],
- ["Outlook Express (Folders)", :demoOutlookFolders, 'outlook-folders.rb'],
- ["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'],
- ["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'],
- ["Explorer (List)", :demoExplorerList, 'explorer.rb'],
- ["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'],
- ["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'],
- ["Internet Options", :demoInternetOptions, 'www-options.rb'],
- ["Help Contents", :demoHelpContents, 'help.rb'],
- ["Layout", :demoLayout, 'layout.rb'],
- ["MailWasher", :demoMailWasher, 'mailwasher.rb'],
- ["Bitmaps", :demoBitmaps, 'bitmaps.rb'],
- ["iMovie", :demoIMovie, 'imovie.rb']
- ].each{|label, cmd, file|
- item = @tree1.item_create
- @tree1.item_lastchild(:root, item)
- unless $Version_1_1_OrLater
- @tree1.item_style_set(item, 0, 's1')
- end
- @tree1.item_text(item, 0, label)
- @demoCmd[item] = cmd
- @demoFile[item] = file
- }
-
- @tree1.yview_moveto(0.0)
- end
-
- def demo_set(cmd, file)
- demo_clear()
- clicks = Tk::Clock.clicks
- @demo_scripts.__send__(cmd, @tree2)
- clicks = Tk::Clock.clicks - clicks
- puts "set list in #{'%.2g'%(clicks/1000000.0)} seconds (#{clicks} clicks)"
- @tree2.xview_moveto(0)
- @tree2.yview_moveto(0)
- Tk.update
- display_styles_in_list()
- show_source(file)
- end
-
- def display_styles_in_list
- # Create elements and styles the first time this is called
- if @tree4.style_names.empty?
- @tree4.element_create('e1', :text,
- :fill=>[@SystemHighlightText,['selected','focus']])
- @tree4.element_create('e2', :text,
- :fill=>[
- @SystemHighlightText, ['selected','focus'],
- '', ['selected','!focus'],
- 'blue', []
- ])
- @tree4.element_create('e3', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected','focus'],
- 'gray', ['selected', '!focus']
- ])
-
- @tree4.style_create('s1')
- @tree4.style_elements('s1', ['e3', 'e1'])
- @tree4.style_layout('s1', 'e3', :union=>['e1'], :ipadx=>1, :ipady=>[0,1])
-
- @tree4.style_create('s2')
- @tree4.style_elements('s2', ['e3', 'e1', 'e2'])
- @tree4.style_layout('s2', 'e1', :padx=>[0,4])
- @tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'],
- :ipadx=>1, :ipady=>[0,1])
- end
-
- # Clear the list
- @tree4.item_delete(:all)
-
- # One item for each element in the demo list
- @tree2.element_names.sort.each{|elem|
- if $Version_1_1_OrLater
- item = @tree4.item_create(:button=>true)
- @tree4.item_collapse(item)
- else
- item = @tree4.item_create
- @tree4.item_hasbutton(item, true)
- @tree4.collapse(item)
- end
- @tree4.item_style_set(item, 0, 's1')
- @tree4.item_text(item, 0,
- "Element #{elem} (#{@tree2.element_type(elem)})")
-
- # One item for each configuration option for this element
- @tree2.element_configinfo(elem).each{|name, x, y, default, current|
- item2 = @tree4.item_create
-
- if default == current
- @tree4.item_style_set(item2, 0, 's1')
- @tree4.item_complex(item2, [
- ['e1', {:text=>"#{name} #{current.inspect}"}]
- ])
- else
- @tree4.item_style_set(item2, 0, 's2')
- @tree4.item_complex(item2, [
- ['e1', {:text=>name}],
- ['e2', {:text=>current.inspect}]
- ])
- end
-
- @tree4.item_lastchild(item, item2)
- }
-
- @tree4.item_lastchild(:root, item)
- }
-
- # One item for each style in the demo list
- @tree2.style_names.sort.each{|sty|
- if $Version_1_1_OrLater
- item = @tree4.item_create(:button=>true)
- @tree4.item_collapse(item)
- else
- item = @tree4.item_create
- @tree4.item_hasbutton(item, true)
- @tree4.collapse(item)
- end
- @tree4.item_style_set(item, 0, 's1')
- @tree4.item_text(item, 0, "Style #{sty}")
-
- # One item for each element in the style
- @tree2.style_elements(sty).each{|elem|
- if $Version_1_1_OrLater
- item2 = @tree4.item_create(:button=>true)
- @tree4.item_collapse(item2)
- else
- item2 = @tree4.item_create
- @tree4.item_hasbutton(item2, true)
- @tree4.collapse(item2)
- end
- @tree4.item_style_set(item2, 0, 's1')
- @tree4.item_text(item2, 0,
- "Element #{elem} (#{@tree2.element_type(elem)})")
-
- # One item for each layout option for this element in this style
- @tree2.style_layout(sty, elem).each{|k, v|
- item3 = @tree4.item_create
- unless $Version_1_1_OrLater
- @tree4.item_hasbutton(item3, false)
- end
- @tree4.item_style_set(item3, 0, 's1')
- @tree4.item_text(item3, 0, "#{k} #{v.inspect}")
- @tree4.item_lastchild(item2, item3)
- }
-
- @tree4.item_lastchild(item, item2)
- }
-
- @tree4.item_lastchild(:root, item)
- }
-
- @tree4.xview_moveto(0)
- @tree4.yview_moveto(0)
- end
-
- def display_styles_in_item(item)
- @tree3.column_configure(0, :text=>"Styles in item #{@tree2.index(item)}")
-
- # Create elements and styles the first time this is called
- if @tree3.style_names.empty?
- @tree3.element_create('e1', :text,
- :fill=>[@SystemHighlightText,['selected','focus']])
- @tree3.element_create('e2', :text,
- :fill=>[
- @SystemHighlightText, ['selected','focus'],
- '', ['selected','!focus'],
- 'blue', []
- ])
- @tree3.element_create('e3', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected','focus'],
- 'gray', ['selected', '!focus']
- ])
-
- @tree3.style_create('s1')
- @tree3.style_elements('s1', ['e3', 'e1'])
- @tree3.style_layout('s1', 'e3', :union=>['e1'], :ipadx=>1, :ipady=>[0,1])
-
- @tree3.style_create('s2')
- @tree3.style_elements('s2', ['e3', 'e1', 'e2'])
- @tree3.style_layout('s2', 'e1', :padx=>[0,4])
- @tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'],
- :ipadx=>1, :ipady=>[0,1])
- end
- # Clear the list
- @tree3.item_delete(:all)
-
- # One item for each item-column
- column = 0
- @tree2.item_style_set(item).each{|sty|
- item2 = @tree3.item_create
- if $Version_1_1_OrLater
- @tree3.item_collapse(item2)
- else
- @tree3.collapse(item2)
- end
- @tree3.item_style_set(item2, 0, 's1')
- @tree3.item_element_configure(item2, 0, 'e1',
- :text=>"Column #{column}: Style #{sty}")
-
- button = false
-
- # One item for each element in this style
- unless sty.to_s.empty?
- @tree2.item_style_elements(item, column).each{|elem|
- button = true
- if $Version_1_1_OrLater
- item3 = @tree3.item_create(:button=>true)
- else
- item3 = @tree3.item_create
- @tree3.item_hasbutton(item3, true)
- end
- if $Version_1_1_OrLater
- @tree3.item_collapse(item3)
- else
- @tree3.collapse(item3)
- end
- @tree3.item_style_set(item3, 0, 's1')
- @tree3.item_element_configure(item3, 0, 'e1',
- :text=>"Element #{elem} (#{@tree2.element_type(elem)})")
-
- # One item for each configuration option in this element
- @tree2.item_element_configinfo(item, column, elem) \
- .each{|name, x, y, default, current|
- item4 = @tree3.item_create
- masterDefault = @tree2.element_cget(elem, name)
- sameAsMaster = (masterDefault == current)
- if !sameAsMaster && current == ''
- sameAsMaster = true
- current = masterDefault
- end
-
- if sameAsMaster
- @tree3.item_style_set(item4, 0, 's1')
- @tree3.item_complex(item4, [
- ['e1',
- {:text=>"#{name} #{current.inspect}"}]
- ])
- else
- @tree3.item_style_set(item4, 0, 's2')
- @tree3.item_complex(item4, [
- ['e1', {:text=>name}],
- ['e2', {:text=>current.inspect}]
- ])
- end
- @tree3.item_lastchild(item3, item4)
- }
- @tree3.item_lastchild(item2, item3)
- }
- if $Version_1_1_OrLater
- @tree3.item_configure(item2, :button=>true) if button
- else
- @tree3.item_hasbutton(item2, true) if button
- end
- end
- @tree3.item_lastchild(:root, item2)
- column += 1
- }
-
- @tree3.xview_moveto(0)
- @tree3.yview_moveto(0)
- end
-
- def demo_clear
- # Clear the demo list
- @tree2.item_delete(:all)
-
- # Clear all bindings on the demo list added by the previous demo.
- # This is why DontDelete is used for the <Selection> binding.
- @tree2.notify_bindinfo(@tree2).each{|ev|
- @tree2.notify_bind_remove(@tree2, ev)
- }
-
- # Clear all run-time states
- @tree2.state_names.each{|st| @tree2.state_undefine(st) }
-
- # Clear the styles-in-item list
- @tree3.item_delete(:all)
-
- # Delete columns in demo list
- while (@tree2.numcolumns > 0)
- @tree2.column_delete(0)
- end
-
- # Delete all styles in demo list
- @tree2.style_delete(*(@tree2.style_names))
-
- # Delete all elements in demo list
- @tree2.element_delete(*(@tree2.element_names))
-
- if $Version_1_1_OrLater
- @tree2.item_configure(:root, :button=>false)
- @tree2.item_expand(:root)
- else
- @tree2.item_hasbutton(:root, false)
- @tree2.expand(:root)
- end
-
- # Restore some happy defaults to the demo list
- # if $Version_1_1_OrLater
- if @has_bgimg
- @tree2.configure(:orient=>:vertical, :wrap=>'',
- :xscrollincrement=>0, :yscrollincrement=>0,
- :itemheight=>0, :showheader=>true,
- :background=>'white', :scrollmargin=>0,
- :xscrolldelay=>50, :yscrolldelay=>50,
- :openbuttonimage=>'', :closedbuttonimage=>'',
- :backgroundmode=>:row, :treecolumn=>0, :indent=>19,
- :defaultstyle=>'', :backgroundimage=>'')
- else
- @tree2.configure(:orient=>:vertical, :wrap=>'',
- :xscrollincrement=>0, :yscrollincrement=>0,
- :itemheight=>0, :showheader=>true,
- :background=>'white', :scrollmargin=>0,
- :xscrolldelay=>50, :yscrolldelay=>50,
- :openbuttonimage=>'', :closedbuttonimage=>'',
- :backgroundmode=>:row, :treecolumn=>0, :indent=>19)
- end
-
- # Restore default bindings to the demo list
- @tree2.bindtags = [ @tree2, Tk::TreeCtrl, @tree2.winfo_toplevel, :all ]
-
- @tree2.winfo_children.each{|w|
- w.destroy unless @non_clear_list.include?(w)
- }
- end
-end
-
-TkTreeCtrl_demo.new($ScriptDir)
-
-##############################################
-
-def cursor_window(top = nil)
- top.destroy if top.kind_of?(TkWindow) && top.winfo_exist?
- top = TkToplevel.new(:title=>'Cursor Window')
-
- c = TkCanvas.new(top, :background=>'white',
- :width=>50*10, :highlightthickness=>0,
- :borderwidth=>0).pack(:expand=>true, :fill=>:both)
- cursors = %w(
- X_cursor
- arrow
- based_arrow_down
- based_arrow_up
- boat
- bogosity
- bottom_left_corner
- bottom_right_corner
- bottom_side
- bottom_tee
- box_spiral
- center_ptr
- circle
- clock
- coffee_mug
- cross
- cross_reverse
- crosshair
- diamond_cross
- dot
- dotbox
- double_arrow
- draft_large
- draft_small
- draped_box
- exchange
- fleur
- gobbler
- gumby
- hand1
- hand2
- heart
- icon
- iron_cross
- left_ptr
- left_side
- left_tee
- leftbutton
- ll_angle
- lr_angle
- man
- middlebutton
- mouse
- pencil
- pirate
- plus
- question_arrow
- right_ptr
- right_side
- right_tee
- rightbutton
- rtl_logo
- sailboat
- sb_down_arrow
- sb_h_double_arrow
- sb_left_arrow
- sb_right_arrow
- sb_up_arrow
- sb_v_double_arrow
- shuttle
- sizing
- spider
- spraycan
- star
- target
- tcross
- top_left_arrow
- top_left_corner
- top_right_corner
- top_side
- top_tee
- trek
- ul_angle
- umbrella
- ur_angle
- watch
- xterm
- )
-
- orig_cursor = c.cursor
- col = 0
- row = 0
-
- cursors.each{|cur|
- x = col * 50
- y = row * 40
-
- begin
- c.cursor = cur
-
- r = TkcRectangle.new(c, x, y, x+50, y+40,
- :fill=>'gray90', :outline=>'black', :width=>2)
- t = TkcText.new(c, x+50/2, y+4, :text=>cur, :anchor=>:n, :width=>42)
-
- col += 1
- if col >= 10
- col = 0
- row += 1
- end
-
- r.bind('Enter', proc{c.cursor = cur; r.fill = 'linen'})
- r.bind('Leave', proc{c.cursor = ''; r.fill = 'gray90'})
-
- t.bind('Enter', proc{c.cursor = cur})
- t.bind('Leave', proc{c.cursor = ''})
- rescue
- c.cursor = orig_cursor
- end
- }
-
- c.cursor = orig_cursor
- c.height = (row + 1) * 40
-end
-
-cursor_window()
-
-##############################################
-
-# A little screen magnifier for X11
-if Tk::PLATFORM['platform'] == 'unix' && Tk.windowingsystem != 'aqua'
- def show_loupe(setting=nil)
- loupe = (setting.kind_of?(Hash))? setting: {}
- loupe[:zoom] = 3 unless loupe[:zoom]
- loupe[:x] = 0 unless loupe[:x]
- loupe[:y] = 0 unless loupe[:y]
- loupe[:auto] = true unless loupe[:auto]
- loupe[:delay] = 500 unless loupe[:delay]
- loupe[:image] =
- TkPhotoImage.new(:width=>150, :height=>150) unless loupe[:image]
-
- top = TkToplevel.new(:geometry=>'-0+30',
- :title=>'A little screen magnifier for X11')
- TkLabel.new(top, :image=>loupe[:image]).pack
-
- TkTimer.new(proc{loupe[:delay]}, -1, proc{
- x, y = TkWinfo.pointerxy(Tk.root)
- if loupe[:auto] || loupe[:x] != x || loupe[:y] != y
- w = loupe[:image].width
- h = loupe[:image].height
- Tk::TreeCtrl.loupe(loupe[:image], x, y, w, h, loupe[:zoom])
- loupe[:x] = x
- loupe[:y] = y
- end
- }).start
- end
-
- show_loupe()
-end
-
-##############################################
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/treectrl/explorer.rb b/ext/tk/sample/tkextlib/treectrl/explorer.rb
deleted file mode 100644
index 242777cbce..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/explorer.rb
+++ /dev/null
@@ -1,430 +0,0 @@
-
-def demoExplorerAux(t, dir_proc, file_proc)
- base_dir = File.dirname(File.dirname(@ScriptDir))
-
- clicks = Tk::Clock.clicks
- globDirs = Dir.glob(File.join(base_dir, '*')).find_all{|file|
- FileTest.directory?(file)
- }
- clickGlobDirs = Tk::Clock.clicks - clicks
-
- clicks = Tk::Clock.clicks
- list = globDirs.sort
- clickSortDirs = Tk::Clock.clicks - clicks
-
- clicks = Tk::Clock.clicks
- list.each{|file| dir_proc.call(file)}
- clickAddDirs = Tk::Clock.clicks - clicks
-
- clicks = Tk::Clock.clicks
- globFiles = Dir.glob(File.join(base_dir, '*')).find_all{|file|
- FileTest.file?(file)
- }
- clickGlobFiles = Tk::Clock.clicks - clicks
-
- clicks = Tk::Clock.clicks
- list = globFiles.sort
- clickSortFiles = Tk::Clock.clicks - clicks
-
- clicks = Tk::Clock.clicks
- list.each{|file| file_proc.call(file)}
- clickAddFiles = Tk::Clock.clicks - clicks
-
- gd = '%.2g' % (clickGlobDirs / 1000000.0)
- sd = '%.2g' % (clickSortDirs / 1000000.0)
- ad = '%.2g' % (clickAddDirs / 1000000.0)
- gf = '%.2g' % (clickGlobFiles / 1000000.0)
- sf = '%.2g' % (clickSortFiles / 1000000.0)
- af = '%.2g' % (clickAddFiles / 1000000.0)
-
- puts "dirs(#{globDirs.length}) glob/sort/add #{gd}/#{sd}/#{ad} files(#{globFiles.length}) glob/sort/add #{gf}/#{sf}/#{af}"
-
- @Priv[:DirCnt, t] = globDirs.length
-end
-
-#
-# Demo: explorer files
-#
-def demoExplorerDetails(t)
- height = t.font.metrics(:linespace)
- height = 18 if height < 18
-
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :itemheight=>height, :selectmode=>:extended,
- :xscrollincrement=>20, :scrollmargin=>16,
- :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
-
- init_pics('small-*')
-
- if $HasColumnCreate
- t.column_create(:text=>'Name', :tag=>'name',
- :width=>200, :arrow=>:up, :arrowpad=>6)
- t.column_create(:text=>'Size', :tag=>'size', :justify=>:right,
- :width=>60, :arrowside=>:left, :arrowgravity=>:right)
- t.column_create(:text=>'Type', :tag=>'type', :width=>120)
- t.column_create(:text=>'Modified', :tag=>'modified', :width=>130)
- else
- t.column_configure(0, :text=>'Name', :tag=>'name',
- :width=>200, :arrow=>:up, :arrowpad=>6)
- t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right,
- :width=>60, :arrowside=>:left, :arrowgravity=>:right)
- t.column_configure(2, :text=>'Type', :tag=>'type', :width=>120)
- t.column_configure(3, :text=>'Modified', :tag=>'modified', :width=>130)
- end
-
- t.element_create('e1', :image,
- :image=>[
- @sel_images['small-folder'], ['selected'],
- @images['small-folder'], []
- ])
- t.element_create('e2', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('txtType', :text, :lines=>1)
- t.element_create('txtSize', :text, :lines=>1,
- :datatype=>:integer, :format=>'%dKB')
- t.element_create('txtDate', :text, :lines=>1,
- :datatype=>:time, :format=>'%d/%m/%y %I:%M %p')
- t.element_create('e4', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
-
- # image + text
- s = t.style_create('styName', :orient=>:horizontal)
- t.style_elements(s, ['e4', 'e1', 'e2'])
- t.style_layout(s, 'e1', :expand=>:ns)
- t.style_layout(s, 'e2', :padx=>[2,0], :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)
-
- # column 1: text
- s = t.style_create('stySize')
- t.style_elements(s, ['txtSize'])
- t.style_layout(s, 'txtSize', :padx=>6, :squeeze=>:x, :expand=>:ns)
-
- # column 2: text
- s = t.style_create('styType')
- t.style_elements(s, ['txtType'])
- t.style_layout(s, 'txtType', :padx=>6, :squeeze=>:x, :expand=>:ns)
-
- # column 3: text
- s = t.style_create('styDate')
- t.style_elements(s, ['txtDate'])
- t.style_layout(s, 'txtDate', :padx=>6, :squeeze=>:x, :expand=>:ns)
-
- @Priv[:edit, t] = ['e2']
- @Priv[:sensitive, t] = [ ['name', 'styName', 'e1', 'e2'] ]
- @Priv[:dragimage, t] = [ ['name', 'styName', 'e1', 'e2'] ]
-
- t.notify_bind(t, 'Edit-accept',
- proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')
-
- dir_proc = proc{|file|
- item = t.item_create
- t.item_style_set(item, 0, 'styName', 2, 'styType', 3, 'styDate')
- t.item_complex(item,
- [['e2', {:text=>File.basename(file)}]],
- [],
- [['txtType', {:text=>'Folder'}]],
- [['txtDate', {:data=>File.mtime(file).tv_sec}]])
- t.item_lastchild(:root, item)
- }
-
- file_proc = proc{|file|
- item = t.item_create
- t.item_style_set(item, 0, 'styName', 1, 'stySize',
- 2, 'styType', 3, 'styDate')
-
- ext = File.extname(file)
- case ext
- when '.dll'
- img = 'small-dll'
- when '.exe'
- img = 'small-exe'
- when '.txt'
- img = 'small-txt'
- else
- img = 'small-file'
- end
-
- type = ext.upcase
- type = type[1..-1] << ' ' unless type.empty?
- type << 'File'
-
- t.item_complex(item,
- [
- ['e1', {:image=>[@sel_images[img], ['selected'],
- @images[img], []]}],
- ['e2', {:text=>File.basename(file)}]
- ],
- [ ['txtSize', {:data=>File.size(file)/1024 + 1}] ],
- [ ['txtType', {:text=>type}] ],
- [ ['txtDate', {:data=>File.mtime(file).tv_sec}] ]
- )
- t.item_lastchild(:root, item)
- }
-
- demoExplorerAux(t, dir_proc, file_proc)
-
- @SortColumn = 0
- t.notify_bind(t, 'Header-invoke',
- proc{|w, c| explorerHeaderInvoke(t, w, c)}, '%T %C')
-
- t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ]
-end
-
-def explorerHeaderInvoke(t, w, c)
- if (c == @SortColumn)
- if t.column_cget(@SortColumn, :arrow) == 'down'
- order = :increasing
- arrow = :up
- else
- order = :decreasing
- arrow = :down
- end
- else
- if t.column_cget(@SortColumn, :arrow) == 'down'
- order = :decreasing
- arrow = :down
- else
- order = :increasing
- arrow = :up
- end
- t.column_configure(@SortColumn, :arrow=>:none)
- @SortColumn = c
- end
-
- t.column_configure(c, :arrow=>arrow)
- dirCount = TkComm.number(@Priv[:DirCnt, t])
- lastDir = dirCount - 1
- case t.column_cget(c, :tag)
- when 'name'
- if dirCount > 0
- t.item_sort(:root, order, {:last=>"root child #{lastDir}"},
- {:column=>c, :dictionary=>true})
- end
- if dirCount < t.numitems - 1
- t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
- {:column=>c, :dictionary=>true})
- end
-
- when 'size'
- if dirCount < t.numitems - 1
- t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
- {:column=>c, :integer=>true},
- {:column=>'name', :dictionary=>true})
- end
-
- when 'type'
- if dirCount < t.numitems - 1
- t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
- {:column=>c, :dictionary=>true},
- {:column=>'name', :dictionary=>true})
- end
-
- when 'modified'
- if dirCount > 0
- t.item_sort(:root, order, {:last=>"root child #{lastDir}"},
- {:column=>c, :integer=>true},
- {:column=>'name', :dictionary=>true})
- end
- if dirCount < t.numitems - 1
- t.item_sort(:root, order, {:first=>"root child #{dirCount}"},
- {:column=>c, :integer=>true},
- {:column=>'name', :dictionary=>true})
- end
-
- end
-end
-
-def demoExplorerLargeIcons(t)
- # Item height is 32 for icon, 4 padding, 3 lines of text
- itemHeight = 32 + 4 + t.font.metrics(:linespace) * 3
-
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :selectmode=>:extended, :wrap=>:window, :orient=>:horizontal,
- :itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16,
- :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
-
- init_pics('big-*')
-
- if $HasColumnCreate
- t.column_create(:width=>75)
- else
- t.column_configure(0, :width=>75)
- end
-
- t.element_create('elemImg', :image,
- :image=>[
- @sel_images['big-folder'], ['selected'],
- @images['big-folder'], []
- ])
- t.element_create('elemTxt', :text, :justify=>:center,
- :lines=>1, :width=>71, :wrap=>:word,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('elemSel', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected']
- ])
-
- # image + text
- s = t.style_create('STYLE', :orient=>:vertical)
- t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt'])
- t.style_layout(s, 'elemImg', :expand=>:we)
- t.style_layout(s, 'elemTxt',
- :pady=>[4,0], :padx=>2, :squeeze=>:x, :expand=>:we)
- t.style_layout(s, 'elemSel', :union=>['elemTxt'])
-
- @Priv[:edit, t] = ['elemTxt']
- @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
- @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
-
- t.notify_bind(t, 'Edit-accept',
- proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')
-
- dir_proc = proc{|file|
- item = t.item_create
- t.item_style_set(item, 0, 'STYLE')
- t.item_text(item, 0, File.basename(file))
- t.item_lastchild(:root, item)
- }
-
- file_proc = proc{|file|
- item = t.item_create
- t.item_style_set(item, 0, 'STYLE')
-
- ext = File.extname(file)
- case ext
- when '.dll'
- img = 'big-dll'
- when '.exe'
- img = 'big-exe'
- when '.txt'
- img = 'big-txt'
- else
- img = 'big-file'
- end
-
- type = ext.upcase
- type = type[1..-1] << ' ' unless type.empty?
- type << 'File'
-
- t.item_complex(item,
- [
- ['elemImg', {:image=>[@sel_images[img], ['selected'],
- @images[img], []]}],
- ['elemTxt', {:text=>File.basename(file)}]
- ])
- t.item_lastchild(:root, item)
- }
-
- demoExplorerAux(t, dir_proc, file_proc)
-
- t.activate(t.index('root firstchild'))
-
- t.notify_bind(t, 'ActiveItem',
- proc{|w, a, c|
- w.item_element_configure(a, 0, 'elemTxt', :lines=>'')
- w.item_element_configure(c, 0, 'elemTxt', :lines=>3)
- }, '%T %p %c')
-
- t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ]
-end
-
-# Tree is horizontal, wrapping occurs at right edge of window, each item
-# is as wide as the smallest needed multiple of 110 pixels
-def demoExplorerSmallIcons(t)
- demoExplorerList(t)
- t.configure(:orient=>:horizontal, :xscrollincrement=>0)
- t.column_configure(0, :width=>'', :stepwidth=>110, :widthhack=>false)
-end
-
-# Tree is vertical, wrapping occurs at bottom of window, each range has the
-# same width (as wide as the longest item), xscrollincrement is by range
-def demoExplorerList(t)
- height = t.font.metrics(:linespace) + 2
- height = 18 if height < 18
-
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :itemheight=>height, :selectmode=>:extended, :wrap=>:window,
- :showheader=>false, :scrollmargin=>16,
- :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
-
- init_pics('small-*')
-
- if $HasColumnCreate
- t.column_create(:widthhack=>true)
- else
- t.column_configure(0, :widthhack=>true)
- end
-
- t.element_create('elemImg', :image,
- :image=>[
- @sel_images['small-folder'], ['selected'],
- @images['small-folder'], []
- ])
- t.element_create('elemTxt', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('elemSel', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
-
- # image + text
- s = t.style_create('STYLE')
- t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt'])
- t.style_layout(s, 'elemImg', :expand=>:ns)
- t.style_layout(s, 'elemTxt', :squeeze=>:x, :expand=>:ns, :padx=>[2,0])
- t.style_layout(s, 'elemSel', :union=>['elemTxt'], :iexpand=>:ns, :ipadx=>2)
-
- @Priv[:edit, t] = ['elemTxt']
- @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
- @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ]
-
- t.notify_bind(t, 'Edit-accept',
- proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t')
-
- dir_proc = proc{|file|
- item = t.item_create
- t.item_style_set(item, 0, 'STYLE')
- t.item_text(item, 0, File.basename(file))
- t.item_lastchild(:root, item)
- }
-
- file_proc = proc{|file|
- item = t.item_create
- t.item_style_set(item, 0, 'STYLE')
-
- ext = File.extname(file)
- case ext
- when '.dll'
- img = 'small-dll'
- when '.exe'
- img = 'small-exe'
- when '.txt'
- img = 'small-txt'
- else
- img = 'small-file'
- end
-
- type = ext.upcase
- type = type[1..-1] << ' ' unless type.empty?
- type << 'File'
-
- t.item_complex(item,
- [
- ['elemImg', {:image=>[@sel_images[img], ['selected'],
- @images[img], []]}],
- ['elemTxt', {:text=>File.basename(file)}]
- ])
- t.item_lastchild(:root, item)
- }
-
- demoExplorerAux(t, dir_proc, file_proc)
-
- t.activate(t.item_firstchild(:root))
-
- t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ]
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/help.rb b/ext/tk/sample/tkextlib/treectrl/help.rb
deleted file mode 100644
index af026fc006..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/help.rb
+++ /dev/null
@@ -1,404 +0,0 @@
-#
-# Demo: Help contents
-#
-def demoHelpContents(t)
- height = t.font.metrics(:linespace)
- height = 18 if height < 18
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :itemheight=>height, :selectmode=>:browse)
-
- init_pics('help-*')
-
- if $Version_1_1_OrLater
- t.column_create(:text=>'Help Contents')
- else # TreeCtrl 1.0
- t.column_configure(0, :text=>'Help Contents')
- end
-
- # Define a new item state
- t.state_define('mouseover')
-
- t.element_create('e1', :image, :image=>@images['help-page'])
- t.element_create('e2', :image, :image=>[
- @images['help-book-open'], ['open'],
- @images['help-book-closed'], [],
- ])
- t.element_create('e3', :text,
- :font=>[t.font.dup.underline(true), ['mouseover']],
- :fill=>[
- @SystemHighlightText, ['selected', 'focus'],
- 'blue', ['mouseover']
- ])
- t.element_create('e4', :rect, :showfocus=>true,
- :fill=>[@SystemHighlight, ['selected', 'focus']])
-
- # book
- s = t.style_create('s1')
- t.style_elements(s, ['e4', 'e1', 'e3'])
- t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e3', :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- # page
- s = t.style_create('s2')
- t.style_elements(s, ['e4', 'e2', 'e3'])
- t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e3', :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- parentList = [:root, '', '', '', '', '', '']
- parent = :root
- [
- [0, 's1', "Welcome to Help"],
- [0, 's2', "Introducing Windows 98"],
- [1, 's2', "How to Use Help"],
- [2, 's1', "Find a topic"],
- [2, 's1', "Get more out of help"],
- [1, 's2', "Register Your Software"],
- [2, 's1', "Registering Windows 98 online"],
- [1, 's2', "What's New in Windows 98"],
- [2, 's1', "Innovative, easy-to-use features"],
- [2, 's1', "Improved reliability"],
- [2, 's1', "A faster operating system"],
- [2, 's1', "True Web integration"],
- [2, 's1', "More entertaining and fun"],
- [1, 's2', "If You're New to Windows 98"],
- [2, 's2', "Tips for Macintosh Users"],
- [3, 's1', "Why does the mouse have two buttons?"]
- ].each{|depth, style, text|
- item = t.item_create
- t.item_style_set(item, 0, style)
- t.item_element_configure(item, 0, 'e3', :text=>text)
- if $Version_1_1_OrLater
- t.item_collapse(item)
- else # TreeCtrl 1.0
- t.collapse(item)
- end
- t.item_lastchild(parentList[depth], item)
- depth += 1
- parentList[depth] = item
- }
-
- treeCtrlHelp = TkBindTag.new
-
- treeCtrlHelp.bind('Double-ButtonPress-1',
- proc{|w, x, y|
- if w.identify(x, y)[0] == 'header'
- Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
- else
- helpButton1(w, x, y)
- end
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('ButtonPress-1',
- proc{|w, x, y|
- helpButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('Button1-Motion',
- proc{|w, x, y|
- helpMotion1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('Button1-Leave',
- proc{|w, x, y|
- helpLeave1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('ButtonRelease-1',
- proc{|w, x, y|
- helpRelease1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('Motion', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y')
-
- treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y')
-
- treeCtrlHelp.bind('KeyPress-Return',
- proc{|w, x, y|
- if w.selection_get.length == 1
- if $Version_1_1_OrLater
- w.item_toggle(w.selection_get[0])
- else # TreeCtrl 1.0
- w.toggle(w.selection_get[0])
- end
- end
- Tk.callback_break
- }, '%W %x %y')
-
- @Priv[:help, :prev] = ''
-
- t.bindtags = [ t, treeCtrlHelp, Tk::TreeCtrl, t.winfo_toplevel, :all ]
-end
-
-# This is an alternate implementation that does not define a new item state
-# to change the appearance of the item under the cursor.
-def demoHelpContents2(t)
- height = t.font.metrics(:linespace)
- height = 18 if height < 18
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :itemheight=>height, :selectmode=>:browse)
-
- init_pics('help-*')
-
- if $Version_1_1_OrLater
- t.column_create(:text=>'Help Contents')
- else # TreeCtrl 1.0
- t.column_configure(0, :text=>'Help Contents')
- end
-
- t.element_create('e1', :image, :image=>@images['help-page'])
- t.element_create('e2', :image, :image=>[
- @images['help-book-open'], ['open'],
- @images['help-book-closed'], [],
- ])
- t.element_create('e3', :text,
- :fill=>[
- @SystemHighlightText, ['selected', 'focus'],
- 'blue', []
- ])
- t.element_create('e4', :rect, :showfocus=>true,
- :fill=>[@SystemHighligh, ['selected', 'focus']])
- t.element_create('e5', :text, :font=>t.font.dup.underline(true),
- :fill=>[
- @SystemHighlightText, ['selected', 'focus'],
- 'blue', []
- ])
-
- # book
- s = t.style_create('s1')
- t.style_elements(s, ['e4', 'e1', 'e3'])
- t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e3', :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- # page
- s = t.style_create('s2')
- t.style_elements(s, ['e4', 'e2', 'e3'])
- t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e3', :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- # book (focus)
- s = t.style_create('s1.f')
- t.style_elements(s, ['e4', 'e1', 'e5'])
- t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e5', :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e5'], :iexpand=>:ns, :ipadx=>2)
-
- # page (focus)
- s = t.style_create('s2')
- t.style_elements(s, ['e4', 'e2', 'e5'])
- t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e5', :expand=>:ns)
- t.style_layout(s, 'e4', :union=>['e5'], :iexpand=>:ns, :ipadx=>2)
-
- parentList = [:root, '', '', '', '', '', '']
- parent = :root
- [
- [0, 's1', "Welcome to Help"],
- [0, 's2', "Introducing Windows 98"],
- [1, 's2', "How to Use Help"],
- [2, 's1' "Find a topic"],
- [2, 's1', "Get more out of help"],
- [1, 's2', "Register Your Software"],
- [2, 's1', "Registering Windows 98 online"],
- [1, 's2', "What's New in Windows 98"],
- [2, 's1', "Innovative, easy-to-use features"],
- [2, 's1', "Improved reliability"],
- [2, 's1', "A faster operating system"],
- [2, 's1', "True Web integration"],
- [2, 's1', "More entertaining and fun"],
- [1, 's2', "If You're New to Windows 98"],
- [2, 's2', "Tips for Macintosh Users"],
- [3, 's1', "Why does the mouse have two buttons?"]
- ].each{|depth, style, text|
- item = t.item_create
- t.item_style_set(item, 0, style)
- t.item_element_configure(item, 0, 'e3', :text=>text)
- if $Version_1_1_OrLater
- t.item_collapse(item)
- else # TreeCtrl 1.0
- t.collapse(item)
- end
- t.item_lastchild(parentList[depth], item)
- depth += 1
- parentList[depth] = item
- }
-
- treeCtrlHelp = TkBindTag.new
-
- treeCtrlHelp.bind('Double-ButtonPress-1',
- proc{|w, x, y|
- if w.identify(x, y)[0] == 'header'
- Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
- else
- helpButton1(w, x, y)
- end
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('ButtonPress-1',
- proc{|w, x, y|
- helpButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('Button1-Motion',
- proc{|w, x, y|
- helpMotion1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('Button1-Leave',
- proc{|w, x, y|
- helpLeave1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('ButtonRelease-1',
- proc{|w, x, y|
- helpRelease1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlHelp.bind('Motion', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y')
-
- treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y')
-
- treeCtrlHelp.bind('KeyPress-Return',
- proc{|w, x, y|
- if w.selection_get.length == 1
- w.item_toggle(w.selection_get[0])
- end
- Tk.callback_break
- }, '%W %x %y')
-
- @Priv[:help, :prev] = ''
-
- t.bindtags = [ t, treeCtrlHelp, Tk::TreeCtrl, t.winfo_toplevel, :all ]
-end
-
-def helpButton1(w, x, y)
- w.set_focus
- id = w.identify(x, y)
- @Priv['buttonMode'] = ''
- if id[0] == 'header'
- Tk::TreeCtrl::BindCallback.buttonPress1(w, x, y)
- elsif id[0] == 'item'
- item = id[1]
- # didn't click an element
- return if id.length != 6
- if w.selection_includes(item)
- w.toggle(item)
- return
- end
- if w.selection_get.length > 0
- item2 = w.selection_get[0]
- if $Version_1_1_OrLater
- w.item_collapse(item2)
- else # TreeCtrl 1.0
- w.collapse(item2)
- end
- w.item_ancestors(item2).each{|i|
- if $Version_1_1_OrLater
- w.item_collapse(i) if w.compare(item, '!=', i)
- else # TreeCtrl 1.0
- w.collapse(i) if w.compare(item, '!=', i)
- end
- }
- end
- w.activate(item)
- if $Version_1_1_OrLater
- w.item_ancestors(item).each{|i|
- w.item_expand(i)
- }
- w.item_toggle(item)
- else # TreeCtrl 1.0
- w.expand(*(w.item_ancestors(item)))
- w.toggle(item)
- end
- w.selection_modify(item, :all)
- end
-end
-
-def helpMotion1(w, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.motion1(w, x, y)
- end
-end
-
-def helpLeave1(w, x, y)
- # This is called when I do ButtonPress-1 on Unix for some reason,
- # and buttonMode is undefined.
- return unless @Priv.exist?('buttonMode')
- case @Priv['buttonMode']
- when 'header'
- w.column_configure(@Priv['column'], :sunken=>false)
- end
-end
-
-def helpRelease1(w, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.release1(w, x, y)
- end
- @Priv['buttonMode'] = ''
-end
-
-def helpMotion(w, x, y)
- id = w.identify(x, y)
- if id.empty?
- elsif id[0] == 'header'
- elsif id[0] == 'item'
- item = id[1]
- if id.length == 6
- if @Priv[:help, :prev] != TkComm._get_eval_string(item)
- if @Priv[:help, :prev] != ''
- w.item_state_set(@Priv[:help, :prev], '!mouseover')
- end
- w.item_state_set(item, 'mouseover')
- @Priv[:help, :prev] = item
- end
- return
- end
- end
- if @Priv[:help, :prev] != ''
- w.item_state_set(@Priv[:help, :prev], '!mouseover')
- @Priv[:help, :prev] = ''
- end
-end
-
-# Alternate implementation doesn't rely on mouseover state
-def helpMotion2(w, x, y)
- id = w.identify(x, y)
- if id[0] == 'header'
- elsif !id.empty?
- item = id[1]
- if id.kength == 6
- if @Priv[:help, :prev] != TkComm._get_eval_string(item)
- if @Priv[:help, :prev] != ''
- style = w.item_style_set(@Priv[:help, :prev], 0)
- style.sub!(/\.f$/, '')
- w.item_style_map(@Priv[:help, :prev], 0, style, ['e5', 'e3'])
- end
- style = w.item_style_set(item, 0)
- w.item_style_map(item, 0, style + '.f', ['e3', 'e5'])
- @Priv[:help, :prev] = item
- end
- return
- end
- end
- if @Priv[:help, :prev] != ''
- style = w.item_style_set(@Priv[:help, :prev], 0)
- style.sub!(/\.f$/, '')
- w.item_style_map(@Priv[:help, :prev], 0, style, ['e5', 'e3'])
- @Priv[:help, :prev] = ''
- end
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/imovie.rb b/ext/tk/sample/tkextlib/treectrl/imovie.rb
deleted file mode 100644
index d61bf9a7c3..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/imovie.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# Demo: iMovie
-#
-def demoIMovie(t)
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :selectmode=>:browse, :orient=>:horizontal, :wrap=>:window,
- :showheader=>false, :background=>'#dcdcdc')
-
- if $HasColumnCreate
- t.column_create
- end
-
- init_pics('imovie-*')
-
- case @thisPlatform
- when 'macintosh', 'macosx'
- font1 = TkFont.new(['Geneva', 9])
- font2 = TkFont.new(['Geneva', 10])
- when 'unix'
- font1 = TkFont.new(['Helvetica', -12])
- font2 = TkFont.new(['Helvetica', -14])
- else
- font1 = TkFont.new(['Helvetica', 8])
- font2 = TkFont.new(['Helvetica', 10])
- end
-
- t.element_create('elemTime', :text, :font=>font1)
- t.element_create('elemName', :text, :font=>font2, :lines=>1, :width=>80)
- t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1,
- :fill=>['#ffdc5a', ['selected'], 'white', []])
- t.element_create('elemImg', :image)
- t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1,
- :open=>:wn)
-
- s = t.style_create('STYLE', :orient=>:vertical)
- t.style_elements(s, [
- 'elemShadow', 'elemRect', 'elemTime',
- 'elemImg', 'elemName'
- ])
- t.style_layout(s, 'elemShadow', :detach=>true,
- :padx=>[1,2], :pady=>[1,2], :iexpand=>:es)
- t.style_layout(s, 'elemTime', :padx=>[2,0])
- t.style_layout(s, 'elemImg', :pady=>[0,1])
- t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3],
- :squeeze=>:x)
- t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'],
- :ipadx=>6, :padx=>[0,3], :pady=>[0,3])
-
- # Set default item style
- if $Version_1_1_OrLater
- t.defaultstyle([s])
- end
-
- (0..4).each{|i|
- [
- ['15:20', 'Clip 1', @images['imovie-01']],
- ['19:18', 'Clip 2', @images['imovie-02']],
- ['07:20', 'Clip 3', @images['imovie-03']],
- ['07:20', 'Clip 4', @images['imovie-04']],
- ['07:20', 'Clip 5', @images['imovie-05']],
- ['07:20', 'Clip 6', @images['imovie-06']],
- ['07:20', 'Clip 7', @images['imovie-07']]
- ].each{|time, name, image|
- item = t.item_create
- unless $Version_1_1_OrLater
- t.item_style_set(item, 0, s)
- end
- t.item_element_configure(item, 0, 'elemTime', :text=>time)
- t.item_element_configure(item, 0, 'elemName', :text=>name)
- t.item_element_configure(item, 0, 'elemImg', :image=>image)
- t.item_lastchild(:root, item)
- }
- }
-
- t.notify_bind(t, 'Edit-accept', proc{|w, i, c, e, tt|
- w.item_element_configure(i, c, e, :text=>tt)
- }, '%T %I %C %E %t')
-
- iMovie = TkBindTag.new
- iMovie.bind('ButtonPress-1', proc{|w, x, y|
- iMovieButton1(w, x, y)
- }, '%W %x %y')
-
- t.bindtags = [t, iMovie, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL]
-end
-
-def iMovieButton1(w, x, y)
- w.set_focus
- id = w.identify(x,y)
-
- if id.empty?
- # Click outside any item
-
- elsif id[0] == 'header'
- # Click in header
- Tk::TreeCtrl::BindCallback.buttonPress1(w, x, y)
-
- elsif id[0] == 'item'
- # Click in item
- Tk::TreeCtrl::BindCallback.buttonPress1(w, x, y)
- Tk.update
- where, item, arg1, arg2, arg3, arg4 = id
- case arg1
- when 'column'
- i = id[1]
- if id.length == 6
- e = id[-1]
- if e == 'elemName'
- exists = TkWinfo.exist?(w.path + '.entry')
- Tk::TreeCtrl::BindCallback.entryOpen(w, i, 0, e)
- ent = TkComm.window(w.path + '.entry')
- unless exists
- ent.configure(:borderwidth=>0, :justify=>:center,
- :background=>'#ffdc5a')
- x1, y1, x2, y2 = w.item_bbox(i, 0, e)
- ent.place(:y=>y1 - 1)
- end
- ent.selection_clear
- x1, y1, x2, y2 = w.item_bbox(i)
- ent.place(:x=>x1 + 1, :width=>x2 - x1 - 5)
- puts "@#{x - (x1 + 1)}"
- # ent.icursor = ent.index("@#{x - (x1 + 1)}")
- ent.icursor = ent.index(TkComm._at(x - (x1 + 1)))
- end
- end
- end
- end
-
- Tk.callback_break
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/layout.rb b/ext/tk/sample/tkextlib/treectrl/layout.rb
deleted file mode 100644
index 745ac86f36..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/layout.rb
+++ /dev/null
@@ -1,159 +0,0 @@
-#
-# Demo: Layout
-#
-def demoLayout(t)
- t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true,
- :showlines=>true, :itemheight=>0, :selectmode=>:browse)
-
- if $HasColumnCreate
- t.column_create(:text=>'Layout')
- else
- t.column_configure(0, :text=>'Layout')
- end
-
- t.element_create('e1', :rect, :width=>30, :height=>30, :fill=>'gray20')
- t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40',
- :outline=>'blue', :outlinewidth=>3)
- t.element_create('e3', :rect, :fill=>'gray60')
- t.element_create('e4', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'], 'gray80', []
- ])
- t.element_create('e5', :rect, :fill=>'{sky blue}', :width=>20, :height=>20)
- t.element_create('e6', :rect, :fill=>'{sea green}', :width=>30, :height=>16)
- t.element_create('e7', :rect, :fill=>'{sky blue}', :width=>30, :height=>16)
- t.element_create('e8', :rect, :fill=>'gray70', :height=>1)
-
- s = t.style_create('s1')
- t.style_elements(s, ['e4', 'e3', 'e1', 'e2', 'e5', 'e6', 'e7'])
- t.style_layout(s, 'e1', :padx=>[28, 4], :pady=>4)
- t.style_layout(s, 'e2', :expand=>:es, :padx=>[0, 38])
- t.style_layout(s, 'e3', :union=>['e1', 'e2'], :ipadx=>4, :ipady=>4, :pady=>2)
- t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es)
- t.style_layout(s, 'e5', :detach=>true, :padx=>[2,0], :pady=>2, :iexpand=>:s)
- t.style_layout(s, 'e6', :detach=>true, :expand=>:ws,
- :padx=>[0,2], :pady=>[2,0])
- t.style_layout(s, 'e7', :detach=>true, :expand=>:wn,
- :padx=>[0,2], :pady=>[0,2])
-
- if $Version_1_1_OrLater
- i = t.item_create(:button=>true)
- else
- i = t.item_create
- t.item_hasbutton(i, true)
- end
- t.item_style_set(i, 0, s)
- t.item_lastchild(:root, i)
- parent = i
-
- i = t.item_create()
- unless $Version_1_1_OrLater
- t.item_hasbutton(i, false)
- end
- t.item_style_set(i, 0, s)
- t.item_lastchild(parent, i)
-
- ###
-
- s = t.style_create('s2')
- t.style_elements(s, ['e4', 'e3', 'e1'])
- t.style_layout(s, 'e1', :padx=>8, :pady=>8, :iexpand=>:e)
- t.style_layout(s, 'e3', :union=>['e1'], :ipadx=>[20,4], :ipady=>[4,12])
- t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es)
-
- if $Version_1_1_OrLater
- i = t.item_create(:button=>true)
- else
- i = t.item_create
- t.item_hasbutton(i, true)
- end
- t.item_style_set(i, 0, s)
- t.item_lastchild(:root, i)
-
- i2 = t.item_create()
- unless $Version_1_1_OrLater
- t.item_hasbutton(i2, false)
- end
- t.item_style_set(i2, 0, s)
- t.item_lastchild(i, i2)
-
- ###
-
- s = t.style_create('s3')
- t.style_elements(s, ['e4', 'e3', 'e1', 'e5', 'e6'])
- t.style_layout(s, 'e4', :union=>['e1', 'e6'], :ipadx=>8, :ipady=>[8,0])
- t.style_layout(s, 'e3', :union=>['e1', 'e5'], :ipadx=>4, :ipady=>4)
- t.style_layout(s, 'e5', :ipady=>[0,20])
-
- if $Version_1_1_OrLater
- i = t.item_create(:button=>true)
- else
- i = t.item_create
- t.item_hasbutton(i, true)
- end
- t.item_style_set(i, 0, s)
- t.item_lastchild(:root, i)
-
- i2 = t.item_create()
- unless $Version_1_1_OrLater
- t.item_hasbutton(i2, false)
- end
- t.item_style_set(i2, 0, s)
- t.item_lastchild(i, i2)
-
- ###
-
- t.element_create('eb', :border, :background=>@SystemButtonFace,
- :relief=>[:sunken, ['selected'], :raised, []],
- :thickness=>2, :filled=>true)
- t.element_create('et', :text)
-
- text = "Here is a text element surrounded by a border element.\nResize the column to watch me wrap."
-
- s = t.style_create('e4')
- t.style_elements(s, ['eb', 'et'])
- t.style_layout(s, 'eb', :union=>['et'], :ipadx=>2, :ipady=>2)
- t.style_layout(s, 'et', :squeeze=>:x)
-
- if $Version_1_1_OrLater
- i = t.item_create(:button=>true)
- else
- i = t.item_create
- t.item_hasbutton(i, true)
- end
- t.item_style_set(i, 0, s)
- t.item_text(i, 0, text)
- t.item_lastchild(:root, i)
- parent = i
-
- i = t.item_create()
- unless $Version_1_1_OrLater
- t.item_hasbutton(i, false)
- end
- t.item_style_set(i, 0, s)
- t.item_text(i, 0, text)
- t.item_lastchild(parent, i)
-
- ###
-
- styleNum = 5
- [
- [:horizontal, [:s, :ns, :n]],
- [:vertical, [:e, :we, :w]]
- ].each{|orient, expandList|
- expandList.each{|expand|
- s = t.style_create("s#{styleNum}", :orient=>orient)
- t.style_elements(s, ['e4', 'e8', 'e2', 'e5', 'e6'])
- t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es)
- t.style_layout(s, 'e8', :detach=>true, :expand=>:n, :iexpand=>:e)
- t.style_layout(s, 'e2', :expand=>expand)
- t.style_layout(s, 'e5', :expand=>expand)
- t.style_layout(s, 'e6', :expand=>expand)
- styleNum += 1
-
- i = t.item_create()
- t.item_style_set(i, 0, s)
- t.item_lastchild(:root, i)
- }
- }
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb
deleted file mode 100644
index 836e1e87de..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb
+++ /dev/null
@@ -1,269 +0,0 @@
-#
-# Demo: MailWasher
-#
-def demoMailWasher(t)
- init_pics('*checked')
-
- height = t.font.metrics(:linespace) + 2
- height = 18 if height < 18
-
- t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false,
- :showlines=>false, :itemheight=>height, :selectmode=>:browse,
- :xscrollincrement=>1)
-
- pad = 4
-
- if $Version_1_1_OrLater
- t.column_create(:text=>'Delete', :textpadx=>pad, :tag=>'delete')
- t.column_create(:text=>'Bounce', :textpadx=>pad, :tag=>'bounce')
- t.column_create(:text=>'Status', :width=>80, :textpadx=>pad,
- :tag=>'status')
- t.column_create(:text=>'Size', :width=>40, :textpadx=>pad,
- :justify=>:right, :tag=>'size')
- t.column_create(:text=>'From', :width=>140, :textpadx=>pad, :tag=>'from')
- t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad,
- :tag=>'subject')
- t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up,
- :arrowpad=>[4,0], :tag=>'received')
- t.column_create(:text=>'Attachments', :textpadx=>pad, :tag=>'attachments')
-
- t.state_define('CHECK')
-
- t.element_create('imgCheck', :image, :image=>[
- @images['checked'], ['CHECK'], @images['unchecked'], []
- ])
-
- else # TreeCtrl 1.0
- t.column_configure(0, :text=>'Delete', :textpadx=>pad, :tag=>'delete')
- t.column_configure(1, :text=>'Bounce', :textpadx=>pad, :tag=>'bounce')
- t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad,
- :tag=>'status')
- t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad,
- :justify=>:right, :tag=>'size')
- t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad,
- :tag=>'from')
- t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad,
- :tag=>'subject')
- t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up,
- :arrowpad=>[4,0], :tag=>'received')
- t.column_configure(7, :text=>'Attachments', :textpadx=>pad,
- :tag=>'attachments')
-
- t.element_create('imgOff', :image, :image=>@images['unchecked'])
- t.element_create('imgOn', :image, :image=>@images['checked'])
- end
-
- t.element_create('border', :rect, :open=>:nw, :outline=>'gray',
- :outlinewidth=>1, :fill=>[@SystemHighlight, ['selected']])
- t.element_create('txtAny', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected']])
- t.element_create('txtNone', :text, :text=>'none', :lines=>1,
- :fill=>[@SystemHighlightText, ['selected']])
- t.element_create('txtYes', :text, :text=>'yes', :lines=>1,
- :fill=>[@SystemHighlightText, ['selected']])
- t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1,
- :fill=>[@SystemHighlightText, ['selected'], '#006800', []])
- t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1,
- :fill=>[@SystemHighlightText, ['selected'], '#787800', []])
- t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1,
- :fill=>[@SystemHighlightText, ['selected'], '#FF9000', []])
- t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1,
- :fill=>[@SystemHighlightText, ['selected'], '#FF5800', []])
-
- if $Version_1_1_OrLater
- s = t.style_create('styCheck')
- t.style_elements(s, ['border', 'imgCheck'])
- t.style_layout(s, 'border', :detach=>true, :iexpand=>:es)
- t.style_layout(s, 'imgCheck', :expand=>:news)
- else
- ['Off', 'On'].each{|name|
- s = t.style_create('sty' << name)
- i = 'img' << name
- t.style_elements(s, ['border', i])
- t.style_layout(s, 'border', :detach=>true, :iexpand=>:es)
- t.style_layout(s, i, :expand=>:news)
- }
- end
-
- pad = 4
-
- %w(Any None Yes Normal PossSpam ProbSpam Blacklist).each{|name|
- s = t.style_create('sty' << name)
- e = 'txt' << name
- t.style_elements(s, ['border', e])
- t.style_layout(s, 'border', :detach=>true, :iexpand=>:es)
- t.style_layout(s, e, :padx=>pad, :squeeze=>:x, :expand=>:ns)
- }
-
- [
- ['baldy@spammer.com', "Your hair is thinning"],
- ['flat@spammer.com', "Your breasts are too small"],
- ['tiny@spammer.com', "Your penis is too small"],
- ['dumbass@spammer.com', "You are not very smart"],
- ['bankrobber@spammer.com', "You need more money"],
- ['loser@spammer.com', "You need better friends"],
- ['gossip@spammer.com', "Find out what your coworkers think about you"],
- ['whoami@spammer.com', "Find out what you think about yourself"],
- ['downsized@spammer.com', "You need a better job"],
- ['poorhouse@spammer.com', "Your mortgage is a joke"],
- ['spam4ever@spammer.com', "You need more spam"]
- ].each{|frm, subj|
- item = t.item_create
- status = ['styNormal','styPossSpam','styProbSpam','styBlacklist'][rand(4)]
- attachments = ['styNone','styYes'][rand(2)]
-
- if $Version_1_1_OrLater
- delete = [false, true][rand(2)]
- bounce = [false, true][rand(2)]
- t.item_style_set(item,
- 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny',
- 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments)
- t.item_state_forcolumn(item, 'delete', 'CHECK') if delete
- t.item_state_forcolumn(item, 'bounce', 'CHECK') if bounce
-
- else # TreeCtrl 1.0
- delete = ['styOn', 'styOff'][rand(2)]
- bounce = ['styOn', 'styOff'][rand(2)]
- t.item_style_set(item,
- 0, delete, 1, bounce, 2, status, 3, 'styAny',
- 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments)
- end
-
- bytes = 512 + rand(1024 * 12)
- size = "#{bytes / 1024 + 1}KB"
- seconds = Tk::Clock.seconds - rand(100000)
- received = Tk::Clock.format(seconds, '%d/%m/%y %I:%M %p')
- t.item_text(item, 3, size, 4, frm, 5, subj, 6, received)
- t.item_lastchild(:root, item)
- }
-
- sortColumn = 6
- t.notify_bind(t, 'Header-invoke',
- proc{|c, w|
- if c == sortColumn
- if w.column_cget(sortColumn, :arrow) == 'down'
- order = :increasing
- arrow = :up
- else
- order = :decreasing
- arrow = :down
- end
- else
- if w.column_cget(sortColumn, :arrow) == 'down'
- order = :decreasing
- arrow = :down
- else
- order = :increasing
- arrow = :up
- end
- w.column_configure(sortColumn, :arrow=>:none)
- sortColumn = c
- end
- w.column_configure(c, :arrow=>arrow)
- case w.column_cget(c, :tag)
- when 'bounce', 'delete'
- w.item_sort(:root, order,
- {
- :column=>c,
- :command=>proc{|item1, item2|
- compareOnOff(w, c, item1, item2)
- }
- },
- { :column=>'subject', :dictionary=>true })
- when 'status'
- w.item_sort(:root, order,
- { :column=>c, :dictionary=>true })
- when 'from'
- w.item_sort(:root, order,
- { :column=>c, :dictionary=>true },
- { :column=>'subject', :dictionary=>true })
- when 'subject'
- w.item_sort(:root, order,
- { :column=>c, :dictionary=>true })
- when 'size'
- w.item_sort(:root, order,
- { :column=>c, :dictionary=>true },
- { :column=>'subject', :dictionary=>true })
- when 'received'
- w.item_sort(:root, order,
- { :column=>c, :dictionary=>true },
- { :column=>'subject', :dictionary=>true })
- when 'attachments'
- w.item_sort(:root, order,
- { :column=>c, :dictionary=>true },
- { :column=>'subject', :dictionary=>true })
- end
- }, '%C %T')
-
- mailWasher = TkBindTag.new
-
- if $Version_1_1_OrLater
- mailWasher.bind('ButtonPress-1',
- proc{|w, x, y|
- id = w.identify(x, y)
- if id.empty?
- elsif id[0] == 'header'
- else
- what, item, where, arg1, arg2, arg3 = id
- if where == 'column'
- tag = w.column_cget(arg1, :tag)
- if tag == 'delete' || tag == 'bounce'
- w.item_state_forcolumn(item, arg1, '~CHECK')
- end
- end
- end
- }, '%W %x %y')
- else # TreeCtrl 1.0
- mailWasher.bind('ButtonPress-1',
- proc{|w, x, y|
- id = w.identify(x, y)
- if id.empty?
- elsif id[0] == 'header'
- else
- what, item, where, arg1, arg2, arg3 = id
- if where == 'column'
- tag = w.column_cget(arg1, :tag)
- if tag == 'delete' || tag == 'bounce'
- style = w.item_style_set(item, arg1)
- if style == 'styOn'
- style = 'styOff'
- else
- style = 'styOn'
- end
- w.item_style_set(item, arg1, style)
- @display_styles_in_item.call(item)
- end
- end
- end
- }, '%W %x %y')
- end
-
- t.bindtags = [t, mailWasher, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL]
-end
-
-if $Version_1_1_OrLater
- def compareOnOff(w, c, item1, item2)
- s1 = w.item_state_forcolumn(item1, c)
- s2 = w.item_state_forcolumn(item2, c)
- if (s1 == s2)
- 0
- elsif (s1 == 'CHECK')
- -1
- else
- 1
- end
- end
-
-else # TreeCtrl 1.0
- def compareOnOff(w, c, item1, item2)
- s1 = w.item_style_set(item1, c)
- s2 = w.item_style_set(item2, c)
- if (s1 == s2)
- 0
- elsif (s1 == 'styOff')
- -1
- else
- 1
- end
- end
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb
deleted file mode 100644
index c3af86868e..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb
+++ /dev/null
@@ -1,124 +0,0 @@
-#
-# Demo: Outlook Express folder list
-#
-def demoOutlookFolders(t)
- init_pics('outlook-*')
-
- height = t.font.metrics(:linespace) + 2
- height = 18 if height < 18
-
- t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true,
- :showroot=>true, :showrootbutton=>false, :showbuttons=>true)
-
- if $HasColumnCreate
- t.column_create(:text=>'Folders')
- else
- t.column_configure(0, :text=>'Folders')
- end
-
- t.element_create('e1', :image)
- t.element_create('e2', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold),
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('e4', :text, :fill=>'blue')
- t.element_create('e5', :image, :image=>@images['outlook-folder'])
- t.element_create('e6', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
-
- # image + text
- s = t.style_create('s1')
- t.style_elements(s, ['e6', 'e1', 'e2'])
- t.style_layout(s, 'e1', :expand=>:ns)
- t.style_layout(s, 'e2', :padx=>[4,0], :expand=>:ns, :squeeze=>:x)
- t.style_layout(s, 'e6', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)
-
- # image + text + text
- s = t.style_create('s2')
- t.style_elements(s, ['e6', 'e1', 'e3', 'e4'])
- t.style_layout(s, 'e1', :expand=>:ns)
- t.style_layout(s, 'e3', :padx=>4, :expand=>:ns, :squeeze=>:x)
- t.style_layout(s, 'e4', :expand=>:ns)
- t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- # folder + text
- s = t.style_create('s3')
- t.style_elements(s, ['e6', 'e5', 'e2'])
- t.style_layout(s, 'e5', :expand=>:ns)
- t.style_layout(s, 'e2', :padx=>[4,0], :expand=>:ns, :squeeze=>:x)
- t.style_layout(s, 'e6', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)
-
- # folder + text + text
- s = t.style_create('s4')
- t.style_elements(s, ['e6', 'e5', 'e3', 'e4'])
- t.style_layout(s, 'e5', :expand=>:ns)
- t.style_layout(s, 'e3', :padx=>4, :expand=>:ns, :squeeze=>:x)
- t.style_layout(s, 'e4', :expand=>:ns)
- t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- t.item_style_set(:root, 0, 's1')
- t.item_complex(:root,
- [
- ['e1', {:image=>@images['outlook-main']}],
- ['e2', {:text=>'Outlook Express'}]
- ])
-
- parentList = [:root, '', '', '', '', '', '']
- parent = :root
- [
- [0, :local, "Local Folders", true, 0],
- [1, :inbox, 'Inbox', false, 5],
- [1, :outbox, 'Outbox', false, 0],
- [1, :sent, "Sent Items", false, 0],
- [1, :deleted, "Deleted Items", false, 50],
- [1, :draft, 'Drafts', false, 0],
- [1, :folder, "Messages to Dad", false, 0],
- [1, :folder, "Messages to Sis", false, 0],
- [1, :folder, "Messages to Me", false, 0],
- [2, :folder, "2001", false, 0],
- [2, :folder, "2000", false, 0],
- [2, :folder, "1999", false, 0],
- [0, :server, "news.gmane.org", true, 0],
- [1, :group, "gmane.comp.lang.lua.general", false, 498]
- ].each{|depth, img, text, button, unread|
- if $Version_1_1_OrLater
- item = t.item_create(:button=>button)
- else
- item = t.item_create
- t.item_hasbutton(item, button)
- end
- if img == :folder
- if unread != 0
- t.item_style_set(item, 0, 's4')
- t.item_complex(item,
- [['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}]])
- else
- t.item_style_set(item, 0, 's3')
- t.item_complex(item, [['e2', {:text=>text}]])
- end
- else
- if unread != 0
- t.item_style_set(item, 0, 's2')
- t.item_complex(item,
- [
- ['e1', {:image=>@images["outlook-#{img}"]}],
- ['e3', {:text=>text}],
- ['e4', {:text=>"(#{unread})"}]
- ])
- else
- t.item_style_set(item, 0, 's1')
- t.item_complex(item,
- [
- ['e1', {:image=>@images["outlook-#{img}"]}],
- ['e2', {:text=>text}]
- ])
- end
- end
- t.item_lastchild(parentList[depth], item)
- depth += 1
- parentList[depth] = item
- }
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb
deleted file mode 100644
index d7e7f7e004..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb
+++ /dev/null
@@ -1,448 +0,0 @@
-#
-# Demo: Outlook Express newsgroup messages
-#
-def demoOutlookNewsgroup(t)
- init_pics('outlook-*')
-
- height = t.font.metrics(:linespace)
- height = 18 if height < 18
- t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,
- :showroot=>false, :showrootbutton=>false, :showbuttons=>true)
-
- if $Version_1_1_OrLater
- t.column_create(:image=>@images['outlook-clip'], :tag=>'clip')
- t.column_create(:image=>@images['outlook-arrow'], :tag=>'arrow')
- t.column_create(:image=>@images['outlook-watch'], :tag=>'watch')
- t.column_create(:text=>'Subject', :width=>250, :tag=>'subject')
- t.column_create(:text=>'From', :width=>150, :tag=>'from')
- t.column_create(:text=>'Sent', :width=>150, :tag=>'sent')
- t.column_create(:text=>'Size', :width=>60, :justify=>:right, :tag=>'size')
- else # TreeCtrl 1.0
- t.column_configure(0, :image=>@images['outlook-clip'], :tag=>'clip')
- t.column_configure(1, :image=>@images['outlook-arrow'], :tag=>'arrow')
- t.column_configure(2, :image=>@images['outlook-watch'], :tag=>'watch')
- t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject')
- t.column_configure(4, :text=>'From', :width=>150, :tag=>'from')
- t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent')
- t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,
- :tag=>'size')
- end
-
- # Would be nice if I could specify a column -tag too
- t.treecolumn = 3
-
- # State for a read message
- t.state_define('read')
-
- # State for a message with unread descendants
- t.state_define('unread')
-
- t.element_create('elemImg', :image,
- :image=>[
- @sel_images['outlook-read-2'],
- ['selected', 'read', 'unread', '!open'],
- @images['outlook-read-2'], ['read', 'unread', '!open'],
- @sel_images['outlook-read'], ['selected', 'read'],
- @images['outlook-read'], ['read'],
- @sel_images['outlook-unread'], ['selected'],
- @images['outlook-unread'], []
- ])
- t.element_create('elemTxt', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected', 'focus']],
- :font=>[
- t.font.dup.weight(:bold), ['read', 'unread', '!open'],
- t.font.dup.weight(:bold), ['!read']
- ])
- t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
- t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
- t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
-
- # Image + text
- s = t.style_create('s1')
- t.style_elements(s, ['sel.e', 'elemImg', 'elemTxt'])
- t.style_layout(s, 'elemImg', :expand=>:ns)
- t.style_layout(s, 'elemTxt', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.e', :union=>['elemTxt'],
- :iexpand=>:nes, :ipadx=>[2,0])
-
- # Text
- s = t.style_create('s2.we')
- t.style_elements(s, ['sel.we', 'elemTxt'])
- t.style_layout(s, 'elemTxt', :padx=>6, :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es)
-
- # Text
- s = t.style_create('s2.w')
- t.style_elements(s, ['sel.w', 'elemTxt'])
- t.style_layout(s, 'elemTxt', :padx=>6, :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es)
-
- # Set default item style
- if $Version_1_1_OrLater
- t.defaultstyle = ['', '', '', 's1', 's2.we', 's2.we', 's2.w']
- end
-
- msgCnt = 100
- thread = 0
-
- @Message = Hash.new{|k, v| k[v] = Hash.new}
- @Message[:count][0] = 0
-
- items = [t.index(:root)]
-
- (1...(msgCnt)).each{|i|
- item_i = t.item_create
- item_j = nil
- j = nil
- loop {
- j = rand(i)
- item_j = items[j]
- break if j == 0
- next if t.depth(item_j) == 5
- next if @Message[:count][@Message[:thread][item_j]] == 15
- break
- }
- t.item_lastchild(item_j, item_i)
-
- @Message[:read][item_i] = (rand(2) == 0)
- if j == 0
- thread += 1
- @Message[:thread][item_i] = thread
- @Message[:seconds][item_i] = (Tk::Clock.seconds - rand(500000))
- @Message[:seconds2][item_i] = @Message[:seconds][item_i]
- @Message[:count][thread] = 1
- else
- @Message[:thread][item_i] = @Message[:thread][item_j]
- @Message[:seconds][item_i] = (@Message[:seconds2][item_j] + rand(10000))
- @Message[:seconds2][item_i] = @Message[:seconds][item_i]
- @Message[:seconds2][item_j] = @Message[:seconds][item_i]
- @Message[:count][@Message[:thread][item_j]] += 1
- end
- items << item_i
- }
-
- (1...(msgCnt)).each{|i|
- item_i = items[i]
- subject = "This is thread number #{@Message[:thread][item_i]}"
- from = 'somebody@somewhere.net'
- sent = Tk::Clock.format(@Message[:seconds][item_i], "%d/%m/%y %I:%M %p")
- size = "#{1 + rand(10)}KB"
-
- # This message has been read
- t.item_state_set(item_i, 'read') if @Message[:read][item_i]
-
- # This message has unread descendants
- t.item_state_set(item_i, 'unread') if anyUnreadDescendants(t, item_i)
-
- if t.item_numchildren(item_i) > 0
- if $Version_1_1_OrLater
- t.item_configure(item_i, :button=>true)
- else # TreeCtrl 1.0
- t.item_hasbutton(item_i, true)
- end
-
- # Collapse some messages
- if $Version_1_1_OrLater
- t.item_collapse(item_i) if rand(2) == 0
- else # TreeCtrl 1.0
- t.collapse(item_i) if rand(2) == 0
- end
- end
-
- unless $Version_1_1_OrLater
- t.item_style_set(item_i, 3, 's1', 4, 's2.we', 5, 's2.we', 6, 's2.w')
- end
- t.item_text(item_i, 3, subject, 4, from, 5, sent, 6, size)
- }
-
- # Do something when the selection changes
- t.notify_bind(t, 'Selection',
- proc{|w|
- if w.selection_count == 1
- # One item is selected
- if @Message[:afterId][:id]
- Tk.after_cancel(@Message[:afterId][:id])
- end
- @Message[:afterId][:item] = w.selection_get[0]
- @Message[:afterId][:id] = Tk.after(500, proc{
- messageReadDelayed(w)
- })
- end
- }, '%T')
-end
-
-def messageReadDelayed(t)
- @Message[:afterId].delete(:id)
- i = @Message[:afterId][:item]
- return unless t.selection_includes(i)
-
- # This message is not read
- unless @Message[:read][i]
- # Read the message
- t.item_state_set(i, 'read')
- @Message[:read][i] = true
-
- # Check ancestors (except root)
- t.item_ancestors(i)[0..-2].each{|i2|
- # This ancestor has no more unread descendants
- t.item_state_set(i2, '!unread') unless anyUnreadDescendants(t, i2)
- }
- end
-end
-
-# Alternate implementation which does not rely on run-time states
-def demoOutlookNewsgroup2(t)
- init_pics('outlook-*')
-
- height = t.font.metrics(:linespace)
- height = 18 if height < 18
- t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,
- :showroot=>false, :showrootbutton=>false, :showbuttons=>true)
-
- if $Version_1_1_OrLater
- t.column_create(:image=>@images['outlook-clip'], :tag=>'clip')
- t.column_create(:image=>@images['outlook-arrow'], :tag=>'arrow')
- t.column_create(:image=>@images['outlook-watch'], :tag=>'watch')
- t.column_create(:text=>'Subject', :width=>250, :tag=>'subject')
- t.column_create(:text=>'From', :width=>150, :tag=>'from')
- t.column_create(:text=>'Sent', :width=>150, :tag=>'sent')
- t.column_create(:text=>'Size', :width=>60, :justify=>:right, :tag=>'size')
- else # TreeCtrl 1.0
- t.column_configure(0, :image=>@images['outlook-clip'], :tag=>'clip')
- t.column_configure(1, :image=>@images['outlook-arrow'], :tag=>'arrow')
- t.column_configure(2, :image=>@images['outlook-watch'], :tag=>'watch')
- t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject')
- t.column_configure(4, :text=>'From', :width=>150, :tag=>'from')
- t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent')
- t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,
- :tag=>'size')
- end
-
- t.treecolumn = 3
-
- t.element_create('image.unread', :image, :image=>@images['outlook-unread'])
- t.element_create('image.read', :image, :image=>@images['outlook-read'])
- t.element_create('image.read2', :image, :image=>@images['outlook-read-2'])
- t.element_create('text.read', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('text.unread', :text, :lines=>1,
- :fill=>[@SystemHighlightText, ['selected', 'focus']],
- :font=>t.font.dup.weight(:bold))
- t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
- t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
- t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
-
- # Image + text
- s = t.style_create('unread')
- t.style_elements(s, ['sel.e', 'image.unread', 'text.unread'])
- t.style_layout(s, 'image.unread', :expand=>:ns)
- t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.e', :union=>['text.unread'],
- :iexpand=>:nes, :ipadx=>[2,0])
-
- # Image + text
- s = t.style_create('read')
- t.style_elements(s, ['sel.e', 'image.read', 'text.read'])
- t.style_layout(s, 'image.read', :expand=>:ns)
- t.style_layout(s, 'text.read', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.e', :union=>['text.read'],
- :iexpand=>:nes, :ipadx=>[2,0])
-
- # Image + text
- s = t.style_create('read2')
- t.style_elements(s, ['sel.e', 'image.read2', 'text.unread'])
- t.style_layout(s, 'image.read2', :expand=>:ns)
- t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.e', :union=>['text.unread'],
- :iexpand=>:nes, :ipadx=>[2,0])
-
- # Text
- s = t.style_create('unread.we')
- t.style_elements(s, ['sel.we', 'text.unread'])
- t.style_layout(s, 'text.unread', :padx=>6, :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es)
-
- # Text
- s = t.style_create('read.we')
- t.style_elements(s, ['sel.we', 'text.read'])
- t.style_layout(s, 'text.read', :padx=>6, :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es)
-
- # Text
- s = t.style_create('unread.w')
- t.style_elements(s, ['sel.w', 'text.unread'])
- t.style_layout(s, 'text.unread', :padx=>6, :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es)
-
- # Text
- s = t.style_create('read.w')
- t.style_elements(s, ['sel.w', 'text.read'])
- t.style_layout(s, 'text.read', :padx=>6, :squeeze=>:x, :expand=>:ns)
- t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es)
-
- msgCnt = 100
- thread = 0
-
- @Message = Hash.new{|k, v| k[v] = Hash.new}
- @Message[:count][0] = 0
-
- (1...(msgCnt)).each{|i|
- t.item_create
- j = nil
- loop {
- j = rand(i)
- break if j == 0
- next if t.depth(j) == 5
- next if @Message[:count][@Message[:thread][j]] == 15
- break
- }
- t.item_lastchild(j, i)
-
- @Message[:read][i] = (rand(2) == 0)
- if j == 0
- thread += 1
- @Message[:thread][i] = thread
- @Message[:seconds][i] = (Tk::Clock.seconds - rand(500000))
- @Message[:seconds2][i] = @Message[:seconds][i]
- @Message[:count][thread] = 1
- else
- @Message[:thread][i] = @Message[:thread][j]
- @Message[:seconds][i] = (@Message[:seconds2][j] + rand(10000))
- @Message[:seconds2][i] = @Message[:seconds][i]
- @Message[:seconds2][j] = @Message[:seconds][i]
- @Message[:count][@Message[:thread][j]] += 1
- end
- }
-
- (1...(msgCnt)).each{|i|
- subject = "This is thread number #{@Message[:thread][i]}"
- from = 'somebody@somewhere.net'
- sent = Tk::Clock.format(@Message[:seconds][i], "%d/%m/%y %I:%M %p")
- size = "#{1 + rand(10)}KB"
- if @Message[:read][i]
- style = 'read'
- style2 = 'read2'
- else
- style = 'unread'
- style2 = 'unread2'
- end
- t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we",
- 6, "#{style2}.w")
- t.item_text(i, 3, subject, 4, from, 5, sent, 6, size)
- if t.item_numchildren(i) > 0
- t.item_configure(item_i, :button=>true)
- end
- }
-
- # Do something when the selection changes
- t.notify_bind(t, 'Selection',
- proc{|w|
- if w.selection_count == 1
- i = t.selection_get[0]
- unless @Message[:read][i]
- if t.item_isopen(i) || !anyUnreadDescendants(t, i)
- # unread -> read
- t.item_style_map(i, 'subject', 'read',
- ['text.unread', 'text.read'])
- t.item_style_map(i, 'from', 'read.we',
- ['text.unread', 'text.read'])
- t.item_style_map(i, 'sent', 'read.we',
- ['text.unread', 'text.read'])
- t.item_style_map(i, 'size', 'read.w',
- ['text.unread', 'text.read'])
- else
- # unread -> read2
- t.item_style_map(i, 'subject', 'read2',
- ['text.unread', 'text.unread'])
- end
-
- @Message[:read][i] = true
- @display_styles_in_item.call(i)
- end
- end
- }, '%T')
-
- t.notify_bind(t, 'Expand-after',
- proc{|w, i|
- if @Messge[:read][i] && anyUnreadDescendants(t, i)
- # read2 -> read
- t.item_style_map(i, 'subject', 'read',
- ['text.unread', 'text.read'])
- # unread -> read
- t.item_style_map(i, 'from', 'read.we',
- ['text.unread', 'text.read'])
- t.item_style_map(i, 'sent', 'read.we',
- ['text.unread', 'text.read'])
- t.item_style_map(i, 'size', 'read.w',
- ['text.unread', 'text.read'])
- end
- }, '%T %I')
-
- t.notify_bind(t, 'Collapse-after',
- proc{|w, i|
- if @Messge[:read][i] && anyUnreadDescendants(t, i)
- # read -> read2
- t.item_style_map(i, 'subject', 'read2',
- ['text.read', 'text.unread'])
- # read -> unread
- t.item_style_map(i, 'from', 'unread.we',
- ['text.read', 'text.unread'])
- t.item_style_map(i, 'sent', 'unread.we',
- ['text.read', 'text.unread'])
- t.item_style_map(i, 'size', 'unread.w',
- ['text.read', 'text.unread'])
- end
- }, '%T %I')
-
- (1...(msgCnt)).each{|i|
- if rand(2) == 0
- if t.item_numchildren(i) > 0
- if $Version_1_1_OrLater
- t.item_collapse(i)
- else # TreeCtrl 1.0
- t.collapse(i)
- end
- end
- end
- }
-end
-
-def anyUnreadDescendants(t, i)
- itemList = []
- item = t.item_firstchild(i)
- itemList.push(item) if item != ''
-
- while item = itemList.pop
- return true unless @Message[:read][item]
-
- item2 = t.item_nextsibling(item)
- itemList.push(item2) if item2 != ''
- item2 = t.item_firstchild(item)
- itemList.push(item2) if item2 != ''
- end
- false
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/big-dll.gif b/ext/tk/sample/tkextlib/treectrl/pics/big-dll.gif
deleted file mode 100644
index 09170c0e26..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/big-dll.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/big-exe.gif b/ext/tk/sample/tkextlib/treectrl/pics/big-exe.gif
deleted file mode 100644
index e19aac1a2d..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/big-exe.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/big-file.gif b/ext/tk/sample/tkextlib/treectrl/pics/big-file.gif
deleted file mode 100644
index 6c752312a3..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/big-file.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/big-folder.gif b/ext/tk/sample/tkextlib/treectrl/pics/big-folder.gif
deleted file mode 100644
index 186c9749fd..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/big-folder.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/big-txt.gif b/ext/tk/sample/tkextlib/treectrl/pics/big-txt.gif
deleted file mode 100644
index a93492586e..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/big-txt.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/checked.gif b/ext/tk/sample/tkextlib/treectrl/pics/checked.gif
deleted file mode 100644
index 3b9b176ab3..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/checked.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/file.gif b/ext/tk/sample/tkextlib/treectrl/pics/file.gif
deleted file mode 100644
index a64c2a06bd..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/file.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/folder-closed.gif b/ext/tk/sample/tkextlib/treectrl/pics/folder-closed.gif
deleted file mode 100644
index 0a064376c9..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/folder-closed.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/folder-open.gif b/ext/tk/sample/tkextlib/treectrl/pics/folder-open.gif
deleted file mode 100644
index 3fac27ffd9..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/folder-open.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/help-book-closed.gif b/ext/tk/sample/tkextlib/treectrl/pics/help-book-closed.gif
deleted file mode 100644
index 0a0497bfa3..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/help-book-closed.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/help-book-open.gif b/ext/tk/sample/tkextlib/treectrl/pics/help-book-open.gif
deleted file mode 100644
index 40656c5194..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/help-book-open.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/help-page.gif b/ext/tk/sample/tkextlib/treectrl/pics/help-page.gif
deleted file mode 100644
index e1ce1d72f5..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/help-page.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-01.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-01.gif
deleted file mode 100644
index 5fd9215551..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-01.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-02.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-02.gif
deleted file mode 100644
index 3d2d1c17c2..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-02.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-03.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-03.gif
deleted file mode 100644
index 9fccf12b51..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-03.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-04.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-04.gif
deleted file mode 100644
index eff851c9bb..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-04.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-05.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-05.gif
deleted file mode 100644
index ad00c827f6..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-05.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-06.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-06.gif
deleted file mode 100644
index 238bf162ac..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-06.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/imovie-07.gif b/ext/tk/sample/tkextlib/treectrl/pics/imovie-07.gif
deleted file mode 100644
index a9287e1b1c..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/imovie-07.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-check-off.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-check-off.gif
deleted file mode 100644
index e64866a394..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-check-off.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-check-on.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-check-on.gif
deleted file mode 100644
index cf652beff2..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-check-on.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-print.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-print.gif
deleted file mode 100644
index 7ac25b10e9..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-print.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-radio-off.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-radio-off.gif
deleted file mode 100644
index 90ef62971f..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-radio-off.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-radio-on.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-radio-on.gif
deleted file mode 100644
index 9de742c198..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-radio-on.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-search.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-search.gif
deleted file mode 100644
index 1f9a047701..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-search.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/internet-security.gif b/ext/tk/sample/tkextlib/treectrl/pics/internet-security.gif
deleted file mode 100644
index 86d3943786..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/internet-security.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/mac-collapse.gif b/ext/tk/sample/tkextlib/treectrl/pics/mac-collapse.gif
deleted file mode 100644
index 81302c80c1..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/mac-collapse.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/mac-expand.gif b/ext/tk/sample/tkextlib/treectrl/pics/mac-expand.gif
deleted file mode 100644
index 0a2cd80040..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/mac-expand.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-arrow.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-arrow.gif
deleted file mode 100644
index b1c2afd426..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-arrow.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-clip.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-clip.gif
deleted file mode 100644
index 8578132702..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-clip.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-deleted.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-deleted.gif
deleted file mode 100644
index 7cc8369b4b..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-deleted.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-draft.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-draft.gif
deleted file mode 100644
index f19585050f..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-draft.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-folder.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-folder.gif
deleted file mode 100644
index b3f733563b..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-folder.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-group.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-group.gif
deleted file mode 100644
index 29ad9b466e..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-group.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-inbox.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-inbox.gif
deleted file mode 100644
index f41d804444..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-inbox.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-local.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-local.gif
deleted file mode 100644
index 0c74970d32..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-local.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-main.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-main.gif
deleted file mode 100644
index 92325fa85f..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-main.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-outbox.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-outbox.gif
deleted file mode 100644
index c7e80527a0..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-outbox.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-read-2.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-read-2.gif
deleted file mode 100644
index 2f15a3af05..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-read-2.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-read.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-read.gif
deleted file mode 100644
index a6f956207a..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-read.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-sent.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-sent.gif
deleted file mode 100644
index 963b56c4c9..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-sent.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-server.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-server.gif
deleted file mode 100644
index c950845d62..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-server.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-unread.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-unread.gif
deleted file mode 100644
index 3df4b99439..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-unread.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/outlook-watch.gif b/ext/tk/sample/tkextlib/treectrl/pics/outlook-watch.gif
deleted file mode 100644
index 87ec861312..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/outlook-watch.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/sky.gif b/ext/tk/sample/tkextlib/treectrl/pics/sky.gif
deleted file mode 100644
index b7fbf14a0a..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/sky.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/small-dll.gif b/ext/tk/sample/tkextlib/treectrl/pics/small-dll.gif
deleted file mode 100644
index d8875ec23f..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/small-dll.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/small-exe.gif b/ext/tk/sample/tkextlib/treectrl/pics/small-exe.gif
deleted file mode 100644
index 69d30beacd..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/small-exe.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/small-file.gif b/ext/tk/sample/tkextlib/treectrl/pics/small-file.gif
deleted file mode 100644
index f340662879..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/small-file.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/small-folder.gif b/ext/tk/sample/tkextlib/treectrl/pics/small-folder.gif
deleted file mode 100644
index ad1b24da84..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/small-folder.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/small-txt.gif b/ext/tk/sample/tkextlib/treectrl/pics/small-txt.gif
deleted file mode 100644
index cdc7cbfe99..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/small-txt.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/pics/unchecked.gif b/ext/tk/sample/tkextlib/treectrl/pics/unchecked.gif
deleted file mode 100644
index 833e48268b..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/pics/unchecked.gif
+++ /dev/null
Binary files differ
diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb
deleted file mode 100644
index 2c9e614aa5..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/random.rb
+++ /dev/null
@@ -1,508 +0,0 @@
-#
-def random_N
- @RandomN[0] || 500
-end
-
-#
-# Demo: random N items
-#
-def demoRandom(t)
- init_pics('folder-*', 'small-*')
-
- height = t.font.metrics(:linespace)
- height = 18 if height < 18
- t.configure(:itemheight=>height, :selectmode=>:extended,
- :showroot=>true, :showrootbutton=>true, :showbuttons=>true,
- :showlines=>true, :scrollmargin=>16,
- :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50])
-
- if $Version_1_1_OrLater
- t.column_create(:expand=>true, :text=>'Item',
- :itembackground=>['#e0e8f0', []], :tag=>'item')
- t.column_create(:text=>'Parent', :justify=>:center,
- :itembackground=>['gray90', []], :tag=>'parent')
- t.column_create(:text=>'Depth', :justify=>:center,
- :itembackground=>['linen', []], :tag=>'depth')
- else # TreeCtrl 1.0
- t.column_configure(0, :expand=>true, :text=>'Item',
- :itembackground=>['#e0e8f0', []], :tag=>'item')
- t.column_configure(1, :text=>'Parent', :justify=>:center,
- :itembackground=>['gray90', []], :tag=>'parent')
- t.column_configure(2, :text=>'Depth', :justify=>:center,
- :itembackground=>['linen', []], :tag=>'depth')
- end
-
- t.element_create('e1', :image, :image=>[
- @images['folder-open'], ['open'],
- @images['folder-closed'], []
- ])
- t.element_create('e2', :image, :image=>@images['small-file'])
- t.element_create('e3', :text,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('e4', :text, :fill=>'blue')
- t.element_create('e6', :text)
- t.element_create('e5', :rect, :showfocus=>true,
- :fill=>[
- @SystemHighlight, ['selected', 'focus'],
- 'gray', ['selected', '!focus']
- ])
-
- s = t.style_create('s1')
- t.style_elements(s, ['e5', 'e1', 'e3', 'e4'])
- t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e3', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e4', :padx=>[0,6], :expand=>:ns)
- t.style_layout(s, 'e5', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- s = t.style_create('s2')
- t.style_elements(s, ['e5', 'e2', 'e3'])
- t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e3', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e5', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)
-
- s = t.style_create('s3')
- t.style_elements(s, ['e6'])
- t.style_layout(s, 'e6', :padx=>6, :expand=>:ns)
-
- @Priv[:sensitive, t] = [
- [:item, 's1', 'e5', 'e1', 'e3'],
- [:item, 's2', 'e5', 'e2', 'e3']
- ]
- @Priv[:dragimage, t] = [
- [:item, 's1', 'e1', 'e3'],
- [:item, 's2', 'e2', 'e3']
- ]
-
- clicks = Tk::Clock.clicks
- items = [ t.index(:root) ]
- (1...(random_N())).each{|i|
- item_i = t.item_create
- item_j = nil
- loop {
- j = rand(i)
- item_j = items[j]
- break if t.depth(item_j) < 5
- }
- if $Version_1_1_OrLater
- t.item_collapse(item_i) if rand(2) == 0
- else # TreeCtrl 1.0
- t.collapse(item_i) if rand(2) == 0
- end
- if rand(2) == 0
- t.item_lastchild(item_j, item_i)
- else
- t.item_firstchild(item_j, item_i)
- end
- items << item_i
- }
- puts "created #{random_N() - 1} items in #{Tk::Clock.clicks - clicks} clicks"
-
- clicks = Tk::Clock.clicks
- (0...(random_N())).each{|i|
- item_i = items[i]
- numChildren = t.item_numchildren(item_i)
- if numChildren > 0
- if $Version_1_1_OrLater
- t.item_configure(item_i, :button=>true)
- else # TreeCtrl 1.0
- t.item_hasbutton(item_i, true)
- end
- t.item_style_set(item_i, 0, 's1', 1, 's3', 2, 's3')
- t.item_complex(item_i,
- [ ['e3', {:text=>"Item #{i}"}],
- ['e4', {:text=>"(#{numChildren})"}] ],
- [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ],
- [ ['e6', {:text=>"#{t.depth(item_i)}"}] ])
- else
- t.item_style_set(item_i, 1, 's3', 2, 's3', 0, 's2')
- t.item_complex(item_i,
- [ ['e3', {:text=>"Item #{i}"}] ],
- [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ],
- [ ['e6', {:text=>"#{t.depth(item_i)}"}] ])
- end
- }
- puts "configured #{random_N()} items in #{Tk::Clock.clicks - clicks} clicks"
-
- treeCtrlRandom = TkBindTag.new
-
- treeCtrlRandom.bind('Double-ButtonPress-1',
- proc{|w, x, y|
- Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlRandom.bind('Control-ButtonPress-1',
- proc{|w, x, y|
- @Priv['selectMode'] = :toggle
- randomButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlRandom.bind('Shift-ButtonPress-1',
- proc{|w, x, y|
- @Priv['selectMode'] = :add
- randomButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlRandom.bind('ButtonPress-1',
- proc{|w, x, y|
- @Priv['selectMode'] = :set
- randomButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlRandom.bind('Button1-Motion',
- proc{|w, x, y|
- randomMotion1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlRandom.bind('Button1-Leave',
- proc{|w, x, y|
- randomLeave1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- treeCtrlRandom.bind('ButtonRelease-1',
- proc{|w, x, y|
- randomRelease1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- t.bindtags = [ t, treeCtrlRandom, Tk::TreeCtrl, t.winfo_toplevel, :all ]
-end
-
-def randomButton1(t, x, y)
- t.set_focus
- id = t.identify(x, y)
- puts id.inspect
- @Priv['buttonMode'] = ''
-
- # Click outside any item
- if id.empty?
- t.selection_clear
-
- # Click in header
- elsif id[0] == 'header'
- Tk::TreeCtrl::BindCallback.buttonPress1(t, x, y)
-
- # Click in item
- else
- where, item, arg1, arg2, arg3, arg4 = id
- case arg1
- when 'button'
- if $Version_1_1_OrLater
- t.item_toggle(item)
- else # TreeCtrl 1.0
- t.toggle(item)
- end
-
- when 'line'
- if $Version_1_1_OrLater
- t.item_toggle(arg2)
- else # TreeCtrl 1.0
- t.toggle(arg2)
- end
-
- when 'column'
- ok = false
- # Clicked an element
- if id.length == 6
- column = id[3]
- e = id[5]
- @Priv.list_element(:sensitive, t).each{|lst|
- c, s, *eList = TkComm.simplelist(lst)
- next if column != t.column_index(c)
- next if t.item_style_set(item, c) != s
- next if eList.find{|le| le == e} == nil
- ok = true
- break
- }
- end
- unless ok
- t.selection_clear
- return
- end
-
- @Priv[:drag, :motion] = 0
- @Priv[:drag, :x] = t.canvasx(x)
- @Priv[:drag, :y] = t.canvasy(y)
- @Priv[:drop] = ''
-
- if @Priv['selectMode'] == 'add'
- Tk::TreeCtrl::BindCallback.beginExtend(t, item)
- elsif @Priv['selectMode'] == 'toggle'
- Tk::TreeCtrl::BindCallback.beginToggle(t, item)
- elsif ! t.selection_includes(item)
- Tk::TreeCtrl::BindCallback.beginSelect(t, item)
- end
- t.activate(item)
-
- if t.selection_includes(item)
- @Priv['buttonMode'] = 'drag'
- end
- end
- end
-end
-
-def randomMotion1(t, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.motion1(t, x, y)
- when 'drag'
- randomAutoScanCheck(t, x, y)
- randomMotion(t, x, y)
- end
-end
-
-def randomMotion(t, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.motion1(t, x, y)
-
- when 'drag'
- # Detect initial mouse movement
- unless @Priv.bool_element(:drag, :motion)
- @Priv[:selection] = t.selection_get
- @Priv[:drop] = ''
- t.dragimage_clear
- # For each selected item, add 2nd and 3rd elements of
- # column "item" to the dragimage
- @Priv.list_element(:selection).each{|i|
- @Priv.list_element(:dragimage,t).each{|lst|
- c, s, *eList = TkComm.simplelist(lst)
- if t.item_style_set(i, c) == s
- t.dragimage_add(i, c, *eList)
- end
- }
- }
- @Priv[:drag,:motion] = true
- end
-
- # Find the item under the cursor
- cursor = 'X_cursor'
- drop = ''
- id = t.identify(x, y)
- ok = false
- if !id.empty? && id[0] == 'item' && id.length == 6
- item = id[1]
- column = id[3]
- e = id[5]
- @Priv.list_element(:sensitive,t).each{|lst|
- c, s, *eList = TkComm.simplelist(lst)
- next if column != t.column_index(c)
- next if t.item_style_set(item, c) != s
- next unless eList.find{|val| val.to_s == e.to_s}
- ok = true
- break
- }
- ok = true if @Priv.list_element(:sensitive,t).find{|val| TkComm.simplelist(val).index(e)}
- end
-
- if ok
- # If the item is not in the pre-drag selection
- # (i.e. not being dragged) see if we can drop on it
- unless @Priv.list_element(:selection).find{|val| val.to_s == item.to_s}
- drop = item
- # We can drop if dragged item isn't an ancestor
- @Priv.list_element(:selection).each{|item2|
- if t.item_isancestor(item2, item)
- drop = ''
- break
- end
- }
- if drop != ''
- x1, y1, x2, y2 = t.item_bbox(drop)
- if y < y1 + 3
- cursor = 'top_side'
- @Priv[:drop,:pos] = 'prevsibling'
- elsif y >= y2 - 3
- cursor = 'bottom_side'
- @Priv[:drop,:pos] = 'nextsibling'
- else
- cursor = ''
- @Priv[:drop,:pos] = 'lastchild'
- end
- end
- end
- end
-
- t[:cursor] = cursor if t[:cursor] != cursor
-
- # Select the item under the cursor (if any) and deselect
- # the previous drop-item (if any)
- t.selection_modify(drop, @Priv[:drop])
- @Priv[:drop] = drop
-
- # Show the dragimage in its new position
- x = t.canvasx(x) - @Priv.numeric_element(:drag,:x)
- y = t.canvasx(y) - @Priv.numeric_element(:drag,:y)
- t.dragimage_offset(x, y)
- t.dragimage_configure(:visible=>true)
- end
-end
-
-def randomLeave1(t, x, y)
- # This is called when I do ButtonPress-1 on Unix for some reason,
- # and buttonMode is undefined.
- return unless @Priv.exist?('buttonMode')
- case @Priv['buttonMode']
- when 'header'
- Tk::TreeCtrl::BindCallback.leave1(t, x, y)
- end
-end
-
-def randomRelease1(t, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.release1(t, x, y)
- when 'drag'
- Tk::TreeCtrl::BindCallback.autoScanCancel(t)
- t.dragimage_configure(:visible=>false)
- t.selection_modify('', @Priv[:drop])
- t[:cursor] = ''
- if @Priv[:drop] != ''
- randomDrop(t, @Priv[:drop], @Priv.list_element(:selection),
- @Priv[:drop, :pos])
- end
- end
- @Priv['buttonMode'] = ''
-end
-
-def randomDrop(t, target, src, pos)
- parentList = []
- case pos
- when 'lastchild'
- parent = target
- when 'prevsibling'
- parent = t.item_parent(target)
- when 'nextsibling'
- parent = t.item_parent(target)
- end
- src.each{|item|
- # Ignore any item whose ancestor is also selected
- ignore = false
- t.item_ancestors(item).each{|ancestor|
- if src.find{|val| val.to_s == ancestor.to_s}
- ignore = true
- break
- end
- }
- next if ignore
-
- # Update the old parent of this moved item later
- unless parentList.find{|val| val.to_s == item.to_s}
- parentList << t.item_parent(item)
- end
-
- # Add to target
- t.__send__("item_#{pos}", target, item)
-
- # Update text: parent
- t.item_element_configure(item, 'parent', 'e6', :text=>parent)
-
- # Update text: depth
- t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item))
-
- # Recursively update text: depth
- itemList = []
- item = t.item_firstchild(item)
- itemList << item if item != ''
-
- while item = itemList.pop
- t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item))
-
- item2 = t.item_nextsibling(item)
- itemList << item2 if item2 != ''
-
- item2 = t.item_firstchild(item)
- itemList << item2 if item2 != ''
- end
- }
-
- # Update items that lost some children
- parentList.each{|item|
- numChildren = t.item_numchildren(item)
- if numChildren == 0
- if $Version_1_1_OrLater
- t.item_configure(item, :button=>false)
- else # TreeCtrl 1.0
- t.item_hasbutton(item, false)
- end
- t.item_style_map(item, 'item', 's2', ['e3', 'e3'])
- else
- t.item_element_configure(item, 'item', 'e4', :text=>"(#{numChildren})")
- end
- }
-
- # Update the target that gained some children
- if t.item_style_set(parent, 0) != 's1'
- if $Version_1_1_OrLater
- t.item_configure(parent, :button=>true)
- else # TreeCtrl 1.0
- t.item_hasbutton(parent, true)
- end
- t.item_style_map(parent, 'item', 's1', ['e3', 'e3'])
- end
- numChildren = t.item_numchildren(parent)
- t.item_element_configure(parent, 'item', 'e4', :text=>"(#{numChildren})")
-end
-
-# Same as TreeCtrl::AutoScanCheck, but calls RandomMotion and
-# RandomAutoScanCheckAux
-def randomAutoScanCheck(t, x, y)
- x1, y1, x2, y2 = t.contentbox
- margin = t.winfo_pixels(t.scrollmargin)
- if x < x1 + margin || x >= x2 - margin || y < y1 + margin || y >= y2 - margin
- if ! @Priv.exist?(:autoscan, :afterId, t)
- if y >= y2 - margin
- t.yview(:scroll, 1, :units)
- delay = t.yscrolldelay
- elsif y < y1 + margin
- t.yview(:scroll, -1, :units)
- delay = t.yscrolldelay
- elsif x >= x2 - margin
- t.xview(:scroll, 1, :units)
- delay = t.xscrolldelay
- elsif x < x1 + margin
- t.xview(:scroll, -1, :units)
- delay = t.xscrolldelay
- end
- if @Priv.exist?(:autoscan, :scanning, t)
- delay = delay[1] if delay.kind_of?(Array)
- else
- delay = delay[0] if delay.kind_of?(Array)
- @Priv[:autoscan, :scanning, t] = true
- end
- case @Priv['buttonMode']
- when 'drag', 'marquee'
- randomMotion(t, x, y)
- end
- @Priv[:autoscan, :afterId, t] =
- Tk.after(delay, proc{ randomAutoScanCheckAux(t) })
- end
- return
- end
- Tk::TreeCtrl::BindCallback.autoScanCancel(t)
-end
-
-def randomAutoScanCheckAux(t)
- @Priv.unset(:autoscan, :afterId, t)
- x = t.winfo_pointerx - t.winfo_rootx
- y = t.winfo_pointery - t.winfo_rooty
- randomAutoScanCheck(t, x, y)
-end
-
-#
-# Demo: random N items, button images
-#
-def demoRandom2(t)
- demoRandom(t)
-
- init_pics('mac-*')
-
- t.configure(:openbuttonimage=>@images['mac-collapse'],
- :closedbuttonimage=>@images['mac-expand'],
- :showlines=>false)
-end
diff --git a/ext/tk/sample/tkextlib/treectrl/readme.txt b/ext/tk/sample/tkextlib/treectrl/readme.txt
deleted file mode 100644
index 9f26ac069c..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/readme.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-The scripts and image files in this directory are based on demo files
-of Tcl/Tk's TreeCtrl extention.
diff --git a/ext/tk/sample/tkextlib/treectrl/www-options.rb b/ext/tk/sample/tkextlib/treectrl/www-options.rb
deleted file mode 100644
index efa55ca06c..0000000000
--- a/ext/tk/sample/tkextlib/treectrl/www-options.rb
+++ /dev/null
@@ -1,303 +0,0 @@
-def demoInternetOptions (t)
- @Option = TkVarAccess.new_hash('::Option')
-
- height = t.font.metrics(:linespace) + 2
- height = 18 if height < 18
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :itemheight=>height, :selectmode=>:browse)
-
- init_pics('internet-*')
-
- if $HasColumnCreate
- t.column_create(:text=>'Internet Options')
- else
- t.column_configure(0, :text=>'Internet Options')
- end
-
- t.state_define('check')
- t.state_define('radio')
- t.state_define('on')
-
- t.element_create('e1', :image, :image=>[
- @images['internet-check-on'], ['check', 'on'],
- @images['internet-check-off'], ['check'],
- @images['internet-radio-on'], ['radio', 'on'],
- @images['internet-radio-off'], ['radio']
- ])
- t.element_create('e2', :text,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('e3', :rect, :showfocus=>true,
- :fill=>[@SystemHighlight, ['selected', 'focus']])
-
- s = t.style_create('s1')
- t.style_elements(s, ['e3', 'e1', 'e2'])
- t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e2', :expand=>:ns)
- t.style_layout(s, 'e3', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)
-
- parentList = [:root, '', '', '', '', '', '']
- parent = :root
- [
- [0, :print, "Printing", "", ""],
- [1, :off, "Print background colors and images", "o1", ""],
- [0, :search, "Search from Address bar", "", ""],
- [1, :search, "When searching", "", ""],
- [2, :off, "Display results, and go to the most likely sites",
- "o2", "r1"],
- [2, :off, "Do not search from the Address bar", "o3", "r1"],
- [2, :off, "Just display the results in the main window",
- "o4", "r1"],
- [2, :on, "Just go to the most likely site", "o5", "r1"],
- [0, :security, "Security", "", ""],
- [1, :on, "Check for publisher's certificate revocation", "o5", ""],
- [1, :off, "Check for server certificate revocation (requires restart)",
- "o6", ""]
- ].each{|depth, setting, text, option, group|
- item = t.item_create()
- t.item_style_set(item, 0, 's1')
- t.item_element_configure(item, 0, 'e2', :text=>text)
- @Option[:option, item] = option
- @Option[:group, item] = group
- if setting == :on || setting == :off
- @Option[:setting, item] = setting
- if group == ''
- t.item_state_set(item, 'check')
- if setting == :on
- t.item_state_set(item, 'on')
- end
- else
- if setting == :on
- @Option[:current, group] = item
- t.item_state_set(item, 'on')
- end
- t.item_state_set(item, 'radio')
- end
- else
- t.item_element_configure(item, 0, 'e1',
- :image=>@images["internet-#{setting}"])
- end
- t.item_lastchild(parentList[depth], item)
- depth += 1
- parentList[depth] = item
- }
-
- treeCtrlOption = TkBindTag.new
- treeCtrlOption.bind('Double-ButtonPress-1', proc{|w, x, y|
- Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
- }, '%W %x %y')
- treeCtrlOption.bind('ButtonPress-1', proc{|w, x, y|
- optionButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
- treeCtrlOption.bind('Button1-Motion', proc{|w, x, y|
- optionMotion1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
- treeCtrlOption.bind('Button1-Leave', proc{|w, x, y|
- optionLeave1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
- treeCtrlOption.bind('ButtonRelease-1', proc{|w, x, y|
- optionRelease1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- t.bindtags = [
- t, treeCtrlOption, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL
- ]
-end
-
-def optionButton1(w, x, y)
- w.set_focus
- id = w.identify(x, y)
- if id[0] == 'header'
- Tk::TreeCtrl::BindCallback.buttonPress1(w, x, y)
- elsif id.empty?
- @Priv['buttonMode'] = ''
- else
- @Priv['buttonMode'] = ''
- item = id[1]
- w.selection_modify(item, :all)
- w.activate(item)
- return if @Option[:option, item] == ''
- group = @Option[:group, item]
- if group == ''
- # a checkbutton
- w.item_state_set(item, '~on')
- if @Option[:setting, item] == 'on'
- setting = :off
- else
- setting = :on
- end
- @Option[:setting, item] = setting
- else
- # a radiobutton
- current = @Option[:current, group]
- return if current == item.to_s
- w.item_state_set(current, '!on')
- w.item_state_set(item, 'on')
- @Option[:setting, item] = :on
- @Option[:current, group] = item
- end
- end
-end
-
-# Alternate implementation that doesn't rely on run-time styles
-def demoInternetOptions_2(t)
- height = t.font.metrics(:linespace) + 2
- height = 18 if height < 18
- t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
- :itemheight=>height, :selectmode=>:browse)
-
- init_pics('internet-*')
-
- t.column_configure(0, :text=>'Internet Options')
-
- t.element_create('e1', :image)
- t.element_create('e2', :text,
- :fill=>[@SystemHighlightText, ['selected', 'focus']])
- t.element_create('e3', :rect, :showfocus=>true,
- :fill=>[@SystemHighlight, ['selected', 'focus']])
-
- s = t.style_create('s1')
- t.style_elements('s1', ['e3', 'e1', 'e2'])
- t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns)
- t.style_layout(s, 'e2', :expand=>:ns)
- t.style_layout(s, 'e3', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)
-
- parentList = [:root, '', '', '', '', '', '']
- parent = :root
- [
- [0, :print, "Printing", "", ""],
- [1, :off, "Print background colors and images", "o1", ""],
- [0, :search, "Search from Address bar", "", ""],
- [1, :search, "When searching", "", ""],
- [2, :off, "Display results, and go to the most likely sites",
- "o2", "r1"],
- [2, :off, "Do not search from the Address bar", "o3", "r1"],
- [2, :off, "Just display the results in the main window",
- "o4", "r1"],
- [2, :on, "Just go to the most likely site", "o5", "r1"],
- [0, :security, "Security", "", ""],
- [1, :on, "Check for publisher's certificate revocation", "o5", ""],
- [1, :off, "Check for server certificate revocation (requires restart)",
- "o6", ""]
- ].each{|depth, setting, text, option, group|
- item = t.item_create()
- t.item_style_set(item, 0, 's1')
- t.item_element_configure(item, 0, 'e2', :text=>text)
- @Option[:option, item] = option
- @Option[:group, item] = group
- if setting == :on || setting == :off
- @Option[:setting, item] = setting
- if group == ''
- img = @images["internet-check-#{setting}"]
- t.item_element_configure(item, 0, 'e1', :image=>img)
- else
- if setting == :on
- @Option[:current, group] = item
- end
- img = @images["internet-radio-#{setting}"]
- t.item_element_configure(item, 0, 'e1', :image=>img)
- end
- else
- t.item_element_configure(item, 0, 'e1',
- :image=>@images["internet-#{setting}"])
- end
- t.item_lastchild(parentList[depth], item)
- depth += 1
- parentList[depth] = item
- }
-
- treeCtrlOption = TkBindTag.new
- treeCtrlOption.bind('Double-ButtonPress-1', proc{|w, x, y|
- Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y)
- }, '%W %x %y')
- treeCtrlOption.bind('ButtonPress-1', proc{|w, x, y|
- optionButton1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
- treeCtrlOption.bind('Button1-Motion', proc{|w, x, y|
- optionMotion1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
- treeCtrlOption.bind('Button1-Leave', proc{|w, x, y|
- optionLeave1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
- treeCtrlOption.bind('ButtonRelease-1', proc{|w, x, y|
- optionRelease1(w, x, y)
- Tk.callback_break
- }, '%W %x %y')
-
- t.bindtags = [
- t, treeCtrlOption, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL
- ]
-end
-
-def optionButton1_2(w, x, y)
- w.set_focus
- id = w.identify(x, y)
- if id[0] == 'header'
- Tk::TreeCtrl::BindCallback.buttonPress1(w, x, y)
- elsif id.empty?
- @Priv['buttonMode'] = ''
- else
- @Priv['buttonMode'] = ''
- item = id[1]
- w.selection_modify(item, :all)
- w.activate(item)
- return if @Option[:option, item] == ''
- group = @Option[:group, item]
- if group == ''
- # a checkbutton
- if @Option[:setting, item] == 'on'
- setting = :off
- else
- setting = :on
- end
- w.item_element_configure(item, 0, 'e1',
- :image=>@images["internet-check-#{setting}"])
- @Option[:setting, item] = setting
- else
- # a radiobutton
- current = @Option[:current, group]
- return if current == item.to_s
- w.item_element_configure(current, 0, 'e1',
- :image=>@images["internet-radio-off"])
- w.item_element_configure(item, 0, 'e1',
- :image=>@images["internet-radio-on"])
- @Option[:setting, item] = :on
- @Option[:current, group] = item
- end
- end
-end
-
-def optionMotion1(w, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.motion1(w, x, y)
- end
-end
-
-def optionLeave1(w, x, y)
- # This is called when I do ButtonPress-1 on Unix for some reason,
- # and buttonMode is undefined.
- begin
- mode = @Priv['buttonMode']
- rescue
- else
- case mode
- when 'header'
- t.column_configure(@Priv['column'], :sunken=>false)
- end
- end
-end
-
-def optionRelease1(w, x, y)
- case @Priv['buttonMode']
- when 'resize', 'header'
- Tk::TreeCtrl::BindCallback.release1(w, x, y)
- end
- @Priv['buttonMode'] = ''
-end
diff --git a/ext/tk/sample/tkextlib/vu/dial_demo.rb b/ext/tk/sample/tkextlib/vu/dial.rb
index 09bd3e9186..09bd3e9186 100644
--- a/ext/tk/sample/tkextlib/vu/dial_demo.rb
+++ b/ext/tk/sample/tkextlib/vu/dial.rb
diff --git a/ext/tk/sample/tkextlib/vu/vu_demo.rb b/ext/tk/sample/tkextlib/vu/vu.rb
index d078ae16f2..d078ae16f2 100644
--- a/ext/tk/sample/tkextlib/vu/vu_demo.rb
+++ b/ext/tk/sample/tkextlib/vu/vu.rb
diff --git a/ext/tk/sample/tkrttimer.rb b/ext/tk/sample/tkrttimer.rb
deleted file mode 100644
index 531f4a8d5a..0000000000
--- a/ext/tk/sample/tkrttimer.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env ruby
-# This script is a re-implementation of tktimer.rb with TkTimer(TkAfter) class.
-
-require "tk"
-
-root = TkRoot.new(:title=>'realtime timer sample')
-
-f1 = TkFrame.new(:borderwidth=>2, :relief=>:ridge)
-f1.pack(:side=>:bottom, :fill=>:both)
-TkLabel.new(f1, :text=>'use TkTimer (TkAfter) class').pack(:anchor=>:center)
-label1 = TkLabel.new(:parent=>f1, :relief=>:raised,
- :width=>10).pack(:fill=>:both)
-
-f2 = TkFrame.new(:borderwidth=>2, :relief=>:ridge)
-f2.pack(:side=>:bottom, :fill=>:both)
-TkLabel.new(f2, :text=>'use TkRTTimer class').pack
-label2 = TkLabel.new(:parent=>f2, :relief=>:raised,
- :width=>10).pack(:fill=>:both)
-
-TkLabel.new(:text=>'Interval setting of each timer is 10 ms.',
- :padx=>10, :pady=>5).pack
-
-# define the procedure repeated by the TkTimer object
-tick = proc{|aobj| #<== TkTimer object
- cnt = aobj.return_value + 1 # return_value keeps a result of the last proc
- label = aobj.current_args[0]
- label.text format("%d.%02d", *(cnt.divmod(100)))
- cnt #==> return value is kept by TkTimer object
- # (so, can be send to the next repeat-proc)
-}
-
-timer1 = TkTimer.new(10, -1, [tick, label1]) # 10 ms interval
-timer2 = TkRTTimer.new(10, -1, [tick, label2]) # 10 ms interval
-
-timer1.start(0, proc{ label1.text('0.00'); 0 })
-timer2.start(0, proc{ label2.text('0.00'); 0 })
-
-b_start = TkButton.new(:text=>'Start', :state=>:disabled) {
- pack(:side=>:left, :fill=>:both, :expand=>true)
-}
-
-b_stop = TkButton.new(:text=>'Stop', :state=>:normal) {
- pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes')
-}
-
-b_start.command {
- timer1.continue
- timer2.continue
- b_stop.state(:normal)
- b_start.state(:disabled)
-}
-
-b_stop.command {
- timer1.stop
- timer2.stop
- b_start.state(:normal)
- b_stop.state(:disabled)
-}
-
-TkButton.new(:text=>'Reset', :state=>:normal) {
- command { timer1.reset; timer2.reset }
- pack(:side=>:right, :fill=>:both, :expand=>:yes)
-}
-
-ev_quit = TkVirtualEvent.new('Control-c', 'Control-q')
-Tk.root.bind(ev_quit, proc{Tk.exit}).focus
-
-Tk.mainloop
diff --git a/ext/tk/sample/tktextio.rb b/ext/tk/sample/tktextio.rb
deleted file mode 100644
index cb59c2d9d6..0000000000
--- a/ext/tk/sample/tktextio.rb
+++ /dev/null
@@ -1,603 +0,0 @@
-#!/usr/bin/env ruby
-#
-# sample class of handling I/O stream on a TkText widget
-# by Hidetoshi NAGAI
-#
-# NOTE: TkTextIO supports 'character' (not 'byte') access only.
-# So, for example, TkTextIO#getc returns a character, TkTextIO#pos
-# means the character position, TkTextIO#read(size) counts by
-# characters, and so on.
-# Of course, it is available to make TkTextIO class to suuport
-# 'byte' access. However, it may break multi-byte characters.
-# and then, displayed string on the text widget may be garbled.
-# I think that it is not good on the supposed situation of using
-# TkTextIO.
-#
-require 'tk'
-
-class TkTextIO < TkText
- def create_self(keys)
- mode = nil
- ovwt = false
- text = nil
- wrap = 'char'
- show = :pos
-
- if keys.kind_of?(Hash)
- mode = keys.delete('mode')
- ovwt = keys.delete('overwrite')
- text = keys.delete('text')
- show = keys.delete('show') if keys.has_key?('show')
- wrap = keys.delete('wrap') || 'char'
- end
-
- super(keys)
-
- self['wrap'] = wrap
- insert('1.0', text)
-
- @txtpos = TkTextMark.new(self, '1.0')
- @txtpos.gravity = :left
-
- self.show_mode = show
-
- @sync = true
- @overwrite = (ovwt)? true: false
-
- @lineno = 0
- @line_offset = 0
- @count_var = TkVariable.new
-
- @open = {:r => true, :w => true} # default is 'r+'
-
- case mode
- when 'r'
- @open[:r] = true; @open[:w] = nil
-
- when 'r+'
- @open[:r] = true; @open[:w] = true
-
- when 'w'
- @open[:r] = nil; @open[:w] = true
- self.value=''
-
- when 'w+'
- @open[:r] = true; @open[:w] = true
- self.value=''
-
- when 'a'
- @open[:r] = nil; @open[:w] = true
- @txtpos = TkTextMark.new(self, 'end - 1 char')
- @txtpos.gravity = :right
-
- when 'a+'
- @open[:r] = true; @open[:w] = true
- @txtpos = TkTextMark.new(self, 'end - 1 char')
- @txtpos.gravity = :right
- end
- end
-
- def <<(obj)
- _write(obj)
- self
- end
-
- def binmode
- self
- end
-
- def clone
- fail NotImplementedError, 'cannot clone TkTextIO'
- end
- def dup
- fail NotImplementedError, 'cannot duplicate TkTextIO'
- end
-
- def close
- close_read
- close_write
- nil
- end
- def close_read
- @open[:r] = false if @open[:r]
- nil
- end
- def close_write
- @open[:w] = false if @opne[:w]
- nil
- end
-
- def closed?
- close_read? && close_write?
- end
- def closed_read?
- !@open[:r]
- end
- def closed_write?
- !@open[:w]
- end
-
- def _check_readable
- fail IOError, "not opened for reading" if @open[:r].nil?
- fail IOError, "closed stream" if !@open[:r]
- end
- def _check_writable
- fail IOError, "not opened for writing" if @open[:w].nil?
- fail IOError, "closed stream" if !@open[:w]
- end
- private :_check_readable, :_check_writable
-
- def each_line(rs = $/)
- _check_readable
- while(s = gets)
- yield(s)
- end
- self
- end
- alias each each_line
-
- def each_char
- _check_readable
- while(c = getc)
- yield(c)
- end
- self
- end
- alias each_byte each_char
-
- def eof?
- compare(@txtpos, '==', 'end - 1 char')
- end
- alias eof eof?
-
- def fcntl(*args)
- fail NotImplementedError, 'fcntl is not implemented on TkTextIO'
- end
-
- def fsync
- 0
- end
-
- def fileno
- nil
- end
-
- def flush
- Tk.update if @open[:w] && @sync
- self
- end
-
- def getc
- _check_readable
- return nil if eof?
- c = get(@txtpos)
- @txtpos.set(@txtpos + '1 char')
- _see_pos
- c
- end
-
- def gets(rs = $/)
- _check_readable
- return nil if eof?
- _readline(rs)
- end
-
- def ioctrl(*args)
- fail NotImplementedError, 'iocntl is not implemented on TkTextIO'
- end
-
- def isatty
- false
- end
- def tty?
- false
- end
-
- def lineno
- @lineno + @line_offset
- end
-
- def lineno=(num)
- @line_offset = num - @lineno
- num
- end
-
- def overwrite?
- @overwrite
- end
-
- def overwrite=(ovwt)
- @overwrite = (ovwt)? true: false
- end
-
- def pid
- nil
- end
-
- def index_pos
- index(@txtpos)
- end
- alias tell_index index_pos
-
- def index_pos=(idx)
- @txtpos.set(idx)
- @txtpos.set('end - 1 char') if compare(@txtpos, '>=', :end)
- _see_pos
- idx
- end
-
- def pos
- s = get('1.0', @txtpos)
- number(tk_call('string', 'length', s))
- end
- alias tell pos
-
- def pos=(idx)
- # @txtpos.set((idx.kind_of?(Numeric))? "1.0 + #{idx} char": idx)
- seek(idx, IO::SEEK_SET)
- idx
- end
-
- def pos_gravity
- @txtpos.gravity
- end
-
- def pos_gravity=(side)
- @txtpos.gravity = side
- side
- end
-
- def print(arg=$_, *args)
- _check_writable
- args.unshift(arg)
- args.map!{|val| (val == nil)? 'nil': val.to_s }
- str = args.join($,)
- str << $\ if $\
- _write(str)
- nil
- end
- def printf(*args)
- _check_writable
- _write(sprintf(*args))
- nil
- end
-
- def putc(c)
- _check_writable
- c = c.chr if c.kind_of?(Fixnum)
- _write(c)
- c
- end
-
- def puts(*args)
- _check_writable
- if args.empty?
- _write("\n")
- return nil
- end
- args.each{|arg|
- if arg == nil
- _write("nil\n")
- elsif arg.kind_of?(Array)
- puts(*arg)
- elsif arg.kind_of?(String)
- _write(arg.chomp)
- _write("\n")
- else
- begin
- arg = arg.to_ary
- puts(*arg)
- rescue
- puts(arg.to_s)
- end
- end
- }
- nil
- end
-
- def _read(len)
- epos = @txtpos + "#{len} char"
- s = get(@txtpos, epos)
- @txtpos.set(epos)
- @txtpos.set('end - 1 char') if compare(@txtpos, '>=', :end)
- _see_pos
- s
- end
- private :_read
-
- def read(len=nil, buf=nil)
- _check_readable
- if len
- return "" if len == 0
- return nil if eof?
- s = _read(len)
- else
- s = get(@txtpos, 'end - 1 char')
- @txtpos.set('end - 1 char')
- _see_pos
- end
- buf.replace(s) if buf.kind_of?(String)
- s
- end
-
- def readchar
- _check_readable
- fail EOFError if eof?
- c = get(@txtpos)
- @txtpos.set(@txtpos + '1 char')
- _see_pos
- c
- end
-
- def _readline(rs = $/)
- if rs == nil
- s = get(@txtpos, 'end - 1 char')
- @txtpos.set('end - 1 char')
- elsif rs == ''
- idx = tksearch_with_count([:regexp], @count_var,
- "\n(\n)+", @txtpos, 'end - 1 char')
- if idx
- s = get(@txtpos, idx) << "\n"
- @txtpos.set("#{idx} + #{@count_var.value} char")
- @txtpos.set('end - 1 char') if compare(@txtpos, '>=', :end)
- else
- s = get(@txtpos, 'end - 1 char')
- @txtpos.set('end - 1 char')
- end
- else
- idx = tksearch_with_count(@count_var, rs, @txtpos, 'end - 1 char')
- if idx
- s = get(@txtpos, "#{idx} + #{@count_var.value} char")
- @txtpos.set("#{idx} + #{@count_var.value} char")
- @txtpos.set('end - 1 char') if compare(@txtpos, '>=', :end)
- else
- s = get(@txtpos, 'end - 1 char')
- @txtpos.set('end - 1 char')
- end
- end
-
- _see_pos
- @lineno += 1
- $_ = s
- end
- private :_readline
-
- def readline(rs = $/)
- _check_readable
- fail EOFError if eof?
- _readline(rs)
- end
-
- def readlines(rs = $/)
- _check_readable
- lines = []
- until(eof?)
- lines << _readline(rs)
- end
- $_ = nil
- lines
- end
-
- def readpartial(maxlen, buf=nil)
- _check_readable
- s = _read(maxlen)
- buf.replace(s) if buf.kind_of?(String)
- s
- end
-
- def reopen(*args)
- fail NotImplementedError, 'reopen is not implemented on TkTextIO'
- end
-
- def rewind
- @txtpos.set('1.0')
- _see_pos
- @lineno = 0
- @line_offset = 0
- self
- end
-
- def seek(offset, whence=IO::SEEK_SET)
- case whence
- when IO::SEEK_SET
- offset = "1.0 + #{offset} char" if offset.kind_of?(Numeric)
- @txtpos.set(offset)
-
- when IO::SEEK_CUR
- offset = "#{offset} char" if offset.kind_of?(Numeric)
- @txtpos.set(@txtpos + offset)
-
- when IO::SEEK_END
- offset = "#{offset} char" if offset.kind_of?(Numeric)
- @txtpos.set("end - 1 char + #{offset}")
-
- else
- fail Errno::EINVAL, 'invalid whence argument'
- end
-
- @txtpos.set('end - 1 char') if compare(@txtpos, '>=', :end)
- _see_pos
-
- 0
- end
- alias sysseek seek
-
- def _see_pos
- see(@show) if @show
- end
- private :_see_pos
-
- def show_mode
- (@show == @txtpos)? :pos : @show
- end
-
- def show_mode=(mode)
- # define show mode when file position is changed.
- # mode == :pos or "pos" or true :: see current file position.
- # mode == :insert or "insert" :: see insert cursor position.
- # mode == nil or false :: do nothing
- # else see 'mode' position ('mode' should be text index or mark)
- case mode
- when :pos, 'pos', true
- @show = @txtpos
- when :insert, 'insert'
- @show = :insert
- when nil, false
- @show = false
- else
- begin
- index(mode)
- rescue
- fail ArgumentError, 'invalid show-position'
- end
- @show = mode
- end
-
- _see_pos
-
- mode
- end
-
- def stat
- fail NotImplementedError, 'stat is not implemented on TkTextIO'
- end
-
- def sync
- @sync
- end
-
- def sync=(mode)
- @sync = mode
- end
-
- def sysread(len, buf=nil)
- _check_readable
- fail EOFError if eof?
- s = _read(len)
- buf.replace(s) if buf.kind_of?(String)
- s
- end
-
- def syswrite(obj)
- _write(obj)
- end
-
- def to_io
- self
- end
-
- def trancate(len)
- delete("1.0 + #{len} char", :end)
- 0
- end
-
- def ungetc(c)
- _check_readable
- c = c.chr if c.kind_of?(Fixnum)
- if compare(@txtpos, '>', '1.0')
- @txtpos.set(@txtpos - '1 char')
- delete(@txtpos)
- insert(@txtpos, tk_call('string', 'range', c, 0, 1))
- @txtpos.set(@txtpos - '1 char') if @txtpos.gravity == 'right'
- _see_pos
- else
- fail IOError, 'cannot ungetc at head of stream'
- end
- nil
- end
-
- def _write(obj)
- s = _get_eval_string(obj)
- n = number(tk_call('string', 'length', s))
- delete(@txtpos, @txtpos + "#{n} char") if @overwrite
- self.insert(@txtpos, s)
- @txtpos.set(@txtpos + "#{n} char")
- @txtpos.set('end - 1 char') if compare(@txtpos, '>=', :end)
- _see_pos
- Tk.update if @sync
- n
- end
- private :_write
-
- def write(obj)
- _check_writable
- _write(obj)
- end
-end
-
-####################
-# TEST
-####################
-if __FILE__ == $0
- f = TkFrame.new.pack
- tio = TkTextIO.new(f, :show=>:pos,
- :text=>">>> This is an initial text line. <<<\n\n"){
- yscrollbar(TkScrollbar.new(f).pack(:side=>:right, :fill=>:y))
- pack(:side=>:left, :fill=>:both, :expand=>true)
- }
-
- $stdin = tio
- $stdout = tio
- $stderr = tio
-
- STDOUT.print("\n========= TkTextIO#gets for inital text ========\n\n")
-
- while(s = gets)
- STDOUT.print(s)
- end
-
- STDOUT.print("\n============ put strings to TkTextIO ===========\n\n")
-
- puts "On this sample, a text widget works as if it is a I/O stream."
- puts "Please see the code."
- puts
- printf("printf message: %d %X\n", 123456, 255)
- puts
- printf("(output by 'p' method) This TkTextIO object is ...\n")
- p tio
- print(" [ Current wrap mode of this object is 'char'. ]\n")
- puts
- warn("This is a warning message generated by 'warn' method.")
- puts
- puts "current show_mode is #{tio.show_mode}."
- if tio.show_mode == :pos
- puts "So, you can see the current file position on this text widget."
- else
- puts "So, you can see the position '#{tio.show_mode}' on this text widget."
- end
- print("Please scroll up this text widget to see the head of lines.\n")
- print("---------------------------------------------------------\n")
-
- STDOUT.print("\n=============== TkTextIO#readlines =============\n\n")
-
- tio.seek(0)
- lines = readlines
- STDOUT.puts(lines.inspect)
-
- STDOUT.print("\n================== TkTextIO#each ===============\n\n")
-
- tio.rewind
- tio.each{|line| STDOUT.printf("%2d: %s\n", tio.lineno, line.chomp)}
-
- STDOUT.print("\n================================================\n\n")
-
- STDOUT.print("\n========= reverse order (seek by lines) ========\n\n")
-
- tio.seek(-1, IO::SEEK_END)
- begin
- begin
- tio.seek(:linestart, IO::SEEK_CUR)
- rescue
- # maybe use old version of tk/textmark.rb
- tio.seek('0 char linestart', IO::SEEK_CUR)
- end
- STDOUT.print(gets)
- tio.seek('-1 char linestart -1 char', IO::SEEK_CUR)
- end while(tio.pos > 0)
-
- STDOUT.print("\n================================================\n\n")
-
- tio.seek(0, IO::SEEK_END)
-
- Tk.mainloop
-end
diff --git a/ext/tk/sample/tktree.rb b/ext/tk/sample/tktree.rb
index 56b7211c88..d16d3344bd 100644
--- a/ext/tk/sample/tktree.rb
+++ b/ext/tk/sample/tktree.rb
@@ -25,7 +25,7 @@ class TkTree < TkCanvas
end
begin
tk_call('::tktree::treecreate', *args)
- rescue NameError, RuntimeError
+ rescue NameError
Tk.load_tclscript(TkTree::TCL_SCRIPT_PATH)
tk_call('::tktree::treecreate', *args)
end
diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c
deleted file mode 100644
index 23ff42a4f4..0000000000
--- a/ext/tk/stubs.c
+++ /dev/null
@@ -1,516 +0,0 @@
-#include "stubs.h"
-#include "ruby.h"
-#include <tcl.h>
-#include <tk.h>
-
-/*------------------------------*/
-
-#ifdef __MACOS__
-# include <tkMac.h>
-# include <Quickdraw.h>
-
-static int call_macinit = 0;
-
-static void
-_macinit()
-{
- if (!call_macinit) {
- tcl_macQdPtr = &qd; /* setup QuickDraw globals */
- Tcl_MacSetEventProc(TkMacConvertEvent); /* setup event handler */
- call_macinit = 1;
- }
-}
-#endif
-
-/*------------------------------*/
-
-static int nativethread_checked = 0;
-
-static void
-_nativethread_consistency_check(ip)
- Tcl_Interp *ip;
-{
- if (nativethread_checked || ip == (Tcl_Interp *)NULL) {
- return;
- }
-
- /* If the variable "tcl_platform(threaded)" exists,
- then the Tcl interpreter was compiled with threads enabled. */
- if (Tcl_GetVar2(ip, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != (char*)NULL) {
-#ifdef HAVE_NATIVETHREAD
- /* consistent */
-#else
- rb_warn("Inconsistency. Loaded Tcl/Tk libraries are enabled nativethread-support. But `tcltklib' is not. The inconsistency causes SEGV or other troubles frequently.");
-#endif
- } else {
-#ifdef HAVE_NATIVETHREAD
- rb_warning("Inconsistency.`tcltklib' is enabled nativethread-support. But loaded Tcl/Tk libraries are not. (Probably, the inconsistency doesn't cause any troubles.)");
-#else
- /* consistent */
-#endif
- }
-
- Tcl_ResetResult(ip);
-
- nativethread_checked = 1;
-}
-
-/*------------------------------*/
-
-#if defined USE_TCL_STUBS && defined USE_TK_STUBS
-
-#if defined _WIN32 || defined __CYGWIN__
-# include "util.h"
-# include <windows.h>
- typedef HINSTANCE DL_HANDLE;
-# define DL_OPEN LoadLibrary
-# define DL_SYM GetProcAddress
-# define TCL_INDEX 4
-# define TK_INDEX 3
-# define TCL_NAME "tcl89%s"
-# define TK_NAME "tk89%s"
-# undef DLEXT
-# define DLEXT ".dll"
-#elif defined HAVE_DLOPEN
-# include <dlfcn.h>
- typedef void *DL_HANDLE;
-# define DL_OPEN(file) dlopen(file, RTLD_LAZY|RTLD_GLOBAL)
-# define DL_SYM dlsym
-# define TCL_INDEX 8
-# define TK_INDEX 7
-# define TCL_NAME "libtcl8.9%s"
-# define TK_NAME "libtk8.9%s"
-#endif
-
-static DL_HANDLE tcl_dll = (DL_HANDLE)0;
-static DL_HANDLE tk_dll = (DL_HANDLE)0;
-
-int
-ruby_open_tcl_dll(appname)
- char *appname;
-{
- void (*p_Tcl_FindExecutable)(const char *);
- int n;
- char *ruby_tcl_dll = 0;
- char tcl_name[20];
-
- if (tcl_dll) return TCLTK_STUBS_OK;
-
- ruby_tcl_dll = getenv("RUBY_TCL_DLL");
-#if defined _WIN32
- if (ruby_tcl_dll) ruby_tcl_dll = ruby_strdup(ruby_tcl_dll);
-#endif
- if (ruby_tcl_dll) {
- tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
- } else {
- snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
- /* examine from 8.9 to 8.1 */
- for (n = '9'; n > '0'; n--) {
- tcl_name[TCL_INDEX] = n;
- tcl_dll = (DL_HANDLE)DL_OPEN(tcl_name);
- if (tcl_dll)
- break;
- }
- }
-
-#if defined _WIN32
- if (ruby_tcl_dll) ruby_xfree(ruby_tcl_dll);
-#endif
-
- if (!tcl_dll)
- return NO_TCL_DLL;
-
- p_Tcl_FindExecutable = (void (*)(const char *))DL_SYM(tcl_dll, "Tcl_FindExecutable");
- if (!p_Tcl_FindExecutable)
- return NO_FindExecutable;
-
- if (appname) {
- p_Tcl_FindExecutable(appname);
- } else {
- p_Tcl_FindExecutable("ruby");
- }
-
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_open_tk_dll()
-{
- int n;
- char *ruby_tk_dll = 0;
- char tk_name[20];
-
- if (!tcl_dll) {
- /* int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
- int ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
- if (ret != TCLTK_STUBS_OK) return ret;
- }
-
- if (tk_dll) return TCLTK_STUBS_OK;
-
- ruby_tk_dll = getenv("RUBY_TK_DLL");
- if (ruby_tk_dll) {
- tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
- } else {
- snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
- /* examine from 8.9 to 8.1 */
- for (n = '9'; n > '0'; n--) {
- tk_name[TK_INDEX] = n;
- tk_dll = (DL_HANDLE)DL_OPEN(tk_name);
- if (tk_dll)
- break;
- }
- }
-
- if (!tk_dll)
- return NO_TK_DLL;
-
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_open_tcltk_dll(appname)
- char *appname;
-{
- return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
-}
-
-int
-tcl_stubs_init_p()
-{
- return(tclStubsPtr != (TclStubs*)NULL);
-}
-
-int
-tk_stubs_init_p()
-{
- return(tkStubsPtr != (TkStubs*)NULL);
-}
-
-
-Tcl_Interp *
-ruby_tcl_create_ip_and_stubs_init(st)
- int *st;
-{
- Tcl_Interp *tcl_ip;
-
- if (st) *st = 0;
-
- if (tcl_stubs_init_p()) {
- tcl_ip = Tcl_CreateInterp();
-
- if (!tcl_ip) {
- if (st) *st = FAIL_CreateInterp;
- return (Tcl_Interp*)NULL;
- }
-
- _nativethread_consistency_check(tcl_ip);
-
- return tcl_ip;
-
- } else {
- Tcl_Interp *(*p_Tcl_CreateInterp)();
- Tcl_Interp *(*p_Tcl_DeleteInterp)();
-
- if (!tcl_dll) {
- /* int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
- int ret = ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
-
- if (ret != TCLTK_STUBS_OK) {
- if (st) *st = ret;
- return (Tcl_Interp*)NULL;
- }
- }
-
- p_Tcl_CreateInterp
- = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_CreateInterp");
- if (!p_Tcl_CreateInterp) {
- if (st) *st = NO_CreateInterp;
- return (Tcl_Interp*)NULL;
- }
-
- p_Tcl_DeleteInterp
- = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_DeleteInterp");
- if (!p_Tcl_DeleteInterp) {
- if (st) *st = NO_DeleteInterp;
- return (Tcl_Interp*)NULL;
- }
-
- tcl_ip = (*p_Tcl_CreateInterp)();
- if (!tcl_ip) {
- if (st) *st = FAIL_CreateInterp;
- return (Tcl_Interp*)NULL;
- }
-
- if (!Tcl_InitStubs(tcl_ip, "8.1", 0)) {
- if (st) *st = FAIL_Tcl_InitStubs;
- (*p_Tcl_DeleteInterp)(tcl_ip);
- return (Tcl_Interp*)NULL;
- }
-
- _nativethread_consistency_check(tcl_ip);
-
- return tcl_ip;
- }
-}
-
-int
-ruby_tcl_stubs_init()
-{
- int st;
- Tcl_Interp *tcl_ip;
-
- if (!tcl_stubs_init_p()) {
- tcl_ip = ruby_tcl_create_ip_and_stubs_init(&st);
-
- if (!tcl_ip) return st;
-
- Tcl_DeleteInterp(tcl_ip);
- }
-
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_tk_stubs_init(tcl_ip)
- Tcl_Interp *tcl_ip;
-{
- Tcl_ResetResult(tcl_ip);
-
- if (tk_stubs_init_p()) {
- if (Tk_Init(tcl_ip) == TCL_ERROR) {
- return FAIL_Tk_Init;
- }
- } else {
- int (*p_Tk_Init)(Tcl_Interp *);
-
- if (!tk_dll) {
- int ret = ruby_open_tk_dll();
- if (ret != TCLTK_STUBS_OK) return ret;
- }
-
- p_Tk_Init = (int (*)(Tcl_Interp *))DL_SYM(tk_dll, "Tk_Init");
- if (!p_Tk_Init)
- return NO_Tk_Init;
-
- if ((*p_Tk_Init)(tcl_ip) == TCL_ERROR)
- return FAIL_Tk_Init;
-
- if (!Tk_InitStubs(tcl_ip, "8.1", 0))
- return FAIL_Tk_InitStubs;
-
-#ifdef __MACOS__
- _macinit();
-#endif
- }
-
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_tk_stubs_safeinit(tcl_ip)
- Tcl_Interp *tcl_ip;
-{
- Tcl_ResetResult(tcl_ip);
-
- if (tk_stubs_init_p()) {
- if (Tk_SafeInit(tcl_ip) == TCL_ERROR)
- return FAIL_Tk_Init;
- } else {
- int (*p_Tk_SafeInit)(Tcl_Interp *);
-
- if (!tk_dll) {
- int ret = ruby_open_tk_dll();
- if (ret != TCLTK_STUBS_OK) return ret;
- }
-
- p_Tk_SafeInit = (int (*)(Tcl_Interp *))DL_SYM(tk_dll, "Tk_SafeInit");
- if (!p_Tk_SafeInit)
- return NO_Tk_Init;
-
- if ((*p_Tk_SafeInit)(tcl_ip) == TCL_ERROR)
- return FAIL_Tk_Init;
-
- if (!Tk_InitStubs(tcl_ip, "8.1", 0))
- return FAIL_Tk_InitStubs;
-
-#ifdef __MACOS__
- _macinit();
-#endif
- }
-
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_tcltk_stubs()
-{
- int st;
- Tcl_Interp *tcl_ip;
-
- /* st = ruby_open_tcltk_dll(RSTRING(rb_argv0)->ptr); */
- st = ruby_open_tcltk_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
- switch(st) {
- case NO_FindExecutable:
- return -7;
- case NO_TCL_DLL:
- case NO_TK_DLL:
- return -1;
- }
-
- tcl_ip = ruby_tcl_create_ip_and_stubs_init(&st);
- if (!tcl_ip) {
- switch(st) {
- case NO_CreateInterp:
- case NO_DeleteInterp:
- return -2;
- case FAIL_CreateInterp:
- return -3;
- case FAIL_Tcl_InitStubs:
- return -5;
- }
- }
-
- st = ruby_tk_stubs_init(tcl_ip);
- switch(st) {
- case NO_Tk_Init:
- Tcl_DeleteInterp(tcl_ip);
- return -4;
- case FAIL_Tk_Init:
- case FAIL_Tk_InitStubs:
- Tcl_DeleteInterp(tcl_ip);
- return -6;
- }
-
- Tcl_DeleteInterp(tcl_ip);
-
- return 0;
-}
-
-/*###################################################*/
-#else /* ! USE_TCL_STUBS || ! USE_TK_STUBS) */
-/*###################################################*/
-
-static int open_tcl_dll = 0;
-static int call_tk_stubs_init = 0;
-
-int
-ruby_open_tcl_dll(appname)
- char *appname;
-{
- if (appname) {
- Tcl_FindExecutable(appname);
- } else {
- Tcl_FindExecutable("ruby");
- }
- open_tcl_dll = 1;
-
- return TCLTK_STUBS_OK;
-}
-
-int ruby_open_tk_dll()
-{
- if (!open_tcl_dll) {
- /* ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
- ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
- }
-
- return TCLTK_STUBS_OK;
-}
-
-int ruby_open_tcltk_dll(appname)
- char *appname;
-{
- return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
-}
-
-int
-tcl_stubs_init_p()
-{
- return 1;
-}
-
-int
-tk_stubs_init_p()
-{
- return call_tk_stubs_init;
-}
-
-Tcl_Interp *
-ruby_tcl_create_ip_and_stubs_init(st)
- int *st;
-{
- Tcl_Interp *tcl_ip;
-
- if (!open_tcl_dll) {
- /* ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); */
- ruby_open_tcl_dll(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
- }
-
- if (st) *st = 0;
- tcl_ip = Tcl_CreateInterp();
- if (!tcl_ip) {
- if (st) *st = FAIL_CreateInterp;
- return (Tcl_Interp*)NULL;
- }
-
- _nativethread_consistency_check(tcl_ip);
-
- return tcl_ip;
-}
-
-int
-ruby_tcl_stubs_init()
-{
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_tk_stubs_init(tcl_ip)
- Tcl_Interp *tcl_ip;
-{
- if (Tk_Init(tcl_ip) == TCL_ERROR)
- return FAIL_Tk_Init;
-
- if (!call_tk_stubs_init) {
-#ifdef __MACOS__
- _macinit();
-#endif
- call_tk_stubs_init = 1;
- }
-
- return TCLTK_STUBS_OK;
-}
-
-int
-ruby_tk_stubs_safeinit(tcl_ip)
- Tcl_Interp *tcl_ip;
-{
-#if TCL_MAJOR_VERSION >= 8
- if (Tk_SafeInit(tcl_ip) == TCL_ERROR)
- return FAIL_Tk_Init;
-
- if (!call_tk_stubs_init) {
-#ifdef __MACOS__
- _macinit();
-#endif
- call_tk_stubs_init = 1;
- }
-
- return TCLTK_STUBS_OK;
-
-#else /* TCL_MAJOR_VERSION < 8 */
-
- return FAIL_Tk_Init;
-#endif
-}
-
-int
-ruby_tcltk_stubs()
-{
- /* Tcl_FindExecutable(RSTRING(rb_argv0)->ptr); */
- Tcl_FindExecutable(rb_argv0 ? RSTRING(rb_argv0)->ptr : 0);
- return 0;
-}
-
-#endif
diff --git a/ext/tk/stubs.h b/ext/tk/stubs.h
deleted file mode 100644
index 7c913fb393..0000000000
--- a/ext/tk/stubs.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <tcl.h>
-
-extern int ruby_open_tcl_dll(char *);
-extern int ruby_open_tk_dll();
-extern int ruby_open_tcltk_dll(char *);
-extern int tcl_stubs_init_p();
-extern int tk_stubs_init_p();
-extern Tcl_Interp *ruby_tcl_create_ip_and_stubs_init(int*);
-extern int ruby_tcl_stubs_init();
-extern int ruby_tk_stubs_init(Tcl_Interp*);
-extern int ruby_tk_stubs_safeinit(Tcl_Interp*);
-extern int ruby_tcltk_stubs();
-
-/* no error */
-#define TCLTK_STUBS_OK (0)
-
-/* return value of ruby_open_tcl_dll() */
-#define NO_TCL_DLL (1)
-#define NO_FindExecutable (2)
-
-/* return value of ruby_open_tk_dll() */
-#define NO_TK_DLL (-1)
-
-/* status value of ruby_tcl_create_ip_and_stubs_init(st) */
-#define NO_CreateInterp (3)
-#define NO_DeleteInterp (4)
-#define FAIL_CreateInterp (5)
-#define FAIL_Tcl_InitStubs (6)
-
-/* return value of ruby_tk_stubs_init() */
-#define NO_Tk_Init (7)
-#define FAIL_Tk_Init (8)
-#define FAIL_Tk_InitStubs (9)
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil.c
index be1b635a0f..04d276cca2 100644
--- a/ext/tk/tkutil/tkutil.c
+++ b/ext/tk/tkutil.c
@@ -2,17 +2,14 @@
tkutil.c -
- $Author: nagai $
- $Date: 2006/04/05 16:08:45 $
+ $Author$
+ $Date$
created at: Fri Nov 3 00:47:54 JST 1995
************************************************/
-#define TKUTIL_RELEASE_DATE "2006-04-06"
-
#include "ruby.h"
#include "rubysig.h"
-#include "version.h"
#include "st.h"
static VALUE cMethod;
@@ -32,15 +29,12 @@ static ID ID_toUTF8;
static ID ID_fromUTF8;
static ID ID_path;
static ID ID_at_path;
-static ID ID_at_enc;
static ID ID_to_eval;
static ID ID_to_s;
static ID ID_source;
static ID ID_downcase;
static ID ID_install_cmd;
static ID ID_merge_tklist;
-static ID ID_encoding;
-static ID ID_encoding_system;
static ID ID_call;
static ID ID_SUBST_INFO;
@@ -58,13 +52,7 @@ tk_s_new(argc, argv, klass)
{
VALUE obj = rb_class_new_instance(argc, argv, klass);
- if (rb_block_given_p()) {
-#if RUBY_VERSION_MAJOR == 1 && RUBY_VERSION_MINOR <= 8 /* ruby 1.8.x */
- rb_obj_instance_eval(0, 0, obj);
-#else
- rb_obj_instance_exec(1, &obj, obj);
-#endif
- }
+ if (rb_block_given_p()) rb_obj_instance_eval(0, 0, obj);
return obj;
}
@@ -85,7 +73,9 @@ tk_eval_cmd(argc, argv, self)
VALUE argv[];
VALUE self;
{
- volatile VALUE cmd, rest;
+ volatile VALUE cmd, rest, arg;
+ volatile VALUE ret;
+ int status;
rb_scan_args(argc, argv, "1*", &cmd, &rest);
return rb_eval_cmd(cmd, rest, 0);
@@ -207,12 +197,24 @@ fromUTF8_toDefaultEnc(str, self)
return tk_fromUTF8(1, argv, self);
}
+
+static void
+hash_check(err)
+ int err;
+{
+ if (err) {
+ rb_raise(rb_eRuntimeError, "hash modified");
+ }
+}
+
static int
-to_strkey(key, value, hash)
+to_strkey(key, value, hash, err)
VALUE key;
VALUE value;
VALUE hash;
+ int err;
{
+ hash_check(err);
if (key == Qundef) return ST_CONTINUE;
rb_hash_aset(hash, rb_funcall(key, ID_to_s, 0, 0), value);
return ST_CHECK;
@@ -232,40 +234,19 @@ tk_symbolkey2str(self, keys)
}
static VALUE get_eval_string_core _((VALUE, VALUE, VALUE));
-static VALUE ary2list _((VALUE, VALUE, VALUE));
-static VALUE ary2list2 _((VALUE, VALUE, VALUE));
+static VALUE ary2list _((VALUE, VALUE));
+static VALUE ary2list2 _((VALUE, VALUE));
static VALUE hash2list _((VALUE, VALUE));
-static VALUE hash2list_enc _((VALUE, VALUE));
static VALUE hash2kv _((VALUE, VALUE, VALUE));
-static VALUE hash2kv_enc _((VALUE, VALUE, VALUE));
static VALUE
-ary2list(ary, enc_flag, self)
+ary2list(ary, self)
VALUE ary;
- VALUE enc_flag;
VALUE self;
{
- int idx, idx2, size, size2, req_chk_flag;
- volatile VALUE val, val2, str_val;
+ int idx, idx2, size, size2;
+ volatile VALUE val, val2;
volatile VALUE dst;
- volatile VALUE sys_enc, dst_enc, str_enc;
-
- sys_enc = rb_funcall(cTclTkLib, ID_encoding, 0, 0);
- if (NIL_P(sys_enc)) {
- sys_enc = rb_funcall(cTclTkLib, ID_encoding_system, 0, 0);
- sys_enc = rb_funcall(sys_enc, ID_to_s, 0, 0);
- }
-
- if NIL_P(enc_flag) {
- dst_enc = sys_enc;
- req_chk_flag = 1;
- } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) {
- dst_enc = enc_flag;
- req_chk_flag = 0;
- } else {
- dst_enc = rb_funcall(enc_flag, ID_to_s, 0, 0);
- req_chk_flag = 0;
- }
/* size = RARRAY(ary)->len; */
size = 0;
@@ -281,69 +262,31 @@ ary2list(ary, enc_flag, self)
RARRAY(dst)->len = 0;
for(idx = 0; idx < RARRAY(ary)->len; idx++) {
val = RARRAY(ary)->ptr[idx];
- str_val = Qnil;
switch(TYPE(val)) {
case T_ARRAY:
- str_val = ary2list(val, enc_flag, self);
- RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;
-
- if (req_chk_flag) {
- str_enc = rb_ivar_get(str_val, ID_at_enc);
- if (!NIL_P(str_enc)) {
- str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
- } else {
- str_enc = sys_enc;
- }
- if (!rb_str_cmp(str_enc, dst_enc)) {
- dst_enc = Qtrue;
- req_chk_flag = 0;
- }
- }
-
+ RARRAY(dst)->ptr[RARRAY(dst)->len++] = ary2list(val, self);
break;
case T_HASH:
/* RARRAY(dst)->ptr[RARRAY(dst)->len++] = hash2list(val, self); */
- if (RTEST(enc_flag)) {
- val = hash2kv_enc(val, Qnil, self);
- } else {
- val = hash2kv(val, Qnil, self);
- }
+ val = hash2kv(val, Qnil, self);
size2 = RARRAY(val)->len;
for(idx2 = 0; idx2 < size2; idx2++) {
val2 = RARRAY(val)->ptr[idx2];
switch(TYPE(val2)) {
case T_ARRAY:
- str_val = ary2list(val2, enc_flag, self);
- RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;
+ RARRAY(dst)->ptr[RARRAY(dst)->len++]
+ = ary2list(val2, self);
break;
case T_HASH:
- if (RTEST(enc_flag)) {
- str_val = hash2list_enc(val2, self);
- } else {
- str_val = hash2list(val2, self);
- }
- RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;
- break;
+ RARRAY(dst)->ptr[RARRAY(dst)->len++]
+ = hash2list(val2, self);
default:
if (val2 != TK_None) {
- str_val = get_eval_string_core(val2, enc_flag, self);
- RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;
- }
- }
-
- if (req_chk_flag) {
- str_enc = rb_ivar_get(str_val, ID_at_enc);
- if (!NIL_P(str_enc)) {
- str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
- } else {
- str_enc = sys_enc;
- }
- if (!rb_str_cmp(str_enc, dst_enc)) {
- dst_enc = Qtrue;
- req_chk_flag = 0;
+ RARRAY(dst)->ptr[RARRAY(dst)->len++]
+ = get_eval_string_core(val2, Qnil, self);
}
}
}
@@ -351,140 +294,45 @@ ary2list(ary, enc_flag, self)
default:
if (val != TK_None) {
- str_val = get_eval_string_core(val, enc_flag, self);
- RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;
-
- if (req_chk_flag) {
- str_enc = rb_ivar_get(str_val, ID_at_enc);
- if (!NIL_P(str_enc)) {
- str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
- } else {
- str_enc = sys_enc;
- }
- if (!rb_str_cmp(str_enc, dst_enc)) {
- dst_enc = Qtrue;
- req_chk_flag = 0;
- }
- }
- }
- }
- }
-
- if (RTEST(dst_enc) && !NIL_P(sys_enc)) {
- for(idx = 0; idx < RARRAY(dst)->len; idx++) {
- str_val = RARRAY(dst)->ptr[idx];
- if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
- str_val = rb_funcall(self, ID_toUTF8, 1, str_val);
- } else {
- str_val = rb_funcall(cTclTkLib, ID_toUTF8, 1, str_val);
+ RARRAY(dst)->ptr[RARRAY(dst)->len++]
+ = get_eval_string_core(val, Qnil, self);
}
- RARRAY(dst)->ptr[idx] = str_val;
- }
- val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
- if (TYPE(dst_enc) == T_STRING) {
- val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc);
- rb_ivar_set(val, ID_at_enc, dst_enc);
- } else {
- rb_ivar_set(val, ID_at_enc, rb_str_new2("utf-8"));
}
- return val;
- } else {
- return rb_apply(cTclTkLib, ID_merge_tklist, dst);
}
+ return rb_apply(cTclTkLib, ID_merge_tklist, dst);
}
static VALUE
-ary2list2(ary, enc_flag, self)
+ary2list2(ary, self)
VALUE ary;
- VALUE enc_flag;
VALUE self;
{
- int idx, size, req_chk_flag;
- volatile VALUE val, str_val;
+ int idx, size;
+ volatile VALUE val;
volatile VALUE dst;
- volatile VALUE sys_enc, dst_enc, str_enc;
-
- sys_enc = rb_funcall(cTclTkLib, ID_encoding, 0, 0);
- if NIL_P(sys_enc) {
- sys_enc = rb_funcall(cTclTkLib, ID_encoding_system, 0, 0);
- sys_enc = rb_funcall(sys_enc, ID_to_s, 0, 0);
- }
-
- if NIL_P(enc_flag) {
- dst_enc = sys_enc;
- req_chk_flag = 1;
- } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) {
- dst_enc = enc_flag;
- req_chk_flag = 0;
- } else {
- dst_enc = rb_funcall(enc_flag, ID_to_s, 0, 0);
- req_chk_flag = 0;
- }
size = RARRAY(ary)->len;
dst = rb_ary_new2(size);
RARRAY(dst)->len = 0;
for(idx = 0; idx < RARRAY(ary)->len; idx++) {
val = RARRAY(ary)->ptr[idx];
- str_val = Qnil;
switch(TYPE(val)) {
case T_ARRAY:
- str_val = ary2list(val, enc_flag, self);
+ RARRAY(dst)->ptr[RARRAY(dst)->len++] = ary2list(val, self);
break;
case T_HASH:
- if (RTEST(enc_flag)) {
- str_val = hash2list(val, self);
- } else {
- str_val = hash2list_enc(val, self);
- }
+ RARRAY(dst)->ptr[RARRAY(dst)->len++] = hash2list(val, self);
break;
default:
if (val != TK_None) {
- str_val = get_eval_string_core(val, enc_flag, self);
- }
- }
-
- if (!NIL_P(str_val)) {
- RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;
-
- if (req_chk_flag) {
- str_enc = rb_ivar_get(str_val, ID_at_enc);
- if (!NIL_P(str_enc)) {
- str_enc = rb_funcall(str_enc, ID_to_s, 0, 0);
- } else {
- str_enc = sys_enc;
- }
- if (!rb_str_cmp(str_enc, dst_enc)) {
- dst_enc = Qtrue;
- req_chk_flag = 0;
- }
+ RARRAY(dst)->ptr[RARRAY(dst)->len++]
+ = get_eval_string_core(val, Qnil, self);
}
}
}
-
- if (RTEST(dst_enc) && !NIL_P(sys_enc)) {
- for(idx = 0; idx < RARRAY(dst)->len; idx++) {
- str_val = RARRAY(dst)->ptr[idx];
- if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
- str_val = rb_funcall(self, ID_toUTF8, 1, str_val);
- } else {
- str_val = rb_funcall(cTclTkLib, ID_toUTF8, 1, str_val);
- }
- RARRAY(dst)->ptr[idx] = str_val;
- }
- val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
- if (TYPE(dst_enc) == T_STRING) {
- val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc);
- rb_ivar_set(val, ID_at_enc, dst_enc);
- } else {
- rb_ivar_set(val, ID_at_enc, rb_str_new2("utf-8"));
- }
- return val;
- } else {
- return rb_apply(cTclTkLib, ID_merge_tklist, dst);
- }
+ return rb_apply(cTclTkLib, ID_merge_tklist, dst);
}
static VALUE
@@ -599,13 +447,15 @@ assoc2kv_enc(assoc, ary, self)
}
static int
-push_kv(key, val, args)
+push_kv(key, val, args, err)
VALUE key;
VALUE val;
VALUE args;
+ int err;
{
volatile VALUE ary;
+ hash_check(err);
ary = RARRAY(args)->ptr[0];
if (key == Qundef) return ST_CONTINUE;
@@ -647,13 +497,15 @@ hash2kv(hash, ary, self)
}
static int
-push_kv_enc(key, val, args)
+push_kv_enc(key, val, args, err)
VALUE key;
VALUE val;
VALUE args;
+ int err;
{
volatile VALUE ary;
+ hash_check(err);
ary = RARRAY(args)->ptr[0];
if (key == Qundef) return ST_CONTINUE;
@@ -702,7 +554,7 @@ hash2list(hash, self)
VALUE hash;
VALUE self;
{
- return ary2list2(hash2kv(hash, Qnil, self), Qfalse, self);
+ return ary2list2(hash2kv(hash, Qnil, self), self);
}
@@ -711,7 +563,7 @@ hash2list_enc(hash, self)
VALUE hash;
VALUE self;
{
- return ary2list2(hash2kv_enc(hash, Qnil, self), Qfalse, self);
+ return ary2list2(hash2kv_enc(hash, Qnil, self), self);
}
static VALUE
@@ -786,7 +638,7 @@ get_eval_string_core(obj, enc_flag, self)
case T_STRING:
if (RTEST(enc_flag)) {
- if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
+ if (rb_respond_to(self, ID_toUTF8)) {
return rb_funcall(self, ID_toUTF8, 1, obj);
} else {
return fromDefaultEnc_toUTF8(obj, self);
@@ -797,7 +649,7 @@ get_eval_string_core(obj, enc_flag, self)
case T_SYMBOL:
if (RTEST(enc_flag)) {
- if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
+ if (rb_respond_to(self, ID_toUTF8)) {
return rb_funcall(self, ID_toUTF8, 1,
rb_str_new2(rb_id2name(SYM2ID(obj))));
} else {
@@ -815,7 +667,11 @@ get_eval_string_core(obj, enc_flag, self)
}
case T_ARRAY:
- return ary2list(obj, enc_flag, self);
+ if (RTEST(enc_flag)) {
+ return fromDefaultEnc_toUTF8(ary2list(obj, self), self);
+ } else {
+ return ary2list(obj, self);
+ }
case T_FALSE:
return rb_str_new2("0");
@@ -839,7 +695,7 @@ get_eval_string_core(obj, enc_flag, self)
if (rb_obj_is_kind_of(obj, rb_cProc)
|| rb_obj_is_kind_of(obj, cMethod)
|| rb_obj_is_kind_of(obj, cTkCallbackEntry)) {
- if (rb_obj_respond_to(self, ID_install_cmd, Qtrue)) {
+ if (rb_respond_to(self, ID_install_cmd)) {
return rb_funcall(self, ID_install_cmd, 1, obj);
} else {
return tk_install_cmd_core(obj);
@@ -848,15 +704,15 @@ get_eval_string_core(obj, enc_flag, self)
if (obj == TK_None) return Qnil;
- if (rb_obj_respond_to(obj, ID_to_eval, Qtrue)) {
+ if (rb_respond_to(obj, ID_to_eval)) {
/* return rb_funcall(obj, ID_to_eval, 0, 0); */
return get_eval_string_core(rb_funcall(obj, ID_to_eval, 0, 0),
enc_flag, self);
- } else if (rb_obj_respond_to(obj, ID_path, Qtrue)) {
+ } else if (rb_respond_to(obj, ID_path)) {
/* return rb_funcall(obj, ID_path, 0, 0); */
return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
enc_flag, self);
- } else if (rb_obj_respond_to(obj, ID_to_s, Qtrue)) {
+ } else if (rb_respond_to(obj, ID_to_s)) {
return rb_funcall(obj, ID_to_s, 0, 0);
}
}
@@ -897,7 +753,7 @@ tk_get_eval_enc_str(self, obj)
static VALUE
tk_conv_args(argc, argv, self)
int argc;
- VALUE *argv; /* [0]:base_array, [1]:enc_mode, [2]..[n]:args */
+ VALUE *argv;
VALUE self;
{
int idx, size;
@@ -905,14 +761,14 @@ tk_conv_args(argc, argv, self)
int thr_crit_bup;
VALUE old_gc;
- if (argc < 2) {
- rb_raise(rb_eArgError, "too few arguments");
- }
-
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
+
old_gc = rb_gc_disable();
+ if (argc < 2) {
+ rb_raise(rb_eArgError, "too few arguments");
+ }
for(size = 0, idx = 2; idx < argc; idx++) {
if (TYPE(argv[idx]) == T_HASH) {
size += 2 * RHASH(argv[idx])->tbl->num_entries;
@@ -966,8 +822,6 @@ tcl2rb_bool(self, value)
value = rb_funcall(value, ID_downcase, 0);
- if (RSTRING(value)->ptr == (char*)NULL) return Qnil;
-
if (RSTRING(value)->ptr[0] == '\0'
|| strcmp(RSTRING(value)->ptr, "0") == 0
|| strcmp(RSTRING(value)->ptr, "no") == 0
@@ -1024,8 +878,6 @@ tkstr_to_number(value)
{
rb_check_type(value, T_STRING);
- if (RSTRING(value)->ptr == (char*)NULL) return INT2FIX(0);
-
return rb_rescue2(tkstr_to_int, value,
tkstr_rescue_float, value,
rb_eArgError, 0);
@@ -1062,8 +914,6 @@ tcl2rb_string(self, value)
{
rb_check_type(value, T_STRING);
- if (RSTRING(value)->ptr == (char*)NULL) return rb_tainted_str_new2("");
-
return tkstr_to_str(value);
}
@@ -1074,8 +924,6 @@ tcl2rb_num_or_str(self, value)
{
rb_check_type(value, T_STRING);
- if (RSTRING(value)->ptr == (char*)NULL) return rb_tainted_str_new2("");
-
return rb_rescue2(tkstr_to_number, value,
tkstr_to_str, value,
rb_eArgError, 0);
@@ -1090,7 +938,6 @@ struct cbsubst_info {
char *type;
ID *ivar;
VALUE proc;
- VALUE aliases;
};
static void
@@ -1098,7 +945,6 @@ subst_mark(ptr)
struct cbsubst_info *ptr;
{
rb_gc_mark(ptr->proc);
- rb_gc_mark(ptr->aliases);
}
static void
@@ -1118,7 +964,7 @@ cbsubst_init()
{
struct cbsubst_info *inf;
ID *ivar;
- volatile VALUE proc, aliases;
+ volatile VALUE proc;
inf = ALLOC(struct cbsubst_info);
@@ -1136,9 +982,6 @@ cbsubst_init()
proc = rb_hash_new();
inf->proc = proc;
- aliases = rb_hash_new();
- inf->aliases = aliases;
-
rb_const_set(cCB_SUBST, ID_SUBST_INFO,
Data_Wrap_Struct(cSUBST_INFO, subst_mark, subst_free, inf));
}
@@ -1150,6 +993,7 @@ cbsubst_initialize(argc, argv, self)
VALUE self;
{
struct cbsubst_info *inf;
+ volatile VALUE proc;
int idx;
Data_Get_Struct(rb_const_get(rb_obj_class(self), ID_SUBST_INFO),
@@ -1171,122 +1015,6 @@ cbsubst_ret_val(self, val)
return val;
}
-static int
-each_attr_def(key, value, klass)
- VALUE key, value, klass;
-{
- ID key_id, value_id;
-
- if (key == Qundef) return ST_CONTINUE;
-
- switch(TYPE(key)) {
- case T_STRING:
- key_id = rb_intern(RSTRING(key)->ptr);
- break;
- case T_SYMBOL:
- key_id = SYM2ID(key);
- break;
- default:
- rb_raise(rb_eArgError,
- "includes invalid key(s). expected a String or a Symbol");
- }
-
- switch(TYPE(value)) {
- case T_STRING:
- value_id = rb_intern(RSTRING(value)->ptr);
- break;
- case T_SYMBOL:
- value_id = SYM2ID(value);
- break;
- default:
- rb_raise(rb_eArgError,
- "includes invalid value(s). expected a String or a Symbol");
- }
-
- rb_alias(klass, key_id, value_id);
-
- return ST_CONTINUE;
-}
-
-static VALUE
-cbsubst_def_attr_aliases(self, tbl)
- VALUE self;
- VALUE tbl;
-{
- struct cbsubst_info *inf;
-
- if (TYPE(tbl) != T_HASH) {
- rb_raise(rb_eArgError, "expected a Hash");
- }
-
- Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
- struct cbsubst_info, inf);
-
- rb_hash_foreach(tbl, each_attr_def, self);
-
- return rb_funcall(inf->aliases, rb_intern("update"), 1, tbl);
-}
-
-static VALUE
-cbsubst_get_subst_arg(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
-{
- struct cbsubst_info *inf;
- char *str, *buf, *ptr;
- int i, j, len;
- ID id;
- volatile VALUE arg_sym, ret;
-
- Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
- struct cbsubst_info, inf);
-
- buf = ALLOC_N(char, 3*argc + 1);
- ptr = buf;
- len = strlen(inf->key);
-
- for(i = 0; i < argc; i++) {
- switch(TYPE(argv[i])) {
- case T_STRING:
- str = RSTRING(argv[i])->ptr;
- arg_sym = ID2SYM(rb_intern(str));
- break;
- case T_SYMBOL:
- arg_sym = argv[i];
- str = rb_id2name(SYM2ID(arg_sym));
- break;
- default:
- rb_raise(rb_eArgError, "arg #%d is not a String or a Symbol", i);
- }
-
- if (!NIL_P(ret = rb_hash_aref(inf->aliases, arg_sym))) {
- str = rb_id2name(SYM2ID(ret));
- }
-
- id = rb_intern(RSTRING(rb_str_cat2(rb_str_new2("@"), str))->ptr);
-
- for(j = 0; j < len; j++) {
- if (inf->ivar[j] == id) break;
- }
-
- if (j >= len) {
- rb_raise(rb_eArgError, "cannot find attribute :%s", str);
- }
-
- *(ptr++) = '%';
- *(ptr++) = *(inf->key + j);
- *(ptr++) = ' ';
- }
-
- *ptr = '\0';
-
- ret = rb_str_new2(buf);
-
- free(buf);
-
- return ret;
-}
static VALUE
cbsubst_get_subst_key(self, str)
@@ -1361,7 +1089,6 @@ cbsubst_table_setup(self, key_inf, proc_inf)
char *type = ALLOC_N(char, len + 1);
ID *ivar = ALLOC_N(ID, len + 1);
volatile VALUE proc = rb_hash_new();
- volatile VALUE aliases = rb_hash_new();
volatile VALUE inf;
/* init */
@@ -1371,7 +1098,6 @@ cbsubst_table_setup(self, key_inf, proc_inf)
subst_inf->type = type;
subst_inf->ivar = ivar;
subst_inf->proc = proc;
- subst_inf->aliases = aliases;
/*
* keys : array of [subst, type, ivar]
@@ -1513,35 +1239,27 @@ tkobj_path(self)
}
/*************************************/
-/* release date */
-const char tkutil_release_date[] = TKUTIL_RELEASE_DATE;
void
Init_tkutil()
{
+ volatile VALUE tmp;
+
VALUE cTK = rb_define_class("TkKernel", rb_cObject);
VALUE mTK = rb_define_module("TkUtil");
/* --------------------- */
-
- rb_define_const(mTK, "RELEASE_DATE",
- rb_obj_freeze(rb_str_new2(tkutil_release_date)));
-
- /* --------------------- */
rb_global_variable(&cMethod);
cMethod = rb_const_get(rb_cObject, rb_intern("Method"));
ID_path = rb_intern("path");
ID_at_path = rb_intern("@path");
- ID_at_enc = rb_intern("@encoding");
ID_to_eval = rb_intern("to_eval");
ID_to_s = rb_intern("to_s");
ID_source = rb_intern("source");
ID_downcase = rb_intern("downcase");
ID_install_cmd = rb_intern("install_cmd");
ID_merge_tklist = rb_intern("_merge_tklist");
- ID_encoding = rb_intern("encoding");
- ID_encoding_system = rb_intern("encoding_system");
ID_call = rb_intern("call");
/* --------------------- */
@@ -1554,8 +1272,6 @@ Init_tkutil()
ID_SUBST_INFO = rb_intern("SUBST_INFO");
rb_define_singleton_method(cCB_SUBST, "ret_val", cbsubst_ret_val, 1);
rb_define_singleton_method(cCB_SUBST, "scan_args", cbsubst_scan_args, 2);
- rb_define_singleton_method(cCB_SUBST, "subst_arg",
- cbsubst_get_subst_arg, -1);
rb_define_singleton_method(cCB_SUBST, "_get_subst_key",
cbsubst_get_subst_key, 1);
rb_define_singleton_method(cCB_SUBST, "_get_all_subst_keys",
@@ -1564,8 +1280,6 @@ Init_tkutil()
cbsubst_table_setup, 2);
rb_define_singleton_method(cCB_SUBST, "_get_extra_args_tbl",
cbsubst_get_extra_args_tbl, 0);
- rb_define_singleton_method(cCB_SUBST, "_define_attribute_aliases",
- cbsubst_def_attr_aliases, 1);
rb_define_method(cCB_SUBST, "initialize", cbsubst_initialize, -1);
@@ -1615,7 +1329,6 @@ Init_tkutil()
tk_get_eval_string, -1);
rb_define_singleton_method(mTK, "_get_eval_enc_str",
tk_get_eval_enc_str, 1);
- rb_define_singleton_method(mTK, "_conv_args", tk_conv_args, -1);
rb_define_singleton_method(mTK, "bool", tcl2rb_bool, 1);
rb_define_singleton_method(mTK, "number", tcl2rb_number, 1);
diff --git a/ext/tk/tkutil/depend b/ext/tk/tkutil/depend
deleted file mode 100644
index fd63e230f0..0000000000
--- a/ext/tk/tkutil/depend
+++ /dev/null
@@ -1 +0,0 @@
-tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tk/tkutil/extconf.rb b/ext/tk/tkutil/extconf.rb
deleted file mode 100644
index e3aa00a4b2..0000000000
--- a/ext/tk/tkutil/extconf.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-if compiled?('tk')
- require 'mkmf'
- create_makefile('tkutil')
-end
diff --git a/ext/win32ole/.cvsignore b/ext/win32ole/.cvsignore
index 4f6430def0..44e7f262dc 100644
--- a/ext/win32ole/.cvsignore
+++ b/ext/win32ole/.cvsignore
@@ -1,4 +1,3 @@
Makefile
mkmf.log
*.log
-.document
diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb
index 8cd9581fb0..c989267733 100644
--- a/ext/win32ole/extconf.rb
+++ b/ext/win32ole/extconf.rb
@@ -1,22 +1,11 @@
#----------------------------------
# extconf.rb
-# $Revision: 1.5.2.2 $
-# $Date: 2005/10/09 02:15:03 $
+# $Revision$
+# $Date$
#----------------------------------
require 'mkmf'
dir_config("win32")
-
-SRCFILES=<<SRC
-win32ole.c
-SRC
-
-def create_docfile(src)
- open(File.expand_path($srcdir) + "/.document", "w") {|ofs|
- ofs.print src
- }
-end
-
def create_win32ole_makefile
if have_library("ole32") and
have_library("oleaut32") and
@@ -26,9 +15,6 @@ def create_win32ole_makefile
have_library("advapi32") and
have_header("windows.h")
create_makefile("win32ole")
- create_docfile(SRCFILES)
- else
- create_docfile("")
end
end
diff --git a/ext/win32ole/sample/olegen.rb b/ext/win32ole/sample/olegen.rb
index ff450f235f..48d86893fe 100644
--- a/ext/win32ole/sample/olegen.rb
+++ b/ext/win32ole/sample/olegen.rb
@@ -1,7 +1,7 @@
#-----------------------------
# olegen.rb
-# $Date: 2002/06/01 12:34:29 $
-# $Revision: 1.1 $
+# $Date$
+# $Revision$
#-----------------------------
require 'win32ole'
diff --git a/ext/win32ole/tests/testNIL2VTEMPTY.rb b/ext/win32ole/tests/testNIL2VTEMPTY.rb
deleted file mode 100644
index 555d35fbf3..0000000000
--- a/ext/win32ole/tests/testNIL2VTEMPTY.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# This is test script to check that WIN32OLE should convert nil to VT_EMPTY in second try.
-# [ruby-talk:137054]
-
-require 'win32ole'
-require 'test/unit'
-
-class TestNIL2VT_EMPTY < Test::Unit::TestCase
- def setup
- fs = WIN32OLE.new('Scripting.FileSystemObject')
- @path = fs.GetFolder(".").path
- end
- def test_openSchema
- con = nil
- begin
- con = WIN32OLE.new('ADODB.Connection')
- con.connectionString = "Provider=MSDASQL;Extended Properties="
- con.connectionString +="\"DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=#{@path}\""
- con.open
- rescue
- con = nil
- end
- if con
- rs = con.openSchema(4, [nil,nil,"DUMMY", "TABLE"])
- assert(rs)
- end
- end
-end
-
diff --git a/ext/win32ole/tests/testOLEEVENT.rb b/ext/win32ole/tests/testOLEEVENT.rb
index 0901158642..15b7ca8413 100644
--- a/ext/win32ole/tests/testOLEEVENT.rb
+++ b/ext/win32ole/tests/testOLEEVENT.rb
@@ -5,8 +5,6 @@ class TestWIN32OLE_EVENT < RUNIT::TestCase
def setup
@excel = WIN32OLE.new("Excel.Application")
@excel.visible = true
- @event = ""
- @event2 = ""
end
def test_on_event
book = @excel.workbooks.Add
@@ -26,62 +24,6 @@ class TestWIN32OLE_EVENT < RUNIT::TestCase
end
assert_equal("OK", value)
end
-
- def handler1
- @event += "handler1"
- end
- def handler2
- @event += "handler2"
- end
-
- def handler3
- @event += "handler3"
- end
-
- def test_on_event2
- book = @excel.workbooks.Add
- begin
- ev = WIN32OLE_EVENT.new(book, 'WorkbookEvents')
- ev.on_event('SheetChange'){|arg1, arg2|
- handler1
- }
- ev.on_event('SheetChange'){|arg1, arg2|
- handler2
- }
- book.Worksheets(1).Range("A1").value = "OK"
- ensure
- book.saved = true
- end
- assert_equal("handler2", @event)
- end
-
- def test_on_event3
- book = @excel.workbooks.Add
- begin
- ev = WIN32OLE_EVENT.new(book, 'WorkbookEvents')
- ev.on_event{ handler1 }
- ev.on_event{ handler2 }
- book.Worksheets(1).Range("A1").value = "OK"
- ensure
- book.saved = true
- end
- assert_equal("handler2", @event)
- end
-
- def test_on_event4
- book = @excel.workbooks.Add
- begin
- ev = WIN32OLE_EVENT.new(book, 'WorkbookEvents')
- ev.on_event{ handler1 }
- ev.on_event{ handler2 }
- ev.on_event('SheetChange'){|arg1, arg2| handler3 }
- book.Worksheets(1).Range("A1").value = "OK"
- ensure
- book.saved = true
- end
- assert_equal("handler3", @event)
- end
-
def teardown
@excel.quit
@excel = nil
diff --git a/ext/win32ole/tests/testOLEMETHOD.rb b/ext/win32ole/tests/testOLEMETHOD.rb
index 390c9999f8..b52052e669 100644
--- a/ext/win32ole/tests/testOLEMETHOD.rb
+++ b/ext/win32ole/tests/testOLEMETHOD.rb
@@ -84,9 +84,4 @@ class TestOLEMETHOD < RUNIT::TestCase
m = WIN32OLE_METHOD.new(@excel_app, 'QueryInterface')
assert_equal(0, m.offset_vtbl)
end
- def test_dispid
- tobj = WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation', 'FolderItem2')
- method = WIN32OLE_METHOD.new(tobj, 'InvokeVerb')
- assert_equal(1610743824, method.dispid)
- end
end
diff --git a/ext/win32ole/tests/testOLEPARAM.rb b/ext/win32ole/tests/testOLEPARAM.rb
index 4014fadbfc..685b548aa5 100644
--- a/ext/win32ole/tests/testOLEPARAM.rb
+++ b/ext/win32ole/tests/testOLEPARAM.rb
@@ -62,4 +62,13 @@ class TestOLEPARAM < RUNIT::TestCase
f = methods.find {|m| m.name == 'SaveAs'}
assert(f.params[0].optional?)
end
+ def test_ole_type_detail
+ classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
+ methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
+ f = methods.find {|m| m.name == 'SaveAs'}
+ assert_equal(nil, f.params[0].default)
+ methods = classes.find {|c| c.name == 'Workbook'}.ole_methods
+ f = methods.find {|m| m.name == 'SaveAs'}
+ assert_equal(1, f.params[6].default)
+ end
end
diff --git a/ext/win32ole/tests/testWIN32OLE.rb b/ext/win32ole/tests/testWIN32OLE.rb
index 5c01507377..d8c3b6e6ba 100644
--- a/ext/win32ole/tests/testWIN32OLE.rb
+++ b/ext/win32ole/tests/testWIN32OLE.rb
@@ -40,7 +40,7 @@ class TestWin32OLE < RUNIT::TestCase
exc = assert_exception(WIN32OLERuntimeError) {
WIN32OLE.new("{000}")
}
- assert_match(/unknown OLE server: `\{000\}'/, exc.message)
+ assert_match(/Unknown OLE server: `\{000\}'/, exc.message)
end
def test_s_connect
excel2 = WIN32OLE.connect('Excel.Application')
@@ -57,60 +57,6 @@ class TestWin32OLE < RUNIT::TestCase
assert_equal(-4160, CONST1::XlTop)
end
- def test_s_codepage
- assert_equal(WIN32OLE::CP_ACP, WIN32OLE.codepage)
- end
-
- def test_s_codepage_set
- WIN32OLE.codepage = WIN32OLE::CP_UTF8
- assert_equal(WIN32OLE::CP_UTF8, WIN32OLE.codepage)
- WIN32OLE.codepage = WIN32OLE::CP_ACP
- end
-
- def test_const_CP_ACP
- assert_equal(0, WIN32OLE::CP_ACP)
- end
-
- def test_const_CP_OEMCP
- assert_equal(1, WIN32OLE::CP_OEMCP)
- end
-
- def test_const_CP_MACCP
- assert_equal(2, WIN32OLE::CP_MACCP)
- end
-
- def test_const_CP_THREAD_ACP
- assert_equal(3, WIN32OLE::CP_THREAD_ACP)
- end
-
- def test_const_CP_SYMBOL
- assert_equal(42, WIN32OLE::CP_SYMBOL)
- end
-
- def test_const_CP_UTF7
- assert_equal(65000, WIN32OLE::CP_UTF7)
- end
-
- def test_const_CP_UTF8
- assert_equal(65001, WIN32OLE::CP_UTF8)
- end
-
- def test_s_codepage_changed
- book = @excel.workbooks.add
- sheet = book.worksheets(1)
- begin
- WIN32OLE.codepage = WIN32OLE::CP_UTF8
- sheet.range("A1").value = [0x3042].pack("U*")
- val = sheet.range("A1").value
- assert_equal("\343\201\202", val)
- WIN32OLE.codepage = WIN32OLE::CP_ACP
- val = sheet.range("A1").value
- assert_equal("\202\240", val)
- ensure
- book.saved = true
- end
- end
-
def test_get_win32ole_object
workbooks = @excel.Workbooks;
assert_instance_of(WIN32OLE, workbooks)
@@ -142,7 +88,6 @@ class TestWin32OLE < RUNIT::TestCase
assert_equal(10, sheet.range("A1").value)
sheet['Cells', 1, 2] = 10
assert_equal(10, sheet.range("B1").value)
- assert_equal(10, sheet['Cells', 1, 2].value)
ensure
book.saved = true
end
@@ -304,11 +249,6 @@ class TestWin32OLE_WITH_MSI < RUNIT::TestCase
@record[ "StringData", 1 ] = 'ffff'
assert_equal('ffff', @record.StringData(1))
end
-
- def test__invoke
- shell=WIN32OLE.new('Shell.Application')
- assert_equal(shell.NameSpace(0).title, shell._invoke(0x60020002, [0], [WIN32OLE::VARIANT::VT_VARIANT]).title)
- end
end
# ---------------------
diff --git a/ext/win32ole/tests/test_ole_methods.rb b/ext/win32ole/tests/test_ole_methods.rb
deleted file mode 100644
index ca1c03b010..0000000000
--- a/ext/win32ole/tests/test_ole_methods.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# This is test for [ruby-talk:196897]
-#
-begin
- require 'win32ole'
-rescue LoadError
-end
-require "test/unit"
-
-if defined?(WIN32OLE)
- class TestWIN32OLE_FOR_PROPERTYPUTREF < Test::Unit::TestCase
-
- def setup
- @obj = WIN32OLE.new('Scripting.Dictionary')
- end
-
- def test_ole_methods
- x = @obj.ole_methods.select {|m|
- m.invoke_kind == 'PROPERTYPUTREF'
- }
- assert(x.size > 0)
- assert_equal(1, x.size)
- assert_equal('Item', x[0].name)
- end
-
- def test_ole_put_methods
- x = @obj.ole_put_methods.select {|m|
- m.invoke_kind == 'PROPERTYPUTREF'
- }
- assert(x.size > 0)
- assert_equal(1, x.size)
- assert_equal('Item', x[0].name)
- end
-
- end
-end
diff --git a/ext/win32ole/tests/test_propertyputref.rb b/ext/win32ole/tests/test_propertyputref.rb
deleted file mode 100644
index befc35ca9c..0000000000
--- a/ext/win32ole/tests/test_propertyputref.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'test/unit'
-require 'win32ole'
-
-class TestWIN32OLE_PROPERTYPUTREF < Test::Unit::TestCase
- def setup
- begin
- @sapi = WIN32OLE.new('SAPI.SpVoice')
- rescue WIN32OLERuntimeError
- @sapi = nil
- end
- end
- def test_sapi
- if @sapi
- new_id = @sapi.getvoices.item(2).Id
- @sapi.voice = @sapi.getvoices.item(2)
- assert_equal(new_id, @sapi.voice.Id)
- end
- end
-end
diff --git a/ext/win32ole/tests/test_word.rb b/ext/win32ole/tests/test_word.rb
deleted file mode 100644
index 53a6c521ba..0000000000
--- a/ext/win32ole/tests/test_word.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# This is test for [ruby-Bugs#3237]
-#
-begin
- require 'win32ole'
-rescue LoadError
-end
-require "test/unit"
-
-if defined?(WIN32OLE)
- class TestWIN32OLE_WITH_WORD < Test::Unit::TestCase
-
- def setup
- begin
- @obj = WIN32OLE.new('Word.Application')
- rescue WIN32OLERuntimeError
- @obj = nil
- end
- end
-
- def test_ole_methods
- if @obj
- @obj.visible = true
- @obj.wordbasic.disableAutoMacros(true)
- assert(true)
- end
- end
-
- def teardown
- if @obj
- @obj.quit
- @obj = nil
- end
- end
-
- end
-end
diff --git a/ext/win32ole/tests/testall.rb b/ext/win32ole/tests/testall.rb
index d45541f571..17bae2c810 100644
--- a/ext/win32ole/tests/testall.rb
+++ b/ext/win32ole/tests/testall.rb
@@ -8,8 +8,4 @@ require "testOLEPARAM"
require "testOLEMETHOD"
require "testOLEVARIABLE"
require "testVARIANT"
-require "testNIL2VTEMPTY"
-require "test_ole_methods.rb"
-require "test_propertyputref.rb"
-require "test_word.rb"
# require "testOLEEVENT"
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 9a55708498..7a800986b5 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -12,7 +12,7 @@
*/
/*
- $Date: 2007/01/13 22:34:25 $
+ $Date$
modified for win32ole (ruby) by Masaki.Suketa <masaki.suketa@nifty.ne.jp>
*/
@@ -72,13 +72,13 @@
#define OLEData_Get_Struct(obj, pole) {\
Data_Get_Struct(obj, struct oledata, pole);\
if(!pole->pDispatch) {\
- rb_raise(rb_eRuntimeError, "failed to get Dispatch Interface");\
+ rb_raise(rb_eRuntimeError, "Failed to get Dispatch Interface");\
}\
}
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-#define WIN32OLE_VERSION "0.7.1"
+#define WIN32OLE_VERSION "0.5.9"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -134,7 +134,6 @@ typedef struct tagIEVENTSINKOBJ {
DWORD m_dwCookie;
IConnectionPoint *pConnectionPoint;
ITypeInfo *pTypeInfo;
- int *ptr_freed;
}IEVENTSINKOBJ, *PIEVENTSINKOBJ;
VALUE cWIN32OLE;
@@ -154,8 +153,6 @@ static HINSTANCE gole32 = NULL;
static FNCOCREATEINSTANCEEX *gCoCreateInstanceEx = NULL;
static VALUE com_hash;
static IDispatchVtbl com_vtbl;
-static UINT cWIN32OLE_cp = CP_ACP;
-static VARTYPE g_nil_to = VT_ERROR;
struct oledata {
IDispatch *pDispatch;
@@ -184,7 +181,6 @@ struct oleparamdata {
struct oleeventdata {
IEVENTSINKOBJ *pEvent;
- int freed;
};
struct oleparam {
@@ -474,10 +470,10 @@ ole_wc2mb(pw)
{
int size;
LPSTR pm;
- size = WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, NULL, 0, NULL, NULL);
+ size = WideCharToMultiByte(CP_ACP, 0, pw, -1, NULL, 0, NULL, NULL);
if (size) {
pm = ALLOC_N(char, size);
- WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, pm, size, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, pw, -1, pm, size, NULL, NULL);
}
else {
pm = ALLOC_N(char, 1);
@@ -607,7 +603,7 @@ ole_initialize()
if(gOLEInitialized == Qfalse) {
hr = OleInitialize(NULL);
if(FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "fail: OLE initialize");
+ ole_raise(hr, rb_eRuntimeError, "Fail: OLE initialize");
}
gOLEInitialized = Qtrue;
/*
@@ -633,7 +629,6 @@ ole_free(pole)
struct oledata *pole;
{
OLE_FREE(pole->pDispatch);
- free(pole);
}
static void
@@ -641,7 +636,6 @@ oletype_free(poletype)
struct oletypedata *poletype;
{
OLE_FREE(poletype->pTypeInfo);
- free(poletype);
}
static void
@@ -650,7 +644,6 @@ olemethod_free(polemethod)
{
OLE_FREE(polemethod->pTypeInfo);
OLE_FREE(polemethod->pOwnerTypeInfo);
- free(polemethod);
}
static void
@@ -658,7 +651,6 @@ olevariable_free(polevar)
struct olevariabledata *polevar;
{
OLE_FREE(polevar->pTypeInfo);
- free(polevar);
}
static void
@@ -666,7 +658,6 @@ oleparam_free(pole)
struct oleparamdata *pole;
{
OLE_FREE(pole->pTypeInfo);
- free(pole);
}
static LPWSTR
@@ -676,9 +667,9 @@ ole_mb2wc(pm, len)
{
int size;
LPWSTR pw;
- size = MultiByteToWideChar(cWIN32OLE_cp, 0, pm, len, NULL, 0);
+ size = MultiByteToWideChar(CP_ACP, 0, pm, len, NULL, 0);
pw = SysAllocStringLen(NULL, size - 1);
- MultiByteToWideChar(cWIN32OLE_cp, 0, pm, len, pw, size);
+ MultiByteToWideChar(CP_ACP, 0, pm, len, pw, size);
return pw;
}
@@ -840,12 +831,8 @@ ole_val2variant(val, var)
V_BOOL(var) = VARIANT_FALSE;
break;
case T_NIL:
- if (g_nil_to == VT_ERROR) {
- V_VT(var) = VT_ERROR;
- V_ERROR(var) = DISP_E_PARAMNOTFOUND;
- }else {
- V_VT(var) = VT_EMPTY;
- }
+ V_VT(var) = VT_ERROR;
+ V_ERROR(var) = DISP_E_PARAMNOTFOUND;
break;
default:
V_VT(var) = VT_DISPATCH;
@@ -854,16 +841,6 @@ ole_val2variant(val, var)
}
}
-static void
-ole_val2variant2(val, var)
- VALUE val;
- VARIANT *var;
-{
- g_nil_to = VT_EMPTY;
- ole_val2variant(val, var);
- g_nil_to = VT_ERROR;
-}
-
static VALUE
ole_set_member(self, dispatch)
VALUE self;
@@ -920,13 +897,8 @@ ole_variant2val(pvar)
VARIANT variant;
VALUE val;
VALUE val2;
- int dim = 0;
-
- if (!psa) {
- return obj;
- }
- dim = SafeArrayGetDim(psa);
+ int dim = SafeArrayGetDim(psa);
VariantInit(&variant);
V_VT(&variant) = (V_VT(pvar) & ~VT_ARRAY) | VT_BYREF;
@@ -1115,7 +1087,6 @@ ole_variant2val(pvar)
return obj;
}
-
static LONG reg_open_key(hkey, name, phkey)
HKEY hkey;
const char *name;
@@ -1393,12 +1364,12 @@ ole_create_dcom(argc, argv, self)
if (!gole32)
gole32 = LoadLibrary("OLE32");
if (!gole32)
- rb_raise(rb_eRuntimeError, "failed to load OLE32");
+ rb_raise(rb_eRuntimeError, "Failed to load OLE32");
if (!gCoCreateInstanceEx)
gCoCreateInstanceEx = (FNCOCREATEINSTANCEEX*)
GetProcAddress(gole32, "CoCreateInstanceEx");
if (!gCoCreateInstanceEx)
- rb_raise(rb_eRuntimeError, "CoCreateInstanceEx is not supported in this environment");
+ rb_raise(rb_eRuntimeError, "CoCreateInstanceEx is not supported in this environment.");
rb_scan_args(argc, argv, "2*", &ole, &host, &others);
pbuf = ole_mb2wc(StringValuePtr(ole), -1);
@@ -1410,7 +1381,7 @@ ole_create_dcom(argc, argv, self)
SysFreeString(pbuf);
if (FAILED(hr))
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "unknown OLE server: `%s'",
+ "Unknown OLE server: `%s'",
StringValuePtr(ole));
memset(&serverinfo, 0, sizeof(COSERVERINFO));
serverinfo.pwszName = ole_mb2wc(StringValuePtr(host), -1);
@@ -1420,7 +1391,7 @@ ole_create_dcom(argc, argv, self)
SysFreeString(serverinfo.pwszName);
if (FAILED(hr))
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to create DCOM server `%s' in `%s'",
+ "Failed to create DCOM server `%s' in `%s'",
StringValuePtr(ole),
StringValuePtr(host));
@@ -1447,7 +1418,7 @@ ole_bind_obj(moniker, argc, argv, self)
hr = CreateBindCtx(0, &pBindCtx);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to create bind context");
+ "Failed to create bind context");
}
pbuf = ole_mb2wc(StringValuePtr(moniker), -1);
@@ -1456,7 +1427,7 @@ ole_bind_obj(moniker, argc, argv, self)
if(FAILED(hr)) {
OLE_RELEASE(pBindCtx);
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to parse display name of moniker `%s'",
+ "Failed to parse display name of moniker `%s'",
StringValuePtr(moniker));
}
hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL,
@@ -1467,20 +1438,17 @@ ole_bind_obj(moniker, argc, argv, self)
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to bind moniker `%s'",
+ "Failed to bind moniker `%s'",
StringValuePtr(moniker));
}
return create_win32ole_object(self, pDispatch, argc, argv);
}
/*
- * call-seq:
- * WIN32OLE.connect( ole ) --> aWIN32OLE
- *
- * Returns running OLE Automation object or WIN32OLE object from moniker.
- * 1st argument should be OLE program id or class id or moniker.
- *
- * WIN32OLE.connect('Excel.Application') # => WIN32OLE object which represents running Excel.
+ * WIN32OLE.connect( ole ) --> aWIN32OLE
+ * ----
+ * Returns running OLE Automation object or WIN32OLE object from moniker.
+ * 1st argument should be OLE program id or class id or moniker.
*/
static VALUE
fole_s_connect(argc, argv, self)
@@ -1527,7 +1495,7 @@ fole_s_connect(argc, argv, self)
if(FAILED(hr)) {
OLE_RELEASE(pUnknown);
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to create WIN32OLE server `%s'",
+ "Failed to create WIN32OLE server `%s'",
StringValuePtr(svr_name));
}
@@ -1537,33 +1505,10 @@ fole_s_connect(argc, argv, self)
}
/*
- * call-seq:
- * WIN32OLE.const_load( ole, mod = WIN32OLE)
- *
- * Defines the constants of OLE Automation server as mod's constants.
- * The first argument is WIN32OLE object or type library name.
- * If 2nd argument is omitted, the default is WIN32OLE.
- * The first letter of Ruby's constant variable name is upper case,
- * so constant variable name of WIN32OLE object is capitalized.
- * For example, the 'xlTop' constant of Excel is changed to 'XlTop'
- * in WIN32OLE.
- * If the first letter of constant variabl is not [A-Z], then
- * the constant is defined as CONSTANTS hash element.
- *
- * module EXCEL_CONST
- * end
- * excel = WIN32OLE.new('Excel.Application')
- * WIN32OLE.const_load(excel, EXCEL_CONST)
- * puts EXCEL_CONST::XlTop # => -4160
- * puts EXCEL_CONST::CONSTANTS['_xlDialogChartSourceData'] # => 541
- *
- * WIN32OLE.const_load(excel)
- * puts WIN32OLE::XlTop # => -4160
- *
- * module MSO
- * end
- * WIN32OLE.const_load('Microsoft Office 9.0 Object Library', MSO)
- * puts MSO::MsoLineSingle # => 1
+ * WIN32OLE.const_load( ole, mod = WIN32OLE)
+ * ----
+ * Defines the constants of OLE Automation server as mod's constants.
+ * If 2nd argument is omitted, the default is WIN32OLE.
*/
static VALUE
fole_s_const_load(argc, argv, self)
@@ -1587,19 +1532,19 @@ fole_s_const_load(argc, argv, self)
if (TYPE(klass) != T_CLASS &&
TYPE(klass) != T_MODULE &&
TYPE(klass) != T_NIL) {
- rb_raise(rb_eTypeError, "2nd parameter must be Class or Module");
+ rb_raise(rb_eTypeError, "2nd paramator must be Class or Module.");
}
if (rb_obj_is_kind_of(ole, cWIN32OLE)) {
OLEData_Get_Struct(ole, pole);
hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
0, lcid, &pTypeInfo);
if(FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to GetTypeInfo");
+ ole_raise(hr, rb_eRuntimeError, "Failed to GetTypeInfo");
}
hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &index);
if(FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
- ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib");
+ ole_raise(hr, rb_eRuntimeError, "Failed to GetContainingTypeLib");
}
OLE_RELEASE(pTypeInfo);
if(TYPE(klass) != T_NIL) {
@@ -1619,7 +1564,7 @@ fole_s_const_load(argc, argv, self)
hr = LoadTypeLibEx(pBuf, REGKIND_NONE, &pTypeLib);
SysFreeString(pBuf);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to LoadTypeLibEx");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to LoadTypeLibEx");
if(TYPE(klass) != T_NIL) {
ole_const_load(pTypeLib, klass, self);
}
@@ -1629,7 +1574,7 @@ fole_s_const_load(argc, argv, self)
OLE_RELEASE(pTypeLib);
}
else {
- rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE instance");
+ rb_raise(rb_eTypeError, "1st paramator must be WIN32OLE instance");
}
return Qnil;
}
@@ -1681,12 +1626,11 @@ reference_count(pole)
}
/*
- * call-seq:
- * WIN32OLE.ole_reference_count(aWIN32OLE) --> number
- *
- * Returns reference counter of Dispatch interface of WIN32OLE object.
- * You should not use this method because this method
- * exists only for debugging WIN32OLE.
+ * WIN32OLE.ole_reference_count(aWIN32OLE) --> number
+ * ----
+ * Returns reference counter of Dispatch interface of WIN32OLE object.
+ * You should not use this method because this method
+ * exists only for debugging WIN32OLE.
*/
static VALUE
fole_s_reference_count(self, obj)
@@ -1699,13 +1643,12 @@ fole_s_reference_count(self, obj)
}
/*
- * call-seq:
- * WIN32OLE.ole_free(aWIN32OLE) --> number
- *
- * Invokes Release method of Dispatch interface of WIN32OLE object.
- * You should not use this method because this method
- * exists only for debugging WIN32OLE.
- * The return value is reference counter of OLE object.
+ * WIN32OLE.ole_free(aWIN32OLE) --> number
+ * ----
+ * Invokes Release method of Dispatch interface of WIN32OLE object.
+ * You should not use this method because this method
+ * exists only for debugging WIN32OLE.
+ * The return value is reference counter of OLE object.
*/
static VALUE
fole_s_free(self, obj)
@@ -1747,15 +1690,10 @@ ole_show_help(helpfile, helpcontext)
}
/*
- * call-seq:
- * WIN32OLE.ole_show_help(obj [,helpcontext])
- *
- * Displays helpfile. The 1st argument specifies WIN32OLE_TYPE
- * object or WIN32OLE_METHOD object or helpfile.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * typeobj = excel.ole_type
- * WIN32OLE.ole_show_help(typeobj)
+ * WIN32OLE.ole_show_help(obj [,helpcontext])
+ * ----
+ * Displays helpfile. The 1st argument specifies WIN32OLE_TYPE
+ * object or WIN32OLE_METHOD object or helpfile.
*/
static VALUE
fole_s_show_help(argc, argv, self)
@@ -1782,84 +1720,16 @@ fole_s_show_help(argc, argv, self)
helpfile = target;
}
if (TYPE(helpfile) != T_STRING) {
- rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)");
+ rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD).");
}
hwnd = ole_show_help(helpfile, helpcontext);
if(hwnd == 0) {
- rb_raise(rb_eRuntimeError, "failed to open help file `%s'",
+ rb_raise(rb_eRuntimeError, "Failed to open help file `%s'",
StringValuePtr(helpfile));
}
return Qnil;
}
-/*
- * call-seq:
- * WIN32OLE.codepage
- *
- * Returns current codepage.
- * WIN32OLE.codepage # => WIN32OLE::CP_ACP
- */
-static VALUE
-fole_s_get_code_page(self)
- VALUE self;
-{
- return INT2FIX(cWIN32OLE_cp);
-}
-
-/*
- * call-seq:
- * WIN32OLE.codepage = CP
- *
- * Sets current codepage.
- * WIN32OLE.codepage = WIN32OLE::CP_UTF8
- */
-static VALUE
-fole_s_set_code_page(self, vcp)
- VALUE self;
- VALUE vcp;
-{
- UINT cp = FIX2INT(vcp);
-
- switch(cp) {
- case CP_ACP:
- case CP_OEMCP:
- case CP_MACCP:
- case CP_THREAD_ACP:
- case CP_SYMBOL:
- case CP_UTF7:
- case CP_UTF8:
- cWIN32OLE_cp = cp;
- break;
- default:
- rb_raise(eWIN32OLE_RUNTIME_ERROR, "codepage should be WIN32OLE::CP_ACP, WIN32OLE::CP_OEMCP, WIN32OLE::CP_MACCP, WIN32OLE::CP_THREAD_ACP, WIN32OLE::CP_SYMBOL, WIN32OLE::CP_UTF7, WIN32OLE::CP_UTF8");
- break;
- }
-
- /*
- * Should this method return old codepage?
- */
- return Qnil;
-}
-
-/*
- * Document-class: WIN32OLE
- *
- * <code>WIN32OLE</code> objects represent OLE Automation object in Ruby.
- */
-
-/*
- * call-seq:
- * WIN32OLE.new(server, [host]) -> WIN32OLE object
- *
- * Returns a new WIN32OLE object(OLE Automation object).
- * The first argument server specifies OLE Automation server.
- * The first argument should be CLSID or PROGID.
- * If second argument host specified, then returns OLE Automation
- * object on host.
- *
- * WIN32OLE.new('Excel.Application') # => Excel OLE Automation WIN32OLE object.
- * WIN32OLE.new('{00024500-0000-0000-C000-000000000046}') # => Excel OLE Automation WIN32OLE object.
- */
static VALUE
fole_initialize(argc, argv, self)
int argc;
@@ -1899,7 +1769,7 @@ fole_initialize(argc, argv, self)
SysFreeString(pBuf);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "unknown OLE server: `%s'",
+ "Unknown OLE server: `%s'",
StringValuePtr(svr_name));
}
@@ -1908,7 +1778,7 @@ fole_initialize(argc, argv, self)
&IID_IDispatch, (void**)&pDispatch);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to create WIN32OLE object from `%s'",
+ "Failed to create WIN32OLE object from `%s'",
StringValuePtr(svr_name));
}
@@ -2009,7 +1879,7 @@ ole_invoke(argc, argv, self, wFlags)
rb_scan_args(argc, argv, "1*", &cmd, &paramS);
OLEData_Get_Struct(self, pole);
if(!pole->pDispatch) {
- rb_raise(rb_eRuntimeError, "failed to get dispatch interface");
+ rb_raise(rb_eRuntimeError, "Failed to get dispatch interface");
}
wcmdname = ole_mb2wc(StringValuePtr(cmd), -1);
hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
@@ -2017,7 +1887,7 @@ ole_invoke(argc, argv, self, wFlags)
SysFreeString(wcmdname);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "unknown property or method `%s'",
+ "Unknown property or method `%s'",
StringValuePtr(cmd));
}
@@ -2054,7 +1924,7 @@ ole_invoke(argc, argv, self, wFlags)
VariantClear(&op.dp.rgvarg[i]);
}
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "failed to get named argument info: `%s'",
+ "Failed to get named argument info: `%s'",
StringValuePtr(cmd));
}
op.dp.rgdispidNamedArgs = &(pDispID[1]);
@@ -2111,44 +1981,24 @@ ole_invoke(argc, argv, self, wFlags)
&IID_NULL, lcid, wFlags,
&op.dp, &result,
&excepinfo, &argErr);
-
- /* mega kludge. if a method in WORD is called and we ask
- * for a result when one is not returned then
- * hResult == DISP_E_EXCEPTION. this only happens on
- * functions whose DISPID > 0x8000 */
- if ((hr == DISP_E_EXCEPTION || hr == DISP_E_MEMBERNOTFOUND) && DispID > 0x8000) {
- memset(&excepinfo, 0, sizeof(EXCEPINFO));
- hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
- &IID_NULL, lcid, wFlags,
- &op.dp, NULL,
- &excepinfo, &argErr);
- }
for(i = cNamedArgs; i < op.dp.cArgs; i++) {
n = op.dp.cArgs - i + cNamedArgs - 1;
VariantClear(&op.dp.rgvarg[n]);
}
}
- if (FAILED(hr)) {
- /* retry after converting nil to VT_EMPTY */
- if (op.dp.cArgs > cNamedArgs) {
- for(i = cNamedArgs; i < op.dp.cArgs; i++) {
- n = op.dp.cArgs - i + cNamedArgs - 1;
- param = rb_ary_entry(paramS, i-cNamedArgs);
- ole_val2variant2(param, &op.dp.rgvarg[n]);
- }
- memset(&excepinfo, 0, sizeof(EXCEPINFO));
- VariantInit(&result);
- hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
- &IID_NULL, lcid, wFlags,
- &op.dp, &result,
- &excepinfo, &argErr);
- for(i = cNamedArgs; i < op.dp.cArgs; i++) {
- n = op.dp.cArgs - i + cNamedArgs - 1;
- VariantClear(&op.dp.rgvarg[n]);
- }
- }
- }
+ /* mega kludge. if a method in WORD is called and we ask
+ * for a result when one is not returned then
+ * hResult == DISP_E_EXCEPTION. this only happens on
+ * functions whose DISPID > 0x8000 */
+ if (hr == DISP_E_EXCEPTION && DispID > 0x8000) {
+ memset(&excepinfo, 0, sizeof(EXCEPINFO));
+ VariantInit(&result);
+ hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID,
+ &IID_NULL, lcid, wFlags,
+ &op.dp, &result,
+ &excepinfo, &argErr);
+ }
}
/* clear dispatch parameter */
if(op.dp.cArgs > cNamedArgs) {
@@ -2170,19 +2020,6 @@ ole_invoke(argc, argv, self, wFlags)
return obj;
}
-/*
- * call-seq:
- * WIN32OLE#invoke(method, [arg1,...]) => return value of method.
- *
- * Runs OLE method.
- * The first argument specifies the method name of OLE Automation object.
- * The others specify argument of the <i>method</i>.
- * If you can not execute <i>method</i> directly, then use this method instead.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * excel.invoke('Quit') # => same as excel.Quit
- *
- */
static VALUE
fole_invoke(argc, argv, self)
int argc;
@@ -2364,7 +2201,7 @@ ole_invoke2(self, dispid, args, types, dispkind)
dispParams.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT;
}
- hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, NUM2INT(dispid),
+ hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, FIX2INT(dispid),
&IID_NULL, LOCALE_SYSTEM_DEFAULT,
dispkind,
&dispParams, &result,
@@ -2387,16 +2224,12 @@ ole_invoke2(self, dispid, args, types, dispkind)
}
/*
- * call-seq:
- * WIN32OLE#_invoke(dispid, args, types)
- *
- * Runs the early binding method.
- * The 1st argument specifies dispatch ID,
- * the 2nd argument specifies the array of arguments,
- * the 3rd argument specifies the array of the type of arguments.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * excel._invoke(302, [], []) # same effect as excel.Quit
+ * WIN32OLE#_invoke(dispid, args, types)
+ * ----
+ * Runs the early binding method.
+ * The 1st argument specifies dispatch ID,
+ * the 2nd argument specifies the array of arguments,
+ * the 3rd argument specifies the array of the type of arguments.
*/
static VALUE
fole_invoke2(self, dispid, args, types)
@@ -2409,16 +2242,12 @@ fole_invoke2(self, dispid, args, types)
}
/*
- * call-seq:
- * WIN32OLE#_getproperty(dispid, args, types)
- *
- * Runs the early binding method to get property.
- * The 1st argument specifies dispatch ID,
- * the 2nd argument specifies the array of arguments,
- * the 3rd argument specifies the array of the type of arguments.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * puts excel._getproperty(558, [], []) # same effect as puts excel.visible
+ * WIN32OLE#_getproperty(dispid, args, types)
+ * ----
+ * Runs the early binding method to get property.
+ * The 1st argument specifies dispatch ID,
+ * the 2nd argument specifies the array of arguments,
+ * the 3rd argument specifies the array of the type of arguments.
*/
static VALUE
fole_getproperty2(self, dispid, args, types)
@@ -2431,16 +2260,12 @@ fole_getproperty2(self, dispid, args, types)
}
/*
- * call-seq:
- * WIN32OLE#_setproperty(dispid, args, types)
- *
- * Runs the early binding method to set property.
- * The 1st argument specifies dispatch ID,
- * the 2nd argument specifies the array of arguments,
- * the 3rd argument specifies the array of the type of arguments.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * excel._setproperty(558, [true], [WIN32OLE::VARIANT::VT_BOOL]) # same effect as excel.visible = true
+ * WIN32OLE#_setproperty(dispid, args, types)
+ * ----
+ * Runs the early binding method to set property.
+ * The 1st argument specifies dispatch ID,
+ * the 2nd argument specifies the array of arguments,
+ * the 3rd argument specifies the array of the type of arguments.
*/
static VALUE
fole_setproperty2(self, dispid, args, types)
@@ -2453,18 +2278,12 @@ fole_setproperty2(self, dispid, args, types)
}
/*
- * call-seq:
- * WIN32OLE['property']=val
- * WIN32OLE.setproperty('property', [arg1, arg2,...] val)
- *
- * Sets property of OLE object.
- * When you want to set property with argument, you can use this method.
+ * WIN32OLE['property']=val
*
- * excel = WIN32OLE.new('Excel.Application')
- * excel['Visible'] = true
- * book = excel.workbooks.add
- * sheet = book.worksheets(1)
- * sheet.setproperty('Cells', 1, 2, 10) # => The B1 cell value is 10.
+ * WIN32OLE.setproperty('property', [arg1, arg2,] val)
+ * -----
+ * Sets property of OLE object.
+ * When you want to set property with argument, you can use setproperty method.
*/
static VALUE
fole_setproperty(argc, argv, self)
@@ -2476,21 +2295,15 @@ fole_setproperty(argc, argv, self)
}
/*
- * call-seq:
- * WIN32OLE['property']
- *
- * Returns property of OLE object.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * puts excel['Visible'] # => false
+ * WIN32OLE['property']
+ * -----
+ * Returns property of OLE object.
*/
static VALUE
-fole_getproperty(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+fole_getproperty(self, property)
+ VALUE self, property;
{
- return ole_invoke(argc, argv, self, DISPATCH_PROPERTYGET);
+ return ole_invoke(1, &property, self, DISPATCH_PROPERTYGET);
}
static VALUE
@@ -2504,7 +2317,7 @@ ole_propertyput(self, property, value)
EXCEPINFO excepinfo;
DISPID dispID = DISPID_VALUE;
DISPID dispIDParam = DISPID_PROPERTYPUT;
- USHORT wFlags = DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF;
+ USHORT wFlags = DISPATCH_PROPERTYPUT;
DISPPARAMS dispParams;
VARIANTARG propertyValue[2];
OLECHAR* pBuf[1];
@@ -2530,7 +2343,7 @@ ole_propertyput(self, property, value)
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
- "unknown property or method: `%s'",
+ "Unknown property or method: `%s'",
StringValuePtr(property));
}
/* set property value */
@@ -2549,15 +2362,6 @@ ole_propertyput(self, property, value)
return Qnil;
}
-/*
- * call-seq:
- * WIN32OLE#ole_free
- *
- * invokes Release method of Dispatch interface of WIN32OLE object.
- * Usually, you do not need to call this method because Release method
- * called automatically when WIN32OLE object garbaged.
- *
- */
static VALUE
fole_free(self)
VALUE self;
@@ -2597,18 +2401,9 @@ ole_ienum_free(pEnumV)
}
/*
- * call-seq:
- * WIN32OLE#each {|i|...}
- *
- * Iterates over each item of OLE collection which has IEnumVARIANT interface.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * book = excel.workbooks.add
- * sheets = book.worksheets(1)
- * cells = sheets.cells("A1:A5")
- * cells.each do |cell|
- * cell.value = 10
- * end
+ * WIN32OLE#each {|i|...}
+ * -----
+ * Iterates over each item of OLE collection which has IEnumVARIANT interface.
*/
static VALUE
fole_each(self)
@@ -2641,7 +2436,7 @@ fole_each(self)
if (FAILED(hr)) {
VariantClear(&result);
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to get IEnum Interface");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to get IEnum Interface");
}
if (V_VT(&result) == VT_UNKNOWN)
@@ -2654,7 +2449,7 @@ fole_each(self)
(void**)&pEnum);
if (FAILED(hr) || !pEnum) {
VariantClear(&result);
- ole_raise(hr, rb_eRuntimeError, "failed to get IEnum Interface");
+ ole_raise(hr, rb_eRuntimeError, "Failed to get IEnum Interface");
}
VariantClear(&result);
@@ -2663,10 +2458,9 @@ fole_each(self)
}
/*
- * call-seq:
- * WIN32OLE#method_missing(id [,arg1, arg2, ...])
- *
- * Calls WIN32OLE#invoke method.
+ * WIN32OLE#method_missing(id [,arg1, arg2, ...])
+ * ----
+ * Calls WIN32OLE#invoke method.
*/
static VALUE
fole_missing(argc, argv, self)
@@ -2680,7 +2474,7 @@ fole_missing(argc, argv, self)
id = rb_to_id(argv[0]);
mname = rb_id2name(id);
if(!mname) {
- rb_raise(rb_eRuntimeError, "fail: unknown method or property");
+ rb_raise(rb_eRuntimeError, "Fail: unknown method or property");
}
n = strlen(mname);
if(mname[n-1] == '=') {
@@ -2710,7 +2504,7 @@ ole_method_sub(self, pOwnerTypeInfo, pTypeInfo, name)
VALUE method = Qnil;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
}
for(i = 0; i < pTypeAttr->cFuncs && method == Qnil; i++) {
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
@@ -2749,7 +2543,7 @@ olemethod_from_typeinfo(self, pTypeInfo, name)
VALUE method = Qnil;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
}
method = ole_method_sub(self, 0, pTypeInfo, name);
if (method != Qnil) {
@@ -2785,7 +2579,7 @@ ole_methods_sub(pOwnerTypeInfo, pTypeInfo, methods, mask)
WORD i;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
}
for(i = 0; i < pTypeAttr->cFuncs; i++) {
pstr = NULL;
@@ -2826,7 +2620,7 @@ ole_methods_from_typeinfo(pTypeInfo, mask)
VALUE methods = rb_ary_new();
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
}
ole_methods_sub(0, pTypeInfo, methods, mask);
@@ -2859,7 +2653,7 @@ typeinfo_from_ole(pole, ppti)
HRESULT hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
0, lcid, &pTypeInfo);
if(FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to GetTypeInfo");
+ ole_raise(hr, rb_eRuntimeError, "Failed to GetTypeInfo");
}
hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo,
-1,
@@ -2869,7 +2663,7 @@ typeinfo_from_ole(pole, ppti)
hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &i);
OLE_RELEASE(pTypeInfo);
if (FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib");
+ ole_raise(hr, rb_eRuntimeError, "Failed to GetContainingTypeLib");
}
count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
for (i = 0; i < count; i++) {
@@ -2909,32 +2703,21 @@ ole_methods(self,mask)
}
/*
- * call-seq:
- * WIN32OLE#ole_methods
- *
- * Returns the array of WIN32OLE_METHOD object.
- * The element is OLE method of WIN32OLE object.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * methods = excel.ole_methods
- *
+ * WIN32OLE#ole_methods
+ * ----
+ * Returns OLE methods
*/
static VALUE
fole_methods( self )
VALUE self;
{
- return ole_methods( self, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
+ return ole_methods( self, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT);
}
/*
- * call-seq:
- * WIN32OLE#ole_get_methods
- *
- * Returns the array of WIN32OLE_METHOD object .
- * The element of the array is property (gettable) of WIN32OLE object.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * properties = excel.ole_get_methods
+ * WIN32OLE#ole_get_methods
+ * ----
+ * Returns get properties.
*/
static VALUE
fole_get_methods( self )
@@ -2944,32 +2727,21 @@ fole_get_methods( self )
}
/*
- * call-seq:
- * WIN32OLE#ole_put_methods
- *
- * Returns the array of WIN32OLE_METHOD object .
- * The element of the array is property (settable) of WIN32OLE object.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * properties = excel.ole_put_methods
+ * WIN32OLE#ole_put_methods
+ * ----
+ * Returns put properties.
*/
static VALUE
fole_put_methods( self )
VALUE self;
{
- return ole_methods( self, INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
+ return ole_methods( self, INVOKE_PROPERTYPUT);
}
/*
- * call-seq:
- * WIN32OLE#ole_func_methods
- *
- * Returns the array of WIN32OLE_METHOD object .
- * The element of the array is functional method of WIN32OLE object.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * properties = excel.ole_func_methods
- *
+ * WIN32OLE#ole_func_methods
+ * ---
+ * Returns OLE func methods.
*/
static VALUE
fole_func_methods( self )
@@ -2979,13 +2751,9 @@ fole_func_methods( self )
}
/*
- * call-seq:
- * WIN32OLE#ole_obj_help
- *
- * Returns WIN32OLE_TYPE object.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * tobj = excel.ole_obj_help
+ * WIN32OLE#ole_obj_help
+ * ----
+ * Returns WIN32OLE_TYPE object.
*/
static VALUE
fole_obj_help( self )
@@ -3004,12 +2772,12 @@ fole_obj_help( self )
hr = pole->pDispatch->lpVtbl->GetTypeInfo( pole->pDispatch, 0, lcid, &pTypeInfo );
if(FAILED(hr)) {
- ole_raise(hr, rb_eRuntimeError, "failed to GetTypeInfo");
+ ole_raise(hr, rb_eRuntimeError, "Failed to GetTypeInfo");
}
hr = pTypeInfo->lpVtbl->GetContainingTypeLib( pTypeInfo, &pTypeLib, &index );
if(FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
- ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib");
+ ole_raise(hr, rb_eRuntimeError, "Failed to GetContainingTypeLib");
}
hr = pTypeLib->lpVtbl->GetDocumentation( pTypeLib, index,
&bstr, NULL, NULL, NULL);
@@ -3222,15 +2990,10 @@ ole_typedesc2val(pTypeInfo, pTypeDesc, typedetails)
}
/*
- * call-seq:
- * WIN32OLE#ole_method_help(method)
- *
- * Returns WIN32OLE_METHOD object corresponding with method
- * specified by 1st argument.
- *
- * excel = WIN32OLE.new('Excel.Application')
- * method = excel.ole_method_help('Quit')
- *
+ * WIN32OLE#ole_method_help(method)
+ * -----
+ * Returns WIN32OLE_METHOD object corresponding with method
+ * specified by 1st argument.
*/
static VALUE
fole_method_help( self, cmdname )
@@ -3247,21 +3010,20 @@ fole_method_help( self, cmdname )
OLEData_Get_Struct(self, pole);
hr = typeinfo_from_ole(pole, &pTypeInfo);
if(FAILED(hr))
- ole_raise(hr, rb_eRuntimeError, "failed to get ITypeInfo");
+ ole_raise(hr, rb_eRuntimeError, "Failed to get ITypeInfo");
method = folemethod_s_allocate(cWIN32OLE_METHOD);
obj = olemethod_from_typeinfo(method, pTypeInfo, cmdname);
OLE_RELEASE(pTypeInfo);
if (obj == Qnil)
- rb_raise(eWIN32OLE_RUNTIME_ERROR, "not found %s",
+ rb_raise(eWIN32OLE_RUNTIME_ERROR, "Not found %s",
StringValuePtr(cmdname));
return obj;
}
/*
- * call-seq:
- * WIN32OLE_TYPE.ole_classes(typelib)
- *
- * Returns array of WIN32OLE_TYPE objects defined by the <i>typelib</i> type library.
+ * WIN32OLE.ole_classes(typelibrary)
+ * ----
+ * Returns array of WIN32OLE_TYPE objects defined by type library.
*/
static VALUE
foletype_s_ole_classes(self, typelib)
@@ -3283,7 +3045,7 @@ foletype_s_ole_classes(self, typelib)
pbuf = ole_mb2wc(StringValuePtr(file), -1);
hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to LoadTypeLibEx");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to LoadTypeLibEx");
SysFreeString(pbuf);
ole_classes_from_typelib(pTypeLib, classes);
OLE_RELEASE(pTypeLib);
@@ -3294,11 +3056,9 @@ foletype_s_ole_classes(self, typelib)
}
/*
- * call-seq:
- * WIN32OLE_TYPE.typelibs
- *
- * Returns array of type libraries.
- *
+ * WIN32OLE_TYPE.typelibs
+ * ----
+ * Returns array of type libraries.
*/
static VALUE
foletype_s_typelibs(self)
@@ -3343,10 +3103,9 @@ foletype_s_typelibs(self)
}
/*
- * call-seq:
- * WIN32OLE_TYPE.progids
- *
- * Returns array of ProgID.
+ * WIN32OLE_TYPE.progids
+ * ---
+ * Returns array of ProgID.
*/
static VALUE
foletype_s_progids(self)
@@ -3441,23 +3200,6 @@ oleclass_from_typelib(self, pTypeLib, oleclass)
return found;
}
-/*
- * Document-class: WIN32OLE_TYPE
- *
- * <code>WIN32OLE_TYPE</code> objects represent OLE type libarary information.
- */
-
-/*
- * call-seq:
- * WIN32OLE_TYPE.new(typelib, ole_class) -> WIN32OLE_TYPE object
- *
- * Returns a new WIN32OLE_TYPE object.
- * The first argument <i>typelib</i> specifies OLE type library name.
- * The second argument specifies OLE class name.
- *
- * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * # => WIN32OLE_TYPE object of Application class of Excel.
- */
static VALUE
foletype_initialize(self, typelib, oleclass)
VALUE self;
@@ -3478,11 +3220,11 @@ foletype_initialize(self, typelib, oleclass)
pbuf = ole_mb2wc(StringValuePtr(file), -1);
hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to LoadTypeLibEx");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to LoadTypeLibEx");
SysFreeString(pbuf);
if (oleclass_from_typelib(self, pTypeLib, oleclass) == Qfalse) {
OLE_RELEASE(pTypeLib);
- rb_raise(eWIN32OLE_RUNTIME_ERROR, "not found `%s` in `%s`",
+ rb_raise(eWIN32OLE_RUNTIME_ERROR, "Not found `%s` in `%s`",
StringValuePtr(oleclass), StringValuePtr(typelib));
}
OLE_RELEASE(pTypeLib);
@@ -3490,12 +3232,9 @@ foletype_initialize(self, typelib, oleclass)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#name #=> OLE type name
- *
- * Returns OLE type name.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.name # => Application
+ * WIN32OLE_TYPE#name
+ * ---
+ * Returns name.
*/
static VALUE
foletype_name(self)
@@ -3552,12 +3291,9 @@ ole_ole_type(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#ole_type #=> OLE type string.
- *
- * returns type of OLE class.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.ole_type # => Class
+ * WIN32OLE_TYPE#ole_type
+ * ----
+ * returns type of class.
*/
static VALUE
foletype_ole_type(self)
@@ -3589,12 +3325,9 @@ ole_type_guid(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#guid #=> GUID
- *
- * Returns GUID.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.guid # => {00024500-0000-0000-C000-000000000046}
+ * WIN32OLE_TYPE#guid
+ * ----
+ * Returns GUID.
*/
static VALUE
foletype_guid(self)
@@ -3624,12 +3357,9 @@ ole_type_progid(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#progid #=> ProgID
- *
+ * WIN32OLE_TYPE#progid
+ * ----
* Returns ProgID if it exists. If not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.progid # => Excel.Application.9
*/
static VALUE
foletype_progid(self)
@@ -3661,12 +3391,9 @@ ole_type_visible(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#visible #=> true or false
- *
- * Returns true if the OLE class is public.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
- * puts tobj.visible # => true
+ * WIN32OLE_TYPE#visible
+ * ----
+ * returns true if the OLE class is public.
*/
static VALUE
foletype_visible(self)
@@ -3686,19 +3413,16 @@ ole_type_major_version(pTypeInfo)
HRESULT hr;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
ver = INT2FIX(pTypeAttr->wMajorVerNum);
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return ver;
}
/*
- * call-seq:
- * WIN32OLE_TYPE#major_version
- *
- * Returns major version.
- * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
- * puts tobj.major_version # => 8
+ * WIN32OLE_TYPE#major_version
+ * ----
+ * Returns major version.
*/
static VALUE
foletype_major_version(self)
@@ -3718,19 +3442,16 @@ ole_type_minor_version(pTypeInfo)
HRESULT hr;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
ver = INT2FIX(pTypeAttr->wMinorVerNum);
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return ver;
}
/*
- * call-seq:
- * WIN32OLE_TYPE#minor_version #=> OLE minor version
- *
- * Returns minor version.
- * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
- * puts tobj.minor_version # => 2
+ * WIN32OLE_TYPE#minor_version
+ * ----
+ * Returns minor version.
*/
static VALUE
foletype_minor_version(self)
@@ -3750,20 +3471,16 @@ ole_type_typekind(pTypeInfo)
HRESULT hr;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
typekind = INT2FIX(pTypeAttr->typekind);
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return typekind;
}
/*
- * call-seq:
- * WIN32OLE_TYPE#typekind #=> number of type.
- *
- * Returns number which represents type.
- * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
- * puts tobj.typekind # => 4
- *
+ * WIN32OLE_TYPE#typekind
+ * ----
+ * Returns number which represents type.
*/
static VALUE
foletype_typekind(self)
@@ -3788,12 +3505,9 @@ ole_type_helpstring(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#helpstring #=> help string.
- *
- * Returns help string.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
- * puts tobj.helpstring # => Web Browser interface
+ * WIN32OLE_TYPE#helpstring
+ * ---
+ * Returns help string.
*/
static VALUE
foletype_helpstring(self)
@@ -3824,13 +3538,9 @@ ole_type_src_type(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#src_type #=> OLE source class
- *
- * Returns source class when the OLE class is 'Alias'.
- * tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType')
- * puts tobj.src_type # => I4
- *
+ * WIN32OLE_TYPE#src_type
+ * ----
+ * Returns source class when the OLE class is 'Alias'.
*/
static VALUE
foletype_src_type(self)
@@ -3855,13 +3565,9 @@ ole_type_helpfile(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#helpfile
- *
- * Returns helpfile path. If helpfile is not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * puts tobj.helpfile # => C:\...\VBAXL9.CHM
- *
+ * WIN32OLE_TYPE#helpfile
+ * ----
+ * Returns helpfile
*/
static VALUE
foletype_helpfile(self)
@@ -3886,12 +3592,9 @@ ole_type_helpcontext(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#helpcontext
- *
- * Returns helpcontext. If helpcontext is not found, then returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * puts tobj.helpfile # => 131185
+ * WIN32OLE_TYPE#helpcontext
+ * ---
+ * Returns helpcontext.
*/
static VALUE
foletype_helpcontext(self)
@@ -3918,7 +3621,7 @@ ole_variables(pTypeInfo)
VALUE variables = rb_ary_new();
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetTypeAttr");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetTypeAttr");
}
for(i = 0; i < pTypeAttr->cVars; i++) {
@@ -3948,24 +3651,9 @@ ole_variables(pTypeInfo)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#variables
- *
- * Returns array of WIN32OLE_VARIABLE objects which represent variables
- * defined in OLE class.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * vars = tobj.variables
- * vars.each do |v|
- * puts "#{v.name} = #{v.value}"
- * end
- *
- * The result of above sample script is follows:
- * xlChart = -4109
- * xlDialogSheet = -4116
- * xlExcel4IntlMacroSheet = 4
- * xlExcel4MacroSheet = 3
- * xlWorksheet = -4167
- *
+ * WIN32OLE_TYPE#variables
+ * ----
+ * Returns array of variables defined in OLE class.
*/
static VALUE
foletype_variables(self)
@@ -3977,16 +3665,9 @@ foletype_variables(self)
}
/*
- * call-seq:
- * WIN32OLE_TYPE#ole_methods # the array of WIN32OLE_METHOD objects.
- *
- * Returns array of WIN32OLE_METHOD objects which represent OLE method defined in
- * OLE type library.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
- * methods = tobj.ole_methods.collect{|m|
- * m.name
- * }
- * # => ['Activate', 'Copy', 'Delete',....]
+ * WIN32OLE_TYPE#ole_methods
+ * ----
+ * Returns array of WIN32OLE_METHOD objects.
*/
static VALUE
foletype_methods(argc, argv, self)
@@ -4000,30 +3681,9 @@ foletype_methods(argc, argv, self)
}
/*
- * Document-class: WIN32OLE_VARIABLE
- *
- * <code>WIN32OLE_VARIABLE</code> objects represent OLE variable information.
- */
-
-/*
- * call-seq:
- * WIN32OLE_VARIABLE#name
- *
- * Returns the name of variable.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name}"
- * end
- *
- * The result of above script is following:
- * xlChart
- * xlDialogSheet
- * xlExcel4IntlMacroSheet
- * xlExcel4MacroSheet
- * xlWorksheet
- *
+ * WIN32OLE_VARIABLE#name
+ * ---
+ * Returns the name.
*/
static VALUE
folevariable_name(self)
@@ -4041,31 +3701,16 @@ static ole_variable_ole_type(pTypeInfo, var_index)
VALUE type;
hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetVarDesc");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetVarDesc");
type = ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), Qnil);
pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
return type;
}
/*
- * call-seq:
- * WIN32OLE_VARIABLE#ole_type
- *
- * Returns OLE type string.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.ole_type} #{variable.name}"
- * end
- *
- * The result of above script is following:
- * INT xlChart
- * INT xlDialogSheet
- * INT xlExcel4IntlMacroSheet
- * INT xlExcel4MacroSheet
- * INT xlWorksheet
- *
+ * WIN32OLE_VARIABLE#ole_type
+ * ----
+ * Returns type.
*/
static VALUE
folevariable_ole_type(self)
@@ -4085,23 +3730,16 @@ static ole_variable_ole_type_detail(pTypeInfo, var_index)
VALUE type = rb_ary_new();
hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetVarDesc");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetVarDesc");
ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), type);
pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
return type;
}
/*
- * call-seq:
- * WIN32OLE_VARIABLE#ole_type_detail
- *
- * Returns detail information of type. The information is array of type.
- *
- * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
- * variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
- * tdetail = variable.ole_type_detail
- * p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]
- *
+ * WIN32OLE_VARIABLE#ole_type_detail
+ * ---
+ * Returns detail information of type. The information is array of type.
*/
static VALUE
folevariable_ole_type_detail(self)
@@ -4129,25 +3767,10 @@ static ole_variable_value(pTypeInfo, var_index)
}
/*
- * call-seq:
- * WIN32OLE_VARIABLE#value
- *
- * Returns value if value is exists. If the value does not exist,
- * this method returns nil.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} = #{variable.value}"
- * end
- *
- * The result of above script is following:
- * xlChart = -4109
- * xlDialogSheet = -4116
- * xlExcel4IntlMacroSheet = 4
- * xlExcel4MacroSheet = 3
- * xlWorksheet = -4167
- *
+ * WIN32OLE_VARIABLE#value
+ * ----
+ * Returns value if value is exists. If the value does not exist,
+ * this method returns nil.
*/
static VALUE
folevariable_value(self)
@@ -4178,24 +3801,9 @@ static ole_variable_visible(pTypeInfo, var_index)
}
/*
- * call-seq:
- * WIN32OLE_VARIABLE#visible?
- *
- * Returns true if the variable is public.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.visible?}"
- * end
- *
- * The result of above script is following:
- * xlChart true
- * xlDialogSheet true
- * xlExcel4IntlMacroSheet true
- * xlExcel4MacroSheet true
- * xlWorksheet true
- *
+ * WIN32OLE_VARIABLE#visible?
+ * ----
+ * Returns true if the variable is public.
*/
static VALUE
folevariable_visible(self)
@@ -4238,23 +3846,9 @@ ole_variable_kind(pTypeInfo, var_index)
}
/*
- * call-seq:
- * WIN32OLE_VARIABLE#variable_kind
- *
+ * WIN32OLE_VARIABLE#variable_kind
+ * ----
* Returns variable kind string.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.variable_kind}"
- * end
- *
- * The result of above script is following:
- * xlChart CONSTANT
- * xlDialogSheet CONSTANT
- * xlExcel4IntlMacroSheet CONSTANT
- * xlExcel4MacroSheet CONSTANT
- * xlWorksheet CONSTANT
*/
static VALUE
folevariable_variable_kind(self)
@@ -4282,22 +3876,9 @@ ole_variable_varkind(pTypeInfo, var_index)
}
/*
- * call-seq:
- * WIN32OLE_VARIABLE#varkind
- *
- * Returns the number which represents variable kind.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
- * variables = tobj.variables
- * variables.each do |variable|
- * puts "#{variable.name} #{variable.varkind}"
- * end
- *
- * The result of above script is following:
- * xlChart 2
- * xlDialogSheet 2
- * xlExcel4IntlMacroSheet 2
- * xlExcel4MacroSheet 2
- * xlWorksheet 2
+ * WIN32OLE_VARIABLE#varkind
+ * ----
+ * Returns the number which represents variable kind.
*/
static VALUE
folevariable_varkind(self)
@@ -4308,12 +3889,6 @@ folevariable_varkind(self)
return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
}
-/*
- * Document-class: WIN32OLE_METHOD
- *
- * <code>WIN32OLE_METHOD</code> objects represent OLE method information.
- */
-
static VALUE
olemethod_set_member(self, pTypeInfo, pOwnerTypeInfo, index, name)
VALUE self;
@@ -4348,19 +3923,6 @@ folemethod_s_allocate(klass)
return obj;
}
-/*
- * call-seq:
- * WIN32OLE_METHOD.new(ole_type, method) -> WIN32OLE_METHOD object
- *
- * Returns a new WIN32OLE_METHOD object which represents the information
- * about OLE method.
- * The first argument <i>ole_type</i> specifies WIN32OLE_TYPE object.
- * The second argument <i>method</i> specifies OLE method name defined OLE class
- * which represents WIN32OLE_TYPE object.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- */
static VALUE
folemethod_initialize(self, oletype, method)
VALUE self;
@@ -4374,26 +3936,20 @@ folemethod_initialize(self, oletype, method)
Data_Get_Struct(oletype, struct oletypedata, ptype);
obj = olemethod_from_typeinfo(self, ptype->pTypeInfo, method);
if (obj == Qnil) {
- rb_raise(eWIN32OLE_RUNTIME_ERROR, "not found %s",
+ rb_raise(eWIN32OLE_RUNTIME_ERROR, "Not found %s",
StringValuePtr(method));
}
}
else {
- rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object");
+ rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object.");
}
return obj;
}
/*
- * call-seq
- * WIN32OLE_METHOD#name
- *
- * Returns the name of the method.
- *
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * puts method.name # => SaveAs
- *
+ * WIN32OLE_METHOD#name
+ * ----
+ * Returns the name of the method.
*/
static VALUE
folemethod_name(self)
@@ -4413,7 +3969,7 @@ ole_method_return_type(pTypeInfo, method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetFuncDesc");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetFuncDesc");
type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
@@ -4421,14 +3977,9 @@ ole_method_return_type(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#return_type
- *
- * Returns string of return value type of method.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.return_type # => Workbook
- *
+ * WIN32OLE_METHOD#return_type
+ * ----
+ * Returns string of return value type of method.
*/
static VALUE
folemethod_return_type(self)
@@ -4450,7 +4001,7 @@ ole_method_return_vtype(pTypeInfo, method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetFuncDesc");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetFuncDesc");
vt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
@@ -4458,14 +4009,9 @@ ole_method_return_vtype(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#return_vtype
- *
- * Returns number of return value type of method.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.return_vtype # => 26
- *
+ * WIN32OLE_METHOD#return_vtype
+ * ----
+ * Returns number of return value type of method.
*/
static VALUE
folemethod_return_vtype(self)
@@ -4495,14 +4041,10 @@ ole_method_return_type_detail(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#return_type_detail
- *
- * Returns detail information of return value type of method.
- * The information is array.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"]
+ * WIN32OLE_METHOD#return_type_detail
+ * -----
+ * Returns detail information of return value type of method.
+ * The information is array.
*/
static VALUE
folemethod_return_type_detail(self)
@@ -4523,7 +4065,7 @@ ole_method_invkind(pTypeInfo, method_index)
VALUE invkind;
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if(FAILED(hr))
- ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "failed to GetFuncDesc");
+ ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to GetFuncDesc");
invkind = INT2FIX(pFuncDesc->invkind);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return invkind;
@@ -4552,14 +4094,9 @@ ole_method_invoke_kind(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_MTHOD#invkind
- *
- * Returns the method invoke kind.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.invkind # => 1
- *
+ * WIN32OLE_MTHOD#invkind
+ * ----
+ * Returns invkind.
*/
static VALUE
folemethod_invkind(self)
@@ -4571,15 +4108,9 @@ folemethod_invkind(self)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#invoke_kind
- *
- * Returns the method kind string. The string is "UNKNOWN" or "PROPERTY"
- * or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF"
- * or "FUNC".
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.invoke_kind # => "FUNC"
+ * WIN32OLE_METHOD#invoke_kind
+ * ----
+ * Returns invoke kind string.
*/
static VALUE
folemethod_invoke_kind(self)
@@ -4613,13 +4144,9 @@ ole_method_visible(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#visible?
- *
- * Returns true if the method is public.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.visible? # => true
+ * WIN32OLE_METHOD#visible?
+ * ----
+ * Returns true if the method is public.
*/
static VALUE
folemethod_visible(self)
@@ -4697,14 +4224,9 @@ static ole_method_event(pTypeInfo, method_index, method_name)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#event?
- *
- * Returns true if the method is event.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
- * puts method.event? # => true
- *
+ * WIN32OLE_METHOD#event?
+ * ----
+ * Returns true if the method is event.
*/
static VALUE
folemethod_event(self)
@@ -4719,15 +4241,6 @@ folemethod_event(self)
rb_ivar_get(self, rb_intern("name")));
}
-/*
- * call-seq:
- * WIN32OLE_METHOD#event_interface
- *
- * Returns event interface name if the method is event.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
- * puts method.event_interface # => WorkbookEvents
- */
static VALUE
folemethod_event_interface(self)
VALUE self;
@@ -4780,17 +4293,6 @@ ole_method_helpstring(pTypeInfo, method_index)
return WC2VSTR(bhelpstring);
}
-/*
- * call-seq:
- * WIN32OLE_METHOD#helpstring
- *
- * Returns help string of OLE method. If the help string is not found,
- * then the method returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
- * method = WIN32OLE_METHOD.new(tobj, 'Navigate')
- * puts method.helpstring # => Navigates to a URL or file.
- *
- */
static VALUE
folemethod_helpstring(self)
VALUE self;
@@ -4815,14 +4317,9 @@ ole_method_helpfile(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#helpfile
- *
- * Returns help file. If help file is not found, then
- * the method returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.helpfile # => C:\...\VBAXL9.CHM
+ * WIN32OLE_METHOD#helpfile
+ * ---
+ * Returns help file.
*/
static VALUE
folemethod_helpfile(self)
@@ -4849,13 +4346,9 @@ ole_method_helpcontext(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#helpcontext
- *
- * Returns help context.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.helpcontext # => 65717
+ * WIN32OLE_METHOD#helpcontext
+ * -----
+ * Returns help context.
*/
static VALUE
folemethod_helpcontext(self)
@@ -4877,19 +4370,15 @@ ole_method_dispid(pTypeInfo, method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
return dispid;
- dispid = INT2NUM(pFuncDesc->memid);
+ dispid = INT2FIX(pFuncDesc->memid);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
return dispid;
}
/*
- * call-seq:
- * WIN32OLE_METHOD#dispid
- *
- * Returns dispatch ID.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.dispid # => 181
+ * WIN32OLE_METHOD#dispid
+ * ----
+ * Returns dispatch ID.
*/
static VALUE
folemethod_dispid(self)
@@ -4917,13 +4406,9 @@ ole_method_offset_vtbl(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#offset_vtbl
- *
- * Returns the offset ov VTBL.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
- * method = WIN32OLE_METHOD.new(tobj, 'Add')
- * puts method.offset_vtbl # => 40
+ * WIN32OLE_METHOD#offset_vtbl
+ * ----
+ * Returns the offset ov VTBL.
*/
static VALUE
folemethod_offset_vtbl(self)
@@ -4951,14 +4436,9 @@ ole_method_size_params(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#size_params
- *
- * Returns the size of arguments of the method.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * puts method.size_params # => 11
- *
+ * WIN32OLE_METHOD#size_params
+ * ----
+ * Returns the size of arguments.
*/
static VALUE
folemethod_size_params(self)
@@ -4969,6 +4449,11 @@ folemethod_size_params(self)
return ole_method_size_params(pmethod->pTypeInfo, pmethod->index);
}
+/*
+ * WIN32OLE_METHOD#size_opt_params
+ * ----
+ * Returns the size of optional parameters.
+ */
static VALUE
ole_method_size_opt_params(pTypeInfo, method_index)
ITypeInfo *pTypeInfo;
@@ -4985,15 +4470,6 @@ ole_method_size_opt_params(pTypeInfo, method_index)
return size_opt_params;
}
-/*
- * call-seq:
- * WIN32OLE_METHOD#size_opt_params
- *
- * Returns the size of optional parameters.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * puts method.size_opt_params # => 4
- */
static VALUE
folemethod_size_opt_params(self)
VALUE self;
@@ -5046,16 +4522,9 @@ ole_method_params(pTypeInfo, method_index)
}
/*
- * call-seq:
- * WIN32OLE_METHOD#params
- *
- * returns array of WIN32OLE_PARAM object corresponding with method parameters.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * p method.params # => [Filename, FileFormat, Password, WriteResPassword,
- * ReadOnlyRecommended, CreateBackup, AccessMode,
- * ConflictResolution, AddToMru, TextCodepage,
- * TextVisualLayout]
+ * WIN32OLE_METHOD#params
+ * ----
+ * returns array of WIN32OLE_PARAM object corresponding with method parameters.
*/
static VALUE
folemethod_params(self)
@@ -5067,21 +4536,9 @@ folemethod_params(self)
}
/*
- * Document-class: WIN32OLE_PARAM
- *
- * <code>WIN32OLE_PARAM</code> objects represent param information of
- * the OLE method.
- */
-
-/*
- * call-seq:
- * WIN32OLE_PARAM#name
- *
- * Returns name.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts param1.name # => Filename
+ * WIN32OLE_PARAM#name
+ * ----
+ * Returns name.
*/
static VALUE
foleparam_name(self)
@@ -5108,16 +4565,6 @@ ole_param_ole_type(pTypeInfo, method_index, index)
return type;
}
-/*
- * call-seq:
- * WIN32OLE_PARAM#ole_type
- *
- * Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method).
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts param1.ole_type # => VARIANT
- */
static VALUE
foleparam_ole_type(self)
VALUE self;
@@ -5146,16 +4593,6 @@ ole_param_ole_type_detail(pTypeInfo, method_index, index)
return typedetail;
}
-/*
- * call-seq:
- * WIN32OLE_PARAM#ole_type_detail
- *
- * Returns detail information of type of argument.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
- * method = WIN32OLE_METHOD.new(tobj, 'SumIf')
- * param1 = method.params[0]
- * p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]
- */
static VALUE
foleparam_ole_type_detail(self)
VALUE self;
@@ -5186,14 +4623,9 @@ ole_param_flag_mask(pTypeInfo, method_index, index, mask)
}
/*
- * call-seq:
- * WIN32OLE_PARAM#input?
- *
- * Returns true if the parameter is input.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts param1.input? # => true
+ * WIN32OLE_PARAM#input?
+ * ----
+ * Returns true if the parameter is input.
*/
static VALUE foleparam_input(self)
VALUE self;
@@ -5205,23 +4637,9 @@ static VALUE foleparam_input(self)
}
/*
- * call-seq:
- * WIN32OLE#output?
- *
- * Returns true if argument is output.
- * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
- * method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
- * method.params.each do |param|
- * puts "#{param.name} #{param.output?}"
- * end
- *
- * The result of above script is following:
- * URL false
- * Flags false
- * TargetFrameName false
- * PostData false
- * Headers false
- * Processed true
+ * WIN32OLE#output?
+ * ----
+ * Returns true if argument is output.
*/
static VALUE foleparam_output(self)
VALUE self;
@@ -5233,14 +4651,9 @@ static VALUE foleparam_output(self)
}
/*
- * call-seq:
- * WIN32OLE_PARAM#optional?
- *
- * Returns true if argument is optional.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * param1 = method.params[0]
- * puts "#{param1.name} #{param1.optional?}" # => Filename true
+ * WIN32OLE_PARAM#optional?
+ * -----
+ * Returns true if argument is output.
*/
static VALUE foleparam_optional(self)
VALUE self;
@@ -5251,17 +4664,6 @@ static VALUE foleparam_optional(self)
pparam->index, PARAMFLAG_FOPT);
}
-/*
- * call-seq:
- * WIN32OLE_PARAM#retval?
- *
- * Returns true if argument is return value.
- * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library',
- * 'DirectPlayLobbyConnection')
- * method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName')
- * param = method.params[0]
- * puts "#{param.name} #{param.retval?}" # => name true
- */
static VALUE foleparam_retval(self)
VALUE self;
{
@@ -5298,33 +4700,10 @@ ole_param_default(pTypeInfo, method_index, index)
}
/*
- * call-seq:
- * WIN32OLE_PARAM#default
- *
- * Returns default value. If the default value does not exist,
- * this method returns nil.
- * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
- * method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
- * method.params.each do |param|
- * if param.default
- * puts "#{param.name} (= #{param.default})"
- * else
- * puts "#{param}"
- * end
- * end
- *
- * The above script result is following:
- * Filename
- * FileFormat
- * Password
- * WriteResPassword
- * ReadOnlyRecommended
- * CreateBackup
- * AccessMode (= 1)
- * ConflictResolution
- * AddToMru
- * TextCodepage
- * TextVisualLayout
+ * WIN32OLE_PARAM#default
+ * ----
+ * Returns default value. If the default value does not exist,
+ * this method returns nil.
*/
static VALUE foleparam_default(self)
VALUE self;
@@ -5335,13 +4714,6 @@ static VALUE foleparam_default(self)
pparam->index);
}
-
-/*
- * Document-class: WIN32OLE_EVENT
- *
- * <code>WIN32OLE_EVENT</code> objects controls OLE event.
- */
-
static IEventSinkVtbl vtEventSink;
static BOOL g_IsEventSinkVtblInitialized = FALSE;
@@ -5414,35 +4786,6 @@ STDMETHODIMP EVENTSINK_GetIDsOfNames(
return DISP_E_UNKNOWNNAME;
}
-static long
-ole_search_event_at(ary, ev)
- VALUE ary;
- VALUE ev;
-{
- VALUE event;
- VALUE def_event;
- VALUE event_name;
- long i, len;
- long ret = -1;
- def_event = Qnil;
- len = RARRAY(ary)->len;
- for(i = 0; i < len; i++) {
- event = rb_ary_entry(ary, i);
- event_name = rb_ary_entry(event, 1);
- if(NIL_P(event_name) && NIL_P(ev)) {
- ret = i;
- break;
- }
- else if (TYPE(ev) == T_STRING &&
- TYPE(event_name) == T_STRING &&
- rb_str_cmp(ev, event_name) == 0) {
- ret = i;
- break;
- }
- }
- return ret;
-}
-
static VALUE
ole_search_event(ary, ev, is_default)
VALUE ary;
@@ -5452,7 +4795,7 @@ ole_search_event(ary, ev, is_default)
VALUE event;
VALUE def_event;
VALUE event_name;
- long i, len;
+ int i, len;
*is_default = FALSE;
def_event = Qnil;
len = RARRAY(ary)->len;
@@ -5650,7 +4993,6 @@ EVENTSINK_Constructor() {
pEv->m_dwCookie = 0;
pEv->pConnectionPoint = NULL;
pEv->pTypeInfo = NULL;
- pEv->ptr_freed = NULL;
return pEv;
}
@@ -5658,7 +5000,6 @@ void EVENTSINK_Destructor(
PIEVENTSINKOBJ pEVObj
) {
if(pEVObj != NULL) {
- *(pEVObj->ptr_freed) = 1;
free(pEVObj);
}
}
@@ -5880,14 +5221,6 @@ ole_event_free(poleev)
ITypeInfo *pti = NULL;
IConnectionPoint *pcp = NULL;
- if (poleev->freed == 1) {
- /*
- * this return create memory leak.
- * but poleev->pEvent->pConnectionPoint shoul'd not be freed
- * until poleev-> freed == 0.
- */
- return;
- }
if(poleev->pEvent) {
pti = poleev->pEvent->pTypeInfo;
if(pti) OLE_RELEASE(pti);
@@ -5896,7 +5229,6 @@ ole_event_free(poleev)
pcp->lpVtbl->Unadvise(pcp, poleev->pEvent->m_dwCookie);
OLE_RELEASE(pcp);
}
- free(poleev);
}
}
@@ -5912,16 +5244,6 @@ fev_s_allocate(klass)
return obj;
}
-/*
- * call-seq:
- * WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object.
- *
- * Returns OLE event object.
- * The first argument specifies WIN32OLE object.
- * The second argument specifies OLE event name.
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
- */
static VALUE
fev_initialize(argc, argv, self)
int argc;
@@ -5938,14 +5260,14 @@ fev_initialize(argc, argv, self)
IConnectionPointContainer *pContainer;
IConnectionPoint *pConnectionPoint;
IEVENTSINKOBJ *pIEV;
- DWORD dwCookie = 0;
+ DWORD dwCookie;
struct oleeventdata *poleev;
rb_secure(4);
rb_scan_args(argc, argv, "11", &ole, &itf);
if (!rb_obj_is_kind_of(ole, cWIN32OLE)) {
- rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE object");
+ rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE object.");
}
if(TYPE(itf) != T_NIL) {
@@ -5972,7 +5294,7 @@ fev_initialize(argc, argv, self)
if (FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
ole_raise(hr, rb_eRuntimeError,
- "failed to query IConnectionPointContainer");
+ "Failed to query IConnectionPointContainer");
}
hr = pContainer->lpVtbl->FindConnectionPoint(pContainer,
@@ -5981,7 +5303,7 @@ fev_initialize(argc, argv, self)
OLE_RELEASE(pContainer);
if (FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
- ole_raise(hr, rb_eRuntimeError, "failed to query IConnectionPoint");
+ ole_raise(hr, rb_eRuntimeError, "Failed to query IConnectionPoint");
}
pIEV = EVENTSINK_Constructor();
pIEV->m_iid = iid;
@@ -5999,17 +5321,15 @@ fev_initialize(argc, argv, self)
poleev->pEvent->pConnectionPoint = pConnectionPoint;
poleev->pEvent->pTypeInfo = pTypeInfo;
poleev->pEvent->m_dwCookie = dwCookie;
- poleev->freed = 0;
- poleev->pEvent->ptr_freed = &(poleev->freed);
+
rb_ary_push(ary_ole_event, self);
return self;
}
/*
- * call-seq:
- * WIN32OLE_EVENT.message_loop
- *
- * Translates and dispatches Windows message.
+ * WIN32OLE_EVENT.message_loop
+ * ---
+ * Translates and dispatches Windows message.
*/
static VALUE
fev_s_msg_loop(klass)
@@ -6021,22 +5341,16 @@ fev_s_msg_loop(klass)
static void
-add_event_call_back(obj, event, data)
+add_event_call_back(obj, data)
VALUE obj;
- VALUE event;
VALUE data;
{
- long at;
- VALUE events = rb_ivar_get(obj, id_events);
- if (NIL_P(events) || TYPE(events) != T_ARRAY) {
- events = rb_ary_new();
- rb_ivar_set(obj, id_events, events);
- }
- at = ole_search_event_at(events, event);
- if (at > -1) {
- rb_ary_delete_at(events, at);
+ VALUE ary = rb_ivar_get(obj, id_events);
+ if (NIL_P(ary) || TYPE(ary) != T_ARRAY) {
+ ary = rb_ary_new();
+ rb_ivar_set(obj, id_events, ary);
}
- rb_ary_push(events, data);
+ rb_ary_push(ary, data);
}
static VALUE
@@ -6052,19 +5366,15 @@ ev_on_event(argc, argv, self, is_ary_arg)
Check_SafeStr(event);
}
data = rb_ary_new3(4, rb_block_proc(), event, args, is_ary_arg);
- add_event_call_back(self, event, data);
+ add_event_call_back(self, data);
return Qnil;
}
/*
- * call-seq:
- * WIN32OLE_EVENT#on_event([event]){...}
- *
- * Defines the callback event.
- * If argument is omitted, this method defines the callback of all events.
- * ie = WIN32OLE.new('InternetExplorer.Application')
- * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
- * ev.on_event("NavigateComplete") {|url| puts url}
+ * WIN32OLE_EVENT#on_event([event]){...}
+ * ----
+ * defines the callback event.
+ * If argument is omitted, this method defines the callback of all events.
*/
static VALUE
fev_on_event(argc, argv, self)
@@ -6076,12 +5386,11 @@ fev_on_event(argc, argv, self)
}
/*
- * call-seq:
- * WIN32OLE_EVENT#on_event_with_outargs([event]){...}
- *
- * Defines the callback of event.
- * If you want modify argument in callback,
- * you should use this method instead of WIN32OLE_EVENT#on_event.
+ * WIN32OLE_EVENT#on_event_with_outargs([event]){...}
+ * ----
+ * defines the callback of event.
+ * If you want modify argument in callback,
+ * you should use this method instead of WIN32OLE_EVENT#on_event.
*/
static VALUE
fev_on_event_with_outargs(argc, argv, self)
@@ -6096,11 +5405,10 @@ fev_on_event_with_outargs(argc, argv, self)
void
Init_win32ole()
{
- rb_global_variable(&ary_ole_event);
ary_ole_event = rb_ary_new();
+ rb_global_variable(&ary_ole_event);
id_events = rb_intern("events");
- rb_global_variable(&com_hash);
com_vtbl.QueryInterface = QueryInterface;
com_vtbl.AddRef = AddRef;
com_vtbl.Release = Release;
@@ -6109,6 +5417,7 @@ Init_win32ole()
com_vtbl.GetIDsOfNames = GetIDsOfNames;
com_vtbl.Invoke = Invoke;
com_hash = Data_Wrap_Struct(rb_cData, rb_mark_hash, st_free_table, st_init_numtable());
+ rb_global_variable(&com_hash);
cWIN32OLE = rb_define_class("WIN32OLE", rb_cObject);
@@ -6122,12 +5431,10 @@ Init_win32ole()
rb_define_singleton_method(cWIN32OLE, "ole_free", fole_s_free, 1);
rb_define_singleton_method(cWIN32OLE, "ole_reference_count", fole_s_reference_count, 1);
rb_define_singleton_method(cWIN32OLE, "ole_show_help", fole_s_show_help, -1);
- rb_define_singleton_method(cWIN32OLE, "codepage", fole_s_get_code_page, 0);
- rb_define_singleton_method(cWIN32OLE, "codepage=", fole_s_set_code_page, 1);
rb_define_method(cWIN32OLE, "invoke", fole_invoke, -1);
- rb_define_method(cWIN32OLE, "[]", fole_getproperty, -1);
+ rb_define_method(cWIN32OLE, "[]", fole_getproperty, 1);
rb_define_method(cWIN32OLE, "_invoke", fole_invoke2, 3);
rb_define_method(cWIN32OLE, "_getproperty", fole_getproperty2, 3);
rb_define_method(cWIN32OLE, "_setproperty", fole_setproperty2, 3);
@@ -6154,13 +5461,6 @@ Init_win32ole()
rb_define_const(cWIN32OLE, "VERSION", rb_str_new2(WIN32OLE_VERSION));
rb_define_const(cWIN32OLE, "ARGV", rb_ary_new());
- rb_define_const(cWIN32OLE, "CP_ACP" ,INT2FIX(CP_ACP));
- rb_define_const(cWIN32OLE, "CP_OEMCP" ,INT2FIX(CP_OEMCP));
- rb_define_const(cWIN32OLE, "CP_MACCP" ,INT2FIX(CP_MACCP));
- rb_define_const(cWIN32OLE, "CP_THREAD_ACP",INT2FIX(CP_THREAD_ACP));
- rb_define_const(cWIN32OLE, "CP_SYMBOL" ,INT2FIX(CP_SYMBOL));
- rb_define_const(cWIN32OLE, "CP_UTF7" ,INT2FIX(CP_UTF7));
- rb_define_const(cWIN32OLE, "CP_UTF8" ,INT2FIX(CP_UTF8));
mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VARIANT");
rb_define_const(mWIN32OLE_VARIANT, "VT_I2", INT2FIX(VT_I2));
diff --git a/ext/zlib/doc/zlib.rd b/ext/zlib/doc/zlib.rd
index f914d883fe..6a36dc7fed 100644
--- a/ext/zlib/doc/zlib.rd
+++ b/ext/zlib/doc/zlib.rd
@@ -4,7 +4,7 @@
#
# Copyright (C) UENO Katsuhiro 2000-2003
#
-# $Id: zlib.rd,v 1.1.2.1 2004/03/28 14:10:39 akr Exp $
+# $Id$
#
= Ruby/zlib version 0.6.0
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb
index 14c8376417..bf3349a65d 100644
--- a/ext/zlib/extconf.rb
+++ b/ext/zlib/extconf.rb
@@ -1,7 +1,7 @@
#
# extconf.rb
#
-# $Id: extconf.rb,v 1.2.2.2 2006/05/25 23:44:07 nobu Exp $
+# $Id$
#
require 'mkmf'
@@ -10,7 +10,7 @@ require 'rbconfig'
dir_config 'zlib'
-if %w'z libz zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
+if %w'z libz zlib'.find {|z| have_library(z, 'deflateReset')} and
have_header('zlib.h') then
defines = []
@@ -54,7 +54,12 @@ if %w'z libz zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
message "#{OS_NAMES[os_code]}\n"
defines << "OS_CODE=#{os_code}"
- $defs.concat(defines.collect{|d|' -D'+d})
+ defines = defines.collect{|d|' -D'+d}.join
+ if $CPPFLAGS then
+ $CPPFLAGS += defines
+ else
+ $CFLAGS += defines
+ end
create_makefile('zlib')
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 4684865c65..1a664fd400 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -3,7 +3,7 @@
*
* Copyright (C) UENO Katsuhiro 2000-2003
*
- * $Id: zlib.c,v 1.7.2.20 2006/02/14 11:21:54 ocean Exp $
+ * $Id$
*/
#include <ruby.h>
@@ -39,7 +39,6 @@ static VALUE rb_zlib_crc32 _((int, VALUE*, VALUE));
static VALUE rb_zlib_crc_table _((VALUE));
static voidpf zlib_mem_alloc _((voidpf, uInt, uInt));
static void zlib_mem_free _((voidpf, voidpf));
-static void finalizer_warn _((const char*));
struct zstream;
struct zstream_funcs;
@@ -56,14 +55,13 @@ static void zstream_reset_input _((struct zstream*));
static void zstream_passthrough_input _((struct zstream*));
static VALUE zstream_detach_input _((struct zstream*));
static void zstream_reset _((struct zstream*));
-static VALUE zstream_end _((struct zstream*));
+static void zstream_end _((struct zstream*));
static void zstream_run _((struct zstream*, Bytef*, uInt, int));
static VALUE zstream_sync _((struct zstream*, Bytef*, uInt));
static void zstream_mark _((struct zstream*));
static void zstream_free _((struct zstream*));
static VALUE zstream_new _((VALUE, const struct zstream_funcs*));
static struct zstream *get_zstream _((VALUE));
-static void zstream_finalize _((struct zstream*));
static VALUE rb_zstream_end _((VALUE));
static VALUE rb_zstream_reset _((VALUE));
@@ -82,8 +80,7 @@ static VALUE rb_zstream_closed_p _((VALUE));
static VALUE rb_deflate_s_allocate _((VALUE));
static VALUE rb_deflate_initialize _((int, VALUE*, VALUE));
-static VALUE rb_deflate_init_copy _((VALUE, VALUE));
-static VALUE deflate_run _((VALUE));
+static VALUE rb_deflate_clone _((VALUE));
static VALUE rb_deflate_s_deflate _((int, VALUE*, VALUE));
static void do_deflate _((struct zstream*, VALUE, int));
static VALUE rb_deflate_deflate _((int, VALUE*, VALUE));
@@ -92,7 +89,6 @@ static VALUE rb_deflate_flush _((int, VALUE*, VALUE));
static VALUE rb_deflate_params _((VALUE, VALUE, VALUE));
static VALUE rb_deflate_set_dictionary _((VALUE, VALUE));
-static VALUE inflate_run _((VALUE));
static VALUE rb_inflate_s_allocate _((VALUE));
static VALUE rb_inflate_initialize _((int, VALUE*, VALUE));
static VALUE rb_inflate_s_inflate _((VALUE, VALUE));
@@ -127,9 +123,8 @@ static void gzfile_calc_crc _((struct gzfile*, VALUE));
static VALUE gzfile_read _((struct gzfile*, int));
static VALUE gzfile_read_all _((struct gzfile*));
static void gzfile_ungetc _((struct gzfile*, int));
-static VALUE gzfile_writer_end_run _((VALUE));
+static VALUE gzfile_finalize _((VALUE));
static void gzfile_writer_end _((struct gzfile*));
-static VALUE gzfile_reader_end_run _((VALUE));
static void gzfile_reader_end _((struct gzfile*));
static void gzfile_reader_rewind _((struct gzfile*));
static VALUE gzfile_reader_get_unused _((struct gzfile*));
@@ -242,15 +237,6 @@ raise_zlib_error(err, msg)
}
-/*--- Warning (in finalizer) ---*/
-
-static void
-finalizer_warn(msg)
- const char *msg;
-{
- fprintf(stderr, "zlib(finalizer): %s\n", msg);
-}
-
/*-------- module Zlib --------*/
@@ -375,13 +361,15 @@ struct zstream {
#define ZSTREAM_FLAG_READY 0x1
#define ZSTREAM_FLAG_IN_STREAM 0x2
#define ZSTREAM_FLAG_FINISHED 0x4
-#define ZSTREAM_FLAG_CLOSING 0x8
-#define ZSTREAM_FLAG_UNUSED 0x10
+#define ZSTREAM_FLAG_FINALIZE 0x8
+#define ZSTREAM_FLAG_CLOSED 0x10
+#define ZSTREAM_FLAG_UNUSED 0x20
#define ZSTREAM_READY(z) ((z)->flags |= ZSTREAM_FLAG_READY)
#define ZSTREAM_IS_READY(z) ((z)->flags & ZSTREAM_FLAG_READY)
#define ZSTREAM_IS_FINISHED(z) ((z)->flags & ZSTREAM_FLAG_FINISHED)
-#define ZSTREAM_IS_CLOSING(z) ((z)->flags & ZSTREAM_FLAG_CLOSING)
+#define ZSTREAM_IS_FINALIZE(z) ((z)->flags & ZSTREAM_FLAG_FINALIZE)
+#define ZSTREAM_IS_CLOSED(z) ((z)->flags & ZSTREAM_FLAG_CLOSED)
/* I think that more better value should be found,
but I gave up finding it. B) */
@@ -668,7 +656,7 @@ zstream_reset(z)
int err;
err = z->func->reset(&z->stream);
- if (err != Z_OK) {
+ if (err != Z_OK && !ZSTREAM_IS_FINALIZE(z)) {
raise_zlib_error(err, z->stream.msg);
}
z->flags = ZSTREAM_FLAG_READY;
@@ -679,28 +667,31 @@ zstream_reset(z)
zstream_reset_input(z);
}
-static VALUE
+static void
zstream_end(z)
struct zstream *z;
{
int err;
- if (!ZSTREAM_IS_READY(z)) {
- rb_warning("attempt to close uninitialized zstream; ignored.");
- return Qnil;
+ if (!ZSTREAM_IS_READY(z) && !ZSTREAM_IS_FINALIZE(z)) {
+ if (RTEST(ruby_debug)) {
+ rb_warning("attempt to close uninitialized zstream; ignored.");
+ }
+ return;
}
if (z->flags & ZSTREAM_FLAG_IN_STREAM) {
- rb_warning("attempt to close unfinished zstream; reset forced.");
+ if (RTEST(ruby_debug)) {
+ rb_warning("attempt to close unfinished zstream; reset forced.");
+ }
zstream_reset(z);
}
zstream_reset_input(z);
err = z->func->end(&z->stream);
- if (err != Z_OK) {
+ if (err != Z_OK && !ZSTREAM_IS_FINALIZE(z)) {
raise_zlib_error(err, z->stream.msg);
}
z->flags = 0;
- return Qnil;
}
static void
@@ -712,7 +703,6 @@ zstream_run(z, src, len, flush)
{
uInt n;
int err;
- volatile VALUE guard;
if (NIL_P(z->input) && len == 0) {
z->stream.next_in = "";
@@ -722,10 +712,6 @@ zstream_run(z, src, len, flush)
zstream_append_input(z, src, len);
z->stream.next_in = RSTRING(z->input)->ptr;
z->stream.avail_in = RSTRING(z->input)->len;
- /* keep reference to `z->input' so as not to be garbage collected
- after zstream_reset_input() and prevent `z->stream.next_in'
- from dangling. */
- guard = z->input;
}
if (z->stream.avail_out == 0) {
@@ -765,7 +751,6 @@ zstream_run(z, src, len, flush)
zstream_reset_input(z);
if (z->stream.avail_in > 0) {
zstream_append_input(z, z->stream.next_in, z->stream.avail_in);
- guard = Qnil; /* prevent tail call to make guard effective */
}
}
@@ -820,23 +805,11 @@ zstream_mark(z)
}
static void
-zstream_finalize(z)
- struct zstream *z;
-{
- int err = z->func->end(&z->stream);
- if (err == Z_STREAM_ERROR)
- finalizer_warn("the stream state was inconsistent.");
- if (err == Z_DATA_ERROR)
- finalizer_warn("the stream was freed prematurely.");
-}
-
-static void
zstream_free(z)
struct zstream *z;
{
- if (ZSTREAM_IS_READY(z)) {
- zstream_finalize(z);
- }
+ z->flags |= ZSTREAM_FLAG_FINALIZE;
+ zstream_end(z);
free(z);
}
@@ -1179,31 +1152,26 @@ rb_deflate_initialize(argc, argv, obj)
* Duplicates the deflate stream.
*/
static VALUE
-rb_deflate_init_copy(self, orig)
- VALUE self, orig;
+rb_deflate_clone(obj)
+ VALUE obj;
{
- struct zstream *z1 = get_zstream(self);
- struct zstream *z2 = get_zstream(orig);
+ struct zstream *z = get_zstream(obj);
+ struct zstream *z2;
+ VALUE clone;
int err;
- err = deflateCopy(&z1->stream, &z2->stream);
+ clone = zstream_deflate_new(rb_class_of(obj));
+ Data_Get_Struct(clone, struct zstream, z2);
+
+ err = deflateCopy(&z2->stream, &z->stream);
if (err != Z_OK) {
raise_zlib_error(err, 0);
}
- z1->flags = z2->flags;
-
- return self;
-}
-
-static VALUE
-deflate_run(args)
- VALUE args;
-{
- struct zstream *z = (struct zstream *)((VALUE *)args)[0];
- VALUE src = ((VALUE *)args)[1];
- zstream_run(z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH);
- return zstream_detach_buffer(z);
+ z2->flags = z->flags;
+ CLONESETUP(clone, obj);
+ OBJ_INFECT(clone, obj);
+ return clone;
}
/*
@@ -1233,7 +1201,7 @@ rb_deflate_s_deflate(argc, argv, klass)
VALUE klass;
{
struct zstream z;
- VALUE src, level, dst, args[2];
+ VALUE src, level, dst;
int err, lev;
rb_scan_args(argc, argv, "11", &src, &level);
@@ -1247,9 +1215,9 @@ rb_deflate_s_deflate(argc, argv, klass)
}
ZSTREAM_READY(&z);
- args[0] = (VALUE)&z;
- args[1] = src;
- dst = rb_ensure(deflate_run, (VALUE)args, zstream_end, (VALUE)&z);
+ zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH);
+ dst = zstream_detach_buffer(&z);
+ zstream_end(&z);
OBJ_INFECT(dst, src);
return dst;
@@ -1371,7 +1339,9 @@ rb_deflate_params(obj, v_level, v_strategy)
err = deflateParams(&z->stream, level, strategy);
while (err == Z_BUF_ERROR) {
- rb_warning("deflateParams() returned Z_BUF_ERROR");
+ if (RTEST(ruby_debug)) {
+ rb_warning("deflateParams() returned Z_BUF_ERROR");
+ }
zstream_expand_buffer(z);
err = deflateParams(&z->stream, level, strategy);
}
@@ -1460,18 +1430,6 @@ rb_inflate_initialize(argc, argv, obj)
return obj;
}
-static VALUE
-inflate_run(args)
- VALUE args;
-{
- struct zstream *z = (struct zstream *)((VALUE *)args)[0];
- VALUE src = ((VALUE *)args)[1];
-
- zstream_run(z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH);
- zstream_run(z, "", 0, Z_FINISH); /* for checking errors */
- return zstream_detach_buffer(z);
-}
-
/*
* call-seq: Zlib::Inflate.inflate(string)
*
@@ -1494,7 +1452,7 @@ rb_inflate_s_inflate(obj, src)
VALUE obj, src;
{
struct zstream z;
- VALUE dst, args[2];
+ VALUE dst;
int err;
StringValue(src);
@@ -1505,9 +1463,10 @@ rb_inflate_s_inflate(obj, src)
}
ZSTREAM_READY(&z);
- args[0] = (VALUE)&z;
- args[1] = src;
- dst = rb_ensure(inflate_run, (VALUE)args, zstream_end, (VALUE)&z);
+ zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH);
+ zstream_run(&z, "", 0, Z_FINISH); /* for checking errors */
+ dst = zstream_detach_buffer(&z);
+ zstream_end(&z);
OBJ_INFECT(dst, src);
return dst;
@@ -1763,13 +1722,9 @@ static void
gzfile_free(gz)
struct gzfile *gz;
{
- struct zstream *z = &gz->z;
-
- if (ZSTREAM_IS_READY(z)) {
- if (z->func == &deflate_funcs) {
- finalizer_warn("Zlib::GzipWriter object must be closed explicitly.");
- }
- zstream_finalize(z);
+ gz->z.flags |= ZSTREAM_FLAG_FINALIZE;
+ if (ZSTREAM_IS_READY(&gz->z)) {
+ gz->end(gz);
}
free(gz);
}
@@ -2203,19 +2158,11 @@ gzfile_ungetc(gz, c)
}
static VALUE
-gzfile_writer_end_run(arg)
- VALUE arg;
+gzfile_finalize(obj)
+ VALUE obj;
{
- struct gzfile *gz = (struct gzfile *)arg;
-
- if (!(gz->z.flags & GZFILE_FLAG_HEADER_FINISHED)) {
- gzfile_make_header(gz);
- }
-
- zstream_run(&gz->z, "", 0, Z_FINISH);
- gzfile_make_footer(gz);
+ struct gzfile *gz = (struct gzfile *)obj;
gzfile_write_raw(gz);
-
return Qnil;
}
@@ -2223,34 +2170,51 @@ static void
gzfile_writer_end(gz)
struct gzfile *gz;
{
- if (ZSTREAM_IS_CLOSING(&gz->z)) return;
- gz->z.flags |= ZSTREAM_FLAG_CLOSING;
+ int aborted;
- rb_ensure(gzfile_writer_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z);
-}
+ if (ZSTREAM_IS_CLOSED(&gz->z)) return;
+ gz->z.flags |= ZSTREAM_FLAG_CLOSED;
-static VALUE
-gzfile_reader_end_run(arg)
- VALUE arg;
-{
- struct gzfile *gz = (struct gzfile *)arg;
-
- if (GZFILE_IS_FINISHED(gz)
- && !(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) {
- gzfile_check_footer(gz);
+ if (!(gz->z.flags & GZFILE_FLAG_HEADER_FINISHED)) {
+ gzfile_make_header(gz);
}
- return Qnil;
+ zstream_run(&gz->z, "", 0, Z_FINISH);
+ gzfile_make_footer(gz);
+
+ if (ZSTREAM_IS_FINALIZE(&gz->z)) {
+ if (NIL_P(gz->io)) return;
+ rb_warn("Zlib::GzipWriter object must be closed explicitly.");
+ if (!SPECIAL_CONST_P(gz->io) && OBJ_IS_FREED(gz->io)) {
+ aborted = 1;
+ }
+ else {
+ rb_protect(gzfile_finalize, (VALUE)gz, &aborted);
+ }
+ if (aborted) {
+ rb_warn("gzip footer is not written; broken gzip file");
+ }
+ zstream_end(&gz->z);
+ return;
+ }
+ gzfile_write_raw(gz);
+ zstream_end(&gz->z);
}
static void
gzfile_reader_end(gz)
struct gzfile *gz;
{
- if (ZSTREAM_IS_CLOSING(&gz->z)) return;
- gz->z.flags |= ZSTREAM_FLAG_CLOSING;
+ if (ZSTREAM_IS_CLOSED(&gz->z)) return;
+ gz->z.flags |= ZSTREAM_FLAG_CLOSED;
+
+ if (GZFILE_IS_FINISHED(gz)
+ && !ZSTREAM_IS_FINALIZE(&gz->z)
+ && !(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) {
+ gzfile_check_footer(gz);
+ }
- rb_ensure(gzfile_reader_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z);
+ zstream_end(&gz->z);
}
static void
@@ -3012,7 +2976,7 @@ rb_gzreader_readchar(obj)
VALUE dst;
dst = rb_gzreader_getc(obj);
if (NIL_P(dst)) {
- rb_raise(rb_eEOFError, "end of file reached");
+ rb_raise(rb_eEOFError, "End of file reached");
}
return dst;
}
@@ -3194,7 +3158,7 @@ rb_gzreader_readline(argc, argv, obj)
VALUE dst;
dst = rb_gzreader_gets(argc, argv, obj);
if (NIL_P(dst)) {
- rb_raise(rb_eEOFError, "end of file reached");
+ rb_raise(rb_eEOFError, "End of file reached");
}
return dst;
}
@@ -3369,7 +3333,7 @@ void Init_zlib()
rb_define_singleton_method(cDeflate, "deflate", rb_deflate_s_deflate, -1);
rb_define_alloc_func(cDeflate, rb_deflate_s_allocate);
rb_define_method(cDeflate, "initialize", rb_deflate_initialize, -1);
- rb_define_method(cDeflate, "initialize_copy", rb_deflate_init_copy, 0);
+ rb_define_method(cDeflate, "clone", rb_deflate_clone, 0);
rb_define_method(cDeflate, "deflate", rb_deflate_deflate, -1);
rb_define_method(cDeflate, "<<", rb_deflate_addstr, 1);
rb_define_method(cDeflate, "flush", rb_deflate_flush, -1);
diff --git a/file.c b/file.c
index d492b6ecd7..610d9a22dc 100644
--- a/file.c
+++ b/file.c
@@ -2,8 +2,8 @@
file.c -
- $Author: nobu $
- $Date: 2006/08/19 02:29:18 $
+ $Author$
+ $Date$
created at: Mon Nov 15 12:24:34 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -64,48 +64,20 @@ char *strrchr _((const char*,const char));
#include <sys/mkdev.h>
#endif
-#if !defined HAVE_LSTAT && !defined lstat
-#define lstat stat
+#ifndef HAVE_LSTAT
+#define lstat(path,st) stat(path,st)
#endif
#if !HAVE_FSEEKO && !defined(fseeko)
# define fseeko fseek
#endif
-#ifdef __BEOS__ /* should not change ID if -1 */
-static int
-be_chown(const char *path, uid_t owner, gid_t group)
-{
- if (owner == -1 || group == -1) {
- struct stat st;
- if (stat(path, &st) < 0) return -1;
- if (owner == -1) owner = st.st_uid;
- if (group == -1) group = st.st_gid;
- }
- return chown(path, owner, group);
-}
-#define chown be_chown
-static int
-be_fchown(int fd, uid_t owner, gid_t group)
-{
- if (owner == -1 || group == -1) {
- struct stat st;
- if (fstat(fd, &st) < 0) return -1;
- if (owner == -1) owner = st.st_uid;
- if (group == -1) group = st.st_gid;
- }
- return fchown(fd, owner, group);
-}
-#define fchown be_fchown
-#endif /* __BEOS__ */
-
VALUE rb_cFile;
VALUE rb_mFileTest;
-VALUE rb_cStat;
+static VALUE rb_cStat;
-static long apply2files _((void (*)(const char *, void *), VALUE, void *));
static long
apply2files(func, vargs, arg)
- void (*func)_((const char *, void *));
+ void (*func)();
VALUE vargs;
void *arg;
{
@@ -124,7 +96,7 @@ apply2files(func, vargs, arg)
/*
* call-seq:
- * file.path -> filename
+ * file.path -> file_ame
*
* Returns the pathname used to create <i>file</i> as a string. Does
* not normalize the name.
@@ -207,20 +179,6 @@ rb_stat_cmp(self, other)
return Qnil;
}
-static VALUE rb_stat_dev _((VALUE));
-static VALUE rb_stat_ino _((VALUE));
-static VALUE rb_stat_mode _((VALUE));
-static VALUE rb_stat_nlink _((VALUE));
-static VALUE rb_stat_uid _((VALUE));
-static VALUE rb_stat_gid _((VALUE));
-static VALUE rb_stat_rdev _((VALUE));
-static VALUE rb_stat_size _((VALUE));
-static VALUE rb_stat_blksize _((VALUE));
-static VALUE rb_stat_blocks _((VALUE));
-static VALUE rb_stat_atime _((VALUE));
-static VALUE rb_stat_mtime _((VALUE));
-static VALUE rb_stat_ctime _((VALUE));
-
/*
* call-seq:
* stat.dev => fixnum
@@ -589,23 +547,23 @@ rb_stat_inspect(self)
{
VALUE str;
int i;
- static const struct {
- const char *name;
- VALUE (*func)_((VALUE));
+ static struct {
+ char *name;
+ VALUE (*func)();
} member[] = {
- {"dev", rb_stat_dev},
- {"ino", rb_stat_ino},
- {"mode", rb_stat_mode},
- {"nlink", rb_stat_nlink},
- {"uid", rb_stat_uid},
- {"gid", rb_stat_gid},
- {"rdev", rb_stat_rdev},
- {"size", rb_stat_size},
- {"blksize", rb_stat_blksize},
- {"blocks", rb_stat_blocks},
- {"atime", rb_stat_atime},
- {"mtime", rb_stat_mtime},
- {"ctime", rb_stat_ctime},
+ {"dev", rb_stat_dev},
+ {"ino", rb_stat_ino},
+ {"mode", rb_stat_mode},
+ {"nlink", rb_stat_nlink},
+ {"uid", rb_stat_uid},
+ {"gid", rb_stat_gid},
+ {"rdev", rb_stat_rdev},
+ {"size", rb_stat_size},
+ {"blksize", rb_stat_blksize},
+ {"blocks", rb_stat_blocks},
+ {"atime", rb_stat_atime},
+ {"mtime", rb_stat_mtime},
+ {"ctime", rb_stat_ctime},
};
str = rb_str_buf_new2("#<");
@@ -662,40 +620,6 @@ rb_stat(file, st)
return stat(StringValueCStr(file), st);
}
-#ifdef _WIN32
-static HANDLE
-w32_io_info(file, st)
- VALUE *file;
- BY_HANDLE_FILE_INFORMATION *st;
-{
- VALUE tmp;
- HANDLE f, ret = 0;
-
- tmp = rb_check_convert_type(*file, T_FILE, "IO", "to_io");
- if (!NIL_P(tmp)) {
- OpenFile *fptr;
-
- GetOpenFile(tmp, fptr);
- f = (HANDLE)rb_w32_get_osfhandle(fileno(fptr->f));
- if (f == (HANDLE)-1) return INVALID_HANDLE_VALUE;
- }
- else {
- SafeStringValue(*file);
- f = CreateFile(StringValueCStr(*file), 0,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, NULL);
- if (f == INVALID_HANDLE_VALUE) return f;
- ret = f;
- }
- if (GetFileType(f) == FILE_TYPE_DISK) {
- ZeroMemory(st, sizeof(*st));
- if (GetFileInformationByHandle(f, st)) return ret;
- }
- if (ret) CloseHandle(ret);
- return INVALID_HANDLE_VALUE;
-}
-#endif
-
/*
* call-seq:
* File.stat(file_name) => stat
@@ -849,17 +773,12 @@ group_member(gid)
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
-#if defined(S_IXGRP) && !defined(_WIN32) && !defined(__CYGWIN__)
-#define USE_GETEUID 1
-#endif
-
-#ifndef HAVE_EACCESS
int
eaccess(path, mode)
const char *path;
int mode;
{
-#ifdef USE_GETEUID
+#if defined(S_IXGRP) && !defined(_WIN32) && !defined(__CYGWIN__)
struct stat st;
int euid;
@@ -889,13 +808,9 @@ eaccess(path, mode)
return -1;
#else
-# if _MSC_VER >= 1400
- mode &= 6;
-# endif
return access(path, mode);
#endif
}
-#endif
/*
@@ -1352,7 +1267,7 @@ check3rdbyte(fname, mode)
* call-seq:
* File.setuid?(file_name) => true or false
*
- * Returns <code>true</code> if the named file has the setuid bit set.
+ * Returns <code>true</code> if the named file is a has the setuid bit set.
*/
static VALUE
@@ -1370,7 +1285,7 @@ test_suid(obj, fname)
* call-seq:
* File.setgid?(file_name) => true or false
*
- * Returns <code>true</code> if the named file has the setgid bit set.
+ * Returns <code>true</code> if the named file is a has the setgid bit set.
*/
static VALUE
@@ -1388,7 +1303,7 @@ test_sgid(obj, fname)
* call-seq:
* File.sticky?(file_name) => true or false
*
- * Returns <code>true</code> if the named file has the sticky bit set.
+ * Returns <code>true</code> if the named file is a has the sticky bit set.
*/
static VALUE
@@ -1404,71 +1319,6 @@ test_sticky(obj, fname)
/*
* call-seq:
- * File.identical?(file_1, file_2) => true or false
- *
- * Returns <code>true</code> if the named files are identical.
- *
- * open("a", "w") {}
- * p File.identical?("a", "a") #=> true
- * p File.identical?("a", "./a") #=> true
- * File.link("a", "b")
- * p File.identical?("a", "b") #=> true
- * File.symlink("a", "c")
- * p File.identical?("a", "c") #=> true
- * open("d", "w") {}
- * p File.identical?("a", "d") #=> false
- */
-
-static VALUE
-test_identical(obj, fname1, fname2)
- VALUE obj, fname1, fname2;
-{
-#ifndef DOSISH
- struct stat st1, st2;
-
- if (rb_stat(fname1, &st1) < 0) return Qfalse;
- if (rb_stat(fname2, &st2) < 0) return Qfalse;
- if (st1.st_dev != st2.st_dev) return Qfalse;
- if (st1.st_ino != st2.st_ino) return Qfalse;
-#else
-#ifdef _WIN32
- BY_HANDLE_FILE_INFORMATION st1, st2;
- HANDLE f1 = 0, f2 = 0;
-#endif
-
- rb_secure(2);
-#ifdef _WIN32
- f1 = w32_io_info(&fname1, &st1);
- if (f1 == INVALID_HANDLE_VALUE) return Qfalse;
- f2 = w32_io_info(&fname2, &st2);
- if (f1) CloseHandle(f1);
- if (f2 == INVALID_HANDLE_VALUE) return Qfalse;
- if (f2) CloseHandle(f2);
-
- if (st1.dwVolumeSerialNumber == st2.dwVolumeSerialNumber &&
- st1.nFileIndexHigh == st2.nFileIndexHigh &&
- st1.nFileIndexLow == st2.nFileIndexLow)
- return Qtrue;
- if (!f1 || !f2) return Qfalse;
- if (rb_w32_iswin95()) return Qfalse;
-#else
- SafeStringValue(fname1);
- fname1 = rb_str_new4(fname1);
- SafeStringValue(fname2);
- if (access(RSTRING(fname1)->ptr, 0)) return Qfalse;
- if (access(RSTRING(fname2)->ptr, 0)) return Qfalse;
-#endif
- fname1 = rb_file_expand_path(fname1, Qnil);
- fname2 = rb_file_expand_path(fname2, Qnil);
- if (RSTRING(fname1)->len != RSTRING(fname2)->len) return Qfalse;
- if (rb_memcicmp(RSTRING(fname1)->ptr, RSTRING(fname2)->ptr, RSTRING(fname1)->len))
- return Qfalse;
-#endif
- return Qtrue;
-}
-
-/*
- * call-seq:
* File.size(file_name) => integer
*
* Returns the size of <code>file_name</code>.
@@ -1695,13 +1545,12 @@ rb_file_ctime(obj)
return rb_time_new(st.st_ctime, 0);
}
-static void chmod_internal _((const char *, void *));
static void
chmod_internal(path, mode)
const char *path;
- void *mode;
+ int mode;
{
- if (chmod(path, *(int *)mode) < 0)
+ if (chmod(path, mode) < 0)
rb_sys_fail(path);
}
@@ -1732,7 +1581,7 @@ rb_file_s_chmod(argc, argv)
rb_scan_args(argc, argv, "1*", &vmode, &rest);
mode = NUM2INT(vmode);
- n = apply2files(chmod_internal, rest, &mode);
+ n = apply2files(chmod_internal, rest, (void *)(long)mode);
return LONG2FIX(n);
}
@@ -1773,13 +1622,12 @@ rb_file_chmod(obj, vmode)
}
#if defined(HAVE_LCHMOD)
-static void lchmod_internal _((const char *, void *));
static void
lchmod_internal(path, mode)
const char *path;
- void *mode;
+ int mode;
{
- if (lchmod(path, (int)mode) < 0)
+ if (lchmod(path, mode) < 0)
rb_sys_fail(path);
}
@@ -1824,13 +1672,11 @@ struct chown_args {
int owner, group;
};
-static void chown_internal _((const char *, void *));
static void
-chown_internal(path, argp)
+chown_internal(path, args)
const char *path;
- void *argp;
+ struct chown_args *args;
{
- struct chown_args *args = (struct chown_args *)argp;
if (chown(path, args->owner, args->group) < 0)
rb_sys_fail(path);
}
@@ -1901,8 +1747,8 @@ rb_file_chown(obj, owner, group)
int o, g;
rb_secure(2);
- o = NIL_P(owner) ? -1 : NUM2INT(owner);
- g = NIL_P(group) ? -1 : NUM2INT(group);
+ o = NUM2INT(owner);
+ g = NUM2INT(group);
GetOpenFile(obj, fptr);
#if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__)
if (!fptr->path) return Qnil;
@@ -1917,13 +1763,11 @@ rb_file_chown(obj, owner, group)
}
#if defined(HAVE_LCHOWN) && !defined(__CHECKER__)
-static void lchown_internal _((const char *, void *));
static void
-lchown_internal(path, argp)
+lchown_internal(path, args)
const char *path;
- void *argp;
+ struct chown_args *args;
{
- struct chown_args *args = (struct chown_args *)argp;
if (lchown(path, args->owner, args->group) < 0)
rb_sys_fail(path);
}
@@ -1979,16 +1823,13 @@ rb_file_s_lchown(argc, argv)
struct timeval rb_time_timeval();
-static void utime_internal _((const char *, void *));
-
#if defined(HAVE_UTIMES) && !defined(__CHECKER__)
static void
-utime_internal(path, arg)
- const char *path;
- void *arg;
+utime_internal(path, tvp)
+ char *path;
+ struct timeval tvp[];
{
- struct timeval *tvp = arg;
if (utimes(path, tvp) < 0)
rb_sys_fail(path);
}
@@ -2030,11 +1871,10 @@ struct utimbuf {
#endif
static void
-utime_internal(path, arg)
+utime_internal(path, utp)
const char *path;
- void *arg;
+ struct utimbuf *utp;
{
- struct utimbuf *utp = arg;
if (utime(path, utp) < 0)
rb_sys_fail(path);
}
@@ -2092,7 +1932,6 @@ static VALUE
rb_file_s_link(klass, from, to)
VALUE klass, from, to;
{
-#ifdef HAVE_LINK
SafeStringValue(from);
SafeStringValue(to);
@@ -2100,10 +1939,6 @@ rb_file_s_link(klass, from, to)
sys_fail2(from, to);
}
return INT2FIX(0);
-#else
- rb_notimplement();
- return Qnil; /* not reached */
-#endif
}
/*
@@ -2159,11 +1994,7 @@ rb_file_s_readlink(klass, path)
SafeStringValue(path);
buf = xmalloc(size);
- while ((rv = readlink(RSTRING(path)->ptr, buf, size)) == size
-#ifdef _AIX
- || (rv < 0 && errno == ERANGE) /* quirky behavior of GPFS */
-#endif
- ) {
+ while ((rv = readlink(StringValueCStr(path), buf, size)) == size) {
size *= 2;
buf = xrealloc(buf, size);
}
@@ -2181,11 +2012,9 @@ rb_file_s_readlink(klass, path)
#endif
}
-static void unlink_internal _((const char *, void *));
static void
-unlink_internal(path, arg)
+unlink_internal(path)
const char *path;
- void *arg;
{
if (unlink(path) < 0)
rb_sys_fail(path);
@@ -2232,16 +2061,10 @@ rb_file_s_rename(klass, from, to)
src = StringValueCStr(from);
dst = StringValueCStr(to);
-#if defined __CYGWIN__
- errno = 0;
-#endif
if (rename(src, dst) < 0) {
#if defined __CYGWIN__
- extern unsigned long __attribute__((stdcall)) GetLastError(void);
- if (errno == 0) { /* This is a bug of old Cygwin */
- /* incorrect as cygwin errno, but the last resort */
- errno = GetLastError();
- }
+ extern unsigned long __attribute__((stdcall)) GetLastError();
+ errno = GetLastError(); /* This is a Cygwin bug */
#elif defined DOSISH && !defined _WIN32
if (errno == EEXIST
#if defined (__EMX__)
@@ -2380,11 +2203,7 @@ rb_path_next(s)
return (char *)s;
}
-#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER)
#define skipprefix rb_path_skip_prefix
-#else
-#define skipprefix(path) (path)
-#endif
char *
rb_path_skip_prefix(path)
const char *path;
@@ -2392,9 +2211,7 @@ rb_path_skip_prefix(path)
#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER)
#ifdef DOSISH_UNC
if (isdirsep(path[0]) && isdirsep(path[1])) {
- path += 2;
- while (isdirsep(*path)) path++;
- if (*(path = nextdirsep(path)) && path[1] && !isdirsep(path[1]))
+ if (*(path = nextdirsep(path + 2)))
path = nextdirsep(path + 1);
return (char *)path;
}
@@ -2750,9 +2567,6 @@ rb_file_s_basename(argc, argv)
{
VALUE fname, fext, basename;
char *name, *p;
-#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
- char *root;
-#endif
int f;
if (rb_scan_args(argc, argv, "11", &fname, &fext) == 2) {
@@ -2761,31 +2575,15 @@ rb_file_s_basename(argc, argv)
StringValue(fname);
if (RSTRING(fname)->len == 0 || !*(name = RSTRING(fname)->ptr))
return fname;
- name = skipprefix(name);
-#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
- root = name;
-#endif
- while (isdirsep(*name))
- name++;
- if (!*name) {
+ if (!*(name = skiproot(name))) {
p = name - 1;
f = 1;
-#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
- if (name != root) {
- /* has slashes */
- }
#ifdef DOSISH_DRIVE_LETTER
- else if (*p == ':') {
+ if (*p == ':') {
p++;
f = 0;
}
#endif
-#ifdef DOSISH_UNC
- else {
- p = "/";
- }
-#endif
-#endif
}
else if (!(p = strrdirsep(name))) {
if (NIL_P(fext) || !(f = rmext(name, StringValueCStr(fext)))) {
@@ -2827,8 +2625,8 @@ rb_file_s_dirname(klass, fname)
name = StringValueCStr(fname);
root = skiproot(name);
#ifdef DOSISH_UNC
- if (root > name + 1 && isdirsep(*name))
- root = skipprefix(name = root - 2);
+ if (root > name + 2 && isdirsep(*name))
+ name = root - 2;
#else
if (root > name + 1)
name = root - 1;
@@ -2839,16 +2637,9 @@ rb_file_s_dirname(klass, fname)
}
if (p == name)
return rb_str_new2(".");
-#ifdef DOSISH_DRIVE_LETTER
- if (has_drive_letter(name) && isdirsep(*(name + 2))) {
- dirname = rb_str_new(name, 3);
- rb_str_cat(dirname, skiproot(name + 2), p - skiproot(name + 2));
- }
- else
-#endif
dirname = rb_str_new(name, p - name);
#ifdef DOSISH_DRIVE_LETTER
- if (has_drive_letter(name) && root == name + 2 && p - name == 2)
+ if (root == name + 2 && name[1] == ':')
rb_str_cat(dirname, ".", 1);
#endif
OBJ_INFECT(dirname, fname);
@@ -2884,7 +2675,7 @@ rb_file_s_extname(klass, fname)
p++;
e = strrchr(p, '.'); /* get the last dot of the last component */
- if (!e || e == p || !e[1]) /* no dot, or the only dot is first or end? */
+ if (!e || e == p) /* no dot, or the only dot is first? */
return rb_str_new2("");
extname = rb_str_new(e, chompdirsep(e) - e); /* keep the dot, too! */
OBJ_INFECT(extname, fname);
@@ -2929,7 +2720,7 @@ rb_file_join(ary, sep)
long len, i;
int taint = 0;
VALUE result, tmp;
- char *name, *tail;
+ char *name;
if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
if (OBJ_TAINTED(ary)) taint = 1;
@@ -2966,18 +2757,11 @@ rb_file_join(ary, sep)
}
break;
default:
- StringValueCStr(tmp);
+ tmp = rb_obj_as_string(tmp);
}
name = StringValueCStr(result);
- if (i > 0 && !NIL_P(sep)) {
- tail = chompdirsep(name);
- if (RSTRING(tmp)->ptr && isdirsep(RSTRING(tmp)->ptr[0])) {
- RSTRING(result)->len = tail - name;
- }
- else if (!*tail) {
- rb_str_buf_append(result, sep);
- }
- }
+ if (i > 0 && !NIL_P(sep) && !*chompdirsep(name))
+ rb_str_buf_append(result, sep);
rb_str_buf_append(result, tmp);
if (OBJ_TAINTED(tmp)) taint = 1;
}
@@ -3117,55 +2901,34 @@ rb_file_truncate(obj, len)
# define LOCK_UN 8
# endif
-#ifdef __CYGWIN__
-static int
-#include <winerror.h>
-cygwin_flock(int fd, int op)
-{
- int old_errno = errno;
- int ret = flock(fd, op);
- if (GetLastError() == ERROR_NOT_LOCKED) {
- ret = 0;
- errno = old_errno;
- }
- return ret;
-}
-# define flock(fd, op) cygwin_flock(fd, op)
-#endif
-
+#if 1
static int
rb_thread_flock(fd, op, fptr)
int fd, op;
OpenFile *fptr;
{
if (rb_thread_alone() || (op & LOCK_NB)) {
- int ret;
- TRAP_BEG;
- ret = flock(fd, op);
- TRAP_END;
- return ret;
+ return flock(fd, op);
}
op |= LOCK_NB;
while (flock(fd, op) < 0) {
switch (errno) {
- case EAGAIN:
- case EACCES:
+ case EAGAIN:
+ case EACCES:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
rb_thread_polling(); /* busy wait */
rb_io_check_closed(fptr);
- continue;
+ continue;
default:
return -1;
}
}
return 0;
}
-#ifdef __CYGWIN__
-# undef flock
-#endif
#define flock(fd, op) rb_thread_flock(fd, op, fptr)
+#endif
/*
* call-seq:
@@ -3214,19 +2977,19 @@ rb_file_flock(obj, operation)
}
retry:
if (flock(fileno(fptr->f), op) < 0) {
- switch (errno) {
- case EAGAIN:
- case EACCES:
+ switch (errno) {
+ case EAGAIN:
+ case EACCES:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
- case EWOULDBLOCK:
+ case EWOULDBLOCK:
#endif
- return Qfalse;
+ return Qfalse;
case EINTR:
#if defined(ERESTART)
case ERESTART:
#endif
goto retry;
- }
+ }
rb_sys_fail(fptr->path);
}
#endif
@@ -3275,14 +3038,14 @@ test_check(n, argc, argv)
* ?d | boolean | True if file1 exists and is a directory
* ?e | boolean | True if file1 exists
* ?f | boolean | True if file1 exists and is a regular file
- * ?g | boolean | True if file1 has the \CF{setgid} bit
+ * ?g | boolean | True if files has the \CF{setgid} bit
* | | set (false under NT)
* ?G | boolean | True if file1 exists and has a group
* | | ownership equal to the caller's group
* ?k | boolean | True if file1 exists and has the sticky bit set
- * ?l | boolean | True if file1 exists and is a symbolic link
+ * ?l | boolean | True if files exists and is a symbolic link
* ?M | Time | Last modification time for file1
- * ?o | boolean | True if file1 exists and is owned by
+ * ?o | boolean | True if files exists and is owned by
* | | the caller's effective uid
* ?O | boolean | True if file1 exists and is owned by
* | | the caller's real uid
@@ -3291,7 +3054,7 @@ test_check(n, argc, argv)
* | | uid/gid of the caller
* ?R | boolean | True if file is readable by the real
* | | uid/gid of the caller
- * ?s | int/nil | If file1 has nonzero size, return the size,
+ * ?s | int/nil | If files has nonzero size, return the size,
* | | otherwise return nil
* ?S | boolean | True if file1 exists and is a socket
* ?u | boolean | True if file1 has the setuid bit set
@@ -3307,7 +3070,7 @@ test_check(n, argc, argv)
*
* Tests that take two files:
*
- * ?- | boolean | True if file1 and file2 are identical
+ * ?- | boolean | True if file1 is a hard link to file2
* ?= | boolean | True if the modification times of file1
* | | and file2 are equal
* ?< | boolean | True if the modification time of file1
@@ -3421,12 +3184,7 @@ rb_f_test(argc, argv)
}
}
- if (cmd == '-') {
- CHECK(2);
- return test_identical(0, argv[1], argv[2]);
- }
-
- if (strchr("=<>", cmd)) {
+ if (strchr("-=<>", cmd)) {
struct stat st1, st2;
CHECK(2);
@@ -3434,6 +3192,11 @@ rb_f_test(argc, argv)
if (rb_stat(argv[2], &st2) < 0) return Qfalse;
switch (cmd) {
+ case '-':
+ if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
+ return Qtrue;
+ return Qfalse;
+
case '=':
if (st1.st_mtime == st2.st_mtime) return Qtrue;
return Qfalse;
@@ -3445,7 +3208,7 @@ rb_f_test(argc, argv)
case '<':
if (st1.st_mtime < st2.st_mtime) return Qtrue;
return Qfalse;
- }
+ }
}
/* unknown command */
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
@@ -3507,7 +3270,6 @@ rb_stat_init(obj, fname)
return Qnil;
}
-/* :nodoc: */
static VALUE
rb_stat_init_copy(copy, orig)
VALUE copy, orig;
@@ -3754,9 +3516,6 @@ rb_stat_r(obj)
{
struct stat *st = get_stat(obj);
-#ifdef USE_GETEUID
- if (geteuid() == 0) return Qtrue;
-#endif
#ifdef S_IRUSR
if (rb_stat_owned(obj))
return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
@@ -3790,9 +3549,6 @@ rb_stat_R(obj)
{
struct stat *st = get_stat(obj);
-#ifdef USE_GETEUID
- if (getuid() == 0) return Qtrue;
-#endif
#ifdef S_IRUSR
if (rb_stat_rowned(obj))
return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
@@ -3824,9 +3580,6 @@ rb_stat_w(obj)
{
struct stat *st = get_stat(obj);
-#ifdef USE_GETEUID
- if (geteuid() == 0) return Qtrue;
-#endif
#ifdef S_IWUSR
if (rb_stat_owned(obj))
return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
@@ -3858,9 +3611,6 @@ rb_stat_W(obj)
{
struct stat *st = get_stat(obj);
-#ifdef USE_GETEUID
- if (getuid() == 0) return Qtrue;
-#endif
#ifdef S_IWUSR
if (rb_stat_rowned(obj))
return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
@@ -3894,11 +3644,6 @@ rb_stat_x(obj)
{
struct stat *st = get_stat(obj);
-#ifdef USE_GETEUID
- if (geteuid() == 0) {
- return st->st_mode & S_IXUGO ? Qtrue : Qfalse;
- }
-#endif
#ifdef S_IXUSR
if (rb_stat_owned(obj))
return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
@@ -3928,11 +3673,6 @@ rb_stat_X(obj)
{
struct stat *st = get_stat(obj);
-#ifdef USE_GETEUID
- if (getuid() == 0) {
- return st->st_mode & S_IXUGO ? Qtrue : Qfalse;
- }
-#endif
#ifdef S_IXUSR
if (rb_stat_rowned(obj))
return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
@@ -4071,7 +3811,7 @@ rb_stat_sticky(obj)
return Qfalse;
}
-VALUE rb_mFConst;
+static VALUE rb_mFConst;
void
rb_file_const(name, value)
@@ -4099,12 +3839,11 @@ is_absolute_path(path)
#ifndef DOSISH
static int
-path_check_0(fpath, loadpath)
- VALUE fpath;
- int loadpath;
+path_check_1(path)
+ VALUE path;
{
struct stat st;
- char *p0 = StringValueCStr(fpath);
+ char *p0 = StringValueCStr(path);
char *p = 0, *s;
if (!is_absolute_path(p0)) {
@@ -4116,7 +3855,7 @@ path_check_0(fpath, loadpath)
rb_str_cat2(newpath, "/");
rb_str_cat2(newpath, p0);
- return path_check_0(newpath, loadpath);
+ return path_check_1(newpath);
}
for (;;) {
#ifndef S_IWOTH
@@ -4124,7 +3863,7 @@ path_check_0(fpath, loadpath)
#endif
if (stat(p0, &st) == 0 && S_ISDIR(st.st_mode) && (st.st_mode & S_IWOTH)
#ifdef S_ISVTX
- && (loadpath || !(st.st_mode & S_ISVTX))
+ && !(st.st_mode & S_ISVTX)
#endif
) {
rb_warn("Insecure world writable dir %s, mode 0%o", p0, st.st_mode);
@@ -4140,17 +3879,6 @@ path_check_0(fpath, loadpath)
}
#endif
-static int
-fpath_check(path)
- char *path;
-{
-#ifndef DOSISH
- return path_check_0(rb_str_new2(path), Qfalse);
-#else
- return 1;
-#endif
-}
-
int
rb_path_check(path)
char *path;
@@ -4167,7 +3895,7 @@ rb_path_check(path)
if (!p) p = pend;
for (;;) {
- if (!path_check_0(rb_str_new(p0, p - p0), Qtrue)) {
+ if (!path_check_1(rb_str_new(p0, p - p0))) {
return 0; /* not safe */
}
p0 = p + 1;
@@ -4279,7 +4007,7 @@ rb_find_file(path)
#if defined(__MACOS__) || defined(riscos)
if (is_macos_native_path(f)) {
- if (rb_safe_level() >= 1 && !fpath_check(f)) {
+ if (rb_safe_level() >= 1 && !rb_path_check(f)) {
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
}
if (file_load_ok(f)) return path;
@@ -4287,7 +4015,7 @@ rb_find_file(path)
#endif
if (is_absolute_path(f)) {
- if (rb_safe_level() >= 1 && !fpath_check(f)) {
+ if (rb_safe_level() >= 1 && !rb_path_check(f)) {
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
}
if (file_load_ok(f)) return path;
@@ -4328,7 +4056,7 @@ rb_find_file(path)
return 0; /* no path, no load */
}
f = dln_find_file(f, lpath);
- if (rb_safe_level() >= 1 && !fpath_check(f)) {
+ if (rb_safe_level() >= 1 && !rb_path_check(f)) {
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
}
if (file_load_ok(f)) {
@@ -4415,8 +4143,6 @@ Init_File()
define_filetest_function("setgid?", test_sgid, 1);
define_filetest_function("sticky?", test_sticky, 1);
- define_filetest_function("identical?", test_identical, 2);
-
rb_define_singleton_method(rb_cFile, "stat", rb_file_s_stat, 1);
rb_define_singleton_method(rb_cFile, "lstat", rb_file_s_lstat, 1);
rb_define_singleton_method(rb_cFile, "ftype", rb_file_s_ftype, 1);
diff --git a/gc.c b/gc.c
index f2530f07ef..90774177e6 100644
--- a/gc.c
+++ b/gc.c
@@ -2,8 +2,8 @@
gc.c -
- $Author: matz $
- $Date: 2006/08/25 08:12:46 $
+ $Author$
+ $Date$
created at: Tue Oct 5 09:44:46 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -66,7 +66,9 @@ void rb_io_fptr_finalize _((struct OpenFile*));
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
-# ifndef _AIX
+# ifdef _AIX
+ #pragma alloca
+# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca ();
# endif
@@ -93,7 +95,7 @@ rb_memerror()
{
static int recurse = 0;
- if (!nomem_error || (recurse > 0 && rb_safe_level() < 4)) {
+ if (recurse > 0 && rb_safe_level() < 4) {
fprintf(stderr, "[FATAL] failed to allocate memory\n");
exit(1);
}
@@ -183,14 +185,14 @@ static st_table *finalizer_table = 0;
/*
* call-seq:
* GC.enable => true or false
- *
+ *
* Enables garbage collection, returning <code>true</code> if garbage
* collection was previously disabled.
- *
+ *
* GC.disable #=> false
* GC.enable #=> true
* GC.enable #=> false
- *
+ *
*/
VALUE
@@ -205,13 +207,13 @@ rb_gc_enable()
/*
* call-seq:
* GC.disable => true or false
- *
+ *
* Disables garbage collection, returning <code>true</code> if garbage
* collection was already disabled.
- *
+ *
* GC.disable #=> false
* GC.disable #=> true
- *
+ *
*/
VALUE
@@ -274,10 +276,6 @@ rb_global_variable(var)
rb_gc_register_address(var);
}
-#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__)
-#pragma pack(push, 1) /* magic for reducing sizeof(RVALUE): 24 -> 20 */
-#endif
-
typedef struct RVALUE {
union {
struct {
@@ -298,7 +296,7 @@ typedef struct RVALUE {
struct RFile file;
struct RNode node;
struct RMatch match;
- struct RVarmap varmap;
+ struct RVarmap varmap;
struct SCOPE scope;
} as;
#ifdef GC_DEBUG
@@ -307,16 +305,11 @@ typedef struct RVALUE {
#endif
} RVALUE;
-#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__)
-#pragma pack(pop)
-#endif
-
static RVALUE *freelist = 0;
static RVALUE *deferred_final_list = 0;
#define HEAPS_INCREMENT 10
static struct heaps_slot {
- void *membase;
RVALUE *slot;
int limit;
} *heaps;
@@ -354,7 +347,8 @@ add_heap()
}
for (;;) {
- RUBY_CRITICAL(p = (RVALUE*)malloc(sizeof(RVALUE)*(heap_slots+1)));
+ RUBY_CRITICAL(p = heaps[heaps_used].slot = (RVALUE*)malloc(sizeof(RVALUE)*heap_slots));
+ heaps[heaps_used].limit = heap_slots;
if (p == 0) {
if (heap_slots == HEAP_MIN_SLOTS) {
rb_memerror();
@@ -362,13 +356,6 @@ add_heap()
heap_slots = HEAP_MIN_SLOTS;
continue;
}
- heaps[heaps_used].membase = p;
- if ((VALUE)p % sizeof(RVALUE) == 0)
- heap_slots += 1;
- else
- p = (RVALUE*)((VALUE)p + sizeof(RVALUE) - ((VALUE)p % sizeof(RVALUE)));
- heaps[heaps_used].slot = p;
- heaps[heaps_used].limit = heap_slots;
break;
}
pend = p + heap_slots;
@@ -376,7 +363,6 @@ add_heap()
if (himem < pend) himem = pend;
heaps_used++;
heap_slots *= 1.8;
- if (heap_slots <= 0) heap_slots = HEAP_MIN_SLOTS;
while (p < pend) {
p->as.free.flags = 0;
@@ -412,7 +398,7 @@ rb_data_object_alloc(klass, datap, dmark, dfree)
RUBY_DATA_FUNC dfree;
{
NEWOBJ(data, struct RData);
- if (klass) Check_Type(klass, T_CLASS);
+ Check_Type(klass, T_CLASS);
OBJSETUP(data, klass, T_DATA);
data->data = datap;
data->dfree = dfree;
@@ -617,12 +603,12 @@ is_pointer_to_heap(ptr)
register long i;
if (p < lomem || p > himem) return Qfalse;
- if ((VALUE)p % sizeof(RVALUE) != 0) return Qfalse;
/* check if p looks like a pointer */
for (i=0; i < heaps_used; i++) {
heap_org = heaps[i].slot;
- if (heap_org <= p && p < heap_org + heaps[i].limit)
+ if (heap_org <= p && p < heap_org + heaps[i].limit &&
+ ((((char*)p)-((char*)heap_org))%sizeof(RVALUE)) == 0)
return Qtrue;
}
return Qfalse;
@@ -633,11 +619,9 @@ mark_locations_array(x, n)
register VALUE *x;
register long n;
{
- VALUE v;
while (n--) {
- v = *x;
- if (is_pointer_to_heap((void *)v)) {
- gc_mark(v, 0);
+ if (is_pointer_to_heap((void *)*x)) {
+ gc_mark(*x, 0);
}
x++;
}
@@ -663,7 +647,7 @@ mark_entry(key, value, lev)
return ST_CONTINUE;
}
-static void
+void
mark_tbl(tbl, lev)
st_table *tbl;
int lev;
@@ -690,7 +674,7 @@ mark_keyvalue(key, value, lev)
return ST_CONTINUE;
}
-static void
+void
mark_hash(tbl, lev)
st_table *tbl;
int lev;
@@ -717,7 +701,7 @@ rb_gc_mark_maybe(obj)
#define GC_LEVEL_MAX 250
-static void
+void
gc_mark(ptr, lev)
VALUE ptr;
int lev;
@@ -727,7 +711,7 @@ gc_mark(ptr, lev)
obj = RANY(ptr);
if (rb_special_const_p(ptr)) return; /* special const not marked */
if (obj->as.basic.flags == 0) return; /* free cell */
- if (obj->as.basic.flags & FL_MARK) return; /* already marked */
+ if (obj->as.basic.flags & FL_MARK) return; /* already marked */
obj->as.basic.flags |= FL_MARK;
if (lev > GC_LEVEL_MAX || (lev == 0 && ruby_stack_check())) {
@@ -765,7 +749,7 @@ gc_mark_children(ptr, lev)
obj = RANY(ptr);
if (rb_special_const_p(ptr)) return; /* special const not marked */
if (obj->as.basic.flags == 0) return; /* free cell */
- if (obj->as.basic.flags & FL_MARK) return; /* already marked */
+ if (obj->as.basic.flags & FL_MARK) return; /* already marked */
obj->as.basic.flags |= FL_MARK;
marking:
@@ -828,9 +812,6 @@ gc_mark_children(ptr, lev)
case NODE_OP_ASGN_OR:
case NODE_OP_ASGN_AND:
case NODE_MODULE:
- case NODE_ALIAS:
- case NODE_VALIAS:
- case NODE_ARGS:
gc_mark((VALUE)obj->as.node.u1.node, lev);
/* fall through */
case NODE_METHOD: /* 2 */
@@ -845,7 +826,6 @@ gc_mark_children(ptr, lev)
case NODE_COLON3:
case NODE_OPT_N:
case NODE_EVSTR:
- case NODE_UNDEF:
ptr = (VALUE)obj->as.node.u2.node;
goto again;
@@ -860,6 +840,7 @@ gc_mark_children(ptr, lev)
case NODE_NEXT:
case NODE_YIELD:
case NODE_COLON2:
+ case NODE_ARGS:
case NODE_SPLAT:
case NODE_TO_ARY:
case NODE_SVALUE:
@@ -884,8 +865,11 @@ gc_mark_children(ptr, lev)
case NODE_CVAR:
case NODE_NTH_REF:
case NODE_BACK_REF:
+ case NODE_ALIAS:
+ case NODE_VALIAS:
case NODE_REDO:
case NODE_RETRY:
+ case NODE_UNDEF:
case NODE_SELF:
case NODE_NIL:
case NODE_TRUE:
@@ -894,11 +878,13 @@ gc_mark_children(ptr, lev)
case NODE_BLOCK_ARG:
case NODE_POSTEXE:
break;
+#ifdef C_ALLOCA
case NODE_ALLOCA:
mark_locations_array((VALUE*)obj->as.node.u1.value,
obj->as.node.u3.cnt);
ptr = (VALUE)obj->as.node.u2.node;
goto again;
+#endif
default: /* unlisted NODE */
if (is_pointer_to_heap(obj->as.node.u1.node)) {
@@ -1033,7 +1019,7 @@ free_unused_heaps()
for (i = j = 1; j < heaps_used; i++) {
if (heaps[i].limit == 0) {
- free(heaps[i].membase);
+ free(heaps[i].slot);
heaps_used--;
}
else {
@@ -1045,8 +1031,6 @@ free_unused_heaps()
}
}
-void rb_gc_abort_threads(void);
-
static void
gc_sweep()
{
@@ -1054,14 +1038,6 @@ gc_sweep()
int freed = 0;
int i;
unsigned long live = 0;
- unsigned long free_min = 0;
-
- for (i = 0; i < heaps_used; i++) {
- free_min += heaps[i].limit;
- }
- free_min = free_min * 0.2;
- if (free_min < FREE_MIN)
- free_min = FREE_MIN;
if (ruby_in_compile && ruby_parser_stack_on_heap()) {
/* should not reclaim nodes during compilation
@@ -1077,9 +1053,7 @@ gc_sweep()
}
mark_source_filename(ruby_sourcefile);
- if (source_filenames) {
- st_foreach(source_filenames, sweep_source_filename, 0);
- }
+ st_foreach(source_filenames, sweep_source_filename, 0);
freelist = 0;
final_list = deferred_final_list;
@@ -1109,7 +1083,7 @@ gc_sweep()
}
else if (RBASIC(p)->flags == FL_MARK) {
/* objects to be finalized */
- /* do nothing remain marked */
+ /* do notning remain marked */
}
else {
RBASIC(p)->flags &= ~FL_MARK;
@@ -1117,12 +1091,12 @@ gc_sweep()
}
p++;
}
- if (n == heaps[i].limit && freed > free_min) {
+ if (n == heaps[i].limit && freed > FREE_MIN) {
RVALUE *pp;
heaps[i].limit = 0;
for (pp = final_list; pp != final; pp = pp->as.free.next) {
- pp->as.free.flags |= FL_SINGLETON; /* freeing page mark */
+ p->as.free.flags |= FL_SINGLETON; /* freeing page mark */
}
freelist = free; /* cancel this page from freelist */
}
@@ -1135,7 +1109,7 @@ gc_sweep()
if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT;
}
malloc_increase = 0;
- if (freed < free_min) {
+ if (freed < FREE_MIN) {
add_heap();
}
during_gc = 0;
@@ -1254,9 +1228,11 @@ obj_free(obj)
RUBY_CRITICAL(free(RANY(obj)->as.node.u1.tbl));
}
break;
+#ifdef C_ALLOCA
case NODE_ALLOCA:
RUBY_CRITICAL(free(RANY(obj)->as.node.u1.node));
break;
+#endif
}
return; /* no need to free iv_tbl */
@@ -1264,7 +1240,7 @@ obj_free(obj)
if (RANY(obj)->as.scope.local_vars &&
RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
- if (!(RANY(obj)->as.scope.flags & SCOPE_CLONE) && vars[0] == 0)
+ if (vars[0] == 0)
RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
RUBY_CRITICAL(free(vars));
@@ -1278,8 +1254,8 @@ obj_free(obj)
break;
default:
- rb_bug("gc_sweep(): unknown data type 0x%lx(0x%lx)",
- RANY(obj)->as.basic.flags & T_MASK, obj);
+ rb_bug("gc_sweep(): unknown data type 0x%lx(%ld)", obj,
+ RANY(obj)->as.basic.flags & T_MASK);
}
}
@@ -1287,6 +1263,7 @@ void
rb_gc_mark_frame(frame)
struct FRAME *frame;
{
+ mark_locations_array(frame->argv, frame->argc);
gc_mark((VALUE)frame->node, 0);
}
@@ -1351,12 +1328,10 @@ garbage_collect()
during_gc++;
init_mark_stack();
-
- gc_mark((VALUE)ruby_current_node, 0);
-
+
/* mark frame stack */
for (frame = ruby_frame; frame; frame = frame->prev) {
- rb_gc_mark_frame(frame);
+ rb_gc_mark_frame(frame);
if (frame->tmp) {
struct FRAME *tmp = frame->tmp;
while (tmp) {
@@ -1423,20 +1398,16 @@ garbage_collect()
rb_mark_generic_ivar_tbl();
rb_gc_mark_parser();
-
+
/* gc_mark objects whose marking are not completed*/
- do {
- while (!MARK_STACK_EMPTY) {
- if (mark_stack_overflow){
- gc_mark_all();
- }
- else {
- gc_mark_rest();
- }
+ while (!MARK_STACK_EMPTY){
+ if (mark_stack_overflow){
+ gc_mark_all();
}
- rb_gc_abort_threads();
- } while (!MARK_STACK_EMPTY);
-
+ else {
+ gc_mark_rest();
+ }
+ }
gc_sweep();
}
@@ -1454,7 +1425,7 @@ rb_gc()
* ObjectSpace.garbage_collect => nil
*
* Initiates garbage collection, unless manually disabled.
- *
+ *
*/
VALUE
@@ -1510,6 +1481,14 @@ Init_stack(addr)
STACK_LEVEL_MAX = (rlim.rlim_cur - space) / sizeof(VALUE);
}
}
+#if defined(__ia64__) && (!defined(__GNUC__) || __GNUC__ < 2 || defined(__OPTIMIZE__))
+ /* ruby crashes on IA64 if compiled with optimizer on */
+ /* when if STACK_LEVEL_MAX is greater than this magic number */
+ /* I know this is a kludge. I suspect optimizer bug */
+#define IA64_MAGIC_STACK_LIMIT 49152
+ if (STACK_LEVEL_MAX > IA64_MAGIC_STACK_LIMIT)
+ STACK_LEVEL_MAX = IA64_MAGIC_STACK_LIMIT;
+#endif
#endif
}
@@ -1520,29 +1499,29 @@ Init_stack(addr)
* The <code>ObjectSpace</code> module contains a number of routines
* that interact with the garbage collection facility and allow you to
* traverse all living objects with an iterator.
- *
+ *
* <code>ObjectSpace</code> also provides support for object
* finalizers, procs that will be called when a specific object is
* about to be destroyed by garbage collection.
- *
+ *
* include ObjectSpace
- *
- *
+ *
+ *
* a = "A"
* b = "B"
* c = "C"
- *
- *
+ *
+ *
* define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
* define_finalizer(a, proc {|id| puts "Finalizer two on #{id}" })
* define_finalizer(b, proc {|id| puts "Finalizer three on #{id}" })
- *
+ *
* <em>produces:</em>
- *
+ *
* Finalizer three on 537763470
* Finalizer one on 537763480
* Finalizer two on 537763480
- *
+ *
*/
void
@@ -1624,7 +1603,7 @@ os_obj_of(of)
/*
* call-seq:
* ObjectSpace.each_object([module]) {|obj| ... } => fixnum
- *
+ *
* Calls the block once for each living, nonimmediate object in this
* Ruby process. If <i>module</i> is specified, calls the block
* for only those classes or modules that match (or are a subclass of)
@@ -1634,15 +1613,15 @@ os_obj_of(of)
* never returned. In the example below, <code>each_object</code>
* returns both the numbers we defined and several constants defined in
* the <code>Math</code> module.
- *
+ *
* a = 102.7
* b = 95 # Won't be returned
* c = 12345678987654321
* count = ObjectSpace.each_object(Numeric) {|x| p x }
* puts "Total count: #{count}"
- *
+ *
* <em>produces:</em>
- *
+ *
* 12345678987654321
* 102.7
* 2.71828182845905
@@ -1651,7 +1630,7 @@ os_obj_of(of)
* 1.7976931348623157e+308
* 2.2250738585072e-308
* Total count: 7
- *
+ *
*/
static VALUE
@@ -1727,9 +1706,9 @@ call_final(os, obj)
/*
* call-seq:
* ObjectSpace.undefine_finalizer(obj)
- *
+ *
* Removes all finalizers for <i>obj</i>.
- *
+ *
*/
static VALUE
@@ -1745,10 +1724,10 @@ undefine_final(os, obj)
/*
* call-seq:
* ObjectSpace.define_finalizer(obj, aProc=proc())
- *
- * Adds <i>aProc</i> as a finalizer, to be called after <i>obj</i>
- * was destroyed.
- *
+ *
+ * Adds <i>aProc</i> as a finalizer, to be called when <i>obj</i>
+ * is about to be destroyed.
+ *
*/
static VALUE
@@ -1812,22 +1791,19 @@ run_final(obj)
{
long i;
int status, critical_save = rb_thread_critical;
- VALUE args[3], table, objid;
+ VALUE args[3], table;
- objid = rb_obj_id(obj); /* make obj into id */
rb_thread_critical = Qtrue;
- args[1] = 0;
+ args[1] = rb_ary_new3(1, rb_obj_id(obj)); /* make obj into id */
args[2] = (VALUE)ruby_safe_level;
for (i=0; i<RARRAY(finalizers)->len; i++) {
args[0] = RARRAY(finalizers)->ptr[i];
- if (!args[1]) args[1] = rb_ary_new3(1, objid);
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
}
if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
VALUE final = RARRAY(table)->ptr[i];
args[0] = RARRAY(final)->ptr[1];
- if (!args[1]) args[1] = rb_ary_new3(1, objid);
args[2] = FIX2INT(RARRAY(final)->ptr[0]);
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
}
@@ -1855,9 +1831,7 @@ rb_gc_call_finalizer_at_exit()
/* run finalizers */
if (need_call_final) {
- p = deferred_final_list;
- deferred_final_list = 0;
- finalize_list(p);
+ finalize_list(deferred_final_list);
for (i = 0; i < heaps_used; i++) {
p = heaps[i].slot; pend = p + heaps[i].limit;
while (p < pend) {
@@ -1896,37 +1870,33 @@ rb_gc_call_finalizer_at_exit()
/*
* call-seq:
* ObjectSpace._id2ref(object_id) -> an_object
- *
+ *
* Converts an object id to a reference to the object. May not be
* called on an object id passed as a parameter to a finalizer.
- *
+ *
* s = "I am a string" #=> "I am a string"
* r = ObjectSpace._id2ref(s.object_id) #=> "I am a string"
* r == s #=> true
- *
+ *
*/
static VALUE
-id2ref(obj, objid)
- VALUE obj, objid;
+id2ref(obj, id)
+ VALUE obj, id;
{
unsigned long ptr, p0;
rb_secure(4);
- p0 = ptr = NUM2ULONG(objid);
+ p0 = ptr = NUM2ULONG(id);
if (ptr == Qtrue) return Qtrue;
if (ptr == Qfalse) return Qfalse;
if (ptr == Qnil) return Qnil;
if (FIXNUM_P(ptr)) return (VALUE)ptr;
- ptr = objid ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
-
- if ((ptr % sizeof(RVALUE)) == (4 << 2)) {
- ID symid = ptr / sizeof(RVALUE);
- if (rb_id2name(symid) == 0)
- rb_raise(rb_eRangeError, "%p is not symbol id value", p0);
- return ID2SYM(symid);
+ if (SYMBOL_P(ptr) && rb_id2name(SYM2ID((VALUE)ptr)) != 0) {
+ return (VALUE)ptr;
}
+ ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
if (!is_pointer_to_heap((void *)ptr)|| BUILTIN_TYPE(ptr) >= T_BLKTAG) {
rb_raise(rb_eRangeError, "0x%lx is not id value", p0);
}
@@ -1937,73 +1907,6 @@ id2ref(obj, objid)
}
/*
- * Document-method: __id__
- * Document-method: object_id
- *
- * call-seq:
- * obj.__id__ => fixnum
- * obj.object_id => fixnum
- *
- * Returns an integer identifier for <i>obj</i>. The same number will
- * be returned on all calls to <code>id</code> for a given object, and
- * no two active objects will share an id.
- * <code>Object#object_id</code> is a different concept from the
- * <code>:name</code> notation, which returns the symbol id of
- * <code>name</code>. Replaces the deprecated <code>Object#id</code>.
- */
-
-/*
- * call-seq:
- * obj.hash => fixnum
- *
- * Generates a <code>Fixnum</code> hash value for this object. This
- * function must have the property that <code>a.eql?(b)</code> implies
- * <code>a.hash == b.hash</code>. The hash value is used by class
- * <code>Hash</code>. Any hash value that exceeds the capacity of a
- * <code>Fixnum</code> will be truncated before being used.
- */
-
-VALUE
-rb_obj_id(VALUE obj)
-{
- /*
- * 32-bit VALUE space
- * MSB ------------------------ LSB
- * false 00000000000000000000000000000000
- * true 00000000000000000000000000000010
- * nil 00000000000000000000000000000100
- * undef 00000000000000000000000000000110
- * symbol ssssssssssssssssssssssss00001110
- * object oooooooooooooooooooooooooooooo00 = 0 (mod sizeof(RVALUE))
- * fixnum fffffffffffffffffffffffffffffff1
- *
- * object_id space
- * LSB
- * false 00000000000000000000000000000000
- * true 00000000000000000000000000000010
- * nil 00000000000000000000000000000100
- * undef 00000000000000000000000000000110
- * symbol 000SSSSSSSSSSSSSSSSSSSSSSSSSSS0 S...S % A = 4 (S...S = s...s * A + 4)
- * object oooooooooooooooooooooooooooooo0 o...o % A = 0
- * fixnum fffffffffffffffffffffffffffffff1 bignum if required
- *
- * where A = sizeof(RVALUE)/4
- *
- * sizeof(RVALUE) is
- * 20 if 32-bit, double is 4-byte aligned
- * 24 if 32-bit, double is 8-byte aligned
- * 40 if 64-bit
- */
- if (TYPE(obj) == T_SYMBOL) {
- return (SYM2ID(obj) * sizeof(RVALUE) + (4 << 2)) | FIXNUM_FLAG;
- }
- if (SPECIAL_CONST_P(obj)) {
- return LONG2NUM((long)obj);
- }
- return (VALUE)((long)obj|FIXNUM_FLAG);
-}
-
-/*
* The <code>GC</code> module provides an interface to Ruby's mark and
* sweep garbage collection mechanism. Some of the underlying methods
* are also available via the <code>ObjectSpace</code> module.
@@ -2040,10 +1943,6 @@ Init_GC()
source_filenames = st_init_strtable();
- rb_global_variable(&nomem_error);
nomem_error = rb_exc_new2(rb_eNoMemError, "failed to allocate memory");
-
- rb_define_method(rb_mKernel, "hash", rb_obj_id, 0);
- rb_define_method(rb_mKernel, "__id__", rb_obj_id, 0);
- rb_define_method(rb_mKernel, "object_id", rb_obj_id, 0);
+ rb_global_variable(&nomem_error);
}
diff --git a/hash.c b/hash.c
index deadb4c3a4..641dac1b78 100644
--- a/hash.c
+++ b/hash.c
@@ -2,8 +2,8 @@
hash.c -
- $Author: shyouhei $
- $Date: 2006/12/05 18:53:00 $
+ $Author$
+ $Date$
created at: Mon Nov 22 18:51:18 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -121,14 +121,17 @@ struct foreach_safe_arg {
};
static int
-foreach_safe_i(key, value, arg)
+foreach_safe_i(key, value, arg, err)
st_data_t key, value;
struct foreach_safe_arg *arg;
{
int status;
+ if (err) {
+ rb_raise(rb_eRuntimeError, "hash modified during iteration");
+ }
if (key == Qundef) return ST_CONTINUE;
- status = (*arg->func)(key, value, arg->arg);
+ status = (*arg->func)(key, value, arg->arg, err);
if (status == ST_CONTINUE) {
return ST_CHECK;
}
@@ -146,9 +149,7 @@ st_foreach_safe(table, func, a)
arg.tbl = table;
arg.func = func;
arg.arg = a;
- if (st_foreach(table, foreach_safe_i, (st_data_t)&arg)) {
- rb_raise(rb_eRuntimeError, "hash modified during iteration");
- }
+ st_foreach(table, foreach_safe_i, (st_data_t)&arg);
}
struct hash_foreach_arg {
@@ -158,13 +159,17 @@ struct hash_foreach_arg {
};
static int
-hash_foreach_iter(key, value, arg)
+hash_foreach_iter(key, value, arg, err)
VALUE key, value;
struct hash_foreach_arg *arg;
+ int err;
{
int status;
st_table *tbl;
+ if (err) {
+ rb_raise(rb_eRuntimeError, "hash modified during iteration");
+ }
tbl = RHASH(arg->hash)->tbl;
if (key == Qundef) return ST_CONTINUE;
status = (*arg->func)(key, value, arg->arg);
@@ -202,9 +207,7 @@ static VALUE
hash_foreach_call(arg)
struct hash_foreach_arg *arg;
{
- if (st_foreach(RHASH(arg->hash)->tbl, hash_foreach_iter, (st_data_t)arg)) {
- rb_raise(rb_eRuntimeError, "hash modified during iteration");
- }
+ st_foreach(RHASH(arg->hash)->tbl, hash_foreach_iter, (st_data_t)arg);
return Qnil;
}
@@ -223,31 +226,20 @@ rb_hash_foreach(hash, func, farg)
rb_ensure(hash_foreach_call, (VALUE)&arg, hash_foreach_ensure, hash);
}
-static VALUE hash_alloc0 _((VALUE));
static VALUE hash_alloc _((VALUE));
static VALUE
-hash_alloc0(klass)
+hash_alloc(klass)
VALUE klass;
{
NEWOBJ(hash, struct RHash);
OBJSETUP(hash, klass, T_HASH);
hash->ifnone = Qnil;
+ hash->tbl = st_init_table(&objhash);
return (VALUE)hash;
}
-static VALUE
-hash_alloc(klass)
- VALUE klass;
-{
- VALUE hash = hash_alloc0(klass);
-
- RHASH(hash)->tbl = st_init_table(&objhash);
-
- return hash;
-}
-
VALUE
rb_hash_new()
{
@@ -336,7 +328,9 @@ rb_hash_s_create(argc, argv, klass)
int i;
if (argc == 1 && TYPE(argv[0]) == T_HASH) {
- hash = hash_alloc0(klass);
+ hash = hash_alloc(klass);
+
+ RHASH(hash)->ifnone = Qnil;
RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl);
return hash;
@@ -517,7 +511,6 @@ rb_hash_default(argc, argv, hash)
rb_scan_args(argc, argv, "01", &key);
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
- if (argc == 0) return Qnil;
return rb_funcall(RHASH(hash)->ifnone, id_call, 2, hash, key);
}
return RHASH(hash)->ifnone;
@@ -890,6 +883,8 @@ static VALUE
rb_hash_clear(hash)
VALUE hash;
{
+ void *tmp;
+
rb_hash_modify(hash);
if (RHASH(hash)->tbl->num_entries > 0) {
rb_hash_foreach(hash, clear_i, 0);
@@ -1822,7 +1817,7 @@ ruby_setenv(name, value)
* RTL's environ global variable directly yet.
*/
SetEnvironmentVariable(name,value);
-#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
+#elif defined __CYGWIN__
#undef setenv
#undef unsetenv
if (value)
@@ -1830,7 +1825,7 @@ ruby_setenv(name, value)
else
unsetenv(name);
#else /* WIN32 */
- size_t len;
+
int i=envix(name); /* where does it go? */
if (environ == origenviron) { /* need we copy environment? */
@@ -1845,28 +1840,30 @@ ruby_setenv(name, value)
tmpenv[max] = 0;
environ = tmpenv; /* tell exec where it is now */
}
- if (environ[i]) {
- char **envp = origenviron;
- while (*envp && *envp != environ[i]) envp++;
- if (!*envp)
- free(environ[i]);
- if (!value) {
- while (environ[i]) {
- environ[i] = environ[i+1];
- i++;
- }
- return;
+ if (!value) {
+ if (environ != origenviron) {
+ char **envp = origenviron;
+ while (*envp && *envp != environ[i]) envp++;
+ if (!*envp)
+ free(environ[i]);
+ }
+ while (environ[i]) {
+ environ[i] = environ[i+1];
+ i++;
}
+ return;
}
- else { /* does not exist yet */
- if (!value) return;
+ if (!environ[i]) { /* does not exist yet */
REALLOC_N(environ, char*, i+2); /* just expand it a bit */
environ[i+1] = 0; /* make sure it's null terminated */
}
- len = strlen(name) + strlen(value) + 2;
- environ[i] = ALLOC_N(char, len);
+ else {
+ if (environ[i] != origenviron[i])
+ free(environ[i]);
+ }
+ environ[i] = ALLOC_N(char, strlen(name) + strlen(value) + 2);
#ifndef MSDOS
- snprintf(environ[i],len,"%s=%s",name,value); /* all that work just for this */
+ sprintf(environ[i],"%s=%s",name,value); /* all that work just for this */
#else
/* MS-DOS requires environment variable names to be in uppercase */
/* [Tom Dinger, 27 August 1990: Well, it doesn't _require_ it, but
@@ -1894,7 +1891,7 @@ env_aset(obj, nm, val)
char *name, *value;
if (rb_safe_level() >= 4) {
- rb_raise(rb_eSecurityError, "can't change environment variable");
+ rb_raise(rb_eSecurityError, "cannot change environment variable");
}
if (NIL_P(val)) {
diff --git a/inits.c b/inits.c
index 4c6008e4b0..052573a443 100644
--- a/inits.c
+++ b/inits.c
@@ -2,8 +2,8 @@
inits.c -
- $Author: dave $
- $Date: 2003/12/19 03:58:57 $
+ $Author$
+ $Date$
created at: Tue Dec 28 16:01:58 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
diff --git a/instruby.rb b/instruby.rb
index 1237b01abc..a9d66c7670 100644
--- a/instruby.rb
+++ b/instruby.rb
@@ -3,36 +3,30 @@
load "./rbconfig.rb"
include Config
-srcdir = File.dirname(__FILE__)
-$:.unshift File.expand_path("lib", srcdir)
+$:.unshift File.join(CONFIG["srcdir"], "lib")
require 'fileutils'
require 'shellwords'
-require 'optparse'
-require 'optparse/shellwords'
+require 'getopts'
require 'tempfile'
-STDOUT.sync = true
File.umask(0)
def parse_args()
- $mantype = 'doc'
- $destdir = nil
- $make = 'make'
- $mflags = []
- $install = []
- opt = OptionParser.new
- opt.on('-n') {$dryrun = true}
- opt.on('--dest-dir=DIR') {|dir| $destdir = dir}
- opt.on('--make=COMMAND') {|make| $make = make}
- opt.on('--mantype=MAN') {|man| $mantype = man}
- opt.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
- if arg = v.first
- arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
- end
- $mflags.concat(v)
+ getopts('n', 'dest-dir:',
+ 'make:', 'make-flags:', 'mflags:',
+ 'mantype:doc')
+
+ $dryrun = $OPT['n']
+ $destdir = $OPT['dest-dir'] || ''
+ $make = $OPT['make'] || $make || 'make'
+ $mantype = $OPT['mantype']
+ mflags = ($OPT['make-flags'] || '').strip
+ mflags = ($OPT['mflags'] || '').strip if mflags.empty?
+
+ $mflags = Shellwords.shellwords(mflags)
+ if arg = $mflags.first
+ arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
end
- opt.on('--install=TYPE', [:bin, :lib, :man]) {|ins| $install << ins}
- opt.parse! rescue abort [$!.message, opt].join("\n")
$make, *rest = Shellwords.shellwords($make)
$mflags.unshift(*rest) unless rest.empty?
@@ -60,10 +54,6 @@ include FileUtils::NoWrite if $dryrun
@fileutils_output = STDOUT
@fileutils_label = ''
-def install?(type)
- yield if $install.empty? or $install.include?(type)
-end
-
def install(src, dest, options = {})
options[:preserve] = true
super
@@ -82,7 +72,7 @@ def makedirs(dirs)
end
def with_destdir(dir)
- return dir if !$destdir or $destdir.empty?
+ return dir if $destdir.empty?
dir = dir.sub(/\A\w:/, '') if File::PATH_SEPARATOR == ';'
$destdir + dir
end
@@ -108,45 +98,31 @@ arc = CONFIG["LIBRUBY_A"]
makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir]
-install?(:bin) do
- ruby_bin = File.join(bindir, ruby_install_name)
+ruby_bin = File.join(bindir, ruby_install_name)
- install ruby_install_name+exeext, ruby_bin+exeext, :mode => 0755
- if File.exist?(ruby_install_name+exeext+".manifest")
- install ruby_install_name+exeext+".manifest", bindir, :mode => 0644
- end
- if rubyw_install_name and !rubyw_install_name.empty?
- install rubyw_install_name+exeext, bindir, :mode => 0755
- if File.exist?(rubyw_install_name+exeext+".manifest")
- install rubyw_install_name+exeext+".manifest", bindir, :mode => 0644
- end
- end
- if enable_shared and dll != lib
- install dll, bindir, :mode => 0755
- if File.exist?(dll+".manifest")
- install dll+".manifest", bindir, :mode => 0644
- end
- end
- install lib, libdir, :mode => 0755 unless lib == arc
- install arc, libdir, :mode => 0644
- install "config.h", archlibdir, :mode => 0644
- install "rbconfig.rb", archlibdir, :mode => 0644
- if CONFIG["ARCHFILE"]
- for file in CONFIG["ARCHFILE"].split
- install file, archlibdir, :mode => 0644
- end
+install ruby_install_name+exeext, ruby_bin+exeext, :mode => 0755
+if rubyw_install_name and !rubyw_install_name.empty?
+ install rubyw_install_name+exeext, bindir, :mode => 0755
+end
+install dll, bindir, :mode => 0755 if enable_shared and dll != lib
+install lib, libdir, :mode => 0755 unless lib == arc
+install arc, libdir, :mode => 0644
+install "config.h", archlibdir, :mode => 0644
+install "rbconfig.rb", archlibdir, :mode => 0644
+if CONFIG["ARCHFILE"]
+ for file in CONFIG["ARCHFILE"].split
+ install file, archlibdir, :mode => 0644
end
+end
- if dll == lib and dll != arc
- for link in CONFIG["LIBRUBY_ALIASES"].split
- ln_sf(dll, File.join(libdir, link))
- end
+if dll == lib and dll != arc
+ for link in CONFIG["LIBRUBY_ALIASES"].split
+ ln_sf(dll, File.join(libdir, link))
end
end
-Dir.chdir srcdir
+Dir.chdir CONFIG["srcdir"]
-install?(:lib) do
ruby_shebang = File.join(CONFIG["bindir"], ruby_install_name)
if File::ALT_SEPARATOR
ruby_bin_dosish = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR)
@@ -199,9 +175,7 @@ for f in Dir["lib/**/*{.rb,help-message}"]
makedirs dir
install f, dir, :mode => 0644
end
-end
-install?(:bin) do
for f in Dir["*.h"]
install f, archlibdir, :mode => 0644
end
@@ -210,9 +184,7 @@ if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
makedirs File.join(archlibdir, "win32")
install "win32/win32.h", File.join(archlibdir, "win32"), :mode => 0644
end
-end
-install?(:man) do
for mdoc in Dir["*.[1-9]"]
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
@@ -239,6 +211,5 @@ for mdoc in Dir["*.[1-9]"]
install w.path, destfile, :mode => 0644
end
end
-end
# vi:set sw=2:
diff --git a/intern.h b/intern.h
index 97577a7cfd..9779d4d835 100644
--- a/intern.h
+++ b/intern.h
@@ -2,8 +2,8 @@
intern.h -
- $Author: matz $
- $Date: 2006/05/16 00:25:18 $
+ $Author$
+ $Date$
created at: Thu Jun 10 14:22:17 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -164,7 +164,6 @@ void rb_dvar_asgn _((ID, VALUE));
void rb_dvar_push _((ID, VALUE));
VALUE *rb_svar _((int));
VALUE rb_eval_cmd _((VALUE, VALUE, int));
-int rb_obj_respond_to _((VALUE, ID, int));
int rb_respond_to _((VALUE, ID));
void rb_interrupt _((void));
VALUE rb_apply _((VALUE, ID, VALUE));
@@ -211,7 +210,6 @@ VALUE rb_thread_create _((VALUE (*)(ANYARGS), void*));
void rb_thread_interrupt _((void));
void rb_thread_trap_eval _((VALUE, int, int));
void rb_thread_signal_raise _((char*));
-void rb_thread_signal_exit _((void));
int rb_thread_select _((int, fd_set *, fd_set *, fd_set *, struct timeval *));
void rb_thread_wait_for _((struct timeval));
VALUE rb_thread_current _((void));
@@ -221,8 +219,8 @@ VALUE rb_thread_local_aset _((VALUE, ID, VALUE));
void rb_thread_atfork _((void));
VALUE rb_funcall_rescue __((VALUE, ID, int, ...));
/* file.c */
+int eaccess _((const char*, int));
VALUE rb_file_s_expand_path _((int, VALUE *));
-VALUE rb_file_expand_path _((VALUE, VALUE));
void rb_file_const _((const char*, VALUE));
int rb_find_file_ext _((VALUE*, const char* const*));
VALUE rb_find_file _((VALUE));
@@ -335,7 +333,6 @@ int rb_is_instance_id _((ID));
int rb_is_class_id _((ID));
int rb_is_local_id _((ID));
int rb_is_junk_id _((ID));
-int rb_symname_p _((const char*));
VALUE rb_backref_get _((void));
void rb_backref_set _((VALUE));
VALUE rb_lastline_get _((void));
@@ -353,9 +350,9 @@ VALUE rb_range_new _((VALUE, VALUE, int));
VALUE rb_range_beg_len _((VALUE, long*, long*, long, int));
VALUE rb_length_by_each _((VALUE));
/* re.c */
-int rb_memcmp _((const void*,const void*,long));
-int rb_memcicmp _((const void*,const void*,long));
-long rb_memsearch _((const void*,long,const void*,long));
+int rb_memcmp _((char*,char*,long));
+int rb_memcicmp _((char*,char*,long));
+long rb_memsearch _((char*,long,char*,long));
VALUE rb_reg_nth_defined _((int, VALUE));
VALUE rb_reg_nth_match _((int, VALUE));
VALUE rb_reg_last_match _((VALUE));
@@ -451,7 +448,7 @@ VALUE rb_path2class _((const char*));
void rb_name_class _((VALUE, ID));
VALUE rb_class_name _((VALUE));
void rb_autoload _((VALUE, ID, const char*));
-VALUE rb_autoload_load _((VALUE, ID));
+void rb_autoload_load _((VALUE, ID));
VALUE rb_autoload_p _((VALUE, ID));
void rb_gc_mark_global_tbl _((void));
VALUE rb_f_trace_var _((int, VALUE*));
diff --git a/io.c b/io.c
index 9275acaea7..0d9f07a8d5 100644
--- a/io.c
+++ b/io.c
@@ -2,8 +2,8 @@
io.c -
- $Author: matz $
- $Date: 2006/07/31 06:34:09 $
+ $Author$
+ $Date$
created at: Fri Oct 15 18:08:59 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -32,7 +32,7 @@
# define NO_LONG_FNAME
#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(sun) || defined(_nec_ews)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(sun) || defined(_nec_ews)
# define USE_SETVBUF
#endif
@@ -41,7 +41,7 @@
#endif
#include <sys/types.h>
-#if defined(HAVE_SYS_IOCTL_H) && !defined(DJGPP) && !defined(_WIN32) && !defined(__human68k__)
+#if !defined(DJGPP) && !defined(_WIN32) && !defined(__human68k__)
#include <sys/ioctl.h>
#endif
#if defined(HAVE_FCNTL_H) || defined(_WIN32)
@@ -72,12 +72,6 @@
#endif
#ifdef HAVE_UNISTD_H
-#ifdef HAVE_SYSCALL_H
-#include <syscall.h>
-#elif defined HAVE_SYS_SYSCALL_H
-#include <sys/syscall.h>
-#endif
-
#include <unistd.h>
#endif
@@ -100,14 +94,6 @@ extern void Init_File _((void));
# error off_t is bigger than long, but you have no long long...
#endif
-#ifndef PIPE_BUF
-# ifdef _POSIX_PIPE_BUF
-# define PIPE_BUF _POSIX_PIPE_BUF
-# else
-# define PIPE_BUF 512 /* is this ok? */
-# endif
-#endif
-
VALUE rb_cIO;
VALUE rb_eEOFError;
VALUE rb_eIOError;
@@ -144,19 +130,6 @@ static VALUE lineno = INT2FIX(0);
# define READ_DATA_PENDING_COUNT(fp) ((fp)->_egptr - (fp)->_gptr)
# define READ_DATA_PENDING_PTR(fp) ((fp)->_gptr)
# endif
-#elif defined(_LP64) && (defined(__sun__) || defined(__sun))
-typedef struct _FILE64 {
- unsigned char *_ptr; /* next character from/to here in buffer */
- unsigned char *_base; /* the buffer */
- unsigned char *_end; /* the end of the buffer */
- ssize_t _cnt; /* number of available characters in buffer */
- int _file; /* UNIX System file descriptor */
- unsigned int _flag; /* the state of the stream */
- char __fill[80]; /* filler to bring size to 128 bytes */
-} FILE64;
-# define READ_DATA_PENDING(fp) (((FILE64*)(fp))->_cnt > 0)
-# define READ_DATA_PENDING_COUNT(fp) (((FILE64*)(fp))->_cnt)
-# define READ_DATA_PENDING_PTR(fp) ((char *)((FILE64*)(fp))->_ptr)
#elif defined(FILE_COUNT)
# define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_COUNT)
@@ -169,10 +142,6 @@ typedef struct _FILE64 {
# define READ_DATA_PENDING_COUNT(fp) ((unsigned int)(*(fp))->_cnt)
# define READ_DATA_PENDING(fp) (((unsigned int)(*(fp))->_cnt) > 0)
# define READ_DATA_BUFFERED(fp) 0
-#elif defined(__DragonFly__)
-/* FILE is an incomplete struct type since DragonFly BSD 1.4.0 */
-# define READ_DATA_PENDING(fp) (((struct __FILE_public *)(fp))->_r > 0)
-# define READ_DATA_PENDING_COUNT(fp) (((struct __FILE_public *)(fp))->_r)
#else
/* requires systems own version of the ReadDataPending() */
extern int ReadDataPending();
@@ -204,7 +173,7 @@ extern int ReadDataPending();
void
rb_eof_error()
{
- rb_raise(rb_eEOFError, "end of file reached");
+ rb_raise(rb_eEOFError, "End of file reached");
}
VALUE
@@ -267,7 +236,7 @@ rb_io_check_readable(fptr)
if (!(fptr->mode & FMODE_READABLE)) {
rb_raise(rb_eIOError, "not opened for reading");
}
-#ifdef NEED_IO_SEEK_BETWEEN_RW
+#if NEED_IO_SEEK_BETWEEN_RW
if (((fptr->mode & FMODE_WBUF) ||
(fptr->mode & (FMODE_SYNCWRITE|FMODE_RBUF)) == FMODE_SYNCWRITE) &&
!feof(fptr->f) &&
@@ -419,38 +388,13 @@ rb_io_wait_writable(f)
}
}
-#ifndef S_ISREG
-# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
-#endif
-
-static int
-wsplit_p(OpenFile *fptr)
-{
- FILE *f = GetWriteFile(fptr);
- int r;
- if (!(fptr->mode & FMODE_WSPLIT_INITIALIZED)) {
- struct stat buf;
- if (fstat(fileno(f), &buf) == 0 &&
- !S_ISREG(buf.st_mode)
-#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(O_NONBLOCK)
- && (r = fcntl(fileno(f), F_GETFL)) != -1 &&
- !(r & O_NONBLOCK)
-#endif
- ) {
- fptr->mode |= FMODE_WSPLIT;
- }
- fptr->mode |= FMODE_WSPLIT_INITIALIZED;
- }
- return fptr->mode & FMODE_WSPLIT;
-}
-
/* writing functions */
static long
io_fwrite(str, fptr)
VALUE str;
OpenFile *fptr;
{
- long len, n, r, l, offset = 0;
+ long len, n, r, offset = 0;
FILE *f = GetWriteFile(fptr);
len = RSTRING(str)->len;
@@ -461,16 +405,7 @@ io_fwrite(str, fptr)
rb_io_check_closed(fptr);
}
retry:
- l = n;
- if (PIPE_BUF < l &&
- !rb_thread_critical &&
- !rb_thread_alone() &&
- wsplit_p(fptr)) {
- l = PIPE_BUF;
- }
- TRAP_BEG;
- r = write(fileno(f), RSTRING(str)->ptr+offset, l);
- TRAP_END;
+ r = write(fileno(f), RSTRING(str)->ptr+offset, n);
if (r == n) return len;
if (0 <= r) {
offset += r;
@@ -728,7 +663,7 @@ rb_io_seek_m(argc, argv, io)
/*
* call-seq:
- * ios.pos = integer => integer
+ * ios.pos = integer => 0
*
* Seeks to the given position (in bytes) in <em>ios</em>.
*
@@ -788,32 +723,13 @@ rb_io_rewind(io)
* call-seq:
* ios.eof => true or false
* ios.eof? => true or false
- *
- * Returns true if <em>ios</em> is at end of file that means
- * there are no more data to read.
- * The stream must be opened for reading or an <code>IOError</code> will be
- * raised.
- *
+ *
+ * Returns true if <em>ios</em> is at end of file. The stream must be
+ * opened for reading or an <code>IOError</code> will be raised.
+ *
* f = File.new("testfile")
* dummy = f.readlines
* f.eof #=> true
- *
- * If <em>ios</em> is a stream such as pipe or socket, <code>IO#eof?</code>
- * blocks until the other end sends some data or closes it.
- *
- * r, w = IO.pipe
- * Thread.new { sleep 1; w.close }
- * r.eof? #=> true after 1 second blocking
- *
- * r, w = IO.pipe
- * Thread.new { sleep 1; w.puts "a" }
- * r.eof? #=> false after 1 second blocking
- *
- * r, w = IO.pipe
- * r.eof? # blocks forever
- *
- * Note that <code>IO#eof?</code> reads data to a input buffer.
- * So <code>IO#sysread</code> doesn't work with <code>IO#eof?</code>.
*/
VALUE
@@ -829,7 +745,6 @@ rb_io_eof(io)
if (feof(fptr->f)) return Qtrue;
if (READ_DATA_PENDING(fptr->f)) return Qfalse;
READ_CHECK(fptr->f);
- clearerr(fptr->f);
TRAP_BEG;
ch = getc(fptr->f);
TRAP_END;
@@ -1010,7 +925,7 @@ rb_io_inspect(obj)
len += 9;
}
buf = ALLOCA_N(char, len);
- snprintf(buf, len, "#<%s:%s%s>", cname, fptr->path, st);
+ sprintf(buf, "#<%s:%s%s>", cname, fptr->path, st);
return rb_str_new2(buf);
}
@@ -1029,29 +944,6 @@ rb_io_to_io(io)
}
/* reading functions */
-static long
-read_buffered_data(ptr, len, f)
- char *ptr;
- long len;
- FILE *f;
-{
- long n;
-
-#ifdef READ_DATA_PENDING_COUNT
- n = READ_DATA_PENDING_COUNT(f);
- if (n <= 0) return 0;
- if (n > len) n = len;
- return fread(ptr, 1, n, f);
-#else
- int c;
-
- for (n = 0; n < len && READ_DATA_PENDING(f) && (c = getc(f)) != EOF; ++n) {
- *ptr++ = c;
- }
- return n;
-#endif
-}
-
long
io_fread(ptr, len, fptr)
char *ptr;
@@ -1060,18 +952,32 @@ io_fread(ptr, len, fptr)
{
long n = len;
int c;
- int saved_errno;
while (n > 0) {
- c = read_buffered_data(ptr, n, fptr->f);
- if (c < 0) goto eof;
- if (c > 0) {
- ptr += c;
- if ((n -= c) <= 0) break;
- }
- rb_thread_wait_fd(fileno(fptr->f));
- rb_io_check_closed(fptr);
- clearerr(fptr->f);
+#ifdef READ_DATA_PENDING_COUNT
+ long i = READ_DATA_PENDING_COUNT(fptr->f);
+ if (i <= 0) {
+ rb_thread_wait_fd(fileno(fptr->f));
+ rb_io_check_closed(fptr);
+ i = READ_DATA_PENDING_COUNT(fptr->f);
+ }
+ if (i > 0) {
+ if (i > n) i = n;
+ TRAP_BEG;
+ c = fread(ptr, 1, i, fptr->f);
+ TRAP_END;
+ if (c < 0) goto eof;
+ ptr += c;
+ n -= c;
+ if (c < i) goto eof;
+ continue;
+ }
+#else
+ if (!READ_DATA_PENDING(fptr->f)) {
+ rb_thread_wait_fd(fileno(fptr->f));
+ rb_io_check_closed(fptr);
+ }
+#endif
TRAP_BEG;
c = getc(fptr->f);
TRAP_END;
@@ -1092,9 +998,6 @@ io_fread(ptr, len, fptr)
if (len > n) {
clearerr(fptr->f);
}
- saved_errno = errno;
- rb_warning("nonblocking IO#read is obsolete; use IO#readpartial or IO#sysread");
- errno = saved_errno;
}
if (len == n) return 0;
}
@@ -1119,6 +1022,10 @@ rb_io_fread(ptr, len, f)
return io_fread(ptr, len, &of);
}
+#ifndef S_ISREG
+# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
+#endif
+
#define SMALLBUF 100
static long
@@ -1185,264 +1092,16 @@ read_all(fptr, siz, str)
return str;
}
-void rb_io_set_nonblock(OpenFile *fptr)
-{
- int flags;
-#ifdef F_GETFL
- flags = fcntl(fileno(fptr->f), F_GETFL);
- if (flags == -1) {
- rb_sys_fail(fptr->path);
- }
-#else
- flags = 0;
-#endif
- if ((flags & O_NONBLOCK) == 0) {
- flags |= O_NONBLOCK;
- if (fcntl(fileno(fptr->f), F_SETFL, flags) == -1) {
- rb_sys_fail(fptr->path);
- }
- }
- if (fptr->f2) {
-#ifdef F_GETFL
- flags = fcntl(fileno(fptr->f2), F_GETFL);
- if (flags == -1) {
- rb_sys_fail(fptr->path);
- }
-#else
- flags = 0;
-#endif
- if ((flags & O_NONBLOCK) == 0) {
- flags |= O_NONBLOCK;
- if (fcntl(fileno(fptr->f2), F_SETFL, flags) == -1) {
- rb_sys_fail(fptr->path);
- }
- }
- }
-}
-
-static VALUE
-io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock)
-{
- OpenFile *fptr;
- VALUE length, str;
- long n, len;
-
- rb_scan_args(argc, argv, "11", &length, &str);
-
- if ((len = NUM2LONG(length)) < 0) {
- rb_raise(rb_eArgError, "negative length %ld given", len);
- }
-
- if (NIL_P(str)) {
- str = rb_str_new(0, len);
- }
- else {
- StringValue(str);
- rb_str_modify(str);
- rb_str_resize(str, len);
- }
- OBJ_TAINT(str);
-
- GetOpenFile(io, fptr);
- rb_io_check_readable(fptr);
-
- if (len == 0)
- return str;
-
- if (!nonblock) {
- READ_CHECK(fptr->f);
- }
- if (RSTRING(str)->len != len) {
- modified:
- rb_raise(rb_eRuntimeError, "buffer string modified");
- }
- n = read_buffered_data(RSTRING(str)->ptr, len, fptr->f);
- if (n <= 0) {
- again:
- if (RSTRING(str)->len != len) goto modified;
- if (nonblock) {
- rb_io_set_nonblock(fptr);
- n = read(fileno(fptr->f), RSTRING(str)->ptr, len);
- }
- else {
- TRAP_BEG;
- n = read(fileno(fptr->f), RSTRING(str)->ptr, len);
- TRAP_END;
- }
- if (n < 0) {
- if (!nonblock && rb_io_wait_readable(fileno(fptr->f)))
- goto again;
- rb_sys_fail(fptr->path);
- }
- }
- rb_str_resize(str, n);
-
- if (n == 0)
- return Qnil;
- else
- return str;
-}
-
/*
* call-seq:
- * ios.readpartial(maxlen) => string
- * ios.readpartial(maxlen, outbuf) => outbuf
- *
- * Reads at most <i>maxlen</i> bytes from the I/O stream.
- * It blocks only if <em>ios</em> has no data immediately available.
- * It doesn't block if some data available.
- * If the optional <i>outbuf</i> argument is present,
- * it must reference a String, which will receive the data.
- * It raises <code>EOFError</code> on end of file.
- *
- * readpartial is designed for streams such as pipe, socket, tty, etc.
- * It blocks only when no data immediately available.
- * This means that it blocks only when following all conditions hold.
- * * the buffer in the IO object is empty.
- * * the content of the stream is empty.
- * * the stream is not reached to EOF.
- *
- * When readpartial blocks, it waits data or EOF on the stream.
- * If some data is reached, readpartial returns with the data.
- * If EOF is reached, readpartial raises EOFError.
- *
- * When readpartial doesn't blocks, it returns or raises immediately.
- * If the buffer is not empty, it returns the data in the buffer.
- * Otherwise if the stream has some content,
- * it returns the data in the stream.
- * Otherwise if the stream is reached to EOF, it raises EOFError.
- *
- * r, w = IO.pipe # buffer pipe content
- * w << "abc" # "" "abc".
- * r.readpartial(4096) #=> "abc" "" ""
- * r.readpartial(4096) # blocks because buffer and pipe is empty.
- *
- * r, w = IO.pipe # buffer pipe content
- * w << "abc" # "" "abc"
- * w.close # "" "abc" EOF
- * r.readpartial(4096) #=> "abc" "" EOF
- * r.readpartial(4096) # raises EOFError
- *
- * r, w = IO.pipe # buffer pipe content
- * w << "abc\ndef\n" # "" "abc\ndef\n"
- * r.gets #=> "abc\n" "def\n" ""
- * w << "ghi\n" # "def\n" "ghi\n"
- * r.readpartial(4096) #=> "def\n" "" "ghi\n"
- * r.readpartial(4096) #=> "ghi\n" "" ""
- *
- * Note that readpartial behaves similar to sysread.
- * The differences are:
- * * If the buffer is not empty, read from the buffer instead of "sysread for buffered IO (IOError)".
- * * It doesn't cause Errno::EAGAIN and Errno::EINTR. When readpartial meets EAGAIN and EINTR by read system call, readpartial retry the system call.
- *
- * The later means that readpartial is nonblocking-flag insensitive.
- * It blocks on the situation IO#sysread causes Errno::EAGAIN as if the fd is blocking mode.
- *
- */
-
-static VALUE
-io_readpartial(int argc, VALUE *argv, VALUE io)
-{
- VALUE ret;
-
- ret = io_getpartial(argc, argv, io, 0);
- if (NIL_P(ret))
- rb_eof_error();
- else
- return ret;
-}
-
-/*
- * call-seq:
- * ios.read_nonblock(maxlen) => string
- * ios.read_nonblock(maxlen, outbuf) => outbuf
- *
- * Reads at most <i>maxlen</i> bytes from <em>ios</em> using
- * read(2) system call after O_NONBLOCK is set for
- * the underlying file descriptor.
- *
- * If the optional <i>outbuf</i> argument is present,
- * it must reference a String, which will receive the data.
- *
- * read_nonblock just calls read(2).
- * It causes all errors read(2) causes: EAGAIN, EINTR, etc.
- * The caller should care such errors.
- *
- * read_nonblock causes EOFError on EOF.
- *
- * If the read buffer is not empty,
- * read_nonblock reads from the buffer like readpartial.
- * In this case, read(2) is not called.
- *
- */
-
-static VALUE
-io_read_nonblock(int argc, VALUE *argv, VALUE io)
-{
- VALUE ret;
-
- ret = io_getpartial(argc, argv, io, 1);
- if (NIL_P(ret))
- rb_eof_error();
- else
- return ret;
-}
-
-/*
- * call-seq:
- * ios.write_nonblock(string) => integer
- *
- * Writes the given string to <em>ios</em> using
- * write(2) system call after O_NONBLOCK is set for
- * the underlying file descriptor.
- *
- * write_nonblock just calls write(2).
- * It causes all errors write(2) causes: EAGAIN, EINTR, etc.
- * The result may also be smaller than string.length (partial write).
- * The caller should care such errors and partial write.
- *
- */
-
-static VALUE
-rb_io_write_nonblock(VALUE io, VALUE str)
-{
- OpenFile *fptr;
- FILE *f;
- long n;
-
- rb_secure(4);
- if (TYPE(str) != T_STRING)
- str = rb_obj_as_string(str);
-
- GetOpenFile(io, fptr);
- rb_io_check_writable(fptr);
-
- f = GetWriteFile(fptr);
-
- rb_io_set_nonblock(fptr);
- n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len);
-
- if (n == -1) rb_sys_fail(fptr->path);
-
- return LONG2FIX(n);
-}
-
-/*
- * call-seq:
- * ios.read([length [, buffer]]) => string, buffer, or nil
- *
- * Reads at most <i>length</i> bytes from the I/O stream, or to the
- * end of file if <i>length</i> is omitted or is <code>nil</code>.
- * <i>length</i> must be a non-negative integer or nil.
+ * ios.read([integer [, buffer]]) => string, buffer, or nil
+ *
+ * Reads at most <i>integer</i> bytes from the I/O stream, or to the
+ * end of file if <i>integer</i> is omitted or is <code>nil</code>.
* If the optional <i>buffer</i> argument is present, it must reference
- * a String, which will receive the data.
- *
- * At end of file, it returns <code>nil</code> or <code>""</code>
- * depend on <i>length</i>.
- * <code><i>ios</i>.read()</code> and
- * <code><i>ios</i>.read(nil)</code> returns <code>""</code>.
- * <code><i>ios</i>.read(<i>positive-integer</i>)</code> returns nil.
- *
+ * a String, which will receive the data. Returns <code>nil</code>
+ * if called at end of file.
+ *
* f = File.new("testfile")
* f.read(16) #=> "This is line one"
*/
@@ -1561,7 +1220,6 @@ appendline(fptr, delim, strp)
#else
READ_CHECK(f);
#endif
- clearerr(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
@@ -1639,7 +1297,6 @@ swallow(fptr, term)
#else
READ_CHECK(f);
#endif
- clearerr(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
@@ -1902,7 +1559,7 @@ rb_io_readline(argc, argv, io)
*
* Reads all of the lines in <em>ios</em>, and returns them in
* <i>anArray</i>. Lines are separated by the optional
- * <i>sep_string</i>. If <i>sep_string</i> is <code>nil</code>, the
+ * <i>sep_string</i>. If <i>set_string</i> is <code>nil</code>, the
* rest of the stream is returned as a single record.
* The stream must be opened for reading or an
* <code>IOError</code> will be raised.
@@ -2004,7 +1661,6 @@ rb_io_each_byte(io)
rb_io_check_readable(fptr);
f = fptr->f;
READ_CHECK(f);
- clearerr(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
@@ -2049,7 +1705,6 @@ rb_io_getc(io)
retry:
READ_CHECK(f);
- clearerr(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
@@ -2075,7 +1730,6 @@ rb_getc(f)
if (!READ_DATA_PENDING(f)) {
rb_thread_wait_fd(fileno(f));
}
- clearerr(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
@@ -2271,9 +1925,6 @@ rb_io_close(io)
* an <code>IOError</code> is raised if such an attempt is made. I/O
* streams are automatically closed when they are claimed by the
* garbage collector.
- *
- * If <em>ios</em> is opened by <code>IO.popen</code>,
- * <code>close</code> sets <code>$?</code>.
*/
static VALUE
@@ -2289,17 +1940,10 @@ rb_io_close_m(io)
}
static VALUE
-io_call_close(io)
- VALUE io;
-{
- return rb_funcall(io, rb_intern("close"), 0, 0);
-}
-
-static VALUE
io_close(io)
VALUE io;
{
- return rb_rescue(io_call_close, io, 0, 0);
+ return rb_funcall(io, rb_intern("close"), 0, 0);
}
/*
@@ -2463,7 +2107,7 @@ rb_io_sysseek(argc, argv, io)
/*
* call-seq:
- * ios.syswrite(string) => integer
+ * ios.syswrite(string ) => integer
*
* Writes the given string to <em>ios</em> using a low-level write.
* Returns the number of bytes written. Do not mix with other methods
@@ -2496,9 +2140,7 @@ rb_io_syswrite(io, str)
if (!rb_thread_fd_writable(fileno(f))) {
rb_io_check_closed(fptr);
}
- TRAP_BEG;
n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len);
- TRAP_END;
if (n == -1) rb_sys_fail(fptr->path);
@@ -2635,7 +2277,7 @@ rb_io_flags_mode(flags)
}
return MODE_BINMODE("r+", "rb+");
}
- rb_raise(rb_eArgError, "illegal access modenum %o", flags);
+ rb_raise(rb_eArgError, "illegal access mode %o", flags);
return NULL; /* not reached */
}
@@ -3139,19 +2781,8 @@ retry:
rb_thread_sleep(1);
goto retry;
}
- else {
- int e = errno;
- if ((modef & FMODE_READABLE)) {
- close(pr[0]);
- close(pr[1]);
- }
- if ((modef & FMODE_WRITABLE)) {
- close(pw[0]);
- close(pw[1]);
- }
- errno = e;
- rb_sys_fail(pname);
- }
+ close(pr[0]); close(pw[1]);
+ rb_sys_fail(pname);
break;
default: /* parent */
@@ -3201,9 +2832,7 @@ retry:
*
* If a block is given, Ruby will run the command as a child connected
* to Ruby with a pipe. Ruby's end of the pipe will be passed as a
- * parameter to the block.
- * At the end of block, Ruby close the pipe and sets <code>$?</code>.
- * In this case <code>IO::popen</code> returns
+ * parameter to the block. In this case <code>IO::popen</code> returns
* the value of the block.
*
* If a block is given with a <i>cmd_string</i> of ``<code>-</code>'',
@@ -3219,7 +2848,6 @@ retry:
* puts "Parent is #{Process.pid}"
* IO.popen ("date") { |f| puts f.gets }
* IO.popen("-") {|f| $stderr.puts "#{Process.pid} is here, f is #{f}"}
- * p $?
*
* <em>produces:</em>
*
@@ -3228,7 +2856,6 @@ retry:
* Wed Apr 9 08:53:52 CDT 2003
* 26169 is here, f is
* 26166 is here, f is #<IO:0x401b3d44>
- * #<Process::Status: pid=26166,exited(0)>
*/
static VALUE
@@ -3369,7 +2996,7 @@ rb_io_s_sysopen(argc, argv)
/*
* call-seq:
* open(path [, mode [, perm]] ) => io or nil
- * open(path [, mode [, perm]] ) {|io| block } => obj
+ * open(path [, mode [. perm]] ) {|io| block } => nil
*
* Creates an <code>IO</code> object connected to the given stream,
* file, or subprocess.
@@ -3382,8 +3009,8 @@ rb_io_s_sysopen(argc, argv)
*
* If a block is specified, it will be invoked with the
* <code>File</code> object as a parameter, and the file will be
- * automatically closed when the block terminates. The call
- * returns the value of the block.
+ * automatically closed when the block terminates. The call always
+ * returns <code>nil</code> in this case.
*
* If <i>path</i> starts with a pipe character, a subprocess is
* created, connected to the caller by a pair of pipes. The returned
@@ -3558,21 +3185,20 @@ io_reopen(io, nfile)
}
else {
FILE *f2 = fptr->f2;
- int m = fptr->mode;
fclose(fptr->f);
fptr->f = f2;
fptr->f2 = NULL;
- fptr->mode &= (m & FMODE_READABLE) ? ~FMODE_READABLE : ~FMODE_WRITABLE;
+ fptr->mode &= ~FMODE_READABLE;
if (dup2(fd2, fd) < 0)
rb_sys_fail(orig->path);
if (f2) {
fptr->f = rb_fdopen(fd, "r");
fptr->f2 = f2;
+ fptr->mode |= FMODE_READABLE;
}
else {
fptr->f = rb_fdopen(fd, mode);
}
- fptr->mode = m;
}
rb_thread_fd_close(fd);
if ((orig->mode & FMODE_READABLE) && pos >= 0) {
@@ -3684,7 +3310,6 @@ rb_io_reopen(argc, argv, file)
return file;
}
-/* :nodoc: */
static VALUE
rb_io_init_copy(dest, io)
VALUE dest, io;
@@ -3801,7 +3426,7 @@ rb_f_printf(argc, argv)
* ios.print(obj, ...) => nil
*
* Writes the given object(s) to <em>ios</em>. The stream must be
- * opened for writing. If the output record separator (<code>$\\</code>)
+ * opened for writing. If the output record separator (<code>$\</code>)
* is not <code>nil</code>, it will be appended to the output. If no
* arguments are given, prints <code>$_</code>. Objects that aren't
* strings will be converted by calling their <code>to_s</code> method.
@@ -3857,7 +3482,7 @@ rb_io_print(argc, argv, out)
* Prints each object in turn to <code>$stdout</code>. If the output
* field separator (<code>$,</code>) is not +nil+, its
* contents will appear between each field. If the output record
- * separator (<code>$\\</code>) is not +nil+, it will be
+ * separator (<code>$\</code>) is not +nil+, it will be
* appended to the output. If no arguments are given, prints
* <code>$_</code>. Objects that aren't strings will be converted by
* calling their <code>to_s</code> method.
@@ -4029,7 +3654,8 @@ rb_p(obj) /* for debug print within C code */
*
* For each object, directly writes
* _obj_.+inspect+ followed by the current output
- * record separator to the program's standard output.
+ * record separator to the program's standard output. +p+
+ * bypasses the Ruby I/O libraries.
*
* S = Struct.new(:name, :state)
* s = S['dave', 'TX']
@@ -4341,18 +3967,16 @@ rb_io_s_for_fd(argc, argv, klass)
static int binmode = 0;
static VALUE
-argf_forward(int argc, VALUE *argv)
+argf_forward()
{
- return rb_funcall3(current_file, ruby_frame->last_func, argc, argv);
+ return rb_funcall3(current_file, ruby_frame->last_func,
+ ruby_frame->argc, ruby_frame->argv);
}
-#define ARGF_FORWARD(argc, argv) do {\
- if (TYPE(current_file) != T_FILE)\
- return argf_forward(argc, argv);\
-} while (0)
-#define NEXT_ARGF_FORWARD(argc, argv) do {\
+#define ARGF_FORWARD() do { if (TYPE(current_file) != T_FILE) return argf_forward(); } while (0)
+#define NEXT_ARGF_FORWARD() do {\
if (!next_argv()) return Qnil;\
- ARGF_FORWARD(argc, argv);\
+ ARGF_FORWARD();\
} while (0)
static void
@@ -4596,7 +4220,7 @@ rb_gets()
/*
* call-seq:
- * readline(separator=$/) => string
+ * readline(separator=$/ => string
*
* Equivalent to <code>Kernel::gets</code>, except
* +readline+ raises +EOFError+ at end of file.
@@ -4610,7 +4234,7 @@ rb_f_readline(argc, argv)
VALUE line;
if (!next_argv()) rb_eof_error();
- ARGF_FORWARD(argc, argv);
+ ARGF_FORWARD();
line = rb_f_gets(argc, argv);
if (NIL_P(line)) {
rb_eof_error();
@@ -4638,7 +4262,7 @@ rb_f_getc()
* readlines(separator=$/) => array
*
* Returns an array containing the lines returned by calling
- * <code>Kernel.gets(<i>separator</i>)</code> until the end of file.
+ * <code>Kernel.gets(<i>aString</i>)</code> until the end of file.
*/
static VALUE
@@ -4648,7 +4272,7 @@ rb_f_readlines(argc, argv)
{
VALUE line, ary;
- NEXT_ARGF_FORWARD(argc, argv);
+ NEXT_ARGF_FORWARD();
ary = rb_ary_new();
while (!NIL_P(line = argf_getline(argc, argv))) {
rb_ary_push(ary, line);
@@ -4675,8 +4299,7 @@ static VALUE
rb_f_backquote(obj, str)
VALUE obj, str;
{
- volatile VALUE port;
- VALUE result;
+ VALUE port, result;
OpenFile *fptr;
SafeStringValue(str);
@@ -4806,7 +4429,7 @@ rb_f_select(argc, argv, obj)
GetOpenFile(rb_io_get_io(RARRAY(read)->ptr[i]), fptr);
if (FD_ISSET(fileno(fptr->f), rp)
|| FD_ISSET(fileno(fptr->f), &pset)) {
- rb_ary_push(list, rb_ary_entry(read, i));
+ rb_ary_push(list, RARRAY(read)->ptr[i]);
}
}
}
@@ -4816,10 +4439,10 @@ rb_f_select(argc, argv, obj)
for (i=0; i< RARRAY(write)->len; i++) {
GetOpenFile(rb_io_get_io(RARRAY(write)->ptr[i]), fptr);
if (FD_ISSET(fileno(fptr->f), wp)) {
- rb_ary_push(list, rb_ary_entry(write, i));
+ rb_ary_push(list, RARRAY(write)->ptr[i]);
}
else if (fptr->f2 && FD_ISSET(fileno(fptr->f2), wp)) {
- rb_ary_push(list, rb_ary_entry(write, i));
+ rb_ary_push(list, RARRAY(write)->ptr[i]);
}
}
}
@@ -4829,10 +4452,10 @@ rb_f_select(argc, argv, obj)
for (i=0; i< RARRAY(except)->len; i++) {
GetOpenFile(rb_io_get_io(RARRAY(except)->ptr[i]), fptr);
if (FD_ISSET(fileno(fptr->f), ep)) {
- rb_ary_push(list, rb_ary_entry(except, i));
+ rb_ary_push(list, RARRAY(except)->ptr[i]);
}
else if (fptr->f2 && FD_ISSET(fileno(fptr->f2), ep)) {
- rb_ary_push(list, rb_ary_entry(except, i));
+ rb_ary_push(list, RARRAY(except)->ptr[i]);
}
}
}
@@ -4934,16 +4557,6 @@ rb_io_ctl(io, req, arg, io_p)
io_cntl(fileno(fptr->f2), cmd, narg, io_p);
}
- if (!io_p && cmd == F_SETFL) {
- if (narg & O_NONBLOCK) {
- fptr->mode |= FMODE_WSPLIT_INITIALIZED;
- fptr->mode &= ~FMODE_WSPLIT;
- }
- else {
- fptr->mode &= ~(FMODE_WSPLIT_INITIALIZED|FMODE_WSPLIT);
- }
- }
-
return INT2NUM(retval);
#else
rb_notimplement();
@@ -5047,8 +4660,6 @@ rb_f_syscall(argc, argv)
rb_secure(2);
if (argc == 0)
rb_raise(rb_eArgError, "too few arguments for syscall");
- if (argc > sizeof(arg) / sizeof(arg[0]))
- rb_raise(rb_eArgError, "too many arguments for syscall");
arg[0] = NUM2LONG(argv[0]); argv++;
while (items--) {
VALUE v = rb_check_string_type(*argv);
@@ -5317,7 +4928,7 @@ io_s_read(arg)
/*
* call-seq:
- * IO.read(name, [length [, offset]] ) => string
+ * IO.read(rane, [length [, offset]] ) => string
*
* Opens the file, optionally seeks to the given offset, then returns
* <i>length</i> bytes (defaulting to the rest of the file).
@@ -5355,7 +4966,7 @@ argf_tell()
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to tell");
}
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
return rb_io_tell(current_file);
}
@@ -5368,7 +4979,7 @@ argf_seek_m(argc, argv, self)
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to seek");
}
- ARGF_FORWARD(argc, argv);
+ ARGF_FORWARD();
return rb_io_seek_m(argc, argv, current_file);
}
@@ -5379,7 +4990,7 @@ argf_set_pos(self, offset)
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to set position");
}
- ARGF_FORWARD(1, &offset);
+ ARGF_FORWARD();
return rb_io_set_pos(current_file, offset);
}
@@ -5389,7 +5000,7 @@ argf_rewind()
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to rewind");
}
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
return rb_io_rewind(current_file);
}
@@ -5399,7 +5010,7 @@ argf_fileno()
if (!next_argv()) {
rb_raise(rb_eArgError, "no stream");
}
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
return rb_io_fileno(current_file);
}
@@ -5407,7 +5018,7 @@ static VALUE
argf_to_io()
{
next_argv();
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
return current_file;
}
@@ -5416,7 +5027,7 @@ argf_eof()
{
if (current_file) {
if (init_p == 0) return Qtrue;
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
if (rb_io_eof(current_file)) {
return Qtrue;
}
@@ -5447,7 +5058,7 @@ argf_read(argc, argv)
return str;
}
if (TYPE(current_file) != T_FILE) {
- tmp = argf_forward(argc, argv);
+ tmp = argf_forward();
}
else {
tmp = io_read(argc, argv, current_file);
@@ -5498,7 +5109,7 @@ argf_readchar()
{
VALUE c;
- NEXT_ARGF_FORWARD(0, 0);
+ NEXT_ARGF_FORWARD();
c = argf_getc();
if (NIL_P(c)) {
rb_eof_error();
@@ -5557,7 +5168,7 @@ argf_binmode()
{
binmode = 1;
next_argv();
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
rb_io_binmode(current_file);
return argf;
}
@@ -5588,7 +5199,7 @@ static VALUE
argf_closed()
{
next_argv();
- ARGF_FORWARD(0, 0);
+ ARGF_FORWARD();
return rb_io_closed(current_file);
}
@@ -5758,9 +5369,9 @@ Init_IO()
rb_output_fs = Qnil;
rb_define_hooked_variable("$,", &rb_output_fs, 0, rb_str_setter);
- rb_global_variable(&rb_default_rs);
rb_rs = rb_default_rs = rb_str_new2("\n");
rb_output_rs = Qnil;
+ rb_global_variable(&rb_default_rs);
OBJ_FREEZE(rb_default_rs); /* avoid modifying RS_default */
rb_define_hooked_variable("$/", &rb_rs, 0, rb_str_setter);
rb_define_hooked_variable("$-0", &rb_rs, 0, rb_str_setter);
@@ -5797,9 +5408,6 @@ Init_IO()
rb_define_method(rb_cIO, "readlines", rb_io_readlines, -1);
- rb_define_method(rb_cIO, "read_nonblock", io_read_nonblock, -1);
- rb_define_method(rb_cIO, "write_nonblock", rb_io_write_nonblock, 1);
- rb_define_method(rb_cIO, "readpartial", io_readpartial, -1);
rb_define_method(rb_cIO, "read", io_read, -1);
rb_define_method(rb_cIO, "write", io_write, 1);
rb_define_method(rb_cIO, "gets", rb_io_gets_m, -1);
@@ -5835,12 +5443,12 @@ Init_IO()
rb_define_method(rb_cIO, "pid", rb_io_pid, 0);
rb_define_method(rb_cIO, "inspect", rb_io_inspect, 0);
- rb_define_variable("$stdin", &rb_stdin);
rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
- rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter);
+ rb_define_variable("$stdin", &rb_stdin);
rb_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
- rb_define_hooked_variable("$stderr", &rb_stderr, 0, stdout_setter);
+ rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter);
rb_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
+ rb_define_hooked_variable("$stderr", &rb_stderr, 0, stdout_setter);
rb_define_hooked_variable("$>", &rb_stdout, 0, stdout_setter);
orig_stdout = rb_stdout;
rb_deferr = orig_stderr = rb_stderr;
@@ -5854,9 +5462,10 @@ Init_IO()
rb_define_global_const("STDOUT", rb_stdout);
rb_define_global_const("STDERR", rb_stderr);
- rb_define_readonly_variable("$<", &argf);
argf = rb_obj_alloc(rb_cObject);
rb_extend_object(argf, rb_mEnumerable);
+
+ rb_define_readonly_variable("$<", &argf);
rb_define_global_const("ARGF", argf);
rb_define_singleton_method(argf, "to_s", argf_to_s, 0);
@@ -5895,8 +5504,8 @@ Init_IO()
rb_define_singleton_method(argf, "lineno=", argf_set_lineno, 1);
rb_global_variable(&current_file);
- rb_define_readonly_variable("$FILENAME", &filename);
filename = rb_str_new2("-");
+ rb_define_readonly_variable("$FILENAME", &filename);
rb_define_virtual_variable("$-i", opt_i_get, opt_i_set);
diff --git a/lib/.document b/lib/.document
index 542ca3764c..e93b0e63e2 100644
--- a/lib/.document
+++ b/lib/.document
@@ -6,98 +6,28 @@
# But for now
-English.rb
-Env.rb
abbrev.rb
base64.rb
benchmark.rb
-cgi
cgi.rb
-cgi-lib.rb
+cgi
complex.rb
-csv.rb
-date
date.rb
-date2.rb
-debug.rb
-delegate.rb
-drb
-drb.rb
-erb.rb
-eregex.rb
+English.rb
fileutils.rb
-finalize.rb
find.rb
-forwardable.rb
-ftools.rb
generator.rb
-getoptlong.rb
-getopts.rb
-gserver.rb
-importenv.rb
-ipaddr.rb
-irb.rb
-jcode.rb
logger.rb
-mailread.rb
-mathn.rb
matrix.rb
-mkmf.rb
-monitor.rb
-mutex_m.rb
-net
observer.rb
-open-uri.rb
-open3.rb
-optparse
-optparse.rb
-ostruct.rb
-parsearg.rb
-parsedate.rb
+optionparser.rb
pathname.rb
-ping.rb
-pp.rb
-prettyprint.rb
-profile.rb
-profiler.rb
-pstore.rb
-racc
-rational.rb
-rdoc
-readbytes.rb
-resolv-replace.rb
-resolv.rb
-rexml
-rinda
-rss
-rss.rb
-rubyunit.rb
-runit
-scanf.rb
set.rb
-shell
-shell.rb
shellwords.rb
singleton.rb
-soap
-sync.rb
tempfile.rb
-test
+test/unit.rb
thread.rb
thwait.rb
time.rb
-timeout.rb
-tmpdir.rb
-tracer.rb
-tsort.rb
-un.rb
-uri
-uri.rb
-weakref.rb
-webrick
-webrick.rb
-wsdl
-xmlrpc
-xsd
-yaml
yaml.rb
diff --git a/lib/abbrev.rb b/lib/abbrev.rb
index bf489526cf..6530679681 100644
--- a/lib/abbrev.rb
+++ b/lib/abbrev.rb
@@ -8,7 +8,7 @@
#
# $Idaemons: /home/cvs/rb/abbrev.rb,v 1.2 2001/05/30 09:37:45 knu Exp $
# $RoughId: abbrev.rb,v 1.4 2003/10/14 19:45:42 knu Exp $
-# $Id: abbrev.rb,v 1.1.2.1 2004/01/20 05:27:12 dave Exp $
+# $Id$
=end
# Calculate the set of unique abbreviations for a given set of strings.
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index ea62dcd208..36e593518f 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -2,7 +2,7 @@
#
# benchmark.rb - a performance benchmarking library
#
-# $Id: benchmark.rb,v 1.8.2.2 2004/04/18 23:20:32 nobu Exp $
+# $Id$
#
# Created by Gotoken (gotoken@notwork.org).
#
diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb
index d6b60d66cc..bc780ffc4e 100644
--- a/lib/cgi-lib.rb
+++ b/lib/cgi-lib.rb
@@ -1,5 +1,3 @@
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: cgi-lib is deprecated after Ruby 1.8.1; use cgi instead"
-
=begin
= simple CGI support library
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 49dbe3f179..0fd0bc7cd4 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -284,7 +284,7 @@ class CGI
# Standard internet newline sequence
EOL = CR + LF
- REVISION = '$Id: cgi.rb,v 1.68.2.16.2.2 2006/12/03 08:06:27 shugo Exp $' #:nodoc:
+ REVISION = '$Id$' #:nodoc:
NEEDS_BINMODE = true if /WIN/ni.match(RUBY_PLATFORM)
@@ -770,7 +770,7 @@ class CGI
# cookie1.domain = 'domain'
# cookie1.expires = Time.now + 30
# cookie1.secure = true
- class Cookie < DelegateClass(Array)
+ class Cookie < SimpleDelegator
# Create a new CGI::Cookie object.
#
@@ -870,16 +870,15 @@ class CGI
cookies = Hash.new([])
return cookies unless raw_cookie
- raw_cookie.split(/[;,]\s?/).each do |pairs|
+ raw_cookie.split(/; /).each do |pairs|
name, values = pairs.split('=',2)
next unless name and values
name = CGI::unescape(name)
values ||= ""
values = values.split('&').collect{|v| CGI::unescape(v) }
- if cookies.has_key?(name)
- values = cookies[name].value + values
+ unless cookies.has_key?(name)
+ cookies[name] = Cookie::new({ "name" => name, "value" => values })
end
- cookies[name] = Cookie::new({ "name" => name, "value" => values })
end
cookies
@@ -967,10 +966,8 @@ class CGI
def read_multipart(boundary, content_length)
params = Hash.new([])
boundary = "--" + boundary
- quoted_boundary = Regexp.quote(boundary, "n")
buf = ""
bufsize = 10 * 1024
- boundary_end=""
# start multipart/form-data
stdinput.binmode if defined? stdinput.binmode
@@ -999,7 +996,7 @@ class CGI
end
body.binmode if defined? body.binmode
- until head and /#{quoted_boundary}(?:#{EOL}|--)/n.match(buf)
+ until head and /#{boundary}(?:#{EOL}|--)/n.match(buf)
if (not head) and /#{EOL}#{EOL}/n.match(buf)
buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do
@@ -1019,19 +1016,18 @@ class CGI
else
stdinput.read(content_length)
end
- if c.nil? || c.empty?
+ if c.nil?
raise EOFError, "bad content body"
end
buf.concat(c)
content_length -= c.size
end
- buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{quoted_boundary}([\r\n]{1,2}|--)/n) do
+ buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{boundary}([\r\n]{1,2}|--)/n) do
body.print $1
if "--" == $2
content_length = -1
end
- boundary_end = $2.dup
""
end
@@ -1065,7 +1061,6 @@ class CGI
break if buf.size == 0
break if content_length === -1
end
- raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
params
end # read_multipart
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index 82eb7534d8..e475bd94c7 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -155,8 +155,8 @@ class CGI
#
class Session
- class NoSession < RuntimeError #:nodoc:
- end
+ #:nodoc:
+ class NoSession < RuntimeError; end
# The id of this session.
attr_reader :session_id, :new_session
@@ -301,14 +301,20 @@ class CGI
# Retrieve the session data for key +key+.
def [](key)
- @data ||= @dbman.restore
+ unless @data
+ @data = @dbman.restore
+ end
@data[key]
end
# Set the session date for key +key+.
def []=(key, val)
- @write_lock ||= true
- @data ||= @dbman.restore
+ unless @write_lock
+ @write_lock = true
+ end
+ unless @data
+ @data = @dbman.restore
+ end
@data[key] = val
end
@@ -368,15 +374,13 @@ class CGI
# not exist, or opened if it does.
def initialize(session, option={})
dir = option['tmpdir'] || Dir::tmpdir
- prefix = option['prefix'] || ''
+ prefix = option['prefix'] || ''
suffix = option['suffix'] || ''
id = session.session_id
require 'digest/md5'
md5 = Digest::MD5.hexdigest(id)[0,16]
@path = dir+"/"+prefix+md5+suffix
- if File::exist? @path
- @hash = nil
- else
+ unless File::exist? @path
unless session.new_session
raise CGI::Session::NoSession, "uninitialized session"
end
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index bd93d0a6ff..696f6f2d3b 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -14,6 +14,17 @@ require 'pstore'
class CGI
class Session
+ def []=(key, val)
+ unless @write_lock
+ @write_lock = true
+ end
+ unless @data
+ @data = @dbman.restore
+ end
+ #@data[key] = String(val)
+ @data[key] = val
+ end
+
# PStore-based session storage class.
#
# This builds upon the top-level PStore class provided by the
@@ -42,7 +53,7 @@ class CGI
#
# This session's PStore file will be created if it does
# not exist, or opened if it does.
- def initialize(session, option={})
+ def initialize session, option={}
dir = option['tmpdir'] || Dir::tmpdir
prefix = option['prefix'] || ''
id = session.session_id
@@ -50,9 +61,7 @@ class CGI
md5 = Digest::MD5.hexdigest(id)[0,16]
path = dir+"/"+prefix+md5
path.untaint
- if File::exist?(path)
- @hash = nil
- else
+ unless File::exist?(path)
unless session.new_session
raise CGI::Session::NoSession, "uninitialized session"
end
diff --git a/lib/csv.rb b/lib/csv.rb
index 31b698f08c..f6c12fa285 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -1,7 +1,7 @@
# CSV -- module for generating/parsing CSV data.
# Copyright (C) 2000-2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>.
-# $Id: csv.rb,v 1.4.2.4 2004/05/27 14:39:10 nahi Exp $
+# $Id$
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
diff --git a/lib/date.rb b/lib/date.rb
index 8639b31575..79a2df1135 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1,12 +1,12 @@
#
# date.rb - date and time library
#
-# Author: Tadayoshi Funaba 1998-2006
+# Author: Tadayoshi Funaba 1998-2004
#
# Documentation: William Webber <william@williamwebber.com>
#
#--
-# $Id: date.rb,v 2.15 2005-02-06 11:09:53+09 tadf Exp $
+# $Id: date.rb,v 2.12 2004-03-20 08:05:13+09 tadf Exp $
#++
#
# == Overview
@@ -370,7 +370,7 @@ class Date
ns = ns?(jd, sg)
a = jd_to_civil(jd - 3, ns)[0]
y = if jd >= commercial_to_jd(a + 1, 1, 1, ns) then a + 1 else a end
- w = 1 + ((jd - commercial_to_jd(y, 1, 1, ns)) / 7).floor
+ w = 1 + (jd - commercial_to_jd(y, 1, 1, ns)) / 7
d = (jd + 1) % 7
if d.zero? then d = 7 end
return y, w, d
@@ -647,7 +647,7 @@ class Date
elem ||= {}
y, m, d = elem.values_at(:year, :mon, :mday)
if [y, m, d].include? nil
- raise ArgumentError, '3 elements of civil date are necessary'
+ raise ArgumentError, 'invalid date'
else
civil(y, m, d, sg)
end
@@ -1211,7 +1211,7 @@ class DateTime < Date
fr ||= 0
of ||= 0
if [y, m, d].include? nil
- raise ArgumentError, '3 elements of civil date are necessary'
+ raise ArgumentError, 'invalid date'
else
civil(y, m, d, h, min, s, of.to_r/86400, sg) + (fr/86400)
end
@@ -1258,7 +1258,7 @@ class DateTime < Date
new_with_hash(elem, sg)
end
- class << self; undef_method :today end rescue nil
+ class << self; undef_method :today end
# Create a new DateTime object representing the current time.
#
diff --git a/lib/date/format.rb b/lib/date/format.rb
index 4425635d33..d821ecb04e 100644
--- a/lib/date/format.rb
+++ b/lib/date/format.rb
@@ -1,5 +1,5 @@
-# format.rb: Written by Tadayoshi Funaba 1999-2006
-# $Id: format.rb,v 2.15 2005-02-06 13:28:48+09 tadf Exp $
+# format.rb: Written by Tadayoshi Funaba 1999-2004
+# $Id: format.rb,v 2.14 2004-11-06 10:58:40+09 tadf Exp $
require 'rational'
@@ -51,8 +51,8 @@ class Date
}
def self.__strptime(str, fmt, elem)
- fmt.scan(/%[EO]?.|./mo) do |c|
- cc = c.sub(/\A%[EO]?(.)\z/mo, '%\\1')
+ fmt.scan(/%[EO]?.|./o) do |c|
+ cc = c.sub(/\A%[EO]?(.)\Z/o, '%\\1')
case cc
when /\A\s/o
str.sub!(/\A[\s\v]+/o, '')
@@ -116,12 +116,6 @@ class Date
val = $1.to_i
return unless (1..12) === val
elem[:mon] = val
-=begin
- when '%N'
- return unless str.sub!(/\A(\d+)/o, '')
- val = $1.to_i.to_r / (10**9)
- elem[:sec_fraction] = val
-=end
when '%n'
return unless __strptime(str, ' ', elem)
when '%p', '%P'
@@ -148,7 +142,7 @@ class Date
return unless str.sub!(/\A(\d+)/o, '')
val = $1.to_i
return unless (0..53) === val
- elem[if c[-1,1] == 'U' then :wnum0 else :wnum1 end] = val
+ elem[if c == '%U' then :wnum0 else :wnum1 end] = val
when '%u'
return unless str.sub!(/\A(\d+)/o, '')
val = $1.to_i
@@ -197,24 +191,13 @@ class Date
elem[:sec_fraction] = val
=end
when '%1'
- if $VERBOSE
- warn("warning: %1 is deprecated; forget this")
- end
return unless str.sub!(/\A(\d+)/o, '')
val = $1.to_i
elem[:jd] = val
when '%2'
- if $VERBOSE
- warn("warning: %2 is deprecated; use '%Y-%j'")
- end
return unless __strptime(str, '%Y-%j', elem)
when '%3'
- if $VERBOSE
- warn("warning: %3 is deprecated; use '%F'")
- end
return unless __strptime(str, '%F', elem)
- when /\A%(.)/m
- return unless str.sub!(Regexp.new('\\A' + Regexp.quote($1)), '')
else
return unless str.sub!(Regexp.new('\\A' + Regexp.quote(c)), '')
end
@@ -492,8 +475,8 @@ class Date
def strftime(fmt='%F')
o = ''
- fmt.scan(/%[EO]?.|./mo) do |c|
- cc = c.sub(/\A%[EO]?(.)\z/mo, '%\\1')
+ fmt.scan(/%[EO]?.|./o) do |c|
+ cc = c.sub(/^%[EO]?(.)$/o, '%\\1')
case cc
when '%A'; o << DAYNAMES[wday]
when '%a'; o << ABBR_DAYNAMES[wday]
@@ -515,10 +498,6 @@ class Date
when '%l'; o << '%2d' % ((hour % 12).nonzero? or 12) # AR,TZ,GL
when '%M'; o << '%02d' % min
when '%m'; o << '%02d' % mon
-=begin
- when '%N' # GNU date
- o << '%09d' % (sec_fraction / (1.to_r/86400/(10**9)))
-=end
when '%n'; o << "\n" # P2,ID
when '%P'; o << if hour < 12 then 'am' else 'pm' end # GL
when '%p'; o << if hour < 12 then 'AM' else 'PM' end
@@ -533,7 +512,7 @@ class Date
when '%t'; o << "\t" # P2,ID
when '%U', '%W'
a = self.class.civil_to_jd(year, 1, 1, ns?) + 6
- k = if c[-1,1] == 'U' then 0 else 1 end
+ k = if c == '%U' then 0 else 1 end
w = (jd - (a - ((a - k) + 1) % 7) + 7) / 7
o << '%02d' % w
when '%u'; o << '%d' % cwday # P2,ID
@@ -558,25 +537,10 @@ class Date
when '%.'
o << '%06d' % (sec_fraction / (1.to_r/86400/(10**6)))
=end
- when '%1'
- if $VERBOSE
- warn("warning: %1 is deprecated; forget this")
- end
- o << '%d' % jd
- when '%2'
- if $VERBOSE
- warn("warning: %2 is deprecated; use '%Y-%j'")
- end
- o << strftime('%Y-%j')
- when '%3'
- if $VERBOSE
- warn("warning: %3 is deprecated; use '%F'")
- end
- o << strftime('%F')
- when /\A%(.)/m
- o << $1
- else
- o << c
+ when '%1'; o << '%d' % jd
+ when '%2'; o << strftime('%Y-%j')
+ when '%3'; o << strftime('%Y-%m-%d')
+ else; o << c
end
end
o
diff --git a/lib/debug.rb b/lib/debug.rb
index 9ae119f8fb..1b12188a76 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -255,9 +255,6 @@ class Context
def debug_command(file, line, id, binding)
MUTEX.lock
- unless defined?($debugger_restart) and $debugger_restart
- callcc{|c| $debugger_restart = c}
- end
set_last_thread(Thread.current)
frame_pos = 0
binding_file = file
@@ -327,7 +324,7 @@ class Context
when /^\s*wat(?:ch)?\s+(.+)$/
exp = $1
break_points.push [true, 1, exp]
- stdout.printf "Set watchpoint %d:%s\n", break_points.size, exp
+ stdout.printf "Set watchpoint %d\n", break_points.size, exp
when /^\s*b(?:reak)?$/
if break_points.find{|b| b[1] == 0}
@@ -527,9 +524,6 @@ class Context
when /^\s*p\s+/
stdout.printf "%s\n", debug_eval($', binding).inspect
- when /^\s*r(?:estart)?$/
- $debugger_restart.call
-
when /^\s*h(?:elp)?$/
debug_print_help()
@@ -547,11 +541,11 @@ class Context
stdout.print <<EOHELP
Debugger help v.-0.002b
Commands
- b[reak] [file:|class:]<line|method>
+ b[reak] [file|class:]<line|method>
b[reak] [class.]<line|method>
set breakpoint to some position
wat[ch] <expression> set watchpoint to some expression
- cat[ch] (<exception>|off) set catchpoint to an exception
+ cat[ch] <an Exception> set catchpoint to an exception
b[reak] list breakpoints
cat[ch] show catchpoint
del[ete][ nnn] delete some or all breakpoints
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 93c9803a18..deffcaf0f5 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -1,125 +1,23 @@
-# = delegate -- Support for the Delegation Pattern
+# Delegation class that delegates even methods defined in super class,
+# which can not be covered with normal method_missing hack.
+#
+# Delegator is the abstract delegation class. Need to redefine
+# `__getobj__' method in the subclass. SimpleDelegator is the
+# concrete subclass for simple delegation.
#
-# Documentation by James Edward Gray II and Gavin Sinclair
+# Usage:
+# foo = Object.new
+# foo2 = SimpleDelegator.new(foo)
+# foo.hash == foo2.hash # => false
#
-# == Introduction
+# Foo = DelegateClass(Array)
#
-# This library provides three different ways to delegate method calls to an
-# object. The easiest to use is SimpleDelegator. Pass an object to the
-# constructor and all methods supported by the object will be delegated. This
-# object can be changed later.
-#
-# Going a step further, the top level DelegateClass method allows you to easily
-# setup delegation through class inheritance. This is considerably more
-# flexible and thus probably the most common use for this library.
-#
-# Finally, if you need full control over the delegation scheme, you can inherit
-# from the abstract class Delegator and customize as needed. (If you find
-# yourself needing this control, have a look at _forwardable_, also in the
-# standard library. It may suit your needs better.)
-#
-# == Notes
-#
-# Be advised, RDoc will not detect delegated methods.
-#
-# <b>delegate.rb provides full-class delegation via the
-# DelegateClass() method. For single-method delegation via
-# def_delegator(), see forwardable.rb.</b>
-#
-# == Examples
-#
-# === SimpleDelegator
-#
-# Here's a simple example that takes advantage of the fact that
-# SimpleDelegator's delegation object can be changed at any time.
-#
-# class Stats
-# def initialize
-# @source = SimpleDelegator.new([])
-# end
-#
-# def stats( records )
-# @source.__setobj__(records)
-#
-# "Elements: #{@source.size}\n" +
-# " Non-Nil: #{@source.compact.size}\n" +
-# " Unique: #{@source.uniq.size}\n"
-# end
-# end
-#
-# s = Stats.new
-# puts s.stats(%w{James Edward Gray II})
-# puts
-# puts s.stats([1, 2, 3, nil, 4, 5, 1, 2])
-#
-# <i>Prints:</i>
-#
-# Elements: 4
-# Non-Nil: 4
-# Unique: 4
-#
-# Elements: 8
-# Non-Nil: 7
-# Unique: 6
-#
-# === DelegateClass()
-#
-# Here's a sample of use from <i>tempfile.rb</i>.
-#
-# A _Tempfile_ object is really just a _File_ object with a few special rules
-# about storage location and/or when the File should be deleted. That makes for
-# an almost textbook perfect example of how to use delegation.
-#
-# class Tempfile < DelegateClass(File)
-# # constant and class member data initialization...
-#
-# def initialize(basename, tmpdir=Dir::tmpdir)
-# # build up file path/name in var tmpname...
-#
-# @tmpfile = File.open(tmpname, File::RDWR|File::CREAT|File::EXCL, 0600)
-#
-# # ...
-#
-# super(@tmpfile)
-#
-# # below this point, all methods of File are supported...
-# end
-#
-# # ...
-# end
-#
-# === Delegator
-#
-# SimpleDelegator's implementation serves as a nice example here.
-#
-# class SimpleDelegator < Delegator
-# def initialize(obj)
-# super # pass obj to Delegator constructor, required
-# @_sd_obj = obj # store obj for future use
-# end
-#
-# def __getobj__
-# @_sd_obj # return object we are delegating to, required
-# end
-#
-# def __setobj__(obj)
-# @_sd_obj = obj # change delegation object, a feature we're providing
-# end
-#
-# # ...
-# end
+# class ExtArray<DelegateClass(Array)
+# ...
+# end
-#
-# Delegator is an abstract class used to build delegator pattern objects from
-# subclasses. Subclasses should redefine \_\_getobj\_\_. For a concrete
-# implementation, see SimpleDelegator.
-#
class Delegator
- #
- # Pass in the _obj_ to delegate method calls to. All methods supported by
- # _obj_ will be delegated to.
- #
def initialize(obj)
preserved = ::Kernel.public_instance_methods(false)
preserved -= ["to_s","to_a","inspect","==","=~","==="]
@@ -151,139 +49,74 @@ class Delegator
end
alias initialize_methods initialize
- # Handles the magic of delegation through \_\_getobj\_\_.
- def method_missing(m, *args)
- target = self.__getobj__
- unless target.respond_to?(m)
- super(m, *args)
- end
- target.__send__(m, *args)
- end
-
- #
- # Checks for a method provided by this the delegate object by fowarding the
- # call through \_\_getobj\_\_.
- #
- def respond_to?(m)
- return true if super
- return self.__getobj__.respond_to?(m)
- end
-
- #
- # This method must be overridden by subclasses and should return the object
- # method calls are being delegated to.
- #
def __getobj__
raise NotImplementedError, "need to define `__getobj__'"
end
- # Serialization support for the object returned by \_\_getobj\_\_.
def marshal_dump
__getobj__
end
- # Reinitializes delegation from a serialized object.
def marshal_load(obj)
initialize_methods(obj)
end
end
-#
-# A concrete implementation of Delegator, this class provides the means to
-# delegate all supported method calls to the object passed into the constructor
-# and even to change the object being delegated to at a later time with
-# \_\_setobj\_\_ .
-#
class SimpleDelegator<Delegator
- # Pass in the _obj_ you would like to delegate method calls to.
def initialize(obj)
super
@_sd_obj = obj
end
- # Returns the current object method calls are being delegated to.
def __getobj__
@_sd_obj
end
- #
- # Changes the delegate object to _obj_.
- #
- # It's important to note that this does *not* cause SimpleDelegator's methods
- # to change. Because of this, you probably only want to change delegation
- # to objects of the same type as the original delegate.
- #
- # Here's an example of changing the delegation object.
- #
- # names = SimpleDelegator.new(%w{James Edward Gray II})
- # puts names[1] # => Edward
- # names.__setobj__(%w{Gavin Sinclair})
- # puts names[1] # => Sinclair
- #
def __setobj__(obj)
- raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
@_sd_obj = obj
end
- # Clone support for the object returned by \_\_getobj\_\_.
def clone
super
__setobj__(__getobj__.clone)
end
- # Duplication support for the object returned by \_\_getobj\_\_.
def dup(obj)
super
__setobj__(__getobj__.dup)
end
end
-# :stopdoc:
# backward compatibility ^_^;;;
Delegater = Delegator
SimpleDelegater = SimpleDelegator
-# :startdoc:
#
-# The primary interface to this library. Use to setup delegation when defining
-# your class.
-#
-# class MyClass < DelegateClass( ClassToDelegateTo ) # Step 1
-# def initiaize
-# super(obj_of_ClassToDelegateTo) # Step 2
-# end
-# end
-#
def DelegateClass(superclass)
klass = Class.new
methods = superclass.public_instance_methods(true)
methods -= ::Kernel.public_instance_methods(false)
methods |= ["to_s","to_a","inspect","==","=~","==="]
klass.module_eval {
- def initialize(obj) # :nodoc:
+ def initialize(obj)
@_dc_obj = obj
end
- def method_missing(m, *args) # :nodoc:
+ def method_missing(m, *args)
unless @_dc_obj.respond_to?(m)
super(m, *args)
end
@_dc_obj.__send__(m, *args)
end
- def respond_to?(m) # :nodoc:
- return true if super
- return @_dc_obj.respond_to?(m)
- end
- def __getobj__ # :nodoc:
+ def __getobj__
@_dc_obj
end
- def __setobj__(obj) # :nodoc:
- raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
+ def __setobj__(obj)
@_dc_obj = obj
end
- def clone # :nodoc:
+ def clone
super
__setobj__(__getobj__.clone)
end
- def dup # :nodoc:
+ def dup
super
__setobj__(__getobj__.dup)
end
@@ -307,8 +140,6 @@ def DelegateClass(superclass)
return klass
end
-# :enddoc:
-
if __FILE__ == $0
class ExtArray<DelegateClass(Array)
def initialize()
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index 25fbb3f788..eba58e3585 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -430,15 +430,12 @@ module DRb
end
end
- # An exception wrapping an error object
class DRbRemoteError < DRbError
def initialize(error)
@reason = error.class.to_s
super("#{error.message} (#{error.class})")
set_backtrace(error.backtrace)
end
-
- # the class of the error, as a string.
attr_reader :reason
end
@@ -578,19 +575,10 @@ module DRb
end
raise(DRbConnError, 'connection closed') if str.nil?
raise(DRbConnError, 'premature marshal format(can\'t read)') if str.size < sz
- Thread.exclusive do
- begin
- save = Thread.current[:drb_untaint]
- Thread.current[:drb_untaint] = []
- Marshal::load(str)
- rescue NameError, ArgumentError
- DRbUnknown.new($!, str)
- ensure
- Thread.current[:drb_untaint].each do |x|
- x.untaint
- end
- Thread.current[:drb_untaint] = save
- end
+ begin
+ Marshal::load(str)
+ rescue NameError, ArgumentError
+ DRbUnknown.new($!, str)
end
end
@@ -832,7 +820,7 @@ module DRb
begin
Socket::gethostbyname(host)[0]
rescue
- 'localhost'
+ host
end
end
@@ -1000,22 +988,12 @@ module DRb
# created to act as a stub for the remote referenced object.
def self._load(s)
uri, ref = Marshal.load(s)
-
if DRb.here?(uri)
- obj = DRb.to_obj(ref)
- if ((! obj.tainted?) && Thread.current[:drb_untaint])
- Thread.current[:drb_untaint].push(obj)
- end
- return obj
+ return DRb.to_obj(ref)
end
- self.new_with(uri, ref)
- end
-
- def self.new_with(uri, ref)
- it = self.allocate
- it.instance_variable_set('@uri', uri)
- it.instance_variable_set('@ref', ref)
+ it = self.new(nil)
+ it.reinit(uri, ref)
it
end
@@ -1049,6 +1027,12 @@ module DRb
end
end
+ # Reinitialise this object with the given +uri+ and +ref+
+ def reinit(uri, ref)
+ @uri = uri
+ @ref = ref
+ end
+
# Get the URI of the remote object.
def __drburi
@uri
@@ -1061,17 +1045,7 @@ module DRb
undef :to_s
undef :to_a if respond_to?(:to_a)
-
- def respond_to?(msg_id, priv=false)
- case msg_id
- when :_dump
- true
- when :marshal_dump
- false
- else
- method_missing(:respond_to?, msg_id, priv)
- end
- end
+ undef :respond_to?
# Routes method calls to the referenced object.
def method_missing(msg_id, *a, &b)
@@ -1081,46 +1055,25 @@ module DRb
return obj.__send__(msg_id, *a, &b)
end
- succ, result = self.class.with_friend(@uri) do
- DRbConn.open(@uri) do |conn|
- conn.send_message(self, msg_id, a, b)
- end
+ succ, result = DRbConn.open(@uri) do |conn|
+ conn.send_message(self, msg_id, a, b)
end
-
- if succ
- return result
- elsif DRbUnknown === result
- raise result
+ return result if succ
+ unless DRbUnknown === result
+ prefix = "(#{@uri}) "
+ bt = []
+ result.backtrace.each do |x|
+ break if /`__send__'$/ =~ x
+ if /^\(druby:\/\// =~ x
+ bt.push(x)
+ else
+ bt.push(prefix + x)
+ end
+ end
+ raise result, result.message, bt + caller
else
- bt = self.class.prepare_backtrace(@uri, result)
- result.set_backtrace(bt + caller)
- raise result
- end
- end
-
- def self.with_friend(uri)
- friend = DRb.fetch_server(uri)
- return yield() unless friend
-
- save = Thread.current['DRb']
- Thread.current['DRb'] = { 'server' => friend }
- return yield
- ensure
- Thread.current['DRb'] = save if friend
- end
-
- def self.prepare_backtrace(uri, result)
- prefix = "(#{uri}) "
- bt = []
- result.backtrace.each do |x|
- break if /`__send__'$/ =~ x
- if /^\(druby:\/\// =~ x
- bt.push(x)
- else
- bt.push(prefix + x)
- end
+ raise result
end
- bt
end
def pretty_print(q) # :nodoc:
@@ -1223,7 +1176,6 @@ module DRb
@@argc_limit = 256
@@load_limit = 256 * 102400
@@verbose = false
- @@safe_level = 0
# Set the default value for the :argc_limit option.
#
@@ -1253,10 +1205,6 @@ module DRb
@@idconv = idconv
end
- def self.default_safe_level(level)
- @@safe_level = level
- end
-
# Set the default value of the :verbose option.
#
# See #new(). The initial default value is false.
@@ -1275,8 +1223,7 @@ module DRb
:verbose => @@verbose,
:tcp_acl => @@acl,
:load_limit => @@load_limit,
- :argc_limit => @@argc_limit,
- :safe_level => @@safe_level
+ :argc_limit => @@argc_limit
}
default_config.update(hash)
end
@@ -1341,12 +1288,13 @@ module DRb
@front = front
@idconv = @config[:idconv]
- @safe_level = @config[:safe_level]
@grp = ThreadGroup.new
@thread = run
- DRb.regist_server(self)
+ Thread.exclusive do
+ DRb.primary_server = self unless DRb.primary_server
+ end
end
# The URI of this DRbServer.
@@ -1368,8 +1316,6 @@ module DRb
# The configuration of this DRbServer
attr_reader :config
- attr_reader :safe_level
-
# Set whether to operate in verbose mode.
#
# In verbose mode, failed calls are logged to stdout.
@@ -1387,12 +1333,7 @@ module DRb
# Stop this server.
def stop_service
- DRb.remove_server(self)
- if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
- Thread.current['DRb']['stop_service'] = true
- else
- @thread.kill
- end
+ @thread.kill
end
# Convert a dRuby reference to the local object it refers to.
@@ -1451,9 +1392,7 @@ module DRb
# Coerce an object to a string, providing our own representation if
# to_s is not defined for the object.
def any_to_s(obj)
- obj.to_s + ":#{obj.class}"
- rescue
- sprintf("#<%s:0x%lx>", obj.class, obj.__id__)
+ obj.to_s rescue sprintf("#<%s:0x%lx>", obj.class, obj.__id__)
end
# Check that a method is callable via dRuby.
@@ -1468,23 +1407,25 @@ module DRb
return true if Proc === obj && msg_id == :__drb_yield
raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class
raise(SecurityError, "insecure method `#{msg_id}'") if insecure_method?(msg_id)
-
- if obj.private_methods.include?(msg_id.to_s)
- desc = any_to_s(obj)
- raise NoMethodError, "private method `#{msg_id}' called for #{desc}"
- elsif obj.protected_methods.include?(msg_id.to_s)
+ unless obj.respond_to?(msg_id)
desc = any_to_s(obj)
- raise NoMethodError, "protected method `#{msg_id}' called for #{desc}"
- else
- true
+ if desc.nil? || desc[0] == '#'
+ desc << ":#{obj.class}"
+ end
+
+ if obj.private_methods.include?(msg_id.to_s)
+ raise NameError, "private method `#{msg_id}' called for #{desc}"
+ else
+ raise NameError, "undefined method `#{msg_id}' called for #{desc}"
+ end
end
+ true
end
public :check_insecure_method
-
+
class InvokeMethod # :nodoc:
def initialize(drb_server, client)
@drb_server = drb_server
- @safe_level = drb_server.safe_level
@client = client
end
@@ -1492,28 +1433,10 @@ module DRb
@result = nil
@succ = false
setup_message
-
- if $SAFE < @safe_level
- info = Thread.current['DRb']
- if @block
- @result = Thread.new {
- Thread.current['DRb'] = info
- $SAFE = @safe_level
- perform_with_block
- }.value
- else
- @result = Thread.new {
- Thread.current['DRb'] = info
- $SAFE = @safe_level
- perform_without_block
- }.value
- end
+ if @block
+ @result = perform_with_block
else
- if @block
- @result = perform_with_block
- else
- @result = perform_without_block
- end
+ @result = perform_without_block
end
@succ = true
if @msg_id == :to_ary && @result.class == Array
@@ -1595,11 +1518,10 @@ module DRb
end
client.send_reply(succ, result) rescue nil
ensure
- client.close unless succ
- if Thread.current['DRb']['stop_service']
- Thread.new { stop_service }
- end
- break unless succ
+ unless succ
+ client.close
+ break
+ end
end
end
end
@@ -1737,25 +1659,6 @@ module DRb
DRbServer.default_acl(acl)
end
module_function :install_acl
-
- @server = {}
- def regist_server(server)
- @server[server.uri] = server
- Thread.exclusive do
- @primary_server = server unless @primary_server
- end
- end
- module_function :regist_server
-
- def remove_server(server)
- @server.delete(server.uri)
- end
- module_function :remove_server
-
- def fetch_server(uri)
- @server[uri]
- end
- module_function :fetch_server
end
DRbObject = DRb::DRbObject
diff --git a/lib/drb/extserv.rb b/lib/drb/extserv.rb
index 7da8130c2b..4ed2913051 100644
--- a/lib/drb/extserv.rb
+++ b/lib/drb/extserv.rb
@@ -25,7 +25,10 @@ module DRb
@invoker.unregist(@name)
server = @server
@server = nil
- server.stop_service
+ Thread.new do
+ sleep 1
+ server.stop_service
+ end
true
end
diff --git a/lib/drb/extservm.rb b/lib/drb/extservm.rb
index 7066f84c65..b649c9c006 100644
--- a/lib/drb/extservm.rb
+++ b/lib/drb/extservm.rb
@@ -86,8 +86,8 @@ module DRb
@servers[name] = false
end
uri = @uri || DRb.uri
- if RUBY_PLATFORM =~ /mswin32/ && /NT/ =~ ENV["OS"]
- system(%Q'cmd /c start "ruby" /b #{command} #{uri} #{name}')
+ if RUBY_PLATFORM =~ /mswin32/
+ system("cmd /c start /b #{command} #{uri} #{name}")
else
system("#{command} #{uri} #{name} &")
end
diff --git a/lib/drb/gw.rb b/lib/drb/gw.rb
index b7a5f5383f..012a2b0a11 100644
--- a/lib/drb/gw.rb
+++ b/lib/drb/gw.rb
@@ -5,7 +5,9 @@ module DRb
class GWIdConv < DRbIdConv
def to_obj(ref)
if Array === ref && ref[0] == :DRbObject
- return DRbObject.new_with(ref[1], ref[2])
+ it = DRbObject.new(nil)
+ it.reinit(ref[1], ref[2])
+ return it
end
super(ref)
end
@@ -38,7 +40,9 @@ module DRb
return ref ? DRb.to_obj(ref) : DRb.front
end
- self.new_with(DRb.uri, [:DRbObject, uri, ref])
+ it = self.new(nil)
+ it.reinit(DRb.uri, [:DRbObject, uri, ref])
+ it
end
def _dump(lv)
@@ -54,69 +58,3 @@ module DRb
end
end
end
-
-=begin
-DRb.install_id_conv(DRb::GWIdConv.new)
-
-front = DRb::GW.new
-
-s1 = DRb::DRbServer.new('drbunix:/tmp/gw_b_a', front)
-s2 = DRb::DRbServer.new('drbunix:/tmp/gw_b_c', front)
-
-s1.thread.join
-s2.thread.join
-=end
-
-=begin
-# foo.rb
-
-require 'drb/drb'
-
-class Foo
- include DRbUndumped
- def initialize(name, peer=nil)
- @name = name
- @peer = peer
- end
-
- def ping(obj)
- puts "#{@name}: ping: #{obj.inspect}"
- @peer.ping(self) if @peer
- end
-end
-=end
-
-=begin
-# gw_a.rb
-require 'drb/unix'
-require 'foo'
-
-obj = Foo.new('a')
-DRb.start_service("drbunix:/tmp/gw_a", obj)
-
-robj = DRbObject.new_with_uri('drbunix:/tmp/gw_b_a')
-robj[:a] = obj
-
-DRb.thread.join
-=end
-
-=begin
-# gw_c.rb
-require 'drb/unix'
-require 'foo'
-
-foo = Foo.new('c', nil)
-
-DRb.start_service("drbunix:/tmp/gw_c", nil)
-
-robj = DRbObject.new_with_uri("drbunix:/tmp/gw_b_c")
-
-puts "c->b"
-a = robj[:a]
-sleep 2
-
-a.ping(foo)
-
-DRb.thread.join
-=end
-
diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb
index 58d6b7d1e0..a1395351f5 100644
--- a/lib/drb/ssl.rb
+++ b/lib/drb/ssl.rb
@@ -171,7 +171,6 @@ module DRb
end
def accept
- begin
while true
soc = @socket.accept
break if (@acl ? @acl.allow_socket?(soc) : true)
@@ -179,10 +178,6 @@ module DRb
end
ssl = @config.accept(soc)
self.class.new(uri, ssl, @config, true)
- rescue OpenSSL::SSL::SSLError
- warn("#{__FILE__}:#{__LINE__}: warning: #{$!.message} (#{$!.class})") if @config[:verbose]
- retry
- end
end
end
diff --git a/lib/drb/unix.rb b/lib/drb/unix.rb
index 989ec57eed..cdc771da1f 100644
--- a/lib/drb/unix.rb
+++ b/lib/drb/unix.rb
@@ -29,7 +29,6 @@ module DRb
filename, option = parse_uri(uri)
if filename.size == 0
soc = temp_server
- filename = soc.path
uri = 'drbunix:' + soc.path
else
soc = UNIXServer.open(filename)
diff --git a/lib/erb.rb b/lib/erb.rb
index bf4b441028..d9fdc7456a 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -236,7 +236,7 @@
# Rails, the web application framework, uses ERB to create views.
#
class ERB
- Revision = '$Date: 2006/02/12 15:09:25 $' #'
+ Revision = '$Date$' #'
# Returns revision information for the erb.rb module.
def self.version
@@ -558,7 +558,7 @@ class ERB
out.push(content)
end
when '<%='
- out.push("#{@insert_cmd}((#{content}).to_s)")
+ out.push("#{@put_cmd}((#{content}).to_s)")
when '<%#'
# out.push("# #{content.dump}")
end
@@ -607,12 +607,11 @@ class ERB
def initialize(trim_mode)
@percent, @trim_mode = prepare_trim_mode(trim_mode)
@put_cmd = 'print'
- @insert_cmd = @put_cmd
@pre_cmd = []
@post_cmd = []
end
attr_reader :percent, :trim_mode
- attr_accessor :put_cmd, :insert_cmd, :pre_cmd, :post_cmd
+ attr_accessor :put_cmd, :pre_cmd, :post_cmd
end
end
@@ -706,7 +705,6 @@ class ERB
#
def set_eoutvar(compiler, eoutvar = '_erbout')
compiler.put_cmd = "#{eoutvar}.concat"
- compiler.insert_cmd = "#{eoutvar}.concat"
cmd = []
cmd.push "#{eoutvar} = ''"
@@ -783,8 +781,6 @@ class ERB
s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
end
alias h html_escape
- module_function :h
- module_function :html_escape
#
# A utility method for encoding the String _s_ as a URL.
@@ -802,8 +798,6 @@ class ERB
s.to_s.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }
end
alias u url_encode
- module_function :u
- module_function :url_encode
end
end
@@ -824,3 +818,5 @@ class ERB
module_function :def_erb_method
end
end
+
+
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 0459a4511f..d92e4c3c94 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -1,7 +1,7 @@
#
# = fileutils.rb
#
-# Copyright (c) 2000-2005 Minero Aoki <aamine@loveruby.net>
+# Copyright (c) 2000-2004 Minero Aoki <aamine@loveruby.net>
#
# This program is free software.
# You can distribute/modify this program under the same terms of ruby.
@@ -16,11 +16,8 @@
# cd(dir, options) {|dir| .... }
# pwd()
# mkdir(dir, options)
-# mkdir(list, options)
# mkdir_p(dir, options)
-# mkdir_p(list, options)
# rmdir(dir, options)
-# rmdir(list, options)
# ln(old, new, options)
# ln(list, destdir, options)
# ln_s(old, new, options)
@@ -37,9 +34,6 @@
# rm_rf(list, options)
# install(src, dest, mode = <src's>, options)
# chmod(mode, list, options)
-# chmod_R(mode, list, options)
-# chown(user, group, list, options)
-# chown_R(user, group, list, options)
# touch(list, options)
#
# The <tt>options</tt> parameter is a hash of options, taken from the list
@@ -51,17 +45,14 @@
# either one file or a list of files in that argument. See the method
# documentation for examples.
#
-# There are some `low level' methods, which do not accept any option:
+# There are some `low level' methods, which does not accept any option:
#
+# uptodate?(file, cmp_list)
# copy_entry(src, dest, preserve = false, dereference = false)
# copy_file(src, dest, preserve = false, dereference = true)
# copy_stream(srcstream, deststream)
-# remove_entry(path, force = false)
-# remove_entry_secure(path, force = false)
-# remove_file(path, force = false)
# compare_file(path_a, path_b)
# compare_stream(stream_a, stream_b)
-# uptodate?(file, cmp_list)
#
# == module FileUtils::Verbose
#
@@ -82,15 +73,10 @@
# <tt>:verbose</tt> flags to methods in FileUtils.
#
-module FileUtils
- def self.private_module_function(name) #:nodoc:
- module_function name
- private_class_method name
- end
+module FileUtils
- # This hash table holds command options.
- OPT_TABLE = {} #:nodoc: internal use only
+ # All methods are module_function.
#
# Options: (none)
@@ -100,13 +86,11 @@ module FileUtils
def pwd
Dir.pwd
end
- module_function :pwd
alias getwd pwd
- module_function :getwd
#
- # Options: verbose
+ # Options: noop verbose
#
# Changes the current directory to the directory +dir+.
#
@@ -116,18 +100,14 @@ module FileUtils
# FileUtils.cd('/', :verbose => true) # chdir and report it
#
def cd(dir, options = {}, &block) # :yield: dir
- fu_check_options options, :verbose
+ fu_check_options options, :noop, :verbose
fu_output_message "cd #{dir}" if options[:verbose]
- Dir.chdir(dir, &block)
+ Dir.chdir(dir, &block) unless options[:noop]
fu_output_message 'cd -' if options[:verbose] and block
end
- module_function :cd
alias chdir cd
- module_function :chdir
- OPT_TABLE['cd'] =
- OPT_TABLE['chdir'] = %w( verbose )
#
# Options: (none)
@@ -150,7 +130,7 @@ module FileUtils
end
true
end
- module_function :uptodate?
+
#
# Options: mode noop verbose
@@ -168,13 +148,11 @@ module FileUtils
fu_output_message "mkdir #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" if options[:verbose]
return if options[:noop]
+ mode = options[:mode] || (0777 & ~File.umask)
list.each do |dir|
- fu_mkdir dir, options[:mode]
+ Dir.mkdir dir.sub(%r</\z>, ''), mode
end
end
- module_function :mkdir
-
- OPT_TABLE['mkdir'] = %w( noop verbose mode )
#
# Options: mode noop verbose
@@ -198,10 +176,11 @@ module FileUtils
fu_output_message "mkdir -p #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" if options[:verbose]
return *list if options[:noop]
+ mode = options[:mode] || (0777 & ~File.umask)
list.map {|path| path.sub(%r</\z>, '') }.each do |path|
# optimize for the most common case
begin
- fu_mkdir path, options[:mode]
+ Dir.mkdir path, mode
next
rescue SystemCallError
next if File.directory?(path)
@@ -214,7 +193,7 @@ module FileUtils
end
stack.reverse_each do |path|
begin
- fu_mkdir path, options[:mode]
+ Dir.mkdir path, mode
rescue SystemCallError => err
raise unless File.directory?(path)
end
@@ -223,27 +202,10 @@ module FileUtils
return *list
end
- module_function :mkdir_p
alias mkpath mkdir_p
alias makedirs mkdir_p
- module_function :mkpath
- module_function :makedirs
-
- OPT_TABLE['mkdir_p'] =
- OPT_TABLE['mkpath'] =
- OPT_TABLE['makedirs'] = %w( noop verbose )
-
- def fu_mkdir(path, mode) #:nodoc:
- path = path.sub(%r</\z>, '')
- if mode
- Dir.mkdir path, mode
- File.chmod mode, path
- else
- Dir.mkdir path
- end
- end
- private_module_function :fu_mkdir
+
#
# Options: noop, verbose
@@ -260,57 +222,52 @@ module FileUtils
list = fu_list(list)
fu_output_message "rmdir #{list.join ' '}" if options[:verbose]
return if options[:noop]
+
list.each do |dir|
Dir.rmdir dir.sub(%r</\z>, '')
end
end
- module_function :rmdir
- OPT_TABLE['rmdir'] = %w( noop verbose )
#
# Options: force noop verbose
#
- # <b><tt>ln(old, new, options = {})</tt></b>
+ # <b><tt>ln( old, new, options = {} )</tt></b>
#
# Creates a hard link +new+ which points to +old+.
- # If +new+ already exists and it is a directory, creates a link +new/old+.
+ # If +new+ already exists and it is a directory, creates a symbolic link +new/old+.
# If +new+ already exists and it is not a directory, raises Errno::EEXIST.
# But if :force option is set, overwrite +new+.
#
# FileUtils.ln 'gcc', 'cc', :verbose => true
# FileUtils.ln '/usr/bin/emacs21', '/usr/bin/emacs'
#
- # <b><tt>ln(list, destdir, options = {})</tt></b>
+ # <b><tt>ln( list, destdir, options = {} )</tt></b>
#
# Creates several hard links in a directory, with each one pointing to the
# item in +list+. If +destdir+ is not a directory, raises Errno::ENOTDIR.
#
# include FileUtils
- # cd '/sbin'
- # FileUtils.ln %w(cp mv mkdir), '/bin' # Now /sbin/cp and /bin/cp are linked.
+ # cd '/bin'
+ # ln %w(cp mv mkdir), '/usr/bin' # Now /usr/bin/cp and /bin/cp are linked.
#
def ln(src, dest, options = {})
fu_check_options options, :force, :noop, :verbose
fu_output_message "ln#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
+
fu_each_src_dest0(src, dest) do |s,d|
remove_file d, true if options[:force]
File.link s, d
end
end
- module_function :ln
alias link ln
- module_function :link
-
- OPT_TABLE['ln'] =
- OPT_TABLE['link'] = %w( noop verbose force )
#
# Options: force noop verbose
#
- # <b><tt>ln_s(old, new, options = {})</tt></b>
+ # <b><tt>ln_s( old, new, options = {} )</tt></b>
#
# Creates a symbolic link +new+ which points to +old+. If +new+ already
# exists and it is a directory, creates a symbolic link +new/old+. If +new+
@@ -320,7 +277,7 @@ module FileUtils
# FileUtils.ln_s '/usr/bin/ruby', '/usr/local/bin/ruby'
# FileUtils.ln_s 'verylongsourcefilename.c', 'c', :force => true
#
- # <b><tt>ln_s(list, destdir, options = {})</tt></b>
+ # <b><tt>ln_s( list, destdir, options = {} )</tt></b>
#
# Creates several symbolic links in a directory, with each one pointing to the
# item in +list+. If +destdir+ is not a directory, raises Errno::ENOTDIR.
@@ -333,18 +290,14 @@ module FileUtils
fu_check_options options, :force, :noop, :verbose
fu_output_message "ln -s#{options[:force] ? 'f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
+
fu_each_src_dest0(src, dest) do |s,d|
remove_file d, true if options[:force]
File.symlink s, d
end
end
- module_function :ln_s
alias symlink ln_s
- module_function :symlink
-
- OPT_TABLE['ln_s'] =
- OPT_TABLE['symlink'] = %w( noop verbose force )
#
# Options: noop verbose
@@ -358,41 +311,34 @@ module FileUtils
options[:force] = true
ln_s src, dest, options
end
- module_function :ln_sf
- OPT_TABLE['ln_sf'] = %w( noop verbose )
#
# Options: preserve noop verbose
#
- # Copies a file content +src+ to +dest+. If +dest+ is a directory,
- # copies +src+ to +dest/src+.
+ # Copies a file +src+ to +dest+. If +dest+ is a directory, copies
+ # +src+ to +dest/src+.
#
# If +src+ is a list of files, then +dest+ must be a directory.
#
# FileUtils.cp 'eval.c', 'eval.c.org'
# FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6'
# FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', :verbose => true
- # FileUtils.cp 'symlink', 'dest' # copy content, "dest" is not a symlink
#
def cp(src, dest, options = {})
fu_check_options options, :preserve, :noop, :verbose
fu_output_message "cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
- fu_each_src_dest(src, dest) do |s, d|
+
+ fu_each_src_dest(src, dest) do |s,d|
copy_file s, d, options[:preserve]
end
end
- module_function :cp
alias copy cp
- module_function :copy
-
- OPT_TABLE['cp'] =
- OPT_TABLE['copy'] = %w( noop verbose preserve )
#
- # Options: preserve noop verbose dereference_root
+ # Options: preserve noop verbose
#
# Copies +src+ to +dest+. If +src+ is a directory, this method copies
# all its contents recursively. If +dest+ is a directory, copies
@@ -406,7 +352,7 @@ module FileUtils
#
# # Examples of copying several files to target directory.
# FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/tmail'
- # FileUtils.cp_r Dir.glob('*.rb'), '/home/aamine/lib/ruby', :noop => true, :verbose => true
+ # FileUtils.cp_r Dir.glob('*.rb'), '/home/aamine/lib/ruby', :noop, :verbose
#
# # If you want to copy all contents of a directory instead of the
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
@@ -415,61 +361,188 @@ module FileUtils
# # but this doesn't.
#
def cp_r(src, dest, options = {})
- fu_check_options options, :preserve, :noop, :verbose, :dereference_root
+ fu_check_options options, :preserve, :noop, :verbose
fu_output_message "cp -r#{options[:preserve] ? 'p' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
- options[:dereference_root] = true unless options.key?(:dereference_root)
- fu_each_src_dest(src, dest) do |s, d|
- copy_entry s, d, options[:preserve], options[:dereference_root]
+
+ fu_each_src_dest(src, dest) do |s,d|
+ if File.directory?(s)
+ fu_traverse(s) {|rel, deref, st|
+ ctx = CopyContext_.new(options[:preserve], deref, st)
+ ctx.copy_entry "#{s}/#{rel}", "#{d}/#{rel}"
+ }
+ else
+ copy_file s, d, options[:preserve]
+ end
end
end
- module_function :cp_r
- OPT_TABLE['cp_r'] = %w( noop verbose preserve dereference_root )
+ def fu_traverse(prefix, dereference_root = true) #:nodoc:
+ stack = ['.']
+ deref = dereference_root
+ while rel = stack.pop
+ st = File.lstat("#{prefix}/#{rel}")
+ if st.directory? and (deref or not st.symlink?)
+ stack.concat Dir.entries("#{prefix}/#{rel}")\
+ .reject {|ent| ent == '.' or ent == '..' }\
+ .map {|ent| "#{rel}/#{ent}" }.reverse
+ end
+ yield rel, deref, st
+ deref = false
+ end
+ end
+ private :fu_traverse
#
# Copies a file system entry +src+ to +dest+.
- # If +src+ is a directory, this method copies its contents recursively.
- # This method preserves file types, c.f. symlink, directory...
- # (FIFO, device files and etc. are not supported yet)
+ # This method preserves file types, c.f. FIFO, device files, directory....
#
# Both of +src+ and +dest+ must be a path name.
# +src+ must exist, +dest+ must not exist.
#
- # If +preserve+ is true, this method preserves owner, group, permissions
- # and modified time.
+ # If +preserve+ is true, this method preserves owner, group and permissions.
+ # If +dereference+ is true, this method copies a target of symbolic link
+ # instead of a symbolic link itself.
#
- # If +dereference_root+ is true, this method dereference tree root.
- #
- def copy_entry(src, dest, preserve = false, dereference_root = false)
- Entry_.new(src, nil, dereference_root).traverse do |ent|
- destent = Entry_.new(dest, ent.rel, false)
- ent.copy destent.path
- ent.copy_metadata destent.path if preserve
- end
+ def copy_entry(src, dest, preserve = false, dereference = false)
+ CopyContext_.new(preserve, dereference).copy_entry src, dest
end
- module_function :copy_entry
#
# Copies file contents of +src+ to +dest+.
# Both of +src+ and +dest+ must be a path name.
#
def copy_file(src, dest, preserve = false, dereference = true)
- ent = Entry_.new(src, nil, dereference)
- ent.copy_file dest
- ent.copy_metadata dest if preserve
+ CopyContext_.new(preserve, dereference).copy_content src, dest
end
- module_function :copy_file
#
# Copies stream +src+ to +dest+.
- # +src+ must respond to #read(n) and
- # +dest+ must respond to #write(str).
+ # Both of +src+ and +dest+ must be a IO.
#
def copy_stream(src, dest)
fu_copy_stream0 src, dest, fu_stream_blksize(src, dest)
end
- module_function :copy_stream
+
+ def fu_copy_stream0(src, dest, blksize) #:nodoc:
+ begin
+ while true
+ dest.syswrite src.sysread(blksize)
+ end
+ rescue EOFError
+ end
+ end
+ private :fu_copy_stream0
+
+ class CopyContext_
+ include ::FileUtils
+
+ def initialize(preserve = false, dereference = false, stat = nil)
+ @preserve = preserve
+ @dereference = dereference
+ @stat = stat
+ end
+
+ def copy_entry(src, dest)
+ preserve(src, dest) {
+ _copy_entry src, dest
+ }
+ end
+
+ def copy_content(src, dest)
+ preserve(src, dest) {
+ _copy_content src, dest
+ }
+ end
+
+ private
+
+ def _copy_entry(src, dest)
+ st = stat(src)
+ case
+ when st.file?
+ _copy_content src, dest
+ when st.directory?
+ begin
+ Dir.mkdir File.expand_path(dest)
+ rescue => err
+ raise unless File.directory?(dest)
+ end
+ when st.symlink?
+ File.symlink File.readlink(src), dest
+ when st.chardev?
+ raise "cannot handle device file" unless File.respond_to?(:mknod)
+ mknod dest, ?c, 0666, st.rdev
+ when st.blockdev?
+ raise "cannot handle device file" unless File.respond_to?(:mknod)
+ mknod dest, ?b, 0666, st.rdev
+ when st.socket?
+ raise "cannot handle socket" unless File.respond_to?(:mknod)
+ mknod dest, nil, st.mode, 0
+ when st.pipe?
+ raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
+ mkfifo dest, 0666
+ when (st.mode & 0xF000) == (_S_IF_DOOR = 0xD000) # door
+ raise "cannot handle door: #{src}"
+ else
+ raise "unknown file type: #{src}"
+ end
+ end
+
+ def _copy_content(src, dest)
+ st = stat(src)
+ File.open(src, 'rb') {|r|
+ File.open(dest, 'wb', st.mode) {|w|
+ fu_copy_stream0 r, w, (fu_blksize(st) || fu_default_blksize())
+ }
+ }
+ end
+
+ def preserve(src, dest)
+ return yield unless @preserve
+ st = stat(src)
+ yield
+ File.utime st.atime, st.mtime, dest
+ begin
+ chown st.uid, st.gid, dest
+ rescue Errno::EPERM
+ # clear setuid/setgid
+ chmod st.mode & 01777, dest
+ else
+ chmod st.mode, dest
+ end
+ end
+
+ def stat(path)
+ @stat ||= ::File.stat(path)
+ end
+
+ def chmod(mode, path)
+ if @dereference
+ ::File.chmod mode, path
+ else
+ begin
+ ::File.lchmod mode, path
+ rescue NotImplementedError
+ # just ignore this because chmod(symlink) changes attributes of
+ # symlink target, which is not our intent.
+ end
+ end
+ end
+
+ def chown(uid, gid, path)
+ if @dereference
+ ::File.chown uid, gid, path
+ else
+ begin
+ ::File.lchown uid, gid, path
+ rescue NotImplementedError
+ # just ignore this because chown(symlink) changes attributes of
+ # symlink target, which is not our intent.
+ end
+ end
+ end
+ end
#
# Options: force noop verbose
@@ -487,39 +560,35 @@ module FileUtils
fu_check_options options, :force, :noop, :verbose
fu_output_message "mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
- fu_each_src_dest(src, dest) do |s, d|
- destent = Entry_.new(d, nil, true)
- begin
- if destent.exist?
- if destent.directory?
- raise Errno::EEXIST, dest
- else
- destent.remove_file if rename_cannot_overwrite_file?
- end
+
+ fu_each_src_dest(src, dest) do |s,d|
+ if rename_cannot_overwrite_file? and File.file?(d)
+ begin
+ File.unlink d
+ rescue SystemCallError
+ raise unless options[:force]
end
+ end
+ begin
+ File.rename s, d
+ rescue SystemCallError
begin
- File.rename s, d
- rescue Errno::EXDEV
copy_entry s, d, true
File.unlink s
+ rescue SystemCallError
+ raise unless options[:force]
end
- rescue SystemCallError
- raise unless options[:force]
end
end
end
- module_function :mv
alias move mv
- module_function :move
-
- OPT_TABLE['mv'] =
- OPT_TABLE['move'] = %w( noop verbose force )
def rename_cannot_overwrite_file? #:nodoc:
- /djgpp|cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
+ /djgpp|cygwin|mswin|mingw|bccwin|wince|emx/ !~ RUBY_PLATFORM
end
- private_module_function :rename_cannot_overwrite_file?
+ private :rename_cannot_overwrite_file?
+
#
# Options: force noop verbose
@@ -537,24 +606,18 @@ module FileUtils
fu_output_message "rm#{options[:force] ? ' -f' : ''} #{list.join ' '}" if options[:verbose]
return if options[:noop]
- list.each do |path|
- remove_file path, options[:force]
+ list.each do |fname|
+ remove_file fname, options[:force]
end
end
- module_function :rm
alias remove rm
- module_function :remove
-
- OPT_TABLE['rm'] =
- OPT_TABLE['remove'] = %w( noop verbose force )
#
# Options: noop verbose
#
- # Equivalent to
- #
- # #rm(list, :force => true)
+ # Same as
+ # #rm(list, :force)
#
def rm_f(list, options = {})
fu_check_options options, :noop, :verbose
@@ -562,16 +625,11 @@ module FileUtils
options[:force] = true
rm list, options
end
- module_function :rm_f
alias safe_unlink rm_f
- module_function :safe_unlink
-
- OPT_TABLE['rm_f'] =
- OPT_TABLE['safe_unlink'] = %w( noop verbose )
#
- # Options: force noop verbose secure
+ # Options: force noop verbose
#
# remove files +list+[0] +list+[1]... If +list+[n] is a directory,
# removes its all contents recursively. This method ignores
@@ -579,201 +637,78 @@ module FileUtils
#
# FileUtils.rm_r Dir.glob('/tmp/*')
# FileUtils.rm_r '/', :force => true # :-)
- #
- # WARNING: This method causes local vulnerability
- # if one of parent directories or removing directory tree are world
- # writable (including /tmp, whose permission is 1777), and the current
- # process has strong privilege such as Unix super user (root), and the
- # system has symbolic link. For secure removing, read the documentation
- # of #remove_entry_secure carefully, and set :secure option to true.
- # Default is :secure=>false.
- #
- # NOTE: This method calls #remove_entry_secure if :secure option is set.
- # See also #remove_entry_secure.
#
def rm_r(list, options = {})
- fu_check_options options, :force, :noop, :verbose, :secure
- # options[:secure] = true unless options.key?(:secure)
+ fu_check_options options, :force, :noop, :verbose
list = fu_list(list)
fu_output_message "rm -r#{options[:force] ? 'f' : ''} #{list.join ' '}" if options[:verbose]
return if options[:noop]
- list.each do |path|
- if options[:secure]
- remove_entry_secure path, options[:force]
- else
- remove_entry path, options[:force]
+
+ list.each do |fname|
+ begin
+ st = File.lstat(fname)
+ rescue
+ next if options[:force]
+ raise
+ end
+ if st.symlink? then remove_file fname, options[:force]
+ elsif st.directory? then remove_dir fname, options[:force]
+ else remove_file fname, options[:force]
end
end
end
- module_function :rm_r
-
- OPT_TABLE['rm_r'] = %w( noop verbose force secure )
#
- # Options: noop verbose secure
+ # Options: noop verbose
#
- # Equivalent to
- #
+ # Same as
# #rm_r(list, :force => true)
- #
- # WARNING: This method causes local vulnerability.
- # Read the documentation of #rm_r first.
#
def rm_rf(list, options = {})
- fu_check_options options, :noop, :verbose, :secure
+ fu_check_options options, :noop, :verbose
options = options.dup
options[:force] = true
rm_r list, options
end
- module_function :rm_rf
alias rmtree rm_rf
- module_function :rmtree
-
- OPT_TABLE['rm_rf'] =
- OPT_TABLE['rmtree'] = %w( noop verbose secure )
- #
- # This method removes a file system entry +path+. +path+ shall be a
- # regular file, a directory, or something. If +path+ is a directory,
- # remove it recursively. This method is required to avoid TOCTTOU
- # (time-of-check-to-time-of-use) local security vulnerability of #rm_r.
- # #rm_r causes security hole when:
- #
- # * Parent directory is world writable (including /tmp).
- # * Removing directory tree includes world writable directory.
- # * The system has symbolic link.
- #
- # To avoid this security hole, this method applies special preprocess.
- # If +path+ is a directory, this method chown(2) and chmod(2) all
- # removing directories. This requires the current process is the
- # owner of the removing whole directory tree, or is the super user (root).
- #
- # WARNING: You must ensure that *ALL* parent directories are not
- # world writable. Otherwise this method does not work.
- # Only exception is temporary directory like /tmp and /var/tmp,
- # whose permission is 1777.
- #
- # WARNING: Only the owner of the removing directory tree, or Unix super
- # user (root) should invoke this method. Otherwise this method does not
- # work.
- #
- # For details of this security vulnerability, see Perl's case:
- #
- # http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448
- # http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452
- #
- # For fileutils.rb, this vulnerability is reported in [ruby-dev:26100].
- #
- def remove_entry_secure(path, force = false)
- unless fu_have_symlink?
- remove_entry path, force
- return
- end
- fullpath = File.expand_path(path)
- st = File.lstat(fullpath)
- unless st.directory?
- File.unlink fullpath
- return
- end
- # is a directory.
- parent_st = File.stat(File.dirname(fullpath))
- unless fu_world_writable?(parent_st)
- remove_entry path, force
- return
- end
- unless parent_st.sticky?
- raise ArgumentError, "parent directory is world writable, FileUtils#remove_entry_secure does not work; abort: #{path.inspect} (parent directory mode #{'%o' % parent_st.mode})"
- end
- # freeze tree root
- euid = Process.euid
- File.open(fullpath + '/.') {|f|
- unless fu_stat_identical_entry?(st, f.stat)
- # symlink (TOC-to-TOU attack?)
- File.unlink fullpath
- return
- end
- f.chown euid, -1
- f.chmod 0700
- }
- # ---- tree root is frozen ----
- root = Entry_.new(path)
- root.preorder_traverse do |ent|
- if ent.directory?
- ent.chown euid, -1
- ent.chmod 0700
- end
- end
- root.postorder_traverse do |ent|
- begin
- ent.remove
- rescue
- raise unless force
+ def remove_file(fname, force = false) #:nodoc:
+ first_time_p = true
+ begin
+ File.unlink fname
+ rescue Errno::ENOENT
+ raise unless force
+ rescue
+ if first_time_p
+ # try once more for Windows
+ first_time_p = false
+ File.chmod 0777, fname
+ retry
+ end
+ raise
+ end
+ end
+
+ def remove_dir(dir, force = false) #:nodoc:
+ Dir.foreach(dir) do |file|
+ next if /\A\.\.?\z/ === file
+ path = "#{dir}/#{file}"
+ if File.symlink?(path)
+ remove_file path, force
+ elsif File.directory?(path)
+ remove_dir path, force
+ else
+ remove_file path, force
end
end
- rescue
- raise unless force
- end
- module_function :remove_entry_secure
-
- def fu_world_writable?(st)
- (st.mode & 0002) != 0
- end
- private_module_function :fu_world_writable?
-
- def fu_have_symlink? #:nodoc
- File.symlink nil, nil
- rescue NotImplementedError
- return false
- rescue
- return true
- end
- private_module_function :fu_have_symlink?
-
- def fu_stat_identical_entry?(a, b) #:nodoc:
- a.dev == b.dev and a.ino == b.ino
- end
- private_module_function :fu_stat_identical_entry?
-
- #
- # This method removes a file system entry +path+.
- # +path+ might be a regular file, a directory, or something.
- # If +path+ is a directory, remove it recursively.
- #
- # See also #remove_entry_secure.
- #
- def remove_entry(path, force = false)
- Entry_.new(path).postorder_traverse do |ent|
- begin
- ent.remove
- rescue
- raise unless force
- end
+ begin
+ Dir.rmdir dir.sub(%r</\z>, '')
+ rescue Errno::ENOENT
+ raise unless force
end
- rescue
- raise unless force
end
- module_function :remove_entry
- #
- # Removes a file +path+.
- # This method ignores StandardError if +force+ is true.
- #
- def remove_file(path, force = false)
- Entry_.new(path).remove_file
- rescue
- raise unless force
- end
- module_function :remove_file
-
- #
- # Removes a directory +dir+ and its contents recursively.
- # This method ignores StandardError if +force+ is true.
- #
- def remove_dir(path, force = false)
- remove_entry path, force # FIXME?? check if it is a directory
- end
- module_function :remove_dir
#
# Returns true if the contents of a file A and a file B are identical.
@@ -789,12 +724,9 @@ module FileUtils
}
}
end
- module_function :compare_file
alias identical? compare_file
alias cmp compare_file
- module_function :identical?
- module_function :cmp
#
# Returns true if the contents of a stream +a+ and +b+ are identical.
@@ -813,7 +745,7 @@ module FileUtils
end
false
end
- module_function :compare_stream
+
#
# Options: mode noop verbose
@@ -828,8 +760,9 @@ module FileUtils
fu_check_options options, :mode, :preserve, :noop, :verbose
fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
- fu_each_src_dest(src, dest) do |s, d|
- unless File.exist?(d) and compare_file(s, d)
+
+ fu_each_src_dest(src, dest) do |s,d|
+ unless File.exist?(d) and compare_file(s,d)
remove_file d, true
st = File.stat(s) if options[:preserve]
copy_file s, d
@@ -838,9 +771,7 @@ module FileUtils
end
end
end
- module_function :install
- OPT_TABLE['install'] = %w( noop verbose preserve mode )
#
# Options: noop verbose
@@ -857,144 +788,9 @@ module FileUtils
list = fu_list(list)
fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]
return if options[:noop]
- list.each do |path|
- Entry_.new(path).chmod mode
- end
- end
- module_function :chmod
-
- OPT_TABLE['chmod'] = %w( noop verbose )
-
- #
- # Options: noop verbose force
- #
- # Changes permission bits on the named files (in +list+)
- # to the bit pattern represented by +mode+.
- #
- # FileUtils.chmod_R 0700, "/tmp/app.#{$$}"
- #
- def chmod_R(mode, list, options = {})
- fu_check_options options, :noop, :verbose, :force
- list = fu_list(list)
- fu_output_message sprintf('chmod -R%s %o %s',
- (options[:force] ? 'f' : ''),
- mode, list.join(' ')) if options[:verbose]
- return if options[:noop]
- list.each do |root|
- Entry_.new(root).traverse do |ent|
- begin
- ent.chmod mode
- rescue
- raise unless options[:force]
- end
- end
- end
+ File.chmod mode, *list
end
- module_function :chmod_R
- OPT_TABLE['chmod_R'] = %w( noop verbose )
-
- #
- # Options: noop verbose
- #
- # Changes owner and group on the named files (in +list+)
- # to the user +user+ and the group +group+. +user+ and +group+
- # may be an ID (Integer/String) or a name (String).
- # If +user+ or +group+ is nil, this method does not change
- # the attribute.
- #
- # FileUtils.chown 'root', 'staff', '/usr/local/bin/ruby'
- # FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), :verbose => true
- #
- def chown(user, group, list, options = {})
- fu_check_options options, :noop, :verbose
- list = fu_list(list)
- fu_output_message sprintf('chown %s%s',
- [user,group].compact.join(':') + ' ',
- list.join(' ')) if options[:verbose]
- return if options[:noop]
- uid = fu_get_uid(user)
- gid = fu_get_gid(group)
- list.each do |path|
- Entry_.new(path).chown uid, gid
- end
- end
- module_function :chown
-
- OPT_TABLE['chown'] = %w( noop verbose )
-
- #
- # Options: noop verbose force
- #
- # Changes owner and group on the named files (in +list+)
- # to the user +user+ and the group +group+ recursively.
- # +user+ and +group+ may be an ID (Integer/String) or
- # a name (String). If +user+ or +group+ is nil, this
- # method does not change the attribute.
- #
- # FileUtils.chown_R 'www', 'www', '/var/www/htdocs'
- # FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', :verbose => true
- #
- def chown_R(user, group, list, options = {})
- fu_check_options options, :noop, :verbose, :force
- list = fu_list(list)
- fu_output_message sprintf('chown -R%s %s%s',
- (options[:force] ? 'f' : ''),
- [user,group].compact.join(':') + ' ',
- list.join(' ')) if options[:verbose]
- return if options[:noop]
- uid = fu_get_uid(user)
- gid = fu_get_gid(group)
- return unless uid or gid
- list.each do |root|
- Entry_.new(root).traverse do |ent|
- begin
- ent.chown uid, gid
- rescue
- raise unless options[:force]
- end
- end
- end
- end
- module_function :chown_R
-
- OPT_TABLE['chown_R'] = %w( noop verbose )
-
- begin
- require 'etc'
-
- def fu_get_uid(user) #:nodoc:
- return nil unless user
- user = user.to_s
- if /\A\d+\z/ =~ user
- then user.to_i
- else Etc.getpwnam(user).uid
- end
- end
- private_module_function :fu_get_uid
-
- def fu_get_gid(group) #:nodoc:
- return nil unless group
- if /\A\d+\z/ =~ group
- then group.to_i
- else Etc.getgrnam(group).gid
- end
- end
- private_module_function :fu_get_gid
-
- rescue LoadError
- # need Win32 support???
-
- def fu_get_uid(user) #:nodoc:
- user # FIXME
- end
- private_module_function :fu_get_uid
-
- def fu_get_gid(group) #:nodoc:
- group # FIXME
- end
- private_module_function :fu_get_gid
- end
#
# Options: noop verbose
@@ -1010,396 +806,56 @@ module FileUtils
list = fu_list(list)
fu_output_message "touch #{list.join ' '}" if options[:verbose]
return if options[:noop]
+
t = Time.now
- list.each do |path|
+ list.each do |fname|
begin
- File.utime(t, t, path)
+ File.utime(t, t, fname)
rescue Errno::ENOENT
- File.open(path, 'a') {
+ File.open(fname, 'a') {
;
}
end
end
end
- module_function :touch
-
- OPT_TABLE['touch'] = %w( noop verbose )
private
- module StreamUtils_
- private
-
- def fu_windows?
- /mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
- end
-
- def fu_copy_stream0(src, dest, blksize) #:nodoc:
- # FIXME: readpartial?
- while s = src.read(blksize)
- dest.write s
- end
- end
-
- def fu_stream_blksize(*streams)
- streams.each do |s|
- next unless s.respond_to?(:stat)
- size = fu_blksize(s.stat)
- return size if size
- end
- fu_default_blksize()
- end
-
- def fu_blksize(st)
- s = st.blksize
- return nil unless s
- return nil if s == 0
- s
- end
-
- def fu_default_blksize
- 1024
+ def fu_check_options(options, *optdecl)
+ h = options.dup
+ optdecl.each do |name|
+ h.delete name
end
+ raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless h.empty?
end
- include StreamUtils_
- extend StreamUtils_
-
- class Entry_ #:nodoc: internal use only
- include StreamUtils_
-
- def initialize(a, b = nil, deref = false)
- @prefix = @rel = @path = nil
- if b
- @prefix = a
- @rel = b
- else
- @path = a
- end
- @deref = deref
- @stat = nil
- @lstat = nil
- end
-
- def inspect
- "\#<#{self.class} #{path()}>"
- end
-
- def path
- if @path
- @path.to_str
- else
- join(@prefix, @rel)
- end
- end
-
- def prefix
- @prefix || @path
- end
-
- def rel
- @rel
- end
-
- def dereference?
- @deref
- end
-
- def exist?
- lstat! ? true : false
- end
-
- def file?
- s = lstat!
- s and s.file?
- end
-
- def directory?
- s = lstat!
- s and s.directory?
- end
-
- def symlink?
- s = lstat!
- s and s.symlink?
- end
-
- def chardev?
- s = lstat!
- s and s.chardev?
- end
-
- def blockdev?
- s = lstat!
- s and s.blockdev?
- end
-
- def socket?
- s = lstat!
- s and s.socket?
- end
-
- def pipe?
- s = lstat!
- s and s.pipe?
- end
-
- S_IF_DOOR = 0xD000
-
- def door?
- s = lstat!
- s and (s.mode & 0xF000 == S_IF_DOOR)
- end
-
- def entries
- Dir.entries(path())\
- .reject {|n| n == '.' or n == '..' }\
- .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
- end
-
- def stat
- return @stat if @stat
- if lstat() and lstat().symlink?
- @stat = File.stat(path())
- else
- @stat = lstat()
- end
- @stat
- end
-
- def stat!
- return @stat if @stat
- if lstat! and lstat!.symlink?
- @stat = File.stat(path())
- else
- @stat = lstat!
- end
- @stat
- rescue SystemCallError
- nil
- end
-
- def lstat
- if dereference?
- @lstat ||= File.stat(path())
- else
- @lstat ||= File.lstat(path())
- end
- end
-
- def lstat!
- lstat()
- rescue SystemCallError
- nil
- end
-
- def chmod(mode)
- if symlink?
- File.lchmod mode, path() if have_lchmod?
- else
- File.chmod mode, path()
- end
- end
-
- def chown(uid, gid)
- if symlink?
- File.lchown uid, gid, path() if have_lchown?
- else
- File.chown uid, gid, path()
- end
- end
-
- def copy(dest)
- case
- when file?
- copy_file dest
- when directory?
- begin
- Dir.mkdir dest
- rescue
- raise unless File.directory?(dest)
- end
- when symlink?
- File.symlink File.readlink(path()), dest
- when chardev?
- raise "cannot handle device file" unless File.respond_to?(:mknod)
- mknod dest, ?c, 0666, lstat().rdev
- when blockdev?
- raise "cannot handle device file" unless File.respond_to?(:mknod)
- mknod dest, ?b, 0666, lstat().rdev
- when socket?
- raise "cannot handle socket" unless File.respond_to?(:mknod)
- mknod dest, nil, lstat().mode, 0
- when pipe?
- raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
- mkfifo dest, 0666
- when door?
- raise "cannot handle door: #{path()}"
- else
- raise "unknown file type: #{path()}"
- end
- end
-
- def copy_file(dest)
- st = stat()
- File.open(path(), 'rb') {|r|
- File.open(dest, 'wb', st.mode) {|w|
- fu_copy_stream0 r, w, (fu_blksize(st) || fu_default_blksize())
- }
- }
- end
-
- def copy_metadata(path)
- st = lstat()
- File.utime st.atime, st.mtime, path
- begin
- File.chown st.uid, st.gid, path
- rescue Errno::EPERM
- # clear setuid/setgid
- File.chmod st.mode & 01777, path
- else
- File.chmod st.mode, path
- end
- end
-
- def remove
- if directory?
- remove_dir1
- else
- remove_file
- end
- end
-
- def remove_dir1
- platform_support {
- Dir.rmdir path().sub(%r</\z>, '')
- }
- end
-
- def remove_file
- platform_support {
- File.unlink path
- }
- end
-
- def platform_support
- return yield unless fu_windows?
- first_time_p = true
- begin
- yield
- rescue Errno::ENOENT
- raise
- rescue => err
- if first_time_p
- first_time_p = false
- begin
- File.chmod 0700, path() # Windows does not have symlink
- retry
- rescue SystemCallError
- end
- end
- raise err
- end
- end
-
- def preorder_traverse
- stack = [self]
- while ent = stack.pop
- yield ent
- stack.concat ent.entries.reverse if ent.directory?
- end
- end
-
- alias traverse preorder_traverse
-
- def postorder_traverse
- if directory?
- entries().each do |ent|
- ent.postorder_traverse do |e|
- yield e
- end
- end
- end
- yield self
- end
-
- private
-
- $fileutils_rb_have_lchmod = nil
-
- def have_lchmod?
- # This is not MT-safe, but it does not matter.
- if $fileutils_rb_have_lchmod == nil
- $fileutils_rb_have_lchmod = check_have_lchmod?
- end
- $fileutils_rb_have_lchmod
- end
-
- def check_have_lchmod?
- return false unless File.respond_to?(:lchmod)
- File.lchmod 0
- return true
- rescue NotImplementedError
- return false
- end
-
- $fileutils_rb_have_lchown = nil
-
- def have_lchown?
- # This is not MT-safe, but it does not matter.
- if $fileutils_rb_have_lchown == nil
- $fileutils_rb_have_lchown = check_have_lchown?
- end
- $fileutils_rb_have_lchown
- end
-
- def check_have_lchown?
- return false unless File.respond_to?(:lchown)
- File.lchown nil, nil
- return true
- rescue NotImplementedError
- return false
- end
-
- def join(dir, base)
- return dir.to_str if not base or base == '.'
- return base.to_str if not dir or dir == '.'
- File.join(dir, base)
- end
- end # class Entry_
-
- def fu_list(arg) #:nodoc:
+ def fu_list(arg)
[arg].flatten.map {|path| path.to_str }
end
- private_module_function :fu_list
- def fu_each_src_dest(src, dest) #:nodoc:
+ def fu_each_src_dest(src, dest)
fu_each_src_dest0(src, dest) do |s, d|
raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d)
yield s, d
end
end
- private_module_function :fu_each_src_dest
- def fu_each_src_dest0(src, dest) #:nodoc:
+ def fu_each_src_dest0(src, dest)
if src.is_a?(Array)
src.each do |s|
- s = s.to_str
- yield s, File.join(dest, File.basename(s))
+ yield s.to_str, File.join(dest, File.basename(s))
end
else
- src = src.to_str
if File.directory?(dest)
- yield src, File.join(dest, File.basename(src))
+ yield src.to_str, File.join(dest, File.basename(src))
else
- yield src, dest.to_str
+ yield src.to_str, dest.to_str
end
end
end
- private_module_function :fu_each_src_dest0
- def fu_same?(a, b) #:nodoc:
- if fu_have_st_ino?
+ def fu_same?(a, b)
+ if have_st_ino?
st1 = File.stat(a)
st2 = File.stat(b)
st1.dev == st2.dev and st1.ino == st2.ino
@@ -1409,91 +865,83 @@ module FileUtils
rescue Errno::ENOENT
return false
end
- private_module_function :fu_same?
- def fu_have_st_ino? #:nodoc:
- not fu_windows?
+ def have_st_ino?
+ /mswin|mingw|bccwin|wince|emx/ !~ RUBY_PLATFORM
end
- private_module_function :fu_have_st_ino?
- def fu_check_options(options, *optdecl) #:nodoc:
- h = options.dup
- optdecl.each do |name|
- h.delete name
+ def fu_stream_blksize(*streams)
+ streams.each do |s|
+ next unless s.respond_to?(:stat)
+ size = fu_blksize(s.stat)
+ return size if size
end
- raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless h.empty?
+ fu_default_blksize()
end
- private_module_function :fu_check_options
- def fu_update_option(args, new) #:nodoc:
- if args.last.is_a?(Hash)
- args[-1] = args.last.dup.update(new)
- else
- args.push new
- end
- args
+ def fu_blksize(st)
+ s = st.blksize
+ return nil unless s
+ return nil if s == 0
+ s
+ end
+
+ def fu_default_blksize
+ 1024
end
- private_module_function :fu_update_option
@fileutils_output = $stderr
@fileutils_label = ''
- def fu_output_message(msg) #:nodoc:
+ def fu_output_message(msg)
@fileutils_output ||= $stderr
@fileutils_label ||= ''
@fileutils_output.puts @fileutils_label + msg
end
- private_module_function :fu_output_message
-
- METHODS = singleton_methods() - ['private_module_function']
-
- #
- # Returns an Array of method names which have any options.
- #
- # p FileUtils.commands #=> ["chmod", "cp", "cp_r", "install", ...]
- #
- def FileUtils.commands
- OPT_TABLE.keys
- end
- #
- # Returns an Array of option names.
- #
- # p FileUtils.options #=> ["noop", "force", "verbose", "preserve", "mode"]
- #
- def FileUtils.options
- OPT_TABLE.values.flatten.uniq
+ def fu_update_option(args, new)
+ if args.last.is_a?(Hash)
+ args.last.update new
+ else
+ args.push new
+ end
+ args
end
- #
- # Returns true if the method +mid+ have an option +opt+.
- #
- # p FileUtils.have_option?(:cp, :noop) #=> true
- # p FileUtils.have_option?(:rm, :force) #=> true
- # p FileUtils.have_option?(:rm, :perserve) #=> false
- #
- def FileUtils.have_option?(mid, opt)
- li = OPT_TABLE[mid.to_s] or raise ArgumentError, "no such method: #{mid}"
- li.include?(opt.to_s)
- end
- #
- # Returns an Array of option names of the method +mid+.
- #
- # p FileUtils.options(:rm) #=> ["noop", "verbose", "force"]
- #
- def FileUtils.options_of(mid)
- OPT_TABLE[mid.to_s]
- end
+ extend self
+
+
+ OPT_TABLE = {
+ 'cd' => %w( noop verbose ),
+ 'chdir' => %w( noop verbose ),
+ 'chmod' => %w( noop verbose ),
+ 'copy' => %w( noop verbose preserve ),
+ 'cp' => %w( noop verbose preserve ),
+ 'cp_r' => %w( noop verbose preserve ),
+ 'install' => %w( noop verbose preserve mode ),
+ 'link' => %w( noop verbose force ),
+ 'ln' => %w( noop verbose force ),
+ 'ln_s' => %w( noop verbose force ),
+ 'ln_sf' => %w( noop verbose ),
+ 'makedirs' => %w( noop verbose ),
+ 'mkdir' => %w( noop verbose mode ),
+ 'mkdir_p' => %w( noop verbose mode ),
+ 'mkpath' => %w( noop verbose ),
+ 'move' => %w( noop verbose force ),
+ 'mv' => %w( noop verbose force ),
+ 'remove' => %w( noop verbose force ),
+ 'rm' => %w( noop verbose force ),
+ 'rm_f' => %w( noop verbose ),
+ 'rm_r' => %w( noop verbose force ),
+ 'rm_rf' => %w( noop verbose ),
+ 'rmtree' => %w( noop verbose ),
+ 'rmdir' => %w( noop verbose ),
+ 'safe_unlink' => %w( noop verbose ),
+ 'symlink' => %w( noop verbose force ),
+ 'touch' => %w( noop verbose )
+ }
- #
- # Returns an Array of method names which have the option +opt+.
- #
- # p FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
- #
- def FileUtils.collect_method(opt)
- OPT_TABLE.keys.select {|m| OPT_TABLE[m].include?(opt.to_s) }
- end
#
# This module has all methods of FileUtils module, but it outputs messages
@@ -1504,20 +952,15 @@ module FileUtils
include FileUtils
@fileutils_output = $stderr
@fileutils_label = ''
- ::FileUtils.collect_method('verbose').each do |name|
+ FileUtils::OPT_TABLE.each do |name, opts|
+ next unless opts.include?('verbose')
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{name}(*args)
super(*fu_update_option(args, :verbose => true))
end
- private :#{name}
EOS
end
extend self
- class << self
- ::FileUtils::METHODS.each do |m|
- public m
- end
- end
end
#
@@ -1529,20 +972,15 @@ module FileUtils
include FileUtils
@fileutils_output = $stderr
@fileutils_label = ''
- ::FileUtils.collect_method('noop').each do |name|
+ FileUtils::OPT_TABLE.each do |name, opts|
+ next unless opts.include?('noop')
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{name}(*args)
super(*fu_update_option(args, :noop => true))
end
- private :#{name}
EOS
end
extend self
- class << self
- ::FileUtils::METHODS.each do |m|
- public m
- end
- end
end
#
@@ -1555,20 +993,15 @@ module FileUtils
include FileUtils
@fileutils_output = $stderr
@fileutils_label = ''
- ::FileUtils.collect_method('noop').each do |name|
+ FileUtils::OPT_TABLE.each do |name, opts|
+ next unless opts.include?('noop')
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{name}(*args)
super(*fu_update_option(args, :noop => true, :verbose => true))
end
- private :#{name}
EOS
end
extend self
- class << self
- ::FileUtils::METHODS.each do |m|
- public m
- end
- end
end
end
diff --git a/lib/finalize.rb b/lib/finalize.rb
index 9b6b302cac..ed1ccc830f 100644
--- a/lib/finalize.rb
+++ b/lib/finalize.rb
@@ -1,51 +1,44 @@
-#--
+#
# finalizer.rb -
# $Release Version: 0.3$
# $Revision: 1.4 $
# $Date: 1998/02/27 05:34:33 $
# by Keiju ISHITSUKA
-#++
#
-# Usage:
+# --
+#
+# Usage:
#
-# add dependency R_method(obj, dependant)
# add(obj, dependant, method = :finalize, *opt)
# add_dependency(obj, dependant, method = :finalize, *opt)
+# add dependency R_method(obj, dependant)
#
-# delete dependency R_method(obj, dependant)
# delete(obj_or_id, dependant, method = :finalize)
# delete_dependency(obj_or_id, dependant, method = :finalize)
-#
-# delete dependency R_*(obj, dependant)
+# delete dependency R_method(obj, dependant)
# delete_all_dependency(obj_or_id, dependant)
-#
-# delete dependency R_method(*, dependant)
+# delete dependency R_*(obj, dependant)
# delete_by_dependant(dependant, method = :finalize)
-#
-# delete dependency R_*(*, dependant)
+# delete dependency R_method(*, dependant)
# delete_all_by_dependant(dependant)
-#
-# delete all dependency R_*(*, *)
+# delete dependency R_*(*, dependant)
# delete_all
+# delete all dependency R_*(*, *)
#
-# finalize the dependant connected by dependency R_method(obj, dependtant).
# finalize(obj_or_id, dependant, method = :finalize)
# finalize_dependency(obj_or_id, dependant, method = :finalize)
-#
-# finalize all dependants connected by dependency R_*(obj, dependtant).
+# finalize the dependant connected by dependency R_method(obj, dependtant).
# finalize_all_dependency(obj_or_id, dependant)
-#
-# finalize the dependant connected by dependency R_method(*, dependtant).
+# finalize all dependants connected by dependency R_*(obj, dependtant).
# finalize_by_dependant(dependant, method = :finalize)
-#
-# finalize all dependants connected by dependency R_*(*, dependant).
+# finalize the dependant connected by dependency R_method(*, dependtant).
# finalize_all_by_dependant(dependant)
-#
-# finalize all dependency registered to the Finalizer.
+# finalize all dependants connected by dependency R_*(*, dependant).
# finalize_all
+# finalize all dependency registered to the Finalizer.
#
-# stop invoking Finalizer on GC.
# safe{..}
+# stop invoking Finalizer on GC.
#
module Finalizer
diff --git a/lib/find.rb b/lib/find.rb
index 0d22dd62d6..52efde81fd 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -36,8 +36,8 @@ module Find
paths.collect!{|d| d.dup}
while file = paths.shift
catch(:prune) do
- yield file.dup.taint
next unless File.exist? file
+ yield file.dup.taint
begin
if File.lstat(file).directory? then
d = Dir.open(file)
@@ -57,7 +57,7 @@ module Find
d.close
end
end
- rescue Errno::ENOENT, Errno::EACCES
+ rescue Errno::ENOENT, Errno::EACCES
end
end
end
diff --git a/lib/forwardable.rb b/lib/forwardable.rb
index 4383ce9bbb..b845f76ec4 100644
--- a/lib/forwardable.rb
+++ b/lib/forwardable.rb
@@ -1,145 +1,45 @@
-# = forwardable - Support for the Delegation Pattern
#
-# $Release Version: 1.1$
-# $Revision: 1.2.2.2 $
-# $Date: 2006/06/02 13:23:01 $
-# by Keiju ISHITSUKA(keiju@ishitsuka.com)
+# forwardable.rb -
+# $Release Version: 1.1$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
+# original definition by delegator.rb
+# --
+# Usage:
#
-# Documentation by James Edward Gray II and Gavin Sinclair
-#
-# == Introduction
-#
-# This library allows you delegate method calls to an object, on a method by
-# method basis. You can use Forwardable to setup this delegation at the class
-# level, or SingleForwardable to handle it at the object level.
-#
-# == Notes
-#
-# Be advised, RDoc will not detect delegated methods.
-#
-# <b>forwardable.rb provides single-method delegation via the
-# def_delegator() and def_delegators() methods. For full-class
-# delegation via DelegateClass(), see delegate.rb.</b>
-#
-# == Examples
-#
-# === Forwardable
-#
-# Forwardable makes building a new class based on existing work, with a proper
-# interface, almost trivial. We want to rely on what has come before obviously,
-# but with delegation we can take just the methods we need and even rename them
-# as appropriate. In many cases this is preferable to inheritance, which gives
-# us the entire old interface, even if much of it isn't needed.
-#
-# class Queue
+# class Foo
# extend Forwardable
-#
-# def initialize
-# @q = [ ] # prepare delegate object
-# end
-#
-# # setup prefered interface, enq() and deq()...
-# def_delegator :@q, :push, :enq
-# def_delegator :@q, :shift, :deq
-#
-# # support some general Array methods that fit Queues well
-# def_delegators :@q, :clear, :first, :push, :shift, :size
-# end
-#
-# q = Queue.new
-# q.enq 1, 2, 3, 4, 5
-# q.push 6
-#
-# q.shift # => 1
-# while q.size > 0
-# puts q.deq
-# end
-#
-# q.enq "Ruby", "Perl", "Python"
-# puts q.first
-# q.clear
-# puts q.first
-#
-# <i>Prints:</i>
-#
-# 2
-# 3
-# 4
-# 5
-# 6
-# Ruby
-# nil
-#
-# === SingleForwardable
-#
-# printer = String.new
-# printer.extend SingleForwardable # prepare object for delegation
-# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
-# printer.puts "Howdy!"
-#
-# <i>Prints:</i>
#
-# Howdy!
-
-#
-# The Forwardable module provides delegation of specified
-# methods to a designated object, using the methods #def_delegator
-# and #def_delegators.
-#
-# For example, say you have a class RecordCollection which
-# contains an array <tt>@records</tt>. You could provide the lookup method
-# #record_number(), which simply calls #[] on the <tt>@records</tt>
-# array, like this:
-#
-# class RecordCollection
-# extend Forwardable
-# def_delegator :@records, :[], :record_number
+# def_delegators("@out", "printf", "print")
+# def_delegators(:@in, :gets)
+# def_delegator(:@contents, :[], "content_at")
# end
+# f = Foo.new
+# f.printf ...
+# f.gets
+# f.content_at(1)
#
-# Further, if you wish to provide the methods #size, #<<, and #map,
-# all of which delegate to @records, this is how you can do it:
-#
-# class RecordCollection
-# # extend Forwardable, but we did that above
-# def_delegators :@records, :size, :<<, :map
-# end
+# g = Goo.new
+# g.extend SingleForwardable
+# g.def_delegator("@out", :puts)
+# g.puts ...
#
-# Also see the example at forwardable.rb.
#
+
module Forwardable
@debug = nil
class<<self
- # force Forwardable to show up in stack backtraces of delegated methods
attr_accessor :debug
end
- #
- # Shortcut for defining multiple delegator methods, but with no
- # provision for using a different name. The following two code
- # samples have the same effect:
- #
- # def_delegators :@records, :size, :<<, :map
- #
- # def_delegator :@records, :size
- # def_delegator :@records, :<<
- # def_delegator :@records, :map
- #
- # See the examples at Forwardable and forwardable.rb.
- #
def def_instance_delegators(accessor, *methods)
for method in methods
def_instance_delegator(accessor, method)
end
end
- #
- # Defines a method _method_ which delegates to _obj_ (i.e. it calls
- # the method of the same name in _obj_). If _new_name_ is
- # provided, it is used as the name for the delegate method.
- #
- # See the examples at Forwardable and forwardable.rb.
- #
def def_instance_delegator(accessor, method, ali = method)
accessor = accessor.id2name if accessor.kind_of?(Integer)
method = method.id2name if method.kind_of?(Integer)
@@ -161,41 +61,13 @@ module Forwardable
alias def_delegator def_instance_delegator
end
-#
-# The SingleForwardable module provides delegation of specified
-# methods to a designated object, using the methods #def_delegator
-# and #def_delegators. This module is similar to Forwardable, but it works on
-# objects themselves, instead of their defining classes.
-#
-# Also see the example at forwardable.rb.
-#
module SingleForwardable
- #
- # Shortcut for defining multiple delegator methods, but with no
- # provision for using a different name. The following two code
- # samples have the same effect:
- #
- # single_forwardable.def_delegators :@records, :size, :<<, :map
- #
- # single_forwardable.def_delegator :@records, :size
- # single_forwardable.def_delegator :@records, :<<
- # single_forwardable.def_delegator :@records, :map
- #
- # See the example at forwardable.rb.
- #
def def_singleton_delegators(accessor, *methods)
for method in methods
def_singleton_delegator(accessor, method)
end
end
- #
- # Defines a method _method_ which delegates to _obj_ (i.e. it calls
- # the method of the same name in _obj_). If _new_name_ is
- # provided, it is used as the name for the delegate method.
- #
- # See the example at forwardable.rb.
- #
def def_singleton_delegator(accessor, method, ali = method)
accessor = accessor.id2name if accessor.kind_of?(Integer)
method = method.id2name if method.kind_of?(Integer)
@@ -216,3 +88,7 @@ module SingleForwardable
alias def_delegators def_singleton_delegators
alias def_delegator def_singleton_delegator
end
+
+
+
+
diff --git a/lib/ftools.rb b/lib/ftools.rb
index 5f082331fb..0441020b05 100644
--- a/lib/ftools.rb
+++ b/lib/ftools.rb
@@ -1,7 +1,7 @@
#
# = ftools.rb: Extra tools for the File class
#
-# Author:: WATANABE, Hirofumi
+# Author:: WANTANABE, Hirofumi
# Documentation:: Zachary Landau
#
# This library can be distributed under the terms of the Ruby license.
@@ -11,22 +11,25 @@
#
# == Description
#
-# ftools adds several (class, not instance) methods to the File class, for
-# copying, moving, deleting, installing, and comparing files, as well as
-# creating a directory path. See the File class for details.
+# +ftools+ adds several (class, not instance) methods to the File class, for copying, moving,
+# deleting, installing, and comparing files, as well as creating a directory path. See the
+# File class for details.
#
-# FileUtils contains all or nearly all the same functionality and more, and
-# is a recommended option over ftools
+# +fileutils+ contains all or nearly all the same functionality and more, and is a recommended
+# option over +ftools+.
+#
+
+
#
# When you
#
# require 'ftools'
#
-# then the File class aquires some utility methods for copying, moving, and
-# deleting files, and more.
+# then the File class aquires some utility methods for copying, moving, and deleting files, and
+# more.
#
-# See the method descriptions below, and consider using FileUtils as it is
-# more comprehensive.
+# See the method descriptions below, and consider using +fileutils+ as it is more
+# comprehensive.
#
class File
end
@@ -42,8 +45,8 @@ class << File
# in +to+.
#
def catname(from, to)
- if directory? to
- join to.sub(%r([/\\]$), ''), basename(from)
+ if FileTest.directory? to
+ File.join to.sub(%r([/\\]$), ''), basename(from)
else
to
end
@@ -85,7 +88,7 @@ class << File
# is printed.
#
def copy(from, to, verbose = false)
- $stderr.print from, " -> ", catname(from, to), "\n" if verbose
+ $deferr.print from, " -> ", catname(from, to), "\n" if verbose
syscopy from, to
end
@@ -93,14 +96,14 @@ class << File
#
# Moves a file +from+ to +to+ using #syscopy. If +to+ is a directory,
- # copies from +from+ to <tt>to/from</tt>. If +verbose+ is true, <tt>from ->
- # to</tt> is printed.
+ # copies from +from+ to <tt>to/from</tt>. If +verbose+ is true, <tt>from -> to</tt>
+ # is printed.
#
def move(from, to, verbose = false)
to = catname(from, to)
- $stderr.print from, " -> ", to, "\n" if verbose
+ $deferr.print from, " -> ", to, "\n" if verbose
- if RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/ and file? to
+ if RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/ and FileTest.file? to
unlink to
end
fstat = stat(from)
@@ -108,7 +111,7 @@ class << File
rename from, to
rescue
begin
- symlink readlink(from), to and unlink from
+ symlink File.readlink(from), to and unlink from
rescue
from_stat = stat(from)
syscopy from, to and unlink from
@@ -124,11 +127,11 @@ class << File
alias mv move
#
- # Returns +true+ if and only if the contents of files +from+ and +to+ are
+ # Returns +true+ iff the contents of files +from+ and +to+ are
# identical. If +verbose+ is +true+, <tt>from <=> to</tt> is printed.
#
def compare(from, to, verbose = false)
- $stderr.print from, " <=> ", to, "\n" if verbose
+ $deferr.print from, " <=> ", to, "\n" if verbose
return false if stat(from).size != stat(to).size
@@ -167,22 +170,12 @@ class << File
#
def safe_unlink(*files)
verbose = if files[-1].is_a? String then false else files.pop end
- files.each do |file|
- begin
- unlink file
- $stderr.print "removing ", file, "\n" if verbose
- rescue Errno::EACCES # for Windows
- continue if symlink? file
- begin
- mode = stat(file).mode
- o_chmod mode | 0200, file
- unlink file
- $stderr.print "removing ", file, "\n" if verbose
- rescue
- o_chmod mode, file rescue nil
- end
- rescue
- end
+ begin
+ $deferr.print files.join(" "), "\n" if verbose
+ chmod 0777, *files
+ unlink(*files)
+ rescue
+# $deferr.print "warning: Couldn't unlink #{files.join ' '}\n"
end
end
@@ -204,17 +197,18 @@ class << File
#
def makedirs(*dirs)
verbose = if dirs[-1].is_a? String then false else dirs.pop end
+# mode = if dirs[-1].is_a? Fixnum then dirs.pop else 0755 end
mode = 0755
for dir in dirs
parent = dirname(dir)
- next if parent == dir or directory? dir
- makedirs parent unless directory? parent
- $stderr.print "mkdir ", dir, "\n" if verbose
+ next if parent == dir or FileTest.directory? dir
+ makedirs parent unless FileTest.directory? parent
+ $deferr.print "mkdir ", dir, "\n" if verbose
if basename(dir) != ""
begin
Dir.mkdir dir, mode
rescue SystemCallError
- raise unless directory? dir
+ raise unless File.directory? dir
end
end
end
@@ -236,7 +230,7 @@ class << File
#
def chmod(mode, *files)
verbose = if files[-1].is_a? String then false else files.pop end
- $stderr.printf "chmod %04o %s\n", mode, files.join(" ") if verbose
+ $deferr.printf "chmod %04o %s\n", mode, files.join(" ") if verbose
o_chmod mode, *files
end
$VERBOSE = vsave
@@ -249,8 +243,8 @@ class << File
#
def install(from, to, mode = nil, verbose = false)
to = catname(from, to)
- unless exist? to and cmp from, to
- safe_unlink to if exist? to
+ unless FileTest.exist? to and cmp from, to
+ safe_unlink to if FileTest.exist? to
cp from, to, verbose
chmod mode, to, verbose if mode
end
diff --git a/lib/generator.rb b/lib/generator.rb
index 21970981fc..a010559b60 100644
--- a/lib/generator.rb
+++ b/lib/generator.rb
@@ -2,7 +2,7 @@
#--
# $Idaemons: /home/cvs/rb/generator.rb,v 1.8 2001/10/03 08:54:32 knu Exp $
# $RoughId: generator.rb,v 1.10 2003/10/14 19:36:58 knu Exp $
-# $Id: generator.rb,v 1.2.2.2 2004/05/07 08:48:23 matz Exp $
+# $Id$
#++
#
# = generator.rb: convert an internal iterator to an external one
diff --git a/lib/getoptlong.rb b/lib/getoptlong.rb
index 4d004419b1..1a0d669fa3 100644
--- a/lib/getoptlong.rb
+++ b/lib/getoptlong.rb
@@ -1,94 +1,17 @@
+# -*- Ruby -*-
+# Copyright (C) 1998, 1999, 2000 Motoyuki Kasahara
#
-# GetoptLong for Ruby
-#
-# Copyright (C) 1998, 1999, 2000 Motoyuki Kasahara.
-#
-# You may redistribute and/or modify this library under the same license
+# You may redistribute it and/or modify it under the same license
# terms as Ruby.
#
-# See GetoptLong for documentation.
-#
-# Additional documents and the latest version of `getoptlong.rb' can be
-# found at http://www.sra.co.jp/people/m-kasahr/ruby/getoptlong/
-# The GetoptLong class allows you to parse command line options similarly to
-# the GNU getopt_long() C library call. Note, however, that GetoptLong is a
-# pure Ruby implementation.
-#
-# GetoptLong allows for POSIX-style options like <tt>--file</tt> as well
-# as single letter options like <tt>-f</tt>
#
-# The empty option <tt>--</tt> (two minus symbols) is used to end option
-# processing. This can be particularly important if options have optional
-# arguments.
+# Documents and latest version of `getoptlong.rb' are found at:
+# http://www.sra.co.jp/people/m-kasahr/ruby/getoptlong/
#
-# Here is a simple example of usage:
-#
-# # == Synopsis
-# #
-# # hello: greets user, demonstrates command line parsing
-# #
-# # == Usage
-# #
-# # hello [OPTION] ... DIR
-# #
-# # -h, --help:
-# # show help
-# #
-# # --repeat x, -n x:
-# # repeat x times
-# #
-# # --name [name]:
-# # greet user by name, if name not supplied default is John
-# #
-# # DIR: The directory in which to issue the greeting.
-#
-# require 'getoptlong'
-# require 'rdoc/usage'
-#
-# opts = GetoptLong.new(
-# [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
-# [ '--repeat', '-n', GetoptLong::REQUIRED_ARGUMENT ],
-# [ '--name', GetoptLong::OPTIONAL_ARGUMENT ]
-# )
-#
-# dir = nil
-# name = nil
-# repetitions = 1
-# opts.each do |opt, arg|
-# case opt
-# when '--help'
-# RDoc::usage
-# when '--repeat'
-# repetitions = arg.to_i
-# when '--name'
-# if arg == ''
-# name = 'John'
-# else
-# name = arg
-# end
-# end
-# end
-#
-# if ARGV.length != 1
-# puts "Missing dir argument (try --help)"
-# exit 0
-# end
-#
-# dir = ARGV.shift
-#
-# Dir.chdir(dir)
-# for i in (1..repetitions)
-# print "Hello"
-# if name
-# print ", #{name}"
-# end
-# puts
-# end
-#
-# Example command line:
+
#
-# hello -n 6 --name -- /tmp
+# Parse command line options just like GNU getopt_long().
#
class GetoptLong
#
@@ -117,20 +40,7 @@ class GetoptLong
class InvalidOption < Error; end
#
- # Set up option processing.
- #
- # The options to support are passed to new() as an array of arrays.
- # Each sub-array contains any number of String option names which carry
- # the same meaning, and one of the following flags:
- #
- # GetoptLong::NO_ARGUMENT :: Option does not take an argument.
- #
- # GetoptLong::REQUIRED_ARGUMENT :: Option always takes an argument.
- #
- # GetoptLong::OPTIONAL_ARGUMENT :: Option may or may not take an argument.
- #
- # The first option name is considered to be the preferred (canonical) name.
- # Other than that, the elements of each sub-array can be in any order.
+ # Initializer.
#
def initialize(*arguments)
#
@@ -193,53 +103,7 @@ class GetoptLong
end
#
- # Set the handling of the ordering of options and arguments.
- # A RuntimeError is raised if option processing has already started.
- #
- # The supplied value must be a member of GetoptLong::ORDERINGS. It alters
- # the processing of options as follows:
- #
- # <b>REQUIRE_ORDER</b> :
- #
- # Options are required to occur before non-options.
- #
- # Processing of options ends as soon as a word is encountered that has not
- # been preceded by an appropriate option flag.
- #
- # For example, if -a and -b are options which do not take arguments,
- # parsing command line arguments of '-a one -b two' would result in
- # 'one', '-b', 'two' being left in ARGV, and only ('-a', '') being
- # processed as an option/arg pair.
- #
- # This is the default ordering, if the environment variable
- # POSIXLY_CORRECT is set. (This is for compatibility with GNU getopt_long.)
- #
- # <b>PERMUTE</b> :
- #
- # Options can occur anywhere in the command line parsed. This is the
- # default behavior.
- #
- # Every sequence of words which can be interpreted as an option (with or
- # without argument) is treated as an option; non-option words are skipped.
- #
- # For example, if -a does not require an argument and -b optionally takes
- # an argument, parsing '-a one -b two three' would result in ('-a','') and
- # ('-b', 'two') being processed as option/arg pairs, and 'one','three'
- # being left in ARGV.
- #
- # If the ordering is set to PERMUTE but the environment variable
- # POSIXLY_CORRECT is set, REQUIRE_ORDER is used instead. This is for
- # compatibility with GNU getopt_long.
- #
- # <b>RETURN_IN_ORDER</b> :
- #
- # All words on the command line are processed as options. Words not
- # preceded by a short or long option flag are passed as arguments
- # with an option of '' (empty string).
- #
- # For example, if -a requires an argument but -b does not, a command line
- # of '-a one -b two three' would result in option/arg pairs of ('-a', 'one')
- # ('-b', ''), ('', 'two'), ('', 'three') being processed.
+ # Set ordering.
#
def ordering=(ordering)
#
@@ -270,9 +134,7 @@ class GetoptLong
attr_reader :ordering
#
- # Set options. Takes the same argument as GetoptLong.new.
- #
- # Raises a RuntimeError if option processing has already started.
+ # Set options
#
def set_options(*arguments)
#
@@ -346,7 +208,7 @@ class GetoptLong
end
#
- # Set/Unset `quiet' mode.
+ # Set/Unset `quit' mode.
#
attr_writer :quiet
@@ -361,7 +223,7 @@ class GetoptLong
alias quiet? quiet
#
- # Explicitly terminate option processing.
+ # Terminate option processing.
#
def terminate
return nil if @status == STATUS_TERMINATED
@@ -381,7 +243,7 @@ class GetoptLong
end
#
- # Returns true if option processing has terminated, false otherwise.
+ # Examine whether option processing is terminated or not.
#
def terminated?
return @status == STATUS_TERMINATED
@@ -414,23 +276,15 @@ class GetoptLong
#
alias error? error
- # Return the appropriate error message in POSIX-defined format.
- # If no error has occurred, returns nil.
+ #
+ # Return an error message.
#
def error_message
return @error_message
end
#
- # Get next option name and its argument, as an Array of two elements.
- #
- # The option name is always converted to the first (preferred)
- # name given in the original options to GetoptLong.new.
- #
- # Example: ['--option', 'value']
- #
- # Returns nil if the processing is complete (as determined by
- # STATUS_TERMINATED).
+ # Get next option name and its argument as an array.
#
def get
option_name, option_argument = nil, ''
@@ -596,15 +450,8 @@ class GetoptLong
#
alias get_option get
- # Iterator version of `get'.
#
- # The block is called repeatedly with two arguments:
- # The first is the option name.
- # The second is the argument which followed it (if any).
- # Example: ('--opt', 'value')
- #
- # The option name is always converted to the first (preferred)
- # name given in the original options to GetoptLong.new.
+ # Iterator version of `get'.
#
def each
loop do
diff --git a/lib/getopts.rb b/lib/getopts.rb
index 0e21bf96c7..34fb0d6442 100644
--- a/lib/getopts.rb
+++ b/lib/getopts.rb
@@ -1,8 +1,8 @@
#
# getopts.rb -
# $Release Version: $
-# $Revision: 1.8.2.4 $
-# $Date: 2006/08/04 22:00:21 $
+# $Revision$
+# $Date$
# by Yasuo OHBA(SHL Japan Inc. Technology Dept.)
#
# --
@@ -15,11 +15,8 @@
# rewritten by Akinori MUSHA <knu@ruby-lang.org>
#
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: getopts is deprecated after Ruby 1.8.1; use optparse instead" if caller[0] and $VERBOSE
+$RCS_ID=%q$Header$
-$RCS_ID=%q$Header: /src/ruby/lib/getopts.rb,v 1.8.2.4 2006/08/04 22:00:21 drbrain Exp $
-
-# getopts is obsolete. Use GetoptLong.
def getopts(single_options, *options)
boolopts = {}
diff --git a/lib/gserver.rb b/lib/gserver.rb
index eb5f31b7b3..371fceb290 100644
--- a/lib/gserver.rb
+++ b/lib/gserver.rb
@@ -12,23 +12,21 @@ require "socket"
require "thread"
#
-# GServer implements a generic server, featuring thread pool management,
-# simple logging, and multi-server management. See HttpServer in
-# <tt>xmlrpc/httpserver.rb</tt> in the Ruby standard library for an example of
-# GServer in action.
-#
-# Any kind of application-level server can be implemented using this class.
-# It accepts multiple simultaneous connections from clients, up to an optional
-# maximum number. Several _services_ (i.e. one service per TCP port) can be
-# run simultaneously, and stopped at any time through the class method
-# <tt>GServer.stop(port)</tt>. All the threading issues are handled, saving
-# you the effort. All events are optionally logged, but you can provide your
-# own event handlers if you wish.
+# +GServer+ implements a generic server, featuring thread pool management, simple logging, and
+# multi-server management. See <tt>xmlrpc/httpserver.rb</tt> in the Ruby standard library for
+# an example of +GServer+ in action.
+#
+# Any kind of application-level server can be implemented using this class. It accepts
+# multiple simultaneous connections from clients, up to an optional maximum number. Several
+# _services_ (i.e. one service per TCP port) can be run simultaneously, and stopped at any time
+# through the class method <tt>GServer.stop(port)</tt>. All the threading issues are handled,
+# saving you the effort. All events are optionally logged, but you can provide your own event
+# handlers if you wish.
#
# === Example
#
-# Using GServer is simple. Below we implement a simple time server, run it,
-# query it, and shut it down. Try this code in +irb+:
+# Using +GServer+ is simple. Below we implement a simple time server, run it, query it, and
+# shut it down. Try this code in +irb+:
#
# require 'gserver'
#
@@ -62,16 +60,14 @@ require "thread"
# GServer.stop(10001)
# # or, of course, "server.stop".
#
-# All the business of accepting connections and exception handling is taken
-# care of. All we have to do is implement the method that actually serves the
-# client.
+# All the business of accepting connections and exception handling is taken care of. All we
+# have to do is implement the method that actually serves the client.
#
# === Advanced
#
-# As the example above shows, the way to use GServer is to subclass it to
-# create a specific server, overriding the +serve+ method. You can override
-# other methods as well if you wish, perhaps to collect statistics, or emit
-# more detailed logging.
+# As the example above shows, the way to use +GServer+ is to subclass it to create a specific
+# server, overriding the +serve+ method. You can override other methods as well if you wish,
+# perhaps to collect statistics, or emit more detailed logging.
#
# connecting
# disconnecting
@@ -80,8 +76,8 @@ require "thread"
#
# The above methods are only called if auditing is enabled.
#
-# You can also override +log+ and +error+ if, for example, you wish to use a
-# more sophisticated logging system.
+# You can also override +log+ and +error+ if, for example, you wish to use a more sophisticated
+# logging system.
#
class GServer
diff --git a/lib/importenv.rb b/lib/importenv.rb
index 8e1ba33b1d..435d6f972a 100644
--- a/lib/importenv.rb
+++ b/lib/importenv.rb
@@ -7,8 +7,6 @@
# $USER = "matz"
# p ENV["USER"]
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: importenv is deprecated after Ruby 1.8.1 (no replacement)"
-
for k,v in ENV
next unless /^[a-zA-Z][_a-zA-Z0-9]*/ =~ k
eval <<EOS
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index 67e2b65332..24543ce093 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -6,10 +6,30 @@
#
# You can redistribute and/or modify it under the same terms as Ruby.
#
-# $Id: ipaddr.rb,v 1.5.2.3 2006/08/04 22:00:21 drbrain Exp $
-#
+# $Id$
+#--
# TODO:
# - scope_id support
+#++
+#
+#== Example
+#
+# require 'ipaddr'
+#
+# ipaddr1 = IPAddr.new "3ffe:505:2::1"
+#
+# p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
+#
+# p ipaddr1.to_s #=> "3ffe:505:2::1"
+#
+# ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>
+#
+# p ipaddr2.to_s #=> "3ffe:505:2::"
+#
+# ipaddr3 = IPAddr.new "192.168.2.0/24"
+#
+# p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0>
+
require 'socket'
unless Socket.const_defined? "AF_INET6"
@@ -55,27 +75,8 @@ unless Socket.const_defined? "AF_INET6"
end
end
-# IPAddr provides a set of methods to manipulate an IP address. Both IPv4 and
-# IPv6 are supported.
-#
-# == Example
-#
-# require 'ipaddr'
-#
-# ipaddr1 = IPAddr.new "3ffe:505:2::1"
-#
-# p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
-#
-# p ipaddr1.to_s #=> "3ffe:505:2::1"
-#
-# ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>
-#
-# p ipaddr2.to_s #=> "3ffe:505:2::"
-#
-# ipaddr3 = IPAddr.new "192.168.2.0/24"
-#
-# p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0>
-
+# IPAddr provides a set of methods to manipulate an IP address. Both
+# IPv4 and IPv6 are supported.
class IPAddr
IN4MASK = 0xffffffff
@@ -206,7 +207,6 @@ class IPAddr
break if str.sub!(/\b0:0\b/, ':')
break
end
- str.sub!(/:{3,}/, '::')
if /\A::(ffff:)?([\da-f]{1,4}):([\da-f]{1,4})\Z/i =~ str
str = sprintf('::%s%d.%d.%d.%d', $1, $2.hex / 256, $2.hex % 256, $3.hex / 256, $3.hex % 256)
@@ -674,10 +674,6 @@ class TC_IPAddr < Test::Unit::TestCase
}
end
- def test_to_s
- assert_equal("3ffe:0505:0002:0000:0000:0000:0000:0001", IPAddr.new("3ffe:505:2::1").to_string)
- assert_equal("3ffe:505:2::1", IPAddr.new("3ffe:505:2::1").to_s)
- end
end
class TC_Operator < Test::Unit::TestCase
diff --git a/lib/irb.rb b/lib/irb.rb
index 65b1512740..1e59d6f669 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -1,9 +1,9 @@
#
# irb.rb - irb main module
-# $Release Version: 0.9.5 $
-# $Revision: 1.7.2.2 $
-# $Date: 2005/10/25 06:38:25 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9 $
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -23,7 +23,7 @@ require "irb/locale"
STDOUT.sync = true
module IRB
- @RCS_ID='-$Id: irb.rb,v 1.7.2.2 2005/10/25 06:38:25 matz Exp $-'
+ @RCS_ID='-$Id$-'
class Abort < Exception;end
@@ -88,8 +88,8 @@ module IRB
# irb interpriter main routine
#
class Irb
- def initialize(workspace = nil, input_method = nil, output_method = nil)
- @context = Context.new(self, workspace, input_method, output_method)
+ def initialize(workspace = nil, input_method = nil)
+ @context = Context.new(self, workspace, input_method)
@context.main.extend ExtendCommandBundle
@signal_status = :IN_IRB
@@ -106,8 +106,6 @@ module IRB
f = @context.prompt_s
elsif continue
f = @context.prompt_c
- elsif indent > 0
- f = @context.prompt_n
else @context.prompt_i
f = @context.prompt_i
end
@@ -119,7 +117,7 @@ module IRB
end
if @context.auto_indent_mode
unless ltype
- ind = prompt(@context.prompt_i, ltype, indent, line_no)[/.*\z/].size +
+ ind = prompt(@context.prompt_i, ltype, indent, line_no).size +
indent * 2 - p.size
ind += 2 if continue
@context.io.prompt = p + " " * ind if ind > 0
diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb
index 63be940f7a..84f06014ba 100644
--- a/lib/irb/cmd/chws.rb
+++ b/lib/irb/cmd/chws.rb
@@ -1,9 +1,9 @@
#
# change-ws.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb
index 67dee460f1..30024dc5e0 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -1,23 +1,9 @@
-#
-# fork.rb -
-# $Release Version: 0.9.5 $
-# $Revision: 1.2.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
-#
-# --
-#
-#
-#
-
-@RCS_ID='-$Id: fork.rb,v 1.2.2.1 2005/04/19 19:24:58 keiju Exp $-'
-
module IRB
module ExtendCommand
class Fork<Nop
def execute(&block)
- pid = send ExtendCommand.irb_original_method_name("fork")
+ pid = send(ExtendCommand.irb_original_method_name("fork"))
unless pid
class<<self
alias_method :exit, ExtendCommand.irb_original_method_name('exit')
diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb
deleted file mode 100644
index 578d9e63a6..0000000000
--- a/lib/irb/cmd/help.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# help.rb - helper using ri
-# $Release Version: 0.9.5$
-# $Revision: 1.2.4.1 $
-# $Date: 2005/04/19 19:24:58 $
-#
-# --
-#
-#
-#
-
-require 'rdoc/ri/ri_driver'
-
-module IRB
- module ExtendCommand
- module Help
- begin
- @ri = RiDriver.new
- rescue SystemExit
- else
- def self.execute(context, *names)
- names.each do |name|
- begin
- @ri.get_info_for(name.to_s)
- rescue RiError
- puts $!.message
- end
- end
- nil
- end
- end
- end
- end
-end
diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb
index aec5d8a391..99d20f500c 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -1,9 +1,9 @@
#
# load.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb
index f0e786e8d4..73c52b1aa3 100644
--- a/lib/irb/cmd/nop.rb
+++ b/lib/irb/cmd/nop.rb
@@ -1,9 +1,9 @@
#
# nop.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
@@ -13,7 +13,7 @@ module IRB
module ExtendCommand
class Nop
- @RCS_ID='-$Id: nop.rb,v 1.1.2.1 2005/04/19 19:24:58 keiju Exp $-'
+ @RCS_ID='-$Id$-'
def self.execute(conf, *opts)
command = new(conf)
diff --git a/lib/irb/cmd/pushws.rb b/lib/irb/cmd/pushws.rb
index 7acfee094f..0d8130d5c6 100644
--- a/lib/irb/cmd/pushws.rb
+++ b/lib/irb/cmd/pushws.rb
@@ -1,9 +1,9 @@
#
# change-ws.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/cmd/subirb.rb b/lib/irb/cmd/subirb.rb
index 3ea9db33a0..7899f1bb43 100644
--- a/lib/irb/cmd/subirb.rb
+++ b/lib/irb/cmd/subirb.rb
@@ -1,10 +1,10 @@
#!/usr/local/bin/ruby
#
# multi.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 49fb4556fa..e51a92adc1 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -1,8 +1,8 @@
#
# irb/completor.rb -
# $Release Version: 0.9$
-# $Revision: 1.8.2.3 $
-# $Date: 2006/07/19 15:08:56 $
+# $Revision$
+# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# From Original Idea of shugo@ruby-lang.org
#
@@ -12,7 +12,7 @@ require "readline"
module IRB
module InputCompletor
- @RCS_ID='-$Id: completion.rb,v 1.8.2.3 2006/07/19 15:08:56 keiju Exp $-'
+ @RCS_ID='-$Id$-'
ReservedWords = [
"BEGIN", "END",
@@ -99,27 +99,15 @@ module IRB
candidates = Symbol.instance_methods(true)
select_message(receiver, message, candidates)
- when /^(-?(0[dbo])?[0-9_]+(\.[0-9_]+)?([eE]-?[0-9]+)?)\.([^.]*)$/
+ when /^([0-9_]+(\.[0-9_]+)?(e[0-9]+)?)\.([^.]*)$/
# Numeric
receiver = $1
- message = Regexp.quote($5)
-
- begin
- candidates = eval(receiver, bind).methods
- rescue Exception
- candidates = []
- end
- select_message(receiver, message, candidates)
-
- when /^(-?0x[0-9a-fA-F_]+)\.([^.]*)$/
- # Numeric(0xFFFF)
- receiver = $1
- message = Regexp.quote($2)
+ message = Regexp.quote($4)
begin
candidates = eval(receiver, bind).methods
rescue Exception
- candidates = []
+ candidates
end
select_message(receiver, message, candidates)
@@ -150,13 +138,8 @@ module IRB
# func1.func2
candidates = []
ObjectSpace.each_object(Module){|m|
- begin
- name = m.name
- rescue Exception
- name = ""
- end
- next if name != "IRB::Context" and
- /^(IRB|SLex|RubyLex|RubyToken)/ =~ name
+ next if m.name != "IRB::Context" and
+ /^(IRB|SLex|RubyLex|RubyToken)/ =~ m.name
candidates.concat m.instance_methods(false)
}
candidates.sort!
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index c82be24db1..9421608f85 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -1,9 +1,9 @@
#
# irb/context.rb - irb context
-# $Release Version: 0.9.5$
-# $Revision: 1.8.2.3 $
-# $Date: 2005/07/31 15:10:26 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -19,7 +19,7 @@ module IRB
# String -- File
# other -- using this as InputMethod
#
- def initialize(irb, workspace = nil, input_method = nil, output_method = nil)
+ def initialize(irb, workspace = nil, input_method = nil)
@irb = irb
if workspace
@workspace = workspace
@@ -38,7 +38,7 @@ module IRB
@inspect_mode = IRB.conf[:INSPECT_MODE]
self.math_mode = IRB.conf[:MATH_MODE] if IRB.conf[:MATH_MODE]
- self.use_tracer = IRB.conf[:USE_TRACER] if IRB.conf[:USE_TRACER]
+ self.use_tracer = IRB.conf[:USE_TRACER] if IRB.conf[:USE_TRASER]
self.use_loader = IRB.conf[:USE_LOADER] if IRB.conf[:USE_LOADER]
self.eval_history = IRB.conf[:EVAL_HISTORY] if IRB.conf[:EVAL_HISTORY]
@@ -58,24 +58,12 @@ module IRB
case input_method
when nil
- case use_readline?
- when nil
- if (defined?(ReadlineInputMethod) && STDIN.tty? &&
- IRB.conf[:PROMPT_MODE] != :INF_RUBY)
- @io = ReadlineInputMethod.new
- else
- @io = StdioInputMethod.new
- end
- when false
+ if (defined?(ReadlineInputMethod) &&
+ (use_readline? || IRB.conf[:PROMPT_MODE] != :INF_RUBY && STDIN.tty?))
+ @io = ReadlineInputMethod.new
+ else
@io = StdioInputMethod.new
- when true
- if defined?(ReadlineInputMethod)
- @io = ReadlineInputMethod.new
- else
- @io = StdioInputMethod.new
- end
end
-
when String
@io = FileInputMethod.new(input_method)
@irb_name = File.basename(input_method)
@@ -83,13 +71,6 @@ module IRB
else
@io = input_method
end
- self.save_history = IRB.conf[:SAVE_HISTORY] if IRB.conf[:SAVE_HISTORY]
-
- if output_method
- @output_method = output_method
- else
- @output_method = StdioOutputMethod.new
- end
@verbose = IRB.conf[:VERBOSE]
@echo = IRB.conf[:ECHO]
@@ -115,14 +96,13 @@ module IRB
attr_accessor :irb_name
attr_accessor :irb_path
- attr_reader :use_readline
+ attr_accessor :use_readline
attr_reader :inspect_mode
attr_reader :prompt_mode
attr_accessor :prompt_i
attr_accessor :prompt_s
attr_accessor :prompt_c
- attr_accessor :prompt_n
attr_accessor :auto_indent_mode
attr_accessor :return_format
@@ -161,7 +141,6 @@ module IRB
def set_last_value(value)
@last_value = value
- @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
end
attr_reader :irb_name
@@ -172,7 +151,6 @@ module IRB
@prompt_i = pconf[:PROMPT_I]
@prompt_s = pconf[:PROMPT_S]
@prompt_c = pconf[:PROMPT_C]
- @prompt_n = pconf[:PROMPT_N]
@return_format = pconf[:RETURN]
if ai = pconf.include?(:AUTO_INDENT)
@auto_indent_mode = ai
@@ -199,6 +177,7 @@ module IRB
@inspect_mode
end
+ undef use_readline=
def use_readline=(opt)
@use_readline = opt
print "use readline module\n" if @use_readline
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb
index d75fe485c8..f15391e202 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -1,9 +1,9 @@
#
# irb/ext/cb.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb
index 2354ca96f7..d40a62e959 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -1,9 +1,9 @@
#
# history.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.2 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
@@ -21,7 +21,7 @@ module IRB
def set_last_value(value)
_set_last_value(value)
-# @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
+ @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
if @eval_history #and !@eval_history_values.equal?(llv)
@eval_history_values.push @line_no, @last_value
@workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
@@ -33,7 +33,7 @@ module IRB
attr_reader :eval_history
def eval_history=(no)
if no
- if defined?(@eval_history) && @eval_history
+ if @eval_history
@eval_history_values.size(no)
else
@eval_history_values = History.new(no)
@@ -49,7 +49,7 @@ module IRB
end
class History
- @RCS_ID='-$Id: history.rb,v 1.1.2.2 2005/04/19 19:24:58 keiju Exp $-'
+ @RCS_ID='-$Id$-'
def initialize(size = 16)
@size = size
diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb
index 67fdc31c8e..26e36e1209 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -1,22 +1,8 @@
-#
-# loader.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
-#
-# --
-#
-#
-#
-
-
module IRB
class LoadAbort < Exception;end
module IrbLoader
- @RCS_ID='-$Id: loader.rb,v 1.1.2.1 2005/04/19 19:24:58 keiju Exp $-'
-
+ @RCS_ID='-$Id$-'
alias ruby_load load
alias ruby_require require
diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb
index dfb01f8202..5e268bb3e5 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -1,9 +1,9 @@
#
# math-mode.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.2.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 946840fd40..e815889383 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -1,9 +1,9 @@
#
# irb/multi-irb.rb - multiple irb module
-# $Release Version: 0.9.5$
-# $Revision: 1.2.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -15,7 +15,7 @@ require "thread"
module IRB
# job management class
class JobManager
- @RCS_ID='-$Id: multi-irb.rb,v 1.2.2.1 2005/04/19 19:24:58 keiju Exp $-'
+ @RCS_ID='-$Id$-'
def initialize
# @jobs = [[thread, irb],...]
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
deleted file mode 100644
index 889d81d5be..0000000000
--- a/lib/irb/ext/save-history.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/local/bin/ruby
-#
-# save-history.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.2.4.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKAkeiju@ruby-lang.org)
-#
-# --
-#
-#
-#
-
-require "readline"
-
-module IRB
- module HistorySavingAbility
- @RCS_ID='-$Id: save-history.rb,v 1.2.4.1 2005/04/19 19:24:58 keiju Exp $-'
- end
-
- class Context
- def init_save_history
- unless (class<<@io;self;end).include?(HistorySavingAbility)
- @io.extend(HistorySavingAbility)
- end
- end
-
- def save_history
- IRB.conf[:SAVE_HISTORY]
- end
-
- def save_history=(val)
- IRB.conf[:SAVE_HISTORY] = val
- if val
- main_context = IRB.conf[:MAIN_CONTEXT]
- main_context = self unless main_context
- main_context.init_save_history
- end
- end
-
- def history_file
- IRB.conf[:HISTORY_FILE]
- end
-
- def history_file=(hist)
- IRB.conf[:HISTORY_FILE] = hist
- end
- end
-
- module HistorySavingAbility
- include Readline
-
- def HistorySavingAbility.create_finalizer
- proc do
- if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
- if hf = IRB.conf[:HISTORY_FILE]
- file = File.expand_path(hf)
- end
- file = IRB.rc_file("_history") unless file
- open(file, 'w' ) do |f|
- hist = HISTORY.to_a
- f.puts(hist[-num..-1] || hist)
- end
- end
- end
- end
-
- def HistorySavingAbility.extended(obj)
- ObjectSpace.define_finalizer(obj, HistorySavingAbility.create_finalizer)
- obj.load_history
- obj
- end
-
- def load_history
- hist = IRB.conf[:HISTORY_FILE]
- hist = IRB.rc_file("_history") unless hist
- if File.exist?(hist)
- open(hist) do |f|
- f.each {|l| HISTORY << l.chomp}
- end
- end
- end
- end
-end
-
diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index 8660bfed17..b2528f74b2 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -1,9 +1,9 @@
#
# irb/lib/tracer.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb
index 68bd1dd592..a81b3aca7b 100644
--- a/lib/irb/ext/use-loader.rb
+++ b/lib/irb/ext/use-loader.rb
@@ -1,9 +1,9 @@
#
# use-loader.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb
index b09e52ca34..2fe8f8a87b 100644
--- a/lib/irb/ext/workspaces.rb
+++ b/lib/irb/ext/workspaces.rb
@@ -1,9 +1,9 @@
#
# push-ws.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.1.2.1 $
-# $Date: 2005/04/19 19:24:58 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
#
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 934f9f6fbb..cfb2c7c4be 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -1,9 +1,9 @@
#
-# irb/extend-command.rb - irb extend command
-# $Release Version: 0.9.5$
-# $Revision: 1.4.2.3 $
-# $Date: 2006/08/08 15:16:21 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# irb/extend-command.rb - irb command extend
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -100,20 +100,16 @@ module IRB
[:fg, NO_OVERRIDE]],
[:irb_kill, :Kill, "irb/cmd/subirb",
[:kill, OVERRIDE_PRIVATE_ONLY]],
-
- [:irb_help, :Help, "irb/cmd/help",
- [:help, NO_OVERRIDE]],
-
]
- def self.install_extend_commands
+ def EXCB.install_extend_commands
for args in @EXTEND_COMMANDS
def_extend_command(*args)
end
end
# aliases = [commans_alias, flag], ...
- def self.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
+ def EXCB.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
case cmd_class
when Symbol
cmd_class = cmd_class.id2name
@@ -172,7 +168,7 @@ module IRB
"irb_" + method_name + "_org"
end
- def self.extend_object(obj)
+ def EXCB.extend_object(obj)
unless (class<<obj;ancestors;end).include?(EXCB)
super
for ali, com, flg in @ALIASES
@@ -193,19 +189,17 @@ module IRB
[:use_tracer=, "irb/ext/tracer.rb"],
[:math_mode=, "irb/ext/math-mode.rb"],
[:use_loader=, "irb/ext/use-loader.rb"],
- [:save_history=, "irb/ext/save-history.rb"],
]
- def self.install_extend_commands
+ def CE.install_extend_commands
for args in @EXTEND_COMMANDS
def_extend_command(*args)
end
end
- def self.def_extend_command(cmd_name, load_file, *aliases)
+ def CE.def_extend_command(cmd_name, load_file, *aliases)
Context.module_eval %[
def #{cmd_name}(*opts, &b)
- Context.module_eval {remove_method(:#{cmd_name})}
require "#{load_file}"
send :#{cmd_name}, *opts, &b
end
@@ -217,48 +211,5 @@ module IRB
CE.install_extend_commands
end
-
- module MethodExtender
- def def_pre_proc(base_method, extend_method)
- base_method = base_method.to_s
- extend_method = extend_method.to_s
-
- alias_name = new_alias_name(base_method)
- module_eval %[
- alias_method alias_name, base_method
- def #{base_method}(*opts)
- send :#{extend_method}, *opts
- send :#{alias_name}, *opts
- end
- ]
- end
-
- def def_post_proc(base_method, extend_method)
- base_method = base_method.to_s
- extend_method = extend_method.to_s
-
- alias_name = new_alias_name(base_method)
- module_eval %[
- alias_method alias_name, base_method
- def #{base_method}(*opts)
- send :#{alias_name}, *opts
- send :#{extend_method}, *opts
- end
- ]
- end
-
- # return #{prefix}#{name}#{postfix}<num>
- def new_alias_name(name, prefix = "__alias_of__", postfix = "__")
- base_name = "#{prefix}#{name}#{postfix}"
- all_methods = instance_methods(true) + private_instance_methods(true)
- same_methods = all_methods.grep(/^#{Regexp.quote(base_name)}[0-9]*$/)
- return base_name if same_methods.empty?
- no = same_methods.size
- while !same_methods.include?(alias_name = base_name + no)
- no += 1
- end
- alias_name
- end
- end
end
diff --git a/lib/irb/frame.rb b/lib/irb/frame.rb
index a6f15d23e9..f0b0a9abf3 100644
--- a/lib/irb/frame.rb
+++ b/lib/irb/frame.rb
@@ -1,8 +1,8 @@
#
# frame.rb -
# $Release Version: 0.9$
-# $Revision: 1.4 $
-# $Date: 2002/07/09 11:17:16 $
+# $Revision$
+# $Date$
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
#
# --
diff --git a/lib/irb/help.rb b/lib/irb/help.rb
index e239fdda4c..eb876a6dbe 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -1,8 +1,8 @@
#
# irb/help.rb - print usase module
-# $Release Version: 0.9.5$
-# $Revision: 1.2.2.1 $
-# $Date: 2005/04/19 19:24:57 $
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
diff --git a/lib/irb/init.rb b/lib/irb/init.rb
index 938e6e3d29..37cdb313e6 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -1,9 +1,9 @@
#
# irb/init.rb - irb initialize module
-# $Release Version: 0.9.5$
-# $Revision: 1.6.2.6 $
-# $Date: 2006/08/04 10:15:49 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -54,43 +54,36 @@ module IRB
@CONF[:VERBOSE] = nil
@CONF[:EVAL_HISTORY] = nil
- @CONF[:SAVE_HISTORY] = nil
@CONF[:BACK_TRACE_LIMIT] = 16
@CONF[:PROMPT] = {
:NULL => {
:PROMPT_I => nil,
- :PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
:RETURN => "%s\n"
},
:DEFAULT => {
:PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_N => "%N(%m):%03n:%i> ",
:PROMPT_S => "%N(%m):%03n:%i%l ",
:PROMPT_C => "%N(%m):%03n:%i* ",
:RETURN => "=> %s\n"
},
:CLASSIC => {
:PROMPT_I => "%N(%m):%03n:%i> ",
- :PROMPT_N => "%N(%m):%03n:%i> ",
:PROMPT_S => "%N(%m):%03n:%i%l ",
:PROMPT_C => "%N(%m):%03n:%i* ",
:RETURN => "%s\n"
},
:SIMPLE => {
:PROMPT_I => ">> ",
- :PROMPT_N => ">> ",
:PROMPT_S => nil,
:PROMPT_C => "?> ",
:RETURN => "=> %s\n"
},
:INF_RUBY => {
:PROMPT_I => "%N(%m):%03n:%i> ",
-# :PROMPT_N => "%N(%m):%03n:%i> ",
- :PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
:RETURN => "%s\n",
@@ -98,14 +91,13 @@ module IRB
},
:XMP => {
:PROMPT_I => nil,
- :PROMPT_N => nil,
:PROMPT_S => nil,
:PROMPT_C => nil,
:RETURN => " ==>%s\n"
}
}
- @CONF[:PROMPT_MODE] = (STDIN.tty? ? :DEFAULT : :NULL)
+ @CONF[:PROMPT_MODE] = :DEFAULT
@CONF[:AUTO_INDENT] = false
@CONF[:CONTEXT_MODE] = 3 # use binding in function on TOPLEVEL_BINDING
@@ -121,11 +113,8 @@ module IRB
@CONF[:LC_MESSAGES].load("irb/error.rb")
end
- FEATURE_IOPT_CHANGE_VERSION = "1.9.0"
-
# option analyzing
def IRB.parse_opts
- load_path = []
while opt = ARGV.shift
case opt
when "-f"
@@ -134,12 +123,12 @@ module IRB
@CONF[:MATH_MODE] = true
when "-d"
$DEBUG = true
- when /^-r(.+)?/
- opt = $1 || ARGV.shift
+ when "-r"
+ opt = ARGV.shift
@CONF[:LOAD_MODULES].push opt if opt
- when /^-I(.+)?/
- opt = $1 || ARGV.shift
- load_path.concat(opt.split(File::PATH_SEPARATOR)) if opt
+ when "-I"
+ opt = ARGV.shift
+ $LOAD_PATH.push opt if opt
when /^-K(.)/
$KCODE = $1
when "--inspect"
@@ -192,57 +181,34 @@ module IRB
break
end
end
- if RUBY_VERSION >= FEATURE_IOPT_CHANGE_VERSION
- load_path.collect! do |path|
- /\A\.\// =~ path ? path : File.expand_path(path)
- end
- end
- $LOAD_PATH.unshift(*load_path)
end
# running config
def IRB.run_config
if @CONF[:RC]
- begin
- load rc_file
- rescue LoadError, Errno::ENOENT
- rescue
- print "load error: #{rc_file}\n"
- print $!.class, ": ", $!, "\n"
- for err in $@[0, $@.size - 2]
- print "\t", err, "\n"
- end
- end
- end
- end
-
- IRBRC_EXT = "rc"
- def IRB.rc_file(ext = IRBRC_EXT)
- if !@CONF[:RC_NAME_GENERATOR]
- rc_file_generators do |rcgen|
- @CONF[:RC_NAME_GENERATOR] ||= rcgen
- if File.exist?(rcgen.call(IRBRC_EXT))
- @CONF[:RC_NAME_GENERATOR] = rcgen
- break
+ rcs = []
+ rcs.push File.expand_path("~/.irbrc") if ENV.key?("HOME")
+ rcs.push ".irbrc"
+ rcs.push "irb.rc"
+ rcs.push "_irbrc"
+ rcs.push "$irbrc"
+ catch(:EXIT) do
+ for rc in rcs
+ begin
+ load rc
+ throw :EXIT
+ rescue LoadError, Errno::ENOENT
+ rescue
+ print "load error: #{rc}\n"
+ print $!.class, ": ", $!, "\n"
+ for err in $@[0, $@.size - 2]
+ print "\t", err, "\n"
+ end
+ throw :EXIT
+ end
end
end
end
- @CONF[:RC_NAME_GENERATOR].call ext
- end
-
- # enumerate possible rc-file base name generators
- def IRB.rc_file_generators
- if irbrc = ENV["IRBRC"]
- yield proc{|rc| rc == "rc" ? irbrc : irbrc+rc}
- end
- if home = ENV["HOME"]
- yield proc{|rc| home+"/.irb#{rc}"}
- end
- home = Dir.pwd
- yield proc{|rc| home+"/.irb#{rc}"}
- yield proc{|rc| home+"/irb#{rc.sub(/\A_?/, '.')}"}
- yield proc{|rc| home+"/_irb#{rc}"}
- yield proc{|rc| home+"/$irb#{rc}"}
end
# loading modules
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index d6abadba76..ec834b17bc 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -1,9 +1,9 @@
#
-# irb/input-method.rb - input methods used irb
-# $Release Version: 0.9.5$
-# $Revision: 1.4.2.2 $
-# $Date: 2005/05/25 13:53:41 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# irb/input-method.rb - input methods using irb
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -18,7 +18,7 @@ module IRB
#
STDIN_FILE_NAME = "(line)"
class InputMethod
- @RCS_ID='-$Id: input-method.rb,v 1.4.2.2 2005/05/25 13:53:41 shugo Exp $-'
+ @RCS_ID='-$Id$-'
def initialize(file = STDIN_FILE_NAME)
@file_name = file
@@ -94,8 +94,8 @@ module IRB
end
def gets
- if l = readline(@prompt, false)
- HISTORY.push(l) if !l.empty?
+ if l = readline(@prompt, true)
+ HISTORY.pop if l.empty?
@line[@line_no += 1] = l + "\n"
else
@eof = true
diff --git a/lib/irb/lc/error.rb b/lib/irb/lc/error.rb
index 54420e3508..68a488a48a 100644
--- a/lib/irb/lc/error.rb
+++ b/lib/irb/lc/error.rb
@@ -1,9 +1,9 @@
#
# irb/lc/error.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.5.2.1 $
-# $Date: 2005/04/19 19:24:59 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message
index f33d95e543..efc00bf148 100644
--- a/lib/irb/lc/help-message
+++ b/lib/irb/lc/help-message
@@ -1,9 +1,9 @@
#
# irb/lc/help-message.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.4.2.2 $
-# $Date: 2005/04/19 19:24:59 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
diff --git a/lib/irb/lc/ja/error.rb b/lib/irb/lc/ja/error.rb
index 25f8af68e0..e1afaf5d71 100644
--- a/lib/irb/lc/ja/error.rb
+++ b/lib/irb/lc/ja/error.rb
@@ -1,9 +1,9 @@
#
# irb/lc/ja/error.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.5.2.1 $
-# $Date: 2005/04/19 19:24:59 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -25,3 +25,5 @@ module IRB
def_exception :CantChangeBinding, '$B%P%$%s%G%#%s%0(B(%s)$B$KJQ99$G$-$^$;$s(B.'
def_exception :UndefinedPromptMode, '$B%W%m%s%W%H%b!<%I(B(%s)$B$ODj5A$5$l$F$$$^$;$s(B.'
end
+
+
diff --git a/lib/irb/lc/ja/help-message b/lib/irb/lc/ja/help-message
index 606f9e8984..4b710c7788 100644
--- a/lib/irb/lc/ja/help-message
+++ b/lib/irb/lc/ja/help-message
@@ -1,9 +1,9 @@
#
# irb/lc/ja/help-message.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.3.2.2 $
-# $Date: 2005/04/19 19:24:59 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index 1f4f9f67d8..b2c90e38e2 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -1,20 +1,21 @@
#
# irb/locale.rb - internationalization module
-# $Release Version: 0.9.5$
-# $Revision: 1.6.2.3 $
-# $Date: 2005/09/01 18:30:46 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
#
#
+autoload :Tempfile, "tempfile"
autoload :Kconv, "kconv"
module IRB
class Locale
- @RCS_ID='-$Id: locale.rb,v 1.6.2.3 2005/09/01 18:30:46 keiju Exp $-'
+ @RCS_ID='-$Id$-'
JPDefaultLocale = "ja"
LOCALE_DIR = "/lc/"
@@ -31,8 +32,6 @@ module IRB
Kconv::EUC
when "ja_JP.sjis", "ja_JP.SJIS"
Kconv::SJIS
- when /ja_JP.utf-?8/i
- Kconv::UTF8
end
end
private :lc2kconv
@@ -127,12 +126,15 @@ module IRB
end
def real_load(path, priv)
- src = self.String(File.read(path))
- if priv
- eval("self", TOPLEVEL_BINDING).extend(Module.new {eval(src, nil, path)})
- else
- eval(src, TOPLEVEL_BINDING, path)
+ tmp_base = path.tr("./:", "___")
+ lc_file = Tempfile.new(tmp_base)
+ File.foreach(path) do |line|
+ line = self.String(line)
+ lc_file.print(line)
end
+ lc_file.close
+ toplevel_load lc_file.path, priv
+ lc_file.close(true)
end
private :real_load
diff --git a/lib/irb/notifier.rb b/lib/irb/notifier.rb
deleted file mode 100644
index b03f445873..0000000000
--- a/lib/irb/notifier.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-#
-# notifier.rb - optput methods used by irb
-# $Release Version: 0.9.5$
-# $Revision: 1.2.4.1 $
-# $Date: 2005/04/19 19:24:57 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
-#
-# --
-#
-#
-#
-
-require "e2mmap"
-require "irb/output-method"
-
-module IRB
- module Notifier
- extend Exception2MessageMapper
- def_exception :ErrUndefinedNotifier,
- "undefined notifier level: %d is specified"
- def_exception :ErrUnrecognizedLevel,
- "unrecognized notifier level: %s is specified"
-
- def def_notifier(prefix = "", output_method = StdioOutputMethod.new)
- CompositeNotifier.new(prefix, output_method)
- end
- module_function :def_notifier
-
- class AbstructNotifier
- def initialize(prefix, base_notifier)
- @prefix = prefix
- @base_notifier = base_notifier
- end
-
- attr_reader :prefix
-
- def notify?
- true
- end
-
- def print(*opts)
- @base_notifier.print prefix, *opts if notify?
- end
-
- def printn(*opts)
- @base_notifier.printn prefix, *opts if notify?
- end
-
- def printf(format, *opts)
- @base_notifier.printf(prefix + format, *opts) if notify?
- end
-
- def puts(*objs)
- if notify?
- @base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s})
- end
- end
-
- def pp(*objs)
- if notify?
- @base_notifier.ppx @prefix, *objs
- end
- end
-
- def ppx(prefix, *objs)
- if notify?
- @base_notifier.ppx @prefix+prefix, *objs
- end
- end
-
- def exec_if
- yield(@base_notifier) if notify?
- end
- end
-
- class CompositeNotifier<AbstructNotifier
- def initialize(prefix, base_notifier)
- super
-
- @notifiers = [D_NOMSG]
- @level_notifier = D_NOMSG
- end
-
- attr_reader :notifiers
-
- def def_notifier(level, prefix = "")
- notifier = LeveledNotifier.new(self, level, prefix)
- @notifiers[level] = notifier
- notifier
- end
-
- attr_reader :level_notifier
- alias level level_notifier
-
- def level_notifier=(value)
- case value
- when AbstructNotifier
- @level_notifier = value
- when Integer
- l = @notifiers[value]
- Notifier.Raise ErrUndefinedNotifer, value unless l
- @level_notifier = l
- else
- Notifier.Raise ErrUnrecognizedLevel, value unless l
- end
- end
-
- alias level= level_notifier=
- end
-
- class LeveledNotifier<AbstructNotifier
- include Comparable
-
- def initialize(base, level, prefix)
- super(prefix, base)
-
- @level = level
- end
-
- attr_reader :level
-
- def <=>(other)
- @level <=> other.level
- end
-
- def notify?
- @base_notifier.level >= self
- end
- end
-
- class NoMsgNotifier<LeveledNotifier
- def initialize
- @base_notifier = nil
- @level = 0
- @prefix = ""
- end
-
- def notify?
- false
- end
- end
-
- D_NOMSG = NoMsgNotifier.new
- end
-end
diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb
deleted file mode 100644
index 01bfefb5af..0000000000
--- a/lib/irb/output-method.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# output-method.rb - optput methods used by irb
-# $Release Version: 0.9.5$
-# $Revision: 1.2.4.1 $
-# $Date: 2005/04/19 19:24:57 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
-#
-# --
-#
-#
-#
-
-require "e2mmap"
-
-module IRB
- # OutputMethod
- # StdioOutputMethod
-
- class OutputMethod
- @RCS_ID='-$Id: output-method.rb,v 1.2.4.1 2005/04/19 19:24:57 keiju Exp $-'
-
- def print(*opts)
- IRB.fail NotImplementError, "print"
- end
-
- def printn(*opts)
- print opts.join(" "), "\n"
- end
-
- # extend printf
- def printf(format, *opts)
- if /(%*)%I/ =~ format
- format, opts = parse_printf_format(format, opts)
- end
- print sprintf(format, *opts)
- end
-
- # %
- # <¥Õ¥é¥°> [#0- +]
- # <ºÇ¾®¥Õ¥£¡¼¥ë¥ÉÉý> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
- # <ÀºÅÙ>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
- # #<Ťµ½¤ÀµÊ¸»ú>(hh|h|l|ll|L|q|j|z|t)
- # <ÊÑ´¹½¤ÀµÊ¸»ú>[diouxXeEfgGcsb%]
- def parse_printf_format(format, opts)
- return format, opts if $1.size % 2 == 1
- end
-
- def foo(format)
- pos = 0
- inspects = []
- format.scan(/%[#0\-+ ]?(\*(?=[^0-9])|\*[1-9][0-9]*\$|[1-9][0-9]*(?=[^0-9]))?(\.(\*(?=[^0-9])|\*[1-9][0-9]*\$|[1-9][0-9]*(?=[^0-9])))?(([1-9][0-9]*\$)*)([diouxXeEfgGcsb%])/) {|f, p, pp, pos, new_pos, c|
- puts [f, p, pp, pos, new_pos, c].join("!")
- pos = new_pos if new_pos
- if c == "I"
- inspects.push pos.to_i
- (f||"")+(p||"")+(pp||"")+(pos||"")+"s"
- else
- $&
- end
- }
- end
-
- def puts(*objs)
- for obj in objs
- print(*obj)
- print "\n"
- end
- end
-
- def pp(*objs)
- puts(*objs.collect{|obj| obj.inspect})
- end
-
- def ppx(prefix, *objs)
- puts(*objs.collect{|obj| prefix+obj.inspect})
- end
-
- end
-
- class StdioOutputMethod<OutputMethod
- def print(*opts)
- STDOUT.print(*opts)
- end
- end
-end
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 6310fb626b..e25af30546 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -1,9 +1,9 @@
#
# irb/ruby-lex.rb - ruby lexcal analizer
-# $Release Version: 0.9.5$
-# $Revision: 1.22.2.6 $
-# $Date: 2006/08/04 10:15:49 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -15,7 +15,7 @@ require "irb/slex"
require "irb/ruby-token"
class RubyLex
- @RCS_ID='-$Id: ruby-lex.rb,v 1.22.2.6 2006/08/04 10:15:49 keiju Exp $-'
+ @RCS_ID='-$Id$-'
extend Exception2MessageMapper
def_exception(:AlreadyDefinedToken, "Already defined token(%s)")
@@ -51,18 +51,13 @@ class RubyLex
@indent = 0
@indent_stack = []
- @lex_state = EXPR_BEG
- @space_seen = false
- @here_header = false
-
- @continue = false
- @line = ""
@skip_space = false
@readed_auto_clean_up = false
@exception_on_syntax_error = true
-
@prompt = nil
+ @here_header = nil
+ @lex_state = nil
end
attr_accessor :skip_space
@@ -100,8 +95,7 @@ class RubyLex
def getc
while @rests.empty?
-# return nil unless buf_input
- @rests.push nil unless buf_input
+ return nil unless buf_input
end
c = @rests.shift
if @here_header
@@ -122,10 +116,9 @@ class RubyLex
def gets
l = ""
while c = getc
- l.concat(c)
+ l.concat c
break if c == "\n"
end
- return nil if l == "" and c.nil?
l
end
@@ -193,7 +186,7 @@ class RubyLex
end
private :buf_input
- def set_prompt(p = nil, &block)
+ def set_prompt(p=nil, &block)
p = block if block_given?
if p.respond_to?(:call)
@prompt = p
@@ -287,7 +280,7 @@ class RubyLex
tk = @OP.match(self)
@space_seen = tk.kind_of?(TkSPACE)
rescue SyntaxError
- raise if @exception_on_syntax_error
+ abort if @exception_on_syntax_error
tk = TkError.new(@seek, @line_no, @char_no)
end
end while @skip_space and tk.kind_of?(TkSPACE)
@@ -309,7 +302,7 @@ class RubyLex
"q" => "\'",
"Q" => "\"",
"x" => "\`",
- "r" => "/",
+ "r" => "\/",
"w" => "]",
"W" => "]",
"s" => ":"
@@ -326,35 +319,35 @@ class RubyLex
"\'" => TkSTRING,
"\"" => TkSTRING,
"\`" => TkXSTRING,
- "/" => TkREGEXP,
+ "\/" => TkREGEXP,
"]" => TkDSTRING,
":" => TkSYMBOL
}
DLtype2Token = {
"\"" => TkDSTRING,
"\`" => TkDXSTRING,
- "/" => TkDREGEXP,
+ "\/" => TkDREGEXP,
}
def lex_init()
- @OP = IRB::SLex.new
- @OP.def_rules("\0", "\004", "\032") do |op, io|
+ @OP = SLex.new
+ @OP.def_rules("\0", "\004", "\032") do
Token(TkEND_OF_SCRIPT)
end
- @OP.def_rules(" ", "\t", "\f", "\r", "\13") do |op, io|
+ @OP.def_rules(" ", "\t", "\f", "\r", "\13") do
@space_seen = true
while getc =~ /[ \t\f\r\13]/; end
ungetc
Token(TkSPACE)
end
- @OP.def_rule("#") do |op, io|
+ @OP.def_rule("#") do
+ |op, io|
identify_comment
end
- @OP.def_rule("=begin",
- proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do
+ @OP.def_rule("=begin", proc{@prev_char_no == 0 && peek(0) =~ /\s/}) do
|op, io|
@ltype = "="
until getc == "\n"; end
@@ -366,7 +359,7 @@ class RubyLex
Token(TkRD_COMMENT)
end
- @OP.def_rule("\n") do |op, io|
+ @OP.def_rule("\n") do
print "\\n\n" if RubyLex.debug?
case @lex_state
when EXPR_BEG, EXPR_FNAME, EXPR_DOT
@@ -436,7 +429,6 @@ class RubyLex
@OP.def_rules("`") do
|op, io|
if @lex_state == EXPR_FNAME
- @lex_state = EXPR_END
Token(op)
else
identify_string(op)
@@ -478,15 +470,13 @@ class RubyLex
Token(TkOPASGN, $1)
end
- @OP.def_rule("+@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("+@", proc{@lex_state == EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
Token(op)
end
- @OP.def_rule("-@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("-@", proc{@lex_state == EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
Token(op)
end
@@ -509,7 +499,6 @@ class RubyLex
end
@OP.def_rule(".") do
- |op, io|
@lex_state = EXPR_BEG
if peek(0) =~ /[0-9]/
ungetc
@@ -540,7 +529,6 @@ class RubyLex
end
@OP.def_rule(":") do
- |op, io|
if @lex_state == EXPR_END || peek(0) =~ /\s/
@lex_state = EXPR_BEG
Token(TkCOLON)
@@ -551,7 +539,6 @@ class RubyLex
end
@OP.def_rule("::") do
- |op, io|
# p @lex_state.id2name, @space_seen
if @lex_state == EXPR_BEG or @lex_state == EXPR_ARG && @space_seen
@lex_state = EXPR_BEG
@@ -579,7 +566,6 @@ class RubyLex
end
@OP.def_rules("^") do
- |op, io|
@lex_state = EXPR_BEG
Token("^")
end
@@ -607,19 +593,16 @@ class RubyLex
end
@OP.def_rule("~") do
- |op, io|
@lex_state = EXPR_BEG
Token("~")
end
- @OP.def_rule("~@", proc{|op, io| @lex_state == EXPR_FNAME}) do
- |op, io|
+ @OP.def_rule("~@", proc{@lex_state == EXPR_FNAME}) do
@lex_state = EXPR_BEG
Token("~")
end
@OP.def_rule("(") do
- |op, io|
@indent += 1
if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
@lex_state = EXPR_BEG
@@ -632,20 +615,15 @@ class RubyLex
tk = Token(tk_c)
end
- @OP.def_rule("[]", proc{|op, io| @lex_state == EXPR_FNAME}) do
- |op, io|
- @lex_state = EXPR_ARG
+ @OP.def_rule("[]", proc{@lex_state == EXPR_FNAME}) do
Token("[]")
end
- @OP.def_rule("[]=", proc{|op, io| @lex_state == EXPR_FNAME}) do
- |op, io|
- @lex_state = EXPR_ARG
+ @OP.def_rule("[]=", proc{@lex_state == EXPR_FNAME}) do
Token("[]=")
end
@OP.def_rule("[") do
- |op, io|
@indent += 1
if @lex_state == EXPR_FNAME
tk_c = TkfLBRACK
@@ -664,7 +642,6 @@ class RubyLex
end
@OP.def_rule("{") do
- |op, io|
@indent += 1
if @lex_state != EXPR_END && @lex_state != EXPR_ARG
tk_c = TkLBRACE
@@ -677,7 +654,6 @@ class RubyLex
end
@OP.def_rule('\\') do
- |op, io|
if getc == "\n"
@space_seen = true
@continue = true
@@ -704,12 +680,10 @@ class RubyLex
end
@OP.def_rule('$') do
- |op, io|
identify_gvar
end
@OP.def_rule('@') do
- |op, io|
if peek(0) =~ /[\w_@]/
ungetc
identify_identifier
@@ -816,13 +790,14 @@ class RubyLex
else
if @lex_state != EXPR_FNAME
if ENINDENT_CLAUSE.include?(token)
- # check for ``class = val'' etc.
+ # check for ``class = val''.
valid = true
case token
when "class"
valid = false unless peek_match?(/^\s*(<<|\w|::)/)
when "def"
valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
+# valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)?=|\&\&|\|\|)/)
when "do"
valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&)/)
when *ENINDENT_CLAUSE
@@ -910,11 +885,7 @@ class RubyLex
end
@here_header = false
- while l = gets
- l = l.sub(/(:?\r)?\n\z/, '')
- if (indent ? l.strip : l) == quoted
- break
- end
+ while (l = gets.chomp) && (indent ? l.strip : l) != quoted
end
@here_header = true
@@ -949,51 +920,19 @@ class RubyLex
def identify_number
@lex_state = EXPR_END
- if peek(0) == "0" && peek(1) !~ /[.eE]/
- getc
- case peek(0)
- when /[xX]/
+ if ch = getc
+ if /[xX]/ =~ peek(0)
ch = getc
match = /[0-9a-fA-F_]/
- when /[bB]/
+ elsif /[bB]/ =~ peek(0)
ch = getc
match = /[01_]/
- when /[oO]/
- ch = getc
- match = /[0-7_]/
- when /[dD]/
- ch = getc
- match = /[0-9_]/
- when /[0-7]/
+ else
match = /[0-7_]/
- when /[89]/
- RubyLex.fail SyntaxError, "Illegal octal digit"
- else
- return Token(TkINTEGER)
end
-
- len0 = true
- non_digit = false
while ch = getc
- if match =~ ch
- if ch == "_"
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{ch}' in number"
- else
- non_digit = ch
- end
- else
- non_digit = false
- len0 = false
- end
- else
+ if ch !~ match
ungetc
- if len0
- RubyLex.fail SyntaxError, "numeric literal without digits"
- end
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
break
end
end
@@ -1003,39 +942,24 @@ class RubyLex
type = TkINTEGER
allow_point = true
allow_e = true
- non_digit = false
while ch = getc
case ch
- when /[0-9]/
- non_digit = false
- when "_"
- non_digit = ch
+ when /[0-9_]/
when allow_point && "."
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
type = TkFLOAT
if peek(0) !~ /[0-9]/
- type = TkINTEGER
ungetc
break
end
allow_point = false
when allow_e && "e", allow_e && "E"
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
type = TkFLOAT
if peek(0) =~ /[+-]/
getc
end
allow_e = false
allow_point = false
- non_digit = ch
else
- if non_digit
- RubyLex.fail SyntaxError, "trailing `#{non_digit}' in number"
- end
ungetc
break
end
@@ -1101,7 +1025,7 @@ class RubyLex
def read_escape
case ch = getc
when "\n", "\r", "\f"
- when "\\", "n", "t", "r", "f", "v", "a", "e", "b", "s" #"
+ when "\\", "n", "t", "r", "f", "v", "a", "e", "b" #"
when /[0-7]/
ungetc ch
3.times do
@@ -1136,7 +1060,7 @@ class RubyLex
end
end
- when "C", "c" #, "^"
+ when "C", "c", "^"
if ch == "C" and (ch = getc) != "-"
ungetc
elsif (ch = getc) == "\\" #"
diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb
index 4d56754d36..49b97e9c54 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -1,9 +1,9 @@
#
# irb/ruby-token.rb - ruby tokens
-# $Release Version: 0.9.5$
-# $Revision: 1.5.2.1 $
-# $Date: 2005/04/19 19:24:57 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
@@ -64,7 +64,7 @@ module RubyToken
class TkOPASGN < TkOp
def initialize(seek, line_no, char_no, op)
super(seek, line_no, char_no)
- op = TkReading2Token[op][0] unless op.kind_of?(Symbol)
+ op = TkReading2Token[op] unless op.kind_of?(Symbol)
@op = op
end
attr :op
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index ed99e8fc86..c0943f6e33 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -1,9 +1,9 @@
#
# irb/slex.rb - symple lex analizer
-# $Release Version: 0.9.5$
-# $Revision: 1.6.2.3 $
-# $Date: 2005/04/19 19:24:57 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishituska.com)
#
# --
#
@@ -11,242 +11,236 @@
#
require "e2mmap"
-require "irb/notifier"
-module IRB
- class SLex
- @RCS_ID='-$Id: slex.rb,v 1.6.2.3 2005/04/19 19:24:57 keiju Exp $-'
+class SLex
+ @RCS_ID='-$Id$-'
- extend Exception2MessageMapper
- def_exception :ErrNodeNothing, "node nothing"
- def_exception :ErrNodeAlreadyExists, "node already exists"
+ extend Exception2MessageMapper
+ def_exception :ErrNodeNothing, "node nothing"
+ def_exception :ErrNodeAlreadyExists, "node already exists"
- DOUT = Notifier::def_notifier("SLex::")
- D_WARN = DOUT::def_notifier(1, "Warn: ")
- D_DEBUG = DOUT::def_notifier(2, "Debug: ")
- D_DETAIL = DOUT::def_notifier(4, "Detail: ")
-
- DOUT.level = Notifier::D_NOMSG
-
- def initialize
- @head = Node.new("")
+ class << self
+ attr_accessor :debug_level
+ def debug?
+ debug_level > 0
end
-
- def def_rule(token, preproc = nil, postproc = nil, &block)
- D_DETAIL.pp token
+ end
+ @debug_level = 0
- postproc = block if block_given?
- node = create(token, preproc, postproc)
- end
-
- def def_rules(*tokens, &block)
- if block_given?
- p = block
- end
- for token in tokens
- def_rule(token, nil, p)
- end
+ def initialize
+ @head = Node.new("")
+ end
+
+ def def_rule(token, preproc = nil, postproc = nil, &block)
+ # print node.inspect, "\n" if SLex.debug?
+ postproc = block if block_given?
+ node = create(token, preproc, postproc)
+ end
+
+ def def_rules(*tokens, &block)
+ if block_given?
+ p = block
end
-
- def preproc(token, proc)
- node = search(token)
- node.preproc=proc
+ for token in tokens
+ def_rule(token, nil, p)
end
-
- #$BMW%A%'%C%/(B?
- def postproc(token)
- node = search(token, proc)
- node.postproc=proc
- end
-
- def search(token)
- @head.search(token.split(//))
+ end
+
+ def preproc(token, proc)
+ node = search(token)
+ node.preproc=proc
+ end
+
+ def postproc(token)
+ node = search(token, proc)
+ node.postproc=proc
+ end
+
+ def search(token)
+ @head.search(token.split(//))
+ end
+
+ def create(token, preproc = nil, postproc = nil)
+ @head.create_subnode(token.split(//), preproc, postproc)
+ end
+
+ def match(token)
+ case token
+ when Array
+ when String
+ return match(token.split(//))
+ else
+ return @head.match_io(token)
end
+ ret = @head.match(token)
+ printf "match end: %s:%s", ret, token.inspect if SLex.debug?
+ ret
+ end
+
+ def inspect
+ format("<SLex: @head = %s>", @head.inspect)
+ end
- def create(token, preproc = nil, postproc = nil)
- @head.create_subnode(token.split(//), preproc, postproc)
+ #----------------------------------------------------------------------
+ #
+ # class Node -
+ #
+ #----------------------------------------------------------------------
+ class Node
+ # if postproc is nil, this node is an abstract node.
+ # if postproc is non-nil, this node is a real node.
+ def initialize(preproc = nil, postproc = nil)
+ @Tree = {}
+ @preproc = preproc
+ @postproc = postproc
end
+
+ attr_accessor :preproc
+ attr_accessor :postproc
- def match(token)
- case token
- when Array
- when String
- return match(token.split(//))
+ def search(chrs, opt = nil)
+ return self if chrs.empty?
+ ch = chrs.shift
+ if node = @Tree[ch]
+ node.search(chrs, opt)
else
- return @head.match_io(token)
+ if opt
+ chrs.unshift ch
+ self.create_subnode(chrs)
+ else
+ SLex.fail ErrNodeNothing
+ end
end
- ret = @head.match(token)
- D_DETAIL.exec_if{D_DEATIL.printf "match end: %s:%s\n", ret, token.inspect}
- ret
end
- def inspect
- format("<SLex: @head = %s>", @head.inspect)
- end
-
- #----------------------------------------------------------------------
- #
- # class Node -
- #
- #----------------------------------------------------------------------
- class Node
- # if postproc is nil, this node is an abstract node.
- # if postproc is non-nil, this node is a real node.
- def initialize(preproc = nil, postproc = nil)
- @Tree = {}
- @preproc = preproc
- @postproc = postproc
- end
-
- attr_accessor :preproc
- attr_accessor :postproc
-
- def search(chrs, opt = nil)
- return self if chrs.empty?
- ch = chrs.shift
- if node = @Tree[ch]
- node.search(chrs, opt)
+ def create_subnode(chrs, preproc = nil, postproc = nil)
+ if chrs.empty?
+ if @postproc
+ p node
+ SLex.fail ErrNodeAlreadyExists
else
- if opt
- chrs.unshift ch
- self.create_subnode(chrs)
- else
- SLex.fail ErrNodeNothing
- end
+ print "Warn: change abstract node to real node\n" if SLex.debug?
+ @preproc = preproc
+ @postproc = postproc
end
+ return self
end
- def create_subnode(chrs, preproc = nil, postproc = nil)
+ ch = chrs.shift
+ if node = @Tree[ch]
if chrs.empty?
- if @postproc
- D_DETAIL.pp node
+ if node.postproc
+ p node
+ p self
+ p ch
+ p chrs
SLex.fail ErrNodeAlreadyExists
else
- D_DEBUG.puts "change abstract node to real node."
- @preproc = preproc
- @postproc = postproc
+ print "Warn: change abstract node to real node\n" if SLex.debug?
+ node.preproc = preproc
+ node.postproc = postproc
end
- return self
+ else
+ node.create_subnode(chrs, preproc, postproc)
end
-
- ch = chrs.shift
- if node = @Tree[ch]
- if chrs.empty?
- if node.postproc
- DebugLogger.pp node
- DebugLogger.pp self
- DebugLogger.pp ch
- DebugLogger.pp chrs
- SLex.fail ErrNodeAlreadyExists
- else
- D_WARN.puts "change abstract node to real node"
- node.preproc = preproc
- node.postproc = postproc
- end
- else
- node.create_subnode(chrs, preproc, postproc)
- end
+ else
+ if chrs.empty?
+ node = Node.new(preproc, postproc)
else
- if chrs.empty?
- node = Node.new(preproc, postproc)
- else
- node = Node.new
- node.create_subnode(chrs, preproc, postproc)
- end
- @Tree[ch] = node
+ node = Node.new
+ node.create_subnode(chrs, preproc, postproc)
end
- node
+ @Tree[ch] = node
end
+ node
+ end
- #
- # chrs: String
- # character array
- # io must have getc()/ungetc(); and ungetc() must be
- # able to be called arbitrary number of times.
- #
- def match(chrs, op = "")
- D_DETAIL.print "match>: ", chrs, "op:", op, "\n"
- if chrs.empty?
- if @preproc.nil? || @preproc.call(op, chrs)
- DOUT.printf(D_DETAIL, "op1: %s\n", op)
- @postproc.call(op, chrs)
- else
- nil
- end
+ #
+ # chrs: String
+ # character array
+ # io must have getc()/ungetc(); and ungetc() must be
+ # able to be called arbitrary number of times.
+ #
+ def match(chrs, op = "")
+ print "match>: ", chrs, "op:", op, "\n" if SLex.debug?
+ if chrs.empty?
+ if @preproc.nil? || @preproc.call(op, chrs)
+ printf "op1: %s\n", op if SLex.debug?
+ @postproc.call(op, chrs)
else
- ch = chrs.shift
- if node = @Tree[ch]
- if ret = node.match(chrs, op+ch)
- return ret
- else
- chrs.unshift ch
- if @postproc and @preproc.nil? || @preproc.call(op, chrs)
- DOUT.printf(D_DETAIL, "op2: %s\n", op.inspect)
- ret = @postproc.call(op, chrs)
- return ret
- else
- return nil
- end
- end
+ nil
+ end
+ else
+ ch = chrs.shift
+ if node = @Tree[ch]
+ if ret = node.match(chrs, op+ch)
+ return ret
else
chrs.unshift ch
if @postproc and @preproc.nil? || @preproc.call(op, chrs)
- DOUT.printf(D_DETAIL, "op3: %s\n", op)
- @postproc.call(op, chrs)
- return ""
+ printf "op2: %s\n", op.inspect if SLex.debug?
+ ret = @postproc.call(op, chrs)
+ return ret
else
return nil
end
end
+ else
+ chrs.unshift ch
+ if @postproc and @preproc.nil? || @preproc.call(op, chrs)
+ printf "op3: %s\n", op if SLex.debug?
+ @postproc.call(op, chrs)
+ return ""
+ else
+ return nil
+ end
end
end
+ end
- def match_io(io, op = "")
- if op == ""
- ch = io.getc
- if ch == nil
- return nil
- end
- else
- ch = io.getc_of_rests
+ def match_io(io, op = "")
+ if op == ""
+ ch = io.getc
+ if ch == nil
+ return nil
end
- if ch.nil?
- if @preproc.nil? || @preproc.call(op, io)
- D_DETAIL.printf("op1: %s\n", op)
- @postproc.call(op, io)
- else
- nil
- end
+ else
+ ch = io.getc_of_rests
+ end
+ if ch.nil?
+ if @preproc.nil? || @preproc.call(op, io)
+ printf "op1: %s\n", op if SLex.debug?
+ @postproc.call(op, io)
else
- if node = @Tree[ch]
- if ret = node.match_io(io, op+ch)
- ret
- else
- io.ungetc ch
- if @postproc and @preproc.nil? || @preproc.call(op, io)
- DOUT.exec_if{D_DETAIL.printf "op2: %s\n", op.inspect}
- @postproc.call(op, io)
- else
- nil
- end
- end
+ nil
+ end
+ else
+ if node = @Tree[ch]
+ if ret = node.match_io(io, op+ch)
+ ret
else
io.ungetc ch
if @postproc and @preproc.nil? || @preproc.call(op, io)
- D_DETAIL.printf("op3: %s\n", op)
+ printf "op2: %s\n", op.inspect if SLex.debug?
@postproc.call(op, io)
else
nil
end
end
+ else
+ io.ungetc ch
+ if @postproc and @preproc.nil? || @preproc.call(op, io)
+ printf "op3: %s\n", op if SLex.debug?
+ @postproc.call(op, io)
+ else
+ nil
+ end
end
end
end
end
end
-SLex=IRB::SLex
-
if $0 == __FILE__
# Tracer.on
case $1
@@ -282,4 +276,3 @@ if $0 == __FILE__
end
exit
end
-
diff --git a/lib/irb/version.rb b/lib/irb/version.rb
index 95192669db..a9e37f7e7b 100644
--- a/lib/irb/version.rb
+++ b/lib/irb/version.rb
@@ -1,8 +1,8 @@
#
# irb/version.rb - irb version definition file
-# $Release Version: 0.9.5$
-# $Revision: 1.4.2.1 $
-# $Date: 2005/04/19 19:24:57 $
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
@@ -11,6 +11,6 @@
#
module IRB
- @RELEASE_VERSION = "0.9.5"
- @LAST_UPDATE_DATE = "05/04/13"
+ @RELEASE_VERSION = "0.9"
+ @LAST_UPDATE_DATE = "02/07/03"
end
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index 364820f997..3b099b1baa 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -1,9 +1,9 @@
#
# irb/workspace-binding.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.5.2.2 $
-# $Date: 2005/04/19 19:24:57 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
diff --git a/lib/irb/ws-for-case-2.rb b/lib/irb/ws-for-case-2.rb
index ca30eb34c0..1c58fb7dda 100644
--- a/lib/irb/ws-for-case-2.rb
+++ b/lib/irb/ws-for-case-2.rb
@@ -1,9 +1,9 @@
#
# irb/ws-for-case-2.rb -
-# $Release Version: 0.9.5$
-# $Revision: 1.2.2.1 $
-# $Date: 2005/04/19 19:24:57 $
-# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+# $Release Version: 0.9$
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
#
# --
#
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb
index 0a0883245b..4bcc2ca22f 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -1,8 +1,8 @@
#
# xmp.rb - irb version of gotoken xmp
# $Release Version: 0.9$
-# $Revision: 1.3 $
-# $Date: 2002/07/09 11:17:16 $
+# $Revision$
+# $Date$
# by Keiju ISHITSUKA(Nippon Rational Inc.)
#
# --
@@ -14,7 +14,7 @@ require "irb"
require "irb/frame"
class XMP
- @RCS_ID='-$Id: xmp.rb,v 1.3 2002/07/09 11:17:16 keiju Exp $-'
+ @RCS_ID='-$Id$-'
def initialize(bind = nil)
IRB.init_config(nil)
diff --git a/lib/jcode.rb b/lib/jcode.rb
index e5367e815b..691d22dafe 100644
--- a/lib/jcode.rb
+++ b/lib/jcode.rb
@@ -175,7 +175,7 @@ class String
def tr_s!(from, to)
return self.delete!(from) if to.length == 0
- pattern = SqueezePatternCache[from] ||= /([#{_regex_quote(from)}])\1*/
+ pattern = SqueezePatternCache[from] ||= /([#{_regex_quote(from)}])\1+/
if from[0] == ?^
last = /.$/.match(to)[0]
self.gsub!(pattern, last)
diff --git a/lib/logger.rb b/lib/logger.rb
index 3012ac2cc7..363e9774b4 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -1,8 +1,6 @@
-# logger.rb - saimple logging utility
-# Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>.
-
-require 'monitor'
-
+#
+# = logger.rb
+#
# Simple logging utility.
#
# Author:: NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
@@ -10,12 +8,18 @@ require 'monitor'
# License::
# You can redistribute it and/or modify it under the same terms of Ruby's
# license; either the dual license version in 2003, or any later version.
-# Revision:: $Id: logger.rb,v 1.5.2.9 2006/08/04 22:00:21 drbrain Exp $
+# Revision:: $Id$
+#
+# See Logger for documentation.
+#
+
+
#
# == Description
#
# The Logger class provides a simple but sophisticated logging utility that
# anyone can use because it's included in the Ruby 1.8.x standard library.
+# For more advanced logging, see the "Log4r" package on the RAA.
#
# The HOWTOs below give a code-based overview of Logger's usage, but the basic
# concept is as follows. You create a Logger object (output to a file or
@@ -72,6 +76,10 @@ require 'monitor'
# specifying a program name in conjunction with the message. The next section
# shows you how to achieve these things.
#
+# See http://raa.ruby-lang.org/list.rhtml?name=log4r for Log4r, which contains
+# many advanced features like file-based configuration, a wide range of
+# logging targets, simultaneous logging, and hierarchical logging.
+#
#
# == HOWTOs
#
@@ -138,12 +146,12 @@ require 'monitor'
#
# 1. Original interface.
#
-# logger.sev_threshold = Logger::WARN
+# logger.level = Logger::WARN
#
# 2. Log4r (somewhat) compatible interface.
#
# logger.level = Logger::INFO
-#
+#
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
#
#
@@ -166,11 +174,8 @@ require 'monitor'
# There is currently no supported way to change the overall format, but you may
# have some luck hacking the Format constant.
#
-
-
class Logger
- VERSION = "1.2.6"
- /: (\S+),v (\S+)/ =~ %q$Id: logger.rb,v 1.5.2.9 2006/08/04 22:00:21 drbrain Exp $
+ /: (\S+),v (\S+)/ =~ %q$Id$
ProgName = "#{$1}/#{$2}"
class Error < RuntimeError; end
@@ -194,20 +199,7 @@ class Logger
attr_accessor :progname
# Logging date-time format (string passed to +strftime+).
- def datetime_format=(datetime_format)
- @default_formatter.datetime_format = datetime_format
- end
-
- def datetime_format
- @default_formatter.datetime_format
- end
-
- # Logging formatter. formatter#call is invoked with 4 arguments; severity,
- # time, progname and msg for each log. Bear in mind that time is a Time and
- # msg is an Object that user passed and it could not be a String. It is
- # expected to return a logdev#write-able Object. Default formatter is used
- # when no formatter is set.
- attr_accessor :formatter
+ attr_accessor :datetime_format
alias sev_threshold level
alias sev_threshold= level=
@@ -251,17 +243,17 @@ class Logger
#
# === Description
#
- # Create an instance.
+ # Create an instance. See Logger::LogDevice.new for more information if
+ # required.
#
def initialize(logdev, shift_age = 0, shift_size = 1048576)
+ @logdev = nil
@progname = nil
@level = DEBUG
- @default_formatter = Formatter.new
- @formatter = nil
+ @datetime_format = nil
@logdev = nil
if logdev
- @logdev = LogDevice.new(logdev, :shift_age => shift_age,
- :shift_size => shift_size)
+ @logdev = LogDevice.new(logdev, :shift_age => shift_age, :shift_size => shift_size)
end
end
@@ -324,7 +316,13 @@ class Logger
end
end
@logdev.write(
- format_message(format_severity(severity), Time.now, progname, message))
+ format_message(
+ format_severity(severity),
+ format_datetime(Time.now),
+ msg2str(message),
+ progname
+ )
+ )
true
end
alias log add
@@ -427,60 +425,72 @@ private
SEV_LABEL[severity] || 'ANY'
end
- def format_message(severity, datetime, progname, msg)
- (@formatter || @default_formatter).call(severity, datetime, progname, msg)
- end
-
-
- class Formatter
- Format = "%s, [%s#%d] %5s -- %s: %s\n"
-
- attr_accessor :datetime_format
-
- def initialize
- @datetime_format = nil
+ def format_datetime(datetime)
+ if @datetime_format.nil?
+ datetime.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % datetime.usec
+ else
+ datetime.strftime(@datetime_format)
end
+ end
- def call(severity, time, progname, msg)
- Format % [severity[0..0], format_datetime(time), $$, severity, progname,
- msg2str(msg)]
- end
-
- private
-
- def format_datetime(time)
- if @datetime_format.nil?
- time.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec
- else
- time.strftime(@datetime_format)
- end
- end
+ Format = "%s, [%s#%d] %5s -- %s: %s\n"
+ def format_message(severity, timestamp, msg, progname)
+ Format % [severity[0..0], timestamp, $$, severity, progname, msg]
+ end
- def msg2str(msg)
- case msg
- when ::String
- msg
- when ::Exception
- "#{ msg.message } (#{ msg.class })\n" <<
- (msg.backtrace || []).join("\n")
- else
- msg.inspect
- end
+ def msg2str(msg)
+ case msg
+ when ::String
+ msg
+ when ::Exception
+ "#{ msg.message } (#{ msg.class })\n" << (msg.backtrace || []).join("\n")
+ else
+ msg.inspect
end
end
+ #
+ # LogDevice -- Logging device.
+ #
class LogDevice
attr_reader :dev
attr_reader :filename
- class LogDeviceMutex
- include MonitorMixin
- end
-
+ #
+ # == Synopsis
+ #
+ # Logger::LogDev.new(name, :shift_age => 'daily|weekly|monthly')
+ # Logger::LogDev.new(name, :shift_age => 10, :shift_size => 1024*1024)
+ #
+ # == Args
+ #
+ # +name+::
+ # A String (representing a filename) or an IO object (actually, anything
+ # that responds to +write+ and +close+). If a filename is given, then
+ # that file is opened for writing (and appending if it already exists),
+ # with +sync+ set to +true+.
+ # +opts+::
+ # Contains optional arguments for rolling ("shifting") the log file.
+ # <tt>:shift_age</tt> is either a description (e.g. 'daily'), or an
+ # integer number of log files to keep. <tt>shift_size</tt> is the maximum
+ # size of the log file, and is only significant is a number is given for
+ # <tt>shift_age</tt>.
+ #
+ # These arguments are only relevant if a filename is provided for the
+ # first argument.
+ #
+ # == Description
+ #
+ # Creates a LogDevice object, which is the target for log messages. Rolling
+ # of log files is supported (only if a filename is given; you can't roll an
+ # IO object). The beginning of each file created by this class is tagged
+ # with a header message.
+ #
+ # This class is unlikely to be used directly; it is a backend for Logger.
+ #
def initialize(log = nil, opt = {})
@dev = @filename = @shift_age = @shift_size = nil
- @mutex = LogDeviceMutex.new
if log.respond_to?(:write) and log.respond_to?(:close)
@dev = log
else
@@ -492,23 +502,29 @@ private
end
end
+ #
+ # Log a message. If needed, the log file is rolled and the new file is
+ # prepared. Log device is not locked. Append open does not need to lock
+ # file but on an OS which supports multi I/O, records could possibly be
+ # mixed.
+ #
def write(message)
- @mutex.synchronize do
- if @shift_age and @dev.respond_to?(:stat)
- begin
- check_shift_log
- rescue
- raise Logger::ShiftingError.new("Shifting failed. #{$!}")
- end
- end
- @dev.write(message)
+ if shift_log?
+ begin
+ shift_log
+ rescue
+ raise Logger::ShiftingError.new("Shifting failed. #{$!}")
+ end
end
+
+ @dev.write(message)
end
+ #
+ # Close the logging device.
+ #
def close
- @mutex.synchronize do
- @dev.close
- end
+ @dev.close
end
private
@@ -536,57 +552,66 @@ private
SiD = 24 * 60 * 60
- def check_shift_log
- if @shift_age.is_a?(Integer)
- # Note: always returns false if '0'.
- if @filename && (@shift_age > 0) && (@dev.stat.size > @shift_size)
- shift_log_age
- end
+ def shift_log?
+ if !@shift_age or !@dev.respond_to?(:stat)
+ return false
+ end
+ if (@shift_age.is_a?(Integer))
+ # Note: always returns false if '0'.
+ return (@filename && (@shift_age > 0) && (@dev.stat.size > @shift_size))
else
- now = Time.now
- if @dev.stat.mtime <= previous_period_end(now)
- shift_log_period(now)
- end
+ now = Time.now
+ limit_time = case @shift_age
+ when /^daily$/
+ eod(now - 1 * SiD)
+ when /^weekly$/
+ eod(now - ((now.wday + 1) * SiD))
+ when /^monthly$/
+ eod(now - now.mday * SiD)
+ else
+ now
+ end
+ return (@dev.stat.mtime <= limit_time)
end
end
- def shift_log_age
- (@shift_age-3).downto(0) do |i|
- if FileTest.exist?("#{@filename}.#{i}")
- File.rename("#{@filename}.#{i}", "#{@filename}.#{i+1}")
- end
+ def shift_log
+ # At first, close the device if opened.
+ if @dev
+ @dev.close
+ @dev = nil
end
- @dev.close
- File.rename("#{@filename}", "#{@filename}.0")
- @dev = create_logfile(@filename)
- return true
- end
-
- def shift_log_period(now)
- postfix = previous_period_end(now).strftime("%Y%m%d") # YYYYMMDD
- age_file = "#{@filename}.#{postfix}"
- if FileTest.exist?(age_file)
- raise RuntimeError.new("'#{ age_file }' already exists.")
+ if (@shift_age.is_a?(Integer))
+ (@shift_age-3).downto(0) do |i|
+ if (FileTest.exist?("#{@filename}.#{i}"))
+ File.rename("#{@filename}.#{i}", "#{@filename}.#{i+1}")
+ end
+ end
+ File.rename("#{@filename}", "#{@filename}.0")
+ else
+ now = Time.now
+ postfix_time = case @shift_age
+ when /^daily$/
+ eod(now - 1 * SiD)
+ when /^weekly$/
+ eod(now - ((now.wday + 1) * SiD))
+ when /^monthly$/
+ eod(now - now.mday * SiD)
+ else
+ now
+ end
+ postfix = postfix_time.strftime("%Y%m%d") # YYYYMMDD
+ age_file = "#{@filename}.#{postfix}"
+ if (FileTest.exist?(age_file))
+ raise RuntimeError.new("'#{ age_file }' already exists.")
+ end
+ File.rename("#{@filename}", age_file)
end
- @dev.close
- File.rename("#{@filename}", age_file)
+
@dev = create_logfile(@filename)
return true
end
- def previous_period_end(now)
- case @shift_age
- when /^daily$/
- eod(now - 1 * SiD)
- when /^weekly$/
- eod(now - ((now.wday + 1) * SiD))
- when /^monthly$/
- eod(now - now.mday * SiD)
- else
- now
- end
- end
-
def eod(t)
Time.mktime(t.year, t.month, t.mday, 23, 59, 59)
end
@@ -666,8 +691,8 @@ private
end
#
- # Sets the log device for this application. See the class Logger for an
- # explanation of the arguments.
+ # Sets the log device for this application. See the classes Logger and
+ # Logger::LogDevice for an explanation of the arguments.
#
def set_log(logdev, shift_age = 0, shift_size = 1024000)
@log = Logger.new(logdev, shift_age, shift_size)
diff --git a/lib/mailread.rb b/lib/mailread.rb
index 08b33c92a4..7573d03ed4 100644
--- a/lib/mailread.rb
+++ b/lib/mailread.rb
@@ -1,14 +1,5 @@
-# The Mail class represents an internet mail message (as per RFC822, RFC2822)
-# with headers and a body.
class Mail
- # Create a new Mail where +f+ is either a stream which responds to gets(),
- # or a path to a file. If +f+ is a path it will be opened.
- #
- # The whole message is read so it can be made available through the #header,
- # #[] and #body methods.
- #
- # The "From " line is ignored if the mail is in mbox format.
def initialize(f)
unless defined? f.gets
f = open(f, "r")
@@ -43,19 +34,14 @@ class Mail
end
end
- # Return the headers as a Hash.
def header
return @header
end
- # Return the message body as an Array of lines
def body
return @body
end
- # Return the header corresponding to +field+.
- #
- # Matching is case-insensitive.
def [](field)
@header[field.capitalize]
end
diff --git a/lib/mathn.rb b/lib/mathn.rb
index a5a121c6c6..2257a4074a 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -43,7 +43,6 @@ class Integer
end
def prime_division
- raise ZeroDivisionError if self == 0
ps = Prime.new
value = self
pv = []
@@ -125,7 +124,6 @@ class Rational
def ** (other)
if other.kind_of?(Rational)
- other2 = other
if self < 0
return Complex.new!(self, 0) ** other
elsif other == 0
@@ -146,7 +144,7 @@ class Rational
for elm in npd
elm[1] = elm[1] * other
if !elm[1].kind_of?(Integer) and elm[1].denominator != 1
- return Float(self) ** other2
+ return Float(self) ** other
end
elm[1] = elm[1].to_i
end
@@ -154,7 +152,7 @@ class Rational
for elm in dpd
elm[1] = elm[1] * other
if !elm[1].kind_of?(Integer) and elm[1].denominator != 1
- return Float(self) ** other2
+ return Float(self) ** other
end
elm[1] = elm[1].to_i
end
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 43ba202bed..494838e63b 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -8,13 +8,8 @@ require 'shellwords'
CONFIG = Config::MAKEFILE_CONFIG
ORIG_LIBPATH = ENV['LIB']
-CXX_EXT = %w[cc cxx cpp]
-if /mswin|bccwin|mingw|msdosdjgpp|human|os2/ !~ CONFIG['build_os']
- CXX_EXT.concat(%w[C])
-end
-SRC_EXT = %w[c m] << CXX_EXT
+SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"]
$static = $config_h = nil
-$default_static = $static
unless defined? $configure_args
$configure_args = {}
@@ -45,6 +40,7 @@ unless defined? $configure_args
end
end
+$srcdir = CONFIG["srcdir"]
$libdir = CONFIG["libdir"]
$rubylibdir = CONFIG["rubylibdir"]
$archdir = CONFIG["archdir"]
@@ -59,9 +55,6 @@ $cygwin = /cygwin/ =~ RUBY_PLATFORM
$human = /human/ =~ RUBY_PLATFORM
$netbsd = /netbsd/ =~ RUBY_PLATFORM
$os2 = /os2/ =~ RUBY_PLATFORM
-$beos = /beos/ =~ RUBY_PLATFORM
-$solaris = /solaris/ =~ RUBY_PLATFORM
-$dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/)
def config_string(key, config = CONFIG)
s = config[key] and !s.empty? and block_given? ? yield(s) : s
@@ -80,45 +73,18 @@ INSTALL_DIRS = [
[dir_re('sitearchdir'), "$(RUBYARCHDIR)"]
]
-def install_dirs(target_prefix = nil)
- if $extout
- dirs = [
- ['RUBYCOMMONDIR', '$(extout)'],
- ['RUBYLIBDIR', '$(extout)$(target_prefix)'],
- ['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
- ['extout', "#$extout"],
- ['extout_prefix', "#$extout_prefix"],
- ]
- elsif $extmk
- dirs = [
- ['RUBYCOMMONDIR', '$(rubylibdir)'],
- ['RUBYLIBDIR', '$(rubylibdir)$(target_prefix)'],
- ['RUBYARCHDIR', '$(archdir)$(target_prefix)'],
- ]
- else
- dirs = [
- ['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
- ['RUBYLIBDIR', '$(sitelibdir)$(target_prefix)'],
- ['RUBYARCHDIR', '$(sitearchdir)$(target_prefix)'],
- ]
- end
- dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
- dirs
-end
-
def map_dir(dir, map = nil)
map ||= INSTALL_DIRS
map.inject(dir) {|dir, (orig, new)| dir.gsub(orig, new)}
end
-topdir = File.dirname(libdir = File.dirname(__FILE__))
-extdir = File.expand_path("ext", topdir)
-$extmk = File.expand_path($0)[0, extdir.size+1] == extdir+"/"
-if not $extmk and File.exist?(Config::CONFIG["archdir"] + "/ruby.h")
+libdir = File.dirname(__FILE__)
+$extmk = libdir != Config::CONFIG["rubylibdir"]
+if not $extmk and File.exist? Config::CONFIG["archdir"] + "/ruby.h"
$hdrdir = $topdir = Config::CONFIG["archdir"]
-elsif File.exist?(($top_srcdir ||= topdir) + "/ruby.h") and
- File.exist?(($topdir ||= Config::CONFIG["topdir"]) + "/config.h")
- $hdrdir = $top_srcdir
+elsif File.exist? $srcdir + "/ruby.h"
+ $topdir = Config::CONFIG["compile_dir"]
+ $hdrdir = $srcdir
else
abort "can't find header files for ruby."
end
@@ -170,7 +136,6 @@ module Logging
@logfile = 'mkmf.log'
@orgerr = $stderr.dup
@orgout = $stdout.dup
- @postpone = 0
def self::open
@log ||= File::open(@logfile, 'w')
@@ -199,7 +164,7 @@ module Logging
end
def self::postpone
- tmplog = "mkmftmp#{@postpone += 1}.log"
+ tmplog = "mkmftmp.log"
open do
log, *save = @log, @logfile, @orgout, @orgerr
@log, @logfile, @orgout, @orgerr = nil, tmplog, log, log
@@ -209,7 +174,6 @@ module Logging
File::open(tmplog) {|t| FileUtils.copy_stream(t, log)}
ensure
@log, @logfile, @orgout, @orgerr = log, *save
- @postpone -= 1
rm_f tmplog
end
end
@@ -217,6 +181,7 @@ module Logging
end
def xsystem command
+ Config.expand(command)
Logging::open do
puts command.quote
system(command)
@@ -224,6 +189,7 @@ def xsystem command
end
def xpopen command, *mode, &block
+ Config.expand(command)
Logging::open do
case mode[0]
when nil, /^r/
@@ -236,22 +202,17 @@ def xpopen command, *mode, &block
end
def log_src(src)
- src = src.split(/^/)
- fmt = "%#{src.size.to_s.size}d: %s"
- Logging::message <<"EOM"
+ Logging::message <<"EOM", src
checked program was:
/* begin */
-EOM
- src.each_with_index {|line, no| Logging::message fmt, no+1, line}
- Logging::message <<"EOM"
-/* end */
+%s/* end */
EOM
end
def create_tmpsrc(src)
src = yield(src) if block_given?
- src = src.gsub(/[ \t]+$/, '').gsub(/\A\n+|^\n+$/, '').sub(/[^\n]\z/, "\\&\n")
+ src = src.sub(/[^\n]\z/, "\\&\n")
open(CONFTEST_C, "wb") do |cfile|
cfile.print src
end
@@ -267,31 +228,31 @@ end
def link_command(ldflags, opt="", libpath=$LIBPATH)
Config::expand(TRY_LINK.dup,
- CONFIG.merge('hdrdir' => $hdrdir.quote,
- 'src' => CONFTEST_C,
- 'INCFLAGS' => $INCFLAGS,
- 'CPPFLAGS' => $CPPFLAGS,
- 'CFLAGS' => "#$CFLAGS",
- 'ARCH_FLAG' => "#$ARCH_FLAG",
- 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
- 'LIBPATH' => libpathflag(libpath),
- 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
- 'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS"))
+ 'hdrdir' => $hdrdir,
+ 'src' => CONFTEST_C,
+ 'INCFLAGS' => $INCFLAGS,
+ 'CPPFLAGS' => $CPPFLAGS,
+ 'CFLAGS' => "#$CFLAGS",
+ 'ARCH_FLAG' => "#$ARCH_FLAG",
+ 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
+ 'LIBPATH' => libpathflag(libpath),
+ 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
+ 'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
end
def cc_command(opt="")
- Config::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
- CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote))
+ "$(CC) -c #$INCFLAGS -I#{$hdrdir} " \
+ "#$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} #{CONFTEST_C}"
end
def cpp_command(outfile, opt="")
- Config::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
- CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote))
+ "$(CPP) #$INCFLAGS -I#{$hdrdir} " \
+ "#$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}"
end
def libpathflag(libpath=$LIBPATH)
libpath.map{|x|
- (x == "$(topdir)" ? LIBPATHFLAG : LIBPATHFLAG+RPATHFLAG) % x.quote
+ (x == "$(topdir)" ? LIBPATHFLAG : LIBPATHFLAG+RPATHFLAG) % x
}.join
end
@@ -326,78 +287,54 @@ def cpp_include(header)
end
end
-def with_cppflags(flags)
- cppflags = $CPPFLAGS
- $CPPFLAGS = flags
- ret = yield
-ensure
- $CPPFLAGS = cppflags unless ret
-end
-
-def with_cflags(flags)
- cflags = $CFLAGS
- $CFLAGS = flags
- ret = yield
-ensure
- $CFLAGS = cflags unless ret
-end
-
-def with_ldflags(flags)
- ldflags = $LDFLAGS
- $LDFLAGS = flags
- ret = yield
-ensure
- $LDFLAGS = ldflags unless ret
-end
-
def try_static_assert(expr, headers = nil, opt = "", &b)
headers = cpp_include(headers)
try_compile(<<SRC, opt, &b)
#{COMMON_HEADERS}
#{headers}
/*top*/
-int conftest_const[(#{expr}) ? 1 : -1];
+int tmp[(#{expr}) ? 1 : -1];
SRC
end
def try_constant(const, headers = nil, opt = "", &b)
- includes = cpp_include(headers)
+ headers = cpp_include(headers)
if CROSS_COMPILING
- if try_static_assert("#{const} > 0", headers, opt)
- # positive constant
- elsif try_static_assert("#{const} < 0", headers, opt)
+ unless try_compile(<<"SRC", opt, &b)
+#{COMMON_HEADERS}
+#{headers}
+/*top*/
+int tmp = #{const};
+SRC
+ return nil
+ end
+ if try_static_assert("#{const} < 0", headers, opt)
neg = true
const = "-(#{const})"
elsif try_static_assert("#{const} == 0", headers, opt)
return 0
- else
- # not a constant
- return nil
end
upper = 1
- lower = 0
- until try_static_assert("#{const} <= #{upper}", headers, opt)
+ until try_static_assert("#{const} < #{upper}", headers, opt)
lower = upper
upper <<= 1
end
return nil unless lower
- while upper > lower + 1
- mid = (upper + lower) / 2
- if try_static_assert("#{const} > #{mid}", headers, opt)
- lower = mid
+ until try_static_assert("#{const} == #{upper}", headers, opt)
+ if try_static_assert("#{const} > #{(upper+lower)/2}", headers, opt)
+ lower = (upper+lower)/2
else
- upper = mid
+ upper = (upper+lower)/2
end
end
upper = -upper if neg
return upper
else
src = %{#{COMMON_HEADERS}
-#{includes}
+#{headers}
#include <stdio.h>
/*top*/
-int conftest_const = (int)(#{const});
-int main() {printf("%d\\n", conftest_const); return 0;}
+int main() {printf("%d\\n", (int)(#{const})); return 0;}
}
if try_link0(src, opt, &b)
xpopen("./conftest") do |f|
@@ -424,17 +361,6 @@ int t() { void ((*volatile p)()); p = (void ((*)()))#{func}; return 0; }
SRC
end
-def try_var(var, headers = nil, &b)
- headers = cpp_include(headers)
- try_compile(<<"SRC", &b)
-#{COMMON_HEADERS}
-#{headers}
-/*top*/
-int main() { return 0; }
-int t() { const volatile void *volatile p; p = (void *)&#{var}; return 0; }
-SRC
-end
-
def egrep_cpp(pat, src, opt = "", &b)
src = create_tmpsrc(src, &b)
xpopen(cpp_command('', opt)) do |f|
@@ -463,11 +389,10 @@ end
def macro_defined?(macro, src, opt = "", &b)
src = src.sub(/[^\n]\z/, "\\&\n")
- try_compile(src + <<"SRC", opt, &b)
+ try_cpp(src + <<"SRC", opt, &b)
/*top*/
#ifndef #{macro}
# error
->>>>>> #{macro} undefined <<<<<<
#endif
SRC
end
@@ -491,7 +416,7 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
ifiles.each do |files, dir, prefix|
dir = map_dir(dir, map)
prefix = %r|\A#{Regexp.quote(prefix)}/?| if prefix
- if /\A\.\// =~ files
+ if( files[0,2] == "./" )
# install files which are in current working directory.
files = files[2..-1]
len = nil
@@ -534,14 +459,14 @@ def message(*s)
end
end
-def checking_for(m, fmt = nil)
+def checking_for(m)
f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim
- m = "checking #{'for ' if /\Acheck/ !~ f}#{m}... "
+ m = "checking for #{m}... "
message "%s", m
a = r = nil
Logging::postpone do
r = yield
- a = (fmt ? fmt % r : r ? "yes" : "no") << "\n"
+ a = r ? "yes\n" : "no\n"
"#{f}#{m}-------------------- #{a}\n"
end
message(a)
@@ -549,31 +474,7 @@ def checking_for(m, fmt = nil)
r
end
-# Returns whether or not +macro+ is defined either in the common header
-# files or within any +headers+ you provide.
-#
-# Any options you pass to +opt+ are passed along to the compiler.
-#
-def have_macro(macro, headers = nil, opt = "", &b)
- m = "#{macro}"
- m << " in #{headers.inspect}" if headers
- checking_for m do
- macro_defined?(macro, cpp_include(headers), opt, &b)
- end
-end
-
-# Returns whether or not the given entry point +func+ can be found within
-# +lib+. If +func+ is nil, the 'main()' entry point is used by default.
-# If found, it adds the library to list of libraries to be used when linking
-# your extension.
-#
-# If +headers+ are provided, it will include those header files as the
-# header files it looks in when searching for +func+.
-#
-# Real name of the library to be linked can be altered by
-# '--with-FOOlib' configuration option.
-#
-def have_library(lib, func = nil, headers = nil, &b)
+def have_library(lib, func = nil, header=nil, &b)
func = "main" if !func or func.empty?
lib = with_config(lib+'lib', lib)
checking_for "#{func}() in #{LIBARG%lib}" do
@@ -581,7 +482,7 @@ def have_library(lib, func = nil, headers = nil, &b)
true
else
libs = append_library($libs, lib)
- if try_func(func, libs, headers, &b)
+ if try_func(func, libs, header, &b)
$libs = libs
true
else
@@ -591,17 +492,9 @@ def have_library(lib, func = nil, headers = nil, &b)
end
end
-# Returns whether or not the entry point +func+ can be found within the library
-# +lib+ in one of the +paths+ specified, where +paths+ is an array of strings.
-# If +func+ is nil , then the main() function is used as the entry point.
-#
-# If +lib+ is found, then the path it was found on is added to the list of
-# library paths searched and linked against.
-#
def find_library(lib, func, *paths, &b)
func = "main" if !func or func.empty?
lib = with_config(lib+'lib', lib)
- paths = paths.collect {|path| path.split(File::PATH_SEPARATOR)}.flatten
checking_for "#{func}() in #{LIBARG%lib}" do
libpath = $LIBPATH
libs = append_library($libs, lib)
@@ -620,14 +513,6 @@ def find_library(lib, func, *paths, &b)
end
end
-# Returns whether or not the function +func+ can be found in the common
-# header files, or within any +headers+ that you provide. If found, a
-# macro is passed as a preprocessor constant to the compiler using the
-# function name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_func('foo') returned true, then the HAVE_FOO
-# preprocessor macro would be passed to the compiler.
-#
def have_func(func, headers = nil, &b)
checking_for "#{func}()" do
if try_func(func, $libs, headers, &b)
@@ -639,32 +524,6 @@ def have_func(func, headers = nil, &b)
end
end
-# Returns whether or not the variable +var+ can be found in the common
-# header files, or within any +headers+ that you provide. If found, a
-# macro is passed as a preprocessor constant to the compiler using the
-# variable name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_var('foo') returned true, then the HAVE_FOO
-# preprocessor macro would be passed to the compiler.
-#
-def have_var(var, headers = nil, &b)
- checking_for "#{var}" do
- if try_var(var, headers, &b)
- $defs.push(format("-DHAVE_%s", var.upcase))
- true
- else
- false
- end
- end
-end
-
-# Returns whether or not the given +header+ file can be found on your system.
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the header file name, in uppercase, prepended with 'HAVE_'.
-#
-# For example, if have_header('foo.h') returned true, then the HAVE_FOO_H
-# preprocessor macro would be passed to the compiler.
-#
def have_header(header, &b)
checking_for header do
if try_cpp(cpp_include(header), &b)
@@ -676,48 +535,11 @@ def have_header(header, &b)
end
end
-# Instructs mkmf to search for the given +header+ in any of the +paths+
-# provided, and returns whether or not it was found in those paths.
-#
-# If the header is found then the path it was found on is added to the list
-# of included directories that are sent to the compiler (via the -I switch).
-#
-def find_header(header, *paths)
- header = cpp_include(header)
- checking_for header do
- if try_cpp(header)
- true
- else
- found = false
- paths.each do |dir|
- opt = "-I#{dir}".quote
- if try_cpp(header, opt)
- $INCFLAGS << " " << opt
- found = true
- break
- end
- end
- found
- end
- end
-end
-
-# Returns whether or not the struct of type +type+ contains +member+. If
-# it does not, or the struct type can't be found, then false is returned. You
-# may optionally specify additional +headers+ in which to look for the struct
-# (in addition to the common header files).
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the member name, in uppercase, prepended with 'HAVE_ST_'.
-#
-# For example, if have_struct_member('foo', 'bar') returned true, then the
-# HAVE_ST_BAR preprocessor macro would be passed to the compiler.
-#
-def have_struct_member(type, member, headers = nil, &b)
+def have_struct_member(type, member, header = nil, &b)
checking_for "#{type}.#{member}" do
if try_compile(<<"SRC", &b)
#{COMMON_HEADERS}
-#{cpp_include(headers)}
+#{cpp_include(header)}
/*top*/
int main() { return 0; }
int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
@@ -730,30 +552,17 @@ SRC
end
end
-# Returns whether or not the static type +type+ is defined. You may
-# optionally pass additional +headers+ to check against in addition to the
-# common header files.
-#
-# You may also pass additional flags to +opt+ which are then passed along to
-# the compiler.
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the type name, in uppercase, prepended with 'HAVE_TYPE_'.
-#
-# For example, if have_type('foo') returned true, then the HAVE_TYPE_FOO
-# preprocessor macro would be passed to the compiler.
-#
-def have_type(type, headers = nil, opt = "", &b)
+def have_type(type, header = nil, opt = "", &b)
checking_for type do
- headers = cpp_include(headers)
+ header = cpp_include(header)
if try_compile(<<"SRC", opt, &b) or (/\A\w+\z/n =~ type && try_compile(<<"SRC", opt, &b))
#{COMMON_HEADERS}
-#{headers}
+#{header}
/*top*/
static #{type} t;
SRC
#{COMMON_HEADERS}
-#{headers}
+#{header}
/*top*/
static #{type} *t;
SRC
@@ -765,97 +574,22 @@ SRC
end
end
-# Returns the size of the given +type+. You may optionally specify additional
-# +headers+ to search in for the +type+.
-#
-# If found, a macro is passed as a preprocessor constant to the compiler using
-# the type name, in uppercase, prepended with 'SIZEOF_', followed by the type
-# name, followed by '=X' where 'X' is the actual size.
-#
-# For example, if check_sizeof('mystruct') returned 12, then the
-# SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler.
-#
-def check_sizeof(type, headers = nil, &b)
+def check_sizeof(type, header = nil, &b)
expr = "sizeof(#{type})"
- fmt = "%d"
- def fmt.%(x)
- x ? super : "failed"
- end
- checking_for("size of #{type}", fmt) do
- if size = try_constant(expr, headers, &b)
- $defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size))
- size
- end
- end
-end
-
-def scalar_ptr_type?(type, member = nil, headers = nil, &b)
- try_compile(<<"SRC", &b) # pointer
-#{COMMON_HEADERS}
-#{cpp_include(headers)}
-/*top*/
-volatile #{type} conftestval;
-int main() { return 0; }
-int t() {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
-SRC
-end
-
-def scalar_type?(type, member = nil, headers = nil, &b)
- try_compile(<<"SRC", &b) # pointer
-#{COMMON_HEADERS}
-#{cpp_include(headers)}
-/*top*/
-volatile #{type} conftestval;
-int main() { return 0; }
-int t() {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
-SRC
-end
-
-def what_type?(type, member = nil, headers = nil, &b)
- m = "#{type}"
- name = type
- if member
- m << "." << member
- name = "(((#{type} *)0)->#{member})"
- end
- m << " in #{headers.inspect}" if headers
- fmt = "seems %s"
- def fmt.%(x)
- x ? super : "unknown"
- end
- checking_for m, fmt do
- if scalar_ptr_type?(type, member, headers, &b)
- if try_static_assert("sizeof(*#{name}) == 1", headers)
- "string"
- end
- elsif scalar_type?(type, member, headers, &b)
- if try_static_assert("sizeof(#{name}) > sizeof(long)", headers)
- "long long"
- elsif try_static_assert("sizeof(#{name}) > sizeof(int)", headers)
- "long"
- elsif try_static_assert("sizeof(#{name}) > sizeof(short)", headers)
- "int"
- elsif try_static_assert("sizeof(#{name}) > 1", headers)
- "short"
- else
- "char"
- end
- end
+ m = "checking size of #{type}... "
+ message "%s", m
+ Logging::message "check_sizeof: %s--------------------\n", m
+ if size = try_constant(expr, header, &b)
+ $defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size))
end
+ message(a = size ? "#{size}\n" : "failed\n")
+ Logging::message "-------------------- %s\n", a
+ size
end
def find_executable0(bin, path = nil)
+ path = (path || ENV['PATH']).split(File::PATH_SEPARATOR)
ext = config_string('EXEEXT')
- if File.expand_path(bin) == bin
- return bin if File.executable?(bin)
- return file if ext and File.executable?(file = bin + ext)
- return nil
- end
- if path ||= ENV['PATH']
- path = path.split(File::PATH_SEPARATOR)
- else
- path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
- end
file = nil
path.each do |dir|
return file if File.executable?(file = File.join(dir, bin))
@@ -870,90 +604,57 @@ def find_executable(bin, path = nil)
end
end
-def arg_config(config, *defaults, &block)
- $arg_config << [config, *defaults]
- defaults << nil if !block and defaults.empty?
- $configure_args.fetch(config.tr('_', '-'), *defaults, &block)
+def arg_config(config, default=nil)
+ $configure_args.fetch(config.tr('_', '-'), default)
end
-def with_config(config, *defaults)
- config = config.sub(/^--with[-_]/, '')
- val = arg_config("--with-"+config) do
- if arg_config("--without-"+config)
- false
- elsif block_given?
- yield(config, *defaults)
- else
- break *defaults
- end
- end
- case val
- when "yes"
- true
- when "no"
- false
- else
- val
+def with_config(config, default=nil)
+ unless /^--with[-_]/ =~ config
+ config = '--with-' + config
end
+ arg_config(config, default)
end
-def enable_config(config, *defaults)
+def enable_config(config, default=nil)
if arg_config("--enable-"+config)
true
elsif arg_config("--disable-"+config)
false
- elsif block_given?
- yield(config, *defaults)
else
- return *defaults
+ default
end
end
def create_header(header = "extconf.h")
message "creating %s\n", header
- sym = header.tr("a-z./\055", "A-Z___")
- hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
- for line in $defs
- case line
- when /^-D([^=]+)(?:=(.*))?/
- hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0] : 1}\n"
- when /^-U(.*)/
- hdr << "#undef #$1\n"
- end
- end
- hdr << "#endif\n"
- hdr = hdr.join
- unless (IO.read(header) == hdr rescue false)
+ if $defs.length > 0
+ sym = header.tr("a-z./\055", "A-Z___")
open(header, "w") do |hfile|
- hfile.write(hdr)
+ hfile.print "#ifndef #{sym}\n#define #{sym}\n"
+ for line in $defs
+ case line
+ when /^-D([^=]+)(?:=(.*))?/
+ hfile.print "#define #$1 #{$2 || 1}\n"
+ when /^-U(.*)/
+ hfile.print "#undef #$1\n"
+ end
+ end
+ hfile.print "#endif\n"
end
end
- $extconf_h = header
end
-# Sets a +target+ name that the user can then use to configure various 'with'
-# options with on the command line by using that name. For example, if the
-# target is set to "foo", then the user could use the --with-foo-dir command
-# line option.
-#
-# You may pass along additional 'include' or 'lib' defaults via the +idefault+
-# and +ldefault+ parameters, respectively.
-#
-# Note that dir_config only adds to the list of places to search for libraries
-# and include files. It does not link the libraries into your application.
-#
def dir_config(target, idefault=nil, ldefault=nil)
if dir = with_config(target + "-dir", (idefault unless ldefault))
- defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)
+ defaults = dir.split(File::PATH_SEPARATOR)
idefault = ldefault = nil
end
idir = with_config(target + "-include", idefault)
- $arg_config.last[1] ||= "${#{target}-dir}/include"
ldir = with_config(target + "-lib", ldefault)
- $arg_config.last[1] ||= "${#{target}-dir}/lib"
- idirs = idir ? Array === idir ? idir : idir.split(File::PATH_SEPARATOR) : []
+# idirs = idir ? idir.split(File::PATH_SEPARATOR) : []
+ idirs = idir.split(File::PATH_SEPARATOR) rescue []
if defaults
idirs.concat(defaults.collect {|dir| dir + "/include"})
idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
@@ -966,7 +667,7 @@ def dir_config(target, idefault=nil, ldefault=nil)
end
end
- ldirs = ldir ? Array === ldir ? ldir : ldir.split(File::PATH_SEPARATOR) : []
+ ldirs = ldir ? ldir.split(File::PATH_SEPARATOR) : []
if defaults
ldirs.concat(defaults.collect {|dir| dir + "/lib"})
ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR)
@@ -977,23 +678,16 @@ def dir_config(target, idefault=nil, ldefault=nil)
end
def pkg_config(pkg)
- if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
- # iff package specific config command is given
- get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
- elsif ($PKGCONFIG ||=
- (pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
- find_executable0(pkgconfig) && pkgconfig) and
- system("#{$PKGCONFIG} --exists #{pkg}")
- # default to pkg-config command
- get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.chomp}
- elsif find_executable0(pkgconfig = "#{pkg}-config")
- # default to package specific config command, as a last resort.
- get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
+ unless defined?($PKGCONFIG)
+ if pkgconfig = with_config("pkg-config", !CROSS_COMPILING && "pkg-config")
+ find_executable0(pkgconfig) or pkgconfig = nil
+ end
+ $PKGCONFIG = pkgconfig
end
- if get
- cflags = get['cflags']
- ldflags = get['libs']
- libs = get['libs-only-l']
+ if $PKGCONFIG and system("#{$PKGCONFIG} --exists #{pkg}")
+ cflags = `#{$PKGCONFIG} --cflags #{pkg}`.chomp
+ ldflags = `#{$PKGCONFIG} --libs #{pkg}`.chomp
+ libs = `#{$PKGCONFIG} --libs-only-l #{pkg}`.chomp
ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
$CFLAGS += " " << cflags
$LDFLAGS += " " << ldflags
@@ -1002,15 +696,11 @@ def pkg_config(pkg)
Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
cflags, ldflags, libs
[cflags, ldflags, libs]
- else
- Logging::message "package configuration for %s is not found\n", pkg
- nil
end
end
def with_destdir(dir)
- dir = dir.sub($dest_prefix_pattern, '')
- /\A\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
+ /^\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
end
def winsep(s)
@@ -1019,46 +709,29 @@ end
def configuration(srcdir)
mk = []
- vpath = %w[$(srcdir) $(topdir) $(hdrdir)]
- if !CROSS_COMPILING
- case CONFIG['build_os']
- when 'cygwin'
- if CONFIG['target_os'] != 'cygwin'
- vpath.each {|p| p.sub!(/.*/, '$(shell cygpath -u \&)')}
- end
- when 'msdosdjgpp', 'mingw32'
- CONFIG['PATH_SEPARATOR'] = ';'
- end
- end
mk << %{
SHELL = /bin/sh
#### Start of system configuration section. ####
-srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {CONFIG[$1||$2]}.quote}
-topdir = #{($extmk ? CONFIG["topdir"] : $topdir).quote}
-hdrdir = #{$extmk ? CONFIG["hdrdir"].quote : '$(topdir)'}
-VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
+srcdir = #{srcdir}
+topdir = #{$topdir}
+hdrdir = #{$extmk ? $hdrdir : '$(topdir)'}
+VPATH = #{$mingw && CONFIG['build_os'] == 'cygwin' ? '$(shell cygpath -u $(srcdir))' : '$(srcdir)'}
}
- if destdir = CONFIG["prefix"][$dest_prefix_pattern, 1]
+ drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/
+ if destdir = CONFIG["prefix"].scan(drive)[0] and !destdir.empty?
mk << "\nDESTDIR = #{destdir}\n"
end
CONFIG.each do |key, var|
next unless /prefix$/ =~ key
- mk << "#{key} = #{with_destdir(var)}\n"
+ mk << "#{key} = #{with_destdir(var.sub(drive, ''))}\n"
end
CONFIG.each do |key, var|
next if /^abs_/ =~ key
- next unless /^(?:src|top|hdr|(.*))dir$/ =~ key and $1
- mk << "#{key} = #{with_destdir(var)}\n"
- end
- if !$extmk and !$configure_args.has_key?('--ruby') and
- sep = config_string('BUILD_FILE_SEPARATOR')
- sep = ":/=#{sep}"
- else
- sep = ""
+ next unless /^(?:src|top|(.*))dir$/ =~ key and $1
+ mk << "#{key} = #{with_destdir(var.sub(drive, ''))}\n"
end
- extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ")<<" "
mk << %{
CC = #{CONFIG['CC']}
LIBRUBY = #{CONFIG['LIBRUBY']}
@@ -1066,10 +739,8 @@ LIBRUBY_A = #{CONFIG['LIBRUBY_A']}
LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED
LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC
-RUBY_EXTCONF_H = #{$extconf_h}
CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS #$ARCH_FLAG
-INCFLAGS = -I. #$INCFLAGS
-CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
+CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{$CPPFLAGS}
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
DLDFLAGS = #$LDFLAGS #$DLDFLAGS #$ARCH_FLAG
LDSHARED = #{CONFIG['LDSHARED']}
@@ -1082,17 +753,14 @@ arch = #{CONFIG['arch']}
sitearch = #{CONFIG['sitearch']}
ruby_version = #{Config::CONFIG['ruby_version']}
ruby = #{$ruby}
-RUBY = $(ruby#{sep})
-RM = #{config_string('RM') || '$(RUBY) -run -e rm -- -f'}
-MAKEDIRS = #{config_string('MAKEDIRS') || '@$(RUBY) -run -e mkdir -- -p'}
-INSTALL = #{config_string('INSTALL') || '@$(RUBY) -run -e install -- -vp'}
-INSTALL_PROG = #{config_string('INSTALL_PROG') || '$(INSTALL) -m 0755'}
-INSTALL_DATA = #{config_string('INSTALL_DATA') || '$(INSTALL) -m 0644'}
-COPY = #{config_string('CP') || '@$(RUBY) -run -e cp -- -v'}
+RUBY = #{($nmake && !$extmk && !$configure_args.has_key?('--ruby')) ? '$(ruby:/=\)' : '$(ruby)'}
+RM = $(RUBY) -run -e rm -- -f
+MAKEDIRS = $(RUBY) -run -e mkdir -- -p
+INSTALL_PROG = $(RUBY) -run -e install -- -vpm 0755
+INSTALL_DATA = $(RUBY) -run -e install -- -vpm 0644
#### End of system configuration section. ####
-preload = #{$preload.join(" ") if $preload}
}
if $nmake == ?b
mk.each do |x|
@@ -1107,32 +775,9 @@ preload = #{$preload.join(" ") if $preload}
end
def dummy_makefile(srcdir)
- configuration(srcdir) << <<RULES << CLEANINGS
-CLEANFILES = #{$cleanfiles.join(' ')}
-DISTCLEANFILES = #{$distcleanfiles.join(' ')}
-
-all install static install-so install-rb: Makefile
-
-RULES
+ configuration(srcdir) << "all install: Makefile\n" << CLEANINGS
end
-# Generates the Makefile for your extension, passing along any options and
-# preprocessor constants that you may have generated through other methods.
-#
-# The +target+ name should correspond the name of the global function name
-# defined within your C extension, minus the 'Init_'. For example, if your
-# C extension is defined as 'Init_foo', then your target would simply be 'foo'.
-#
-# If any '/' characters are present in the target name, only the last name
-# is interpreted as the target name, and the rest are considered toplevel
-# directory names, and the generated Makefile will be altered accordingly to
-# follow that directory structure.
-#
-# For example, if you pass 'test/foo' as a target name, your extension will
-# be installed under the 'test' directory. This means that in order to
-# load the file within a Ruby program later, that directory structure will
-# have to be followed, e.g. "require 'test/foo'".
-#
def create_makefile(target, srcprefix = nil)
$target = target
libpath = $LIBPATH
@@ -1155,18 +800,15 @@ def create_makefile(target, srcprefix = nil)
srcprefix ||= '$(srcdir)'
Config::expand(srcdir = srcprefix.dup)
- if not $objs
+ unless $objs then
$objs = []
- srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
- for f in srcs
- obj = File.basename(f, ".*") << ".o"
- $objs.push(obj) unless $objs.index(obj)
+ for f in Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
+ $objs.push(File.basename(f, ".*") << "." << $OBJEXT)
+ end
+ else
+ for i in $objs
+ i.sub!(/\.o\z/, ".#{$OBJEXT}")
end
- elsif !(srcs = $srcs)
- srcs = $objs.collect {|obj| obj.sub(/\.o\z/, '.c')}
- end
- for i in $objs
- i.sub!(/\.o\z/, ".#{$OBJEXT}")
end
$objs = $objs.join(" ")
@@ -1193,107 +835,80 @@ def create_makefile(target, srcprefix = nil)
dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
staticlib = target ? "$(TARGET).#$LIBEXT" : ""
mfile = open("Makefile", "wb")
- mfile.print configuration(srcprefix)
+ mfile.print configuration(srcdir)
mfile.print %{
-libpath = #{$LIBPATH.join(" ")}
LIBPATH = #{libpath}
DEFFILE = #{deffile}
CLEANFILES = #{$cleanfiles.join(' ')}
DISTCLEANFILES = #{$distcleanfiles.join(' ')}
-extout = #{$extout}
-extout_prefix = #{$extout_prefix}
target_prefix = #{target_prefix}
LOCAL_LIBS = #{$LOCAL_LIBS}
LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
-SRCS = #{srcs.collect(&File.method(:basename)).join(' ')}
OBJS = #{$objs}
TARGET = #{target}
DLLIB = #{dllib}
-EXTSTATIC = #{$static || ""}
-STATIC_LIB = #{staticlib unless $static.nil?}
-
+STATIC_LIB = #{staticlib}
}
- install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
- n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET).'
+ if $extmk
+ mfile.print %{
+RUBYCOMMONDIR = $(rubylibdir)
+RUBYLIBDIR = $(rubylibdir)$(target_prefix)
+RUBYARCHDIR = $(archdir)$(target_prefix)
+}
+ else
+ mfile.print %{
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+}
+ end
mfile.print %{
-TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
-CLEANLIBS = #{n}#{CONFIG['DLEXT']} #{n}il? #{n}tds #{n}map
-CLEANOBJS = *.#{$OBJEXT} *.#{$LIBEXT} *.s[ol] *.pdb *.exp *.bak
+CLEANLIBS = "$(TARGET).{lib,exp,il?,tds,map}" $(DLLIB)
+CLEANOBJS = "*.{#{$OBJEXT},#{$LIBEXT},s[ol],pdb,bak}"
-all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
-static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
+all: #{target ? "$(DLLIB)" : "Makefile"}
+static: $(STATIC_LIB)
}
mfile.print CLEANINGS
dirs = []
- mfile.print "install: install-so install-rb\n\n"
- sodir = (dir = "$(RUBYARCHDIR)").dup
- mfile.print("install-so: #{dir}\n")
- if target
+ if not $static and target
+ dirs << (dir = "$(RUBYARCHDIR)")
+ mfile.print("install: #{dir}\n")
f = "$(DLLIB)"
dest = "#{dir}/#{f}"
- mfile.print "install-so: #{dest}\n"
- unless $extout
- mfile.print "#{dest}: #{f}\n"
- if (sep = config_string('BUILD_FILE_SEPARATOR'))
- f.gsub!("/", sep)
- dir.gsub!("/", sep)
- sep = ":/="+sep
- f.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
- f.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
- dir.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
- dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
- end
- mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n"
- end
+ mfile.print "install: #{dest}\n"
+ mfile.print "#{dest}: #{f} #{dir}\n\t@$(INSTALL_PROG) #{f} #{dir}\n"
end
- mfile.print("install-rb: pre-install-rb install-rb-default\n")
- mfile.print("install-rb-default: pre-install-rb-default\n")
- mfile.print("pre-install-rb: Makefile\n")
- mfile.print("pre-install-rb-default: Makefile\n")
- for sfx, i in [["-default", [["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]]], ["", $INSTALLFILES]]
+ for i in [[["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]], $INSTALLFILES]
files = install_files(mfile, i, nil, srcprefix) or next
for dir, *files in files
unless dirs.include?(dir)
dirs << dir
- mfile.print "pre-install-rb#{sfx}: #{dir}\n"
+ mfile.print("install: #{dir}\n")
end
files.each do |f|
dest = "#{dir}/#{File.basename(f)}"
- mfile.print("install-rb#{sfx}: #{dest}\n")
- mfile.print("#{dest}: #{f}\n\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ")
- sep = config_string('BUILD_FILE_SEPARATOR')
- if sep
- f = f.gsub("/", sep)
- sep = ":/="+sep
- f = f.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
- f = f.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
- else
- sep = ""
- end
- mfile.print("#{f} $(@D#{sep})\n")
+ mfile.print("install: #{dest}\n")
+ mfile.print("#{dest}: #{f} #{dir}\n\t@$(INSTALL_DATA) #{f} #{dir}\n")
end
end
end
- dirs.unshift(sodir) if target and !dirs.include?(sodir)
- dirs.each {|dir| mfile.print "#{dir}:\n\t$(MAKEDIRS) $@\n"}
-
- mfile.print <<-SITEINSTALL
-
-site-install: site-install-so site-install-rb
-site-install-so: install-so
-site-install-rb: install-rb
+ if dirs.empty?
+ mfile.print("install:\n")
+ else
+ dirs.each {|dir| mfile.print "#{dir}:\n\t@$(MAKEDIRS) #{dir}\n"}
+ end
- SITEINSTALL
+ mfile.print "\nsite-install: install\n\n"
return unless target
- mfile.puts SRC_EXT.collect {|ext| ".path.#{ext} = $(VPATH)"} if $nmake == ?b
mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
mfile.print "\n"
- CXX_EXT.each do |ext|
+ %w[cc cpp cxx C].each do |ext|
COMPILE_RULES.each do |rule|
mfile.printf(rule, ext, $OBJEXT)
mfile.printf("\n\t%s\n\n", COMPILE_CXX)
@@ -1306,18 +921,18 @@ site-install-rb: install-rb
end
end
- mfile.print "$(RUBYARCHDIR)/" if $extout
- mfile.print "$(DLLIB): ", (makedef ? "$(DEFFILE) " : ""), "$(OBJS)\n"
- mfile.print "\t@-$(RM) $@\n"
- mfile.print "\t@-$(MAKEDIRS) $(@D)\n" if $extout
- link_so = LINK_SO.gsub(/^/, "\t")
- mfile.print link_so, "\n\n"
- unless $static.nil?
- mfile.print "$(STATIC_LIB): $(OBJS)\n\t"
- mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)"
- config_string('RANLIB') do |ranlib|
- mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true"
- end
+ if makedef
+ mfile.print "$(DLLIB): $(OBJS) $(DEFFILE)\n\t"
+ else
+ mfile.print "$(DLLIB): $(OBJS)\n\t"
+ end
+ mfile.print "@-$(RM) $@\n\t"
+ mfile.print "@-$(RM) $(TARGET).lib\n\t" if $mswin
+ mfile.print LINK_SO, "\n\n"
+ mfile.print "$(STATIC_LIB): $(OBJS)\n\t"
+ mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)"
+ if ranlib = config_string('RANLIB')
+ mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true"
end
mfile.print "\n\n"
if makedef
@@ -1327,81 +942,28 @@ site-install-rb: install-rb
depend = File.join(srcdir, "depend")
if File.exist?(depend)
- suffixes = []
- depout = []
open(depend, "r") do |dfile|
mfile.printf "###\n"
- cont = implicit = nil
- impconv = proc do
- COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
- implicit = nil
- end
- ruleconv = proc do |line|
- if implicit
- if /\A\t/ =~ line
- implicit[1] << line
- next
- else
- impconv[]
- end
- end
- if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
- suffixes << m[1] << m[2]
- implicit = [[m[1], m[2]], [m.post_match]]
- next
- elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
- line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
- end
- depout << line
- end
while line = dfile.gets()
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
+ line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1{$(srcdir)}\2') if $nmake
line.gsub!(/\$\(hdrdir\)\/config.h/, $config_h) if $config_h
- if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
- (cont ||= []) << line
- next
- elsif cont
- line = (cont << line).join
- cont = nil
- end
- ruleconv.call(line)
- end
- if cont
- ruleconv.call(cont.join)
- elsif implicit
- impconv.call
+ mfile.print line
end
end
- unless suffixes.empty?
- mfile.print ".SUFFIXES: .", suffixes.uniq.join(" ."), "\n\n"
- end
- mfile.print depout
- else
- headers = %w[ruby.h defines.h]
- if RULE_SUBST
- headers.each {|h| h.sub!(/.*/) {|*m| RULE_SUBST % m}}
- end
- headers << $config_h if $config_h
- headers << "$(RUBY_EXTCONF_H)" if $extconf_h
- mfile.print "$(OBJS): ", headers.join(' '), "\n"
end
-
- $makefile_created = true
ensure
mfile.close if mfile
end
def init_mkmf(config = CONFIG)
- $makefile_created = false
- $arg_config = []
$enable_shared = config['ENABLE_SHARED'] == 'yes'
$defs = []
- $extconf_h = nil
$CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
$ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG", config["ARCH_FLAG"])).dup
$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
$LDFLAGS = (with_config("ldflags") || "").dup
- $INCFLAGS = "-I$(topdir) -I$(hdrdir) -I$(srcdir)"
+ $INCFLAGS = "-I$(topdir)"
$DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
$LIBEXT = config['LIBEXT'].dup
$OBJEXT = config["OBJEXT"].dup
@@ -1413,7 +975,6 @@ def init_mkmf(config = CONFIG)
$INSTALLFILES = nil
$objs = nil
- $srcs = nil
$libs = ""
if $enable_shared or Config.expand(config["LIBRUBY"].dup) != Config.expand(config["LIBRUBY_A"].dup)
$LIBRUBYARG = config['LIBRUBYARG']
@@ -1421,31 +982,12 @@ def init_mkmf(config = CONFIG)
$LOCAL_LIBS = ""
- $cleanfiles = config_string('CLEANFILES') {|s| Shellwords.shellwords(s)} || []
- $distcleanfiles = config_string('DISTCLEANFILES') {|s| Shellwords.shellwords(s)} || []
+ $cleanfiles = []
+ $distcleanfiles = []
- $extout ||= nil
- $extout_prefix ||= nil
-
- $arg_config.clear
dir_config("opt")
end
-FailedMessage = <<MESSAGE
-Could not create Makefile due to some reason, probably lack of
-necessary libraries and/or headers. Check the mkmf.log file for more
-details. You may need configuration options.
-
-Provided configuration options:
-MESSAGE
-
-def mkmf_failed(path)
- unless $makefile_created or File.exist?("Makefile")
- opts = $arg_config.collect {|t, n| "\t#{t}#{"=#{n}" if n}\n"}
- abort "*** #{path} failed ***\n" + FailedMessage + opts.join
- end
-end
-
init_mkmf
$make = with_config("make-prog", ENV["MAKE"] || "make")
@@ -1461,15 +1003,8 @@ end
Config::CONFIG["srcdir"] = CONFIG["srcdir"] =
$srcdir = arg_config("--srcdir", File.dirname($0))
$configure_args["--topsrcdir"] ||= $srcdir
-if $curdir = arg_config("--curdir")
- Config.expand(curdir = $curdir.dup)
-else
- curdir = $curdir = "."
-end
-unless File.expand_path(Config::CONFIG["topdir"]) == File.expand_path(curdir)
- CONFIG["topdir"] = $curdir
- Config::CONFIG["topdir"] = curdir
-end
+Config::CONFIG["topdir"] = CONFIG["topdir"] =
+ $curdir = arg_config("--curdir", Dir.pwd)
$configure_args["--topdir"] ||= $curdir
$ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
@@ -1491,35 +1026,29 @@ COMMON_HEADERS = (hdr.join("\n") unless hdr.empty?)
COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
-RULE_SUBST = config_string('RULE_SUBST')
-COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<'
-COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<'
+COMPILE_C = config_string('COMPILE_C') || '$(CC) $(CFLAGS) $(CPPFLAGS) -c $<'
+COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<'
TRY_LINK = config_string('TRY_LINK') ||
- "$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
+ "$(CC) #{OUTFLAG}conftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) " \
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
LINK_SO = config_string('LINK_SO') ||
if CONFIG["DLEXT"] == $OBJEXT
- "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
+ "ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)\n"
else
- "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$@ " \
+ "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB) " \
"$(OBJS) $(LOCAL_LIBS) $(LIBS)"
end
LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'
RPATHFLAG = config_string('RPATHFLAG') || ''
LIBARG = config_string('LIBARG') || '-l%s'
-sep = config_string('BUILD_FILE_SEPARATOR') {|sep| ":/=#{sep}" if sep != "/"} || ""
CLEANINGS = "
clean:
- @-$(RM) $(CLEANLIBS#{sep}) $(CLEANOBJS#{sep}) $(CLEANFILES#{sep})
+ @$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
distclean: clean
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
+ @$(RM) Makefile extconf.h conftest.* mkmf.log
+ @$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
realclean: distclean
"
-
-if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
- END {mkmf_failed($0)}
-end
diff --git a/lib/monitor.rb b/lib/monitor.rb
index 4ed4e41222..a573af2bae 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -86,16 +86,12 @@ module MonitorMixin
class ConditionVariable
class Timeout < Exception; end
- # Create a new timer with the argument timeout, and add the
- # current thread to the list of waiters. Then the thread is
- # stopped. It will be resumed when a corresponding #signal
- # occurs.
def wait(timeout = nil)
- @monitor.instance_eval {mon_check_owner()}
+ @monitor.__send__(:mon_check_owner)
timer = create_timer(timeout)
Thread.critical = true
- count = @monitor.instance_eval {mon_exit_for_cond()}
+ count = @monitor.__send__(:mon_exit_for_cond)
@waiters.push(Thread.current)
begin
@@ -111,29 +107,25 @@ module MonitorMixin
if @waiters.include?(Thread.current) # interrupted?
@waiters.delete(Thread.current)
end
- @monitor.instance_eval {mon_enter_for_cond(count)}
+ @monitor.__send__(:mon_enter_for_cond, count)
Thread.critical = false
end
end
-
- # call #wait while the supplied block returns +true+.
def wait_while
while yield
wait
end
end
- # call #wait until the supplied block returns +true+.
def wait_until
until yield
wait
end
end
- # Wake up and run the next waiter
def signal
- @monitor.instance_eval {mon_check_owner()}
+ @monitor.__send__(:mon_check_owner)
Thread.critical = true
t = @waiters.shift
t.wakeup if t
@@ -141,9 +133,8 @@ module MonitorMixin
Thread.pass
end
- # Wake up all the waiters.
def broadcast
- @monitor.instance_eval {mon_check_owner()}
+ @monitor.__send__(:mon_check_owner)
Thread.critical = true
for t in @waiters
t.wakeup
@@ -181,7 +172,7 @@ module MonitorMixin
def self.extend_object(obj)
super(obj)
- obj.instance_eval {mon_initialize()}
+ obj.__send__(:mon_initialize)
end
#
@@ -244,9 +235,6 @@ module MonitorMixin
#
# FIXME: This isn't documented in Nutshell.
- #
- # Create a new condition variable for this monitor.
- # This facilitates control of the monitor with #signal and #wait.
#
def new_cond
return ConditionVariable.new(self)
@@ -259,7 +247,6 @@ module MonitorMixin
mon_initialize
end
- # called by initialize method to set defaults for instance variables.
def mon_initialize
@mon_owner = nil
@mon_count = 0
@@ -267,8 +254,6 @@ module MonitorMixin
@mon_waiting_queue = []
end
- # Throw a ThreadError exception if the current thread
- # does't own the monitor
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
@@ -304,17 +289,6 @@ module MonitorMixin
end
end
-# Monitors provide means of mutual exclusion for Thread programming.
-# A critical region is created by means of the synchronize method,
-# which takes a block.
-# The condition variables (created with #new_cond) may be used
-# to control the execution of a monitor with #signal and #wait.
-#
-# the Monitor class wraps MonitorMixin, and provides aliases
-# alias try_enter try_mon_enter
-# alias enter mon_enter
-# alias exit mon_exit
-# to access its methods more concisely.
class Monitor
include MonitorMixin
alias try_enter try_mon_enter
diff --git a/lib/mutex_m.rb b/lib/mutex_m.rb
index 8e0d42bc8d..0192d83bee 100644
--- a/lib/mutex_m.rb
+++ b/lib/mutex_m.rb
@@ -1,4 +1,4 @@
-#--
+#
# mutex_m.rb -
# $Release Version: 3.0$
# $Revision: 1.7 $
@@ -7,26 +7,22 @@
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# modified by matz
# patched by akira yamada
-#++
-#
-# == Usage
-#
-# Extend an object and use it like a Mutex object:
-#
-# require "mutex_m.rb"
-# obj = Object.new
-# obj.extend Mutex_m
-# # ...
#
-# Or, include Mutex_m in a class to have its instances behave like a Mutex
-# object:
+# --
+# Usage:
+# require "mutex_m.rb"
+# obj = Object.new
+# obj.extend Mutex_m
+# ...
+# extended object can be handled like Mutex
+# or
+# class Foo
+# include Mutex_m
+# ...
+# end
+# obj = Foo.new
+# this obj can be handled like Mutex
#
-# class Foo
-# include Mutex_m
-# # ...
-# end
-#
-# obj = Foo.new
module Mutex_m
def Mutex_m.define_aliases(cl)
diff --git a/lib/net/http.rb b/lib/net/http.rb
index b62f97d374..8ae2889843 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1,12 +1,10 @@
#
# = net/http.rb
#
-# Copyright (c) 1999-2006 Yukihiro Matsumoto
-# Copyright (c) 1999-2006 Minero Aoki
-# Copyright (c) 2001 GOTOU Yuuzou
+# Copyright (c) 1999-2003 Yukihiro Matsumoto
+# Copyright (c) 1999-2003 Minero Aoki
#
-# Written and maintained by Minero Aoki <aamine@loveruby.net>.
-# HTTPS support added by GOTOU Yuuzou <gotoyuzo@notwork.org>.
+# Written & maintained by Minero Aoki <aamine@loveruby.net>.
#
# This file is derived from "http-access.rb".
#
@@ -22,13 +20,14 @@
# http://www.ruby-lang.org/ja/man/?cmd=view;name=net%2Fhttp.rb
#
#--
-# $Id: http.rb,v 1.100.2.14 2006/07/26 13:27:18 aamine Exp $
+# $Id$
#++
require 'net/protocol'
require 'uri'
-module Net #:nodoc:
+
+module Net # :nodoc:
# :stopdoc:
class HTTPBadResponse < StandardError; end
@@ -46,66 +45,31 @@ module Net #:nodoc:
#
# === Getting Document From WWW Server
#
- # Example #1: Simple GET+print
+ # (formal version)
#
# require 'net/http'
- # Net::HTTP.get_print 'www.example.com', '/index.html'
+ # Net::HTTP.start('www.example.com', 80) { |http|
+ # response = http.get('/index.html')
+ # puts response.body
+ # }
#
- # Example #2: Simple GET+print by URL
+ # (shorter version)
#
# require 'net/http'
- # require 'uri'
- # Net::HTTP.get_print URI.parse('http://www.example.com/index.html')
+ # Net::HTTP.get_print 'www.example.com', '/index.html'
#
- # Example #3: More generic GET+print
+ # or
#
# require 'net/http'
# require 'uri'
- #
- # url = URI.parse('http://www.example.com/index.html')
- # res = Net::HTTP.start(url.host, url.port) {|http|
- # http.get('/index.html')
- # }
- # puts res.body
- #
- # Example #4: More generic GET+print
- #
- # require 'net/http'
- #
- # url = URI.parse('http://www.example.com/index.html')
- # req = Net::HTTP::Get.new(url.path)
- # res = Net::HTTP.start(url.host, url.port) {|http|
- # http.request(req)
- # }
- # puts res.body
+ # Net::HTTP.get_print URI.parse('http://www.example.com/index.html')
#
# === Posting Form Data
#
# require 'net/http'
- # require 'uri'
- #
- # #1: Simple POST
- # res = Net::HTTP.post_form(URI.parse('http://www.example.com/search.cgi'),
- # {'q'=>'ruby', 'max'=>'50'})
- # puts res.body
- #
- # #2: POST with basic authentication
- # res = Net::HTTP.post_form(URI.parse('http://jack:pass@www.example.com/todo.cgi'),
- # {'from'=>'2005-01-01', 'to'=>'2005-03-31'})
- # puts res.body
- #
- # #3: Detailed control
- # url = URI.parse('http://www.example.com/todo.cgi')
- # req = Net::HTTP::Post.new(url.path)
- # req.basic_auth 'jack', 'pass'
- # req.set_form_data({'from'=>'2005-01-01', 'to'=>'2005-03-31'}, ';')
- # res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
- # case res
- # when Net::HTTPSuccess, Net::HTTPRedirection
- # # OK
- # else
- # res.error!
- # end
+ # Net::HTTP.start('some.www.server', 80) { |http|
+ # response = http.post('/cgi-bin/search.rb', 'query=ruby')
+ # }
#
# === Accessing via Proxy
#
@@ -119,7 +83,7 @@ module Net #:nodoc:
# proxy_port = 8080
# :
# Net::HTTP::Proxy(proxy_addr, proxy_port).start('www.example.com') {|http|
- # # always connect to your.proxy.addr:8080
+ # # always connect to your.proxy.addr:8080
# :
# }
#
@@ -154,7 +118,7 @@ module Net #:nodoc:
# require 'net/http'
# require 'uri'
#
- # def fetch(uri_str, limit = 10)
+ # def fetch( uri_str, limit = 10 )
# # You should choose better exception.
# raise ArgumentError, 'HTTP redirect too deep' if limit == 0
#
@@ -185,78 +149,9 @@ module Net #:nodoc:
# print response.body
# }
#
- # === HTTP Request Classes
- #
- # Here is HTTP request class hierarchy.
- #
- # Net::HTTPRequest
- # Net::HTTP::Get
- # Net::HTTP::Head
- # Net::HTTP::Post
- # Net::HTTP::Put
- # Net::HTTP::Proppatch
- # Net::HTTP::Lock
- # Net::HTTP::Unlock
- # Net::HTTP::Options
- # Net::HTTP::Propfind
- # Net::HTTP::Delete
- # Net::HTTP::Move
- # Net::HTTP::Copy
- # Net::HTTP::Mkcol
- # Net::HTTP::Trace
- #
# === HTTP Response Classes
#
- # Here is HTTP response class hierarchy.
- # All classes are defined in Net module.
- #
- # HTTPResponse
- # HTTPUnknownResponse
- # HTTPInformation # 1xx
- # HTTPContinue # 100
- # HTTPSwitchProtocl # 101
- # HTTPSuccess # 2xx
- # HTTPOK # 200
- # HTTPCreated # 201
- # HTTPAccepted # 202
- # HTTPNonAuthoritativeInformation # 203
- # HTTPNoContent # 204
- # HTTPResetContent # 205
- # HTTPPartialContent # 206
- # HTTPRedirection # 3xx
- # HTTPMultipleChoice # 300
- # HTTPMovedPermanently # 301
- # HTTPFound # 302
- # HTTPSeeOther # 303
- # HTTPNotModified # 304
- # HTTPUseProxy # 305
- # HTTPTemporaryRedirect # 307
- # HTTPClientError # 4xx
- # HTTPBadRequest # 400
- # HTTPUnauthorized # 401
- # HTTPPaymentRequired # 402
- # HTTPForbidden # 403
- # HTTPNotFound # 404
- # HTTPMethodNotAllowed # 405
- # HTTPNotAcceptable # 406
- # HTTPProxyAuthenticationRequired # 407
- # HTTPRequestTimeOut # 408
- # HTTPConflict # 409
- # HTTPGone # 410
- # HTTPLengthRequired # 411
- # HTTPPreconditionFailed # 412
- # HTTPRequestEntityTooLarge # 413
- # HTTPRequestURITooLong # 414
- # HTTPUnsupportedMediaType # 415
- # HTTPRequestedRangeNotSatisfiable # 416
- # HTTPExpectationFailed # 417
- # HTTPServerError # 5xx
- # HTTPInternalServerError # 500
- # HTTPNotImplemented # 501
- # HTTPBadGateway # 502
- # HTTPServiceUnavailable # 503
- # HTTPGatewayTimeOut # 504
- # HTTPVersionNotSupported # 505
+ # TODO: write me.
#
# == Switching Net::HTTP versions
#
@@ -265,22 +160,22 @@ module Net #:nodoc:
# allows you to use 1.2 features again.
#
# # example
- # Net::HTTP.start {|http1| ...(http1 has 1.2 features)... }
+ # Net::HTTP.start { |http1| ...(http1 has 1.2 features)... }
#
# Net::HTTP.version_1_1
- # Net::HTTP.start {|http2| ...(http2 has 1.1 features)... }
+ # Net::HTTP.start { |http2| ...(http2 has 1.1 features)... }
#
# Net::HTTP.version_1_2
- # Net::HTTP.start {|http3| ...(http3 has 1.2 features)... }
+ # Net::HTTP.start { |http3| ...(http3 has 1.2 features)... }
#
# This function is NOT thread-safe.
#
class HTTP < Protocol
# :stopdoc:
- Revision = %q$Revision: 1.100.2.14 $.split[1]
+ Revision = %q$Revision$.split[1]
HTTPVersion = '1.1'
- @newimpl = true
+ @@newimpl = true # for backward compatability
# :startdoc:
# Turns on net/http 1.2 (ruby 1.8) features.
@@ -292,25 +187,25 @@ module Net #:nodoc:
# Net::HTTP.version_1_2
#
def HTTP.version_1_2
- @newimpl = true
+ @@newimpl = true
end
# Turns on net/http 1.1 (ruby 1.6) features.
# Defaults to OFF in ruby 1.8.
def HTTP.version_1_1
- @newimpl = false
+ @@newimpl = false
end
# true if net/http is in version 1.2 mode.
# Defaults to true.
def HTTP.version_1_2?
- @newimpl
+ @@newimpl
end
# true if net/http is in version 1.1 compatible mode.
# Defaults to true.
def HTTP.version_1_1?
- not @newimpl
+ not @@newimpl
end
class << HTTP
@@ -318,6 +213,12 @@ module Net #:nodoc:
alias is_version_1_2? version_1_2? #:nodoc:
end
+ def HTTP.setimplversion(obj) #:nodoc:
+ f = @@newimpl
+ obj.instance_eval { @newimpl = f }
+ end
+ private_class_method :setimplversion
+
#
# short cut methods
#
@@ -331,13 +232,19 @@ module Net #:nodoc:
#
# or:
#
- # Net::HTTP.get_print 'www.example.com', '/index.html'
+ # Net::HTTP.get_print('www.example.com', '/index.html')
#
- def HTTP.get_print(uri_or_host, path = nil, port = nil)
- get_response(uri_or_host, path, port) {|res|
- res.read_body do |chunk|
- $stdout.print chunk
- end
+ def HTTP.get_print(arg1, arg2 = nil, port = nil)
+ if arg2
+ addr, path = arg1, arg2
+ else
+ uri = arg1
+ addr = uri.host
+ path = uri.request_uri
+ port = uri.port
+ end
+ new(addr, port || HTTP.default_port).start {|http|
+ http.get path, nil, $stdout
}
nil
end
@@ -352,8 +259,8 @@ module Net #:nodoc:
#
# print Net::HTTP.get('www.example.com', '/index.html')
#
- def HTTP.get(uri_or_host, path = nil, port = nil)
- get_response(uri_or_host, path, port).body
+ def HTTP.get(arg1, arg2 = nil, arg3 = nil)
+ get_response(arg1,arg2,arg3).body
end
# Send a GET request to the target and return the response
@@ -368,43 +275,29 @@ module Net #:nodoc:
# res = Net::HTTP.get_response('www.example.com', '/index.html')
# print res.body
#
- def HTTP.get_response(uri_or_host, path = nil, port = nil, &block)
- if path
- host = uri_or_host
- new(host, port || HTTP.default_port).start {|http|
- return http.request_get(path, &block)
- }
+ def HTTP.get_response(arg1, arg2 = nil, arg3 = nil)
+ if arg2
+ get_by_path(arg1, arg2, arg3)
else
- uri = uri_or_host
- new(uri.host, uri.port).start {|http|
- return http.request_get(uri.request_uri, &block)
- }
+ get_by_uri(arg1)
end
end
- # Posts HTML form data to the +URL+.
- # Form data must be represented as a Hash of String to String, e.g:
- #
- # { "cmd" => "search", "q" => "ruby", "max" => "50" }
- #
- # This method also does Basic Authentication iff +URL+.user exists.
- #
- # Example:
- #
- # require 'net/http'
- # require 'uri'
- #
- # HTTP.post_form URI.parse('http://www.example.com/search.cgi'),
- # { "q" => "ruby", "max" => "50" }
- #
- def HTTP.post_form(url, params)
- req = Post.new(url.path)
- req.form_data = params
- req.basic_auth url.user, url.password if url.user
- new(url.host, url.port).start {|http|
- http.request(req)
+ def HTTP.get_by_path(addr, path, port = nil) #:nodoc:
+ new(addr, port || HTTP.default_port).start {|http|
+ return http.request(Get.new(path))
}
end
+ private_class_method :get_by_path
+
+ def HTTP.get_by_uri(uri) #:nodoc:
+ # Should we allow this?
+ # uri = URI.parse(uri) unless uri.respond_to?(:host)
+ new(uri.host, uri.port).start {|http|
+ return http.request(Get.new(uri.request_uri))
+ }
+ end
+ private_class_method :get_by_uri
#
# HTTP session management
@@ -412,47 +305,35 @@ module Net #:nodoc:
# The default port to use for HTTP requests; defaults to 80.
def HTTP.default_port
- http_default_port()
- end
-
- # The default port to use for HTTP requests; defaults to 80.
- def HTTP.http_default_port
80
end
- # The default port to use for HTTPS requests; defaults to 443.
- def HTTP.https_default_port
- 443
- end
-
def HTTP.socket_type #:nodoc: obsolete
- BufferedIO
- end
-
- # creates a new Net::HTTP object and opens its TCP connection and
- # HTTP session. If the optional block is given, the newly
- # created Net::HTTP object is passed to it and closed when the
- # block finishes. In this case, the return value of this method
- # is the return value of the block. If no block is given, the
- # return value of this method is the newly created Net::HTTP object
- # itself, and the caller is responsible for closing it upon completion.
- def HTTP.start(address, port = nil, p_addr = nil, p_port = nil, p_user = nil, p_pass = nil, &block) # :yield: +http+
- new(address, port, p_addr, p_port, p_user, p_pass).start(&block)
+ InternetMessageIO
end
class << HTTP
+ # creates a new Net::HTTP object and opens its TCP connection and
+ # HTTP session. If the optional block is given, the newly
+ # created Net::HTTP object is passed to it and closed when the
+ # block finishes. In this case, the return value of this method
+ # is the return value of the block. If no block is given, the
+ # return value of this method is the newly created Net::HTTP object
+ # itself, and the caller is responsible for closing it upon completion.
+ def start(address, port = nil, p_addr = nil, p_port = nil, p_user = nil, p_pass = nil, &block) # :yield: +http+
+ new(address, port, p_addr, p_port, p_user, p_pass).start(&block)
+ end
+
alias newobj new
- end
- # Creates a new Net::HTTP object.
- # If +proxy_addr+ is given, creates an Net::HTTP object with proxy support.
- # This method does not open the TCP connection.
- def HTTP.new(address, port = nil, p_addr = nil, p_port = nil, p_user = nil, p_pass = nil)
- h = Proxy(p_addr, p_port, p_user, p_pass).newobj(address, port)
- h.instance_eval {
- @newimpl = ::Net::HTTP.version_1_2?
- }
- h
+ # Creates a new Net::HTTP object.
+ # If +proxy_addr+ is given, creates an Net::HTTP object with proxy support.
+ # This method does not open the TCP connection.
+ def new(address, port = nil, p_addr = nil, p_port = nil, p_user = nil, p_pass = nil)
+ obj = Proxy(p_addr, p_port, p_user, p_pass).newobj(address, port)
+ setimplversion obj
+ obj
+ end
end
# Creates a new Net::HTTP object for the specified +address+.
@@ -460,16 +341,17 @@ module Net #:nodoc:
def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)
+
@curr_http_version = HTTPVersion
@seems_1_0_server = false
@close_on_empty_response = false
@socket = nil
@started = false
- @open_timeout = nil
+
+ @open_timeout = 30
@read_timeout = 60
+
@debug_output = nil
- @use_ssl = false
- @ssl_context = nil
end
def inspect
@@ -521,11 +403,6 @@ module Net #:nodoc:
attr_accessor :close_on_empty_response
- # returns true if use SSL/TLS with HTTP.
- def use_ssl?
- false # redefined in net/https
- end
-
# Opens TCP connection and HTTP session.
#
# When this method is called with block, gives a HTTP object
@@ -550,45 +427,14 @@ module Net #:nodoc:
end
def do_start
- connect
+ @socket = self.class.socket_type.open(conn_address(), conn_port(),
+ @open_timeout, @read_timeout,
+ @debug_output)
+ on_connect
@started = true
end
private :do_start
- def connect
- D "opening connection to #{conn_address()}..."
- s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
- D "opened"
- if use_ssl?
- unless @ssl_context.verify_mode
- warn "warning: peer certificate won't be verified in this SSL session"
- @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
- end
- s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
- s.sync_close = true
- end
- @socket = BufferedIO.new(s)
- @socket.read_timeout = @read_timeout
- @socket.debug_output = @debug_output
- if use_ssl?
- if proxy?
- @socket.writeline sprintf('CONNECT %s:%s HTTP/%s',
- @address, @port, HTTPVersion)
- @socket.writeline "Host: #{@address}:#{@port}"
- if proxy_user
- credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
- credential.delete!("\r\n")
- @socket.writeline "Proxy-Authorization: Basic #{credential}"
- end
- @socket.writeline ''
- HTTPResponse.read_new(@socket).value
- end
- s.connect
- end
- on_connect
- end
- private :connect
-
def on_connect
end
private :on_connect
@@ -663,7 +509,7 @@ module Net #:nodoc:
attr_reader :proxy_pass
end
- # True if self is a HTTP proxy class.
+ # True if self is a HTTP proxy class
def proxy?
self.class.proxy_class?
end
@@ -696,11 +542,11 @@ module Net #:nodoc:
# without proxy
def conn_address
- address()
+ address
end
def conn_port
- port()
+ port
end
def edit_path(path)
@@ -719,7 +565,7 @@ module Net #:nodoc:
end
def edit_path(path)
- use_ssl? ? path : "http://#{addr_port()}#{path}"
+ 'http://' + addr_port() + path
end
end
@@ -812,8 +658,14 @@ module Net #:nodoc:
# the socket. Note that in this case, the returned response
# object will *not* contain a (meaningful) body.
#
- # +dest+ argument is obsolete.
- # It still works but you must not use it.
+ # +dest+ is an alternative method of collecting the body. It
+ # must be an object responding to the "<<" operator (such as
+ # a String or an Array). Each fragment of the entity body
+ # will be "<<"-ed in turn onto +dest+ if provided, and it will
+ # also become the body of the returned response object.
+ #
+ # You must *not* provide both +dest+ and a block; doing so
+ # will result in an ArgumentError.
#
# In version 1.1, this method might raise an exception for
# 3xx (redirect). In this case you can get an HTTPResponse object
@@ -833,10 +685,6 @@ module Net #:nodoc:
# end
# }
#
- # You should set Content-Type: header field for POST.
- # If no Content-Type: field given, this method uses
- # "application/x-www-form-urlencoded" by default.
- #
def post(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
res = nil
request(Post.new(path, initheader), data) {|r|
@@ -847,6 +695,7 @@ module Net #:nodoc:
res.value
return res, res.body
end
+
res
end
@@ -856,66 +705,6 @@ module Net #:nodoc:
res
end
- # Sends a PROPPATCH request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def proppatch(path, body, initheader = nil)
- request(Proppatch.new(path, initheader), body)
- end
-
- # Sends a LOCK request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def lock(path, body, initheader = nil)
- request(Lock.new(path, initheader), body)
- end
-
- # Sends a UNLOCK request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def unlock(path, body, initheader = nil)
- request(Unlock.new(path, initheader), body)
- end
-
- # Sends a OPTIONS request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def options(path, initheader = nil)
- request(Options.new(path, initheader))
- end
-
- # Sends a PROPFIND request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def propfind(path, body = nil, initheader = {'Depth' => '0'})
- request(Propfind.new(path, initheader), body)
- end
-
- # Sends a DELETE request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def delete(path, initheader = {'Depth' => 'Infinity'})
- request(Delete.new(path, initheader))
- end
-
- # Sends a MOVE request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def move(path, initheader = nil)
- request(Move.new(path, initheader))
- end
-
- # Sends a COPY request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def copy(path, initheader = nil)
- request(Copy.new(path, initheader))
- end
-
- # Sends a MKCOL request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def mkcol(path, body = nil, initheader = nil)
- request(Mkcol.new(path, initheader), body)
- end
-
- # Sends a TRACE request to the +path+ and gets a response,
- # as an HTTPResponse object.
- def trace(path, initheader = nil)
- request(Trace.new(path, initheader))
- end
-
# Sends a GET request to the +path+ and gets a response,
# as an HTTPResponse object.
#
@@ -1035,17 +824,14 @@ module Net #:nodoc:
}
end
if proxy_user()
- unless use_ssl?
- req.proxy_basic_auth proxy_user(), proxy_pass()
- end
+ req.proxy_basic_auth proxy_user(), proxy_pass()
end
- req.set_body_internal body
begin_transport req
- req.exec @socket, @curr_http_version, edit_path(req.path)
+ req.exec @socket, @curr_http_version, edit_path(req.path), body
begin
res = HTTPResponse.read_new(@socket)
- end while res.kind_of?(HTTPContinue)
+ end while HTTPContinue === res
res.reading_body(@socket, req.response_body_permitted?) {
yield res if block_given?
}
@@ -1058,7 +844,8 @@ module Net #:nodoc:
def begin_transport(req)
if @socket.closed?
- connect
+ @socket.reopen @open_timeout
+ on_connect
end
if @seems_1_0_server
req['connection'] ||= 'close'
@@ -1103,11 +890,7 @@ module Net #:nodoc:
private
def addr_port
- if use_ssl?
- address() + (port == HTTP.https_default_port ? '' : ":#{port()}")
- else
- address() + (port == HTTP.http_default_port ? '' : ":#{port()}")
- end
+ address + (port == HTTP.default_port ? '' : ":#{port}")
end
def D(msg)
@@ -1120,7 +903,6 @@ module Net #:nodoc:
HTTPSession = HTTP
-
#
# Header module.
#
@@ -1131,15 +913,6 @@ module Net #:nodoc:
#
module HTTPHeader
- def initialize_http_header(initheader)
- @header = {}
- return unless initheader
- initheader.each do |key, value|
- warn "net/http: warning: duplicated HTTP header: #{key}" if key?(key) and $VERBOSE
- @header[key.downcase] = [value.strip]
- end
- end
-
def size #:nodoc: obsolete
@header.size
end
@@ -1149,94 +922,36 @@ module Net #:nodoc:
# Returns the header field corresponding to the case-insensitive key.
# For example, a key of "Content-Type" might return "text/html"
def [](key)
- a = @header[key.downcase] or return nil
- a.join(', ')
+ @header[key.downcase]
end
# Sets the header field corresponding to the case-insensitive key.
def []=(key, val)
- unless val
- @header.delete key.downcase
- return val
- end
- @header[key.downcase] = [val]
- end
-
- # [Ruby 1.8.3]
- # Adds header field instead of replace.
- # Second argument +val+ must be a String.
- # See also #[]=, #[] and #get_fields.
- #
- # request.add_field 'X-My-Header', 'a'
- # p request['X-My-Header'] #=> "a"
- # p request.get_fields('X-My-Header') #=> ["a"]
- # request.add_field 'X-My-Header', 'b'
- # p request['X-My-Header'] #=> "a, b"
- # p request.get_fields('X-My-Header') #=> ["a", "b"]
- # request.add_field 'X-My-Header', 'c'
- # p request['X-My-Header'] #=> "a, b, c"
- # p request.get_fields('X-My-Header') #=> ["a", "b", "c"]
- #
- def add_field(key, val)
- if @header.key?(key.downcase)
- @header[key.downcase].push val
- else
- @header[key.downcase] = [val]
- end
- end
-
- # [Ruby 1.8.3]
- # Returns an array of header field strings corresponding to the
- # case-insensitive +key+. This method allows you to get duplicated
- # header fields without any processing. See also #[].
- #
- # p response.get_fields('Set-Cookie')
- # #=> ["session=al98axx; expires=Fri, 31-Dec-1999 23:58:23",
- # "query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"]
- # p response['Set-Cookie']
- # #=> "session=al98axx; expires=Fri, 31-Dec-1999 23:58:23, query=rubyscript; expires=Fri, 31-Dec-1999 23:58:23"
- #
- def get_fields(key)
- return nil unless @header[key.downcase]
- @header[key.downcase].dup
+ @header[key.downcase] = val
end
# Returns the header field corresponding to the case-insensitive key.
# Returns the default value +args+, or the result of the block, or nil,
# if there's no header field named key. See Hash#fetch
def fetch(key, *args, &block) #:yield: +key+
- a = @header.fetch(key.downcase, *args, &block)
- a.join(', ')
+ @header.fetch(key.downcase, *args, &block)
end
# Iterates for each header names and values.
- def each_header #:yield: +key+, +value+
- @header.each do |k,va|
- yield k, va.join(', ')
- end
+ def each_header(&block) #:yield: +key+, +value+
+ @header.each(&block)
end
alias each each_header
# Iterates for each header names.
- def each_name(&block) #:yield: +key+
+ def each_key(&block) #:yield: +key+
@header.each_key(&block)
end
- alias each_key each_name
-
- # Iterates for each capitalized header names.
- def each_capitalized_name(&block) #:yield: +key+
- @header.each_key do |k|
- yield capitalize(k)
- end
- end
-
# Iterates for each header values.
- def each_value #:yield: +value+
- @header.each_value do |va|
- yield va.join(', ')
- end
+ def each_value(&block) #:yield: +value+
+ @header.each_value(&block)
end
# Removes a header field.
@@ -1255,24 +970,22 @@ module Net #:nodoc:
end
# As for #each_header, except the keys are provided in capitalized form.
- def each_capitalized
+ def canonical_each
@header.each do |k,v|
- yield capitalize(k), v.join(', ')
+ yield canonical(k), v
end
end
- alias canonical_each each_capitalized
-
- def capitalize(name)
- name.split(/-/).map {|s| s.capitalize }.join('-')
+ def canonical( k )
+ k.split(/-/).map {|i| i.capitalize }.join('-')
end
- private :capitalize
+ private :canonical
- # Returns an Array of Range objects which represents Range: header field,
+ # Returns a Range object which represents Range: header field,
# or +nil+ if there is no such header.
def range
- return nil unless @header['range']
- self['Range'].split(/,/).map {|spec|
+ s = @header['range'] or return nil
+ s.split(/,/).map {|spec|
m = /bytes\s*=\s*(\d+)?\s*-\s*(\d+)?/i.match(spec) or
raise HTTPHeaderSyntaxError, "wrong Range: #{spec}"
d1 = m[1].to_i
@@ -1287,57 +1000,44 @@ module Net #:nodoc:
end
# Set Range: header from Range (arg r) or beginning index and
- # length from it (arg idx&len).
- #
- # req.range = (0..1023)
- # req.set_range 0, 1023
- #
- def set_range(r, e = nil)
- unless r
- @header.delete 'range'
- return r
- end
- r = (r...r+e) if e
+ # length from it (arg i&len).
+ def range=(r, fin = nil)
+ r = (r ... r + fin) if fin
case r
when Numeric
- n = r.to_i
- rangestr = (n > 0 ? "0-#{n-1}" : "-#{-n}")
+ s = r > 0 ? "0-#{r - 1}" : "-#{-r}"
when Range
first = r.first
last = r.last
- last -= 1 if r.exclude_end?
+ if r.exclude_end?
+ last -= 1
+ end
+
if last == -1
- rangestr = (first > 0 ? "#{first}-" : "-#{-first}")
+ s = first > 0 ? "#{first}-" : "-#{-first}"
else
- raise HTTPHeaderSyntaxError, 'range.first is negative' if first < 0
- raise HTTPHeaderSyntaxError, 'range.last is negative' if last < 0
- raise HTTPHeaderSyntaxError, 'must be .first < .last' if first > last
- rangestr = "#{first}-#{last}"
+ first >= 0 or raise HTTPHeaderSyntaxError, 'range.first is negative'
+ last > 0 or raise HTTPHeaderSyntaxError, 'range.last is negative'
+ first < last or raise HTTPHeaderSyntaxError, 'must be .first < .last'
+ s = "#{first}-#{last}"
end
else
raise TypeError, 'Range/Integer is required'
end
- @header['range'] = ["bytes=#{rangestr}"]
+
+ @header['range'] = "bytes=#{s}"
r
end
- alias range= set_range
+ alias set_range range=
# Returns an Integer object which represents the Content-Length: header field
# or +nil+ if that field is not provided.
def content_length
- return nil unless key?('Content-Length')
- len = self['Content-Length'].slice(/\d+/) or
- raise HTTPHeaderSyntaxError, 'wrong Content-Length format'
- len.to_i
- end
-
- def content_length=(len)
- unless len
- @header.delete 'content-length'
- return nil
- end
- @header['content-length'] = [len.to_i.to_s]
+ s = @header['content-length'] or return nil
+ m = /\d+/.match(s) or
+ raise HTTPHeaderSyntaxError, 'wrong Content-Length format'
+ m[0].to_i
end
# Returns "true" if the "transfer-encoding" header is present and
@@ -1345,101 +1045,34 @@ module Net #:nodoc:
# the content to be sent in "chunks" without at the outset
# stating the entire content length.
def chunked?
- return false unless @header['transfer-encoding']
- field = self['Transfer-Encoding']
- (/(?:\A|[^\-\w])chunked(?![\-\w])/i =~ field) ? true : false
+ s = @header['transfer-encoding']
+ (s and /(?:\A|[^\-\w])chunked(?:[^\-\w]|\z)/i === s) ? true : false
end
# Returns a Range object which represents Content-Range: header field.
# This indicates, for a partial entity body, where this fragment
# fits inside the full entity body, as range of byte offsets.
def content_range
- return nil unless @header['content-range']
- m = %r<bytes\s+(\d+)-(\d+)/(\d+|\*)>i.match(self['Content-Range']) or
- raise HTTPHeaderSyntaxError, 'wrong Content-Range format'
+ s = @header['content-range'] or return nil
+ m = %r<bytes\s+(\d+)-(\d+)/(?:\d+|\*)>i.match(s) or
+ raise HTTPHeaderSyntaxError, 'wrong Content-Range format'
m[1].to_i .. m[2].to_i + 1
end
- # The length of the range represented in Content-Range: header.
+ # The length of the range represented in Range: header.
def range_length
- r = content_range() or return nil
- r.end - r.begin
- end
-
- # Returns a content type string such as "text/html".
- # This method returns nil if Content-Type: header field does not exist.
- def content_type
- return nil unless main_type()
- if sub_type()
- then "#{main_type()}/#{sub_type()}"
- else main_type()
- end
- end
-
- # Returns a content type string such as "text".
- # This method returns nil if Content-Type: header field does not exist.
- def main_type
- return nil unless @header['content-type']
- self['Content-Type'].split(';').first.to_s.split('/')[0].to_s.strip
- end
-
- # Returns a content type string such as "html".
- # This method returns nil if Content-Type: header field does not exist
- # or sub-type is not given (e.g. "Content-Type: text").
- def sub_type
- return nil unless @header['content-type']
- main, sub = *self['Content-Type'].split(';').first.to_s.split('/')
- return nil unless sub
- sub.strip
- end
-
- # Returns content type parameters as a Hash as like
- # {"charset" => "iso-2022-jp"}.
- def type_params
- result = {}
- list = self['Content-Type'].to_s.split(';')
- list.shift
- list.each do |param|
- k, v = *param.split('=', 2)
- result[k.strip] = v.strip
- end
- result
- end
-
- # Set Content-Type: header field by +type+ and +params+.
- # +type+ must be a String, +params+ must be a Hash.
- def set_content_type(type, params = {})
- @header['content-type'] = [type + params.map{|k,v|"; #{k}=#{v}"}.join('')]
+ r = self.content_range
+ r and (r.end - r.begin)
end
- alias content_type= set_content_type
-
- # Set header fields and a body from HTML form data.
- # +params+ should be a Hash containing HTML form data.
- # Optional argument +sep+ means data record separator.
- #
- # This method also set Content-Type: header field to
- # application/x-www-form-urlencoded.
- def set_form_data(params, sep = '&')
- self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
- self.content_type = 'application/x-www-form-urlencoded'
- end
-
- alias form_data= set_form_data
-
- def urlencode(str)
- str.gsub(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0]) }
- end
- private :urlencode
-
# Set the Authorization: header for "Basic" authorization.
def basic_auth(account, password)
- @header['authorization'] = [basic_encode(account, password)]
+ @header['authorization'] = basic_encode(account, password)
end
# Set Proxy-Authorization: header for "Basic" authorization.
def proxy_basic_auth(account, password)
- @header['proxy-authorization'] = [basic_encode(account, password)]
+ @header['proxy-authorization'] = basic_encode(account, password)
end
def basic_encode(account, password)
@@ -1449,7 +1082,6 @@ module Net #:nodoc:
end
-
#
# Parent of HTTPRequest class. Do not use this directly; use
# a subclass of HTTPRequest.
@@ -1464,12 +1096,16 @@ module Net #:nodoc:
@method = m
@request_has_body = reqbody
@response_has_body = resbody
- raise ArgumentError, "HTTP request path is empty" if path.empty?
@path = path
- initialize_http_header initheader
- self['Accept'] ||= '*/*'
- @body = nil
- @body_stream = nil
+
+ @header = {}
+ return unless initheader
+ initheader.each do |k,v|
+ key = k.downcase
+ $stderr.puts "net/http: warning: duplicated HTTP header: #{k}" if @header.key?(key) and $VERBOSE
+ @header[key] = v.strip
+ end
+ @header['accept'] ||= '*/*'
end
attr_reader :method
@@ -1487,85 +1123,45 @@ module Net #:nodoc:
@response_has_body
end
- def body_exist?
- warn "Net::HTTPRequest#body_exist? is obsolete; use response_body_permitted?" if $VERBOSE
- response_body_permitted?
- end
-
- attr_reader :body
-
- def body=(str)
- @body = str
- @body_stream = nil
- str
- end
-
- attr_reader :body_stream
-
- def body_stream=(input)
- @body = nil
- @body_stream = input
- input
- end
-
- def set_body_internal(str) #:nodoc: internal use only
- raise ArgumentError, "both of body argument and HTTPRequest#body set" if str and (@body or @body_stream)
- self.body = str if str
- end
+ alias body_exist? response_body_permitted?
#
# write
#
- def exec(sock, ver, path) #:nodoc: internal use only
- if @body
- send_request_with_body sock, ver, path, @body
- elsif @body_stream
- send_request_with_body_stream sock, ver, path, @body_stream
+ def exec(sock, ver, path, body) #:nodoc: internal use only
+ if body
+ check_body_permitted
+ send_request_with_body sock, ver, path, body
else
- write_header sock, ver, path
+ request sock, ver, path
end
end
private
- def send_request_with_body(sock, ver, path, body)
- self.content_length = body.length
- delete 'Transfer-Encoding'
- supply_default_content_type
- write_header sock, ver, path
- sock.write body
+ def check_body_permitted
+ request_body_permitted? or
+ raise ArgumentError, 'HTTP request body is not permitted'
end
- def send_request_with_body_stream(sock, ver, path, f)
- unless content_length() or chunked?
- raise ArgumentError,
- "Content-Length not given and Transfer-Encoding is not `chunked'"
- end
- supply_default_content_type
- write_header sock, ver, path
- if chunked?
- while s = f.read(1024)
- sock.write(sprintf("%x\r\n", s.length) << s << "\r\n")
- end
- sock.write "0\r\n\r\n"
- else
- while s = f.read(1024)
- sock.write s
- end
+ def send_request_with_body( sock, ver, path, body )
+ @header['content-length'] = body.length.to_s
+ @header.delete 'transfer-encoding'
+
+ unless @header['content-type']
+ $stderr.puts 'net/http: warning: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE
+ @header['content-type'] = 'application/x-www-form-urlencoded'
end
- end
- def supply_default_content_type
- return if content_type()
- warn 'net/http: warning: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE
- set_content_type 'application/x-www-form-urlencoded'
+ request sock, ver, path
+ sock.write body
end
- def write_header(sock, ver, path)
+ def request(sock, ver, path)
buf = "#{@method} #{path} HTTP/#{ver}\r\n"
- each_capitalized do |k,v|
- buf << "#{k}: #{v}\r\n"
+ canonical_each do |k,v|
+ buf << k + ': ' + v + "\r\n"
end
buf << "\r\n"
sock.write buf
@@ -1590,10 +1186,7 @@ module Net #:nodoc:
end
- class HTTP # reopen
- #
- # HTTP 1.1 methods --- RFC2616
- #
+ class HTTP
class Get < HTTPRequest
METHOD = 'GET'
@@ -1619,69 +1212,6 @@ module Net #:nodoc:
RESPONSE_HAS_BODY = true
end
- class Delete < HTTPRequest
- METHOD = 'DELETE'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- class Options < HTTPRequest
- METHOD = 'OPTIONS'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = false
- end
-
- class Trace < HTTPRequest
- METHOD = 'TRACE'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- #
- # WebDAV methods --- RFC2518
- #
-
- class Propfind < HTTPRequest
- METHOD = 'PROPFIND'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- class Proppatch < HTTPRequest
- METHOD = 'PROPPATCH'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- class Mkcol < HTTPRequest
- METHOD = 'MKCOL'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- class Copy < HTTPRequest
- METHOD = 'COPY'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- class Move < HTTPRequest
- METHOD = 'MOVE'
- REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = true
- end
-
- class Lock < HTTPRequest
- METHOD = 'LOCK'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
-
- class Unlock < HTTPRequest
- METHOD = 'UNLOCK'
- REQUEST_HAS_BODY = true
- RESPONSE_HAS_BODY = true
- end
end
@@ -1785,7 +1315,7 @@ module Net #:nodoc:
def HTTPResponse.exception_type # :nodoc: internal use only
self::EXCEPTION_TYPE
end
- end # reopened after
+ end # redefined after
# :stopdoc:
@@ -1945,7 +1475,7 @@ module Net #:nodoc:
# :startdoc:
- class HTTPResponse # reopen
+ class HTTPResponse # redefine
CODE_CLASS_TO_OBJ = {
'1' => HTTPInformation,
@@ -1993,7 +1523,7 @@ module Net #:nodoc:
'416' => HTTPRequestedRangeNotSatisfiable,
'417' => HTTPExpectationFailed,
- '500' => HTTPInternalServerError,
+ '501' => HTTPInternalServerError,
'501' => HTTPNotImplemented,
'502' => HTTPBadGateway,
'503' => HTTPServiceUnavailable,
@@ -2001,13 +1531,20 @@ module Net #:nodoc:
'505' => HTTPVersionNotSupported
}
- class << HTTPResponse
+
+ class << self
+
def read_new(sock) #:nodoc: internal use only
httpv, code, msg = read_status_line(sock)
res = response_class(code).new(httpv, code, msg)
each_response_header(sock) do |k,v|
- res.add_field k, v
+ if res.key?(k)
+ res[k] << ', ' << v
+ else
+ res[k] = v
+ end
end
+
res
end
@@ -2016,8 +1553,8 @@ module Net #:nodoc:
def read_status_line(sock)
str = sock.readline
m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/in.match(str) or
- raise HTTPBadResponse, "wrong status line: #{str.dump}"
- m.captures
+ raise HTTPBadResponse, "wrong status line: #{str.dump}"
+ m.to_a[1,3]
end
def response_class(code)
@@ -2035,6 +1572,7 @@ module Net #:nodoc:
yield m[1], m.post_match
end
end
+
end
# next is to fix bug in RDoc, where the private inside class << self
@@ -2047,7 +1585,8 @@ module Net #:nodoc:
@http_version = httpv
@code = code
@message = msg
- initialize_http_header nil
+
+ @header = {}
@body = nil
@read = false
end
@@ -2065,7 +1604,7 @@ module Net #:nodoc:
alias msg message # :nodoc: obsolete
def inspect
- "#<#{self.class} #{@code} #{@message} readbody=#{@read}>"
+ "#<#{self.class} #{@code} readbody=#{@read}>"
end
# For backward compatibility.
@@ -2075,11 +1614,7 @@ module Net #:nodoc:
#
def to_ary
warn "net/http.rb: warning: Net::HTTP v1.1 style assignment found at #{caller(1)[0]}; use `response = http.get(...)' instead." if $VERBOSE
- res = self.dup
- class << res
- undef to_ary
- end
- [res, res.body]
+ [self, body()]
end
#
@@ -2100,7 +1635,7 @@ module Net #:nodoc:
# Raises HTTP error if the response is not 2xx.
def value
- error! unless self.kind_of?(HTTPSuccess)
+ error! unless HTTPSuccess === self
end
#
@@ -2108,19 +1643,11 @@ module Net #:nodoc:
#
def response #:nodoc:
- warn "#{caller(1)[0]}: warning: HTTPResponse#response is obsolete" if $VERBOSE
self
end
- def header #:nodoc:
- warn "#{caller(1)[0]}: warning: HTTPResponse#header is obsolete" if $VERBOSE
- self
- end
-
- def read_header #:nodoc:
- warn "#{caller(1)[0]}: warning: HTTPResponse#read_header is obsolete" if $VERBOSE
- self
- end
+ alias header response #:nodoc:
+ alias read_header response #:nodoc:
#
# body
@@ -2202,19 +1729,19 @@ module Net #:nodoc:
def read_body_0(dest)
if chunked?
read_chunked dest
- return
- end
- clen = content_length()
- if clen
- @socket.read clen, dest, true # ignore EOF
- return
- end
- clen = range_length()
- if clen
- @socket.read clen, dest
- return
+ else
+ clen = content_length()
+ if clen
+ @socket.read clen, dest, true # ignore EOF
+ else
+ clen = range_length()
+ if clen
+ @socket.read clen, dest
+ else
+ @socket.read_all dest
+ end
+ end
end
- @socket.read_all dest
end
def read_chunked(dest)
@@ -2253,8 +1780,8 @@ module Net #:nodoc:
# :enddoc:
- #--
# for backward compatibility
+
class HTTP
ProxyMod = ProxyDelta
end
diff --git a/lib/net/https.rb b/lib/net/https.rb
deleted file mode 100644
index 1111e94590..0000000000
--- a/lib/net/https.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-=begin
-
-= $RCSfile: https.rb,v $ -- SSL/TLS enhancement for Net::HTTP.
-
-== Info
- 'OpenSSL for Ruby 2' project
- Copyright (C) 2001 GOTOU Yuuzou <gotoyuzo@notwork.org>
- All rights reserved.
-
-== Licence
- This program is licenced under the same licence as Ruby.
- (See the file 'LICENCE'.)
-
-== Requirements
- This program requires Net 1.2.0 or higher version.
- You can get it from RAA or Ruby's CVS repository.
-
-== Version
- $Id: https.rb,v 1.3.4.2 2006/02/05 09:56:34 aamine Exp $
-
- 2001-11-06: Contiributed to Ruby/OpenSSL project.
- 2004-03-06: Some code is merged in to net/http.
-
-== Example
-
-Here is a simple HTTP client:
-
- require 'net/http'
- require 'uri'
-
- uri = URI.parse(ARGV[0] || 'http://localhost/')
- http = Net::HTTP.new(uri.host, uri.port)
- http.start {
- http.request_get(uri.path) {|res|
- print res.body
- }
- }
-
-It can be replaced by the following code:
-
- require 'net/https'
- require 'uri'
-
- uri = URI.parse(ARGV[0] || 'https://localhost/')
- http = Net::HTTP.new(uri.host, uri.port)
- http.use_ssl = true if uri.scheme == "https" # enable SSL/TLS
- http.start {
- http.request_get(uri.path) {|res|
- print res.body
- }
- }
-
-== class Net::HTTP
-
-=== Instance Methods
-
-: use_ssl?
- returns true if use SSL/TLS with HTTP.
-
-: use_ssl=((|true_or_false|))
- sets use_ssl.
-
-: peer_cert
- return the X.509 certificates the server presented.
-
-: key, key=((|key|))
- Sets an OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
- (This method is appeared in Michal Rokos's OpenSSL extention.)
-
-: cert, cert=((|cert|))
- Sets an OpenSSL::X509::Certificate object as client certificate
- (This method is appeared in Michal Rokos's OpenSSL extention).
-
-: ca_file, ca_file=((|path|))
- Sets path of a CA certification file in PEM format.
- The file can contrain several CA certificats.
-
-: ca_path, ca_path=((|path|))
- Sets path of a CA certification directory containing certifications
- in PEM format.
-
-: verify_mode, verify_mode=((|mode|))
- Sets the flags for server the certification verification at
- begining of SSL/TLS session.
- OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER is acceptable.
-
-: verify_callback, verify_callback=((|proc|))
- Sets the verify callback for the server certification verification.
-
-: verify_depth, verify_depth=((|num|))
- Sets the maximum depth for the certificate chain verification.
-
-: cert_store, cert_store=((|store|))
- Sets the X509::Store to verify peer certificate.
-
-: ssl_timeout, ssl_timeout=((|sec|))
- Sets the SSL timeout seconds.
-
-=end
-
-require 'net/http'
-require 'openssl'
-
-module Net
-
- class HTTP
- remove_method :use_ssl?
- def use_ssl?
- @use_ssl
- end
-
- # For backward compatibility.
- alias use_ssl use_ssl?
-
- # Turn on/off SSL.
- # This flag must be set before starting session.
- # If you change use_ssl value after session started,
- # a Net::HTTP object raises IOError.
- def use_ssl=(flag)
- flag = (flag ? true : false)
- raise IOError, "use_ssl value changed, but session already started" \
- if started? and @use_ssl != flag
- if flag and not @ssl_context
- @ssl_context = OpenSSL::SSL::SSLContext.new
- end
- @use_ssl = flag
- end
-
- def self.ssl_context_accessor(name)
- module_eval(<<-End, __FILE__, __LINE__ + 1)
- def #{name}
- return nil unless @ssl_context
- @ssl_context.#{name}
- end
-
- def #{name}=(val)
- @ssl_context ||= OpenSSL::SSL::SSLContext.new
- @ssl_context.#{name} = val
- end
- End
- end
-
- ssl_context_accessor :key
- ssl_context_accessor :cert
- ssl_context_accessor :ca_file
- ssl_context_accessor :ca_path
- ssl_context_accessor :verify_mode
- ssl_context_accessor :verify_callback
- ssl_context_accessor :verify_depth
- ssl_context_accessor :cert_store
-
- def ssl_timeout
- return nil unless @ssl_context
- @ssl_context.timeout
- end
-
- def ssl_timeout=(sec)
- raise ArgumentError, 'Net::HTTP#ssl_timeout= called but use_ssl=false' \
- unless use_ssl?
- @ssl_context ||= OpenSSL::SSL::SSLContext.new
- @ssl_context.timeout = sec
- end
-
- # For backward compatibility
- alias timeout= ssl_timeout=
-
- def peer_cert
- return nil if not use_ssl? or not @socket
- @socket.io.peer_cert
- end
- end
-
-end
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 29b6359e0e..7886c66fdd 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -885,16 +885,15 @@ module Net
raise "SSL extension not installed"
end
@usessl = true
+ @sock = SSLSocket.new(@sock)
# verify the server.
- context = SSLContext::new()
- context.ca_file = certs if certs && FileTest::file?(certs)
- context.ca_path = certs if certs && FileTest::directory?(certs)
- context.verify_mode = VERIFY_PEER if verify
+ @sock.ca_file = certs if certs && FileTest::file?(certs)
+ @sock.ca_path = certs if certs && FileTest::directory?(certs)
+ @sock.verify_mode = VERIFY_PEER if verify
if defined?(VerifyCallbackProc)
- context.verify_callback = VerifyCallbackProc
+ @sock.verify_callback = VerifyCallbackProc
end
- @sock = SSLSocket.new(@sock, context)
@sock.connect # start ssl session.
else
@usessl = false
@@ -1267,7 +1266,7 @@ module Net
buf.concat(c)
i += 1
elsif (c & 0xe0) == 0xc0 &&
- len >= 2 &&
+ inlen >= 2 &&
(s[i + 1] & 0xc0) == 0x80
if c == 0xc0 || c == 0xc1
raise DataFormatError, format("non-shortest UTF-8 sequence (%02x)", c)
diff --git a/lib/net/pop.rb b/lib/net/pop.rb
index b76124156b..a4f50b002c 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -15,7 +15,7 @@
# NOTE: You can find Japanese version of this document in
# the doc/net directory of the standard ruby interpreter package.
#
-# $Id: pop.rb,v 1.62.2.4 2005/09/13 07:27:18 aamine Exp $
+# $Id$
#
# See Net::POP3 for documentation.
#
@@ -190,7 +190,7 @@ module Net
#
class POP3 < Protocol
- Revision = %q$Revision: 1.62.2.4 $.split[1]
+ Revision = %q$Revision$.split[1]
#
# Class Parameters
@@ -435,7 +435,7 @@ module Net
end
def do_start( account, password )
- @socket = self.class.socket_type.old_open(@address, @port,
+ @socket = self.class.socket_type.open(@address, @port,
@open_timeout, @read_timeout, @debug_output)
on_connect
@command = POP3Command.new(@socket)
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index 0fee78c63a..ac6bce1058 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -2,8 +2,8 @@
# = net/protocol.rb
#
#--
-# Copyright (c) 1999-2005 Yukihiro Matsumoto
-# Copyright (c) 1999-2005 Minero Aoki
+# Copyright (c) 1999-2004 Yukihiro Matsumoto
+# Copyright (c) 1999-2004 Minero Aoki
#
# written and maintained by Minero Aoki <aamine@loveruby.net>
#
@@ -11,7 +11,7 @@
# modify this program under the same terms as Ruby itself,
# Ruby Distribute License or GNU General Public License.
#
-# $Id: protocol.rb,v 1.73.2.3 2005/09/13 07:27:18 aamine Exp $
+# $Id$
#++
#
# WARNING: This file is going to remove.
@@ -25,7 +25,7 @@ module Net # :nodoc:
class Protocol #:nodoc: internal use only
private
- def Protocol.protocol_param(name, val)
+ def Protocol.protocol_param( name, val )
module_eval(<<-End, __FILE__, __LINE__ + 1)
def #{name}
#{val}
@@ -34,7 +34,6 @@ module Net # :nodoc:
end
end
-
class ProtocolError < StandardError; end
class ProtoSyntaxError < ProtocolError; end
class ProtoFatalError < ProtocolError; end
@@ -46,282 +45,335 @@ module Net # :nodoc:
ProtocRetryError = ProtoRetriableError
- class BufferedIO #:nodoc: internal use only
- def initialize(io)
- @io = io
- @read_timeout = 60
- @debug_output = nil
- @rbuf = ''
+ class InternetMessageIO #:nodoc: internal use only
+
+ class << self
+ alias open new
+ end
+
+ def initialize( addr, port,
+ open_timeout = nil, read_timeout = nil,
+ debug_output = nil )
+ @address = addr
+ @port = port
+ @read_timeout = read_timeout
+ @debug_output = debug_output
+ @socket = nil
+ @rbuf = nil # read buffer
+ @wbuf = nil # write buffer
+ connect open_timeout
+ LOG 'opened'
+ end
+
+ attr_reader :address
+ attr_reader :port
+
+ def ip_address
+ return '' unless @socket
+ @socket.addr[3]
end
- attr_reader :io
attr_accessor :read_timeout
- attr_accessor :debug_output
- def inspect
- "#<#{self.class} io=#{@io}>"
+ attr_reader :socket
+
+ def connect( open_timeout )
+ LOG "opening connection to #{@address}..."
+ timeout(open_timeout) {
+ @socket = TCPsocket.new(@address, @port)
+ }
+ @rbuf = ''
+ end
+ private :connect
+
+ def close
+ if @socket
+ @socket.close
+ LOG 'closed'
+ else
+ LOG 'close call for already closed socket'
+ end
+ @socket = nil
+ @rbuf = ''
+ end
+
+ def reopen( open_timeout = nil )
+ LOG 'reopening...'
+ close
+ connect open_timeout
+ LOG 'reopened'
end
def closed?
- @io.closed?
+ not @socket
end
- def close
- @io.close
+ def inspect
+ "#<#{self.class} #{closed?() ? 'closed' : 'opened'}>"
end
- #
- # Read
- #
+ ###
+ ### READ
+ ###
public
- def read(len, dest = '', ignore_eof = false)
+ def read( len, dest = '', ignore_eof = false )
LOG "reading #{len} bytes..."
+ # LOG_off() # experimental: [ruby-list:38800]
read_bytes = 0
begin
while read_bytes + @rbuf.size < len
- dest << (s = rbuf_consume(@rbuf.size))
- read_bytes += s.size
+ read_bytes += rbuf_moveto(dest, @rbuf.size)
rbuf_fill
end
- dest << (s = rbuf_consume(len - read_bytes))
- read_bytes += s.size
+ rbuf_moveto dest, len - read_bytes
rescue EOFError
raise unless ignore_eof
end
+ # LOG_on()
LOG "read #{read_bytes} bytes"
dest
end
- def read_all(dest = '')
+ def read_all( dest = '' )
LOG 'reading all...'
+ # LOG_off() # experimental: [ruby-list:38800]
read_bytes = 0
begin
while true
- dest << (s = rbuf_consume(@rbuf.size))
- read_bytes += s.size
+ read_bytes += rbuf_moveto(dest, @rbuf.size)
rbuf_fill
end
rescue EOFError
;
end
+ # LOG_on()
LOG "read #{read_bytes} bytes"
dest
end
- def readuntil(terminator, ignore_eof = false)
+ def readuntil( terminator, ignore_eof = false )
+ dest = ''
begin
until idx = @rbuf.index(terminator)
rbuf_fill
end
- return rbuf_consume(idx + terminator.size)
+ rbuf_moveto dest, idx + terminator.size
rescue EOFError
raise unless ignore_eof
- return rbuf_consume(@rbuf.size)
+ rbuf_moveto dest, @rbuf.size
end
+ dest
end
def readline
readuntil("\n").chop
end
+ def each_message_chunk
+ LOG 'reading message...'
+ LOG_off()
+ read_bytes = 0
+ while (line = readuntil("\r\n")) != ".\r\n"
+ read_bytes += line.size
+ yield line.sub(/\A\./, '')
+ end
+ LOG_on()
+ LOG "read message (#{read_bytes} bytes)"
+ end
+
+ # *library private* (cannot handle 'break')
+ def each_list_item
+ while (str = readuntil("\r\n")) != ".\r\n"
+ yield str.chop
+ end
+ end
+
private
def rbuf_fill
timeout(@read_timeout) {
- @rbuf << @io.sysread(1024)
+ @rbuf << @socket.sysread(1024)
}
end
- def rbuf_consume(len)
- s = @rbuf.slice!(0, len)
+ def rbuf_moveto( dest, len )
+ dest << (s = @rbuf.slice!(0, len))
@debug_output << %Q[-> #{s.dump}\n] if @debug_output
- s
+ len
end
- #
- # Write
- #
+ ###
+ ### WRITE
+ ###
public
- def write(str)
+ def write( str )
writing {
write0 str
}
end
- def writeline(str)
+ def writeline( str )
writing {
write0 str + "\r\n"
}
end
+ def write_message( src )
+ LOG "writing message from #{src.class}"
+ LOG_off()
+ len = using_each_crlf_line {
+ write_message_0 src
+ }
+ LOG_on()
+ LOG "wrote #{len} bytes"
+ len
+ end
+
+ def write_message_by_block( &block )
+ LOG 'writing message from block'
+ LOG_off()
+ len = using_each_crlf_line {
+ begin
+ block.call(WriteAdapter.new(self, :write_message_0))
+ rescue LocalJumpError
+ # allow `break' from writer block
+ end
+ }
+ LOG_on()
+ LOG "wrote #{len} bytes"
+ len
+ end
+
private
def writing
@written_bytes = 0
@debug_output << '<- ' if @debug_output
yield
+ @socket.flush
@debug_output << "\n" if @debug_output
bytes = @written_bytes
@written_bytes = nil
bytes
end
- def write0(str)
+ def write0( str )
@debug_output << str.dump if @debug_output
- len = @io.write(str)
+ len = @socket.write(str)
@written_bytes += len
len
end
#
- # Logging
+ # Reads string from src calling :each, and write to @socket.
+ # Escapes '.' on the each line head.
#
-
- private
-
- def LOG_off
- @save_debug_out = @debug_output
- @debug_output = nil
- end
-
- def LOG_on
- @debug_output = @save_debug_out
- end
-
- def LOG(msg)
- return unless @debug_output
- @debug_output << msg + "\n"
- end
- end
-
-
- class InternetMessageIO < BufferedIO #:nodoc: internal use only
- def InternetMessageIO.old_open(addr, port,
- open_timeout = nil, read_timeout = nil, debug_output = nil)
- debug_output << "opening connection to #{addr}...\n" if debug_output
- s = timeout(open_timeout) { TCPsocket.new(addr, port) }
- io = new(s)
- io.read_timeout = read_timeout
- io.debug_output = debug_output
- io
- end
-
- def initialize(io)
- super
- @wbuf = nil
- end
-
- #
- # Read
- #
-
- def each_message_chunk
- LOG 'reading message...'
- LOG_off()
- read_bytes = 0
- while (line = readuntil("\r\n")) != ".\r\n"
- read_bytes += line.size
- yield line.sub(/\A\./, '')
- end
- LOG_on()
- LOG "read message (#{read_bytes} bytes)"
- end
-
- # *library private* (cannot handle 'break')
- def each_list_item
- while (str = readuntil("\r\n")) != ".\r\n"
- yield str.chop
- end
- end
-
- def write_message_0(src)
+ def write_message_0( src )
prev = @written_bytes
each_crlf_line(src) do |line|
- write0 line.sub(/\A\./, '..')
+ if line[0] == ?.
+ then write0 '.' + line
+ else write0 line
+ end
end
@written_bytes - prev
end
#
- # Write
+ # setup @wbuf for each_crlf_line.
#
-
- def write_message(src)
- LOG "writing message from #{src.class}"
- LOG_off()
- len = writing {
- using_each_crlf_line {
- write_message_0 src
- }
- }
- LOG_on()
- LOG "wrote #{len} bytes"
- len
- end
-
- def write_message_by_block(&block)
- LOG 'writing message from block'
- LOG_off()
- len = writing {
- using_each_crlf_line {
- begin
- block.call(WriteAdapter.new(self, :write_message_0))
- rescue LocalJumpError
- # allow `break' from writer block
+ def using_each_crlf_line
+ writing {
+ @wbuf = ''
+ yield
+ if not @wbuf.empty? # unterminated last line
+ if @wbuf[-1] == ?\r
+ @wbuf.chop!
+ end
+ @wbuf.concat "\r\n"
+ write0 @wbuf
+ elsif @written_bytes == 0 # empty src
+ write0 "\r\n"
end
- }
+ write0 ".\r\n"
+ @wbuf = nil
}
- LOG_on()
- LOG "wrote #{len} bytes"
- len
- end
-
- private
-
- def using_each_crlf_line
- @wbuf = ''
- yield
- if not @wbuf.empty? # unterminated last line
- write0 @wbuf.chomp + "\r\n"
- elsif @written_bytes == 0 # empty src
- write0 "\r\n"
- end
- write0 ".\r\n"
- @wbuf = nil
end
- def each_crlf_line(src)
- buffer_filling(@wbuf, src) do
- while line = @wbuf.slice!(/\A.*(?:\n|\r\n|\r(?!\z))/n)
- yield line.chomp("\n") + "\r\n"
+ #
+ # extract a CR-LF-terminating-line from @wbuf and yield it.
+ #
+ def each_crlf_line( src )
+ adding(src) do
+ beg = 0
+ buf = @wbuf
+ while buf.index(/\n|\r\n|\r/, beg)
+ m = Regexp.last_match
+ if (m.begin(0) == buf.length - 1) and buf[-1] == ?\r
+ # "...\r" : can follow "\n..."
+ break
+ end
+ str = buf[beg ... m.begin(0)]
+ str.concat "\r\n"
+ yield str
+ beg = m.end(0)
end
+ @wbuf = buf[beg ... buf.length]
end
end
- def buffer_filling(buf, src)
+ #
+ # Reads strings from SRC and add to @wbuf, then yield.
+ #
+ def adding( src )
case src
when String # for speeding up.
- 0.step(src.size - 1, 1024) do |i|
- buf << src[i, 1024]
+ 0.step(src.size - 1, 2048) do |i|
+ @wbuf << src[i,2048]
yield
end
+
when File # for speeding up.
- while s = src.read(1024)
- buf << s
+ while s = src.read(2048)
+ s[0,0] = @wbuf
+ @wbuf = s
yield
end
+
else # generic reader
src.each do |s|
- buf << s
- yield if buf.size > 1024
+ @wbuf << s
+ yield if @wbuf.size > 2048
end
- yield unless buf.empty?
+ yield unless @wbuf.empty?
end
end
+
+ ###
+ ### DEBUG
+ ###
+
+ private
+
+ def LOG_off
+ @save_debug_out = @debug_output
+ @debug_output = nil
+ end
+
+ def LOG_on
+ @debug_output = @save_debug_out
+ end
+
+ def LOG( msg )
+ return unless @debug_output
+ @debug_output << msg
+ @debug_output << "\n"
+ end
+
end
@@ -329,38 +381,41 @@ module Net # :nodoc:
# The writer adapter class
#
class WriteAdapter
- def initialize(socket, method)
- @socket = socket
- @method_id = method
+
+ def initialize( sock, mid )
+ @socket = sock
+ @method_id = mid
end
def inspect
"#<#{self.class} socket=#{@socket.inspect}>"
end
- def write(str)
+ def write( str )
@socket.__send__(@method_id, str)
end
alias print write
- def <<(str)
+ def <<( str )
write str
self
end
- def puts(str = '')
- write str.chomp("\n") + "\n"
+ def puts( str = '' )
+ write str.sub(/\n?/, "\n")
end
- def printf(*args)
+ def printf( *args )
write sprintf(*args)
end
+
end
class ReadAdapter #:nodoc: internal use only
- def initialize(block)
+
+ def initialize( block )
@block = block
end
@@ -368,18 +423,21 @@ module Net # :nodoc:
"#<#{self.class}>"
end
- def <<(str)
+ def <<( str )
call_block(str, &@block) if @block
end
private
+ #
# This method is needed because @block must be called by yield,
# not Proc#call. You can see difference when using `break' in
# the block.
- def call_block(str)
+ #
+ def call_block( str )
yield str
end
+
end
diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 89929b1c6e..db54b998c9 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -15,7 +15,7 @@
# NOTE: You can find Japanese version of this document in
# the doc/net directory of the standard ruby interpreter package.
#
-# $Id: smtp.rb,v 1.69.2.3 2005/09/13 07:27:18 aamine Exp $
+# $Id$
#
# See Net::SMTP for documentation.
#
@@ -163,7 +163,7 @@ module Net
#
class SMTP
- Revision = %q$Revision: 1.69.2.3 $.split[1]
+ Revision = %q$Revision$.split[1]
# The default SMTP port, port 25.
def SMTP.default_port
@@ -390,7 +390,7 @@ module Net
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret, authtype if user or secret
- @socket = InternetMessageIO.old_open(@address, @port,
+ @socket = InternetMessageIO.open(@address, @port,
@open_timeout, @read_timeout,
@debug_output)
check_response(critical { recv_response() })
diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb
index a2f6065dd7..05691de0f7 100644
--- a/lib/net/telnet.rb
+++ b/lib/net/telnet.rb
@@ -164,7 +164,7 @@ module Net
CR = "\015"
LF = "\012"
EOL = CR + LF
- REVISION = '$Id: telnet.rb,v 1.23.2.4 2005/09/14 15:21:31 matz Exp $'
+ REVISION = '$Id$'
# :startdoc:
#
@@ -551,7 +551,7 @@ module Net
raise TimeoutError, "timed out while waiting for more data"
end
begin
- c = @sock.readpartial(1024 * 1024)
+ c = @sock.sysread(1024 * 1024)
@dumplog.log_dump('<', c) if @options.has_key?("Dump_log")
if @options["Telnetmode"]
c = rest + c
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index d69f7dbe41..8d0353bbc9 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -1,3 +1,59 @@
+#= open-uri.rb
+#
+#open-uri.rb is easy-to-use wrapper for net/http and net/ftp.
+#
+#== Example
+#
+#It is possible to open http/ftp URL as usual a file:
+#
+# open("http://www.ruby-lang.org/") {|f|
+# f.each_line {|line| p line}
+# }
+#
+#The opened file has several methods for meta information as follows since
+#it is extended by OpenURI::Meta.
+#
+# open("http://www.ruby-lang.org/en") {|f|
+# f.each_line {|line| p line}
+# p f.base_uri # <URI::HTTP:0x40e6ef2 URL:http://www.ruby-lang.org/en/>
+# p f.content_type # "text/html"
+# p f.charset # "iso-8859-1"
+# p f.content_encoding # []
+# p f.last_modified # Thu Dec 05 02:45:02 UTC 2002
+# }
+#
+#Additional header fields can be specified by an optional hash argument.
+#
+# open("http://www.ruby-lang.org/en/",
+# "User-Agent" => "Ruby/#{RUBY_VERSION}",
+# "From" => "foo@bar.invalid",
+# "Referer" => "http://www.ruby-lang.org/") {|f|
+# ...
+# }
+#
+#The environment variables such as http_proxy and ftp_proxy are in effect by
+#default. :proxy => nil disables proxy.
+#
+# open("http://www.ruby-lang.org/en/raa.html",
+# :proxy => nil) {|f|
+# ...
+# }
+#
+#URI objects can be opened in similar way.
+#
+# uri = URI.parse("http://www.ruby-lang.org/en/")
+# uri.open {|f|
+# ...
+# }
+#
+#URI objects can be read directly.
+#The returned string is also extended by OpenURI::Meta.
+#
+# str = uri.read
+# p str.base_uri
+#
+#Author:: Tanaka Akira <akr@m17n.org>
+
require 'uri'
require 'stringio'
require 'time'
@@ -16,11 +72,10 @@ module Kernel
#
# Otherwise original open is called.
#
- # Since open-uri.rb provides URI::HTTP#open, URI::HTTPS#open and
- # URI::FTP#open,
+ # Since open-uri.rb provides URI::HTTP#open and URI::FTP#open,
# Kernel[#.]open can accepts such URIs and strings which begins with
- # http://, https:// and ftp://.
- # In these case, the opened file object is extended by OpenURI::Meta.
+ # http:// and ftp://. In this http and ftp case, the opened file object
+ # is extended by OpenURI::Meta.
def open(name, *rest, &block) # :doc:
if name.respond_to?(:open)
name.open(*rest, &block)
@@ -35,67 +90,14 @@ module Kernel
module_function :open
end
-# OpenURI is an easy-to-use wrapper for net/http, net/https and net/ftp.
-#
-#== Example
-#
-# It is possible to open http/https/ftp URL as usual like opening a file:
-#
-# open("http://www.ruby-lang.org/") {|f|
-# f.each_line {|line| p line}
-# }
-#
-# The opened file has several methods for meta information as follows since
-# it is extended by OpenURI::Meta.
-#
-# open("http://www.ruby-lang.org/en") {|f|
-# f.each_line {|line| p line}
-# p f.base_uri # <URI::HTTP:0x40e6ef2 URL:http://www.ruby-lang.org/en/>
-# p f.content_type # "text/html"
-# p f.charset # "iso-8859-1"
-# p f.content_encoding # []
-# p f.last_modified # Thu Dec 05 02:45:02 UTC 2002
-# }
-#
-# Additional header fields can be specified by an optional hash argument.
-#
-# open("http://www.ruby-lang.org/en/",
-# "User-Agent" => "Ruby/#{RUBY_VERSION}",
-# "From" => "foo@bar.invalid",
-# "Referer" => "http://www.ruby-lang.org/") {|f|
-# # ...
-# }
-#
-# The environment variables such as http_proxy, https_proxy and ftp_proxy
-# are in effect by default. :proxy => nil disables proxy.
-#
-# open("http://www.ruby-lang.org/en/raa.html", :proxy => nil) {|f|
-# # ...
-# }
-#
-# URI objects can be opened in a similar way.
-#
-# uri = URI.parse("http://www.ruby-lang.org/en/")
-# uri.open {|f|
-# # ...
-# }
-#
-# URI objects can be read directly. The returned string is also extended by
-# OpenURI::Meta.
-#
-# str = uri.read
-# p str.base_uri
-#
-# Author:: Tanaka Akira <akr@m17n.org>
-
module OpenURI
Options = {
:proxy => true,
:progress_proc => true,
:content_length_proc => true,
- :http_basic_authentication => true,
}
+
def OpenURI.check_options(options) # :nodoc:
options.each {|k, v|
next unless Symbol === k
@@ -161,7 +163,11 @@ module OpenURI
while true
redirect = catch(:open_uri_redirect) {
buf = Buffer.new
- uri.buffer_open(buf, find_proxy.call(uri), options)
+ if proxy_uri = find_proxy.call(uri)
+ proxy_uri.proxy_open(buf, uri, options)
+ else
+ uri.direct_open(buf, options)
+ end
nil
}
if redirect
@@ -173,11 +179,6 @@ module OpenURI
unless OpenURI.redirectable?(uri, redirect)
raise "redirection forbidden: #{uri} -> #{redirect}"
end
- if options.include? :http_basic_authentication
- # send authentication only for the URI directly specified.
- options = options.dup
- options.delete :http_basic_authentication
- end
uri = redirect
raise "HTTP redirection loop: #{uri}" if uri_set.include? uri.to_s
uri_set[uri.to_s] = true
@@ -198,96 +199,6 @@ module OpenURI
(/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:http|ftp)\z/i =~ uri2.scheme)
end
- def OpenURI.open_http(buf, target, proxy, options) # :nodoc:
- if proxy
- raise "Non-HTTP proxy URI: #{proxy}" if proxy.class != URI::HTTP
- end
-
- if target.userinfo && "1.9.0" <= RUBY_VERSION
- # don't raise for 1.8 because compatibility.
- raise ArgumentError, "userinfo not supported. [RFC3986]"
- end
-
- require 'net/http'
- klass = Net::HTTP
- if URI::HTTP === target
- # HTTP or HTTPS
- if proxy
- klass = Net::HTTP::Proxy(proxy.host, proxy.port)
- end
- target_host = target.host
- target_port = target.port
- request_uri = target.request_uri
- else
- # FTP over HTTP proxy
- target_host = proxy.host
- target_port = proxy.port
- request_uri = target.to_s
- end
-
- http = klass.new(target_host, target_port)
- if target.class == URI::HTTPS
- require 'net/https'
- http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
- store = OpenSSL::X509::Store.new
- store.set_default_paths
- http.cert_store = store
- end
-
- header = {}
- options.each {|k, v| header[k] = v if String === k }
-
- resp = nil
- http.start {
- if target.class == URI::HTTPS
- # xxx: information hiding violation
- sock = http.instance_variable_get(:@socket)
- if sock.respond_to?(:io)
- sock = sock.io # 1.9
- else
- sock = sock.instance_variable_get(:@socket) # 1.8
- end
- sock.post_connection_check(target_host)
- end
- req = Net::HTTP::Get.new(request_uri, header)
- if options.include? :http_basic_authentication
- user, pass = options[:http_basic_authentication]
- req.basic_auth user, pass
- end
- http.request(req) {|response|
- resp = response
- if options[:content_length_proc] && Net::HTTPSuccess === resp
- if resp.key?('Content-Length')
- options[:content_length_proc].call(resp['Content-Length'].to_i)
- else
- options[:content_length_proc].call(nil)
- end
- end
- resp.read_body {|str|
- buf << str
- if options[:progress_proc] && Net::HTTPSuccess === resp
- options[:progress_proc].call(buf.size)
- end
- }
- }
- }
- io = buf.io
- io.rewind
- io.status = [resp.code, resp.message]
- resp.each {|name,value| buf.io.meta_add_field name, value }
- case resp
- when Net::HTTPSuccess
- when Net::HTTPMovedPermanently, # 301
- Net::HTTPFound, # 302
- Net::HTTPSeeOther, # 303
- Net::HTTPTemporaryRedirect # 307
- throw :open_uri_redirect, URI.parse(resp['location'])
- else
- raise OpenURI::HTTPError.new(io.status.join(' '), io)
- end
- end
-
class HTTPError < StandardError
def initialize(message, io)
super(message)
@@ -311,14 +222,14 @@ module OpenURI
require 'tempfile'
io = Tempfile.new('open-uri')
io.binmode
- Meta.init io, @io if @io.respond_to? :meta
+ Meta.init io, @io if Meta === @io
io << @io.string
@io = io
end
end
def io
- Meta.init @io unless @io.respond_to? :meta
+ Meta.init @io unless Meta === @io
@io
end
end
@@ -366,7 +277,7 @@ module OpenURI
RE_LWS = /[\r\n\t ]+/n
RE_TOKEN = %r{[^\x00- ()<>@,;:\\"/\[\]?={}\x7f]+}n
- RE_QUOTED_STRING = %r{"(?:[\r\n\t !#-\[\]-~\x80-\xff]|\\[\x00-\x7f])*"}n
+ RE_QUOTED_STRING = %r{"(?:[\r\n\t !#-\[\]-~\x80-\xff]|\\[\x00-\x7f])"}n
RE_PARAMETERS = %r{(?:;#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?=#{RE_LWS}?(?:#{RE_TOKEN}|#{RE_QUOTED_STRING})#{RE_LWS}?)*}n
def content_type_parse # :nodoc:
@@ -451,75 +362,60 @@ module OpenURI
# field for HTTP.
# I.e. it is ignored for FTP without HTTP proxy.
#
- # The hash may include other options which key is a symbol:
+ # The hash may include other option which key is a symbol:
+ #
+ # :proxy => "http://proxy.foo.com:8000/"
+ # :proxy => URI.parse("http://proxy.foo.com:8000/")
+ # :proxy => true
+ # :proxy => false
+ # :proxy => nil
+ #
+ # If :proxy option is specified, the value should be String, URI,
+ # boolean or nil.
+ # When String or URI is given, it is treated as proxy URI.
+ # When true is given or the option itself is not specified,
+ # environment variable `scheme_proxy'(or `SCHEME_PROXY') is examined.
+ # `scheme' is replaced by `http' or `ftp'.
+ # When false or nil is given, the environment variables are ignored and
+ # connection will be made to a server directly.
#
- # [:proxy]
- # Synopsis:
- # :proxy => "http://proxy.foo.com:8000/"
- # :proxy => URI.parse("http://proxy.foo.com:8000/")
- # :proxy => true
- # :proxy => false
- # :proxy => nil
- #
- # If :proxy option is specified, the value should be String, URI,
- # boolean or nil.
- # When String or URI is given, it is treated as proxy URI.
- # When true is given or the option itself is not specified,
- # environment variable `scheme_proxy' is examined.
- # `scheme' is replaced by `http', `https' or `ftp'.
- # When false or nil is given, the environment variables are ignored and
- # connection will be made to a server directly.
+ # :content_length_proc => lambda {|content_length| ... }
#
- # [:http_basic_authentication]
- # Synopsis:
- # :http_basic_authentication=>[user, password]
+ # If :content_length_proc option is specified, the option value procedure
+ # is called before actual transfer is started.
+ # It takes one argument which is expected content length in bytes.
#
- # If :http_basic_authentication is specified,
- # the value should be an array which contains 2 strings:
- # username and password.
- # It is used for HTTP Basic authentication defined by RFC 2617.
+ # If two or more transfer is done by HTTP redirection, the procedure
+ # is called only one for a last transfer.
#
- # [:content_length_proc]
- # Synopsis:
- # :content_length_proc => lambda {|content_length| ... }
- #
- # If :content_length_proc option is specified, the option value procedure
- # is called before actual transfer is started.
- # It takes one argument which is expected content length in bytes.
- #
- # If two or more transfer is done by HTTP redirection, the procedure
- # is called only one for a last transfer.
- #
- # When expected content length is unknown, the procedure is called with
- # nil.
- # It is happen when HTTP response has no Content-Length header.
+ # When expected content length is unknown, the procedure is called with
+ # nil.
+ # It is happen when HTTP response has no Content-Length header.
#
- # [:progress_proc]
- # Synopsis:
- # :progress_proc => lambda {|size| ...}
+ # :progress_proc => lambda {|size| ...}
#
- # If :progress_proc option is specified, the proc is called with one
- # argument each time when `open' gets content fragment from network.
- # The argument `size' `size' is a accumulated transfered size in bytes.
+ # If :progress_proc option is specified, the proc is called with one
+ # argument each time when `open' gets content fragment from network.
+ # The argument `size' `size' is a accumulated transfered size in bytes.
#
- # If two or more transfer is done by HTTP redirection, the procedure
- # is called only one for a last transfer.
+ # If two or more transfer is done by HTTP redirection, the procedure
+ # is called only one for a last transfer.
#
- # :progress_proc and :content_length_proc are intended to be used for
- # progress bar.
- # For example, it can be implemented as follows using Ruby/ProgressBar.
+ # :progress_proc and :content_length_proc are intended to be used for
+ # progress bar.
+ # For example, it can be implemented as follows using Ruby/ProgressBar.
#
- # pbar = nil
- # open("http://...",
- # :content_length_proc => lambda {|t|
- # if t && 0 < t
- # pbar = ProgressBar.new("...", t)
- # pbar.file_transfer_mode
- # end
- # },
- # :progress_proc => lambda {|s|
- # pbar.set s if pbar
- # }) {|f| ... }
+ # pbar = nil
+ # open("http://...",
+ # :content_length_proc => lambda {|t|
+ # if t && 0 < t
+ # pbar = ProgressBar.new("...", t)
+ # pbar.file_transfer_mode
+ # end
+ # },
+ # :progress_proc => lambda {|s|
+ # pbar.set s if pbar
+ # }) {|f| ... }
#
# OpenURI::OpenRead#open returns an IO like object if block is not given.
# Otherwise it yields the IO object and return the value of the block.
@@ -604,6 +500,9 @@ module URI
if proxy_uri
proxy_uri = URI.parse(proxy_uri)
+ unless URI::HTTP === proxy_uri
+ raise "Non-HTTP proxy URI: #{proxy_uri}"
+ end
name = 'no_proxy'
if no_proxy = ENV[name] || ENV[name.upcase]
no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port|
@@ -622,60 +521,83 @@ module URI
end
class HTTP
- def buffer_open(buf, proxy, options) # :nodoc:
- OpenURI.open_http(buf, self, proxy, options)
+ def direct_open(buf, options) # :nodoc:
+ proxy_open(buf, request_uri, options)
end
- include OpenURI::OpenRead
- end
-
- class FTP
- def buffer_open(buf, proxy, options) # :nodoc:
- if proxy
- OpenURI.open_http(buf, self, proxy, options)
- return
+ def proxy_open(buf, uri, options) # :nodoc:
+ header = {}
+ options.each {|k, v| header[k] = v if String === k }
+
+ if uri.respond_to? :host
+ # According to RFC2616 14.23, Host: request-header field should be set
+ # an origin server.
+ # But net/http wrongly set a proxy server if an absolute URI is
+ # specified as a request URI.
+ # So open-uri override it here explicitly.
+ header['host'] = uri.host
+ header['host'] += ":#{uri.port}" if uri.port
end
- require 'net/ftp'
- directories = self.path.split(%r{/}, -1)
- directories.shift if directories[0] == '' # strip a field before leading slash
- directories.each {|d|
- d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
- }
- unless filename = directories.pop
- raise ArgumentError, "no filename: #{self.inspect}"
- end
- directories.each {|d|
- if /[\r\n]/ =~ d
- raise ArgumentError, "invalid directory: #{d.inspect}"
- end
+ require 'net/http'
+ resp = nil
+ Net::HTTP.start(self.host, self.port) {|http|
+ http.request_get(uri.to_s, header) {|response|
+ resp = response
+ if options[:content_length_proc] && Net::HTTPSuccess === resp
+ if resp.key?('Content-Length')
+ options[:content_length_proc].call(resp['Content-Length'].to_i)
+ else
+ options[:content_length_proc].call(nil)
+ end
+ end
+ resp.read_body {|str|
+ buf << str
+ if options[:progress_proc] && Net::HTTPSuccess === resp
+ options[:progress_proc].call(buf.size)
+ end
+ }
+ }
}
- if /[\r\n]/ =~ filename
- raise ArgumentError, "invalid filename: #{filename.inspect}"
- end
- typecode = self.typecode
- if typecode && /\A[aid]\z/ !~ typecode
- raise ArgumentError, "invalid typecode: #{typecode.inspect}"
+ io = buf.io
+ io.rewind
+ io.status = [resp.code, resp.message]
+ resp.each {|name,value| buf.io.meta_add_field name, value }
+ case resp
+ when Net::HTTPSuccess
+ when Net::HTTPMovedPermanently, # 301
+ Net::HTTPFound, # 302
+ Net::HTTPSeeOther, # 303
+ Net::HTTPTemporaryRedirect # 307
+ throw :open_uri_redirect, URI.parse(resp['location'])
+ else
+ raise OpenURI::HTTPError.new(io.status.join(' '), io)
end
+ end
- # The access sequence is defined by RFC 1738
- ftp = Net::FTP.open(self.host)
+ include OpenURI::OpenRead
+ end
+
+ class HTTPS
+ def proxy_open(buf, uri, options) # :nodoc:
+ raise ArgumentError, "open-uri doesn't support https."
+ end
+ end
+
+ class FTP
+ def direct_open(buf, options) # :nodoc:
+ require 'net/ftp'
# todo: extract user/passwd from .netrc.
user = 'anonymous'
passwd = nil
user, passwd = self.userinfo.split(/:/) if self.userinfo
+
+ ftp = Net::FTP.open(self.host)
ftp.login(user, passwd)
- directories.each {|cwd|
- ftp.voidcmd("CWD #{cwd}")
- }
- if typecode
- # xxx: typecode D is not handled.
- ftp.voidcmd("TYPE #{typecode.upcase}")
- end
if options[:content_length_proc]
- options[:content_length_proc].call(ftp.size(filename))
+ options[:content_length_proc].call(ftp.size(self.path))
end
- ftp.retrbinary("RETR #{filename}", 4096) { |str|
+ ftp.getbinaryfile(self.path, '/dev/null', Net::FTP::DEFAULT_BLOCKSIZE) {|str|
buf << str
options[:progress_proc].call(buf.size) if options[:progress_proc]
}
diff --git a/lib/open3.rb b/lib/open3.rb
index f722252b1c..407cd7662c 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -3,24 +3,12 @@
# which IO#popen does not allow)
#
# Usage:
+# require "open3"
#
-# require "open3"
-#
-# stdin, stdout, stderr = Open3.popen3('nroff -man')
-#
-# or:
-#
-# include Open3
-#
-# stdin, stdout, stderr = popen3('nroff -man')
-#
-# popen3 can also take a block which will receive stdin, stdout and stderr as
-# parameters. This ensures stdin, stdout and stderr are closed once the block
-# exits.
-#
-# Such as:
-#
-# Open3.popen3('nroff -man') { |stdin, stdout, stderr| ... }
+# stdin, stdout, stderr = Open3.popen3('nroff -man')
+# or
+# include Open3
+# stdin, stdout, stderr = popen3('nroff -man')
module Open3
#[stdin, stdout, stderr] = popen3(command);
@@ -47,7 +35,7 @@ module Open3
exec(*cmd)
}
- exit!(0)
+ exit!
}
pw[0].close
diff --git a/lib/optparse.rb b/lib/optparse.rb
index c1df9586c8..aa2555f6f7 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -25,22 +25,24 @@
#
# === Object relationship diagram
#
-# +--------------+
-# | OptionParser |<>-----+
-# +--------------+ | +--------+
-# | ,-| Switch |
-# on_head -------->+---------------+ / +--------+
-# accept/reject -->| List |<|>-
-# | |<|>- +----------+
-# on ------------->+---------------+ `-| argument |
-# : : | class |
-# +---------------+ |==========|
-# on_tail -------->| | |pattern |
-# +---------------+ |----------|
-# OptionParser.accept ->| DefaultList | |converter |
-# reject |(shared between| +----------+
-# | all instances)|
-# +---------------+
+# +--------------+
+# | OptionParser |<>-----+
+# +--------------+ | +--------+
+# | ,-| Switch |
+# on_head -------->+---------------+ / +--------+
+# accept/reject -->| List |<|>-
+# | |<|>- +----------+
+# on ------------->+---------------+ `-| argument |
+# : : | class |
+# +---------------+ |==========|
+# on_tail -------->| | |pattern |
+# +---------------+ |----------|
+# OptionParser.accept ->| DefaultList | |converter |
+# reject |(shared between| +----------+
+# | all instances)|
+# +---------------+
+
+
#
# == OptionParser
#
@@ -52,33 +54,17 @@
#
# === Features
#
-# 1. The argument specification and the code to handle it are written in the
-# same place.
+# 1. The argument specification and the code to handle it are written in the same
+# place.
# 2. It can output an option summary; you don't need to maintain this string
# separately.
# 3. Optional and mandatory arguments are specified very gracefully.
# 4. Arguments can be automatically converted to a specified class.
# 5. Arguments can be restricted to a certain set.
#
-# All of these features are demonstrated in the examples below.
-#
-# === Minimal example
-#
-# require 'optparse'
-#
-# options = {}
-# OptionParser.new do |opts|
-# opts.banner = "Usage: example.rb [options]"
-#
-# opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
-# options[:verbose] = v
-# end
-# end.parse!
-#
-# p options
-# p ARGV
+# All of these features are demonstrated in the example below.
#
-# === Complete example
+# === Example
#
# The following example is a complete Ruby program. You can run it and see the
# effect of specifying various options. This is probably the best way to learn
@@ -195,15 +181,18 @@
# options = OptparseExample.parse(ARGV)
# pp options
#
+# Note: some bugs were fixed between 1.8.0 and 1.8.1. If you experience trouble
+# with the above code, keep this in mind.
+#
# === Further documentation
#
-# The above examples should be enough to learn how to use this class. If you
-# have any questions, email me (gsinclair@soyabean.com.au) and I will update
-# this document.
+# The methods are not individually documented at this stage. The above example
+# should be enough to learn how to use this class. If you have any questions,
+# email me (gsinclair@soyabean.com.au) and I will update this document.
#
class OptionParser
# :stopdoc:
- RCSID = %w$Id: optparse.rb,v 1.40.2.12 2006/08/04 22:00:21 drbrain Exp $[1..-1].each {|s| s.freeze}.freeze
+ RCSID = %w$Id$[1..-1].each {|s| s.freeze}.freeze
Version = (RCSID[1].split('.').collect {|s| s.to_i}.extend(Comparable).freeze if RCSID[1])
LastModified = (Time.gm(*RCSID[2, 2].join('-').scan(/\d+/).collect {|s| s.to_i}) if RCSID[2])
Release = RCSID[2]
@@ -317,8 +306,15 @@ class OptionParser
end
#
- # Parses +arg+ and returns rest of +arg+ and matched portion to the
- # argument pattern. Yields when the pattern doesn't match substring.
+ # OptionParser::Switch#parse_arg(arg) {non-serious error handler}
+ #
+ # Parses argument and returns rest of ((|arg|)), and matched portion
+ # to the argument pattern.
+ # :Parameters:
+ # : ((|arg|))
+ # option argument to be parsed.
+ # : (({block}))
+ # yields when the pattern doesn't match sub-string.
#
def parse_arg(arg)
pattern or return nil, arg
@@ -341,9 +337,20 @@ class OptionParser
private :parse_arg
#
- # Parses argument, converts and returns +arg+, +block+ and result of
- # conversion. Yields at semi-error condition instead of raising an
- # exception.
+ # OptionParser::Switch#conv_arg(arg, val) {semi-error handler}
+ #
+ # Parses argument, convert and returns ((|arg|)), ((|block|)) and
+ # result of conversion.
+ # : Arguments to ((|@conv|))
+ # substrings matched to ((|@pattern|)), ((|$&|)), ((|$1|)),
+ # ((|$2|)) and so on.
+ # :Parameters:
+ # : ((|arg|))
+ # argument string follows the switch.
+ # : ((|val|))
+ # following argument.
+ # : (({block}))
+ # (({yields})) at semi-error condition, instead of raises exception.
#
def conv_arg(arg, val = nil)
if block
@@ -360,16 +367,23 @@ class OptionParser
private :conv_arg
#
- # Produces the summary text. Each line of the summary is yielded to the
- # block (without newline).
+ # OptionParser::Switch#summarize(sdone, ldone, width, max, indent)
#
- # +sdone+:: Already summarized short style options keyed hash.
- # +ldone+:: Already summarized long style options keyed hash.
- # +width+:: Width of left side (option part). In other words, the right
- # side (description part) starts after +width+ columns.
- # +max+:: Maximum width of left side -> the options are filled within
- # +max+ columns.
- # +indent+:: Prefix string indents all summarized lines.
+ # Makes summary strings.
+ # :Parameters:
+ # : ((|sdone|))
+ # already summarized short style options keyed hash.
+ # : ((|ldone|))
+ # already summarized long style options keyed hash.
+ # : ((|width|))
+ # width of left side, option part. in other word, right side,
+ # description part strings start at ((|width|)) column.
+ # : ((|max|))
+ # maximum width of left side, options are filled within ((|max|)) columns.
+ # : ((|indent|))
+ # prefix string indents each summarized lines.
+ # : (({block}))
+ # to be passed each lines(without newline).
#
def summarize(sdone = [], ldone = [], width = 1, max = width - 1, indent = "")
sopts, lopts, s = [], [], nil
@@ -406,7 +420,6 @@ class OptionParser
# Switch that takes no arguments.
#
class NoArgument < self
-
#
# Raises an exception if any arguments given.
#
@@ -414,10 +427,8 @@ class OptionParser
yield(NeedlessArgument, arg) if arg
conv_arg(arg)
end
-
def self.incompatible_argument_styles(*)
end
-
def self.pattern
Object
end
@@ -427,16 +438,15 @@ class OptionParser
# Switch that takes an argument.
#
class RequiredArgument < self
-
#
# Raises an exception if argument is not present.
#
- def parse(arg, argv)
+ def parse(arg, argv, &error)
unless arg
raise MissingArgument if argv.empty?
arg = argv.shift
end
- conv_arg(*parse_arg(arg) {|*exc| raise(*exc)})
+ conv_arg(*parse_arg(arg, &error))
end
end
@@ -444,7 +454,6 @@ class OptionParser
# Switch that can omit argument.
#
class OptionalArgument < self
-
#
# Parses argument if given, or uses default value.
#
@@ -458,12 +467,11 @@ class OptionParser
end
#
- # Switch that takes an argument, which does not begin with '-'.
+ # ?
#
class PlacedArgument < self
-
#
- # Returns nil if argument is not present or begins with '-'.
+ # ?
#
def parse(arg, argv, &error)
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
@@ -483,8 +491,9 @@ class OptionParser
#
# Simple option list providing mapping from short and/or long option
- # string to OptionParser::Switch and mapping from acceptable argument to
- # matching pattern and converter pair. Also provides summary feature.
+ # string to ((<OptionParser::Switch>)), and mapping from acceptable
+ # argument to matching pattern and converter pair. Also provides
+ # summary feature.
#
class List
# Map from acceptable argument types to pattern and converter pairs.
@@ -512,7 +521,7 @@ class OptionParser
#
# See OptionParser.accept.
#
- def accept(t, pat = /.*/nm, &block)
+ def accept(t, pat = /.*/, &block)
if pat
pat.respond_to?(:match) or raise TypeError, "has no `match'"
else
@@ -532,12 +541,19 @@ class OptionParser
end
#
- # Adds +sw+ according to +sopts+, +lopts+ and +nlopts+.
+ # OptionParser::List#update(sw, sopts, lopts, nlopts = nil)
#
- # +sw+:: OptionParser::Switch instance to be added.
- # +sopts+:: Short style option list.
- # +lopts+:: Long style option list.
- # +nlopts+:: Negated long style options list.
+ # Adds ((|sw|)) according to ((|sopts|)), ((|lopts|)) and
+ # ((|nlopts|)).
+ # :Parameters:
+ # : ((|sw|))
+ # ((<OptionParser::Switch>)) instance to be added.
+ # : ((|sopts|))
+ # short style options list.
+ # : ((|lopts|))
+ # long style options list.
+ # : ((|nlopts|))
+ # negated long style options list.
#
def update(sw, sopts, lopts, nsw = nil, nlopts = nil)
o = nil
@@ -550,40 +566,45 @@ class OptionParser
private :update
#
- # Inserts +switch+ at the head of the list, and associates short, long
- # and negated long options. Arguments are:
- #
- # +switch+:: OptionParser::Switch instance to be inserted.
- # +short_opts+:: List of short style options.
- # +long_opts+:: List of long style options.
- # +nolong_opts+:: List of long style options with "no-" prefix.
- #
- # prepend(switch, short_opts, long_opts, nolong_opts)
+ # OptionParser::List#prepend(switch, short_opts, long_opts, nolong_opts)
#
+ # Inserts ((|switch|)) at head of the list, and associates short,
+ # long and negated long options.
def prepend(*args)
update(*args)
@list.unshift(args[0])
end
#
- # Appends +switch+ at the tail of the list, and associates short, long
- # and negated long options. Arguments are:
- #
- # +switch+:: OptionParser::Switch instance to be inserted.
- # +short_opts+:: List of short style options.
- # +long_opts+:: List of long style options.
- # +nolong_opts+:: List of long style options with "no-" prefix.
- #
- # append(switch, short_opts, long_opts, nolong_opts)
+ # OptionParser::List#append(switch, short_opts, long_opts, nolong_opts)
#
+ # Appends ((|switch|)) at tail of the list, and associates short,
+ # long and negated long options.
+ # :Parameters:
+ # : ((|switch|))
+ # ((<OptionParser::Switch>)) instance to be inserted.
+ # : ((|short_opts|))
+ # list of short style options.
+ # : ((|long_opts|))
+ # list of long style options.
+ # : ((|nolong_opts|))
+ # list of long style options with (({"no-"})) prefix.
def append(*args)
update(*args)
@list.push(args[0])
end
#
- # Searches +key+ in +id+ list. The result is returned or yielded if a
- # block is given. If it isn't found, nil is returned.
+ # OptionParser::List#search(id, key) [{block}]
+ #
+ # Searches ((|key|)) in ((|id|)) list.
+ # :Parameters:
+ # : ((|id|))
+ # searching list.
+ # : ((|k|))
+ # searching key.
+ # : (({block}))
+ # yielded with the found value when succeeded.
#
def search(id, key)
if list = __send__(id)
@@ -594,19 +615,35 @@ class OptionParser
end
#
- # Searches list +id+ for +opt+ and the optional patterns for completion
- # +pat+. If +icase+ is true, the search is case insensitive. The result
- # is returned or yielded if a block is given. If it isn't found, nil is
- # returned.
+ # OptionParser::List#complete(id, opt, *pat, &block)
+ #
+ # Searches list ((|id|)) for ((|opt|)) and ((|*pat|)).
+ # :Parameters:
+ # : ((|id|))
+ # searching list.
+ # : ((|opt|))
+ # searching key.
+ # : ((|icase|))
+ # search case insensitive if true.
+ # : ((|*pat|))
+ # optional pattern for completion.
+ # : (({block}))
+ # yielded with the found value when succeeded.
#
def complete(id, opt, icase = false, *pat, &block)
__send__(id).complete(opt, icase, *pat, &block)
end
#
- # Creates the summary table, passing each line to the +block+ (without
- # newline). The arguments +args+ are passed along to the summarize
- # method which is called on every option.
+ # OptionParser::List#summarize(*args) {...}
+ #
+ # Making summary table, yields the (({block})) with each lines.
+ # Each elements of (({@list})) should be able to (({summarize})).
+ # :Parameters:
+ # : ((|args|))
+ # passed to elements#summarize through.
+ # : (({block}))
+ # to be passed each lines(without newline).
#
def summarize(*args, &block)
list.each do |opt|
@@ -622,12 +659,14 @@ class OptionParser
end
#
- # Hash with completion search feature. See OptionParser::Completion.
+ # Hash with completion search feature. See Completion module.
#
class CompletingHash < Hash
include Completion
#
+ # OptionParser::CompletingHash#match(key)
+ #
# Completion for hash key.
#
def match(key)
@@ -637,19 +676,23 @@ class OptionParser
end
end
- # :stopdoc:
-
- #
- # Enumeration of acceptable argument styles. Possible values are:
#
- # NO_ARGUMENT:: The switch takes no arguments. (:NONE)
- # REQUIRED_ARGUMENT:: The switch requires an argument. (:REQUIRED)
- # OPTIONAL_ARGUMENT:: The switch requires an optional argument. (:OPTIONAL)
+ # OptionParser::ArgumentStyle
+ # Enumeration of acceptable argument styles; possible values are:
+ # : OptionParser::NO_ARGUMENT
+ # the switch takes no arguments. ((({:NONE})))
+ # : OptionParser::REQUIRED_ARGUMENT
+ # the switch requires an argument. ((({:REQUIRED})))
+ # : OptionParser::OPTIONAL_ARGUMENT
+ # the switch requires an optional argument, that is, may take or
+ # not. ((({:OPTIONAL})))
#
- # Use like --switch=argument (long style) or -Xargument (short style). For
- # short style, only portion matched to argument pattern is dealed as
- # argument.
+ # Use like (({--switch=argument}))(long style) or
+ # (({-Xargument}))(short style). For short style, only portion
+ # matched to ((<argument pattern>)) is dealed as argument.
#
+
+ # :stopdoc:
ArgumentStyle = {}
NoArgument.each {|el| ArgumentStyle[el] = Switch::NoArgument}
RequiredArgument.each {|el| ArgumentStyle[el] = Switch::RequiredArgument}
@@ -657,22 +700,24 @@ class OptionParser
ArgumentStyle.freeze
#
+ # OptionParser::DefaultList
+ #
# Switches common used such as '--', and also provides default
# argument classes
#
+
DefaultList = List.new
DefaultList.short['-'] = Switch::NoArgument.new {}
DefaultList.long[''] = Switch::NoArgument.new {throw :terminate}
#
+ # OptionParser::Officious
# Default options for ARGV, which never appear in option summary.
#
Officious = {}
- #
- # --help
- # Shows option summary.
- #
+ # --help
+ # Shows option summary.
Officious['help'] = proc do |parser|
Switch::NoArgument.new do
puts parser.help
@@ -680,10 +725,8 @@ class OptionParser
end
end
- #
- # --version
- # Shows version string if Version is defined.
- #
+ # --version
+ # Shows version string if (({::Version})) is defined.
Officious['version'] = proc do |parser|
Switch::OptionalArgument.new do |pkg|
if pkg
@@ -708,23 +751,34 @@ class OptionParser
# Class methods
#
- #
- # Initializes a new instance and evaluates the optional block in context
- # of the instance. Arguments +args+ are passed to #new, see there for
- # description of parameters.
- #
- # This method is *deprecated*, its behavior corresponds to the older #new
- # method.
- #
+=begin
+--- OptionParser.with([banner[, width[, indent]]]) [{...}]
+ Initializes new instance, and evaluates the block in context of
+ the instance if called as iterator. This behavior is equivalent
+ to older (({new})). This is ((*deprecated*)) method.
+
+ cf. ((<OptionParser.new>))
+ :Parameters:
+ : ((|banner|))
+ banner message.
+ : ((|width|))
+ summary width.
+ : ((|indent|))
+ summary indent.
+ : (({block}))
+ to be evaluated in the new instance context.
+=end #'#"#`#
def self.with(*args, &block)
opts = new(*args)
opts.instance_eval(&block)
opts
end
- #
- # Returns an incremented value of +default+ according to +arg+.
- #
+=begin
+--- OptionParser.inc(arg[, default])
+--- OptionParser#inc(arg[, default])
+ Returns incremented value of ((|default|)) according to ((|arg|)).
+=end
def self.inc(arg, default = nil)
case arg
when Integer
@@ -737,35 +791,45 @@ class OptionParser
self.class.inc(*args)
end
- #
- # Initializes the instance and yields itself if called with a block.
- #
- # +banner+:: Banner message.
- # +width+:: Summary width.
- # +indent+:: Summary indent.
- #
+=begin
+--- OptionParser.new([banner[, width[, indent]]]) [{...}]
+ Initializes the instance, and yields itself if called as iterator.
+ :Parameters:
+ : ((|banner|))
+ banner message.
+ : ((|width|))
+ summary width.
+ : ((|indent|))
+ summary indent.
+ : (({block}))
+ to be evaluated in the new instance context.
+=end #'#"#`#
def initialize(banner = nil, width = 32, indent = ' ' * 4)
@stack = [DefaultList, List.new, List.new]
@program_name = nil
@banner = banner
@summary_width = width
@summary_indent = indent
- @default_argv = ARGV
add_officious
yield self if block_given?
end
- def add_officious # :nodoc:
+ # :nodoc:
+ def add_officious
list = base()
Officious.each_pair do |opt, block|
list.long[opt] ||= block.call(self)
end
end
- #
- # Terminates option parsing. Optional parameter +arg+ is a string pushed
- # back to be the first non-option argument.
- #
+=begin
+--- OptionParser.terminate([arg])
+ Terminates option parsing. Optional parameter ((|arg|)) would be
+ pushed back if given.
+ :Parameters:
+ : ((|arg|))
+ string pushed back to be first non-option argument
+=end #'#"#`#
def terminate(arg = nil)
self.class.terminate(arg)
end
@@ -776,97 +840,90 @@ class OptionParser
@stack = [DefaultList]
def self.top() DefaultList end
- #
- # Directs to accept specified class +t+. The argument string is passed to
- # the block in which it should be converted to the desired class.
- #
- # +t+:: Argument class specifier, any object including Class.
- # +pat+:: Pattern for argument, defaults to +t+ if it responds to match.
- #
- # accept(t, pat, &block)
- #
+=begin
+--- OptionParser.accept(t, [pat]) {...}
+--- OptionParser#accept(t, [pat]) {...}
+ Directs to accept specified class argument.
+ :Parameters:
+ : ((|t|))
+ argument class specifier, any object including Class.
+ : ((|pat|))
+ pattern for argument, defaulted to ((|t|)) if it respond to (({match})).
+ : (({block}))
+ receives argument string and should be convert to desired class.
+=end #'#"#`#
def accept(*args, &blk) top.accept(*args, &blk) end
- #
- # See #accept.
- #
def self.accept(*args, &blk) top.accept(*args, &blk) end
- #
- # Directs to reject specified class argument.
- #
- # +t+:: Argument class speficier, any object including Class.
- #
- # reject(t)
- #
+=begin
+--- OptionParser.reject(t)
+--- OptionParser#reject(t)
+ Directs to reject specified class argument.
+ :Parameters:
+ : ((|t|))
+ argument class specifier, any object including Class.
+=end #'#"#`#
def reject(*args, &blk) top.reject(*args, &blk) end
- #
- # See #reject.
- #
def self.reject(*args, &blk) top.reject(*args, &blk) end
- #
- # Instance methods
- #
-
- # Heading banner preceding summary.
- attr_writer :banner
-
- # Program name to be emitted in error message and default banner,
- # defaults to $0.
- attr_writer :program_name
-
- # Width for option list portion of summary. Must be Numeric.
- attr_accessor :summary_width
+
+=begin
+=== Instance methods
+=end #'#"#`#
+
+=begin
+--- OptionParser#banner
+--- OptionParser#banner=(heading)
+ Heading banner preceding summary.
+--- OptionParser#summary_width
+--- OptionParser#summary_width=(width)
+ Width for option list portion of summary. Must be (({Numeric})).
+--- OptionParser#summary_indent
+--- OptionParser#summary_indent=(indent)
+ Indentation for summary. Must be (({String})) (or have (({+ String}))).
+--- OptionParser#program_name
+--- OptionParser#program_name=(name)
+ Program name to be emitted in error message and default banner,
+ defaulted to (({$0})).
+=end #'#"#`#
+ attr_writer :banner, :program_name
+ attr_accessor :summary_width, :summary_indent
- # Indentation for summary. Must be String (or have + String method).
- attr_accessor :summary_indent
-
- # Strings to be parsed in default.
- attr_accessor :default_argv
-
- #
- # Heading banner preceding summary.
- #
def banner
@banner ||= "Usage: #{program_name} [options]"
end
- #
- # Program name to be emitted in error message and default banner, defaults
- # to $0.
- #
def program_name
@program_name || File.basename($0, '.*')
end
- # for experimental cascading :-)
+# for experimental cascading :-)
alias set_banner banner=
alias set_program_name program_name=
alias set_summary_width summary_width=
alias set_summary_indent summary_indent=
- # Version
- attr_writer :version
- # Release code
- attr_writer :release
+=begin
+--- OptionParser#version
+--- OptionParser#version=(ver)
+ Version.
+--- OptionParser#release
+--- OptionParser#release=(rel)
+ Release code.
+--- OptionParser#ver
+ Returns version string from ((<program_name>)), (({version})) and
+ (({release})).
+=end #'#"#`#
+ attr_writer :version, :release
- #
- # Version
- #
def version
@version || (defined?(::Version) && ::Version)
end
- #
- # Release code
- #
def release
@release || (defined?(::Release) && ::Release) || (defined?(::RELEASE) && ::RELEASE)
end
- #
- # Returns version string from program_name, version and release.
- #
def ver
if v = version
str = "#{program_name} #{[v].join('.')}"
@@ -883,23 +940,26 @@ class OptionParser
super("#{program_name}: #{mesg}")
end
- #
- # Subject of #on / #on_head, #accept / #reject
- #
+=begin
+--- OptionParser#top
+ Subject of ((<on>))/((<on_head>)), ((<accept>))/((<reject>)).
+=end #'#"#`#
def top
@stack[-1]
end
- #
- # Subject of #on_tail.
- #
+=begin
+--- OptionParser#base
+ Subject of ((<on_tail>)).
+=end #'#"#`#
def base
@stack[1]
end
- #
- # Pushes a new List.
- #
+=begin
+--- OptionParser#new
+ Pushes a new (({List})).
+=end #'#"#`#
def new
@stack.push(List.new)
if block_given?
@@ -909,46 +969,99 @@ class OptionParser
end
end
- #
- # Removes the last List.
- #
+=begin
+--- OptionParser#remove
+ Removes the last (({List})).
+=end #'#"#`#
def remove
@stack.pop
end
- #
- # Puts option summary into +to+ and returns +to+. Yields each line if
- # a block is given.
- #
- # +to+:: Output destination, which must have method <<. Defaults to [].
- # +width+:: Width of left side, defaults to @summary_width.
- # +max+:: Maximum length allowed for left side, defaults to +width+ - 1.
- # +indent+:: Indentation, defaults to @summary_indent.
- #
+
+=begin
+--- OptionParser#summarize(to = [], width = @summary_width, max = width - 1, indent = @summary_indent)
+ Puts option summary into ((|to|)), and returns ((|to|)).
+ :Parameters:
+ : ((|to|))
+ output destination, which must have method ((|<<|)). Defaulted to (({[]})).
+ : ((|width|))
+ width of left side. Defaulted to ((|@summary_width|))
+ : ((|max|))
+ maximum length allowed for left side. Defaulted to (({((|width|)) - 1}))
+ : ((|indent|))
+ indentation. Defaulted to ((|@summary_indent|))
+ : (({block}))
+ yields with each line if called as iterator.
+=end #'#"#`#
def summarize(to = [], width = @summary_width, max = width - 1, indent = @summary_indent, &blk)
visit(:summarize, {}, {}, width, max, indent, &(blk || proc {|l| to << l + $/}))
to
end
- #
- # Returns option summary string.
- #
+=begin
+--- OptionParser#help
+--- OptionParser#to_s
+ Returns option summary string.
+=end #'#"#`#
def help; summarize(banner.to_s.sub(/\n?\z/, "\n")) end
alias to_s help
- #
- # Returns option summary list.
- #
+=begin
+--- OptionParser#to_a
+ Returns option summary list.
+=end #'#"#`#
def to_a; summarize(banner.to_a.dup) end
- #
- # Checks if an argument is given twice, in which case an ArgumentError is
- # raised. Called from OptionParser#switch only.
- #
- # +obj+:: New argument.
- # +prv+:: Previously specified argument.
- # +msg+:: Exception message.
- #
+
+=begin
+--- OptionParser#switch
+ Creates ((<OptionParser::Switch>)).
+ :Parameters:
+ : ((|*opts|))
+ option definition:
+ : argument style
+ see ((<OptionParser::ArgumentStyle>))
+ : argument pattern
+ acceptable option argument format, must pre-defined with
+ ((<OptionParser.accept>)) or ((<OptionParser#accept>)), or
+ (({Regexp})). This can appear once or assigned as (({String}))
+ if not present, otherwise causes exception (({ArgumentError})).
+
+ cf. ((<Acceptable argument classes>)).
+ : Hash
+ : Array
+ possible argument values.
+ : Proc
+ : Method
+ alternative way to give the ((*handler*)).
+ : "--switch=MANDATORY", "--switch[=OPTIONAL]", "--switch"
+ specifies long style switch that takes ((*mandatory*)),
+ ((*optional*)) and ((*no*)) argument, respectively.
+ : "-xMANDATORY", "-x[OPTIONAL]", "-x"
+ specifies short style switch that takes ((*mandatory*)),
+ ((*optional*)) and ((*no*)) argument, respectively.
+ : "-[a-z]MANDATORY", "-[a-z][OPTIONAL]", "-[a-z]"
+ special form short style switch that matches character
+ range(not fullset of regular expression).
+ : "=MANDATORY", "=[OPTIONAL]"
+ argument style and description.
+ : "description", ...
+ ((*description*)) for this option.
+ : (({block}))
+ ((*handler*)) to convert option argument to arbitrary (({Class})).
+=end #'#"#`#
+=begin private
+--- OptionParser#notwice(obj, prv, msg)
+ Checks never given twice an argument.
+ ((*Called from OptionParser#switch only*))
+ :Parameters:
+ : ((|obj|))
+ new argument.
+ : ((|prv|))
+ previously specified argument.
+ : ((|msg|))
+ exception message
+=end #'#"#`#
def notwice(obj, prv, msg)
unless !prv or prv == obj
begin
@@ -962,64 +1075,6 @@ class OptionParser
end
private :notwice
- #
- # Creates an OptionParser::Switch from the parameters. The parsed argument
- # value is passed to the given block, where it can be processed.
- #
- # See at the beginning of OptionParser for some full examples.
- #
- # +opts+ can include the following elements:
- #
- # [Argument style:]
- # One of the following:
- # :NONE, :REQUIRED, :OPTIONAL
- #
- # [Argument pattern:]
- # Acceptable option argument format, must be pre-defined with
- # OptionParser.accept or OptionParser#accept, or Regexp. This can appear
- # once or assigned as String if not present, otherwise causes an
- # ArgumentError. Examples:
- # Float, Time, Array
- #
- # [Possible argument values:]
- # Hash or Array.
- # [:text, :binary, :auto]
- # %w[iso-2022-jp shift_jis euc-jp utf8 binary]
- # { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
- #
- # [Long style switch:]
- # Specifies a long style switch which takes a mandatory, optional or no
- # argument. It's a string of the following form:
- # "--switch=MANDATORY" or "--switch MANDATORY"
- # "--switch[=OPTIONAL]"
- # "--switch"
- #
- # [Short style switch:]
- # Specifies short style switch which takes a mandatory, optional or no
- # argument. It's a string of the following form:
- # "-xMANDATORY"
- # "-x[OPTIONAL]"
- # "-x"
- # There is also a special form which matches character range (not full
- # set of regural expression):
- # "-[a-z]MANDATORY"
- # "-[a-z][OPTIONAL]"
- # "-[a-z]"
- #
- # [Argument style and description:]
- # Instead of specifying mandatory or optional orguments directly in the
- # switch parameter, this separate parameter can be used.
- # "=MANDATORY"
- # "=[OPTIONAL]"
- #
- # [Description:]
- # Description string for the option.
- # "Run verbosely"
- #
- # [Handler:]
- # Handler for the parsed argument value. Either give a block or pass a
- # Proc or Method as an argument.
- #
def make_switch(*opts, &block)
short, long, nolong, style, pattern, conv, not_pattern, not_conv, not_style = [], [], []
ldesc, sdesc, desc, arg = [], [], []
@@ -1135,15 +1190,23 @@ class OptionParser
nolong
end
+=begin
+--- OptionParser#on(*opts) [{...}]
+--- OptionParser#def_option(*opts) [{...}]
+--- OptionParser#on_head(*opts) [{...}]
+--- OptionParser#def_head_option(*opts) [{...}]
+--- OptionParser#on_tail(*opts) [{...}]
+--- OptionParser#def_tail_option(*opts) [{...}]
+ Defines option switch and handler. (({on_head})), (({def_head_option}))
+ and (({on_tail})), (({def_tail_option})) put the switch at head
+ and tail of summary, respectively.
+
+ cf. ((<OptionParser#switch>)).
+=end #'#"#`#
def define(*opts, &block)
top.append(*(sw = make_switch(*opts, &block)))
sw[0]
end
-
- #
- # Add option switch and handler. See #make_switch for an explanation of
- # parameters.
- #
def on(*opts, &block)
define(*opts, &block)
self
@@ -1154,10 +1217,6 @@ class OptionParser
top.prepend(*(sw = make_switch(*opts, &block)))
sw[0]
end
-
- #
- # Add option switch like with #on, but at head of summary.
- #
def on_head(*opts, &block)
define_head(*opts, &block)
self
@@ -1168,45 +1227,47 @@ class OptionParser
base.append(*(sw = make_switch(*opts, &block)))
sw[0]
end
-
- #
- # Add option switch like with #on, but at tail of summary.
- #
def on_tail(*opts, &block)
define_tail(*opts, &block)
self
end
alias def_tail_option define_tail
- #
- # Add separator in summary.
- #
def separator(string)
top.append(string, nil, nil)
end
- #
- # Parses command line arguments +argv+ in order. When a block is given,
- # each non-option argument is yielded.
- #
- # Returns the rest of +argv+ left unparsed.
- #
+
+=begin
+--- OptionParser#order(*argv) [{...}]
+--- OptionParser#order!([argv = ARGV]) [{...}]
+ Parses ((|argv|)) in order. When non-option argument encountered,
+ yields it if called as iterator, otherwise terminates the parse
+ process.
+ Returns rest of ((|argv|)) left unparsed.
+
+ (({order!})) takes argument array itself, and removes switches
+ destructively.
+ Defaults to parse ((|ARGV|)).
+ :Parameters:
+ : ((|argv|))
+ command line arguments to be parsed.
+ : (({block}))
+ called with each non-option argument.
+=end #'#"#`#
def order(*argv, &block)
argv = argv[0].dup if argv.size == 1 and Array === argv[0]
order!(argv, &block)
end
- #
- # Same as #order, but removes switches destructively.
- #
- def order!(argv = default_argv, &nonopt)
+ def order!(argv = ARGV, &nonopt)
opt, arg, sw, val, rest = nil
nonopt ||= proc {|arg| throw :terminate, arg}
argv.unshift(arg) if arg = catch(:terminate) {
while arg = argv.shift
case arg
# long option
- when /\A--([^=]*)(?:=(.*))?/nm
+ when /\A--([^=]*)(?:=(.*))?/
opt, rest = $1, $2
begin
sw, = complete(:long, opt, true)
@@ -1221,7 +1282,7 @@ class OptionParser
end
# short option
- when /\A-(.)((=).*|.+)?/nm
+ when /\A-(.)((=).*|.+)?/
opt, has_arg, eq, val, rest = $1, $3, $3, $2, $2
begin
unless sw = search(:short, opt)
@@ -1261,19 +1322,25 @@ class OptionParser
argv
end
- #
- # Parses command line arguments +argv+ in permutation mode and returns
- # list of non-option arguments.
- #
+=begin
+--- OptionParser#permute(*argv)
+--- OptionParser#permute!([argv = ARGV])
+ Parses ((|argv|)) in permutation mode, and returns list of
+ non-option arguments.
+
+ (({permute!})) takes argument array itself, and removes switches
+ destructively.
+ Defaults to parse ((|ARGV|)).
+ :Parameters:
+ : ((|argv|))
+ command line arguments to be parsed.
+=end #'#"#`#
def permute(*argv)
argv = argv[0].dup if argv.size == 1 and Array === argv[0]
permute!(argv)
end
- #
- # Same as #permute, but removes switches destructively.
- #
- def permute!(argv = default_argv)
+ def permute!(argv = ARGV)
nonopts = []
arg = nil
order!(argv) {|arg| nonopts << arg}
@@ -1281,19 +1348,25 @@ class OptionParser
argv
end
- #
- # Parses command line arguments +argv+ in order when environment variable
- # POSIXLY_CORRECT is set, and in permutation mode otherwise.
- #
+=begin
+--- OptionParser#parse(*argv)
+--- OptionParser#parse!([argv = ARGV])
+ Parses ((|argv|)) in order when environment variable (({POSIXLY_CORRECT}))
+ is set, otherwise permutation mode
+
+ (({parse!})) takes argument array itself, and removes switches
+ destructively.
+ Defaults to parse ((|ARGV|)).
+ :Parameters:
+ : ((|argv|))
+ command line arguments to be parsed.
+=end #'#"#`#
def parse(*argv)
argv = argv[0].dup if argv.size == 1 and Array === argv[0]
parse!(argv)
end
- #
- # Same as #parse, but removes switches destructively.
- #
- def parse!(argv = default_argv)
+ def parse!(argv = ARGV)
if ENV.include?('POSIXLY_CORRECT')
order!(argv)
else
@@ -1301,48 +1374,18 @@ class OptionParser
end
end
- #
- # Wrapper method for getopts.rb.
- #
- def getopts(argv, single_options, *long_options)
- result = {}
-
- single_options.scan(/(.)(:)?/) do |opt, val|
- if val
- result[opt] = nil
- define("-#{opt} VAL") {|val| result[opt] = val}
- else
- result[opt] = false
- define("-#{opt}") {result[opt] = true}
- end
- end if single_options
-
- long_options.each do |arg|
- opt, val = arg.split(':', 2)
- if val
- result[opt] = val.empty? ? nil : val
- define("--#{opt} VAL") {|val| result[opt] = val}
- else
- result[opt] = false
- define("--#{opt}") {result[opt] = true}
- end
- end
-
- order!(argv)
- result
- end
-
- #
- # See #getopts.
- #
- def self.getopts(*args)
- new.getopts(*args)
- end
-
- #
- # Traverses @stack, sending each element method +id+ with +args+ and
- # +block+.
- #
+
+=begin private
+--- OptionParser#visit(id, *args) {block}
+ Traverses (({stack}))s calling method ((|id|)) with ((|*args|)).
+ :Parameters:
+ : ((|id|))
+ called method in each elements of (({stack}))s.
+ : ((|*args|))
+ passed to ((|id|)).
+ : (({block}))
+ passed to ((|id|)).
+=end #'#"#`#
def visit(id, *args, &block)
el = nil
@stack.reverse_each do |el|
@@ -1352,9 +1395,18 @@ class OptionParser
end
private :visit
- #
- # Searches key +k+ in @stack for +id+ hash and returns or yields the result.
- #
+=begin private
+--- OptionParser#search(id, k)
+ Searches ((|k|)) in stack for ((|id|)) hash, and returns it or yielded
+ value if called as iterator.
+ :Parameters:
+ : ((|id|))
+ searching table.
+ : ((|k|))
+ searching key.
+ : (({block}))
+ yielded with the found value when succeeded.
+=end #'#"#`#
def search(id, k)
visit(:search, id, k) do |k|
return k unless block_given?
@@ -1363,15 +1415,22 @@ class OptionParser
end
private :search
- #
- # Completes shortened long style option switch and returns pair of
- # canonical switch and switch descriptor OptionParser::Switch.
- #
- # +id+:: Searching table.
- # +opt+:: Searching key.
- # +icase+:: Search case insensitive if true.
- # +pat+:: Optional pattern for completion.
- #
+=begin private
+--- OptionParser#complete(typ, opt, *etc)
+ Completes shortened long style option switch, and returns pair of
+ canonical switch and switch descriptor((<OptionParser::Switch>)).
+ :Parameters:
+ : ((|id|))
+ searching table.
+ : ((|opt|))
+ searching key.
+ : ((|icase|))
+ search case insensitive if true.
+ : ((|*pat|))
+ optional pattern for completion.
+ : (({block}))
+ yielded with the found value when succeeded.
+=end #'#"#`#
def complete(typ, opt, icase = false, *pat)
if pat.empty?
search(typ, opt) {|sw| return [sw, opt]} # exact match or...
@@ -1383,13 +1442,15 @@ class OptionParser
end
private :complete
- #
- # Loads options from file names as +filename+. Does nothing when the file
- # is not present. Returns whether successfully loaded.
- #
- # +filename+ defaults to basename of the program without suffix in a
- # directory ~/.options.
- #
+=begin undocumented
+--- OptionParser#load([filename])
+ Loads options from file named as ((|filename|)). Does nothing when
+ the file is not present. Returns whether successfuly loaded.
+ :Parameters:
+ : ((|filename|))
+ option file name. defaulted to basename of the program without
+ suffix in a directory ((%~/.options%)).
+=end #'#"#`#
def load(filename = nil)
begin
filename ||= File.expand_path(File.basename($0, '.*'), '~/.options')
@@ -1404,38 +1465,44 @@ class OptionParser
end
end
- #
- # Parses environment variable +env+ or its uppercase with splitting like a
- # shell.
- #
- # +env+ defaults to the basename of the program.
- #
+=begin undocumented
+--- OptionParser#environment([env])
+ Parses environment variable ((|env|)) or its uppercase with spliting
+ like as shell.
+ :Parameters:
+ : ((|env|))
+ defaulted to basename of the program.
+=end #'#"#`#
def environment(env = File.basename($0, '.*'))
env = ENV[env] || ENV[env.upcase] or return
parse(*Shellwords.shellwords(env))
end
- #
- # Acceptable argument classes
- #
+
+=begin
+= Acceptable argument classes
+=end #'#"#`#
- #
- # Any string and no conversion. This is fall-back.
- #
+=begin
+: Object
+ any string, and no conversion. this is fall-back.
+=end #'#"#`#
accept(Object) {|s,|s or s.nil?}
accept(NilClass) {|s,|s}
- #
- # Any non-empty string, and no conversion.
- #
- accept(String, /.+/nm) {|s,*|s}
-
- #
- # Ruby/C-like integer, octal for 0-7 sequence, binary for 0b, hexadecimal
- # for 0x, and decimal for others; with optional sign prefix. Converts to
- # Integer.
- #
+=begin
+: String
+ any none-empty string, and no conversion.
+=end #'#"#`#
+ accept(String, /.+/) {|s,*|s}
+
+=begin
+: Integer
+ Ruby/C-like integer, octal for (({0-7})) sequence, binary for
+ (({0b})), hexadecimal for (({0x})), and decimal for others; with
+ optional sign prefix. Converts to (({Integer})).
+=end #'#"#`#
decimal = '\d+(?:_\d+)*'
binary = 'b[01]+(?:_[01]+)*'
hex = 'x[\da-f]+(?:_[\da-f]+)*'
@@ -1443,57 +1510,63 @@ class OptionParser
integer = "#{octal}|#{decimal}"
accept(Integer, %r"\A[-+]?(?:#{integer})"io) {|s,| Integer(s) if s}
- #
- # Float number format, and converts to Float.
- #
+=begin
+: Float
+ Float number format, and converts to (({Float})).
+=end #'#"#`#
float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
floatpat = %r"\A[-+]?#{float}"io
accept(Float, floatpat) {|s,| s.to_f if s}
- #
- # Generic numeric format, converts to Integer for integer format, Float
- # for float format.
- #
+=begin
+: Numeric
+ Generic numeric format, and converts to (({Integer})) for integer
+ format, (({Float})) for float format.
+=end #'#"#`#
accept(Numeric, %r"\A[-+]?(?:#{octal}|#{float})"io) {|s,| eval(s) if s}
- #
- # Decimal integer format, to be converted to Integer.
- #
+=begin
+: OptionParser::DecimalInteger
+ Decimal integer format, to be converted to (({Integer})).
+=end #'#"#`#
DecimalInteger = /\A[-+]?#{decimal}/io
accept(DecimalInteger) {|s,| s.to_i if s}
- #
- # Ruby/C like octal/hexadecimal/binary integer format, to be converted to
- # Integer.
- #
+=begin
+: OptionParser::OctalInteger
+ Ruby/C like octal/hexadecimal/binary integer format, to be converted
+ to (({Integer})).
+=end #'#"#`#
OctalInteger = /\A[-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))/io
accept(OctalInteger) {|s,| s.oct if s}
- #
- # Decimal integer/float number format, to be converted to Integer for
- # integer format, Float for float format.
- #
+=begin
+: OptionParser::DecimalNumeric
+ Decimal integer/float number format, to be converted to
+ (({Integer})) for integer format, (({Float})) for float format.
+=end #'#"#`#
DecimalNumeric = floatpat # decimal integer is allowed as float also.
accept(DecimalNumeric) {|s,| eval(s) if s}
- #
- # Boolean switch, which means whether it is present or not, whether it is
- # absent or not with prefix no-, or it takes an argument
- # yes/no/true/false/+/-.
- #
+=begin
+: TrueClass
+ Boolean switch, which means whether it is present or not, whether it
+ is absent or not with prefix (({no-})), or it takes an argument
+ (({yes/no/true/false/+/-})).
+: FalseClass
+ Similar to ((<TrueClass>)), but defaulted to (({false})).
+=end #'#"#`#
yesno = CompletingHash.new
%w[- no false].each {|el| yesno[el] = false}
%w[+ yes true].each {|el| yesno[el] = true}
yesno['nil'] = false # shoud be nil?
accept(TrueClass, yesno) {|arg, val| val == nil or val}
- #
- # Similar to TrueClass, but defaults to false.
- #
accept(FalseClass, yesno) {|arg, val| val != nil and val}
- #
- # List of strings separated by ",".
- #
+=begin
+: Array
+ List of strings separated by ","
+=end #'#"#`#
accept(Array) do |s,|
if s
s = s.split(',').collect {|s| s unless s.empty?}
@@ -1501,9 +1574,10 @@ class OptionParser
s
end
- #
- # Regular expression with options.
- #
+=begin
+: Regexp
+ Regular expression with option.
+=end
accept(Regexp, %r"\A/((?:\\.|[^\\])*)/([[:alpha:]]+)?\z|.*") do |all, s, o|
f = 0
if o
@@ -1515,15 +1589,32 @@ class OptionParser
Regexp.new(s || all, f, k)
end
- #
- # Exceptions
- #
-
- #
- # Base class of exceptions from OptionParser.
- #
+
+=begin
+= Exceptions
+=end #'#"#`#
+
+=begin
+== ((:OptionParser::ParseError:))
+Base class of exceptions from ((<OptionParser>))
+=== Superclass
+(({RuntimeError}))
+=== Constants
+: OptionParser::ParseError::Reason
+ Reason caused error.
+=== Instance methods
+--- OptionParser::ParseError#recover(argv)
+ Push backs erred argument(s) to ((|argv|)).
+--- OptionParser::ParseError#reason
+ Returns error reason. Override this to I18N.
+--- OptionParser::ParseError#inspect
+ Returns inspection string.
+--- OptionParser::ParseError#message
+--- OptionParser::ParseError#to_s
+--- OptionParser::ParseError#to_str
+ Default stringizing method to emit standard error message.
+=end #'#"#`#
class ParseError < RuntimeError
- # Reason which caused the error.
Reason = 'parse error'.freeze
def initialize(*args)
@@ -1534,9 +1625,6 @@ class OptionParser
attr_reader :args
attr_writer :reason
- #
- # Pushes back erred argument(s) to +argv+.
- #
def recover(argv)
argv[0, 0] = @args
argv
@@ -1551,9 +1639,6 @@ class OptionParser
self
end
- #
- # Returns error reason. Override this for I18N.
- #
def reason
@reason || self.class::Reason
end
@@ -1562,9 +1647,6 @@ class OptionParser
"#<#{self.class.to_s}: #{args.join(' ')}>"
end
- #
- # Default stringizing method to emit standard error message.
- #
def message
reason + ': ' + args.join(' ')
end
@@ -1573,63 +1655,85 @@ class OptionParser
alias to_str message
end
- #
- # Raises when ambiguously completable string is encountered.
- #
+=begin
+== ((:OptionParser::AmbiguousOption:))
+Raises when encountered ambiguously completable string.
+=== Superclass
+((<OptionParser::ParseError>))
+=end #'#"#`#
class AmbiguousOption < ParseError
const_set(:Reason, 'ambiguous option'.freeze)
end
- #
- # Raises when there is an argument for a switch which takes no argument.
- #
+=begin
+== ((:OptionParser::NeedlessArgument:))
+Raises when encountered argument for switch defined as which takes no
+argument.
+=== Superclass
+((<OptionParser::ParseError>))
+=end #'#"#`#
class NeedlessArgument < ParseError
const_set(:Reason, 'needless argument'.freeze)
end
- #
- # Raises when a switch with mandatory argument has no argument.
- #
+=begin
+== ((:OptionParser::MissingArgument:))
+Raises when no argument found for switch defined as which needs
+argument.
+=== Superclass
+((<OptionParser::ParseError>))
+=end #'#"#`#
class MissingArgument < ParseError
const_set(:Reason, 'missing argument'.freeze)
end
- #
- # Raises when switch is undefined.
- #
+=begin
+== ((:OptionParser::InvalidOption:))
+Raises when undefined switch.
+=== Superclass
+((<OptionParser::ParseError>))
+=end #'#"#`#
class InvalidOption < ParseError
const_set(:Reason, 'invalid option'.freeze)
end
- #
- # Raises when the given argument does not match required format.
- #
+=begin
+== ((:OptionParser::InvalidArgument:))
+Raises when the given argument does not match required format.
+=== Superclass
+((<OptionParser::ParseError>))
+=end #'#"#`#
class InvalidArgument < ParseError
const_set(:Reason, 'invalid argument'.freeze)
end
- #
- # Raises when the given argument word can't be completed uniquely.
- #
+=begin
+== ((:OptionParser::AmbiguousArgument:))
+Raises when the given argument word can't completed uniquely.
+=== Superclass
+((<OptionParser::InvalidArgument>))
+=end #'#"#`#
class AmbiguousArgument < InvalidArgument
const_set(:Reason, 'ambiguous argument'.freeze)
end
- #
- # Miscellaneous
- #
-
- #
- # Extends command line arguments array (ARGV) to parse itself.
- #
+
+=begin
+= Miscellaneous
+=end #'#"#`#
+=begin
+== ((:OptionParser::Arguable:))
+Extends command line arguments array to parse itself.
+=end #'#"#`#
module Arguable
-
- #
- # Sets OptionParser object, when +opt+ is +false+ or +nil+, methods
- # OptionParser::Arguable#options and OptionParser::Arguable#options= are
- # undefined. Thus, there is no ways to access the OptionParser object
- # via the receiver object.
- #
+=begin
+--- OptionParser::Arguable#options=(opt)
+ Sets ((<OptionParser>)) object, when ((|opt|)) is (({false})) or
+ (({nil})), methods ((<OptionParser::Arguable#options>)) and
+ ((<OptionParser::Arguable#options=>)) are undefined. Thus, there
+ is no ways to access the ((<OptionParser>)) object via the
+ receiver object.
+=end #'#"#`#
def options=(opt)
unless @optparse = opt
class << self
@@ -1639,17 +1743,23 @@ class OptionParser
end
end
- #
- # Actual OptionParser object, automatically created if nonexistent.
- #
- # If called with a block, yields the OptionParser object and returns the
- # result of the block. If an OptionParser::ParseError exception occurs
- # in the block, it is rescued, a error message printed to STDERR and
- # +nil+ returned.
- #
+=begin
+--- OptionParser::Arguable#options
+ Actual ((<OptionParser>)) object, automatically created if not
+ yet.
+
+ If called as iterator, yields with the ((<OptionParser>)) object
+ and returns the result of the block. In this case, rescues any
+ ((<OptionParser::ParseError>)) exceptions in the block, just emits
+ error message to ((<STDERR>)) and returns (({nil})).
+
+ :Parameters:
+ : (({block}))
+ Yielded with the ((<OptionParser>)) instance.
+
+=end #'#"#`#
def options
@optparse ||= OptionParser.new
- @optparse.default_argv = self
block_given? or return @optparse
begin
yield @optparse
@@ -1659,42 +1769,20 @@ class OptionParser
end
end
- #
- # Parses +self+ destructively in order and returns +self+ containing the
- # rest arguments left unparsed.
- #
+=begin
+--- OptionParser::Arguable#order!
+--- OptionParser::Arguable#permute!
+--- OptionParser::Arguable#parse!
+ Parses ((|self|)) destructively, and returns ((|self|)) just contains
+ rest arguments left without parsed.
+=end #'#"#`#
def order!(&blk) options.order!(self, &blk) end
-
- #
- # Parses +self+ destructively in permutation mode and returns +self+
- # containing the rest arguments left unparsed.
- #
def permute!() options.permute!(self) end
-
- #
- # Parses +self+ destructively and returns +self+ containing the
- # rest arguments left unparsed.
- #
def parse!() options.parse!(self) end
- #
- # Substitution of getopts is possible as follows. Also see
- # OptionParser#getopts.
- #
- # def getopts(*args)
- # ($OPT = ARGV.getopts(*args)).each do |opt, val|
- # eval "$OPT_#{opt.gsub(/[^A-Za-z0-9_]/, '_')} = val"
- # end
- # rescue OptionParser::ParseError
- # end
- #
- def getopts(*args)
- options.getopts(self, *args)
- end
-
- #
- # Initializes instance variable.
- #
+=begin private
+Initializes instance variable.
+=end #'#"#`#
def self.extend_object(obj)
super
obj.instance_eval {@optparse = nil}
@@ -1705,10 +1793,12 @@ class OptionParser
end
end
- #
- # Acceptable argument classes. Now contains DecimalInteger, OctalInteger
- # and DecimalNumeric. See Acceptable argument classes (in source code).
- #
+=begin
+== OptionParser::Acceptables
+Acceptable argument classes. Now contains (({DecimalInteger})),
+(({OctalInteger})) and (({DecimalNumeric})).
+see ((<Acceptable argument classes>)).
+=end #'#"#`#
module Acceptables
const_set(:DecimalInteger, OptionParser::DecimalInteger)
const_set(:OctalInteger, OptionParser::OctalInteger)
@@ -1719,9 +1809,15 @@ end
# ARGV is arguable by OptionParser
ARGV.extend(OptionParser::Arguable)
+
if $0 == __FILE__
Version = OptionParser::Version
ARGV.options {|q|
q.parse!.empty? or puts "what's #{ARGV.join(' ')}?"
} or exit 1
end
+__END__
+=begin example
+= Example
+<<< opttest.rb
+=end #'#"#`#
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 6af5bbdac0..b30ae640c5 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -47,7 +47,7 @@ class OpenStruct
@table = {}
if hash
for k,v in hash
- @table[k.to_sym] = v
+ @table[k.to_sym] = v
new_ostruct_member(k)
end
end
@@ -68,11 +68,11 @@ class OpenStruct
end
def new_ostruct_member(name)
- name = name.to_sym
unless self.respond_to?(name)
- meta = class << self; self; end
- meta.send(:define_method, name) { @table[name] }
- meta.send(:define_method, :"#{name}=") { |x| @table[name] = x }
+ self.instance_eval %{
+ def #{name}; @table[:#{name}]; end
+ def #{name}=(x); @table[:#{name}] = x; end
+ }
end
end
@@ -81,14 +81,14 @@ class OpenStruct
len = args.length
if mname =~ /=$/
if len != 1
- raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
+ raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
if self.frozen?
- raise TypeError, "can't modify frozen #{self.class}", caller(1)
+ raise TypeError, "can't modify frozen #{self.class}", caller(1)
end
mname.chop!
- self.new_ostruct_member(mname)
@table[mname.intern] = args[0]
+ self.new_ostruct_member(mname)
elsif len == 0
@table[mid]
else
@@ -103,35 +103,16 @@ class OpenStruct
@table.delete name.to_sym
end
- InspectKey = :__inspect_key__ # :nodoc:
-
#
# Returns a string containing a detailed summary of the keys and values.
#
def inspect
- str = "#<#{self.class}"
-
- Thread.current[InspectKey] ||= []
- if Thread.current[InspectKey].include?(self) then
- str << " ..."
- else
- first = true
- for k,v in @table
- str << "," unless first
- first = false
-
- Thread.current[InspectKey] << v
- begin
- str << " #{k}=#{v.inspect}"
- ensure
- Thread.current[InspectKey].pop
- end
- end
+ str = "<#{self.class}"
+ for k,v in @table
+ str << " #{k}=#{v.inspect}"
end
-
str << ">"
end
- alias :to_s :inspect
attr_reader :table # :nodoc:
protected :table
diff --git a/lib/parsearg.rb b/lib/parsearg.rb
index b7e18c3afd..d5f3c9638d 100644
--- a/lib/parsearg.rb
+++ b/lib/parsearg.rb
@@ -1,8 +1,8 @@
#
# parsearg.rb - parse arguments
# $Release Version: $
-# $Revision: 1.2.2.2 $
-# $Date: 2006/08/04 22:00:21 $
+# $Revision$
+# $Date$
# by Yasuo OHBA(SHL Japan Inc. Technology Dept.)
#
# --
@@ -10,9 +10,7 @@
#
#
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: parsearg is deprecated after Ruby 1.8.1; use optparse instead"
-
-$RCS_ID=%q$Header: /src/ruby/lib/parsearg.rb,v 1.2.2.2 2006/08/04 22:00:21 drbrain Exp $
+$RCS_ID=%q$Header$
require "getopts"
@@ -57,8 +55,6 @@ def setExpression(ex, opt, op)
return ex
end
-# parseArgs is obsolete. Use OptionParser instead.
-
def parseArgs(argc, nopt, single_opts, *opts)
if (noOptions = getopts(single_opts, *opts)) == nil
printUsageAndExit()
diff --git a/lib/pathname.rb b/lib/pathname.rb
index e4ca5489ce..19630415c1 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -15,12 +15,8 @@
# == Pathname
#
# Pathname represents a pathname which locates a file in a filesystem.
-# The pathname depends on OS: Unix, Windows, etc.
-# Pathname library works with pathnames of local OS.
-# However non-Unix pathnames are supported experimentally.
-#
-# It does not represent the file itself.
-# A Pathname can be relative or absolute. It's not until you try to
+# It supports only Unix style pathnames. It does not represent the file
+# itself. A Pathname can be relative or absolute. It's not until you try to
# reference the file that it even matters whether the file exists or not.
#
# Pathname is immutable. It has no method for destructive update.
@@ -107,7 +103,6 @@
# - #owned?
# - #pipe?
# - #readable?
-# - #world_readable?
# - #readable_real?
# - #setgid?
# - #setuid?
@@ -117,7 +112,6 @@
# - #sticky?
# - #symlink?
# - #writable?
-# - #world_writable?
# - #writable_real?
# - #zero?
#
@@ -186,22 +180,12 @@
# information. In some cases, a brief description will follow.
#
class Pathname
-
- # :stopdoc:
- if RUBY_VERSION < "1.9"
- TO_PATH = :to_str
- else
- # to_path is implemented so Pathname objects are usable with File.open, etc.
- TO_PATH = :to_path
- end
- # :startdoc:
-
#
# Create a Pathname object from the given String (or String-like object).
# If +path+ contains a NUL character (<tt>\0</tt>), an ArgumentError is raised.
#
def initialize(path)
- path = path.__send__(TO_PATH) if path.respond_to? TO_PATH
+ path = path.to_str if path.respond_to? :to_str
@path = path.dup
if /\0/ =~ @path
@@ -242,59 +226,14 @@ class Pathname
@path.dup
end
- # to_path is implemented so Pathname objects are usable with File.open, etc.
- alias_method TO_PATH, :to_s
+ # to_str is implemented so Pathname objects are usable with File.open, etc.
+ alias to_str to_s
def inspect # :nodoc:
"#<#{self.class}:#{@path}>"
end
- # Return a pathname which is substituted by String#sub.
- def sub(pattern, *rest, &block)
- self.class.new(@path.sub(pattern, *rest, &block))
- end
-
- if File::ALT_SEPARATOR
- SEPARATOR_PAT = /[#{Regexp.quote File::ALT_SEPARATOR}#{Regexp.quote File::SEPARATOR}]/
- else
- SEPARATOR_PAT = /#{Regexp.quote File::SEPARATOR}/
- end
-
- # chop_basename(path) -> [pre-basename, basename] or nil
- def chop_basename(path)
- base = File.basename(path)
- if /\A#{SEPARATOR_PAT}?\z/ =~ base
- return nil
- else
- return path[0, path.rindex(base)], base
- end
- end
- private :chop_basename
-
- # split_names(path) -> prefix, [name, ...]
- def split_names(path)
- names = []
- while r = chop_basename(path)
- path, basename = r
- names.unshift basename
- end
- return path, names
- end
- private :split_names
-
- def prepend_prefix(prefix, relpath)
- if relpath.empty?
- File.dirname(prefix)
- elsif /#{SEPARATOR_PAT}/ =~ prefix
- prefix = File.dirname(prefix)
- prefix = File.join(prefix, "") if File.basename(prefix + 'a') != 'a'
- prefix + relpath
- else
- prefix + relpath
- end
- end
- private :prepend_prefix
-
+ #
# Returns clean pathname of +self+ with consecutive slashes and useless dots
# removed. The filesystem is not accessed.
#
@@ -316,142 +255,118 @@ class Pathname
# Nothing more, nothing less.
#
def cleanpath_aggressive
- path = @path
+ # cleanpath_aggressive assumes:
+ # * no symlink
+ # * all pathname prefix contained in the pathname is existing directory
+ return Pathname.new('') if @path == ''
+ absolute = absolute?
names = []
- pre = path
- while r = chop_basename(pre)
- pre, base = r
- case base
- when '.'
- when '..'
- names.unshift base
- else
- if names[0] == '..'
- names.shift
+ @path.scan(%r{[^/]+}) {|name|
+ next if name == '.'
+ if name == '..'
+ if names.empty?
+ next if absolute
else
- names.unshift base
+ if names.last != '..'
+ names.pop
+ next
+ end
end
end
- end
- if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
- names.shift while names[0] == '..'
- end
- self.class.new(prepend_prefix(pre, File.join(*names)))
+ names << name
+ }
+ return Pathname.new(absolute ? '/' : '.') if names.empty?
+ path = absolute ? '/' : ''
+ path << names.join('/')
+ Pathname.new(path)
end
private :cleanpath_aggressive
- # has_trailing_separator?(path) -> bool
- def has_trailing_separator?(path)
- if r = chop_basename(path)
- pre, basename = r
- pre.length + basename.length < path.length
- else
- false
- end
- end
- private :has_trailing_separator?
-
- # add_trailing_separator(path) -> path
- def add_trailing_separator(path)
- if File.basename(path + 'a') == 'a'
- path
- else
- File.join(path, "") # xxx: Is File.join is appropriate to add separator?
- end
- end
- private :add_trailing_separator
-
- def del_trailing_separator(path)
- if r = chop_basename(path)
- pre, basename = r
- pre + basename
- elsif /#{SEPARATOR_PAT}+\z/o =~ path
- $` + File.dirname(path)[/#{SEPARATOR_PAT}*\z/o]
- else
- path
- end
- end
- private :del_trailing_separator
-
def cleanpath_conservative
- path = @path
- names = []
- pre = path
- while r = chop_basename(pre)
- pre, base = r
- names.unshift base if base != '.'
- end
- if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
- names.shift while names[0] == '..'
- end
- if names.empty?
- self.class.new(File.dirname(pre))
- else
- if names.last != '..' && File.basename(path) == '.'
- names << '.'
- end
- result = prepend_prefix(pre, File.join(*names))
- if /\A(?:\.|\.\.)\z/ !~ names.last && has_trailing_separator?(path)
- self.class.new(add_trailing_separator(result))
- else
- self.class.new(result)
+ return Pathname.new('') if @path == ''
+ names = @path.scan(%r{[^/]+})
+ last_dot = names.last == '.'
+ names.delete('.')
+ names.shift while names.first == '..' if absolute?
+ return Pathname.new(absolute? ? '/' : '.') if names.empty?
+ path = absolute? ? '/' : ''
+ path << names.join('/')
+ if names.last != '..'
+ if last_dot
+ path << '/.'
+ elsif %r{/\z} =~ @path
+ path << '/'
end
end
+ Pathname.new(path)
end
private :cleanpath_conservative
- def realpath_rec(prefix, unresolved, h)
+ #
+ # Returns a real (absolute) pathname of +self+ in the actual filesystem.
+ # The real pathname doesn't contain symlinks or useless dots.
+ #
+ # No arguments should be given; the old behaviour is *obsoleted*.
+ #
+ def realpath(*args)
+ unless args.empty?
+ warn "The argument for Pathname#realpath is obsoleted."
+ end
+ force_absolute = args.fetch(0, true)
+
+ if %r{\A/} =~ @path
+ top = '/'
+ unresolved = @path.scan(%r{[^/]+})
+ elsif force_absolute
+ # Although POSIX getcwd returns a pathname which contains no symlink,
+ # 4.4BSD-Lite2 derived getcwd may return the environment variable $PWD
+ # which may contain a symlink.
+ # So the return value of Dir.pwd should be examined.
+ top = '/'
+ unresolved = Dir.pwd.scan(%r{[^/]+}) + @path.scan(%r{[^/]+})
+ else
+ top = ''
+ unresolved = @path.scan(%r{[^/]+})
+ end
resolved = []
+
until unresolved.empty?
- n = unresolved.shift
- if n == '.'
- next
- elsif n == '..'
- resolved.pop
+ case unresolved.last
+ when '.'
+ unresolved.pop
+ when '..'
+ resolved.unshift unresolved.pop
else
- path = prepend_prefix(prefix, File.join(*(resolved + [n])))
- if h.include? path
- if h[path] == :resolving
- raise Errno::ELOOP.new(path)
+ loop_check = {}
+ while (stat = File.lstat(path = top + unresolved.join('/'))).symlink?
+ symlink_id = "#{stat.dev}:#{stat.ino}"
+ raise Errno::ELOOP.new(path) if loop_check[symlink_id]
+ loop_check[symlink_id] = true
+ if %r{\A/} =~ (link = File.readlink(path))
+ top = '/'
+ unresolved = link.scan(%r{[^/]+})
else
- prefix, *resolved = h[path]
+ unresolved[-1,1] = link.scan(%r{[^/]+})
end
+ end
+ next if (filename = unresolved.pop) == '.'
+ if filename != '..' && resolved.first == '..'
+ resolved.shift
else
- s = File.lstat(path)
- if s.symlink?
- h[path] = :resolving
- link_prefix, link_names = split_names(File.readlink(path))
- if link_prefix == ''
- prefix, *resolved = h[path] = realpath_rec(prefix, resolved + link_names, h)
- else
- prefix, *resolved = h[path] = realpath_rec(link_prefix, link_names, h)
- end
- else
- resolved << n
- h[path] = [prefix, *resolved]
- end
+ resolved.unshift filename
end
end
end
- return prefix, *resolved
- end
- private :realpath_rec
- #
- # Returns a real (absolute) pathname of +self+ in the actual filesystem.
- # The real pathname doesn't contain symlinks or useless dots.
- #
- # No arguments should be given; the old behaviour is *obsoleted*.
- #
- def realpath
- path = @path
- prefix, names = split_names(path)
- if prefix == ''
- prefix, names2 = split_names(Dir.pwd)
- names = names2 + names
+ if top == '/'
+ resolved.shift while resolved[0] == '..'
+ end
+
+ if resolved.empty?
+ Pathname.new(top.empty? ? '.' : '/')
+ else
+ Pathname.new(top + resolved.join('/'))
end
- prefix, *names = realpath_rec(prefix, names, {})
- self.class.new(prepend_prefix(prefix, File.join(*names)))
end
# #parent returns the parent directory.
@@ -481,91 +396,28 @@ class Pathname
# pathnames which points to roots such as <tt>/usr/..</tt>.
#
def root?
- !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)
+ %r{\A/+\z} =~ @path ? true : false
end
# Predicate method for testing whether a path is absolute.
# It returns +true+ if the pathname begins with a slash.
def absolute?
- !relative?
+ %r{\A/} =~ @path ? true : false
end
# The opposite of #absolute?
def relative?
- path = @path
- while r = chop_basename(path)
- path, basename = r
- end
- path == ''
+ !absolute?
end
#
# Iterates over each component of the path.
#
- # Pathname.new("/usr/bin/ruby").each_filename {|filename| ... }
+ # Pathname.new("/usr/bin/ruby").each_filename
# # yields "usr", "bin", and "ruby".
#
- def each_filename # :yield: filename
- prefix, names = split_names(@path)
- names.each {|filename| yield filename }
- nil
- end
-
- # Iterates over and yields a new Pathname object
- # for each element in the given path in descending order.
- #
- # Pathname.new('/path/to/some/file.rb').descend {|v| p v}
- # #<Pathname:/>
- # #<Pathname:/path>
- # #<Pathname:/path/to>
- # #<Pathname:/path/to/some>
- # #<Pathname:/path/to/some/file.rb>
- #
- # Pathname.new('path/to/some/file.rb').descend {|v| p v}
- # #<Pathname:path>
- # #<Pathname:path/to>
- # #<Pathname:path/to/some>
- # #<Pathname:path/to/some/file.rb>
- #
- # It doesn't access actual filesystem.
- #
- # This method is available since 1.8.5.
- #
- def descend
- vs = []
- ascend {|v| vs << v }
- vs.reverse_each {|v| yield v }
- nil
- end
-
- # Iterates over and yields a new Pathname object
- # for each element in the given path in ascending order.
- #
- # Pathname.new('/path/to/some/file.rb').ascend {|v| p v}
- # #<Pathname:/path/to/some/file.rb>
- # #<Pathname:/path/to/some>
- # #<Pathname:/path/to>
- # #<Pathname:/path>
- # #<Pathname:/>
- #
- # Pathname.new('path/to/some/file.rb').ascend {|v| p v}
- # #<Pathname:path/to/some/file.rb>
- # #<Pathname:path/to/some>
- # #<Pathname:path/to>
- # #<Pathname:path>
- #
- # It doesn't access actual filesystem.
- #
- # This method is available since 1.8.5.
- #
- def ascend
- path = @path
- yield self
- while r = chop_basename(path)
- path, name = r
- break if path.empty?
- yield self.class.new(del_trailing_separator(path))
- end
+ def each_filename # :yield: s
+ @path.scan(%r{[^/]+}) { yield $& }
end
#
@@ -580,50 +432,32 @@ class Pathname
#
def +(other)
other = Pathname.new(other) unless Pathname === other
- Pathname.new(plus(@path, other.to_s))
- end
- def plus(path1, path2) # -> path
- prefix2 = path2
- index_list2 = []
- basename_list2 = []
- while r2 = chop_basename(prefix2)
- prefix2, basename2 = r2
- index_list2.unshift prefix2.length
- basename_list2.unshift basename2
- end
- return path2 if prefix2 != ''
- prefix1 = path1
- while true
- while !basename_list2.empty? && basename_list2.first == '.'
- index_list2.shift
- basename_list2.shift
- end
- break unless r1 = chop_basename(prefix1)
- prefix1, basename1 = r1
- next if basename1 == '.'
- if basename1 == '..' || basename_list2.empty? || basename_list2.first != '..'
- prefix1 = prefix1 + basename1
- break
- end
- index_list2.shift
- basename_list2.shift
+ return other if other.absolute?
+
+ path1 = @path
+ path2 = other.to_s
+ while m2 = %r{\A\.\.(?:/+|\z)}.match(path2) and
+ m1 = %r{(\A|/+)([^/]+)\z}.match(path1) and
+ %r{\A(?:\.|\.\.)\z} !~ m1[2]
+ path1 = m1[1].empty? ? '.' : '/' if (path1 = m1.pre_match).empty?
+ path2 = '.' if (path2 = m2.post_match).empty?
end
- r1 = chop_basename(prefix1)
- if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1)
- while !basename_list2.empty? && basename_list2.first == '..'
- index_list2.shift
- basename_list2.shift
+ if %r{\A/+\z} =~ path1
+ while m2 = %r{\A\.\.(?:/+|\z)}.match(path2)
+ path2 = '.' if (path2 = m2.post_match).empty?
end
end
- if !basename_list2.empty?
- suffix2 = path2[index_list2.first..-1]
- r1 ? File.join(prefix1, suffix2) : prefix1 + suffix2
+
+ return Pathname.new(path2) if path1 == '.'
+ return Pathname.new(path1) if path2 == '.'
+
+ if %r{/\z} =~ path1
+ Pathname.new(path1 + path2)
else
- r1 ? prefix1 : File.dirname(prefix1)
+ Pathname.new(path1 + '/' + path2)
end
end
- private :plus
#
# Pathname#join joins pathnames.
@@ -671,9 +505,9 @@ class Pathname
Dir.foreach(@path) {|e|
next if e == '.' || e == '..'
if with_directory
- result << self.class.new(File.join(@path, e))
+ result << Pathname.new(File.join(@path, e))
else
- result << self.class.new(e)
+ result << Pathname.new(e)
end
}
result
@@ -691,42 +525,44 @@ class Pathname
# This method has existed since 1.8.1.
#
def relative_path_from(base_directory)
- dest_directory = self.cleanpath.to_s
- base_directory = base_directory.cleanpath.to_s
- dest_prefix = dest_directory
- dest_names = []
- while r = chop_basename(dest_prefix)
- dest_prefix, basename = r
- dest_names.unshift basename if basename != '.'
- end
- base_prefix = base_directory
- base_names = []
- while r = chop_basename(base_prefix)
- base_prefix, basename = r
- base_names.unshift basename if basename != '.'
- end
- if dest_prefix != base_prefix
- raise ArgumentError, "different prefix: #{dest_prefix.inspect} and #{base_directory.inspect}"
+ if self.absolute? != base_directory.absolute?
+ raise ArgumentError,
+ "relative path between absolute and relative path: #{self.inspect}, #{base_directory.inspect}"
end
- while !dest_names.empty? &&
- !base_names.empty? &&
- dest_names.first == base_names.first
- dest_names.shift
- base_names.shift
+
+ dest = []
+ self.cleanpath.each_filename {|f|
+ next if f == '.'
+ dest << f
+ }
+
+ base = []
+ base_directory.cleanpath.each_filename {|f|
+ next if f == '.'
+ base << f
+ }
+
+ while !base.empty? && !dest.empty? && base[0] == dest[0]
+ base.shift
+ dest.shift
end
- if base_names.include? '..'
+
+ if base.include? '..'
raise ArgumentError, "base_directory has ..: #{base_directory.inspect}"
end
- base_names.fill('..')
- relpath_names = base_names + dest_names
- if relpath_names.empty?
- Pathname.new('.')
+
+ base.fill '..'
+ relpath = base + dest
+ if relpath.empty?
+ Pathname.new(".")
else
- Pathname.new(File.join(*relpath_names))
+ Pathname.new(relpath.join('/'))
end
end
+
end
+
class Pathname # * IO *
#
# #each_line iterates over the line in the file. It yields a String object
@@ -799,7 +635,7 @@ class Pathname # * File *
end
# See <tt>File.readlink</tt>. Read symbolic link.
- def readlink() self.class.new(File.readlink(@path)) end
+ def readlink() Pathname.new(File.readlink(@path)) end
# See <tt>File.rename</tt>. Rename the file.
def rename(to) File.rename(@path, to) end
@@ -820,20 +656,20 @@ class Pathname # * File *
def utime(atime, mtime) File.utime(atime, mtime, @path) end
# See <tt>File.basename</tt>. Returns the last component of the path.
- def basename(*args) self.class.new(File.basename(@path, *args)) end
+ def basename(*args) Pathname.new(File.basename(@path, *args)) end
# See <tt>File.dirname</tt>. Returns all but the last component of the path.
- def dirname() self.class.new(File.dirname(@path)) end
+ def dirname() Pathname.new(File.dirname(@path)) end
# See <tt>File.extname</tt>. Returns the file's extension.
def extname() File.extname(@path) end
# See <tt>File.expand_path</tt>.
- def expand_path(*args) self.class.new(File.expand_path(@path, *args)) end
+ def expand_path(*args) Pathname.new(File.expand_path(@path, *args)) end
# See <tt>File.split</tt>. Returns the #dirname and the #basename in an
# Array.
- def split() File.split(@path).map {|f| self.class.new(f) } end
+ def split() File.split(@path).map {|f| Pathname.new(f) } end
# Pathname#link is confusing and *obsoleted* because the receiver/argument
# order is inverted to corresponding system call.
@@ -889,9 +725,6 @@ class Pathname # * FileTest *
# See <tt>FileTest.readable?</tt>.
def readable?() FileTest.readable?(@path) end
- # See <tt>FileTest.world_readable?</tt>.
- def world_readable?() FileTest.world_readable?(@path) end
-
# See <tt>FileTest.readable_real?</tt>.
def readable_real?() FileTest.readable_real?(@path) end
@@ -916,9 +749,6 @@ class Pathname # * FileTest *
# See <tt>FileTest.writable?</tt>.
def writable?() FileTest.writable?(@path) end
- # See <tt>FileTest.world_writable?</tt>.
- def world_writable?() FileTest.world_writable?(@path) end
-
# See <tt>FileTest.writable_real?</tt>.
def writable_real?() FileTest.writable_real?(@path) end
@@ -931,14 +761,14 @@ class Pathname # * Dir *
# See <tt>Dir.glob</tt>. Returns or yields Pathname objects.
def Pathname.glob(*args) # :yield: p
if block_given?
- Dir.glob(*args) {|f| yield self.new(f) }
+ Dir.glob(*args) {|f| yield Pathname.new(f) }
else
- Dir.glob(*args).map {|f| self.new(f) }
+ Dir.glob(*args).map {|f| Pathname.new(f) }
end
end
# See <tt>Dir.getwd</tt>. Returns the current working directory as a Pathname.
- def Pathname.getwd() self.new(Dir.getwd) end
+ def Pathname.getwd() Pathname.new(Dir.getwd) end
class << self; alias pwd getwd end
# Pathname#chdir is *obsoleted* at 1.8.1.
@@ -955,14 +785,14 @@ class Pathname # * Dir *
# Return the entries (files and subdirectories) in the directory, each as a
# Pathname object.
- def entries() Dir.entries(@path).map {|f| self.class.new(f) } end
+ def entries() Dir.entries(@path).map {|f| Pathname.new(f) } end
# Iterates over the entries (files and subdirectories) in the directory. It
# yields a Pathname object for each entry.
#
# This method has existed since 1.8.1.
def each_entry(&block) # :yield: p
- Dir.foreach(@path) {|f| yield self.class.new(f) }
+ Dir.foreach(@path) {|f| yield Pathname.new(f) }
end
# Pathname#dir_foreach is *obsoleted* at 1.8.1.
@@ -998,9 +828,9 @@ class Pathname # * Find *
def find(&block) # :yield: p
require 'find'
if @path == '.'
- Find.find(@path) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
+ Find.find(@path) {|f| yield Pathname.new(f.sub(%r{\A\./}, '')) }
else
- Find.find(@path) {|f| yield self.class.new(f) }
+ Find.find(@path) {|f| yield Pathname.new(f) }
end
end
end
@@ -1030,9 +860,9 @@ class Pathname # * mixed *
# Removes a file or directory, using <tt>File.unlink</tt> or
# <tt>Dir.unlink</tt> as necessary.
def unlink()
- begin
+ if FileTest.directory? @path
Dir.unlink @path
- rescue Errno::ENOTDIR
+ else
File.unlink @path
end
end
@@ -1051,12 +881,319 @@ class Pathname # * mixed *
end
end
-module Kernel
- # create a pathname object.
- #
- # This method is available since 1.8.5.
- def Pathname(path) # :doc:
- Pathname.new(path)
+if $0 == __FILE__
+ require 'test/unit'
+
+ class PathnameTest < Test::Unit::TestCase # :nodoc:
+ def test_initialize
+ p1 = Pathname.new('a')
+ assert_equal('a', p1.to_s)
+ p2 = Pathname.new(p1)
+ assert_equal(p1, p2)
+ end
+
+ class AnotherStringLike # :nodoc:
+ def initialize(s) @s = s end
+ def to_str() @s end
+ def ==(other) @s == other end
+ end
+
+ def test_equality
+ obj = Pathname.new("a")
+ str = "a"
+ sym = :a
+ ano = AnotherStringLike.new("a")
+ assert_equal(false, obj == str)
+ assert_equal(false, str == obj)
+ assert_equal(false, obj == ano)
+ assert_equal(false, ano == obj)
+ assert_equal(false, obj == sym)
+ assert_equal(false, sym == obj)
+
+ obj2 = Pathname.new("a")
+ assert_equal(true, obj == obj2)
+ assert_equal(true, obj === obj2)
+ assert_equal(true, obj.eql?(obj2))
+ end
+
+ def test_hashkey
+ h = {}
+ h[Pathname.new("a")] = 1
+ h[Pathname.new("a")] = 2
+ assert_equal(1, h.size)
+ end
+
+ def assert_pathname_cmp(e, s1, s2)
+ p1 = Pathname.new(s1)
+ p2 = Pathname.new(s2)
+ r = p1 <=> p2
+ assert(e == r,
+ "#{p1.inspect} <=> #{p2.inspect}: <#{e}> expected but was <#{r}>")
+ end
+ def test_comparison
+ assert_pathname_cmp( 0, "a", "a")
+ assert_pathname_cmp( 1, "b", "a")
+ assert_pathname_cmp(-1, "a", "b")
+ ss = %w(
+ a
+ a/
+ a/b
+ a.
+ a0
+ )
+ s1 = ss.shift
+ ss.each {|s2|
+ assert_pathname_cmp(-1, s1, s2)
+ s1 = s2
+ }
+ end
+
+ def test_comparison_string
+ assert_equal(nil, Pathname.new("a") <=> "a")
+ assert_equal(nil, "a" <=> Pathname.new("a"))
+ end
+
+ def test_syntactical
+ assert_equal(true, Pathname.new("/").root?)
+ assert_equal(true, Pathname.new("//").root?)
+ assert_equal(true, Pathname.new("///").root?)
+ assert_equal(false, Pathname.new("").root?)
+ assert_equal(false, Pathname.new("a").root?)
+ end
+
+ def test_cleanpath
+ assert_equal('/', Pathname.new('/').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('//').cleanpath(true).to_s)
+ assert_equal('', Pathname.new('').cleanpath(true).to_s)
+
+ assert_equal('.', Pathname.new('.').cleanpath(true).to_s)
+ assert_equal('..', Pathname.new('..').cleanpath(true).to_s)
+ assert_equal('a', Pathname.new('a').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('/.').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('/..').cleanpath(true).to_s)
+ assert_equal('/a', Pathname.new('/a').cleanpath(true).to_s)
+ assert_equal('.', Pathname.new('./').cleanpath(true).to_s)
+ assert_equal('..', Pathname.new('../').cleanpath(true).to_s)
+ assert_equal('a/', Pathname.new('a/').cleanpath(true).to_s)
+
+ assert_equal('a/b', Pathname.new('a//b').cleanpath(true).to_s)
+ assert_equal('a/.', Pathname.new('a/.').cleanpath(true).to_s)
+ assert_equal('a/.', Pathname.new('a/./').cleanpath(true).to_s)
+ assert_equal('a/..', Pathname.new('a/../').cleanpath(true).to_s)
+ assert_equal('/a/.', Pathname.new('/a/.').cleanpath(true).to_s)
+ assert_equal('..', Pathname.new('./..').cleanpath(true).to_s)
+ assert_equal('..', Pathname.new('../.').cleanpath(true).to_s)
+ assert_equal('..', Pathname.new('./../').cleanpath(true).to_s)
+ assert_equal('..', Pathname.new('.././').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('/./..').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('/../.').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('/./../').cleanpath(true).to_s)
+ assert_equal('/', Pathname.new('/.././').cleanpath(true).to_s)
+
+ assert_equal('a/b/c', Pathname.new('a/b/c').cleanpath(true).to_s)
+ assert_equal('b/c', Pathname.new('./b/c').cleanpath(true).to_s)
+ assert_equal('a/c', Pathname.new('a/./c').cleanpath(true).to_s)
+ assert_equal('a/b/.', Pathname.new('a/b/.').cleanpath(true).to_s)
+ assert_equal('a/..', Pathname.new('a/../.').cleanpath(true).to_s)
+
+ assert_equal('/a', Pathname.new('/../.././../a').cleanpath(true).to_s)
+ assert_equal('a/b/../../../../c/../d',
+ Pathname.new('a/b/../../../../c/../d').cleanpath(true).to_s)
+ end
+
+ def test_cleanpath_no_symlink
+ assert_equal('/', Pathname.new('/').cleanpath.to_s)
+ assert_equal('/', Pathname.new('//').cleanpath.to_s)
+ assert_equal('', Pathname.new('').cleanpath.to_s)
+
+ assert_equal('.', Pathname.new('.').cleanpath.to_s)
+ assert_equal('..', Pathname.new('..').cleanpath.to_s)
+ assert_equal('a', Pathname.new('a').cleanpath.to_s)
+ assert_equal('/', Pathname.new('/.').cleanpath.to_s)
+ assert_equal('/', Pathname.new('/..').cleanpath.to_s)
+ assert_equal('/a', Pathname.new('/a').cleanpath.to_s)
+ assert_equal('.', Pathname.new('./').cleanpath.to_s)
+ assert_equal('..', Pathname.new('../').cleanpath.to_s)
+ assert_equal('a', Pathname.new('a/').cleanpath.to_s)
+
+ assert_equal('a/b', Pathname.new('a//b').cleanpath.to_s)
+ assert_equal('a', Pathname.new('a/.').cleanpath.to_s)
+ assert_equal('a', Pathname.new('a/./').cleanpath.to_s)
+ assert_equal('.', Pathname.new('a/../').cleanpath.to_s)
+ assert_equal('/a', Pathname.new('/a/.').cleanpath.to_s)
+ assert_equal('..', Pathname.new('./..').cleanpath.to_s)
+ assert_equal('..', Pathname.new('../.').cleanpath.to_s)
+ assert_equal('..', Pathname.new('./../').cleanpath.to_s)
+ assert_equal('..', Pathname.new('.././').cleanpath.to_s)
+ assert_equal('/', Pathname.new('/./..').cleanpath.to_s)
+ assert_equal('/', Pathname.new('/../.').cleanpath.to_s)
+ assert_equal('/', Pathname.new('/./../').cleanpath.to_s)
+ assert_equal('/', Pathname.new('/.././').cleanpath.to_s)
+
+ assert_equal('a/b/c', Pathname.new('a/b/c').cleanpath.to_s)
+ assert_equal('b/c', Pathname.new('./b/c').cleanpath.to_s)
+ assert_equal('a/c', Pathname.new('a/./c').cleanpath.to_s)
+ assert_equal('a/b', Pathname.new('a/b/.').cleanpath.to_s)
+ assert_equal('.', Pathname.new('a/../.').cleanpath.to_s)
+
+ assert_equal('/a', Pathname.new('/../.././../a').cleanpath.to_s)
+ assert_equal('../../d', Pathname.new('a/b/../../../../c/../d').cleanpath.to_s)
+ end
+
+ def test_destructive_update
+ path = Pathname.new("a")
+ path.to_s.replace "b"
+ assert_equal(Pathname.new("a"), path)
+ end
+
+ def test_null_character
+ assert_raise(ArgumentError) { Pathname.new("\0") }
+ end
+
+ def assert_relpath(result, dest, base)
+ assert_equal(Pathname.new(result),
+ Pathname.new(dest).relative_path_from(Pathname.new(base)))
+ end
+
+ def assert_relpath_err(dest, base)
+ assert_raise(ArgumentError) {
+ Pathname.new(dest).relative_path_from(Pathname.new(base))
+ }
+ end
+
+ def test_relative_path_from
+ assert_relpath("../a", "a", "b")
+ assert_relpath("../a", "a", "b/")
+ assert_relpath("../a", "a/", "b")
+ assert_relpath("../a", "a/", "b/")
+ assert_relpath("../a", "/a", "/b")
+ assert_relpath("../a", "/a", "/b/")
+ assert_relpath("../a", "/a/", "/b")
+ assert_relpath("../a", "/a/", "/b/")
+
+ assert_relpath("../b", "a/b", "a/c")
+ assert_relpath("../a", "../a", "../b")
+
+ assert_relpath("a", "a", ".")
+ assert_relpath("..", ".", "a")
+
+ assert_relpath(".", ".", ".")
+ assert_relpath(".", "..", "..")
+ assert_relpath("..", "..", ".")
+
+ assert_relpath("c/d", "/a/b/c/d", "/a/b")
+ assert_relpath("../..", "/a/b", "/a/b/c/d")
+ assert_relpath("../../../../e", "/e", "/a/b/c/d")
+ assert_relpath("../b/c", "a/b/c", "a/d")
+
+ assert_relpath("../a", "/../a", "/b")
+ assert_relpath("../../a", "../a", "b")
+ assert_relpath(".", "/a/../../b", "/b")
+ assert_relpath("..", "a/..", "a")
+ assert_relpath(".", "a/../b", "b")
+
+ assert_relpath("a", "a", "b/..")
+ assert_relpath("b/c", "b/c", "b/..")
+
+ assert_relpath_err("/", ".")
+ assert_relpath_err(".", "/")
+ assert_relpath_err("a", "..")
+ assert_relpath_err(".", "..")
+ end
+
+ def assert_pathname_plus(a, b, c)
+ a = Pathname.new(a)
+ b = Pathname.new(b)
+ c = Pathname.new(c)
+ d = b + c
+ assert(a == d,
+ "#{b.inspect} + #{c.inspect}: #{a.inspect} expected but was #{d.inspect}")
+ end
+
+ def test_plus
+ assert_pathname_plus('a/b', 'a', 'b')
+ assert_pathname_plus('a', 'a', '.')
+ assert_pathname_plus('b', '.', 'b')
+ assert_pathname_plus('.', '.', '.')
+ assert_pathname_plus('/b', 'a', '/b')
+
+ assert_pathname_plus('/', '/', '..')
+ assert_pathname_plus('.', 'a', '..')
+ assert_pathname_plus('a', 'a/b', '..')
+ assert_pathname_plus('../..', '..', '..')
+ assert_pathname_plus('/c', '/', '../c')
+ assert_pathname_plus('c', 'a', '../c')
+ assert_pathname_plus('a/c', 'a/b', '../c')
+ assert_pathname_plus('../../c', '..', '../c')
+ end
+
+ def test_taint
+ obj = Pathname.new("a"); assert_same(obj, obj.taint)
+ obj = Pathname.new("a"); assert_same(obj, obj.untaint)
+
+ assert_equal(false, Pathname.new("a" ) .tainted?)
+ assert_equal(false, Pathname.new("a" ) .to_s.tainted?)
+ assert_equal(true, Pathname.new("a" ).taint .tainted?)
+ assert_equal(true, Pathname.new("a" ).taint.to_s.tainted?)
+ assert_equal(true, Pathname.new("a".taint) .tainted?)
+ assert_equal(true, Pathname.new("a".taint) .to_s.tainted?)
+ assert_equal(true, Pathname.new("a".taint).taint .tainted?)
+ assert_equal(true, Pathname.new("a".taint).taint.to_s.tainted?)
+
+ str = "a"
+ path = Pathname.new(str)
+ str.taint
+ assert_equal(false, path .tainted?)
+ assert_equal(false, path.to_s.tainted?)
+ end
+
+ def test_untaint
+ obj = Pathname.new("a"); assert_same(obj, obj.untaint)
+
+ assert_equal(false, Pathname.new("a").taint.untaint .tainted?)
+ assert_equal(false, Pathname.new("a").taint.untaint.to_s.tainted?)
+
+ str = "a".taint
+ path = Pathname.new(str)
+ str.untaint
+ assert_equal(true, path .tainted?)
+ assert_equal(true, path.to_s.tainted?)
+ end
+
+ def test_freeze
+ obj = Pathname.new("a"); assert_same(obj, obj.freeze)
+
+ assert_equal(false, Pathname.new("a" ) .frozen?)
+ assert_equal(false, Pathname.new("a".freeze) .frozen?)
+ assert_equal(true, Pathname.new("a" ).freeze .frozen?)
+ assert_equal(true, Pathname.new("a".freeze).freeze .frozen?)
+ assert_equal(false, Pathname.new("a" ) .to_s.frozen?)
+ assert_equal(false, Pathname.new("a".freeze) .to_s.frozen?)
+ assert_equal(false, Pathname.new("a" ).freeze.to_s.frozen?)
+ assert_equal(false, Pathname.new("a".freeze).freeze.to_s.frozen?)
+ end
+
+ def test_to_s
+ str = "a"
+ obj = Pathname.new(str)
+ assert_equal(str, obj.to_s)
+ assert_not_same(str, obj.to_s)
+ assert_not_same(obj.to_s, obj.to_s)
+ end
+
+ def test_kernel_open
+ count = 0
+ stat1 = File.stat(__FILE__)
+ result = Kernel.open(Pathname.new(__FILE__)) {|f|
+ stat2 = f.stat
+ assert_equal(stat1.dev, stat2.dev)
+ assert_equal(stat1.ino, stat2.ino)
+ assert_equal(stat1.size, stat2.size)
+ count += 1
+ 2
+ }
+ assert_equal(1, count)
+ assert_equal(2, result)
+ end
end
- private :Pathname
end
diff --git a/lib/ping.rb b/lib/ping.rb
index 7728ece979..7f970f96de 100644
--- a/lib/ping.rb
+++ b/lib/ping.rb
@@ -1,35 +1,46 @@
#
# ping.rb -- check a host for upness
#
-
-require 'timeout'
-require "socket"
-
#= SYNOPSIS
#
# require 'ping'
-#
-# puts "'jimmy' is alive and kicking" if Ping.pingecho('jimmy', 10)
+# print "'jimmy' is alive and kicking\n" if Ping.pingecho('jimmy', 10) ;
#
#= DESCRIPTION
#
# This module contains routines to test for the reachability of remote hosts.
# Currently the only routine implemented is pingecho().
#
-# pingecho() uses a TCP echo (_not_ an ICMP echo) to determine if the
+# pingecho() uses a TCP echo (I<not> an ICMP one) to determine if the
# remote host is reachable. This is usually adequate to tell that a remote
-# host is available to rsh(1), ftp(1), or telnet(1) to.
+# host is available to rsh(1), ftp(1), or telnet(1) onto.
+#
+#== Parameters
+#
+# : hostname
+#
+# The remote host to check, specified either as a hostname or as an
+# IP address.
+#
+# : timeout
+#
+# The timeout in seconds. If not specified it will default to 5 seconds.
+#
+# : service
+#
+# The service port to connect. The default is "echo".
#
#= WARNING
#
-# pingecho() may block for a long period if name resolution is slow. Require
-# 'resolv-replace' to use non-blocking name resolution.
+# pingecho() uses user-level thread to implement the timeout, so it may block
+# for long period if named does not respond for some reason.
#
-module Ping
+#=end
- # return true if we can open a connection to the hostname or IP address
- # +host+ on port +service+ (which defaults to the "echo" port) waiting up to
- # +timeout+ seconds.
+require 'timeout'
+require "socket"
+
+module Ping
def pingecho(host, timeout=5, service="echo")
begin
timeout(timeout) do
@@ -38,7 +49,7 @@ module Ping
end
rescue Errno::ECONNREFUSED
return true
- rescue Timeout::Error, StandardError
+ rescue Timeout::Error
return false
end
return true
diff --git a/lib/pp.rb b/lib/pp.rb
index 8080d879f9..756dce6f51 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -1,61 +1,156 @@
-# == Pretty-printer for Ruby objects.
-#
-# = Which seems better?
-#
-# non-pretty-printed output by #p is:
-# #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @group_stack=[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], @buffer_width=0, @indent=0, @maxwidth=79, @output_width=2, @output=#<IO:0x8114ee4>>
-#
-# pretty-printed output by #pp is:
-# #<PP:0x81fedf0
-# @buffer=[],
-# @buffer_width=0,
-# @genspace=#<Proc:0x81feda0>,
-# @group_queue=
-# #<PrettyPrint::GroupQueue:0x81fed3c
-# @queue=
-# [[#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
-# []]>,
-# @group_stack=
-# [#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
-# @indent=0,
-# @maxwidth=79,
-# @newline="\n",
-# @output=#<IO:0x8114ee4>,
-# @output_width=2>
-#
-# I like the latter. If you do too, this library is for you.
-#
-# = Usage
-#
-# pp(obj)
-#
-# output +obj+ to +$>+ in pretty printed format.
-#
-# It returns +nil+.
-#
-# = Output Customization
-# To define your customized pretty printing function for your classes,
-# redefine a method #pretty_print(+pp+) in the class.
-# It takes an argument +pp+ which is an instance of the class PP.
-# The method should use PP#text, PP#breakable, PP#nest, PP#group and
-# PP#pp to print the object.
-#
-# = Author
-# Tanaka Akira <akr@m17n.org>
+# $Id$
+
+=begin
+= Pretty-printer for Ruby objects.
+
+== Which seems better?
+
+non-pretty-printed output by (({p})) is:
+ #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @group_stack=[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], @buffer_width=0, @indent=0, @maxwidth=79, @output_width=2, @output=#<IO:0x8114ee4>>
+
+pretty-printed output by (({pp})) is:
+ #<PP:0x81fedf0
+ @buffer=[],
+ @buffer_width=0,
+ @genspace=#<Proc:0x81feda0>,
+ @group_queue=
+ #<PrettyPrint::GroupQueue:0x81fed3c
+ @queue=
+ [[#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
+ []]>,
+ @group_stack=
+ [#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
+ @indent=0,
+ @maxwidth=79,
+ @newline="\n",
+ @output=#<IO:0x8114ee4>,
+ @output_width=2>
+
+I like the latter. If you do too, this library is for you.
+
+== Usage
+
+: pp(obj)
+ output ((|obj|)) to (({$>})) in pretty printed format.
+
+ It returns (({nil})).
+
+== Output Customization
+To define your customized pretty printing function for your classes,
+redefine a method (({pretty_print(((|pp|)))})) in the class.
+It takes an argument ((|pp|)) which is an instance of the class ((<PP>)).
+The method should use PP#text, PP#breakable, PP#nest, PP#group and
+PP#pp to print the object.
+
+= PP
+== super class
+((<PrettyPrint>))
+
+== class methods
+--- PP.pp(obj[, out[, width]])
+ outputs ((|obj|)) to ((|out|)) in pretty printed format of
+ ((|width|)) columns in width.
+
+ If ((|out|)) is omitted, (({$>})) is assumed.
+ If ((|width|)) is omitted, 79 is assumed.
+
+ PP.pp returns ((|out|)).
+
+--- PP.singleline_pp(obj[, out])
+ outputs ((|obj|)) to ((|out|)) like (({PP.pp})) but with no indent and
+ newline.
+
+ PP.singleline_pp returns ((|out|)).
+
+--- PP.sharing_detection
+ returns the sharing detection flag as a boolean value.
+ It is false by default.
+
+--- PP.sharing_detection = boolean_value
+ sets the sharing detection flag.
+
+== methods
+--- pp(obj)
+ adds ((|obj|)) to the pretty printing buffer
+ using Object#pretty_print or Object#pretty_print_cycle.
+
+ Object#pretty_print_cycle is used when ((|obj|)) is already
+ printed, a.k.a the object reference chain has a cycle.
+
+--- object_group(obj) { ... }
+ is a convenience method which is same as follows:
+
+ group(1, '#<' + obj.class.name, '>') { ... }
+
+--- comma_breakable
+ is a convenience method which is same as follows:
+
+ text ','
+ breakable
+
+--- seplist(list[, separator_proc[, iter_method]]) {|elt| ... }
+ adds a separated list.
+ The list is separated by comma with breakable space, by default.
+
+ seplist iterates the ((|list|)) using ((|iter_method|)).
+ It yields each object to the block given for seplist.
+ The procedure ((|separator_proc|)) is called between each yields.
+
+ If the iteration is zero times, ((|separator_proc|)) is not called at all.
+
+ If ((|separator_proc|)) is nil or not given,
+ (({lambda { comma_breakable }})) is used.
+ If ((|iter_method|)) is not given, (({:each})) is used.
+
+ For example, following 3 code fragments has similar effect.
+
+ q.seplist([1,2,3]) {|v| xxx v }
+
+ q.seplist([1,2,3], lambda { comma_breakable }, :each) {|v| xxx v }
+
+ xxx 1
+ q.comma_breakable
+ xxx 2
+ q.comma_breakable
+ xxx 3
+
+= Object
+--- pretty_print(pp)
+ is a default pretty printing method for general objects.
+ It calls (({pretty_print_instance_variables})) to list instance variables.
+
+ If (({self})) has a customized (redefined) (({inspect})) method,
+ the result of (({self.inspect})) is used but it obviously has no
+ line break hints.
+
+ This module provides predefined pretty_print() methods for some of
+ the most commonly used built-in classes for convenience.
+
+--- pretty_print_cycle(pp)
+ is a default pretty printing method for general objects that are
+ detected as part of a cycle.
+
+--- pretty_print_instance_variables
+ returns a sorted array of instance variable names.
+
+ This method should return an array of names of instance variables as symbols or strings as:
+ (({[:@a, :@b]})).
+
+--- pretty_print_inspect
+ is (({inspect})) implementation using (({pretty_print})).
+ If you implement (({pretty_print})), it can be used as follows.
+
+ alias inspect pretty_print_inspect
+
+== AUTHOR
+Tanaka Akira <akr@m17n.org>
+=end
require 'prettyprint'
module Kernel
- # returns a pretty printed object as a string.
- def pretty_inspect
- PP.pp(self, '')
- end
-
private
- # prints arguments in pretty form.
- #
- # pp returns nil.
- def pp(*objs) # :doc:
+ def pp(*objs)
objs.each {|obj|
PP.pp(obj)
}
@@ -65,13 +160,6 @@ module Kernel
end
class PP < PrettyPrint
- # Outputs +obj+ to +out+ in pretty printed format of
- # +width+ columns in width.
- #
- # If +out+ is omitted, +$>+ is assumed.
- # If +width+ is omitted, 79 is assumed.
- #
- # PP.pp returns +out+.
def PP.pp(obj, out=$>, width=79)
q = PP.new(out, width)
q.guard_inspect_key {q.pp obj}
@@ -80,10 +168,6 @@ class PP < PrettyPrint
out << "\n"
end
- # Outputs +obj+ to +out+ like PP.pp but with no indent and
- # newline.
- #
- # PP.singleline_pp returns +out+.
def PP.singleline_pp(obj, out=$>)
q = SingleLine.new(out)
q.guard_inspect_key {q.pp obj}
@@ -91,16 +175,8 @@ class PP < PrettyPrint
out
end
- # :stopdoc:
- def PP.mcall(obj, mod, meth, *args, &block)
- mod.instance_method(meth).bind(obj).call(*args, &block)
- end
- # :startdoc:
-
@sharing_detection = false
class << self
- # Returns the sharing detection flag as a boolean value.
- # It is false by default.
attr_accessor :sharing_detection
end
@@ -122,11 +198,6 @@ class PP < PrettyPrint
end
end
- # Adds +obj+ to the pretty printing buffer
- # using Object#pretty_print or Object#pretty_print_cycle.
- #
- # Object#pretty_print_cycle is used when +obj+ is already
- # printed, a.k.a the object reference chain has a cycle.
def pp(obj)
id = obj.__id__
@@ -143,10 +214,7 @@ class PP < PrettyPrint
end
end
- # A convenience method which is same as follows:
- #
- # group(1, '#<' + obj.class.name, '>') { ... }
- def object_group(obj, &block) # :yield:
+ def object_group(obj, &block)
group(1, '#<' + obj.class.name, '>', &block)
end
@@ -156,40 +224,12 @@ class PP < PrettyPrint
group(1, "\#<#{obj.class}:0x#{id}", '>', &block)
end
- # A convenience method which is same as follows:
- #
- # text ','
- # breakable
def comma_breakable
text ','
breakable
end
- # Adds a separated list.
- # The list is separated by comma with breakable space, by default.
- #
- # #seplist iterates the +list+ using +iter_method+.
- # It yields each object to the block given for #seplist.
- # The procedure +separator_proc+ is called between each yields.
- #
- # If the iteration is zero times, +separator_proc+ is not called at all.
- #
- # If +separator_proc+ is nil or not given,
- # +lambda { comma_breakable }+ is used.
- # If +iter_method+ is not given, :each is used.
- #
- # For example, following 3 code fragments has similar effect.
- #
- # q.seplist([1,2,3]) {|v| xxx v }
- #
- # q.seplist([1,2,3], lambda { comma_breakable }, :each) {|v| xxx v }
- #
- # xxx 1
- # q.comma_breakable
- # xxx 2
- # q.comma_breakable
- # xxx 3
- def seplist(list, sep=nil, iter_method=:each) # :yield: element
+ def seplist(list, sep=nil, iter_method=:each)
sep ||= lambda { comma_breakable }
first = true
list.__send__(iter_method) {|*v|
@@ -245,15 +285,6 @@ class PP < PrettyPrint
# 3. specific to_s if instance variable is empty
# 4. generic pretty_print
- # A default pretty printing method for general objects.
- # It calls #pretty_print_instance_variables to list instance variables.
- #
- # If +self+ has a customized (redefined) #inspect method,
- # the result of self.inspect is used but it obviously has no
- # line break hints.
- #
- # This module provides predefined #pretty_print methods for some of
- # the most commonly used built-in classes for convenience.
def pretty_print(q)
if /\(Kernel\)#/ !~ method(:inspect).inspect
q.text self.inspect
@@ -264,8 +295,6 @@ class PP < PrettyPrint
end
end
- # A default pretty printing method for general objects that are
- # detected as part of a cycle.
def pretty_print_cycle(q)
q.object_address_group(self) {
q.breakable
@@ -273,24 +302,13 @@ class PP < PrettyPrint
}
end
- # Returns a sorted array of instance variable names.
- #
- # This method should return an array of names of instance variables as symbols or strings as:
- # +[:@a, :@b]+.
def pretty_print_instance_variables
instance_variables.sort
end
- # Is #inspect implementation using #pretty_print.
- # If you implement #pretty_print, it can be used as follows.
- #
- # alias inspect pretty_print_inspect
- #
- # However, doing this requires that every class that #inspect is called on
- # implement #pretty_print, or a RuntimeError will be raised.
def pretty_print_inspect
if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect
- raise "pretty_print is not overridden for #{self.class}"
+ raise "pretty_print is not overridden."
end
PP.singleline_pp(self, '')
end
@@ -329,8 +347,8 @@ end
class Struct
def pretty_print(q)
- q.group(1, '#<struct ' + PP.mcall(self, Kernel, :class).name, '>') {
- q.seplist(PP.mcall(self, Struct, :members), lambda { q.text "," }) {|member|
+ q.group(1, '#<struct ' + self.class.name, '>') {
+ q.seplist(self.members, lambda { q.text "," }) {|member|
q.breakable
q.text member.to_s
q.text '='
@@ -343,7 +361,7 @@ class Struct
end
def pretty_print_cycle(q)
- q.text sprintf("#<struct %s:...>", PP.mcall(self, Kernel, :class).name)
+ q.text sprintf("#<struct %s:...>", self.class.name)
end
end
@@ -389,23 +407,19 @@ class File
q.group {
q.text "uid="; q.pp self.uid
begin
- pw = Etc.getpwuid(self.uid)
+ name = Etc.getpwuid(self.uid).name
+ q.breakable; q.text "(#{name})"
rescue ArgumentError
end
- if pw
- q.breakable; q.text "(#{pw.name})"
- end
}
q.comma_breakable
q.group {
q.text "gid="; q.pp self.gid
begin
- gr = Etc.getgrgid(self.gid)
+ name = Etc.getgrgid(self.gid).name
+ q.breakable; q.text "(#{name})"
rescue ArgumentError
end
- if gr
- q.breakable; q.text "(#{gr.name})"
- end
}
q.comma_breakable
q.group {
@@ -470,7 +484,6 @@ end
}
}
-# :enddoc:
if __FILE__ == $0
require 'test/unit'
@@ -482,12 +495,6 @@ if __FILE__ == $0
def test_list0123_11
assert_equal("[0,\n 1,\n 2,\n 3]\n", PP.pp([0,1,2,3], '', 11))
end
-
- OverriddenStruct = Struct.new("OverriddenStruct", :members, :class)
- def test_struct_override_members # [ruby-core:7865]
- a = OverriddenStruct.new(1,2)
- assert_equal("#<struct Struct::OverriddenStruct members=1, class=2>\n", PP.pp(a, ''))
- end
end
class HasInspect
diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb
index 507a05e65c..7b38cc0112 100644
--- a/lib/prettyprint.rb
+++ b/lib/prettyprint.rb
@@ -1,45 +1,131 @@
# $Id$
-# This class implements a pretty printing algorithm. It finds line breaks and
-# nice indentations for grouped structure.
-#
-# By default, the class assumes that primitive elements are strings and each
-# byte in the strings have single column in width. But it can be used for
-# other situations by giving suitable arguments for some methods:
-# * newline object and space generation block for PrettyPrint.new
-# * optional width argument for PrettyPrint#text
-# * PrettyPrint#breakable
-#
-# There are several candidate uses:
-# * text formatting using proportional fonts
-# * multibyte characters which has columns different to number of bytes
-# * non-string formatting
-#
-# == Bugs
-# * Box based formatting?
-# * Other (better) model/algorithm?
-#
-# == References
-# Christian Lindig, Strictly Pretty, March 2000,
-# http://www.st.cs.uni-sb.de/~lindig/papers/#pretty
-#
-# Philip Wadler, A prettier printer, March 1998,
-# http://homepages.inf.ed.ac.uk/wadler/topics/language-design.html#prettier
-#
-# == Author
-# Tanaka Akira <akr@m17n.org>
-#
-class PrettyPrint
+=begin
+= PrettyPrint
+The class implements pretty printing algorithm.
+It finds line breaks and nice indentations for grouped structure.
+
+By default, the class assumes that primitive elements are strings and
+each byte in the strings have single column in width.
+But it can be used for other situations
+by giving suitable arguments for some methods:
+newline object and space generation block for (({PrettyPrint.new})),
+optional width argument for (({PrettyPrint#text})),
+(({PrettyPrint#breakable})), etc.
+There are several candidates to use them:
+text formatting using proportional fonts,
+multibyte characters which has columns different to number of bytes,
+non-string formatting, etc.
+
+== class methods
+--- PrettyPrint.new([output[, maxwidth[, newline]]]) [{|width| ...}]
+ creates a buffer for pretty printing.
+
+ ((|output|)) is an output target.
+ If it is not specified, (({''})) is assumed.
+ It should have a (({<<})) method which accepts
+ the first argument ((|obj|)) of (({PrettyPrint#text})),
+ the first argument ((|sep|)) of (({PrettyPrint#breakable})),
+ the first argument ((|newline|)) of (({PrettyPrint.new})),
+ and
+ the result of a given block for (({PrettyPrint.new})).
+
+ ((|maxwidth|)) specifies maximum line length.
+ If it is not specified, 79 is assumed.
+ However actual outputs may overflow ((|maxwidth|)) if
+ long non-breakable texts are provided.
+
+ ((|newline|)) is used for line breaks.
+ (({"\n"})) is used if it is not specified.
+
+ The block is used to generate spaces.
+ (({{|width| ' ' * width}})) is used if it is not given.
+
+--- PrettyPrint.format([output[, maxwidth[, newline[, genspace]]]]) {|q| ...}
+ is a convenience method which is same as follows:
+
+ begin
+ q = PrettyPrint.new(output, maxwidth, newline, &genspace)
+ ...
+ q.flush
+ output
+ end
+
+--- PrettyPrint.singleline_format([output[, maxwidth[, newline[, genspace]]]]) {|q| ...}
+ is similar to (({PrettyPrint.format})) but the result has no breaks.
+
+ ((|maxwidth|)), ((|newline|)) and ((|genspace|)) are ignored.
+ The invocation of (({breakable})) in the block doesn't break a line and
+ treated as just an invocation of (({text})).
+
+== methods
+--- text(obj[, width])
+ adds ((|obj|)) as a text of ((|width|)) columns in width.
+
+ If ((|width|)) is not specified, (({((|obj|)).length})) is used.
+
+--- breakable([sep[, width]])
+ tells "you can break a line here if necessary", and a
+ ((|width|))-column text ((|sep|)) is inserted if a line is not
+ broken at the point.
+
+ If ((|sep|)) is not specified, (({" "})) is used.
+
+ If ((|width|)) is not specified, (({((|sep|)).length})) is used.
+ You will have to specify this when ((|sep|)) is a multibyte
+ character, for example.
+
+--- nest(indent) {...}
+ increases left margin after newline with ((|indent|)) for line breaks added
+ in the block.
+
+--- group([indent[, open_obj[, close_obj[, open_width[, close_width]]]]]) {...}
+ groups line break hints added in the block.
+ The line break hints are all to be breaked or not.
+
+ If ((|indent|)) is specified, the method call is regarded as nested by
+ (({nest(((|indent|))) { ... }})).
+
+ If ((|open_obj|)) is specified, (({text open_obj, open_width})) is called
+ at first.
+ If ((|close_obj|)) is specified, (({text close_obj, close_width})) is
+ called at last.
- # This is a convenience method which is same as follows:
- #
- # begin
- # q = PrettyPrint.new(output, maxwidth, newline, &genspace)
- # ...
- # q.flush
- # output
- # end
- #
+--- flush
+ outputs buffered data.
+
+--- first?
+ first? is obsoleted at 1.8.2.
+
+ first? is a predicate to test the call is a first call to (({first?})) with
+ current group.
+ It is useful to format comma separated values as:
+
+ q.group(1, '[', ']') {
+ xxx.each {|yyy|
+ unless q.first?
+ q.text ','
+ q.breakable
+ end
+ ... pretty printing yyy ...
+ }
+ }
+
+== Bugs
+* Box based formatting? Other (better) model/algorithm?
+
+== References
+Christian Lindig, Strictly Pretty, March 2000,
+((<URL:http://www.st.cs.uni-sb.de/~lindig/papers/#pretty>))
+
+Philip Wadler, A prettier printer, March 1998,
+((<URL:http://homepages.inf.ed.ac.uk/wadler/topics/language-design.html#prettier>))
+
+== AUTHOR
+Tanaka Akira <akr@m17n.org>
+=end
+
+class PrettyPrint
def PrettyPrint.format(output='', maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n})
q = PrettyPrint.new(output, maxwidth, newline, &genspace)
yield q
@@ -47,36 +133,12 @@ class PrettyPrint
output
end
- # This is similar to PrettyPrint::format but the result has no breaks.
- #
- # +maxwidth+, +newline+ and +genspace+ are ignored.
- #
- # The invocation of +breakable+ in the block doesn't break a line and is
- # treated as just an invocation of +text+.
- #
def PrettyPrint.singleline_format(output='', maxwidth=nil, newline=nil, genspace=nil)
q = SingleLine.new(output)
yield q
output
end
- # Creates a buffer for pretty printing.
- #
- # +output+ is an output target. If it is not specified, '' is assumed. It
- # should have a << method which accepts the first argument +obj+ of
- # PrettyPrint#text, the first argument +sep+ of PrettyPrint#breakable, the
- # first argument +newline+ of PrettyPrint.new, and the result of a given
- # block for PrettyPrint.new.
- #
- # +maxwidth+ specifies maximum line length. If it is not specified, 79 is
- # assumed. However actual outputs may overflow +maxwidth+ if long
- # non-breakable texts are provided.
- #
- # +newline+ is used for line breaks. "\n" is used if it is not specified.
- #
- # The block is used to generate spaces. {|width| ' ' * width} is used if it
- # is not given.
- #
def initialize(output='', maxwidth=79, newline="\n", &genspace)
@output = output
@maxwidth = maxwidth
@@ -99,23 +161,6 @@ class PrettyPrint
@group_stack.last
end
- # first? is a predicate to test the call is a first call to first? with
- # current group.
- #
- # It is useful to format comma separated values as:
- #
- # q.group(1, '[', ']') {
- # xxx.each {|yyy|
- # unless q.first?
- # q.text ','
- # q.breakable
- # end
- # ... pretty printing yyy ...
- # }
- # }
- #
- # first? is obsoleted in 1.8.2.
- #
def first?
warn "PrettyPrint#first? is obsoleted at 1.8.2."
current_group.first?
@@ -137,10 +182,6 @@ class PrettyPrint
end
end
- # This adds +obj+ as a text of +width+ columns in width.
- #
- # If +width+ is not specified, obj.length is used.
- #
def text(obj, width=obj.length)
if @buffer.empty?
@output << obj
@@ -161,14 +202,6 @@ class PrettyPrint
group { breakable sep, width }
end
- # This tells "you can break a line here if necessary", and a +width+\-column
- # text +sep+ is inserted if a line is not broken at the point.
- #
- # If +sep+ is not specified, " " is used.
- #
- # If +width+ is not specified, +sep.length+ is used. You will have to
- # specify this when +sep+ is a multibyte character, for example.
- #
def breakable(sep=' ', width=sep.length)
group = @group_stack.last
if group.break?
@@ -184,16 +217,6 @@ class PrettyPrint
end
end
- # Groups line break hints added in the block. The line break hints are all
- # to be used or not.
- #
- # If +indent+ is specified, the method call is regarded as nested by
- # nest(indent) { ... }.
- #
- # If +open_obj+ is specified, <tt>text open_obj, open_width</tt> is called
- # before grouping. If +close_obj+ is specified, <tt>text close_obj,
- # close_width</tt> is called after grouping.
- #
def group(indent=0, open_obj='', close_obj='', open_width=open_obj.length, close_width=close_obj.length)
text open_obj, open_width
group_sub {
@@ -218,9 +241,6 @@ class PrettyPrint
end
end
- # Increases left margin after newline with +indent+ for line breaks added in
- # the block.
- #
def nest(indent)
@indent += indent
begin
@@ -230,8 +250,6 @@ class PrettyPrint
end
end
- # outputs buffered data.
- #
def flush
@buffer.each {|data|
@output_width = data.output(@output, @output_width)
diff --git a/lib/profiler.rb b/lib/profiler.rb
index 9762fa1181..74e9b96295 100644
--- a/lib/profiler.rb
+++ b/lib/profiler.rb
@@ -1,29 +1,40 @@
module Profiler__
+ Times = if defined? Process.times then Process else Time end
# internal values
@@start = @@stack = @@map = nil
PROFILE_PROC = proc{|event, file, line, id, binding, klass|
case event
when "call", "c-call"
- now = Process.times[0]
- @@stack.push [now, 0.0]
+ now = Float(Times::times[0])
+ @@stack.push [now, 0.0, id]
when "return", "c-return"
- now = Process.times[0]
- key = [klass, id]
- if tick = @@stack.pop
- data = (@@map[key] ||= [0, 0.0, 0.0, key])
- data[0] += 1
- cost = now - tick[0]
- data[1] += cost
- data[2] += cost - tick[1]
- @@stack[-1][1] += cost if @@stack[-1]
+ now = Float(Times::times[0])
+ tick = @@stack.pop
+ name = klass.to_s
+ if name.nil? then name = '' end
+ if klass.kind_of? Class
+ name += "#"
+ else
+ name += "."
end
+ name += id.id2name
+ data = @@map[name]
+ unless data
+ data = [0.0, 0.0, 0.0, name]
+ @@map[name] = data
+ end
+ data[0] += 1
+ cost = now - tick[0]
+ data[1] += cost
+ data[2] += cost - tick[1]
+ @@stack[-1][1] += cost
end
}
module_function
def start_profile
- @@start = Process.times[0]
- @@stack = []
- @@map = {}
+ @@start = Float(Times::times[0])
+ @@stack = [[0, 0, :toplevel], [0, 0, :dummy]]
+ @@map = {"#toplevel" => [1, 0, 0, "#toplevel"]}
set_trace_func PROFILE_PROC
end
def stop_profile
@@ -31,29 +42,18 @@ module_function
end
def print_profile(f)
stop_profile
- total = Process.times[0] - @@start
+ total = Float(Times::times[0]) - @@start
if total == 0 then total = 0.01 end
+ @@map["#toplevel"][1] = total
data = @@map.values
data.sort!{|a,b| b[2] <=> a[2]}
sum = 0
- f.printf " %% cumulative self self total\n"
+ f.printf " %% cumulative self self total\n"
f.printf " time seconds seconds calls ms/call ms/call name\n"
for d in data
sum += d[2]
f.printf "%6.2f %8.2f %8.2f %8d ", d[2]/total*100, sum, d[2], d[0]
- f.printf "%8.2f %8.2f %s\n", d[2]*1000/d[0], d[1]*1000/d[0], get_name(*d[3])
- end
- f.printf "%6.2f %8.2f %8.2f %8d ", 0.0, total, 0.0, 1 # ???
- f.printf "%8.2f %8.2f %s\n", 0.0, total*1000, "#toplevel" # ???
- end
- def get_name(klass, id)
- name = klass.to_s || ""
- if klass.kind_of? Class
- name += "#"
- else
- name += "."
+ f.printf "%8.2f %8.2f %s\n", d[2]*1000/d[0], d[1]*1000/d[0], d[3]
end
- name + id.id2name
end
- private :get_name
end
diff --git a/lib/pstore.rb b/lib/pstore.rb
index 46123bf0a7..51cef6e134 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -1,91 +1,24 @@
-# = PStore -- Transactional File Storage for Ruby Objects
#
-# pstore.rb -
-# originally by matz
-# documentation by Kev Jackson and James Edward Gray II
+# How to use:
#
-# See PStore for documentation.
+# db = PStore.new("/tmp/foo")
+# db.transaction do
+# p db.roots
+# ary = db["root"] = [1,2,3,4]
+# ary[0] = [1,1.5]
+# end
+# db.transaction do
+# p db["root"]
+# end
require "fileutils"
require "digest/md5"
-#
-# PStore implements a file based persistance mechanism based on a Hash. User
-# code can store hierarchies of Ruby objects (values) into the data store file
-# by name (keys). An object hierarchy may be just a single object. User code
-# may later read values back from the data store or even update data, as needed.
-#
-# The transactional behavior ensures that any changes succeed or fail together.
-# This can be used to ensure that the data store is not left in a transitory
-# state, where some values were upated but others were not.
-#
-# Behind the scenes, Ruby objects are stored to the data store file with
-# Marshal. That carries the usual limitations. Proc objects cannot be
-# marshalled, for example.
-#
-# == Usage example:
-#
-# require "pstore"
-#
-# # a mock wiki object...
-# class WikiPage
-# def initialize( page_name, author, contents )
-# @page_name = page_name
-# @revisions = Array.new
-#
-# add_revision(author, contents)
-# end
-#
-# attr_reader :page_name
-#
-# def add_revision( author, contents )
-# @revisions << { :created => Time.now,
-# :author => author,
-# :contents => contents }
-# end
-#
-# def wiki_page_references
-# [@page_name] + @revisions.last[:contents].scan(/\b(?:[A-Z]+[a-z]+){2,}/)
-# end
-#
-# # ...
-# end
-#
-# # create a new page...
-# home_page = WikiPage.new( "HomePage", "James Edward Gray II",
-# "A page about the JoysOfDocumentation..." )
-#
-# # then we want to update page data and the index together, or not at all...
-# wiki = PStore.new("wiki_pages.pstore")
-# wiki.transaction do # begin transaction; do all of this or none of it
-# # store page...
-# wiki[home_page.page_name] = home_page
-# # ensure that an index has been created...
-# wiki[:wiki_index] ||= Array.new
-# # update wiki index...
-# wiki[:wiki_index].push(*home_page.wiki_page_references)
-# end # commit changes to wiki data store file
-#
-# ### Some time later... ###
-#
-# # read wiki data...
-# wiki.transaction(true) do # begin read-only transaction, no changes allowed
-# wiki.roots.each do |data_root_name|
-# p data_root_name
-# p wiki[data_root_name]
-# end
-# end
-#
class PStore
- # The error type thrown by all PStore methods.
class Error < StandardError
end
- #
- # To construct a PStore object, pass in the _file_ path where you would like
- # the data to be stored.
- #
def initialize(file)
dir = File::dirname(file)
unless File::directory? dir
@@ -99,184 +32,62 @@ class PStore
@abort = false
end
- # Raises PStore::Error if the calling code is not in a PStore#transaction.
def in_transaction
raise PStore::Error, "not in transaction" unless @transaction
end
- #
- # Raises PStore::Error if the calling code is not in a PStore#transaction or
- # if the code is in a read-only PStore#transaction.
- #
def in_transaction_wr()
in_transaction()
raise PStore::Error, "in read-only transaction" if @rdonly
end
private :in_transaction, :in_transaction_wr
- #
- # Retrieves a value from the PStore file data, by _name_. The hierarchy of
- # Ruby objects stored under that root _name_ will be returned.
- #
- # *WARNING*: This method is only valid in a PStore#transaction. It will
- # raise PStore::Error if called at any other time.
- #
def [](name)
in_transaction
@table[name]
end
- #
- # This method is just like PStore#[], save that you may also provide a
- # _default_ value for the object. In the event the specified _name_ is not
- # found in the data store, your _default_ will be returned instead. If you do
- # not specify a default, PStore::Error will be raised if the object is not
- # found.
- #
- # *WARNING*: This method is only valid in a PStore#transaction. It will
- # raise PStore::Error if called at any other time.
- #
def fetch(name, default=PStore::Error)
- in_transaction
unless @table.key? name
if default==PStore::Error
raise PStore::Error, format("undefined root name `%s'", name)
else
- return default
+ default
end
end
- @table[name]
+ self[name]
end
- #
- # Stores an individual Ruby object or a hierarchy of Ruby objects in the data
- # store file under the root _name_. Assigning to a _name_ already in the data
- # store clobbers the old data.
- #
- # == Example:
- #
- # require "pstore"
- #
- # store = PStore.new("data_file.pstore")
- # store.transaction do # begin transaction
- # # load some data into the store...
- # store[:single_object] = "My data..."
- # store[:obj_heirarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"],
- # "James Gray" => ["erb.rb", "pstore.rb"] }
- # end # commit changes to data store file
- #
- # *WARNING*: This method is only valid in a PStore#transaction and it cannot
- # be read-only. It will raise PStore::Error if called at any other time.
- #
def []=(name, value)
in_transaction_wr()
@table[name] = value
end
- #
- # Removes an object hierarchy from the data store, by _name_.
- #
- # *WARNING*: This method is only valid in a PStore#transaction and it cannot
- # be read-only. It will raise PStore::Error if called at any other time.
- #
def delete(name)
in_transaction_wr()
@table.delete name
end
- #
- # Returns the names of all object hierarchies currently in the store.
- #
- # *WARNING*: This method is only valid in a PStore#transaction. It will
- # raise PStore::Error if called at any other time.
- #
def roots
in_transaction
@table.keys
end
- #
- # Returns true if the supplied _name_ is currently in the data store.
- #
- # *WARNING*: This method is only valid in a PStore#transaction. It will
- # raise PStore::Error if called at any other time.
- #
def root?(name)
in_transaction
@table.key? name
end
- # Returns the path to the data store file.
def path
@filename
end
- #
- # Ends the current PStore#transaction, committing any changes to the data
- # store immediately.
- #
- # == Example:
- #
- # require "pstore"
- #
- # store = PStore.new("data_file.pstore")
- # store.transaction do # begin transaction
- # # load some data into the store...
- # store[:one] = 1
- # store[:two] = 2
- #
- # store.commit # end transaction here, committing changes
- #
- # store[:three] = 3 # this change is never reached
- # end
- #
- # *WARNING*: This method is only valid in a PStore#transaction. It will
- # raise PStore::Error if called at any other time.
- #
def commit
in_transaction
@abort = false
throw :pstore_abort_transaction
end
- #
- # Ends the current PStore#transaction, discarding any changes to the data
- # store.
- #
- # == Example:
- #
- # require "pstore"
- #
- # store = PStore.new("data_file.pstore")
- # store.transaction do # begin transaction
- # store[:one] = 1 # this change is not applied, see below...
- # store[:two] = 2 # this change is not applied, see below...
- #
- # store.abort # end transaction here, discard all changes
- #
- # store[:three] = 3 # this change is never reached
- # end
- #
- # *WARNING*: This method is only valid in a PStore#transaction. It will
- # raise PStore::Error if called at any other time.
- #
def abort
in_transaction
@abort = true
throw :pstore_abort_transaction
end
- #
- # Opens a new transaction for the data store. Code executed inside a block
- # passed to this method may read and write data to and from the data store
- # file.
- #
- # At the end of the block, changes are committed to the data store
- # automatically. You may exit the transaction early with a call to either
- # PStore#commit or PStore#abort. See those methods for details about how
- # changes are handled. Raising an uncaught Exception in the block is
- # equivalent to calling PStore#abort.
- #
- # If _read_only_ is set to +true+, you will only be allowed to read from the
- # data store during the transaction and any attempts to change the data will
- # raise a PStore::Error.
- #
- # Note that PStore does not support nested transactions.
- #
- def transaction(read_only=false) # :yields: pstore
+ def transaction(read_only=false)
raise PStore::Error, "nested transaction" if @transaction
begin
@rdonly = read_only
@@ -344,23 +155,19 @@ class PStore
value
end
- # This method is just a wrapped around Marshal.dump.
- def dump(table) # :nodoc:
+ def dump(table)
Marshal::dump(table)
end
- # This method is just a wrapped around Marshal.load.
- def load(content) # :nodoc:
+ def load(content)
Marshal::load(content)
end
- # This method is just a wrapped around Marshal.load.
- def load_file(file) # :nodoc:
+ def load_file(file)
Marshal::load(file)
end
private
- # Commits changes to the data store file.
def commit_new(f)
f.truncate(0)
f.rewind
@@ -373,8 +180,6 @@ class PStore
end
end
-# :enddoc:
-
if __FILE__ == $0
db = PStore.new("/tmp/foo")
db.transaction do
diff --git a/lib/racc/parser.rb b/lib/racc/parser.rb
index a7408dd00a..7d160f6c44 100644
--- a/lib/racc/parser.rb
+++ b/lib/racc/parser.rb
@@ -1,7 +1,7 @@
#
-# $originalId: parser.rb,v 1.8 2006/07/06 11:42:07 aamine Exp $
+# parser.rb
#
-# Copyright (c) 1999-2006 Minero Aoki
+# Copyright (c) 1999-2003 Minero Aoki <aamine@loveruby.net>
#
# This program is free software.
# You can distribute/modify this program under the same terms of ruby.
@@ -10,6 +10,8 @@
# into a Racc output file, you may use that output file
# without restriction.
#
+# $raccId: parser.rb,v 1.4 2003/11/03 13:41:47 aamine Exp $
+#
unless defined?(NotImplementedError)
NotImplementedError = NotImplementError
@@ -22,6 +24,7 @@ unless defined?(::ParseError)
ParseError = Racc::ParseError
end
+
module Racc
unless defined?(Racc_No_Extentions)
@@ -30,14 +33,14 @@ module Racc
class Parser
- Racc_Runtime_Version = '1.4.5'
- Racc_Runtime_Revision = '$originalRevision: 1.8 $'.split[1]
+ Racc_Runtime_Version = '1.4.4'
+ Racc_Runtime_Revision = '$raccRevision: 1.4 $'.split[1]
- Racc_Runtime_Core_Version_R = '1.4.5'
- Racc_Runtime_Core_Revision_R = '$originalRevision: 1.8 $'.split[1]
+ Racc_Runtime_Core_Version_R = '1.4.4'
+ Racc_Runtime_Core_Revision_R = '$raccRevision: 1.4 $'.split[1]
begin
require 'racc/cparse'
- # Racc_Runtime_Core_Version_C = (defined in extention)
+ # Racc_Runtime_Core_Version_C = (defined in extension)
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
unless new.respond_to?(:_racc_do_parse_c, true)
raise LoadError, 'old cparse.so'
@@ -103,7 +106,7 @@ module Racc
raise NotImplementedError, "#{self.class}\#next_token is not defined"
end
- def _racc_do_parse_rb(arg, in_debug)
+ def _racc_do_parse_rb( arg, in_debug )
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
@@ -148,11 +151,11 @@ module Racc
### yyparse
###
- def yyparse(recv, mid)
+ def yyparse( recv, mid )
__send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
end
- def _racc_yyparse_rb(recv, mid, arg, c_debug)
+ def _racc_yyparse_rb( recv, mid, arg, c_debug )
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
@@ -171,6 +174,7 @@ module Racc
end
end
recv.__send__(mid) do |tok, val|
+# $stderr.puts "rd: tok=#{tok}, val=#{val}"
unless tok
@racc_t = 0
else
@@ -184,7 +188,12 @@ module Racc
act = action_table[i] and
action_check[i] == @racc_state[-1]
act = action_default[@racc_state[-1]]
+# $stderr.puts "02: act=#{act}"
+# $stderr.puts "curstate=#{@racc_state[-1]}"
+ else
+# $stderr.puts "01: act=#{act}"
end
+
while act = _racc_evalact(act, arg)
;
end
@@ -197,6 +206,9 @@ module Racc
act = action_table[i] and
action_check[i] == @racc_state[-1]
act = action_default[@racc_state[-1]]
+# $stderr.puts "04: act=#{act}"
+ else
+# $stderr.puts "03: act=#{act}"
end
while act = _racc_evalact(act, arg)
;
@@ -210,12 +222,13 @@ module Racc
### common
###
- def _racc_evalact(act, arg)
+ def _racc_evalact( act, arg )
+# $stderr.puts "ea: act=#{act}"
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
reduce_n, use_result, * = arg
- nerr = 0 # tmp
+nerr = 0 # tmp
if act > 0 and act < shift_n
#
@@ -248,7 +261,7 @@ module Racc
when 2 # yyaccept
return shift_n
else
- raise '[Racc Bug] unknown jump code'
+ raise RuntimeError, '[Racc Bug] unknown jump code'
end
end
@@ -286,6 +299,7 @@ module Racc
break
end
end
+
throw :racc_end_parse, nil if @racc_state.size <= 1
@racc_state.pop
@racc_vstack.pop
@@ -297,7 +311,7 @@ module Racc
return act
else
- raise "[Racc Bug] unknown action #{act.inspect}"
+ raise RuntimeError, "[Racc Bug] unknown action #{act.inspect}"
end
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
@@ -305,7 +319,7 @@ module Racc
nil
end
- def _racc_do_reduce(arg, act)
+ def _racc_do_reduce( arg, act )
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
@@ -346,7 +360,7 @@ module Racc
goto_default[k1]
end
- def on_error(t, val, vstack)
+ def on_error( t, val, vstack )
raise ParseError, sprintf("\nparse error on value %s (%s)",
val.inspect, token_to_str(t) || '?')
end
@@ -367,20 +381,20 @@ module Racc
# for debugging output
#
- def racc_read_token(t, tok, val)
+ def racc_read_token( t, tok, val )
@racc_debug_out.print 'read '
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
@racc_debug_out.puts val.inspect
@racc_debug_out.puts
end
- def racc_shift(tok, tstack, vstack)
+ def racc_shift( tok, tstack, vstack )
@racc_debug_out.puts "shift #{racc_token2str tok}"
racc_print_stacks tstack, vstack
@racc_debug_out.puts
end
- def racc_reduce(toks, sim, tstack, vstack)
+ def racc_reduce( toks, sim, tstack, vstack )
out = @racc_debug_out
out.print 'reduce '
if toks.empty?
@@ -399,20 +413,20 @@ module Racc
@racc_debug_out.puts
end
- def racc_e_pop(state, tstack, vstack)
+ def racc_e_pop( state, tstack, vstack )
@racc_debug_out.puts 'error recovering mode: pop token'
racc_print_states state
racc_print_stacks tstack, vstack
@racc_debug_out.puts
end
- def racc_next_state(curstate, state)
+ def racc_next_state( curstate, state )
@racc_debug_out.puts "goto #{curstate}"
racc_print_states state
@racc_debug_out.puts
end
- def racc_print_stacks(t, v)
+ def racc_print_stacks( t, v )
out = @racc_debug_out
out.print ' ['
t.each_index do |i|
@@ -421,19 +435,19 @@ module Racc
out.puts ' ]'
end
- def racc_print_states(s)
+ def racc_print_states( s )
out = @racc_debug_out
out.print ' ['
s.each {|st| out.print ' ', st }
out.puts ' ]'
end
- def racc_token2str(tok)
+ def racc_token2str( tok )
self.class::Racc_token_to_s_table[tok] or
- raise "[Racc Bug] can't convert token #{tok} to string"
+ raise RuntimeError, "[Racc Bug] can't convert token #{tok} to string"
end
- def token_to_str(t)
+ def token_to_str( t )
self.class::Racc_token_to_s_table[t]
end
diff --git a/lib/rational.rb b/lib/rational.rb
index ce754cfa3c..2019363ac6 100644
--- a/lib/rational.rb
+++ b/lib/rational.rb
@@ -1,33 +1,41 @@
#
-# rational.rb -
-# $Release Version: 0.5 $
-# $Revision: 1.7 $
-# $Date: 1999/08/24 12:49:28 $
-# by Keiju ISHITSUKA(SHL Japan Inc.)
+# rational.rb -
+# $Release Version: 0.5 $
+# $Revision: 1.7 $
+# $Date: 1999/08/24 12:49:28 $
+# by Keiju ISHITSUKA(SHL Japan Inc.)
#
-# Documentation by Kevin Jackson and Gavin Sinclair.
-#
-# When you <tt>require 'rational'</tt>, all interactions between numbers
-# potentially return a rational result. For example:
+# --
+# Usage:
+# class Rational < Numeric
+# (include Comparable)
#
-# 1.quo(2) # -> 0.5
-# require 'rational'
-# 1.quo(2) # -> Rational(1,2)
-#
-# See Rational for full documentation.
+# Rational(a, b) --> a/b
#
-
-
-#
-# Creates a Rational number (i.e. a fraction). +a+ and +b+ should be Integers:
-#
-# Rational(1,3) # -> 1/3
+# Rational::+
+# Rational::-
+# Rational::*
+# Rational::/
+# Rational::**
+# Rational::%
+# Rational::divmod
+# Rational::abs
+# Rational::<=>
+# Rational::to_i
+# Rational::to_f
+# Rational::to_s
#
-# Note: trying to construct a Rational with floating point or real values
-# produces errors:
+# Integer::gcd
+# Integer::lcm
+# Integer::gcdlcm
+# Integer::to_r
#
-# Rational(1.1, 2.3) # -> NoMethodError
+# Fixnum::**
+# Fixnum::quo
+# Bignum::**
+# Bignum::quo
#
+
def Rational(a, b = 1)
if a.kind_of?(Rational) && b == 1
a
@@ -35,39 +43,10 @@ def Rational(a, b = 1)
Rational.reduce(a, b)
end
end
-
-#
-# Rational implements a rational class for numbers.
-#
-# <em>A rational number is a number that can be expressed as a fraction p/q
-# where p and q are integers and q != 0. A rational number p/q is said to have
-# numerator p and denominator q. Numbers that are not rational are called
-# irrational numbers.</em> (http://mathworld.wolfram.com/RationalNumber.html)
-#
-# To create a Rational Number:
-# Rational(a,b) # -> a/b
-# Rational.new!(a,b) # -> a/b
-#
-# Examples:
-# Rational(5,6) # -> 5/6
-# Rational(5) # -> 5/1
-#
-# Rational numbers are reduced to their lowest terms:
-# Rational(6,10) # -> 3/5
-#
-# But not if you use the unusual method "new!":
-# Rational.new!(6,10) # -> 6/10
-#
-# Division by zero is obviously not allowed:
-# Rational(3,0) # -> ZeroDivisionError
-#
+
class Rational < Numeric
@RCS_ID='-$Id: rational.rb,v 1.7 1999/08/24 12:49:28 keiju Exp keiju $-'
- #
- # Reduces the given numerator and denominator to their lowest terms. Use
- # Rational() instead.
- #
def Rational.reduce(num, den = 1)
raise ZeroDivisionError, "denominator is zero" if den == 0
@@ -84,21 +63,13 @@ class Rational < Numeric
new!(num, den)
end
end
-
- #
- # Implements the constructor. This method does not reduce to lowest terms or
- # check for division by zero. Therefore #Rational() should be preferred in
- # normal use.
- #
+
def Rational.new!(num, den = 1)
new(num, den)
end
private_class_method :new
- #
- # This method is actually private.
- #
def initialize(num, den)
if den < 0
num = -num
@@ -112,15 +83,7 @@ class Rational < Numeric
@denominator = den.to_i
end
end
-
- #
- # Returns the addition of this value and +a+.
- #
- # Examples:
- # r = Rational(3,4) # -> Rational(3,4)
- # r + 1 # -> Rational(7,4)
- # r + 0.5 # -> 1.25
- #
+
def + (a)
if a.kind_of?(Rational)
num = @numerator * a.denominator
@@ -135,16 +98,7 @@ class Rational < Numeric
x + y
end
end
-
- #
- # Returns the difference of this value and +a+.
- # subtracted.
- #
- # Examples:
- # r = Rational(3,4) # -> Rational(3,4)
- # r - 1 # -> Rational(-1,4)
- # r - 0.5 # -> 0.25
- #
+
def - (a)
if a.kind_of?(Rational)
num = @numerator * a.denominator
@@ -159,17 +113,7 @@ class Rational < Numeric
x - y
end
end
-
- #
- # Returns the product of this value and +a+.
- #
- # Examples:
- # r = Rational(3,4) # -> Rational(3,4)
- # r * 2 # -> Rational(3,2)
- # r * 4 # -> Rational(3,1)
- # r * 0.5 # -> 0.375
- # r * Rational(1,2) # -> Rational(3,8)
- #
+
def * (a)
if a.kind_of?(Rational)
num = @numerator * a.numerator
@@ -184,14 +128,7 @@ class Rational < Numeric
x * y
end
end
-
- #
- # Returns the quotient of this value and +a+.
- # r = Rational(3,4) # -> Rational(3,4)
- # r / 2 # -> Rational(3,8)
- # r / 2.0 # -> 0.375
- # r / Rational(1,2) # -> Rational(3,2)
- #
+
def / (a)
if a.kind_of?(Rational)
num = @numerator * a.denominator
@@ -207,16 +144,7 @@ class Rational < Numeric
x / y
end
end
-
- #
- # Returns this value raised to the given power.
- #
- # Examples:
- # r = Rational(3,4) # -> Rational(3,4)
- # r ** 2 # -> Rational(9,16)
- # r ** 2.0 # -> 0.5625
- # r ** Rational(1,2) # -> 0.866025403784439
- #
+
def ** (other)
if other.kind_of?(Rational)
Float(self) ** other
@@ -239,37 +167,17 @@ class Rational < Numeric
x ** y
end
end
-
- #
- # Returns the remainder when this value is divided by +other+.
- #
- # Examples:
- # r = Rational(7,4) # -> Rational(7,4)
- # r % Rational(1,2) # -> Rational(1,4)
- # r % 1 # -> Rational(3,4)
- # r % Rational(1,7) # -> Rational(1,28)
- # r % 0.26 # -> 0.19
- #
+
def % (other)
value = (self / other).to_i
return self - other * value
end
-
- #
- # Returns the quotient _and_ remainder.
- #
- # Examples:
- # r = Rational(7,4) # -> Rational(7,4)
- # r.divmod Rational(1,2) # -> [3, Rational(1,4)]
- #
+
def divmod(other)
value = (self / other).to_i
return value, self - other * value
end
-
- #
- # Returns the absolute value.
- #
+
def abs
if @numerator > 0
Rational.new!(@numerator, @denominator)
@@ -278,15 +186,6 @@ class Rational < Numeric
end
end
- #
- # Returns +true+ iff this value is numerically equal to +other+.
- #
- # But beware:
- # Rational(1,2) == Rational(4,8) # -> true
- # Rational(1,2) == Rational.new!(4,8) # -> false
- #
- # Don't use Rational.new!
- #
def == (other)
if other.kind_of?(Rational)
@numerator == other.numerator and @denominator == other.denominator
@@ -299,9 +198,6 @@ class Rational < Numeric
end
end
- #
- # Standard comparison operator.
- #
def <=> (other)
if other.kind_of?(Rational)
num = @numerator * other.denominator
@@ -336,35 +232,14 @@ class Rational < Numeric
end
end
- #
- # Converts the rational to an Integer. Not the _nearest_ integer, the
- # truncated integer. Study the following example carefully:
- # Rational(+7,4).to_i # -> 1
- # Rational(-7,4).to_i # -> -2
- # (-1.75).to_i # -> -1
- #
- # In other words:
- # Rational(-7,4) == -1.75 # -> true
- # Rational(-7,4).to_i == (-1.75).to_i # false
- #
def to_i
Integer(@numerator.div(@denominator))
end
-
- #
- # Converts the rational to a Float.
- #
+
def to_f
@numerator.to_f/@denominator.to_f
end
-
- #
- # Returns a string representation of the rational number.
- #
- # Example:
- # Rational(3,4).to_s # "3/4"
- # Rational(8).to_s # "8"
- #
+
def to_s
if @denominator == 1
@numerator.to_s
@@ -372,123 +247,94 @@ class Rational < Numeric
@numerator.to_s+"/"+@denominator.to_s
end
end
-
- #
- # Returns +self+.
- #
+
def to_r
self
end
-
- #
- # Returns a reconstructable string representation:
- #
- # Rational(5,8).inspect # -> "Rational(5, 8)"
- #
+
def inspect
sprintf("Rational(%s, %s)", @numerator.inspect, @denominator.inspect)
end
-
- #
- # Returns a hash code for the object.
- #
+
def hash
@numerator.hash ^ @denominator.hash
end
-
+
attr :numerator
attr :denominator
-
+
private :initialize
end
class Integer
- #
- # In an integer, the value _is_ the numerator of its rational equivalent.
- # Therefore, this method returns +self+.
- #
def numerator
self
end
-
- #
- # In an integer, the denominator is 1. Therefore, this method returns 1.
- #
+
def denominator
1
end
-
- #
- # Returns a Rational representation of this integer.
- #
+
def to_r
Rational(self, 1)
end
+
+ def gcd(n)
+ m = self.abs
+ n = n.abs
- #
- # Returns the <em>greatest common denominator</em> of the two numbers (+self+
- # and +n+).
- #
- # Examples:
- # 72.gcd 168 # -> 24
- # 19.gcd 36 # -> 1
- #
- # The result is positive, no matter the sign of the arguments.
- #
- def gcd(other)
- min = self.abs
- max = other.abs
- while min > 0
- tmp = min
- min = max % min
- max = tmp
- end
- max
- end
+ return n if m == 0
+ return m if n == 0
- #
- # Returns the <em>lowest common multiple</em> (LCM) of the two arguments
- # (+self+ and +other+).
- #
- # Examples:
- # 6.lcm 7 # -> 42
- # 6.lcm 9 # -> 18
- #
- def lcm(other)
- if self.zero? or other.zero?
- 0
- else
- (self.div(self.gcd(other)) * other).abs
+ b = 0
+ while n[0] == 0 && m[0] == 0
+ b += 1; n >>= 1; m >>= 1
+ end
+ m >>= 1 while m[0] == 0
+ n >>= 1 while n[0] == 0
+ while m != n
+ m, n = n, m if n > m
+ m -= n; m >>= 1 while m[0] == 0
+ end
+ m << b
+ end
+
+ def gcd2(int)
+ a = self.abs
+ b = int.abs
+
+ a, b = b, a if a < b
+
+ while b != 0
+ void, a = a.divmod(b)
+ a, b = b, a
end
+ return a
end
- #
- # Returns the GCD _and_ the LCM (see #gcd and #lcm) of the two arguments
- # (+self+ and +other+). This is more efficient than calculating them
- # separately.
- #
- # Example:
- # 6.gcdlcm 9 # -> [3, 18]
- #
- def gcdlcm(other)
- gcd = self.gcd(other)
- if self.zero? or other.zero?
- [gcd, 0]
- else
- [gcd, (self.div(gcd) * other).abs]
- end
+ def lcm(int)
+ a = self.abs
+ b = int.abs
+ gcd = a.gcd(b)
+ (a.div(gcd)) * b
end
+
+ def gcdlcm(int)
+ a = self.abs
+ b = int.abs
+ gcd = a.gcd(b)
+ return gcd, (a.div(gcd)) * b
+ end
+
end
class Fixnum
undef quo
- # If Rational is defined, returns a Rational number instead of a Fixnum.
def quo(other)
Rational.new!(self,1) / other
end
alias rdiv quo
-
- # Returns a Rational number if the result is in fact rational (i.e. +other+ < 0).
+
def rpower (other)
if other >= 0
self.power!(other)
@@ -498,7 +344,7 @@ class Fixnum
end
unless defined? 1.power!
- alias power! **
+ alias power! **
alias ** rpower
end
end
@@ -509,13 +355,11 @@ class Bignum
end
undef quo
- # If Rational is defined, returns a Rational number instead of a Bignum.
def quo(other)
Rational.new!(self,1) / other
end
alias rdiv quo
-
- # Returns a Rational number if the result is in fact rational (i.e. +other+ < 0).
+
def rpower (other)
if other >= 0
self.power!(other)
@@ -523,7 +367,7 @@ class Bignum
Rational.new!(self, 1)**other
end
end
-
+
unless defined? Complex
alias ** rpower
end
diff --git a/lib/rdoc/README b/lib/rdoc/README
index 89ea0fbd3f..60650dd88b 100644
--- a/lib/rdoc/README
+++ b/lib/rdoc/README
@@ -82,6 +82,9 @@ RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. It
is free software, and may be redistributed under the terms specified
in the README file of the Ruby distribution.
+
+----
+
= Usage
RDoc is invoked from the command line using:
diff --git a/lib/rdoc/diagram.rb b/lib/rdoc/diagram.rb
index 9fdc49c02e..62e2f2e164 100644
--- a/lib/rdoc/diagram.rb
+++ b/lib/rdoc/diagram.rb
@@ -38,7 +38,6 @@ module RDoc
@options = options
@counter = 0
File.makedirs(DOT_PATH)
- @diagram_cache = {}
end
# Draw the diagrams. We traverse the files, drawing a diagram for
@@ -56,6 +55,7 @@ module RDoc
@local_names = find_names(i)
@global_names = []
@global_graph = graph = DOT::DOTDigraph.new('name' => 'TopLevel',
+ 'label' => i.file_absolute_name,
'fontname' => FONT,
'fontsize' => '8',
'bgcolor' => 'lightcyan1',
@@ -73,7 +73,7 @@ module RDoc
end
add_classes(i, graph, i.file_relative_name)
- i.diagram = convert_to_png("f_#{file_count}", graph)
+ i.diagram = convert_to_png("f_#{file_count}", graph, i.name)
# now go through and document each top level class and
# module independently
@@ -83,6 +83,7 @@ module RDoc
@global_names = []
@global_graph = graph = DOT::DOTDigraph.new('name' => 'TopLevel',
+ 'label' => i.full_name,
'fontname' => FONT,
'fontsize' => '8',
'bgcolor' => 'lightcyan1',
@@ -94,7 +95,8 @@ module RDoc
'fontsize' => 8)
draw_module(mod, graph, true)
mod.diagram = convert_to_png("m_#{file_count}_#{count}",
- graph)
+ graph,
+ "Module: #{mod.name}")
end
end
$stderr.puts unless @options.quiet
@@ -278,9 +280,7 @@ module RDoc
end
- def convert_to_png(file_base, graph)
- str = graph.to_s
- return @diagram_cache[str] if @diagram_cache[str]
+ def convert_to_png(file_base, graph, name)
op_type = Options.instance.image_format
dotfile = File.join(DOT_PATH, file_base)
src = dotfile + ".dot"
@@ -292,17 +292,15 @@ module RDoc
end
File.open(src, 'w+' ) do |f|
- f << str << "\n"
+ f << graph.to_s << "\n"
end
- system "dot", "-T#{op_type}", src, "-o", dot
+ system "dot -T#{op_type} #{src} -o #{dot}"
# Now construct the imagemap wrapper around
# that png
- ret = wrap_in_image_map(src, dot)
- @diagram_cache[str] = ret
- return ret
+ return wrap_in_image_map(src, dot, name)
end
# Extract the client-side image map from dot, and use it
@@ -310,7 +308,7 @@ module RDoc
# <map>..<img> combination, suitable for inclusion on
# the page
- def wrap_in_image_map(src, dot)
+ def wrap_in_image_map(src, dot, name)
res = %{<map id="map" name="map">\n}
dot_map = `dot -Tismap #{src}`
dot_map.each do |area|
@@ -322,13 +320,13 @@ module RDoc
xs, ys = [$1.to_i, $3.to_i], [$2.to_i, $4.to_i]
url, area_name = $5, $6
- res << %{ <area shape="rect" coords="#{xs.min},#{ys.min},#{xs.max},#{ys.max}" }
- res << %{ href="#{url}" alt="#{area_name}" />\n}
+ res << %{ <area shape="RECT" coords="#{xs.min},#{ys.min},#{xs.max},#{ys.max}" }
+ res << %{ href="#{url}" alt="#{area_name}">\n}
end
res << "</map>\n"
# map_file = src.sub(/.dot/, '.map')
# system("dot -Timap #{src} -o #{map_file}")
- res << %{<img src="#{dot}" usemap="#map" border="0" alt="#{dot}">}
+ res << %{<img src="#{dot}" usemap="#map" border=0 alt="#{name}">}
return res
end
end
diff --git a/lib/rdoc/generators/chm_generator.rb b/lib/rdoc/generators/chm_generator.rb
index 51eeda8dd1..1c46769cc2 100644
--- a/lib/rdoc/generators/chm_generator.rb
+++ b/lib/rdoc/generators/chm_generator.rb
@@ -4,7 +4,7 @@ module Generators
class CHMGenerator < HTMLGenerator
- HHC_PATH = "c:/Program Files/HTML Help Workshop/hhc.exe"
+ HHC_PATH = "c:\\Program Files\\HTML Help Workshop\\hhc.exe"
# Standard generator factory
def CHMGenerator.for(options)
@@ -103,7 +103,7 @@ module Generators
# Invoke the windows help compiler to compiler the project
def compile_project
- system(HHC_PATH, @project_name)
+ system("\"#{HHC_PATH}\" #@project_name")
end
end
diff --git a/lib/rdoc/generators/html_generator.rb b/lib/rdoc/generators/html_generator.rb
index 1f9b808e8d..f9c72a4df2 100644
--- a/lib/rdoc/generators/html_generator.rb
+++ b/lib/rdoc/generators/html_generator.rb
@@ -114,12 +114,7 @@ module Generators
lookup = name
end
- # Find class, module, or method in class or module.
- if /([A-Z]\w*)[.\#](\w+[!?=]?)/ =~ lookup
- container = $1
- method = $2
- ref = @context.find_symbol(container, method)
- elsif /([A-Za-z]\w*)[.\#](\w+(\([\.\w+\*\/\+\-\=\<\>]+\))?)/ =~ lookup
+ if /([A-Z].*)[.\#](.*)/ =~ lookup
container = $1
method = $2
ref = @context.find_symbol(container, method)
@@ -158,7 +153,7 @@ module Generators
if (type == "http" || type == "link") &&
url =~ /\.(gif|png|jpg|jpeg|bmp)$/
- "<img src=\"#{url}\" />"
+ "<img src=\"#{url}\">"
else
"<a href=\"#{url}\">#{text.sub(%r{^#{type}:/*}, '')}</a>"
end
@@ -211,14 +206,12 @@ module Generators
unless defined? @markup
@markup = SM::SimpleMarkup.new
- # class names, variable names, or instance variables
+ # class names, variable names, file names, or instance variables
@markup.add_special(/(
- \w+(::\w+)*[.\#]\w+(\([\.\w+\*\/\+\-\=\<\>]+\))? # A::B.meth(**) (for operator in Fortran95)
- | \#\w+(\([.\w\*\/\+\-\=\<\>]+\))? # meth(**) (for operator in Fortran95)
- | \b([A-Z]\w*(::\w+)*[.\#]\w+) # A::B.meth
+ \b([A-Z]\w*(::\w+)*[.\#]\w+) # A::B.meth
| \b([A-Z]\w+(::\w+)*) # A::B..
| \#\w+[!?=]? # #meth_name
- | \b\w+([_\/\.]+\w+)*[!?=]? # meth_name
+ | \b\w+([_\/\.]+\w+)+[!?=]? # meth_name
)/x,
:CROSSREF)
@@ -321,7 +314,7 @@ module Generators
def collect_methods
list = @context.method_list
unless @options.show_all
- list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
+ list = list.find_all {|m| m.visibility == :public || m.force_documentation }
end
@methods = list.collect {|m| HtmlMethod.new(m, self, @options) }
end
@@ -688,13 +681,13 @@ module Generators
res = []
atts.each do |att|
next unless att.section == section
- if att.visibility == :public || att.visibility == :protected || @options.show_all
+ if att.visibility == :public || @options.show_all
entry = {
"name" => CGI.escapeHTML(att.name),
"rw" => att.rw,
"a_desc" => markup(att.comment, true)
}
- unless att.visibility == :public || att.visibility == :protected
+ unless att.visibility == :public
entry["rw"] << "-"
end
res << entry
diff --git a/lib/rdoc/generators/ri_generator.rb b/lib/rdoc/generators/ri_generator.rb
index c4b4a7e17c..8d94579347 100644
--- a/lib/rdoc/generators/ri_generator.rb
+++ b/lib/rdoc/generators/ri_generator.rb
@@ -172,7 +172,7 @@ module Generators
list = cls.method_list
unless @options.show_all
list = list.find_all do |m|
- m.visibility == :public || m.visibility == :protected || m.force_documentation
+ m.visibility == :public || m.force_documentation
end
end
diff --git a/lib/rdoc/generators/template/html/hefss.rb b/lib/rdoc/generators/template/html/hefss.rb
index e68ca85823..ff4f557b71 100644
--- a/lib/rdoc/generators/template/html/hefss.rb
+++ b/lib/rdoc/generators/template/html/hefss.rb
@@ -114,7 +114,7 @@ BODY = %{
<html><head>
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
- <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
+ <link rel=StyleSheet href="%style_url%" type="text/css" media=screen>
<script type="text/javascript" language="JavaScript">
<!--
function popCode(url) {
@@ -138,9 +138,9 @@ IF:description
ENDIF:description
IF:requires
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Required files</td></tr>
-</table><br />
+</table><br>
<div class="name-list">
START:requires
HREF:aref:name:
@@ -149,9 +149,9 @@ ENDIF:requires
</div>
IF:methods
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Subroutines and Functions</td></tr>
-</table><br />
+</table><br>
<div class="name-list">
START:methods
HREF:aref:name:,
@@ -160,10 +160,10 @@ END:methods
ENDIF:methods
IF:attributes
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Arguments</td></tr>
-</table><br />
-<table cellspacing="5">
+</table><br>
+<table cellspacing=5>
START:attributes
<tr valign="top">
IF:rw
@@ -180,10 +180,10 @@ END:attributes
ENDIF:attributes
IF:classlist
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Modules</td></tr>
-</table><br />
-%classlist%<br />
+</table><br>
+%classlist%<br>
ENDIF:classlist
!INCLUDE! <!-- method descriptions -->
@@ -198,13 +198,13 @@ FILE_PAGE = <<_FILE_PAGE_
<table width="100%">
<tr class="title-row">
<td><table width="100%"><tr>
- <td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font>%short_name%</td>
- <td align="right"><table cellspacing="0" cellpadding="2">
+ <td class="big-title-font" colspan=2><font size=-3><B>File</B><BR></font>%short_name%</td>
+ <td align="right"><table cellspacing=0 cellpadding=2>
<tr>
<td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path%
IF:cvsurl
- &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+ &nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
</td>
</tr>
@@ -215,26 +215,26 @@ ENDIF:cvsurl
</table>
</td></tr></table></td>
</tr>
-</table><br />
+</table><br>
_FILE_PAGE_
###################################################################
CLASS_PAGE = %{
-<table width="100%" border="0" cellspacing="0">
+<table width="100%" border=0 cellspacing=0>
<tr class="title-row">
<td class="big-title-font">
- <font size="-3"><b>%classmod%</b><br /></font>%full_name%
+ <font size=-3><B>%classmod%</B><BR></font>%full_name%
</td>
<td align="right">
- <table cellspacing="0" cellpadding="2">
+ <table cellspacing=0 cellpadding=2>
<tr valign="top">
<td class="small-title-font">In:</td>
<td class="small-title-font">
START:infiles
HREF:full_path_url:full_path:
IF:cvsurl
-&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+&nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
END:infiles
</td>
@@ -256,14 +256,14 @@ ENDIF:parent
</table>
</td>
</tr>
-</table><br />
+</table><br>
}
###################################################################
METHOD_LIST = %{
IF:includes
-<div class="tablesubsubtitle">Uses</div><br />
+<div class="tablesubsubtitle">Uses</div><br>
<div class="name-list">
START:includes
<span class="method-name">HREF:aref:name:</span>
@@ -274,11 +274,11 @@ ENDIF:includes
IF:method_list
START:method_list
IF:methods
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">%type% %category% methods</td></tr>
</table>
START:methods
-<table width="100%" cellspacing="0" cellpadding="5" border="0">
+<table width="100%" cellspacing = 0 cellpadding=5 border=0>
<tr><td class="methodtitle">
<a name="%aref%">
<b>%name%</b>%params%
@@ -307,7 +307,7 @@ SRC_PAGE = %{
<html>
<head><title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
-<style type="text/css">
+<style>
.kw { color: #3333FF; font-weight: bold }
.cmt { color: green; font-style: italic }
.str { color: #662222; font-style: italic }
@@ -339,7 +339,7 @@ FILE_INDEX = %{
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
-<style type="text/css">
+<style>
<!--
body {
background-color: #bbbbbb;
@@ -368,7 +368,7 @@ div.banner {
<body>
<div class="banner">%list_title%</div>
START:entries
-<a href="%href%">%name%</a><br />
+<a href="%href%">%name%</a><br>
END:entries
</body></html>
}
diff --git a/lib/rdoc/generators/template/html/html.rb b/lib/rdoc/generators/template/html/html.rb
index 7f9e599465..6bbde46000 100644
--- a/lib/rdoc/generators/template/html/html.rb
+++ b/lib/rdoc/generators/template/html/html.rb
@@ -322,7 +322,7 @@ FILE_PAGE = %{
<td><strong>Path:</strong></td>
<td>%full_path%
IF:cvsurl
- &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+ &nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
</td>
</tr>
@@ -358,7 +358,7 @@ IF:full_path_url
</a>
ENDIF:full_path_url
IF:cvsurl
- &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+ &nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
<br />
END:infiles
@@ -504,7 +504,7 @@ IF:aliases
START:aliases
<tr class="top-aligned-row context-row">
<td class="context-item-name">%old_name%</td>
- <td>-&gt;</td>
+ <td>-></td>
<td class="context-item-value">%new_name%</td>
</tr>
IF:desc
diff --git a/lib/rdoc/generators/template/html/kilmer.rb b/lib/rdoc/generators/template/html/kilmer.rb
index 55071fc026..0d47587f67 100644
--- a/lib/rdoc/generators/template/html/kilmer.rb
+++ b/lib/rdoc/generators/template/html/kilmer.rb
@@ -94,7 +94,7 @@ BODY = %{
<html><head>
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
- <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
+ <link rel=StyleSheet href="%style_url%" type="text/css" media=screen>
<script type="text/javascript" language="JavaScript">
<!--
function popCode(url) {
@@ -118,9 +118,9 @@ IF:description
ENDIF:description
IF:requires
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Required files</td></tr>
-</table><br />
+</table><br>
<div class="name-list">
START:requires
HREF:aref:name:
@@ -129,9 +129,9 @@ ENDIF:requires
</div>
IF:methods
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Methods</td></tr>
-</table><br />
+</table><br>
<div class="name-list">
START:methods
HREF:aref:name:,
@@ -139,23 +139,11 @@ END:methods
</div>
ENDIF:methods
-
-START:sections
- <div id="section">
-IF:sectitle
- <h2 class="section-title"><a name="%secsequence%">%sectitle%</a></h2>
-IF:seccomment
- <div class="section-comment">
- %seccomment%
- </div>
-ENDIF:seccomment
-ENDIF:sectitle
-
IF:attributes
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Attributes</td></tr>
-</table><br />
-<table cellspacing="5">
+</table><br>
+<table cellspacing=5>
START:attributes
<tr valign="top">
IF:rw
@@ -172,16 +160,14 @@ END:attributes
ENDIF:attributes
IF:classlist
-<table cellpadding="5" width="100%">
+<table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">Classes and Modules</td></tr>
-</table><br />
-%classlist%<br />
+</table><br>
+%classlist%<br>
ENDIF:classlist
!INCLUDE! <!-- method descriptions -->
-END:sections
-
</body>
</html>
}
@@ -192,13 +178,13 @@ FILE_PAGE = <<_FILE_PAGE_
<table width="100%">
<tr class="title-row">
<td><table width="100%"><tr>
- <td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font>%short_name%</td>
- <td align="right"><table cellspacing="0" cellpadding="2">
+ <td class="big-title-font" colspan=2><font size=-3><B>File</B><BR></font>%short_name%</td>
+ <td align="right"><table cellspacing=0 cellpadding=2>
<tr>
<td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path%
IF:cvsurl
- &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+ &nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
</td>
</tr>
@@ -209,26 +195,26 @@ ENDIF:cvsurl
</table>
</td></tr></table></td>
</tr>
-</table><br />
+</table><br>
_FILE_PAGE_
###################################################################
CLASS_PAGE = %{
-<table width="100%" border="0" cellspacing="0">
+<table width="100%" border=0 cellspacing=0>
<tr class="title-row">
<td class="big-title-font">
- <font size="-3"><b>%classmod%</b><br /></font>%full_name%
+ <font size=-3><B>%classmod%</B><BR></font>%full_name%
</td>
<td align="right">
- <table cellspacing="0" cellpadding="2">
+ <table cellspacing=0 cellpadding=2>
<tr valign="top">
<td class="small-title-font">In:</td>
<td class="small-title-font">
START:infiles
HREF:full_path_url:full_path:
IF:cvsurl
-&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+&nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
END:infiles
</td>
@@ -250,14 +236,14 @@ ENDIF:parent
</table>
</td>
</tr>
-</table><br />
+</table><br>
}
###################################################################
METHOD_LIST = %{
IF:includes
-<div class="tablesubsubtitle">Included modules</div><br />
+<div class="tablesubsubtitle">Included modules</div><br>
<div class="name-list">
START:includes
<span class="method-name">HREF:aref:name:</span>
@@ -272,7 +258,7 @@ IF:methods
<tr><td class="tablesubtitle">%type% %category% methods</td></tr>
</table>
START:methods
-<table width="100%" cellspacing="0" cellpadding="5" border="0">
+<table width="100%" cellspacing = 0 cellpadding=5 border=0>
<tr><td class="methodtitle">
<a name="%aref%">
IF:callseq
@@ -319,7 +305,7 @@ SRC_PAGE = %{
<html>
<head><title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
-<style type="text/css">
+<style>
.ruby-comment { color: green; font-style: italic }
.ruby-constant { color: #4433aa; font-weight: bold; }
.ruby-identifier { color: #222222; }
@@ -380,7 +366,7 @@ div.banner {
<body>
<div class="banner">%list_title%</div>
START:entries
-<a href="%href%">%name%</a><br />
+<a href="%href%">%name%</a><br>
END:entries
</body></html>
}
diff --git a/lib/rdoc/generators/template/html/old_html.rb b/lib/rdoc/generators/template/html/old_html.rb
index ca66302a08..9e0073c37e 100644
--- a/lib/rdoc/generators/template/html/old_html.rb
+++ b/lib/rdoc/generators/template/html/old_html.rb
@@ -497,7 +497,7 @@ FILE_PAGE = <<_FILE_PAGE_
<td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path%
IF:cvsurl
- &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+ &nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
</td>
</tr>
@@ -533,7 +533,7 @@ IF:full_path_url
</a>
ENDIF:full_path_url
IF:cvsurl
- &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
+ &nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
<br />
END:infiles
@@ -570,7 +570,7 @@ SRC_PAGE = %{
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<title>%title%</title>
-<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
+<link rel=StyleSheet href="%style_url%" type="text/css" media="screen" />
</head>
<body bgcolor="white">
<pre>%code%</pre>
diff --git a/lib/rdoc/markup/.document b/lib/rdoc/markup/.document
deleted file mode 100644
index 3cf4f21bd7..0000000000
--- a/lib/rdoc/markup/.document
+++ /dev/null
@@ -1,2 +0,0 @@
-simple_markup
-simple_markup.rb
diff --git a/lib/rdoc/markup/simple_markup.rb b/lib/rdoc/markup/simple_markup.rb
index 8193ca02d4..21064cb009 100644
--- a/lib/rdoc/markup/simple_markup.rb
+++ b/lib/rdoc/markup/simple_markup.rb
@@ -194,7 +194,8 @@ module SM #:nodoc:
LABEL_LIST_RE = /^(
( \[.*?\] (?# labeled )
|\S.*:: (?# note )
- )(?:\s+|$)
+ )(?=\s|$)
+ \s*
)/x
diff --git a/lib/rdoc/markup/simple_markup/inline.rb b/lib/rdoc/markup/simple_markup/inline.rb
index d54fe1e667..1e76c201c9 100644
--- a/lib/rdoc/markup/simple_markup/inline.rb
+++ b/lib/rdoc/markup/simple_markup/inline.rb
@@ -183,7 +183,7 @@ module SM
unless SPECIAL.empty?
SPECIAL.each do |regexp, attr|
str.scan(regexp) do
- attrs.set_attrs($`.length, $&.length, attr | Attribute::SPECIAL)
+ attrs.set_attrs($`.length, $1.length, attr | Attribute::SPECIAL)
end
end
end
@@ -215,8 +215,6 @@ module SM
add_html("b", :BOLD)
add_html("tt", :TT)
add_html("code", :TT)
-
- add_special(/<!--(.*?)-->/, :COMMENT)
end
def add_word_pair(start, stop, name)
diff --git a/lib/rdoc/markup/simple_markup/preprocess.rb b/lib/rdoc/markup/simple_markup/preprocess.rb
index 101c9bdeb1..bbbae1b77c 100644
--- a/lib/rdoc/markup/simple_markup/preprocess.rb
+++ b/lib/rdoc/markup/simple_markup/preprocess.rb
@@ -43,12 +43,7 @@ module SM
def include_file(name, indent)
if (full_name = find_include_file(name))
content = File.open(full_name) {|f| f.read}
- # strip leading '#'s, but only if all lines start with them
- if content =~ /^[^#]/
- content.gsub(/^/, indent)
- else
- content.gsub(/^#?/, indent)
- end
+ res = content.gsub(/^#?/, indent)
else
$stderr.puts "Couldn't find file to include: '#{name}'"
''
diff --git a/lib/rdoc/markup/simple_markup/to_flow.rb b/lib/rdoc/markup/simple_markup/to_flow.rb
index 048e71abce..401703a72a 100644
--- a/lib/rdoc/markup/simple_markup/to_flow.rb
+++ b/lib/rdoc/markup/simple_markup/to_flow.rb
@@ -113,7 +113,7 @@ module SM
end
def accept_heading(am, fragment)
- @res << Flow::H.new(fragment.head_level, convert_flow(am.flow(fragment.txt)))
+ @res << Flow::H.new(fragment.head_level, am.flow(fragment.txt))
end
diff --git a/lib/rdoc/parsers/parse_c.rb b/lib/rdoc/parsers/parse_c.rb
index 19b5d443f6..6c9134fc62 100644
--- a/lib/rdoc/parsers/parse_c.rb
+++ b/lib/rdoc/parsers/parse_c.rb
@@ -174,13 +174,12 @@ module RDoc
# prepare to parse a C file
def initialize(top_level, file_name, body, options, stats)
@known_classes = KNOWN_CLASSES.dup
- @body = handle_tab_width(handle_ifdefs_in(body))
+ @body = handle_ifdefs_in(body)
@options = options
@stats = stats
@top_level = top_level
@classes = Hash.new
@file_dir = File.dirname(file_name)
- @progress = $stderr unless options.quiet
end
# Extract the classes/modules and methods from a C file
@@ -188,7 +187,6 @@ module RDoc
def scan
remove_commented_out_lines
do_classes
- do_constants
do_methods
do_includes
do_aliases
@@ -199,24 +197,6 @@ module RDoc
private
#######
- def progress(char)
- unless @options.quiet
- @progress.print(char)
- @progress.flush
- end
- end
-
- def warn(msg)
- $stderr.puts
- $stderr.puts msg
- $stderr.flush
- end
-
- def remove_private_comments(comment)
- comment.gsub!(/\/?\*--(.*?)\/?\*\+\+/m, '')
- comment.sub!(/\/?\*--.*/m, '')
- end
-
# remove lines that are commented out that might otherwise get
# picked up when scanning for classes and methods
@@ -225,28 +205,19 @@ module RDoc
end
def handle_class_module(var_name, class_mod, class_name, parent, in_module)
- progress(class_mod[0, 1])
-
parent_name = @known_classes[parent] || parent
if in_module
enclosure = @classes[in_module]
unless enclosure
- if enclosure = @known_classes[in_module]
- handle_class_module(in_module, (/^rb_m/ =~ in_module ? "module" : "class"),
- enclosure, nil, nil)
- enclosure = @classes[in_module]
- end
- end
- unless enclosure
- warn("Enclosing class/module '#{in_module}' for " +
- "#{class_mod} #{class_name} not known")
+ $stderr.puts("Enclosing class/module '#{in_module}' for " +
+ "#{class_mod} #{class_name} not known")
return
end
else
enclosure = @top_level
end
-
+
if class_mod == "class"
cm = enclosure.add_class(NormalClass, class_name, parent_name)
@stats.num_classes += 1
@@ -267,9 +238,9 @@ module RDoc
def find_class_comment(class_name, class_meth)
comment = nil
if @body =~ %r{((?>/\*.*?\*/\s+))
- (static\s+)?void\s+Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)}xmi
+ (static\s+)?void\s+Init_#{class_name}\s*\(\)}xmi
comment = $1
- elsif @body =~ %r{Document-(class|module):\s#{class_name}\s*?\n((?>.*?\*/))}m
+ elsif @body =~ %r{Document-(class|module):\s#{class_name}.*?\n((?>.*?\*/))}m
comment = $2
end
class_meth.comment = mangle_comment(comment) if comment
@@ -278,13 +249,13 @@ module RDoc
############################################################
def do_classes
- @body.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
+ @body.scan(/(\w+)\s* = \s*rb_define_module\(\s*"(\w+)"\s*\)/mx) do
|var_name, class_name|
handle_class_module(var_name, "module", class_name, nil, nil)
end
# The '.' lets us handle SWIG-generated files
- @body.scan(/([\w\.]+)\s* = \s*rb_define_class\s*
+ @body.scan(/([\w\.]+)\s* = \s*rb_define_class
\(
\s*"(\w+)",
\s*(\w+)\s*
@@ -294,7 +265,7 @@ module RDoc
handle_class_module(var_name, "class", class_name, parent, nil)
end
- @body.scan(/(\w+)\s*=\s*boot_defclass\s*\(\s*"(\w+?)",\s*(\w+?)\s*\)/) do
+ @body.scan(/(\w+)\s*=\s*boot_defclass\(\s*"(\w+?)",\s*(\w+?)\)/) do
|var_name, class_name, parent|
parent = nil if parent == "0"
handle_class_module(var_name, "class", class_name, parent, nil)
@@ -310,40 +281,18 @@ module RDoc
handle_class_module(var_name, "module", class_name, nil, in_module)
end
- @body.scan(/([\w\.]+)\s* = \s*rb_define_class_under\s*
+ @body.scan(/([\w\.]+)\s* = \s*rb_define_class_under
\(
\s*(\w+),
\s*"(\w+)",
\s*(\w+)\s*
- \s*\)/mx) do
+ \)/mx) do
|var_name, in_module, class_name, parent|
handle_class_module(var_name, "class", class_name, parent, in_module)
end
end
-
- ###########################################################
-
- def do_constants
- @body.scan(%r{\Wrb_define_
- (
- variable |
- readonly_variable |
- const |
- global_const |
- )
- \s*\(
- (?:\s*(\w+),)?
- \s*"(\w+)",
- \s*(.*?)\s*\)\s*;
- }xm) do
-
- |type, var_name, const_name, definition|
- var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
- handle_constants(type, var_name, const_name, definition)
- end
- end
############################################################
@@ -356,7 +305,7 @@ module RDoc
module_function |
private_method
)
- \s*\(\s*([\w\.]+),
+ \(\s*([\w\.]+),
\s*"([^"]+)",
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
\s*(-?\w+)\s*\)
@@ -376,21 +325,7 @@ module RDoc
meth_body, param_count, source_file)
end
- @body.scan(%r{rb_define_attr\(
- \s*([\w\.]+),
- \s*"([^"]+)",
- \s*(\d+),
- \s*(\d+)\s*\);
- }xm) do #"
- |var_name, attr_name, attr_reader, attr_writer|
-
- #var_name = "rb_cObject" if var_name == "rb_mKernel"
- handle_attr(var_name, attr_name,
- attr_reader.to_i != 0,
- attr_writer.to_i != 0)
- end
-
- @body.scan(%r{rb_define_global_function\s*\(
+ @body.scan(%r{rb_define_global_function\(
\s*"([^"]+)",
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
\s*(-?\w+)\s*\)
@@ -401,7 +336,7 @@ module RDoc
meth_body, param_count, source_file)
end
- @body.scan(/define_filetest_function\s*\(
+ @body.scan(/define_filetest_function\(
\s*"([^"]+)",
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
\s*(-?\w+)\s*\)/xm) do #"
@@ -415,7 +350,7 @@ module RDoc
############################################################
def do_aliases
- @body.scan(%r{rb_define_alias\s*\(\s*(\w+),\s*"([^"]+)",\s*"([^"]+)"\s*\)}m) do
+ @body.scan(%r{rb_define_alias\(\s*(\w+),\s*"([^"]+)",\s*"([^"]+)"\s*\)}m) do
|var_name, new_name, old_name|
@stats.num_methods += 1
class_name = @known_classes[var_name] || var_name
@@ -427,87 +362,8 @@ module RDoc
############################################################
- def handle_constants(type, var_name, const_name, definition)
- #@stats.num_constants += 1
- class_name = @known_classes[var_name]
-
- return unless class_name
-
- class_obj = find_class(var_name, class_name)
-
- unless class_obj
- warn("Enclosing class/module '#{const_name}' for not known")
- return
- end
-
- comment = find_const_comment(type, const_name)
-
- con = Constant.new(const_name, definition, mangle_comment(comment))
- class_obj.add_constant(con)
- end
-
- ###########################################################
-
- def find_const_comment(type, const_name)
- if @body =~ %r{((?>/\*.*?\*/\s+))
- rb_define_#{type}\((?:\s*(\w+),)?\s*"#{const_name}"\s*,.*?\)\s*;}xmi
- $1
- elsif @body =~ %r{Document-(?:const|global|variable):\s#{const_name}\s*?\n((?>.*?\*/))}m
- $1
- else
- ''
- end
- end
-
- ###########################################################
-
- def handle_attr(var_name, attr_name, reader, writer)
- rw = ''
- if reader
- #@stats.num_methods += 1
- rw << 'R'
- end
- if writer
- #@stats.num_methods += 1
- rw << 'W'
- end
-
- class_name = @known_classes[var_name]
-
- return unless class_name
-
- class_obj = find_class(var_name, class_name)
-
- if class_obj
- comment = find_attr_comment(attr_name)
- unless comment.empty?
- comment = mangle_comment(comment)
- end
- att = Attr.new('', attr_name, rw, comment)
- class_obj.add_attribute(att)
- end
-
- end
-
- ###########################################################
-
- def find_attr_comment(attr_name)
- if @body =~ %r{((?>/\*.*?\*/\s+))
- rb_define_attr\((?:\s*(\w+),)?\s*"#{attr_name}"\s*,.*?\)\s*;}xmi
- $1
- elsif @body =~ %r{Document-attr:\s#{attr_name}\s*?\n((?>.*?\*/))}m
- $1
- else
- ''
- end
- end
-
- ###########################################################
-
def handle_method(type, var_name, meth_name,
meth_body, param_count, source_file = nil)
- progress(".")
-
@stats.num_methods += 1
class_name = @known_classes[var_name]
@@ -521,8 +377,7 @@ module RDoc
type = "singleton_method"
end
meth_obj = AnyMethod.new("", meth_name)
- meth_obj.singleton =
- %w{singleton_method module_function}.include?(type)
+ meth_obj.singleton = type == "singleton_method"
p_count = (Integer(param_count) rescue -1)
@@ -537,28 +392,25 @@ module RDoc
end
if source_file
- file_name = File.join(@file_dir, source_file)
+ file_name = File.join(@file_dir, source_file)
body = (@@known_bodies[source_file] ||= File.read(file_name))
else
body = @body
end
- if find_body(meth_body, meth_obj, body) and meth_obj.document_self
- class_obj.add_method(meth_obj)
- end
+ find_body(meth_body, meth_obj, body)
+ class_obj.add_method(meth_obj)
end
end
############################################################
# Find the C code corresponding to a Ruby method
- def find_body(meth_name, meth_obj, body, quiet = false)
- case body
- when %r{((?>/\*.*?\*/\s*))(?:static\s+)?VALUE\s+#{meth_name}
- \s*(\(.*?\)).*?^}xm
- comment, params = $1, $2
- body_text = $&
+ def find_body(meth_name, meth_obj, body)
+ if body =~ %r{((?>/\*.*?\*/\s*))(static\s+)?VALUE\s+#{meth_name}
+ \s*(\(.*?\)).*?^}xm
- remove_private_comments(comment) if comment
+ comment, params = $1, $3
+ body_text = $&
# see if we can find the whole body
@@ -577,36 +429,25 @@ module RDoc
override_comment = find_override_comment(meth_obj.name)
comment = override_comment if override_comment
- find_modifiers(comment, meth_obj) if comment
+ find_call_seq(comment, meth_obj) if comment
# meth_obj.params = params
meth_obj.start_collecting_tokens
meth_obj.add_token(RubyToken::Token.new(1,1).set_text(body_text))
meth_obj.comment = mangle_comment(comment)
- when %r{((?>/\*.*?\*/\s*))^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
- comment = $1
- find_body($2, meth_obj, body, true)
- find_modifiers(comment, meth_obj)
- meth_obj.comment = mangle_comment(comment) + meth_obj.comment
- when %r{^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
- unless find_body($1, meth_obj, body, true)
- warn "No definition for #{meth_name}" unless quiet
- return false
- end
+
else
# No body, but might still have an override comment
comment = find_override_comment(meth_obj.name)
if comment
- find_modifiers(comment, meth_obj)
+ find_call_seq(comment, meth_obj)
meth_obj.comment = mangle_comment(comment)
else
- warn "No definition for #{meth_name}" unless quiet
- return false
+ $stderr.puts "No definition for #{meth_name}"
end
end
- true
end
@@ -617,13 +458,8 @@ module RDoc
# Array.new
# Array.new(10)
# use it for the parameters
- def find_modifiers(comment, meth_obj)
- if comment.sub!(/:nodoc:\s*^\s*\*?\s*$/m, '') or
- comment.sub!(/\A\/\*\s*:nodoc:\s*\*\/\Z/, '')
- meth_obj.document_self = false
- end
- if comment.sub!(/call-seq:(.*?)^\s*\*?\s*$/m, '') or
- comment.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '')
+ def find_call_seq(comment, meth_obj)
+ if comment.sub!(/call-seq:(.*?)^\s*\*?\s*$/m, '')
seq = $1
seq.gsub!(/^\s*\*\s*/, '')
meth_obj.call_seq = seq
@@ -633,10 +469,12 @@ module RDoc
############################################################
def find_override_comment(meth_name)
+ comment = nil
name = Regexp.escape(meth_name)
- if @body =~ %r{Document-method:\s#{name}\s*?\n((?>.*?\*/))}m
- $1
+ if @body =~ %r{Document-method:\s#{name}.*?\n((?>.*?\*/))}m
+ comment = $1
end
+ comment
end
############################################################
@@ -644,9 +482,9 @@ module RDoc
# Look for includes of the form
# rb_include_module(rb_cArray, rb_mEnumerable);
def do_includes
- @body.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
+ @body.scan(/rb_include_module\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
if cls = @classes[c]
- m = @known_classes[m] || m
+ m = KNOWN_CLASSES[m] || m
cls.add_include(Include.new(m, ""))
end
end
@@ -674,18 +512,6 @@ module RDoc
@classes[raw_name]
end
- def handle_tab_width(body)
- if /\t/ =~ body
- tab_width = Options.instance.tab_width
- body.split(/\n/).map do |line|
- 1 while line.gsub!(/\t+/) { ' ' * (tab_width*$&.length - $`.length % tab_width)} && $~ #`
- line
- end .join("\n")
- else
- body
- end
- end
-
# Remove #ifdefs that would otherwise confuse us
def handle_ifdefs_in(body)
diff --git a/lib/rdoc/parsers/parse_f95.rb b/lib/rdoc/parsers/parse_f95.rb
index f3f6d76103..518e421c60 100644
--- a/lib/rdoc/parsers/parse_f95.rb
+++ b/lib/rdoc/parsers/parse_f95.rb
@@ -1,160 +1,15 @@
-#= parse_f95.rb - Fortran95 Parser
-#
-#== Overview
-#
-#"parse_f95.rb" parses Fortran95 files with suffixes "f90", "F90", "f95"
-#and "F95". Fortran95 files are expected to be conformed to Fortran95
-#standards.
-#
-#== Rules
-#
-#Fundamental rules are same as that of the Ruby parser.
-#But comment markers are '!' not '#'.
-#
-#=== Correspondence between RDoc documentation and Fortran95 programs
-#
-#"parse_f95.rb" parses main programs, modules, subroutines, functions,
-#derived-types, public variables, public constants,
-#defined operators and defined assignments.
-#These components are described in items of RDoc documentation, as follows.
-#
-#Files :: Files (same as Ruby)
-#Classes :: Modules
-#Methods :: Subroutines, functions, variables, constants, derived-types, defined operators, defined assignments
-#Required files :: Files in which imported modules, external subroutines and external functions are defined.
-#Included Modules :: List of imported modules
-#Attributes :: List of derived-types, List of imported modules all of whose components are published again
-#
-#Components listed in 'Methods' (subroutines, functions, ...)
-#defined in modules are described in the item of 'Classes'.
-#On the other hand, components defined in main programs or
-#as external procedures are described in the item of 'Files'.
-#
-#=== Components parsed by default
-#
-#By default, documentation on public components (subroutines, functions,
-#variables, constants, derived-types, defined operators,
-#defined assignments) are generated.
-#With "--all" option, documentation on all components
-#are generated (almost same as the Ruby parser).
-#
-#=== Information parsed automatically
-#
-#The following information is automatically parsed.
-#
-#* Types of arguments
-#* Types of variables and constants
-#* Types of variables in the derived types, and initial values
-#* NAMELISTs and types of variables in them, and initial values
-#
-#Aliases by interface statement are described in the item of 'Methods'.
-#
-#Components which are imported from other modules and published again
-#are described in the item of 'Methods'.
-#
-#=== Format of comment blocks
-#
-#Comment blocks should be written as follows.
-#Comment blocks are considered to be ended when the line without '!'
-#appears.
-#The indentation is not necessary.
-#
-# ! (Top of file)
-# !
-# ! Comment blocks for the files.
-# !
-# !--
-# ! The comment described in the part enclosed by
-# ! "!--" and "!++" is ignored.
-# !++
-# !
-# module hogehoge
-# !
-# ! Comment blocks for the modules (or the programs).
-# !
-#
-# private
-#
-# logical :: a ! a private variable
-# real, public :: b ! a public variable
-# integer, parameter :: c = 0 ! a public constant
-#
-# public :: c
-# public :: MULTI_ARRAY
-# public :: hoge, foo
-#
-# type MULTI_ARRAY
-# !
-# ! Comment blocks for the derived-types.
-# !
-# real, pointer :: var(:) =>null() ! Comments block for the variables.
-# integer :: num = 0
-# end type MULTI_ARRAY
-#
-# contains
-#
-# subroutine hoge( in, & ! Comment blocks between continuation lines are ignored.
-# & out )
-# !
-# ! Comment blocks for the subroutines or functions
-# !
-# character(*),intent(in):: in ! Comment blocks for the arguments.
-# character(*),intent(out),allocatable,target :: in
-# ! Comment blocks can be
-# ! written under Fortran statements.
-#
-# character(32) :: file ! This comment parsed as a variable in below NAMELIST.
-# integer :: id
-#
-# namelist /varinfo_nml/ file, id
-# !
-# ! Comment blocks for the NAMELISTs.
-# ! Information about variables are described above.
-# !
-#
-# ....
-#
-# end subroutine hoge
-#
-# integer function foo( in )
-# !
-# ! This part is considered as comment block.
-#
-# ! Comment blocks under blank lines are ignored.
-# !
-# integer, intent(in):: inA ! This part is considered as comment block.
-#
-# ! This part is ignored.
-#
-# end function foo
-#
-# subroutine hide( in, &
-# & out ) !:nodoc:
-# !
-# ! If "!:nodoc:" is described at end-of-line in subroutine
-# ! statement as above, the subroutine is ignored.
-# ! This assignment can be used to modules, subroutines,
-# ! functions, variables, constants, derived-types,
-# ! defined operators, defined assignments,
-# ! list of imported modules ("use" statement).
-# !
-#
-# ....
-#
-# end subroutine hide
-#
-# end module hogehoge
-#
-
+# Parse a Fortran 95 file.
require "rdoc/code_objects"
module RDoc
+ # See rdoc/parsers/parse_f95.rb
+
class Token
NO_TEXT = "??".freeze
-
+
def initialize(line_no, char_no)
@line_no = line_no
@char_no = char_no
@@ -171,996 +26,84 @@ module RDoc
end
- # See rdoc/parsers/parse_f95.rb
-
class Fortran95parser
extend ParserFactory
- parse_files_matching(/\.((f|F)9(0|5)|F)$/)
-
- @@external_aliases = []
- @@public_methods = []
-
- # "false":: Comments are below source code
- # "true" :: Comments are upper source code
- COMMENTS_ARE_UPPER = false
-
- # Internal alias message
- INTERNAL_ALIAS_MES = "Alias for"
-
- # External alias message
- EXTERNAL_ALIAS_MES = "The entity is"
-
+ parse_files_matching(/\.(f9(0|5)|F)$/)
+
# prepare to parse a Fortran 95 file
def initialize(top_level, file_name, body, options, stats)
@body = body
@stats = stats
- @file_name = file_name
@options = options
@top_level = top_level
@progress = $stderr unless options.quiet
end
-
+
# devine code constructs
def scan
- # remove private comment
- remaining_code = remove_private_comments(@body)
-
- # continuation lines are united to one line
- remaining_code = united_to_one_line(remaining_code)
-
- # semicolons are replaced to line feed
- remaining_code = semicolon_to_linefeed(remaining_code)
-
- # collect comment for file entity
- whole_comment, remaining_code = collect_first_comment(remaining_code)
- @top_level.comment = whole_comment
-
- # String "remaining_code" is converted to Array "remaining_lines"
- remaining_lines = remaining_code.split("\n")
-
- # "module" or "program" parts are parsed (new)
- #
- level_depth = 0
- block_searching_flag = nil
- block_searching_lines = []
- pre_comment = []
- module_program_trailing = ""
- module_program_name = ""
- other_block_level_depth = 0
- other_block_searching_flag = nil
- remaining_lines.collect!{|line|
- if !block_searching_flag && !other_block_searching_flag
- if line =~ /^\s*?module\s+(\w+)\s*?(!.*?)?$/i
- block_searching_flag = :module
- block_searching_lines << line
- module_program_name = $1
- module_program_trailing = find_comments($2)
- next false
- elsif line =~ /^\s*?program\s+(\w+)\s*?(!.*?)?$/i ||
- line =~ /^\s*?\w/ && !block_start?(line)
- block_searching_flag = :program
- block_searching_lines << line
- module_program_name = $1 || ""
- module_program_trailing = find_comments($2)
- next false
-
- elsif block_start?(line)
- other_block_searching_flag = true
- next line
-
- elsif line =~ /^\s*?!\s?(.*)/
- pre_comment << line
- next line
- else
- pre_comment = []
- next line
- end
- elsif other_block_searching_flag
- other_block_level_depth += 1 if block_start?(line)
- other_block_level_depth -= 1 if block_end?(line)
- if other_block_level_depth < 0
- other_block_level_depth = 0
- other_block_searching_flag = nil
- end
- next line
- end
-
- block_searching_lines << line
- level_depth += 1 if block_start?(line)
- level_depth -= 1 if block_end?(line)
- if level_depth >= 0
- next false
- end
-
- # "module_program_code" is formatted.
- # ":nodoc:" flag is checked.
- #
- module_program_code = block_searching_lines.join("\n")
- module_program_code = remove_empty_head_lines(module_program_code)
- if module_program_trailing =~ /^:nodoc:/
- # next loop to search next block
- level_depth = 0
- block_searching_flag = false
- block_searching_lines = []
- pre_comment = []
- next false
- end
-
- # NormalClass is created, and added to @top_level
- #
- if block_searching_flag == :module
- module_name = module_program_name
- module_code = module_program_code
- module_trailing = module_program_trailing
- progress "m"
- @stats.num_modules += 1
- f9x_module = @top_level.add_module NormalClass, module_name
- f9x_module.record_location @top_level
-
- f9x_comment = COMMENTS_ARE_UPPER ?
- find_comments(pre_comment.join("\n")) + "\n" + module_trailing :
- module_trailing + "\n" + find_comments(module_code.sub(/^.*$\n/i, ''))
- f9x_module.comment = f9x_comment
- parse_program_or_module(f9x_module, module_code)
-
- TopLevel.all_files.each do |name, toplevel|
- if toplevel.include_includes?(module_name, @options.ignore_case)
- if !toplevel.include_requires?(@file_name, @options.ignore_case)
- toplevel.add_require(Require.new(@file_name, ""))
- end
- end
- toplevel.each_classmodule{|m|
- if m.include_includes?(module_name, @options.ignore_case)
- if !m.include_requires?(@file_name, @options.ignore_case)
- m.add_require(Require.new(@file_name, ""))
- end
- end
- }
- end
- elsif block_searching_flag == :program
- program_name = module_program_name
- program_code = module_program_code
- program_trailing = module_program_trailing
- progress "p"
- program_comment = COMMENTS_ARE_UPPER ?
- find_comments(pre_comment.join("\n")) + "\n" + program_trailing :
- program_trailing + "\n" + find_comments(program_code.sub(/^.*$\n/i, ''))
- program_comment = "\n\n= <i>Program</i> <tt>#{program_name}</tt>\n\n" \
- + program_comment
- @top_level.comment << program_comment