summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/getc_spec.rb
diff options
context:
space:
mode:
authorgit <svn-admin@ruby-lang.org>2020-08-17 09:29:04 +0900
committergit <svn-admin@ruby-lang.org>2020-08-17 09:29:04 +0900
commit86260ee98663f5cc600c149b8c589f1ae9b1f98a (patch)
tree343134c62c1ac07b2e9c69243c269f1fe0e4f25d /spec/ruby/core/io/getc_spec.rb
parent5849309c5a3754c3a9b0d1e42a34e82b94a5104b (diff)
* 2020-08-17 [ci skip]
Diffstat (limited to 'spec/ruby/core/io/getc_spec.rb')
0 files changed, 0 insertions, 0 deletions
d class='upd'>README26
-rw-r--r--README.EXT137
-rw-r--r--README.EXT.ja40
-rw-r--r--README.ja23
-rw-r--r--array.c1205
-rw-r--r--bcc32/Makefile.sub124
-rw-r--r--bcc32/README.bcc3212
-rwxr-xr-x[-rw-r--r--]bcc32/configure.bat92
-rwxr-xr-x[-rw-r--r--]bcc32/mkexports.rb2
-rw-r--r--bcc32/setup.mak86
-rw-r--r--bignum.c573
-rwxr-xr-xbin/erb6
-rw-r--r--class.c52
-rw-r--r--common.mk280
-rw-r--r--configure.in536
-rw-r--r--defines.h54
-rw-r--r--dir.c1346
-rw-r--r--distruby.rb59
-rwxr-xr-x[-rw-r--r--]djgpp/configure.bat0
-rw-r--r--dln.c120
-rw-r--r--doc/NEWS-1.8.0 (renamed from doc/NEWS)0
-rw-r--r--enum.c1248
-rw-r--r--enumerator.c450
-rw-r--r--env.h6
-rw-r--r--error.c47
-rw-r--r--eval.c2119
-rw-r--r--ext/.document5
-rw-r--r--ext/Setup1
-rw-r--r--ext/Setup.atheos1
-rw-r--r--ext/Setup.dj1
-rw-r--r--ext/Setup.emx1
-rw-r--r--ext/Setup.nt1
-rw-r--r--ext/Setup.x681
-rw-r--r--ext/Win32API/Win32API.c2
-rw-r--r--ext/Win32API/lib/win32/registry.rb2
-rw-r--r--ext/Win32API/lib/win32/resolv.rb6
-rw-r--r--ext/bigdecimal/bigdecimal.c735
-rw-r--r--ext/bigdecimal/bigdecimal.h12
-rw-r--r--ext/bigdecimal/bigdecimal_en.html9
-rw-r--r--ext/bigdecimal/bigdecimal_ja.html7
-rw-r--r--ext/bigdecimal/extconf.rb8
-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.rb32
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb31
-rw-r--r--ext/curses/curses.c3
-rw-r--r--ext/curses/extconf.rb2
-rw-r--r--ext/dbm/dbm.c2
-rw-r--r--ext/dbm/extconf.rb60
-rw-r--r--ext/digest/bubblebabble/.cvsignore (renamed from ext/enumerator/.cvsignore)1
-rw-r--r--ext/digest/bubblebabble/bubblebabble.c142
-rw-r--r--ext/digest/bubblebabble/depend3
-rw-r--r--ext/digest/bubblebabble/extconf.rb6
-rw-r--r--ext/digest/defs.h8
-rw-r--r--ext/digest/digest.c694
-rw-r--r--ext/digest/digest.h26
-rw-r--r--ext/digest/digest.txt113
-rw-r--r--ext/digest/digest.txt.ja111
-rw-r--r--ext/digest/extconf.rb4
-rw-r--r--ext/digest/lib/digest.rb50
-rw-r--r--ext/digest/lib/md5.rb17
-rw-r--r--ext/digest/lib/sha1.rb17
-rw-r--r--ext/digest/md5/extconf.rb5
-rw-r--r--ext/digest/md5/md5.c26
-rw-r--r--ext/digest/md5/md5.h9
-rw-r--r--ext/digest/md5/md5init.c23
-rw-r--r--ext/digest/md5/md5ossl.c23
-rw-r--r--ext/digest/md5/md5ossl.h5
-rw-r--r--ext/digest/rmd160/depend2
-rw-r--r--ext/digest/rmd160/extconf.rb7
-rw-r--r--ext/digest/rmd160/rmd160.c9
-rw-r--r--ext/digest/rmd160/rmd160.h16
-rw-r--r--ext/digest/rmd160/rmd160hl.c96
-rw-r--r--ext/digest/rmd160/rmd160init.c26
-rw-r--r--ext/digest/rmd160/rmd160ossl.c43
-rw-r--r--ext/digest/rmd160/rmd160ossl.h4
-rw-r--r--ext/digest/sha1/depend2
-rw-r--r--ext/digest/sha1/extconf.rb7
-rw-r--r--ext/digest/sha1/sha1.c22
-rw-r--r--ext/digest/sha1/sha1.h17
-rw-r--r--ext/digest/sha1/sha1hl.c102
-rw-r--r--ext/digest/sha1/sha1init.c30
-rw-r--r--ext/digest/sha1/sha1ossl.c43
-rw-r--r--ext/digest/sha1/sha1ossl.h7
-rw-r--r--ext/digest/sha2/depend2
-rw-r--r--ext/digest/sha2/extconf.rb6
-rw-r--r--ext/digest/sha2/lib/sha2.rb73
-rw-r--r--ext/digest/sha2/sha2.c26
-rw-r--r--ext/digest/sha2/sha2.h36
-rw-r--r--ext/digest/sha2/sha2hl.c252
-rw-r--r--ext/digest/sha2/sha2init.c23
-rw-r--r--ext/digest/test.sh5
-rw-r--r--ext/dl/dl.c26
-rw-r--r--ext/dl/handle.c4
-rw-r--r--ext/dl/lib/dl/import.rb4
-rw-r--r--ext/dl/lib/dl/win32.rb2
-rw-r--r--ext/dl/mkcallback.rb3
-rw-r--r--ext/dl/ptr.c145
-rw-r--r--ext/dl/sym.c3
-rw-r--r--ext/dl/test/test.rb13
-rw-r--r--ext/enumerator/enumerator.c195
-rw-r--r--ext/enumerator/enumerator.txt102
-rw-r--r--ext/enumerator/extconf.rb2
-rw-r--r--ext/etc/etc.c161
-rw-r--r--ext/etc/extconf.rb16
-rw-r--r--ext/extmk.rb227
-rw-r--r--ext/fcntl/fcntl.c75
-rw-r--r--ext/gdbm/gdbm.c414
-rw-r--r--ext/iconv/charset_alias.rb83
-rw-r--r--ext/iconv/extconf.rb14
-rw-r--r--ext/iconv/iconv.c80
-rw-r--r--ext/io/wait/extconf.rb2
-rw-r--r--ext/io/wait/lib/nonblock.rb2
-rw-r--r--ext/io/wait/wait.c4
-rw-r--r--ext/nkf/lib/kconv.rb329
-rw-r--r--ext/nkf/nkf-utf8/config.h36
-rw-r--r--ext/nkf/nkf-utf8/nkf.c3324
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c9337
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.h34
-rw-r--r--ext/nkf/nkf.c440
-rw-r--r--ext/nkf/test.rb864
-rw-r--r--ext/openssl/.cvsignore1
-rw-r--r--ext/openssl/extconf.rb12
-rw-r--r--ext/openssl/lib/net/ftptls.rb10
-rw-r--r--ext/openssl/lib/net/telnets.rb3
-rw-r--r--ext/openssl/lib/openssl.rb1
-rw-r--r--ext/openssl/lib/openssl/cipher.rb65
-rw-r--r--ext/openssl/lib/openssl/digest.rb42
-rw-r--r--ext/openssl/lib/openssl/pkcs7.rb25
-rw-r--r--ext/openssl/lib/openssl/ssl.rb95
-rw-r--r--ext/openssl/openssl_missing.c16
-rw-r--r--ext/openssl/openssl_missing.h60
-rw-r--r--ext/openssl/ossl.c40
-rw-r--r--ext/openssl/ossl.h44
-rw-r--r--ext/openssl/ossl_asn1.c66
-rw-r--r--ext/openssl/ossl_bio.c23
-rw-r--r--ext/openssl/ossl_bn.c167
-rw-r--r--ext/openssl/ossl_bn.h5
-rw-r--r--ext/openssl/ossl_cipher.c273
-rw-r--r--ext/openssl/ossl_cipher.h1
-rw-r--r--ext/openssl/ossl_config.c17
-rw-r--r--ext/openssl/ossl_digest.c199
-rw-r--r--ext/openssl/ossl_digest.h1
-rw-r--r--ext/openssl/ossl_engine.c10
-rw-r--r--ext/openssl/ossl_hmac.c72
-rw-r--r--ext/openssl/ossl_ns_spki.c15
-rw-r--r--ext/openssl/ossl_ocsp.c26
-rw-r--r--ext/openssl/ossl_pkcs12.c76
-rw-r--r--ext/openssl/ossl_pkcs12.h1
-rw-r--r--ext/openssl/ossl_pkcs5.c96
-rw-r--r--ext/openssl/ossl_pkcs5.h6
-rw-r--r--ext/openssl/ossl_pkcs7.c64
-rw-r--r--ext/openssl/ossl_pkcs7.h1
-rw-r--r--ext/openssl/ossl_pkey.c28
-rw-r--r--ext/openssl/ossl_pkey.h21
-rw-r--r--ext/openssl/ossl_pkey_dh.c106
-rw-r--r--ext/openssl/ossl_pkey_dsa.c97
-rw-r--r--ext/openssl/ossl_pkey_ec.c1582
-rw-r--r--ext/openssl/ossl_pkey_rsa.c124
-rw-r--r--ext/openssl/ossl_rand.c92
-rw-r--r--ext/openssl/ossl_ssl.c652
-rw-r--r--ext/openssl/ossl_ssl.h15
-rw-r--r--ext/openssl/ossl_ssl_session.c298
-rw-r--r--ext/openssl/ossl_x509attr.c36
-rw-r--r--ext/openssl/ossl_x509cert.c109
-rw-r--r--ext/openssl/ossl_x509crl.c16
-rw-r--r--ext/openssl/ossl_x509ext.c44
-rw-r--r--ext/openssl/ossl_x509name.c46
-rw-r--r--ext/openssl/ossl_x509req.c10
-rw-r--r--ext/openssl/ossl_x509revoked.c8
-rw-r--r--ext/openssl/ossl_x509store.c17
-rw-r--r--ext/openssl/ruby_missing.h27
-rw-r--r--ext/pty/expect_sample.rb15
-rw-r--r--ext/pty/lib/expect.rb2
-rw-r--r--ext/pty/pty.c138
-rw-r--r--ext/purelib.rb10
-rw-r--r--ext/racc/cparse/cparse.c216
-rw-r--r--ext/readline/extconf.rb5
-rw-r--r--ext/readline/readline.c36
-rw-r--r--ext/sdbm/_sdbm.c2
-rw-r--r--ext/socket/addrinfo.h5
-rw-r--r--ext/socket/extconf.rb111
-rw-r--r--ext/socket/getnameinfo.c5
-rw-r--r--ext/socket/socket.c1450
-rw-r--r--ext/stringio/stringio.c83
-rw-r--r--ext/strscan/strscan.c304
-rw-r--r--ext/syck/bytecode.c233
-rw-r--r--ext/syck/emitter.c71
-rw-r--r--ext/syck/handler.c1
-rw-r--r--ext/syck/implicit.c154
-rw-r--r--ext/syck/rubyext.c216
-rw-r--r--ext/syck/syck.c6
-rw-r--r--ext/syck/syck.h9
-rw-r--r--ext/syck/token.c322
-rw-r--r--ext/syck/yaml2byte.c16
-rw-r--r--ext/syslog/syslog.c3
-rw-r--r--ext/syslog/syslog.txt5
-rw-r--r--ext/tcltklib/depend2
-rw-r--r--ext/tcltklib/extconf.rb299
-rw-r--r--ext/thread/extconf.rb9
-rw-r--r--ext/thread/lib/thread.rb5
-rw-r--r--ext/thread/thread.c1182
-rw-r--r--ext/tk/ChangeLog.tkextlib161
-rw-r--r--ext/tk/MANUAL_tcltklib.eng (renamed from ext/tcltklib/MANUAL.eng)24
-rw-r--r--ext/tk/MANUAL_tcltklib.eucj (renamed from ext/tcltklib/MANUAL.euc)22
-rw-r--r--ext/tk/README.1st13
-rw-r--r--ext/tk/README.ActiveTcl (renamed from ext/tcltklib/README.ActiveTcl)0
-rw-r--r--ext/tk/README.macosx-aqua67
-rw-r--r--ext/tk/README.tcltklib (renamed from ext/tcltklib/README.1st)25
-rw-r--r--ext/tk/depend3
-rw-r--r--ext/tk/extconf.rb414
-rw-r--r--ext/tk/lib/multi-tk.rb795
-rw-r--r--ext/tk/lib/remote-tk.rb38
-rw-r--r--ext/tk/lib/tcltk.rb (renamed from ext/tcltklib/lib/tcltk.rb)2
-rw-r--r--ext/tk/lib/tk.rb1402
-rw-r--r--ext/tk/lib/tk/autoload.rb359
-rw-r--r--ext/tk/lib/tk/bindtag.rb83
-rw-r--r--ext/tk/lib/tk/button.rb5
-rw-r--r--ext/tk/lib/tk/canvas.rb84
-rw-r--r--ext/tk/lib/tk/canvastag.rb117
-rw-r--r--ext/tk/lib/tk/checkbutton.rb9
-rw-r--r--ext/tk/lib/tk/composite.rb165
-rw-r--r--ext/tk/lib/tk/encodedstr.rb84
-rw-r--r--ext/tk/lib/tk/entry.rb11
-rw-r--r--ext/tk/lib/tk/event.rb114
-rw-r--r--ext/tk/lib/tk/font.rb775
-rw-r--r--ext/tk/lib/tk/frame.rb10
-rw-r--r--ext/tk/lib/tk/grid.rb49
-rw-r--r--ext/tk/lib/tk/image.rb67
-rw-r--r--ext/tk/lib/tk/itemconfig.rb187
-rw-r--r--ext/tk/lib/tk/itemfont.rb33
-rw-r--r--ext/tk/lib/tk/label.rb5
-rw-r--r--ext/tk/lib/tk/labelframe.rb13
-rw-r--r--ext/tk/lib/tk/listbox.rb10
-rw-r--r--ext/tk/lib/tk/macpkg.rb9
-rw-r--r--ext/tk/lib/tk/menu.rb181
-rw-r--r--ext/tk/lib/tk/menubar.rb2
-rw-r--r--ext/tk/lib/tk/menuspec.rb26
-rw-r--r--ext/tk/lib/tk/message.rb5
-rw-r--r--ext/tk/lib/tk/msgcat.rb9
-rw-r--r--ext/tk/lib/tk/namespace.rb233
-rw-r--r--ext/tk/lib/tk/optiondb.rb16
-rw-r--r--ext/tk/lib/tk/pack.rb17
-rw-r--r--ext/tk/lib/tk/package.rb4
-rw-r--r--ext/tk/lib/tk/palette.rb2
-rw-r--r--ext/tk/lib/tk/panedwindow.rb34
-rw-r--r--ext/tk/lib/tk/radiobutton.rb19
-rw-r--r--ext/tk/lib/tk/root.rb37
-rw-r--r--ext/tk/lib/tk/scale.rb38
-rw-r--r--ext/tk/lib/tk/scrollable.rb11
-rw-r--r--ext/tk/lib/tk/scrollbar.rb65
-rw-r--r--ext/tk/lib/tk/scrollbox.rb7
-rw-r--r--ext/tk/lib/tk/spinbox.rb39
-rw-r--r--ext/tk/lib/tk/text.rb239
-rw-r--r--ext/tk/lib/tk/textimage.rb14
-rw-r--r--ext/tk/lib/tk/textmark.rb102
-rw-r--r--ext/tk/lib/tk/texttag.rb113
-rw-r--r--ext/tk/lib/tk/textwindow.rb13
-rw-r--r--ext/tk/lib/tk/timer.rb55
-rw-r--r--ext/tk/lib/tk/toplevel.rb28
-rw-r--r--ext/tk/lib/tk/ttk_selector.rb76
-rw-r--r--ext/tk/lib/tk/txtwin_abst.rb2
-rw-r--r--ext/tk/lib/tk/validation.rb25
-rw-r--r--ext/tk/lib/tk/variable.rb496
-rw-r--r--ext/tk/lib/tk/virtevent.rb82
-rw-r--r--ext/tk/lib/tk/winpkg.rb18
-rw-r--r--ext/tk/lib/tk/wm.rb476
-rw-r--r--ext/tk/lib/tkextlib/ICONS/icons.rb22
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS100
-rw-r--r--ext/tk/lib/tkextlib/blt.rb4
-rw-r--r--ext/tk/lib/tkextlib/blt/barchart.rb5
-rw-r--r--ext/tk/lib/tkextlib/blt/bitmap.rb21
-rw-r--r--ext/tk/lib/tkextlib/blt/busy.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/component.rb457
-rw-r--r--ext/tk/lib/tkextlib/blt/container.rb17
-rw-r--r--ext/tk/lib/tkextlib/blt/dragdrop.rb69
-rw-r--r--ext/tk/lib/tkextlib/blt/eps.rb17
-rw-r--r--ext/tk/lib/tkextlib/blt/graph.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/htext.rb6
-rw-r--r--ext/tk/lib/tkextlib/blt/stripchart.rb3
-rw-r--r--ext/tk/lib/tkextlib/blt/table.rb124
-rw-r--r--ext/tk/lib/tkextlib/blt/tabset.rb96
-rw-r--r--ext/tk/lib/tkextlib/blt/ted.rb9
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/button.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/checkbutton.rb4
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/frame.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/label.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/radiobutton.rb4
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/scrollbar.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/toplevel.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tree.rb341
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb248
-rw-r--r--ext/tk/lib/tkextlib/blt/unix_dnd.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/vector.rb37
-rw-r--r--ext/tk/lib/tkextlib/blt/watch.rb47
-rw-r--r--ext/tk/lib/tkextlib/bwidget/button.rb7
-rw-r--r--ext/tk/lib/tkextlib/bwidget/buttonbox.rb25
-rw-r--r--ext/tk/lib/tkextlib/bwidget/combobox.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dialog.rb43
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dynamichelp.rb12
-rw-r--r--ext/tk/lib/tkextlib/bwidget/entry.rb12
-rw-r--r--ext/tk/lib/tkextlib/bwidget/label.rb12
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelentry.rb12
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelframe.rb19
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb42
-rw-r--r--ext/tk/lib/tkextlib/bwidget/mainframe.rb62
-rw-r--r--ext/tk/lib/tkextlib/bwidget/messagedlg.rb27
-rw-r--r--ext/tk/lib/tkextlib/bwidget/notebook.rb29
-rw-r--r--ext/tk/lib/tkextlib/bwidget/pagesmanager.rb16
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panedwindow.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panelframe.rb57
-rw-r--r--ext/tk/lib/tkextlib/bwidget/passwddlg.rb11
-rw-r--r--ext/tk/lib/tkextlib/bwidget/progressdlg.rb4
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollableframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollview.rb5
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectcolor.rb28
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectfont.rb13
-rw-r--r--ext/tk/lib/tkextlib/bwidget/spinbox.rb17
-rw-r--r--ext/tk/lib/tkextlib/bwidget/statusbar.rb52
-rw-r--r--ext/tk/lib/tkextlib/bwidget/titleframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb48
-rw-r--r--ext/tk/lib/tkextlib/bwidget/widget.rb20
-rw-r--r--ext/tk/lib/tkextlib/itcl/incr_tcl.rb12
-rw-r--r--ext/tk/lib/tkextlib/itk/incr_tk.rb52
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb37
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb28
-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.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb24
-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.rb73
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledframe.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb10
-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.rb15
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb25
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/optionmenu.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/panedwindow.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/pushbutton.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/radiobox.rb21
-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.rb12
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb40
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectionbox.rb12
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb2
-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.rb19
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spintime.rb10
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb40
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabset.rb59
-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.rb20
-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.rb14
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb13
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb2
-rw-r--r--ext/tk/lib/tkextlib/tcllib/dialog.rb84
-rw-r--r--ext/tk/lib/tkextlib/tcllib/getstring.rb134
-rw-r--r--ext/tk/lib/tkextlib/tcllib/history.rb73
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ico.rb6
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb7
-rw-r--r--ext/tk/lib/tkextlib/tcllib/panelframe.rb72
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb227
-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.rb1
-rw-r--r--ext/tk/lib/tkextlib/tcllib/superframe.rb51
-rw-r--r--ext/tk/lib/tkextlib/tcllib/swaplist.rb150
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist.rb27
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_core.rb782
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb25
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb30
-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/tile.rb295
-rw-r--r--ext/tk/lib/tkextlib/tile/dialog.rb96
-rw-r--r--ext/tk/lib/tkextlib/tile/sizegrip.rb29
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb252
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/tcombobox.rb19
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb22
-rw-r--r--ext/tk/lib/tkextlib/tile/tframe.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabelframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb67
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb55
-rw-r--r--ext/tk/lib/tkextlib/tile/tprogressbar.rb27
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb1223
-rw-r--r--ext/tk/lib/tkextlib/tile/tscale.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tscrollbar.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tseparator.rb3
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb32
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb18
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb22
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb223
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb4
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb496
-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/version.rb6
-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.rb77
-rw-r--r--ext/tk/lib/tkextlib/vu/spinbox.rb2
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb58
-rw-r--r--ext/tk/old-README.tcltklib.eucj (renamed from ext/tcltklib/README.euc)0
-rw-r--r--ext/tk/sample/24hr_clock.rb286
-rw-r--r--ext/tk/sample/binstr_usage.rb12
-rw-r--r--ext/tk/sample/demos-en/anilabel.rb10
-rw-r--r--ext/tk/sample/demos-en/aniwave.rb9
-rw-r--r--ext/tk/sample/demos-en/arrow.rb26
-rw-r--r--ext/tk/sample/demos-en/bind.rb33
-rw-r--r--ext/tk/sample/demos-en/bitmap.rb10
-rw-r--r--ext/tk/sample/demos-en/button.rb2
-rw-r--r--ext/tk/sample/demos-en/check.rb14
-rw-r--r--ext/tk/sample/demos-en/check2.rb14
-rw-r--r--ext/tk/sample/demos-en/clrpick.rb22
-rw-r--r--ext/tk/sample/demos-en/colors.rb18
-rw-r--r--ext/tk/sample/demos-en/combo.rb96
-rw-r--r--ext/tk/sample/demos-en/cscroll.rb14
-rw-r--r--ext/tk/sample/demos-en/ctext.rb53
-rw-r--r--ext/tk/sample/demos-en/entry1.rb12
-rw-r--r--ext/tk/sample/demos-en/entry2.rb8
-rw-r--r--ext/tk/sample/demos-en/entry3.rb50
-rw-r--r--ext/tk/sample/demos-en/filebox.rb17
-rw-r--r--ext/tk/sample/demos-en/floor.rb14
-rw-r--r--ext/tk/sample/demos-en/floor2.rb14
-rw-r--r--ext/tk/sample/demos-en/form.rb8
-rw-r--r--ext/tk/sample/demos-en/goldberg.rb23
-rw-r--r--ext/tk/sample/demos-en/hello6
-rw-r--r--ext/tk/sample/demos-en/hscale.rb29
-rw-r--r--ext/tk/sample/demos-en/icon.rb20
-rw-r--r--ext/tk/sample/demos-en/image1.rb13
-rw-r--r--ext/tk/sample/demos-en/image2.rb22
-rw-r--r--ext/tk/sample/demos-en/image3.rb32
-rw-r--r--ext/tk/sample/demos-en/items.rb17
-rw-r--r--ext/tk/sample/demos-en/knightstour.rb271
-rw-r--r--ext/tk/sample/demos-en/label.rb13
-rw-r--r--ext/tk/sample/demos-en/labelframe.rb8
-rw-r--r--ext/tk/sample/demos-en/mclist.rb117
-rw-r--r--ext/tk/sample/demos-en/menu.rb24
-rw-r--r--ext/tk/sample/demos-en/menu84.rb8
-rw-r--r--ext/tk/sample/demos-en/menubu.rb10
-rw-r--r--ext/tk/sample/demos-en/msgbox.rb10
-rw-r--r--ext/tk/sample/demos-en/msgbox2.rb91
-rw-r--r--ext/tk/sample/demos-en/paned1.rb14
-rw-r--r--ext/tk/sample/demos-en/paned2.rb8
-rw-r--r--ext/tk/sample/demos-en/patch_1.1c193
-rw-r--r--ext/tk/sample/demos-en/pendulum.rb43
-rw-r--r--ext/tk/sample/demos-en/plot.rb8
-rw-r--r--ext/tk/sample/demos-en/puzzle.rb32
-rw-r--r--ext/tk/sample/demos-en/radio.rb12
-rw-r--r--ext/tk/sample/demos-en/radio2.rb17
-rw-r--r--ext/tk/sample/demos-en/radio3.rb19
-rw-r--r--ext/tk/sample/demos-en/rolodex-j323
-rw-r--r--ext/tk/sample/demos-en/ruler.rb8
-rw-r--r--ext/tk/sample/demos-en/sayings.rb8
-rw-r--r--ext/tk/sample/demos-en/search.rb19
-rw-r--r--ext/tk/sample/demos-en/spin.rb12
-rw-r--r--ext/tk/sample/demos-en/states.rb8
-rw-r--r--ext/tk/sample/demos-en/style.rb42
-rw-r--r--ext/tk/sample/demos-en/tcolor.bak513
-rw-r--r--ext/tk/sample/demos-en/text.rb8
-rw-r--r--ext/tk/sample/demos-en/textpeer.rb76
-rw-r--r--ext/tk/sample/demos-en/toolbar.rb130
-rw-r--r--ext/tk/sample/demos-en/tree.rb119
-rw-r--r--ext/tk/sample/demos-en/ttkbut.rb139
-rw-r--r--ext/tk/sample/demos-en/ttkmenu.rb85
-rw-r--r--ext/tk/sample/demos-en/ttknote.rb89
-rw-r--r--ext/tk/sample/demos-en/ttkpane.rb213
-rw-r--r--ext/tk/sample/demos-en/ttkprogress.rb66
-rw-r--r--ext/tk/sample/demos-en/twind.rb14
-rw-r--r--ext/tk/sample/demos-en/twind2.rb6
-rw-r--r--ext/tk/sample/demos-en/unicodeout.rb14
-rw-r--r--ext/tk/sample/demos-en/vscale.rb29
-rw-r--r--ext/tk/sample/demos-en/widget327
-rw-r--r--ext/tk/sample/demos-jp/anilabel.rb11
-rw-r--r--ext/tk/sample/demos-jp/aniwave.rb10
-rw-r--r--ext/tk/sample/demos-jp/arrow.rb27
-rw-r--r--ext/tk/sample/demos-jp/bind.rb34
-rw-r--r--ext/tk/sample/demos-jp/bitmap.rb11
-rw-r--r--ext/tk/sample/demos-jp/button.rb4
-rw-r--r--ext/tk/sample/demos-jp/check.rb15
-rw-r--r--ext/tk/sample/demos-jp/check2.rb15
-rw-r--r--ext/tk/sample/demos-jp/clrpick.rb21
-rw-r--r--ext/tk/sample/demos-jp/colors.rb19
-rw-r--r--ext/tk/sample/demos-jp/combo.rb98
-rw-r--r--ext/tk/sample/demos-jp/cscroll.rb15
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb54
-rw-r--r--ext/tk/sample/demos-jp/dialog1.rb1
-rw-r--r--ext/tk/sample/demos-jp/dialog2.rb1
-rw-r--r--ext/tk/sample/demos-jp/entry1.rb13
-rw-r--r--ext/tk/sample/demos-jp/entry2.rb9
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb49
-rw-r--r--ext/tk/sample/demos-jp/filebox.rb18
-rw-r--r--ext/tk/sample/demos-jp/floor.rb15
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb15
-rw-r--r--ext/tk/sample/demos-jp/form.rb9
-rw-r--r--ext/tk/sample/demos-jp/goldberg.rb24
-rw-r--r--ext/tk/sample/demos-jp/hello1
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb29
-rw-r--r--ext/tk/sample/demos-jp/icon.rb21
-rw-r--r--ext/tk/sample/demos-jp/image1.rb14
-rw-r--r--ext/tk/sample/demos-jp/image2.rb24
-rw-r--r--ext/tk/sample/demos-jp/image3.rb21
-rw-r--r--ext/tk/sample/demos-jp/items.rb18
-rw-r--r--ext/tk/sample/demos-jp/ixset21
-rw-r--r--ext/tk/sample/demos-jp/knightstour.rb273
-rw-r--r--ext/tk/sample/demos-jp/label.rb14
-rw-r--r--ext/tk/sample/demos-jp/labelframe.rb10
-rw-r--r--ext/tk/sample/demos-jp/mclist.rb121
-rw-r--r--ext/tk/sample/demos-jp/menu.rb27
-rw-r--r--ext/tk/sample/demos-jp/menu84.rb9
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb25
-rw-r--r--ext/tk/sample/demos-jp/menubu.rb11
-rw-r--r--ext/tk/sample/demos-jp/msgbox.rb15
-rw-r--r--ext/tk/sample/demos-jp/msgbox2.rb90
-rw-r--r--ext/tk/sample/demos-jp/paned1.rb16
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb10
-rw-r--r--ext/tk/sample/demos-jp/pendulum.rb44
-rw-r--r--ext/tk/sample/demos-jp/plot.rb15
-rw-r--r--ext/tk/sample/demos-jp/puzzle.rb33
-rw-r--r--ext/tk/sample/demos-jp/radio.rb13
-rw-r--r--ext/tk/sample/demos-jp/radio2.rb19
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb21
-rw-r--r--ext/tk/sample/demos-jp/rolodex-j1
-rw-r--r--ext/tk/sample/demos-jp/ruler.rb9
-rw-r--r--ext/tk/sample/demos-jp/sayings.rb9
-rw-r--r--ext/tk/sample/demos-jp/search.rb20
-rw-r--r--ext/tk/sample/demos-jp/spin.rb16
-rw-r--r--ext/tk/sample/demos-jp/states.rb9
-rw-r--r--ext/tk/sample/demos-jp/style.rb42
-rw-r--r--ext/tk/sample/demos-jp/tcolor1
-rw-r--r--ext/tk/sample/demos-jp/text.rb9
-rw-r--r--ext/tk/sample/demos-jp/textpeer.rb82
-rw-r--r--ext/tk/sample/demos-jp/toolbar.rb136
-rw-r--r--ext/tk/sample/demos-jp/tree.rb120
-rw-r--r--ext/tk/sample/demos-jp/ttkbut.rb145
-rw-r--r--ext/tk/sample/demos-jp/ttkmenu.rb91
-rw-r--r--ext/tk/sample/demos-jp/ttknote.rb97
-rw-r--r--ext/tk/sample/demos-jp/ttkpane.rb216
-rw-r--r--ext/tk/sample/demos-jp/ttkprogress.rb71
-rw-r--r--ext/tk/sample/demos-jp/twind.rb13
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb7
-rw-r--r--ext/tk/sample/demos-jp/unicodeout.rb16
-rw-r--r--ext/tk/sample/demos-jp/vscale.rb30
-rw-r--r--ext/tk/sample/demos-jp/widget371
-rw-r--r--ext/tk/sample/editable_listbox.rb69
-rw-r--r--ext/tk/sample/encstr_usage.rb5
-rw-r--r--ext/tk/sample/figmemo_sample.rb456
-rw-r--r--ext/tk/sample/images/teapot.ppm49
-rw-r--r--ext/tk/sample/irbtkw.rbw146
-rw-r--r--ext/tk/sample/scrollframe.rb237
-rw-r--r--ext/tk/sample/tcltklib/batsu.gif (renamed from ext/tcltklib/sample/batsu.gif)bin538 -> 538 bytes-rw-r--r--ext/tk/sample/tcltklib/lines0.tcl (renamed from ext/tcltklib/demo/lines0.tcl)0
-rw-r--r--ext/tk/sample/tcltklib/lines1.rb (renamed from ext/tcltklib/demo/lines1.rb)0
-rw-r--r--ext/tk/sample/tcltklib/lines2.rb (renamed from ext/tcltklib/demo/lines2.rb)0
-rw-r--r--ext/tk/sample/tcltklib/lines3.rb (renamed from ext/tcltklib/demo/lines3.rb)0
-rw-r--r--ext/tk/sample/tcltklib/lines4.rb (renamed from ext/tcltklib/demo/lines4.rb)0
-rw-r--r--ext/tk/sample/tcltklib/maru.gif (renamed from ext/tcltklib/sample/maru.gif)bin481 -> 481 bytes-rw-r--r--ext/tk/sample/tcltklib/safeTk.rb (renamed from ext/tcltklib/demo/safeTk.rb)0
-rw-r--r--ext/tk/sample/tcltklib/sample0.rb (renamed from ext/tcltklib/sample/sample0.rb)0
-rw-r--r--ext/tk/sample/tcltklib/sample1.rb (renamed from ext/tcltklib/sample/sample1.rb)0
-rw-r--r--ext/tk/sample/tcltklib/sample2.rb (renamed from ext/tcltklib/sample/sample2.rb)2
-rw-r--r--ext/tk/sample/tkballoonhelp.rb99
-rw-r--r--ext/tk/sample/tkextlib/tile/demo.rb76
-rw-r--r--ext/tk/sample/tkextlib/tile/readme.txt5
-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.gifbin0 -> 315 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gifbin0 -> 312 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowdown.gifbin0 -> 313 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gifbin0 -> 329 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gifbin0 -> 327 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowleft.gifbin0 -> 323 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gifbin0 -> 330 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gifbin0 -> 327 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowright.gifbin0 -> 324 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gifbin0 -> 309 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gifbin0 -> 313 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/arrowup.gifbin0 -> 314 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-h.gifbin0 -> 696 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.gifbin0 -> 770 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-n.xcfbin0 -> 1942 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/button-p.gifbin0 -> 769 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hc.gifbin0 -> 254 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-hu.gifbin0 -> 234 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nc.gifbin0 -> 249 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/check-nu.gifbin0 -> 229 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hc.gifbin0 -> 1098 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-hu.gifbin0 -> 626 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nc.gifbin0 -> 389 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/radio-nu.gifbin0 -> 401 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gifbin0 -> 343 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gifbin0 -> 316 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gifbin0 -> 333 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gifbin0 -> 308 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/slider-p.gifbin0 -> 182 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/slider.gifbin0 -> 182 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider-p.gifbin0 -> 183 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/blue/vslider.gifbin0 -> 283 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.gifbin0 -> 273 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gifbin0 -> 258 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gifbin0 -> 292 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gifbin0 -> 272 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gifbin0 -> 274 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gifbin0 -> 258 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gifbin0 -> 286 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gifbin0 -> 271 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-d.gifbin0 -> 1266 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-h.gifbin0 -> 896 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-n.gifbin0 -> 881 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-p.gifbin0 -> 625 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/button-s.gifbin0 -> 859 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-c.gifbin0 -> 434 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/check-u.gifbin0 -> 423 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gifbin0 -> 401 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gifbin0 -> 395 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gifbin0 -> 592 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gifbin0 -> 1116 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gifbin0 -> 61 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gifbin0 -> 1057 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gifbin0 -> 1095 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gifbin0 -> 695 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gifbin0 -> 686 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gifbin0 -> 383 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gifbin0 -> 878 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gifbin0 -> 907 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gifbin0 -> 238 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gifbin0 -> 927 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gifbin0 -> 405 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gifbin0 -> 399 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gifbin0 -> 587 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl15
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc.rb85
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc.tcl (renamed from ext/tk/sample/tkextlib/tile/themes/kroc.tcl)0
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/button-h.gif)bin522 -> 522 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/button-n.gif)bin554 -> 554 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/button-p.gif)bin548 -> 548 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/check-hc.gif)bin281 -> 281 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/check-hu.gif)bin273 -> 273 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/check-nc.gif)bin303 -> 303 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/check-nu.gif)bin294 -> 294 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/radio-hc.gif)bin652 -> 652 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/radio-hu.gif)bin644 -> 644 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/radio-nc.gif)bin632 -> 632 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif (renamed from ext/tk/sample/tkextlib/tile/themes/kroc/radio-nu.gif)bin621 -> 621 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl (renamed from ext/tk/sample/tkextlib/tile/themes/pkgIndex.tcl)0
-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.gifbin0 -> 362 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gifbin0 -> 250 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gifbin0 -> 378 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gifbin0 -> 267 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gifbin0 -> 379 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gifbin0 -> 266 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gifbin0 -> 363 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gifbin0 -> 251 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-h.gifbin0 -> 439 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-n.gifbin0 -> 443 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/button-p.gifbin0 -> 302 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gifbin0 -> 169 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gifbin0 -> 170 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gifbin0 -> 235 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gifbin0 -> 226 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gifbin0 -> 169 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gifbin0 -> 269 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gifbin0 -> 342 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gifbin0 -> 178 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gifbin0 -> 179 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gifbin0 -> 236 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gifbin0 -> 178 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gifbin0 -> 178 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gifbin0 -> 366 bytes-rw-r--r--ext/tk/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gifbin0 -> 336 bytes-rw-r--r--ext/tk/sample/tkextlib/treectrl/demo.rb12
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker2.rb12
-rw-r--r--ext/tk/sample/tkrttimer.rb13
-rw-r--r--ext/tk/sample/tksleep_sample.rb29
-rw-r--r--ext/tk/sample/tktextio.rb557
-rw-r--r--ext/tk/sample/ttk_wrapper.rb154
-rw-r--r--ext/tk/stubs.c (renamed from ext/tcltklib/stubs.c)81
-rw-r--r--ext/tk/stubs.h (renamed from ext/tcltklib/stubs.h)0
-rw-r--r--ext/tk/tcltklib.c (renamed from ext/tcltklib/tcltklib.c)3170
-rw-r--r--ext/tk/tkutil/.cvsignore (renamed from ext/tcltklib/.cvsignore)0
-rw-r--r--ext/tk/tkutil/depend1
-rw-r--r--ext/tk/tkutil/extconf.rb13
-rw-r--r--ext/tk/tkutil/tkutil.c (renamed from ext/tk/tkutil.c)738
-rw-r--r--ext/win32ole/.cvsignore1
-rw-r--r--ext/win32ole/extconf.rb14
-rw-r--r--ext/win32ole/tests/testNIL2VTEMPTY.rb28
-rw-r--r--ext/win32ole/tests/testOLEEVENT.rb91
-rw-r--r--ext/win32ole/tests/testWIN32OLE.rb4
-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_win32ole_event.rb133
-rw-r--r--ext/win32ole/tests/test_word.rb37
-rw-r--r--ext/win32ole/tests/testall.rb5
-rw-r--r--ext/win32ole/win32ole.c1300
-rw-r--r--ext/zlib/extconf.rb11
-rw-r--r--ext/zlib/zlib.c147
-rw-r--r--file.c818
-rw-r--r--gc.c466
-rw-r--r--hash.c621
-rw-r--r--ia64.s33
-rw-r--r--inits.c2
-rwxr-xr-x[-rw-r--r--]instruby.rb382
-rw-r--r--intern.h51
-rw-r--r--io.c737
-rw-r--r--keywords2
-rw-r--r--lex.c2
-rw-r--r--lib/.document80
-rw-r--r--lib/README6
-rw-r--r--lib/base64.rb4
-rw-r--r--lib/benchmark.rb9
-rw-r--r--lib/cgi.rb59
-rw-r--r--lib/cgi/session.rb62
-rw-r--r--lib/cgi/session/pstore.rb19
-rw-r--r--lib/complex.rb32
-rw-r--r--lib/date.rb989
-rw-r--r--lib/date/format.rb1590
-rw-r--r--lib/debug.rb10
-rw-r--r--lib/delegate.rb237
-rw-r--r--lib/drb/acl.rb2
-rw-r--r--lib/drb/drb.rb30
-rw-r--r--lib/drb/extservm.rb45
-rw-r--r--lib/drb/ssl.rb2
-rw-r--r--lib/drb/unix.rb2
-rw-r--r--lib/erb.rb312
-rw-r--r--lib/fileutils.rb160
-rw-r--r--lib/finalize.rb39
-rw-r--r--lib/find.rb4
-rw-r--r--lib/forwardable.rb174
-rw-r--r--lib/ftools.rb27
-rw-r--r--lib/generator.rb38
-rw-r--r--lib/getoptlong.rb187
-rw-r--r--lib/getopts.rb1
-rw-r--r--lib/gserver.rb42
-rw-r--r--lib/ipaddr.rb189
-rw-r--r--lib/irb.rb20
-rw-r--r--lib/irb/completion.rb27
-rw-r--r--lib/irb/extend-command.rb12
-rw-r--r--lib/irb/help.rb2
-rw-r--r--lib/irb/init.rb2
-rw-r--r--lib/irb/locale.rb6
-rw-r--r--lib/irb/notifier.rb2
-rw-r--r--lib/irb/ruby-lex.rb51
-rw-r--r--lib/irb/slex.rb2
-rw-r--r--lib/jcode.rb4
-rw-r--r--lib/logger.rb15
-rw-r--r--lib/mailread.rb14
-rw-r--r--lib/mathn.rb1
-rw-r--r--lib/matrix.rb18
-rw-r--r--lib/mkmf.rb774
-rw-r--r--lib/monitor.rb47
-rw-r--r--lib/mutex_m.rb34
-rw-r--r--lib/net/ftp.rb11
-rw-r--r--lib/net/http.rb78
-rw-r--r--lib/net/https.rb12
-rw-r--r--lib/net/imap.rb48
-rw-r--r--lib/net/pop.rb230
-rw-r--r--lib/net/protocol.rb4
-rw-r--r--lib/net/smtp.rb635
-rw-r--r--lib/net/telnet.rb22
-rw-r--r--lib/open-uri.rb121
-rw-r--r--lib/open3.rb51
-rw-r--r--lib/optparse.rb1338
-rw-r--r--lib/parsearg.rb2
-rw-r--r--lib/parsedate.rb44
-rw-r--r--lib/pathname.rb813
-rw-r--r--lib/ping.rb66
-rw-r--r--lib/pp.rb43
-rw-r--r--lib/prettyprint.rb244
-rw-r--r--lib/pstore.rb248
-rw-r--r--lib/racc/parser.rb66
-rw-r--r--lib/rational.rb416
-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.rb17
-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.rb48
-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/options.rb17
-rw-r--r--lib/rdoc/parsers/parse_c.rb286
-rw-r--r--lib/rdoc/parsers/parse_f95.rb1842
-rw-r--r--lib/rdoc/parsers/parse_rb.rb35
-rw-r--r--lib/rdoc/rdoc.rb56
-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.rb6
-rw-r--r--lib/rdoc/ri/ri_options.rb132
-rw-r--r--lib/rdoc/ri/ri_paths.rb64
-rw-r--r--lib/rdoc/usage.rb2
-rw-r--r--lib/readbytes.rb15
-rw-r--r--lib/resolv-replace.rb3
-rw-r--r--lib/resolv.rb1246
-rw-r--r--lib/rexml/attlistdecl.rb2
-rw-r--r--lib/rexml/attribute.rb38
-rw-r--r--lib/rexml/cdata.rb25
-rw-r--r--lib/rexml/comment.rb34
-rw-r--r--lib/rexml/doctype.rb426
-rw-r--r--lib/rexml/document.rb113
-rw-r--r--lib/rexml/dtd/dtd.rb2
-rw-r--r--lib/rexml/element.rb2271
-rw-r--r--lib/rexml/encoding.rb123
-rw-r--r--lib/rexml/encodings/CP-1252.rb123
-rw-r--r--lib/rexml/encodings/EUC-JP.rb29
-rw-r--r--lib/rexml/encodings/ISO-8859-15.rb59
-rw-r--r--lib/rexml/encodings/SHIFT-JIS.rb29
-rw-r--r--lib/rexml/encodings/SHIFT_JIS.rb2
-rw-r--r--lib/rexml/encodings/UNILE.rb2
-rw-r--r--lib/rexml/encodings/UTF-16.rb3
-rw-r--r--lib/rexml/entity.rb6
-rw-r--r--lib/rexml/formatters/default.rb109
-rw-r--r--lib/rexml/formatters/pretty.rb137
-rw-r--r--lib/rexml/formatters/transitive.rb56
-rw-r--r--lib/rexml/functions.rb45
-rw-r--r--lib/rexml/instruction.rb4
-rw-r--r--lib/rexml/node.rb25
-rw-r--r--lib/rexml/parent.rb319
-rw-r--r--lib/rexml/parsers/baseparser.rb132
-rw-r--r--lib/rexml/parsers/pullparser.rb1
-rw-r--r--lib/rexml/parsers/sax2parser.rb10
-rw-r--r--lib/rexml/parsers/streamparser.rb74
-rw-r--r--lib/rexml/parsers/treeparser.rb17
-rw-r--r--lib/rexml/parsers/xpathparser.rb10
-rw-r--r--lib/rexml/rexml.rb16
-rw-r--r--lib/rexml/sax2listener.rb3
-rw-r--r--lib/rexml/source.rb393
-rw-r--r--lib/rexml/streamlistener.rb3
-rw-r--r--lib/rexml/text.rb78
-rw-r--r--lib/rexml/undefinednamespaceexception.rb8
-rw-r--r--lib/rexml/xmldecl.rb16
-rw-r--r--lib/rexml/xpath.rb16
-rw-r--r--lib/rexml/xpath_parser.rb114
-rw-r--r--lib/rinda/rinda.rb179
-rw-r--r--lib/rinda/ring.rb113
-rw-r--r--lib/rinda/tuplespace.rb354
-rw-r--r--lib/rss.rb7
-rw-r--r--lib/rss/0.9.rb549
-rw-r--r--lib/rss/1.0.rb508
-rw-r--r--lib/rss/2.0.rb116
-rw-r--r--lib/rss/atom.rb749
-rw-r--r--lib/rss/content.rb42
-rw-r--r--lib/rss/content/1.0.rb10
-rw-r--r--lib/rss/content/2.0.rb12
-rw-r--r--lib/rss/converter.rb19
-rw-r--r--lib/rss/dublincore.rb65
-rw-r--r--lib/rss/dublincore/1.0.rb13
-rw-r--r--lib/rss/dublincore/2.0.rb13
-rw-r--r--lib/rss/dublincore/atom.rb17
-rw-r--r--lib/rss/image.rb173
-rw-r--r--lib/rss/itunes.rb410
-rw-r--r--lib/rss/maker.rb26
-rw-r--r--lib/rss/maker/0.9.rb375
-rw-r--r--lib/rss/maker/1.0.rb332
-rw-r--r--lib/rss/maker/2.0.rb147
-rw-r--r--lib/rss/maker/atom.rb172
-rw-r--r--lib/rss/maker/base.rb828
-rw-r--r--lib/rss/maker/content.rb14
-rw-r--r--lib/rss/maker/dublincore.rb141
-rw-r--r--lib/rss/maker/entry.rb163
-rw-r--r--lib/rss/maker/feed.rb429
-rw-r--r--lib/rss/maker/image.rb116
-rw-r--r--lib/rss/maker/itunes.rb242
-rw-r--r--lib/rss/maker/slash.rb33
-rw-r--r--lib/rss/maker/syndication.rb13
-rw-r--r--lib/rss/maker/taxonomy.rb118
-rw-r--r--lib/rss/maker/trackback.rb111
-rw-r--r--lib/rss/parser.rb266
-rw-r--r--lib/rss/rexmlparser.rb17
-rw-r--r--lib/rss/rss.rb1003
-rw-r--r--lib/rss/slash.rb49
-rw-r--r--lib/rss/syndication.rb51
-rw-r--r--lib/rss/taxonomy.rb143
-rw-r--r--lib/rss/trackback.rb138
-rw-r--r--lib/rss/utils.rb90
-rw-r--r--lib/rss/xml-stylesheet.rb12
-rw-r--r--lib/rss/xml.rb71
-rw-r--r--lib/rss/xmlparser.rb10
-rw-r--r--lib/rss/xmlscanner.rb35
-rw-r--r--lib/securerandom.rb137
-rw-r--r--lib/set.rb63
-rw-r--r--lib/shell/process-controller.rb8
-rw-r--r--lib/shellwords.rb146
-rw-r--r--lib/singleton.rb61
-rw-r--r--lib/tempfile.rb26
-rw-r--r--lib/test/unit.rb15
-rw-r--r--lib/test/unit/assertionfailederror.rb2
-rw-r--r--lib/test/unit/assertions.rb236
-rw-r--r--lib/test/unit/autorunner.rb26
-rw-r--r--lib/test/unit/collector/dir.rb25
-rw-r--r--lib/test/unit/error.rb2
-rw-r--r--lib/test/unit/failure.rb2
-rw-r--r--lib/test/unit/testcase.rb16
-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.rb13
-rw-r--r--lib/time.rb28
-rw-r--r--lib/timeout.rb70
-rw-r--r--lib/tmpdir.rb107
-rw-r--r--lib/tracer.rb23
-rw-r--r--lib/tsort.rb151
-rw-r--r--lib/uri.rb1
-rw-r--r--lib/uri/common.rb10
-rw-r--r--lib/uri/ftp.rb86
-rw-r--r--lib/uri/generic.rb122
-rw-r--r--lib/uri/http.rb49
-rw-r--r--lib/uri/https.rb4
-rw-r--r--lib/uri/ldaps.rb12
-rw-r--r--lib/uri/mailto.rb45
-rw-r--r--lib/weakref.rb49
-rw-r--r--lib/webrick/cgi.rb1
-rw-r--r--lib/webrick/config.rb2
-rw-r--r--lib/webrick/cookie.rb30
-rw-r--r--lib/webrick/httpproxy.rb2
-rw-r--r--lib/webrick/httprequest.rb7
-rw-r--r--lib/webrick/httpresponse.rb2
-rw-r--r--lib/webrick/httpserver.rb2
-rw-r--r--lib/webrick/httpservlet/abstract.rb2
-rw-r--r--lib/webrick/httpservlet/cgi_runner.rb4
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb10
-rw-r--r--lib/webrick/httpservlet/filehandler.rb73
-rw-r--r--lib/webrick/httputils.rb16
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb4
-rw-r--r--lib/xmlrpc/client.rb21
-rw-r--r--lib/xmlrpc/create.rb7
-rw-r--r--lib/xmlrpc/parser.rb4
-rw-r--r--lib/xmlrpc/server.rb16
-rw-r--r--lib/xmlrpc/utils.rb2
-rw-r--r--lib/yaml.rb9
-rw-r--r--lib/yaml/baseemitter.rb2
-rw-r--r--lib/yaml/basenode.rb18
-rw-r--r--lib/yaml/encoding.rb6
-rw-r--r--lib/yaml/rubytypes.rb48
-rw-r--r--lib/yaml/store.rb20
-rw-r--r--lib/yaml/tag.rb13
-rw-r--r--lib/yaml/types.rb83
-rw-r--r--main.c9
-rw-r--r--marshal.c77
-rw-r--r--math.c55
-rw-r--r--misc/README13
-rw-r--r--misc/inf-ruby.el10
-rw-r--r--misc/ruby-mode.el82
-rw-r--r--misc/ruby-style.el66
-rw-r--r--missing.h6
-rw-r--r--missing/crypt.c34
-rw-r--r--missing/flock.c5
-rw-r--r--missing/isinf.c8
-rw-r--r--missing/strftime.c58
-rw-r--r--missing/vsnprintf.c2
-rwxr-xr-x[-rw-r--r--]mkconfig.rb115
-rw-r--r--node.h125
-rw-r--r--numeric.c642
-rw-r--r--object.c304
-rw-r--r--pack.c96
-rw-r--r--parse.y609
-rw-r--r--prec.c4
-rw-r--r--process.c394
-rw-r--r--random.c27
-rw-r--r--range.c101
-rw-r--r--re.c211
-rw-r--r--regex.c137
-rw-r--r--regex.h4
-rw-r--r--ruby.15
-rw-r--r--ruby.c320
-rw-r--r--ruby.h112
-rw-r--r--rubyio.h24
-rw-r--r--rubysig.h21
-rwxr-xr-x[-rw-r--r--]rubytest.rb0
-rwxr-xr-xrunruby.rb22
-rw-r--r--sample/README3
-rw-r--r--sample/cal.rb84
-rw-r--r--sample/cbreak.rb4
-rw-r--r--sample/dualstack-httpd.rb2
-rw-r--r--sample/erb/erb4html.rb60
-rw-r--r--sample/eval.rb2
-rw-r--r--sample/from.rb2
-rw-r--r--sample/goodfriday.rb48
-rw-r--r--sample/openssl/c_rehash.rb4
-rw-r--r--sample/openssl/cipher.rb12
-rw-r--r--sample/philos.rb2
-rw-r--r--sample/regx.rb2
-rwxr-xr-xsample/rss/blend.rb8
-rwxr-xr-xsample/rss/convert.rb69
-rwxr-xr-x[-rw-r--r--]sample/rss/list_description.rb13
-rwxr-xr-xsample/rss/re_read.rb10
-rwxr-xr-x[-rw-r--r--]sample/rss/rss_recent.rb20
-rw-r--r--sample/test.rb69
-rw-r--r--sample/time.rb16
-rw-r--r--signal.c296
-rw-r--r--sprintf.c140
-rw-r--r--st.c27
-rw-r--r--st.h7
-rw-r--r--string.c516
-rw-r--r--struct.c43
-rw-r--r--test/dbm/test_dbm.rb12
-rw-r--r--test/digest/test_digest.rb28
-rw-r--r--test/drb/drbtest.rb6
-rw-r--r--test/erb/hello.erb4
-rw-r--r--test/erb/test_erb.rb386
-rw-r--r--test/fileutils/test_dryrun.rb25
-rw-r--r--test/fileutils/test_fileutils.rb5
-rw-r--r--test/fileutils/test_nowrite.rb17
-rw-r--r--test/fileutils/test_verbose.rb25
-rw-r--r--test/gdbm/test_gdbm.rb21
-rw-r--r--test/iconv/test_basic.rb49
-rw-r--r--test/iconv/test_option.rb31
-rw-r--r--test/iconv/test_partial.rb41
-rw-r--r--test/iconv/utils.rb26
-rw-r--r--test/net/http/test_httpheader.rb39
-rw-r--r--test/net/http/test_https_proxy.rb9
-rw-r--r--test/net/imap/test_imap.rb11
-rw-r--r--test/nkf/test_kconv.rb71
-rw-r--r--test/nkf/test_nkf.rb16
-rw-r--r--test/openssl/test_cipher.rb43
-rw-r--r--test/openssl/test_digest.rb22
-rw-r--r--test/openssl/test_ec.rb113
-rw-r--r--test/openssl/test_ssl.rb349
-rw-r--r--test/openssl/test_x509ext.rb74
-rw-r--r--test/optparse/test_getopts.rb31
-rw-r--r--test/pathname/test_pathname.rb478
-rw-r--r--test/rdoc/parsers/test_parse_c.rb261
-rw-r--r--test/readline/test_readline.rb28
-rw-r--r--test/rinda/test_rinda.rb111
-rw-r--r--test/rss/dot.pngbin0 -> 111 bytes-rw-r--r--test/rss/rss-assertions.rb1945
-rw-r--r--test/rss/rss-testcase.rb244
-rw-r--r--test/rss/test_1.0.rb115
-rw-r--r--test/rss/test_2.0.rb410
-rw-r--r--test/rss/test_accessor.rb83
-rw-r--r--test/rss/test_atom.rb681
-rw-r--r--test/rss/test_content.rb69
-rw-r--r--test/rss/test_dublincore.rb312
-rw-r--r--test/rss/test_image.rb137
-rw-r--r--test/rss/test_inherit.rb5
-rw-r--r--test/rss/test_itunes.rb347
-rw-r--r--test/rss/test_maker_0.9.rb188
-rw-r--r--test/rss/test_maker_1.0.rb221
-rw-r--r--test/rss/test_maker_2.0.rb145
-rw-r--r--test/rss/test_maker_atom_entry.rb367
-rw-r--r--test/rss/test_maker_atom_feed.rb389
-rw-r--r--test/rss/test_maker_content.rb13
-rw-r--r--test/rss/test_maker_dc.rb29
-rw-r--r--test/rss/test_maker_image.rb8
-rw-r--r--test/rss/test_maker_itunes.rb471
-rw-r--r--test/rss/test_maker_slash.rb37
-rw-r--r--test/rss/test_maker_sy.rb3
-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.rb46
-rw-r--r--test/rss/test_parser.rb587
-rw-r--r--test/rss/test_parser_1.0.rb511
-rw-r--r--test/rss/test_parser_2.0.rb122
-rw-r--r--test/rss/test_parser_atom_entry.rb163
-rw-r--r--test/rss/test_parser_atom_feed.rb276
-rw-r--r--test/rss/test_setup_maker_0.9.rb89
-rw-r--r--test/rss/test_setup_maker_1.0.rb292
-rw-r--r--test/rss/test_setup_maker_2.0.rb113
-rw-r--r--test/rss/test_setup_maker_atom_entry.rb409
-rw-r--r--test/rss/test_setup_maker_atom_feed.rb445
-rw-r--r--test/rss/test_setup_maker_itunes.rb144
-rw-r--r--test/rss/test_setup_maker_slash.rb38
-rw-r--r--test/rss/test_slash.rb64
-rw-r--r--test/rss/test_syndication.rb24
-rw-r--r--test/rss/test_taxonomy.rb172
-rw-r--r--test/rss/test_to_s.rb242
-rw-r--r--test/rss/test_trackback.rb22
-rw-r--r--test/rss/test_version.rb2
-rw-r--r--test/rss/test_xml-stylesheet.rb6
-rw-r--r--test/ruby/envutil.rb12
-rw-r--r--test/ruby/suicide.rb2
-rw-r--r--test/ruby/test_array.rb1191
-rw-r--r--test/ruby/test_beginendblock.rb47
-rw-r--r--test/ruby/test_bignum.rb19
-rw-r--r--test/ruby/test_dir.rb42
-rw-r--r--test/ruby/test_enum.rb258
-rw-r--r--test/ruby/test_enumerator.rb105
-rw-r--r--test/ruby/test_fixnum.rb26
-rw-r--r--test/ruby/test_float.rb76
-rw-r--r--test/ruby/test_hash.rb567
-rw-r--r--test/ruby/test_integer.rb653
-rw-r--r--test/ruby/test_iterator.rb12
-rw-r--r--test/ruby/test_marshal.rb20
-rw-r--r--test/ruby/test_method.rb11
-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_proc.rb5
-rw-r--r--test/ruby/test_process.rb41
-rw-r--r--test/ruby/test_settracefunc.rb6
-rw-r--r--test/ruby/test_signal.rb2
-rw-r--r--test/ruby/test_sleep.rb10
-rw-r--r--test/ruby/test_super.rb17
-rw-r--r--test/ruby/test_symbol.rb92
-rw-r--r--test/ruby/test_system.rb5
-rw-r--r--test/ruby/test_time.rb21
-rw-r--r--test/sdbm/test_sdbm.rb1
-rw-r--r--test/soap/ssl/test_ssl.rb80
-rw-r--r--test/soap/wsdlDriver/test_calc.rb14
-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.rb84
-rw-r--r--test/testunit/collector/test_dir.rb29
-rwxr-xr-xtest/thread/lbtest.rb51
-rw-r--r--test/thread/test_thread.rb81
-rw-r--r--test/uri/test_common.rb5
-rw-r--r--test/uri/test_ftp.rb22
-rw-r--r--test/uri/test_generic.rb80
-rw-r--r--test/webrick/.htaccess1
-rw-r--r--test/webrick/test_cgi.rb34
-rw-r--r--test/webrick/test_cookie.rb48
-rw-r--r--test/webrick/test_filehandler.rb135
-rw-r--r--test/webrick/test_httprequest.rb58
-rw-r--r--test/webrick/utils.rb12
-rw-r--r--test/webrick/webrick.cgi6
-rw-r--r--test/webrick/webrick_long_filename.cgi36
-rw-r--r--test/wsdl/any/test_any.rb14
-rw-r--r--test/wsdl/ref/test_ref.rb14
-rw-r--r--test/wsdl/simpletype/rpc/test_rpc.rb14
-rw-r--r--test/xmlrpc/test_cookie.rb96
-rw-r--r--test/xmlrpc/test_webrick_server.rb16
-rw-r--r--test/yaml/test_yaml.rb55
-rw-r--r--test/yaml/test_yamlstore.rb74
-rw-r--r--time.c105
-rw-r--r--util.c3443
-rw-r--r--util.h1
-rw-r--r--variable.c121
-rw-r--r--version.c33
-rw-r--r--version.h34
-rw-r--r--win32/Makefile.sub286
-rwxr-xr-xwin32/configure.bat10
-rw-r--r--win32/dir.h4
-rwxr-xr-x[-rw-r--r--]win32/mkexports.rb17
-rwxr-xr-x[-rw-r--r--]win32/resource.rb26
-rw-r--r--win32/setup.mak50
-rw-r--r--win32/win32.c1114
-rw-r--r--win32/win32.h57
-rw-r--r--wince/Makefile.sub488
-rwxr-xr-x[-rw-r--r--]wince/configure.bat0
-rw-r--r--wince/mkconfig_wce.rb7
-rw-r--r--wince/mkexports.rb35
-rw-r--r--wince/resource.rb96
-rw-r--r--wince/setup.mak2
1189 files changed, 109022 insertions, 30686 deletions
diff --git a/.cvsignore b/.cvsignore
index 69a30e5f81..a72211d03f 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -3,10 +3,14 @@
*.rej
*.sav
*~
+.*.list
+.*.time
.ccmalloc
.ppack
.ext
-.rbconfig.time
+.git
+.svn
+.pc
COPYING.LIB
ChangeLog.pre-alpha
ChangeLog.pre1_1
@@ -24,32 +28,20 @@ config.h.in
config.log
config.status
configure
-foo.rb
libruby.so.*
miniruby
-miniruby.elhash
-miniruby.elhash2
-miniruby.orig2
-miniruby.plhash
-miniruby.plhash2
-modex.rb
newdate.rb
newver.rb
parse.c
-parse.y.try
-pitest.rb
+patches
ppack
preview
rbconfig.rb
-rename2.h
repack
riscos
rubicon
ruby
ruby-man.rd.gz
-rubyunit
-st.c.power
-this that
tmp
web
y.output
diff --git a/COPYING b/COPYING
index 870a5f22d6..9043404a83 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
-(see the file GPL), or the conditions below:
+version 2 (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 9623be8a0a..6432869b78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9360 @@
+Fri Jan 9 19:25:25 2009 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (disconnect): do not refer SSL::SSLSocket for
+ environments without OpenSSL. backported from trunk.
+ fixed [ruby-dev:35755].
+
+Thu Jan 8 13:24:23 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (deferred_nodes, compstmt, arg, fixup_nodes, range_op): fix
+ up fixnum range literal in conditional as automagical line number
+ comparison. [ruby-core:12124], [ruby-dev:35731]
+
+Wed Jan 7 10:09:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (timeofday): use monotonic clock. based on a patch
+ from zimbatm <zimbatm@oree.ch> in [ruby-core:16627].
+
+Tue Jan 6 09:03:35 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yylex): 8 and 9 in octal integer should cause compile
+ error. [ruby-dev:35729]
+
+Mon Jan 5 11:14:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): runs deferred finalizers.
+
+ * gc.c (gc_sweep): sets rb_thread_pending to run deferred finalizers.
+
+ * rubysig.h (CHECK_INTS): now checks rb_thread_pending even on
+ platforms where setitimer is not available. [ruby-core:18045]
+
+Mon Jan 5 11:14:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * rubysig.h (CHECK_INTS): gives the chance to perform to deferred
+ finalizers before explicit GC.start or the process termination.
+ [ruby-core:18045]
+
+Sun Jan 4 04:49:01 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_telldir): just returns loc.
+
+ * win32/win32.c (rb_w32_rewinddir): needs to intialize loc.
+ [ruby-core:18041]
+
+Sun Jan 4 04:45:26 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select): recalc the rest of timeout for each
+ iterations. [ruby-core:18015]
+
+Fri Jan 2 03:08:47 2009 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rss/: use PNG instead of zlib as binary data. [ruby-dev:35666]
+
+Tue Nov 11 01:07:32 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * configure.in: fix SEGV on Mac OS X 10.5.3 with --enable-pthread.
+ a patch from Wataru Kimura in Bug #193 [ruby-core:17333].
+
+Mon Aug 11 09:37:17 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dl/dl.c (rb_str_to_ptr): should propagate taint to dlptr.
+
+ * ext/dl/dl.c (rb_ary_to_ptr): ditto.
+
+ * ext/dl/sym.c (rb_dlsym_call): should check taint of DLPtrData as
+ well.
+
+Fri Aug 8 10:53:52 2008 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb: randomize source port and transaction id.
+ CVE-2008-1447.
+
+ * lib/resolv-replace.rb (UDPSocket#bind): don't resolv host if host is
+ "".
+
+Mon Aug 4 14:49:35 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::rcptto): fix a typo. a patch from
+ Masao Takaku <masao at nii.ac.jp>
+ fix [ruby-dev:35489].
+
+Mon Aug 4 14:13:15 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * regex.c (xmalloc, xrealloc, xfree): not to use ruby managed memory.
+
+ * regex.c (DOUBLE_STACK, re_compile_fastmap0, re_adjust_startpos),
+ (re_search, re_match_exec): check if failed to allocate memory.
+
+Mon Aug 4 13:53:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big2str0, bigsqr): made interruptible. [ruby-Bugs-20622]
+
+Mon Aug 4 13:31:41 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (check_uint, rb_num2uint, rb_fix2uint): fixed wrong check
+ about 64bit positive value.
+Mon Aug 4 13:31:41 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (check_uint, rb_num2uint, rb_fix2uint): strict check.
+ fixed [ruby-dev:33683]
+
+Thu Jul 17 21:42:07 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::start): revert to avoid RFC2821
+ violation. [ruby-dev:35487]
+
+Thu Jul 17 21:32:49 2008 Tanaka Akira <akr@fsij.org>
+
+ * string.c (rb_str_format_m): make tmp volatile to avoid possible GC
+ problem.
+
+Thu Jul 17 21:30:55 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#environment): requires shellwords.
+ [ruby-dev:35466]
+
+Thu Jul 17 02:05:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/xmlrpc/client.rb (XMLRPC::Client#do_rpc): requires
+ webrick/cookie. [ ruby-Bugs-21139 ]
+
+Thu Jul 17 01:38:31 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ext/zlib/zlib.c (rb_gzfile_set_mtime): fix typo. [ruby-core:17713]
+
+Sun Jul 13 00:08:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/ipaddr.rb (IPAddr#initialize): get rid of ArgumentError in
+ IPAddr#to_range. a patch from okkez <okkez000 AT gmail.com> in
+ [ruby-dev:35091].
+
+Sun Jul 13 00:04:38 2008 Tanaka Akira <akr@fsij.org>
+
+ * configure.in (erfc): erfc of glibc comes with Debian GNU/Linux Etch
+ on IA64 is broken. erfc(10000.0) aborts.
+ use missing/erf.c instead.
+ http://sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html
+
+Thu Jul 10 18:50:48 2008 Tanaka Akira <akr@fsij.org>
+
+ * common.mk (SPEC_GIT_BASE): update RubySpec GIT URL.
+
+Thu Jul 10 18:46:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_extname): fix for file name with spaces.
+ [ruby-talk:307404]
+
+Thu Jul 10 18:42:37 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (PercentScanner#scan): fix %% line bug. [ruby-core:17491]
+
+ * test/erb/test_erb.rb (test_percent): ditto.
+
+Thu Jul 10 18:40:22 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
+
+Thu Jul 10 18:36:53 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ruby.c: Mac OS X needs origargc times of '\0' in
+ origargv. [ruby-dev:35308]
+
+Thu Jul 10 13:53:08 2008 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/ruby.h (POSFIXABLE): use FIXNUM_MAX+1 instead of
+ FIXNUM_MAX to make it possible to convert to double accurately.
+ It assumes FLT_RADIX is 2.
+ fix RubyForge bug #14102.
+ backported from 1.9.
+
+Mon Jul 7 16:21:38 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::start): use 'localhost' instead of
+ 'localhost.localdomain'. [ruby-dev:35333]
+
+ * lib/net/smtp.rb (Net::SMTP::SMTP.start): ditto.
+
+Mon Jul 7 15:02:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_longjmp): duplicate the thrown exception to set backtrace
+ if it was frozen. clear all raised flags.
+
+ * eval.c (stack_check): leave clearing flag to rb_longjmp.
+
+ * eval.c (rb_thread_set_raised, rb_thread_reset_raised): use generic
+ flags.
+
+ * eval.c (Init_Proc), gc.c (Init_GC): freeze preallocated special exceptions.
+
+ * gc.c (rb_memerror): use thread raised flag instead of static flag,
+ and raise nomem_error without backtrace if failed to make backtrace.
+ [ruby-dev:34724]
+
+ * gc.c (ruby_xmalloc): increase malloc_increase only if malloc
+ succeeds. failed malloc size can be huge. it may increase
+ malloc_limit too big which cause less GC and memory full.
+ (ruby_xrealloc): ditto.
+
+Mon Jul 7 12:23:05 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c: avoid creating Ruby object during
+ GC. thanks to arton <artonx AT yahoo.co.jp>. [ruby-dev:35313]
+
+ * ext/win32ole/tests: add test_win32ole_event.rb, remove
+ testOLEEVENT.rb
+
+ * ext/win32ole/tests/testWIN32OLE.rb(test_convert_bignum):
+ fix test.
+
+Mon Jul 7 12:23:05 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * gc.c: add rb_during_gc(). based on a patch from arton <artonx AT
+ yahoo.co.jp> at [ruby-dev:35313].
+
+ * intern.h: ditto.
+
+Thu Jul 3 20:13:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
+ public methods only. [ruby-core:17283]
+
+ * object.c (convert_type): ditto.
+
+ * lib/singleton.rb (Singleton#_dump): conversion method should be
+ public.
+
+Wed Jul 2 19:06:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension.read_multipart): blanks inside
+ double quotes are allowed. [ruby-list:45140]
+
+Wed Jul 2 19:03:37 2008 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (num_coerce): call rb_Float(x) first. don't depend on
+ evaluation order of function arguments.
+
+Wed Jul 2 18:57:19 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/syslog/syslog.c (syslog_write): syslog operations should be
+ protected from $SAFE level 4. a patch from Keita Yamaguchi
+ <keita.yamaguchi at gmail.com>.
+
+ * ext/syslog/syslog.c (mSyslog_close): ditto.
+
+ * ext/syslog/syslog.c (mSyslog_set_mask): ditto.
+
+Wed Jul 2 18:26:20 2008 Tanaka Akira <akr@fsij.org>
+
+ * math.c (domain_check): fix preprocess condition.
+
+Wed Jul 2 18:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tmpdir.rb (@@systmpdir): prior LOCAL_APPDATA if possible, and
+ should be clean. based on a patch from arton <artonx AT
+ yahoo.co.jp> at [ruby-dev:35269]
+
+Wed Jul 2 18:16:19 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (date2time_str): fix the overflow in
+ some situation. [ruby-bugs-20793]
+
+Tue Jul 1 15:11:14 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_fill): check if beg is too big.
+
+Mon Jun 30 20:35:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_buf_cat): check for self concatenation.
+
+Sun Jun 29 21:39:54 2008 Tanaka Akira <akr@fsij.org>
+
+ * eval.c (rb_obj_respond_to): use RTEST to test the result of
+ respond_to? method.
+
+Sun Jun 29 21:20:17 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * array.c (rb_ary_fill): (compatibility) do not raise
+ ArgumentError on negative length. This behaviour shall change
+ in a future release.
+
+Sun Jun 29 20:08:11 2008 Tanaka Akira <akr@fsij.org>
+
+ * time.c (time_timeval): fix rounding negative float.
+
+Sun Jun 29 19:19:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/inlinetest.rb (InlineTest.in_progname): workaround for frozen
+ $0. [ruby-dev:35261]
+
+ * lib/test/unit/ui/console/testrunner.rb (TestRunner#finished): ditto.
+
+Sun Jun 29 19:19:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (set_arg0, ruby_prog_init): freeze $0. a patch from Keita
+ Yamaguchi <keita.yamaguchi at gmail.com>.
+
+Sun Jun 29 18:33:33 2008 Tanaka Akira <akr@fsij.org>
+
+ * process.c: include sys/resource.h if HAVE_SYS_RESOURCE_H is defined.
+ pointed by TOYOFUKU Chikanobu. [ruby-dev:35258]
+
+Sun Jun 29 18:26:01 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_f_trace_var): should not be allowed at safe level 4.
+ a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com>.
+
+ * eval.c (rb_call0): wrong condition to check insecure method.
+ a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com>.
+
+Sun Jun 29 18:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_fill): not depend on unspecified behavior at integer
+ overflow. reported by Vincenzo Iozzo <snagg AT openssl.it>.
+
+Sun Jun 29 18:22:06 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c(ole_invoke): fix memory leak.
+ [ruby-bugs-20792]
+
+Sun Jun 29 18:19:11 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (PUSH_FRAME, PUSH_CLASS): Add volatile to avoid a
+ possible optimization bug on OS X/PPC. This at least makes
+ build with gcc -O1 and `make test' pass.
+
+Sun Jun 29 17:24:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc#collect_first_comment): skip
+ magic comment.
+
+Sun Jun 29 17:22:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_each, strio_readlines): IO#each and
+ IO#readlines do not affect $_. [ruby-core:17277]
+
+Sun Jun 29 17:19:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_readline, strio_each)
+ (strio_readlines): set lastline. [ruby-core:17257]
+
+Sun Jun 29 17:15:49 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl.h: include winsock.h if USE_WINSOCK2 is not defined.
+ a patch from arton <artonx at yahoo.co.jp> in [ruby-dev:35078]
+
+Sun Jun 29 17:09:48 2008 wanabe <s.wanabe@gmail.com>
+
+ * util.c (ruby_strtod): ruby_strtod don't allow a trailing
+ decimal point like "7.". [ruby-dev:34835] [ruby-dev:35009]
+
+Sat Jun 28 19:23:40 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * class.c (clone_method): use rb_copy_node_scope.
+ fixed [ruby-list:45102]
+ fixed [ruby-core:17393]
+
+Sat Jun 28 18:49:50 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * class.c: revert to r15855.
+
+Fri Jun 20 18:25:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_buf_append): should infect.
+
+Fri Jun 20 16:33:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_store, rb_ary_splice): not depend on unspecified
+ behavior at integer overflow.
+
+ * string.c (str_buf_cat): ditto.
+
+Wed Jun 18 22:24:46 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * array.c (ary_new, rb_ary_initialize, rb_ary_store,
+ rb_ary_aplice, rb_ary_times): integer overflows should be
+ checked. based on patches from Drew Yao <ayao at apple.com>
+ fixed CVE-2008-2726
+
+ * string.c (rb_str_buf_append): fixed unsafe use of alloca,
+ which led memory corruption. based on a patch from Drew Yao
+ <ayao at apple.com> fixed CVE-2008-2726
+
+ * sprintf.c (rb_str_format): backported from trunk.
+
+ * intern.h: ditto.
+
+Tue Jun 17 15:09:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): no need to expand root path which has no
+ short file name. [ruby-dev:35095]
+
+Sun Jun 15 19:27:40 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in: Fix $LOAD_PATH. Properly expand vendor_ruby
+ directories; submitted by Takahiro Kambe <taca at
+ back-street.net> in [ruby-dev:35099].
+
+Mon Jun 9 17:56:30 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#delete_if): Call to_a.
+ (SortedSet#delete_if, TC_SortedSet#test_sortedset): Use super to
+ yield elements in sorted order; [ruby-core:17144] by Arthur
+ Schreiber.
+ (SortedSet#each, SortedSet#each, TC_Set#test_each)
+ (TC_SortedSet#test_sortedset): Return self; [ruby-dev:35002] by
+ Arthur Schreiber.
+
+Mon Jun 9 03:28:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/zlib/zlib.c (rb_deflate_initialize, Init_zlib): Fix up
+ initialize_copy; [ruby-list:45016], [ruby-list:45018].
+
+Mon Jun 9 03:26:03 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: Mention new constants.
+
+Mon Jun 9 03:24:18 2008 Tanaka Akira <akr@fsij.org>
+
+ * hash.c (hash_i): make Hash#hash order insensitive.
+
+Mon Jun 9 03:22:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (VENDOR_DIR): use LIBDIR instead of PREFIX as well as
+ SITE_DIR. a patch from Richard Brown <rbrown AT exherbo.org> in
+ [ruby-core:17129].
+
+Mon Jun 9 03:21:20 2008 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (os_obj_of): assure to not free the scanning heap.
+
+Mon Jun 9 03:20:12 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_open_file, rb_io_s_sysopen): fmode should be unsigned int.
+ fixed [ruby-dev:34979]
+
+Fri Jun 6 21:16:55 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (COMMON_HEADERS): include ws2tcpip.h.
+
+ * ext/socket/addrinfo.h (addrinfo, getaddrinfo, getnameinfo,
+ freehostent, freeaddrinfo): undef before define because these are
+ macros in some versions of Windows SDK.
+
+ * win32/setup.mak: maybe commit miss.
+
+Fri Jun 6 19:34:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * mkconfig.rb: hide build path from rbconfig.rb.
+
+ * util.c (ruby_strtod, dtoa): initialize more variables for error
+ handling.
+
+ * io.c (rscheck), marshal.c (w_nbyte, w_bytes, w_unique),
+ (path2class, path2module): constified.
+
+ * pack.c (pack_unpack), process.c (rb_syswait): suppress warnings.
+
+ * suppress warnings on cygwin, mingw and mswin.
+
+Fri Jun 6 19:23:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): fix for non-existent files and SFN of
+ symlinks. [ruby-talk:303736]
+
+Fri Jun 6 18:25:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/iconv: Tests fixed.
+
+Fri Jun 6 17:04:56 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * win32/win32.h: include ws2tcpip.h. fixed [ruby-Bugs-20528]
+
+ * lib/time.rb (Time.xmlschema): don't use float. fix
+ http://rubyforge.org/tracker/index.php?func=detail&group_id=426&atid=1698&aid=20504
+
+ * object.c (rb_obj_alloc): RDoc updated. a patch from Gaston
+ Ramos <ramos.gaston at gmail.com> in [ruby-core:17073].
+
+ * lib/rdoc.rb: massive spelling correction patch from Evan Farrar
+ <evanfarrar at gmail.com> in [ruby-doc:1382] applied.
+
+ * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_initialize):
+ Add a null check for ssl; submitted by akira yamada
+ in [ruby-dev:34950].
+
+ * ext/openssl/ossl_ssl.c (Init_ossl_ssl): Define OP_NO_TICKET if
+ SSL_OP_NO_TICKET is present; submitted by akira yamada
+ in [ruby-dev:34944].
+
+ * test/openssl/test_ssl.rb (OpenSSL#test_server_session): Add a
+ workaround for the case where OpenSSL is configured with
+ --enable-tlsext; submitted by akira yamada in [ruby-dev:34944].
+
+Fri Jun 6 16:58:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_iconv): fix for length argument and now
+ allows range. [ruby-core:17092] [ruby-core:17115]
+
+Wed Jun 4 17:22:30 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Fix typos and move misplaced entries.
+ NEWS: Somehow optflags and warnflags were not actually included
+ in this release.
+
+Tue Jun 3 19:33:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_init_copy): Take care of
+ initialize_copy as well as initialize.
+
+ * test/ruby/test_enumerator.rb: Pull in the test suite for
+ enumerator from trunk.
+
+Tue Jun 3 12:51:57 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_allocate, enumerator_ptr): Properly
+ detect if the object is initialized and raise error when
+ appropriate.
+ (enumerator_initialize): Fix a typo in rdoc. [ruby-core:17052]
+
+Tue Jun 3 10:16:40 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/erb.rb (ERB::Compiler::TrimScanner#scan_line): Fix a bug
+ where tokens are not yilelded one by one.
+ (ERB::Compiler::TrimScanner#explicit_trim_line): Fix without-
+ strscan problems. [ruby_core:17028].
+
+ * test/erb/test_erb.rb (TestERBCore#_test_01)
+ (TestERBCore#test_02_safe_04): The expected value should come
+ first for assert_equal().
+ (TestERBCoreWOStrScan): Add test class for without-strscan.
+
+Mon Jun 2 19:47:16 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/delegate.rb (DelegateClass, Delegator#respond_to?):
+ respond_to? must take optional second argument. This was a
+ latent bug exposed by a recent internal change of marshal.c to
+ call respond_to? with a second argument; submitted by Jeremy
+ Kemper <jeremy at bitsweat.net> in [ruby-core:17045].
+
+Sat May 31 23:53:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7.
+
+Sat May 31 23:33:34 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * README, README.ja: Add a note about default C flags.
+
+Sat May 31 22:11:15 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * version.c (ruby_description, ruby_copyright): backported from
+ 1.9. bug#19002, [ruby-dev:34883]
+
+ * error.c (report_bug): uses ruby_description.
+
+Sat May 31 20:56:04 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_delete_if): should return enumerator if no block
+ is given. [ruby-dev:34901]
+
+Sat May 31 18:28:17 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * suppress warnings with -Wwrite-string.
+
+Sat May 31 15:58:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, configure.in (warnflags): defaulted to -Wall
+ -Wno-parentheses with gcc. [ruby-dev:34810]
+
+Fri May 30 05:28:18 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (count_i, count_iter_i, count_all_i): add prototypes for VC.
+
+Fri May 30 04:32:07 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (count_i, count_iter_i): Sync with trunk.
+ enum.c (enum_count, count_all_i, Init_Enumerable),
+ array.c (rb_ary_count): Sync with trunk. If no argument or
+ block is given, count the number of all elements.
+
+Fri May 30 03:12:18 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_bn.c (ossl_bn_s_rand, ossl_bn_s_pseudo_rand):
+ Int should be enough here.
+
+Fri May 30 02:35:00 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_bn.c (ossl_bn_s_rand, ossl_bn_s_pseudo_rand),
+ ext/openssl/ossl_pkey_dh.c (ossl_dh_s_generate)
+ (ossl_dh_initialize),
+ ext/openssl/ossl_pkey_dsa.c (ossl_dsa_s_generate),
+ ext/openssl/ossl_rand.c (ossl_rand_bytes)
+ (ossl_rand_pseudo_bytes, ossl_rand_egd_bytes),
+ ext/openssl/ossl_x509store.c (ossl_x509stctx_set_error): Do not
+ use FIX2INT() without checking the value type. Use NUM2INT()
+ instead; found by akr in [ruby-dev:34890].
+
+Thu May 29 20:07:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in, win32/Makefile.sub, mkconfig.rb, instruby.rb,
+ ruby.c, lib/mkmf.rb, README.EXT, README.EXT.ja: Backport the
+ vendor_ruby directory support.
+
+Thu May 29 17:52:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/extconf.rb: search zlib1, and regard mswin32 later than VC6
+ as WIN32. [ruby-core:16984]
+
+Wed May 28 17:54:29 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_start_with): Remove an unused variable.
+ (rb_str_upto_m): Fix a prototype.
+
+Wed May 28 17:48:28 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * range.c (range_step): Fix brokenness when a non-integer numeric
+ value is specified as step. [rubyspec]
+ (range_step): Make use of String#step internally if a string (or
+ string-alike) range is given.
+
+ * string.c (rb_str_upto_m, Init_String): Add an optional second
+ argument to specify if the last value should be included.
+
+Wed May 28 16:53:39 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): Call rb_ary_modify_check() at the
+ beginning. [rubyspec]
+
+Wed May 28 16:12:44 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/webrick/httpservlet/cgihandler.rb (WEBrick::HTTPServlet::CGIHandler#do_GET):
+ Set the HTTP status code to 302 if a Location header field is
+ present and the status code is not valid as a client
+ redirection. cf. RFC 3875 6.2.3, 6.2.4.
+
+Wed May 28 15:18:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/singleton.rb (SingletonClassMethods): _load should be public.
+
+Wed May 28 12:52:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
+ private methods too. [ruby-dev:34671]
+
+ * object.c (convert_type): ditto.
+
+Tue May 27 23:26:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_bug): description from rb_bug() should include
+ patchlevel. [ruby-dev:34826]
+
+Tue May 27 20:19:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): Return an empty array instead of
+ nil when pos is valid and len is adjusted from a valid value to
+ zero; caught by RubySpec.
+
+Tue May 27 19:45:20 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (flo_divmod): Revert the behavior change; do not
+ suppress an exception when div is NaN or Inf. [ruby-dev:34857]
+
+Tue May 27 19:24:40 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_to_a): Pass arguments through to #each().
+ (enum_sort): Follow the enum_to_a signature change.
+ (enum_reverse_each): Add #reverse_each().
+
+Tue May 27 18:54:02 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (strio_each_char, Init_stringio): Add
+ StringIO#{each_char,chars}.
+
+Tue May 27 17:59:34 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (strio_each): Return an enumerator if no
+ block is given.
+ (strio_each_byte): Return an enumerator if no block is given,
+ and return self if one is given as the rdoc says.
+
+ * io.c (rb_io_each_byte): Fix rdoc. IO#each_byte returns self,
+ not nil.
+
+Tue May 27 16:02:58 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_mod_module_exec, Init_eval): Add
+ Module#{module_exec,class_exec}.
+
+Tue May 27 15:36:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (rb_io_each_char, argf_each_char, Init_IO):
+ Add {IO#,ARGF.}{each_char,chars}.
+
+Tue May 27 13:46:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (Init_stringio): Define
+ StringIO#{getbyte,readbyte}.
+
+Tue May 27 13:38:51 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (Init_IO): Define {IO#,ARGF.}{getbyte,readbyte}.
+
+Tue May 27 13:26:15 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (Init_stringio): Define #bytes and
+ #lines.
+
+Tue May 27 13:20:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c: (rb_io_lines, rb_io_bytes, Init_IO): Define
+ IO#{lines,bytes} and ARGF.{lines,bytes}.
+
+Tue May 27 12:13:17 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (BUFCHECK): wrong condition. [ruby-core:16921]
+
+ * file.c (file_expand_buf): shouldn't use buflen for length of string.
+
+Mon May 26 18:24:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (BUFCHECK): no resize if enough room.
+
+ * file.c (file_expand_path): use BUFCHECK.
+
+Mon May 26 16:46:19 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (ntfs_tail): filename which starts with '.' is valid.
+
+ * file.c (file_expand_path): cygwin symlink support.
+
+Mon May 26 12:16:43 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview4.
+
+Mon May 26 12:12:26 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * marshal.c (dump_ensure, load_ensure): should return values.
+
+ * eval.c (yield_under, yield_under_i, yield_args_under_i)
+ (specific_eval, rb_obj_instance_exec, Init_eval): Implement
+ Object#instance_exec(), a 1.9 feature.
+
+Mon May 26 11:53:21 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_yield_0, proc_invoke, proc_arity): allow passing a
+ block to a Proc. [ruby-dev:23533]; by nobu; backported from
+ 1.9. This implementation in current shape is known to be
+ buggy/broken, especially with nested block invocation. Take
+ this as an experimental feature.
+
+ * parse.y (block_par, block_var): ditto.
+
+Mon May 26 08:00:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * marshal.c (r_object0, Init_marshal): Fix the garbled s_call
+ definition; fixes [ruby-dev:34843].
+
+Mon May 26 03:16:20 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * hash.c (rb_hash_default): Fix rdoc.
+ (rb_hash_each, env_each_value, env_each_pair): Return an
+ enumerator if no block is given.
+ (rb_hash_update): Update rdoc.
+ (envix): Conditionalize the definition itself.
+ (rb_f_getenv, env_fetch, env_keys, env_values, env_values_at)
+ (env_select, env_inspect, env_to_a, env_empty_p, env_has_key)
+ (env_has_value, env_index, env_indexes, env_to_hash, env_shift)
+ (env_update): Require secure level 4.
+ (env_each_value, env_each_i): Delay variable initialization.
+ (env_each_key, env_each_value, env_reject_bang)
+ (env_clear, env_replace): Omit duplicated secure level check.
+ (env_has_value): Do to_str conversion.
+
+Sun May 25 19:48:12 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * hash.c (env_delete_if): Return an enumerator if no block is
+ given.
+ (env_each_key): Delay a variable initialization after
+ RETURN_ENUMERATOR().
+
+Sun May 25 05:07:19 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): Be consistent with Array#slice()
+ and String#slice!(). Just return nil when a negative length or
+ out of boundary index is given instead of raising an exception
+ via internal functions.
+ (rb_ary_slice_bang): should not use rb_ary_subseq() which shares
+ internal pointer. splice modifies the receiver right after
+ subseq. [ruby-dev:34005]
+ (rb_ary_slice_bang): should adjust length before making
+ sub-array.
+
+ * enumerator.c (Init_Enumerator): Override
+ Enumerable::Enumerator#each_with_index with #with_index.
+
+Sun May 25 03:13:09 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (Init_Thread): Initialize recursive_key.
+
+Sun May 25 02:45:49 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * error.c (syserr_eqq): Use en.
+
+Sat May 24 22:32:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_cstr_to_dbl): should clear errno before calling
+ strtod(3). [ruby-dev:34834]
+
+Sat May 24 22:27:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (marshal_load): should initialize arg.data used for
+ reentrant check. [ruby-dev:34837]
+
+Sat May 24 00:34:59 2008 Tanaka Akira <akr@fsij.org>
+
+ * lib/rational.rb (Rational#to_i): fix rdoc. Rational(-7,4).to_i
+ should be -1.
+
+Fri May 23 20:22:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (reentrant_check): check reentrance via callcc.
+ [ruby-dev:34802]
+
+Fri May 23 16:46:28 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (proc_call): Remove an unused static function.
+
+Fri May 23 13:46:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (cflags): commit miss.
+
+Fri May 23 09:52:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (MINIRUBY), common.mk (RUBYOPT): add purelib.rb.
+ [ruby-core:16642]
+
+ * ext/extmk.rb: load purelib.rb only when not cross compiling.
+
+Fri May 23 08:47:02 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (syserr_eqq): === should be able to handle delegated
+ objects as well.
+
+Fri May 23 04:22:19 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
+
+ * ext/tk/lib/tk.rb: avoid trouble when finalize TclTkIp.
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/*: help to fix troubles when
+ use Ttk widgets on old Tk scripts.
+
+ * ext/tk/sample/*: update and add demo scripts. some of them are
+ introduction about new features of Tcl/Tk8.5.
+
+Fri May 23 03:48:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (clone_method): Just use ruby_cref as cref.
+
+Fri May 23 01:03:23 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (rb_singleton_class_clone): Pass Qnil, not 0.
+
+Fri May 23 00:51:48 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (clone_method): Totally revamp the previous fix which
+ was incorrect.
+ (rb_mod_init_copy): Ditto.
+ (singleton_class_clone_int): Ditto.
+
+Fri May 23 00:48:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_copy_node_scope), node.h: Rename from copy_node_scope
+ and export.
+
+Thu May 22 21:24:15 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (top_local_setup): fixed memory leak bug based on a
+ patch from Roger Pack <rogerpack2005 at gmail.com> in
+ [ruby-core:16610].
+
+Thu May 22 14:20:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (flatten): check if reentered. [ruby-dev:34798]
+
+Thu May 22 08:28:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (flatten): free memo hash table before raising exception.
+ [ruby-dev:34789]
+
+Thu May 22 06:30:10 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * array.c (flatten): fix memory leak.
+
+Thu May 22 05:45:30 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * proc.c (proc_dup): should copy safe_level from src proc
+ properly. a patch from Keita Yamaguchi
+ <keita.yamaguchi at gmail.com>
+
+Wed May 21 23:31:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache
+ uninitialized value, since search_method doesn't set origin if the
+ method wasn't found.
+
+ * eval.c (search_method, remove_method, error_print, rb_alias)
+ (rb_eval, rb_rescue2, search_required, Init_eval, rb_thread_create),
+ gc.c (rb_source_filename, Init_stack), io.c (rb_io_getline),
+ parse.y (rb_id2name, rb_parser_free): suppress warnings.
+
+Wed May 21 12:34:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_delete): rdoc fix based on a patch from Gaston Ramos
+ <ramos.gaston AT gmail.com>. [ruby-core:16825]
+
+Tue May 20 13:15:46 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * file.c (lchmod_internal): Remove a compiler warning.
+
+Mon May 19 18:22:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_pkcs5.c (ossl_pkcs5_pbkdf2_hmac): Fix the type
+ of md; pointed out by Takahiro Kambe <taca at back-street.net>
+ in [ruby-dev:34748].
+
+Mon May 19 14:20:13 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): fixed SEGV on win32 with "% 0e" % 1.0/0.0.
+
+Mon May 19 13:29:58 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_f_system): set last_status when status == -1 because
+ there is no path to set it on win32. this patch is derived from
+ [ruby-core:16787], submitted by Luis Lavena <luislavena at gmail.com>
+
+Mon May 19 13:01:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk ({MSPEC,RUBYSPEC}_GIT_URL): moved from Makefine.in.
+
+ * {win32,bcc32}/Makefile.sub (update-rubyspec): added.
+
+Mon May 19 11:53:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/openssl_missing.c (HMAC_CTX_copy): adopted
+ prototype change in openssl bundled with newer OpenBSD.
+ a patch from Takahiro Kambe <taca at back-street.net> in
+ [ruby-dev:34691].
+
+Mon May 19 06:36:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview3.
+
+Sun May 18 22:26:51 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpservlet/filehandler.rb: should normalize path
+ name in path_info to prevent script disclosure vulnerability on
+ DOSISH filesystems. (fix: CVE-2008-1891)
+ Note: NTFS/FAT filesystem should not be published by the platforms
+ other than Windows. Pathname interpretation (including short
+ filename) is less than perfect.
+
+ * lib/webrick/httpservlet/abstract.rb
+ (WEBrick::HTTPServlet::AbstracServlet#redirect_to_directory_uri):
+ should escape the value of Location: header.
+
+ * lib/webrick/httpservlet/cgi_runner.rb: accept interpreter
+ command line arguments.
+
+Sat May 17 23:53:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): fix for short file name on Cygwin.
+
+Sat May 17 11:29:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_extname): first dot is not an extension name.
+
+Sat May 17 10:18:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_search): need to free allocated buffer in re_register.
+
+Fri May 16 17:01:44 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (test-rubyspec): added.
+
+Fri May 16 16:22:40 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c: sometimes freeze when receive Interrupt signal.
+
+Fri May 16 14:54:56 2008 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (update-rubyspec): move rubyspec to srcdir.
+ (test-rubyspec): ditto.
+
+Fri May 16 14:25:22 2008 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (test-rubyspec): use RUNRUBY. suggested by nobu.
+
+Fri May 16 13:01:43 2008 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (update-rubyspec): new target to download rubyspec.
+ (test-rubyspec): new target to run rubyspec. this doesn't work
+ before install.
+
+Fri May 16 08:15:52 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: fix memory (object) leak bug.
+
+ * ext/tk/sample/demos-jp/aniwave.rb, ext/tk/sample/demos-en/aniwave.rb:
+ bug fix.
+
+Thu May 15 17:00:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (Init_String): Define #bytesize as an alias for #size
+ for compatibility with 1.9.
+
+Thu May 15 15:33:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): support for alternative data stream
+ and ignored trailing garbages of NTFS.
+
+ * file.c (rb_file_s_basename): ditto.
+
+ * file.c (rb_file_s_extname): ditto.
+
+Wed May 14 19:24:59 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_count): Override Enumerable#count for better
+ performance.
+ (rb_ary_nitems): Undo the backport. Use #count {} instead.
+
+ * enumerator.c (enumerator_iter_i): Remove an unused function.
+ (enumerator_with_index, enumerator_each): Remove unused
+ variables.
+
+Wed May 14 17:15:11 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/tk/tkutil/extronf.rb: check stdndup() because it's not standard
+ function of C.
+
+ * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use malloc() and
+ strncpy() instead of strndup() if not available.
+
+Wed May 14 09:52:02 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
+ Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still
+ not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g.
+ :widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on;
+ those are attributes of event object). It means that Ruby/Tk accepts
+ not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but
+ also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }".
+ It is potentially incompatible, when user passes symbols to the
+ arguments of the callback block (the block receives the symbols as
+ strings). I think that is very rare case (probably, used by Ruby/Tk
+ experts only). When causes such trouble, please give strings instead
+ of such symbol parameters (e.g. call Symbol#to_s method).
+
+ * ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb,
+ ext/tk/lib/tkextlib/blt/treeview.rb,
+ ext/tk/lib/tkextlib/winico/winico.rb: ditto.
+
+ * ext/tk/tkutil/tkutil.c: strings are available on subst_tables on
+ TkUtil::CallbackSubst class (it is useful on Ruby 1.9).
+
+ * ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb,
+ ext/tk/lib/tkextlib/iwidgets/spinner.rb,
+ ext/tk/lib/tkextlib/iwidgets/entryfield.rb,
+ ext/tk/lib/tkextlib/iwidgets/calendar.rb,
+ ext/tk/lib/tkextlib/blt/dragdrop.rb,
+ ext/tk/lib/tkextlib/tkDND/tkdnd.rb,
+ ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,
+ ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became
+ unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c.
+
+Tue May 13 15:10:50 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c: Update rdoc.
+ (enumerator_initialize): Discourage the use.
+ (enum_each_slice, enum_each_cons, enumerator_each)
+ (enumerator_with_index): Add a note about a call without a block.
+
+ * NEWS: Intentionally omit enum_slice and enum_cons, which are
+ removed in 1.9.
+
+Tue May 13 07:56:36 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cat): fixed buffer overrun reported by
+ Christopher Thompson <cthompson at nexopia.com> in [ruby-core:16746]
+
+Mon May 12 13:57:19 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): add NODE_OP_ASGN_{OR,AND}. "defined?(a||=1)"
+ should not operate assignment. [ruby-dev:34645]
+
+Mon May 12 12:59:23 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
+ an invalid value.
+
+ * ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
+
+Mon May 12 12:36:55 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select): backport from trunk.
+ [ruby-talk:300743]
+
+Mon May 12 12:33:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (RUBYLIB, RUBYOPT): clear.
+
+Mon May 12 10:41:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/delegate.rb (SimpleDelegator::dup): removed needless argument.
+ [ruby-list:44910]
+
+ * lib/delegate.rb (clone, dup): keep relationship with the target
+ object.
+
+Sun May 11 23:19:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (all_iter_i, any_iter_i): reduced duplicated code.
+
+Sun May 11 17:57:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (MINIRUBY): should not include extension library path.
+
+Sun May 11 10:36:10 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * eval.c (method_name, method_owner): New methods; backported
+ from 1.9. (UnboundMethod#name, UnboundMethod#owner)
+
+Sun May 11 02:48:13 2008 <nagai@orca16.orcabay.ddo.jp>
+
+ * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: fail to do pack/grid
+ without options.
+
+ * ext/tk/lib/tk.rb: add TkWindow#grid_anchor, grid_column, grid_row.
+
+Sat May 10 18:19:16 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_each_line): RDoc updated. [ruby-dev:34586]
+
+Sat May 10 13:17:56 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase supported
+ parameter patterns of configure method.
+
+Sat May 10 09:16:13 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * util.c (ruby_strtod): backported from 1.9. a patch from Satoshi
+ Nakagawa <psychs at limechat.net> in [ruby-dev:34625].
+ fixed: [ruby-dev:34623]
+
+Fri May 9 23:33:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/wm.rb: methods of Tk::Wm_for_General module cannot
+ pass the given block to methods of Tk::Wm module.
+
+ * ext/tk/lib/tk/grid.rb: lack of module-method definitions.
+
+ * ext/tk/lib/tkextlib/tile.rb: lack of autoload definitions.
+
+ * ext/tk/lib/tkextlib/tile/tnotebook.rb: cannot use kanji (not UTF-8)
+ characters for headings.
+
+ * ext/tk/tcltklib.c: maybe a little more stable about @encoding value
+ of TclTkIp object.
+
+Wed May 7 08:46:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * struct.c (rb_struct_s_def): to_str should be called only once.
+ [ruby-core:16647]
+
+Wed May 7 00:54:25 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzreader_gets): may cause infinite loop.
+ a patch from Kouya <kouyataifu4 at gmail.com> in
+ [ruby-reference-manual:762].
+
+Sun May 4 09:35:51 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * sample/erb/erb4html.rb (ERB4Html) : add example of ERB#set_eoutvar.
+ ERB4Html is an auto-quote ERB.
+
+Sat May 3 22:52:48 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
+ ext/tk/sample/ttk_wrapper.rb: improve treating and control themes.
+ add Tk::Tile.themes and Tk::Tile.set_theme(theme).
+
+Fri May 2 14:52:33 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el: move fontifying code from hook. a patch from
+ Phil Hagelberg <phil at hagelb.org> in [ruby-core:16636].
+
+Fri May 2 13:47:51 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (match_select): restore previous behavior of MatchData#select.
+ RDoc updated as well, mentioning the plan to remove this method
+ in the future. [ruby-dev:34556]
+
+Fri May 2 13:04:04 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dbm/dbm.c (Init_dbm): defines DBM::VERSION even when
+ DB_VERSION_STRING is not available. [ruby-dev:34569]
+
+Thu May 1 23:57:06 2008 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 16257 from trunk.
+
+ * lib/net/telnet.rb: This patch from Brian Candler adds a FailEOF mode which
+ can be activated to have net/telnet raise EOFError exceptions when the
+ remote connection is closed. The default behavior remains unchanged though.
+
+Thu May 1 23:43:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (range_step): check if step can be converted to an integer.
+ [ruby-dev:34558]
+
+ * range.c (range_step): allow float step bigger than zero but less
+ than one. [ruby-dev:34557]
+
+Wed Apr 30 20:22:40 2008 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 16241 from trunk.
+
+ * lib/net/telnet.rb: Fixing a bug where line endings would not be properly
+ escaped when the two character ending was broken up into separate TCP
+ packets. Issue reported and patched by Brian Candler.
+
+Wed Apr 30 17:47:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * re.c (rb_reg_search): use local variable. a patch from wanabe
+ <s.wanabe AT gmail.com> in [ruby-dev:34537]. [ruby-dev:34492]
+
+Sat Apr 26 19:40:34 2008 Guy Decoux <decoux@moulon.inra.fr>
+
+ * class.c (struct clone_method_data): Add cref.
+ (clone_method): Properly handle NODE_BMETHOD and NODE_DMETHOD.
+ (rb_singleton_class_clone, singleton_class_clone_int): Set a
+ proper value to klass and propagate cref. [ruby-core:16238]
+
+ * eval.c (rb_block_dup, rb_method_dup), intern.h: Add duplicator
+ methods for use from class.c#clone_method().
+
+Fri Apr 25 15:46:37 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/scrollbar.rb, ext/tk/lib/tk/scale.rb:
+ improve unknonw-option check when create a widget.
+
+ * ext/tk/lib/tkextlib/blt/unix_dnd.rb, ext/tk/lib/tkextlib/blt/ted.rb,
+ ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix on 'cget'.
+
+ * ext/tk/lib/tk/menuspec.rb: option check will fail when
+ TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ is true.
+
+ * ext/tk/lib/tk/palette.rb: bug fix.
+
+Fri Apr 25 12:37:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (flatten): returns an instance of same class.
+ [ruby-core:16554]
+
+Thu Apr 24 23:47:50 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/net/pop.rb: backported from 1.9. bug#19003
+
+ * ext/openssl/lib/openssl/ssl.rb: set_params; backported from 1.9.
+ bug#19552, [ruby-dev:34402]
+
+ * ext/openssl/ossl_ssl.c: ditto.
+
+ * test/openssl/test_ssl.rb: ditto.
+
+Thu Apr 24 17:06:34 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (THREAD_SAVE_CONTEXT): remove unnecessary
+ FLUSH_REGISTER_WINDOWS before calling setjmp(). [ruby-core:16285]
+
+Thu Apr 24 14:15:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (dln_find_1): prior files with extensions to files sans
+ extensions. [ruby-core:16517]
+
+Wed Apr 23 15:39:31 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (bind_eval): Add Binding#eval, a shorthand method for
+ eval(str, binding, ..); backported from 1.9.
+
+Wed Apr 23 15:28:52 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_no_create): failed
+ notice moved from comment to assertion message. [ruby-dev:29127]
+
+Wed Apr 23 14:00:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb (create_makefile): Add a missing dependency on the
+ target directory for each .rb file. This will hopefully fix
+ parallel make (-jN). Tested on FreeBSD.
+
+Wed Apr 23 11:49:54 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#each, SortedSet#each, TC_Set#test_each): Return
+ an enumerator if no block is given.
+
+Wed Apr 23 00:42:49 2008 Tanaka Akira <akr@fsij.org>
+
+ * eval.c (error_print): show full stack grace except SystemStackError.
+ backport from 1.9. [ruby-dev:31014]
+
+Wed Apr 23 00:18:45 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_symbol.rb (TestSymbol#test_to_proc): Improve
+ tests of Symbol#to_proc.
+
+Tue Apr 22 22:43:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_proc_new, YIELD_FUNC_LAMBDA): Add a new nd_state
+ YIELD_FUNC_LAMBDA which avoids automatic `avalue' conversion for
+ arguments. This fixes a bug where [1,[2,3]].map(&:object_id)
+ fails.
+
+ * intern.h, object.c: Hide rb_proc_new() from intern.h. It should
+ not be considered an official API function yet.
+
+Tue Apr 22 21:24:32 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_proc_new): Turn the BLOCK_LAMBDA flag on.
+
+ * object.c (sym_to_proc), test/ruby/test_symbol.rb: Add back
+ Symbol#to_proc, now that it passes the tests.
+
+Tue Apr 22 19:35:03 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_initialize): Remove an undocumented
+ feature (passing a block to the constructor) that's broken.
+ This is not what I intended.
+
+Tue Apr 22 17:49:46 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): should protect temporary string from
+ GC. [ruby-dev:34480]
+
+Tue Apr 22 17:12:05 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_search): string might be NULL. [ruby-core:16478]
+
+Tue Apr 22 16:44:00 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * object.c (rb_obj_tap): Correct documentation; pointed out by
+ okkez in [ruby-dev:34472].
+
+Tue Apr 22 10:05:51 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (eaccess): workaround for recent msvcrt's behavior.
+ [ruby-core:16460]
+
+Mon Apr 21 16:06:47 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enumerator.c (enumerator_init): preserve the method name in ID.
+
+ * enumerator.c (enumerator_each): need not to call rb_to_id().
+
+ * enumerator.c (enumerator_with_index): ditto.
+
+Mon Apr 21 17:19:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_f_method_name): New gloval function: __method__;
+ backported from matzruby / 1.9.
+
+ * eval.c (rb_frame_this_func), intern.h: New internal function.
+
+ * intern.h (RETURN_ENUMERATOR): Use rb_frame_this_func() instead
+ of rb_frame_last_func(), to accommodate the behavior to that of
+ 1.9.
+
+Mon Apr 21 15:54:48 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/tempfile.rb (Tempfile::_close): check @data before modifying
+ it; backported from 1.9. [ruby-dev:34094]
+
+ * lib/tempfile.rb (Tempfile::close): clear @data and @tmpname.
+
+Mon Apr 21 10:17:17 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * time.c: should include <errno.h> to refer errno.
+
+Mon Apr 21 10:02:43 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * hash.c (recursive_hash): prototype.
+
+Mon Apr 21 10:00:51 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * time.c (rb_strftime): check errno to detect strftime(3)'s error.
+ this is workaround for recent version of MSVCRT.
+ [ruby-dev:34456]
+
+Sun Apr 20 21:10:04 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview2.
+
+Sun Apr 20 21:02:06 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c: Resolve the method every time an enumeration
+ method is run, not once when the enumerator is initialized as it
+ was before, so that method_missing() and method (re)definition
+ afterwards are both in effect; pointed out in: [ruby-core:16441]
+
+Sun Apr 20 17:59:25 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * object.c, NEWS, test/ruby/test_symbol.rb: Revert Symbol#to_proc
+ since it does not pass the tests.
+
+Sun Apr 20 14:29:35 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/ossl_ssl.c: initialize session class.
+
+Sat Apr 19 20:54:42 2008 akira yamada <akira@arika.org>
+
+ * lib/uri/ftp.rb, lib/uri/generic.rb, test/uri/test_common.rb,
+ test/uri/test_ftp.rb, test/uri/test_generic.rb: backported from 1.9.
+ [ruby-dev:31318]
+
+Sat Apr 19 20:35:02 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/yaml/baseemitter.rb, lib/yaml/encoding.rb: performance
+ tuning around String#gsub.
+
+ * lib/yaml/tag.rb: Replace nodoc with stopdoc so Module methods get
+ documented.
+
+ * lib/yaml/store.rb (YAML::load): modified to support empty
+ database.
+
+ * lib/yaml/store.rb (YAML::Store::marshal_dump_supports_canonical_option?):
+ add a method to support faster PStore.
+
+Sat Apr 19 20:16:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/yaml/types.rb: Likewise, pass self to YAML::quick_emit;
+ merged from 1.9.
+
+ * lib/yaml.rb (quick_emit): use combination of object_id and hash to
+ identify repeated object references, since GC will reuse memory of
+ objects during output of YAML. [ruby-Bugs-8548] [ruby-Bugs-3698];
+ merged from 1.9.
+
+Sat Apr 19 20:05:39 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_equal, rb_ary_eql, rb_ary_hash, rb_ary_cmp):
+ Make Array#eql?, #hash, #== and #<=> use rb_exec_recursive() and
+ handle recursive data properly.
+
+ * hash.c (hash_equal, rb_hash_hash): Make Hash#eql?, #hash and #==
+ use rb_exec_recursive() and handle recursive data properly.
+
+Sat Apr 19 19:26:09 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h, eval.c (rb_exec_recursive): New internal function to
+ help perform recursive operation; backported from 1.9.
+
+Sat Apr 19 18:42:04 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h, hash.c (rb_hash_lookup): New internal function to
+ check if a key exists in a hash, ignoring #default; backported
+ from 1.9.
+
+Fri Apr 18 18:56:57 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/rubyext.c (syck_genericresolver_node_import): should
+ not set instance variable "@kind" before initializing it.
+ [ruby-dev:32677]
+
+ * ext/syck/rubyext.c (syck_resolver_initialize,
+ syck_resolver_detect_implicit, syck_emitter_emit): remove unused
+ variables.
+
+Fri Apr 18 18:54:57 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/rubyext.c: Node#value defined twice.
+
+ * lib/yaml/: several method redefinitions causing warnings.
+
+Fri Apr 18 16:36:16 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/rexml/node.rb (REXML::Node::indent): should initialize rv
+ variable. a patch from Tadayoshi Funaba <tadf AT dotrb.org> in
+ [ruby-dev:32783].
+
+Fri Apr 18 16:01:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/rexml: Merge fixes since 1.8.6 made solely on the ruby_1_8_6
+ branch.
+
+Wed Apr 16 06:11:49 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/ruby/test_settracefunc.rb (TestSetTraceFunc#test_event):
+ Fix tests to reflect the following changes: r15833, r15759.
+
+Wed Apr 16 05:03:48 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview1.
+
+Wed Apr 16 02:09:14 2008 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/xmlrpc/client.rb: fix cookie handling. [ruby-dev:34403]
+
+ * test/xmlrpc/test_cookie.rb: add a test for the above fix.
+
+Tue Apr 15 23:48:28 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * version.h: Branch off ruby_1_8_7 from ruby_1_8 in preparation
+ for the forthcoming 1.8.7 release.
+
+Tue Apr 15 23:40:39 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/rubyext.c (rb_syck_mktime): Avoid buffer overflow.
+
+Tue Apr 15 20:32:03 2008 Tanaka Akira <akr@fsij.org>
+
+ * re.c (match_inspect): backported from 1.9.
+
+Tue Apr 15 19:03:28 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * eval.c (method_receiver, method_name, method_owner): New
+ methods; backported from 1.9. bug#19007
+
+Tue Apr 15 18:39:14 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/uri.rb, lib/uri/ldaps.rb: added LDAPS
+ scheme; backported from 1.9. bug#19015, [ruby-dev:31896]
+
+Tue Apr 15 17:45:43 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/net/smtp.rb: backported from 1.9. bug#19003
+
+Tue Apr 15 17:06:12 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_symbol.rb (TestSymbol#test_to_proc): add tests.
+
+Tue Apr 15 16:58:55 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/menuspec.rb: option check will fail when
+ TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ is true.
+
+ * ext/tk/lib/tk/palette.rb: bug fix.
+
+Tue Apr 15 16:47:48 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * signal.c, gc.c: New methods: GC.stress, GC.stress=;
+ backported from 1.9. a patch from Tadashi Saito
+ in [ruby-dev:34394] and bug#19000
+
+Tue Apr 15 12:35:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * rubyio.h (rb_io_t): renamed from OpenFile.
+
+ * ruby.h (struct RHash), file.c, gc.c, io.c, ext/dl/dl.c,
+ ext/io/wait/wait.c, ext/pty/pty.c, ext/readline/readline.c,
+ ext/socket/socket.c: ditto.
+
+ * win32/win32.h: removed workaround for OpenFile.
+
+Tue Apr 15 00:15:29 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/text.rb: typo. call a wrong method.
+
+ * ext/tk/lib/tk/itemconfig.rb: ditto.
+
+ * ext/tk/sample/ttk_wrapper.rb: bug fix.
+
+ * ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/itemfont.rb, ext/tk/lib/font.rb:
+ support __IGNORE_UNKNOWN_CONFIGURE_OPTION__ about font options.
+
+ * ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,
+ ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
+ ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
+
+ * ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
+
+ * ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
+ procedure which called at end of the timer.
+
+Mon Apr 14 19:54:21 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_flatten, rb_ary_flatten_bang): Take an optional
+ argument that determines the level of recursion to flatten;
+ backported from 1.9.
+
+ * array.c (rb_ary_shuffle_bang, rb_ary_shuffle, rb_ary_choice,
+ rb_ary_cycle, rb_ary_permutation, rb_ary_combination,
+ rb_ary_product, rb_ary_take, rb_ary_take_while, rb_ary_drop,
+ rb_ary_drop_while): New methods: Array#shuffle, #shuffle!,
+ #choice, #cycle, #permutation, #combination, #product, #take,
+ #take_while, #drop, #drop_while; backported from 1.9.
+
+Mon Apr 14 19:52:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.h: New macro: RB_GC_GUARD().
+
+Mon Apr 14 19:49:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * random.c (rb_genrand_int32, rb_genrand_real), intern.h: Export.
+
+ * string.c (rb_str_tmp_new), intern.h: New function.
+
+Mon Apr 14 19:18:55 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (inject_i, inject_op_i): prototype.
+
+Mon Apr 14 19:10:47 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c New methods: Enumerable#take, #take_while, #drop and
+ #drop_while; backported from 1.9.
+
+Mon Apr 14 18:50:15 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c: New methods: Enumerable#one?, #none?, #minmax, #min_by,
+ #max_by, #minmax_by and #cycle; backported from 1.9.
+
+ * enum.c (enum_find_index): Add support for find_index(obj);
+ [ruby-dev:34313]; backported from 1.9.
+
+ * enum.c (enum_inject): Add support for Enumerable#inject(:binop);
+ backported from 1.9.
+
+ * enum.c: Alias Enumerable#reject to #inject; backported from 1.9.
+
+Mon Apr 14 18:14:19 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_find, enum_reject): Return an enumerator if no
+ block is given; backported from 1.9.
+
+ * io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach,
+ argf_each_line, argf_each_byte): Ditto.
+
+ * string.c (str_gsub): Ditto.
+
+Mon Apr 14 18:10:05 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (find_index_i, find_index_iter_i): add prototype for VC.
+
+Mon Apr 14 17:55:30 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_collect_bang, rb_ary_select): Return an
+ enumerator if no block is given; backported from 1.9.
+
+ * dir.c (dir_each, dir_foreach): Ditto.
+
+ * enum.c (enum_partition, enum_sort_by): Ditto.
+
+ * gc.c (os_each_obj): Ditto.
+
+ * hash.c (rb_hash_delete_if, rb_hash_reject_bang, rb_hash_select,
+ rb_hash_each_value, rb_hash_each_key, rb_hash_each_pair,
+ env_each_key, env_each_value, env_each, env_each_pair,
+ env_reject_bang, env_delete_if, env_select): Ditto.
+
+ * numeric.c (num_step, int_upto, int_downto, int_dotimes): Ditto.
+
+Mon Apr 14 16:42:53 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.h (rb_block_call_func): Fix prototype.
+
+ * enumerator.c (enumerator_iter_i, enumerator_each_i): Ditto.
+
+Mon Apr 14 15:49:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_count, enum_find_index): New methods:
+ Enumerable#count and #find_index; backported from 1.9.
+
+Mon Apr 14 14:16:08 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enumerator.c (enumerator_mark, enumerator_iter_i, enumerator_each_i,
+ enumerator_allocate): add prototype.
+
+ * enumerator.c (enumerator_each_i): declare unused two arguments.
+
+Mon Apr 14 13:58:32 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_each_char): New methods: String#chars and
+ #each_char; backported from 1.9.
+
+Mon Apr 14 13:42:20 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_each_line, rb_str_each_byte): Reflect
+ enumerator integration. #lines and #bytes are now aliases to
+ #each_line and #each_byte, respectively.
+
+Mon Apr 14 13:19:36 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * range.c (range_each, range_step): Return an enumerator if no
+ block is given; backported from 1.9.
+
+ * struct.c (rb_struct_each, rb_struct_each_pair): Ditto.
+
+Mon Apr 14 13:07:59 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_partition, rb_str_rpartition,
+ rb_str_start_with, rb_str_end_with): New methods:
+ String#partition, #rpartition, #start_with? and #end_with?;
+ backported from 1.9. These methods are $KCODE aware unlike
+ #index, #rindex and #include?.
+
+Sun Apr 13 15:55:52 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * object.c (sym_to_proc): new method Symbol#to_proc; backported
+ from 1.9. bug#19012
+
+Fri Apr 11 19:14:30 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * object.c (rb_obj_tap): new method Object#tap; backported from
+ 1.9. bug#19008
+
+Fri Apr 11 18:58:09 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * process.c: new method Process.exec; backported from 1.9. bug#19006
+
+Fri Apr 11 12:43:56 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
+ ext/tk/sample/tkextlib/tile/demo.rb: previous patch is not complete.
+
+Fri Apr 11 10:22:54 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tile.rb:
+ __define_LoadImages_proc_for_compatibility__! do nothing when the
+ Tcl command exists.
+
+ * ext/tk/lib/tkextlib/tile/style.rb:
+ __define_wrapper_proc_for_compatibility__! do nothing when the Tcl
+ command exists.
+
+ * ext/tk/sample/tkextlib/tile/demo.rb: don't create 'step' theme if
+ it already exists.
+
+Fri Apr 11 08:05:12 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): add volatile to avoid potential GC bug. a
+ patch from Tomoyuki Chikanaga <chikanag at nippon-control-system.co.jp>
+ in [ruby-dev:34311].
+
+Thu Apr 10 20:29:13 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/rdebug.el, misc/README: Remove rdebug.el as per request
+ from the maintainer and mention the ruby-debug project at
+ RubyForge in README; bug#19043.
+
+Thu Apr 10 20:08:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_first, enum_group_by): New methods:
+ Enumerable#first and #group_by; backported from 1.9.
+
+Thu Apr 10 19:49:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (rb_eStopIteration), eval.c (rb_f_loop), ruby.h:
+ Add a new exception class StopIteration, which breaks Kernel#loop
+ iteration when raised; backported from 1.9.
+
+ * enumerator.c (enumerator_next, enumerator_rewind): Implement
+ #next and #rewind using the "generator" library.
+
+ * lib/generator.rb: Implement Enumerable::Enumerator#next and
+ #rewind.
+
+Thu Apr 10 19:29:48 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_first, rb_ary_last): Return a shared array when
+ possible.
+
+ * array.c (rb_ary_pop, rb_ary_pop_m, rb_ary_shift, rb_ary_shift_m):
+ Array#pop and Array#shift can take an optional argument
+ specifying the number of elements to remove and return;
+ backported from 1.9.
+
+Thu Apr 10 14:00:44 2008 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb (Resolv::DNS#each_address): backport from 1.9 for
+ CNAME. [ruby-dev:34200]
+
+Thu Apr 10 01:42:25 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (iterate_method): add prototype to avoid warning on VC++.
+
+Wed Apr 9 23:12:41 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
+
+ * ext/tk/tcltklib.c: avoid error on a shared object.
+
+ * ext/tk/extconf.rb: support --with-tcltkversion
+
+ * ext/tk/README.tcltklib: add document about --with-tcltkversion
+
+ * ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget,
+ ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb,
+ ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb:
+ bug fix.
+
+Wed Apr 9 21:54:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_pop): Do not reallocate too often; backported
+ from 1.9.
+
+Wed Apr 9 21:13:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_each, rb_ary_each_index, rb_ary_reverse_each,
+ rb_ary_reject, rb_ary_reject_bang): Array#each, #each_index,
+ #reverse_each, #reject, #reject! and #delete_if return an
+ enumerator if no block is given; backported from 1.9.
+
+Wed Apr 9 20:47:16 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_index, rb_ary_index): Array#index and #rindex
+ can take a block instead of an argument; backported from 1.9.
+
+Wed Apr 9 19:58:31 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c, inits.c (rb_call_inits), ruby.h, intern.h,
+ ext/enumerator, common.mk (OBJS, enumerator.$(OBJEXT)): Make the
+ enumerator module built-in.
+
+ * enumerator.c: New method: Enumerable::Enumerator#with_index.
+
+ * enum.c (enum_each_with_index): Enumerable#each_with_index now
+ returns an enumerator instead of raising an exception if no
+ block is given. Enumerable#enum_with_index, formerly defined in
+ the enumerator module, is kept as an alias to each_with_index
+ for backward compatibility.
+
+Wed Apr 9 19:43:51 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_obj_method, rb_proc_call), intern.h: Export.
+
+Tue Apr 8 11:11:28 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (EXEC_TAG): remove unnecessary FLUSH_REGISTER_WINDOWS for
+ better performance on SPARC. [ruby-core:16159]
+
+Tue Apr 8 10:49:54 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_quote): should always copy the quoting string.
+ [ruby-core:16235]
+
+Mon Apr 7 21:35:08 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_nitems): Backport Array#nitems with a block;
+ suggested by Bertram Scharpf <lists@bertram-scharpf.de> in
+ [ruby-talk:134083].
+
+Sun Apr 6 09:45:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_tell): check if closed. [ruby-core:16223]
+
+Sat Apr 5 10:05:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_check_to_integer): backported for range_step.
+
+Fri Apr 4 05:57:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/net/pop.rb (Net::POP3::do_finish): clear @n_mails and
+ @n_bytes as well. [ruby-core:16144]
+
+Fri Apr 4 02:17:06 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): should not round step into integer if
+ begin and end are numeric. [ruby-core:15990]
+
+Tue Apr 1 14:43:38 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: get rid of empty expansion.
+
+ * {bcc,win}32/Makefile (config.h): need to define RUBY_SETJMP, etc.
+
+Tue Apr 1 11:36:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: _setjmp is available but _longjmp is not on mingw.
+
+Tue Apr 1 03:20:40 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_SETJMP, RUBY_LONGJMP, RUBY_JMP_BUF): prefers
+ _setjmp over setjmp and sigsetjmp. [ruby-core:16023]
+ __builtin_setjmp cannot handle a variable.
+
+ * configure.in (--with-setjmp-type): new option to override the
+ default rule in the above.
+
+ * eval_intern.h (ruby_setjmp, ruby_longjmp), gc.c (rb_setjmp),
+ vm_core.h (rb_jmpbuf_t): use RUBY_SETJMP, RUBY_LONGJMP and
+ RUBY_JMP_BUF.
+
+Tue Apr 1 01:55:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/resolv.rb (Resolv::Config.default_config_hash): requires
+ win32/resolv to use Win32::Resolv. [ruby-dev:34138]
+
+Mon Mar 31 14:51:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_div): Bignum#div should return integer for
+ floating number operand.
+
+Sun Mar 30 07:00:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/tcltklib.c: rb_hash_lookup has not been backported yet.
+
+Sat Mar 29 14:18:41 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
+
+ * ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
+ instate/state/identify method to avoid the conflict with standard
+ widget options. Those methods are renamed to ttk_instate/ttk_state/
+ ttk_identify (tile_instate/tile_state/tile_identify are available
+ too). Although I don't recommend, if you realy need old methods,
+ please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
+ "require 'tkextlib/tile'".
+
+ * ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
+ is obsolete. It outputs warning. To control default widget set,
+ use "Tk.default_widget_set = :Ttk".
+
+ * ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
+ __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
+ as module methods of TkConfigMethod. It may help users to wrap old
+ Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
+ Ttk widgets don't have some options of standard widgets which are
+ control the view of widgets. When set ignore-mode true, configure
+ method tries to ignoure such unknown options with no exception.
+ Of course, it may raise other troubles on the GUI design.
+ So, those are a little danger methods.
+
+ * ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
+ are defind as module methods of TkItemConfigMethod as the same
+ purpose as TkConfigMethod's ones.
+
+ * ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
+ wrapping old Ruby/Tk scripts (which use standard widgets) to use
+ Ttk (Tile) widgets as default.
+
+ * ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
+ method instead of instate/state method.
+
+ * ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
+ ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
+ are replaced to "instance_exec(self)".
+
+ * ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
+ a character code on Ruby1.9).
+
+ * ext/tk/lib/tk/variable.rb: support new style of operation argument
+ on Tcl/Tk's 'trace' command for variables.
+
+ * ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
+
+ * ext/tk/sammple/demos-jp/textpeer.rb,
+ ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
+
+ * ext/tk/tcltklib.c: decrase SEGV troubles (probably)
+
+ * ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
+
+ * ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
+
+ * ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
+ to make Tcl/Tk theme sources (based on different version of Tile
+ extension) available.
+ (Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
+ (Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
+ as toplevel widgets.
+
+ * ext/tk/lib/tkextlib/tile/style.rb: ditto.
+ (Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
+
+ * ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
+ properties as a hash. metrics_hash method returns a boolean value
+ for 'fixed' option. But metrics method returns numeric value
+ (0 or 1) for 'fixed' option, because of backward compatibility.
+
+ * ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
+
+ * ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
+ doesn't block the eventloop. It will be better to use the method
+ in event callbacks.
+
+ * ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
+
+Sat Mar 29 04:08:59 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (clone_method): should copy cref as well.
+ [ruby-core:15833]
+
+Mon Mar 24 20:07:42 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_eval): Call trace hook for if expression after the
+ condition has been evaluated, not before; submitted by Rocky
+ Bernstein in #18722.
+
+Mon Mar 24 19:44:53 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * parse.y (yycompile): Always prepare a new array for each file's
+ SCRIPT_LINES__ storage, instead of appending source lines every
+ time a file is re-loaded; submitted by Rocky Bernstein in
+ #18517.
+
+Mon Mar 24 10:25:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: sitearch should use target_cpu. [ruby-core:15986]
+
+Mon Mar 24 01:24:24 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (result): use proc instead of Thread. [ruby-dev:33692]
+
+Fri Mar 21 21:26:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/resolv.rb (Resolv::Hosts): should not use win32/resolv on cygwin.
+ [ruby-dev:29945], [ruby-dev:34095]
+
+ * lib/win32/registry.rb (Win32::Registry.expand_environ): try upcased
+ name too for cygwin. [ruby-dev:29945]
+
+ * lib/win32/resolv.rb (Win32::Resolv.get_hosts_path): use expand_path.
+
+Fri Mar 21 21:10:00 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb: Say that I am the current maintainer.
+
+ * lib/set.rb: Ditto.
+
+ * lib/shellwords.rb: Ditto.
+
+ * ext/syslog/syslog.txt: Ditto.
+
+Fri Mar 21 09:24:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb (open_for_install): write block result and rewrite only
+ if changed from existing file.
+
+Wed Mar 19 21:01:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_inspect, dir_path, dir_tell): check for frozen and closed
+ is not needed. [ruby-dev:32640]
+
+Wed Mar 19 20:25:40 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (Init_Dir): define inspect method. [ruby-core:15960]
+
+Wed Mar 19 14:59:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el (ruby-style-{case,label}-indent): fix for labels
+ inside blocks in switch and function top level.
+
+Wed Mar 19 14:36:40 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_cstr_to_inum): treat successive underscores as
+ nondigit. [ruby-dev:34089]
+
+Wed Mar 19 00:01:23 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (ERB::Compiler): Make some minor code optimization.
+
+Mon Mar 17 17:11:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-mode): should use `run-mode-hooks' instead
+ of calling `run-hooks' directly to run the mode hook. patch from
+ Chiyuan Zhang <pluskid AT gmail.com> in [ruby-core:15915]
+
+Mon Mar 17 16:41:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: unset GREP_OPTIONS. [ruby-core:15918]
+
+Fri Mar 14 16:59:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_LIB_PREFIX): fix for prefix.
+
+Fri Mar 14 16:35:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::Cookie::initialize): performance patch from
+ Makoto Kuwata <kwa@kuwata-lab.com> in [ruby-dev:34048].
+
+Fri Mar 14 15:49:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_LIB_PREFIX): use libdir.
+
+Fri Mar 14 10:12:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_CHECK_VARTYPE): should not indent preprocessor
+ directives.
+
+Thu Mar 13 00:37:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_call0): yields the last executed node line number at
+ return event. [ruby-core:15855]
+
+Wed Mar 12 02:12:20 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/delegate.rb: check $@ to avoid NoMethodError.
+
+Tue Mar 11 19:48:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (fix_coerce): try conversion before type check.
+ [ruby-core:15838]
+
+Tue Mar 11 17:03:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/delegate.rb (Delegator#initialize, DelegateClass): skip correct
+ backtrace. [ruby-dev:34019]
+
+Tue Mar 11 16:43:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_cmdvector): terminate shrunken command line.
+
+Tue Mar 11 12:39:03 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (clean-local): removes MINOBJS.
+
+Sat Mar 8 18:50:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (isdirsep): backslash is valid path separator on cygwin too.
+
+Fri Mar 7 19:56:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: rdoc added. [ruby-Patches-9762]
+
+Thu Mar 6 15:10:21 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {bcc32,win32}/Makefile.sub (RUNRUBY): use $(PROGRAM) instead of
+ ruby$(EXEEXT).
+ suggested by KIMURA Koichi <kimura.koichi at canon.co.jp>.
+ [ruby-dev:34000]
+
+Thu Mar 6 12:15:06 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (opt_block_param): command can start just after block param
+ definition. [ruby-list:44479]
+
+Thu Mar 6 00:34:11 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb: update RDoc. Thanks Makoto Kuwata [ruby-dev:33702]
+
+Mon Mar 3 23:28:34 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpservlet/filehandler.rb: should normalize path
+ separators in path_info to prevent directory traversal attacks
+ on DOSISH platforms.
+ reported by Digital Security Research Group [DSECRG-08-026].
+
+ * lib/webrick/httpservlet/filehandler.rb: pathnames which have
+ not to be published should be checked case-insensitively.
+
+Mon Mar 3 16:14:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_any_hash): shrinks all results in Fixnum range.
+ [ruby-core:15713]
+
+Sat Mar 1 02:35:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (big2str_find_n1): check integer overflow.
+
+Tue Feb 26 16:06:00 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/ossl_pkey_{ec,dh,dsa,rsa}.c: Remove useless warnings.
+
+ * ext/openssl/ossl_asn1.c: Simplify code.
+
+ * ext/openssl/ossl_ssl_session.c Fix compiler warnings.
+ Undefine #id if SSL_SESSION_get_id is not supported.
+
+Tue Feb 26 15:43:42 2008 Tanaka Akira <akr@fsij.org>
+
+ * parse.y (tokadd_escape): refactored. [ruby-core:15657]
+
+Mon Feb 25 17:30:29 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/digest.c ext/openssl/lib/openssl/digest.rb:
+ Commit patch #9280 from Akinori MUSHA.
+ Simplify the OpenSSL::Digest class and make use of the
+ existing Digest framework.
+ Enhance performance.
+
+Mon Feb 25 13:40:03 2008 Tanaka Akira <akr@fsij.org>
+
+ * process.c (Init_process): share bignum objects for RLIM_INFINITY,
+ RLIM_SAVED_MAX and RLIM_SAVED_CUR if they are equal.
+
+Sun Feb 24 23:29:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk, {bcc,win}32/Makefile.sub (clean-local): remove
+ intermediate files.
+
+Sun Feb 24 03:52:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (valid_filename): use O_EXCL to get rid of clobbering
+ existing files in race conditions.
+
+Fri Feb 22 19:50:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454]
+
+Fri Feb 22 16:09:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_lshift, rb_big_rshift, rb_big_aref): removed excess
+ arguments.
+
+Thu Feb 21 00:01:34 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RPATHFLAG): -R option of HP-UX ld is not for runtime
+ load path. [ruby-list:44600]
+
+Wed Feb 20 23:55:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_map_errno): exported.
+
+Wed Feb 20 13:08:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb (parse_args): added --dir-mode, --script-mode and
+ --cmd-type options. [ruby-dev:33816]
+
+ * instruby.rb (parse_args): added bin-arch and bin-comm to install
+ type, for compiled files and script files.
+
+ * instruby.rb (parse_args): deal with make style command line macros,
+ and count as long syle options if prefixed with INSTALL_.
+
+ * instruby.rb (makedirs): use $dir_mode. [ruby-dev:33805]
+
+ * instruby.rb (open_for_install): set file mode, which is now
+ permission mode instead of access mode.
+
+ * instruby.rb (bin-comm): installs scripts with replacing shebang
+ lines.
+
+Tue Feb 19 18:34:32 2008 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (STACK_LENGTH) [SPARC] : 0x80 offset removed. [ruby-dev:33857]
+
+Tue Feb 19 14:27:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_event): prevent polling. based on
+ a patch from error errorsson in [ruby-Bugs-17675].
+
+Tue Feb 19 12:08:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yycompile): clear ruby_eval_tree_begin if parse failed.
+
+Mon Feb 18 16:23:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yycompile): clear ruby_eval_tree_begin too before parse.
+
+Mon Feb 18 10:17:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/lib/expect.rb (IO#expect): check if peer is closed.
+ [ruby-Bugs-17940]
+
+Fri Feb 15 20:37:06 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/rational.rb (floor, ceil, truncate, round): do not use
+ definitions of Numeric.
+
+ * lib/rational.rb (to_i): should returns truncated self.
+
+ * lib/complex.rb (numerator): requires
+ Integer#{numerator,denominator}.
+
+ * lib/complex.rb (quo): do not use definition of Numeric.
+
+ * lib/complex.rb (div, divmod, floor, ceil, truncate, round):
+ undef'ed.
+
+Fri Feb 15 15:23:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_convert): check upper bound. a patch from
+ Daniel Luz at [ruby-Bugs-17910].
+
+Fri Feb 15 02:42:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ftruncate): check if available.
+
+ * file.c (rb_file_truncate): check if ftruncate instead of truncate.
+
+Fri Feb 15 02:40:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (sigsetmask): check when signal semantics is not POSIX.
+
+ * signal.c (USE_TRAP_MASK): set true if sigprocmask or sigsetmask is
+ available.
+
+Thu Feb 14 17:44:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dl/ptr.c (dlmem_each_i): typo fixed. a patch from IKOMA
+ Yoshiki <ikoma AT mb.i-chubu.ne.jp> in [ruby-dev:33776].
+
+Thu Feb 14 16:02:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_utime): inhibits with secure level 2 or higher.
+
+Thu Feb 14 01:43:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/timeout.rb (Timeout::timeout): made sensitive to location on the
+ stack. [ruby-core:15458]
+
+Thu Feb 14 00:49:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (INSTRUBY_ARGS): pass mode to install. [ruby-dev:33766]
+
+ * instruby.rb (parse_args): added --data-mode and --prog-mode options.
+
+Tue Feb 12 11:33:26 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/erb/test_erb.rb(TestERBCore): import from erb-2.0.4.
+
+ * test/erb/hello.erb: ditto
+
+Mon Feb 11 17:25:21 2008 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb (RSS::VERSION), test/rss/test_version.rb, NEWS:
+ 0.2.3 -> 0.2.4.
+
+ * lib/rss/maker.rb, lib/rss/maker/, test/rss/test_maker_2.0.rb:
+ fixed a bug that RSS::Maker.make("0.9")'s item doesn't make some
+ elements if description is missed.
+ Reported by Michael Auzenne. Thanks!!!
+
+ * lib/rss/maker/0.9.rb, test/rss/test_maker_0.9.rb:
+ RSS::Maker.make("0.9") generates RSS 0.92 not RSS 0.91.
+
+Mon Feb 11 16:57:00 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ChangeLog: format-time-string under C locale. [ruby-dev:33261]
+
+Mon Feb 11 16:31:47 2008 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
+
+ * gc.c (rb_newobj): prohibit call of rb_newobj() during gc.
+ Submitted by Sylvain Joyeux [ruby-core:12099].
+
+ * ext/dl/ptr.c: do not use LONG2NUM() inside dlptr_free().
+ Slightly modified fix bassed on a patch by Sylvain Joyeux
+ [ruby-core:12099] [ ruby-bugs-11859 ] [ ruby-bugs-11882 ]
+ [ ruby-patches-13151 ].
+
+Mon Feb 11 00:22:55 2008 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/benchmark.rb (Job::Benchmark#item): fix typo.
+
+Sat Feb 9 23:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/extconf.rb: simplified the condition.
+
+Sat Feb 9 17:51:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use strtod() for more
+ precision. [ruby-talk:290296]
+
+ * ext/bigdecimal/bigdecimal.c (BASE_FIG): made constant.
+
+ * ext/bigdecimal/extconf.rb: ditto. [ruby-dev:33658]
+
+Sat Feb 9 00:44:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than
+ SystemExit and SignalException. [ruby-core:15359]
+
+Fri Feb 8 15:09:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (xsystem): expand macros like as make.
+
+Tue Feb 5 11:14:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (INSTALL_DIRS, install_dirs): added BINDIR.
+
+ * lib/mkmf.rb (install_files): rejects files matching to
+ $NONINSTALLFILES.
+
+ * lib/mkmf.rb (init_mkmf): defaults $NONINSTALLFILES to backup and
+ temporary filse.
+
+Mon Feb 4 16:44:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): NSIG is not defined if _XOPEN_SOURCE > 500L.
+ [ruby-dev:33584]
+
+Sat Feb 2 20:06:42 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime
+ a bit faster. a patch from Alexander Dymo <dymo AT ukrpost.ua> in
+ [ruby-core:15337].
+
+Sat Feb 2 09:53:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): disabled fat-binary support which confuses
+ configure much, since ``universal'' implies hidden cross-compiling.
+ TODO: ruby and libruby.bundle might be possible to bound with `lipo'
+ after builds for each archs. Anyway, config.h and rbconfig.rb must
+ be separated definitely at least.
+
+Fri Feb 1 21:42:37 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): _XOPEN_SOURCE is necessary to make ucontext_t
+ consistent with the library implementation of MacOS X 10.5.
+ [ruby-dev:33461]
+
+ * configure.in (darwin): ucontext on PowerPC MacOS X 10.5 is broken.
+
+Thu Jan 31 08:31:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (ext/extmk.rb, instruby.rb): inlined $(MAKE) so that can
+ be executed even with -n.
+
+Thu Jan 31 07:00:19 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (bin_for_find): should find a symbol by
+ Symbol class.
+
+ * test/rinda/test_rinda.rb (test_symbol_tuple): ditto.
+
+Wed Jan 30 22:07:58 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: refined deprecated methods.
+
+Wed Jan 30 22:06:54 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * bignum.c (rb_cstr_to_inum): '0_2' is a valid representation.
+
+Tue Jan 29 22:40:12 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * range.c (step_i): rb_funcall receives VALUE as an argument.
+
+Tue Jan 29 11:53:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: rm largefile.h.
+
+Mon Jan 28 01:21:15 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_open_file): should check NUL in path.
+ <http://www.rubyist.net/~matz/20080125.html#c01>.
+
+ * io.c (rb_io_s_popen): ditto.
+
+ * io.c (rb_io_reopen): ditto.
+
+ * io.c (next_argv): ditto.
+
+ * io.c (rb_io_s_foreach): ditto.
+
+ * io.c (rb_io_s_readlines): ditto.
+
+ * io.c (rb_io_s_read): ditto.
+
+Fri Jan 25 22:33:38 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * math.c: fix comment. [ruby-dev:33276]
+
+Fri Jan 25 10:31:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * */*.bat: set svn:mime-type to text/batch.
+
+Thu Jan 24 19:36:22 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic::inspect): use Kernel#to_s instead
+ object_id with printf. [ruby-dev:33347]
+
+Tue Jan 22 11:22:47 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/setup.mak ($(ARCH)): if a macro is appended by $(APPEND),
+ a space will be inserted on the top of the line.
+
+ * win32/Makefile.sub (MKFILES): stop make process if Makefile is
+ updated.
+
+Mon Jan 21 17:34:41 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (rb_io_mode_flags, rb_io_mode_modenum): Ignore encoding
+ options for forward compatibility.
+
+Mon Jan 21 12:50:02 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c, gc.c (setjmp): sigsetjmp is a macro on cygwin.
+
+Sat Jan 19 11:21:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (sigsetjmp): check if available.
+
+ * eval.c, gc.c (setjmp): do not use _setjmp if sigsetjmp is available.
+
+Sat Jan 19 11:10:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: Remove wrong assumptions about Cygwin. a patch from
+ Corinna Vinschen in [ruby-Bugs-17018].
+
+Thu Jan 17 21:06:01 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (Date::Infinity#<=>): didn't work. A patch from
+ Dirkjan Bussink <d.bussink AT gmail.com> [ruby-core:15098].
+ This is a bug obviously. However it didn't affect the library's
+ functions.
+
+ * lib/date.rb, lib/date/format.rb: some trivial changes.
+
+Tue Jan 15 15:09:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/setup.mak: strip out empty lines from CPP output.
+
+Tue Jan 15 03:41:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (eval): check if backtrace is empty. [ruby-core:15040]
+
+Tue Jan 15 01:28:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk: simplified dummy objects dependencies.
+
+Mon Jan 14 16:12:58 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/shellwords.rb: scape should be an alias to shellescape. a
+ patch from Masahiro Kawato <m-kawato AT mwb.biglobe.ne.jp> in
+ [ruby-dev:33060].
+
+Mon Jan 14 09:32:40 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/time.rb: do not reference Time directly from the inside of
+ definitions. [ruby-dev:33059]
+
+Sat Jan 12 18:27:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_define_alloc_func, rb_undef_alloc_func): should
+ define/undef on a signleton class. [ruby-core:09959]
+
+Sat Jan 12 12:04:14 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: tuning for performance.
+
+Fri Jan 11 12:35:56 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: moved broken syscall checks from process.c etc.
+
+ * defines.h (WORDS_BIGENDIAN): honor __BIG_ENDIAN__ than the result of
+ configure.
+
+ * dln.c: use dlopen on Mac OS X 10.3 or later. backport from trunk.
+
+ * lib/rdoc/options.rb (check_diagram): more precise check, darwin
+ is not Windows but minwg is on it.
+
+Thu Jan 10 10:53:50 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_open_osfhandle): reverted to old definition.
+ [ ruby-Bugs-16948 ]
+
+Tue Jan 8 20:02:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win{32,ce}/Makefile.sub: merged.
+
+Sun Jan 6 09:39:02 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: introduced some constants
+ (for internal use).
+
+ * sample/cal.rb: trivial adjustments.
+
+Fri Jan 4 23:08:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (time_arg): use converted object. [ruby-core:14759]
+
+Fri Jan 4 01:20:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32.h: only VC6 needs extern "C++" for math.h. [ruby-talk:285660]
+
+Thu Jan 3 11:28:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (fptr_finalize): clear errno first. [ruby-talk:284492]
+
+Wed Jan 2 10:18:56 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/time.rb: use Process.times instead of Time.times.
+
+Wed Jan 2 09:18:11 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/goodfriday.rb: examples for date are enough. retired.
+
+Wed Jan 2 09:06:55 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/cal.rb: just updated with the newest version.
+
+Mon Dec 31 06:50:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * trunk/common.mk: not use -I$(srcdir)/lib with $(MINIRUBY) for cross
+ compiling.
+
+ * configure.in, {win,bcc}32/Makefile.sub (MINIRUBY): -I$(srcdir)/lib
+ moved.
+
+Sun Dec 30 22:48:37 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (_valid_time?): I'm not sure to recommend such an
+ expression. but anyway it is acceptable now. [ruby-core:14580]
+
+Fri Dec 28 16:36:33 2007 NARUSE, Yui <naruse@airemix.com>
+
+ * lib/resolv.rb (Resolv::DNS#each_address): now returns IPv6 address.
+
+Fri Dec 28 13:21:32 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb, test/rss/test_version.rb, NEWS: 0.2.2 -> 0.2.3.
+
+ * lib/rss/parser.rb, test/rss/test_parser.rb: supported "-" in tag name.
+ Reported by Ray Chen. Thanks.
+
+Thu Dec 27 23:56:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * mkconfig.rb: should not use the libraries under the source directory
+ at cross compiling.
+
+Thu Dec 27 11:02:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * intern.h, string.c (rb_str_set_len): added for upgrading path from
+ 1.8 to 1.9. [ruby-dev:32807]
+
+ * string.c (rb_str_lines, rb_str_bytes): ditto.
+
+Thu Dec 27 10:47:32 2007 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/ossl_ssl.c: Only show a warning if the default
+ DH callback is actually used.
+
+ * ext/openssl/ossl_rand.c: New method: random_add().
+
+Wed Dec 26 22:27:45 2007 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/resolv.rb (Resolv::DNS::Name.==): fix for other is array of
+ Resolv::DNS::Label::Str.
+
+ * lib/resolv.rb (Resolv::DNS::MessageEncoder#put_label): String#string
+ is not defined, so replace to_s.
+
+ * lib/resolv.rb (Resolv::IPv6#to_name): ip6.int is obsoleted by
+ int.arpa.
+
+Mon Dec 24 16:18:57 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ri/ri_options.rb: Fix ri --help listing of gem ri paths.
+ Merge of r14567 and r14569 from trunk.
+
+ * lib/rdoc/ri/ri_paths.rb: Fix duplication of ri data for multiple
+ gems. Merge of r14567 from trunk
+
+Mon Dec 24 12:35:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win{32,ce}/Makefile.sub (MFLAGS): defaulted to -l.
+
+Mon Dec 24 11:56:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * {bcc32,win{32,ce}}/Makefile.sub (SET_MAKE): set MFLAGS which is not
+ set by default, to get rid of chaotic situation of MFLAGS/MAKEFLAGS.
+
+Sat Dec 22 14:49:46 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: don't freeze nil even if 1.8 will not be aware of
+ the issue. [ruby-dev:32677]
+
+Wed Dec 19 13:57:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (TIMEZONE_VOID): check whether timezone requires zero
+ arguments. [ruby-dev:32631]
+
+Wed Dec 19 12:01:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (f_rest_arg): check if duplicated. [ruby-core:14140]
+
+Wed Dec 19 10:52:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_cstr_to_inum): an underscore succeeding after octal
+ prefix is allowed. [ruby-core:14139]
+
+Mon Dec 17 13:43:15 2007 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (stack_end_address): use local variable address instead of
+ __builtin_frame_address(0) to avoid SEGV on SunOS 5.11 on x86 with
+ gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802).
+ stack_end_address returned a frame address of garbage_collect
+ since stack_end_address doesn't create its own frame.
+ So a VALUE stored in a callee saved register, %edi, pushed into
+ the stack at the beginning of garbage_collect was not marked.
+
+Mon Dec 17 12:21:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (RUNRUBY): added RUNRUBYOPT.
+
+Fri Dec 14 12:36:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_CHECK_VARTYPE): check if a variable is defined
+ and its type.
+
+ * configure.in (timezone, altzone): check for recent cygwin.
+
+ * missing/strftime.c (strftime): fix for timezone. [ruby-dev:32536]
+
+ * lib/mkmf.rb (try_var): should fail for functions.
+
+ * ext/readline/extconf.rb: should use have_func for functions instead
+ of have_var.
+
+Tue Dec 11 00:04:05 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): If an invalid negative index (<
+ -size) is given, do not raise an exception but return nil just
+ like slice() does.
+
+ * test/ruby/test_array.rb (TestArray::test_slice,
+ TestArray::test_slice!): Pull in test cases from trunk.
+
+Mon Dec 10 21:47:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (str_transcode): allow non-registered encodings.
+ [ruby-dev:32520]
+
+Mon Dec 10 21:00:30 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_slice_bang): should return nil if position out
+ of range. a patch from Akinori MUSHA <knu AT iDaemons.org>.
+ [ruby-dev:32518]
+
+Mon Dec 10 18:28:06 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::REGEXP::PATTERN): typo in REG_NAME
+ regular expression. a patch from Ueda Satoshi
+ <s-ueda AT livedoor.jp>. [ruby-dev:32514]
+
+Sun Dec 9 12:39:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/cgi.rb (read_multipart): exclude blanks from header values.
+ [ruby-list:44327]
+
+Wed Dec 5 23:38:50 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (range_each): followed step_i change.
+
+Wed Dec 5 18:08:45 2007 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (int_odd_p): new method Integer#odd?.
+ (int_even_p): new method Integer#even?.
+ (int_pred): new method Integer#pred.
+ (fix_odd_p): new method Fixnum#odd?.
+ (fix_even_p): new method Fixnum#even?.
+
+Wed Dec 5 15:15:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (step_i, range_step): support non-fixnum steps.
+ [ruby-talk:282100]
+
+Tue Dec 4 11:23:50 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_cstr_to_inum): trailing spaces may exist at sqeezing
+ preceeding 0s. [ruby-core:13873]
+
+Sun Dec 2 22:43:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (error_print): put newline unless multiple line message ends
+ with a newline. [ruby-dev:32429]
+
+Sun Dec 2 15:49:20 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb, test/rss/test_version.rb, NEWS: 0.2.1 -> 0.2.2.
+
+ * lib/rss/maker/itunes.rb: fixed new_itunes_category.
+ * lib/rss/maker/taxonomy.rb: new_taxo_topic -> new_topic because
+ of consistency.
+
+ * test/rss/test_maker_itunes.rb, test/rss/test_itunes.rb: removed
+ needless UTF-8 characters.
+
+Sun Dec 2 01:12:15 2007 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 14070 from trunk.
+
+ * lib/xmlrpc/server.rb (XMLRPC::Server#server): Improve signal handling so
+ pressing control-c in the controlling terminal or sending SIGTERM stops
+ the XML-RPC server.
+
+Sat Dec 1 15:13:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/resolv.rb: documentation update. backported from 1.9.
+ [ruby-core:13273]
+
+Sat Dec 1 03:30:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (newline_node): set line from outermost node before removing
+ NODE_BEGIN. [ruby-dev:32406]
+
+Fri Nov 30 21:53:28 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb, test/rss/test_version.rb: 0.2.0 -> 0.2.1.
+
+ * lib/rss/content.rb, lib/rss/content/1.0.rb,
+ lib/rss/content/2.0.rb, lib/rss/maker/content.rb,
+ test/rss/rss-testcase.rb, test/rss/test_content.rb,
+ test/rss/test_maker_content.rb: supported content:encoded with RSS
+ 2.0.
+ Suggested by Sam Lown. Thanks.
+
+ * NEWS: added the above changes.
+
+Thu Nov 29 16:59:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (stmt): remove unnecessary NODE_BEGIN. [ruby-core:13814]
+
+Wed Nov 28 14:43:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extract_makefile): use dldflags instead of DLDFLAGS to
+ get rid of mixing $LDFLAGS and $ARCH_FLAG.
+
+ * lib/mkmf.rb (configuration): ditto.
+
+ * lib/mkmf.rb (create_makefile): support for extensions which has no
+ shared object.
+
+Wed Nov 28 09:51:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): do not clobber space for sign.
+
+ * sprintf.c (remove_sign_bits): extends sign bit first.
+
+Wed Nov 21 01:04:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (nil_plus): remove unused function. [ruby-core:13737]
+
+Sun Nov 18 14:03:44 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_alias): do not call hook functions until initialization
+ finishes. [ruby-talk:279538]
+
+Sun Nov 18 09:09:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (String#tr_cpp): make preprocessor identifiers.
+
+Sat Nov 17 13:58:11 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_invoke): bug fix. [ruby-talk:279100]
+
+Fri Nov 16 17:41:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (Document-class): moved the simplest example to
+ the top.
+
+ * ext/iconv/iconv.c (iconv_s_iconv): Document-method: needs class
+ prefix for class method. [ruby-core:13542]
+
+ * ext/iconv/iconv.c (iconv_iconv): also instance method needs to be
+ qualified.
+
+Fri Nov 16 11:16:41 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb (String#is_binary_data?): use Integer#fdiv.
+
+Thu Nov 15 19:50:46 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/curses/extconf.rb: check macro if cannot find func.
+ [ruby-list:44224]
+
+Thu Nov 15 12:19:14 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi/session.rb (CGI::Session::FileStore::restore): use
+ lockfile for exclusive locks. a patch from <tommy AT tmtm.org>.
+ [ruby-dev:32296]
+
+Wed Nov 14 01:52:59 2007 Tanaka Akira <akr@fsij.org>
+
+ * missing/isinf.c (isinf): don't define if the macro is defined.
+
+Wed Nov 14 01:34:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (round): fallback definition.
+
+ * numeric.c (flo_divmod, flo_round): use round() always.
+ [ruby-dev:32269]
+
+Tue Nov 13 22:02:23 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: remove Thread.exclusive.
+
+ * lib/drb/extservm.rb: ditto.
+
+Tue Nov 13 16:33:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (flodivmod): work around for infinity.
+
+ * numeric.c (flo_divmod): work around for platforms have no round().
+ [ruby-dev:32247]
+
+Tue Nov 13 13:58:51 2007 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (numeric.c): Integer#ord implemented. [ruby-dev:32206]
+
+Tue Nov 13 02:57:04 2007 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
+
+ * numeric.c (flo_divmod): round to the nearest integer.
+ [ ruby-Bugs-14540 ]
+
+Mon Nov 12 16:52:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): rdoc about srcprefix. a patch from
+ Daniel Berger <djberg96 AT gmail.com> in [ruby-core:13378].
+
+Mon Nov 12 13:53:06 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): handle stringified
+ symbols properly using ruby-forward-string.
+
+Mon Nov 12 12:38:31 2007 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (lex.c): don't remove lex.c at first.
+
+Fri Nov 9 07:26:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * random.c: update MT URL.[ruby-core:13305].
+
+Wed Nov 7 03:32:38 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/rexml/encodings/SHIFT-JIS.rb (REXML::Encoding): place -x for
+ nkf conversion. a patch from <moonwolf AT moonwolf.com>.
+ [ruby-dev:32183]
+
+Mon Nov 5 05:17:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::Switch::summarize): fix for long form
+ option with very long argument. a patch from Kobayashi Noritada
+ <nori1 AT dolphin.c.u-tokyo.ac.jp> in [ruby-list:44179].
+
+Mon Nov 5 01:20:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (call_args): remove "parenthesize argument(s) for future
+ version" warning. when I added this warning, I had a plan to
+ reimplement the parser that is simpler than the current one.
+ since we abandoned the plan, warning no longer required.
+
+Fri Nov 2 00:13:51 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_assoc): check and convert inner arrays (assocs)
+ using #to_ary.
+
+ * hash.c (rb_hash_s_create): check and convert argument hash
+ using #to_hash.
+
+ * hash.c (rb_hash_s_create): Hash#[] now takes assocs as source of
+ hash conversion.
+
+Thu Nov 1 23:47:43 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb (DRbTCPSocket): Improving with multiple network
+ interface.
+
+ * test/drb/drbtest.rb: ditto.
+
+Fri Oct 26 17:14:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (fix_pow): returns 1.0 for 0**0.0.
+
+ * numeric.c (fix_pow): returns infinity for 0**-1. [ruby-dev:32084]
+
+Wed Oct 25 07:18:09 2007 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 13781 from trunk.
+
+ * lib/net/telnet.rb (Net::Telnet#login): Allowing "passphrase" in
+ addition to "password" for Telnet login prompts. [ruby-Bugs-10746]
+
+Wed Oct 25 06:46:21 2007 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 13779 from trunk.
+
+ * lib/net/telnet.rb (Net::Telnet#login): Making the password prompt
+ pattern case insensitive. [ruby-Bugs-10746]
+
+Thu Oct 25 14:19:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093]
+
+Wed Oct 25 08:03:53 2007 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 13767, 13768, 13769, and 13770 from trunk.
+
+ * lib/xmlrpc/parser.rb (XMLRPC::Convert::dateTime): Fixing a bug that
+ caused time zone conversion to fail for some ISO 8601 date formats.
+ [ruby-Bugs-12677]
+
+ * lib/xmlrpc/client.rb (XMLRPC::Client#do_rpc): Explicitly start
+ the HTTP connection to support keepalive requests. [ruby-Bugs-9353]
+
+ * lib/xmlrpc/client.rb (XMLRPC::Client#do_rpc): Improving the error
+ message for Content-Type check failures. [ruby-core:12163]
+
+ * lib/xmlrpc/utils.rb (XMLRPC::ParseContentType#parse_content_type):
+ Making Content-Type checks case insensitive. [ruby-Bugs-3367]
+
+Sun Oct 21 21:16:43 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss.rb, lib/rss/, test/rss/, sample/rss/: merged from trunk.
+ - 0.1.6 -> 2.0.0.
+ - fixed image module URI. Thanks to Dmitry Borodaenko.
+ - supported Atom.
+ - supported ITunes module.
+ - supported Slash module.
+
+ * NEWS: added an entry for RSS Parser.
+
+Thu Oct 18 10:57:06 2007 Tanaka Akira <akr@fsij.org>
+
+ * ruby.h (RCLASS_IV_TBL): defined.
+ (RCLASS_M_TBL): ditto.
+ (RCLASS_SUPER): ditto.
+ (RMODULE_IV_TBL): ditto.
+ (RMODULE_M_TBL): ditto.
+ (RMODULE_SUPER): ditto.
+
+Mon Oct 15 22:08:55 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Merge some of the sub-sections, as the differences were
+ unclear.
+
+Mon Oct 15 21:57:07 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Mention ipaddr enhancements.
+
+ * lib/ipaddr.rb (in_addr, in6_addr, addr_mask): Make some minor
+ code optimization.
+
+ * lib/ipaddr.rb (<=>): Implement IPAddr#<=> and make IPAddr
+ comparable.
+
+ * lib/ipaddr.rb (succ): Implement IPAddr#succ. You can now create
+ a range between two IPAddr's, which (Range) object is
+ enumerable.
+
+ * lib/ipaddr.rb (to_range): A new method to create a Range object
+ for the (network) address.
+
+ * lib/ipaddr.rb (coerce_other): Support type coercion and make &,
+ |, == and include? accept a string or an integer instead of an
+ IPAddr object as the argument.
+
+ * lib/ipaddr.rb (initialize): Give better error messages.
+
+ * lib/ipaddr.rb: Improve documentation.
+
+Mon Oct 15 21:24:25 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Mention shellwords and tempfile enhancements.
+
+ * NEWS: Move the entry about Tk::X_Scrollable to a better section.
+
+Mon Oct 15 17:28:20 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/buffering.rb (read, readpartial): revert
+ r12496. handling EOF is a little differnt in ruby 1.8 and ruby 1.9.
+ [ruby-dev:31979]
+
+Mon Oct 15 11:45:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (r_bytes0): refined length check. [ruby-dev:32059]
+
+Mon Oct 15 09:58:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (r_bytes0): check if source has enough data.
+ [ruby-dev:32054]
+
+Mon Oct 15 01:15:09 2007 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (s_accept_nonblock): make accepted fd
+ nonblocking. [ruby-talk:274079]
+
+Sun Oct 14 04:08:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (AC_SYS_LARGEFILE): keep results also in command
+ options, to vail out of mismatch. [ruby-list:44114]
+
+ * mkconfig.rb, lib/mkmf.rb (configuration): add DEFS.
+
+Sun Oct 14 03:55:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/mkexports.rb: deal with __fastcall name decorations.
+ [ruby-list:44111]
+
+Sat Oct 13 09:02:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * {bcc,win}32/mkexports.rb: explicit data. [ruby-list:44108]
+
+Sat Oct 13 00:35:03 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/rexml/source.rb (REXML::SourceFactory::SourceFactory): typo
+ fixed. [ruby-list:44099]
+
+Fri Oct 12 11:22:15 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (match_values_at): make #select to be alias to #values_at
+ to adapt RDoc description. [ruby-core:12588]
+
+Thu Oct 11 14:32:46 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {bcc32,win32}/Makefile.sub (COMMON_MACROS): workaround for old SDK's
+ bug. [ruby-core:12584]
+
+Wed Oct 10 23:34:45 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb: new file. [ruby-dev:31928]
+
+ * lib/cgi/session.rb (create_new_id): use securerandom if available.
+
+Tue Oct 9 01:01:55 2007 Tanaka Akira <akr@fsij.org>
+
+ * re.c (rb_reg_s_union_m): Regexp.union accepts single
+ argument which is an array of patterns. [ruby-list:44084]
+
+Mon Oct 8 20:06:23 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/net/http.rb, lib/open-uri.rb: remove
+ Net::HTTP#enable_post_connection_check. [ruby-dev:31960]
+
+ * lib/net/imap.rb: hostname should be verified against server's
+ indentity as persented in the server's certificate. [ruby-dev:31960]
+
+ * ext/openssl/lib/net/telnets.rb, ext/openssl/lib/net/ftptls.rb: ditto.
+
+Sat Oct 6 23:14:54 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_to_i): update RDoc since base can be any value
+ between 2 and 36. [ruby-talk:272879]
+
+Fri Oct 5 15:44:50 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb: Add shellescape() and shelljoin().
+
+ * lib/shellwords.rb: Rename shellwords() to shellsplit() and make
+ the former an alias to the latter.
+
+ * lib/shellwords.rb: Add escape(), split(), join() as class
+ methods, which are aliases to their respective long names
+ prefixed with `shell'.
+
+ * lib/shellwords.rb: Add String#shellescape(), String#shellsplit()
+ and Array#shelljoin() for convenience.
+
+Fri Oct 5 15:40:04 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb (Tempfile::make_tmpname): Allow to specify a
+ suffix for a temporary file name.
+
+ * lib/tempfile.rb (Tempfile::make_tmpname): Make temporary file
+ names less predictable by including a random string.
+ [inspired by: akr]
+
+Tue Oct 2 21:20:14 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (make_cmdvector): adjust escaped successive
+ double-quote handling. (merge from trunk)
+
+Tue Oct 2 20:35:24 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (init_env): initialize HOME and USER environment
+ variables unless set. [ruby-core:12328] (merge from trunk)
+
+ * win32/win32.c (NtInitialize, getlogin): ditto.
+
+ * configure.in, win32/Makefile.sub (LIBS): need to link shell32
+ library for SH* functions on mswin32 and mingw32.
+
+Mon Oct 1 12:50:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (id2ref): valid id should not refer T_VALUE nor T_ICLASS.
+ [ruby-dev:31911]
+
+Wed Sep 26 23:54:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake), lib/mkmf.rb (configuration): top_srcdir
+ should not prefixed with DESTDIR.
+
+Wed Sep 26 08:36:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (ext/extinit.o): use $(OUTFLAG) as well as other
+ objects. [ruby-Bugs-14228]
+
+Wed Sep 26 05:12:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yyerror): limit error message length. [ruby-dev:31848]
+
+ * regex.c (re_mbc_startpos): separated from re_adjust_startpos.
+
+Tue Sep 25 13:47:38 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (remove_method): should not remove undef place holder.
+ [ruby-dev:31817]
+
+Mon Sep 24 16:52:11 2007 Urabe Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/net/http.rb: fix typo.
+
+Sun Sep 23 21:57:25 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/net/http.rb: an SSL verification (the server hostname should
+ be matched with its certificate's commonName) is added.
+ this verification can be skipped by
+ "Net::HTTP#enable_post_connection_check=(false)".
+ suggested by Chris Clark <cclark at isecpartners.com>
+
+ * lib/net/open-uri.rb: use Net::HTTP#enable_post_connection_check to
+ perform SSL post connection check.
+
+ * ext/openssl/lib/openssl/ssl.c
+ (OpenSSL::SSL::SSLSocket#post_connection_check): refine error message.
+
+Sun Sep 23 09:05:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (os_obj_of, os_each_obj): hide objects to be finalized.
+ [ruby-dev:31810]
+
+Sun Sep 23 08:58:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval_method.ci (rb_attr): should not use alloca for unknowen size
+ input. [ruby-dev:31816]
+
+ * parse.y (rb_intern_str): prevent str from optimization.
+
+Sun Sep 23 05:42:35 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/rdoc/options.rb (Options::check_diagram): dot -V output
+ changed. [ ruby-Bugs-11978 ], Thanks Florian Frank.
+
+Sat Sep 22 06:02:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::List::summarize): use each_line if
+ defined rather than each. [ruby-Patches-14096]
+
+Sat Sep 22 05:19:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_init): separate from strio_initialize
+ to share with strio_reopen properly. [ruby-Bugs-13919]
+
+Fri Sep 21 15:46:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (struct rb_exec_arg): proc should be a VALUE.
+
+ * process.c (rb_f_exec): suppress a warning.
+
+Fri Sep 21 03:05:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c, intern.h, ext/thread/thread.c: should not free queue while
+ any live threads are waiting. [ruby-dev:30653]
+
+Thu Sep 20 17:24:59 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_detach_process): cast for the platforms where size of
+ pointer differs from size of int.
+
+ * process.c (rb_f_exec, rb_f_system): should not exceptions after
+ fork. [ruby-core:08262]
+
+Fri Sep 14 00:34:25 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/extservm.rb (invoke_service): use Thread.exclusive instead of
+ Thread.critical
+
+Wed Sep 12 23:12:22 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (proc_options): -W should be allowed in RUBYOPT
+ environment variable. [ruby-core:12118]
+
+Mon Sep 10 01:05:25 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): fixed integer overflow. [ruby-dev:31763]
+
+Sun Sep 9 09:14:45 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (_strptime): now also attaches an element
+ which denotes leftover substring if exists.
+
+Sat Sep 8 10:22:20 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * struct.c (rb_struct_s_members): should raise TypeError instead
+ of call rb_bug(). [ruby-dev:31709]
+
+ * marshal.c (r_object0): no nil check require any more.
+
+Sat Sep 8 09:38:19 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (str[fp]time): now check specifications more
+ strictly.
+
+Fri Sep 7 05:36:19 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/rinda/test_rinda.rb (MockClock): correct synchronous problems
+ of the MultiThreading. [ruby-dev:31692]
+
+Wed Sep 5 22:02:27 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_subseq): need integer overflow check.
+ [ruby-dev:31736]
+
+ * array.c (rb_ary_splice): ditto. [ruby-dev:31737]
+
+ * array.c (rb_ary_fill): ditto. [ruby-dev:31738]
+
+ * string.c (rb_str_splice): integer overflow for length.
+ [ruby-dev:31739]
+
+Sun Sep 2 00:48:15 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (_parse): improved parsing of ordinal dates.
+
+ * lib/date/format.rb (_parse): use named character classes in some
+ regular expressions.
+
+Sat Sep 1 08:13:36 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize.
+
+Thu Aug 30 13:13:13 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_const, have_const): check for a const is defined.
+ [ruby-core:04422]
+
+Thu Aug 30 13:10:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (group_member): check if presents.
+
+ * configure.in (XCFLAGS): add _GNU_SOURCE on linux.
+
+ * file.c (group_member): use system routine if available.
+
+Thu Aug 30 08:24:18 2007 Tanaka Akira <akr@fsij.org>
+
+ * ruby.h (RHASH_TBL): defined for compatibility to 1.9.
+ * (RHASH_ITER_LEV): ditto.
+ * (RHASH_IFNONE): ditto.
+ * (RHASH_SIZE): ditto.
+ * (RHASH_EMPTY_P): ditto.
+
+Wed Aug 29 13:05:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * include/ruby/defines.h (flush_register_windows): call "ta 0x03"
+ even on Linux/Sparc. [ruby-dev:31674]
+
+Tue Aug 28 23:26:12 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key,
+ reg_get_val, ole_wc2mb): fix the bug. Thanks, arton.
+ [ruby-dev:31576]
+
+Mon Aug 27 19:10:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/etc/etc.c (etc_getlogin): update documentation to note
+ security issue. [ruby-Bugs-11821]
+
+Tue Aug 21 21:09:48 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/tmpdir.rb (Dir.mktmpdir): make directory suffix specifiable.
+
+Tue Aug 21 13:57:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (st_foreach_func, rb_foreach_func): typedefed.
+
+Mon Aug 20 17:25:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (mnew): should preserve noex as safe_level.
+
+ * eval.c (rb_call0): tighten security check condition..
+
+Sat Aug 18 21:32:20 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/tmpdir.rb (Dir.mktmpdir): new method.
+ [ruby-dev:31462]
+
+Sat Aug 18 17:44:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/tcltklib.c (Init_tcltklib): use rb_set_end_proc().
+
+Sat Aug 18 15:59:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (detach_process_watcher): should not pass the pointer
+ to an auto variable to the thread to be created. pointed and
+ fix by KUBO Takehiro <kubo at jiubao.org> [ruby-dev:30618]
+
+Sat Aug 18 12:24:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep
+ comment lines first.
+
+Thu Aug 16 20:40:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigtrunc): RBIGNUM(x)->len may be zero. out of bound
+ access. [ruby-dev:31404]
+
+Thu Aug 16 16:46:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (aix): enable shared by default.
+
+ * configure.in (aix): for 64bit-mode AIX. [ruby-dev:31401]
+ + use CC for LDSHARED if non-gcc,
+ + moved -G option from *LDFLAGS to LDSHARED,
+ + set -brtl only in XLDFLAGS.
+
+Thu Aug 16 13:06:08 2007 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (big_lshift): make shift offset long type.
+ (big_rshift): ditto.
+ (rb_big_lshift): ditto.
+ (big_rshift): ditto.
+ [ruby-dev:31434]
+
+Thu Aug 16 04:09:19 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (Rinda::TupleSpace#start_keeper): improve
+ keeper thread.
+
+Wed Aug 15 13:50:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_delete_key): delete the entry without calling block.
+
+ * hash.c (rb_hash_shift): should consider iter_lev too.
+
+ * hash.c (delete_if_i): use rb_hash_delete_key() so that the block
+ isn't called twice. [ruby-core:11556]
+
+Sun Arg 12 03:56:30 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb: fix Rinda::TupleSpace keeper thread bug.
+ the thread is started too early. [ruby-talk:264062]
+
+ * test/rinda/test_rinda.rb: ditto.
+
+Sat Aug 11 07:34:10 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: reverted some wrongly erased "o" options
+ (pointed out by nobu).
+
+Tue Aug 7 14:58:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/pty.c (establishShell): handshaking before close slave
+ device. [ruby-talk:263410]
+
+ * ext/pty/pty.c (MasterDevice, SlaveDevice, deviceNo): constified.
+
+ * ext/pty/pty.c (SlaveName): removed static buffer.
+
+ * ext/pty/expect_sample.rb: support for autologin.
+
+Tue Aug 7 12:45:13 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ac_cv_func_isinf): set yes also on OpenSolaris.
+ [ruby-Bugs-12859]
+
+Mon Aug 6 17:36:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rexml/encodings/{ISO-8859-15,CP-1252}.rb: fixed invalid syntax.
+
+Fri Aug 3 11:05:54 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): save all CONFIG values.
+
+ * ext/extmk.rb (extmake): remove mkmf.log at clean, and extconf.h at
+ distclean, respectively.
+
+ * ext/extmk.rb: remove rdoc at clean, and installed list file at
+ distclean, respectively.
+
+Fri Aug 3 07:09:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: more verbose message. [ruby-Bugs-12766]
+
+ * lib/mkmf.rb (have_type): suppress a warning with -Wall.
+
+ * lib/mkmf.rb (find_type): new method.
+
+Thu Aug 2 13:46:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): should not check positional number as
+ width. [ruby-core:11838]
+
+Mon Jul 30 11:16:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_aref): check for Bignum index range.
+ [ruby-dev:31271]
+
+Sat Jul 28 09:35:41 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/digest/lib/digest.rb (Digest::self.const_missing): avoid
+ infinite recursive const_missing call. [ruby-talk:262193]
+
+Thu Jul 26 13:57:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (load_1, dln_find_1): constified.
+
+ * dln.c (conv_to_posix_path): removed.
+
+ * ruby.c (usage): constified.
+
+ * ruby.c (rubylib_mangled_path, rubylib_mangled_path2): return
+ VALUE instead of a pointer to static buffer.
+
+ * ruby.c (push_include_cygwin): fixed buffer overflow.
+ [ruby-dev:31297]
+
+ * ruby.c (ruby_init_loadpath): not convert built-in paths.
+
+Sun Jul 22 16:07:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * intern.h (is_ruby_native_thread): removed since declared as an int
+ function in ruby.h already.
+
+Sun Jul 22 14:33:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_rename): deleted code to get rid of a bug of
+ old Cygwin.
+
+ * file.c (rb_file_truncate): added prototype of GetLastError()
+ on cygwin. [ruby-dev:31239]
+
+ * intern.h (is_ruby_native_thread): prototype.
+
+ * missing/strftime.c (strftime): fix printf format and actual
+ arguments.
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): ditto.
+
+ * ext/tk/tcltklib.c (ip_finalize): ditto.
+
+ * ext/dl/ptr.c (rb_dlptr_inspect): ditto. [ruby-dev:31268]
+
+ * ext/dl/sym.c (rb_dlsym_inspect): ditto.
+
+ * ext/socket/getnameinfo.c: include stdio.h always.
+
+ * ext/win32ole/win32ole.c (ole_hresult2msg, folevariable_name,
+ folevariable_ole_type, folevariable_ole_type_detail,
+ folevariable_value, folemethod_visible): missing return value.
+
+Sat Jul 21 17:48:26 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): make OBJS depend on RUBY_EXTCONF_H
+ only if extconf.h is created.
+
+ * bcc32/{Makefile.sub,configure.bat,setup.mak: configure_args
+ support.
+
+ * bcc32/setup.mak: check runtime version.
+
+ * win32/win32.c (rb_w32_open_osfhandle): prototype has changed
+ in bcc 5.82.
+
+ * {win32,wince,bcc32}/setup.mak (-version-): no RUBY_EXTERN magic.
+
+ * win32/resource.rb: include patchlevel number.
+
+Sat Jul 21 12:06:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (init_mkmf): should remove mkmf.log too.
+
+Sat Jul 21 01:53:17 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (Date._parse): completes calendar week based year.
+
+ * lib/date/format.rb (Date._parse): detects year of ordinal date in
+ extended format.
+
+Fri Jul 20 15:22:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/ossl_config.c (ossl_config_set_section): do not
+ initialize aggregations with dynamic values. [ruby-talk:259306]
+
+Thu Jul 19 19:24:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (get_backtrace): check the result more.
+ [ruby-dev:31261] [ruby-bugs-12398]
+
+Thu Jul 19 14:38:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_lshift, rb_big_rshift): separated functions
+ to get rid of infinite recursion. fixed calculation in edge
+ cases. [ruby-dev:31244]
+
+ * numeric.c (rb_fix_lshift, rb_fix_rshift): ditto.
+
+Wed Jul 18 16:57:41 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): refine overflow check. [ruby-dev:31242]
+
+Wed Jul 18 08:47:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_succ): Time#succ should return a time object in the
+ same timezone mode to the original. [ruby-talk:260256]
+
+Tue Jul 17 00:50:53 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_pow): integer power calculation: 0**n => 0,
+ 1**n => 1, -1**n => 1 (n: even) / -1 (n: odd).
+
+ * test/ruby/test_fixnum.rb (TestFixnum::test_pow): update test
+ suite. pow(-3, 2^64) gives NaN when pow(3, 2^64) gives Inf.
+
+Mon Jul 16 23:07:51 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/base64.rb (Base64::b64encode): should not specify /o option
+ for regular expression. [ruby-dev:31221]
+
+Mon Jul 16 18:29:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_rindex_m): accept string-like object convertible
+ with #to_str method, as well as rb_str_index_m. [ruby-core:11692]
+
+Mon Jul 16 05:45:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): more checks for format argument.
+ [ruby-core:11569], [ruby-core:11570], [ruby-core:11571],
+ [ruby-core:11573]
+
+Mon Jul 16 00:26:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): removed invariant variable. [ruby-dev:31236]
+
+Sun Jul 15 23:59:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_neg): SIGNED_VALUE isn't in 1.8.
+
+Sun Jul 15 22:24:49 2007 pegacorn <subscriber.jp AT gmail.com>
+
+ * ext/digest/digest.c (rb_digest_instance_update,
+ rb_digest_instance_finish, rb_digest_instance_reset,
+ rb_digest_instance_block_length): %s in rb_raise() expects char*.
+ [ruby-dev:31222]
+
+ * ext/openssl/ossl.h: include ossl_pkcs5.h. [ruby-dev:31231]
+
+ * ext/openssl/ossl_pkcs5.h: new file for PKCS5. [ruby-dev:31231]
+
+ * ext/openssl/ossl_x509name.c (ossl_x509name_to_s): use ossl_raise()
+ instead of rb_raise(). [ruby-dev:31222]
+
+ * ext/sdbm/_sdbm.c: DOSISH platforms need io.h. [ruby-dev:31232]
+
+ * ext/syck/syck.h: include stdlib.h for malloc() and free().
+ [ruby-dev:31232]
+
+ * ext/syck/syck.h (syck_parser_set_input_type): prototype added.
+ [ruby-dev:31231]
+
+ * win32/win32.c: include mbstring.h for _mbspbrk(). [ruby-dev:31232]
+
+ * win32.h (rb_w32_getcwd): prototype added. [ruby-dev:31232]
+
+Sun Jul 15 21:07:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (bigtrunc): do not empty Bignum. [ruby-dev:31229]
+
+Sun Jul 15 19:05:28 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_cstr_to_inum): check leading non-digits.
+ [ruby-core:11691]
+
+Sun Jul 15 04:42:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (get2comp): do nothing for empty Bignum. [ruby-dev:31225]
+
+Sat Jul 14 14:04:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (sort_by_cmp): check if reentered. [ruby-dev:24291]
+
+Sat Jul 14 12:44:14 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/openssl/test_pkcs7.rb: reverted the previous patch. it should
+ be as it was to check interface compatibility. sorry for bothering
+ with this.
+
+Sat Jul 14 12:16:17 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/openssl/test_pkcs7.rb: follow the library change. applied a
+ patch from <zn at mbf.nifty.com> [ruby-dev:31214].
+ NOTE: r12496 imports the latest openssl libs from trunk to ruby_1_8
+ though its's not ChangeLog-ed. maintainer should aware that.
+
+Sat Jul 14 02:51:52 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_pow): 0**2 should not raise floating point
+ exception. [ruby-dev:31216]
+
+Sat Jul 14 02:25:48 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (int_pow): wrong overflow detection. [ruby-dev:31213]
+
+ * numeric.c (int_pow): wrong overflow detection. [ruby-dev:31215]
+
+Fri Jul 13 16:10:00 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): use ENV.to_hash to access
+ http_proxy environment variable to avoid case insensitive
+ environment search.
+
+Fri Jul 13 15:02:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (CreateChild): enclose command line except for
+ command.com which can not handle quotes. [ruby-talk:258939]
+
+Fri Jul 13 10:10:46 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (link_command, cc_command, cpp_command): do not expand
+ ::CONFIG which is an alias of MAKEFILE_CONFIG.
+
+Thu Jul 12 17:03:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * struct.c (rb_struct_init_copy): disallow changing the size.
+ [ruby-dev:31168]
+
+Wed Jul 11 23:38:14 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * random.c: documentation fix. srand(0) initializes PRNG with '0',
+ not with random_seed.
+
+Tue Jul 10 14:50:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bcc32/{Makefile.sub,setup.mak}: remove surplus slash from srcdir.
+
+Fri Jul 6 15:22:58 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_interrupt): suppress a gcc's officious warning.
+
+Thu Jul 5 16:44:28 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (int_pow): fix previous nubu's commit.
+
+ * test/ruby/test_fixnum.rb: new test.
+
+Thu Jul 5 15:56:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (int_pow): even number multiplication never be negative.
+
+Mon Jul 2 14:34:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): sign bit extension should not be done
+ if FPLUS flag is specified. [ruby-list:39224]
+
+Sat Jun 30 16:05:41 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_initialize): should call rb_ary_modify() first.
+ [ruby-core:11562]
+
+Sat Jun 30 00:17:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yylex): return non-valid token for an invalid
+ instance/class variable name. a patch from Yusuke ENDOH
+ <mame AT tsg.ne.jp>. [ruby-dev:31095]
+
+Fri Jun 29 11:23:09 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (dsym): return non-null NODE even if yyerror(). based on a
+ patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:31085]
+
+Tue Jun 26 16:35:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (ruby_setreuid, ruby_setregid): rename to get rid of name
+ clash.
+
+ * process.c (proc_exec_v, rb_proc_exec): preserve errno.
+
+Sat Jun 23 00:37:46 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_select): remove unnecessary varargs for
+ rb_hash_select. a patch from Daniel Berger
+ <Daniel.Berger at qwest.com>. [ruby-core:11527]
+
+ * hash.c: ditto.
+
+Mon Jun 18 08:47:54 2007 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/{extconf.rb,ossl_ssl_session.c}:
+ Fix ruby-Bugs-11513.
+
+ * ext/openssl/ossl_pkey_ec.c
+ New methods EC::Point.[eql,make_affine!,invert!,on_curve?,infinity?]
+ By default output the same key form as the openssl command.
+
+ * ext/openssl/ossl_rand.c
+ New method Random.status?
+
+Mon Jun 18 13:54:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): return EXIT_FAILURE if any exceptions occured
+ in at_exit blocks. [ruby-core:11263]
+
+Mon Jun 18 01:14:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_path2class): get rid of dangling pointer caused by
+ optimized out value.
+
+ * variable.c (rb_global_entry, rb_f_untrace_var, rb_alias_variable,
+ rb_generic_ivar_table, generic_ivar_get, generic_ivar_set,
+ generic_ivar_defined, generic_ivar_remove, rb_mark_generic_ivar,
+ rb_free_generic_ivar, rb_copy_generic_ivar,
+ rb_obj_instance_variables): suppress warnings.
+
+Fri Jun 15 22:33:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (realclean): separate local and ext.
+
+ * ext/extmk.rb: not remove unrelated directories.
+
+Fri Jun 15 17:01:20 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/lib/dl/win32.rb: seems that dl doesn't accept void argument.
+ fixed [ruby-bugs:PR#5489].
+
+Thu Jun 14 17:09:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser): handle more
+ extensions. [ruby-dev:30972]
+
+Wed Jun 13 06:05:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): prohibit loading extension libraries to
+ miniruby.
+
+Wed Jun 13 05:47:58 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_kill_thread): renamed in order to get rid of conflict
+ with a BeOS system function. [ruby-core:10830]
+
+Tue Jun 12 14:53:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (Logging.quiet, Logging.message): added quiet flag and
+ use it. [ruby-core:10909]
+
+ * lib/mkmf.rb (find_header): use header names in the message.
+
+Sun Jun 10 13:47:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
+ get rid of invoking shell. [ruby-dev:30942]
+
+Thu Jun 7 19:02:48 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/pp.rb: call original "method" method instead of redefined one.
+
+Mon Jun 4 11:11:12 2007 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (ResponseParser#next_token): fixed
+ error message. (backported from HEAD)
+
+ * lib/net/imap.rb (ResponseParser#parse_error): fixed
+ the condition not to refer @token.symbol unexpectedly.
+ Thanks, Dick Monahan. (backported from HEAD)
+
+Thu May 31 17:27:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/benchmark.rb (Benchmark::Job::item): avoid modifying the
+ argument unintentionally. [ruby-talk:253676]
+
+Thu May 31 02:12:32 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (Rinda::TupleBag): create index on tuple bag
+ by first column.
+
+Wed May 30 13:27:40 2007 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (Net::FTP#transfercmd): skip 2XX
+ responses for some FTP servers. (backported from HEAD)
+
+Wed May 30 05:17:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): get rid of SEGV at ZSUPER in a block
+ [ruby-dev:30836]
+
+Wed May 30 04:29:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (thread_timer): timer thread should not receive any
+ signals. submitted by Sylvain Joyeux. [ruby-core:08546]
+
+Wed May 30 04:18:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval_cmd): just return if no exceptions.
+ [ruby-dev:30820]
+
+Tue May 29 11:01:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_opendir): store attributes of the second
+ entries or later too.
+
+ * win32/win32.c (rb_w32_opendir, rb_w32_readdir): eliminate magic
+ numbers.
+
+Mon May 28 02:54:05 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (Rinda::TupleBag#delete): use rindex and
+ delete_at instead of delete for little improvement.
+
+Sat May 26 00:05:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
+ skip tests for exitstatus and termsig on the platforms where
+ signals not supported.
+
+Wed May 23 06:51:46 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/cgi.rb (CGI#[]): get rid of exceptions being raised.
+ [ruby-dev:30740], Thanks Kentaro KAWAMOTO.
+
+Wed May 23 05:49:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb, ext/purelib.rb, lib/mkmf.rb, runruby.rb: clear default
+ load path to get rid of load pre-installed extensions/libraries.
+ [ruby-core:11017]
+
+Sat May 19 10:29:18 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (Date._parse): detects some OFX dates
+ (Of course not fully).
+
+Fri May 18 23:07:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_first): call rb_ary_subseq() instead of pushing
+ values by itself. [ruby-talk:252062]
+
+ * array.c (rb_ary_first): add negative length check.
+
+Fri May 18 17:10:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (move_to_next_entry): loc also must move forward.
+ [ruby-talk:251987]
+
+Fri May 18 03:02:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/mkexports.rb: preserve prefixed underscores for WINAPI
+ symbols.
+
+ * wince/mkconfig_wce.rb, wince/mkexports.rb: obsolete.
+
+Thu May 17 17:03:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el (ruby-style-label-indent): for yacc rules.
+
+Tue May 15 14:54:07 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (init_stdhandle): stderr should be without buffering,
+ but mswin32 use buffering when stderr is not connected to tty.
+
+Mon May 14 13:28:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/thread/thread.c (wait_list): supress a warning.
+
+Thu May 10 15:21:51 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_s_conv): rdoc fix.
+
+Thu May 10 10:14:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_priority): rdoc fix; the initial value is
+ inherited from the creating thread. [ruby-core:10607]
+
+Wed May 9 12:28:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (Init_Bignum), numeric.c (Init_Numeric): added fdiv as
+ aliases of quo. [ruby-dev:30771]
+
+Wed May 9 11:55:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_quo): now calculate in integer. [ruby-dev:30753]
+
+Wed May 9 11:51:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): reduce multiplying for even number.
+
+ * bignum.c (rb_big_pow): truncate all zero BDIGITs. [ruby-dev:30733]
+
+ * bignum.c (rb_big_pow): improvement by calculating from MSB and using
+ factorization. <http://yowaken.dip.jp/tdiary/20070426.html#p01>
+
+ * numeric.c (int_pow): calculate power in Fixnum as possible.
+ [ruby-dev:30726]
+
+Tue May 8 23:42:51 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (Date._parse): revised treatment of
+ hyphened/separatorless dates.
+
+ * lib/date/format.rb: some trivial adjustments.
+
+Tue May 8 20:25:05 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: reverted.
+
+Sat May 5 16:26:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/date/format.rb (Format::Bag#method_missing): get rid of
+ modifying orginal argument. [ruby-core:11090]
+
+Mon Apr 30 01:17:51 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (TupleSpace#create_entry, TupleBag#push,
+ delete): extract method, and rename parameter.
+
+Fri Apr 27 02:00:17 2007 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * signal.c: Fixed backwards compatibility for 'raise Interrupt'.
+
+ * lib/yaml/tag.rb: Running rdoc over the 1.8.6 tree skips
+ Module. Patch from James Britt
+
+Thu Apr 26 13:54:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el: new file. C/C++ style for ruby source code.
+
+Wed Apr 25 19:49:16 2007 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (unix_send_io, unix_recv_io): use CMSG_DATA to
+ align file descriptor appropriately.
+
+Tue Apr 24 09:33:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (do_stat, do_lstat, do_opendir): should not warn ENOTDIR.
+ [ruby-talk:248288]
+
+Mon Apr 23 22:14:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb ($ruby): add extout directory to include path.
+ [ruby-core:11003]
+
+ * lib/mkmf.rb (libpathflag): not to append RPATHFLAG to current
+ directory.
+
+ * lib/mkmf.rb (init_mkmf): add current directory to default
+ library path with highest priority. [ruby-core:10960]
+
+ * lib/mkmf.rb (LINK_SO): LIBPATH to be placed before DLDFLAGS.
+
+Fri Apr 20 16:05:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBPATHFLAG, RPATHFLAG): no needs to be quoted,
+ it is done by libpathflag in mkmf.rb.
+
+Fri Apr 20 12:27:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb: fix to override conv proc.
+
+Fri Apr 20 12:17:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): inversed the order of errinfos.
+
+Thu Apr 19 14:53:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/monitor.rb (ConditionVariable#wait, mon_enter, mon_exit_for_cond):
+ ensures Thread.critical to be false. [ruby-talk:248300]
+
+Wed Apr 18 10:41:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_strtod): exponent is radix 10. [ruby-talk:248272]
+
+Wed Apr 18 02:30:24 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LDFLAGS): prepend -L. instead appending it to
+ XLDFLAGS. [ruby-core:10933]
+
+ * configure.in (Makefile): remove $U for automake from MISSING.
+ [ruby-talk:248171]
+
+Tue Apr 17 16:46:46 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): should not clear state on TAG_NEXT when
+ it's invoked from within lambda body. [ruby-talk:248136]
+
+ * eval.c (proc_invoke): handle TAG_NEXT which would be caused by
+ next in the lambda body as well.
+
+Mon Apr 16 22:56:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/pty/expect_sample.rb: avoid symbolic link representation for
+ expect. a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com>.
+ [ruby-dev:30714]
+
+Mon Apr 16 22:51:11 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sample: replace TRUE, FALSE with true, false respectively.
+ a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com>.
+ [ruby-dev:30713]
+
+Mon Apr 16 17:08:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (make_switch): do not clobber converter if pattern
+ has no convert method. reported by sheepman in [ruby-dev:30709].
+
+Mon Apr 16 16:49:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_seek): consistent behavior with
+ IO#seek. patch by sheepman in [ruby-dev:30710].
+
+Mon Apr 16 16:34:08 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (parser_yylex): should set command_start after block
+ starting "do"s and braces. [ruby-core:10916]
+
+Sun Apr 15 09:19:57 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: added some zone names.
+
+ * lib/date/format.rb (_parse): now interprets doted numerical
+ dates as a big endian (except dd.mm.yyyy).
+
+Tue Apr 10 17:37:36 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_fclose, rb_w32_close): need to save errno
+ before calling original fclose()/close().
+
+Mon Apr 9 09:30:44 2007 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (disconnect): call shutdown for
+ SSLSocket. Thanks, Technorama Ltd.
+
+Thu Apr 5 00:42:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_notimplement), io.c (pipe_open): removed definite
+ articles and UNIX manual section from messages. [ruby-dev:30690]
+
+Wed Apr 4 17:09:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (pipe_open): refined the message of NotImplementedError.
+ [ruby-dev:30685]
+
+Wed Apr 4 10:18:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (pipe_open): raise NotImplementedError for command "-" on
+ platforms where fork(2) is not available. [ruby-dev:30681]
+
+Tue Apr 3 15:45:41 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/socket.c (s_recv, s_recvfrom): some systems (such as
+ windows) doesn't set fromlen if the socket is connection-oriented.
+ reported by Bram Whillock in [ruby-core:10512] [ruby-Bugs#9061]
+
+Sat Mar 24 23:40:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * node.h (struct rb_thread.locals): explicit as struct.
+ [ruby-core:10585]
+
+ * eval.c, node.h (enum rb_thread_status, struct rb_thread,
+ rb_curr_thread, rb_main_thread): prefixed. [ruby-core:10586]
+
+ * file.c (chompdirsep): made an unprefixed name static.
+
+ * io.c (io_fread): ditto.
+
+Sat Mar 24 01:54:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): exit by SystemExit and SignalException in END
+ block. [ruby-core:10609]
+
+ * test/ruby/test_beginendblock.rb (test_should_propagate_exit_code):
+ test for exit in END block. [ruby-core:10760]
+
+ * test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
+ test for signal in END block.
+
+Thu Mar 22 23:13:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_provided): check for extension library if SOEXT is
+ explicitly given. [ruby-dev:30657]
+
+Thu Mar 22 10:29:25 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_bignum.rb (test_to_s): add tests for Bignum#to_s.
+
+Wed Mar 21 17:04:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): round up for the most significant digit.
+ [ruby-core:10686]
+
+Wed Mar 21 07:21:24 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c (remove_one): Preserve List invariants;
+ submitted by: MenTaLguY <mental AT rydia.net>
+ in [ruby-core:10598] and [ruby-bugs:PR#9388].
+
+Tue Mar 20 22:54:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_extended): erroneous check condition when dump
+ method is defined. [ruby-core:10646]
+
+Tue Mar 20 15:37:24 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * distruby.rb: Add zip generation.
+
+Tue Mar 20 11:28:41 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/matrix.rb (Matrix::inverse_from): adding partial pivoting to
+ the Gauss-Jordan algorithm, making it stable. a patch from
+ Peter Vanbroekhoven. [ruby-core:10641]
+
+Mon Mar 19 11:39:29 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb (rbuf_read): extend buffer size for speed.
+
+Sun Mar 18 04:23:52 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Add a note about the new `date' library defining
+ Time#to_date and Time#to_datetime private methods.
+
+ * NEWS: Inform that the old `thread' library is considered to be
+ stable.
+
+ * NEWS: Sort library entries in alphabetical order.
+
+Fri Mar 16 21:48:11 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dl/dl.c (rb_ary2cary): Fix a bug in type validation;
+ submitted by sheepman <sheepman AT sheepman.sakura.ne.jp>
+ in [ruby-dev:30554].
+
+Fri Mar 16 18:28:06 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/etc/etc.c (etc_getgrgid): Fix a bug in Etc::getgrgid()
+ always returning the (real) group entry of the running process;
+ reported by: UEDA Hiroyuki <ueda AT netforest.ad.jp>
+ in [ruby-dev:30586].
+
+Fri Mar 16 16:33:58 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c (unlock_mutex_inner): Make sure that the
+ given mutex is actually owned by the caller; submitted by:
+ Sylvain Joyeux <sylvain.joyeux AT m4x.org> in [ruby-core:10598].
+
+Fri Mar 16 16:21:35 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c (wait_condvar, lock_mutex): Fix a problem in
+ ConditionVariable#wait that occurs when two threads that are
+ trying to access the condition variable are also in concurrence
+ for the given mutex; submitted by: Sylvain Joyeux
+ <sylvain.joyeux AT m4x.org> and MenTaLguY <mental AT rydia.net>
+ in [ruby-core:10598].
+
+Fri Mar 16 16:17:27 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/thread/test_thread.rb: Add a test script for the `thread'
+ library. This should result in failure as of now with
+ ext/thread; submitted by: Sylvain Joyeux <sylvain.joyeux AT
+ m4x.org> in [ruby-core:10598].
+
+Wed Mar 14 12:30:00 2007 Shigeo Kobayashi <shigeo@tinyforest.jp>
+
+ * ext/bigdecimal/bigdecimal.c: BigDecimal("-.31") is now
+ treated as ("-0.31") not as ("0.31").
+
+Tue Mar 13 09:25:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (clear-installed-list): separated from install-prereq.
+
+Tue Mar 13 06:38:43 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Reword and improve entries.
+
+Tue Mar 13 06:03:46 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * stable version 1.8.6 released from the ruby_1_8_6 branch.
+
+Tue Mar 13 03:24:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * runruby.rb: added --pure (turned on by default) and --debugger
+ options.
+
+Tue Mar 13 02:50:28 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/cgi.rb (CGI::header): IIS >= 5.0 does not need the nph
+ assumption any more; submitted by MIYASAKA Masaru <alkaid AT
+ coral.ocn.ne.jp> in [ruby-dev:30537].
+
+Mon Mar 12 11:07:44 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_asn1.c (Init_ossl_asn1): Let rdoc know about
+ externally defined modules; submitted by Technorama
+ Ltd. <oss-ruby AT technorama.net> in [ruby-bugs:PR#4704].
+
+ * ext/openssl/ossl_bn.c (Init_ossl_bn): Ditto.
+
+ * ext/openssl/ossl_cipher.c (Init_ossl_cipher): Ditto.
+
+ * ext/openssl/ossl_digest.c (Init_ossl_digest): Ditto.
+
+ * ext/openssl/ossl_hmac.c (Init_ossl_hmac): Ditto.
+
+ * ext/openssl/ossl_pkey.c (Init_ossl_pkey): Ditto.
+
+ * ext/openssl/ossl_pkey_dh.c (Init_ossl_dh): Ditto.
+
+ * ext/openssl/ossl_pkey_dsa.c (Init_ossl_dsa): Ditto.
+
+ * ext/openssl/ossl_pkey_rsa.c (Init_ossl_rsa): Ditto.
+
+ * ext/openssl/ossl_rand.c (Init_ossl_rand): Ditto.
+
+ * ext/openssl/ossl_ssl.c (Init_ossl_ssl): Ditto.
+
+Mon Mar 12 01:05:17 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dl/sym.c (rb_dlsym_inspect): Use "0x%x" rather for pointers.
+ This might not be very right but it is commonly used in other
+ parts of the code; submitted by sheepman <sheepman AT
+ sheepman.sakura.ne.jp> in [ruby-dev:30532].
+
+ * ext/dl/ptr.c (rb_dlptr_inspect): Ditto.
+
+Mon Mar 12 00:59:19 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dl/lib/dl/import.rb (DL::Importable::Internal::import,
+ DL::Importable::Internal::callback): Avoid race condition for an
+ instance variable; submitted by sheepman <sheepman AT
+ sheepman.sakura.ne.jp> in [ruby-dev:30530].
+
+Sun Mar 11 18:57:50 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/README: Add a note about ruby-electric.el.
+
+ * misc/ruby-mode.el (ruby-non-block-do-re): Fix
+ ruby-non-block-do-re. [ruby-core:03719]
+
+ * misc/inf-ruby.el: Synchronize the comment section with trunk.
+
+ * misc/README, misc/rdebug.el: Add rdebug.el, Emacs ruby-debug
+ interface based on rubydb3x.el; submitted by Martin Nordholts
+ <enselic AT gmail.com> in [ruby-bugs:PR#9023].
+
+Sun Mar 11 17:45:51 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dl/mkcallback.rb (mkfunc): Make sure that a callback
+ function is found in the function table before trying to call
+ it; submitted by sheepman <sheepman AT sheepman.sakura.ne.jp>
+ in [ruby-dev:30524].
+
+Sun Mar 11 12:09:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (error_handle): no message when exiting by signal.
+
+ * eval.c (ruby_cleanup): re-send signal. [ruby-dev:30516]
+
+ * eval.c (rb_thread_interrupt): instantiate SignalException.
+
+ * eval.c (rb_thread_signal_raise): now takes signal number instead
+ of signal name.
+
+ * intern.h (rb_thread_signal_raise, ruby_default_signal): prototypes.
+
+ * signal.c (esignal_init): takes a signal number and an optional
+ signal name.
+
+ * signal.c (interrupt_init): pass SIGINT always.
+
+ * signal.c (ruby_default_signal): invoke system default signal
+ handler.
+
+ * signal.c (rb_signal_exec, trap): handle SIGTERM. [ruby-dev:30505]
+
+Tue Mar 6 19:08:46 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/md5.rb (MD5::new, MD5::md5): Do not modify
+ Digest::MD5.
+
+ * ext/digest/lib/sha1.rb (SHA1::new, SHA1::sha1): Ditto.
+
+Tue Mar 6 18:58:37 2007 Keiju Ishitsuka <keiju@ruby-lang.org>
+
+ * lib/shell/process-controller.rb: fix thread synchronization
+ problem for [ruby-dev:30477].
+
+Tue Mar 6 18:44:26 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/md5.rb (MD5::new, MD5::md5): Catch up with
+ Digest's API changes; noted by: Kazuhiro Yoshida <moriq AT
+ moriq.com> in [ruby-dev:30500].
+
+ * ext/digest/lib/sha1.rb (SHA1::new, SHA1::sha1): Ditto.
+
+Tue Mar 6 18:24:19 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * time.c (time_to_s): Back out the format changes; discussed
+ in [ruby-dev:30495].
+
+Tue Mar 6 11:53:25 2007 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/irbtkw.rbw: fails to exit process.
+
+Mon Mar 5 20:14:49 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * time.c (time_to_s): Correct the wrong format which did not
+ really conform to RFC 2822; pointed out by: OHARA Shigeki <os at
+ iij.ad.jp> in [ruby-dev:30487].
+
+Sun Mar 4 23:38:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_stat_s_utime): fixed a commit miss for the platforms
+ where utimes() does not exist.
+
+ * lib/fileutils.rb (touch): ditto.
+
+Sun Mar 4 14:46:56 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * util.c (push_element): should return a int value.
+
+Sun Mar 4 01:05:57 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#^, Set#&): Correct documentation. Those methods
+ return sets, not arrays; noted by Oliver Frank Wittich <nietz AT
+ mangabrain.de>.
+
+Sat Mar 3 23:01:07 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (mv): could not move a directory between
+ different filesystems. [ruby-dev:30411]
+
+Sat Mar 3 22:57:11 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (touch): last commit causes error if :mtime
+ option was not given.
+
+Sat Mar 3 22:37:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_utime): allow nil to set the current time.
+
+ * lib/fileutils.rb (touch): ditto, and added :mtime and :nocreate
+ options. fixed: [ruby-talk:219037]
+
+Sat Mar 3 21:17:35 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 19:05:31 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c (push_list): Use ALLOC().
+
+ * ext/thread/thread.c (rb_mutex_alloc): Ditto.
+
+ * ext/thread/thread.c (rb_condvar_alloc): Ditto.
+
+Sat Mar 3 18:53:11 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Add a note for String#intern.
+
+Sat Mar 3 16:23:13 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 16:07:02 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * object.c (rb_obj_ivar_set): RDoc updated according to a
+ suggestion from Brian Candler <B.Candler AT pobox.com>.
+ [ruby-core:10469]
+
+Thu Mar 1 21:38:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (stmt, arg): should not omit lhs of OP_ASGN1 even if
+ empty. [ruby-dev:30455]
+
+Thu Mar 1 08:55:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_feature_p): check loading_tbl if the given ext is
+ empty. [ruby-dev:30452]
+
+ * eval.c (rb_feature_p): fix possible buffer overrun.
+
+Thu Mar 1 03:30:21 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (get_digest_base_metadata): Allow inheriting
+ Digest::Base subclasses, which was unintentionally made
+ impossible while restructuring Digest classes.
+
+Thu Mar 1 02:05:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * mkconfig.rb (patchlevel): read from version.h.
+
+Thu Mar 1 00:09:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_provided): return true only for features loaded from
+ .rb files, and not search actual library type. [ruby-dev:30414]
+
+Wed Feb 28 21:15:00 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (ac_cv_func_fcntl): fcntl support for MinGW.
+
+ * missing/flock.c: workaround for MinGW.
+
+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 18:59:57 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Add NEWS, a document file to keep user visible feature
+ changes between releases.
+
+Wed Feb 28 18:35:50 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/extconf.rb: no need to check unistd.h and sys/time.h.
+ they are already checked at configure.
+ reported by KOBAYASHI Yasuhiro [ruby-list:43225]
+
+Wed Feb 28 18:34:48 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb ($DEFLIBPATH): default library paths ($(topdir), etc)
+ should be the first elements of library paths list.
+ reported by KOBAYASHI Yasuhiro [ruby-list:43225]
+
+Wed Feb 28 18:31:32 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * doc/NEWS-1.8.0: Rename NEWS to NEWS-1.8.0. This is way too old
+ NEWS.
+
+Wed Feb 28 01:22:58 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/{dbm,gdbm}/test_{dbm,gdbm}.rb: shouldn't use host_os. use
+ target_os instead. reported by KOBAYASHI Yasuhiro [ruby-list:43225]
+
+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 22:18:45 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (--enable-auto-image-base): avoid the neccessity to
+ rebase the shared libs as much as possible;
+ submitted by Corinna Vinschen <spam at vinschen.de> in
+ [ruby-talk:240964].
+
+Tue Feb 27 21:36:47 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * util.c (__crt0_glob_function): use ruby_glob() instead of rb_globi().
+
+Tue Feb 27 21:33:04 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (ac_cv_func_setrlimit): workaround for djgpp.
+
+Tue Feb 27 19:38:52 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/base64.rb (Base64::b64encode): Fix documentation; submitted
+ by David Symonds <dsymonds@gmail.com> in [ruby-core:10432].
+
+Tue Feb 27 19:36:57 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * regex.c (calculate_must_string, slow_search, re_search): Silence
+ warnings regarding char * vs. unsigned char * mismatch;
+ submitted by Lyle Johnson <lyle.johnson@gmail.com>
+ in [ruby-core:10416].
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_load): Ditto.
+
+ * ext/digest/sha1/sha1ossl.c (SHA1_Finish): Ditto.
+
+ * ext/digest/rmd160/rmd160ossl.c (RMD160_Finish): Ditto.
+
+ * ext/digest/digest.c (rb_digest_base_finish,
+ rb_digest_base_update): Ditto.
+
+ * ext/nkf/nkf.c (rb_str_resize, rb_nkf_kconv, rb_nkf_guess1,
+ rb_nkf_guess2): Ditto.
+
+Tue Feb 27 03:40:09 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock):
+ Eliminate rb_thread_critical switching where unnecessary;
+ implied by shugo in [ruby-dev:30412].
+
+ * ext/thread/thread.c (set_critical): Merge in
+ thread_exclusive_ensure().
+
+ * ext/thread/thread.c: Consistently use 0 and 1 for
+ rb_thread_critical values.
+
+Mon Feb 26 15:18:23 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c: Use xmalloc()/xfree() instead of
+ malloc()/free(); pointed out by shugo in [ruby-dev:30412].
+
+Sun Feb 25 23:02:55 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::initialize):
+ Initialize @workdir properly to silence a warning under -w.
+ Submitted by <tommy at tmtm.org> in [ruby-dev:30400].
+
+Sun Feb 25 02:47:43 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * defines.h: Pull the RUBY_MBCHAR_MAXSIZE definition from trunk,
+ which is necessary for dir.c to compile on djgpp and emx.
+
+Sat Feb 24 10:42:01 2007 Minero Aoki <aamine@loveruby.net>
+
+ * ext/racc/cparse/cparse.c (cparse_params_mark): remove useless
+ rb_gc_mark. Thanks Tomoyuki Chikanaga. [ruby-dev:30405]
+
+Fri Feb 23 15:10:46 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.
+
+Fri Feb 23 14:19:40 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * signal.c (sighandler): need to tell to be interrupted to main
+ context when handler is installed.
+
+ * win32/win32.[ch] (rb_win32_interrupted): new function to listen
+ interrupt.
+
+Fri Feb 23 13:02:17 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (fix_cmp, fix_equal): Remove FIX2LONG() to optimize.
+ suggested in
+ http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html.
+ [ruby-talk:240223]
+
+Fri Feb 23 12:43:17 2007 James Edward Gray II <james@grayproductions.net>
+
+ * lib/xmlrpc/client.rb (XMLRPC::Client::do_rpc): Make the
+ Content-Length parameter optional for responses in
+ xmlrpc/client.rb; suggested by Daniel Berger
+ <Daniel.Berger@qwest.com> and approved by the maintainer.
+
+ * lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): Add DateTime
+ support to xmlrpc; approved by the maintainer.
+
+Mon Feb 19 18:22:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in, defines.h, eval.c (rb_feature_p, rb_provided,
+ load_wait, search_required, rb_require_safe), ext/extmk.rb: Fix
+ a bug where a statically linked extension cannot be autoloaded.
+ [ruby-dev:30023] / [ruby-dev:30239]
+
+Mon Feb 19 17:14:28 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (unix_peeraddr): wrong syscall name in error
+ message for #peeraddr. a patch from Sam Roberts
+ <sroberts at uniserve.com>. [ruby-core:10366]
+
+Sun Feb 18 19:35:21 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: updated based on date2 4.0.3.
+
+Fri Feb 16 11:18:21 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/.document: Apply patch for irb, e2mmap and README by Hugh Sasse
+ <hgs at dmu.ac.uk> from [ruby-core:10135]
+
+ * lib/prettyprint.rb: Suppress RDoc for PrettyPrint test suite.
+
+Thu Feb 15 20:26:30 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/uri/ftp.rb: Revert the previous change pending discussion.
+
+Thu Feb 15 18:08:17 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * dir.c (glob_helper): Fix the function declaration.
+
+Thu Feb 15 17:13:32 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * version.h: Welcome to the post-1.8.6 world. Radical changes are
+ inhibited in the ruby_1_8 branch until the 1.8.6 final release
+ goes out of the door.
+
+Thu Feb 15 16:44:14 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/uri/generic.rb (URI::Generic::userinfo): Considering how
+ `scheme://user:@...', `scheme://:password@...' and
+ `scheme://:@...' are parsed, an empty user name or password
+ should be allowed and represented as it is.
+
+Thu Feb 15 11:46:05 2007 KIMURA Koichi <hogemuta@gmail.com>
+
+ * dir.c, win32/win32.c, win32/dir.h, ruby.h, intern.h: Bring
+ encoding aware globbing support in from trunk. Dir.[] and
+ Dir.glob() can now take many patterns in an array. Minor fixes
+ will follow.
+
+Thu Feb 15 11:00:26 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/uri/generic.rb (URI::Generic::userinfo): should support
+ empty password. [ruby-core:10290]
+
+ * lib/uri/generic.rb (URI::Generic::set_password): password can be
+ cleared by nil. [ruby-core:10290]
+
+ * lib/uri/common.rb (escape): regard second string argument as a
+ character set properly. [ruby-dev:27692]
+
+ * lib/uri/ftp.rb: Attempt to conform to RFC 1738 with regard to
+ relative/absolute paths.
+
+ * lib/uri: Lovely RDOC patches from mathew (metaATpoboxDOTcom).
+
+Thu Feb 15 10:57:38 2007 Tietew <tietew@tietew.net>>
+
+ * lib/cgi.rb (CGI::unescapeHTML): invalid decoding for single
+ unescaped ampersand. a patch from Tietew
+ <tietew+ruby-dev at tietew.net> in [ruby-dev:30292].
+ fixed: [ruby-dev:30289]
+
+Thu Feb 15 10:48:40 2007 MenTaLguY <mental@rydia.net>
+
+ * ext/thread/thread.c: Handle interrupted waits correctly.
+ [ruby-bugs:PR#8663]
+
+Wed Feb 14 19:22:15 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/digest.rb (Digest::self.const_missing): Drop
+ autoloads for sha2 classes in favor of handling in
+ const_missing(), to work around a problem exposed on OS X.
+
+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]
+
+Sun Feb 11 07:46:45 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::read_multipart): Properly parse
+ a quoted-string in a Content-Disposition value.
+
+Sun Feb 11 06:27:54 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in, ext/thread/extconf.rb, lib/thread.rb: Add a
+ configure option `--disable-fastthread', to choose the original,
+ pure ruby version of the "thread" library instead of the new,
+ much faster implementation in ext/thread.
+
+Sun Feb 11 06:22:20 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Setup: Add thread except for platforms without threads
+ support.
+
+Sun Feb 11 06:15:16 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/lib/thread.rb: Add a replacement of thread.rb that
+ loads this extension.
+
+Sun Feb 11 05:39:47 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/thread.rb: Remove an ineffective part of the code.
+
+Sun Feb 11 05:32:54 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c (rb_thread_exclusive): Implement
+ Thread.exclusive.
+
+Sun Feb 11 05:26:51 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread/thread.c: Get rid of use of a dummy function.
+
+Sun Feb 11 01:45:31 2007 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/thread/thread.c (Init_thread): Define missing aliases:
+ Queue#enq and SizedQueue#enq.
+
+Sat Feb 10 09:27:35 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_variant2val): fix compile error
+ on VC++.
+
+Sat Feb 10 07:41:52 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_variant2val): fix the bug when
+ SAFEARRAY pointer is NULL.
+
+Sat Feb 10 00:13:11 2007 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: fix typo (TkConfigMethod::__confinfo_cmd,
+ __conv_keyonly_opts).
+
+Fri Feb 9 20:44:53 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread: Make style fixes (mostly de-K&R'ism) to match the
+ rest of the source code.
+
+ * ext/thread: Make USE_MEM_POOLS an extconf option.
+
+Fri Feb 9 20:43:01 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/thread: Import the "fastthread" implementation by MenTaLguY
+ in the original form. This module is not hooked into the build
+ yet since it needs some style fixes and adjustments.
+
+Fri Feb 9 15:46:09 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/bigdecimal: Synchronize with trunk. Better function
+ prototypes, removal of a useless method `!=', and document
+ updates.
+
+Tue Feb 06 22:06:45 2007 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf-utf8/{nkf.c,utf8tbl.c}:
+ imported nkf 2007-01-28.
+ * Fixed: can't decode MIME encode JIS string.
+ * Fixed: Fullwitdh-halfwidth conversion.
+ * Support DoCoMo's and Softbank's EMOJI
+ * Support CP932, CP5022x, eucJP-ms UDC
+ * Support UTF-32 encoding
+ * Support beyond BMP
+ [ruby-dev:29700] [ruby-dev:29922] [ruby-dev:30144]
+
+Wed Jan 31 14:52:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_iterate): need to PUSH_ITER in proper order.
+ [ruby-core:10125]
+
+ * test/ruby/test_iterator.rb (TestIterator::test_block_given_within_iterator):
+ add new test. [ruby-core:10125]
+
+Tue Jan 30 14:58:51 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)
+
+Tue Jan 30 12:05:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * mkconfig.rb: autoconf 2.61 support. [ruby-core:10016]
+
+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.
+
+Fri Jan 26 12:03:39 2007 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb (TkConfigMethod#__confinfo_cmd,
+ __conv_keyonly_optkeys): make them private [ruby-dev:30074].
+
+ * ext/tk/lib/tk/txtwin_abst.rb: fix typo [ruby-dev:30073].
+
+ * ext/tk/lib/tk/canvas.rb (TkCanvas#scan_dragto): lack of an argument.
+
+ * ext/tk/lib/tk/canvas.rb: clarify the including module name
+ [ruby-dev:30080].
+
+ * ext/tk/lib/tk/scrollable.rb: change primary name of modules
+ [ruby-dev:30080].
+
+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]
+
+Tue Jan 23 11:02:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/webrick/httprequest.rb (WEBrick::HTTPRequest::read_line):
+
+Tue Jan 23 18:26:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::read_multipart): use == instead
+ of ===. [ruby-dev:30176]
+
+Tue Jan 23 10:48:17 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c: added documentation for Hash about how it uses eql? and
+ hash methods for the keys. [ruby-core:09995]
+
+Mon Jan 22 14:57:25 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c: fix errors in socket sample code.
+ [ruby-core:09992]
+
+Sat Jan 13 23:54:48 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]
+
+Fri Jan 12 11:13:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/etc/etc.c (etc_getpwuid, etc_getgrgid): fix to correctly
+ convert uid/gid from VALUE. (backport of r11521)
+
+Wed Jan 10 18:57:57 2007 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c (strscan_do_scan): should set kcode option
+ before match. [ruby-dev:29914]
+
+ * test/strscan/test_stringscanner.rb: test it.
+
+ * re.c: export kcode_set_option and kcode_reset_option (with "rb_"
+ prefix).
+
+ * intern.h: ditto.
+
+Tue Jan 9 17:45:17 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (rb_find_file): should not call fpath_check() with NULL.
+ fixed: [ruby-core:09867]
+
+Tue Jan 9 03:54:38 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_upto): String#upto from empty string makes
+ inifinite loop. [ruby-core:09864]
+
+Sun Jan 7 12:13:26 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#find_class_comment):
+ Look for class and module comments above rb_define_class and
+ rb_define_module. Patch by Daniel Berger <djberg96 at gmail.com>
+
+Sun Jan 7 10:32:12 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#handle_constants):
+ Properly handle escaping of : in comments.
+ * test/rdoc/parsers/test_parse_c.rb:
+ Test RDoc::C_Parser#do_classes and Rdoc::C_Parser#find_class_comment.
+
+Sun Jan 7 09:33:02 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: updated based on date2 4.0.1.
+
+Wed Jan 3 11:36:51 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (ruby_dup): start GC on ENOMEM as well.
+
+Mon Jan 1 06:13:11 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parsers/c_parser.rb: Make Rdoc accessible. Update constant
+ value information.
+
+Mon Jan 1 06:13:11 2007 Eric Hodel <drbrain@segment7.net>
+
+ * ext/bigdecimal/bigdecimal.c: Update constant comments to provide
+ values for RDoc.
+
+Mon Jan 1 06:05:55 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#handle_constansts):
+ Allow RDoc comment to give friendly value for rb_define_const. Patch
+ by Daniel Berger <djberg96 at gmail.com>, [ruby-patches-7499].
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser#handle_constansts): Fix
+ whitespace handling in constant comments.
+
+Sun Dec 31 00:31:16 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 4.0.
+
+Thu Dec 14 18:29:13 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/readline/readline.c: NetBSD editline does not have
+ rl_username_completion_function() and rl_completion_matches().
+ a patch from Takahiro Kambe <taca at back-street.net>.
+ [ruby-dev:30008]
+
+Thu Dec 14 18:20:43 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/irb/locale.rb (IRB::Locale::puts): typo fixed. a patch from
+ NAKAMURA Usaku <usa@ruby-lang.org>. [ruby-dev:30012]
+
+Mon Dec 11 11:58:36 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/sha2/lib/sha2.rb: Moved one level up from under
+ the superfluous subdirectory digest/.
+
+Mon Dec 11 11:46:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_define_const): typo fixed.
+
+Mon Dec 11 09:36:29 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_aset): index double decode problem.
+ [ruby-core:09695]
+
+Sat Dec 9 21:39:24 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): keep the exception till after END blocks.
+ [ruby-core:09675]
+
+Sat Dec 9 11:22:00 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/irb/locale.rb (IRB::Locale::search_file): ues File.exist?
+ instead of File.exists?. a patch from Yutaka Kanemoto
+ <kinpoco at gmail.com> in [ruby-dev:30000].
+
+Thu Dec 7 09:29:02 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/weakref.rb (WeakRef::__setobj__): should support
+ marshaling. [ruby-talk:228508]
+
+ * lib/delegate.rb (Delegator::marshal_load): need to call
+ __setobj__.
+
+Wed Dec 6 23:56:14 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, common.mk (NULLCMD): moved for platforms that empty
+ command does not run. fixed: [ruby-dev:29994]
+
+Wed Dec 6 17:17:26 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]
+
+Tue Dec 5 00:59:05 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): need to parse "/=" as
+ self assignment operator, not regex. [ruby-talk:227324]
+
+Mon Dec 4 10:48:03 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.h (OFFT2NUM): use LONG2NUM() if sizeof(long) equals to
+ sizeof(off_t).
+
+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 08:32:49 2006 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::read_multipart): should quote
+ boundary. JVN#84798830
+
+Sat Dec 2 07:09:04 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ocsp.c: OpenSSL::OCSP::OSCPError should be
+ subclass of OpenSSL::OpenSSLError. [ruby-dev:29980]
+
+Fri Dec 1 17:01:49 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * gc.c (ruby_init_stack): decrease "stack level too deep" in Windows.
+ merge from trunk.
+
+Fri Dec 1 16:31:53 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c: shouldn't run the killed thread at callback.
+ [ruby-talk: 227408]
+
+Mon Nov 27 17:18:27 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): need not to truncate string if no
+ width specifier given for %s. [ruby-dev:29952]
+
+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 23 10:38:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_define_method): set implicit visibility only when
+ it's called for the target class (ruby_cbase).
+
+Wed Nov 22 16:00:49 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/extconf.rb: support --with-X11/--without-X11 option.
+
+ * ext/tk/README.tcltklib: add description about --with-X11-* option
+ [ruby-talk:225166] and --with-X11/--without-X11 option.
+
+ * ext/tk/tkutil/extconf.rb: able to be called manually
+ [ruby-talk:225950].
+
+Wed Nov 15 23:22:54 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (test_grpowned, rb_stat_grpowned): should honor
+ supplementary group IDs. [ruby-core:09546]
+
+Thu Nov 9 03:15:22 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (BEGIN_CALLARGS): ruby_block may be NULL even when
+ ITER_PRE.
+
+Tue Nov 7 18:34:34 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/digest/hmac.rb: Keep this out of the 1.8 tree
+ until we reach a consensus that HMAC should be put under Digest.
+
+Tue Nov 7 18:05:01 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/itemconfig.rb: minor bug fix.
+
+Mon Nov 6 20:11:20 2006 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/0.9.rb (RSS::Rss): removed needless include.
+
+Mon Nov 6 15:41:55 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/itemconfig.rb: ext/tk/lib/tk/itemconfig.rb: bug
+ fix on 'itemconfiginfo' method, and modify to make it easy to
+ override 'itemconfiginfo' method.
+
+ * ext/tk/lib/tkextlib/tile/treeview.rb : support Tile 0.7.8.
+
+ * ext/tk/lib/tkextlib/version.rb : [new] add Tk::Tkextlib_RELEASE_DATE
+ to get the information from scripts.
+
+ * ext/tk/lib/tk.rb: load 'tkextlib/version.rb', and update RELEASE_DATE
+
+ * ext/tk/lib/tkextlib/SUPPORT_STATUS: update.
+
+ * ext/tk/sample/editable_listbox.rb: [new] the listbox with editable
+ items. It's one of the example about usage of Place geometry manager.
+
+ * ext/tk/sample/tktextio.rb: improve the functions of TkTextIO class.
+ Those are required by 'irbtkw.rbw'.
+
+ * ext/tk/sample/irbtkw.rbw: [new] IRB on Ruby/Tk. It doesn't need any
+ real console. IRB works on a text widget without I/O blocking. That
+ is, thread switching on IRB will work properly, even if on Windows.
+
+Sun Nov 5 19:53:49 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: updated based on date2 3.9.7.
+
+Sat Nov 4 13:13:57 2006 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: accept NOMODSEQ. [ruby-core:9002]
+ (backported from HEAD)
+
+Fri Nov 3 00:16:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_getnameinfo__aix): AF_INET6 workaround
+ for AIX. a patch from Yutaka Kanemoto <kinpoco AT gmail.com>.
+ [ruby-dev:29744]
+
+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]
+
+Thu Nov 2 14:48:30 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#^): Fix XOR operation against a container that
+ holds duplicate values. [issue: #6444]
+
+Wed Nov 1 02:41:38 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/digest/hmac.rb (Digest::HMAC::update): Minor
+ optimization.
+
+ * ext/digest/digest.c (rb_digest_instance_equal): Allow comparing
+ a digest instance with another of a different class.
+
+Wed Nov 1 01:05:13 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * eval.c (rb_call0): fixed bug of zsuper with both of opt and rest.
+ fixed: [ruby-list:42928]
+
+ * test/ruby/test_super.rb: add tests to check above bug.
+
+Tue Oct 31 17:03:21 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_dup): duplicate the class of original time.
+ [ruby-core:09357]
+
+ * lib/time.rb (Time::make_time, Time::rfc2822, Time::httpdate):
+ should respect subclasses. [ruby-core:09357]
+
+Mon Oct 30 23:40:52 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (miniruby): add XLDFLAGS.
+
+ * configure.in (aix): use -bE option for miniruby. [ruby-dev:29698]
+
+ * 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.
+
+Mon Oct 30 19:29:20 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): use better approximation.
+
+Mon Oct 30 18:35:33 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): wrong allocation length. a patch from
+ U.Nakamura <usa at garbagecollect.jp> [ruby-dev:29710]
+
+Mon Oct 30 12:34:02 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): fix commit miss. [ruby-dev:29707]
+
+Mon Oct 30 12:20:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): a bug in length adjustment.
+
+Mon Oct 30 11:15:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_str_format): should preserve leading zero
+ information for negative %b and %x. [ruby-talk:221347]
+
+Thu Oct 26 21:05:58 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_verify): should clear error.
+ (fix http://bugs.debian.org/394336)
+
+ * ext/openssl/ossl_ns_spki.c (ossl_spki_initialize): ditto.
+
+Thu Oct 26 15:21:10 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/digest/digest.c (Init_digest): typo.
+
+Wed Oct 25 17:23:28 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest, test/digest/test_digest.rb: Merge from trunk:
+ - Introduce versioning in Digest::Base API, and prefix C
+ constants with RUBY_ and C type names with rb_ to avoid name
+ clash in writing extensions.
+ - Introduce Digest::Class and Digest::Instance for ease of
+ implementing subclasses and add-ons.
+ - Digest::Instance module requires and assumes that any instance
+ be resettable and clonable. An instance method #new() is
+ added so digest instances work just like digest classes.
+ - The constructor does no longer take an initial string to feed;
+ digest() and hexdigest() now do, instead. This allows digest
+ classes to take their own hashing parameters.
+ - Make some changes to digest() and hexdigest() class methods,
+ which now take extra arguments, which are passed through to
+ the constructor in an internal call.
+ - Add #digest_length/size/length() and #block_length(),
+ - Add the Digest::SHA2 class to wrap up SHA2 variants: SHA256,
+ SHA384 and SHA512, hoping this module would make a decent
+ example of a digest subclass written in Ruby.
+ - Rip BubbleBabble support out of the base class and have a
+ separate module named digest/bubblebabble.
+ - Remove RD documents in favor of newly written and embedded
+ RDoc documentation.
+
+Wed Oct 25 08:03:23 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: updated based on date2 3.9.6.
+ [ruby-core:09323]
+
+Sun Oct 22 14:48:31 2006 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]
+
+ * signal.c (Init_signal): avoid duplicated installation of SIGCHLD
+ handler.
+
+Sun Oct 22 16:47:56 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_substr): should be infected with only original
+ string, but not the shared string. fixed: [ruby-core:09152]
+
+ * string.c (rb_str_new4): keep shared string untainted when orignal
+ string is tainted. fixed: [ruby-dev:29672]
+
+Sun Oct 22 05:20:34 2006 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
+
+ * configure.in: alloca is broken; use C_ALLOCA instead.
+ [ruby-dev:29416]
+
+Fri Oct 20 10:47:43 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb: fixed the bug of handling COMMON_MACROS.
+
+Fri Oct 20 08:42:38 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (NULLCMD): dummy command.
+
+ * bcc32/Makefile.sub (post-install-*): Borland make cannot ignore
+ command-less double-colon rules. [ruby-dev:29676]
+
+Fri Oct 20 00:37:07 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bcc32/Makefile.sub ($(LIBRUBY_SO)): execute pre-link hook.
+
+ * ext/extmk.rb: workaround for Borland make.
+
+Wed Oct 18 23:02:40 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_shift): shorten copy size. fixed: [ruby-list:42907]
+
+ * signal.c (Init_signal): handle SIGTERM. fixed: [ruby-list:42895]
+
+ * win32/win32.c (rb_w32_utime): allow NULL to set the current time.
+ [ruby-talk:219248]
+
+Wed Oct 18 00:55:33 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): use particular enums. [ruby-core:09221]
+
+Mon Oct 16 08:30:43 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * mkconfig.rb: *OBJS are not needed for extension libraries.
+
+ * {bcc32,wince,win32}/Makefile.sub (config.status): fixed typo,
+ missing comma.
+
+Sun Oct 15 01:03:08 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/collector/dir.rb (Collector::Dir#collect): append base
+ directory but not prepend.
+
+ * lib/test/unit/collector/dir.rb (Collector::Dir#collect_file): do not
+ join with dot. fixed: [ruby-core:09179]
+
+Sat Oct 14 23:39:50 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (singleton): no need to re-create NODE_SELF() again.
+ [ruby-core:09177]
+
+Sat Oct 14 23:25:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (parser_warning, parser_warn): some error message may
+ contain format specifiers. a patch from Akinori MUSHA <knu at
+ iDaemons.org>. [ruby-dev:29657]
+
+ * ext/bigdecimal/bigdecimal.c (VpException): ditto.
+
+ * ext/dl/handle.c (rb_dlhandle_initialize): ditto.
+
+ * ext/gdbm/gdbm.c (rb_gdbm_fatal): ditto.
+
+Sat Oct 14 08:24:45 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/digest/hmac: Back out the addition of digest/hmac
+ for now because the API is too premature for a stable branch.
+
+Sat Oct 14 00:55:08 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bcc32/Makefile.sub (post-install-ext): no longer needed.
+
+ * bcc32/configure.bat: get rid of a quirk of Borland make, which
+ sets empty macro in command line to "1".
+
+Fri Oct 13 22:50:43 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: updated based on date2 3.9.5.
+
+Fri Oct 13 22:33:28 2006 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (FileUtils.cp_r): dereference_root=true is
+ default in Ruby 1.8. This line is wrongly removed in last commit.
+
+Fri Oct 13 18:19:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c: Class#inherited RDoc added. a patch from Daniel
+ Berger <djberg96 at gmail.com> [ruby-core:08942]
+
+Fri Oct 13 02:30:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/collector/dir.rb (Collector::Dir#collect): prepend
+ base directory to load path.
+
+ * lib/test/unit/collector/dir.rb (Collector::Dir#collect_file): should
+ use the given File-like interface, but not File directly.
+
+ * test/testunit/collector/test_dir.rb (TestDir::FileSystem): implement
+ File-like methods correctly.
+
+Fri Oct 13 01:48:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/date.rb (Date::self.complete_hash): need to check if g is
+ nil before dereference. [ruby-core:09116]
+
+Fri Oct 13 00:34:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_mod_cvar_defined): wrong id check. a patch from
+ Mauricio Fernandez <mfp at acm.org>. [ruby-core:09158]
+
+ * object.c (rb_mod_cvar_get): typo fixed. [ruby-core:09168]
+
+ * object.c (rb_mod_cvar_set): ditto.
+
+Wed Oct 11 22:21:41 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest: Merge from trunk; metadata location changed,
+ Digest::Base#reset() added, Digest::Base#equal() changed, and
+ digest/hmac added with some modifications made for ruby 1.8.
+
+Tue Oct 10 17:24:12 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {bcc32,win32,wince}/Makefile.sub (config.status): shouldn't use
+ copy command instead of install. use -run install.
+
+Tue Oct 10 16:49:16 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (hexdigest_str_new, bubblebabble_str_new):
+ Perform StringValue() checks properly.
+
+ * ext/digest/digest.c: Use RSTRING_{PTR,LEN} macros.
+
+Tue Oct 10 13:49:53 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest: Merge from trunk; apply all changes since the
+ initial import, except for the removal of compatibility stub
+ libraries (md5.rb and sha1.rb).
+
+Mon Oct 9 23:46:29 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/parsedate.rb: documentation patch from Konrad Meyer
+ <konrad.meyer@gmail.com>. [ruby-doc:1238]
+
+ * lib/open3.rb, lib/ping.rb: ditto.
+
+Mon Oct 9 22:56:12 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/rexml/encoding.rb (REXML::Encoding::check_encoding): spaces
+ are allowed around equal sign. [ruby-core:09032]
+
+ * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser): ditto.
+
+Sat Oct 7 23:53:08 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_scan): small documentation fix.
+ [ruby-core:09007]
+
+Sat Oct 7 23:44:33 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_rshift): a bug in right shift of negative
+ bignums. [ruby-core:09020]
+
+Sat Oct 7 00:27:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_include_module): remove unnecessary check.
+ [ruby-talk:218402]
+
+Fri Oct 6 04:30:30 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * sample/openssl/c_rehash.rb: Use digest/md5 instead of obsolete md5.
+
+Wed Oct 4 18:47:25 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/*: bugfix and update
+ (see ext/tk/ChangeLog.tkextlib).
+
+Wed Oct 4 17:25:14 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call): check protected visibility based on real self,
+ not ruby_frame->self. [ruby-talk:217822]
+
+Wed Oct 4 08:52:30 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/optparse/test_getopts.rb: changed the class name of test case
+ to get rid of conflict with test_optparse.rb.
+
+Tue Oct 3 23:32:27 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/testcase.rb (Test::Unit::TestCase.suite): test name
+ must be string. fixed: [ruby-core:08978]
+
+Mon Oct 2 23:47:55 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::COLLECTORS):
+ base directory should be lower precedence. fixed: [ruby-dev:29622]
+
+ * lib/test/unit/autorunner.rb (Test::Unit::AutoRunner#options): typo.
+
+ * lib/test/unit/collector/dir.rb (Test::Unit::Collector::Dir#collect_file):
+ load expanded path. fixed: [ruby-dev:29621]
+
+Mon Oct 2 15:49:19 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * instruby.rb: batfile should be CRLF'ed.
+
+Mon Oct 2 01:24:26 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (test-all): separate directory where running test cases
+ from source tree.
+
+ * lib/test/unit/autorunner.rb (options): added --basedir, --workdir
+ and --load-path options.
+
+ * lib/test/unit/collector/dir.rb (recursive_collect, collect_file):
+ base directory support.
+
+Sun Oct 1 23:56:52 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, common.mk, ext/extmk.rb, win{32,ce}/Makefile.in: keep
+ LIBRUBY_SO unless need to be removed.
+
+Sun Oct 1 23:12:19 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#make_switch): pass arguments directly.
+
+Sat Sep 30 15:12:25 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 3.9.4.
+
+Fri Sep 29 12:11:04 2006 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * jcode.rb (succ!): call original succ! if $KCODE == 'n'.
+ fixed: [ruby-talk:216845]
+
+Fri Sep 29 11:43:40 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_func): revert fallback checking undeclared function.
+ fixed: [ruby-core:08949]
+
+Fri Sep 29 09:56:56 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: extout is needed for also clean.
+ fixed: [ruby-core:08944]
+
+ * lib/optparse.rb (OptionParser::Switch#conv_arg): unsplat by
+ Proc#call if no conversion is given.
+
+Thu Sep 28 23:59:31 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * node.h (struct thread): declare win32_exception_list on cygwin and
+ win32 regardless if it is implemented. Provisional fix for
+ [ruby-core:08917].
+
+Thu Sep 28 20:53:16 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/tmpdir.rb: use return value of getdir.call for length.
+
+Wed Sep 27 01:04:49 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_func): check function pointer first and macro next.
+
+ * lib/mkmf.rb (have_type): simplified with typedef and sizeof.
+
+Tue Sep 26 23:57:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#getopts): use strings as key.
+ fixed: [ruby-dev:29614]
+
+Tue Sep 26 15:31:26 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {win32,wince}/Makefile.sub (CPP): check predefined value.
+
+Tue Sep 26 07:55:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_shift): should not move memory region if array
+ body is shared. a patch from Kent Sibilev <ksruby at gmail.com>.
+ [ruby-core:08922]
+
+Mon Sep 25 22:26:26 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_path_end): skip root directory. fixed: [ruby-core:08913]
+
+ * lib/mkmf.rb (init_mkmf): set default $LDFLAGS. Patch by Michal
+ Suchanek <hramrach at centrum.cz>. [ruby-talk:216256]
+
+Mon Sep 25 08:14:43 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_shift): should clear shifting top element.
+ [ruby-talk:216055]
+
+ * array.c (rb_ary_shift): avoid creating shared object if array
+ size is small.
+
+Mon Sep 25 08:11:35 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * random.c (rb_f_rand): RDoc typo fix. a patch from Frederick
+ Cheung <fred at 82ask.com>. [ruby-talk:216047]
+
+Sun Sep 24 22:28:20 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * runruby.rb: extension library scripts moved into common directory.
+
+Sun Sep 24 14:59:50 2006 Tanaka Akira <akr@fsij.org>
+
+ * node.h (struct thread): ia64 support is broken by sandbox patch.
+
+Sun Sep 24 12:11:16 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 3.9.3.
+
+Sat Sep 23 23:24:57 2006 why the lucky stiff <why@ruby-lang.org>
+
+ * eval.c (rb_thread_save_context, rb_thread_restore_context):
+ sandbox hook to save and restore sandbox state.
+
+ * eval.c (thread_no_ensure): added THREAD_NO_ENSURE thread flag.
+
+ * eval.c (rb_thread_kill_bang): Thread#kill! uses the above flag
+ to circumvent ensure, in order to prevent endless loops.
+ [ruby-core:08768]
+
+ * eval.c (rb_thread_kill): fix Thread#kill docs, which returns
+ the thread object in all cases.
+
+ * node.h: expose the rb_jmpbuf_t and rb_thread_t structs, along
+ with the thread flags. used by the sandbox extension.
+
+ * ruby.h: extern rb_eThreadError, so sandbox can swap it.
+
+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>.
+
+Sat Sep 23 08:35:53 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/rdoc/ri/ri_options.rb: prevent NameError. [ruby-dev:29597]
+
+Sat Sep 23 01:04:20 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 3.9.2.
+
+Fri Sep 22 02:06:26 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * .cvsignore: ignore timestamp files and installed list file.
+
+Fri Sep 22 01:36:34 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb: include FileUtils unconditionally.
+
+Thu Sep 21 22:56:20 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (no-install): not install rdoc actually.
+
+ * common.mk (install-doc, no-install-doc): use instruby.rb.
+
+ * instruby.rb: rdoc installation.
+
+ * ext/extmk.rb: expand ruby executable names.
+
+Thu Sep 21 13:55:07 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/etc/etc.c (etc_getpwuid): uid integer should be wraped in
+ uid_t value. [ruby-core:08897]
+
+ * ext/etc/etc.c (etc_getpwuid): uid_t may be bigger than plain
+ 'int' type.
+
+Wed Sep 20 23:17:41 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (pre-install-doc): create data directory before install.
+
+ * lib/mkmf.rb (dir_re): fixed typo.
+
+ * lib/mkmf.rb (install_dirs): remove extra slash.
+
+Wed Sep 20 09:53:38 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {bcc32,win32,wince}/Makefile.sub (INSTALLED_LIST): need to define
+ this macro to install.
+
+Wed Sep 20 09:43:10 2006 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: allow extra spaces in responses.
+ Thanks, Tom Soderlund. (backported from HEAD)
+
+Wed Sep 20 09:25:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/gdbm/gdbm.c: add RDoc documentation. a patch from Peter
+ Adolphs <futzilogik at users dot sourceforge dot net>.
+ [ruby-doc:1223]
+
+Tue Sep 19 01:28:00 2006 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: backport from HEAD (rev 1.71).
+
+ * lib/fileutils.rb (FileUtils.cp_r): new option
+ :remove_destination.
+
+Tue Sep 19 00:42:15 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_obj_ivar_defined, rb_mod_cvar_defined): new methods,
+ Kernel#instance_variable_defined? and Module#class_variable_defined?.
+ [ruby-dev:29587]
+
+ * lib/date/format.rb (Date::Bag#method_missing): use new method,
+ instance_variable_defined? to check if an instance variable is
+ defined. fixed: [ruby-dev:29554]
+ -- This didn't fix anything.
+
+Sun Sep 17 23:44:58 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/rdoc.rb (RDoc::RDoc#document): scan only files modified
+ after the previous generation.
+
+Sun Sep 17 17:42:13 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (install-doc): reverted.
+
+ * instruby.rb: stores file name list without destdir prefix.
+
+ * lib/rdoc/generators/ri_generator.rb: do not chdir twice.
+
+Sat Sep 16 23:14:29 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/pty/pty.c (establishShell): remove remaining unused line.
+
+Sat Sep 16 16:40:44 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb:
+ use instruby.rb to install extensions instead of ext/extmk.rb.
+
+ * instruby.rb: store installed list into the file.
+
+ * ext/dbm/extconf.rb: allow multiple candidates for dbm-type.
+
+ * ext/io/wait/extconf.rb: suspicious checking_for.
+
+ * ext/pty/pty.c (establishShell): parent pid is not used.
+
+ * ext/pty/pty.c (freeDevice): not used.
+
+ * ext/pty/pty.c (get_device_once): removed garbage right brace.
+
+ * lib/mkmf.rb (checking_for): improved the messages.
+
+Thu Sep 14 16:11:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_intern): raise SecurityError only when $SAFE
+ level is greater than zero. [ruby-core:08862]
+
+ * parse.y (rb_interned_p): new function to check if a string is
+ already interned.
+
+ * object.c (str_to_id): use rb_str_intern().
+
+Wed Sep 13 18:43:05 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * README.EXT: English adjustment. [ruby-core:08851] and
+ [ruby-core:08852]
+
+Wed Sep 13 18:25:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): better here-doc support.
+ a patch from Marshall T. Vandegrift <llasram at gmail.com>.
+ [ruby-core:08804]
+
+Wed Sep 13 16:43:36 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_intern): prohibit interning tainted string.
+
+Wed Sep 13 01:14:21 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#getopts): works with pre-registered
+ options. [ruby-core:08826]
+
+Sun Sep 10 20:27:13 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 3.9.1.
+
+Tue Jan 10 09:18:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (stack_extend): fixed prototype.
+
+ * eval.c (rb_require_safe): prevent extension from loading twice.
+ fixed: [ruby-dev:29523]
+
+Sat Sep 9 23:50:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_mul0): bignum multiplication without
+ normalization.
+
+ * bignum.c (rb_big_pow): use rb_big_mul0(). [ruby-dev:29547]
+
+Sat Sep 9 14:08:38 2006 Eric Hodel <drbrain@segment7.net>
+
+ * lib/test/unit/testcase.rb (Test::Unit::TestCase#run): Rescue
+ Exception in Test::Unit::TestCase#run. [ruby-core:08783]
+
+Sat Sep 9 04:55:59 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/pstore.rb: open all in binary mode, and get rid of the quirk of
+ msvcrt. fixed: [ruby-dev:29518]
+
+Sat Sep 9 04:54:42 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, win32/Makefile.sub (MINIRUBY): append MINIRUBYOPT.
+
+ * mkconfig.rb, ext/extmk.rb, lib/mkmf.rb, win32/mkexports.rb: suppress
+ warnings with $VERBOSE.
+
+ * ext/extmk.rb: Proc#call does not pass the block in 1.8.
+
+ * win32/resource.rb: add more info.
+
+Fri Sep 8 10:03:59 2006 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/cookie.rb (WEBrick::Cookie.parse_set_cookies): new
+ method to parse multiple cookies per Set-Cookie header.
+ Thanks to Aaron Patterson <aaron_patterson at speakeasy.net>.
+ [ruby-core:08802]
+
+Fri Sep 8 08:59:30 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub, win32/configure.bat win32/setup.mak: program
+ name transform.
+
+Fri Sep 8 01:33:08 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.h (RSTRING_PTR): add migration macro.
+
+ * ruby.h (RARRAY_PTR): ditto.
+
+Thu Sep 7 23:27:05 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (path_check_0, fpath_check): disable path check on cygwin.
+ [ruby-talk:213074]
+
+Wed Sep 06 12:05:19 2006 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/lib/kconv.rb (Kconv::RegexpEucjp): fix regexp for euc-jp
+ [ruby-dev:29344]
+
+ * ext/nkf/lib/kconv.rb (Kconv::toeuc): remove -m0 [ruby-dev:29505]
+
+Tue Sep 5 06:47:22 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (time_to_s): variable declaration after an execution
+ statement.
+
+Tue Sep 5 05:56:51 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (flo_hash): improve collision. fixed: [ruby-dev:29352]
+
+Tue Sep 5 05:49:41 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (path_check_0): check if sticky bit is set on parent
+ directories for executable path. fixed: [ruby-dev:29415]
+
+Tue Sep 5 05:03:46 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_plus): addition in Fixnum will never overflow
+ long. a patch from Ondrej Bilka <neleai at seznam.cz>.
+ [ruby-core:08794]
+
+ * numeric.c (fix_minus): ditto.
+
+ * bignum.c (rb_big_pow): eagerly truncate resulting bignum.
+ [ruby-core:08794]
+
+Mon Sep 4 23:15:34 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_to_s): make it conform to RFC2822 date format.
+ [ruby-dev:29467]
+
+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]
+
+Mon Sep 4 21:42:35 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 3.9.
+
+Mon Sep 4 21:14:20 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (time_strftime): include nul character. fixed: [ruby-dev:29422]
+
+Mon Sep 4 16:29:33 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::out): specify -m0 -x option for nkf.
+ [ruby-dev:29284]
+
+Mon Sep 4 16:13:23 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (pipe_open): command name should not contain null bytes.
+ [ruby-dev:29421]
+
+ * process.c (proc_spawn): ditto.
+
+ * process.c (proc_spawn_n): ditto.
+
+ * process.c (rb_f_system): ditto.
+
+Sun Sep 3 15:32:44 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: get rid of nil.to_s.
+
+Sun Sep 3 06:24:38 2006 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (ruby_connect): sockerrlen should be socklen_t.
+
+Sun Sep 3 04:40:42 2006 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: check arpa/inet.h for ntohs.
+
+ * ext/socket/socket.c: include arpa/inet.h if available.
+
+Sun Sep 3 02:34:55 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/unix.rb (DRbUNIXSocket#close): don't get path if client mode.
+ [ruby-dev:29417]
+
+Sun Sep 3 01:45:17 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/acl.rb (ACLEntry#initialize): examine whether '*' is
+ included before IPAddr.new. [ruby-dev:29406]
+
+Sat Sep 2 13:23:01 2006 Tanaka Akira <akr@fsij.org>
+
+ * common.mk (ia64.o): use the compiler driver to assemble ia64.s
+ to use appropriate ABI.
+
+Sat Sep 2 03:36:22 2006 Tanaka Akira <akr@fsij.org>
+
+ * common.mk, configure.in, defines.h, eval.c, gc.c, main.c,
+ numeric.c, ruby.h, ia64.s: backport IA64 HP-UX support.
+
+Fri Sep 1 13:52:57 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/font.rb: TkFont#current_configinfo() doesn't work
+ on Tcl/Tk8.x.
+
+Thu Aug 31 12:46:55 2006 why the lucky stiff <why@ruby-lang.org>
+
+ * eval.c (ruby_init): rename top_cref to ruby_top_cref and export,
+ along with ruby_cref, for use by the sandbox. [ruby-core:08762]
+
+ * node.h: ditto.
+
+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]
+
+Mon Aug 28 11:36:02 2006 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parsers/parse_rb.rb: Fix typo. Submitted by
+ <calamitas at gmail.com>. [ruby-core:08724]
+
+Mon Aug 28 07:53:44 2006 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ri/ri_formatter.rb: Don't unescape HTML in HtmlFormatter.
+ Submitted by Kent Sibilev <ksruby at gmail.com>. [ruby-core:08392].
+
+Mon Aug 28 07:25:45 2006 Eric Hodel <drbrain@segment7.net>
+
+ * file.c (File#size?): Fix documentation submitted by Rick Ohnemus.
+ ruby-Bugs-5529. [ruby-core:08725]
+
+Sat Aug 26 08:07:13 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: updated based on date2 3.8.2.
+
+Fri Aug 25 22:32:04 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rexml/source.rb (REXML::IOSource#initialize): encoding have to
+ be set with the accessor. fixed: [ruby-list:42737]
+
+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).
@@ -67,17 +9424,17 @@ Mon Sep 19 03:17:48 2005 Tanaka Akira <akr@m17n.org>
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.
+ 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.
+ the rdoc and ri output. output symbols as plain scalars.
- * ext/syck/rubyext.c (syck_emitter_reset): emit headless
+ * ext/syck/rubyext.c (syck_emitter_reset): emit headless
documents always.
- * ext/syck/emitter.c (syck_scan_scalar): quote scalars with any
+ * 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,
@@ -98,8 +9455,8 @@ Sat Sep 17 23:20:27 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
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
+ 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>
@@ -113,14 +9470,14 @@ Sat Sep 17 09:45:26 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
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>.
+ 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
+ * ext/win32ole/win32ole.c (ole_search_event_at): bug fix
in ext/win32ole/sample/ienavi.rb.
* ext/win32ole/win32ole/tests/testOLEEVENT.rb: ditto.
@@ -137,7 +9494,7 @@ 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@mtb.biglobe.ne.jp>. [ruby-dev:27111]
+ <miyamuko at mtb.biglobe.ne.jp>. [ruby-dev:27111]
Fri Sep 16 14:48:48 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -148,7 +9505,7 @@ 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 <nakahiro@sarion.co.jp>
+Fri Sep 16 00:14:14 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/logger/test_logger.rb: unintentionally overwritten changes by
Usa. reverted.
@@ -158,7 +9515,7 @@ 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 <nakahiro@sarion.co.jp>
+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.
@@ -282,7 +9639,7 @@ Wed Sep 14 01:26:03 2005 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: #use_ssl?, #use_ssl are moved from net/https.
-Tue Sep 13 22:09:40 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+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
@@ -368,7 +9725,7 @@ Mon Sep 12 14:03:33 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
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@back-street.net>. [ruby-dev:27023]
+ 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>
@@ -467,7 +9824,7 @@ Fri Sep 9 16:45:25 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
Thu Sep 8 14:58:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
- * merged a patch from Takahiro Kambe <taca@back-street.net> to
+ * 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>
@@ -512,7 +9869,7 @@ Wed Sep 7 08:32:47 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
Mon Sep 5 17:03:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
- * lib/ostruct.rb: a patch from Florian Gross <florgro@gmail.com>
+ * 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]
@@ -525,7 +9882,7 @@ 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>
+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]
@@ -611,13 +9968,13 @@ Wed Aug 24 10:53:28 2005 NAKAMURA Usaku <usa@ruby-lang.org>
device before unlink, since some platform cannot unlink opened
file.
-Sun Aug 21 00:13:27 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+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 <nakahiro@sarion.co.jp>
+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]
@@ -738,11 +10095,11 @@ 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 <nakahiro@sarion.co.jp>
+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 <nakahiro@sarion.co.jp>
+Sun Aug 7 23:50:14 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/test_super.rb: added from HEAD. [ruby-dev:26743]
@@ -871,7 +10228,8 @@ Mon Aug 1 01:17:40 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* test/drb/ut_drb.rb: ditto.
-Mon Aug 1 00:07:32 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
+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>
@@ -1188,7 +10546,7 @@ Sun Jul 10 23:58:04 2005 Tanaka Akira <akr@m17n.org>
avoid unlink a directory by root.
cf. [ruby-dev:26237]
-Sun Jul 10 22:18:17 CEST 2005 Michael Neumann <mneumann@ruby-lang.org>
+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
@@ -1293,7 +10651,7 @@ 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 <nakahiro@sarion.co.jp>
+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
@@ -1356,6 +10714,7 @@ Fri Jul 1 00:18:40 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
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.
@@ -1399,11 +10758,11 @@ 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 24 22:06:47 CEST 2005 Michael Neumann <mneumann@ruby-lang.org>
+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>
+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.
@@ -1602,19 +10961,19 @@ Wed Jun 8 08:33:10 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
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@jiubao.org> to support AIX. [ruby-list:40832]
+ 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@code-monkey.de>. [ruby-core:05055]
+ 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@lapis.plala.or.jp>. [ruby-ext:02305]
+ TAKAHASHI Tamotsu <ttakah at lapis.plala.or.jp>. [ruby-ext:02305]
Tue Jun 7 19:34:15 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -1624,7 +10983,7 @@ Tue Jun 7 19:34:15 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
Tue Jun 7 18:39:31 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/thread.rb: RDoc documentation from Eric Hodel
- <drbrain@segment7.net> added. [ruby-core:05148]
+ <drbrain at segment7.net> added. [ruby-core:05148]
Tue Jun 7 18:30:04 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -1787,7 +11146,7 @@ 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 <nakahiro@sarion.co.jp>
+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]
@@ -1806,7 +11165,7 @@ 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 <nakahiro@sarion.co.jp>
+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.
@@ -1897,7 +11256,7 @@ 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>
+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]
@@ -2044,7 +11403,7 @@ Thu May 12 16:15:01 2005 Tanaka Akira <akr@m17n.org>
(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>
+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]
@@ -2327,7 +11686,6 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
- 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
@@ -2355,34 +11713,28 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
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.
@@ -2398,7 +11750,6 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
* 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.
@@ -3389,7 +12740,7 @@ Wed Feb 2 21:56:01 2005 Kouhei Sutou <kou@cozmixng.org>
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.
+ _dump.
Tue Feb 1 00:20:23 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -3510,7 +12861,7 @@ 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 <nakahiro@sarion.co.jp>
+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
@@ -3990,7 +13341,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 <nakahiro@sarion.co.jp>
+Wed Dec 22 00:08:01 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/soap/*, test/soap/*, sample/soap/authheader/*: eval cleanup.
@@ -4024,7 +13375,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 <nakahiro@sarion.co.jp>
+Mon Dec 20 23:22:26 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* added files:
* lib/soap/mapping/wsdl*.rb
@@ -4150,7 +13501,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 <nakahiro@sarion.co.jp>
+Sat Dec 18 15:16:41 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/webrick/httpauth.rb,
lib/webrick/httpauth/{basicauth.rb,digestauth.rb}: use
@@ -4296,7 +13647,7 @@ Wed Dec 15 18:57:01 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
Wed Dec 15 18:48:42 2004 Shugo Maeda <shugo@ruby-lang.org>
* ext/curses/curses.c (window_subwin): call NUM2INT() before
- GetWINDOW(). (backported from CVS HEAD)
+ GetWINDOW(). (backported from CVS HEAD)
Wed Dec 15 17:03:50 2004 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -4373,6 +13724,13 @@ 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],
@@ -4403,7 +13761,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
@@ -4411,7 +13769,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()
@@ -4497,7 +13855,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)
@@ -4912,7 +14270,7 @@ Thu Nov 18 18:41:08 2004 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* test/ruby/test_stringchar.rb (test_bang): added.
* string.c (rb_str_upcase_bang, rb_str_capitalize_bang)
- (rb_str_swapcase_bang): missing rb_str_modify(). [ruby-dev:24915]
+ (rb_str_swapcase_bang): missing rb_str_modify(). [ruby-dev:24915]
Thu Nov 18 00:21:15 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -4933,7 +14291,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 <nakahiro@sarion.co.jp>
+Wed Nov 17 23:42:40 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/test_settracefunc.rb: added. [ruby-dev:24884]
@@ -5004,7 +14362,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 <nakahiro@sarion.co.jp>
+Sun Nov 14 08:51:04 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/logger/test_logger.rb: Logger just expects
Logger#datetime_format to be used for Time#strftime independently of
@@ -5528,7 +14886,7 @@ Mon Oct 18 15:58:01 2004 NAKAMURA Usaku <usa@ruby-lang.org>
Fri Oct 29 16:34:19 2004 Daiki Ueno <ueno@unixuser.org>
* misc/ruby-mode.el (ruby-parse-partial): Parse the rest of the
- line after opening heredoc identifier. [ruby-dev:24635]
+ line after opening heredoc identifier. [ruby-dev:24635]
Mon Oct 18 07:26:21 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -5724,7 +15082,7 @@ Mon Oct 4 12:53:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Sun Oct 3 21:20:03 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (TEXT_REGEXP): allow 8-bit characters for the german
- version of Microsoft Exchange Server. (backported from HEAD)
+ version of Microsoft Exchange Server. (backported from HEAD)
* lib/net/imap.rb (RTEXT_REGEXP): ditto.
@@ -6049,7 +15407,6 @@ Sun Sep 12 02:41:58 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: add TclTkIp#allow_ruby_exit? and
allow_ruby_exit=
-
* ext/tk/lib/multi-tk.rb: ditto.
* ext/tk/lib/remote-tk.rb: ditto.
@@ -6124,7 +15481,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@iar.se>. [ruby-core:03292]
+ Holmberg <holmberg at iar.se>. [ruby-core:03292]
Mon Sep 6 07:51:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -6293,7 +15650,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 19 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.
@@ -6530,9 +15887,9 @@ Sun Jul 18 03:21:42 2004 Akinori MUSHA <knu@iDaemons.org>
Sun Jul 18 03:12:11 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (receive_responses): return if a LOGOUT response
- received. (backported from HEAD)
+ received. (backported from HEAD)
* lib/net/imap.rb (send_string_data): wait command continuation
- requests before sending octet data of literals. (backported from HEAD)
+ requests before sending octet data of literals. (backported from HEAD)
Sat Jul 17 23:54:59 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -6603,7 +15960,7 @@ Thu Jul 15 23:53:38 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
Thu Jul 15 22:59:48 2004 Shugo Maeda <shugo@ruby-lang.org>
* ext/readline/extconf.rb: added dir_config for curses, ncurses,
- termcap. (backported from HEAD)
+ termcap. (backported from HEAD)
Thu Jul 15 20:29:15 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
@@ -6635,7 +15992,6 @@ Thu Jul 15 10:15:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/sample/tkextlib/: add samples of Iwidget and TkTable
-
Wed Jul 14 18:08:37 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_asn1.c (ossl_asn1cons_to_der): fix type of
@@ -6683,7 +16039,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 <nakahiro@sarion.co.jp>
+Sat Jul 10 09:30:24 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/soap/marshal/test_struct.rb: use qualified build-tin class name
(::Struct) to avoid name crash.
@@ -6787,7 +16143,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 <nakahiro@sarion.co.jp>
+Sun Jul 4 00:24:40 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* added files
* lib/soap/attachment.rb
@@ -7013,7 +16369,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]
@@ -7124,7 +16480,7 @@ Tue Jun 22 21:11:36 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp>
Tue Jun 22 16:47:42 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (MDTM_REGEXP): fix for demon's ftp server.
- Thanks, Rutger Nijlunsing.
+ Thanks, Rutger Nijlunsing.
Mon Jun 21 10:19:23 2004 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -7240,7 +16596,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 <nakahiro@sarion.co.jp>
+Thu May 27 23:15:18 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/logger.rb: leading 0 padding of timestamp usec part.
@@ -7459,11 +16815,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.
@@ -7475,7 +16831,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).
@@ -7579,7 +16935,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
@@ -7641,11 +16997,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
@@ -7702,7 +17058,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
- compatibilitiy. [bruby-dev:28]
+ compatibility. [bruby-dev:28]
* version.c (ruby_show_copyright): obtain copyright year from
RUBY_RELEASE_YEAR.
@@ -7774,7 +17130,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.
@@ -7831,7 +17187,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.
@@ -7977,7 +17333,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 <nakahiro@sarion.co.jp>
+Thu Apr 1 19:58:37 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/soap/mapping/{factory.rb,registry.rb}: fixed illegal mapped URI
object with soap/marshal.
@@ -8055,7 +17411,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.
@@ -8320,15 +17676,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.
@@ -8351,16 +17707,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 <nakahiro@sarion.co.jp>
+Thu Feb 19 22:39:04 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* 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
@@ -8381,11 +17737,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 <nakahiro@sarion.co.jp>
+Wed Feb 18 22:03:11 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/*: should not depend on $KCODE.
@@ -8396,14 +17752,14 @@ Wed Feb 18 17:18:01 2004 WATANABE Hirofumi <eban@ruby-lang.org>
Wed Feb 18 10:40:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* sprintf.c (rb_f_sprintf): do not prepend dots for negative
- numbers if FZERO is specified. [ruby-dev:39218]
+ numbers if FZERO is specified. [ruby-list:39218]
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 <nakahiro@sarion.co.jp>
+Tue Feb 17 23:28:45 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/marshaltestlib.rb: common marshal testcase added.
@@ -8446,11 +17802,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 <nakahiro@sarion.co.jp>
+Mon Feb 16 23:28:14 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* 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)
@@ -8502,11 +17858,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)
@@ -8563,12 +17919,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 <nakahiro@sarion.co.jp>
+Fri Feb 6 22:41:22 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* 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 <nakahiro@sarion.co.jp>
+Fri Feb 6 22:22:50 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/pp.rb (PPInspectTest#test_to_s_with_iv): remove instance
variable which is defined in the test.
@@ -8633,11 +17989,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.
@@ -8653,7 +18009,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 <nakahiro@sarion.co.jp>
+Sat Jan 31 01:00:32 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/soap/wsdlDriver.rb, lib/wsdl/soap/operation.rb: add support of
"parts" attribute of soap:body element in WSDL.
@@ -8868,7 +18224,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 <nakahiro@sarion.co.jp>
+Tue Jan 13 18:54:28 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/logger.rb(Logger#msg2str): no special treatment for the object
which responds to :to_str. commited at 2004-01-11T21:46:27 by
@@ -8984,7 +18340,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 <nakahiro@sarion.co.jp>
+Thu Jan 8 16:51:04 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/wsdl/datetime/test_datetime.rb: fixed a stupid testcase which
dumps "E" at month-end.
@@ -9009,7 +18365,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 <nakahiro@sarion.co.jp>
+Wed Jan 7 12:35:41 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/debug.rb: revert command parse regexps. [ruby-list:39014] by
Shirai,Kaoru.
@@ -9112,7 +18468,6 @@ Tue Dec 30 12:30:30 2003 Dave Thomas <dave@pragprog.com>
class and a method have the same name, finding Xxx.abc was trying
to find 'abc' in method 'Xxx', not class 'Xxx'.
-
Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method):
@@ -9120,7 +18475,6 @@ Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
def each_entry(&b) Dir.foreach(@path) {|f| yield P.new(f) } end
-
Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method):
@@ -9399,7 +18753,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.
@@ -9423,7 +18777,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]
@@ -10226,7 +19580,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.
@@ -10289,7 +19643,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).
@@ -10373,7 +19727,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.
@@ -10459,7 +19813,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]
@@ -10600,7 +19954,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'.
@@ -10623,12 +19977,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.
@@ -10737,7 +20091,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.
@@ -10852,7 +20206,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.
@@ -11025,7 +20379,8 @@ 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.
@@ -11128,7 +20483,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.
@@ -11149,7 +20504,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.
@@ -11255,7 +20610,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)
@@ -11314,7 +20669,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]
@@ -11343,7 +20698,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.
@@ -11375,7 +20730,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,
@@ -11457,7 +20812,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.
@@ -11510,7 +20865,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.
@@ -11564,7 +20919,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.
@@ -11631,7 +20986,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]
@@ -11644,7 +20999,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.
@@ -11911,7 +21266,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
@@ -12330,7 +21685,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.
@@ -12353,7 +21708,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.
@@ -12449,7 +21804,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.
@@ -12562,11 +21917,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 01 14:09:53 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+Wed Oct 1 14:09:53 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/mkconfig_wce.rb: sorry, forget to commit.
-Wed Oct 01 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+Wed Oct 1 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/setup.mak: add sigmarionIII SDK support.
@@ -12576,7 +21931,7 @@ Wed Oct 01 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/mkconfig_wce.rb: camouflage RUBY_PLATFORM for compiling ext.
-Wed Oct 01 08:02:52 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+Wed Oct 1 08:02:52 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/time_wce.c (time): add zero check.
@@ -12723,7 +22078,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 *.
@@ -12748,7 +22103,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.
@@ -12756,7 +22111,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#==.
@@ -12839,7 +22194,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.
@@ -12980,7 +22335,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]
@@ -13004,7 +22359,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.
@@ -13029,7 +22384,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]
@@ -13047,7 +22402,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.
@@ -13117,7 +22472,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]
@@ -13136,7 +22491,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.
@@ -13417,12 +22772,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
@@ -13497,7 +22852,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.
@@ -13546,7 +22901,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]
@@ -13571,7 +22926,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
@@ -13759,7 +23114,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
@@ -13791,7 +23146,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]
@@ -13830,7 +23185,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)
@@ -13863,6 +23218,7 @@ Tue Aug 12 02:48:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (THREAD_ALLOC): initialize IA64 members.
Mon Aug 11 22:31:50 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
* lib/debug.rb(debug_command): inspection command should inspect
resulting value even if it's nil. [ruby-dev:21180] by OMAE, jun
<jun66j5@ybb.ne.jp>.
@@ -13989,7 +23345,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.
@@ -14063,9 +23419,10 @@ For the changes before 1.8.0, see doc/ChangeLog-1.8.0
Local variables:
add-log-time-format: (lambda ()
(let* ((time (current-time))
+ (system-time-locale "C")
(diff (+ (cadr time) 32400))
(lo (% diff 65536))
- (hi (+ (car time) (/ diff 65536))))
+ (hi (+ (car time) (/ diff 65536))))
(format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
indent-tabs-mode: t
tab-width: 8
diff --git a/Makefile.in b/Makefile.in
index 9dde68840e..a37bcf65fb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,5 @@
SHELL = /bin/sh
+NULLCMD = :
#### Start of system configuration section. ####
@@ -18,6 +19,7 @@ bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
libexecdir = @libexecdir@
+datarootdir = @datarootdir@
datadir = @datadir@
arch = @arch@
sitearch = @sitearch@
@@ -30,8 +32,12 @@ RDOCTARGET = @RDOCTARGET@
EXTOUT = @EXTOUT@
RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
-OUTFLAG = -o
+empty =
+OUTFLAG = @OUTFLAG@$(empty)
CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
+cflags = @cflags@
+optflags = @optflags@
+debugflags = @debugflags@
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
EXTLDFLAGS =
@@ -50,8 +56,8 @@ RUBY_SO_NAME=@RUBY_SO_NAME@
EXEEXT = @EXEEXT@
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
RUBY = $(RUBY_INSTALL_NAME)
-MINIRUBY = @MINIRUBY@
-RUNRUBY = @RUNRUBY@
+MINIRUBY = @MINIRUBY@ $(MINIRUBYOPT)
+RUNRUBY = @RUNRUBY@ $(RUNRUBYOPT) --
#### End of system configuration section. ####
@@ -77,10 +83,13 @@ NM = @NM@
AR = @AR@
ARFLAGS = rcu
RANLIB = @RANLIB@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
OBJEXT = @OBJEXT@
MANTYPE = @MANTYPE@
+INSTALLED_LIST= .installed.list
#### End of variables
all:
@@ -92,7 +101,7 @@ all:
miniruby$(EXEEXT):
@$(RM) $@
- $(PURIFY) $(CC) $(MAINOBJ) $(MINIOBJS) $(LIBRUBY_A) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(MAINLIBS)
+ $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(LIBRUBY_A) $(LIBS) $(OUTFLAG)$@
$(PROGRAM):
@$(RM) $@
@@ -107,6 +116,7 @@ $(LIBRUBY_A):
@-$(RANLIB) $@ 2> /dev/null || true
$(LIBRUBY_SO):
+ @-$(PRE_LIBRUBY_UPDATE)
$(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@
@-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
File.symlink "$(LIBRUBY_SO)", link}' \
@@ -148,9 +158,12 @@ $(srcdir)/configure: $(srcdir)/configure.in
cd $(srcdir) && $(AUTOCONF)
lex.c: keywords
- @-$(RM) $@
- gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@ || \
- cp "$(srcdir)/$@" .
+ ( gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@.tmp && mv $@.tmp $@ ) || \
+ if test -f $@; then \
+ touch $@ && echo $@ touched.; \
+ else \
+ cp $(srcdir)/lex.c $@ && echo $@ copied.; \
+ fi
.y.c:
$(YACC) $<
@@ -160,6 +173,9 @@ lex.c: keywords
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+.s.@OBJEXT@:
+ $(AS) $(ASFLAGS) -o $@ $<
+
clean-local::
@$(RM) ext/extinit.c ext/extinit.$(OBJEXT)
@@ -167,4 +183,20 @@ distclean-local::
@$(RM) ext/config.cache $(RBCONFIG)
ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
- $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
+ $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ -c ext/extinit.c
+
+update-rubyspec:
+ if [ -d $(srcdir)/rubyspec ]; then \
+ cd $(srcdir)/rubyspec/mspec; \
+ git pull; \
+ cd ../spec/rubyspec; \
+ git pull; \
+ else \
+ git clone $(MSPEC_GIT_URL) $(srcdir)/rubyspec/mspec; \
+ git clone $(RUBYSPEC_GIT_URL) $(srcdir)/rubyspec/spec/rubyspec; \
+ fi
+
+test-rubyspec:
+ @if [ ! -d $(srcdir)/rubyspec ]; then echo No rubyspec here. make update-rubyspec first.; exit 1; fi
+ $(RUNRUBY) $(srcdir)/rubyspec/mspec/bin/mspec -r$(srcdir)/ext/purelib.rb $(srcdir)/rubyspec/spec/rubyspec/$(MAJOR).$(MINOR)
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000000..61373187e5
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,629 @@
+= NEWS
+
+This document is a list of user visible feature changes made between
+releases except for bug fixes.
+
+Note that each entry is kept so brief that no reason behind or
+reference information is supplied with. For a full list of changes
+with all sufficient information, see the ChangeLog file.
+
+== Changes since the 1.8.6 release
+
+=== Configuration changes
+
+* vendor_ruby directory
+
+ A new library directory named `vendor_ruby' is introduced in
+ addition to `site_ruby'. The idea is to separate libraries
+ installed by the package system (`vendor') from manually (`site')
+ installed libraries preventing the former from getting overwritten
+ by the latter, while preserving the user option to override vendor
+ libraries with site libraries. (`site_ruby' takes precedence over
+ `vendor_ruby')
+
+ If you are a package maintainer, make each library package configure
+ the library passing the `--vendor' option to `extconf.rb' so that
+ the library files will get installed under `vendor_ruby'.
+
+ You can change the directory locations using configure options such
+ as `--with-sitedir=DIR' and `--with-vendordir=DIR'.
+
+=== Global constants
+
+* new constants
+
+ * RUBY_COPYRIGHT
+ * RUBY_DESCRIPTION
+
+=== Library updates (outstanding ones only)
+
+* new library
+
+ * securerandom
+
+* builtin classes
+
+ * Array#flatten
+ * Array#flatten!
+
+ Takes an optional argument that determines the level of recursion
+ to flatten.
+
+ * Array#eql?
+ * Array#hash
+ * Array#==
+ * Array#<=>
+
+ Handle recursive data properly.
+
+ * Array#index
+ * Array#rindex
+
+ Take a block instead of an argument.
+
+ * Array#collect!
+ * Array#map!
+ * Array#each
+ * Array#each_index
+ * Array#reverse_each
+ * Array#reject
+ * Array#reject!
+ * Array#delete_if
+
+ Return an enumerator if no block is given.
+
+ Note that #map and #collect still return an array unlike Ruby 1.9
+ to keep compatibility.
+
+ * Array#pop
+ * Array#shift
+
+ Take an optional argument specifying the number of elements to
+ remove.
+
+ * Array#choice
+ * Array#combination
+ * Array#cycle
+ * Array#drop
+ * Array#drop_while
+ * Array#permutation
+ * Array#product
+ * Array#shuffle
+ * Array#shuffle!
+ * Array#take,
+ * Array#take_while
+
+ New methods.
+
+ * Binding#eval
+
+ New method.
+
+ * Dir#each
+ * Dir#foreach
+
+ Return an enumerator if no block is given.
+
+ * Enumerable::Enumerator
+
+ New class for various enumeration defined by the enumerator library.
+
+ * Enumerable#each_slice
+ * Enumerable#each_cons
+ * Object#to_enum
+ * Object#enum_for
+
+ New methods for various enumeration defined by the enumerator library.
+
+ * Enumerable#count
+ * Enumerable#cycle
+ * Enumerable#drop
+ * Enumerable#drop_while
+ * Enumerable#find_index
+ * Enumerable#first
+ * Enumerable#group_by
+ * Enumerable#max_by
+ * Enumerable#min_by
+ * Enumerable#minmax
+ * Enumerable#minmax_by
+ * Enumerable#none?
+ * Enumerable#one?
+ * Enumerable#take
+ * Enumerable#take_while
+
+ New methods.
+
+ * Enumerable#find
+ * Enumerable#find_all
+ * Enumerable#partition
+ * Enumerable#reject
+ * Enumerable#select
+ * Enumerable#sort_by
+
+ Return an enumerator if no block is given.
+
+ Note that #map and #collect still return an array unlike Ruby 1.9
+ to keep compatibility.
+
+ * Enumerable#inject
+
+ Accepts a binary operator instead of a block.
+
+ * Enumerable#reduce
+
+ New alias to #inject.
+
+ * Hash#eql?
+ * Hash#hash
+ * Hash#==
+
+ Handle recursive data properly.
+
+ * Hash#delete_if
+ * Hash#each
+ * Hash#each_key
+ * Hash#each_pair
+ * Hash#each_value
+ * Hash#reject!
+ * Hash#select
+ * ENV.delete_if
+ * ENV.each
+ * ENV.each_key
+ * ENV.each_pair
+ * ENV.each_value
+ * ENV.reject!
+ * ENV.select
+
+ Return an enumerator if no block is given.
+
+ * GC.stress
+ * GC.stress=
+
+ New methods.
+
+ * Integer#ord
+ * Integer#odd?
+ * Integer#even?
+ * Integer#pred
+
+ New methods.
+
+ * Integer#downto
+ * Integer#times
+ * Integer#upto
+
+ Return an enumerator if no block is given.
+
+ * IO#each
+ * IO#each_line
+ * IO#each_byte
+ * IO.foreach
+ * ARGF.each
+ * ARGF.each_line
+ * ARGF.each_byte
+
+ Return an enumerator if no block is given.
+
+ * IO#bytes
+ * IO#chars
+ * IO#each_char
+ * IO#getbyte
+ * IO#lines
+ * IO#readbyte
+ * ARGF.bytes
+ * ARGF.chars
+ * ARGF.each_char
+ * ARGF.getbyte
+ * ARGF.lines
+ * ARGF.readbyte
+
+ New methods.
+
+ * Method#name
+ * Method#owner
+ * Method#receiver
+ * UnboundMethod#name
+ * UnboundMethod#owner
+
+ New methods.
+
+ * Module#class_exec
+ * Module#module_exec
+
+ New methods.
+
+ * Numeric#step
+
+ Return an enumerator if no block is given.
+
+ * Object#instance_exec
+ * Object#tap
+
+ New methods.
+
+ * ObjectSpace.each_object
+
+ Return an enumerator if no block is given.
+
+ * Process.exec implemented.
+
+ * Range#each
+ * Range#step
+
+ Return an enumerator if no block is given.
+
+ * Regexp.union accepts an array of patterns.
+
+ * String#bytesize
+
+ New method, returning the size in bytes. (alias length and size)
+
+ * String#chars
+ * String#each_char
+ * String#partition
+ * String#rpartition
+ * String#start_with?
+ * String#end_with?
+
+ New methods. These are $KCODE aware unlike #index, #rindex and
+ #include?.
+
+ * String#each_byte
+ * String#each
+ * String#each_line
+ * String#gsub(pattern)
+
+ Return an enumerator if no block is given.
+
+ * String#upto
+
+ An optional second argument is added to specify if the last value
+ should be included.
+
+ * StopIteration
+
+ New exception class that causes Kernel#loop to stop iteration when
+ raised.
+
+ * Struct#each
+ * Struct#each_pair
+
+ Return an enumerator if no block is given.
+
+ * Symbol#to_proc
+
+ New method.
+
+ * __method__
+
+ New global function that returns the name of the current method as
+ a Symbol.
+
+* enumerator
+
+ * Enumerator is now a built-in module. The #next and #rewind
+ methods are implemented using the "generator" library. Use with
+ care and be aware of the performance loss.
+
+* ipaddr
+
+ * New methods
+ * IPAddr#<=>
+ * IPAddr#succ
+
+ IPAddr objects are now comparable and enumerable having these
+ methods. This also means that it is possible to have a Range
+ object between two IPAddr objects.
+
+ * IPAddr#to_range
+
+ A new method to create a Range object for the (network) address.
+
+ * Type coercion support
+ * IPAddr#&
+ * IPAddr#|
+ * IPAddr#==
+ * IPAddr#include?
+
+ These methods now accept a string or an integer instead of an
+ IPAddr object as the argument.
+
+* net/smtp
+
+ * Support SSL/TLS.
+
+* openssl
+
+ * New classes
+ * OpenSSL::PKey::EC
+ * OpenSSL::PKey::EC::Group
+ * OpenSSL::PKey::EC::Point
+ * OpenSSL::PKey::PKCS5
+ * OpenSSL::SSL::Session
+
+ * Documentation!
+
+ * Various new methods (see documentation).
+
+ * Remove redundant module namespace in Cipher, Digest, PKCS7, PKCS12.
+ Compatibility classes are provided which will be removed in Ruby 1.9.
+
+* shellwords
+
+ * Add methods for escaping shell-unsafe characters:
+ * Shellwords.join
+ * Shellwords.escape
+ * Array#shelljoin
+ * String#shellescape
+
+ * Add shorthand methods:
+ * Shellwords.split (alias shellwords)
+ * String#shellsplit
+
+* stringio
+
+ * StringIO#getbyte
+ * StringIO#readbyte
+
+ New methods. (aliases for compatibility with 1.9)
+
+ * StringIO#each_char
+ * StringIO#chars
+
+ New methods.
+
+ * StringIO#each
+ * StringIO#each_line
+ * StringIO#each_byte
+
+ Return an enumerator if no block is given.
+
+* tempfile
+
+ * Tempfile.open and Tempfile.new now accept a suffix for the
+ temporary file to be created. To specify a suffix, pass an array
+ of [basename, suffix] as the first argument.
+
+ Tempfile.open(['image', 'jpg']) { |tempfile| ... }
+
+* tmpdir
+
+ * New method:
+
+ * Dir.mktmpdir
+
+* uri
+
+ * added LDAPS scheme.
+ * Change for RFC3986:
+ * FTP
+ * URI('ftp://example.com/foo').path #=> 'foo'
+ * URI('ftp://example.com/%2Ffoo').path #=> '/foo'
+ * URI::FTP.build([nil, 'example.com', nil, '/foo', 'i').to_s #=> 'ftp://example.com/%2Ffoo;type=i'
+ * URI merge
+ * URI('http://a/b/c/d;p?q').merge('?y') == URI('http://a/b/c/d;p?y')
+ * URI('http://a/b/c/d;p?q').merge('/./g') == URI('http://a/g')
+ * URI('http://a/b/c/d;p?q').merge('/../g') == URI('http://a/g')
+ * URI('http://a/b/c/d;p?q').merge('../../../g') == URI('http://a/g')
+ * URI('http://a/b/c/d;p?q').merge('../../../../g') == URI('http://a/g')
+
+* rss
+
+ * 0.1.6 -> 0.2.4
+
+ * Fix image module URI
+
+ * Atom support
+
+ * ITunes module support
+
+ * Slash module support
+
+ * content:encoded with RSS 2.0 support
+
+=== Interpreter Implementation
+
+* passing a block to a Proc [experimental]
+
+ This implementation in current shape is known to be buggy/broken,
+ especially with nested block invocation. Take this as an
+ experimental feature.
+
+* stack trace
+
+ On non-SystemStackError exception, full stack trace is shown.
+
+=== Compatibility issues (excluding feature bug fixes)
+
+* String#slice! had some unintentional bugs and they have been fixed
+ because either they disagreed with documentation or their respective
+ behavior of #slice. Unfortunately, this causes some
+ incompatibilities in the following (somewhat rare) cases.
+
+ * #slice! no longer expands the array when an out-of-boundary value
+ is given.
+
+ # Ruby 1.8.6
+ a = [1,2]
+ a.slice!(4,0) #=> nil
+ a #=> [1,2,nil,nil]
+
+ # Ruby 1.8.7
+ a = [1,2]
+ a.slice!(4,0) #=> nil
+ a #=> [1,2]
+
+ * #slice! no longer raises an exception but returns nil when a
+ negative length or out-of-boundary negative position is given.
+
+ # Ruby 1.8.6
+ a = [1,2]
+ a.slice!(1,-1) #=> (raises IndexError)
+ a.slice!(-5,1) #=> (raises IndexError)
+
+ # Ruby 1.8.7
+ a = [1,2]
+ a.slice!(1,-1) #=> nil
+ a.slice!(-5,1) #=> nil
+
+* String#to_i, String#hex and String#oct no longer accept a sequence
+ of underscores (`__') as part of a number.
+
+ # Ruby 1.8.6
+ '1__0'.to_i #=> 10
+ '1__0'.to_i(2) #=> 2 # 0b10
+ '1__0'.oct #=> 8 # 010
+ '1__0'.hex #=> 16 # 0x10
+
+ # Ruby 1.8.7
+ '1__0'.to_i #=> 1
+ '1__0'.to_i(2) #=> 1
+ '1__0'.oct #=> 1
+ '1__0'.hex #=> 1
+
+ The old behavior was inconsistent with Ruby syntax and considered as
+ a bug.
+
+* date
+
+ * Date.parse
+
+ '##.##.##' (where each '#' is a digit) is now taken as 'YY.MM.DD'
+ instead of 'MM.DD.YY'. While the change may confuse you, you can
+ always use Date.strptime() when you know what you are dealing
+ with.
+
+* stringio
+
+ * StringIO#each_byte
+
+ The return value changed from nil to self. This is what the
+ document says and the same as each_line() does.
+
+* tempfile
+
+ * The file name format has changed. No dots are included by default
+ in temporary file names any more. See above for how to specify a
+ suffix.
+
+* uri
+
+ * See above for details.
+
+== Changes since the 1.8.5 release
+
+=== New platforms/build tools support
+
+* IA64 HP-UX
+
+* Visual C++ 8 SP1
+
+* autoconf 2.6x
+
+=== Global constants
+
+* RUBY_PATCHLEVEL
+
+ New constant since 1.8.5-p1.
+
+=== Library updates (outstanding ones only)
+
+* builtin classes
+
+ * New method: Kernel#instance_variable_defined?
+
+ * New method: Module#class_variable_defined?
+
+ * New feature: Dir::glob() can now take an array of glob patterns.
+
+* date
+
+ * Updated based on date2 4.0.3.
+
+* digest
+
+ * New internal APIs for C and Ruby.
+
+ * Support for autoloading.
+
+ require 'digest'
+
+ # autoloads digest/md5
+ md = Digest::MD5.digest("string")
+
+ * New digest class methods: file
+
+ * New digest instance methods: clone, reset, new, inspect,
+ digest_length (alias size or length), block_length()
+
+ * New library: digest/bubblebabble
+
+ * New function: Digest(name)
+
+* fileutils
+
+ * New option for FileUtils.cp_r(): :remove_destination
+
+* nkf
+
+ * Updated based on nkf as of 2007-01-28.
+
+* thread
+
+ * Replaced with much faster mutex implementation in C. The former
+ implementation, which is slow but considered to be stable, is
+ available with a configure option `--disable-fastthread'.
+
+* tk
+
+ * Updated Tile extension support based on Tile 0.7.8.
+
+ * Support --without-X11 configure option for non-X11 versions of
+ Tcl/Tk (e.g. Tcl/Tk Aqua).
+
+ * New sample script: irbtkw.rbw -- IRB on Ruby/Tk. It has no trouble
+ about STDIN blocking on Windows.
+
+* webrick
+
+ * New method: WEBrick::Cookie.parse_set_cookies()
+
+=== Compatibility issues (excluding feature bug fixes)
+
+* builtin classes
+
+ * String#intern now raises SecurityError when $SAFE level is greater
+ than zero.
+
+* date
+
+ * Time#to_date and Time#to_datetime are added as private methods.
+ They cause name conflict error in ActiveSupport 1.4.1 and prior,
+ which comes with Rails 1.2.2 and prior. Updating ActiveSupport
+ and/or Rails to the latest versions fixes the problem.
+
+* digest
+
+ * The constructor does no longer take an initial string to feed.
+ The following examples show how to migrate:
+
+ # Before
+ md = Digest::MD5.new("string")
+ # After (works with any version)
+ md = Digest::MD5.new.update("string")
+
+ # Before
+ hd = Digest::MD5.new("string").hexdigest
+ # After (works with any version)
+ hd = Digest::MD5.hexdigest("string")
+
+* fileutils
+
+ * A minor implementation change breaks Rake <=0.7.1.
+ Updating Rake to 0.7.2 or higher fixes the problem.
+
+* tk
+
+ * Tk::X_Scrollable (Y_Scrollable) is renamed to Tk::XScrollable
+ (YScrollable). Tk::X_Scrollable (Y_Scrollable) is still available,
+ but it is an alias name.
diff --git a/README b/README
index bde22dff78..1b79781367 100644
--- a/README
+++ b/README
@@ -22,16 +22,24 @@ Perl). It is simple, straight-forward, and extensible.
* How to get Ruby
-The Ruby distribution can be found on:
+The Ruby distribution files can be found in the following FTP site:
ftp://ftp.ruby-lang.org/pub/ruby/
-You can get it by anonymous CVS. How to check out is:
+The latest source code of this version series can be checked out
+through SVN with the following command:
- $ 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
+ $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8/
+
+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/
* Ruby home-page
@@ -62,7 +70,11 @@ 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. Probably this step will not need.
+ Some C compiler flags may be added by default depending on your
+ environment. Specify optflags=.. and warnflags=.. as necessary
+ to override them.
+
+ 3. Edit defines.h if you need. Usually this step will not be needed.
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 5f2427747f..637b19d25b 100644
--- a/README.EXT
+++ b/README.EXT
@@ -8,8 +8,8 @@ In C, variables have types and data do not have types. In contrast,
Ruby variables do not have a static type, and data themselves have
types, so data will need to be converted between the languages.
-Data in Ruby are represented by C type `VALUE'. Each VALUE data has
-its data-type.
+Data in Ruby are represented by the C type `VALUE'. Each VALUE data
+has its data-type.
To retrieve C data from a VALUE, you need to:
@@ -91,26 +91,26 @@ The data for type T_NIL, T_FALSE, T_TRUE are nil, true, false
respectively. They are singletons for the data type.
The T_FIXNUM data is a 31bit length fixed integer (63bit length on
-some machines), which can be convert to a C integer by using the
+some machines), which can be converted to a C integer by using the
FIX2INT() macro. There is also NUM2INT() which converts any Ruby
numbers into C integers. The NUM2INT() macro includes a type check, so
an exception will be raised if the conversion failed. NUM2DBL() can
-be used to retrieve the double float value in same way.
+be used to retrieve the double float value in the same way.
-To get char* from a VALUE, version 1.7 recommend to use new macros
-StringValue() and StringValuePtr(). StringValue(var) replaces var's
-value to the result of "var.to_str()". StringValuePtr(var) does same
-replacement and returns char* representation of var. These macros
-will skip the replacement if var is a String. Notice that the macros
-requires to take only lvalue as their argument, to change the value
-of var in the replacement.
+In version 1.7 or later it is recommended that you use the new macros
+StringValue() and StringValuePtr() to get a char* from a VALUE.
+StringValue(var) replaces var's value with the result of "var.to_str()".
+StringValuePtr(var) does same replacement and returns char*
+representation of var. These macros will skip the replacement if var is
+a String. Notice that the macros take only the lvalue as their
+argument, to change the value of var in place.
-In version 1.6 or earlier, STR2CSTR() was used to do same thing
-but now it is obsoleted in version 1.7 because of STR2CSTR() has
-a risk of dangling pointer problem in to_str() impliclit conversion.
+In version 1.6 or earlier, STR2CSTR() was used to do the same thing
+but now it is deprecated in version 1.7, because STR2CSTR() has a risk
+of a dangling pointer problem in the to_str() impliclit conversion.
Other data types have corresponding C structures, e.g. struct RArray
-for T_ARRAY etc. The VALUE of the type which has corresponding structure
+for T_ARRAY etc. The VALUE of the type which has the corresponding structure
can be cast to retrieve the pointer to the struct. The casting macro
will be of the form RXXXX for each data type; for instance, RARRAY(obj).
See "ruby.h".
@@ -205,7 +205,7 @@ interpreter. Some (not all) of the useful functions are listed below:
rb_ary_unshift(VALUE ary, VALUE val)
Array operations. The first argument to each functions must be an
- array. They may dump core if other types given.
+ array. They may dump core if other types are given.
2. Extending Ruby with C
@@ -244,7 +244,7 @@ To define methods or singleton methods, use these functions:
VALUE (*func)(), int argc)
The `argc' represents the number of the arguments to the C function,
-which must be less than 17. But I believe you don't need that much. :-)
+which must be less than 17. But I doubt you'll need that many.
If `argc' is negative, it specifies the calling sequence, not number of
the arguments.
@@ -272,7 +272,7 @@ private methods:
The other is to define module functions, which are private AND singleton
methods of the module. For example, sqrt is the module function
-defined in Math module. It can be call in the form like:
+defined in Math module. It can be called in the following way:
Math.sqrt(4)
@@ -291,10 +291,19 @@ in the Kernel module, can be defined using:
void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
-To define alias to the method,
+To define an alias for 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:
@@ -312,7 +321,7 @@ There are several ways to invoke Ruby's features from C code.
2.2.1 Evaluate Ruby Programs in a String
The easiest way to use Ruby's functionality from a C program is to
-evaluate the string as Ruby program. This function will do the job.
+evaluate the string as Ruby program. This function will do the job:
VALUE rb_eval_string(const char *str)
@@ -321,17 +330,30 @@ 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 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:
+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:
:Identifier
-You can get the symbol value from a string within C code by using
+You can get the ID 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
@@ -412,7 +434,7 @@ The prototypes of the getter and setter functions are as follows:
(*getter)(ID id, void *data, struct global_entry* entry);
(*setter)(VALUE val, ID id, void *data, struct global_entry* entry);
-3.3 Encapsulate C data into Ruby object
+3.3 Encapsulate C data into a Ruby object
To wrap and objectify a C pointer as a Ruby object (so called
DATA), use Data_Wrap_Struct().
@@ -597,7 +619,7 @@ are not exported to the Ruby world. You need to protect them by
If the file named extconf.rb exists, it will be executed to generate
Makefile.
-extconf.rb is the file for check compilation conditions etc. You
+extconf.rb is the file for checking compilation conditions etc. You
need to put
require 'mkmf'
@@ -612,11 +634,17 @@ various conditions.
The value of the variables below will affect the Makefile.
- $CFLAGS: included in CFLAGS make variable (such as -I)
+ $CFLAGS: included in CFLAGS make variable (such as -O)
+ $CPPFLAGS: included in CPPFLAGS make variable (such as -I, -D)
$LDFLAGS: included in LDFLAGS make variable (such as -L)
+ $objs: list of object file names
+
+Normally, the object files list is automatically generated by searching
+source files, but you must define 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
+``create_makefile''. The Makefile will not be generated, compilation will
not be done.
(5) prepare depend (optional)
@@ -626,7 +654,7 @@ check dependencies. You can make this file by invoking
% gcc -MM *.c > depend
-It's no harm. Prepare it.
+It's harmless. Prepare it.
(6) generate Makefile
@@ -634,6 +662,11 @@ Try generating the Makefile by:
ruby extconf.rb
+If the library should be installed under vendor_ruby directory
+instead of site_ruby directory, use --vendor option as follows.
+
+ ruby extconf.rb --vendor
+
You don't need this step if you put the extension library under the ext
directory of the ruby source tree. In that case, compilation of the
interpreter will do this step for you.
@@ -645,12 +678,12 @@ Type
make
to compile your extension. You don't need this step either if you have
-put extension library under the ext directory of the ruby source tree.
+put the extension library under the ext directory of the ruby source tree.
(8) debug
You may need to rb_debug the extension. Extensions can be linked
-statically by the adding directory name in the ext/Setup file so that
+statically by adding the directory name in the ext/Setup file so that
you can inspect the extension with the debugger.
(9) done, now you have the extension library
@@ -771,7 +804,9 @@ NUM2INT(value)
INT2NUM(i)
NUM2DBL(value)
rb_float_new(f)
-STR2CSTR(value)
+StringValue(value)
+StringValuePtr(value)
+StringValueCStr(value)
rb_str_new2(s)
** defining class/module
@@ -813,15 +848,15 @@ it can't be seen from Ruby programs.
void rb_define_readonly_variable(const char *name, VALUE *var)
Defines a read-only global variable. Works just like
-rb_define_variable(), except defined variable is read-only.
+rb_define_variable(), except the defined variable is read-only.
void rb_define_virtual_variable(const char *name,
VALUE (*getter)(), VALUE (*setter)())
Defines a virtual variable, whose behavior is defined by a pair of C
functions. The getter function is called when the variable is
-referred. The setter function is called when the value is set to the
-variable. The prototype for getter/setter functions are:
+referenced. The setter function is called when the variable is set to a
+value. The prototype for getter/setter functions are:
VALUE getter(ID id)
void setter(VALUE val, ID id)
@@ -981,7 +1016,7 @@ Terminates the interpreter immediately. This function should be
called under the situation caused by the bug in the interpreter. No
exception handling nor ensure execution will be done.
-** Initialize and Starts the Interpreter
+** Initialize and Start the Interpreter
The embedding API functions are below (not needed for extension libraries):
@@ -1001,6 +1036,32 @@ Starts execution of the interpreter.
Specifies the name of the script ($0).
+** Hooks for the Interpreter Events
+
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_t events)
+
+Adds a hook function for the specified interpreter events.
+events should be Or'ed value of:
+
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
+
+The definition of rb_event_hook_func_t is below:
+
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, NODE *node,
+ VALUE self, ID id, VALUE klass)
+
+ int rb_remove_event_hook(rb_event_hook_func_t func)
+
+Removes the specified hook function.
+
Appendix C. Functions Available in extconf.rb
These functions are available in extconf.rb:
@@ -1092,7 +1153,7 @@ 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
+Obtains the information for pkg by pkg-config command. The actual
command name can be overriden by --with-pkg-config command line
option.
diff --git a/README.EXT.ja b/README.EXT.ja
index f5fdbd2613..73425c2cdb 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -331,6 +331,17 @@ 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 Äê¿ôÄêµÁ
³ÈÄ¥¥é¥¤¥Ö¥é¥ê¤¬É¬ÍפÊÄê¿ô¤Ï¤¢¤é¤«¤¸¤áÄêµÁ¤·¤Æ¤ª¤¤¤¿Êý¤¬Îɤ¤
@@ -369,7 +380,8 @@ C¤«¤éʸ»úÎó¤ò·Ðͳ¤»¤º¤ËRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤â¤Ç¤­¤Þ
¤¹¡¥¤½¤ÎÁ°¤Ë¡¤Ruby¥¤¥ó¥¿¥×¥ê¥¿Æâ¤Ç¥á¥½¥Ã¥É¤äÊÑ¿ô̾¤ò»ØÄꤹ¤ë
»þ¤Ë»È¤ï¤ì¤Æ¤¤¤ëID¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤ª¤­¤Þ¤·¤ç¤¦¡¥
-ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤ÎÃæ¤Ç¤Ï
+ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤Ç¤ÏID¤ËÂбþ¤¹¤ë
+¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¥·¥ó¥Ü¥ë(Symbol)¤¬¤¢¤ê¡¤
:¼±ÊÌ»Ò
@@ -382,6 +394,14 @@ ID¤È¤ÏÊÑ¿ô̾¡¤¥á¥½¥Ã¥É̾¤òɽ¤¹À°¿ô¤Ç¤¹¡¥Ruby¤ÎÃæ¤Ç¤Ï
rb_to_id(VALUE symbol)
+ID¤«¤é¥·¥ó¥Ü¥ë¤òÆÀ¤ë¤¿¤á¤Ë¤Ï°Ê²¼¤Î¥Þ¥¯¥í¤ò»È¤¤¤Þ¤¹¡¥
+
+ VALUE ID2SYM(ID id)
+
+¥·¥ó¥Ü¥ë¤«¤éID¤òÆÀ¤ë¤¿¤á¤Ë¤Ï°Ê²¼¤Î¥Þ¥¯¥í¤ò»È¤¤¤Þ¤¹¡¥
+
+ ID SYM2ID(VALUE symbol)
+
2.2.3 C¤«¤éRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹
C¤«¤éʸ»úÎó¤ò·Ðͳ¤»¤º¤ËRuby¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤¿¤á¤Ë¤Ï°Ê²¼
@@ -710,8 +730,14 @@ Makefile¤òºî¤ë¾ì¹ç¤Î¿÷·¿¤Ë¤Ê¤ëextconf.rb¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤òºî¤ê
°Ê²¼¤ÎÊÑ¿ô¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡¥
- $CFLAGS: ¥³¥ó¥Ñ¥¤¥ë»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-I¤Ê¤É)
+ $CFLAGS: ¥³¥ó¥Ñ¥¤¥ë»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-O¤Ê¤É)
+ $CPPFLAGS: ¥×¥ê¥×¥í¥»¥Ã¥µ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-I¤ä-D¤Ê¤É)
$LDFLAGS: ¥ê¥ó¥¯»þ¤ËÄɲÃŪ¤Ë»ØÄꤹ¤ë¥Õ¥é¥°(-L¤Ê¤É)
+ $objs: ¥ê¥ó¥¯¤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë̾¤Î¥ê¥¹¥È
+
+¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤Ï¡¢Ä̾ï¤Ï¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò¸¡º÷¤·
+¤Æ¼«Æ°Åª¤ËÀ¸À®¤µ¤ì¤Þ¤¹¤¬¡¢make¤ÎÅÓÃæ¤Ç¥½¡¼¥¹¤òÀ¸À®¤¹¤ë¤è¤¦¤Ê
+¾ì¹ç¤ÏÌÀ¼¨Åª¤Ë»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
¥é¥¤¥Ö¥é¥ê¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¾ò·ï¤¬Â·¤ï¤º¡¤¤½¤Î¥é¥¤¥Ö¥é¥ê¤ò¥³¥ó
¥Ñ¥¤¥ë¤·¤Ê¤¤»þ¤Ë¤Ïcreate_makefile¤ò¸Æ¤Ð¤Ê¤±¤ì¤ÐMakefile¤ÏÀ¸
@@ -739,6 +765,12 @@ Makefile¤ò¼ÂºÝ¤ËÀ¸À®¤¹¤ë¤¿¤á¤Ë¤Ï
¤È¤·¤Æ¤¯¤À¤µ¤¤¡¥
+site_ruby ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¯¡¢
+vendor_ruby ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¾ì¹ç¤Ë¤Ï
+°Ê²¼¤Î¤è¤¦¤Ë --vendor ¥ª¥×¥·¥ç¥ó¤ò²Ã¤¨¤Æ¤¯¤À¤µ¤¤¡¥
+
+ ruby extconf.rb --vendor
+
¥Ç¥£¥ì¥¯¥È¥ê¤òext°Ê²¼¤ËÍѰդ·¤¿¾ì¹ç¤Ë¤ÏRubyÁ´ÂΤÎmake¤Î»þ¤Ë
¼«Æ°Åª¤ËMakefile¤¬À¸À®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¤¤³¤Î¥¹¥Æ¥Ã¥×¤ÏÉÔÍפǤ¹¡¥
@@ -891,7 +923,9 @@ NUM2INT(value)
INT2NUM(i)
NUM2DBL(value)
rb_float_new(f)
-STR2CSTR(value)
+StringValue(value)
+StringValuePtr(value)
+StringValueCStr(value)
rb_str_new2(s)
** ¥¯¥é¥¹/¥â¥¸¥å¡¼¥ëÄêµÁ
diff --git a/README.ja b/README.ja
index fc502dd440..71ce4ee12c 100644
--- a/README.ja
+++ b/README.ja
@@ -26,18 +26,25 @@ Ruby¤Ï¥Æ¥­¥¹¥È½èÍý´Ø·¸¤ÎǽÎϤʤɤËÍ¥¤ì¡¤Perl¤ÈƱ¤¸¤¯¤é¤¤¶¯ÎÏ
* Æþ¼êË¡
-** ftp¤Ç
+** FTP¤Ç
°Ê²¼¤Î¾ì½ê¤Ë¤ª¤¤¤Æ¤¢¤ê¤Þ¤¹¡¥
ftp://ftp.ruby-lang.org/pub/ruby/
-** CVS¤Ç
+** Subversion¤Ç
- $ 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¤ÎºÇ¿·¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡¥
+
+ $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8/
+
+³«È¯Àèü¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡¥
+
+ $ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby
+
+¾¤Ë³«È¯Ãæ¤Î¥Ö¥é¥ó¥Á¤Î°ìÍ÷¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¸«¤é¤ì¤Þ¤¹¡¥
+
+ $ svn ls http://svn.ruby-lang.org/repos/ruby/branches/
* ¥Û¡¼¥à¥Ú¡¼¥¸
@@ -85,6 +92,10 @@ Ruby³ÈÄ¥¥â¥¸¥å¡¼¥ë¤Ë¤Ä¤¤¤ÆÏ䷹礦ruby-ext¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤È
2. configure¤ò¼Â¹Ô¤·¤ÆMakefile¤Ê¤É¤òÀ¸À®¤¹¤ë
+ ´Ä¶­¤Ë¤è¤Ã¤Æ¤Ï¥Ç¥Õ¥©¥ë¥È¤ÎC¥³¥ó¥Ñ¥¤¥éÍÑ¥ª¥×¥·¥ç¥ó¤¬ÉÕ¤­
+ ¤Þ¤¹¡¥configure¥ª¥×¥·¥ç¥ó¤Ç optflags=.. warnflags=.. Åù
+ ¤Ç¾å½ñ¤­¤Ç¤­¤Þ¤¹¡¥
+
3. (ɬÍפʤé¤Ð)defines.h¤òÊÔ½¸¤¹¤ë
¿ʬ¡¤É¬Í×̵¤¤¤È»×¤¤¤Þ¤¹¡¥
diff --git a/array.c b/array.c
index f16e0a663c..7e8c12b683 100644
--- a/array.c
+++ b/array.c
@@ -20,6 +20,7 @@ VALUE rb_cArray;
static ID id_cmp;
#define ARY_DEFAULT_SIZE 16
+#define ARY_MAX_SIZE (LONG_MAX / sizeof(VALUE))
void
rb_mem_clear(mem, size)
@@ -120,7 +121,7 @@ ary_new(klass, len)
if (len < 0) {
rb_raise(rb_eArgError, "negative array size (or size too big)");
}
- if (len > 0 && len * sizeof(VALUE) <= len) {
+ if (len > ARY_MAX_SIZE) {
rb_raise(rb_eArgError, "array size too big");
}
if (len == 0) len++;
@@ -188,11 +189,34 @@ 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;
}
+static VALUE
+ary_make_shared(ary)
+ VALUE ary;
+{
+ if (!FL_TEST(ary, ELTS_SHARED)) {
+ NEWOBJ(shared, struct RArray);
+ OBJSETUP(shared, rb_cArray, T_ARRAY);
+
+ shared->len = RARRAY(ary)->len;
+ shared->ptr = RARRAY(ary)->ptr;
+ shared->aux.capa = RARRAY(ary)->aux.capa;
+ RARRAY(ary)->aux.shared = (VALUE)shared;
+ FL_SET(ary, ELTS_SHARED);
+ OBJ_FREEZE(shared);
+ return (VALUE)shared;
+ }
+ else {
+ return RARRAY(ary)->aux.shared;
+ }
+}
+
VALUE
rb_assoc_new(car, cdr)
VALUE car, cdr;
@@ -270,6 +294,7 @@ rb_ary_initialize(argc, argv, ary)
long len;
VALUE size, val;
+ rb_ary_modify(ary);
if (rb_scan_args(argc, argv, "02", &size, &val) == 0) {
RARRAY(ary)->len = 0;
if (rb_block_given_p()) {
@@ -290,10 +315,9 @@ rb_ary_initialize(argc, argv, ary)
if (len < 0) {
rb_raise(rb_eArgError, "negative array size");
}
- if (len > 0 && len * (long)sizeof(VALUE) <= len) {
+ if (len > ARY_MAX_SIZE) {
rb_raise(rb_eArgError, "array size too big");
}
- rb_ary_modify(ary);
if (len > RARRAY(ary)->aux.capa) {
REALLOC_N(RARRAY(ary)->ptr, VALUE, len);
RARRAY(ary)->aux.capa = len;
@@ -356,6 +380,9 @@ rb_ary_store(ary, idx, val)
idx - RARRAY(ary)->len);
}
}
+ else if (idx >= ARY_MAX_SIZE) {
+ rb_raise(rb_eIndexError, "index %ld too big", idx);
+ }
rb_ary_modify(ary);
if (idx >= RARRAY(ary)->aux.capa) {
@@ -364,10 +391,10 @@ rb_ary_store(ary, idx, val)
if (new_capa < ARY_DEFAULT_SIZE) {
new_capa = ARY_DEFAULT_SIZE;
}
- new_capa += idx;
- if (new_capa * (long)sizeof(VALUE) <= new_capa) {
- rb_raise(rb_eArgError, "index too big");
+ if (new_capa >= ARY_MAX_SIZE - idx) {
+ new_capa = (ARY_MAX_SIZE - idx) / 2;
}
+ new_capa += idx;
REALLOC_N(RARRAY(ary)->ptr, VALUE, new_capa);
RARRAY(ary)->aux.capa = new_capa;
}
@@ -382,6 +409,50 @@ rb_ary_store(ary, idx, val)
RARRAY(ary)->ptr[idx] = val;
}
+static VALUE
+ary_shared_array(klass, ary)
+ VALUE klass;
+ VALUE ary;
+{
+ VALUE val = ary_alloc(klass);
+
+ ary_make_shared(ary);
+ RARRAY(val)->ptr = RARRAY(ary)->ptr;
+ RARRAY(val)->len = RARRAY(ary)->len;
+ RARRAY(val)->aux.shared = RARRAY(ary)->aux.shared;
+ FL_SET(val, ELTS_SHARED);
+ return val;
+}
+
+static VALUE
+ary_shared_first(argc, argv, ary, last)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+ int last;
+{
+ VALUE nv, result;
+ long n;
+ long offset = 0;
+
+ rb_scan_args(argc, argv, "1", &nv);
+ n = NUM2LONG(nv);
+ if (n > RARRAY(ary)->len) {
+ n = RARRAY(ary)->len;
+ }
+ else if (n < 0) {
+ rb_raise(rb_eArgError, "negative array size");
+ }
+ if (last) {
+ offset = RARRAY(ary)->len - n;
+ }
+ result = ary_shared_array(rb_cArray, ary);
+ RARRAY(result)->ptr += offset;
+ RARRAY(result)->len = n;
+
+ return result;
+}
+
/*
* call-seq:
* array << obj -> array
@@ -429,18 +500,6 @@ rb_ary_push_m(argc, argv, ary)
return ary;
}
-/*
- * call-seq:
- * array.pop -> obj or nil
- *
- * Removes the last element from <i>self</i> and returns it, or
- * <code>nil</code> if the array is empty.
- *
- * a = [ "a", "m", "z" ]
- * a.pop #=> "z"
- * a #=> ["a", "m"]
- */
-
VALUE
rb_ary_pop(ary)
VALUE ary;
@@ -448,7 +507,7 @@ rb_ary_pop(ary)
rb_ary_modify_check(ary);
if (RARRAY(ary)->len == 0) return Qnil;
if (!FL_TEST(ary, ELTS_SHARED) &&
- RARRAY(ary)->len * 2 < RARRAY(ary)->aux.capa &&
+ RARRAY(ary)->len * 3 < RARRAY(ary)->aux.capa &&
RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) {
RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2;
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);
@@ -456,54 +515,112 @@ rb_ary_pop(ary)
return RARRAY(ary)->ptr[--RARRAY(ary)->len];
}
+/*
+ * call-seq:
+ * array.pop -> obj or nil
+ * array.pop(n) -> array
+ *
+ * Removes the last element from <i>self</i> and returns it, or
+ * <code>nil</code> if the array is empty.
+ *
+ * If a number _n_ is given, returns an array of the last n elements
+ * (or less) just like <code>array.slice!(-n, n)</code> does.
+ *
+ * a = [ "a", "b", "c", "d" ]
+ * a.pop #=> "d"
+ * a.pop(2) #=> ["b", "c"]
+ * a #=> ["a"]
+ */
+
static VALUE
-ary_make_shared(ary)
+rb_ary_pop_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- if (!FL_TEST(ary, ELTS_SHARED)) {
- NEWOBJ(shared, struct RArray);
- OBJSETUP(shared, rb_cArray, T_ARRAY);
+ VALUE result;
- shared->len = RARRAY(ary)->len;
- shared->ptr = RARRAY(ary)->ptr;
- shared->aux.capa = RARRAY(ary)->aux.capa;
- RARRAY(ary)->aux.shared = (VALUE)shared;
- FL_SET(ary, ELTS_SHARED);
- OBJ_FREEZE(shared);
- return (VALUE)shared;
+ if (argc == 0) {
+ return rb_ary_pop(ary);
}
- else {
- return RARRAY(ary)->aux.shared;
+
+ rb_ary_modify_check(ary);
+ result = ary_shared_first(argc, argv, ary, Qtrue);
+ RARRAY(ary)->len -= RARRAY(result)->len;
+ return result;
+}
+
+VALUE
+rb_ary_shift(ary)
+ VALUE ary;
+{
+ VALUE top;
+
+ rb_ary_modify_check(ary);
+ if (RARRAY(ary)->len == 0) return Qnil;
+ top = RARRAY(ary)->ptr[0];
+ if (!FL_TEST(ary, ELTS_SHARED)) {
+ if (RARRAY(ary)->len < ARY_DEFAULT_SIZE) {
+ MEMMOVE(RARRAY(ary)->ptr, RARRAY(ary)->ptr+1, VALUE, RARRAY(ary)->len-1);
+ RARRAY(ary)->len--;
+ return top;
+ }
+ RARRAY(ary)->ptr[0] = Qnil;
+ ary_make_shared(ary);
}
+ RARRAY(ary)->ptr++; /* shift ptr */
+ RARRAY(ary)->len--;
+
+ return top;
}
/*
* call-seq:
- * array.shift -> obj or nil
+ * array.shift -> obj or nil
+ * array.shift(n) -> array
*
* Returns the first element of <i>self</i> and removes it (shifting all
* other elements down by one). Returns <code>nil</code> if the array
* is empty.
+ *
+ * If a number _n_ is given, returns an array of the first n elements
+ * (or less) just like <code>array.slice!(0, n)</code> does.
*
* args = [ "-m", "-q", "filename" ]
- * args.shift #=> "-m"
- * args #=> ["-q", "filename"]
+ * args.shift #=> "-m"
+ * args #=> ["-q", "filename"]
+ *
+ * args = [ "-m", "-q", "filename" ]
+ * args.shift(2) #=> ["-m", "-q"]
+ * args #=> ["filename"]
*/
-VALUE
-rb_ary_shift(ary)
+static VALUE
+rb_ary_shift_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- VALUE top;
+ VALUE result;
+ long n;
+
+ if (argc == 0) {
+ return rb_ary_shift(ary);
+ }
rb_ary_modify_check(ary);
- if (RARRAY(ary)->len == 0) return Qnil;
- top = RARRAY(ary)->ptr[0];
- ary_make_shared(ary);
- RARRAY(ary)->ptr++; /* shift ptr */
- RARRAY(ary)->len--;
+ result = ary_shared_first(argc, argv, ary, Qfalse);
+ n = RARRAY(result)->len;
+ if (FL_TEST(ary, ELTS_SHARED)) {
+ RARRAY(ary)->ptr += n;
+ RARRAY(ary)->len -= n;
+ }
+ else {
+ MEMMOVE(RARRAY(ary)->ptr, RARRAY(ary)->ptr+n, VALUE, RARRAY(ary)->len-n);
+ RARRAY(ary)->len -= n;
+ }
- return top;
+ return result;
}
VALUE
@@ -596,7 +713,7 @@ rb_ary_subseq(ary, beg, len)
if (beg > RARRAY(ary)->len) return Qnil;
if (beg < 0 || len < 0) return Qnil;
- if (beg + len > RARRAY(ary)->len) {
+ if (RARRAY(ary)->len < len || RARRAY(ary)->len < beg + len) {
len = RARRAY(ary)->len - beg;
if (len < 0)
len = 0;
@@ -715,12 +832,16 @@ rb_ary_at(ary, pos)
/*
* call-seq:
* array.first -> obj or nil
- *
- * Returns the first element of the array. If the array is empty,
- * returns <code>nil</code>.
- *
+ * 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.
+ *
* a = [ "q", "r", "s", "t" ]
- * a.first #=> "q"
+ * a.first #=> "q"
+ * a.first(1) #=> ["q"]
+ * a.first(3) #=> ["q", "r", "s"]
*/
static VALUE
@@ -734,17 +855,7 @@ rb_ary_first(argc, argv, ary)
return RARRAY(ary)->ptr[0];
}
else {
- VALUE nv, result;
- long n, i;
-
- rb_scan_args(argc, argv, "01", &nv);
- n = NUM2LONG(nv);
- if (n > RARRAY(ary)->len) n = RARRAY(ary)->len;
- result = rb_ary_new2(n);
- for (i=0; i<n; i++) {
- rb_ary_push(result, RARRAY(ary)->ptr[i]);
- }
- return result;
+ return ary_shared_first(argc, argv, ary, Qfalse);
}
}
@@ -770,17 +881,7 @@ rb_ary_last(argc, argv, ary)
return RARRAY(ary)->ptr[RARRAY(ary)->len-1];
}
else {
- VALUE nv, result;
- long n, i;
-
- rb_scan_args(argc, argv, "01", &nv);
- n = NUM2LONG(nv);
- if (n > RARRAY(ary)->len) n = RARRAY(ary)->len;
- result = rb_ary_new2(n);
- for (i=RARRAY(ary)->len-n; n--; i++) {
- rb_ary_push(result, RARRAY(ary)->ptr[i]);
- }
- return result;
+ return ary_shared_first(argc, argv, ary, Qtrue);
}
}
@@ -836,24 +937,41 @@ rb_ary_fetch(argc, argv, ary)
/*
* call-seq:
- * array.index(obj) -> int or nil
+ * array.index(obj) -> int or nil
+ * array.index {|item| block} -> int or nil
*
- * Returns the index of the first object in <i>self</i> such that is
- * <code>==</code> to <i>obj</i>. Returns <code>nil</code> if
- * no match is found.
+ * Returns the index of the first object in <i>self</i> such that is
+ * <code>==</code> to <i>obj</i>. If a block is given instead of an
+ * argument, returns first object for which <em>block</em> is true.
+ * Returns <code>nil</code> if no match is found.
*
* a = [ "a", "b", "c" ]
- * a.index("b") #=> 1
- * a.index("z") #=> nil
+ * a.index("b") #=> 1
+ * a.index("z") #=> nil
+ * a.index{|x|x=="b"} #=> 1
+ *
+ * This is an alias of <code>#find_index</code>.
*/
static VALUE
-rb_ary_index(ary, val)
+rb_ary_index(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- VALUE val;
{
+ VALUE val;
long i;
+ if (argc == 0) {
+ RETURN_ENUMERATOR(ary, 0, 0);
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
+ return LONG2NUM(i);
+ }
+ }
+ return Qnil;
+ }
+ rb_scan_args(argc, argv, "01", &val);
for (i=0; i<RARRAY(ary)->len; i++) {
if (rb_equal(RARRAY(ary)->ptr[i], val))
return LONG2NUM(i);
@@ -865,29 +983,44 @@ rb_ary_index(ary, val)
* call-seq:
* array.rindex(obj) -> int or nil
*
- * Returns the index of the last object in <i>array</i>
- * <code>==</code> to <i>obj</i>. Returns <code>nil</code> if
- * no match is found.
+ * Returns the index of the last object in <i>array</i>
+ * <code>==</code> to <i>obj</i>. If a block is given instead of an
+ * argument, returns first object for which <em>block</em> is
+ * true. Returns <code>nil</code> if no match is found.
*
* a = [ "a", "b", "b", "b", "c" ]
- * a.rindex("b") #=> 3
- * a.rindex("z") #=> nil
+ * a.rindex("b") #=> 3
+ * a.rindex("z") #=> nil
+ * a.rindex{|x|x=="b"} #=> 3
*/
static VALUE
-rb_ary_rindex(ary, val)
+rb_ary_rindex(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- VALUE val;
{
+ VALUE val;
long i = RARRAY(ary)->len;
+ if (argc == 0) {
+ RETURN_ENUMERATOR(ary, 0, 0);
+ while (i--) {
+ if (RTEST(rb_yield(RARRAY(ary)->ptr[i])))
+ return LONG2NUM(i);
+ if (i > RARRAY(ary)->len) {
+ i = RARRAY(ary)->len;
+ }
+ }
+ return Qnil;
+ }
+ rb_scan_args(argc, argv, "01", &val);
while (i--) {
+ if (rb_equal(RARRAY(ary)->ptr[i], val))
+ return LONG2NUM(i);
if (i > RARRAY(ary)->len) {
i = RARRAY(ary)->len;
- continue;
}
- if (rb_equal(RARRAY(ary)->ptr[i], val))
- return LONG2NUM(i);
}
return Qnil;
}
@@ -897,7 +1030,7 @@ rb_ary_rindex(ary, val)
* array.indexes( i1, i2, ... iN ) -> an_array
* array.indices( i1, i2, ... iN ) -> an_array
*
- * Deprecated; use <code>Array#select</code>.
+ * Deprecated; use <code>Array#values_at</code>.
*/
static VALUE
@@ -947,7 +1080,7 @@ rb_ary_splice(ary, beg, len, rpl)
rb_raise(rb_eIndexError, "index %ld out of array", beg);
}
}
- if (beg + len > RARRAY(ary)->len) {
+ if (RARRAY(ary)->len < len || RARRAY(ary)->len < beg + len) {
len = RARRAY(ary)->len - beg;
}
@@ -961,6 +1094,9 @@ rb_ary_splice(ary, beg, len, rpl)
rb_ary_modify(ary);
if (beg >= RARRAY(ary)->len) {
+ if (beg > ARY_MAX_SIZE - rlen) {
+ rb_raise(rb_eIndexError, "index %ld too big", beg);
+ }
len = beg + rlen;
if (len >= RARRAY(ary)->aux.capa) {
REALLOC_N(RARRAY(ary)->ptr, VALUE, len);
@@ -1084,6 +1220,7 @@ 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)");
}
@@ -1091,11 +1228,9 @@ rb_ary_insert(argc, argv, ary)
if (pos == -1) {
pos = RARRAY(ary)->len;
}
- else if (pos < 0) {
+ if (pos < 0) {
pos++;
}
-
- if (argc == 1) return ary;
rb_ary_splice(ary, pos, 0, rb_ary_new4(argc - 1, argv + 1));
return ary;
}
@@ -1121,6 +1256,7 @@ rb_ary_each(ary)
{
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
for (i=0; i<RARRAY(ary)->len; i++) {
rb_yield(RARRAY(ary)->ptr[i]);
}
@@ -1148,6 +1284,7 @@ rb_ary_each_index(ary)
{
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
for (i=0; i<RARRAY(ary)->len; i++) {
rb_yield(LONG2NUM(i));
}
@@ -1173,8 +1310,10 @@ static VALUE
rb_ary_reverse_each(ary)
VALUE ary;
{
- long len = RARRAY(ary)->len;
+ long len;
+ RETURN_ENUMERATOR(ary, 0, 0);
+ len = RARRAY(ary)->len;
while (len--) {
rb_yield(RARRAY(ary)->ptr[len]);
if (RARRAY(ary)->len < len) {
@@ -1721,6 +1860,7 @@ rb_ary_collect_bang(ary)
{
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
rb_ary_modify(ary);
for (i = 0; i < RARRAY(ary)->len; i++) {
rb_ary_store(ary, i, rb_yield(RARRAY(ary)->ptr[i]));
@@ -1805,6 +1945,7 @@ rb_ary_select(ary)
VALUE result;
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
result = rb_ary_new2(RARRAY(ary)->len);
for (i = 0; i < RARRAY(ary)->len; i++) {
if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
@@ -1944,22 +2085,42 @@ rb_ary_slice_bang(argc, argv, ary)
VALUE ary;
{
VALUE arg1, arg2;
- long pos, len;
+ long pos, len, orig_len;
+ rb_ary_modify_check(ary);
if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
pos = NUM2LONG(arg1);
len = NUM2LONG(arg2);
delete_pos_len:
+ if (len < 0) return Qnil;
+ orig_len = RARRAY_LEN(ary);
if (pos < 0) {
- pos = RARRAY(ary)->len + pos;
+ pos += orig_len;
+ if (pos < 0) return Qnil;
+ }
+ else if (orig_len < pos) return Qnil;
+ if (orig_len < pos + len) {
+ len = orig_len - pos;
}
- arg2 = rb_ary_subseq(ary, pos, len);
- rb_ary_splice(ary, pos, len, Qnil); /* Qnil/rb_ary_new2(0) */
+ if (len == 0) return rb_ary_new2(0);
+ arg2 = rb_ary_new4(len, RARRAY_PTR(ary)+pos);
+ RBASIC(arg2)->klass = rb_obj_class(ary);
+ rb_ary_splice(ary, pos, len, Qnil); /* Qundef in 1.9 */
return arg2;
}
- if (!FIXNUM_P(arg1) && rb_range_beg_len(arg1, &pos, &len, RARRAY(ary)->len, 1)) {
- goto delete_pos_len;
+ if (!FIXNUM_P(arg1)) {
+ switch (rb_range_beg_len(arg1, &pos, &len, RARRAY_LEN(ary), 0)) {
+ case Qtrue:
+ /* valid range */
+ goto delete_pos_len;
+ case Qnil:
+ /* invalid range */
+ return Qnil;
+ default:
+ /* not a range */
+ break;
+ }
}
return rb_ary_delete_at(ary, NUM2LONG(arg1));
@@ -1981,6 +2142,7 @@ rb_ary_reject_bang(ary)
{
long i1, i2;
+ RETURN_ENUMERATOR(ary, 0, 0);
rb_ary_modify(ary);
for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) {
VALUE v = RARRAY(ary)->ptr[i1];
@@ -2009,6 +2171,7 @@ static VALUE
rb_ary_reject(ary)
VALUE ary;
{
+ RETURN_ENUMERATOR(ary, 0, 0);
ary = rb_ary_dup(ary);
rb_ary_reject_bang(ary);
return ary;
@@ -2029,6 +2192,7 @@ static VALUE
rb_ary_delete_if(ary)
VALUE ary;
{
+ RETURN_ENUMERATOR(ary, 0, 0);
rb_ary_reject_bang(ary);
return ary;
}
@@ -2220,7 +2384,7 @@ rb_ary_fill(argc, argv, ary)
VALUE ary;
{
VALUE item, arg1, arg2;
- long beg, end, len;
+ long beg = 0, end = 0, len = 0;
VALUE *p, *pend;
int block_p = Qfalse;
@@ -2252,15 +2416,19 @@ rb_ary_fill(argc, argv, ary)
break;
}
rb_ary_modify(ary);
+ if (len < 0) {
+ return ary;
+ }
+ if (beg >= ARY_MAX_SIZE || len > ARY_MAX_SIZE - beg) {
+ rb_raise(rb_eArgError, "argument too big");
+ }
end = beg + len;
if (end > RARRAY(ary)->len) {
if (end >= RARRAY(ary)->aux.capa) {
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
RARRAY(ary)->aux.capa = end;
}
- if (beg > RARRAY(ary)->len) {
- rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
- }
+ rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
RARRAY(ary)->len = end;
}
@@ -2364,7 +2532,7 @@ rb_ary_times(ary, times)
if (len < 0) {
rb_raise(rb_eArgError, "negative argument");
}
- if (LONG_MAX/len < RARRAY(ary)->len) {
+ if (ARY_MAX_SIZE/len < RARRAY(ary)->len) {
rb_raise(rb_eArgError, "argument too big");
}
len *= RARRAY(ary)->len;
@@ -2408,9 +2576,8 @@ rb_ary_assoc(ary, key)
VALUE v;
for (i = 0; i < RARRAY(ary)->len; ++i) {
- v = RARRAY(ary)->ptr[i];
- if (TYPE(v) == T_ARRAY &&
- RARRAY(v)->len > 0 &&
+ v = rb_check_array_type(RARRAY(ary)->ptr[i]);
+ if (!NIL_P(v) && RARRAY(v)->len > 0 &&
rb_equal(RARRAY(v)->ptr[0], key))
return v;
}
@@ -2448,6 +2615,22 @@ rb_ary_rassoc(ary, value)
return Qnil;
}
+static VALUE recursive_equal _((VALUE, VALUE, int));
+static VALUE
+recursive_equal(ary1, ary2, recur)
+ VALUE ary1, ary2;
+ int recur;
+{
+ long i;
+
+ if (recur) return Qfalse;
+ for (i=0; i<RARRAY(ary1)->len; i++) {
+ if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
+ return Qfalse;
+ }
+ return Qtrue;
+}
+
/*
* call-seq:
* array == other_array -> bool
@@ -2466,8 +2649,6 @@ static VALUE
rb_ary_equal(ary1, ary2)
VALUE ary1, ary2;
{
- long i;
-
if (ary1 == ary2) return Qtrue;
if (TYPE(ary2) != T_ARRAY) {
if (!rb_respond_to(ary2, rb_intern("to_ary"))) {
@@ -2476,8 +2657,20 @@ rb_ary_equal(ary1, ary2)
return rb_equal(ary2, ary1);
}
if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
+ return rb_exec_recursive(recursive_equal, ary1, ary2);
+}
+
+static VALUE recursive_eql _((VALUE, VALUE, int));
+static VALUE
+recursive_eql(ary1, ary2, recur)
+ VALUE ary1, ary2;
+ int recur;
+{
+ long i;
+
+ if (recur) return Qfalse;
for (i=0; i<RARRAY(ary1)->len; i++) {
- if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
+ if (!rb_eql(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
return Qfalse;
}
return Qtrue;
@@ -2495,33 +2688,26 @@ static VALUE
rb_ary_eql(ary1, ary2)
VALUE ary1, ary2;
{
- long i;
-
if (ary1 == ary2) return Qtrue;
if (TYPE(ary2) != T_ARRAY) return Qfalse;
if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
- for (i=0; i<RARRAY(ary1)->len; i++) {
- if (!rb_eql(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
- return Qfalse;
- }
- return Qtrue;
+ return rb_exec_recursive(recursive_eql, ary1, ary2);
}
-/*
- * call-seq:
- * array.hash -> fixnum
- *
- * Compute a hash-code for this array. Two arrays with the same content
- * will have the same hash code (and will compare using <code>eql?</code>).
- */
-
+static VALUE recursive_hash _((VALUE, VALUE, int));
static VALUE
-rb_ary_hash(ary)
+recursive_hash(ary, dummy, recur)
VALUE ary;
+ VALUE dummy;
+ int recur;
{
long i, h;
VALUE n;
+ if (recur) {
+ return LONG2FIX(0);
+ }
+
h = RARRAY(ary)->len;
for (i=0; i<RARRAY(ary)->len; i++) {
h = (h << 1) | (h<0 ? 1 : 0);
@@ -2533,6 +2719,21 @@ rb_ary_hash(ary)
/*
* call-seq:
+ * array.hash -> fixnum
+ *
+ * Compute a hash-code for this array. Two arrays with the same content
+ * will have the same hash code (and will compare using <code>eql?</code>).
+ */
+
+static VALUE
+rb_ary_hash(ary)
+ VALUE ary;
+{
+ return rb_exec_recursive(recursive_hash, ary, 0);
+}
+
+/*
+ * call-seq:
* array.include?(obj) -> true or false
*
* Returns <code>true</code> if the given object is present in
@@ -2560,6 +2761,29 @@ rb_ary_includes(ary, item)
}
+static VALUE recursive_cmp _((VALUE, VALUE, int));
+static VALUE
+recursive_cmp(ary1, ary2, recur)
+ VALUE ary1;
+ VALUE ary2;
+ int recur;
+{
+ long i, len;
+
+ if (recur) return Qnil;
+ len = RARRAY(ary1)->len;
+ if (len > RARRAY(ary2)->len) {
+ len = RARRAY(ary2)->len;
+ }
+ for (i=0; i<len; i++) {
+ VALUE v = rb_funcall(rb_ary_elt(ary1, i), id_cmp, 1, rb_ary_elt(ary2, i));
+ if (v != INT2FIX(0)) {
+ return v;
+ }
+ }
+ return Qundef;
+}
+
/*
* call-seq:
* array <=> other_array -> -1, 0, +1
@@ -2584,19 +2808,13 @@ VALUE
rb_ary_cmp(ary1, ary2)
VALUE ary1, ary2;
{
- long i, len;
+ long len;
+ VALUE v;
ary2 = to_ary(ary2);
- len = RARRAY(ary1)->len;
- if (len > RARRAY(ary2)->len) {
- len = RARRAY(ary2)->len;
- }
- for (i=0; i<len; i++) {
- VALUE v = rb_funcall(rb_ary_elt(ary1, i), id_cmp, 1, rb_ary_elt(ary2, i));
- if (v != INT2FIX(0)) {
- return v;
- }
- }
+ if (ary1 == ary2) return INT2FIX(0);
+ v = rb_exec_recursive(recursive_cmp, ary1, ary2);
+ if (v != Qundef) return v;
len = RARRAY(ary1)->len - RARRAY(ary2)->len;
if (len == 0) return INT2FIX(0);
if (len > 0) return INT2FIX(1);
@@ -2637,7 +2855,8 @@ static VALUE
rb_ary_diff(ary1, ary2)
VALUE ary1, ary2;
{
- VALUE ary3, hash;
+ VALUE ary3;
+ volatile VALUE hash;
long i;
hash = ary_make_hash(to_ary(ary2), 0);
@@ -2835,6 +3054,7 @@ rb_ary_compact(ary)
* array.nitems -> int
*
* Returns the number of non-<code>nil</code> elements in _self_.
+ *
* May be zero.
*
* [ 1, nil, 3, nil, 5 ].nitems #=> 3
@@ -2847,110 +3067,691 @@ rb_ary_nitems(ary)
long n = 0;
VALUE *p, *pend;
- p = RARRAY(ary)->ptr;
- pend = p + RARRAY(ary)->len;
-
- while (p < pend) {
+ for (p = RARRAY(ary)->ptr, pend = p + RARRAY(ary)->len; p < pend; p++) {
if (!NIL_P(*p)) n++;
- p++;
}
return LONG2NUM(n);
}
-static long
-flatten(ary, idx, ary2, memo)
+/*
+ * call-seq:
+ * array.count -> int
+ * array.count(obj) -> int
+ * array.count { |item| block } -> int
+ *
+ * Returns the number of elements. If an argument is given, counts
+ * the number of elements which equals to <i>obj</i>. If a block is
+ * given, counts the number of elements yielding a true value.
+ *
+ * ary = [1, 2, 4, 2]
+ * ary.count # => 4
+ * ary.count(2) # => 2
+ * ary.count{|x|x%2==0} # => 3
+ *
+ */
+
+static VALUE
+rb_ary_count(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- long idx;
- VALUE ary2, memo;
{
- VALUE id;
- long i = idx;
- long n, lim = idx + RARRAY(ary2)->len;
+ long n = 0;
- id = rb_obj_id(ary2);
- if (rb_ary_includes(memo, id)) {
- rb_raise(rb_eArgError, "tried to flatten recursive array");
+ if (argc == 0) {
+ VALUE *p, *pend;
+
+ if (!rb_block_given_p())
+ return LONG2NUM(RARRAY_LEN(ary));
+
+ for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
+ if (RTEST(rb_yield(*p))) n++;
+ }
+ }
+ else {
+ VALUE obj, *p, *pend;
+
+ rb_scan_args(argc, argv, "1", &obj);
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
+ for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
+ if (rb_equal(*p, obj)) n++;
+ }
}
- rb_ary_push(memo, id);
- rb_ary_splice(ary, idx, 1, ary2);
- while (i < lim) {
- VALUE tmp;
- tmp = rb_check_array_type(rb_ary_elt(ary, i));
- if (!NIL_P(tmp)) {
- n = flatten(ary, i, tmp, memo);
- i += n; lim += n;
+ return LONG2NUM(n);
+}
+
+static VALUE
+flatten(ary, level, modified)
+ VALUE ary;
+ int level;
+ int *modified;
+{
+ long i = 0;
+ VALUE stack, result, tmp, elt;
+ st_table *memo;
+ st_data_t id;
+
+ stack = ary_new(0, ARY_DEFAULT_SIZE);
+ result = ary_new(0, RARRAY_LEN(ary));
+ memo = st_init_numtable();
+ st_insert(memo, (st_data_t)ary, (st_data_t)Qtrue);
+ *modified = 0;
+
+ while (1) {
+ while (i < RARRAY(ary)->len) {
+ elt = RARRAY(ary)->ptr[i++];
+ tmp = rb_check_array_type(elt);
+ if (RBASIC(result)->klass) {
+ rb_raise(rb_eRuntimeError, "flatten reentered");
+ }
+ if (NIL_P(tmp) || (level >= 0 && RARRAY(stack)->len / 2 >= level)) {
+ rb_ary_push(result, elt);
+ }
+ else {
+ *modified = 1;
+ id = (st_data_t)tmp;
+ if (st_lookup(memo, id, 0)) {
+ st_free_table(memo);
+ rb_raise(rb_eArgError, "tried to flatten recursive array");
+ }
+ st_insert(memo, id, (st_data_t)Qtrue);
+ rb_ary_push(stack, ary);
+ rb_ary_push(stack, LONG2NUM(i));
+ ary = tmp;
+ i = 0;
+ }
}
- i++;
+ if (RARRAY(stack)->len == 0) {
+ break;
+ }
+ id = (st_data_t)ary;
+ st_delete(memo, &id, 0);
+ tmp = rb_ary_pop(stack);
+ i = NUM2LONG(tmp);
+ ary = rb_ary_pop(stack);
}
- rb_ary_pop(memo);
- return lim - idx - 1; /* returns number of increased items */
+ st_free_table(memo);
+
+ RBASIC(result)->klass = rb_class_of(ary);
+ return result;
}
/*
* call-seq:
* array.flatten! -> array or nil
+ * array.flatten!(level) -> array or nil
*
* Flattens _self_ in place.
* Returns <code>nil</code> if no modifications were made (i.e.,
- * <i>array</i> contains no subarrays.)
+ * <i>array</i> contains no subarrays.) If the optional <i>level</i>
+ * argument determines the level of recursion to flatten.
*
* a = [ 1, 2, [3, [4, 5] ] ]
* a.flatten! #=> [1, 2, 3, 4, 5]
* a.flatten! #=> nil
* a #=> [1, 2, 3, 4, 5]
+ * a = [ 1, 2, [3, [4, 5] ] ]
+ * a.flatten!(1) #=> [1, 2, 3, [4, 5]]
*/
static VALUE
-rb_ary_flatten_bang(ary)
+rb_ary_flatten_bang(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- long i = 0;
- int mod = 0;
- VALUE memo = Qnil;
+ int mod = 0, level = -1;
+ VALUE result, lv;
- while (i<RARRAY(ary)->len) {
- VALUE ary2 = RARRAY(ary)->ptr[i];
- VALUE tmp;
+ rb_scan_args(argc, argv, "01", &lv);
+ if (!NIL_P(lv)) level = NUM2INT(lv);
+ if (level == 0) return ary;
- tmp = rb_check_array_type(ary2);
- if (!NIL_P(tmp)) {
- if (NIL_P(memo)) {
- memo = rb_ary_new();
- }
- i += flatten(ary, i, tmp, memo);
- mod = 1;
- }
- i++;
- }
+ result = flatten(ary, level, &mod);
if (mod == 0) return Qnil;
+ rb_ary_replace(ary, result);
+
return ary;
}
/*
* call-seq:
* array.flatten -> an_array
+ * array.flatten(level) -> an_array
*
* Returns a new array that is a one-dimensional flattening of this
* array (recursively). That is, for every element that is an array,
- * extract its elements into the new array.
+ * extract its elements into the new array. If the optional
+ * <i>level</i> argument determines the level of recursion to flatten.
*
* s = [ 1, 2, 3 ] #=> [1, 2, 3]
* t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]
* a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]
- * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10
+ * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+ * a = [ 1, 2, [3, [4, 5] ] ]
+ * a.flatten(1) #=> [1, 2, 3, [4, 5]]
+ */
+
+static VALUE
+rb_ary_flatten(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ int mod = 0, level = -1;
+ VALUE result, lv;
+
+ rb_scan_args(argc, argv, "01", &lv);
+ if (!NIL_P(lv)) level = NUM2INT(lv);
+ if (level == 0) return ary;
+
+ result = flatten(ary, level, &mod);
+ if (OBJ_TAINTED(ary)) OBJ_TAINT(result);
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * array.shuffle! -> array or nil
+ *
+ * Shuffles elements in _self_ in place.
*/
+
static VALUE
-rb_ary_flatten(ary)
+rb_ary_shuffle_bang(ary)
VALUE ary;
{
+ long i = RARRAY(ary)->len;
+
+ rb_ary_modify(ary);
+ while (i) {
+ long j = rb_genrand_real()*i;
+ VALUE tmp = RARRAY(ary)->ptr[--i];
+ RARRAY(ary)->ptr[i] = RARRAY(ary)->ptr[j];
+ RARRAY(ary)->ptr[j] = tmp;
+ }
+ return ary;
+}
+
+
+/*
+ * call-seq:
+ * array.shuffle -> an_array
+ *
+ * Returns a new array with elements of this array shuffled.
+ *
+ * a = [ 1, 2, 3 ] #=> [1, 2, 3]
+ * a.shuffle #=> [2, 3, 1]
+ */
+
+static VALUE
+rb_ary_shuffle(VALUE ary)
+{
ary = rb_ary_dup(ary);
- rb_ary_flatten_bang(ary);
+ rb_ary_shuffle_bang(ary);
+ return ary;
+}
+
+
+/*
+ * call-seq:
+ * array.choice -> obj
+ *
+ * Choose a random element from an array.
+ */
+
+
+static VALUE
+rb_ary_choice(ary)
+ VALUE ary;
+{
+ long i, j;
+
+ i = RARRAY(ary)->len;
+ if (i == 0) return Qnil;
+ j = rb_genrand_real()*i;
+ return RARRAY(ary)->ptr[j];
+}
+
+
+/*
+ * call-seq:
+ * ary.cycle {|obj| block }
+ * ary.cycle(n) {|obj| block }
+ *
+ * Calls <i>block</i> for each element repeatedly _n_ times or
+ * forever if none or nil is given. If a non-positive number is
+ * given or the array is empty, does nothing. Returns nil if the
+ * loop has finished without getting interrupted.
+ *
+ * a = ["a", "b", "c"]
+ * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
+ * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
+ *
+ */
+
+static VALUE
+rb_ary_cycle(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ long n, i;
+ VALUE nv = Qnil;
+
+ rb_scan_args(argc, argv, "01", &nv);
+
+ RETURN_ENUMERATOR(ary, argc, argv);
+ if (NIL_P(nv)) {
+ n = -1;
+ }
+ else {
+ n = NUM2LONG(nv);
+ if (n <= 0) return Qnil;
+ }
+
+ while (RARRAY(ary)->len > 0 && (n < 0 || 0 < n--)) {
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ rb_yield(RARRAY(ary)->ptr[i]);
+ }
+ }
+ return Qnil;
+}
+
+#define tmpbuf(n, size) rb_str_tmp_new((n)*(size))
+
+/*
+ * Recursively compute permutations of r elements of the set [0..n-1].
+ * When we have a complete permutation of array indexes, copy the values
+ * at those indexes into a new array and yield that array.
+ *
+ * n: the size of the set
+ * r: the number of elements in each permutation
+ * p: the array (of size r) that we're filling in
+ * index: what index we're filling in now
+ * used: an array of booleans: whether a given index is already used
+ * values: the Ruby array that holds the actual values to permute
+ */
+static void
+permute0(n, r, p, index, used, values)
+ long n, r, *p, index;
+ int *used;
+ VALUE values;
+{
+ long i,j;
+ for (i = 0; i < n; i++) {
+ if (used[i] == 0) {
+ p[index] = i;
+ if (index < r-1) { /* if not done yet */
+ used[i] = 1; /* mark index used */
+ permute0(n, r, p, index+1, /* recurse */
+ used, values);
+ used[i] = 0; /* index unused */
+ }
+ else {
+ /* We have a complete permutation of array indexes */
+ /* Build a ruby array of the corresponding values */
+ /* And yield it to the associated block */
+ VALUE result = rb_ary_new2(r);
+ VALUE *result_array = RARRAY(result)->ptr;
+ const VALUE *values_array = RARRAY(values)->ptr;
+
+ for (j = 0; j < r; j++) result_array[j] = values_array[p[j]];
+ RARRAY(result)->len = r;
+ rb_yield(result);
+ }
+ }
+ }
+}
+
+/*
+ * call-seq:
+ * ary.permutation { |p| block } -> array
+ * ary.permutation -> enumerator
+ * ary.permutation(n) { |p| block } -> array
+ * ary.permutation(n) -> enumerator
+ *
+ * When invoked with a block, yield all permutations of length <i>n</i>
+ * of the elements of <i>ary</i>, then return the array itself.
+ * If <i>n</i> is not specified, yield all permutations of all elements.
+ * The implementation makes no guarantees about the order in which
+ * the permutations are yielded.
+ *
+ * When invoked without a block, return an enumerator object instead.
+ *
+ * Examples:
+ *
+ * a = [1, 2, 3]
+ * a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
+ * a.permutation(1).to_a #=> [[1],[2],[3]]
+ * a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
+ * a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
+ * a.permutation(0).to_a #=> [[]] # one permutation of length 0
+ * a.permutation(4).to_a #=> [] # no permutations of length 4
+ */
+
+static VALUE
+rb_ary_permutation(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE num;
+ long r, n, i;
+
+ n = RARRAY(ary)->len; /* Array length */
+ RETURN_ENUMERATOR(ary, argc, argv); /* Return enumerator if no block */
+ rb_scan_args(argc, argv, "01", &num);
+ r = NIL_P(num) ? n : NUM2LONG(num); /* Permutation size from argument */
+
+ if (r < 0 || n < r) {
+ /* no permutations: yield nothing */
+ }
+ else if (r == 0) { /* exactly one permutation: the zero-length array */
+ rb_yield(rb_ary_new2(0));
+ }
+ else if (r == 1) { /* this is a special, easy case */
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ rb_yield(rb_ary_new3(1, RARRAY(ary)->ptr[i]));
+ }
+ }
+ else { /* this is the general case */
+ volatile VALUE t0 = tmpbuf(n,sizeof(long));
+ long *p = (long*)RSTRING(t0)->ptr;
+ volatile VALUE t1 = tmpbuf(n,sizeof(int));
+ int *used = (int*)RSTRING(t1)->ptr;
+ VALUE ary0 = ary_make_shared(ary); /* private defensive copy of ary */
+
+ for (i = 0; i < n; i++) used[i] = 0; /* initialize array */
+
+ permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
+ RB_GC_GUARD(t0);
+ RB_GC_GUARD(t1);
+ }
+ return ary;
+}
+
+static long
+combi_len(n, k)
+ long n, k;
+{
+ long i, val = 1;
+
+ if (k*2 > n) k = n-k;
+ if (k == 0) return 1;
+ if (k < 0) return 0;
+ val = 1;
+ for (i=1; i <= k; i++,n--) {
+ long m = val;
+ val *= n;
+ if (val < m) {
+ rb_raise(rb_eRangeError, "too big for combination");
+ }
+ val /= i;
+ }
+ return val;
+}
+
+/*
+ * call-seq:
+ * ary.combination(n) { |c| block } -> ary
+ * ary.combination(n) -> enumerator
+ *
+ * When invoked with a block, yields all combinations of length <i>n</i>
+ * of elements from <i>ary</i> and then returns <i>ary</i> itself.
+ * The implementation makes no guarantees about the order in which
+ * the combinations are yielded.
+ *
+ * When invoked without a block, returns an enumerator object instead.
+ *
+ * Examples:
+ *
+ * a = [1, 2, 3, 4]
+ * a.combination(1).to_a #=> [[1],[2],[3],[4]]
+ * a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
+ * a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
+ * a.combination(4).to_a #=> [[1,2,3,4]]
+ * a.combination(0).to_a #=> [[]] # one combination of length 0
+ * a.combination(5).to_a #=> [] # no combinations of length 5
+ *
+ */
+
+static VALUE
+rb_ary_combination(ary, num)
+ VALUE ary;
+ VALUE num;
+{
+ long n, i, len;
+
+ n = NUM2LONG(num);
+ RETURN_ENUMERATOR(ary, 1, &num);
+ len = RARRAY(ary)->len;
+ if (n < 0 || len < n) {
+ /* yield nothing */
+ }
+ else if (n == 0) {
+ rb_yield(rb_ary_new2(0));
+ }
+ else if (n == 1) {
+ for (i = 0; i < len; i++) {
+ rb_yield(rb_ary_new3(1, RARRAY(ary)->ptr[i]));
+ }
+ }
+ else {
+ volatile VALUE t0 = tmpbuf(n+1, sizeof(long));
+ long *stack = (long*)RSTRING(t0)->ptr;
+ long nlen = combi_len(len, n);
+ volatile VALUE cc = rb_ary_new2(n);
+ VALUE *chosen = RARRAY(cc)->ptr;
+ long lev = 0;
+
+ RBASIC(cc)->klass = 0;
+ MEMZERO(stack, long, n);
+ stack[0] = -1;
+ for (i = 0; i < nlen; i++) {
+ chosen[lev] = RARRAY(ary)->ptr[stack[lev+1]];
+ for (lev++; lev < n; lev++) {
+ chosen[lev] = RARRAY(ary)->ptr[stack[lev+1] = stack[lev]+1];
+ }
+ rb_yield(rb_ary_new4(n, chosen));
+ do {
+ stack[lev--]++;
+ } while (lev && (stack[lev+1]+n == len+lev+1));
+ }
+ }
return ary;
}
+/*
+ * call-seq:
+ * ary.product(other_ary, ...)
+ *
+ * Returns an array of all combinations of elements from all arrays.
+ * The length of the returned array is the product of the length
+ * of ary and the argument arrays
+ *
+ * [1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
+ * [1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
+ * [1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6],
+ * # [2,3,5],[2,3,6],[2,4,5],[2,4,6]]
+ * [1,2].product() # => [[1],[2]]
+ * [1,2].product([]) # => []
+ */
+
+static VALUE
+rb_ary_product(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ int n = argc+1; /* How many arrays we're operating on */
+ volatile VALUE t0 = tmpbuf(n, sizeof(VALUE));
+ volatile VALUE t1 = tmpbuf(n, sizeof(int));
+ VALUE *arrays = (VALUE*)RSTRING(t0)->ptr; /* The arrays we're computing the product of */
+ int *counters = (int*)RSTRING(t1)->ptr; /* The current position in each one */
+ VALUE result; /* The array we'll be returning */
+ long i,j;
+ long resultlen = 1;
+
+ RBASIC(t0)->klass = 0;
+ RBASIC(t1)->klass = 0;
+
+ /* initialize the arrays of arrays */
+ arrays[0] = ary;
+ for (i = 1; i < n; i++) arrays[i] = to_ary(argv[i-1]);
+
+ /* initialize the counters for the arrays */
+ for (i = 0; i < n; i++) counters[i] = 0;
+
+ /* Compute the length of the result array; return [] if any is empty */
+ for (i = 0; i < n; i++) {
+ long k = RARRAY(arrays[i])->len, l = resultlen;
+ if (k == 0) return rb_ary_new2(0);
+ resultlen *= k;
+ if (resultlen < k || resultlen < l || resultlen / k != l) {
+ rb_raise(rb_eRangeError, "too big to product");
+ }
+ }
+
+ /* Otherwise, allocate and fill in an array of results */
+ result = rb_ary_new2(resultlen);
+ for (i = 0; i < resultlen; i++) {
+ int m;
+ /* fill in one subarray */
+ VALUE subarray = rb_ary_new2(n);
+ for (j = 0; j < n; j++) {
+ rb_ary_push(subarray, rb_ary_entry(arrays[j], counters[j]));
+ }
+
+ /* put it on the result array */
+ rb_ary_push(result, subarray);
+
+ /*
+ * Increment the last counter. If it overflows, reset to 0
+ * and increment the one before it.
+ */
+ m = n-1;
+ counters[m]++;
+ while (m > 0 && counters[m] == RARRAY(arrays[m])->len) {
+ counters[m] = 0;
+ m--;
+ counters[m]++;
+ }
+ }
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * ary.take(n) => array
+ *
+ * Returns first n elements from <i>ary</i>.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take(3) # => [1, 2, 3]
+ *
+ */
+
+static VALUE
+rb_ary_take(obj, n)
+ VALUE obj;
+ VALUE n;
+{
+ long len = NUM2LONG(n);
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to take negative size");
+ }
+
+ return rb_ary_subseq(obj, 0, len);
+}
+
+/*
+ * call-seq:
+ * ary.take_while {|arr| block } => array
+ *
+ * Passes elements to the block until the block returns nil or false,
+ * then stops iterating and returns an array of all prior elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take_while {|i| i < 3 } # => [1, 2]
+ *
+ */
+
+static VALUE
+rb_ary_take_while(ary)
+ VALUE ary;
+{
+ long i;
+
+ RETURN_ENUMERATOR(ary, 0, 0);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ if (!RTEST(rb_yield(RARRAY(ary)->ptr[i]))) break;
+ }
+ return rb_ary_take(ary, LONG2FIX(i));
+}
+
+/*
+ * call-seq:
+ * ary.drop(n) => array
+ *
+ * Drops first n elements from <i>ary</i>, and returns rest elements
+ * in an array.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop(3) # => [4, 5, 0]
+ *
+ */
+
+static VALUE
+rb_ary_drop(ary, n)
+ VALUE ary;
+ VALUE n;
+{
+ VALUE result;
+ long pos = NUM2LONG(n);
+ if (pos < 0) {
+ rb_raise(rb_eArgError, "attempt to drop negative size");
+ }
+
+ result = rb_ary_subseq(ary, pos, RARRAY(ary)->len);
+ if (result == Qnil) result = rb_ary_new();
+ return result;
+}
+
+/*
+ * call-seq:
+ * ary.drop_while {|arr| block } => array
+ *
+ * Drops elements up to, but not including, the first element for
+ * which the block returns nil or false and returns an array
+ * containing the remaining elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
+ *
+ */
+
+static VALUE
+rb_ary_drop_while(ary)
+ VALUE ary;
+{
+ long i;
+
+ RETURN_ENUMERATOR(ary, 0, 0);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ if (!RTEST(rb_yield(RARRAY(ary)->ptr[i]))) break;
+ }
+ return rb_ary_drop(ary, LONG2FIX(i));
+}
+
+
/* Arrays are ordered, integer-indexed collections of any object.
* Array indexing starts at 0, as in C or Java. A negative index is
@@ -2989,8 +3790,8 @@ Init_Array()
rb_define_method(rb_cArray, "concat", rb_ary_concat, 1);
rb_define_method(rb_cArray, "<<", rb_ary_push, 1);
rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
- rb_define_method(rb_cArray, "pop", rb_ary_pop, 0);
- rb_define_method(rb_cArray, "shift", rb_ary_shift, 0);
+ rb_define_method(rb_cArray, "pop", rb_ary_pop_m, -1);
+ rb_define_method(rb_cArray, "shift", rb_ary_shift_m, -1);
rb_define_method(rb_cArray, "unshift", rb_ary_unshift_m, -1);
rb_define_method(rb_cArray, "insert", rb_ary_insert, -1);
rb_define_method(rb_cArray, "each", rb_ary_each, 0);
@@ -2999,8 +3800,9 @@ Init_Array()
rb_define_method(rb_cArray, "length", rb_ary_length, 0);
rb_define_alias(rb_cArray, "size", "length");
rb_define_method(rb_cArray, "empty?", rb_ary_empty_p, 0);
- rb_define_method(rb_cArray, "index", rb_ary_index, 1);
- rb_define_method(rb_cArray, "rindex", rb_ary_rindex, 1);
+ rb_define_method(rb_cArray, "find_index", rb_ary_index, -1);
+ rb_define_method(rb_cArray, "index", rb_ary_index, -1);
+ rb_define_method(rb_cArray, "rindex", rb_ary_rindex, -1);
rb_define_method(rb_cArray, "indexes", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "indices", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
@@ -3044,9 +3846,22 @@ Init_Array()
rb_define_method(rb_cArray, "uniq!", rb_ary_uniq_bang, 0);
rb_define_method(rb_cArray, "compact", rb_ary_compact, 0);
rb_define_method(rb_cArray, "compact!", rb_ary_compact_bang, 0);
- rb_define_method(rb_cArray, "flatten", rb_ary_flatten, 0);
- rb_define_method(rb_cArray, "flatten!", rb_ary_flatten_bang, 0);
+ rb_define_method(rb_cArray, "flatten", rb_ary_flatten, -1);
+ rb_define_method(rb_cArray, "flatten!", rb_ary_flatten_bang, -1);
rb_define_method(rb_cArray, "nitems", rb_ary_nitems, 0);
+ rb_define_method(rb_cArray, "count", rb_ary_count, -1);
+ rb_define_method(rb_cArray, "shuffle!", rb_ary_shuffle_bang, 0);
+ rb_define_method(rb_cArray, "shuffle", rb_ary_shuffle, 0);
+ rb_define_method(rb_cArray, "choice", rb_ary_choice, 0);
+ rb_define_method(rb_cArray, "cycle", rb_ary_cycle, -1);
+ rb_define_method(rb_cArray, "permutation", rb_ary_permutation, -1);
+ rb_define_method(rb_cArray, "combination", rb_ary_combination, 1);
+ rb_define_method(rb_cArray, "product", rb_ary_product, -1);
+
+ rb_define_method(rb_cArray, "take", rb_ary_take, 1);
+ rb_define_method(rb_cArray, "take_while", rb_ary_take_while, 0);
+ rb_define_method(rb_cArray, "drop", rb_ary_drop, 1);
+ rb_define_method(rb_cArray, "drop_while", rb_ary_drop_while, 0);
id_cmp = rb_intern("<=>");
inspect_key = rb_intern("__inspect_key__");
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index 5d7b60197a..713b5c69df 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -4,8 +4,12 @@ SHELL = $(COMSPEC)
MKFILES = Makefile
#### Start of system configuration section. ####
+!ifndef OS
OS = bccwin32
-RT = $(OS)
+!endif
+!if !defined(RT)
+!error RT not defined. Retry from configure pass.
+!endif
## variables may be overridden by $(compile_dir)/Makefile
!ifndef srcdir
@@ -125,16 +129,19 @@ RFLAGS = $(iconinc)
!ifndef EXTLIBS
EXTLIBS =
!endif
-LIBS = cw32i.lib import32.lib ws2_32.lib $(EXTLIBS)
+!ifndef MEMLIB
+MEMLIB =
+!endif
+LIBS = $(MEMLIB) cw32i.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 -I. -I$(srcdir) -I$(srcdir)/missing
-ARFLAGS = /a
+ARFLAGS = /a /p32
LD = ilink32 -q -Gn
LDSHARED = $(LD)
XLDFLAGS = -Tpe c0x32.obj
@@ -150,8 +157,8 @@ EXEEXT = .exe
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)" --
+MINIRUBY = .\miniruby$(EXEEXT) -I$(srcdir)/lib $(MINIRUBYOPT)
+RUNRUBY = .\$(PROGRAM) "$(srcdir)/runruby.rb" --extout="$(EXTOUT)" --
ORGLIBPATH = $(LIB)
@@ -166,11 +173,13 @@ PREP = miniruby$(EXEEXT)
OBJEXT = obj
+INSTALLED_LIST= .installed.list
+
WINMAINOBJ = winmain.$(OBJEXT)
MINIOBJS = dmydln.$(OBJEXT)
-.path.c = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
-.path.h = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
+.path.c = .;$(srcdir);$(srcdir)/win32;$(srcdir)/missing
+.path.h = .;$(srcdir);$(srcdir)/win32;$(srcdir)/missing
.path.y = $(srcdir)
.path. = $(srcdir)
@@ -178,21 +187,27 @@ MINIOBJS = dmydln.$(OBJEXT)
$(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)
.rc.res:
- $(RC) $(RFLAGS) -I. -I$(<D). $(iconinc) -I$(srcdir)win32 $(RFLAGS) -fo$@ $(<:/=\)
+ $(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
+all: $(srcdir)/bcc32/Makefile.sub $(srcdir)/common.mk
ruby: $(PROGRAM)
rubyw: $(WPROGRAM)
!include $(srcdir)/common.mk
-PHONY: Makefile
+$(MKFILES): $(srcdir)/bcc32/Makefile.sub $(srcdir)/bcc32/configure.bat $(srcdir)/bcc32/setup.mak
+ $(COMSPEC) /C $(srcdir:/=\)\bcc32\configure.bat $(configure_args)
+ @echo $(MKFILES) should be updated, re-run $(MAKE).
+ @$(MAKE) > nul -q -f &&|
+PHONY: nul
+ @exit
+|
CONFIG_H = ./.config.h.time
@@ -200,8 +215,8 @@ config: config.status
config.status: $(CONFIG_H)
-$(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
- @$(srcdir:/=\)win32\ifchange.bat config.h &&|
+$(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
+ @$(srcdir:/=\)\win32\ifchange.bat config.h &&|
\#define HAVE_SYS_TYPES_H 1
\#define HAVE_SYS_STAT_H 1
\#define HAVE_STDLIB_H 1
@@ -222,6 +237,7 @@ $(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
@@ -247,8 +263,10 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#define HAVE_STRTOD 1
\#define HAVE_STRTOL 1
\#define HAVE_STRTOUL 1
+\#define HAVE_VSNPRINTF 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
@@ -265,6 +283,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#define RSHIFT(x,y) ((x)>>(int)y)
\#define FILE_COUNT level
\#define FILE_READPTR curp
+\#define RUBY_SETJMP(env) _setjmp(env)
+\#define RUBY_LONGJMP(env,val) longjmp(env,val)
+\#define RUBY_JMP_BUF jmp_buf
\#define inline __inline
\#define NEED_IO_SEEK_BETWEEN_RW 1
\#define STACK_GROW_DIRECTION -1
@@ -273,13 +294,16 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/Makefile.sub
\#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)"
+\#define RUBY_VENDOR_LIB "/lib/ruby/vendor_ruby"
+\#define RUBY_VENDOR_LIB2 "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)"
\#define RUBY_PLATFORM "$(ARCH)-$(OS)"
\#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
\#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
+\#define RUBY_VENDOR_ARCHLIB "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
|
@exit > $@
-config.status: $(MKFILES) $(srcdir)bcc32/Makefile.sub $(srcdir)common.mk
+config.status: $(MKFILES) $(srcdir)/bcc32/Makefile.sub $(srcdir)/common.mk
@echo Creating $@
@type > $@ &&|
# Generated automatically by Makefile.sub.
@@ -329,11 +353,8 @@ s,@RANLIB@,,;t t
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,@SET_MAKE@,MFLAGS = -$$(MAKEFLAGS),;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
@@ -379,18 +400,19 @@ 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) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
-s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;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,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN;t t
+s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN WIN32,;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
s,@EXPORT_PREFIX@,_,;t t
s,@arch@,$(ARCH)-$(OS),;t t
s,@sitearch@,$(ARCH)-$(OS),;t t
s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
+s,@vendordir@,$${prefix}/lib/ruby/vendor_ruby,;t t
s,@configure_args@,--enable-shared $(configure_args),;t t
s,@configure_input@,$$configure_input,;t t
s,@srcdir@,$(srcdir),;t t
@@ -416,33 +438,75 @@ $(LIBRUBY_A): $(OBJS) $(DMYEXT)
$(LIBRUBY_SO): $(LIBRUBY_A) $(DLDOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
@echo $(DLDOBJS)
+ @$(PRE_LIBRUBY_UPDATE)
$(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)
+ $(MINIRUBY) $(srcdir)/bcc32/mkexports.rb -output=$@ -base=$(RUBY_SO_NAME) $(LIBRUBY_A)
$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
- @$(MINIRUBY) $(srcdir)win32/resource.rb \
+ @$(MINIRUBY) $(srcdir)/win32/resource.rb \
-ruby_name=$(RUBY_INSTALL_NAME) \
-rubyw_name=$(RUBYW_INSTALL_NAME) \
-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:\=/)"
+ . $(icondirs) $(srcdir)/win32
+
+post-install-bin::
+ @$(NULLCMD)
+post-install-lib::
+ @$(NULLCMD)
+post-install-ext-comm::
+ @$(NULLCMD)
+post-install-ext-arch::
+ @$(NULLCMD)
+post-install-man::
+ @$(NULLCMD)
+post-install-doc::
+ @$(NULLCMD)
clean-local::
- @$(RM) ext\extinit.c ext\extinit.$(OBJEXT) *.tds *.il? $(RUBY_SO_NAME).lib
+ @$(RM) $(WINMAINOBJ) 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
+ @$(RM) *.map *.pdb *.ilk *.exp $(RUBYDEF)
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
+update-rubyspec:
+ @echo SPEC_EXISTS=0 > $@.mk
+ @if exist $(srcdir:/=\)\rubyspec\nul echo SPEC_EXISTS=1 >> $@.mk
+ @type >> $@.mk &&|
+$()update-rubyspec:
+$() @del $@.mk
+$()!if $$(SPEC_EXISTS)
+$() cd $(srcdir:/=\)\rubyspec\mspec
+$() git pull
+$() cd ..\spec\rubyspec
+$() git pull
+$()!else
+$() git clone $(MSPEC_GIT_URL) $(srcdir)/rubyspec/mspec
+$() git clone $(RUBYSPEC_GIT_URL) $(srcdir)/rubyspec/spec/rubyspec
+$()!endif
+|
+ @$(MAKE) -$(MAKEFLAGS)$(MFLAGS) -f $@.mk
+
+test-rubyspec:
+ @echo SPEC_EXISTS=0 > $@.mk
+ @if exist $(srcdir:/=\)\rubyspec\nul echo SPEC_EXISTS=1 >> $@.mk
+ @type >> $@.mk &&|
+$()test-rubyspec:
+$()!if $$(SPEC_EXISTS)
+$() $(RUNRUBY) $(srcdir)/rubyspec/mspec/bin/mspec -r$(srcdir)/ext/purelib.rb $(srcdir)/rubyspec/spec/rubyspec/$(MAJOR).$(MINOR)
+$()!else
+$() @echo No rubyspec here. put rubyspec to srcdir first.
+$() @cd $(srcdir:/=\)\rubyspec
+$()!endif
+|
+ @$(MAKE) -$(MAKEFLAGS) -f $@.mk
+
ext/extinit.obj: ext/extinit.c $(SETUP)
$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
diff --git a/bcc32/README.bcc32 b/bcc32/README.bcc32
index 405b2dcfa4..c27a1261f1 100644
--- a/bcc32/README.bcc32
+++ b/bcc32/README.bcc32
@@ -19,6 +19,14 @@
* 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
+
== How to compile and install
(1) Execute bcc32\configure.bat on your build directory.
@@ -48,6 +56,10 @@
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..95575cbc60 100644..100755
--- a/bcc32/configure.bat
+++ b/bcc32/configure.bat
@@ -6,70 +6,110 @@
echo> ~tmp~.mak ####
echo>> ~tmp~.mak conf = %0
echo>> ~tmp~.mak $(conf:\=/): nul
-echo>> ~tmp~.mak @del ~tmp~.mak
+echo>> ~tmp~.mak @del ~setup~.mak
echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
+if exist pathlist.tmp del pathlist.tmp
+if exist confargs.mk del confargs.mk
:loop
if "%1" == "" goto :end
if "%1" == "--prefix" goto :prefix
+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" == "RUBY_SUFFIX" goto :suffix
+if "%1" == "--program-name" goto :installname
+if "%1" == "--install-name" goto :installname
+if "%1" == "RUBY_INSTALL_NAME" goto :installname
+if "%1" == "--so-name" goto :soname
+if "%1" == "RUBY_SO_NAME" goto :soname
if "%1" == "--enable-install-doc" goto :enable-rdoc
if "%1" == "--disable-install-doc" goto :disable-rdoc
if "%1" == "--extout" goto :extout
+if "%1" == "EXTOUT" goto :extout
+if "%1" == "--path" goto :path
if "%1" == "-h" goto :help
if "%1" == "--help" goto :help
- echo>> ~tmp~.mak "%1" \
+ echo>>confargs.tmp %1 \
shift
goto :loop
:srcdir
- echo>> ~tmp~.mak -D"srcdir=%2" \
+ echo>> ~tmp~.mak -Dsrcdir=%2 \
+ echo>>confargs.tmp --srcdir=%2 \
shift
shift
goto :loop
:prefix
- echo>> ~tmp~.mak -D"prefix=%2" \
+ echo>> ~tmp~.mak -Dprefix=%2 \
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:suffix
- echo>> ~tmp~.mak -D"RUBY_SUFFIX=%2" \
+ echo>>confargs.mk !ifndef RUBY_SUFFIX
+ echo>>confargs.mk RUBY_SUFFIX = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:installname
- echo>> ~tmp~.mak -D"RUBY_INSTALL_NAME=%2" \
+ echo>>confargs.mk !ifndef RUBY_INSTALL_NAME
+ echo>>confargs.mk RUBY_INSTALL_NAME = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:soname
- echo>> ~tmp~.mak -D"RUBY_SO_NAME=%2" \
+ echo>>confargs.mk !ifndef RUBY_SO_NAME
+ echo>>confargs.mk RUBY_SO_NAME = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:target
- echo>> ~tmp~.mak "%2" \
+ echo>> ~tmp~.mak %2 \
+ echo>>confargs.tmp --target=%2 \
shift
shift
goto :loop
:extstatic
- echo>> ~tmp~.mak -D"EXTSTATIC=static" \
+ echo>>confargs.mk !ifndef EXTSTATIC
+ echo>>confargs.mk EXTSTATIC = static
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1 \
shift
goto :loop
:enable-rdoc
- echo>> ~tmp~.mak -D"RDOCTARGET=install-doc" \
+ echo>>confargs.mk !ifndef RDOCTARGET
+ echo>>confargs.mk RDOCTARGET = install-doc
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1 \
shift
goto :loop
:disable-rdoc
- echo>> ~tmp~.mak -D"RDOCTARGET=install-nodoc" \
+ echo>>confargs.mk !ifndef RDOCTARGET
+ echo>>confargs.mk RDOCTARGET = install-nodoc
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1 \
shift
goto :loop
:extout
- echo>> ~tmp~.mak "EXTOUT=%2" \
+ echo>>confargs.mk !ifndef EXTOUT
+ echo>>confargs.mk EXTOUT = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
+ shift
+ shift
+goto :loop
+:path
+ echo>>pathlist.tmp %2;\
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
@@ -83,10 +123,30 @@ goto :loop
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
+ echo --disable-install-doc install rdoc indexes during install
+ del *.tmp
del ~tmp~.mak
goto :exit
:end
-echo>> ~tmp~.mak bcc32dir="$(@D)"
-make -s -f ~tmp~.mak
+echo>> ~tmp~.mak -Dbcc32dir=$(@D)
+if not exist confargs.tmp goto :noconfargs
+ echo>>confargs.mk configure_args = \
+ type>>confargs.mk confargs.tmp
+ echo.>>confargs.mk
+ echo>>confargs.mk ####
+:noconfargs
+if not exist pathlist.tmp goto :nopathlist
+ echo>>confargs.mk pathlist = \
+ type>>confargs.mk pathlist.tmp
+ echo.>>confargs.mk
+ echo>>confargs.mk ####
+ echo>>confargs.mk PATH = $(pathlist:;=/bin;)$(PATH)
+ echo>>confargs.mk INCLUDE = $(pathlist:;=/include;)
+ echo>>confargs.mk LIB = $(pathlist:;=/lib;)
+:nopathlist
+if exist confargs.mk copy confargs.mk ~setup~.mak > nul
+type>>~setup~.mak ~tmp~.mak
+del *.tmp > nul
+del ~tmp~.mak > nul
+make -s -f ~setup~.mak
:exit
diff --git a/bcc32/mkexports.rb b/bcc32/mkexports.rb
index e34b441e2f..dc523e2541 100644..100755
--- a/bcc32/mkexports.rb
+++ b/bcc32/mkexports.rb
@@ -1,5 +1,7 @@
#!./miniruby -s
+$name = $library = $description = nil
+
SYM = {}
STDIN.reopen(open("nul"))
ARGV.each do |obj|
diff --git a/bcc32/setup.mak b/bcc32/setup.mak
index d6120d10cb..483292ed51 100644
--- a/bcc32/setup.mak
+++ b/bcc32/setup.mak
@@ -1,13 +1,13 @@
# -*- makefile -*-
!if "$(srcdir)" != ""
-bcc32dir = $(srcdir)bcc32/
+bcc32dir = $(srcdir)/bcc32
!elseif "$(bcc32dir)" == "bcc32/"
-srcdir = ./
+srcdir = .
!elseif "$(bcc32dir:/bcc32/=)/bcc32/" == "$(bcc32dir)"
-srcdir = $(bcc32dir:/bcc32/=/)
+srcdir = $(bcc32dir:/bcc32/=)
!else
-srcdir = $(bcc32dir)../
+srcdir = $(bcc32dir)/..
!endif
!ifndef prefix
prefix = /usr
@@ -30,7 +30,9 @@ i586-$(OS): -prologue- -i586- -epilogue-
i686-$(OS): -prologue- -i686- -epilogue-
alpha-$(OS): -prologue- -alpha- -epilogue-
--prologue-: nul
+-prologue-: -basic-vars- -version- -system-vars-
+
+-basic-vars-: nul
@echo Creating $(MAKEFILE)
@type > $(MAKEFILE) &&|
\#\#\# Makefile for ruby $(OS) \#\#\#
@@ -40,28 +42,68 @@ $(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
+|
+!if exist(confargs.mk)
+ @type confargs.mk >> $(MAKEFILE)
+ @del confargs.mk
!endif
-!if defined(EXTOUT)
-$(BANG)ifndef EXTOUT
-EXTOUT = $(EXTOUT)
+
+-system-vars-: -runtime- -bormm-
+
+-bormm-: nul
+ @-ilink32 -q -Gn -x usebormm.lib > nul
+ @-if exist usebormm.tds $(APPEND) MEMLIB = usebormm.lib
+ @if exist usebormm.* del usebormm.*
+
+-osname-: nul
+ @echo OS = >>$(MAKEFILE)
+
+-runtime-: nul
+ type > conftest.c &&|
+\#include <stdio.h>
+int main(){printf("");return 0;}
+|
+ bcc32 conftest.c cw32i.lib > nul
+ tdump conftest.exe < nul > conftest.i
+ grep "^Imports from CC" conftest.i > conftest.c
+ cpp32 -P- -DFile=\# -DImports=RTNAME -Dfrom== conftest.c > nul
+ $(MAKE) > nul -DBANG=$(BANG) -f &&|
+-runtime-: nul
+$(BANG)include conftest.i
+RT = $$(RTNAME:.DLL=)
+OS = $$(RT:CC32=)
+-runtime-:
+ del conftest.*
+$(BANG)if "$$(OS)" == "50"
+ echo OS = bccwin32 >> $(MAKEFILE)
+$(BANG)else
+ echo OS = bccwin32_$$(OS) >> $(MAKEFILE)
$(BANG)endif
-!endif
|
- @cpp32 -I$(srcdir) -DRUBY_EXTERN="//" -P- -o$(MAKEFILE) > nul &&|
+ @echo RT = $$(OS) >> $(MAKEFILE)
+
+-version-: nul
+ @cpp32 -I$(srcdir) -P- -o$(MAKEFILE) > nul &&|
\#include "version.h"
MAJOR = RUBY_VERSION_MAJOR
MINOR = RUBY_VERSION_MINOR
TEENY = RUBY_VERSION_TEENY
+
+BORLANDC = __BORLANDC__
|
- @type $(MAKEFILE).i >> $(MAKEFILE)
+ @$(MAKE) > nul -DBANG=$(BANG) -f &&,
+-version-: nul
+$(BANG)include $(MAKEFILE)
+$(BANG)include $(MAKEFILE).i
+-version-:
@del $(MAKEFILE).i
+ @type >> $(MAKEFILE) &&|
+MAJOR = $$(MAJOR)
+MINOR = $$(MINOR)
+TEENY = $$(TEENY)
+BORLANDC = $$(BORLANDC)
+|
+,
-generic-: nul
!if defined(PROCESSOR_ARCHITECTURE) || defined(PROCESSOR_LEVEL)
@@ -76,7 +118,6 @@ $(BANG)ifndef PROCESSOR_LEVEL
PROCESSOR_LEVEL = $(PROCESSOR_LEVEL)
$(BANG)endif
!endif
-
|
!endif
@@ -109,17 +150,14 @@ $(BANG)endif
-epilogue-: nul
@type >> $(MAKEFILE) &&|
-\# OS = $(OS)
-\# RT = $(RT)
\# RUBY_INSTALL_NAME = ruby
\# RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR)
\# 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)\"
+\# 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
+$(BANG)include $$(srcdir)/bcc32/Makefile.sub
|
- @$(srcdir:/=\)\win32\rm.bat config.h config.status
@echo type "`$(MAKE)'" to make ruby for $(OS).
diff --git a/bignum.c b/bignum.c
index 043e799366..7f14aee709 100644
--- a/bignum.c
+++ b/bignum.c
@@ -11,8 +11,10 @@
**********************************************************************/
#include "ruby.h"
+#include "rubysig.h"
#include <math.h>
+#include <float.h>
#include <ctype.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
@@ -36,7 +38,21 @@ VALUE rb_cBignum;
#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
#define BDIGMAX ((BDIGIT)-1)
-#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0))
+#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || \
+ (BDIGITS(x)[0] == 0 && \
+ (RBIGNUM(x)->len == 1 || bigzero_p(x))))
+
+static int bigzero_p(VALUE);
+static int
+bigzero_p(x)
+ VALUE x;
+{
+ long i;
+ for (i = 0; i < RBIGNUM(x)->len; ++i) {
+ if (BDIGITS(x)[i]) return 0;
+ }
+ return 1;
+}
static VALUE
bignew_1(klass, len, sign)
@@ -46,7 +62,7 @@ bignew_1(klass, len, sign)
{
NEWOBJ(big, struct RBignum);
OBJSETUP(big, klass, T_BIGNUM);
- big->sign = (char)sign;
+ big->sign = sign?1:0;
big->len = len;
big->digits = ALLOC_N(BDIGIT, len);
@@ -74,6 +90,7 @@ get2comp(x)
BDIGIT *ds = BDIGITS(x);
BDIGIT_DBL num;
+ if (!i) return;
while (i--) ds[i] = ~ds[i];
i = 0; num = 1;
do {
@@ -96,32 +113,52 @@ rb_big_2comp(x) /* get 2's complement */
}
static VALUE
-bignorm(x)
+bigtrunc(x)
VALUE x;
{
- if (!FIXNUM_P(x)) {
- long len = RBIGNUM(x)->len;
- BDIGIT *ds = BDIGITS(x);
+ long len = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(x);
- while (len-- && !ds[len]) ;
- RBIGNUM(x)->len = ++len;
+ if (len == 0) return x;
+ while (--len && !ds[len]);
+ RBIGNUM(x)->len = ++len;
+ return x;
+}
- if (len*SIZEOF_BDIGITS <= sizeof(VALUE)) {
- long num = 0;
- while (len--) {
- num = BIGUP(num) + ds[len];
+static VALUE
+bigfixize(x)
+ VALUE x;
+{
+ long len = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(x);
+
+ if (len*SIZEOF_BDIGITS <= sizeof(VALUE)) {
+ long num = 0;
+ while (len--) {
+ num = BIGUP(num) + ds[len];
+ }
+ if (num >= 0) {
+ if (RBIGNUM(x)->sign) {
+ if (POSFIXABLE(num)) return LONG2FIX(num);
}
- if (num >= 0) {
- if (RBIGNUM(x)->sign) {
- if (POSFIXABLE(num)) return LONG2FIX(num);
- }
- else if (NEGFIXABLE(-(long)num)) return LONG2FIX(-(long)num);
+ else {
+ if (NEGFIXABLE(-(long)num)) return LONG2FIX(-(long)num);
}
}
}
return x;
}
+static VALUE
+bignorm(x)
+ VALUE x;
+{
+ if (!FIXNUM_P(x) && TYPE(x) == T_BIGNUM) {
+ x = bigfixize(bigtrunc(x));
+ }
+ return x;
+}
+
VALUE
rb_big_norm(x)
VALUE x;
@@ -328,6 +365,13 @@ rb_cstr_to_inum(str, base, badcheck)
VALUE z;
BDIGIT *zds;
+#define conv_digit(c) \
+ (!ISASCII(c) ? -1 : \
+ isdigit(c) ? ((c) - '0') : \
+ islower(c) ? ((c) - 'a' + 10) : \
+ isupper(c) ? ((c) - 'A' + 10) : \
+ -1)
+
if (!str) {
if (badcheck) goto bad;
return INT2FIX(0);
@@ -419,8 +463,21 @@ rb_cstr_to_inum(str, base, badcheck)
break;
}
if (*str == '0') { /* squeeze preceeding 0s */
- while (*++str == '0');
- --str;
+ int us = 0;
+ while ((c = *++str) == '0' || c == '_') {
+ if (c == '_') {
+ if (++us >= 2)
+ break;
+ } else
+ us = 0;
+ }
+ if (!(c = *str) || ISSPACE(c)) --str;
+ }
+ c = *str;
+ c = conv_digit(c);
+ if (c < 0 || c >= base) {
+ if (badcheck) goto bad;
+ return INT2FIX(0);
}
len *= strlen(str)*sizeof(char);
@@ -454,27 +511,16 @@ rb_cstr_to_inum(str, base, badcheck)
z = bignew(len, sign);
zds = BDIGITS(z);
for (i=len;i--;) zds[i]=0;
- while (c = *str++) {
+ while ((c = *str++) != 0) {
if (c == '_') {
- if (badcheck) {
- if (nondigit) goto bad;
- nondigit = c;
+ if (nondigit) {
+ if (badcheck) goto bad;
+ break;
}
+ nondigit = c;
continue;
}
- else if (!ISASCII(c)) {
- break;
- }
- else if (isdigit(c)) {
- c -= '0';
- }
- else if (islower(c)) {
- c -= 'a' - 10;
- }
- else if (isupper(c)) {
- c -= 'A' - 10;
- }
- else {
+ else if ((c = conv_digit(c)) < 0) {
break;
}
if (c >= base) break;
@@ -533,7 +579,7 @@ rb_str_to_inum(str, base, badcheck)
s = p;
}
}
- return rb_cstr_to_inum(s, base, badcheck);
+ return rb_cstr_to_inum(s, base, badcheck);
}
#if HAVE_LONG_LONG
@@ -595,7 +641,7 @@ rb_ll2inum(n)
}
#endif /* HAVE_LONG_LONG */
-
+
VALUE
rb_cstr2inum(str, base)
const char *str;
@@ -614,15 +660,16 @@ rb_str2inum(str, base)
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
VALUE
-rb_big2str(x, base)
+rb_big2str0(x, base, trim)
VALUE x;
int base;
+ int trim;
{
volatile VALUE t;
BDIGIT *ds;
long i, j, hbase;
VALUE ss;
- char *s, c;
+ char *s;
if (FIXNUM_P(x)) {
return rb_fix2str(x, base);
@@ -631,34 +678,37 @@ rb_big2str(x, base)
if (BIGZEROP(x)) {
return rb_str_new2("0");
}
+ if (i >= LONG_MAX/SIZEOF_BDIGITS/CHAR_BIT) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
j = SIZEOF_BDIGITS*CHAR_BIT*i;
switch (base) {
case 2: break;
case 3:
- j = j * 647L / 1024;
+ j = j * 53L / 84 + 1;
break;
case 4: case 5: case 6: case 7:
- j /= 2;
+ j = (j + 1) / 2;
break;
case 8: case 9:
- j /= 3;
+ j = (j + 2) / 3;
break;
case 10: case 11: case 12: case 13: case 14: case 15:
- j = j * 241L / 800;
+ j = j * 28L / 93 + 1;
break;
case 16: case 17: case 18: case 19: case 20: case 21:
case 22: case 23: case 24: case 25: case 26: case 27:
case 28: case 29: case 30: case 31:
- j /= 4;
+ j = (j + 3) / 4;
break;
case 32: case 33: case 34: case 35: case 36:
- j /= 5;
+ j = (j + 4) / 5;
break;
default:
rb_raise(rb_eArgError, "illegal radix %d", base);
break;
}
- j += 2;
+ j++; /* space for sign */
hbase = base * base;
#if SIZEOF_BDIGITS > 2
@@ -667,11 +717,12 @@ rb_big2str(x, base)
t = rb_big_clone(x);
ds = BDIGITS(t);
- ss = rb_str_new(0, j);
+ ss = rb_str_new(0, j+1);
s = RSTRING(ss)->ptr;
s[0] = RBIGNUM(x)->sign ? '+' : '-';
- while (i && j) {
+ TRAP_BEG;
+ while (i && j > 1) {
long k = i;
BDIGIT_DBL num = 0;
@@ -680,30 +731,44 @@ rb_big2str(x, base)
ds[k] = (BDIGIT)(num / hbase);
num %= hbase;
}
- if (ds[i-1] == 0) i--;
+ if (trim && ds[i-1] == 0) i--;
k = SIZEOF_BDIGITS;
while (k--) {
- c = (char)(num % base);
- s[--j] = ruby_digitmap[(int)c];
+ s[--j] = ruby_digitmap[num % base];
num /= base;
- if (i == 0 && num == 0) break;
+ if (!trim && j <= 1) break;
+ if (trim && i == 0 && num == 0) break;
}
}
- while (s[j] == '0') j++;
- RSTRING(ss)->len -= RBIGNUM(x)->sign?j:j-1;
- memmove(RBIGNUM(x)->sign?s:s+1, s+j, RSTRING(ss)->len);
+ if (trim) {while (s[j] == '0') j++;}
+ i = RSTRING(ss)->len - j;
+ if (RBIGNUM(x)->sign) {
+ memmove(s, s+j, i);
+ RSTRING(ss)->len = i-1;
+ }
+ else {
+ memmove(s+1, s+j, i);
+ RSTRING(ss)->len = i;
+ }
s[RSTRING(ss)->len] = '\0';
+ TRAP_END;
return ss;
}
+VALUE
+rb_big2str(VALUE x, int base)
+{
+ return rb_big2str0(x, base, Qtrue);
+}
+
/*
* call-seq:
* big.to_s(base=10) => string
- *
+ *
* Returns a string containing the representation of <i>big</i> radix
* <i>base</i> (2 through 36).
- *
+ *
* 12345654321.to_s #=> "12345654321"
* 12345654321.to_s(2) #=> "1011011111110110111011110000110001"
* 12345654321.to_s(8) #=> "133766736061"
@@ -747,15 +812,15 @@ big2ulong(x, type)
}
unsigned long
-rb_big2ulong_pack(x)
- VALUE x;
-{
+rb_big2ulong_pack(x)
+ VALUE x;
+{
unsigned long num = big2ulong(x, "unsigned long");
if (!RBIGNUM(x)->sign) {
return -num;
}
return num;
-}
+}
unsigned long
rb_big2ulong(x)
@@ -873,8 +938,8 @@ rb_dbl2big(d)
return bignorm(dbl2big(d));
}
-double
-rb_big2dbl(x)
+static double
+big2dbl(x)
VALUE x;
{
double d = 0.0;
@@ -884,21 +949,30 @@ rb_big2dbl(x)
while (i--) {
d = ds[i] + BIGRAD*d;
}
+ if (!RBIGNUM(x)->sign) d = -d;
+ return d;
+}
+
+double
+rb_big2dbl(x)
+ VALUE x;
+{
+ double d = big2dbl(x);
+
if (isinf(d)) {
rb_warn("Bignum out of Float range");
d = HUGE_VAL;
}
- if (!RBIGNUM(x)->sign) d = -d;
return d;
}
/*
* call-seq:
* big.to_f -> float
- *
+ *
* Converts <i>big</i> to a <code>Float</code>. If <i>big</i> doesn't
* fit in a <code>Float</code>, the result is infinity.
- *
+ *
*/
static VALUE
@@ -911,11 +985,11 @@ rb_big_to_f(x)
/*
* call-seq:
* big <=> numeric => -1, 0, +1
- *
+ *
* Comparison---Returns -1, 0, or +1 depending on whether <i>big</i> is
* less than, equal to, or greater than <i>numeric</i>. This is the
* basis for the tests in <code>Comparable</code>.
- *
+ *
*/
static VALUE
@@ -956,11 +1030,11 @@ rb_big_cmp(x, y)
/*
* call-seq:
* big == obj => true or false
- *
+ *
* Returns <code>true</code> only if <i>obj</i> has the same value
* as <i>big</i>. Contrast this with <code>Bignum#eql?</code>, which
* requires <i>obj</i> to be a <code>Bignum</code>.
- *
+ *
* 68719476736 == 68719476736.0 #=> true
*/
@@ -995,11 +1069,11 @@ rb_big_eq(x, y)
/*
* call-seq:
* big.eql?(obj) => true or false
- *
+ *
* Returns <code>true</code> only if <i>obj</i> is a
* <code>Bignum</code> with the same value as <i>big</i>. Contrast this
* with <code>Bignum#==</code>, which performs type conversions.
- *
+ *
* 68719476736.eql?(68719476736.0) #=> false
*/
@@ -1040,7 +1114,7 @@ rb_big_uminus(x)
* length, the result acts as if it had an infinite number of one
* bits to the left. In hex representations, this is displayed
* as two periods to the left of the digits.
- *
+ *
* sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA"
*/
@@ -1055,6 +1129,7 @@ rb_big_neg(x)
if (!RBIGNUM(x)->sign) get2comp(z);
ds = BDIGITS(z);
i = RBIGNUM(x)->len;
+ if (!i) return INT2FIX(~0);
while (i--) ds[i] = ~ds[i];
RBIGNUM(z)->sign = !RBIGNUM(z)->sign;
if (RBIGNUM(x)->sign) get2comp(z);
@@ -1070,7 +1145,7 @@ bigsub(x, y)
BDIGIT *zds;
BDIGIT_DBL_SIGNED num;
long i = RBIGNUM(x)->len;
-
+
/* if x is larger than y, swap */
if (RBIGNUM(x)->len < RBIGNUM(y)->len) {
z = x; x = y; y = z; /* swap x y */
@@ -1088,14 +1163,14 @@ bigsub(x, y)
}
}
- z = bignew(RBIGNUM(x)->len, (z == 0)?1:0);
+ z = bignew(RBIGNUM(x)->len, z==0);
zds = BDIGITS(z);
- for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
+ for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
num += (BDIGIT_DBL_SIGNED)BDIGITS(x)[i] - BDIGITS(y)[i];
zds[i] = BIGLO(num);
num = BIGDN(num);
- }
+ }
while (num && i < RBIGNUM(x)->len) {
num += BDIGITS(x)[i];
zds[i++] = BIGLO(num);
@@ -1105,7 +1180,7 @@ bigsub(x, y)
zds[i] = BDIGITS(x)[i];
i++;
}
-
+
return z;
}
@@ -1206,15 +1281,8 @@ rb_big_minus(x, y)
}
}
-/*
- * call-seq:
- * big * other => Numeric
- *
- * Multiplies big and other, returning the result.
- */
-
VALUE
-rb_big_mul(x, y)
+rb_big_mul0(x, y)
VALUE x, y;
{
long i, j;
@@ -1243,7 +1311,7 @@ rb_big_mul(x, y)
zds = BDIGITS(z);
while (j--) zds[j] = 0;
for (i = 0; i < RBIGNUM(x)->len; i++) {
- BDIGIT_DBL dd = BDIGITS(x)[i];
+ BDIGIT_DBL dd = BDIGITS(x)[i];
if (dd == 0) continue;
n = 0;
for (j = 0; j < RBIGNUM(y)->len; j++) {
@@ -1257,7 +1325,21 @@ rb_big_mul(x, y)
}
}
- return bignorm(z);
+ return z;
+}
+
+/*
+ * call-seq:
+ * big * other => Numeric
+ *
+ * Multiplies big and other, returning the result.
+ */
+
+VALUE
+rb_big_mul(x, y)
+ VALUE x, y;
+{
+ return bignorm(rb_big_mul0(x, y));
}
static void
@@ -1306,7 +1388,7 @@ bigdivrem(x, y, divp, modp)
dd = 0;
q = yds[ny-1];
- while ((q & (1<<(BITSPERDIG-1))) == 0) {
+ while ((q & (1U<<(BITSPERDIG-1))) == 0) {
q <<= 1;
dd++;
}
@@ -1430,9 +1512,6 @@ rb_big_div(x, y)
case T_BIGNUM:
break;
- case T_FLOAT:
- return rb_float_new(rb_big2dbl(x) / RFLOAT(y)->value);
-
default:
return rb_num_coerce_bin(x, y);
}
@@ -1475,9 +1554,9 @@ rb_big_modulo(x, y)
/*
* call-seq:
* big.remainder(numeric) => number
- *
+ *
* Returns the remainder after dividing <i>big</i> by <i>numeric</i>.
- *
+ *
* -1234567890987654321.remainder(13731) #=> -6966
* -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
*/
@@ -1503,12 +1582,47 @@ rb_big_remainder(x, y)
return bignorm(z);
}
+static int
+bdigbitsize(BDIGIT x)
+{
+ int size = 1;
+ int nb = BITSPERDIG / 2;
+ BDIGIT bits = (~0 << nb);
+
+ if (!x) return 0;
+ while (x > 1) {
+ if (x & bits) {
+ size += nb;
+ x >>= nb;
+ }
+ x &= ~bits;
+ nb /= 2;
+ bits >>= nb;
+ }
+
+ return size;
+}
+
+static VALUE big_lshift _((VALUE, unsigned long));
+static VALUE big_rshift _((VALUE, unsigned long));
+
+static VALUE big_shift(x, n)
+ VALUE x;
+ int n;
+{
+ if (n < 0)
+ return big_lshift(x, (unsigned int)n);
+ else if (n > 0)
+ return big_rshift(x, (unsigned int)n);
+ return x;
+}
+
/*
* call-seq:
* big.divmod(numeric) => array
- *
+ *
* See <code>Numeric#divmod</code>.
- *
+ *
*/
VALUE
rb_big_divmod(x, y)
@@ -1535,22 +1649,51 @@ rb_big_divmod(x, y)
/*
* call-seq:
* big.quo(numeric) -> float
- *
+ * big.fdiv(numeric) -> float
+ *
* Returns the floating point result of dividing <i>big</i> by
* <i>numeric</i>.
- *
+ *
* -1234567890987654321.quo(13731) #=> -89910996357705.5
* -1234567890987654321.quo(13731.24) #=> -89909424858035.7
- *
+ *
*/
static VALUE
rb_big_quo(x, y)
VALUE x, y;
{
- double dx = rb_big2dbl(x);
+ double dx = big2dbl(x);
double dy;
+ if (isinf(dx)) {
+#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)
+ VALUE z;
+ int ex, ey;
+
+ ex = (RBIGNUM(bigtrunc(x))->len - 1) * BITSPERDIG;
+ ex += bdigbitsize(BDIGITS(x)[RBIGNUM(x)->len - 1]);
+ ex -= 2 * DBL_BIGDIG * BITSPERDIG;
+ if (ex) x = big_shift(x, ex);
+
+ switch (TYPE(y)) {
+ case T_FIXNUM:
+ y = rb_int2big(FIX2LONG(y));
+ case T_BIGNUM: {
+ ey = (RBIGNUM(bigtrunc(y))->len - 1) * BITSPERDIG;
+ ey += bdigbitsize(BDIGITS(y)[RBIGNUM(y)->len - 1]);
+ ey -= DBL_BIGDIG * BITSPERDIG;
+ if (ey) y = big_shift(y, ey);
+ bignum:
+ bigdivrem(x, y, &z, 0);
+ return rb_float_new(ldexp(big2dbl(z), ex - ey));
+ }
+ case T_FLOAT:
+ y = dbl2big(ldexp(frexp(RFLOAT(y)->value, &ey), DBL_MANT_DIG));
+ ey -= DBL_MANT_DIG;
+ goto bignum;
+ }
+ }
switch (TYPE(y)) {
case T_FIXNUM:
dy = (double)FIX2LONG(y);
@@ -1570,6 +1713,52 @@ rb_big_quo(x, y)
return rb_float_new(dx / dy);
}
+static VALUE
+bigsqr(x)
+ VALUE x;
+{
+ long len = RBIGNUM(x)->len, k = len / 2, i;
+ VALUE a, b, a2, z;
+ BDIGIT_DBL num;
+
+ if (len < 4000 / BITSPERDIG) {
+ return rb_big_mul0(x, x);
+ }
+
+ a = bignew(len - k, 1);
+ MEMCPY(BDIGITS(a), BDIGITS(x) + k, BDIGIT, len - k);
+ b = bignew(k, 1);
+ MEMCPY(BDIGITS(b), BDIGITS(x), BDIGIT, k);
+
+ a2 = bigtrunc(bigsqr(a));
+ z = bigsqr(b);
+ REALLOC_N(RBIGNUM(z)->digits, BDIGIT, (len = 2 * k + RBIGNUM(a2)->len) + 1);
+ while (RBIGNUM(z)->len < 2 * k) BDIGITS(z)[RBIGNUM(z)->len++] = 0;
+ MEMCPY(BDIGITS(z) + 2 * k, BDIGITS(a2), BDIGIT, RBIGNUM(a2)->len);
+ RBIGNUM(z)->len = len;
+ a2 = bigtrunc(rb_big_mul0(a, b));
+ len = RBIGNUM(a2)->len;
+ TRAP_BEG;
+ for (i = 0, num = 0; i < len; i++) {
+ num += (BDIGIT_DBL)BDIGITS(z)[i + k] + ((BDIGIT_DBL)BDIGITS(a2)[i] << 1);
+ BDIGITS(z)[i + k] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ TRAP_END;
+ if (num) {
+ len = RBIGNUM(z)->len;
+ for (i += k; i < len && num; ++i) {
+ num += (BDIGIT_DBL)BDIGITS(z)[i];
+ BDIGITS(z)[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ if (num) {
+ BDIGITS(z)[RBIGNUM(z)->len++] = BIGLO(num);
+ }
+ }
+ return bigtrunc(z);
+}
+
/*
* call-seq:
* big ** exponent #=> numeric
@@ -1589,7 +1778,7 @@ rb_big_pow(x, y)
{
double d;
long yy;
-
+
if (y == INT2FIX(0)) return INT2FIX(1);
switch (TYPE(y)) {
case T_FLOAT:
@@ -1604,16 +1793,21 @@ rb_big_pow(x, y)
case T_FIXNUM:
yy = FIX2LONG(y);
if (yy > 0) {
- VALUE z = x;
-
- for (;;) {
- yy -= 1;
- if (yy == 0) break;
- while (yy % 2 == 0) {
- yy /= 2;
- x = rb_big_mul(x, x);
+ VALUE z = 0;
+ long mask;
+ const long BIGLEN_LIMIT = 1024*1024 / SIZEOF_BDIGITS;
+
+ if ((RBIGNUM(x)->len > BIGLEN_LIMIT) ||
+ (RBIGNUM(x)->len > BIGLEN_LIMIT / yy)) {
+ rb_warn("in a**b, b may be too big");
+ d = (double)yy;
+ break;
+ }
+ for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
+ if (z) z = bigtrunc(bigsqr(z));
+ if (yy & mask) {
+ z = z ? bigtrunc(rb_big_mul0(z, x)) : x;
}
- z = rb_big_mul(z, x);
}
return bignorm(z);
}
@@ -1799,7 +1993,15 @@ rb_big_xor(xx, yy)
return bignorm(z);
}
-static VALUE rb_big_rshift _((VALUE,VALUE));
+static VALUE
+check_shiftdown(VALUE y, VALUE x)
+{
+ if (!RBIGNUM(x)->len) return INT2FIX(0);
+ if (RBIGNUM(y)->len > SIZEOF_LONG / SIZEOF_BDIGITS) {
+ return RBIGNUM(x)->sign ? INT2FIX(0) : INT2FIX(-1);
+ }
+ return Qnil;
+}
/*
* call-seq:
@@ -1812,15 +2014,46 @@ VALUE
rb_big_lshift(x, y)
VALUE x, y;
{
+ long shift;
+ int neg = 0;
+
+ for (;;) {
+ if (FIXNUM_P(y)) {
+ shift = FIX2LONG(y);
+ if (shift < 0) {
+ neg = 1;
+ shift = -shift;
+ }
+ break;
+ }
+ else if (TYPE(y) == T_BIGNUM) {
+ if (!RBIGNUM(y)->sign) {
+ VALUE t = check_shiftdown(y, x);
+ if (!NIL_P(t)) return t;
+ neg = 1;
+ }
+ shift = big2ulong(y, "long");
+ break;
+ }
+ y = rb_to_int(y);
+ }
+
+ if (neg) return big_rshift(x, shift);
+ return big_lshift(x, shift);
+}
+
+static VALUE
+big_lshift(x, shift)
+ VALUE x;
+ unsigned long shift;
+{
BDIGIT *xds, *zds;
- int shift = NUM2INT(y);
- int s1 = shift/BITSPERDIG;
+ long s1 = shift/BITSPERDIG;
int s2 = shift%BITSPERDIG;
VALUE z;
BDIGIT_DBL num = 0;
long len, i;
- if (shift < 0) return rb_big_rshift(x, INT2FIX(-shift));
len = RBIGNUM(x)->len;
z = bignew(len+s1+1, RBIGNUM(x)->sign);
zds = BDIGITS(z);
@@ -1844,19 +2077,52 @@ rb_big_lshift(x, y)
* Shifts big right _numeric_ positions (left if _numeric_ is negative).
*/
-static VALUE
+VALUE
rb_big_rshift(x, y)
VALUE x, y;
{
+ long shift;
+ int neg = 0;
+
+ for (;;) {
+ if (FIXNUM_P(y)) {
+ shift = FIX2LONG(y);
+ if (shift < 0) {
+ neg = 1;
+ shift = -shift;
+ }
+ break;
+ }
+ else if (TYPE(y) == T_BIGNUM) {
+ if (RBIGNUM(y)->sign) {
+ VALUE t = check_shiftdown(y, x);
+ if (!NIL_P(t)) return t;
+ }
+ else {
+ neg = 1;
+ }
+ shift = big2ulong(y, "long");
+ break;
+ }
+ y = rb_to_int(y);
+ }
+
+ if (neg) return big_lshift(x, shift);
+ return big_rshift(x, shift);
+}
+
+static VALUE
+big_rshift(x, shift)
+ VALUE x;
+ unsigned long shift;
+{
BDIGIT *xds, *zds;
- int shift = NUM2INT(y);
long s1 = shift/BITSPERDIG;
- long s2 = shift%BITSPERDIG;
+ int s2 = shift%BITSPERDIG;
VALUE z;
BDIGIT_DBL num = 0;
long i, j;
-
- if (shift < 0) return rb_big_lshift(x, INT2FIX(-shift));
+ volatile VALUE save_x;
if (s1 > RBIGNUM(x)->len) {
if (RBIGNUM(x)->sign)
@@ -1865,11 +2131,15 @@ rb_big_rshift(x, y)
return INT2FIX(-1);
}
if (!RBIGNUM(x)->sign) {
- x = rb_big_clone(x);
+ save_x = x = rb_big_clone(x);
get2comp(x);
}
xds = BDIGITS(x);
i = RBIGNUM(x)->len; j = i - s1;
+ if (j == 0) {
+ if (RBIGNUM(x)->sign) return INT2FIX(0);
+ else return INT2FIX(-1);
+ }
z = bignew(j, RBIGNUM(x)->sign);
if (!RBIGNUM(x)->sign) {
num = ((BDIGIT_DBL)~0) << BITSPERDIG;
@@ -1889,20 +2159,20 @@ rb_big_rshift(x, y)
/*
* call-seq:
* big[n] -> 0, 1
- *
+ *
* Bit Reference---Returns the <em>n</em>th bit in the (assumed) binary
* representation of <i>big</i>, where <i>big</i>[0] is the least
* significant bit.
- *
+ *
* a = 9**15
* 50.downto(0) do |n|
* print a[n]
* end
- *
+ *
* <em>produces:</em>
- *
+ *
* 000101110110100000111000011110010100111100010111001
- *
+ *
*/
static VALUE
@@ -1910,29 +2180,39 @@ rb_big_aref(x, y)
VALUE x, y;
{
BDIGIT *xds;
- int shift;
- long s1, s2;
+ BDIGIT_DBL num;
+ unsigned long shift;
+ long i, s1, s2;
if (TYPE(y) == T_BIGNUM) {
- if (!RBIGNUM(y)->sign || RBIGNUM(x)->sign)
+ if (!RBIGNUM(y)->sign)
return INT2FIX(0);
- return INT2FIX(1);
+ if (RBIGNUM(bigtrunc(y))->len > SIZEOF_LONG/SIZEOF_BDIGITS) {
+ out_of_range:
+ return RBIGNUM(x)->sign ? INT2FIX(0) : INT2FIX(1);
+ }
+ shift = big2ulong(y, "long");
+ }
+ else {
+ i = NUM2LONG(y);
+ if (i < 0) return INT2FIX(0);
+ shift = (VALUE)i;
}
- shift = NUM2INT(y);
- if (shift < 0) return INT2FIX(0);
s1 = shift/BITSPERDIG;
s2 = shift%BITSPERDIG;
+ if (s1 >= RBIGNUM(x)->len) goto out_of_range;
if (!RBIGNUM(x)->sign) {
- if (s1 >= RBIGNUM(x)->len) return INT2FIX(1);
- x = rb_big_clone(x);
- get2comp(x);
+ xds = BDIGITS(x);
+ i = 0; num = 1;
+ while (num += ~xds[i], ++i <= s1) {
+ num = BIGDN(num);
+ }
}
else {
- if (s1 >= RBIGNUM(x)->len) return INT2FIX(0);
+ num = BDIGITS(x)[s1];
}
- xds = BDIGITS(x);
- if (xds[s1] & (1<<s2))
+ if (num & ((BDIGIT_DBL)1<<s2))
return INT2FIX(1);
return INT2FIX(0);
}
@@ -1983,9 +2263,9 @@ rb_big_coerce(x, y)
/*
* call-seq:
* big.abs -> aBignum
- *
+ *
* Returns the absolute value of <i>big</i>.
- *
+ *
* -1234567890987654321.abs #=> 1234567890987654321
*/
@@ -2013,7 +2293,7 @@ rb_big_rand(max, rand_buf)
}
v = bignew(len,1);
len--;
- BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
+ BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
while (len--) {
BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len];
}
@@ -2024,10 +2304,10 @@ rb_big_rand(max, rand_buf)
/*
* call-seq:
* big.size -> integer
- *
+ *
* Returns the number of bytes in the machine representation of
* <i>big</i>.
- *
+ *
* (256**10 - 1).size #=> 12
* (256**20 - 1).size #=> 20
* (256**40 - 1).size #=> 40
@@ -2047,15 +2327,15 @@ rb_big_size(big)
* Fixnum. When a calculation involving
* Bignum objects returns a result that will fit in a
* Fixnum, the result is automatically converted.
- *
+ *
* For the purposes of the bitwise operations and <code>[]</code>, a
* Bignum is treated as if it were an infinite-length
* bitstring with 2's complement representation.
- *
+ *
* While Fixnum values are immediate, Bignum
* objects are not---assignment and parameter passing work with
* references to objects, not the objects themselves.
- *
+ *
*/
void
@@ -2076,6 +2356,7 @@ Init_Bignum()
rb_define_method(rb_cBignum, "modulo", rb_big_modulo, 1);
rb_define_method(rb_cBignum, "remainder", rb_big_remainder, 1);
rb_define_method(rb_cBignum, "quo", rb_big_quo, 1);
+ rb_define_method(rb_cBignum, "fdiv", rb_big_quo, 1);
rb_define_method(rb_cBignum, "**", rb_big_pow, 1);
rb_define_method(rb_cBignum, "&", rb_big_and, 1);
rb_define_method(rb_cBignum, "|", rb_big_or, 1);
diff --git a/bin/erb b/bin/erb
index 8759f81024..a6fcd5370c 100755
--- a/bin/erb
+++ b/bin/erb
@@ -60,7 +60,7 @@ class ERB
$DEBUG = true
when '-r' # require
require ARGV.req_arg
- when '-S' # sacurity level
+ when '-S' # security level
arg = ARGV.req_arg
raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-4]$/
safe_level = arg.to_i
@@ -102,12 +102,12 @@ class ERB
-x print ruby script
-n print ruby script with line number
-v enable verbose mode
- -d set $DBEUG to true
+ -d set $DEBUG 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 disregard the lin which starts in "%"
+ -P ignore lines which start with "%"
EOU
exit 1
end
diff --git a/class.c b/class.c
index b7f05dd4e5..096c7fbdf1 100644
--- a/class.c
+++ b/class.c
@@ -48,23 +48,35 @@ rb_class_new(super)
return rb_class_boot(super);
}
+struct clone_method_data {
+ st_table *tbl;
+ VALUE klass;
+};
+
static int
-clone_method(mid, body, tbl)
+clone_method(mid, body, data)
ID mid;
NODE *body;
- st_table *tbl;
+ struct clone_method_data *data;
{
- st_insert(tbl, mid, (st_data_t)NEW_METHOD(body->nd_body, body->nd_noex));
+ NODE *fbody = body->nd_body;
+
+ if (fbody && nd_type(fbody) == NODE_SCOPE) {
+ fbody = rb_copy_node_scope(fbody, ruby_cref);
+ }
+ st_insert(data->tbl, mid, (st_data_t)NEW_METHOD(fbody, body->nd_noex));
return ST_CONTINUE;
}
+/* :nodoc: */
VALUE
rb_mod_init_copy(clone, orig)
VALUE clone, orig;
{
rb_obj_init_copy(clone, orig);
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
- RBASIC(clone)->klass = rb_singleton_class_clone(orig);
+ RBASIC(clone)->klass = RBASIC(orig)->klass;
+ RBASIC(clone)->klass = rb_singleton_class_clone(clone);
}
RCLASS(clone)->super = RCLASS(orig)->super;
if (RCLASS(orig)->iv_tbl) {
@@ -77,14 +89,18 @@ rb_mod_init_copy(clone, orig)
st_delete(RCLASS(clone)->iv_tbl, (st_data_t*)&id, 0);
}
if (RCLASS(orig)->m_tbl) {
- RCLASS(clone)->m_tbl = st_init_numtable();
- st_foreach(RCLASS(orig)->m_tbl, clone_method,
- (st_data_t)RCLASS(clone)->m_tbl);
+ struct clone_method_data data;
+
+ data.tbl = RCLASS(clone)->m_tbl = st_init_numtable();
+ data.klass = (VALUE)clone;
+
+ st_foreach(RCLASS(orig)->m_tbl, clone_method, (st_data_t)&data);
}
return clone;
}
+/* :nodoc: */
VALUE
rb_class_init_copy(clone, orig)
VALUE clone, orig;
@@ -124,9 +140,22 @@ rb_singleton_class_clone(obj)
if (RCLASS(klass)->iv_tbl) {
clone->iv_tbl = st_copy(RCLASS(klass)->iv_tbl);
}
- clone->m_tbl = st_init_numtable();
- st_foreach(RCLASS(klass)->m_tbl, clone_method,
- (st_data_t)clone->m_tbl);
+ {
+ struct clone_method_data data;
+
+ data.tbl = clone->m_tbl = st_init_numtable();
+ switch (TYPE(obj)) {
+ case T_CLASS:
+ case T_MODULE:
+ data.klass = obj;
+ break;
+ default:
+ data.klass = 0;
+ break;
+ }
+
+ st_foreach(RCLASS(klass)->m_tbl, clone_method, (st_data_t)&data);
+ }
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
FL_SET(clone, FL_SINGLETON);
return (VALUE)clone;
@@ -377,9 +406,6 @@ rb_include_module(klass, module)
rb_secure(4);
}
- if (NIL_P(module)) return;
- if (klass == module) return;
-
if (TYPE(module) != T_MODULE) {
Check_Type(module, T_MODULE);
}
diff --git a/common.mk b/common.mk
index 113b64c970..bf49aade4a 100644
--- a/common.mk
+++ b/common.mk
@@ -1,11 +1,20 @@
bin: $(PROGRAM) $(WPROGRAM)
-lib: $(LIBRUBY);
-dll: $(LIBRUBY_SO);
+lib: $(LIBRUBY)
+dll: $(LIBRUBY_SO)
-RUBYOPT =
+RUBYLIB = -
+RUBYOPT = -
+
+SPEC_GIT_BASE = git://github.com/rubyspec
+MSPEC_GIT_URL = $(SPEC_GIT_BASE)/mspec.git
+RUBYSPEC_GIT_URL = $(SPEC_GIT_BASE)/rubyspec.git
+
+STATIC_RUBY = static-ruby
EXTCONF = extconf.rb
RBCONFIG = ./.rbconfig.time
+LIBRUBY_EXTS = ./.libruby-with-ext.time
+RDOCOUT = $(EXTOUT)/rdoc
DMYEXT = dmyext.$(OBJEXT)
MAINOBJ = main.$(OBJEXT)
@@ -19,6 +28,7 @@ OBJS = array.$(OBJEXT) \
dir.$(OBJEXT) \
dln.$(OBJEXT) \
enum.$(OBJEXT) \
+ enumerator.$(OBJEXT) \
error.$(OBJEXT) \
eval.$(OBJEXT) \
file.$(OBJEXT) \
@@ -51,90 +61,243 @@ OBJS = array.$(OBJEXT) \
$(MISSING)
SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
- --make="$(MAKE)" \
+ --extout="$(EXTOUT)" \
--mflags="$(MFLAGS)" \
--make-flags="$(MAKEFLAGS)"
-EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC) --
+EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) --
+INSTRUBY_ARGS = $(SCRIPT_ARGS) \
+ --data-mode=$(INSTALL_DATA_MODE) \
+ --prog-mode=$(INSTALL_PROG_MODE) \
+ --installed-list $(INSTALLED_LIST)
+INSTALL_PROG_MODE = 0755
+INSTALL_DATA_MODE = 0644
+
+PRE_LIBRUBY_UPDATE = $(MINIRUBY) -e 'ARGV[1] or File.unlink(ARGV[0]) rescue nil' -- \
+ $(LIBRUBY_EXTS) $(LIBRUBY_SO_UPDATE)
+
+TESTSDIR = $(srcdir)/test
+TESTWORKDIR = testwork
all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(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)
+$(LIBRUBY_A): $(OBJS) $(DMYEXT) $(ARCHFILE)
+
+$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(LIBRUBY_SO_UPDATE)
-$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(ARCHFILE)
+$(LIBRUBY_EXTS):
+ @exit > $@
-static-ruby: $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A)
+$(STATIC_RUBY)$(EXEEXT): $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
@$(RM) $@
- $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A) $(LIBS) $(OUTFLAG)$@
+ $(PURIFY) $(CC) $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)$@ $(LDFLAGS) $(XLDFLAGS)
-ruby.imp: $(LIBRUBY_A)
- @$(NM) -Pgp $(LIBRUBY_A) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@
+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-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc
+pre-install-nodoc:: pre-install-local pre-install-ext
+do-install-nodoc:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
+post-install-nodoc:: post-install-local post-install-ext
+
install-local: pre-install-local do-install-local post-install-local
-install-ext: pre-install-ext do-install-ext post-install-ext
+pre-install-local:: pre-install-bin pre-install-lib pre-install-man
+do-install-local:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
+loadpath: $(PREP)
+ $(MINIRUBY) -e 'p $$:'
-do-install-local: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
-do-install-ext: $(RBCONFIG)
- $(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
+post-install-local:: post-install-bin post-install-lib post-install-man
-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)"
+install-ext: pre-install-ext do-install-ext post-install-ext
+pre-install-ext:: pre-install-ext-arch pre-install-ext-comm
+do-install-ext:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext
+post-install-ext:: post-install-ext-arch post-install-ext-comm
+
+install-arch: pre-install-arch do-install-arch post-install-arch
+pre-install-arch:: pre-install-bin pre-install-ext-arch
+do-install-arch:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch
+post-install-arch:: post-install-bin post-install-ext-arch
+
+install-comm: pre-install-comm do-install-comm post-install-comm
+pre-install-comm:: pre-install-lib pre-install-ext-comm pre-install-man
+do-install-comm:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
+post-install-comm:: post-install-lib post-install-ext-comm post-install-man
+
+install-bin: pre-install-bin do-install-bin post-install-bin
+pre-install-bin:: install-prereq
+do-install-bin:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin
+post-install-bin::
+ @$(NULLCMD)
+
+install-lib: pre-install-lib do-install-lib post-install-lib
+pre-install-lib:: install-prereq
+do-install-lib:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib
+post-install-lib::
+ @$(NULLCMD)
+
+install-ext-comm: pre-install-ext-comm do-install-ext-comm post-install-ext-comm
+pre-install-ext-comm:: install-prereq
+do-install-ext-comm:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm
+post-install-ext-comm::
+ @$(NULLCMD)
+
+install-ext-arch: pre-install-ext-arch do-install-ext-arch post-install-ext-arch
+pre-install-ext-arch:: install-prereq
+do-install-ext-arch:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch
+post-install-ext-arch::
+ @$(NULLCMD)
+
+install-man: pre-install-man do-install-man post-install-man
+pre-install-man:: install-prereq
+do-install-man:
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
+post-install-man::
+ @$(NULLCMD)
+
+what-where: no-install
+no-install: no-install-nodoc no-install-doc
+what-where-all: no-install-all
+no-install-all: no-install-nodoc
+
+what-where-nodoc: no-install-nodoc
+no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
+pre-no-install-nodoc:: pre-no-install-local pre-no-install-ext
+dont-install-nodoc:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
+post-no-install-nodoc:: post-no-install-local post-no-install-ext
-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
+no-install-local: pre-no-install-local dont-install-local post-no-install-local
+pre-no-install-local:: pre-no-install-bin pre-no-install-lib pre-no-install-man
+dont-install-local:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
+post-no-install-local:: post-no-install-bin post-no-install-lib post-no-install-man
-install-doc: pre-install-doc do-install-doc post-install-doc
+what-where-ext: no-install-ext
+no-install-ext: pre-no-install-ext dont-install-ext post-no-install-ext
+pre-no-install-ext:: pre-no-install-ext-arch pre-no-install-ext-comm
+dont-install-ext:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext
+post-no-install-ext:: post-no-install-ext-arch post-no-install-ext-comm
+
+what-where-arch: no-install-arch
+no-install-arch: pre-no-install-arch dont-install-arch post-no-install-arch
+pre-no-install-arch:: pre-no-install-bin pre-no-install-ext-arch
+dont-install-arch:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch
+post-no-install-arch:: post-no-install-lib post-no-install-man post-no-install-ext-arch
+
+what-where-comm: no-install-comm
+no-install-comm: pre-no-install-comm dont-install-comm post-no-install-comm
+pre-no-install-comm:: pre-no-install-lib pre-no-install-ext-comm pre-no-install-man
+dont-install-comm:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
+post-no-install-comm:: post-no-install-lib post-no-install-ext-comm post-no-install-man
+
+what-where-bin: no-install-bin
+no-install-bin: pre-no-install-bin dont-install-bin post-no-install-bin
+pre-no-install-bin:: install-prereq
+dont-install-bin:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin
+post-no-install-bin::
+ @$(NULLCMD)
+
+what-where-lib: no-install-lib
+no-install-lib: pre-no-install-lib dont-install-lib post-no-install-lib
+pre-no-install-lib:: install-prereq
+dont-install-lib:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib
+post-no-install-lib::
+ @$(NULLCMD)
+
+what-where-ext-comm: no-install-ext-comm
+no-install-ext-comm: pre-no-install-ext-comm dont-install-ext-comm post-no-install-ext-comm
+pre-no-install-ext-comm:: install-prereq
+dont-install-ext-comm:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm
+post-no-install-ext-comm::
+ @$(NULLCMD)
+
+what-where-ext-arch: no-install-ext-arch
+no-install-ext-arch: pre-no-install-ext-arch dont-install-ext-arch post-no-install-ext-arch
+pre-no-install-ext-arch:: install-prereq
+dont-install-ext-arch:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch
+post-no-install-ext-arch::
+ @$(NULLCMD)
+
+what-where-man: no-install-man
+no-install-man: pre-no-install-man dont-install-man post-no-install-man
+pre-no-install-man:: install-prereq
+dont-install-man:
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
+post-no-install-man::
+ @$(NULLCMD)
+
+install-doc: rdoc pre-install-doc do-install-doc post-install-doc
+pre-install-doc:: install-prereq
do-install-doc: $(PROGRAM)
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
+post-install-doc::
+ @$(NULLCMD)
+
+rdoc: $(PROGRAM) PHONY
@echo Generating RDoc documentation
- $(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
+ $(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RDOCOUT)" "$(srcdir)"
+
+what-where-doc: no-install-doc
+no-install-doc: pre-no-install-doc dont-install-doc post-no-install-doc
+pre-no-install-doc:: install-prereq
+dont-install-doc::
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
+post-no-install-doc::
+ @$(NULLCMD)
+
+CLEAR_INSTALLED_LIST = clear-installed-list
-pre-install: pre-install-local pre-install-ext
-pre-install-local:: PHONY
-pre-install-ext:: PHONY
-pre-install-doc:: PHONY
+install-prereq: $(CLEAR_INSTALLED_LIST)
-post-install: post-install-local post-install-ext
-post-install-local:: PHONY
-post-install-ext:: PHONY
-post-install-doc:: PHONY
+clear-installed-list:
+ @exit > $(INSTALLED_LIST)
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)
+ @$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
+ @$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time
+ @$(RM) y.tab.c y.output
clean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) clean
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(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)
+ @$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP)
distclean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) distclean
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS) distclean
-realclean:: distclean
+realclean:: realclean-ext realclean-local
+realclean-local:: distclean-local
@$(RM) parse.c lex.c
+realclean-ext::
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS) realclean
check: test test-all
@@ -142,10 +305,10 @@ test: miniruby$(EXEEXT) $(RBCONFIG) $(PROGRAM) PHONY
@$(MINIRUBY) $(srcdir)/rubytest.rb
test-all:
- $(RUNRUBY) -C "$(srcdir)/test" runner.rb --runner=$(TESTUI) $(TESTS)
+ $(RUNRUBY) "$(srcdir)/test/runner.rb" --basedir="$(TESTSDIR)" --runner=$(TESTUI) $(TESTS)
extconf:
- $(MINIRUBY) -I$(srcdir)/lib -run -e mkdir -- -p "$(EXTCONFDIR)"
+ $(MINIRUBY) -run -e mkdir -- -p "$(EXTCONFDIR)"
$(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
$(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
@@ -155,7 +318,7 @@ $(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
.PRECIOUS: $(MKFILES)
-.PHONY: test install install-nodoc install-doc
+.PHONY: test install install-nodoc install-doc dist
PHONY:
@@ -186,6 +349,8 @@ nt.$(OBJEXT): {$(VPATH)}nt.c
x68.$(OBJEXT): {$(VPATH)}x68.c
os2.$(OBJEXT): {$(VPATH)}os2.c
dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
+ia64.$(OBJEXT): {$(VPATH)}ia64.s
+ $(CC) $(CFLAGS) -c $<
# when I use -I., there is confliction at "OpenFile"
# so, set . into environment varible "include"
@@ -197,7 +362,8 @@ 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
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubysig.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
@@ -209,13 +375,13 @@ dir.$(OBJEXT): {$(VPATH)}dir.c {$(VPATH)}ruby.h config.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
+dmydln.$(OBJEXT): {$(VPATH)}dmydln.c dln.$(OBJEXT)
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
+enumerator.$(OBJEXT): {$(VPATH)}enumerator.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.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
@@ -238,7 +404,8 @@ 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)}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 \
@@ -296,3 +463,6 @@ variable.$(OBJEXT): {$(VPATH)}variable.c {$(VPATH)}ruby.h config.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/configure.in b/configure.in
index 336d1c2d18..5633bc3c44 100644
--- a/configure.in
+++ b/configure.in
@@ -3,7 +3,7 @@ AC_INIT()
AC_PREREQ(2.58)
-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
@@ -44,10 +44,20 @@ fi
GNU_LD=$rb_cv_prog_gnu_ld
AC_SUBST(GNU_LD)])
+unset GREP_OPTIONS
rb_version=`grep RUBY_VERSION $srcdir/version.h`
MAJOR=`expr "$rb_version" : '#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"'`
MINOR=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"'`
TEENY=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"'`
+if test "$MAJOR" = ""; then
+ AC_MSG_ERROR(could not determine MAJOR number from version.h)
+fi
+if test "$MINOR" = ""; then
+ AC_MSG_ERROR(could not determine MINOR number from version.h)
+fi
+if test "$TEENY" = ""; then
+ AC_MSG_ERROR(could not determine TEENY number from version.h)
+fi
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(TEENY)
@@ -73,7 +83,9 @@ 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.
+ifelse(currently,disabled, [
dnl checks for fat-binary
AC_ARG_ENABLE(fat-binary,
[ --enable-fat-binary=ARCHS
@@ -127,6 +139,7 @@ if test "$fat_binary" != no; then
done
AC_DEFINE(NEXT_FAT_BINARY)
fi
+], [fat_binary=no])
case $target_cpu in
i?86) frame_address=yes;;
@@ -148,6 +161,11 @@ if test x"${build}" != x"${host}"; then
fi
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
+if test "$GCC" = yes; then
+ linker_flag=-Wl,
+else
+ linker_flag=
+fi
RUBY_PROG_GNU_LD
RUBY_CPPOUTFILE
@@ -168,6 +186,10 @@ 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)
@@ -182,10 +204,19 @@ cygwin*|mingw*)
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 |
+ tr A-Z a-z |
sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
- [rb_cv_msvcrt=msvcrt])])
- test "$rb_cv_msvcrt" = "" && AC_MSG_ERROR([must be linked to DLL])
+ [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}
;;
@@ -215,7 +246,12 @@ else
fi
dnl check for large file stuff
+mv confdefs.h confdefs1.h
+: > confdefs.h
AC_SYS_LARGEFILE
+mv confdefs.h largefile.h
+mv confdefs1.h confdefs.h
+cat largefile.h >> confdefs.h
AC_CHECK_TYPES([long long, off_t])
@@ -272,16 +308,53 @@ if test "$rb_cv_stdarg" = yes; then
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
fi
-AC_CACHE_CHECK([for noreturn], rb_cv_noreturn,
-[rb_cv_noreturn=x
-for mac in "x __attribute__ ((noreturn))" "__declspec(noreturn) x" x; do
+AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
+m4_ifval([$2], dnl
+ [AS_VAR_PUSHDEF([attrib],[$2])], dnl
+ [AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
+)dnl
+m4_ifval([$3], dnl
+ [AS_VAR_PUSHDEF([rbcv],[$3])], dnl
+ [AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
+)dnl
+AC_CACHE_CHECK(for [$1] function attribute, rbcv,
+[rbcv=x
+if test "${ac_c_werror_flag+set}"; then
+ rb_c_werror_flag="$ac_c_werror_flag"
+else
+ unset rb_c_werror_flag
+fi
+ac_c_werror_flag=yes
+for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
AC_TRY_COMPILE(
- [#define NORETURN(x) $mac
-NORETURN(void exit(int x));],
- [],
- [rb_cv_noreturn="$mac"; break])
+ [#define ]attrib[(x) $mac
+ ]attrib[(void conftest_attribute_check(void));], [],
+ [rbcv="$mac"; break])
+done
+if test "${rb_c_werror_flag+set}"; then
+ ac_c_werror_flag="$rb_c_werror_flag"
+else
+ unset ac_c_werror_flag
+fi
+])
+AC_DEFINE_UNQUOTED(attrib[(x)], $rbcv)
+AS_VAR_POPDEF([attrib])
+AS_VAR_POPDEF([rbcv])
+])
+
+RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
+RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
+
+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])
-AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn)
+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
@@ -299,24 +372,45 @@ AC_ARG_ENABLE(pthread,
[ --enable-pthread use pthread library.],
[enable_pthread=$enableval], [enable_pthread=no])
+AC_ARG_ENABLE(fastthread,
+ [ --disable-fastthread do not use the fastthread mutex], [
+ : handled by ext/thread/extconf.rb
+ ])
+
dnl Checks for libraries.
case "$target_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
-darwin*) LIBS="-lobjc $LIBS";;
+darwin*) LIBS="-lobjc $LIBS"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE"
+ AC_TRY_CPP([#include <AvailabilityMacros.h>
+ #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040
+ #error pre OS X 10.4
+ [!<===== pre OS X 10.4 =====>]
+ #endif
+ ],
+ [
+ test "x$target_cpu" = xpowerpc && ac_cv_header_ucontext_h=no
+ ],
+ [
+ AC_DEFINE(BROKEN_SETREUID, 1)
+ AC_DEFINE(BROKEN_SETREGID, 1)
+ ])
+ ;;
hpux*) LIBS="-lm $LIBS"
ac_cv_c_inline=no;;
human*) ac_cv_func_getpgrp_void=yes
ac_cv_func_setitimer=no
;;
-beos*) ;;
-cygwin*) rb_cv_have_daylight=no
- ac_cv_var_tzname=no
- ac_cv_func__setjmp=no
- ac_cv_func_setitimer=no
- ;;
-mingw*) LIBS="-lwsock32 $LIBS"
+beos*) ac_cv_func_link=no;;
+cygwin*) ;;
+mingw*) if test "$with_winsock2" = yes; then
+ LIBS="-lws2_32 $LIBS"
+ else
+ LIBS="-lwsock32 $LIBS"
+ fi
+ LIBS="-lshell32 $LIBS"
ac_cv_header_a_out_h=no
ac_cv_header_pwd_h=no
ac_cv_header_utime_h=no
@@ -324,6 +418,7 @@ mingw*) LIBS="-lwsock32 $LIBS"
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
@@ -334,20 +429,29 @@ mingw*) LIBS="-lwsock32 $LIBS"
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
+ ac_cv_func_fcntl=yes
;;
os2-emx*) LIBS="-lm $LIBS"
ac_cv_lib_dir_opendir=no;;
msdosdjgpp*) LIBS="-lm $LIBS"
ac_cv_func_getpgrp_void=yes
ac_cv_func_setitimer=no
+ ac_cv_sizeof_rlim_t=4
+ ac_cv_func_setrlimit=no
;;
+bsdi*) LIBS="-lm $LIBS"
+ AC_DEFINE(BROKEN_SETREUID, 1)
+ AC_DEFINE(BROKEN_SETREGID, 1)
+ ac_cv_sizeof_rlim_t=8;;
freebsd*) LIBS="-lm $LIBS"
AC_CACHE_CHECK([whether -lxpg4 has to be linked],
rb_cv_lib_xpg4_needed,
@@ -387,11 +491,17 @@ bow) ac_cv_func_setitimer=no
;;
superux*) ac_cv_func_setitimer=no
;;
+solaris*2.1*) if test -z "$GCC"; then
+ ac_cv_func_isinf=yes
+ fi
+ LIBS="-lm $LIBS"
+ ;;
*) LIBS="-lm $LIBS";;
esac
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
+AC_CHECK_LIB(rt, clock_gettime) # GNU/Linux
case "$target_cpu" in
alpha*) case "$target_os"::"$GCC" in
@@ -404,12 +514,29 @@ 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\
+AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h sys/syscall.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_SIZE_T
AC_STRUCT_ST_BLKSIZE
@@ -419,21 +546,104 @@ AC_STRUCT_ST_RDEV
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL
-AC_FUNC_ALLOCA
+case "${target_cpu}-${target_os}" in
+powerpc-darwin*)
+ AC_LIBSOURCES(alloca.c)
+ AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.${ac_objext}])
+ AC_DEFINE(C_ALLOCA)
+ AC_DEFINE_UNQUOTED(alloca, alloca)
+ ;;
+*)
+ AC_FUNC_ALLOCA
+ ;;
+esac
AC_FUNC_MEMCMP
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(ftello)
+
+# http://sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html
+# Debian GNU/Linux Etch's libc6.1 2.3.6.ds1-13etch5 has this problem.
+# Debian GNU/Linux Lenny's libc6.1 2.7-10 has no problem.
+AC_CACHE_CHECK(for broken erfc of glibc-2.3.6 on IA64, rb_broken_glibc_ia64_erfc,
+ [AC_TRY_RUN([
+#include <math.h>
+int
+main()
+{
+ erfc(10000.0);
+ return 0;
+}
+],
+ rb_broken_glibc_ia64_erfc=no,
+ rb_broken_glibc_ia64_erfc=yes,
+ rb_broken_glibc_ia64_erfc=no)])
+case $rb_broken_glibc_ia64_erfc in
+ yes) ac_cv_func_erf=no;;
+esac
+
AC_REPLACE_FUNCS(dup2 memmove 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\
- 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_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd eaccess\
+ truncate ftruncate 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\
+ group_member dlopen sigprocmask\
+ sigaction sigsetjmp _setjmp _longjmp setsid telldir seekdir fchmod\
+ mktime timegm gettimeofday\
+ cosh sinh tanh round setuid setgid setenv unsetenv)
+
+AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
+[AC_TRY_LINK([@%:@include <setjmp.h>
+ jmp_buf jb; void t(v) int v; {__builtin_longjmp(jb, v);}],
+ [__builtin_setjmp(jb);],
+ [ac_cv_func___builtin_setjmp=yes],
+ [ac_cv_func___builtin_setjmp=no])
+])
+
+test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
+
+AC_MSG_CHECKING(for setjmp type)
+AC_ARG_WITH(setjmp-type,
+ [ --with-setjmp-type select setjmp type], [
+ case $withval in
+ __builtin_setjmp) setjmp_prefix=__builtin_;;
+ _setjmp) setjmp_prefix=_;;
+ sigsetjmp) setjmp_prefix=sig;;
+ setjmp) setjmp_prefix=;;
+ '') unset setjmp_prefix;;
+ *) AC_MSG_ERROR(invalid setjmp type: $withval);;
+ esac], [unset setjmp_prefix])
+if test ${setjmp_prefix+set}; then
+ if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp = no; then
+ AC_MSG_ERROR(${setjmp_prefix}setjmp is not available)
+ fi
+elif test "$ac_cv_func___builtin_setjmp" = yes; then
+ setjmp_prefix=__builtin_
+elif test "$ac_cv_func__setjmp" = yes; then
+ setjmp_prefix=_
+elif test "$ac_cv_func_sigsetjmp" = yes; then
+ case $target_os in
+ solaris*|cygwin*)
+ setjmp_prefix=;;
+ *)
+ setjmp_prefix=sig;;
+ esac
+else
+ setjmp_prefix=
+fi
+if test x$setjmp_prefix = xsig; then
+ setjmp_sigmask=yes
+else
+ unset setjmp_sigmask
+fi
+AC_MSG_RESULT(${setjmp_prefix}setjmp)
+AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp(env${setjmp_sigmask+,0})])
+AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
+AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
+
AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
[use_setreuid=$enableval])
@@ -459,6 +669,50 @@ AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
if test "$rb_cv_have_daylight" = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
+AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
+AC_CACHE_CHECK([for external $1], rb_cv_var_$1,
+ [rb_cv_var_$1=no
+ AC_TRY_COMPILE([
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 1
+#endif
+$2
+;
+const volatile void *volatile t;],
+ [t = &(&$1)[0];],
+ [for t in $3; do
+ AC_TRY_COMPILE([
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 1
+#endif
+$2
+;
+extern $t $1;
+const volatile void *volatile t;],
+ [t = &(&$1)[0];],
+ [rb_cv_var_$1=$t; break])
+ done])])
+if test "[$rb_cv_var_]$1" != no; then
+ AC_DEFINE([HAVE_VAR_]m4_toupper($1))
+ AC_DEFINE_UNQUOTED([TYPEOF_VAR_]m4_toupper($1), $rb_cv_var_$1)
+fi])
+RUBY_CHECK_VARTYPE(timezone, [@%:@include <time.h>], [long int])
+RUBY_CHECK_VARTYPE(altzone, [@%:@include <time.h>], [long int])
+if test "$rb_cv_var_timezone" = no; then
+ AC_CHECK_FUNCS(timezone)
+ if test "$ac_cv_func_timezone" = yes; then
+ AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void,
+ [AC_TRY_COMPILE([@%:@include <time.h>],
+ [(void)timezone(0, 0);],
+ [rb_cv_func_timezone_void=no],
+ [rb_cv_func_timezone_void=yes])]
+ )
+ if test $rb_cv_func_timezone_void = yes; then
+ AC_DEFINE(TIMEZONE_VOID)
+ fi
+ fi
+fi
+
AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
[AC_TRY_RUN([
#include <time.h>
@@ -500,6 +754,7 @@ fi
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
AC_DEFINE(POSIX_SIGNAL)
else
+ AC_CHECK_FUNCS(sigsetmask)
AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal,
[AC_TRY_RUN([
#include <stdio.h>
@@ -522,7 +777,7 @@ main()
],
rb_cv_bsd_signal=yes,
rb_cv_bsd_signal=no,
- rb_cv_bsd_signal=no)])
+ rb_cv_bsd_signal=$ac_cv_func_sigsetmask)])
if test "$rb_cv_bsd_signal" = yes; then
AC_DEFINE(BSD_SIGNAL)
fi
@@ -537,6 +792,21 @@ AC_C_CHAR_UNSIGNED
AC_C_INLINE
AC_C_VOLATILE
+if test x"$target_cpu" = xia64; then
+ AC_LIBOBJ([ia64])
+ AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
+ rb_cv___libc_ia64_register_backing_store_base,
+ [rb_cv___libc_ia64_register_backing_store_base=no
+ AC_TRY_LINK(
+ [extern unsigned long __libc_ia64_register_backing_store_base;],
+ [unsigned long p = __libc_ia64_register_backing_store_base;
+ printf("%ld\n", p);],
+ [rb_cv___libc_ia64_register_backing_store_base=yes])])
+ if test $rb_cv___libc_ia64_register_backing_store_base = yes; then
+ AC_DEFINE(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE)
+ fi
+fi
+
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
[AC_TRY_RUN([
int
@@ -621,7 +891,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>
@@ -696,6 +966,22 @@ 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;;
@@ -753,7 +1039,7 @@ if test x"$enable_pthread" = xyes; then
fi
fi
if test x"$ac_cv_header_ucontext_h" = xyes; then
- if test x"$target_cpu" = xia64 -o x"$rb_with_pthread" = xyes; then
+ if test x"$rb_with_pthread" = xyes; then
AC_CHECK_FUNCS(getcontext setcontext)
fi
fi
@@ -827,7 +1113,7 @@ AC_SUBST(DLEXT2)dnl
AC_SUBST(LIBEXT)dnl
STATIC=
-: ${LIBPATHFLAG=' -L"%s"'}
+: ${LIBPATHFLAG=' -L%s'}
: ${PATHFLAG=''}
if test "$with_dln_a_out" != yes; then
@@ -852,17 +1138,28 @@ if test "$with_dln_a_out" != yes; then
esac
fi
+
+ AC_ARG_ENABLE(rpath,
+ [ --disable-rpath embed run path into extension libraries.],
+ [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
+ if test "$enable_rpath" = yes; then
+ LIBPATHFLAG=" -L%1\$-s"
+ RPATHFLAG=" ${linker_flag}-R%1\$-s"
+ fi
+
case "$target_os" in
hpux*) DLDFLAGS="$DLDFLAGS -E"
: ${LDSHARED='ld -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
: ${LIBPATHENV=SHLIB_PATH}
+ if test "$rb_cv_prog_gnu_ld" = no; then
+ RPATHFLAG=' +b %1$-s'
+ fi
rb_cv_dlopen=yes;;
solaris*) if test "$GCC" = yes; then
- : ${LDSHARED='$(CC) -Wl,-G'}
+ : ${LDSHARED='$(CC) -shared'}
if test "$rb_cv_prog_gnu_ld" = yes; then
LDFLAGS="$LDFLAGS -Wl,-E"
- LDSHARED="$LDSHARED -shared"
fi
else
: ${LDSHARED='ld -G'}
@@ -892,7 +1189,7 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes ;;
interix*) : ${LDSHARED="$CC -shared"}
XLDFLAGS="$XLDFLAGS -Wl,-E"
- LIBPATHFLAG=" -L'%1\$-s'"
+ LIBPATHFLAG=" -L%1\$-s"
rb_cv_dlopen=yes ;;
freebsd*|dragonfly*) : ${LDSHARED="$CC -shared"}
if test "$rb_cv_binary_elf" = yes; then
@@ -920,16 +1217,19 @@ if test "$with_dln_a_out" != yes; then
: ${LDFLAGS=""}
: ${LIBPATHENV=DYLD_LIBRARY_PATH}
rb_cv_dlopen=yes ;;
- aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
- XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
- DLDFLAGS='-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
- LDFLAGS="-brtl $LDFLAGS"
- : ${ARCHFILE="ruby.imp"}
- TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
- TRY_LINK="$TRY_LINK"' $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
- : ${LIBPATHENV=SHLIB_PATH}
- rb_cv_dlopen=yes ;;
-
+ aix*) if test "$GCC" = yes; then
+ : ${LDSHARED='$(CC) -shared'}
+ else
+ : ${LDSHARED='$(CC)'}
+ fi
+ LDSHARED="$LDSHARED ${linker_flag}-G"
+ DLDFLAGS='-eInit_$(TARGET)'
+ XLDFLAGS="${linker_flag}-bE:ruby.imp ${linker_flag}-brtl"
+ : ${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 ;;
human*) : ${DLDFLAGS=''}
: ${LDSHARED=''}
: ${LDFLAGS=''}
@@ -953,7 +1253,7 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes;;
cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"}
XLDFLAGS="$XLDFLAGS -Wl,--stack,0x02000000"
- DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-import,--export-all"
+ DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import,--export-all"
: ${LIBPATHENV=""}
rb_cv_dlopen=yes ;;
hiuxmpp) : ${LDSHARED='ld -r'} ;;
@@ -964,14 +1264,6 @@ if test "$with_dln_a_out" != yes; then
*) : ${LDSHARED='ld'} ;;
esac
AC_MSG_RESULT($rb_cv_dlopen)
-
- AC_ARG_ENABLE(rpath,
- [ --disable-rpath embed run path into extension libraries.],
- [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
- if test "$enable_rpath" = yes; then
- LIBPATHFLAG=" -L'%1\$-s'"
- RPATHFLAG=" -Wl,-R'%1\$-s'"
- fi
fi
AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
@@ -1005,30 +1297,24 @@ if test "$dln_a_out_works" = yes; then
STATIC=-Bstatic
fi
DLEXT=so
- AC_DEFINE(DLEXT, ".so")
CCDLFLAGS=
else
case "$target_os" in
- hpux*) DLEXT=sl
- AC_DEFINE(DLEXT, ".sl");;
- nextstep*) DLEXT=bundle
- AC_DEFINE(DLEXT, ".bundle");;
- openstep*) DLEXT=bundle
- AC_DEFINE(DLEXT, ".bundle");;
- rhapsody*) DLEXT=bundle
- AC_DEFINE(DLEXT, ".bundle");;
- darwin*) DLEXT=bundle
- AC_DEFINE(DLEXT, ".bundle");;
- os2-emx*) DLEXT=dll
- AC_DEFINE(DLEXT, ".dll");;
- cygwin*|mingw*) DLEXT=so
- AC_DEFINE(DLEXT, ".so")
- DLEXT2=dll
- AC_DEFINE(DLEXT2, ".dll");;
- *) DLEXT=so
- AC_DEFINE(DLEXT, ".so");;
+ hpux*) DLEXT=sl;;
+ nextstep*|openstep*|rhapsody*|darwin*)
+ DLEXT=bundle;;
+ os2-emx*) DLEXT=dll;;
+ cygwin*|mingw*)
+ DLEXT=so DLEXT2=dll;;
+ *) DLEXT=so;;
esac
fi
+len=2 # .rb
+n=`expr "$DLEXT" : '.*'`; test "$n" -gt "$len" && len=$n
+n=`expr "$DLEXT2" : '.*'`; test "$n" -gt "$len" && len=$n
+AC_DEFINE_UNQUOTED(DLEXT_MAXLEN, `expr $len + 1`)
+test ".$DLEXT" = "." || AC_DEFINE_UNQUOTED(DLEXT, ".$DLEXT")
+test ".$DLEXT2" = "." || AC_DEFINE_UNQUOTED(DLEXT2, ".$DLEXT2")
AC_SUBST(STRIP)dnl
if test "$with_dln_a_out" = yes; then
@@ -1064,7 +1350,7 @@ case "$target_os" in
human*)
AC_CHECK_LIB(signal, _harderr)
AC_CHECK_LIB(hmem, hmemset)
- AC_CHECK_FUNCS(select gettimeofday)
+ AC_CHECK_FUNCS(select)
AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
rb_cv_missing__dtos18,
[AC_TRY_RUN(
@@ -1137,9 +1423,10 @@ if test x"$cross_compiling" = xyes; then
PREP=fake.rb
RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
else
- MINIRUBY='./miniruby$(EXEEXT)'
+ MINIRUBY='./miniruby$(EXEEXT) -I$(srcdir)/lib'
+ MINIRUBY="$MINIRUBY"' -I$(EXTOUT)/common -I./- -r$(srcdir)/ext/purelib.rb'
PREP='miniruby$(EXEEXT)'
- RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT) --'
+ RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT)'
fi
AC_SUBST(MINIRUBY)
AC_SUBST(PREP)
@@ -1217,8 +1504,6 @@ 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}'
;;
@@ -1228,14 +1513,8 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).sl'
;;
aix*)
- if test "$GCC" = yes; then
- LIBRUBY_LDSHARED='$(CC) -shared'
- LIBRUBY_DLDFLAGS='-Wl,-bE:ruby.imp'
- else
- LIBRUBY_LDSHARED='/usr/ccs/bin/ld'
- LIBRUBY_DLDFLAGS='-bE:ruby.imp -bM:SRE -bnoentry'
- fi
- LIBRUBYARG_SHARED='-L${libdir} -Wl,lib$(RUBY_SO_NAME).so'
+ LIBRUBY_DLDFLAGS="${linker_flag}-bnoentry $XLDFLAGS"
+ LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
SOLIBS='-lm -lc'
;;
beos*)
@@ -1252,17 +1531,17 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib'
;;
interix*)
- LIBRUBYARG_SHARED='-L${libdir} -L. -l$(RUBY_SO_NAME)'
+ LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
;;
*)
;;
esac
fi
if test "$enable_rpath" = yes; then
- LIBRUBYARG_SHARED='-Wl,-R -Wl,$(libdir) -L$(libdir) -L. '"$LIBRUBYARG_SHARED"
+ LIBRUBYARG_SHARED="${linker_flag}-R ${linker_flag}\$(libdir) -L\$(libdir) $LIBRUBYARG_SHARED"
fi
-XLDFLAGS="$XLDFLAGS -L."
+LDFLAGS="-L. $LDFLAGS"
AC_SUBST(ARCHFILE)
dnl build rdoc index if requested
@@ -1276,6 +1555,9 @@ fi
AC_SUBST(RDOCTARGET)
case "$target_os" in
+ linux*)
+ XCFLAGS="$XCFLAGS -D_GNU_SOURCE=1"
+ ;;
netbsd*)
CFLAGS="$CFLAGS -pipe"
;;
@@ -1295,6 +1577,7 @@ case "$target_os" in
;;
darwin*)
CFLAGS="$CFLAGS -pipe -fno-common"
+ MINIOBJS=dmydln.o
;;
os2-emx)
CFLAGS="$CFLAGS -DOS2 -Zmts"
@@ -1317,7 +1600,7 @@ case "$target_os" in
rm -f /tmp/main.o
CFLAGS="$CFLAGS -std"
fi
- ;;
+ ;;
beos*)
case "$target_cpu" in
powerpc*)
@@ -1332,7 +1615,6 @@ case "$target_os" in
LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}.dll
LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
fi
- AC_LIBOBJ([strftime])
;;
mingw*)
RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
@@ -1346,7 +1628,6 @@ case "$target_os" in
COMMON_HEADERS="windows.h winsock.h"
;;
esac
- XCFLAGS="$XCFLAGS"
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
LIBRUBY_ALIASES=''
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
@@ -1375,6 +1656,13 @@ case "$build_os" in
*msdosdjgpp*) FIRSTMAKEFILE=GNUmakefile:djgpp/GNUmakefile.in;;
esac
+CPPFLAGS="$CPPFLAGS "'$(DEFS)'
+test -z "$CFLAGS" || CFLAGS="$CFLAGS "; CFLAGS="$CFLAGS"'${cflags}'
+test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
+AC_SUBST(cppflags, [])dnl
+AC_SUBST(cflags, ['${optflags} ${debugflags}'])dnl
+AC_SUBST(optflags)dnl
+AC_SUBST(debugflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
@@ -1419,37 +1707,53 @@ case "$target_os" in
rubyw_install_name="$RUBYW_INSTALL_NAME"
;;
esac
+RUBY_LIB_PREFIX=`eval echo \\"${libdir}/ruby\\"`
+
+AC_ARG_WITH(sitedir,
+ [ --with-sitedir=DIR site libraries in DIR [[LIBDIR/ruby/site_ruby]]],
+ [sitedir=$withval],
+ [sitedir='${libdir}/ruby/site_ruby'])
+SITE_DIR=`eval echo \\"${sitedir}\\"`
+
case "$target_os" in
cygwin*|mingw*|*djgpp*|os2-emx*)
- RUBY_LIB_PREFIX="/lib/ruby"
+ RUBY_LIB_PREFIX="`eval echo "$RUBY_LIB_PREFIX" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
+ RUBY_SITE_LIB_PATH="`eval echo "$SITE_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
;;
*)
- RUBY_LIB_PREFIX="${prefix}/lib/ruby"
+ RUBY_LIB_PREFIX="`eval echo \\"$RUBY_LIB_PREFIX\\" | sed 's|^NONE/|'"$prefix"'/|'`"
+ RUBY_SITE_LIB_PATH="`eval echo \\"$SITE_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
;;
esac
RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
+RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
-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}\"`"
+AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
+AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
+AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
+
+AC_ARG_WITH(vendordir,
+ [ --with-vendordir=DIR vendor libraries in DIR [[LIBDIR/ruby/vendor_ruby]]],
+ [vendordir=$withval],
+ [vendordir='${libdir}/ruby/vendor_ruby'])
+VENDOR_DIR=`eval echo \\"${vendordir}\\"`
case "$target_os" in
cygwin*|mingw*|*djgpp*|os2-emx*)
- RUBY_SITE_LIB_PATH="`expr "$SITE_DIR" : "$prefix\(/.*\)"`" ||
- RUBY_SITE_LIB_PATH="$SITE_DIR";;
+ RUBY_VENDOR_LIB_PATH="`eval echo "$VENDOR_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
+ ;;
*)
- RUBY_SITE_LIB_PATH="$SITE_DIR";;
+ RUBY_VENDOR_LIB_PATH="`eval echo \\"$VENDOR_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
+ ;;
esac
-RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
+RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${MAJOR}.${MINOR}"
-AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
-AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
-AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(sitedir)dnl
+AC_SUBST(vendordir)dnl
configure_args=$ac_configure_args
AC_SUBST(configure_args)dnl
@@ -1462,6 +1766,8 @@ if test "$fat_binary" != no ; then
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
"${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
+ AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
+ "${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
else
arch="${target_cpu}-${target_os}"
@@ -1469,12 +1775,13 @@ else
fi
case "$target_os" in
- mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
+ mingw*) sitearch="$target_cpu-$rb_cv_msvcrt" ;;
*) sitearch="${arch}" ;;
esac
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${sitearch}")
AC_ARG_WITH(search-path,
[ --with-search-path=DIR specify the additional search path],
@@ -1511,12 +1818,15 @@ else
echo "creating config.h"
tr -d '\015' < confdefs.h > config.h
fi
-: > confdefs.h
+tr -d '\015' < largefile.h > confdefs.h
+rm largefile.h
AC_CONFIG_FILES($FIRSTMAKEFILE)
AC_CONFIG_FILES(Makefile, [{
+ sed '/^MISSING/s/\$U\././g' 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])
+ } >> confmk$$.tmp && mv -f confmk$$.tmp Makefile],
+[RUBY_INSTALL_NAME=$RUBY_INSTALL_NAME EXEEXT=$EXEEXT])
AC_OUTPUT
diff --git a/defines.h b/defines.h
index 0e3c547585..f39097fea4 100644
--- a/defines.h
+++ b/defines.h
@@ -102,6 +102,16 @@ void xfree _((void*));
#endif
#endif
+#if defined(__NeXT__) || defined(__APPLE__)
+/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
+ result in a different endian. Instead trust __BIG_ENDIAN__ and
+ __LITTLE_ENDIAN__ which are set correctly by -arch. */
+#undef WORDS_BIGENDIAN
+#ifdef __BIG_ENDIAN__
+#define WORDS_BIGENDIAN
+#endif
+#endif
+
#ifdef __NeXT__
/* NextStep, OpenStep, Rhapsody */
#ifndef S_IRUSR
@@ -155,13 +165,6 @@ void xfree _((void*));
#ifndef S_ISREG
#define S_ISREG(mode) (((mode) & (0170000)) == (0100000))
#endif
-/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
- result in a different endian. Instead trust __BIG_ENDIAN__ and
- __LITTLE_ENDIAN__ which are set correctly by -arch. */
-#undef WORDS_BIGENDIAN
-#ifdef __BIG_ENDIAN__
-#define WORDS_BIGENDIAN
-#endif
#ifndef __APPLE__
/* NextStep, OpenStep (but not Rhapsody) */
#ifndef GETPGRP_VOID
@@ -191,11 +194,8 @@ 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
@@ -206,6 +206,11 @@ void xfree _((void*));
#define EXTERN RUBY_EXTERN /* deprecated */
#endif
+#ifndef RUBY_MBCHAR_MAXSIZE
+#define RUBY_MBCHAR_MAXSIZE INT_MAX
+ /* MB_CUR_MAX will not work well in C locale */
+#endif
+
#if defined(sparc) || defined(__sparc__)
static inline void
flush_register_windows(void)
@@ -216,21 +221,16 @@ flush_register_windows(void)
#endif
# if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
("flushw")
-# elif defined(linux) || defined(__linux__)
- ("ta 0x83")
-# else /* Solaris, OpenBSD, NetBSD, etc. */
+# else
("ta 0x03")
# endif /* trap always to flush register windows if we are on a Sparc system */
;
}
# 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()
+#elif defined(__ia64)
+void *rb_ia64_bsp(void);
+void rb_ia64_flushrs(void);
+# define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
#else
# define FLUSH_REGISTER_WINDOWS ((void)0)
#endif
@@ -254,6 +254,18 @@ __attribute__ ((noinline))
#define ENV_IGNORECASE
#endif
+#ifndef CASEFOLD_FILESYSTEM
+# if defined DOSISH || defined __VMS
+# define CASEFOLD_FILESYSTEM 1
+# else
+# define CASEFOLD_FILESYSTEM 0
+# endif
+#endif
+
+#ifndef DLEXT_MAXLEN
+#define DLEXT_MAXLEN 4
+#endif
+
#ifndef RUBY_PLATFORM
#define RUBY_PLATFORM "unknown-unknown"
#endif
diff --git a/dir.c b/dir.c
index d058334ac9..c2c3f9452f 100644
--- a/dir.c
+++ b/dir.c
@@ -67,162 +67,283 @@ char *strchr _((char*,char));
#define lstat stat
#endif
+#ifndef CASEFOLD_FILESYSTEM
+# if defined DOSISH || defined __VMS
+# define CASEFOLD_FILESYSTEM 1
+# else
+# define CASEFOLD_FILESYSTEM 0
+# endif
+#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
#define downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c))
+#define compare(c1, c2) (((unsigned char)(c1)) - ((unsigned char)(c2)))
+
+/* caution: in case *p == '\0'
+ Next(p) == p + 1 in single byte environment
+ Next(p) == p in multi byte environment
+*/
+#if defined(CharNext)
+# define Next(p) CharNext(p)
+#elif defined(DJGPP)
+# define Next(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
+#elif defined(__EMX__)
+# define Next(p) ((p) + emx_mblen(p))
+static inline int
+emx_mblen(const char *p)
+{
+ int n = mblen(p, RUBY_MBCHAR_MAXSIZE);
+ return (n < 0) ? 1 : n;
+}
+#endif
-#ifndef CharNext /* defined as CharNext[AW] on Windows. */
-# if defined(DJGPP)
-# define CharNext(p) ((p) + mblen(p, MB_CUR_MAX))
-# else
-# define CharNext(p) ((p) + 1)
-# endif
+#ifndef Next /* single byte environment */
+# define Next(p) ((p) + 1)
+# define Inc(p) (++(p))
+# define Compare(p1, p2) (compare(downcase(*(p1)), downcase(*(p2))))
+#else /* multi byte environment */
+# define Inc(p) ((p) = Next(p))
+# define Compare(p1, p2) (CompareImpl(p1, p2, nocase))
+static int
+CompareImpl(const char *p1, const char *p2, int nocase)
+{
+ const int len1 = Next(p1) - p1;
+ const int len2 = Next(p2) - p2;
+#ifdef _WIN32
+ char buf1[10], buf2[10]; /* large enough? */
#endif
-#if defined DOSISH
-#define isdirsep(c) ((c) == '/' || (c) == '\\')
-#else
-#define isdirsep(c) ((c) == '/')
+ if (len1 < 0 || len2 < 0) {
+ rb_fatal("CompareImpl: negative len");
+ }
+
+ if (len1 == 0) return len2;
+ if (len2 == 0) return -len1;
+
+#ifdef _WIN32
+ if (nocase && rb_w32_iswinnt()) {
+ if (len1 > 1) {
+ if (len1 >= sizeof(buf1)) {
+ rb_fatal("CompareImpl: too large len");
+ }
+ memcpy(buf1, p1, len1);
+ buf1[len1] = '\0';
+ CharLower(buf1);
+ p1 = buf1; /* trick */
+ }
+ if (len2 > 1) {
+ if (len2 >= sizeof(buf2)) {
+ rb_fatal("CompareImpl: too large len");
+ }
+ memcpy(buf2, p2, len2);
+ buf2[len2] = '\0';
+ CharLower(buf2);
+ p2 = buf2; /* trick */
+ }
+ }
#endif
+ if (len1 == 1)
+ if (len2 == 1)
+ return compare(downcase(*p1), downcase(*p2));
+ else {
+ const int ret = compare(downcase(*p1), *p2);
+ return ret ? ret : -1;
+ }
+ else
+ if (len2 == 1) {
+ const int ret = compare(*p1, downcase(*p2));
+ return ret ? ret : 1;
+ }
+ else {
+ const int ret = memcmp(p1, p2, len1 < len2 ? len1 : len2);
+ return ret ? ret : len1 - len2;
+ }
+}
+#endif /* environment */
static char *
-range(pat, test, flags)
- const char *pat;
- int test;
+bracket(p, s, flags)
+ const char *p; /* pattern (next to '[') */
+ const char *s; /* string */
int flags;
{
- int not, ok = 0;
- int nocase = flags & FNM_CASEFOLD;
- int escape = !(flags & FNM_NOESCAPE);
+ const int nocase = flags & FNM_CASEFOLD;
+ const int escape = !(flags & FNM_NOESCAPE);
- not = *pat == '!' || *pat == '^';
- if (not)
- pat++;
+ int ok = 0, not = 0;
- test = downcase(test);
+ if (*p == '!' || *p == '^') {
+ not = 1;
+ p++;
+ }
- while (*pat != ']') {
- int cstart, cend;
- if (escape && *pat == '\\')
- pat++;
- cstart = cend = *pat++;
- if (!cstart)
+ while (*p != ']') {
+ const char *t1 = p;
+ if (escape && *t1 == '\\')
+ t1++;
+ if (!*t1)
return NULL;
- if (*pat == '-' && pat[1] != ']') {
- pat++;
- if (escape && *pat == '\\')
- pat++;
- cend = *pat++;
- if (!cend)
+ p = Next(t1);
+ if (p[0] == '-' && p[1] != ']') {
+ const char *t2 = p + 1;
+ if (escape && *t2 == '\\')
+ t2++;
+ if (!*t2)
return NULL;
+ p = Next(t2);
+ if (!ok && Compare(t1, s) <= 0 && Compare(s, t2) <= 0)
+ ok = 1;
}
- if (downcase(cstart) <= test && test <= downcase(cend))
- ok = 1;
+ else
+ if (!ok && Compare(t1, s) == 0)
+ ok = 1;
}
- return ok == not ? NULL : (char *)pat + 1;
+
+ return ok == not ? NULL : (char *)p + 1;
}
-#define ISDIRSEP(c) (pathname && isdirsep(c))
-#define PERIOD(s) (period && *(s) == '.' && \
- ((s) == string || ISDIRSEP((s)[-1])))
+/* If FNM_PATHNAME is set, only path element will be matched. (upto '/' or '\0')
+ Otherwise, entire string will be matched.
+ End marker itself won't be compared.
+ And if function succeeds, *pcur reaches end marker.
+*/
+#define UNESCAPE(p) (escape && *(p) == '\\' ? (p) + 1 : (p))
+#define ISEND(p) (!*(p) || (pathname && *(p) == '/'))
+#define RETURN(val) return *pcur = p, *scur = s, (val);
+
static int
-fnmatch(pat, string, flags)
- const char *pat;
- const char *string;
+fnmatch_helper(pcur, scur, flags)
+ const char **pcur; /* pattern */
+ const char **scur; /* string */
int flags;
{
- int c;
- int test;
- const char *s = string;
- int escape = !(flags & FNM_NOESCAPE);
- int pathname = flags & FNM_PATHNAME;
- int period = !(flags & FNM_DOTMATCH);
- int nocase = flags & FNM_CASEFOLD;
+ const int period = !(flags & FNM_DOTMATCH);
+ const int pathname = flags & FNM_PATHNAME;
+ const int escape = !(flags & FNM_NOESCAPE);
+ const int nocase = flags & FNM_CASEFOLD;
- while (c = *pat++) {
- switch (c) {
- case '?':
- if (!*s || ISDIRSEP(*s) || PERIOD(s))
- return FNM_NOMATCH;
- s++;
- break;
- case '*':
- while ((c = *pat++) == '*')
- ;
+ const char *ptmp = 0;
+ const char *stmp = 0;
- if (PERIOD(s))
- return FNM_NOMATCH;
+ const char *p = *pcur;
+ const char *s = *scur;
- if (!c) {
- if (pathname && *rb_path_next(s))
- return FNM_NOMATCH;
- else
- return 0;
- }
- else if (ISDIRSEP(c)) {
- s = rb_path_next(s);
- if (*s) {
- s++;
- break;
- }
- return FNM_NOMATCH;
- }
+ if (period && *s == '.' && *UNESCAPE(p) != '.') /* leading period */
+ RETURN(FNM_NOMATCH);
- test = escape && c == '\\' ? *pat : c;
- test = downcase(test);
- pat--;
- while (*s) {
- if ((c == '?' || c == '[' || downcase(*s) == test) &&
- !fnmatch(pat, s, flags | FNM_DOTMATCH))
- return 0;
- else if (ISDIRSEP(*s))
- break;
- s++;
+ while (1) {
+ switch (*p) {
+ case '*':
+ do { p++; } while (*p == '*');
+ if (ISEND(UNESCAPE(p))) {
+ p = UNESCAPE(p);
+ RETURN(0);
}
- return FNM_NOMATCH;
+ if (ISEND(s))
+ RETURN(FNM_NOMATCH);
+ ptmp = p;
+ stmp = s;
+ continue;
- case '[':
- if (!*s || ISDIRSEP(*s) || PERIOD(s))
- return FNM_NOMATCH;
- pat = range(pat, *s, flags);
- if (pat == NULL)
- return FNM_NOMATCH;
- s++;
- break;
+ case '?':
+ if (ISEND(s))
+ RETURN(FNM_NOMATCH);
+ p++;
+ Inc(s);
+ continue;
- case '\\':
- if (escape
-#if defined DOSISH
- && *pat && strchr("*?[]\\", *pat)
-#endif
- ) {
- c = *pat;
- if (!c)
- c = '\\';
- else
- pat++;
+ case '[': {
+ const char *t;
+ if (ISEND(s))
+ RETURN(FNM_NOMATCH);
+ if ((t = bracket(p + 1, s, flags)) != 0) {
+ p = t;
+ Inc(s);
+ continue;
}
- /* FALLTHROUGH */
+ goto failed;
+ }
+ }
- default:
-#if defined DOSISH
- if (ISDIRSEP(c) && isdirsep(*s))
- ;
- else
-#endif
- if(downcase(c) != downcase(*s))
- return FNM_NOMATCH;
- s++;
- break;
+ /* ordinary */
+ p = UNESCAPE(p);
+ if (ISEND(s))
+ RETURN(ISEND(p) ? 0 : FNM_NOMATCH);
+ if (ISEND(p))
+ goto failed;
+ if (Compare(p, s) != 0)
+ goto failed;
+ Inc(p);
+ Inc(s);
+ continue;
+
+ failed: /* try next '*' position */
+ if (ptmp && stmp) {
+ p = ptmp;
+ Inc(stmp); /* !ISEND(*stmp) */
+ s = stmp;
+ continue;
+ }
+ RETURN(FNM_NOMATCH);
+ }
+}
+
+static int
+fnmatch(p, s, flags)
+ const char *p; /* pattern */
+ const char *s; /* string */
+ int flags;
+{
+ const int period = !(flags & FNM_DOTMATCH);
+ const int pathname = flags & FNM_PATHNAME;
+
+ const char *ptmp = 0;
+ const char *stmp = 0;
+
+ if (pathname) {
+ while (1) {
+ if (p[0] == '*' && p[1] == '*' && p[2] == '/') {
+ do { p += 3; } while (p[0] == '*' && p[1] == '*' && p[2] == '/');
+ ptmp = p;
+ stmp = s;
+ }
+ if (fnmatch_helper(&p, &s, flags) == 0) {
+ while (*s && *s != '/') Inc(s);
+ if (*p && *s) {
+ p++;
+ s++;
+ continue;
+ }
+ if (!*p && !*s)
+ return 0;
+ }
+ /* failed : try next recursion */
+ if (ptmp && stmp && !(period && *stmp == '.')) {
+ while (*stmp && *stmp != '/') Inc(stmp);
+ if (*stmp) {
+ p = ptmp;
+ stmp++;
+ s = stmp;
+ continue;
+ }
+ }
+ return FNM_NOMATCH;
}
}
- return !*s ? 0 : FNM_NOMATCH;
+ else
+ return fnmatch_helper(&p, &s, flags);
}
VALUE rb_cDir;
@@ -325,13 +446,46 @@ 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)
/*
* call-seq:
+ * dir.inspect => string
+ *
+ * Return a string describing this Dir object.
+ */
+static VALUE
+dir_inspect(dir)
+ VALUE dir;
+{
+ struct dir_data *dirp;
+
+ Data_Get_Struct(dir, struct dir_data, dirp);
+ if (dirp->path) {
+ const char *c = rb_obj_classname(dir);
+ int len = strlen(c) + strlen(dirp->path) + 4;
+ VALUE s = rb_str_new(0, len);
+ snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
+ return s;
+ }
+ return rb_funcall(dir, rb_intern("to_s"), 0, 0);
+}
+
+/*
+ * call-seq:
* dir.path => string or nil
*
* Returns the path parameter passed to <em>dir</em>'s constructor.
@@ -345,7 +499,7 @@ dir_path(dir)
{
struct dir_data *dirp;
- GetDIR(dir, dirp);
+ Data_Get_Struct(dir, struct dir_data, dirp);
if (!dirp->path) return Qnil;
return rb_str_new2(dirp->path);
}
@@ -408,6 +562,7 @@ dir_each(dir)
struct dir_data *dirp;
struct dirent *dp;
+ RETURN_ENUMERATOR(dir, 0, 0);
GetDIR(dir, dirp);
rewinddir(dirp->dir);
for (dp = readdir(dirp->dir); dp != NULL; dp = readdir(dirp->dir)) {
@@ -515,6 +670,9 @@ dir_rewind(dir)
{
struct dir_data *dirp;
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(dir)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't close");
+ }
GetDIR(dir, dirp);
rewinddir(dirp->dir);
return dir;
@@ -786,97 +944,259 @@ dir_s_rmdir(obj, dir)
return INT2FIX(0);
}
-#define GLOB_VERBOSE (1 << (sizeof(int) * CHAR_BIT - 1))
+static void
+sys_warning_1(mesg)
+ const char* mesg;
+{
+ rb_sys_warning("%s", mesg);
+}
+
+#define GLOB_VERBOSE (1UL << (sizeof(int) * CHAR_BIT - 1))
#define sys_warning(val) \
- ((flags & GLOB_VERBOSE) && rb_protect((VALUE (*)_((VALUE)))rb_sys_warning, (VALUE)(val), 0))
+ (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_JUMP_TAG(status) ((status == -1) ? rb_memerror() : rb_jump_tag(status))
+
+/*
+ * ENOTDIR can be returned by stat(2) if a non-leaf element of the path
+ * is not a directory.
+ */
+#define to_be_ignored(e) ((e) == ENOENT || (e) == ENOTDIR)
+
+/* System call with warning */
+static int
+do_stat(const char *path, struct stat *pst, int flags)
+
+{
+ int ret = stat(path, pst);
+ if (ret < 0 && !to_be_ignored(errno))
+ sys_warning(path);
+
+ return ret;
+}
+
+static int
+do_lstat(const char *path, struct stat *pst, int flags)
+{
+ int ret = lstat(path, pst);
+ if (ret < 0 && !to_be_ignored(errno))
+ sys_warning(path);
+
+ return ret;
+}
+
+static DIR *
+do_opendir(const char *path, int flags)
+{
+ DIR *dirp = opendir(path);
+ if (dirp == NULL && !to_be_ignored(errno))
+ sys_warning(path);
+
+ return dirp;
+}
/* Return nonzero if S has any special globbing chars in it. */
static int
-has_magic(s, send, flags)
- const char *s, *send;
+has_magic(s, flags)
+ const char *s;
int flags;
{
+ const int escape = !(flags & FNM_NOESCAPE);
+ const int nocase = flags & FNM_CASEFOLD;
+
register const char *p = s;
register char c;
- int open = 0;
- int escape = !(flags & FNM_NOESCAPE);
- while ((c = *p++) != '\0') {
+ while ((c = *p++) != 0) {
switch (c) {
- case '?':
case '*':
- return Qtrue;
+ case '?':
+ case '[':
+ return 1;
- case '[': /* Only accept an open brace if there is a close */
- open++; /* brace to match it. Bracket expressions must be */
- continue; /* complete, according to Posix.2 */
- case ']':
- if (open)
- return Qtrue;
+ case '\\':
+ if (escape && !(c = *p++))
+ return 0;
continue;
- case '\\':
- if (escape && *p++ == '\0')
- return Qfalse;
+ default:
+ if (!FNM_SYSCASE && ISALPHA(c) && nocase)
+ return 1;
}
- if (send && p >= send) break;
+ p = Next(p-1);
}
- return Qfalse;
+
+ return 0;
}
-static char*
-extract_path(p, pend)
- const char *p, *pend;
+/* Find separator in globbing pattern. */
+static char *
+find_dirsep(const char *s, int flags)
{
- char *alloc;
- int len;
-
- len = pend - p;
- alloc = ALLOC_N(char, len+1);
- memcpy(alloc, p, len);
- if (len > 1 && pend[-1] == '/'
-#if defined DOSISH_DRIVE_LETTER
- && pend[-2] != ':'
-#endif
- ) {
- alloc[len-1] = 0;
- }
- else {
- alloc[len] = 0;
- }
+ const int escape = !(flags & FNM_NOESCAPE);
- return alloc;
-}
+ register const char *p = s;
+ register char c;
+ int open = 0;
-static char*
-extract_elem(path)
- const char *path;
-{
- const char *pend;
+ while ((c = *p++) != 0) {
+ switch (c) {
+ case '[':
+ open = 1;
+ continue;
+ case ']':
+ open = 0;
+ continue;
- pend = strchr(path, '/');
- if (!pend) pend = path + strlen(path);
+ case '/':
+ if (!open)
+ return (char *)p-1;
+ continue;
+
+ case '\\':
+ if (escape && !(c = *p++))
+ return (char *)p-1;
+ continue;
+ }
- return extract_path(path, pend);
+ p = Next(p-1);
+ }
+
+ return (char *)p-1;
}
+/* Remove escaping backslashes */
static void
remove_backslashes(p)
char *p;
{
- char *pend = p + strlen(p);
char *t = p;
+ char *s = p;
- while (p < pend) {
+ while (*p) {
if (*p == '\\') {
- if (++p == pend) break;
+ if (t != s)
+ memmove(t, s, p - s);
+ t += p - s;
+ s = ++p;
+ if (!*p) break;
}
- *t++ = *p++;
+ Inc(p);
}
- *t = '\0';
+
+ while (*p++);
+
+ if (t != s)
+ memmove(t, s, p - s); /* move '\0' too */
}
+/* Globing pattern */
+enum glob_pattern_type { PLAIN, MAGICAL, RECURSIVE, MATCH_ALL, MATCH_DIR };
+
+struct glob_pattern {
+ char *str;
+ enum glob_pattern_type type;
+ struct glob_pattern *next;
+};
+
+static void glob_free_pattern(struct glob_pattern *list);
+
+static struct glob_pattern *
+glob_make_pattern(const char *p, int flags)
+{
+ struct glob_pattern *list, *tmp, **tail = &list;
+ int dirsep = 0; /* pattern is terminated with '/' */
+
+ while (*p) {
+ tmp = GLOB_ALLOC(struct glob_pattern);
+ if (!tmp) goto error;
+ if (p[0] == '*' && p[1] == '*' && p[2] == '/') {
+ /* fold continuous RECURSIVEs (needed in glob_helper) */
+ do { p += 3; } while (p[0] == '*' && p[1] == '*' && p[2] == '/');
+ tmp->type = RECURSIVE;
+ tmp->str = 0;
+ dirsep = 1;
+ }
+ else {
+ const char *m = find_dirsep(p, flags);
+ char *buf = GLOB_ALLOC_N(char, m-p+1);
+ if (!buf) {
+ free(tmp);
+ goto error;
+ }
+ memcpy(buf, p, m-p);
+ buf[m-p] = '\0';
+ tmp->type = has_magic(buf, flags) ? MAGICAL : PLAIN;
+ tmp->str = buf;
+ if (*m) {
+ dirsep = 1;
+ p = m + 1;
+ }
+ else {
+ dirsep = 0;
+ p = m;
+ }
+ }
+ *tail = tmp;
+ tail = &tmp->next;
+ }
+
+ tmp = GLOB_ALLOC(struct glob_pattern);
+ if (!tmp) {
+ error:
+ *tail = 0;
+ glob_free_pattern(list);
+ return 0;
+ }
+ tmp->type = dirsep ? MATCH_DIR : MATCH_ALL;
+ tmp->str = 0;
+ *tail = tmp;
+ tmp->next = 0;
+
+ return list;
+}
+
+static void
+glob_free_pattern(struct glob_pattern *list)
+{
+ while (list) {
+ struct glob_pattern *tmp = list;
+ list = list->next;
+ if (tmp->str)
+ free(tmp->str);
+ free(tmp);
+ }
+}
+
+static char *
+join_path(const char *path, int dirsep, const char *name)
+{
+ long len = strlen(path);
+ char *buf = GLOB_ALLOC_N(char, len+strlen(name)+(dirsep?1:0)+1);
+
+ if (!buf) return 0;
+ memcpy(buf, path, len);
+ if (dirsep) {
+ strcpy(buf+len, "/");
+ len++;
+ }
+ strcpy(buf+len, name);
+ return buf;
+}
+
+enum answer { YES, NO, UNKNOWN };
+
+#ifndef S_ISLNK
+# ifndef S_IFLNK
+# define S_ISLNK(m) (0)
+# else
+# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
+# endif
+#endif
+
#ifndef S_ISDIR
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
@@ -901,203 +1221,239 @@ glob_func_caller(val)
#define glob_call_func(func, path, arg) (*func)(path, arg)
-static int glob_helper _((const char *path, const char *sub, int flags, int (*func)(const char *,VALUE), VALUE arg));
+static int glob_helper _((const char *, int, enum answer, enum answer, struct glob_pattern **, struct glob_pattern **, int, ruby_glob_func *, VALUE));
static int
-glob_helper(path, sub, flags, func, arg)
+glob_helper(path, dirsep, exist, isdir, beg, end, flags, func, arg)
const char *path;
- const char *sub;
+ int dirsep; /* '/' should be placed before appending child entry's name to 'path'. */
+ enum answer exist; /* Does 'path' indicate an existing entry? */
+ enum answer isdir; /* Does 'path' indicate a directory or a symlink to a directory? */
+ struct glob_pattern **beg;
+ struct glob_pattern **end;
int flags;
- int (*func) _((const char *, VALUE));
+ ruby_glob_func *func;
VALUE arg;
{
struct stat st;
- const char *p, *m;
int status = 0;
- char *buf = 0;
- char *newpath = 0;
+ struct glob_pattern **cur, **new_beg, **new_end;
+ int plain = 0, magical = 0, recursive = 0, match_all = 0, match_dir = 0;
+ int escape = !(flags & FNM_NOESCAPE);
- p = sub ? sub : path;
- if (!has_magic(p, 0, flags)) {
- if (
-#if defined DOSISH
- TRUE
-#else
- !(flags & FNM_NOESCAPE)
-#endif
- )
- {
- newpath = strdup(path);
- if (sub) {
- p = newpath + (sub - path);
- remove_backslashes(newpath + (sub - path));
- sub = p;
+ for (cur = beg; cur < end; ++cur) {
+ struct glob_pattern *p = *cur;
+ if (p->type == RECURSIVE) {
+ recursive = 1;
+ p = p->next;
+ }
+ switch (p->type) {
+ case PLAIN:
+ plain = 1;
+ break;
+ case MAGICAL:
+ magical = 1;
+ break;
+ case MATCH_ALL:
+ match_all = 1;
+ break;
+ case MATCH_DIR:
+ match_dir = 1;
+ break;
+ case RECURSIVE:
+ rb_bug("continuous RECURSIVEs");
+ }
+ }
+
+ if (*path) {
+ if (match_all && exist == UNKNOWN) {
+ if (do_lstat(path, &st, flags) == 0) {
+ exist = YES;
+ isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;
}
else {
- remove_backslashes(newpath);
- p = path = newpath;
+ exist = NO;
+ isdir = NO;
}
}
- if (lstat(path, &st) == 0) {
+ if (match_dir && isdir == UNKNOWN) {
+ if (do_stat(path, &st, flags) == 0) {
+ exist = YES;
+ isdir = S_ISDIR(st.st_mode) ? YES : NO;
+ }
+ else {
+ exist = NO;
+ isdir = NO;
+ }
+ }
+ if (match_all && exist == YES) {
status = glob_call_func(func, path, 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);
+ if (match_dir && isdir == YES) {
+ char *tmp = join_path(path, dirsep, "");
+ if (!tmp) return -1;
+ status = glob_call_func(func, tmp, arg);
+ free(tmp);
+ if (status) return status;
}
- xfree(newpath);
- return status;
}
- while (p && !status) {
- if (*p == '/') p++;
- m = strchr(p, '/');
- if (has_magic(p, m, flags)) {
- char *dir, *base, *magic;
- DIR *dirp;
- struct dirent *dp;
- int recursive = 0;
-
- struct d_link {
- char *path;
- struct d_link *next;
- } *tmp, *link, **tail = &link;
-
- base = extract_path(path, p);
- if (path == p) dir = ".";
- else dir = base;
-
- magic = extract_elem(p);
- if (stat(dir, &st) < 0) {
- if (errno != ENOENT)
- sys_warning(dir);
- free(base);
- free(magic);
- break;
- }
- if (S_ISDIR(st.st_mode)) {
- if (m && strcmp(magic, "**") == 0) {
- int n = strlen(base);
- recursive = 1;
- REALLOC_N(buf, char, n+strlen(m)+3);
- sprintf(buf, "%s%s", base, *base ? m : m+1);
- status = glob_helper(buf, buf+n, flags, func, arg);
- if (status) goto finalize;
- }
- dirp = opendir(dir);
- if (dirp == NULL) {
- sys_warning(dir);
- free(base);
- free(magic);
- break;
- }
- }
- else {
- free(base);
- free(magic);
+ if (exist == NO || isdir == NO) return 0;
+
+ if (magical || recursive) {
+ struct dirent *dp;
+ DIR *dirp = do_opendir(*path ? path : ".", flags);
+ if (dirp == NULL) return 0;
+
+ for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
+ char *buf = join_path(path, dirsep, dp->d_name);
+ enum answer new_isdir = UNKNOWN;
+
+ if (!buf) {
+ status = -1;
break;
}
-
-#if defined DOSISH_DRIVE_LETTER
-#define BASE (*base && !((isdirsep(*base) && !base[1]) || (base[1] == ':' && isdirsep(base[2]) && !base[3])))
+ if (recursive && strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0
+ && fnmatch("*", dp->d_name, flags) == 0) {
+#ifndef _WIN32
+ if (do_lstat(buf, &st, flags) == 0)
+ new_isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;
+ else
+ new_isdir = NO;
#else
-#define BASE (*base && !(isdirsep(*base) && !base[1]))
+ new_isdir = dp->d_isdir ? (!dp->d_isrep ? YES : UNKNOWN) : NO;
#endif
+ }
- for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
- if (recursive) {
- if (strcmp(".", dp->d_name) == 0 || strcmp("..", dp->d_name) == 0)
- continue;
- if (fnmatch("*", dp->d_name, flags) != 0)
- continue;
- REALLOC_N(buf, char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
- sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
- if (lstat(buf, &st) < 0) {
- if (errno != ENOENT)
- sys_warning(buf);
- continue;
- }
- if (S_ISDIR(st.st_mode)) {
- char *t = buf+strlen(buf);
- strcpy(t, "/**");
- strcpy(t+3, m);
- status = glob_helper(buf, t, flags, func, arg);
- if (status) break;
- continue;
- }
- continue;
+ new_beg = new_end = GLOB_ALLOC_N(struct glob_pattern *, (end - beg) * 2);
+ if (!new_beg) {
+ status = -1;
+ break;
+ }
+
+ for (cur = beg; cur < end; ++cur) {
+ struct glob_pattern *p = *cur;
+ if (p->type == RECURSIVE) {
+ if (new_isdir == YES) /* not symlink but real directory */
+ *new_end++ = p; /* append recursive pattern */
+ p = p->next; /* 0 times recursion */
}
- if (fnmatch(magic, dp->d_name, flags) == 0) {
- REALLOC_N(buf, char, strlen(base)+NAMLEN(dp)+2);
- sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
- if (!m) {
- status = glob_call_func(func, buf, arg);
- if (status) break;
- continue;
- }
- tmp = ALLOC(struct d_link);
- tmp->path = buf;
- buf = 0;
- *tail = tmp;
- tail = &tmp->next;
+ if (p->type == PLAIN || p->type == MAGICAL) {
+ if (fnmatch(p->str, dp->d_name, flags) == 0)
+ *new_end++ = p->next;
}
}
- closedir(dirp);
- finalize:
- *tail = 0;
- free(base);
- free(magic);
- if (link) {
- while (link) {
- if (status == 0) {
- if (stat(link->path, &st) == 0) {
- if (S_ISDIR(st.st_mode)) {
- int len = strlen(link->path);
- int mlen = strlen(m);
-
- REALLOC_N(buf, char, len+mlen+1);
- sprintf(buf, "%s%s", link->path, m);
- status = glob_helper(buf, buf+len, flags, func, arg);
- }
- }
- else {
- sys_warning(link->path);
- }
+
+ status = glob_helper(buf, 1, YES, new_isdir, new_beg, new_end, flags, func, arg);
+ free(buf);
+ free(new_beg);
+ if (status) break;
+ }
+
+ closedir(dirp);
+ }
+ else if (plain) {
+ struct glob_pattern **copy_beg, **copy_end, **cur2;
+
+ copy_beg = copy_end = GLOB_ALLOC_N(struct glob_pattern *, end - beg);
+ if (!copy_beg) return -1;
+ for (cur = beg; cur < end; ++cur)
+ *copy_end++ = (*cur)->type == PLAIN ? *cur : 0;
+
+ for (cur = copy_beg; cur < copy_end; ++cur) {
+ if (*cur) {
+ char *buf;
+ char *name;
+ name = GLOB_ALLOC_N(char, strlen((*cur)->str) + 1);
+ if (!name) {
+ status = -1;
+ break;
+ }
+ strcpy(name, (*cur)->str);
+ if (escape) remove_backslashes(name);
+
+ new_beg = new_end = GLOB_ALLOC_N(struct glob_pattern *, end - beg);
+ if (!new_beg) {
+ free(name);
+ status = -1;
+ break;
+ }
+ *new_end++ = (*cur)->next;
+ for (cur2 = cur + 1; cur2 < copy_end; ++cur2) {
+ if (*cur2 && fnmatch((*cur2)->str, name, flags) == 0) {
+ *new_end++ = (*cur2)->next;
+ *cur2 = 0;
}
- tmp = link;
- link = link->next;
- free(tmp->path);
- free(tmp);
}
- break;
+
+ buf = join_path(path, dirsep, name);
+ free(name);
+ if (!buf) {
+ free(new_beg);
+ status = -1;
+ break;
+ }
+ status = glob_helper(buf, 1, UNKNOWN, UNKNOWN, new_beg, new_end, flags, func, arg);
+ free(buf);
+ free(new_beg);
+ if (status) break;
}
}
- p = m;
+
+ free(copy_beg);
}
- xfree(buf);
- xfree(newpath);
+
return status;
}
-int
-ruby_glob(path, flags, func, arg)
+static int
+ruby_glob0(path, flags, func, arg)
const char *path;
int flags;
- int (*func) _((const char *, VALUE));
+ ruby_glob_func *func;
VALUE arg;
{
- return glob_helper(path, 0, flags & ~GLOB_VERBOSE, func, arg);
+ struct glob_pattern *list;
+ const char *root, *start;
+ char *buf;
+ int n;
+ int status;
+
+ start = root = path;
+ flags |= FNM_SYSCASE;
+#if defined DOSISH
+ root = rb_path_skip_prefix(root);
+#endif
+
+ if (root && *root == '/') root++;
+
+ n = root - start;
+ buf = GLOB_ALLOC_N(char, n + 1);
+ if (!buf) return -1;
+ MEMCPY(buf, start, char, n);
+ buf[n] = '\0';
+
+ list = glob_make_pattern(root, flags);
+ if (!list) {
+ free(buf);
+ return -1;
+ }
+ status = glob_helper(buf, 0, UNKNOWN, UNKNOWN, &list, &list + 1, flags, func, arg);
+ glob_free_pattern(list);
+ free(buf);
+
+ return status;
}
int
-ruby_globi(path, flags, func, arg)
+ruby_glob(path, flags, func, arg)
const char *path;
int flags;
- int (*func) _((const char *, VALUE));
+ ruby_glob_func *func;
VALUE arg;
{
- return glob_helper(path, 0, flags | FNM_CASEFOLD, func, arg);
+ return ruby_glob0(path, flags & ~GLOB_VERBOSE, func, arg);
}
static int rb_glob_caller _((const char *, VALUE));
@@ -1127,7 +1483,11 @@ rb_glob2(path, flags, func, arg)
args.func = func;
args.v = arg;
- return glob_helper(path, 0, flags | GLOB_VERBOSE, rb_glob_caller, (VALUE)&args);
+ if (flags & FNM_SYSCASE) {
+ rb_warning("Dir.glob() ignores File::FNM_CASEFOLD");
+ }
+
+ return ruby_glob0(path, flags | GLOB_VERBOSE, rb_glob_caller, (VALUE)&args);
}
void
@@ -1137,19 +1497,10 @@ rb_glob(path, func, arg)
VALUE arg;
{
int status = rb_glob2(path, 0, func, arg);
- if (status) rb_jump_tag(status);
-}
-
-void
-rb_globi(path, func, arg)
- const char *path;
- void (*func) _((const char*, VALUE));
- VALUE arg;
-{
- int status = rb_glob2(path, FNM_CASEFOLD, func, arg);
- if (status) rb_jump_tag(status);
+ if (status) GLOB_JUMP_TAG(status);
}
+static void push_pattern _((const char* path, VALUE ary));
static void
push_pattern(path, ary)
const char *path;
@@ -1158,150 +1509,196 @@ push_pattern(path, ary)
rb_ary_push(ary, rb_tainted_str_new2(path));
}
-static int
-push_globs(ary, s, flags)
- VALUE ary;
- const char *s;
- int flags;
-{
- return rb_glob2(s, flags, push_pattern, ary);
-}
-
-static int
-push_braces(ary, str, flags)
- VALUE ary;
+int
+ruby_brace_expand(str, flags, func, arg)
const char *str;
int flags;
+ ruby_glob_func *func;
+ VALUE arg;
{
- char *buf = 0;
- char *b;
- const char *s, *p, *t;
- const char *lbrace, *rbrace;
- int nest = 0;
- int status = 0;
+ const int escape = !(flags & FNM_NOESCAPE);
+ const char *p = str;
+ const char *s = p;
+ const char *lbrace = 0, *rbrace = 0;
+ int nest = 0, status = 0;
- s = p = str;
- lbrace = rbrace = 0;
while (*p) {
- if (*p == '{') {
+ if (*p == '{' && nest++ == 0) {
lbrace = p;
- break;
}
- p++;
- }
- while (*p) {
- if (*p == '{') nest++;
- if (*p == '}' && --nest == 0) {
+ if (*p == '}' && --nest <= 0) {
rbrace = p;
break;
}
- p++;
+ if (*p == '\\' && escape) {
+ if (!*++p) break;
+ }
+ Inc(p);
}
if (lbrace && rbrace) {
- int len = strlen(s);
+ char *buf = GLOB_ALLOC_N(char, strlen(s) + 1);
+ long shift;
+
+ if (!buf) return -1;
+ memcpy(buf, s, lbrace-s);
+ shift = (lbrace-s);
p = lbrace;
- while (*p != '}') {
- t = p + 1;
- for (p = t; *p!='}' && *p!=','; p++) {
- /* skip inner braces */
- if (*p == '{') {
- nest = 1;
- while (*++p != '}' || --nest) {
- if (*p == '{') nest++;
- }
+ while (p < rbrace) {
+ const char *t = ++p;
+ nest = 0;
+ while (p < rbrace && !(*p == ',' && nest == 0)) {
+ if (*p == '{') nest++;
+ if (*p == '}') nest--;
+ if (*p == '\\' && escape) {
+ if (++p == rbrace) break;
}
+ Inc(p);
}
- REALLOC_N(buf, char, len+1);
- memcpy(buf, s, lbrace-s);
- b = buf + (lbrace-s);
- memcpy(b, t, p-t);
- strcpy(b+(p-t), rbrace+1);
- status = push_braces(ary, buf, flags);
+ memcpy(buf+shift, t, p-t);
+ strcpy(buf+shift+(p-t), rbrace+1);
+ status = ruby_brace_expand(buf, flags, func, arg);
if (status) break;
}
+ free(buf);
}
- else {
- status = push_globs(ary, str, flags);
+ else if (!lbrace && !rbrace) {
+ status = (*func)(s, arg);
}
- xfree(buf);
return status;
}
-#define isdelim(c) ((c)=='\0')
+struct brace_args {
+ ruby_glob_func *func;
+ VALUE value;
+ int flags;
+};
+
+static int glob_brace _((const char *, VALUE));
+static int
+glob_brace(path, val)
+ const char *path;
+ VALUE val;
+{
+ struct brace_args *arg = (struct brace_args *)val;
+
+ return ruby_glob0(path, arg->flags, arg->func, arg->value);
+}
+
+static int
+ruby_brace_glob0(str, flags, func, arg)
+ const char *str;
+ int flags;
+ ruby_glob_func *func;
+ VALUE arg;
+{
+ struct brace_args args;
+
+ args.func = func;
+ args.value = arg;
+ args.flags = flags;
+ return ruby_brace_expand(str, flags, glob_brace, (VALUE)&args);
+}
+
+int
+ruby_brace_glob(str, flags, func, arg)
+ const char *str;
+ int flags;
+ ruby_glob_func *func;
+ VALUE arg;
+{
+ return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg);
+}
+
+static int
+push_glob(VALUE ary, const char *str, int flags)
+{
+ struct glob_args args;
+
+ args.func = push_pattern;
+ args.v = ary;
+ return ruby_brace_glob0(str, flags | GLOB_VERBOSE, rb_glob_caller, (VALUE)&args);
+}
static VALUE
-rb_push_glob(str, flags)
+rb_push_glob(str, flags) /* '\0' is delimiter */
VALUE str;
int flags;
{
- const char *p, *pend, *buf;
- int nest, maxnest;
- int status = 0;
- int noescape = flags & FNM_NOESCAPE;
+ long offset = 0;
VALUE ary;
ary = rb_ary_new();
SafeStringValue(str);
- p = RSTRING(str)->ptr;
- pend = p + RSTRING(str)->len;
-
- while (p < pend) {
- 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;
- }
+
+ while (offset < RSTRING_LEN(str)) {
+ int status = push_glob(ary, RSTRING(str)->ptr + offset, flags);
+ char *p, *pend;
+ if (status) GLOB_JUMP_TAG(status);
+ if (offset >= RSTRING_LEN(str)) break;
+ p = RSTRING(str)->ptr + offset;
+ p += strlen(p) + 1;
+ pend = RSTRING(str)->ptr + RSTRING_LEN(str);
+ while (p < pend && !*p)
p++;
- }
- if (maxnest == 0) {
- status = push_globs(ary, buf, flags);
- if (status) break;
- }
- else if (nest == 0) {
- status = push_braces(ary, buf, flags);
- if (status) break;
- }
- /* else unmatched braces */
+ offset = p - RSTRING(str)->ptr;
}
- if (status) rb_jump_tag(status);
- if (rb_block_given_p()) {
- rb_ary_each(ary);
- return Qnil;
+
+ return ary;
+}
+
+static VALUE
+dir_globs(argc, argv, flags)
+ long argc;
+ VALUE *argv;
+ int flags;
+{
+ VALUE ary = rb_ary_new();
+ long i;
+
+ for (i = 0; i < argc; ++i) {
+ int status;
+ VALUE str = argv[i];
+ StringValue(str);
+ status = push_glob(ary, RSTRING(str)->ptr, flags);
+ if (status) GLOB_JUMP_TAG(status);
}
+
return ary;
}
/*
* call-seq:
- * Dir[ string ] => array
+ * Dir[ array ] => array
+ * Dir[ string [, string ...] ] => array
*
* Equivalent to calling
- * <em>dir</em>.<code>glob(</code><i>string,</i><code>0)</code>.
+ * <code>Dir.glob(</code><i>array,</i><code>0)</code> and
+ * <code>Dir.glob([</code><i>string,...</i><code>],0)</code>.
*
*/
static VALUE
-dir_s_aref(obj, str)
- VALUE obj, str;
-{
- return rb_push_glob(str, 0);
-}
+dir_s_aref(int argc, VALUE *argv, VALUE obj)
+ {
+ if (argc == 1) {
+ return rb_push_glob(argv[0], 0);
+ }
+ return dir_globs(argc, argv, 0);
+ }
/*
* call-seq:
- * Dir.glob( string, [flags] ) => array
- * Dir.glob( string, [flags] ) {| filename | block } => nil
+ * Dir.glob( pattern, [flags] ) => array
+ * Dir.glob( pattern, [flags] ) {| filename | block } => nil
*
- * 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.
+ * Returns the filenames found by expanding <i>pattern</i> which is
+ * an +Array+ of the patterns or the pattern +String+, 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. Note that case sensitivity depends on your system (so
+ * <code>File::FNM_CASEFOLD</code> is ignored)
*
* <code>*</code>:: Matches any file. Can be restricted by
* other values in the glob. <code>*</code>
@@ -1356,7 +1753,7 @@ dir_s_glob(argc, argv, obj)
VALUE *argv;
VALUE obj;
{
- VALUE str, rflags;
+ VALUE str, rflags, ary;
int flags;
if (rb_scan_args(argc, argv, "11", &str, &rflags) == 2)
@@ -1364,7 +1761,20 @@ dir_s_glob(argc, argv, obj)
else
flags = 0;
- return rb_push_glob(str, flags);
+ ary = rb_check_array_type(str);
+ if (NIL_P(ary)) {
+ ary = rb_push_glob(str, flags);
+ }
+ else {
+ volatile VALUE v = ary;
+ ary = dir_globs(RARRAY_LEN(v), RARRAY_PTR(v), flags);
+ }
+
+ if (rb_block_given_p()) {
+ rb_ary_each(ary);
+ return Qnil;
+ }
+ return ary;
}
static VALUE
@@ -1405,6 +1815,7 @@ dir_foreach(io, dirname)
{
VALUE dir;
+ RETURN_ENUMERATOR(io, 1, &dirname);
dir = dir_open_dir(dirname);
rb_ensure(dir_each, dir, dir_close, dir);
return Qnil;
@@ -1451,6 +1862,8 @@ dir_entries(io, dirname)
* have <code>c</code> in them (including at
* the beginning or end). Equivalent to
* <code>/ .* /x</code> in regexp.
+ * <code>**</code>:: Matches directories recursively or files
+ * expansively.
* <code>?</code>:: Matches any one character. Equivalent to
* <code>/.{1}/</code> in regexp.
* <code>[set]</code>:: Matches any one character in +set+.
@@ -1463,31 +1876,52 @@ dir_entries(io, dirname)
* parameters. The same glob pattern and flags are used by
* <code>Dir::glob</code>.
*
- * File.fnmatch('cat', 'cat') #=> true
- * File.fnmatch('cat', 'category') #=> false
- * File.fnmatch('c{at,ub}s', 'cats') #=> false
- * File.fnmatch('c{at,ub}s', 'cubs') #=> false
- * File.fnmatch('c{at,ub}s', 'cat') #=> false
+ * File.fnmatch('cat', 'cat') #=> true : match entire string
+ * File.fnmatch('cat', 'category') #=> false : only match partial string
+ * File.fnmatch('c{at,ub}s', 'cats') #=> false : { } isn't supported
+ *
+ * File.fnmatch('c?t', 'cat') #=> true : '?' match only 1 character
+ * File.fnmatch('c??t', 'cat') #=> false : ditto
+ * File.fnmatch('c*', 'cats') #=> true : '*' match 0 or more characters
+ * File.fnmatch('c*t', 'c/a/b/t') #=> true : ditto
+ * File.fnmatch('ca[a-z]', 'cat') #=> true : inclusive bracket expression
+ * File.fnmatch('ca[^t]', 'cat') #=> false : exclusive bracket expression ('^' or '!')
+ *
+ * File.fnmatch('cat', 'CAT') #=> false : case sensitive
+ * File.fnmatch('cat', 'CAT', File::FNM_CASEFOLD) #=> true : case insensitive
+ *
+ * File.fnmatch('?', '/', File::FNM_PATHNAME) #=> false : wildcard doesn't match '/' on FNM_PATHNAME
+ * File.fnmatch('*', '/', File::FNM_PATHNAME) #=> false : ditto
+ * File.fnmatch('[/]', '/', File::FNM_PATHNAME) #=> false : ditto
+ *
+ * File.fnmatch('\?', '?') #=> true : escaped wildcard becomes ordinary
+ * File.fnmatch('\a', 'a') #=> true : escaped ordinary remains ordinary
+ * File.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true : FNM_NOESACPE makes '\' ordinary
+ * File.fnmatch('[\?]', '?') #=> true : can escape inside bracket expression
+ *
+ * File.fnmatch('*', '.profile') #=> false : wildcard doesn't match leading
+ * File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true period by default.
+ * File.fnmatch('.*', '.profile') #=> true
+ *
+ * rbfiles = '**' '/' '*.rb' # you don't have to do like this. just write in single string.
+ * File.fnmatch(rbfiles, 'main.rb') #=> false
+ * File.fnmatch(rbfiles, './main.rb') #=> false
+ * File.fnmatch(rbfiles, 'lib/song.rb') #=> true
+ * File.fnmatch('**.rb', 'main.rb') #=> true
+ * File.fnmatch('**.rb', './main.rb') #=> false
+ * File.fnmatch('**.rb', 'lib/song.rb') #=> true
+ * File.fnmatch('*', 'dave/.profile') #=> true
*
- * File.fnmatch('c?t', 'cat') #=> true
- * File.fnmatch('c\?t', 'cat') #=> false
- * File.fnmatch('c??t', 'cat') #=> false
- * File.fnmatch('c*', 'cats') #=> true
- * File.fnmatch('c/ * FIXME * /t', 'c/a/b/c/t') #=> true
- * File.fnmatch('c*t', 'cat') #=> true
- * File.fnmatch('c\at', 'cat') #=> true
- * File.fnmatch('c\at', 'cat', File::FNM_NOESCAPE) #=> false
- * File.fnmatch('a?b', 'a/b') #=> true
- * File.fnmatch('a?b', 'a/b', File::FNM_PATHNAME) #=> false
+ * pattern = '*' '/' '*'
+ * File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME) #=> false
+ * File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
*
- * File.fnmatch('*', '.profile') #=> false
- * File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true
- * File.fnmatch('*', 'dave/.profile') #=> true
- * File.fnmatch('*', 'dave/.profile', File::FNM_DOTMATCH) #=> true
- * File.fnmatch('*', 'dave/.profile', File::FNM_PATHNAME) #=> false
- * File.fnmatch('* / FIXME *', 'dave/.profile', File::FNM_PATHNAME) #=> false
- * STRICT = File::FNM_PATHNAME | File::FNM_DOTMATCH
- * File.fnmatch('* / FIXME *', 'dave/.profile', STRICT) #=> true
+ * pattern = '**' '/' 'foo'
+ * File.fnmatch(pattern, 'a/b/c/foo', File::FNM_PATHNAME) #=> true
+ * File.fnmatch(pattern, '/a/b/c/foo', File::FNM_PATHNAME) #=> true
+ * File.fnmatch(pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true
+ * File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME) #=> false
+ * File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
*/
static VALUE
file_s_fnmatch(argc, argv, obj)
@@ -1538,6 +1972,7 @@ Init_Dir()
rb_define_method(rb_cDir,"initialize", dir_initialize, 1);
rb_define_method(rb_cDir,"path", dir_path, 0);
+ rb_define_method(rb_cDir,"inspect", dir_inspect, 0);
rb_define_method(rb_cDir,"read", dir_read, 0);
rb_define_method(rb_cDir,"each", dir_each, 0);
rb_define_method(rb_cDir,"rewind", dir_rewind, 0);
@@ -1557,7 +1992,7 @@ Init_Dir()
rb_define_singleton_method(rb_cDir,"unlink", dir_s_rmdir, 1);
rb_define_singleton_method(rb_cDir,"glob", dir_s_glob, -1);
- rb_define_singleton_method(rb_cDir,"[]", dir_s_aref, 1);
+ rb_define_singleton_method(rb_cDir,"[]", dir_s_aref, -1);
rb_define_singleton_method(rb_cFile,"fnmatch", file_s_fnmatch, -1);
rb_define_singleton_method(rb_cFile,"fnmatch?", file_s_fnmatch, -1);
@@ -1566,4 +2001,5 @@ 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
new file mode 100644
index 0000000000..613da0eb9c
--- /dev/null
+++ b/distruby.rb
@@ -0,0 +1,59 @@
+#!./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
+tgzname = dirname + '.tar.gz'
+tbzname = dirname + '.tar.bz2'
+zipname = dirname + '.zip'
+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 tarballs...'
+ENV['GZIP'] = '-9'
+system 'tar', 'chofzp', tgzname, dirname
+system 'tar', 'chojfp', tbzname, dirname
+system 'zip', '-q9r', zipname, dirname
+
+require 'digest/md5'
+require 'digest/sha2'
+for name in [tgzname, tbzname, zipname] do
+ open name, 'rb' do |fp|
+ str = fp.read
+ md5 = Digest::MD5.hexdigest str
+ sha = Digest::SHA256.hexdigest str
+ printf "MD5(%s)= %s\nSHA256(%s)= %s\nSIZE(%s)= %s\n\n",
+ name, md5,
+ name, sha,
+ name, str.size
+ end
+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 100644..100755
--- a/djgpp/configure.bat
+++ b/djgpp/configure.bat
diff --git a/dln.c b/dln.c
index 0993a84161..5ba25b6415 100644
--- a/dln.c
+++ b/dln.c
@@ -27,10 +27,6 @@
char *dln_argv0;
#endif
-#ifdef _AIX
-#pragma alloca
-#endif
-
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#endif
@@ -85,21 +81,28 @@ char *getenv();
# include "macruby_private.h"
#endif
+#if defined(__APPLE__) && defined(__MACH__) /* Mac OS X */
+# if defined(HAVE_DLOPEN)
+ /* Mac OS X with dlopen (10.3 or later) */
+# define MACOSX_DLOPEN
+# else
+# define MACOSX_DYLD
+# endif
+#endif
+
#ifdef __BEOS__
# include <image.h>
#endif
-int eaccess();
-
#ifndef NO_DLN_LOAD
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(MACOSX_DYLD) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
#ifndef FUNCNAME_PATTERN
-# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(__APPLE__)
+# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD)
# define FUNCNAME_PATTERN "_Init_%s"
# else
# define FUNCNAME_PATTERN "Init_%s"
@@ -642,7 +645,7 @@ load_1(fd, disp, need_init)
long disp;
const char *need_init;
{
- static char *libc = LIBC_NAME;
+ static const char *libc = LIBC_NAME;
struct exec hdr;
struct relocation_info *reloc = NULL;
long block = 0;
@@ -1147,7 +1150,7 @@ dln_sym(name)
#endif
#endif
#else
-#ifdef __APPLE__
+#ifdef MACOSX_DYLD
#include <mach-o/dyld.h>
#endif
#endif
@@ -1409,7 +1412,7 @@ dln_load(file)
}
#endif /* _AIX */
-#if defined(NeXT) || defined(__APPLE__)
+#if defined(NeXT) || defined(MACOSX_DYLD)
#define DLN_DEFINED
/*----------------------------------------------------
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1533,7 +1536,7 @@ dln_load(file)
}
#endif /* __BEOS__*/
-#ifdef __MACOS__
+#ifdef __MACOS__ /* Mac OS 9 or before */
# define DLN_DEFINED
{
OSErr err;
@@ -1682,63 +1685,35 @@ dln_find_file(fname, path)
#endif
}
-#if defined(__CYGWIN32__)
-const char *
-conv_to_posix_path(win32, posix, len)
- char *win32;
- char *posix;
- int len;
-{
- char *first = win32;
- char *p = win32;
- char *dst = posix;
-
- for (p = win32; *p; p++)
- if (*p == ';') {
- *p = 0;
- cygwin32_conv_to_posix_path(first, posix);
- posix += strlen(posix);
- *posix++ = ':';
- first = p + 1;
- *p = ';';
- }
- if (len < strlen(first))
- fprintf(stderr, "PATH length too long: %s\n", first);
- else
- cygwin32_conv_to_posix_path(first, posix);
- return dst;
-}
-#endif
-
static char fbuf[MAXPATHLEN];
static char *
dln_find_1(fname, path, exe_flag)
- char *fname;
- char *path;
+ const char *fname;
+ const char *path;
int exe_flag; /* non 0 if looking for executable. */
{
- register char *dp;
- register char *ep;
+ register const char *dp;
+ register const char *ep;
register char *bp;
struct stat st;
#ifdef __MACOS__
const char* mac_fullpath;
#endif
- if (!fname) return fname;
- if (fname[0] == '/') return fname;
+ if (!fname) return (char *)fname;
+ if (fname[0] == '/') return (char *)fname;
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
- return fname;
- if (exe_flag && strchr(fname, '/')) return fname;
+ return (char *)fname;
+ if (exe_flag && strchr(fname, '/')) return (char *)fname;
#ifdef DOSISH
- if (fname[0] == '\\') return fname;
+ if (fname[0] == '\\') return (char *)fname;
# ifdef DOSISH_DRIVE_LETTER
- if (strlen(fname) > 2 && fname[1] == ':') return fname;
+ if (strlen(fname) > 2 && fname[1] == ':') return (char *)fname;
# endif
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
- return fname;
- if (exe_flag && strchr(fname, '\\')) return fname;
+ return (char *)fname;
+ if (exe_flag && strchr(fname, '\\')) return (char *)fname;
#endif
for (dp = path;; dp = ++ep) {
@@ -1806,26 +1781,9 @@ dln_find_1(fname, path, exe_flag)
}
memcpy(bp, fname, i + 1);
-#ifndef __MACOS__
- if (stat(fbuf, &st) == 0) {
- if (exe_flag == 0) return fbuf;
- /* looking for executable */
- if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
- return fbuf;
- }
-#else
- if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) {
- if (exe_flag == 0) return mac_fullpath;
- /* looking for executable */
- if (stat(mac_fullpath, &st) == 0) {
- if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0)
- return mac_fullpath;
- }
- }
-#endif
#if defined(DOSISH)
if (exe_flag) {
- static const char *extension[] = {
+ static const char extension[][5] = {
#if defined(MSDOS)
".com", ".exe", ".bat",
#if defined(DJGPP)
@@ -1838,11 +1796,10 @@ dln_find_1(fname, path, exe_flag)
".r", ".R", ".x", ".X", ".bat", ".BAT",
/* __human68k__ */
#endif
- (char *) NULL
};
int j;
- for (j = 0; extension[j]; j++) {
+ for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {
if (fspace < strlen(extension[j])) {
fprintf(stderr, "openpath: pathname too long (ignored)\n");
fprintf(stderr, "\tDirectory \"%.*s\"\n", (int) (bp - fbuf), fbuf);
@@ -1859,9 +1816,28 @@ dln_find_1(fname, path, exe_flag)
#endif
}
+ goto next;
}
#endif /* MSDOS or _WIN32 or __human68k__ or __EMX__ */
+#ifndef __MACOS__
+ if (stat(fbuf, &st) == 0) {
+ if (exe_flag == 0) return fbuf;
+ /* looking for executable */
+ if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
+ return fbuf;
+ }
+#else
+ if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) {
+ if (exe_flag == 0) return mac_fullpath;
+ /* looking for executable */
+ if (stat(mac_fullpath, &st) == 0) {
+ if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0)
+ return mac_fullpath;
+ }
+ }
+#endif
+
next:
/* if not, and no other alternatives, life is bleak */
if (*ep == '\0') {
diff --git a/doc/NEWS b/doc/NEWS-1.8.0
index b4445fa59f..b4445fa59f 100644
--- a/doc/NEWS
+++ b/doc/NEWS-1.8.0
diff --git a/enum.c b/enum.c
index a50de77a90..df35c2fe03 100644
--- a/enum.c
+++ b/enum.c
@@ -15,7 +15,43 @@
#include "util.h"
VALUE rb_mEnumerable;
-static ID id_each, id_eqq, id_cmp;
+static ID id_each, id_eqq, id_cmp, id_size;
+
+struct iter_method_arg {
+ VALUE obj;
+ ID mid;
+ int argc;
+ VALUE *argv;
+};
+
+static VALUE iterate_method _((VALUE obj));
+static VALUE
+iterate_method(obj)
+ VALUE obj;
+{
+ struct iter_method_arg *arg;
+
+ arg = (struct iter_method_arg *)obj;
+ return rb_funcall2(arg->obj, arg->mid, arg->argc, arg->argv);
+}
+
+VALUE
+rb_block_call(obj, mid, argc, argv, bl_proc, data2)
+ VALUE obj;
+ ID mid;
+ int argc;
+ VALUE *argv;
+ VALUE (*bl_proc) (ANYARGS);
+ VALUE data2;
+{
+ struct iter_method_arg arg;
+
+ arg.obj = obj;
+ arg.mid = mid;
+ arg.argc = argc;
+ arg.argv = argv;
+ return rb_iterate(iterate_method, (VALUE)&arg, bl_proc, data2);
+}
VALUE
rb_each(obj)
@@ -48,18 +84,18 @@ grep_iter_i(i, arg)
* call-seq:
* enum.grep(pattern) => array
* enum.grep(pattern) {| obj | block } => array
- *
+ *
* Returns an array of every element in <i>enum</i> for which
* <code>Pattern === element</code>. If the optional <em>block</em> is
* supplied, each matching element is passed to it, and the block's
* result is stored in the output array.
- *
+ *
* (1..100).grep 38..44 #=> [38, 39, 40, 41, 42, 43, 44]
* c = IO.constants
* c.grep(/SEEK/) #=> ["SEEK_END", "SEEK_SET", "SEEK_CUR"]
* res = c.grep(/SEEK/) {|v| IO.const_get(v) }
* res #=> [2, 0, 1]
- *
+ *
*/
static VALUE
@@ -73,10 +109,99 @@ enum_grep(obj, pat)
arg[1] = ary;
rb_iterate(rb_each, obj, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)arg);
-
+
return ary;
}
+static VALUE count_i _((VALUE, VALUE));
+static VALUE
+count_i(i, memop)
+ VALUE i, memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (rb_equal(i, memo[1])) {
+ memo[0]++;
+ }
+ return Qnil;
+}
+
+static VALUE count_iter_i _((VALUE, VALUE));
+static VALUE
+count_iter_i(i, memop)
+ VALUE i, memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (RTEST(rb_yield(i))) {
+ memo[0]++;
+ }
+ return Qnil;
+}
+
+static VALUE count_all_i _((VALUE, VALUE));
+static VALUE
+count_all_i(i, memop)
+ VALUE i, memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ memo[0]++;
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.count => int
+ * enum.count(item) => int
+ * enum.count {| obj | block } => int
+ *
+ * Returns the number of items in <i>enum</i>, where #size is called
+ * if it responds to it, otherwise the items are counted through
+ * enumeration. If an argument is given, counts the number of items
+ * in <i>enum</i>, for which equals to <i>item</i>. If a block is
+ * given, counts the number of elements yielding a true value.
+ *
+ * ary = [1, 2, 4, 2]
+ * ary.count # => 4
+ * ary.count(2) # => 2
+ * ary.count{|x|x%2==0} # => 3
+ *
+ */
+
+static VALUE
+enum_count(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE memo[2]; /* [count, condition value] */
+ rb_block_call_func *func;
+
+ if (argc == 0) {
+ if (rb_block_given_p()) {
+ func = count_iter_i;
+ }
+ else {
+ if (rb_respond_to(obj, id_size)) {
+ return rb_funcall(obj, id_size, 0, 0);
+ }
+ func = count_all_i;
+ }
+ }
+ else {
+ rb_scan_args(argc, argv, "1", &memo[1]);
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
+ func = count_i;
+ }
+
+ memo[0] = 0;
+ rb_block_call(obj, id_each, 0, 0, func, (VALUE)&memo);
+ return INT2NUM(memo[0]);
+}
+
static VALUE
find_i(i, memo)
VALUE i;
@@ -93,15 +218,15 @@ find_i(i, memo)
* call-seq:
* enum.detect(ifnone = nil) {| obj | block } => obj or nil
* enum.find(ifnone = nil) {| obj | block } => obj or nil
- *
+ *
* Passes each entry in <i>enum</i> to <em>block</em>. Returns the
* first for which <em>block</em> is not <code>false</code>. If no
* object matches, calls <i>ifnone</i> and returns its result when it
* is specified, or returns <code>nil</code>
- *
+ *
* (1..10).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
* (1..100).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> 35
- *
+ *
*/
static VALUE
@@ -114,6 +239,7 @@ enum_find(argc, argv, obj)
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
+ RETURN_ENUMERATOR(obj, argc, argv);
rb_iterate(rb_each, obj, find_i, (VALUE)&memo);
if (memo != Qundef) {
return memo;
@@ -124,6 +250,81 @@ enum_find(argc, argv, obj)
return Qnil;
}
+static VALUE find_index_i _((VALUE, VALUE));
+static VALUE
+find_index_i(i, memop)
+ VALUE i;
+ VALUE memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (rb_equal(i, memo[2])) {
+ memo[0] = UINT2NUM(memo[1]);
+ rb_iter_break();
+ }
+ memo[1]++;
+ return Qnil;
+}
+
+static VALUE find_index_iter_i _((VALUE, VALUE));
+static VALUE
+find_index_iter_i(i, memop)
+ VALUE i;
+ VALUE memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (RTEST(rb_yield(i))) {
+ memo[0] = UINT2NUM(memo[1]);
+ rb_iter_break();
+ }
+ memo[1]++;
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.find_index(value) => int or nil
+ * enum.find_index {| obj | block } => int or nil
+ *
+ * Compares each entry in <i>enum</i> with <em>value</em> or passes
+ * to <em>block</em>. Returns the index for the first for which the
+ * evaluated value is non-false. If no object matches, returns
+ * <code>nil</code>
+ *
+ * (1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
+ * (1..100).find_index(50) #=> 49
+ *
+ */
+
+static VALUE
+enum_find_index(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE memo[3]; /* [return value, current index, condition value] */
+ rb_block_call_func *func;
+
+ if (argc == 0) {
+ RETURN_ENUMERATOR(obj, 0, 0);
+ func = find_index_iter_i;
+ }
+ else {
+ rb_scan_args(argc, argv, "1", &memo[2]);
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
+ func = find_index_i;
+ }
+
+ memo[0] = Qnil;
+ memo[1] = 0;
+ rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo);
+ return memo[0];
+}
+
static VALUE
find_all_i(i, ary)
VALUE i, ary;
@@ -138,13 +339,13 @@ find_all_i(i, ary)
* call-seq:
* enum.find_all {| obj | block } => array
* enum.select {| obj | block } => array
- *
+ *
* Returns an array containing all elements of <i>enum</i> for which
* <em>block</em> is not <code>false</code> (see also
* <code>Enumerable#reject</code>).
- *
+ *
* (1..10).find_all {|i| i % 3 == 0 } #=> [3, 6, 9]
- *
+ *
*/
static VALUE
@@ -152,7 +353,8 @@ enum_find_all(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
-
+
+ RETURN_ENUMERATOR(obj, 0, 0);
rb_iterate(rb_each, obj, find_all_i, ary);
return ary;
@@ -171,12 +373,12 @@ reject_i(i, ary)
/*
* call-seq:
* enum.reject {| obj | block } => array
- *
+ *
* Returns an array for all elements of <i>enum</i> for which
* <em>block</em> is false (see also <code>Enumerable#find_all</code>).
- *
+ *
* (1..10).reject {|i| i % 3 == 0 } #=> [1, 2, 4, 5, 7, 8, 10]
- *
+ *
*/
static VALUE
@@ -184,7 +386,8 @@ enum_reject(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
-
+
+ RETURN_ENUMERATOR(obj, 0, 0);
rb_iterate(rb_each, obj, reject_i, ary);
return ary;
@@ -212,13 +415,13 @@ collect_all(i, ary)
* call-seq:
* enum.collect {| obj | block } => array
* enum.map {| obj | block } => array
- *
+ *
* Returns a new array with the results of running <em>block</em> once
* for every element in <i>enum</i>.
- *
+ *
* (1..4).collect {|i| i*i } #=> [1, 4, 9, 16]
* (1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
- *
+ *
*/
static VALUE
@@ -236,80 +439,135 @@ enum_collect(obj)
* call-seq:
* enum.to_a => array
* enum.entries => array
- *
+ *
* Returns an array containing the items in <i>enum</i>.
- *
+ *
* (1..7).to_a #=> [1, 2, 3, 4, 5, 6, 7]
* { 'a'=>1, 'b'=>2, 'c'=>3 }.to_a #=> [["a", 1], ["b", 2], ["c", 3]]
*/
static VALUE
-enum_to_a(obj)
+enum_to_a(argc, argv, obj)
+ int argc;
+ VALUE *argv;
VALUE obj;
{
VALUE ary = rb_ary_new();
- rb_iterate(rb_each, obj, collect_all, ary);
+ rb_block_call(obj, id_each, argc, argv, collect_all, ary);
return ary;
}
+static VALUE inject_i _((VALUE, VALUE));
static VALUE
-inject_i(i, memo)
+inject_i(i, p)
VALUE i;
- VALUE *memo;
+ VALUE p;
{
- if (*memo == Qundef) {
- *memo = i;
+ VALUE *memo = (VALUE *)p;
+ if (memo[0] == Qundef) {
+ memo[0] = i;
+ }
+ else {
+ memo[0] = rb_yield_values(2, memo[0], i);
+ }
+ return Qnil;
+}
+
+static VALUE inject_op_i _((VALUE, VALUE));
+static VALUE
+inject_op_i(i, p)
+ VALUE i;
+ VALUE p;
+{
+ VALUE *memo = (VALUE *)p;
+
+ if (memo[0] == Qundef) {
+ memo[0] = i;
}
else {
- *memo = rb_yield_values(2, *memo, i);
+ memo[0] = rb_funcall(memo[0], (ID)memo[1], 1, i);
}
return Qnil;
}
/*
* call-seq:
+ * enum.inject(initial, sym) => obj
+ * enum.inject(sym) => obj
* enum.inject(initial) {| memo, obj | block } => obj
* enum.inject {| memo, obj | block } => obj
- *
- * Combines the elements of <i>enum</i> by applying the block to an
- * accumulator value (<i>memo</i>) and each element in turn. At each
- * step, <i>memo</i> is set to the value returned by the block. The
- * first form lets you supply an initial value for <i>memo</i>. The
- * second form uses the first element of the collection as a the
- * initial value (and skips that element while iterating).
- *
+ *
+ * enum.reduce(initial, sym) => obj
+ * enum.reduce(sym) => obj
+ * enum.reduce(initial) {| memo, obj | block } => obj
+ * enum.reduce {| memo, obj | block } => obj
+ *
+ * Combines all elements of <i>enum</i> by applying a binary
+ * operation, specified by a block or a symbol that names a
+ * method or operator.
+ *
+ * If you specify a block, then for each element in <i>enum<i>
+ * the block is passed an accumulator value (<i>memo</i>) and the element.
+ * If you specify a symbol instead, then each element in the collection
+ * will be passed to the named method of <i>memo</i>.
+ * In either case, the result becomes the new value for <i>memo</i>.
+ * At the end of the iteration, the final value of <i>memo</i> is the
+ * return value fo the method.
+ *
+ * If you do not explicitly specify an <i>initial</i> value for <i>memo</i>,
+ * then uses the first element of collection is used as the initial value
+ * of <i>memo</i>.
+ *
+ * Examples:
+ *
* # Sum some numbers
- * (5..10).inject {|sum, n| sum + n } #=> 45
+ * (5..10).reduce(:+) #=> 45
+ * # Same using a block and inject
+ * (5..10).inject {|sum, n| sum + n } #=> 45
* # Multiply some numbers
- * (5..10).inject(1) {|product, n| product * n } #=> 151200
- *
+ * (5..10).reduce(1, :*) #=> 151200
+ * # Same using a block
+ * (5..10).inject(1) {|product, n| product * n } #=> 151200
* # find the longest word
* longest = %w{ cat sheep bear }.inject do |memo,word|
* memo.length > word.length ? memo : word
* end
- * longest #=> "sheep"
- *
- * # find the length of the longest word
- * longest = %w{ cat sheep bear }.inject(0) do |memo,word|
- * memo >= word.length ? memo : word.length
- * end
- * longest #=> 5
- *
+ * longest #=> "sheep"
+ *
*/
-
static VALUE
enum_inject(argc, argv, obj)
int argc;
- VALUE *argv, obj;
+ VALUE *argv;
+ VALUE obj;
{
- VALUE memo = Qundef;
-
- 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;
+ VALUE memo[2];
+ rb_block_call_func *iter = inject_i;
+
+ switch (rb_scan_args(argc, argv, "02", &memo[0], &memo[1])) {
+ case 0:
+ memo[0] = Qundef;
+ break;
+ case 1:
+ if (rb_block_given_p()) {
+ break;
+ }
+ memo[1] = (VALUE)rb_to_id(memo[0]);
+ memo[0] = Qundef;
+ iter = inject_op_i;
+ break;
+ case 2:
+ if (rb_block_given_p()) {
+ rb_warning("given block not used");
+ }
+ memo[1] = (VALUE)rb_to_id(memo[1]);
+ iter = inject_op_i;
+ break;
+ }
+ rb_block_call(obj, id_each, 0, 0, iter, (VALUE)memo);
+ if (memo[0] == Qundef) return Qnil;
+ return memo[0];
}
static VALUE
@@ -328,13 +586,13 @@ partition_i(i, ary)
/*
* call-seq:
* enum.partition {| obj | block } => [ true_array, false_array ]
- *
+ *
* Returns two arrays, the first containing the elements of
* <i>enum</i> for which the block evaluates to true, the second
* containing the rest.
- *
+ *
* (1..6).partition {|i| (i&1).zero?} #=> [[2, 4, 6], [1, 3, 5]]
- *
+ *
*/
static VALUE
@@ -343,6 +601,8 @@ enum_partition(obj)
{
VALUE ary[2];
+ RETURN_ENUMERATOR(obj, 0, 0);
+
ary[0] = rb_ary_new();
ary[1] = rb_ary_new();
rb_iterate(rb_each, obj, partition_i, (VALUE)ary);
@@ -350,11 +610,111 @@ enum_partition(obj)
return rb_assoc_new(ary[0], ary[1]);
}
+static VALUE
+group_by_i(i, hash)
+ VALUE i;
+ VALUE hash;
+{
+ VALUE group = rb_yield(i);
+ VALUE values;
+
+ values = rb_hash_aref(hash, group);
+ if (NIL_P(values)) {
+ values = rb_ary_new3(1, i);
+ rb_hash_aset(hash, group, values);
+ }
+ else {
+ rb_ary_push(values, i);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.group_by {| obj | block } => a_hash
+ *
+ * Returns a hash, which keys are evaluated result from the
+ * block, and values are arrays of elements in <i>enum</i>
+ * corresponding to the key.
+ *
+ * (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
+ *
+ */
+
+static VALUE
+enum_group_by(obj)
+ VALUE obj;
+{
+ VALUE hash;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ hash = rb_hash_new();
+ rb_block_call(obj, id_each, 0, 0, group_by_i, hash);
+
+ return hash;
+}
+
+static VALUE
+first_i(i, ary)
+ VALUE i;
+ VALUE *ary;
+{
+ if (NIL_P(ary[0])) {
+ ary[1] = i;
+ rb_iter_break();
+ }
+ else {
+ long n = NUM2LONG(ary[0]);
+
+ if (n <= 0) {
+ rb_iter_break();
+ }
+ rb_ary_push(ary[1], i);
+ n--;
+ ary[0] = INT2NUM(n);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.first -> obj or nil
+ * enum.first(n) -> an_array
+ *
+ * Returns the first element, or the first +n+ elements, of the enumerable.
+ * If the enumerable is empty, the first form returns <code>nil</code>, and the
+ * second form returns an empty array.
+ *
+ */
+
+static VALUE
+enum_first(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE n, ary[2];
+
+ if (argc == 0) {
+ ary[0] = ary[1] = Qnil;
+ }
+ else {
+ rb_scan_args(argc, argv, "01", &n);
+ ary[0] = n;
+ ary[1] = rb_ary_new2(NUM2LONG(n));
+ }
+ rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)ary);
+
+ return ary[1];
+}
+
+
/*
* call-seq:
* enum.sort => array
* enum.sort {| a, b | block } => array
- *
+ *
* Returns an array containing the items in <i>enum</i> sorted,
* either according to their own <code><=></code> method, or by using
* the results of the supplied block. The block should return -1, 0, or
@@ -362,7 +722,7 @@ enum_partition(obj)
* Ruby 1.8, the method <code>Enumerable#sort_by</code> implements a
* built-in Schwartzian Transform, useful when key computation or
* comparison is expensive..
- *
+ *
* %w(rhea kea flea).sort #=> ["flea", "kea", "rhea"]
* (1..10).sort {|a,b| b <=> a} #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
*/
@@ -371,7 +731,7 @@ static VALUE
enum_sort(obj)
VALUE obj;
{
- return rb_ary_sort(enum_to_a(obj));
+ return rb_ary_sort(enum_to_a(0, 0, obj));
}
static VALUE
@@ -391,65 +751,70 @@ sort_by_i(i, ary)
}
static int
-sort_by_cmp(aa, bb)
+sort_by_cmp(aa, bb, data)
NODE **aa, **bb;
+ void *data;
{
VALUE a = aa[0]->u1.value;
VALUE b = bb[0]->u1.value;
+ VALUE ary = (VALUE)data;
+ if (RBASIC(ary)->klass) {
+ rb_raise(rb_eRuntimeError, "sort_by reentered");
+ }
return rb_cmpint(rb_funcall(a, id_cmp, 1, b), a, b);
}
/*
* call-seq:
* enum.sort_by {| obj | block } => array
- *
+ *
* Sorts <i>enum</i> using a set of keys generated by mapping the
* values in <i>enum</i> through the given block.
- *
+ *
* %w{ apple pear fig }.sort_by {|word| word.length}
#=> ["fig", "pear", "apple"]
- *
+ *
* The current implementation of <code>sort_by</code> generates an
* array of tuples containing the original collection element and the
* mapped value. This makes <code>sort_by</code> fairly expensive when
* the keysets are simple
- *
+ *
* require 'benchmark'
* include Benchmark
- *
+ *
* a = (1..100000).map {rand(100000)}
- *
+ *
* bm(10) do |b|
* b.report("Sort") { a.sort }
* b.report("Sort by") { a.sort_by {|a| a} }
* end
- *
+ *
* <em>produces:</em>
- *
+ *
* user system total real
* Sort 0.180000 0.000000 0.180000 ( 0.175469)
* Sort by 1.980000 0.040000 2.020000 ( 2.013586)
- *
+ *
* However, consider the case where comparing the keys is a non-trivial
* operation. The following code sorts some files on modification time
* using the basic <code>sort</code> method.
- *
+ *
* files = Dir["*"]
* sorted = files.sort {|a,b| File.new(a).mtime <=> File.new(b).mtime}
* sorted #=> ["mon", "tues", "wed", "thurs"]
- *
+ *
* This sort is inefficient: it generates two new <code>File</code>
* objects during every comparison. A slightly better technique is to
* use the <code>Kernel#test</code> method to generate the modification
* times directly.
- *
+ *
* files = Dir["*"]
* sorted = files.sort { |a,b|
* test(?M, a) <=> test(?M, b)
* }
* sorted #=> ["mon", "tues", "wed", "thurs"]
- *
+ *
* This still generates many unnecessary <code>Time</code> objects. A
* more efficient technique is to cache the sort keys (modification
* times in this case) before the sort. Perl users often call this
@@ -457,14 +822,14 @@ sort_by_cmp(aa, bb)
* construct a temporary array, where each element is an array
* containing our sort key along with the filename. We sort this array,
* and then extract the filename from the result.
- *
+ *
* sorted = Dir["*"].collect { |f|
* [test(?M, f), f]
* }.sort.collect { |f| f[1] }
* sorted #=> ["mon", "tues", "wed", "thurs"]
- *
+ *
* This is exactly what <code>sort_by</code> does internally.
- *
+ *
* sorted = Dir["*"].sort_by {|f| test(?M, f)}
* sorted #=> ["mon", "tues", "wed", "thurs"]
*/
@@ -476,6 +841,8 @@ enum_sort_by(obj)
VALUE ary;
long i;
+ RETURN_ENUMERATOR(obj, 0, 0);
+
if (TYPE(obj) == T_ARRAY) {
ary = rb_ary_new2(RARRAY(obj)->len);
}
@@ -485,7 +852,8 @@ enum_sort_by(obj)
RBASIC(ary)->klass = 0;
rb_iterate(rb_each, obj, sort_by_i, ary);
if (RARRAY(ary)->len > 1) {
- qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), sort_by_cmp, 0);
+ qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE),
+ sort_by_cmp, (void *)ary);
}
if (RBASIC(ary)->klass) {
rb_raise(rb_eRuntimeError, "sort_by reentered");
@@ -498,11 +866,11 @@ enum_sort_by(obj)
}
static VALUE
-all_iter_i(i, memo)
+all_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (!RTEST(rb_yield(i))) {
+ if (!RTEST(i)) {
*memo = Qfalse;
rb_iter_break();
}
@@ -510,32 +878,28 @@ all_iter_i(i, memo)
}
static VALUE
-all_i(i, memo)
+all_iter_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (!RTEST(i)) {
- *memo = Qfalse;
- rb_iter_break();
- }
- return Qnil;
+ return all_i(rb_yield(i), memo);
}
/*
* call-seq:
* enum.all? [{|obj| block } ] => true or false
- *
+ *
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block never returns
* <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>all?</code> will return <code>true</code> only if none of the
* collection members are <code>false</code> or <code>nil</code>.)
- *
+ *
* %w{ ant bear cat}.all? {|word| word.length >= 3} #=> true
* %w{ ant bear cat}.all? {|word| word.length >= 4} #=> false
* [ nil, true, 99 ].all? #=> false
- *
+ *
*/
static VALUE
@@ -549,11 +913,11 @@ enum_all(obj)
}
static VALUE
-any_iter_i(i, memo)
+any_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (RTEST(rb_yield(i))) {
+ if (RTEST(i)) {
*memo = Qtrue;
rb_iter_break();
}
@@ -561,33 +925,29 @@ any_iter_i(i, memo)
}
static VALUE
-any_i(i, memo)
+any_iter_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (RTEST(i)) {
- *memo = Qtrue;
- rb_iter_break();
- }
- return Qnil;
+ return any_i(rb_yield(i), memo);
}
/*
* call-seq:
* enum.any? [{|obj| block } ] => true or false
- *
+ *
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block ever returns a value other
- * that <code>false</code> or <code>nil</code>. If the block is not
+ * than <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
* <code>nil</code>.
- *
+ *
* %w{ ant bear cat}.any? {|word| word.length >= 3} #=> true
* %w{ ant bear cat}.any? {|word| word.length >= 4} #=> true
* [ nil, true, 99 ].any? #=> true
- *
+ *
*/
static VALUE
@@ -601,6 +961,105 @@ enum_any(obj)
}
static VALUE
+one_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ if (RTEST(i)) {
+ if (*memo == Qundef) {
+ *memo = Qtrue;
+ }
+ else if (*memo == Qtrue) {
+ *memo = Qfalse;
+ rb_iter_break();
+ }
+ }
+ return Qnil;
+}
+
+static VALUE
+one_iter_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ return one_i(rb_yield(i), memo);
+}
+
+/*
+ * call-seq:
+ * enum.one? [{|obj| block }] => true or false
+ *
+ * Passes each element of the collection to the given block. The method
+ * returns <code>true</code> if the block returns <code>true</code>
+ * exactly once. If the block is not given, <code>one?</code> will return
+ * <code>true</code> only if exactly one of the collection members is
+ * true.
+ *
+ * %w{ant bear cat}.one? {|word| word.length == 4} #=> true
+ * %w{ant bear cat}.one? {|word| word.length > 4} #=> false
+ * %w{ant bear cat}.one? {|word| word.length < 4} #=> false
+ * [ nil, true, 99 ].one? #=> false
+ * [ nil, true, false ].one? #=> true
+ *
+ */
+
+static VALUE
+enum_one(obj)
+ VALUE obj;
+{
+ VALUE result = Qundef;
+
+ rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? one_iter_i : one_i, (VALUE)&result);
+ if (result == Qundef) return Qfalse;
+ return result;
+}
+
+static VALUE
+none_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ if (RTEST(i)) {
+ *memo = Qfalse;
+ rb_iter_break();
+ }
+ return Qnil;
+}
+
+static VALUE
+none_iter_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ return none_i(rb_yield(i), memo);
+}
+
+/*
+ * call-seq:
+ * enum.none? [{|obj| block }] => true or false
+ *
+ * Passes each element of the collection to the given block. The method
+ * returns <code>true</code> if the block never returns <code>true</code>
+ * for all elements. If the block is not given, <code>none?</code> will return
+ * <code>true</code> only if none of the collection members is true.
+ *
+ * %w{ant bear cat}.none? {|word| word.length == 5} #=> true
+ * %w{ant bear cat}.none? {|word| word.length >= 4} #=> false
+ * [].none? #=> true
+ * [nil].none? #=> true
+ * [nil,false].none? #=> true
+ */
+static VALUE
+enum_none(obj)
+ VALUE obj;
+{
+ VALUE result = Qtrue;
+
+ rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? none_iter_i : none_i, (VALUE)&result);
+ return result;
+}
+
+static VALUE
min_i(i, memo)
VALUE i;
VALUE *memo;
@@ -643,11 +1102,11 @@ min_ii(i, memo)
* call-seq:
* enum.min => obj
* enum.min {| a,b | block } => obj
- *
+ *
* Returns the object in <i>enum</i> with the minimum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
- *
+ *
* a = %w(albatross dog horse)
* a.min #=> "albatross"
* a.min {|a,b| a.length <=> b.length } #=> "dog"
@@ -668,11 +1127,11 @@ enum_min(obj)
* call-seq:
* enum.max => obj
* enum.max {| a,b | block } => obj
- *
+ *
* Returns the object in <i>enum</i> with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
- *
+ *
* a = %w(albatross dog horse)
* a.max #=> "horse"
* a.max {|a,b| a.length <=> b.length } #=> "albatross"
@@ -720,15 +1179,15 @@ max_ii(i, memo)
* call-seq:
* enum.max => obj
* enum.max {|a,b| block } => obj
- *
+ *
* Returns the object in _enum_ with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
- *
+ *
* a = %w(albatross dog horse)
* a.max #=> "horse"
* a.max {|a,b| a.length <=> b.length } #=> "albatross"
- */
+ */
static VALUE
enum_max(obj)
@@ -742,6 +1201,240 @@ enum_max(obj)
}
static VALUE
+minmax_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ int n;
+
+ if (memo[0] == Qundef) {
+ memo[0] = i;
+ memo[1] = i;
+ }
+ else {
+ n = rb_cmpint(rb_funcall(i, id_cmp, 1, memo[0]), i, memo[0]);
+ if (n < 0) {
+ memo[0] = i;
+ }
+ n = rb_cmpint(rb_funcall(i, id_cmp, 1, memo[1]), i, memo[1]);
+ if (n > 0) {
+ memo[1] = i;
+ }
+ }
+ return Qnil;
+}
+
+static VALUE
+minmax_ii(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ int n;
+
+ if (memo[0] == Qundef) {
+ memo[0] = i;
+ memo[1] = i;
+ }
+ else {
+ VALUE ary = memo[2];
+
+ RARRAY(ary)->ptr[0] = i;
+ RARRAY(ary)->ptr[1] = memo[0];
+ n = rb_cmpint(rb_yield(ary), i, memo[0]);
+ if (n < 0) {
+ memo[0] = i;
+ }
+ RARRAY(ary)->ptr[0] = i;
+ RARRAY(ary)->ptr[1] = memo[1];
+ n = rb_cmpint(rb_yield(ary), i, memo[1]);
+ if (n > 0) {
+ memo[1] = i;
+ }
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.minmax => [min,max]
+ * enum.minmax {|a,b| block } => [min,max]
+ *
+ * Returns two elements array which contains the minimum and the
+ * maximum value in the enumerable. The first form assumes all
+ * objects implement <code>Comparable</code>; the second uses the
+ * block to return <em>a <=> b</em>.
+ *
+ * a = %w(albatross dog horse)
+ * a.minmax #=> ["albatross", "horse"]
+ * a.minmax {|a,b| a.length <=> b.length } #=> ["dog", "albatross"]
+ */
+
+static VALUE
+enum_minmax(obj)
+ VALUE obj;
+{
+ VALUE result[3];
+ VALUE ary = rb_ary_new3(2, Qnil, Qnil);
+
+ result[0] = Qundef;
+ if (rb_block_given_p()) {
+ result[2] = ary;
+ rb_block_call(obj, id_each, 0, 0, minmax_ii, (VALUE)result);
+ }
+ else {
+ rb_block_call(obj, id_each, 0, 0, minmax_i, (VALUE)result);
+ }
+ if (result[0] != Qundef) {
+ RARRAY(ary)->ptr[0] = result[0];
+ RARRAY(ary)->ptr[1] = result[1];
+ }
+ return ary;
+}
+
+static VALUE
+min_by_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ VALUE v;
+
+ v = rb_yield(i);
+ if (memo[0] == Qundef) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) < 0) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.min_by {| obj| block } => obj
+ *
+ * Returns the object in <i>enum</i> that gives the minimum
+ * value from the given block.
+ *
+ * a = %w(albatross dog horse)
+ * a.min_by {|x| x.length } #=> "dog"
+ */
+
+static VALUE
+enum_min_by(obj)
+ VALUE obj;
+{
+ VALUE memo[2];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo[0] = Qundef;
+ memo[1] = Qnil;
+ rb_block_call(obj, id_each, 0, 0, min_by_i, (VALUE)memo);
+ return memo[1];
+}
+
+static VALUE
+max_by_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ VALUE v;
+
+ v = rb_yield(i);
+ if (memo[0] == Qundef) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) > 0) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.max_by {| obj| block } => obj
+ *
+ * Returns the object in <i>enum</i> that gives the maximum
+ * value from the given block.
+ *
+ * a = %w(albatross dog horse)
+ * a.max_by {|x| x.length } #=> "albatross"
+ */
+
+static VALUE
+enum_max_by(obj)
+ VALUE obj;
+{
+ VALUE memo[2];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo[0] = Qundef;
+ memo[1] = Qnil;
+ rb_block_call(obj, id_each, 0, 0, max_by_i, (VALUE)memo);
+ return memo[1];
+}
+
+static VALUE
+minmax_by_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ VALUE v;
+
+ v = rb_yield(i);
+ if (memo[0] == Qundef) {
+ memo[0] = v;
+ memo[1] = v;
+ memo[2] = i;
+ memo[3] = i;
+ }
+ else {
+ if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) < 0) {
+ memo[0] = v;
+ memo[2] = i;
+ }
+ if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[1]), v, memo[1]) > 0) {
+ memo[1] = v;
+ memo[3] = i;
+ }
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.minmax_by {| obj| block } => [min, max]
+ *
+ * Returns two elements array array containing the objects in
+ * <i>enum</i> that gives the minimum and maximum values respectively
+ * from the given block.
+ *
+ * a = %w(albatross dog horse)
+ * a.minmax_by {|x| x.length } #=> ["dog", "albatross"]
+ */
+
+static VALUE
+enum_minmax_by(obj)
+ VALUE obj;
+{
+ VALUE memo[4];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo[0] = Qundef;
+ memo[1] = Qundef;
+ memo[2] = Qnil;
+ memo[3] = Qnil;
+ rb_block_call(obj, id_each, 0, 0, minmax_by_i, (VALUE)memo);
+ return rb_assoc_new(memo[2], memo[3]);
+}
+
+static VALUE
member_i(item, memo)
VALUE item;
VALUE *memo;
@@ -757,13 +1450,13 @@ member_i(item, memo)
* call-seq:
* enum.include?(obj) => true or false
* enum.member?(obj) => true or false
- *
+ *
* Returns <code>true</code> if any member of <i>enum</i> equals
* <i>obj</i>. Equality is tested using <code>==</code>.
- *
+ *
* IO.constants.include? "SEEK_SET" #=> true
* IO.constants.include? "SEEK_NO_FURTHER" #=> false
- *
+ *
*/
static VALUE
@@ -791,29 +1484,56 @@ each_with_index_i(val, memo)
/*
* call-seq:
* enum.each_with_index {|obj, i| block } -> enum
- *
+ *
* Calls <em>block</em> with two arguments, the item and its index, for
* each item in <i>enum</i>.
- *
+ *
* hash = Hash.new
* %w(cat dog wombat).each_with_index {|item, index|
* hash[item] = index
* }
* hash #=> {"cat"=>0, "wombat"=>2, "dog"=>1}
- *
+ *
*/
static VALUE
enum_each_with_index(obj)
VALUE obj;
{
- VALUE memo = 0;
+ VALUE memo;
- rb_need_block();
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo = 0;
rb_iterate(rb_each, obj, each_with_index_i, (VALUE)&memo);
return obj;
}
+/*
+ * call-seq:
+ * enum.reverse_each {|item| block }
+ *
+ * Traverses <i>enum</i> in reverse order.
+ */
+
+static VALUE
+enum_reverse_each(int argc, VALUE *argv, VALUE obj)
+{
+ VALUE ary;
+ long i;
+
+ RETURN_ENUMERATOR(obj, argc, argv);
+
+ ary = enum_to_a(argc, argv, obj);
+
+ for (i = RARRAY_LEN(ary); --i >= 0; ) {
+ rb_yield(RARRAY_PTR(ary)[i]);
+ }
+
+ return obj;
+}
+
+
static VALUE
zip_i(val, memo)
VALUE val;
@@ -843,7 +1563,7 @@ zip_i(val, memo)
* call-seq:
* enum.zip(arg, ...) => array
* enum.zip(arg, ...) {|arr| block } => nil
- *
+ *
* Converts any arguments to arrays, then merges elements of
* <i>enum</i> with corresponding elements from each argument. This
* generates a sequence of <code>enum#size</code> <em>n</em>-element
@@ -852,14 +1572,14 @@ zip_i(val, memo)
* <code>nil</code> values are supplied. If a block given, it is
* invoked for each output array, otherwise an array of arrays is
* returned.
- *
+ *
* a = [ 4, 5, 6 ]
* b = [ 7, 8, 9 ]
- *
+ *
* (1..3).zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
* "cat\ndog".zip([1]) #=> [["cat\n", 1], ["dog", nil]]
* (1..3).zip #=> [[1], [2], [3]]
- *
+ *
*/
static VALUE
@@ -884,6 +1604,227 @@ enum_zip(argc, argv, obj)
return result;
}
+static VALUE
+take_i(i, arg)
+ VALUE i;
+ VALUE *arg;
+{
+ if (arg[1]-- == 0) rb_iter_break();
+ rb_ary_push(arg[0], i);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.take(n) => array
+ *
+ * Returns first n elements from <i>enum</i>.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take(3) # => [1, 2, 3]
+ *
+ */
+
+static VALUE
+enum_take(obj, n)
+ VALUE obj;
+ VALUE n;
+{
+ VALUE args[2];
+ long len = NUM2LONG(n);
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to take negative size");
+ }
+
+ args[1] = len;
+ args[0] = rb_ary_new();
+ rb_block_call(obj, id_each, 0, 0, take_i, (VALUE)args);
+ return args[0];
+}
+
+
+static VALUE
+take_while_i(i, ary)
+ VALUE i;
+ VALUE *ary;
+{
+ if (!RTEST(rb_yield(i))) rb_iter_break();
+ rb_ary_push(*ary, i);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.take_while {|arr| block } => array
+ *
+ * Passes elements to the block until the block returns nil or false,
+ * then stops iterating and returns an array of all prior elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take_while {|i| i < 3 } # => [1, 2]
+ *
+ */
+
+static VALUE
+enum_take_while(obj)
+ VALUE obj;
+{
+ VALUE ary;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+ ary = rb_ary_new();
+ rb_block_call(obj, id_each, 0, 0, take_while_i, (VALUE)&ary);
+ return ary;
+}
+
+static VALUE
+drop_i(i, arg)
+ VALUE i;
+ VALUE *arg;
+{
+ if (arg[1] == 0) {
+ rb_ary_push(arg[0], i);
+ }
+ else {
+ arg[1]--;
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.drop(n) => array
+ *
+ * Drops first n elements from <i>enum</i>, and returns rest elements
+ * in an array.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop(3) # => [4, 5, 0]
+ *
+ */
+
+static VALUE
+enum_drop(obj, n)
+ VALUE obj;
+ VALUE n;
+{
+ VALUE args[2];
+ long len = NUM2LONG(n);
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to drop negative size");
+ }
+
+ args[1] = len;
+ args[0] = rb_ary_new();
+ rb_block_call(obj, id_each, 0, 0, drop_i, (VALUE)args);
+ return args[0];
+}
+
+
+static VALUE
+drop_while_i(i, args)
+ VALUE i;
+ VALUE *args;
+{
+ if (!args[1] && !RTEST(rb_yield(i))) {
+ args[1] = Qtrue;
+ }
+ if (args[1]) {
+ rb_ary_push(args[0], i);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.drop_while {|arr| block } => array
+ *
+ * Drops elements up to, but not including, the first element for
+ * which the block returns nil or false and returns an array
+ * containing the remaining elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
+ *
+ */
+
+static VALUE
+enum_drop_while(obj)
+ VALUE obj;
+{
+ VALUE args[2];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+ args[0] = rb_ary_new();
+ args[1] = Qfalse;
+ rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)args);
+ return args[0];
+}
+
+static VALUE
+cycle_i(i, ary)
+ VALUE i;
+ VALUE ary;
+{
+ rb_ary_push(ary, i);
+ rb_yield(i);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.cycle {|obj| block }
+ * enum.cycle(n) {|obj| block }
+ *
+ * Calls <i>block</i> for each element of <i>enum</i> repeatedly _n_
+ * times or forever if none or nil is given. If a non-positive
+ * number is given or the collection is empty, does nothing. Returns
+ * nil if the loop has finished without getting interrupted.
+ *
+ * Enumerable#cycle saves elements in an internal array so changes
+ * to <i>enum</i> after the first pass have no effect.
+ *
+ * a = ["a", "b", "c"]
+ * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
+ * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
+ *
+ */
+
+static VALUE
+enum_cycle(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE ary;
+ VALUE nv = Qnil;
+ long n, i, len;
+
+ rb_scan_args(argc, argv, "01", &nv);
+
+ RETURN_ENUMERATOR(obj, argc, argv);
+ if (NIL_P(nv)) {
+ n = -1;
+ }
+ else {
+ n = NUM2LONG(nv);
+ if (n <= 0) return Qnil;
+ }
+ ary = rb_ary_new();
+ RBASIC(ary)->klass = 0;
+ rb_block_call(obj, id_each, 0, 0, cycle_i, ary);
+ len = RARRAY(ary)->len;
+ if (len == 0) return Qnil;
+ while (n < 0 || 0 < --n) {
+ for (i=0; i<len; i++) {
+ rb_yield(RARRAY(ary)->ptr[i]);
+ }
+ }
+ return Qnil; /* not reached */
+}
+
/*
* The <code>Enumerable</code> mixin provides collection classes with
* several traversal and searching methods, and with the ability to
@@ -900,32 +1841,51 @@ Init_Enumerable()
{
rb_mEnumerable = rb_define_module("Enumerable");
- rb_define_method(rb_mEnumerable,"to_a", enum_to_a, 0);
- rb_define_method(rb_mEnumerable,"entries", enum_to_a, 0);
-
- rb_define_method(rb_mEnumerable,"sort", enum_sort, 0);
- rb_define_method(rb_mEnumerable,"sort_by", enum_sort_by, 0);
- rb_define_method(rb_mEnumerable,"grep", enum_grep, 1);
- rb_define_method(rb_mEnumerable,"find", enum_find, -1);
- rb_define_method(rb_mEnumerable,"detect", enum_find, -1);
- rb_define_method(rb_mEnumerable,"find_all", enum_find_all, 0);
- rb_define_method(rb_mEnumerable,"select", enum_find_all, 0);
- rb_define_method(rb_mEnumerable,"reject", enum_reject, 0);
- rb_define_method(rb_mEnumerable,"collect", enum_collect, 0);
- rb_define_method(rb_mEnumerable,"map", enum_collect, 0);
- rb_define_method(rb_mEnumerable,"inject", enum_inject, -1);
- rb_define_method(rb_mEnumerable,"partition", enum_partition, 0);
- rb_define_method(rb_mEnumerable,"all?", enum_all, 0);
- rb_define_method(rb_mEnumerable,"any?", enum_any, 0);
- rb_define_method(rb_mEnumerable,"min", enum_min, 0);
- rb_define_method(rb_mEnumerable,"max", enum_max, 0);
- rb_define_method(rb_mEnumerable,"member?", enum_member, 1);
- rb_define_method(rb_mEnumerable,"include?", enum_member, 1);
- rb_define_method(rb_mEnumerable,"each_with_index", enum_each_with_index, 0);
+ rb_define_method(rb_mEnumerable, "to_a", enum_to_a, -1);
+ rb_define_method(rb_mEnumerable, "entries", enum_to_a, -1);
+
+ rb_define_method(rb_mEnumerable, "sort", enum_sort, 0);
+ rb_define_method(rb_mEnumerable, "sort_by", enum_sort_by, 0);
+ rb_define_method(rb_mEnumerable, "grep", enum_grep, 1);
+ rb_define_method(rb_mEnumerable, "count", enum_count, -1);
+ rb_define_method(rb_mEnumerable, "find", enum_find, -1);
+ rb_define_method(rb_mEnumerable, "detect", enum_find, -1);
+ rb_define_method(rb_mEnumerable, "find_index", enum_find_index, -1);
+ rb_define_method(rb_mEnumerable, "find_all", enum_find_all, 0);
+ rb_define_method(rb_mEnumerable, "select", enum_find_all, 0);
+ rb_define_method(rb_mEnumerable, "reject", enum_reject, 0);
+ rb_define_method(rb_mEnumerable, "collect", enum_collect, 0);
+ rb_define_method(rb_mEnumerable, "map", enum_collect, 0);
+ rb_define_method(rb_mEnumerable, "inject", enum_inject, -1);
+ rb_define_method(rb_mEnumerable, "reduce", enum_inject, -1);
+ rb_define_method(rb_mEnumerable, "partition", enum_partition, 0);
+ rb_define_method(rb_mEnumerable, "group_by", enum_group_by, 0);
+ rb_define_method(rb_mEnumerable, "first", enum_first, -1);
+ rb_define_method(rb_mEnumerable, "all?", enum_all, 0);
+ rb_define_method(rb_mEnumerable, "any?", enum_any, 0);
+ rb_define_method(rb_mEnumerable, "one?", enum_one, 0);
+ rb_define_method(rb_mEnumerable, "none?", enum_none, 0);
+ rb_define_method(rb_mEnumerable, "min", enum_min, 0);
+ rb_define_method(rb_mEnumerable, "max", enum_max, 0);
+ rb_define_method(rb_mEnumerable, "minmax", enum_minmax, 0);
+ rb_define_method(rb_mEnumerable, "min_by", enum_min_by, 0);
+ rb_define_method(rb_mEnumerable, "max_by", enum_max_by, 0);
+ rb_define_method(rb_mEnumerable, "minmax_by", enum_minmax_by, 0);
+ rb_define_method(rb_mEnumerable, "member?", enum_member, 1);
+ rb_define_method(rb_mEnumerable, "include?", enum_member, 1);
+ rb_define_method(rb_mEnumerable, "each_with_index", enum_each_with_index, 0);
+ rb_define_method(rb_mEnumerable, "enum_with_index", enum_each_with_index, 0);
+ rb_define_method(rb_mEnumerable, "reverse_each", enum_reverse_each, -1);
rb_define_method(rb_mEnumerable, "zip", enum_zip, -1);
+ rb_define_method(rb_mEnumerable, "take", enum_take, 1);
+ rb_define_method(rb_mEnumerable, "take_while", enum_take_while, 0);
+ rb_define_method(rb_mEnumerable, "drop", enum_drop, 1);
+ rb_define_method(rb_mEnumerable, "drop_while", enum_drop_while, 0);
+ rb_define_method(rb_mEnumerable, "cycle", enum_cycle, -1);
id_eqq = rb_intern("===");
id_each = rb_intern("each");
id_cmp = rb_intern("<=>");
+ id_size = rb_intern("size");
}
diff --git a/enumerator.c b/enumerator.c
new file mode 100644
index 0000000000..f95d931b62
--- /dev/null
+++ b/enumerator.c
@@ -0,0 +1,450 @@
+/************************************************
+
+ enumerator.c - provides Enumerator class
+
+ $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$
+
+************************************************/
+
+#include "ruby.h"
+
+/*
+ * Document-class: Enumerable::Enumerator
+ *
+ * A class which provides a method `each' to be used as an Enumerable
+ * object.
+ */
+VALUE rb_cEnumerator;
+static VALUE sym_each;
+
+VALUE rb_eStopIteration;
+
+struct enumerator {
+ VALUE obj;
+ ID meth;
+ VALUE proc;
+ VALUE args;
+ rb_block_call_func *iter;
+};
+
+static void enumerator_mark _((void *));
+static void
+enumerator_mark(p)
+ void *p;
+{
+ struct enumerator *ptr = p;
+ rb_gc_mark(ptr->obj);
+ rb_gc_mark(ptr->args);
+}
+
+static struct enumerator *
+enumerator_ptr(obj)
+ VALUE obj;
+{
+ struct enumerator *ptr;
+
+ Data_Get_Struct(obj, struct enumerator, ptr);
+ if (RDATA(obj)->dmark != enumerator_mark) {
+ rb_raise(rb_eTypeError,
+ "wrong argument type %s (expected Enumerable::Enumerator)",
+ rb_obj_classname(obj));
+ }
+ if (!ptr || ptr->obj == Qundef) {
+ rb_raise(rb_eArgError, "uninitialized enumerator");
+ }
+ return ptr;
+}
+
+/*
+ * 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(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE meth = sym_each;
+
+ if (argc > 0) {
+ --argc;
+ meth = *argv++;
+ }
+ return rb_enumeratorize(obj, meth, argc, argv);
+}
+
+static VALUE
+each_slice_i(val, memo)
+ VALUE val;
+ VALUE *memo;
+{
+ VALUE ary = memo[0];
+ VALUE v = Qnil;
+ long size = (long)memo[1];
+
+ rb_ary_push(ary, val);
+
+ if (RARRAY_LEN(ary) == size) {
+ v = rb_yield(ary);
+ memo[0] = rb_ary_new2(size);
+ }
+
+ return v;
+}
+
+/*
+ * call-seq:
+ * e.each_slice(n) {...}
+ * e.each_slice(n)
+ *
+ * Iterates the given block for each slice of <n> elements. If no
+ * block is given, returns an enumerator.
+ *
+ * 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;
+{
+ long size = NUM2LONG(n);
+ VALUE args[2], ary;
+
+ if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
+ RETURN_ENUMERATOR(obj, 1, &n);
+ args[0] = rb_ary_new2(size);
+ args[1] = (VALUE)size;
+
+ rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_slice_i, (VALUE)args);
+
+ ary = args[0];
+ if (RARRAY_LEN(ary) > 0) rb_yield(ary);
+
+ return Qnil;
+}
+
+static VALUE
+each_cons_i(val, memo)
+ VALUE val;
+ VALUE *memo;
+{
+ VALUE ary = memo[0];
+ VALUE v = Qnil;
+ long size = (long)memo[1];
+
+ if (RARRAY_LEN(ary) == size) {
+ rb_ary_shift(ary);
+ }
+ rb_ary_push(ary, val);
+ if (RARRAY_LEN(ary) == size) {
+ v = rb_yield(rb_ary_dup(ary));
+ }
+ return v;
+}
+
+/*
+ * call-seq:
+ * each_cons(n) {...}
+ * each_cons(n)
+ *
+ * Iterates the given block for each array of consecutive <n>
+ * elements. If no block is given, returns an enumerator.a
+ *
+ * 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;
+{
+ long size = NUM2LONG(n);
+ VALUE args[2];
+
+ if (size <= 0) rb_raise(rb_eArgError, "invalid size");
+ RETURN_ENUMERATOR(obj, 1, &n);
+ args[0] = rb_ary_new2(size);
+ args[1] = (VALUE)size;
+
+ rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_cons_i, (VALUE)args);
+
+ return Qnil;
+}
+
+static VALUE enumerator_allocate _((VALUE));
+static VALUE
+enumerator_allocate(klass)
+ VALUE klass;
+{
+ struct enumerator *ptr;
+ VALUE enum_obj;
+
+ enum_obj = Data_Make_Struct(klass, struct enumerator,
+ enumerator_mark, -1, ptr);
+ ptr->obj = Qundef;
+
+ return enum_obj;
+}
+
+static VALUE enumerator_each_i _((VALUE, VALUE));
+static VALUE
+enumerator_each_i(v, enum_obj)
+ VALUE v;
+ VALUE enum_obj;
+{
+ return rb_yield(v);
+}
+
+static VALUE
+enumerator_init(enum_obj, obj, meth, argc, argv)
+ VALUE enum_obj;
+ VALUE obj;
+ VALUE meth;
+ int argc;
+ VALUE *argv;
+{
+ struct enumerator *ptr;
+
+ Data_Get_Struct(enum_obj, struct enumerator, ptr);
+
+ if (!ptr) {
+ rb_raise(rb_eArgError, "unallocated enumerator");
+ }
+
+ ptr->obj = obj;
+ ptr->meth = rb_to_id(meth);
+ ptr->iter = enumerator_each_i;
+ if (argc) ptr->args = rb_ary_new4(argc, argv);
+
+ return enum_obj;
+}
+
+/*
+ * 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.
+ *
+ * Use of this method is discouraged. Use Kernel#enum_for() instead.
+ */
+static VALUE
+enumerator_initialize(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE recv, meth = sym_each;
+
+ if (argc == 0)
+ rb_raise(rb_eArgError, "wrong number of argument (0 for 1)");
+ recv = *argv++;
+ if (--argc) {
+ meth = *argv++;
+ --argc;
+ }
+ return enumerator_init(obj, recv, meth, argc, argv);
+}
+
+/* :nodoc: */
+static VALUE
+enumerator_init_copy(obj, orig)
+ VALUE obj;
+ VALUE orig;
+{
+ struct enumerator *ptr0, *ptr1;
+
+ ptr0 = enumerator_ptr(orig);
+
+ Data_Get_Struct(obj, struct enumerator, ptr1);
+
+ if (!ptr1) {
+ rb_raise(rb_eArgError, "unallocated enumerator");
+ }
+
+ ptr1->obj = ptr0->obj;
+ ptr1->meth = ptr0->meth;
+ ptr1->iter = ptr0->iter;
+ ptr1->args = ptr0->args;
+
+ return obj;
+}
+
+VALUE
+rb_enumeratorize(obj, meth, argc, argv)
+ VALUE obj;
+ VALUE meth;
+ int argc;
+ VALUE *argv;
+{
+ return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, argv);
+}
+
+/*
+ * call-seq:
+ * enum.each {...}
+ *
+ * Iterates the given block using the object and the method specified
+ * in the first place. If no block is given, returns self.
+ *
+ */
+static VALUE
+enumerator_each(obj)
+ VALUE obj;
+{
+ struct enumerator *e;
+ int argc = 0;
+ VALUE *argv = 0;
+
+ if (!rb_block_given_p()) return obj;
+ e = enumerator_ptr(obj);
+ if (e->args) {
+ argc = RARRAY_LEN(e->args);
+ argv = RARRAY_PTR(e->args);
+ }
+ return rb_block_call(e->obj, e->meth, argc, argv, e->iter, (VALUE)e);
+}
+
+static VALUE
+enumerator_with_index_i(val, memo)
+ VALUE val;
+ VALUE *memo;
+{
+ val = rb_yield_values(2, val, INT2FIX(*memo));
+ ++*memo;
+ return val;
+}
+
+/*
+ * call-seq:
+ * e.with_index {|(*args), idx| ... }
+ * e.with_index
+ *
+ * Iterates the given block for each elements with an index, which
+ * start from 0. If no block is given, returns an enumerator.
+ *
+ */
+static VALUE
+enumerator_with_index(obj)
+ VALUE obj;
+{
+ struct enumerator *e = enumerator_ptr(obj);
+ VALUE memo = 0;
+ int argc = 0;
+ VALUE *argv = 0;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+ if (e->args) {
+ argc = RARRAY_LEN(e->args);
+ argv = RARRAY_PTR(e->args);
+ }
+ return rb_block_call(e->obj, e->meth, argc, argv,
+ enumerator_with_index_i, (VALUE)&memo);
+}
+
+/*
+ * call-seq:
+ * e.next => object
+ *
+ * Returns the next object in the enumerator, and move the internal
+ * position forward. When the position reached at the end, internal
+ * position is rewinded then StopIteration is raised.
+ *
+ * Note that enumeration sequence by next method does not affect other
+ * non-external enumeration methods, unless underlying iteration
+ * methods itself has side-effect, e.g. IO#each_line.
+ *
+ * Caution: Calling this method causes the "generator" library to be
+ * loaded.
+ */
+
+static VALUE
+enumerator_next(obj)
+ VALUE obj;
+{
+ rb_require("generator");
+ return rb_funcall(obj, rb_intern("next"), 0, 0);
+}
+
+/*
+ * call-seq:
+ * e.rewind => e
+ *
+ * Rewinds the enumeration sequence by the next method.
+ */
+
+static VALUE
+enumerator_rewind(obj)
+ VALUE obj;
+{
+ rb_require("generator");
+ return rb_funcall(obj, rb_intern("rewind"), 0, 0);
+}
+
+void
+Init_Enumerator()
+{
+ rb_define_method(rb_mKernel, "to_enum", obj_to_enum, -1);
+ rb_define_method(rb_mKernel, "enum_for", obj_to_enum, -1);
+
+ rb_define_method(rb_mEnumerable, "each_slice", enum_each_slice, 1);
+ rb_define_method(rb_mEnumerable, "enum_slice", enum_each_slice, 1);
+ rb_define_method(rb_mEnumerable, "each_cons", enum_each_cons, 1);
+ rb_define_method(rb_mEnumerable, "enum_cons", enum_each_cons, 1);
+
+ rb_cEnumerator = rb_define_class_under(rb_mEnumerable, "Enumerator", rb_cObject);
+ rb_include_module(rb_cEnumerator, rb_mEnumerable);
+
+ rb_define_alloc_func(rb_cEnumerator, enumerator_allocate);
+ rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
+ rb_define_method(rb_cEnumerator, "initialize_copy", enumerator_init_copy, 1);
+ rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
+ rb_define_method(rb_cEnumerator, "each_with_index", enumerator_with_index, 0);
+ rb_define_method(rb_cEnumerator, "with_index", enumerator_with_index, 0);
+ rb_define_method(rb_cEnumerator, "next", enumerator_next, 0);
+ rb_define_method(rb_cEnumerator, "rewind", enumerator_rewind, 0);
+
+ rb_eStopIteration = rb_define_class("StopIteration", rb_eIndexError);
+
+ sym_each = ID2SYM(rb_intern("each"));
+
+ rb_provide("enumerator.so"); /* for backward compatibility */
+}
diff --git a/env.h b/env.h
index c47c01d9db..c50103f71e 100644
--- a/env.h
+++ b/env.h
@@ -16,7 +16,6 @@
extern struct FRAME {
VALUE self;
int argc;
- VALUE *argv;
ID last_func;
ID orig_func;
VALUE last_class;
@@ -30,8 +29,8 @@ extern struct FRAME {
void rb_gc_mark_frame _((struct FRAME *));
-#define FRAME_ALLOCA 0
-#define FRAME_MALLOC 1
+#define FRAME_DMETH 1
+#define FRAME_FUNC 2
extern struct SCOPE {
struct RBasic super;
@@ -44,6 +43,7 @@ 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 febaad2c87..a991f55e57 100644
--- a/error.c
+++ b/error.c
@@ -29,7 +29,7 @@
#define EXIT_SUCCESS 0
#endif
-extern const char ruby_version[], ruby_release_date[], ruby_platform[];
+extern const char *ruby_description;
int ruby_nerrs;
@@ -208,8 +208,7 @@ rb_bug(fmt, va_alist)
va_init_list(args, fmt);
vfprintf(out, fmt, args);
va_end(args);
- fprintf(out, "\nruby %s (%s) [%s]\n\n",
- ruby_version, ruby_release_date, ruby_platform);
+ fprintf(out, "\n%s\n\n", ruby_description);
}
abort();
}
@@ -258,7 +257,7 @@ rb_check_type(x, t)
if (TYPE(x) != t) {
while (type->type >= 0) {
if (type->type == t) {
- char *etype;
+ const char *etype;
if (NIL_P(x)) {
etype = "nil";
@@ -303,7 +302,7 @@ VALUE rb_eNoMethodError;
VALUE rb_eSecurityError;
VALUE rb_eNotImpError;
VALUE rb_eNoMemError;
-static VALUE rb_cNameErrorMesg;
+VALUE rb_cNameErrorMesg;
VALUE rb_eScriptError;
VALUE rb_eSyntaxError;
@@ -334,7 +333,7 @@ rb_exc_new3(etype, str)
VALUE etype, str;
{
StringValue(str);
- return rb_exc_new(etype, RSTRING(str)->ptr, RSTRING(str)->len);
+ return rb_funcall(etype, rb_intern("new"), 1, str);
}
/*
@@ -488,18 +487,18 @@ static VALUE
exc_backtrace(exc)
VALUE exc;
{
- ID bt = rb_intern("bt");
+ static ID bt;
- if (!rb_ivar_defined(exc, bt)) return Qnil;
- return rb_ivar_get(exc, bt);
+ if (!bt) bt = rb_intern("bt");
+ return rb_attr_get(exc, bt);
}
-static VALUE
-check_backtrace(bt)
+VALUE
+rb_check_backtrace(bt)
VALUE bt;
{
long i;
- static char *err = "backtrace must be Array of String";
+ static const char err[] = "backtrace must be Array of String";
if (!NIL_P(bt)) {
int t = TYPE(bt);
@@ -532,7 +531,7 @@ exc_set_backtrace(exc, bt)
VALUE exc;
VALUE bt;
{
- return rb_iv_set(exc, "bt", check_backtrace(bt));
+ return rb_iv_set(exc, "bt", rb_check_backtrace(bt));
}
/*
@@ -728,7 +727,7 @@ name_err_mesg_to_str(obj)
mesg = ptr[0];
if (NIL_P(mesg)) return Qnil;
else {
- char *desc = 0;
+ const char *desc = 0;
VALUE d = 0, args[3];
obj = ptr[1];
@@ -882,7 +881,7 @@ syserr_initialize(argc, argv, self)
#if !defined(_WIN32) && !defined(__VMS)
char *strerror();
#endif
- char *err;
+ const char *err;
VALUE mesg, error;
VALUE klass = rb_obj_class(self);
@@ -952,18 +951,16 @@ syserr_eqq(self, exc)
VALUE self, exc;
{
VALUE num, e;
+ ID en = rb_intern("errno");
- if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
- if (self == rb_eSystemCallError) return Qtrue;
+ if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
+ if (!rb_respond_to(exc, en)) return Qfalse;
+ }
+ else if (self == rb_eSystemCallError) return Qtrue;
- num = rb_attr_get(exc, rb_intern("errno"));
+ num = rb_attr_get(exc, en);
if (NIL_P(num)) {
- VALUE klass = CLASS_OF(exc);
-
- while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
- klass = (VALUE)RCLASS(klass)->super;
- }
- num = rb_const_get(klass, rb_intern("Errno"));
+ num = rb_funcall(exc, en, 0, 0);
}
e = rb_const_get(self, rb_intern("Errno"));
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
@@ -1083,7 +1080,7 @@ void
rb_notimplement()
{
rb_raise(rb_eNotImpError,
- "the %s() function is unimplemented on this machine",
+ "%s() function is unimplemented on this machine",
rb_id2name(ruby_frame->last_func));
}
diff --git a/eval.c b/eval.c
index ee73317c09..d2a2556494 100644
--- a/eval.c
+++ b/eval.c
@@ -29,11 +29,6 @@
#endif
#include <stdio.h>
-#if defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT)
-#include <ucontext.h>
-#define USE_CONTEXT
-#endif
-#include <setjmp.h>
#include "st.h"
#include "dln.h"
@@ -53,9 +48,7 @@
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
-# ifdef _AIX
- #pragma alloca
-# else
+# ifndef _AIX
# ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca ();
# endif
@@ -79,6 +72,8 @@ char *strrchr _((const char*,const char));
#include <unistd.h>
#endif
+#include <time.h>
+
#ifdef __BEOS__
#include <net/socket.h>
#endif
@@ -92,10 +87,6 @@ char *strrchr _((const char*,const char));
#endif
#ifdef USE_CONTEXT
-typedef struct {
- ucontext_t context;
- volatile int status;
-} rb_jmpbuf_t[1];
NORETURN(static void rb_jump_context(rb_jmpbuf_t, int));
static inline void
@@ -108,7 +99,7 @@ rb_jump_context(env, val)
abort(); /* ensure noreturn */
}
/*
- * FUNCTION_CALL_MAY_RETURN_TWICE is a magic for getcontext, gcc,
+ * PRE_GETCONTEXT and POST_GETCONTEXT is a magic for getcontext, gcc,
* IA64 register stack and SPARC register window combination problem.
*
* Assume following code sequence.
@@ -129,42 +120,87 @@ rb_jump_context(env, val)
* But it has not the problem because gcc knows setjmp may return twice.
* gcc detects setjmp and generates setjmp safe code.
*
- * So setjmp call before getcontext call makes the code somewhat safe.
+ * 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
*/
-#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__))
-#define FUNCTION_CALL_MAY_RETURN_TWICE \
- ({ __asm__ volatile ("" : : : \
- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-#else
+# 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 = 0;
-#define FUNCTION_CALL_MAY_RETURN_TWICE \
- (function_call_may_return_twice_false ? \
- setjmp(function_call_may_return_twice_jmp_buf) : \
- 0)
-#endif
-#define ruby_longjmp(env, val) rb_jump_context(env, val)
-#define ruby_setjmp(j) ((j)->status = 0, \
- FUNCTION_CALL_MAY_RETURN_TWICE, \
- 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)
+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(just_before_setjmp, j) ((j)->status = 0, \
+ (just_before_setjmp), \
+ PRE_GETCONTEXT, \
+ getcontext(&(j)->context), \
+ POST_GETCONTEXT, \
+ (j)->status)
#else
-#define ruby_setjmp(env) setjmp(env)
-#define ruby_longjmp(env,val) longjmp(env,val)
-#endif
+# define ruby_setjmp(just_before_setjmp, env) \
+ ((just_before_setjmp), RUBY_SETJMP(env))
+# define ruby_longjmp(env,val) RUBY_LONGJMP(env,val)
+# ifdef __CYGWIN__
+int _setjmp(), _longjmp();
+# endif
#endif
#include <sys/types.h>
@@ -182,15 +218,16 @@ typedef jmp_buf rb_jmpbuf_t;
#include <sys/stat.h>
VALUE rb_cProc;
-static VALUE rb_cBinding;
+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*));
-static VALUE rb_cMethod;
+
+VALUE rb_cMethod;
static VALUE method_call _((int, VALUE*, VALUE));
-static VALUE rb_cUnboundMethod;
+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)));
@@ -205,6 +242,8 @@ static int scope_vmode;
#define SCOPE_SET(f) (scope_vmode=(f))
#define SCOPE_TEST(f) (scope_vmode&(f))
+VALUE (*ruby_sandbox_save)_((rb_thread_t));
+VALUE (*ruby_sandbox_restore)_((rb_thread_t));
NODE* ruby_current_node;
int ruby_safe_level = 0;
/* safe-level:
@@ -320,7 +359,8 @@ rb_clear_cache_for_undef(klass, id)
if (!ruby_running) return;
ent = cache; end = ent + CACHE_SIZE;
while (ent < end) {
- if (ent->origin == klass && ent->mid == id) {
+ if (ent->mid == id &&
+ RCLASS(ent->origin)->m_tbl == RCLASS(klass)->m_tbl) {
ent->mid = 0;
}
ent++;
@@ -412,7 +452,8 @@ rb_define_alloc_func(klass, func)
VALUE (*func) _((VALUE));
{
Check_Type(klass, T_CLASS);
- rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, NEW_CFUNC(func, 0), NOEX_PRIVATE);
+ rb_add_method(rb_singleton_class(klass), ID_ALLOCATOR, NEW_CFUNC(func, 0),
+ NOEX_PRIVATE);
}
void
@@ -420,7 +461,7 @@ rb_undef_alloc_func(klass)
VALUE klass;
{
Check_Type(klass, T_CLASS);
- rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, 0, NOEX_UNDEF);
+ rb_add_method(rb_singleton_class(klass), ID_ALLOCATOR, 0, NOEX_UNDEF);
}
static NODE*
@@ -428,16 +469,16 @@ search_method(klass, id, origin)
VALUE klass, *origin;
ID id;
{
- NODE *body;
+ st_data_t body;
if (!klass) return 0;
- while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *)&body)) {
+ while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
klass = RCLASS(klass)->super;
if (!klass) return 0;
}
if (origin) *origin = klass;
- return body;
+ return (NODE *)body;
}
static NODE*
@@ -448,7 +489,7 @@ rb_get_method_body(klassp, idp, noexp)
{
ID id = *idp;
VALUE klass = *klassp;
- VALUE origin;
+ VALUE origin = 0;
NODE * volatile body;
struct cache_entry *ent;
@@ -516,7 +557,8 @@ remove_method(klass, mid)
VALUE klass;
ID mid;
{
- NODE *body;
+ st_data_t data;
+ NODE *body = 0;
if (klass == rb_cObject) {
rb_secure(4);
@@ -528,8 +570,14 @@ remove_method(klass, mid)
if (mid == __id__ || mid == __send__ || mid == init) {
rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
}
- if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body) ||
- !body->nd_body) {
+ if (st_lookup(RCLASS(klass)->m_tbl, mid, &data)) {
+ body = (NODE *)data;
+ if (!body || !body->nd_body) body = 0;
+ else {
+ st_delete(RCLASS(klass)->m_tbl, &mid, &data);
+ }
+ }
+ if (!body) {
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}
@@ -699,8 +747,8 @@ extern NODE *ruby_eval_tree_begin;
extern NODE *ruby_eval_tree;
extern int ruby_nerrs;
-static VALUE rb_eLocalJumpError;
-static VALUE rb_eSysStackError;
+VALUE rb_eLocalJumpError;
+VALUE rb_eSysStackError;
extern VALUE ruby_top_self;
@@ -712,14 +760,13 @@ static struct SCOPE *top_scope;
static unsigned long frame_unique = 0;
#define PUSH_FRAME() do { \
- struct FRAME _frame; \
+ volatile struct FRAME _frame; \
_frame.prev = ruby_frame; \
_frame.tmp = 0; \
_frame.node = ruby_current_node; \
_frame.iter = ruby_iter->iter; \
_frame.argc = 0; \
- _frame.argv = 0; \
- _frame.flags = FRAME_ALLOCA; \
+ _frame.flags = 0; \
_frame.uniq = frame_unique++; \
ruby_frame = &_frame
@@ -752,7 +799,7 @@ struct BLOCK {
#define BLOCK_LAMBDA 2
static struct BLOCK *ruby_block;
-static unsigned long block_unique = 0;
+static unsigned long block_unique = 1;
#define PUSH_BLOCK(v,b) do { \
struct BLOCK _block; \
@@ -798,6 +845,8 @@ 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;
@@ -980,7 +1029,7 @@ 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() ruby_setjmp(((void)0), prot_tag->buf)
#define JUMP_TAG(st) do { \
ruby_frame = prot_tag->frame; \
@@ -1008,14 +1057,14 @@ VALUE ruby_class;
static VALUE ruby_wrapper; /* security wrapper */
#define PUSH_CLASS(c) do { \
- VALUE _class = ruby_class; \
+ volatile VALUE _class = ruby_class; \
ruby_class = (c)
#define POP_CLASS() ruby_class = _class; \
} while (0)
-static NODE *ruby_cref = 0;
-static NODE *top_cref;
+NODE *ruby_cref = 0;
+NODE *ruby_top_cref;
#define PUSH_CREF(c) ruby_cref = NEW_NODE(NODE_CREF,(c),0,ruby_cref)
#define POP_CREF() ruby_cref = ruby_cref->nd_next
@@ -1031,9 +1080,11 @@ static NODE *top_cref;
ruby_scope = _scope; \
scope_vmode = SCOPE_PUBLIC
-typedef struct thread * rb_thread_t;
-static rb_thread_t curr_thread = 0;
-static rb_thread_t main_thread;
+rb_thread_t rb_curr_thread;
+rb_thread_t rb_main_thread;
+#define main_thread rb_main_thread
+#define curr_thread rb_curr_thread
+
static void scope_dup _((struct SCOPE *));
#define POP_SCOPE() \
@@ -1054,8 +1105,8 @@ static void scope_dup _((struct SCOPE *));
} while (0)
static VALUE rb_eval _((VALUE,NODE*));
-static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
-static NODE *compile _((VALUE, char*, int));
+static VALUE eval _((VALUE,VALUE,VALUE,const char*,int));
+static NODE *compile _((VALUE, const char*, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
@@ -1064,8 +1115,9 @@ static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
#define YIELD_PUBLIC_DEF 4
#define YIELD_FUNC_AVALUE 1
#define YIELD_FUNC_SVALUE 2
+#define YIELD_FUNC_LAMBDA 3
-static VALUE rb_call _((VALUE,VALUE,ID,int,const VALUE*,int));
+static VALUE rb_call _((VALUE,VALUE,ID,int,const VALUE*,int,VALUE));
static VALUE module_setup _((VALUE,NODE*));
static VALUE massign _((VALUE,NODE*,VALUE,int));
@@ -1081,11 +1133,16 @@ static rb_event_hook_t *event_hooks;
#define EXEC_EVENT_HOOK(event, node, self, id, klass) \
do { \
- rb_event_hook_t *hook; \
+ rb_event_hook_t *hook = event_hooks; \
+ rb_event_hook_func_t hook_func; \
+ rb_event_t events; \
\
- for (hook = event_hooks; hook; hook = hook->next) { \
- if (hook->events & event) \
- (*hook->func)(event, node, self, id, klass); \
+ while (hook) { \
+ hook_func = hook->func; \
+ events = hook->events; \
+ hook = hook->next; \
+ if (events & event) \
+ (*hook_func)(event, node, self, id, klass); \
} \
} while (0)
@@ -1137,7 +1194,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->last_func));
+ rb_id2name(ruby_frame->orig_func));
}
else if (ruby_sourceline == 0) {
warn_printf("%s", ruby_sourcefile);
@@ -1148,6 +1205,8 @@ error_pos()
}
}
+VALUE rb_check_backtrace(VALUE);
+
static VALUE
get_backtrace(info)
VALUE info;
@@ -1155,7 +1214,7 @@ get_backtrace(info)
if (NIL_P(info)) return Qnil;
info = rb_funcall(info, rb_intern("backtrace"), 0);
if (NIL_P(info)) return Qnil;
- return rb_check_array_type(info);
+ return rb_check_backtrace(info);
}
static void
@@ -1170,7 +1229,7 @@ error_print()
{
VALUE errat = Qnil; /* OK */
volatile VALUE eclass, e;
- char *einfo;
+ const char *einfo;
long elen;
if (NIL_P(ruby_errinfo)) return;
@@ -1231,7 +1290,7 @@ error_print()
long len = elen;
if (RSTRING(epath)->ptr[0] == '#') epath = 0;
- if (tail = memchr(einfo, '\n', elen)) {
+ if ((tail = memchr(einfo, '\n', elen)) != 0) {
len = tail - einfo;
tail++; /* skip newline */
}
@@ -1242,8 +1301,9 @@ error_print()
warn_print2(RSTRING(epath)->ptr, RSTRING(epath)->len);
warn_print(")\n");
}
- if (tail) {
+ if (tail && elen>len+1) {
warn_print2(tail, elen-len-1);
+ if (einfo[elen-1] != '\n') warn_print2("\n", 1);
}
}
}
@@ -1251,6 +1311,7 @@ error_print()
if (!NIL_P(errat)) {
long i;
struct RArray *ep = RARRAY(errat);
+ int truncate = eclass == rb_eSysStackError;
#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
@@ -1261,7 +1322,7 @@ error_print()
if (TYPE(ep->ptr[i]) == T_STRING) {
warn_printf("\tfrom %s\n", RSTRING(ep->ptr[i])->ptr);
}
- if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
+ if (truncate && i == TRACE_HEAD && ep->len > TRACE_MAX) {
warn_printf("\t ... %ld levels...\n",
ep->len - TRACE_HEAD - TRACE_TAIL);
i = ep->len - TRACE_TAIL;
@@ -1290,6 +1351,15 @@ 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
@@ -1330,8 +1400,8 @@ ruby_init()
rb_call_inits();
ruby_class = rb_cObject;
ruby_frame->self = ruby_top_self;
- top_cref = rb_node_newnode(NODE_CREF,rb_cObject,0,0);
- ruby_cref = top_cref;
+ ruby_top_cref = rb_node_newnode(NODE_CREF,rb_cObject,0,0);
+ ruby_cref = ruby_top_cref;
rb_define_global_const("TOPLEVEL_BINDING", rb_f_binding(ruby_top_self));
#ifdef __MACOS__
_macruby_init();
@@ -1373,8 +1443,7 @@ int ruby_in_eval;
static void rb_thread_cleanup _((void));
static void rb_thread_wait_other_threads _((void));
-static int thread_set_raised();
-static int thread_reset_raised();
+static int thread_no_ensure _((void));
static VALUE exception_error;
static VALUE sysstack_error;
@@ -1392,8 +1461,10 @@ error_handle(ex)
int ex;
{
int status = EXIT_FAILURE;
+ rb_thread_t th = curr_thread;
- if (thread_set_raised()) return EXIT_FAILURE;
+ if (rb_thread_set_raised(th))
+ return EXIT_FAILURE;
switch (ex & TAG_MASK) {
case 0:
status = EXIT_SUCCESS;
@@ -1435,6 +1506,9 @@ error_handle(ex)
if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
status = sysexit_status(ruby_errinfo);
}
+ else if (rb_obj_is_instance_of(ruby_errinfo, rb_eSignal)) {
+ /* no message when exiting by signal */
+ }
else {
error_print();
}
@@ -1443,7 +1517,7 @@ error_handle(ex)
rb_bug("Unknown longjmp status %d", ex);
break;
}
- thread_reset_raised();
+ rb_thread_reset_raised(th);
return status;
}
@@ -1502,12 +1576,14 @@ ruby_cleanup(ex)
int ex;
{
int state;
- volatile VALUE err = ruby_errinfo;
+ volatile VALUE errs[2];
+ int nerr;
+ errs[1] = ruby_errinfo;
ruby_safe_level = 0;
- Init_stack((void*)&state);
+ Init_stack((void *)&state);
ruby_finalize_0();
- if (ruby_errinfo) err = ruby_errinfo;
+ errs[0] = ruby_errinfo;
PUSH_TAG(PROT_NONE);
PUSH_ITER(ITER_NOT);
if ((state = EXEC_TAG()) == 0) {
@@ -1518,15 +1594,39 @@ ruby_cleanup(ex)
ex = state;
}
POP_ITER();
- ruby_errinfo = err;
+ ruby_errinfo = errs[1];
ex = error_handle(ex);
ruby_finalize_1();
POP_TAG();
- if (err && rb_obj_is_kind_of(err, rb_eSystemExit)) {
- VALUE st = rb_iv_get(err, "status");
- return NUM2INT(st);
+ for (nerr = 0; nerr < sizeof(errs) / sizeof(errs[0]); ++nerr) {
+ VALUE err = errs[nerr];
+
+ if (!RTEST(err)) continue;
+
+ if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
+ return sysexit_status(err);
+ }
+ else if (rb_obj_is_kind_of(err, rb_eSignal)) {
+ VALUE sig = rb_iv_get(err, "signo");
+ ruby_default_signal(NUM2INT(sig));
+ }
+ else if (ex == 0) {
+ ex = 1;
+ }
+ }
+
+#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
+ switch (ex) {
+#if EXIT_SUCCESS != 0
+ case 0: return EXIT_SUCCESS;
+#endif
+#if EXIT_FAILURE != 1
+ case 1: return EXIT_FAILURE;
+#endif
}
+#endif
+
return ex;
}
@@ -1632,7 +1732,6 @@ 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);
@@ -1774,7 +1873,6 @@ 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);
@@ -1792,7 +1890,7 @@ rb_eval_cmd(cmd, arg, level)
POP_TAG();
POP_FRAME();
- jump_tag_but_local_jump(state, val);
+ if (state) jump_tag_but_local_jump(state, val);
return val;
}
@@ -1810,12 +1908,13 @@ ev_const_defined(cref, id, self)
while (cbase && cbase->nd_next) {
struct RClass *klass = RCLASS(cbase->nd_clss);
- 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;
+ 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;
}
- return Qtrue;
}
cbase = cbase->nd_next;
}
@@ -1834,17 +1933,19 @@ ev_const_get(cref, id, self)
while (cbase && cbase->nd_next) {
VALUE klass = cbase->nd_clss;
- 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;
+ 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;
}
- return result;
}
cbase = cbase->nd_next;
}
- return rb_const_get(cref->nd_clss, id);
+ return rb_const_get(NIL_P(cref->nd_clss) ? CLASS_OF(self): cref->nd_clss, id);
}
static VALUE
@@ -1932,7 +2033,7 @@ void
rb_frozen_class_p(klass)
VALUE klass;
{
- char *desc = "something(?!)";
+ const char *desc = "something(?!)";
if (OBJ_FROZEN(klass)) {
if (FL_TEST(klass, FL_SINGLETON))
@@ -1970,7 +2071,7 @@ rb_undef(klass, id)
}
body = search_method(klass, id, &origin);
if (!body || !body->nd_body) {
- char *s0 = " class";
+ const char *s0 = " class";
VALUE c = klass;
if (FL_TEST(c, FL_SINGLETON)) {
@@ -2061,9 +2162,10 @@ rb_alias(klass, name, def)
VALUE klass;
ID name, def;
{
- VALUE origin;
+ VALUE origin = 0;
NODE *orig, *body, *node;
VALUE singleton = 0;
+ st_data_t data;
rb_frozen_class_p(klass);
if (name == def) return;
@@ -2091,13 +2193,18 @@ rb_alias(klass, name, def)
}
rb_clear_cache_by_id(name);
- if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *)&node)) {
+ if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, &data)) {
+ node = (NODE *)data;
if (node->nd_cnt == 0 && node->nd_body) {
rb_warning("discarding old %s", rb_id2name(name));
}
}
st_insert(RCLASS(klass)->m_tbl, name,
- (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
+ (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin),
+ NOEX_WITH_SAFE(orig->nd_noex)));
+
+ if (!ruby_running) return;
+
if (singleton) {
rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
}
@@ -2136,8 +2243,8 @@ rb_mod_alias_method(mod, newname, oldname)
return mod;
}
-static NODE*
-copy_node_scope(node, rval)
+NODE *
+rb_copy_node_scope(node, rval)
NODE *node;
NODE *rval;
{
@@ -2164,18 +2271,18 @@ copy_node_scope(node, rval)
# define TMP_ALLOC(n) ALLOCA_N(VALUE,n)
#endif
-#define SETUP_ARGS0(anode,alen) do {\
+#define SETUP_ARGS0(anode,extra) do {\
NODE *n = anode;\
if (!n) {\
argc = 0;\
argv = 0;\
}\
else if (nd_type(n) == NODE_ARRAY) {\
- argc=alen;\
+ argc=anode->nd_alen;\
if (argc > 0) {\
int i;\
n = anode;\
- argv = TMP_ALLOC(argc);\
+ argv = TMP_ALLOC(argc+extra);\
for (i=0;i<argc;i++) {\
argv[i] = rb_eval(self,n->nd_head);\
n=n->nd_next;\
@@ -2191,19 +2298,19 @@ copy_node_scope(node, rval)
if (TYPE(args) != T_ARRAY)\
args = rb_ary_to_ary(args);\
argc = RARRAY(args)->len;\
- argv = ALLOCA_N(VALUE, argc);\
+ argv = TMP_ALLOC(argc+extra);\
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\
}\
} while (0)
-#define SETUP_ARGS(anode) SETUP_ARGS0(anode, anode->nd_alen)
+#define SETUP_ARGS(anode) SETUP_ARGS0(anode,0)
#define BEGIN_CALLARGS do {\
struct BLOCK *tmp_block = ruby_block;\
int tmp_iter = ruby_iter->iter;\
switch (tmp_iter) {\
case ITER_PRE:\
- ruby_block = ruby_block->outer;\
+ if (ruby_block) ruby_block = ruby_block->outer;\
case ITER_PAS:\
tmp_iter = ITER_NOT;\
}\
@@ -2216,9 +2323,9 @@ copy_node_scope(node, rval)
#define MATCH_DATA *rb_svar(node->nd_cnt)
-static char* is_defined _((VALUE, NODE*, char*));
+static const char* is_defined _((VALUE, NODE*, char*));
-static char*
+static const char*
arg_defined(self, node, buf, type)
VALUE self;
NODE *node;
@@ -2245,7 +2352,7 @@ arg_defined(self, node, buf, type)
return type;
}
-static char*
+static const char*
is_defined(self, node, buf)
VALUE self;
NODE *node; /* OK */
@@ -2259,7 +2366,7 @@ is_defined(self, node, buf)
switch (nd_type(node)) {
case NODE_SUPER:
case NODE_ZSUPER:
- if (ruby_frame->orig_func == 0) return 0;
+ if (ruby_frame->last_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)) {
@@ -2338,6 +2445,8 @@ is_defined(self, node, buf)
case NODE_ATTRSET:
case NODE_OP_ASGN1:
case NODE_OP_ASGN2:
+ case NODE_OP_ASGN_OR:
+ case NODE_OP_ASGN_AND:
case NODE_MASGN:
case NODE_LASGN:
case NODE_DASGN:
@@ -2545,6 +2654,7 @@ set_trace_func(obj, trace)
{
rb_event_hook_t *hook;
+ rb_secure(4);
if (NIL_P(trace)) {
trace_func = 0;
rb_remove_event_hook(call_trace_func);
@@ -2562,27 +2672,27 @@ set_trace_func(obj, trace)
return trace;
}
-static char *
+static const char *
get_event_name(rb_event_t event)
{
switch (event) {
- case RUBY_EVENT_LINE:
+ case RUBY_EVENT_LINE:
return "line";
- case RUBY_EVENT_CLASS:
+ case RUBY_EVENT_CLASS:
return "class";
- case RUBY_EVENT_END:
+ case RUBY_EVENT_END:
return "end";
- case RUBY_EVENT_CALL:
+ case RUBY_EVENT_CALL:
return "call";
- case RUBY_EVENT_RETURN:
+ case RUBY_EVENT_RETURN:
return "return";
- case RUBY_EVENT_C_CALL:
+ case RUBY_EVENT_C_CALL:
return "c-call";
- case RUBY_EVENT_C_RETURN:
+ case RUBY_EVENT_C_RETURN:
return "c-return";
- case RUBY_EVENT_RAISE:
+ case RUBY_EVENT_RAISE:
return "raise";
- default:
+ default:
return "unknown";
}
}
@@ -2599,7 +2709,8 @@ call_trace_func(event, node, self, id, klass)
struct FRAME *prev;
NODE *node_save;
VALUE srcfile;
- char *event_name;
+ const char *event_name;
+ rb_thread_t th = curr_thread;
if (!trace_func) return;
if (tracing) return;
@@ -2627,11 +2738,11 @@ call_trace_func(event, node, self, id, klass)
klass = RBASIC(klass)->klass;
}
else if (FL_TEST(klass, FL_SINGLETON)) {
- klass = self;
+ klass = rb_iv_get(klass, "__attached__");
}
}
PUSH_TAG(PROT_NONE);
- raised = thread_reset_raised();
+ raised = rb_thread_reset_raised(th);
if ((state = EXEC_TAG()) == 0) {
srcfile = rb_str_new2(ruby_sourcefile?ruby_sourcefile:"(ruby)");
event_name = get_event_name(event);
@@ -2643,7 +2754,7 @@ call_trace_func(event, node, self, id, klass)
klass),
Qundef, 0);
}
- if (raised) thread_set_raised();
+ if (raised) rb_thread_set_raised(th);
POP_TAG();
POP_FRAME();
@@ -2807,6 +2918,7 @@ 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
@@ -2814,7 +2926,15 @@ unknown_node(node)
NODE *volatile node;
{
ruby_current_node = 0;
- rb_bug("unknown node type %d", nd_type(node));
+ 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
@@ -2826,6 +2946,7 @@ rb_eval(self, n)
NODE * volatile node = n;
int state;
volatile VALUE result = Qnil;
+ st_data_t data;
#define RETURN(v) do { \
result = (v); \
@@ -2925,13 +3046,16 @@ 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 (RTEST(rb_eval(self, node->nd_cond))) {
+ EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
node = node->nd_body;
}
else {
+ EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
node = node->nd_else;
}
goto again;
@@ -3108,7 +3232,7 @@ rb_eval(self, n)
END_CALLARGS;
ruby_current_node = node;
SET_CURRENT_SOURCE();
- result = rb_call(CLASS_OF(recv),recv,each,0,0,0);
+ result = rb_call(CLASS_OF(recv),recv,each,0,0,0,self);
}
POP_ITER();
}
@@ -3137,8 +3261,7 @@ rb_eval(self, n)
case NODE_NEXT:
CHECK_INTS;
- return_value(rb_eval(self, node->nd_stts));
- JUMP_TAG(TAG_NEXT);
+ next_jump(rb_eval(self, node->nd_stts));
break;
case NODE_REDO:
@@ -3220,7 +3343,6 @@ 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 */
@@ -3236,7 +3358,7 @@ rb_eval(self, n)
result = rb_eval(self, node->nd_head);
}
POP_TAG();
- if (node->nd_ensr) {
+ if (node->nd_ensr && !thread_no_ensure()) {
VALUE retval = prot_tag->retval; /* save retval */
VALUE errinfo = ruby_errinfo;
@@ -3351,7 +3473,7 @@ rb_eval(self, n)
ruby_current_node = node;
SET_CURRENT_SOURCE();
- rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,scope);
+ rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,scope,self);
result = argv[argc-1];
}
break;
@@ -3369,7 +3491,7 @@ rb_eval(self, n)
ruby_current_node = node;
SET_CURRENT_SOURCE();
- result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0);
+ result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0,self);
}
break;
@@ -3384,13 +3506,13 @@ rb_eval(self, n)
ruby_current_node = node;
SET_CURRENT_SOURCE();
- result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1);
+ result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1,self);
}
break;
case NODE_VCALL:
SET_CURRENT_SOURCE();
- result = rb_call(CLASS_OF(self),self,node->nd_mid,0,0,2);
+ result = rb_call(CLASS_OF(self),self,node->nd_mid,0,0,2,self);
break;
case NODE_SUPER:
@@ -3400,7 +3522,7 @@ rb_eval(self, n)
TMP_PROTECT;
if (ruby_frame->last_class == 0) {
- if (ruby_frame->orig_func) {
+ if (ruby_frame->last_func) {
rb_name_error(ruby_frame->last_func,
"superclass method `%s' disabled",
rb_id2name(ruby_frame->orig_func));
@@ -3411,7 +3533,21 @@ rb_eval(self, n)
}
if (nd_type(node) == NODE_ZSUPER) {
argc = ruby_frame->argc;
- argv = ruby_frame->argv;
+ 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 if (!ruby_scope->local_vars) {
+ argc = 0;
+ argv = 0;
+ }
+ else {
+ argv = ruby_scope->local_vars + 2;
+ }
}
else {
BEGIN_CALLARGS;
@@ -3466,28 +3602,29 @@ rb_eval(self, n)
case NODE_OP_ASGN1:
{
int argc; VALUE *argv; /* used in SETUP_ARGS */
- VALUE recv, val;
+ VALUE recv, val, tmp;
NODE *rval;
TMP_PROTECT;
recv = rb_eval(self, node->nd_recv);
rval = node->nd_args->nd_head;
- SETUP_ARGS0(node->nd_args->nd_next, node->nd_args->nd_alen - 1);
- val = rb_funcall2(recv, aref, argc-1, argv);
+ SETUP_ARGS0(node->nd_args->nd_body, 1);
+ val = rb_funcall3(recv, aref, argc, 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:
- val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
+ tmp = rb_eval(self, rval);
+ val = rb_funcall3(val, node->nd_mid, 1, &tmp);
}
- argv[argc-1] = val;
- rb_funcall2(recv, aset, argc, argv);
+ argv[argc] = val;
+ rb_funcall2(recv, aset, argc+1, argv);
result = val;
}
break;
@@ -3495,22 +3632,22 @@ rb_eval(self, n)
case NODE_OP_ASGN2:
{
ID id = node->nd_next->nd_vid;
- VALUE recv, val;
+ VALUE recv, val, tmp;
recv = rb_eval(self, node->nd_recv);
- val = rb_funcall(recv, id, 0);
+ val = rb_funcall3(recv, id, 0, 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:
- val = rb_funcall(val, node->nd_next->nd_mid, 1,
- rb_eval(self, node->nd_value));
+ tmp = rb_eval(self, node->nd_value);
+ val = rb_funcall3(val, node->nd_next->nd_mid, 1, &tmp);
}
rb_funcall2(recv, node->nd_next->nd_aid, 1, &val);
@@ -3569,9 +3706,6 @@ 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;
@@ -3786,17 +3920,10 @@ 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;
- VALUE origin;
+ VALUE origin = 0;
int noex;
if (NIL_P(ruby_class)) {
@@ -3830,7 +3957,7 @@ rb_eval(self, n)
noex |= NOEX_NOSUPER;
}
- defn = copy_node_scope(node->nd_defn, ruby_cref);
+ defn = rb_copy_node_scope(node->nd_defn, ruby_cref);
rb_add_method(ruby_class, node->nd_mid, defn, noex);
if (scope_vmode == SCOPE_MODFUNC) {
rb_add_method(rb_singleton_class(ruby_class),
@@ -3858,7 +3985,8 @@ rb_eval(self, n)
if (OBJ_FROZEN(recv)) rb_error_frozen("object");
klass = rb_singleton_class(recv);
- if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, (st_data_t *)&body)) {
+ if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &data)) {
+ body = (NODE *)data;
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError, "redefining method prohibited");
}
@@ -3866,7 +3994,7 @@ rb_eval(self, n)
rb_warning("redefine %s", rb_id2name(node->nd_mid));
}
}
- defn = copy_node_scope(node->nd_defn, ruby_cref);
+ defn = rb_copy_node_scope(node->nd_defn, ruby_cref);
rb_add_method(klass, node->nd_mid, defn,
NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
result = Qnil;
@@ -3877,7 +4005,7 @@ rb_eval(self, n)
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class to undef method");
}
- rb_undef(ruby_class, node->nd_mid);
+ rb_undef(ruby_class, rb_to_id(rb_eval(self, node->u2.node)));
result = Qnil;
break;
@@ -3885,12 +4013,13 @@ rb_eval(self, n)
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class to make alias");
}
- rb_alias(ruby_class, node->nd_new, node->nd_old);
+ rb_alias(ruby_class, rb_to_id(rb_eval(self, node->u1.node)),
+ rb_to_id(rb_eval(self, node->u2.node)));
result = Qnil;
break;
case NODE_VALIAS:
- rb_alias_variable(node->nd_new, node->nd_old);
+ rb_alias_variable(node->u1.id, node->u2.id);
result = Qnil;
break;
@@ -4009,7 +4138,7 @@ rb_eval(self, n)
case NODE_DEFINED:
{
char buf[20];
- char *desc = is_defined(self, node->nd_head, buf);
+ const char *desc = is_defined(self, node->nd_head, buf);
if (desc) result = rb_str_new2(desc);
else result = Qnil;
@@ -4091,21 +4220,32 @@ module_setup(module, n)
static NODE *basic_respond_to = 0;
int
-rb_respond_to(obj, id)
+rb_obj_respond_to(obj, id, priv)
VALUE obj;
ID id;
+ int priv;
{
VALUE klass = CLASS_OF(obj);
- if (rb_method_node(klass, respond_to) == basic_respond_to &&
- rb_method_boundp(klass, id, 0)) {
- return Qtrue;
+
+ if (rb_method_node(klass, respond_to) == basic_respond_to) {
+ return rb_method_boundp(klass, id, !priv);
}
- else{
- return rb_funcall(obj, respond_to, 1, ID2SYM(id));
+ else {
+ VALUE args[2];
+ int n = 0;
+ args[n++] = ID2SYM(id);
+ if (priv) args[n++] = Qtrue;
+ return RTEST(rb_funcall2(obj, respond_to, n, args));
}
- return Qfalse;
}
+int
+rb_respond_to(obj, id)
+ VALUE obj;
+ ID id;
+{
+ return rb_obj_respond_to(obj, id, Qfalse);
+}
/*
* call-seq:
@@ -4117,7 +4257,7 @@ rb_respond_to(obj, id)
*/
static VALUE
-rb_obj_respond_to(argc, argv, obj)
+obj_respond_to(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
@@ -4433,8 +4573,9 @@ rb_longjmp(tag, mesg)
VALUE mesg;
{
VALUE at;
+ rb_thread_t th = curr_thread;
- if (thread_set_raised()) {
+ if (rb_thread_set_raised(th)) {
ruby_errinfo = exception_error;
JUMP_TAG(TAG_FATAL);
}
@@ -4448,6 +4589,9 @@ rb_longjmp(tag, mesg)
at = get_backtrace(mesg);
if (NIL_P(at)) {
at = make_backtrace();
+ if (OBJ_FROZEN(mesg)) {
+ mesg = rb_obj_dup(mesg);
+ }
set_backtrace(mesg, at);
}
}
@@ -4473,7 +4617,7 @@ rb_longjmp(tag, mesg)
ruby_errinfo = mesg;
}
else if (status) {
- thread_reset_raised();
+ rb_thread_reset_raised(th);
JUMP_TAG(status);
}
}
@@ -4488,11 +4632,20 @@ rb_longjmp(tag, mesg)
if (!prot_tag) {
error_print();
}
- thread_reset_raised();
+ rb_thread_raised_clear(th);
JUMP_TAG(tag);
}
void
+rb_exc_jump(mesg)
+ VALUE mesg;
+{
+ rb_thread_raised_clear(rb_curr_thread);
+ ruby_errinfo = mesg;
+ JUMP_TAG(TAG_RAISE);
+}
+
+void
rb_exc_raise(mesg)
VALUE mesg;
{
@@ -4509,7 +4662,8 @@ rb_exc_fatal(mesg)
void
rb_interrupt()
{
- rb_raise(rb_eInterrupt, "");
+ static const char fmt[1] = {'\0'};
+ rb_raise(rb_eInterrupt, fmt);
}
/*
@@ -4656,7 +4810,7 @@ rb_f_block_given_p()
return Qfalse;
}
-static VALUE rb_eThreadError;
+VALUE rb_eThreadError;
NORETURN(static void proc_jump_error(int, VALUE));
static void
@@ -4665,7 +4819,7 @@ proc_jump_error(state, result)
VALUE result;
{
char mesg[32];
- char *statement;
+ const char *statement;
switch (state) {
case TAG_BREAK:
@@ -4740,6 +4894,32 @@ 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()
{
@@ -4753,7 +4933,7 @@ rb_yield_0(val, self, klass, flags, avalue)
VALUE val, self, klass; /* OK */
int flags, avalue;
{
- NODE *node;
+ NODE *node, *var;
volatile VALUE result = Qnil;
volatile VALUE old_cref;
volatile VALUE old_wrapper;
@@ -4795,27 +4975,35 @@ rb_yield_0(val, self, klass, flags, avalue)
self = block->self;
}
node = block->body;
+ var = block->var;
- if (block->var) {
+ if (var) {
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
- if (block->var == (NODE*)1) { /* no parameter || */
+ NODE *bvar = NULL;
+ block_var:
+ if (var == (NODE*)1) { /* no parameter || */
if (lambda && RARRAY(val)->len != 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)",
RARRAY(val)->len);
}
}
- else if (block->var == (NODE*)2) {
+ else if (var == (NODE*)2) {
if (TYPE(val) == T_ARRAY && RARRAY(val)->len != 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)",
RARRAY(val)->len);
}
}
- else if (nd_type(block->var) == NODE_MASGN) {
+ else if (!bvar && nd_type(var) == NODE_BLOCK_PASS) {
+ bvar = var->nd_body;
+ var = var->nd_args;
+ goto block_var;
+ }
+ else if (nd_type(var) == NODE_MASGN) {
if (!avalue) {
- val = svalue_to_mrhs(val, block->var->nd_head);
+ val = svalue_to_mrhs(val, var->nd_head);
}
- massign(self, block->var, val, lambda);
+ massign(self, var, val, lambda);
}
else {
int len = 0;
@@ -4836,13 +5024,21 @@ rb_yield_0(val, self, klass, flags, avalue)
val = Qnil;
multi_values:
{
- ruby_current_node = block->var;
+ ruby_current_node = var;
rb_warn("multiple values for a block parameter (%d for 1)\n\tfrom %s:%d",
len, cnode->nd_file, nd_line(cnode));
ruby_current_node = cnode;
}
}
- assign(self, block->var, val, lambda);
+ assign(self, var, val, lambda);
+ }
+ if (bvar) {
+ VALUE blk;
+ if (flags & YIELD_PROC_CALL)
+ blk = block->block_obj;
+ else
+ blk = rb_block_proc();
+ assign(self, bvar, blk, 0);
}
}
POP_TAG();
@@ -4859,12 +5055,18 @@ rb_yield_0(val, self, klass, flags, avalue)
if ((state = EXEC_TAG()) == 0) {
redo:
if (nd_type(node) == NODE_CFUNC || nd_type(node) == NODE_IFUNC) {
- if (node->nd_state == YIELD_FUNC_AVALUE) {
+ switch (node->nd_state) {
+ case YIELD_FUNC_LAMBDA:
+ if (!avalue) {
+ val = rb_ary_new3(1, val);
+ }
+ break;
+ case YIELD_FUNC_AVALUE:
if (!avalue) {
val = svalue_to_avalue(val);
}
- }
- else {
+ break;
+ default:
if (avalue) {
val = avalue_to_svalue(val);
}
@@ -4884,8 +5086,10 @@ rb_yield_0(val, self, klass, flags, avalue)
CHECK_INTS;
goto redo;
case TAG_NEXT:
- state = 0;
- result = prot_tag->retval;
+ if (!lambda) {
+ state = 0;
+ result = prot_tag->retval;
+ }
break;
case TAG_BREAK:
if (TAG_DST()) {
@@ -5000,6 +5204,16 @@ rb_yield_splat(values)
return rb_yield_0(values, 0, 0, 0, avalue);
}
+static VALUE
+loop_i()
+{
+ for (;;) {
+ rb_yield_0(Qundef, 0, 0, 0, Qfalse);
+ CHECK_INTS;
+ }
+ return Qnil;
+}
+
/*
* call-seq:
* loop {|| block }
@@ -5012,15 +5226,14 @@ rb_yield_splat(values)
* break if !line or line =~ /^qQ/
* # ...
* end
+ *
+ * StopIteration raised in the block breaks the loop.
*/
static VALUE
rb_f_loop()
{
- for (;;) {
- rb_yield_0(Qundef, 0, 0, 0, Qfalse);
- CHECK_INTS;
- }
+ rb_rescue2(loop_i, (VALUE)0, 0, 0, rb_eStopIteration, (VALUE)0);
return Qnil; /* dummy */
}
@@ -5147,7 +5360,7 @@ assign(self, lhs, val, pcall)
/* attr set */
ruby_current_node = lhs;
SET_CURRENT_SOURCE();
- rb_call(CLASS_OF(recv), recv, lhs->nd_mid, 1, &val, scope);
+ rb_call(CLASS_OF(recv), recv, lhs->nd_mid, 1, &val, scope, self);
}
else {
/* array set */
@@ -5158,7 +5371,7 @@ assign(self, lhs, val, pcall)
ruby_current_node = lhs;
SET_CURRENT_SOURCE();
rb_call(CLASS_OF(recv), recv, lhs->nd_mid,
- RARRAY(args)->len, RARRAY(args)->ptr, scope);
+ RARRAY(args)->len, RARRAY(args)->ptr, scope, self);
}
}
break;
@@ -5179,9 +5392,9 @@ rb_iterate(it_proc, data1, bl_proc, data2)
NODE *node = NEW_IFUNC(bl_proc, data2);
VALUE self = ruby_top_self;
- PUSH_ITER(ITER_PRE);
PUSH_TAG(PROT_LOOP);
PUSH_BLOCK(0, node);
+ PUSH_ITER(ITER_PRE);
state = EXEC_TAG();
if (state == 0) {
iter_retry:
@@ -5195,9 +5408,9 @@ rb_iterate(it_proc, data1, bl_proc, data2)
state = 0;
goto iter_retry;
}
+ POP_ITER();
POP_BLOCK();
POP_TAG();
- POP_ITER();
switch (state) {
case 0:
@@ -5265,7 +5478,7 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
if (handle) break;
handle = Qfalse;
va_init_list(args, data2);
- while (eclass = va_arg(args, VALUE)) {
+ while ((eclass = va_arg(args, VALUE)) != 0) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
handle = Qtrue;
break;
@@ -5343,7 +5556,9 @@ rb_ensure(b_proc, data1, e_proc, data2)
}
POP_TAG();
retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */
- (*e_proc)(data2);
+ if (!thread_no_ensure()) {
+ (*e_proc)(data2);
+ }
if (prot_tag) return_value(retval);
if (state) JUMP_TAG(state);
return result;
@@ -5375,21 +5590,14 @@ rb_with_disable_interrupt(proc, data)
return result;
}
-static inline void
+static void
stack_check()
{
- static int overflowing = 0;
+ rb_thread_t th = rb_curr_thread;
- if (!overflowing && ruby_stack_check()) {
- int state;
- overflowing = 1;
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- rb_exc_raise(sysstack_error);
- }
- POP_TAG();
- overflowing = 0;
- JUMP_TAG(state);
+ if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) && ruby_stack_check()) {
+ rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
+ rb_exc_raise(sysstack_error);
}
}
@@ -5438,7 +5646,7 @@ rb_method_missing(argc, argv, obj)
{
ID id;
VALUE exc = rb_eNoMethodError;
- char *format = 0;
+ const char *format = 0;
NODE *cnode = ruby_current_node;
if (argc == 0 || !SYMBOL_P(argv[0])) {
@@ -5505,11 +5713,21 @@ 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;
- nargv = ALLOCA_N(VALUE, argc+1);
+ 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[0] = ID2SYM(id);
- MEMCPY(nargv+1, argv, VALUE, argc);
-
return rb_funcall2(obj, missing, argc+1, nargv);
}
@@ -5618,6 +5836,10 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
TMP_PROTECT;
volatile int safe = -1;
+ if (NOEX_SAFE(flags) > ruby_safe_level && 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:
@@ -5634,6 +5856,18 @@ 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();
@@ -5642,7 +5876,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
ruby_frame->last_class = (flags & NOEX_NOSUPER)?0:klass;
ruby_frame->self = recv;
ruby_frame->argc = argc;
- ruby_frame->argv = argv;
+ ruby_frame->flags = 0;
switch (nd_type(body)) {
case NODE_CFUNC:
@@ -5683,9 +5917,13 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
break;
case NODE_ATTRSET:
- /* for re-scoped/renamed method */
+ 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;
+
case NODE_ZSUPER:
- result = rb_eval(recv, body);
+ result = rb_call_super(argc, argv);
break;
case NODE_DMETHOD:
@@ -5693,7 +5931,16 @@ 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, ruby_current_node, recv, id, klass);
+ }
break;
case NODE_SCOPE:
@@ -5722,10 +5969,6 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
b2 = body = body->nd_next;
if (NOEX_SAFE(flags) > ruby_safe_level) {
- if (!(flags&NOEX_TAINTED) && ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
- rb_raise(rb_eSecurityError, "calling insecure method: %s",
- rb_id2name(id));
- }
safe = ruby_safe_level;
ruby_safe_level = NOEX_SAFE(flags);
}
@@ -5733,7 +5976,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
PUSH_TAG(PROT_FUNC);
if ((state = EXEC_TAG()) == 0) {
NODE *node = 0;
- int i;
+ int i, nopt = 0;
if (nd_type(body) == NODE_ARGS) {
node = body;
@@ -5753,53 +5996,61 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
argc, i);
}
- if ((long)node->nd_rest == -1) {
- int opt = i;
+ if (!node->nd_rest) {
NODE *optnode = node->nd_opt;
+ nopt = i;
while (optnode) {
- opt++;
+ nopt++;
optnode = optnode->nd_next;
}
- if (opt < argc) {
- rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
- argc, opt);
+ if (nopt < argc) {
+ rb_raise(rb_eArgError,
+ "wrong number of arguments (%d for %d)",
+ argc, nopt);
}
- 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--;
+ }
+ 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--;
+ ++i;
+ opt = opt->nd_next;
+ }
+ if (opt) {
+ rb_eval(recv, opt);
+ while (opt) {
opt = opt->nd_next;
- }
- if (opt) {
- rb_eval(recv, opt);
+ ++i;
}
}
- 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;
+ }
+ if (!node->nd_rest) {
+ i = nopt;
+ }
+ else {
+ VALUE v;
+
+ if (argc > 0) {
+ v = rb_ary_new4(argc,argv);
+ i = -i - 1;
}
+ else {
+ v = rb_ary_new2(0);
+ }
+ assign(recv, node->nd_rest, v, 1);
}
+ ruby_frame->argc = i;
}
-
if (event_hooks) {
EXEC_EVENT_HOOK(RUBY_EVENT_CALL, b2, recv, id, klass);
}
@@ -5810,14 +6061,14 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
state = 0;
}
POP_TAG();
+ if (event_hooks) {
+ EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass);
+ }
POP_VARS();
POP_CLASS();
POP_SCOPE();
ruby_cref = saved_cref;
if (safe >= 0) ruby_safe_level = safe;
- if (event_hooks) {
- EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
- }
switch (state) {
case 0:
break;
@@ -5847,12 +6098,13 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
}
static VALUE
-rb_call(klass, recv, mid, argc, argv, scope)
+rb_call(klass, recv, mid, argc, argv, scope, self)
VALUE klass, recv;
ID mid;
int argc; /* OK */
const VALUE *argv; /* OK */
int scope;
+ VALUE self;
{
NODE *body; /* OK */
int noex;
@@ -5880,19 +6132,20 @@ rb_call(klass, recv, mid, argc, argv, scope)
return method_missing(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
}
- if (mid != missing) {
+ if (mid != missing && scope == 0) {
/* receiver specified form for private method */
- if ((noex & NOEX_PRIVATE) && scope == 0)
+ if (noex & NOEX_PRIVATE)
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 (self == Qundef) self = ruby_frame->self;
if (TYPE(defined_class) == T_ICLASS) {
defined_class = RBASIC(defined_class)->klass;
}
- if (!rb_obj_is_kind_of(ruby_frame->self, rb_class_real(defined_class)))
+ if (!rb_obj_is_kind_of(self, rb_class_real(defined_class)))
return method_missing(recv, mid, argc, argv, CSTAT_PROT);
}
}
@@ -5912,7 +6165,7 @@ rb_apply(recv, mid, args)
argc = RARRAY(args)->len; /* Assigns LONG, but argc is INT */
argv = ALLOCA_N(VALUE, argc);
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);
- return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
+ return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1, Qundef);
}
/*
@@ -5921,7 +6174,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
@@ -5945,7 +6198,7 @@ rb_f_send(argc, argv, recv)
vid = *argv++; argc--;
PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
- vid = rb_call(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv, 1);
+ vid = rb_call(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv, 1, Qundef);
POP_ITER();
return vid;
@@ -5974,7 +6227,7 @@ vafuncall(recv, mid, n, ar)
argv = 0;
}
- return rb_call(CLASS_OF(recv), recv, mid, n, argv, 1);
+ return rb_call(CLASS_OF(recv), recv, mid, n, argv, 1, Qundef);
}
VALUE
@@ -6033,7 +6286,7 @@ rb_funcall2(recv, mid, argc, argv)
int argc;
const VALUE *argv;
{
- return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
+ return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1, Qundef);
}
VALUE
@@ -6043,7 +6296,7 @@ rb_funcall3(recv, mid, argc, argv)
int argc;
const VALUE *argv;
{
- return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0);
+ return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0, Qundef);
}
VALUE
@@ -6055,14 +6308,17 @@ rb_call_super(argc, argv)
if (ruby_frame->last_class == 0) {
rb_name_error(ruby_frame->last_func, "calling `super' from `%s' is prohibited",
- rb_id2name(ruby_frame->last_func));
+ rb_id2name(ruby_frame->orig_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);
+ result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3, Qundef);
POP_ITER();
return result;
@@ -6108,7 +6364,9 @@ backtrace(lev)
}
for (; frame && (n = frame->node); frame = frame->prev) {
if (frame->prev && frame->prev->last_func) {
- if (frame->prev->node == n) continue;
+ 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));
@@ -6188,10 +6446,16 @@ rb_frame_last_func()
return ruby_frame->last_func;
}
+ID
+rb_frame_this_func()
+{
+ return ruby_frame->orig_func;
+}
+
static NODE*
compile(src, file, line)
VALUE src;
- char *file;
+ const char *file;
int line;
{
NODE *node;
@@ -6211,7 +6475,7 @@ compile(src, file, line)
static VALUE
eval(self, src, scope, file, line)
VALUE self, src, scope;
- char *file;
+ const char *file;
int line;
{
struct BLOCK *data = NULL;
@@ -6270,7 +6534,7 @@ eval(self, src, scope, file, line)
file = ruby_sourcefile;
line = ruby_sourceline;
}
- PUSH_CLASS(ruby_cbase);
+ PUSH_CLASS(data ? data->klass : ruby_class);
ruby_in_eval++;
if (TYPE(ruby_class) == T_ICLASS) {
ruby_class = RBASIC(ruby_class)->klass;
@@ -6293,7 +6557,6 @@ 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;
@@ -6326,16 +6589,17 @@ eval(self, src, scope, file, line)
if (state) {
if (state == TAG_RAISE) {
if (strcmp(file, "(eval)") == 0) {
- VALUE mesg, errat;
+ VALUE mesg, errat, bt2;
errat = get_backtrace(ruby_errinfo);
- mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg"));
- if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) {
+ mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg"));
+ if (!NIL_P(errat) && TYPE(errat) == T_ARRAY &&
+ (bt2 = backtrace(-2), RARRAY_LEN(bt2) > 0)) {
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
rb_str_update(mesg, 0, 0, rb_str_new2(": "));
- rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]);
+ rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]);
}
- RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0];
+ RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0];
}
}
rb_exc_raise(ruby_errinfo);
@@ -6372,7 +6636,7 @@ rb_f_eval(argc, argv, self)
VALUE self;
{
VALUE src, scope, vfile, vline;
- char *file = "(eval)";
+ const char *file = "(eval)";
int line = 1;
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
@@ -6419,14 +6683,15 @@ 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 = _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;
+ 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;
if (cbase) {
PUSH_CREF(cbase);
}
@@ -6451,6 +6716,11 @@ 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]);
}
@@ -6483,12 +6753,28 @@ yield_under_i(self)
return rb_yield_0(self, self, ruby_class, YIELD_PUBLIC_DEF, Qfalse);
}
+static VALUE
+yield_args_under_i(vinfo)
+ VALUE vinfo;
+{
+ VALUE *info = (VALUE *)vinfo;
+
+ return rb_yield_0(info[0], info[1], ruby_class, YIELD_PUBLIC_DEF, Qtrue);
+}
+
/* block eval under the class/module context */
static VALUE
-yield_under(under, self)
- VALUE under, self;
+yield_under(under, self, args)
+ VALUE under, self, args;
{
- return exec_under(yield_under_i, under, 0, self);
+ if (args == Qundef) {
+ return exec_under(yield_under_i, under, 0, self);
+ }
+ else {
+ VALUE info[2] = { args, self };
+
+ return exec_under(yield_args_under_i, under, 0, (VALUE)info);
+ }
}
static VALUE
@@ -6501,10 +6787,10 @@ specific_eval(argc, argv, klass, self)
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
}
- return yield_under(klass, self);
+ return yield_under(klass, self, Qundef);
}
else {
- char *file = "(eval)";
+ const char *file = "(eval)";
int line = 1;
if (argc == 0) {
@@ -6562,7 +6848,7 @@ rb_obj_instance_eval(argc, argv, self)
{
VALUE klass;
- if (FIXNUM_P(self) || SYMBOL_P(self)) {
+ if (SPECIAL_CONST_P(self)) {
klass = Qnil;
}
else {
@@ -6573,6 +6859,41 @@ rb_obj_instance_eval(argc, argv, self)
/*
* call-seq:
+ * obj.instance_exec(arg...) {|var...| block } => obj
+ *
+ * Executes the given block within the context of the receiver
+ * (_obj_). In order to set the context, the variable +self+ is set
+ * to _obj_ while the code is executing, giving the code access to
+ * _obj_'s instance variables. Arguments are passed as block parameters.
+ *
+ * class KlassWithSecret
+ * def initialize
+ * @secret = 99
+ * end
+ * end
+ * k = KlassWithSecret.new
+ * k.instance_exec(5) {|x| @secret+x } #=> 104
+ */
+
+VALUE
+rb_obj_instance_exec(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
+{
+ VALUE klass;
+
+ if (SPECIAL_CONST_P(self)) {
+ klass = Qnil;
+ }
+ else {
+ klass = rb_singleton_class(self);
+ }
+ return yield_under(klass, self, rb_ary_new4(argc, argv));
+}
+
+/*
+ * call-seq:
* mod.class_eval(string [, filename [, lineno]]) => obj
* mod.module_eval {|| block } => obj
*
@@ -6604,6 +6925,35 @@ rb_mod_module_eval(argc, argv, mod)
return specific_eval(argc, argv, mod, mod);
}
+/*
+ * call-seq:
+ * mod.module_exec(arg...) {|var...| block } => obj
+ * mod.class_exec(arg...) {|var...| block } => obj
+ *
+ * Evaluates the given block in the context of the class/module.
+ * The method defined in the block will belong to the receiver.
+ *
+ * class Thing
+ * end
+ * Thing.class_exec{
+ * def hello() "Hello there!" end
+ * }
+ * puts Thing.new.hello()
+ *
+ * <em>produces:</em>
+ *
+ * Hello there!
+ */
+
+VALUE
+rb_mod_module_exec(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
+{
+ return yield_under(mod, mod, rb_ary_new4(argc, argv));
+}
+
VALUE rb_load_path;
NORETURN(static void load_failed _((VALUE)));
@@ -6621,7 +6971,6 @@ rb_load(fname, wrap)
volatile VALUE self = ruby_top_self;
NODE *volatile last_node;
NODE *saved_cref = ruby_cref;
- TMP_PROTECT;
if (wrap && ruby_safe_level >= 4) {
StringValue(fname);
@@ -6639,7 +6988,7 @@ rb_load(fname, wrap)
ruby_errinfo = Qnil; /* ensure */
PUSH_VARS();
PUSH_CLASS(ruby_wrapper);
- ruby_cref = top_cref;
+ ruby_cref = ruby_top_cref;
if (!wrap) {
rb_secure(4); /* should alter global state */
ruby_class = rb_cObject;
@@ -6765,13 +7114,25 @@ static st_table *loading_tbl;
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0)
#endif
-static char *
+
+static const char *const loadable_ext[] = {
+ ".rb", DLEXT,
+#ifdef DLEXT2
+ DLEXT2,
+#endif
+ 0
+};
+
+static int rb_feature_p _((const char *, const char *, int));
+static int search_required _((VALUE, VALUE *, VALUE *));
+
+static int
rb_feature_p(feature, ext, rb)
const char *feature, *ext;
int rb;
{
VALUE v;
- char *f, *e;
+ const char *f, *e;
long i, len, elen;
if (ext) {
@@ -6782,51 +7143,64 @@ rb_feature_p(feature, ext, rb)
len = strlen(feature);
elen = 0;
}
- for (i = 0; i < RARRAY(rb_features)->len; ++i) {
- v = RARRAY(rb_features)->ptr[i];
+ for (i = 0; i < RARRAY_LEN(rb_features); ++i) {
+ v = RARRAY_PTR(rb_features)[i];
f = StringValuePtr(v);
- if (strncmp(f, feature, len) != 0) continue;
+ if (RSTRING_LEN(v) < len || strncmp(f, feature, len) != 0)
+ continue;
if (!*(e = f + len)) {
if (ext) continue;
- return e;
+ return 'u';
}
if (*e != '.') continue;
if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
- return e;
+ return 's';
}
if ((rb || !ext) && (strcmp(e, ".rb") == 0)) {
- return e;
+ return 'r';
+ }
+ }
+ if (loading_tbl) {
+ if (st_lookup(loading_tbl, (st_data_t)feature, 0)) {
+ if (!ext) return 'u';
+ return strcmp(ext, ".rb") ? 's' : 'r';
+ }
+ else {
+ char *buf;
+
+ if (ext && *ext) return 0;
+ buf = ALLOCA_N(char, len + DLEXT_MAXLEN + 1);
+ MEMCPY(buf, feature, char, len);
+ for (i = 0; (e = loadable_ext[i]) != 0; i++) {
+ strncpy(buf + len, e, DLEXT_MAXLEN + 1);
+ if (st_lookup(loading_tbl, (st_data_t)buf, 0)) {
+ return i ? 's' : 'r';
+ }
+ }
}
}
return 0;
}
-static const char *const loadable_ext[] = {
- ".rb", DLEXT,
-#ifdef DLEXT2
- DLEXT2,
-#endif
- 0
-};
-
int
rb_provided(feature)
const char *feature;
{
- int i;
- char *buf;
+ const char *ext = strrchr(feature, '.');
- if (rb_feature_p(feature, 0, Qfalse))
- return Qtrue;
- if (!loading_tbl) return Qfalse;
- if (st_lookup(loading_tbl, (st_data_t)feature, 0)) return Qtrue;
- buf = ALLOCA_N(char, strlen(feature)+8);
- strcpy(buf, feature);
- for (i=0; ; i++) {
- if (!loadable_ext[i]) break;
- strcpy(buf+strlen(feature), loadable_ext[i]);
- if (st_lookup(loading_tbl, (st_data_t)buf, 0)) return Qtrue;
+ if (ext && !strchr(ext, '/')) {
+ if (strcmp(".rb", ext) == 0) {
+ if (rb_feature_p(feature, ext, Qtrue)) return Qtrue;
+ return Qfalse;
+ }
+ else if (IS_SOEXT(ext) || IS_DLEXT(ext)) {
+ if (rb_feature_p(feature, ext, Qfalse)) return Qtrue;
+ return Qfalse;
+ }
}
+ if (rb_feature_p(feature, feature + strlen(feature), Qtrue))
+ return Qtrue;
+
return Qfalse;
}
@@ -6844,19 +7218,41 @@ rb_provide(feature)
rb_provide_feature(rb_str_new2(feature));
}
-static void
-load_wait(ftptr)
- char *ftptr;
+static char *
+load_lock(ftptr)
+ const char *ftptr;
{
st_data_t th;
- if (!loading_tbl) return;
- if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return;
- if ((rb_thread_t)th == curr_thread) return;
+ if (!loading_tbl ||
+ !st_lookup(loading_tbl, (st_data_t)ftptr, &th))
+ {
+ /* loading ruby library should be serialized. */
+ if (!loading_tbl) {
+ loading_tbl = st_init_strtable();
+ }
+ /* partial state */
+ ftptr = ruby_strdup(ftptr);
+ st_insert(loading_tbl, (st_data_t)ftptr, (st_data_t)curr_thread);
+ return (char *)ftptr;
+ }
do {
+ if ((rb_thread_t)th == curr_thread) return 0;
CHECK_INTS;
- rb_thread_schedule();
} while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
+ return 0;
+}
+
+static void
+load_unlock(const char *ftptr)
+{
+ if (ftptr) {
+ st_data_t key = (st_data_t)ftptr;
+
+ if (st_delete(loading_tbl, &key, 0)) {
+ free((char *)key);
+ }
+ }
}
/*
@@ -6898,16 +7294,16 @@ search_required(fname, featurep, path)
*featurep = fname;
*path = 0;
- ext = strrchr(ftptr = RSTRING(fname)->ptr, '.');
+ ext = strrchr(ftptr = RSTRING_PTR(fname), '.');
if (ext && !strchr(ext, '/')) {
if (strcmp(".rb", ext) == 0) {
if (rb_feature_p(ftptr, ext, Qtrue)) return 'r';
- if (*path = rb_find_file(fname)) return 'r';
+ if ((*path = rb_find_file(fname)) != 0) return 'r';
return 0;
}
else if (IS_SOEXT(ext)) {
if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
- tmp = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr);
+ tmp = rb_str_new(RSTRING_PTR(fname), ext-RSTRING_PTR(fname));
*featurep = tmp;
#ifdef DLEXT2
OBJ_FREEZE(tmp);
@@ -6919,27 +7315,25 @@ search_required(fname, featurep, path)
#else
rb_str_cat2(tmp, DLEXT);
OBJ_FREEZE(tmp);
- if (*path = rb_find_file(tmp)) {
+ if ((*path = rb_find_file(tmp)) != 0) {
return 's';
}
#endif
}
else if (IS_DLEXT(ext)) {
if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
- if (*path = rb_find_file(fname)) return 's';
+ if ((*path = rb_find_file(fname)) != 0) return 's';
}
}
tmp = fname;
- switch (type = rb_find_file_ext(&tmp, loadable_ext)) {
+ type = rb_find_file_ext(&tmp, loadable_ext);
+ *featurep = tmp;
+ switch (type) {
case 0:
- if ((ext = rb_feature_p(ftptr, 0, Qfalse))) {
- type = strcmp(".rb", ext);
- break;
- }
- return 0;
+ ftptr = RSTRING_PTR(tmp);
+ return rb_feature_p(ftptr, 0, Qfalse);
default:
- *featurep = tmp;
ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
if (rb_feature_p(ftptr, ext, !--type)) break;
*path = rb_find_file(tmp);
@@ -6987,22 +7381,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 || !(ftptr = load_lock(RSTRING_PTR(feature)))) {
result = Qfalse;
}
else {
ruby_safe_level = 0;
- rb_provide_feature(feature);
switch (found) {
case 'r':
- /* loading ruby library should be serialized. */
- if (!loading_tbl) {
- loading_tbl = st_init_strtable();
- }
- /* partial state */
- ftptr = ruby_strdup(RSTRING(feature)->ptr);
- st_insert(loading_tbl, (st_data_t)ftptr, (st_data_t)curr_thread);
rb_load(path, 0);
break;
@@ -7016,6 +7401,7 @@ rb_require_safe(fname, safe)
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;
}
+ rb_provide_feature(feature);
result = Qtrue;
}
}
@@ -7026,11 +7412,7 @@ rb_require_safe(fname, safe)
ruby_frame->last_func = saved.func;
SCOPE_SET(saved.vmode);
ruby_safe_level = saved.safe;
- if (ftptr) {
- if (st_delete(loading_tbl, (st_data_t *)&ftptr, 0)) { /* loading done */
- free(ftptr);
- }
- }
+ load_unlock(ftptr);
if (state) JUMP_TAG(state);
if (NIL_P(result)) {
load_failed(fname);
@@ -7049,6 +7431,24 @@ rb_require(fname)
return rb_require_safe(fn, ruby_safe_level);
}
+void
+ruby_init_ext(name, init)
+ const char *name;
+ void (*init) _((void));
+{
+ ruby_current_node = 0;
+ ruby_sourcefile = rb_source_filename(name);
+ ruby_sourceline = 0;
+ ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
+ SCOPE_SET(SCOPE_PUBLIC);
+ if (load_lock(name)) {
+ (*init)();
+ rb_provide(name);
+ load_unlock(name);
+ }
+}
+
static void
secure_visibility(self)
VALUE self;
@@ -7715,6 +8115,37 @@ rb_exec_end_proc()
ruby_safe_level = safe;
}
+/*
+ * call-seq:
+ * __method__ => symbol
+ *
+ * Returns the name of the current method as a Symbol.
+ * If called from inside of an aliased method it will return the original
+ * nonaliased name.
+ * If called outside of a method, it returns <code>nil</code>.
+ *
+ * def foo
+ * __method__
+ * end
+ * alias bar foo
+ *
+ * foo # => :foo
+ * bar # => :foo
+ *
+ */
+
+static VALUE
+rb_f_method_name()
+{
+ struct FRAME* prev = ruby_frame->prev;
+ if (prev && prev->orig_func) {
+ return ID2SYM(prev->orig_func);
+ }
+ else {
+ return Qnil;
+ }
+}
+
void
Init_eval()
{
@@ -7736,11 +8167,11 @@ Init_eval()
__id__ = rb_intern("__id__");
__send__ = rb_intern("__send__");
- rb_global_variable((VALUE*)&top_scope);
- rb_global_variable((VALUE*)&ruby_eval_tree_begin);
+ rb_global_variable((void *)&top_scope);
+ rb_global_variable((void *)&ruby_eval_tree_begin);
- rb_global_variable((VALUE*)&ruby_eval_tree);
- rb_global_variable((VALUE*)&ruby_dyna_vars);
+ rb_global_variable((void *)&ruby_eval_tree);
+ rb_global_variable((void *)&ruby_dyna_vars);
rb_define_virtual_variable("$@", errat_getter, errat_setter);
rb_define_hooked_variable("$!", &ruby_errinfo, 0, errinfo_setter);
@@ -7751,10 +8182,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?", rb_obj_respond_to, -1);
+ rb_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1);
respond_to = rb_intern("respond_to?");
+ rb_global_variable((void *)&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);
@@ -7771,9 +8202,12 @@ Init_eval()
rb_define_global_function("global_variables", rb_f_global_variables, 0); /* in variable.c */
rb_define_global_function("local_variables", rb_f_local_variables, 0);
+ rb_define_global_function("__method__", rb_f_method_name, 0);
+
rb_define_method(rb_mKernel, "send", rb_f_send, -1);
rb_define_method(rb_mKernel, "__send__", rb_f_send, -1);
rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1);
+ rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1);
rb_define_private_method(rb_cModule, "append_features", rb_mod_append_features, 1);
rb_define_private_method(rb_cModule, "extend_object", rb_mod_extend_object, 1);
@@ -7789,7 +8223,9 @@ Init_eval()
rb_define_method(rb_cModule, "public_class_method", rb_mod_public_method, -1);
rb_define_method(rb_cModule, "private_class_method", rb_mod_private_method, -1);
rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1);
+ rb_define_method(rb_cModule, "module_exec", rb_mod_module_exec, -1);
rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1);
+ rb_define_method(rb_cModule, "class_exec", rb_mod_module_exec, -1);
rb_undef_method(rb_cClass, "module_function");
@@ -7880,6 +8316,9 @@ 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);
}
@@ -7900,20 +8339,23 @@ 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);
@@ -7923,8 +8365,8 @@ Init_load()
rb_define_global_function("autoload?", rb_f_autoload_p, 1);
rb_global_variable(&ruby_wrapper);
- ruby_dln_librefs = rb_ary_new();
rb_global_variable(&ruby_dln_librefs);
+ ruby_dln_librefs = rb_ary_new();
}
static void
@@ -7971,12 +8413,8 @@ 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);
@@ -8001,16 +8439,9 @@ 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);
@@ -8083,20 +8514,42 @@ proc_clone(self)
* MISSING: documentation
*/
+#define PROC_TSHIFT (FL_USHIFT+1)
+#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3)
+#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT)
+
+static int proc_get_safe_level(VALUE);
+
static VALUE
proc_dup(self)
VALUE self;
{
struct BLOCK *orig, *data;
VALUE bind;
+ int safe = proc_get_safe_level(self);
Data_Get_Struct(self, struct BLOCK, orig);
bind = Data_Make_Struct(rb_obj_class(self),struct BLOCK,blk_mark,blk_free,data);
blk_dup(data, orig);
+ if (safe > PROC_TMAX) safe = PROC_TMAX;
+ FL_SET(bind, (safe << PROC_TSHIFT) & PROC_TMASK);
return bind;
}
+VALUE
+rb_block_dup(self, klass, cref)
+ VALUE self, klass, cref;
+{
+ struct BLOCK *block;
+ VALUE obj = proc_dup(self);
+ Data_Get_Struct(obj, struct BLOCK, block);
+ block->klass = klass;
+ block->cref = NEW_NODE(nd_type(block->cref), cref, block->cref->u2.node,
+ block->cref->u3.node);
+ return obj;
+}
+
/*
* call-seq:
* binding -> a_binding
@@ -8132,6 +8585,7 @@ 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) {
@@ -8153,9 +8607,34 @@ rb_f_binding(self)
return bind;
}
-#define PROC_TSHIFT (FL_USHIFT+1)
-#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3)
-#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT)
+/*
+ * call-seq:
+ * binding.eval(string [, filename [,lineno]]) => obj
+ *
+ * Evaluates the Ruby expression(s) in <em>string</em>, in the
+ * <em>binding</em>'s context. If the optional <em>filename</em> and
+ * <em>lineno</em> parameters are present, they will be used when
+ * reporting syntax errors.
+ *
+ * def getBinding(param)
+ * return binding
+ * end
+ * b = getBinding("hello")
+ * b.eval("param") #=> "hello"
+ */
+
+static VALUE
+bind_eval(argc, argv, bindval)
+ int argc;
+ VALUE *argv;
+ VALUE bindval;
+{
+ VALUE args[4];
+
+ rb_scan_args(argc, argv, "12", &args[0], &args[2], &args[3]);
+ args[1] = bindval;
+ return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */);
+}
#define SAFE_LEVEL_MAX PROC_TMASK
@@ -8318,13 +8797,12 @@ proc_invoke(proc, args, self, klass)
volatile VALUE old_wrapper = ruby_wrapper;
volatile int pcall, avalue = Qtrue;
volatile VALUE tmp = args;
+ VALUE bvar = Qnil;
if (rb_block_given_p() && ruby_frame->last_func) {
if (klass != ruby_frame->last_class)
klass = rb_obj_class(proc);
- rb_warning("block for %s#%s is useless",
- rb_class2name(klass),
- rb_id2name(ruby_frame->last_func));
+ bvar = rb_block_proc();
}
Data_Get_Struct(proc, struct BLOCK, data);
@@ -8340,21 +8818,29 @@ proc_invoke(proc, args, self, klass)
/* PUSH BLOCK from data */
old_block = ruby_block;
_block = *data;
+ _block.block_obj = bvar;
if (self != Qundef) _block.frame.self = self;
if (klass) _block.frame.last_class = klass;
_block.frame.argc = RARRAY(tmp)->len;
- _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;
+ _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 */
ruby_block = &_block;
-
PUSH_ITER(ITER_CUR);
ruby_frame->iter = ITER_CUR;
PUSH_TAG(pcall ? PROT_LAMBDA : PROT_NONE);
state = EXEC_TAG();
if (state == 0) {
proc_set_safe_level(proc);
- result = rb_yield_0(args, self, (self!=Qundef)?CLASS_OF(self):0, pcall, avalue);
+ result = rb_yield_0(args, self, (self!=Qundef)?CLASS_OF(self):0,
+ pcall | YIELD_PROC_CALL, avalue);
}
else if (TAG_DST()) {
result = prot_tag->retval;
@@ -8373,6 +8859,7 @@ proc_invoke(proc, args, self, klass)
proc_jump_error(TAG_RETRY, Qnil); /* xxx */
JUMP_TAG(state);
break;
+ case TAG_NEXT:
case TAG_BREAK:
if (!pcall && result != Qundef) {
proc_jump_error(state, result);
@@ -8422,8 +8909,8 @@ proc_invoke(proc, args, self, klass)
* from prog.rb:5
*/
-static VALUE
-proc_call(proc, args)
+VALUE
+rb_proc_call(proc, args)
VALUE proc, args; /* OK */
{
return proc_invoke(proc, args, Qundef, 0);
@@ -8457,30 +8944,36 @@ proc_arity(proc)
VALUE proc;
{
struct BLOCK *data;
- NODE *list;
+ NODE *var, *list;
int n;
Data_Get_Struct(proc, struct BLOCK, data);
- if (data->var == 0) {
+ var = data->var;
+ if (var == 0) {
if (data->body && nd_type(data->body) == NODE_IFUNC &&
data->body->nd_cfnc == bmcall) {
return method_arity(data->body->nd_tval);
}
return INT2FIX(-1);
}
- if (data->var == (NODE*)1) return INT2FIX(0);
- if (data->var == (NODE*)2) return INT2FIX(0);
- switch (nd_type(data->var)) {
+ if (var == (NODE*)1) return INT2FIX(0);
+ if (var == (NODE*)2) return INT2FIX(0);
+ if (nd_type(var) == NODE_BLOCK_ARG) {
+ var = var->nd_args;
+ if (var == (NODE*)1) return INT2FIX(0);
+ if (var == (NODE*)2) return INT2FIX(0);
+ }
+ switch (nd_type(var)) {
default:
return INT2FIX(1);
case NODE_MASGN:
- list = data->var->nd_head;
+ list = var->nd_head;
n = 0;
while (list) {
n++;
list = list->nd_next;
}
- if (data->var->nd_args) return INT2FIX(-n-1);
+ if (var->nd_args) return INT2FIX(-n-1);
return INT2FIX(n);
}
}
@@ -8528,7 +9021,7 @@ proc_to_s(self)
{
struct BLOCK *data;
NODE *node;
- char *cname = rb_obj_classname(self);
+ const char *cname = rb_obj_classname(self);
const int w = (sizeof(VALUE) * CHAR_BIT) / 4;
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
VALUE str;
@@ -8750,7 +9243,7 @@ mnew(klass, obj, id, mklass)
data->body = body;
data->rklass = rklass;
data->oid = oid;
- data->safe_level = NOEX_WITH_SAFE(0);
+ data->safe_level = NOEX_WITH_SAFE(noex);
OBJ_INFECT(method, klass);
return method;
@@ -8842,6 +9335,57 @@ method_unbind(obj)
/*
* call-seq:
+ * meth.receiver => object
+ *
+ * Returns the bound receiver of the method object.
+ */
+
+static VALUE
+method_receiver(obj)
+ VALUE obj;
+{
+ struct METHOD *data;
+
+ Data_Get_Struct(obj, struct METHOD, data);
+ return data->recv;
+}
+
+/*
+ * call-seq:
+ * meth.name => string
+ *
+ * Returns the name of the method.
+ */
+
+static VALUE
+method_name(obj)
+ VALUE obj;
+{
+ struct METHOD *data;
+
+ Data_Get_Struct(obj, struct METHOD, data);
+ return rb_str_new2(rb_id2name(data->oid));
+}
+
+/*
+ * call-seq:
+ * meth.owner => class_or_module
+ *
+ * Returns the class or module that defines the method.
+ */
+
+static VALUE
+method_owner(obj)
+ VALUE obj;
+{
+ struct METHOD *data;
+
+ Data_Get_Struct(obj, struct METHOD, data);
+ return data->klass;
+}
+
+/*
+ * call-seq:
* obj.method(sym) => method
*
* Looks up the named method as a receiver in <i>obj</i>, returning a
@@ -8868,7 +9412,7 @@ method_unbind(obj)
* m.call #=> "Hello, @iv = Fred"
*/
-static VALUE
+VALUE
rb_obj_method(obj, vid)
VALUE obj;
VALUE vid;
@@ -8935,6 +9479,29 @@ method_clone(self)
return clone;
}
+VALUE
+rb_method_dup(self, klass, cref)
+ VALUE self;
+ VALUE klass;
+ VALUE cref;
+{
+ VALUE clone;
+ struct METHOD *orig, *data;
+
+ Data_Get_Struct(self, struct METHOD, orig);
+ clone = Data_Make_Struct(CLASS_OF(self),struct METHOD, bm_mark, free, data);
+ *data = *orig;
+ data->rklass = klass;
+ if (data->body->nd_rval) {
+ NODE *tmp = NEW_NODE(nd_type(data->body->u2.node), cref,
+ data->body->u2.node->u2.node,
+ data->body->u2.node->u3.node);
+ data->body = NEW_NODE(nd_type(data->body), data->body->u1.node, tmp,
+ data->body->u3.node);
+ }
+ return clone;
+}
+
/*
* call-seq:
* meth.call(args, ...) => obj
@@ -9070,13 +9637,22 @@ 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 != CLASS_OF(recv)) {
+ if (data->rklass != rklass) {
if (FL_TEST(data->rklass, FL_SINGLETON)) {
- rb_raise(rb_eTypeError, "singleton method called for a different object");
+ rb_raise(rb_eTypeError, "singleton method bound for a different object");
}
- if(!rb_obj_is_kind_of(recv, data->rklass)) {
+ 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:
rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
rb_class2name(data->rklass));
}
@@ -9085,7 +9661,7 @@ umethod_bind(method, recv)
method = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,bound);
*bound = *data;
bound->recv = recv;
- bound->rklass = CLASS_OF(recv);
+ bound->rklass = rklass;
return method;
}
@@ -9148,16 +9724,18 @@ method_arity(method)
return proc_arity(body->nd_cval);
case NODE_DMETHOD:
return method_arity(body->nd_cval);
- default:
+ case NODE_SCOPE:
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 != -1)
+ if (body->nd_opt || body->nd_rest)
n = -n-1;
return INT2FIX(n);
- }
+ default:
+ rb_raise(rb_eArgError, "invalid node 0x%x", nd_type(body));
+ }
}
/*
@@ -9177,7 +9755,7 @@ method_inspect(method)
struct METHOD *data;
VALUE str;
const char *s;
- char *sharp = "#";
+ const char *sharp = "#";
Data_Get_Struct(method, struct METHOD, data);
str = rb_str_buf_new2("#<");
@@ -9239,9 +9817,12 @@ bmcall(args, method)
VALUE args, method;
{
volatile VALUE a;
+ VALUE ret;
a = svalue_to_avalue(args);
- return method_call(RARRAY(a)->len, RARRAY(a)->ptr, method);
+ ret = method_call(RARRAY(a)->len, RARRAY(a)->ptr, method);
+ a = Qnil; /* prevent tail call */
+ return ret;
}
VALUE
@@ -9253,7 +9834,8 @@ rb_proc_new(func, val)
VALUE proc = rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
Data_Get_Struct(proc, struct BLOCK, data);
- data->body->nd_state = YIELD_FUNC_AVALUE;
+ data->body->nd_state = YIELD_FUNC_LAMBDA;
+ data->flags |= BLOCK_LAMBDA;
return proc;
}
@@ -9373,14 +9955,14 @@ rb_mod_define_method(argc, argv, mod)
rb_raise(rb_eTypeError, "wrong argument type (expected Proc/Method)");
}
- if (SCOPE_TEST(SCOPE_PRIVATE)) {
- noex = NOEX_PRIVATE;
- }
- else if (SCOPE_TEST(SCOPE_PROTECTED)) {
- noex = NOEX_PROTECTED;
- }
- else {
- noex = NOEX_PUBLIC;
+ noex = NOEX_PUBLIC;
+ if (ruby_cbase == mod) {
+ if (SCOPE_TEST(SCOPE_PRIVATE)) {
+ noex = NOEX_PRIVATE;
+ }
+ else if (SCOPE_TEST(SCOPE_PROTECTED)) {
+ noex = NOEX_PROTECTED;
+ }
}
rb_add_method(mod, id, node, noex);
return body;
@@ -9411,13 +9993,18 @@ Init_Proc()
rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
- exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
rb_global_variable(&exception_error);
+ exception_error = rb_exc_new3(rb_eFatal,
+ rb_obj_freeze(rb_str_new2("exception reentered")));
+ OBJ_TAINT(exception_error);
+ OBJ_FREEZE(exception_error);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
- sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
- OBJ_TAINT(sysstack_error);
rb_global_variable(&sysstack_error);
+ sysstack_error = rb_exc_new3(rb_eSysStackError,
+ rb_obj_freeze(rb_str_new2("stack level too deep")));
+ OBJ_TAINT(sysstack_error);
+ OBJ_FREEZE(sysstack_error);
rb_cProc = rb_define_class("Proc", rb_cObject);
rb_undef_alloc_func(rb_cProc);
@@ -9425,9 +10012,9 @@ Init_Proc()
rb_define_method(rb_cProc, "clone", proc_clone, 0);
rb_define_method(rb_cProc, "dup", proc_dup, 0);
- rb_define_method(rb_cProc, "call", proc_call, -2);
+ rb_define_method(rb_cProc, "call", rb_proc_call, -2);
rb_define_method(rb_cProc, "arity", proc_arity, 0);
- rb_define_method(rb_cProc, "[]", proc_call, -2);
+ rb_define_method(rb_cProc, "[]", rb_proc_call, -2);
rb_define_method(rb_cProc, "==", proc_eq, 1);
rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
rb_define_method(rb_cProc, "to_proc", proc_to_self, 0);
@@ -9447,6 +10034,9 @@ Init_Proc()
rb_define_method(rb_cMethod, "inspect", method_inspect, 0);
rb_define_method(rb_cMethod, "to_s", method_inspect, 0);
rb_define_method(rb_cMethod, "to_proc", method_proc, 0);
+ rb_define_method(rb_cMethod, "receiver", method_receiver, 0);
+ rb_define_method(rb_cMethod, "name", method_name, 0);
+ rb_define_method(rb_cMethod, "owner", method_owner, 0);
rb_define_method(rb_cMethod, "unbind", method_unbind, 0);
rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
@@ -9458,6 +10048,8 @@ Init_Proc()
rb_define_method(rb_cUnboundMethod, "arity", method_arity, 0);
rb_define_method(rb_cUnboundMethod, "inspect", method_inspect, 0);
rb_define_method(rb_cUnboundMethod, "to_s", method_inspect, 0);
+ rb_define_method(rb_cUnboundMethod, "name", method_name, 0);
+ rb_define_method(rb_cUnboundMethod, "owner", method_owner, 0);
rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
rb_define_method(rb_cModule, "instance_method", rb_mod_method, 1);
}
@@ -9504,22 +10096,11 @@ 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_method(rb_cBinding, "eval", bind_eval, -1);
rb_define_global_function("binding", rb_f_binding, 0);
}
-#ifdef __ia64__
-#if defined(__FreeBSD__)
-/*
- * FreeBSD/ia64 currently does not have a way for a process to get the
- * base address for the RSE backing store, so hardcode it.
- */
-#define __libc_ia64_register_backing_store_base (4ULL<<61)
-#else
-#pragma weak __libc_ia64_register_backing_store_base
-extern unsigned long __libc_ia64_register_backing_store_base;
-#endif
-#endif
-
/* Windows SEH refers data on the stack. */
#undef SAVE_WIN32_EXCEPTION_LIST
#if defined _WIN32 || defined __CYGWIN__
@@ -9584,13 +10165,6 @@ VALUE rb_cThread;
extern VALUE rb_last_status;
-enum thread_status {
- THREAD_TO_KILL,
- THREAD_RUNNABLE,
- THREAD_STOPPED,
- THREAD_KILLED,
-};
-
#define WAIT_FD (1<<0)
#define WAIT_SELECT (1<<1)
#define WAIT_TIME (1<<2)
@@ -9608,70 +10182,9 @@ enum thread_status {
# endif
#endif
-/* typedef struct thread * rb_thread_t; */
-
-struct thread {
- struct thread *next, *prev;
- rb_jmpbuf_t context;
-#ifdef SAVE_WIN32_EXCEPTION_LIST
- DWORD win32_exception_list;
-#endif
-
- VALUE result;
-
- long stk_len;
- long stk_max;
- VALUE *stk_ptr;
- VALUE *stk_pos;
-#ifdef __ia64__
- VALUE *bstr_ptr;
- long bstr_len;
-#endif
-
- struct FRAME *frame;
- struct SCOPE *scope;
- struct RVarmap *dyna_vars;
- struct BLOCK *block;
- struct iter *iter;
- struct tag *tag;
- VALUE klass;
- VALUE wrapper;
- NODE *cref;
-
- int flags; /* misc. states (vmode/rb_trap_immediate/raised) */
-
- NODE *node;
-
- int tracing;
- VALUE errinfo;
- VALUE last_status;
- VALUE last_line;
- VALUE last_match;
-
- int safe;
-
- enum thread_status status;
- int wait_for;
- int fd;
- fd_set readfds;
- fd_set writefds;
- fd_set exceptfds;
- int select_value;
- double delay;
- rb_thread_t join;
-
- int abort;
- int priority;
- VALUE thgroup;
-
- st_table *locals;
-
- VALUE thread;
-};
-
-#define THREAD_RAISED 0x200 /* temporary flag */
#define THREAD_TERMINATING 0x400 /* persistent flag */
-#define THREAD_FLAGS_MASK 0x400 /* mask for persistent flags */
+#define THREAD_NO_ENSURE 0x800 /* persistent flag */
+#define THREAD_FLAGS_MASK 0xfc00 /* mask for persistent flags */
#define FOREACH_THREAD_FROM(f,x) x = f; do { x = x->next;
#define END_FOREACH_FROM(f,x) } while (x != f)
@@ -9690,7 +10203,7 @@ struct thread_status_t {
int safe;
- enum thread_status status;
+ enum rb_thread_status status;
int wait_for;
int fd;
fd_set readfds;
@@ -9723,22 +10236,34 @@ struct thread_status_t {
(dst)->join = (src)->join, \
0)
-static int
-thread_set_raised()
+int
+rb_thread_set_raised(th)
+ rb_thread_t th;
{
- if (curr_thread->flags & THREAD_RAISED) return 1;
- curr_thread->flags |= THREAD_RAISED;
+ if (th->flags & RAISED_EXCEPTION) {
+ return 1;
+ }
+ th->flags |= RAISED_EXCEPTION;
return 0;
}
-static int
-thread_reset_raised()
+int
+rb_thread_reset_raised(th)
+ rb_thread_t th;
{
- if (!(curr_thread->flags & THREAD_RAISED)) return 0;
- curr_thread->flags &= ~THREAD_RAISED;
+ if (!(th->flags & RAISED_EXCEPTION)) {
+ return 0;
+ }
+ th->flags &= ~RAISED_EXCEPTION;
return 1;
}
+static int
+thread_no_ensure()
+{
+ return ((curr_thread->flags & THREAD_NO_ENSURE) == THREAD_NO_ENSURE);
+}
+
static void rb_thread_ready _((rb_thread_t));
static VALUE run_trap_eval _((VALUE));
@@ -9772,6 +10297,7 @@ rb_trap_eval(cmd, sig, safe)
if (state) {
rb_trap_immediate = 0;
+ rb_thread_ready(curr_thread);
JUMP_TAG(state);
}
@@ -9785,7 +10311,7 @@ rb_trap_eval(cmd, sig, safe)
static const char *
thread_status_name(status)
- enum thread_status status;
+ enum rb_thread_status status;
{
switch (status) {
case THREAD_RUNNABLE:
@@ -9839,32 +10365,19 @@ static double
timeofday()
{
struct timeval tv;
+#ifdef CLOCK_MONOTONIC
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
+ return (double)tp.tv_sec + (double)tp.tv_nsec * 1e-9;
+ }
+#endif
gettimeofday(&tv, NULL);
return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
}
#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;
@@ -9883,10 +10396,12 @@ 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);
rb_gc_mark(th->thgroup);
+ rb_gc_mark_maybe(th->sandbox);
/* mark data in copied stack */
if (th == curr_thread) return;
@@ -9897,22 +10412,22 @@ thread_mark(th)
#if defined(THINK_C) || defined(__human68k__)
rb_gc_mark_locations(th->stk_ptr+2, th->stk_ptr+th->stk_len+2);
#endif
-#ifdef __ia64__
+#ifdef __ia64
if (th->bstr_ptr) {
- rb_gc_mark_locations(th->bstr_ptr, th->bstr_ptr+th->bstr_len);
+ rb_gc_mark_locations(th->bstr_ptr, th->bstr_ptr+th->bstr_len);
}
#endif
}
frame = th->frame;
while (frame && frame != top_frame) {
frame = ADJ(frame);
- MARK_FRAME_ADJ(frame);
+ rb_gc_mark_frame(frame);
if (frame->tmp) {
struct FRAME *tmp = frame->tmp;
while (tmp && tmp != top_frame) {
tmp = ADJ(tmp);
- MARK_FRAME_ADJ(tmp);
+ rb_gc_mark_frame(tmp);
tmp = tmp->prev;
}
}
@@ -9921,11 +10436,21 @@ thread_mark(th)
block = th->block;
while (block) {
block = ADJ(block);
- MARK_FRAME_ADJ(&block->frame);
+ rb_gc_mark_frame(&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()
{
@@ -9935,9 +10460,38 @@ 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;
+ }
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);
}
static void
@@ -9946,7 +10500,7 @@ thread_free(th)
{
if (th->stk_ptr) free(th->stk_ptr);
th->stk_ptr = 0;
-#ifdef __ia64__
+#ifdef __ia64
if (th->bstr_ptr) free(th->bstr_ptr);
th->bstr_ptr = 0;
#endif
@@ -9975,7 +10529,6 @@ static VALUE th_raise_exception;
static NODE *th_raise_node;
static VALUE th_cmd;
static int th_sig, th_safe;
-static char *th_signm;
#define RESTORE_NORMAL 1
#define RESTORE_FATAL 2
@@ -9986,6 +10539,9 @@ static char *th_signm;
#define RESTORE_EXIT 7
extern VALUE *rb_gc_stack_start;
+#ifdef __ia64
+extern VALUE *rb_gc_register_stack_start;
+#endif
static void
rb_thread_save_context(th)
@@ -10007,22 +10563,19 @@ rb_thread_save_context(th)
th->stk_len = len;
FLUSH_REGISTER_WINDOWS;
MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
-#ifdef __ia64__
- {
- ucontext_t ctx;
- VALUE *top, *bot;
-
- getcontext(&ctx);
- bot = (VALUE*)__libc_ia64_register_backing_store_base;
-#if defined(__FreeBSD__)
- top = (VALUE*)ctx.uc_mcontext.mc_special.bspstore;
-#else
- top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
-#endif
- th->bstr_len = top - bot;
- REALLOC_N(th->bstr_ptr, VALUE, th->bstr_len);
- MEMCPY(th->bstr_ptr, (VALUE*)__libc_ia64_register_backing_store_base, VALUE, th->bstr_len);
- }
+#ifdef __ia64
+ th->bstr_pos = rb_gc_register_stack_start;
+ len = (VALUE*)rb_ia64_bsp() - th->bstr_pos;
+ th->bstr_len = 0;
+ if (len > th->bstr_max) {
+ VALUE *ptr = realloc(th->bstr_ptr, sizeof(VALUE) * len);
+ if (!ptr) rb_memerror();
+ th->bstr_ptr = ptr;
+ th->bstr_max = len;
+ }
+ th->bstr_len = len;
+ rb_ia64_flushrs();
+ MEMCPY(th->bstr_ptr, th->bstr_pos, VALUE, th->bstr_len);
#endif
#ifdef SAVE_WIN32_EXCEPTION_LIST
th->win32_exception_list = win32_get_exception_list();
@@ -10030,6 +10583,7 @@ 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;
@@ -10051,6 +10605,10 @@ rb_thread_save_context(th)
th->safe = ruby_safe_level;
th->node = ruby_current_node;
+ if (ruby_sandbox_save != NULL)
+ {
+ ruby_sandbox_save(th);
+ }
}
static int
@@ -10076,7 +10634,7 @@ rb_thread_switch(n)
rb_raise_jump(th_raise_exception);
break;
case RESTORE_SIGNAL:
- rb_raise(rb_eSignal, "SIG%s", th_signm);
+ rb_thread_signal_raise(th_sig);
break;
case RESTORE_EXIT:
ruby_errinfo = th_raise_exception;
@@ -10094,53 +10652,24 @@ 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(ruby_setjmp(rb_thread_save_context(th), (th)->context)))
NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
-
-# if _MSC_VER >= 1300
-__declspec(noinline) static void stack_extend(rb_thread_t, int);
-# endif
-static void
-stack_extend(th, exit)
- rb_thread_t th;
- int exit;
-{
- VALUE space[1024];
-
- memset(space, 0, 1); /* prevent array from optimization */
- rb_thread_restore_context(th, exit);
-}
+NORETURN(NOINLINE(static void rb_thread_restore_context_0(rb_thread_t,int,void*)));
+NORETURN(NOINLINE(static void stack_extend(rb_thread_t, int, VALUE *)));
static void
-rb_thread_restore_context(th, exit)
- rb_thread_t th;
- int exit;
+rb_thread_restore_context_0(rb_thread_t th, int exit, void *vp)
{
- VALUE v;
static rb_thread_t tmp;
static int ex;
static VALUE tval;
- if (!th->stk_ptr) rb_bug("unsaved context");
-
-#if STACK_GROW_DIRECTION < 0
- if (&v > th->stk_pos) stack_extend(th, exit);
-#elif STACK_GROW_DIRECTION > 0
- if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
-#else
- if (&v < rb_gc_stack_start) {
- /* Stack grows downward */
- if (&v > th->stk_pos) stack_extend(th, exit);
- }
- else {
- /* Stack grows upward */
- if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
- }
-#endif
-
rb_trap_immediate = 0; /* inhibit interrupts from here */
+ if (ruby_sandbox_restore != NULL)
+ {
+ ruby_sandbox_restore(th);
+ }
ruby_frame = th->frame;
ruby_scope = th->scope;
ruby_class = th->klass;
@@ -10165,8 +10694,8 @@ rb_thread_restore_context(th, exit)
ex = exit;
FLUSH_REGISTER_WINDOWS;
MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
-#ifdef __ia64__
- MEMCPY((VALUE*)__libc_ia64_register_backing_store_base, tmp->bstr_ptr, VALUE, tmp->bstr_len);
+#ifdef __ia64
+ MEMCPY(tmp->bstr_pos, tmp->bstr_ptr, VALUE, tmp->bstr_len);
#endif
tval = rb_lastline_get();
@@ -10179,6 +10708,78 @@ rb_thread_restore_context(th, exit)
ruby_longjmp(tmp->context, ex);
}
+#ifdef __ia64
+#define C(a) rse_##a##0, rse_##a##1, rse_##a##2, rse_##a##3, rse_##a##4
+#define E(a) rse_##a##0= rse_##a##1= rse_##a##2= rse_##a##3= rse_##a##4
+static volatile int C(a), C(b), C(c), C(d), C(e);
+static volatile int C(f), C(g), C(h), C(i), C(j);
+static volatile int C(k), C(l), C(m), C(n), C(o);
+static volatile int C(p), C(q), C(r), C(s), C(t);
+int rb_dummy_false = 0;
+NORETURN(NOINLINE(static void register_stack_extend(rb_thread_t, int, void *, VALUE *)));
+static void
+register_stack_extend(rb_thread_t th, int exit, void *vp, VALUE *curr_bsp)
+{
+ if (rb_dummy_false) {
+ /* use registers as much as possible */
+ E(a) = E(b) = E(c) = E(d) = E(e) =
+ E(f) = E(g) = E(h) = E(i) = E(j) =
+ E(k) = E(l) = E(m) = E(n) = E(o) =
+ E(p) = E(q) = E(r) = E(s) = E(t) = 0;
+ E(a) = E(b) = E(c) = E(d) = E(e) =
+ E(f) = E(g) = E(h) = E(i) = E(j) =
+ E(k) = E(l) = E(m) = E(n) = E(o) =
+ E(p) = E(q) = E(r) = E(s) = E(t) = 0;
+ }
+ if (curr_bsp < th->bstr_pos+th->bstr_len) {
+ register_stack_extend(th, exit, &exit, (VALUE*)rb_ia64_bsp());
+ }
+ rb_thread_restore_context_0(th, exit, &exit);
+}
+#undef C
+#undef E
+#endif
+
+# if defined(_MSC_VER) && _MSC_VER >= 1300
+__declspec(noinline) static void stack_extend(rb_thread_t, int, VALUE*);
+# endif
+static void
+stack_extend(rb_thread_t th, int exit, VALUE *addr_in_prev_frame)
+{
+#define STACK_PAD_SIZE 1024
+ VALUE space[STACK_PAD_SIZE];
+
+#if STACK_GROW_DIRECTION < 0
+ if (addr_in_prev_frame > th->stk_pos) stack_extend(th, exit, &space[0]);
+#elif STACK_GROW_DIRECTION > 0
+ if (addr_in_prev_frame < th->stk_pos + th->stk_len) stack_extend(th, exit, &space[STACK_PAD_SIZE-1]);
+#else
+ if (addr_in_prev_frame < rb_gc_stack_start) {
+ /* Stack grows downward */
+ if (addr_in_prev_frame > th->stk_pos) stack_extend(th, exit, &space[0]);
+ }
+ else {
+ /* Stack grows upward */
+ if (addr_in_prev_frame < th->stk_pos + th->stk_len) stack_extend(th, exit, &space[STACK_PAD_SIZE-1]);
+ }
+#endif
+#ifdef __ia64
+ register_stack_extend(th, exit, space, (VALUE*)rb_ia64_bsp());
+#else
+ rb_thread_restore_context_0(th, exit, space);
+#endif
+}
+
+static void
+rb_thread_restore_context(th, exit)
+ rb_thread_t th;
+ int exit;
+{
+ VALUE v;
+ if (!th->stk_ptr) rb_bug("unsaved context");
+ stack_extend(th, exit, &v);
+}
+
static void
rb_thread_ready(th)
rb_thread_t th;
@@ -10356,6 +10957,7 @@ rb_thread_schedule()
}
#endif
rb_thread_pending = 0;
+ rb_gc_finalize_deferred();
if (curr_thread == curr_thread->next
&& curr_thread->status == THREAD_RUNNABLE)
return;
@@ -10603,6 +11205,7 @@ 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);
@@ -10643,7 +11246,7 @@ rb_thread_wait_for(time)
#ifdef ERESTART
case ERESTART:
#endif
- return;
+ break;
default:
rb_sys_fail("sleep");
}
@@ -10774,7 +11377,7 @@ rb_thread_join(th, limit)
rb_thread_t th;
double limit;
{
- enum thread_status last_status = THREAD_RUNNABLE;
+ enum rb_thread_status last_status = THREAD_RUNNABLE;
if (rb_thread_critical) rb_thread_deadlock();
if (!rb_thread_dead(th)) {
@@ -10797,7 +11400,7 @@ rb_thread_join(th, limit)
if (!rb_thread_dead(th)) return Qfalse;
}
- if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED)) {
+ if (!NIL_P(th->errinfo) && (th->flags & RAISED_EXCEPTION)) {
VALUE oldbt = get_backtrace(th->errinfo);
VALUE errat = make_backtrace();
VALUE errinfo = rb_obj_dup(th->errinfo);
@@ -10964,10 +11567,19 @@ VALUE
rb_thread_wakeup(thread)
VALUE thread;
{
+ if (!RTEST(rb_thread_wakeup_alive(thread)))
+ rb_raise(rb_eThreadError, "killed thread");
+ return thread;
+}
+
+VALUE
+rb_thread_wakeup_alive(thread)
+ VALUE thread;
+{
rb_thread_t th = rb_thread_check(thread);
if (th->status == THREAD_KILLED)
- rb_raise(rb_eThreadError, "killed thread");
+ return Qnil;
rb_thread_ready(th);
return thread;
@@ -11005,16 +11617,34 @@ rb_thread_run(thread)
}
+static void
+rb_kill_thread(th, flags)
+ rb_thread_t th;
+ int flags;
+{
+ if (th != curr_thread && th->safe < 4) {
+ rb_secure(4);
+ }
+ if (th->status == THREAD_TO_KILL || th->status == THREAD_KILLED)
+ return;
+ if (th == th->next || th == main_thread) rb_exit(EXIT_SUCCESS);
+
+ rb_thread_ready(th);
+ th->flags |= flags;
+ th->status = THREAD_TO_KILL;
+ if (!rb_thread_critical) rb_thread_schedule();
+}
+
+
/*
* call-seq:
- * thr.exit => thr or nil
- * thr.kill => thr or nil
- * thr.terminate => thr or nil
+ * thr.exit => thr
+ * thr.kill => thr
+ * thr.terminate => thr
*
- * Terminates <i>thr</i> and schedules another thread to be run. If this thread
- * is already marked to be killed, <code>exit</code> returns the
- * <code>Thread</code>. If this is the main thread, or the last thread, exits
- * the process.
+ * Terminates <i>thr</i> and schedules another thread to be run, returning
+ * the terminated <code>Thread</code>. If this is the main thread, or the
+ * last thread, exits the process.
*/
VALUE
@@ -11023,22 +11653,35 @@ rb_thread_kill(thread)
{
rb_thread_t th = rb_thread_check(thread);
- if (th != curr_thread && th->safe < 4) {
- rb_secure(4);
- }
- if (th->status == THREAD_TO_KILL || th->status == THREAD_KILLED)
- return thread;
- if (th == th->next || th == main_thread) rb_exit(EXIT_SUCCESS);
-
- rb_thread_ready(th);
- th->status = THREAD_TO_KILL;
- if (!rb_thread_critical) rb_thread_schedule();
+ rb_kill_thread(th, 0);
return thread;
}
/*
* call-seq:
+ * thr.exit! => thr
+ * thr.kill! => thr
+ * thr.terminate! => thr
+ *
+ * Terminates <i>thr</i> without calling ensure clauses and schedules
+ * another thread to be run, returning the terminated <code>Thread</code>.
+ * If this is the main thread, or the last thread, exits the process.
+ *
+ * See <code>Thread#exit</code> for the safer version.
+ */
+
+static VALUE
+rb_thread_kill_bang(thread)
+ VALUE thread;
+{
+ rb_thread_t th = rb_thread_check(thread);
+ rb_kill_thread(th, THREAD_NO_ENSURE);
+ return thread;
+}
+
+/*
+ * call-seq:
* Thread.kill(thread) => thread
*
* Causes the given <em>thread</em> to exit (see <code>Thread::exit</code>).
@@ -11126,7 +11769,7 @@ rb_thread_pass()
VALUE
rb_thread_stop()
{
- enum thread_status last_status = THREAD_RUNNABLE;
+ enum rb_thread_status last_status = THREAD_RUNNABLE;
rb_thread_critical = 0;
if (curr_thread == curr_thread->next) {
@@ -11191,10 +11834,12 @@ rb_thread_sleep_forever()
/*
* call-seq:
* thr.priority => integer
- *
- * Returns the priority of <i>thr</i>. Default is zero; higher-priority threads
- * will run before lower-priority threads.
- *
+ *
+ * Returns the priority of <i>thr</i>. Default is inherited from the
+ * current thread which creating the new thread, or zero for the
+ * initial main thread; higher-priority threads will run before
+ * lower-priority threads.
+ *
* Thread.current.priority #=> 0
*/
@@ -11209,10 +11854,10 @@ rb_thread_priority(thread)
/*
* call-seq:
* thr.priority= integer => thr
- *
+ *
* Sets the priority of <i>thr</i> to <i>integer</i>. Higher-priority threads
* will run before lower-priority threads.
- *
+ *
* count1 = count2 = 0
* a = Thread.new do
* loop { count1 += 1 }
@@ -11383,14 +12028,14 @@ rb_thread_group(thread)
return group;
}
-#ifdef __ia64__
+#ifdef __ia64
# define IA64_INIT(x) x
#else
# define IA64_INIT(x)
#endif
#define THREAD_ALLOC(th) do {\
- th = ALLOC(struct thread);\
+ th = ALLOC(struct rb_thread);\
\
th->next = 0;\
th->prev = 0;\
@@ -11405,6 +12050,7 @@ rb_thread_group(thread)
th->wait_for = 0;\
IA64_INIT(th->bstr_ptr = 0);\
IA64_INIT(th->bstr_len = 0);\
+ IA64_INIT(th->bstr_max = 0);\
FD_ZERO(&th->readfds);\
FD_ZERO(&th->writefds);\
FD_ZERO(&th->exceptfds);\
@@ -11430,6 +12076,11 @@ rb_thread_group(thread)
th->thgroup = thgroup_default;\
th->locals = 0;\
th->thread = 0;\
+ if (curr_thread == 0) {\
+ th->sandbox = Qnil;\
+ } else {\
+ th->sandbox = curr_thread->sandbox;\
+ }\
} while (0)
static rb_thread_t
@@ -11449,7 +12100,7 @@ rb_thread_alloc(klass)
return th;
}
-static int thread_init = 0;
+static int thread_init;
#if defined(_THREAD_SAFE)
static void
@@ -11468,6 +12119,11 @@ static void*
thread_timer(dummy)
void *dummy;
{
+ sigset_t all_signals;
+
+ sigfillset(&all_signals);
+ pthread_sigmask(SIG_BLOCK, &all_signals, 0);
+
for (;;) {
#ifdef HAVE_NANOSLEEP
struct timespec req, rem;
@@ -11549,7 +12205,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;
- enum thread_status status;
+ enum rb_thread_status status;
int state;
if (OBJ_FROZEN(curr_thread->thgroup)) {
@@ -11620,7 +12276,7 @@ rb_thread_start_0(fn, arg, th)
}
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
- th->flags |= THREAD_RAISED;
+ th->flags |= RAISED_EXCEPTION;
if (state == TAG_FATAL) {
/* fatal error within this thread, need to stop whole script */
main_thread->errinfo = ruby_errinfo;
@@ -11657,7 +12313,7 @@ rb_thread_create(fn, arg)
VALUE (*fn)();
void *arg;
{
- Init_stack((VALUE*)&arg);
+ Init_stack((void *)&arg);
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
}
@@ -11838,7 +12494,7 @@ rb_thread_status(thread)
rb_thread_t th = rb_thread_check(thread);
if (rb_thread_dead(th)) {
- if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
+ if (!NIL_P(th->errinfo) && (th->flags & RAISED_EXCEPTION))
return Qnil;
return Qfalse;
}
@@ -11859,7 +12515,7 @@ rb_thread_status(thread)
* thr.alive? #=> false
*/
-static VALUE
+VALUE
rb_thread_alive_p(thread)
VALUE thread;
{
@@ -11996,13 +12652,15 @@ rb_thread_interrupt()
void
rb_thread_signal_raise(sig)
- char *sig;
+ int sig;
{
- if (sig == 0) return; /* should not happen */
rb_thread_critical = 0;
if (curr_thread == main_thread) {
+ VALUE argv[1];
+
rb_thread_ready(curr_thread);
- rb_raise(rb_eSignal, "SIG%s", sig);
+ argv[0] = INT2FIX(sig);
+ rb_exc_raise(rb_class_new_instance(1, argv, rb_eSignal));
}
rb_thread_ready(main_thread);
if (!rb_thread_dead(curr_thread)) {
@@ -12010,7 +12668,7 @@ rb_thread_signal_raise(sig)
return;
}
}
- th_signm = sig;
+ th_sig = sig;
curr_thread = main_thread;
rb_thread_restore_context(curr_thread, RESTORE_SIGNAL);
}
@@ -12290,7 +12948,7 @@ static VALUE
rb_thread_inspect(thread)
VALUE thread;
{
- char *cname = rb_obj_classname(thread);
+ const char *cname = rb_obj_classname(thread);
rb_thread_t th = rb_thread_check(thread);
const char *status = thread_status_name(th->status);
VALUE str;
@@ -12369,7 +13027,7 @@ rb_thread_atfork()
* 3: 15 16
*/
-static VALUE rb_cCont;
+VALUE rb_cCont;
/*
* call-seq:
@@ -12548,7 +13206,7 @@ thgroup_list(group)
* ThreadError: can't move from the enclosed thread group
*/
-VALUE
+static VALUE
thgroup_enclose(group)
VALUE group;
{
@@ -12645,6 +13303,109 @@ thgroup_add(group, thread)
}
+/* variables for recursive traversals */
+static ID recursive_key;
+
+static VALUE
+recursive_check(hash, obj)
+ VALUE hash;
+ VALUE obj;
+{
+ if (NIL_P(hash) || TYPE(hash) != T_HASH) {
+ return Qfalse;
+ }
+ else {
+ VALUE list = rb_hash_aref(hash, ID2SYM(rb_frame_last_func()));
+
+ if (NIL_P(list) || TYPE(list) != T_HASH)
+ return Qfalse;
+ if (NIL_P(rb_hash_lookup(list, obj)))
+ return Qfalse;
+ return Qtrue;
+ }
+}
+
+static VALUE
+recursive_push(hash, obj)
+ VALUE hash;
+ VALUE obj;
+{
+ VALUE list, sym;
+
+ sym = ID2SYM(rb_frame_last_func());
+ if (NIL_P(hash) || TYPE(hash) != T_HASH) {
+ hash = rb_hash_new();
+ rb_thread_local_aset(rb_thread_current(), recursive_key, hash);
+ list = Qnil;
+ }
+ else {
+ list = rb_hash_aref(hash, sym);
+ }
+ if (NIL_P(list) || TYPE(list) != T_HASH) {
+ list = rb_hash_new();
+ rb_hash_aset(hash, sym, list);
+ }
+ rb_hash_aset(list, obj, Qtrue);
+ return hash;
+}
+
+static void
+recursive_pop(hash, obj)
+ VALUE hash;
+ VALUE obj;
+{
+ VALUE list, sym;
+
+ sym = ID2SYM(rb_frame_last_func());
+ if (NIL_P(hash) || TYPE(hash) != T_HASH) {
+ VALUE symname;
+ VALUE thrname;
+ symname = rb_inspect(sym);
+ thrname = rb_inspect(rb_thread_current());
+
+ rb_raise(rb_eTypeError, "invalid inspect_tbl hash for %s in %s",
+ StringValuePtr(symname), StringValuePtr(thrname));
+ }
+ list = rb_hash_aref(hash, sym);
+ if (NIL_P(list) || TYPE(list) != T_HASH) {
+ VALUE symname = rb_inspect(sym);
+ VALUE thrname = rb_inspect(rb_thread_current());
+ rb_raise(rb_eTypeError, "invalid inspect_tbl list for %s in %s",
+ StringValuePtr(symname), StringValuePtr(thrname));
+ }
+ rb_hash_delete(list, obj);
+}
+
+VALUE
+rb_exec_recursive(func, obj, arg)
+ VALUE (*func) _((VALUE, VALUE, int));
+ VALUE obj;
+ VALUE arg;
+{
+ VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
+ VALUE objid = rb_obj_id(obj);
+
+ if (recursive_check(hash, objid)) {
+ return (*func) (obj, arg, Qtrue);
+ }
+ else {
+ VALUE result = Qundef;
+ int state;
+
+ hash = recursive_push(hash, objid);
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ result = (*func) (obj, arg, Qfalse);
+ }
+ POP_TAG();
+ recursive_pop(hash, objid);
+ if (state)
+ JUMP_TAG(state);
+ return result;
+ }
+}
+
+
/*
* +Thread+ encapsulates the behavior of a thread of
* execution, including the main thread of the Ruby script.
@@ -12659,6 +13420,7 @@ Init_Thread()
{
VALUE cThGroup;
+ recursive_key = rb_intern("__recursive_key__");
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
rb_cThread = rb_define_class("Thread", rb_cObject);
rb_undef_alloc_func(rb_cThread);
@@ -12687,6 +13449,9 @@ Init_Thread()
rb_define_method(rb_cThread, "kill", rb_thread_kill, 0);
rb_define_method(rb_cThread, "terminate", rb_thread_kill, 0);
rb_define_method(rb_cThread, "exit", rb_thread_kill, 0);
+ rb_define_method(rb_cThread, "kill!", rb_thread_kill_bang, 0);
+ rb_define_method(rb_cThread, "terminate!", rb_thread_kill_bang, 0);
+ rb_define_method(rb_cThread, "exit!", rb_thread_kill_bang, 0);
rb_define_method(rb_cThread, "value", rb_thread_value, 0);
rb_define_method(rb_cThread, "status", rb_thread_status, 0);
rb_define_method(rb_cThread, "join", rb_thread_join_m, -1);
@@ -12723,9 +13488,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);
@@ -12858,13 +13623,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 f4c8de2f3b..ba8182593e 100644
--- a/ext/.document
+++ b/ext/.document
@@ -1,6 +1,11 @@
# 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/Setup b/ext/Setup
index 7b214abde3..d0d6317a5e 100644
--- a/ext/Setup
+++ b/ext/Setup
@@ -28,6 +28,7 @@
#syck
#syslog
#tcltklib
+#thread
#tk
#win32ole
#zlib
diff --git a/ext/Setup.atheos b/ext/Setup.atheos
index 9b1bdecb95..6bda3a4cfb 100644
--- a/ext/Setup.atheos
+++ b/ext/Setup.atheos
@@ -28,6 +28,7 @@ strscan
syck
syslog
#tcltklib
+thread
#tk
#win32ole
zlib
diff --git a/ext/Setup.dj b/ext/Setup.dj
index f2ed3a4f16..4f94788886 100644
--- a/ext/Setup.dj
+++ b/ext/Setup.dj
@@ -28,6 +28,7 @@ strscan
syck
#syslog
#tcltklib
+thread
#tk
#win32ole
zlib
diff --git a/ext/Setup.emx b/ext/Setup.emx
index 7ea04543c5..afc5923577 100644
--- a/ext/Setup.emx
+++ b/ext/Setup.emx
@@ -28,6 +28,7 @@ strscan
#syck
#syslog
#tcltklib
+thread
#tk
#win32ole
#zlib
diff --git a/ext/Setup.nt b/ext/Setup.nt
index 7a330f801a..9f8abf9b8d 100644
--- a/ext/Setup.nt
+++ b/ext/Setup.nt
@@ -28,6 +28,7 @@ strscan
syck
#syslog
#tcltklib
+thread
#tk
win32ole
#zlib
diff --git a/ext/Setup.x68 b/ext/Setup.x68
index 9b9563d941..0966e737e9 100644
--- a/ext/Setup.x68
+++ b/ext/Setup.x68
@@ -28,6 +28,7 @@ strscan
#syck
#syslog
#tcltklib
+thread
#tk
#win32ole
#zlib
diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c
index 96ce8c6636..a4fd0396f0 100644
--- a/ext/Win32API/Win32API.c
+++ b/ext/Win32API/Win32API.c
@@ -108,7 +108,7 @@ Win32API_initialize(self, dllname, proc, import, export)
}
if (16 < RARRAY(a_import)->len) {
- rb_raise(rb_eRuntimeError, "too many parameters: %d\n", RARRAY(a_import)->len);
+ rb_raise(rb_eRuntimeError, "too many parameters: %ld\n", RARRAY(a_import)->len);
}
rb_iv_set(self, "__import__", a_import);
diff --git a/ext/Win32API/lib/win32/registry.rb b/ext/Win32API/lib/win32/registry.rb
index 2671551a33..9a2f3827b7 100644
--- a/ext/Win32API/lib/win32/registry.rb
+++ b/ext/Win32API/lib/win32/registry.rb
@@ -493,7 +493,7 @@ module Win32
# utility functions
#
def self.expand_environ(str)
- str.gsub(/%([^%]+)%/) { ENV[$1] || $& }
+ str.gsub(/%([^%]+)%/) { ENV[$1] || ENV[$1.upcase] || $& }
end
@@type2name = { }
diff --git a/ext/Win32API/lib/win32/resolv.rb b/ext/Win32API/lib/win32/resolv.rb
index 5a99d04d55..92336fac28 100644
--- a/ext/Win32API/lib/win32/resolv.rb
+++ b/ext/Win32API/lib/win32/resolv.rb
@@ -11,7 +11,7 @@ module Win32
def self.get_hosts_path
path = get_hosts_dir
- path = File.join(path.gsub(/\\/, File::SEPARATOR), 'hosts')
+ path = File.expand_path('hosts', path)
File.exist?(path) ? path : nil
end
@@ -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+/))
+ nameserver.concat(ns.split(/[,\s]\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*/))
+ nameserver.concat(ns.split(/[,\s]\s*/))
end
end
rescue Registry::Error
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 7f3f1520ee..636c0907d6 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -13,6 +13,7 @@
*
*/
+#include "ruby.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -20,7 +21,6 @@
#include <errno.h>
#include <float.h>
#include <math.h>
-#include "ruby.h"
#include "math.h"
#include "version.h"
@@ -41,8 +41,123 @@ 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
+
/*
- * **** BigDecimal version ****
+ * 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.
*/
static VALUE
BigDecimal_version(VALUE self)
@@ -109,14 +224,14 @@ GetVpValue(VALUE v, int must)
#ifdef ENABLE_NUMERIC_STRING
case T_STRING:
SafeStringValue(v);
- return VpCreateRbObject(strlen(RSTRING(v)->ptr) + VpBaseFig() + 1,
- RSTRING(v)->ptr);
+ return VpCreateRbObject(strlen(RSTRING_PTR(v)) + VpBaseFig() + 1,
+ RSTRING_PTR(v));
#endif /* ENABLE_NUMERIC_STRING */
case T_BIGNUM:
bg = rb_big2str(v, 10);
- return VpCreateRbObject(strlen(RSTRING(bg)->ptr) + VpBaseFig() + 1,
- RSTRING(bg)->ptr);
+ return VpCreateRbObject(strlen(RSTRING_PTR(bg)) + VpBaseFig() + 1,
+ RSTRING_PTR(bg));
default:
goto SomeOneMayDoIt;
}
@@ -125,19 +240,35 @@ SomeOneMayDoIt:
if(must) {
rb_raise(rb_eTypeError, "%s can't be coerced into BigDecimal",
rb_special_const_p(v)?
- RSTRING(rb_inspect(v))->ptr:
+ RSTRING_PTR(rb_inspect(v)):
rb_obj_classname(v)
);
}
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)
{
@@ -188,6 +319,9 @@ 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)
{
@@ -198,7 +332,7 @@ BigDecimal_load(VALUE self, VALUE str)
unsigned long m=0;
SafeStringValue(str);
- pch = RSTRING(str)->ptr;
+ pch = (unsigned char *)RSTRING_PTR(str);
/* First get max prec */
while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
if(!ISDIGIT(ch)) {
@@ -207,12 +341,50 @@ BigDecimal_load(VALUE self, VALUE str)
m = m*10 + (unsigned long)(ch-'0');
}
if(m>VpBaseFig()) m -= VpBaseFig();
- GUARD_OBJ(pv,VpNewRbClass(m,pch,self));
+ GUARD_OBJ(pv,VpNewRbClass(m,(char *)pch,self));
m /= VpBaseFig();
if(m && pv->MaxPrec>m) pv->MaxPrec = m+1;
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)
{
@@ -302,14 +474,14 @@ VpNewRbClass(U_LONG mx, char *str, VALUE klass)
}
VP_EXPORT Real *
-VpCreateRbObject(U_LONG mx, char *str)
+VpCreateRbObject(U_LONG mx, const char *str)
{
Real *pv = VpAlloc(mx,str);
pv->obj = (VALUE)Data_Wrap_Struct(rb_cBigDecimal, 0, BigDecimal_delete, pv);
return pv;
}
-
+/* Returns True if the value is Not a Number */
static VALUE
BigDecimal_IsNaN(VALUE self)
{
@@ -318,6 +490,7 @@ BigDecimal_IsNaN(VALUE self)
return Qfalse;
}
+/* Returns True if the value is infinite */
static VALUE
BigDecimal_IsInfinite(VALUE self)
{
@@ -327,6 +500,7 @@ BigDecimal_IsInfinite(VALUE self)
return Qnil;
}
+/* Returns True if the value is finite (not NaN or infinite) */
static VALUE
BigDecimal_IsFinite(VALUE self)
{
@@ -336,6 +510,10 @@ 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)
{
@@ -399,26 +577,47 @@ 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)
{
ENTER(1);
Real *p;
- double d, d2;
+ double d;
S_LONG e;
+ char *buf;
GUARD_OBJ(p,GetVpValue(self,1));
if(VpVtoD(&d, &e, p)!=1) return rb_float_new(d);
+ buf = ALLOCA_N(char,(unsigned int)VpNumOfChars(p,"E"));
+ VpToString(p, buf, 0, 0);
errno = 0;
- d2 = pow(10.0,(double)e);
- if((errno == ERANGE && e>0) || (d2>1.0 && (fabs(d) > (DBL_MAX / d2)))) {
+ d = strtod(buf, 0);
+ if(errno == ERANGE) {
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);
+ return rb_float_new(d);
}
+/* 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)
{
@@ -440,6 +639,17 @@ 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)
{
@@ -467,6 +677,17 @@ 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)
{
@@ -522,6 +743,7 @@ 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)
{
@@ -529,6 +751,7 @@ BigDecimal_zero(VALUE self)
return VpIsZero(a) ? Qtrue : Qfalse;
}
+/* Returns True if the value is non-zero. */
static VALUE
BigDecimal_nonzero(VALUE self)
{
@@ -536,42 +759,73 @@ 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, '=');
}
-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)
{
@@ -589,6 +843,17 @@ 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)
{
@@ -627,6 +892,23 @@ 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 */
@@ -705,6 +987,12 @@ 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 */
{
@@ -755,16 +1043,42 @@ 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 */
{
VALUE f;
- Real *d,*rv;
+ Real *d,*rv=0;
f = BigDecimal_divremain(self,r,&d,&rv);
if(f!=(VALUE)0) return f;
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)
{
@@ -866,6 +1180,12 @@ 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)
{
@@ -881,6 +1201,13 @@ 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)
{
@@ -898,6 +1225,8 @@ BigDecimal_sqrt(VALUE self, VALUE nFig)
return ToValue(c);
}
+/* Return the integer part of the number.
+ */
static VALUE
BigDecimal_fix(VALUE self)
{
@@ -912,12 +1241,34 @@ 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)
{
ENTER(5);
Real *c, *a;
- int iLoc;
+ int iLoc = 0;
U_LONG mx;
VALUE vLoc;
VALUE vRound;
@@ -955,6 +1306,25 @@ 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)
{
@@ -980,6 +1350,8 @@ BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
return ToValue(c);
}
+/* Return the fractional part of the number.
+ */
static VALUE
BigDecimal_frac(VALUE self)
{
@@ -994,6 +1366,25 @@ 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)
{
@@ -1019,6 +1410,25 @@ 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)
{
@@ -1044,6 +1454,36 @@ 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)
{
@@ -1062,13 +1502,13 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
if(rb_scan_args(argc,argv,"01",&f)==1) {
if(TYPE(f)==T_STRING) {
SafeStringValue(f);
- psz = RSTRING(f)->ptr;
+ psz = RSTRING_PTR(f);
if(*psz==' ') {
fPlus = 1; psz++;
} else if(*psz=='+') {
fPlus = 2; psz++;
}
- while(ch=*psz++) {
+ while((ch=*psz++)!=0) {
if(ISSPACE(ch)) continue;
if(!ISDIGIT(ch)) {
if(ch=='F' || ch=='f') fmt = 1; /* F format */
@@ -1097,6 +1537,30 @@ 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)
{
@@ -1125,6 +1589,11 @@ 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)
{
@@ -1132,6 +1601,16 @@ 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)
{
@@ -1154,6 +1633,13 @@ 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)
{
@@ -1193,10 +1679,22 @@ BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
mf = GetPositiveInt(nFig);
}
SafeStringValue(iniValue);
- GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING(iniValue)->ptr));
+ GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING_PTR(iniValue)));
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)
{
@@ -1212,10 +1710,22 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
mf = GetPositiveInt(nFig);
}
SafeStringValue(iniValue);
- GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING(iniValue)->ptr,self));
+ GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING_PTR(iniValue),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)
{
@@ -1235,6 +1745,22 @@ 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 */
@@ -1264,37 +1790,112 @@ 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 */
+
+ /*
+ * 0xff: 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));
+
+ /*
+ * 0x02: 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));
+
+ /*
+ * 0x01: 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));
+
+ /*
+ * 0x04: 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));
+
+ /*
+ * 0x01: 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));
+
+ /*
+ * 0x01: Determines what happens when a division by zero is performed.
+ * See BigDecimal.mode.
+ */
rb_define_const(rb_cBigDecimal, "EXCEPTION_ZERODIVIDE",INT2FIX(VP_EXCEPTION_ZERODIVIDE));
- /* Computation mode */
+ /*
+ * 0x100: Determines what happens when a result must be rounded in order to
+ * fit in the appropriate number of significant digits. See
+ * BigDecimal.mode.
+ */
rb_define_const(rb_cBigDecimal, "ROUND_MODE",INT2FIX(VP_ROUND_MODE));
+
+ /* 1: Indicates that values should be rounded away from zero. See
+ * BigDecimal.mode.
+ */
rb_define_const(rb_cBigDecimal, "ROUND_UP",INT2FIX(VP_ROUND_UP));
+
+ /* 2: Indicates that values should be rounded towards zero. See
+ * BigDecimal.mode.
+ */
rb_define_const(rb_cBigDecimal, "ROUND_DOWN",INT2FIX(VP_ROUND_DOWN));
+
+ /* 3: 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));
+
+ /* 4: 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));
+ /* 5: Round towards +infinity. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_CEILING",INT2FIX(VP_ROUND_CEIL));
+
+ /* 6: Round towards -infinity. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_FLOOR",INT2FIX(VP_ROUND_FLOOR));
+
+ /* 7: Round towards the even neighbor. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_HALF_EVEN",INT2FIX(VP_ROUND_HALF_EVEN));
- /* Constants for sign value */
+ /* 0: Indicates that a value is not a number. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_NaN",INT2FIX(VP_SIGN_NaN));
+
+ /* 1: Indicates that a value is +0. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_ZERO",INT2FIX(VP_SIGN_POSITIVE_ZERO));
+
+ /* -1: Indicates that a value is -0. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_ZERO",INT2FIX(VP_SIGN_NEGATIVE_ZERO));
+
+ /* 2: Indicates that a value is positive and finite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_FINITE",INT2FIX(VP_SIGN_POSITIVE_FINITE));
+
+ /* -2: Indicates that a value is negative and finite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_FINITE",INT2FIX(VP_SIGN_NEGATIVE_FINITE));
+
+ /* 3: Indicates that a value is positive and infinite. See BigDecimal.sign. */
rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_INFINITE",INT2FIX(VP_SIGN_POSITIVE_INFINITE));
+
+ /* -3: 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);
@@ -1330,7 +1931,6 @@ Init_bigdecimal(void)
rb_define_method(rb_cBigDecimal, "==", BigDecimal_eq, 1);
rb_define_method(rb_cBigDecimal, "===", BigDecimal_eq, 1);
rb_define_method(rb_cBigDecimal, "eql?", BigDecimal_eq, 1);
- rb_define_method(rb_cBigDecimal, "!=", BigDecimal_ne, 1);
rb_define_method(rb_cBigDecimal, "<", BigDecimal_lt, 1);
rb_define_method(rb_cBigDecimal, "<=", BigDecimal_le, 1);
rb_define_method(rb_cBigDecimal, ">", BigDecimal_gt, 1);
@@ -1365,17 +1965,27 @@ static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
static U_LONG gnPrecLimit = 0; /* Global upper limit of the precision newly allocated */
static U_LONG gfRoundMode = VP_ROUND_HALF_UP; /* Mode for general rounding operation */
+#ifndef BASE_FIG
static U_LONG BASE_FIG = 4; /* =log10(BASE) */
static U_LONG BASE = 10000L; /* Base value(value must be 10**BASE_FIG) */
/* The value of BASE**2 + BASE must be represented */
/* within one U_LONG. */
static U_LONG HALF_BASE = 5000L;/* =BASE/2 */
-static S_LONG DBLE_FIG = 8; /* figure of double */
static U_LONG BASE1 = 1000L; /* =BASE/10 */
+#else
+#ifndef BASE
+#error BASE_FIG is defined but BASE is not
+#endif
+#define HALF_BASE (BASE/2)
+#define BASE1 (BASE/10)
+#endif
+#ifndef DBLE_FIG
+#define DBLE_FIG (DBL_DIG+1) /* figure of double */
+#endif
static Real *VpConstOne; /* constant 1.0 */
static Real *VpPt5; /* constant 0.5 */
-static U_LONG maxnr = 100; /* Maximum iterations for calcurating sqrt. */
+#define maxnr 100UL /* Maximum iterations for calcurating sqrt. */
/* used in VpSqrt() */
/* ETC */
@@ -1492,8 +2102,8 @@ VpSetRoundMode(unsigned long n)
* (to let the compiler know they may be changed in outside
* (... but not actually..)).
*/
-volatile double gZero_ABCED9B1_CE73__00400511F31D = 0.0;
-volatile double gOne_ABCED9B4_CE73__00400511F31D = 1.0;
+volatile const double gZero_ABCED9B1_CE73__00400511F31D = 0.0;
+volatile const double gOne_ABCED9B4_CE73__00400511F31D = 1.0;
static double
Zero(void)
{
@@ -1578,7 +2188,7 @@ VpIsNegDoubleZero(double v)
}
VP_EXPORT int
-VpException(unsigned short f,char *str,int always)
+VpException(unsigned short f, const char *str,int always)
{
VALUE exc;
int fatal=0;
@@ -1615,8 +2225,8 @@ VpException(unsigned short f,char *str,int always)
return 0; /* 0 Means VpException() raised no exception */
raise:
- if(fatal) rb_fatal(str);
- else rb_raise(exc,str);
+ if(fatal) rb_fatal("%s", str);
+ else rb_raise(exc, "%s", str);
return 0;
}
@@ -1720,7 +2330,7 @@ NaN:
* returns number of chars needed to represent vp in specified format.
*/
VP_EXPORT U_LONG
-VpNumOfChars(Real *vp,char *pszFmt)
+VpNumOfChars(Real *vp,const char *pszFmt)
{
S_INT ex;
U_LONG nc;
@@ -1765,16 +2375,15 @@ VpNumOfChars(Real *vp,char *pszFmt)
VP_EXPORT U_LONG
VpInit(U_LONG BaseVal)
{
- U_LONG w;
- double v;
-
/* Setup +/- Inf NaN -0 */
VpGetDoubleNaN();
VpGetDoublePosInf();
VpGetDoubleNegInf();
VpGetDoubleNegZero();
+#ifndef BASE_FIG
if(BaseVal <= 0) {
+ U_LONG w;
/* Base <= 0, then determine Base by calcuration. */
BASE = 1;
while(
@@ -1791,6 +2400,8 @@ VpInit(U_LONG BaseVal)
BASE1 = BASE / 10;
BASE_FIG = 0;
while(BaseVal /= 10) ++BASE_FIG;
+#endif
+
/* Allocates Vp constants. */
VpConstOne = VpAlloc((U_LONG)1, "1");
VpPt5 = VpAlloc((U_LONG)1, ".5");
@@ -1799,15 +2410,6 @@ VpInit(U_LONG BaseVal)
gnAlloc = 0;
#endif /* _DEBUG */
- /* Determine # of digits available in one 'double'. */
-
- v = 1.0;
- DBLE_FIG = 0;
- while(v + 1.0 > 1.0) {
- ++DBLE_FIG;
- v /= 10;
- }
-
#ifdef _DEBUG
if(gfDebug) {
printf("VpInit: BaseVal = %lu\n", BaseVal);
@@ -1823,7 +2425,7 @@ VpInit(U_LONG BaseVal)
}
VP_EXPORT Real *
-VpOne()
+VpOne(void)
{
return VpConstOne;
}
@@ -1873,7 +2475,7 @@ overflow:
* NULL be returned if memory allocation is failed,or any error.
*/
VP_EXPORT Real *
-VpAlloc(U_LONG mx, char *szVal)
+VpAlloc(U_LONG mx, const char *szVal)
{
U_LONG i, ni, ipn, ipf, nf, ipe, ne, nalloc;
char v,*psz;
@@ -1905,14 +2507,25 @@ VpAlloc(U_LONG mx, char *szVal)
return vp;
}
- /* Skip all spaces */
+ /* Skip all '_' after digit: 2006-6-30 */
+ ni = 0;
psz = ALLOCA_N(char,strlen(szVal)+1);
i = 0;
ipn = 0;
- while(psz[i]=szVal[ipn]) {
- if(ISSPACE(szVal[ipn])) {ipn++;continue;}
+ while((psz[i]=szVal[ipn])!=0) {
+ if(ISDIGIT(psz[i])) ++ni;
+ if(psz[i]=='_') {
+ if(ni>0) {ipn++;continue;}
+ psz[i]=0;
+ break;
+ }
++i; ++ipn;
}
+ /* Skip trailing spaces */
+ while((--i)>0) {
+ if(ISSPACE(psz[i])) psz[i] = 0;
+ else break;
+ }
szVal = psz;
/* Check on Inf & NaN */
@@ -1942,7 +2555,7 @@ VpAlloc(U_LONG mx, char *szVal)
else if(szVal[i] == '+') ++i;
/* Skip digits */
ni = 0; /* digits in mantissa */
- while(v = szVal[i]) {
+ while((v = szVal[i]) != 0) {
if(!ISDIGIT(v)) break;
++i;
++ni;
@@ -1956,7 +2569,7 @@ VpAlloc(U_LONG mx, char *szVal)
if(szVal[i] == '.') { /* xxx. */
++i;
ipf = i;
- while(v = szVal[i]) { /* get fraction part. */
+ while((v = szVal[i]) != 0) { /* get fraction part. */
if(!ISDIGIT(v)) break;
++i;
++nf;
@@ -1974,7 +2587,7 @@ VpAlloc(U_LONG mx, char *szVal)
ipe = i;
v = szVal[i];
if((v == '-') ||(v == '+')) ++i;
- while(v=szVal[i]) {
+ while((v=szVal[i])!=0) {
if(!ISDIGIT(v)) break;
++i;
++ne;
@@ -3277,7 +3890,7 @@ VpToFString(Real *a,char *psz,int fFmt,int fPlus)
* ne ... number of characters in exp_chr[],not including '+/-'.
*/
VP_EXPORT int
-VpCtoV(Real *a, char *int_chr, U_LONG ni, char *frac, U_LONG nf, char *exp_chr, U_LONG ne)
+VpCtoV(Real *a, const char *int_chr, U_LONG ni, const char *frac, U_LONG nf, const char *exp_chr, U_LONG ne)
{
U_LONG i, j, ind_a, ma, mi, me;
U_LONG loc;
@@ -3313,7 +3926,7 @@ VpCtoV(Real *a, char *int_chr, U_LONG ni, char *frac, U_LONG nf, char *exp_chr,
/* get integer part */
i = 0;
sign = 1;
- if(ni > 0) {
+ if(ni >= 0) {
if(int_chr[0] == '-') {
sign = -1;
++i;
@@ -3826,7 +4439,7 @@ VpLeftRound(Real *y, int f, int nf)
if(!VpHasVal(y)) return 0; /* Unable to round */
v = y->frac[0];
nf -= VpExponent(y)*BASE_FIG;
- while(v=v/10) nf--;
+ while((v /= 10) != 0) nf--;
nf += (BASE_FIG-1);
return VpMidRound(y,f,nf);
}
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index aabc551a76..4f77feab00 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -105,7 +105,7 @@ typedef struct {
VP_EXPORT Real *
VpNewRbClass(U_LONG mx,char *str,VALUE klass);
-VP_EXPORT Real *VpCreateRbObject(U_LONG mx,char *str);
+VP_EXPORT Real *VpCreateRbObject(U_LONG mx,const char *str);
VP_EXPORT U_LONG VpBaseFig(void);
VP_EXPORT U_LONG VpDblFig(void);
@@ -126,13 +126,13 @@ VP_EXPORT int VpIsRoundMode(unsigned long n);
VP_EXPORT unsigned long VpGetRoundMode(void);
VP_EXPORT unsigned long VpSetRoundMode(unsigned long n);
-VP_EXPORT int VpException(unsigned short f,char *str,int always);
+VP_EXPORT int VpException(unsigned short f,const char *str,int always);
VP_EXPORT int VpIsNegDoubleZero(double v);
-VP_EXPORT U_LONG VpNumOfChars(Real *vp,char *pszFmt);
+VP_EXPORT U_LONG VpNumOfChars(Real *vp,const char *pszFmt);
VP_EXPORT U_LONG VpInit(U_LONG BaseVal);
VP_EXPORT void *VpMemAlloc(U_LONG mb);
VP_EXPORT void VpFree(Real *pv);
-VP_EXPORT Real *VpAlloc(U_LONG mx, char *szVal);
+VP_EXPORT Real *VpAlloc(U_LONG mx, const char *szVal);
VP_EXPORT int VpAsgn(Real *c,Real *a,int isw);
VP_EXPORT int VpAddSub(Real *c,Real *a,Real *b,int operation);
VP_EXPORT int VpMult(Real *c,Real *a,Real *b);
@@ -143,7 +143,7 @@ VP_EXPORT void VpSzMantissa(Real *a,char *psz);
VP_EXPORT int VpToSpecialString(Real *a,char *psz,int fPlus);
VP_EXPORT void VpToString(Real *a,char *psz,int fFmt,int fPlus);
VP_EXPORT void VpToFString(Real *a,char *psz,int fFmt,int fPlus);
-VP_EXPORT int VpCtoV(Real *a,char *int_chr,U_LONG ni,char *frac,U_LONG nf,char *exp_chr,U_LONG ne);
+VP_EXPORT int VpCtoV(Real *a,const char *int_chr,U_LONG ni,const char *frac,U_LONG nf,const char *exp_chr,U_LONG ne);
VP_EXPORT int VpVtoD(double *d,S_LONG *e,Real *m);
VP_EXPORT void VpDtoV(Real *m,double d);
VP_EXPORT void VpItoV(Real *m,S_INT ival);
@@ -155,7 +155,7 @@ VP_EXPORT void VpFrac(Real *y,Real *x);
VP_EXPORT int VpPower(Real *y,Real *x,S_INT n);
/* VP constants */
-VP_EXPORT Real *VpOne();
+VP_EXPORT Real *VpOne(void);
/*
* ------------------
diff --git a/ext/bigdecimal/bigdecimal_en.html b/ext/bigdecimal/bigdecimal_en.html
index 02c88df43e..c2b86faef6 100644
--- a/ext/bigdecimal/bigdecimal_en.html
+++ b/ext/bigdecimal/bigdecimal_en.html
@@ -379,7 +379,7 @@ after every n digits for readability.
<CODE><PRE>
BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
</PRE></CODE>
-n can be an string representing a positive integer number.
+n can be a string representing a positive integer number.
<CODE><PRE>
BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
</PRE></CODE>
@@ -678,10 +678,9 @@ structure.
</DL>
<H3>Disadvantage of decimal representation</H3>
-Advantages stated so far can also be disadvantages if the input from outside is
- represented in binary.
-Translation error from decimal to binary or vice versa is inevitable.
-So,translation from Float(binary) to BigDecimal(decimal) is not alway done exactly.
+Because most computers have no internal decimal representaion.
+Once you use BigDecimal,you need to keep using it without
+considering computation cost if exact computation is required.
<H4>Which is the first input?</H4>
Because most people uses decimal notatin for numeric data representation,
diff --git a/ext/bigdecimal/bigdecimal_ja.html b/ext/bigdecimal/bigdecimal_ja.html
index 8fd95a6fe3..37bbcbbb09 100644
--- a/ext/bigdecimal/bigdecimal_ja.html
+++ b/ext/bigdecimal/bigdecimal_ja.html
@@ -676,10 +676,11 @@ exponent=1Asign=2 ‚Ȃ甒l‚ª 1234.56784321 ‚Å‚ ‚é‚̂͌©‚ê‚Î’¼‚®‚É•ª‚©‚è‚Ü‚·B
<H3>10i‚̃fƒƒŠƒbƒg</H3>
ŽÀ‚Í¡‚܂ł̃ƒŠƒbƒg‚ÍA‚»‚̂܂܃fƒƒŠƒbƒg‚É‚à‚È‚è‚Ü‚·B
-‚»‚à‚»‚àA10i‚ð2iA2i‚ð10i‚ɕϊ·‚·‚邿‚¤‚È‘€ì‚͕ϊ·Œë·
+‚»‚à‚»‚àA10i‚ð2i‚ɕϊ·‚·‚邿‚¤‚È‘€ì‚͕ϊ·Œë·
‚𔺂¤ê‡‚ð‰ñ”ð‚·‚é‚±‚Ƃ͂ł«‚Ü‚¹‚ñB
-Šù‚ÉŒvŽZ‹@“à•”‚ÉŽæ‚螂܂ꂽ2i”’l‚ð BigDecimal ‚Ì“à•”•\Œ»‚É
-•ÏŠ·‚·‚邯‚«‚ɂ͌뷂ª”ð‚¯‚ç‚ê‚È‚¢ê‡‚ª‚ ‚è‚Ü‚·B
+‘åŠT‚̃Rƒ“ƒsƒ…[ƒ^‚Í10i‚Ì“à•”•\Œ»‚ðŽ‚Á‚Ä‚¢‚È‚¢‚Ì‚ÅA
+BigDecimal ‚ð—˜—p‚µ‚Č뷖³‚µ‚ÌŒvŽZ‚ð‚·‚éꇂÍAŒvŽZ‘¬“x
+‚𖳎‹‚µ‚Ä‚àÅŒã‚܂ŠBigDecimal ‚ðŽg—p‘±‚¯‚é•K—v‚ª‚ ‚è‚Ü‚·B
<H3>ʼn‚͉½‚©H</H3>
Ž©•ª‚ÅŒvŽZ‚·‚邯‚«‚ɂ킴‚í‚´2i”‚ðŽg‚¤l‚͋ɂ߂Ă܂ê‚Å‚·B
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index a68a656044..0c8b98e4a3 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -1,2 +1,10 @@
require 'mkmf'
+
+base_fig = 0
+src = "(BASE * (BASE+1)) / BASE == (BASE+1)"
+while try_static_assert(src, nil, "-DBASE=10#{'0'*base_fig}UL")
+ base_fig += 1
+end
+$defs << "-DBASE=1#{'0'*base_fig}UL" << "-DBASE_FIG=#{base_fig}"
+
create_makefile('bigdecimal')
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index 34a60ae67a..d80eeab901 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -1,9 +1,27 @@
#
-# jacobian.rb
+# require 'bigdecimal/jacobian'
#
-# Computes Jacobian matrix of f at x
+# 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).
#
module Jacobian
+ #--
def isEqual(a,b,zero=0.0,e=1.0e-8)
aa = a.abs
bb = b.abs
@@ -17,7 +35,10 @@ 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
@@ -49,6 +70,7 @@ 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 1d5d3170cc..8f4888725e 100644
--- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
+++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -1,7 +1,8 @@
#
-# ludcmp.rb
+# Solves a*x = b for x, using LU decomposition.
#
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 = []
@@ -52,6 +53,12 @@ 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 7b3f46ed1a..f3248a3c5c 100644
--- a/ext/bigdecimal/lib/bigdecimal/math.rb
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -1,4 +1,5 @@
#
+#--
# Contents:
# sqrt(x, prec)
# sin (x, prec)
@@ -13,19 +14,35 @@
# 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.rb"
+# require "bigdecimal/math"
+#
# 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?
@@ -51,6 +68,9 @@ 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?
@@ -76,6 +96,10 @@ 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?
@@ -96,6 +120,13 @@ 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?
@@ -117,6 +148,11 @@ 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?
@@ -138,6 +174,7 @@ 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
@@ -176,6 +213,8 @@ 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 f88fabe5dc..59ac0f7f04 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -1,24 +1,26 @@
#
# newton.rb
#
-# Solves nonlinear algebraic equation system f = 0 by Newton's method.
-# (This program is not dependent on BigDecimal)
+# Solves the 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 solution vector.
-# f is the object to be solved which must have following methods.
+# 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:
#
-# 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.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.
+#
+# On exit, x is the solution vector.
#
require "bigdecimal/ludcmp"
require "bigdecimal/jacobian"
@@ -60,7 +62,7 @@ module Newton
begin
fact *= p5
if fact < minfact then
- raize "Failed to reduce function values."
+ raise "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/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
index 1f8d6c7a49..09e926acd5 100644
--- a/ext/bigdecimal/lib/bigdecimal/util.rb
+++ b/ext/bigdecimal/lib/bigdecimal/util.rb
@@ -1,19 +1,17 @@
#
# BigDecimal utility library.
-# ----------------------------------------------------------------------
-# Contents:
#
-# String#
-# to_d ... to BigDecimal
+# To use these functions, require 'bigdecimal/util'
+#
+# The following methods are provided to convert other types to BigDecimals:
#
-# Float#
-# to_d ... to BigDecimal
+# String#to_d -> BigDecimal
+# Float#to_d -> BigDecimal
+# Rational#to_d -> BigDecimal
#
-# BigDecimal#
-# to_r ... to Rational
+# The following method is provided to convert BigDecimals to other types:
#
-# Rational#
-# to_d ... to BigDecimal
+# BigDecimal#to_r -> Rational
#
# ----------------------------------------------------------------------
#
@@ -30,8 +28,8 @@ class String
end
class BigDecimal < Numeric
- # to "nnnnnn.mmm" form digit string
- # Use BigDecimal#to_s("F") instead.
+ # Converts a BigDecimal to a String of the form "nnnnnn.mmm".
+ # This method is deprecated; use BigDecimal#to_s("F") instead.
def to_digits
if self.nan? || self.infinite? || self.zero?
self.to_s
@@ -42,22 +40,21 @@ class BigDecimal < Numeric
end
end
- # Convert BigDecimal to Rational
+ # Converts a BigDecimal to a 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
- denominator = base ** (-denomi_power)
+ Rational(numerator,base ** (-denomi_power))
else
- denominator = base ** denomi_power
+ Rational(numerator * (base ** denomi_power),1)
end
- Rational(numerator,denominator)
end
end
class Rational < Numeric
- # Convert Rational to BigDecimal
+ # Converts a Rational to a BigDecimal
def to_d(nFig=0)
num = self.numerator.to_s
if nFig<=0
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index b54b07126d..9c51a2127f 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -683,7 +683,7 @@ curses_getmouse(VALUE obj)
val = Data_Make_Struct(cMouseEvent,struct mousedata,
0,curses_mousedata_free,mdata);
- mdata->mevent = (MEVENT*)malloc(sizeof(MEVENT));
+ mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT));
return (getmouse(mdata->mevent) == OK) ? val : Qnil;
}
@@ -1255,7 +1255,6 @@ window_color_set(VALUE obj, VALUE col)
GetWINDOW(obj, winp);
res = wcolor_set(winp->window, NUM2INT(col), NULL);
return (res == OK) ? Qtrue : Qfalse;
- return Qfalse;
}
#endif /* USE_COLOR */
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 01fe971093..0124bbbf4a 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -20,7 +20,7 @@ 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)
- have_func(f)
+ have_func(f) || (have_macro(f, curses) && $defs.push(format("-DHAVE_%s", f.upcase)))
end
flag = "-D_XOPEN_SOURCE_EXTENDED"
src = "int test_var[(sizeof(char*)>sizeof(int))*2-1];"
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 69b7a6e7a7..0247387fdc 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -812,5 +812,7 @@ Init_dbm()
#ifdef DB_VERSION_STRING
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(DB_VERSION_STRING));
+#else
+ rb_define_const(rb_cDBM, "VERSION", rb_str_new2("unknown"));
#endif
}
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 5a67603e69..0074ab605b 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -2,9 +2,13 @@ require 'mkmf'
dir_config("dbm")
-dblib = with_config("dbm-type", nil)
+if dblib = with_config("dbm-type", nil)
+ dblib = dblib.split(/[ ,]+/)
+else
+ dblib = %w(db db2 db1 dbm gdbm gdbm_compat qdbm)
+end
-$dbm_conf_headers = {
+headers = {
"db" => ["db.h"],
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
"db2" => ["db2/db.h", "db2.h", "db.h"],
@@ -14,48 +18,36 @@ $dbm_conf_headers = {
"qdbm" => ["relic.h"],
}
-def db_check(db)
- $dbm_conf_db_prefix = ""
- $dbm_conf_have_gdbm = false
- hsearch = ""
+def headers.db_check(db)
+ db_prefix = nil
+ have_gdbm = false
+ hsearch = nil
case db
when /^db2?$/
- $dbm_conf_db_prefix = "__db_n"
+ db_prefix = "__db_n"
hsearch = "-DDB_DBM_HSEARCH "
when "gdbm"
- $dbm_conf_have_gdbm = true
+ have_gdbm = true
when "gdbm_compat"
- $dbm_conf_have_gdbm = true
+ have_gdbm = true
have_library("gdbm") or return false
end
-
- 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)
- $CFLAGS += " " + hsearch + '-DDBM_HDR="<'+hdr+'>"'
- return true
- end
- end
- end
- return false
-end
-
-def db_prefix(func)
- $dbm_conf_db_prefix+func
-end
-
-if dblib
- db_check(dblib)
-else
- for dblib in %w(db db2 db1 dbm gdbm gdbm_compat qdbm)
- db_check(dblib) and break
+ db_prefix ||= ""
+
+ if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and
+ hdr = self.fetch(db, ["ndbm.h"]).find {|hdr| have_type("DBM", hdr, hsearch)}
+ have_func(db_prefix+"dbm_clearerr") unless have_gdbm
+ $defs << hsearch if hsearch
+ $defs << '-DDBM_HDR="<'+hdr+'>"'
+ true
+ else
+ false
end
end
-have_header("cdefs.h")
-have_header("sys/cdefs.h")
-if /DBM_HDR/ =~ $CFLAGS and have_func(db_prefix("dbm_open"))
- have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
+if dblib.any? {|db| headers.db_check(db)}
+ have_header("cdefs.h")
+ have_header("sys/cdefs.h")
create_makefile("dbm")
end
diff --git a/ext/enumerator/.cvsignore b/ext/digest/bubblebabble/.cvsignore
index fc802ff1c2..4088712231 100644
--- a/ext/enumerator/.cvsignore
+++ b/ext/digest/bubblebabble/.cvsignore
@@ -1,2 +1,3 @@
Makefile
mkmf.log
+*.def
diff --git a/ext/digest/bubblebabble/bubblebabble.c b/ext/digest/bubblebabble/bubblebabble.c
new file mode 100644
index 0000000000..3a03ceced0
--- /dev/null
+++ b/ext/digest/bubblebabble/bubblebabble.c
@@ -0,0 +1,142 @@
+/************************************************
+
+ bubblebabble.c - BubbleBabble encoding support
+
+ $Author$
+ created at: Fri Oct 13 18:31:42 JST 2006
+
+ Copyright (C) 2006 Akinori MUSHA
+
+ $Id$
+
+************************************************/
+
+#include "ruby.h"
+#include "digest.h"
+
+static ID id_digest;
+
+static VALUE
+bubblebabble_str_new(VALUE str_digest)
+{
+ char *digest;
+ size_t digest_len;
+ VALUE str;
+ char *p;
+ int i, j, seed = 1;
+ static const char vowels[] = {
+ 'a', 'e', 'i', 'o', 'u', 'y'
+ };
+ static const char consonants[] = {
+ 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', 'n',
+ 'p', 'r', 's', 't', 'v', 'z', 'x'
+ };
+
+ StringValue(str_digest);
+ digest = RSTRING_PTR(str_digest);
+ digest_len = RSTRING_LEN(str_digest);
+
+ if ((LONG_MAX - 2) / 3 < (digest_len | 1)) {
+ rb_raise(rb_eRuntimeError, "digest string too long");
+ }
+
+ str = rb_str_new(0, (digest_len | 1) * 3 + 2);
+ p = RSTRING_PTR(str);
+
+ i = j = 0;
+ p[j++] = 'x';
+
+ for (;;) {
+ unsigned char byte1, byte2;
+
+ if (i >= digest_len) {
+ p[j++] = vowels[seed % 6];
+ p[j++] = consonants[16];
+ p[j++] = vowels[seed / 6];
+ break;
+ }
+
+ byte1 = digest[i++];
+ p[j++] = vowels[(((byte1 >> 6) & 3) + seed) % 6];
+ p[j++] = consonants[(byte1 >> 2) & 15];
+ p[j++] = vowels[((byte1 & 3) + (seed / 6)) % 6];
+
+ if (i >= digest_len) {
+ break;
+ }
+
+ byte2 = digest[i++];
+ p[j++] = consonants[(byte2 >> 4) & 15];
+ p[j++] = '-';
+ p[j++] = consonants[byte2 & 15];
+
+ seed = (seed * 5 + byte1 * 7 + byte2) % 36;
+ }
+
+ p[j] = 'x';
+
+ return str;
+}
+
+/*
+ * call-seq:
+ * Digest.bubblebabble(string) -> bubblebabble_string
+ *
+ * Returns a BubbleBabble encoded version of a given _string_.
+ */
+static VALUE
+rb_digest_s_bubblebabble(VALUE klass, VALUE str)
+{
+ return bubblebabble_str_new(str);
+}
+
+/*
+ * call-seq:
+ * Digest::Class.bubblebabble(string, ...) -> hash_string
+ *
+ * Returns the BubbleBabble encoded hash value of a given _string_.
+ */
+static VALUE
+rb_digest_class_s_bubblebabble(int argc, VALUE *argv, VALUE klass)
+{
+ return bubblebabble_str_new(rb_funcall2(klass, id_digest, argc, argv));
+}
+
+/*
+ * call-seq:
+ * digest_obj.bubblebabble -> hash_string
+ *
+ * Returns the resulting hash value in a Bubblebabble encoded form.
+ */
+static VALUE
+rb_digest_instance_bubblebabble(VALUE self)
+{
+ return bubblebabble_str_new(rb_funcall(self, id_digest, 0));
+}
+
+/*
+ * This module adds some methods to Digest classes to perform
+ * BubbleBabble encoding.
+ */
+void
+Init_bubblebabble(void)
+{
+ VALUE mDigest, mDigest_Instance, cDigest_Class;
+
+ rb_require("digest");
+
+ mDigest = rb_path2class("Digest");
+ mDigest_Instance = rb_path2class("Digest::Instance");
+ cDigest_Class = rb_path2class("Digest::Class");
+
+ /* Digest::bubblebabble() */
+ rb_define_module_function(mDigest, "bubblebabble", rb_digest_s_bubblebabble, 1);
+
+ /* Digest::Class::bubblebabble() */
+ rb_define_singleton_method(cDigest_Class, "bubblebabble", rb_digest_class_s_bubblebabble, -1);
+
+ /* Digest::Instance#bubblebabble() */
+ rb_define_method(mDigest_Instance, "bubblebabble", rb_digest_instance_bubblebabble, 0);
+
+ id_digest = rb_intern("digest");
+}
diff --git a/ext/digest/bubblebabble/depend b/ext/digest/bubblebabble/depend
new file mode 100644
index 0000000000..b20148ded4
--- /dev/null
+++ b/ext/digest/bubblebabble/depend
@@ -0,0 +1,3 @@
+bubblebabble.o: bubblebabble.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
+ $(srcdir)/../defs.h
diff --git a/ext/digest/bubblebabble/extconf.rb b/ext/digest/bubblebabble/extconf.rb
new file mode 100644
index 0000000000..53cb83934a
--- /dev/null
+++ b/ext/digest/bubblebabble/extconf.rb
@@ -0,0 +1,6 @@
+require 'mkmf'
+
+$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
+
+create_makefile('digest/bubblebabble')
diff --git a/ext/digest/defs.h b/ext/digest/defs.h
index 5cfc77dd24..b9a3470e65 100644
--- a/ext/digest/defs.h
+++ b/ext/digest/defs.h
@@ -23,12 +23,8 @@
typedef unsigned int uint32_t;
# if SIZEOF_LONG == 8
typedef unsigned long uint64_t;
-# elif defined(__GNUC__)
- typedef unsigned long long uint64_t;
-# elif defined(_MSC_VER)
- typedef unsigned _int64 uint64_t;
-# elif defined(__BORLANDC__)
- typedef unsigned __int64 uint64_t;
+# elif SIZEOF_LONG_LONG == 8
+ typedef unsigned LONG_LONG uint64_t;
# else
# define NO_UINT64_T
# endif
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 70f986327a..0b910e8c47 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -6,153 +6,487 @@
created at: Fri May 25 08:57:27 JST 2001
Copyright (C) 1995-2001 Yukihiro Matsumoto
- Copyright (C) 2001 Akinori MUSHA
+ Copyright (C) 2001-2006 Akinori MUSHA
$RoughId: digest.c,v 1.16 2001/07/13 15:38:27 knu Exp $
$Id$
************************************************/
+#include "digest.h"
+
+static VALUE rb_mDigest;
+static VALUE rb_mDigest_Instance;
+static VALUE rb_cDigest_Class;
+static VALUE rb_cDigest_Base;
+
+static ID id_reset, id_update, id_finish, id_digest, id_hexdigest, id_digest_length;
+static ID id_metadata;
+
+RUBY_EXTERN void Init_digest_base(void);
+
/*
- * This module provides an interface to the following hash algorithms:
+ * Document-module: Digest
*
- * - the MD5 Message-Digest Algorithm by the RSA Data Security,
- * Inc., described in RFC 1321
- *
- * - the SHA-1 Secure Hash Algorithm by NIST (the US' National
- * Institute of Standards and Technology), described in FIPS PUB
- * 180-1.
+ * This module provides a framework for message digest libraries.
+ */
+
+static VALUE
+hexencode_str_new(VALUE str_digest)
+{
+ char *digest;
+ size_t digest_len;
+ int i;
+ VALUE str;
+ char *p;
+ static const char hex[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+
+ StringValue(str_digest);
+ digest = RSTRING_PTR(str_digest);
+ digest_len = RSTRING_LEN(str_digest);
+
+ if (LONG_MAX / 2 < digest_len) {
+ rb_raise(rb_eRuntimeError, "digest string too long");
+ }
+
+ str = rb_str_new(0, digest_len * 2);
+
+ for (i = 0, p = RSTRING_PTR(str); i < digest_len; i++) {
+ unsigned char byte = digest[i];
+
+ p[i + i] = hex[byte >> 4];
+ p[i + i + 1] = hex[byte & 0x0f];
+ }
+
+ return str;
+}
+
+/*
+ * call-seq:
+ * Digest.hexencode(string) -> hexencoded_string
*
- * - the SHA-256/384/512 Secure Hash Algorithm by NIST (the US'
- * National Institute of Standards and Technology), described in
- * FIPS PUB 180-2.
+ * Generates a hex-encoded version of a given _string_.
+ */
+static VALUE
+rb_digest_s_hexencode(VALUE klass, VALUE str)
+{
+ return hexencode_str_new(str);
+}
+
+/*
+ * Document-module: Digest::Instance
*
- * - the RIPEMD-160 cryptographic hash function, designed by Hans
- * Dobbertin, Antoon Bosselaers, and Bart Preneel.
+ * This module provides instance methods for a digest implementation
+ * object to calculate message digest values.
*/
-#include "digest.h"
+/*
+ * call-seq:
+ * digest_obj.update(string) -> digest_obj
+ * digest_obj << string -> digest_obj
+ *
+ * Updates the digest using a given _string_ and returns self.
+ *
+ * The update() method and the left-shift operator are overridden by
+ * each implementation subclass. (One should be an alias for the
+ * other)
+ */
+static VALUE
+rb_digest_instance_update(VALUE self, VALUE str)
+{
+ rb_raise(rb_eRuntimeError, "%s does not implement update()", RSTRING_PTR(rb_inspect(self)));
+}
-static VALUE mDigest, cDigest_Base;
-static ID id_metadata;
+/*
+ * call-seq:
+ * digest_obj.instance_eval { finish } -> digest_obj
+ *
+ * Finishes the digest and returns the resulting hash value.
+ *
+ * This method is overridden by each implementation subclass and often
+ * made private, because some of those subclasses may leave internal
+ * data uninitialized. Do not call this method from outside. Use
+ * #digest!() instead, which ensures that internal data be reset for
+ * security reasons.
+ */
+static VALUE
+rb_digest_instance_finish(VALUE self)
+{
+ rb_raise(rb_eRuntimeError, "%s does not implement finish()", RSTRING_PTR(rb_inspect(self)));
+}
/*
- * Digest::Base
+ * call-seq:
+ * digest_obj.reset -> digest_obj
+ *
+ * Resets the digest to the initial state and returns self.
+ *
+ * This method is overridden by each implementation subclass.
*/
+static VALUE
+rb_digest_instance_reset(VALUE self)
+{
+ rb_raise(rb_eRuntimeError, "%s does not implement reset()", RSTRING_PTR(rb_inspect(self)));
+}
-static algo_t *
-get_digest_base_metadata(klass)
- VALUE klass;
+/*
+ * call-seq:
+ * digest_obj.new -> another_digest_obj
+ *
+ * Returns a new, initialized copy of the digest object. Equivalent
+ * to digest_obj.clone().reset().
+ */
+static VALUE
+rb_digest_instance_new(VALUE self)
{
- VALUE obj;
- algo_t *algo;
+ VALUE clone = rb_obj_clone(self);
+ rb_funcall(clone, id_reset, 0);
+ return clone;
+}
- if (rb_cvar_defined(klass, id_metadata) == Qfalse) {
- rb_notimplement();
+/*
+ * call-seq:
+ * digest_obj.digest -> string
+ * digest_obj.digest(string) -> string
+ *
+ * If none is given, returns the resulting hash value of the digest,
+ * keeping the digest's state.
+ *
+ * If a _string_ is given, returns the hash value for the given
+ * _string_, resetting the digest to the initial state before and
+ * after the process.
+ */
+static VALUE
+rb_digest_instance_digest(int argc, VALUE *argv, VALUE self)
+{
+ VALUE str, value;
+
+ if (rb_scan_args(argc, argv, "01", &str) > 0) {
+ rb_funcall(self, id_reset, 0);
+ rb_funcall(self, id_update, 1, str);
+ value = rb_funcall(self, id_finish, 0);
+ rb_funcall(self, id_reset, 0);
+ } else {
+ VALUE clone = rb_obj_clone(self);
+
+ value = rb_funcall(clone, id_finish, 0);
+ rb_funcall(clone, id_reset, 0);
}
- obj = rb_cvar_get(klass, id_metadata);
+ return value;
+}
- Data_Get_Struct(obj, algo_t, algo);
+/*
+ * call-seq:
+ * digest_obj.digest! -> string
+ *
+ * Returns the resulting hash value and resets the digest to the
+ * initial state.
+ */
+static VALUE
+rb_digest_instance_digest_bang(VALUE self)
+{
+ VALUE value = rb_funcall(self, id_finish, 0);
+ rb_funcall(self, id_reset, 0);
- return algo;
+ return value;
}
-static VALUE rb_digest_base_alloc _((VALUE));
+/*
+ * call-seq:
+ * digest_obj.hexdigest -> string
+ * digest_obj.hexdigest(string) -> string
+ *
+ * If none is given, returns the resulting hash value of the digest in
+ * a hex-encoded form, keeping the digest's state.
+ *
+ * If a _string_ is given, returns the hash value for the given
+ * _string_ in a hex-encoded form, resetting the digest to the initial
+ * state before and after the process.
+ */
static VALUE
-rb_digest_base_alloc(klass)
- VALUE klass;
+rb_digest_instance_hexdigest(int argc, VALUE *argv, VALUE self)
{
- algo_t *algo;
- VALUE obj;
- void *pctx;
-
- if (klass == cDigest_Base) {
- rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
+ VALUE str, value;
+
+ if (rb_scan_args(argc, argv, "01", &str) > 0) {
+ rb_funcall(self, id_reset, 0);
+ rb_funcall(self, id_update, 1, str);
+ value = rb_funcall(self, id_finish, 0);
+ rb_funcall(self, id_reset, 0);
+ } else {
+ VALUE clone = rb_obj_clone(self);
+
+ value = rb_funcall(clone, id_finish, 0);
+ rb_funcall(clone, id_reset, 0);
}
- algo = get_digest_base_metadata(klass);
+ return hexencode_str_new(value);
+}
- /* XXX: An uninitialized buffer leads ALGO_Equal() to fail */
- pctx = xcalloc(algo->ctx_size, 1);
- algo->init_func(pctx);
+/*
+ * call-seq:
+ * digest_obj.hexdigest! -> string
+ *
+ * Returns the resulting hash value and resets the digest to the
+ * initial state.
+ */
+static VALUE
+rb_digest_instance_hexdigest_bang(VALUE self)
+{
+ VALUE value = rb_funcall(self, id_finish, 0);
+ rb_funcall(self, id_reset, 0);
- obj = Data_Wrap_Struct(klass, 0, free, pctx);
+ return hexencode_str_new(value);
+}
- return obj;
+/*
+ * call-seq:
+ * digest_obj.to_s -> string
+ *
+ * Returns digest_obj.hexdigest().
+ */
+static VALUE
+rb_digest_instance_to_s(VALUE self)
+{
+ return rb_funcall(self, id_hexdigest, 0);
}
+/*
+ * call-seq:
+ * digest_obj.inspect -> string
+ *
+ * Creates a printable version of the digest object.
+ */
static VALUE
-rb_digest_base_s_digest(klass, str)
- VALUE klass;
+rb_digest_instance_inspect(VALUE self)
+{
VALUE str;
+ size_t digest_len = 32; /* about this size at least */
+ char *cname;
+
+ cname = rb_obj_classname(self);
+
+ /* #<Digest::ClassName: xxxxx...xxxx> */
+ str = rb_str_buf_new(2 + strlen(cname) + 2 + digest_len * 2 + 1);
+ rb_str_buf_cat2(str, "#<");
+ rb_str_buf_cat2(str, cname);
+ rb_str_buf_cat2(str, ": ");
+ rb_str_buf_append(str, rb_digest_instance_hexdigest(0, 0, self));
+ rb_str_buf_cat2(str, ">");
+ return str;
+}
+
+/*
+ * call-seq:
+ * digest_obj == another_digest_obj -> boolean
+ * digest_obj == string -> boolean
+ *
+ * If a string is given, checks whether it is equal to the hex-encoded
+ * hash value of the digest object. If another digest instance is
+ * given, checks whether they have the same hash value. Otherwise
+ * returns false.
+ */
+static VALUE
+rb_digest_instance_equal(VALUE self, VALUE other)
{
- algo_t *algo;
- void *pctx;
- size_t len;
- unsigned char *digest;
- VALUE obj = rb_digest_base_alloc(klass);
+ VALUE str1, str2;
- algo = get_digest_base_metadata(klass);
- Data_Get_Struct(obj, void, pctx);
+ if (rb_obj_is_kind_of(other, rb_mDigest_Instance) == Qtrue) {
+ str1 = rb_digest_instance_digest(0, 0, self);
+ str2 = rb_digest_instance_digest(0, 0, other);
+ } else {
+ str1 = rb_digest_instance_to_s(self);
+ str2 = other;
+ }
- StringValue(str);
- algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
+ /* never blindly assume that subclass methods return strings */
+ StringValue(str1);
+ StringValue(str2);
- len = algo->digest_len;
+ if (RSTRING_LEN(str1) == RSTRING_LEN(str2) &&
+ rb_str_cmp(str1, str2) == 0) {
+ return Qtrue;
+ }
+ return Qfalse;
+}
- digest = xmalloc(len);
- algo->final_func(digest, pctx);
+/*
+ * call-seq:
+ * digest_obj.digest_length -> integer
+ *
+ * Returns the length of the hash value of the digest.
+ *
+ * This method should be overridden by each implementation subclass.
+ * If not, digest_obj.digest().length() is returned.
+ */
+static VALUE
+rb_digest_instance_digest_length(VALUE self)
+{
+ /* subclasses really should redefine this method */
+ VALUE digest = rb_digest_instance_digest(0, 0, self);
- obj = rb_str_new(digest, len);
+ /* never blindly assume that #digest() returns a string */
+ StringValue(digest);
+ return INT2NUM(RSTRING_LEN(digest));
+}
- free(digest);
+/*
+ * call-seq:
+ * digest_obj.length -> integer
+ * digest_obj.size -> integer
+ *
+ * Returns digest_obj.digest_length().
+ */
+static VALUE
+rb_digest_instance_length(VALUE self)
+{
+ return rb_funcall(self, id_digest_length, 0);
+}
- return obj;
+/*
+ * call-seq:
+ * digest_obj.block_length -> integer
+ *
+ * Returns the block length of the digest.
+ *
+ * This method is overridden by each implementation subclass.
+ */
+static VALUE
+rb_digest_instance_block_length(VALUE self)
+{
+ rb_raise(rb_eRuntimeError, "%s does not implement block_length()", RSTRING_PTR(rb_inspect(self)));
}
+/*
+ * Document-class: Digest::Class
+ *
+ * This module stands as a base class for digest implementation
+ * classes.
+ */
+
+/*
+ * call-seq:
+ * Digest::Class.digest(string, *parameters) -> hash_string
+ *
+ * Returns the hash value of a given _string_. This is equivalent to
+ * Digest::Class.new(*parameters).digest(string), where extra
+ * _parameters_, if any, are passed through to the constructor and the
+ * _string_ is passed to #digest().
+ */
static VALUE
-rb_digest_base_s_hexdigest(klass, str)
- VALUE klass;
- VALUE str;
+rb_digest_class_s_digest(int argc, VALUE *argv, VALUE klass)
{
- algo_t *algo;
- void *pctx;
- size_t len;
- unsigned char *hexdigest;
- VALUE obj = rb_digest_base_alloc(klass);
+ VALUE str;
+ volatile VALUE obj;
- algo = get_digest_base_metadata(klass);
- Data_Get_Struct(obj, void, pctx);
+ if (argc < 1) {
+ rb_raise(rb_eArgError, "no data given");
+ }
+
+ str = *argv++;
+ argc--;
StringValue(str);
- algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
- len = algo->digest_len * 2;
+ obj = rb_obj_alloc(klass);
+ rb_obj_call_init(obj, argc, argv);
+
+ return rb_funcall(obj, id_digest, 1, str);
+}
+
+/*
+ * call-seq:
+ * Digest::Class.hexdigest(string[, ...]) -> hash_string
+ *
+ * Returns the hex-encoded hash value of a given _string_. This is
+ * almost equivalent to
+ * Digest.hexencode(Digest::Class.new(*parameters).digest(string)).
+ */
+static VALUE
+rb_digest_class_s_hexdigest(int argc, VALUE *argv, VALUE klass)
+{
+ return hexencode_str_new(rb_funcall2(klass, id_digest, argc, argv));
+}
+
+/*
+ * Document-class: Digest::Base
+ *
+ * This abstract class provides a common interface to message digest
+ * implementation classes written in C.
+ */
+
+static rb_digest_metadata_t *
+get_digest_base_metadata(VALUE klass)
+{
+ VALUE p;
+ VALUE obj;
+ rb_digest_metadata_t *algo;
+
+ for (p = klass; p; p = RCLASS(p)->super) {
+ if (rb_ivar_defined(p, id_metadata)) {
+ obj = rb_ivar_get(p, id_metadata);
+ break;
+ }
+ }
+
+ if (!p)
+ rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
+
+ Data_Get_Struct(obj, rb_digest_metadata_t, algo);
+
+ switch (algo->api_version) {
+ case 2:
+ break;
+
+ /*
+ * put conversion here if possible when API is updated
+ */
+
+ default:
+ rb_raise(rb_eRuntimeError, "Incompatible digest API version");
+ }
+
+ return algo;
+}
+
+static VALUE
+rb_digest_base_alloc(VALUE klass)
+{
+ rb_digest_metadata_t *algo;
+ VALUE obj;
+ void *pctx;
- hexdigest = xmalloc(len + 1); /* +1 is for '\0' */
- algo->end_func(pctx, hexdigest);
+ if (klass == rb_cDigest_Base) {
+ rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
+ }
- obj = rb_str_new(hexdigest, len);
+ algo = get_digest_base_metadata(klass);
+
+ pctx = xmalloc(algo->ctx_size);
+ algo->init_func(pctx);
- free(hexdigest);
+ obj = Data_Wrap_Struct(klass, 0, free, pctx);
return obj;
}
+/* :nodoc: */
static VALUE
-rb_digest_base_copy(copy, obj)
- VALUE copy, obj;
+rb_digest_base_copy(VALUE copy, VALUE obj)
{
- algo_t *algo;
+ rb_digest_metadata_t *algo;
void *pctx1, *pctx2;
if (copy == obj) return copy;
+
rb_check_frozen(copy);
+
algo = get_digest_base_metadata(rb_obj_class(copy));
- if (algo != get_digest_base_metadata(rb_obj_class(obj))) {
- rb_raise(rb_eTypeError, "wrong argument class");
- }
+
Data_Get_Struct(obj, void, pctx1);
Data_Get_Struct(copy, void, pctx2);
memcpy(pctx2, pctx1, algo->ctx_size);
@@ -160,157 +494,149 @@ rb_digest_base_copy(copy, obj)
return copy;
}
+/* :nodoc: */
static VALUE
-rb_digest_base_update(self, str)
- VALUE self, str;
+rb_digest_base_reset(VALUE self)
{
- algo_t *algo;
+ rb_digest_metadata_t *algo;
void *pctx;
- StringValue(str);
algo = get_digest_base_metadata(rb_obj_class(self));
+
Data_Get_Struct(self, void, pctx);
- algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
+ algo->init_func(pctx);
return self;
}
+/* :nodoc: */
static VALUE
-rb_digest_base_init(argc, argv, self)
- int argc;
- VALUE* argv;
- VALUE self;
+rb_digest_base_update(VALUE self, VALUE str)
{
- VALUE arg;
+ rb_digest_metadata_t *algo;
+ void *pctx;
+
+ algo = get_digest_base_metadata(rb_obj_class(self));
- rb_scan_args(argc, argv, "01", &arg);
+ Data_Get_Struct(self, void, pctx);
- if (!NIL_P(arg)) rb_digest_base_update(self, arg);
+ StringValue(str);
+ algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
return self;
}
+/* :nodoc: */
static VALUE
-rb_digest_base_digest(self)
- VALUE self;
+rb_digest_base_finish(VALUE self)
{
- algo_t *algo;
- void *pctx1, *pctx2;
- unsigned char *digest;
- size_t len;
+ rb_digest_metadata_t *algo;
+ void *pctx;
VALUE str;
algo = get_digest_base_metadata(rb_obj_class(self));
- Data_Get_Struct(self, void, pctx1);
-
- len = algo->ctx_size;
-
- pctx2 = xmalloc(len);
- memcpy(pctx2, pctx1, len);
-
- len = algo->digest_len;
- digest = xmalloc(len);
- algo->final_func(digest, pctx2);
+ Data_Get_Struct(self, void, pctx);
- str = rb_str_new(digest, len);
+ str = rb_str_new(0, algo->digest_len);
+ algo->finish_func(pctx, (unsigned char *)RSTRING_PTR(str));
- free(digest);
- free(pctx2);
+ /* avoid potential coredump caused by use of a finished context */
+ algo->init_func(pctx);
return str;
}
+/* :nodoc: */
static VALUE
-rb_digest_base_hexdigest(self)
- VALUE self;
+rb_digest_base_digest_length(VALUE self)
{
- algo_t *algo;
- void *pctx1, *pctx2;
- unsigned char *hexdigest;
- size_t len;
- VALUE str;
+ rb_digest_metadata_t *algo;
algo = get_digest_base_metadata(rb_obj_class(self));
- Data_Get_Struct(self, void, pctx1);
-
- len = algo->ctx_size;
-
- pctx2 = xmalloc(len);
- memcpy(pctx2, pctx1, len);
-
- len = algo->digest_len * 2;
- hexdigest = xmalloc(len + 1); /* +1 is for '\0' */
- algo->end_func(pctx2, hexdigest);
-
- str = rb_str_new(hexdigest, len);
-
- free(hexdigest);
- free(pctx2);
-
- return str;
+ return INT2NUM(algo->digest_len);
}
+/* :nodoc: */
static VALUE
-rb_digest_base_equal(self, other)
- VALUE self, other;
+rb_digest_base_block_length(VALUE self)
{
- algo_t *algo;
- VALUE klass;
- VALUE str1, str2;
-
- klass = rb_obj_class(self);
- algo = get_digest_base_metadata(klass);
+ rb_digest_metadata_t *algo;
- if (rb_obj_class(other) == klass) {
- void *pctx1, *pctx2;
-
- Data_Get_Struct(self, void, pctx1);
- Data_Get_Struct(other, void, pctx2);
-
- return algo->equal_func(pctx1, pctx2) ? Qtrue : Qfalse;
- }
-
- StringValue(other);
- str2 = other;
-
- if (RSTRING(str2)->len == algo->digest_len)
- str1 = rb_digest_base_digest(self);
- else
- str1 = rb_digest_base_hexdigest(self);
-
- if (RSTRING(str1)->len == RSTRING(str2)->len
- && rb_str_cmp(str1, str2) == 0)
- return Qtrue;
+ algo = get_digest_base_metadata(rb_obj_class(self));
- return Qfalse;
+ return INT2NUM(algo->block_len);
}
-/*
- * Init
- */
-
void
-Init_digest()
+Init_digest(void)
{
- mDigest = rb_define_module("Digest");
+ id_reset = rb_intern("reset");
+ id_update = rb_intern("update");
+ id_finish = rb_intern("finish");
+ id_digest = rb_intern("digest");
+ id_hexdigest = rb_intern("hexdigest");
+ id_digest_length = rb_intern("digest_length");
+
+ /*
+ * module Digest
+ */
+ rb_mDigest = rb_define_module("Digest");
+
+ /* module functions */
+ rb_define_module_function(rb_mDigest, "hexencode", rb_digest_s_hexencode, 1);
+
+ /*
+ * module Digest::Instance
+ */
+ rb_mDigest_Instance = rb_define_module_under(rb_mDigest, "Instance");
+
+ /* instance methods that should be overridden */
+ rb_define_method(rb_mDigest_Instance, "update", rb_digest_instance_update, 1);
+ rb_define_method(rb_mDigest_Instance, "<<", rb_digest_instance_update, 1);
+ rb_define_private_method(rb_mDigest_Instance, "finish", rb_digest_instance_finish, 0);
+ rb_define_method(rb_mDigest_Instance, "reset", rb_digest_instance_reset, 0);
+ rb_define_method(rb_mDigest_Instance, "digest_length", rb_digest_instance_digest_length, 0);
+ rb_define_method(rb_mDigest_Instance, "block_length", rb_digest_instance_block_length, 0);
+
+ /* instance methods that may be overridden */
+ rb_define_method(rb_mDigest_Instance, "==", rb_digest_instance_equal, 1);
+ rb_define_method(rb_mDigest_Instance, "inspect", rb_digest_instance_inspect, 0);
+
+ /* instance methods that need not usually be overridden */
+ rb_define_method(rb_mDigest_Instance, "new", rb_digest_instance_new, 0);
+ rb_define_method(rb_mDigest_Instance, "digest", rb_digest_instance_digest, -1);
+ rb_define_method(rb_mDigest_Instance, "digest!", rb_digest_instance_digest_bang, 0);
+ rb_define_method(rb_mDigest_Instance, "hexdigest", rb_digest_instance_hexdigest, -1);
+ rb_define_method(rb_mDigest_Instance, "hexdigest!", rb_digest_instance_hexdigest_bang, 0);
+ rb_define_method(rb_mDigest_Instance, "to_s", rb_digest_instance_to_s, 0);
+ rb_define_method(rb_mDigest_Instance, "length", rb_digest_instance_length, 0);
+ rb_define_method(rb_mDigest_Instance, "size", rb_digest_instance_length, 0);
+
+ /*
+ * class Digest::Class
+ */
+ rb_cDigest_Class = rb_define_class_under(rb_mDigest, "Class", rb_cObject);
+ rb_include_module(rb_cDigest_Class, rb_mDigest_Instance);
+
+ /* class methods */
+ rb_define_singleton_method(rb_cDigest_Class, "digest", rb_digest_class_s_digest, -1);
+ rb_define_singleton_method(rb_cDigest_Class, "hexdigest", rb_digest_class_s_hexdigest, -1);
- cDigest_Base = rb_define_class_under(mDigest, "Base", rb_cObject);
+ id_metadata = rb_intern("metadata");
- rb_define_alloc_func(cDigest_Base, rb_digest_base_alloc);
- rb_define_singleton_method(cDigest_Base, "digest", rb_digest_base_s_digest, 1);
- rb_define_singleton_method(cDigest_Base, "hexdigest", rb_digest_base_s_hexdigest, 1);
+ /* class Digest::Base < Digest::Class */
+ rb_cDigest_Base = rb_define_class_under(rb_mDigest, "Base", rb_cDigest_Class);
- rb_define_method(cDigest_Base, "initialize", rb_digest_base_init, -1);
- rb_define_method(cDigest_Base, "initialize_copy", rb_digest_base_copy, 1);
- rb_define_method(cDigest_Base, "update", rb_digest_base_update, 1);
- rb_define_method(cDigest_Base, "<<", rb_digest_base_update, 1);
- rb_define_method(cDigest_Base, "digest", rb_digest_base_digest, 0);
- rb_define_method(cDigest_Base, "hexdigest", rb_digest_base_hexdigest, 0);
- rb_define_method(cDigest_Base, "to_s", rb_digest_base_hexdigest, 0);
- rb_define_method(cDigest_Base, "==", rb_digest_base_equal, 1);
+ rb_define_alloc_func(rb_cDigest_Base, rb_digest_base_alloc);
- id_metadata = rb_intern("metadata");
+ rb_define_method(rb_cDigest_Base, "initialize_copy", rb_digest_base_copy, 1);
+ rb_define_method(rb_cDigest_Base, "reset", rb_digest_base_reset, 0);
+ rb_define_method(rb_cDigest_Base, "update", rb_digest_base_update, 1);
+ rb_define_method(rb_cDigest_Base, "<<", rb_digest_base_update, 1);
+ rb_define_private_method(rb_cDigest_Base, "finish", rb_digest_base_finish, 0);
+ rb_define_method(rb_cDigest_Base, "digest_length", rb_digest_base_digest_length, 0);
+ rb_define_method(rb_cDigest_Base, "block_length", rb_digest_base_block_length, 0);
}
diff --git a/ext/digest/digest.h b/ext/digest/digest.h
index 5e846df040..6e4906c859 100644
--- a/ext/digest/digest.h
+++ b/ext/digest/digest.h
@@ -1,12 +1,12 @@
/************************************************
- digest.c -
+ digest.h - header file for ruby digest modules
$Author$
created at: Fri May 25 08:54:56 JST 2001
- Copyright (C) 2001 Akinori MUSHA
+ Copyright (C) 2001-2006 Akinori MUSHA
$RoughId: digest.h,v 1.3 2001/07/13 15:38:27 knu Exp $
$Id$
@@ -15,18 +15,18 @@
#include "ruby.h"
-typedef void (*hash_init_func_t) _((void *));
-typedef void (*hash_update_func_t) _((void *, unsigned char *, size_t));
-typedef void (*hash_end_func_t) _((void *, unsigned char *));
-typedef void (*hash_final_func_t) _((unsigned char *, void *));
-typedef int (*hash_equal_func_t) _((void *, void *));
+#define RUBY_DIGEST_API_VERSION 2
+
+typedef void (*rb_digest_hash_init_func_t)(void *);
+typedef void (*rb_digest_hash_update_func_t)(void *, unsigned char *, size_t);
+typedef void (*rb_digest_hash_finish_func_t)(void *, unsigned char *);
typedef struct {
+ int api_version;
size_t digest_len;
+ size_t block_len;
size_t ctx_size;
- hash_init_func_t init_func;
- hash_update_func_t update_func;
- hash_end_func_t end_func;
- hash_final_func_t final_func;
- hash_equal_func_t equal_func;
-} algo_t;
+ rb_digest_hash_init_func_t init_func;
+ rb_digest_hash_update_func_t update_func;
+ rb_digest_hash_finish_func_t finish_func;
+} rb_digest_metadata_t;
diff --git a/ext/digest/digest.txt b/ext/digest/digest.txt
deleted file mode 100644
index 5797dd18f9..0000000000
--- a/ext/digest/digest.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-.\" 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$
-
-** MD5(Class)
-
-A class to implement the MD5 Message-Digest Algorithm by RSA Data
-Security, Inc., described in RFC1321.
-
-Superclass: Digest::Base
-
-require 'digest/md5'
-
-** SHA1(Class)
-
-A class to implement the SHA-1 Secure Hash Algorithm by NIST (the US'
-National Institute of Standards and Technology), described in FIPS PUB
-180-1.
-
-Superclass: Digest::Base
-
-require 'digest/sha1'
-
-** SHA256(Class)
-** SHA384(Class)
-** SHA512(Class)
-
-Classes to implement the SHA-256/384/512 Secure Hash Algorithm(s) by
-NIST (the US' National Institute of Standards and Technology),
-described in FIPS PUB 180-2.
-
-Superclass: Digest::Base
-
-require 'digest/sha2'
-
-** RMD160(Class)
-
-A class to implement the RIPEMD-160 cryptographic hash function,
-designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel.
-
-Superclass: Digest::Base
-
-require 'digest/rmd160'
-
-
-Those above classes provide a common interface as shown below.
-
-
-Class Methods:
-
- new([str])
-
- Creates a new digest object. If a string argument is given,
- it is added to the object. (see update.)
-
- digest(str)
-
- Immediately calculates and return the hash of the given
- strings as a string. Equivalent to new(str).digest.
-
- hexdigest(str)
-
- Immediately calculates and return the hash of the given
- strings as a string of hexadecimal digits. Equivalent to
- new(str).hexdigest.
-
-Methods:
-
- clone
-
- Creates a copy of the digest object.
-
- digest
-
- Returns the hash of the added strings as a string of 16 bytes
- for MD5, 20 bytes for SHA1 and RMD160, 32 bytes for SHA256, 48
- bytes for SHA384, and 64 bytes for SHA512.
-
- hexdigest
- to_s
-
- Returns the hash of the added strings as a string of 32
- hexadecimal digits for MD5, 40 hexadecimal digits for SHA1 and
- RMD160, 64 hexadecimal digits for SHA256, 96 hexadecimal
- digits for SHA384, and 128 hexadecimal digits for SHA512.
- This method is equal to:
-
- def hexdigest
- digest.unpack("H*")[0]
- end
-
- update(str)
- << str
-
- Appends the string str to the digest object. Repeated calls
- are equivalent to a single call with the concatenation of all
- the arguments, i.e. m.update(a); m.update(b) is equivalent to
- m.update(a + b) and m << a << b is equivalent to m << a + b.
-
- == md
-
- Checks if the object is equal to the given digest object.
-
- == str
-
- Regards the value as either a digest value or a hexdigest
- value (depending on the length) and checks if the object is
- equal to the given string.
-
--------------------------------------------------------
-Local variables:
-fill-column: 70
-end:
diff --git a/ext/digest/digest.txt.ja b/ext/digest/digest.txt.ja
deleted file mode 100644
index 8997d25b9d..0000000000
--- a/ext/digest/digest.txt.ja
+++ /dev/null
@@ -1,111 +0,0 @@
-.\" 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$
-
-** MD5(¥¯¥é¥¹)
-
-RFC1321¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ëRSA Data Security, Inc. ¤Î MD5 Message-Digest
-Algorithm¤ò¼ÂÁõ¤¹¤ë¥¯¥é¥¹¡£
-
-Superclass: Digest::Base
-
-require 'digest/md5'
-
-** SHA1(¥¯¥é¥¹)
-
-FIPS PUB 180-1¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ëNIST (the US' National Institute of
-Standards and Technology) ¤Î SHA-1 Secure Hash Algorithm¤ò¼ÂÁõ¤¹¤ë¥¯¥é¥¹¡£
-
-Superclass: Digest::Base
-
-require 'digest/sha1'
-
-** SHA256(¥¯¥é¥¹)
-** SHA384(¥¯¥é¥¹)
-** SHA512(¥¯¥é¥¹)
-
-FIPS PUB 180-2¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ëNIST (the US' National Institute of
-Standards and Technology) ¤Î SHA-256/384/512 Secure Hash Algorithm¤ò
-¼ÂÁõ¤¹¤ë¥¯¥é¥¹¡£
-
-Superclass: Digest::Base
-
-require 'digest/sha2'
-
-** RMD160(¥¯¥é¥¹)
-
-Hans Dobbertin, Antoon Bosselaers, Bart Preneel ¤Ë¤è¤Ã¤ÆÀ߷פµ¤ì¤¿
-RIPEMD-160 ¥Ï¥Ã¥·¥å´Ø¿ô¤ò¼ÂÁõ¤¹¤ë¥¯¥é¥¹¡£
-
-Superclass: Digest::Base
-
-require 'digest/rmd160'
-
-
-¤³¤ì¤é¤Î¥¯¥é¥¹¤Ï°Ê²¼¤Î¤è¤¦¤Ê¶¦Ä̤Υ¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¡£
-
-
-Class Methods:
-
- new([str])
-
- ¿·¤·¤¤¥À¥¤¥¸¥§¥¹¥È¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë¡¥Ê¸»úÎó°ú¿ô¤¬Í¿¤¨¤é¤ì¤ë
- ¤È¤½¤ì¤òÄɲ乤ë(see update)¡£
-
- digest(str)
-
- Í¿¤¨¤é¤ì¤¿Ê¸»úÎó¤ËÂФ¹¤ë¥Ï¥Ã¥·¥åÃͤòʸ»úÎó¤ÇÊÖ¤¹¡£
- new(str).digest ¤ÈÅù²Á¡£
-
- hexdigest(str)
-
- Í¿¤¨¤é¤ì¤¿Ê¸»úÎó¤ËÂФ¹¤ë¥Ï¥Ã¥·¥åÃͤò¡¢ASCII¥³¡¼¥É¤ò»È¤Ã¤Æ
- 16¿Ê¿ô¤ÎÎó¤ò¼¨¤¹Ê¸»úÎó¤Ë¥¨¥ó¥³¡¼¥É¤·¤ÆÊÖ¤¹¡£
- new(str).hexdigest ¤ÈÅù²Á¡£
-
-Methods:
-
- clone
-
- ¥À¥¤¥¸¥§¥¹¥È¥ª¥Ö¥¸¥§¥¯¥È¤ÎÊ£À½¤òºî¤ë¡£
-
- digest
-
- º£¤Þ¤Ç¤ËÄɲä·¤¿Ê¸»úÎó¤ËÂФ¹¤ë¥Ï¥Ã¥·¥åÃͤòʸ»úÎó¤ÇÊÖ¤¹¡£MD5¤Ç¤Ï
- 16¥Ð¥¤¥ÈĹ¡¢SHA1¤ª¤è¤ÓRMD160¤Ç¤Ï20¥Ð¥¤¥ÈĹ¡¢SHA256¤Ç¤Ï32¥Ð¥¤¥ÈĹ¡¢
- SHA384¤Ç¤Ï48¥Ð¥¤¥ÈĹ¡¢SHA512¤Ç¤Ï64¥Ð¥¤¥ÈĹ¤È¤Ê¤ë¡£
-
- hexdigest
- to_s
-
- º£¤Þ¤Ç¤ËÄɲä·¤¿Ê¸»úÎó¤ËÂФ¹¤ë¥Ï¥Ã¥·¥åÃͤò¡¢ASCII¥³¡¼¥É¤ò»È¤Ã¤Æ
- 16¿Ê¿ô¤ÎÎó¤ò¼¨¤¹Ê¸»úÎó¤Ë¥¨¥ó¥³¡¼¥É¤·¤ÆÊÖ¤¹¡£MD5¤Ç¤Ï32¥Ð¥¤¥ÈĹ¡¢
- SHA1¤ª¤è¤ÓRMD160¤Ç¤Ï40¥Ð¥¤¥ÈĹ¡¢SHA256¤Ç¤Ï64¥Ð¥¤¥ÈĹ¡¢SHA384¤Ç¤Ï
- 96¥Ð¥¤¥ÈĹ¡¢SHA512¤Ç¤Ï128¥Ð¥¤¥ÈĹ¤È¤Ê¤ë¡£Ruby¤Ç½ñ¤¯¤È°Ê²¼¤ÈƱ¤¸¡£
-
- def hexdigest
- digest.unpack("H*")[0]
- end
-
- update(str)
- << str
-
- ʸ»úÎó¤òÄɲ乤롣ʣ¿ô²óupdate¤ò¸Æ¤Ö¤³¤È¤Ïʸ»úÎó¤òÏ¢·ë¤·¤Æ
- update¤ò¸Æ¤Ö¤³¤È¤ÈÅù¤·¤¤¡£¤¹¤Ê¤ï¤Á m.update(a); m.update(b) ¤Ï
- m.update(a + b) ¤È¡¢ m << a << b ¤Ï m << a + b ¤È¤½¤ì¤¾¤ìÅù²Á
- ¤Ç¤¢¤ë¡£
-
- == md
-
- Í¿¤¨¤é¤ì¤¿¥À¥¤¥¸¥§¥¹¥È¥ª¥Ö¥¸¥§¥¯¥È¤ÈÈæ³Ó¤¹¤ë¡£
-
- == str
-
- Í¿¤¨¤é¤ì¤¿Ê¸»úÎó¤ò digest ÃÍ¡¢¤â¤·¤¯¤Ï hexdigest ÃͤÈÈæ³Ó¤¹¤ë¡£
- ¤¤¤º¤ì¤ÎÃͤȸ«¤ë¤«¤ÏÍ¿¤¨¤é¤ì¤¿Ê¸»úÎó¤ÎŤµ¤Ë¤è¤Ã¤Æ¼«Æ°È½ÊÌ
- ¤µ¤ì¤ë¡£
-
--------------------------------------------------------
-Local variables:
-fill-column: 70
-end:
diff --git a/ext/digest/extconf.rb b/ext/digest/extconf.rb
index cd512622a4..cf9127ecc0 100644
--- a/ext/digest/extconf.rb
+++ b/ext/digest/extconf.rb
@@ -3,4 +3,8 @@
require "mkmf"
+$INSTALLFILES = {
+ "digest.h" => "$(RUBYARCHDIR)"
+}
+
create_makefile("digest")
diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb
new file mode 100644
index 0000000000..0c4ee3c2cc
--- /dev/null
+++ b/ext/digest/lib/digest.rb
@@ -0,0 +1,50 @@
+require 'digest.so'
+
+module Digest
+ def self.const_missing(name)
+ case name
+ when :SHA256, :SHA384, :SHA512
+ lib = 'digest/sha2.so'
+ else
+ lib = File.join('digest', name.to_s.downcase)
+ end
+
+ begin
+ require lib
+ rescue LoadError => e
+ raise LoadError, "library not found for class Digest::#{name} -- #{lib}", caller(1)
+ end
+ unless Digest.const_defined?(name)
+ raise NameError, "uninitialized constant Digest::#{name}", caller(1)
+ end
+ Digest.const_get(name)
+ end
+
+ class ::Digest::Class
+ # creates a digest object and reads a given file, _name_.
+ #
+ # p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
+ # # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
+ def self.file(name)
+ new.file(name)
+ end
+ end
+
+ module Instance
+ # updates the digest with the contents of a given file _name_ and
+ # returns self.
+ def file(name)
+ File.open(name, "rb") {|f|
+ buf = ""
+ while f.read(16384, buf)
+ update buf
+ end
+ }
+ self
+ end
+ end
+end
+
+def Digest(name)
+ Digest.const_get(name)
+end
diff --git a/ext/digest/lib/md5.rb b/ext/digest/lib/md5.rb
index 1d05d7d04e..c399f2de1d 100644
--- a/ext/digest/lib/md5.rb
+++ b/ext/digest/lib/md5.rb
@@ -5,10 +5,19 @@
require 'digest/md5'
-MD5 = Digest::MD5
+class MD5 < Digest::MD5
+ class << self
+ alias orig_new new
+ def new(str = nil)
+ if str
+ orig_new.update(str)
+ else
+ orig_new
+ end
+ end
-class MD5
- def self.md5(*args)
- new(*args)
+ def md5(*args)
+ new(*args)
+ end
end
end
diff --git a/ext/digest/lib/sha1.rb b/ext/digest/lib/sha1.rb
index c4ac6f66ea..4446e12e8d 100644
--- a/ext/digest/lib/sha1.rb
+++ b/ext/digest/lib/sha1.rb
@@ -5,10 +5,19 @@
require 'digest/sha1'
-SHA1 = Digest::SHA1
+class SHA1 < Digest::SHA1
+ class << self
+ alias orig_new new
+ def new(str = nil)
+ if str
+ orig_new.update(str)
+ else
+ orig_new
+ end
+ end
-class SHA1
- def self.sha1(*args)
- new(*args)
+ def sha1(*args)
+ new(*args)
+ end
end
end
diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb
index 9acf7ba9c0..018f8ccb02 100644
--- a/ext/digest/md5/extconf.rb
+++ b/ext/digest/md5/extconf.rb
@@ -3,7 +3,8 @@
require "mkmf"
-$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "md5init.#{$OBJEXT}" ]
@@ -23,4 +24,6 @@ have_header("inttypes.h")
have_header("unistd.h")
+$preload = %w[digest]
+
create_makefile("digest/md5")
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index 6b61f031c4..993bc47a06 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -41,6 +41,12 @@
1999-05-03 lpd Original version.
*/
+/*
+ This code was modified for use in Ruby.
+
+ - Akinori MUSHA <knu@idaemons.org>
+ */
+
/*$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$ */
@@ -391,7 +397,7 @@ MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)
}
void
-MD5_Final(uint8_t *digest, MD5_CTX *pms)
+MD5_Finish(MD5_CTX *pms, uint8_t *digest)
{
static const uint8_t pad[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -412,21 +418,3 @@ MD5_Final(uint8_t *digest, MD5_CTX *pms)
for (i = 0; i < 16; ++i)
digest[i] = (uint8_t)(pms->state[i >> 2] >> ((i & 3) << 3));
}
-
-void
-MD5_End(MD5_CTX *pctx, uint8_t *hexdigest)
-{
- unsigned char digest[16];
- size_t i;
-
- MD5_Final(digest, pctx);
-
- for (i = 0; i < 16; i++)
- sprintf(hexdigest + i * 2, "%02x", digest[i]);
-}
-
-int MD5_Equal(MD5_CTX* pctx1, MD5_CTX* pctx2) {
- return memcmp(pctx1->count, pctx2->count, sizeof(pctx1->count)) == 0
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
-}
diff --git a/ext/digest/md5/md5.h b/ext/digest/md5/md5.h
index fc41380d38..f4580ef5e7 100644
--- a/ext/digest/md5/md5.h
+++ b/ext/digest/md5/md5.h
@@ -63,18 +63,15 @@ typedef struct md5_state_s {
} MD5_CTX;
#ifdef RUBY
+/* avoid name clash */
#define MD5_Init rb_Digest_MD5_Init
#define MD5_Update rb_Digest_MD5_Update
-#define MD5_Final rb_Digest_MD5_Final
-#define MD5_End rb_Digest_MD5_End
-#define MD5_Equal rb_Digest_MD5_Equal
+#define MD5_Finish rb_Digest_MD5_Finish
#endif
void MD5_Init _((MD5_CTX *pms));
void MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes));
-void MD5_Final _((uint8_t *digest, MD5_CTX *pms));
-void MD5_End _((MD5_CTX *pctx, uint8_t *hexdigest));
-int MD5_Equal _((MD5_CTX *pctx1, MD5_CTX *pctx2));
+void MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
#define MD5_BLOCK_LENGTH 64
#define MD5_DIGEST_LENGTH 16
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index 2acca16a46..17658f4fce 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -8,28 +8,33 @@
#include "md5.h"
#endif
-static algo_t md5 = {
+static rb_digest_metadata_t md5 = {
+ RUBY_DIGEST_API_VERSION,
MD5_DIGEST_LENGTH,
+ MD5_BLOCK_LENGTH,
sizeof(MD5_CTX),
- (hash_init_func_t)MD5_Init,
- (hash_update_func_t)MD5_Update,
- (hash_end_func_t)MD5_End,
- (hash_final_func_t)MD5_Final,
- (hash_equal_func_t)MD5_Equal,
+ (rb_digest_hash_init_func_t)MD5_Init,
+ (rb_digest_hash_update_func_t)MD5_Update,
+ (rb_digest_hash_finish_func_t)MD5_Finish,
};
+/*
+ * A class for calculating message digests using the MD5
+ * Message-Digest Algorithm by RSA Data Security, Inc., described in
+ * RFC1321.
+ */
void
Init_md5()
{
VALUE mDigest, cDigest_Base, cDigest_MD5;
- rb_require("digest.so");
+ rb_require("digest");
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);
- rb_cvar_set(cDigest_MD5, rb_intern("metadata"),
- Data_Wrap_Struct(rb_cObject, 0, 0, &md5), Qtrue);
+ rb_ivar_set(cDigest_MD5, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, &md5));
}
diff --git a/ext/digest/md5/md5ossl.c b/ext/digest/md5/md5ossl.c
index d930c7ab51..d94ae2cd2f 100644
--- a/ext/digest/md5/md5ossl.c
+++ b/ext/digest/md5/md5ossl.c
@@ -1,30 +1,9 @@
/* $Id$ */
#include "md5ossl.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
void
-MD5_End(MD5_CTX *pctx, unsigned char *hexdigest)
+MD5_Finish(MD5_CTX *pctx, unsigned char *digest)
{
- unsigned char digest[16];
- size_t i;
-
MD5_Final(digest, pctx);
-
- for (i = 0; i < 16; i++)
- sprintf(hexdigest + i * 2, "%02x", digest[i]);
-}
-
-int
-MD5_Equal(MD5_CTX* pctx1, MD5_CTX* pctx2) {
- return pctx1->num == pctx2->num
- && pctx1->A == pctx2->A
- && pctx1->B == pctx2->B
- && pctx1->C == pctx2->C
- && pctx1->D == pctx2->D
- && pctx1->Nl == pctx2->Nl
- && pctx1->Nh == pctx2->Nh
- && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
}
diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h
index 610f58db06..1680c4f5c9 100644
--- a/ext/digest/md5/md5ossl.h
+++ b/ext/digest/md5/md5ossl.h
@@ -6,7 +6,8 @@
#include <stddef.h>
#include <openssl/md5.h>
-void MD5_End(MD5_CTX *pctx, unsigned char *hexdigest);
-int MD5_Equal(MD5_CTX *pctx1, MD5_CTX *pctx2);
+#define MD5_BLOCK_LENGTH MD5_CBLOCK
+
+void MD5_Finish(MD5_CTX *pctx, unsigned char *digest);
#endif
diff --git a/ext/digest/rmd160/depend b/ext/digest/rmd160/depend
index 0ca79c5f40..a21d7188dc 100644
--- a/ext/digest/rmd160/depend
+++ b/ext/digest/rmd160/depend
@@ -1,7 +1,5 @@
rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
$(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
-rmd160hl.o: rmd160hl.c rmd160.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
rmd160init.o: rmd160init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
$(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
rmd160.h $(srcdir)/../defs.h
diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb
index 5bc968385c..09359944f2 100644
--- a/ext/digest/rmd160/extconf.rb
+++ b/ext/digest/rmd160/extconf.rb
@@ -3,7 +3,8 @@
require "mkmf"
-$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "rmd160init.#{$OBJEXT}" ]
@@ -13,7 +14,7 @@ if !with_config("bundled-rmd160") &&
have_library("crypto") && have_header("openssl/ripemd.h")
$objs << "rmd160ossl.#{$OBJEXT}"
else
- $objs << "rmd160.#{$OBJEXT}" << "rmd160hl.#{$OBJEXT}"
+ $objs << "rmd160.#{$OBJEXT}"
end
have_header("sys/cdefs.h")
@@ -22,4 +23,6 @@ have_header("inttypes.h")
have_header("unistd.h")
+$preload = %w[digest]
+
create_makefile("digest/rmd160")
diff --git a/ext/digest/rmd160/rmd160.c b/ext/digest/rmd160/rmd160.c
index 2de3c99b29..88918728cd 100644
--- a/ext/digest/rmd160/rmd160.c
+++ b/ext/digest/rmd160/rmd160.c
@@ -409,7 +409,7 @@ RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
/********************************************************************/
void
-RMD160_Final(uint8_t digest[20], RMD160_CTX *context)
+RMD160_Finish(RMD160_CTX *context, uint8_t digest[20])
{
uint32_t i;
uint32_t X[16];
@@ -454,11 +454,4 @@ RMD160_Final(uint8_t digest[20], RMD160_CTX *context)
}
}
-int RMD160_Equal(RMD160_CTX* pctx1, RMD160_CTX* pctx2) {
- return pctx1->buflen == pctx2->buflen
- && memcmp(pctx1->length, pctx2->length, sizeof(pctx1->length)) == 0
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->bbuffer, pctx2->bbuffer, sizeof(pctx1->bbuffer)) == 0;
-}
-
/************************ end of file rmd160.c **********************/
diff --git a/ext/digest/rmd160/rmd160.h b/ext/digest/rmd160/rmd160.h
index 24f9a025f0..54d1ca9140 100644
--- a/ext/digest/rmd160/rmd160.h
+++ b/ext/digest/rmd160/rmd160.h
@@ -39,26 +39,14 @@ typedef struct {
#define RMD160_Init rb_Digest_RMD160_Init
#define RMD160_Transform rb_Digest_RMD160_Transform
#define RMD160_Update rb_Digest_RMD160_Update
-#define RMD160_Final rb_Digest_RMD160_Final
-#define RMD160_Equal rb_Digest_RMD160_Equal
-#ifndef _KERNEL
-#define RMD160_End rb_Digest_RMD160_End
-#define RMD160_File rb_Digest_RMD160_File
-#define RMD160_Data rb_Digest_RMD160_Data
-#endif /* _KERNEL */
+#define RMD160_Finish rb_Digest_RMD160_Finish
#endif
__BEGIN_DECLS
void RMD160_Init _((RMD160_CTX *));
void RMD160_Transform _((uint32_t[5], const uint32_t[16]));
void RMD160_Update _((RMD160_CTX *, const uint8_t *, size_t));
-void RMD160_Final _((uint8_t[20], RMD160_CTX *));
-int RMD160_Equal _((RMD160_CTX *, RMD160_CTX *));
-#ifndef _KERNEL
-char *RMD160_End _((RMD160_CTX *, char *));
-char *RMD160_File _((char *, char *));
-char *RMD160_Data _((const uint8_t *, size_t, char *));
-#endif /* _KERNEL */
+void RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
__END_DECLS
#define RMD160_BLOCK_LENGTH 64
diff --git a/ext/digest/rmd160/rmd160hl.c b/ext/digest/rmd160/rmd160hl.c
deleted file mode 100644
index 4c5e0217d9..0000000000
--- a/ext/digest/rmd160/rmd160hl.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $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
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * from OpenBSD: rmd160hl.c,v 1.2 1999/08/17 09:13:12 millert Exp $
- */
-
-#include "rmd160.h"
-
-#ifndef lint
-/* __RCSID("$NetBSD: rmd160hl.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $"); */
-#endif /* not lint */
-
-/* #include "namespace.h" */
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
-
-
-char *
-RMD160_End(RMD160_CTX *ctx, char *buf)
-{
- size_t i;
- char *p = buf;
- uint8_t digest[20];
- static const char hex[]="0123456789abcdef";
-
- _DIAGASSERT(ctx != NULL);
- /* buf may be NULL */
-
- if (p == NULL && (p = malloc(41)) == NULL)
- return 0;
-
- RMD160_Final(digest,ctx);
- for (i = 0; i < 20; i++) {
- p[i + i] = hex[(uint32_t)digest[i] >> 4];
- p[i + i + 1] = hex[digest[i] & 0x0f];
- }
- p[i + i] = '\0';
- return(p);
-}
-
-char *
-RMD160_File(char *filename, char *buf)
-{
- uint8_t buffer[BUFSIZ];
- RMD160_CTX ctx;
- int fd, num, oerrno;
-
- _DIAGASSERT(filename != NULL);
- /* XXX: buf may be NULL ? */
-
- RMD160_Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return(0);
-
- while ((num = read(fd, buffer, sizeof(buffer))) > 0)
- RMD160_Update(&ctx, buffer, (size_t)num);
-
- oerrno = errno;
- close(fd);
- errno = oerrno;
- return(num < 0 ? 0 : RMD160_End(&ctx, buf));
-}
-
-char *
-RMD160_Data(const uint8_t *data, size_t len, char *buf)
-{
- RMD160_CTX ctx;
-
- _DIAGASSERT(data != NULL);
- /* XXX: buf may be NULL ? */
-
- RMD160_Init(&ctx);
- RMD160_Update(&ctx, data, len);
- return(RMD160_End(&ctx, buf));
-}
diff --git a/ext/digest/rmd160/rmd160init.c b/ext/digest/rmd160/rmd160init.c
index b16cdbbed8..763867df86 100644
--- a/ext/digest/rmd160/rmd160init.c
+++ b/ext/digest/rmd160/rmd160init.c
@@ -8,31 +8,33 @@
#include "rmd160.h"
#endif
-static algo_t rmd160 = {
+static rb_digest_metadata_t rmd160 = {
+ RUBY_DIGEST_API_VERSION,
RMD160_DIGEST_LENGTH,
+ RMD160_BLOCK_LENGTH,
sizeof(RMD160_CTX),
- (hash_init_func_t)RMD160_Init,
- (hash_update_func_t)RMD160_Update,
- (hash_end_func_t)RMD160_End,
- (hash_final_func_t)RMD160_Final,
- (hash_equal_func_t)RMD160_Equal,
+ (rb_digest_hash_init_func_t)RMD160_Init,
+ (rb_digest_hash_update_func_t)RMD160_Update,
+ (rb_digest_hash_finish_func_t)RMD160_Finish,
};
+/*
+ * A class for calculating message digests using RIPEMD-160
+ * cryptographic hash function, designed by Hans Dobbertin, Antoon
+ * Bosselaers, and Bart Preneel.
+ */
void
Init_rmd160()
{
VALUE mDigest, cDigest_Base, cDigest_RMD160;
- ID id_metadata;
- rb_require("digest.so");
+ rb_require("digest");
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
- id_metadata = rb_intern("metadata");
-
- rb_cvar_set(cDigest_RMD160, id_metadata,
- Data_Wrap_Struct(rb_cObject, 0, 0, &rmd160), Qtrue);
+ rb_ivar_set(cDigest_RMD160, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, &rmd160));
}
diff --git a/ext/digest/rmd160/rmd160ossl.c b/ext/digest/rmd160/rmd160ossl.c
index be66d81ff9..f24e63e3d8 100644
--- a/ext/digest/rmd160/rmd160ossl.c
+++ b/ext/digest/rmd160/rmd160ossl.c
@@ -1,45 +1,8 @@
/* $Id$ */
-#include "rmd160ossl.h"
#include "defs.h"
-#include <assert.h>
-#include <stdlib.h>
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
-
-char *
-RMD160_End(RMD160_CTX *ctx, char *buf)
-{
- size_t i;
- char *p = buf;
- uint8_t digest[20];
- static const char hex[]="0123456789abcdef";
-
- _DIAGASSERT(ctx != NULL);
- /* buf may be NULL */
-
- if (p == NULL && (p = malloc(41)) == NULL)
- return 0;
-
- RMD160_Final(digest,ctx);
- for (i = 0; i < 20; i++) {
- p[i + i] = hex[(uint32_t)digest[i] >> 4];
- p[i + i + 1] = hex[digest[i] & 0x0f];
- }
- p[i + i] = '\0';
- return(p);
-}
+#include "rmd160ossl.h"
-int RMD160_Equal(RMD160_CTX* pctx1, RMD160_CTX* pctx2) {
- return pctx1->num == pctx2->num
- && pctx1->A == pctx2->A
- && pctx1->B == pctx2->B
- && pctx1->C == pctx2->C
- && pctx1->D == pctx2->D
- && pctx1->E == pctx2->E
- && pctx1->Nl == pctx2->Nl
- && pctx1->Nh == pctx2->Nh
- && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
+void RMD160_Finish(RMD160_CTX *ctx, char *buf) {
+ RIPEMD160_Final((unsigned char *)buf, ctx);
}
diff --git a/ext/digest/rmd160/rmd160ossl.h b/ext/digest/rmd160/rmd160ossl.h
index e8928d164b..3df38a01c0 100644
--- a/ext/digest/rmd160/rmd160ossl.h
+++ b/ext/digest/rmd160/rmd160ossl.h
@@ -10,12 +10,10 @@
#define RMD160_Init RIPEMD160_Init
#define RMD160_Update RIPEMD160_Update
-#define RMD160_Final RIPEMD160_Final
#define RMD160_BLOCK_LENGTH RIPEMD160_CBLOCK
#define RMD160_DIGEST_LENGTH RIPEMD160_DIGEST_LENGTH
-char *RMD160_End(RMD160_CTX *ctx, char *buf);
-int RMD160_Equal(RMD160_CTX *pctx1, RMD160_CTX *pctx2);
+void RMD160_Finish(RMD160_CTX *ctx, char *buf);
#endif
diff --git a/ext/digest/sha1/depend b/ext/digest/sha1/depend
index a159f456d3..61607844d0 100644
--- a/ext/digest/sha1/depend
+++ b/ext/digest/sha1/depend
@@ -1,7 +1,5 @@
sha1.o: sha1.c sha1.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
$(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
-sha1hl.o: sha1hl.c sha1.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
sha1init.o: sha1init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
$(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
sha1.h $(srcdir)/../defs.h
diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb
index c249a415ed..87b74c34af 100644
--- a/ext/digest/sha1/extconf.rb
+++ b/ext/digest/sha1/extconf.rb
@@ -3,7 +3,8 @@
require "mkmf"
-$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [ "sha1init.#{$OBJEXT}" ]
@@ -13,7 +14,7 @@ if !with_config("bundled-sha1") &&
have_library("crypto") && have_header("openssl/sha.h")
$objs << "sha1ossl.#{$OBJEXT}"
else
- $objs << "sha1.#{$OBJEXT}" << "sha1hl.#{$OBJEXT}"
+ $objs << "sha1.#{$OBJEXT}"
end
have_header("sys/cdefs.h")
@@ -22,4 +23,6 @@ have_header("inttypes.h")
have_header("unistd.h")
+$preload = %w[digest]
+
create_makefile("digest/sha1")
diff --git a/ext/digest/sha1/sha1.c b/ext/digest/sha1/sha1.c
index 1012ef8751..6196ca6b82 100644
--- a/ext/digest/sha1/sha1.c
+++ b/ext/digest/sha1/sha1.c
@@ -129,9 +129,7 @@ do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LON
/*
* Hash a single 512-bit block. This is the core of the algorithm.
*/
-void SHA1_Transform(state, buffer)
- uint32_t state[5];
- const uint8_t buffer[64];
+void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
{
uint32_t a, b, c, d, e;
CHAR64LONG16 *block;
@@ -201,8 +199,7 @@ void SHA1_Transform(state, buffer)
/*
* SHA1_Init - Initialize new context
*/
-void SHA1_Init(context)
- SHA1_CTX *context;
+void SHA1_Init(SHA1_CTX *context)
{
_DIAGASSERT(context != 0);
@@ -220,10 +217,7 @@ void SHA1_Init(context)
/*
* Run your data through this.
*/
-void SHA1_Update(context, data, len)
- SHA1_CTX *context;
- const uint8_t *data;
- size_t len;
+void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
{
uint32_t i, j;
@@ -250,9 +244,7 @@ void SHA1_Update(context, data, len)
/*
* Add padding and return the message digest.
*/
-void SHA1_Final(digest, context)
- uint8_t digest[20];
- SHA1_CTX* context;
+void SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
{
size_t i;
uint8_t finalcount[8];
@@ -275,9 +267,3 @@ void SHA1_Final(digest, context)
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
}
}
-
-int SHA1_Equal(SHA1_CTX* pctx1, SHA1_CTX* pctx2) {
- return memcmp(pctx1->count, pctx2->count, sizeof(pctx1->count)) == 0
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
-}
diff --git a/ext/digest/sha1/sha1.h b/ext/digest/sha1/sha1.h
index 2303cecc2b..60e3b01fe2 100644
--- a/ext/digest/sha1/sha1.h
+++ b/ext/digest/sha1/sha1.h
@@ -20,28 +20,17 @@ typedef struct {
} SHA1_CTX;
#ifdef RUBY
+/* avoid name clash */
#define SHA1_Transform rb_Digest_SHA1_Transform
#define SHA1_Init rb_Digest_SHA1_Init
#define SHA1_Update rb_Digest_SHA1_Update
-#define SHA1_Final rb_Digest_SHA1_Final
-#define SHA1_Equal rb_Digest_SHA1_Equal
-#ifndef _KERNEL
-#define SHA1_End rb_Digest_SHA1_End
-#define SHA1_File rb_Digest_SHA1_File
-#define SHA1_Data rb_Digest_SHA1_Data
-#endif /* _KERNEL */
+#define SHA1_Finish rb_Digest_SHA1_Finish
#endif
void SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
void SHA1_Init _((SHA1_CTX *context));
void SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
-void SHA1_Final _((uint8_t digest[20], SHA1_CTX *context));
-int SHA1_Equal _((SHA1_CTX *pctx1, SHA1_CTX *pctx2));
-#ifndef _KERNEL
-char *SHA1_End _((SHA1_CTX *, char *));
-char *SHA1_File _((char *, char *));
-char *SHA1_Data _((const uint8_t *, size_t, char *));
-#endif /* _KERNEL */
+void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
#define SHA1_BLOCK_LENGTH 64
#define SHA1_DIGEST_LENGTH 20
diff --git a/ext/digest/sha1/sha1hl.c b/ext/digest/sha1/sha1hl.c
deleted file mode 100644
index d1a236b22c..0000000000
--- a/ext/digest/sha1/sha1hl.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $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
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- */
-
-/* #include "namespace.h" */
-
-#include "sha1.h"
-#include <fcntl.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#if defined(LIBC_SCCS) && !defined(lint)
-/* __RCSID("$NetBSD: sha1hl.c,v 1.2 2001/03/10 15:55:14 tron Exp $"); */
-#endif /* LIBC_SCCS and not lint */
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
-
-
-/* ARGSUSED */
-char *
-SHA1_End(ctx, buf)
- SHA1_CTX *ctx;
- char *buf;
-{
- int i;
- char *p = buf;
- uint8_t digest[20];
- static const char hex[]="0123456789abcdef";
-
- _DIAGASSERT(ctx != NULL);
- /* buf may be NULL */
-
- if (p == NULL && (p = malloc(41)) == NULL)
- return 0;
-
- SHA1_Final(digest,ctx);
- for (i = 0; i < 20; i++) {
- p[i + i] = hex[((uint32_t)digest[i]) >> 4];
- p[i + i + 1] = hex[digest[i] & 0x0f];
- }
- p[i + i] = '\0';
- return(p);
-}
-
-char *
-SHA1_File (filename, buf)
- char *filename;
- char *buf;
-{
- uint8_t buffer[BUFSIZ];
- SHA1_CTX ctx;
- int fd, num, oerrno;
-
- _DIAGASSERT(filename != NULL);
- /* XXX: buf may be NULL ? */
-
- SHA1_Init(&ctx);
-
- if ((fd = open(filename,O_RDONLY)) < 0)
- return(0);
-
- while ((num = read(fd, buffer, sizeof(buffer))) > 0)
- SHA1_Update(&ctx, buffer, (size_t)num);
-
- oerrno = errno;
- close(fd);
- errno = oerrno;
- return(num < 0 ? 0 : SHA1_End(&ctx, buf));
-}
-
-char *
-SHA1_Data (data, len, buf)
- const uint8_t *data;
- size_t len;
- char *buf;
-{
- SHA1_CTX ctx;
-
- _DIAGASSERT(data != NULL);
- /* XXX: buf may be NULL ? */
-
- SHA1_Init(&ctx);
- SHA1_Update(&ctx, data, len);
- return(SHA1_End(&ctx, buf));
-}
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
index 426afb7cd0..b2146f05a9 100644
--- a/ext/digest/sha1/sha1init.c
+++ b/ext/digest/sha1/sha1init.c
@@ -8,31 +8,33 @@
#include "sha1.h"
#endif
-static algo_t sha1 = {
+static rb_digest_metadata_t sha1 = {
+ RUBY_DIGEST_API_VERSION,
SHA1_DIGEST_LENGTH,
+ SHA1_BLOCK_LENGTH,
sizeof(SHA1_CTX),
- (hash_init_func_t)SHA1_Init,
- (hash_update_func_t)SHA1_Update,
- (hash_end_func_t)SHA1_End,
- (hash_final_func_t)SHA1_Final,
- (hash_equal_func_t)SHA1_Equal,
+ (rb_digest_hash_init_func_t)SHA1_Init,
+ (rb_digest_hash_update_func_t)SHA1_Update,
+ (rb_digest_hash_finish_func_t)SHA1_Finish,
};
+/*
+ * A class for calculating message digests using the SHA-1 Secure Hash
+ * Algorithm by NIST (the US' National Institute of Standards and
+ * Technology), described in FIPS PUB 180-1.
+ */
void
Init_sha1()
{
VALUE mDigest, cDigest_Base, cDigest_SHA1;
- ID id_metadata;
-
- rb_require("digest.so");
-
+
+ rb_require("digest");
+
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");
cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);
- id_metadata = rb_intern("metadata");
-
- rb_cvar_set(cDigest_SHA1, id_metadata,
- Data_Wrap_Struct(rb_cObject, 0, 0, &sha1), Qtrue);
+ rb_ivar_set(cDigest_SHA1, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, &sha1));
}
diff --git a/ext/digest/sha1/sha1ossl.c b/ext/digest/sha1/sha1ossl.c
index b125128f82..452cf35084 100644
--- a/ext/digest/sha1/sha1ossl.c
+++ b/ext/digest/sha1/sha1ossl.c
@@ -1,45 +1,10 @@
/* $Id$ */
-#include "sha1ossl.h"
#include "defs.h"
-#include <assert.h>
-#include <stdlib.h>
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
+#include "sha1ossl.h"
-char *
-SHA1_End(SHA1_CTX *ctx, char *buf)
+void
+SHA1_Finish(SHA1_CTX *ctx, char *buf)
{
- int i;
- char *p = buf;
- uint8_t digest[20];
- static const char hex[]="0123456789abcdef";
-
- _DIAGASSERT(ctx != NULL);
- /* buf may be NULL */
-
- if (p == NULL && (p = malloc(41)) == NULL)
- return 0;
-
- SHA1_Final(digest,ctx);
- for (i = 0; i < 20; i++) {
- p[i + i] = hex[((uint32_t)digest[i]) >> 4];
- p[i + i + 1] = hex[digest[i] & 0x0f];
- }
- p[i + i] = '\0';
- return(p);
-}
-
-int SHA1_Equal(SHA1_CTX* pctx1, SHA1_CTX* pctx2) {
- return pctx1->num == pctx2->num
- && pctx1->h0 == pctx2->h0
- && pctx1->h1 == pctx2->h1
- && pctx1->h2 == pctx2->h2
- && pctx1->h3 == pctx2->h3
- && pctx1->h4 == pctx2->h4
- && pctx1->Nl == pctx2->Nl
- && pctx1->Nh == pctx2->Nh
- && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
+ SHA1_Final((unsigned char *)buf, ctx);
}
diff --git a/ext/digest/sha1/sha1ossl.h b/ext/digest/sha1/sha1ossl.h
index c271cc47c6..8f9984cc64 100644
--- a/ext/digest/sha1/sha1ossl.h
+++ b/ext/digest/sha1/sha1ossl.h
@@ -8,10 +8,13 @@
#define SHA1_CTX SHA_CTX
+#ifdef SHA_BLOCK_LENGTH
#define SHA1_BLOCK_LENGTH SHA_BLOCK_LENGTH
+#else
+#define SHA1_BLOCK_LENGTH SHA_CBLOCK
+#endif
#define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
-char *SHA1_End(SHA1_CTX *ctx, char *buf);
-int SHA1_Equal(SHA1_CTX *pctx1, SHA1_CTX *pctx2);
+void SHA1_Finish(SHA1_CTX *ctx, char *buf);
#endif
diff --git a/ext/digest/sha2/depend b/ext/digest/sha2/depend
index 2587415fdc..225d6ad52b 100644
--- a/ext/digest/sha2/depend
+++ b/ext/digest/sha2/depend
@@ -1,7 +1,5 @@
sha2.o: sha2.c sha2.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
$(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
-sha2hl.o: sha2hl.c sha2.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
sha2init.o: sha2init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
$(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
sha2.h $(srcdir)/../defs.h
diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb
index 17fb9f2d1a..c084a51a64 100644
--- a/ext/digest/sha2/extconf.rb
+++ b/ext/digest/sha2/extconf.rb
@@ -3,11 +3,11 @@
require "mkmf"
-$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+$defs << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
$objs = [
"sha2.#{$OBJEXT}",
- "sha2hl.#{$OBJEXT}",
"sha2init.#{$OBJEXT}",
]
@@ -17,6 +17,8 @@ have_header("inttypes.h")
have_header("unistd.h")
+$preload = %w[digest]
+
if have_type("uint64_t", "defs.h", $defs.join(' '))
create_makefile("digest/sha2")
end
diff --git a/ext/digest/sha2/lib/sha2.rb b/ext/digest/sha2/lib/sha2.rb
new file mode 100644
index 0000000000..52dd639f9b
--- /dev/null
+++ b/ext/digest/sha2/lib/sha2.rb
@@ -0,0 +1,73 @@
+#--
+# sha2.rb - defines Digest::SHA2 class which wraps up the SHA256,
+# SHA384, and SHA512 classes.
+#++
+# Copyright (c) 2006 Akinori MUSHA <knu@iDaemons.org>
+#
+# All rights reserved. You can redistribute and/or modify it under the same
+# terms as Ruby.
+#
+# $Id$
+
+require 'digest'
+
+module Digest
+ #
+ # A meta digest provider class for SHA256, SHA384 and SHA512.
+ #
+ class SHA2 < Digest::Class
+ # call-seq:
+ # Digest::SHA2.new(bitlen = 256) -> digest_obj
+ #
+ # Creates a new SHA2 hash object with a given bit length.
+ def initialize(bitlen = 256)
+ case bitlen
+ when 256
+ @sha2 = Digest::SHA256.new
+ when 384
+ @sha2 = Digest::SHA384.new
+ when 512
+ @sha2 = Digest::SHA512.new
+ else
+ raise ArgumentError, "unsupported bit length: %s" % bitlen.inspect
+ end
+ @bitlen = bitlen
+ end
+
+ # :nodoc:
+ def reset
+ @sha2.reset
+ self
+ end
+
+ # :nodoc:
+ def update(str)
+ @sha2.update(str)
+ self
+ end
+ alias << update
+
+ def finish
+ @sha2.digest!
+ end
+ private :finish
+
+ def block_length
+ @sha2.block_length
+ end
+
+ def digest_length
+ @sha2.digest_length
+ end
+
+ # :nodoc:
+ def initialize_copy(other)
+ @sha2 = other.instance_eval { @sha2.clone }
+ end
+
+ # :nodoc:
+ def inspect
+ "#<%s:%d %s>" % [self.class.name, @bitlen, hexdigest]
+ end
+ end
+end
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c
index 24a57ded0d..aca9ee926f 100644
--- a/ext/digest/sha2/sha2.c
+++ b/ext/digest/sha2/sha2.c
@@ -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)
+#if defined(__GNUC__) || defined(_HPUX_SOURCE) || defined(__IBMC__)
#define ULL(number) number##ULL
#else
#define ULL(number) (uint64_t)(number)
@@ -515,7 +515,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
usedspace = freespace = 0;
}
-void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
+void SHA256_Finish(SHA256_CTX* context, sha2_byte digest[]) {
sha2_word32 *d = (sha2_word32*)digest;
unsigned int usedspace;
@@ -578,12 +578,6 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
usedspace = 0;
}
-int SHA256_Equal(SHA256_CTX* pctx1, SHA256_CTX* pctx2) {
- return pctx1->bitcount == pctx2->bitcount
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
-}
-
/*** SHA-512: *********************************************************/
void SHA512_Init(SHA512_CTX* context) {
if (context == (SHA512_CTX*)0) {
@@ -852,7 +846,7 @@ void SHA512_Last(SHA512_CTX* context) {
SHA512_Transform(context, (const sha2_word64*)context->buffer);
}
-void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
+void SHA512_Finish(SHA512_CTX* context, sha2_byte digest[]) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -881,12 +875,6 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
MEMSET_BZERO(context, sizeof(SHA512_CTX));
}
-int SHA512_Equal(SHA512_CTX* pctx1, SHA512_CTX* pctx2) {
- return memcmp(pctx1->bitcount, pctx2->bitcount, sizeof(pctx1->bitcount)) == 0
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
-}
-
/*** SHA-384: *********************************************************/
void SHA384_Init(SHA384_CTX* context) {
if (context == (SHA384_CTX*)0) {
@@ -901,7 +889,7 @@ void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
SHA512_Update((SHA512_CTX*)context, data, len);
}
-void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
+void SHA384_Finish(SHA384_CTX* context, sha2_byte digest[]) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -929,9 +917,3 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
/* Zero out state data */
MEMSET_BZERO(context, sizeof(SHA384_CTX));
}
-
-int SHA384_Equal(SHA384_CTX* pctx1, SHA384_CTX* pctx2) {
- return memcmp(pctx1->bitcount, pctx2->bitcount, sizeof(pctx1->bitcount)) == 0
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
-}
diff --git a/ext/digest/sha2/sha2.h b/ext/digest/sha2/sha2.h
index 4689ad93ce..917d415b73 100644
--- a/ext/digest/sha2/sha2.h
+++ b/ext/digest/sha2/sha2.h
@@ -77,53 +77,29 @@ typedef SHA512_CTX SHA384_CTX;
#ifdef RUBY
#define SHA256_Init rb_Digest_SHA256_Init
#define SHA256_Update rb_Digest_SHA256_Update
-#define SHA256_Final rb_Digest_SHA256_Final
-#define SHA256_End rb_Digest_SHA256_End
-#define SHA256_Data rb_Digest_SHA256_Data
-#define SHA256_File rb_Digest_SHA256_File
-#define SHA256_Equal rb_Digest_SHA256_Equal
+#define SHA256_Finish rb_Digest_SHA256_Finish
#define SHA384_Init rb_Digest_SHA384_Init
#define SHA384_Update rb_Digest_SHA384_Update
-#define SHA384_Final rb_Digest_SHA384_Final
-#define SHA384_End rb_Digest_SHA384_End
-#define SHA384_Data rb_Digest_SHA384_Data
-#define SHA384_File rb_Digest_SHA384_File
-#define SHA384_Equal rb_Digest_SHA384_Equal
+#define SHA384_Finish rb_Digest_SHA384_Finish
#define SHA512_Init rb_Digest_SHA512_Init
#define SHA512_Update rb_Digest_SHA512_Update
-#define SHA512_Final rb_Digest_SHA512_Final
-#define SHA512_End rb_Digest_SHA512_End
-#define SHA512_Data rb_Digest_SHA512_Data
-#define SHA512_File rb_Digest_SHA512_File
-#define SHA512_Equal rb_Digest_SHA512_Equal
+#define SHA512_Finish rb_Digest_SHA512_Finish
#endif
/*** SHA-256/384/512 Function Prototypes ******************************/
void SHA256_Init _((SHA256_CTX *));
void SHA256_Update _((SHA256_CTX*, const uint8_t*, size_t));
-void SHA256_Final _((uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*));
-char* SHA256_End _((SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]));
-char* SHA256_Data _((const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]));
-char *SHA256_File _((char *, char *));
-int SHA256_Equal _((SHA256_CTX*, SHA256_CTX*));
+void SHA256_Finish _((SHA256_CTX*, uint8_t[SHA256_DIGEST_LENGTH]));
void SHA384_Init _((SHA384_CTX*));
void SHA384_Update _((SHA384_CTX*, const uint8_t*, size_t));
-void SHA384_Final _((uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*));
-char* SHA384_End _((SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]));
-char* SHA384_Data _((const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]));
-char *SHA384_File _((char *, char *));
-int SHA384_Equal _((SHA384_CTX*, SHA384_CTX*));
+void SHA384_Finish _((SHA384_CTX*, uint8_t[SHA384_DIGEST_LENGTH]));
void SHA512_Init _((SHA512_CTX*));
void SHA512_Update _((SHA512_CTX*, const uint8_t*, size_t));
-void SHA512_Final _((uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*));
-char* SHA512_End _((SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]));
-char* SHA512_Data _((const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]));
-char *SHA512_File _((char *, char *));
-int SHA512_Equal _((SHA512_CTX*, SHA512_CTX*));
+void SHA512_Finish _((SHA512_CTX*, uint8_t[SHA512_DIGEST_LENGTH]));
#ifdef __cplusplus
}
diff --git a/ext/digest/sha2/sha2hl.c b/ext/digest/sha2/sha2hl.c
deleted file mode 100644
index 03fde538c3..0000000000
--- a/ext/digest/sha2/sha2hl.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* $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
- * This code includes some functions taken from sha2.c, hence the
- * following licence reproduction.
- *
- * This code is not a verbatim copy, since some routines have been added,
- * and some bugs have been fixed.
- *
- * Version 1.0.0beta1
- *
- * Written by Aaron D. Gifford <me@aarongifford.com>
- *
- * Copyright 2000 Aaron D. Gifford. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 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 copyright holder nor the names of contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include "sha2.h"
-
-#ifndef lint
-/* __RCSID("$NetBSD: sha2hl.c,v 1.1 2001/03/12 09:08:40 agc Exp $"); */
-#endif /* not lint */
-
-/* #include "namespace.h" */
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#if defined(HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
-
-/*
- * Constant used by SHA256/384/512_End() functions for converting the
- * digest to a readable hexadecimal character string:
- */
-static const char sha2_hex_digits[] = "0123456789abcdef";
-
-char *
-SHA256_File(char *filename, char *buf)
-{
- uint8_t buffer[BUFSIZ * 20];
- SHA256_CTX ctx;
- int fd, num, oerrno;
-
- _DIAGASSERT(filename != NULL);
- /* XXX: buf may be NULL ? */
-
- SHA256_Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (0);
-
- while ((num = read(fd, buffer, sizeof(buffer))) > 0)
- SHA256_Update(&ctx, buffer, (size_t) num);
-
- oerrno = errno;
- close(fd);
- errno = oerrno;
- return (num < 0 ? 0 : SHA256_End(&ctx, buf));
-}
-
-
-char *
-SHA256_End(SHA256_CTX *ctx, char buffer[])
-{
- uint8_t digest[SHA256_DIGEST_LENGTH], *d = digest;
- uint8_t *ret;
- int i;
-
- /* Sanity check: */
- assert(ctx != NULL);
-
- if ((ret = buffer) != NULL) {
- SHA256_Final(digest, ctx);
-
- for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
- *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
- *buffer++ = sha2_hex_digits[*d & 0x0f];
- d++;
- }
- *buffer = (char) 0;
- } else {
- (void) memset(ctx, 0, sizeof(SHA256_CTX));
- }
- (void) memset(digest, 0, SHA256_DIGEST_LENGTH);
- return ret;
-}
-
-char *
-SHA256_Data(const uint8_t * data, size_t len, char *digest)
-{
- SHA256_CTX ctx;
-
- SHA256_Init(&ctx);
- SHA256_Update(&ctx, data, len);
- return SHA256_End(&ctx, digest);
-}
-
-char *
-SHA384_File(char *filename, char *buf)
-{
- SHA384_CTX ctx;
- uint8_t buffer[BUFSIZ * 20];
- int fd, num, oerrno;
-
- _DIAGASSERT(filename != NULL);
- /* XXX: buf may be NULL ? */
-
- SHA384_Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (0);
-
- while ((num = read(fd, buffer, sizeof(buffer))) > 0)
- SHA384_Update(&ctx, buffer, (size_t) num);
-
- oerrno = errno;
- close(fd);
- errno = oerrno;
- return (num < 0 ? 0 : SHA384_End(&ctx, buf));
-}
-
-char *
-SHA384_End(SHA384_CTX * ctx, char buffer[])
-{
- uint8_t digest[SHA384_DIGEST_LENGTH], *d = digest;
- uint8_t *ret;
- int i;
-
- /* Sanity check: */
- assert(ctx != NULL);
-
- if ((ret = buffer) != NULL) {
- SHA384_Final(digest, ctx);
-
- for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
- *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
- *buffer++ = sha2_hex_digits[*d & 0x0f];
- d++;
- }
- *buffer = (char) 0;
- } else {
- (void) memset(ctx, 0, sizeof(SHA384_CTX));
- }
- (void) memset(digest, 0, SHA384_DIGEST_LENGTH);
- return ret;
-}
-
-char *
-SHA384_Data(const uint8_t * data, size_t len, char *digest)
-{
- SHA384_CTX ctx;
-
- SHA384_Init(&ctx);
- SHA384_Update(&ctx, data, len);
- return SHA384_End(&ctx, digest);
-}
-
-char *
-SHA512_File(char *filename, char *buf)
-{
- SHA512_CTX ctx;
- uint8_t buffer[BUFSIZ * 20];
- int fd, num, oerrno;
-
- _DIAGASSERT(filename != NULL);
- /* XXX: buf may be NULL ? */
-
- SHA512_Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (0);
-
- while ((num = read(fd, buffer, sizeof(buffer))) > 0)
- SHA512_Update(&ctx, buffer, (size_t) num);
-
- oerrno = errno;
- close(fd);
- errno = oerrno;
- return (num < 0 ? 0 : SHA512_End(&ctx, buf));
-}
-
-char *
-SHA512_End(SHA512_CTX * ctx, char buffer[])
-{
- uint8_t digest[SHA512_DIGEST_LENGTH], *d = digest;
- uint8_t *ret;
- int i;
-
- /* Sanity check: */
- assert(ctx != NULL);
-
- if ((ret = buffer) != NULL) {
- SHA512_Final(digest, ctx);
-
- for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
- *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
- *buffer++ = sha2_hex_digits[*d & 0x0f];
- d++;
- }
- *buffer = (char) 0;
- } else {
- (void) memset(ctx, 0, sizeof(SHA512_CTX));
- }
- (void) memset(digest, 0, SHA512_DIGEST_LENGTH);
- return ret;
-}
-
-char *
-SHA512_Data(const uint8_t * data, size_t len, char *digest)
-{
- SHA512_CTX ctx;
-
- SHA512_Init(&ctx);
- SHA512_Update(&ctx, data, len);
- return SHA512_End(&ctx, digest);
-}
diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c
index 4b14031811..c83a29316a 100644
--- a/ext/digest/sha2/sha2init.c
+++ b/ext/digest/sha2/sha2init.c
@@ -7,18 +7,23 @@
#define FOREACH_BITLEN(func) func(256) func(384) func(512)
#define DEFINE_ALGO_METADATA(bitlen) \
-static algo_t sha##bitlen = { \
+static rb_digest_metadata_t sha##bitlen = { \
+ RUBY_DIGEST_API_VERSION, \
SHA##bitlen##_DIGEST_LENGTH, \
+ SHA##bitlen##_BLOCK_LENGTH, \
sizeof(SHA##bitlen##_CTX), \
- (hash_init_func_t)SHA##bitlen##_Init, \
- (hash_update_func_t)SHA##bitlen##_Update, \
- (hash_end_func_t)SHA##bitlen##_End, \
- (hash_final_func_t)SHA##bitlen##_Final, \
- (hash_equal_func_t)SHA##bitlen##_Equal, \
+ (rb_digest_hash_init_func_t)SHA##bitlen##_Init, \
+ (rb_digest_hash_update_func_t)SHA##bitlen##_Update, \
+ (rb_digest_hash_finish_func_t)SHA##bitlen##_Finish, \
};
FOREACH_BITLEN(DEFINE_ALGO_METADATA)
+/*
+ * Classes for calculating message digests using the SHA-256/384/512
+ * Secure Hash Algorithm(s) by NIST (the US' National Institute of
+ * Standards and Technology), described in FIPS PUB 180-2.
+ */
void
Init_sha2()
{
@@ -30,7 +35,7 @@ Init_sha2()
FOREACH_BITLEN(DECLARE_ALGO_CLASS)
- rb_require("digest.so");
+ rb_require("digest");
id_metadata = rb_intern("metadata");
@@ -40,8 +45,8 @@ Init_sha2()
#define DEFINE_ALGO_CLASS(bitlen) \
cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
\
- rb_cvar_set(cDigest_SHA##bitlen, id_metadata, \
- Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen), Qtrue);
+ rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
+ Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen));
FOREACH_BITLEN(DEFINE_ALGO_CLASS)
}
diff --git a/ext/digest/test.sh b/ext/digest/test.sh
index 6fb07d2177..328c7575e6 100644
--- a/ext/digest/test.sh
+++ b/ext/digest/test.sh
@@ -11,8 +11,6 @@ ${RUBY} extconf.rb --with-cflags="${CFLAGS}"
${MAKE} clean
${MAKE}
-mkdir -p lib/digest
-
for algo in md5 rmd160 sha1 sha2; do
args=--with-cflags="${CFLAGS}"
@@ -27,7 +25,6 @@ for algo in md5 rmd160 sha1 sha2; do
ln -sf ../../$algo/$algo.so lib/digest/
done
-${RUBY} -I. -I./lib test.rb
+${RUBY} -I. -I./lib ../../test/digest/test_digest.rb
rm lib/digest/*.so
-rmdir lib/digest
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 8972f24e07..f65247be86 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -147,7 +147,7 @@ dlstrdup(const char *str)
{
char *newstr;
- newstr = (char*)dlmalloc(strlen(str));
+ newstr = (char*)dlmalloc(strlen(str)+1);
strcpy(newstr,str);
return newstr;
@@ -459,7 +459,7 @@ rb_ary2cary(char t, VALUE v, long *size)
VALUE val0;
val0 = rb_check_array_type(v);
- if(NIL_P(TYPE(val0))) {
+ if(NIL_P(val0)) {
rb_raise(rb_eDLTypeError, "an array is expected.");
}
v = val0;
@@ -522,12 +522,15 @@ rb_str_to_ptr(VALUE self)
{
char *ptr;
int len;
+ VALUE p;
len = RSTRING(self)->len;
ptr = (char*)dlmalloc(len + 1);
memcpy(ptr, RSTRING(self)->ptr, len);
ptr[len] = '\0';
- return rb_dlptr_new((void*)ptr,len,dlfree);
+ p = rb_dlptr_new((void*)ptr,len,dlfree);
+ OBJ_INFECT(p, self);
+ return p;
}
VALUE
@@ -545,29 +548,30 @@ rb_ary_to_ptr(int argc, VALUE argv[], VALUE self)
ptr = rb_ary2cary(0, self, &size);
break;
}
- return ptr ? rb_dlptr_new(ptr, size, dlfree) : Qnil;
+ if (ptr) {
+ VALUE p = rb_dlptr_new(ptr, size, dlfree);
+ OBJ_INFECT(p, self);
+ return p;
+ }
+ return Qnil;
}
VALUE
rb_io_to_ptr(VALUE self)
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *fp;
GetOpenFile(self, fptr);
fp = fptr->f;
-#if defined(__DragonFly__)
- return fp ? rb_dlptr_new(fp, 1, 0) : Qnil;
-#else
- return fp ? rb_dlptr_new(fp, sizeof(FILE), 0) : Qnil;
-#endif
+ return fp ? rb_dlptr_new(fp, 0, 0) : Qnil;
}
VALUE
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
{
- rb_secure(4);
+ rb_secure(2);
return rb_class_new_instance(argc, argv, rb_cDLHandle);
}
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index 7a05115ec5..69d47caac0 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -66,12 +66,12 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
ptr = dlopen(clib, cflag);
#if defined(HAVE_DLERROR)
if (!ptr && (err = dlerror())) {
- rb_raise(rb_eRuntimeError, err);
+ rb_raise(rb_eRuntimeError, "%s", err);
}
#else
if (!ptr) {
err = dlerror();
- rb_raise(rb_eRuntimeError, err);
+ rb_raise(rb_eRuntimeError, "%s", err);
}
#endif
Data_Get_Struct(self, struct dl_handle, dlhandle);
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
index 63c9b2c050..01ee2490e8 100644
--- a/ext/dl/lib/dl/import.rb
+++ b/ext/dl/lib/dl/import.rb
@@ -87,7 +87,7 @@ module DL
" rs = dec.call(rs) if (dec && rs)",
" @retval = r",
" @args = rs",
- " @retval",
+ " r",
"}",
].join("\n"))
@@ -169,7 +169,7 @@ module DL
" rs = dec.call(rs) if dec",
" @retval = r",
" @args = rs",
- " return @retval",
+ " return r",
"end",
"module_function :#{mname}",
].join("\n")
diff --git a/ext/dl/lib/dl/win32.rb b/ext/dl/lib/dl/win32.rb
index 92f473d392..0fed47c324 100644
--- a/ext/dl/lib/dl/win32.rb
+++ b/ext/dl/lib/dl/win32.rb
@@ -6,7 +6,7 @@ class Win32API
DLL = {}
def initialize(dllname, func, import, export = "0")
- prototype = (export + import.to_s).tr("VPpNnLlIi", "0SSI")
+ prototype = (export + import.to_s).tr("VPpNnLlIi", "0SSI").sub(/^(.)0*$/, '\1')
handle = DLL[dllname] ||= DL::Handle.new(dllname)
@sym = handle.sym(func, prototype)
end
diff --git a/ext/dl/mkcallback.rb b/ext/dl/mkcallback.rb
index b7ea1718d0..c9f92e4a0d 100644
--- a/ext/dl/mkcallback.rb
+++ b/ext/dl/mkcallback.rb
@@ -31,6 +31,9 @@ def mkfunc(rettype, fnum, argc)
subst_code,
"",
" obj = rb_hash_aref(DLFuncTable, rb_assoc_new(INT2NUM(#{rettype.to_s}),INT2NUM(#{fnum.to_s})));",
+ " if(NIL_P(obj))",
+ " rb_raise(rb_eDLError, \"callback function does not exist in DL::FuncTable\");",
+ " Check_Type(obj, T_ARRAY);",
" proto = rb_ary_entry(obj, 0);",
" proc = rb_ary_entry(obj, 1);",
" Check_Type(proto, T_STRING);",
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c
index 32f78c4de5..01eb31da20 100644
--- a/ext/dl/ptr.c
+++ b/ext/dl/ptr.c
@@ -4,30 +4,22 @@
#include <ruby.h>
#include <ctype.h>
-#include <version.h> /* for ruby version code */
+#include "st.h"
#include "dl.h"
VALUE rb_cDLPtrData;
VALUE rb_mDLMemorySpace;
-static VALUE DLMemoryTable;
+static st_table* st_memory_table;
#ifndef T_SYMBOL
# define T_SYMBOL T_FIXNUM
#endif
-#if RUBY_VERSION_CODE < 171
-static VALUE
-rb_hash_delete(VALUE hash, VALUE key)
-{
- return rb_funcall(hash, rb_intern("delete"), 1, key);
-}
-#endif
-
static void
rb_dlmem_delete(void *ptr)
{
rb_secure(4);
- rb_hash_delete(DLMemoryTable, DLLONG2NUM(ptr));
+ st_delete(st_memory_table, (st_data_t*)&ptr, NULL);
}
static void
@@ -37,7 +29,7 @@ rb_dlmem_aset(void *ptr, VALUE obj)
rb_dlmem_delete(ptr);
}
else{
- rb_hash_aset(DLMemoryTable, DLLONG2NUM(ptr), DLLONG2NUM(obj));
+ st_insert(st_memory_table, (st_data_t)ptr, (st_data_t)obj);
}
}
@@ -46,8 +38,8 @@ rb_dlmem_aref(void *ptr)
{
VALUE val;
- val = rb_hash_aref(DLMemoryTable, DLLONG2NUM(ptr));
- return val == Qnil ? Qnil : (VALUE)DLNUM2LONG(val);
+ if(!st_lookup(st_memory_table, (st_data_t)ptr, &val)) return Qnil;
+ return val == Qundef ? Qnil : val;
}
void
@@ -344,7 +336,7 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
n = data->size / sizeof(void*);
break;
case 'S': case 's':
- for (n=0; ((void**)(data->ptr))[n]; n++) {};
+ n = data->size / sizeof(char*);
break;
default:
n = 0;
@@ -466,8 +458,9 @@ rb_dlptr_inspect(VALUE self)
char str[1024];
Data_Get_Struct(self, struct ptr_data, data);
- snprintf(str, 1023, "#<%s:0x%p ptr=0x%p size=%ld free=0x%p>",
- rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
+ snprintf(str, 1023, "#<%s:0x%lx ptr=0x%lx size=%ld free=0x%lx>",
+ rb_class2name(CLASS_OF(self)), data, data->ptr, data->size,
+ (long)data->free);
return rb_str_new2(str);
}
@@ -753,32 +746,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,34 +876,35 @@ 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]) {
@@ -981,6 +975,7 @@ 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;
@@ -1007,20 +1002,18 @@ rb_dlptr_size(int argc, VALUE argv[], VALUE self)
}
}
-static VALUE
-dlmem_each_i(VALUE assoc, void *data)
+static int
+dlmem_each_i(void* key, VALUE value, void* arg)
{
- VALUE key, val;
- key = rb_ary_entry(assoc, 0);
- val = rb_ary_entry(assoc, 1);
- rb_yield(rb_assoc_new(key,(VALUE)DLNUM2LONG(val)));
+ VALUE vkey = DLLONG2NUM(key);
+ rb_yield(rb_assoc_new(vkey, value));
return Qnil;
}
VALUE
rb_dlmem_each(VALUE self)
{
- rb_iterate(rb_each, DLMemoryTable, dlmem_each_i, 0);
+ st_foreach(st_memory_table, dlmem_each_i, 0);
return Qnil;
}
@@ -1059,7 +1052,7 @@ Init_dlptr()
rb_define_method(rb_cDLPtrData, "size=", rb_dlptr_size, -1);
rb_mDLMemorySpace = rb_define_module_under(rb_mDL, "MemorySpace");
- DLMemoryTable = rb_hash_new();
- rb_define_const(rb_mDLMemorySpace, "MemoryTable", DLMemoryTable);
+ st_memory_table = st_init_numtable();
+ rb_define_const(rb_mDLMemorySpace, "MemoryTable", Qnil); /* historical */
rb_define_module_function(rb_mDLMemorySpace, "each", rb_dlmem_each, 0);
}
diff --git a/ext/dl/sym.c b/ext/dl/sym.c
index 40b2035c00..933fb7f4f0 100644
--- a/ext/dl/sym.c
+++ b/ext/dl/sym.c
@@ -268,7 +268,7 @@ rb_dlsym_inspect(VALUE self)
str_size = RSTRING(proto)->len + 100;
str = dlmalloc(str_size);
snprintf(str, str_size - 1,
- "#<DL::Symbol:0x%p func=0x%p '%s'>",
+ "#<DL::Symbol:0x%lx func=0x%lx '%s'>",
sym, sym->func, RSTRING(proto)->ptr);
val = rb_tainted_str_new2(str);
dlfree(str);
@@ -492,6 +492,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
rb_raise(rb_eDLTypeError, "unexpected type of argument #%d", i);
}
}
+ rb_check_safe_obj(pval);
Data_Get_Struct(pval, struct ptr_data, data);
ANY2P(args[i]) = DLVOIDP(data->ptr);
}
diff --git a/ext/dl/test/test.rb b/ext/dl/test/test.rb
index 52be04699f..bf8dfc18e3 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(1024)
+ptr = DL::malloc(32)
ptr.struct!("CHIL", "c", "h", "i", "l")
ptr["c"] = 1
ptr["h"] = 2
@@ -291,5 +291,16 @@ 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
deleted file mode 100644
index 74785569e7..0000000000
--- a/ext/enumerator/enumerator.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/************************************************
-
- enumerator.c - provides Enumerator class
-
- $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$
-
-************************************************/
-
-#include "ruby.h"
-#include "node.h"
-
-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;
-
-static VALUE
-obj_to_enum(obj, enum_args)
- VALUE obj, enum_args;
-{
- rb_ary_unshift(enum_args, obj);
-
- return rb_apply(rb_cEnumerator, id_new, enum_args);
-}
-
-static VALUE
-enumerator_enum_with_index(obj)
- VALUE obj;
-{
- return rb_funcall(rb_cEnumerator, id_new, 2, obj, sym_each_with_index);
-}
-
-static VALUE
-each_slice_i(val, memo)
- VALUE val;
- NODE *memo;
-{
- VALUE ary = memo->u1.value;
- long size = memo->u3.cnt;
-
- rb_ary_push(ary, val);
-
- if (RARRAY(ary)->len == size) {
- rb_yield(ary);
- memo->u1.value = rb_ary_new2(size);
- }
-
- return Qnil;
-}
-
-static VALUE
-enum_each_slice(obj, n)
- VALUE obj, n;
-{
- long size = NUM2LONG(n);
- NODE *memo;
- VALUE ary;
-
- if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
-
- memo = rb_node_newnode(NODE_MEMO, rb_ary_new2(size), 0, size);
-
- rb_iterate(rb_each, obj, each_slice_i, (VALUE)memo);
-
- ary = memo->u1.value;
- if (RARRAY(ary)->len > 0) rb_yield(ary);
-
- return Qnil;
-}
-
-static VALUE
-enumerator_enum_slice(obj, n)
- VALUE obj, n;
-{
- return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_slice, n);
-}
-
-static VALUE
-each_cons_i(val, memo)
- VALUE val;
- NODE *memo;
-{
- VALUE ary = memo->u1.value;
- long size = memo->u3.cnt;
-
- if (RARRAY(ary)->len == size) {
- rb_ary_shift(ary);
- }
- rb_ary_push(ary, val);
- if (RARRAY(ary)->len == size) {
- rb_yield(rb_ary_dup(ary));
- }
- return Qnil;
-}
-
-static VALUE
-enum_each_cons(obj, n)
- VALUE obj, n;
-{
- long size = NUM2LONG(n);
- NODE *memo;
-
- if (size <= 0) rb_raise(rb_eArgError, "invalid size");
- memo = rb_node_newnode(NODE_MEMO, rb_ary_new2(size), 0, size);
-
- rb_iterate(rb_each, obj, each_cons_i, (VALUE)memo);
-
- return Qnil;
-}
-
-static VALUE
-enumerator_enum_cons(obj, n)
- VALUE obj, n;
-{
- return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_cons, n);
-}
-
-static VALUE
-enumerator_initialize(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
-{
- VALUE enum_obj, enum_method, enum_args;
-
- rb_scan_args(argc, argv, "11*", &enum_obj, &enum_method, &enum_args);
-
- if (enum_method == Qnil)
- enum_method = sym_each;
-
- rb_ivar_set(obj, id_enum_obj, enum_obj);
- rb_ivar_set(obj, id_enum_method, enum_method);
- rb_ivar_set(obj, id_enum_args, enum_args);
-
- return Qnil;
-}
-
-static VALUE
-enumerator_iter(memo)
- NODE *memo;
-{
- return rb_apply(memo->u1.value, memo->u2.id, memo->u3.value);
-}
-
-static VALUE
-enumerator_each(obj)
- VALUE obj;
-{
- VALUE val;
-
- obj = (VALUE)rb_node_newnode(NODE_MEMO,
- rb_ivar_get(obj, id_enum_obj),
- rb_to_id(rb_ivar_get(obj, id_enum_method)),
- rb_ivar_get(obj, id_enum_args));
- val = rb_iterate((VALUE (*)_((VALUE)))enumerator_iter, obj, rb_yield, 0);
- return val;
-}
-
-void
-Init_enumerator()
-{
- VALUE rb_mEnumerable;
-
- rb_define_method(rb_mKernel, "to_enum", obj_to_enum, -2);
- rb_define_method(rb_mKernel, "enum_for", obj_to_enum, -2);
-
- rb_mEnumerable = rb_path2class("Enumerable");
-
- rb_define_method(rb_mEnumerable, "enum_with_index", enumerator_enum_with_index, 0);
- rb_define_method(rb_mEnumerable, "each_slice", enum_each_slice, 1);
- rb_define_method(rb_mEnumerable, "enum_slice", enumerator_enum_slice, 1);
- rb_define_method(rb_mEnumerable, "each_cons", enum_each_cons, 1);
- rb_define_method(rb_mEnumerable, "enum_cons", enumerator_enum_cons, 1);
-
- rb_cEnumerator = rb_define_class_under(rb_mEnumerable, "Enumerator", rb_cObject);
- rb_include_module(rb_cEnumerator, rb_mEnumerable);
-
- rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
- rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
-
- sym_each = ID2SYM(rb_intern("each"));
- sym_each_with_index = ID2SYM(rb_intern("each_with_index"));
- sym_each_slice = ID2SYM(rb_intern("each_slice"));
- sym_each_cons = ID2SYM(rb_intern("each_cons"));
-
- id_new = rb_intern("new");
- id_enum_obj = rb_intern("enum_obj");
- id_enum_method = rb_intern("enum_method");
- id_enum_args = rb_intern("enum_args");
-}
diff --git a/ext/enumerator/enumerator.txt b/ext/enumerator/enumerator.txt
deleted file mode 100644
index 64c7d50226..0000000000
--- a/ext/enumerator/enumerator.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-.\" 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$
-
-** Enumerable::Enumerator(Class)
-
-A class which provides a method `each' to be used as an Enumerable
-object.
-
-Superclass: Object
-
-Mix-ins: Enumerable
-
-require 'enumerator'
-
-Class Methods:
-
- 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"]
-
-Methods:
-
- each {...}
-
- Iterates the given block using the object and the method
- specified in the first place.
-
-
-Requiring this module also adds some methods to the Object class:
-
- to_enum(method = :each, *args)
- 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)
-
-And the Enumerable module.
-
- 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]
-
- enum_slice(n)
-
- Returns Enumerable::Enumerator.new(self, :each_slice, n).
-
- 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]
-
- enum_cons(n)
-
- Returns Enumerable::Enumerator.new(self, :each_cons, n).
-
- enum_with_index
-
- Returns Enumerable::Enumerator.new(self, :each_with_index).
-
--------------------------------------------------------
-Local variables:
-fill-column: 70
-end:
diff --git a/ext/enumerator/extconf.rb b/ext/enumerator/extconf.rb
deleted file mode 100644
index 94e2ee38b2..0000000000
--- a/ext/enumerator/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'mkmf'
-create_makefile('enumerator')
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 3b788d72d7..ecb9e16411 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -34,6 +34,13 @@ char *getenv();
#endif
char *getlogin();
+/* Returns the short user name of the currently logged in user.
+ * Unfortunately, it is often rather easy to fool getlogin().
+ * Avoid getlogin() for security-related purposes.
+ *
+ * e.g.
+ * Etc.getlogin -> 'guest'
+ */
static VALUE
etc_getlogin(obj)
VALUE obj;
@@ -74,18 +81,18 @@ setup_passwd(pwd)
#ifdef HAVE_ST_PW_PASSWD
safe_setup_str(pwd->pw_passwd),
#endif
- INT2FIX(pwd->pw_uid),
- INT2FIX(pwd->pw_gid),
+ PW_UID2VAL(pwd->pw_uid),
+ PW_GID2VAL(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
- INT2FIX(pwd->pw_change),
+ INT2NUM(pwd->pw_change),
#endif
#ifdef HAVE_ST_PW_QUOTA
- INT2FIX(pwd->pw_quota),
+ INT2NUM(pwd->pw_quota),
#endif
#ifdef HAVE_ST_PW_AGE
PW_AGE2VAL(pwd->pw_age),
@@ -97,13 +104,22 @@ setup_passwd(pwd)
safe_setup_str(pwd->pw_comment),
#endif
#ifdef HAVE_ST_PW_EXPIRE
- INT2FIX(pwd->pw_expire),
+ INT2NUM(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;
@@ -112,12 +128,12 @@ etc_getpwuid(argc, argv, obj)
{
#if defined(HAVE_GETPWENT)
VALUE id;
- int uid;
+ uid_t uid;
struct passwd *pwd;
rb_secure(4);
if (rb_scan_args(argc, argv, "01", &id) == 1) {
- uid = NUM2INT(id);
+ uid = PW_VAL2UID(id);
}
else {
uid = getuid();
@@ -130,6 +146,14 @@ 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;
@@ -169,6 +193,21 @@ 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;
@@ -191,6 +230,9 @@ 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;
@@ -201,6 +243,9 @@ 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;
@@ -211,6 +256,32 @@ 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;
@@ -244,21 +315,31 @@ setup_group(grp)
#ifdef HAVE_ST_GR_PASSWD
safe_setup_str(grp->gr_passwd),
#endif
- INT2FIX(grp->gr_gid),
+ PW_GID2VAL(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
- int gid;
+ gid_t gid;
struct group *grp;
rb_secure(4);
- gid = NUM2INT(id);
+ gid = PW_VAL2GID(id);
grp = getgrgid(gid);
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
return setup_group(grp);
@@ -267,6 +348,16 @@ 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;
@@ -307,6 +398,21 @@ 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;
@@ -329,6 +435,9 @@ 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;
@@ -339,6 +448,9 @@ 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;
@@ -349,6 +461,26 @@ 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;
@@ -365,6 +497,11 @@ 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()
{
@@ -386,6 +523,7 @@ 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
@@ -411,14 +549,13 @@ Init_etc()
"expire",
#endif
NULL);
- rb_global_variable(&sPasswd);
#ifdef HAVE_GETGRENT
+ rb_global_variable(&sGroup);
sGroup = rb_struct_define("Group", "name",
#ifdef HAVE_ST_GR_PASSWD
"passwd",
#endif
"gid", "mem", NULL);
- rb_global_variable(&sGroup);
#endif
}
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 0dc8e7ddac..dbd0672545 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -24,6 +24,20 @@ if a or b or c
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')
- have_type("uid_t");
+ [%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 26651195a1..64746552c1 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -1,13 +1,19 @@
#! /usr/local/bin/ruby
# -*- ruby -*-
+$extension = nil
+$extstatic = nil
$force_static = nil
$install = nil
$destdir = nil
+$dryrun = false
$clean = nil
$nodynamic = nil
$extinit = nil
$extobjs = nil
+$extflags = ""
+$extlibs = nil
+$extpath = nil
$ignore = nil
$message = nil
@@ -16,7 +22,6 @@ alias $PROGRAM_NAME $0
alias $0 $progname
$extlist = []
-$extupdate = false
$compiled = {}
$:.replace([Dir.pwd])
@@ -70,14 +75,18 @@ def extract_makefile(makefile, keep = true)
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] || "")
+ $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
+ $objs = (m[/^OBJS[ \t]*=[ \t](.*)/, 1] || "").split
+ $srcs = (m[/^SRCS[ \t]*=[ \t](.*)/, 1] || "").split
$LOCAL_LIBS = m[/^LOCAL_LIBS[ \t]*=[ \t]*(.*)/, 1] || ""
$LIBPATH = Shellwords.shellwords(m[/^libpath[ \t]*=[ \t]*(.*)/, 1] || "") - %w[$(libdir) $(topdir)]
true
@@ -103,29 +112,51 @@ def extmake(target)
Dir.chdir target
top_srcdir = $top_srcdir
topdir = $topdir
- mk_srcdir = CONFIG["srcdir"]
- mk_topdir = CONFIG["topdir"]
+ hdrdir = $hdrdir
prefix = "../" * (target.count("/")+1)
- $hdrdir = $top_srcdir = relative_from(top_srcdir, prefix)
+ $top_srcdir = relative_from(top_srcdir, prefix)
+ $hdrdir = relative_from(hdrdir, prefix)
$topdir = prefix + $topdir
$target = target
$mdir = target
$srcdir = File.join($top_srcdir, "ext", $mdir)
$preload = nil
+ $objs = ""
+ $srcs = ""
$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
+ rbconfig0 = Config::CONFIG
+ mkconfig0 = CONFIG
+ rbconfig = {
+ "hdrdir" => $hdrdir,
+ "srcdir" => $srcdir,
+ "topdir" => $topdir,
+ }
+ mkconfig = {
+ "hdrdir" => "$(top_srcdir)",
+ "srcdir" => "$(top_srcdir)/ext/#{$mdir}",
+ "topdir" => $topdir,
+ }
+ rbconfig0.each_pair {|key, val| rbconfig[key] ||= val.dup}
+ mkconfig0.each_pair {|key, val| mkconfig[key] ||= val.dup}
+ Config.module_eval {
+ remove_const(:CONFIG)
+ const_set(:CONFIG, rbconfig)
+ remove_const(:MAKEFILE_CONFIG)
+ const_set(:MAKEFILE_CONFIG, mkconfig)
+ }
+ Object.class_eval {
+ remove_const(:CONFIG)
+ const_set(:CONFIG, mkconfig)
+ }
begin
- if (!(ok &&= extract_makefile(makefile)) ||
+ $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])})
+ ["#{$srcdir}/makefile.rb", "#{$srcdir}/extconf.rb", "#{$srcdir}/depend"].any? {|f| modified?(f, [t])})
then
ok = false
init_mkmf
@@ -138,7 +169,7 @@ def extmake(target)
else
create_makefile(target)
end
- $extupdate = true
+ $defs << "-DRUBY_EXPORT" if $static
ok = File.exist?(makefile)
end
rescue SystemExit
@@ -168,7 +199,11 @@ def extmake(target)
$ignore or $continue or return false
end
$compiled[target] = true
- if $clean and $clean != true
+ if $clean
+ FileUtils.rm_f("mkmf.log")
+ if $clean != true
+ FileUtils.rm_f([makefile, $extconf_h || "extconf.h"])
+ end
File.unlink(makefile) rescue nil
end
if $static
@@ -182,12 +217,21 @@ def extmake(target)
$extpath |= $LIBPATH
end
ensure
- $hdrdir = $top_srcdir = top_srcdir
- Config::CONFIG["topdir"] = topdir
- CONFIG["srcdir"] = mk_srcdir
- CONFIG["topdir"] = mk_topdir
- CONFIG.delete("hdrdir")
+ unless $ignore
+ Config.module_eval {
+ remove_const(:CONFIG)
+ const_set(:CONFIG, rbconfig0)
+ remove_const(:MAKEFILE_CONFIG)
+ const_set(:MAKEFILE_CONFIG, mkconfig0)
+ }
+ Object.class_eval {
+ remove_const(:CONFIG)
+ const_set(:CONFIG, mkconfig0)
+ }
+ end
+ $top_srcdir = top_srcdir
$topdir = topdir
+ $hdrdir = hdrdir
Dir.chdir dir
end
begin
@@ -216,8 +260,7 @@ def parse_args()
if ($extstatic = v) == false
$extstatic = []
elsif v
- $force_static = true
- $extstatic.delete("static")
+ $force_static = true if $extstatic.delete("static")
$extstatic = nil if $extstatic.empty?
end
end
@@ -231,6 +274,7 @@ def parse_args()
$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
@@ -254,7 +298,7 @@ def parse_args()
$mflags.unshift(*rest) unless rest.empty?
def $mflags.set?(flag)
- grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
+ grep(/\A-(?!-).*#{flag.chr}/i) { return true }
false
end
def $mflags.defined?(var)
@@ -271,6 +315,7 @@ def parse_args()
$continue = $mflags.set?(?k)
if $extout
$extout = '$(topdir)/'+$extout
+ Config::CONFIG["extout"] = CONFIG["extout"] = $extout
$extout_prefix = $extout ? "$(extout)$(target_prefix)/" : ""
$mflags << "extout=#$extout" << "extout_prefix=#$extout_prefix"
end
@@ -280,9 +325,9 @@ parse_args()
if target = ARGV.shift and /^[a-z-]+$/ =~ target
$mflags.push(target)
- target = target.sub(/^(dist|real)(?=(?:clean)?$)/, '')
case target
- when /clean/
+ when /^(dist|real)?(clean)$/
+ target = $2
$ignore ||= true
$clean = $1 ? $1[0] : true
when /^install\b/
@@ -304,13 +349,21 @@ end
EXEEXT = CONFIG['EXEEXT']
if CROSS_COMPILING
$ruby = CONFIG['MINIRUBY']
-elsif $nmake
- $ruby = '$(topdir:/=\\)\\miniruby' + EXEEXT
+elsif sep = config_string('BUILD_FILE_SEPARATOR')
+ $ruby = "$(topdir:/=#{sep})#{sep}miniruby" + EXEEXT
else
$ruby = '$(topdir)/miniruby' + EXEEXT
end
-$ruby << " -I'$(topdir)' -I'$(hdrdir)/lib'"
+$ruby << " -I'$(topdir)'"
+unless CROSS_COMPILING
+ $ruby << " -I'$(top_srcdir)/lib'"
+ $ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
+ $ruby << " -I./- -I'$(top_srcdir)/ext' -rpurelib.rb"
+ ENV["RUBYLIB"] = "-"
+ ENV["RUBYOPT"] = "-rpurelib.rb"
+end
$config_h = '$(topdir)/config.h'
+$mflags << "ruby=#$ruby"
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
@@ -325,7 +378,7 @@ 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!(/#.*$/, '')
@@ -350,20 +403,33 @@ end unless $extstatic
ext_prefix = "#{$top_srcdir}/ext"
exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
-exts |= $extension if $extension
-exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
- d = File.dirname(d)
- d.slice!(0, ext_prefix.length + 1)
- d
-}.sort unless $extension
+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
+ proc {|c1| w.collect {|opt| opt.split(/,/)}.flatten.any?(&c1)}
+ 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
- Config.expand(dest = "#{$destdir}#{$rubylibdir}")
- FileUtils.cp_r(extout+"/.", dest, :verbose => true, :noop => $dryrun)
- exit
- end
+ extout = Config.expand("#{$extout}", Config::CONFIG.merge("topdir"=>$topdir))
unless $ignore
FileUtils.mkpath(extout)
end
@@ -373,26 +439,46 @@ dir = Dir.pwd
FileUtils::makedirs('ext')
Dir::chdir('ext')
+hdrdir = $hdrdir
$hdrdir = $top_srcdir = relative_from(srcdir, $topdir = "..")
exts.each do |d|
extmake(d) or abort
end
-$hdrdir = $top_srcdir = srcdir
+$top_srcdir = srcdir
$topdir = "."
+$hdrdir = hdrdir
+extinit = Struct.new(:c, :o) {
+ def initialize(src)
+ super("#{src}.c", "#{src}.#{$OBJEXT}")
+ end
+}.new("extinit")
if $ignore
- FileUtils.rm_f(%W"extinit.c extinit.#{$OBJEXT}") if $clean
+ FileUtils.rm_f(extinit.to_a) if $clean
Dir.chdir ".."
if $clean
Dir.rmdir('ext') rescue nil
- FileUtils.rm_rf(extout) if $extout
+ if $extout
+ FileUtils.rm_rf([extout+"/common", extout+"/include/ruby", extout+"/rdoc"])
+ FileUtils.rm_rf(extout+"/"+CONFIG["arch"])
+ if $clean != true
+ FileUtils.rm_rf(extout+"/include/"+CONFIG["arch"])
+ FileUtils.rm_f($mflags.defined?("INSTALLED_LIST")||ENV["INSTALLED_LIST"]||".installed.list")
+ Dir.rmdir(extout+"/include") rescue nil
+ Dir.rmdir(extout) rescue nil
+ end
+ end
end
exit
end
-if $extlist.size > 0
- $extinit ||= ""
- $extobjs ||= ""
+$extinit ||= ""
+$extobjs ||= ""
+$extpath ||= []
+$extflags ||= ""
+$extlibs ||= []
+unless $extlist.empty?
+ $extinit << "\n" unless $extinit.empty?
list = $extlist.dup
built = []
while e = list.shift
@@ -406,28 +492,33 @@ if $extlist.size > 0
end
f = format("%s/%s.%s", s, i, $LIBEXT)
if File.exist?(f)
- $extinit += "\tinit(Init_#{i}, \"#{t}.so\");\n"
- $extobjs += "ext/#{f} "
+ $extinit << " init(Init_#{i}, \"#{t}.so\");\n"
+ $extobjs << "ext/#{f} "
built << t
end
end
- 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}
-SRC
- if !modified?("extinit.c", MTIMES) || IO.read("extinit.c") != src
- open("extinit.c", "w") {|f| f.print src}
+ src = %{\
+#include "ruby.h"
+
+#define init(func, name) {void func _((void)); ruby_init_ext(name, func);}
+
+void ruby_init_ext _((const char *name, void (*init)(void)));
+
+void Init_ext _((void))\n{\n#$extinit}
+}
+ if !modified?(extinit.c, MTIMES) || IO.read(extinit.c) != src
+ open(extinit.c, "w") {|f| f.print src}
end
- $extobjs = "ext/extinit.#{$OBJEXT} " + $extobjs
+ $extobjs = "ext/#{extinit.o} #{$extobjs}"
if RUBY_PLATFORM =~ /m68k-human|beos/
$extflags.delete("-L/usr/local/lib")
end
$extpath.delete("$(topdir)")
$extflags = libpathflag($extpath) << " " << $extflags.strip
conf = [
+ ['LIBRUBY_SO_UPDATE', '$(LIBRUBY_EXTS)'],
['SETUP', $setup],
[enable_config("shared", $enable_shared) ? 'DLDOBJS' : 'EXTOBJS', $extobjs],
['EXTLIBS', $extlibs.join(' ')], ['EXTLDFLAGS', $extflags]
@@ -437,11 +528,15 @@ SRC
puts conf
$stdout.flush
$mflags.concat(conf)
+else
+ FileUtils.rm_f(extinit.to_a)
end
rubies = []
-%w[RUBY RUBYW].each {|r|
+%w[RUBY RUBYW STATIC_RUBY].each {|r|
+ n = r
if r = arg_config("--"+r.downcase) || config_string(r+"_INSTALL_NAME")
- rubies << r+EXEEXT
+ rubies << Config.expand(r+=EXEEXT)
+ $mflags << "#{n}=#{r}"
end
}
@@ -449,15 +544,21 @@ Dir.chdir ".."
unless $destdir.to_s.empty?
$mflags.defined?("DESTDIR") or $mflags << "DESTDIR=#{$destdir}"
end
-if !$extlist.empty? and $extupdate
- 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")}
+ unless (vars = $mflags.grep(/\A\w+=/n)).empty?
+ open(mkf = "libruby.mk", "wb") do |tmf|
+ tmf.puts("!include Makefile")
+ tmf.puts
+ tmf.puts(*vars.map {|v| v.sub(/=/, " = ")})
+ tmf.puts("PRE_LIBRUBY_UPDATE = del #{mkf}")
+ end
+ $mflags.unshift("-f#{mkf}")
+ vars.each {|flag| flag.sub!(/\A/, "-D")}
+ end
end
system($make, *sysquote($mflags)) or exit($?.exitstatus)
diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c
index d48630fc66..57cca103f4 100644
--- a/ext/fcntl/fcntl.c
+++ b/ext/fcntl/fcntl.c
@@ -34,6 +34,81 @@ 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 d50cb91eed..82109fda90 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -6,6 +6,8 @@
$Date$
modified at: Mon Jan 24 15:59:52 JST 1994
+ Documentation by Peter Adolphs < futzilogik at users dot sourceforge dot net >
+
************************************************/
#include "ruby.h"
@@ -14,6 +16,62 @@
#include <fcntl.h>
#include <errno.h>
+/*
+ * Document-class: GDBM
+ *
+ * == Summary
+ *
+ * Ruby extension for GNU dbm (gdbm) -- a simple database engine for storing
+ * key-value pairs on disk.
+ *
+ * == Description
+ *
+ * GNU dbm is a library for simple databases. A database is a file that stores
+ * key-value pairs. Gdbm allows the user to store, retrieve, and delete data by
+ * key. It furthermore allows a non-sorted traversal of all key-value pairs.
+ * A gdbm database thus provides the same functionality as a hash. As
+ * with objects of the Hash class, elements can be accessed with <tt>[]</tt>.
+ * Furthermore, GDBM mixes in the Enumerable module, thus providing convenient
+ * methods such as #find, #collect, #map, etc.
+ *
+ * A process is allowed to open several different databases at the same time.
+ * A process can open a database as a "reader" or a "writer". Whereas a reader
+ * has only read-access to the database, a writer has read- and write-access.
+ * A database can be accessed either by any number of readers or by exactly one
+ * writer at the same time.
+ *
+ * == Examples
+ *
+ * 1. Opening/creating a database, and filling it with some entries:
+ *
+ * require 'gdbm'
+ *
+ * gdbm = GDBM.new("fruitstore.db")
+ * gdbm["ananas"] = "3"
+ * gdbm["banana"] = "8"
+ * gdbm["cranberry"] = "4909"
+ * gdbm.close
+ *
+ * 2. Reading out a database:
+ *
+ * require 'gdbm'
+ *
+ * gdbm = GDBM.new("fruitstore.db")
+ * gdbm.each_pair do |key, value|
+ * print "#{key}: #{value}\n"
+ * end
+ * gdbm.close
+ *
+ * produces
+ *
+ * banana: 8
+ * ananas: 3
+ * cranberry: 4909
+ *
+ * == Links
+ *
+ * * http://www.gnu.org/software/gdbm/
+ */
static VALUE rb_cGDBM, rb_eGDBMError, rb_eGDBMFatalError;
#define RUBY_GDBM_RW_BIT 0x20000000
@@ -24,7 +82,7 @@ static void
rb_gdbm_fatal(msg)
char *msg;
{
- rb_raise(rb_eGDBMFatalError, msg);
+ rb_raise(rb_eGDBMFatalError, "%s", msg);
}
struct dbmdata {
@@ -54,11 +112,17 @@ free_dbm(dbmp)
struct dbmdata *dbmp;
{
if (dbmp) {
- if (dbmp->di_dbm) gdbm_close(dbmp->di_dbm);
- free(dbmp);
+ if (dbmp->di_dbm) gdbm_close(dbmp->di_dbm);
+ free(dbmp);
}
}
+/*
+ * call-seq:
+ * gdbm.close -> nil
+ *
+ * Closes the associated database file.
+ */
static VALUE
fgdbm_close(obj)
VALUE obj;
@@ -72,6 +136,12 @@ fgdbm_close(obj)
return Qnil;
}
+/*
+ * call-seq:
+ * gdbm.closed? -> true or false
+ *
+ * Returns true if the associated database file has been closed.
+ */
static VALUE
fgdbm_closed(obj)
VALUE obj;
@@ -80,9 +150,9 @@ fgdbm_closed(obj)
Data_Get_Struct(obj, struct dbmdata, dbmp);
if (dbmp == 0)
- return Qtrue;
+ return Qtrue;
if (dbmp->di_dbm == 0)
- return Qtrue;
+ return Qtrue;
return Qfalse;
}
@@ -96,6 +166,29 @@ fgdbm_s_alloc(klass)
return Data_Wrap_Struct(klass, 0, free_dbm, 0);
}
+/*
+ * call-seq:
+ * GDBM.new(filename, mode = 0666, flags = nil)
+ *
+ * Creates a new GDBM instance by opening a gdbm file named _filename_.
+ * If the file does not exist, a new file with file mode _mode_ will be
+ * created. _flags_ may be one of the following:
+ * * *READER* - open as a reader
+ * * *WRITER* - open as a writer
+ * * *WRCREAT* - open as a writer; if the database does not exist, create a new one
+ * * *NEWDB* - open as a writer; overwrite any existing databases
+ *
+ * The values *WRITER*, *WRCREAT* and *NEWDB* may be combined with the following
+ * values by bitwise or:
+ * * *SYNC* - cause all database operations to be synchronized to the disk
+ * * *NOLOCK* - do not lock the database file
+ *
+ * If no _flags_ are specified, the GDBM object will try to open the database
+ * file as a writer and will create it if it does not already exist
+ * (cf. flag <tt>WRCREAT</tt>). If this fails (for instance, if another process
+ * has already opened the database as a reader), it will try to open the
+ * database file as a reader (cf. flag <tt>READER</tt>).
+ */
static VALUE
fgdbm_initialize(argc, argv, obj)
int argc;
@@ -108,13 +201,13 @@ fgdbm_initialize(argc, argv, obj)
int mode, flags = 0;
if (rb_scan_args(argc, argv, "12", &file, &vmode, &vflags) == 1) {
- mode = 0666; /* default value */
+ mode = 0666; /* default value */
}
else if (NIL_P(vmode)) {
- mode = -1; /* return nil if DB not exist */
+ mode = -1; /* return nil if DB does not exist */
}
else {
- mode = NUM2INT(vmode);
+ mode = NUM2INT(vmode);
}
if (!NIL_P(vflags))
@@ -160,6 +253,25 @@ fgdbm_initialize(argc, argv, obj)
return obj;
}
+/*
+ * call-seq:
+ * GDBM.open(filename, mode = 0666, flags = nil)
+ * GDBM.open(filename, mode = 0666, flags = nil) { |gdbm| ... }
+ *
+ * If called without a block, this is synonymous to GDBM::new.
+ * If a block is given, the new GDBM instance will be passed to the block
+ * as a parameter, and the corresponding database file will be closed
+ * after the execution of the block code has been finished.
+ *
+ * Example for an open call with a block:
+ *
+ * require 'gdbm'
+ * GDBM.open("fruitstore.db") do |gdbm|
+ * gdbm.each_pair do |key, value|
+ * print "#{key}: #{value}\n"
+ * end
+ * end
+ */
static VALUE
fgdbm_s_open(argc, argv, klass)
int argc;
@@ -286,6 +398,12 @@ fgdbm_fetch(obj, keystr, ifnone)
return valstr;
}
+/*
+ * call-seq:
+ * gdbm[key] -> value
+ *
+ * Retrieves the _value_ corresponding to _key_.
+ */
static VALUE
fgdbm_aref(obj, keystr)
VALUE obj, keystr;
@@ -293,6 +411,13 @@ fgdbm_aref(obj, keystr)
return rb_gdbm_fetch3(obj, keystr);
}
+/*
+ * call-seq:
+ * gdbm.fetch(key [, default]) -> value
+ *
+ * Retrieves the _value_ corresponding to _key_. If there is no value
+ * associated with _key_, _default_ will be returned instead.
+ */
static VALUE
fgdbm_fetch_m(argc, argv, obj)
int argc;
@@ -304,11 +429,18 @@ fgdbm_fetch_m(argc, argv, obj)
rb_scan_args(argc, argv, "11", &keystr, &ifnone);
valstr = fgdbm_fetch(obj, keystr, ifnone);
if (argc == 1 && !rb_block_given_p() && NIL_P(valstr))
- rb_raise(rb_eIndexError, "key not found");
+ rb_raise(rb_eIndexError, "key not found");
return valstr;
}
+/*
+ * call-seq:
+ * gdbm.index(value) -> key
+ *
+ * Returns the _key_ for a given _value_. If several keys may map to the
+ * same value, the key that is found first will be returned.
+ */
static VALUE
fgdbm_index(obj, valstr)
VALUE obj, valstr;
@@ -350,6 +482,13 @@ fgdbm_indexes(argc, argv, obj)
return new;
}
+/*
+ * call-seq:
+ * gdbm.select { |value| block } -> array
+ *
+ * Returns a new array of all values of the database for which _block_
+ * evaluates to true.
+ */
static VALUE
fgdbm_select(argc, argv, obj)
int argc;
@@ -390,6 +529,12 @@ fgdbm_select(argc, argv, obj)
return new;
}
+/*
+ * call-seq:
+ * gdbm.values_at(key, ...) -> array
+ *
+ * Returns an array of the values associated with each specified _key_.
+ */
static VALUE
fgdbm_values_at(argc, argv, obj)
int argc;
@@ -429,19 +574,26 @@ rb_gdbm_delete(obj, keystr)
GetDBM2(obj, dbmp, dbm);
if (!gdbm_exists(dbm, key)) {
- return Qnil;
+ return Qnil;
}
if (gdbm_delete(dbm, key)) {
- dbmp->di_size = -1;
- rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ dbmp->di_size = -1;
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
else if (dbmp->di_size >= 0) {
- dbmp->di_size--;
+ dbmp->di_size--;
}
return obj;
}
+/*
+ * call-seq:
+ * gdbm.delete(key) -> value or nil
+ *
+ * Removes the key-value-pair with the specified _key_ from this database and
+ * returns the corresponding _value_. Returns nil if the database is empty.
+ */
static VALUE
fgdbm_delete(obj, keystr)
VALUE obj, keystr;
@@ -453,6 +605,13 @@ fgdbm_delete(obj, keystr)
return valstr;
}
+/*
+ * call-seq:
+ * gdbm.shift -> (key, value) or nil
+ *
+ * Removes a key-value-pair from this database and returns it as a
+ * two-item array [ _key_, _value_ ]. Returns nil if the database is empty.
+ */
static VALUE
fgdbm_shift(obj)
VALUE obj;
@@ -471,6 +630,13 @@ fgdbm_shift(obj)
return rb_assoc_new(keystr, valstr);
}
+/*
+ * call-seq:
+ * gdbm.delete_if { |key, value| block } -> gdbm
+ * gdbm.reject! { |key, value| block } -> gdbm
+ *
+ * Deletes every key-value pair from _gdbm_ for which _block_ evaluates to true.
+ */
static VALUE
fgdbm_delete_if(obj)
VALUE obj;
@@ -489,11 +655,11 @@ fgdbm_delete_if(obj)
for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
keystr = rb_gdbm_nextkey(dbm, keystr)) {
- valstr = rb_gdbm_fetch2(dbm, keystr);
+ valstr = rb_gdbm_fetch2(dbm, keystr);
ret = rb_protect(rb_yield, rb_assoc_new(keystr, valstr), &status);
if (status != 0) break;
- if (RTEST(ret)) rb_ary_push(ary, keystr);
- GetDBM2(obj, dbmp, dbm);
+ if (RTEST(ret)) rb_ary_push(ary, keystr);
+ GetDBM2(obj, dbmp, dbm);
}
for (i = 0; i < RARRAY(ary)->len; i++)
@@ -504,6 +670,12 @@ fgdbm_delete_if(obj)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.clear -> gdbm
+ *
+ * Removes all the key-value pairs within _gdbm_.
+ */
static VALUE
fgdbm_clear(obj)
VALUE obj;
@@ -518,11 +690,11 @@ fgdbm_clear(obj)
#if 0
while (key = gdbm_firstkey(dbm), key.dptr) {
- if (gdbm_delete(dbm, key)) {
- free(key.dptr);
- rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
- }
- free(key.dptr);
+ if (gdbm_delete(dbm, key)) {
+ free(key.dptr);
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ free(key.dptr);
}
#else
while (key = gdbm_firstkey(dbm), key.dptr) {
@@ -542,6 +714,13 @@ fgdbm_clear(obj)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.invert -> hash
+ *
+ * Returns a hash created by using _gdbm_'s values as keys, and the keys
+ * as values.
+ */
static VALUE
fgdbm_invert(obj)
VALUE obj;
@@ -584,6 +763,14 @@ update_i(pair, dbm)
return Qnil;
}
+/*
+ * call-seq:
+ * gdbm.update(other) -> gdbm
+ *
+ * Adds the key-value pairs of _other_ to _gdbm_, overwriting entries with
+ * duplicate keys with those from _other_. _other_ must have an each_pair
+ * method.
+ */
static VALUE
fgdbm_update(obj, other)
VALUE obj, other;
@@ -592,6 +779,13 @@ fgdbm_update(obj, other)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.replace(other) -> gdbm
+ *
+ * Replaces the content of _gdbm_ with the key-value pairs of _other_.
+ * _other_ must have an each_pair method.
+ */
static VALUE
fgdbm_replace(obj, other)
VALUE obj, other;
@@ -601,6 +795,13 @@ fgdbm_replace(obj, other)
return obj;
}
+/*
+ * call-seq:
+ * gdbm[key]= value -> value
+ * gdbm.store(key, value) -> value
+ *
+ * Associates the value _value_ with the specified _key_.
+ */
static VALUE
fgdbm_store(obj, keystr, valstr)
VALUE obj, keystr, valstr;
@@ -622,13 +823,20 @@ fgdbm_store(obj, keystr, valstr)
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
if (gdbm_store(dbm, key, val, GDBM_REPLACE)) {
- if (errno == EPERM) rb_sys_fail(0);
- rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ if (errno == EPERM) rb_sys_fail(0);
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
return valstr;
}
+/*
+ * call-seq:
+ * gdbm.length -> fixnum
+ * gdbm.size -> fixnum
+ *
+ * Returns the number of key-value pairs in this database.
+ */
static VALUE
fgdbm_length(obj)
VALUE obj;
@@ -651,6 +859,12 @@ fgdbm_length(obj)
return INT2FIX(i);
}
+/*
+ * call-seq:
+ * gdbm.empty? -> true or false
+ *
+ * Returns true if the database is empty.
+ */
static VALUE
fgdbm_empty_p(obj)
VALUE obj;
@@ -675,6 +889,13 @@ fgdbm_empty_p(obj)
return Qfalse;
}
+/*
+ * call-seq:
+ * gdbm.each_value { |value| block } -> gdbm
+ *
+ * Executes _block_ for each key in the database, passing the corresponding
+ * _value_ as a parameter.
+ */
static VALUE
fgdbm_each_value(obj)
VALUE obj;
@@ -693,6 +914,13 @@ fgdbm_each_value(obj)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.each_key { |key| block } -> gdbm
+ *
+ * Executes _block_ for each key in the database, passing the
+ * _key_ as a parameter.
+ */
static VALUE
fgdbm_each_key(obj)
VALUE obj;
@@ -711,6 +939,13 @@ fgdbm_each_key(obj)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.each_pair { |key, value| block } -> gdbm
+ *
+ * Executes _block_ for each key in the database, passing the _key_ and the
+ * correspoding _value_ as a parameter.
+ */
static VALUE
fgdbm_each_pair(obj)
VALUE obj;
@@ -724,12 +959,18 @@ fgdbm_each_pair(obj)
keystr = rb_gdbm_nextkey(dbm, keystr)) {
rb_yield(rb_assoc_new(keystr, rb_gdbm_fetch2(dbm, keystr)));
- GetDBM2(obj, dbmp, dbm);
+ GetDBM2(obj, dbmp, dbm);
}
return obj;
}
+/*
+ * call-seq:
+ * gdbm.keys -> array
+ *
+ * Returns an array of all keys of this database.
+ */
static VALUE
fgdbm_keys(obj)
VALUE obj;
@@ -749,6 +990,12 @@ fgdbm_keys(obj)
return ary;
}
+/*
+ * call-seq:
+ * gdbm.values -> array
+ *
+ * Returns an array of all values of this database.
+ */
static VALUE
fgdbm_values(obj)
VALUE obj;
@@ -762,14 +1009,22 @@ fgdbm_values(obj)
ary = rb_ary_new();
for (key = gdbm_firstkey(dbm); key.dptr; key = nextkey) {
nextkey = gdbm_nextkey(dbm, key);
- valstr = rb_gdbm_fetch(dbm, key);
+ valstr = rb_gdbm_fetch(dbm, key);
free(key.dptr);
- rb_ary_push(ary, valstr);
+ rb_ary_push(ary, valstr);
}
return ary;
}
+/*
+ * call-seq:
+ * gdbm.has_key?(k) -> true or false
+ * gdbm.key?(k) -> true or false
+ *
+ * Returns true if the given key _k_ exists within the database.
+ * Returns false otherwise.
+ */
static VALUE
fgdbm_has_key(obj, keystr)
VALUE obj, keystr;
@@ -788,6 +1043,14 @@ fgdbm_has_key(obj, keystr)
return Qfalse;
}
+/*
+ * call-seq:
+ * gdbm.has_value?(v) -> true or false
+ * gdbm.value?(v) -> true or false
+ *
+ * Returns true if the given value _v_ exists within the database.
+ * Returns false otherwise.
+ */
static VALUE
fgdbm_has_value(obj, valstr)
VALUE obj, valstr;
@@ -813,6 +1076,12 @@ fgdbm_has_value(obj, valstr)
return Qfalse;
}
+/*
+ * call-seq:
+ * gdbm.to_a -> array
+ *
+ * Returns an array of all key-value pairs contained in the database.
+ */
static VALUE
fgdbm_to_a(obj)
VALUE obj;
@@ -832,6 +1101,14 @@ fgdbm_to_a(obj)
return ary;
}
+/*
+ * call-seq:
+ * gdbm.reorganize -> gdbm
+ *
+ * Reorganizes the database file. This operation removes reserved space of
+ * elements that have already been deleted. It is only useful after a lot of
+ * deletions in the database.
+ */
static VALUE
fgdbm_reorganize(obj)
VALUE obj;
@@ -845,6 +1122,16 @@ fgdbm_reorganize(obj)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.sync -> gdbm
+ *
+ * Unless the _gdbm_ object has been opened with the *SYNC* flag, it is not
+ * guarenteed that database modification operations are immediately applied to
+ * the database file. This method ensures that all recent modifications
+ * to the database are written to the file. Blocks until all writing operations
+ * to the disk have been finished.
+ */
static VALUE
fgdbm_sync(obj)
VALUE obj;
@@ -858,6 +1145,12 @@ fgdbm_sync(obj)
return obj;
}
+/*
+ * call-seq:
+ * gdbm.cachesize = size -> size
+ *
+ * Sets the size of the internal bucket cache to _size_.
+ */
static VALUE
fgdbm_set_cachesize(obj, val)
VALUE obj, val;
@@ -869,11 +1162,21 @@ fgdbm_set_cachesize(obj, val)
GetDBM2(obj, dbmp, dbm);
optval = FIX2INT(val);
if (gdbm_setopt(dbm, GDBM_CACHESIZE, &optval, sizeof(optval)) == -1) {
- rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
return val;
}
+/*
+ * call-seq:
+ * gdbm.fastmode = boolean -> boolean
+ *
+ * Turns the database's fast mode on or off. If fast mode is turned on, gdbm
+ * does not wait for writes to be flushed to the disk before continuing.
+ *
+ * This option is obsolete for gdbm >= 1.8 since fast mode is turned on by
+ * default. See also: #syncmode=
+ */
static VALUE
fgdbm_set_fastmode(obj, val)
VALUE obj, val;
@@ -888,11 +1191,24 @@ fgdbm_set_fastmode(obj, val)
optval = 1;
if (gdbm_setopt(dbm, GDBM_FASTMODE, &optval, sizeof(optval)) == -1) {
- rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
return val;
}
+/*
+ * call-seq:
+ * gdbm.syncmode = boolean -> boolean
+ *
+ * Turns the database's synchronization mode on or off. If the synchronization
+ * mode is turned on, the database's in-memory state will be synchronized to
+ * disk after every database modification operation. If the synchronization
+ * mode is turned off, GDBM does not wait for writes to be flushed to the disk
+ * before continuing.
+ *
+ * This option is only available for gdbm >= 1.8 where syncmode is turned off
+ * by default. See also: #fastmode=
+ */
static VALUE
fgdbm_set_syncmode(obj, val)
VALUE obj, val;
@@ -911,12 +1227,18 @@ fgdbm_set_syncmode(obj, val)
optval = 1;
if (gdbm_setopt(dbm, GDBM_FASTMODE, &optval, sizeof(optval)) == -1) {
- rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
return val;
#endif
}
+/*
+ * call-seq:
+ * gdbm.to_hash -> hash
+ *
+ * Returns a hash of all key-value pairs contained in the database.
+ */
static VALUE
fgdbm_to_hash(obj)
VALUE obj;
@@ -936,6 +1258,13 @@ fgdbm_to_hash(obj)
return hash;
}
+/*
+ * call-seq:
+ * gdbm.reject { |key, value| block } -> hash
+ *
+ * Returns a hash copy of _gdbm_ where all key-value pairs from _gdbm_ for
+ * which _block_ evaluates to true are removed. See also: #delete_if
+ */
static VALUE
fgdbm_reject(obj)
VALUE obj;
@@ -981,15 +1310,15 @@ Init_gdbm()
rb_define_method(rb_cGDBM, "reject!", fgdbm_delete_if, 0);
rb_define_method(rb_cGDBM, "reject", fgdbm_reject, 0);
rb_define_method(rb_cGDBM, "clear", fgdbm_clear, 0);
- rb_define_method(rb_cGDBM,"invert", fgdbm_invert, 0);
- rb_define_method(rb_cGDBM,"update", fgdbm_update, 1);
- rb_define_method(rb_cGDBM,"replace", fgdbm_replace, 1);
- rb_define_method(rb_cGDBM,"reorganize", fgdbm_reorganize, 0);
- rb_define_method(rb_cGDBM,"sync", fgdbm_sync, 0);
- /* rb_define_method(rb_cGDBM,"setopt", fgdbm_setopt, 2); */
- rb_define_method(rb_cGDBM,"cachesize=", fgdbm_set_cachesize, 1);
- rb_define_method(rb_cGDBM,"fastmode=", fgdbm_set_fastmode, 1);
- rb_define_method(rb_cGDBM,"syncmode=", fgdbm_set_syncmode, 1);
+ rb_define_method(rb_cGDBM, "invert", fgdbm_invert, 0);
+ rb_define_method(rb_cGDBM, "update", fgdbm_update, 1);
+ rb_define_method(rb_cGDBM, "replace", fgdbm_replace, 1);
+ rb_define_method(rb_cGDBM, "reorganize", fgdbm_reorganize, 0);
+ rb_define_method(rb_cGDBM, "sync", fgdbm_sync, 0);
+ /* rb_define_method(rb_cGDBM, "setopt", fgdbm_setopt, 2); */
+ rb_define_method(rb_cGDBM, "cachesize=", fgdbm_set_cachesize, 1);
+ rb_define_method(rb_cGDBM, "fastmode=", fgdbm_set_fastmode, 1);
+ rb_define_method(rb_cGDBM, "syncmode=", fgdbm_set_syncmode, 1);
rb_define_method(rb_cGDBM, "include?", fgdbm_has_key, 1);
rb_define_method(rb_cGDBM, "has_key?", fgdbm_has_key, 1);
@@ -1001,22 +1330,29 @@ Init_gdbm()
rb_define_method(rb_cGDBM, "to_a", fgdbm_to_a, 0);
rb_define_method(rb_cGDBM, "to_hash", fgdbm_to_hash, 0);
- /* flags for gdbm_open() */
+ /* flag for #new and #open: open database as a reader */
rb_define_const(rb_cGDBM, "READER", INT2FIX(GDBM_READER|RUBY_GDBM_RW_BIT));
+ /* flag for #new and #open: open database as a writer */
rb_define_const(rb_cGDBM, "WRITER", INT2FIX(GDBM_WRITER|RUBY_GDBM_RW_BIT));
+ /* flag for #new and #open: open database as a writer; if the database does not exist, create a new one */
rb_define_const(rb_cGDBM, "WRCREAT", INT2FIX(GDBM_WRCREAT|RUBY_GDBM_RW_BIT));
+ /* flag for #new and #open: open database as a writer; overwrite any existing databases */
rb_define_const(rb_cGDBM, "NEWDB", INT2FIX(GDBM_NEWDB|RUBY_GDBM_RW_BIT));
+ /* flag for #new and #open. this flag is obsolete for gdbm >= 1.8 */
rb_define_const(rb_cGDBM, "FAST", INT2FIX(GDBM_FAST));
/* this flag is obsolete in gdbm 1.8.
On gdbm 1.8, fast mode is default behavior. */
/* gdbm version 1.8 specific */
#if defined(GDBM_SYNC)
+ /* flag for #new and #open. only for gdbm >= 1.8 */
rb_define_const(rb_cGDBM, "SYNC", INT2FIX(GDBM_SYNC));
#endif
#if defined(GDBM_NOLOCK)
+ /* flag for #new and #open */
rb_define_const(rb_cGDBM, "NOLOCK", INT2FIX(GDBM_NOLOCK));
#endif
+ /* version of the gdbm library*/
rb_define_const(rb_cGDBM, "VERSION", rb_str_new2(gdbm_version));
}
diff --git a/ext/iconv/charset_alias.rb b/ext/iconv/charset_alias.rb
index 65fd41759b..aed4644290 100644
--- a/ext/iconv/charset_alias.rb
+++ b/ext/iconv/charset_alias.rb
@@ -1,11 +1,12 @@
#! /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 = Config::CONFIG["target_os"]
SHELL = Config::CONFIG['SHELL']
class Hash::Ordered < Hash
@@ -14,39 +15,89 @@ class Hash::Ordered < Hash
end
def []=(key, val)
ary = fetch(key) {return super(key, [self.size, key, val])} and
- ary.last = val
+ ary << val
end
- def each
- values.sort.each {|i, key, val| yield key, val}
+ def sort
+ values.sort.collect {|i, *rest| rest}
+ end
+ def each(&block)
+ sort.each(&block)
end
end
def charset_alias(config_charset, mapfile, target = OS)
map = Hash::Ordered.new
comments = []
- 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
+ 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
end
case target
when /linux|-gnu/
- map.delete('ascii')
- when /cygwin/
+ # map.delete('ascii')
+ when /cygwin|os2-emx/
# get rid of tilde/yen problem.
map['shift_jis'] = 'cp932'
end
- open(mapfile, "w") do |f|
+ 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|
f.puts("require 'iconv.so'")
f.puts
f.puts(comments)
f.puts("class Iconv")
- map.each {|can, sys| f.puts(" charset_map['#{can}'.freeze] = '#{sys}'.freeze")}
+ 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
f.puts("end")
end
+ if mapfile
+ open(mapfile, "w", &writer)
+ else
+ writer[STDOUT]
+ end
end
-(2..3) === ARGV.size or abort "usage: #$0 config.status map.rb [target]"
-charset_alias(*ARGV)
+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)
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb
index 62adb7a6b6..a9d0cfb5e6 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") {|s| s.sub(/(?=\n\/\*top\*\/)/, "#include <iconv.h>")}
+ have_library("iconv", "iconv", "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}
@@ -26,13 +26,17 @@ if have_func("iconv", "iconv.h") or
if conf
prefix = '$(srcdir)'
prefix = $nmake ? "{#{prefix}}" : "#{prefix}/"
- wrapper = "./iconv.rb"
- $INSTALLFILES = [[wrapper, "$(RUBYARCHDIR)"]]
+ if $extout
+ wrapper = "$(RUBYARCHDIR)/iconv.rb"
+ else
+ wrapper = "./iconv.rb"
+ $INSTALLFILES = [[wrapper, "$(RUBYARCHDIR)"]]
+ end
if String === conf
require 'uri'
scheme = URI.parse(conf).scheme
else
- conf = prefix + "config.charset"
+ conf = "$(srcdir)/config.charset"
end
$cleanfiles << wrapper
end
@@ -41,7 +45,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) ", prefix, "charset_alias.rb ", conf, " $@\n")
+ mf.print("\n\t$(RUBY) $(srcdir)/charset_alias.rb #{conf} $@\n")
end
end
end
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 5715b8fbde..d989b97df2 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -43,7 +43,11 @@
*
* == Examples
*
- * 1. Instantiate a new Iconv and use method Iconv#iconv.
+ * 1. Simple conversion between two charsets.
+ *
+ * converted_text = Iconv.conv('iso-8859-15', 'utf-8', text)
+ *
+ * 2. Instantiate a new Iconv and use method Iconv#iconv.
*
* cd = Iconv.new(to, from)
* begin
@@ -53,20 +57,16 @@
* cd.close
* end
*
- * 2. Invoke Iconv.open with a block.
+ * 3. Invoke Iconv.open with a block.
*
* Iconv.open(to, from) do |cd|
* input.each { |s| output << cd.iconv(s) }
* output << cd.iconv(nil)
* end
*
- * 3. Shorthand for (2).
+ * 4. Shorthand for (3).
*
* Iconv.iconv(to, from, *input.to_a)
- *
- * 4. Simple conversion between two charsets.
- *
- * converted_text = Iconv.new('iso-8859-15', 'utf-8').iconv(text)
*/
/* Invalid value for iconv_t is -1 but 0 for VALUE, I hope VALUE is
@@ -88,6 +88,7 @@ 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));
@@ -100,7 +101,7 @@ static void iconv_dfree _((void *cd));
static VALUE iconv_free _((VALUE cd));
static VALUE iconv_try _((iconv_t cd, const char **inptr, size_t *inlen, char **outptr, size_t *outlen));
static VALUE rb_str_derive _((VALUE str, const char* ptr, int len));
-static VALUE iconv_convert _((iconv_t cd, VALUE str, int start, int length, struct iconv_env_t* env));
+static VALUE iconv_convert _((iconv_t cd, VALUE str, long start, long length, struct iconv_env_t* env));
static VALUE iconv_s_allocate _((VALUE klass));
static VALUE iconv_initialize _((VALUE self, VALUE to, VALUE from));
static VALUE iconv_s_open _((VALUE self, VALUE to, VALUE from));
@@ -169,7 +170,7 @@ iconv_create
}
if (cd == (iconv_t)-1) {
int inval = errno == EINVAL;
- char *s = inval ? "invalid encoding " : "iconv";
+ const char *s = inval ? "invalid encoding " : "iconv";
volatile VALUE msg = rb_str_new(0, strlen(s) + RSTRING(to)->len +
RSTRING(from)->len + 8);
@@ -248,7 +249,10 @@ iconv_try
#else
#define ICONV_INPTR_CAST (char **)
#endif
- size_t ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
+ size_t ret;
+
+ errno = 0;
+ ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
if (ret == (size_t)-1) {
if (!*inlen)
return Qfalse;
@@ -260,6 +264,8 @@ iconv_try
return rb_eIconvIllegalSeq;
case EINVAL:
return rb_eIconvInvalidChar;
+ case 0:
+ return rb_eIconvBrokenLibrary;
default:
rb_sys_fail("iconv");
}
@@ -356,13 +362,13 @@ rb_str_derive
static VALUE
iconv_convert
#ifdef HAVE_PROTOTYPES
- (iconv_t cd, VALUE str, int start, int length, struct iconv_env_t* env)
+ (iconv_t cd, VALUE str, long start, long length, struct iconv_env_t* env)
#else /* HAVE_PROTOTYPES */
(cd, str, start, length, env)
iconv_t cd;
VALUE str;
- int start;
- int length;
+ long start;
+ long length;
struct iconv_env_t *env;
#endif /* HAVE_PROTOTYPES */
{
@@ -411,14 +417,9 @@ iconv_convert
slen = RSTRING(str)->len;
inptr = RSTRING(str)->ptr;
- if (start < 0 ? (start += slen) < 0 : start >= slen)
- length = 0;
- else if (length < 0 && (length += slen + 1) < 0)
- length = 0;
- else if ((length -= start) < 0)
- length = 0;
- else
- inptr += start;
+ inptr += start;
+ if (length < 0 || length > start + slen)
+ length = slen - start;
}
instart = inptr;
inlen = length;
@@ -600,7 +601,7 @@ iconv_s_convert
}
/*
- * Document-method: iconv
+ * Document-method: Iconv::iconv
* call-seq: Iconv.iconv(to, from, *strs)
*
* Shorthand for
@@ -643,7 +644,7 @@ iconv_s_iconv
/*
* Document-method: Iconv::conv
- * call-seq: Iconv.iconv(to, from, *strs)
+ * call-seq: Iconv.conv(to, from, str)
*
* Shorthand for
* Iconv.iconv(to, from, str).join
@@ -709,7 +710,7 @@ iconv_finish
}
/*
- * Document-method: iconv
+ * Document-method: Iconv#iconv
* call-seq: iconv(str, start=0, length=-1)
*
* Converts string and returns the result.
@@ -748,14 +749,22 @@ iconv_iconv
{
VALUE str, n1, n2;
VALUE cd = check_iconv(self);
+ long start = 0, length = 0, slen = 0;
- n1 = n2 = Qnil;
rb_scan_args(argc, argv, "12", &str, &n1, &n2);
+ if (!NIL_P(str)) slen = RSTRING_LEN(StringValue(str));
+ if (argc != 2 || !RTEST(rb_range_beg_len(n1, &start, &length, slen, 0))) {
+ if (NIL_P(n1) || ((start = NUM2LONG(n1)) < 0 ? (start += slen) >= 0 : start < slen)) {
+ if (NIL_P(n2)) {
+ length = -1;
+ }
+ else if ((length = NUM2LONG(n2)) >= slen - start) {
+ length = slen - start;
+ }
+ }
+ }
- return iconv_convert(VALUE2ICONV(cd), str,
- NIL_P(n1) ? 0 : NUM2INT(n1),
- NIL_P(n2) ? -1 : NUM2INT(n2),
- NULL);
+ return iconv_convert(VALUE2ICONV(cd), str, start, length, NULL);
}
/*
@@ -819,7 +828,7 @@ iconv_failure_inspect
VALUE self;
#endif /* HAVE_PROTOTYPES */
{
- char *cname = rb_class2name(CLASS_OF(self));
+ const char *cname = rb_class2name(CLASS_OF(self));
VALUE success = rb_attr_get(self, rb_success);
VALUE failed = rb_attr_get(self, rb_failed);
VALUE str = rb_str_buf_cat2(rb_str_new2("#<"), cname);
@@ -857,6 +866,13 @@ iconv_failure_inspect
* 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
+ */
+
void
Init_iconv _((void))
{
@@ -880,16 +896,18 @@ Init_iconv _((void))
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");
- charset_map = rb_hash_new();
rb_gc_register_address(&charset_map);
+ charset_map = rb_hash_new();
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..e8181d25f5 100644
--- a/ext/io/wait/extconf.rb
+++ b/ext/io/wait/extconf.rb
@@ -3,7 +3,7 @@ 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)}
+ have_macro("FIONREAD", h)
end
if fionread
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
diff --git a/ext/io/wait/lib/nonblock.rb b/ext/io/wait/lib/nonblock.rb
index 46511fb40c..2103fdf25b 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
+end if defined?(Fcntl::F_GETFL)
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index 61d6527b36..02cb54a014 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -56,7 +56,7 @@ static VALUE
io_ready_p(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *fp;
ioctl_arg n;
@@ -84,7 +84,7 @@ io_wait(argc, argv, io)
VALUE *argv;
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
fd_set rd;
FILE *fp;
int fd;
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index 3512135ecc..4ffe8d984e 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -1,82 +1,73 @@
+#
+# kconv.rb - Kanji Converter.
+#
+# $Id$
+#
+# ----
+#
+# 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 = ::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
+
+ # 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$
#Regexp of Encoding
- 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
+
+ # Regexp of Shift_JIS string (private constant)
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-\xfe] [\xa1-\xfe] |
+ [\xa1-\xfe] [\xa1-\xfe]
)*\z/nx
+
+ # Regexp of UTF-8 string (private constant)
RegexpUtf8 = /\A(?:
[\x00-\x7f] |
[\xc2-\xdf] [\x80-\xbf] |
@@ -88,9 +79,19 @@ module Kconv
)*\z/nx
#
- # kconv
+ # Public Methods
#
+ # 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
@@ -131,28 +132,73 @@ 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('-j', str)
+ ::NKF::nkf('-jm', 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('-e', str)
+ ::NKF::nkf('-em', 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('-s', str)
+ ::NKF::nkf('-sm', 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('-w', str)
+ ::NKF::nkf('-wm', 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('-w16', str)
+ ::NKF::nkf('-w16m', str)
end
module_function :toutf16
@@ -160,11 +206,19 @@ 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)
end
@@ -174,16 +228,34 @@ 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
@@ -192,37 +264,104 @@ 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
- def iseuc
- Kconv.iseuc( self )
- end
+ #
- def issjis
- Kconv.issjis( self )
- end
+ # 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 isutf8
- Kconv.isutf8( 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
+
+ # 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
end
diff --git a/ext/nkf/nkf-utf8/config.h b/ext/nkf/nkf-utf8/config.h
index 0f202baafd..9da82c6aee 100644
--- a/ext/nkf/nkf-utf8/config.h
+++ b/ext/nkf/nkf-utf8/config.h
@@ -24,6 +24,9 @@
/* --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
@@ -40,6 +43,19 @@
*/
/* #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 */
@@ -48,5 +64,25 @@
/* #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 2973799fb2..3cd1b160da 100644
--- a/ext/nkf/nkf-utf8/nkf.c
+++ b/ext/nkf/nkf-utf8/nkf.c
@@ -40,12 +40,14 @@
** $B$^$G8fO"Mm$r$*4j$$$7$^$9!#(B
***********************************************************************/
/* $Id$ */
-#define NKF_VERSION "2.0.5"
-#define NKF_RELEASE_DATE "2005-04-10"
+#define NKF_VERSION "2.0.8"
+#define NKF_RELEASE_DATE "2007-01-28"
#include "config.h"
+#include "utf8tbl.h"
-static char *CopyRight =
- "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW, 2002-2005 Kono, Furukawa, Naruse";
+#define COPY_RIGHT \
+ "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW\n" \
+ "Copyright (C) 2002-2006 Kono, Furukawa, Naruse, mastodon"
/*
@@ -60,7 +62,7 @@ static char *CopyRight =
**
** t no operation
**
-** j Outout code is JIS 7 bit (DEFAULT SELECT)
+** j Output code is JIS 7 bit (DEFAULT SELECT)
** s Output code is MS Kanji (DEFAULT SELECT)
** e Output code is AT&T JIS (DEFAULT SELECT)
** w Output code is AT&T JIS (DEFAULT SELECT)
@@ -95,7 +97,7 @@ static char *CopyRight =
**
**/
-#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__)) && !defined(MSDOS)
+#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS)
#define MSDOS
#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
#define __WIN32__
@@ -111,22 +113,40 @@ static char *CopyRight =
#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,OS/2 */
+#else /* UNIX */
#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 */
@@ -144,11 +164,17 @@ static char *CopyRight =
#ifdef OVERWRITE
/* added by satoru@isoternet.org */
-#include <string.h>
+#if defined(__EMX__)
+#include <sys/types.h>
+#endif
#include <sys/stat.h>
-#ifndef MSDOS /* UNIX, OS/2 */
+#if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */
#include <unistd.h>
+#if defined(__WATCOMC__)
+#include <sys/utime.h>
+#else
#include <utime.h>
+#endif
#else /* defined(MSDOS) */
#ifdef __WIN32__
#ifdef __BORLANDC__ /* BCC32 */
@@ -157,7 +183,7 @@ static char *CopyRight =
#include <sys/utime.h>
#endif /* (__BORLANDC__) */
#else /* !defined(__WIN32__) */
-#if defined(_MSC_VER) || defined(__MINGW32__) /* VC++, MinGW */
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__) /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */
#include <sys/utime.h>
#elif defined(__TURBOC__) /* BCC */
#include <utime.h>
@@ -165,10 +191,6 @@ static char *CopyRight =
#endif /* (__WIN32__) */
#endif
#endif
-#endif
-
-#ifdef INT_IS_SHORT
-#define int long
#endif
#define FALSE 0
@@ -190,11 +212,14 @@ static char *CopyRight =
#define X0201 2
#define ISO8859_1 8
#define NO_X0201 3
-#define X0212 16
+#define X0212 0x2844
+#define X0213_1 0x284F
+#define X0213_2 0x2850
/* Input Assumption */
#define JIS_INPUT 4
+#define EUC_INPUT 16
#define SJIS_INPUT 5
#define LATIN1_INPUT 6
#define FIXED_MIME 7
@@ -208,8 +233,15 @@ static char *CopyRight =
#define UTF8 12
#define UTF8_INPUT 13
-#define UTF16BE_INPUT 14
-#define UTF16LE_INPUT 15
+#define UTF16_INPUT 1015
+#define UTF32_INPUT 1017
+
+/* byte order */
+
+#define ENDIAN_BIG 1234
+#define ENDIAN_LITTLE 4321
+#define ENDIAN_2143 2143
+#define ENDIAN_3412 3412
#define WISH_TRUE 15
@@ -232,8 +264,34 @@ static char *CopyRight =
#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'
@@ -246,117 +304,151 @@ static char *CopyRight =
#define GETA2 0x2e
-#if defined( UTF8_OUTPUT_ENABLE ) || defined( UTF8_INPUT_ENABLE )
-#define sizeof_euc_utf8 94
+#if defined(UTF8_OUTPUT_ENABLE) || defined(UTF8_INPUT_ENABLE)
#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 112
+#define sizeof_utf8_to_euc_3bytes 16
#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;
- 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));
+ 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 _file_stat;
};
-STATIC char *input_codename = "";
+static char *input_codename = "";
-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)(int c2,int c1,int c0)));
-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));
+#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
#ifdef UTF8_INPUT_ENABLE
-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));
+/* 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 no_best_fit_chars_f = FALSE;
+static int input_endian = ENDIAN_BIG;
+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 w_iconv32(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 void w_status(struct input_code *, nkf_char);
#endif
#ifdef UTF8_OUTPUT_ENABLE
-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 int 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_prechar PROTO((int c2, int c1));
-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));
+static int output_bom_f = FALSE;
+static int output_endian = ENDIAN_BIG;
+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);
+static void w_oconv32(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 PROTO(());
+static void reinit(void);
#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;
+static int hold_count = 0;
/* MIME preprocessor fifo */
@@ -367,6 +459,7 @@ 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;
@@ -389,49 +482,63 @@ 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
-#define CLASS_MASK 0x0f000000
-#define CLASS_UTF16 0x01000000
+#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);
#endif
#ifdef INPUT_OPTION
static int cap_f = FALSE;
-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 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 url_f = FALSE;
-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));
+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
+
+#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_UNICODE 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_UNICODE)
+#define is_unicode_bmp(c) ((c & VALUE_MASK) <= NKF_INT32_C(0xFFFF))
+#ifdef NUMCHAR_OPTION
static int numchar_f = FALSE;
-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));
+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);
#endif
#ifdef CHECK_OPTION
static int noout_f = FALSE;
-STATIC void no_putc PROTO((int c));
-static int debug_f = FALSE;
-STATIC void debug PROTO((char *str));
+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;
#endif
static int guess_f = FALSE;
-STATIC void print_guessed_code PROTO((char *filename));
-STATIC void set_input_codename PROTO((char *codename));
+#if !defined PERL_XS
+static void print_guessed_code(char *filename);
+#endif
+static void set_input_codename(char *codename);
static int is_inputcode_mixed = FALSE;
static int is_inputcode_set = FALSE;
@@ -440,39 +547,43 @@ static int exec_f = 0;
#endif
#ifdef SHIFTJIS_CP932
-STATIC int cp932_f = TRUE;
-#define CP932_TABLE_BEGIN (0xfa)
-#define CP932_TABLE_END (0xfc)
+/* invert IBM extended characters to others */
+static int cp51932_f = FALSE;
-STATIC int cp932inv_f = TRUE;
-#define CP932INV_TABLE_BEGIN (0xed)
-#define CP932INV_TABLE_END (0xee)
+/* invert NEC-selected IBM extended characters to IBM extended characters */
+static int cp932inv_f = TRUE;
-/* STATIC int cp932_conv PROTO((int c2, int c1)); */
+/* static nkf_char cp932_conv(nkf_char c2, nkf_char c1); */
#endif /* SHIFTJIS_CP932 */
#ifdef X0212_ENABLE
-STATIC int x0212_f = FALSE;
-static int x0212_shift PROTO((int c));
-static int x0212_unshift PROTO((int c));
+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 e_status PROTO((struct input_code *, int));
-STATIC void s_status PROTO((struct input_code *, int));
-
-#ifdef UTF8_INPUT_ENABLE
-STATIC void w_status PROTO((struct input_code *, int));
-STATIC void w16_status PROTO((struct input_code *, int));
-static int utf16_mode = UTF16BE_INPUT;
-#endif
+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);
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},
+ {"UTF-16", 0, 0, 0, {0, 0, 0}, NULL, w_iconv16, 0},
+ {"UTF-32", 0, 0, 0, {0, 0, 0}, NULL, w_iconv32, 0},
+#endif
{0}
};
@@ -515,38 +626,38 @@ static int fold_margin = FOLD_MARGIN;
#endif
/* process default */
-static void (*output_conv)PROTO((int c2,int c1)) = DEFAULT_CONV;
+static void (*output_conv)(nkf_char c2,nkf_char c1) = DEFAULT_CONV;
-static void (*oconv)PROTO((int c2,int c1)) = no_connection;
+static void (*oconv)(nkf_char c2,nkf_char c1) = no_connection;
/* s_iconv or oconv */
-static int (*iconv)PROTO((int c2,int c1,int c0)) = no_connection2;
+static nkf_char (*iconv)(nkf_char c2,nkf_char c1,nkf_char c0) = no_connection2;
-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 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 redirections */
-static void (*o_putc)PROTO((int c)) = std_putc;
+static void (*o_putc)(nkf_char c) = std_putc;
-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_getc)(FILE *f) = std_getc; /* general input */
+static nkf_char (*i_ungetc)(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 nkf_char (*i_bgetc)(FILE *) = std_getc; /* input of mgetc */
+static nkf_char (*i_bungetc)(nkf_char c ,FILE *f) = std_ungetc;
-static void (*o_mputc)PROTO((int c)) = std_putc ; /* output of mputc */
+static void (*o_mputc)(nkf_char c) = std_putc ; /* output of mputc */
-static int (*i_mgetc)PROTO((FILE *)) = std_getc; /* input of mgetc */
-static int (*i_mungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+static nkf_char (*i_mgetc)(FILE *) = std_getc; /* input of mgetc */
+static nkf_char (*i_mungetc)(nkf_char c ,FILE *f) = std_ungetc;
/* for strict mime */
-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;
+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;
/* Global states */
static int output_mode = ASCII, /* output kanji mode */
@@ -558,7 +669,7 @@ static int mime_decode_mode = FALSE; /* MIME mode B base64, Q hex */
/* X0201 kana conversion table */
/* 90-9F A0-DF */
-static
+static const
unsigned char cv[]= {
0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57,
0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21,
@@ -581,7 +692,7 @@ unsigned char cv[]= {
/* X0201 kana conversion table for daguten */
/* 90-9F A0-DF */
-static
+static const
unsigned char dv[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -603,7 +714,7 @@ unsigned char dv[]= {
/* X0201 kana conversion table for han-daguten */
/* 90-9F A0-DF */
-static
+static const
unsigned char ev[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -626,7 +737,7 @@ unsigned char ev[]= {
/* X0208 kigou conversion table */
/* 0x8140 - 0x819e */
-static
+static const
unsigned char fv[] = {
0x00,0x00,0x00,0x00,0x2c,0x2e,0x00,0x3a,
@@ -646,9 +757,13 @@ unsigned char fv[] = {
#define CRLF 1
-static int file_out = FALSE;
+static int file_out_f = FALSE;
#ifdef OVERWRITE
-static int overwrite = FALSE;
+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);
#endif
static int crmode_f = 0; /* CR, NL, CRLF */
@@ -657,17 +772,14 @@ static int end_check;
#endif /*Easy Win */
#define STD_GC_BUFSIZE (256)
-int std_gc_buf[STD_GC_BUFSIZE];
-int std_gc_ndx;
+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(argc, argv)
- int argc;
- char **argv;
+int main(int argc, char **argv)
{
FILE *fin;
unsigned char *cp;
@@ -714,7 +826,7 @@ main(argc, argv)
x0201_f = ((!iso2022jp_f)? TRUE : NO_X0201);
if (binmode_f == TRUE)
-#ifdef __OS2__
+#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
if (freopen("","wb",stdout) == NULL)
return (-1);
#else
@@ -724,16 +836,16 @@ main(argc, argv)
if (unbuf_f)
setbuf(stdout, (char *) NULL);
else
- setvbuffer(stdout, stdobuf, IOBUF_SIZE);
+ setvbuffer(stdout, (char *) stdobuf, IOBUF_SIZE);
if (argc == 0) {
if (binmode_f == TRUE)
-#ifdef __OS2__
+#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
if (freopen("","rb",stdin) == NULL) return (-1);
#else
setbinmode(stdin);
#endif
- setvbuffer(stdin, stdibuf, IOBUF_SIZE);
+ setvbuffer(stdin, (char *) stdibuf, IOBUF_SIZE);
if (nop_f)
noconvert(stdin);
else {
@@ -742,13 +854,19 @@ main(argc, argv)
}
} else {
int nfiles = argc;
+ int is_argument_error = FALSE;
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);
+ *argv++;
+ is_argument_error = TRUE;
+ continue;
} else {
#ifdef OVERWRITE
int fd = 0;
@@ -756,9 +874,9 @@ main(argc, argv)
#endif
/* reopen file for stdout */
- if (file_out == TRUE) {
+ if (file_out_f == TRUE) {
#ifdef OVERWRITE
- if (overwrite){
+ if (overwrite_f){
outfname = malloc(strlen(origfname)
+ strlen(".nkftmpXXXXXX")
+ 1);
@@ -780,7 +898,7 @@ main(argc, argv)
}
strcat(outfname, "ntXXXXXX");
mktemp(outfname);
- fd = open(outfname, O_WRONLY | O_CREAT | O_TRUNC,
+ fd = open(outfname, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
S_IREAD | S_IWRITE);
#else
strcat(outfname, ".nkftmpXXXXXX");
@@ -807,7 +925,7 @@ main(argc, argv)
return (-1);
}
if (binmode_f == TRUE) {
-#ifdef __OS2__
+#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
if (freopen("","wb",stdout) == NULL)
return (-1);
#else
@@ -816,13 +934,13 @@ main(argc, argv)
}
}
if (binmode_f == TRUE)
-#ifdef __OS2__
+#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__))
if (freopen("","rb",fin) == NULL)
return (-1);
#else
setbinmode(fin);
#endif
- setvbuffer(fin, stdibuf, IOBUF_SIZE);
+ setvbuffer(fin, (char *) stdibuf, IOBUF_SIZE);
if (nop_f)
noconvert(fin);
else {
@@ -833,9 +951,9 @@ main(argc, argv)
}
fclose(fin);
#ifdef OVERWRITE
- if (overwrite) {
+ if (overwrite_f) {
struct stat sb;
-#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__)
+#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__) && !defined(__WATCOMC__) && !defined(__EMX__) && !defined(__OS2__) && !defined(__DJGPP__)
time_t tb[2];
#else
struct utimbuf tb;
@@ -855,23 +973,37 @@ main(argc, argv)
}
/* $B%?%$%`%9%?%s%W$rI|85(B */
-#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__)
- tb[0] = tb[1] = sb.st_mtime;
- if (utime(outfname, tb)) {
- fprintf(stderr, "Can't set timestamp %s\n", outfname);
- }
+ 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);
+ }
#else
- tb.actime = sb.st_atime;
- tb.modtime = sb.st_mtime;
- if (utime(outfname, &tb)) {
- fprintf(stderr, "Can't set timestamp %s\n", outfname);
- }
+ 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
- if (unlink(origfname)){
- perror(origfname);
- }
+ unlink(backup_filename);
+#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);
+ }
#endif
+ }
if (rename(outfname, origfname)) {
perror(origfname);
fprintf(stderr, "Can't rename %s to %s\n",
@@ -882,25 +1014,70 @@ main(argc, argv)
#endif
}
}
+ if (is_argument_error)
+ return(-1);
}
#ifdef EASYWIN /*Easy Win */
- if (file_out == FALSE)
+ if (file_out_f == FALSE)
scanf("%d",&end_check);
else
fclose(stdout);
#else /* for Other OS */
- if (file_out == TRUE)
+ if (file_out_f == TRUE)
fclose(stdout);
#endif /*Easy Win */
return (0);
}
#endif /* WIN32DLL */
-static
+#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
struct {
- char *name;
- char *alias;
+ const char *name;
+ const char *alias;
} long_option[] = {
+ {"ic=", ""},
+ {"oc=", ""},
{"base64","jMB"},
{"euc","e"},
{"euc-input","E"},
@@ -930,13 +1107,28 @@ struct {
{"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", ""},
@@ -961,47 +1153,340 @@ struct {
static int option_mode = 0;
-void
-options(cp)
- unsigned char *cp;
+void options(unsigned char *cp)
{
- int i;
- unsigned char *p = NULL;
+ nkf_char i, j;
+ unsigned char *p;
+ unsigned char *cp_back = NULL;
+ char codeset[32];
if (option_mode==1)
return;
- if (*cp++ != '-')
- return;
- while (*cp) {
- if (p && !*cp) {
- cp = p;
- p = 0;
+ while(*cp && *cp++!='-');
+ while (*cp || cp_back) {
+ if(!*cp){
+ cp = cp_back;
+ cp_back = NULL;
+ continue;
}
+ p = 0;
switch (*cp++) {
case '-': /* literal options */
- if (!*cp) { /* ignore the rest of arguments */
+ if (!*cp || *cp == SPACE) { /* 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]){
- p = &cp[j];
+ for (j=0;*p && *p != '=' && *p == cp[j];p++, j++);
+ if (*p == cp[j] || cp[j] == ' '){
+ p = &cp[j] + 1;
break;
}
p = 0;
}
if (p == 0) return;
- cp = (unsigned char *)long_option[i].alias;
- if (!*cp){
+ 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){
+ input_f = JIS_INPUT;
+ }else if(strcmp(codeset, "X-ISO2022JP-CP932") == 0 ||
+ strcmp(codeset, "CP50220") == 0 ||
+ strcmp(codeset, "CP50221") == 0 ||
+ strcmp(codeset, "CP50222") == 0){
+ input_f = JIS_INPUT;
+#ifdef SHIFTJIS_CP932
+ cp51932_f = TRUE;
+#endif
+#ifdef UTF8_OUTPUT_ENABLE
+ ms_ucs_map_f = UCS_MAP_CP932;
+#endif
+ }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;
+ }else if(strcmp(codeset, "WINDOWS-31J") == 0 ||
+ strcmp(codeset, "CSWINDOWS31J") == 0 ||
+ strcmp(codeset, "CP932") == 0 ||
+ strcmp(codeset, "MS932") == 0){
+ input_f = SJIS_INPUT;
+#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 = EUC_INPUT;
+ }else if(strcmp(codeset, "CP51932") == 0){
+ input_f = EUC_INPUT;
+#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 = EUC_INPUT;
+#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 = EUC_INPUT;
+#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;
+#endif
+ }else if(strcmp(codeset, "EUC-JISX0213") == 0 ||
+ strcmp(codeset, "EUC-JIS-2004") == 0){
+ input_f = EUC_INPUT;
+ x0213_f = TRUE;
+#ifdef SHIFTJIS_CP932
+ cp51932_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 ||
+ strcmp(codeset, "UTF-16BE") == 0 ||
+ strcmp(codeset, "UTF-16BE-BOM") == 0){
+ input_f = UTF16_INPUT;
+ input_endian = ENDIAN_BIG;
+ }else if(strcmp(codeset, "UTF-16LE") == 0 ||
+ strcmp(codeset, "UTF-16LE-BOM") == 0){
+ input_f = UTF16_INPUT;
+ input_endian = ENDIAN_LITTLE;
+ }else if(strcmp(codeset, "UTF-32") == 0 ||
+ strcmp(codeset, "UTF-32BE") == 0 ||
+ strcmp(codeset, "UTF-32BE-BOM") == 0){
+ input_f = UTF32_INPUT;
+ input_endian = ENDIAN_BIG;
+ }else if(strcmp(codeset, "UTF-32LE") == 0 ||
+ strcmp(codeset, "UTF-32LE-BOM") == 0){
+ input_f = UTF32_INPUT;
+ input_endian = ENDIAN_LITTLE;
+#endif
+ }
+ continue;
+ }
+ if (strcmp(long_option[i].name, "oc=") == 0){
+ x0201_f = FALSE;
+ 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){
+ output_conv = j_oconv;
+ }else if(strcmp(codeset, "X-ISO2022JP-CP932") == 0){
+ output_conv = j_oconv;
+ no_cp932ext_f = TRUE;
+#ifdef SHIFTJIS_CP932
+ cp932inv_f = FALSE;
+#endif
+#ifdef UTF8_OUTPUT_ENABLE
+ ms_ucs_map_f = UCS_MAP_CP932;
+#endif
+ }else if(strcmp(codeset, "CP50220") == 0){
+ output_conv = j_oconv;
+ x0201_f = TRUE;
+#ifdef SHIFTJIS_CP932
+ cp932inv_f = FALSE;
+#endif
+#ifdef UTF8_OUTPUT_ENABLE
+ ms_ucs_map_f = UCS_MAP_CP932;
+#endif
+ }else if(strcmp(codeset, "CP50221") == 0){
+ output_conv = j_oconv;
+#ifdef SHIFTJIS_CP932
+ cp932inv_f = FALSE;
+#endif
+#ifdef UTF8_OUTPUT_ENABLE
+ ms_ucs_map_f = UCS_MAP_CP932;
+#endif
+ }else if(strcmp(codeset, "ISO-2022-JP-1") == 0){
+ output_conv = j_oconv;
+#ifdef X0212_ENABLE
+ x0212_f = TRUE;
+#endif
+#ifdef SHIFTJIS_CP932
+ cp932inv_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
+ cp932inv_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;
+#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;
+#ifdef SHIFTJIS_CP932
+ cp932inv_f = FALSE;
+#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;
+#ifdef X0212_ENABLE
+ x0212_f = TRUE;
+#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;
+#ifdef X0212_ENABLE
+ x0212_f = TRUE;
+#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
+ cp932inv_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;
+ }else if(strcmp(codeset, "UTF-8-BOM") == 0){
+ output_conv = w_oconv;
+ output_bom_f = TRUE;
+ }else if(strcmp(codeset, "UTF-16BE") == 0){
+ output_conv = w_oconv16;
+ }else if(strcmp(codeset, "UTF-16") == 0 ||
+ strcmp(codeset, "UTF-16BE-BOM") == 0){
+ output_conv = w_oconv16;
+ output_bom_f = TRUE;
+ }else if(strcmp(codeset, "UTF-16LE") == 0){
+ output_conv = w_oconv16;
+ output_endian = ENDIAN_LITTLE;
+ }else if(strcmp(codeset, "UTF-16LE-BOM") == 0){
+ output_conv = w_oconv16;
+ output_endian = ENDIAN_LITTLE;
+ output_bom_f = TRUE;
+ }else if(strcmp(codeset, "UTF-32") == 0 ||
+ strcmp(codeset, "UTF-32BE") == 0){
+ output_conv = w_oconv32;
+ }else if(strcmp(codeset, "UTF-32BE-BOM") == 0){
+ output_conv = w_oconv32;
+ output_bom_f = TRUE;
+ }else if(strcmp(codeset, "UTF-32LE") == 0){
+ output_conv = w_oconv32;
+ output_endian = ENDIAN_LITTLE;
+ }else if(strcmp(codeset, "UTF-32LE-BOM") == 0){
+ output_conv = w_oconv32;
+ output_endian = ENDIAN_LITTLE;
+ output_bom_f = TRUE;
+#endif
+ }
+ continue;
+ }
#ifdef OVERWRITE
if (strcmp(long_option[i].name, "overwrite") == 0){
- file_out = TRUE;
- overwrite = TRUE;
+ file_out_f = TRUE;
+ overwrite_f = TRUE;
+ preserve_time_f = 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){
@@ -1031,21 +1516,21 @@ options(cp)
#endif
if (strcmp(long_option[i].name, "cp932") == 0){
#ifdef SHIFTJIS_CP932
- cp932_f = TRUE;
+ cp51932_f = TRUE;
cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = TRUE;
+ ms_ucs_map_f = UCS_MAP_CP932;
#endif
continue;
}
if (strcmp(long_option[i].name, "no-cp932") == 0){
#ifdef SHIFTJIS_CP932
- cp932_f = FALSE;
+ cp51932_f = FALSE;
cp932inv_f = FALSE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = FALSE;
+ ms_ucs_map_f = UCS_MAP_ASCII;
#endif
continue;
}
@@ -1073,16 +1558,83 @@ options(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 = TRUE;
+ ms_ucs_map_f = UCS_MAP_MS;
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 (*p == '=' && ' ' < p[1] && p[1] < 128){
- for (i = 2; ' ' < p[i] && p[i] < 128; i++){
- prefix_table[p[i]] = p[1];
+ if (nkf_isgraph(p[0])){
+ for (i = 1; nkf_isgraph(p[i]); i++){
+ prefix_table[p[i]] = p[0];
}
}
continue;
@@ -1096,7 +1648,21 @@ options(cp)
unbuf_f = TRUE;
continue;
case 't': /* transparent mode */
- nop_f = TRUE;
+ 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;
continue;
case 'j': /* JIS output */
case 'n':
@@ -1104,6 +1670,7 @@ options(cp)
continue;
case 'e': /* AT&T EUC output */
output_conv = e_oconv;
+ cp932inv_f = FALSE;
continue;
case 's': /* SJIS output */
output_conv = s_oconv;
@@ -1122,8 +1689,8 @@ options(cp)
continue;
case 'h':
/*
- bit:1 hira -> kata
- bit:2 kata -> hira
+ bit:1 katakana->hiragana
+ bit:2 hiragana->katakana
*/
if ('9'>= *cp && *cp>='0')
hira_f |= (*cp++ -'0');
@@ -1150,57 +1717,72 @@ options(cp)
#endif
#ifdef UTF8_OUTPUT_ENABLE
case 'w': /* UTF-8 output */
- if ('1'== cp[0] && '6'==cp[1]) {
- output_conv = w_oconv16; cp+=2;
+ if (cp[0] == '8') {
+ output_conv = w_oconv; cp++;
+ if (cp[0] == '0'){
+ cp++;
+ } else {
+ output_bom_f = TRUE;
+ }
+ } else {
+ if ('1'== cp[0] && '6'==cp[1]) {
+ output_conv = w_oconv16; cp+=2;
+ } else if ('3'== cp[0] && '2'==cp[1]) {
+ output_conv = w_oconv32; cp+=2;
+ } else {
+ output_conv = w_oconv;
+ continue;
+ }
if (cp[0]=='L') {
- unicode_bom_f=2; cp++;
- w_oconv16_LE = 1;
- if (cp[0] == '0'){
- unicode_bom_f=1; cp++;
- }
+ cp++;
+ output_endian = ENDIAN_LITTLE;
} else if (cp[0] == 'B') {
- unicode_bom_f=2; cp++;
- if (cp[0] == '0'){
- unicode_bom_f=1; cp++;
- }
- }
- } else if (cp[0] == '8') {
- output_conv = w_oconv; cp++;
- unicode_bom_f=2;
+ cp++;
+ } else {
+ continue;
+ }
if (cp[0] == '0'){
- unicode_bom_f=1; cp++;
+ cp++;
+ } else {
+ output_bom_f = TRUE;
}
- } else
- output_conv = w_oconv;
+ }
continue;
#endif
#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;
+ case 'W': /* UTF input */
+ if (cp[0] == '8') {
+ cp++;
+ input_f = UTF8_INPUT;
+ }else{
+ if ('1'== cp[0] && '6'==cp[1]) {
+ cp += 2;
+ input_f = UTF16_INPUT;
+ input_endian = ENDIAN_BIG;
+ } else if ('3'== cp[0] && '2'==cp[1]) {
+ cp += 2;
+ input_f = UTF32_INPUT;
+ input_endian = ENDIAN_BIG;
+ } else {
+ input_f = UTF8_INPUT;
+ continue;
+ }
if (cp[0]=='L') {
cp++;
- input_f = UTF16LE_INPUT;
- utf16_mode = UTF16LE_INPUT;
+ input_endian = ENDIAN_LITTLE;
} else if (cp[0] == 'B') {
cp++;
- input_f = UTF16BE_INPUT;
- utf16_mode = UTF16BE_INPUT;
}
- } else if (cp[0] == '8') {
- cp++;
- input_f = UTF8_INPUT;
- } else
- input_f = UTF8_INPUT;
+ }
continue;
#endif
/* Input code assumption */
case 'J': /* JIS input */
- case 'E': /* AT&T EUC input */
input_f = JIS_INPUT;
continue;
+ case 'E': /* AT&T EUC input */
+ input_f = EUC_INPUT;
+ continue;
case 'S': /* MS Kanji input */
input_f = SJIS_INPUT;
if (x0201_f==NO_X0201) x0201_f=TRUE;
@@ -1290,7 +1872,7 @@ options(cp)
continue;
#ifndef PERL_XS
case 'O':/* for Output file */
- file_out = TRUE;
+ file_out_f = TRUE;
continue;
#endif
case 'c':/* add cr code */
@@ -1320,8 +1902,7 @@ options(cp)
continue;
case ' ':
/* module muliple options in a string are allowed for Perl moudle */
- while(*cp && *cp!='-') cp++;
- if(*cp=='-') cp++;
+ while(*cp && *cp++!='-');
continue;
default:
/* bogus option but ignored */
@@ -1330,12 +1911,7 @@ options(cp)
}
}
-#ifdef ANSI_C_PROTOTYPE
-struct input_code * find_inputcode_byfunc(int (*iconv_func)(int c2,int c1,int c0))
-#else
-struct input_code * find_inputcode_byfunc(iconv_func)
- int (*iconv_func)();
-#endif
+struct input_code * find_inputcode_byfunc(nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0))
{
if (iconv_func){
struct input_code *p = input_code_list;
@@ -1349,17 +1925,7 @@ struct input_code * find_inputcode_byfunc(iconv_func)
return 0;
}
-#ifdef CHECK_OPTION
-static int (*iconv_for_check)() = 0;
-#endif
-
-#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
+void set_iconv(nkf_char f, nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0))
{
#ifdef INPUT_CODE_FIX
if (f || !input_f)
@@ -1401,43 +1967,40 @@ void set_iconv(f, iconv_func)
#define SCORE_INIT (SCORE_iMIME)
-int score_table_A0[] = {
+const nkf_char 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,
};
-int score_table_F0[] = {
+const nkf_char 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(ptr, score)
- struct input_code *ptr;
- int score;
+void set_code_score(struct input_code *ptr, nkf_char score)
{
if (ptr){
ptr->score |= score;
}
}
-void clr_code_score(ptr, score)
- struct input_code *ptr;
- int score;
+void clr_code_score(struct input_code *ptr, nkf_char score)
{
if (ptr){
ptr->score &= ~score;
}
}
-void code_score(ptr)
- struct input_code *ptr;
+void code_score(struct input_code *ptr)
{
- int c2 = ptr->buf[0];
- int c1 = ptr->buf[1];
+ nkf_char c2 = ptr->buf[0];
+#ifdef UTF8_OUTPUT_ENABLE
+ nkf_char c1 = ptr->buf[1];
+#endif
if (c2 < 0){
set_code_score(ptr, SCORE_ERROR);
}else if (c2 == SSO){
@@ -1455,8 +2018,7 @@ void code_score(ptr)
}
}
-void status_disable(ptr)
-struct input_code *ptr;
+void status_disable(struct input_code *ptr)
{
ptr->stat = -1;
ptr->buf[0] = -1;
@@ -1464,46 +2026,37 @@ struct input_code *ptr;
if (iconv == ptr->iconv_func) set_iconv(FALSE, 0);
}
-void status_push_ch(ptr, c)
- struct input_code *ptr;
- int c;
+void status_push_ch(struct input_code *ptr, nkf_char c)
{
ptr->buf[ptr->index++] = c;
}
-void status_clear(ptr)
- struct input_code *ptr;
+void status_clear(struct input_code *ptr)
{
ptr->stat = 0;
ptr->index = 0;
}
-void status_reset(ptr)
- struct input_code *ptr;
+void status_reset(struct input_code *ptr)
{
status_clear(ptr);
ptr->score = SCORE_INIT;
}
-void status_reinit(ptr)
- struct input_code *ptr;
+void status_reinit(struct input_code *ptr)
{
status_reset(ptr);
ptr->_file_stat = 0;
}
-void status_check(ptr, c)
- struct input_code *ptr;
- int c;
+void status_check(struct input_code *ptr, nkf_char c)
{
if (c <= DEL && estab_f){
status_reset(ptr);
}
}
-void s_status(ptr, c)
- struct input_code *ptr;
- int c;
+void s_status(struct input_code *ptr, nkf_char c)
{
switch(ptr->stat){
case -1:
@@ -1513,7 +2066,7 @@ void s_status(ptr, c)
if (c <= DEL){
break;
#ifdef NUMCHAR_OPTION
- }else if ((c & CLASS_MASK) == CLASS_UTF16){
+ }else if (is_unicode_capsule(c)){
break;
#endif
}else if (0xa1 <= c && c <= 0xdf){
@@ -1525,8 +2078,8 @@ void s_status(ptr, c)
ptr->stat = 1;
status_push_ch(ptr, c);
#ifdef SHIFTJIS_CP932
- }else if (cp932_f
- && CP932_TABLE_BEGIN <= c && c <= CP932_TABLE_END){
+ }else if (cp51932_f
+ && is_ibmext_in_sjis(c)){
ptr->stat = 2;
status_push_ch(ptr, c);
#endif /* SHIFTJIS_CP932 */
@@ -1562,14 +2115,12 @@ void s_status(ptr, c)
#endif /* SHIFTJIS_CP932 */
#ifndef X0212_ENABLE
status_disable(ptr);
- break;
#endif
+ break;
}
}
-void e_status(ptr, c)
- struct input_code *ptr;
- int c;
+void e_status(struct input_code *ptr, nkf_char c)
{
switch (ptr->stat){
case -1:
@@ -1579,7 +2130,7 @@ void e_status(ptr, c)
if (c <= DEL){
break;
#ifdef NUMCHAR_OPTION
- }else if ((c & CLASS_MASK) == CLASS_UTF16){
+ }else if (is_unicode_capsule(c)){
break;
#endif
}else if (SSO == c || (0xa1 <= c && c <= 0xfe)){
@@ -1616,57 +2167,7 @@ void e_status(ptr, c)
}
#ifdef UTF8_INPUT_ENABLE
-void w16_status(ptr, c)
- struct input_code *ptr;
- int c;
-{
- switch (ptr->stat){
- case -1:
- break;
- case 0:
- if (ptr->_file_stat == 0){
- if (c == 0xfe || c == 0xff){
- ptr->stat = c;
- status_push_ch(ptr, c);
- ptr->_file_stat = 1;
- }else{
- status_disable(ptr);
- ptr->_file_stat = -1;
- }
- }else if (ptr->_file_stat > 0){
- ptr->stat = 1;
- status_push_ch(ptr, c);
- }else if (ptr->_file_stat < 0){
- status_disable(ptr);
- }
- break;
-
- case 1:
- if (c == EOF){
- status_disable(ptr);
- ptr->_file_stat = -1;
- }else{
- status_push_ch(ptr, c);
- status_clear(ptr);
- }
- break;
-
- case 0xfe:
- case 0xff:
- if (ptr->stat != c && (c == 0xfe || c == 0xff)){
- status_push_ch(ptr, c);
- status_clear(ptr);
- }else{
- status_disable(ptr);
- ptr->_file_stat = -1;
- }
- break;
- }
-}
-
-void w_status(ptr, c)
- struct input_code *ptr;
- int c;
+void w_status(struct input_code *ptr, nkf_char c)
{
switch (ptr->stat){
case -1:
@@ -1676,7 +2177,7 @@ void w_status(ptr, c)
if (c <= DEL){
break;
#ifdef NUMCHAR_OPTION
- }else if ((c & CLASS_MASK) == CLASS_UTF16){
+ }else if (is_unicode_capsule(c)){
break;
#endif
}else if (0xc0 <= c && c <= 0xdf){
@@ -1685,6 +2186,9 @@ void w_status(ptr, c)
}else if (0xe0 <= c && c <= 0xef){
ptr->stat = 2;
status_push_ch(ptr, c);
+ }else if (0xf0 <= c && c <= 0xf4){
+ ptr->stat = 3;
+ status_push_ch(ptr, c);
}else{
status_disable(ptr);
}
@@ -1707,18 +2211,33 @@ void w_status(ptr, c)
status_disable(ptr);
}
break;
+ case 3:
+ if (0x80 <= c && c <= 0xbf){
+ if (ptr->index < ptr->stat){
+ status_push_ch(ptr, c);
+ } else {
+ status_clear(ptr);
+ }
+ }else{
+ status_disable(ptr);
+ }
+ break;
}
}
#endif
-void
-code_status(c)
- int c;
+void code_status(nkf_char c)
{
int action_flag = 1;
struct input_code *result = 0;
struct input_code *p = input_code_list;
while (p->name){
+ if (!p->status_func) {
+ ++p;
+ continue;
+ }
+ if (!p->status_func)
+ continue;
(p->status_func)(p, c);
if (p->stat > 0){
action_flag = 0;
@@ -1746,9 +2265,7 @@ code_status(c)
}
#ifndef WIN32DLL
-int
-std_getc(f)
-FILE *f;
+nkf_char std_getc(FILE *f)
{
if (std_gc_ndx){
return std_gc_buf[--std_gc_ndx];
@@ -1757,10 +2274,7 @@ FILE *f;
}
#endif /*WIN32DLL*/
-int
-std_ungetc(c,f)
-int c;
-FILE *f;
+nkf_char std_ungetc(nkf_char c, FILE *f)
{
if (std_gc_ndx == STD_GC_BUFSIZE){
return EOF;
@@ -1770,29 +2284,28 @@ FILE *f;
}
#ifndef WIN32DLL
-void
-std_putc(c)
-int c;
+void std_putc(nkf_char c)
{
if(c!=EOF)
putchar(c);
}
#endif /*WIN32DLL*/
-int
-noconvert(f)
- FILE *f;
+#if !defined(PERL_XS) && !defined(WIN32DLL)
+nkf_char noconvert(FILE *f)
{
- int c;
+ nkf_char 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 module_connection(void)
{
oconv = output_conv;
o_putc = std_putc;
@@ -1853,6 +2366,12 @@ module_connection()
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;
@@ -1861,17 +2380,17 @@ module_connection()
i_bgetc = i_getc; i_getc = broken_getc;
i_bungetc = i_ungetc; i_ungetc = broken_ungetc;
}
- if (input_f == JIS_INPUT || input_f == LATIN1_INPUT) {
+ if (input_f == JIS_INPUT || input_f == EUC_INPUT || input_f == LATIN1_INPUT) {
set_iconv(-TRUE, e_iconv);
} else if (input_f == SJIS_INPUT) {
set_iconv(-TRUE, s_iconv);
#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) {
+ } else if (input_f == UTF16_INPUT) {
set_iconv(-TRUE, w_iconv16);
+ } else if (input_f == UTF32_INPUT) {
+ set_iconv(-TRUE, w_iconv32);
#endif
} else {
set_iconv(FALSE, e_iconv);
@@ -1886,20 +2405,132 @@ module_connection()
}
/*
+ * Check and Ignore BOM
+ */
+void check_bom(FILE *f)
+{
+ int c2;
+ switch(c2 = (*i_getc)(f)){
+ case 0x00:
+ if((c2 = (*i_getc)(f)) == 0x00){
+ if((c2 = (*i_getc)(f)) == 0xFE){
+ if((c2 = (*i_getc)(f)) == 0xFF){
+ if(!input_f){
+ set_iconv(TRUE, w_iconv32);
+ }
+ if (iconv == w_iconv32) {
+ input_endian = ENDIAN_BIG;
+ return;
+ }
+ (*i_ungetc)(0xFF,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0xFE,f);
+ }else if(c2 == 0xFF){
+ if((c2 = (*i_getc)(f)) == 0xFE){
+ if(!input_f){
+ set_iconv(TRUE, w_iconv32);
+ }
+ if (iconv == w_iconv32) {
+ input_endian = ENDIAN_2143;
+ return;
+ }
+ (*i_ungetc)(0xFF,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0xFF,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0x00,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0x00,f);
+ break;
+ case 0xEF:
+ if((c2 = (*i_getc)(f)) == 0xBB){
+ if((c2 = (*i_getc)(f)) == 0xBF){
+ if(!input_f){
+ set_iconv(TRUE, w_iconv);
+ }
+ if (iconv == w_iconv) {
+ return;
+ }
+ (*i_ungetc)(0xBF,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0xBB,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0xEF,f);
+ break;
+ case 0xFE:
+ if((c2 = (*i_getc)(f)) == 0xFF){
+ if((c2 = (*i_getc)(f)) == 0x00){
+ if((c2 = (*i_getc)(f)) == 0x00){
+ if(!input_f){
+ set_iconv(TRUE, w_iconv32);
+ }
+ if (iconv == w_iconv32) {
+ input_endian = ENDIAN_3412;
+ return;
+ }
+ (*i_ungetc)(0x00,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0x00,f);
+ }else (*i_ungetc)(c2,f);
+ if(!input_f){
+ set_iconv(TRUE, w_iconv16);
+ }
+ if (iconv == w_iconv16) {
+ input_endian = ENDIAN_BIG;
+ return;
+ }
+ (*i_ungetc)(0xFF,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0xFE,f);
+ break;
+ case 0xFF:
+ if((c2 = (*i_getc)(f)) == 0xFE){
+ if((c2 = (*i_getc)(f)) == 0x00){
+ if((c2 = (*i_getc)(f)) == 0x00){
+ if(!input_f){
+ set_iconv(TRUE, w_iconv32);
+ }
+ if (iconv == w_iconv32) {
+ input_endian = ENDIAN_LITTLE;
+ return;
+ }
+ (*i_ungetc)(0x00,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0x00,f);
+ }else (*i_ungetc)(c2,f);
+ if(!input_f){
+ set_iconv(TRUE, w_iconv16);
+ }
+ if (iconv == w_iconv16) {
+ input_endian = ENDIAN_LITTLE;
+ return;
+ }
+ (*i_ungetc)(0xFE,f);
+ }else (*i_ungetc)(c2,f);
+ (*i_ungetc)(0xFF,f);
+ break;
+ default:
+ (*i_ungetc)(c2,f);
+ break;
+ }
+}
+
+/*
Conversion main loop. Code detection only.
*/
-int
-kanji_convert(f)
- FILE *f;
+nkf_char kanji_convert(FILE *f)
{
- int c1,
- c2, c3;
+ nkf_char c3, c2=0, c1, c0=0;
int is_8bit = FALSE;
- module_connection();
- c2 = 0;
-
+ if(input_f == SJIS_INPUT || input_f == EUC_INPUT
+#ifdef UTF8_INPUT_ENABLE
+ || input_f == UTF8_INPUT || input_f == UTF16_INPUT
+#endif
+ ){
+ is_8bit = TRUE;
+ }
input_mode = ASCII;
output_mode = ASCII;
@@ -1909,11 +2540,17 @@ kanji_convert(f)
#define SEND ; /* output c1 and c2, get next */
#define LAST break /* end of loop, go closing */
+ module_connection();
+ check_bom(f);
+
while ((c1 = (*i_getc)(f)) != EOF) {
- code_status(c1);
+#ifdef INPUT_CODE_FIX
+ if (!input_f)
+#endif
+ code_status(c1);
if (c2) {
/* second byte */
- if (c2 > DEL) {
+ if (c2 > ((input_f == JIS_INPUT && ms_ucs_map_f) ? 0x92 : DEL)) {
/* in case of 8th bit is on */
if (!estab_f&&!mime_decode_mode) {
/* in case of not established yet */
@@ -1923,14 +2560,16 @@ kanji_convert(f)
else
c2 = 0;
NEXT;
- } else
- /* in case of already established */
- if (c1 < AT) {
- /* ignore bogus code */
- c2 = 0;
- NEXT;
- } else
- SEND;
+ } else {
+ /* in case of already established */
+ if (c1 < AT) {
+ /* ignore bogus code and not CP5022x UCD */
+ c2 = 0;
+ NEXT;
+ } else {
+ SEND;
+ }
+ }
} else
/* second byte, 7 bit code */
/* it might be kanji shitfted */
@@ -1942,25 +2581,68 @@ kanji_convert(f)
SEND;
} else {
/* first byte */
- if (
#ifdef UTF8_INPUT_ENABLE
- iconv == w_iconv16
-#else
- 0
-#endif
- ) {
- c2 = c1;
- c1 = (*i_getc)(f);
+ if (iconv == w_iconv16) {
+ if (input_endian == ENDIAN_BIG) {
+ c2 = c1;
+ if ((c1 = (*i_getc)(f)) != EOF) {
+ if (0xD8 <= c2 && c2 <= 0xDB) {
+ if ((c0 = (*i_getc)(f)) != EOF) {
+ c0 <<= 8;
+ if ((c3 = (*i_getc)(f)) != EOF) {
+ c0 |= c3;
+ } else c2 = EOF;
+ } else c2 = EOF;
+ }
+ } else c2 = EOF;
+ } else {
+ if ((c2 = (*i_getc)(f)) != EOF) {
+ if (0xD8 <= c2 && c2 <= 0xDB) {
+ if ((c3 = (*i_getc)(f)) != EOF) {
+ if ((c0 = (*i_getc)(f)) != EOF) {
+ c0 <<= 8;
+ c0 |= c3;
+ } else c2 = EOF;
+ } else c2 = EOF;
+ }
+ } else c2 = EOF;
+ }
+ SEND;
+ } else if(iconv == w_iconv32){
+ int c3 = c1;
+ if((c2 = (*i_getc)(f)) != EOF &&
+ (c1 = (*i_getc)(f)) != EOF &&
+ (c0 = (*i_getc)(f)) != EOF){
+ switch(input_endian){
+ case ENDIAN_BIG:
+ c1 = (c2&0xFF)<<16 | (c1&0xFF)<<8 | (c0&0xFF);
+ break;
+ case ENDIAN_LITTLE:
+ c1 = (c3&0xFF) | (c2&0xFF)<<8 | (c1&0xFF)<<16;
+ break;
+ case ENDIAN_2143:
+ c1 = (c3&0xFF)<<16 | (c1&0xFF) | (c0&0xFF)<<8;
+ break;
+ case ENDIAN_3412:
+ c1 = (c3&0xFF)<<8 | (c2&0xFF) | (c0&0xFF)<<16;
+ break;
+ }
+ c2 = 0;
+ }else{
+ c2 = EOF;
+ }
SEND;
+ } else
+#endif
#ifdef NUMCHAR_OPTION
- } else if ((c1 & CLASS_MASK) == CLASS_UTF16){
+ if (is_unicode_capsule(c1)){
SEND;
+ } else
#endif
- } else if (c1 > DEL) {
+ if (c1 > ((input_f == JIS_INPUT && ms_ucs_map_f) ? 0x92 : 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 */
@@ -2020,7 +2702,8 @@ kanji_convert(f)
/* look like bogus code */
NEXT;
}
- } else if (input_mode == X0208) {
+ } else if (input_mode == X0208 || input_mode == X0212 ||
+ input_mode == X0213_1 || input_mode == X0213_2) {
/* in case of Kanji shifted */
c2 = c1;
NEXT;
@@ -2050,13 +2733,13 @@ kanji_convert(f)
/* normal ASCII code */
SEND;
}
- } else if (c1 == SI) {
+ } else if (c1 == SI && (!is_8bit || mime_decode_mode)) {
shift_mode = FALSE;
NEXT;
- } else if (c1 == SO) {
+ } else if (c1 == SO && (!is_8bit || mime_decode_mode)) {
shift_mode = TRUE;
NEXT;
- } else if (c1 == ESC ) {
+ } else if (c1 == ESC && (!is_8bit || mime_decode_mode)) {
if ((c1 = (*i_getc)(f)) == EOF) {
/* (*oconv)(0, ESC); don't send bogus code */
LAST;
@@ -2071,7 +2754,9 @@ kanji_convert(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) {
@@ -2092,6 +2777,14 @@ kanji_convert(f)
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);
@@ -2154,6 +2847,44 @@ kanji_convert(f)
(*oconv)(0, ESC);
SEND;
}
+ } else if (c1 == ESC && iconv == s_iconv) {
+ /* ESC in Shift_JIS */
+ if ((c1 = (*i_getc)(f)) == EOF) {
+ /* (*oconv)(0, ESC); don't send bogus code */
+ LAST;
+ } else if (c1 == '$') {
+ /* J-PHONE emoji */
+ if ((c1 = (*i_getc)(f)) == EOF) {
+ /*
+ (*oconv)(0, ESC); don't send bogus code
+ (*oconv)(0, '$'); */
+ LAST;
+ } else {
+ if (('E' <= c1 && c1 <= 'G') ||
+ ('O' <= c1 && c1 <= 'Q')) {
+ /*
+ NUM : 0 1 2 3 4 5
+ BYTE: G E F O P Q
+ C%7 : 1 6 0 2 3 4
+ C%7 : 0 1 2 3 4 5 6
+ NUM : 2 0 3 4 5 X 1
+ */
+ static const int jphone_emoji_first_table[7] = {2, 0, 3, 4, 5, 0, 1};
+ c0 = (jphone_emoji_first_table[c1 % 7] << 8) - SPACE + 0xE000 + CLASS_UNICODE;
+ while ((c1 = (*i_getc)(f)) != EOF) {
+ if (SPACE <= c1 && c1 <= 'z') {
+ (*oconv)(0, c1 + c0);
+ } else break; /* c1 == SO */
+ }
+ }
+ }
+ if (c1 == EOF) LAST;
+ NEXT;
+ } else {
+ /* lonely ESC */
+ (*oconv)(0, ESC);
+ SEND;
+ }
} else if ((c1 == NL || c1 == CR) && broken_f&4) {
input_mode = ASCII; set_iconv(FALSE, 0);
SEND;
@@ -2183,27 +2914,63 @@ kanji_convert(f)
}
c1 = CR;
SEND;
+ } else if (c1 == DEL && input_mode == X0208 ) {
+ /* CP5022x */
+ c2 = c1;
+ NEXT;
} else
SEND;
}
/* send: */
- if (input_mode == X0208)
- (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */
+ switch(input_mode){
+ case ASCII:
+ switch ((*iconv)(c2, c1, c0)) { /* can be EUC / SJIS / UTF-8 / UTF-16 */
+ case -2:
+ /* 4 bytes UTF-8 */
+ if ((c0 = (*i_getc)(f)) != EOF) {
+ code_status(c0);
+ c0 <<= 8;
+ if ((c3 = (*i_getc)(f)) != EOF) {
+ code_status(c3);
+ (*iconv)(c2, c1, c0|c3);
+ }
+ }
+ break;
+ case -1:
+ /* 3 bytes EUC or UTF-8 */
+ if ((c0 = (*i_getc)(f)) != EOF) {
+ code_status(c0);
+ (*iconv)(c2, c1, c0);
+ }
+ break;
+ }
+ break;
+ case X0208:
+ case X0213_1:
+ if (ms_ucs_map_f &&
+ 0x7F <= c2 && c2 <= 0x92 &&
+ 0x21 <= c1 && c1 <= 0x7E) {
+ /* CP932 UDC */
+ if(c1 == 0x7F) return 0;
+ c1 = (c2 - 0x7F) * 94 + c1 - 0x21 + 0xE000 + CLASS_UNICODE;
+ c2 = 0;
+ }
+ (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */
+ break;
#ifdef X0212_ENABLE
- else if (input_mode == X0212)
- (*oconv)((0x8f << 8) | c2, c1);
+ case X0212:
+ (*oconv)(PREFIX_EUCG3 | c2, c1);
+ break;
#endif /* X0212_ENABLE */
- 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);
- }
- }
+ case X0213_2:
+ (*oconv)(PREFIX_EUCG3 | c2, c1);
+ break;
+ default:
+ (*oconv)(input_mode, c1); /* other special case */
+ }
c2 = 0;
+ c0 = 0;
continue;
/* goto next_word */
}
@@ -2225,13 +2992,11 @@ kanji_convert(f)
return 1;
}
-int
-h_conv(f, c2, c1)
- FILE *f;
- int c1,
- c2;
+nkf_char
+h_conv(FILE *f, nkf_char c2, nkf_char c1)
{
- int wc,c3;
+ nkf_char ret, c3, c0;
+ int hold_index;
/** it must NOT be in the kanji shifte sequence */
@@ -2241,7 +3006,6 @@ h_conv(f, c2, c1)
hold_count = 0;
push_hold_buf(c2);
push_hold_buf(c1);
- c2 = 0;
while ((c1 = (*i_getc)(f)) != EOF) {
if (c1 == ESC){
@@ -2279,13 +3043,13 @@ h_conv(f, c2, c1)
** Kanji codes by oconv and leave estab_f unchanged.
**/
- c3=c1;
- wc = 0;
- while (wc < hold_count){
- c2 = hold_buf[wc++];
+ ret = c1;
+ hold_index = 0;
+ while (hold_index < hold_count){
+ c2 = hold_buf[hold_index++];
if (c2 <= DEL
#ifdef NUMCHAR_OPTION
- || (c2 & CLASS_MASK) == CLASS_UTF16
+ || is_unicode_capsule(c2)
#endif
){
(*iconv)(0, c2, 0);
@@ -2294,8 +3058,8 @@ h_conv(f, c2, c1)
(*iconv)(X0201, c2, 0);
continue;
}
- if (wc < hold_count){
- c1 = hold_buf[wc++];
+ if (hold_index < hold_count){
+ c1 = hold_buf[hold_index++];
}else{
c1 = (*i_getc)(f);
if (c1 == EOF){
@@ -2304,59 +3068,93 @@ h_conv(f, c2, c1)
}
code_status(c1);
}
- if ((*iconv)(c2, c1, 0) < 0){
- int c0;
- if (wc < hold_count){
- c0 = hold_buf[wc++];
- }else{
- c0 = (*i_getc)(f);
- if (c0 == EOF){
- c3 = EOF;
- break;
- }
+ c0 = 0;
+ switch ((*iconv)(c2, c1, 0)) { /* can be EUC/SJIS/UTF-8 */
+ case -2:
+ /* 4 bytes UTF-8 */
+ if (hold_index < hold_count){
+ c0 = hold_buf[hold_index++];
+ } else if ((c0 = (*i_getc)(f)) == EOF) {
+ ret = EOF;
+ break;
+ } else {
+ code_status(c0);
+ c0 <<= 8;
+ if (hold_index < hold_count){
+ c3 = hold_buf[hold_index++];
+ } else if ((c3 = (*i_getc)(f)) == EOF) {
+ c0 = ret = EOF;
+ break;
+ } else {
+ code_status(c3);
+ (*iconv)(c2, c1, c0|c3);
+ }
+ }
+ break;
+ case -1:
+ /* 3 bytes EUC or UTF-8 */
+ if (hold_index < hold_count){
+ c0 = hold_buf[hold_index++];
+ } else if ((c0 = (*i_getc)(f)) == EOF) {
+ ret = EOF;
+ break;
+ } else {
code_status(c0);
}
(*iconv)(c2, c1, c0);
- c1 = c0;
- }
+ break;
+ }
+ if (c0 == EOF) break;
}
- return c3;
+ return ret;
}
-
-
-int
-push_hold_buf(c2)
- int c2;
+nkf_char push_hold_buf(nkf_char c2)
{
if (hold_count >= HOLD_SIZE*2)
return (EOF);
- hold_buf[hold_count++] = c2;
+ hold_buf[hold_count++] = (unsigned char)c2;
return ((hold_count >= HOLD_SIZE*2) ? EOF : hold_count);
}
-int s2e_conv(c2, c1, p2, p1)
- int c2, c1;
- int *p2, *p1;
+nkf_char s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
{
- int val;
+#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 (cp932_f && CP932_TABLE_BEGIN <= c2 && c2 <= CP932_TABLE_END){
- extern unsigned short shiftjis_cp932[3][189];
+ if (!cp932inv_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 (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];
+ if (c){
+ c2 = c >> 8;
+ c1 = c & 0xff;
+ }
+ }
#endif /* SHIFTJIS_CP932 */
#ifdef X0212_ENABLE
- if (x0212_f && 0xfa <= c2 && c2 <= 0xfc){
- extern unsigned short shiftjis_x0212[3][189];
+ 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 & 0x8000){
- c2 = (0x8f << 8) | (val >> 8);
+ if (val > 0x7FFF){
+ c2 = PREFIX_EUCG3 | ((val >> 8) & 0x7f);
c1 = val & 0xff;
}else{
c2 = val >> 8;
@@ -2368,45 +3166,53 @@ int s2e_conv(c2, c1, p2, p1)
}
}
#endif
- c2 = c2 + c2 - ((c2 <= 0x9f) ? SJ0162 : SJ6394);
- if (c1 < 0x9f)
- c1 = c1 - ((c1 > DEL) ? SPACE : 0x1f);
- else {
- c1 = c1 - 0x7e;
- c2++;
+ 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
- if (x0212_f){
- c2 = x0212_unshift(c2);
- }
+ c2 = x0212_unshift(c2);
#endif
if (p2) *p2 = c2;
if (p1) *p1 = c1;
return 0;
}
-int
-s_iconv(c2, c1, c0)
- int c2,
- c1, c0;
+nkf_char s_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
{
if (c2 == X0201) {
c1 &= 0x7f;
} else if ((c2 == EOF) || (c2 == 0) || c2 < SPACE) {
/* NOP */
+ } else if (!x0213_f && 0xF0 <= c2 && c2 <= 0xF9 && 0x40 <= c1 && c1 <= 0xFC) {
+ /* CP932 UDC */
+ if(c1 == 0x7F) return 0;
+ c1 = (c2 - 0xF0) * 188 + (c1 - 0x40 - (0x7E < c1)) + 0xE000 + CLASS_UNICODE;
+ c2 = 0;
} else {
- int ret = s2e_conv(c2, c1, &c2, &c1);
+ nkf_char ret = s2e_conv(c2, c1, &c2, &c1);
if (ret) return ret;
}
(*oconv)(c2, c1);
return 0;
}
-int
-e_iconv(c2, c1, c0)
- int c2,
- c1, c0;
+nkf_char e_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
{
if (c2 == X0201) {
c1 &= 0x7f;
@@ -2415,20 +3221,26 @@ e_iconv(c2, c1, c0)
if (c0 == 0){
return -1;
}
- c2 = (c2 << 8) | (c1 & 0x7f);
- c1 = c0 & 0x7f;
+ if (!cp51932_f && !x0213_f && 0xF5 <= c1 && c1 <= 0xFE && 0xA1 <= c0 && c0 <= 0xFE) {
+ /* encoding is eucJP-ms, so invert to Unicode Private User Area */
+ c1 = (c1 - 0xF5) * 94 + c0 - 0xA1 + 0xE3AC + CLASS_UNICODE;
+ c2 = 0;
+ } else {
+ c2 = (c2 << 8) | (c1 & 0x7f);
+ c1 = c0 & 0x7f;
#ifdef SHIFTJIS_CP932
- if (cp932_f){
- int s2, s1;
- if (e2s_conv(c2, c1, &s2, &s1) == 0){
- s2e_conv(s2, s1, &c2, &c1);
- if ((c2 & 0xff00) == 0){
- c1 &= 0x7f;
- c2 &= 0x7f;
- }
- }
- }
+ 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;
@@ -2436,66 +3248,126 @@ e_iconv(c2, c1, c0)
} else if ((c2 == EOF) || (c2 == 0) || c2 < SPACE) {
/* NOP */
} else {
- c1 &= 0x7f;
- c2 &= 0x7f;
+ if (!cp51932_f && ms_ucs_map_f && 0xF5 <= c2 && c2 <= 0xFE && 0xA1 <= c1 && c1 <= 0xFE) {
+ /* encoding is eucJP-ms, so invert to Unicode Private User Area */
+ c1 = (c2 - 0xF5) * 94 + c1 - 0xA1 + 0xE000 + CLASS_UNICODE;
+ c2 = 0;
+ } else {
+ c1 &= 0x7f;
+ c2 &= 0x7f;
+#ifdef SHIFTJIS_CP932
+ if (cp51932_f && 0x79 <= c2 && c2 <= 0x7c){
+ 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 */
+ }
}
(*oconv)(c2, c1);
return 0;
}
#ifdef UTF8_INPUT_ENABLE
-int
-w2e_conv(c2, c1, c0, p2, p1)
- int c2, c1, c0;
- int *p2, *p1;
+nkf_char w2e_conv(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
{
- extern unsigned short * utf8_to_euc_2bytes[];
- extern unsigned short ** utf8_to_euc_3bytes[];
- int ret = 0;
-
- if (0xc0 <= c2 && c2 <= 0xef) {
- unsigned short **pp;
+ nkf_char ret = 0;
- 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);
- }
+ if (!c1){
+ *p2 = 0;
+ *p1 = c2;
+ }else if (0xc0 <= c2 && c2 <= 0xef) {
+ ret = unicode_to_jis_common(c2, c1, c0, p2, p1);
#ifdef NUMCHAR_OPTION
- if (ret){
+ if (ret > 0){
if (p2) *p2 = 0;
- if (p1) *p1 = CLASS_UTF16 | ww16_conv(c2, c1, c0);
+ if (p1) *p1 = CLASS_UNICODE | 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;
}
-int
-w_iconv(c2, c1, c0)
- int c2,
- c1, c0;
+nkf_char w_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
{
- int ret = w2e_conv(c2, c1, c0, &c2, &c1);
+ nkf_char ret = 0;
+ static const int w_iconv_utf8_1st_byte[] =
+ { /* 0xC0 - 0xFF */
+ 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 33,
+ 40, 41, 41, 41, 42, 43, 43, 43, 50, 50, 50, 50, 60, 60, 70, 70};
+
+ if (c2 < 0 || 0xff < c2) {
+ }else if (c2 == 0) { /* 0 : 1 byte*/
+ c0 = 0;
+ } else if ((c2 & 0xc0) == 0x80) { /* 0x80-0xbf : trail byte */
+ return 0;
+ } else{
+ switch (w_iconv_utf8_1st_byte[c2 - 0xC0]) {
+ case 21:
+ if (c1 < 0x80 || 0xBF < c1) return 0;
+ break;
+ case 30:
+ if (c0 == 0) return -1;
+ if (c1 < 0xA0 || 0xBF < c1 || (c0 & 0xc0) != 0x80)
+ return 0;
+ break;
+ case 31:
+ case 33:
+ if (c0 == 0) return -1;
+ if ((c1 & 0xc0) != 0x80 || (c0 & 0xc0) != 0x80)
+ return 0;
+ break;
+ case 32:
+ if (c0 == 0) return -1;
+ if (c1 < 0x80 || 0x9F < c1 || (c0 & 0xc0) != 0x80)
+ return 0;
+ break;
+ case 40:
+ if (c0 == 0) return -2;
+ if (c1 < 0x90 || 0xBF < c1 || (c0 & 0xc0c0) != 0x8080)
+ return 0;
+ break;
+ case 41:
+ if (c0 == 0) return -2;
+ if (c1 < 0x80 || 0xBF < c1 || (c0 & 0xc0c0) != 0x8080)
+ return 0;
+ break;
+ case 42:
+ if (c0 == 0) return -2;
+ if (c1 < 0x80 || 0x8F < c1 || (c0 & 0xc0c0) != 0x8080)
+ return 0;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ if (c2 == 0 || c2 == EOF){
+ } else if ((c2 & 0xf8) == 0xf0) { /* 4 bytes */
+ c1 = CLASS_UNICODE | ww16_conv(c2, c1, c0);
+ c2 = 0;
+ } else {
+ ret = w2e_conv(c2, c1, c0, &c2, &c1);
+ }
if (ret == 0){
(*oconv)(c2, c1);
}
return ret;
}
+#endif
-void
-w16w_conv(val, p2, p1, p0)
- unsigned short val;
- int *p2, *p1, *p0;
+#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
+void w16w_conv(nkf_char val, nkf_char *p2, nkf_char *p1, nkf_char *p0)
{
+ val &= VALUE_MASK;
if (val < 0x80){
*p2 = val;
*p1 = 0;
@@ -2504,19 +3376,35 @@ w16w_conv(val, p2, p1, p0)
*p2 = 0xc0 | (val >> 6);
*p1 = 0x80 | (val & 0x3f);
*p0 = 0;
- }else{
+ } else if (val <= NKF_INT32_C(0xFFFF)) {
*p2 = 0xe0 | (val >> 12);
*p1 = 0x80 | ((val >> 6) & 0x3f);
*p0 = 0x80 | (val & 0x3f);
+ } else if (val <= NKF_INT32_C(0x10FFFF)) {
+ *p2 = 0xe0 | (val >> 16);
+ *p1 = 0x80 | ((val >> 12) & 0x3f);
+ *p0 = 0x8080 | ((val << 2) & 0x3f00)| (val & 0x3f);
+ } else {
+ *p2 = 0;
+ *p1 = 0;
+ *p0 = 0;
}
}
+#endif
-int
-ww16_conv(c2, c1, c0)
- int c2, c1, c0;
+#ifdef UTF8_INPUT_ENABLE
+nkf_char ww16_conv(nkf_char c2, nkf_char c1, nkf_char c0)
{
- unsigned short val;
- if (c2 >= 0xe0){
+ nkf_char val;
+ if (c2 >= 0xf8) {
+ val = -1;
+ } else if (c2 >= 0xf0){
+ /* c2: 1st, c1: 2nd, c0: 3rd/4th */
+ val = (c2 & 0x0f) << 18;
+ val |= (c1 & 0x3f) << 12;
+ val |= (c0 & 0x3f00) >> 2;
+ val |= (c0 & 0x3f);
+ }else if (c2 >= 0xe0){
val = (c2 & 0x0f) << 12;
val |= (c1 & 0x3f) << 6;
val |= (c0 & 0x3f);
@@ -2529,79 +3417,205 @@ ww16_conv(c2, c1, c0)
return val;
}
-int
-w16e_conv(val, p2, p1)
- unsigned short val;
- int *p2, *p1;
+nkf_char w16e_conv(nkf_char val, nkf_char *p2, nkf_char *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);
- }
+ 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);
#ifdef NUMCHAR_OPTION
- if (ret){
- *p2 = 0;
- *p1 = CLASS_UTF16 | val;
- ret = 0;
- }
+ if (ret > 0){
+ *p2 = 0;
+ *p1 = CLASS_UNICODE | val;
+ ret = 0;
+ }
#endif
- }else{
- *p2 = 0;
- *p1 = c2;
}
return ret;
}
+#endif
-int
-w_iconv16(c2, c1, c0)
- int c2, c1,c0;
+#ifdef UTF8_INPUT_ENABLE
+nkf_char w_iconv16(nkf_char c2, nkf_char c1, nkf_char c0)
{
- int ret;
-
- 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 != EOF && utf16_mode == UTF16LE_INPUT) {
- int tmp;
- tmp=c1; c1=c2; c2=tmp;
- }
+ nkf_char ret = 0;
if ((c2==0 && c1 < 0x80) || c2==EOF) {
(*oconv)(c2, c1);
return 0;
+ }else if (0xD8 <= c2 && c2 <= 0xDB) {
+ if (c0 < NKF_INT32_C(0xDC00) || NKF_INT32_C(0xDFFF) < c0)
+ return -2;
+ c1 = CLASS_UNICODE | ((c2 << 18) + (c1 << 10) + c0 - NKF_INT32_C(0x35FDC00));
+ c2 = 0;
+ }else if ((c2>>3) == 27) { /* unpaired surrogate */
+ /*
+ return 2;
+ */
+ return 1;
+ }else ret = w16e_conv(((c2 & 0xff)<<8) + c1, &c2, &c1);
+ if (ret) return ret;
+ (*oconv)(c2, c1);
+ return 0;
+}
+
+nkf_char w_iconv32(nkf_char c2, nkf_char c1, nkf_char c0)
+{
+ int ret = 0;
+
+ if ((c2 == 0 && c1 < 0x80) || c2==EOF) {
+ } else if (is_unicode_bmp(c1)) {
+ ret = w16e_conv(c1, &c2, &c1);
+ } else {
+ c2 = 0;
+ c1 = CLASS_UNICODE | c1;
}
- ret = w16e_conv(((c2<<8)&0xff00) + c1, &c2, &c1);
if (ret) return ret;
(*oconv)(c2, c1);
return 0;
}
-int
-w_iconv_common(c1, c0, pp, psize, p2, p1)
- int c1,c0;
- unsigned short **pp;
- int psize;
- int *p2, *p1;
+nkf_char unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
{
- int c2;
- unsigned short *p ;
+#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(!cp932inv_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 && !cp932inv_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 && !cp932inv_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;
unsigned short val;
if (pp == 0) return 1;
@@ -2612,14 +3626,18 @@ w_iconv_common(c1, c0, pp, psize, p2, p1)
if (p == 0) return 1;
c0 -= 0x80;
- if (c0 < 0 || sizeof_utf8_to_euc_E5B8 <= c0) return 1;
+ if (c0 < 0 || sizeof_utf8_to_euc_C2 <= 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 & 0x8000){
+ if (val > 0x7FFF){
c2 &= 0x7f;
- c2 |= 0x8f00;
+ c2 |= PREFIX_EUCG3;
}
if (c2 == SO) c2 = X0201;
c1 = val & 0x7f;
@@ -2628,23 +3646,114 @@ w_iconv_common(c1, c0, pp, psize, p2, p1)
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
-int
-e2w_conv(c2, c1)
- int c2, c1;
+nkf_char e2w_conv(nkf_char c2, nkf_char c1)
{
- 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 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;
if (c2 == X0201) {
p = euc_to_utf8_1byte;
#ifdef X0212_ENABLE
- } else if (c2 >> 8 == 0x8f){
- extern unsigned short * x0212_to_utf8_2bytes[];
+ } 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];
@@ -2655,7 +3764,7 @@ e2w_conv(c2, c1)
c2 &= 0x7f;
c2 = (c2&0x7f) - 0x21;
if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes)
- p = ms_ucs_map_f ? euc_to_utf8_2bytes_ms[c2] : euc_to_utf8_2bytes[c2];
+ p = ms_ucs_map_f != UCS_MAP_ASCII ? euc_to_utf8_2bytes_ms[c2] : euc_to_utf8_2bytes[c2];
else
return 0;
}
@@ -2666,31 +3775,40 @@ e2w_conv(c2, c1)
return 0;
}
-void
-w_oconv(c2, c1)
- int c2,
- c1;
+void w_oconv(nkf_char c2, nkf_char c1)
{
- int c0;
- if (c2 == EOF) {
- (*o_putc)(EOF);
- return;
- }
+ nkf_char c0;
+ nkf_char val;
- if (unicode_bom_f==2) {
- (*o_putc)('\357');
+ if (output_bom_f) {
+ output_bom_f = FALSE;
+ (*o_putc)('\357');
(*o_putc)('\273');
(*o_putc)('\277');
- unicode_bom_f=1;
+ }
+
+ if (c2 == EOF) {
+ (*o_putc)(EOF);
+ return;
}
#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);
+ 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)(0xF0 | ( val>>18));
+ (*o_putc)(0x80 | ((val>>12) & 0x3f));
+ (*o_putc)(0x80 | ((val>> 6) & 0x3f));
+ (*o_putc)(0x80 | ( val & 0x3f));
}
return;
}
@@ -2703,9 +3821,8 @@ w_oconv(c2, c1)
output_mode = ISO8859_1;
(*o_putc)(c1 | 0x080);
} else {
- unsigned short val;
output_mode = UTF8;
- val = e2w_conv(c2, c1);
+ val = e2w_conv(c2, c1);
if (val){
w16w_conv(val, &c2, &c1, &c0);
(*o_putc)(c2);
@@ -2717,41 +3834,59 @@ w_oconv(c2, c1)
}
}
-void
-w_oconv16(c2, c1)
- int c2,
- c1;
+void w_oconv16(nkf_char c2, nkf_char c1)
{
- if (c2 == EOF) {
- (*o_putc)(EOF);
- return;
- }
-
- if (unicode_bom_f==2) {
- if (w_oconv16_LE){
+ if (output_bom_f) {
+ output_bom_f = FALSE;
+ if (output_endian == ENDIAN_LITTLE){
(*o_putc)((unsigned char)'\377');
(*o_putc)('\376');
}else{
(*o_putc)('\376');
(*o_putc)((unsigned char)'\377');
}
- unicode_bom_f=1;
+ }
+
+ if (c2 == EOF) {
+ (*o_putc)(EOF);
+ return;
}
if (c2 == ISO8859_1) {
c2 = 0;
c1 |= 0x80;
#ifdef NUMCHAR_OPTION
- } else if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16) {
- c2 = (c1 >> 8) & 0xff;
- c1 &= 0xff;
+ } 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 (output_endian == ENDIAN_LITTLE){
+ (*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;
+ }
#endif
} else if (c2) {
- unsigned short val = e2w_conv(c2, c1);
+ nkf_char val = e2w_conv(c2, c1);
c2 = (val >> 8) & 0xff;
c1 = val & 0xff;
+ if (!val) return;
}
- if (w_oconv16_LE){
+ if (output_endian == ENDIAN_LITTLE){
(*o_putc)(c1);
(*o_putc)(c2);
}else{
@@ -2760,18 +3895,78 @@ w_oconv16(c2, c1)
}
}
+void w_oconv32(nkf_char c2, nkf_char c1)
+{
+ if (output_bom_f) {
+ output_bom_f = FALSE;
+ if (output_endian == ENDIAN_LITTLE){
+ (*o_putc)((unsigned char)'\377');
+ (*o_putc)('\376');
+ (*o_putc)('\000');
+ (*o_putc)('\000');
+ }else{
+ (*o_putc)('\000');
+ (*o_putc)('\000');
+ (*o_putc)('\376');
+ (*o_putc)((unsigned char)'\377');
+ }
+ }
+
+ if (c2 == EOF) {
+ (*o_putc)(EOF);
+ return;
+ }
+
+ if (c2 == ISO8859_1) {
+ c1 |= 0x80;
+#ifdef NUMCHAR_OPTION
+ } else if (c2 == 0 && is_unicode_capsule(c1)) {
+ c1 &= VALUE_MASK;
+#endif
+ } else if (c2) {
+ c1 = e2w_conv(c2, c1);
+ if (!c1) return;
+ }
+ if (output_endian == ENDIAN_LITTLE){
+ (*o_putc)( c1 & NKF_INT32_C(0x000000FF));
+ (*o_putc)((c1 & NKF_INT32_C(0x0000FF00)) >> 8);
+ (*o_putc)((c1 & NKF_INT32_C(0x00FF0000)) >> 16);
+ (*o_putc)('\000');
+ }else{
+ (*o_putc)('\000');
+ (*o_putc)((c1 & NKF_INT32_C(0x00FF0000)) >> 16);
+ (*o_putc)((c1 & NKF_INT32_C(0x0000FF00)) >> 8);
+ (*o_putc)( c1 & NKF_INT32_C(0x000000FF));
+ }
+}
#endif
-void
-e_oconv(c2, c1)
- int c2,
- c1;
+void e_oconv(nkf_char c2, nkf_char c1)
{
#ifdef NUMCHAR_OPTION
- if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){
+ if (c2 == 0 && is_unicode_capsule(c1)){
w16e_conv(c1, &c2, &c1);
- if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){
- return;
+ if (c2 == 0 && is_unicode_capsule(c1)){
+ c2 = c1 & VALUE_MASK;
+ if (x0212_f && 0xE000 <= c2 && c2 <= 0xE757) {
+ /* eucJP-ms UDC */
+ c1 &= 0xFFF;
+ c2 = c1 / 94;
+ c2 += c2 < 10 ? 0x75 : 0x8FEB;
+ c1 = 0x21 + c1 % 94;
+ if (is_eucg3(c2)){
+ (*o_putc)(0x8f);
+ (*o_putc)((c2 & 0x7f) | 0x080);
+ (*o_putc)(c1 | 0x080);
+ }else{
+ (*o_putc)((c2 & 0x7f) | 0x080);
+ (*o_putc)(c1 | 0x080);
+ }
+ return;
+ } else {
+ if (encode_fallback) (*encode_fallback)(c1);
+ return;
+ }
}
}
#endif
@@ -2788,17 +3983,20 @@ e_oconv(c2, c1)
output_mode = ISO8859_1;
(*o_putc)(c1 | 0x080);
#ifdef X0212_ENABLE
- } else if ((c2 & 0xff00) >> 8 == 0x8f){
+ } else if (is_eucg3(c2)){
output_mode = JAPANESE_EUC;
#ifdef SHIFTJIS_CP932
- if (cp932_f){
- int s2, s1;
+ if (!cp932inv_f){
+ nkf_char s2, s1;
if (e2s_conv(c2, c1, &s2, &s1) == 0){
s2e_conv(s2, s1, &c2, &c1);
}
}
#endif
- if ((c2 & 0xff00) >> 8 == 0x8f){
+ 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);
@@ -2810,8 +4008,7 @@ e_oconv(c2, c1)
}
#endif
} else {
- if ((c1<0x21 || 0x7e<c1) ||
- (c2<0x21 || 0x7e<c2)) {
+ if (!nkf_isgraph(c1) || !nkf_isgraph(c2)) {
set_iconv(FALSE, 0);
return; /* too late to rescue this char */
}
@@ -2822,12 +4019,11 @@ e_oconv(c2, c1)
}
#ifdef X0212_ENABLE
-int x0212_shift(c)
- int c;
+nkf_char x0212_shift(nkf_char c)
{
- int ret = c;
+ nkf_char ret = c;
c &= 0x7f;
- if ((ret & 0xff00) == 0x8f00){
+ if (is_eucg3(ret)){
if (0x75 <= c && c <= 0x7f){
ret = c + (0x109 - 0x75);
}
@@ -2840,62 +4036,84 @@ int x0212_shift(c)
}
-int x0212_unshift(c)
- int c;
+nkf_char x0212_unshift(nkf_char c)
{
- int ret = c;
+ nkf_char ret = c;
if (0x7f <= c && c <= 0x88){
ret = c + (0x75 - 0x7f);
}else if (0x89 <= c && c <= 0x92){
- ret = (0x8f << 8) | 0x80 | (c + (0x75 - 0x89));
+ ret = PREFIX_EUCG3 | 0x80 | (c + (0x75 - 0x89));
}
return ret;
}
#endif /* X0212_ENABLE */
-int
-e2s_conv(c2, c1, p2, p1)
- int c2, c1, *p2, *p1;
+nkf_char e2s_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
{
- int val = 0;
- unsigned short *ptr;
- int ndx;
- extern unsigned short *x0212_shiftjis[];
+ nkf_char ndx;
+ if (is_eucg3(c2)){
+ ndx = c2 & 0x7f;
+ 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
- if ((c2 & 0xff00) == 0x8f00){
- ndx = c2 & 0x7f;
- if (0x21 <= ndx && ndx <= 0x7e){
- 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);
- }
+ 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 ((c2 & 0xff00) == 0x8f00){
- return 1;
}
+ 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(c2, c1)
- int c2,
- c1;
+void s_oconv(nkf_char c2, nkf_char c1)
{
#ifdef NUMCHAR_OPTION
- if (c2 == 0 && (c1 & CLASS_MASK) == CLASS_UTF16){
+ if (c2 == 0 && is_unicode_capsule(c1)){
w16e_conv(c1, &c2, &c1);
+ if (c2 == 0 && is_unicode_capsule(c1)){
+ c2 = c1 & VALUE_MASK;
+ if (!x0213_f && 0xE000 <= c2 && c2 <= 0xE757) {
+ /* CP932 UDC */
+ c1 &= 0xFFF;
+ c2 = c1 / 188 + 0xF0;
+ c1 = c1 % 188;
+ c1 += 0x40 + (c1 > 0x3e);
+ (*o_putc)(c2);
+ (*o_putc)(c1);
+ return;
+ } else {
+ if(encode_fallback)(*encode_fallback)(c1);
+ return;
+ }
+ }
}
#endif
if (c2 == EOF) {
@@ -2911,7 +4129,7 @@ s_oconv(c2, c1)
output_mode = ISO8859_1;
(*o_putc)(c1 | 0x080);
#ifdef X0212_ENABLE
- } else if ((c2 & 0xff00) >> 8 == 0x8f){
+ } else if (is_eucg3(c2)){
output_mode = SHIFT_JIS;
if (e2s_conv(c2, c1, &c2, &c1) == 0){
(*o_putc)(c2);
@@ -2919,8 +4137,7 @@ s_oconv(c2, c1)
}
#endif
} else {
- if ((c1<0x20 || 0x7e<c1) ||
- (c2<0x20 || 0x7e<c2)) {
+ if (!nkf_isprint(c1) || !nkf_isprint(c2)) {
set_iconv(FALSE, 0);
return; /* too late to rescue this char */
}
@@ -2930,8 +4147,10 @@ s_oconv(c2, c1)
#ifdef SHIFTJIS_CP932
if (cp932inv_f
&& CP932INV_TABLE_BEGIN <= c2 && c2 <= CP932INV_TABLE_END){
- extern unsigned short cp932inv[2][189];
- int c = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
+#if 0
+ extern const unsigned short cp932inv[2][189];
+#endif
+ nkf_char c = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
if (c){
c2 = c >> 8;
c1 = c & 0xff;
@@ -2947,14 +4166,23 @@ s_oconv(c2, c1)
}
}
-void
-j_oconv(c2, c1)
- int c2,
- c1;
+void j_oconv(nkf_char c2, nkf_char c1)
{
#ifdef NUMCHAR_OPTION
- if ((c1 & CLASS_MASK) == CLASS_UTF16){
+ if (c2 == 0 && is_unicode_capsule(c1)){
w16e_conv(c1, &c2, &c1);
+ if (c2 == 0 && is_unicode_capsule(c1)){
+ c2 = c1 & VALUE_MASK;
+ if (ms_ucs_map_f && 0xE000 <= c2 && c2 <= 0xE757) {
+ /* CP5022x UDC */
+ c1 &= 0xFFF;
+ c2 = 0x7F + c1 / 94;
+ c1 = 0x21 + c1 % 94;
+ } else {
+ if (encode_fallback) (*encode_fallback)(c1);
+ return;
+ }
+ }
}
#endif
if (c2 == EOF) {
@@ -2966,13 +4194,23 @@ j_oconv(c2, c1)
}
(*o_putc)(EOF);
#ifdef X0212_ENABLE
- } else if ((c2 & 0xff00) >> 8 == 0x8f){
- if (output_mode!=X0212) {
- output_mode = X0212;
- (*o_putc)(ESC);
- (*o_putc)('$');
- (*o_putc)('(');
- (*o_putc)('D');
+ } 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);
@@ -3000,39 +4238,41 @@ j_oconv(c2, c1)
}
(*o_putc)(c1);
} else {
- if (output_mode != X0208) {
+ if(ms_ucs_map_f
+ ? c2<0x20 || 0x92<c2 || c1<0x20 || 0x7e<c1
+ : 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) {
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(c2, c1)
- int c2,
- c1;
+void base64_conv(nkf_char c2, nkf_char c1)
{
mime_prechar(c2, c1);
(*o_base64conv)(c2,c1);
}
-static int broken_buf[3];
+static nkf_char broken_buf[3];
static int broken_counter = 0;
static int broken_last = 0;
-int
-broken_getc(f)
-FILE *f;
+nkf_char broken_getc(FILE *f)
{
- int c,c1;
+ nkf_char c,c1;
if (broken_counter>0) {
return broken_buf[--broken_counter];
@@ -3068,21 +4308,16 @@ FILE *f;
}
}
-int
-broken_ungetc(c,f)
-int c;
-FILE *f;
+nkf_char broken_ungetc(nkf_char c, FILE *f)
{
if (broken_counter<2)
broken_buf[broken_counter++]=c;
return c;
}
-static int prev_cr = 0;
+static nkf_char prev_cr = 0;
-void
-cr_conv(c2,c1)
-int c2,c1;
+void cr_conv(nkf_char c2, nkf_char c1)
{
if (prev_cr) {
prev_cr = 0;
@@ -3129,12 +4364,10 @@ int c2,c1;
#define char_size(c2,c1) (c2?2:1)
-void
-fold_conv(c2,c1)
-int c2,c1;
+void fold_conv(nkf_char c2, nkf_char c1)
{
- int prev0;
- int fold_state=0;
+ nkf_char prev0;
+ nkf_char fold_state;
if (c1== '\r' && !fold_preserve_f) {
fold_state=0; /* ignore cr */
@@ -3182,8 +4415,6 @@ int c2,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==' ')||
@@ -3210,7 +4441,7 @@ int c2,c1;
if (f_line<=fold_len) { /* normal case */
fold_state = 1;
} else {
- if (f_line>=fold_len+fold_margin) { /* too many kinsou suspension */
+ if (f_line>fold_len+fold_margin) { /* too many kinsoku suspension */
f_line = char_size(c2,c1);
fold_state = '\n'; /* We can't wait, do fold now */
} else if (c2==X0201) {
@@ -3301,11 +4532,9 @@ int c2,c1;
}
}
-int z_prev2=0,z_prev1=0;
+nkf_char z_prev2=0,z_prev1=0;
-void
-z_conv(c2,c1)
-int c2,c1;
+void z_conv(nkf_char c2, nkf_char c1)
{
/* if (c2) c1 &= 0x7f; assertion */
@@ -3394,9 +4623,7 @@ int c2,c1;
c \
)
-void
-rot_conv(c2,c1)
-int c2,c1;
+void rot_conv(nkf_char c2, nkf_char c1)
{
if (c2==0 || c2==X0201 || c2==ISO8859_1) {
c1 = rot13(c1);
@@ -3407,24 +4634,43 @@ int c2,c1;
(*o_rot_conv)(c2,c1);
}
-void
-hira_conv(c2,c1)
-int c2,c1;
+void hira_conv(nkf_char c2, nkf_char c1)
{
- 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;
- }
+ 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_UNICODE | 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_UNICODE | 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;
+ }
+ }
(*o_hira_conv)(c2,c1);
}
-void
-iso2022jp_check_conv(c2,c1)
-int c2, c1;
+void iso2022jp_check_conv(nkf_char c2, nkf_char c1)
{
- static int range[RANGE_NUM_MAX][2] = {
+ static const nkf_char range[RANGE_NUM_MAX][2] = {
{0x222f, 0x2239,},
{0x2242, 0x2249,},
{0x2251, 0x225b,},
@@ -3444,8 +4690,8 @@ int c2, c1;
{0x4f54, 0x4f7e,},
{0x7425, 0x747e},
};
- int i;
- int start, end, c;
+ nkf_char i;
+ nkf_char start, end, c;
if(c2 >= 0x00 && c2 <= 0x20 && c1 >= 0x7f && c1 <= 0xff) {
c2 = GETA1;
@@ -3471,43 +4717,43 @@ int c2, c1;
/* This converts =?ISO-2022-JP?B?HOGE HOGE?= */
-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
+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
};
/* $B3:Ev$9$k%3!<%I$NM%@hEY$r>e$2$k$?$a$NL\0u(B */
-int (*mime_priority_func[])PROTO((int c2, int c1, int c0)) = {
+nkf_char (*mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = {
e_iconv, s_iconv, 0, 0, 0, 0,
-#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
+#if defined(UTF8_INPUT_ENABLE)
w_iconv, w_iconv,
#endif
0,
};
-int mime_encode[] = {
+const nkf_char mime_encode[] = {
JAPANESE_EUC, SHIFT_JIS,ISO8859_1, ISO8859_1, X0208, X0201,
-#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
+#if defined(UTF8_INPUT_ENABLE)
UTF8, UTF8,
#endif
ASCII,
0
};
-int mime_encode_method[] = {
+const nkf_char mime_encode_method[] = {
'B', 'B','Q', 'B', 'B', 'Q',
-#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
+#if defined(UTF8_INPUT_ENABLE)
'B', 'Q',
#endif
'Q',
@@ -3517,17 +4763,7 @@ int mime_encode_method[] = {
#define MAXRECOVER 20
-/* 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'))
-#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))
-
-void
-switch_mime_getc()
+void switch_mime_getc(void)
{
if (i_getc!=mime_getc) {
i_mgetc = i_getc; i_getc = mime_getc;
@@ -3539,8 +4775,7 @@ switch_mime_getc()
}
}
-void
-unswitch_mime_getc()
+void unswitch_mime_getc(void)
{
if(mime_f==STRICT_MIME) {
i_mgetc = i_mgetc_buf;
@@ -3548,16 +4783,16 @@ unswitch_mime_getc()
}
i_getc = i_mgetc;
i_ungetc = i_mungetc;
+ if(mime_iconv_back)set_iconv(FALSE, mime_iconv_back);
+ mime_iconv_back = NULL;
}
-int
-mime_begin_strict(f)
-FILE *f;
+nkf_char mime_begin_strict(FILE *f)
{
- int c1 = 0;
+ nkf_char c1 = 0;
int i,j,k;
- unsigned char *p,*q;
- int r[MAXRECOVER]; /* recovery buffer, max mime pattern lenght */
+ const unsigned char *p,*q;
+ nkf_char r[MAXRECOVER]; /* recovery buffer, max mime pattern length */
mime_decode_mode = FALSE;
/* =? has been checked */
@@ -3569,11 +4804,13 @@ FILE *f;
if ( ((r[i] = c1 = (*i_getc)(f))==EOF) || nkf_toupper(c1) != p[i] ) {
/* pattern fails, try next one */
q = p;
- while ((p = mime_pattern[++j])) {
+ while (mime_pattern[++j]) {
+ 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);
@@ -3585,6 +4822,7 @@ 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);
@@ -3600,9 +4838,7 @@ FILE *f;
return c1;
}
-int
-mime_getc_buf(f)
-FILE *f;
+nkf_char mime_getc_buf(FILE *f)
{
/* we don't keep eof of Fifo, becase it contains ?= as
a terminator. It was checked in mime_integrity. */
@@ -3610,23 +4846,18 @@ FILE *f;
(*i_mgetc_buf)(f):Fifo(mime_input++));
}
-int
-mime_ungetc_buf(c,f)
-FILE *f;
-int c;
+nkf_char mime_ungetc_buf(nkf_char c, FILE *f)
{
if (mimebuf_f)
(*i_mungetc_buf)(c,f);
else
- Fifo(--mime_input)=c;
+ Fifo(--mime_input) = (unsigned char)c;
return c;
}
-int
-mime_begin(f)
-FILE *f;
+nkf_char mime_begin(FILE *f)
{
- int c1;
+ nkf_char c1;
int i,k;
/* In NONSTRICT mode, only =? is checked. In case of failure, we */
@@ -3637,7 +4868,7 @@ 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++)= c1 ;
+ c1 = (*i_getc)(f); Fifo(mime_last++) = (unsigned char)c1;
if (c1=='\n'||c1==' '||c1=='\r'||
c1=='-'||c1=='_'||is_alnum(c1) ) continue;
if (c1=='=') {
@@ -3649,7 +4880,7 @@ FILE *f;
if (c1!='?') break;
else {
/* c1=='?' */
- c1 = (*i_getc)(f); Fifo(mime_last++) = c1;
+ c1 = (*i_getc)(f); Fifo(mime_last++) = (unsigned char)c1;
if (!(++i<MAXRECOVER) || c1==EOF) break;
if (c1=='b'||c1=='B') {
mime_decode_mode = 'B';
@@ -3658,7 +4889,7 @@ FILE *f;
} else {
break;
}
- c1 = (*i_getc)(f); Fifo(mime_last++) = c1;
+ c1 = (*i_getc)(f); Fifo(mime_last++) = (unsigned char)c1;
if (!(++i<MAXRECOVER) || c1==EOF) break;
if (c1!='?') {
mime_decode_mode = FALSE;
@@ -3681,15 +4912,12 @@ FILE *f;
}
#ifdef CHECK_OPTION
-void
-no_putc(c)
- int c;
+void no_putc(nkf_char c)
{
;
}
-void debug(str)
- char *str;
+void debug(const char *str)
{
if (debug_f){
fprintf(stderr, "%s\n", str);
@@ -3697,9 +4925,7 @@ void debug(str)
}
#endif
-void
-set_input_codename (codename)
- char *codename;
+void set_input_codename(char *codename)
{
if (guess_f &&
is_inputcode_set &&
@@ -3712,10 +4938,8 @@ set_input_codename (codename)
is_inputcode_set = TRUE;
}
-#ifndef WIN32DLL
-void
-print_guessed_code (filename)
- char *filename;
+#if !defined(PERL_XS) && !defined(WIN32DLL)
+void print_guessed_code(char *filename)
{
char *codename = "BINARY";
if (!is_inputcode_mixed) {
@@ -3730,28 +4954,11 @@ print_guessed_code (filename)
}
#endif /*WIN32DLL*/
-int
-hex2bin(x)
- int x;
-{
- if (nkf_isdigit(x)) return x - '0';
- return nkf_toupper(x) - 'A' + 10;
-}
-
#ifdef INPUT_OPTION
-#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 hex_getc(nkf_char ch, FILE *f, nkf_char (*g)(FILE *f), nkf_char (*u)(nkf_char c, FILE *f))
{
- int c1, c2, c3;
+ nkf_char c1, c2, c3;
c1 = (*g)(f);
if (c1 != ch){
return c1;
@@ -3770,46 +4977,34 @@ hex_getc(ch, f, g, u)
return (hex2bin(c2) << 4) | hex2bin(c3);
}
-int
-cap_getc(f)
- FILE *f;
+nkf_char cap_getc(FILE *f)
{
return hex_getc(':', f, i_cgetc, i_cungetc);
}
-int
-cap_ungetc(c, f)
- int c;
- FILE *f;
+nkf_char cap_ungetc(nkf_char c, FILE *f)
{
return (*i_cungetc)(c, f);
}
-int
-url_getc(f)
- FILE *f;
+nkf_char url_getc(FILE *f)
{
return hex_getc('%', f, i_ugetc, i_uungetc);
}
-int
-url_ungetc(c, f)
- int c;
- FILE *f;
+nkf_char url_ungetc(nkf_char c, FILE *f)
{
return (*i_uungetc)(c, f);
}
#endif
#ifdef NUMCHAR_OPTION
-int
-numchar_getc(f)
- FILE *f;
+nkf_char numchar_getc(FILE *f)
{
- int (*g)() = i_ngetc;
- int (*u)() = i_nungetc;
+ nkf_char (*g)(FILE *) = i_ngetc;
+ nkf_char (*u)(nkf_char c ,FILE *f) = i_nungetc;
int i = 0, j;
- int buf[8];
+ nkf_char buf[8];
long c = -1;
buf[i] = (*g)(f);
@@ -3819,7 +5014,7 @@ numchar_getc(f)
c = 0;
buf[++i] = (*g)(f);
if (buf[i] == 'x' || buf[i] == 'X'){
- for (j = 0; j < 5; j++){
+ for (j = 0; j < 7; j++){
buf[++i] = (*g)(f);
if (!nkf_isxdigit(buf[i])){
if (buf[i] != ';'){
@@ -3831,7 +5026,7 @@ numchar_getc(f)
c |= hex2bin(buf[i]);
}
}else{
- for (j = 0; j < 6; j++){
+ for (j = 0; j < 8; j++){
if (j){
buf[++i] = (*g)(f);
}
@@ -3848,7 +5043,7 @@ numchar_getc(f)
}
}
if (c != -1){
- return CLASS_UTF16 | c;
+ return CLASS_UNICODE | c;
}
while (i > 0){
(*u)(buf[i], f);
@@ -3857,26 +5052,70 @@ numchar_getc(f)
return buf[0];
}
-int
-numchar_ungetc(c, f)
- int c;
- FILE *f;
+nkf_char numchar_ungetc(nkf_char 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 */
-int
-mime_getc(f)
-FILE *f;
+
+nkf_char
+mime_getc(FILE *f)
{
- int c1, c2, c3, c4, cc;
- int t1, t2, t3, t4, mode, exit_mode;
- int lwsp_count;
+ nkf_char c1, c2, c3, c4, cc;
+ nkf_char t1, t2, t3, t4, mode, exit_mode;
+ nkf_char lwsp_count;
char *lwsp_buf;
char *lwsp_buf_new;
- int lwsp_size = 128;
+ nkf_char lwsp_size = 128;
if (mime_top != mime_last) { /* Something is in FIFO */
return Fifo(mime_top++);
@@ -3894,13 +5133,16 @@ FILE *f;
if (mime_decode_mode == 'Q') {
if ((c1 = (*i_mgetc)(f)) == EOF) return (EOF);
restart_mime_q:
- if (c1=='_') return ' ';
- if (c1!='=' && c1!='?') {
+ 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)) {
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 */
@@ -3940,13 +5182,12 @@ restart_mime_q:
break;
case SPACE:
case TAB:
- lwsp_buf[lwsp_count] = c1;
+ lwsp_buf[lwsp_count] = (unsigned char)c1;
if (lwsp_count++>lwsp_size){
- lwsp_size *= 2;
+ lwsp_size <<= 1;
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;
}
@@ -3956,18 +5197,13 @@ restart_mime_q:
}
break;
}
- 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];
- }
+ 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];
}
free(lwsp_buf);
- lwsp_buf = NULL;
return c1;
}
if (c1=='='&&c2<' ') { /* this is soft wrap */
@@ -3985,9 +5221,7 @@ restart_mime_q:
if ((c3 = (*i_mgetc)(f)) == EOF) return (EOF);
if (c2<=' ') return c2;
mime_decode_mode = 'Q'; /* still in MIME */
-#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));
+ return ((hex2bin(c2)<<4) + hex2bin(c3));
}
if (mime_decode_mode != 'B') {
@@ -4059,13 +5293,12 @@ mime_c2_retry:
break;
case SPACE:
case TAB:
- lwsp_buf[lwsp_count] = c1;
+ lwsp_buf[lwsp_count] = (unsigned char)c1;
if (lwsp_count++>lwsp_size){
- lwsp_size *= 2;
+ lwsp_size <<= 1;
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;
}
@@ -4075,18 +5308,13 @@ mime_c2_retry:
}
break;
}
- 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];
- }
+ 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];
}
free(lwsp_buf);
- lwsp_buf = NULL;
return c1;
}
mime_c3_retry:
@@ -4116,13 +5344,13 @@ mime_c4_retry:
t4 = 0x3f & base64decode(c4);
cc = ((t1 << 2) & 0x0fc) | ((t2 >> 4) & 0x03);
if (c2 != '=') {
- Fifo(mime_last++) = cc;
+ Fifo(mime_last++) = (unsigned char)cc;
cc = ((t2 << 4) & 0x0f0) | ((t3 >> 2) & 0x0f);
if (c3 != '=') {
- Fifo(mime_last++) = cc;
+ Fifo(mime_last++) = (unsigned char)cc;
cc = ((t3 << 6) & 0x0c0) | (t4 & 0x3f);
if (c4 != '=')
- Fifo(mime_last++) = cc;
+ Fifo(mime_last++) = (unsigned char)cc;
}
} else {
return c1;
@@ -4130,26 +5358,21 @@ mime_c4_retry:
return Fifo(mime_top++);
}
-int
-mime_ungetc(c,f)
-int c;
-FILE *f;
+nkf_char mime_ungetc(nkf_char c, FILE *f)
{
- Fifo(--mime_top) = c;
+ Fifo(--mime_top) = (unsigned char)c;
return c;
}
-int
-mime_integrity(f,p)
-FILE *f;
-unsigned char *p;
+nkf_char mime_integrity(FILE *f, const unsigned char *p)
{
- int c,d;
+ nkf_char 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;
@@ -4159,7 +5382,7 @@ unsigned char *p;
}
if (c=='=' && d=='?') {
/* checked. skip header, start decode */
- Fifo(mime_input++) = c;
+ Fifo(mime_input++) = (unsigned char)c;
/* mime_last_input = mime_input; */
mime_input = q;
switch_mime_getc();
@@ -4168,20 +5391,18 @@ unsigned char *p;
if (!( (c=='+'||c=='/'|| c=='=' || c=='?' || is_alnum(c))))
break;
/* Should we check length mod 4? */
- Fifo(mime_input++) = c;
+ Fifo(mime_input++) = (unsigned char)c;
d=c;
}
/* In case of Incomplete MIME, no MIME decode */
- Fifo(mime_input++) = c;
+ Fifo(mime_input++) = (unsigned char)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;
}
-int
-base64decode(c)
- int c;
+nkf_char base64decode(nkf_char c)
{
int i;
if (c > '@') {
@@ -4200,21 +5421,19 @@ base64decode(c)
return (i);
}
-static char basis_64[] =
+static const char basis_64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static int b64c;
+static nkf_char 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(mode)
-int mode;
+void open_mime(nkf_char mode)
{
- unsigned char *p;
+ const unsigned char *p;
int i;
int j;
p = mime_pattern[0];
@@ -4265,8 +5484,7 @@ int mode;
}
}
-void
-close_mime()
+void close_mime(void)
{
(*o_mputc)('?');
(*o_mputc)('=');
@@ -4274,8 +5492,7 @@ close_mime()
mimeout_mode = 0;
}
-void
-eof_mime()
+void eof_mime(void)
{
switch(mimeout_mode) {
case 'Q':
@@ -4301,19 +5518,14 @@ eof_mime()
}
}
-void
-mimeout_addchar(c)
- int c;
+void mimeout_addchar(nkf_char c)
{
switch(mimeout_mode) {
case 'Q':
- if(c==SPACE){
- (*o_mputc)('_');
- base64_count++;
- } else if (c==CR||c==NL) {
+ if (c==CR||c==NL) {
(*o_mputc)(c);
base64_count = 0;
- } else if(c<SPACE||c=='='||c=='?'||c=='_'||DEL<=c) {
+ } else if(!nkf_isalnum(c)) {
(*o_mputc)('=');
(*o_mputc)(itoh4(((c>>4)&0xf)));
(*o_mputc)(itoh4((c&0xf)));
@@ -4348,10 +5560,9 @@ mimeout_addchar(c)
}
}
-int mime_lastchar2, mime_lastchar1;
+nkf_char mime_lastchar2, mime_lastchar1;
-void mime_prechar(c2, c1)
- int c2, c1;
+void mime_prechar(nkf_char c2, nkf_char c1)
{
if (mimeout_mode){
if (c2){
@@ -4375,13 +5586,10 @@ void mime_prechar(c2, c1)
mime_lastchar1 = c1;
}
-void
-mime_putc(c)
- int c;
+void mime_putc(nkf_char c)
{
- int i = 0;
- int j = 0;
- int lastchar;
+ int i, j;
+ nkf_char lastchar;
if (mimeout_f == FIXED_MIME){
if (mimeout_mode == 'Q'){
@@ -4414,16 +5622,21 @@ mime_putc(c)
j = mimeout_buf_count;
mimeout_buf_count = 0;
i = 0;
- for (;i<j;i++) {
- /*if (nkf_isspace(mimeout_buf[i])){
- break;
- }*/
- mimeout_addchar(mimeout_buf[i]);
- }
- eof_mime();
- for (;i<j;i++) {
- (*o_mputc)(mimeout_buf[i]);
- base64_count++;
+ if (mimeout_mode) {
+ for (;i<j;i++) {
+ if (nkf_isspace(mimeout_buf[i]) && base64_count < 71){
+ break;
+ }
+ mimeout_addchar(mimeout_buf[i]);
+ }
+ eof_mime();
+ for (;i<j;i++) {
+ mimeout_addchar(mimeout_buf[i]);
+ }
+ } else {
+ for (;i<j;i++) {
+ mimeout_addchar(mimeout_buf[i]);
+ }
}
return;
}
@@ -4461,7 +5674,7 @@ mime_putc(c)
base64_count++;
}
}
- mimeout_buf[0] = c;
+ mimeout_buf[0] = (char)c;
mimeout_buf_count = 1;
}else{
if (base64_count > 1
@@ -4473,7 +5686,7 @@ mime_putc(c)
base64_count++;
}
}
- mimeout_buf[mimeout_buf_count++] = c;
+ mimeout_buf[mimeout_buf_count++] = (char)c;
if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
open_mime(output_mode);
}
@@ -4526,7 +5739,7 @@ mime_putc(c)
mimeout_buf_count = 0;
}
}
- mimeout_buf[mimeout_buf_count++] = c;
+ mimeout_buf[mimeout_buf_count++] = (char)c;
if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
eof_mime();
for (i=0;i<mimeout_buf_count;i++) {
@@ -4538,7 +5751,7 @@ mime_putc(c)
return;
}
if (mimeout_buf_count>0 && SPACE<c && c!='=') {
- mimeout_buf[mimeout_buf_count++] = c;
+ mimeout_buf[mimeout_buf_count++] = (char)c;
if (mimeout_buf_count>MIMEOUT_BUF_LENGTH) {
j = mimeout_buf_count;
mimeout_buf_count = 0;
@@ -4572,8 +5785,7 @@ mime_putc(c)
#if defined(PERL_XS) || defined(WIN32DLL)
-void
-reinit()
+void reinit(void)
{
{
struct input_code *p = input_code_list;
@@ -4601,10 +5813,22 @@ reinit()
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;
+ no_best_fit_chars_f = FALSE;
+ encode_fallback = NULL;
+ unicode_subchar = '?';
+ input_endian = ENDIAN_BIG;
+#endif
#ifdef UTF8_OUTPUT_ENABLE
- unicode_bom_f = 0;
- w_oconv16_LE = 0;
- ms_ucs_map_f = FALSE;
+ output_bom_f = FALSE;
+ output_endian = ENDIAN_BIG;
+#endif
+#ifdef UNICODE_NORMALIZATION
+ nfc_f = FALSE;
#endif
#ifdef INPUT_OPTION
cap_f = FALSE;
@@ -4622,18 +5846,20 @@ reinit()
exec_f = 0;
#endif
#ifdef SHIFTJIS_CP932
- cp932_f = TRUE;
+ cp51932_f = TRUE;
cp932inv_f = TRUE;
#endif
+#ifdef X0212_ENABLE
+ x0212_f = FALSE;
+ x0213_f = FALSE;
+#endif
{
int i;
for (i = 0; i < 256; i++){
prefix_table[i] = 0;
}
}
-#ifdef UTF8_INPUT_ENABLE
- utf16_mode = UTF16BE_INPUT;
-#endif
+ hold_count = 0;
mimeout_buf_count = 0;
mimeout_mode = 0;
base64_count = 0;
@@ -4668,7 +5894,7 @@ reinit()
input_mode = ASCII;
shift_mode = FALSE;
mime_decode_mode = FALSE;
- file_out = FALSE;
+ file_out_f = FALSE;
crmode_f = 0;
option_mode = 0;
broken_counter = 0;
@@ -4684,16 +5910,12 @@ reinit()
}
#endif
-void
-no_connection(c2,c1)
-int c2,c1;
+void no_connection(nkf_char c2, nkf_char c1)
{
no_connection2(c2,c1,0);
}
-int
-no_connection2(c2,c1,c0)
-int c2,c1,c0;
+nkf_char no_connection2(nkf_char c2, nkf_char c1, nkf_char c0)
{
fprintf(stderr,"nkf internal module connection failure.\n");
exit(1);
@@ -4704,79 +5926,87 @@ int c2,c1,c0;
#ifdef WIN32DLL
#define fprintf dllprintf
#endif
-void
-usage()
+void usage(void)
{
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), AT&T JIS (EUC), UTF-8\n");
+ fprintf(stderr,"j,s,e,w Output code is JIS 7 bit, Shift_JIS (DEFAULT), EUC-JP, UTF-8N\n");
#endif
#ifdef DEFAULT_CODE_JIS
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit (DEFAULT), Shift JIS, AT&T JIS (EUC), UTF-8\n");
+ fprintf(stderr,"j,s,e,w Output code is JIS 7 bit (DEFAULT), Shift JIS, EUC-JP, UTF-8N\n");
#endif
#ifdef DEFAULT_CODE_EUC
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS, AT&T JIS (EUC) (DEFAULT), UTF-8\n");
+ fprintf(stderr,"j,s,e,w Output code is JIS 7 bit, Shift JIS, EUC-JP (DEFAULT), UTF-8N\n");
#endif
#ifdef DEFAULT_CODE_UTF8
- fprintf(stderr,"j,s,e,w Outout code is JIS 7 bit, Shift JIS, AT&T JIS (EUC), UTF-8 (DEFAULT)\n");
+ fprintf(stderr,"j,s,e,w Output code is JIS 7 bit, Shift JIS, EUC-JP, UTF-8N (DEFAULT)\n");
#endif
#ifdef UTF8_OUTPUT_ENABLE
- fprintf(stderr," After 'w' you can add more options. (80?|16((B|L)0?)?) \n");
+ fprintf(stderr," After 'w' you can add more options. -w[ 8 [0], 16 [[BL] [0]] ]\n");
#endif
- fprintf(stderr,"J,S,E,W Input assumption is JIS 7 bit , Shift JIS, AT&T JIS (EUC), UTF-8\n");
+ fprintf(stderr,"J,S,E,W Input assumption is JIS 7 bit , Shift JIS, EUC-JP, UTF-8\n");
#ifdef UTF8_INPUT_ENABLE
- fprintf(stderr," After 'W' you can add more options. (8|16(B|L)?) \n");
+ fprintf(stderr," After 'W' you can add more options. -W[ 8, 16 [BL] ] \n");
#endif
fprintf(stderr,"t no conversion\n");
- fprintf(stderr,"i_/o_ Output sequence to designate JIS-kanji/ASCII (DEFAULT B)\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,"r {de/en}crypt ROT13/47\n");
- fprintf(stderr,"h 1 hirakana->katakana, 2 katakana->hirakana,3 both\n");
+ fprintf(stderr,"h 1 katakana->hiragana, 2 hiragana->katakana, 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 1: Kankaku to space,2: 2 spaces,\n");
- fprintf(stderr," 3: Convert HTML Entity\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,"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,"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," --x0212 Convert JISX0212\n");
- fprintf(stderr," --cp932, --no-cp932 CP932 compatibility\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");
#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_OUTPUT_ENABLE
- fprintf(stderr," --ms-ucs-map Microsoft UCS Mapping Compatible\n");
+#ifdef UTF8_INPUT_ENABLE
+ fprintf(stderr," --fb-{skip, html, xml, perl, java, subchar}\n");
+ fprintf(stderr," Specify how nkf handles unassigned characters\n");
#endif
#ifdef OVERWRITE
- 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");
+ 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");
version();
}
-void
-version()
+void version(void)
{
fprintf(stderr,"Network Kanji Filter Version %s (%s) "
-#if defined(MSDOS) && !defined(__WIN32__) && !defined(__WIN16__)
+#if defined(MSDOS) && !defined(__WIN32__) && !defined(__WIN16__) && !defined(__OS2__)
"for DOS"
#endif
#if defined(MSDOS) && defined(__WIN16__)
diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c
index 7969081b4f..e43ad553d6 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
-unsigned short euc_to_utf8_A1[] = {
+const unsigned short euc_to_utf8_A1[] = {
0x3000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A,
0xFF1B, 0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8,
- 0xFF3E, 0xFFE3, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003,
- 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2015, 0x2010, 0xFF0F,
+ 0xFF3E, 0x203E, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003,
+ 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2014, 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, 0xFFE5,
+ 0x2234, 0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0x00A5,
0xFF04, 0x00A2, 0x00A3, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20,
0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7,
};
/* Microsoft UCS Mapping Compatible */
-unsigned short euc_to_utf8_A1_ms[] = {
+const 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,8 +31,7 @@ unsigned short euc_to_utf8_A1_ms[] = {
0xFF04, 0xFFE0, 0xFFE1, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20,
0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7,
};
-
-unsigned short euc_to_utf8_A2[] = {
+const 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,
@@ -48,7 +47,7 @@ unsigned short euc_to_utf8_A2[] = {
};
/* Microsoft UCS Mapping Compatible */
-unsigned short euc_to_utf8_A2_ms[] = {
+const 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,
@@ -62,7 +61,7 @@ unsigned short euc_to_utf8_A2_ms[] = {
0, 0, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020,
0x2021, 0x00B6, 0, 0, 0, 0, 0x25EF,
};
-unsigned short euc_to_utf8_A3[] = {
+const 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,
@@ -76,7 +75,7 @@ unsigned short euc_to_utf8_A3[] = {
0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57,
0xFF58, 0xFF59, 0xFF5A, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_A4[] = {
+const 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,
@@ -90,7 +89,7 @@ unsigned short euc_to_utf8_A4[] = {
0x3090, 0x3091, 0x3092, 0x3093, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_A5[] = {
+const 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,
@@ -104,7 +103,7 @@ unsigned short euc_to_utf8_A5[] = {
0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_A6[] = {
+const 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,
@@ -118,7 +117,7 @@ unsigned short euc_to_utf8_A6[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_A7[] = {
+const 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,
@@ -132,7 +131,7 @@ unsigned short euc_to_utf8_A7[] = {
0x044E, 0x044F, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_A8[] = {
+const 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,
@@ -146,7 +145,7 @@ unsigned short euc_to_utf8_A8[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_A9[] = {
+const 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,
@@ -160,7 +159,7 @@ unsigned short euc_to_utf8_A9[] = {
0, 0, 0x2488, 0x2489, 0x248A, 0x248B, 0x248C, 0x248D,
0x248E, 0x248F, 0x2490, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_AA[] = {
+const 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,
@@ -174,7 +173,7 @@ unsigned short euc_to_utf8_AA[] = {
0x24AF, 0x24B0, 0x24B1, 0x24B2, 0x24B3, 0x24B4, 0x24B5, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_AB[] = {
+const 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,
@@ -188,7 +187,7 @@ unsigned short euc_to_utf8_AB[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x2116, 0x33CD, 0x2121, 0,
};
-unsigned short euc_to_utf8_AC[] = {
+const 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,
@@ -202,7 +201,7 @@ unsigned short euc_to_utf8_AC[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_AD[] = {
+const 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,
@@ -216,7 +215,7 @@ unsigned short euc_to_utf8_AD[] = {
0x2252, 0x2261, 0x222B, 0x222E, 0x2211, 0x221A, 0x22A5, 0x2220,
0x221F, 0x22BF, 0x2235, 0x2229, 0x222A, 0, 0x3299,
};
-unsigned short euc_to_utf8_AE[] = {
+const 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,
@@ -230,7 +229,7 @@ unsigned short euc_to_utf8_AE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x337F, 0, 0,
};
-unsigned short euc_to_utf8_AF[] = {
+const 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,
@@ -244,7 +243,7 @@ unsigned short euc_to_utf8_AF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_B0[] = {
+const 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,
@@ -258,7 +257,7 @@ unsigned short euc_to_utf8_B0[] = {
0x7A32, 0x8328, 0x828B, 0x9C2F, 0x5141, 0x5370, 0x54BD, 0x54E1,
0x56E0, 0x59FB, 0x5F15, 0x98F2, 0x6DEB, 0x80E4, 0x852D,
};
-unsigned short euc_to_utf8_B1[] = {
+const 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,
@@ -272,7 +271,7 @@ unsigned short euc_to_utf8_B1[] = {
0x8276, 0x82D1, 0x8597, 0x9060, 0x925B, 0x9D1B, 0x5869, 0x65BC,
0x6C5A, 0x7525, 0x51F9, 0x592E, 0x5965, 0x5F80, 0x5FDC,
};
-unsigned short euc_to_utf8_B2[] = {
+const 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,
@@ -286,7 +285,7 @@ unsigned short euc_to_utf8_B2[] = {
0x4ECB, 0x4F1A, 0x89E3, 0x56DE, 0x584A, 0x58CA, 0x5EFB, 0x5FEB,
0x602A, 0x6094, 0x6062, 0x61D0, 0x6212, 0x62D0, 0x6539,
};
-unsigned short euc_to_utf8_B3[] = {
+const 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,
@@ -300,7 +299,7 @@ unsigned short euc_to_utf8_B3[] = {
0x53F6, 0x691B, 0x6A3A, 0x9784, 0x682A, 0x515C, 0x7AC3, 0x84B2,
0x91DC, 0x938C, 0x565B, 0x9D28, 0x6822, 0x8305, 0x8431,
};
-unsigned short euc_to_utf8_B4[] = {
+const 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,
@@ -314,7 +313,7 @@ unsigned short euc_to_utf8_B4[] = {
0x57FA, 0x5947, 0x5B09, 0x5BC4, 0x5C90, 0x5E0C, 0x5E7E, 0x5FCC,
0x63EE, 0x673A, 0x65D7, 0x65E2, 0x671F, 0x68CB, 0x68C4,
};
-unsigned short euc_to_utf8_B5[] = {
+const 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,
@@ -328,7 +327,7 @@ unsigned short euc_to_utf8_B5[] = {
0x5DE8, 0x62D2, 0x62E0, 0x6319, 0x6E20, 0x865A, 0x8A31, 0x8DDD,
0x92F8, 0x6F01, 0x79A6, 0x9B5A, 0x4EA8, 0x4EAB, 0x4EAC,
};
-unsigned short euc_to_utf8_B6[] = {
+const 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,
@@ -342,7 +341,7 @@ unsigned short euc_to_utf8_B6[] = {
0x99D2, 0x5177, 0x611A, 0x865E, 0x55B0, 0x7A7A, 0x5076, 0x5BD3,
0x9047, 0x9685, 0x4E32, 0x6ADB, 0x91E7, 0x5C51, 0x5C48,
};
-unsigned short euc_to_utf8_B7[] = {
+const 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,
@@ -356,7 +355,7 @@ unsigned short euc_to_utf8_B7[] = {
0x5039, 0x5026, 0x5065, 0x517C, 0x5238, 0x5263, 0x55A7, 0x570F,
0x5805, 0x5ACC, 0x5EFA, 0x61B2, 0x61F8, 0x62F3, 0x6372,
};
-unsigned short euc_to_utf8_B8[] = {
+const 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,
@@ -370,7 +369,7 @@ unsigned short euc_to_utf8_B8[] = {
0x4E5E, 0x9BC9, 0x4EA4, 0x4F7C, 0x4FAF, 0x5019, 0x5016, 0x5149,
0x516C, 0x529F, 0x52B9, 0x52FE, 0x539A, 0x53E3, 0x5411,
};
-unsigned short euc_to_utf8_B9[] = {
+const 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,
@@ -384,7 +383,7 @@ unsigned short euc_to_utf8_B9[] = {
0x544A, 0x56FD, 0x7A40, 0x9177, 0x9D60, 0x9ED2, 0x7344, 0x6F09,
0x8170, 0x7511, 0x5FFD, 0x60DA, 0x9AA8, 0x72DB, 0x8FBC,
};
-unsigned short euc_to_utf8_BA[] = {
+const 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,
@@ -398,7 +397,7 @@ unsigned short euc_to_utf8_BA[] = {
0x548B, 0x643E, 0x6628, 0x6714, 0x67F5, 0x7A84, 0x7B56, 0x7D22,
0x932F, 0x685C, 0x9BAD, 0x7B39, 0x5319, 0x518A, 0x5237,
};
-unsigned short euc_to_utf8_BB[] = {
+const 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,
@@ -412,7 +411,7 @@ unsigned short euc_to_utf8_BB[] = {
0x8AEE, 0x8CC7, 0x8CDC, 0x96CC, 0x98FC, 0x6B6F, 0x4E8B, 0x4F3C,
0x4F8D, 0x5150, 0x5B57, 0x5BFA, 0x6148, 0x6301, 0x6642,
};
-unsigned short euc_to_utf8_BC[] = {
+const 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,
@@ -426,7 +425,7 @@ unsigned short euc_to_utf8_BC[] = {
0x816B, 0x8DA3, 0x9152, 0x9996, 0x5112, 0x53D7, 0x546A, 0x5BFF,
0x6388, 0x6A39, 0x7DAC, 0x9700, 0x56DA, 0x53CE, 0x5468,
};
-unsigned short euc_to_utf8_BD[] = {
+const 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,
@@ -440,7 +439,7 @@ unsigned short euc_to_utf8_BD[] = {
0x7F72, 0x66F8, 0x85AF, 0x85F7, 0x8AF8, 0x52A9, 0x53D9, 0x5973,
0x5E8F, 0x5F90, 0x6055, 0x92E4, 0x9664, 0x50B7, 0x511F,
};
-unsigned short euc_to_utf8_BE[] = {
+const 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,
@@ -454,7 +453,7 @@ unsigned short euc_to_utf8_BE[] = {
0x60C5, 0x64FE, 0x6761, 0x6756, 0x6D44, 0x72B6, 0x7573, 0x7A63,
0x84B8, 0x8B72, 0x91B8, 0x9320, 0x5631, 0x57F4, 0x98FE,
};
-unsigned short euc_to_utf8_BF[] = {
+const 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,
@@ -468,7 +467,7 @@ unsigned short euc_to_utf8_BF[] = {
0x745E, 0x9AC4, 0x5D07, 0x5D69, 0x6570, 0x67A2, 0x8DA8, 0x96DB,
0x636E, 0x6749, 0x6919, 0x83C5, 0x9817, 0x96C0, 0x88FE,
};
-unsigned short euc_to_utf8_C0[] = {
+const 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,
@@ -482,7 +481,7 @@ unsigned short euc_to_utf8_C0[] = {
0x6247, 0x64B0, 0x6813, 0x6834, 0x6CC9, 0x6D45, 0x6D17, 0x67D3,
0x6F5C, 0x714E, 0x717D, 0x65CB, 0x7A7F, 0x7BAD, 0x7DDA,
};
-unsigned short euc_to_utf8_C1[] = {
+const 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,
@@ -496,7 +495,7 @@ unsigned short euc_to_utf8_C1[] = {
0x8349, 0x8358, 0x846C, 0x84BC, 0x85FB, 0x88C5, 0x8D70, 0x9001,
0x906D, 0x9397, 0x971C, 0x9A12, 0x50CF, 0x5897, 0x618E,
};
-unsigned short euc_to_utf8_C2[] = {
+const 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,
@@ -510,7 +509,7 @@ unsigned short euc_to_utf8_C2[] = {
0x5B85, 0x6258, 0x629E, 0x62D3, 0x6CA2, 0x6FEF, 0x7422, 0x8A17,
0x9438, 0x6FC1, 0x8AFE, 0x8338, 0x51E7, 0x86F8, 0x53EA,
};
-unsigned short euc_to_utf8_C3[] = {
+const 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,
@@ -524,7 +523,7 @@ unsigned short euc_to_utf8_C3[] = {
0x8A3B, 0x914E, 0x92F3, 0x99D0, 0x6A17, 0x7026, 0x732A, 0x82E7,
0x8457, 0x8CAF, 0x4E01, 0x5146, 0x51CB, 0x558B, 0x5BF5,
};
-unsigned short euc_to_utf8_C4[] = {
+const 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,
@@ -538,7 +537,7 @@ unsigned short euc_to_utf8_C4[] = {
0x608C, 0x62B5, 0x633A, 0x63D0, 0x68AF, 0x6C40, 0x7887, 0x798E,
0x7A0B, 0x7DE0, 0x8247, 0x8A02, 0x8AE6, 0x8E44, 0x9013,
};
-unsigned short euc_to_utf8_C5[] = {
+const 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,
@@ -552,7 +551,7 @@ unsigned short euc_to_utf8_C5[] = {
0x76D7, 0x6DD8, 0x6E6F, 0x6D9B, 0x706F, 0x71C8, 0x5F53, 0x75D8,
0x7977, 0x7B49, 0x7B54, 0x7B52, 0x7CD6, 0x7D71, 0x5230,
};
-unsigned short euc_to_utf8_C6[] = {
+const 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,
@@ -566,7 +565,7 @@ unsigned short euc_to_utf8_C6[] = {
0x8EDF, 0x96E3, 0x6C5D, 0x4E8C, 0x5C3C, 0x5F10, 0x8FE9, 0x5302,
0x8CD1, 0x8089, 0x8679, 0x5EFF, 0x65E5, 0x4E73, 0x5165,
};
-unsigned short euc_to_utf8_C7[] = {
+const 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,
@@ -580,7 +579,7 @@ unsigned short euc_to_utf8_C7[] = {
0x67CF, 0x6CCA, 0x767D, 0x7B94, 0x7C95, 0x8236, 0x8584, 0x8FEB,
0x66DD, 0x6F20, 0x7206, 0x7E1B, 0x83AB, 0x99C1, 0x9EA6,
};
-unsigned short euc_to_utf8_C8[] = {
+const 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,
@@ -594,7 +593,7 @@ unsigned short euc_to_utf8_C8[] = {
0x8AB9, 0x8CBB, 0x907F, 0x975E, 0x98DB, 0x6A0B, 0x7C38, 0x5099,
0x5C3E, 0x5FAE, 0x6787, 0x6BD8, 0x7435, 0x7709, 0x7F8E,
};
-unsigned short euc_to_utf8_C9[] = {
+const 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,
@@ -608,7 +607,7 @@ unsigned short euc_to_utf8_C9[] = {
0x6B66, 0x821E, 0x8461, 0x856A, 0x90E8, 0x5C01, 0x6953, 0x98A8,
0x847A, 0x8557, 0x4F0F, 0x526F, 0x5FA9, 0x5E45, 0x670D,
};
-unsigned short euc_to_utf8_CA[] = {
+const 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,
@@ -622,7 +621,7 @@ unsigned short euc_to_utf8_CA[] = {
0x4FF8, 0x5305, 0x5446, 0x5831, 0x5949, 0x5B9D, 0x5CF0, 0x5CEF,
0x5D29, 0x5E96, 0x62B1, 0x6367, 0x653E, 0x65B9, 0x670B,
};
-unsigned short euc_to_utf8_CB[] = {
+const 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,
@@ -636,7 +635,7 @@ unsigned short euc_to_utf8_CB[] = {
0x9C52, 0x685D, 0x4EA6, 0x4FE3, 0x53C8, 0x62B9, 0x672B, 0x6CAB,
0x8FC4, 0x4FAD, 0x7E6D, 0x9EBF, 0x4E07, 0x6162, 0x6E80,
};
-unsigned short euc_to_utf8_CC[] = {
+const 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,
@@ -650,7 +649,7 @@ unsigned short euc_to_utf8_CC[] = {
0x77E2, 0x5384, 0x5F79, 0x7D04, 0x85AC, 0x8A33, 0x8E8D, 0x9756,
0x67F3, 0x85AE, 0x9453, 0x6109, 0x6108, 0x6CB9, 0x7652,
};
-unsigned short euc_to_utf8_CD[] = {
+const 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,
@@ -664,7 +663,7 @@ unsigned short euc_to_utf8_CD[] = {
0x4E71, 0x5375, 0x5D50, 0x6B04, 0x6FEB, 0x85CD, 0x862D, 0x89A7,
0x5229, 0x540F, 0x5C65, 0x674E, 0x68A8, 0x7406, 0x7483,
};
-unsigned short euc_to_utf8_CE[] = {
+const 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,
@@ -678,7 +677,7 @@ unsigned short euc_to_utf8_CE[] = {
0x9F62, 0x66A6, 0x6B74, 0x5217, 0x52A3, 0x70C8, 0x88C2, 0x5EC9,
0x604B, 0x6190, 0x6F23, 0x7149, 0x7C3E, 0x7DF4, 0x806F,
};
-unsigned short euc_to_utf8_CF[] = {
+const 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,
@@ -692,7 +691,7 @@ unsigned short euc_to_utf8_CF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_D0[] = {
+const 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,
@@ -706,7 +705,7 @@ unsigned short euc_to_utf8_D0[] = {
0x5043, 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505A, 0x5056,
0x506C, 0x5078, 0x5080, 0x509A, 0x5085, 0x50B4, 0x50B2,
};
-unsigned short euc_to_utf8_D1[] = {
+const 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,
@@ -720,7 +719,7 @@ unsigned short euc_to_utf8_D1[] = {
0x525E, 0x5254, 0x526A, 0x5274, 0x5269, 0x5273, 0x527F, 0x527D,
0x528D, 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8FA8,
};
-unsigned short euc_to_utf8_D2[] = {
+const 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,
@@ -734,7 +733,7 @@ unsigned short euc_to_utf8_D2[] = {
0x5492, 0x547B, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54C7,
0x54A2, 0x54B8, 0x54A5, 0x54AC, 0x54C4, 0x54C8, 0x54A8,
};
-unsigned short euc_to_utf8_D3[] = {
+const 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,
@@ -748,7 +747,7 @@ unsigned short euc_to_utf8_D3[] = {
0x56BC, 0x56C1, 0x56C3, 0x56C0, 0x56C8, 0x56CE, 0x56D1, 0x56D3,
0x56D7, 0x56EE, 0x56F9, 0x5700, 0x56FF, 0x5704, 0x5709,
};
-unsigned short euc_to_utf8_D4[] = {
+const 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,
@@ -762,7 +761,7 @@ unsigned short euc_to_utf8_D4[] = {
0x592D, 0x5932, 0x5938, 0x593E, 0x7AD2, 0x5955, 0x5950, 0x594E,
0x595A, 0x5958, 0x5962, 0x5960, 0x5967, 0x596C, 0x5969,
};
-unsigned short euc_to_utf8_D5[] = {
+const 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,
@@ -776,7 +775,7 @@ unsigned short euc_to_utf8_D5[] = {
0x5BF3, 0x5C05, 0x5C07, 0x5C08, 0x5C0D, 0x5C13, 0x5C20, 0x5C22,
0x5C28, 0x5C38, 0x5C39, 0x5C41, 0x5C46, 0x5C4E, 0x5C53,
};
-unsigned short euc_to_utf8_D6[] = {
+const 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,
@@ -790,7 +789,7 @@ unsigned short euc_to_utf8_D6[] = {
0x5E5F, 0x5E62, 0x5E64, 0x5E47, 0x5E75, 0x5E76, 0x5E7A, 0x9EBC,
0x5E7F, 0x5EA0, 0x5EC1, 0x5EC2, 0x5EC8, 0x5ED0, 0x5ECF,
};
-unsigned short euc_to_utf8_D7[] = {
+const 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,
@@ -804,7 +803,7 @@ unsigned short euc_to_utf8_D7[] = {
0x604A, 0x6046, 0x604D, 0x6063, 0x6043, 0x6064, 0x6042, 0x606C,
0x606B, 0x6059, 0x6081, 0x608D, 0x60E7, 0x6083, 0x609A,
};
-unsigned short euc_to_utf8_D8[] = {
+const 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,
@@ -818,7 +817,7 @@ unsigned short euc_to_utf8_D8[] = {
0x61E3, 0x61F6, 0x61FA, 0x61F4, 0x61FF, 0x61FD, 0x61FC, 0x61FE,
0x6200, 0x6208, 0x6209, 0x620D, 0x620C, 0x6214, 0x621B,
};
-unsigned short euc_to_utf8_D9[] = {
+const 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,
@@ -832,7 +831,7 @@ unsigned short euc_to_utf8_D9[] = {
0x651D, 0x6417, 0x6428, 0x640F, 0x6467, 0x646F, 0x6476, 0x644E,
0x652A, 0x6495, 0x6493, 0x64A5, 0x64A9, 0x6488, 0x64BC,
};
-unsigned short euc_to_utf8_DA[] = {
+const 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,
@@ -846,7 +845,7 @@ unsigned short euc_to_utf8_DA[] = {
0x665F, 0x6662, 0x6670, 0x6683, 0x6688, 0x668E, 0x6689, 0x6684,
0x6698, 0x669D, 0x66C1, 0x66B9, 0x66C9, 0x66BE, 0x66BC,
};
-unsigned short euc_to_utf8_DB[] = {
+const 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,
@@ -860,7 +859,7 @@ unsigned short euc_to_utf8_DB[] = {
0x68B5, 0x68A0, 0x68BA, 0x690F, 0x688D, 0x687E, 0x6901, 0x68CA,
0x6908, 0x68D8, 0x6922, 0x6926, 0x68E1, 0x690C, 0x68CD,
};
-unsigned short euc_to_utf8_DC[] = {
+const 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,
@@ -874,7 +873,7 @@ unsigned short euc_to_utf8_DC[] = {
0x6A36, 0x6A78, 0x6A47, 0x6A62, 0x6A59, 0x6A66, 0x6A48, 0x6A38,
0x6A22, 0x6A90, 0x6A8D, 0x6AA0, 0x6A84, 0x6AA2, 0x6AA3,
};
-unsigned short euc_to_utf8_DD[] = {
+const 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,
@@ -888,7 +887,7 @@ unsigned short euc_to_utf8_DD[] = {
0x6C7E, 0x6C68, 0x6C73, 0x6C92, 0x6C90, 0x6CC4, 0x6CF1, 0x6CD3,
0x6CBD, 0x6CD7, 0x6CC5, 0x6CDD, 0x6CAE, 0x6CB1, 0x6CBE,
};
-unsigned short euc_to_utf8_DE[] = {
+const 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,
@@ -902,7 +901,7 @@ unsigned short euc_to_utf8_DE[] = {
0x6EA5, 0x6EC2, 0x6E9F, 0x6F41, 0x6F11, 0x704C, 0x6EEC, 0x6EF8,
0x6EFE, 0x6F3F, 0x6EF2, 0x6F31, 0x6EEF, 0x6F32, 0x6ECC,
};
-unsigned short euc_to_utf8_DF[] = {
+const 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,
@@ -916,7 +915,7 @@ unsigned short euc_to_utf8_DF[] = {
0x7195, 0x71A8, 0x71AC, 0x71D7, 0x71B9, 0x71BE, 0x71D2, 0x71C9,
0x71D4, 0x71CE, 0x71E0, 0x71EC, 0x71E7, 0x71F5, 0x71FC,
};
-unsigned short euc_to_utf8_E0[] = {
+const 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,
@@ -930,7 +929,7 @@ unsigned short euc_to_utf8_E0[] = {
0x7441, 0x745C, 0x7469, 0x7470, 0x7463, 0x746A, 0x7476, 0x747E,
0x748B, 0x749E, 0x74A7, 0x74CA, 0x74CF, 0x74D4, 0x73F1,
};
-unsigned short euc_to_utf8_E1[] = {
+const 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,
@@ -944,7 +943,7 @@ unsigned short euc_to_utf8_E1[] = {
0x7630, 0x763B, 0x7647, 0x7648, 0x7646, 0x765C, 0x7658, 0x7661,
0x7662, 0x7668, 0x7669, 0x766A, 0x7667, 0x766C, 0x7670,
};
-unsigned short euc_to_utf8_E2[] = {
+const 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,
@@ -958,7 +957,7 @@ unsigned short euc_to_utf8_E2[] = {
0x789A, 0x788C, 0x78A3, 0x78B5, 0x78AA, 0x78AF, 0x78D1, 0x78C6,
0x78CB, 0x78D4, 0x78BE, 0x78BC, 0x78C5, 0x78CA, 0x78EC,
};
-unsigned short euc_to_utf8_E3[] = {
+const 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,
@@ -972,7 +971,7 @@ unsigned short euc_to_utf8_E3[] = {
0x7AE6, 0x7AED, 0x7AF0, 0x7B02, 0x7B0F, 0x7B0A, 0x7B06, 0x7B33,
0x7B18, 0x7B19, 0x7B1E, 0x7B35, 0x7B28, 0x7B36, 0x7B50,
};
-unsigned short euc_to_utf8_E4[] = {
+const 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,
@@ -986,7 +985,7 @@ unsigned short euc_to_utf8_E4[] = {
0x7CBD, 0x7CC0, 0x7CC5, 0x7CC2, 0x7CD8, 0x7CD2, 0x7CDC, 0x7CE2,
0x9B3B, 0x7CEF, 0x7CF2, 0x7CF4, 0x7CF6, 0x7CFA, 0x7D06,
};
-unsigned short euc_to_utf8_E5[] = {
+const 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,
@@ -1000,7 +999,7 @@ unsigned short euc_to_utf8_E5[] = {
0x8FAE, 0x7E7F, 0x7E88, 0x7E89, 0x7E8C, 0x7E92, 0x7E90, 0x7E93,
0x7E94, 0x7E96, 0x7E8E, 0x7E9B, 0x7E9C, 0x7F38, 0x7F3A,
};
-unsigned short euc_to_utf8_E6[] = {
+const 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,
@@ -1014,7 +1013,7 @@ unsigned short euc_to_utf8_E6[] = {
0x80DB, 0x80E5, 0x80D9, 0x80DD, 0x80C4, 0x80DA, 0x80D6, 0x8109,
0x80EF, 0x80F1, 0x811B, 0x8129, 0x8123, 0x812F, 0x814B,
};
-unsigned short euc_to_utf8_E7[] = {
+const 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,
@@ -1028,7 +1027,7 @@ unsigned short euc_to_utf8_E7[] = {
0x82E3, 0x82DF, 0x82D2, 0x82F4, 0x82F3, 0x82FA, 0x8393, 0x8303,
0x82FB, 0x82F9, 0x82DE, 0x8306, 0x82DC, 0x8309, 0x82D9,
};
-unsigned short euc_to_utf8_E8[] = {
+const 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,
@@ -1042,7 +1041,7 @@ unsigned short euc_to_utf8_E8[] = {
0x84A1, 0x8521, 0x84FF, 0x84F4, 0x8517, 0x8518, 0x852C, 0x851F,
0x8515, 0x8514, 0x84FC, 0x8540, 0x8563, 0x8558, 0x8548,
};
-unsigned short euc_to_utf8_E9[] = {
+const 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,
@@ -1056,7 +1055,7 @@ unsigned short euc_to_utf8_E9[] = {
0x8737, 0x873B, 0x8725, 0x8729, 0x871A, 0x8760, 0x875F, 0x8778,
0x874C, 0x874E, 0x8774, 0x8757, 0x8768, 0x876E, 0x8759,
};
-unsigned short euc_to_utf8_EA[] = {
+const 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,
@@ -1070,7 +1069,7 @@ unsigned short euc_to_utf8_EA[] = {
0x8913, 0x8943, 0x891E, 0x8925, 0x892A, 0x892B, 0x8941, 0x8944,
0x893B, 0x8936, 0x8938, 0x894C, 0x891D, 0x8960, 0x895E,
};
-unsigned short euc_to_utf8_EB[] = {
+const 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,
@@ -1084,7 +1083,7 @@ unsigned short euc_to_utf8_EB[] = {
0x8B33, 0x97AB, 0x8B26, 0x8B2B, 0x8B3E, 0x8B28, 0x8B41, 0x8B4C,
0x8B4F, 0x8B4E, 0x8B49, 0x8B56, 0x8B5B, 0x8B5A, 0x8B6B,
};
-unsigned short euc_to_utf8_EC[] = {
+const 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,
@@ -1098,7 +1097,7 @@ unsigned short euc_to_utf8_EC[] = {
0x8DDF, 0x8DE3, 0x8DFC, 0x8E08, 0x8E09, 0x8DFF, 0x8E1D, 0x8E1E,
0x8E10, 0x8E1F, 0x8E42, 0x8E35, 0x8E30, 0x8E34, 0x8E4A,
};
-unsigned short euc_to_utf8_ED[] = {
+const 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,
@@ -1112,7 +1111,7 @@ unsigned short euc_to_utf8_ED[] = {
0x9005, 0x8FF9, 0x8FFA, 0x9011, 0x9015, 0x9021, 0x900D, 0x901E,
0x9016, 0x900B, 0x9027, 0x9036, 0x9035, 0x9039, 0x8FF8,
};
-unsigned short euc_to_utf8_EE[] = {
+const 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,
@@ -1126,7 +1125,7 @@ unsigned short euc_to_utf8_EE[] = {
0x924B, 0x9250, 0x929C, 0x9296, 0x9293, 0x929B, 0x925A, 0x92CF,
0x92B9, 0x92B7, 0x92E9, 0x930F, 0x92FA, 0x9344, 0x932E,
};
-unsigned short euc_to_utf8_EF[] = {
+const 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,
@@ -1140,7 +1139,7 @@ unsigned short euc_to_utf8_EF[] = {
0x95DC, 0x95E1, 0x95E5, 0x95E2, 0x9621, 0x9628, 0x962E, 0x962F,
0x9642, 0x964C, 0x964F, 0x964B, 0x9677, 0x965C, 0x965E,
};
-unsigned short euc_to_utf8_F0[] = {
+const 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,
@@ -1154,7 +1153,7 @@ unsigned short euc_to_utf8_F0[] = {
0x97F6, 0x97F5, 0x980F, 0x980C, 0x9838, 0x9824, 0x9821, 0x9837,
0x983D, 0x9846, 0x984F, 0x984B, 0x986B, 0x986F, 0x9870,
};
-unsigned short euc_to_utf8_F1[] = {
+const 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,
@@ -1168,7 +1167,7 @@ unsigned short euc_to_utf8_F1[] = {
0x9ACF, 0x9AD1, 0x9AD3, 0x9AD4, 0x9ADE, 0x9ADF, 0x9AE2, 0x9AE3,
0x9AE6, 0x9AEF, 0x9AEB, 0x9AEE, 0x9AF4, 0x9AF1, 0x9AF7,
};
-unsigned short euc_to_utf8_F2[] = {
+const 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,
@@ -1182,7 +1181,7 @@ unsigned short euc_to_utf8_F2[] = {
0x9D03, 0x9D06, 0x9D2A, 0x9D26, 0x9DAF, 0x9D23, 0x9D1F, 0x9D44,
0x9D15, 0x9D12, 0x9D41, 0x9D3F, 0x9D3E, 0x9D46, 0x9D48,
};
-unsigned short euc_to_utf8_F3[] = {
+const 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,
@@ -1196,7 +1195,7 @@ unsigned short euc_to_utf8_F3[] = {
0x9F54, 0x9F63, 0x9F5F, 0x9F60, 0x9F61, 0x9F66, 0x9F67, 0x9F6C,
0x9F6A, 0x9F77, 0x9F72, 0x9F76, 0x9F95, 0x9F9C, 0x9FA0,
};
-unsigned short euc_to_utf8_F4[] = {
+const 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,
@@ -1210,7 +1209,7 @@ unsigned short euc_to_utf8_F4[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_F5[] = {
+const 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,
@@ -1224,7 +1223,7 @@ unsigned short euc_to_utf8_F5[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
-unsigned short euc_to_utf8_F9[] = {
+const 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,
@@ -1238,7 +1237,7 @@ unsigned short euc_to_utf8_F9[] = {
0x5CA6, 0x5CBA, 0x5CF5, 0x5D27, 0x5D53, 0xFA11, 0x5D42, 0x5D6D,
0x5DB8, 0x5DB9, 0x5DD0, 0x5F21, 0x5F34, 0x5F67, 0x5FB7,
};
-unsigned short euc_to_utf8_FA[] = {
+const 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,
@@ -1252,7 +1251,7 @@ unsigned short euc_to_utf8_FA[] = {
0x6FF5, 0x7005, 0x7007, 0x7028, 0x7085, 0x70AB, 0x710F, 0x7104,
0x715C, 0x7146, 0x7147, 0xFA15, 0x71C1, 0x71FE, 0x72B1,
};
-unsigned short euc_to_utf8_FB[] = {
+const 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,
@@ -1266,7 +1265,23 @@ unsigned short euc_to_utf8_FB[] = {
0x8B7F, 0x8CF0, 0x8CF4, 0x8D12, 0x8D76, 0xFA23, 0x8ECF, 0xFA24,
0xFA25, 0x9067, 0x90DE, 0xFA26, 0x9115, 0x9127, 0x91DA,
};
-unsigned short euc_to_utf8_FC[] = {
+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[] = {
0x91D7, 0x91DE, 0x91ED, 0x91EE, 0x91E4, 0x91E5, 0x9206,
0x9210, 0x920A, 0x923A, 0x9240, 0x923C, 0x924E, 0x9259, 0x9251,
0x9239, 0x9267, 0x92A7, 0x9277, 0x9278, 0x92E7, 0x92D7, 0x92D9,
@@ -1280,7 +1295,991 @@ unsigned short euc_to_utf8_FC[] = {
0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176,
0x2177, 0x2178, 0x2179, 0xFFE2, 0xFFE4, 0xFF07, 0xFF02,
};
-unsigned short euc_to_utf8_1byte[] = {
+
+#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[] = {
0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0xFF66, 0xFF67,
0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F,
0xFF70, 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF76, 0xFF77,
@@ -1294,7 +2293,7 @@ unsigned short euc_to_utf8_1byte[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x00A9, 0x2122,
};
-unsigned short * euc_to_utf8_2bytes[] = {
+const unsigned short *const 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,
@@ -1321,8 +2320,8 @@ unsigned short * euc_to_utf8_2bytes[] = {
euc_to_utf8_FC, 0, 0,
};
/* Microsoft UCS Mapping Compatible */
-unsigned short * euc_to_utf8_2bytes_ms[] = {
- euc_to_utf8_A1_ms,euc_to_utf8_A2_ms, euc_to_utf8_A3,
+const unsigned short *const 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,
@@ -1345,44 +2344,142 @@ unsigned short * 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, 0, 0,
+ euc_to_utf8_FC_ms, 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
-unsigned short utf8_to_euc_C2[] = {
+const 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,
- 0x0E20, 0, 0x2171, 0x2172, 0, 0, 0, 0x2178,
- 0x212F, 0x0E7D, 0, 0, 0x224C, 0, 0, 0,
+ 0, 0xA242, 0x2171, 0x2172, 0xA270, 0x216F, 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_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,
};
-unsigned short utf8_to_euc_C3[] = {
+const unsigned short utf8_to_euc_C2_932[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0x215F,
+ 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, 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, 0, 0, 0x2160,
+ 0, 0, 0, 0, 0, 0xAB39, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_CE[] = {
+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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627,
+ 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,
0x2628, 0x2629, 0x262A, 0x262B, 0x262C, 0x262D, 0x262E, 0x262F,
0x2630, 0x2631, 0, 0x2632, 0x2633, 0x2634, 0x2635, 0x2636,
- 0x2637, 0x2638, 0, 0, 0, 0, 0, 0,
- 0, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647,
+ 0x2637, 0x2638, 0xA665, 0xA66A, 0xA671, 0xA672, 0xA673, 0xA674,
+ 0xA67B, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647,
0x2648, 0x2649, 0x264A, 0x264B, 0x264C, 0x264D, 0x264E, 0x264F,
};
-unsigned short utf8_to_euc_CF[] = {
- 0x2650, 0x2651, 0, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656,
- 0x2657, 0x2658, 0, 0, 0, 0, 0, 0,
+const unsigned short utf8_to_euc_CF[] = {
+ 0x2650, 0x2651, 0xA678, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656,
+ 0x2657, 0x2658, 0xA675, 0xA67A, 0xA677, 0xA679, 0xA67C, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -1390,9 +2487,9 @@ unsigned short utf8_to_euc_CF[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_D0[] = {
- 0, 0x2727, 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,
0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2728, 0x2729,
0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, 0x2730, 0x2731,
0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739,
@@ -1400,17 +2497,27 @@ unsigned short utf8_to_euc_D0[] = {
0x2751, 0x2752, 0x2753, 0x2754, 0x2755, 0x2756, 0x2758, 0x2759,
0x275A, 0x275B, 0x275C, 0x275D, 0x275E, 0x275F, 0x2760, 0x2761,
};
-unsigned short utf8_to_euc_D1[] = {
+const unsigned short utf8_to_euc_D1[] = {
0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2768, 0x2769,
0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, 0x2770, 0x2771,
- 0, 0x2757, 0, 0, 0, 0, 0, 0,
+ 0, 0x2757, 0xA772, 0xA773, 0xA774, 0xA775, 0xA776, 0xA777,
+ 0xA778, 0xA779, 0xA77A, 0xA77B, 0xA77C, 0, 0xA77D, 0xA77E,
0, 0, 0, 0, 0, 0, 0, 0,
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,
};
-unsigned short utf8_to_euc_E280[] = {
+const unsigned short utf8_to_euc_E280_ms[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x213E, 0, 0, 0, 0x213D, 0x213D, 0x2142, 0,
@@ -1418,29 +2525,39 @@ unsigned short utf8_to_euc_E280[] = {
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,
};
-unsigned short utf8_to_euc_E284[] = {
+const 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, 0x2D64, 0x0E7E, 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, 0, 0, 0x2272, 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_E285[] = {
+const 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, 0x2A2B, 0x2A2C, 0, 0, 0, 0,
- 0x7C71, 0x7C72, 0x7C73, 0x7C74, 0x7C75, 0x7C76, 0x7C77, 0x7C78,
- 0x7C79, 0x7C7A, 0x2A3F, 0x2A40, 0, 0, 0, 0,
+ 0x2D3D, 0x2D3E, 0, 0, 0, 0, 0, 0,
+ 0xF373, 0xF374, 0xF375, 0xF376, 0xF377, 0xF378, 0xF379, 0xF37A,
+ 0xF37B, 0xF37C, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E286[] = {
+const 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,
@@ -1450,17 +2567,17 @@ unsigned short utf8_to_euc_E286[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E287[] = {
- 0, 0, 0, 0, 0x2C4E, 0x2C4F, 0x2C4D, 0,
+const unsigned short utf8_to_euc_E287[] = {
+ 0, 0, 0, 0, 0, 0, 0, 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, 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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E288[] = {
+const 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,
@@ -1470,7 +2587,17 @@ unsigned short utf8_to_euc_E288[] = {
0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
0, 0, 0, 0, 0, 0x2266, 0, 0,
};
-unsigned short utf8_to_euc_E289[] = {
+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[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x2262, 0, 0, 0, 0, 0,
@@ -1480,7 +2607,7 @@ unsigned short utf8_to_euc_E289[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E28A[] = {
+const 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,
@@ -1490,7 +2617,7 @@ unsigned short utf8_to_euc_E28A[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x2D79,
};
-unsigned short utf8_to_euc_E28C[] = {
+const 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,
@@ -1500,27 +2627,17 @@ unsigned short utf8_to_euc_E28C[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E291[] = {
+const 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, 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,
+ 0x2D31, 0x2D32, 0x2D33, 0x2D34, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E294[] = {
+const 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,
@@ -1530,7 +2647,7 @@ unsigned short utf8_to_euc_E294[] = {
0x283D, 0, 0, 0x2833, 0x282A, 0, 0, 0x283A,
0x283F, 0, 0, 0x2835, 0x282B, 0, 0, 0x283B,
};
-unsigned short utf8_to_euc_E295[] = {
+const 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,
@@ -1540,7 +2657,7 @@ unsigned short utf8_to_euc_E295[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E296[] = {
+const 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,
@@ -1550,7 +2667,7 @@ unsigned short utf8_to_euc_E296[] = {
0, 0, 0x2225, 0x2224, 0, 0, 0, 0,
0, 0, 0, 0, 0x2227, 0x2226, 0, 0,
};
-unsigned short utf8_to_euc_E297[] = {
+const 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,
@@ -1560,47 +2677,47 @@ unsigned short utf8_to_euc_E297[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E298[] = {
+const 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, 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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E299[] = {
+const 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,
- 0x2C25, 0x2C23, 0x2C24, 0x2C26, 0x2C21, 0x2C27, 0x2C28, 0x2C22,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x2276, 0, 0, 0x2275, 0, 0x2274,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E29D[] = {
- 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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 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,
};
-unsigned short utf8_to_euc_E380[] = {
- 0x2121, 0x2122, 0x2123, 0x2137, 0x2C37, 0x2139, 0x213A, 0x213B,
+const unsigned short utf8_to_euc_E380_932[] = {
+ 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,
- 0x2C35, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x2D60, 0, 0x2D61,
+ 0, 0, 0, 0, 0, 0, 0, 0,
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_E381[] = {
+const 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,
@@ -1610,2047 +2727,2047 @@ unsigned short utf8_to_euc_E381[] = {
0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457,
0x2458, 0x2459, 0x245A, 0x245B, 0x245C, 0x245D, 0x245E, 0x245F,
};
-unsigned short utf8_to_euc_E382[] = {
+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[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F,
- 0x2470, 0x2471, 0x2472, 0x2473, 0x2F49, 0, 0, 0,
- 0, 0x0E5E, 0x0E5F, 0x212B, 0x212C, 0x2135, 0x2136, 0,
+ 0x2470, 0x2471, 0x2472, 0x2473, 0x2574, 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,
};
-unsigned short utf8_to_euc_E383[] = {
+const 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, 0x2F4B,
- 0x2F4C, 0x2F4D, 0x2F4E, 0x2126, 0x213C, 0x2133, 0x2134, 0,
+ 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0,
+ 0, 0, 0, 0x2126, 0x213C, 0x2133, 0x2134, 0,
};
-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,
+const unsigned short utf8_to_euc_E388[] = {
0, 0, 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,
-};
-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, 0x2D6A, 0x2D6B, 0, 0, 0, 0, 0,
+ 0, 0x2D6C, 0, 0, 0, 0, 0, 0,
+};
+const unsigned short utf8_to_euc_E38A[] = {
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, 0x2D78, 0, 0, 0, 0, 0, 0,
+ 0x2D69, 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_E38C[] = {
- 0x2E3F, 0, 0, 0x2D46, 0, 0x2E26, 0, 0,
+const unsigned short utf8_to_euc_E38C[] = {
+ 0, 0, 0, 0x2D46, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x2D4A, 0, 0,
- 0, 0, 0, 0, 0x2D41, 0x2E2C, 0x2E25, 0,
- 0x2D44, 0, 0, 0, 0, 0, 0x2E40, 0,
+ 0, 0, 0, 0, 0x2D41, 0, 0, 0,
+ 0x2D44, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0x2D42, 0x2D4C, 0, 0, 0x2D4B, 0x2D45,
- 0, 0, 0x2E41, 0x2D4D, 0, 0, 0, 0,
- 0, 0x2E42, 0, 0x2E27, 0, 0, 0x2D47, 0,
- 0, 0x2E30, 0, 0x2D4F, 0, 0, 0, 0,
+ 0, 0, 0, 0x2D4D, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0x2D47, 0,
+ 0, 0, 0, 0x2D4F, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E38D[] = {
- 0, 0, 0x2E33, 0, 0, 0, 0, 0x2E43,
- 0, 0x2D40, 0x2D4E, 0, 0, 0x2D43, 0x2E28, 0,
+const unsigned short utf8_to_euc_E38D[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x2D40, 0x2D4E, 0, 0, 0x2D43, 0, 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, 0x2E7C,
+ 0, 0, 0, 0x2D5F, 0x2D6F, 0x2D6E, 0x2D6D, 0,
};
-unsigned short utf8_to_euc_E38E[] = {
- 0, 0, 0, 0, 0, 0x2B3B, 0x2B3C, 0x2B3D,
+const unsigned short utf8_to_euc_E38E[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
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,
- 0x2B36, 0x2B35, 0x2B34, 0x2B33, 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,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E38F[] = {
+const unsigned short utf8_to_euc_E38F[] = {
0, 0, 0, 0, 0x2D55, 0, 0, 0,
- 0, 0, 0, 0x2B39, 0, 0x2D63, 0, 0,
- 0, 0, 0, 0, 0x2B38, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0x2D63, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
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_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,
+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,
0x345D, 0x4330, 0, 0x3C67, 0x5027, 0, 0, 0x5028,
};
-unsigned short utf8_to_euc_E4B9[] = {
- 0, 0, 0x5029, 0x4735, 0, 0x3557, 0, 0,
+const unsigned short utf8_to_euc_E4B9[] = {
+ 0xB02F, 0xB030, 0x5029, 0x4735, 0xB031, 0x3557, 0, 0xB032,
0, 0, 0, 0x4737, 0, 0x4663, 0x3843, 0x4B33,
- 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[] = {
+ 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[] = {
0x3535, 0, 0x502C, 0, 0, 0x502D, 0x4E3B, 0,
- 0x4D3D, 0x4168, 0x502F, 0x3B76, 0x4673, 0, 0x5032, 0,
- 0, 0x313E, 0x385F, 0, 0x385E, 0x3066, 0, 0,
- 0x4F4B, 0x4F4A, 0, 0x3A33, 0x3021, 0, 0x5033, 0x5034,
+ 0x4D3D, 0x4168, 0x502F, 0x3B76, 0x4673, 0xB03D, 0x5032, 0,
+ 0, 0x313E, 0x385F, 0, 0x385E, 0x3066, 0xB03E, 0xB03F,
+ 0x4F4B, 0x4F4A, 0, 0x3A33, 0x3021, 0xB040, 0x5033, 0x5034,
0x5035, 0x4B34, 0x5036, 0, 0x3872, 0x3067, 0x4B72, 0,
- 0x357C, 0, 0, 0x357D, 0x357E, 0x4462, 0x4E3C, 0,
+ 0x357C, 0, 0, 0x357D, 0x357E, 0x4462, 0x4E3C, 0xB041,
0x5037, 0, 0, 0x5038, 0, 0, 0x5039, 0,
- 0, 0, 0x3F4D, 0, 0, 0, 0, 0,
+ 0, 0xB042, 0x3F4D, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E4BB[] = {
- 0x3D3A, 0x3F4E, 0x503E, 0, 0x503C, 0, 0x503D, 0x3558,
+const unsigned short utf8_to_euc_E4BB[] = {
+ 0x3D3A, 0x3F4E, 0x503E, 0xB043, 0x503C, 0, 0x503D, 0x3558,
0, 0, 0x3A23, 0x3270, 0, 0x503B, 0x503A, 0x4A29,
- 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,
+ 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,
0x3622, 0x3241, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x5525, 0, 0x4B79, 0x496E, 0x3874,
- 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, 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, 0, 0x3D24, 0x506D,
- 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,
+ 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,
0x5079, 0, 0, 0, 0, 0x3536, 0, 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,
+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,
0x4134, 0x5140, 0x5141, 0x482C, 0x3878, 0x4F3B, 0x5142, 0,
0, 0x3626, 0, 0, 0, 0x4A3C, 0x4236, 0x3671,
- 0x4535, 0, 0, 0, 0x3773, 0, 0, 0,
+ 0x4535, 0, 0, 0, 0x3773, 0, 0xB26F, 0,
};
-unsigned short utf8_to_euc_E586[] = {
- 0x5143, 0, 0x5144, 0, 0, 0x4662, 0x315F, 0,
- 0, 0x5147, 0x3A7D, 0, 0x5146, 0x3A46, 0, 0x5148,
+const unsigned short utf8_to_euc_E586[] = {
+ 0x5143, 0, 0x5144, 0xB270, 0xB271, 0x4662, 0x315F, 0,
+ 0, 0x5147, 0x3A7D, 0xB272, 0x5146, 0x3A46, 0xB273, 0x5148,
0x666E, 0x5149, 0x4B41, 0x514A, 0, 0x514B, 0x514C, 0x3E69,
- 0, 0x3C4C, 0, 0, 0, 0x7945, 0, 0,
- 0x3427, 0, 0x514F, 0, 0x514D, 0x4C3D, 0x514E, 0,
- 0x495A, 0x5150, 0x5151, 0x5152, 0x455F, 0, 0, 0,
+ 0xB274, 0x3C4C, 0, 0, 0, 0xB275, 0, 0,
+ 0x3427, 0xB276, 0x514F, 0xB277, 0x514D, 0x4C3D, 0x514E, 0,
+ 0x495A, 0x5150, 0x5151, 0x5152, 0x455F, 0xB278, 0, 0,
0x5156, 0x5154, 0x5155, 0x5153, 0x3A63, 0x5157, 0x4C6A, 0x4E64,
- 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,
+ 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,
0x464C, 0x317A, 0x3D50, 0, 0, 0x4821, 0x5162, 0,
};
-unsigned short utf8_to_euc_E588[] = {
- 0x4561, 0, 0, 0x3F4F, 0x5163, 0, 0x4A2C, 0x405A,
+const unsigned short utf8_to_euc_E588[] = {
+ 0x4561, 0xB330, 0xB331, 0x3F4F, 0x5163, 0xB332, 0x4A2C, 0x405A,
0x3422, 0, 0x3429, 0x5164, 0, 0, 0x5166, 0,
- 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,
+ 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,
0x5230, 0x5231, 0x3C5B, 0, 0, 0, 0x387B, 0x4C5E,
};
-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,
+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,
0, 0x485C, 0x4234, 0x426E, 0x3628, 0, 0, 0x466E,
- 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,
+ 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,
0x525B, 0x4321, 0x427E, 0x362B, 0x3E24, 0x525C, 0x525A, 0x3244,
- 0x4266, 0x3C38, 0x3B4B, 0x3126, 0, 0, 0x3370, 0x3966,
+ 0x4266, 0x3C38, 0x3B4B, 0x3126, 0, 0xB463, 0x3370, 0x3966,
0x3B4A, 0, 0x525D, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E590[] = {
- 0, 0x525E, 0, 0x3549, 0x3346, 0, 0, 0,
+const unsigned short utf8_to_euc_E590[] = {
+ 0, 0x525E, 0xB464, 0x3549, 0x3346, 0, 0, 0,
0x3967, 0x3548, 0x445F, 0x3125, 0x4631, 0x4C3E, 0x3921, 0x4D79,
- 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,
+ 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,
0x355B, 0x3F61, 0, 0x4A2D, 0x5263, 0x525F, 0x3863, 0,
};
-unsigned short utf8_to_euc_E591[] = {
- 0x5260, 0, 0x4F24, 0, 0, 0, 0x4A72, 0,
- 0x4468, 0x3862, 0x3970, 0, 0, 0, 0x5268, 0,
+const unsigned short utf8_to_euc_E591[] = {
+ 0x5260, 0, 0x4F24, 0xB46F, 0xB470, 0, 0x4A72, 0xB471,
+ 0x4468, 0x3862, 0x3970, 0, 0, 0xB472, 0x5268, 0xB473,
0, 0x465D, 0, 0, 0, 0, 0, 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, 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, 0,
0x5326, 0, 0, 0, 0, 0, 0, 0,
- 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,
+ 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,
};
-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,
+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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 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,
+ 0, 0, 0xB54E, 0xB54F, 0, 0, 0x5334, 0x4D23,
+ 0, 0x3E27, 0xB550, 0x533A, 0, 0xB551, 0xB552, 0,
+ 0x5339, 0x5330, 0, 0xB553, 0xB554, 0xB555, 0x4243, 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,
+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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x5341, 0x5346, 0, 0x5342, 0,
+ 0, 0, 0, 0x5341, 0x5346, 0, 0x5342, 0xB565,
};
-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,
+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,
0x5343, 0x533C, 0x342D, 0, 0x346E, 0x3365, 0x5344, 0x5340,
- 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,
+ 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,
0x4655, 0, 0x4838, 0, 0, 0, 0, 0,
};
-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,
+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,
0, 0x537A, 0x3847, 0, 0, 0x3971, 0, 0x537C,
};
-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,
+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,
0x543B, 0, 0, 0x5438, 0, 0, 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,
+ 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, 0x4244, 0, 0,
- 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,
+ 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,
};
-unsigned short utf8_to_euc_E5A1[] = {
+const unsigned short utf8_to_euc_E5A1[] = {
0x4A3D, 0x4E5D, 0, 0, 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,
+ 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,
0x544B, 0, 0x5447, 0, 0, 0x3F50, 0, 0,
- 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,
+ 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, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, 0, 0,
};
-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,
+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,
0x4660, 0x4A74, 0, 0, 0, 0, 0x5477, 0x4155,
- 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[] = {
+ 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[] = {
0, 0x5522, 0x4721, 0x485E, 0x4C51, 0, 0, 0,
- 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, 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, 0, 0x3079, 0, 0, 0, 0x3B51,
};
-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,
+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,
0, 0, 0, 0, 0x3E2B, 0, 0, 0,
};
-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,
+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,
0x554C, 0, 0, 0, 0, 0, 0x5545, 0x5542,
- 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, 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, 0x3528, 0x3849, 0x5557, 0x3358, 0,
- 0, 0x5558, 0, 0x4239, 0, 0, 0, 0,
+ 0xBA40, 0x5558, 0, 0x4239, 0, 0, 0xBA41, 0xBA42,
0x5559, 0x5623, 0, 0x555A, 0, 0x555B, 0, 0,
- 0x555C, 0, 0x555E, 0, 0, 0, 0, 0,
+ 0x555C, 0, 0x555E, 0, 0xBA43, 0xBA44, 0xBA45, 0xBA46,
};
-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,
+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,
0x3431, 0x4368, 0x446A, 0x3038, 0x3539, 0x4A75, 0, 0x3C42,
0, 0, 0x3552, 0x406B, 0x3C3C, 0x4D28, 0x5561, 0,
- 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[] = {
+ 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, 0x4975, 0x406C, 0, 0x3C4D, 0x5571, 0x3E2D, 0x5572,
- 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,
+ 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,
0x5579, 0x557A, 0x3C5C, 0x3F2C, 0x4674, 0x3F54, 0x4878, 0x4722,
};
-unsigned short utf8_to_euc_E5B1[] = {
+const 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, 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, 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, 0x5632, 0, 0x5634,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x5635, 0, 0, 0, 0, 0, 0,
+ 0, 0xBB39, 0, 0xBB3A, 0, 0, 0, 0,
+ 0, 0, 0xBB3B, 0, 0, 0, 0, 0xBB3D,
+ 0, 0x5635, 0, 0, 0, 0xBB3C, 0, 0,
0x463D, 0x362E, 0, 0, 0, 0, 0, 0,
- 0x3265, 0x5636, 0x563B, 0, 0, 0x5639, 0, 0x4A77,
- 0x4A76, 0, 0, 0, 0, 0x7972, 0x4567, 0,
+ 0x3265, 0x5636, 0x563B, 0, 0, 0x5639, 0xBB3E, 0x4A77,
+ 0x4A76, 0xBB3F, 0xBB40, 0, 0xBB41, 0xF43B, 0x4567, 0,
0, 0, 0x5638, 0x3D54, 0, 0x5637, 0, 0,
};
-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,
+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,
0x5647, 0x5646, 0x5645, 0x5641, 0, 0, 0, 0x5640,
- 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, 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, 0x384A, 0x5661, 0x4C26, 0x4743, 0x5662, 0, 0x392B,
- 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[] = {
+ 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[] = {
0x566C, 0, 0, 0x566B, 0x566A, 0x497D, 0, 0x5673,
- 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, 0xBC34, 0, 0xBC32, 0x4B5A, 0, 0x566D, 0,
+ 0xBC33, 0xBC35, 0, 0, 0x566F, 0x4B6B, 0xBC36, 0x566E,
+ 0xBC37, 0, 0, 0xBC38, 0xBC39, 0, 0xBC3A, 0x5670,
0, 0x4828, 0x5671, 0x4A3E, 0x5672, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x3433, 0x4A3F, 0x472F, 0x5674, 0x5675, 0,
+ 0xBC3B, 0, 0xBC3C, 0xBC3D, 0xBC3E, 0xBC3F, 0xBC40, 0,
+ 0xBC41, 0, 0x3433, 0x4A3F, 0x472F, 0x5674, 0x5675, 0,
0x392C, 0x3434, 0x5676, 0x3838, 0x4D44, 0x4D29, 0x3476, 0x5678,
};
-unsigned short utf8_to_euc_E5BA[] = {
- 0, 0x4423, 0, 0x392D, 0x3E31, 0, 0, 0x485F,
- 0, 0, 0x3E32, 0, 0, 0, 0, 0x3D78,
+const unsigned short utf8_to_euc_E5BA[] = {
+ 0xBC42, 0x4423, 0, 0x392D, 0x3E31, 0, 0, 0x485F,
+ 0, 0, 0x3E32, 0xBC43, 0, 0, 0xBC44, 0x3D78,
0, 0, 0, 0, 0, 0x446C, 0x4A79, 0x4539,
0, 0, 0x392E, 0, 0x495C, 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,
+ 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,
0x572D, 0x572B, 0, 0x572C, 0x572E, 0, 0x3164, 0x446E,
0x572F, 0, 0x377A, 0x3276, 0x4736, 0, 0x5730, 0x467B,
};
-unsigned short utf8_to_euc_E5BC[] = {
- 0, 0x4A5B, 0, 0x5731, 0x4F2E, 0, 0, 0,
- 0, 0x5732, 0x4A40, 0x5735, 0x5021, 0x5031, 0, 0x3C30,
+const unsigned short utf8_to_euc_E5BC[] = {
+ 0, 0x4A5B, 0xBC5C, 0x5731, 0x4F2E, 0, 0xBC5D, 0xBC5E,
+ 0xBC5F, 0x5732, 0x4A40, 0x5735, 0x5021, 0x5031, 0xBC60, 0x3C30,
0x4675, 0x5736, 0, 0x355D, 0x4424, 0x307A, 0x5737, 0x4A26,
- 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[] = {
+ 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[] = {
0x317D, 0x402C, 0x5749, 0x5748, 0x3742, 0x4254, 0, 0x574E,
- 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,
+ 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,
0, 0, 0x576A, 0, 0, 0, 0, 0,
};
-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,
+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,
0x3A28, 0x3238, 0x576D, 0x5778, 0x5777, 0x3633, 0, 0x4229,
- 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,
+ 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,
0x3B34, 0, 0, 0, 0, 0, 0, 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,
+ 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,
0, 0, 0, 0x5858, 0, 0x4A69, 0, 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,
+ 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,
0, 0, 0x377B, 0, 0, 0, 0x3231, 0,
- 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,
+ 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, 0x4428, 0, 0x5873, 0, 0x5871, 0x5867,
0x377C, 0, 0x5872, 0, 0x5876, 0x5875, 0x5877, 0x5874,
};
-unsigned short utf8_to_euc_E688[] = {
- 0x5878, 0, 0, 0, 0, 0, 0, 0,
+const unsigned short utf8_to_euc_E688[] = {
+ 0x5878, 0xBF24, 0, 0xBF25, 0xBF26, 0, 0, 0xBF27,
0x5879, 0x587A, 0x4A6A, 0, 0x587C, 0x587B, 0x3D3F, 0,
- 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,
+ 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,
0x5925, 0, 0x5926, 0x5927, 0x4257, 0, 0, 0,
- 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[] = {
+ 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[] = {
0x353B, 0, 0x5930, 0x5937, 0x3E36, 0, 0, 0,
- 0, 0x5931, 0x4744, 0, 0, 0, 0, 0,
- 0, 0x4D5E, 0x5933, 0x5934, 0x5938, 0x456A, 0x5935, 0x3933,
+ 0, 0x5931, 0x4744, 0, 0, 0xBF45, 0xBF46, 0xBF47,
+ 0xBF48, 0x4D5E, 0x5933, 0x5934, 0x5938, 0x456A, 0x5935, 0x3933,
0x405E, 0, 0, 0x5946, 0x4834, 0, 0x4272, 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,
+ 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,
0x3572, 0x3348, 0, 0, 0, 0, 0, 0,
- 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, 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, 0, 0, 0, 0x594B,
- 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,
+ 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,
0, 0, 0x3747, 0, 0x444F, 0x595E, 0, 0,
- 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, 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, 0, 0, 0, 0x596C, 0,
- 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, 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, 0x405D, 0, 0, 0, 0, 0,
- 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,
+ 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,
0x5A26, 0, 0x5A21, 0, 0, 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,
+ 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,
0x3F74, 0, 0x5A4A, 0, 0x4030, 0x4528, 0, 0x495F,
- 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,
+ 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,
0x5A5B, 0x5A5C, 0x347B, 0, 0, 0x467C, 0x4336, 0x356C,
0x3B5D, 0x4161, 0, 0, 0x3D5C, 0x3030, 0, 0,
- 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,
+ 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,
0x5B25, 0, 0, 0, 0, 0, 0x5B27, 0,
- 0, 0x5B28, 0, 0, 0, 0, 0, 0,
+ 0xC269, 0x5B28, 0, 0xC26A, 0xC26B, 0, 0xC26C, 0,
0x5B29, 0, 0x364A, 0x3148, 0x3939, 0x5B2A, 0, 0x5B2B,
- 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,
+ 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,
0x4C5A, 0, 0x4C24, 0x4B76, 0x4B5C, 0x3B25, 0x5B32, 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,
+ 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,
0x4F48, 0x5B46, 0x3F75, 0, 0, 0, 0x5B45, 0,
0, 0x5B40, 0, 0, 0, 0, 0, 0x384F,
- 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,
+ 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, 0x5B4D, 0, 0, 0x5B4B, 0, 0x5B53, 0x5B49,
- 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,
+ 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, 0, 0, 0x5B63, 0, 0, 0, 0x4930,
- 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, 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, 0x3F7A, 0x5C2F, 0x3371, 0x3821, 0, 0, 0,
0, 0x5C31, 0x5B7A, 0x5C30, 0, 0x5C29, 0x5B7B, 0,
0x5C2D, 0, 0x5C2E, 0, 0, 0, 0, 0,
- 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,
+ 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,
0x4D4D, 0x4B6A, 0, 0, 0, 0x5C4F, 0x5C59, 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, 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, 0x3D5E, 0x3C6C, 0x3B44, 0, 0x5D4B, 0, 0,
- 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[] = {
+ 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[] = {
0x4475, 0x3D41, 0x3561, 0, 0, 0, 0, 0,
- 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, 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, 0x4B57, 0x4274, 0, 0, 0, 0, 0,
0, 0, 0, 0x4B77, 0, 0, 0x5D7C, 0,
- 0, 0x5D7D, 0, 0x324F, 0, 0, 0, 0,
+ 0xC673, 0x5D7D, 0xC674, 0x324F, 0xC675, 0, 0, 0,
0x4A28, 0x4C7D, 0x5E21, 0x3C23, 0x3E42, 0x5D78, 0x5D7E, 0x3168,
};
-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[] = {
+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[] = {
0, 0x4E2E, 0, 0, 0x3E74, 0x4075, 0, 0,
0, 0, 0, 0, 0, 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,
+ 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,
};
-unsigned short utf8_to_euc_E6B6[] = {
- 0, 0, 0, 0, 0, 0x5E3A, 0, 0x7A61,
+const unsigned short utf8_to_euc_E6B6[] = {
+ 0, 0, 0xC746, 0, 0, 0x5E3A, 0, 0xC747,
0x3E43, 0, 0, 0, 0x4D30, 0, 0x5E37, 0,
- 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,
+ 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,
0x3A51, 0x3E44, 0x5E3D, 0x3D42, 0, 0, 0, 0,
0, 0, 0, 0x374C, 0, 0x5E3C, 0, 0,
- 0, 0x5E52, 0x3D6D, 0x383A, 0, 0x5E61, 0, 0x5E5B,
- 0x3574, 0x454F, 0, 0x5E56, 0x5E5F, 0x302F, 0x3132, 0x7A6B,
+ 0, 0x5E52, 0x3D6D, 0x383A, 0, 0x5E61, 0xC769, 0x5E5B,
+ 0x3574, 0x454F, 0xC76A, 0x5E56, 0x5E5F, 0x302F, 0x3132, 0xC76B,
0, 0x3239, 0, 0x5E58, 0x422C, 0x5E4F, 0x5E51, 0x3941,
- 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[] = {
+ 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[] = {
0x4B7E, 0, 0x5E63, 0, 0, 0, 0, 0,
- 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, 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, 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, 0, 0x5E76, 0, 0, 0x5E7C,
+ 0, 0, 0, 0xC83B, 0x5E76, 0xC83C, 0xC83D, 0x5E7C,
0, 0, 0x5E7A, 0, 0x4529, 0, 0, 0x5F23,
- 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[] = {
+ 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[] = {
0, 0x5E73, 0, 0, 0, 0x3443, 0, 0,
- 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,
+ 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,
0x4459, 0, 0, 0, 0x5F4C, 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,
+ 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,
0, 0, 0, 0, 0x5F3E, 0x5F3C, 0, 0,
- 0x5F3F, 0, 0, 0x5F42, 0, 0, 0, 0x5F3B,
+ 0x5F3F, 0, 0xC921, 0x5F42, 0, 0, 0xC922, 0x5F3B,
0x396A, 0x4728, 0, 0, 0x5E39, 0, 0, 0,
- 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,
+ 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,
0x5F4E, 0, 0x5F4B, 0x5F4A, 0, 0x5F4D, 0x4654, 0x5F4F,
- 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,
+ 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, 0x4F27, 0x3F66, 0, 0, 0, 0x316A, 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,
+ 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,
};
-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,
+const unsigned short utf8_to_euc_E783[] = {
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, 0, 0, 0, 0x5F62, 0, 0,
+ 0, 0x4B23, 0xC961, 0, 0, 0x5F62, 0, 0,
};
-unsigned short utf8_to_euc_E784[] = {
- 0, 0, 0, 0, 0x7A77, 0, 0, 0,
- 0, 0x5F61, 0, 0, 0, 0, 0, 0x7A76,
+const unsigned short utf8_to_euc_E784[] = {
+ 0, 0, 0, 0xC962, 0xC963, 0xC964, 0xC965, 0xC966,
+ 0, 0x5F61, 0, 0xC967, 0xC968, 0, 0, 0xC969,
0, 0, 0, 0, 0x316B, 0, 0, 0,
- 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,
+ 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,
0x5F7A, 0, 0, 0, 0, 0x4167, 0x3B38, 0x5F7C,
0, 0, 0, 0, 0x5F7B, 0x3F24, 0x5259, 0,
0, 0, 0, 0, 0, 0x5F7D, 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,
+ 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,
0x353E, 0, 0x6039, 0, 0, 0, 0, 0x603A,
- 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,
+ 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, 0x3C6D, 0, 0, 0x4648, 0x3639, 0, 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, 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, 0x6077, 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,
+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,
0, 0, 0, 0, 0x612E, 0x6130, 0x612F, 0,
- 0, 0x3979, 0, 0x6132, 0, 0x6131, 0, 0,
+ 0, 0x3979, 0xCD21, 0x6132, 0, 0x6131, 0xCD22, 0xCD23,
0x3445, 0, 0x3F53, 0, 0x453C, 0, 0x6133, 0x4038,
- 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,
+ 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, 0x6149, 0x6148, 0x4925, 0, 0, 0x4142, 0x4141,
- 0, 0x353F, 0, 0, 0x614B, 0, 0, 0,
- 0, 0, 0x614C, 0, 0, 0x614D, 0, 0,
- 0, 0, 0, 0x614F, 0, 0x614E, 0, 0,
+ 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, 0, 0, 0x3156, 0, 0, 0, 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,
+ 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,
0x6223, 0, 0x482F, 0x4550, 0x6224, 0x4772, 0x4934, 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,
+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,
0x622E, 0, 0, 0, 0x622F, 0, 0, 0x7369,
- 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,
+ 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,
0, 0, 0x4557, 0, 0, 0, 0, 0x395C,
};
-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,
+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,
0, 0, 0x4823, 0, 0x626D, 0, 0, 0,
- 0, 0, 0x7B40, 0, 0x626F, 0, 0, 0,
+ 0, 0, 0xCF6D, 0, 0x626F, 0, 0xCF6E, 0,
};
-unsigned short utf8_to_euc_E7A2[] = {
+const unsigned short utf8_to_euc_E7A2[] = {
0, 0x386B, 0, 0, 0, 0, 0x626E, 0x4476,
- 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[] = {
+ 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[] = {
0x6349, 0x3658, 0, 0, 0x4F3D, 0x4135, 0, 0,
- 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,
+ 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,
0x3568, 0, 0x6375, 0x6424, 0, 0, 0, 0x6374,
- 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, 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, 0, 0, 0, 0, 0x6438, 0, 0,
- 0, 0, 0, 0, 0, 0x6428, 0, 0x642A,
- 0, 0, 0, 0, 0x642D, 0, 0x642E, 0,
- 0x642B, 0x642C, 0, 0, 0x6429, 0x6427, 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, 0x6421, 0, 0, 0, 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,
+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,
0x3C44, 0, 0, 0, 0x4646, 0x6445, 0x6444, 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,
+ 0xD252, 0x6441, 0xD253, 0, 0, 0x4F36, 0, 0,
+ 0, 0, 0xD254, 0x644A, 0xD255, 0xD256, 0x644E, 0x644B,
+ 0xD257, 0xD258, 0xD259, 0, 0xD25A, 0, 0xD25B, 0,
};
-unsigned short utf8_to_euc_E7B0[] = {
- 0x6447, 0, 0, 0, 0, 0, 0, 0x6448,
- 0, 0, 0, 0, 0, 0x644D, 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,
0, 0x6442, 0x5255, 0x6449, 0x6443, 0, 0, 0x644C,
- 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,
+ 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,
0x646A, 0, 0, 0x6468, 0, 0x6466, 0x646E, 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,
+ 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,
0x3B65, 0, 0x647D, 0x374F, 0, 0, 0x356A, 0,
};
-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[] = {
+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[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -3658,509 +4775,509 @@ 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, 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,
+ 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,
0, 0, 0x3D2C, 0, 0x6646, 0x6645, 0, 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, 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, 0x6658, 0, 0, 0, 0, 0,
0, 0, 0x665A, 0, 0, 0, 0x403B, 0,
0x665B, 0, 0x665C, 0, 0, 0, 0x4A39, 0x665D,
- 0, 0x416F, 0x665E, 0, 0, 0, 0, 0,
- 0x665F, 0, 0, 0, 0, 0, 0, 0x4E7E,
- 0x6662, 0, 0x6661, 0x6660, 0x4430, 0, 0x6663, 0x3F26,
+ 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, 0x6664, 0, 0, 0, 0x6665, 0x4F38, 0x6666,
};
-unsigned short utf8_to_euc_E882[] = {
- 0, 0, 0, 0, 0x6667, 0x6669, 0x6668, 0x4825,
- 0, 0x4679, 0, 0x4F3E, 0x4829, 0, 0, 0,
+const unsigned short utf8_to_euc_E882[] = {
+ 0, 0xD56A, 0, 0, 0x6667, 0x6669, 0x6668, 0x4825,
+ 0xD56B, 0x4679, 0, 0x4F3E, 0x4829, 0, 0xD56C, 0,
0, 0, 0, 0x666B, 0, 0, 0x3E53, 0,
- 0x492A, 0, 0x666C, 0x666A, 0, 0x344E, 0, 0,
- 0, 0x3854, 0x3B68, 0, 0, 0x486E, 0, 0,
- 0, 0x382A, 0x4B43, 0, 0x666F, 0x666D, 0, 0x394E,
+ 0x492A, 0, 0x666C, 0x666A, 0xD56D, 0x344E, 0xD56E, 0,
+ 0, 0x3854, 0x3B68, 0, 0, 0x486E, 0xD56F, 0xD570,
+ 0, 0x382A, 0x4B43, 0xD571, 0x666F, 0x666D, 0, 0x394E,
0, 0x394F, 0x3069, 0, 0x3A68, 0, 0, 0,
- 0, 0, 0x4759, 0, 0, 0, 0, 0,
+ 0xD572, 0xD573, 0x4759, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E883[] = {
+const unsigned short utf8_to_euc_E883[] = {
0, 0, 0, 0x305F, 0x6674, 0, 0x4340, 0,
- 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,
+ 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, 0, 0, 0, 0x6735,
- 0, 0, 0, 0, 0, 0x6729, 0x672A, 0,
- 0, 0, 0, 0x3C70, 0, 0, 0x6728, 0,
- 0x3978, 0x6727, 0, 0, 0x672B, 0, 0, 0,
+ 0xD63D, 0xD63E, 0, 0, 0, 0x6729, 0x672A, 0xD63F,
+ 0xD640, 0xD641, 0, 0x3C70, 0, 0xD642, 0x6728, 0xD643,
+ 0x3978, 0x6727, 0, 0, 0x672B, 0, 0, 0xD644,
0x4432, 0x4A22, 0x4123, 0, 0, 0, 0, 0x425C,
};
-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,
+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,
0, 0, 0, 0, 0, 0, 0x6823, 0x682C,
- 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,
+ 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,
0x4171, 0, 0, 0, 0, 0, 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, 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, 0x4D69, 0, 0, 0, 0x6839, 0, 0,
- 0, 0, 0, 0, 0, 0x684F, 0, 0,
+ 0, 0, 0, 0, 0, 0x684F, 0xD834, 0xD835,
};
-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,
+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,
0x684A, 0, 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,
+ 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,
0x684E, 0, 0x684D, 0, 0, 0, 0, 0,
- 0, 0x476B, 0x6854, 0, 0x685F, 0, 0, 0,
+ 0, 0x476B, 0x6854, 0, 0x685F, 0, 0, 0xD84D,
0, 0x337E, 0, 0, 0, 0x6862, 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,
+ 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,
0, 0, 0, 0x3E55, 0, 0, 0, 0,
- 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,
+ 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,
0, 0, 0, 0, 0, 0, 0, 0x6931,
- 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,
+ 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,
0x6938, 0, 0, 0, 0, 0x6939, 0, 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,
+ 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, 0, 0x6948, 0x3857, 0,
- 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,
+ 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,
0, 0x6959, 0, 0x4341, 0, 0x3756, 0x3342, 0,
- 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, 0xDA63, 0xDA64, 0, 0x695C, 0xDA65, 0, 0xDA66,
+ 0, 0x333F, 0xDA67, 0x6961, 0xDA68, 0, 0x695D, 0x6960,
+ 0xDA69, 0, 0, 0xDA6A, 0x483A, 0xDA6B, 0, 0xDA6C,
0, 0x695E, 0, 0, 0x695F, 0x4948, 0x485A, 0x6962,
0, 0, 0, 0, 0, 0, 0, 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,
+ 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,
0, 0, 0, 0x6A21, 0, 0x3F2A, 0, 0x697B,
- 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,
+ 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, 0x6A42, 0x6A41, 0x695A, 0, 0, 0, 0x6A46,
- 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,
+ 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,
0x3736, 0, 0, 0x425E, 0, 0x6A5C, 0, 0,
0, 0, 0x6A58, 0, 0, 0, 0x4235, 0x6A57,
- 0, 0x6A5A, 0, 0, 0, 0, 0x6A51, 0,
- 0, 0, 0x6A5B, 0, 0x6A5D, 0, 0, 0,
- 0, 0, 0, 0x486F, 0, 0, 0x6A59, 0,
+ 0xDC39, 0x6A5A, 0xDC3A, 0xDC3B, 0xDC3C, 0, 0x6A51, 0xDC3D,
+ 0xDC3E, 0, 0x6A5B, 0, 0x6A5D, 0, 0, 0,
+ 0xDC3F, 0, 0xDC40, 0x486F, 0, 0, 0x6A59, 0,
0x6A5E, 0x6A60, 0, 0, 0x3853, 0x6A54, 0, 0x3041,
- 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,
+ 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,
0x4D67, 0x6A67, 0, 0, 0x6A69, 0x403D, 0x3F7E, 0,
};
-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[] = {
+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[] = {
0, 0x4D57, 0, 0x6B29, 0, 0, 0x4A24, 0x4746,
- 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,
+ 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,
0, 0x6B2F, 0x3F46, 0, 0x6B31, 0, 0, 0x6B32,
- 0, 0, 0x6B33, 0x3451, 0, 0, 0, 0,
- 0, 0, 0x6B34, 0, 0, 0x6B35, 0, 0x6B36,
+ 0xDD2E, 0, 0x6B33, 0x3451, 0xDD2F, 0xDD30, 0xDD31, 0xDD32,
+ 0, 0, 0x6B34, 0, 0xDD33, 0x6B35, 0, 0x6B36,
};
-unsigned short utf8_to_euc_E8A7[] = {
+const 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, 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, 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, 0x3B6D, 0, 0x4F4D, 0x6B4D, 0x6B4C, 0x4127, 0,
- 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,
+ 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,
0x6B63, 0x6B6B, 0x6B64, 0, 0x6B60, 0, 0x447C, 0x6B5F,
- 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,
+ 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,
0x6B6F, 0x4D58, 0, 0, 0, 0, 0x6B72, 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,
+ 0x6B75, 0, 0, 0x6B73, 0x4935, 0xDE40, 0, 0,
+ 0xDE41, 0, 0, 0x6B70, 0, 0, 0, 0xDE42,
+ 0, 0x3660, 0, 0, 0xDE43, 0, 0x6B74, 0,
};
-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_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_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,
+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,
0, 0, 0, 0, 0, 0, 0, 0,
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_E8B0[] = {
+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, 0,
@@ -4168,340 +5285,340 @@ 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,
- 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,
+ 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,
0x325F, 0x484E, 0x6C45, 0x3453, 0x4055, 0x6C44, 0x6C49, 0x4379,
0x4C63, 0, 0x6C47, 0x6C48, 0x352E, 0, 0x6C4A, 0x4763,
- 0x425F, 0, 0, 0x4871, 0x453D, 0x6C46, 0, 0x4B47,
+ 0x425F, 0xDF2A, 0xDF2B, 0x4871, 0x453D, 0x6C46, 0, 0x4B47,
};
-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_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_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,
+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,
0, 0, 0, 0, 0, 0, 0, 0,
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_E8B5[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
+const 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, 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,
};
-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_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_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_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_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,
+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,
0, 0, 0, 0, 0, 0x6C76, 0x6C77, 0x6C79,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xDF7C, 0xDF7D, 0xDF7E, 0xE021, 0, 0, 0xE022, 0xE023,
0, 0, 0x6D29, 0, 0, 0, 0, 0,
- 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,
+ 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,
0, 0, 0x453E, 0x6D44, 0, 0, 0, 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,
+ 0xE05D, 0, 0, 0x6D47, 0, 0xE064, 0xE05E, 0,
+ 0xE05F, 0xE060, 0, 0, 0, 0, 0, 0xE061,
+ 0x3C34, 0xE062, 0xE063, 0x6D46, 0x6D45, 0x375A, 0x6D48, 0,
};
-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_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_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,
+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,
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_E8BE[] = {
+const 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, 0, 0x3C2D, 0x6D64,
- 0, 0, 0, 0x6D65, 0, 0, 0, 0x5221,
+ 0, 0, 0, 0x3F49, 0x6D63, 0xE12D, 0x3C2D, 0x6D64,
+ 0xE12E, 0xE12F, 0, 0x6D65, 0xE130, 0xE131, 0xE132, 0x5221,
0x517E, 0, 0, 0, 0, 0x6D66, 0x6570, 0x6D67,
- 0x4324, 0x3F2B, 0x4740, 0, 0, 0, 0, 0x6D68,
- 0, 0, 0x4A55, 0x4454, 0x397E, 0, 0, 0x4329,
+ 0x4324, 0x3F2B, 0x4740, 0, 0, 0xE133, 0xE134, 0x6D68,
+ 0xE135, 0, 0x4A55, 0x4454, 0x397E, 0, 0xE136, 0x4329,
};
-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,
+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,
0, 0, 0x6D69, 0, 0, 0, 0, 0,
- 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,
+ 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,
0x4360, 0x6D73, 0, 0x447E, 0x4553, 0x6D74, 0x6D78, 0x3F60,
- 0, 0x4767, 0x444C, 0, 0, 0x4042, 0x6D77, 0x422E,
+ 0xE14F, 0x4767, 0x444C, 0xE150, 0, 0x4042, 0x6D77, 0x422E,
0x4224, 0x6D75, 0x3029, 0x4F22, 0, 0, 0, 0x6D7A,
- 0, 0, 0, 0, 0, 0, 0x4261, 0,
- 0, 0x3D35, 0x3F4A, 0, 0, 0x6D7C, 0x6D7B, 0,
- 0x306F, 0x6D7D, 0, 0, 0x492F, 0, 0x6E27, 0,
+ 0xE151, 0xE152, 0xE154, 0, 0xE155, 0xE156, 0x4261, 0xE153,
+ 0, 0x3D35, 0x3F4A, 0xE157, 0xE158, 0x6D7C, 0x6D7B, 0xE159,
+ 0x306F, 0x6D7D, 0, 0, 0x492F, 0, 0x6E27, 0xE15A,
};
-unsigned short utf8_to_euc_E981[] = {
- 0, 0x465B, 0x3F6B, 0, 0, 0x4359, 0, 0x3678,
- 0, 0x6E26, 0x4D37, 0x313F, 0, 0x4A57, 0x3261, 0x6E21,
+const unsigned short utf8_to_euc_E981[] = {
+ 0, 0x465B, 0x3F6B, 0xE15B, 0xE15C, 0x4359, 0, 0x3678,
+ 0, 0x6E26, 0x4D37, 0x313F, 0xE15D, 0x4A57, 0x3261, 0x6E21,
0x6E22, 0x6E23, 0x6E24, 0x463B, 0x4323, 0x3063, 0x6E28, 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,
+ 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,
0x6E37, 0, 0x3C59, 0, 0, 0, 0, 0x6E38,
- 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,
+ 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,
0x3C61, 0x6E58, 0, 0x6E59, 0x4E24, 0x3D45, 0x4C6E, 0x4E4C,
- 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[] = {
+ 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[] = {
0x3664, 0, 0, 0x3D46, 0, 0x463C, 0, 0,
- 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,
+ 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,
0, 0, 0x6F25, 0x6F27, 0, 0, 0, 0,
};
-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,
+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,
0x6F34, 0, 0, 0, 0, 0, 0, 0,
- 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, 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, 0x6F45, 0, 0, 0, 0, 0, 0,
- 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, 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, 0, 0x6F55, 0x6F53, 0x6F56, 0x6F58,
};
-unsigned short utf8_to_euc_E992[] = {
- 0, 0x6F57, 0, 0, 0, 0, 0, 0,
+const unsigned short utf8_to_euc_E992[] = {
+ 0, 0x6F57, 0, 0xE57C, 0xE57B, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -4510,7 +5627,7 @@ unsigned short utf8_to_euc_E992[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E995[] = {
+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, 0,
@@ -4518,349 +5635,349 @@ 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,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xE57D, 0xE57E, 0, 0, 0, 0, 0xE621, 0,
};
-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_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_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,
+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,
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_E998[] = {
+const 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, 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,
+ 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,
};
-unsigned short utf8_to_euc_E999[] = {
- 0x424B, 0, 0x6F78, 0, 0x496D, 0, 0, 0,
+const unsigned short utf8_to_euc_E999[] = {
+ 0x424B, 0xE653, 0x6F78, 0, 0x496D, 0, 0, 0,
0, 0, 0, 0x6F7B, 0x6F79, 0x395F, 0, 0x6F7A,
- 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[] = {
+ 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[] = {
0x3F7D, 0x3467, 0, 0, 0x4D3A, 0x326D, 0x3D38, 0x385B,
- 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, 0x7035, 0xE672, 0x7034, 0x3B73, 0x7036, 0x7033, 0,
+ 0, 0x3B28, 0xE673, 0, 0, 0x703A, 0x6A2D, 0,
+ 0xE675, 0x5256, 0xE676, 0x3F77, 0x7038, 0xE677, 0xE678, 0xE679,
0, 0, 0x4E25, 0x4671, 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,
+ 0x312B, 0xE67A, 0x4063, 0x3C36, 0, 0, 0, 0xE67B,
+ 0x4A37, 0xE67C, 0x3140, 0, 0, 0, 0x4E6D, 0x4D6B,
+ 0, 0x703B, 0xE67D, 0x4545, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E99C[] = {
- 0x3C7B, 0, 0, 0, 0x703C, 0, 0x703D, 0x3F4C,
- 0x703E, 0, 0x4E6E, 0, 0, 0x7039, 0x7040, 0x7042,
+const unsigned short utf8_to_euc_E99C[] = {
+ 0x3C7B, 0, 0xE67E, 0xE721, 0x703C, 0xE722, 0x703D, 0x3F4C,
+ 0x703E, 0xE723, 0x4E6E, 0, 0, 0x7039, 0x7040, 0x7042,
0, 0x7041, 0, 0x703F, 0, 0, 0x7043, 0,
- 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,
+ 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,
0x707E, 0x7121, 0, 0x7123, 0x7122, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_E9A2[] = {
+const 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, 0, 0, 0, 0, 0x7125,
- 0, 0x7126, 0, 0, 0, 0, 0x7127, 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,
};
-unsigned short utf8_to_euc_E9A3[] = {
- 0, 0, 0, 0x7129, 0x7128, 0, 0x712A, 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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0x4874, 0x664C, 0, 0, 0x3F29,
- 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, 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, 0, 0, 0x3B74, 0x4B30, 0x3E7E, 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_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_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,
+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,
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_E9A6[] = {
+const 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, 0, 0, 0, 0x7C60, 0,
- 0, 0, 0, 0, 0, 0x7146, 0, 0,
+ 0x7145, 0x3961, 0, 0xE877, 0, 0xE878, 0xF47A, 0xE879,
+ 0, 0, 0, 0, 0, 0x7146, 0xE87A, 0,
0x333E, 0, 0, 0, 0x474F, 0x7147, 0x7148, 0,
- 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,
+ 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, 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,
};
-unsigned short utf8_to_euc_E9AA[] = {
+const 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, 0, 0, 0, 0x716C, 0, 0,
- 0x716D, 0, 0, 0, 0, 0, 0, 0,
- 0x333C, 0, 0, 0, 0x716E, 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,
};
-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_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_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_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_E9AD[] = {
+const unsigned short utf8_to_euc_E9AD[] = {
0, 0x3321, 0x3A32, 0x7231, 0x7230, 0x4C25, 0, 0,
- 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,
+ 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, 0x4837, 0, 0x726F, 0x726B, 0, 0, 0,
- 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,
+ 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,
0, 0, 0, 0x7275, 0, 0, 0x7273, 0,
- 0x337B, 0, 0x7272, 0x3C32, 0x3229, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x3963, 0, 0, 0x727C, 0x727B,
+ 0x337B, 0, 0x7272, 0x3C32, 0x3229, 0, 0, 0xEB65,
+ 0xEB66, 0, 0xEB67, 0xEB68, 0xEB69, 0, 0, 0,
+ 0, 0, 0xEB6A, 0x3963, 0xEB6B, 0xEB6D, 0x727C, 0x727B,
};
-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_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_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_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_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_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_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,
+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,
0, 0, 0, 0, 0, 0, 0, 0,
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_E9B9[] = {
+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, 0, 0, 0,
@@ -4868,110 +5985,90 @@ 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, 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,
+ 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,
0x7350, 0x396D, 0x4C4D, 0x4B63, 0x5677, 0, 0x5D60, 0x4B7B,
};
-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,
+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,
0, 0, 0x736E, 0x6337, 0, 0, 0x6C5A, 0x706D,
- 0, 0, 0x736F, 0, 0x7370, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0x7372,
+ 0, 0, 0x736F, 0xED45, 0x7370, 0xED46, 0xED47, 0xED48,
+ 0xED49, 0, 0xED4A, 0, 0, 0xED4B, 0xED4C, 0x7372,
0x7373, 0x7374, 0x4E70, 0x7371, 0, 0, 0x7375, 0x7376,
- 0, 0, 0x7378, 0, 0x7377, 0, 0, 0,
- 0, 0, 0x737A, 0, 0, 0, 0x737B, 0x7379,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0xED4D, 0xED4E, 0x7378, 0, 0x7377, 0xED4F, 0xED50, 0xED51,
+ 0xED52, 0xED53, 0x737A, 0xED54, 0, 0xED55, 0x737B, 0x7379,
+ 0, 0, 0xED56, 0, 0, 0xED57, 0, 0,
};
-unsigned short utf8_to_euc_E9BE[] = {
+const unsigned short utf8_to_euc_E9BE[] = {
0, 0, 0, 0, 0, 0, 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, 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, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_EFA4[] = {
+const 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, 0x7A46, 0, 0, 0, 0, 0, 0,
+ 0, 0xF445, 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_EFA7[] = {
+const 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, 0x7C4F, 0, 0, 0,
+ 0, 0, 0, 0, 0xF472, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
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_EFA8[] = {
+const unsigned short utf8_to_euc_EFA8[] = {
0, 0, 0, 0, 0, 0, 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, 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, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-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,
+const unsigned short utf8_to_euc_EFBC[] = {
+ 0, 0x212A, 0xF42A, 0x2174, 0x2170, 0x2173, 0x2175, 0xF429,
0x214A, 0x214B, 0x2176, 0x215C, 0x2124, 0x215D, 0x2125, 0x213F,
0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337,
0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129,
@@ -4980,7 +6077,17 @@ unsigned short utf8_to_euc_EFBC[] = {
0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357,
0x2358, 0x2359, 0x235A, 0x214E, 0x2140, 0x214F, 0x2130, 0x2132,
};
-unsigned short utf8_to_euc_EFBD[] = {
+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[] = {
0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
@@ -4990,7 +6097,7 @@ unsigned short utf8_to_euc_EFBD[] = {
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
0x0E38, 0x0E39, 0x0E3A, 0x0E3B, 0x0E3C, 0x0E3D, 0x0E3E, 0x0E3F,
};
-unsigned short utf8_to_euc_EFBE[] = {
+const 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,
@@ -5000,25 +6107,61 @@ unsigned short utf8_to_euc_EFBE[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned short utf8_to_euc_EFBF[] = {
+const 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, 0x7C7C, 0x216F, 0, 0,
+ 0x2171, 0x2172, 0x224C, 0x2131, 0xA243, 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,
};
-unsigned short * utf8_to_euc_E2[] = {
+const unsigned short *const 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, utf8_to_euc_E292, 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,
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, utf8_to_euc_E29D, 0, 0,
+ 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -5028,10 +6171,10 @@ unsigned short * utf8_to_euc_E2[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
-unsigned short * utf8_to_euc_E3[] = {
+const unsigned short *const 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, utf8_to_euc_E389, utf8_to_euc_E38A, 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,
@@ -5046,7 +6189,25 @@ unsigned short * utf8_to_euc_E3[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
-unsigned short * utf8_to_euc_E4[] = {
+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[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -5064,7 +6225,7 @@ unsigned short * 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,
};
-unsigned short * utf8_to_euc_E5[] = {
+const unsigned short *const 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,
@@ -5082,7 +6243,7 @@ unsigned short * 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,
};
-unsigned short * utf8_to_euc_E6[] = {
+const unsigned short *const 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,
@@ -5100,7 +6261,7 @@ unsigned short * 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,
};
-unsigned short * utf8_to_euc_E7[] = {
+const unsigned short *const 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,
@@ -5118,7 +6279,7 @@ unsigned short * 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,
};
-unsigned short * utf8_to_euc_E8[] = {
+const unsigned short *const 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,
@@ -5136,7 +6297,7 @@ unsigned short * 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,
};
-unsigned short * utf8_to_euc_E9[] = {
+const unsigned short *const 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,
@@ -5154,7 +6315,7 @@ unsigned short * 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,
};
-unsigned short * utf8_to_euc_EF[] = {
+const unsigned short *const utf8_to_euc_EF[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -5169,10 +6330,28 @@ unsigned short * utf8_to_euc_EF[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
- utf8_to_euc_EFB8, utf8_to_euc_EFB9, 0, 0,
+ 0, 0, 0, 0,
utf8_to_euc_EFBC, utf8_to_euc_EFBD, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
};
-unsigned short * utf8_to_euc_2bytes[] = {
+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[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -5190,8 +6369,38 @@ unsigned short * 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,
@@ -5202,8 +6411,7 @@ unsigned short * utf8_to_euc_2bytes[] = {
0, 0, 0, 0,
0, 0, 0, 0,
};
-unsigned short ** utf8_to_euc_3bytes[] = {
- 0, 0, 0, 0,
+const unsigned short *const utf8_to_euc_2bytes_932[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -5220,6 +6428,11 @@ unsigned short ** utf8_to_euc_3bytes[] = {
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,
@@ -5227,15 +6440,980 @@ unsigned short ** utf8_to_euc_3bytes[] = {
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
-unsigned short shiftjis_cp932[3][189] = {
+const unsigned short shiftjis_cp932[3][189] = {
{
0xEEEF, 0xEEF0, 0xEEF1, 0xEEF2, 0xEEF3, 0xEEF4, 0xEEF5, 0xEEF6,
0xEEF7, 0xEEF8, 0x8754, 0x8755, 0x8756, 0x8757, 0x8758, 0x8759,
@@ -5315,7 +7493,7 @@ unsigned short shiftjis_cp932[3][189] = {
0, 0, 0, 0, 0,
},
};
-unsigned short cp932inv[2][189] = {
+const unsigned short cp932inv[2][189] = {
{
0xFA5C, 0xFA5D, 0xFA5E, 0xFA5F, 0xFA60, 0xFA61, 0xFA62, 0xFA63,
0xFA64, 0xFA65, 0xFA66, 0xFA67, 0xFA68, 0xFA69, 0xFA6A, 0xFA6B,
@@ -5366,8 +7544,957 @@ unsigned short cp932inv[2][189] = {
0xFBFC, 0xFC40, 0xFC41, 0xFC42, 0xFC43, 0xFC44, 0xFC45, 0xFC46,
0xFC47, 0xFC48, 0xFC49, 0xFC4A, 0xFC4B, 0, 0, 0xFA40,
0xFA41, 0xFA42, 0xFA43, 0xFA44, 0xFA45, 0xFA46, 0xFA47, 0xFA48,
- 0xFA49, 0, 0xFA55, 0xFA56, 0xFA57,
+ 0xFA49, 0x81CA, 0xFA55, 0xFA56, 0xFA57,
},
};
-#endif /* SHIFTJIS_CP932_TRANS */
-;
+#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 */
diff --git a/ext/nkf/nkf-utf8/utf8tbl.h b/ext/nkf/nkf-utf8/utf8tbl.h
new file mode 100644
index 0000000000..1f40f0b363
--- /dev/null
+++ b/ext/nkf/nkf-utf8/utf8tbl.h
@@ -0,0 +1,34 @@
+#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 65442a130c..2bb0340a64 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -1,9 +1,9 @@
/*
- * NKF Module for Ruby base on nkf 2.x
+ * NKF - Ruby extension for Network Kanji Filter
*
- * original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/
+ * original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/
*
- * $Id$
+ * $Id$
*
*/
@@ -63,7 +63,7 @@ rb_nkf_putchar(c)
o_len += incsize;
rb_str_resize(result, o_len);
incsize *= 2;
- output = RSTRING(result)->ptr;
+ output = (unsigned char *)RSTRING(result)->ptr;
}
output[output_ctr++] = c;
@@ -78,6 +78,69 @@ 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;
@@ -89,19 +152,19 @@ rb_nkf_kconv(obj, opt, src)
StringValue(opt);
opt_ptr = RSTRING(opt)->ptr;
opt_end = opt_ptr + RSTRING(opt)->len;
- options(opt_ptr);
+ nkf_split_options(opt_ptr);
incsize = INCSIZE;
input_ctr = 0;
StringValue(src);
- input = RSTRING(src)->ptr;
+ input = (unsigned char *)RSTRING(src)->ptr;
i_len = RSTRING(src)->len;
result = rb_str_new(0, i_len*3 + 10);
v = result;
output_ctr = 0;
- output = RSTRING(result)->ptr;
+ output = (unsigned char *)RSTRING(result)->ptr;
o_len = RSTRING(result)->len;
*output = '\0';
@@ -118,11 +181,27 @@ rb_nkf_kconv(obj, opt, src)
/*
- * NKF.guess1
+ * 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.
*
- * Character code detection - Algorithm described in:
- * Ken Lunde. `Understanding Japanese Information Processing'
- * Sebastopol, CA: O'Reilly & Associates.
+ * 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
*/
static VALUE
@@ -134,7 +213,7 @@ rb_nkf_guess1(obj, src)
int sequence_counter = 0;
StringValue(src);
- p = RSTRING(src)->ptr;
+ p = (unsigned char *)RSTRING(src)->ptr;
pend = p + RSTRING(src)->len;
if (p == pend) return INT2FIX(_UNKNOWN);
@@ -214,9 +293,29 @@ rb_nkf_guess1(obj, src)
/*
- * NKF.guess2
+ * call-seq:
+ * NKF.guess2(str) -> integer
*
- * Guess Encoding By NKF2.0 Routine
+ * 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
*/
static VALUE
@@ -229,7 +328,7 @@ rb_nkf_guess2(obj, src)
input_ctr = 0;
StringValue(src);
- input = RSTRING(src)->ptr;
+ input = (unsigned char *)RSTRING(src)->ptr;
i_len = RSTRING(src)->len;
if(x0201_f == WISH_TRUE)
@@ -261,32 +360,295 @@ rb_nkf_guess2(obj, src)
}
-/* Initialize NKF Module */
+/*
+ * 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.
+ */
void
Init_nkf()
{
- 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));
+ /* 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));
}
diff --git a/ext/nkf/test.rb b/ext/nkf/test.rb
deleted file mode 100644
index b3406cbb6c..0000000000
--- a/ext/nkf/test.rb
+++ /dev/null
@@ -1,864 +0,0 @@
-#!/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 dfb8bfb8bb..3a9a9f341f 100644
--- a/ext/openssl/.cvsignore
+++ b/ext/openssl/.cvsignore
@@ -2,3 +2,4 @@ GNUmakefile
Makefile
mkmf.log
dep
+extconf.h
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 2ced7f62ce..02e06b7149 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -36,8 +36,6 @@ end
message "=== Checking for system dependent stuff... ===\n"
have_library("nsl", "t_open")
have_library("socket", "socket")
-have_header("unistd.h")
-have_header("sys/time.h")
have_header("assert.h")
message "=== Checking for required stuff... ===\n"
@@ -61,7 +59,10 @@ unless have_header("openssl/conf_api.h")
exit 1
end
+%w"rb_str_set_len rb_block_call".each {|func| have_func(func, "ruby.h")}
+
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")
@@ -82,13 +83,18 @@ have_func("HMAC_CTX_cleanup")
have_func("HMAC_CTX_copy")
have_func("HMAC_CTX_init")
have_func("PEM_def_callback")
+have_func("PKCS5_PBKDF2_HMAC")
+have_func("PKCS5_PBKDF2_HMAC_SHA1")
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("SSL_SESSION_get_id")
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")
@@ -114,5 +120,7 @@ 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
create_makefile("openssl")
message "Done.\n"
diff --git a/ext/openssl/lib/net/ftptls.rb b/ext/openssl/lib/net/ftptls.rb
index f433457923..a21c1f6c3c 100644
--- a/ext/openssl/lib/net/ftptls.rb
+++ b/ext/openssl/lib/net/ftptls.rb
@@ -29,13 +29,23 @@ require 'net/ftp'
module Net
class FTPTLS < FTP
+ def connect(host, port=FTP_PORT)
+ @hostname = host
+ super
+ end
+
def login(user = "anonymous", passwd = nil, acct = nil)
+ store = OpenSSL::X509::Store.new
+ store.set_default_paths
ctx = OpenSSL::SSL::SSLContext.new('SSLv23')
+ ctx.cert_store = store
+ ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
ctx.key = nil
ctx.cert = nil
voidcmd("AUTH TLS")
@sock = OpenSSL::SSL::SSLSocket.new(@sock, ctx)
@sock.connect
+ @sock.post_connection_check(@hostname)
super(user, passwd, acct)
voidcmd("PBSZ 0")
end
diff --git a/ext/openssl/lib/net/telnets.rb b/ext/openssl/lib/net/telnets.rb
index a872f41e6a..2b69280432 100644
--- a/ext/openssl/lib/net/telnets.rb
+++ b/ext/openssl/lib/net/telnets.rb
@@ -134,6 +134,9 @@ module Net
@sock.verify_callback = @options['VerifyCallback']
@sock.verify_depth = @options['VerifyDepth']
@sock.connect
+ if @options['VerifyMode'] != OpenSSL::SSL::VERIFY_NONE
+ @sock.post_connection_check(@options['Host'])
+ end
@ssl = true
end
''
diff --git a/ext/openssl/lib/openssl.rb b/ext/openssl/lib/openssl.rb
index 24a9eed136..f10985ed2c 100644
--- a/ext/openssl/lib/openssl.rb
+++ b/ext/openssl/lib/openssl.rb
@@ -19,6 +19,7 @@ require 'openssl.so'
require 'openssl/bn'
require 'openssl/cipher'
require 'openssl/digest'
+require 'openssl/pkcs7'
require 'openssl/ssl'
require 'openssl/x509'
diff --git a/ext/openssl/lib/openssl/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index 9f8776d6fc..290e9c1d2d 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -19,34 +19,47 @@
#require 'openssl'
module OpenSSL
- module Cipher
- %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
+ %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)
}
- class Cipher
- def random_key
- str = OpenSSL::Random.random_bytes(self.key_len)
- self.key = str
- return str
- end
-
- def random_iv
- str = OpenSSL::Random.random_bytes(self.iv_len)
- self.iv = str
- return str
- end
+ %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)
+ }
+
+ # Generate, set, and return a random key.
+ # You must call cipher.encrypt or cipher.decrypt before calling this method.
+ def random_key
+ str = OpenSSL::Random.random_bytes(self.key_len)
+ self.key = str
+ return str
+ end
+
+ # Generate, set, and return a random iv.
+ # You must call cipher.encrypt or cipher.decrypt before calling this method.
+ def random_iv
+ str = OpenSSL::Random.random_bytes(self.iv_len)
+ self.iv = str
+ return str
+ end
+
+ # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
+ class Cipher < Cipher
+ # add warning
end
end # Cipher
end # OpenSSL
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb
index 5745661c3c..4810f0121b 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -19,31 +19,43 @@
#require 'openssl'
module OpenSSL
- module Digest
+ class 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{|digest|
- self.module_eval(<<-EOD)
- class #{digest} < Digest
- def initialize(data=nil)
- super(\"#{digest}\", data)
- end
-
- def #{digest}::digest(data)
- Digest::digest(\"#{digest}\", data)
- end
+ def self.digest(name, data)
+ super(data, name)
+ end
- def #{digest}::hexdigest(data)
- Digest::hexdigest(\"#{digest}\", data)
+ 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)"
end
- end
- EOD
+ 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)
}
+ # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
+ class Digest < Digest
+ def initialize(*args)
+ # add warning
+ super(*args)
+ end
+ end
+
end # Digest
end # OpenSSL
diff --git a/ext/openssl/lib/openssl/pkcs7.rb b/ext/openssl/lib/openssl/pkcs7.rb
new file mode 100644
index 0000000000..1f88c1de5e
--- /dev/null
+++ b/ext/openssl/lib/openssl/pkcs7.rb
@@ -0,0 +1,25 @@
+=begin
+= $RCSfile$ -- PKCS7
+
+= Licence
+ This program is licenced under the same licence as Ruby.
+ (See the file 'LICENCE'.)
+
+= Version
+ $Id: digest.rb 12148 2007-04-05 05:59:22Z technorama $
+=end
+
+module OpenSSL
+ class PKCS7
+ # This class is only provided for backwards compatibility. Use OpenSSL::PKCS7 in the future.
+ class PKCS7 < PKCS7
+ def initialize(*args)
+ super(*args)
+
+ warn("Warning: OpenSSL::PKCS7::PKCS7 is deprecated after Ruby 1.9; use OpenSSL::PKCS7 instead")
+ end
+ end
+
+ end # PKCS7
+end # OpenSSL
+
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 9b287fc939..f722cb0c45 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -20,6 +20,33 @@ require "fcntl"
module OpenSSL
module SSL
+ class SSLContext
+ DEFAULT_PARAMS = {
+ :ssl_version => "SSLv23",
+ :verify_mode => OpenSSL::SSL::VERIFY_PEER,
+ :ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
+ :options => OpenSSL::SSL::OP_ALL,
+ }
+
+ DEFAULT_CERT_STORE = OpenSSL::X509::Store.new
+ DEFAULT_CERT_STORE.set_default_paths
+ if defined?(OpenSSL::X509::V_FLAG_CRL_CHECK_ALL)
+ DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
+ end
+
+ def set_params(params={})
+ params = DEFAULT_PARAMS.merge(params)
+ self.ssl_version = params.delete(:ssl_version)
+ params.each{|name, value| self.__send__("#{name}=", value) }
+ if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
+ unless self.ca_file or self.ca_path or self.cert_store
+ self.cert_store = DEFAULT_CERT_STORE
+ end
+ end
+ return params
+ end
+ end
+
module SocketForwarder
def addr
to_io.addr
@@ -29,12 +56,12 @@ module OpenSSL
to_io.peeraddr
end
- def getsockopt(level, optname, optval)
+ def setsockopt(level, optname, optval)
to_io.setsockopt(level, optname, optval)
end
- def setsockopt(level, optname)
- to_io.setsockopt(level, optname)
+ def getsockopt(level, optname)
+ to_io.getsockopt(level, optname)
end
def fcntl(*args)
@@ -59,35 +86,49 @@ module OpenSSL
end
end
+ def verify_certificate_identity(cert, hostname)
+ should_verify_common_name = true
+ cert.extensions.each{|ext|
+ next if ext.oid != "subjectAltName"
+ ext.value.split(/,\s+/).each{|general_name|
+ if /\ADNS:(.*)/ =~ general_name
+ should_verify_common_name = false
+ reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
+ elsif /\AIP Address:(.*)/ =~ general_name
+ should_verify_common_name = false
+ return true if $1 == hostname
+ end
+ }
+ }
+ if should_verify_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
+ return false
+ end
+ module_function :verify_certificate_identity
+
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" && value.casecmp(hostname) == 0
- return true
- end
- }
+ unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname)
+ raise SSLError, "hostname was not match with the server certificate"
end
- raise SSLError, "hostname not match"
+ return true
+ end
+
+ def session
+ SSL::Session.new(self)
+ rescue SSL::Session::SessionError
+ nil
end
end
@@ -113,6 +154,10 @@ module OpenSSL
@svr.listen(backlog)
end
+ def shutdown(how=Socket::SHUT_RDWR)
+ @svr.shutdown(how)
+ end
+
def accept
sock = @svr.accept
begin
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c
index 3b8083c257..724f36b8ae 100644
--- a/ext/openssl/openssl_missing.c
+++ b/ext/openssl/openssl_missing.c
@@ -8,6 +8,8 @@
* 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
@@ -17,18 +19,18 @@
#include <string.h> /* memcpy() */
#include <openssl/hmac.h>
+#include "openssl_missing.h"
+
#if !defined(HAVE_HMAC_CTX_COPY)
-int
+void
HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
{
- if (!out || !in) return 0;
+ if (!out || !in) return;
memcpy(out, in, sizeof(HMAC_CTX));
- if (!EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx)
- || !EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx)
- || !EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx))
- return 0;
- return 1;
+ EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx);
+ EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx);
+ EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx);
}
#endif /* HAVE_HMAC_CTX_COPY */
#endif /* NO_HMAC */
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index e8c75ca42c..5a71f73c64 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -15,6 +15,10 @@
extern "C" {
#endif
+#ifndef TYPEDEF_D2I_OF
+typedef char *d2i_of_void();
+#endif
+
/*
* These functions are not included in headers of OPENSSL <= 0.9.6b
*/
@@ -56,14 +60,33 @@ extern "C" {
(char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri)
#endif
+#if !defined(HAVE_EVP_MD_CTX_INIT)
void HMAC_CTX_init(HMAC_CTX *ctx);
-int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
+#endif
+
+#if !defined(HAVE_HMAC_CTX_COPY)
+void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
+#endif
+
+#if !defined(HAVE_HMAC_CTX_CLEANUP)
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
+#endif
+#if !defined(HAVE_EVP_MD_CTX_CREATE)
EVP_MD_CTX *EVP_MD_CTX_create(void);
+#endif
+
+#if !defined(HAVE_EVP_MD_CTX_INIT)
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
+#endif
+
+#if !defined(HAVE_EVP_MD_CTX_CLEANUP)
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
+#endif
+
+#if !defined(HAVE_EVP_MD_CTX_DESTROY)
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
+#endif
#if !defined(HAVE_EVP_CIPHER_CTX_COPY)
int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
@@ -107,19 +130,54 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
#define OPENSSL_cleanse(p, l) memset(p, 0, l)
#endif
+#if !defined(HAVE_X509_STORE_SET_EX_DATA)
void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
+#endif
+
+#if !defined(HAVE_X509_CRL_SET_VERSION)
int X509_CRL_set_version(X509_CRL *x, long version);
+#endif
+
+#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
+#endif
+
+#if !defined(HAVE_X509_CRL_SORT)
int X509_CRL_sort(X509_CRL *c);
+#endif
+
+#if !defined(HAVE_X509_CRL_ADD0_REVOKED)
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
+#endif
+
+#if !defined(HAVE_BN_MOD_SQR)
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+#endif
+
+#if !defined(HAVE_BN_MOD_ADD)
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+#endif
+
+#if !defined(HAVE_BN_MOD_SUB)
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+#endif
+
+#if !defined(HAVE_BN_RAND_RANGE)
int BN_rand_range(BIGNUM *r, BIGNUM *range);
+#endif
+
+#if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
+#endif
+
+#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
char *CONF_get1_default_config_file(void);
+#endif
+
+#if !defined(HAVE_PEM_DEF_CALLBACK)
int PEM_def_callback(char *buf, int num, int w, void *key);
+#endif
#if defined(__cplusplus)
}
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 2ad2ee38d0..53f476fd65 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -59,7 +59,7 @@ ossl_x509_ary2sk0(VALUE ary)
sk = sk_X509_new_null();
if (!sk) ossl_raise(eOSSLError, NULL);
- for (i = 0; i < RARRAY(ary)->len; i++) {
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
val = rb_ary_entry(ary, i);
if (!rb_obj_is_kind_of(val, cX509Cert)) {
sk_X509_pop_free(sk, X509_free);
@@ -131,7 +131,7 @@ ossl_buf2str(char *buf, int len)
int status = 0;
str = rb_protect((VALUE(*)_((VALUE)))ossl_str_new, len, &status);
- if(!NIL_P(str)) memcpy(RSTRING(str)->ptr, buf, len);
+ if(!NIL_P(str)) memcpy(RSTRING_PTR(str), buf, len);
OPENSSL_free(buf);
if(status) rb_jump_tag(status);
@@ -170,7 +170,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
rflag = flag ? Qtrue : Qfalse;
pass = rb_protect(ossl_pem_passwd_cb0, rflag, &status);
if (status) return -1; /* exception was raised. */
- len = RSTRING(pass)->len;
+ len = RSTRING_LEN(pass);
if (len < 4) { /* 4 is OpenSSL hardcoded limit */
rb_warning("password must be longer than 4 bytes");
continue;
@@ -179,7 +179,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
rb_warning("password must be shorter then %d bytes", max_len-1);
continue;
}
- memcpy(buf, RSTRING(pass)->ptr, len);
+ memcpy(buf, RSTRING_PTR(pass), len);
break;
}
return len;
@@ -278,9 +278,14 @@ ossl_raise(VALUE exc, const char *fmt, ...)
va_list args;
char buf[BUFSIZ];
const char *msg;
- long e = ERR_peek_last_error();
+ long e;
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);
@@ -305,6 +310,14 @@ ossl_raise(VALUE exc, const char *fmt, ...)
rb_exc_raise(rb_exc_new(exc, buf, len));
}
+/*
+ * call-seq:
+ * OpenSSL.errors -> [String...]
+ *
+ * See any remaining errors held in queue.
+ *
+ * Any errors you see here are probably due to a bug in ruby's OpenSSL implementation.
+ */
VALUE
ossl_get_errors()
{
@@ -340,12 +353,23 @@ ossl_debug(const char *fmt, ...)
}
#endif
+/*
+ * call-seq:
+ * OpenSSL.debug -> true | false
+ */
static VALUE
ossl_debug_get(VALUE self)
{
return dOSSL;
}
+/*
+ * call-seq:
+ * OpenSSL.debug = boolean -> boolean
+ *
+ * Turns on or off CRYPTO_MEM_CHECK.
+ * Also shows some debugging message on stderr.
+ */
static VALUE
ossl_debug_set(VALUE self, VALUE val)
{
@@ -382,6 +406,7 @@ 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();
@@ -421,8 +446,8 @@ Init_openssl()
/*
* Verify callback Proc index for ext-data
*/
- ossl_verify_cb_idx =
- X509_STORE_CTX_get_ex_new_index(0, "ossl_verify_cb_idx", 0, 0, 0);
+ if ((ossl_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, "ossl_verify_cb_idx", 0, 0, 0)) < 0)
+ ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index");
/*
* Init debug core
@@ -448,6 +473,7 @@ Init_openssl()
Init_ossl_ns_spki();
Init_ossl_pkcs12();
Init_ossl_pkcs7();
+ Init_ossl_pkcs5();
Init_ossl_pkey();
Init_ossl_rand();
Init_ossl_ssl();
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index f678ac1188..3cc30ae2e8 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -11,10 +11,26 @@
#if !defined(_OSSL_H_)
#define _OSSL_H_
+#include RUBY_EXTCONF_H
+
#if defined(__cplusplus)
extern "C" {
#endif
+#if 0
+ mOSSL = rb_define_module("OpenSSL");
+ mX509 = rb_define_module_under(mOSSL, "X509");
+#endif
+
+/*
+* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
+*/
+#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
+# undef RFILE
+#endif
+#include <ruby.h>
+#include <rubyio.h>
+
/*
* Check the OpenSSL version
* The only supported are:
@@ -29,8 +45,12 @@ extern "C" {
#endif
#if defined(_WIN32)
-# define OpenFile WINAPI_OpenFile
# define OSSL_NO_CONF_API 1
+# ifdef USE_WINSOCK2
+# include <winsock2.h>
+# else
+# include <winsock.h>
+# endif
#endif
#include <errno.h>
#include <openssl/err.h>
@@ -53,18 +73,6 @@ extern "C" {
# define OSSL_OCSP_ENABLED
# include <openssl/ocsp.h>
#endif
-#if defined(_WIN32)
-# undef OpenFile
-#endif
-
-/*
- * OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
- */
-#if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/
-# undef RFILE
-#endif
-#include <ruby.h>
-#include <rubyio.h>
/*
* Common Module
@@ -115,11 +123,10 @@ VALUE ossl_x509crl_sk2ary(STACK_OF(X509_CRL) *crl);
VALUE ossl_buf2str(char *buf, int len);
#define ossl_str_adjust(str, p) \
do{\
- int len = RSTRING(str)->len;\
- int newlen = (p) - (unsigned char*)RSTRING(str)->ptr;\
+ int len = RSTRING_LEN(str);\
+ int newlen = (p) - (unsigned char*)RSTRING_PTR(str);\
assert(newlen <= len);\
- RSTRING(str)->len = newlen;\
- RSTRING(str)->ptr[newlen] = 0;\
+ rb_str_set_len(str, newlen);\
}while(0)
/*
@@ -164,7 +171,7 @@ extern VALUE dOSSL;
if (dOSSL == Qtrue) { \
fprintf(stderr, "OSSL_DEBUG: "); \
fprintf(stderr, fmt, ##__VA_ARGS__); \
- fprintf(stderr, " [in %s (%s:%d)]\n", __func__, __FILE__, __LINE__); \
+ fprintf(stderr, " [%s:%d]\n", __FILE__, __LINE__); \
} \
} while (0)
@@ -200,6 +207,7 @@ void ossl_debug(const char *, ...);
#include "ossl_ocsp.h"
#include "ossl_pkcs12.h"
#include "ossl_pkcs7.h"
+#include "ossl_pkcs5.h"
#include "ossl_pkey.h"
#include "ossl_rand.h"
#include "ossl_ssl.h"
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 8d6bd014ca..8ceea95021 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -214,7 +214,7 @@ obj_to_asn1bstr(VALUE obj, long unused_bits)
StringValue(obj);
if(!(bstr = ASN1_BIT_STRING_new()))
ossl_raise(eASN1Error, NULL);
- ASN1_BIT_STRING_set(bstr, RSTRING(obj)->ptr, RSTRING(obj)->len);
+ ASN1_BIT_STRING_set(bstr, RSTRING_PTR(obj), RSTRING_LEN(obj));
bstr->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */
bstr->flags |= ASN1_STRING_FLAG_BITS_LEFT|(unused_bits&0x07);
@@ -229,7 +229,7 @@ obj_to_asn1str(VALUE obj)
StringValue(obj);
if(!(str = ASN1_STRING_new()))
ossl_raise(eASN1Error, NULL);
- ASN1_STRING_set(str, RSTRING(obj)->ptr, RSTRING(obj)->len);
+ ASN1_STRING_set(str, RSTRING_PTR(obj), RSTRING_LEN(obj));
return str;
}
@@ -253,8 +253,8 @@ obj_to_asn1obj(VALUE obj)
ASN1_OBJECT *a1obj;
StringValue(obj);
- a1obj = OBJ_txt2obj(RSTRING(obj)->ptr, 0);
- if(!a1obj) a1obj = OBJ_txt2obj(RSTRING(obj)->ptr, 1);
+ a1obj = OBJ_txt2obj(RSTRING_PTR(obj), 0);
+ if(!a1obj) a1obj = OBJ_txt2obj(RSTRING_PTR(obj), 1);
if(!a1obj) ossl_raise(eASN1Error, "invalid OBJECT ID");
return a1obj;
@@ -295,7 +295,7 @@ obj_to_asn1derstr(VALUE obj)
str = ossl_to_der(obj);
if(!(a1str = ASN1_STRING_new()))
ossl_raise(eASN1Error, NULL);
- ASN1_STRING_set(a1str, RSTRING(str)->ptr, RSTRING(str)->len);
+ ASN1_STRING_set(a1str, RSTRING_PTR(str), RSTRING_LEN(str));
return a1str;
}
@@ -445,7 +445,7 @@ decode_time(unsigned char* der, int length)
/********/
typedef struct {
- char *name;
+ const char *name;
VALUE *klass;
} ossl_asn1_info_t;
@@ -678,7 +678,7 @@ static VALUE
join_der(VALUE enumerable)
{
VALUE str = rb_str_new(0, 0);
- rb_iterate(rb_each, enumerable, join_der_i, str);
+ rb_block_call(enumerable, rb_intern("each"), 0, 0, join_der_i, str);
return str;
}
@@ -699,13 +699,13 @@ ossl_asn1data_to_der(VALUE self)
tag = ossl_asn1_tag(self);
tag_class = ossl_asn1_tag_class(self);
- if((length = ASN1_object_size(1, RSTRING(value)->len, tag)) <= 0)
+ if((length = ASN1_object_size(1, RSTRING_LEN(value), tag)) <= 0)
ossl_raise(eASN1Error, NULL);
der = rb_str_new(0, length);
- p = RSTRING(der)->ptr;
- ASN1_put_object(&p, is_cons, RSTRING(value)->len, tag, tag_class);
- memcpy(p, RSTRING(value)->ptr, RSTRING(value)->len);
- p += RSTRING(value)->len;
+ p = RSTRING_PTR(der);
+ ASN1_put_object(&p, is_cons, RSTRING_LEN(value), tag, tag_class);
+ memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value));
+ p += RSTRING_LEN(value);
ossl_str_adjust(der, p);
return der;
@@ -766,7 +766,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;
+ long flag = 0;
if(!rb_obj_is_kind_of(value, rb_cArray)){
switch(tag){
case V_ASN1_BOOLEAN:
@@ -824,8 +824,8 @@ ossl_asn1_traverse(VALUE self, VALUE obj)
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
- p = RSTRING(tmp)->ptr;
- ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 0, 1);
+ p = RSTRING_PTR(tmp);
+ ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 1);
return Qnil;
}
@@ -840,8 +840,8 @@ ossl_asn1_decode(VALUE self, VALUE obj)
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
- p = RSTRING(tmp)->ptr;
- ary = ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 1, 0);
+ p = RSTRING_PTR(tmp);
+ ary = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 1, 0);
ret = rb_ary_entry(ary, 0);
return ret;
@@ -857,8 +857,8 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
- p = RSTRING(tmp)->ptr;
- ret = ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 0, 0);
+ p = RSTRING_PTR(tmp);
+ ret = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 0);
return ret;
}
@@ -973,21 +973,21 @@ ossl_asn1cons_to_der(VALUE self)
explicit = ossl_asn1_is_explicit(self);
value = join_der(ossl_asn1_get_value(self));
- seq_len = ASN1_object_size(1, RSTRING(value)->len, tag);
+ seq_len = ASN1_object_size(1, RSTRING_LEN(value), tag);
length = ASN1_object_size(1, seq_len, tn);
str = rb_str_new(0, length);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(tc == V_ASN1_UNIVERSAL)
- ASN1_put_object(&p, 1, RSTRING(value)->len, tn, tc);
+ ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc);
else{
if(explicit){
ASN1_put_object(&p, 1, seq_len, tn, tc);
- ASN1_put_object(&p, 1, RSTRING(value)->len, tag, V_ASN1_UNIVERSAL);
+ ASN1_put_object(&p, 1, RSTRING_LEN(value), tag, V_ASN1_UNIVERSAL);
}
- else ASN1_put_object(&p, 1, RSTRING(value)->len, tn, tc);
+ else ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc);
}
- memcpy(p, RSTRING(value)->ptr, RSTRING(value)->len);
- p += RSTRING(value)->len;
+ memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value));
+ p += RSTRING_LEN(value);
ossl_str_adjust(str, p);
return str;
@@ -1007,7 +1007,7 @@ ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
StringValue(sn);
StringValue(ln);
- if(!OBJ_create(RSTRING(oid)->ptr, RSTRING(sn)->ptr, RSTRING(ln)->ptr))
+ if(!OBJ_create(RSTRING_PTR(oid), RSTRING_PTR(sn), RSTRING_PTR(ln)))
ossl_raise(eASN1Error, NULL);
return Qtrue;
@@ -1087,6 +1087,10 @@ Init_ossl_asn1()
VALUE ary;
int i;
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
sUNIVERSAL = rb_intern("UNIVERSAL");
sCONTEXT_SPECIFIC = rb_intern("CONTEXT_SPECIFIC");
sAPPLICATION = rb_intern("APPLICATION");
@@ -1108,9 +1112,9 @@ Init_ossl_asn1()
}
cASN1Data = rb_define_class_under(mASN1, "ASN1Data", rb_cObject);
- rb_attr(cASN1Data, rb_intern("value"), 1, 1, Qtrue);
- rb_attr(cASN1Data, rb_intern("tag"), 1, 1, Qtrue);
- rb_attr(cASN1Data, rb_intern("tag_class"), 1, 1, Qtrue);
+ rb_attr(cASN1Data, rb_intern("value"), 1, 1, 0);
+ rb_attr(cASN1Data, rb_intern("tag"), 1, 1, 0);
+ rb_attr(cASN1Data, rb_intern("tag_class"), 1, 1, 0);
rb_define_method(cASN1Data, "initialize", ossl_asn1data_initialize, 3);
rb_define_method(cASN1Data, "to_der", ossl_asn1data_to_der, 0);
@@ -1162,5 +1166,5 @@ do{\
rb_define_method(cASN1ObjectId, "oid", ossl_asn1obj_get_oid, 0);
rb_define_alias(cASN1ObjectId, "short_name", "sn");
rb_define_alias(cASN1ObjectId, "long_name", "ln");
- rb_attr(cASN1BitString, rb_intern("unused_bits"), 1, 1, Qtrue);
+ rb_attr(cASN1BitString, rb_intern("unused_bits"), 1, 1, 0);
}
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index 9c9aa24197..6db1fb9a62 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -19,16 +19,29 @@ ossl_obj2bio(VALUE obj)
BIO *bio;
if (TYPE(obj) == T_FILE) {
- OpenFile *fptr;
+ rb_io_t *fptr;
+ FILE *fp;
+ int fd;
+
GetOpenFile(obj, fptr);
rb_io_check_readable(fptr);
- bio = BIO_new_fp(fptr->f, BIO_NOCLOSE);
- }
+ if ((fd = dup(FPTR_TO_FD(fptr))) < 0){
+ rb_sys_fail(0);
+ }
+ if (!(fp = fdopen(fd, "r"))){
+ close(fd);
+ rb_sys_fail(0);
+ }
+ if (!(bio = BIO_new_fp(fp, BIO_CLOSE))){
+ fclose(fp);
+ ossl_raise(eOSSLError, NULL);
+ }
+ }
else {
StringValue(obj);
- bio = BIO_new_mem_buf(RSTRING(obj)->ptr, RSTRING(obj)->len);
+ bio = BIO_new_mem_buf(RSTRING_PTR(obj), RSTRING_LEN(obj));
+ if (!bio) ossl_raise(eOSSLError, NULL);
}
- if (!bio) ossl_raise(eOSSLError, NULL);
return bio;
}
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 47a607e60f..6856476261 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -40,7 +40,7 @@ VALUE eBNError;
* Public
*/
VALUE
-ossl_bn_new(BIGNUM *bn)
+ossl_bn_new(const BIGNUM *bn)
{
BIGNUM *newbn;
VALUE obj;
@@ -100,6 +100,13 @@ ossl_bn_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * BN.new => aBN
+ * BN.new(bn) => aBN
+ * BN.new(string) => aBN
+ * BN.new(string, 0 | 2 | 10 | 16) => aBN
+ */
static VALUE
ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -124,22 +131,22 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
switch (base) {
case 0:
- if (!BN_mpi2bn(RSTRING(str)->ptr, RSTRING(str)->len, bn)) {
+ if (!BN_mpi2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) {
ossl_raise(eBNError, NULL);
}
break;
case 2:
- if (!BN_bin2bn(RSTRING(str)->ptr, RSTRING(str)->len, bn)) {
+ if (!BN_bin2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) {
ossl_raise(eBNError, NULL);
}
break;
case 10:
- if (!BN_dec2bn(&bn, RSTRING(str)->ptr)) {
+ if (!BN_dec2bn(&bn, RSTRING_PTR(str))) {
ossl_raise(eBNError, NULL);
}
break;
case 16:
- if (!BN_hex2bn(&bn, RSTRING(str)->ptr)) {
+ if (!BN_hex2bn(&bn, RSTRING_PTR(str))) {
ossl_raise(eBNError, NULL);
}
break;
@@ -149,6 +156,19 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * bn.to_s => string
+ * bn.to_s(base) => string
+ *
+ * === Parameters
+ * * +base+ - integer
+ * * * Valid values:
+ * * * * 0 - MPI
+ * * * * 2 - binary
+ * * * * 10 - the default
+ * * * * 16 - hex
+ */
static VALUE
ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
{
@@ -165,13 +185,13 @@ ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
case 0:
len = BN_bn2mpi(bn, NULL);
str = rb_str_new(0, len);
- if (BN_bn2mpi(bn, RSTRING(str)->ptr) != len)
+ if (BN_bn2mpi(bn, RSTRING_PTR(str)) != len)
ossl_raise(eBNError, NULL);
break;
case 2:
len = BN_num_bytes(bn);
str = rb_str_new(0, len);
- if (BN_bn2bin(bn, RSTRING(str)->ptr) != len)
+ if (BN_bn2bin(bn, RSTRING_PTR(str)) != len)
ossl_raise(eBNError, NULL);
break;
case 10:
@@ -189,6 +209,10 @@ ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
return str;
}
+/*
+ * call-seq:
+ * bn.to_i => integer
+ */
static VALUE
ossl_bn_to_i(VALUE self)
{
@@ -233,6 +257,11 @@ ossl_bn_coerce(VALUE self, VALUE other)
}
#define BIGNUM_BOOL1(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> true | false \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -248,6 +277,11 @@ BIGNUM_BOOL1(is_one);
BIGNUM_BOOL1(is_odd);
#define BIGNUM_1c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -267,6 +301,11 @@ BIGNUM_BOOL1(is_odd);
BIGNUM_1c(sqr);
#define BIGNUM_2(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -287,6 +326,11 @@ BIGNUM_2(add);
BIGNUM_2(sub);
#define BIGNUM_2c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -310,6 +354,10 @@ BIGNUM_2c(gcd);
BIGNUM_2c(mod_sqr);
BIGNUM_2c(mod_inverse);
+/*
+ * call-seq:
+ * bn1 / bn2 => [result, remainder]
+ */
static VALUE
ossl_bn_div(VALUE self, VALUE other)
{
@@ -337,6 +385,11 @@ ossl_bn_div(VALUE self, VALUE other)
}
#define BIGNUM_3c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn1, bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other1, VALUE other2) \
{ \
@@ -360,6 +413,11 @@ BIGNUM_3c(mod_mul);
BIGNUM_3c(mod_exp);
#define BIGNUM_BIT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bit) -> self \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE bit) \
{ \
@@ -374,6 +432,10 @@ BIGNUM_BIT(set_bit);
BIGNUM_BIT(clear_bit);
BIGNUM_BIT(mask_bits);
+/*
+ * call-seq:
+ * bn.bit_set?(bit) => true | false
+ */
static VALUE
ossl_bn_is_bit_set(VALUE self, VALUE bit)
{
@@ -389,6 +451,11 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
}
#define BIGNUM_SHIFT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bits) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE bits) \
{ \
@@ -410,7 +477,32 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
BIGNUM_SHIFT(lshift);
BIGNUM_SHIFT(rshift);
+#define BIGNUM_SELF_SHIFT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func!(bits) -> self \
+ * \
+ */ \
+ static VALUE \
+ ossl_bn_self_##func(VALUE self, VALUE bits) \
+ { \
+ BIGNUM *bn; \
+ int b; \
+ b = NUM2INT(bits); \
+ GetBN(self, bn); \
+ if (!BN_##func(bn, bn, b)) \
+ ossl_raise(eBNError, NULL); \
+ return self; \
+ }
+BIGNUM_SELF_SHIFT(lshift);
+BIGNUM_SELF_SHIFT(rshift);
+
#define BIGNUM_RAND(func) \
+ /* \
+ * call-seq: \
+ * BN.##func(bits [, fill [, odd]]) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_s_##func(int argc, VALUE *argv, VALUE klass) \
{ \
@@ -423,7 +515,7 @@ BIGNUM_SHIFT(rshift);
bottom = (odd == Qtrue) ? 1 : 0; \
/* FALLTHROUGH */ \
case 2: \
- top = FIX2INT(fill); \
+ top = NUM2INT(fill); \
} \
b = NUM2INT(bits); \
if (!(result = BN_new())) { \
@@ -440,6 +532,11 @@ BIGNUM_RAND(rand);
BIGNUM_RAND(pseudo_rand);
#define BIGNUM_RAND_RANGE(func) \
+ /* \
+ * call-seq: \
+ * BN.##func(range) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_s_##func##_range(VALUE klass, VALUE range) \
{ \
@@ -458,6 +555,16 @@ BIGNUM_RAND(pseudo_rand);
BIGNUM_RAND_RANGE(rand);
BIGNUM_RAND_RANGE(pseudo_rand);
+/*
+ * call-seq:
+ * BN.generate_prime(bits, [, safe [, add [, rem]]]) => bn
+ *
+ * === Parameters
+ * * +bits+ - integer
+ * * +safe+ - boolean
+ * * +add+ - BN
+ * * +rem+ - BN
+ */
static VALUE
ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
{
@@ -473,12 +580,8 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
safe = 0;
}
if (!NIL_P(vadd)) {
- if (NIL_P(vrem)) {
- ossl_raise(rb_eArgError,
- "if ADD is specified, REM must be also given");
- }
add = GetBNPtr(vadd);
- rem = GetBNPtr(vrem);
+ rem = NIL_P(vrem) ? NULL : GetBNPtr(vrem);
}
if (!(result = BN_new())) {
ossl_raise(eBNError, NULL);
@@ -489,10 +592,15 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
}
WrapBN(klass, obj, result);
- return obj;
+ return obj;
}
#define BIGNUM_NUM(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> integer \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -522,6 +630,11 @@ ossl_bn_copy(VALUE self, VALUE other)
}
#define BIGNUM_CMP(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> integer \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -541,6 +654,14 @@ ossl_bn_eql(VALUE self, VALUE other)
return Qfalse;
}
+/*
+ * call-seq:
+ * bn.prime? => true | false
+ * bn.prime?(checks) => true | false
+ *
+ * === Parameters
+ * * +checks+ - integer
+ */
static VALUE
ossl_bn_is_prime(int argc, VALUE *argv, VALUE self)
{
@@ -564,6 +685,16 @@ ossl_bn_is_prime(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+/*
+ * call-seq:
+ * bn.prime_fasttest? => true | false
+ * bn.prime_fasttest?(checks) => true | false
+ * bn.prime_fasttest?(checks, trial_div) => true | false
+ *
+ * === Parameters
+ * * +checks+ - integer
+ * * +trial_div+ - boolean
+ */
static VALUE
ossl_bn_is_prime_fasttest(int argc, VALUE *argv, VALUE self)
{
@@ -600,6 +731,10 @@ ossl_bn_is_prime_fasttest(int argc, VALUE *argv, VALUE self)
void
Init_ossl_bn()
{
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
if (!(ossl_bn_ctx = BN_CTX_new())) {
ossl_raise(rb_eRuntimeError, "Cannot init BN_CTX");
}
@@ -672,8 +807,10 @@ Init_ossl_bn()
rb_define_method(cBN, "bit_set?", ossl_bn_is_bit_set, 1);
rb_define_method(cBN, "mask_bits!", ossl_bn_mask_bits, 1);
rb_define_method(cBN, "<<", ossl_bn_lshift, 1);
- /* lshift1 - DON'T IMPL. */
rb_define_method(cBN, ">>", ossl_bn_rshift, 1);
+ rb_define_method(cBN, "lshift!", ossl_bn_self_lshift, 1);
+ rb_define_method(cBN, "rshift!", ossl_bn_self_rshift, 1);
+ /* lshift1 - DON'T IMPL. */
/* rshift1 - DON'T IMPL. */
/*
diff --git a/ext/openssl/ossl_bn.h b/ext/openssl/ossl_bn.h
index 12aa484873..d6c396227b 100644
--- a/ext/openssl/ossl_bn.h
+++ b/ext/openssl/ossl_bn.h
@@ -14,9 +14,12 @@
extern VALUE cBN;
extern VALUE eBNError;
-VALUE ossl_bn_new(BIGNUM *);
+extern BN_CTX *ossl_bn_ctx;
+
+VALUE ossl_bn_new(const BIGNUM *);
BIGNUM *GetBNPtr(VALUE);
void Init_ossl_bn(void);
+
#endif /* _OSS_BN_H_ */
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index cb5fee6aee..b680dc6e64 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -26,7 +26,6 @@
/*
* Classes
*/
-VALUE mCipher;
VALUE cCipher;
VALUE eCipherError;
@@ -84,6 +83,14 @@ ossl_cipher_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * Cipher.new(string) -> cipher
+ *
+ * The string must contain a valid cipher name like "AES-128-CBC" or "3DES".
+ *
+ * A list of cipher names is available by calling OpenSSL::Cipher.ciphers.
+ */
static VALUE
ossl_cipher_initialize(VALUE self, VALUE str)
{
@@ -117,6 +124,42 @@ 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;
+}
+
+/*
+ * call-seq:
+ * Cipher.ciphers -> array[string...]
+ *
+ * Returns the names of all available ciphers in an array.
+ */
+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
+}
+
+/*
+ * call-seq:
+ * cipher.reset -> self
+ *
+ * Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).
+ */
static VALUE
ossl_cipher_reset(VALUE self)
{
@@ -143,22 +186,23 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
* We deprecated the arguments for this method, but we decided
* keeping this behaviour for backward compatibility.
*/
+ char *cname = rb_class2name(rb_obj_class(self));
+ rb_warn("argumtents for %s#encrypt and %s#decrypt were deprecated; "
+ "use %s#pkcs5_keyivgen to derive key and IV",
+ cname, cname, cname);
StringValue(pass);
GetCipher(self, ctx);
if (NIL_P(init_v)) memcpy(iv, "OpenSSL for Ruby rulez!", sizeof(iv));
else{
- char *cname = rb_class2name(rb_obj_class(self));
- rb_warning("key derivation by %s#encrypt is deprecated; "
- "use %s::pkcs5_keyivgen instead", cname, cname);
StringValue(init_v);
- if (EVP_MAX_IV_LENGTH > RSTRING(init_v)->len) {
+ if (EVP_MAX_IV_LENGTH > RSTRING_LEN(init_v)) {
memset(iv, 0, EVP_MAX_IV_LENGTH);
- memcpy(iv, RSTRING(init_v)->ptr, RSTRING(init_v)->len);
+ memcpy(iv, RSTRING_PTR(init_v), RSTRING_LEN(init_v));
}
- else memcpy(iv, RSTRING(init_v)->ptr, sizeof(iv));
+ else memcpy(iv, RSTRING_PTR(init_v), sizeof(iv));
}
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), EVP_md5(), iv,
- RSTRING(pass)->ptr, RSTRING(pass)->len, 1, key, NULL);
+ RSTRING_PTR(pass), RSTRING_LEN(pass), 1, key, NULL);
p_key = key;
p_iv = iv;
}
@@ -172,18 +216,54 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
return self;
}
+/*
+ * call-seq:
+ * cipher.encrypt -> self
+ *
+ * Make sure to call .encrypt or .decrypt before using any of the following methods:
+ * * [key=, iv=, random_key, random_iv, pkcs5_keyivgen]
+ *
+ * Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).
+ */
static VALUE
ossl_cipher_encrypt(int argc, VALUE *argv, VALUE self)
{
return ossl_cipher_init(argc, argv, self, 1);
}
+/*
+ * call-seq:
+ * cipher.decrypt -> self
+ *
+ * Make sure to call .encrypt or .decrypt before using any of the following methods:
+ * * [key=, iv=, random_key, random_iv, pkcs5_keyivgen]
+ *
+ * Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).
+ */
static VALUE
ossl_cipher_decrypt(int argc, VALUE *argv, VALUE self)
{
return ossl_cipher_init(argc, argv, self, 0);
}
+/*
+ * call-seq:
+ * cipher.pkcs5_keyivgen(pass [, salt [, iterations [, digest]]] ) -> nil
+ *
+ * Generates and sets the key/iv based on a password.
+ *
+ * WARNING: This method is only PKCS5 v1.5 compliant when using RC2, RC4-40, or DES
+ * with MD5 or SHA1. Using anything else (like AES) will generate the key/iv using an
+ * OpenSSL specific method. Use a PKCS5 v2 key generation method instead.
+ *
+ * === Parameters
+ * +salt+ must be an 8 byte string if provided.
+ * +iterations+ is a integer with a default of 2048.
+ * +digest+ is a Digest object that defaults to 'MD5'
+ *
+ * A minimum of 1000 iterations is recommended.
+ *
+ */
static VALUE
ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
{
@@ -197,15 +277,15 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
StringValue(vpass);
if(!NIL_P(vsalt)){
StringValue(vsalt);
- if(RSTRING(vsalt)->len != PKCS5_SALT_LEN)
+ if(RSTRING_LEN(vsalt) != PKCS5_SALT_LEN)
rb_raise(eCipherError, "salt must be an 8-octet string");
- salt = RSTRING(vsalt)->ptr;
+ salt = RSTRING_PTR(vsalt);
}
iter = NIL_P(viter) ? 2048 : NUM2INT(viter);
digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest);
GetCipher(self, ctx);
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt,
- RSTRING(vpass)->ptr, RSTRING(vpass)->len, iter, key, iv);
+ RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv);
if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, -1) != 1)
ossl_raise(eCipherError, NULL);
OPENSSL_cleanse(key, sizeof key);
@@ -214,38 +294,75 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+
+/*
+ * call-seq:
+ * cipher << data -> string
+ *
+ * === Parameters
+ * +data+ is a nonempty string.
+ *
+ * This method is deprecated and not available in 1.9.x or later.
+ */
+static VALUE
+ossl_cipher_update_deprecated(VALUE self, VALUE data)
+{
+ char *cname;
+
+ cname = rb_class2name(rb_obj_class(self));
+ rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname);
+ return rb_funcall(self, rb_intern("update"), 1, data);
+}
+
+
+/*
+ * call-seq:
+ * cipher.update(data [, buffer]) -> string or buffer
+ *
+ * === Parameters
+ * +data+ is a nonempty string.
+ * +buffer+ is an optional string to store the result.
+ */
static VALUE
-ossl_cipher_update(VALUE self, VALUE data)
+ossl_cipher_update(int argc, VALUE *argv, VALUE self)
{
EVP_CIPHER_CTX *ctx;
char *in;
int in_len, out_len;
- VALUE str;
+ VALUE data, str;
+
+ rb_scan_args(argc, argv, "11", &data, &str);
StringValue(data);
- in = RSTRING(data)->ptr;
- in_len = RSTRING(data)->len;
+ in = RSTRING_PTR(data);
+ if ((in_len = RSTRING_LEN(data)) == 0)
+ rb_raise(rb_eArgError, "data must not be empty");
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))
- ossl_raise(eCipherError, NULL);
- assert(out_len < RSTRING(str)->len);
- RSTRING(str)->len = out_len;
- RSTRING(str)->ptr[out_len] = 0;
+ out_len = in_len+EVP_CIPHER_CTX_block_size(ctx);
- return str;
-}
+ if (NIL_P(str)) {
+ str = rb_str_new(0, out_len);
+ } else {
+ StringValue(str);
+ rb_str_resize(str, out_len);
+ }
-static VALUE
-ossl_cipher_update_deprecated(VALUE self, VALUE data)
-{
- char *cname;
+ if (!EVP_CipherUpdate(ctx, RSTRING_PTR(str), &out_len, in, in_len))
+ ossl_raise(eCipherError, NULL);
+ assert(out_len < RSTRING_LEN(str));
+ rb_str_set_len(str, out_len);
- cname = rb_class2name(rb_obj_class(self));
- rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname);
- return ossl_cipher_update(self, data);
+ return str;
}
+/*
+ * call-seq:
+ * cipher.final -> aString
+ *
+ * Returns the remaining data held in the cipher object. Further calls to update() or final() will return garbage.
+ *
+ * See EVP_CipherFinal_ex for further information.
+ */
static VALUE
ossl_cipher_final(VALUE self)
{
@@ -255,15 +372,20 @@ ossl_cipher_final(VALUE self)
GetCipher(self, ctx);
str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx));
- if (!EVP_CipherFinal_ex(ctx, RSTRING(str)->ptr, &out_len))
+ if (!EVP_CipherFinal_ex(ctx, RSTRING_PTR(str), &out_len))
ossl_raise(eCipherError, NULL);
- assert(out_len <= RSTRING(str)->len);
- RSTRING(str)->len = out_len;
- RSTRING(str)->ptr[out_len] = 0;
+ assert(out_len <= RSTRING_LEN(str));
+ rb_str_set_len(str, out_len);
return str;
}
+/*
+ * call-seq:
+ * cipher.name -> string
+ *
+ * Returns the name of the cipher which may differ slightly from the original name provided.
+ */
static VALUE
ossl_cipher_name(VALUE self)
{
@@ -274,6 +396,14 @@ ossl_cipher_name(VALUE self)
return rb_str_new2(EVP_CIPHER_name(EVP_CIPHER_CTX_cipher(ctx)));
}
+/*
+ * call-seq:
+ * cipher.key = string -> string
+ *
+ * Sets the cipher key.
+ *
+ * Only call this method after calling cipher.encrypt or cipher.decrypt.
+ */
static VALUE
ossl_cipher_set_key(VALUE self, VALUE key)
{
@@ -282,15 +412,23 @@ ossl_cipher_set_key(VALUE self, VALUE key)
StringValue(key);
GetCipher(self, ctx);
- if (RSTRING(key)->len < EVP_CIPHER_CTX_key_length(ctx))
+ if (RSTRING_LEN(key) < EVP_CIPHER_CTX_key_length(ctx))
ossl_raise(eCipherError, "key length too short");
- if (EVP_CipherInit_ex(ctx, NULL, NULL, RSTRING(key)->ptr, NULL, -1) != 1)
+ if (EVP_CipherInit_ex(ctx, NULL, NULL, RSTRING_PTR(key), NULL, -1) != 1)
ossl_raise(eCipherError, NULL);
return key;
}
+/*
+ * call-seq:
+ * cipher.iv = string -> string
+ *
+ * Sets the cipher iv.
+ *
+ * Only call this method after calling cipher.encrypt or cipher.decrypt.
+ */
static VALUE
ossl_cipher_set_iv(VALUE self, VALUE iv)
{
@@ -299,20 +437,32 @@ ossl_cipher_set_iv(VALUE self, VALUE iv)
StringValue(iv);
GetCipher(self, ctx);
- if (RSTRING(iv)->len < EVP_CIPHER_CTX_iv_length(ctx))
+ if (RSTRING_LEN(iv) < EVP_CIPHER_CTX_iv_length(ctx))
ossl_raise(eCipherError, "iv length too short");
- if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, RSTRING(iv)->ptr, -1) != 1)
+ if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, RSTRING_PTR(iv), -1) != 1)
ossl_raise(eCipherError, NULL);
return iv;
}
+
+/*
+ * call-seq:
+ * cipher.key_length = integer -> integer
+ *
+ * Sets the key length of the cipher. If the cipher is a fixed length cipher then attempting to set the key
+ * length to any value other than the fixed value is an error.
+ *
+ * Under normal circumstances you do not need to call this method (and probably shouldn't).
+ *
+ * See EVP_CIPHER_CTX_set_key_length for further information.
+ */
static VALUE
ossl_cipher_set_key_length(VALUE self, VALUE key_length)
{
- EVP_CIPHER_CTX *ctx;
int len = NUM2INT(key_length);
+ EVP_CIPHER_CTX *ctx;
GetCipher(self, ctx);
if (EVP_CIPHER_CTX_set_key_length(ctx, len) != 1)
@@ -321,6 +471,16 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length)
return key_length;
}
+/*
+ * call-seq:
+ * cipher.padding = integer -> integer
+ *
+ * Enables or disables padding. By default encryption operations are padded using standard block padding and the
+ * padding is checked and removed when decrypting. If the pad parameter is zero then no padding is performed, the
+ * total amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur.
+ *
+ * See EVP_CIPHER_CTX_set_padding for further information.
+ */
static VALUE
ossl_cipher_set_padding(VALUE self, VALUE padding)
{
@@ -349,25 +509,51 @@ CIPHER_0ARG_INT(key_length)
CIPHER_0ARG_INT(iv_length)
CIPHER_0ARG_INT(block_size)
+#if 0
+/*
+ * call-seq:
+ * cipher.key_length -> integer
+ *
+ */
+static VALUE ossl_cipher_key_length() { }
+/*
+ * call-seq:
+ * cipher.iv_length -> integer
+ *
+ */
+static VALUE ossl_cipher_iv_length() { }
+/*
+ * call-seq:
+ * cipher.block_size -> integer
+ *
+ */
+static VALUE ossl_cipher_block_size() { }
+#endif
+
/*
* INIT
*/
void
Init_ossl_cipher(void)
{
- mCipher = rb_define_module_under(mOSSL, "Cipher");
- eCipherError = rb_define_class_under(mOSSL, "CipherError", eOSSLError);
- cCipher = rb_define_class_under(mCipher, "Cipher", rb_cObject);
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+ cCipher = rb_define_class_under(mOSSL, "Cipher", rb_cObject);
+ eCipherError = rb_define_class_under(cCipher, "CipherError", eOSSLError);
rb_define_alloc_func(cCipher, ossl_cipher_alloc);
rb_define_copy_func(cCipher, ossl_cipher_copy);
+ rb_define_module_function(cCipher, "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);
rb_define_method(cCipher, "decrypt", ossl_cipher_decrypt, -1);
rb_define_method(cCipher, "pkcs5_keyivgen", ossl_cipher_pkcs5_keyivgen, -1);
- rb_define_method(cCipher, "update", ossl_cipher_update, 1);
+ rb_define_method(cCipher, "update", ossl_cipher_update, -1);
+#if RUBY_VERSION_CODE < 190
rb_define_method(cCipher, "<<", ossl_cipher_update_deprecated, 1);
+#endif
rb_define_method(cCipher, "final", ossl_cipher_final, 0);
rb_define_method(cCipher, "name", ossl_cipher_name, 0);
rb_define_method(cCipher, "key=", ossl_cipher_set_key, 1);
@@ -378,3 +564,4 @@ Init_ossl_cipher(void)
rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
}
+
diff --git a/ext/openssl/ossl_cipher.h b/ext/openssl/ossl_cipher.h
index 63c7a875e8..bed4fa853b 100644
--- a/ext/openssl/ossl_cipher.h
+++ b/ext/openssl/ossl_cipher.h
@@ -11,7 +11,6 @@
#if !defined(_OSSL_CIPHER_H_)
#define _OSSL_CIPHER_H_
-extern VALUE mCipher;
extern VALUE cCipher;
extern VALUE eCipherError;
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index ef89fdfe0d..cc8e324029 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -171,16 +171,16 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value)
StringValue(name);
StringValue(value);
GetConfig(self, conf);
- if(!(sv = _CONF_get_section(conf, RSTRING(section)->ptr))){
- if(!(sv = _CONF_new_section(conf, RSTRING(section)->ptr))){
+ if(!(sv = _CONF_get_section(conf, RSTRING_PTR(section)))){
+ if(!(sv = _CONF_new_section(conf, RSTRING_PTR(section)))){
ossl_raise(eConfigError, NULL);
}
}
if(!(cv = OPENSSL_malloc(sizeof(CONF_VALUE)))){
ossl_raise(eConfigError, NULL);
}
- cv->name = BUF_strdup(RSTRING(name)->ptr);
- cv->value = BUF_strdup(RSTRING(value)->ptr);
+ cv->name = BUF_strdup(RSTRING_PTR(name));
+ cv->value = BUF_strdup(RSTRING_PTR(value));
if(!cv->name || !cv->value || !_CONF_add_string(conf, sv, cv)){
OPENSSL_free(cv->name);
OPENSSL_free(cv->value);
@@ -201,7 +201,7 @@ ossl_config_get_value(VALUE self, VALUE section, VALUE name)
StringValue(section);
StringValue(name);
GetConfig(self, conf);
- str = NCONF_get_string(conf, RSTRING(section)->ptr, RSTRING(name)->ptr);
+ str = NCONF_get_string(conf, RSTRING_PTR(section), RSTRING_PTR(name));
if(!str){
ERR_clear_error();
return Qnil;
@@ -245,8 +245,11 @@ set_conf_section_i(VALUE i, VALUE *arg)
static VALUE
ossl_config_set_section(VALUE self, VALUE section, VALUE hash)
{
- VALUE arg[2] = { self, section };
- rb_iterate(rb_each, hash, set_conf_section_i, (VALUE)arg);
+ VALUE arg[2];
+
+ arg[0] = self;
+ arg[1] = section;
+ rb_block_call(hash, rb_intern("each"), 0, 0, set_conf_section_i, (VALUE)arg);
return hash;
}
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index d22f022442..879d399fe7 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -24,7 +24,6 @@
/*
* Classes
*/
-VALUE mDigest;
VALUE cDigest;
VALUE eDigestError;
@@ -36,11 +35,23 @@ static VALUE ossl_digest_alloc(VALUE klass);
const EVP_MD *
GetDigestPtr(VALUE obj)
{
- EVP_MD_CTX *ctx;
+ const EVP_MD *md;
+
+ if (TYPE(obj) == T_STRING) {
+ const char *name = STR2CSTR(obj);
+
+ md = EVP_get_digestbyname(name);
+ if (!md)
+ ossl_raise(rb_eRuntimeError, "Unsupported digest algorithm (%s).", name);
+ } else {
+ EVP_MD_CTX *ctx;
- SafeGetDigest(obj, ctx);
+ SafeGetDigest(obj, ctx);
- return EVP_MD_CTX_md(ctx); /*== ctx->digest*/
+ md = EVP_MD_CTX_md(ctx);
+ }
+
+ return md;
}
VALUE
@@ -51,7 +62,6 @@ ossl_digest_new(const EVP_MD *md)
ret = ossl_digest_alloc(cDigest);
GetDigest(ret, ctx);
- EVP_MD_CTX_init(ctx);
EVP_DigestInit_ex(ctx, md, NULL);
return ret;
@@ -69,14 +79,18 @@ ossl_digest_alloc(VALUE klass)
ctx = EVP_MD_CTX_create();
if (ctx == NULL)
ossl_raise(rb_eRuntimeError, "EVP_MD_CTX_create() failed");
- EVP_MD_CTX_init(ctx);
obj = Data_Wrap_Struct(klass, 0, EVP_MD_CTX_destroy, ctx);
-
+
return obj;
}
VALUE ossl_digest_update(VALUE, VALUE);
+/*
+ * call-seq:
+ * Digest.new(string) -> digest
+ *
+ */
static VALUE
ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -86,14 +100,9 @@ ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
VALUE type, data;
rb_scan_args(argc, argv, "11", &type, &data);
- StringValue(type);
+ md = GetDigestPtr(type);
if (!NIL_P(data)) StringValue(data);
- name = StringValuePtr(type);
-
- md = EVP_get_digestbyname(name);
- if (!md) {
- ossl_raise(rb_eRuntimeError, "Unsupported digest algorithm (%s).", name);
- }
+
GetDigest(self, ctx);
EVP_DigestInit_ex(ctx, md, NULL);
@@ -118,6 +127,11 @@ ossl_digest_copy(VALUE self, VALUE other)
return self;
}
+/*
+ * call-seq:
+ * digest.reset -> self
+ *
+ */
static VALUE
ossl_digest_reset(VALUE self)
{
@@ -129,6 +143,11 @@ ossl_digest_reset(VALUE self)
return self;
}
+/*
+ * call-seq:
+ * digest.update(string) -> aString
+ *
+ */
VALUE
ossl_digest_update(VALUE self, VALUE data)
{
@@ -136,126 +155,77 @@ ossl_digest_update(VALUE self, VALUE data)
StringValue(data);
GetDigest(self, ctx);
- EVP_DigestUpdate(ctx, RSTRING(data)->ptr, RSTRING(data)->len);
+ EVP_DigestUpdate(ctx, RSTRING_PTR(data), RSTRING_LEN(data));
return self;
}
-static void
-digest_final(EVP_MD_CTX *ctx, char **buf, int *buf_len)
-{
- EVP_MD_CTX final;
-
- if (!EVP_MD_CTX_copy(&final, ctx)) {
- ossl_raise(eDigestError, NULL);
- }
- if (!(*buf = OPENSSL_malloc(EVP_MD_CTX_size(&final)))) {
- EVP_MD_CTX_cleanup(&final);
- ossl_raise(eDigestError, "Cannot allocate mem for digest");
- }
- EVP_DigestFinal_ex(&final, *buf, buf_len);
- EVP_MD_CTX_cleanup(&final);
-}
-
+/*
+ * call-seq:
+ * digest.finish -> aString
+ *
+ */
static VALUE
-ossl_digest_digest(VALUE self)
+ossl_digest_finish(int argc, VALUE *argv, VALUE self)
{
EVP_MD_CTX *ctx;
- char *buf;
- int buf_len;
- VALUE digest;
-
- GetDigest(self, ctx);
- digest_final(ctx, &buf, &buf_len);
- digest = ossl_buf2str(buf, buf_len);
-
- return digest;
-}
+ VALUE str;
-static VALUE
-ossl_digest_hexdigest(VALUE self)
-{
- EVP_MD_CTX *ctx;
- char *buf, *hexbuf;
- int buf_len;
- VALUE hexdigest;
+ rb_scan_args(argc, argv, "01", &str);
GetDigest(self, ctx);
- digest_final(ctx, &buf, &buf_len);
- if (string2hex(buf, buf_len, &hexbuf, NULL) != 2 * buf_len) {
- OPENSSL_free(buf);
- ossl_raise(eDigestError, "Memory alloc error");
- }
- OPENSSL_free(buf);
- hexdigest = ossl_buf2str(hexbuf, 2 * buf_len);
-
- return hexdigest;
-}
-
-static VALUE
-ossl_digest_s_digest(VALUE klass, VALUE str, VALUE data)
-{
- VALUE obj = rb_class_new_instance(1, &str, klass);
-
- ossl_digest_update(obj, data);
- return ossl_digest_digest(obj);
-}
-
-static VALUE
-ossl_digest_s_hexdigest(VALUE klass, VALUE str, VALUE data)
-{
- VALUE obj = rb_class_new_instance(1, &str, klass);
+ if (NIL_P(str)) {
+ str = rb_str_new(NULL, EVP_MD_CTX_size(ctx));
+ } else {
+ StringValue(str);
+ rb_str_resize(str, EVP_MD_CTX_size(ctx));
+ }
- ossl_digest_update(obj, data);
+ EVP_DigestFinal_ex(ctx, RSTRING_PTR(str), NULL);
- return ossl_digest_hexdigest(obj);
+ return str;
}
+/*
+ * call-seq:
+ * digest.name -> string
+ *
+ */
static VALUE
-ossl_digest_equal(VALUE self, VALUE other)
+ossl_digest_name(VALUE self)
{
EVP_MD_CTX *ctx;
- VALUE str1, str2;
- if (rb_obj_is_kind_of(other, cDigest) == Qtrue) {
- str2 = ossl_digest_digest(other);
- } else {
- StringValue(other);
- str2 = other;
- }
GetDigest(self, ctx);
- if (RSTRING(str2)->len == EVP_MD_CTX_size(ctx)) {
- str1 = ossl_digest_digest(self);
- } else {
- str1 = ossl_digest_hexdigest(self);
- }
- if (RSTRING(str1)->len == RSTRING(str2)->len
- && rb_str_cmp(str1, str2) == 0) {
- return Qtrue;
- }
- return Qfalse;
+ return rb_str_new2(EVP_MD_name(EVP_MD_CTX_md(ctx)));
}
+/*
+ * call-seq:
+ * digest.digest_size -> integer
+ *
+ * Returns the output size of the digest.
+ */
static VALUE
-ossl_digest_name(VALUE self)
+ossl_digest_size(VALUE self)
{
EVP_MD_CTX *ctx;
GetDigest(self, ctx);
- return rb_str_new2(EVP_MD_name(EVP_MD_CTX_md(ctx)));
+ return INT2NUM(EVP_MD_CTX_size(ctx));
}
static VALUE
-ossl_digest_size(VALUE self)
+ossl_digest_block_length(VALUE self)
{
EVP_MD_CTX *ctx;
GetDigest(self, ctx);
- return INT2NUM(EVP_MD_CTX_size(ctx));
+ return INT2NUM(EVP_MD_CTX_block_size(ctx));
}
/*
@@ -264,31 +234,26 @@ ossl_digest_size(VALUE self)
void
Init_ossl_digest()
{
- mDigest = rb_define_module_under(mOSSL, "Digest");
-
- eDigestError = rb_define_class_under(mDigest, "DigestError", eOSSLError);
-
- cDigest = rb_define_class_under(mDigest, "Digest", rb_cObject);
+ rb_require("openssl");
+ rb_require("digest");
+
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
+ cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class"));
+ eDigestError = rb_define_class_under(cDigest, "DigestError", eOSSLError);
rb_define_alloc_func(cDigest, ossl_digest_alloc);
- rb_define_singleton_method(cDigest, "digest", ossl_digest_s_digest, 2);
- rb_define_singleton_method(cDigest, "hexdigest", ossl_digest_s_hexdigest, 2);
-
+
rb_define_method(cDigest, "initialize", ossl_digest_initialize, -1);
- rb_define_method(cDigest, "reset", ossl_digest_reset, 0);
-
rb_define_copy_func(cDigest, ossl_digest_copy);
-
- rb_define_method(cDigest, "digest", ossl_digest_digest, 0);
- rb_define_method(cDigest, "hexdigest", ossl_digest_hexdigest, 0);
- rb_define_alias(cDigest, "inspect", "hexdigest");
- rb_define_alias(cDigest, "to_s", "hexdigest");
-
+ rb_define_method(cDigest, "reset", ossl_digest_reset, 0);
rb_define_method(cDigest, "update", ossl_digest_update, 1);
rb_define_alias(cDigest, "<<", "update");
-
- rb_define_method(cDigest, "==", ossl_digest_equal, 1);
-
+ rb_define_private_method(cDigest, "finish", ossl_digest_finish, -1);
+ rb_define_method(cDigest, "digest_length", ossl_digest_size, 0);
+ rb_define_method(cDigest, "block_length", ossl_digest_block_length, 0);
+
rb_define_method(cDigest, "name", ossl_digest_name, 0);
- rb_define_method(cDigest, "size", ossl_digest_size, 0);
}
diff --git a/ext/openssl/ossl_digest.h b/ext/openssl/ossl_digest.h
index 8a1f7964f2..8cc5b1bc56 100644
--- a/ext/openssl/ossl_digest.h
+++ b/ext/openssl/ossl_digest.h
@@ -11,7 +11,6 @@
#if !defined(_OSSL_DIGEST_H_)
#define _OSSL_DIGEST_H_
-extern VALUE mDigest;
extern VALUE cDigest;
extern VALUE eDigestError;
diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c
index 71586e3620..cd835d1237 100644
--- a/ext/openssl/ossl_engine.c
+++ b/ext/openssl/ossl_engine.c
@@ -40,7 +40,7 @@ VALUE eEngineError;
*/
#define OSSL_ENGINE_LOAD_IF_MATCH(x) \
do{\
- if(!strcmp(#x, RSTRING(name)->ptr)){\
+ if(!strcmp(#x, RSTRING_PTR(name))){\
ENGINE_load_##x();\
return Qtrue;\
}\
@@ -75,7 +75,7 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
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);
+ rb_warning("no such builtin loader for `%s'", RSTRING_PTR(name));
return Qnil;
#endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
}
@@ -112,7 +112,7 @@ ossl_engine_s_by_id(VALUE klass, VALUE id)
StringValue(id);
ossl_engine_s_load(1, &id, klass);
- if(!(e = ENGINE_by_id(RSTRING(id)->ptr)))
+ if(!(e = ENGINE_by_id(RSTRING_PTR(id))))
ossl_raise(eEngineError, NULL);
WrapEngine(klass, obj, e);
if(rb_block_given_p()) rb_yield(obj);
@@ -281,8 +281,8 @@ ossl_engine_ctrl_cmd(int argc, VALUE *argv, VALUE self)
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);
+ ret = ENGINE_ctrl_cmd_string(e, RSTRING_PTR(cmd),
+ NIL_P(val) ? NULL : RSTRING_PTR(val), 0);
if (!ret) ossl_raise(eEngineError, NULL);
return self;
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index ca5917518f..ef77d6c427 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -57,6 +57,12 @@ ossl_hmac_alloc(VALUE klass)
return obj;
}
+
+/*
+ * call-seq:
+ * HMAC.new(key, digest) -> hmac
+ *
+ */
static VALUE
ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
{
@@ -64,7 +70,7 @@ ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
StringValue(key);
GetHMAC(self, ctx);
- HMAC_Init_ex(ctx, RSTRING(key)->ptr, RSTRING(key)->len,
+ HMAC_Init_ex(ctx, RSTRING_PTR(key), RSTRING_LEN(key),
GetDigestPtr(digest), NULL);
return self;
@@ -81,12 +87,15 @@ ossl_hmac_copy(VALUE self, VALUE other)
GetHMAC(self, ctx1);
SafeGetHMAC(other, ctx2);
- if (!HMAC_CTX_copy(ctx1, ctx2)) {
- ossl_raise(eHMACError, NULL);
- }
+ HMAC_CTX_copy(ctx1, ctx2);
return self;
}
+/*
+ * call-seq:
+ * hmac.update(string) -> self
+ *
+ */
static VALUE
ossl_hmac_update(VALUE self, VALUE data)
{
@@ -94,7 +103,7 @@ ossl_hmac_update(VALUE self, VALUE data)
StringValue(data);
GetHMAC(self, ctx);
- HMAC_Update(ctx, RSTRING(data)->ptr, RSTRING(data)->len);
+ HMAC_Update(ctx, RSTRING_PTR(data), RSTRING_LEN(data));
return self;
}
@@ -104,9 +113,7 @@ hmac_final(HMAC_CTX *ctx, char **buf, int *buf_len)
{
HMAC_CTX final;
- if (!HMAC_CTX_copy(&final, ctx)) {
- ossl_raise(eHMACError, NULL);
- }
+ HMAC_CTX_copy(&final, ctx);
if (!(*buf = OPENSSL_malloc(HMAC_size(&final)))) {
HMAC_CTX_cleanup(&final);
OSSL_Debug("Allocating %d mem", HMAC_size(&final));
@@ -116,6 +123,11 @@ hmac_final(HMAC_CTX *ctx, char **buf, int *buf_len)
HMAC_CTX_cleanup(&final);
}
+/*
+ * call-seq:
+ * hmac.digest -> aString
+ *
+ */
static VALUE
ossl_hmac_digest(VALUE self)
{
@@ -131,6 +143,11 @@ ossl_hmac_digest(VALUE self)
return digest;
}
+/*
+ * call-seq:
+ * hmac.hexdigest -> aString
+ *
+ */
static VALUE
ossl_hmac_hexdigest(VALUE self)
{
@@ -151,6 +168,27 @@ ossl_hmac_hexdigest(VALUE self)
return hexdigest;
}
+/*
+ * call-seq:
+ * hmac.reset -> self
+ *
+ */
+static VALUE
+ossl_hmac_reset(VALUE self)
+{
+ HMAC_CTX *ctx;
+
+ GetHMAC(self, ctx);
+ HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * HMAC.digest(digest, key, data) -> aString
+ *
+ */
static VALUE
ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
{
@@ -159,12 +197,17 @@ ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
StringValue(key);
StringValue(data);
- buf = HMAC(GetDigestPtr(digest), RSTRING(key)->ptr, RSTRING(key)->len,
- RSTRING(data)->ptr, RSTRING(data)->len, NULL, &buf_len);
+ buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
+ RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
return rb_str_new(buf, buf_len);
}
+/*
+ * call-seq:
+ * HMAC.digest(digest, key, data) -> aString
+ *
+ */
static VALUE
ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
{
@@ -175,8 +218,8 @@ ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
StringValue(key);
StringValue(data);
- buf = HMAC(GetDigestPtr(digest), RSTRING(key)->ptr, RSTRING(key)->len,
- RSTRING(data)->ptr, RSTRING(data)->len, NULL, &buf_len);
+ buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
+ RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
if (string2hex(buf, buf_len, &hexbuf, NULL) != 2 * buf_len) {
ossl_raise(eHMACError, "Cannot convert buf to hexbuf");
}
@@ -191,6 +234,10 @@ ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
void
Init_ossl_hmac()
{
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
eHMACError = rb_define_class_under(mOSSL, "HMACError", eOSSLError);
cHMAC = rb_define_class_under(mOSSL, "HMAC", rb_cObject);
@@ -202,6 +249,7 @@ Init_ossl_hmac()
rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2);
rb_define_copy_func(cHMAC, ossl_hmac_copy);
+ rb_define_method(cHMAC, "reset", ossl_hmac_reset, 0);
rb_define_method(cHMAC, "update", ossl_hmac_update, 1);
rb_define_alias(cHMAC, "<<", "update");
rb_define_method(cHMAC, "digest", ossl_hmac_digest, 0);
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index 5cba529850..738a203d93 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -62,14 +62,15 @@ ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
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))) {
+ if (!(spki = NETSCAPE_SPKI_b64_decode(RSTRING_PTR(buffer), -1))) {
+ p = RSTRING_PTR(buffer);
+ if (!(spki = d2i_NETSCAPE_SPKI(NULL, &p, RSTRING_LEN(buffer)))) {
ossl_raise(eSPKIError, NULL);
}
}
NETSCAPE_SPKI_free(DATA_PTR(self));
DATA_PTR(self) = spki;
+ ERR_clear_error();
return self;
}
@@ -86,7 +87,7 @@ ossl_spki_to_der(VALUE self)
if ((len = i2d_NETSCAPE_SPKI(spki, NULL)) <= 0)
ossl_raise(eX509CertError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if (i2d_NETSCAPE_SPKI(spki, &p) <= 0)
ossl_raise(eX509CertError, NULL);
ossl_str_adjust(str, p);
@@ -168,7 +169,7 @@ ossl_spki_get_challenge(VALUE self)
GetSPKI(self, spki);
if (spki->spkac->challenge->length <= 0) {
OSSL_Debug("Challenge.length <= 0?");
- return rb_str_new2(NULL);
+ return rb_str_new(0, 0);
}
return rb_str_new(spki->spkac->challenge->data,
@@ -182,8 +183,8 @@ ossl_spki_set_challenge(VALUE self, VALUE str)
StringValue(str);
GetSPKI(self, spki);
- if (!ASN1_STRING_set(spki->spkac->challenge, RSTRING(str)->ptr,
- RSTRING(str)->len)) {
+ if (!ASN1_STRING_set(spki->spkac->challenge, RSTRING_PTR(str),
+ RSTRING_LEN(str))) {
ossl_raise(eSPKIError, NULL);
}
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c
index b1e721c24c..1e8e5903bd 100644
--- a/ext/openssl/ossl_ocsp.c
+++ b/ext/openssl/ossl_ocsp.c
@@ -109,9 +109,9 @@ ossl_ocspreq_initialize(int argc, VALUE *argv, VALUE self)
if(!NIL_P(arg)){
arg = ossl_to_der_if_possible(arg);
StringValue(arg);
- p = (unsigned char*)RSTRING(arg)->ptr;
+ p = (unsigned char*)RSTRING_PTR(arg);
if(!d2i_OCSP_REQUEST((OCSP_REQUEST**)&DATA_PTR(self), &p,
- RSTRING(arg)->len)){
+ RSTRING_LEN(arg))){
ossl_raise(eOCSPError, "cannot load DER encoded request");
}
}
@@ -134,7 +134,7 @@ ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
else{
StringValue(val);
GetOCSPReq(self, req);
- ret = OCSP_request_add1_nonce(req, RSTRING(val)->ptr, RSTRING(val)->len);
+ ret = OCSP_request_add1_nonce(req, RSTRING_PTR(val), RSTRING_LEN(val));
}
if(!ret) ossl_raise(eOCSPError, NULL);
@@ -265,7 +265,7 @@ ossl_ocspreq_to_der(VALUE self)
if((len = i2d_OCSP_REQUEST(req, NULL)) <= 0)
ossl_raise(eOCSPError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_OCSP_REQUEST(req, &p) <= 0)
ossl_raise(eOCSPError, NULL);
ossl_str_adjust(str, p);
@@ -316,9 +316,9 @@ ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
if(!NIL_P(arg)){
arg = ossl_to_der_if_possible(arg);
StringValue(arg);
- p = RSTRING(arg)->ptr;
+ p = RSTRING_PTR(arg);
if(!d2i_OCSP_RESPONSE((OCSP_RESPONSE**)&DATA_PTR(self), &p,
- RSTRING(arg)->len)){
+ RSTRING_LEN(arg))){
ossl_raise(eOCSPError, "cannot load DER encoded response");
}
}
@@ -377,7 +377,7 @@ ossl_ocspres_to_der(VALUE self)
if((len = i2d_OCSP_RESPONSE(res, NULL)) <= 0)
ossl_raise(eOCSPError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_OCSP_RESPONSE(res, NULL) <= 0)
ossl_raise(eOCSPError, NULL);
ossl_str_adjust(str, p);
@@ -436,7 +436,7 @@ ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
else{
StringValue(val);
GetOCSPBasicRes(self, bs);
- ret = OCSP_basic_add1_nonce(bs, RSTRING(val)->ptr, RSTRING(val)->len);
+ ret = OCSP_basic_add1_nonce(bs, RSTRING_PTR(val), RSTRING_LEN(val));
}
if(!ret) ossl_raise(eOCSPError, NULL);
@@ -461,8 +461,8 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
if(!NIL_P(ext)){
/* All ary's members should be X509Extension */
Check_Type(ext, T_ARRAY);
- for (i = 0; i < RARRAY(ext)->len; i++)
- OSSL_Check_Kind(RARRAY(ext)->ptr[i], cX509Ext);
+ for (i = 0; i < RARRAY_LEN(ext); i++)
+ OSSL_Check_Kind(RARRAY_PTR(ext)[i], cX509Ext);
}
error = 0;
@@ -490,8 +490,8 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
X509_EXTENSION *x509ext;
sk_X509_EXTENSION_pop_free(single->singleExtensions, X509_EXTENSION_free);
single->singleExtensions = NULL;
- for(i = 0; i < RARRAY(ext)->len; i++){
- x509ext = DupX509ExtPtr(RARRAY(ext)->ptr[i]);
+ for(i = 0; i < RARRAY_LEN(ext); i++){
+ x509ext = DupX509ExtPtr(RARRAY_PTR(ext)[i]);
if(!OCSP_SINGLERESP_add_ext(single, x509ext, -1)){
X509_EXTENSION_free(x509ext);
error = 1;
@@ -681,7 +681,7 @@ Init_ossl_ocsp()
{
mOCSP = rb_define_module_under(mOSSL, "OCSP");
- eOCSPError = rb_define_class_under(mOCSP, "OCSPError", rb_cObject);
+ eOCSPError = rb_define_class_under(mOCSP, "OCSPError", eOSSLError);
cOCSPReq = rb_define_class_under(mOCSP, "Request", rb_cObject);
rb_define_alloc_func(cOCSPReq, ossl_ocspreq_alloc);
diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c
index e7d9954c5a..2ec69ba8db 100644
--- a/ext/openssl/ossl_pkcs12.c
+++ b/ext/openssl/ossl_pkcs12.c
@@ -30,7 +30,6 @@
/*
* Classes
*/
-VALUE mPKCS12;
VALUE cPKCS12;
VALUE ePKCS12Error;
@@ -49,32 +48,85 @@ ossl_pkcs12_s_allocate(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * PKCS12.create(pass, name, key, cert [, ca, [, key_pbe [, cert_pbe [, key_iter [, mac_iter [, keytype]]]]]])
+ *
+ * === Parameters
+ * * +pass+ - string
+ * * +name+ - A string describing the key.
+ * * +key+ - Any PKey.
+ * * +cert+ - A X509::Certificate.
+ * * * The public_key portion of the certificate must contain a valid public key.
+ * * * The not_before and not_after fields must be filled in.
+ * * +ca+ - An optional array of X509::Certificate's.
+ * * +key_pbe+ - string
+ * * +cert_pbe+ - string
+ * * +key_iter+ - integer
+ * * +mac_iter+ - integer
+ * * +keytype+ - An integer representing an MSIE specific extension.
+ *
+ * Any optional arguments may be supplied as nil to preserve the OpenSSL defaults.
+ *
+ * See the OpenSSL documentation for PKCS12_create().
+ */
static VALUE
ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
{
- VALUE pass, name, pkey, cert, ca;
+ VALUE pass, name, pkey, cert, ca, key_nid, cert_nid, key_iter, mac_iter, keytype;
VALUE obj;
char *passphrase, *friendlyname;
EVP_PKEY *key;
X509 *x509;
STACK_OF(X509) *x509s;
+ int nkey = 0, ncert = 0, kiter = 0, miter = 0, ktype = 0;
PKCS12 *p12;
- rb_scan_args(argc, argv, "41", &pass, &name, &pkey, &cert, &ca);
+ rb_scan_args(argc, argv, "46", &pass, &name, &pkey, &cert, &ca, &key_nid, &cert_nid, &key_iter, &mac_iter, &keytype);
passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass);
friendlyname = NIL_P(name) ? NULL : StringValuePtr(name);
key = GetPKeyPtr(pkey);
x509 = GetX509CertPtr(cert);
x509s = NIL_P(ca) ? NULL : ossl_x509_ary2sk(ca);
+/* TODO: make a VALUE to nid function */
+ if (!NIL_P(key_nid)) {
+ if ((nkey = OBJ_txt2nid(StringValuePtr(key_nid))) == NID_undef)
+ rb_raise(rb_eArgError, "Unknown PBE algorithm %s", StringValuePtr(key_nid));
+ }
+ if (!NIL_P(cert_nid)) {
+ if ((ncert = OBJ_txt2nid(StringValuePtr(cert_nid))) == NID_undef)
+ rb_raise(rb_eArgError, "Unknown PBE algorithm %s", StringValuePtr(cert_nid));
+ }
+ if (!NIL_P(key_iter))
+ kiter = NUM2INT(key_iter);
+ if (!NIL_P(mac_iter))
+ miter = NUM2INT(mac_iter);
+ if (!NIL_P(keytype))
+ ktype = NUM2INT(keytype);
+
p12 = PKCS12_create(passphrase, friendlyname, key, x509, x509s,
- 0, 0, 0, 0, 0);
+ nkey, ncert, kiter, miter, ktype);
sk_X509_pop_free(x509s, X509_free);
if(!p12) ossl_raise(ePKCS12Error, NULL);
WrapPKCS12(cPKCS12, obj, p12);
+ ossl_pkcs12_set_key(obj, pkey);
+ ossl_pkcs12_set_cert(obj, cert);
+ ossl_pkcs12_set_ca_certs(obj, ca);
+
return obj;
}
+/*
+ * call-seq:
+ * PKCS12.new -> pkcs12
+ * PKCS12.new(str) -> pkcs12
+ * PKCS12.new(str, pass) -> pkcs12
+ *
+ * === Parameters
+ * * +str+ - Must be a DER encoded PKCS12 string.
+ * * +pass+ - string
+ */
static VALUE
ossl_pkcs12_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -94,7 +146,7 @@ ossl_pkcs12_initialize(int argc, VALUE *argv, VALUE self)
pkey = cert = ca = Qnil;
if(!PKCS12_parse((PKCS12*)DATA_PTR(self), passphrase, &key, &x509, &x509s))
- ossl_raise(ePKCS12Error, NULL);
+ ossl_raise(ePKCS12Error, "PKCS12_parse");
pkey = rb_protect((VALUE(*)_((VALUE)))ossl_pkey_new, (VALUE)key,
&st); /* NO DUP */
if(st) goto err;
@@ -129,7 +181,7 @@ ossl_pkcs12_to_der(VALUE self)
if((len = i2d_PKCS12(p12, NULL)) <= 0)
ossl_raise(ePKCS12Error, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_PKCS12(p12, &p) <= 0)
ossl_raise(ePKCS12Error, NULL);
ossl_str_adjust(str, p);
@@ -140,10 +192,14 @@ ossl_pkcs12_to_der(VALUE self)
void
Init_ossl_pkcs12()
{
- mPKCS12 = rb_define_module_under(mOSSL, "PKCS12");
- cPKCS12 = rb_define_class_under(mPKCS12, "PKCS12", rb_cObject);
- ePKCS12Error = rb_define_class_under(mPKCS12, "PKCS12Error", eOSSLError);
- rb_define_module_function(mPKCS12, "create", ossl_pkcs12_s_create, -1);
+ /*
+ * Defines a file format commonly used to store private keys with
+ * accompanying public key certificates, protected with a password-based
+ * symmetric key.
+ */
+ cPKCS12 = rb_define_class_under(mOSSL, "PKCS12", rb_cObject);
+ ePKCS12Error = rb_define_class_under(cPKCS12, "PKCS12Error", eOSSLError);
+ rb_define_singleton_method(cPKCS12, "create", ossl_pkcs12_s_create, -1);
rb_define_alloc_func(cPKCS12, ossl_pkcs12_s_allocate);
rb_attr(cPKCS12, rb_intern("key"), 1, 0, Qfalse);
diff --git a/ext/openssl/ossl_pkcs12.h b/ext/openssl/ossl_pkcs12.h
index 01dde2bc30..24d25d00bb 100644
--- a/ext/openssl/ossl_pkcs12.h
+++ b/ext/openssl/ossl_pkcs12.h
@@ -6,7 +6,6 @@
#if !defined(_OSSL_PKCS12_H_)
#define _OSSL_PKCS12_H_
-extern VALUE mPKCS12;
extern VALUE cPKCS12;
extern VALUE ePKCS12Error;
diff --git a/ext/openssl/ossl_pkcs5.c b/ext/openssl/ossl_pkcs5.c
new file mode 100644
index 0000000000..007889fc94
--- /dev/null
+++ b/ext/openssl/ossl_pkcs5.c
@@ -0,0 +1,96 @@
+/*
+ * $Id$
+ * Copyright (C) 2007 Technorama Ltd. <oss-ruby@technorama.net>
+ */
+#include "ossl.h"
+
+VALUE mPKCS5;
+VALUE ePKCS5;
+
+/*
+ * call-seq:
+ * PKCS5.pbkdf2_hmac(pass, salt, iter, keylen, digest) => string
+ *
+ * === Parameters
+ * * +pass+ - string
+ * * +salt+ - string
+ * * +iter+ - integer - should be greater than 1000. 2000 is better.
+ * * +keylen+ - integer
+ * * +digest+ - a string or OpenSSL::Digest object.
+ *
+ * Available in OpenSSL 0.9.9?.
+ *
+ * Digests other than SHA1 may not be supported by other cryptography libraries.
+ */
+static VALUE
+ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen, VALUE digest)
+{
+#ifdef HAVE_PKCS5_PBKDF2_HMAC
+ VALUE str;
+ const EVP_MD *md;
+ int len = NUM2INT(keylen);
+
+ StringValue(pass);
+ StringValue(salt);
+ md = GetDigestPtr(digest);
+
+ str = rb_str_new(0, len);
+
+ if (PKCS5_PBKDF2_HMAC(RSTRING_PTR(pass), RSTRING_LEN(pass), RSTRING_PTR(salt), RSTRING_LEN(salt), NUM2INT(iter), md, len, RSTRING_PTR(str)) != 1)
+ ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC");
+
+ return str;
+#else
+ rb_notimplement();
+#endif
+}
+
+
+/*
+ * call-seq:
+ * PKCS5.pbkdf2_hmac_sha1(pass, salt, iter, keylen) => string
+ *
+ * === Parameters
+ * * +pass+ - string
+ * * +salt+ - string
+ * * +iter+ - integer - should be greater than 1000. 2000 is better.
+ * * +keylen+ - integer
+ *
+ * This method is available almost any version OpenSSL.
+ *
+ * Conforms to rfc2898.
+ */
+static VALUE
+ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen)
+{
+#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1
+ VALUE str;
+ int len = NUM2INT(keylen);
+
+ StringValue(pass);
+ StringValue(salt);
+
+ str = rb_str_new(0, len);
+
+ if (PKCS5_PBKDF2_HMAC_SHA1(RSTRING_PTR(pass), RSTRING_LEN(pass), RSTRING_PTR(salt), RSTRING_LEN(salt), NUM2INT(iter), len, RSTRING_PTR(str)) != 1)
+ ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC_SHA1");
+
+ return str;
+#else
+ rb_notimplement();
+#endif
+}
+
+void
+Init_ossl_pkcs5()
+{
+ /*
+ * Password-based Encryption
+ *
+ */
+ mPKCS5 = rb_define_module_under(mOSSL, "PKCS5");
+ ePKCS5 = rb_define_class_under(mPKCS5, "PKCS5Error", eOSSLError);
+
+ rb_define_module_function(mPKCS5, "pbkdf2_hmac", ossl_pkcs5_pbkdf2_hmac, 5);
+ rb_define_module_function(mPKCS5, "pbkdf2_hmac_sha1", ossl_pkcs5_pbkdf2_hmac_sha1, 4);
+}
diff --git a/ext/openssl/ossl_pkcs5.h b/ext/openssl/ossl_pkcs5.h
new file mode 100644
index 0000000000..a3b132bc50
--- /dev/null
+++ b/ext/openssl/ossl_pkcs5.h
@@ -0,0 +1,6 @@
+#if !defined(_OSSL_PKCS5_H_)
+#define _OSSL_PKCS5_H_
+
+void Init_ossl_pkcs5(void);
+
+#endif /* _OSSL_PKCS5_H_ */
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index 38a7dce7a2..6918844779 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -71,7 +71,6 @@
/*
* Classes
*/
-VALUE mPKCS7;
VALUE cPKCS7;
VALUE cPKCS7Signer;
VALUE cPKCS7Recipient;
@@ -134,7 +133,8 @@ DupPKCS7RecipientPtr(VALUE obj)
}
/*
- * Private
+ * call-seq:
+ * PKCS7.read_smime(string) => pkcs7
*/
static VALUE
ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg)
@@ -156,6 +156,10 @@ ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg)
return ret;
}
+/*
+ * call-seq:
+ * PKCS7.write_smime(pkcs7 [, data [, flags]]) => string
+ */
static VALUE
ossl_pkcs7_s_write_smime(int argc, VALUE *argv, VALUE klass)
{
@@ -187,6 +191,10 @@ ossl_pkcs7_s_write_smime(int argc, VALUE *argv, VALUE klass)
return str;
}
+/*
+ * call-seq:
+ * PKCS7.sign(cert, key, data, [, certs [, flags]]) => pkcs7
+ */
static VALUE
ossl_pkcs7_s_sign(int argc, VALUE *argv, VALUE klass)
{
@@ -226,6 +234,10 @@ ossl_pkcs7_s_sign(int argc, VALUE *argv, VALUE klass)
return ret;
}
+/*
+ * call-seq:
+ * PKCS7.encrypt(certs, data, [, cipher [, flags]]) => pkcs7
+ */
static VALUE
ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
{
@@ -287,6 +299,13 @@ ossl_pkcs7_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * PKCS7.new => pkcs7
+ * PKCS7.new(string) => pkcs7
+ *
+ * Many methods in this class aren't documented.
+ */
static VALUE
ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -335,7 +354,7 @@ static int
ossl_pkcs7_sym2typeid(VALUE sym)
{
int i, ret = Qnil;
- char *s;
+ const char *s;
static struct {
const char *name;
@@ -364,6 +383,10 @@ ossl_pkcs7_sym2typeid(VALUE sym)
return ret;
}
+/*
+ * call-seq:
+ * pkcs7.type = type => type
+ */
static VALUE
ossl_pkcs7_set_type(VALUE self, VALUE type)
{
@@ -376,6 +399,10 @@ ossl_pkcs7_set_type(VALUE self, VALUE type)
return type;
}
+/*
+ * call-seq:
+ * pkcs7.type => string or nil
+ */
static VALUE
ossl_pkcs7_get_type(VALUE self)
{
@@ -583,7 +610,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary)
certs = pkcs7_get_certs_or_crls(self, 1);
while((cert = sk_X509_pop(certs))) X509_free(cert);
- rb_iterate(rb_each, ary, ossl_pkcs7_set_certs_i, self);
+ rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self);
return ary;
}
@@ -623,7 +650,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary)
crls = pkcs7_get_certs_or_crls(self, 0);
while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl);
- rb_iterate(rb_each, ary, ossl_pkcs7_set_crls_i, self);
+ rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self);
return ary;
}
@@ -667,8 +694,10 @@ ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
}
ok = PKCS7_verify(p7, x509s, x509st, in, out, flg);
BIO_free(in);
+ if (ok < 0) ossl_raise(ePKCS7Error, NULL);
msg = ERR_reason_error_string(ERR_get_error());
ossl_pkcs7_set_err_string(self, msg ? rb_str_new2(msg) : Qnil);
+ ERR_clear_error();
data = ossl_membio2str(out);
ossl_pkcs7_set_data(self, data);
sk_X509_pop_free(x509s, X509_free);
@@ -749,7 +778,7 @@ ossl_pkcs7_to_der(VALUE self)
if((len = i2d_PKCS7(pkcs7, NULL)) <= 0)
ossl_raise(ePKCS7Error, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_PKCS7(pkcs7, &p) <= 0)
ossl_raise(ePKCS7Error, NULL);
ossl_str_adjust(str, p);
@@ -924,15 +953,12 @@ ossl_pkcs7ri_get_enc_key(VALUE self)
void
Init_ossl_pkcs7()
{
- mPKCS7 = rb_define_module_under(mOSSL, "PKCS7");
-
- ePKCS7Error = rb_define_class_under(mPKCS7, "PKCS7Error", eOSSLError);
-
- cPKCS7 = rb_define_class_under(mPKCS7, "PKCS7", rb_cObject);
- rb_define_singleton_method(mPKCS7, "read_smime", ossl_pkcs7_s_read_smime, 1);
- rb_define_singleton_method(mPKCS7, "write_smime", ossl_pkcs7_s_write_smime, -1);
- rb_define_singleton_method(mPKCS7, "sign", ossl_pkcs7_s_sign, -1);
- rb_define_singleton_method(mPKCS7, "encrypt", ossl_pkcs7_s_encrypt, -1);
+ cPKCS7 = rb_define_class_under(mOSSL, "PKCS7", rb_cObject);
+ ePKCS7Error = rb_define_class_under(cPKCS7, "PKCS7Error", eOSSLError);
+ rb_define_singleton_method(cPKCS7, "read_smime", ossl_pkcs7_s_read_smime, 1);
+ rb_define_singleton_method(cPKCS7, "write_smime", ossl_pkcs7_s_write_smime, -1);
+ rb_define_singleton_method(cPKCS7, "sign", ossl_pkcs7_s_sign, -1);
+ rb_define_singleton_method(cPKCS7, "encrypt", ossl_pkcs7_s_encrypt, -1);
rb_attr(cPKCS7, rb_intern("data"), 1, 0, Qfalse);
rb_attr(cPKCS7, rb_intern("error_string"), 1, 1, Qfalse);
rb_define_alloc_func(cPKCS7, ossl_pkcs7_alloc);
@@ -962,8 +988,8 @@ 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(cPKCS7, "SignerInfo", rb_cObject);
+ rb_define_const(cPKCS7, "Signer", cPKCS7Signer);
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);
@@ -971,14 +997,14 @@ Init_ossl_pkcs7()
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);
+ cPKCS7Recipient = rb_define_class_under(cPKCS7,"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);
-#define DefPKCS7Const(x) rb_define_const(mPKCS7, #x, INT2NUM(PKCS7_##x))
+#define DefPKCS7Const(x) rb_define_const(cPKCS7, #x, INT2NUM(PKCS7_##x))
DefPKCS7Const(TEXT);
DefPKCS7Const(NOCERTS);
diff --git a/ext/openssl/ossl_pkcs7.h b/ext/openssl/ossl_pkcs7.h
index f5942d65db..371c421103 100644
--- a/ext/openssl/ossl_pkcs7.h
+++ b/ext/openssl/ossl_pkcs7.h
@@ -11,7 +11,6 @@
#if !defined(_OSSL_PKCS7_H_)
#define _OSSL_PKCS7_H_
-extern VALUE mPKCS7;
extern VALUE cPKCS7;
extern VALUE cPKCS7Signer;
extern VALUE cPKCS7Recipient;
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index db70333047..b295cfc25e 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -55,6 +55,10 @@ ossl_pkey_new(EVP_PKEY *pkey)
case EVP_PKEY_DH:
return ossl_dh_new(pkey);
#endif
+#if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
+ case EVP_PKEY_EC:
+ return ossl_ec_new(pkey);
+#endif
default:
ossl_raise(ePKeyError, "unsupported key type");
}
@@ -68,7 +72,7 @@ ossl_pkey_new_from_file(VALUE filename)
EVP_PKEY *pkey;
SafeStringValue(filename);
- if (!(fp = fopen(RSTRING(filename)->ptr, "r"))) {
+ if (!(fp = fopen(RSTRING_PTR(filename), "r"))) {
ossl_raise(ePKeyError, "%s", strerror(errno));
}
@@ -108,7 +112,7 @@ EVP_PKEY *
DupPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
-
+
SafeGetPKey(obj, pkey);
CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
@@ -169,13 +173,12 @@ ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
GetPKey(self, pkey);
EVP_SignInit(&ctx, GetDigestPtr(digest));
StringValue(data);
- EVP_SignUpdate(&ctx, RSTRING(data)->ptr, RSTRING(data)->len);
+ EVP_SignUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data));
str = rb_str_new(0, EVP_PKEY_size(pkey)+16);
- if (!EVP_SignFinal(&ctx, RSTRING(str)->ptr, &buf_len, pkey))
+ if (!EVP_SignFinal(&ctx, RSTRING_PTR(str), &buf_len, pkey))
ossl_raise(ePKeyError, NULL);
- assert(buf_len <= RSTRING(str)->len);
- RSTRING(str)->len = buf_len;
- RSTRING(str)->ptr[buf_len] = 0;
+ assert(buf_len <= RSTRING_LEN(str));
+ rb_str_set_len(str, buf_len);
return str;
}
@@ -190,8 +193,8 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
EVP_VerifyInit(&ctx, GetDigestPtr(digest));
StringValue(sig);
StringValue(data);
- EVP_VerifyUpdate(&ctx, RSTRING(data)->ptr, RSTRING(data)->len);
- switch (EVP_VerifyFinal(&ctx, RSTRING(sig)->ptr, RSTRING(sig)->len, pkey)) {
+ EVP_VerifyUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data));
+ switch (EVP_VerifyFinal(&ctx, RSTRING_PTR(sig), RSTRING_LEN(sig), pkey)) {
case 0:
return Qfalse;
case 1:
@@ -208,6 +211,10 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
void
Init_ossl_pkey()
{
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
mPKey = rb_define_module_under(mOSSL, "PKey");
ePKeyError = rb_define_class_under(mPKey, "PKeyError", eOSSLError);
@@ -223,10 +230,11 @@ Init_ossl_pkey()
id_private_q = rb_intern("private?");
/*
- * INIT rsa, dsa
+ * INIT rsa, dsa, dh, ec
*/
Init_ossl_rsa();
Init_ossl_dsa();
Init_ossl_dh();
+ Init_ossl_ec();
}
diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h
index 880a104675..67ff1fddd0 100644
--- a/ext/openssl/ossl_pkey.h
+++ b/ext/openssl/ossl_pkey.h
@@ -77,7 +77,24 @@ extern DH *OSSL_DEFAULT_DH_1024;
VALUE ossl_dh_new(EVP_PKEY *);
void Init_ossl_dh(void);
+/*
+ * EC
+ */
+extern VALUE cEC;
+extern VALUE eECError;
+extern VALUE cEC_GROUP;
+extern VALUE eEC_GROUP;
+extern VALUE cEC_POINT;
+extern VALUE eEC_POINT;
+VALUE ossl_ec_new(EVP_PKEY *);
+void Init_ossl_ec(void);
+
+
#define OSSL_PKEY_BN(keytype, name) \
+/* \
+ * call-seq: \
+ * key.##name -> aBN \
+ */ \
static VALUE ossl_##keytype##_get_##name(VALUE self) \
{ \
EVP_PKEY *pkey; \
@@ -89,6 +106,10 @@ static VALUE ossl_##keytype##_get_##name(VALUE self) \
return Qnil; \
return ossl_bn_new(bn); \
} \
+/* \
+ * call-seq: \
+ * key.##name = bn -> bn \
+ */ \
static VALUE ossl_##keytype##_set_##name(VALUE self, VALUE bignum) \
{ \
EVP_PKEY *pkey; \
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index 5b728ba353..02c3d99ed8 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -99,6 +99,15 @@ dh_generate(int size, int gen)
return dh;
}
+/*
+ * call-seq:
+ * DH.generate(size [, generator]) -> dh
+ *
+ * === Parameters
+ * * +size+ is an integer representing the desired key size. Keys smaller than 1024 should be considered insecure.
+ * * +generator+ is a small number > 1, typically 2 or 5.
+ *
+ */
static VALUE
ossl_dh_s_generate(int argc, VALUE *argv, VALUE klass)
{
@@ -107,9 +116,9 @@ ossl_dh_s_generate(int argc, VALUE *argv, VALUE klass)
VALUE size, gen, obj;
if (rb_scan_args(argc, argv, "11", &size, &gen) == 2) {
- g = FIX2INT(gen);
+ g = NUM2INT(gen);
}
- dh = dh_generate(FIX2INT(size), g);
+ dh = dh_generate(NUM2INT(size), g);
obj = dh_instance(klass, dh);
if (obj == Qfalse) {
DH_free(dh);
@@ -119,6 +128,21 @@ ossl_dh_s_generate(int argc, VALUE *argv, VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * DH.new([size [, generator] | string]) -> dh
+ *
+ * === Parameters
+ * * +size+ is an integer representing the desired key size. Keys smaller than 1024 should be considered insecure.
+ * * +generator+ is a small number > 1, typically 2 or 5.
+ * * +string+ contains the DER or PEM encoded key.
+ *
+ * === Examples
+ * * DH.new -> dh
+ * * DH.new(1024) -> dh
+ * * DH.new(1024, 5) -> dh
+ * * DH.new(File.read('key.pem')) -> dh
+ */
static VALUE
ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -134,7 +158,7 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
}
else if (FIXNUM_P(arg)) {
if (!NIL_P(gen)) {
- g = FIX2INT(gen);
+ g = NUM2INT(gen);
}
if (!(dh = dh_generate(FIX2INT(arg), g))) {
ossl_raise(eDHError, NULL);
@@ -158,19 +182,26 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * dh.public? -> true | false
+ *
+ */
static VALUE
ossl_dh_is_public(VALUE self)
{
EVP_PKEY *pkey;
GetPKeyDH(self, pkey);
- /*
- * Do we need to check dhp->dh->public_pkey?
- * return Qtrue;
- */
+
return (pkey->pkey.dh->pub_key) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * dh.private? -> true | false
+ *
+ */
static VALUE
ossl_dh_is_private(VALUE self)
{
@@ -181,6 +212,11 @@ ossl_dh_is_private(VALUE self)
return (DH_PRIVATE(pkey->pkey.dh)) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * dh.to_pem -> aString
+ *
+ */
static VALUE
ossl_dh_export(VALUE self)
{
@@ -201,6 +237,11 @@ ossl_dh_export(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * dh.to_der -> aString
+ *
+ */
static VALUE
ossl_dh_to_der(VALUE self)
{
@@ -213,7 +254,7 @@ ossl_dh_to_der(VALUE self)
if((len = i2d_DHparams(pkey->pkey.dh, NULL)) <= 0)
ossl_raise(eDHError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_DHparams(pkey->pkey.dh, &p) < 0)
ossl_raise(eDHError, NULL);
ossl_str_adjust(str, p);
@@ -222,6 +263,9 @@ ossl_dh_to_der(VALUE self)
}
/*
+ * call-seq:
+ * dh.params -> hash
+ *
* Stores all parameters of key to the hash
* INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
* Don't use :-)) (I's up to you)
@@ -245,6 +289,9 @@ ossl_dh_get_params(VALUE self)
}
/*
+ * call-seq:
+ * dh.to_text -> aString
+ *
* Prints all parameters of key to buffer
* INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
* Don't use :-)) (I's up to you)
@@ -270,7 +317,10 @@ ossl_dh_to_text(VALUE self)
}
/*
- * Makes new instance DH PUBLIC_KEY from PRIVATE_KEY
+ * call-seq:
+ * dh.public_key -> aDH
+ *
+ * Makes new instance DH PUBLIC_KEY from PRIVATE_KEY
*/
static VALUE
ossl_dh_to_public_key(VALUE self)
@@ -290,6 +340,11 @@ ossl_dh_to_public_key(VALUE self)
return obj;
}
+/*
+ * call-seq:
+ * dh.check_params -> true | false
+ *
+ */
static VALUE
ossl_dh_check_params(VALUE self)
{
@@ -307,6 +362,11 @@ ossl_dh_check_params(VALUE self)
return codes == 0 ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * dh.generate_key -> self
+ *
+ */
static VALUE
ossl_dh_generate_key(VALUE self)
{
@@ -321,6 +381,18 @@ ossl_dh_generate_key(VALUE self)
return self;
}
+/*
+ * call-seq:
+ * dh.compute_key(pub_bn) -> aString
+ *
+ * === Parameters
+ * * +pub_bn+ is a OpenSSL::BN.
+ *
+ * Returns aString containing a shared secret computed from the other parties public value.
+ *
+ * See DH_compute_key() for further information.
+ *
+ */
static VALUE
ossl_dh_compute_key(VALUE self, VALUE pub)
{
@@ -335,11 +407,10 @@ ossl_dh_compute_key(VALUE self, VALUE pub)
pub_key = GetBNPtr(pub);
len = DH_size(dh);
str = rb_str_new(0, len);
- if ((len = DH_compute_key(RSTRING(str)->ptr, pub_key, dh)) < 0) {
+ if ((len = DH_compute_key(RSTRING_PTR(str), pub_key, dh)) < 0) {
ossl_raise(eDHError, NULL);
}
- RSTRING(str)->len = len;
- RSTRING(str)->ptr[len] = 0;
+ rb_str_set_len(str, len);
return str;
}
@@ -367,7 +438,7 @@ static unsigned char DEFAULT_DH_512_PRIM[] = {
};
static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 };
DH *OSSL_DEFAULT_DH_512 = NULL;
-
+
/*
* -----BEGIN DH PARAMETERS-----
* MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ
@@ -406,7 +477,7 @@ ossl_create_dh(unsigned char *p, size_t plen, unsigned char *g, size_t glen)
dh->g = BN_bin2bn(g, glen, NULL);
if (dh->p == NULL || dh->g == NULL){
DH_free(dh);
- ossl_raise(eDHError, NULL);
+ ossl_raise(eDHError, NULL);
}
return dh;
@@ -418,6 +489,11 @@ ossl_create_dh(unsigned char *p, size_t plen, unsigned char *g, size_t glen)
void
Init_ossl_dh()
{
+#if 0 /* let rdoc know about mOSSL and mPKey */
+ mOSSL = rb_define_module("OpenSSL");
+ mPKey = rb_define_module_under(mOSSL, "PKey");
+#endif
+
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);
@@ -448,11 +524,9 @@ Init_ossl_dh()
}
#else /* defined NO_DH */
-# warning >>> OpenSSL is compiled without DH support <<<
void
Init_ossl_dh()
{
- rb_warning("OpenSSL is compiled without DH support");
}
#endif /* NO_DH */
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 39b1902d57..d9c7fcbe78 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -99,10 +99,18 @@ dsa_generate(int size)
return dsa;
}
+/*
+ * call-seq:
+ * DSA.generate(size) -> dsa
+ *
+ * === Parameters
+ * * +size+ is an integer representing the desired key size.
+ *
+ */
static VALUE
ossl_dsa_s_generate(VALUE klass, VALUE size)
{
- DSA *dsa = dsa_generate(FIX2INT(size)); /* err handled by dsa_instance */
+ DSA *dsa = dsa_generate(NUM2INT(size)); /* err handled by dsa_instance */
VALUE obj = dsa_instance(klass, dsa);
if (obj == Qfalse) {
@@ -113,6 +121,22 @@ ossl_dsa_s_generate(VALUE klass, VALUE size)
return obj;
}
+/*
+ * call-seq:
+ * DSA.new([size | string [, pass]) -> dsa
+ *
+ * === Parameters
+ * * +size+ is an integer representing the desired key size.
+ * * +string+ contains a DER or PEM encoded key.
+ * * +pass+ is a string that contains a optional password.
+ *
+ * === Examples
+ * * DSA.new -> dsa
+ * * DSA.new(1024) -> dsa
+ * * DSA.new(File.read('dsa.pem')) -> dsa
+ * * DSA.new(File.read('dsa.pem'), 'mypassword') -> dsa
+ *
+ */
static VALUE
ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -163,6 +187,11 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * dsa.public? -> true | false
+ *
+ */
static VALUE
ossl_dsa_is_public(VALUE self)
{
@@ -170,13 +199,14 @@ ossl_dsa_is_public(VALUE self)
GetPKeyDSA(self, pkey);
- /*
- * Do we need to check dsap->dsa->public_pkey?
- * return Qtrue;
- */
return (pkey->pkey.dsa->pub_key) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * dsa.private? -> true | false
+ *
+ */
static VALUE
ossl_dsa_is_private(VALUE self)
{
@@ -187,6 +217,19 @@ ossl_dsa_is_private(VALUE self)
return (DSA_PRIVATE(self, pkey->pkey.dsa)) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * dsa.to_pem([cipher, password]) -> aString
+ *
+ * === Parameters
+ * +cipher+ is an OpenSSL::Cipher.
+ * +password+ is a string containing your password.
+ *
+ * === Examples
+ * * DSA.to_pem -> aString
+ * * DSA.to_pem(cipher, 'mypassword') -> aString
+ *
+ */
static VALUE
ossl_dsa_export(int argc, VALUE *argv, VALUE self)
{
@@ -224,6 +267,11 @@ ossl_dsa_export(int argc, VALUE *argv, VALUE self)
return str;
}
+/*
+ * call-seq:
+ * dsa.to_der -> aString
+ *
+ */
static VALUE
ossl_dsa_to_der(VALUE self)
{
@@ -241,7 +289,7 @@ ossl_dsa_to_der(VALUE self)
if((len = i2d_func(pkey->pkey.dsa, NULL)) <= 0)
ossl_raise(eDSAError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_func(pkey->pkey.dsa, &p) < 0)
ossl_raise(eDSAError, NULL);
ossl_str_adjust(str, p);
@@ -250,6 +298,9 @@ ossl_dsa_to_der(VALUE self)
}
/*
+ * call-seq:
+ * dsa.params -> hash
+ *
* Stores all parameters of key to the hash
* INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
* Don't use :-)) (I's up to you)
@@ -274,6 +325,9 @@ ossl_dsa_get_params(VALUE self)
}
/*
+ * call-seq:
+ * dsa.to_text -> aString
+ *
* Prints all parameters of key to buffer
* INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
* Don't use :-)) (I's up to you)
@@ -299,6 +353,9 @@ ossl_dsa_to_text(VALUE self)
}
/*
+ * call-seq:
+ * dsa.public_key -> aDSA
+ *
* Makes new instance DSA PUBLIC_KEY from PRIVATE_KEY
*/
static VALUE
@@ -321,6 +378,11 @@ ossl_dsa_to_public_key(VALUE self)
#define ossl_dsa_buf_size(pkey) (DSA_size((pkey)->pkey.dsa)+16)
+/*
+ * call-seq:
+ * dsa.syssign(string) -> aString
+ *
+ */
static VALUE
ossl_dsa_sign(VALUE self, VALUE data)
{
@@ -334,16 +396,20 @@ ossl_dsa_sign(VALUE self, VALUE data)
ossl_raise(eDSAError, "Private DSA key needed!");
}
str = rb_str_new(0, ossl_dsa_buf_size(pkey));
- if (!DSA_sign(0, RSTRING(data)->ptr, RSTRING(data)->len, RSTRING(str)->ptr,
+ if (!DSA_sign(0, RSTRING_PTR(data), RSTRING_LEN(data), RSTRING_PTR(str),
&buf_len, pkey->pkey.dsa)) { /* type is ignored (0) */
ossl_raise(eDSAError, NULL);
}
- RSTRING(str)->len = buf_len;
- RSTRING(str)->ptr[buf_len] = 0;
+ rb_str_set_len(str, buf_len);
return str;
}
+/*
+ * call-seq:
+ * dsa.sysverify(digest, sig) -> true | false
+ *
+ */
static VALUE
ossl_dsa_verify(VALUE self, VALUE digest, VALUE sig)
{
@@ -354,8 +420,8 @@ ossl_dsa_verify(VALUE self, VALUE digest, VALUE sig)
StringValue(digest);
StringValue(sig);
/* type is ignored (0) */
- ret = DSA_verify(0, RSTRING(digest)->ptr, RSTRING(digest)->len,
- RSTRING(sig)->ptr, RSTRING(sig)->len, pkey->pkey.dsa);
+ ret = DSA_verify(0, RSTRING_PTR(digest), RSTRING_LEN(digest),
+ RSTRING_PTR(sig), RSTRING_LEN(sig), pkey->pkey.dsa);
if (ret < 0) {
ossl_raise(eDSAError, NULL);
}
@@ -378,6 +444,11 @@ OSSL_PKEY_BN(dsa, priv_key);
void
Init_ossl_dsa()
{
+#if 0 /* let rdoc know about mOSSL and mPKey */
+ mOSSL = rb_define_module("OpenSSL");
+ mPKey = rb_define_module_under(mOSSL, "PKey");
+#endif
+
eDSAError = rb_define_class_under(mPKey, "DSAError", ePKeyError);
cDSA = rb_define_class_under(mPKey, "DSA", cPKey);
@@ -406,12 +477,8 @@ Init_ossl_dsa()
}
#else /* defined NO_DSA */
-# warning >>> OpenSSL is compiled without DSA support <<<
-
void
Init_ossl_dsa()
{
- rb_warning("OpenSSL is compiled without DSA support");
}
-
#endif /* NO_DSA */
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
new file mode 100644
index 0000000000..210054121d
--- /dev/null
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -0,0 +1,1582 @@
+/*
+ * Copyright (C) 2006-2007 Technorama Ltd. <oss-ruby@technorama.net>
+ */
+
+#include "ossl.h"
+
+#if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
+
+typedef struct {
+ EC_GROUP *group;
+ int dont_free;
+} ossl_ec_group;
+
+typedef struct {
+ EC_POINT *point;
+ int dont_free;
+} ossl_ec_point;
+
+
+#define EXPORT_PEM 0
+#define EXPORT_DER 1
+
+
+#define GetPKeyEC(obj, pkey) do { \
+ GetPKey(obj, pkey); \
+ if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) { \
+ ossl_raise(rb_eRuntimeError, "THIS IS NOT A EC PKEY!"); \
+ } \
+} while (0)
+
+#define SafeGet_ec_group(obj, group) do { \
+ OSSL_Check_Kind(obj, cEC_GROUP); \
+ Data_Get_Struct(obj, ossl_ec_group, group); \
+} while(0)
+
+#define Get_EC_KEY(obj, key) do { \
+ EVP_PKEY *pkey; \
+ GetPKeyEC(obj, pkey); \
+ key = pkey->pkey.ec; \
+} while(0)
+
+#define Require_EC_KEY(obj, key) do { \
+ Get_EC_KEY(obj, key); \
+ if (key == NULL) \
+ rb_raise(eECError, "EC_KEY is not initialized"); \
+} while(0)
+
+#define SafeRequire_EC_KEY(obj, key) do { \
+ OSSL_Check_Kind(obj, cEC); \
+ Require_EC_KEY(obj, key); \
+} while (0)
+
+#define Get_EC_GROUP(obj, g) do { \
+ ossl_ec_group *ec_group; \
+ Data_Get_Struct(obj, ossl_ec_group, ec_group); \
+ if (ec_group == NULL) \
+ rb_raise(eEC_GROUP, "missing ossl_ec_group structure"); \
+ g = ec_group->group; \
+} while(0)
+
+#define Require_EC_GROUP(obj, group) do { \
+ Get_EC_GROUP(obj, group); \
+ if (group == NULL) \
+ rb_raise(eEC_GROUP, "EC_GROUP is not initialized"); \
+} while(0)
+
+#define SafeRequire_EC_GROUP(obj, group) do { \
+ OSSL_Check_Kind(obj, cEC_GROUP); \
+ Require_EC_GROUP(obj, group); \
+} while(0)
+
+#define Get_EC_POINT(obj, p) do { \
+ ossl_ec_point *ec_point; \
+ Data_Get_Struct(obj, ossl_ec_point, ec_point); \
+ if (ec_point == NULL) \
+ rb_raise(eEC_POINT, "missing ossl_ec_point structure"); \
+ p = ec_point->point; \
+} while(0)
+
+#define Require_EC_POINT(obj, point) do { \
+ Get_EC_POINT(obj, point); \
+ if (point == NULL) \
+ rb_raise(eEC_POINT, "EC_POINT is not initialized"); \
+} while(0)
+
+#define SafeRequire_EC_POINT(obj, point) do { \
+ OSSL_Check_Kind(obj, cEC_POINT); \
+ Require_EC_POINT(obj, point); \
+} while(0)
+
+VALUE cEC;
+VALUE eECError;
+VALUE cEC_GROUP;
+VALUE eEC_GROUP;
+VALUE cEC_POINT;
+VALUE eEC_POINT;
+
+static ID s_GFp;
+static ID s_GFp_simple;
+static ID s_GFp_mont;
+static ID s_GFp_nist;
+static ID s_GF2m;
+static ID s_GF2m_simple;
+
+static ID ID_uncompressed;
+static ID ID_compressed;
+static ID ID_hybrid;
+
+static VALUE ec_instance(VALUE klass, EC_KEY *ec)
+{
+ EVP_PKEY *pkey;
+ VALUE obj;
+
+ if (!ec) {
+ return Qfalse;
+ }
+ if (!(pkey = EVP_PKEY_new())) {
+ return Qfalse;
+ }
+ if (!EVP_PKEY_assign_EC_KEY(pkey, ec)) {
+ EVP_PKEY_free(pkey);
+ return Qfalse;
+ }
+ WrapPKey(klass, obj, pkey);
+
+ return obj;
+}
+
+VALUE ossl_ec_new(EVP_PKEY *pkey)
+{
+ VALUE obj;
+
+ if (!pkey) {
+ obj = ec_instance(cEC, EC_KEY_new());
+ } else {
+ if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) {
+ ossl_raise(rb_eTypeError, "Not a EC key!");
+ }
+ WrapPKey(cEC, obj, pkey);
+ }
+ if (obj == Qfalse) {
+ ossl_raise(eECError, NULL);
+ }
+
+ return obj;
+}
+
+
+/* call-seq:
+ * OpenSSL::PKey::EC.new()
+ * OpenSSL::PKey::EC.new(ec_key)
+ * OpenSSL::PKey::EC.new(ec_group)
+ * OpenSSL::PKey::EC.new("secp112r1")
+ * OpenSSL::PKey::EC.new(pem_string)
+ * OpenSSL::PKey::EC.new(der_string)
+ *
+ * See the OpenSSL documentation for:
+ * EC_KEY_*
+ */
+static VALUE ossl_ec_key_initialize(int argc, VALUE *argv, VALUE self)
+{
+ EVP_PKEY *pkey;
+ EC_KEY *ec = NULL;
+ VALUE arg, pass;
+ VALUE group = Qnil;
+
+ GetPKey(self, pkey);
+ if (pkey->pkey.ec)
+ rb_raise(eECError, "EC_KEY already initialized");
+
+ rb_scan_args(argc, argv, "02", &arg, &pass);
+
+ if (NIL_P(arg)) {
+ ec = EC_KEY_new();
+ } else {
+ if (rb_obj_is_kind_of(arg, cEC)) {
+ EC_KEY *other_ec = NULL;
+
+ SafeRequire_EC_KEY(arg, other_ec);
+ ec = EC_KEY_dup(other_ec);
+ } else if (rb_obj_is_kind_of(arg, cEC_GROUP)) {
+ ec = EC_KEY_new();
+ group = arg;
+ } else {
+ BIO *in = ossl_obj2bio(arg);
+
+ ec = PEM_read_bio_ECPrivateKey(in, NULL, NULL, NULL);
+ if (!ec) {
+ BIO_reset(in);
+ ec = PEM_read_bio_EC_PUBKEY(in, NULL, NULL, NULL);
+ }
+ if (!ec) {
+ BIO_reset(in);
+ ec = d2i_ECPrivateKey_bio(in, NULL);
+ }
+ if (!ec) {
+ BIO_reset(in);
+ ec = d2i_EC_PUBKEY_bio(in, NULL);
+ }
+
+ BIO_free(in);
+
+ if (ec == NULL) {
+ const char *name = STR2CSTR(arg);
+ int nid = OBJ_sn2nid(name);
+
+ if (nid == NID_undef)
+ ossl_raise(eECError, "unknown curve name (%s)\n", name);
+
+ if ((ec = EC_KEY_new_by_curve_name(nid)) == NULL)
+ ossl_raise(eECError, "unable to create curve (%s)\n", name);
+
+ EC_KEY_set_asn1_flag(ec, OPENSSL_EC_NAMED_CURVE);
+ EC_KEY_set_conv_form(ec, POINT_CONVERSION_UNCOMPRESSED);
+ }
+ }
+ }
+
+ if (ec == NULL)
+ ossl_raise(eECError, NULL);
+
+ if (!EVP_PKEY_assign_EC_KEY(pkey, ec)) {
+ EC_KEY_free(ec);
+ ossl_raise(eECError, "EVP_PKEY_assign_EC_KEY");
+ }
+
+ rb_iv_set(self, "@group", Qnil);
+
+ if (!NIL_P(group))
+ rb_funcall(self, rb_intern("group="), 1, arg);
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * key.group => group
+ *
+ * Returns a constant <code>OpenSSL::EC::Group</code> that is tied to the key.
+ * Modifying the returned group can make the key invalid.
+ */
+static VALUE ossl_ec_key_get_group(VALUE self)
+{
+ VALUE group_v;
+ EC_KEY *ec;
+ ossl_ec_group *ec_group;
+ EC_GROUP *group;
+
+ Require_EC_KEY(self, ec);
+
+ group_v = rb_iv_get(self, "@group");
+ if (!NIL_P(group_v))
+ return group_v;
+
+ if ((group = (EC_GROUP *)EC_KEY_get0_group(ec)) != NULL) {
+ group_v = rb_obj_alloc(cEC_GROUP);
+ SafeGet_ec_group(group_v, ec_group);
+ ec_group->group = group;
+ ec_group->dont_free = 1;
+ rb_iv_set(group_v, "@key", self);
+ rb_iv_set(self, "@group", group_v);
+ return group_v;
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * key.group = group => group
+ *
+ * Returns the same object passed, not the group object associated with the key.
+ * If you wish to access the group object tied to the key call key.group after setting
+ * the group.
+ *
+ * Setting the group will immediately destroy any previously assigned group object.
+ * The group is internally copied by OpenSSL. Modifying the original group after
+ * assignment will not effect the internal key structure.
+ * (your changes may be lost). BE CAREFUL.
+ *
+ * EC_KEY_set_group calls EC_GROUP_free(key->group) then EC_GROUP_dup(), not EC_GROUP_copy.
+ * This documentation is accurate for OpenSSL 0.9.8b.
+ */
+static VALUE ossl_ec_key_set_group(VALUE self, VALUE group_v)
+{
+ VALUE old_group_v;
+ EC_KEY *ec;
+ EC_GROUP *group;
+
+ Require_EC_KEY(self, ec);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ old_group_v = rb_iv_get(self, "@group");
+ if (!NIL_P(old_group_v)) {
+ ossl_ec_group *old_ec_group;
+ SafeGet_ec_group(old_group_v, old_ec_group);
+
+ old_ec_group->group = NULL;
+ old_ec_group->dont_free = 0;
+ rb_iv_set(old_group_v, "@key", Qnil);
+ }
+
+ rb_iv_set(self, "@group", Qnil);
+
+ if (EC_KEY_set_group(ec, group) != 1)
+ ossl_raise(eECError, "EC_KEY_set_group");
+
+ return group_v;
+}
+
+/*
+ * call-seq:
+ * key.private_key => OpenSSL::BN
+ *
+ * See the OpenSSL documentation for EC_KEY_get0_private_key()
+ */
+static VALUE ossl_ec_key_get_private_key(VALUE self)
+{
+ EC_KEY *ec;
+ const BIGNUM *bn;
+
+ Require_EC_KEY(self, ec);
+
+ if ((bn = EC_KEY_get0_private_key(ec)) == NULL)
+ return Qnil;
+
+ return ossl_bn_new(bn);
+}
+
+/*
+ * call-seq:
+ * key.private_key = openssl_bn
+ *
+ * See the OpenSSL documentation for EC_KEY_set_private_key()
+ */
+static VALUE ossl_ec_key_set_private_key(VALUE self, VALUE private_key)
+{
+ EC_KEY *ec;
+ BIGNUM *bn = NULL;
+
+ Require_EC_KEY(self, ec);
+ if (!NIL_P(private_key))
+ bn = GetBNPtr(private_key);
+
+ switch (EC_KEY_set_private_key(ec, bn)) {
+ case 1:
+ break;
+ case 0:
+ if (bn == NULL)
+ break;
+ default:
+ ossl_raise(eECError, "EC_KEY_set_private_key");
+ }
+
+ return private_key;
+}
+
+
+static VALUE ossl_ec_point_dup(const EC_POINT *point, VALUE group_v)
+{
+ VALUE obj;
+ const EC_GROUP *group;
+ ossl_ec_point *new_point;
+
+ obj = rb_obj_alloc(cEC_POINT);
+ Data_Get_Struct(obj, ossl_ec_point, new_point);
+
+ SafeRequire_EC_GROUP(group_v, group);
+
+ new_point->point = EC_POINT_dup(point, group);
+ if (new_point->point == NULL)
+ ossl_raise(eEC_POINT, "EC_POINT_dup");
+ rb_iv_set(obj, "@group", group_v);
+
+ return obj;
+}
+
+/*
+ * call-seq:
+ * key.public_key => OpenSSL::PKey::EC::Point
+ *
+ * See the OpenSSL documentation for EC_KEY_get0_public_key()
+ */
+static VALUE ossl_ec_key_get_public_key(VALUE self)
+{
+ EC_KEY *ec;
+ const EC_POINT *point;
+ VALUE group;
+
+ Require_EC_KEY(self, ec);
+
+ if ((point = EC_KEY_get0_public_key(ec)) == NULL)
+ return Qnil;
+
+ group = rb_funcall(self, rb_intern("group"), 0);
+ if (NIL_P(group))
+ ossl_raise(eECError, "EC_KEY_get0_get0_group (has public_key but no group???");
+
+ return ossl_ec_point_dup(point, group);
+}
+
+/*
+ * call-seq:
+ * key.public_key = ec_point
+ *
+ * See the OpenSSL documentation for EC_KEY_set_public_key()
+ */
+static VALUE ossl_ec_key_set_public_key(VALUE self, VALUE public_key)
+{
+ EC_KEY *ec;
+ EC_POINT *point = NULL;
+
+ Require_EC_KEY(self, ec);
+ if (!NIL_P(public_key))
+ SafeRequire_EC_POINT(public_key, point);
+
+ switch (EC_KEY_set_public_key(ec, point)) {
+ case 1:
+ break;
+ case 0:
+ if (point == NULL)
+ break;
+ default:
+ ossl_raise(eECError, "EC_KEY_set_public_key");
+ }
+
+ return public_key;
+}
+
+/*
+ * call-seq:
+ * key.public_key? => true or false
+ *
+ * Both public_key? and private_key? may return false at the same time unlike other PKey classes.
+ */
+static VALUE ossl_ec_key_is_public_key(VALUE self)
+{
+ EC_KEY *ec;
+
+ Require_EC_KEY(self, ec);
+
+ return (EC_KEY_get0_public_key(ec) ? Qtrue : Qfalse);
+}
+
+/*
+ * call-seq:
+ * key.private_key? => true or false
+ *
+ * Both public_key? and private_key? may return false at the same time unlike other PKey classes.
+ */
+static VALUE ossl_ec_key_is_private_key(VALUE self)
+{
+ EC_KEY *ec;
+
+ Require_EC_KEY(self, ec);
+
+ return (EC_KEY_get0_private_key(ec) ? Qtrue : Qfalse);
+}
+
+static VALUE ossl_ec_key_to_string(VALUE self, int format)
+{
+ EC_KEY *ec;
+ BIO *out;
+ int i = -1;
+ int private = 0;
+ EVP_CIPHER *cipher = NULL;
+ char *password = NULL;
+ VALUE str;
+
+ Require_EC_KEY(self, ec);
+
+ if (EC_KEY_get0_public_key(ec) == NULL)
+ rb_raise(eECError, "can't export - no public key set");
+
+ if (EC_KEY_check_key(ec) != 1)
+ ossl_raise(eECError, "can't export - EC_KEY_check_key failed");
+
+ if (EC_KEY_get0_private_key(ec))
+ private = 1;
+
+ if (!(out = BIO_new(BIO_s_mem())))
+ ossl_raise(eECError, "BIO_new(BIO_s_mem())");
+
+ switch(format) {
+ case EXPORT_PEM:
+ if (private) {
+ if (cipher || password)
+/* BUG: finish cipher/password key export */
+ rb_notimplement();
+ i = PEM_write_bio_ECPrivateKey(out, ec, cipher, NULL, 0, NULL, password);
+ } else {
+ if (cipher || password)
+ rb_raise(rb_eArgError, "encryption is not supported when exporting this key type");
+
+ i = PEM_write_bio_EC_PUBKEY(out, ec);
+ }
+
+ break;
+ case EXPORT_DER:
+ if (private) {
+ if (cipher || password)
+ rb_raise(rb_eArgError, "encryption is not supported when exporting this key type");
+
+ i = i2d_ECPrivateKey_bio(out, ec);
+ } else {
+ if (cipher || password)
+ rb_raise(rb_eArgError, "encryption is not supported when exporting this key type");
+
+ i = i2d_EC_PUBKEY_bio(out, ec);
+ }
+
+ break;
+ default:
+ BIO_free(out);
+ rb_raise(rb_eRuntimeError, "unknown format (internal error)");
+ }
+
+ if (i != 1) {
+ BIO_free(out);
+ ossl_raise(eECError, "outlen=%d", i);
+ }
+
+ str = ossl_membio2str(out);
+
+ return str;
+}
+
+/*
+ * call-seq:
+ * key.to_pem => String
+ *
+ * See the OpenSSL documentation for PEM_write_bio_ECPrivateKey()
+ */
+static VALUE ossl_ec_key_to_pem(VALUE self)
+{
+ return ossl_ec_key_to_string(self, EXPORT_PEM);
+}
+
+/*
+ * call-seq:
+ * key.to_der => String
+ *
+ * See the OpenSSL documentation for i2d_ECPrivateKey_bio()
+ */
+static VALUE ossl_ec_key_to_der(VALUE self)
+{
+ return ossl_ec_key_to_string(self, EXPORT_DER);
+}
+
+/*
+ * call-seq:
+ * key.to_text => String
+ *
+ * See the OpenSSL documentation for EC_KEY_print()
+ */
+static VALUE ossl_ec_key_to_text(VALUE self)
+{
+ EC_KEY *ec;
+ BIO *out;
+ VALUE str;
+
+ Require_EC_KEY(self, ec);
+ if (!(out = BIO_new(BIO_s_mem()))) {
+ ossl_raise(eECError, "BIO_new(BIO_s_mem())");
+ }
+ if (!EC_KEY_print(out, ec, 0)) {
+ BIO_free(out);
+ ossl_raise(eECError, "EC_KEY_print");
+ }
+ str = ossl_membio2str(out);
+
+ return str;
+}
+
+/*
+ * call-seq:
+ * key.generate_key => self
+ *
+ * See the OpenSSL documentation for EC_KEY_generate_key()
+ */
+static VALUE ossl_ec_key_generate_key(VALUE self)
+{
+ EC_KEY *ec;
+
+ Require_EC_KEY(self, ec);
+
+ if (EC_KEY_generate_key(ec) != 1)
+ ossl_raise(eECError, "EC_KEY_generate_key");
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * key.check_key => true
+ *
+ * Raises an exception if the key is invalid.
+ *
+ * See the OpenSSL documentation for EC_KEY_check_key()
+ */
+static VALUE ossl_ec_key_check_key(VALUE self)
+{
+ EC_KEY *ec;
+
+ Require_EC_KEY(self, ec);
+
+ if (EC_KEY_check_key(ec) != 1)
+ ossl_raise(eECError, "EC_KEY_check_key");
+
+ return Qtrue;
+}
+
+/*
+ * call-seq:
+ * key.dh_compute_key(pubkey) => String
+ *
+ * See the OpenSSL documentation for ECDH_compute_key()
+ */
+static VALUE ossl_ec_key_dh_compute_key(VALUE self, VALUE pubkey)
+{
+ EC_KEY *ec;
+ EC_POINT *point;
+ int buf_len;
+ VALUE str;
+
+ Require_EC_KEY(self, ec);
+ SafeRequire_EC_POINT(pubkey, point);
+
+/* BUG: need a way to figure out the maximum string size */
+ buf_len = 1024;
+ str = rb_str_new(0, buf_len);
+/* BUG: take KDF as a block */
+ buf_len = ECDH_compute_key(RSTRING_PTR(str), buf_len, point, ec, NULL);
+ if (buf_len < 0)
+ ossl_raise(eECError, "ECDH_compute_key");
+
+ rb_str_resize(str, buf_len);
+
+ return str;
+}
+
+/* sign_setup */
+
+/*
+ * call-seq:
+ * key.dsa_sign_asn1(data) => String
+ *
+ * See the OpenSSL documentation for ECDSA_sign()
+ */
+static VALUE ossl_ec_key_dsa_sign_asn1(VALUE self, VALUE data)
+{
+ EC_KEY *ec;
+ unsigned int buf_len;
+ VALUE str;
+
+ Require_EC_KEY(self, ec);
+ StringValue(data);
+
+ if (EC_KEY_get0_private_key(ec) == NULL)
+ ossl_raise(eECError, "Private EC key needed!");
+
+ str = rb_str_new(0, ECDSA_size(ec) + 16);
+ if (ECDSA_sign(0, (unsigned char *) RSTRING_PTR(data), RSTRING_LEN(data), (unsigned char *) RSTRING_PTR(str), &buf_len, ec) != 1)
+ ossl_raise(eECError, "ECDSA_sign");
+
+ rb_str_resize(str, buf_len);
+
+ return str;
+}
+
+/*
+ * call-seq:
+ * key.dsa_verify(data, sig) => true or false
+ *
+ * See the OpenSSL documentation for ECDSA_verify()
+ */
+static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig)
+{
+ EC_KEY *ec;
+
+ Require_EC_KEY(self, ec);
+ StringValue(data);
+ StringValue(sig);
+
+ switch (ECDSA_verify(0, (unsigned char *) RSTRING_PTR(data), RSTRING_LEN(data), (unsigned char *) RSTRING_PTR(sig), RSTRING_LEN(sig), ec)) {
+ case 1: return Qtrue;
+ case 0: return Qfalse;
+ default: break;
+ }
+
+ ossl_raise(eECError, "ECDSA_verify");
+}
+
+static void ossl_ec_group_free(ossl_ec_group *ec_group)
+{
+ if (!ec_group->dont_free && ec_group->group)
+ EC_GROUP_clear_free(ec_group->group);
+ free(ec_group);
+}
+
+static VALUE ossl_ec_group_alloc(VALUE klass)
+{
+ ossl_ec_group *ec_group;
+ VALUE obj;
+
+ obj = Data_Make_Struct(klass, ossl_ec_group, 0, ossl_ec_group_free, ec_group);
+
+ return obj;
+}
+
+/* call-seq:
+ * OpenSSL::PKey::EC::Group.new("secp112r1")
+ * OpenSSL::PKey::EC::Group.new(ec_group)
+ * OpenSSL::PKey::EC::Group.new(pem_string)
+ * OpenSSL::PKey::EC::Group.new(der_string)
+ * OpenSSL::PKey::EC::Group.new(pem_file)
+ * OpenSSL::PKey::EC::Group.new(der_file)
+ * OpenSSL::PKey::EC::Group.new(:GFp_simple)
+ * OpenSSL::PKey::EC::Group.new(:GFp_mult)
+ * OpenSSL::PKey::EC::Group.new(:GFp_nist)
+ * OpenSSL::PKey::EC::Group.new(:GF2m_simple)
+ * OpenSSL::PKey::EC::Group.new(:GFp, bignum_p, bignum_a, bignum_b)
+ * OpenSSL::PKey::EC::Group.new(:GF2m, bignum_p, bignum_a, bignum_b)
+ *
+ * See the OpenSSL documentation for EC_GROUP_*
+ */
+static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
+{
+ VALUE arg1, arg2, arg3, arg4;
+ ossl_ec_group *ec_group;
+ EC_GROUP *group = NULL;
+
+ Data_Get_Struct(self, ossl_ec_group, ec_group);
+ if (ec_group->group != NULL)
+ rb_raise(rb_eRuntimeError, "EC_GROUP is already initialized");
+
+ switch (rb_scan_args(argc, argv, "13", &arg1, &arg2, &arg3, &arg4)) {
+ case 1:
+ if (SYMBOL_P(arg1)) {
+ const EC_METHOD *method = NULL;
+ ID id = SYM2ID(arg1);
+
+ if (id == s_GFp_simple) {
+ method = EC_GFp_simple_method();
+ } else if (id == s_GFp_mont) {
+ method = EC_GFp_mont_method();
+ } else if (id == s_GFp_nist) {
+ method = EC_GFp_nist_method();
+ } else if (id == s_GF2m_simple) {
+ method = EC_GF2m_simple_method();
+ }
+
+ if (method) {
+ if ((group = EC_GROUP_new(method)) == NULL)
+ ossl_raise(eEC_GROUP, "EC_GROUP_new");
+ } else {
+ rb_raise(rb_eArgError, "unknown symbol, must be :GFp_simple, :GFp_mont, :GFp_nist or :GF2m_simple");
+ }
+ } else if (rb_obj_is_kind_of(arg1, cEC_GROUP)) {
+ const EC_GROUP *arg1_group;
+
+ SafeRequire_EC_GROUP(arg1, arg1_group);
+ if ((group = EC_GROUP_dup(arg1_group)) == NULL)
+ ossl_raise(eEC_GROUP, "EC_GROUP_dup");
+ } else {
+ BIO *in = ossl_obj2bio(arg1);
+
+ group = PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL);
+ if (!group) {
+ BIO_reset(in);
+ group = d2i_ECPKParameters_bio(in, NULL);
+ }
+
+ BIO_free(in);
+
+ if (!group) {
+ const char *name = STR2CSTR(arg1);
+ int nid = OBJ_sn2nid(name);
+
+ if (nid == NID_undef)
+ ossl_raise(eEC_GROUP, "unknown curve name (%s)", name);
+
+ group = EC_GROUP_new_by_curve_name(nid);
+ if (group == NULL)
+ ossl_raise(eEC_GROUP, "unable to create curve (%s)", name);
+
+ EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
+ EC_GROUP_set_point_conversion_form(group, POINT_CONVERSION_UNCOMPRESSED);
+ }
+ }
+
+ break;
+ case 4:
+ if (SYMBOL_P(arg1)) {
+ ID id = SYM2ID(arg1);
+ EC_GROUP *(*new_curve)(const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *) = NULL;
+ const BIGNUM *p = GetBNPtr(arg2);
+ const BIGNUM *a = GetBNPtr(arg3);
+ const BIGNUM *b = GetBNPtr(arg4);
+
+ if (id == s_GFp) {
+ new_curve = EC_GROUP_new_curve_GFp;
+ } else if (id == s_GF2m) {
+ new_curve = EC_GROUP_new_curve_GF2m;
+ } else {
+ rb_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
+ }
+
+ if ((group = new_curve(p, a, b, ossl_bn_ctx)) == NULL)
+ ossl_raise(eEC_GROUP, "EC_GROUP_new_by_GF*");
+ } else {
+ rb_raise(rb_eArgError, "unknown argument, must be :GFp or :GF2m");
+ }
+
+ break;
+ default:
+ rb_raise(rb_eArgError, "wrong number of arguments");
+ }
+
+ if (group == NULL)
+ ossl_raise(eEC_GROUP, "");
+
+ ec_group->group = group;
+
+ return self;
+}
+
+/* call-seq:
+ * group1 == group2 => true | false
+ *
+ */
+static VALUE ossl_ec_group_eql(VALUE a, VALUE b)
+{
+ EC_GROUP *group1 = NULL, *group2 = NULL;
+
+ Require_EC_GROUP(a, group1);
+ SafeRequire_EC_GROUP(b, group2);
+
+ if (EC_GROUP_cmp(group1, group2, ossl_bn_ctx) == 1)
+ return Qfalse;
+
+ return Qtrue;
+}
+
+/* call-seq:
+ * group.generator => ec_point
+ *
+ * See the OpenSSL documentation for EC_GROUP_get0_generator()
+ */
+static VALUE ossl_ec_group_get_generator(VALUE self)
+{
+ VALUE point_obj;
+ EC_GROUP *group = NULL;
+
+ Require_EC_GROUP(self, group);
+
+ point_obj = ossl_ec_point_dup(EC_GROUP_get0_generator(group), self);
+
+ return point_obj;
+}
+
+/* call-seq:
+ * group.set_generator(generator, order, cofactor) => self
+ *
+ * See the OpenSSL documentation for EC_GROUP_set_generator()
+ */
+static VALUE ossl_ec_group_set_generator(VALUE self, VALUE generator, VALUE order, VALUE cofactor)
+{
+ EC_GROUP *group = NULL;
+ const EC_POINT *point;
+ const BIGNUM *o, *co;
+
+ Require_EC_GROUP(self, group);
+ SafeRequire_EC_POINT(generator, point);
+ o = GetBNPtr(order);
+ co = GetBNPtr(cofactor);
+
+ if (EC_GROUP_set_generator(group, point, o, co) != 1)
+ ossl_raise(eEC_GROUP, "EC_GROUP_set_generator");
+
+ return self;
+}
+
+/* call-seq:
+ * group.get_order => order_bn
+ *
+ * See the OpenSSL documentation for EC_GROUP_get_order()
+ */
+static VALUE ossl_ec_group_get_order(VALUE self)
+{
+ VALUE bn_obj;
+ BIGNUM *bn;
+ EC_GROUP *group = NULL;
+
+ Require_EC_GROUP(self, group);
+
+ bn_obj = ossl_bn_new(NULL);
+ bn = GetBNPtr(bn_obj);
+
+ if (EC_GROUP_get_order(group, bn, ossl_bn_ctx) != 1)
+ ossl_raise(eEC_GROUP, "EC_GROUP_get_order");
+
+ return bn_obj;
+}
+
+/* call-seq:
+ * group.get_cofactor => cofactor_bn
+ *
+ * See the OpenSSL documentation for EC_GROUP_get_cofactor()
+ */
+static VALUE ossl_ec_group_get_cofactor(VALUE self)
+{
+ VALUE bn_obj;
+ BIGNUM *bn;
+ EC_GROUP *group = NULL;
+
+ Require_EC_GROUP(self, group);
+
+ bn_obj = ossl_bn_new(NULL);
+ bn = GetBNPtr(bn_obj);
+
+ if (EC_GROUP_get_cofactor(group, bn, ossl_bn_ctx) != 1)
+ ossl_raise(eEC_GROUP, "EC_GROUP_get_cofactor");
+
+ return bn_obj;
+}
+
+/* call-seq:
+ * group.curve_name => String
+ *
+ * See the OpenSSL documentation for EC_GROUP_get_curve_name()
+ */
+static VALUE ossl_ec_group_get_curve_name(VALUE self)
+{
+ EC_GROUP *group = NULL;
+ int nid;
+
+ Get_EC_GROUP(self, group);
+ if (group == NULL)
+ return Qnil;
+
+ nid = EC_GROUP_get_curve_name(group);
+
+/* BUG: an nid or asn1 object should be returned, maybe. */
+ return rb_str_new2(OBJ_nid2sn(nid));
+}
+
+/* call-seq:
+ * EC.builtin_curves => [[name, comment], ...]
+ *
+ * See the OpenSSL documentation for EC_builtin_curves()
+ */
+static VALUE ossl_s_builtin_curves(VALUE self)
+{
+ EC_builtin_curve *curves = NULL;
+ int n;
+ int crv_len = EC_get_builtin_curves(NULL, 0);
+ VALUE ary, ret;
+
+ curves = ALLOCA_N(EC_builtin_curve, crv_len);
+ if (curves == NULL)
+ return Qnil;
+ if (!EC_get_builtin_curves(curves, crv_len))
+ ossl_raise(rb_eRuntimeError, "EC_get_builtin_curves");
+
+ ret = rb_ary_new2(crv_len);
+
+ for (n = 0; n < crv_len; n++) {
+ const char *sname = OBJ_nid2sn(curves[n].nid);
+ const char *comment = curves[n].comment;
+
+ ary = rb_ary_new2(2);
+ rb_ary_push(ary, rb_str_new2(sname));
+ rb_ary_push(ary, comment ? rb_str_new2(comment) : Qnil);
+ rb_ary_push(ret, ary);
+ }
+
+ return ret;
+}
+
+/* call-seq:
+ * group.asn1_flag => Fixnum
+ *
+ * See the OpenSSL documentation for EC_GROUP_get_asn1_flag()
+ */
+static VALUE ossl_ec_group_get_asn1_flag(VALUE self)
+{
+ EC_GROUP *group = NULL;
+ int flag;
+
+ Require_EC_GROUP(self, group);
+
+ flag = EC_GROUP_get_asn1_flag(group);
+
+ return INT2FIX(flag);
+}
+
+/* call-seq:
+ * group.asn1_flag = Fixnum => Fixnum
+ *
+ * See the OpenSSL documentation for EC_GROUP_set_asn1_flag()
+ */
+static VALUE ossl_ec_group_set_asn1_flag(VALUE self, VALUE flag_v)
+{
+ EC_GROUP *group = NULL;
+
+ Require_EC_GROUP(self, group);
+
+ EC_GROUP_set_asn1_flag(group, NUM2INT(flag_v));
+
+ return flag_v;
+}
+
+/* call-seq:
+ * group.point_conversion_form => :uncompressed | :compressed | :hybrid
+ *
+ * See the OpenSSL documentation for EC_GROUP_get_point_conversion_form()
+ */
+static VALUE ossl_ec_group_get_point_conversion_form(VALUE self)
+{
+ EC_GROUP *group = NULL;
+ point_conversion_form_t form;
+ VALUE ret;
+
+ Require_EC_GROUP(self, group);
+
+ form = EC_GROUP_get_point_conversion_form(group);
+
+ switch (form) {
+ case POINT_CONVERSION_UNCOMPRESSED: ret = ID_uncompressed; break;
+ case POINT_CONVERSION_COMPRESSED: ret = ID_compressed; break;
+ case POINT_CONVERSION_HYBRID: ret = ID_hybrid; break;
+ default: rb_raise(eEC_GROUP, "unsupported point conversion form: %d, this module should be updated", form);
+ }
+
+ return ID2SYM(ret);
+}
+
+/* call-seq:
+ * group.point_conversion_form = form => form
+ *
+ * See the OpenSSL documentation for EC_GROUP_set_point_conversion_form()
+ */
+static VALUE ossl_ec_group_set_point_conversion_form(VALUE self, VALUE form_v)
+{
+ EC_GROUP *group = NULL;
+ point_conversion_form_t form;
+ ID form_id = SYM2ID(form_v);
+
+ Require_EC_GROUP(self, group);
+
+ if (form_id == ID_uncompressed) {
+ form = POINT_CONVERSION_UNCOMPRESSED;
+ } else if (form_id == ID_compressed) {
+ form = POINT_CONVERSION_COMPRESSED;
+ } else if (form_id == ID_hybrid) {
+ form = POINT_CONVERSION_HYBRID;
+ } else {
+ rb_raise(rb_eArgError, "form must be :compressed, :uncompressed, or :hybrid");
+ }
+
+ EC_GROUP_set_point_conversion_form(group, form);
+
+ return form_v;
+}
+
+/* call-seq:
+ * group.seed => String or nil
+ *
+ * See the OpenSSL documentation for EC_GROUP_get0_seed()
+ */
+static VALUE ossl_ec_group_get_seed(VALUE self)
+{
+ EC_GROUP *group = NULL;
+ size_t seed_len;
+
+ Require_EC_GROUP(self, group);
+
+ seed_len = EC_GROUP_get_seed_len(group);
+
+ if (seed_len == 0)
+ return Qnil;
+
+ return rb_str_new(EC_GROUP_get0_seed(group), seed_len);
+}
+
+/* call-seq:
+ * group.seed = seed => seed
+ *
+ * See the OpenSSL documentation for EC_GROUP_set_seed()
+ */
+static VALUE ossl_ec_group_set_seed(VALUE self, VALUE seed)
+{
+ EC_GROUP *group = NULL;
+
+ Require_EC_GROUP(self, group);
+ StringValue(seed);
+
+ if (EC_GROUP_set_seed(group, RSTRING_PTR(seed), RSTRING_LEN(seed)) != RSTRING_LEN(seed))
+ ossl_raise(eEC_GROUP, "EC_GROUP_set_seed");
+
+ return seed;
+}
+
+/* get/set curve GFp, GF2m */
+
+/* call-seq:
+ * group.degree => Fixnum
+ *
+ * See the OpenSSL documentation for EC_GROUP_get_degree()
+ */
+static VALUE ossl_ec_group_get_degree(VALUE self)
+{
+ EC_GROUP *group = NULL;
+
+ Require_EC_GROUP(self, group);
+
+ return INT2NUM(EC_GROUP_get_degree(group));
+}
+
+static VALUE ossl_ec_group_to_string(VALUE self, int format)
+{
+ EC_GROUP *group;
+ BIO *out;
+ int i = -1;
+ VALUE str;
+
+ Get_EC_GROUP(self, group);
+
+ if (!(out = BIO_new(BIO_s_mem())))
+ ossl_raise(eEC_GROUP, "BIO_new(BIO_s_mem())");
+
+ switch(format) {
+ case EXPORT_PEM:
+ i = PEM_write_bio_ECPKParameters(out, group);
+ break;
+ case EXPORT_DER:
+ i = i2d_ECPKParameters_bio(out, group);
+ break;
+ default:
+ BIO_free(out);
+ rb_raise(rb_eRuntimeError, "unknown format (internal error)");
+ }
+
+ if (i != 1) {
+ BIO_free(out);
+ ossl_raise(eECError, NULL);
+ }
+
+ str = ossl_membio2str(out);
+
+ return str;
+}
+
+/* call-seq:
+ * group.to_pem => String
+ *
+ * See the OpenSSL documentation for PEM_write_bio_ECPKParameters()
+ */
+static VALUE ossl_ec_group_to_pem(VALUE self)
+{
+ return ossl_ec_group_to_string(self, EXPORT_PEM);
+}
+
+/* call-seq:
+ * group.to_der => String
+ *
+ * See the OpenSSL documentation for i2d_ECPKParameters_bio()
+ */
+static VALUE ossl_ec_group_to_der(VALUE self)
+{
+ return ossl_ec_group_to_string(self, EXPORT_DER);
+}
+
+/* call-seq:
+ * group.to_text => String
+ *
+ * See the OpenSSL documentation for ECPKParameters_print()
+ */
+static VALUE ossl_ec_group_to_text(VALUE self)
+{
+ EC_GROUP *group;
+ BIO *out;
+ VALUE str;
+
+ Require_EC_GROUP(self, group);
+ if (!(out = BIO_new(BIO_s_mem()))) {
+ ossl_raise(eEC_GROUP, "BIO_new(BIO_s_mem())");
+ }
+ if (!ECPKParameters_print(out, group, 0)) {
+ BIO_free(out);
+ ossl_raise(eEC_GROUP, NULL);
+ }
+ str = ossl_membio2str(out);
+
+ return str;
+}
+
+
+static void ossl_ec_point_free(ossl_ec_point *ec_point)
+{
+ if (!ec_point->dont_free && ec_point->point)
+ EC_POINT_clear_free(ec_point->point);
+ free(ec_point);
+}
+
+static VALUE ossl_ec_point_alloc(VALUE klass)
+{
+ ossl_ec_point *ec_point;
+ VALUE obj;
+
+ obj = Data_Make_Struct(klass, ossl_ec_point, 0, ossl_ec_point_free, ec_point);
+
+ return obj;
+}
+
+/*
+ * call-seq:
+ * OpenSSL::PKey::EC::Point.new(point)
+ * OpenSSL::PKey::EC::Point.new(group)
+ * OpenSSL::PKey::EC::Point.new(group, bn)
+ *
+ * See the OpenSSL documentation for EC_POINT_*
+ */
+static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
+{
+ ossl_ec_point *ec_point;
+ EC_POINT *point = NULL;
+ VALUE arg1, arg2;
+ VALUE group_v = Qnil;
+ const EC_GROUP *group = NULL;
+
+ Data_Get_Struct(self, ossl_ec_point, ec_point);
+ if (ec_point->point)
+ rb_raise(eEC_POINT, "EC_POINT already initialized");
+
+ switch (rb_scan_args(argc, argv, "11", &arg1, &arg2)) {
+ case 1:
+ if (rb_obj_is_kind_of(arg1, cEC_POINT)) {
+ const EC_POINT *arg_point;
+
+ group_v = rb_iv_get(arg1, "@group");
+ SafeRequire_EC_GROUP(group_v, group);
+ SafeRequire_EC_POINT(arg1, arg_point);
+
+ point = EC_POINT_dup(arg_point, group);
+ } else if (rb_obj_is_kind_of(arg1, cEC_GROUP)) {
+ group_v = arg1;
+ SafeRequire_EC_GROUP(group_v, group);
+
+ point = EC_POINT_new(group);
+ } else {
+ rb_raise(eEC_POINT, "wrong argument type: must be OpenSSL::PKey::EC::Point or OpenSSL::Pkey::EC::Group");
+ }
+
+ break;
+ case 2:
+ if (!rb_obj_is_kind_of(arg1, cEC_GROUP))
+ rb_raise(rb_eArgError, "1st argument must be OpenSSL::PKey::EC::Group");
+ group_v = arg1;
+ SafeRequire_EC_GROUP(group_v, group);
+
+ if (rb_obj_is_kind_of(arg2, cBN)) {
+ const BIGNUM *bn = GetBNPtr(arg2);
+
+ point = EC_POINT_bn2point(group, bn, NULL, ossl_bn_ctx);
+ } else {
+ BIO *in = ossl_obj2bio(arg1);
+
+/* BUG: finish me */
+
+ BIO_free(in);
+
+ if (point == NULL) {
+ ossl_raise(eEC_POINT, "unknown type for 2nd arg");
+ }
+ }
+ break;
+ default:
+ rb_raise(rb_eArgError, "wrong number of arguments");
+ }
+
+ if (point == NULL)
+ ossl_raise(eEC_POINT, NULL);
+
+ if (NIL_P(group_v))
+ rb_raise(rb_eRuntimeError, "missing group (internal error)");
+
+ ec_point->point = point;
+
+ rb_iv_set(self, "@group", group_v);
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * point1 == point2 => true | false
+ *
+ */
+static VALUE ossl_ec_point_eql(VALUE a, VALUE b)
+{
+ EC_POINT *point1, *point2;
+ VALUE group_v1 = rb_iv_get(a, "@group");
+ VALUE group_v2 = rb_iv_get(b, "@group");
+ const EC_GROUP *group;
+
+ if (ossl_ec_group_eql(group_v1, group_v2) == Qfalse)
+ return Qfalse;
+
+ Require_EC_POINT(a, point1);
+ SafeRequire_EC_POINT(b, point2);
+ SafeRequire_EC_GROUP(group_v1, group);
+
+ if (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx) == 1)
+ return Qfalse;
+
+ return Qtrue;
+}
+
+/*
+ * call-seq:
+ * point.infinity? => true | false
+ *
+ */
+static VALUE ossl_ec_point_is_at_infinity(VALUE self)
+{
+ EC_POINT *point;
+ VALUE group_v = rb_iv_get(self, "@group");
+ const EC_GROUP *group;
+
+ Require_EC_POINT(self, point);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ switch (EC_POINT_is_at_infinity(group, point)) {
+ case 1: return Qtrue;
+ case 0: return Qfalse;
+ default: ossl_raise(cEC_POINT, "EC_POINT_is_at_infinity");
+ }
+}
+
+/*
+ * call-seq:
+ * point.on_curve? => true | false
+ *
+ */
+static VALUE ossl_ec_point_is_on_curve(VALUE self)
+{
+ EC_POINT *point;
+ VALUE group_v = rb_iv_get(self, "@group");
+ const EC_GROUP *group;
+
+ Require_EC_POINT(self, point);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ switch (EC_POINT_is_on_curve(group, point, ossl_bn_ctx)) {
+ case 1: return Qtrue;
+ case 0: return Qfalse;
+ default: ossl_raise(cEC_POINT, "EC_POINT_is_on_curve");
+ }
+}
+
+/*
+ * call-seq:
+ * point.make_affine! => self
+ *
+ */
+static VALUE ossl_ec_point_make_affine(VALUE self)
+{
+ EC_POINT *point;
+ VALUE group_v = rb_iv_get(self, "@group");
+ const EC_GROUP *group;
+
+ Require_EC_POINT(self, point);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ if (EC_POINT_make_affine(group, point, ossl_bn_ctx) != 1)
+ ossl_raise(cEC_POINT, "EC_POINT_make_affine");
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * point.invert! => self
+ *
+ */
+static VALUE ossl_ec_point_invert(VALUE self)
+{
+ EC_POINT *point;
+ VALUE group_v = rb_iv_get(self, "@group");
+ const EC_GROUP *group;
+
+ Require_EC_POINT(self, point);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ if (EC_POINT_invert(group, point, ossl_bn_ctx) != 1)
+ ossl_raise(cEC_POINT, "EC_POINT_invert");
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * point.set_to_infinity! => self
+ *
+ */
+static VALUE ossl_ec_point_set_to_infinity(VALUE self)
+{
+ EC_POINT *point;
+ VALUE group_v = rb_iv_get(self, "@group");
+ const EC_GROUP *group;
+
+ Require_EC_POINT(self, point);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ if (EC_POINT_set_to_infinity(group, point) != 1)
+ ossl_raise(cEC_POINT, "EC_POINT_set_to_infinity");
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * point.to_bn => OpenSSL::BN
+ *
+ * See the OpenSSL documentation for EC_POINT_point2bn()
+ */
+static VALUE ossl_ec_point_to_bn(VALUE self)
+{
+ EC_POINT *point;
+ VALUE bn_obj;
+ VALUE group_v = rb_iv_get(self, "@group");
+ const EC_GROUP *group;
+ point_conversion_form_t form;
+ BIGNUM *bn;
+
+ Require_EC_POINT(self, point);
+ SafeRequire_EC_GROUP(group_v, group);
+
+ form = EC_GROUP_get_point_conversion_form(group);
+
+ bn_obj = rb_obj_alloc(cBN);
+ bn = GetBNPtr(bn_obj);
+
+ if (EC_POINT_point2bn(group, point, form, bn, ossl_bn_ctx) == NULL)
+ ossl_raise(eEC_POINT, "EC_POINT_point2bn");
+
+ return bn_obj;
+}
+
+static void no_copy(VALUE klass)
+{
+ rb_undef_method(klass, "copy");
+ rb_undef_method(klass, "clone");
+ rb_undef_method(klass, "dup");
+ rb_undef_method(klass, "initialize_copy");
+}
+
+void Init_ossl_ec()
+{
+#ifdef DONT_NEED_RDOC_WORKAROUND
+ mOSSL = rb_define_module("OpenSSL");
+ mPKey = rb_define_module_under(mOSSL, "PKey");
+#endif
+
+ eECError = rb_define_class_under(mPKey, "ECError", ePKeyError);
+
+ cEC = rb_define_class_under(mPKey, "EC", cPKey);
+ cEC_GROUP = rb_define_class_under(cEC, "Group", rb_cObject);
+ cEC_POINT = rb_define_class_under(cEC, "Point", rb_cObject);
+ eEC_GROUP = rb_define_class_under(cEC_GROUP, "Error", eOSSLError);
+ eEC_POINT = rb_define_class_under(cEC_POINT, "Error", eOSSLError);
+
+ s_GFp = rb_intern("GFp");
+ s_GF2m = rb_intern("GF2m");
+ s_GFp_simple = rb_intern("GFp_simple");
+ s_GFp_mont = rb_intern("GFp_mont");
+ s_GFp_nist = rb_intern("GFp_nist");
+ s_GF2m_simple = rb_intern("GF2m_simple");
+
+ ID_uncompressed = rb_intern("uncompressed");
+ ID_compressed = rb_intern("compressed");
+ ID_hybrid = rb_intern("hybrid");
+
+#ifdef OPENSSL_EC_NAMED_CURVE
+ rb_define_const(cEC, "NAMED_CURVE", ULONG2NUM(OPENSSL_EC_NAMED_CURVE));
+#endif
+
+ rb_define_singleton_method(cEC, "builtin_curves", ossl_s_builtin_curves, 0);
+
+ rb_define_method(cEC, "initialize", ossl_ec_key_initialize, -1);
+/* copy/dup/cmp */
+
+ rb_define_method(cEC, "group", ossl_ec_key_get_group, 0);
+ rb_define_method(cEC, "group=", ossl_ec_key_set_group, 1);
+ rb_define_method(cEC, "private_key", ossl_ec_key_get_private_key, 0);
+ rb_define_method(cEC, "private_key=", ossl_ec_key_set_private_key, 1);
+ rb_define_method(cEC, "public_key", ossl_ec_key_get_public_key, 0);
+ rb_define_method(cEC, "public_key=", ossl_ec_key_set_public_key, 1);
+ rb_define_method(cEC, "private_key?", ossl_ec_key_is_private_key, 0);
+ rb_define_method(cEC, "public_key?", ossl_ec_key_is_public_key, 0);
+/* rb_define_method(cEC, "", ossl_ec_key_get_, 0);
+ rb_define_method(cEC, "=", ossl_ec_key_set_ 1);
+ set/get enc_flags
+ set/get _conv_from
+ set/get asn1_flag (can use ruby to call self.group.asn1_flag)
+ set/get precompute_mult
+*/
+ rb_define_method(cEC, "generate_key", ossl_ec_key_generate_key, 0);
+ rb_define_method(cEC, "check_key", ossl_ec_key_check_key, 0);
+
+ rb_define_method(cEC, "dh_compute_key", ossl_ec_key_dh_compute_key, 1);
+ rb_define_method(cEC, "dsa_sign_asn1", ossl_ec_key_dsa_sign_asn1, 1);
+ rb_define_method(cEC, "dsa_verify_asn1", ossl_ec_key_dsa_verify_asn1, 2);
+/* do_sign/do_verify */
+
+ rb_define_method(cEC, "to_pem", ossl_ec_key_to_pem, 0);
+ rb_define_method(cEC, "to_der", ossl_ec_key_to_der, 0);
+ rb_define_method(cEC, "to_text", ossl_ec_key_to_text, 0);
+
+
+ rb_define_alloc_func(cEC_GROUP, ossl_ec_group_alloc);
+ rb_define_method(cEC_GROUP, "initialize", ossl_ec_group_initialize, -1);
+ rb_define_method(cEC_GROUP, "eql?", ossl_ec_group_eql, 1);
+ rb_define_alias(cEC_GROUP, "==", "eql?");
+/* copy/dup/cmp */
+
+ rb_define_method(cEC_GROUP, "generator", ossl_ec_group_get_generator, 0);
+ rb_define_method(cEC_GROUP, "set_generator", ossl_ec_group_set_generator, 3);
+ rb_define_method(cEC_GROUP, "order", ossl_ec_group_get_order, 0);
+ rb_define_method(cEC_GROUP, "cofactor", ossl_ec_group_get_cofactor, 0);
+
+ rb_define_method(cEC_GROUP, "curve_name", ossl_ec_group_get_curve_name, 0);
+/* rb_define_method(cEC_GROUP, "curve_name=", ossl_ec_group_set_curve_name, 1); */
+
+ rb_define_method(cEC_GROUP, "asn1_flag", ossl_ec_group_get_asn1_flag, 0);
+ rb_define_method(cEC_GROUP, "asn1_flag=", ossl_ec_group_set_asn1_flag, 1);
+
+ rb_define_method(cEC_GROUP, "point_conversion_form", ossl_ec_group_get_point_conversion_form, 0);
+ rb_define_method(cEC_GROUP, "point_conversion_form=", ossl_ec_group_set_point_conversion_form, 1);
+
+ rb_define_method(cEC_GROUP, "seed", ossl_ec_group_get_seed, 0);
+ rb_define_method(cEC_GROUP, "seed=", ossl_ec_group_set_seed, 1);
+
+/* get/set GFp, GF2m */
+
+ rb_define_method(cEC_GROUP, "degree", ossl_ec_group_get_degree, 0);
+
+/* check* */
+
+
+ rb_define_method(cEC_GROUP, "to_pem", ossl_ec_group_to_pem, 0);
+ rb_define_method(cEC_GROUP, "to_der", ossl_ec_group_to_der, 0);
+ rb_define_method(cEC_GROUP, "to_text", ossl_ec_group_to_text, 0);
+
+
+ rb_define_alloc_func(cEC_POINT, ossl_ec_point_alloc);
+ rb_define_method(cEC_POINT, "initialize", ossl_ec_point_initialize, -1);
+ rb_attr(cEC_POINT, rb_intern("group"), 1, 0, 0);
+ rb_define_method(cEC_POINT, "eql?", ossl_ec_point_eql, 1);
+ rb_define_alias(cEC_POINT, "==", "eql?");
+
+ rb_define_method(cEC_POINT, "infinity?", ossl_ec_point_is_at_infinity, 0);
+ rb_define_method(cEC_POINT, "on_curve?", ossl_ec_point_is_on_curve, 0);
+ rb_define_method(cEC_POINT, "make_affine!", ossl_ec_point_make_affine, 0);
+ rb_define_method(cEC_POINT, "invert!", ossl_ec_point_invert, 0);
+ rb_define_method(cEC_POINT, "set_to_infinity!", ossl_ec_point_set_to_infinity, 0);
+/* all the other methods */
+
+ rb_define_method(cEC_POINT, "to_bn", ossl_ec_point_to_bn, 0);
+
+ no_copy(cEC);
+ no_copy(cEC_GROUP);
+ no_copy(cEC_POINT);
+}
+
+#else /* defined NO_EC */
+void Init_ossl_ec()
+{
+}
+#endif /* NO_EC */
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index 17bec2b7bb..9ac69e7ded 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -84,9 +84,19 @@ rsa_generate(int size, int exp)
NULL);
}
+/*
+ * call-seq:
+ * RSA.generate(size [, exponent]) -> rsa
+ *
+ * === Parameters
+ * * +size+ is an integer representing the desired key size. Keys smaller than 1024 should be considered insecure.
+ * * +exponent+ is an odd number normally 3, 17, or 65537.
+ *
+ */
static VALUE
ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass)
{
+/* why does this method exist? why can't initialize take an optional exponent? */
RSA *rsa;
VALUE size, exp;
VALUE obj;
@@ -104,6 +114,20 @@ ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * RSA.new([size | encoded_key] [, pass]) -> rsa
+ *
+ * === Parameters
+ * * +size+ is an integer representing the desired key size.
+ * * +encoded_key+ is a string containing PEM or DER encoded key.
+ * * +pass+ is an optional string with the password to decrypt the encoded key.
+ *
+ * === Examples
+ * * RSA.new(2048) -> rsa
+ * * RSA.new(File.read("rsa.pem")) -> rsa
+ * * RSA.new(File.read("rsa.pem"), "mypassword") -> rsa
+ */
static VALUE
ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -157,6 +181,13 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * rsa.public? -> true
+ *
+ * The return value is always true since every private key is also a public key.
+ *
+ */
static VALUE
ossl_rsa_is_public(VALUE self)
{
@@ -164,12 +195,16 @@ ossl_rsa_is_public(VALUE self)
GetPKeyRSA(self, pkey);
/*
- * SURPRISE! :-))
- * Every key is public at the same time!
+ * This method should check for n and e. BUG.
*/
return Qtrue;
}
+/*
+ * call-seq:
+ * rsa.private? -> true | false
+ *
+ */
static VALUE
ossl_rsa_is_private(VALUE self)
{
@@ -180,6 +215,18 @@ ossl_rsa_is_private(VALUE self)
return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * rsa.to_pem([cipher, pass]) -> aString
+ *
+ * === Parameters
+ * * +cipher+ is a Cipher object.
+ * * +pass+ is a string.
+ *
+ * === Examples
+ * * rsa.to_pem -> aString
+ * * rsa.to_pem(cipher, pass) -> aString
+ */
static VALUE
ossl_rsa_export(int argc, VALUE *argv, VALUE self)
{
@@ -219,6 +266,11 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self)
return str;
}
+/*
+ * call-seq:
+ * rsa.to_der -> aString
+ *
+ */
static VALUE
ossl_rsa_to_der(VALUE self)
{
@@ -236,7 +288,7 @@ ossl_rsa_to_der(VALUE self)
if((len = i2d_func(pkey->pkey.rsa, NULL)) <= 0)
ossl_raise(eRSAError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_func(pkey->pkey.rsa, &p) < 0)
ossl_raise(eRSAError, NULL);
ossl_str_adjust(str, p);
@@ -246,6 +298,11 @@ ossl_rsa_to_der(VALUE self)
#define ossl_rsa_buf_size(pkey) (RSA_size((pkey)->pkey.rsa)+16)
+/*
+ * call-seq:
+ * rsa.public_encrypt(string [, padding]) -> aString
+ *
+ */
static VALUE
ossl_rsa_public_encrypt(int argc, VALUE *argv, VALUE self)
{
@@ -258,16 +315,20 @@ ossl_rsa_public_encrypt(int argc, VALUE *argv, VALUE self)
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
str = rb_str_new(0, ossl_rsa_buf_size(pkey));
- buf_len = RSA_public_encrypt(RSTRING(buffer)->len, RSTRING(buffer)->ptr,
- RSTRING(str)->ptr, pkey->pkey.rsa,
+ buf_len = RSA_public_encrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer),
+ RSTRING_PTR(str), pkey->pkey.rsa,
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
- RSTRING(str)->len = buf_len;
- RSTRING(str)->ptr[buf_len] = 0;
+ rb_str_set_len(str, buf_len);
return str;
}
+/*
+ * call-seq:
+ * rsa.public_decrypt(string [, padding]) -> aString
+ *
+ */
static VALUE
ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self)
{
@@ -280,16 +341,20 @@ ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self)
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
str = rb_str_new(0, ossl_rsa_buf_size(pkey));
- buf_len = RSA_public_decrypt(RSTRING(buffer)->len, RSTRING(buffer)->ptr,
- RSTRING(str)->ptr, pkey->pkey.rsa,
+ buf_len = RSA_public_decrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer),
+ RSTRING_PTR(str), pkey->pkey.rsa,
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
- RSTRING(str)->len = buf_len;
- RSTRING(str)->ptr[buf_len] = 0;
+ rb_str_set_len(str, buf_len);
return str;
}
+/*
+ * call-seq:
+ * rsa.private_encrypt(string [, padding]) -> aString
+ *
+ */
static VALUE
ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
{
@@ -305,16 +370,21 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
str = rb_str_new(0, ossl_rsa_buf_size(pkey));
- buf_len = RSA_private_encrypt(RSTRING(buffer)->len, RSTRING(buffer)->ptr,
- RSTRING(str)->ptr, pkey->pkey.rsa,
+ buf_len = RSA_private_encrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer),
+ RSTRING_PTR(str), pkey->pkey.rsa,
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
- RSTRING(str)->len = buf_len;
- RSTRING(str)->ptr[buf_len] = 0;
+ rb_str_set_len(str, buf_len);
return str;
}
+
+/*
+ * call-seq:
+ * rsa.private_decrypt(string [, padding]) -> aString
+ *
+ */
static VALUE
ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self)
{
@@ -330,17 +400,19 @@ ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self)
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
str = rb_str_new(0, ossl_rsa_buf_size(pkey));
- buf_len = RSA_private_decrypt(RSTRING(buffer)->len, RSTRING(buffer)->ptr,
- RSTRING(str)->ptr, pkey->pkey.rsa,
+ buf_len = RSA_private_decrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer),
+ RSTRING_PTR(str), pkey->pkey.rsa,
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
- RSTRING(str)->len = buf_len;
- RSTRING(str)->ptr[buf_len] = 0;
+ rb_str_set_len(str, buf_len);
return str;
}
/*
+ * call-seq:
+ * rsa.params -> hash
+ *
* Stores all parameters of key to the hash
* INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
* Don't use :-)) (I's up to you)
@@ -368,6 +440,9 @@ ossl_rsa_get_params(VALUE self)
}
/*
+ * call-seq:
+ * rsa.to_text -> aString
+ *
* Prints all parameters of key to buffer
* INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!!
* Don't use :-)) (It's up to you)
@@ -393,6 +468,9 @@ ossl_rsa_to_text(VALUE self)
}
/*
+ * call-seq:
+ * rsa.public_key -> aRSA
+ *
* Makes new instance RSA PUBLIC_KEY from PRIVATE_KEY
*/
static VALUE
@@ -415,7 +493,6 @@ ossl_rsa_to_public_key(VALUE self)
/*
* TODO: Test me
-extern BN_CTX *ossl_bn_ctx;
static VALUE
ossl_rsa_blinding_on(VALUE self)
@@ -459,6 +536,11 @@ OSSL_PKEY_BN(rsa, iqmp);
void
Init_ossl_rsa()
{
+#if 0 /* let rdoc know about mOSSL and mPKey */
+ mOSSL = rb_define_module("OpenSSL");
+ mPKey = rb_define_module_under(mOSSL, "PKey");
+#endif
+
eRSAError = rb_define_class_under(mPKey, "RSAError", ePKeyError);
cRSA = rb_define_class_under(mPKey, "RSA", cPKey);
@@ -503,11 +585,9 @@ Init_ossl_rsa()
}
#else /* defined NO_RSA */
-# warning >>> OpenSSL is compiled without RSA support <<<
void
Init_ossl_rsa()
{
- rb_warning("OpenSSL is compiled without RSA support");
}
#endif /* NO_RSA */
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c
index ec9883d70a..ad830fbc98 100644
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -27,84 +27,150 @@ VALUE eRandomError;
/*
* Private
*/
+
+/*
+ * call-seq:
+ * seed(str) -> str
+ *
+ */
static VALUE
ossl_rand_seed(VALUE self, VALUE str)
{
StringValue(str);
- RAND_seed(RSTRING(str)->ptr, RSTRING(str)->len);
+ RAND_seed(RSTRING_PTR(str), RSTRING_LEN(str));
return str;
}
+/*
+ * call-seq:
+ * add(str, entropy) -> self
+ *
+ */
+static VALUE
+ossl_rand_add(VALUE self, VALUE str, VALUE entropy)
+{
+ StringValue(str);
+ RAND_add(RSTRING_PTR(str), RSTRING_LEN(str), NUM2DBL(entropy));
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * load_random_file(filename) -> true
+ *
+ */
static VALUE
ossl_rand_load_file(VALUE self, VALUE filename)
{
SafeStringValue(filename);
- if(!RAND_load_file(RSTRING(filename)->ptr, -1)) {
+ if(!RAND_load_file(RSTRING_PTR(filename), -1)) {
ossl_raise(eRandomError, NULL);
}
return Qtrue;
}
+/*
+ * call-seq:
+ * write_random_file(filename) -> true
+ *
+ */
static VALUE
ossl_rand_write_file(VALUE self, VALUE filename)
{
SafeStringValue(filename);
- if (RAND_write_file(RSTRING(filename)->ptr) == -1) {
+ if (RAND_write_file(RSTRING_PTR(filename)) == -1) {
ossl_raise(eRandomError, NULL);
}
return Qtrue;
}
+/*
+ * call-seq:
+ * random_bytes(length) -> aString
+ *
+ */
static VALUE
ossl_rand_bytes(VALUE self, VALUE len)
{
VALUE str;
-
- str = rb_str_new(0, FIX2INT(len));
- if (!RAND_bytes(RSTRING(str)->ptr, FIX2INT(len))) {
+ int n = NUM2INT(len);
+
+ str = rb_str_new(0, n);
+ if (!RAND_bytes(RSTRING_PTR(str), n)) {
ossl_raise(eRandomError, NULL);
}
return str;
}
+/*
+ * call-seq:
+ * pseudo_bytes(length) -> aString
+ *
+ */
static VALUE
ossl_rand_pseudo_bytes(VALUE self, VALUE len)
{
VALUE str;
+ int n = NUM2INT(len);
- str = rb_str_new(0, FIX2INT(len));
- if (!RAND_pseudo_bytes(RSTRING(str)->ptr, FIX2INT(len))) {
+ str = rb_str_new(0, n);
+ if (!RAND_pseudo_bytes(RSTRING_PTR(str), n)) {
ossl_raise(eRandomError, NULL);
}
return str;
}
+/*
+ * call-seq:
+ * egd(filename) -> true
+ *
+ */
static VALUE
ossl_rand_egd(VALUE self, VALUE filename)
{
SafeStringValue(filename);
- if(!RAND_egd(RSTRING(filename)->ptr)) {
+ if(!RAND_egd(RSTRING_PTR(filename))) {
ossl_raise(eRandomError, NULL);
}
return Qtrue;
}
+/*
+ * call-seq:
+ * egd_bytes(filename, length) -> true
+ *
+ */
static VALUE
ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
{
+ long n = NUM2INT(len);
+
SafeStringValue(filename);
- if (!RAND_egd_bytes(RSTRING(filename)->ptr, FIX2INT(len))) {
+ if (!RAND_egd_bytes(RSTRING_PTR(filename), n)) {
ossl_raise(eRandomError, NULL);
}
return Qtrue;
}
+/*
+ * call-seq:
+ * status? => true | false
+ *
+ * Return true if the PRNG has been seeded with enough data, false otherwise.
+ */
+static VALUE
+ossl_rand_status(VALUE self)
+{
+ return RAND_status() ? Qtrue : Qfalse;
+}
+
#define DEFMETH(class, name, func, argc) \
rb_define_method(class, name, func, argc); \
rb_define_singleton_method(class, name, func, argc);
@@ -115,16 +181,22 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
void
Init_ossl_rand()
{
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
mRandom = rb_define_module_under(mOSSL, "Random");
eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
DEFMETH(mRandom, "seed", ossl_rand_seed, 1);
+ DEFMETH(mRandom, "random_add", ossl_rand_add, 2);
DEFMETH(mRandom, "load_random_file", ossl_rand_load_file, 1);
DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+ DEFMETH(mRandom, "status?", ossl_rand_status, 0)
}
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index a4d03089bc..01b86fec27 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -3,6 +3,7 @@
* 'OpenSSL for Ruby' project
* Copyright (C) 2000-2002 GOTOU Yuuzou <gotoyuzo@notwork.org>
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
+ * Copyright (C) 2001-2007 Technorama Ltd. <oss-ruby@technorama.net>
* All rights reserved.
*/
/*
@@ -30,9 +31,6 @@ VALUE eSSLError;
VALUE cSSLContext;
VALUE cSSLSocket;
-/*
- * SSLContext class
- */
#define ossl_sslctx_set_cert(o,v) rb_iv_set((o),"@cert",(v))
#define ossl_sslctx_set_key(o,v) rb_iv_set((o),"@key",(v))
#define ossl_sslctx_set_client_ca(o,v) rb_iv_set((o),"@client_ca",(v))
@@ -65,11 +63,12 @@ VALUE cSSLSocket;
#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[] = {
+static const 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",
+ "session_get_cb", "session_new_cb", "session_remove_cb",
};
#define ossl_ssl_get_io(o) rb_iv_get((o),"@io")
@@ -86,8 +85,10 @@ static char *ossl_sslctx_attrs[] = {
#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", };
+static const char *ossl_ssl_attr_readers[] = { "io", "context", };
+static const char *ossl_ssl_attrs[] = { "sync_close", };
+
+ID ID_callback_state;
/*
* SSLContext class
@@ -141,22 +142,13 @@ ossl_sslctx_s_alloc(VALUE klass)
}
static VALUE
-ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
+ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
{
- VALUE ssl_method;
SSL_METHOD *method = NULL;
- SSL_CTX *ctx;
+ const char *s;
int i;
- char *s;
- for(i = 0; i < numberof(ossl_sslctx_attrs); i++){
- char buf[32];
- snprintf(buf, sizeof(buf), "@%s", ossl_sslctx_attrs[i]);
- rb_iv_set(self, buf, Qnil);
- }
- if (rb_scan_args(argc, argv, "01", &ssl_method) == 0){
- return self;
- }
+ SSL_CTX *ctx;
if(TYPE(ssl_method) == T_SYMBOL)
s = rb_id2name(SYM2ID(ssl_method));
else
@@ -175,6 +167,33 @@ ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
ossl_raise(eSSLError, "SSL_CTX_set_ssl_version:");
}
+ return ssl_method;
+}
+
+/*
+ * call-seq:
+ * SSLContext.new => ctx
+ * SSLContext.new(:TLSv1) => ctx
+ * SSLContext.new("SSLv23_client") => ctx
+ *
+ * You can get a list of valid methods with OpenSSL::SSL::SSLContext::METHODS
+ */
+static VALUE
+ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
+{
+ VALUE ssl_method;
+ int i;
+
+ for(i = 0; i < numberof(ossl_sslctx_attrs); i++){
+ char buf[32];
+ snprintf(buf, sizeof(buf), "@%s", ossl_sslctx_attrs[i]);
+ rb_iv_set(self, buf, Qnil);
+ }
+ if (rb_scan_args(argc, argv, "01", &ssl_method) == 0){
+ return self;
+ }
+ ossl_sslctx_set_ssl_version(self, ssl_method);
+
return self;
}
@@ -251,6 +270,8 @@ ossl_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
static DH*
ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
{
+ rb_warning("using default DH parameters.");
+
switch(keylength){
case 512:
return OSSL_DEFAULT_DH_512;
@@ -274,6 +295,143 @@ ossl_ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
}
static VALUE
+ossl_call_session_get_cb(VALUE ary)
+{
+ VALUE ssl_obj, sslctx_obj, cb, ret;
+
+ Check_Type(ary, T_ARRAY);
+ ssl_obj = rb_ary_entry(ary, 0);
+
+ sslctx_obj = rb_iv_get(ssl_obj, "@context");
+ if (NIL_P(sslctx_obj)) return Qnil;
+ cb = rb_iv_get(sslctx_obj, "@session_get_cb");
+ if (NIL_P(cb)) return Qnil;
+
+ return rb_funcall(cb, rb_intern("call"), 1, ary);
+}
+
+/* this method is currently only called for servers (in OpenSSL <= 0.9.8e) */
+static SSL_SESSION *
+ossl_sslctx_session_get_cb(SSL *ssl, unsigned char *buf, int len, int *copy)
+{
+ VALUE ary, ssl_obj, ret_obj;
+ SSL_SESSION *sess;
+ void *ptr;
+ int state = 0;
+
+ OSSL_Debug("SSL SESSION get callback entered");
+ if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL)
+ return NULL;
+ ssl_obj = (VALUE)ptr;
+ ary = rb_ary_new2(2);
+ rb_ary_push(ary, ssl_obj);
+ rb_ary_push(ary, rb_str_new(buf, len));
+
+ ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_get_cb, ary, &state);
+ if (state) {
+ rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state));
+ return NULL;
+ }
+ if (!rb_obj_is_instance_of(ret_obj, cSSLSession))
+ return NULL;
+
+ SafeGetSSLSession(ret_obj, sess);
+ *copy = 1;
+
+ return sess;
+}
+
+static VALUE
+ossl_call_session_new_cb(VALUE ary)
+{
+ VALUE ssl_obj, sslctx_obj, cb, ret;
+
+ Check_Type(ary, T_ARRAY);
+ ssl_obj = rb_ary_entry(ary, 0);
+
+ sslctx_obj = rb_iv_get(ssl_obj, "@context");
+ if (NIL_P(sslctx_obj)) return Qnil;
+ cb = rb_iv_get(sslctx_obj, "@session_new_cb");
+ if (NIL_P(cb)) return Qnil;
+
+ return rb_funcall(cb, rb_intern("call"), 1, ary);
+}
+
+/* return 1 normal. return 0 removes the session */
+static int
+ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
+{
+ VALUE ary, ssl_obj, sess_obj, ret_obj;
+ void *ptr;
+ int state = 0;
+
+ OSSL_Debug("SSL SESSION new callback entered");
+
+ if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL)
+ return 1;
+ ssl_obj = (VALUE)ptr;
+ sess_obj = rb_obj_alloc(cSSLSession);
+ CRYPTO_add(&sess->references, 1, CRYPTO_LOCK_SSL_SESSION);
+ DATA_PTR(sess_obj) = sess;
+
+ ary = rb_ary_new2(2);
+ rb_ary_push(ary, ssl_obj);
+ rb_ary_push(ary, sess_obj);
+
+ ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_new_cb, ary, &state);
+ if (state) {
+ rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state));
+ return 0; /* what should be returned here??? */
+ }
+
+ return RTEST(ret_obj) ? 1 : 0;
+}
+
+static VALUE
+ossl_call_session_remove_cb(VALUE ary)
+{
+ VALUE sslctx_obj, cb, ret;
+
+ Check_Type(ary, T_ARRAY);
+ sslctx_obj = rb_ary_entry(ary, 0);
+
+ cb = rb_iv_get(sslctx_obj, "@session_remove_cb");
+ if (NIL_P(cb)) return Qnil;
+
+ return rb_funcall(cb, rb_intern("call"), 1, ary);
+}
+
+static void
+ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
+{
+ VALUE ary, sslctx_obj, sess_obj, ret_obj;
+ void *ptr;
+ int state = 0;
+
+ OSSL_Debug("SSL SESSION remove callback entered");
+
+ if ((ptr = SSL_CTX_get_ex_data(ctx, ossl_ssl_ex_ptr_idx)) == NULL)
+ return;
+ sslctx_obj = (VALUE)ptr;
+ sess_obj = rb_obj_alloc(cSSLSession);
+ CRYPTO_add(&sess->references, 1, CRYPTO_LOCK_SSL_SESSION);
+ DATA_PTR(sess_obj) = sess;
+
+ ary = rb_ary_new2(2);
+ rb_ary_push(ary, sslctx_obj);
+ rb_ary_push(ary, sess_obj);
+
+ ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_new_cb, ary, &state);
+ if (state) {
+/*
+ the SSL_CTX is frozen, nowhere to save state.
+ there is no common accessor method to check it either.
+ rb_ivar_set(sslctx_obj, ID_callback_state, INT2NUM(state));
+*/
+ }
+}
+
+static VALUE
ossl_sslctx_add_extra_chain_cert_i(VALUE i, VALUE arg)
{
X509 *x509;
@@ -288,6 +446,14 @@ ossl_sslctx_add_extra_chain_cert_i(VALUE i, VALUE arg)
return i;
}
+/*
+ * call-seq:
+ * ctx.setup => Qtrue # first time
+ * ctx.setup => nil # thereafter
+ *
+ * This method is called automatically when a new SSLSocket is created.
+ * Normally you do not need to call this method (unless you are writing an extension in C).
+ */
static VALUE
ossl_sslctx_setup(VALUE self)
{
@@ -307,10 +473,10 @@ ossl_sslctx_setup(VALUE 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
+ SSL_CTX_set_ex_data(ctx, ossl_ssl_ex_ptr_idx, (void*)self);
val = ossl_sslctx_get_cert_store(self);
if(!NIL_P(val)){
@@ -327,7 +493,7 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_extra_cert(self);
if(!NIL_P(val)){
- rb_iterate(rb_each, val, ossl_sslctx_add_extra_chain_cert_i, self);
+ rb_block_call(val, rb_intern("each"), 0, 0, ossl_sslctx_add_extra_chain_cert_i, self);
}
/* private key may be bundled in certificate file. */
@@ -352,8 +518,8 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_client_ca(self);
if(!NIL_P(val)){
if(TYPE(val) == T_ARRAY){
- for(i = 0; i < RARRAY(val)->len; i++){
- client_ca = GetX509CertPtr(RARRAY(val)->ptr[i]);
+ for(i = 0; i < RARRAY_LEN(val); i++){
+ client_ca = GetX509CertPtr(RARRAY_PTR(val)[i]);
if (!SSL_CTX_add_client_CA(ctx, client_ca)){
/* Copies X509_NAME => FREE it. */
ossl_raise(eSSLError, "SSL_CTX_add_client_CA");
@@ -397,12 +563,24 @@ ossl_sslctx_setup(VALUE 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:");
+ if (!SSL_CTX_set_session_id_context(ctx, RSTRING_PTR(val),
+ RSTRING_LEN(val))){
+ ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:");
}
}
+ if (RTEST(rb_iv_get(self, "@session_get_cb"))) {
+ SSL_CTX_sess_set_get_cb(ctx, ossl_sslctx_session_get_cb);
+ OSSL_Debug("SSL SESSION get callback added");
+ }
+ if (RTEST(rb_iv_get(self, "@session_new_cb"))) {
+ SSL_CTX_sess_set_new_cb(ctx, ossl_sslctx_session_new_cb);
+ OSSL_Debug("SSL SESSION new callback added");
+ }
+ if (RTEST(rb_iv_get(self, "@session_remove_cb"))) {
+ SSL_CTX_sess_set_remove_cb(ctx, ossl_sslctx_session_remove_cb);
+ OSSL_Debug("SSL SESSION remove callback added");
+ }
return Qtrue;
}
@@ -422,6 +600,10 @@ ossl_ssl_cipher_to_ary(SSL_CIPHER *cipher)
return ary;
}
+/*
+ * call-seq:
+ * ctx.ciphers => [[name, version, bits, alg_bits], ...]
+ */
static VALUE
ossl_sslctx_get_ciphers(VALUE self)
{
@@ -450,6 +632,12 @@ ossl_sslctx_get_ciphers(VALUE self)
return ary;
}
+/*
+ * call-seq:
+ * ctx.ciphers = "cipher1:cipher2:..."
+ * ctx.ciphers = [name, ...]
+ * ctx.ciphers = [[name, version, bits, alg_bits], ...]
+ */
static VALUE
ossl_sslctx_set_ciphers(VALUE self, VALUE v)
{
@@ -461,13 +649,13 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
if (NIL_P(v))
return v;
else if (TYPE(v) == T_ARRAY) {
- str = rb_str_new2(NULL);
- for (i = 0; i < RARRAY(v)->len; i++) {
+ str = rb_str_new(0, 0);
+ for (i = 0; i < RARRAY_LEN(v); i++) {
elem = rb_ary_entry(v, i);
if (TYPE(elem) == T_ARRAY) elem = rb_ary_entry(elem, 0);
elem = rb_String(elem);
rb_str_append(str, elem);
- if (i < RARRAY(v)->len-1) rb_str_cat2(str, ":");
+ if (i < RARRAY_LEN(v)-1) rb_str_cat2(str, ":");
}
} else {
str = v;
@@ -479,13 +667,173 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
ossl_raise(eSSLError, "SSL_CTX is not initialized.");
return Qnil;
}
- if (!SSL_CTX_set_cipher_list(ctx, RSTRING(str)->ptr)) {
+ if (!SSL_CTX_set_cipher_list(ctx, RSTRING_PTR(str))) {
ossl_raise(eSSLError, "SSL_CTX_set_cipher_list:");
}
return v;
}
+
+/*
+ * call-seq:
+ * ctx.session_add(session) -> true | false
+ *
+ */
+static VALUE
+ossl_sslctx_session_add(VALUE self, VALUE arg)
+{
+ SSL_CTX *ctx;
+ SSL_SESSION *sess;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+ SafeGetSSLSession(arg, sess);
+
+ return SSL_CTX_add_session(ctx, sess) == 1 ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * ctx.session_remove(session) -> true | false
+ *
+ */
+static VALUE
+ossl_sslctx_session_remove(VALUE self, VALUE arg)
+{
+ SSL_CTX *ctx;
+ SSL_SESSION *sess;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+ SafeGetSSLSession(arg, sess);
+
+ return SSL_CTX_remove_session(ctx, sess) == 1 ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * ctx.session_cache_mode -> integer
+ *
+ */
+static VALUE
+ossl_sslctx_get_session_cache_mode(VALUE self)
+{
+ SSL_CTX *ctx;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+
+ return LONG2NUM(SSL_CTX_get_session_cache_mode(ctx));
+}
+
+/*
+ * call-seq:
+ * ctx.session_cache_mode=(integer) -> integer
+ *
+ */
+static VALUE
+ossl_sslctx_set_session_cache_mode(VALUE self, VALUE arg)
+{
+ SSL_CTX *ctx;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+
+ SSL_CTX_set_session_cache_mode(ctx, NUM2LONG(arg));
+
+ return arg;
+}
+
+/*
+ * call-seq:
+ * ctx.session_cache_size -> integer
+ *
+ */
+static VALUE
+ossl_sslctx_get_session_cache_size(VALUE self)
+{
+ SSL_CTX *ctx;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+
+ return LONG2NUM(SSL_CTX_sess_get_cache_size(ctx));
+}
+
+/*
+ * call-seq:
+ * ctx.session_cache_size=(integer) -> integer
+ *
+ */
+static VALUE
+ossl_sslctx_set_session_cache_size(VALUE self, VALUE arg)
+{
+ SSL_CTX *ctx;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+
+ SSL_CTX_sess_set_cache_size(ctx, NUM2LONG(arg));
+
+ return arg;
+}
+
+/*
+ * call-seq:
+ * ctx.session_cache_stats -> Hash
+ *
+ */
+static VALUE
+ossl_sslctx_get_session_cache_stats(VALUE self)
+{
+ SSL_CTX *ctx;
+ VALUE hash;
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+
+ hash = rb_hash_new();
+ rb_hash_aset(hash, ID2SYM(rb_intern("cache_num")), LONG2NUM(SSL_CTX_sess_number(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("connect")), LONG2NUM(SSL_CTX_sess_connect(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("connect_good")), LONG2NUM(SSL_CTX_sess_connect_good(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("connect_renegotiate")), LONG2NUM(SSL_CTX_sess_connect_renegotiate(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("accept")), LONG2NUM(SSL_CTX_sess_accept(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("accept_good")), LONG2NUM(SSL_CTX_sess_accept_good(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("accept_renegotiate")), LONG2NUM(SSL_CTX_sess_accept_renegotiate(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("cache_hits")), LONG2NUM(SSL_CTX_sess_hits(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("cb_hits")), LONG2NUM(SSL_CTX_sess_cb_hits(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("cache_misses")), LONG2NUM(SSL_CTX_sess_misses(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("cache_full")), LONG2NUM(SSL_CTX_sess_cache_full(ctx)));
+ rb_hash_aset(hash, ID2SYM(rb_intern("timeouts")), LONG2NUM(SSL_CTX_sess_timeouts(ctx)));
+
+ return hash;
+}
+
+
+/*
+ * call-seq:
+ * ctx.flush_sessions(time | nil) -> self
+ *
+ */
+static VALUE
+ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
+{
+ VALUE arg1;
+ SSL_CTX *ctx;
+ time_t tm = 0;
+ int cb_state;
+
+ rb_scan_args(argc, argv, "01", &arg1);
+
+ Data_Get_Struct(self, SSL_CTX, ctx);
+
+ if (NIL_P(arg1)) {
+ tm = time(0);
+ } else if (rb_obj_is_instance_of(arg1, rb_cTime)) {
+ tm = NUM2LONG(rb_funcall(arg1, rb_intern("to_i"), 0));
+ } else {
+ rb_raise(rb_eArgError, "arg must be Time or nil");
+ }
+
+ SSL_CTX_flush_sessions(ctx, tm);
+
+ return self;
+}
+
/*
* SSLSocket class
*/
@@ -511,6 +859,20 @@ ossl_ssl_s_alloc(VALUE klass)
return Data_Wrap_Struct(klass, 0, ossl_ssl_free, NULL);
}
+/*
+ * call-seq:
+ * SSLSocket.new(io) => aSSLSocket
+ * SSLSocket.new(io, ctx) => aSSLSocket
+ *
+ * === Parameters
+ * * +io+ is a real ruby IO object. Not an IO like object that responds to read/write.
+ * * +ctx+ is an OpenSSLSSL::SSLContext.
+ *
+ * The OpenSSL::Buffering module provides additional IO methods.
+ *
+ * This method will freeze the SSLContext if one is provided;
+ * however, session management is still allowed in the frozen SSLContext.
+ */
static VALUE
ossl_ssl_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -536,7 +898,7 @@ ossl_ssl_setup(VALUE self)
VALUE io, v_ctx, cb;
SSL_CTX *ctx;
SSL *ssl;
- OpenFile *fptr;
+ rb_io_t *fptr;
Data_Get_Struct(self, SSL, ssl);
if(!ssl){
@@ -553,7 +915,7 @@ ossl_ssl_setup(VALUE self)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
rb_io_check_writable(fptr);
- SSL_set_fd(ssl, TO_SOCKET(fileno(fptr->f)));
+ SSL_set_fd(ssl, TO_SOCKET(FPTR_TO_FD(fptr)));
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);
@@ -567,62 +929,85 @@ ossl_ssl_setup(VALUE self)
}
#ifdef _WIN32
-#define ssl_get_error(ssl, ret) \
- (errno = WSAGetLastError(), SSL_get_error(ssl, ret))
+#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)())
+ossl_start_ssl(VALUE self, int (*func)(), const char *funcname)
{
SSL *ssl;
- OpenFile *fptr;
- VALUE cb;
- int ret;
+ rb_io_t *fptr;
+ int ret, ret2;
+ VALUE cb_state;
+
+ rb_ivar_set(self, ID_callback_state, Qnil);
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((ret2 = ssl_get_error(ssl, ret))){
case SSL_ERROR_WANT_WRITE:
- rb_io_wait_writable(fileno(fptr->f));
+ rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- rb_io_wait_readable(fileno(fptr->f));
+ rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_SYSCALL:
- if (errno) rb_sys_fail(0);
+ if (errno) rb_sys_fail(funcname);
+ ossl_raise(eSSLError, "%s SYSCALL returned=%d errno=%d state=%s", funcname, ret2, errno, SSL_state_string_long(ssl));
default:
- ossl_raise(eSSLError, NULL);
+ ossl_raise(eSSLError, "%s returned=%d errno=%d state=%s", funcname, ret2, errno, SSL_state_string_long(ssl));
}
}
+ cb_state = rb_ivar_get(self, ID_callback_state);
+ if (!NIL_P(cb_state))
+ rb_jump_tag(NUM2INT(cb_state));
+
return self;
}
+/*
+ * call-seq:
+ * ssl.connect => self
+ */
static VALUE
ossl_ssl_connect(VALUE self)
{
ossl_ssl_setup(self);
- return ossl_start_ssl(self, SSL_connect);
+ return ossl_start_ssl(self, SSL_connect, "SSL_connect");
}
+/*
+ * call-seq:
+ * ssl.accept => self
+ */
static VALUE
ossl_ssl_accept(VALUE self)
{
ossl_ssl_setup(self);
- return ossl_start_ssl(self, SSL_accept);
+ return ossl_start_ssl(self, SSL_accept, "SSL_accept");
}
+/*
+ * call-seq:
+ * ssl.sysread(length) => string
+ * ssl.sysread(length, buffer) => buffer
+ *
+ * === Parameters
+ * * +length+ is a positive integer.
+ * * +buffer+ is a string used to store the result.
+ */
static VALUE
ossl_ssl_read(int argc, VALUE *argv, VALUE self)
{
SSL *ssl;
int ilen, nread = 0;
VALUE len, str;
- OpenFile *fptr;
+ rb_io_t *fptr;
rb_scan_args(argc, argv, "11", &len, &str);
ilen = NUM2INT(len);
@@ -638,19 +1023,19 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self)
GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
if(SSL_pending(ssl) <= 0)
- rb_thread_wait_fd(fileno(fptr->f));
+ rb_thread_wait_fd(FPTR_TO_FD(fptr));
for (;;){
- nread = SSL_read(ssl, RSTRING(str)->ptr, RSTRING(str)->len);
+ nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LEN(str));
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));
+ rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- rb_io_wait_readable(fileno(fptr->f));
+ rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_SYSCALL:
if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
@@ -667,19 +1052,22 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self)
}
end:
- RSTRING(str)->len = nread;
- RSTRING(str)->ptr[nread] = 0;
+ rb_str_set_len(str, nread);
OBJ_TAINT(str);
return str;
}
+/*
+ * call-seq:
+ * ssl.syswrite(string) => integer
+ */
static VALUE
ossl_ssl_write(VALUE self, VALUE str)
{
SSL *ssl;
int nwrite = 0;
- OpenFile *fptr;
+ rb_io_t *fptr;
StringValue(str);
Data_Get_Struct(self, SSL, ssl);
@@ -687,15 +1075,15 @@ ossl_ssl_write(VALUE self, VALUE str)
if (ssl) {
for (;;){
- nwrite = SSL_write(ssl, RSTRING(str)->ptr, RSTRING(str)->len);
+ nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LEN(str));
switch(ssl_get_error(ssl, nwrite)){
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_WANT_WRITE:
- rb_io_wait_writable(fileno(fptr->f));
+ rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- rb_io_wait_readable(fileno(fptr->f));
+ rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_SYSCALL:
if (errno) rb_sys_fail(0);
@@ -714,6 +1102,10 @@ ossl_ssl_write(VALUE self, VALUE str)
return INT2NUM(nwrite);
}
+/*
+ * call-seq:
+ * ssl.sysclose => nil
+ */
static VALUE
ossl_ssl_close(VALUE self)
{
@@ -727,6 +1119,10 @@ ossl_ssl_close(VALUE self)
return Qnil;
}
+/*
+ * call-seq:
+ * ssl.cert => cert or nil
+ */
static VALUE
ossl_ssl_get_cert(VALUE self)
{
@@ -751,6 +1147,10 @@ ossl_ssl_get_cert(VALUE self)
return ossl_x509_new(cert);
}
+/*
+ * call-seq:
+ * ssl.peer_cert => cert or nil
+ */
static VALUE
ossl_ssl_get_peer_cert(VALUE self)
{
@@ -776,6 +1176,10 @@ ossl_ssl_get_peer_cert(VALUE self)
return obj;
}
+/*
+ * call-seq:
+ * ssl.peer_cert_chain => [cert, ...] or nil
+ */
static VALUE
ossl_ssl_get_peer_cert_chain(VALUE self)
{
@@ -802,6 +1206,10 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
return ary;
}
+/*
+ * call-seq:
+ * ssl.cipher => [name, version, bits, alg_bits]
+ */
static VALUE
ossl_ssl_get_cipher(VALUE self)
{
@@ -818,6 +1226,10 @@ ossl_ssl_get_cipher(VALUE self)
return ossl_ssl_cipher_to_ary(cipher);
}
+/*
+ * call-seq:
+ * ssl.state => string
+ */
static VALUE
ossl_ssl_get_state(VALUE self)
{
@@ -837,6 +1249,10 @@ ossl_ssl_get_state(VALUE self)
return ret;
}
+/*
+ * call-seq:
+ * ssl.pending => integer
+ */
static VALUE
ossl_ssl_pending(VALUE self)
{
@@ -851,10 +1267,82 @@ ossl_ssl_pending(VALUE self)
return INT2NUM(SSL_pending(ssl));
}
+/*
+ * call-seq:
+ * ssl.session_reused? -> true | false
+ *
+ */
+static VALUE
+ossl_ssl_session_reused(VALUE self)
+{
+ SSL *ssl;
+
+ Data_Get_Struct(self, SSL, ssl);
+ if (!ssl) {
+ rb_warning("SSL session is not started yet.");
+ return Qnil;
+ }
+
+ switch(SSL_session_reused(ssl)) {
+ case 1: return Qtrue;
+ case 0: return Qfalse;
+ default: ossl_raise(eSSLError, "SSL_session_reused");
+ }
+}
+
+/*
+ * call-seq:
+ * ssl.session = session -> session
+ *
+ */
+static VALUE
+ossl_ssl_set_session(VALUE self, VALUE arg1)
+{
+ SSL *ssl;
+ SSL_SESSION *sess;
+
+/* why is ossl_ssl_setup delayed? */
+ ossl_ssl_setup(self);
+
+ Data_Get_Struct(self, SSL, ssl);
+ if (!ssl) {
+ rb_warning("SSL session is not started yet.");
+ return Qnil;
+ }
+
+ SafeGetSSLSession(arg1, sess);
+
+ if (SSL_set_session(ssl, sess) != 1)
+ ossl_raise(eSSLError, "SSL_set_session");
+
+ return arg1;
+}
+
+static VALUE
+ossl_ssl_get_verify_result(VALUE self)
+{
+ SSL *ssl;
+
+ Data_Get_Struct(self, SSL, ssl);
+ if (!ssl) {
+ rb_warning("SSL session is not started yet.");
+ return Qnil;
+ }
+
+ return INT2FIX(SSL_get_verify_result(ssl));
+}
+
void
Init_ossl_ssl()
{
int i;
+ VALUE ary;
+
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+#endif
+
+ ID_callback_state = rb_intern("@callback_state");
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);
@@ -867,16 +1355,60 @@ Init_ossl_ssl()
mSSL = rb_define_module_under(mOSSL, "SSL");
eSSLError = rb_define_class_under(mSSL, "SSLError", eOSSLError);
- /* class SSLContext */
+ Init_ossl_ssl_session();
+
+ /* class SSLContext
+ *
+ * The following attributes are available but don't show up in rdoc.
+ * All attributes must be set before calling SSLSocket.new(io, ctx).
+ * * ssl_version, cert, key, client_ca, ca_file, ca_path, timeout,
+ * * verify_mode, verify_depth client_cert_cb, tmp_dh_callback,
+ * * session_id_context, session_add_cb, session_new_cb, session_remove_cb
+ */
cSSLContext = rb_define_class_under(mSSL, "SSLContext", rb_cObject);
rb_define_alloc_func(cSSLContext, ossl_sslctx_s_alloc);
for(i = 0; i < numberof(ossl_sslctx_attrs); i++)
rb_attr(cSSLContext, rb_intern(ossl_sslctx_attrs[i]), 1, 1, Qfalse);
+ rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
rb_define_method(cSSLContext, "initialize", ossl_sslctx_initialize, -1);
+ rb_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1);
rb_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers, 0);
rb_define_method(cSSLContext, "ciphers=", ossl_sslctx_set_ciphers, 1);
- /* class SSLSocket */
+ rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
+
+
+ rb_define_const(cSSLContext, "SESSION_CACHE_OFF", LONG2FIX(SSL_SESS_CACHE_OFF));
+ rb_define_const(cSSLContext, "SESSION_CACHE_CLIENT", LONG2FIX(SSL_SESS_CACHE_CLIENT)); /* doesn't actually do anything in 0.9.8e */
+ rb_define_const(cSSLContext, "SESSION_CACHE_SERVER", LONG2FIX(SSL_SESS_CACHE_SERVER));
+ rb_define_const(cSSLContext, "SESSION_CACHE_BOTH", LONG2FIX(SSL_SESS_CACHE_BOTH)); /* no different than CACHE_SERVER in 0.9.8e */
+ rb_define_const(cSSLContext, "SESSION_CACHE_NO_AUTO_CLEAR", LONG2FIX(SSL_SESS_CACHE_NO_AUTO_CLEAR));
+ rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL_LOOKUP", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP));
+ rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL_STORE", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL_STORE));
+ rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL));
+ rb_define_method(cSSLContext, "session_add", ossl_sslctx_session_add, 1);
+ rb_define_method(cSSLContext, "session_remove", ossl_sslctx_session_remove, 1);
+ rb_define_method(cSSLContext, "session_cache_mode", ossl_sslctx_get_session_cache_mode, 0);
+ rb_define_method(cSSLContext, "session_cache_mode=", ossl_sslctx_set_session_cache_mode, 1);
+ rb_define_method(cSSLContext, "session_cache_size", ossl_sslctx_get_session_cache_size, 0);
+ rb_define_method(cSSLContext, "session_cache_size=", ossl_sslctx_set_session_cache_size, 1);
+ rb_define_method(cSSLContext, "session_cache_stats", ossl_sslctx_get_session_cache_stats, 0);
+ rb_define_method(cSSLContext, "flush_sessions", ossl_sslctx_flush_sessions, -1);
+
+ ary = rb_ary_new2(numberof(ossl_ssl_method_tab));
+ for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
+ rb_ary_push(ary, ID2SYM(rb_intern(ossl_ssl_method_tab[i].name)));
+ }
+ rb_obj_freeze(ary);
+ /* holds a list of available SSL/TLS methods */
+ rb_define_const(cSSLContext, "METHODS", ary);
+
+ /* class SSLSocket
+ *
+ * The following attributes are available but don't show up in rdoc.
+ * * io, context, sync_close
+ *
+ */
cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject);
rb_define_alloc_func(cSSLSocket, ossl_ssl_s_alloc);
for(i = 0; i < numberof(ossl_ssl_attr_readers); i++)
@@ -896,6 +1428,9 @@ Init_ossl_ssl()
rb_define_method(cSSLSocket, "cipher", ossl_ssl_get_cipher, 0);
rb_define_method(cSSLSocket, "state", ossl_ssl_get_state, 0);
rb_define_method(cSSLSocket, "pending", ossl_ssl_pending, 0);
+ rb_define_method(cSSLSocket, "session_reused?", ossl_ssl_session_reused, 0);
+ rb_define_method(cSSLSocket, "session=", ossl_ssl_set_session, 1);
+ rb_define_method(cSSLSocket, "verify_result", ossl_ssl_get_verify_result, 0);
#define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2FIX(SSL_##x))
@@ -931,6 +1466,9 @@ Init_ossl_ssl()
ossl_ssl_def_const(OP_NO_SSLv2);
ossl_ssl_def_const(OP_NO_SSLv3);
ossl_ssl_def_const(OP_NO_TLSv1);
+#if defined(SSL_OP_NO_TICKET)
+ ossl_ssl_def_const(OP_NO_TICKET);
+#endif
ossl_ssl_def_const(OP_PKCS1_CHECK_1);
ossl_ssl_def_const(OP_PKCS1_CHECK_2);
ossl_ssl_def_const(OP_NETSCAPE_CA_DN_BUG);
diff --git a/ext/openssl/ossl_ssl.h b/ext/openssl/ossl_ssl.h
index 5929eef856..487f41216c 100644
--- a/ext/openssl/ossl_ssl.h
+++ b/ext/openssl/ossl_ssl.h
@@ -11,11 +11,26 @@
#if !defined(_OSSL_SSL_H_)
#define _OSSL_SSL_H_
+#define GetSSLSession(obj, sess) do { \
+ Data_Get_Struct(obj, SSL_SESSION, sess); \
+ if (!sess) { \
+ ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
+ } \
+} while (0)
+
+#define SafeGetSSLSession(obj, sess) do { \
+ OSSL_Check_Kind(obj, cSSLSession); \
+ GetSSLSession(obj, sess); \
+} while (0)
+
extern VALUE mSSL;
extern VALUE eSSLError;
extern VALUE cSSLSocket;
extern VALUE cSSLContext;
+extern VALUE cSSLSession;
void Init_ossl_ssl(void);
+void Init_ossl_ssl_session(void);
#endif /* _OSSL_SSL_H_ */
+
diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c
new file mode 100644
index 0000000000..63c2bbb87a
--- /dev/null
+++ b/ext/openssl/ossl_ssl_session.c
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2004-2007 Technorama Ltd. <oss-ruby@technorama.net>
+ */
+
+#include "ossl.h"
+
+#define GetSSLSession(obj, sess) do { \
+ Data_Get_Struct(obj, SSL_SESSION, sess); \
+ if (!sess) { \
+ ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
+ } \
+} while (0)
+
+#define SafeGetSSLSession(obj, sess) do { \
+ OSSL_Check_Kind(obj, cSSLSession); \
+ GetSSLSession(obj, sess); \
+} while (0)
+
+
+VALUE cSSLSession;
+static VALUE eSSLSession;
+
+static VALUE ossl_ssl_session_alloc(VALUE klass)
+{
+ return Data_Wrap_Struct(klass, 0, SSL_SESSION_free, NULL);
+}
+
+/*
+ * call-seq:
+ * Session.new(SSLSocket | string) => session
+ *
+ * === Parameters
+ * +SSLSocket+ is an OpenSSL::SSL::SSLSocket
+ * +string+ must be a DER or PEM encoded Session.
+*/
+static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1)
+{
+ SSL_SESSION *ctx = NULL;
+ VALUE obj;
+ unsigned char *p;
+
+ if (RDATA(self)->data)
+ ossl_raise(eSSLSession, "SSL Session already initialized");
+
+ if (rb_obj_is_instance_of(arg1, cSSLSocket)) {
+ SSL *ssl;
+
+ Data_Get_Struct(arg1, SSL, ssl);
+
+ if (!ssl || (ctx = SSL_get1_session(ssl)) == NULL)
+ ossl_raise(eSSLSession, "no session available");
+ } else {
+ BIO *in = ossl_obj2bio(arg1);
+
+ ctx = PEM_read_bio_SSL_SESSION(in, NULL, NULL, NULL);
+
+ if (!ctx) {
+ BIO_reset(in);
+ ctx = d2i_SSL_SESSION_bio(in, NULL);
+ }
+
+ BIO_free(in);
+
+ if (!ctx)
+ ossl_raise(rb_eArgError, "unknown type");
+ }
+
+ /* should not happen */
+ if (ctx == NULL)
+ ossl_raise(eSSLSession, "ctx not set - internal error");
+
+ RDATA(self)->data = ctx;
+
+ return self;
+}
+
+/*
+ * call-seq:
+ * session1 == session2 -> boolean
+ *
+*/
+static VALUE ossl_ssl_session_eq(VALUE val1, VALUE val2)
+{
+ SSL_SESSION *ctx1, *ctx2;
+
+ GetSSLSession(val1, ctx1);
+ SafeGetSSLSession(val2, ctx2);
+
+ switch (SSL_SESSION_cmp(ctx1, ctx2)) {
+ case 0: return Qtrue;
+ default: return Qfalse;
+ }
+}
+
+/*
+ * call-seq:
+ * session.time -> Time
+ *
+*/
+static VALUE ossl_ssl_session_get_time(VALUE self)
+{
+ SSL_SESSION *ctx;
+ time_t t;
+
+ GetSSLSession(self, ctx);
+
+ t = SSL_SESSION_get_time(ctx);
+
+ if (t == 0)
+ return Qnil;
+
+ return rb_funcall(rb_cTime, rb_intern("at"), 1, LONG2NUM(t));
+}
+
+/*
+ * call-seq:
+ * session.timeout -> integer
+ *
+ * How long until the session expires in seconds.
+ *
+*/
+static VALUE ossl_ssl_session_get_timeout(VALUE self)
+{
+ SSL_SESSION *ctx;
+ time_t t;
+
+ GetSSLSession(self, ctx);
+
+ t = SSL_SESSION_get_timeout(ctx);
+
+ return ULONG2NUM(t);
+}
+
+#define SSLSESSION_SET_TIME(func) \
+ static VALUE ossl_ssl_session_set_##func(VALUE self, VALUE time_v) \
+ { \
+ SSL_SESSION *ctx; \
+ time_t t; \
+ \
+ GetSSLSession(self, ctx); \
+ \
+ if (rb_obj_is_instance_of(time_v, rb_cTime)) { \
+ time_v = rb_funcall(time_v, rb_intern("to_i"), 0); \
+ } else if (FIXNUM_P(time_v)) { \
+ ; \
+ } else { \
+ rb_raise(rb_eArgError, "unknown type"); \
+ } \
+ \
+ t = NUM2ULONG(time_v); \
+ \
+ SSL_SESSION_set_##func(ctx, t); \
+ \
+ return ossl_ssl_session_get_##func(self); \
+ }
+
+SSLSESSION_SET_TIME(time)
+SSLSESSION_SET_TIME(timeout)
+
+#ifdef HAVE_SSL_SESSION_GET_ID
+/*
+ * call-seq:
+ * session.id -> aString
+ *
+ * Returns the Session ID.
+*/
+static VALUE ossl_ssl_session_get_id(VALUE self)
+{
+ SSL_SESSION *ctx;
+ const unsigned char *p = NULL;
+ unsigned int i = 0;
+
+ GetSSLSession(self, ctx);
+
+ p = SSL_SESSION_get_id(ctx, &i);
+
+ return rb_str_new((const char *) p, i);
+}
+#endif
+
+/*
+ * call-seq:
+ * session.to_der -> aString
+ *
+ * Returns an ASN1 encoded String that contains the Session object.
+*/
+static VALUE ossl_ssl_session_to_der(VALUE self)
+{
+ SSL_SESSION *ctx;
+ unsigned char buf[1024*10], *p;
+ int len;
+
+ GetSSLSession(self, ctx);
+
+ p = buf;
+ len = i2d_SSL_SESSION(ctx, &p);
+
+ if (len <= 0)
+ ossl_raise(eSSLSession, "i2d_SSL_SESSION");
+ else if (len >= sizeof(buf))
+ ossl_raise(eSSLSession, "i2d_SSL_SESSION too large");
+
+ return rb_str_new((const char *) p, len);
+}
+
+/*
+ * call-seq:
+ * session.to_pem -> String
+ *
+ * Returns a PEM encoded String that contains the Session object.
+*/
+static VALUE ossl_ssl_session_to_pem(VALUE self)
+{
+ SSL_SESSION *ctx;
+ BIO *out;
+ BUF_MEM *buf;
+ VALUE str;
+ int i;
+
+ GetSSLSession(self, ctx);
+
+ if (!(out = BIO_new(BIO_s_mem()))) {
+ ossl_raise(eSSLSession, "BIO_s_mem()");
+ }
+
+ if (!(i=PEM_write_bio_SSL_SESSION(out, ctx))) {
+ BIO_free(out);
+ ossl_raise(eSSLSession, "SSL_SESSION_print()");
+ }
+
+ BIO_get_mem_ptr(out, &buf);
+ str = rb_str_new(buf->data, buf->length);
+ BIO_free(out);
+
+ return str;
+}
+
+
+/*
+ * call-seq:
+ * session.to_text -> String
+ *
+ * Shows everything in the Session object.
+*/
+static VALUE ossl_ssl_session_to_text(VALUE self)
+{
+ SSL_SESSION *ctx;
+ BIO *out;
+ BUF_MEM *buf;
+ VALUE str;
+
+ GetSSLSession(self, ctx);
+
+ if (!(out = BIO_new(BIO_s_mem()))) {
+ ossl_raise(eSSLSession, "BIO_s_mem()");
+ }
+
+ if (!SSL_SESSION_print(out, ctx)) {
+ BIO_free(out);
+ ossl_raise(eSSLSession, "SSL_SESSION_print()");
+ }
+
+ BIO_get_mem_ptr(out, &buf);
+ str = rb_str_new(buf->data, buf->length);
+ BIO_free(out);
+
+ return str;
+}
+
+
+void Init_ossl_ssl_session(void)
+{
+#if 0 /* let rdoc know about mOSSL */
+ mOSSL = rb_define_module("OpenSSL");
+ mSSL = rb_define_module_under(mOSSL, "SSL");
+#endif
+ cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject);
+ eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError);
+
+ rb_define_alloc_func(cSSLSession, ossl_ssl_session_alloc);
+ rb_define_method(cSSLSession, "initialize", ossl_ssl_session_initialize, 1);
+
+ rb_define_method(cSSLSession, "==", ossl_ssl_session_eq, 1);
+
+ rb_define_method(cSSLSession, "time", ossl_ssl_session_get_time, 0);
+ rb_define_method(cSSLSession, "time=", ossl_ssl_session_set_time, 1);
+ rb_define_method(cSSLSession, "timeout", ossl_ssl_session_get_timeout, 0);
+ rb_define_method(cSSLSession, "timeout=", ossl_ssl_session_set_timeout, 1);
+
+#ifdef HAVE_SSL_SESSION_GET_ID
+ rb_define_method(cSSLSession, "id", ossl_ssl_session_get_id, 0);
+#else
+ rb_undef_method(cSSLSession, "id");
+#endif
+ rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
+ rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
+ rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
+}
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index 7b88e294a9..ca1c59aba9 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -84,6 +84,10 @@ ossl_x509attr_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * Attribute.new(oid [, value]) => attr
+ */
static VALUE
ossl_x509attr_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -95,9 +99,9 @@ ossl_x509attr_initialize(int argc, VALUE *argv, VALUE self)
if(rb_scan_args(argc, argv, "11", &oid, &value) == 1){
oid = ossl_to_der_if_possible(oid);
StringValue(oid);
- p = RSTRING(oid)->ptr;
+ p = RSTRING_PTR(oid);
if(!d2i_X509_ATTRIBUTE((X509_ATTRIBUTE**)&DATA_PTR(self),
- &p, RSTRING(oid)->len)){
+ &p, RSTRING_LEN(oid))){
ossl_raise(eX509AttrError, NULL);
}
return self;
@@ -108,6 +112,10 @@ ossl_x509attr_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * attr.oid = string => string
+ */
static VALUE
ossl_x509attr_set_oid(VALUE self, VALUE oid)
{
@@ -125,6 +133,10 @@ ossl_x509attr_set_oid(VALUE self, VALUE oid)
return oid;
}
+/*
+ * call-seq:
+ * attr.oid => string
+ */
static VALUE
ossl_x509attr_get_oid(VALUE self)
{
@@ -156,6 +168,10 @@ ossl_x509attr_get_oid(VALUE self)
# define OSSL_X509ATTR_SET_SINGLE(attr) ((attr)->set = 0)
#endif
+/*
+ * call-seq:
+ * attr.value = asn1 => asn1
+ */
static VALUE
ossl_x509attr_set_value(VALUE self, VALUE value)
{
@@ -179,6 +195,10 @@ ossl_x509attr_set_value(VALUE self, VALUE value)
return value;
}
+/*
+ * call-seq:
+ * attr.value => asn1
+ */
static VALUE
ossl_x509attr_get_value(VALUE self)
{
@@ -192,7 +212,7 @@ ossl_x509attr_get_value(VALUE self)
if(OSSL_X509ATTR_IS_SINGLE(attr)){
length = i2d_ASN1_TYPE(attr->value.single, NULL);
str = rb_str_new(0, length);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
i2d_ASN1_TYPE(attr->value.single, &p);
ossl_str_adjust(str, p);
}
@@ -200,7 +220,7 @@ ossl_x509attr_get_value(VALUE self)
length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL,
i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
str = rb_str_new(0, length);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
ossl_str_adjust(str, p);
@@ -210,6 +230,10 @@ ossl_x509attr_get_value(VALUE self)
return asn1;
}
+/*
+ * call-seq:
+ * attr.to_der => string
+ */
static VALUE
ossl_x509attr_to_der(VALUE self)
{
@@ -222,10 +246,10 @@ ossl_x509attr_to_der(VALUE self)
if((len = i2d_X509_ATTRIBUTE(attr, NULL)) <= 0)
ossl_raise(eX509AttrError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_X509_ATTRIBUTE(attr, &p) <= 0)
ossl_raise(eX509AttrError, NULL);
- RSTRING(str)->len = p - (unsigned char*)RSTRING(str)->ptr;
+ rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str));
return str;
}
diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c
index fc587a31f3..b97f27ffa9 100644
--- a/ext/openssl/ossl_x509cert.c
+++ b/ext/openssl/ossl_x509cert.c
@@ -63,7 +63,7 @@ ossl_x509_new_from_file(VALUE filename)
VALUE obj;
SafeStringValue(filename);
- if (!(fp = fopen(RSTRING(filename)->ptr, "r"))) {
+ if (!(fp = fopen(RSTRING_PTR(filename), "r"))) {
ossl_raise(eX509CertError, "%s", strerror(errno));
}
x509 = PEM_read_X509(fp, NULL, NULL, NULL);
@@ -125,6 +125,11 @@ ossl_x509_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * Certificate.new => cert
+ * Certificate.new(string) => cert
+ */
static VALUE
ossl_x509_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -169,6 +174,10 @@ ossl_x509_copy(VALUE self, VALUE other)
return self;
}
+/*
+ * call-seq:
+ * cert.to_der => string
+ */
static VALUE
ossl_x509_to_der(VALUE self)
{
@@ -181,7 +190,7 @@ ossl_x509_to_der(VALUE self)
if ((len = i2d_X509(x509, NULL)) <= 0)
ossl_raise(eX509CertError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if (i2d_X509(x509, &p) <= 0)
ossl_raise(eX509CertError, NULL);
ossl_str_adjust(str, p);
@@ -189,6 +198,10 @@ ossl_x509_to_der(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * cert.to_pem => string
+ */
static VALUE
ossl_x509_to_pem(VALUE self)
{
@@ -209,6 +222,10 @@ ossl_x509_to_pem(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * cert.to_text => string
+ */
static VALUE
ossl_x509_to_text(VALUE self)
{
@@ -252,6 +269,10 @@ ossl_x509_to_req(VALUE self)
}
#endif
+/*
+ * call-seq:
+ * cert.version => integer
+ */
static VALUE
ossl_x509_get_version(VALUE self)
{
@@ -262,6 +283,10 @@ ossl_x509_get_version(VALUE self)
return LONG2NUM(X509_get_version(x509));
}
+/*
+ * call-seq:
+ * cert.version = integer => integer
+ */
static VALUE
ossl_x509_set_version(VALUE self, VALUE version)
{
@@ -279,6 +304,10 @@ ossl_x509_set_version(VALUE self, VALUE version)
return version;
}
+/*
+ * call-seq:
+ * cert.serial => integer
+ */
static VALUE
ossl_x509_get_serial(VALUE self)
{
@@ -289,6 +318,10 @@ ossl_x509_get_serial(VALUE self)
return asn1integer_to_num(X509_get_serialNumber(x509));
}
+/*
+ * call-seq:
+ * cert.serial = integer => integer
+ */
static VALUE
ossl_x509_set_serial(VALUE self, VALUE num)
{
@@ -302,6 +335,10 @@ ossl_x509_set_serial(VALUE self, VALUE num)
return num;
}
+/*
+ * call-seq:
+ * cert.signature_algorithm => string
+ */
static VALUE
ossl_x509_get_signature_algorithm(VALUE self)
{
@@ -322,6 +359,10 @@ ossl_x509_get_signature_algorithm(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * cert.subject => name
+ */
static VALUE
ossl_x509_get_subject(VALUE self)
{
@@ -336,6 +377,10 @@ ossl_x509_get_subject(VALUE self)
return ossl_x509name_new(name);
}
+/*
+ * call-seq:
+ * cert.subject = name => name
+ */
static VALUE
ossl_x509_set_subject(VALUE self, VALUE subject)
{
@@ -349,6 +394,10 @@ ossl_x509_set_subject(VALUE self, VALUE subject)
return subject;
}
+/*
+ * call-seq:
+ * cert.issuer => name
+ */
static VALUE
ossl_x509_get_issuer(VALUE self)
{
@@ -363,6 +412,10 @@ ossl_x509_get_issuer(VALUE self)
return ossl_x509name_new(name);
}
+/*
+ * call-seq:
+ * cert.issuer = name => name
+ */
static VALUE
ossl_x509_set_issuer(VALUE self, VALUE issuer)
{
@@ -376,6 +429,10 @@ ossl_x509_set_issuer(VALUE self, VALUE issuer)
return issuer;
}
+/*
+ * call-seq:
+ * cert.not_before => time
+ */
static VALUE
ossl_x509_get_not_before(VALUE self)
{
@@ -390,6 +447,10 @@ ossl_x509_get_not_before(VALUE self)
return asn1time_to_time(asn1time);
}
+/*
+ * call-seq:
+ * cert.not_before = time => time
+ */
static VALUE
ossl_x509_set_not_before(VALUE self, VALUE time)
{
@@ -405,6 +466,10 @@ ossl_x509_set_not_before(VALUE self, VALUE time)
return time;
}
+/*
+ * call-seq:
+ * cert.not_after => time
+ */
static VALUE
ossl_x509_get_not_after(VALUE self)
{
@@ -419,6 +484,10 @@ ossl_x509_get_not_after(VALUE self)
return asn1time_to_time(asn1time);
}
+/*
+ * call-seq:
+ * cert.not_before = time => time
+ */
static VALUE
ossl_x509_set_not_after(VALUE self, VALUE time)
{
@@ -434,6 +503,10 @@ ossl_x509_set_not_after(VALUE self, VALUE time)
return time;
}
+/*
+ * call-seq:
+ * cert.public_key => key
+ */
static VALUE
ossl_x509_get_public_key(VALUE self)
{
@@ -448,6 +521,10 @@ ossl_x509_get_public_key(VALUE self)
return ossl_pkey_new(pkey); /* NO DUP - OK */
}
+/*
+ * call-seq:
+ * cert.public_key = key => key
+ */
static VALUE
ossl_x509_set_public_key(VALUE self, VALUE key)
{
@@ -461,6 +538,10 @@ ossl_x509_set_public_key(VALUE self, VALUE key)
return key;
}
+/*
+ * call-seq:
+ * cert.sign(key, digest) => self
+ */
static VALUE
ossl_x509_sign(VALUE self, VALUE key, VALUE digest)
{
@@ -479,6 +560,9 @@ ossl_x509_sign(VALUE self, VALUE key, VALUE digest)
}
/*
+ * call-seq:
+ * cert.verify(key) => true | false
+ *
* Checks that cert signature is made with PRIVversion of this PUBLIC 'key'
*/
static VALUE
@@ -501,6 +585,9 @@ ossl_x509_verify(VALUE self, VALUE key)
}
/*
+ * call-seq:
+ * cert.check_private_key(key)
+ *
* Checks if 'key' is PRIV key for this cert
*/
static VALUE
@@ -521,7 +608,8 @@ ossl_x509_check_private_key(VALUE self, VALUE key)
}
/*
- * Gets X509v3 extensions as array of X509Ext objects
+ * call-seq:
+ * cert.extensions => [extension...]
*/
static VALUE
ossl_x509_get_extensions(VALUE self)
@@ -546,7 +634,8 @@ ossl_x509_get_extensions(VALUE self)
}
/*
- * Sets X509_EXTENSIONs
+ * call-seq:
+ * cert.extensions = [ext...] => [ext...]
*/
static VALUE
ossl_x509_set_extensions(VALUE self, VALUE ary)
@@ -557,14 +646,14 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
Check_Type(ary, T_ARRAY);
/* All ary's members should be X509Extension */
- for (i=0; i<RARRAY(ary)->len; i++) {
- OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Ext);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509(self, x509);
sk_X509_EXTENSION_pop_free(x509->cert_info->extensions, X509_EXTENSION_free);
x509->cert_info->extensions = NULL;
- for (i=0; i<RARRAY(ary)->len; i++) {
- ext = DupX509ExtPtr(RARRAY(ary)->ptr[i]);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ ext = DupX509ExtPtr(RARRAY_PTR(ary)[i]);
if (!X509_add_ext(x509, ext, -1)) { /* DUPs ext - FREE it */
X509_EXTENSION_free(ext);
@@ -576,6 +665,10 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
return ary;
}
+/*
+ * call-seq:
+ * cert.add_extension(extension) => extension
+ */
static VALUE
ossl_x509_add_extension(VALUE self, VALUE extension)
{
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index 0dc22416e7..be9ddacf48 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -287,14 +287,14 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary)
Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Revoked */
- for (i=0; i<RARRAY(ary)->len; i++) {
- OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Rev);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Rev);
}
GetX509CRL(self, crl);
sk_X509_REVOKED_pop_free(crl->crl->revoked, X509_REVOKED_free);
crl->crl->revoked = NULL;
- for (i=0; i<RARRAY(ary)->len; i++) {
- rev = DupX509RevokedPtr(RARRAY(ary)->ptr[i]);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ rev = DupX509RevokedPtr(RARRAY_PTR(ary)[i]);
if (!X509_CRL_add0_revoked(crl, rev)) { /* NO DUP - don't free! */
ossl_raise(eX509CRLError, NULL);
}
@@ -461,14 +461,14 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary)
Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Extensions */
- for (i=0; i<RARRAY(ary)->len; i++) {
- OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Ext);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509CRL(self, crl);
sk_X509_EXTENSION_pop_free(crl->crl->extensions, X509_EXTENSION_free);
crl->crl->extensions = NULL;
- for (i=0; i<RARRAY(ary)->len; i++) {
- ext = DupX509ExtPtr(RARRAY(ary)->ptr[i]);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ ext = DupX509ExtPtr(RARRAY_PTR(ary)[i]);
if(!X509_CRL_add_ext(crl, ext, -1)) { /* DUPs ext - FREE it */
X509_EXTENSION_free(ext);
ossl_raise(eX509CRLError, NULL);
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index 8ba555d3e0..aa9366f901 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -26,9 +26,12 @@
OSSL_Check_Kind(obj, cX509Ext); \
GetX509Ext(obj, ext); \
} while (0)
-
-#define MakeX509ExtFactory(klass, obj, ctx) \
- obj = Data_Make_Struct(klass, X509V3_CTX, 0, ossl_x509extfactory_free, ctx)
+#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 GetX509ExtFactory(obj, ctx) do { \
Data_Get_Struct(obj, X509V3_CTX, ctx); \
if (!ctx) { \
@@ -214,22 +217,35 @@ 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);
StringValue(value);
if(NIL_P(critical)) critical = Qfalse;
- nid = OBJ_ln2nid(RSTRING(oid)->ptr);
- if(!nid) nid = OBJ_sn2nid(RSTRING(oid)->ptr);
- if(!nid) ossl_raise(eX509ExtError, "unknown OID `%s'", RSTRING(oid)->ptr);
+ nid = OBJ_ln2nid(RSTRING_PTR(oid));
+ if(!nid) nid = OBJ_sn2nid(RSTRING_PTR(oid));
+ if(!nid) ossl_raise(eX509ExtError, "unknown OID `%s'", RSTRING_PTR(oid));
valstr = rb_str_new2(RTEST(critical) ? "critical," : "");
rb_str_append(valstr, value);
GetX509ExtFactory(self, ctx);
- ext = X509V3_EXT_conf_nid(NULL, ctx, nid, RSTRING(valstr)->ptr);
+#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_PTR(valstr));
+#else
+ if (!empty_lhash) empty_lhash = lh_new(NULL, NULL);
+ ext = X509V3_EXT_conf_nid(empty_lhash, ctx, nid, RSTRING_PTR(valstr));
+#endif
if (!ext){
ossl_raise(eX509ExtError, "%s = %s",
- RSTRING(oid)->ptr, RSTRING(value)->ptr);
+ RSTRING_PTR(oid), RSTRING_PTR(value));
}
WrapX509Ext(cX509Ext, obj, ext);
@@ -264,9 +280,9 @@ ossl_x509ext_initialize(int argc, VALUE *argv, VALUE self)
if(rb_scan_args(argc, argv, "12", &oid, &value, &critical) == 1){
oid = ossl_to_der_if_possible(oid);
StringValue(oid);
- p = RSTRING(oid)->ptr;
+ p = RSTRING_PTR(oid);
if(!d2i_X509_EXTENSION((X509_EXTENSION**)&DATA_PTR(self),
- &p, RSTRING(oid)->len))
+ &p, RSTRING_LEN(oid)))
ossl_raise(eX509ExtError, NULL);
return self;
}
@@ -303,14 +319,14 @@ ossl_x509ext_set_value(VALUE self, VALUE data)
data = ossl_to_der_if_possible(data);
StringValue(data);
- if(!(s = OPENSSL_malloc(RSTRING(data)->len)))
+ if(!(s = OPENSSL_malloc(RSTRING_LEN(data))))
ossl_raise(eX509ExtError, "malloc error");
- memcpy(s, RSTRING(data)->ptr, RSTRING(data)->len);
+ memcpy(s, RSTRING_PTR(data), RSTRING_LEN(data));
if(!(asn1s = ASN1_OCTET_STRING_new())){
free(s);
ossl_raise(eX509ExtError, NULL);
}
- if(!M_ASN1_OCTET_STRING_set(asn1s, s, RSTRING(data)->len)){
+ if(!M_ASN1_OCTET_STRING_set(asn1s, s, RSTRING_LEN(data))){
free(s);
ASN1_OCTET_STRING_free(asn1s);
ossl_raise(eX509ExtError, NULL);
@@ -393,7 +409,7 @@ ossl_x509ext_to_der(VALUE obj)
if((len = i2d_X509_EXTENSION(ext, NULL)) <= 0)
ossl_raise(eX509ExtError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_X509_EXTENSION(ext, &p) < 0)
ossl_raise(eX509ExtError, NULL);
ossl_str_adjust(str, p);
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index c5ed8b5457..b4434d2a34 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -109,6 +109,13 @@ ossl_x509name_init_i(VALUE i, VALUE args)
return Qnil;
}
+/*
+ * call-seq:
+ * X509::Name.new => name
+ * X509::Name.new(string) => name
+ * X509::Name.new(dn) => name
+ * X509::Name.new(dn, template) => name
+ */
static VALUE
ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -125,14 +132,14 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
VALUE args;
if(NIL_P(template)) template = OBJECT_TYPE_TEMPLATE;
args = rb_ary_new3(2, self, template);
- rb_iterate(rb_each, tmp, ossl_x509name_init_i, args);
+ rb_block_call(tmp, rb_intern("each"), 0, 0, ossl_x509name_init_i, args);
}
else{
unsigned char *p;
VALUE str = ossl_to_der_if_possible(arg);
StringValue(str);
- p = RSTRING(str)->ptr;
- if(!d2i_X509_NAME((X509_NAME**)&DATA_PTR(self), &p, RSTRING(str)->len)){
+ p = RSTRING_PTR(str);
+ if(!d2i_X509_NAME((X509_NAME**)&DATA_PTR(self), &p, RSTRING_LEN(str))){
ossl_raise(eX509NameError, NULL);
}
}
@@ -141,6 +148,10 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * name.add_entry(oid, value [, type]) => self
+ */
static
VALUE ossl_x509name_add_entry(int argc, VALUE *argv, VALUE self)
{
@@ -152,8 +163,8 @@ VALUE ossl_x509name_add_entry(int argc, VALUE *argv, VALUE self)
StringValue(value);
if(NIL_P(type)) type = rb_aref(OBJECT_TYPE_TEMPLATE, oid);
GetX509Name(self, name);
- if (!X509_NAME_add_entry_by_txt(name, RSTRING(oid)->ptr, NUM2INT(type),
- RSTRING(value)->ptr, RSTRING(value)->len, -1, 0)) {
+ if (!X509_NAME_add_entry_by_txt(name, RSTRING_PTR(oid), NUM2INT(type),
+ RSTRING_PTR(value), RSTRING_LEN(value), -1, 0)) {
ossl_raise(eX509NameError, NULL);
}
@@ -175,9 +186,14 @@ ossl_x509name_to_s_old(VALUE self)
return str;
}
+/*
+ * call-seq:
+ * name.to_s => string
+ * name.to_s(integer) => string
+ */
static VALUE
ossl_x509name_to_s(int argc, VALUE *argv, VALUE self)
-{
+{
X509_NAME *name;
VALUE flag, str;
BIO *out;
@@ -188,17 +204,21 @@ ossl_x509name_to_s(int argc, VALUE *argv, VALUE self)
return ossl_x509name_to_s_old(self);
else iflag = NUM2ULONG(flag);
if (!(out = BIO_new(BIO_s_mem())))
- rb_raise(eX509NameError, NULL);
+ ossl_raise(eX509NameError, NULL);
GetX509Name(self, name);
if (!X509_NAME_print_ex(out, name, 0, iflag)){
BIO_free(out);
- rb_raise(eX509NameError, NULL);
+ ossl_raise(eX509NameError, NULL);
}
str = ossl_membio2str(out);
return str;
}
+/*
+ * call-seq:
+ * name.to_a => [[name, data, type], ...]
+ */
static VALUE
ossl_x509name_to_a(VALUE self)
{
@@ -266,6 +286,10 @@ ossl_x509name_eql(VALUE self, VALUE other)
return (result == 0) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * name.hash => integer
+ */
static VALUE
ossl_x509name_hash(VALUE self)
{
@@ -279,6 +303,10 @@ ossl_x509name_hash(VALUE self)
return ULONG2NUM(hash);
}
+/*
+ * call-seq:
+ * name.to_der => string
+ */
static VALUE
ossl_x509name_to_der(VALUE self)
{
@@ -291,7 +319,7 @@ ossl_x509name_to_der(VALUE self)
if((len = i2d_X509_NAME(name, NULL)) <= 0)
ossl_raise(eX509NameError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_X509_NAME(name, &p) <= 0)
ossl_raise(eX509NameError, NULL);
ossl_str_adjust(str, p);
diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c
index d644250433..13a42dddaf 100644
--- a/ext/openssl/ossl_x509req.c
+++ b/ext/openssl/ossl_x509req.c
@@ -171,7 +171,7 @@ ossl_x509req_to_der(VALUE self)
if ((len = i2d_X509_REQ(req, NULL)) <= 0)
ossl_raise(eX509CertError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if (i2d_X509_REQ(req, &p) <= 0)
ossl_raise(eX509ReqError, NULL);
ossl_str_adjust(str, p);
@@ -403,14 +403,14 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary)
VALUE item;
Check_Type(ary, T_ARRAY);
- for (i=0;i<RARRAY(ary)->len; i++) {
- OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Attr);
+ for (i=0;i<RARRAY_LEN(ary); i++) {
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Attr);
}
GetX509Req(self, req);
sk_X509_ATTRIBUTE_pop_free(req->req_info->attributes, X509_ATTRIBUTE_free);
req->req_info->attributes = NULL;
- for (i=0;i<RARRAY(ary)->len; i++) {
- item = RARRAY(ary)->ptr[i];
+ for (i=0;i<RARRAY_LEN(ary); i++) {
+ item = RARRAY_PTR(ary)[i];
attr = DupX509AttrPtr(item);
if (!X509_REQ_add1_attr(req, attr)) {
ossl_raise(eX509ReqError, NULL);
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c
index 3ccac8d26a..d0f816bad4 100644
--- a/ext/openssl/ossl_x509revoked.c
+++ b/ext/openssl/ossl_x509revoked.c
@@ -175,14 +175,14 @@ ossl_x509revoked_set_extensions(VALUE self, VALUE ary)
VALUE item;
Check_Type(ary, T_ARRAY);
- for (i=0; i<RARRAY(ary)->len; i++) {
- OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Ext);
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509Rev(self, rev);
sk_X509_EXTENSION_pop_free(rev->extensions, X509_EXTENSION_free);
rev->extensions = NULL;
- for (i=0; i<RARRAY(ary)->len; i++) {
- item = RARRAY(ary)->ptr[i];
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ item = RARRAY_PTR(ary)[i];
ext = DupX509ExtPtr(item);
if(!X509_REVOKED_add_ext(rev, ext, -1)) {
ossl_raise(eX509RevError, NULL);
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index cea845a1cc..769ce8a91a 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -118,11 +118,18 @@ ossl_x509store_set_vfy_cb(VALUE self, VALUE cb)
return cb;
}
+
+/*
+ * call-seq:
+ * X509::Store.new => store
+ *
+ */
static VALUE
ossl_x509store_initialize(int argc, VALUE *argv, VALUE self)
{
X509_STORE *store;
+/* BUG: This method takes any number of arguments but appears to ignore them. */
GetX509Store(self, store);
X509_STORE_set_verify_cb_func(store, ossl_verify_cb);
ossl_x509store_set_vfy_cb(self, Qnil);
@@ -206,7 +213,7 @@ ossl_x509store_add_file(VALUE self, VALUE file)
if(file != Qnil){
Check_SafeStr(file);
- path = RSTRING(file)->ptr;
+ path = RSTRING_PTR(file);
}
GetX509Store(self, store);
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
@@ -227,7 +234,7 @@ ossl_x509store_add_path(VALUE self, VALUE dir)
if(dir != Qnil){
Check_SafeStr(dir);
- path = RSTRING(dir)->ptr;
+ path = RSTRING_PTR(dir);
}
GetX509Store(self, store);
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
@@ -451,7 +458,7 @@ ossl_x509stctx_set_error(VALUE self, VALUE err)
X509_STORE_CTX *ctx;
GetX509StCtx(self, ctx);
- X509_STORE_CTX_set_error(ctx, FIX2INT(err));
+ X509_STORE_CTX_set_error(ctx, NUM2INT(err));
return err;
}
@@ -550,6 +557,10 @@ ossl_x509stctx_set_trust(VALUE self, VALUE trust)
return trust;
}
+/*
+ * call-seq:
+ * storectx.time = time => time
+ */
static VALUE
ossl_x509stctx_set_time(VALUE self, VALUE time)
{
diff --git a/ext/openssl/ruby_missing.h b/ext/openssl/ruby_missing.h
index 4bd08890f8..64b76f26b4 100644
--- a/ext/openssl/ruby_missing.h
+++ b/ext/openssl/ruby_missing.h
@@ -9,10 +9,33 @@
* (See the file 'LICENCE'.)
*/
#if !defined(_OSSL_RUBY_MISSING_H_)
-#define _OSS_RUBY_MISSING_H_
+#define _OSSL_RUBY_MISSING_H_
#define rb_define_copy_func(klass, func) \
rb_define_method(klass, "initialize_copy", func, 1)
-#endif /* _OSS_RUBY_MISSING_H_ */
+#ifndef GetReadFile
+#define FPTR_TO_FD(fptr) (fptr->fd)
+#else
+#define FPTR_TO_FD(fptr) (fileno(GetReadFile(fptr)))
+#endif
+
+#ifndef HAVE_RB_IO_T
+#define rb_io_t OpenFile
+#endif
+
+#ifndef HAVE_RB_STR_SET_LEN
+/* these methods should probably be backported to 1.8 */
+#define rb_str_set_len(str, length) do { \
+ RSTRING(str)->ptr[length] = 0; \
+ RSTRING(str)->len = length; \
+} while(0)
+#endif /* ! HAVE_RB_STR_SET_LEN */
+
+#ifndef HAVE_RB_BLOCK_CALL
+/* the openssl module doesn't use arg[3-4] and arg2 is always rb_each */
+#define rb_block_call(arg1, arg2, arg3, arg4, arg5, arg6) rb_iterate(rb_each, arg1, arg5, arg6)
+#endif /* ! HAVE_RB_BLOCK_CALL */
+
+#endif /* _OSSL_RUBY_MISSING_H_ */
diff --git a/ext/pty/expect_sample.rb b/ext/pty/expect_sample.rb
index bf8a2352fe..2a2e29f866 100644
--- a/ext/pty/expect_sample.rb
+++ b/ext/pty/expect_sample.rb
@@ -15,10 +15,6 @@ PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid|
$expect_verbose = false
- r_f.expect(/^Name.*: /) do
- w_f.print "ftp\n"
- end
-
if !ENV['USER'].nil?
username = ENV['USER']
elsif !ENV['LOGNAME'].nil?
@@ -27,19 +23,16 @@ PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid|
username = 'guest'
end
- r_f.expect('word:') do
- w_f.print username+"@\n"
- end
- r_f.expect("> ") do
- w_f.print "cd pub/ruby\n"
+ r_f.expect(/^(Name).*: |(word):|> /) do
+ w_f.puts($1 ? "ftp" : $2 ? "#{username}@" : "cd pub/ruby")
end
r_f.expect("> ") do
w_f.print "dir\n"
end
- r_f.expect("> ") do |output|
+ r_f.expect(/[^\-]> /) do |output|
for x in output[0].split("\n")
- if x =~ /(ruby.*\.tar\.gz)/ then
+ if x =~ /(ruby.*?\.tar\.gz)/ then
fnames.push $1
end
end
diff --git a/ext/pty/lib/expect.rb b/ext/pty/lib/expect.rb
index aa9ab895d3..08191b05b9 100644
--- a/ext/pty/lib/expect.rb
+++ b/ext/pty/lib/expect.rb
@@ -10,7 +10,7 @@ class IO
e_pat = pat
end
while true
- if IO.select([self],nil,nil,timeout).nil? then
+ if !IO.select([self],nil,nil,timeout) or eof? then
result = nil
break
end
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index db072744d6..939335242f 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -39,10 +39,10 @@
#if !defined(HAVE_OPENPTY)
#if defined(__hpux)
-static
-char *MasterDevice = "/dev/ptym/pty%s",
- *SlaveDevice = "/dev/pty/tty%s",
- *deviceNo[] = {
+static const
+char MasterDevice[] = "/dev/ptym/pty%s",
+ SlaveDevice[] = "/dev/pty/tty%s",
+ *const deviceNo[] = {
"p0","p1","p2","p3","p4","p5","p6","p7",
"p8","p9","pa","pb","pc","pd","pe","pf",
"q0","q1","q2","q3","q4","q5","q6","q7",
@@ -62,10 +62,10 @@ char *MasterDevice = "/dev/ptym/pty%s",
0,
};
#elif defined(_IBMESA) /* AIX/ESA */
-static
-char *MasterDevice = "/dev/ptyp%s",
- *SlaveDevice = "/dev/ttyp%s",
- *deviceNo[] = {
+static const
+char MasterDevice[] = "/dev/ptyp%s",
+ SlaveDevice[] = "/dev/ttyp%s",
+ *const deviceNo[] = {
"00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f",
"10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f",
"20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f",
@@ -84,10 +84,10 @@ char *MasterDevice = "/dev/ptyp%s",
"f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff",
};
#elif !defined(HAVE_PTSNAME)
-static
-char *MasterDevice = "/dev/pty%s",
- *SlaveDevice = "/dev/tty%s",
- *deviceNo[] = {
+static const
+char MasterDevice[] = "/dev/pty%s",
+ SlaveDevice[] = "/dev/tty%s",
+ *const deviceNo[] = {
"p0","p1","p2","p3","p4","p5","p6","p7",
"p8","p9","pa","pb","pc","pd","pe","pf",
"q0","q1","q2","q3","q4","q5","q6","q7",
@@ -101,8 +101,6 @@ char *MasterDevice = "/dev/pty%s",
#endif
#endif /* !defined(HAVE_OPENPTY) */
-static char SlaveName[DEVICELEN];
-
#ifndef HAVE_SETEUID
# ifdef HAVE_SETREUID
# define seteuid(e) setreuid(-1, (e))
@@ -139,7 +137,7 @@ raise_from_wait(state, info)
char buf[1024];
VALUE exc;
- snprintf(buf, sizeof(buf), "pty - %s: %d", state, info->child_pid);
+ snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)info->child_pid);
exc = rb_exc_new2(eChildExited, buf);
rb_iv_set(exc, "status", rb_last_status);
rb_funcall(info->thread, rb_intern("raise"), 1, exc);
@@ -155,17 +153,15 @@ pty_syswait(info)
cpid = rb_waitpid(info->child_pid, &status, WUNTRACED);
if (cpid == -1) return Qnil;
-#if defined(IF_STOPPED)
- if (IF_STOPPED(status)) { /* suspend */
- raise_from_wait("stopped", info);
- }
-#elif defined(WIFSTOPPED)
- if (WIFSTOPPED(status)) { /* suspend */
- raise_from_wait("stopped", info);
- }
+#if defined(WIFSTOPPED)
+#elif defined(IF_STOPPED)
+#define WIFSTOPPED(status) IF_STOPPED(status)
#else
---->> Either IF_STOPPED or WIFSTOPPED is needed <<----
#endif /* WIFSTOPPED | IF_STOPPED */
+ if (WIFSTOPPED(status)) { /* suspend */
+ raise_from_wait("stopped", info);
+ }
else if (kill(info->child_pid, 0) == 0) {
raise_from_wait("changed", info);
}
@@ -176,28 +172,32 @@ pty_syswait(info)
}
}
-static void getDevice _((int*, int*));
+static void getDevice _((int*, int*, char [DEVICELEN]));
struct exec_info {
int argc;
VALUE *argv;
};
+static VALUE pty_exec _((VALUE v));
+
static VALUE
-pty_exec(arg)
- struct exec_info *arg;
+pty_exec(v)
+ VALUE v;
{
+ struct exec_info *arg = (struct exec_info *)v;
return rb_f_exec(arg->argc, arg->argv);
}
static void
-establishShell(argc, argv, info)
+establishShell(argc, argv, info, SlaveName)
int argc;
VALUE *argv;
struct pty_info *info;
-{
- static int i,master,slave,currentPid;
- char *p,*getenv();
+ char SlaveName[DEVICELEN];
+{
+ int i,master,slave;
+ char *p, tmp, *getenv();
struct passwd *pwent;
VALUE v;
struct exec_info arg;
@@ -220,10 +220,9 @@ establishShell(argc, argv, info)
argc = 1;
argv = &v;
}
- getDevice(&master,&slave);
+ getDevice(&master, &slave, SlaveName);
info->thread = rb_thread_current();
- currentPid = getpid();
if((i = fork()) < 0) {
close(master);
close(slave);
@@ -231,8 +230,6 @@ establishShell(argc, argv, info)
}
if(i == 0) { /* child */
- currentPid = getpid();
-
/*
* Set free from process group and controlling terminal
*/
@@ -244,7 +241,7 @@ establishShell(argc, argv, info)
if (setpgrp() == -1)
perror("setpgrp()");
# else /* SETGRP_VOID */
- if (setpgrp(0, currentPid) == -1)
+ if (setpgrp(0, getpid()) == -1)
rb_sys_fail("setpgrp()");
if ((i = open("/dev/tty", O_RDONLY)) < 0)
rb_sys_fail("/dev/tty");
@@ -273,6 +270,7 @@ establishShell(argc, argv, info)
}
close(master);
#endif
+ write(slave, "", 1);
dup2(slave,0);
dup2(slave,1);
dup2(slave,2);
@@ -288,6 +286,7 @@ establishShell(argc, argv, info)
_exit(1);
}
+ read(master, &tmp, 1);
close(slave);
info->child_pid = i;
@@ -304,40 +303,36 @@ pty_finalize_syswait(info)
return Qnil;
}
-#ifdef HAVE_OPENPTY
+static int
+get_device_once(master, slave, SlaveName, fail)
+ int *master, *slave, fail;
+ char SlaveName[DEVICELEN];
+{
+#if defined 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");
}
-}
-#else /* HAVE_OPENPTY */
-#ifdef HAVE__GETPTY
-static void
-getDevice(master,slave)
- int *master,*slave;
-{
+
+ return 0;
+#elif defined HAVE__GETPTY
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);
-}
+ strncpy(SlaveName, name, sizeof SlaveName);
+
+ return 0;
#else /* HAVE__GETPTY */
-static void
-getDevice(master,slave)
- int *master,*slave;
-{
int i,j;
#ifdef HAVE_PTSNAME
@@ -358,11 +353,12 @@ getDevice(master,slave)
#if defined I_PUSH && !defined linux
if(ioctl(j, I_PUSH, "ptem") != -1) {
if(ioctl(j, I_PUSH, "ldterm") != -1) {
+ ioctl(j, I_PUSH, "ttcompat");
#endif
*master = i;
*slave = j;
- strcpy(SlaveName, pn);
- return;
+ strncpy(SlaveName, pn, sizeof SlaveName);
+ return 0;
#if defined I_PUSH && !defined linux
}
}
@@ -373,36 +369,41 @@ getDevice(master,slave)
}
close(i);
}
- rb_raise(rb_eRuntimeError, "can't get Master/Slave device");
+ if (!fail) rb_raise(rb_eRuntimeError, "can't get Master/Slave device");
+ return -1;
#else
char **p;
char MasterName[DEVICELEN];
for (p = deviceNo; *p != NULL; p++) {
- sprintf(MasterName,MasterDevice,*p);
+ snprintf(MasterName, sizeof MasterName, MasterDevice, *p);
if ((i = open(MasterName,O_RDWR,0)) >= 0) {
*master = i;
- sprintf(SlaveName,SlaveDevice,*p);
+ snprintf(SlaveName, sizeof SlaveName, SlaveDevice, *p);
if ((j = open(SlaveName,O_RDWR,0)) >= 0) {
*slave = j;
chown(SlaveName, getuid(), getgid());
chmod(SlaveName, 0622);
- return;
+ return 0;
}
close(i);
}
}
- rb_raise(rb_eRuntimeError, "can't get %s", SlaveName);
+ if (fail) rb_raise(rb_eRuntimeError, "can't get %s", SlaveName);
+ return -1;
+#endif
#endif
}
-#endif /* HAVE__GETPTY */
-#endif /* HAVE_OPENPTY */
static void
-freeDevice()
+getDevice(master, slave, slavename)
+ int *master, *slave;
+ char slavename[DEVICELEN];
{
- chmod(SlaveName, 0666);
- chown(SlaveName, 0, 0);
+ if (get_device_once(master, slave, slavename, 0)) {
+ rb_gc();
+ get_device_once(master, slave, slavename, 1);
+ }
}
/* ruby function: getpty */
@@ -415,14 +416,15 @@ pty_getpty(argc, argv, self)
VALUE res;
struct pty_info info;
struct pty_info thinfo;
- OpenFile *wfptr,*rfptr;
+ rb_io_t *wfptr,*rfptr;
VALUE rport = rb_obj_alloc(rb_cFile);
VALUE wport = rb_obj_alloc(rb_cFile);
-
+ char SlaveName[DEVICELEN];
+
MakeOpenFile(rport, rfptr);
MakeOpenFile(wport, wfptr);
- establishShell(argc, argv, &info);
+ establishShell(argc, argv, &info, SlaveName);
rfptr->mode = rb_io_mode_flags("r");
rfptr->f = fdopen(info.fd, "r");
diff --git a/ext/purelib.rb b/ext/purelib.rb
new file mode 100644
index 0000000000..dbe514c34a
--- /dev/null
+++ b/ext/purelib.rb
@@ -0,0 +1,10 @@
+nul = nil
+$:.each_with_index {|path, index|
+ if /\A(?:\.\/)*-\z/ =~ path
+ nul = index
+ break
+ end
+}
+if nul
+ $:[nul..-1] = ["."]
+end
diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c
index 24c4e36f2b..18a26f670f 100644
--- a/ext/racc/cparse/cparse.c
+++ b/ext/racc/cparse/cparse.c
@@ -1,25 +1,24 @@
/*
- cparse.c -- racc runtime core
+ cparse.c -- Racc Runtime Core
- Copyright (c) 1999-2003 Minero Aoki <aamine@loveruby.net>
+ Copyright (c) 1999-2006 Minero Aoki
This library is free software.
You can distribute/modify this program under the same terms of ruby.
- $raccId: cparse.c,v 1.3 2003/11/03 12:20:54 aamine Exp $
+ $originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $
*/
#include "ruby.h"
-#include <stdio.h>
-
+#include "version.h"
/* -----------------------------------------------------------------------
Important Constants
----------------------------------------------------------------------- */
-#define RACC_VERSION "1.4.4"
+#define RACC_VERSION "1.4.5"
#define DEFAULT_TOKEN -1
#define ERROR_TOKEN 1
@@ -29,7 +28,6 @@
#define vERROR_TOKEN INT2FIX(ERROR_TOKEN)
#define vFINAL_TOKEN INT2FIX(FINAL_TOKEN)
-
/* -----------------------------------------------------------------------
File Local Variables
----------------------------------------------------------------------- */
@@ -41,8 +39,6 @@ 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;
@@ -52,44 +48,41 @@ 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(v)
- VALUE v;
+value_to_id(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(n)
- VALUE n;
+num_to_long(VALUE n)
{
return NUM2LONG(n);
}
@@ -97,7 +90,6 @@ num_to_long(n)
#define AREF(s, idx) \
((0 <= idx && idx < RARRAY(s)->len) ? RARRAY(s)->ptr[idx] : Qnil)
-
/* -----------------------------------------------------------------------
Parser Stack Interfaces
----------------------------------------------------------------------- */
@@ -106,9 +98,7 @@ static VALUE get_stack_tail _((VALUE stack, long len));
static void cut_stack_tail _((VALUE stack, long len));
static VALUE
-get_stack_tail(stack, len)
- VALUE stack;
- long len;
+get_stack_tail(VALUE stack, long len)
{
if (len < 0) return Qnil; /* system error */
if (len > RARRAY(stack)->len) len = RARRAY(stack)->len;
@@ -116,9 +106,7 @@ get_stack_tail(stack, len)
}
static void
-cut_stack_tail(stack, len)
- VALUE stack;
- long len;
+cut_stack_tail(VALUE stack, long len)
{
while (len > 0) {
rb_ary_pop(stack);
@@ -135,7 +123,6 @@ cut_stack_tail(stack, len)
#define GET_TAIL(s, len) get_stack_tail(s, len)
#define CUT_TAIL(s, len) cut_stack_tail(s, len)
-
/* -----------------------------------------------------------------------
struct cparse_params
----------------------------------------------------------------------- */
@@ -193,7 +180,6 @@ struct cparse_params {
long i; /* table index */
};
-
/* -----------------------------------------------------------------------
Parser Main Routines
----------------------------------------------------------------------- */
@@ -203,15 +189,14 @@ 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 void initialize_params _((struct cparse_params *v,
- VALUE parser, VALUE arg,
+static VALUE initialize_params _((VALUE vparams, 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));
@@ -219,7 +204,6 @@ 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
@@ -231,15 +215,16 @@ static VALUE reduce0 _((VALUE block_args, VALUE data, VALUE self));
#endif
static VALUE
-racc_cparse(parser, arg, sysdebug)
- VALUE parser, arg, sysdebug;
+racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug)
{
- struct cparse_params params;
- struct cparse_params *v = &params;
+ volatile VALUE vparams;
+ struct cparse_params *v;
+ vparams = Data_Make_Struct(CparseParams, struct cparse_params,
+ cparse_params_mark, -1, v);
D_puts("starting cparse");
v->sys_debug = RTEST(sysdebug);
- initialize_params(v, parser, arg, Qnil, Qnil);
+ vparams = initialize_params(vparams, parser, arg, Qnil, Qnil);
v->lex_is_iterator = Qfalse;
parse_main(v, Qnil, Qnil, 0);
@@ -247,15 +232,16 @@ racc_cparse(parser, arg, sysdebug)
}
static VALUE
-racc_yyparse(parser, lexer, lexmid, arg, sysdebug)
- VALUE parser, lexer, lexmid, arg, sysdebug;
+racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug)
{
- struct cparse_params params;
- struct cparse_params *v = &params;
+ volatile VALUE vparams;
+ struct cparse_params *v;
+ vparams = Data_Make_Struct(CparseParams, struct cparse_params,
+ cparse_params_mark, -1, v);
v->sys_debug = RTEST(sysdebug);
D_puts("start C yyparse");
- initialize_params(v, parser, arg, lexer, lexmid);
+ vparams = initialize_params(vparams, parser, arg, lexer, lexmid);
v->lex_is_iterator = Qtrue;
D_puts("params initialized");
parse_main(v, Qnil, Qnil, 0);
@@ -268,16 +254,15 @@ racc_yyparse(parser, lexer, lexmid, arg, sysdebug)
return v->retval;
}
+#ifdef HAVE_RB_BLOCK_CALL
static void
-call_lexer(v)
- struct cparse_params *v;
+call_lexer(struct cparse_params *v)
{
- rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);
+ rb_block_call(v->lexer, v->lexmid, 0, NULL, lexer_i, v->value_v);
}
-
+#else
static VALUE
-lexer_iter(data)
- VALUE data;
+lexer_iter(VALUE data)
{
struct cparse_params *v;
@@ -286,9 +271,15 @@ lexer_iter(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(block_args, data, self)
- VALUE block_args, data, self;
+lexer_i(VALUE block_args, VALUE data, VALUE self)
{
struct cparse_params *v;
VALUE tok, val;
@@ -304,35 +295,32 @@ lexer_i(block_args, data, self)
}
static VALUE
-assert_array(a)
- VALUE a;
+assert_array(VALUE a)
{
Check_Type(a, T_ARRAY);
return a;
}
static VALUE
-assert_hash(h)
- VALUE h;
+assert_hash(VALUE h)
{
Check_Type(h, T_HASH);
return h;
}
static long
-assert_integer(n)
- VALUE n;
+assert_integer(VALUE n)
{
return NUM2LONG(n);
}
-static void
-initialize_params(v, parser, arg, lexer, lexmid)
- struct cparse_params *v;
- VALUE parser, arg, lexer, lexmid;
+static VALUE
+initialize_params(VALUE vparams, VALUE parser, VALUE arg, VALUE lexer, VALUE lexmid)
{
- v->value_v = Data_Wrap_Struct(CparseParams, 0, 0, v);
+ struct cparse_params *v;
+ Data_Get_Struct(vparams, struct cparse_params, v);
+ v->value_v = vparams;
v->parser = parser;
v->lexer = lexer;
if (! NIL_P(lexmid))
@@ -377,13 +365,46 @@ initialize_params(v, parser, arg, lexer, lexmid)
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
-extract_user_token(v, block_args, tok, val)
- struct cparse_params *v;
- VALUE block_args;
- VALUE *tok, *val;
+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->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)
{
if (NIL_P(block_args)) {
/* EOF */
@@ -426,10 +447,7 @@ extract_user_token(v, block_args, tok, val)
} while (0)
static void
-parse_main(v, tok, val, resume)
- struct cparse_params *v;
- VALUE tok, val;
- int resume;
+parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
{
long i; /* table index */
long act; /* action type */
@@ -468,8 +486,10 @@ parse_main(v, tok, val, resume)
extract_user_token(v, tmp, &tok, &val);
}
/* convert token */
- tmp = rb_hash_aref(v->token_table, tok);
- v->t = NIL_P(tmp) ? vERROR_TOKEN : tmp;
+ v->t = rb_hash_aref(v->token_table, tok);
+ if (NIL_P(v->t)) {
+ v->t = vERROR_TOKEN;
+ }
D_printf("(act) t(k2)=%ld\n", NUM2LONG(v->t));
if (v->debug) {
rb_funcall(v->parser, id_d_read_token,
@@ -636,10 +656,7 @@ parse_main(v, tok, val, resume)
}
static void
-shift(v, act, tok, val)
- struct cparse_params *v;
- long act;
- VALUE tok, val;
+shift(struct cparse_params *v, long act, VALUE tok, VALUE val)
{
PUSH(v->vstack, val);
if (v->debug) {
@@ -652,33 +669,23 @@ shift(v, act, tok, val)
}
static int
-reduce(v, act)
- struct cparse_params *v;
- long act;
+reduce(struct cparse_params *v, long act)
{
VALUE code;
v->ruleno = -act * 3;
- code = rb_iterate(catch_iter, Qnil, reduce0, v->value_v);
+ code = rb_catch("racc_jump", reduce0, v->value_v);
v->errstatus = num_to_long(rb_ivar_get(v->parser, id_errstatus));
return NUM2INT(code);
}
static VALUE
-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;
+reduce0(VALUE val, VALUE data, VALUE self)
{
struct cparse_params *v;
VALUE reduce_to, reduce_len, method_id;
long len;
ID mid;
- VALUE tmp, tmp_t, tmp_v;
+ VALUE tmp, tmp_t = Qundef, tmp_v = Qundef;
long i, k1, k2;
VALUE goto_state;
@@ -777,13 +784,12 @@ reduce0(val, data, self)
goto transit;
}
-
/* -----------------------------------------------------------------------
Ruby Interface
----------------------------------------------------------------------- */
void
-Init_cparse()
+Init_cparse(void)
{
VALUE Racc, Parser;
ID id_racc = rb_intern("Racc");
@@ -801,7 +807,7 @@ Init_cparse()
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("$raccId: cparse.c,v 1.3 2003/11/03 12:20:54 aamine Exp $"));
+ rb_str_new2("$originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $"));
CparseParams = rb_define_class_under(Racc, "CparseParams", rb_cObject);
@@ -811,9 +817,7 @@ Init_cparse()
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/readline/extconf.rb b/ext/readline/extconf.rb
index b67a443dad..b820c0b32f 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -42,7 +42,9 @@ else
end
end
-have_readline_var("rl_filename_completion_function")
+have_func("rl_filename_completion_function")
+have_func("rl_username_completion_function")
+have_func("rl_completion_matches")
have_readline_var("rl_deprep_term_function")
have_readline_var("rl_completion_append_character")
have_readline_var("rl_basic_word_break_characters")
@@ -57,7 +59,6 @@ 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 b78a911b7c..c9acaadac9 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1,6 +1,7 @@
/* readline.c -- GNU Readline module
Copyright (C) 1997-2001 Shugo Maeda */
+#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
@@ -33,21 +34,40 @@ static ID completion_proc, completion_case_fold;
#ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION
# define rl_filename_completion_function filename_completion_function
+#endif
+#ifndef HAVE_RL_USERNAME_COMPLETION_FUNCTION
# define rl_username_completion_function username_completion_function
+#endif
+#ifndef HAVE_RL_COMPLETION_MATCHES
# 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);
+#ifdef HAVE_RL_EVENT_HOOK
+#ifdef DOSISH
+#define BUSY_WAIT 1
+#else
+#define BUSY_WAIT 0
+#endif
+
+static int readline_event(void);
static int
readline_event()
{
- CHECK_INTS;
+#if BUSY_WAIT
rb_thread_schedule();
+#else
+ fd_set rset;
+
+ FD_ZERO(&rset);
+ FD_SET(fileno(rl_instream), &rset);
+ rb_thread_select(fileno(rl_instream) + 1, &rset, NULL, NULL, NULL);
return 0;
+#endif
}
+#endif
static VALUE
readline_readline(argc, argv, self)
@@ -59,7 +79,7 @@ readline_readline(argc, argv, self)
char *prompt = NULL;
char *buff;
int status;
- OpenFile *ofp, *ifp;
+ rb_io_t *ofp, *ifp;
rb_secure(4);
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
@@ -69,10 +89,12 @@ 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 = ofp->f;
+ rl_outstream = GetWriteFile(ofp);
+ Check_Type(rb_stdin, T_FILE);
GetOpenFile(rb_stdin, ifp);
- rl_instream = ifp->f;
+ rl_instream = GetReadFile(ifp);
buff = (char*)rb_protect((VALUE(*)_((VALUE)))readline, (VALUE)prompt,
&status);
if (status) {
@@ -81,7 +103,9 @@ readline_readline(argc, argv, self)
rl_cleanup_after_signal();
#elif defined HAVE_RL_DEPREP_TERM_FUNCTION
/* restore terminal mode */
- (*rl_deprep_term_function)();
+ if (rl_deprep_term_function != NULL) /* NULL in libedit. [ruby-dev:29116] */
+ (*rl_deprep_term_function)();
+ else
#else
rl_deprep_terminal();
#endif
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index d4cf621ea5..5b34824afc 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -71,7 +71,7 @@ static int duppair proto((char *, datum));
#include <stdio.h>
#include <stdlib.h>
-#ifdef MSDOS
+#ifdef DOSISH
#include <io.h>
#endif
#include <sys/types.h>
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
index a22615ee00..e93adafba6 100644
--- a/ext/socket/addrinfo.h
+++ b/ext/socket/addrinfo.h
@@ -61,10 +61,15 @@
#undef NI_NUMERICSERV
#undef NI_DGRAM
+#undef addrinfo
#define addrinfo addrinfo__compat
+#undef getaddrinfo
#define getaddrinfo getaddrinfo__compat
+#undef getnameinfo
#define getnameinfo getnameinfo__compat
+#undef freehostent
#define freehostent freehostent__compat
+#undef freeaddrinfo
#define freeaddrinfo freeaddrinfo__compat
#ifndef __P
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 28f38140b4..8a13ddba73 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -6,7 +6,11 @@ when /bccwin32/
have_library("ws2_32", "WSACleanup")
when /mswin32|mingw/
test_func = "WSACleanup"
- have_library("wsock32", "WSACleanup")
+ if with_config("winsock2")
+ have_library("ws2_32", "WSACleanup")
+ else
+ have_library("wsock32", "WSACleanup")
+ end
when /cygwin/
test_func = "socket"
when /beos/
@@ -29,8 +33,11 @@ if /solaris/ =~ RUBY_PLATFORM and !try_compile("")
# bug of gcc 3.0 on Solaris 8 ?
headers << "sys/feature_tests.h"
end
+if have_header("arpa/inet.h")
+ headers << "arpa/inet.h"
+end
-$ipv6 = false
+ipv6 = false
default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
if enable_config("ipv6", default_ipv6)
if checking_for("ipv6") {try_link(<<EOF)}
@@ -41,74 +48,45 @@ main()
socket(AF_INET6, SOCK_STREAM, 0);
}
EOF
- $CFLAGS+=" -DENABLE_IPV6"
- $ipv6 = true
+ $defs << "-DENABLE_IPV6" << "-DINET6"
+ ipv6 = true
end
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
+if ipv6
+ ipv6lib = nil
+ class << (fmt = "unknown")
+ def %(s) s || self end
end
-
- if $ipv6lib
- if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a"
- $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib"
- elsif !$ipv6trylibc
- print <<EOS
+ 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
-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)
@@ -178,6 +156,10 @@ main()
if (ai->ai_addr == NULL)
goto bad;
#if defined(_AIX)
+ if (ai->ai_family == AF_INET6 && passive) {
+ inet6++;
+ continue;
+ }
ai->ai_addr->sa_len = ai->ai_addrlen;
ai->ai_addr->sa_family = ai->ai_family;
#endif
@@ -241,7 +223,7 @@ main()
}
EOF
end
-if $ipv6 and not getaddr_info_ok
+if ipv6 and not getaddr_info_ok
abort <<EOS
Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature.
@@ -277,7 +259,6 @@ unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("ge
have_func("inet_ntop") or have_func("inet_ntoa")
have_func("inet_pton") or have_func("inet_aton")
have_func("getservbyport")
- have_header("arpa/inet.h")
have_header("arpa/nameser.h")
have_header("resolv.h")
end
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index 4c9c8f03c4..66f7e8818a 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -35,6 +35,7 @@
*/
#include "config.h"
+#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
#if defined(__BEOS__)
@@ -51,15 +52,11 @@
#endif
#include <netdb.h>
#if defined(HAVE_RESOLV_H)
-#ifdef _SX
-#include <stdio.h>
-#endif
#include <resolv.h>
#endif
#endif
#ifdef _WIN32
#include <winsock2.h>
-#include <stdio.h>
#define snprintf _snprintf
#endif
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 09326ce16f..1dcc7160e9 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -42,6 +42,9 @@
#ifdef HAVE_NETINET_UDP_H
# include <netinet/udp.h>
#endif
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
#include <netdb.h>
#endif
#include <errno.h>
@@ -195,6 +198,40 @@ ruby_getaddrinfo__aix(nodename, servname, hints, res)
}
#undef getaddrinfo
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
+static int
+ruby_getnameinfo__aix(sa, salen, host, hostlen, serv, servlen, flags)
+ const struct sockaddr *sa;
+ size_t salen;
+ char *host;
+ size_t hostlen;
+ char *serv;
+ size_t servlen;
+ int flags;
+{
+ struct sockaddr_in6 *sa6;
+ u_int32_t *a6;
+
+ if (sa->sa_family == AF_INET6) {
+ sa6 = (struct sockaddr_in6 *)sa;
+ a6 = sa6->sin6_addr.u6_addr.u6_addr32;
+
+ if (a6[0] == 0 && a6[1] == 0 && a6[2] == 0 && a6[3] == 0) {
+ strncpy(host, "::", hostlen);
+ snprintf(serv, servlen, "%d", sa6->sin6_port);
+ return 0;
+ }
+ }
+ return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
+}
+#undef getnameinfo
+#define getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) \
+ ruby_getnameinfo__aix((sa), (salen), (host), (hostlen), (serv), (servlen), (flags))
+#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
@@ -207,7 +244,7 @@ init_sock(sock, fd)
VALUE sock;
int fd;
{
- OpenFile *fp;
+ rb_io_t *fp;
MakeOpenFile(sock, fp);
fp->f = rb_fdopen(fd, "r");
@@ -222,7 +259,7 @@ static VALUE
bsock_s_for_fd(klass, fd)
VALUE klass, fd;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock = init_sock(rb_obj_alloc(klass), NUM2INT(fd));
GetOpenFile(sock, fptr);
@@ -238,7 +275,7 @@ bsock_shutdown(argc, argv, sock)
{
VALUE howto;
int how;
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't shutdown socket");
@@ -263,7 +300,7 @@ static VALUE
bsock_close_read(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't close socket");
@@ -282,7 +319,7 @@ static VALUE
bsock_close_write(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't close socket");
@@ -347,7 +384,7 @@ bsock_setsockopt(sock, lev, optname, val)
VALUE sock, lev, optname, val;
{
int level, option;
- OpenFile *fptr;
+ rb_io_t *fptr;
int i;
char *v;
int vlen;
@@ -430,7 +467,7 @@ bsock_getsockopt(sock, lev, optname)
int level, option;
socklen_t len;
char *buf;
- OpenFile *fptr;
+ rb_io_t *fptr;
level = NUM2INT(lev);
option = NUM2INT(optname);
@@ -454,7 +491,7 @@ bsock_getsockname(sock)
{
char buf[1024];
socklen_t len = sizeof buf;
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(sock, fptr);
if (getsockname(fileno(fptr->f), (struct sockaddr*)buf, &len) < 0)
@@ -468,7 +505,7 @@ bsock_getpeername(sock)
{
char buf[1024];
socklen_t len = sizeof buf;
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(sock, fptr);
if (getpeername(fileno(fptr->f), (struct sockaddr*)buf, &len) < 0)
@@ -484,7 +521,7 @@ bsock_send(argc, argv, sock)
{
VALUE mesg, to;
VALUE flags;
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
int fd, n;
@@ -520,7 +557,7 @@ bsock_send(argc, argv, sock)
static VALUE ipaddr _((struct sockaddr*));
#ifdef HAVE_SYS_UN_H
-static VALUE unixaddr _((struct sockaddr_un*));
+static VALUE unixaddr _((struct sockaddr_un*, socklen_t));
#endif
enum sock_recv_type {
@@ -537,7 +574,7 @@ s_recvfrom(sock, argc, argv, from)
VALUE *argv;
enum sock_recv_type from;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE str;
char buf[1024];
socklen_t alen = sizeof buf;
@@ -588,13 +625,14 @@ s_recvfrom(sock, argc, argv, from)
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
}
#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));
+ if (alen && alen != sizeof(buf)) /* OSX doesn't return a 'from' result from recvfrom for connection-oriented sockets */
+ 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));
+ return rb_assoc_new(str, unixaddr((struct sockaddr_un*)buf, alen));
#endif
case RECV_SOCKET:
return rb_assoc_new(str, rb_str_new(buf, alen));
@@ -604,6 +642,70 @@ s_recvfrom(sock, argc, argv, from)
}
static VALUE
+s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
+{
+ rb_io_t *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 && alen != sizeof(buf)) /* 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;
@@ -612,6 +714,52 @@ 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()
{
@@ -937,7 +1085,8 @@ ruby_connect(fd, sockaddr, len, socks)
int mode;
#if WAIT_IN_PROGRESS > 0
int wait_in_progress = -1;
- int sockerr, sockerrlen;
+ int sockerr;
+ socklen_t sockerrlen;
#endif
#if defined(HAVE_FCNTL)
@@ -1097,7 +1246,7 @@ init_inetsock_internal(arg)
}
arg->fd = fd;
if (type == INET_SERVER) {
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__CYGWIN__)
status = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
(char*)&status, sizeof(status));
@@ -1157,6 +1306,14 @@ init_inetsock(sock, remote_host, remote_serv, local_host, local_serv, type)
inetsock_cleanup, (VALUE)&arg);
}
+/*
+ * call-seq:
+ * TCPSocket.new(remote_host, remote_port, local_host=nil, local_port=nil)
+ *
+ * Opens a TCP connection to +remote_host+ on +remote_port+. If +local_host+
+ * and +local_port+ are specified, then those parameters are used on the local
+ * end to establish the connection.
+ */
static VALUE
tcp_init(argc, argv, sock)
int argc;
@@ -1193,7 +1350,7 @@ static VALUE
socks_s_close(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't close socket");
@@ -1250,7 +1407,13 @@ 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) {
- rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
+ /* 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));
+ }
}
return ary;
@@ -1301,6 +1464,39 @@ tcp_svr_init(argc, argv, sock)
return init_inetsock(sock, Qnil, arg1, Qnil, Qnil, INET_SERVER);
}
+static void
+make_fd_nonblock(int fd)
+{
+ int flags;
+#ifdef F_GETFL
+ flags = fcntl(fd, F_GETFL);
+ if (flags == -1) {
+ rb_sys_fail(0);
+ }
+#else
+ flags = 0;
+#endif
+ flags |= O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, flags) == -1) {
+ rb_sys_fail(0);
+ }
+}
+
+static VALUE
+s_accept_nonblock(VALUE klass, rb_io_t *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)");
+ }
+ make_fd_nonblock(fd2);
+ return init_sock(rb_obj_alloc(klass), fd2);
+}
+
static VALUE
s_accept(klass, fd, sockaddr, len)
VALUE klass;
@@ -1346,7 +1542,7 @@ static VALUE
tcp_accept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
@@ -1356,11 +1552,54 @@ 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::EWOULDBLOCK, 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;
+{
+ rb_io_t *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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
@@ -1391,7 +1630,7 @@ init_unixsock(sock, path, server)
{
struct sockaddr_un sockaddr;
int fd, status;
- OpenFile *fptr;
+ rb_io_t *fptr;
SafeStringValue(path);
fd = ruby_socket(AF_UNIX, SOCK_STREAM, 0);
@@ -1401,8 +1640,11 @@ init_unixsock(sock, path, server)
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
- strncpy(sockaddr.sun_path, RSTRING(path)->ptr, sizeof(sockaddr.sun_path)-1);
- sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0';
+ 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));
if (server) {
status = bind(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
@@ -1428,7 +1670,9 @@ init_unixsock(sock, path, server)
init_sock(sock, fd);
GetOpenFile(sock, fptr);
- fptr->path = strdup(RSTRING(path)->ptr);
+ if (server) {
+ fptr->path = strdup(RSTRING(path)->ptr);
+ }
return sock;
}
@@ -1438,7 +1682,7 @@ static VALUE
ip_addr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage addr;
socklen_t len = sizeof addr;
@@ -1453,7 +1697,7 @@ static VALUE
ip_peeraddr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage addr;
socklen_t len = sizeof addr;
@@ -1534,7 +1778,7 @@ static VALUE
udp_connect(sock, host, port)
VALUE sock, host, port;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct udp_arg arg;
VALUE ret;
@@ -1552,7 +1796,7 @@ static VALUE
udp_bind(sock, host, port)
VALUE sock, host, port;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct addrinfo *res0, *res;
rb_secure(3);
@@ -1577,7 +1821,7 @@ udp_send(argc, argv, sock)
VALUE sock;
{
VALUE mesg, flags, host, port;
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
int n;
struct addrinfo *res0, *res;
@@ -1609,6 +1853,52 @@ 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)
@@ -1617,11 +1907,20 @@ 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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(sock, fptr);
if (fptr->path == 0) {
@@ -1629,7 +1928,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(addr.sun_path);
+ fptr->path = strdup(unixpath(&addr, len));
}
return rb_str_new2(fptr->path);
}
@@ -1668,7 +1967,7 @@ unix_send_io(sock, val)
{
#if defined(HAVE_SENDMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
int fd;
- OpenFile *fptr;
+ rb_io_t *fptr;
struct msghdr msg;
struct iovec vec[1];
char buf[1];
@@ -1676,12 +1975,12 @@ unix_send_io(sock, val)
#if FD_PASSING_BY_MSG_CONTROL
struct {
struct cmsghdr hdr;
- int fd;
+ char pad[8+sizeof(int)+8];
} cmsg;
#endif
if (rb_obj_is_kind_of(val, rb_cIO)) {
- OpenFile *valfptr;
+ rb_io_t *valfptr;
GetOpenFile(val, valfptr);
fd = fileno(valfptr->f);
}
@@ -1706,12 +2005,13 @@ 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 = CMSG_LEN(sizeof(int));
msg.msg_flags = 0;
+ MEMZERO((char*)&cmsg, char, sizeof(cmsg));
cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_RIGHTS;
- cmsg.fd = fd;
+ *(int *)CMSG_DATA(&cmsg.hdr) = fd;
#else
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
@@ -1748,7 +2048,7 @@ unix_recv_io(argc, argv, sock)
{
#if defined(HAVE_RECVMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
VALUE klass, mode;
- OpenFile *fptr;
+ rb_io_t *fptr;
struct msghdr msg;
struct iovec vec[2];
char buf[1];
@@ -1757,7 +2057,7 @@ unix_recv_io(argc, argv, sock)
#if FD_PASSING_BY_MSG_CONTROL
struct {
struct cmsghdr hdr;
- int fd;
+ char pad[8+sizeof(int)+8];
} cmsg;
#endif
@@ -1786,7 +2086,7 @@ unix_recv_io(argc, argv, sock)
cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_RIGHTS;
- cmsg.fd = -1;
+ *(int *)CMSG_DATA(&cmsg.hdr) = -1;
#else
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
@@ -1799,22 +2099,22 @@ unix_recv_io(argc, argv, sock)
#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)",
+ "file descriptor was not passed (msg_controllen=%d, %d expected)",
msg.msg_controllen, CMSG_SPACE(sizeof(int)));
}
- if (cmsg.hdr.cmsg_len != CMSG_SPACE(0) + sizeof(int)) {
+ if (cmsg.hdr.cmsg_len != CMSG_LEN(sizeof(int))) {
rb_raise(rb_eSocket,
- "file descriptor was not passed (cmsg_len : %d != %d)",
- cmsg.hdr.cmsg_len, CMSG_SPACE(0) + sizeof(int));
+ "file descriptor was not passed (cmsg_len=%d, %d expected)",
+ cmsg.hdr.cmsg_len, CMSG_LEN(sizeof(int)));
}
if (cmsg.hdr.cmsg_level != SOL_SOCKET) {
rb_raise(rb_eSocket,
- "file descriptor was not passed (cmsg_level : %d != %d)",
+ "file descriptor was not passed (cmsg_level=%d, %d expected)",
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)",
+ "file descriptor was not passed (cmsg_type=%d, %d expected)",
cmsg.hdr.cmsg_type, SCM_RIGHTS);
}
#else
@@ -1826,7 +2126,7 @@ unix_recv_io(argc, argv, sock)
#endif
#if FD_PASSING_BY_MSG_CONTROL
- fd = cmsg.fd;
+ fd = *(int *)CMSG_DATA(&cmsg.hdr);
#endif
if (klass == Qnil)
@@ -1852,7 +2152,7 @@ static VALUE
unix_accept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un from;
socklen_t fromlen;
@@ -1862,11 +2162,54 @@ 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::EWOULDBLOCK, 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;
+{
+ rb_io_t *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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un from;
socklen_t fromlen;
@@ -1876,18 +2219,19 @@ unix_sysaccept(sock)
}
static VALUE
-unixaddr(sockaddr)
+unixaddr(sockaddr, len)
struct sockaddr_un *sockaddr;
+ socklen_t len;
{
return rb_assoc_new(rb_str_new2("AF_UNIX"),
- rb_str_new2(sockaddr->sun_path));
+ rb_str_new2(unixpath(sockaddr, len)));
}
static VALUE
unix_addr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un addr;
socklen_t len = sizeof addr;
@@ -1895,26 +2239,22 @@ unix_addr(sock)
if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail("getsockname(2)");
- if (len == 0)
- addr.sun_path[0] = '\0';
- return unixaddr(&addr);
+ return unixaddr(&addr, len);
}
static VALUE
unix_peeraddr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un addr;
socklen_t len = sizeof addr;
GetOpenFile(sock, fptr);
if (getpeername(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
- rb_sys_fail("getsockname(2)");
- if (len == 0)
- addr.sun_path[0] = '\0';
- return unixaddr(&addr);
+ rb_sys_fail("getpeername(2)");
+ return unixaddr(&addr, len);
}
#endif
@@ -2029,16 +2369,18 @@ static VALUE
sock_s_socketpair(klass, domain, type, protocol)
VALUE klass, domain, type, protocol;
{
-#if !defined(_WIN32) && !defined(__BEOS__) && !defined(__EMX__) && !defined(__QNXNTO__) && !defined(__VMS)
- int d, t, sp[2];
+#if defined HAVE_SOCKETPAIR
+ int d, t, p, sp[2];
+ int ret;
setup_domain_and_type(domain, &d, type, &t);
- again:
- if (socketpair(d, t, NUM2INT(protocol), sp) < 0) {
- if (errno == EMFILE || errno == ENFILE) {
- rb_gc();
- goto again;
- }
+ 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) {
rb_sys_fail("socketpair(2)");
}
@@ -2069,11 +2411,122 @@ 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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int fd;
StringValue(addr);
@@ -2087,11 +2540,147 @@ 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;
+{
+ rb_io_t *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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
StringValue(addr);
GetOpenFile(sock, fptr);
@@ -2101,11 +2690,81 @@ 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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int backlog;
rb_secure(4);
@@ -2117,6 +2776,111 @@ 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;
@@ -2126,11 +2890,157 @@ 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, Errno::EWOULDBLOCK
+ * 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, '#{client.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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock2;
char buf[1024];
socklen_t len = sizeof buf;
@@ -2141,11 +3051,112 @@ 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::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
+ * IO.select([socket])
+ * retry
+ * end
+ * puts "The client said, '#{client_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;
+{
+ rb_io_t *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
+ * client_socket = Socket.for_fd( client_fd )
+ * puts "The client said, '#{client_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.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;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock2;
char buf[1024];
socklen_t len = sizeof buf;
@@ -2216,6 +3227,7 @@ make_addrinfo(res0)
return base;
}
+/* Returns a String containing the binary value of a struct sockaddr. */
VALUE
sock_sockaddr(addr, len)
struct sockaddr *addr;
@@ -2241,6 +3253,102 @@ 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;
@@ -2301,6 +3409,18 @@ 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;
@@ -2331,6 +3451,120 @@ 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;
@@ -2568,6 +3802,17 @@ 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);
@@ -2579,11 +3824,17 @@ 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;
- strncpy(sockaddr.sun_path, StringValuePtr(path), sizeof(sockaddr.sun_path)-1);
+ 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);
addr = rb_str_new((char*)&sockaddr, sizeof(sockaddr));
OBJ_INFECT(addr, path);
@@ -2595,15 +3846,24 @@ 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 (RSTRING(addr)->len != sizeof(struct sockaddr_un)) {
- rb_raise(rb_eTypeError, "sockaddr_un size differs - %ld required; %d given",
+ 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",
RSTRING(addr)->len, sizeof(struct sockaddr_un));
}
- /* xxx: should I check against sun_path size? */
- path = rb_str_new2(sockaddr->sun_path);
+ 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);
OBJ_INFECT(path, addr);
return path;
}
@@ -2620,6 +3880,31 @@ 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()
{
@@ -2643,6 +3928,7 @@ 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);
@@ -2668,6 +3954,7 @@ 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);
@@ -2678,6 +3965,7 @@ 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);
@@ -2696,6 +3984,7 @@ 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
@@ -2704,12 +3993,15 @@ 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);
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index a64aaf837c..537fc19a4e 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -14,6 +14,7 @@
#include "ruby.h"
#include "rubyio.h"
+#include "re.h"
#if defined(HAVE_FCNTL_H) || defined(_WIN32)
#include <fcntl.h>
#elif defined(HAVE_SYS_FCNTL_H)
@@ -136,6 +137,7 @@ check_modifiable(ptr)
static VALUE strio_s_allocate _((VALUE));
static VALUE strio_s_open _((int, VALUE *, VALUE));
+static void strio_init _((int, VALUE *, struct StringIO *));
static VALUE strio_initialize _((int, VALUE *, VALUE));
static VALUE strio_finalize _((VALUE));
static VALUE strio_self _((VALUE));
@@ -161,6 +163,7 @@ static VALUE strio_rewind _((VALUE));
static VALUE strio_seek _((int, VALUE *, VALUE));
static VALUE strio_get_sync _((VALUE));
static VALUE strio_each_byte _((VALUE));
+static VALUE strio_each_char _((VALUE));
static VALUE strio_getc _((VALUE));
static VALUE strio_ungetc _((VALUE, VALUE));
static VALUE strio_readchar _((VALUE));
@@ -217,13 +220,24 @@ strio_initialize(argc, argv, self)
VALUE self;
{
struct StringIO *ptr = check_strio(self);
- VALUE string, mode;
- int trunc = Qfalse;
if (!ptr) {
DATA_PTR(self) = ptr = strio_alloc();
}
rb_call_super(0, 0);
+ strio_init(argc, argv, ptr);
+ return self;
+}
+
+static void
+strio_init(argc, argv, ptr)
+ int argc;
+ VALUE *argv;
+ struct StringIO *ptr;
+{
+ VALUE string, mode;
+ int trunc = Qfalse;
+
switch (rb_scan_args(argc, argv, "02", &string, &mode)) {
case 2:
if (FIXNUM_P(mode)) {
@@ -255,7 +269,6 @@ strio_initialize(argc, argv, self)
break;
}
ptr->string = string;
- return self;
}
static VALUE
@@ -570,7 +583,8 @@ strio_reopen(argc, argv, self)
if (argc == 1 && TYPE(*argv) != T_STRING) {
return strio_copy(self, *argv);
}
- return strio_initialize(argc, argv, self);
+ strio_init(argc, argv, StringIO(self));
+ return self;
}
/*
@@ -645,6 +659,9 @@ strio_seek(argc, argv, self)
rb_scan_args(argc, argv, "11", NULL, &whence);
offset = NUM2LONG(argv[0]);
+ if (CLOSED(ptr)) {
+ rb_raise(rb_eIOError, "closed stream");
+ }
switch (NIL_P(whence) ? 0 : NUM2LONG(whence)) {
case 0:
break;
@@ -655,7 +672,7 @@ strio_seek(argc, argv, self)
offset += RSTRING(ptr->string)->len;
break;
default:
- rb_raise(rb_eArgError, "invalid whence %ld", NUM2LONG(whence));
+ error_inval("invalid whence");
}
if (offset < 0) {
error_inval(0);
@@ -695,11 +712,14 @@ strio_each_byte(self)
VALUE self;
{
struct StringIO *ptr = readable(StringIO(self));
- while (ptr->pos < RSTRING(ptr->string)->len) {
- char c = RSTRING(ptr->string)->ptr[ptr->pos++];
+
+ RETURN_ENUMERATOR(self, 0, 0);
+
+ while (ptr->pos < RSTRING_LEN(ptr->string)) {
+ char c = RSTRING_PTR(ptr->string)[ptr->pos++];
rb_yield(CHR2FIX(c));
}
- return Qnil;
+ return self;
}
/*
@@ -788,6 +808,41 @@ strio_readchar(self)
return c;
}
+/*
+ * call-seq:
+ * strio.each_char {|char| block } -> strio
+ *
+ * See IO#each_char.
+ */
+static VALUE
+strio_each_char(self)
+ VALUE self;
+{
+ struct StringIO *sio;
+ VALUE str;
+ const char *ptr;
+ size_t len;
+
+ RETURN_ENUMERATOR(self, 0, 0);
+
+ sio = readable(StringIO(self));
+ str = sio->string;
+ ptr = RSTRING_PTR(str);
+ len = RSTRING_LEN(str);
+
+ while (sio->pos < len) {
+ int pos = sio->pos;
+ char c = ptr[pos];
+ int n = mbclen(c);
+
+ if (len < pos + n) n = len - pos;
+
+ sio->pos += n;
+ rb_yield(rb_str_substr(str, pos, n));
+ }
+ return self;
+}
+
static void
bm_init_skip(skip, pat, m)
long *skip;
@@ -935,7 +990,7 @@ strio_readline(argc, argv, self)
VALUE *argv;
VALUE self;
{
- VALUE line = strio_getline(argc, argv, readable(StringIO(self)));
+ VALUE line = strio_gets(argc, argv, self);
if (NIL_P(line)) rb_eof_error();
return line;
}
@@ -956,6 +1011,8 @@ strio_each(argc, argv, self)
struct StringIO *ptr = StringIO(self);
VALUE line;
+ RETURN_ENUMERATOR(self, argc, argv);
+
while (!NIL_P(line = strio_getline(argc, argv, readable(ptr)))) {
rb_yield(line);
}
@@ -1279,11 +1336,17 @@ Init_stringio()
rb_define_method(StringIO, "path", strio_path, 0);
rb_define_method(StringIO, "each", strio_each, -1);
- rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
rb_define_method(StringIO, "each_line", strio_each, -1);
+ rb_define_method(StringIO, "lines", strio_each, -1);
+ rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
+ rb_define_method(StringIO, "bytes", strio_each_byte, 0);
+ rb_define_method(StringIO, "each_char", strio_each_char, 0);
+ rb_define_method(StringIO, "chars", strio_each_char, 0);
rb_define_method(StringIO, "getc", strio_getc, 0);
+ rb_define_method(StringIO, "getbyte", strio_getc, 0);
rb_define_method(StringIO, "ungetc", strio_ungetc, 1);
rb_define_method(StringIO, "readchar", strio_readchar, 0);
+ rb_define_method(StringIO, "readbyte", strio_readchar, 0);
rb_define_method(StringIO, "gets", strio_gets, -1);
rb_define_method(StringIO, "readline", strio_readline, -1);
rb_define_method(StringIO, "readlines", strio_readlines, -1);
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 17ec3a8f81..b5ee20282c 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -1,26 +1,15 @@
/*
+ $Id$
- strscan.c
-
- Copyright (c) 1999-2004 Minero Aoki
+ Copyright (c) 1999-2006 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"
@@ -73,10 +62,12 @@ 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));
@@ -128,18 +119,14 @@ static VALUE inspect2 _((struct strscanner *p));
======================================================================= */
static VALUE
-infect(str, p)
- VALUE str;
- struct strscanner *p;
+infect(VALUE str, struct strscanner *p)
{
OBJ_INFECT(str, p->str);
return str;
}
static VALUE
-extract_range(p, beg_i, end_i)
- struct strscanner *p;
- long beg_i, end_i;
+extract_range(struct strscanner *p, long beg_i, long end_i)
{
if (beg_i > S_LEN(p)) return Qnil;
if (end_i > S_LEN(p))
@@ -148,9 +135,7 @@ extract_range(p, beg_i, end_i)
}
static VALUE
-extract_beg_len(p, beg_i, len)
- struct strscanner *p;
- long beg_i, len;
+extract_beg_len(struct strscanner *p, long beg_i, long len)
{
if (beg_i > S_LEN(p)) return Qnil;
if (beg_i + len > S_LEN(p))
@@ -158,31 +143,25 @@ extract_beg_len(p, beg_i, len)
return infect(rb_str_new(S_PBEG(p) + beg_i, len), p);
}
-
/* =======================================================================
Constructor
======================================================================= */
-
static void
-strscan_mark(p)
- struct strscanner *p;
+strscan_mark(struct strscanner *p)
{
rb_gc_mark(p->str);
}
static void
-strscan_free(p)
- struct strscanner *p;
+strscan_free(struct strscanner *p)
{
re_free_registers(&(p->regs));
- memset(p, sizeof(struct strscanner), 0);
free(p);
}
static VALUE
-strscan_s_allocate(klass)
- VALUE klass;
+strscan_s_allocate(VALUE klass)
{
struct strscanner *p;
@@ -201,10 +180,7 @@ strscan_s_allocate(klass)
* +dup+ argument is obsolete and not used now.
*/
static VALUE
-strscan_initialize(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+strscan_initialize(int argc, VALUE *argv, VALUE self)
{
struct strscanner *p;
VALUE str, need_dup;
@@ -217,6 +193,40 @@ strscan_initialize(argc, argv, 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
@@ -228,8 +238,7 @@ strscan_initialize(argc, argv, self)
* This method is defined for backward compatibility.
*/
static VALUE
-strscan_s_mustc(self)
- VALUE self;
+strscan_s_mustc(VALUE self)
{
return self;
}
@@ -238,8 +247,7 @@ strscan_s_mustc(self)
* Reset the scan pointer (index 0) and clear matching data.
*/
static VALUE
-strscan_reset(self)
- VALUE self;
+strscan_reset(VALUE self)
{
struct strscanner *p;
@@ -257,8 +265,7 @@ strscan_reset(self)
* Set the scan pointer to the end of the string and clear matching data.
*/
static VALUE
-strscan_terminate(self)
- VALUE self;
+strscan_terminate(VALUE self)
{
struct strscanner *p;
@@ -273,8 +280,7 @@ strscan_terminate(self)
* This method is obsolete; use #terminate instead.
*/
static VALUE
-strscan_clear(self)
- VALUE self;
+strscan_clear(VALUE self)
{
rb_warning("StringScanner#clear is obsolete; use #terminate instead");
return strscan_terminate(self);
@@ -284,8 +290,7 @@ strscan_clear(self)
* Returns the string being scanned.
*/
static VALUE
-strscan_get_string(self)
- VALUE self;
+strscan_get_string(VALUE self)
{
struct strscanner *p;
@@ -300,8 +305,7 @@ strscan_get_string(self)
* Returns +str+.
*/
static VALUE
-strscan_set_string(self, str)
- VALUE self, str;
+strscan_set_string(VALUE self, VALUE str)
{
struct strscanner *p;
@@ -329,8 +333,7 @@ strscan_set_string(self, str)
* s.scan(/Dec/) # -> "Dec"
*/
static VALUE
-strscan_concat(self, str)
- VALUE self, str;
+strscan_concat(VALUE self, VALUE str)
{
struct strscanner *p;
@@ -345,7 +348,7 @@ strscan_concat(self, 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 1-based index into the string.
+ * In short, it's a 0-based index into the string.
*
* s = StringScanner.new('test string')
* s.pos # -> 0
@@ -355,8 +358,7 @@ strscan_concat(self, str)
* s.pos # -> 11
*/
static VALUE
-strscan_get_pos(self)
- VALUE self;
+strscan_get_pos(VALUE self)
{
struct strscanner *p;
@@ -374,8 +376,7 @@ strscan_get_pos(self)
* s.rest # -> "ring"
*/
static VALUE
-strscan_set_pos(self, v)
- VALUE self, v;
+strscan_set_pos(VALUE self, VALUE v)
{
struct strscanner *p;
long i;
@@ -389,14 +390,8 @@ strscan_set_pos(self, v)
return INT2NUM(i);
}
-
-/* I should implement this function? */
-#define strscan_prepare_re(re) /* none */
-
static VALUE
-strscan_do_scan(self, regex, succptr, getstr, headonly)
- VALUE self, regex;
- int succptr, getstr, headonly;
+strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
{
struct strscanner *p;
int ret;
@@ -405,10 +400,10 @@ strscan_do_scan(self, regex, succptr, getstr, headonly)
GET_SCANNER(self, p);
CLEAR_MATCH_STATUS(p);
- if (EOS_P(p)) {
+ if (S_RESTLEN(p) < 0) {
return Qnil;
}
- strscan_prepare_re(regex);
+ rb_kcode_set_option(regex);
if (headonly) {
ret = re_match(RREGEXP(regex)->ptr,
CURPTR(p), S_RESTLEN(p),
@@ -422,6 +417,7 @@ strscan_do_scan(self, regex, succptr, getstr, headonly)
S_RESTLEN(p),
&(p->regs));
}
+ rb_kcode_reset_option();
if (ret == -2) rb_raise(ScanError, "regexp buffer overflow");
if (ret < 0) {
@@ -443,13 +439,7 @@ strscan_do_scan(self, regex, succptr, getstr, headonly)
}
/*
- * call-seq:
- * scanner.scan(pattern) => String
- *
- */
-
-/*
- * call-seq: scan(pattern)
+ * call-seq: scan(pattern) => String
*
* 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.
@@ -464,8 +454,7 @@ strscan_do_scan(self, regex, succptr, getstr, headonly)
*
*/
static VALUE
-strscan_scan(self, re)
- VALUE self, re;
+strscan_scan(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 1, 1, 1);
}
@@ -482,8 +471,7 @@ strscan_scan(self, re)
* p s.match?(/\s+/) # -> nil
*/
static VALUE
-strscan_match_p(self, re)
- VALUE self, re;
+strscan_match_p(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 0, 0, 1);
}
@@ -506,8 +494,7 @@ strscan_match_p(self, re)
*
*/
static VALUE
-strscan_skip(self, re)
- VALUE self, re;
+strscan_skip(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 1, 0, 1);
}
@@ -528,8 +515,7 @@ strscan_skip(self, re)
* Mnemonic: it "checks" to see whether a #scan will return a value.
*/
static VALUE
-strscan_check(self, re)
- VALUE self, re;
+strscan_check(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 0, 1, 1);
}
@@ -545,8 +531,7 @@ strscan_check(self, re)
* "full" means "#scan with full parameters".
*/
static VALUE
-strscan_scan_full(self, re, s, f)
- VALUE self, re, s, f;
+strscan_scan_full(VALUE self, VALUE re, VALUE s, VALUE f)
{
return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1);
}
@@ -565,8 +550,7 @@ strscan_scan_full(self, re, s, f)
* s.scan_until(/XYZ/) # -> nil
*/
static VALUE
-strscan_scan_until(self, re)
- VALUE self, re;
+strscan_scan_until(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 1, 1, 0);
}
@@ -585,8 +569,7 @@ strscan_scan_until(self, re)
* s.exist? /e/ # -> nil
*/
static VALUE
-strscan_exist_p(self, re)
- VALUE self, re;
+strscan_exist_p(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 0, 0, 0);
}
@@ -608,8 +591,7 @@ strscan_exist_p(self, re)
* s #
*/
static VALUE
-strscan_skip_until(self, re)
- VALUE self, re;
+strscan_skip_until(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 1, 0, 0);
}
@@ -628,8 +610,7 @@ strscan_skip_until(self, re)
* Mnemonic: it "checks" to see whether a #scan_until will return a value.
*/
static VALUE
-strscan_check_until(self, re)
- VALUE self, re;
+strscan_check_until(VALUE self, VALUE re)
{
return strscan_do_scan(self, re, 0, 1, 0);
}
@@ -644,16 +625,14 @@ strscan_check_until(self, re)
* This method does affect the match register.
*/
static VALUE
-strscan_search_full(self, re, s, f)
- VALUE self, re, s, f;
+strscan_search_full(VALUE self, VALUE re, VALUE s, VALUE 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(p)
- struct strscanner *p;
+adjust_registers_to_matched(struct strscanner *p)
{
if (p->regs.allocated == 0) {
p->regs.beg = ALLOC_N(int, RE_NREGS);
@@ -667,15 +646,21 @@ adjust_registers_to_matched(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(self)
- VALUE self;
+strscan_getch(VALUE self)
{
struct strscanner *p;
long len;
@@ -684,10 +669,10 @@ strscan_getch(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);
@@ -697,24 +682,30 @@ strscan_getch(self)
}
/*
- * Scans one byte and returns it. Similar to, but not the same as, #getch.
+ * Scans one byte and returns it.
+ * This method is NOT multi-byte character sensitive.
+ * See also #getch.
*
- * s = StringScanner.new('ab')
- * s.get_byte # => "a"
- * s.get_byte # => "b"
- * s.get_byte # => nil
+ * 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
*/
static VALUE
-strscan_get_byte(self)
- VALUE self;
+strscan_get_byte(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);
@@ -728,8 +719,7 @@ strscan_get_byte(self)
* This method is obsolete; use #get_byte instead.
*/
static VALUE
-strscan_getbyte(self)
- VALUE self;
+strscan_getbyte(VALUE self)
{
rb_warning("StringScanner#getbyte is obsolete; use #get_byte instead");
return strscan_get_byte(self);
@@ -747,20 +737,19 @@ strscan_getbyte(self)
*
*/
static VALUE
-strscan_peek(self, vlen)
- VALUE self, vlen;
+strscan_peek(VALUE self, VALUE 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);
}
@@ -769,8 +758,7 @@ strscan_peek(self, vlen)
* This method is obsolete; use #peek instead.
*/
static VALUE
-strscan_peep(self, vlen)
- VALUE self, vlen;
+strscan_peep(VALUE self, VALUE vlen)
{
rb_warning("StringScanner#peep is obsolete; use #peek instead");
return strscan_peek(self, vlen);
@@ -785,18 +773,17 @@ strscan_peep(self, vlen)
* s.unscan
* s.scan(/../) # => "te"
* s.scan(/\d/) # => nil
- * s.unscan # ScanError: can't unscan: prev match had failed
+ * s.unscan # ScanError: unscan failed: previous match had failed
*/
static VALUE
-strscan_unscan(self)
- VALUE self;
+strscan_unscan(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
- if (! MATCHED_P(p))
- rb_raise(ScanError, "can't unscan: prev match had failed");
-
+ if (! MATCHED_P(p)) {
+ rb_raise(ScanError, "unscan failed: previous match had failed");
+ }
p->curr = p->prev;
CLEAR_MATCH_STATUS(p);
return self;
@@ -815,8 +802,7 @@ strscan_unscan(self)
* s.bol? # => true
*/
static VALUE
-strscan_bol_p(self)
- VALUE self;
+strscan_bol_p(VALUE self)
{
struct strscanner *p;
@@ -837,16 +823,12 @@ strscan_bol_p(self)
* p s.eos? # => true
*/
static VALUE
-strscan_eos_p(self)
- VALUE self;
+strscan_eos_p(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
- if (EOS_P(p))
- return Qtrue;
- else
- return Qfalse;
+ return EOS_P(p) ? Qtrue : Qfalse;
}
/*
@@ -854,8 +836,7 @@ strscan_eos_p(self)
* This method is obsolete, use #eos? instead.
*/
static VALUE
-strscan_empty_p(self)
- VALUE self;
+strscan_empty_p(VALUE self)
{
rb_warning("StringScanner#empty? is obsolete; use #eos? instead");
return strscan_eos_p(self);
@@ -870,16 +851,12 @@ strscan_empty_p(self)
* s.rest? # are opposites.
*/
static VALUE
-strscan_rest_p(self)
- VALUE self;
+strscan_rest_p(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
- if (EOS_P(p))
- return Qfalse;
- else
- return Qtrue;
+ return EOS_P(p) ? Qfalse : Qtrue;
}
/*
@@ -892,16 +869,12 @@ strscan_rest_p(self)
* s.matched? # => false
*/
static VALUE
-strscan_matched_p(self)
- VALUE self;
+strscan_matched_p(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
- if (MATCHED_P(p))
- return Qtrue;
- else
- return Qfalse;
+ return MATCHED_P(p) ? Qtrue : Qfalse;
}
/*
@@ -912,8 +885,7 @@ strscan_matched_p(self)
* s.matched # -> "test"
*/
static VALUE
-strscan_matched(self)
- VALUE self;
+strscan_matched(VALUE self)
{
struct strscanner *p;
@@ -935,8 +907,7 @@ strscan_matched(self)
* s.matched_size # -> nil
*/
static VALUE
-strscan_matched_size(self)
- VALUE self;
+strscan_matched_size(VALUE self)
{
struct strscanner *p;
@@ -951,8 +922,7 @@ strscan_matched_size(self)
* This method is obsolete; use #matched_size instead.
*/
static VALUE
-strscan_matchedsize(self)
- VALUE self;
+strscan_matchedsize(VALUE self)
{
rb_warning("StringScanner#matchedsize is obsolete; use #matched_size instead");
return strscan_matched_size(self);
@@ -973,8 +943,7 @@ strscan_matchedsize(self)
* s.pre_match # -> ""
*/
static VALUE
-strscan_aref(self, idx)
- VALUE self, idx;
+strscan_aref(VALUE self, VALUE idx)
{
struct strscanner *p;
long i;
@@ -1003,8 +972,7 @@ strscan_aref(self, idx)
* s.post_match # -> "string"
*/
static VALUE
-strscan_pre_match(self)
- VALUE self;
+strscan_pre_match(VALUE self)
{
struct strscanner *p;
@@ -1024,8 +992,7 @@ strscan_pre_match(self)
* s.post_match # -> "string"
*/
static VALUE
-strscan_post_match(self)
- VALUE self;
+strscan_post_match(VALUE self)
{
struct strscanner *p;
@@ -1040,8 +1007,7 @@ strscan_post_match(self)
* If there is no more data (eos? = true), it returns <tt>""</tt>.
*/
static VALUE
-strscan_rest(self)
- VALUE self;
+strscan_rest(VALUE self)
{
struct strscanner *p;
@@ -1056,8 +1022,7 @@ strscan_rest(self)
* <tt>s.rest_size</tt> is equivalent to <tt>s.rest.size</tt>.
*/
static VALUE
-strscan_rest_size(self)
- VALUE self;
+strscan_rest_size(VALUE self)
{
struct strscanner *p;
long i;
@@ -1076,8 +1041,7 @@ strscan_rest_size(self)
* This method is obsolete; use #rest_size instead.
*/
static VALUE
-strscan_restsize(self)
- VALUE self;
+strscan_restsize(VALUE self)
{
rb_warning("StringScanner#restsize is obsolete; use #rest_size instead");
return strscan_rest_size(self);
@@ -1098,8 +1062,7 @@ strscan_restsize(self)
* s.inspect # -> '#<StringScanner 10/21 "...ec 12" @ " 1975...">'
*/
static VALUE
-strscan_inspect(self)
- VALUE self;
+strscan_inspect(VALUE self)
{
struct strscanner *p;
char buf[BUFSIZE];
@@ -1136,8 +1099,7 @@ strscan_inspect(self)
}
static VALUE
-inspect1(p)
- struct strscanner *p;
+inspect1(struct strscanner *p)
{
char buf[BUFSIZE];
char *bp = buf;
@@ -1156,8 +1118,7 @@ inspect1(p)
}
static VALUE
-inspect2(p)
- struct strscanner *p;
+inspect2(struct strscanner *p)
{
char buf[BUFSIZE];
char *bp = buf;
@@ -1236,7 +1197,7 @@ inspect2(p)
* === Advancing the Scan Pointer
*
* - #getch
- * - #getbyte
+ * - #get_byte
* - #scan
* - #scan_until
* - #skip
@@ -1252,7 +1213,7 @@ inspect2(p)
*
* === Finding Where we Are
*
- * - #bol?
+ * - #beginning_of_line? (#bol?)
* - #eos?
* - #rest?
* - #rest_size
@@ -1284,7 +1245,7 @@ inspect2(p)
* There are aliases to several of the methods.
*/
void
-Init_strscan()
+Init_strscan(void)
{
ID id_scanerr = rb_intern("ScanError");
VALUE tmp;
@@ -1303,6 +1264,7 @@ Init_strscan()
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);
@@ -1337,7 +1299,7 @@ Init_strscan()
rb_define_method(StringScanner, "unscan", strscan_unscan, 0);
rb_define_method(StringScanner, "beginning_of_line?", strscan_bol_p, 0);
- rb_define_method(StringScanner, "bol?", strscan_bol_p, 0);
+ rb_alias(StringScanner, rb_intern("bol?"), rb_intern("beginning_of_line?"));
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 bae1f4f45e..567aaf52a8 100644
--- a/ext/syck/bytecode.c
+++ b/ext/syck/bytecode.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.3 on Tue Apr 12 20:34:14 2005 */
+/* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */
#line 1 "bytecode.re"
/*
* bytecode.re
@@ -135,7 +135,6 @@ int
sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
{
SyckLevel *lvl;
- int doc_level = 0;
syck_parser_ptr = parser;
if ( YYCURSOR == NULL )
{
@@ -149,7 +148,7 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
return t;
}
-#line 173 "bytecode.re"
+#line 172 "bytecode.re"
lvl = CURRENT_LEVEL();
@@ -158,22 +157,22 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
goto Document;
}
-Header:
+/* Header: */
YYTOKEN = YYCURSOR;
-#line 7 "<stdout>"
+#line 165 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
-yy1: ++YYCURSOR;
+ ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy2;
+ case 0x00: goto yy2;
case 'D': goto yy3;
default: goto yy5;
}
@@ -184,22 +183,22 @@ yy2: YYCURSOR = YYMARKER;
yy3: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\n': goto yy6;
- case '\r': goto yy8;
+ case 0x0A: goto yy6;
+ case 0x0D: goto yy8;
default: goto yy4;
}
yy4:
-#line 200 "bytecode.re"
+#line 199 "bytecode.re"
{ YYPOS(0);
goto Document;
}
-#line 37 "<stdout>"
+#line 195 "<stdout>"
yy5: yych = *++YYCURSOR;
goto yy4;
yy6: ++YYCURSOR;
goto yy7;
yy7:
-#line 187 "bytecode.re"
+#line 186 "bytecode.re"
{ if ( lvl->status == syck_lvl_header )
{
CHK_NL(YYCURSOR);
@@ -212,14 +211,14 @@ yy7:
return 0;
}
}
-#line 56 "<stdout>"
+#line 214 "<stdout>"
yy8: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\n': goto yy6;
+ case 0x0A: goto yy6;
default: goto yy2;
}
}
-#line 204 "bytecode.re"
+#line 203 "bytecode.re"
Document:
@@ -233,19 +232,18 @@ Document:
YYTOKEN = YYCURSOR;
-#line 65 "<stdout>"
+#line 235 "<stdout>"
{
YYCTYPE yych;
- unsigned int yyaccept;
goto yy9;
-yy10: ++YYCURSOR;
+ ++YYCURSOR;
yy9:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy30;
- case '\n': goto yy27;
- case '\r': goto yy29;
+ case 0x00: goto yy30;
+ case 0x0A: goto yy27;
+ case 0x0D: goto yy29;
case 'A': goto yy19;
case 'D': goto yy12;
case 'E': goto yy16;
@@ -260,68 +258,68 @@ yy9:
}
yy11:yy12: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy41;
- case '\r': goto yy44;
+ case 0x0A: goto yy41;
+ case 0x0D: goto yy44;
default: goto yy11;
}
yy13: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy41;
- case '\r': goto yy43;
+ case 0x0A: goto yy41;
+ case 0x0D: goto yy43;
default: goto yy11;
}
yy14: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy38;
- case '\r': goto yy40;
+ case 0x0A: goto yy38;
+ case 0x0D: goto yy40;
default: goto yy11;
}
yy15: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy35;
- case '\r': goto yy37;
+ case 0x0A: goto yy35;
+ case 0x0D: goto yy37;
default: goto yy11;
}
yy16: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy32;
- case '\r': goto yy34;
+ case 0x0A: goto yy32;
+ case 0x0D: goto yy34;
default: goto yy11;
}
yy17: ++YYCURSOR;
goto yy18;
yy18:
-#line 289 "bytecode.re"
+#line 288 "bytecode.re"
{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
goto Scalar;
}
-#line 127 "<stdout>"
+#line 296 "<stdout>"
yy19: ++YYCURSOR;
goto yy20;
yy20:
-#line 293 "bytecode.re"
+#line 292 "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 138 "<stdout>"
+#line 307 "<stdout>"
yy21: ++YYCURSOR;
goto yy22;
yy22:
-#line 300 "bytecode.re"
+#line 299 "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 149 "<stdout>"
+#line 318 "<stdout>"
yy23: ++YYCURSOR;
goto yy24;
yy24:
-#line 307 "bytecode.re"
+#line 306 "bytecode.re"
{ char *qstr;
ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
qstr = get_inline( parser );
@@ -381,17 +379,17 @@ yy24:
sycklval->name = qstr;
return YAML_TAGURI;
}
-#line 213 "<stdout>"
+#line 382 "<stdout>"
yy25: ++YYCURSOR;
goto yy26;
yy26:
-#line 367 "bytecode.re"
+#line 366 "bytecode.re"
{ goto Comment; }
-#line 219 "<stdout>"
+#line 388 "<stdout>"
yy27: ++YYCURSOR;
goto yy28;
yy28:
-#line 369 "bytecode.re"
+#line 368 "bytecode.re"
{ CHK_NL(YYCURSOR);
if ( lvl->status == syck_lvl_seq )
{
@@ -404,25 +402,25 @@ yy28:
}
goto Document;
}
-#line 236 "<stdout>"
+#line 405 "<stdout>"
yy29: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy27;
+ case 0x0A: goto yy27;
default: goto yy11;
}
yy30: ++YYCURSOR;
goto yy31;
yy31:
-#line 382 "bytecode.re"
+#line 381 "bytecode.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 250 "<stdout>"
+#line 419 "<stdout>"
yy32: ++YYCURSOR;
goto yy33;
yy33:
-#line 253 "bytecode.re"
+#line 252 "bytecode.re"
{ if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 )
{
lvl->ncount++;
@@ -458,16 +456,16 @@ yy33:
CHK_NL(YYCURSOR);
return YAML_IEND;
}
-#line 290 "<stdout>"
+#line 459 "<stdout>"
yy34: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy32;
+ case 0x0A: goto yy32;
default: goto yy11;
}
yy35: ++YYCURSOR;
goto yy36;
yy36:
-#line 238 "bytecode.re"
+#line 237 "bytecode.re"
{ int complex = 0;
if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
{
@@ -482,16 +480,16 @@ yy36:
}
return YAML_IOPEN;
}
-#line 314 "<stdout>"
+#line 483 "<stdout>"
yy37: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy35;
+ case 0x0A: goto yy35;
default: goto yy11;
}
yy38: ++YYCURSOR;
goto yy39;
yy39:
-#line 223 "bytecode.re"
+#line 222 "bytecode.re"
{ int complex = 0;
if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
{
@@ -506,33 +504,33 @@ yy39:
}
return YAML_IOPEN;
}
-#line 338 "<stdout>"
+#line 507 "<stdout>"
yy40: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy38;
+ case 0x0A: goto yy38;
default: goto yy11;
}
yy41: ++YYCURSOR;
goto yy42;
yy42:
-#line 218 "bytecode.re"
+#line 217 "bytecode.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 352 "<stdout>"
+#line 521 "<stdout>"
yy43: yych = *++YYCURSOR;
switch(yych){
- case '\n': goto yy41;
+ case 0x0A: goto yy41;
default: goto yy11;
}
yy44: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\n': goto yy41;
+ case 0x0A: goto yy41;
default: goto yy11;
}
}
-#line 387 "bytecode.re"
+#line 386 "bytecode.re"
}
@@ -542,17 +540,17 @@ Directive:
YYTOKEN = YYCURSOR;
-#line 366 "<stdout>"
+#line 543 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy45;
-yy46: ++YYCURSOR;
+ ++YYCURSOR;
yy45:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy47;
+ case 0x00: goto yy47;
case 'V': goto yy48;
default: goto yy50;
}
@@ -641,15 +639,15 @@ yy48: yyaccept = 0;
default: goto yy49;
}
yy49:
-#line 400 "bytecode.re"
+#line 399 "bytecode.re"
{ YYCURSOR = YYTOKEN;
return YAML_DOCSEP;
}
-#line 469 "<stdout>"
+#line 646 "<stdout>"
yy50: yych = *++YYCURSOR;
goto yy49;
yy51: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy52;
yy52: switch(yych){
@@ -809,12 +807,12 @@ yy53: yych = *++YYCURSOR;
default: goto yy47;
}
yy54: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy55;
yy55: switch(yych){
- case '\n': goto yy56;
- case '\r': goto yy58;
+ case 0x0A: goto yy56;
+ case 0x0D: goto yy58;
case '.':
case '/':
case '0':
@@ -895,17 +893,17 @@ yy55: switch(yych){
yy56: ++YYCURSOR;
goto yy57;
yy57:
-#line 397 "bytecode.re"
+#line 396 "bytecode.re"
{ CHK_NL(YYCURSOR);
goto Directive; }
-#line 724 "<stdout>"
+#line 899 "<stdout>"
yy58: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\n': goto yy56;
+ case 0x0A: goto yy56;
default: goto yy47;
}
}
-#line 403 "bytecode.re"
+#line 402 "bytecode.re"
}
@@ -915,44 +913,43 @@ Comment:
YYTOKEN = YYCURSOR;
-#line 733 "<stdout>"
+#line 916 "<stdout>"
{
YYCTYPE yych;
- unsigned int yyaccept;
goto yy59;
-yy60: ++YYCURSOR;
+ ++YYCURSOR;
yy59:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy61;
- case '\n': goto yy62;
- case '\r': goto yy64;
+ case 0x00: goto yy61;
+ case 0x0A: goto yy62;
+ case 0x0D: goto yy64;
default: goto yy66;
}
yy61:yy62: ++YYCURSOR;
goto yy63;
yy63:
-#line 413 "bytecode.re"
+#line 412 "bytecode.re"
{ CHK_NL(YYCURSOR);
goto Document; }
-#line 754 "<stdout>"
+#line 936 "<stdout>"
yy64: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\n': goto yy67;
+ case 0x0A: goto yy67;
default: goto yy65;
}
yy65:
-#line 416 "bytecode.re"
+#line 415 "bytecode.re"
{ goto Comment; }
-#line 763 "<stdout>"
+#line 945 "<stdout>"
yy66: yych = *++YYCURSOR;
goto yy65;
yy67: ++YYCURSOR;
yych = *YYCURSOR;
goto yy63;
}
-#line 418 "bytecode.re"
+#line 417 "bytecode.re"
}
@@ -970,19 +967,18 @@ Scalar2:
tok = YYCURSOR;
-#line 771 "<stdout>"
+#line 970 "<stdout>"
{
YYCTYPE yych;
- unsigned int yyaccept;
goto yy68;
-yy69: ++YYCURSOR;
+ ++YYCURSOR;
yy68:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy74;
- case '\n': goto yy70;
- case '\r': goto yy72;
+ case 0x00: goto yy74;
+ case 0x0A: goto yy70;
+ case 0x0D: goto yy72;
default: goto yy76;
}
yy70: ++YYCURSOR;
@@ -993,30 +989,30 @@ yy70: ++YYCURSOR;
default: goto yy71;
}
yy71:
-#line 462 "bytecode.re"
+#line 461 "bytecode.re"
{ YYCURSOR = tok;
goto ScalarEnd;
}
-#line 798 "<stdout>"
+#line 996 "<stdout>"
yy72: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\n': goto yy77;
+ case 0x0A: goto yy77;
default: goto yy73;
}
yy73:
-#line 470 "bytecode.re"
+#line 469 "bytecode.re"
{ CAT(str, cap, idx, tok[0]);
goto Scalar2;
}
-#line 809 "<stdout>"
+#line 1007 "<stdout>"
yy74: ++YYCURSOR;
goto yy75;
yy75:
-#line 466 "bytecode.re"
+#line 465 "bytecode.re"
{ YYCURSOR = tok;
goto ScalarEnd;
}
-#line 817 "<stdout>"
+#line 1015 "<stdout>"
yy76: yych = *++YYCURSOR;
goto yy73;
yy77: yych = *++YYCURSOR;
@@ -1029,10 +1025,10 @@ yy77: yych = *++YYCURSOR;
yy78: ++YYCURSOR;
goto yy79;
yy79:
-#line 436 "bytecode.re"
+#line 435 "bytecode.re"
{ CHK_NL(tok+1);
goto Scalar2; }
-#line 833 "<stdout>"
+#line 1031 "<stdout>"
yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1051,7 +1047,7 @@ yy81: switch(yych){
default: goto yy82;
}
yy82:
-#line 439 "bytecode.re"
+#line 438 "bytecode.re"
{ CHK_NL(tok+1);
if ( tok + 2 < YYCURSOR )
{
@@ -1069,18 +1065,18 @@ yy82:
}
goto Scalar2;
}
-#line 871 "<stdout>"
+#line 1068 "<stdout>"
yy83: ++YYCURSOR;
goto yy84;
yy84:
-#line 457 "bytecode.re"
+#line 456 "bytecode.re"
{ CHK_NL(tok+1);
CAT(str, cap, idx, '\0');
goto Scalar2;
}
-#line 880 "<stdout>"
+#line 1077 "<stdout>"
}
-#line 474 "bytecode.re"
+#line 473 "bytecode.re"
ScalarEnd:
@@ -1115,54 +1111,53 @@ Inline:
tok = YYCURSOR;
-#line 884 "<stdout>"
+#line 1114 "<stdout>"
{
YYCTYPE yych;
- unsigned int yyaccept;
goto yy85;
-yy86: ++YYCURSOR;
+ ++YYCURSOR;
yy85:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy91;
- case '\n': goto yy87;
- case '\r': goto yy89;
+ case 0x00: goto yy91;
+ case 0x0A: goto yy87;
+ case 0x0D: goto yy89;
default: goto yy93;
}
yy87: ++YYCURSOR;
goto yy88;
yy88:
-#line 509 "bytecode.re"
+#line 508 "bytecode.re"
{ CHK_NL(YYCURSOR);
return str; }
-#line 905 "<stdout>"
+#line 1134 "<stdout>"
yy89: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
- case '\n': goto yy94;
+ case 0x0A: goto yy94;
default: goto yy90;
}
yy90:
-#line 516 "bytecode.re"
+#line 515 "bytecode.re"
{ CAT(str, cap, idx, tok[0]);
goto Inline;
}
-#line 916 "<stdout>"
+#line 1145 "<stdout>"
yy91: ++YYCURSOR;
goto yy92;
yy92:
-#line 512 "bytecode.re"
+#line 511 "bytecode.re"
{ YYCURSOR = tok;
return str;
}
-#line 924 "<stdout>"
+#line 1153 "<stdout>"
yy93: yych = *++YYCURSOR;
goto yy90;
yy94: ++YYCURSOR;
yych = *YYCURSOR;
goto yy88;
}
-#line 520 "bytecode.re"
+#line 519 "bytecode.re"
}
diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c
index 6a5e43c9ee..9c8ab8d49b 100644
--- a/ext/syck/emitter.c
+++ b/ext/syck/emitter.c
@@ -314,7 +314,6 @@ syck_emitter_write( SyckEmitter *e, char *str, long len )
*/
S_MEMCPY( e->marker, str, char, len );
e->marker += len;
- e->marker[0] = '\0';
}
/*
@@ -359,7 +358,8 @@ syck_emit( SyckEmitter *e, st_data_t n )
{
SYMID oid;
char *anchor_name = NULL;
- int indent = 0, x = 0;
+ int indent = 0;
+ long x = 0;
SyckLevel *lvl = syck_emitter_current_level( e );
/*
@@ -559,7 +559,8 @@ syck_scan_scalar( int req_width, char *cursor, long len )
}
if ( ( cursor[0] == '-' || cursor[0] == ':' ||
cursor[0] == '?' || cursor[0] == ',' ) &&
- cursor[1] == ' ' ) {
+ ( len == 1 || cursor[1] == ' ' || cursor[1] == '\n' ) )
+ {
flags |= SCAN_INDIC_S;
}
@@ -618,11 +619,13 @@ syck_scan_scalar( int req_width, char *cursor, long len )
}
/* 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] == ':' &&
+ ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) )
{
flags |= SCAN_INDIC_C;
}
- else if ( cursor[i] == ',' && cursor[i+1] == ' ' )
+ else if ( cursor[i] == ',' &&
+ ( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) )
{
flags |= SCAN_FLOWMAP;
flags |= SCAN_FLOWSEQ;
@@ -642,7 +645,7 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style,
enum scalar_style favor_style = scalar_literal;
SyckLevel *parent = syck_emitter_parent_level( e );
SyckLevel *lvl = syck_emitter_current_level( e );
- int scan;
+ int scan = 0;
char *implicit;
if ( str == NULL ) str = "";
@@ -663,6 +666,14 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style,
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 );
@@ -710,7 +721,7 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style,
}
/* For now, all ambiguous keys are going to be double-quoted */
- if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 ) {
+ if ( ( parent->status == syck_lvl_map || parent->status == syck_lvl_mapx ) && parent->ncount % 2 == 1 ) {
if ( force_style != scalar_plain ) {
force_style = scalar_2quote;
}
@@ -737,6 +748,7 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style,
syck_emit_1quoted( e, force_width, str, len );
break;
+ case scalar_none:
case scalar_2quote:
syck_emit_2quoted( e, force_width, str, len );
break;
@@ -753,6 +765,11 @@ void syck_emit_scalar( SyckEmitter *e, char *tag, enum scalar_style force_style,
syck_emitter_write( e, str, len );
break;
}
+
+ if ( parent->status == syck_lvl_mapx )
+ {
+ syck_emitter_write( e, "\n", 1 );
+ }
}
void
@@ -985,6 +1002,11 @@ void syck_emit_seq( SyckEmitter *e, char *tag, enum seq_style style )
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;
}
}
@@ -1001,6 +1023,11 @@ void syck_emit_map( SyckEmitter *e, char *tag, enum map_style style )
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;
}
}
@@ -1018,18 +1045,11 @@ void syck_emit_item( SyckEmitter *e, st_data_t n )
{
SyckLevel *parent = syck_emitter_parent_level( e );
- /* seq-in-map shortcut */
- if ( parent->status == syck_lvl_map && lvl->ncount == 0 ) {
- /* complex key */
- if ( parent->ncount % 2 == 1 ) {
- syck_emitter_write( e, "?", 1 );
- parent->status = syck_lvl_mapx;
- /* 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. */
- } else if ( lvl->anctag == 0 ) {
- lvl->spaces = parent->spaces;
- }
+ /* 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 */
@@ -1062,15 +1082,6 @@ void syck_emit_item( SyckEmitter *e, st_data_t n )
{
SyckLevel *parent = syck_emitter_parent_level( e );
- /* map-in-map */
- if ( parent->status == syck_lvl_map && lvl->ncount == 0 ) {
- /* complex key */
- if ( parent->ncount % 2 == 1 ) {
- syck_emitter_write( e, "?", 1 );
- parent->status = syck_lvl_mapx;
- }
- }
-
/* map-in-seq shortcut */
if ( lvl->anctag == 0 && parent->status == syck_lvl_seq && lvl->ncount == 0 ) {
int spcs = ( lvl->spaces - parent->spaces ) - 2;
@@ -1122,6 +1133,8 @@ void syck_emit_item( SyckEmitter *e, st_data_t n )
}
}
break;
+
+ default: break;
}
lvl->ncount++;
@@ -1162,6 +1175,8 @@ void syck_emit_end( SyckEmitter *e )
case syck_lvl_imap:
syck_emitter_write( e, "}\n", 1 );
break;
+
+ default: break;
}
}
diff --git a/ext/syck/handler.c b/ext/syck/handler.c
index d070efa8e5..56fe838fbd 100644
--- a/ext/syck/handler.c
+++ b/ext/syck/handler.c
@@ -31,7 +31,6 @@ syck_hdlr_add_node( SyckParser *p, SyckNode *n )
SyckNode *
syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
{
- char *atmp = NULL;
SyckNode *ntmp = NULL;
n->anchor = a;
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c
index cce7a9f4e3..d356faf7d9 100644
--- a/ext/syck/implicit.c
+++ b/ext/syck/implicit.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.3 on Wed Mar 30 08:27:25 2005 */
+/* Generated by re2c 0.9.10 on Mon Sep 19 21:46:50 2005 */
#line 1 "implicit.re"
/*
* implicit.re
@@ -52,17 +52,17 @@ char *syck_match_implicit( char *str, size_t len )
limit = str + len;
-#line 6 "<stdout>"
+#line 55 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
-yy1: ++YYCURSOR;
+ ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 26) YYFILL(26);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy6;
+ case 0x00: goto yy6;
case '+': goto yy16;
case '-': goto yy17;
case '.': goto yy20;
@@ -92,12 +92,12 @@ yy0:
default: goto yy23;
}
yy2: ++YYCURSOR;
- if((yych = *YYCURSOR) <= '\000') goto yy6;
+ if((yych = *YYCURSOR) <= 0x00) goto yy6;
goto yy3;
yy3:
#line 123 "implicit.re"
{ return "str"; }
-#line 51 "<stdout>"
+#line 100 "<stdout>"
yy4: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -118,7 +118,7 @@ yy6: ++YYCURSOR;
yy7:
#line 85 "implicit.re"
{ return "null"; }
-#line 72 "<stdout>"
+#line 121 "<stdout>"
yy8: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -208,7 +208,7 @@ yy17: yyaccept = 0;
yy18: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\000': goto yy52;
+ case 0x00: goto yy52;
case ',': goto yy142;
case '.': goto yy50;
case '0':
@@ -228,7 +228,7 @@ yy18: yyaccept = 0;
yy19: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
- case '\000': goto yy52;
+ case 0x00: goto yy52;
case ',': goto yy47;
case '.': goto yy50;
case '0':
@@ -254,7 +254,7 @@ yy20: yyaccept = 0;
default: goto yy3;
}
yy21: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy28;
+ if(yych <= 0x00) goto yy28;
goto yy3;
yy22: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -265,7 +265,7 @@ yy22: yyaccept = 0;
yy23: yych = *++YYCURSOR;
goto yy3;
yy24: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy26;
+ if(yych <= 0x00) goto yy26;
goto yy25;
yy25: YYCURSOR = YYMARKER;
switch(yyaccept){
@@ -276,13 +276,13 @@ yy26: ++YYCURSOR;
yy27:
#line 121 "implicit.re"
{ return "merge"; }
-#line 230 "<stdout>"
+#line 279 "<stdout>"
yy28: ++YYCURSOR;
goto yy29;
yy29:
#line 119 "implicit.re"
{ return "default"; }
-#line 236 "<stdout>"
+#line 285 "<stdout>"
yy30: yych = *++YYCURSOR;
switch(yych){
case 'a': goto yy45;
@@ -316,14 +316,14 @@ yy35: yych = *++YYCURSOR;
default: goto yy25;
}
yy36: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy25;
+ if(yych >= 0x01) goto yy25;
goto yy37;
yy37: ++YYCURSOR;
goto yy38;
yy38:
#line 105 "implicit.re"
{ return "float#inf"; }
-#line 277 "<stdout>"
+#line 326 "<stdout>"
yy39: yych = *++YYCURSOR;
switch(yych){
case 'f': goto yy36;
@@ -340,14 +340,14 @@ yy41: yych = *++YYCURSOR;
default: goto yy25;
}
yy42: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy25;
+ if(yych >= 0x01) goto yy25;
goto yy43;
yy43: ++YYCURSOR;
goto yy44;
yy44:
#line 109 "implicit.re"
{ return "float#nan"; }
-#line 301 "<stdout>"
+#line 350 "<stdout>"
yy45: yych = *++YYCURSOR;
switch(yych){
case 'n': goto yy42;
@@ -372,7 +372,7 @@ yy47: ++YYCURSOR;
yych = *YYCURSOR;
goto yy48;
yy48: switch(yych){
- case '\000': goto yy52;
+ case 0x00: goto yy52;
case ',': case '0':
case '1':
case '2':
@@ -404,11 +404,11 @@ yy49: ++YYCURSOR;
default: goto yy25;
}
yy50: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
goto yy51;
yy51: switch(yych){
- case '\000': goto yy56;
+ case 0x00: goto yy56;
case ',': goto yy54;
case '.': goto yy58;
case '0':
@@ -429,13 +429,13 @@ yy52: ++YYCURSOR;
yy53:
#line 97 "implicit.re"
{ return "int"; }
-#line 386 "<stdout>"
+#line 432 "<stdout>"
yy54: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy55;
yy55: switch(yych){
- case '\000': goto yy56;
+ case 0x00: goto yy56;
case ',': case '0':
case '1':
case '2':
@@ -453,9 +453,9 @@ yy56: ++YYCURSOR;
yy57:
#line 99 "implicit.re"
{ return "float#fix"; }
-#line 411 "<stdout>"
+#line 456 "<stdout>"
yy58: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
goto yy59;
yy59: switch(yych){
@@ -478,14 +478,14 @@ yy60: yych = *++YYCURSOR;
default: goto yy25;
}
yy61: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy25;
+ if(yych <= 0x00) goto yy25;
goto yy63;
yy62: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy63;
yy63: switch(yych){
- case '\000': goto yy64;
+ case 0x00: goto yy64;
case '0':
case '1':
case '2':
@@ -503,12 +503,12 @@ yy64: ++YYCURSOR;
yy65:
#line 101 "implicit.re"
{ return "float#exp"; }
-#line 463 "<stdout>"
+#line 506 "<stdout>"
yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy70;
+ case 0x00: goto yy70;
case '.': goto yy68;
case '0':
case '1':
@@ -527,7 +527,7 @@ yy67: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy70;
+ case 0x00: goto yy70;
case '.': goto yy68;
case ':': goto yy49;
default: goto yy25;
@@ -537,7 +537,7 @@ yy68: ++YYCURSOR;
yych = *YYCURSOR;
goto yy69;
yy69: switch(yych){
- case '\000': goto yy72;
+ case 0x00: goto yy72;
case ',': case '0':
case '1':
case '2':
@@ -555,13 +555,13 @@ yy70: ++YYCURSOR;
yy71:
#line 95 "implicit.re"
{ return "int#base60"; }
-#line 518 "<stdout>"
+#line 558 "<stdout>"
yy72: ++YYCURSOR;
goto yy73;
yy73:
#line 103 "implicit.re"
{ return "float#base60"; }
-#line 524 "<stdout>"
+#line 564 "<stdout>"
yy74: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -644,7 +644,7 @@ yy80: yych = *++YYCURSOR;
}
yy81: yych = *++YYCURSOR;
switch(yych){
- case '\000': goto yy82;
+ case 0x00: goto yy82;
case '0':
case '1':
case '2':
@@ -664,7 +664,7 @@ yy82: ++YYCURSOR;
yy83:
#line 111 "implicit.re"
{ return "timestamp#ymd"; }
-#line 627 "<stdout>"
+#line 667 "<stdout>"
yy84: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -694,11 +694,11 @@ yy85: yych = *++YYCURSOR;
default: goto yy25;
}
yy86: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 9) YYFILL(9);
yych = *YYCURSOR;
goto yy87;
yy87: switch(yych){
- case '\t': case ' ': goto yy86;
+ case 0x09: case ' ': goto yy86;
case '0':
case '1':
case '2':
@@ -793,7 +793,7 @@ yy94: yych = *++YYCURSOR;
}
yy95: yych = *++YYCURSOR;
switch(yych){
- case '\t': case ' ': goto yy98;
+ case 0x09: case ' ': goto yy98;
case '.': goto yy96;
default: goto yy25;
}
@@ -802,7 +802,7 @@ yy96: ++YYCURSOR;
yych = *YYCURSOR;
goto yy97;
yy97: switch(yych){
- case '\t': case ' ': goto yy98;
+ case 0x09: case ' ': goto yy98;
case '0':
case '1':
case '2':
@@ -816,17 +816,17 @@ yy97: switch(yych){
default: goto yy25;
}
yy98: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
goto yy99;
yy99: switch(yych){
- case '\t': case ' ': goto yy98;
+ case 0x09: case ' ': goto yy98;
case '+': case '-': goto yy101;
case 'Z': goto yy100;
default: goto yy25;
}
yy100: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy105;
+ if(yych <= 0x00) goto yy105;
goto yy25;
yy101: yych = *++YYCURSOR;
switch(yych){
@@ -858,7 +858,7 @@ yy102: yych = *++YYCURSOR;
}
yy103: yych = *++YYCURSOR;
switch(yych){
- case '\000': goto yy105;
+ case 0x00: goto yy105;
case ':': goto yy104;
default: goto yy25;
}
@@ -881,7 +881,7 @@ yy105: ++YYCURSOR;
yy106:
#line 115 "implicit.re"
{ return "timestamp#spaced"; }
-#line 847 "<stdout>"
+#line 884 "<stdout>"
yy107: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -992,7 +992,7 @@ yy115: yych = *++YYCURSOR;
default: goto yy117;
}
yy116: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
goto yy117;
yy117: switch(yych){
@@ -1011,7 +1011,7 @@ yy117: switch(yych){
default: goto yy25;
}
yy118: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy123;
+ if(yych <= 0x00) goto yy123;
goto yy25;
yy119: yych = *++YYCURSOR;
switch(yych){
@@ -1043,7 +1043,7 @@ yy120: yych = *++YYCURSOR;
}
yy121: yych = *++YYCURSOR;
switch(yych){
- case '\000': goto yy123;
+ case 0x00: goto yy123;
case ':': goto yy122;
default: goto yy25;
}
@@ -1066,7 +1066,7 @@ yy123: ++YYCURSOR;
yy124:
#line 113 "implicit.re"
{ return "timestamp#iso8601"; }
-#line 1033 "<stdout>"
+#line 1069 "<stdout>"
yy125: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -1197,7 +1197,7 @@ yy135: switch(yych){
default: goto yy25;
}
yy136: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy25;
+ if(yych >= 0x01) goto yy25;
goto yy137;
yy137: yych = *++YYCURSOR;
goto yy124;
@@ -1253,7 +1253,7 @@ yy142: ++YYCURSOR;
yych = *YYCURSOR;
goto yy143;
yy143: switch(yych){
- case '\000': goto yy149;
+ case 0x00: goto yy149;
case ',': case '0':
case '1':
case '2':
@@ -1269,14 +1269,14 @@ yy143: switch(yych){
default: goto yy25;
}
yy144: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy25;
+ if(yych <= 0x00) goto yy25;
goto yy146;
yy145: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy146;
yy146: switch(yych){
- case '\000': goto yy147;
+ case 0x00: goto yy147;
case ',': case '0':
case '1':
case '2':
@@ -1304,13 +1304,13 @@ yy147: ++YYCURSOR;
yy148:
#line 91 "implicit.re"
{ return "int#hex"; }
-#line 1275 "<stdout>"
+#line 1307 "<stdout>"
yy149: ++YYCURSOR;
goto yy150;
yy150:
#line 93 "implicit.re"
{ return "int#oct"; }
-#line 1281 "<stdout>"
+#line 1313 "<stdout>"
yy151: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1376,7 +1376,7 @@ yy157: yych = *++YYCURSOR;
}
yy158: yych = *++YYCURSOR;
switch(yych){
- case '\000': goto yy52;
+ case 0x00: goto yy52;
case 'x': goto yy144;
default: goto yy143;
}
@@ -1402,14 +1402,14 @@ yy162: yych = *++YYCURSOR;
default: goto yy25;
}
yy163: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy25;
+ if(yych >= 0x01) goto yy25;
goto yy164;
yy164: ++YYCURSOR;
goto yy165;
yy165:
#line 107 "implicit.re"
{ return "float#neginf"; }
-#line 1381 "<stdout>"
+#line 1412 "<stdout>"
yy166: yych = *++YYCURSOR;
switch(yych){
case 'f': goto yy163;
@@ -1442,14 +1442,14 @@ yy171: yych = *++YYCURSOR;
default: goto yy25;
}
yy172: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy25;
+ if(yych >= 0x01) goto yy25;
goto yy173;
yy173: ++YYCURSOR;
goto yy174;
yy174:
#line 89 "implicit.re"
{ return "bool#no"; }
-#line 1421 "<stdout>"
+#line 1452 "<stdout>"
yy175: yych = *++YYCURSOR;
switch(yych){
case 'S': goto yy176;
@@ -1486,14 +1486,14 @@ yy181: yych = *++YYCURSOR;
default: goto yy25;
}
yy182: yych = *++YYCURSOR;
- if(yych >= '\001') goto yy25;
+ if(yych >= 0x01) goto yy25;
goto yy183;
yy183: ++YYCURSOR;
goto yy184;
yy184:
#line 87 "implicit.re"
{ return "bool#yes"; }
-#line 1465 "<stdout>"
+#line 1496 "<stdout>"
yy185: yych = *++YYCURSOR;
switch(yych){
case 'f': goto yy172;
@@ -1560,7 +1560,7 @@ yy197: yych = *++YYCURSOR;
default: goto yy25;
}
yy198: yych = *++YYCURSOR;
- if(yych <= '\000') goto yy6;
+ if(yych <= 0x00) goto yy6;
goto yy25;
yy199: yych = *++YYCURSOR;
switch(yych){
@@ -1617,17 +1617,17 @@ syck_type_id_to_uri( char *type_id )
limit = type_id + strlen( type_id );
-#line 1552 "<stdout>"
+#line 1620 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy202;
-yy203: ++YYCURSOR;
+ ++YYCURSOR;
yy202:
- if((YYLIMIT - YYCURSOR) < 21) YYFILL(21);
+ if((YYLIMIT - YYCURSOR) < 11) YYFILL(11);
yych = *YYCURSOR;
switch(yych){
- case '\000': goto yy204;
+ case 0x00: goto yy204;
case '!': goto yy208;
case '0':
case '1':
@@ -1765,7 +1765,7 @@ yy205: yyaccept = 0;
yy206:
#line 202 "implicit.re"
{ return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); }
-#line 1700 "<stdout>"
+#line 1768 "<stdout>"
yy207: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -1839,7 +1839,7 @@ yy208: ++YYCURSOR;
yy209:
#line 176 "implicit.re"
{ return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); }
-#line 1774 "<stdout>"
+#line 1842 "<stdout>"
yy210: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -1980,7 +1980,7 @@ yy213: switch(yych){
default: goto yy204;
}
yy214: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy215;
yy215: switch(yych){
@@ -2146,9 +2146,9 @@ yy219:
S_FREE( domain );
return uri;
}
-#line 2084 "<stdout>"
+#line 2149 "<stdout>"
yy220: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if((YYLIMIT - YYCURSOR) < 12) YYFILL(12);
yych = *YYCURSOR;
goto yy221;
yy221: switch(yych){
@@ -2362,7 +2362,7 @@ yy230:
S_FREE( domain );
return uri;
}
-#line 2302 "<stdout>"
+#line 2365 "<stdout>"
yy231: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -2481,8 +2481,8 @@ yy244: ++YYCURSOR;
goto yy245;
yy245:
#line 174 "implicit.re"
-{ return type_id; }
-#line 2422 "<stdout>"
+{ return syck_strndup( type_id, strlen( type_id ) ); }
+#line 2485 "<stdout>"
yy246: yych = *++YYCURSOR;
switch(yych){
case ',': goto yy216;
@@ -2507,7 +2507,7 @@ yy248: yych = *++YYCURSOR;
default: goto yy250;
}
yy249: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy250;
yy250: switch(yych){
@@ -2725,7 +2725,7 @@ yy254: ++YYCURSOR;
default: goto yy204;
}
yy255: ++YYCURSOR;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ if((YYLIMIT - YYCURSOR) < 12) YYFILL(12);
yych = *YYCURSOR;
goto yy256;
yy256: switch(yych){
@@ -2928,8 +2928,8 @@ yy264: ++YYCURSOR;
goto yy265;
yy265:
#line 172 "implicit.re"
-{ return type_id; }
-#line 2874 "<stdout>"
+{ return syck_strndup( type_id, strlen( type_id ) ); }
+#line 2932 "<stdout>"
yy266: yych = *++YYCURSOR;
switch(yych){
case '0':
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
index 2be6217d2d..76e8279601 100644
--- a/ext/syck/rubyext.c
+++ b/ext/syck/rubyext.c
@@ -75,7 +75,10 @@ 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));
+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));
struct parser_xtra {
VALUE data; /* Borrowed this idea from marshal.c to fix [ruby-core:8067] problem */
@@ -104,7 +107,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 );
@@ -112,7 +115,7 @@ rb_syck_compile(self, port)
oid = syck_parse( parser );
syck_lookup_sym( parser, oid, (char **)&sav );
- ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
+ ret = S_ALLOCA_N( char, strlen( sav->buffer ) + 3 );
ret[0] = '\0';
strcat( ret, "D\n" );
strcat( ret, sav->buffer );
@@ -161,12 +164,12 @@ rb_syck_io_str_read( char *buf, SyckIoStr *str, long max_size, long skip )
* (returns tainted? boolean)
*/
int
-syck_parser_assign_io(parser, port)
+syck_parser_assign_io(parser, pport)
SyckParser *parser;
- VALUE port;
+ VALUE *pport;
{
int taint = Qtrue;
- VALUE tmp;
+ VALUE tmp, port = *pport;
if (!NIL_P(tmp = rb_check_string_type(port))) {
taint = OBJ_TAINTED(port); /* original taintedness */
port = tmp;
@@ -181,6 +184,7 @@ syck_parser_assign_io(parser, port)
else {
rb_raise(rb_eTypeError, "instance of IO needed");
}
+ *pport = port;
return taint;
}
@@ -262,12 +266,15 @@ rb_syck_mktime(str, len)
ptr += 2;
if ( len > ptr - str && *ptr == '.' )
{
- char *padded = syck_strndup( "000000", 6 );
+ char padded[] = "000000";
char *end = ptr + 1;
+ char *p = end;
while ( isdigit( *end ) ) end++;
- MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
- usec = strtol(padded, NULL, 10);
- S_FREE(padded);
+ if (end - p < sizeof(padded)) {
+ MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
+ p = padded;
+ }
+ usec = strtol(p, NULL, 10);
}
else
{
@@ -592,6 +599,8 @@ yaml_org_handler( n, ref )
return transferred;
}
+static void syck_node_mark( SyckNode *n );
+
/*
* {native mode} node handler
* - Converts data into native Ruby types
@@ -700,6 +709,13 @@ syck_set_model( p, input, model )
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
*/
@@ -707,14 +723,20 @@ static void
syck_mark_parser(parser)
SyckParser *parser;
{
- struct parser_xtra *bonus;
- rb_gc_mark(parser->root);
- rb_gc_mark(parser->root_on_error);
- if ( parser->bonus != NULL )
+ 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 )
{
- bonus = (struct parser_xtra *)parser->bonus;
- rb_gc_mark( bonus->data );
- rb_gc_mark( bonus->proc );
+ st_foreach( parser->bad_anchors, syck_st_mark_nodes, 0 );
}
}
@@ -725,8 +747,7 @@ void
rb_syck_free_parser(p)
SyckParser *p;
{
- struct parser_xtra *bonus = (struct parser_xtra *)p->bonus;
- if ( bonus != NULL ) S_FREE( bonus );
+ S_FREE( p->bonus );
syck_free_parser(p);
}
@@ -741,6 +762,9 @@ syck_parser_s_alloc(class)
VALUE pobj;
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 );
syck_parser_set_root_on_error( parser, Qnil );
@@ -767,6 +791,7 @@ syck_parser_initialize(argc, argv, self)
Check_Type(options, T_HASH);
}
rb_ivar_set(self, s_options, options);
+ rb_ivar_set(self, s_input, Qnil);
return self;
}
@@ -811,8 +836,7 @@ syck_parser_load(argc, argv, self)
{
VALUE port, proc, model, input;
SyckParser *parser;
- struct parser_xtra *bonus = S_ALLOC_N( struct parser_xtra, 1 );
- volatile VALUE hash; /* protect from GC */
+ struct parser_xtra *bonus;
rb_scan_args(argc, argv, "11", &port, &proc);
@@ -821,13 +845,12 @@ syck_parser_load(argc, argv, self)
Data_Get_Struct(self, SyckParser, parser);
syck_set_model( self, input, model );
- bonus->taint = syck_parser_assign_io(parser, port);
- bonus->data = hash = rb_hash_new();
+ 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;
-
- parser->bonus = (void *)bonus;
return syck_parse( parser );
}
@@ -843,8 +866,7 @@ syck_parser_load_documents(argc, argv, self)
{
VALUE port, proc, v, input, model;
SyckParser *parser;
- struct parser_xtra *bonus = S_ALLOC_N( struct parser_xtra, 1 );
- volatile VALUE hash;
+ struct parser_xtra *bonus;
rb_scan_args(argc, argv, "1&", &port, &proc);
@@ -853,15 +875,15 @@ syck_parser_load_documents(argc, argv, self)
Data_Get_Struct(self, SyckParser, parser);
syck_set_model( self, input, model );
- bonus->taint = syck_parser_assign_io(parser, port);
+ 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;
- parser->bonus = (void *)bonus;
while ( 1 )
{
/* Reset hash for tracking nodes */
- bonus->data = hash = rb_hash_new();
+ bonus->data = rb_hash_new();
/* Parse a document */
v = syck_parse( parser );
@@ -895,7 +917,6 @@ static VALUE
syck_resolver_initialize( self )
VALUE self;
{
- VALUE tags = rb_hash_new();
rb_ivar_set(self, s_tags, rb_hash_new());
return self;
}
@@ -930,7 +951,6 @@ VALUE
syck_resolver_detect_implicit( self, val )
VALUE self, val;
{
- char *type_id;
return rb_str_new2( "" );
}
@@ -1025,12 +1045,11 @@ syck_set_ivars( vars, obj )
VALUE ivname = rb_ary_entry( vars, 0 );
char *ivn;
StringValue( ivname );
- ivn = S_ALLOC_N( char, RSTRING(ivname)->len + 2 );
+ 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 ) );
- S_FREE( ivn );
return Qnil;
}
@@ -1117,6 +1136,10 @@ syck_resolver_transfer( self, type, val )
type = subclass;
subclass = cYObject;
}
+ else /* workaround for SEGV. real fix please */
+ {
+ rb_raise( rb_eTypeError, "invalid subclass" );
+ }
}
break;
}
@@ -1139,7 +1162,15 @@ syck_resolver_transfer( self, type, val )
}
else if ( !NIL_P( target_class ) )
{
- obj = rb_obj_alloc( subclass );
+ 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 );
@@ -1183,10 +1214,9 @@ syck_resolver_tagurize( self, val )
if ( !NIL_P(tmp) )
{
- char *taguri;
- val = tmp;
- taguri = syck_type_id_to_uri( RSTRING(val)->ptr );
- return rb_str_new2( taguri );
+ char *taguri = syck_type_id_to_uri( RSTRING(tmp)->ptr );
+ val = rb_str_new2( taguri );
+ S_FREE( taguri );
}
return val;
@@ -1276,7 +1306,6 @@ syck_genericresolver_node_import( self, node )
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++ )
{
@@ -1287,10 +1316,10 @@ syck_genericresolver_node_import( self, node )
style = sym_inline;
}
obj = rb_funcall( cSeq, s_new, 3, t, v, style );
+ rb_iv_set(obj, "@kind", sym_seq);
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++ )
{
@@ -1301,6 +1330,7 @@ syck_genericresolver_node_import( self, node )
style = sym_inline;
}
obj = rb_funcall( cMap, s_new, 3, t, v, style );
+ rb_iv_set(obj, "@kind", sym_map);
break;
}
@@ -1336,7 +1366,7 @@ syck_badalias_cmp( alias1, alias2 )
*/
VALUE
syck_domaintype_initialize( self, domain, type_id, val )
- VALUE self, type_id, val;
+ VALUE self, domain, type_id, val;
{
rb_iv_set( self, "@domain", domain );
rb_iv_set( self, "@type_id", type_id );
@@ -1376,6 +1406,7 @@ syck_node_mark( n )
SyckNode *n;
{
int i;
+ rb_gc_mark_maybe( n->id );
switch ( n->kind )
{
case syck_seq_kind:
@@ -1393,42 +1424,9 @@ syck_node_mark( n )
}
break;
}
-}
-
-/*
- * Don't free Ruby data, Ruby will do that
- */
-void
-rb_syck_free_node( SyckNode *n )
-{
- switch ( n->kind )
- {
- case syck_str_kind:
- S_FREE( n->data.str );
- n->data.str = NULL;
- break;
-
- case syck_seq_kind:
- if ( n->data.list != NULL )
- {
- S_FREE( n->data.list->items );
- S_FREE( n->data.list );
- n->data.list = NULL;
- }
- break;
-
- case syck_map_kind:
- if ( n->data.pairs != NULL )
- {
- S_FREE( n->data.pairs->keys );
- S_FREE( n->data.pairs->values );
- S_FREE( n->data.pairs );
- n->data.pairs = NULL;
- }
- break;
- }
-
- S_FREE( n );
+#if 0 /* maybe needed */
+ if ( n->shortcut ) syck_node_mark( n->shortcut ); /* caution: maybe cyclic */
+#endif
}
/*
@@ -1439,7 +1437,7 @@ syck_scalar_alloc( class )
VALUE class;
{
SyckNode *node = syck_alloc_str();
- VALUE obj = Data_Wrap_Struct( class, syck_node_mark, rb_syck_free_node, node );
+ VALUE obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
node->id = obj;
return obj;
}
@@ -1508,7 +1506,7 @@ syck_scalar_value_set( self, val )
Data_Get_Struct( self, SyckNode, node );
StringValue( val );
- node->data.str->ptr = RSTRING(val)->ptr;
+ 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;
@@ -1526,7 +1524,7 @@ syck_seq_alloc( class )
SyckNode *node;
VALUE obj;
node = syck_alloc_seq();
- obj = Data_Wrap_Struct( class, syck_node_mark, rb_syck_free_node, node );
+ obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
node->id = obj;
return obj;
}
@@ -1625,7 +1623,7 @@ syck_map_alloc( class )
SyckNode *node;
VALUE obj;
node = syck_alloc_map();
- obj = Data_Wrap_Struct( class, syck_node_mark, rb_syck_free_node, node );
+ obj = Data_Wrap_Struct( class, syck_node_mark, syck_free_node, node );
node->id = obj;
return obj;
}
@@ -1755,8 +1753,7 @@ syck_node_init_copy( copy, orig )
if ( copy == orig )
return copy;
- if ( TYPE( orig ) != T_DATA ||
- RDATA( orig )->dfree != ( RUBY_DATA_FUNC )rb_syck_free_node )
+ if ( TYPE( orig ) != T_DATA )
{
rb_raise( rb_eTypeError, "wrong argument type" );
}
@@ -1777,12 +1774,11 @@ syck_node_type_id_set( self, type_id )
SyckNode *node;
Data_Get_Struct( self, SyckNode, node );
- if ( node->type_id != NULL ) S_FREE( node->type_id );
+ S_FREE( node->type_id );
- if ( NIL_P( type_id ) ) {
- node->type_id = NULL;
- } else {
- node->type_id = StringValuePtr( 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 );
@@ -1800,13 +1796,14 @@ syck_node_transform( self )
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;
- n = syck_alloc_map();
+ 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 ),
@@ -1818,7 +1815,7 @@ syck_node_transform( self )
case syck_seq_kind:
{
int i;
- n = syck_alloc_seq();
+ 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 ) );
@@ -1827,7 +1824,7 @@ syck_node_transform( self )
break;
case syck_str_kind:
- n = syck_new_str2( orig_n->data.str->ptr, orig_n->data.str->len, orig_n->data.str->style );
+ DATA_PTR(t) = n = syck_new_str2( orig_n->data.str->ptr, orig_n->data.str->len, orig_n->data.str->style );
break;
}
@@ -1839,11 +1836,8 @@ syck_node_transform( self )
{
n->anchor = syck_strndup( orig_n->anchor, strlen( orig_n->anchor ) );
}
- t = Data_Wrap_Struct( cNode, NULL, NULL, n );
n->id = t;
- t = rb_funcall( oDefaultResolver, s_node_import, 1, t );
- syck_free_node( n );
- return t;
+ return rb_funcall( oDefaultResolver, s_node_import, 1, t );
}
/*
@@ -1938,13 +1932,10 @@ static void
syck_mark_emitter(emitter)
SyckEmitter *emitter;
{
- struct emitter_xtra *bonus;
- if ( emitter->bonus != NULL )
- {
- bonus = (struct emitter_xtra *)emitter->bonus;
- rb_gc_mark( bonus->data );
- rb_gc_mark( bonus->port );
- }
+ struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
+ rb_gc_mark( bonus->oid );
+ rb_gc_mark( bonus->data );
+ rb_gc_mark( bonus->port );
}
/*
@@ -1954,8 +1945,7 @@ void
rb_syck_free_emitter(e)
SyckEmitter *e;
{
- struct emitter_xtra *bonus = (struct emitter_xtra *)e->bonus;
- if ( bonus != NULL ) S_FREE( bonus );
+ S_FREE( e->bonus );
syck_free_emitter(e);
}
@@ -1970,6 +1960,9 @@ syck_emitter_s_alloc(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 );
@@ -1990,15 +1983,13 @@ syck_emitter_reset( argc, argv, self )
VALUE options, tmp;
SyckEmitter *emitter;
struct emitter_xtra *bonus;
- volatile VALUE hash; /* protect from GC */
Data_Get_Struct(self, SyckEmitter, emitter);
bonus = (struct emitter_xtra *)emitter->bonus;
- if ( bonus != NULL ) S_FREE( bonus );
- bonus = S_ALLOC_N( struct emitter_xtra, 1 );
+ bonus->oid = Qnil;
bonus->port = rb_str_new2( "" );
- bonus->data = hash = rb_hash_new();
+ bonus->data = rb_hash_new();
if (rb_scan_args(argc, argv, "01", &options) == 0)
{
@@ -2019,8 +2010,7 @@ syck_emitter_reset( argc, argv, self )
rb_ivar_set(self, s_options, options);
}
- emitter->headless = 1;
- emitter->bonus = (void *)bonus;
+ emitter->headless = 0;
rb_ivar_set(self, s_level, INT2FIX(0));
rb_ivar_set(self, s_resolver, Qnil);
return self;
@@ -2036,7 +2026,6 @@ syck_emitter_emit( argc, argv, self )
VALUE self;
{
VALUE oid, proc;
- char *anchor_name;
SyckEmitter *emitter;
struct emitter_xtra *bonus;
SYMID symple;
@@ -2248,10 +2237,12 @@ Init_syck()
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 );
@@ -2290,7 +2281,6 @@ Init_syck()
*/
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 );
diff --git a/ext/syck/syck.c b/ext/syck/syck.c
index 33f9bf23e8..a83c8813c1 100644
--- a/ext/syck/syck.c
+++ b/ext/syck/syck.c
@@ -410,12 +410,10 @@ syck_move_tokens( SyckParser *p )
return 0;
skip = p->limit - p->token;
- if ( skip < 1 )
- return 0;
-
if ( ( count = p->token - p->buffer ) )
{
- S_MEMMOVE( p->buffer, p->token, char, skip );
+ if (skip > 0)
+ 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 02ffe240f8..e7d07e9c0d 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -13,10 +13,11 @@
#define SYCK_YAML_MAJOR 1
#define SYCK_YAML_MINOR 0
-#define SYCK_VERSION "0.55"
+#define SYCK_VERSION "0.60"
#define YAML_DOMAIN "yaml.org,2002"
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include "st.h"
@@ -51,7 +52,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) free(n); n = NULL;
+#define S_FREE(n) if (n) { free(n); n = NULL; }
#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
@@ -399,6 +400,7 @@ 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 );
+void syck_parser_set_input_type( SyckParser *, enum syck_parser_input );
void syck_parser_file( SyckParser *, FILE *, SyckIoFileRead );
void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead );
void syck_parser_str_auto( SyckParser *, char *, SyckIoStrRead );
@@ -445,6 +447,9 @@ long syck_seq_count( SyckNode * );
* Lexer prototypes
*/
void syckerror( char * );
+int syckparse( void * );
+union YYSTYPE;
+int sycklex( union YYSTYPE *, SyckParser * );
#if defined(__cplusplus)
} /* extern "C" { */
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 8644058bd5..3c6cd1a9cf 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.10 on Sat Sep 17 00:51:29 2005 */
+/* Generated by re2c 0.9.10 on Tue Sep 20 17:46:17 2005 */
#line 1 "token.re"
/*
* token.re
@@ -218,7 +218,7 @@
{ \
SyckLevel *lvl_deep = CURRENT_LEVEL(); \
indt_len = lvl_deep->spaces; \
- if ( indt_len == YYTOKEN - YYLINEPTR ) \
+ if ( lvl_deep->status == syck_lvl_seq || ( indt_len == YYCURSOR - YYLINEPTR && lvl_deep->status != syck_lvl_map ) ) \
{ \
SyckLevel *lvl_over; \
parser->lvl_idx--; \
@@ -268,6 +268,7 @@ sycklex( YYSTYPE *sycklval, SyckParser *parser )
case syck_bytecode_utf8:
return sycklex_bytecode_utf8( sycklval, parser );
}
+ return YAML_DOCSEP;
}
/*
@@ -290,7 +291,7 @@ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser )
return t;
}
-#line 314 "token.re"
+#line 315 "token.re"
if ( YYLINEPTR != YYCURSOR )
@@ -303,7 +304,7 @@ Header:
YYTOKEN = YYCURSOR;
-#line 306 "<stdout>"
+#line 307 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -329,11 +330,11 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 373 "token.re"
+#line 374 "token.re"
{ YYPOS(0);
goto Document;
}
-#line 336 "<stdout>"
+#line 337 "<stdout>"
yy4: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -343,30 +344,30 @@ yy4: yyaccept = 0;
yy5: ++YYCURSOR;
goto yy6;
yy6:
-#line 355 "token.re"
+#line 356 "token.re"
{ eat_comments( parser );
goto Header;
}
-#line 350 "<stdout>"
+#line 351 "<stdout>"
yy7: ++YYCURSOR;
goto yy8;
yy8:
-#line 359 "token.re"
+#line 360 "token.re"
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 360 "<stdout>"
+#line 361 "<stdout>"
yy9: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy18;
yy10:
-#line 365 "token.re"
+#line 366 "token.re"
{ GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN );
goto Header;
}
-#line 369 "<stdout>"
+#line 370 "<stdout>"
yy11: yych = *++YYCURSOR;
switch(yych){
case 0x0A: goto yy17;
@@ -376,11 +377,11 @@ yy12: ++YYCURSOR;
yych = *YYCURSOR;
goto yy16;
yy13:
-#line 369 "token.re"
+#line 370 "token.re"
{ doc_level = YYCURSOR - YYLINEPTR;
goto Header;
}
-#line 383 "<stdout>"
+#line 384 "<stdout>"
yy14: yych = *++YYCURSOR;
goto yy3;
yy15: ++YYCURSOR;
@@ -428,7 +429,7 @@ yy22: yych = *++YYCURSOR;
yy23: ++YYCURSOR;
goto yy24;
yy24:
-#line 341 "token.re"
+#line 342 "token.re"
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -442,7 +443,7 @@ yy24:
}
return 0;
}
-#line 445 "<stdout>"
+#line 446 "<stdout>"
yy25: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -471,7 +472,7 @@ yy29: yych = *++YYCURSOR;
yy30: ++YYCURSOR;
goto yy31;
yy31:
-#line 327 "token.re"
+#line 328 "token.re"
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -485,7 +486,7 @@ yy31:
return 0;
}
}
-#line 488 "<stdout>"
+#line 489 "<stdout>"
yy32: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -500,7 +501,7 @@ yy34: ++YYCURSOR;
default: goto yy20;
}
}
-#line 377 "token.re"
+#line 378 "token.re"
Document:
@@ -514,7 +515,7 @@ Document:
YYTOKEN = YYCURSOR;
-#line 517 "<stdout>"
+#line 518 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -546,7 +547,7 @@ yy37: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy92;
yy38:
-#line 391 "token.re"
+#line 392 "token.re"
{ /* Isolate spaces */
int indt_len;
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
@@ -574,46 +575,46 @@ yy38:
}
return YAML_INDENT;
}
-#line 577 "<stdout>"
+#line 578 "<stdout>"
yy39: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x0A: goto yy91;
default: goto yy40;
}
yy40:
-#line 495 "token.re"
+#line 497 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto Plain;
}
-#line 588 "<stdout>"
+#line 589 "<stdout>"
yy41: ++YYCURSOR;
goto yy42;
yy42:
-#line 419 "token.re"
+#line 420 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq);
return YYTOKEN[0];
}
-#line 598 "<stdout>"
+#line 599 "<stdout>"
yy43: ++YYCURSOR;
goto yy44;
yy44:
-#line 425 "token.re"
+#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 608 "<stdout>"
+#line 609 "<stdout>"
yy45: ++YYCURSOR;
goto yy46;
yy46:
-#line 431 "token.re"
+#line 432 "token.re"
{ POP_LEVEL();
return YYTOKEN[0];
}
-#line 616 "<stdout>"
+#line 617 "<stdout>"
yy47: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -761,23 +762,23 @@ yy50: yych = *++YYCURSOR;
yy51: ++YYCURSOR;
goto yy52;
yy52:
-#line 469 "token.re"
+#line 471 "token.re"
{ goto TransferMethod; }
-#line 766 "<stdout>"
+#line 767 "<stdout>"
yy53: ++YYCURSOR;
goto yy54;
yy54:
-#line 471 "token.re"
+#line 473 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto SingleQuote; }
-#line 773 "<stdout>"
+#line 774 "<stdout>"
yy55: ++YYCURSOR;
goto yy56;
yy56:
-#line 474 "token.re"
+#line 476 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto DoubleQuote; }
-#line 780 "<stdout>"
+#line 781 "<stdout>"
yy57: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -799,27 +800,27 @@ yy57: yyaccept = 1;
yy58: ++YYCURSOR;
goto yy59;
yy59:
-#line 484 "token.re"
+#line 486 "token.re"
{ eat_comments( parser );
goto Document;
}
-#line 806 "<stdout>"
+#line 807 "<stdout>"
yy60: ++YYCURSOR;
yych = *YYCURSOR;
goto yy66;
yy61:
-#line 488 "token.re"
+#line 490 "token.re"
{ goto Document; }
-#line 813 "<stdout>"
+#line 814 "<stdout>"
yy62: ++YYCURSOR;
goto yy63;
yy63:
-#line 490 "token.re"
+#line 492 "token.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
}
-#line 822 "<stdout>"
+#line 823 "<stdout>"
yy64: yych = *++YYCURSOR;
goto yy40;
yy65: ++YYCURSOR;
@@ -858,14 +859,14 @@ yy69: YYCURSOR = YYMARKER;
yy70: ++YYCURSOR;
goto yy71;
yy71:
-#line 477 "token.re"
+#line 479 "token.re"
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
}
goto ScalarBlock;
}
-#line 868 "<stdout>"
+#line 869 "<stdout>"
yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -947,12 +948,12 @@ yy76: switch(yych){
default: goto yy77;
}
yy77:
-#line 464 "token.re"
+#line 466 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return YAML_ALIAS;
}
-#line 955 "<stdout>"
+#line 956 "<stdout>"
yy78: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1021,7 +1022,7 @@ yy79: switch(yych){
default: goto yy80;
}
yy80:
-#line 453 "token.re"
+#line 455 "token.re"
{ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
/*
@@ -1032,25 +1033,25 @@ yy80:
syck_hdlr_remove_anchor(parser, sycklval->name);
return YAML_ANCHOR;
}
-#line 1035 "<stdout>"
+#line 1036 "<stdout>"
yy81: ++YYCURSOR;
goto yy82;
yy82:
-#line 439 "token.re"
+#line 441 "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_doc);
+ ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_seq);
}
else /* spaces followed by content uses the space as indentation */
{
- ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_doc);
+ ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_seq);
}
return YYTOKEN[0];
}
-#line 1053 "<stdout>"
+#line 1054 "<stdout>"
yy83: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1067,11 +1068,12 @@ yy85: yych = *++YYCURSOR;
yy86: ++YYCURSOR;
goto yy87;
yy87:
-#line 435 "token.re"
-{ YYPOS(1);
+#line 436 "token.re"
+{ if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map;
+ YYPOS(1);
return YYTOKEN[0];
}
-#line 1074 "<stdout>"
+#line 1076 "<stdout>"
yy88: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1103,7 +1105,7 @@ yy93: ++YYCURSOR;
default: goto yy69;
}
}
-#line 499 "token.re"
+#line 501 "token.re"
}
@@ -1112,7 +1114,7 @@ Directive:
YYTOKTMP = YYCURSOR;
-#line 1115 "<stdout>"
+#line 1117 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -1212,18 +1214,18 @@ yy97: yyaccept = 0;
default: goto yy98;
}
yy98:
-#line 512 "token.re"
+#line 514 "token.re"
{ YYCURSOR = YYTOKTMP;
return YAML_DOCSEP;
}
-#line 1219 "<stdout>"
+#line 1221 "<stdout>"
yy99: ++YYCURSOR;
yych = *YYCURSOR;
goto yy103;
yy100:
-#line 510 "token.re"
+#line 512 "token.re"
{ goto Directive; }
-#line 1226 "<stdout>"
+#line 1228 "<stdout>"
yy101: yych = *++YYCURSOR;
goto yy98;
yy102: ++YYCURSOR;
@@ -1477,11 +1479,11 @@ yy108: switch(yych){
default: goto yy109;
}
yy109:
-#line 508 "token.re"
+#line 510 "token.re"
{ goto Directive; }
-#line 1482 "<stdout>"
+#line 1484 "<stdout>"
}
-#line 515 "token.re"
+#line 517 "token.re"
}
@@ -1504,7 +1506,7 @@ Plain2:
Plain3:
-#line 1507 "<stdout>"
+#line 1509 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -1529,7 +1531,7 @@ yy112: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy142;
yy113:
-#line 538 "token.re"
+#line 540 "token.re"
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKEN;
@@ -1543,8 +1545,8 @@ yy113:
while ( YYTOKEN < YYCURSOR )
{
- int nl_len = 0;
- if ( nl_len = newline_len( YYTOKEN++ ) )
+ int nl_len = newline_len( YYTOKEN++ );
+ if ( nl_len )
{
nl_count++;
YYTOKEN += nl_len - 1;
@@ -1565,18 +1567,18 @@ yy113:
goto Plain2;
}
-#line 1568 "<stdout>"
+#line 1570 "<stdout>"
yy114: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x0A: goto yy141;
default: goto yy115;
}
yy115:
-#line 625 "token.re"
+#line 627 "token.re"
{ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
goto Plain2;
}
-#line 1579 "<stdout>"
+#line 1581 "<stdout>"
yy116: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -1596,7 +1598,7 @@ yy117: yyaccept = 1;
yy118: ++YYCURSOR;
goto yy119;
yy119:
-#line 587 "token.re"
+#line 589 "token.re"
{ if ( plvl->status != syck_lvl_imap )
{
PLAIN_NOT_INL();
@@ -1607,11 +1609,11 @@ yy119:
}
RETURN_IMPLICIT();
}
-#line 1610 "<stdout>"
+#line 1612 "<stdout>"
yy120: ++YYCURSOR;
goto yy121;
yy121:
-#line 598 "token.re"
+#line 600 "token.re"
{ if ( plvl->status != syck_lvl_iseq )
{
PLAIN_NOT_INL();
@@ -1622,14 +1624,14 @@ yy121:
}
RETURN_IMPLICIT();
}
-#line 1625 "<stdout>"
+#line 1627 "<stdout>"
yy122: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case '#': goto yy128;
default: goto yy123;
}
yy123:
-#line 615 "token.re"
+#line 617 "token.re"
{ if ( qidx == 0 )
{
goto Plain2;
@@ -1639,13 +1641,13 @@ yy123:
goto Plain3;
}
}
-#line 1642 "<stdout>"
+#line 1644 "<stdout>"
yy124: ++YYCURSOR;
goto yy125;
yy125:
-#line 613 "token.re"
+#line 615 "token.re"
{ RETURN_IMPLICIT(); }
-#line 1648 "<stdout>"
+#line 1650 "<stdout>"
yy126: yych = *++YYCURSOR;
goto yy123;
yy127: yych = *++YYCURSOR;
@@ -1653,15 +1655,15 @@ yy127: yych = *++YYCURSOR;
yy128: ++YYCURSOR;
goto yy129;
yy129:
-#line 609 "token.re"
+#line 611 "token.re"
{ eat_comments( parser );
RETURN_IMPLICIT();
}
-#line 1660 "<stdout>"
+#line 1662 "<stdout>"
yy130: ++YYCURSOR;
goto yy131;
yy131:
-#line 576 "token.re"
+#line 578 "token.re"
{ if ( plvl->status != syck_lvl_iseq && plvl->status != syck_lvl_imap )
{
PLAIN_NOT_INL();
@@ -1672,7 +1674,7 @@ yy131:
}
RETURN_IMPLICIT();
}
-#line 1675 "<stdout>"
+#line 1677 "<stdout>"
yy132: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1694,9 +1696,9 @@ yy135: YYCURSOR = YYMARKER;
yy136: ++YYCURSOR;
goto yy137;
yy137:
-#line 574 "token.re"
+#line 576 "token.re"
{ RETURN_IMPLICIT(); }
-#line 1699 "<stdout>"
+#line 1701 "<stdout>"
yy138: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -1728,7 +1730,7 @@ yy143: ++YYCURSOR;
default: goto yy135;
}
}
-#line 629 "token.re"
+#line 631 "token.re"
}
@@ -1742,7 +1744,7 @@ SingleQuote2:
YYTOKEN = YYCURSOR;
-#line 1745 "<stdout>"
+#line 1747 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -1762,7 +1764,7 @@ yy146: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy157;
yy147:
-#line 643 "token.re"
+#line 645 "token.re"
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1780,8 +1782,8 @@ yy147:
while ( YYTOKEN < YYCURSOR )
{
- int nl_len = 0;
- if ( nl_len = newline_len( YYTOKEN++ ) )
+ int nl_len = newline_len( YYTOKEN++ );
+ if ( nl_len )
{
nl_count++;
YYTOKEN += nl_len - 1;
@@ -1802,25 +1804,25 @@ yy147:
goto SingleQuote2;
}
-#line 1805 "<stdout>"
+#line 1807 "<stdout>"
yy148: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x0A: goto yy156;
default: goto yy149;
}
yy149:
-#line 710 "token.re"
+#line 712 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
-#line 1816 "<stdout>"
+#line 1818 "<stdout>"
yy150: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case '\'': goto yy154;
default: goto yy151;
}
yy151:
-#line 687 "token.re"
+#line 689 "token.re"
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1843,7 +1845,7 @@ yy151:
sycklval->nodeData = n;
return YAML_PLAIN;
}
-#line 1846 "<stdout>"
+#line 1848 "<stdout>"
yy152: yych = *++YYCURSOR;
goto yy151;
yy153: yych = *++YYCURSOR;
@@ -1851,11 +1853,11 @@ yy153: yych = *++YYCURSOR;
yy154: ++YYCURSOR;
goto yy155;
yy155:
-#line 683 "token.re"
+#line 685 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
-#line 1858 "<stdout>"
+#line 1860 "<stdout>"
yy156: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1878,7 +1880,7 @@ yy159: YYCURSOR = YYMARKER;
case 0: goto yy147;
}
}
-#line 714 "token.re"
+#line 716 "token.re"
}
@@ -1896,7 +1898,7 @@ DoubleQuote2:
-#line 1899 "<stdout>"
+#line 1901 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -1917,7 +1919,7 @@ yy162: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy184;
yy163:
-#line 732 "token.re"
+#line 734 "token.re"
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1937,8 +1939,8 @@ yy163:
{
while ( YYTOKEN < YYCURSOR )
{
- int nl_len = 0;
- if ( nl_len = newline_len( YYTOKEN++ ) )
+ int nl_len = newline_len( YYTOKEN++ );
+ if ( nl_len )
{
nl_count++;
YYTOKEN += nl_len - 1;
@@ -1961,18 +1963,18 @@ yy163:
keep_nl = 1;
goto DoubleQuote2;
}
-#line 1964 "<stdout>"
+#line 1966 "<stdout>"
yy164: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x0A: goto yy183;
default: goto yy165;
}
yy165:
-#line 818 "token.re"
+#line 820 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
-#line 1975 "<stdout>"
+#line 1977 "<stdout>"
yy166: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -1988,7 +1990,7 @@ yy166: yyaccept = 1;
yy167: ++YYCURSOR;
goto yy168;
yy168:
-#line 795 "token.re"
+#line 797 "token.re"
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -2011,7 +2013,7 @@ yy168:
sycklval->nodeData = n;
return YAML_PLAIN;
}
-#line 2014 "<stdout>"
+#line 2016 "<stdout>"
yy169: yych = *++YYCURSOR;
goto yy168;
yy170: yych = *++YYCURSOR;
@@ -2034,12 +2036,12 @@ yy173: YYCURSOR = YYMARKER;
yy174: ++YYCURSOR;
goto yy175;
yy175:
-#line 790 "token.re"
+#line 792 "token.re"
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
}
-#line 2042 "<stdout>"
+#line 2044 "<stdout>"
yy176: yych = *++YYCURSOR;
switch(yych){
case 0x0A: goto yy174;
@@ -2072,12 +2074,12 @@ yy177: yych = *++YYCURSOR;
yy178: ++YYCURSOR;
goto yy179;
yy179:
-#line 776 "token.re"
+#line 778 "token.re"
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto DoubleQuote2;
}
-#line 2080 "<stdout>"
+#line 2082 "<stdout>"
yy180: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -2105,7 +2107,7 @@ yy180: yych = *++YYCURSOR;
yy181: ++YYCURSOR;
goto yy182;
yy182:
-#line 781 "token.re"
+#line 783 "token.re"
{ long ch;
char *chr_text = syck_strndup( YYTOKEN, 4 );
chr_text[0] = '0';
@@ -2114,7 +2116,7 @@ yy182:
QUOTECAT(qstr, qcapa, qidx, ch);
goto DoubleQuote2;
}
-#line 2117 "<stdout>"
+#line 2119 "<stdout>"
yy183: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -2133,7 +2135,7 @@ yy185: ++YYCURSOR;
default: goto yy173;
}
}
-#line 822 "token.re"
+#line 824 "token.re"
}
@@ -2147,7 +2149,7 @@ TransferMethod2:
YYTOKTMP = YYCURSOR;
-#line 2150 "<stdout>"
+#line 2152 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -2167,7 +2169,7 @@ yy186:
yy188: ++YYCURSOR;
goto yy189;
yy189:
-#line 836 "token.re"
+#line 838 "token.re"
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -2217,7 +2219,7 @@ yy189:
return YAML_TRANSFER;
}
-#line 2220 "<stdout>"
+#line 2222 "<stdout>"
yy190: yych = *++YYCURSOR;
goto yy189;
yy191: yych = *++YYCURSOR;
@@ -2228,11 +2230,11 @@ yy192: ++YYCURSOR;
default: goto yy193;
}
yy193:
-#line 903 "token.re"
+#line 905 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
-#line 2235 "<stdout>"
+#line 2237 "<stdout>"
yy194: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -2275,12 +2277,12 @@ yy197: YYCURSOR = YYMARKER;
yy198: ++YYCURSOR;
goto yy199;
yy199:
-#line 889 "token.re"
+#line 891 "token.re"
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto TransferMethod2;
}
-#line 2283 "<stdout>"
+#line 2285 "<stdout>"
yy200: yych = *++YYCURSOR;
switch(yych){
case '0':
@@ -2308,7 +2310,7 @@ yy200: yych = *++YYCURSOR;
yy201: ++YYCURSOR;
goto yy202;
yy202:
-#line 894 "token.re"
+#line 896 "token.re"
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -2317,7 +2319,7 @@ yy202:
QUOTECAT(qstr, qcapa, qidx, ch);
goto TransferMethod2;
}
-#line 2320 "<stdout>"
+#line 2322 "<stdout>"
yy203: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -2327,7 +2329,7 @@ yy204: switch(yych){
default: goto yy189;
}
}
-#line 908 "token.re"
+#line 910 "token.re"
}
@@ -2342,8 +2344,7 @@ ScalarBlock:
int forceIndent = -1;
char *yyt = YYTOKEN;
SyckLevel *lvl = CURRENT_LEVEL();
- int parentIndent;
- GET_TRUE_YAML_INDENT(parentIndent);
+ int parentIndent = -1;
switch ( *yyt )
{
@@ -2363,7 +2364,7 @@ ScalarBlock:
}
else if ( isdigit( *yyt ) )
{
- forceIndent = strtol( yyt, NULL, 10 ) + parentIndent;
+ forceIndent = strtol( yyt, NULL, 10 );
}
}
@@ -2374,7 +2375,7 @@ ScalarBlock2:
YYTOKEN = YYCURSOR;
-#line 2377 "<stdout>"
+#line 2378 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -2395,25 +2396,30 @@ yy207: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy226;
yy208:
-#line 955 "token.re"
+#line 956 "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 ( indt_len > parentIndent && lvl->status != syck_lvl_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 )
+ if ( lvl->status != syck_lvl_block )
{
- YYCURSOR = YYTOKEN;
- RETURN_YAML_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();
+ }
}
/*
@@ -2428,8 +2434,8 @@ yy208:
pacer = YYTOKEN;
while ( pacer < YYCURSOR )
{
- int nl_len = 0;
- if ( nl_len = newline_len( pacer++ ) )
+ int nl_len = newline_len( pacer++ );
+ if ( nl_len )
{
nl_count++;
pacer += nl_len - 1;
@@ -2465,22 +2471,22 @@ yy208:
}
goto ScalarBlock2;
}
-#line 2468 "<stdout>"
+#line 2474 "<stdout>"
yy209: ++YYCURSOR;
switch((yych = *YYCURSOR)) {
case 0x0A: goto yy225;
default: goto yy210;
}
yy210:
-#line 1064 "token.re"
+#line 1070 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
goto ScalarBlock2;
}
-#line 2479 "<stdout>"
+#line 2485 "<stdout>"
yy211: ++YYCURSOR;
goto yy212;
yy212:
-#line 1026 "token.re"
+#line 1032 "token.re"
{ lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_block )
{
@@ -2493,16 +2499,16 @@ yy212:
}
goto ScalarBlock2;
}
-#line 2496 "<stdout>"
+#line 2502 "<stdout>"
yy213: ++YYCURSOR;
goto yy214;
yy214:
-#line 1040 "token.re"
+#line 1046 "token.re"
{ YYCURSOR--;
POP_LEVEL();
RETURN_YAML_BLOCK();
}
-#line 2505 "<stdout>"
+#line 2511 "<stdout>"
yy215: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
@@ -2531,7 +2537,7 @@ yy219: yych = *++YYCURSOR;
yy220: ++YYCURSOR;
goto yy221;
yy221:
-#line 1045 "token.re"
+#line 1051 "token.re"
{ if ( YYTOKEN == YYLINEPTR )
{
if ( blockType == BLOCK_FOLD && qidx > 0 )
@@ -2550,7 +2556,7 @@ yy221:
goto ScalarBlock2;
}
}
-#line 2553 "<stdout>"
+#line 2559 "<stdout>"
yy222: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -2582,7 +2588,7 @@ yy227: ++YYCURSOR;
default: goto yy218;
}
}
-#line 1069 "token.re"
+#line 1075 "token.re"
}
@@ -2598,7 +2604,7 @@ Comment:
YYTOKEN = YYCURSOR;
-#line 2601 "<stdout>"
+#line 2607 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -2616,11 +2622,11 @@ yy228:
yy230: ++YYCURSOR;
goto yy231;
yy231:
-#line 1085 "token.re"
+#line 1091 "token.re"
{ YYCURSOR = YYTOKEN;
return;
}
-#line 2623 "<stdout>"
+#line 2629 "<stdout>"
yy232: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy237;
@@ -2630,10 +2636,10 @@ yy233: ++YYCURSOR;
default: goto yy234;
}
yy234:
-#line 1089 "token.re"
+#line 1095 "token.re"
{ goto Comment;
}
-#line 2636 "<stdout>"
+#line 2642 "<stdout>"
yy235: yych = *++YYCURSOR;
goto yy234;
yy236: yyaccept = 0;
@@ -2658,7 +2664,7 @@ yy239: YYCURSOR = YYMARKER;
case 0: goto yy231;
}
}
-#line 1092 "token.re"
+#line 1098 "token.re"
}
diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c
index 46173e861e..821a3cd5b5 100644
--- a/ext/syck/yaml2byte.c
+++ b/ext/syck/yaml2byte.c
@@ -145,6 +145,7 @@ 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)
@@ -226,12 +227,17 @@ 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 );
- ret = S_ALLOC_N( char, strlen( sav->buffer ) + 3 );
- ret[0] = '\0';
- strcat( ret, "D\n" );
- strcat( ret, sav->buffer );
+ 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;
+ }
syck_free_parser( parser );
return ret;
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index 477489ddfe..ecc49318f7 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -22,6 +22,7 @@ static void syslog_write(int pri, int argc, VALUE *argv)
{
VALUE str;
+ rb_secure(4);
if (argc < 1) {
rb_raise(rb_eArgError, "no log message supplied");
}
@@ -38,6 +39,7 @@ static void syslog_write(int pri, int argc, VALUE *argv)
/* Syslog module methods */
static VALUE mSyslog_close(VALUE self)
{
+ rb_secure(4);
if (!syslog_opened) {
rb_raise(rb_eRuntimeError, "syslog not opened");
}
@@ -132,6 +134,7 @@ static VALUE mSyslog_get_mask(VALUE self)
static VALUE mSyslog_set_mask(VALUE self, VALUE mask)
{
+ rb_secure(4);
if (!syslog_opened) {
rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
}
diff --git a/ext/syslog/syslog.txt b/ext/syslog/syslog.txt
index 9aed35133d..35bd4cb057 100644
--- a/ext/syslog/syslog.txt
+++ b/ext/syslog/syslog.txt
@@ -7,7 +7,10 @@ Amos Gouaux, University of Texas at Dallas
<amos+ruby@utdallas.edu>
&
Akinori MUSHA
-<knu@ruby-lang.org>
+<knu@iDaemons.org>
+
+Contact:
+ - Akinori MUSHA <knu@iDaemons.org> (current maintainer)
** Syslog(Module)
diff --git a/ext/tcltklib/depend b/ext/tcltklib/depend
deleted file mode 100644
index 526a7b871c..0000000000
--- a/ext/tcltklib/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
-stubs.o: stubs.c stubs.h $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
deleted file mode 100644
index d498e25138..0000000000
--- a/ext/tcltklib/extconf.rb
+++ /dev/null
@@ -1,299 +0,0 @@
-# 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 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 recommend 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>
-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_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
- 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 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.
-**
-*****************************************************************************
-')
- $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
-
- create_makefile("tcltklib") if stubs or pthread_check
-end
diff --git a/ext/thread/extconf.rb b/ext/thread/extconf.rb
new file mode 100644
index 0000000000..2f984efc6d
--- /dev/null
+++ b/ext/thread/extconf.rb
@@ -0,0 +1,9 @@
+require 'mkmf'
+
+enable_config('fastthread', true) or exit
+
+if with_config('mem-pools', true)
+ $CPPFLAGS << ' -DUSE_MEM_POOLS'
+end
+
+create_makefile("thread")
diff --git a/ext/thread/lib/thread.rb b/ext/thread/lib/thread.rb
new file mode 100644
index 0000000000..6c533aba39
--- /dev/null
+++ b/ext/thread/lib/thread.rb
@@ -0,0 +1,5 @@
+unless defined? Thread
+ fail "Thread not available for this ruby interpreter"
+end
+
+require 'thread.so'
diff --git a/ext/thread/thread.c b/ext/thread/thread.c
new file mode 100644
index 0000000000..68f172220a
--- /dev/null
+++ b/ext/thread/thread.c
@@ -0,0 +1,1182 @@
+/*
+ * Optimized Ruby Mutex implementation, loosely based on thread.rb by
+ * Yukihiro Matsumoto <matz@ruby-lang.org>
+ *
+ * Copyright 2006-2007 MenTaLguY <mental@rydia.net>
+ *
+ * RDoc taken from original.
+ *
+ * This file is made available under the same terms as Ruby.
+ */
+
+#include <ruby.h>
+#include <intern.h>
+#include <rubysig.h>
+
+static VALUE rb_cMutex;
+static VALUE rb_cConditionVariable;
+static VALUE rb_cQueue;
+static VALUE rb_cSizedQueue;
+
+static VALUE set_critical(VALUE value);
+
+static VALUE
+thread_exclusive(VALUE (*func)(ANYARGS), VALUE arg)
+{
+ VALUE critical = rb_thread_critical;
+
+ rb_thread_critical = 1;
+ return rb_ensure(func, arg, set_critical, (VALUE)critical);
+}
+
+/*
+ * call-seq:
+ * Thread.exclusive { block } => obj
+ *
+ * Wraps a block in Thread.critical, restoring the original value
+ * upon exit from the critical section, and returns the value of the
+ * block.
+ */
+
+static VALUE
+rb_thread_exclusive(void)
+{
+ return thread_exclusive(rb_yield, Qundef);
+}
+
+typedef struct _Entry {
+ VALUE value;
+ struct _Entry *next;
+} Entry;
+
+typedef struct _List {
+ Entry *entries;
+ Entry *last_entry;
+ Entry *entry_pool;
+ unsigned long size;
+} List;
+
+static void
+init_list(List *list)
+{
+ list->entries = NULL;
+ list->last_entry = NULL;
+ list->entry_pool = NULL;
+ list->size = 0;
+}
+
+static void
+mark_list(List *list)
+{
+ Entry *entry;
+ for (entry = list->entries; entry; entry = entry->next) {
+ rb_gc_mark(entry->value);
+ }
+}
+
+static void
+free_entries(Entry *first)
+{
+ Entry *next;
+ while (first) {
+ next = first->next;
+ xfree(first);
+ first = next;
+ }
+}
+
+static void
+finalize_list(List *list)
+{
+ free_entries(list->entries);
+ free_entries(list->entry_pool);
+}
+
+static void
+push_list(List *list, VALUE value)
+{
+ Entry *entry;
+
+ if (list->entry_pool) {
+ entry = list->entry_pool;
+ list->entry_pool = entry->next;
+ } else {
+ entry = ALLOC(Entry);
+ }
+
+ entry->value = value;
+ entry->next = NULL;
+
+ if (list->last_entry) {
+ list->last_entry->next = entry;
+ } else {
+ list->entries = entry;
+ }
+ list->last_entry = entry;
+
+ ++list->size;
+}
+
+static void
+push_multiple_list(List *list, VALUE *values, unsigned count)
+{
+ unsigned i;
+ for (i = 0; i < count; i++) {
+ push_list(list, values[i]);
+ }
+}
+
+static void
+recycle_entries(List *list, Entry *first_entry, Entry *last_entry)
+{
+#ifdef USE_MEM_POOLS
+ last_entry->next = list->entry_pool;
+ list->entry_pool = first_entry;
+#else
+ last_entry->next = NULL;
+ free_entries(first_entry);
+#endif
+}
+
+static VALUE
+shift_list(List *list)
+{
+ Entry *entry;
+ VALUE value;
+
+ entry = list->entries;
+ if (!entry) return Qnil;
+
+ list->entries = entry->next;
+ if (entry == list->last_entry) {
+ list->last_entry = NULL;
+ }
+
+ --list->size;
+
+ value = entry->value;
+ recycle_entries(list, entry, entry);
+
+ return value;
+}
+
+static void
+remove_one(List *list, VALUE value)
+{
+ Entry **ref;
+ Entry *prev;
+ Entry *entry;
+
+ for (ref = &list->entries, prev = NULL, entry = list->entries;
+ entry != NULL;
+ ref = &entry->next, prev = entry, entry = entry->next) {
+ if (entry->value == value) {
+ *ref = entry->next;
+ list->size--;
+ if (!entry->next) {
+ list->last_entry = prev;
+ }
+ recycle_entries(list, entry, entry);
+ break;
+ }
+ }
+}
+
+static void
+clear_list(List *list)
+{
+ if (list->last_entry) {
+ recycle_entries(list, list->entries, list->last_entry);
+ list->entries = NULL;
+ list->last_entry = NULL;
+ list->size = 0;
+ }
+}
+
+static VALUE
+array_from_list(List const *list)
+{
+ VALUE ary;
+ Entry *entry;
+ ary = rb_ary_new();
+ for (entry = list->entries; entry; entry = entry->next) {
+ rb_ary_push(ary, entry->value);
+ }
+ return ary;
+}
+
+static VALUE
+wake_thread(VALUE thread)
+{
+ return rb_thread_wakeup_alive(thread);
+}
+
+static VALUE
+run_thread(VALUE thread)
+{
+ thread = wake_thread(thread);
+ if (RTEST(thread) && !rb_thread_critical)
+ rb_thread_schedule();
+ return thread;
+}
+
+static VALUE
+wake_one(List *list)
+{
+ VALUE waking;
+
+ waking = Qnil;
+ while (list->entries && !RTEST(waking)) {
+ waking = wake_thread(shift_list(list));
+ }
+
+ return waking;
+}
+
+static VALUE
+wake_all(List *list)
+{
+ while (list->entries) {
+ wake_one(list);
+ }
+ return Qnil;
+}
+
+static VALUE
+wait_list_inner(List *list)
+{
+ push_list(list, rb_thread_current());
+ rb_thread_stop();
+ return Qnil;
+}
+
+static VALUE
+wait_list_cleanup(List *list)
+{
+ /* cleanup in case of spurious wakeups */
+ remove_one(list, rb_thread_current());
+ return Qnil;
+}
+
+static VALUE
+wait_list(List *list)
+{
+ return rb_ensure(wait_list_inner, (VALUE)list, wait_list_cleanup, (VALUE)list);
+}
+
+static void
+kill_waiting_threads(List *waiting)
+{
+ Entry *entry;
+
+ for (entry = waiting->entries; entry; entry = entry->next) {
+ rb_thread_kill(entry->value);
+ }
+}
+
+/*
+ * Document-class: Mutex
+ *
+ * Mutex implements a simple semaphore that can be used to coordinate access to
+ * shared data from multiple concurrent threads.
+ *
+ * Example:
+ *
+ * require 'thread'
+ * semaphore = Mutex.new
+ *
+ * a = Thread.new {
+ * semaphore.synchronize {
+ * # access shared resource
+ * }
+ * }
+ *
+ * b = Thread.new {
+ * semaphore.synchronize {
+ * # access shared resource
+ * }
+ * }
+ *
+ */
+
+typedef struct _Mutex {
+ VALUE owner;
+ List waiting;
+} Mutex;
+
+#define MUTEX_LOCKED_P(mutex) (RTEST((mutex)->owner) && rb_thread_alive_p((mutex)->owner))
+
+static void
+mark_mutex(Mutex *mutex)
+{
+ rb_gc_mark(mutex->owner);
+ mark_list(&mutex->waiting);
+}
+
+static void
+finalize_mutex(Mutex *mutex)
+{
+ finalize_list(&mutex->waiting);
+}
+
+static void
+free_mutex(Mutex *mutex)
+{
+ kill_waiting_threads(&mutex->waiting);
+ finalize_mutex(mutex);
+ xfree(mutex);
+}
+
+static void
+init_mutex(Mutex *mutex)
+{
+ mutex->owner = Qnil;
+ init_list(&mutex->waiting);
+}
+
+/*
+ * Document-method: new
+ * call-seq: Mutex.new
+ *
+ * Creates a new Mutex
+ *
+ */
+
+static VALUE
+rb_mutex_alloc(VALUE klass)
+{
+ Mutex *mutex;
+ mutex = ALLOC(Mutex);
+ init_mutex(mutex);
+ return Data_Wrap_Struct(klass, mark_mutex, free_mutex, mutex);
+}
+
+/*
+ * Document-method: locked?
+ * call-seq: locked?
+ *
+ * Returns +true+ if this lock is currently held by some thread.
+ *
+ */
+
+static VALUE
+rb_mutex_locked_p(VALUE self)
+{
+ Mutex *mutex;
+ Data_Get_Struct(self, Mutex, mutex);
+ return MUTEX_LOCKED_P(mutex) ? Qtrue : Qfalse;
+}
+
+/*
+ * Document-method: try_lock
+ * call-seq: try_lock
+ *
+ * Attempts to obtain the lock and returns immediately. Returns +true+ if the
+ * lock was granted.
+ *
+ */
+
+static VALUE
+rb_mutex_try_lock(VALUE self)
+{
+ Mutex *mutex;
+
+ Data_Get_Struct(self, Mutex, mutex);
+
+ if (MUTEX_LOCKED_P(mutex))
+ return Qfalse;
+
+ mutex->owner = rb_thread_current();
+ return Qtrue;
+}
+
+/*
+ * Document-method: lock
+ * call-seq: lock
+ *
+ * Attempts to grab the lock and waits if it isn't available.
+ *
+ */
+
+static VALUE
+lock_mutex(Mutex *mutex)
+{
+ VALUE current;
+ current = rb_thread_current();
+
+ rb_thread_critical = 1;
+
+ if (!MUTEX_LOCKED_P(mutex)) {
+ mutex->owner = current;
+ }
+ else {
+ do {
+ wait_list(&mutex->waiting);
+ rb_thread_critical = 1;
+ if (!MUTEX_LOCKED_P(mutex)) {
+ mutex->owner = current;
+ break;
+ }
+ } while (mutex->owner != current);
+ }
+
+ rb_thread_critical = 0;
+ return Qnil;
+}
+
+static VALUE
+rb_mutex_lock(VALUE self)
+{
+ Mutex *mutex;
+ Data_Get_Struct(self, Mutex, mutex);
+ lock_mutex(mutex);
+ return self;
+}
+
+/*
+ * Document-method: unlock
+ *
+ * Releases the lock. Returns +nil+ if ref wasn't locked.
+ *
+ */
+
+static VALUE
+unlock_mutex_inner(Mutex *mutex)
+{
+ VALUE waking;
+
+ if (mutex->owner != rb_thread_current()) {
+ rb_raise(rb_eThreadError, "not owner");
+ }
+
+ waking = wake_one(&mutex->waiting);
+ mutex->owner = waking;
+
+ return waking;
+}
+
+static VALUE
+set_critical(VALUE value)
+{
+ rb_thread_critical = (int)value;
+ return Qundef;
+}
+
+static VALUE
+unlock_mutex(Mutex *mutex)
+{
+ VALUE waking = thread_exclusive(unlock_mutex_inner, (VALUE)mutex);
+
+ if (!RTEST(waking)) {
+ return Qfalse;
+ }
+
+ run_thread(waking);
+
+ return Qtrue;
+}
+
+static VALUE
+rb_mutex_unlock(VALUE self)
+{
+ Mutex *mutex;
+ Data_Get_Struct(self, Mutex, mutex);
+
+ if (RTEST(unlock_mutex(mutex))) {
+ return self;
+ } else {
+ return Qnil;
+ }
+}
+
+/*
+ * Document-method: exclusive_unlock
+ * call-seq: exclusive_unlock { ... }
+ *
+ * If the mutex is locked, unlocks the mutex, wakes one waiting thread, and
+ * yields in a critical section.
+ *
+ */
+
+static VALUE
+rb_mutex_exclusive_unlock_inner(Mutex *mutex)
+{
+ VALUE waking;
+ waking = unlock_mutex_inner(mutex);
+ rb_yield(Qundef);
+ return waking;
+}
+
+static VALUE
+rb_mutex_exclusive_unlock(VALUE self)
+{
+ Mutex *mutex;
+ VALUE waking;
+ Data_Get_Struct(self, Mutex, mutex);
+
+ waking = thread_exclusive(rb_mutex_exclusive_unlock_inner, (VALUE)mutex);
+
+ if (!RTEST(waking)) {
+ return Qnil;
+ }
+
+ run_thread(waking);
+
+ return self;
+}
+
+/*
+ * Document-method: synchronize
+ * call-seq: synchronize { ... }
+ *
+ * Obtains a lock, runs the block, and releases the lock when the block
+ * completes. See the example under Mutex.
+ *
+ */
+
+static VALUE
+rb_mutex_synchronize(VALUE self)
+{
+ rb_mutex_lock(self);
+ return rb_ensure(rb_yield, Qundef, rb_mutex_unlock, self);
+}
+
+/*
+ * Document-class: ConditionVariable
+ *
+ * ConditionVariable objects augment class Mutex. Using condition variables,
+ * it is possible to suspend while in the middle of a critical section until a
+ * resource becomes available.
+ *
+ * Example:
+ *
+ * require 'thread'
+ *
+ * mutex = Mutex.new
+ * resource = ConditionVariable.new
+ *
+ * a = Thread.new {
+ * mutex.synchronize {
+ * # Thread 'a' now needs the resource
+ * resource.wait(mutex)
+ * # 'a' can now have the resource
+ * }
+ * }
+ *
+ * b = Thread.new {
+ * mutex.synchronize {
+ * # Thread 'b' has finished using the resource
+ * resource.signal
+ * }
+ * }
+ *
+ */
+
+typedef struct _ConditionVariable {
+ List waiting;
+} ConditionVariable;
+
+static void
+mark_condvar(ConditionVariable *condvar)
+{
+ mark_list(&condvar->waiting);
+}
+
+static void
+finalize_condvar(ConditionVariable *condvar)
+{
+ finalize_list(&condvar->waiting);
+}
+
+static void
+free_condvar(ConditionVariable *condvar)
+{
+ kill_waiting_threads(&condvar->waiting);
+ finalize_condvar(condvar);
+ xfree(condvar);
+}
+
+static void
+init_condvar(ConditionVariable *condvar)
+{
+ init_list(&condvar->waiting);
+}
+
+/*
+ * Document-method: new
+ * call-seq: ConditionVariable.new
+ *
+ * Creates a new ConditionVariable
+ *
+ */
+
+static VALUE
+rb_condvar_alloc(VALUE klass)
+{
+ ConditionVariable *condvar;
+
+ condvar = ALLOC(ConditionVariable);
+ init_condvar(condvar);
+
+ return Data_Wrap_Struct(klass, mark_condvar, free_condvar, condvar);
+}
+
+/*
+ * Document-method: wait
+ * call-seq: wait
+ *
+ * Releases the lock held in +mutex+ and waits; reacquires the lock on wakeup.
+ *
+ */
+
+static void
+wait_condvar(ConditionVariable *condvar, Mutex *mutex)
+{
+ VALUE waking;
+
+ rb_thread_critical = 1;
+ if (rb_thread_current() != mutex->owner) {
+ rb_thread_critical = 0;
+ rb_raise(rb_eThreadError, "not owner of the synchronization mutex");
+ }
+ waking = unlock_mutex_inner(mutex);
+ if (RTEST(waking)) {
+ wake_thread(waking);
+ }
+ rb_ensure(wait_list, (VALUE)&condvar->waiting, lock_mutex, (VALUE)mutex);
+}
+
+static VALUE
+legacy_exclusive_unlock(VALUE mutex)
+{
+ return rb_funcall(mutex, rb_intern("exclusive_unlock"), 0);
+}
+
+typedef struct {
+ ConditionVariable *condvar;
+ VALUE mutex;
+} legacy_wait_args;
+
+static VALUE
+legacy_wait(VALUE unused, legacy_wait_args *args)
+{
+ wait_list(&args->condvar->waiting);
+ rb_funcall(args->mutex, rb_intern("lock"), 0);
+ return Qnil;
+}
+
+static VALUE
+rb_condvar_wait(VALUE self, VALUE mutex_v)
+{
+ ConditionVariable *condvar;
+ Data_Get_Struct(self, ConditionVariable, condvar);
+
+ if (CLASS_OF(mutex_v) != rb_cMutex) {
+ /* interoperate with legacy mutex */
+ legacy_wait_args args;
+ args.condvar = condvar;
+ args.mutex = mutex_v;
+ rb_iterate(legacy_exclusive_unlock, mutex_v, legacy_wait, (VALUE)&args);
+ } else {
+ Mutex *mutex;
+ Data_Get_Struct(mutex_v, Mutex, mutex);
+ wait_condvar(condvar, mutex);
+ }
+
+ return self;
+}
+
+/*
+ * Document-method: broadcast
+ * call-seq: broadcast
+ *
+ * Wakes up all threads waiting for this condition.
+ *
+ */
+
+static VALUE
+rb_condvar_broadcast(VALUE self)
+{
+ ConditionVariable *condvar;
+
+ Data_Get_Struct(self, ConditionVariable, condvar);
+
+ thread_exclusive(wake_all, (VALUE)&condvar->waiting);
+ rb_thread_schedule();
+
+ return self;
+}
+
+/*
+ * Document-method: signal
+ * call-seq: signal
+ *
+ * Wakes up the first thread in line waiting for this condition.
+ *
+ */
+
+static void
+signal_condvar(ConditionVariable *condvar)
+{
+ VALUE waking = thread_exclusive(wake_one, (VALUE)&condvar->waiting);
+
+ if (RTEST(waking)) {
+ run_thread(waking);
+ }
+}
+
+static VALUE
+rb_condvar_signal(VALUE self)
+{
+ ConditionVariable *condvar;
+ Data_Get_Struct(self, ConditionVariable, condvar);
+ signal_condvar(condvar);
+ return self;
+}
+
+/*
+ * Document-class: Queue
+ *
+ * This class provides a way to synchronize communication between threads.
+ *
+ * Example:
+ *
+ * require 'thread'
+ *
+ * queue = Queue.new
+ *
+ * producer = Thread.new do
+ * 5.times do |i|
+ * sleep rand(i) # simulate expense
+ * queue << i
+ * puts "#{i} produced"
+ * end
+ * end
+ *
+ * consumer = Thread.new do
+ * 5.times do |i|
+ * value = queue.pop
+ * sleep rand(i/2) # simulate expense
+ * puts "consumed #{value}"
+ * end
+ * end
+ *
+ * consumer.join
+ *
+ */
+
+typedef struct _Queue {
+ Mutex mutex;
+ ConditionVariable value_available;
+ ConditionVariable space_available;
+ List values;
+ unsigned long capacity;
+} Queue;
+
+static void
+mark_queue(Queue *queue)
+{
+ mark_mutex(&queue->mutex);
+ mark_condvar(&queue->value_available);
+ mark_condvar(&queue->space_available);
+ mark_list(&queue->values);
+}
+
+static void
+finalize_queue(Queue *queue)
+{
+ finalize_mutex(&queue->mutex);
+ finalize_condvar(&queue->value_available);
+ finalize_condvar(&queue->space_available);
+ finalize_list(&queue->values);
+}
+
+static void
+free_queue(Queue *queue)
+{
+ kill_waiting_threads(&queue->mutex.waiting);
+ kill_waiting_threads(&queue->space_available.waiting);
+ kill_waiting_threads(&queue->value_available.waiting);
+ finalize_queue(queue);
+ xfree(queue);
+}
+
+static void
+init_queue(Queue *queue)
+{
+ init_mutex(&queue->mutex);
+ init_condvar(&queue->value_available);
+ init_condvar(&queue->space_available);
+ init_list(&queue->values);
+ queue->capacity = 0;
+}
+
+/*
+ * Document-method: new
+ * call-seq: new
+ *
+ * Creates a new queue.
+ *
+ */
+
+static VALUE
+rb_queue_alloc(VALUE klass)
+{
+ Queue *queue;
+ queue = ALLOC(Queue);
+ init_queue(queue);
+ return Data_Wrap_Struct(klass, mark_queue, free_queue, queue);
+}
+
+static VALUE
+rb_queue_marshal_load(VALUE self, VALUE data)
+{
+ Queue *queue;
+ VALUE array;
+ Data_Get_Struct(self, Queue, queue);
+
+ array = rb_marshal_load(data);
+ if (TYPE(array) != T_ARRAY) {
+ rb_raise(rb_eTypeError, "expected Array of queue data");
+ }
+ if (RARRAY(array)->len < 1) {
+ rb_raise(rb_eArgError, "missing capacity value");
+ }
+ queue->capacity = NUM2ULONG(rb_ary_shift(array));
+ push_multiple_list(&queue->values, RARRAY(array)->ptr, (unsigned)RARRAY(array)->len);
+
+ return self;
+}
+
+static VALUE
+rb_queue_marshal_dump(VALUE self)
+{
+ Queue *queue;
+ VALUE array;
+ Data_Get_Struct(self, Queue, queue);
+
+ array = array_from_list(&queue->values);
+ rb_ary_unshift(array, ULONG2NUM(queue->capacity));
+ return rb_marshal_dump(array, Qnil);
+}
+
+/*
+ * Document-method: clear
+ * call-seq: clear
+ *
+ * Removes all objects from the queue.
+ *
+ */
+
+static VALUE
+rb_queue_clear(VALUE self)
+{
+ Queue *queue;
+ Data_Get_Struct(self, Queue, queue);
+
+ lock_mutex(&queue->mutex);
+ clear_list(&queue->values);
+ signal_condvar(&queue->space_available);
+ unlock_mutex(&queue->mutex);
+
+ return self;
+}
+
+/*
+ * Document-method: empty?
+ * call-seq: empty?
+ *
+ * Returns +true+ if the queue is empty.
+ *
+ */
+
+static VALUE
+rb_queue_empty_p(VALUE self)
+{
+ Queue *queue;
+ VALUE result;
+ Data_Get_Struct(self, Queue, queue);
+
+ lock_mutex(&queue->mutex);
+ result = queue->values.size == 0 ? Qtrue : Qfalse;
+ unlock_mutex(&queue->mutex);
+
+ return result;
+}
+
+/*
+ * Document-method: length
+ * call-seq: length
+ *
+ * Returns the length of the queue.
+ *
+ */
+
+static VALUE
+rb_queue_length(VALUE self)
+{
+ Queue *queue;
+ VALUE result;
+ Data_Get_Struct(self, Queue, queue);
+
+ lock_mutex(&queue->mutex);
+ result = ULONG2NUM(queue->values.size);
+ unlock_mutex(&queue->mutex);
+
+ return result;
+}
+
+/*
+ * Document-method: num_waiting
+ * call-seq: num_waiting
+ *
+ * Returns the number of threads waiting on the queue.
+ *
+ */
+
+static VALUE
+rb_queue_num_waiting(VALUE self)
+{
+ Queue *queue;
+ VALUE result;
+ Data_Get_Struct(self, Queue, queue);
+
+ lock_mutex(&queue->mutex);
+ result = ULONG2NUM(queue->value_available.waiting.size +
+ queue->space_available.waiting.size);
+ unlock_mutex(&queue->mutex);
+
+ return result;
+}
+
+/*
+ * Document-method: pop
+ * call_seq: pop(non_block=false)
+ *
+ * Retrieves data from the queue. If the queue is empty, the calling thread is
+ * suspended until data is pushed onto the queue. If +non_block+ is true, the
+ * thread isn't suspended, and an exception is raised.
+ *
+ */
+
+static VALUE
+rb_queue_pop(int argc, VALUE *argv, VALUE self)
+{
+ Queue *queue;
+ int should_block;
+ VALUE result;
+ Data_Get_Struct(self, Queue, queue);
+
+ if (argc == 0) {
+ should_block = 1;
+ } else if (argc == 1) {
+ should_block = !RTEST(argv[0]);
+ } else {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ }
+
+ lock_mutex(&queue->mutex);
+ if (!queue->values.entries && !should_block) {
+ unlock_mutex(&queue->mutex);
+ rb_raise(rb_eThreadError, "queue empty");
+ }
+
+ while (!queue->values.entries) {
+ wait_condvar(&queue->value_available, &queue->mutex);
+ }
+
+ result = shift_list(&queue->values);
+ if (queue->capacity && queue->values.size < queue->capacity) {
+ signal_condvar(&queue->space_available);
+ }
+ unlock_mutex(&queue->mutex);
+
+ return result;
+}
+
+/*
+ * Document-method: push
+ * call-seq: push(obj)
+ *
+ * Pushes +obj+ to the queue.
+ *
+ */
+
+static VALUE
+rb_queue_push(VALUE self, VALUE value)
+{
+ Queue *queue;
+ Data_Get_Struct(self, Queue, queue);
+
+ lock_mutex(&queue->mutex);
+ while (queue->capacity && queue->values.size >= queue->capacity) {
+ wait_condvar(&queue->space_available, &queue->mutex);
+ }
+ push_list(&queue->values, value);
+ signal_condvar(&queue->value_available);
+ unlock_mutex(&queue->mutex);
+
+ return self;
+}
+
+/*
+ * Document-class: SizedQueue
+ *
+ * This class represents queues of specified size capacity. The push operation
+ * may be blocked if the capacity is full.
+ *
+ * See Queue for an example of how a SizedQueue works.
+ *
+ */
+
+/*
+ * Document-method: new
+ * call-seq: new
+ *
+ * Creates a fixed-length queue with a maximum size of +max+.
+ *
+ */
+
+/*
+ * Document-method: max
+ * call-seq: max
+ *
+ * Returns the maximum size of the queue.
+ *
+ */
+
+static VALUE
+rb_sized_queue_max(VALUE self)
+{
+ Queue *queue;
+ VALUE result;
+ Data_Get_Struct(self, Queue, queue);
+
+ lock_mutex(&queue->mutex);
+ result = ULONG2NUM(queue->capacity);
+ unlock_mutex(&queue->mutex);
+
+ return result;
+}
+
+/*
+ * Document-method: max=
+ * call-seq: max=(size)
+ *
+ * Sets the maximum size of the queue.
+ *
+ */
+
+static VALUE
+rb_sized_queue_max_set(VALUE self, VALUE value)
+{
+ Queue *queue;
+ unsigned long new_capacity;
+ unsigned long difference;
+ Data_Get_Struct(self, Queue, queue);
+
+ new_capacity = NUM2ULONG(value);
+
+ if (new_capacity < 1) {
+ rb_raise(rb_eArgError, "value must be positive");
+ }
+
+ lock_mutex(&queue->mutex);
+ if (queue->capacity && new_capacity > queue->capacity) {
+ difference = new_capacity - queue->capacity;
+ } else {
+ difference = 0;
+ }
+ queue->capacity = new_capacity;
+ for (; difference > 0; --difference) {
+ signal_condvar(&queue->space_available);
+ }
+ unlock_mutex(&queue->mutex);
+
+ return self;
+}
+
+/*
+ * Document-method: push
+ * call-seq: push(obj)
+ *
+ * Pushes +obj+ to the queue. If there is no space left in the queue, waits
+ * until space becomes available.
+ *
+ */
+
+/*
+ * Document-method: pop
+ * call-seq: pop(non_block=false)
+ *
+ * Retrieves data from the queue and runs a waiting thread, if any.
+ *
+ */
+
+/* for marshalling mutexes and condvars */
+
+static VALUE
+dummy_load(VALUE self, VALUE string)
+{
+ return Qnil;
+}
+
+static VALUE
+dummy_dump(VALUE self)
+{
+ return rb_str_new2("");
+}
+
+void
+Init_thread(void)
+{
+ rb_define_singleton_method(rb_cThread, "exclusive", rb_thread_exclusive, 0);
+
+ rb_cMutex = rb_define_class("Mutex", rb_cObject);
+ rb_define_alloc_func(rb_cMutex, rb_mutex_alloc);
+ rb_define_method(rb_cMutex, "marshal_load", dummy_load, 1);
+ rb_define_method(rb_cMutex, "marshal_dump", dummy_dump, 0);
+ rb_define_method(rb_cMutex, "locked?", rb_mutex_locked_p, 0);
+ rb_define_method(rb_cMutex, "try_lock", rb_mutex_try_lock, 0);
+ rb_define_method(rb_cMutex, "lock", rb_mutex_lock, 0);
+ rb_define_method(rb_cMutex, "unlock", rb_mutex_unlock, 0);
+ rb_define_method(rb_cMutex, "exclusive_unlock", rb_mutex_exclusive_unlock, 0);
+ rb_define_method(rb_cMutex, "synchronize", rb_mutex_synchronize, 0);
+
+ rb_cConditionVariable = rb_define_class("ConditionVariable", rb_cObject);
+ rb_define_alloc_func(rb_cConditionVariable, rb_condvar_alloc);
+ rb_define_method(rb_cConditionVariable, "marshal_load", dummy_load, 1);
+ rb_define_method(rb_cConditionVariable, "marshal_dump", dummy_dump, 0);
+ rb_define_method(rb_cConditionVariable, "wait", rb_condvar_wait, 1);
+ rb_define_method(rb_cConditionVariable, "broadcast", rb_condvar_broadcast, 0);
+ rb_define_method(rb_cConditionVariable, "signal", rb_condvar_signal, 0);
+
+ rb_cQueue = rb_define_class("Queue", rb_cObject);
+ rb_define_alloc_func(rb_cQueue, rb_queue_alloc);
+ rb_define_method(rb_cQueue, "marshal_load", rb_queue_marshal_load, 1);
+ rb_define_method(rb_cQueue, "marshal_dump", rb_queue_marshal_dump, 0);
+ rb_define_method(rb_cQueue, "clear", rb_queue_clear, 0);
+ rb_define_method(rb_cQueue, "empty?", rb_queue_empty_p, 0);
+ rb_define_method(rb_cQueue, "length", rb_queue_length, 0);
+ rb_define_method(rb_cQueue, "num_waiting", rb_queue_num_waiting, 0);
+ rb_define_method(rb_cQueue, "pop", rb_queue_pop, -1);
+ rb_define_method(rb_cQueue, "push", rb_queue_push, 1);
+ rb_alias(rb_cQueue, rb_intern("enq"), rb_intern("push"));
+ rb_alias(rb_cQueue, rb_intern("<<"), rb_intern("push"));
+ rb_alias(rb_cQueue, rb_intern("deq"), rb_intern("pop"));
+ rb_alias(rb_cQueue, rb_intern("shift"), rb_intern("pop"));
+ rb_alias(rb_cQueue, rb_intern("size"), rb_intern("length"));
+
+ rb_cSizedQueue = rb_define_class("SizedQueue", rb_cQueue);
+ rb_define_method(rb_cSizedQueue, "initialize", rb_sized_queue_max_set, 1);
+ rb_define_method(rb_cSizedQueue, "num_waiting", rb_queue_num_waiting, 0);
+ rb_define_method(rb_cSizedQueue, "pop", rb_queue_pop, -1);
+ rb_define_method(rb_cSizedQueue, "push", rb_queue_push, 1);
+ rb_define_method(rb_cSizedQueue, "max", rb_sized_queue_max, 0);
+ rb_define_method(rb_cSizedQueue, "max=", rb_sized_queue_max_set, 1);
+ rb_alias(rb_cSizedQueue, rb_intern("enq"), rb_intern("push"));
+ rb_alias(rb_cSizedQueue, rb_intern("<<"), rb_intern("push"));
+ rb_alias(rb_cSizedQueue, rb_intern("deq"), rb_intern("pop"));
+ rb_alias(rb_cSizedQueue, rb_intern("shift"), rb_intern("pop"));
+}
+
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib
index a0c1571f3b..8c5d01a954 100644
--- a/ext/tk/ChangeLog.tkextlib
+++ b/ext/tk/ChangeLog.tkextlib
@@ -1,58 +1,169 @@
+2008-05-12 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tkDND/shape.rb: wrong package name.
+
+--------------< ... some changes ... >------------------
+
+2007-05-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tcllib/tablelist.rb: fix typo.
+
+ * ext/tk/lib/tkextlib/tile/dialog.rb: forget to give an argument.
+
+ * ext/tk/lib/tkextlib/version.rb: update RELEASE_DATE.
+
+2007-01-26 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/iwidgets/checkbox.rb: wrong number of arguments
+ [ruby-Bugs-7776].
+
+ * ext/tk/lib/tkextlib/iwidgets/radiobox.rb: ditto.
+
+ * ext/tk/lib/tkextlib/blt/tile/checkbutton.rb: change primary name
+ of class [ruby-dev:30080].
+
+ * ext/tk/lib/tkextlib/blt/tile/radiobutton.rb: ditto.
+
+2006-11-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * lib/tkextlib/tile/treeview.rb : minor bug fix.
+
+ * lib/tkextlib/blt/table.rb: fix bugs which forbade use of
+ '::blt::table' command. Now, probably, it'll works properly.
+
+2006-11-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * lib/tkextlib/version.rb: keep release date of tkextlib on
+ "Tk::Tkextlib_RELEASE_DATE".
+
+ * lib/tkextlib/tile/treeview.rb : support Tile 0.7.8.
+ Now, you can handle tree items as objects.
+
+2006-10-04 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * lib/tkextlib/tile.rb, lib/tkextlib/tile/* : support Tile 0.7.6.
+
+2006-10-03 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * lib/tkextlib/SUPPORT_STATUS: [ruby-talk:211939] check links
+ of extensions.
+
+ * lib/tkextlib/blt/container.rb: define instance methods properly.
+
+ * lib/tkextlib/tile/tcombobox.rb: bug fix [ruby-talk:213003].
+
+ * lib/tkextlib/tile/tnotebook.rb: ditto.
+
+ * lib/tkextlib/tile/treeview.rb: ditto.
+
+ * lib/tkextlib/tile/sizegrip.rb: [new] add 'ttk::sizegrip' widget.
+
+2006-08-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * lib/tkextlib/blt.rb: double dashes (--) option doesn't work
+ properly on some versions of BLT (wrong description on the
+ manual of `blt::bgexec'?).
+
+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>
- * ext/tk/lib/tkextlib/blt/component.rb: didn't check
+ * lib/tkextlib/blt/component.rb: didn't check
__item_ruby2val_optkeys().
2005-08-09 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tkextlib/blt/barchart.rb: support to treat tkvariable-type
+ * lib/tkextlib/blt/barchart.rb: support to treat tkvariable-type
configure options.
- * ext/tk/lib/tkextlib/blt/component.rb: ditto.
+ * lib/tkextlib/blt/component.rb: ditto.
- * ext/tk/lib/tkextlib/blt/dragdrop.rb: ditto.
+ * lib/tkextlib/blt/dragdrop.rb: ditto.
- * ext/tk/lib/tkextlib/blt/treeview.rb: ditto.
+ * lib/tkextlib/blt/treeview.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/button.rb: ditto.
+ * lib/tkextlib/bwidget/button.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/entry.rb: ditto.
+ * lib/tkextlib/bwidget/entry.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/label.rb: ditto.
+ * lib/tkextlib/bwidget/label.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/labelentry.rb: ditto.
+ * lib/tkextlib/bwidget/labelentry.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/labelframe.rb: ditto.
+ * lib/tkextlib/bwidget/labelframe.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/mainframe.rb: ditto.
+ * lib/tkextlib/bwidget/mainframe.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/passwddlg.rb: ditto.
+ * lib/tkextlib/bwidget/passwddlg.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/spinbox.rb: ditto.
+ * lib/tkextlib/bwidget/spinbox.rb: ditto.
- * ext/tk/lib/tkextlib/bwidget/tree.rb: ditto.
+ * lib/tkextlib/bwidget/tree.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/calendar.rb: ditto.
+ * lib/tkextlib/iwidgets/calendar.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/entryfield.rb: ditto.
+ * lib/tkextlib/iwidgets/entryfield.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/hierarchy.rb: ditto.
+ * lib/tkextlib/iwidgets/hierarchy.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/labeledframe.rb: ditto.
+ * lib/tkextlib/iwidgets/labeledframe.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb: ditto.
+ * lib/tkextlib/iwidgets/labeledwidget.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/menubar.rb: ditto.
+ * lib/tkextlib/iwidgets/menubar.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb: ditto.
+ * lib/tkextlib/iwidgets/scrolledlistbox.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/spinner.rb: ditto.
+ * lib/tkextlib/iwidgets/spinner.rb: ditto.
- * ext/tk/lib/tkextlib/iwidgets/toolbar.rb: ditto.
+ * lib/tkextlib/iwidgets/toolbar.rb: ditto.
- * ext/tk/lib/tkextlib/tkimg/pixmap.rb: ditto.
+ * lib/tkextlib/tkimg/pixmap.rb: ditto.
- * ext/tk/lib/tkextlib/tktable/tktable.rb: ditto.
+ * lib/tkextlib/tktable/tktable.rb: ditto.
2005-08-06 ocean <ocean@ruby-lang.org>
diff --git a/ext/tcltklib/MANUAL.eng b/ext/tk/MANUAL_tcltklib.eng
index 1db61f228e..6fa775b7de 100644
--- a/ext/tcltklib/MANUAL.eng
+++ b/ext/tk/MANUAL_tcltklib.eng
@@ -125,7 +125,24 @@ module TclTklib
: Tcl7.6 doesn't have this flag. So PARSE_VARNAME is
: defined as 0.
+ module TclTkLib::RELEASE_TYPE
+ : Defines release type number of Tcl/Tk
+
+ ALPHA
+ : ALPHA release
+
+ BETA
+ : BETA release
+
+ FINAL
+ : FINAL release
+
[module methods]
+ get_version()
+ : return an array of major, minor, release-type number,
+ : number, release-type name, and patchlevel of current
+ : Tcl/Tk library.
+
mainloop(check_root = true)
: Starts the eventloop. If 'check_root' is true, this method
: doesn't return when a root widget exists.
@@ -431,6 +448,10 @@ class TclTkIp
: slave interpreter, same to the TclTkLib module method with
: the same name.
+ encoding_table
+ : For Ruby m17n. Return encoding relation table between Ruby's
+ : Encoding object and Tcl's encoding name.
+
class TkCallbackBreak < StandardError
class TkCallbackContinue < StandardError
: They are exception classes to break or continue the Tk callback
@@ -441,5 +462,8 @@ class TkCallbackContinue < StandardError
: If raise TkCallbackContinue, returns 'continue' code (Then the Tk
: interpreter will break the operateion for the current bindtag and
: starts the operation for the next buindtag for the current event).
+ : However, current tcltklib supports Ruby's 'break' and 'next' to
+ : get the same effect. That is, those classes are obsolete. Those
+ : exist for backward compatibility.
(eof)
diff --git a/ext/tcltklib/MANUAL.euc b/ext/tk/MANUAL_tcltklib.eucj
index 5dd36726ba..7df42997b4 100644
--- a/ext/tcltklib/MANUAL.euc
+++ b/ext/tk/MANUAL_tcltklib.eucj
@@ -221,7 +221,23 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: ¤«¤éÃê½Ð¤µ¤ì¤ë¤Ï¤º¤Ç¤¢¤ë¤«¤é¡¤index_name °ú¿ô¤Ï nil ¤È
: ¤»¤Í¤Ð¤Ê¤é¤Ê¤¤¡¥
+ ¥â¥¸¥å¡¼¥ë TclTkLib::RELEASE_TYPE
+ : Tcl/Tk ¤Î¥ê¥ê¡¼¥¹¥¿¥¤¥×ÈÖ¹æ¤ÎÄêµÁ
+
+ Äê¿ô ALPHA
+ : ALPHA ¥ê¥ê¡¼¥¹
+
+ Äê¿ô BETA
+ : BETA ¥ê¥ê¡¼¥¹
+
+ Äê¿ô FINAL
+ : FINAL ¥ê¥ê¡¼¥¹
+
¥â¥¸¥å¡¼¥ë¥á¥½¥Ã¥É
+ get_version()
+ : Tcl/Tk ¤Î major, minor, release-type ÈÖ¹æ, release-type ̾,
+ : patchlevel ¤òÇÛÎó¤Ë¤·¤ÆÊÖ¤¹¡¥
+
mainloop(check_root = true)
: ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤òµ¯Æ°¤¹¤ë¡¥check_root ¤¬ true ¤Ç¤¢¤ì¤Ð¡¤
: root widget ¤¬Â¸ºß¤¹¤ë¸Â¤ê¡¤¤³¤Î¥á¥½¥Ã¥É¤Ï½ªÎ»¤·¤Ê¤¤¡¥
@@ -543,6 +559,9 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: ¥¹¥ì¡¼¥Ö IP ¤Î¾ì¹ç¤Ë¤ÏÃͤÎÀßÄ꤬µö¤µ¤ì¤Ê¤¤ (̵»ë¤µ¤ì¤ë)¡¥
: ¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï°ú¿ô¤ò´Þ¤á¤Æ TclTkLib ¤ÎƱ̾¥á¥½¥Ã¥É¤ËƱ¤¸¡¥
+ encoding_table
+ : Ruby m17n ÍÑ¤Ë Ruby ¤È Tk ¤È¤Î´Ö¤Î encoding Âбþɽ¤òÊÖ¤¹¡¥
+
¥¯¥é¥¹ TkCallbackBreak < StandardError
¥¯¥é¥¹ TkCallbackContinue < StandardError
: ¤³¤ì¤é¤Ï¥¤¥Ù¥ó¥È¥³¡¼¥ë¥Ð¥Ã¥¯¤Ë¤ª¤¤¤Æ¡¤¥³¡¼¥ë¥Ð¥Ã¥¯½èÍý¤òŬÀÚ¤ËÃæ
@@ -553,5 +572,8 @@ require "tcltklib" ¤¹¤ë¤È, °Ê²¼¤Î¥â¥¸¥å¡¼¥ë, ¥¯¥é¥¹¤¬ÍøÍѲÄǽ¤Ç¤¹.
: ¥É¤òÊÖ¤¹É¬Íפ¬¤¢¤ë¡¥Ruby ¤Î¼ê³¤­¤¬ÉáÄ̤ËÃͤòÊÖ¤¹¤Î¤Ç¤Ï¡¤¤½¤ì¤¬Éá
: Ä̤ÎÌá¤êÃͤǤ¢¤ë¤Î¤«Èݤ«¤ò¶èÊ̤¬¤Ç¤­¤Ê¤¤¤¿¤á¡¤Î㳰ȯÀ¸¤òÍøÍѤ·¤¿
: ¼ÂÁõ¤ò¹Ô¤Ã¤Æ¤¤¤ë¡¥
+ : ¤¿¤À¤·¸½ºß¤Ç¤Ï¡¤¥³¡¼¥ë¥Ð¥Ã¥¯¼ê³¤­¤ò Ruby ¤Î break, next ¤Ç½ªÎ»¤¹
+ : ¤ë¤³¤È¤ÇƱÅù¤Î·ë²Ì¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡¥¤½¤ì¤æ¤¨¡¤
+ : ¤³¤ì¤é¤ÏɬÍפʤ¤¤â¤Î¤Ç¤Ï¤¢¤ë¤¬¡¤¸ß´¹À­¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤¢¤ë¡¥
(eof)
diff --git a/ext/tk/README.1st b/ext/tk/README.1st
index df6c819d26..fce5b0242b 100644
--- a/ext/tk/README.1st
+++ b/ext/tk/README.1st
@@ -1,7 +1,6 @@
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.
+which is working correctly. When you have some troubles on compiling,
+please read README.tcltklib and README.ActiveTcl.
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.
@@ -9,11 +8,9 @@ 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/Tk (tk.rb ¤Ê¤É) ¤ò»È¤¤¤¿¤¤¾ì¹ç¤Ë¤Ï¡¤tcltklib.so ¤¬Àµ¤·¤¯Æ°¤¤¤Æ¤¤¤Ê
+¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡¥¥³¥ó¥Ñ¥¤¥ë»þ¤Ë²¿¤«ÌäÂ꤬À¸¤¸¤¿¾ì¹ç¤Ï¡¤README.tcltklib
+¤ä README.ActiveTcl ¤ò¸«¤Æ¤¯¤À¤µ¤¤¡¥
¤¿¤È¤¨ Ruby ¤Î¥é¥¤¥Ö¥é¥ê¥Ç¥£¥ì¥¯¥È¥ê¤Ë tcltklib.so ¤¬Â¸ºß¤·¤Æ¤¤¤¿¤È¤·¤Æ
¤â¡¤¼Â¹Ô´Ä¶­¤Ë Tcl/Tk ¥é¥¤¥Ö¥é¥ê (libtcl8.4.so ¤Ê¤É) ¤¬¤Ê¤±¤ì¤Ðµ¡Ç½¤·¤Þ
¤»¤ó¡¥Tcl/Tk ¤¬Àµ¤·¤¯¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¤«¤â¥Á¥§¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡¥
diff --git a/ext/tcltklib/README.ActiveTcl b/ext/tk/README.ActiveTcl
index 3afb3f4cf6..3afb3f4cf6 100644
--- a/ext/tcltklib/README.ActiveTcl
+++ b/ext/tk/README.ActiveTcl
diff --git a/ext/tk/README.macosx-aqua b/ext/tk/README.macosx-aqua
new file mode 100644
index 0000000000..25a8ed827c
--- /dev/null
+++ b/ext/tk/README.macosx-aqua
@@ -0,0 +1,67 @@
+
+ *** 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/tcltklib/README.1st b/ext/tk/README.tcltklib
index 5d1da48a45..8c6dd5178f 100644
--- a/ext/tcltklib/README.1st
+++ b/ext/tk/README.tcltklib
@@ -5,10 +5,14 @@ Tcl/Tk libraries or header files are installed but are not found, you can
give the information by arguments of the 'configure' script. Please give
some or all of the following options.
+ --with-tcltkversion=<version>
+ force version of Tcl/Tk libaray
+ (e.g. libtcl8.4g.so ==> --with-tcltkversion=8.4g)
+
--with-tcllib=<libname> (e.g. libtcl8.4.so ==> --with-tcllib=tcl8.4)
--with-tklib=<libname> (e.g. libtk8.4.so ==> --with-tklib=tk8.4)
- --enable-tcltk_stubs (if you force to enable stubs)
+ --enable-tcltk-stubs (if you force to enable stubs)
--with-tcl-dir=<path>
equal to "--with-tcl-include=<path>/include --with-tcl-lib=<path>/lib"
@@ -16,18 +20,18 @@ some or all of the following options.
--with-tk-dir=<path>
equal to "--with-tk-include=<path>/include --with-tk-lib=<path>/lib"
- --with-tcl-include=<dir> the directry containts 'tcl.h'
- --with-tk-include=<dir> the directry containts 'tk.h'
+ --with-tcl-include=<dir> the directry contains 'tcl.h'
+ --with-tk-include=<dir> the directry contains 'tk.h'
- --with-tcl-lib=<dir> the directry containts 'libtcl<version>.so'
- --with-tk-lib=<dir> the directry containts 'libtk<version>.so'
+ --with-tcl-lib=<dir> the directry contains 'libtcl<version>.so'
+ --with-tk-lib=<dir> the directry contains '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;
+ --with-tcltk-framework=<dir> the directory contains 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.
@@ -41,6 +45,15 @@ some or all of the following options.
(e.g. "/Library/Frameworks/Tk.framework/Headers")
+ --with-X11 / --without-X11 use / not use the X Window System
+
+ --with-X11-dir=<path>
+ equal to "--with-X11-include=<path>/include --with-X11-lib=<path>/lib"
+
+ --with-X11-include=<dir> the directry contais X11 header files
+ --with-X11-lib=<dir> the directry contais X11 libraries
+
+
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/depend b/ext/tk/depend
index fd63e230f0..2cd9c400f7 100644
--- a/ext/tk/depend
+++ b/ext/tk/depend
@@ -1 +1,2 @@
-tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+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/tk/extconf.rb b/ext/tk/extconf.rb
index 8b10353d1a..4807ea7b40 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -1,4 +1,412 @@
+# extconf.rb for tcltklib
+
require 'mkmf'
-$preload = ["tcltklib"]
-($INSTALLFILES||=[]) << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
-create_makefile("tkutil")
+
+#is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
+is_win32 = (/mswin|mingw|cygwin|bccwin|wince/ =~ 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
+
+tk_idir, tk_ldir = dir_config("tk")
+tcl_idir, tcl_ldir = dir_config("tcl")
+x11_idir, x11_ldir = dir_config("X11")
+
+tk_ldir2 = with_config("tk-lib")
+tcl_ldir2 = with_config("tcl-lib")
+x11_ldir2 = with_config("X11-lib")
+
+tk_ldir_list = [tk_ldir2, tk_ldir]
+tcl_ldir_list = [tcl_ldir2, tcl_ldir]
+
+tklib = with_config("tklib")
+tcllib = with_config("tcllib")
+stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
+
+tcltk_version = with_config("tcltkversion")
+
+use_X = with_config("X11", (! is_win32))
+
+def check_tcltk_version(version)
+ return [nil, nil] unless version
+
+ version = version.strip
+
+ tclver = version.dup
+ tkver = version.dup
+
+ major = dot = minor = dot = plvl = ext = nil
+
+ if version =~ /^(\d)(\.?)(\d)(\.?)(\d*)(.*)$/
+ major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6
+ dot = ! minor_dot.empty?
+ if plvl_dot.empty? && ! plvl.empty?
+ minor << plvl
+ end
+ elsif version =~ /^(\d)(\.?)(\d?)(.*)$/
+ major = $1; minor_dot = $2; minor = $3; ext = $4
+ dot = ! minor_dot.empty?
+ else # unknown -> believe user
+ return [tclver, tkver]
+ end
+
+ # check Tcl7.6 / Tk4.2 ?
+ if major == "7" # Tcl7.6 ( not support Tclversion < 7.6 )
+ # Tk4.2
+ tkver = "4" + ((dot)? ".": "") + ((minor.empty)? "": "2") + ext
+ elsif major == "4" # Tk4.2 ( not support Tkversion < 4.2 )
+ # Tcl7.6
+ tclver = "7" + ((dot)? ".": "") + ((minor.empty)? "": "6") + ext
+ end
+
+ [tclver, tkver]
+end
+
+def find_tcl(tcllib, stubs, version, *opt_paths)
+ default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ default_paths << "/Tcl/lib" # default for ActiveTcl
+
+ if (paths = opt_paths.compact).empty?
+ paths = default_paths
+ end
+
+ if stubs
+ func = "Tcl_InitStubs"
+ lib = "tclstub"
+ else
+ func = "Tcl_FindExecutable"
+ lib = "tcl"
+ end
+
+ if version && ! version.empty?
+ versions = [version]
+ else
+ versions = %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6]
+ end
+
+ if tcllib
+ st = find_library(tcllib, func, *paths)
+ else
+ st = versions.find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("#{lib}#{ver}g", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}g", func, *paths) or
+ find_library("tcl#{ver}", func, *paths) or
+ find_library("tcl#{ver.delete('.')}", func, *paths) or
+ find_library("tcl#{ver}g", func, *paths) or
+ find_library("tcl#{ver.delete('.')}g", func, *paths)
+ } || (!version && find_library(lib, func, *paths))
+ end
+
+ unless st
+ puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.")
+ end
+ st
+end
+
+def find_tk(tklib, stubs, version, *opt_paths)
+ default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ default_paths << "/Tcl/lib" # default for ActiveTcl
+
+ if (paths = opt_paths.compact).empty?
+ paths = default_paths
+ end
+
+ if stubs
+ func = "Tk_InitStubs"
+ lib = "tkstub"
+ else
+ func = "Tk_Init"
+ lib = "tk"
+ end
+
+ if version && ! version.empty?
+ versions = [version]
+ else
+ versions = %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2]
+ end
+
+ if tklib
+ st = find_library(tklib, func, *paths)
+ else
+ st = versions.find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("#{lib}#{ver}g", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}g", func, *paths) or
+ find_library("tk#{ver}", func, *paths) or
+ find_library("tk#{ver.delete('.')}", func, *paths) or
+ find_library("tk#{ver}g", func, *paths) or
+ find_library("tk#{ver.delete('.')}g", func, *paths)
+ } || (!version && find_library(lib, func, *paths))
+ end
+
+ unless st
+ puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.")
+ end
+ st
+end
+
+def find_X11(*opt_paths)
+ default_paths =
+ [ "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib" ]
+ paths = opt_paths.compact.concat(default_paths)
+ st = find_library("X11", "XOpenDisplay", *paths)
+ unless st
+ puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.")
+ end
+ st
+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
+
+tclver, tkver = check_tcltk_version(tcltk_version)
+
+if have_header("tcl.h") && have_header("tk.h") &&
+ ( tcltk_framework ||
+ ( ( !use_X || find_X11(x11_ldir2, x11_ldir) ) &&
+ find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) &&
+ find_tk(tklib, stubs, tkver, *tk_ldir_list) ) )
+ $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"]
+
+ have_func("rb_hash_lookup", "ruby.h")
+
+ # create
+ $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"]
+ $defs << %[-DRUBY_RELEASE_DATE=\\"#{RUBY_RELEASE_DATE}\\"]
+ create_makefile("tcltklib")
+ end
+end
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index d10e304a3d..ec718678f0 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -34,6 +34,64 @@ 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)
@@ -54,7 +112,16 @@ MultiTkIp_OK.freeze
################################################
# methods for construction
class MultiTkIp
- @@SLAVE_IP_ID = ['slave'.freeze, '0'.taint].freeze
+ BASE_DIR = File.dirname(__FILE__)
+
+ WITH_RUBY_VM = Object.const_defined?(:VM) && ::VM.class == Class
+ WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
+
+ (@@SLAVE_IP_ID = ['slave'.freeze, '0'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
@@IP_TABLE = {}.taint unless defined?(@@IP_TABLE)
@@ -63,15 +130,94 @@ class MultiTkIp
@@TK_TABLE_LIST = [].taint unless defined?(@@TK_TABLE_LIST)
- @@TK_CMD_TBL = {}.taint unless defined?(@@TK_CMD_TBL)
+ unless defined?(@@TK_CMD_TBL)
+ @@TK_CMD_TBL = Object.new.taint
+
+ # @@TK_CMD_TBL.instance_variable_set('@tbl', {}.taint)
+ @@TK_CMD_TBL.instance_variable_set('@tbl', Hash.new{|hash,key|
+ fail IndexError,
+ "unknown command ID '#{key}'"
+ }.taint)
+
+ class << @@TK_CMD_TBL
+ allow = [
+ '__send__', '__id__', 'freeze', 'inspect', 'kind_of?', 'object_id',
+ '[]', '[]=', 'delete', 'each', 'has_key?'
+ ]
+ instance_methods.each{|m| undef_method(m) unless allow.index(m.to_s)}
+
+ 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
######################################
- @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){|c|
+ @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){
def initialize(ip, cmd)
@ip = ip
@cmd = cmd
- freeze
+ self.freeze
end
attr_reader :ip, :cmd
def inspect
@@ -83,7 +229,9 @@ class MultiTkIp
backup_ip = current['callback_ip']
current['callback_ip'] = @ip
begin
- @ip.cb_eval(@cmd, *args)
+ ret = @ip.cb_eval(@cmd, *args)
+ fail ret if ret.kind_of?(Exception)
+ ret
rescue TkCallbackBreak, TkCallbackContinue => e
fail e
rescue SecurityError => e
@@ -100,6 +248,8 @@ class MultiTkIp
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)
@@ -434,7 +584,11 @@ class MultiTkIp
# raise exception
begin
bt = _toUTF8(e.backtrace.join("\n"))
- bt.instance_variable_set(:@encoding, 'utf-8')
+ if MultiTkIp::WITH_ENCODING
+ bt.force_encoding('utf-8')
+ else
+ bt.instance_variable_set(:@encoding, 'utf-8')
+ end
rescue Exception
bt = e.backtrace.join("\n")
end
@@ -528,6 +682,7 @@ class MultiTkIp
begin
loop do
sleep 1
+ receiver.kill if @interp.deleted?
break unless receiver.alive?
end
rescue Exception
@@ -555,6 +710,11 @@ class MultiTkIp
######################################
+ unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
+ ### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!!
+ RUN_EVENTLOOP_ON_MAIN_THREAD = false
+ end
+
if self.const_defined? :DEFAULT_MASTER_NAME
name = DEFAULT_MASTER_NAME.to_s
else
@@ -583,9 +743,45 @@ class MultiTkIp
fail ArgumentError, "expecting a Hash object for the 2nd argument"
end
- @interp = TclTkIp.new(name, _keys2opts(keys))
+ if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
+ @interp = TclTkIp.new(name, _keys2opts(keys))
+ else ### Ruby 1.9 !!!!!!!!!!!
+ @interp_thread = Thread.new{
+ current = Thread.current
+ current[:interp] = interp = TclTkIp.new(name, _keys2opts(keys))
+ #sleep
+ current[:mutex] = mutex = Mutex.new
+ current[:root_check] = cond_var = ConditionVariable.new
+
+ begin
+ current[:status] = interp.mainloop(true)
+ rescue Exception=>e
+ current[:status] = e
+ ensure
+ mutex.synchronize{ cond_var.broadcast }
+ end
+ current[:status] = interp.mainloop(false)
+ }
+ until @interp_thread[:interp]
+ Thread.pass
+ end
+ # INTERP_THREAD.run
+ @interp = @interp_thread[:interp]
+
+ def self.mainloop(check_root = true)
+ begin
+ TclTkLib.set_eventloop_window_mode(true)
+ @interp_thread.value
+ ensure
+ TclTkLib.set_eventloop_window_mode(false)
+ end
+ end
+ end
+
@ip_name = nil
+ @callback_status = [].taint
+
@system = Object.new
@wait_on_mainloop = [true, 0].taint
@@ -610,6 +806,49 @@ 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()
@@ -664,10 +903,44 @@ class MultiTkIp
#################################
+ @init_ip_env_queue = Queue.new
+ Thread.new{
+ current = Thread.current
+ loop {
+ mtx, cond, 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.synchronize{ cond.signal }
+ end
+ mtx = cond = ret = table = script = nil # clear variables for GC
+ }
+ }
+
+ def self.__init_ip_env__(table, script)
+ ret = []
+ mtx = (Thread.current[:MultiTk_ip_Mutex] ||= Mutex.new)
+ cond = (Thread.current[:MultiTk_ip_CondVar] ||= ConditionVariable.new)
+ mtx.synchronize{
+ @init_ip_env_queue.enq([mtx, cond, ret, table, script])
+ cond.wait(mtx)
+ }
+ 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
######################################
@@ -732,9 +1005,11 @@ class MultiTkIp
private :_parse_slaveopts
def _create_slave_ip_name
- name = @@SLAVE_IP_ID.join('')
- @@SLAVE_IP_ID[1].succ!
- name
+ @@SLAVE_IP_ID.mutex.synchronize{
+ name = @@SLAVE_IP_ID.join('')
+ @@SLAVE_IP_ID[1].succ!
+ name.freeze
+ }
end
private :_create_slave_ip_name
@@ -868,6 +1143,7 @@ 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)
@@ -876,6 +1152,8 @@ 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)
@@ -917,6 +1195,8 @@ 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)
@@ -929,6 +1209,8 @@ 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
@@ -974,6 +1256,8 @@ class MultiTkIp
@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)
safe = 4 if safe && !safe.kind_of?(Fixnum)
@@ -982,7 +1266,20 @@ class MultiTkIp
if safeip == nil
# create master-ip
- @interp = TclTkIp.new(name, _keys2opts(tk_opts))
+ unless WITH_RUBY_VM
+ @interp = TclTkIp.new(name, _keys2opts(tk_opts))
+ else ### Ruby 1.9 !!!!!!!!!!!
+ @interp_thread = Thread.new{
+ Thread.current[:interp] = interp = TclTkIp.new(name, _keys2opts(tk_opts))
+ #sleep
+ TclTkLib.mainloop(true)
+ }
+ until @interp_thread[:interp]
+ Thread.pass
+ end
+ # INTERP_THREAD.run
+ @interp = @interp_thread[:interp]
+ end
@ip_name = nil
if safe
@@ -997,6 +1294,8 @@ class MultiTkIp
@safe_base = true
@interp, @ip_name = master.__create_safe_slave_obj(safe_opts,
name, tk_opts)
+ # @interp_thread = nil if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!
+ @interp_thread = nil unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
if safe
safe = master.safe_level if safe < master.safe_level
@safe_level = [safe]
@@ -1005,6 +1304,8 @@ class MultiTkIp
end
else
@interp, @ip_name = master.__create_trusted_slave_obj(name, tk_opts)
+ # @interp_thread = nil if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!
+ @interp_thread = nil unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
if safe
safe = master.safe_level if safe < master.safe_level
@safe_level = [safe]
@@ -1024,6 +1325,8 @@ class MultiTkIp
@threadgroup = ThreadGroup.new
+ @pseudo_toplevel = [false, nil]
+
@cmd_queue = Queue.new
=begin
@@ -1037,11 +1340,11 @@ class MultiTkIp
@@DEFAULT_MASTER.assign_receiver_and_watchdog(self)
@@IP_TABLE[@threadgroup] = self
- _init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
@@TK_TABLE_LIST.size.times{
(tbl = {}).tainted? || tbl.taint
@tk_table_list << tbl
}
+ _init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
class << self
undef :instance_eval
@@ -1056,6 +1359,7 @@ class MultiTkIp
######################################
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)
@@ -1090,6 +1394,7 @@ class MultiTkIp
__getip._ip_id_
end
def _ip_id_
+ # for RemoteTkIp
''
end
@@ -1117,8 +1422,13 @@ class << MultiTkIp
alias __new new
private :__new
-
def new_master(safe=nil, keys={})
+ if MultiTkIp::WITH_RUBY_VM
+ #### TODO !!!!!!
+ fail RuntimeError,
+ 'sorry, still not support multiple master-interpreters on Ruby VM'
+ end
+
if safe.kind_of?(Hash)
keys = safe
elsif safe.kind_of?(Integer)
@@ -1192,19 +1502,21 @@ end
class MultiTkIp
def inspect
s = self.to_s.chop!
- if master?
- if @interp.deleted?
- s << ':deleted-master'
- else
- s << ':master'
- end
- else
- if @interp.deleted?
- s << ':deleted-slave'
- elsif @interp.safe?
- s << ':safe-slave'
+ if self.manipulable?
+ if master?
+ if @interp.deleted?
+ s << ':deleted-master'
+ else
+ s << ':master'
+ end
else
- s << ':trusted-slave'
+ if @interp.deleted?
+ s << ':deleted-slave'
+ elsif @interp.safe?
+ s << ':safe-slave'
+ else
+ s << ':trusted-slave'
+ end
end
end
s << '>'
@@ -1229,6 +1541,7 @@ 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?
@@ -1262,6 +1575,7 @@ 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]
@@ -1275,6 +1589,20 @@ 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
@@ -1302,7 +1630,7 @@ class MultiTkIp
end
def _init_ip_env(script)
- script.call(self)
+ self.eval_proc{script.call(self)}
end
def _add_tk_procs(name, args, body)
@@ -1313,8 +1641,25 @@ class MultiTkIp
}
end
+ def _remove_tk_procs(*names)
+ return if slave?
+ names.each{|name|
+ name = name.to_s
+
+ return if @interp.deleted?
+ @interp._invoke('rename', name, '')
+
+ return if @interp.deleted?
+ @interp._invoke('interp', 'slaves').split.each{|slave|
+ return if @interp.deleted?
+ @interp._invoke('interp', 'alias', slave, name, '') rescue nil
+ }
+ }
+ end
+
def _init_ip_internal(init_ip_env, add_tk_procs)
- init_ip_env.each{|script| script.call(self)}
+ #init_ip_env.each{|script| self.eval_proc{script.call(self)}}
+ init_ip_env.each{|script| self._init_ip_env(script)}
add_tk_procs.each{|name, args, body|
if master?
@interp._invoke('proc', name, args, body) if args && body
@@ -1338,17 +1683,34 @@ class MultiTkIp
__getip._tk_table_list[id]
end
def self.create_table
- #if __getip.slave?
- # raise SecurityError, "slave-IP has no permission creating a new table"
- #end
+ 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
+
id = @@TK_TABLE_LIST.size
obj = Object.new
@@TK_TABLE_LIST << obj
- obj.instance_eval <<-EOD
+ obj.instance_variable_set(:@id, id)
+ obj.instance_variable_set(:@mutex, Mutex.new)
+ obj.instance_eval{
+ def self.mutex
+ @mutex
+ end
def self.method_missing(m, *args)
- MultiTkIp.tk_object_table(#{id}).__send__(m, *args)
+ MultiTkIp.tk_object_table(@id).__send__(m, *args)
end
- EOD
+ }
obj.freeze
@@IP_TABLE.each{|tg, ip| ip._add_new_tables }
return obj
@@ -1356,15 +1718,48 @@ class MultiTkIp
def self.init_ip_env(script = Proc.new)
@@INIT_IP_ENV << script
- @@IP_TABLE.each{|tg, ip|
- ip._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)
end
def self.add_tk_procs(name, args=nil, body=nil)
- @@ADD_TK_PROCS << [name, args, body]
+ 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
+ }
+ }
@@IP_TABLE.each{|tg, ip|
- ip._add_tk_procs(name, args, body)
+ ip._remove_tk_procs(*names)
}
end
@@ -1383,6 +1778,7 @@ 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)) }
@@ -1395,14 +1791,112 @@ class MultiTkIp
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
@@ -1599,6 +2093,35 @@ class MultiTkIp
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)
+ 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
+ end
+
+ def bg_eval(*args, &blk)
+ 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
+ else
+ fail ArgumentError, "no argument to eval"
+ end
+ end
+ alias background_eval bg_eval
end
class << MultiTkIp
@@ -1608,7 +2131,39 @@ class << MultiTkIp
__getip.eval_proc(*args, &blk)
end
alias call eval_proc
- alias eval_string 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
end
@@ -1803,6 +2358,10 @@ 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
@@ -1870,6 +2429,12 @@ end
# depend on TclTkIp
class MultiTkIp
def mainloop(check_root = true, restart_on_dead = true)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+
+ if WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
+ return @interp_thread.value if @interp_thread
+ end
+
#return self if self.slave?
#return self if self != @@DEFAULT_MASTER
if self != @@DEFAULT_MASTER
@@ -1978,26 +2543,32 @@ class MultiTkIp
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
@@ -2060,19 +2631,23 @@ class MultiTkIp
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)
- if master?
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ if master? && !safe? && allow_ruby_exit?
if msg
Kernel.abort(msg)
else
@@ -2086,7 +2661,8 @@ class MultiTkIp
end
def exit(st = true)
- if master?
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ if master? && !safe? && allow_ruby_exit?
Kernel.exit(st)
else
delete
@@ -2095,6 +2671,7 @@ 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
@@ -2104,6 +2681,8 @@ 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
@@ -2115,102 +2694,135 @@ 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?
@interp._toUTF8(str, encoding)
end
def _fromUTF8(str, encoding=nil)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
@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
@@ -2231,9 +2843,10 @@ class MultiTkIp
i = -1
brace = 1
str.each_byte {|c|
+ c = c.chr
i += 1
- brace += 1 if c == ?{
- brace -= 1 if c == ?}
+ brace += 1 if c == '{'
+ brace -= 1 if c == '}'
break if brace == 0
}
if i == 0
@@ -2261,6 +2874,7 @@ 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)
@@ -2268,6 +2882,7 @@ 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
@@ -2277,6 +2892,7 @@ 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
@@ -2287,6 +2903,7 @@ 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 = '')
@@ -2294,6 +2911,7 @@ 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
@@ -2304,6 +2922,7 @@ 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
@@ -2312,6 +2931,7 @@ 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
@@ -2322,6 +2942,7 @@ 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
@@ -2335,6 +2956,7 @@ 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
@@ -2348,6 +2970,7 @@ 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 = '')
@@ -2355,6 +2978,7 @@ 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
@@ -2374,6 +2998,7 @@ 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
@@ -2395,6 +3020,7 @@ class MultiTkIp
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
@@ -2411,6 +3037,7 @@ class MultiTkIp
end
def mark_trusted(slave = '')
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._invoke('interp', 'marktrusted', _slavearg(slave))
self
end
@@ -2420,6 +3047,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
slave = cmd
@@ -2435,6 +3064,7 @@ 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 = '')
@@ -2442,6 +3072,7 @@ 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 = {})
@@ -2449,6 +3080,8 @@ 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))
@@ -2472,6 +3105,7 @@ 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
@@ -2480,6 +3114,7 @@ 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 = '')
@@ -2487,6 +3122,7 @@ 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
@@ -2496,6 +3132,7 @@ 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
@@ -2505,6 +3142,7 @@ 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
@@ -2514,6 +3152,7 @@ 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
@@ -2523,6 +3162,7 @@ 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
@@ -2532,6 +3172,7 @@ 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
@@ -2541,6 +3182,7 @@ 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)
@@ -2552,6 +3194,7 @@ 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)
@@ -2586,8 +3229,12 @@ 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
@@ -2598,8 +3245,12 @@ 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
@@ -2634,20 +3285,53 @@ end
# encoding convert
+class << MultiTkIp
+ def encoding_table
+ __getip.encoding_table
+ end
+end
class MultiTkIp
- def encoding
- @interp.encoding
+ def encoding_table
+ @interp.encoding_table
+ end
+
+ def force_default_encoding=(mode)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ @interp.force_default_encoding = mode
+ end
+ def force_default_encoding?
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ @interp.force_default_encoding?
+ end
+
+ def default_encoding=(enc)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ @interp.default_encoding = enc
end
+
def encoding=(enc)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp.encoding = enc
end
+ def encoding_name
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ @interp.encoding_name
+ end
+ def encoding_obj
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+ @interp.encoding_obj
+ end
+ alias encoding encoding_name
+ alias default_encoding encoding_name
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
@@ -2655,13 +3339,30 @@ end
# remove methods for security
+if MultiTkIp::WITH_RUBY_VM &&
+ ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
+ class MultiTkIp
+ INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
+ INTERP_MUTEX = INTERP_THREAD[:mutex]
+ INTERP_ROOT_CHECK = INTERP_THREAD[:root_check]
+ end
+ module TkCore
+ INTERP_THREAD = MultiTkIp::INTERP_THREAD
+ INTERP_MUTEX = MultiTkIp::INTERP_MUTEX
+ INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK
+ end
+ class MultiTkIp
+ remove_const(:INTERP_THREAD)
+ remove_const(:INTERP_MUTEX)
+ remove_const(:INTERP_ROOT_CHECK)
+ end
+end
+
class MultiTkIp
# undef_method :instance_eval
undef_method :instance_variable_get
undef_method :instance_variable_set
end
-
-
# end of MultiTkIp definition
# defend against modification
diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb
index 6e64a1ca2d..70115a60aa 100644
--- a/ext/tk/lib/remote-tk.rb
+++ b/ext/tk/lib/remote-tk.rb
@@ -66,6 +66,11 @@ class RemoteTkIp
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
@@ -127,11 +132,26 @@ 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,
@@ -150,6 +170,8 @@ 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
@@ -170,6 +192,8 @@ 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"
@@ -210,6 +234,8 @@ 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
@@ -222,6 +248,8 @@ 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
@@ -267,6 +295,8 @@ 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)
@@ -282,6 +312,8 @@ class RemoteTkIp
end
def has_mainwindow?
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
+
begin
inf = @interp._invoke_without_enc('info', 'command', '.')
rescue Exception
@@ -333,10 +365,12 @@ class RemoteTkIp
end
def _toUTF8(str, encoding=nil)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._toUTF8(str, encoding)
end
def _fromUTF8(str, encoding=nil)
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._fromUTF8(str, encoding)
end
@@ -349,6 +383,7 @@ class RemoteTkIp
end
def _return_value
+ raise SecurityError, "no permission to manipulate" unless self.manipulable?
@interp._return_value
end
@@ -401,14 +436,17 @@ class RemoteTkIp
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
diff --git a/ext/tcltklib/lib/tcltk.rb b/ext/tk/lib/tcltk.rb
index 1a6694dbff..7f6f41605d 100644
--- a/ext/tcltklib/lib/tcltk.rb
+++ b/ext/tk/lib/tcltk.rb
@@ -265,7 +265,7 @@ class TclTkWidget < TclTkCommand
# (used in TclTkInterpreter#initialize())
# need two arguments
- fail("illegal # of parameter") if args.size != 2
+ fail("invalid # of parameter") if args.size != 2
# ip: interpreter(TclTkIp)
# exp: tcl/tk representation
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index c3e92f4097..c5d5b804d2 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1,6 +1,5 @@
#
# tk.rb - Tk interface module using tcltklib
-# $Date$
# by Yukihiro Matsumoto <matz@netlab.jp>
# use Shigehiro's tcltklib
@@ -10,12 +9,16 @@ require 'tkutil'
# autoload
require 'tk/autoload'
+# for Mutex
+require 'thread'
+
class TclTkIp
# backup original (without encoding) _eval and _invoke
alias _eval_without_enc _eval
alias _invoke_without_enc _invoke
def _ip_id_
+ # for RemoteTkIp
''
end
end
@@ -36,7 +39,12 @@ module TkComm
#Tk_CMDTBL = {}
#Tk_WINDOWS = {}
- Tk_IDs = ["00000".taint, "00000".taint].freeze # [0]-cmdid, [1]-winid
+ Tk_IDs = ["00000".taint, "00000".taint] # [0]-cmdid, [1]-winid
+ Tk_IDs.instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
# for backward compatibility
Tk_CMDTBL = Object.new
@@ -189,6 +197,7 @@ 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]
@@ -199,21 +208,27 @@ 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 /^@font/
+ when /\A@font\S+\z/
TkFont.get_obj(val)
- when /^-?\d+$/
+ when /\A-?\d+\z/
val.to_i
- when /^\./
+ when /\A\.\S*\z/
#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 /^i(_\d+_)?\d+$/
- TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
- when /^-?\d+\.?\d*(e[-+]?\d+)?$/
+ when /\Ai(_\d+_)?\d+\z/
+ TkImage::Tk_IMGTBL.mutex.synchronize{
+ TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
+ }
+ when /\A-?\d+\.?\d*(e[-+]?\d+)?\z/
val.to_f
when /\\ /
val.gsub(/\\ /, ' ')
@@ -329,6 +344,8 @@ if USE_TCLs_LIST_FUNCTIONS
if dst_enc != true && dst_enc != false
if (s_enc = s.instance_variable_get(:@encoding))
s_enc = s_enc.to_s
+ elsif TkCore::WITH_ENCODING
+ s_enc = s.encoding.name
else
s_enc = sys_enc
end
@@ -341,11 +358,20 @@ if USE_TCLs_LIST_FUNCTIONS
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')
+ if TkCore::WITH_ENCODING
+ if dst_enc.kind_of?(String)
+ ret = _fromUTF8(ret, dst_enc)
+ ret.force_encoding(dst_enc)
+ else
+ ret.force_encoding('utf-8')
+ end
+ else # without encoding
+ 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
end
ret
else
@@ -405,46 +431,6 @@ else
tk_split_sublist(token, depth - 1)
}
end
-=begin
- def tk_split_list(str)
- return [] if str == ""
- idx = str.index('{')
- while idx and idx > 0 and str[idx-1] == ?\\
- idx = str.index('{', idx+1)
- end
- unless idx
- list = tk_tcl2ruby(str)
- unless Array === list
- list = [list]
- end
- return list
- end
-
- list = tk_tcl2ruby(str[0,idx])
- list = [] if list == ""
- str = str[idx+1..-1]
- i = -1
- escape = false
- brace = 1
- str.each_byte {|c|
- i += 1
- brace += 1 if c == ?{ && !escape
- brace -= 1 if c == ?} && !escape
- escape = (c == ?\\)
- break if brace == 0
- }
- if str.size == i + 1
- return tk_split_list(str[0, i])
- end
- if str[0, i] == ' '
- list.push ' '
- else
- list.push tk_split_list(str[0, i])
- end
- list += tk_split_list(str[i+1..-1])
- list
- end
-=end
def tk_split_simplelist(str, src_enc=true, dst_enc=true)
return [] if str == ""
@@ -595,16 +581,22 @@ end
end
def image_obj(val)
if val =~ /^i(_\d+_)?\d+$/
- TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
+ TkImage::Tk_IMGTBL.mutex.synchronize{
+ TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
+ }
else
val
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
@@ -773,16 +765,25 @@ end
id = "c" + TkCore::INTERP._ip_id_ + TkComm::Tk_IDs[0]
end
def _next_cmd_id
- id = _curr_cmd_id
- #Tk_IDs[0] += 1
- TkComm::Tk_IDs[0].succ!
- id
+ TkComm::Tk_IDs.mutex.synchronize{
+ id = _curr_cmd_id
+ #Tk_IDs[0] += 1
+ TkComm::Tk_IDs[0].succ!
+ id
+ }
end
private :_curr_cmd_id, :_next_cmd_id
module_function :_curr_cmd_id, :_next_cmd_id
- def install_cmd(cmd)
+ def TkComm.install_cmd(cmd, local_cmdtbl=nil)
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)
@@ -793,16 +794,46 @@ end
@cmdtbl = [] unless defined? @cmdtbl
@cmdtbl.taint unless @cmdtbl.tainted?
@cmdtbl.push id
+
+ if local_cmdtbl && local_cmdtbl.kind_of?(Array)
+ begin
+ local_cmdtbl << id
+ rescue Exception
+ # ignore
+ end
+ end
+
#return Kernel.format("rb_out %s", id);
- return 'rb_out' + TkCore::INTERP._ip_id_ + ' ' + id
+ if ns
+ 'rb_out' << TkCore::INTERP._ip_id_ << ' ' << ns << ' ' << id
+ else
+ 'rb_out' << TkCore::INTERP._ip_id_ << ' ' << id
+ end
end
- def uninstall_cmd(id)
- id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
+ def TkComm.uninstall_cmd(id, local_cmdtbl=nil)
+ #id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
+ id = $4 if id =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
+
+ if local_cmdtbl && local_cmdtbl.kind_of?(Array)
+ begin
+ local_cmdtbl.delete(id)
+ rescue Exception
+ # ignore
+ end
+ end
+ @cmdtbl.delete(id)
+
#Tk_CMDTBL.delete(id)
TkCore::INTERP.tk_cmd_tbl.delete(id)
end
# private :install_cmd, :uninstall_cmd
- module_function :install_cmd, :uninstall_cmd
+ # module_function :install_cmd, :uninstall_cmd
+ def install_cmd(cmd)
+ TkComm.install_cmd(cmd, @cmdtbl)
+ end
+ def uninstall_cmd(id)
+ TkComm.uninstall_cmd(id, @cmdtbl)
+ end
=begin
def install_win(ppath,name=nil)
@@ -834,8 +865,10 @@ end
return TkCore::INTERP.tk_windows[@path] = self
end
else
- name = "w" + TkCore::INTERP._ip_id_ + Tk_IDs[1]
- Tk_IDs[1].succ!
+ Tk_IDs.mutex.synchronize{
+ name = "w" + TkCore::INTERP._ip_id_ + Tk_IDs[1]
+ Tk_IDs[1].succ!
+ }
end
if !ppath or ppath == '.'
@path = '.' + name
@@ -914,10 +947,19 @@ module TkComm
def _bindinfo(what, context=nil)
if context
- tk_call_without_enc(*what+["<#{tk_event_sequence(context)}>"]) .collect {|cmdline|
+ if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
+ enum_obj = tk_call_without_enc(*what+["<#{tk_event_sequence(context)}>"]).each_line
+ else
+ enum_obj = tk_call_without_enc(*what+["<#{tk_event_sequence(context)}>"])
+ end
+ enum_obj.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
@@ -1056,6 +1098,14 @@ module TkCore
include TkComm
extend TkComm
+ WITH_RUBY_VM = Object.const_defined?(:VM) && ::VM.class == Class
+ WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
+
+ unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
+ ### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!!
+ RUN_EVENTLOOP_ON_MAIN_THREAD = false
+ end
+
unless self.const_defined? :INTERP
if self.const_defined? :IP_NAME
name = IP_NAME.to_s
@@ -1073,14 +1123,56 @@ module TkCore
opts = ''
end
- INTERP = TclTkIp.new(name, opts)
+ if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
+ INTERP = TclTkIp.new(name, opts)
+ else
+ INTERP_MUTEX = Mutex.new
+ INTERP_ROOT_CHECK = ConditionVariable.new
+ INTERP_THREAD = Thread.new{
+ begin
+ Thread.current[:interp] = interp = TclTkIp.new(name, opts)
+ rescue => e
+ Thread.current[:interp] = e
+ raise e
+ end
+ Thread.current[:status] = nil
+ #sleep
+
+ begin
+ Thread.current[:status] = TclTkLib.mainloop(true)
+ rescue Exception=>e
+ Thread.current[:status] = e
+ ensure
+ INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast }
+ end
+ Thread.current[:status] = TclTkLib.mainloop(false)
+ }
+
+ until INTERP_THREAD[:interp]
+ Thread.pass
+ end
+ # INTERP_THREAD.run
+ raise INTERP_THREAD[:interp] if INTERP_THREAD[:interp].kind_of? Exception
+
+ INTERP = INTERP_THREAD[:interp]
+ end
def INTERP.__getip
self
end
INTERP.instance_eval{
- @tk_cmd_tbl = {}.taint
+ # @tk_cmd_tbl = {}.taint
+ @tk_cmd_tbl = Hash.new{|hash, key|
+ fail IndexError, "unknown command ID '#{key}'"
+ }.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
@@ -1088,8 +1180,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){|c|
- class << c
+ @cb_entry_class = Class.new(TkCallbackEntry){
+ class << self
def inspect
sprintf("#<Class(TkCallbackEntry):%0x>", self.__id__)
end
@@ -1124,6 +1216,10 @@ module TkCore
class Tk_OBJECT_TABLE
def initialize(id)
@id = id
+ @mutex = Mutex.new
+ end
+ def mutex
+ @mutex
end
def method_missing(m, *args, &b)
TkCore::INTERP.tk_object_table(@id).__send__(m, *args, &b)
@@ -1159,8 +1255,22 @@ module TkCore
script.call(self)
end
def INTERP.add_tk_procs(name, args = nil, body = nil)
- @add_tk_procs << [name, args, body]
- self._invoke('proc', name, args, body) if args && body
+ 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, '')
+ }
end
def INTERP.init_ip_internal
ip = self
@@ -1188,8 +1298,30 @@ module TkCore
}) << ' %W')
INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '',
- "bind all <#{WIDGET_DESTROY_HOOK}> {}")
+ "catch { 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
@@ -1206,6 +1338,7 @@ module TkCore
return $ret
}
EOL
+=end
=begin
INTERP.add_tk_procs('rb_out', 'args', <<-'EOL')
#regsub -all {\\} $args {\\\\} args
@@ -1229,6 +1362,8 @@ module TkCore
EOL
=end
+ at_exit{ INTERP.remove_tk_procs(TclTkLib::FINALIZE_PROC_NAME) }
+
EventFlag = TclTkLib::EventFlag
def callback_break
@@ -1239,6 +1374,10 @@ 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)
@@ -1266,7 +1405,11 @@ module TkCore
"\n---< backtrace of Ruby side >-----\n" +
_toUTF8(e.backtrace.join("\n")) +
"\n---< backtrace of Tk side >-------"
- msg.instance_variable_set(:@encoding, 'utf-8')
+ if TkCore::WITH_ENCODING
+ msg.force_encoding('utf-8')
+ else
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ end
rescue Exception
msg = e.class.inspect + ': ' + e.message + "\n" +
"\n---< backtrace of Ruby side >-----\n" +
@@ -1322,6 +1465,13 @@ module TkCore
end
def after(ms, cmd=Proc.new)
+ cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
+ after_id = tk_call_without_enc("after",ms,cmdid)
+ after_id.instance_variable_set('@cmdid', cmdid)
+ after_id
+ end
+=begin
+ def after(ms, cmd=Proc.new)
crit_bup = Thread.critical
Thread.critical = true
@@ -1344,8 +1494,16 @@ module TkCore
# tk_call("after",ms,cmdid)
# end
end
+=end
def after_idle(cmd=Proc.new)
+ cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
+ after_id = tk_call_without_enc('after','idle',cmdid)
+ after_id.instance_variable_set('@cmdid', cmdid)
+ after_id
+ end
+=begin
+ def after_idle(cmd=Proc.new)
crit_bup = Thread.critical
Thread.critical = true
@@ -1356,9 +1514,15 @@ module TkCore
tk_call_without_enc('after','idle',cmdid)
end
+=end
def after_cancel(afterId)
tk_call_without_enc('after','cancel',afterId)
+ if (cmdid = afterId.instance_variable_get('@cmdid'))
+ afterId.instance_variable_set('@cmdid', nil)
+ uninstall_cmd(cmdid)
+ end
+ afterId
end
def windowingsystem
@@ -1478,7 +1642,27 @@ module TkCore
end
def mainloop(check_root = true)
- TclTkLib.mainloop(check_root)
+ if !TkCore::WITH_RUBY_VM || TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
+ TclTkLib.mainloop(check_root)
+ else ### Ruby 1.9 !!!!!
+ begin
+ TclTkLib.set_eventloop_window_mode(true)
+ if check_root
+ INTERP_MUTEX.synchronize{
+ INTERP_ROOT_CHECK.wait(INTERP_MUTEX)
+ status = INTERP_THREAD[:status]
+ if status
+ INTERP_THREAD[:status] = nil
+ raise status if status.kind_of?(Exception)
+ end
+ }
+ else
+ INTERP_THREAD.value
+ end
+ ensure
+ TclTkLib.set_eventloop_window_mode(false)
+ end
+ end
end
def mainloop_thread?
@@ -1486,7 +1670,12 @@ module TkCore
# 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?
+ if !TkCore::WITH_RUBY_VM || TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD
+ ### Ruby 1.9 !!!!!!!!!!!
+ TclTkLib.mainloop_thread?
+ else
+ Thread.current == INTERP_THREAD
+ end
end
def mainloop_exist?
@@ -1838,7 +2027,7 @@ module Tk
end
def root
- TkRoot.new
+ Tk::Root.new
end
def Tk.load_tclscript(file, enc=nil)
@@ -1865,6 +2054,62 @@ 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')
@@ -1898,6 +2143,27 @@ module Tk
tk_call_without_enc('destroy', '.')
end
+ ################################################
+
+ def Tk.sleep(ms = nil, id = nil)
+ if id
+ var = (id.kind_of?(TkVariable))? id: TkVarAccess.new(id.to_s)
+ else
+ var = TkVariable.new
+ end
+
+ var.value = tk_call_without_enc('after', ms, proc{ var.value = 0 }) if ms
+ var.thread_wait
+ ms
+ end
+
+ def Tk.wakeup(id)
+ ((id.kind_of?(TkVariable))? id: TkVarAccess.new(id.to_s)).value = 0
+ nil
+ end
+
+ ################################################
+
def Tk.pack(*args)
TkPack.configure(*args)
end
@@ -2073,16 +2339,432 @@ end
# convert kanji string to/from utf-8
###########################################
if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
+ module Tk
+ module Encoding
+ extend Encoding
+
+ TkCommandNames = ['encoding'.freeze].freeze
+
+ #############################################
+
+ if TkCore::WITH_ENCODING ### Ruby 1.9
+ RubyEncoding = ::Encoding
+
+ # for saving GC cost
+ #ENCNAMES_CMD = ['encoding'.freeze, 'names'.freeze]
+ BINARY_NAME = 'binary'.freeze
+ UTF8_NAME = 'utf-8'.freeze
+ DEFAULT_EXTERNAL_NAME = RubyEncoding.default_external.name.freeze
+
+ BINARY = RubyEncoding.find(BINARY_NAME)
+ UNKNOWN = RubyEncoding.find('ASCII-8BIT')
+
+ ### start of creating ENCODING_TABLE
+ ENCODING_TABLE = TkCore::INTERP.encoding_table
+=begin
+ ENCODING_TABLE = {
+ 'binary' => BINARY,
+ # 'UNKNOWN-8BIT' => UNKNOWN,
+ }
+
+ list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0],
+ ENCNAMES_CMD[1])
+ TkCore::INTERP._split_tklist(list).each{|name|
+ begin
+ enc = RubyEncoding.find(name)
+ rescue ArgumentError
+ case name
+ when 'identity'
+ enc = BINARY
+ when 'shiftjis'
+ enc = RubyEncoding.find('Shift_JIS')
+ when 'unicode'
+ enc = RubyEncoding.find('UTF-8')
+ #if Tk.tk_call('set', 'tcl_platform(byteOrder)') =='littleEndian'
+ # enc = RubyEncoding.find('UTF-16LE')
+ #else
+ # enc = RubyEncoding.find('UTF-16BE')
+ #end
+ when 'symbol'
+ # single byte data
+ enc = RubyEncoding.find('ASCII-8BIT') ### ???
+ else
+ # unsupported on Ruby, but supported on Tk
+ enc = TkCore::INTERP.create_dummy_encoding_for_tk(name)
+ end
+ end
+ ENCODING_TABLE[name.freeze] = enc
+ }
+=end
+=begin
+ def ENCODING_TABLE.get_name(enc)
+ orig_enc = enc
+
+ # unles enc, use system default
+ # 1st: Ruby/Tk default encoding
+ # 2nd: Tcl/Tk default encoding
+ # 3rd: Ruby's default_external
+ enc ||= TkCore::INTERP.encoding
+ enc ||= TclTkLib.encoding_system
+ enc ||= DEFAULT_EXTERNAL_NAME
+
+ if enc.kind_of?(RubyEncoding)
+ # Ruby's Encoding object
+ if (name = self.key(enc))
+ return name
+ end
+
+ # Is it new ?
+ list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0],
+ ENCNAMES_CMD[1])
+ TkComm.simplelist(list).each{|name|
+ if ((enc == RubyEncoding.find(name)) rescue false)
+ # new relation!! update table
+ self[name.freeze] = enc
+ return name
+ end
+ }
+ else
+ # String or Symbol ?
+ if self[name = enc.to_s]
+ return name
+ end
+
+ # Is it new ?
+ if (enc_obj = (RubyEncoding.find(name) rescue false))
+ list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0],
+ ENCNAMES_CMD[1])
+ if TkComm.simplelist(list).index(name)
+ # Tk's encoding name ?
+ self[name.freeze] = enc_obj # new relation!! update table
+ return name
+ else
+ # Ruby's encoding name ?
+ if (name = self.key(enc_obj))
+ return name
+ end
+ end
+ end
+ end
+
+ fail ArgumentError, "unsupported Tk encoding '#{orig_enc}'"
+ end
+
+ def ENCODING_TABLE.get_obj(enc)
+ # returns the encoding object.
+ # If 'enc' is the encoding name on Tk only, it returns nil.
+ ((obj = self[self.get_name(enc)]).kind_of?(RubyEncoding))? obj: nil
+ end
+=end
+ ### end of creating ENCODING_TABLE
+
+ end
+
+ #############################################
+
+ if TkCore::WITH_ENCODING
+ ################################
+ ### Ruby 1.9
+ ################################
+ def force_default_encoding(mode)
+ TkCore::INTERP.force_default_encoding = mode
+ end
+
+ def force_default_encoding?
+ TkCore::INTERP.force_default_encoding?
+ end
+
+ def default_encoding=(enc)
+ TkCore::INTERP.default_encoding = Tk::Encoding::ENCODING_TABLE.get_name(enc)
+ end
+
+ def encoding=(enc)
+ TkCore::INTERP.encoding = Tk::Encoding::ENCODING_TABLE.get_name(enc)
+ end
+
+ def encoding_name
+ Tk::Encoding::ENCODING_TABLE.get_name(TkCore::INTERP.encoding)
+ end
+ def encoding_obj
+ Tk::Encoding::ENCODING_TABLE.get_obj(TkCore::INTERP.encoding)
+ end
+ alias encoding encoding_name
+ alias default_encoding encoding_name
+
+ def tk_encoding_names
+ TkComm.simplelist(TkCore::INTERP._invoke_without_enc(Tk::Encoding::ENCNAMES_CMD[0], Tk::Encoding::ENCNAMES_CMD[1]))
+ end
+ def encoding_names
+ self.tk_encoding_names.find_all{|name|
+ Tk::Encoding::ENCODING_TABLE.get_name(name) rescue false
+ }
+ end
+ def encoding_objs
+ self.tk_encoding_names.map!{|name|
+ Tk::Encoding::ENCODING_TABLE.get_obj(name) rescue nil
+ }.compact
+ end
+
+ def encoding_system=(enc)
+ TclTkLib.encoding_system = Tk::Encoding::ENCODING_TABLE.get_name(enc)
+ end
+
+ def encoding_system_name
+ Tk::Encoding::ENCODING_TABLE.get_name(TclTkLib.encoding_system)
+ end
+ def encoding_system_obj
+ Tk::Encoding::ENCODING_TABLE.get_obj(TclTkLib.encoding_system)
+ end
+ alias encoding_system encoding_system_name
+
+ ################################
+ else
+ ################################
+ ### Ruby 1.8-
+ ################################
+ def force_default_encoding=(mode)
+ true
+ end
+
+ def force_default_encoding?
+ true
+ end
+
+ def default_encoding=(enc)
+ TkCore::INTERP.default_encoding = enc
+ end
+
+ def encoding=(enc)
+ TkCore::INTERP.encoding = enc
+ end
+
+ def encoding_obj
+ TkCore::INTERP.encoding
+ end
+ def encoding_name
+ TkCore::INTERP.encoding
+ end
+ alias encoding encoding_name
+ alias default_encoding encoding_name
+
+ def tk_encoding_names
+ TkComm.simplelist(Tk.tk_call('encoding', 'names'))
+ end
+ def encoding_objs
+ self.tk_encoding_names
+ end
+ def encoding_names
+ self.tk_encoding_names
+ end
+
+ def encoding_system=(enc)
+ TclTkLib.encoding_system = enc
+ end
+
+ def encoding_system_name
+ TclTkLib.encoding_system
+ end
+ def encoding_system_obj
+ TclTkLib.encoding_system
+ end
+ alias encoding_system encoding_system_name
+
+ ################################
+ end
+
+ def encoding_convertfrom(str, enc=nil)
+ enc = encoding_system_name unless enc
+ str = str.dup
+ if TkCore::WITH_ENCODING
+ if str.kind_of?(Tk::EncodedString)
+ str.__instance_variable_set('@encoding', nil)
+ else
+ str.instance_variable_set('@encoding', nil)
+ end
+ str.force_encoding('binary')
+ else
+ str.instance_variable_set('@encoding', 'binary')
+ end
+ ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertfrom',
+ enc, str)
+ if TkCore::WITH_ENCODING
+ ret.force_encoding('utf-8')
+ else
+ Tk::UTF8_String.new(ret)
+ end
+ ret
+ end
+ alias encoding_convert_from encoding_convertfrom
+
+ def encoding_convertto(str, enc=nil)
+ # str must be a UTF-8 string
+ enc = encoding_system_name unless enc
+ ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertto',
+ enc, str)
+ #ret.instance_variable_set('@encoding', 'binary')
+ if TkCore::WITH_ENCODING
+ #ret.force_encoding(Tk::Encoding::ENCODING_TABLE.get_obj('binary'))
+ ret.force_encoding(Tk::Encoding::ENCODING_TABLE.get_obj(enc))
+ end
+ ret
+ 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
+ end
+
class TclTkIp
+ def force_default_encoding=(mode)
+ @force_default_encoding = (mode)? true: false
+ end
+
+ def force_default_encoding?
+ @force_default_encoding ||= false
+ end
+
+ def default_encoding=(name)
+ name = name.name if name.kind_of?(::Encoding) if Tk::WITH_ENCODING
+ @encoding = name
+ end
+
# from tkencoding.rb by ttate@jaist.ac.jp
- attr_accessor :encoding
+ #attr_accessor :encoding
+ def encoding=(name)
+ self.force_default_encoding = true # for comaptibility
+ self.default_encoding = name
+ end
- alias __eval _eval
- alias __invoke _invoke
+ def encoding_name
+ (@encoding)? @encoding.dup: nil
+ end
+ alias encoding encoding_name
+ alias default_encoding encoding_name
+
+ def encoding_obj
+ if Tk::WITH_ENCODING
+ Tk::Encoding.tcl2rb_encoding(@encoding)
+ else
+ (@encoding)? @encoding.dup: nil
+ end
+ end
alias __toUTF8 _toUTF8
alias __fromUTF8 _fromUTF8
+ if Object.const_defined?(:Encoding) && ::Encoding.class == Class
+ # with Encoding (Ruby 1.9+)
+ #
+ # use functions on Tcl as default.
+ # but when unsupported encoding on Tcl, use methods on Ruby.
+ #
+ def _toUTF8(str, enc = nil)
+ if enc
+ # use given encoding
+ begin
+ enc_name = Tk::Encoding::ENCODING_TABLE.get_name(enc)
+ rescue
+ # unknown encoding for Tk -> try to convert encoding on Ruby
+ str = str.dup.force_encoding(enc)
+ str.encode!(Tk::Encoding::UTF8_NAME) # modify self !!
+ return str # if no error, probably succeed converting
+ end
+ end
+
+ enc_name ||= str.instance_variable_get(:@encoding)
+
+ enc_name ||=
+ Tk::Encoding::ENCODING_TABLE.get_name(str.encoding) rescue nil
+
+ unless enc_name
+ # str.encoding isn't supported by Tk -> try to convert on Ruby
+ begin
+ return str.encode(Tk::Encoding::UTF8_NAME) # new string
+ rescue
+ # error -> ignore, try to use default encoding of Ruby/Tk
+ end
+ end
+
+ #enc_name ||=
+ # Tk::Encoding::ENCODING_TABLE.get_name(Tk.encoding) rescue nil
+ enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(nil)
+
+ # is 'binary' encoding?
+ if enc_name == Tk::Encoding::BINARY_NAME
+ return str.dup.force_encoding(Tk::Encoding::BINARY_NAME)
+ end
+
+ # force default encoding?
+ if ! str.kind_of?(Tk::EncodedString) && self.force_default_encoding?
+ enc_name = Tk::Encoding::ENCODING_TABLE.get_name(Tk.default_encoding)
+ end
+
+ encstr = __toUTF8(str, enc_name)
+ encstr.force_encoding(Tk::Encoding::UTF8_NAME)
+ encstr
+ end
+ def _fromUTF8(str, enc = nil)
+ # str must be UTF-8 or binary.
+ enc_name = str.instance_variable_get(:@encoding)
+ enc_name ||=
+ Tk::Encoding::ENCODING_TABLE.get_name(str.encoding) rescue nil
+
+ # is 'binary' encoding?
+ if enc_name == Tk::Encoding::BINARY_NAME
+ return str.dup.force_encoding(Tk::Encoding::BINARY_NAME)
+ end
+
+ # get target encoding name (if enc == nil, use default encoding)
+ begin
+ enc_name = Tk::Encoding::ENCODING_TABLE.get_name(enc)
+ rescue
+ # then, enc != nil
+ # unknown encoding for Tk -> try to convert encoding on Ruby
+ str = str.dup.force_encoding(Tk::Encoding::UTF8_NAME)
+ str.encode!(enc) # modify self !!
+ return str # if no error, probably succeed converting
+ end
+
+ encstr = __fromUTF8(str, enc_name)
+ encstr.force_encoding(Tk::Encoding::ENCODING_TABLE.get_obj(enc_name))
+ encstr
+ end
+ ###
+ else
+ # without Encoding (Ruby 1.8)
+ def _toUTF8(str, encoding = nil)
+ __toUTF8(str, encoding)
+ end
+ def _fromUTF8(str, encoding = nil)
+ __fromUTF8(str, encoding)
+ end
+ ###
+ end
+
+ alias __eval _eval
+ alias __invoke _invoke
+
+ def _eval(cmd)
+ _fromUTF8(__eval(_toUTF8(cmd)))
+ end
+
+ def _invoke(*cmds)
+ _fromUTF8(__invoke(*(cmds.collect{|cmd| _toUTF8(cmd)})))
+ end
+
+ alias _eval_with_enc _eval
+ alias _invoke_with_enc _invoke
+
=begin
#### --> definition is moved to TclTkIp module
@@ -2132,17 +2814,6 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
end
=end
- def _eval(cmd)
- _fromUTF8(__eval(_toUTF8(cmd)))
- end
-
- def _invoke(*cmds)
- _fromUTF8(__invoke(*(cmds.collect{|cmd| _toUTF8(cmd)})))
- end
-
- alias _eval_with_enc _eval
- alias _invoke_with_enc _invoke
-
=begin
def _eval(cmd)
if defined?(@encoding) && @encoding != 'utf-8'
@@ -2198,114 +2869,215 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
end
module TclTkLib
- def self.encoding=(name)
- TkCore::INTERP.encoding = name
- end
- def self.encoding
- TkCore::INTERP.encoding
- end
- end
+ class << self
+ def force_default_encoding=(mode)
+ TkCore::INTERP.force_default_encoding = mode
+ end
- module Tk
- module Encoding
- extend Encoding
+ def force_default_encoding?
+ TkCore::INTERP.force_default_encoding?
+ end
- TkCommandNames = ['encoding'.freeze].freeze
+ def default_encoding=(name)
+ TkCore::INTERP.default_encoding = name
+ end
+ alias _encoding encoding
+ alias _encoding= encoding=
def encoding=(name)
+ name = name.name if name.kind_of?(::Encoding) if Tk::WITH_ENCODING
TkCore::INTERP.encoding = name
end
- def encoding
+ def encoding_name
TkCore::INTERP.encoding
end
+ alias encoding encoding_name
+ alias default_encoding encoding_name
- def encoding_names
- tk_split_simplelist(tk_call('encoding', 'names'))
+ def encoding_obj
+ if Tk::WITH_ENCODING
+ Tk::Encoding.tcl2rb_encoding(TkCore::INTERP.encoding)
+ else
+ TkCore::INTERP.encoding
+ end
end
+ end
+ end
- def encoding_system
- tk_call('encoding', 'system')
+ # estimate encoding
+ unless TkCore::WITH_ENCODING
+ case $KCODE
+ when /^e/i # EUC
+ Tk.encoding = 'euc-jp'
+ Tk.encoding_system = 'euc-jp'
+ when /^s/i # SJIS
+ begin
+ if Tk.encoding_system == 'cp932'
+ Tk.encoding = 'cp932'
+ else
+ Tk.encoding = 'shiftjis'
+ Tk.encoding_system = 'shiftjis'
+ end
+ rescue StandardError, NameError
+ Tk.encoding = 'shiftjis'
+ Tk.encoding_system = 'shiftjis'
end
-
- def encoding_system=(enc)
- tk_call('encoding', 'system', enc)
+ when /^u/i # UTF8
+ Tk.encoding = 'utf-8'
+ Tk.encoding_system = 'utf-8'
+ else # NONE
+ if defined? DEFAULT_TK_ENCODING
+ Tk.encoding_system = DEFAULT_TK_ENCODING
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).
- # 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
+ begin
+ Tk.encoding = Tk.encoding_system
+ rescue StandardError, NameError
+ Tk.encoding = 'utf-8'
+ Tk.encoding_system = 'utf-8'
end
- alias encoding_convert_from encoding_convertfrom
+ end
- def encoding_convertto(str, enc=nil)
- # str must be a UTF-8 string.
- # 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
+ else ### Ruby 1.9 !!!!!!!!!!!!
+ loc_enc_obj = ::Encoding.find(::Encoding.locale_charmap)
+ ext_enc_obj = ::Encoding.default_external
+ tksys_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(Tk.encoding_system)
+ # p [Tk.encoding, Tk.encoding_system, loc_enc_obj, ext_enc_obj]
+
+=begin
+ if ext_enc_obj == Tk::Encoding::UNKNOWN
+ if defind? DEFAULT_TK_ENCODING
+ if DEFAULT_TK_ENCODING.kind_of?(::Encoding)
+ tk_enc_name = DEFAULT_TK_ENCODING.name
+ tksys_enc_name = DEFAULT_TK_ENCODING.name
+ else
+ tk_enc_name = DEFAULT_TK_ENCODING
+ tksys_enc_name = DEFAULT_TK_ENCODING
+ end
+ else
+ tk_enc_name = loc_enc_obj.name
+ tksys_enc_name = loc_enc_obj.name
end
- alias encoding_convert_to encoding_convertto
+ else
+ tk_enc_name = ext_enc_obj.name
+ tksys_enc_name = ext_enc_obj.name
end
- extend Encoding
- end
+ # Tk.encoding = tk_enc_name
+ Tk.default_encoding = tk_enc_name
+ Tk.encoding_system = tksys_enc_name
+=end
- # estimate encoding
- case $KCODE
- when /^e/i # EUC
- Tk.encoding = 'euc-jp'
- Tk.encoding_system = 'euc-jp'
- when /^s/i # SJIS
- begin
- if Tk.encoding_system == 'cp932'
- Tk.encoding = 'cp932'
+ if ext_enc_obj == Tk::Encoding::UNKNOWN
+ if loc_enc_obj == Tk::Encoding::UNKNOWN
+ # use Tk.encoding_system
else
- Tk.encoding = 'shiftjis'
- Tk.encoding_system = 'shiftjis'
+ # use locale_charmap
+ begin
+ loc_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(loc_enc_obj)
+ if loc_enc_name && loc_enc_name != tksys_enc_name
+ # use locale_charmap
+ Tk.encoding_system = loc_enc_name
+ else
+ # use Tk.encoding_system
+ end
+ rescue ArgumentError
+ # unsupported encoding on Tk -> use Tk.encoding_system
+ end
+ end
+ else
+ begin
+ ext_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(ext_enc_obj)
+ if ext_enc_name && ext_enc_name != tksys_enc_name
+ # use default_external
+ Tk.encoding_system = ext_enc_name
+ else
+ # use Tk.encoding_system
+ end
+ rescue ArgumentError
+ # unsupported encoding on Tk -> use Tk.encoding_system
end
- rescue StandardError, NameError
- Tk.encoding = 'shiftjis'
- Tk.encoding_system = 'shiftjis'
- end
- when /^u/i # UTF8
- Tk.encoding = 'utf-8'
- Tk.encoding_system = 'utf-8'
- else # NONE
- if defined? DEFAULT_TK_ENCODING
- Tk.encoding_system = DEFAULT_TK_ENCODING
end
+
+ # setup Tk.encoding
+ enc_name = nil
+
begin
- Tk.encoding = Tk.encoding_system
- rescue StandardError, NameError
- Tk.encoding = 'utf-8'
- Tk.encoding_system = 'utf-8'
+ default_def = DEFAULT_TK_ENCODING
+ if ::Encoding.find(default_def.to_s) != Tk::Encoding::UNKNOWN
+ enc_name = Tk::Encoding::ENCODING_TABLE.get_name(default_def)
+ end
+ rescue NameError
+ # ignore
+ enc_name = nil
+ rescue ArgumentError
+ enc_name = nil
+ fail ArgumentError,
+ "DEFAULT_TK_ENCODING has an unknown encoding #{default_def}"
end
- end
-
-else
- # dummy methods
- class TclTkIp
- attr_accessor :encoding
- alias __eval _eval
- alias __invoke _invoke
+ unless enc_name
+ if ext_enc_obj == Tk::Encoding::UNKNOWN
+ if loc_enc_obj == Tk::Encoding::UNKNOWN
+ # use Tk.encoding_system
+ enc_name = tksys_enc_name
+ else
+ # use locale_charmap
+ begin
+ loc_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(loc_enc_obj)
+ if loc_enc_name && loc_enc_name != tksys_enc_name
+ # use locale_charmap
+ enc_name = loc_enc_name
+ else
+ # use Tk.encoding_system
+ enc_name = tksys_enc_name
+ end
+ rescue ArgumentError
+ # unsupported encoding on Tk -> use Tk.encoding_system
+ enc_name = tksys_enc_name
+ end
+ end
+ else
+ begin
+ ext_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(ext_enc_obj)
+ if ext_enc_name && ext_enc_name != tksys_enc_name
+ # use default_external
+ enc_name = ext_enc_name
+ else
+ # use Tk.encoding_system
+ enc_name = tksys_enc_name
+ end
+ rescue ArgumentError
+ # unsupported encoding on Tk -> use Tk.encoding_system
+ enc_name = tksys_enc_name
+ end
+ end
+ end
- alias _eval_with_enc _eval
- alias _invoke_with_enc _invoke
+ Tk.default_encoding = (enc_name)? enc_name: tksys_enc_name
end
+else
+ # dummy methods
module Tk
module Encoding
extend Encoding
+ def force_default_encoding=(mode)
+ nil
+ end
+
+ def force_default_encoding?
+ nil
+ end
+
+ def default_encoding=(enc)
+ nil
+ end
+ def default_encoding
+ nil
+ end
+
def encoding=(name)
nil
end
@@ -2331,10 +3103,26 @@ 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
+
+ class TclTkIp
+ attr_accessor :encoding
+
+ alias __eval _eval
+ alias __invoke _invoke
+
+ alias _eval_with_enc _eval
+ alias _invoke_with_enc _invoke
+ end
end
@@ -2457,7 +3245,15 @@ module TkTreatFont
next
else
fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ rescue
+ # ignore
+ end
+ end
end
end
next
@@ -2511,7 +3307,15 @@ module TkTreatFont
fobj = fontobj # create a new TkFont object
else
ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ rescue => e
+ # ignore
+ end
+ end
next
end
@@ -2563,7 +3367,15 @@ module TkTreatFont
fobj = fontobj # create a new TkFont object
else
knj = hash_kv(knj) if knj.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ rescue => e
+ # ignore
+ end
+ end
next
end
@@ -2664,6 +3476,14 @@ module TkConfigMethod
include TkUtil
include TkTreatFont
+ def TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ @mode || false
+ end
+ def TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
+ fail SecurityError, "can't change the mode" if $SAFE>=4
+ @mode = (mode)? true: false
+ end
+
def __cget_cmd
[self.path, 'cget']
end
@@ -2677,7 +3497,7 @@ module TkConfigMethod
def __confinfo_cmd
__config_cmd
end
- private :__config_cmd
+ private :__confinfo_cmd
def __configinfo_struct
{:key=>0, :alias=>1, :db_name=>1, :db_class=>2,
@@ -2685,6 +3505,11 @@ module TkConfigMethod
end
private :__configinfo_struct
+ def __optkey_aliases
+ {}
+ end
+ private :__optkey_aliases
+
def __numval_optkeys
[]
end
@@ -2696,12 +3521,18 @@ module TkConfigMethod
private :__numstrval_optkeys
def __boolval_optkeys
- []
+ ['exportselection', 'jump', 'setgrid', 'takefocus']
end
private :__boolval_optkeys
def __strval_optkeys
- ['text', 'label', 'show', 'data', 'file']
+ [
+ 'text', 'label', 'show', 'data', 'file',
+ 'activebackground', 'activeforeground', 'background',
+ 'disabledforeground', 'disabledbackground', 'foreground',
+ 'highlightbackground', 'highlightcolor', 'insertbackground',
+ 'selectbackground', 'selectforeground', 'troughcolor'
+ ]
end
private :__strval_optkeys
@@ -2768,6 +3599,7 @@ module TkConfigMethod
}
keys2
end
+ private :__conv_keyonly_opts
def config_hash_kv(keys, enc_mode = nil, conf = nil)
hash_kv(__conv_keyonly_opts(keys), enc_mode, conf)
@@ -2784,7 +3616,7 @@ module TkConfigMethod
val
end
- def cget(slot)
+ def __cget_core(slot)
orig_slot = slot
slot = slot.to_s
@@ -2792,6 +3624,11 @@ module TkConfigMethod
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
begin
@@ -2860,11 +3697,41 @@ module TkConfigMethod
tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{slot}")), true)
end
end
+ private :__cget_core
- def configure(slot, value=None)
+ def cget(slot)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __cget_core(slot)
+ else
+ begin
+ __cget_core(slot)
+ rescue => e
+ if current_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
+ def cget_strict(slot)
+ # never use TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __cget_core(slot)
+ end
+
+ def __configure_core(slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
+ __optkey_aliases.each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if slot.has_key?(alias_name)
+ slot[real_name.to_s] = slot.delete(alias_name)
+ end
+ }
+
__methodcall_optkeys.each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, value) if value
@@ -2901,6 +3768,11 @@ module TkConfigMethod
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
defkey, undefkey = conf
if value
@@ -2924,12 +3796,55 @@ module TkConfigMethod
end
self
end
+ private :__configure_core
+
+ def __check_available_configure_options(keys)
+ availables = self.current_configinfo.keys
+
+ # add non-standard keys
+ availables |= __font_optkeys.map{|k|
+ [k.to_s, "latin#{k}", "ascii#{k}", "kanji#{k}"]
+ }.flatten
+ availables |= __methodcall_optkeys.keys.map{|k| k.to_s}
+ availables |= __keyonly_optkeys.keys.map{|k| k.to_s}
+
+ keys = _symbolkey2str(keys)
+ keys.delete_if{|k, v| !(availables.include?(k))}
+ end
+
+ def configure(slot, value=None)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __configure_core(slot, value)
+ else
+ if slot.kind_of?(Hash)
+ begin
+ __configure_core(slot)
+ rescue
+ slot = __check_available_configure_options(slot)
+ __configure_core(slot) unless slot.empty?
+ end
+ else
+ begin
+ __configure_core(slot, value)
+ rescue => e
+ if current_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
+ self
+ end
def configure_cmd(slot, value)
configure(slot, install_cmd(value))
end
- def configinfo(slot = nil)
+ def __configinfo_core(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if (slot &&
slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
@@ -2940,6 +3855,10 @@ module TkConfigMethod
conf[__configinfo_struct[:key]][1..-1]
if ( ! __configinfo_struct[:alias] \
|| conf.size > __configinfo_struct[:alias] + 1 )
+ fnt = conf[__configinfo_struct[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ conf[__configinfo_struct[:default_value]] = TkNamedFont.new(fnt)
+ end
conf[__configinfo_struct[:current_value]] = fontobj(fontkey)
elsif ( __configinfo_struct[:alias] \
&& conf.size == __configinfo_struct[:alias] + 1 \
@@ -2951,6 +3870,12 @@ module TkConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
@@ -3276,6 +4201,11 @@ module TkConfigMethod
fontconf = ret.assoc(optkey)
if fontconf && fontconf.size > 2
ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
+ fnt = fontconf[__configinfo_struct[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ fontconf[__configinfo_struct[:default_value]] \
+ = TkNamedFont.new(fnt)
+ end
fontconf[__configinfo_struct[:current_value]] = fontobj(optkey)
ret.push(fontconf)
end
@@ -3300,6 +4230,10 @@ module TkConfigMethod
if ( ! __configinfo_struct[:alias] \
|| conf.size > __configinfo_struct[:alias] + 1 )
+ fnt = conf[__configinfo_struct[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ conf[__configinfo_struct[:default_value]] = TkNamedFont.new(fnt)
+ end
conf[__configinfo_struct[:current_value]] = fontobj(fontkey)
{ conf.shift => conf }
elsif ( __configinfo_struct[:alias] \
@@ -3315,6 +4249,12 @@ module TkConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
@@ -3647,6 +4587,11 @@ module TkConfigMethod
ret.delete('latin' << optkey)
ret.delete('ascii' << optkey)
ret.delete('kanji' << optkey)
+ fnt = fontconf[__configinfo_struct[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ fontconf[__configinfo_struct[:default_value]] \
+ = TkNamedFont.new(fnt)
+ end
fontconf[__configinfo_struct[:current_value]] = fontobj(optkey)
ret[optkey] = fontconf
end
@@ -3661,6 +4606,19 @@ module TkConfigMethod
end
end
end
+ private :__configinfo_core
+
+ def configinfo(slot = nil)
+ if slot && TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ begin
+ __configinfo_core(slot)
+ rescue
+ Array.new(__configinfo_struct.values.max).unshift(slot.to_s)
+ end
+ else
+ __configinfo_core(slot)
+ end
+ end
def current_configinfo(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
@@ -3760,12 +4718,19 @@ class TkObject<TkKernel
begin
cget(name)
rescue
- fail NameError,
- "undefined local variable or method `#{name}' for #{self.to_s}",
- error_at
+ if self.kind_of?(TkWindow)
+ fail NameError,
+ "unknown option '#{id}' for #{self.inspect} (deleted widget?)"
+ else
+ super(id, *args)
+ end
+# 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
+ super(id, *args)
+# fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
end
end
@@ -3813,6 +4778,15 @@ end
class TkWindow<TkObject
include TkWinfo
extend TkBindCore
+ include Tk::Wm_for_General
+
+ @@WIDGET_INSPECT_FULL = false
+ def TkWindow._widget_inspect_full_?
+ @@WIDGET_INSPECT_FULL
+ end
+ def TkWindow._widget_inspect_full_=(mode)
+ @@WIDGET_INSPECT_FULL = (mode && true) || false
+ end
TkCommandNames = [].freeze
## ==> If TkCommandNames[0] is a string (not a null string),
@@ -3876,6 +4850,13 @@ class TkWindow<TkObject
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __optkey_aliases.each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__methodcall_optkeys.each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -3908,13 +4889,48 @@ class TkWindow<TkObject
end
if keys and keys != None
- tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ else
+ begin
+ tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ rescue => e
+ tk_call_without_enc(cmd, @path)
+ keys = __check_available_configure_options(keys)
+ unless keys.empty?
+ begin
+ # try to configure
+ configure(keys)
+ rescue
+ # fail => includes options adaptable when creattion only?
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot rescue options error
+ fail e
+ else
+ # re-create widget
+ tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ end
+ end
+ end
+ end
+ end
else
tk_call_without_enc(cmd, @path)
end
end
private :create_self
+ def inspect
+ if @@WIDGET_INSPECT_FULL
+ super
+ else
+ str = super
+ str[0..(str.index(' '))] << '@path=' << @path.inspect << '>'
+ end
+ end
+
def exist?
TkWinfo.exist?(self)
end
@@ -4036,6 +5052,15 @@ class TkWindow<TkObject
self
end
+ def grid_anchor(anchor=None)
+ if anchor == None
+ TkGrid.anchor(self)
+ else
+ TkGrid.anchor(self, anchor)
+ self
+ end
+ end
+
def grid_forget
#tk_call('grid', 'forget', epath)
TkGrid.forget(self)
@@ -4067,12 +5092,14 @@ class TkWindow<TkObject
TkGrid.columnconfigure(self, index, keys)
end
alias grid_columnconfigure grid_columnconfig
+ alias grid_column grid_columnconfig
def grid_rowconfig(index, keys)
#tk_call('grid', 'rowconfigure', epath, index, *hash_kv(keys))
TkGrid.rowconfigure(self, index, keys)
end
alias grid_rowconfigure grid_rowconfig
+ alias grid_row grid_rowconfig
def grid_columnconfiginfo(index, slot=nil)
#if slot
@@ -4315,11 +5342,13 @@ class TkWindow<TkObject
end
children.each{|path, obj|
- if defined?(@cmdtbl)
- for id in @cmdtbl
- uninstall_cmd id
+ obj.instance_eval{
+ if defined?(@cmdtbl)
+ for id in @cmdtbl
+ uninstall_cmd id
+ end
end
- end
+ }
TkCore::INTERP.tk_windows.delete(path)
}
@@ -4424,7 +5453,7 @@ class TkWindow<TkObject
bindtags(bindtags().unshift(tag))
end
end
-
+TkWidget = TkWindow
# freeze core modules
#TclTkLib.freeze
@@ -4437,7 +5466,7 @@ end
#Tk.freeze
module Tk
- RELEASE_DATE = '2005-09-17'.freeze
+ RELEASE_DATE = '2008-05-23'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
@@ -4449,6 +5478,7 @@ end
# call setup script for Tk extension libraries (base configuration)
begin
+ require 'tkextlib/version.rb'
require 'tkextlib/setup.rb'
rescue LoadError
# ignore
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index 73544e1d23..0773f7708d 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -1,9 +1,19 @@
#
# autoload
#
-
-#######################
+############################################
# geometry manager
+module Tk
+ autoload :Grid, 'tk/grid'
+ def Grid(*args); TkGrid.configure(*args); end
+
+ autoload :Pack, 'tk/pack'
+ def Pack(*args); TkPack.configure(*args); end
+
+ autoload :Place, 'tk/place'
+ def Place(*args); TkPlace.configure(*args); end
+end
+
autoload :TkGrid, 'tk/grid'
def TkGrid(*args); TkGrid.configure(*args); end
@@ -14,19 +24,117 @@ autoload :TkPlace, 'tk/place'
def TkPlace(*args); TkPlace.configure(*args); end
-#######################
-# others
+############################################
+# classes on Tk module
+module Tk
+ autoload :Button, 'tk/button'
+
+ autoload :Canvas, 'tk/canvas'
+
+ autoload :CheckButton, 'tk/checkbutton'
+ autoload :Checkbutton, 'tk/checkbutton'
+
+ autoload :Entry, 'tk/entry'
+
+ autoload :Frame, 'tk/frame'
+
+ autoload :Label, 'tk/label'
+
+ autoload :LabelFrame, 'tk/labelframe'
+ autoload :Labelframe, 'tk/labelframe'
+
+ autoload :Listbox, 'tk/listbox'
+
+ autoload :Menu, 'tk/menu'
+ autoload :MenuClone, 'tk/menu'
+ autoload :CloneMenu, 'tk/menu'
+ autoload :SystemMenu, 'tk/menu'
+ autoload :SysMenu_Help, 'tk/menu'
+ autoload :SysMenu_System, 'tk/menu'
+ autoload :SysMenu_Apple, 'tk/menu'
+ autoload :Menubutton, 'tk/menu'
+ autoload :MenuButton, 'tk/menu'
+ autoload :OptionMenubutton, 'tk/menu'
+ autoload :OptionMenBbutton, 'tk/menu'
+
+ autoload :Message, 'tk/message'
+
+ autoload :PanedWindow, 'tk/panedwindow'
+ autoload :Panedwindow, 'tk/panedwindow'
+
+ autoload :RadioButton, 'tk/radiobutton'
+ autoload :Radiobutton, 'tk/radiobutton'
+
+ autoload :Root, 'tk/root'
+
+ autoload :Scale, 'tk/scale'
+
+ autoload :Scrollbar, 'tk/scrollbar'
+ autoload :XScrollbar, 'tk/scrollbar'
+ autoload :YScrollbar, 'tk/scrollbar'
+
+ autoload :Spinbox, 'tk/spinbox'
+
+ autoload :Text, 'tk/text'
+
+ autoload :Toplevel, 'tk/toplevel'
+end
+
+
+############################################
+# sub-module of Tk
+module Tk
+ autoload :Clock, 'tk/clock'
+
+ autoload :OptionObj, 'tk/optionobj'
+
+ autoload :X_Scrollable, 'tk/scrollable'
+ autoload :Y_Scrollable, 'tk/scrollable'
+ autoload :Scrollable, 'tk/scrollable'
+
+ autoload :Wm, 'tk/wm'
+ autoload :Wm_for_General, 'tk/wm'
+
+ autoload :MacResource, 'tk/macpkg'
+
+ autoload :WinDDE, 'tk/winpkg'
+ autoload :WinRegistry, 'tk/winpkg'
+
+ autoload :ValidateConfigure, 'tk/validation'
+ autoload :ItemValidateConfigure, 'tk/validation'
+
+ autoload :EncodedString, 'tk/encodedstr'
+ def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
+
+ autoload :BinaryString, 'tk/encodedstr'
+ def Tk.BinaryString(str); Tk::BinaryString.new(str); end
+
+ autoload :UTF8_String, 'tk/encodedstr'
+ def Tk.UTF8_String(str); Tk::UTF8_String.new(str); end
+
+end
+
+
+############################################
+# toplevel classes/modules (fixed)
autoload :TkBgError, 'tk/bgerror'
autoload :TkBindTag, 'tk/bindtag'
autoload :TkBindTagAll, 'tk/bindtag'
autoload :TkDatabaseClass, 'tk/bindtag'
-autoload :TkButton, 'tk/button'
-
autoload :TkConsole, 'tk/console'
-autoload :TkCanvas, 'tk/canvas'
+autoload :TkcItem, 'tk/canvas'
+autoload :TkcArc, 'tk/canvas'
+autoload :TkcBitmap, 'tk/canvas'
+autoload :TkcImage, 'tk/canvas'
+autoload :TkcLine, 'tk/canvas'
+autoload :TkcOval, 'tk/canvas'
+autoload :TkcPolygon, 'tk/canvas'
+autoload :TkcRectangle, 'tk/canvas'
+autoload :TkcText, 'tk/canvas'
+autoload :TkcWindow, 'tk/canvas'
autoload :TkcTagAccess, 'tk/canvastag'
autoload :TkcTag, 'tk/canvastag'
@@ -36,9 +144,6 @@ autoload :TkcTagAll, 'tk/canvastag'
autoload :TkcTagCurrent, 'tk/canvastag'
autoload :TkcTagGroup, 'tk/canvastag'
-autoload :TkCheckButton, 'tk/checkbutton'
-autoload :TkCheckbutton, 'tk/checkbutton'
-
autoload :TkClipboard, 'tk/clipboard'
autoload :TkComposite, 'tk/composite'
@@ -52,14 +157,10 @@ autoload :TkWarning, 'tk/dialog'
autoload :TkWarning2, 'tk/dialog'
autoload :TkWarningObj, 'tk/dialog'
-autoload :TkEntry, 'tk/entry'
-
autoload :TkEvent, 'tk/event'
autoload :TkFont, 'tk/font'
-autoload :TkTreatTagFont, 'tk/font'
-
-autoload :TkFrame, 'tk/frame'
+autoload :TkNamedFont, 'tk/font'
autoload :TkImage, 'tk/image'
autoload :TkBitmapImage, 'tk/image'
@@ -71,30 +172,12 @@ autoload :TkTreatItemFont, 'tk/itemfont'
autoload :TkKinput, 'tk/kinput'
-autoload :TkLabel, 'tk/label'
-
-autoload :TkLabelFrame, 'tk/labelframe'
-autoload :TkLabelframe, 'tk/labelframe'
-
-autoload :TkListbox, 'tk/listbox'
-
-autoload :TkMacResource, 'tk/macpkg'
-
-autoload :TkMenu, 'tk/menu'
-autoload :TkMenuClone, 'tk/menu'
autoload :TkSystemMenu, 'tk/menu'
-autoload :TkSysMenu_Help, 'tk/menu'
-autoload :TkSysMenu_System, 'tk/menu'
-autoload :TkSysMenu_Apple, 'tk/menu'
-autoload :TkMenubutton, 'tk/menu'
-autoload :TkOptionMenubutton, 'tk/menu'
autoload :TkMenubar, 'tk/menubar'
autoload :TkMenuSpec, 'tk/menuspec'
-autoload :TkMessage, 'tk/message'
-
autoload :TkManageFocus, 'tk/mngfocus'
autoload :TkMsgCatalog, 'tk/msgcat'
@@ -110,86 +193,222 @@ autoload :TkPackage, 'tk/package'
autoload :TkPalette, 'tk/palette'
-autoload :TkPanedWindow, 'tk/panedwindow'
-autoload :TkPanedwindow, 'tk/panedwindow'
-
-autoload :TkRadioButton, 'tk/radiobutton'
-autoload :TkRadiobutton, 'tk/radiobutton'
-
autoload :TkRoot, 'tk/root'
-autoload :TkScale, 'tk/scale'
-
-autoload :TkScrollbar, 'tk/scrollbar'
-autoload :TkXScrollbar, 'tk/scrollbar'
-autoload :TkYScrollbar, 'tk/scrollbar'
-
autoload :TkScrollbox, 'tk/scrollbox'
autoload :TkSelection, 'tk/selection'
-autoload :TkSpinbox, 'tk/spinbox'
-
autoload :TkTreatTagFont, 'tk/tagfont'
-autoload :TkText, 'tk/text'
-
autoload :TkTextImage, 'tk/textimage'
+autoload :TktImage, 'tk/textimage'
autoload :TkTextMark, 'tk/textmark'
autoload :TkTextNamedMark, 'tk/textmark'
autoload :TkTextMarkInsert, 'tk/textmark'
autoload :TkTextMarkCurrent, 'tk/textmark'
autoload :TkTextMarkAnchor, 'tk/textmark'
+autoload :TktMark, 'tk/textmark'
+autoload :TktNamedMark, 'tk/textmark'
+autoload :TktMarkInsert, 'tk/textmark'
+autoload :TktMarkCurrent, 'tk/textmark'
+autoload :TktMarkAnchor, 'tk/textmark'
autoload :TkTextTag, 'tk/texttag'
autoload :TkTextNamedTag, 'tk/texttag'
autoload :TkTextTagSel, 'tk/texttag'
+autoload :TktTag, 'tk/texttag'
+autoload :TktNamedTag, 'tk/texttag'
+autoload :TktTagSel, 'tk/texttag'
autoload :TkTextWindow, 'tk/textwindow'
+autoload :TktWindow, 'tk/textwindow'
autoload :TkAfter, 'tk/timer'
autoload :TkTimer, 'tk/timer'
autoload :TkRTTimer, 'tk/timer'
-autoload :TkToplevel, 'tk/toplevel'
-
autoload :TkTextWin, 'tk/txtwin_abst'
autoload :TkValidation, 'tk/validation'
+autoload :TkValidateCommand, 'tk/validation'
autoload :TkVariable, 'tk/variable'
autoload :TkVarAccess, 'tk/variable'
autoload :TkVirtualEvent, 'tk/virtevent'
+autoload :TkNamedVirtualEvent,'tk/virtevent'
autoload :TkWinfo, 'tk/winfo'
-autoload :TkWinDDE, 'tk/winpkg'
-autoload :TkWinRegistry, 'tk/winpkg'
-
autoload :TkXIM, 'tk/xim'
-#######################
-# sub-module of Tk
+############################################
+# toplevel classes/modules (switchable)
module Tk
- autoload :Clock, 'tk/clock'
- autoload :OptionObj, 'tk/optionobj'
- autoload :X_Scrollable, 'tk/scrollable'
- autoload :Y_Scrollable, 'tk/scrollable'
- autoload :Scrollable, 'tk/scrollable'
- autoload :Wm, 'tk/wm'
+ @TOPLEVEL_ALIAS_TABLE = {}
+ @TOPLEVEL_ALIAS_TABLE[:Tk] = {
+ :TkButton => 'tk/button',
- autoload :ValidateConfigure, 'tk/validation'
- autoload :ItemValidateConfigure, 'tk/validation'
+ :TkCanvas => 'tk/canvas',
- autoload :EncodedString, 'tk/encodedstr'
- def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
+ :TkCheckButton => 'tk/checkbutton',
+ :TkCheckbutton => 'tk/checkbutton',
- autoload :BinaryString, 'tk/encodedstr'
- def Tk.BinaryString(str); Tk::BinaryString.new(str); end
+ # :TkDialog => 'tk/dialog',
+ # :TkDialog2 => 'tk/dialog',
+ # :TkDialogObj => 'tk/dialog',
+ # :TkWarning => 'tk/dialog',
+ # :TkWarning2 => 'tk/dialog',
+ # :TkWarningObj => 'tk/dialog',
- autoload :UTF8_String, 'tk/encodedstr'
- def Tk.UTF8_String(str); Tk::UTF8_String.new(str); end
+ :TkEntry => 'tk/entry',
+
+ :TkFrame => 'tk/frame',
+
+ :TkLabel => 'tk/label',
+
+ :TkLabelFrame => 'tk/labelframe',
+ :TkLabelframe => 'tk/labelframe',
+
+ :TkListbox => 'tk/listbox',
+
+ :TkMacResource => 'tk/macpkg',
+
+ :TkMenu => 'tk/menu',
+ :TkMenuClone => 'tk/menu',
+ :TkCloneMenu => 'tk/menu',
+ # :TkSystemMenu => 'tk/menu',
+ :TkSysMenu_Help => 'tk/menu',
+ :TkSysMenu_System => 'tk/menu',
+ :TkSysMenu_Apple => 'tk/menu',
+ :TkMenubutton => 'tk/menu',
+ :TkMenuButton => 'tk/menu',
+ :TkOptionMenubutton => 'tk/menu',
+ :TkOptionMenuButton => 'tk/menu',
+
+ :TkMessage => 'tk/message',
+
+ :TkPanedWindow => 'tk/panedwindow',
+ :TkPanedwindow => 'tk/panedwindow',
+
+ :TkRadioButton => 'tk/radiobutton',
+ :TkRadiobutton => 'tk/radiobutton',
+
+ # :TkRoot => 'tk/root',
+
+ :TkScale => 'tk/scale',
+
+ :TkScrollbar => 'tk/scrollbar',
+ :TkXScrollbar => 'tk/scrollbar',
+ :TkYScrollbar => 'tk/scrollbar',
+
+ :TkSpinbox => 'tk/spinbox',
+
+ :TkText => 'tk/text',
+
+ :TkToplevel => 'tk/toplevel',
+
+ :TkWinDDE => 'tk/winpkg',
+ :TkWinRegistry => 'tk/winpkg',
+ }
+
+ @TOPLEVEL_ALIAS_OWNER = {}
+
+ @TOPLEVEL_ALIAS_SETUP_PROC = {}
+
+ @current_default_widget_set = nil
+end
+
+
+############################################
+# methods to control default widget set
+############################################
+
+class << Tk
+ def default_widget_set
+ @current_default_widget_set
+ end
+
+ def default_widget_set=(target)
+ target = target.to_sym
+ return target if target == @current_default_widget_set
+
+ if (cmd = @TOPLEVEL_ALIAS_SETUP_PROC[target])
+ cmd.call(target)
+ end
+
+ _replace_toplevel_aliases(target)
+ end
+
+ def __set_toplevel_aliases__(target, obj, *symbols)
+ @TOPLEVEL_ALIAS_TABLE[target = target.to_sym] ||= {}
+ symbols.each{|sym|
+ @TOPLEVEL_ALIAS_TABLE[target][sym = sym.to_sym] = obj
+ # if @current_default_widget_set == target
+ if @TOPLEVEL_ALIAS_OWNER[sym] == target
+ Object.class_eval{remove_const sym} if Object.const_defined?(sym)
+ Object.const_set(sym, obj)
+ end
+ }
+ end
+
+ ###################################
+ private
+ def _replace_toplevel_aliases(target)
+ # check already autoloaded
+ if (table = @TOPLEVEL_ALIAS_TABLE[current = @current_default_widget_set])
+ table.each{|sym, file|
+ if !Object.autoload?(sym) && Object.const_defined?(sym) &&
+ @TOPLEVEL_ALIAS_TABLE[current][sym].kind_of?(String)
+ # autoload -> class
+ @TOPLEVEL_ALIAS_TABLE[current][sym] = Object.const_get(sym)
+ end
+ }
+ end
+
+ # setup autoloads
+ @TOPLEVEL_ALIAS_TABLE[target].each{|sym, file|
+ Object.class_eval{remove_const sym} if Object.const_defined?(sym)
+ if file.kind_of?(String)
+ # file => autoload target file
+ Object.autoload(sym, file)
+ else
+ # file => loaded class object
+ Object.const_set(sym, file)
+ end
+ @TOPLEVEL_ALIAS_OWNER[sym] = target
+ }
+
+ # update current alias
+ @current_default_widget_set = target
+ end
+end
+
+############################################
+# setup default widget set => :Tk
+Tk.default_widget_set = :Tk
+
+
+############################################
+# depend on the version of Tcl/Tk
+# major, minor, type, type_name, patchlevel = TclTkLib.get_version
+
+############################################
+# Ttk (Tile) support
+=begin
+if major > 8 ||
+ (major == 8 && minor > 5) ||
+ (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA)
+ # Tcl/Tk 8.5 beta or later
+ Object.autoload :Ttk, 'tkextlib/tile'
+ Tk.autoload :Tile, 'tkextlib/tile'
+
+ require 'tk/ttk_selector'
end
+=end
+Object.autoload :Ttk, 'tkextlib/tile'
+Tk.autoload :Tile, 'tkextlib/tile'
+require 'tk/ttk_selector'
diff --git a/ext/tk/lib/tk/bindtag.rb b/ext/tk/lib/tk/bindtag.rb
index 9023a08e06..88c8367a88 100644
--- a/ext/tk/lib/tk/bindtag.rb
+++ b/ext/tk/lib/tk/bindtag.rb
@@ -8,30 +8,64 @@ class TkBindTag
#BTagID_TBL = {}
BTagID_TBL = TkCore::INTERP.create_table
- Tk_BINDTAG_ID = ["btag".freeze, "00000".taint].freeze
- TkCore::INTERP.init_ip_env{ BTagID_TBL.clear }
+ (Tk_BINDTAG_ID = ["btag".freeze, "00000".taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ BTagID_TBL.mutex.synchronize{ BTagID_TBL.clear }
+ }
def TkBindTag.id2obj(id)
- BTagID_TBL[id]? BTagID_TBL[id]: id
+ BTagID_TBL.mutex.synchronize{
+ (BTagID_TBL[id])? BTagID_TBL[id]: id
+ }
end
+=begin
def TkBindTag.new_by_name(name, *args, &b)
- return BTagID_TBL[name] if BTagID_TBL[name]
+ BTagID_TBL.mutex.synchronize{
+ return BTagID_TBL[name] if BTagID_TBL[name]
+ }
+
self.new.instance_eval{
- BTagID_TBL.delete @id
- @id = name
- BTagID_TBL[@id] = self
+ BTagID_TBL.mutex.synchronize{
+ BTagID_TBL.delete @id
+ @id = name
+ BTagID_TBL[@id] = self
+ }
bind(*args, &b) if args != []
self
}
end
+=end
+ def TkBindTag.new_by_name(name, *args, &b)
+ obj = nil
+ BTagID_TBL.mutex.synchronize{
+ if BTagID_TBL[name]
+ obj = BTagID_TBL[name]
+ else
+ (obj = BTagID_TBL[name] = self.allocate).instance_eval{
+ @id = name
+ }
+ end
+ }
+ bind(*args, &b) if obj && args != []
+ obj
+ end
def initialize(*args, &b)
- # @id = Tk_BINDTAG_ID.join('')
- @id = Tk_BINDTAG_ID.join(TkCore::INTERP._ip_id_)
- Tk_BINDTAG_ID[1].succ!
- BTagID_TBL[@id] = self
+ Tk_BINDTAG_ID.mutex.synchronize{
+ # @id = Tk_BINDTAG_ID.join('')
+ @id = Tk_BINDTAG_ID.join(TkCore::INTERP._ip_id_)
+ Tk_BINDTAG_ID[1].succ!
+ }
+ BTagID_TBL.mutex.synchronize{
+ BTagID_TBL[@id] = self
+ }
bind(*args, &b) if args != []
end
@@ -63,14 +97,37 @@ end
class TkDatabaseClass<TkBindTag
+=begin
def self.new(name, *args, &b)
- return BTagID_TBL[name] if BTagID_TBL[name]
+ BTagID_TBL.mutex.synchronize{
+ return BTagID_TBL[name] if BTagID_TBL[name]
+ }
super(name, *args, &b)
end
def initialize(name, *args, &b)
@id = name
- BTagID_TBL[@id] = self
+ BTagID_TBL.mutex.synchronize{
+ BTagID_TBL[@id] = self
+ }
+ bind(*args, &b) if args != []
+ end
+=end
+ def self.new(name, *args, &b)
+ BTagID_TBL.mutex.synchronize{
+ if BTagID_TBL[name]
+ BTagID_TBL[name]
+ else
+ BTagID_TBL[name] = self.allocate.instance_eval{
+ initialize(name, *args, &b)
+ self
+ }
+ end
+ }
+ end
+
+ def initialize(name, *args, &b)
+ @id = name
bind(*args, &b) if args != []
end
diff --git a/ext/tk/lib/tk/button.rb b/ext/tk/lib/tk/button.rb
index 407a47c400..770a5785bb 100644
--- a/ext/tk/lib/tk/button.rb
+++ b/ext/tk/lib/tk/button.rb
@@ -4,7 +4,7 @@
require 'tk'
require 'tk/label'
-class TkButton<TkLabel
+class Tk::Button<Tk::Label
TkCommandNames = ['button'.freeze].freeze
WidgetClassName = 'Button'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -25,3 +25,6 @@ class TkButton<TkLabel
self
end
end
+
+#TkButton = Tk::Button unless Object.const_defined? :TkButton
+Tk.__set_toplevel_aliases__(:Tk, Tk::Button, :TkButton)
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index 97bc6cc14a..36ea008a17 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -1,6 +1,5 @@
#
# tk/canvas.rb - Tk canvas classes
-# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
require 'tk'
@@ -11,11 +10,25 @@ 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
@@ -26,9 +39,9 @@ module TkCanvasItemConfig
private :__item_pathname
end
-class TkCanvas<TkWindow
+class Tk::Canvas<TkWindow
include TkCanvasItemConfig
- include Scrollable
+ include Tk::Scrollable
TkCommandNames = ['canvas'.freeze].freeze
WidgetClassName = 'Canvas'.freeze
@@ -47,6 +60,16 @@ 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
@@ -145,6 +168,8 @@ class TkCanvas<TkWindow
#tk_tcl2ruby(tk_send_without_enc('canvasy', screen_y, *args))
number(tk_send_without_enc('canvasy', screen_y, *args))
end
+ alias canvas_x canvasx
+ alias canvas_y canvasy
def coords(tag, *args)
if args == []
@@ -162,11 +187,17 @@ class TkCanvas<TkWindow
end
def delete(*args)
- if TkcItem::CItemID_TBL[self.path]
+ tbl = nil
+ TkcItem::CItemID_TBL.mutex.synchronize{
+ tbl = TkcItem::CItemID_TBL[self.path]
+ }
+ if tbl
args.each{|tag|
find('withtag', tag).each{|item|
if item.kind_of?(TkcItem)
- TkcItem::CItemID_TBL[self.path].delete(item.id)
+ TkcItem::CItemID_TBL.mutex.synchronize{
+ tbl.delete(item.id)
+ }
end
}
}
@@ -519,8 +550,8 @@ class TkCanvas<TkWindow
tk_send_without_enc('scan', 'mark', x, y)
self
end
- def scan_dragto(x, y)
- tk_send_without_enc('scan', 'dragto', x, y)
+ def scan_dragto(x, y, gain=None)
+ tk_send_without_enc('scan', 'dragto', x, y, gain)
self
end
@@ -549,6 +580,10 @@ class TkCanvas<TkWindow
end
end
+#TkCanvas = Tk::Canvas unless Object.const_defined? :TkCanvas
+Tk.__set_toplevel_aliases__(:Tk, Tk::Canvas, :TkCanvas)
+
+
class TkcItem<TkObject
extend Tk
include TkcTagAccess
@@ -557,9 +592,12 @@ class TkcItem<TkObject
CItemTypeName = nil
CItemTypeToClass = {}
+
CItemID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ CItemID_TBL.clear }
+ TkCore::INTERP.init_ip_env{
+ CItemID_TBL.mutex.synchronize{ CItemID_TBL.clear }
+ }
def TkcItem.type2class(type)
CItemTypeToClass[type]
@@ -567,8 +605,13 @@ class TkcItem<TkObject
def TkcItem.id2obj(canvas, id)
cpath = canvas.path
- return id unless CItemID_TBL[cpath]
- CItemID_TBL[cpath][id]? CItemID_TBL[cpath][id]: id
+ CItemID_TBL.mutex.synchronize{
+ if CItemID_TBL[cpath]
+ CItemID_TBL[cpath][id]? CItemID_TBL[cpath][id]: id
+ else
+ id
+ end
+ }
end
########################################
@@ -601,6 +644,13 @@ class TkcItem<TkObject
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __item_optkey_aliases(nil).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -634,15 +684,17 @@ class TkcItem<TkObject
########################################
def initialize(parent, *args)
- #unless parent.kind_of?(TkCanvas)
- # fail ArgumentError, "expect TkCanvas for 1st argument"
+ #unless parent.kind_of?(Tk::Canvas)
+ # fail ArgumentError, "expect Tk::Canvas for 1st argument"
#end
@parent = @c = parent
@path = parent.path
@id = create_self(*args) # an integer number as 'canvas item id'
- CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
- CItemID_TBL[@path][@id] = self
+ CItemID_TBL.mutex.synchronize{
+ CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
+ CItemID_TBL[@path][@id] = self
+ }
end
def create_self(*args)
self.class.create(@c, *args) # return an integer number as 'canvas item id'
@@ -663,7 +715,9 @@ class TkcItem<TkObject
def delete
@c.delete @id
- CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
+ CItemID_TBL.mutex.synchronize{
+ CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
+ }
self
end
alias remove delete
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
index a5650ee68b..49796d80b2 100644
--- a/ext/tk/lib/tk/canvastag.rb
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -63,6 +63,9 @@ module TkcTagAccess
def cget(option)
@c.itemcget(@id, option)
end
+ def cget_strict(option)
+ @c.itemcget_strict(@id, option)
+ end
def configure(key, value=None)
@c.itemconfigure(@id, key, value)
@@ -199,14 +202,26 @@ class TkcTag<TkObject
include TkcTagAccess
CTagID_TBL = TkCore::INTERP.create_table
- Tk_CanvasTag_ID = ['ctag'.freeze, '00000'.taint].freeze
- TkCore::INTERP.init_ip_env{ CTagID_TBL.clear }
+ (Tk_CanvasTag_ID = ['ctag'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ CTagID_TBL.mutex.synchronize{ CTagID_TBL.clear }
+ }
def TkcTag.id2obj(canvas, id)
cpath = canvas.path
- return id unless CTagID_TBL[cpath]
- CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id
+ CTagID_TBL.mutex.synchronize{
+ if CTagID_TBL[cpath]
+ CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id
+ else
+ id
+ end
+ }
end
def initialize(parent, mode=nil, *args)
@@ -215,11 +230,15 @@ class TkcTag<TkObject
#end
@c = parent
@cpath = parent.path
- # @path = @id = Tk_CanvasTag_ID.join('')
- @path = @id = Tk_CanvasTag_ID.join(TkCore::INTERP._ip_id_)
- CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
- CTagID_TBL[@cpath][@id] = self
- Tk_CanvasTag_ID[1].succ!
+ Tk_CanvasTag_ID.mutex.synchronize{
+ # @path = @id = Tk_CanvasTag_ID.join('')
+ @path = @id = Tk_CanvasTag_ID.join(TkCore::INTERP._ip_id_)
+ Tk_CanvasTag_ID[1].succ!
+ }
+ CTagID_TBL.mutex.synchronize{
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ }
if mode
tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
end
@@ -238,7 +257,9 @@ class TkcTag<TkObject
def delete
@c.delete @id
- CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
+ CTagID_TBL.mutex.synchronize{
+ CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
+ }
self
end
alias remove delete
@@ -288,23 +309,38 @@ class TkcTag<TkObject
end
class TkcTagString<TkcTag
- def self.new(parent, name, *args)
- if CTagID_TBL[parent.path] && CTagID_TBL[parent.path][name]
- return CTagID_TBL[parent.path][name]
- else
- super(parent, name, *args)
+ def self.new(parent, name, mode=nil, *args)
+ obj = nil
+ CTagID_TBL.mutex.synchronize{
+ if CTagID_TBL[parent.path] && CTagID_TBL[parent.path][name]
+ obj = CTagID_TBL[parent.path][name]
+ else
+ # super(parent, name, *args)
+ (obj = self.allocate).instance_eval{
+ @c = parent
+ @cpath = parent.path
+ @path = @id = name
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ }
+ end
+ }
+ if obj && mode
+ tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
end
+ obj
end
def initialize(parent, name, mode=nil, *args)
+ # dummy:: not called by 'new' method
+
#unless parent.kind_of?(TkCanvas)
# fail ArgumentError, "expect TkCanvas for 1st argument"
#end
@c = parent
@cpath = parent.path
@path = @id = name
- CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
- CTagID_TBL[@cpath][@id] = self
+
if mode
tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
end
@@ -312,7 +348,11 @@ class TkcTagString<TkcTag
end
TkcNamedTag = TkcTagString
-class TkcTagAll<TkcTag
+class TkcTagAll<TkcTagString
+ def self.new(parent)
+ super(parent, 'all')
+ end
+=begin
def initialize(parent)
#unless parent.kind_of?(TkCanvas)
# fail ArgumentError, "expect TkCanvas for 1st argument"
@@ -320,12 +360,19 @@ class TkcTagAll<TkcTag
@c = parent
@cpath = parent.path
@path = @id = 'all'
- CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
- CTagID_TBL[@cpath][@id] = self
+ CTagID_TBL.mutex.synchronize{
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ }
end
+=end
end
-class TkcTagCurrent<TkcTag
+class TkcTagCurrent<TkcTagString
+ def self.new(parent)
+ super(parent, 'current')
+ end
+=begin
def initialize(parent)
#unless parent.kind_of?(TkCanvas)
# fail ArgumentError, "expect TkCanvas for 1st argument"
@@ -333,13 +380,21 @@ class TkcTagCurrent<TkcTag
@c = parent
@cpath = parent.path
@path = @id = 'current'
- CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
- CTagID_TBL[@cpath][@id] = self
+ CTagID_TBL.mutex.synchronize{
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ }
end
+=end
end
class TkcGroup<TkcTag
- Tk_cGroup_ID = ['tkcg'.freeze, '00000'.taint].freeze
+ (Tk_cGroup_ID = ['tkcg'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
#def create_self(parent, *args)
def initialize(parent, *args)
#unless parent.kind_of?(TkCanvas)
@@ -347,11 +402,15 @@ class TkcGroup<TkcTag
#end
@c = parent
@cpath = parent.path
- # @path = @id = Tk_cGroup_ID.join('')
- @path = @id = Tk_cGroup_ID.join(TkCore::INTERP._ip_id_)
- CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
- CTagID_TBL[@cpath][@id] = self
- Tk_cGroup_ID[1].succ!
+ Tk_cGroup_ID.mutex.synchronize{
+ # @path = @id = Tk_cGroup_ID.join('')
+ @path = @id = Tk_cGroup_ID.join(TkCore::INTERP._ip_id_)
+ Tk_cGroup_ID[1].succ!
+ }
+ CTagID_TBL.mutex.synchronize{
+ CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
+ CTagID_TBL[@cpath][@id] = self
+ }
include(*args) if args != []
end
#private :create_self
diff --git a/ext/tk/lib/tk/checkbutton.rb b/ext/tk/lib/tk/checkbutton.rb
index d76d99c0f2..b1186a87ed 100644
--- a/ext/tk/lib/tk/checkbutton.rb
+++ b/ext/tk/lib/tk/checkbutton.rb
@@ -4,7 +4,7 @@
require 'tk'
require 'tk/radiobutton'
-class TkCheckButton<TkRadioButton
+class Tk::CheckButton<Tk::RadioButton
TkCommandNames = ['checkbutton'.freeze].freeze
WidgetClassName = 'Checkbutton'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -22,4 +22,9 @@ class TkCheckButton<TkRadioButton
self
end
end
-TkCheckbutton = TkCheckButton
+
+Tk::Checkbutton = Tk::CheckButton
+#TkCheckButton = Tk::CheckButton unless Object.const_defined? :TkCheckButton
+#TkCheckbutton = Tk::Checkbutton unless Object.const_defined? :TkCheckbutton
+Tk.__set_toplevel_aliases__(:Tk, Tk::CheckButton,
+ :TkCheckButton, :TkCheckbutton)
diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb
index 58cca736db..883d43c3ea 100644
--- a/ext/tk/lib/tk/composite.rb
+++ b/ext/tk/lib/tk/composite.rb
@@ -7,6 +7,7 @@ module TkComposite
include Tk
extend Tk
+=begin
def initialize(parent=nil, *args)
@delegates = {}
@option_methods = {}
@@ -24,6 +25,113 @@ 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
+ if klass <= TkFrame || klass < Tk::Frame || 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
+ if self.class < TkFrame || self.class.superclass < Tk::Frame || 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
+ if self.class < TkFrame || self.class.superclass < Tk::Frame || 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 = Tk::Frame.new(parent, :class=>base_class_name)
+ # --> use current TkFrame class
+ @frame = TkFrame.new(parent, :class=>base_class_name)
+ else
+ # @frame = Tk::Frame.new(parent)
+ # --> use current TkFrame class
+ @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
@@ -32,6 +140,11 @@ module TkComposite
def initialize_composite(*args) end
private :initialize_composite
+ def inspect
+ str = super
+ str.chop << ' @epath=' << @epath.inspect << '>'
+ end
+
def option_methods(*opts)
opts.each{|m_set, m_cget, m_info|
m_set = m_set.to_s
@@ -68,6 +181,57 @@ module TkComposite
delegate_alias(option, option, *wins)
end
+ def __cget_delegates(slot)
+ slot = slot.to_s
+
+ if @option_methods.include?(slot)
+ if @option_methods[slot][:cget]
+ return self.__send__(@option_methods[slot][:cget])
+ else
+ if @option_setting[slot]
+ return @option_setting[slot]
+ else
+ return ''
+ end
+ end
+ end
+
+ tbl = @delegates[slot]
+ tbl = @delegates['DEFAULT'] unless tbl
+
+ begin
+ if tbl
+ opt, wins = tbl[-1]
+ opt = slot if opt == 'DEFAULT'
+ if wins && wins[-1]
+ # return wins[-1].cget(opt)
+ return wins[-1].cget_strict(opt)
+ end
+ end
+ rescue
+ end
+
+ return None
+ end
+ private :__cget_delegates
+
+ def cget(slot)
+ if (ret = __cget_delegates(slot)) == None
+ super(slot)
+ else
+ ret
+ end
+ end
+
+ def cget_strict(slot)
+ if (ret = __cget_delegates(slot)) == None
+ super(slot)
+ else
+ ret
+ end
+ end
+
+=begin
def cget(slot)
slot = slot.to_s
@@ -99,6 +263,7 @@ module TkComposite
super(slot)
end
+=end
def configure(slot, value=None)
if slot.kind_of? Hash
diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb
index 797e514a4c..02de0b0d85 100644
--- a/ext/tk/lib/tk/encodedstr.rb
+++ b/ext/tk/lib/tk/encodedstr.rb
@@ -70,13 +70,89 @@ module Tk
# @encoding = ( enc ||
# ((self.class::Encoding)?
# self.class::Encoding : Tk.encoding_system) )
- @encoding = ( enc ||
- ((self.class::Encoding)?
+ enc ||= (self.class::Encoding)?
self.class::Encoding :
- ((Tk.encoding)? Tk.encoding : Tk.encoding_system) ) )
+ ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
+ if TkCore::WITH_ENCODING
+ unless encobj = Tk::Encoding::ENCODING_TABLE.get_obj(enc)
+ fail ArgumentError, "unsupported Tk encoding '#{enc}'"
+ end
+ self.force_encoding(encobj)
+ else
+ @encoding = enc
+ end
+ end
+
+ if TkCore::WITH_ENCODING
+ alias encoding_obj encoding
+ alias __encoding encoding
+ def encoding
+ Tk::Encoding::ENCODING_TABLE.get_name(super())
+ end
+ else
+ def encoding
+ @encoding
+ end
+ alias encoding_obj encoding
end
- attr_reader :encoding
+ if TkCore::WITH_ENCODING
+ # wrapper methods for compatibility
+ alias __instance_variable_get instance_variable_get
+ alias __instance_variable_set instance_variable_set
+ alias __instance_eval instance_eval
+ alias __instance_variables instance_variables
+
+ def instance_variable_get(key)
+ if (key.to_s == '@encoding')
+ self.encoding
+ else
+ super(key)
+ end
+ end
+
+ def instance_variable_set(key, value)
+ if (key.to_s == '@encoding')
+ if value
+ self.force_encoding(value)
+ else
+ self.force_encoding(Tk::Encoding::UNKNOWN)
+ end
+ value
+ else
+ super(key, value)
+ end
+ end
+
+ def instance_eval(*args, &b)
+ old_enc = @encoding = self.encoding
+
+ ret = super(*args, &b)
+
+ if @encoding
+ if @encoding != old_enc
+ # modified by user
+ self.force_encoding(@encoding)
+ end
+ remove_instance_variable(:@encoding)
+ else
+ begin
+ remove_instance_variable(:@encoding)
+ # user sets to nil -> use current default
+ self.force_encoding(Tk.encoding)
+ rescue NameError
+ # removed by user -> ignore, because user don't use @encoding
+ end
+ end
+ ret
+ end
+ end
+
+ def instance_variables
+ ret = super()
+ ret << :@encoding # fake !!
+ ret
+ end
end
# def Tk.EncodedString(str, enc = nil)
# Tk::EncodedString.new(str, enc)
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
index 63051979e6..8ce8def1e7 100644
--- a/ext/tk/lib/tk/entry.rb
+++ b/ext/tk/lib/tk/entry.rb
@@ -1,6 +1,5 @@
#
# tk/entry.rb - Tk entry classes
-# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
@@ -8,7 +7,7 @@ require 'tk/label'
require 'tk/scrollable'
require 'tk/validation'
-class TkEntry<TkLabel
+class Tk::Entry<Tk::Label
include X_Scrollable
include TkValidation
@@ -21,6 +20,11 @@ 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
@@ -110,3 +114,6 @@ class TkEntry<TkLabel
val
end
end
+
+#TkEntry = Tk::Entry unless Object.const_defined? :TkEntry
+Tk.__set_toplevel_aliases__(:Tk, Tk::Entry, :TkEntry)
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index b538bfd63d..d8aad6248b 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -39,7 +39,9 @@ module TkEvent
RESIZEREQ = 0x200000
CIRCREQ = 0x400000
- MWHEEL = 0x10000000
+ MWHEEL = KEY
+
+ STRING_DATA = 0x80000000 # special flag for 'data' field
ALL = 0xFFFFFFFF
@@ -155,7 +157,7 @@ module TkEvent
'borderwidth' => (Grp::CREATE|Grp::CONFIG),
'button' => Grp::BUTTON,
'count' => Grp::EXPOSE,
- 'data' => Grp::VIRTUAL,
+ 'data' => (Grp::VIRTUAL|Grp::STRING_DATA),
'delta' => Grp::MWHEEL,
'detail' => (Grp::FOCUS|Grp::CROSSING),
'focus' => Grp::CROSSING,
@@ -223,7 +225,8 @@ module TkEvent
rescue
next
end
- next if !val || val == '??'
+ # next if !val || val == '??'
+ next if !val || (val == '??' && (flag & Grp::STRING_DATA))
fields[key] = val
}
@@ -298,34 +301,65 @@ module TkEvent
[ ?b, ?n, :num ],
[ ?c, ?n, :count ],
[ ?d, ?s, :detail ],
+ # ?e
[ ?f, ?b, :focus ],
+ # ?g
[ ?h, ?n, :height ],
[ ?i, ?s, :win_hex ],
+ # ?j
[ ?k, ?n, :keycode ],
+ # ?l
[ ?m, ?s, :mode ],
+ # ?n
[ ?o, ?b, :override ],
[ ?p, ?s, :place ],
+ # ?q
+ # ?r
[ ?s, ?x, :state ],
[ ?t, ?n, :time ],
+ # ?u
+ [ ?v, ?n, :value_mask ],
[ ?w, ?n, :width ],
[ ?x, ?n, :x ],
[ ?y, ?n, :y ],
+ # ?z
[ ?A, ?s, :char ],
[ ?B, ?n, :borderwidth ],
+ # ?C
[ ?D, ?n, :wheel_delta ],
[ ?E, ?b, :send_event ],
+ # ?F
+ # ?G
+ # ?H
+ # ?I
+ # ?J
[ ?K, ?s, :keysym ],
+ # ?L
+ # ?M
[ ?N, ?n, :keysym_num ],
+ # ?O
[ ?P, ?s, :property ],
+ # ?Q
[ ?R, ?s, :rootwin_id ],
[ ?S, ?s, :subwindow ],
[ ?T, ?n, :type ],
+ # ?U
+ # ?V
[ ?W, ?w, :widget ],
[ ?X, ?n, :x_root ],
[ ?Y, ?n, :y_root ],
+ # ?Z
nil
]
+ # [ <'%' subst-key str>, <proc type char>, <instance var (accessor) name>]
+ # the subst-key string will be converted to a bytecode (128+idx).
+ LONGKEY_TBL = [
+ # for example, for %CTT and %CST subst-key on tkdnd-2.0
+ # ['CTT', ?l, :drop_target_type],
+ # ['CST', ?l, :drop_source_type],
+ ]
+
# [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
PROC_TBL = [
[ ?n, TkComm.method(:num_or_str) ],
@@ -345,6 +379,24 @@ module TkEvent
nil
]
+=begin
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
+ KEY_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
+ end
+ inf
+ }
+
+ PROC_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ end
+ inf
+ }
+=end
+
# setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys
#
# _get_subst_key() and _get_all_subst_keys() generates key-string
@@ -357,7 +409,8 @@ module TkEvent
# ( which are Tcl strings ) to ruby objects based on the key string
# that is generated by _get_subst_key() or _get_all_subst_keys().
#
- _setup_subst_table(KEY_TBL, PROC_TBL);
+ _setup_subst_table(KEY_TBL, PROC_TBL)
+ # _setup_subst_table(KEY_TBL, LONGKEY_TBL, PROC_TBL) # if use longname-keys
#
# NOTE: The order of parameters which passed to callback procedure is
@@ -384,6 +437,7 @@ module TkEvent
=end
ALIAS_TBL = {
:button => :num,
+ :data => :detail,
:delta => :wheel_delta,
:root => :rootwin_id,
:rootx => :x_root,
@@ -404,6 +458,7 @@ module TkEvent
extra_args_tbl = klass._get_extra_args_tbl
if args.compact.size > 0
+ args.map!{|arg| klass._sym2subst(arg)}
args = args.join(' ')
keys = klass._get_subst_key(args)
@@ -415,10 +470,18 @@ module TkEvent
id = install_cmd(proc{|*arg|
ex_args = []
extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- TkUtil.eval_cmd(cmd, *(ex_args.concat(klass.scan_args(keys, arg))))
+ 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
})
end
- id + ' ' + args
else
keys, args = klass._get_all_subst_keys
@@ -430,11 +493,46 @@ module TkEvent
id = install_cmd(proc{|*arg|
ex_args = []
extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- TkUtil.eval_cmd(cmd,
- *(ex_args << klass.new(*klass.scan_args(keys, arg))))
+ 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
})
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 8e63558cae..62d628c132 100644
--- a/ext/tk/lib/tk/font.rb
+++ b/ext/tk/lib/tk/font.rb
@@ -11,13 +11,18 @@ class TkFont
TkCommandNames = ['font'.freeze].freeze
- Tk_FontID = ["@font".freeze, "00000".taint].freeze
+ (Tk_FontID = ["@font".freeze, "00000".taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
Tk_FontNameTBL = TkCore::INTERP.create_table
Tk_FontUseTBL = TkCore::INTERP.create_table
TkCore::INTERP.init_ip_env{
- Tk_FontNameTBL.clear
- Tk_FontUseTBL.clear
+ Tk_FontNameTBL.mutex.synchronize{ Tk_FontNameTBL.clear }
+ Tk_FontUseTBL.mutex.synchronize{ Tk_FontUseTBL.clear }
}
# option_type : default => string
@@ -31,13 +36,26 @@ class TkFont
MetricType = Hash.new(?n)
MetricType['fixed'] = ?b
+ # system font names
+ SYSTEM_FONT_NAMES = []
+ def SYSTEM_FONT_NAMES.add(font_names)
+ (@mutex ||= Mutex.new).synchronize{
+ self.replace(self | font_names.map{|name| name.to_s})
+ }
+ end
+ def SYSTEM_FONT_NAMES.include?(name)
+ (@mutex ||= Mutex.new).synchronize{
+ super(name.to_s)
+ }
+ end
+
# set default font
case Tk::TK_VERSION
- when /^4\.*/
+ when /^4\..*/
DEFAULT_LATIN_FONT_NAME = 'a14'.freeze
DEFAULT_KANJI_FONT_NAME = 'k14'.freeze
- when /^8\.*/
+ when /^8\.[0-4]/
if JAPANIZED_TK
begin
fontnames = tk_call('font', 'names')
@@ -103,6 +121,15 @@ class TkFont
DEFAULT_LATIN_FONT_NAME = ltn.freeze
DEFAULT_KANJI_FONT_NAME = knj.freeze
+ when /^8\.[5-9]/, /^9\..*/
+ if tk_call('font', 'names') =~ /\bTkDefaultFont\b/
+ DEFAULT_LATIN_FONT_NAME = 'TkDefaultFont'.freeze
+ DEFAULT_KANJI_FONT_NAME = 'TkDefaultFont'.freeze
+ else
+ DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
+ DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
+ end
+
else # unknown version
DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
@@ -121,6 +148,7 @@ class TkFont
unless compound.kind_of?(TkFont)
fail ArgumentError, "a TkFont object is expected for the 1st argument"
end
+
@compound = compound
case type
when 'kanji', 'latin', 'ascii'
@@ -145,6 +173,9 @@ class TkFont
def font
@compound.__send__(@type + '_font_id')
end
+ alias font_id font
+ alias name font
+ alias to_s font
def [](slot)
@compound.__send__(@type + '_configinfo', slot)
@@ -163,6 +194,14 @@ class TkFont
###################################
# class methods
###################################
+ def TkFont.is_system_font?(fnt)
+ # true --> system font which is available on the current system
+ # false --> not system font (or unknown system font)
+ # nil --> system font name, but not available on the current system
+ fnt = fnt.to_s
+ SYSTEM_FONT_NAMES.include?(fnt) && self.names.index(fnt) && true
+ end
+
def TkFont.actual(fnt, option=nil)
fnt = '{}' if fnt == ''
if fnt.kind_of?(TkFont)
@@ -171,6 +210,9 @@ class TkFont
actual_core(fnt, nil, option)
end
end
+ def TkFont.actual_hash(fnt, option=nil)
+ Hash[TkFont.actual_hash(fnt, option)]
+ end
def TkFont.actual_displayof(fnt, win, option=nil)
fnt = '{}' if fnt == ''
@@ -181,6 +223,9 @@ class TkFont
actual_core(fnt, win, option)
end
end
+ def TkFont.actual_hash_displayof(fnt, option=nil)
+ Hash[TkFont.actual_hash_displayof(fnt, option)]
+ end
def TkFont.configure(fnt, slot, value=None)
if fnt.kind_of?(TkFont)
@@ -234,6 +279,33 @@ class TkFont
metrics_core(fnt, nil, option)
end
end
+ def TkFont.metrics_hash(fnt, option=nil)
+ if option
+ val = TkFont.metrics(fnt, option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[TkFont.metrics(fnt)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
+ end
def TkFont.metrics_displayof(fnt, win, option=nil)
fnt = '{}' if fnt == ''
@@ -244,13 +316,40 @@ class TkFont
metrics_core(fnt, win, option)
end
end
+ def TkFont.metrics_hash_displayof(fnt, win, option=nil)
+ if option
+ val = TkFont.metrics_displayof(fnt, win, option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[TkFont.metrics_displayof(fnt, win, option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
+ end
def TkFont.families(win=nil)
case (Tk::TK_VERSION)
- when /^4\.*/
+ when /^4\..*/
['fixed']
- when /^8\.*/
+ when /^8\..*/
if win
tk_split_simplelist(tk_call('font', 'families', '-displayof', win))
else
@@ -261,13 +360,16 @@ class TkFont
def TkFont.names
case (Tk::TK_VERSION)
- when /^4\.*/
+ when /^4\..*/
r = ['fixed']
r += ['a14', 'k14'] if JAPANIZED_TK
- Tk_FontNameTBL.each_value{|obj| r.push(obj)}
- r | []
+ Tk_FontNameTBL.mutex.synchronize{
+ Tk_FontNameTBL.each_value{|obj| r.push(obj)}
+ }
+ #r | []
+ r.uniq
- when /^8\.*/
+ when /^8\..*/
tk_split_simplelist(tk_call('font', 'names'))
end
@@ -285,10 +387,15 @@ class TkFont
end
def TkFont.get_obj(name)
+ name = name.to_s
if name =~ /^(@font[0-9]+)(|c|l|k)$/
- Tk_FontNameTBL[$1]
+ Tk_FontNameTBL.mutex.synchronize{
+ Tk_FontNameTBL[$1]
+ }
else
- nil
+ Tk_FontNameTBL.mutex.synchronize{
+ Tk_FontNameTBL[name]
+ }
end
end
@@ -298,7 +405,7 @@ class TkFont
path = [win, tag, key].join(';')
case (Tk::TK_VERSION)
- when /^4\.*/
+ when /^4\..*/
regexp = /^-(|kanji)#{key} /
conf_list = tk_split_simplelist(tk_call(*args)).
@@ -324,7 +431,7 @@ class TkFont
TkFont.new(ltn, knj).call_font_configure([path, key], *args)
- when /^8\.*/
+ when /^8\.[0-4]/
regexp = /^-#{key} /
conf_list = tk_split_simplelist(tk_call(*args)).
@@ -360,26 +467,66 @@ class TkFont
compound = []
end
if compound == []
- TkFont.new(fnt).call_font_configure([path, key], *args)
+ if TkFont.is_system_font?(fnt)
+ TkNamedFont.new(fnt).call_font_configure([path, key], *args)
+ else
+ TkFont.new(fnt).call_font_configure([path, key], *args)
+ end
else
TkFont.new(compound[0],
compound[1]).call_font_configure([path, key], *args)
end
end
+
+ when /^8\.[5-9]/, /^9\..*/
+ regexp = /^-#{key} /
+
+ conf_list = tk_split_simplelist(tk_call(*args)).
+ find_all{|prop| prop =~ regexp}.
+ collect{|prop| tk_split_simplelist(prop)}
+
+ if conf_list.size == 0
+ raise RuntimeError, "the widget may not support 'font' option"
+ end
+
+ args << {}
+
+ optkey = "-#{key}"
+
+ info = conf_list.find{|conf| conf[0] == optkey}
+ fnt = info[-1]
+ 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
+ else
+ if TkFont.is_system_font?(fnt)
+ TkNamedFont.new(fnt).call_font_configure([path, key], *args)
+ else
+ TkFont.new(fnt).call_font_configure([path, key], *args)
+ end
+ end
end
end
def TkFont.used_on(path=nil)
- if path
- Tk_FontUseTBL[path]
- else
- Tk_FontUseTBL.values | []
- end
+ Tk_FontUseTBL.mutex.synchronize{
+ if path
+ Tk_FontUseTBL[path]
+ else
+ # Tk_FontUseTBL.values | []
+ Tk_FontUseTBL.values.uniq
+ end
+ }
end
def TkFont.failsafe(font)
begin
- if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK
tk_call('font', 'failsafe', font)
end
rescue
@@ -392,15 +539,20 @@ class TkFont
private
###################################
def init_dummy_fontobj
- @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
- Tk_FontID[1].succ!
- Tk_FontNameTBL[@id] = self
+ Tk_FontID.mutex.synchronize{
+ @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
+ Tk_FontID[1].succ!
+ }
+ Tk_FontNameTBL.mutex.synchronize{
+ Tk_FontNameTBL[@id] = self
+ }
- @latin_desscendant = nil
- @kanji_desscendant = nil
+ # @latin_desscendant = nil
+ # @kanji_desscendant = nil
+ @descendant = [nil, nil] # [latin, kanji]
case (Tk::TK_VERSION)
- when /^4\.*/
+ when /^4\..*/
@latinfont = ""
@kanjifont = ""
if JAPANIZED_TK
@@ -436,13 +588,23 @@ class TkFont
ltn = '{}' if ltn == ''
knj = '{}' if knj == ''
- # @id = Tk_FontID.join('')
- @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
- Tk_FontID[1].succ!
- Tk_FontNameTBL[@id] = self
+ Tk_FontID.mutex.synchronize{
+ # @id = Tk_FontID.join('')
+ @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
+ Tk_FontID[1].succ!
+ }
+ Tk_FontNameTBL.mutex.synchronize{
+ Tk_FontNameTBL[@id] = self
+ }
+
+ # @latin_desscendant = nil
+ # @kanji_desscendant = nil
+ @descendant = [nil, nil] # [latin, kanji]
- @latin_desscendant = nil
- @kanji_desscendant = nil
+ # @latinfont = @id + 'l'
+ # @kanjifont = @id + 'k'
+ # @compoundfont = @id + 'c'
+ # @fontslot = {}
if knj.kind_of?(Hash) && !keys
keys = knj
@@ -474,7 +636,7 @@ class TkFont
if ltn
if JAPANIZED_TK && !knj
- if Tk::TK_VERSION =~ /^4.*/
+ if Tk::TK_VERSION =~ /^4..*/
knj = DEFAULT_KANJI_FONT_NAME
else
knj = ltn
@@ -488,6 +650,19 @@ 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: '*'
@@ -612,9 +787,14 @@ class TkFont
if JAPANIZED_TK
@compoundfont = [[@latinfont], [@kanjifont]]
@fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
+ # @fontslot.clear
+ # @fontslot['font'] = @latinfont
+ # @fontslot['kanjifont'] = @kanjifont
else
@compoundfont = @latinfont
@fontslot = {'font'=>@latinfont}
+ # @fontslot.clear
+ # @fontslot['font'] = @latinfont
end
end
@@ -740,6 +920,7 @@ class TkFont
end
@fontslot = {'font'=>@compoundfont}
+ # @fontslot['font'] = @compoundfont
begin
tk_call('font', 'create', @compoundfont,
'-compound', [@latinfont, @kanjifont], *hash_kv(keys))
@@ -820,6 +1001,7 @@ class TkFont
end
@fontslot = {'font'=>@compoundfont}
+ # @fontslot['font'] = @compoundfont
tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
end
end
@@ -846,10 +1028,12 @@ class TkFont
begin
configinfo name
rescue
- fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
+ super(id, *args)
+# 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
+ super(id, *args)
+# fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
end
end
@@ -872,25 +1056,39 @@ class TkFont
keys = _symbolkey2str(args.pop).update(fontslot)
args.concat(hash_kv(keys))
- tk_call(*args)
- Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
+ begin
+ tk_call(*args)
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
+ Tk_FontUseTBL.mutex.synchronize{
+ Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
+ }
self
end
def used
ret = []
- Tk_FontUseTBL.each{|key,value|
+ table = nil
+ Tk_FontUseTBL.mutex.synchronize{
+ table = Tk_FontUseTBL.clone # to avoid deadlock
+ }
+ table.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 winobj.kind_of? TkText
+ if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
if optkey
ret.push([winobj, winobj.tagid2obj(tag), optkey])
else
ret.push([winobj, winobj.tagid2obj(tag)])
end
- elsif winobj.kind_of? TkCanvas
+ #elsif winobj.kind_of? TkCanvas
+ elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
if optkey
ret.push([winobj, tagobj, optkey])
@@ -910,7 +1108,8 @@ class TkFont
ret.push([winobj, tag])
end
end
- elsif winobj.kind_of? TkMenu
+ #elsif winobj.kind_of? TkMenu
+ elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
if optkey
ret.push([winobj, tag, optkey])
else
@@ -942,6 +1141,8 @@ class TkFont
@compoundfont
end
alias font_id font
+ alias name font
+ alias to_s font
def latin_font_id
@latinfont
@@ -949,11 +1150,18 @@ class TkFont
def latin_font
# @latinfont
+ if @descendant[0] # [0] -> latin
+ @descendant[0]
+ else
+ @descendant[0] = DescendantFont.new(self, 'latin')
+ end
+=begin
if @latin_descendant
@latin_descendant
else
@latin_descendant = DescendantFont.new(self, 'latin')
end
+=end
end
alias latinfont latin_font
@@ -963,50 +1171,87 @@ class TkFont
def kanji_font
# @kanjifont
+ if @descendant[1] # [1] -> kanji
+ @descendant[1]
+ else
+ @descendant[1] = DescendantFont.new(self, 'kanji')
+ end
+=begin
if @kanji_descendant
@kanji_descendant
else
@kanji_descendant = DescendantFont.new(self, 'kanji')
end
+=end
end
alias kanjifont kanji_font
def actual(option=nil)
actual_core(@compoundfont, nil, option)
end
+ def actual_hash(option=nil)
+ Hash[actual(option)]
+ end
def actual_displayof(win, option=nil)
win = '.' unless win
actual_core(@compoundfont, win, option)
end
+ def actual_hash_displayof(win, option=nil)
+ Hash[actual_displayof(win, option)]
+ end
def latin_actual(option=nil)
- actual_core(@latinfont, nil, option)
+ if @latinfont == nil
+ actual_core(@compoundfont, nil, option) # use @compoundfont
+ else
+ actual_core(@latinfont, nil, option)
+ end
+ end
+ def latin_actual_hash(option=nil)
+ Hash[latin_actual(option)]
end
def latin_actual_displayof(win, option=nil)
win = '.' unless win
- actual_core(@latinfont, win, option)
+ if @latinfont == nil
+ actual_core(@compoundfont, win, option) # use @compoundfont
+ else
+ actual_core(@latinfont, win, option)
+ end
+ end
+ def latin_actual_hash_displayof(win, option=nil)
+ Hash[latin_actual_displayof(win, option)]
end
def kanji_actual(option=nil)
#if JAPANIZED_TK
- if @kanjifont != ""
+ if @kanjifont == nil
+ actual_core(@compoundfont, nil, option) # use @compoundfont
+ elsif @kanjifont != ""
actual_core(@kanjifont, nil, option)
else
actual_core_tk4x(nil, nil, option)
end
end
+ def kanji_actual_hash(option=nil)
+ Hash[kanji_actual(option)]
+ end
def kanji_actual_displayof(win, option=nil)
#if JAPANIZED_TK
- if @kanjifont != ""
+ if @kanjifont == nil
+ actual_core(@compoundfont, nil, option) # use @compoundfont
+ elsif @kanjifont != ""
win = '.' unless win
actual_core(@kanjifont, win, option)
else
actual_core_tk4x(nil, win, option)
end
end
+ def kanji_actual_hash_displayof(win, option=nil)
+ Hash[kanji_actual_displayof(win, option)]
+ end
def [](slot)
configinfo slot
@@ -1050,10 +1295,15 @@ class TkFont
configinfo(slot)
end
end
+ def latin_current_configinfo(slot=nil)
+ Hash[latin_configinfo(slot)]
+ end
def kanji_configure(slot, value=None)
#if JAPANIZED_TK
- if @kanjifont != ""
+ if @kanjifont == nil
+ configure_core(@compoundfont, slot, value) # use @compoundfont
+ elsif @kanjifont != ""
configure_core(@kanjifont, slot, value)
configure('size'=>configinfo('size')) # to reflect new configuration
else
@@ -1065,13 +1315,18 @@ class TkFont
def kanji_configinfo(slot=nil)
#if JAPANIZED_TK
- if @kanjifont != ""
+ if @kanjifont == nil
+ configure_core(@compoundfont, slot) # use @compoundfont
+ elsif @kanjifont != ""
configinfo_core(@kanjifont, slot)
else
#[]
configinfo(slot)
end
end
+ def kanji_current_configinfo(slot=nil)
+ Hash[kanji_configinfo(slot)]
+ end
def replace(ltn, knj=None)
knj = ltn if knj == None
@@ -1081,12 +1336,30 @@ class TkFont
end
def latin_replace(ltn)
- latin_replace_core(ltn)
- reset_pointadjust
+ if @latinfont
+ latin_replace_core(ltn)
+ reset_pointadjust
+ else
+ # not compound font -> copy properties of ltn
+ latinkeys = {}
+ begin
+ actual_core(ltn).each{|key,val| latinkeys[key] = val}
+ rescue
+ latinkeys = {}
+ end
+ begin
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ rescue
+ # not exist? (deleted?) -> create font
+ tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys))
+ end
+ end
+
self
end
def kanji_replace(knj)
+ return self unless @kanjifont # ignore
kanji_replace_core(knj)
reset_pointadjust
self
@@ -1104,41 +1377,215 @@ class TkFont
def metrics(option=nil)
metrics_core(@compoundfont, nil, option)
end
+ def metrics_hash(option=nil)
+ if option
+ val = metrics(option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[metrics(option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
+ end
def metrics_displayof(win, option=nil)
win = '.' unless win
metrics_core(@compoundfont, win, option)
end
+ def metrics_hash_displayof(win, option=nil)
+ if option
+ val = metrics_displayof(win, option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[metrics_displayof(win, option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
+ end
def latin_metrics(option=nil)
- metrics_core(@latinfont, nil, option)
+ if @latinfont == nil
+ metrics_core(@compoundfont, nil, option) # use @compoundfont
+ else
+ metrics_core(@latinfont, nil, option)
+ end
+ end
+ def latin_metrics_hash(option=nil)
+ if option
+ val = latin_metrics(option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[latin_metrics(option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
end
def latin_metrics_displayof(win, option=nil)
win = '.' unless win
- metrics_core(@latinfont, win, option)
+ if @latinfont == nil
+ metrics_core(@compoundfont, win, option) # use @compoundfont
+ else
+ metrics_core(@latinfont, win, option)
+ end
+ end
+ def latin_metrics_hash_displayof(win, option=nil)
+ if option
+ val = latin_metrics_displayof(win, option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[latin_metrics_displayof(win, option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
end
def kanji_metrics(option=nil)
- if JAPANIZED_TK
+ if @latinfont == nil
+ metrics_core(@compoundfont, nil, option) # use @compoundfont
+ elsif JAPANIZED_TK
metrics_core(@kanjifont, nil, option)
else
metrics_core_tk4x(nil, nil, option)
end
end
+ def kanji_metrics_hash(option=nil)
+ if option
+ val = kanji_metrics(option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[kanji_metrics(option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
+ end
def kanji_metrics_displayof(win, option=nil)
- if JAPANIZED_TK
- win = '.' unless win
+ win = '.' unless win
+ if @latinfont == nil
+ metrics_core(@compoundfont, win, option) # use @compoundfont
+ elsif JAPANIZED_TK
metrics_core(@kanjifont, win, option)
else
metrics_core_tk4x(nil, win, option)
end
end
+ def kanji_metrics_hash_displayof(win, option=nil)
+ if option
+ val = kanji_metrics_displayof(win, option)
+ case TkFont::MetricsType[option.to_s]
+ when ?n
+ val = TkComm::num_or_str(val)
+ when ?b
+ val = TkComm::bool(val)
+ else
+ # do nothing
+ end
+ return val
+ end
+
+ h = Hash[kanji_metrics_displayof(win, option)]
+ h.keys.each{|k|
+ case TkFont::MetricsType[k.to_s]
+ when ?n
+ h[k] = TkComm::num_or_str(h[k])
+ when ?b
+ h[k] = TkComm::bool(h[k])
+ else
+ # do nothing
+ end
+ }
+ h
+ end
def reset_pointadjust
begin
- if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK
configure('pointadjust' => latin_actual.assoc('size')[1].to_f /
kanji_actual.assoc('size')[1].to_f )
end
@@ -1151,7 +1598,7 @@ class TkFont
# private alias
###################################
case (Tk::TK_VERSION)
- when /^4\.*/
+ when /^4\..*/
alias create_latinfont create_latinfont_tk4x
alias create_kanjifont create_kanjifont_tk4x
alias create_compoundfont create_compoundfont_tk4x
@@ -1184,24 +1631,12 @@ class TkFont
###################################
=begin
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
- def dup
TkFont.new(self)
end
def clone
TkFont.new(self)
end
+=end
end
module TkFont::CoreMethods
@@ -1446,7 +1881,7 @@ module TkFont::CoreMethods
end
else
l = tk_split_simplelist(tk_call('font', 'configure', font))
- r = {}
+ h = {}
while key=l.shift
if key == '-compound'
l.shift
@@ -1455,45 +1890,57 @@ module TkFont::CoreMethods
val = l.shift
case TkFont::OptionType[key]
when ?n
- r.push [key, num_or_str(val)]
+ h[key] = num_or_str(val)
when ?b
- r.push [key, bool(val)]
+ h[key] = bool(val)
else
- r.push [key, val]
+ h[key] = val
end
end
end
- r
+ h
end
end
def delete_core_tk4x
- TkFont::Tk_FontNameTBL.delete(@id)
- TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
+ TkFont::Tk_FontNameTBL.mutex.synchronize{
+ TkFont::Tk_FontNameTBL.delete(@id)
+ }
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
+ TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
+ }
end
def delete_core_tk8x
begin
- tk_call('font', 'delete', @latinfont)
+ tk_call('font', 'delete', @latinfont) if @latinfont
rescue
end
begin
- tk_call('font', 'delete', @kanjifont)
+ tk_call('font', 'delete', @kanjifont) if @kanjifont
rescue
end
begin
- tk_call('font', 'delete', @compoundfont)
+ tk_call('font', 'delete', @compoundfont) if @compoundfont
rescue
end
- TkFont::Tk_FontNameTBL.delete(@id)
- TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
+ TkFont::Tk_FontNameTBL.mutex.synchronize{
+ TkFont::Tk_FontNameTBL.delete(@id)
+ }
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
+ TkFont::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|
+ table = nil
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
+ table = TkFont::Tk_FontUseTBL.clone
+ }
+ table.each{|w, fobj|
if self == fobj
begin
if w.include?(';')
@@ -1501,11 +1948,14 @@ module TkFont::CoreMethods
optkey = 'font' if optkey == nil || optkey == ''
winobj = tk_tcl2ruby(win)
# winobj.tagfont_configure(tag, {'font'=>@latinfont})
- if winobj.kind_of? TkText
+ #if winobj.kind_of? TkText
+ if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
- elsif winobj.kind_of? TkCanvas
+ #elsif winobj.kind_of? TkCanvas
+ elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
- elsif winobj.kind_of? TkMenu
+ #elsif winobj.kind_of? TkMenu
+ elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
else
raise RuntimeError, "unknown widget type"
@@ -1515,7 +1965,9 @@ module TkFont::CoreMethods
tk_call(w, 'configure', '-font', @latinfont)
end
rescue
- TkFont::Tk_FontUseTBL.delete(w)
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
+ TkFont::Tk_FontUseTBL.delete(w)
+ }
end
end
}
@@ -1528,7 +1980,11 @@ module TkFont::CoreMethods
create_kanjifont_tk4x(knj)
@compoundfont[1] = [@kanjifont]
@fontslot['kanjifont'] = @kanjifont
- TkFont::Tk_FontUseTBL.dup.each{|w, fobj|
+ table = nil
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
+ table = TkFont::Tk_FontUseTBL.clone
+ }
+ table.dup.each{|w, fobj|
if self == fobj
begin
if w.include?(';')
@@ -1536,11 +1992,14 @@ module TkFont::CoreMethods
optkey = 'kanjifont' unless optkey
winobj = tk_tcl2ruby(win)
# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
- if winobj.kind_of? TkText
+ #if winobj.kind_of? TkText
+ if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
- elsif winobj.kind_of? TkCanvas
+ #elsif winobj.kind_of? TkCanvas
+ elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
- elsif winobj.kind_of? TkMenu
+ #elsif winobj.kind_of? TkMenu
+ elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
else
raise RuntimeError, "unknown widget type"
@@ -1550,7 +2009,9 @@ module TkFont::CoreMethods
tk_call(w, 'configure', '-kanjifont', @kanjifont)
end
rescue
- TkFont::Tk_FontUseTBL.delete(w)
+ Tk_FontUseTBL.mutex.synchronize{
+ TkFont::Tk_FontUseTBL.delete(w)
+ }
end
end
}
@@ -1615,8 +2076,11 @@ module TkFont::CoreMethods
rescue
latinkeys = {}
end
- if latinkeys != {}
+ begin
tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ rescue
+ # not exist? (deleted?) -> create font
+ tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys))
end
end
self
@@ -1708,6 +2172,13 @@ module TkFont::CoreMethods
r = []
while key=l.shift
r.push [key[1..-1], l.shift.to_i]
+=begin
+ if key == '-fixed' # boolean value
+ r.push [key[1..-1], bool(l.shift)]
+ else
+ r.push [key[1..-1], l.shift.to_i]
+ end
+=end
end
r
end
@@ -1717,7 +2188,7 @@ module TkFont::CoreMethods
# private alias
###################################
case (Tk::TK_VERSION)
- when /^4\.*/
+ when /^4\..*/
alias actual_core actual_core_tk4x
alias configure_core configure_core_tk4x
alias configinfo_core configinfo_core_tk4x
@@ -1757,3 +2228,117 @@ class TkFont
include TkFont::CoreMethods
extend TkFont::CoreMethods
end
+
+class TkNamedFont < TkFont
+ # for built-in named fonts
+ def TkNamedFont.find(name)
+ name = name.to_s
+ unless (obj = Tk_FontNameTBL[name])
+ obj = self.new(name) if TkFont.is_system_font?(name)
+ end
+ obj
+ end
+
+ def TkNamedFont.new(name, keys=nil)
+ name = name.to_s
+ obj = nil
+ Tk_FontNameTBL.mutex.synchronize{
+ unless (obj = Tk_FontNameTBL[name])
+ (obj = self.allocate).instance_eval{
+ @id = @compoundfont = name.to_s
+ @latinfont = nil
+ @kanjifont = nil
+ @descendant = [self, self] # [latin, kanji] : dummy
+ Tk_FontNameTBL[@id] = self
+ }
+ end
+ }
+ obj.instance_eval{ initialize(name, keys) }
+ obj
+ end
+
+ ###########################
+ private
+ ###########################
+ def initialize(name, keys=nil)
+ @id = @compoundfont = name.to_s
+
+ # if not exist named font, create it.
+ begin
+ if keys
+ tk_call('font', 'configure', @compoundfont, keys)
+ else
+ tk_call('font', 'configure', @compoundfont)
+ end
+ rescue
+ # the named font doesn't exist -> create
+ if keys
+ tk_call('font', 'create', @compoundfont, keys)
+ else
+ tk_call('font', 'create', @compoundfont)
+ end
+ end
+ end
+
+ def create_latinfont(fnt)
+ # ignore
+ end
+ def create_kanjifont(fnt)
+ # ignore
+ end
+ def create_compoundfont(ltn, knj, keys)
+ # ignore
+ end
+
+ ###########################
+ public
+ ###########################
+ def latin_font_id
+ @compoundfont
+ end
+ def kanji_font_id
+ @compoundfont
+ end
+end
+
+#######################################
+# define system font names
+#######################################
+if Tk::TCL_MAJOR_VERSION > 8 ||
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
+ # add standard fonts of Tcl/Tk 8.5+
+ TkFont::SYSTEM_FONT_NAMES.add [
+ 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont',
+ 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont',
+ 'TkIconFont', 'TkTooltipFont'
+ ]
+end
+
+# platform-specific fonts
+# -- windows
+TkFont::SYSTEM_FONT_NAMES.add [
+ 'ansifixed', 'ansi', 'device', 'oemfixed', 'systemfixed', 'system'
+]
+
+# -- macintosh, macosx
+TkFont::SYSTEM_FONT_NAMES.add ['system', 'application']
+
+if Tk::TCL_MAJOR_VERSION > 8 ||
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
+ TkFont::SYSTEM_FONT_NAMES.add ['menu']
+end
+
+# -- macosx (Aqua theme)
+if Tk::TCL_MAJOR_VERSION > 8 ||
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
+ TkFont::SYSTEM_FONT_NAMES.add [
+ 'systemSystemFont', 'systemEmphasizedSystemFont',
+ 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont',
+ 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont',
+ 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont',
+ 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont',
+ 'systemPushButtonFont', 'systemUtilityWindowTitleFont',
+ 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont',
+ 'systemDetailSystemFont', 'systemDetailEmphasizedSystemFont'
+ ]
+end
diff --git a/ext/tk/lib/tk/frame.rb b/ext/tk/lib/tk/frame.rb
index 519b9ae8a6..263b160f29 100644
--- a/ext/tk/lib/tk/frame.rb
+++ b/ext/tk/lib/tk/frame.rb
@@ -3,7 +3,7 @@
#
require 'tk'
-class TkFrame<TkWindow
+class Tk::Frame<TkWindow
TkCommandNames = ['frame'.freeze].freeze
WidgetClassName = 'Frame'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -30,6 +30,11 @@ 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]
@@ -121,3 +126,6 @@ class TkFrame<TkWindow
end
end
end
+
+#TkFrame = Tk::Frame unless Object.const_defined? :TkFrame
+Tk.__set_toplevel_aliases__(:Tk, Tk::Frame, :TkFrame)
diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb
index 10fdf3569b..0dfd7263a7 100644
--- a/ext/tk/lib/tk/grid.rb
+++ b/ext/tk/lib/tk/grid.rb
@@ -22,6 +22,7 @@ module TkGrid
list(tk_call_without_enc('grid', 'bbox', *args))
end
+=begin
def configure(win, *args)
if args[-1].kind_of?(Hash)
opts = args.pop
@@ -53,6 +54,48 @@ module TkGrid
tk_call_without_enc('grid', 'configure', *params)
end
end
+=end
+ def configure(*args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ fail ArgumentError, 'no widget is given' if args.empty?
+ params = []
+ args.flatten(1).each{|win|
+ case win
+ when '-', ?- # RELATIVE PLACEMENT (increase columnspan)
+ params.push('-')
+ when /^-+$/ # RELATIVE PLACEMENT (increase columnspan)
+ params.concat(win.to_s.split(//))
+ when '^', ?^ # RELATIVE PLACEMENT (increase rowspan)
+ params.push('^')
+ when /^\^+$/ # RELATIVE PLACEMENT (increase rowspan)
+ params.concat(win.to_s.split(//))
+ when 'x', :x, ?x, nil, '' # RELATIVE PLACEMENT (empty column)
+ params.push('x')
+ when /^x+$/ # RELATIVE PLACEMENT (empty column)
+ params.concat(win.to_s.split(//))
+ else
+ params.push(_epath(win))
+ end
+ }
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push(_epath(v)) # have to use 'epath' (hash_kv() is unavailable)
+ }
+ if Tk::TCL_MAJOR_VERSION < 8 ||
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION <= 3)
+ if params[0] == '-' || params[0] == 'x' || params[0] == '^'
+ tk_call_without_enc('grid', *params)
+ else
+ tk_call_without_enc('grid', 'configure', *params)
+ end
+ else
+ tk_call_without_enc('grid', 'configure', *params)
+ end
+ end
alias grid configure
def columnconfigure(master, index, args)
@@ -61,12 +104,14 @@ module TkGrid
tk_call_without_enc("grid", 'columnconfigure',
master, index, *hash_kv(args))
end
+ alias column columnconfigure
def rowconfigure(master, index, args)
# master = master.epath if master.kind_of?(TkObject)
master = _epath(master)
tk_call_without_enc("grid", 'rowconfigure', master, index, *hash_kv(args))
end
+ alias row rowconfigure
def columnconfiginfo(master, index, slot=nil)
# master = master.epath if master.kind_of?(TkObject)
@@ -189,10 +234,10 @@ module TkGrid
list(tk_call_without_enc('grid', 'slaves', master, *hash_kv(args)))
end
- module_function :bbox, :forget, :propagate, :info
+ module_function :anchor, :bbox, :add, :forget, :propagate, :info
module_function :remove, :size, :slaves, :location
module_function :grid, :configure, :columnconfigure, :rowconfigure
- module_function :columnconfiginfo, :rowconfiginfo
+ module_function :column, :row, :columnconfiginfo, :rowconfiginfo
end
=begin
def TkGrid(win, *args)
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index e3880106a4..dffdc19644 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -10,9 +10,16 @@ class TkImage<TkObject
TkCommandNames = ['image'.freeze].freeze
Tk_IMGTBL = TkCore::INTERP.create_table
- Tk_Image_ID = ['i'.freeze, '00000'.taint].freeze
- TkCore::INTERP.init_ip_env{ Tk_IMGTBL.clear }
+ (Tk_Image_ID = ['i'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ Tk_IMGTBL.mutex.synchronize{ Tk_IMGTBL.clear }
+ }
def self.new(keys=nil)
if keys.kind_of?(Hash)
@@ -27,7 +34,10 @@ class TkImage<TkObject
obj = name
else
name = _get_eval_string(name)
- obj = Tk_IMGTBL[name]
+ obj = nil
+ Tk_IMGTBL.mutex.synchronize{
+ obj = Tk_IMGTBL[name]
+ }
end
if obj
if !(keys[:without_creating] || keys['without_creating'])
@@ -43,7 +53,13 @@ class TkImage<TkObject
end
end
end
- super(keys)
+ (obj = self.allocate).instance_eval{
+ Tk_IMGTBL.mutex.synchronize{
+ initialize(keys)
+ Tk_IMGTBL[@path] = self
+ }
+ }
+ obj
end
def initialize(keys=nil)
@@ -55,19 +71,22 @@ class TkImage<TkObject
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!
+ Tk_Image_ID.mutex.synchronize{
+ # @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
- Tk_IMGTBL[@path] = self
end
def delete
- Tk_IMGTBL.delete(@id) if @id
+ Tk_IMGTBL.mutex.synchronize{
+ Tk_IMGTBL.delete(@id) if @id
+ }
tk_call_without_enc('image', 'delete', @path)
self
end
@@ -85,8 +104,10 @@ class TkImage<TkObject
end
def TkImage.names
- Tk.tk_call_without_enc('image', 'names').split.collect!{|id|
- (Tk_IMGTBL[id])? Tk_IMGTBL[id] : id
+ Tk_IMGTBL.mutex.synchronize{
+ Tk.tk_call_without_enc('image', 'names').split.collect!{|id|
+ (Tk_IMGTBL[id])? Tk_IMGTBL[id] : id
+ }
}
end
@@ -96,6 +117,11 @@ class TkImage<TkObject
end
class TkBitmapImage<TkImage
+ def __strval_optkeys
+ super() + ['maskdata', 'maskfile']
+ end
+ private :__strval_optkeys
+
def initialize(*args)
@type = 'bitmap'
super(*args)
@@ -130,7 +156,7 @@ class TkPhotoImage<TkImage
self
end
- def cget(option)
+ def cget_strict(option)
case option.to_s
when 'data', 'file'
tk_send 'cget', '-' << option.to_s
@@ -138,6 +164,23 @@ class TkPhotoImage<TkImage
tk_tcl2ruby(tk_send('cget', '-' << option.to_s))
end
end
+ def cget(option)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(option)
+ else
+ begin
+ cget_strict(option)
+ rescue => e
+ if current_configinfo.has_key?(option.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
def copy(src, *opts)
if opts.size == 0
diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb
index ac04cdefe9..9c6a98d0f8 100644
--- a/ext/tk/lib/tk/itemconfig.rb
+++ b/ext/tk/lib/tk/itemconfig.rb
@@ -8,6 +8,11 @@ require 'tk/itemfont.rb'
module TkItemConfigOptkeys
include TkUtil
+ def __item_optkey_aliases(id)
+ {}
+ end
+ private :__item_optkey_aliases
+
def __item_numval_optkeys(id)
[]
end
@@ -19,13 +24,19 @@ 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']
+ [
+ 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile',
+ 'activebackground', 'activeforeground', 'background',
+ 'disabledforeground', 'disabledbackground', 'foreground',
+ 'highlightbackground', 'highlightcolor', 'insertbackground',
+ 'selectbackground', 'selectforeground', 'troughcolor'
+ ]
end
private :__item_strval_optkeys
@@ -109,6 +120,14 @@ module TkItemConfigMethod
include TkTreatItemFont
include TkItemConfigOptkeys
+ def TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ @mode || false
+ end
+ def TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
+ fail SecurityError, "can't change the mode" if $SAFE>=4
+ @mode = (mode)? true: false
+ end
+
def __item_cget_cmd(id)
# maybe need to override
[self.path, 'itemcget', id]
@@ -143,7 +162,7 @@ module TkItemConfigMethod
################################################
- def itemcget(tagOrId, option)
+ def __itemcget_core(tagOrId, option)
orig_opt = option
option = option.to_s
@@ -151,6 +170,11 @@ module TkItemConfigMethod
fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
end
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == option}
+ if real_name
+ option = real_name.to_s
+ end
+
if ( method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[option] )
optval = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
begin
@@ -218,11 +242,45 @@ module TkItemConfigMethod
tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")), true)
end
end
+ private :__itemcget_core
- def itemconfigure(tagOrId, slot, value=None)
+ def itemcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __itemcget_core(tagOrId, option)
+ else
+ begin
+ __itemcget_core(tagOrId, option)
+ rescue => e
+ begin
+ if __current_itemconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+ def itemcget_strict(tagOrId, option)
+ # never use TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __itemcget_core(tagOrId, option)
+ end
+
+ def __itemconfigure_core(tagOrId, slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
+ __item_optkey_aliases(tagid(tagOrId)).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if slot.has_key?(alias_name)
+ slot[real_name.to_s] = slot.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(tagid(tagOrId)).each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, tagOrId, value) if value
@@ -259,6 +317,11 @@ module TkItemConfigMethod
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
defkey, undefkey = conf
if value
@@ -282,8 +345,58 @@ module TkItemConfigMethod
end
self
end
+ private :__itemconfigure_core
- def itemconfiginfo(tagOrId, slot = nil)
+ def __check_available_itemconfigure_options(tagOrId, keys)
+ id = tagid(tagOrId)
+
+ availables = self.__current_itemconfiginfo(id).keys
+
+ # add non-standard keys
+ availables |= __font_optkeys.map{|k|
+ [k.to_s, "latin#{k}", "ascii#{k}", "kanji#{k}"]
+ }.flatten
+ availables |= __item_methodcall_optkeys(id).keys.map{|k| k.to_s}
+ availables |= __item_keyonly_optkeys(id).keys.map{|k| k.to_s}
+
+ keys = _symbolkey2str(keys)
+
+ keys.delete_if{|k, v| !(availables.include?(k))}
+ end
+
+ def itemconfigure(tagOrId, slot, value=None)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __itemconfigure_core(tagOrId, slot, value)
+ else
+ if slot.kind_of?(Hash)
+ begin
+ __itemconfigure_core(tagOrId, slot)
+ rescue
+ slot = __check_available_itemconfigure_options(tagOrId, slot)
+ __itemconfigure_core(tagOrId, slot) unless slot.empty?
+ end
+ else
+ begin
+ __itemconfigure_core(tagOrId, slot, value)
+ rescue => e
+ begin
+ if __current_itemconfiginfo(tagOrId).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+ self
+ end
+
+ def __itemconfiginfo_core(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
fontkey = $2
@@ -293,6 +406,10 @@ module TkItemConfigMethod
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
|| conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ fnt = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
+ end
conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), fontkey)
elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
&& conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
@@ -304,6 +421,12 @@ module TkItemConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
@@ -588,7 +711,7 @@ module TkItemConfigMethod
if v.empty?
conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
end
end
@@ -629,6 +752,10 @@ module TkItemConfigMethod
fontconf = ret.assoc(optkey)
if fontconf && fontconf.size > 2
ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
+ fnt = fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
+ end
fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
ret.push(fontconf)
end
@@ -652,7 +779,11 @@ module TkItemConfigMethod
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
|| conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = fontobj(tagid(tagOrId), fontkey)
+ fnt = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
+ end
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), fontkey)
{ conf.shift => conf }
elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
&& conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
@@ -667,6 +798,12 @@ module TkItemConfigMethod
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
@@ -1000,6 +1137,10 @@ module TkItemConfigMethod
ret.delete('latin' << optkey)
ret.delete('ascii' << optkey)
ret.delete('kanji' << optkey)
+ fnt = fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+ if TkFont.is_system_font?(fnt)
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkNamedFont.new(fnt)
+ end
fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
ret[optkey] = fontconf
end
@@ -1014,13 +1155,32 @@ module TkItemConfigMethod
end
end
end
+ private :__itemconfiginfo_core
- def current_itemconfiginfo(tagOrId, slot = nil)
+ def itemconfiginfo(tagOrId, slot = nil)
+ if slot && TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ begin
+ __itemconfiginfo_core(tagOrId, slot)
+ rescue => e
+ begin
+ __itemconfiginfo_core(tagOrId)
+ # not tag error -> option is unknown
+ Array.new(__item_configinfo_struct.values.max).unshift(slot.to_s)
+ rescue
+ fail e # tag error
+ end
+ end
+ else
+ __itemconfiginfo_core(tagOrId, slot)
+ end
+ end
+
+ def __current_itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
org_slot = slot
begin
- conf = itemconfiginfo(tagOrId, slot)
+ conf = __itemconfiginfo_core(tagOrId, slot)
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
|| conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
return {conf[0] => conf[-1]}
@@ -1031,20 +1191,25 @@ module TkItemConfigMethod
"there is a configure alias loop about '#{org_slot}'"
else
ret = {}
- itemconfiginfo(tagOrId).each{|conf|
+ __itemconfiginfo_core(tagOrId).each{|conf|
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
|| conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
ret[conf[0]] = conf[-1]
end
}
+
ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
- itemconfiginfo(slot).each{|key, conf|
+ __itemconfiginfo_core(tagOrId, slot).each{|key, conf|
ret[key] = conf[-1] if conf.kind_of?(Array)
}
ret
end
end
+
+ def current_itemconfiginfo(tagOrId, slot = nil)
+ __current_itemconfiginfo(tagOrId, slot)
+ end
end
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
index ab9e3ff6c9..4c5c917c57 100644
--- a/ext/tk/lib/tk/itemfont.rb
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -94,7 +94,16 @@ module TkTreatItemFont
*(__item_config_cmd(tagid(tagOrId)) << {}))
next
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ rescue => e
+ # ignore
+ end
+ end
end
end
next
@@ -147,7 +156,16 @@ module TkTreatItemFont
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ rescue => e
+ # ignore
+ end
+ end
next
end
@@ -198,7 +216,16 @@ module TkTreatItemFont
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ knj = hash_kv(knj) if knj.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ rescue => e
+ # ignore
+ end
+ end
next
end
diff --git a/ext/tk/lib/tk/label.rb b/ext/tk/lib/tk/label.rb
index 8b45db9b30..80b3d778f1 100644
--- a/ext/tk/lib/tk/label.rb
+++ b/ext/tk/lib/tk/label.rb
@@ -3,7 +3,7 @@
#
require 'tk'
-class TkLabel<TkWindow
+class Tk::Label<TkWindow
TkCommandNames = ['label'.freeze].freeze
WidgetClassName = 'Label'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -16,3 +16,6 @@ class TkLabel<TkWindow
#end
#private :create_self
end
+
+#TkLabel = Tk::Label unless Object.const_defined? :TkLabel
+Tk.__set_toplevel_aliases__(:Tk, Tk::Label, :TkLabel)
diff --git a/ext/tk/lib/tk/labelframe.rb b/ext/tk/lib/tk/labelframe.rb
index fd16d3419d..995b5b7e72 100644
--- a/ext/tk/lib/tk/labelframe.rb
+++ b/ext/tk/lib/tk/labelframe.rb
@@ -4,7 +4,7 @@
require 'tk'
require 'tk/frame'
-class TkLabelFrame<TkFrame
+class Tk::LabelFrame<Tk::Frame
TkCommandNames = ['labelframe'.freeze].freeze
WidgetClassName = 'Labelframe'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -16,5 +16,14 @@ 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
+
+Tk::Labelframe = Tk::LabelFrame
+#TkLabelFrame = Tk::LabelFrame unless Object.const_defined? :TkLabelFrame
+#TkLabelframe = Tk::Labelframe unless Object.const_defined? :TkLabelframe
+Tk.__set_toplevel_aliases__(:Tk, Tk::LabelFrame, :TkLabelFrame, :TkLabelframe)
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb
index 295a9bf88c..bb039ffb0e 100644
--- a/ext/tk/lib/tk/listbox.rb
+++ b/ext/tk/lib/tk/listbox.rb
@@ -15,7 +15,7 @@ module TkListItemConfig
private :__item_listval_optkeys
end
-class TkListbox<TkTextWin
+class Tk::Listbox<TkTextWin
include TkListItemConfig
include Scrollable
@@ -32,6 +32,11 @@ 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)
@@ -272,3 +277,6 @@ class TkListbox<TkTextWin
end
=end
end
+
+#TkListbox = Tk::Listbox unless Object.const_defined? :TkListbox
+Tk.__set_toplevel_aliases__(:Tk, Tk::Listbox, :TkListbox)
diff --git a/ext/tk/lib/tk/macpkg.rb b/ext/tk/lib/tk/macpkg.rb
index 1802073f46..67b0a4bb60 100644
--- a/ext/tk/lib/tk/macpkg.rb
+++ b/ext/tk/lib/tk/macpkg.rb
@@ -20,9 +20,14 @@ module Tk
end
end
-module TkMacResource
+module Tk::MacResource
+end
+#TkMacResource = Tk::MacResource
+Tk.__set_toplevel_aliases__(:Tk, Tk::MacResource, :TkMacResource)
+
+module Tk::MacResource
extend Tk
- extend TkMacResource
+ extend Tk::MacResource
TkCommandNames = ['resource'.freeze].freeze
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index 54b42705e5..3ae0548dd1 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -18,21 +18,33 @@ 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 entrycget_strict itemcget_strict
alias entryconfigure itemconfigure
alias entryconfiginfo itemconfiginfo
alias current_entryconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
-class TkMenu<TkWindow
+class Tk::Menu<TkWindow
+ include Wm
include TkMenuEntryConfig
extend TkMenuSpec
@@ -49,6 +61,16 @@ 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)
@@ -95,6 +117,36 @@ 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?
+ Tk::MenuClone.new(self, parent, type)
+ else
+ Tk::MenuClone.new(self, parent, type, keys)
+ end
+ end
+
def index(idx)
ret = tk_send_without_enc('index', _get_eval_enc_str(idx))
(ret == 'none')? nil: number(ret)
@@ -151,6 +203,9 @@ class TkMenu<TkWindow
tk_send_without_enc('unpost')
self
end
+ def xposition(index)
+ number(tk_send_without_enc('xposition', _get_eval_enc_str(index)))
+ end
def yposition(index)
number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
end
@@ -330,8 +385,12 @@ class TkMenu<TkWindow
=end
end
+#TkMenu = Tk::Menu unless Object.const_defined? :TkMenu
+Tk.__set_toplevel_aliases__(:Tk, Tk::Menu, :TkMenu)
+
-class TkMenuClone<TkMenu
+class Tk::MenuClone<Tk::Menu
+=begin
def initialize(parent, type=None)
widgetname = nil
if parent.kind_of? Hash
@@ -347,10 +406,49 @@ class TkMenuClone<TkMenu
install_win(@parent.path, widgetname)
tk_call_without_enc(@parent.path, 'clone', @path, type)
end
-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
+Tk::CloneMenu = Tk::MenuClone
+#TkMenuClone = Tk::MenuClone unless Object.const_defined? :TkMenuClone
+#TkCloneMenu = Tk::CloneMenu unless Object.const_defined? :TkCloneMenu
+Tk.__set_toplevel_aliases__(:Tk, Tk::MenuClone, :TkMenuClone, :TkCloneMenu)
-module TkSystemMenu
+module Tk::SystemMenu
def initialize(parent, keys=nil)
if parent.kind_of? Hash
keys = _symbolkey2str(parent)
@@ -373,49 +471,80 @@ module TkSystemMenu
end
end
end
+TkSystemMenu = Tk::SystemMenu
-class TkSysMenu_Help<TkMenu
+class Tk::SysMenu_Help<Tk::Menu
# for all platform
- include TkSystemMenu
+ include Tk::SystemMenu
SYSMENU_NAME = 'help'
end
+#TkSysMenu_Help = Tk::SysMenu_Help unless Object.const_defined? :TkSysMenu_Help
+Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_Help, :TkSysMenu_Help)
-class TkSysMenu_System<TkMenu
+class Tk::SysMenu_System<Tk::Menu
# for Windows
- include TkSystemMenu
+ include Tk::SystemMenu
SYSMENU_NAME = 'system'
end
+#TkSysMenu_System = Tk::SysMenu_System unless Object.const_defined? :TkSysMenu_System
+Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_System, :TkSysMenu_System)
-class TkSysMenu_Apple<TkMenu
+class Tk::SysMenu_Apple<Tk::Menu
# for Machintosh
- include TkSystemMenu
+ include Tk::SystemMenu
SYSMENU_NAME = 'apple'
end
+#TkSysMenu_Apple = Tk::SysMenu_Apple unless Object.const_defined? :TkSysMenu_Apple
+Tk.__set_toplevel_aliases__(:Tk, Tk::SysMenu_Apple, :TkSysMenu_Apple)
-class TkMenubutton<TkLabel
+class Tk::Menubutton<Tk::Label
TkCommandNames = ['menubutton'.freeze].freeze
WidgetClassName = 'Menubutton'.freeze
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))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ # tk_call_without_enc('menubutton', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ begin
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ rescue
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ keys = __check_available_configure_options(keys)
+ unless keys.empty?
+ tk_call_without_enc('destroy', @path) rescue nil
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ end
+ end
+ end
else
# tk_call_without_enc('menubutton', @path)
tk_call_without_enc(self.class::TkCommandNames[0], @path)
end
end
private :create_self
+
+ def __boolval_optkeys
+ super() << 'indicatoron'
+ end
+ private :__boolval_optkeys
+
end
-TkMenuButton = TkMenubutton
+Tk::MenuButton = Tk::Menubutton
+#TkMenubutton = Tk::Menubutton unless Object.const_defined? :TkMenubutton
+#TkMenuButton = Tk::MenuButton unless Object.const_defined? :TkMenuButton
+Tk.__set_toplevel_aliases__(:Tk, Tk::Menubutton, :TkMenubutton, :TkMenuButton)
-class TkOptionMenubutton<TkMenubutton
+class Tk::OptionMenubutton<Tk::Menubutton
TkCommandNames = ['tk_optionMenu'.freeze].freeze
class OptionMenu<TkMenu
@@ -502,6 +631,9 @@ class TkOptionMenubutton<TkMenubutton
@menu.delete(index, last)
self
end
+ def xposition(index)
+ @menu.xposition(index)
+ end
def yposition(index)
@menu.yposition(index)
end
@@ -511,6 +643,9 @@ class TkOptionMenubutton<TkMenubutton
def menucget(key)
@menu.cget(key)
end
+ def menucget_strict(key)
+ @menu.cget_strict(key)
+ end
def menuconfigure(key, val=None)
@menu.configure(key, val)
self
@@ -524,6 +659,9 @@ class TkOptionMenubutton<TkMenubutton
def entrycget(index, key)
@menu.entrycget(index, key)
end
+ def entrycget_strict(index, key)
+ @menu.entrycget_strict(index, key)
+ end
def entryconfigure(index, key, val=None)
@menu.entryconfigure(index, key, val)
self
@@ -535,4 +673,9 @@ class TkOptionMenubutton<TkMenubutton
@menu.current_entryconfiginfo(index, key)
end
end
-TkOptionMenuButton = TkOptionMenubutton
+
+Tk::OptionMenuButton = Tk::OptionMenubutton
+#TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton
+#TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton
+Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton,
+ :TkOptionMenubutton, :TkOptionMenuButton)
diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb
index 392b6fbd4e..ef9da809b9 100644
--- a/ext/tk/lib/tk/menubar.rb
+++ b/ext/tk/lib/tk/menubar.rb
@@ -89,7 +89,7 @@ require 'tk/frame'
require 'tk/composite'
require 'tk/menuspec'
-class TkMenubar<TkFrame
+class TkMenubar<Tk::Frame
include TkComposite
include TkMenuSpec
diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb
index 118a4f42b1..2a2eb9ba3c 100644
--- a/ext/tk/lib/tk/menuspec.rb
+++ b/ext/tk/lib/tk/menuspec.rb
@@ -61,8 +61,12 @@ module TkMenuSpec
tearoff = orig_opts.delete('tearoff') if orig_opts.key?('tearoff')
if menu_name
+ #menu = Tk::Menu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
+ # --> use current TkMenu class
menu = TkMenu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff)
else
+ #menu = Tk::Menu.new(parent, :tearoff=>tearoff)
+ # --> use current TkMenu class
menu = TkMenu.new(parent, :tearoff=>tearoff)
end
@@ -150,21 +154,22 @@ module TkMenuSpec
def _use_menubar?(parent)
use_menubar = false
- if parent.kind_of?(TkRoot) || parent.kind_of?(TkToplevel)
- return true
+ if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel)
+ true
+ elsif parent.current_configinfo.has_key?('menu')
+ true
else
- begin
- parent.cget('menu')
- return true
- rescue
- end
+ false
end
- false
end
private :_use_menubar?
def _create_menu_for_menubar(parent)
- unless (mbar = parent.menu).kind_of?(TkMenu)
+ #unless (mbar = parent.menu).kind_of?(TkMenu)
+ # --> use current TkMenu class
+ mbar = parent.menu
+ unless mbar.kind_of?(Tk::Menu) || mbar.kind_of?(TkMenu)
+ #mbar = Tk::Menu.new(parent, :tearoff=>false)
mbar = TkMenu.new(parent, :tearoff=>false)
parent.menu(mbar)
end
@@ -190,7 +195,6 @@ module TkMenuSpec
if _use_menubar?(parent)
# menubar by menu entries
-
mbar = _create_menu_for_menubar(parent)
menu_name = nil
@@ -221,6 +225,8 @@ module TkMenuSpec
else
# menubar by menubuttons
+ #mbtn = Tk::Menubutton.new(parent)
+ # --> use current TkMenubutton class
mbtn = TkMenubutton.new(parent)
menu_name = nil
diff --git a/ext/tk/lib/tk/message.rb b/ext/tk/lib/tk/message.rb
index 79121bebb3..946b68c704 100644
--- a/ext/tk/lib/tk/message.rb
+++ b/ext/tk/lib/tk/message.rb
@@ -4,7 +4,7 @@
require 'tk'
require 'tk/label'
-class TkMessage<TkLabel
+class Tk::Message<Tk::Label
TkCommandNames = ['message'.freeze].freeze
WidgetClassName = 'Message'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -17,3 +17,6 @@ class TkMessage<TkLabel
#end
private :create_self
end
+
+#TkMessage = Tk::Message unless Object.const_defined? :TkMessage
+Tk.__set_toplevel_aliases__(:Tk, Tk::Message, :TkMessage)
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index eee331650d..162953f425 100644
--- a/ext/tk/lib/tk/msgcat.rb
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -74,7 +74,11 @@ class TkMsgCatalog < TkObject
"\n---< backtrace of Ruby side >-----\n" +
_toUTF8(e.backtrace.join("\n")) +
"\n---< backtrace of Tk side >-------"
- msg.instance_variable_set(:@encoding, 'utf-8')
+ if TkCore::WITH_ENCODING
+ msg.force_encoding('utf-8')
+ else
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ end
rescue Exception
msg = e.class.inspect + ': ' + e.message + "\n" +
"\n---< backtrace of Ruby side >-----\n" +
@@ -130,7 +134,8 @@ class TkMsgCatalog < TkObject
self.set_translation(loc, *args)
else
- fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+ super(id, *args)
+# 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 85a94372b9..20a8d65215 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -12,7 +12,27 @@ class TkNamespace < TkObject
].freeze
Tk_Namespace_ID_TBL = TkCore::INTERP.create_table
- Tk_Namespace_ID = ["ns".freeze, "00000".taint].freeze
+
+ (Tk_Namespace_ID = ["ns".freeze, "00000".taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ Tk_NsCode_RetObjID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ Tk_Namespace_ID_TBL.mutex.synchronize{ Tk_Namespace_ID_TBL.clear }
+ Tk_NsCode_RetObjID_TBL.mutex.synchronize{ Tk_NsCode_RetObjID_TBL.clear }
+ }
+
+ def TkNamespace.id2obj(id)
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ Tk_Namespace_ID_TBL[id]? Tk_Namespace_ID_TBL[id]: id
+ }
+ end
+
+ #####################################
class Ensemble < TkObject
def __cget_cmd
@@ -52,11 +72,27 @@ class TkNamespace < TkObject
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
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
+ TkNamespace::Tk_Namespace_ID_TBL[ns]
+ else
+ ns
+ end
+ }
+ else
+ super(slot)
+ end
+ end
+ def cget_strict(slot)
+ if slot == :namespace || slot == 'namespace'
+ ns = super(slot)
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
+ TkNamespace::Tk_Namespace_ID_TBL[ns]
+ else
+ ns
+ end
+ }
else
super(slot)
end
@@ -66,9 +102,11 @@ class TkNamespace < TkObject
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
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
+ val = TkNamespace::Tk_Namespace_ID_TBL[val]
+ end
+ }
else
val = super(slot)
end
@@ -83,19 +121,23 @@ class TkNamespace < TkObject
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
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ 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
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
+ info['namespace'] = TkNamespace::Tk_Namespace_ID_TBL[val]
+ end
+ }
end
info
@@ -107,6 +149,8 @@ class TkNamespace < TkObject
end
end
+ #####################################
+
class ScopeArgs < Array
include Tk
@@ -139,9 +183,12 @@ class TkNamespace < TkObject
end
end
+ #####################################
+
class NsCode < TkObject
- def initialize(scope)
+ def initialize(scope, use_obj_id = false)
@scope = scope + ' '
+ @use_obj_id = use_obj_id
end
def path
@scope
@@ -150,8 +197,24 @@ class TkNamespace < TkObject
@scope
end
def call(*args)
- TkCore::INTERP._eval_without_enc(@scope + array2tk_list(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
+ 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
@@ -181,9 +244,11 @@ class TkNamespace < TkObject
def initialize(name = nil, parent = nil)
unless name
- # name = Tk_Namespace_ID.join('')
- name = Tk_Namespace_ID.join(TkCore::INTERP._ip_id_)
- Tk_Namespace_ID[1].succ!
+ Tk_Namespace_ID.mutex.synchronize{
+ # name = Tk_Namespace_ID.join('')
+ name = Tk_Namespace_ID.join(TkCore::INTERP._ip_id_)
+ Tk_Namespace_ID[1].succ!
+ }
end
name = __tk_call('namespace', 'current') if name == ''
if parent
@@ -218,7 +283,9 @@ class TkNamespace < TkObject
# create namespace
__tk_call('namespace', 'eval', @fullname, '')
- Tk_Namespace_ID_TBL[@fullname] = self
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ Tk_Namespace_ID_TBL[@fullname] = self
+ }
end
def self.children(*args)
@@ -226,11 +293,13 @@ class TkNamespace < TkObject
# <pattern> must be glob-style pattern
tk_split_simplelist(tk_call('namespace', 'children', *args)).collect{|ns|
# ns is fullname
- if Tk_Namespace_ID_TBL.key?(ns)
- Tk_Namespace_ID_TBL[ns]
- else
- ns
- end
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if Tk_Namespace_ID_TBL.key?(ns)
+ Tk_Namespace_ID_TBL[ns]
+ else
+ ns
+ end
+ }
}
end
def children(pattern=None)
@@ -240,6 +309,7 @@ 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)}
@@ -251,18 +321,75 @@ 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|
+ if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
+ obj = ScopeArgs.new(@fullname,*args)
+ ret = obj.instance_exec(obj, script)
+ else
+ ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
+ end
+ id = ret.object_id
+ TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
+ id
+ }
+ elsif script.kind_of?(Proc)
+ cmd = proc{|*args|
+ if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
+ obj = ScopeArgs.new(@fullname,*args)
+ ret = obj.instance_exec(obj, &script)
+ else
+ ret = ScopeArgs.new(@fullname,*args).instance_eval(&script)
+ end
+ 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
+ def self.current_path
tk_call('namespace', 'current')
end
+ def current_path
+ @fullname
+ end
+
+ def self.current
+ ns = self.current_path
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if Tk_Namespace_ID_TBL.key?(ns)
+ Tk_Namespace_ID_TBL[ns]
+ else
+ ns
+ end
+ }
+ end
def current_namespace
# ns_tk_call('namespace', 'current')
- @fullname
+ # @fullname
+ self
end
alias current current_namespace
def self.delete(*ns_list)
tk_call('namespace', 'delete', *ns_list)
+ ns_list.each{|ns|
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ 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)
@@ -293,8 +420,9 @@ class TkNamespace < TkObject
def self.eval(namespace, cmd = Proc.new, *args)
#tk_call('namespace', 'eval', namespace, cmd, *args)
- TkNamespace.new(namespece).eval(cmd, *args)
+ TkNamespace.new(namespace).eval(cmd, *args)
end
+=begin
def eval(cmd = Proc.new, *args)
#TkNamespace.eval(@fullname, cmd, *args)
#ns_tk_call(cmd, *args)
@@ -302,6 +430,13 @@ class TkNamespace < TkObject
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]))
ret
end
@@ -309,7 +444,7 @@ class TkNamespace < TkObject
bool(tk_call('namespace', 'exists', ns))
end
def exist?
- TkNamespece.delete(@fullname)
+ TkNamespece.exist?(@fullname)
end
def self.export(*patterns)
@@ -349,7 +484,7 @@ class TkNamespace < TkObject
tk_call('namespace', 'inscope', namespace, script, *args)
end
def inscope(script, *args)
- TkNamespace(@fullname, script, *args)
+ TkNamespace.inscope(@fullname, script, *args)
end
def self.origin(cmd)
@@ -358,11 +493,13 @@ class TkNamespace < TkObject
def self.parent(namespace=None)
ns = tk_call('namespace', 'parent', namespace)
- if Tk_Namespace_ID_TBL.key?(ns)
- Tk_Namespace_ID_TBL[ns]
- else
- ns
- end
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if Tk_Namespace_ID_TBL.key?(ns)
+ Tk_Namespace_ID_TBL[ns]
+ else
+ ns
+ end
+ }
end
def parent
tk_call('namespace', 'parent', @fullname)
@@ -386,6 +523,20 @@ 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
@@ -396,3 +547,5 @@ 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..186811d37d 100644
--- a/ext/tk/lib/tk/optiondb.rb
+++ b/ext/tk/lib/tk/optiondb.rb
@@ -8,7 +8,11 @@ module TkOptionDB
extend Tk
TkCommandNames = ['option'.freeze].freeze
- CmdClassID = ['CMD_CLASS'.freeze, '00000'.taint].freeze
+ (CmdClassID = ['CMD_CLASS'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
module Priority
WidgetDefault = 20
@@ -250,8 +254,10 @@ module TkOptionDB
def __create_new_class(klass, func, safe = 4, add = false, parent = nil)
if klass.kind_of?(TkWindow)
carrier = klass.path
- klass = CmdClassID.join(TkCore::INTERP._ip_id_)
- CmdClassID[1].succ!
+ CmdClassID.mutex.synchronize{
+ klass = CmdClassID.join(TkCore::INTERP._ip_id_)
+ CmdClassID[1].succ!
+ }
parent = nil # ignore parent
else
klass = klass.to_s if klass.kind_of?(Symbol)
@@ -312,7 +318,7 @@ module TkOptionDB
:singleton_methods, :remove_const, :remove_method, :undef_method,
:to_s, :inspect, :display, :method, :methods, :respond_to?,
:instance_variable_get, :instance_variable_set, :instance_method,
- :instance_eval, :instance_variables, :kind_of?, :is_a?,
+ :instance_eval, :instance_exec, :instance_variables, :kind_of?, :is_a?,
:private_methods, :protected_methods, :public_methods ].each{|m|
alias_method(m, :__null_method)
}
@@ -362,7 +368,7 @@ module TkOptionDB
def new_proc_class_random(klass, func, safe = 4, add = false, &b)
eval_under_random_base(){
- TkOption.new_proc_class(klass, func, safe, add, self, &b)
+ TkOptionDB.new_proc_class(klass, func, safe, add, self, &b)
}
end
module_function :new_proc_class_random
diff --git a/ext/tk/lib/tk/pack.rb b/ext/tk/lib/tk/pack.rb
index 8fab363121..220a38e524 100644
--- a/ext/tk/lib/tk/pack.rb
+++ b/ext/tk/lib/tk/pack.rb
@@ -9,6 +9,7 @@ module TkPack
TkCommandNames = ['pack'.freeze].freeze
+=begin
def configure(win, *args)
if args[-1].kind_of?(Hash)
opts = args.pop
@@ -29,6 +30,22 @@ module TkPack
}
tk_call_without_enc("pack", 'configure', *params)
end
+=end
+ def configure(*args)
+ if args[-1].kind_of?(Hash)
+ opts = args.pop
+ else
+ opts = {}
+ end
+ fail ArgumentError, 'no widget is given' if args.empty?
+ params = []
+ args.flatten(1).each{|win| params.push(_epath(win))}
+ opts.each{|k, v|
+ params.push("-#{k}")
+ params.push(_epath(v)) # have to use 'epath' (hash_kv() is unavailable)
+ }
+ tk_call_without_enc("pack", 'configure', *params)
+ end
alias pack configure
def forget(*args)
diff --git a/ext/tk/lib/tk/package.rb b/ext/tk/lib/tk/package.rb
index d1eb27674d..0c329732f5 100644
--- a/ext/tk/lib/tk/package.rb
+++ b/ext/tk/lib/tk/package.rb
@@ -136,4 +136,8 @@ module TkPackage
def vsatisfies(version1, version2)
bool(tk_call('package', 'vsatisfies', version1, version2))
end
+
+ def prefer(setting = None)
+ tk_call('package', 'prefer', setting)
+ end
end
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
index 2b6fdf5d90..2d08d50f6a 100644
--- a/ext/tk/lib/tk/palette.rb
+++ b/ext/tk/lib/tk/palette.rb
@@ -15,7 +15,7 @@ module TkPalette
].freeze
def TkPalette.set(*args)
- args = args.to_a.flatten if args.kind_of? Hash
+ args = args[0].to_a.flatten if args[0].kind_of? Hash
tk_call('tk_setPalette', *args)
end
def TkPalette.setPalette(*args)
diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb
index 3f4266e4f9..030144e677 100644
--- a/ext/tk/lib/tk/panedwindow.rb
+++ b/ext/tk/lib/tk/panedwindow.rb
@@ -3,7 +3,7 @@
#
require 'tk'
-class TkPanedWindow<TkWindow
+class Tk::PanedWindow<TkWindow
TkCommandNames = ['panedwindow'.freeze].freeze
WidgetClassName = 'Panedwindow'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -63,7 +63,7 @@ class TkPanedWindow<TkWindow
def sash_coord(index)
list(tk_send('sash', 'coord', index))
end
- def sash_dragto(index)
+ def sash_dragto(index, x, y)
tk_send('sash', 'dragto', index, x, y)
self
end
@@ -76,11 +76,32 @@ class TkPanedWindow<TkWindow
self
end
- def panecget(win, key)
+ def panecget_strict(win, key)
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
tk_tcl2ruby(tk_send_without_enc('panecget', win, "-#{key}"))
end
+ def panecget(win, key)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ panecget_strict(win, key)
+ else
+ begin
+ panecget_strict(win, key)
+ rescue => e
+ begin
+ if current_paneconfiginfo(win).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def paneconfigure(win, key, value=nil)
# win = win.epath if win.kind_of?(TkObject)
@@ -229,4 +250,9 @@ class TkPanedWindow<TkWindow
list(tk_send_without_enc('panes'))
end
end
-TkPanedwindow = TkPanedWindow
+
+Tk::Panedwindow = Tk::PanedWindow
+#TkPanedWindow = Tk::PanedWindow unless Object.const_defined? :TkPanedWindow
+#TkPanedwindow = Tk::Panedwindow unless Object.const_defined? :TkPanedwindow
+Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow,
+ :TkPanedWindow, :TkPanedwindow)
diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb
index d82aa5d07d..1f864ec06b 100644
--- a/ext/tk/lib/tk/radiobutton.rb
+++ b/ext/tk/lib/tk/radiobutton.rb
@@ -4,7 +4,7 @@
require 'tk'
require 'tk/button'
-class TkRadioButton<TkButton
+class Tk::RadioButton<Tk::Button
TkCommandNames = ['radiobutton'.freeze].freeze
WidgetClassName = 'Radiobutton'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -17,6 +17,16 @@ 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
@@ -53,4 +63,9 @@ class TkRadioButton<TkButton
end
end
end
-TkRadiobutton = TkRadioButton
+
+Tk::Radiobutton = Tk::RadioButton
+#TkRadioButton = Tk::RadioButton unless Object.const_defined? :TkRadioButton
+#TkRadiobutton = Tk::Radiobutton unless Object.const_defined? :TkRadiobutton
+Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton,
+ :TkRadioButton, :TkRadiobutton)
diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb
index 0e5584c7c1..7237b4c614 100644
--- a/ext/tk/lib/tk/root.rb
+++ b/ext/tk/lib/tk/root.rb
@@ -5,7 +5,7 @@ require 'tk'
require 'tk/wm'
require 'tk/menuspec'
-class TkRoot<TkWindow
+class Tk::Root<TkWindow
include Wm
include TkMenuSpec
@@ -14,28 +14,7 @@ class TkRoot<TkWindow
end
private :__methodcall_optkeys
-=begin
- ROOT = []
- def TkRoot.new(keys=nil)
- if ROOT[0]
- Tk_WINDOWS["."] = ROOT[0]
- return ROOT[0]
- end
- new = super(:without_creating=>true, :widgetname=>'.')
- if keys # wm commands
- keys.each{|k,v|
- if v.kind_of? Array
- new.send(k,*v)
- else
- new.send(k,v)
- end
- }
- end
- ROOT[0] = new
- Tk_WINDOWS["."] = new
- end
-=end
- def TkRoot.new(keys=nil, &b)
+ def Root.new(keys=nil, &b)
unless TkCore::INTERP.tk_windows['.']
TkCore::INTERP.tk_windows['.'] =
super(:without_creating=>true, :widgetname=>'.'){}
@@ -62,7 +41,13 @@ class TkRoot<TkWindow
}
end
- root.instance_eval(&b) if block_given?
+ if block_given?
+ if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
+ root.instance_exec(root, &b)
+ else
+ root.instance_eval(&b)
+ end
+ end
root
end
@@ -102,7 +87,9 @@ class TkRoot<TkWindow
self.menu
end
- def TkRoot.destroy
+ def Root.destroy
TkCore::INTERP._invoke('destroy', '.')
end
end
+
+TkRoot = Tk::Root unless Object.const_defined? :TkRoot
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
index 7214c46f5e..7e758d92f4 100644
--- a/ext/tk/lib/tk/scale.rb
+++ b/ext/tk/lib/tk/scale.rb
@@ -3,7 +3,7 @@
#
require 'tk'
-class TkScale<TkWindow
+class Tk::Scale<TkWindow
TkCommandNames = ['scale'.freeze].freeze
WidgetClassName = 'Scale'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -14,9 +14,31 @@ class TkScale<TkWindow
cmd = keys.delete('command')
keys['command'] = proc{|val| cmd.call(val.to_f)}
end
- #tk_call_without_enc('scale', @path, *hash_kv(keys, true))
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ #tk_call_without_enc('scale', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ begin
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ rescue
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ keys = __check_available_configure_options(keys)
+ unless keys.empty?
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot destroy
+ configure(keys)
+ else
+ # re-create widget
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ end
+ end
+ end
+ end
else
#tk_call_without_enc('scale', @path)
tk_call_without_enc(self.class::TkCommandNames[0], @path)
@@ -24,6 +46,11 @@ 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)
@@ -79,3 +106,6 @@ class TkScale<TkWindow
val
end
end
+
+#TkScale = Tk::Scale unless Object.const_defined? :TkScale
+Tk.__set_toplevel_aliases__(:Tk, Tk::Scale, :TkScale)
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb
index ec27b76467..96959b7a4b 100644
--- a/ext/tk/lib/tk/scrollable.rb
+++ b/ext/tk/lib/tk/scrollable.rb
@@ -4,7 +4,7 @@
require 'tk'
module Tk
- module X_Scrollable
+ module XScrollable
def xscrollcommand(cmd=Proc.new)
configure_cmd 'xscrollcommand', cmd
# Tk.update # avoid scrollbar trouble
@@ -38,7 +38,7 @@ module Tk
end
end
- module Y_Scrollable
+ module YScrollable
def yscrollcommand(cmd=Proc.new)
configure_cmd 'yscrollcommand', cmd
# Tk.update # avoid scrollbar trouble
@@ -72,8 +72,11 @@ module Tk
end
end
+ X_Scrollable = XScrollable
+ Y_Scrollable = YScrollable
+
module Scrollable
- include X_Scrollable
- include Y_Scrollable
+ include XScrollable
+ include YScrollable
end
end
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb
index 70aadfdd4c..87db46a9f9 100644
--- a/ext/tk/lib/tk/scrollbar.rb
+++ b/ext/tk/lib/tk/scrollbar.rb
@@ -3,7 +3,7 @@
#
require 'tk'
-class TkScrollbar<TkWindow
+class Tk::Scrollbar<TkWindow
TkCommandNames = ['scrollbar'.freeze].freeze
WidgetClassName = 'Scrollbar'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -19,9 +19,31 @@ class TkScrollbar<TkWindow
}
if keys and keys != None
- #tk_call_without_enc('scrollbar', @path, *hash_kv(keys, true))
- tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ #tk_call_without_enc('scrollbar', @path, *hash_kv(keys, true))
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ else
+ begin
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ rescue
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ keys = __check_available_configure_options(keys)
+ unless keys.empty?
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot destroy
+ configure(keys)
+ else
+ # re-create widget
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ *hash_kv(keys, true))
+ end
+ end
+ end
+ end
else
#tk_call_without_enc('scrollbar', @path)
tk_call_without_enc(self.class::TkCommandNames[0], @path)
@@ -103,9 +125,33 @@ class TkScrollbar<TkWindow
def activate(element=None)
tk_send_without_enc('activate', element)
end
+
+ def moveto(fraction)
+ tk_send_without_enc('moveto', fraction)
+ self
+ end
+
+ def scroll(*args)
+ tk_send_without_enc('scroll', *args)
+ self
+ end
+
+ def scroll_units(num)
+ scroll(num, 'units')
+ self
+ end
+
+ def scroll_pages(num)
+ scroll(num, 'pages')
+ self
+ end
end
-class TkXScrollbar<TkScrollbar
+#TkScrollbar = Tk::Scrollbar unless Object.const_defined? :TkScrollbar
+Tk.__set_toplevel_aliases__(:Tk, Tk::Scrollbar, :TkScrollbar)
+
+
+class Tk::XScrollbar<Tk::Scrollbar
def create_self(keys)
keys = {} unless keys
keys['orient'] = 'horizontal'
@@ -114,7 +160,11 @@ class TkXScrollbar<TkScrollbar
private :create_self
end
-class TkYScrollbar<TkScrollbar
+#TkXScrollbar = Tk::XScrollbar unless Object.const_defined? :TkXScrollbar
+Tk.__set_toplevel_aliases__(:Tk, Tk::XScrollbar, :TkXScrollbar)
+
+
+class Tk::YScrollbar<Tk::Scrollbar
def create_self(keys)
keys = {} unless keys
keys['orient'] = 'vertical'
@@ -122,3 +172,6 @@ class TkYScrollbar<TkScrollbar
end
private :create_self
end
+
+#TkYScrollbar = Tk::YScrollbar unless Object.const_defined? :TkYScrollbar
+Tk.__set_toplevel_aliases__(:Tk, Tk::YScrollbar, :TkYScrollbar)
diff --git a/ext/tk/lib/tk/scrollbox.rb b/ext/tk/lib/tk/scrollbox.rb
index fd04057fb6..d20742a666 100644
--- a/ext/tk/lib/tk/scrollbox.rb
+++ b/ext/tk/lib/tk/scrollbox.rb
@@ -1,16 +1,19 @@
#
# tk/scrollbox.rb - Tk Listbox with Scrollbar
# as an example of Composite Widget
-# $Date$
# by Yukihiro Matsumoto <matz@netlab.co.jp>
#
require 'tk'
require 'tk/listbox'
-class TkScrollbox<TkListbox
+class TkScrollbox<Tk::Listbox
include TkComposite
def initialize_composite(keys=nil)
+ #list = Tk::Listbox.new(@frame)
+ # -> use current TkListbox class
list = TkListbox.new(@frame)
+ #scroll = Tk::Scrollbar.new(@frame)
+ # -> use current TkScrollbar class
scroll = TkScrollbar.new(@frame)
@path = list.path
diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
index 8941510fed..34dc1904f7 100644
--- a/ext/tk/lib/tk/spinbox.rb
+++ b/ext/tk/lib/tk/spinbox.rb
@@ -1,12 +1,11 @@
#
# tk/spinbox.rb - Tk spinbox classes
-# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
require 'tk'
require 'tk/entry'
-class TkSpinbox<TkEntry
+class Tk::Spinbox<Tk::Entry
TkCommandNames = ['spinbox'.freeze].freeze
WidgetClassName = 'Spinbox'.freeze
WidgetClassNames[WidgetClassName] = self
@@ -38,6 +37,24 @@ class TkSpinbox<TkEntry
nil
]
+=begin
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
+ KEY_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
+ end
+ inf
+ }
+
+ PROC_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ end
+ inf
+ }
+=end
+
_setup_subst_table(KEY_TBL, PROC_TBL);
def self.ret_val(val)
@@ -64,6 +81,21 @@ 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
@@ -82,3 +114,6 @@ class TkSpinbox<TkEntry
_fromUTF8(tk_send_without_enc('set', _get_eval_enc_str(str)))
end
end
+
+#TkSpinbox = Tk::Spinbox unless Object.const_defined? :TkSpinbox
+Tk.__set_toplevel_aliases__(:Tk, Tk::Spinbox, :TkSpinbox)
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index f2bad37b01..4ec82bed1d 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -1,6 +1,5 @@
#
# tk/text.rb - Tk text classes
-# $Date$
# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
require 'tk/itemfont'
@@ -33,34 +32,40 @@ module TkTextTagConfig
def tag_cget(tagOrId, option)
itemcget(['tag', tagOrId], option)
end
+ def tag_cget_strict(tagOrId, option)
+ itemcget_strict(['tag', tagOrId], option)
+ end
def tag_configure(tagOrId, slot, value=None)
itemconfigure(['tag', tagOrId], slot, value)
end
def tag_configinfo(tagOrId, slot=nil)
- itemconfigure(['tag', tagOrId], slot)
+ itemconfiginfo(['tag', tagOrId], slot)
end
def current_tag_configinfo(tagOrId, slot=nil)
- itemconfigure(['tag', tagOrId], slot)
+ current_itemconfiginfo(['tag', tagOrId], slot)
end
def window_cget(tagOrId, option)
itemcget(['window', tagOrId], option)
end
+ def window_cget_strict(tagOrId, option)
+ itemcget_strict(['window', tagOrId], option)
+ end
def window_configure(tagOrId, slot, value=None)
itemconfigure(['window', tagOrId], slot, value)
end
def window_configinfo(tagOrId, slot=nil)
- itemconfigure(['window', tagOrId], slot)
+ itemconfiginfo(['window', tagOrId], slot)
end
def current_window_configinfo(tagOrId, slot=nil)
- itemconfigure(['window', tagOrId], slot)
+ current_itemconfiginfo(['window', tagOrId], slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
-class TkText<TkTextWin
+class Tk::Text<TkTextWin
ItemConfCMD = ['tag'.freeze, 'configure'.freeze].freeze
#include TkTreatTextTagFont
include TkTextTagConfig
@@ -74,9 +79,9 @@ class TkText<TkTextWin
mod = mod.to_s
if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(String.new(id) << ' + ' << mod)
+ Tk::Text::IndexString.new(String.new(id) << ' + ' << mod)
else
- TkText::IndexString.new(String.new(id) << ' ' << mod)
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod)
end
end
@@ -85,46 +90,138 @@ class TkText<TkTextWin
mod = mod.to_s
if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(String.new(id) << ' - ' << mod)
+ Tk::Text::IndexString.new(String.new(id) << ' - ' << mod)
elsif mod =~ /^\s*[-]\s+(\d.*)$/
- TkText::IndexString.new(String.new(id) << ' - -' << $1)
+ Tk::Text::IndexString.new(String.new(id) << ' - -' << $1)
else
- TkText::IndexString.new(String.new(id) << ' ' << mod)
+ Tk::Text::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')
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars')
else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars')
+ Tk::Text::IndexString.new(String.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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars')
+ else
+ Tk::Text::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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars')
+ else
+ Tk::Text::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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices')
+ else
+ Tk::Text::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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices')
+ else
+ Tk::Text::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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices')
+ else
+ Tk::Text::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')
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines')
else
- TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines')
+ Tk::Text::IndexString.new(String.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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines')
+ else
+ Tk::Text::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
+ Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines')
+ else
+ Tk::Text::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')
+ Tk::Text::IndexString.new(String.new(id) << ' linestart')
end
def lineend
- TkText::IndexString.new(String.new(id) << ' lineend')
+ Tk::Text::IndexString.new(String.new(id) << ' lineend')
+ end
+
+ def display_linestart
+ # Tk8.5 feature
+ Tk::Text::IndexString.new(String.new(id) << ' display linestart')
+ end
+ def display_lineend
+ # Tk8.5 feature
+ Tk::Text::IndexString.new(String.new(id) << ' display lineend')
end
def wordstart
- TkText::IndexString.new(String.new(id) << ' wordstart')
+ Tk::Text::IndexString.new(String.new(id) << ' wordstart')
end
def wordend
- TkText::IndexString.new(String.new(id) << ' wordend')
+ Tk::Text::IndexString.new(String.new(id) << ' wordend')
+ end
+
+ def display_wordstart
+ # Tk8.5 feature
+ Tk::Text::IndexString.new(String.new(id) << ' display wordstart')
+ end
+ def display_wordend
+ # Tk8.5 feature
+ Tk::Text::IndexString.new(String.new(id) << ' display wordend')
end
end
@@ -159,7 +256,11 @@ class TkText<TkTextWin
def self.new(*args, &block)
obj = super(*args){}
obj.init_instance_variable
- obj.instance_eval(&block) if defined? yield
+ if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
+ obj.instance_exec(obj, &block) if defined? yield
+ else
+ obj.instance_eval(&block) if defined? yield
+ end
obj
end
@@ -169,8 +270,12 @@ class TkText<TkTextWin
end
def __destroy_hook__
- TkTextTag::TTagID_TBL.delete(@path)
- TkTextMark::TMarkID_TBL.delete(@path)
+ TkTextTag::TTagID_TBL.mutex.synchronize{
+ TkTextTag::TTagID_TBL.delete(@path)
+ }
+ TkTextTag::TMarkID_TBL.mutex.synchronize{
+ TkTextMark::TMarkID_TBL.delete(@path)
+ }
end
def create_self(keys)
@@ -187,17 +292,22 @@ 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)
+ Tk::Text::IndexString.at(x, y)
end
def at(x, y)
- TkText::IndexString.at(x, y)
+ Tk::Text::IndexString.at(x, y)
end
def index(idx)
- TkText::IndexString.new(tk_send_without_enc('index',
- _get_eval_enc_str(idx)))
+ Tk::Text::IndexString.new(tk_send_without_enc('index',
+ _get_eval_enc_str(idx)))
end
def get_displaychars(*index)
@@ -299,7 +409,7 @@ class TkText<TkTextWin
end
alias previous_mark mark_previous
- def image_cget(index, slot)
+ def image_cget_strict(index, slot)
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_send_without_enc('image', 'cget',
@@ -311,6 +421,28 @@ class TkText<TkTextWin
end
end
+ def image_cget(index, slot)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ image_cget_strict(index, slot)
+ else
+ begin
+ image_cget_strict(index, slot)
+ rescue => e
+ begin
+ if current_image_configinfo(index).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+
def image_configure(index, slot, value=None)
if slot.kind_of?(Hash)
_fromUTF8(tk_send_without_enc('image', 'configure',
@@ -616,15 +748,17 @@ class TkText<TkTextWin
def tag_delete(*tags)
tk_send_without_enc('tag', 'delete',
*(tags.collect{|tag| _get_eval_enc_str(tag)}))
- if TkTextTag::TTagID_TBL[@path]
- tags.each{|tag|
- if tag.kind_of?(TkTextTag)
- TkTextTag::TTagID_TBL[@path].delete(tag.id)
- else
- TkTextTag::TTagID_TBL[@path].delete(tag)
- end
- }
- end
+ TkTextTag::TTagID_TBL.mutex.synchronize{
+ if TkTextTag::TTagID_TBL[@path]
+ tags.each{|tag|
+ if tag.kind_of?(TkTextTag)
+ TkTextTag::TTagID_TBL[@path].delete(tag.id)
+ else
+ TkTextTag::TTagID_TBL[@path].delete(tag)
+ end
+ }
+ end
+ }
self
end
alias deltag tag_delete
@@ -871,7 +1005,7 @@ class TkText<TkTextWin
false, true)
r = []
while key=l.shift
- r.push [TkText::IndexString.new(key), TkText::IndexString.new(l.shift)]
+ r.push [Tk::Text::IndexString.new(key), Tk::Text::IndexString.new(l.shift)]
end
r
end
@@ -881,7 +1015,7 @@ class TkText<TkTextWin
_get_eval_enc_str(tag),
_get_eval_enc_str(first),
_get_eval_enc_str(last))).collect{|idx|
- TkText::IndexString.new(idx)
+ Tk::Text::IndexString.new(idx)
}
end
@@ -890,7 +1024,7 @@ class TkText<TkTextWin
_get_eval_enc_str(tag),
_get_eval_enc_str(first),
_get_eval_enc_str(last))).collect{|idx|
- TkText::IndexString.new(idx)
+ Tk::Text::IndexString.new(idx)
}
end
@@ -1086,6 +1220,11 @@ class TkText<TkTextWin
end
def _ktext_length(txt)
+ if TkCore::WITH_ENCODING ### Ruby 1.9 !!!!!!!!!!!!!
+ return txt.length
+ end
+ ###########################
+
if $KCODE !~ /n/i
return txt.gsub(/[^\Wa-zA-Z_\d]/, ' ').length
end
@@ -1135,7 +1274,7 @@ class TkText<TkTextWin
if ret == ""
nil
else
- TkText::IndexString.new(ret)
+ Tk::Text::IndexString.new(ret)
end
end
@@ -1170,7 +1309,7 @@ class TkText<TkTextWin
if ret == ""
nil
else
- TkText::IndexString.new(ret)
+ Tk::Text::IndexString.new(ret)
end
end
@@ -1359,10 +1498,10 @@ class TkText<TkTextWin
# retrieve index
idx = str.index(/ /, i)
if idx
- result.push(TkText::IndexString.new(str[i..(idx-1)]))
+ result.push(Tk::Text::IndexString.new(str[i..(idx-1)]))
i = idx + 1
else
- result.push(TkText::IndexString.new(str[i..-1]))
+ result.push(Tk::Text::IndexString.new(str[i..-1]))
break
end
end
@@ -1430,13 +1569,17 @@ class TkText<TkTextWin
end
end
+#TkText = Tk::Text unless Object.const_defined? :TkText
+Tk.__set_toplevel_aliases__(:Tk, Tk::Text, :TkText)
+
+
#######################################
-class TkText::Peer < TkText
+class Tk::Text::Peer < Tk::Text
# Tk8.5 feature
def initialize(text, parent=nil, keys={})
- unless text.kind_of?(TkText)
- fail ArgumentError, "TkText is expected for 1st argument"
+ unless text.kind_of?(Tk::Text)
+ fail ArgumentError, "Tk::Text is expected for 1st argument"
end
@src_text = text
super(parent, keys)
diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb
index a29b23c7dd..fb306a9c17 100644
--- a/ext/tk/lib/tk/textimage.rb
+++ b/ext/tk/lib/tk/textimage.rb
@@ -5,11 +5,11 @@ require 'tk'
require 'tk/text'
class TkTextImage<TkObject
- include TkText::IndexModMethods
+ include Tk::Text::IndexModMethods
def initialize(parent, index, keys)
- #unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ #unless parent.kind_of?(Tk::Text)
+ # fail ArgumentError, "expect Tk::Text for 1st argument"
#end
@t = parent
if index == 'end' || index == :end
@@ -34,7 +34,7 @@ class TkTextImage<TkObject
end
def id
- TkText::IndexString.new(@id)
+ Tk::Text::IndexString.new(@id)
end
def mark
@path
@@ -52,6 +52,10 @@ class TkTextImage<TkObject
@t.image_cget(@index, slot)
end
+ def cget_strict(slot)
+ @t.image_cget_strict(@index, slot)
+ end
+
def configure(slot, value=None)
@t.image_configure(@index, slot, value)
self
@@ -80,3 +84,5 @@ class TkTextImage<TkObject
value
end
end
+
+TktImage = TkTextImage
diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb
index 650d95af70..72c1ce1ab4 100644
--- a/ext/tk/lib/tk/textmark.rb
+++ b/ext/tk/lib/tk/textmark.rb
@@ -5,38 +5,54 @@ require 'tk'
require 'tk/text'
class TkTextMark<TkObject
- include TkText::IndexModMethods
+ include Tk::Text::IndexModMethods
TMarkID_TBL = TkCore::INTERP.create_table
- Tk_TextMark_ID = ['mark'.freeze, '00000'.taint].freeze
- TkCore::INTERP.init_ip_env{ TMarkID_TBL.clear }
+ (Tk_TextMark_ID = ['mark'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ TMarkID_TBL.mutex.synchronize{ TMarkID_TBL.clear }
+ }
def TkTextMark.id2obj(text, id)
tpath = text.path
- return id unless TMarkID_TBL[tpath]
- TMarkID_TBL[tpath][id]? TMarkID_TBL[tpath][id]: id
+ TMarkID_TBL.mutex.synchronize{
+ if TMarkID_TBL[tpath]
+ TMarkID_TBL[tpath][id]? TMarkID_TBL[tpath][id]: id
+ else
+ id
+ end
+ }
end
def initialize(parent, index)
- #unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ #unless parent.kind_of?(Tk::Text)
+ # fail ArgumentError, "expect Tk::Text for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
- # @path = @id = Tk_TextMark_ID.join('')
- @path = @id = Tk_TextMark_ID.join(TkCore::INTERP._ip_id_).freeze
- TMarkID_TBL[@id] = self
- TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
- TMarkID_TBL[@tpath][@id] = self
- Tk_TextMark_ID[1].succ!
+ Tk_TextMark_ID.mutex.synchronize{
+ # @path = @id = Tk_TextMark_ID.join('')
+ @path = @id = Tk_TextMark_ID.join(TkCore::INTERP._ip_id_).freeze
+ Tk_TextMark_ID[1].succ!
+ }
+ TMarkID_TBL.mutex.synchronize{
+ TMarkID_TBL[@id] = self
+ TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
+ TMarkID_TBL[@tpath][@id] = self
+ }
tk_call_without_enc(@t.path, 'mark', 'set', @id,
_get_eval_enc_str(index))
@t._addtag id, self
end
def id
- TkText::IndexString.new(@id)
+ Tk::Text::IndexString.new(@id)
end
def exist?
@@ -49,15 +65,15 @@ class TkTextMark<TkObject
end
=begin
- # move to TkText::IndexModMethods module
+ # move to Tk::Text::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)
+ Tk::Text::IndexString.new(@id + ' + ' + mod)
else
- TkText::IndexString.new(@id + ' ' + mod)
+ Tk::Text::IndexString.new(@id + ' ' + mod)
end
end
@@ -66,11 +82,11 @@ class TkTextMark<TkObject
mod = mod.to_s
if mod =~ /^\s*[+-]?\d/
- TkText::IndexString.new(@id + ' - ' + mod)
+ Tk::Text::IndexString.new(@id + ' - ' + mod)
elsif mod =~ /^\s*[-]\s+(\d.*)$/
- TkText::IndexString.new(@id + ' - -' + $1)
+ Tk::Text::IndexString.new(@id + ' - -' + $1)
else
- TkText::IndexString.new(@id + ' ' + mod)
+ Tk::Text::IndexString.new(@id + ' ' + mod)
end
end
=end
@@ -121,46 +137,68 @@ class TkTextMark<TkObject
end
end
end
+TktMark = TkTextMark
class TkTextNamedMark<TkTextMark
- def self.new(parent, name, *args)
- if TMarkID_TBL[parent.path] && TMarkID_TBL[parent.path][name]
- return TMarkID_TBL[parent.path][name]
- else
- super(parent, name, *args)
- end
+ def self.new(parent, name, index=nil)
+ TMarkID_TBL.mutex.synchronize{
+ if TMarkID_TBL[parent.path] && TMarkID_TBL[parent.path][name]
+ obj = TMarkID_TBL[parent.path][name]
+ else
+ # super(parent, name, *args)
+ (obj = self.allocate).instance_eval{
+ @parent = @t = parent
+ @tpath = parent.path
+ @path = @id = name
+ TMarkID_TBL[@id] = self
+ TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
+ TMarkID_TBL[@tpath][@id] = self unless TMarkID_TBL[@tpath][@id]
+ @t._addtag @id, self
+ }
+ obj
+ end
+
+ if obj && index
+ tk_call_without_enc(parent.path, 'mark', 'set', name,
+ _get_eval_enc_str(index))
+ end
+ obj
+ }
end
def initialize(parent, name, index=nil)
- #unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # dummy:: not called by 'new' method
+
+ #unless parent.kind_of?(Tk::Text)
+ # fail ArgumentError, "expect Tk::Text for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
@path = @id = name
- TMarkID_TBL[@id] = self
- TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
- TMarkID_TBL[@tpath][@id] = self unless TMarkID_TBL[@tpath][@id]
tk_call_without_enc(@t.path, 'mark', 'set', @id,
_get_eval_enc_str(index)) if index
- @t._addtag id, self
+ @t._addtag @id, self
end
end
+TktNamedMark = TkTextNamedMark
class TkTextMarkInsert<TkTextNamedMark
def self.new(parent,*args)
super(parent, 'insert', *args)
end
end
+TktMarkInsert = TkTextMarkInsert
class TkTextMarkCurrent<TkTextNamedMark
def self.new(parent,*args)
super(parent, 'current', *args)
end
end
+TktMarkCurrent = TkTextMarkCurrent
class TkTextMarkAnchor<TkTextNamedMark
def self.new(parent,*args)
super(parent, 'anchor', *args)
end
end
+TktMarkAnchor = TkTextMarkAnchor
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index cc2c56210f..b08d923ea1 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -7,17 +7,29 @@ require 'tk/tagfont'
class TkTextTag<TkObject
include TkTreatTagFont
- include TkText::IndexModMethods
+ include Tk::Text::IndexModMethods
TTagID_TBL = TkCore::INTERP.create_table
- Tk_TextTag_ID = ['tag'.freeze, '00000'.taint].freeze
- TkCore::INTERP.init_ip_env{ TTagID_TBL.clear }
+ (Tk_TextTag_ID = ['tag'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ TTagID_TBL.mutex.synchronize{ TTagID_TBL.clear }
+ }
def TkTextTag.id2obj(text, id)
tpath = text.path
- return id unless TTagID_TBL[tpath]
- TTagID_TBL[tpath][id]? TTagID_TBL[tpath][id]: id
+ TTagID_TBL.mutex.synchronize{
+ if TTagID_TBL[tpath]
+ TTagID_TBL[tpath][id]? TTagID_TBL[tpath][id]: id
+ else
+ id
+ end
+ }
end
def initialize(parent, *args)
@@ -26,12 +38,16 @@ class TkTextTag<TkObject
#end
@parent = @t = parent
@tpath = parent.path
- # @path = @id = Tk_TextTag_ID.join('')
- @path = @id = Tk_TextTag_ID.join(TkCore::INTERP._ip_id_).freeze
- # TTagID_TBL[@id] = self
- TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
- TTagID_TBL[@tpath][@id] = self
- Tk_TextTag_ID[1].succ!
+ Tk_TextTag_ID.mutex.synchronize{
+ # @path = @id = Tk_TextTag_ID.join('')
+ @path = @id = Tk_TextTag_ID.join(TkCore::INTERP._ip_id_).freeze
+ Tk_TextTag_ID[1].succ!
+ }
+ TTagID_TBL.mutex.synchronize{
+ TTagID_TBL[@id] = self
+ TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
+ TTagID_TBL[@tpath][@id] = self
+ }
#tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
if args != []
keys = args.pop
@@ -47,7 +63,7 @@ class TkTextTag<TkObject
end
def id
- TkText::IndexString.new(@id)
+ Tk::Text::IndexString.new(@id)
end
def exist?
@@ -60,11 +76,11 @@ class TkTextTag<TkObject
end
def first
- TkText::IndexString.new(@id + '.first')
+ Tk::Text::IndexString.new(@id + '.first')
end
def last
- TkText::IndexString.new(@id + '.last')
+ Tk::Text::IndexString.new(@id + '.last')
end
def add(*indices)
@@ -83,7 +99,7 @@ class TkTextTag<TkObject
l = tk_split_simplelist(tk_call_without_enc(@t.path, 'tag', 'ranges', @id))
r = []
while key=l.shift
- r.push [TkText::IndexString.new(key), TkText::IndexString.new(l.shift)]
+ r.push [Tk::Text::IndexString.new(key), Tk::Text::IndexString.new(l.shift)]
end
r
end
@@ -92,7 +108,7 @@ class TkTextTag<TkObject
simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id,
_get_eval_enc_str(first),
_get_eval_enc_str(last))).collect{|idx|
- TkText::IndexString.new(idx)
+ Tk::Text::IndexString.new(idx)
}
end
@@ -100,7 +116,7 @@ class TkTextTag<TkObject
simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id,
_get_eval_enc_str(first),
_get_eval_enc_str(last))).collect{|idx|
- TkText::IndexString.new(idx)
+ Tk::Text::IndexString.new(idx)
}
end
@@ -116,6 +132,9 @@ class TkTextTag<TkObject
def cget(key)
@t.tag_cget @id, key
end
+ def cget_strict(key)
+ @t.tag_cget_strict @id, key
+ end
=begin
def cget(key)
case key.to_s
@@ -221,40 +240,58 @@ class TkTextTag<TkObject
def destroy
tk_call_without_enc(@t.path, 'tag', 'delete', @id)
- TTagID_TBL[@tpath].delete(@id) if TTagID_TBL[@tpath]
+ TTagID_TBL.mutex.synchronize{
+ TTagID_TBL[@tpath].delete(@id) if TTagID_TBL[@tpath]
+ }
self
end
end
+TktTag = TkTextTag
class TkTextNamedTag<TkTextTag
def self.new(parent, name, *args)
- if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
- tagobj = TTagID_TBL[parent.path][name]
- if args != []
- keys = args.pop
- if keys.kind_of?(Hash)
- tagobj.add(*args) if args != []
- tagobj.configure(keys)
- else
- args.push keys
- tagobj.add(*args)
- end
+ tagobj = nil
+ TTagID_TBL.mutex.synchronize{
+ if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
+ tagobj = TTagID_TBL[parent.path][name]
+ else
+ # super(parent, name, *args)
+ (tagobj = self.allocate).instance_eval{
+ @parent = @t = parent
+ @tpath = parent.path
+ @path = @id = name
+ TTagID_TBL[@id] = self
+ TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
+ TTagID_TBL[@tpath][@id] = self unless TTagID_TBL[@tpath][@id]
+ @t._addtag @id, self
+ }
+ end
+ }
+
+ if args != []
+ keys = args.pop
+ if keys.kind_of?(Hash)
+ tagobj.add(*args) if args != []
+ tagobj.configure(keys)
+ else
+ args.push keys
+ tagobj.add(*args)
end
- return tagobj
- else
- super(parent, name, *args)
end
+
+ tagobj
end
def initialize(parent, name, *args)
- #unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ # dummy:: not called by 'new' method
+
+ #unless parent.kind_of?(Tk::Text)
+ # fail ArgumentError, "expect Tk::Text for 1st argument"
#end
@parent = @t = parent
@tpath = parent.path
@path = @id = name
- TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
- TTagID_TBL[@tpath][@id] = self unless TTagID_TBL[@tpath][@id]
+
#if mode
# tk_call @t.path, "addtag", @id, *args
#end
@@ -268,12 +305,14 @@ class TkTextNamedTag<TkTextTag
add(*args)
end
end
- @t._addtag id, self
+ @t._addtag @id, self
end
end
+TktNamedTag = TkTextNamedTag
class TkTextTagSel<TkTextNamedTag
def self.new(parent, *args)
super(parent, 'sel', *args)
end
end
+TktTagSel = TkTextTagSel
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index 605c40addd..004422e4f3 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -5,11 +5,11 @@ require 'tk'
require 'tk/text'
class TkTextWindow<TkObject
- include TkText::IndexModMethods
+ include Tk::Text::IndexModMethods
def initialize(parent, index, keys = {})
- #unless parent.kind_of?(TkText)
- # fail ArgumentError, "expect TkText for 1st argument"
+ #unless parent.kind_of?(Tk::Text)
+ # fail ArgumentError, "expect Tk::Text for 1st argument"
#end
@t = parent
if index == 'end' || index == :end
@@ -55,7 +55,7 @@ class TkTextWindow<TkObject
end
def id
- TkText::IndexString.new(_epath(@id))
+ Tk::Text::IndexString.new(_epath(@id))
end
def mark
@path
@@ -72,6 +72,9 @@ class TkTextWindow<TkObject
def cget(slot)
@t.window_cget(@index, slot)
end
+ def cget_strict(slot)
+ @t.window_cget_strict(@index, slot)
+ end
def configure(slot, value=None)
if slot.kind_of?(Hash)
@@ -147,3 +150,5 @@ class TkTextWindow<TkObject
value
end
end
+
+TktWindow = TkTextWindow
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index 47f2b79350..91840d0575 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -11,7 +11,12 @@ class TkTimer
TkCommandNames = ['after'.freeze].freeze
- Tk_CBID = ['a'.freeze, '00000'.taint].freeze
+ (Tk_CBID = ['a'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
Tk_CBTBL = {}.taint
TkCore::INTERP.add_tk_procs('rb_after', 'id', <<-'EOL')
@@ -96,9 +101,9 @@ class TkTimer
return self
end
@after_script = "rb_after #{@id}"
- @after_id = tk_call_without_enc('after', sleep, @after_script)
@current_args = args
@current_script = [sleep, @after_script]
+ @after_id = tk_call_without_enc('after', sleep, @after_script)
self
end
@@ -106,7 +111,8 @@ class TkTimer
if @running == false || @proc_max == 0 || @do_loop == 0
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
if @current_pos >= @proc_max
@@ -115,7 +121,8 @@ class TkTimer
else
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
end
@@ -138,12 +145,16 @@ class TkTimer
end
def initialize(*args, &b)
- # @id = Tk_CBID.join('')
- @id = Tk_CBID.join(TkCore::INTERP._ip_id_)
- Tk_CBID[1].succ!
+ Tk_CBID.mutex.synchronize{
+ # @id = Tk_CBID.join('')
+ @id = Tk_CBID.join(TkCore::INTERP._ip_id_)
+ Tk_CBID[1].succ!
+ }
@wait_var = TkVariable.new(0)
+ @at_end_proc = nil
+
@cb_cmd = TkCore::INTERP.get_cb_entry(self.method(:do_callback))
@set_next = true
@@ -203,6 +214,12 @@ class TkTimer
attr_accessor :loop_exec
+ def __at_end__
+ @at_end_proc.call(self) if @at_end_proc
+ @wait_var.value = 0 # for wait
+ end
+ private :__at_end__
+
def cb_call
@cb_cmd.call
end
@@ -420,7 +437,8 @@ class TkTimer
def cancel
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
tk_call 'after', 'cancel', @after_id if @after_id
@after_id = nil
@@ -464,6 +482,21 @@ class TkTimer
end
end
+ def at_end(*arg, &b)
+ if arg.empty?
+ if b
+ @at_end_proc = b
+ else
+ # no proc
+ return @at_end_proc
+ end
+ else
+ fail ArgumentError, "wrong number of arguments" if arg.length != 1 || b
+ @at_end_proc = arg[0]
+ end
+ self
+ end
+
def wait(on_thread = true, check_root = false)
if $SAFE >= 4
fail SecurityError, "can't wait timer at $SAFE >= 4"
@@ -562,7 +595,8 @@ class TkRTTimer < TkTimer
if @running == false || @proc_max == 0 || @do_loop == 0
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
if @current_pos >= @proc_max
@@ -571,7 +605,8 @@ class TkRTTimer < TkTimer
else
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
end
diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb
index 33920aba77..bd6e8307f5 100644
--- a/ext/tk/lib/tk/toplevel.rb
+++ b/ext/tk/lib/tk/toplevel.rb
@@ -5,7 +5,7 @@ require 'tk'
require 'tk/wm'
require 'tk/menuspec'
-class TkToplevel<TkWindow
+class Tk::Toplevel<TkWindow
include Wm
include TkMenuSpec
@@ -45,6 +45,21 @@ 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
@@ -57,7 +72,7 @@ class TkToplevel<TkWindow
conf_methods = _symbolkey2str(__methodcall_optkeys())
- keys.each{|k,v|
+ keys.each{|k,v| # k is a String
if conf_methods.key?(k)
wm_cmds[conf_methods[k]] = v
elsif Wm.method_defined?(k)
@@ -102,9 +117,10 @@ class TkToplevel<TkWindow
end
if @classname.kind_of? TkBindTag
@db_class = @classname
- @classname = @classname.id
+ keys['class'] = @classname = @classname.id
elsif @classname
@db_class = TkDatabaseClass.new(@classname)
+ keys['class'] = @classname
else
@db_class = self.class
@classname = @db_class::WidgetClassName
@@ -150,9 +166,10 @@ class TkToplevel<TkWindow
end
if @classname.kind_of? TkBindTag
@db_class = @classname
- @classname = @classname.id
+ keys['class'] = @classname = @classname.id
elsif @classname
@db_class = TkDatabaseClass.new(@classname)
+ keys['class'] = @classname
else
@db_class = self.class
@classname = @db_class::WidgetClassName
@@ -240,3 +257,6 @@ class TkToplevel<TkWindow
end
end
end
+
+#TkToplevel = Tk::Toplevel unless Object.const_defined? :TkToplevel
+Tk.__set_toplevel_aliases__(:Tk, Tk::Toplevel, :TkToplevel)
diff --git a/ext/tk/lib/tk/ttk_selector.rb b/ext/tk/lib/tk/ttk_selector.rb
new file mode 100644
index 0000000000..72ed637a38
--- /dev/null
+++ b/ext/tk/lib/tk/ttk_selector.rb
@@ -0,0 +1,76 @@
+#
+# ttk_selector
+#
+######################################
+# toplevel classes/modules
+module Tk
+ @TOPLEVEL_ALIAS_TABLE[:Ttk] = {
+ :TkButton => 'tkextlib/tile/tbutton',
+
+ :TkCheckbutton => 'tkextlib/tile/tcheckbutton',
+ :TkCheckButton => 'tkextlib/tile/tcheckbutton',
+
+ # :TkDialog => 'tkextlib/tile/dialog',
+
+ :TkEntry => 'tkextlib/tile/tentry',
+
+ :TkCombobox => 'tkextlib/tile/tcombobox',
+
+ :TkFrame => 'tkextlib/tile/tframe',
+
+ :TkLabel => 'tkextlib/tile/tlabel',
+
+ :TkLabelframe => 'tkextlib/tile/tlabelframe',
+ :TkLabelFrame => 'tkextlib/tile/tlabelframe',
+
+ :TkMenubutton => 'tkextlib/tile/tmenubutton',
+ :TkMenuButton => 'tkextlib/tile/tmenubutton',
+
+ :TkNotebook => 'tkextlib/tile/tnotebook',
+
+ # :TkPaned => 'tkextlib/tile/tpaned',
+ :TkPanedwindow => 'tkextlib/tile/tpaned',
+ :TkPanedWindow => 'tkextlib/tile/tpaned',
+
+ :TkProgressbar => 'tkextlib/tile/tprogressbar',
+
+ :TkRadiobutton => 'tkextlib/tile/tradiobutton',
+ :TkRadioButton => 'tkextlib/tile/tradiobutton',
+
+ :TkScale => 'tkextlib/tile/tscale',
+ # :TkProgress => 'tkextlib/tile/tscale',
+
+ :TkScrollbar => 'tkextlib/tile/tscrollbar',
+ :TkXScrollbar => 'tkextlib/tile/tscrollbar',
+ :TkYScrollbar => 'tkextlib/tile/tscrollbar',
+
+ :TkSeparator => 'tkextlib/tile/tseparator',
+
+ :TkSizeGrip => 'tkextlib/tile/sizegrip',
+ :TkSizegrip => 'tkextlib/tile/sizegrip',
+
+ # :TkSquare => 'tkextlib/tile/tsquare',
+
+ :TkTreeview => 'tkextlib/tile/treeview',
+ }
+ @TOPLEVEL_ALIAS_TABLE[:Tile] = @TOPLEVEL_ALIAS_TABLE[:Ttk]
+
+ ################################################
+ # register some Ttk widgets as default
+ # (Ttk is a standard library on Tcl/Tk8.5+)
+ @TOPLEVEL_ALIAS_TABLE[:Ttk].each{|sym, file|
+ unless Object.autoload?(sym) || Object.const_defined?(sym)
+ Object.autoload(sym, file)
+ end
+ }
+
+ ################################################
+
+ @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] =
+ @TOPLEVEL_ALIAS_SETUP_PROC[:Ttk] = proc{|mod|
+ unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile)
+ Object.autoload :Ttk, 'tkextlib/tile'
+ Tk.autoload :Tile, 'tkextlib/tile'
+ end
+ }
+end
diff --git a/ext/tk/lib/tk/txtwin_abst.rb b/ext/tk/lib/tk/txtwin_abst.rb
index 5520360eab..540f806d17 100644
--- a/ext/tk/lib/tk/txtwin_abst.rb
+++ b/ext/tk/lib/tk/txtwin_abst.rb
@@ -4,7 +4,7 @@
require 'tk'
class TkTextWin<TkWindow
- TkCommnadNames = [].freeze
+ TkCommandNames = [].freeze
#def create_self
# fail RuntimeError, "TkTextWin is an abstract class"
#end
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index 0c5b5c61b9..60bd433cdc 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -50,7 +50,8 @@ module Tk
key2class.each{|key, klass|
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
- keys[key] = klass.new(cmd, args.join(' '))
+ #keys[key] = klass.new(cmd, args.join(' '))
+ keys[key] = klass.new(cmd, *args)
# elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
@@ -151,7 +152,8 @@ module Tk
key2class.each{|key, klass|
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
- keys[key] = klass.new(cmd, args.join(' '))
+ #keys[key] = klass.new(cmd, args.join(' '))
+ keys[key] = klass.new(cmd, *args)
# elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
@@ -249,6 +251,24 @@ class TkValidateCommand
nil
]
+=begin
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
+ KEY_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
+ end
+ inf
+ }
+
+ PROC_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ end
+ inf
+ }
+=end
+
_setup_subst_table(KEY_TBL, PROC_TBL);
#
@@ -277,6 +297,7 @@ class TkValidateCommand
extra_args_tbl = klass._get_extra_args_tbl
if args.compact.size > 0
+ args.map!{|arg| klass._sym2subst(arg)}
args = args.join(' ')
keys = klass._get_subst_key(args)
if cmd.kind_of?(String)
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index 1ea41b729b..f738a96ee7 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -16,11 +16,22 @@ class TkVariable
#TkVar_ID_TBL = {}
TkVar_CB_TBL = TkCore::INTERP.create_table
TkVar_ID_TBL = TkCore::INTERP.create_table
- Tk_VARIABLE_ID = ["v".freeze, "00000".taint].freeze
+ (Tk_VARIABLE_ID = ["v".freeze, "00000".taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+ TkCore::INTERP.init_ip_env{
+ TkVar_CB_TBL.mutex.synchronize{ TkVar_CB_TBL.clear }
+ TkVar_ID_TBL.mutex.synchronize{ TkVar_ID_TBL.clear }
+ }
+
+ major, minor, type, type_name, patchlevel = TclTkLib.get_version
+ USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4)
#TkCore::INTERP.add_tk_procs('rb_var', 'args',
# "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
-TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
+ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} {
set idx [string first "\n\n" $ret]
if {$idx > 0} {
@@ -44,10 +55,10 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
def TkVariable.callback(id, name1, name2, op)
#name1,name2,op = tk_split_list(args)
#name1,name2,op = tk_split_simplelist(args)
- if TkVar_CB_TBL[id]
+ if cb_obj = TkVar_CB_TBL[id]
#_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(cb_obj.trace_callback(name2, op))
rescue SystemExit
exit(0)
rescue Interrupt
@@ -59,7 +70,11 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
"\n---< backtrace of Ruby side >-----\n" +
_toUTF8(e.backtrace.join("\n")) +
"\n---< backtrace of Tk side >-------"
- msg.instance_variable_set(:@encoding, 'utf-8')
+ if TkCore::WITH_ENCODING
+ msg.force_encoding('utf-8')
+ else
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ end
rescue Exception
msg = e.class.inspect + ': ' + e.message + "\n" +
"\n---< backtrace of Ruby side >-----\n" +
@@ -266,9 +281,16 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
def initialize(val="", type=nil)
# @id = Tk_VARIABLE_ID.join('')
- @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
- Tk_VARIABLE_ID[1].succ!
- TkVar_ID_TBL[@id] = self
+ begin
+ Tk_VARIABLE_ID.mutex.synchronize{
+ @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
+ Tk_VARIABLE_ID[1].succ!
+ }
+ end until INTERP._invoke_without_enc('info', 'globals', @id).empty?
+
+ TkVar_ID_TBL.mutex.synchronize{
+ TkVar_ID_TBL[@id] = self
+ }
@var = @id
@elem = nil
@@ -286,11 +308,6 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
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)
#INTERP._invoke('global', @id)
@@ -1265,56 +1282,101 @@ end
end
end
+ def _check_trace_opt(opts)
+ if opts.kind_of?(Array)
+ opt_str = opts.map{|s| s.to_s}.join(' ')
+ else
+ opt_str = opts.to_s
+ end
+
+ fail ArgumentError, 'null trace option' if opt_str.empty?
+
+ if opt_str =~ /[^arwu\s]/
+ # new format (Tcl/Tk8.4+?)
+ if opts.kind_of?(Array)
+ opt_ary = opts.map{|opt| opt.to_s.strip}
+ else
+ opt_ary = opt_str.split(/\s+|\|/)
+ opt_ary.delete('')
+ end
+ if USE_OLD_TRACE_OPTION_STYLE
+ opt_ary.uniq.map{|opt|
+ case opt
+ when 'array'
+ 'a'
+ when 'read'
+ 'r'
+ when 'write'
+ 'w'
+ when 'unset'
+ 'u'
+ else
+ fail ArgumentError, "unsupported trace option '#{opt}' on Tcl/Tk#{Tk::TCL_PATCHLEVEL}"
+ end
+ }.join
+ else
+ opt_ary
+ end
+ else
+ # old format
+ opt_ary = opt_str.delete('^arwu').split(//).uniq
+ if USE_OLD_TRACE_OPTION_STYLE
+ opt_ary.join
+ else
+ opt_ary.map{|c|
+ case c
+ when 'a'
+ 'array'
+ when 'r'
+ 'read'
+ when 'w'
+ 'write'
+ when 'u'
+ 'unset'
+ end
+ }
+ end
+ end
+ end
+ private :_check_trace_opt
+
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('')
- @trace_var.unshift([opts,cmd])
+ opts = _check_trace_opt(opts)
+ (@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)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
+ @trace_opts = opts
+ if USE_OLD_TRACE_OPTION_STYLE
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
end
-=end
else
newopts = @trace_opts.dup
- #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)
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
+ if USE_OLD_TRACE_OPTION_STYLE
+ opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
+ if newopts != @trace_opts
Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
@trace_opts.replace(newopts)
Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
+ end
+ else
+ newopts |= opts
+ unless (newopts - @trace_opts).empty?
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
end
-=end
end
end
+
self
end
@@ -1323,65 +1385,54 @@ end
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('')
- @trace_elem[elem].unshift([opts,cmd])
+
+ opts = _check_trace_opt(opts)
+
+ ((@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)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
+ @trace_opts = opts
+ if USE_OLD_TRACE_OPTION_STYLE
Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
else
- # TCL_VERSION <= 8.3
Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
end
-=end
else
newopts = @trace_opts.dup
- # 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)
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
+ if USE_OLD_TRACE_OPTION_STYLE
+ opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
+ if newopts != @trace_opts
Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
@trace_opts.replace(newopts)
Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
+ end
+ else
+ newopts |= opts
+ unless (newopts - @trace_opts).empty?
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
end
-=end
end
end
+
self
end
- def trace_vinfo
+ def trace_info
return [] unless @trace_var
@trace_var.dup
end
+ alias trace_vinfo trace_info
- def _trace_vinfo_for_element(elem)
+ def trace_info_for_element(elem)
if @elem
fail(RuntimeError,
"invalid for a TkVariable which denotes an element of Tcl's array")
@@ -1390,141 +1441,180 @@ end
return [] unless @trace_elem[elem]
@trace_elem[elem].dup
end
+ alias trace_vinfo_for_element trace_info_for_element
- def trace_vdelete(opts,cmd)
+ def trace_remove(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 = _check_trace_opt(opts)
+
idx = -1
- newopts = ''
- @trace_var.each_with_index{|e,i|
- if idx < 0 && e[0] == opts && e[1] == cmd
- idx = i
- next
- end
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
- }
+ if USE_OLD_TRACE_OPTION_STYLE
+ newopts = ''
+ @trace_var.each_with_index{|e, i|
+ if idx < 0 && e[1] == cmd
+ diff = false
+ ['a', 'r', 'w', 'u'].each{|c|
+ break if (diff = e[0].index(c) ^ opts.index(c))
+ }
+ unless diff
+ #find
+ idx = i
+ next
+ end
+ end
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
+ }
+ else
+ newopts = []
+ @trace_var.each_with_index{|e, i|
+ if idx < 0 && e[1] == cmd &&
+ e[0].size == opts.size && (e[0] - opts).empty?
+ # find
+ idx = i
+ next
+ end
+ newopts |= e[0]
+ }
+ end
+
if idx >= 0
@trace_var.delete_at(idx)
else
return self
end
- @trace_elem.each{|elem|
+ (@trace_elem ||= {}).each{|elem|
@trace_elem[elem].each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
+ if USE_OLD_TRACE_OPTION_STYLE
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
+ else
+ newopts |= e[0]
+ end
}
}
- newopts = newopts.to_s
- newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
- if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts,
- 'rb_var ' << @id)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
+ if USE_OLD_TRACE_OPTION_STYLE
+ diff = false
+ @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))}
+ if diff
Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
+ @trace_opts.replace(newopts)
+ unless @trace_opts.empty?
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
+ end
end
-=end
- @trace_opts.replace(newopts)
- if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
+ else
+ unless (@trace_opts - newopts).empty?
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
+ @trace_opts.replace(newopts)
+ unless @trace_opts.empty?
Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
end
-=end
end
end
self
end
+ alias trace_delete trace_remove
+ alias trace_vdelete trace_remove
- def trace_vdelete_for_element(elem,opts,cmd)
+ def trace_remove_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 = _check_trace_opt(opts)
+
idx = -1
- @trace_elem[elem].each_with_index{|e,i|
- if idx < 0 && e[0] == opts && e[1] == cmd
- idx = i
- next
- end
- }
+ if USE_OLD_TRACE_OPTION_STYLE
+ @trace_elem[elem].each_with_index{|e, i|
+ if idx < 0 && e[1] == cmd
+ diff = false
+ ['a', 'r', 'w', 'u'].each{|c|
+ break if (diff = e[0].index(c) ^ opts.index(c))
+ }
+ unless diff
+ #find
+ idx = i
+ next
+ end
+ end
+ }
+ else
+ @trace_elem[elem].each_with_index{|e, i|
+ if idx < 0 && e[1] == cmd &&
+ e[0].size == opts.size && (e[0] - opts).empty?
+ # find
+ idx = i
+ next
+ end
+ }
+ end
+
if idx >= 0
@trace_elem[elem].delete_at(idx)
else
return self
end
- newopts = ''
- @trace_var.each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
- }
- @trace_elem.each{|elem|
- @trace_elem[elem].each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
+ if USE_OLD_TRACE_OPTION_STYLE
+ newopts = ''
+ @trace_var.each{|e|
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
}
- }
+ @trace_elem.each{|elem|
+ @trace_elem[elem].each{|e|
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
+ }
+ }
+ else
+ newopts = []
+ @trace_var.each{|e|
+ newopts |= e[0]
+ }
+ @trace_elem.each{|elem|
+ @trace_elem[elem].each{|e|
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
+ }
+ }
+ end
- newopts = newopts.to_s
- newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
- if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts,
- 'rb_var ' << @id)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
+ if USE_OLD_TRACE_OPTION_STYLE
+ diff = false
+ @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))}
+ if diff
Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
+ @trace_opts.replace(newopts)
+ unless @trace_opts.empty?
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
+ end
end
-=end
- @trace_opts.replace(newopts)
- if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts,
- 'rb_var ' << @id)
-=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
+ else
+ unless (@trace_opts - newopts).empty?
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var ' << @id)
+ @trace_opts.replace(newopts)
+ unless @trace_opts.empty?
Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable', @id,
- @trace_opts, 'rb_var')
+ @id, @trace_opts, 'rb_var ' << @id)
end
-=end
end
end
self
end
+ alias trace_delete_for_element trace_remove_for_element
+ alias trace_vdelete_for_element trace_remove_for_element
end
class TkVarAccess<TkVariable
@@ -1534,12 +1624,23 @@ class TkVarAccess<TkVariable
return name
end
- if v = TkVar_ID_TBL[name]
- v.value = args[0] unless args.empty?
- return v
- end
+ name = name.to_s
+ v = nil
+ TkVar_ID_TBL.mutex.synchronize{
+ if v = TkVar_ID_TBL[name]
+ v.value = args[0] unless args.empty?
+ return v
+ else
+ (v = self.allocate).instance_eval{
+ @id = name
+ TkVar_ID_TBL[@id] = self
+ @var = @id
+ }
+ end
+ }
- super(name, *args)
+ v.instance_eval{ initialize(name, *args) }
+ v
end
def self.new_hash(name, *args)
@@ -1551,27 +1652,38 @@ class TkVarAccess<TkVariable
return name
end
- if v = TkVar_ID_TBL[name]
- unless v.is_hash?
- fail ArgumentError, "already exist as a scalar variable"
+ name = name.to_s
+ v = nil
+ TkVar_ID_TBL.mutex.synchronize{
+ 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
+ else
+ (v = self.allocate).instance_eval{
+ @id = name
+ TkVar_ID_TBL[@id] = self
+ @var = @id
+ }
end
- v.value = args[0] unless args.empty?
- return v
- end
+ }
INTERP._invoke_without_enc('global', name)
if args.empty? && INTERP._invoke_without_enc('array', 'exist', name) == '0'
- self.new(name, {}) # force creating
+ v.instance_eval{ initialize(name, {}) } # force creating
else
- self.new(name, *args)
+ v.instance_eval{ initialize(name, *args) }
end
+ v
end
def initialize(varname, val=nil)
- @id = varname
- TkVar_ID_TBL[@id] = self
+ # @id = varname
+ # TkVar_ID_TBL[@id] = self
- @var = @id
+ # @var = @id
@elem = nil
@def_default = false
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
index a1a94d3c55..ae31ac1f8f 100644
--- a/ext/tk/lib/tk/virtevent.rb
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -9,21 +9,49 @@ class TkVirtualEvent<TkObject
TkCommandNames = ['event'.freeze].freeze
- TkVirtualEventID = ["VirtEvent".freeze, "00000".taint].freeze
+ (TkVirtualEventID = ["VirtEvent".freeze, "00000".taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
TkVirtualEventTBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ TkVirtualEventTBL.clear }
+ TkCore::INTERP.init_ip_env{
+ TkVirtualEventTBL.mutex.synchronize{ TkVirtualEventTBL.clear }
+ }
class PreDefVirtEvent<self
+ def self.new(event, *sequences)
+ if event =~ /^<(<.*>)>$/
+ event = $1
+ elsif event !~ /^<.*>$/
+ event = '<' + event + '>'
+ end
+ TkVirtualEvent::TkVirtualEventTBL.mutex.synchronize{
+ if TkVirtualEvent::TkVirtualEventTBL.has_key?(event)
+ TkVirtualEvent::TkVirtualEventTBL[event]
+ else
+ # super(event, *sequences)
+ (obj = self.allocate).instance_eval{
+ initialize(event, *sequences)
+ TkVirtualEvent::TkVirtualEventTBL[@id] = self
+ }
+ end
+ }
+ end
+
def initialize(event, *sequences)
@path = @id = event
- TkVirtualEvent::TkVirtualEventTBL[@id] = self
- add(*sequences)
+ _add_sequences(sequences)
end
end
def TkVirtualEvent.getobj(event)
- obj = TkVirtualEventTBL[event]
+ obj = nil
+ TkVirtualEventTBL.mutex.synchronize{
+ obj = TkVirtualEventTBL[event]
+ }
if obj
obj
else
@@ -42,19 +70,31 @@ class TkVirtualEvent<TkObject
end
def initialize(*sequences)
- # @path = @id = '<' + TkVirtualEventID.join('') + '>'
- @path = @id = '<' + TkVirtualEventID.join(TkCore::INTERP._ip_id_) + '>'
- TkVirtualEventID[1].succ!
- add(*sequences)
+ TkVirtualEventID.mutex.synchronize{
+ # @path = @id = '<' + TkVirtualEventID.join('') + '>'
+ @path = @id = '<' + TkVirtualEventID.join(TkCore::INTERP._ip_id_) + '>'
+ TkVirtualEventID[1].succ!
+ }
+ _add_sequences(sequences)
end
- def add(*sequences)
- if sequences != []
+ def _add_sequences(seq_ary)
+ unless seq_ary.empty?
tk_call_without_enc('event', 'add', "<#{@id}>",
- *(sequences.collect{|seq|
+ *(seq_ary.collect{|seq|
"<#{tk_event_sequence(seq)}>"
}) )
- TkVirtualEventTBL[@id] = self
+ end
+ self
+ end
+ private :_add_sequences
+
+ def add(*sequences)
+ if sequences != []
+ _add_sequences(sequences)
+ TkVirtualEventTBL.mutex.synchronize{
+ TkVirtualEventTBL[@id] = self
+ }
end
self
end
@@ -62,20 +102,26 @@ class TkVirtualEvent<TkObject
def delete(*sequences)
if sequences == []
tk_call_without_enc('event', 'delete', "<#{@id}>")
- TkVirtualEventTBL.delete(@id)
+ TkVirtualEventTBL.mutex.synchronize{
+ TkVirtualEventTBL.delete(@id)
+ }
else
tk_call_without_enc('event', 'delete', "<#{@id}>",
*(sequences.collect{|seq|
"<#{tk_event_sequence(seq)}>"
}) )
- TkVirtualEventTBL.delete(@id) if info == []
+ if tk_call_without_enc('event','info',"<#{@id}>").empty?
+ TkVirtualEventTBL.mutex.synchronize{
+ TkVirtualEventTBL.delete(@id)
+ }
+ end
end
self
end
def info
tk_call_without_enc('event','info',"<#{@id}>").split(/\s+/).collect!{|seq|
- l = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
+ lst = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
case (subseq)
when /^<<[^<>]+>>$/
TkVirtualEvent.getobj(subseq[1..-2])
@@ -85,7 +131,9 @@ class TkVirtualEvent<TkObject
subseq.split('')
end
}.flatten
- (l.size == 1) ? l[0] : l
+ (lst.size == 1) ? lst[0] : lst
}
end
end
+
+TkNamedVirtualEvent = TkVirtualEvent::PreDefVirtEvent
diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb
index 737fb959b5..89fb391c77 100644
--- a/ext/tk/lib/tk/winpkg.rb
+++ b/ext/tk/lib/tk/winpkg.rb
@@ -7,9 +7,14 @@
#
require 'tk'
-module TkWinDDE
+module Tk::WinDDE
+end
+#TkWinDDE = Tk::WinDDE
+Tk.__set_toplevel_aliases__(:Tk, Tk::WinDDE, :TkWinDDE)
+
+module Tk::WinDDE
extend Tk
- extend TkWinDDE
+ extend Tk::WinDDE
TkCommandNames = ['dde'.freeze].freeze
@@ -85,9 +90,14 @@ module TkWinDDE
:poke, :request, :services, :eval
end
-module TkWinRegistry
+module Tk::WinRegistry
+end
+#TkWinRegistry = Tk::WinRegistry
+Tk.__set_toplevel_aliases__(:Tk, Tk::WinRegistry, :TkWinRegistry)
+
+module Tk::WinRegistry
extend Tk
- extend TkWinRegistry
+ extend Tk::WinRegistry
TkCommandNames = ['registry'.freeze].freeze
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
index 1f432a3848..0394296189 100644
--- a/ext/tk/lib/tk/wm.rb
+++ b/ext/tk/lib/tk/wm.rb
@@ -5,273 +5,407 @@ require 'tk'
module Tk
module Wm
- include TkComm
+ #include TkComm
+ extend TkCore
TkCommandNames = ['wm'.freeze].freeze
TOPLEVEL_METHODCALL_OPTKEYS = {}
- def aspect(*args)
+ def Wm.aspect(win, *args)
if args.length == 0
- list(tk_call_without_enc('wm', 'aspect', path))
+ list(tk_call_without_enc('wm', 'aspect', win.epath))
else
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
- tk_call('wm', 'aspect', path, *args)
- self
+ tk_call('wm', 'aspect', win.epath, *args)
+ win
end
end
+ def aspect(*args)
+ Wm.aspect(self, *args)
+ end
+ alias wm_aspect aspect
TOPLEVEL_METHODCALL_OPTKEYS['aspect'] = 'aspect'
- def attributes(slot=nil,value=None)
+ def Wm.attributes(win, slot=nil,value=TkComm::None)
if slot == nil
- lst = tk_split_list(tk_call('wm', 'attributes', path))
+ lst = tk_split_list(tk_call('wm', 'attributes', win.epath))
info = {}
while key = lst.shift
info[key[1..-1]] = lst.shift
end
info
elsif slot.kind_of? Hash
- tk_call('wm', 'attributes', path, *hash_kv(slot))
- self
- elsif value == None
- tk_call('wm', 'attributes', path, "-#{slot}")
+ tk_call('wm', 'attributes', win.epath, *hash_kv(slot))
+ win
+ elsif value == TkComm::None
+ tk_call('wm', 'attributes', win.epath, "-#{slot}")
else
- tk_call('wm', 'attributes', path, "-#{slot}", value)
- self
+ tk_call('wm', 'attributes', win.epath, "-#{slot}", value)
+ win
end
end
+ def attributes(slot=nil,value=TkComm::None)
+ Wm.attributes(self, slot, value)
+ end
+ alias wm_attributes attributes
TOPLEVEL_METHODCALL_OPTKEYS['attributes'] = 'attributes'
- def client(name=None)
- if name == None
- tk_call('wm', 'client', path)
+ def Wm.client(win, name=TkComm::None)
+ if name == TkComm::None
+ tk_call('wm', 'client', win.epath)
else
name = '' if name == nil
- tk_call('wm', 'client', path, name)
- self
+ tk_call('wm', 'client', win.epath, name)
+ win
end
end
+ def client(name=TkComm::None)
+ Wm.client(self, name)
+ end
+ alias wm_client client
TOPLEVEL_METHODCALL_OPTKEYS['client'] = 'client'
- def colormapwindows(*args)
+ def Wm.colormapwindows(win, *args)
if args.size == 0
- list(tk_call_without_enc('wm', 'colormapwindows', path))
+ list(tk_call_without_enc('wm', 'colormapwindows', win.epath))
else
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
- tk_call_without_enc('wm', 'colormapwindows', path, *args)
- self
+ tk_call_without_enc('wm', 'colormapwindows', win.epath, *args)
+ win
end
end
+ def colormapwindows(*args)
+ Wm.colormapwindows(self, *args)
+ end
+ alias wm_colormapwindows colormapwindows
TOPLEVEL_METHODCALL_OPTKEYS['colormapwindows'] = 'colormapwindows'
- def wm_command(value=nil)
+ def Wm.command(win, value=nil)
if value
- tk_call('wm', 'command', path, value)
- self
+ tk_call('wm', 'command', epath, value)
+ win
else
- #procedure(tk_call('wm', 'command', path))
- tk_call('wm', 'command', path)
+ #procedure(tk_call('wm', 'command', epath))
+ tk_call('wm', 'command', epath)
end
end
+ def wm_command(value=nil)
+ Wm.command(self, value)
+ end
TOPLEVEL_METHODCALL_OPTKEYS['wm_command'] = 'wm_command'
- def deiconify(ex = true)
+ def Wm.deiconify(win, ex = true)
if ex
- tk_call_without_enc('wm', 'deiconify', path)
+ tk_call_without_enc('wm', 'deiconify', win.epath)
else
- self.iconify
+ Wm.iconify(win)
end
- self
+ win
end
+ def deiconify(ex = true)
+ Wm.deiconify(self, ex)
+ end
+ alias wm_deiconify deiconify
- def focusmodel(mode = nil)
+ def Wm.focusmodel(win, mode = nil)
if mode
- tk_call_without_enc('wm', 'focusmodel', path, mode)
- self
+ tk_call_without_enc('wm', 'focusmodel', win.epath, mode)
+ win
else
- tk_call_without_enc('wm', 'focusmodel', path)
+ tk_call_without_enc('wm', 'focusmodel', win.epath)
end
end
+ def focusmodel(mode = nil)
+ Wm.focusmodel(self, mode)
+ end
+ alias wm_focusmodel focusmodel
TOPLEVEL_METHODCALL_OPTKEYS['focusmodel'] = 'focusmodel'
+ def Wm.forget(win)
+ # Tcl/Tk 8.5+
+ # work with dockable frames
+ tk_call_without_enc('wm', 'forget', win.epath)
+ win
+ end
+ def wm_forget
+ Wm.forget(self)
+ end
+
+ def Wm.frame(win)
+ tk_call_without_enc('wm', 'frame', win.epath)
+ end
def frame
- tk_call_without_enc('wm', 'frame', path)
+ Wm.frame(self)
end
+ alias wm_frame frame
- def geometry(geom=nil)
+ def Wm.geometry(win, geom=nil)
if geom
- tk_call_without_enc('wm', 'geometry', path, geom)
- self
+ tk_call_without_enc('wm', 'geometry', win.epath, geom)
+ win
else
- tk_call_without_enc('wm', 'geometry', path)
+ tk_call_without_enc('wm', 'geometry', win.epath)
end
end
+ def geometry(geom=nil)
+ Wm.geometry(self, geom)
+ end
+ alias wm_geometry geometry
TOPLEVEL_METHODCALL_OPTKEYS['geometry'] = 'geometry'
- def wm_grid(*args)
+ def Wm.grid(win, *args)
if args.size == 0
- list(tk_call_without_enc('wm', 'grid', path))
+ list(tk_call_without_enc('wm', 'grid', win.epath))
else
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
- tk_call_without_enc('wm', 'grid', path, *args)
- self
+ tk_call_without_enc('wm', 'grid', win.epath, *args)
+ win
end
end
+ def wm_grid(*args)
+ Wm.grid(self, *args)
+ end
TOPLEVEL_METHODCALL_OPTKEYS['wm_grid'] = 'wm_grid'
- def group(leader = nil)
+ def Wm.group(win, leader = nil)
if leader
- tk_call('wm', 'group', path, leader)
- self
+ tk_call('wm', 'group', win.epath, leader)
+ win
else
- window(tk_call('wm', 'group', path))
+ window(tk_call('wm', 'group', win.epath))
end
end
+ def group(leader = nil)
+ Wm.group(self, leader)
+ end
+ alias wm_group group
TOPLEVEL_METHODCALL_OPTKEYS['group'] = 'group'
- def iconbitmap(bmp=nil)
+ def Wm.iconbitmap(win, bmp=nil)
if bmp
- tk_call_without_enc('wm', 'iconbitmap', path, bmp)
- self
+ tk_call_without_enc('wm', 'iconbitmap', win.epath, bmp)
+ win
else
- image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
+ image_obj(tk_call_without_enc('wm', 'iconbitmap', win.epath))
end
end
+ def iconbitmap(bmp=nil)
+ Wm.iconbitmap(self, bmp)
+ end
+ alias wm_iconbitmap iconbitmap
TOPLEVEL_METHODCALL_OPTKEYS['iconbitmap'] = 'iconbitmap'
- def iconphoto(*imgs)
+ def Wm.iconphoto(win, *imgs)
if imgs.empty?
- @wm_iconphoto = nil unless defined? @wm_iconphoto
- return @wm_iconphoto
+ win.instance_eval{
+ @wm_iconphoto = nil unless defined? @wm_iconphoto
+ return @wm_iconphoto
+ }
end
imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
- tk_call_without_enc('wm', 'iconphoto', path, *imgs)
- @wm_iconphoto = imgs
- self
+ tk_call_without_enc('wm', 'iconphoto', win.epath, *imgs)
+ win.instance_eval{ @wm_iconphoto = imgs }
+ win
+ end
+ def iconphoto(*imgs)
+ Wm.iconphoto(self, *imgs)
end
+ alias wm_iconphoto iconphoto
TOPLEVEL_METHODCALL_OPTKEYS['iconphoto'] = 'iconphoto'
- def iconphoto_default(*imgs)
+ def Wm.iconphoto_default(win, *imgs)
imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
- tk_call_without_enc('wm', 'iconphoto', path, '-default', *imgs)
- self
+ tk_call_without_enc('wm', 'iconphoto', win.epath, '-default', *imgs)
+ win
+ end
+ def iconphoto_default(*imgs)
+ Wm.iconphoto_default(self, *imgs)
end
+ alias wm_iconphoto_default iconphoto_default
- def iconify(ex = true)
+ def Wm.iconify(win, ex = true)
if ex
- tk_call_without_enc('wm', 'iconify', path)
+ tk_call_without_enc('wm', 'iconify', win.epath)
else
- self.deiconify
+ Wm.deiconify(win)
end
- self
+ win
+ end
+ def iconify(ex = true)
+ Wm.iconify(self, ex)
end
+ alias wm_iconify iconify
- def iconmask(bmp=nil)
+ def Wm.iconmask(win, bmp=nil)
if bmp
- tk_call_without_enc('wm', 'iconmask', path, bmp)
- self
+ tk_call_without_enc('wm', 'iconmask', win.epath, bmp)
+ win
else
- image_obj(tk_call_without_enc('wm', 'iconmask', path))
+ image_obj(tk_call_without_enc('wm', 'iconmask', win.epath))
end
end
+ def iconmask(bmp=nil)
+ Wm.iconmask(self, bmp)
+ end
+ alias wm_iconmask iconmask
TOPLEVEL_METHODCALL_OPTKEYS['iconmask'] = 'iconmask'
- def iconname(name=nil)
+ def Wm.iconname(win, name=nil)
if name
- tk_call('wm', 'iconname', path, name)
- self
+ tk_call('wm', 'iconname', win.epath, name)
+ win
else
- tk_call('wm', 'iconname', path)
+ tk_call('wm', 'iconname', win.epath)
end
end
+ def iconname(name=nil)
+ Wm.iconname(self, name)
+ end
+ alias wm_iconname iconname
TOPLEVEL_METHODCALL_OPTKEYS['iconname'] = 'iconname'
- def iconposition(*args)
+ def Wm.iconposition(win, *args)
if args.size == 0
- list(tk_call_without_enc('wm', 'iconposition', path))
+ list(tk_call_without_enc('wm', 'iconposition', win.epath))
else
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
- tk_call_without_enc('wm', 'iconposition', path, *args)
- self
+ tk_call_without_enc('wm', 'iconposition', win.epath, *args)
+ win
end
end
+ def iconposition(*args)
+ Wm.iconposition(self, *args)
+ end
+ alias wm_iconposition iconposition
TOPLEVEL_METHODCALL_OPTKEYS['iconposition'] = 'iconposition'
- def iconwindow(win = nil)
- if win
- tk_call_without_enc('wm', 'iconwindow', path, win)
- self
+ def Wm.iconwindow(win, iconwin = nil)
+ if iconwin
+ tk_call_without_enc('wm', 'iconwindow', win.epath, iconwin)
+ win
else
- w = tk_call_without_enc('wm', 'iconwindow', path)
+ w = tk_call_without_enc('wm', 'iconwindow', win.epath)
(w == '')? nil: window(w)
end
end
+ def iconwindow(iconwin = nil)
+ Wm.iconwindow(self, iconwin)
+ end
+ alias wm_iconwindow iconwindow
TOPLEVEL_METHODCALL_OPTKEYS['iconwindow'] = 'iconwindow'
- def maxsize(*args)
+ def Wm.manage(win)
+ # Tcl/Tk 8.5+ feature
+ tk_call_without_enc('wm', 'manage', win.epath)
+ win
+ end
+ def wm_manage
+ Wm.manage(self)
+ end
+=begin
+ def Wm.manage(win, use_id = nil)
+ # Tcl/Tk 8.5+ feature
+ # --------------------------------------------------------------
+ # In the future release, I want to support to embed the 'win'
+ # into the container which has window-id 'use-id'.
+ # It may give users frexibility on controlling their GUI.
+ # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1),
+ # because it seems to require to modify Tcl/Tk's source code.
+ # --------------------------------------------------------------
+ if use_id
+ tk_call_without_enc('wm', 'manage', win.epath, '-use', use_id)
+ else
+ tk_call_without_enc('wm', 'manage', win.epath)
+ end
+ win
+ end
+=end
+
+ def Wm.maxsize(win, *args)
if args.size == 0
- list(tk_call_without_enc('wm', 'maxsize', path))
+ list(tk_call_without_enc('wm', 'maxsize', win.epath))
else
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
- tk_call_without_enc('wm', 'maxsize', path, *args)
- self
+ tk_call_without_enc('wm', 'maxsize', win.epath, *args)
+ win
end
end
+ def maxsize(*args)
+ Wm.maxsize(self, *args)
+ end
+ alias wm_maxsize maxsize
TOPLEVEL_METHODCALL_OPTKEYS['maxsize'] = 'maxsize'
- def minsize(*args)
+ def Wm.minsize(win, *args)
if args.size == 0
- list(tk_call_without_enc('wm', 'minsize', path))
+ list(tk_call_without_enc('wm', 'minsize', win.epath))
else
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
- tk_call_without_enc('wm', 'minsize', path, *args)
- self
+ tk_call_without_enc('wm', 'minsize', win.path, *args)
+ win
end
end
+ def minsize(*args)
+ Wm.minsize(self, *args)
+ end
+ alias wm_minsize minsize
TOPLEVEL_METHODCALL_OPTKEYS['minsize'] = 'minsize'
- def overrideredirect(mode=None)
- if mode == None
- bool(tk_call_without_enc('wm', 'overrideredirect', path))
+ def Wm.overrideredirect(win, mode=TkComm::None)
+ if mode == TkComm::None
+ bool(tk_call_without_enc('wm', 'overrideredirect', win.epath))
else
- tk_call_without_enc('wm', 'overrideredirect', path, mode)
- self
+ tk_call_without_enc('wm', 'overrideredirect', win.epath, mode)
+ win
end
end
+ def overrideredirect(mode=TkComm::None)
+ Wm.overrideredirect(self, mode)
+ end
+ alias wm_overrideredirect overrideredirect
TOPLEVEL_METHODCALL_OPTKEYS['overrideredirect'] = 'overrideredirect'
- def positionfrom(who=None)
- if who == None
- r = tk_call_without_enc('wm', 'positionfrom', path)
+ def Wm.positionfrom(win, who=TkComm::None)
+ if who == TkComm::None
+ r = tk_call_without_enc('wm', 'positionfrom', win.epath)
(r == "")? nil: r
else
- tk_call_without_enc('wm', 'positionfrom', path, who)
- self
+ tk_call_without_enc('wm', 'positionfrom', win.epath, who)
+ win
end
end
+ def positionfrom(who=TkComm::None)
+ Wm.positionfrom(self, who)
+ end
+ alias wm_positionfrom positionfrom
TOPLEVEL_METHODCALL_OPTKEYS['positionfrom'] = 'positionfrom'
- def protocol(name=nil, cmd=nil, &b)
+ def Wm.protocol(win, name=nil, cmd=nil, &b)
if cmd
- tk_call_without_enc('wm', 'protocol', path, name, cmd)
- self
+ tk_call_without_enc('wm', 'protocol', win.epath, name, cmd)
+ win
elsif b
- tk_call_without_enc('wm', 'protocol', path, name, proc(&b))
- self
+ tk_call_without_enc('wm', 'protocol', win.epath, name, proc(&b))
+ win
elsif name
- result = tk_call_without_enc('wm', 'protocol', path, name)
+ result = tk_call_without_enc('wm', 'protocol', win.epath, name)
(result == "")? nil : tk_tcl2ruby(result)
else
- tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path))
+ tk_split_simplelist(tk_call_without_enc('wm', 'protocol', win.epath))
end
end
+ def protocol(name=nil, cmd=nil, &b)
+ Wm.protocol(self, name, cmd, &b)
+ end
+ alias wm_protocol protocol
- def protocols(kv=nil)
+ def Wm.protocols(win, kv=nil)
unless kv
ret = {}
- self.protocol.each{|name|
- ret[name] = self.protocol(name)
+ Wm.protocol(win).each{|name|
+ ret[name] = Wm.protocol(win, name)
}
return ret
end
@@ -279,82 +413,140 @@ module Tk
unless kv.kind_of?(Hash)
fail ArgumentError, 'expect a hash of protocol=>command'
end
- kv.each{|k, v| self.protocol(k, v)}
- self
+ kv.each{|k, v| Wm.protocol(win, k, v)}
+ win
end
+ def protocols(kv=nil)
+ Wm.protocols(self, kv)
+ end
+ alias wm_protocols protocols
TOPLEVEL_METHODCALL_OPTKEYS['protocols'] = 'protocols'
- def resizable(*args)
+ def Wm.resizable(win, *args)
if args.length == 0
- list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
+ list(tk_call_without_enc('wm', 'resizable', win.epath)).map!{|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
+ tk_call_without_enc('wm', 'resizable', win.epath, *args)
+ win
end
end
+ def resizable(*args)
+ Wm.resizable(self, *args)
+ end
+ alias wm_resizable resizable
TOPLEVEL_METHODCALL_OPTKEYS['resizable'] = 'resizable'
- def sizefrom(who=None)
- if who == None
- r = tk_call_without_enc('wm', 'sizefrom', path)
+ def Wm.sizefrom(win, who=TkComm::None)
+ if who == TkComm::None
+ r = tk_call_without_enc('wm', 'sizefrom', win.epath)
(r == "")? nil: r
else
- tk_call_without_enc('wm', 'sizefrom', path, who)
- self
+ tk_call_without_enc('wm', 'sizefrom', win.epath, who)
+ win
end
end
+ def sizefrom(who=TkComm::None)
+ Wm.sizefrom(self, who)
+ end
+ alias wm_sizefrom sizefrom
TOPLEVEL_METHODCALL_OPTKEYS['sizefrom'] = 'sizefrom'
+ def Wm.stackorder(win)
+ list(tk_call('wm', 'stackorder', win.epath))
+ end
def stackorder
- list(tk_call('wm', 'stackorder', path))
+ Wm.stackorder(self)
end
+ alias wm_stackorder stackorder
- def stackorder_isabove(win)
- bool(tk_call('wm', 'stackorder', path, 'isabove', win))
+ def Wm.stackorder_isabove(win, target)
+ bool(tk_call('wm', 'stackorder', win.epath, 'isabove', target))
+ end
+ def Wm.stackorder_is_above(win, target)
+ Wm.stackorder_isabove(win, target)
+ end
+ def stackorder_isabove(target)
+ Wm.stackorder_isabove(self, target)
end
+ alias stackorder_is_above stackorder_isabove
+ alias wm_stackorder_isabove stackorder_isabove
+ alias wm_stackorder_is_above stackorder_isabove
- def stackorder_isbelow(win)
- bool(tk_call('wm', 'stackorder', path, 'isbelow', win))
+ def Wm.stackorder_isbelow(win, target)
+ bool(tk_call('wm', 'stackorder', win.epath, 'isbelow', target))
end
+ def Wm.stackorder_is_below(win, target)
+ Wm.stackorder_isbelow(win, target)
+ end
+ def stackorder_isbelow(target)
+ Wm.stackorder_isbelow(self, target)
+ end
+ alias stackorder_is_below stackorder_isbelow
+ alias wm_stackorder_isbelow stackorder_isbelow
+ alias wm_stackorder_is_below stackorder_isbelow
- def state(st=nil)
+ def Wm.state(win, st=nil)
if st
- tk_call_without_enc('wm', 'state', path, st)
- self
+ tk_call_without_enc('wm', 'state', win.epath, st)
+ win
else
- tk_call_without_enc('wm', 'state', path)
+ tk_call_without_enc('wm', 'state', win.epath)
end
end
+ def state(st=nil)
+ Wm.state(self, st)
+ end
+ alias wm_state state
TOPLEVEL_METHODCALL_OPTKEYS['state'] = 'state'
- def title(str=nil)
+ def Wm.title(win, str=nil)
if str
- tk_call('wm', 'title', path, str)
- self
+ tk_call('wm', 'title', win.epath, str)
+ win
else
- tk_call('wm', 'title', path)
+ tk_call('wm', 'title', win.epath)
end
end
+ def title(str=nil)
+ Wm.title(self, str)
+ end
+ alias wm_title title
TOPLEVEL_METHODCALL_OPTKEYS['title'] = 'title'
- def transient(master=nil)
+ def Wm.transient(win, master=nil)
if master
- tk_call_without_enc('wm', 'transient', path, master)
- self
+ tk_call_without_enc('wm', 'transient', win.epath, master)
+ win
else
- window(tk_call_without_enc('wm', 'transient', path))
+ window(tk_call_without_enc('wm', 'transient', win.epath))
end
end
+ def transient(master=nil)
+ Wm.transient(self, master)
+ end
+ alias wm_transient transient
TOPLEVEL_METHODCALL_OPTKEYS['transient'] = 'transient'
- def withdraw(ex = true)
+ def Wm.withdraw(win, ex = true)
if ex
- tk_call_without_enc('wm', 'withdraw', path)
+ tk_call_without_enc('wm', 'withdraw', win.epath)
else
- self.deiconify
+ Wm.deiconify(win)
end
- self
+ win
end
+ def withdraw(ex = true)
+ Wm.withdraw(self, ex)
+ end
+ alias wm_withdraw withdraw
+ end
+
+ module Wm_for_General
+ Wm.instance_methods.each{|m|
+ if (m = m.to_s) =~ /^wm_(.*)$/
+ eval "def #{m}(*args, &b); Tk::Wm.#{$1}(self, *args, &b); end"
+ end
+ }
end
end
diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb
index 8a37e35ebf..b430bae55d 100644
--- a/ext/tk/lib/tkextlib/ICONS/icons.rb
+++ b/ext/tk/lib/tkextlib/ICONS/icons.rb
@@ -75,14 +75,26 @@ module Tk
##########################################
- def self.new(name, keys=nil)
- unless obj = Tk_IMGTBL["::icon::#{name}"]
- obj = allocate()
- obj.instance_eval{initialize(name, keys)}
+ 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
- obj
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 0a5c332d82..cfbe274c86 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -1,7 +1,7 @@
[ current support status of Tcl/Tk extensions ]
- *******<<< RELEASE_DATE of the libraries : 2005/08/10 >>>*******
+ *** RELEASE_DATE of the libraries => see 'tkextlib/version.rb' ***
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
@@ -55,138 +55,142 @@ script may give you some hints about that.
===< support with some examples (may be beta quality) >=======================
-Tcllib 1.7 http://sf.net/projects/tcllib
- ==> tcllib (partial support; Tklib part only)
+Tcllib 1.8
+Tklib 0.4.1 http://sourceforge.net/projects/tcllib ==> tcllib
-IWidgets 4.0.2 http://sf.net/projects/incrTcl ==> iwidgets
+IWidgets 4.0.2 http://sourceforge.net/projects/incrtcl ==> iwidgets
-BWidgets 1.7 http://sf.net/projects/tcllib ==> bwidget
+BWidgets 1.7 http://sourceforge.net/projects/tcllib ==> bwidget
-TkTable 2.9 http://sf.net/projects/tktable ==> tktable
+TkTable 2.9 http://sourceforge.net/projects/tktable ==> tktable
* see also <http://www.korus.hu/~fery/ruby/tktable.rb>
written by Ferenc Engard (ferenc@engard.hu)
-vu 2.1.0 http://tktable.sourceforge.net ==> vu
+vu 2.3.0 http://sourceforge.net/projects/tktable ==> vu
-TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/index.html ==> tkHTML
+TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/ ==> tkHTML
ICONS 1.0 http://www.satisoft.com/tcltk/icons/ ==> ICONS
-TkImg 1.3 http://sf.net/projects/tkimg ==> tkimg
+TkImg 1.3 http://sourceforge.net/projects/tkimg ==> tkimg
-BLT 2.4z http://sourceforge.net/projects/blt
+BLT 2.4z http://sourceforge.net/projects/blt
* see also tcltk-ext library on RAA
(http://raa.ruby-lang.org/)
==> blt
-TkTreeCtrl CVS/Hd(2005-03-25)
- http://tktreectrl.sourceforge.net/ ==> treectrl
+TkTreeCtrl CVS/Hd(2005-12-02)
+ http://sourceforge.net/projects/tktreectrl ==> treectrl
+
+Tile 0.8.0/8.5.1
+ http://sourceforge.net/projects/tktable ==> tile
-Tile 0.6 http://tktable.sourceforge.net/tile/ ==> tile
===< support (may be alpha or beta quality) >=================================
IncrTcl CVS/Hd(2005-02-14)
- http://sf.net/projects/incrTcl ==> itcl, itk
+ http://sourceforge.net/projects/incrtcl ==> itcl, itk
TclX CVS/Hd(2005-02-07)
- http://sf.net/projects/tclx
+ http://sourceforge.net/projects/tclx
==> tclx (partial support; infox command and
XPG/3 message catalogs only)
+Trofs 0.4.3 http://math.nist.gov/~DPorter/tcltk/trofs/
+
===< possibly available (not tested; alpha quality) >=========================
-winico CVS/Hd(2004-11-02)
- http://tktable.sourceforge.net
- ==> winico (win32 only)
+winico 0.6
+ http://sourceforge.net/projects/tktable
+ ==> winico (win32 only)
TkTrans latest(2004-10-11)
- http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html
- ==> tktrans (win32 only)
+ http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html
+ ==> tktrans (win32 only)
-TkDND 1.0a2 http://sourceforge.net/projects/tkdnd ==> tkDND
+TkDND 1.0a2 http://sourceforge.net/projects/tkdnd ==> tkDND
===< plan to support (alpha quality libraries may be included) >==============
-GraphViz *** http://www.graphviz.org/
+GraphViz *** http://www.graphviz.org/
-Tkgeomap *** http://tkgeomap.sourceforge.net/index.html
+Tkgeomap *** http://tkgeomap.sourceforge.net/index.html
===< not determined to supprt or not >========================================
-Tix *** http://tixlibrary.sourceforge.net/
+Tix *** http://tixlibrary.sourceforge.net/
* see also 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
+vfwtcl *** http://sourceforge.net/projects/avicaptcl
* Win32 only
-multicast *** http://sourceforge.net/projects/avicaptcl
+multicast *** http://sourceforge.net/projects/avicaptcl
* Win32 only
-XBit *** http://www.geocities.com/~chengye/
+XBit *** http://www.geocities.com/~chengye/
* current implementation is for Windows only
-QuickTimeTcl *** http://hem.fyristorg.com/matben/qt/
+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://sourceforge.net/projects/tkcon
-Expect *** http://sf.net/projects/expect
+Expect *** http://sourceforge.net/projects/expect
-TclXML *** http://sf.net/projects/tclxml
+TclXML *** http://sourceforge.net/projects/tclxml
-TclXSLT *** http://sf.net/projects/tclxml
+TclXSLT *** http://sourceforge.net/projects/tclxml
-TclDOM *** http://sf.net/projects/tclxml
+TclDOM *** http://sourceforge.net/projects/tclxml
-TclSOAP *** http://sf.net/projects/tclsoap
+TclSOAP *** http://sourceforge.net/projects/tclsoap
-Snack *** http://www.speech.kth.se/~kare/snack2.2.tar.gz
+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://sourceforge.net/projects/memchan
-XOTcl *** http://www.xotcl.org/
+XOTcl *** http://www.xotcl.org/
===< tool (may not supprt) >==================================================
tbcload/tclcompiler
- *** http://www.tcl.tk/software/tclpro/
+ *** http://www.tcl.tk/software/tclpro/
(End of List)
diff --git a/ext/tk/lib/tkextlib/blt.rb b/ext/tk/lib/tkextlib/blt.rb
index 8ac8605513..115eb927ba 100644
--- a/ext/tk/lib/tkextlib/blt.rb
+++ b/ext/tk/lib/tkextlib/blt.rb
@@ -68,7 +68,7 @@ module Tk
params.concat(hash_kv(args.shift, true)) if args[0].kind_of?(Hash)
- params << '--'
+ params << '--' if args[0] =~ /^\s*-[^-]/
params.concat(args)
tk_call('::blt::bgexec', *params)
@@ -85,7 +85,7 @@ module Tk
params.concat(hash_kv(args.shift, true)) if args[0].kind_of?(Hash)
- params << '--'
+ params << '--' if args[0] =~ /^\s*-[^-]/
params.concat(args)
params << '&'
diff --git a/ext/tk/lib/tkextlib/blt/barchart.rb b/ext/tk/lib/tkextlib/blt/barchart.rb
index 241ce11632..cb481c5889 100644
--- a/ext/tk/lib/tkextlib/blt/barchart.rb
+++ b/ext/tk/lib/tkextlib/blt/barchart.rb
@@ -17,12 +17,13 @@ module Tk::BLT
include GraphCommand
def __boolval_optkeys
- ['bufferelements', 'invertxy']
+ ['bufferelements', 'buffergraph', 'invertxy']
end
private :__boolval_optkeys
def __strval_optkeys
- ['text', 'label', 'title', 'file']
+ ['text', 'label', 'title', 'file',
+ 'background', 'plotbackground']
end
private :__strval_optkeys
diff --git a/ext/tk/lib/tkextlib/blt/bitmap.rb b/ext/tk/lib/tkextlib/blt/bitmap.rb
index 31cf8d4229..23c6d2d064 100644
--- a/ext/tk/lib/tkextlib/blt/bitmap.rb
+++ b/ext/tk/lib/tkextlib/blt/bitmap.rb
@@ -13,7 +13,16 @@ module Tk::BLT
TkCommandNames = ['::blt::bitmap'.freeze].freeze
BITMAP_ID_TBL = TkCore::INTERP.create_table
- BITMAP_ID = ['blt_bitmap_id'.freeze, '00000'.taint].freeze
+
+ (BITMAP_ID = ['blt_bitmap_id'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ BITMAP_ID_TBL.mutex.synchronize{ BITMAP_ID_TBL.clear }
+ }
def self.data(name)
dat = tk_simple_list(tk_call('::blt::bitmap', 'data', name))
@@ -64,9 +73,13 @@ module Tk::BLT
if name
@id = name
else
- @id = BITMAP_ID.join(TkCore::INTERP._ip_id_)
- BITMAP_ID[1].succ!
- BITMAP_ID_TBL[@id] = self
+ BITMAP_ID.mutex.synchronize{
+ @id = BITMAP_ID.join(TkCore::INTERP._ip_id_)
+ BITMAP_ID[1].succ!
+ }
+ BITMAP_ID_TBL.mutex.synchronize{
+ BITMAP_ID_TBL[@id] = self
+ }
end
@path = @id
diff --git a/ext/tk/lib/tkextlib/blt/busy.rb b/ext/tk/lib/tkextlib/blt/busy.rb
index 4726e466f4..2f807fcd9c 100644
--- a/ext/tk/lib/tkextlib/blt/busy.rb
+++ b/ext/tk/lib/tkextlib/blt/busy.rb
@@ -19,7 +19,7 @@ module Tk::BLT
class Shield < TkWindow
def self.shield_path(win)
win = window(win) unless win.kind_of?(TkWindow)
- if win.kind_of?(TkToplevel)
+ if win.kind_of?(Tk::Toplevel)
win.path + '._Busy'
else
win.path + '_Busy'
diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb
index 0b58195c96..b2005b2f2b 100644
--- a/ext/tk/lib/tkextlib/blt/component.rb
+++ b/ext/tk/lib/tkextlib/blt/component.rb
@@ -30,7 +30,8 @@ module Tk::BLT
def __item_strval_optkeys(id)
['text', 'label', 'limits', 'title',
- 'show', 'file', 'maskdata', 'maskfile']
+ 'show', 'file', 'maskdata', 'maskfile',
+ 'color', 'titlecolor', 'fill', 'outline', 'offdash']
end
private :__item_strval_optkeys
@@ -40,7 +41,7 @@ module Tk::BLT
private :__item_listval_optkeys
def __item_numlistval_optkeys(id)
- ['dashes']
+ ['dashes', 'majorticks', 'minorticks']
end
private :__item_numlistval_optkeys
@@ -84,6 +85,9 @@ module Tk::BLT
def axis_cget(id, option)
ret = itemcget(['axis', tagid(id)], option)
end
+ def axis_cget_strict(id, option)
+ ret = itemcget_strict(['axis', tagid(id)], option)
+ end
def axis_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -117,6 +121,9 @@ module Tk::BLT
def crosshairs_cget(option)
itemcget('crosshairs', option)
end
+ def crosshairs_cget_strict(option)
+ itemcget_strict('crosshairs', option)
+ end
def crosshairs_configure(slot, value=None)
itemconfigure('crosshairs', slot, value)
end
@@ -130,6 +137,9 @@ module Tk::BLT
def element_cget(id, option)
itemcget(['element', tagid(id)], option)
end
+ def element_cget_strict(id, option)
+ itemcget_strict(['element', tagid(id)], option)
+ end
def element_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -151,6 +161,9 @@ module Tk::BLT
def bar_cget(id, option)
itemcget(['bar', tagid(id)], option)
end
+ def bar_cget_strict(id, option)
+ itemcget_strict(['bar', tagid(id)], option)
+ end
def bar_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -172,6 +185,9 @@ module Tk::BLT
def line_cget(id, option)
itemcget(['line', tagid(id)], option)
end
+ def line_cget_strict(id, option)
+ itemcget_strict(['line', tagid(id)], option)
+ end
def line_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -193,6 +209,9 @@ module Tk::BLT
def gridline_cget(option)
itemcget('grid', option)
end
+ def gridline_cget_strict(option)
+ itemcget_strict('grid', option)
+ end
def gridline_configure(slot, value=None)
itemconfigure('grid', slot, value)
end
@@ -206,6 +225,9 @@ module Tk::BLT
def legend_cget(option)
itemcget('legend', option)
end
+ def legend_cget_strict(option)
+ itemcget_strict('legend', option)
+ end
def legend_configure(slot, value=None)
itemconfigure('legend', slot, value)
end
@@ -219,6 +241,9 @@ module Tk::BLT
def pen_cget(id, option)
itemcget(['pen', tagid(id)], option)
end
+ def pen_cget_strict(id, option)
+ itemcget_strict(['pen', tagid(id)], option)
+ end
def pen_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -240,6 +265,9 @@ module Tk::BLT
def postscript_cget(option)
itemcget('postscript', option)
end
+ def postscript_cget_strict(option)
+ itemcget_strict('postscript', option)
+ end
def postscript_configure(slot, value=None)
itemconfigure('postscript', slot, value)
end
@@ -253,6 +281,9 @@ module Tk::BLT
def marker_cget(id, option)
itemcget(['marker', tagid(id)], option)
end
+ def marker_cget_strict(id, option)
+ itemcget_strict(['marker', tagid(id)], option)
+ end
def marker_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -272,11 +303,12 @@ module Tk::BLT
end
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo
- def itemcget(tagOrId, option)
+ def itemcget_strict(tagOrId, option)
ret = __itemcget(tagid(tagOrId), option)
if option == 'bindtags' || option == :bindtags
ret.collect{|tag| TkBindTag.id2obj(tag)}
@@ -284,6 +316,27 @@ module Tk::BLT
ret
end
end
+ def itemcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ itemcget_strict(tagOrId, option)
+ else
+ begin
+ itemcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_itemconfiginfo(tagOrId).has_key?(option.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def itemconfiginfo(tagOrId, slot = nil)
ret = __itemconfiginfo(tagid(tagOrId), slot)
@@ -320,19 +373,30 @@ module Tk::BLT
ret
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
#################
class Axis < TkObject
- OBJ_ID = ['blt_chart_axis'.freeze, '00000'.taint].freeze
- OBJ_TBL={}
+ (OBJ_ID = ['blt_chart_axis'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ AxisID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ AxisID_TBL.mutex.synchronize{ AxisID_TBL.clear }
+ }
def self.id2obj(chart, id)
cpath = chart.path
- return id unless OBJ_TBL[cpath]
- OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
+ AxisID_TBL.mutex.synchronize{
+ return id unless AxisID_TBL[cpath]
+ AxisID_TBL[cpath][id]? AxisID_TBL[cpath][id]: id
+ }
end
def self.new(chart, axis=nil, keys={})
@@ -340,12 +404,48 @@ module Tk::BLT
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)
+ if keys
+ keys = _symbolkey2str(keys)
+ not_create = keys.delete('without_creating')
+ else
+ not_create = false
+ end
+
+ obj = nil
+ AxisID_TBL.mutex.synchronize{
+ chart_path = chart.path
+ AxisID_TBL[chart_path] ||= {}
+ if axis && AxisID_TBL[chart_path][axis]
+ obj = AxisID_TBL[chart_path][axis]
+ else
+ (obj = self.allocate).instance_eval{
+ if axis
+ @axis = @id = axis.to_s
+ else
+ OBJ_ID.mutex.synchronize{
+ @axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
+ OBJ_ID[1].succ!
+ }
+ end
+ @path = @id
+ @parent = @chart = chart
+ @cpath = @chart.path
+ Axis::AxisID_TBL[@cpath][@axis] = self
+ unless not_create
+ tk_call(@chart, 'axis', 'create', @axis, keys)
+ return obj
+ end
+ }
+ end
+ }
+
+ obj.configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, axis=nil, keys={})
+ # dummy:: not called by 'new' method
+
if axis.kind_of?(Hash)
keys = axis
axis = nil
@@ -353,13 +453,15 @@ module Tk::BLT
if axis
@axis = @id = axis.to_s
else
- @axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
- OBJ_ID[1].succ!
+ OBJ_ID.mutex.synchronize{
+ @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
+ # Axis::AxisID_TBL[@cpath][@axis] = self
keys = _symbolkey2str(keys)
unless keys.delete('without_creating')
# @chart.axis_create(@axis, keys)
@@ -378,6 +480,9 @@ module Tk::BLT
def cget(option)
@chart.axis_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.axis_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.axis_configure(@id, key, value)
self
@@ -437,17 +542,34 @@ module Tk::BLT
#################
class Crosshairs < TkObject
- OBJ_TBL={}
+ CrosshairsID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ CrosshairsID_TBL.mutex.synchronize{ CrosshairsID_TBL.clear }
+ }
def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
+ obj = nil
+ CrosshairsID_TBL.mutex.synchronize{
+ unless (obj = CrosshairsID_TBL[chart.path])
+ (obj = self.allocate).instance_eval{
+ @parent = @chart = chart
+ @cpath = @chart.path
+ @path = @id = 'crosshairs'
+ Crosshairs::CrosshairsID_TBL[@cpath] = self
+ }
+ end
+ }
+ chart.crosshair_configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, keys={})
+ # dummy:: not called by 'new' method
+
@parent = @chart = chart
@cpath = @chart.path
- Crosshairs::OBJ_TBL[@cpath] = self
+ # Crosshairs::CrosshairsID_TBL[@cpath] = self
@chart.crosshair_configure(keys) unless keys.empty?
@path = @id = 'crosshairs'
end
@@ -463,6 +585,9 @@ module Tk::BLT
def cget(option)
@chart.crosshair_cget(option)
end
+ def cget_strict(option)
+ @chart.crosshair_cget_strict(option)
+ end
def configure(key, value=None)
@chart.crosshair_configure(key, value)
self
@@ -499,12 +624,18 @@ module Tk::BLT
ElementTypeName = 'element'
ElementTypeToClass = { ElementTypeName=>self }
+
ElementID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ ElementID_TBL.clear }
+ TkCore::INTERP.init_ip_env{
+ ElementID_TBL.mutex.synchronize{ ElementID_TBL.clear }
+ }
- OBJ_ID = ['blt_chart_element'.freeze, '00000'.taint].freeze
- OBJ_TBL={}
+ (OBJ_ID = ['blt_chart_element'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
def Element.type2class(type)
ElementTypeToClass[type]
@@ -512,8 +643,10 @@ module Tk::BLT
def Element.id2obj(chart, id)
cpath = chart.path
- return id unless OBJ_TBL[cpath]
- OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
+ ElementID_TBL.mutex.synchronize{
+ return id unless ElementID_TBL[cpath]
+ ElementID_TBL[cpath][id]? ElementID_TBL[cpath][id]: id
+ }
end
def self.new(chart, element=nil, keys={})
@@ -521,14 +654,49 @@ module Tk::BLT
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]
+ if keys
+ keys = _symbolkey2str(keys)
+ not_create = keys.delete('without_creating')
+ else
+ not_create = false
end
- super(chart, element, keys)
+
+ obj = nil
+ ElementID_TBL.mutex.synchronize{
+ chart_path = chart.path
+ ElementID_TBL[chart_path] ||= {}
+ if element && ElementID_TBL[chart_path][element]
+ obj = ElementID_TBL[chart_path][element]
+ else
+ (obj = self.allocate).instance_eval{
+ if element
+ @element = @id = element.to_s
+ else
+ OBJ_ID.mutex.synchronize{
+ @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::ElementID_TBL[@cpath][@element] = self
+ unless not_create
+ tk_call(@chart, @typename, 'create', @element, keys)
+ return obj
+ end
+ }
+ end
+ }
+
+ obj.configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, element=nil, keys={})
+ # dummy:: not called by 'new' method
+
if element.kind_of?(Hash)
keys = element
element = nil
@@ -536,14 +704,16 @@ module Tk::BLT
if element
@element = @id = element.to_s
else
- @element = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
- OBJ_ID[1].succ!
+ OBJ_ID.mutex.synchronize{
+ @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
+ # Element::ElementID_TBL[@cpath][@element] = self
keys = _symbolkey2str(keys)
unless keys.delete('without_creating')
# @chart.element_create(@element, keys)
@@ -563,6 +733,9 @@ module Tk::BLT
# @chart.element_cget(@id, option)
@chart.__send__(@typename + '_cget', @id, option)
end
+ def cget_strict(option)
+ @chart.__send__(@typename + '_cget_strict', @id, option)
+ end
def configure(key, value=None)
# @chart.element_configure(@id, key, value)
@chart.__send__(@typename + '_configure', @id, key, value)
@@ -621,17 +794,33 @@ module Tk::BLT
#################
class GridLine < TkObject
- OBJ_TBL={}
+ GridLineID_TBL = TkCore::INTERP.create_table
+ TkCore::INTERP.init_ip_env{
+ GridLineID_TBL.mutex.synchronize{ GridLineID_TBL.clear }
+ }
def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
+ obj = nil
+ GridLineID_TBL.mutex.synchronize{
+ unless (obj = GridLineID_TBL[chart.path])
+ (obj = self.allocate).instance_eval{
+ @parent = @chart = chart
+ @cpath = @chart.path
+ @path = @id = 'grid'
+ GridLine::GridLineID_TBL[@cpath] = self
+ }
+ end
+ }
+ chart.gridline_configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, keys={})
+ # dummy:: not called by 'new' method
+
@parent = @chart = chart
@cpath = @chart.path
- GridLine::OBJ_TBL[@cpath] = self
+ # GridLine::GridLineID_TBL[@cpath] = self
@chart.gridline_configure(keys) unless keys.empty?
@path = @id = 'grid'
end
@@ -647,6 +836,9 @@ module Tk::BLT
def cget(option)
@chart.gridline_cget(option)
end
+ def cget_strict(option)
+ @chart.gridline_cget_strict(option)
+ end
def configure(key, value=None)
@chart.gridline_configure(key, value)
self
@@ -675,18 +867,35 @@ module Tk::BLT
#################
class Legend < TkObject
- OBJ_TBL={}
+ LegendID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ LegendID_TBL.mutex.synchronize{ LegendID_TBL.clear }
+ }
def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
+ obj = nil
+ LegenedID_TBL.mutex.synchronize{
+ unless (obj = LegenedID_TBL[chart.path])
+ (obj = self.allocate).instance_eval{
+ @parent = @chart = chart
+ @cpath = @chart.path
+ @path = @id = 'crosshairs'
+ Legend::LegenedID_TBL[@cpath] = self
+ }
+ end
+ }
+ chart.legend_configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, keys={})
+ # dummy:: not called by 'new' method
+
@parent = @chart = chart
@cpath = @chart.path
- Crosshairs::OBJ_TBL[@cpath] = self
- @chart.crosshair_configure(keys) unless keys.empty?
+ # Legend::LegendID_TBL[@cpath] = self
+ @chart.legend_configure(keys) unless keys.empty?
@path = @id = 'legend'
end
@@ -701,6 +910,9 @@ module Tk::BLT
def cget(option)
@chart.legend_cget(option)
end
+ def cget_strict(option)
+ @chart.legend_cget_strict(option)
+ end
def configure(key, value=None)
@chart.legend_configure(key, value)
self
@@ -728,13 +940,24 @@ module Tk::BLT
#################
class Pen < TkObject
- OBJ_ID = ['blt_chart_pen'.freeze, '00000'.taint].freeze
- OBJ_TBL={}
+ (OBJ_ID = ['blt_chart_pen'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ PenID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ PenID_TBL.mutex.synchronize{ PenID_TBL.clear }
+ }
def self.id2obj(chart, id)
cpath = chart.path
- return id unless OBJ_TBL[cpath]
- OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
+ PenID_TBL.mutex.synchronize{
+ return id unless PenID_TBL[cpath]
+ PenID_TBL[cpath][id]? PenID_TBL[cpath][id]: id
+ }
end
def self.new(chart, pen=nil, keys={})
@@ -742,9 +965,43 @@ module Tk::BLT
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)
+ if keys
+ keys = _symbolkey2str(keys)
+ not_create = keys.delete('without_creating')
+ else
+ not_create = false
+ end
+
+ obj = nil
+ PenID_TBL.mutex.synchronize{
+ chart_path = chart.path
+ PenID_TBL[chart_path] ||= {}
+ if pen && PenID_TBL[chart_path][pen]
+ obj = PenID_TBL[chart_path][pen]
+ else
+ (obj = self.allocate).instance_eval{
+ if pen
+ @pen = @id = pen.to_s
+ else
+ OBJ_ID.mutex.synchronize{
+ @pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
+ OBJ_ID[1].succ!
+ }
+ end
+ @path = @id
+ @parent = @chart = chart
+ @cpath = @chart.path
+ Pen::PenID_TBL[@cpath][@pen] = self
+ unless not_create
+ tk_call(@chart, 'pen', 'create', @pen, keys)
+ return obj
+ end
+ }
+ end
+ }
+
+ obj.configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, pen=nil, keys={})
@@ -755,13 +1012,15 @@ module Tk::BLT
if pen
@pen = @id = pen.to_s
else
- @pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
- OBJ_ID[1].succ!
+ OBJ_ID.mutex.synchronize{
+ @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
+ Pen::PenID_TBL[@cpath][@pen] = self
keys = _symbolkey2str(keys)
unless keys.delete('without_creating')
# @chart.pen_create(@pen, keys)
@@ -780,6 +1039,9 @@ module Tk::BLT
def cget(option)
@chart.pen_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.pen_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.pen_configure(@id, key, value)
self
@@ -804,17 +1066,34 @@ module Tk::BLT
#################
class Postscript < TkObject
- OBJ_TBL={}
+ PostscriptID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ PostscriptID_TBL.mutex.synchronize{ PostscriptID_TBL.clear }
+ }
def self.new(chart, keys={})
- return OBJ_TBL[chart.path] if OBJ_TBL[chart.path]
- super(chart, keys)
+ obj = nil
+ PostscriptID_TBL.mutex.synchronize{
+ unless (obj = PostscriptID_TBL[chart.path])
+ (obj = self.allocate).instance_eval{
+ @parent = @chart = chart
+ @cpath = @chart.path
+ @path = @id = 'postscript'
+ Postscript::PostscriptID_TBL[@cpath] = self
+ }
+ end
+ }
+ chart.postscript_configure(keys) if obj && ! keys.empty?
+ obj
end
def initialize(chart, keys={})
+ # dummy:: not called by 'new' method
+
@parent = @chart = chart
@cpath = @chart.path
- Postscript::OBJ_TBL[@cpath] = self
+ # Postscript::PostscriptID_TBL[@cpath] = self
@chart.postscript_configure(keys) unless keys.empty?
@path = @id = 'postscript'
end
@@ -830,6 +1109,9 @@ module Tk::BLT
def cget(option)
@chart.postscript_cget(option)
end
+ def cget_strict(option)
+ @chart.postscript_cget_strict(option)
+ end
def configure(key, value=None)
@chart.postscript_configure(key, value)
self
@@ -869,7 +1151,9 @@ module Tk::BLT
MarkerTypeToClass = {}
MarkerID_TBL = TkCore::INTERP.create_table
- TkCore::INTERP.init_ip_env{ MarkerID_TBL.clear }
+ TkCore::INTERP.init_ip_env{
+ MarkerID_TBL.mutex.synchronize{ MarkerID_TBL.clear }
+ }
def Marker.type2class(type)
MarkerTypeToClass[type]
@@ -877,8 +1161,13 @@ module Tk::BLT
def Marker.id2obj(chart, id)
cpath = chart.path
- return id unless MarkerID_TBL[cpath]
- MarkerID_TBL[cpath][id]? MarkerID_TBL[cpath][id]: id
+ MarkerID_TBL.mutex.synchronize{
+ if MarkerID_TBL[cpath]
+ MarkerID_TBL[cpath][id]? MarkerID_TBL[cpath][id]: id
+ else
+ id
+ end
+ }
end
def self._parse_create_args(keys)
@@ -901,6 +1190,13 @@ module Tk::BLT
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __item_optkey_aliases(nil).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -942,10 +1238,10 @@ module Tk::BLT
@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
+ Tk::BLT::PlotComponent::Marker::MarkerID_TBL.mutex.synchronize{
+ Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath] ||= {}
+ Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath][@id] = self
+ }
}
obj
end
@@ -955,10 +1251,10 @@ module Tk::BLT
@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
+ Tk::BLT::PlotComponent::Marker::MarkerID_TBL.mutex.synchronize{
+ Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath] ||= {}
+ 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'
@@ -976,6 +1272,9 @@ module Tk::BLT
def cget(option)
@chart.marker_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.marker_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.marker_configure(@id, key, value)
self
@@ -1036,14 +1335,14 @@ module Tk::BLT
#################
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)
+ Axis::AxisID_TBL.delete(@path)
+ Crosshairs::CrosshairsID_TBL.delete(@path)
+ Element::ElementID_TBL.delete(@path)
+ GridLine::GridLineID_TBL.delete(@path)
+ Legend::LegendID_TBL.delete(@path)
+ Pen::PenID_TBL.delete(@path)
+ Postscript::PostscriptID_TBL.delete(@path)
+ Marker::MarkerID_TBL.delete(@path)
super()
end
@@ -1558,6 +1857,9 @@ module Tk::BLT
def xaxis_cget(option)
itemcget('xaxis', option)
end
+ def xaxis_cget_strict(option)
+ itemcget_strict('xaxis', option)
+ end
def xaxis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1627,6 +1929,9 @@ module Tk::BLT
def x2axis_cget(option)
itemcget('x2axis', option)
end
+ def x2axis_cget_strict(option)
+ itemcget_strict('x2axis', option)
+ end
def x2axis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1696,6 +2001,9 @@ module Tk::BLT
def yaxis_cget(option)
itemcget('yaxis', option)
end
+ def yaxis_cget_strict(option)
+ itemcget_strict('yaxis', option)
+ end
def yaxis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1765,6 +2073,9 @@ module Tk::BLT
def y2axis_cget(option)
itemcget('y2axis', option)
end
+ def y2axis_cget_strict(option)
+ itemcget_strict('y2axis', option)
+ end
def y2axis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
diff --git a/ext/tk/lib/tkextlib/blt/container.rb b/ext/tk/lib/tkextlib/blt/container.rb
index ef711bbcc6..cdbec21f25 100644
--- a/ext/tk/lib/tkextlib/blt/container.rb
+++ b/ext/tk/lib/tkextlib/blt/container.rb
@@ -11,13 +11,18 @@ module Tk::BLT
TkCommandNames = ['::blt::container'.freeze].freeze
WidgetClassName = 'Container'.freeze
WidgetClassNames[WidgetClassName] = self
- end
- def find_command(pat)
- list(tk_send_without_enc(tk_call(self.path, 'find', '-command', pat)))
- end
+ def __strval_optkeys
+ super() << 'name'
+ end
+ private :__strval_optkeys
+
+ def find_command(pat)
+ Hash[*simplelist(tk_send_without_enc('find', '-command', pat))]
+ end
- def find_name(pat)
- list(tk_send_without_enc(tk_call(self.path, 'find', '-name', pat)))
+ def find_name(pat)
+ Hash[*simplelist(tk_send_without_enc('find', '-name', pat))]
+ end
end
end
diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb
index 3d7d652dde..201548504a 100644
--- a/ext/tk/lib/tkextlib/blt/dragdrop.rb
+++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb
@@ -39,6 +39,21 @@ module Tk::BLT
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
@@ -66,6 +81,24 @@ module Tk::BLT
nil
]
+=begin
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
+ KEY_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
+ end
+ inf
+ }
+
+ PROC_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ end
+ inf
+ }
+=end
+
_setup_subst_table(KEY_TBL, PROC_TBL)
def self.ret_val(val)
@@ -92,6 +125,24 @@ module Tk::BLT
nil
]
+=begin
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
+ KEY_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
+ end
+ inf
+ }
+
+ PROC_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ end
+ inf
+ }
+=end
+
_setup_subst_table(KEY_TBL, PROC_TBL)
def self.ret_val(val)
@@ -130,6 +181,24 @@ module Tk::BLT
nil
]
+=begin
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
+ KEY_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
+ end
+ inf
+ }
+
+ PROC_TBL.map!{|inf|
+ if inf.kind_of?(Array)
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
+ end
+ inf
+ }
+=end
+
_setup_subst_table(KEY_TBL, PROC_TBL)
end
diff --git a/ext/tk/lib/tkextlib/blt/eps.rb b/ext/tk/lib/tkextlib/blt/eps.rb
index 43b2f8adc0..0dba87a7cc 100644
--- a/ext/tk/lib/tkextlib/blt/eps.rb
+++ b/ext/tk/lib/tkextlib/blt/eps.rb
@@ -13,3 +13,20 @@ module Tk::BLT
CItemTypeToClass[CItemTypeName] = self
end
end
+
+class Tk::Canvas
+ 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
index e9fbdd587a..9ae99bff5c 100644
--- a/ext/tk/lib/tkextlib/blt/graph.rb
+++ b/ext/tk/lib/tkextlib/blt/graph.rb
@@ -22,7 +22,7 @@ module Tk::BLT
private :__boolval_optkeys
def __strval_optkeys
- ['text', 'label', 'title', 'file']
+ ['text', 'label', 'title', 'file', 'plotbackground']
end
private :__strval_optkeys
diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb
index 3bc35b7e10..0d9cb30185 100644
--- a/ext/tk/lib/tkextlib/blt/htext.rb
+++ b/ext/tk/lib/tkextlib/blt/htext.rb
@@ -22,10 +22,16 @@ module Tk::BLT
WidgetClassNames[WidgetClassName] = self
alias window_cget itemcget
+ alias window_cget_strict itemcget_strict
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
diff --git a/ext/tk/lib/tkextlib/blt/stripchart.rb b/ext/tk/lib/tkextlib/blt/stripchart.rb
index 64c5c1abf8..fe5afbb095 100644
--- a/ext/tk/lib/tkextlib/blt/stripchart.rb
+++ b/ext/tk/lib/tkextlib/blt/stripchart.rb
@@ -22,7 +22,8 @@ module Tk::BLT
private :__boolval_optkeys
def __strval_optkeys
- ['text', 'label', 'title', 'file']
+ ['text', 'label', 'title', 'file',
+ 'background', 'plotbackground']
end
private :__strval_optkeys
diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb
index dc9cd0627e..dfa10269ed 100644
--- a/ext/tk/lib/tkextlib/blt/table.rb
+++ b/ext/tk/lib/tkextlib/blt/table.rb
@@ -17,97 +17,103 @@ module Tk::BLT
module TableContainer
def blt_table_add(*args)
- Tk::BLT::Table.add(@path, *args)
+ Tk::BLT::Table.add(self, *args)
self
end
def blt_table_arrange()
- Tk::BLT::Table.arrange(@path)
+ Tk::BLT::Table.arrange(self)
self
end
def blt_table_cget(*args)
- Tk::BLT::Table.cget(@path, *args)
+ Tk::BLT::Table.cget(self, *args)
+ end
+ def blt_table_cget_strict(*args)
+ Tk::BLT::Table.cget_strict(self, *args)
end
def blt_table_configure(*args)
- Tk::BLT::Table.configure(@path, *args)
+ Tk::BLT::Table.configure(self, *args)
self
end
def blt_table_configinfo(*args)
- Tk::BLT::Table.configinfo(@path, *args)
+ Tk::BLT::Table.configinfo(self, *args)
end
def blt_table_current_configinfo(*args)
- Tk::BLT::Table.current_configinfo(@path, *args)
+ Tk::BLT::Table.current_configinfo(self, *args)
end
def blt_table_locate(x, y)
- Tk::BLT::Table.locate(@path, x, y)
+ Tk::BLT::Table.locate(self, x, y)
end
def blt_table_delete(*args)
- Tk::BLT::Table.delete(@path, *args)
+ Tk::BLT::Table.delete(self, *args)
self
end
def blt_table_extents(item)
- Tk::BLT::Table.extents(@path, item)
+ Tk::BLT::Table.extents(self, item)
end
def blt_table_insert(*args)
- Tk::BLT::Table.insert(@path, *args)
+ Tk::BLT::Table.insert(self, *args)
self
end
def blt_table_insert_before(*args)
- Tk::BLT::Table.insert_before(@path, *args)
+ Tk::BLT::Table.insert_before(self, *args)
self
end
def blt_table_insert_after(*args)
- Tk::BLT::Table.insert_after(@path, *args)
+ Tk::BLT::Table.insert_after(self, *args)
self
end
def blt_table_join(first, last)
- Tk::BLT::Table.join(@path, first, last)
+ Tk::BLT::Table.join(self, first, last)
self
end
def blt_table_save()
- Tk::BLT::Table.save(@path)
+ Tk::BLT::Table.save(self)
end
def blt_table_search(*args)
- Tk::BLT::Table.search(@path, *args)
+ Tk::BLT::Table.search(self, *args)
end
def blt_table_split(*args)
- Tk::BLT::Table.split(@path, *args)
+ Tk::BLT::Table.split(self, *args)
self
end
def blt_table_itemcget(*args)
- Tk::BLT::Table.itemcget(@path, *args)
+ Tk::BLT::Table.itemcget(self, *args)
+ end
+ def blt_table_itemcget_strict(*args)
+ Tk::BLT::Table.itemcget_strict(self, *args)
end
def blt_table_itemconfigure(*args)
- Tk::BLT::Table.itemconfigure(@path, *args)
+ Tk::BLT::Table.itemconfigure(self, *args)
self
end
def blt_table_itemconfiginfo(*args)
- Tk::BLT::Table.itemconfiginfo(@path, *args)
+ Tk::BLT::Table.itemconfiginfo(self, *args)
end
def blt_table_current_itemconfiginfo(*args)
- Tk::BLT::Table.current_itemconfiginfo(@path, *args)
+ Tk::BLT::Table.current_itemconfiginfo(self, *args)
end
def blt_table_iteminfo(item)
- Tk::BLT::Table.iteminfo(@path, item)
+ Tk::BLT::Table.iteminfo(self, item)
end
end
end
@@ -117,28 +123,37 @@ end
############################################
class << Tk::BLT::Table
def __item_cget_cmd(id) # id := [ container, item ]
- ['::blt::table', 'cget', id[0].path, id[1]]
+ win = (id[0].kind_of?(TkWindow))? id[0].path: id[0].to_s
+ ['::blt::table', 'cget', win, id[1]]
end
private :__item_cget_cmd
def __item_config_cmd(id) # id := [ container, item, ... ]
container, *items = id
- ['::blt::table', 'configure', container.path, *items]
+ win = (container.kind_of?(TkWindow))? container.path: container.to_s
+ ['::blt::table', 'configure', win, *items]
end
private :__item_config_cmd
def __item_pathname(id)
- id[0].path + ';'
+ win = (id[0].kind_of?(TkWindow))? id[0].path: id[0].to_s
+ win + ';'
end
private :__item_pathname
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfigure itemconfigure
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
- private :__itemcget, :__itemconfigure
- private :__itemconfiginfo, :__current_itemconfiginfo
+ private :__itemcget, :__itemcget_strict
+ private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo
+
+ def __boolval_optkeys
+ super() << 'propagate'
+ end
+ private :__boolval_optkeys
def tagid(tag)
if tag.kind_of?(Array)
@@ -168,6 +183,9 @@ class << Tk::BLT::Table
def cget(container, option)
__itemcget([container], option)
end
+ def cget_strict(container, option)
+ __itemcget_strict([container], option)
+ end
def configure(container, *args)
__itemconfigure([container], *args)
@@ -184,11 +202,15 @@ class << Tk::BLT::Table
def itemcget(container, item, option)
__itemcget([container, tagid(item)], option)
end
+ def itemcget_strict(container, item, option)
+ __itemcget_strict([container, tagid(item)], option)
+ end
def itemconfigure(container, *args)
if args[-1].kind_of?(Hash)
# container, item, item, ... , hash_optkeys
keys = args.pop
+ fail ArgumentError, 'no item is given' if args.empty?
id = [container]
args.each{|item| id << tagid(item)}
__itemconfigure(id, keys)
@@ -196,10 +218,12 @@ class << Tk::BLT::Table
# container, item, item, ... , option, value
val = args.pop
opt = args.pop
+ fail ArgumentError, 'no item is given' if args.empty?
id = [container]
args.each{|item| id << tagid(item)}
__itemconfigure(id, opt, val)
end
+ container
end
def itemconfiginfo(container, *args)
@@ -217,11 +241,35 @@ class << Tk::BLT::Table
slot = nil
end
+ fail ArgumentError, 'no item is given' if args.empty?
+
id = [container]
args.each{|item| id << tagid(item)}
__itemconfiginfo(id, slot)
end
+ def current_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
+
+ fail ArgumentError, 'no item is given' if args.empty?
+
+ id = [container]
+ args.each{|item| id << tagid(item)}
+ __current_itemconfiginfo(id, slot)
+ end
+
def info(container)
ret = {}
inf = list(tk_call('::blt::table', 'info', container))
@@ -233,12 +281,22 @@ class << Tk::BLT::Table
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]
+ inf = list(tk_call('::blt::table', 'info', container, tagid(item)).chomp)
+
+ ret = []
+ until inf.empty? || (inf[0].kind_of?(String) && inf[0] =~ /^-/)
+ ret << inf.shift
end
+
+ if inf.length > 1
+ keys = {}
+ while inf.length > 1
+ opt = inf.slice!(0..1)
+ keys[opt[0][1..-1]] = opt[1]
+ end
+ ret << keys
+ end
+
ret
end
@@ -248,7 +306,7 @@ class << Tk::BLT::Table
tk_call('::blt::table', container)
begin
class << container
- include Tk::BLT::TABLE::TableContainer
+ include Tk::BLT::Table::TableContainer
end
rescue
warn('fail to include TableContainer methods (frozen object?)')
@@ -271,10 +329,12 @@ class << Tk::BLT::Table
}
tk_call('::blt::table', container, *args)
end
+ container
end
def arrange(container)
tk_call('::blt::table', 'arrange', container)
+ container
end
def delete(container, *args)
diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb
index 693cce5073..ca81ad8f95 100644
--- a/ext/tk/lib/tkextlib/blt/tabset.rb
+++ b/ext/tk/lib/tkextlib/blt/tabset.rb
@@ -12,14 +12,26 @@ module Tk::BLT
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 }
+ (TabsetTab_ID = ['blt_tabset_tab'.freeze, '00000'.taint]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ TabID_TBL.mutex.synchronize{ 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
+ TabID_TBL.mutex.synchronize{
+ if TabID_TBL[tpath]
+ TabID_TBL[tpath][id]? TabID_TBL[tpath]: id
+ else
+ id
+ end
+ }
end
def self.new(parent, pos=nil, name=nil, keys={})
@@ -32,12 +44,20 @@ module Tk::BLT
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
+ obj = nil
+ TabID_TBL.mutex.synchronize{
+ if name && TabID_TBL[parent.path] && TabID_TBL[parent.path][name]
+ obj = TabID_TBL[parent.path][name]
+ obj.configure if keys && ! keys.empty?
+ else
+ (obj = self.allocate).instance_eval{
+ initialize(parent, pos, name, keys)
+ TabID_TBL[@tpath] = {} unless TabID_TBL[@tpath]
+ TabID_TBL[@tpath][@id] = self
+ }
+ end
+ }
+ obj
end
def initialize(parent, pos, name, keys)
@@ -45,9 +65,6 @@ module Tk::BLT
@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)
@@ -58,18 +75,18 @@ module Tk::BLT
end
end
tk_call(@tpath, 'tab', 'configure', @id, keys)
- return
+ else
+ pos = 'end' unless pos
+ tk_call(@tpath, 'insert', pos, @id, keys)
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!
+ TabsetTab_ID.mutex.synchronize{
+ @path = @id = TabsetTab_ID.join(TkCore::INTERP._ip_id_)
+ TabsetTab_ID[1].succ!
+ }
+ pos = 'end' unless pos
+ tk_call(@tpath, 'insert', pos, @id, keys)
end
-
- pos = 'end' unless pos
- tk_call(@tpath, 'insert', pos, @id, keys)
end
#def bind(context, cmd=Proc.new, *args)
@@ -111,6 +128,9 @@ module Tk::BLT
def cget(*args)
@t.tab_cget(@id, *args)
end
+ def cget_strict(*args)