summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-01 09:38:48 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-01 09:38:48 +0000
commitffcedd79505ea2e99f859c7cea2fb2221c948d4c (patch)
tree02232516faf0e1959ecb5d5b7aca25a52f9f87ca /ext
parent73cf1d02bac2dbdd5d7f673a33d81444a00c865e (diff)
* ext/tk/lib/tcltklib : bug fix
* ext/tk/lib/tk : bug fix and add Tcl/Tk extension support libraries git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/tcltklib/MANIFEST1
-rw-r--r--ext/tcltklib/README.ActiveTcl42
-rw-r--r--ext/tcltklib/extconf.rb10
-rw-r--r--ext/tcltklib/tcltklib.c12
-rw-r--r--ext/tk/ChangeLog.tkextlib3
-rw-r--r--ext/tk/MANIFEST170
-rw-r--r--ext/tk/README.1st2
-rw-r--r--ext/tk/lib/README11
-rw-r--r--ext/tk/lib/tk.rb1278
-rw-r--r--ext/tk/lib/tk/autoload.rb7
-rw-r--r--ext/tk/lib/tk/canvas.rb56
-rw-r--r--ext/tk/lib/tk/canvastag.rb8
-rw-r--r--ext/tk/lib/tk/event.rb35
-rw-r--r--ext/tk/lib/tk/font.rb176
-rw-r--r--ext/tk/lib/tk/itemconfig.rb781
-rw-r--r--ext/tk/lib/tk/itemfont.rb358
-rw-r--r--ext/tk/lib/tk/listbox.rb26
-rw-r--r--ext/tk/lib/tk/menu.rb40
-rw-r--r--ext/tk/lib/tk/optionobj.rb212
-rw-r--r--ext/tk/lib/tk/package.rb88
-rw-r--r--ext/tk/lib/tk/scrollable.rb21
-rw-r--r--ext/tk/lib/tk/scrollbar.rb7
-rw-r--r--ext/tk/lib/tk/scrollbox.rb5
-rw-r--r--ext/tk/lib/tk/text.rb82
-rw-r--r--ext/tk/lib/tk/textmark.rb8
-rw-r--r--ext/tk/lib/tk/texttag.rb13
-rw-r--r--ext/tk/lib/tk/validation.rb171
-rw-r--r--ext/tk/lib/tk/variable.rb96
-rw-r--r--ext/tk/lib/tkextlib/ICONS.rb16
-rw-r--r--ext/tk/lib/tkextlib/ICONS/icons.rb84
-rw-r--r--ext/tk/lib/tkextlib/ICONS/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS161
-rwxr-xr-xext/tk/lib/tkextlib/pkg_checker.rb129
-rw-r--r--ext/tk/lib/tkextlib/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tcllib.rb57
-rw-r--r--ext/tk/lib/tkextlib/tcllib/README135
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb100
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb141
-rw-r--r--ext/tk/lib/tkextlib/tcllib/cursor.rb41
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb50
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb53
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb666
-rw-r--r--ext/tk/lib/tkextlib/tcllib/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tcllib/style.rb30
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb284
-rw-r--r--ext/tk/lib/tkextlib/tile.rb73
-rw-r--r--ext/tk/lib/tkextlib/tile/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb67
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb33
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb90
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb33
-rw-r--r--ext/tk/lib/tkextlib/tkDND.rb25
-rw-r--r--ext/tk/lib/tkextlib/tkDND/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb96
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb108
-rw-r--r--ext/tk/lib/tkextlib/tkHTML.rb16
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb427
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkimg.rb23
-rw-r--r--ext/tk/lib/tkextlib/tkimg/README26
-rw-r--r--ext/tk/lib/tkextlib/tkimg/bmp.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/gif.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ico.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/jpeg.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pcx.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pixmap.rb21
-rw-r--r--ext/tk/lib/tkextlib/tkimg/png.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ppm.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ps.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sgi.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sun.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tga.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tiff.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/window.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xbm.rb14
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xpm.rb14
-rw-r--r--ext/tk/lib/tkextlib/tktrans.rb17
-rw-r--r--ext/tk/lib/tkextlib/tktrans/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb53
-rw-r--r--ext/tk/lib/tkextlib/treectrl.rb16
-rw-r--r--ext/tk/lib/tkextlib/treectrl/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb887
-rw-r--r--ext/tk/lib/tkextlib/vu.rb40
-rw-r--r--ext/tk/lib/tkextlib/vu/bargraph.rb50
-rw-r--r--ext/tk/lib/tkextlib/vu/charts.rb47
-rw-r--r--ext/tk/lib/tkextlib/vu/dial.rb102
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb229
-rw-r--r--ext/tk/lib/tkextlib/vu/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/vu/spinbox.rb17
-rw-r--r--ext/tk/sample/demos-en/paned2.rb2
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb2
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb3
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb2
-rw-r--r--ext/tk/sample/optobj_sample.rb67
-rw-r--r--ext/tk/sample/tkcombobox.rb7
-rw-r--r--ext/tk/sample/tkextlib/tcllib/datefield.rb29
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos1.rb158
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos2.rb71
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos3.rb83
-rw-r--r--ext/tk/sample/tkextlib/tcllib/xyplot.rb17
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/README12
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/hv.rb306
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image1bin0 -> 8995 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image10bin0 -> 3095 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image11bin0 -> 1425 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image12bin0 -> 2468 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image13bin0 -> 4073 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image14bin0 -> 53 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image2bin0 -> 42 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image3bin0 -> 3473 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image4bin0 -> 1988 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image5bin0 -> 973 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image6bin0 -> 2184 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image7bin0 -> 2022 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image8bin0 -> 1186 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image9bin0 -> 139 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/index.html115
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image1bin0 -> 1966 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image10bin0 -> 255 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image11bin0 -> 590 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image12bin0 -> 254 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image13bin0 -> 493 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image14bin0 -> 195 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image15bin0 -> 68 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image16bin0 -> 157 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image17bin0 -> 81 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image18bin0 -> 545 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image19bin0 -> 53 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image2bin0 -> 49 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image20bin0 -> 533 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image21bin0 -> 564 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image22bin0 -> 81 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image23bin0 -> 539 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image24bin0 -> 151 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image25bin0 -> 453 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image26bin0 -> 520 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image27bin0 -> 565 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image28bin0 -> 416 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image29bin0 -> 121 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image3bin0 -> 10835 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image30bin0 -> 663 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image31bin0 -> 78 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image32bin0 -> 556 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image33bin0 -> 598 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image34bin0 -> 496 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image35bin0 -> 724 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image36bin0 -> 404 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image37bin0 -> 124 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image38bin0 -> 8330 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image39bin0 -> 369 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image4bin0 -> 268 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image5bin0 -> 492 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image6bin0 -> 246 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image7bin0 -> 551 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image8bin0 -> 497 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image9bin0 -> 492 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/index.html433
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image1bin0 -> 113 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image10bin0 -> 5088 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image11bin0 -> 4485 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image12bin0 -> 3579 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image13bin0 -> 5119 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image14bin0 -> 3603 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image2bin0 -> 74 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image3bin0 -> 681 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image4bin0 -> 3056 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image5bin0 -> 2297 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image6bin0 -> 79 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image7bin0 -> 1613 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image8bin0 -> 864 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image9bin0 -> 2379 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/index.html2787
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image1bin0 -> 42 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image2bin0 -> 14343 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image3bin0 -> 17750 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image4bin0 -> 61 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image5bin0 -> 201 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image6bin0 -> 214 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image7bin0 -> 149 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image8bin0 -> 203 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image9bin0 -> 1504 bytes
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/index.html768
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/ss.rb404
-rw-r--r--ext/tk/sample/tkextlib/vu/README.txt50
-rw-r--r--ext/tk/sample/tkextlib/vu/canvItems.rb90
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker.rb82
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker2.rb99
-rw-r--r--ext/tk/sample/tkextlib/vu/dial.rb113
-rw-r--r--ext/tk/sample/tkextlib/vu/m128_000.xbm174
-rw-r--r--ext/tk/sample/tkextlib/vu/oscilloscope.rb68
-rw-r--r--ext/tk/sample/tkextlib/vu/pie.rb56
-rw-r--r--ext/tk/sample/tkextlib/vu/vu.rb67
-rw-r--r--ext/tk/sample/tkmultilistbox.rb4
-rw-r--r--ext/tk/tkutil.c77
198 files changed, 14110 insertions, 572 deletions
diff --git a/ext/tcltklib/MANIFEST b/ext/tcltklib/MANIFEST
index e408dc3ee80..92a6ed642be 100644
--- a/ext/tcltklib/MANIFEST
+++ b/ext/tcltklib/MANIFEST
@@ -1,5 +1,6 @@
MANIFEST
README.1st
+README.ActiveTcl
README.euc
MANUAL.euc
MANUAL.eng
diff --git a/ext/tcltklib/README.ActiveTcl b/ext/tcltklib/README.ActiveTcl
new file mode 100644
index 00000000000..c9cc691973c
--- /dev/null
+++ b/ext/tcltklib/README.ActiveTcl
@@ -0,0 +1,42 @@
+ActiveTcl is ActiveState's quality-assured distribution of Tcl.
+
+# see <http://www.activestate.com/Products/ActiveTcl/>
+# <http://www.tcl.tk/>
+
+If you want to use ActiveTcl binary package as the Tcl/Tk libraries,
+please use the following configure options.
+
+ --with-tcl-dir=<ActiveTcl_root>
+ --with-tk-dir=<ActiveTcl_root>
+
+And use the followings if you need.
+
+ --with-tcllib=<libname>
+ --with-tklib=<libname>
+ --enable-tcltk-stubs
+
+For example, when you install ActiveTcl-8.4.x to '/usr/local/ActiveTcl',
+
+ configure --with-tcl-dir=/usr/local/ActiveTcl/ \
+ --with-tk-dir=/usr/local/ActiveTcl/ \
+ --with-tcllib=tcl8.4 \
+ --with-tklib=tk8.4 \
+ --enable-tcltk-stubs
+
+It depends on your environment that you have to add the directory of
+ActiveTcl's dynamic link libraries to your library path when execute
+Ruby/Tk.
+
+# For example, on Linux, one of the ways is to use LD_LIBRARY_PATH
+# environment variable.
+#
+# [bash]$ LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH \
+# ruby your-Ruby/Tk-script
+#
+# [bash]$ LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH irb
+
+Then, you'll be able to use Tcl/Tk extension libraries included in the
+ActiveTcl package (e.g. call TkPackage.require('BWidget'), and then,
+use functions/widgets of BWidget extention).
+
+ Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
index 83b4a2ac31c..ac48812d7a2 100644
--- a/ext/tcltklib/extconf.rb
+++ b/ext/tcltklib/extconf.rb
@@ -5,6 +5,12 @@ require 'mkmf'
is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
is_macosx = (/darwin/ =~ RUBY_PLATFORM)
+mac_need_framework =
+ is_macosx &&
+ enable_config("mac-tcltk-framework", false) &&
+ FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
+ FileTest.directory?("/Library/Frameworks/Tk.framework/")
+
unless is_win32
have_library("nsl", "t_open")
have_library("socket", "socket")
@@ -210,7 +216,7 @@ EOF
end
end
-if is_macosx ||
+if mac_need_framework ||
(have_header("tcl.h") && have_header("tk.h") &&
(is_win32 || find_library("X11", "XOpenDisplay",
"/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
@@ -219,7 +225,7 @@ if is_macosx ||
$CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
$CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
- if is_macosx
+ if mac_need_framework
$CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
$LDFLAGS += ' -framework Tk -framework Tcl'
end
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index cb3826ba9fa..c68fe661e92 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -1201,12 +1201,15 @@ ip_ruby_eval(clientData, interp, argc, argv)
rb_thread_critical = thr_crit_bup;
if (eclass == eTkCallbackReturn) {
+ ip_set_exc_message(interp, res);
return TCL_RETURN;
} else if (eclass == eTkCallbackBreak) {
+ ip_set_exc_message(interp, res);
return TCL_BREAK;
} else if (eclass == eTkCallbackContinue) {
+ ip_set_exc_message(interp, res);
return TCL_CONTINUE;
} else if (eclass == rb_eSystemExit) {
@@ -1239,12 +1242,15 @@ ip_ruby_eval(clientData, interp, argc, argv)
}
if (SYM2ID(reason) == ID_return) {
+ ip_set_exc_message(interp, res);
return TCL_RETURN;
} else if (SYM2ID(reason) == ID_break) {
+ ip_set_exc_message(interp, res);
return TCL_BREAK;
} else if (SYM2ID(reason) == ID_next) {
+ ip_set_exc_message(interp, res);
return TCL_CONTINUE;
} else {
@@ -1572,12 +1578,15 @@ ip_ruby_cmd(clientData, interp, argc, argv)
rb_thread_critical = thr_crit_bup;
if (eclass == eTkCallbackReturn) {
+ ip_set_exc_message(interp, res);
return TCL_RETURN;
} else if (eclass == eTkCallbackBreak) {
+ ip_set_exc_message(interp, res);
return TCL_BREAK;
} else if (eclass == eTkCallbackContinue) {
+ ip_set_exc_message(interp, res);
return TCL_CONTINUE;
} else if (eclass == rb_eSystemExit) {
@@ -1609,12 +1618,15 @@ ip_ruby_cmd(clientData, interp, argc, argv)
}
if (SYM2ID(reason) == ID_return) {
+ ip_set_exc_message(interp, res);
return TCL_RETURN;
} else if (SYM2ID(reason) == ID_break) {
+ ip_set_exc_message(interp, res);
return TCL_BREAK;
} else if (SYM2ID(reason) == ID_next) {
+ ip_set_exc_message(interp, res);
return TCL_CONTINUE;
} else {
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib
new file mode 100644
index 00000000000..48e6228e27c
--- /dev/null
+++ b/ext/tk/ChangeLog.tkextlib
@@ -0,0 +1,3 @@
+2004-07-01 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * 1st release of tkextlib ( to support Tcl/Tk extensions )
diff --git a/ext/tk/MANIFEST b/ext/tk/MANIFEST
index c2ac51eddca..fbba82daefd 100644
--- a/ext/tk/MANIFEST
+++ b/ext/tk/MANIFEST
@@ -1,6 +1,7 @@
MANIFEST
README.1st
README.fork
+ChangeLog.tkextlib
extconf.rb
depend
tkutil.c
@@ -44,6 +45,7 @@ lib/tk/font.rb
lib/tk/frame.rb
lib/tk/grid.rb
lib/tk/image.rb
+lib/tk/itemconfig.rb
lib/tk/itemfont.rb
lib/tk/kinput.rb
lib/tk/label.rb
@@ -58,6 +60,7 @@ lib/tk/mngfocus.rb
lib/tk/msgcat.rb
lib/tk/namespace.rb
lib/tk/optiondb.rb
+lib/tk/optionobj.rb
lib/tk/pack.rb
lib/tk/package.rb
lib/tk/palette.rb
@@ -87,6 +90,71 @@ lib/tk/winfo.rb
lib/tk/winpkg.rb
lib/tk/wm.rb
lib/tk/xim.rb
+lib/tkextlib/SUPPORT_STATUS
+lib/tkextlib/pkg_checker.rb
+lib/tkextlib/setup.rb
+lib/tkextlib/ICONS.rb
+lib/tkextlib/ICONS/icons.rb
+lib/tkextlib/ICONS/setup.rb
+lib/tkextlib/tcllib.rb
+lib/tkextlib/tcllib/README
+lib/tkextlib/tcllib/autoscroll.rb
+lib/tkextlib/tcllib/ctext.rb
+lib/tkextlib/tcllib/cursor.rb
+lib/tkextlib/tcllib/datefield.rb
+lib/tkextlib/tcllib/ip_entry.rb
+lib/tkextlib/tcllib/plotchart.rb
+lib/tkextlib/tcllib/setup.rb
+lib/tkextlib/tcllib/style.rb
+lib/tkextlib/tcllib/tkpiechart.rb
+lib/tkextlib/tile.rb
+lib/tkextlib/tile/setup.rb
+lib/tkextlib/tile/style.rb
+lib/tkextlib/tile/tbutton.rb
+lib/tkextlib/tile/tcheckbutton.rb
+lib/tkextlib/tile/tlabel.rb
+lib/tkextlib/tile/tmenubutton.rb
+lib/tkextlib/tile/tnotebook.rb
+lib/tkextlib/tile/tradiobutton.rb
+lib/tkextlib/tkDND.rb
+lib/tkextlib/tkDND/setup.rb
+lib/tkextlib/tkDND/shape.rb
+lib/tkextlib/tkDND/tkdnd.rb
+lib/tkextlib/tkHTML.rb
+lib/tkextlib/tkHTML/htmlwidget.rb
+lib/tkextlib/tkHTML/setup.rb
+lib/tkextlib/tkimg.rb
+lib/tkextlib/tkimg/README
+lib/tkextlib/tkimg/bmp.rb
+lib/tkextlib/tkimg/gif.rb
+lib/tkextlib/tkimg/ico.rb
+lib/tkextlib/tkimg/jpeg.rb
+lib/tkextlib/tkimg/pcx.rb
+lib/tkextlib/tkimg/pixmap.rb
+lib/tkextlib/tkimg/png.rb
+lib/tkextlib/tkimg/ppm.rb
+lib/tkextlib/tkimg/ps.rb
+lib/tkextlib/tkimg/setup.rb
+lib/tkextlib/tkimg/sgi.rb
+lib/tkextlib/tkimg/sun.rb
+lib/tkextlib/tkimg/tga.rb
+lib/tkextlib/tkimg/tiff.rb
+lib/tkextlib/tkimg/window.rb
+lib/tkextlib/tkimg/xbm.rb
+lib/tkextlib/tkimg/xpm.rb
+lib/tkextlib/tktrans.rb
+lib/tkextlib/tktrans/setup.rb
+lib/tkextlib/tktrans/tktrans.rb
+lib/tkextlib/treectrl.rb
+lib/tkextlib/treectrl/setup.rb
+lib/tkextlib/treectrl/tktreectrl.rb
+lib/tkextlib/vu.rb
+lib/tkextlib/vu/bargraph.rb
+lib/tkextlib/vu/charts.rb
+lib/tkextlib/vu/dial.rb
+lib/tkextlib/vu/pie.rb
+lib/tkextlib/vu/setup.rb
+lib/tkextlib/vu/spinbox.rb
sample/binding_sample.rb
sample/bindtag_sample.rb
sample/binstr_usage.rb
@@ -95,12 +163,13 @@ sample/encstr_usage.rb
sample/iso2022-kr.txt
sample/menubar1.rb
sample/menubar2.rb
+sample/optobj_sample.rb
sample/propagate.rb
+sample/remote-ip_sample.rb
+sample/remote-ip_sample2.rb
sample/resource.en
sample/resource.ja
sample/safe-tk.rb
-sample/remote-ip_sample.rb
-sample/remote-ip_sample2.rb
sample/tkalignbox.rb
sample/tkballoonhelp.rb
sample/tkbiff.rb
@@ -313,3 +382,100 @@ sample/msgs_tk/ja.msg
sample/msgs_tk/nl.msg
sample/msgs_tk/pl.msg
sample/msgs_tk/ru.msg
+sample/tkextlib/tcllib/datefield.rb
+sample/tkextlib/tcllib/plotdemos1.rb
+sample/tkextlib/tcllib/plotdemos2.rb
+sample/tkextlib/tcllib/plotdemos3.rb
+sample/tkextlib/tcllib/xyplot.rb
+sample/tkextlib/tkHTML/README
+sample/tkextlib/tkHTML/hv.rb
+sample/tkextlib/tkHTML/ss.rb
+sample/tkextlib/tkHTML/page1/image1
+sample/tkextlib/tkHTML/page1/image10
+sample/tkextlib/tkHTML/page1/image11
+sample/tkextlib/tkHTML/page1/image12
+sample/tkextlib/tkHTML/page1/image13
+sample/tkextlib/tkHTML/page1/image14
+sample/tkextlib/tkHTML/page1/image2
+sample/tkextlib/tkHTML/page1/image3
+sample/tkextlib/tkHTML/page1/image4
+sample/tkextlib/tkHTML/page1/image5
+sample/tkextlib/tkHTML/page1/image6
+sample/tkextlib/tkHTML/page1/image7
+sample/tkextlib/tkHTML/page1/image8
+sample/tkextlib/tkHTML/page1/image9
+sample/tkextlib/tkHTML/page1/index.html
+sample/tkextlib/tkHTML/page2/image1
+sample/tkextlib/tkHTML/page2/image10
+sample/tkextlib/tkHTML/page2/image11
+sample/tkextlib/tkHTML/page2/image12
+sample/tkextlib/tkHTML/page2/image13
+sample/tkextlib/tkHTML/page2/image14
+sample/tkextlib/tkHTML/page2/image15
+sample/tkextlib/tkHTML/page2/image16
+sample/tkextlib/tkHTML/page2/image17
+sample/tkextlib/tkHTML/page2/image18
+sample/tkextlib/tkHTML/page2/image19
+sample/tkextlib/tkHTML/page2/image2
+sample/tkextlib/tkHTML/page2/image20
+sample/tkextlib/tkHTML/page2/image21
+sample/tkextlib/tkHTML/page2/image22
+sample/tkextlib/tkHTML/page2/image23
+sample/tkextlib/tkHTML/page2/image24
+sample/tkextlib/tkHTML/page2/image25
+sample/tkextlib/tkHTML/page2/image26
+sample/tkextlib/tkHTML/page2/image27
+sample/tkextlib/tkHTML/page2/image28
+sample/tkextlib/tkHTML/page2/image29
+sample/tkextlib/tkHTML/page2/image3
+sample/tkextlib/tkHTML/page2/image30
+sample/tkextlib/tkHTML/page2/image31
+sample/tkextlib/tkHTML/page2/image32
+sample/tkextlib/tkHTML/page2/image33
+sample/tkextlib/tkHTML/page2/image34
+sample/tkextlib/tkHTML/page2/image35
+sample/tkextlib/tkHTML/page2/image36
+sample/tkextlib/tkHTML/page2/image37
+sample/tkextlib/tkHTML/page2/image38
+sample/tkextlib/tkHTML/page2/image39
+sample/tkextlib/tkHTML/page2/image4
+sample/tkextlib/tkHTML/page2/image5
+sample/tkextlib/tkHTML/page2/image6
+sample/tkextlib/tkHTML/page2/image7
+sample/tkextlib/tkHTML/page2/image8
+sample/tkextlib/tkHTML/page2/image9
+sample/tkextlib/tkHTML/page2/index.html
+sample/tkextlib/tkHTML/page3/image1
+sample/tkextlib/tkHTML/page3/image10
+sample/tkextlib/tkHTML/page3/image11
+sample/tkextlib/tkHTML/page3/image12
+sample/tkextlib/tkHTML/page3/image13
+sample/tkextlib/tkHTML/page3/image14
+sample/tkextlib/tkHTML/page3/image2
+sample/tkextlib/tkHTML/page3/image3
+sample/tkextlib/tkHTML/page3/image4
+sample/tkextlib/tkHTML/page3/image5
+sample/tkextlib/tkHTML/page3/image6
+sample/tkextlib/tkHTML/page3/image7
+sample/tkextlib/tkHTML/page3/image8
+sample/tkextlib/tkHTML/page3/image9
+sample/tkextlib/tkHTML/page3/index.html
+sample/tkextlib/tkHTML/page4/image1
+sample/tkextlib/tkHTML/page4/image2
+sample/tkextlib/tkHTML/page4/image3
+sample/tkextlib/tkHTML/page4/image4
+sample/tkextlib/tkHTML/page4/image5
+sample/tkextlib/tkHTML/page4/image6
+sample/tkextlib/tkHTML/page4/image7
+sample/tkextlib/tkHTML/page4/image8
+sample/tkextlib/tkHTML/page4/image9
+sample/tkextlib/tkHTML/page4/index.html
+sample/tkextlib/vu/README.txt
+sample/tkextlib/vu/canvItems.rb
+sample/tkextlib/vu/canvSticker.rb
+sample/tkextlib/vu/canvSticker2.rb
+sample/tkextlib/vu/dial.rb
+sample/tkextlib/vu/m128_000.xbm
+sample/tkextlib/vu/oscilloscope.rb
+sample/tkextlib/vu/pie.rb
+sample/tkextlib/vu/vu.rb
diff --git a/ext/tk/README.1st b/ext/tk/README.1st
index ff92fdd8a38..038528e5539 100644
--- a/ext/tk/README.1st
+++ b/ext/tk/README.1st
@@ -1,6 +1,7 @@
If you want to use Ruby/Tk (tk.rb and so on), you must have
tcltklib.so which is working collectry. If you fail to call
'require "tcltklib"', you may not have tcltklib.so.
+( see also README files of tcltklib )
Even if there is a tcltklib.so on your Ruby library directry,
it will not work without Tcl/Tk libraries (e.g. libtcl8.4.so)
on your environment. You must also check that your Tcl/Tk is
@@ -12,6 +13,7 @@ installed properly.
Ruby/Tk (tk.rb など) を使いたい場合には,tcltklib.so が正しく
動いていなければなりません.もし require "tcltklib" に失敗する
ようなら,tcltklib.so が存在していないのかもしれません.
+( tcltklib の README ファイルも見てください )
たとえ Ruby のライブラリディレクトリに tcltklib.so が存在して
いたとしても,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など)
がなければ機能しません.Tcl/Tk が正しくインストールされているか
diff --git a/ext/tk/lib/README b/ext/tk/lib/README
index c003adb2c8d..5918fe4bf06 100644
--- a/ext/tk/lib/README
+++ b/ext/tk/lib/README
@@ -1,6 +1,17 @@
README this file
multi-tk.rb multiple Tk interpreter (included safe-Tk) support
+remotei-tk.rb control remote Tk interpreter on the other process support
tk.rb Tk interface
+
+tk/ library files construct Ruby/Tk
+
+tkextlib/ non-standard Tcl/Tk extension support libraries
+
+*********************************************************************
+*** The followings exists for backward compatibility only.
+*** The only thing which they work is that requires current
+*** library files ( tk/*.rb ).
+*********************************************************************
tkafter.rb handles Tcl after
tkbgerror.rb Tk error module
tkcanvas.rb Tk canvas interface
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 8462c3064cc..9cf2ac3e077 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -103,6 +103,8 @@ module TkComm
gen_class_name = 'TkWidget_' + tk_class
classname_def = "WidgetClassName = '#{tk_class}'.freeze"
end
+
+=begin
unless Object.const_defined? gen_class_name
Object.class_eval "class #{gen_class_name}<#{ruby_class_name}
#{classname_def}
@@ -110,6 +112,21 @@ module TkComm
end
Object.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}',
'without_creating'=>true)"
+=end
+ base = Object
+ gen_class_name.split('::').each{|klass|
+ next if klass == ''
+ if base.const_defined?(klass)
+ base = base.class_eval klass
+ else
+ base = base.class_eval "class #{klass}<#{ruby_class_name}
+ #{classname_def}
+ end
+ #{klass}"
+ end
+ }
+ base.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}',
+ 'without_creating'=>true)"
end
private :_genobj_for_tkwidget
module_function :_genobj_for_tkwidget
@@ -790,8 +807,8 @@ module TkComm
}
end
end
- private :install_bind, :tk_event_sequence,
- :_bind_core, :_bind, :_bind_append, :_bind_remove, :_bindinfo
+ private :tk_event_sequence
+ private :_bind_core, :_bind, :_bind_append, :_bind_remove, :_bindinfo
def bind(tagOrClass, context, cmd=Proc.new, args=nil)
_bind(["bind", tagOrClass], context, cmd, args)
@@ -1403,9 +1420,17 @@ module Tk
TCL_VERSION = INTERP._invoke_without_enc("info", "tclversion").freeze
TCL_PATCHLEVEL = INTERP._invoke_without_enc("info", "patchlevel").freeze
+ major, minor = TCL_VERSION.split('.')
+ TCL_MAJOR_VERSION = major.to_i
+ TCL_MINOR_VERSION = minor.to_i
+
TK_VERSION = INTERP._invoke_without_enc("set", "tk_version").freeze
TK_PATCHLEVEL = INTERP._invoke_without_enc("set", "tk_patchLevel").freeze
+ major, minor = TK_VERSION.split('.')
+ TK_MAJOR_VERSION = major.to_i
+ TK_MINOR_VERSION = minor.to_i
+
JAPANIZED_TK = (INTERP._invoke_without_enc("info", "commands",
"kanji") != "").freeze
@@ -1888,281 +1913,500 @@ else
end
+module TkBindCore
+ def bind(context, cmd=Proc.new, args=nil)
+ Tk.bind(self, context, cmd, args)
+ end
+
+ def bind_append(context, cmd=Proc.new, args=nil)
+ Tk.bind_append(self, context, cmd, args)
+ end
+
+ def bind_remove(context)
+ Tk.bind_remove(self, context)
+ end
+
+ def bindinfo(context=nil)
+ Tk.bindinfo(self, context)
+ end
+end
+
+
module TkTreatFont
- def font_configinfo(name = nil)
- ret = TkFont.used_on(self.path)
- if ret == nil
-=begin
- if name
- ret = name
- else
- ret = TkFont.init_widget_font(self.path, self.path, 'configure')
- end
-=end
- ret = TkFont.init_widget_font(self.path, self.path, 'configure')
+ def __font_optkeys
+ ['font']
+ end
+ private :__font_optkeys
+
+ def __pathname
+ self.path
+ end
+ private :__pathname
+
+ ################################
+
+ def font_configinfo(key = nil)
+ optkeys = __font_optkeys
+ if key && !optkeys.find{|opt| opt.to_s == key.to_s}
+ fail ArgumentError, "unknown font option name `#{key}'"
+ end
+
+ win, tag = __pathname.split(':')
+
+ if key
+ pathname = [win, tag, key].join(';')
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *__config_cmd)
+ elsif optkeys.size == 1
+ pathname = [win, tag, optkeys[0]].join(';')
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *__config_cmd)
+ else
+ fonts = {}
+ optkeys.each{|key|
+ key = key.to_s
+ pathname = [win, tag, key].join(';')
+ fonts[key] =
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *__config_cmd)
+ }
+ fonts
end
- ret
end
alias fontobj font_configinfo
def font_configure(slot)
+ pathname = __pathname
+
slot = _symbolkey2str(slot)
- if slot.key?('font')
- fnt = slot.delete('font')
- if fnt.kind_of? TkFont
- return fnt.call_font_configure(self.path, self.path,'configure',slot)
- else
- if fnt
- if (slot.key?('kanjifont') ||
- slot.key?('latinfont') ||
- slot.key?('asciifont'))
- fnt = TkFont.new(fnt)
-
- lfnt = slot.delete('latinfont')
- lfnt = slot.delete('asciifont') if slot.key?('asciifont')
- kfnt = slot.delete('kanjifont')
-
- fnt.latin_replace(lfnt) if lfnt
- fnt.kanji_replace(kfnt) if kfnt
- else
- slot['font'] = fnt
- tk_call(self.path, 'configure', *hash_kv(slot))
+ __font_optkeys.each{|optkey|
+ optkey = optkey.to_s
+ l_optkey = 'latin' << optkey
+ a_optkey = 'ascii' << optkey
+ k_optkey = 'kanji' << optkey
+
+ if slot.key?(optkey)
+ fnt = slot.delete(optkey)
+ if fnt.kind_of?(TkFont)
+ slot.delete(l_optkey)
+ slot.delete(a_optkey)
+ slot.delete(k_optkey)
+
+ fnt.call_font_configure([pathname, optkey], *(__config_cmd << {}))
+ next
+ else
+ if fnt
+ if (slot.key?(l_optkey) ||
+ slot.key?(a_optkey) ||
+ slot.key?(k_optkey))
+ fnt = TkFont.new(fnt)
+
+ lfnt = slot.delete(l_optkey)
+ lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
+ kfnt = slot.delete(k_optkey)
+
+ fnt.latin_replace(lfnt) if lfnt
+ fnt.kanji_replace(kfnt) if kfnt
+
+ fnt.call_font_configure([pathname, optkey],
+ *(__config_cmd << {}))
+ next
+ else
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ end
end
+ next
end
- return self
end
- end
-
- lfnt = slot.delete('latinfont')
- lfnt = slot.delete('asciifont') if slot.key?('asciifont')
- kfnt = slot.delete('kanjifont')
- if lfnt && kfnt
- return TkFont.new(lfnt, kfnt).call_font_configure(self.path, self.path,
- 'configure', slot)
- end
+ lfnt = slot.delete(l_optkey)
+ lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
+ kfnt = slot.delete(k_optkey)
+
+ if lfnt && kfnt
+ TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey],
+ *(__config_cmd << {}))
+ elsif lfnt
+ latinfont_configure([lfnt, optkey])
+ elsif kfnt
+ kanjifont_configure([kfnt, optkey])
+ end
+ }
- latinfont_configure(lfnt) if lfnt
- kanjifont_configure(kfnt) if kfnt
-
- tk_call(self.path, 'configure', *hash_kv(slot)) if slot != {}
+ # configure other (without font) options
+ tk_call(*(__config_cmd.concat(hash_kv(slot)))) if slot != {}
self
end
def latinfont_configure(ltn, keys=nil)
- if (fobj = TkFont.used_on(self.path))
- fobj = TkFont.new(fobj) # create a new TkFont object
- elsif Tk::JAPANIZED_TK
- fobj = fontobj # create a new TkFont object
+ if ltn.kind_of?(Array)
+ key = ltn[1]
+ ltn = ltn[0]
else
- tk_call(self.path, 'configure', '-font', ltn)
- return self
+ key = nil
end
- if fobj.kind_of?(TkFont)
- if ltn.kind_of? TkFont
- conf = {}
- ltn.latin_configinfo.each{|key,val| conf[key] = val}
- if keys
- fobj.latin_configure(conf.update(keys))
+ optkeys = __font_optkeys
+ if key && !optkeys.find{|opt| opt.to_s == key.to_s}
+ fail ArgumentError, "unknown font option name `#{key}'"
+ end
+
+ win, tag = __pathname.split(':')
+
+ optkeys = [key] if key
+
+ optkeys.each{|optkey|
+ optkey = optkey.to_s
+
+ pathname = [win, tag, optkey].join(';')
+
+ if (fobj = TkFont.used_on(pathname))
+ fobj = TkFont.new(fobj) # create a new TkFont object
+ elsif Tk::JAPANIZED_TK
+ fobj = fontobj # create a new TkFont object
+ else
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ next
+ end
+
+ if fobj.kind_of?(TkFont)
+ if ltn.kind_of?(TkFont)
+ conf = {}
+ ltn.latin_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.latin_configure(conf.update(keys))
+ else
+ fobj.latin_configure(conf)
+ end
else
- fobj.latin_configure(conf)
+ fobj.latin_replace(ltn)
end
- else
- fobj.latin_replace(ltn)
end
- end
- return fobj.call_font_configure(self.path, self.path, 'configure', {})
+ fobj.call_font_configure([pathname, optkey], *(__config_cmd << {}))
+ }
+ self
end
alias asciifont_configure latinfont_configure
def kanjifont_configure(knj, keys=nil)
- if (fobj = TkFont.used_on(self.path))
- fobj = TkFont.new(fobj) # create a new TkFont object
- elsif Tk::JAPANIZED_TK
- fobj = fontobj # create a new TkFont object
+ if knj.kind_of?(Array)
+ key = knj[1]
+ knj = knj[0]
else
- tk_call(self.path, 'configure', '-font', knj)
- return self
+ key = nil
+ end
+
+ optkeys = __font_optkeys
+ if key && !optkeys.find{|opt| opt.to_s == key.to_s}
+ fail ArgumentError, "unknown font option name `#{key}'"
end
- if fobj.kind_of?(TkFont)
- if knj.kind_of? TkFont
- conf = {}
- knj.kanji_configinfo.each{|key,val| conf[key] = val}
- if keys
- fobj.kanji_configure(conf.update(keys))
+ win, tag = __pathname.split(':')
+
+ optkeys = [key] if key
+
+ optkeys.each{|optkey|
+ optkey = optkey.to_s
+
+ pathname = [win, tag, optkey].join(';')
+
+ if (fobj = TkFont.used_on(pathname))
+ fobj = TkFont.new(fobj) # create a new TkFont object
+ elsif Tk::JAPANIZED_TK
+ fobj = fontobj # create a new TkFont object
+ else
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ next
+ end
+
+ if fobj.kind_of?(TkFont)
+ if knj.kind_of?(TkFont)
+ conf = {}
+ knj.kanji_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.kanji_configure(conf.update(keys))
+ else
+ fobj.kanji_configure(conf)
+ end
else
- fobj.kanji_configure(conf)
+ fobj.kanji_replace(knj)
end
- else
- fobj.kanji_replace(knj)
end
- end
- return fobj.call_font_configure(self.path, self.path, 'configure', {})
+ fobj.call_font_configure([pathname, optkey], *(__config_cmd << {}))
+ }
+ self
end
- def font_copy(window, tag=nil)
- if tag
- fnt = window.tagfontobj(tag).dup
+ def font_copy(window, wintag=nil, winkey=nil, targetkey=nil)
+ if wintag
+ if winkey
+ fnt = window.tagfontobj(wintag, winkey).dup
+ else
+ fnt = window.tagfontobj(wintag).dup
+ end
else
- fnt = window.fontobj.dup
+ if winkey
+ fnt = window.fontobj(winkey).dup
+ else
+ fnt = window.fontobj.dup
+ end
+ end
+
+ if targetkey
+ fnt.call_font_configure([__pathname, targetkey], *(__config_cmd << {}))
+ else
+ fnt.call_font_configure(__pathname, *(__config_cmd << {}))
end
- fnt.call_font_configure(self.path, self.path, 'configure', {})
self
end
- def latinfont_copy(window, tag=nil)
- fontobj.dup.call_font_configure(self.path, self.path, 'configure', {})
- if tag
- fontobj.latin_replace(window.tagfontobj(tag).latin_font_id)
+ def latinfont_copy(window, wintag=nil, winkey=nil, targetkey=nil)
+ if targetkey
+ fontobj(targetkey).dup.call_font_configure([__pathname, targetkey],
+ *(__config_cmd << {}))
+ else
+ fontobj.dup.call_font_configure(__pathname, *(__config_cmd << {}))
+ end
+
+ if wintag
+ if winkey
+ fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
+ else
+ fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
+ end
else
- fontobj.latin_replace(window.fontobj.latin_font_id)
+ if winkey
+ fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
+ else
+ fontobj.latin_replace(window.fontobj.latin_font_id)
+ end
end
self
end
alias asciifont_copy latinfont_copy
- def kanjifont_copy(window, tag=nil)
- fontobj.dup.call_font_configure(self.path, self.path, 'configure', {})
- if tag
- fontobj.kanji_replace(window.tagfontobj(tag).kanji_font_id)
+ def kanjifont_copy(window, wintag=nil, winkey=nil, targetkey=nil)
+ if targetkey
+ fontobj(targetkey).dup.call_font_configure([__pathname, targetkey],
+ *(__config_cmd << {}))
else
- fontobj.kanji_replace(window.fontobj.kanji_font_id)
+ fontobj.dup.call_font_configure(__pathname, *(__config_cmd << {}))
+ end
+
+ if wintag
+ if winkey
+ fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
+ else
+ fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
+ end
+ else
+ if winkey
+ fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
+ else
+ fontobj.kanji_replace(window.fontobj.kanji_font_id)
+ end
end
self
end
end
-module TkBindCore
- def bind(context, cmd=Proc.new, args=nil)
- Tk.bind(self, context, cmd, args)
- end
+module TkConfigMethod
+ include TkUtil
+ include TkTreatFont
- def bind_append(context, cmd=Proc.new, args=nil)
- Tk.bind_append(self, context, cmd, args)
+ def __cget_cmd
+ [self.path, 'cget']
end
+ private :__cget_cmd
- def bind_remove(context)
- Tk.bind_remove(self, context)
+ def __config_cmd
+ [self.path, 'configure']
end
+ private :__config_cmd
- def bindinfo(context=nil)
- Tk.bindinfo(self, context)
+ def __configinfo_struct
+ {:key=>0, :alias=>1, :db_name=>1, :db_class=>2,
+ :default_value=>3, :current_value=>4}
end
-end
+ private :__configinfo_struct
+ def __numval_optkeys
+ []
+ end
+ private :__numval_optkeys
-class TkObject<TkKernel
- include Tk
- include TkTreatFont
- include TkBindCore
+ def __numstrval_optkeys
+ []
+ end
+ private :__numstrval_optkeys
-### --> definition is moved to TkUtil module
-# def path
-# @path
-# end
+ def __boolval_optkeys
+ []
+ end
+ private :__boolval_optkeys
- def epath
- @path
+ def __strval_optkeys
+ ['text', 'label', 'show', 'data', 'file']
end
+ private :__strval_optkeys
- def to_eval
- @path
+ def __listval_optkeys
+ []
end
+ private :__listval_optkeys
- def tk_send(cmd, *rest)
- tk_call(path, cmd, *rest)
+ def __numlistval_optkeys
+ []
end
- def tk_send_without_enc(cmd, *rest)
- tk_call_without_enc(path, cmd, *rest)
+ private :__numlistval_optkeys
+
+ def __methodcall_optkeys # { key=>method, ... }
+ {}
end
- def tk_send_with_enc(cmd, *rest)
- tk_call_with_enc(path, cmd, *rest)
+ private :__methodcall_optkeys
+
+ def __keyonly_optkeys # { def_key=>undef_key or nil, ... }
+ {}
end
- # private :tk_send, :tk_send_without_enc, :tk_send_with_enc
+ private :__keyonly_optkeys
- def method_missing(id, *args)
- name = id.id2name
- case args.length
- when 1
- if name[-1] == ?=
- configure name[0..-2], args[0]
+ def __conv_keyonly_opts(keys)
+ return keys unless keys.kind_of?(Hash)
+ keyonly = __keyonly_optkeys
+ keys2 = {}
+ keys.each{|k, v|
+ optkey = keyonly.find{|kk,vv| kk.to_s == k.to_s}
+ if optkey
+ defkey, undefkey = optkey
+ if v
+ keys2[defkey.to_s] = None
+ elsif undefkey
+ keys2[undefkey.to_s] = None
+ else
+ # remove key
+ end
else
- configure name, args[0]
+ keys2[k.to_s] = v
end
- when 0
- begin
- cget(name)
- rescue
- fail NameError,
- "undefined local variable or method `#{name}' for #{self.to_s}",
- error_at
- end
- else
- fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
- end
+ }
+ keys2
end
- def [](id)
- cget(id)
+ def config_hash_kv(keys, enc_mode = nil, conf = nil)
+ hash_kv(__conv_keyonly_opts(keys), enc_mode, conf)
end
- def []=(id, val)
- configure(id, val)
- val
- end
+ ################################
def cget(slot)
- case slot.to_s
- when 'text', 'label', 'show', 'data', 'file'
- #tk_call(path, 'cget', "-#{slot}")
- _fromUTF8(tk_call_without_enc(path, 'cget', "-#{slot}"))
- when 'font', 'kanjifont'
- #fnt = tk_tcl2ruby(tk_call(path, 'cget', "-#{slot}"))
- #fnt = tk_tcl2ruby(tk_call(path, 'cget', "-font"))
- fnt = tk_tcl2ruby(tk_call_without_enc(path, 'cget', "-font"), true)
+ slot = slot.to_s
+
+ if ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
+ return self.__send__(method)
+ end
+
+ case slot
+ when /^(#{__numval_optkeys.join('|')})$/
+ begin
+ number(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
+ rescue
+ nil
+ end
+
+ when /^(#{__numstrval_optkeys.join('|')})$/
+ num_or_str(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
+
+ when /^(#{__boolval_optkeys.join('|')})$/
+ begin
+ bool(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
+ rescue
+ nil
+ end
+
+ when /^(#{__listval_optkeys.join('|')})$/
+ simplelist(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
+
+ when /^(#{__numlistval_optkeys.join('|')})$/
+ conf = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
+ if conf =~ /^[0-9+-]/
+ list(conf)
+ else
+ conf
+ end
+
+ when /^(#{__strval_optkeys.join('|')})$/
+ _fromUTF8(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
+
+ when /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/
+ fontcode = $1
+ fontkey = $2
+ fnt = tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{fontkey}")), true)
unless fnt.kind_of?(TkFont)
- fnt = fontobj(fnt)
+ fnt = fontobj(fontkey)
end
- if slot == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ if fontcode == 'kanji' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
# obsolete; just for compatibility
fnt.kanji_font
else
fnt
end
+
else
- tk_tcl2ruby(tk_call_without_enc(path, 'cget', "-#{slot}"), true)
+ tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{slot}")), true)
end
end
def configure(slot, value=None)
if slot.kind_of? Hash
- if (slot['font'] || slot[:font] ||
- slot['kanjifont'] || slot[:kanjifont] ||
- slot['latinfont'] || slot[:latinfont] ||
- slot['asciifont'] || slot[:asciifont] )
+ slot = _symbolkey2str(slot)
+
+ __methodcall_optkeys.each{|key, method|
+ value = slot.delete(key.to_s)
+ self.__send__(method, value) if value
+ }
+
+ __keyonly_optkeys.each{|defkey, undefkey|
+ conf = slot.find{|kk, vv| kk == defkey.to_s}
+ if conf
+ k, v = conf
+ if v
+ slot[k] = None
+ else
+ slot[undefkey.to_s] = None if undefkey
+ slot.delete(k)
+ end
+ end
+ }
+
+ if (slot.find{|k, v| k =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/})
font_configure(slot)
elsif slot.size > 0
- tk_call(path, 'configure', *hash_kv(slot))
+ tk_call(*(__config_cmd.concat(hash_kv(slot))))
end
else
- if (slot == 'font' || slot == :font ||
- slot == 'kanjifont' || slot == :kanjifont ||
- slot == 'latinfont' || slot == :latinfont ||
- slot == 'asciifont' || slot == :asciifont )
+ slot = slot.to_s
+ if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
+ defkey, undefkey = conf
+ if value
+ tk_call(*(__config_cmd << "-#{defkey}"))
+ elsif undefkey
+ tk_call(*(__config_cmd << "-#{undefkey}"))
+ end
+ elsif ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
+ self.__send__(method, value)
+ elsif (slot =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
if value == None
- fontobj
+ fontobj($2)
else
font_configure({slot=>value})
end
else
- tk_call(path, 'configure', "-#{slot}", value)
+ tk_call(*(__config_cmd << "-#{slot}" << value))
end
end
self
@@ -2174,110 +2418,528 @@ class TkObject<TkKernel
def configinfo(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
- if slot == 'font' || slot == :font ||
- slot == 'kanjifont' || slot == :kanjifont
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('configure', "-#{slot}")))
- conf[0] = conf[0][1..-1]
- conf[4] = fontobj(conf[4])
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
+ fontkey = $2
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{fontkey}"))))
+ conf[__configinfo_struct[:key]] =
+ conf[__configinfo_struct[:key]][1..-1]
+ if ( ! __configinfo_struct[:alias] \
+ || conf.size > __configinfo_struct[:alias] + 1 )
+ conf[__configinfo_struct[:current_value]] = fontobj(fontkey)
+ elsif ( __configinfo_struct[:alias] \
+ && conf.size == __configinfo_struct[:alias] + 1 \
+ && conf[__configinfo_struct[:alias]][0] == ?- )
+ conf[__configinfo_struct[:alias]] =
+ conf[__configinfo_struct[:alias]][1..-1]
+ end
conf
else
if slot
- case slot.to_s
- when 'text', 'label', 'show', 'data', 'file'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('configure', "-#{slot}")))
+ slot = slot.to_s
+ case slot
+ when /^(#{__methodcall_optkeys.keys.join('|')})$/
+ method = _symbolkey2str(__methodcall_optkeys)[slot]
+ return [slot, '', '', '', self.__send__(method)]
+
+ when /^(#{__numval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]])
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ number(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ number(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__numstrval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]])
+ conf[__configinfo_struct[:default_value]] =
+ num_or_str(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ num_or_str(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__boolval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]])
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ bool(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ bool(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__listval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]])
+ conf[__configinfo_struct[:default_value]] =
+ simplelist(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ simplelist(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__numlistval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] \
+ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:default_value]] =
+ list(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] \
+ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:current_value]] =
+ list(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__strval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('configure', "-#{slot}")))
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+ end
+ conf[__configinfo_struct[:key]] =
+ conf[__configinfo_struct[:key]][1..-1]
+
+ if ( __configinfo_struct[:alias] \
+ && conf.size == __configinfo_struct[:alias] + 1 \
+ && conf[__configinfo_struct[:alias]][0] == ?- )
+ conf[__configinfo_struct[:alias]] =
+ conf[__configinfo_struct[:alias]][1..-1]
end
- conf[0] = conf[0][1..-1]
+
conf
+
else
- ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('configure'))).collect{|conflist|
+ ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__config_cmd))).collect{|conflist|
conf = tk_split_simplelist(conflist)
- conf[0] = conf[0][1..-1]
- case conf[0]
- when 'text', 'label', 'show', 'data', 'file'
+ conf[__configinfo_struct[:key]] =
+ conf[__configinfo_struct[:key]][1..-1]
+
+ case conf[__configinfo_struct[:key]]
+ when /^(#{__strval_optkeys.join('|')})$/
+ # do nothing
+
+ when /^(#{__numval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ number(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ number(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__numstrval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ conf[__configinfo_struct[:default_value]] =
+ num_or_str(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ num_or_str(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__boolval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ bool(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ bool(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__listval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ conf[__configinfo_struct[:default_value]] =
+ simplelist(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ simplelist(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__numlistval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] \
+ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:default_value]] =
+ list(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] \
+ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:current_value]] =
+ list(conf[__configinfo_struct[:current_value]])
+ end
+
else
- if conf[3]
- if conf[3].index('{')
- conf[3] = tk_split_list(conf[3])
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ if conf[__configinfo_struct[:default_value]].index('{')
+ conf[__configinfo_struct[:default_value]] =
+ tk_split_list(conf[__configinfo_struct[:default_value]])
else
- conf[3] = tk_tcl2ruby(conf[3])
+ conf[__configinfo_struct[:default_value]] =
+ tk_tcl2ruby(conf[__configinfo_struct[:default_value]])
end
end
- if conf[4]
- if conf[4].index('{')
- conf[4] = tk_split_list(conf[4])
+ if conf[__configinfo_struct[:current_value]]
+ if conf[__configinfo_struct[:current_value]].index('{')
+ conf[__configinfo_struct[:current_value]] =
+ tk_split_list(conf[__configinfo_struct[:current_value]])
else
- conf[4] = tk_tcl2ruby(conf[4])
+ conf[__configinfo_struct[:current_value]] =
+ tk_tcl2ruby(conf[__configinfo_struct[:current_value]])
end
end
end
- conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+
+ if ( __configinfo_struct[:alias] \
+ && conf.size == __configinfo_struct[:alias] + 1 \
+ && conf[__configinfo_struct[:alias]][0] == ?- )
+ conf[__configinfo_struct[:alias]] =
+ conf[__configinfo_struct[:alias]][1..-1]
+ end
+
conf
}
- fontconf = ret.assoc('font')
- if fontconf
- ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
- fontconf[4] = fontobj(fontconf[4])
- ret.push(fontconf)
- else
- ret
- end
+
+ __font_optkeys.each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret.assoc(optkey)
+ if fontconf && fontconf.size > 2
+ ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
+ fontconf[__configinfo_struct[:current_value]] = fontobj(optkey)
+ ret.push(fontconf)
+ end
+ }
+
+ __methodcall_optkeys.each{|optkey, method|
+ ret << [optkey.to_s, '', '', '', self.__send__(method)]
+ }
+
+ ret
end
end
+
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
- if slot == 'font' || slot == :font ||
- slot == 'kanjifont' || slot == :kanjifont
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('configure', "-#{slot}")))
- key = conf.shift[1..-1]
- conf[3] = fontobj(conf[3])
- { key => conf }
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
+ fontkey = $2
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{fontkey}"))))
+ conf[__configinfo_struct[:key]] =
+ conf[__configinfo_struct[:key]][1..-1]
+
+ if ( ! __configinfo_struct[:alias] \
+ || conf.size > __configinfo_struct[:alias] + 1 )
+ conf[__configinfo_struct[:current_value]] = fontobj(fontkey)
+ { conf.shift => conf }
+ elsif ( __configinfo_struct[:alias] \
+ && conf.size == __configinfo_struct[:alias] + 1 )
+ if conf[__configinfo_struct[:alias]][0] == ?-
+ conf[__configinfo_struct[:alias]] =
+ conf[__configinfo_struct[:alias]][1..-1]
+ end
+ { conf[0] => conf[1] }
+ else
+ { conf.shift => conf }
+ end
else
if slot
- case slot.to_s
- when 'text', 'label', 'show', 'data', 'file'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('configure', "-#{slot}")))
+ slot = slot.to_s
+ case slot
+ when /^(#{__methodcall_optkeys.keys.join('|')})$/
+ method = _symbolkey2str(__methodcall_optkeys)[slot]
+ return {slot => ['', '', '', self.__send__(method)]}
+
+ when /^(#{__numval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ number(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ number(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__numstrval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ conf[__configinfo_struct[:default_value]] =
+ num_or_str(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ num_or_str(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__boolval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ bool(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ bool(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__listval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ conf[__configinfo_struct[:default_value]] =
+ simplelist(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ simplelist(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__numlistval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
+
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] \
+ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:default_value]] =
+ list(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] \
+ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:current_value]] =
+ list(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__strval_optkeys.join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__config_cmd << "-#{slot}"))))
else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('configure', "-#{slot}")))
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc(*(__config_cmd << "-#{slot}"))))
end
- key = conf.shift[1..-1]
- { key => conf }
+ conf[__configinfo_struct[:key]] =
+ conf[__configinfo_struct[:key]][1..-1]
+
+ if ( __configinfo_struct[:alias] \
+ && conf.size == __configinfo_struct[:alias] + 1 )
+ if conf[__configinfo_struct[:alias]][0] == ?-
+ conf[__configinfo_struct[:alias]] =
+ conf[__configinfo_struct[:alias]][1..-1]
+ end
+ { conf[0] => conf[1] }
+ else
+ { conf.shift => conf }
+ end
+
else
ret = {}
- tk_split_simplelist(_fromUTF8(tk_send_without_enc('configure'))).each{|conflist|
+ tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__config_cmd))).each{|conflist|
conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- case key
- when 'text', 'label', 'show', 'data', 'file'
+ conf[__configinfo_struct[:key]] =
+ conf[__configinfo_struct[:key]][1..-1]
+
+ case conf[__configinfo_struct[:key]]
+ when /^(#{__strval_optkeys.join('|')})$/
+ # do nothing
+
+ when /^(#{__numval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ number(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ number(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__numstrval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ conf[__configinfo_struct[:default_value]] =
+ num_or_str(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ num_or_str(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__boolval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ begin
+ conf[__configinfo_struct[:default_value]] =
+ bool(conf[__configinfo_struct[:default_value]])
+ rescue
+ conf[__configinfo_struct[:default_value]] = nil
+ end
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ begin
+ conf[__configinfo_struct[:current_value]] =
+ bool(conf[__configinfo_struct[:current_value]])
+ rescue
+ conf[__configinfo_struct[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__listval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ conf[__configinfo_struct[:default_value]] =
+ simplelist(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] )
+ conf[__configinfo_struct[:current_value]] =
+ simplelist(conf[__configinfo_struct[:current_value]])
+ end
+
+ when /^(#{__numlistval_optkeys.join('|')})$/
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] \
+ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:default_value]] =
+ list(conf[__configinfo_struct[:default_value]])
+ end
+ if ( conf[__configinfo_struct[:current_value]] \
+ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
+ conf[__configinfo_struct[:current_value]] =
+ list(conf[__configinfo_struct[:current_value]])
+ end
+
else
- if conf[2]
- if conf[2].index('{')
- conf[2] = tk_split_list(conf[2])
+ if ( __configinfo_struct[:default_value] \
+ && conf[__configinfo_struct[:default_value]] )
+ if conf[__configinfo_struct[:default_value]].index('{')
+ conf[__configinfo_struct[:default_value]] =
+ tk_split_list(conf[__configinfo_struct[:default_value]])
else
- conf[2] = tk_tcl2ruby(conf[2])
+ conf[__configinfo_struct[:default_value]] =
+ tk_tcl2ruby(conf[__configinfo_struct[:default_value]])
end
end
- if conf[3]
- if conf[3].index('{')
- conf[3] = tk_split_list(conf[3])
+ if conf[__configinfo_struct[:current_value]]
+ if conf[__configinfo_struct[:current_value]].index('{')
+ conf[__configinfo_struct[:current_value]] =
+ tk_split_list(conf[__configinfo_struct[:current_value]])
else
- conf[3] = tk_tcl2ruby(conf[3])
+ conf[__configinfo_struct[:current_value]] =
+ tk_tcl2ruby(conf[__configinfo_struct[:current_value]])
end
end
end
- if conf.size == 1
- ret[key] = conf[0][1..-1] # alias info
+
+ if ( __configinfo_struct[:alias] \
+ && conf.size == __configinfo_struct[:alias] + 1 )
+ if conf[__configinfo_struct[:alias]][0] == ?-
+ conf[__configinfo_struct[:alias]] =
+ conf[__configinfo_struct[:alias]][1..-1]
+ end
+ ret[conf[0]] = conf[1]
else
- ret[key] = conf
+ ret[conf.shift] = conf
end
}
- fontconf = ret['font']
- if fontconf
- ret.delete('font')
- ret.delete('kanjifont')
- fontconf[3] = fontobj(fontconf[3])
- ret['font'] = fontconf
- end
+
+ __font_optkeys.each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret[optkey]
+ if fontconf.kind_of?(Array)
+ ret.delete(optkey)
+ ret.delete('latin' << optkey)
+ ret.delete('ascii' << optkey)
+ ret.delete('kanji' << optkey)
+ fontconf[__configinfo_struct[:current_value]] = fontobj(optkey)
+ ret[optkey] = fontconf
+ end
+ }
+
+ __methodcall_optkeys.each{|optkey, method|
+ ret[optkey.to_s] = ['', '', '', self.__send__(method)]
+ }
+
ret
end
end
@@ -2287,12 +2949,24 @@ class TkObject<TkKernel
def current_configinfo(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- conf = configinfo(slot)
- {conf[0] => conf[4]}
+ org_slot = slot
+ begin
+ conf = configinfo(slot)
+ if ( ! __configinfo_struct[:alias] \
+ || conf.size > __configinfo_struct[:alias] + 1 )
+ return {conf[0] => conf[-1]}
+ end
+ slot = conf[__configinfo_struct[:alias]]
+ end while(org_slot != slot)
+ fail RuntimeError,
+ "there is a configure alias loop about '#{org_slot}'"
else
ret = {}
configinfo().each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
+ if ( ! __configinfo_struct[:alias] \
+ || conf.size > __configinfo_struct[:alias] + 1 )
+ ret[conf[0]] = conf[-1]
+ end
}
ret
end
@@ -2304,6 +2978,67 @@ class TkObject<TkKernel
ret
end
end
+end
+
+class TkObject<TkKernel
+ include Tk
+ include TkConfigMethod
+ include TkBindCore
+
+### --> definition is moved to TkUtil module
+# def path
+# @path
+# end
+
+ def epath
+ @path
+ end
+
+ def to_eval
+ @path
+ end
+
+ def tk_send(cmd, *rest)
+ tk_call(path, cmd, *rest)
+ end
+ def tk_send_without_enc(cmd, *rest)
+ tk_call_without_enc(path, cmd, *rest)
+ end
+ def tk_send_with_enc(cmd, *rest)
+ tk_call_with_enc(path, cmd, *rest)
+ end
+ # private :tk_send, :tk_send_without_enc, :tk_send_with_enc
+
+ def method_missing(id, *args)
+ name = id.id2name
+ case args.length
+ when 1
+ if name[-1] == ?=
+ configure name[0..-2], args[0]
+ else
+ configure name, args[0]
+ end
+ when 0
+ begin
+ cget(name)
+ rescue
+ fail NameError,
+ "undefined local variable or method `#{name}' for #{self.to_s}",
+ error_at
+ end
+ else
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
+ end
+ end
+
+ def [](id)
+ cget(id)
+ end
+
+ def []=(id, val)
+ configure(id, val)
+ val
+ end
def event_generate(context, keys=nil)
if keys
@@ -2337,7 +3072,12 @@ class TkWindow<TkObject
include TkWinfo
extend TkBindCore
+ TkCommandNames = [].freeze
+ ## ==> If TkCommandNames[0] is a string (not a null string),
+ ## assume the string is a Tcl/Tk's create command of the widget class.
WidgetClassName = ''.freeze
+ # WidgetClassNames[WidgetClassName] = self
+ ## ==> If self is a widget class, entry to the WidgetClassNames table.
def self.to_eval
self::WidgetClassName
end
@@ -2375,22 +3115,56 @@ class TkWindow<TkObject
else
p 'create_self has args' if $DEBUG
fontkeys = {}
+ methodkeys = {}
if keys
- ['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
- fontkeys[key] = keys.delete(key) if keys.key?(key)
- }
+ #['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
+ # fontkeys[key] = keys.delete(key) if keys.key?(key)
+ #}
+ __font_optkeys.each{|key|
+ fkey = key.to_s
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+
+ fkey = "kanji#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+
+ fkey = "latin#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+
+ fkey = "ascii#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+ }
+
+ __methodcall_optkeys.each{|key|
+ key = key.to_s
+ methodkeys[key] = keys.delete(key) if keys.key?(key)
+ }
end
if without_creating && keys
- configure(keys)
+ #configure(keys)
+ configure(__conv_keyonly_opts(keys))
else
- create_self(keys)
+ #create_self(keys)
+ create_self(__conv_keyonly_opts(keys))
end
font_configure(fontkeys) unless fontkeys.empty?
+ configure(methodkeys) unless methodkeys.empty?
end
end
- def create_self
- fail RuntimeError, "TkWindow is an abstract class"
+ def create_self(keys)
+ # may need to override
+ begin
+ cmd = self.class::TkCommandNames[0]
+ fail unless (cmd.kind_of?(String) && cmd.length > 0)
+ rescue
+ fail RuntimeError, "class #{self.class} may be an abstract class"
+ end
+
+ if keys and keys != None
+ tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc(cmd, @path)
+ end
end
private :create_self
@@ -2912,3 +3686,11 @@ module Tk
autoload :LIBRARY_PATH, 'tk/variable'
autoload :TCL_PRECISION, 'tk/variable'
end
+
+
+# call setup script for Tk extension libraries (base configuration)
+begin
+ require 'tkextlib/setup.rb'
+rescue LoadError
+ # ignore
+end
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index 0a8251af8b5..e3c29e96ea5 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -63,6 +63,8 @@ autoload :TkImage, 'tk/image'
autoload :TkBitmapImage, 'tk/image'
autoload :TkPhotoImage, 'tk/image'
+autoload :TkItemConfigMethod, 'tk/itemconfig'
+
autoload :TkTreatItemFont, 'tk/itemfont'
autoload :TkKinput, 'tk/kinput'
@@ -150,6 +152,7 @@ autoload :TkToplevel, 'tk/toplevel'
autoload :TkTextWin, 'tk/txtwin_abst'
autoload :TkValidation, 'tk/validation'
+
autoload :TkVariable, 'tk/variable'
autoload :TkVarAccess, 'tk/variable'
@@ -167,9 +170,13 @@ autoload :TkXIM, 'tk/xim'
# sub-module of Tk
module Tk
autoload :Clock, 'tk/clock'
+ autoload :OptionObj, 'tk/optionobj'
autoload :Scrollable, 'tk/scrollable'
autoload :Wm, 'tk/wm'
+ autoload :ValidateConfigure, 'tk/validation'
+ autoload :ItemValidateConfigure, 'tk/validation'
+
autoload :EncodedString, 'tk/encodedstr'
def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index b311db6e20a..17a05c0ce1c 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -7,16 +7,16 @@
#
require 'tk'
require 'tk/canvastag'
-require 'tk/itemfont'
+require 'tk/itemconfig'
require 'tk/scrollable'
-module TkTreatCItemFont
- include TkTreatItemFont
+module TkCanvasItemConfig
+ include TkItemConfigMethod
- ItemCMD = ['itemconfigure'.freeze, TkComm::None].freeze
- def __conf_cmd(idx)
- ItemCMD[idx]
+ def __item_methodcall_optkeys(id)
+ {'coords'=>'coords'}
end
+ private :__item_methodcall_optkeys
def __item_pathname(tagOrId)
if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
@@ -25,12 +25,11 @@ module TkTreatCItemFont
self.path + ';' + tagOrId.to_s
end
end
-
- private :__conf_cmd, :__item_pathname
+ private :__item_pathname
end
class TkCanvas<TkWindow
- include TkTreatCItemFont
+ include TkCanvasItemConfig
include Scrollable
TkCommandNames = ['canvas'.freeze].freeze
@@ -130,6 +129,7 @@ class TkCanvas<TkWindow
tk_split_list(tk_send_without_enc('coords', tagid(tag)))
else
tk_send_without_enc('coords', tagid(tag), *(args.flatten))
+ self
end
end
@@ -217,6 +217,7 @@ class TkCanvas<TkWindow
self
end
+=begin
def itemcget(tagOrId, option)
case option.to_s
when 'dash', 'activedash', 'disableddash'
@@ -453,6 +454,7 @@ class TkCanvas<TkWindow
ret
end
end
+=end
def lower(tag, below=nil)
if below
@@ -523,6 +525,8 @@ end
class TkcItem<TkObject
extend Tk
include TkcTagAccess
+ extend TkItemFontOptkeys
+ extend TkItemConfigOptkeys
CItemTypeName = nil
CItemTypeToClass = {}
@@ -543,6 +547,7 @@ class TkcItem<TkObject
########################################
def self._parse_create_args(args)
fontkeys = {}
+ methodkeys = {}
if args[-1].kind_of? Hash
keys = _symbolkey2str(args.pop)
if args.size == 0
@@ -552,11 +557,30 @@ class TkcItem<TkObject
end
end
- ['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
- fontkeys[key] = keys.delete(key) if keys.key?(key)
+ #['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
+ # fontkeys[key] = keys.delete(key) if keys.key?(key)
+ #}
+ __item_font_optkeys(nil).each{|key|
+ fkey = key.to_s
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+
+ fkey = "kanji#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+
+ fkey = "latin#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+
+ fkey = "ascii#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
- args = args.flatten.concat(hash_kv(keys))
+ __item_methodcall_optkeys(nil).each{|key|
+ key = key.to_s
+ methodkeys[key] = keys.delete(key) if keys.key?(key)
+ }
+
+ #args = args.flatten.concat(hash_kv(keys))
+ args = args.flatten.concat(itemconfig_hash_kv(nil, keys))
else
args = args.flatten
end
@@ -597,6 +621,14 @@ class TkcItem<TkObject
@id
end
+ def exist?
+ if @c.find_withtag(@id)
+ true
+ else
+ false
+ end
+ end
+
def delete
@c.delete @id
CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
index 5a98127f6b7..056bf74c055 100644
--- a/ext/tk/lib/tk/canvastag.rb
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -204,6 +204,14 @@ class TkcTag<TkObject
@id
end
+ def exist?
+ if @c.find_withtag(@id)
+ true
+ else
+ false
+ end
+ end
+
def delete
@c.delete @id
CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index b85c456d41f..4c6c0844b28 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -1,7 +1,17 @@
#
# tk/event.rb - module for event
#
-require 'tk'
+
+unless $LOADED_FEATURES.member?('tk.rb')
+ # change loading order
+
+ $LOADED_FEATURES.delete('tk/event.rb')
+
+ require 'tkutil'
+ require 'tk'
+
+else
+################################################
module TkEvent
class Event < TkUtil::CallbackSubst
@@ -42,7 +52,7 @@ module TkEvent
end
# [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
- key_tbl = [
+ KEY_TBL = [
[ ?#, ?n, :serial ],
[ ?a, ?s, :above ],
[ ?b, ?n, :num ],
@@ -76,7 +86,7 @@ module TkEvent
]
# [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
- proc_tbl = [
+ PROC_TBL = [
[ ?n, TkComm.method(:num_or_str) ],
[ ?s, TkComm.method(:string) ],
[ ?b, TkComm.method(:bool) ],
@@ -106,13 +116,13 @@ 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);
end
- def install_bind(cmd, *args)
+ def install_bind_for_event_class(klass, cmd, *args)
if args.compact.size > 0
args = args.join(' ')
- keys = Event._get_subst_key(args)
+ keys = klass._get_subst_key(args)
if cmd.kind_of?(String)
id = cmd
@@ -120,12 +130,12 @@ module TkEvent
id = install_cmd(cmd)
else
id = install_cmd(proc{|*arg|
- TkUtil.eval_cmd(cmd, *Event.scan_args(keys, arg))
+ TkUtil.eval_cmd(cmd, *klass.scan_args(keys, arg))
})
end
id + ' ' + args
else
- keys, args = Event._get_all_subst_keys
+ keys, args = klass._get_all_subst_keys
if cmd.kind_of?(String)
id = cmd
@@ -133,10 +143,17 @@ module TkEvent
id = install_cmd(cmd)
else
id = install_cmd(proc{|*arg|
- TkUtil.eval_cmd(cmd, Event.new(*Event.scan_args(keys, arg)))
+ TkUtil.eval_cmd(cmd, klass.new(*klass.scan_args(keys, arg)))
})
end
id + ' ' + args
end
end
+
+ def install_bind(cmd, *args)
+ install_bind_for_event_class(Event, cmd, *args)
+ end
+end
+
+################################################
end
diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb
index 9b38531f599..b4c5c792135 100644
--- a/ext/tk/lib/tk/font.rb
+++ b/ext/tk/lib/tk/font.rb
@@ -73,25 +73,18 @@ class TkFont
when 'unix'
ltn = {'family'=>'Helvetica'.freeze,
'size'=>-12, 'weight'=>'bold'.freeze}
- #knj = 'k14'
- #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
- knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
when 'windows'
ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
- knj = 'mincho'
when 'macintosh'
ltn = 'system'
- knj = 'mincho'
else # unknown
ltn = 'Helvetica'
- knj = 'mincho'
end
rescue
ltn = 'Helvetica'
- knj = 'mincho'
end
- knj = ltn
+ knj = ltn.dup
end
DEFAULT_LATIN_FONT_NAME = ltn.freeze
@@ -202,54 +195,74 @@ class TkFont
end
end
- def TkFont.init_widget_font(path, *args)
+ def TkFont.init_widget_font(pathname, *args)
+ win, tag, key = pathname.split(';')
+ key = 'font' unless key
+ path = [win, tag, key].join(';')
+
case (Tk::TK_VERSION)
when /^4\.*/
- conf = tk_split_simplelist(tk_call(*args)).
- find_all{|prop| prop[0..5]=='-font ' || prop[0..10]=='-kanjifont '}.
+ regexp = /^-(|kanji)#{key} /
+
+ conf_list = tk_split_simplelist(tk_call(*args)).
+ find_all{|prop| prop =~ regexp}.
collect{|prop| tk_split_simplelist(prop)}
- if font_inf = conf.assoc('-font')
- ltn = font_inf[4]
- ltn = nil if ltn == []
- else
- #ltn = nil
- raise RuntimeError, "unknown option '-font'"
- end
- if font_inf = conf.assoc('-kanjifont')
- knj = font_inf[4]
- knj = nil if knj == []
- else
- knj = nil
+
+ if conf_list.size == 0
+ raise RuntimeError, "the widget may not support 'font' option"
end
- TkFont.new(ltn, knj).call_font_configure(path, *(args + [{}]))
+
+ args << {}
+
+ ltn_key = "-#{key}"
+ knj_key = "-kanji#{key}"
+
+ ltn_info = conf_list.find{|conf| conf[0] == ltn_key}
+ ltn = ltn_info[-1]
+ ltn = nil if ltn == [] || ltn == ""
+
+ knj_info = conf_list.find{|conf| conf[0] == knj_key}
+ knj = knj_info[-1]
+ knj = nil if knj == [] || knj == ""
+
+ TkFont.new(ltn, knj).call_font_configure([path, key], *args)
when /^8\.*/
- font_prop = tk_split_simplelist(tk_call(*args)).find{|prop|
- prop[0..5] == '-font '
- }
- unless font_prop
- raise RuntimeError, "unknown option '-font'"
+ 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
- fnt = tk_split_simplelist(font_prop)[4]
- if fnt == ""
- TkFont.new(nil, nil).call_font_configure(path, *(args + [{}]))
+
+ args << {}
+
+ optkey = "-#{key}"
+
+ info = conf_list.find{|conf| conf[0] == optkey}
+ fnt = info[-1]
+ fnt = nil if fnt == [] || fnt == ""
+
+ unless fnt
+ TkFont.new(nil, nil).call_font_configure([path, key], *args)
else
begin
compound = tk_split_simplelist(
- Hash[*tk_split_simplelist(tk_call('font', 'configure',
- fnt))].collect{|key,value|
- [key[1..-1], value]
- }.assoc('compound')[1])
+ Hash[*tk_split_simplelist(tk_call('font', 'configure',
+ fnt))].collect{|key,value|
+ [key[1..-1], value]
+ }.assoc('compound')[1])
rescue
compound = []
end
if compound == []
- #TkFont.new(fnt, DEFAULT_KANJI_FONT_NAME) \
- #.call_font_configure(path, *(args + [{}]))
- TkFont.new(fnt).call_font_configure(path, *(args + [{}]))
+ TkFont.new(fnt).call_font_configure([path, key], *args)
else
- TkFont.new(compound[0], compound[1]) \
- .call_font_configure(path, *(args + [{}]))
+ TkFont.new(compound[0],
+ compound[1]).call_font_configure([path, key], *args)
end
end
end
@@ -854,15 +867,16 @@ class TkFont
if self == fobj
begin
if w.include?(';')
- win, tag = w.split(';')
+ win, tag, optkey = w.split(';')
+ optkey = 'font' unless optkey
winobj = tk_tcl2ruby(win)
# winobj.tagfont_configure(tag, {'font'=>@latinfont})
if winobj.kind_of? TkText
- tk_call(win, 'tag', 'configure', tag, '-font', @latinfont)
+ tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
elsif winobj.kind_of? TkCanvas
- tk_call(win, 'itemconfigure', tag, '-font', @latinfont)
+ tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
elsif winobj.kind_of? TkMenu
- tk_call(win, 'entryconfigure', tag, '-font', @latinfont)
+ tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
else
raise RuntimeError, "unknown widget type"
end
@@ -888,15 +902,16 @@ class TkFont
if self == fobj
begin
if w.include?(';')
- win, tag = w.split(';')
+ win, tag, optkey = w.split(';')
+ optkey = 'kanjifont' unless optkey
winobj = tk_tcl2ruby(win)
# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
if winobj.kind_of? TkText
- tk_call(win, 'tag', 'configure', tag, '-kanjifont', @kanjifont)
+ tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
elsif winobj.kind_of? TkCanvas
- tk_call(win, 'itemconfigure', tag, '-kanjifont', @kanjifont)
+ tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
elsif winobj.kind_of? TkMenu
- tk_call(win, 'entryconfigure', tag, '-kanjifont', @latinfont)
+ tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
else
raise RuntimeError, "unknown widget type"
end
@@ -1128,36 +1143,77 @@ class TkFont
end
def call_font_configure(path, *args)
- keys = args.pop.update(@fontslot)
+ if path.kind_of?(Array)
+ # [path, optkey]
+ win, tag = path[0].split(';')
+ optkey = path[1].to_s
+ else
+ win, tag, optkey = path.split(';')
+ end
+
+ fontslot = _symbolkey2str(@fontslot)
+ if optkey && optkey != ""
+ ltn = fontslot.delete('font')
+ knj = fontslot.delete('kanjifont')
+ fontslot[optkey] = ltn if ltn
+ fontslot["kanji#{optkey}"] = knj if knj
+ end
+
+ keys = _symbolkey2str(args.pop).update(fontslot)
args.concat(hash_kv(keys))
tk_call(*args)
- Tk_FontUseTBL[path] = self
+ Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
self
end
def used
ret = []
Tk_FontUseTBL.each{|key,value|
+ next unless self == value
if key.include?(';')
- win, tag = key.split(';')
+ win, tag, optkey = key.split(';')
winobj = tk_tcl2ruby(win)
if winobj.kind_of? TkText
- ret.push([winobj, winobj.tagid2obj(tag)])
+ if optkey
+ ret.push([winobj, winobj.tagid2obj(tag), optkey])
+ else
+ ret.push([winobj, winobj.tagid2obj(tag)])
+ end
elsif winobj.kind_of? TkCanvas
if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
- ret.push([winobj, tagobj])
- elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem
- ret.push([winobj, tagobj])
+ if optkey
+ ret.push([winobj, tagobj, optkey])
+ else
+ ret.push([winobj, tagobj])
+ end
+ elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
+ if optkey
+ ret.push([winobj, tagobj, optkey])
+ else
+ ret.push([winobj, tagobj])
+ end
else
- ret.push([winobj, tag])
+ if optkey
+ ret.push([winobj, tag, optkey])
+ else
+ ret.push([winobj, tag])
+ end
end
elsif winobj.kind_of? TkMenu
- ret.push([winobj, tag])
+ if optkey
+ ret.push([winobj, tag, optkey])
+ else
+ ret.push([winobj, tag])
+ end
else
- ret.push([win, tag])
+ if optkey
+ ret.push([win, tag, optkey])
+ else
+ ret.push([win, tag])
+ end
end
else
- ret.push(tk_tcl2ruby(key)) if value == self
+ ret.push(tk_tcl2ruby(key))
end
}
ret
diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb
new file mode 100644
index 00000000000..b1cc7767488
--- /dev/null
+++ b/ext/tk/lib/tk/itemconfig.rb
@@ -0,0 +1,781 @@
+#
+# tk/itemconfig.rb : control item/tag configuration of widget
+#
+require 'tk'
+require 'tkutil'
+require 'tk/itemfont.rb'
+
+module TkItemConfigOptkeys
+ def __item_numval_optkeys(id)
+ []
+ end
+ private :__item_numval_optkeys
+
+ def __item_numstrval_optkeys(id)
+ []
+ end
+ private :__item_numstrval_optkeys
+
+ def __item_boolval_optkeys(id)
+ []
+ end
+ private :__item_boolval_optkeys
+
+ def __item_strval_optkeys(id)
+ # maybe need to override
+ ['text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile']
+ end
+ private :__item_strval_optkeys
+
+ def __item_listval_optkeys(id)
+ []
+ end
+ private :__item_listval_optkeys
+
+ def __item_numlistval_optkeys(id)
+ # maybe need to override
+ ['dash', 'activedash', 'disableddash']
+ end
+ private :__item_numlistval_optkeys
+
+ def __item_methodcall_optkeys(id) # { key=>method, ... }
+ # maybe need to override
+ # {'coords'=>'coords'}
+ {}
+ end
+ private :__item_methodcall_optkeys
+
+ ################################################
+
+ def __item_keyonly_optkeys(id) # { def_key=>(undef_key|nil), ... }
+ # maybe need to override
+ {}
+ end
+ private :__item_keyonly_optkeys
+
+
+ def __conv_item_keyonly_opts(id, keys)
+ return keys unless keys.kind_of?(Hash)
+ keyonly = __item_keyonly_optkeys(id)
+ keys2 = {}
+ keys.each{|k, v|
+ optkey = keyonly.find{|kk,vv| kk.to_s == k.to_s}
+ if optkey
+ defkey, undefkey = optkey
+ if v
+ keys2[defkey.to_s] = None
+ else
+ keys2[undefkey.to_s] = None
+ end
+ else
+ keys2[k.to_s] = v
+ end
+ }
+ keys2
+ end
+
+ def itemconfig_hash_kv(id, keys, enc_mode = nil, conf = nil)
+ hash_kv(__conv_item_keyonly_opts(id, keys), enc_mode, conf)
+ end
+end
+
+module TkItemConfigMethod
+ include TkUtil
+ include TkTreatItemFont
+ include TkItemConfigOptkeys
+
+ def __item_cget_cmd(id)
+ # maybe need to override
+ [self.path, 'itemcget', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ # maybe need to override
+ [self.path, 'itemconfigure', id]
+ end
+ private :__item_config_cmd
+
+ def __item_configinfo_struct(id)
+ # maybe need to override
+ {:key=>0, :alias=>1, :db_name=>1, :db_class=>2,
+ :default_value=>3, :current_value=>4}
+ end
+ private :__item_configinfo_struct
+
+ ################################################
+
+ def itemcget(tagOrId, option)
+ option = option.to_s
+
+ if ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[option] )
+ return self.__send__(method, tagOrId)
+ end
+
+ case option
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ number(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+ rescue
+ nil
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ num_or_str(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ bool(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+ rescue
+ nil
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ simplelist(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
+ if conf =~ /^[0-9]/
+ list(conf)
+ else
+ conf
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ _fromUTF8(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+
+ when /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/
+ fontcode = $1
+ fontkey = $2
+ fnt = tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{fontkey}")), true)
+ unless fnt.kind_of?(TkFont)
+ fnt = tagfontobj(tagid(tagOrId), fontkey)
+ end
+ if fontcode == 'kanji' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
+ # obsolete; just for compatibility
+ fnt.kanji_font
+ else
+ fnt
+ end
+ else
+ tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")), true)
+ end
+ end
+
+ def itemconfigure(tagOrId, slot, value=None)
+ if slot.kind_of? Hash
+ slot = _symbolkey2str(slot)
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|key, method|
+ value = slot.delete(key.to_s)
+ self.__send__(method, tagOrId, value) if value
+ }
+
+ __item_keyonly_optkeys(tagid(tagOrId)).each{|defkey, undefkey|
+ conf = slot.find{|kk, vv| kk == defkey.to_s}
+ if conf
+ k, v = conf
+ if v
+ slot[k] = None
+ else
+ slot[undefkey.to_s] = None if undefkey
+ slot.delete(k)
+ end
+ end
+ }
+
+ if (slot.find{|k, v| k =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/})
+ tagfont_configure(tagid(tagOrId), slot)
+ elsif slot.size > 0
+ tk_call(*(__item_config_cmd(tagid(tagOrId)).concat(hash_kv(slot))))
+ end
+
+ else
+ slot = slot.to_s
+ if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
+ defkey, undefkey = conf
+ if value
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{defkey}"))
+ elsif undefkey
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
+ end
+ elsif ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot] )
+ self.__send__(method, tagOrId, value)
+ elsif (slot =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ if value == None
+ tagfontobj(tagid(tagOrId), $2)
+ else
+ tagfont_configure(tagid(tagOrId), {slot=>value})
+ end
+ else
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}" << value))
+ end
+ end
+ self
+ end
+
+ def itemconfiginfo(tagOrId, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ fontkey = $2
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ 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 \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ conf
+ else
+ if slot
+ slot = slot.to_s
+ case slot
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
+ return [slot, '', '', '', self.__send__(method, tagOrId)]
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ else
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+ end
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ 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 \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+
+ conf
+
+ else
+ ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)))))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ # do nothing
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ else
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ end
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+ end
+ end
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+
+ conf
+ }
+
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret.assoc(optkey)
+ if fontconf && fontconf.size > 2
+ ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
+ ret.push(fontconf)
+ end
+ }
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
+ ret << [optkey.to_s, '', '', '', self.__send__(method, tagOrId)]
+ }
+
+ ret
+ end
+ end
+
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ fontkey = $2
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = fontobj(tagid(tagOrId), fontkey)
+ { conf.shift => conf }
+ elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ { conf[0] => conf[1] }
+ else
+ { conf.shift => conf }
+ end
+ else
+ if slot
+ slot = slot.to_s
+ case slot
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
+ return {slot => ['', '', '', self.__send__(method, tagOrId)]}
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_stre(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ else
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+ end
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ 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 )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ { conf[0] => conf[1] }
+ else
+ { conf.shift => conf }
+ end
+
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)))))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ # do nothing
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ else
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ end
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+ end
+ end
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ ret[conf[0]] = conf[1]
+ else
+ ret[conf.shift] = conf
+ end
+ }
+
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret[optkey]
+ if fontconf.kind_of?(Array)
+ ret.delete(optkey)
+ ret.delete('latin' << optkey)
+ ret.delete('ascii' << optkey)
+ ret.delete('kanji' << optkey)
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
+ ret[optkey] = fontconf
+ end
+ }
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
+ ret[optkey.to_s] = ['', '', '', self.__send__(method, tagOrId)]
+ }
+
+ ret
+ end
+ end
+ end
+ end
+
+ def current_itemconfiginfo(tagOrId, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ org_slot = slot
+ begin
+ conf = itemconfiginfo(tagOrId, slot)
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ return {conf[0] => conf[-1]}
+ end
+ slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
+ end while(org_slot != slot)
+ fail RuntimeError,
+ "there is a configure alias loop about '#{org_slot}'"
+ else
+ ret = {}
+ itemconfiginfo(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|
+ ret[key] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+end
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
index 6e92fc001c2..f653755b060 100644
--- a/ext/tk/lib/tk/itemfont.rb
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -3,182 +3,294 @@
#
require 'tk'
-module TkTreatItemFont
- def __conf_cmd(idx)
- raise NotImplementedError, "need to define `__conf_cmd'"
+module TkItemFontOptkeys
+ def __item_font_optkeys(id)
+ # maybe need to override
+ ['font']
end
- def __item_pathname(tagOrId)
- raise NotImplementedError, "need to define `__item_pathname'"
+ private :__item_font_optkeys
+end
+
+module TkTreatItemFont
+ include TkItemFontOptkeys
+
+ def __item_pathname(id)
+ # maybe need to override
+ [self.path, id].join(';')
end
- private :__conf_cmd, :__item_pathname
-
- def tagfont_configinfo(tagOrId, name = nil)
- pathname = __item_pathname(tagOrId)
- ret = TkFont.used_on(pathname)
- if ret == nil
-=begin
- if name
- ret = name
- else
- ret = TkFont.init_widget_font(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1), tagOrId)
- end
-=end
- ret = TkFont.init_widget_font(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1), tagOrId)
+ private :__item_pathname
+
+ ################################################
+
+ def tagfont_configinfo(tagOrId, key = nil)
+ optkeys = __item_font_optkeys(tagid(tagOrId))
+ if key && !optkeys.find{|opt| opt.to_s == key.to_s}
+ fail ArgumentError, "unknown font option name `#{key}'"
+ end
+
+ win, tag = __item_pathname(tagid(tagOrId)).split(':')
+
+ if key
+ pathname = [win, tag, key].join(';')
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
+ elsif optkeys.size == 1
+ pathname = [win, tag, optkeys[0]].join(';')
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
+ else
+ fonts = {}
+ optkeys.each{|key|
+ key = key.to_s
+ pathname = [win, tag, key].join(';')
+ fonts[key] =
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
+ }
+ fonts
end
- ret
end
alias tagfontobj tagfont_configinfo
def tagfont_configure(tagOrId, slot)
- pathname = __item_pathname(tagOrId)
+ pathname = __item_pathname(tagid(tagOrId))
+
slot = _symbolkey2str(slot)
- if slot.key?('font')
- fnt = slot.delete('font')
- if fnt.kind_of? TkFont
- return fnt.call_font_configure(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1),
- tagOrId, slot)
- else
- if fnt
- if (slot.key?('kanjifont') ||
- slot.key?('latinfont') ||
- slot.key?('asciifont'))
- fnt = TkFont.new(fnt)
-
- lfnt = slot.delete('latinfont')
- lfnt = slot.delete('asciifont') if slot.key?('asciifont')
- kfnt = slot.delete('kanjifont')
-
- fnt.latin_replace(lfnt) if lfnt
- fnt.kanji_replace(kfnt) if kfnt
- end
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ l_optkey = 'latin' << optkey
+ a_optkey = 'ascii' << optkey
+ k_optkey = 'kanji' << optkey
+
+ if slot.key?(optkey)
+ fnt = slot.delete(optkey)
+ if fnt.kind_of?(TkFont)
+ slot.delete(l_optkey)
+ slot.delete(a_optkey)
+ slot.delete(k_optkey)
+
+ fnt.call_font_configure([pathname, optkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ next
+ else
+ if fnt
+ if (slot.key?(l_optkey) ||
+ slot.key?(a_optkey) ||
+ slot.key?(k_optkey))
+ fnt = TkFont.new(fnt)
- slot['font'] = fnt
- tk_call(self.path, __conf_cmd(0), __conf_cmd(1),
- tagOrId, *hash_kv(slot))
+ lfnt = slot.delete(l_optkey)
+ lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
+ kfnt = slot.delete(k_optkey)
+
+ fnt.latin_replace(lfnt) if lfnt
+ fnt.kanji_replace(kfnt) if kfnt
+
+ fnt.call_font_configure([pathname, optkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ next
+ else
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ end
+ end
+ next
end
- return self
end
- end
- lfnt = slot.delete('latinfont')
- lfnt = slot.delete('asciifont') if slot.key?('asciifont')
- kfnt = slot.delete('kanjifont')
+ lfnt = slot.delete(l_optkey)
+ lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
+ kfnt = slot.delete(k_optkey)
- if lfnt && kfnt
- return TkFont.new(lfnt, kfnt).call_font_configure(pathname, self.path,
- __conf_cmd(0),
- __conf_cmd(1),
- tagOrId, slot)
- end
+ if lfnt && kfnt
+ TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ elsif lfnt
+ latintagfont_configure([lfnt, optkey])
+ elsif kfnt
+ kanjitagfont_configure([kfnt, optkey])
+ end
+ }
- latintagfont_configure(tagOrId, lfnt) if lfnt
- kanjitagfont_configure(tagOrId, kfnt) if kfnt
-
- tk_call(self.path, __conf_cmd(0), __conf_cmd(1),
- tagOrId, *hash_kv(slot)) if slot != {}
+ # configure other (without font) options
+ tk_call(*(__item_config_cmd(tagid(tagOrId)).concat(hash_kv(slot)))) if slot != {}
self
end
def latintagfont_configure(tagOrId, ltn, keys=nil)
- pathname = __item_pathname(tagOrId)
- if (fobj = TkFont.used_on(pathname))
- fobj = TkFont.new(fobj) # create a new TkFont object
- elsif Tk::JAPANIZED_TK
- fobj = tagfontobj(tagOrId) # create a new TkFont object
+ if ltn.kind_of?(Array)
+ key = ltn[1]
+ ltn = ltn[0]
else
- tk_call(self.path, __conf_cmd(0), __conf_cmd(1), tagOrId, '-font', ltn)
- return self
+ key = nil
+ end
+
+ optkeys = __item_font_optkeys(tagid(tagOrId))
+ if key && !optkeys.find{|opt| opt.to_s == key.to_s}
+ fail ArgumentError, "unknown font option name `#{key}'"
end
- if fobj.kind_of?(TkFont)
- if ltn.kind_of? TkFont
- conf = {}
- ltn.latin_configinfo.each{|key,val| conf[key] = val}
- if keys
- fobj.latin_configure(conf.update(keys))
+ win, tag = __item_pathname(tagid(tagOrId)).split(':')
+
+ optkeys = [key] if key
+
+ optkeys.each{|optkey|
+ optkey = optkey.to_s
+
+ pathname = [win, tag, optkey].join(';')
+
+ if (fobj = TkFont.used_on(pathname))
+ fobj = TkFont.new(fobj) # create a new TkFont object
+ elsif Tk::JAPANIZED_TK
+ fobj = fontobj # create a new TkFont object
+ else
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ next
+ end
+
+ if fobj.kind_of?(TkFont)
+ if ltn.kind_of?(TkFont)
+ conf = {}
+ ltn.latin_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.latin_configure(conf.update(keys))
+ else
+ fobj.latin_configure(conf)
+ end
else
- fobj.latin_configure(conf)
+ fobj.latin_replace(ltn)
end
- else
- fobj.latin_replace(ltn)
end
- end
- return fobj.call_font_configure(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1), tagOrId, {})
+ fobj.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {}))
+ }
+ self
end
alias asciitagfont_configure latintagfont_configure
def kanjitagfont_configure(tagOrId, knj, keys=nil)
- pathname = __item_pathname(tagOrId)
- if (fobj = TkFont.used_on(pathname))
- fobj = TkFont.new(fobj) # create a new TkFont object
- elsif Tk::JAPANIZED_TK
- fobj = tagfontobj(tagOrId) # create a new TkFont object
+ if knj.kind_of?(Array)
+ key = knj[1]
+ knj = knj[0]
else
- tk_call(self.path, __conf_cmd(0), __conf_cmd(1), tagOrId, '-font', knj)
- return self
+ key = nil
+ end
+
+ optkeys = __item_font_optkeys(tagid(tagOrId))
+ if key && !optkeys.find{|opt| opt.to_s == key.to_s}
+ fail ArgumentError, "unknown font option name `#{key}'"
end
- if fobj.kind_of?(TkFont)
- if knj.kind_of? TkFont
- conf = {}
- knj.kanji_configinfo.each{|key,val| conf[key] = val}
- if keys
- fobj.kanji_configure(conf.update(keys))
+ win, tag = __item_pathname(tagid(tagOrId)).split(':')
+
+ optkeys = [key] if key
+
+ optkeys.each{|optkey|
+ optkey = optkey.to_s
+
+ pathname = [win, tag, optkey].join(';')
+
+ if (fobj = TkFont.used_on(pathname))
+ fobj = TkFont.new(fobj) # create a new TkFont object
+ elsif Tk::JAPANIZED_TK
+ fobj = fontobj # create a new TkFont object
+ else
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ next
+ end
+
+ if fobj.kind_of?(TkFont)
+ if knj.kind_of?(TkFont)
+ conf = {}
+ knj.kanji_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.kanji_configure(conf.update(keys))
+ else
+ fobj.kanji_configure(conf)
+ end
else
- fobj.kanji_configure(conf)
+ fobj.kanji_replace(knj)
end
- else
- fobj.kanji_replace(knj)
end
- end
- return fobj.call_font_configure(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1), tagOrId, {})
+ fobj.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {}))
+ }
+ self
end
- def tagfont_copy(tagOrId, window, wintag=nil)
- pathname = __item_pathname(tagOrId)
+ def tagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if wintag
- fnt = window.tagfontobj(wintag).dup
+ if winkey
+ fnt = window.tagfontobj(wintag, winkey).dup
+ else
+ fnt = window.tagfontobj(wintag).dup
+ end
else
- fnt = window.fontobj.dup
+ if winkey
+ fnt = window.fontobj(winkey).dup
+ else
+ fnt = window.fontobj.dup
+ end
end
- fnt.call_font_configure(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1), tagOrId, {})
- return self
+
+ if targetkey
+ fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ else
+ fnt.call_font_configure(__item_pathname(tagid(tagOrId)),
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ end
+ self
end
- def latintagfont_copy(tagOrId, window, wintag=nil)
- pathname = __item_pathname(tagOrId)
- tagfontobj(tagOrId).dup.call_font_configure(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1),
- tagOrId, {})
+
+ def latintagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
+ if targetkey
+ fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ else
+ fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)),
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ end
+
if wintag
- tagfontobj(tagOrId).
- latin_replace(window.tagfontobj(wintag).latin_font_id)
+ if winkey
+ fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
+ else
+ fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
+ end
else
- tagfontobj(tagOrId).latin_replace(window.fontobj.latin_font_id)
+ if winkey
+ fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
+ else
+ fontobj.latin_replace(window.fontobj.latin_font_id)
+ end
end
self
end
alias asciitagfont_copy latintagfont_copy
- def kanjitagfont_copy(tagOrId, window, wintag=nil)
- pathname = __item_pathname(tagOrId)
- tagfontobj(tagOrId).dup.call_font_configure(pathname, self.path,
- __conf_cmd(0), __conf_cmd(1),
- tagOrId, {})
+ def kanjifont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
+ if targetkey
+ fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ else
+ fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)),
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ end
+
if wintag
- tagfontobj(tagOrId).
- kanji_replace(window.tagfontobj(wintag).kanji_font_id)
+ if winkey
+ fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
+ else
+ fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
+ end
else
- tagfontobj(tagOrId).kanji_replace(window.fontobj.kanji_font_id)
+ if winkey
+ fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
+ else
+ fontobj.kanji_replace(window.fontobj.kanji_font_id)
+ end
end
self
end
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb
index 611226682ae..799d573b1d5 100644
--- a/ext/tk/lib/tk/listbox.rb
+++ b/ext/tk/lib/tk/listbox.rb
@@ -2,27 +2,21 @@
# tk/listbox.rb : treat listbox widget
#
require 'tk'
+require 'tk/itemconfig'
require 'tk/scrollable'
require 'tk/txtwin_abst'
-module TkTreatListItemFont
- include TkTreatItemFont
+module TkListItemConfig
+ include TkItemConfigMethod
- ItemCMD = ['itemconfigure'.freeze, TkComm::None].freeze
- def __conf_cmd(idx)
- ItemCMD[idx]
+ def __item_listval_optkeys(id)
+ []
end
-
- def __item_pathname(tagOrId)
- self.path + ';' + tagOrId.to_s
- end
-
- private :__conf_cmd, :__item_pathname
+ private :__item_listval_optkeys
end
-
class TkListbox<TkTextWin
- include TkTreatListItemFont
+ include TkListItemConfig
include Scrollable
TkCommandNames = ['listbox'.freeze].freeze
@@ -38,6 +32,10 @@ class TkListbox<TkTextWin
end
private :create_self
+ def tagid(id)
+ id.to_s
+ end
+
def activate(y)
tk_send_without_enc('activate', y)
self
@@ -78,6 +76,7 @@ class TkListbox<TkTextWin
tk_send_without_enc('index', index).to_i
end
+=begin
def itemcget(index, key)
case key.to_s
when 'text', 'label', 'show'
@@ -249,4 +248,5 @@ class TkListbox<TkTextWin
ret
end
end
+=end
end
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index 9c34741b1ba..f5a16cf3cf5 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -2,24 +2,37 @@
# tk/menu.rb : treat menu and menubutton
#
require 'tk'
+require 'tk/itemconfig'
-module TkTreatMenuEntryFont
- include TkTreatItemFont
+module TkMenuEntryConfig
+ include TkItemConfigMethod
- ItemCMD = ['entryconfigure'.freeze, TkComm::None].freeze
- def __conf_cmd(idx)
- ItemCMD[idx]
+ def __item_cget_cmd(id)
+ [self.path, 'entrycget', id]
end
-
- def __item_pathname(tagOrId)
- self.path + ';' + tagOrId.to_s
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'entryconfigure', id]
+ end
+ private :__item_config_cmd
+
+ def __item_listval_optkeys(id)
+ []
end
+ private :__item_listval_optkeys
+
+ alias entrycget itemcget
+ alias entryconfigure itemconfigure
+ alias entryconfiginfo itemconfiginfo
+ alias current_entryconfiginfo current_itemconfiginfo
- private :__conf_cmd, :__item_pathname
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
end
class TkMenu<TkWindow
- include TkTreatMenuEntryFont
+ include TkMenuEntryConfig
TkCommandNames = ['menu'.freeze].freeze
WidgetClassName = 'Menu'.freeze
@@ -34,6 +47,10 @@ class TkMenu<TkWindow
end
private :create_self
+ def tagid(id)
+ id.to_s
+ end
+
def activate(index)
tk_send_without_enc('activate', _get_eval_enc_str(index))
self
@@ -116,6 +133,8 @@ class TkMenu<TkWindow
def yposition(index)
number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
end
+
+=begin
def entrycget(index, key)
case key.to_s
when 'text', 'label', 'show'
@@ -287,6 +306,7 @@ class TkMenu<TkWindow
ret
end
end
+=end
end
diff --git a/ext/tk/lib/tk/optionobj.rb b/ext/tk/lib/tk/optionobj.rb
new file mode 100644
index 00000000000..2c8a1efd5e7
--- /dev/null
+++ b/ext/tk/lib/tk/optionobj.rb
@@ -0,0 +1,212 @@
+#
+# tk/optionobj.rb : control options for a group of widgets
+#
+# NOTE: If you want to use key-only option (no value),
+# use Tk::None for the value of the key-only option.
+#
+# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3})
+# => ["-aaa", 1, "-bbb", "-ccc", 3]
+#
+require 'tk'
+
+module Tk
+ class OptionObj < Hash
+ include TkUtil
+
+ def initialize(hash = nil)
+ super()
+ @observ = []
+ update_without_notify(_symbolkey2str(hash)) if hash
+ end
+
+ def observ_info
+ @observ.dup
+ end
+
+ def observs
+ @observ.collect{|win|
+ if win.kind_of?(Array)
+ win[0]
+ else
+ win
+ end
+ }
+ end
+
+ def _remove_win(win)
+ if win.kind_of?(Array)
+ widget, method = win
+ @observ.delete_if{|x|
+ if x.kind_of?(Array)
+ x[0] == widget
+ else
+ x == widget
+ end
+ }
+ else
+ @observ.delete_if{|x|
+ if x.kind_of?(Array)
+ x[0] == win
+ else
+ x == win
+ end
+ }
+ end
+ end
+ private :_remove_win
+
+ def assign(*wins)
+ # win :=
+ # widget #==> call widget.configure(hash)
+ # [widget] #==> call widget.configure(hash)
+ # [widget, nil, {src=>target, ... }]
+ # #==> call widget.configure(hash)
+ # with converting hash-key
+ # [widget, method] #==> call widget.method(hash)
+ # [widget, method, {src=>target, ... }]
+ # #==> call widget.method(hash)
+ # with converting hash-key
+ # [widget [receiver, method, arg, ... ]]
+ # #==> call receiver.method(arg, ... , hash)
+ # [widget [receiver, method, arg, ... ], {src=>target, ... }]
+ # #==> call receiver.method(arg, ... , hash)
+ # with onverting hash-key
+ #
+ # src := option_name_on_optobj
+ #
+ # target :=
+ # nil #==> not use the src
+ # option_name_on_target_widget
+ # [ option_name_on_target_widget, ... ]
+ # #==> set all of them
+ #
+ wins.each{|win|
+ _remove_win(win)
+ @observ << win
+ notify(win)
+ }
+ self
+ end
+
+ def unassign(*wins)
+ wins.each{|win|
+ _remove_win(win)
+ }
+ self
+ end
+
+ def notify(target = nil)
+ if target
+ targets = [target]
+ elsif @observ.empty?
+ return self
+ else
+ targets = @observ.dup
+ end
+
+ return self if empty?
+
+ org_hash = _symbolkey2str(self)
+
+ targets.each{|win|
+ widget = receiver = win
+ hash = org_hash
+ begin
+ if win.kind_of?(Array)
+ widget, method, conv_tbl = win
+ receiver = widget
+
+ if conv_tbl
+ hash = {}
+ org_hash.each{|key, val|
+ key = conv_tbl[key] if conv_tbl.key?(key)
+ next unless key
+ if key.kind_of?(Array)
+ key.each{|k| hash[k] = val}
+ else
+ hash[key] = val
+ end
+ }
+ end
+
+ if method.kind_of?(Array)
+ receiver, method, *args = method
+ receiver.__send__(method, *(args << hash))
+ elsif method
+ widget.__send__(method, hash)
+ else
+ widget.configure(hash)
+ end
+
+ else
+ widget.configure(self)
+ end
+ rescue => e
+ if ( ( widget.kind_of?(TkObject) \
+ && widget.respond_to?('exist?') \
+ && ! receiver.exist? ) \
+ || ( receiver.kind_of?(TkObject) \
+ && receiver.respond_to?('exist?') \
+ && ! receiver.exist? ) )
+ @observ.delete(win)
+ else
+ fail e
+ end
+ end
+ }
+
+ self
+ end
+ alias apply notify
+
+ def +(hash)
+ unless hash.kind_of?(Hash)
+ fail ArgumentError, "expect a Hash"
+ end
+ new_obj = self.dup
+ new_obj.update_without_notify(_symbolkey2str(hash))
+ new_obj
+ end
+
+ alias update_without_notify update
+
+ def update(hash)
+ update_without_notify(_symbolkey2str(hash))
+ notify
+ end
+
+ def configure(key, value=nil)
+ if key.kind_of?(Hash)
+ update(key)
+ else
+ store(key,value)
+ end
+ end
+
+ def [](key)
+ super(key.to_s)
+ end
+ alias cget []
+
+ def store(key, val)
+ key = key.to_s
+ super(key, val)
+ notify
+ end
+ def []=(key, val)
+ store(key,val)
+ end
+
+ def replace(hash)
+ super(_symbolkey2str(hash))
+ notify
+ end
+
+ def default(opt)
+ fail RuntimeError, "unknown option `#{opt}'"
+ end
+ private :default
+
+ undef :default=
+ end
+end
diff --git a/ext/tk/lib/tk/package.rb b/ext/tk/lib/tk/package.rb
index 8768bf1c793..dbb0ca33e81 100644
--- a/ext/tk/lib/tk/package.rb
+++ b/ext/tk/lib/tk/package.rb
@@ -18,6 +18,36 @@ module TkPackage
nil
end
+ def if_needed(pkg, ver, *arg, &b)
+ size = arg.size
+
+ if size==0 && !b
+ # proc info
+ procedure(tk_call('package', 'ifneeded', pkg, ver))
+
+ elsif size==0 && b
+ # set proc
+ cmd = proc(&b)
+ tk_call('package', 'ifneeded', pkg, ver, cmd)
+ cmd
+
+ elsif size==1 && !b
+ # set proc
+ cmd = arg[0]
+ if cmd
+ tk_call('package', 'ifneeded', pkg, ver, cmd)
+ cmd
+ else
+ # remove proc
+ tk_call('package', 'ifneeded', pkg, ver, '')
+ nil
+ end
+
+ else
+ fail ArgumentError, 'too many arguments'
+ end
+ end
+
def names
tk_split_simplelist(tk_call('package', 'names'))
end
@@ -25,26 +55,74 @@ module TkPackage
def provide(package, version=nil)
if version
tk_call('package', 'provide', package, version)
+ end
+ if (ret = tk_call('package', 'provide', package)) == ''
nil
else
- tk_call('package', 'provide', package)
+ ret
end
end
def present(package, version=None)
- tk_call('package', 'present', package, version)
+ begin
+ tk_call('package', 'present', package, version)
+ rescue => e
+ fail e.class, 'TkPackage ' << e.message
+ end
end
def present_exact(package, version)
- tk_call('package', 'present', '-exact', package, version)
+ begin
+ tk_call('package', 'present', '-exact', package, version)
+ rescue => e
+ fail e.class, 'TkPackage ' << e.message
+ end
end
def require(package, version=None)
- tk_call('package', 'require', package, version)
+ begin
+ tk_call('package', 'require', package, version)
+ rescue => e
+ fail e.class, 'TkPackage ' << e.message
+ end
end
def require_exact(package, version)
- tk_call('package', 'require', '-exact', package, version)
+ begin
+ tk_call('package', 'require', '-exact', package, version)
+ rescue => e
+ fail e.class, 'TkPackage ' << e.message
+ end
+ end
+
+ def unknown_proc(*arg, &b)
+ size = arg.size
+
+ if size==0 && !b
+ # proc info
+ procedure(tk_call('package', 'unknown'))
+
+ elsif size==0 && b
+ # set proc
+ cmd = proc(&b)
+ tk_call('package', 'unknown', cmd)
+ cmd
+
+ elsif size==1 && !b
+ # set proc
+ cmd = arg[0]
+ if cmd
+ tk_call('package', 'unknown', cmd)
+ cmd
+ else
+ # remove proc
+ tk_call('package', 'unknown', '')
+ nil
+ end
+
+ else
+ fail ArgumentError, 'too many arguments'
+ end
end
def versions(package)
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb
index e591a299ab8..c5f4fdb70c2 100644
--- a/ext/tk/lib/tk/scrollable.rb
+++ b/ext/tk/lib/tk/scrollable.rb
@@ -7,10 +7,15 @@ module Tk
module Scrollable
def xscrollcommand(cmd=Proc.new)
configure_cmd 'xscrollcommand', cmd
+ # Tk.update # avoid scrollbar trouble
+ self
end
def yscrollcommand(cmd=Proc.new)
configure_cmd 'yscrollcommand', cmd
+ # Tk.update # avoid scrollbar trouble
+ self
end
+
def xview(*index)
if index.size == 0
list(tk_send_without_enc('xview'))
@@ -19,6 +24,13 @@ module Tk
self
end
end
+ def xview_moveto(*index)
+ xview('moveto', *index)
+ end
+ def xview_scroll(*index)
+ xview('scroll', *index)
+ end
+
def yview(*index)
if index.size == 0
list(tk_send_without_enc('yview'))
@@ -27,6 +39,13 @@ module Tk
self
end
end
+ def yview_moveto(*index)
+ yview('moveto', *index)
+ end
+ def yview_scroll(*index)
+ yview('scroll', *index)
+ end
+
def xscrollbar(bar=nil)
if bar
@xscrollbar = bar
@@ -34,6 +53,7 @@ module Tk
self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
@xscrollbar.command {|*arg| self.xview(*arg)}
end
+ Tk.update # avoid scrollbar trouble
@xscrollbar
end
def yscrollbar(bar=nil)
@@ -43,6 +63,7 @@ module Tk
self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
@yscrollbar.command {|*arg| self.yview(*arg)}
end
+ Tk.update # avoid scrollbar trouble
@yscrollbar
end
end
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb
index 0ee4423c9a8..8d4d40322d5 100644
--- a/ext/tk/lib/tk/scrollbar.rb
+++ b/ext/tk/lib/tk/scrollbar.rb
@@ -41,6 +41,7 @@ class TkScrollbar<TkWindow
w.yscrollcommand proc{|first, last| self.set(first, last)}
end
}
+ Tk.update # avoid scrollbar trouble
self
end
@@ -52,6 +53,12 @@ class TkScrollbar<TkWindow
fail RuntimeError, "not depend on the assigned_list"
end
+ def configure(*args)
+ ret = super(*args)
+ # Tk.update # avoid scrollbar trouble
+ ret
+ end
+
#def delta(deltax=None, deltay=None)
def delta(deltax, deltay)
number(tk_send_without_enc('delta', deltax, deltay))
diff --git a/ext/tk/lib/tk/scrollbox.rb b/ext/tk/lib/tk/scrollbox.rb
index f0fdece2604..5f304d377f7 100644
--- a/ext/tk/lib/tk/scrollbox.rb
+++ b/ext/tk/lib/tk/scrollbox.rb
@@ -14,10 +14,15 @@ class TkScrollbox<TkListbox
scroll = TkScrollbar.new(@frame)
@path = list.path
+=begin
list.configure 'yscroll', scroll.path+" set"
list.pack 'side'=>'left','fill'=>'both','expand'=>'yes'
scroll.configure 'command', list.path+" yview"
scroll.pack 'side'=>'right','fill'=>'y'
+=end
+ list.yscrollbar(scroll)
+ list.pack('side'=>'left','fill'=>'both','expand'=>'yes')
+ scroll.pack('side'=>'right','fill'=>'y')
delegate('DEFAULT', list)
delegate('foreground', list)
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index be3f8145051..7593b593682 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -4,32 +4,66 @@
# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
require 'tk/itemfont'
+require 'tk/itemconfig'
require 'tk/scrollable'
require 'tk/txtwin_abst'
-module TkTreatTextTagFont
+module TkTextTagConfig
include TkTreatItemFont
+ include TkItemConfigMethod
- ItemCMD = ['tag'.freeze, 'configure'.freeze].freeze
- def __conf_cmd(idx)
- ItemCMD[idx]
+ def __item_cget_cmd(id) # id := [ type, tagOrId ]
+ [self.path, id[0], 'cget', id[1]]
end
+ private :__item_cget_cmd
- def __item_pathname(tagOrId)
- if tagOrId.kind_of?(TkTextTag)
- self.path + ';' + tagOrId.id
- else
- self.path + ';' + tagOrId
+ def __item_config_cmd(id) # id := [ type, tagOrId ]
+ [self.path, id[0], 'configure', id[1]]
+ end
+ private :__item_config_cmd
+
+ def __item_pathname(id)
+ if id.kind_of?(Array)
+ id = tagid(id[1])
end
+ [self.path, id].join(';')
end
+ private :__item_pathname
- private :__conf_cmd, :__item_pathname
-end
+ def tag_cget(tagOrId, option)
+ itemcget(['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)
+ end
+ def current_tag_configinfo(tagOrId, slot=nil)
+ itemconfigure(['tag', tagOrId], slot)
+ end
+
+ def window_cget(tagOrId, option)
+ itemcget(['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)
+ end
+ def current_window_configinfo(tagOrId, slot=nil)
+ itemconfigure(['window', tagOrId], slot)
+ end
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
+end
class TkText<TkTextWin
ItemConfCMD = ['tag'.freeze, 'configure'.freeze].freeze
- include TkTreatTextTagFont
+ #include TkTreatTextTagFont
+ include TkTextTagConfig
include Scrollable
TkCommandNames = ['text'.freeze].freeze
@@ -90,6 +124,18 @@ class TkText<TkTextWin
@tags[name] = obj
end
+ def tagid(tag)
+ if tag.kind_of?(TkTextTag) \
+ || tag.kind_of?(TkTextMark) \
+ || tag.kind_of?(TkTextImage) \
+ || tag.kind_of?(TkTextWindow)
+ tag.id
+ else
+ tag
+ end
+ end
+ private :tagid
+
def tagid2obj(tagid)
if @tags[tagid]
@tags[tagid]
@@ -482,6 +528,7 @@ class TkText<TkTextWin
_bindinfo([@path, 'tag', 'bind', tag], context)
end
+=begin
def tag_cget(tag, key)
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
@@ -655,6 +702,7 @@ class TkText<TkTextWin
ret
end
end
+=end
def tag_raise(tag, above=None)
tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag),
@@ -698,6 +746,7 @@ class TkText<TkTextWin
_get_eval_enc_str(last)))
end
+=begin
def window_cget(index, slot)
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
@@ -732,7 +781,7 @@ class TkText<TkTextWin
if slot['create']
p_create = slot['create']
if p_create.kind_of? Proc
-=begin
+#=begin
slot['create'] = install_cmd(proc{
id = p_create.call
if id.kind_of?(TkWindow)
@@ -741,7 +790,7 @@ class TkText<TkTextWin
id
end
})
-=end
+#=end
slot['create'] = install_cmd(proc{_epath(p_create.call)})
end
end
@@ -757,7 +806,7 @@ class TkText<TkTextWin
if slot == 'create' || slot == :create
p_create = value
if p_create.kind_of? Proc
-=begin
+#=begin
value = install_cmd(proc{
id = p_create.call
if id.kind_of?(TkWindow)
@@ -766,7 +815,7 @@ class TkText<TkTextWin
id
end
})
-=end
+#=end
value = install_cmd(proc{_epath(p_create.call)})
end
end
@@ -879,6 +928,7 @@ class TkText<TkTextWin
ret
end
end
+=end
def window_names
tk_split_simplelist(_fromUTF8(tk_send_without_enc('window', 'names'))).collect{|elt|
diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb
index 8b42df2f0cd..18d52a5bfc3 100644
--- a/ext/tk/lib/tk/textmark.rb
+++ b/ext/tk/lib/tk/textmark.rb
@@ -37,6 +37,14 @@ class TkTextMark<TkObject
@id
end
+ def exist?
+ if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'names'))).find{|id| id == @id } )
+ true
+ else
+ false
+ end
+ end
+
def +(mod)
@id + ' + ' + mod
end
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index 561a027f084..17909bbfcfd 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -49,6 +49,14 @@ class TkTextTag<TkObject
@id
end
+ def exist?
+ if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'names'))).find{|id| id == @id } )
+ true
+ else
+ false
+ end
+ end
+
def first
@id + '.first'
end
@@ -100,6 +108,10 @@ class TkTextTag<TkObject
end
def cget(key)
+ @t.tag_cget @id, key
+ end
+=begin
+ def cget(key)
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, "-#{key}"))
@@ -121,6 +133,7 @@ class TkTextTag<TkObject
@id, "-#{key}")))
end
end
+=end
def configure(key, val=None)
@t.tag_configure @id, key, val
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index 70e84e6cbfb..0524a43757b 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -3,7 +3,106 @@
#
require 'tk'
+module Tk
+ module ValidateConfigure
+ def __validation_class_list
+ # maybe need to override
+ []
+ end
+
+ def __get_validate_key2class
+ k2c = {}
+ __validation_class_list.each{|klass|
+ klass._config_keys.each{|key|
+ k2c[key.to_s] = klass
+ }
+ }
+ k2c
+ end
+
+ def configure(slot, value=TkComm::None)
+ key2class = __get_validate_key2class
+
+ if slot.kind_of?(Hash)
+ slot = _symbolkey2str(slot)
+ key2class.each{|key, klass|
+ if slot[key].kind_of?(Array)
+ cmd, *args = slot[key]
+ slot[key] = klass.new(cmd, args.join(' '))
+ elsif slot[key].kind_of? Proc
+ slot[key] = klass.new(slot[key])
+ end
+ }
+ super(slot)
+
+ else
+ slot = slot.to_s
+ if (klass = key2class[slot])
+ if value.kind_of? Array
+ cmd, *args = value
+ value = klass.new(cmd, args.join(' '))
+ elsif value.kind_of? Proc
+ value = klass.new(value)
+ end
+ end
+ super(slot, value)
+ end
+
+ self
+ end
+ end
+
+ module ItemValidateConfigure
+ def __item_validation_class_list(id)
+ # maybe need to override
+ []
+ end
+
+ def __get_item_validate_key2class(id)
+ k2c = {}
+ __item_validation_class_list(id).each{|klass|
+ klass._config_keys.each{|key|
+ k2c[key.to_s] = klass
+ }
+ }
+ end
+
+ def itemconfigure(tagOrId, slot, value=TkComm::None)
+ key2class = __get_item_validate_key2class(tagid(tagOrId))
+
+ if slot.kind_of?(Hash)
+ slot = _symbolkey2str(slot)
+ key2class.each{|key, klass|
+ if slot[key].kind_of?(Array)
+ cmd, *args = slot[key]
+ slot[key] = klass.new(cmd, args.join(' '))
+ elsif slot[key].kind_of? Proc
+ slot[key] = klass.new(slot[key])
+ end
+ }
+ super(slot)
+
+ else
+ slot = slot.to_s
+ if (klass = key2class[slot])
+ if value.kind_of? Array
+ cmd, *args = value
+ value = klass.new(cmd, args.join(' '))
+ elsif value.kind_of? Proc
+ value = klass.new(value)
+ end
+ end
+ super(slot, value)
+ end
+
+ self
+ end
+ end
+end
+
module TkValidation
+ include Tk::ValidateConfigure
+
class ValidateCmd
include TkComm
@@ -18,7 +117,7 @@ module TkValidation
end
class ValidateArgs < TkUtil::CallbackSubst
- key_tbl = [
+ KEY_TBL = [
[ ?d, ?n, :action ],
[ ?i, ?x, :index ],
[ ?s, ?e, :current ],
@@ -30,7 +129,7 @@ module TkValidation
nil
]
- proc_tbl = [
+ PROC_TBL = [
[ ?n, TkComm.method(:number) ],
[ ?s, TkComm.method(:string) ],
[ ?w, TkComm.method(:window) ],
@@ -58,24 +157,31 @@ module TkValidation
nil
]
- _setup_subst_table(key_tbl, proc_tbl);
+ _setup_subst_table(KEY_TBL, PROC_TBL);
end
- def initialize(cmd = Proc.new, *args)
+ ##############################
+
+ def self._config_keys
+ # array of config-option key (string or symbol)
+ ['vcmd', 'validatecommand', 'invcmd', 'invalidcommand']
+ end
+
+ def _initialize_for_cb_class(klass, cmd = Proc.new, *args)
if args.compact.size > 0
args = args.join(' ')
- keys = ValidateArgs._get_subst_key(args)
+ keys = klass._get_subst_key(args)
if cmd.kind_of?(String)
id = cmd
elsif cmd.kind_of?(TkCallbackEntry)
@id = install_cmd(cmd)
else
@id = install_cmd(proc{|*arg|
- (cmd.call(*ValidateArgs.scan_args(keys, arg)))? '1':'0'
+ (cmd.call(*klass.scan_args(keys, arg)))? '1':'0'
}) + ' ' + args
end
else
- keys, args = ValidateArgs._get_all_subst_keys
+ keys, args = klass._get_all_subst_keys
if cmd.kind_of?(String)
id = cmd
elsif cmd.kind_of?(TkCallbackEntry)
@@ -83,13 +189,17 @@ module TkValidation
else
@id = install_cmd(proc{|*arg|
(cmd.call(
- ValidateArgs.new(*ValidateArgs.scan_args(keys,arg)))
+ klass.new(*klass.scan_args(keys,arg)))
)? '1': '0'
}) + ' ' + args
end
end
end
+ def initialize(cmd = Proc.new, *args)
+ _initialize_for_cb_class(ValidateArgs, cmd, *args)
+ end
+
def to_eval
@id
end
@@ -97,49 +207,8 @@ module TkValidation
#####################################
- def configure(slot, value=TkComm::None)
- if slot.kind_of? Hash
- slot = _symbolkey2str(slot)
- if slot['vcmd'].kind_of? Array
- cmd, *args = slot['vcmd']
- slot['vcmd'] = ValidateCmd.new(cmd, args.join(' '))
- elsif slot['vcmd'].kind_of? Proc
- slot['vcmd'] = ValidateCmd.new(slot['vcmd'])
- end
- if slot['validatecommand'].kind_of? Array
- cmd, *args = slot['validatecommand']
- slot['validatecommand'] = ValidateCmd.new(cmd, args.join(' '))
- elsif slot['validatecommand'].kind_of? Proc
- slot['validatecommand'] = ValidateCmd.new(slot['validatecommand'])
- end
- if slot['invcmd'].kind_of? Array
- cmd, *args = slot['invcmd']
- slot['invcmd'] = ValidateCmd.new(cmd, args.join(' '))
- elsif slot['invcmd'].kind_of? Proc
- slot['invcmd'] = ValidateCmd.new(slot['invcmd'])
- end
- if slot['invalidcommand'].kind_of? Array
- cmd, *args = slot['invalidcommand']
- slot['invalidcommand'] = ValidateCmd.new(cmd, args.join(' '))
- elsif slot['invalidcommand'].kind_of? Proc
- slot['invalidcommand'] = ValidateCmd.new(slot['invalidcommand'])
- end
- super(slot)
- else
- if (slot == 'vcmd' || slot == :vcmd ||
- slot == 'validatecommand' || slot == :validatecommand ||
- slot == 'invcmd' || slot == :invcmd ||
- slot == 'invalidcommand' || slot == :invalidcommand)
- if value.kind_of? Array
- cmd, *args = value
- value = ValidateCmd.new(cmd, args.join(' '))
- elsif value.kind_of? Proc
- value = ValidateCmd.new(value)
- end
- end
- super(slot, value)
- end
- self
+ def __validation_class_list
+ super << ValidateCmd
end
def validatecommand(cmd = Proc.new, args = nil)
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index 43baac458dd..61d6e8a410d 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -84,6 +84,14 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
end
end
+ def self.new_hash(val = {})
+ if val.kind_of?(Hash)
+ self.new(val)
+ else
+ fail ArgumentError, 'Hash is expected'
+ end
+ end
+
def initialize(val="")
# @id = Tk_VARIABLE_ID.join('')
@id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
@@ -103,6 +111,12 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
INTERP._invoke_without_enc('global', @id)
#INTERP._invoke('global', @id)
+ # create and init
+ if val.kind_of?(Hash)
+ # assoc-array variable
+ self[''] = 0
+ self.clear
+ end
self.value = val
=begin
@@ -185,7 +199,7 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
def is_hash?
#ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
- ITNERP._invoke_without_enc('array', 'exist', @id) == '1'
+ INTERP._invoke_without_enc('array', 'exist', @id) == '1'
end
def is_scalar?
@@ -197,7 +211,23 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
fail RuntimeError, 'cannot get keys from a scalar variable'
end
#tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
- tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))
+ tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id)))
+ end
+
+ def clear
+ if (is_scalar?)
+ fail RuntimeError, 'cannot clear a scalar variable'
+ end
+ keys.each{|k| unset(k)}
+ self
+ end
+
+ def update(hash)
+ if (is_scalar?)
+ fail RuntimeError, 'cannot update a scalar variable'
+ end
+ hash.each{|k,v| self[k] = v}
+ self
end
@@ -222,10 +252,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
def value=(val)
if val.kind_of?(Hash)
+ self.clear
val.each{|k, v|
#INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
# _toUTF8(_get_eval_string(v)))
- INTERP._set_global_var2(@id, __get_eval_string(k, true),
+ INTERP._set_global_var2(@id, _get_eval_string(k, true),
_get_eval_string(v, true))
}
self.value
@@ -260,7 +291,7 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
def unset(elem=nil)
if elem
- INTERP._unset_global_var2(@id, tk_tcl2ruby(elem))
+ INTERP._unset_global_var2(@id, _get_eval_string(elem, true))
else
INTERP._unset_global_var(@id)
end
@@ -359,7 +390,7 @@ else
def unset(elem=nil)
if elem
INTERP._eval(Kernel.format('global %s; unset %s(%s)',
- @id, @id, tk_tcl2ruby(elem)))
+ @id, @id, _get_eval_string(elem)))
#INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
#INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
else
@@ -387,6 +418,29 @@ end
val
end
+ def bool
+ # see Tcl_GetBoolean man-page
+ case value.downcase
+ when '0', 'false', 'no', 'off'
+ false
+ else
+ true
+ end
+ end
+
+ def bool=(val)
+ if ! val
+ self.value = '0'
+ else
+ case val.to_s.downcase
+ when 'false', '0', 'no', 'off'
+ self.value = '0'
+ else
+ self.value = '1'
+ end
+ end
+ end
+
def to_i
number(value).to_i
end
@@ -570,7 +624,8 @@ end
def trace(opts, cmd = Proc.new)
@trace_var = [] if @trace_var == nil
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
@trace_var.unshift([opts,cmd])
if @trace_opts == nil
TkVar_CB_TBL[@id] = self
@@ -619,7 +674,8 @@ end
def trace_element(elem, opts, cmd = Proc.new)
@trace_elem = {} if @trace_elem == nil
@trace_elem[elem] = [] if @trace_elem[elem] == nil
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
@trace_elem[elem].unshift([opts,cmd])
if @trace_opts == nil
TkVar_CB_TBL[@id] = self
@@ -678,7 +734,8 @@ end
def trace_vdelete(opts,cmd)
return self unless @trace_var.kind_of? Array
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
idx = -1
newopts = ''
@trace_var.each_with_index{|e,i|
@@ -702,7 +759,8 @@ end
}
}
- newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
if newopts != @trace_opts
Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
@@ -739,7 +797,8 @@ end
def trace_vdelete_for_element(elem,opts,cmd)
return self unless @trace_elem.kind_of? Hash
return self unless @trace_elem[elem].kind_of? Array
- opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ # opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
+ opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
idx = -1
@trace_elem[elem].each_with_index{|e,i|
if idx < 0 && e[0] == opts && e[1] == cmd
@@ -765,7 +824,8 @@ end
}
}
- newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
+ newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
if newopts != @trace_opts
Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
@@ -807,6 +867,15 @@ class TkVarAccess<TkVariable
super(name, *args)
end
+ def self.new_hash(name, *args)
+ return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
+ if args.empty? && INTERP._invoke_without_enc('array', 'exist', name) == '0'
+ self.new(name, {}) # force creating
+ else
+ self.new(name, *args)
+ end
+ end
+
def initialize(varname, val=nil)
@id = varname
TkVar_ID_TBL[@id] = self
@@ -815,6 +884,11 @@ class TkVarAccess<TkVariable
INTERP._invoke_without_enc('global', @id)
if val
+ if val.kind_of?(Hash)
+ # assoc-array variable
+ self[''] = 0
+ self.clear
+ end
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"
#INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
diff --git a/ext/tk/lib/tkextlib/ICONS.rb b/ext/tk/lib/tkextlib/ICONS.rb
new file mode 100644
index 00000000000..84f4204c607
--- /dev/null
+++ b/ext/tk/lib/tkextlib/ICONS.rb
@@ -0,0 +1,16 @@
+#
+# ICONS support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load library
+require File.join(dir, 'icons')
diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb
new file mode 100644
index 00000000000..fe8351fa521
--- /dev/null
+++ b/ext/tk/lib/tkextlib/ICONS/icons.rb
@@ -0,0 +1,84 @@
+#
+# tkextlib/ICONS/icons.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('icons', '1.0')
+TkPackage.require('icons')
+
+module Tk
+ class ICONS < TkImage
+ def self.create(*args) # icon, icon, ..., keys
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ icons = simplelist(tk_call('::icons::icons', 'create',
+ *(hash_kv(keys).concat(args.flatten))))
+ else
+ icons = simplelist(tk_call('::icons::icons', 'create',
+ *(args.flatten)))
+ end
+
+ icons.collect{|icon| self.new(icon, :without_creating=>true)}
+ end
+
+ def self.delete(*icons)
+ return if icons.empty?
+ tk_call('::icons::icons', 'delete', icons)
+ end
+
+ def self.query(*args)
+ if args[-1].kind_of?(Hash)
+ keys = args.pop
+ list(tk_call('::icons::icons', 'query',
+ *(hash_kv(keys).concat(args.flatten))))
+ else
+ list(tk_call('::icons::icons', 'query', *(args.flatten)))
+ end
+ end
+
+ ##########################################
+
+ def self.new(name, keys=nil)
+ Tk_IMGTBL["::icon::#{name}"] || super
+ end
+
+ def initialize(name, keys=nil)
+ if name.kind_of?(String) && name =~ /^::icon::(.+)$/
+ @name = $1
+ @path = name
+ else
+ @name = name.to_s
+ @path = "::icon::#{@name}"
+ end
+ keys = _symbolkey2str(keys)
+ unless keys.delete('without_creating')
+ tk_call('::icons::icons', 'create', *(hash_kv(keys) << @name))
+ end
+ Tk_IMGTBL[@path] = self
+ end
+
+ def name
+ @name
+ end
+
+ def delete
+ Tk_IMGTBL.delete(@path)
+ tk_call('::icons::icons', 'delete', @name)
+ self
+ end
+
+ def query(keys)
+ list(simplelist(tk_call('::icons::icons', 'query',
+ *(hash_kv(keys) << @name))
+ )[0])
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/ICONS/setup.rb b/ext/tk/lib/tkextlib/ICONS/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/ICONS/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
new file mode 100644
index 00000000000..6cc5e156173
--- /dev/null
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -0,0 +1,161 @@
+
+ [ current support status of Tcl/Tk extensions ]
+
+The following list shows *CURRENT* status when this file was modifyed
+at last. If you want to add other Tcl/Tk extensions to the planed list
+(or change its status position), please request them at the ruby-talk,
+ruby-list, or ruby-dev ML. Although we cannot promise to support your
+requests, we'll try to do.
+
+If you want to check that wrapper libraries are ready to use on your
+environment, please execute 'pkg_checker.rb' with no arguments. The
+script may give you some hints about that.
+
+
+ ***** IMPORTANT NOTE **********************************************
+
+ 'support' means that Ruby/Tk's wrapper libraries are released.
+ 'not support' does *NOT* mean that the extension doesn't work
+ on Ruby/Tk.
+
+ Even if the status of the extension is 'not support', you can
+ control the functions/widgets of the extension without wrapper
+ libraries by Tk.tk_call(), Tk.ip_eval(), and so on.
+
+ If you cannot use installed Tcl/Tk extension, please check the
+ followings.
+
+ (1) On your Tcl/Tk, does the extention work?
+
+ (2) Do DLL libraries of the extension exist on DLL load-path?
+ (See also "<ruby archive>/ext/tcltklib/README.ActiveTcl")
+
+ (3) Is the Tcl library directory of the extension included in
+ library search-path of the Tcl interpreter linked Ruby/Tk?
+
+ The check results may request you to do some setup operations
+ before using the extension. If so, then please write the step
+ of setup oprations into the "setup.rb" file in the directory
+ of the wrapper libraries for the extention (It is the wrapper
+ libraries have the standard structure of the libraries in this
+ directory). The "setup" file is required before requiring the
+ Tcl library package (TkPackage.require(<libname>)).
+
+ *******************************************************************
+
+
+===< support with some examples (may be beta quality) >=======================
+
+Tcllib http://sf.net/projects/tcllib
+ ==> tcllib (partial support; Tklib part only)
+
+vu http://tktable.sourceforge.net ==> vu
+
+TkHTML http://www.hwaci.com/sw/tkhtml/index.html ==> tkHTML
+
+
+
+===< support (may be alpha or beta quality) >=================================
+
+TkImg http://sf.net/projects/tkimg ==> tkimg
+
+TkTreeCtrl http://tktreectrl.sourceforge.net/ ==> treectrl
+
+Tile http://tktable.sourceforge.net/tile/ ==> tile
+
+
+
+===< possibly support (not tested; alpha quality) >===========================
+
+TkTrans http://www2.cmp.uea.ac.uk/~fuzz/tktrans/default.html
+ ==> tktrans (win32 only)
+
+TkDND http://sourceforge.net/projects/tkdnd ==> tkDND
+
+ICONS http://www.satisoft.com/tcltk/icons/ ==> ICONS
+
+
+
+===< plan to support (alpha quality libraries may be included) >==============
+
+TclX http://sf.net/projects/tclx * may support Tk part only
+
+IncrTcl http://sf.net/projects/incrTcl * may support Tk part only
+
+IWidgets http://sf.net/projects/incrTcl
+
+TkTable http://sf.net/projects/tktable
+ * see http://www.korus.hu/~fery/ruby/tktable.rb
+
+BWidgets http://sf.net/projects/tcllib
+
+winico http://tktable.sourceforge.net
+
+
+
+===< not determined to supprt or not >========================================
+
+GraphViz http://www.graphviz.org/
+
+BLT http://sourceforge.net/projects/blt
+
+Tix http://tixlibrary.sourceforge.net/
+
+Tkgeomap http://tkgeomap.sourceforge.net/index.html
+
+XBit http://www.geocities.com/~chengye/
+
+TkZinc http://www.tkzinc.org/
+
+Wbc 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/
+
+vfwtcl http://sourceforge.net/projects/avicaptcl
+
+QuickTimeTcl http://hem.fyristorg.com/matben/qt/
+
+ANIGIF http://cardtable.sourceforge.net/tcltk/
+
+IMG_ROTATE http://cardtable.sourceforge.net/tcltk/
+
+TclVfs http://sourceforge.net/projects/tclvfs/
+
+
+
+===< may not support (already exist, out of Ruby/Tk scope, and so on) >=======
+
+TkCon http://sf.net/projects/tkcon
+
+Expect http://sf.net/projects/expect
+
+TclXML http://sf.net/projects/tclxml
+
+TclXSLT http://sf.net/projects/tclxml
+
+TclDOM http://sf.net/projects/tclxml
+
+TclSOAP http://sf.net/projects/tclsoap
+
+Snack http://www.speech.kth.se/~kare/snack2.2.tar.gz
+ * use Snack for Ruby (see http://rbsnack.sourceforge.net/)
+
+Tcom http://www.vex.net/~cthuang/tcom/
+
+tDOM http://www.tdom.org
+
+Mk4tcl http://www.equi4.com/metakit/tcl.html
+
+Memchan http://memchan.sourceforge.net/
+
+
+
+===< tool (may not supprt) >==================================================
+
+tbcload/tclcompiler http://www.tcl.tk/software/tclpro/
+
+
+
+(End of List) \ No newline at end of file
diff --git a/ext/tk/lib/tkextlib/pkg_checker.rb b/ext/tk/lib/tkextlib/pkg_checker.rb
new file mode 100755
index 00000000000..813273e65b9
--- /dev/null
+++ b/ext/tk/lib/tkextlib/pkg_checker.rb
@@ -0,0 +1,129 @@
+#!/usr/bin/env ruby
+#
+# Ruby/Tk extension library checker
+#
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+TkRoot.new.withdraw # hide root window
+
+name = File.basename(__FILE__)
+
+if ARGV[0]
+ dir = File.expand_path(ARGV[0])
+else
+ dir = File.dirname(File.expand_path(__FILE__))
+end
+
+print "\nRuby/Tk extension library checker\n"
+print "( Note:: This check is very simple one. Shown status may be wrong. )\n"
+print "\n check directory :: #{dir}\n"
+
+def get_pkg_list(file)
+ pkg_list = []
+
+ File.foreach(file){|l|
+ if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)TkPackage\s*\.\s*require\s*\(?\s*(["'])((\w|:)+)\1/
+ pkg = [$2, :package]
+ pkg_list << pkg unless pkg_list.member?(pkg)
+ end
+ if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tcllibrary\s*\(?\s*(["'])((\w|:)+)\1/
+ pkg = [$2, :library]
+ pkg_list << pkg unless pkg_list.member?(pkg)
+ end
+ if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tclscript\s*\(?\s*(["'])((\w|:)+)\1/
+ pkg = [$2, :script]
+ pkg_list << pkg unless pkg_list.member?(pkg)
+ end
+ }
+
+ pkg_list
+end
+
+def check_pkg(file)
+ pkg_list = get_pkg_list(file)
+
+ error_list = []
+ success_list = {}
+
+ pkg_list.each{|name, type|
+ next if success_list[name]
+
+ begin
+ case type
+ when :package
+ ver = TkPackage.require(name)
+ success_list[name] = ver
+ error_list.delete_if{|n, t| n == name}
+
+ when :library
+ Tk.load_tcllibrary(name)
+ success_list[name] = :library
+ error_list.delete_if{|n, t| n == name}
+
+ when :script
+ Tk.load_tclscript(name)
+ success_list[name] = :script
+ error_list.delete_if{|n, t| n == name}
+
+ end
+ rescue
+ error_list << [name, type]
+ end
+ }
+
+ success_list.dup.each{|name, ver|
+ unless ver.kind_of?(String)
+ begin
+ ver = TkPackage.require(name)
+ sccess_list[name] = ver
+ rescue
+ end
+ end
+ }
+
+ [success_list, error_list]
+end
+
+def subdir_check(dir)
+ Dir.foreach(dir){|f|
+ next if f == '.' || f == '..'
+ if File.directory?(f)
+ subdir_check(File.join(dir, f))
+ elsif File.extname(f) == '.rb'
+ path = File.join(dir, f)
+ suc, err = check_pkg(path)
+ if err.empty?
+ print 'Ready : ', path, ' : require->', suc.inspect, "\n"
+ else
+ print '*LACK : ', path, ' : require->', suc.inspect,
+ ' FAIL->', err.inspect, "\n"
+ end
+ end
+ }
+end
+
+Dir.chdir(dir)
+
+(Dir['*.rb'] - ['setup.rb', name]).each{|f|
+ subdir = File.basename(f, '.*')
+ begin
+ # read 'setup.rb' as if the library has standard structure
+ require File.join(subdir, 'setup.rb')
+ rescue LoadError
+ # ignore error
+ end
+
+ print "\n"
+
+ suc, err = check_pkg(f)
+ if err.empty?
+ print 'Ready : ', f, ' : require->', suc.inspect, "\n"
+ else
+ print '*LACK : ', f, ' : require->', suc.inspect,
+ ' FAIL->', err.inspect, "\n"
+ end
+
+ subdir_check(subdir) if File.directory?(subdir)
+}
diff --git a/ext/tk/lib/tkextlib/setup.rb b/ext/tk/lib/tkextlib/setup.rb
new file mode 100644
index 00000000000..12867e8f9cd
--- /dev/null
+++ b/ext/tk/lib/tkextlib/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before using Tk extension libraries
+#
+# If you need some setup operations for Tk extensions (for example,
+# modify the dynamic library path) required, please write the setup
+# operations in this file. This file is required at the last of
+# "require 'tk'".
+#
diff --git a/ext/tk/lib/tkextlib/tcllib.rb b/ext/tk/lib/tkextlib/tcllib.rb
new file mode 100644
index 00000000000..56f21556ae0
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib.rb
@@ -0,0 +1,57 @@
+#
+# tcllib extension support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# package:: autoscroll
+#require 'tkextlib/tcllib/autoscroll'
+require File.join(dir, 'autoscroll')
+
+# package:: cursor
+#require 'tkextlib/tcllib/cursor'
+require File.join(dir, 'cursor')
+
+# package:: style
+#require 'tkextlib/tcllib/style'
+require File.join(dir, 'style')
+
+
+# autoload
+module Tk
+ module Tcllib
+ dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+ # package:: ctext
+ #autoload :CText, 'tkextlib/tcllib/ctext'
+ autoload :CText, File.join(dir, 'ctext')
+
+ # package:: datefield
+ #autoload :Datefield, 'tkextlib/tcllib/datefield'
+ #autoload :DateField, 'tkextlib/tcllib/datefield'
+ autoload :Datefield, File.join(dir, 'datefield')
+ autoload :DateField, File.join(dir, 'datefield')
+
+ # package:: ipentry
+ #autoload :IP_Entry, 'tkextlib/tcllib/ip_entry'
+ autoload :IP_Entry, File.join(dir, 'ip_entry')
+
+ # package:: Plotchart
+ #autoload :Plotchart, 'tkextlib/tcllib/plotchart'
+ autoload :Plotchart, File.join(dir, 'plotchart')
+
+ # package:: tkpiechart
+ #autoload :Tkpiechart, 'tkextlib/tcllib/tkpiechart'
+ autoload :Tkpiechart, File.join(dir, 'tkpiechart')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/README b/ext/tk/lib/tkextlib/tcllib/README
new file mode 100644
index 00000000000..953239befa0
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/README
@@ -0,0 +1,135 @@
+
+ [ tcllib extension support files ]
+
+Tcllib includes many utilities. But currently, supports TKLib part
+only (see the following 'tcllib contents').
+
+If you request to support others, please send your message to one of
+ruby-talk/ruby-list/ruby-dev/ruby-ext mailing lists.
+
+-----<from "What is tcllib?">----------------------------
+Tcllib is a collection of utility modules for Tcl. These modules provide
+a wide variety of functionality, from implementations of standard data
+structures to implementations of common networking protocols. The intent
+is to collect commonly used function into a single library, which users
+can rely on to be available and stable.
+---------------------------------------------------------
+
+-----< tcllib contents (based on tcllib-1.6.1) >---------
+Programming tools
+ * cmdline - Procedures to process command lines and options.
+ * comm - A remote communications facility for Tcl (7.6, 8.0, and later)
+ * control - Procedures for control flow structures.
+ * fileutil - Procedures implementing some file utilities
+ * log - Procedures to log messages of libraries and applications.
+ * logger - System to control logging of events.
+ * multiplexer - One-to-many communication with sockets.
+ * snit - Snit's Not Incr Tcl
+ * snitfaq - Snit Frequently Asked Questions
+ * stooop - Object oriented extension.
+ * stoop - Simple Tcl Only Object Oriented Programming
+ * switched - stooop switched class
+ * profiler - Tcl source code profiler
+
+Mathematics
+ * math::statistics - Basic statistical functions and procedures
+ * math::calculus - Integration and ordinary differential equations
+ * math::optimize - Optimisation routines
+ * math::fuzzy - Fuzzy comparison of floating-point numbers
+ * counter - Procedures for counters and histograms
+ * combinatorics - Combinatorial functions in the Tcl Math Library
+
+Data structures
+ * struct::list - Procedures for manipulating lists
+ * struct::set - Procedures for manipulating sets
+ * struct::stack - Create and manipulate stack objects
+ * struct::queue - Create and manipulate queue objects
+ * struct::prioqueue - Create and manipulate prioqueue objects
+ * struct::skiplist - Create and manipulate skiplists
+ * struct::tree - Create and manipulate tree objects
+ * struct::graph - Create and manipulate directed graph objects
+ * struct::record - Define and create records (similar to 'C' structures)
+ * struct::matrix - Create and manipulate matrix objects
+ * struct::pool - Create and manipulate pool objects (of discrete items)
+ * report - Create and manipulate report objects
+
+Text processing
+ * expander - Procedures to process templates and expand text.
+ * base64 - Procedures to encode and decode base64
+ * yencode - encode/decoding a binary file
+ * uuencode - encode/decoding a binary file
+ * csv - Procedures to handle CSV data.
+ * inifile - Parsing of Windows INI files
+ * htmlparse - Procedures to parse HTML strings
+ * mime - Manipulation of MIME body parts
+ * Tcl MIME - generates and parses MIME body parts
+ * textutil - Procedures to manipulate texts and strings.
+ * exif - Tcl EXIF extracts and parses EXIF fields from digital images
+ * EXIF - extract and parse EXIF fields from digital images
+
+Hashes, checksums, and encryption
+ * cksum - calculate a cksum(1) compatible checksum
+ * crc16 - Perform a 16bit Cyclic Redundancy Check
+ * crc32 - Perform a 32bit Cyclic Redundancy Check
+ * des - Perform DES encryption of Tcl data
+ * md4 - MD4 Message-Digest Algorithm
+ * md5 - MD5 Message-Digest Algorithm
+ * ripemd160 - RIPEMD-160 Message-Digest Algorithm
+ * ripemd128 - RIPEMD-128 Message-Digest Algorithm
+ * md5crypt - MD5-based password encryption
+ * sha1 - Perform sha1 hashing
+ * sum - calculate a sum(1) compatible checksum
+ * soundex - Soundex
+
+Documentation tools
+ * mpexpand - Markup processor
+ * doctools - Create and manipulate doctools converter object
+ * doctoc_fmt - Specification of simple tcl markup for table of contents
+ * doctools_api - Interface specification for formatter code
+ * doctools_fmt - Specification of simple tcl markup for manpages
+ * docidx - Create and manipulate docidx converter objects
+ * docidx_api - Interface specification for index formatting code
+ * docidx_fmt - Specification of simple tcl markup for an index
+ * doctoc - Create and manipulate doctoc converter objects
+ * doctoc_api - Interface specification for toc formatting code
+ * doctools::changelog - Handle text in Emacs ChangeLog format
+ * doctools::cvs - Handle text in 'cvs log' format
+
+Networking
+ * uri - URI utilities
+ * dns - Tcl Domain Name Service Client
+ * ntp_time - Tcl Time Service Client
+ * nntp - Tcl client for the NNTP protocol
+ * pop3 - Tcl client for POP3 email protocol
+ * pop3d - Tcl POP3 server implementation
+ * pop3d::udb - Simple user database for pop3d
+ * pop3d::dbox - Simple mailbox database for pop3d
+ * ftp - Client-side tcl implementation of the ftp protocol
+ * ftp - Client-side tcl implementation of the ftp protocol
+ * ftpd - Tcl FTP server implementation
+ * smtp - Client-side tcl implementation of the smtp protocol
+ * smtpd - Tcl SMTP server implementation
+ * irc - Create IRC connection and interface.
+
+CGI programming
+ * ncgi - Procedures to manipulate CGI values.
+ * html - Procedures to generate HTML structures
+ * javascript - Procedures to generate HTML and Java Script structures.
+
+Grammars and finite automata
+ * grammar::fa - Create and manipulate finite automatons
+ * grammar::fa::op - Operations on finite automatons
+ * grammar::dacceptor - Create and use deterministic acceptors
+ * grammar::dexec - Execute deterministic finite automatons
+
+TKLib
+ * Plotchart - Simple plotting and charting package
+ * autoscroll - Provides for a scrollbar to automatically mapped and
+ unmapped as needed
+ * ctext - An extended text widget with customizable Syntax highlighting
+ * cursor - Procedures to handle CURSOR data
+ * datefield - Tk datefield widget
+ * style - Changes default Tk look&feel
+ * ipentry - An IP address entry widget
+ * tkpiechart - Creates and dynamically updates 2D or 3D pie charts
+---------------------------------------------------------
diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
new file mode 100644
index 00000000000..9c161d7ec9a
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb
@@ -0,0 +1,100 @@
+#
+# tkextlib/tcllib/autoscroll.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Provides for a scrollbar to automatically mapped and unmapped as needed
+#
+# (The following is the original description of the library.)
+#
+# This package allows scrollbars to be mapped and unmapped as needed
+# depending on the size and content of the scrollbars scrolled widget.
+# The scrollbar must be managed by either pack or grid, other geometry
+# managers are not supported.
+#
+# When managed by pack, any geometry changes made in the scrollbars parent
+# between the time a scrollbar is unmapped, and when it is mapped will be
+# lost. It is an error to destroy any of the scrollbars siblings while the
+# scrollbar is unmapped. When managed by grid, if anything becomes gridded
+# in the same row and column the scrollbar occupied it will be replaced by
+# the scrollbar when remapped.
+#
+# This package may be used on any scrollbar-like widget as long as it
+# supports the set subcommand in the same style as scrollbar. If the set
+# subcommand is not used then this package will have no effect.
+#
+
+require 'tk'
+require 'tk/scrollbar'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('autoscroll', '1.0')
+TkPackage.require('autoscroll')
+
+module Tk
+ module Scrollable
+ def autoscroll(mode = nil)
+ case mode
+ when :x, 'x'
+ if @xscrollbar
+ tk_send_without_enc('::autoscroll::autoscroll', @xscrollbar)
+ end
+ when :y, 'y'
+ if @yscrollbar
+ tk_send_without_enc('::autoscroll::autoscroll', @yscrollbar)
+ end
+ when nil, :both, 'both'
+ if @xscrollbar
+ tk_send_without_enc('::autoscroll::autoscroll', @xscrollbar)
+ end
+ if @yscrollbar
+ tk_send_without_enc('::autoscroll::autoscroll', @yscrollbar)
+ end
+ else
+ fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected"
+ end
+ self
+ end
+ def unautoscroll(mode = nil)
+ case mode
+ when :x, 'x'
+ if @xscrollbar
+ tk_send_without_enc('::autoscroll::unautoscroll', @xscrollbar)
+ end
+ when :y, 'y'
+ if @yscrollbar
+ tk_send_without_enc('::autoscroll::unautoscroll', @yscrollbar)
+ end
+ when nil, :both, 'both'
+ if @xscrollbar
+ tk_send_without_enc('::autoscroll::unautoscroll', @xscrollbar)
+ end
+ if @yscrollbar
+ tk_send_without_enc('::autoscroll::unautoscroll', @yscrollbar)
+ end
+ else
+ fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected"
+ end
+ self
+ end
+ end
+end
+
+class TkScrollbar
+ def autoscroll
+ # Arranges for the already existing scrollbar to be mapped
+ # and unmapped as needed.
+ tk_send_without_enc('::autoscroll::autoscroll', @path)
+ self
+ end
+ def unautoscroll
+ # Returns the scrollbar to its original static state.
+ tk_send_without_enc('::autoscroll::unautoscroll', @path)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb
new file mode 100644
index 00000000000..6fa3e2edda4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb
@@ -0,0 +1,141 @@
+#
+# tkextlib/tcllib/ctext.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Overloads the text widget and provides new commands
+#
+
+require 'tk'
+require 'tk/text'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('ctext', '3.1')
+TkPackage.require('ctext')
+
+module Tk
+ module Tcllib
+ class CText < TkText
+ end
+ end
+end
+
+class Tk::Tcllib::CText
+ TkCommandNames = ['ctext'.freeze].freeze
+ WidgetClassName = 'Ctext'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('ctext', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('ctext', @path)
+ end
+ end
+ private :create_self
+
+ def append(*args)
+ tk_send('append', *args)
+ end
+
+ def copy
+ tk_send('copy')
+ end
+
+ def cut
+ tk_send('cut')
+ end
+
+ def fast_delete(*args)
+ tk_send('fastdelete', *args)
+ end
+
+ def fast_insert(*args)
+ tk_send('fastinsert', *args)
+ end
+
+ def highlight(*args)
+ tk_send('highlight', *args)
+ end
+
+ def paste
+ tk_send('paste')
+ end
+
+ def edit(*args)
+ tk_send('edit', *args)
+ end
+
+ def add_highlight_class(klass, col, *keywords)
+ tk_call('ctext::addHighlightClass', @path, klass, col, keywords.flatten)
+ self
+ end
+
+ def add_highlight_class_for_special_chars(klass, col, *chrs)
+ tk_call('ctext::addHighlightClassForSpecialChars',
+ @path, klass, col, chrs.join(''))
+ self
+ end
+
+ def add_highlight_class_for_regexp(klass, col, tcl_regexp)
+ tk_call('ctext::addHighlightClassForRegexp',
+ @path, klass, col, tcl_regexp)
+ self
+ end
+
+ def add_highlight_class_with_only_char_start(klass, col, chr)
+ tk_call('ctext::addHighlightClassWithOnlyCharStart',
+ @path, klass, col, chr)
+ self
+ end
+
+ def clear_highlight_classes
+ tk_call('ctext::clearHighlightClasses', @path)
+ self
+ end
+
+ def get_highlight_classes
+ tk_split_simplelist(tk_call('ctext::getHighlightClasses', @path))
+ end
+
+ def delete_highlight_class(klass)
+ tk_call('ctext::deleteHighlightClass', @path, klass)
+ self
+ end
+
+ def enable_C_comments
+ tk_call('ctext::enableComments', @path)
+ self
+ end
+
+ def disable_C_comments
+ tk_call('ctext::disableComments', @path)
+ self
+ end
+
+ def find_next_char(idx, chr)
+ tk_call('ctext::findNextChar', @path, idx, chr)
+ end
+
+ def find_next_space(idx)
+ tk_call('ctext::findNextSpace', @path, idx)
+ end
+
+ def find_previous_space(idx)
+ tk_call('ctext::findPreviousSpace', @path, idx)
+ end
+
+ def set_update_proc(cmd=Proc.new)
+ tk_call('proc', 'ctext::update', '', cmd)
+ self
+ end
+
+ def modified(mode)
+ bool(tk_call('ctext::modified', @path, mode))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/cursor.rb b/ext/tk/lib/tkextlib/tcllib/cursor.rb
new file mode 100644
index 00000000000..cf4f247209a
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/cursor.rb
@@ -0,0 +1,41 @@
+#
+# tkextlib/tcllib/cursor.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Procedures to handle CURSOR data
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('cursor', '0.1')
+TkPackage.require('cursor')
+
+module Tk
+ def self.cursor_display(parent=None)
+ # Pops up a dialog with a listbox containing all the cursor names.
+ # Selecting a cursor name will display it in that dialog.
+ # This is simply for viewing any available cursors on the platform .
+ tk_call_without_enc('::cursor::display', parent)
+ end
+end
+
+class TkWindow
+ def cursor_propagate(cursor)
+ # Sets the cursor for self and all its descendants to cursor.
+ tk_send_without_enc('::cursor::propagate', @path, cursor)
+ end
+ def cursor_restore(cursor = None)
+ # Restore the original or previously set cursor for self and all its
+ # descendants. If cursor is specified, that will be used if on any
+ # widget that did not have a preset cursor (set by a previous call
+ # to TkWindow#cursor_propagate).
+ tk_send_without_enc('::cursor::restore', @path, cursor)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb
new file mode 100644
index 00000000000..6d3ba4693f2
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb
@@ -0,0 +1,50 @@
+#
+# tkextlib/tcllib/datefield.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Tk datefield widget
+#
+# (The following is the original description of the library.)
+#
+# The datefield package provides the datefield widget which is an enhanced
+# text entry widget for the purpose of date entry. Only valid dates of the
+# form MM/DD/YYYY can be entered.
+#
+# The datefield widget is, in fact, just an entry widget with specialized
+# bindings. This means all the command and options for an entry widget apply
+# equally here.
+
+require 'tk'
+require 'tk/entry'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('datefield', '0.1')
+TkPackage.require('datefield')
+
+module Tk
+ module Tcllib
+ class Datefield < TkEntry
+ end
+ DateField = Datefield
+ end
+end
+
+class Tk::Tcllib::Datefield
+ TkCommandNames = ['::datefield::datefield'.freeze].freeze
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('::datefield::datefield', @path,
+ *hash_kv(keys, true))
+ else
+ tk_call_without_enc('::datefield::datefield', @path)
+ end
+ end
+ private :create_self
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
new file mode 100644
index 00000000000..aed47da63a9
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb
@@ -0,0 +1,53 @@
+#
+# tkextlib/tcllib/ip_entry.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * An IP address entry widget
+#
+# (The following is the original description of the library.)
+#
+# This package provides a widget for the entering of a IP address.
+# It guarantees a valid address at all times.
+
+require 'tk'
+require 'tk/entry'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('ipentry', '0.1')
+TkPackage.require('ipentry')
+
+module Tk
+ module Tcllib
+ class IP_Entry < TkEntry
+ end
+ end
+end
+
+class Tk::Tcllib::IP_Entry
+ TkCommandNames = ['::ipentry::ipentry'.freeze].freeze
+ WidgetClassName = 'IPEntry'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('::ipentry::ipentry', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('::ipentry::ipentry', @path)
+ end
+ end
+ private :create_self
+
+ def complete?
+ bool(tk_send_without_enc('complete'))
+ end
+
+ def insert(*ip)
+ tk_send_without_enc('insert', array2tk_list(ip.flatten))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
new file mode 100644
index 00000000000..108507b05bf
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
@@ -0,0 +1,666 @@
+#
+# tkextlib/tcllib/plotchart.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Simple plotting and charting package
+#
+# (The following is the original description of the library.)
+#
+# Plotchart is a Tcl-only package that focuses on the easy creation of
+# xy-plots, barcharts and other common types of graphical presentations.
+# The emphasis is on ease of use, rather than flexibility. The procedures
+# that create a plot use the entire canvas window, making the layout of the
+# plot completely automatic.
+#
+# This results in the creation of an xy-plot in, say, ten lines of code:
+# --------------------------------------------------------------------
+# package require Plotchart
+#
+# canvas .c -background white -width 400 -height 200
+# pack .c -fill both
+#
+# #
+# # Create the plot with its x- and y-axes
+# #
+# set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0 20.0}]
+#
+# foreach {x y} {0.0 32.0 10.0 50.0 25.0 60.0 78.0 11.0 } {
+# $s plot series1 $x $y
+# }
+#
+# $s title "Data series"
+# --------------------------------------------------------------------
+#
+# A drawback of the package might be that it does not do any data management.
+# So if the canvas that holds the plot is to be resized, the whole plot must
+# be redrawn. The advantage, though, is that it offers a number of plot and
+# chart types:
+#
+# * XY-plots like the one shown above with any number of data series.
+# * Stripcharts, a kind of XY-plots where the horizontal axis is adjusted
+# automatically. The result is a kind of sliding window on the data
+# series.
+# * Polar plots, where the coordinates are polar instead of cartesian.
+# * Isometric plots, where the scale of the coordinates in the two
+# directions is always the same, i.e. a circle in world coordinates
+# appears as a circle on the screen.
+# You can zoom in and out, as well as pan with these plots (Note: this
+# works best if no axes are drawn, the zooming and panning routines do
+# not distinguish the axes), using the mouse buttons with the control
+# key and the arrow keys with the control key.
+# * Piecharts, with automatic scaling to indicate the proportions.
+# * Barcharts, with either vertical or horizontal bars, stacked bars or
+# bars side by side.
+# * Timecharts, where bars indicate a time period and milestones or other
+# important moments in time are represented by triangles.
+# * 3D plots (both for displaying surfaces and 3D bars)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('Plotchart', '0.9')
+TkPackage.require('Plotchart')
+
+module Tk
+ module Tcllib
+ module Plotchart
+ end
+ end
+end
+
+module Tk::Tcllib::Plotchart
+ ############################
+ def self.view_port(w, *args) # args := pxmin, pymin, pxmax, pymax
+ tk_call_without_enc('::Plotchart::viewPort', w.path, *(args.flatten))
+ end
+
+ def self.world_coordinates(w, *args) # args := xmin, ymin, xmax, ymax
+ tk_call_without_enc('::Plotchart::worldCoordinates',
+ w.path, *(args.flatten))
+ end
+
+ def self.world_3D_coordinates(w, *args)
+ # args := xmin, ymin, zmin, xmax, ymax, zmax
+ tk_call_without_enc('::Plotchart::world3DCoordinates',
+ w.path, *(args.flatten))
+ end
+
+ def self.coords_to_pixel(w, x, y)
+ list(tk_call_without_enc('::Plotchart::coordsToPixel', w.path, x, y))
+ end
+
+ def self.coords_3D_to_pixel(w, x, y, z)
+ list(tk_call_without_enc('::Plotchart::coords3DToPixel', w.path, x, y, z))
+ end
+
+ def self.polar_coordinates(w, radmax)
+ tk_call_without_enc('::Plotchart::polarCoordinates', w.path, radmax)
+ end
+
+ def self.polar_to_pixel(w, rad, phi)
+ list(tk_call_without_enc('::Plotchart::polarToPixel', w.path, rad, phi))
+ end
+
+ def self.pixel_to_coords(w, x, y)
+ list(tk_call_without_enc('::Plotchart::coordsToPixel', w.path, x, y))
+ end
+
+ def self.determine_scale(w, xmax, ymax)
+ tk_call_without_enc('::Plotchart::determineScale', w.path, xmax, ymax)
+ end
+
+ def self.set_zoom_pan(w)
+ tk_call_without_enc('::Plotchart::setZoomPan', w.path)
+ end
+
+ ############################
+ module ChartMethod
+ include TkUtil
+
+ def title(str)
+ tk_call_without_enc(@chart, 'title', _get_eval_enc_str(str))
+ self
+ end
+
+ def save_plot(filename)
+ tk_call_without_enc(@chart, 'saveplot', filename)
+ self
+ end
+
+ def xtext(str)
+ tk_call_without_enc(@chart, 'xtext', _get_eval_enc_str(str))
+ self
+ end
+
+ def ytext(str)
+ tk_call_without_enc(@chart, 'ytext', _get_eval_enc_str(str))
+ self
+ end
+
+ def xconfig(key, value=None)
+ if key.kind_of?(Hash)
+ tk_call_without_enc(@chart, 'xconfig', *hash_kv(key, true))
+ else
+ tk_call_without_enc(@chart, 'xconfig',
+ "-#{key}", _get_eval_enc_str(value))
+ end
+ self
+ end
+
+ def yconfig(key, value=None)
+ if key.kind_of?(Hash)
+ tk_call_without_enc(@chart, 'yconfig', *hash_kv(key, true))
+ else
+ tk_call_without_enc(@chart, 'yconfig',
+ "-#{key}", _get_eval_enc_str(value))
+ end
+ self
+ end
+
+ ############################
+ def view_port(*args) # args := pxmin, pymin, pxmax, pymax
+ tk_call_without_enc('::Plotchart::viewPort', @path, *(args.flatten))
+ self
+ end
+
+ def world_coordinates(*args) # args := xmin, ymin, xmax, ymax
+ tk_call_without_enc('::Plotchart::worldCoordinates',
+ @path, *(args.flatten))
+ self
+ end
+
+ def world_3D_coordinates(*args)
+ # args := xmin, ymin, zmin, xmax, ymax, zmax
+ tk_call_without_enc('::Plotchart::world3DCoordinates',
+ @path, *(args.flatten))
+ self
+ end
+
+ def coords_to_pixel(x, y)
+ list(tk_call_without_enc('::Plotchart::coordsToPixel', @path, x, y))
+ end
+
+ def coords_3D_to_pixel(x, y, z)
+ list(tk_call_without_enc('::Plotchart::coords3DToPixel', @path, x, y, z))
+ end
+
+ def polar_coordinates(radmax)
+ tk_call_without_enc('::Plotchart::polarCoordinates', @path, radmax)
+ self
+ end
+
+ def polar_to_pixel(rad, phi)
+ list(tk_call_without_enc('::Plotchart::polarToPixel', @path, rad, phi))
+ end
+
+ def pixel_to_coords(x, y)
+ list(tk_call_without_enc('::Plotchart::coordsToPixel', @path, x, y))
+ end
+
+ def determine_scale(xmax, ymax)
+ tk_call_without_enc('::Plotchart::determineScale', @path, xmax, ymax)
+ self
+ end
+
+ def set_zoom_pan()
+ tk_call_without_enc('::Plotchart::setZoomPan', @path)
+ self
+ end
+ end
+
+ ############################
+ class XYPlot < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::createXYPlot'.freeze].freeze
+
+ def initialize(*args) # args := ([parent,] xaxis, yaxis [, keys])
+ # xaxis := Array of [minimum, maximum, stepsize]
+ # yaxis := Array of [minimum, maximum, stepsize]
+ if args[0].kind_of?(Array)
+ @xaxis = args.shift
+ @yaxis = args.shift
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @xaxis = args.shift
+ @yaxis = args.shift
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ array2tk_list(@xaxis), array2tk_list(@yaxis))
+ end
+ private :_create_chart
+
+ def plot(series, x, y)
+ tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series), x, y)
+ self
+ end
+
+ def dataconfig(series, key, value=None)
+ if key.kind_of?(Hash)
+ tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true))
+ else
+ tk_call_without_enc(@chart, 'dataconfig', series,
+ "-#{key}", _get_eval_enc_str(value))
+ end
+ end
+ end
+
+ ############################
+ class Stripchart < XYPlot
+ TkCommandNames = ['::Plotchart::createStripchart'.freeze].freeze
+ end
+
+ ############################
+ class PolarPlot < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::createPolarplot'.freeze].freeze
+
+ def initialize(*args) # args := ([parent,] radius_data [, keys])
+ # radius_data := Array of [maximum_radius, stepsize]
+ if args[0].kind_of?(Array)
+ @radius_data = args.shift
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @radius_data = args.shift
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ array2tk_list(@radius_data))
+ end
+ private :_create_chart
+
+ def plot(series, radius, angle)
+ tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series),
+ radius, angle)
+ self
+ end
+
+ def dataconfig(series, key, value=None)
+ if key.kind_of?(Hash)
+ tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true))
+ else
+ tk_call_without_enc(@chart, 'dataconfig', series,
+ "-#{key}", _get_eval_enc_str(value))
+ end
+ end
+ end
+ Polarplot = PolarPlot
+
+ ############################
+ class IsometricPlot < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::createIsometricPlot'.freeze].freeze
+
+ def initialize(*args) # args := ([parent,] xaxis, yaxis, [, step] [, keys])
+ # xaxis := Array of [minimum, maximum]
+ # yaxis := Array of [minimum, maximum]
+ # step := Float of stepsize | "noaxes" | :noaxes
+ if args[0].kind_of?(Array)
+ @xaxis = args.shift
+ @yaxis = args.shift
+
+ if args[0].kind_of?(Hash)
+ @stepsize = :noaxes
+ else
+ @stepsize = args.shift
+ end
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @xaxis = args.shift
+ @yaxis = args.shift
+
+ if args[0].kind_of?(Hash)
+ @stepsize = :noaxes
+ else
+ @stepsize = args.shift
+ end
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ array2tk_list(@xaxis), array2tk_list(@yaxis),
+ @stepsize)
+ end
+ private :_create_chart
+
+ def plot(type, *args)
+ self.__send__("plot_#{type.to_s.tr('-', '_')}", *args)
+ end
+
+ def plot_rectangle(*args) # args := x1, y1, x2, y2, color
+ tk_call_without_enc(@chart, 'plot', 'rectangle', *(args.flatten))
+ self
+ end
+
+ def plot_filled_rectangle(*args) # args := x1, y1, x2, y2, color
+ tk_call_without_enc(@chart, 'plot', 'filled-rectangle', *(args.flatten))
+ self
+ end
+
+ def plot_circle(*args) # args := xc, yc, radius, color
+ tk_call_without_enc(@chart, 'plot', 'circle', *(args.flatten))
+ self
+ end
+
+ def plot_filled_circle(*args) # args := xc, yc, radius, color
+ tk_call_without_enc(@chart, 'plot', 'filled-circle', *(args.flatten))
+ self
+ end
+ end
+ Isometricplot = IsometricPlot
+
+ ############################
+ class Plot3D < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::create3DPlot'.freeze].freeze
+
+ def initialize(*args) # args := ([parent,] xaxis, yaxis, zaxis [, keys])
+ # xaxis := Array of [minimum, maximum, stepsize]
+ # yaxis := Array of [minimum, maximum, stepsize]
+ # zaxis := Array of [minimum, maximum, stepsize]
+ if args[0].kind_of?(Array)
+ @xaxis = args.shift
+ @yaxis = args.shift
+ @zaxis = args.shift
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @xaxis = args.shift
+ @yaxis = args.shift
+ @zaxis = args.shift
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ array2tk_list(@xaxis),
+ array2tk_list(@yaxis),
+ array2tk_list(@zaxis))
+ end
+ private :_create_chart
+
+ def plot_function(cmd=Proc.new)
+ Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd)} $x $y}")
+ tk_call_without_enc(@chart, 'plotfunc', "#{@path}_#{@chart}")
+ self
+ end
+
+ def grid_size(nxcells, nycells)
+ tk_call_without_enc(@chart, 'gridsize', nxcells, nycells)
+ self
+ end
+
+ def plot_data(dat)
+ # dat has to be provided as a 2 level array.
+ # 1st level contains rows, drawn in y-direction,
+ # and each row is an array whose elements are drawn in x-direction,
+ # for the columns.
+ tk_call_without_enc(@chart, 'plotdata', dat)
+ self
+ end
+
+ def colour(fill, border)
+ # configure the colours to use for polygon borders and inner area
+ tk_call_without_enc(@chart, 'colour', fill, border)
+ self
+ end
+ alias colours colour
+ alias colors colour
+ alias color colour
+ end
+
+ ############################
+ class Piechart < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::createPiechart'.freeze].freeze
+
+ def initialize(*args) # args := ([parent] [, keys])
+ if args[0].kind_of?(TkCanvas)
+ parent = args.shift
+ @path = parent.path
+ else
+ super(*args) # create canvas widget
+ end
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path)
+ end
+ private :_create_chart
+
+ def plot(*dat) # argument is a list of [label, value]
+ tk_call_without_enc(@chart, 'plot', dat.flatten)
+ self
+ end
+ end
+
+ ############################
+ class Barchart < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::createBarchart'.freeze].freeze
+
+ def initialize(*args)
+ # args := ([parent,] xlabels, ylabels [, series] [, keys])
+ # xlabels, ylabels := labels | axis ( depend on normal or horizontal )
+ # labels := Array of [label, label, ...]
+ # (It determines the number of bars that will be plotted per series.)
+ # axis := Array of [minimum, maximum, stepsize]
+ # series := Integer number of data series | 'stacked' | :stacked
+ if args[0].kind_of?(Array)
+ @xlabels = args.shift
+ @ylabels = args.shift
+
+ if args[0].kind_of?(Hash)
+ @series_size = :stacked
+ else
+ @series_size = args.shift
+ end
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @xlabels = args.shift
+ @ylabels = args.shift
+
+ if args[0].kind_of?(Hash)
+ @series_size = :stacked
+ else
+ @series_size = args.shift
+ end
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ array2tk_list(@xlabels), array2tk_list(@ylabels),
+ @series_size)
+ end
+ private :_create_chart
+
+ def plot(series, dat, col=None)
+ tk_call_without_enc(@chart, 'plot', series, dat, col)
+ self
+ end
+
+ def colours(*cols)
+ # set the colours to be used
+ tk_call_without_enc(@chart, 'colours', *cols)
+ self
+ end
+ alias colour colours
+ alias colors colours
+ alias color colours
+ end
+
+ ############################
+ class HorizontalBarchart < Barchart
+ TkCommandNames = ['::Plotchart::createHorizontalBarchart'.freeze].freeze
+ end
+
+ ############################
+ class Timechart < TkCanvas
+ include ChartMethod
+
+ TkCommandNames = ['::Plotchart::createTimechart'.freeze].freeze
+
+ def initialize(*args)
+ # args := ([parent,] time_begin, time_end, items [, keys])
+ # time_begin := String of time format (e.g. "1 january 2004")
+ # time_end := String of time format (e.g. "1 january 2004")
+ # items := Expected/maximum number of items
+ # ( This determines the vertical spacing. )
+ if args[0].kind_of?(Array)
+ @time_begin = args.shift
+ @time_end = args.shift
+ @items = args.shift
+
+ super(*args) # create canvas widget
+ else
+ parent = args.shift
+
+ @time_begin = args.shift
+ @time_end = args.shift
+ @items = args.shift
+
+ if parent.kind_of?(TkCanvas)
+ @path = parent.path
+ else
+ super(parent, *args) # create canvas widget
+ end
+ end
+
+ @chart = _create_chart
+ end
+
+ def _create_chart
+ p self.class::TkCommandNames[0] if $DEBUG
+ tk_call_without_enc(self.class::TkCommandNames[0], @path,
+ @time_begin, @time_end, @items)
+ end
+ private :_create_chart
+
+ def period(txt, time_begin, time_end, col=None)
+ tk_call_without_enc(@chart, 'period', txt, time_begin, time_end, col)
+ self
+ end
+
+ def milestone(txt, time, col=None)
+ tk_call_without_enc(@chart, 'milestone', txt, time, col)
+ self
+ end
+
+ def vertline(txt, time)
+ tk_call_without_enc(@chart, 'vertline', txt, time)
+ self
+ end
+ end
+
+ ############################
+ class PlotSeries < TkObject
+ SeriesID_TBL = TkCore::INTERP.create_table
+ Series_ID = ['series'.freeze, '00000'.taint].freeze
+ TkCore::INTERP.init_ip_env{ SeriesID_TBL.clear }
+
+ def self.id2obj(chart, id)
+ path = chart.path
+ return id unless SeriesID_TBL[path]
+ SeriesID_TBL[path][id]? SeriesID_TBL[path][id]: id
+ end
+
+ def initialize(chart, keys=nil)
+ @parent = @chart_obj = chart
+ @ppath = @chart_obj.path
+ @path = @series = @id = Series_ID.join(TkCore::INTERP._ip_id_)
+ SeriesID_TBL[@id] = self
+ SeriesID_TBL[@ppath] = {} unless SeriesID_TBL[@ppath]
+ SeriesID_TBL[@ppath][@id] = self
+ Series_ID[1].succ!
+ dataconfig(keys) if keys.kind_of?(Hash)
+ end
+
+ def plot(*args)
+ @chart_obj.plot(@series, *args)
+ end
+
+ def dataconfig(key, value=None)
+ @chart_obj.dataconfig(@series, key, value)
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/setup.rb b/ext/tk/lib/tkextlib/tcllib/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/tcllib/style.rb b/ext/tk/lib/tkextlib/tcllib/style.rb
new file mode 100644
index 00000000000..e441cd83b0b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/style.rb
@@ -0,0 +1,30 @@
+#
+# tkextlib/tcllib/style.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * select and use some 'style' of option (resource) DB
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('style', '0.1')
+TkPackage.require('style')
+
+module Tk
+ module Style
+ def self.names
+ tk_split_simplelist(tk_call('style::names'))
+ end
+
+ def self.use(style)
+ tk_call('style::use', style)
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
new file mode 100644
index 00000000000..1ef49ef4f49
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
@@ -0,0 +1,284 @@
+#
+# tkextlib/tcllib/tkpiechart.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# * Part of tcllib extension
+# * Create 2D or 3D pies with labels in Tcl canvases
+#
+
+require 'tk'
+require 'tk/canvas'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('tkpiechart', '6.6')
+TkPackage.require('tkpiechart')
+
+module Tk
+ module Tcllib
+ module Tkpiechart
+ end
+ end
+end
+
+module Tk::Tcllib::Tkpiechart
+ module ConfigMethod
+ include TkConfigMethod
+
+ def __pathname
+ self.path + ';' + self.tag
+ end
+ private :__pathname
+
+ def __cget_cmd
+ ['::switched::cget', self.tag]
+ end
+
+ def __config_cmd
+ ['::switched::configure', self.tag]
+ end
+ private :__config_cmd
+
+ def __configinfo_struct
+ {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
+ :default_value=>1, :current_value=>2}
+ end
+ private :__configinfo_struct
+ end
+
+ ####################################
+ class PieChartObj < TkcItem
+ include ConfigMethod
+
+ def __font_optkeys
+ ['titlefont']
+ end
+ private :__font_optkeys
+ end
+
+ ####################################
+ class Pie < TkcItem
+ include ConfigMethod
+
+ def create_self(x, y, width, height, keys=None)
+ if keys and keys != None
+ @tag_key = tk_call_without_enc('::stooop::new', 'pie',
+ @c, x, y, *hash_kv(keys, true))
+ else
+ @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y)
+ end
+
+ @slice_tbl = {}
+
+ id = "pie(#{@tag_key})"
+
+ @tag = @tag_pie = TkcNamedTag(@c, id)
+ @tag_slices = TkcNamedTag(@c, "pieSlices(#{@tag_key})")
+
+ id
+ end
+ private :create_self
+
+ def tag_key
+ @tag_key
+ end
+ def tag
+ @tag
+ end
+ def canvas
+ @c
+ end
+ def _entry_slice(slice)
+ @slice_tbl[slice.to_eval] = slice
+ end
+ def _delete_slice(slice)
+ @slice_tbl.delete(slice.to_eval)
+ end
+
+ def delete
+ tk_call_without_enc('::stooop::delete', @tag_key)
+ CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
+ self
+ end
+
+ def new_slice(text=None)
+ Slice.new(self, text)
+ end
+
+ def delete_slice(slice)
+ unless slice.kind_of?(Slice)
+ unless (slice = @slice_tbl[slice])
+ return tk_call_without_enc('pie::deleteSlice', @tag_key, slice)
+ end
+ end
+ unless slice.kind_of?(Slice) && slice.pie == self
+ fail ArgumentError, "argument is not a slice of self"
+ end
+ slice.delete
+ end
+
+ def selected_slices
+ tk_split_simplelist(tk_call_without_enc('pie::selectedSlices',
+ @tag_key)).collect{|slice|
+ @slice_tbl[slice] || Slice.new(:no_create, self, slice)
+ }
+ end
+ end
+
+ ####################################
+ class Slice < TkcItem
+ include ConfigMethod
+
+ def __config_cmd
+ ['::switched::configure', self.tag]
+ end
+ private :__config_cmd
+
+ #------------------------
+
+ def initialize(pie, *args)
+ unless pie.kind_of?(Pie) && pie != :no_create
+ fail ArgumentError, "expects TkPiechart::Pie for 1st argument"
+ end
+
+ if pie == :no_create
+ @pie, @tag_key = args
+ else
+ text = args[0] || None
+ @pie = pie
+ @tag_key = tk_call_without_enc('pie::newSlice', @pie.tag_key, text)
+ end
+ @parent = @c = @pie.canvas
+ @path = @parent.path
+
+ @pie._entry_slice(self)
+
+ @id = "slices(#{@tag_key})"
+ @tag = TkcNamedTag.new(@pie.canvas, @id)
+
+ CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
+ CItemID_TBL[@path][@id] = self
+ end
+
+ def tag_key
+ @tag_key
+ end
+ def tag
+ @tag
+ end
+ def pie
+ @pie
+ end
+
+ def delete
+ tk_call_without_enc('pie::deleteSlice', @pie.tag_key, @tag_key)
+ CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
+ @pie._delete_slice(self)
+ self
+ end
+
+ def size(share, disp=None)
+ tk_call_without_enc('pie::sizeSlice',
+ @pie.tag_key, @tag_key, share, disp)
+ self
+ end
+
+ def label(text)
+ tk_call_without_enc('pie::labelSlice', @pie.tag_key, @tag_key, text)
+ self
+ end
+ end
+
+ ####################################
+ class BoxLabeler < TkcItem
+ include ConfigMethod
+
+ def __config_cmd
+ ['::switched::configure', self.tag]
+ end
+ private :__config_cmd
+
+ #------------------------
+
+ def create_self(keys=None)
+ if keys and keys != None
+ @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler',
+ *hash_kv(keys, true))
+ else
+ @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler')
+ end
+
+ id = "pieBoxLabeler(#{@tag_key})"
+ @tag = TkcNamedTag(@c, id)
+
+ id
+ end
+ private :create_self
+ end
+
+ ####################################
+ class PeripheralLabeler < TkcItem
+ include ConfigMethod
+
+ def __font_optkeys
+ ['font', 'smallfont']
+ end
+ private :__font_optkeys
+
+ def __config_cmd
+ ['::switched::configure', self.tag]
+ end
+ private :__config_cmd
+
+ #------------------------
+
+ def create_self(keys=None)
+ if keys and keys != None
+ @tag_key = tk_call_without_enc('::stooop::new',
+ 'piePeripheralLabeler',
+ *hash_kv(keys, true))
+ else
+ @tag_key = tk_call_without_enc('::stooop::new', 'piePeripheralLabeler')
+ end
+
+ id = "piePeripheralLabeler(#{@tag_key})"
+ @tag = TkcNamedTag(@c, id)
+
+ id
+ end
+ private :create_self
+ end
+
+ ####################################
+ class Label < TkcItem
+ include ConfigMethod
+
+ def __config_cmd
+ ['::switched::configure', self.tag]
+ end
+ private :__config_cmd
+
+ #------------------------
+
+ def create_self(x, y, keys=None)
+ if keys and keys != None
+ @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel',
+ @c, x, y, width, height,
+ *hash_kv(keys, true))
+ else
+ @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel',
+ @c, x, y, width, height)
+ end
+
+ id = "canvasLabel(#{@tag_key})"
+ @tag = TkcNamedTag(@c, id)
+
+ id
+ end
+ private :create_self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb
new file mode 100644
index 00000000000..866cdf06442
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile.rb
@@ -0,0 +1,73 @@
+#
+# Tile theme engin (tile widget set) support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load package
+# TkPackage.require('tile', '0.4')
+TkPackage.require('tile')
+
+# autoload
+module Tk
+ module Tile
+ module TileWidget
+ def instate(state, script=nil, &b)
+ if script
+ tk_send('instate', state, script)
+ elsif b
+ tk_send('instate', state, Proc.new(&b))
+ else
+ bool(tk_send('instate', state))
+ end
+ end
+
+ def state(state=nil)
+ if state
+ tk_send('state', state)
+ else
+ list(tk_send('state'))
+ end
+ end
+ end
+
+
+ # library directory
+ dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+ #autoload :TButton, 'tkextlib/tile/tbutton'
+ autoload :TButton, File.join(dir, 'tbutton')
+
+ #autoload :TCheckButton, 'tkextlib/tile/tcheckbutton'
+ #autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton'
+ autoload :TCheckButton, File.join(dir, 'tcheckbutton')
+ autoload :TCheckbutton, File.join(dir, 'tcheckbutton')
+
+ #autoload :TLabel, 'tkextlib/tile/tlabel'
+ autoload :TLabel, File.join(dir, 'tlabel')
+
+ #autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
+ autoload :TMenubutton, File.join(dir, 'tmenubutton')
+
+ #autoload :TNotebook, 'tkextlib/tile/tnotebook'
+ autoload :TNotebook, File.join(dir, 'tnotebook')
+
+ #autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
+ #autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
+ autoload :TRadioButton, File.join(dir, 'tradiobutton')
+ autoload :TRadiobutton, File.join(dir, 'tradiobutton')
+
+ #autoload :Style, 'tkextlib/tile/style'
+ autoload :Style, File.join(dir, 'style')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tile/setup.rb b/ext/tk/lib/tkextlib/tile/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
new file mode 100644
index 00000000000..be4b45ab731
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -0,0 +1,67 @@
+#
+# style commands
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+module Tk::Tile::Style
+end
+
+class << Tk::Tile::Style
+ def default(style, keys=nil)
+ if keys && keys != None
+ tk_call('style', 'default', style, *hash_kv(keys))
+ else
+ tk_call('style', 'default', style)
+ end
+ end
+
+ def map(style, keys=nil)
+ if keys && keys != None
+ tk_call('style', 'map', style, *hash_kv(keys))
+ else
+ tk_call('style', 'map', style)
+ end
+ end
+
+ def layout(style, spec=nil)
+ if spec
+ tk_call('style', 'layout', style, spec)
+ else
+ tk_call('style', 'layout', style)
+ end
+ end
+
+ def element_create(name, type, *args)
+ tk_call('style', 'element', 'create', name, type, *args)
+ end
+
+ def element_names()
+ list(tk_call('style', 'element', 'names'))
+ end
+
+ def theme_create(name, keys=nil)
+ if keys && keys != None
+ tk_call('style', 'theme', 'create', name, type, *hash_kv(keys))
+ else
+ tk_call('style', 'theme', 'create', name, type)
+ end
+ end
+
+ def theme_settings(name, cmd=nil, &b)
+ end
+
+ def theme_names()
+ list(tk_call('style', 'theme', 'names'))
+ end
+
+ def theme_use(name)
+ tk_call('style', 'use', name)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tile/tbutton.rb b/ext/tk/lib/tkextlib/tile/tbutton.rb
new file mode 100644
index 00000000000..c73b7904eda
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -0,0 +1,28 @@
+#
+# tbutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Tile::TButton < TkButton
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['tbutton'.freeze].freeze
+ WidgetClassName = 'TButton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tbutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tbutton', @path)
+ end
+ end
+ private :create_self
+end
diff --git a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
new file mode 100644
index 00000000000..f5ab0088202
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -0,0 +1,33 @@
+#
+# tcheckbutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Tile::TCheckButton < TkCheckButton
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['tcheckbutton'.freeze].freeze
+ WidgetClassName = 'TCheckbutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tcheckbutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tcheckbutton', @path)
+ end
+ end
+ private :create_self
+end
+module Tk
+ module Tile
+ TCheckbutton = TCheckButton
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tile/tlabel.rb b/ext/tk/lib/tkextlib/tile/tlabel.rb
new file mode 100644
index 00000000000..1b7302cab18
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -0,0 +1,28 @@
+#
+# tlabel widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Tile::TLabel < TkLabel
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['tlabel'.freeze].freeze
+ WidgetClassName = 'TLabel'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tlabel', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tlabel', @path)
+ end
+ end
+ private :create_self
+end
diff --git a/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
new file mode 100644
index 00000000000..c827629c7d4
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -0,0 +1,28 @@
+#
+# tmenubutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Tile::TMenubutton < TkMenubutton
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['tmenubutton'.freeze].freeze
+ WidgetClassName = 'TMenubutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tmenubutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tmenubutton', @path)
+ end
+ end
+ private :create_self
+end
diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb
new file mode 100644
index 00000000000..40242b5235c
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -0,0 +1,90 @@
+#
+# tnotebook widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Tile::TNotebook < TkWindow
+ ################################
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, 'tabcget', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'tabconfigure', id]
+ end
+ private :__item_config_cmd
+
+
+ def __item_listval_optkeys
+ []
+ end
+ private :__item_listval_optkeys
+
+ def __item_methodcall_optkeys # { key=>method, ... }
+ {}
+ end
+ private :__item_listval_optkeys
+
+ alias tabcget itemcget
+ alias tabconfigure itemconfigure
+ alias tabconfiginfo itemconfiginfo
+ alias current_tabconfiginfo current_itemconfiginfo
+ ################################
+
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['tnotebook'.freeze].freeze
+ WidgetClassName = 'TNotebook'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tnotebook', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tnotebook', @path)
+ end
+ end
+ private :create_self
+
+ def enable_traversal()
+ tk_call_without_end('tile::enableNotebookTraversal', @path)
+ self
+ end
+
+ def add(child, keys=nil)
+ if keys && keys != None
+ tk_send_without_enc('add', _epath(child), *hash_kv(keys))
+ else
+ tk_send_without_enc('add', _epath(child))
+ end
+ self
+ end
+
+ def forget(idx)
+ tk_send('forget', idx)
+ self
+ end
+
+ def index(idx)
+ number(tk_send('index', idx))
+ end
+
+ def select(idx)
+ tk_send('select', idx)
+ self
+ end
+
+ def tabs
+ list(tk_send('tabs'))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
new file mode 100644
index 00000000000..2587a74cf3b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -0,0 +1,33 @@
+#
+# tradiobutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script -- <libdir>/tkextlib/tile.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Tile::TRadioButton < TkRadioButton
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['tradiobutton'.freeze].freeze
+ WidgetClassName = 'TRadiobutton'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('tradiobutton', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('tradiobutton', @path)
+ end
+ end
+ private :create_self
+end
+module Tk
+ module Tile
+ TRadiobutton = TRadioButton
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tkDND.rb b/ext/tk/lib/tkextlib/tkDND.rb
new file mode 100644
index 00000000000..ba5b23b5388
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkDND.rb
@@ -0,0 +1,25 @@
+#
+# TkDND (Tk Drag & Drop Extension) support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+module Tk
+ module TkDND
+ dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+ #autoload :DND 'tkextlib/tkDND/tkdnd'
+ #autoload :Shape 'tkextlib/tkDND/shape'
+ autoload :DND File.join(dir, 'tkdnd')
+ autoload :Shape File.join(dir, 'shape')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tkDND/setup.rb b/ext/tk/lib/tkextlib/tkDND/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkDND/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/tkDND/shape.rb b/ext/tk/lib/tkextlib/tkDND/shape.rb
new file mode 100644
index 00000000000..3e4a94f526c
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkDND/shape.rb
@@ -0,0 +1,96 @@
+#
+# tkextlib/tkDND/shape.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('shape', '0.3')
+TkPackage.require('shape')
+
+module Tk
+ module TkDND
+ module Shape
+ def self.version
+ tk_call('shape', 'version')
+ end
+
+ ############################
+
+ def shape_bounds(kind=nil)
+ if kind
+ ret = tk_call('shape', 'bounds', @path, "-#{kind}")
+ else
+ ret = tk_call('shape', 'bounds', @path)
+ end
+ if ret == ""
+ nil
+ else
+ list(ret)
+ end
+ end
+
+ def shape_get(kind=nil)
+ if kind
+ list(tk_call('shape', 'get', @path, "-#{kind}"))
+ else
+ list(tk_call('shape', 'get', @path))
+ end
+ end
+
+ def shape_offset(x, y, kind=nil)
+ if kind
+ tk_call('shape', 'get', @path, "-#{kind}", x, y)
+ else
+ tk_call('shape', 'get', @path, x, y)
+ end
+ self
+ end
+
+ def _parse_shapespec_param(args)
+ cmd = []
+
+ kind_keys = ['bounding', 'clip', 'both']
+ offset_keys = ['offset']
+ srckind_keys = ['bitmap', 'rectangles', 'reset', 'test', 'window']
+
+ cmd << "-#{args.shift}" if kind_keys.member?(args[0].to_s)
+
+ if offset_keys.member?(args[0].to_s)
+ cmd << "-#{args.shift}"
+ cmd << args.shift # xOffset
+ cmd << args.shift # yOffset
+ end
+
+ if srckind_keys.member?(args[0].to_s)
+ cmd << "-#{args.shift}"
+ end
+
+ cmd.concat(args)
+
+ cmd
+ end
+ private :_parse_shapespec_param
+
+ def shape_set(*args) # ?kind? ?offset <x> <y>? srckind ?arg ...?
+ tk_call('shape', 'set', @path, *(_parse_shapespec_param(args)))
+ self
+ end
+
+ def shape_update(op, *args) # ?kind? ?offset <x> <y>? srckind ?arg ...?
+ tk_call('shape', 'update', @path, op, *(_parse_shapespec_param(args)))
+ self
+ end
+ end
+ end
+end
+
+class TkWindow
+ include Tk::TkDND::Shape
+end
diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
new file mode 100644
index 00000000000..036d1998bd6
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
@@ -0,0 +1,108 @@
+#
+# tkextlib/tkDND/tkdnd.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+TkPackage.require('tkdnd')
+
+module Tk
+ module TkDND
+ class DND_Subst < TkUtil::CallbackSubst
+ KEY_TBL = [
+ [ ?a, ?l, :actions ],
+ [ ?A, ?s, :action ],
+ [ ?b, ?L, :codes ],
+ [ ?c, ?s, :code ],
+ [ ?d, ?l, :descriptions ],
+ [ ?D, ?l, :data ],
+ [ ?L, ?l, :source_types ],
+ [ ?m, ?l, :modifiers ],
+ [ ?t, ?l, :types ],
+ [ ?T, ?s, :type ],
+ [ ?W, ?w, :widget ],
+ [ ?x, ?n, :x ],
+ [ ?X, ?n, :x_root ],
+ [ ?y, ?n, :y ],
+ [ ?Y, ?n, :y_root ],
+ nil
+ ]
+
+ PROC_TBL = [
+ [ ?n, TkComm.method(:num_or_str) ],
+ [ ?s, TkComm.method(:string) ],
+ [ ?l, TkComm.method(:list) ],
+ [ ?L, TkComm.method(:simplelist) ],
+ [ ?w, TkComm.method(:window) ],
+ nil
+ ]
+
+ # setup tables
+ _setup_subst_table(KEY_TBL, PROC_TBL);
+ end
+
+ module DND
+ def dnd_bindtarget_info(type=nil, event=nil)
+ if event
+ procedure(tk_call('dnd', 'bindtarget', @path, type, event))
+ elsif type
+ procedure(tk_call('dnd', 'bindtarget', @path, type))
+ else
+ simplelist(tk_call('dnd', 'bindtarget', @path))
+ end
+ end
+
+ def dnd_bindtarget(type, event, cmd=Proc.new, prior=50, *args)
+ event = tk_event_sequence(event)
+ if prior.kind_of?(Numeric)
+ tk_call('dnd', 'bindtarget', @path, type, event,
+ install_bind_for_event_class(DND_Subst, cmd, *args),
+ prior)
+ else
+ tk_call('dnd', 'bindtarget', @path, type, event,
+ install_bind_for_event_class(DND_Subst, cmd, prior, *args))
+ end
+ self
+ end
+
+ def dnd_cleartarget
+ tk_call('dnd', 'cleartarget', @path)
+ self
+ end
+
+ def dnd_bindsource_info(type=nil)
+ if type
+ procedure(tk_call('dnd', 'bindsource', @path, type))
+ else
+ simplelist(tk_call('dnd', 'bindsource', @path))
+ end
+ end
+
+ def dnd_bindsource(type, cmd=Proc.new, prior=None)
+ tk_call('dnd', 'bindsource', @path, type, cmd, prior)
+ self
+ end
+
+ def dnd_clearsource()
+ tk_call('dnd', 'clearsource', @path)
+ self
+ end
+
+ def dnd_drag(keys=nil)
+ tk_call('dnd', 'drag', @path, *hash_kv(keys))
+ self
+ end
+ end
+ end
+end
+
+class TkWindow
+ include Tk::TkDND::DND
+end
diff --git a/ext/tk/lib/tkextlib/tkHTML.rb b/ext/tk/lib/tkextlib/tkHTML.rb
new file mode 100644
index 00000000000..f32aed99f1d
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkHTML.rb
@@ -0,0 +1,16 @@
+#
+# TkHtml support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load library
+require File.join(dir, 'htmlwidget')
diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
new file mode 100644
index 00000000000..5c0657025a9
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
@@ -0,0 +1,427 @@
+#
+# tkextlib/tkHTML/htmlwidget.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('Tkhtml', '2.0')
+TkPackage.require('Tkhtml')
+
+module Tk
+ class HTML_Widget < TkWindow
+ class ClippingWindow < TkWindow
+ end
+ end
+end
+
+class Tk::HTML_Widget::ClippingWindow
+ extend TkUtil
+
+ WidgetClassName = 'HtmlClip'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ HtmlClip_TBL = TkCore::INTERP.create_table
+ TkCore::INTERP.init_ip_env{ HtmlClip_TBL.clear }
+
+ def self.new(parent, keys={})
+ if parent.kind_of?(Hash)
+ keys = _symbolkey2str(parent)
+ parent = keys.delete('parent')
+ end
+
+ if parent.kind_of?(String)
+ ppath = parent.path
+ elsif parent
+ ppath = parent
+ else
+ ppath = ''
+ end
+ return HtmlClip_TBL[ppath] if HtmlClip_TBL[ppath]
+
+ widgetname = keys.delete('widgetname')
+ if widgetname =~ /^(.*)\.[^.]+$/
+ ppath2 = $1
+ if ppath2[0] != ?.
+ ppath2 = ppath + '.' + ppath2
+ end
+ return HtmlClip_TBL[ppath2] if HtmlClip_TBL[ppath2]
+
+ ppath = ppath2
+ end
+
+ parent = TkComm._genobj_for_tkwidget(ppath)
+ unless parent.kind_of?(Tk::HTML_Widget)
+ fail ArgumentError, "parent must be a Tk::HTML_Widget instance"
+ end
+
+ super(parent)
+ end
+
+ def initialize(parent)
+ @parent = parent
+ @ppath = parent.path
+ @path = @id = @ppath + '.x'
+ HtmlClip_TBL[@ppath] = self
+ end
+
+ def method_missing(m, *args, &b)
+ @parent.__send__(m, *args, &b)
+ end
+end
+
+class Tk::HTML_Widget
+ include Scrollable
+
+ TkCommandNames = ['html'.freeze].freeze
+ WidgetClassName = 'Html'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('html', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('html', @path)
+ end
+ end
+ private :create_self
+
+ ###################################
+ # class methods
+ ###################################
+ def self.reformat(src, dst, txt)
+ tk_call('html', 'reformat', src, dst, txt)
+ end
+
+ def self.url_join(*args) # args := sheme authority path query fragment
+ tk_call('html', 'urljoin', *args)
+ end
+
+ def self.url_split(uri)
+ tk_call('html', 'urlsplit', uri)
+ end
+
+ def self.lockcopy(src, dst)
+ tk_call('html', 'lockcopy', src, dst)
+ end
+
+ def self.gzip_file(file, dat)
+ tk_call('html', 'gzip', 'file', file, dat)
+ end
+
+ def self.gunzip_file(file, dat)
+ tk_call('html', 'gunzip', 'file', filet)
+ end
+
+ def self.gzip_data(dat)
+ tk_call('html', 'gzip', 'data', file, dat)
+ end
+
+ def self.gunzip_data(dat)
+ tk_call('html', 'gunzip', 'data', filet)
+ end
+
+ def self.base64_encode(dat)
+ tk_call('html', 'base64', 'encode', dat)
+ end
+
+ def self.base64_decode(dat)
+ tk_call('html', 'base64', 'encode', dat)
+ end
+
+ def self.text_format(dat, len)
+ tk_call('html', 'text', 'format', dat, len)
+ end
+
+ def self.xor(cmd, *args)
+ tk_call('html', 'xor', cmd, *args)
+ end
+
+ def self.stdchan(cmd, channel)
+ tk_call('html', 'stdchan', cmd, channel)
+ end
+
+ def self.crc32(data)
+ tk_call('html', 'crc32', data)
+ end
+
+ ###################################
+ # instance methods
+ ###################################
+ def clipping_window
+ ClippingWindow.new(self)
+ end
+ alias clipwin clipping_window
+ alias htmlclip clipping_window
+
+ def bgimage(image, tid=None)
+ tk_send('bgimage', image, tid)
+ self
+ end
+
+ def clear()
+ tk_send('clear')
+ self
+ end
+
+ def coords(index=None, percent=None)
+ tk_send('coords', index, percent)
+ end
+
+ def forminfo(*args)
+ tk_send('forminfo', *args)
+ end
+ alias form_info forminfo
+
+ def href(x, y)
+ simplelist(tk_send('href', x, y))
+ end
+
+ def image_add(id, img)
+ tk_send('imageadd', id, img)
+ self
+ end
+
+ def image_at(x, y)
+ tk_send('imageat', x, y)
+ end
+
+ def images()
+ list(tk_send('images'))
+ end
+
+ def image_set(id, num)
+ tk_send('imageset', id, num)
+ self
+ end
+
+ def image_update(id, imgs)
+ tk_send('imageupdate', id, imgs)
+ self
+ end
+
+ def index(idx, count=None, unit=None)
+ tk_send('index', idx, count, unit)
+ end
+
+ def insert_cursor(idx)
+ tk_send('insert', idx)
+ end
+
+ def names()
+ simple_list(tk_send('names'))
+ end
+
+ def on_screen(id, x, y)
+ bool(tk_send('onscreen', id, x, y))
+ end
+
+ def over(x, y)
+ list(tk_send('over', x, y))
+ end
+
+ def over_markup(x, y)
+ list(tk_send('over', x, y, '-muponly'))
+ end
+
+ def over_attr(x, y, attrs)
+ list(tk_send('overattr', x, y, attrs))
+ end
+
+ def parse(txt)
+ tk_send('parse', txt)
+ self
+ end
+
+ def resolver(*uri_args)
+ tk_send('resolver', *uri_args)
+ end
+
+ def selection_clear()
+ tk_send('selection', 'clear')
+ self
+ end
+
+ def selection_set(first, last)
+ tk_send('selection', 'set', first, last)
+ self
+ end
+
+ def refresh(*opts)
+ tk_send('refresh', *opts)
+ end
+
+ def layout()
+ tk_send('layout')
+ end
+
+ def sizewindow(*args)
+ tk_send('sizewindow', *args)
+ end
+
+ def postscript(*args)
+ tk_send('postscript', *args)
+ end
+
+ def source()
+ tk_send('source')
+ end
+
+ def plain_text(first, last)
+ tk_send('text', 'ascii', first, last)
+ end
+ alias ascii_text plain_text
+ alias text_ascii plain_text
+
+ def text_delete(first, last)
+ tk_send('text', 'delete', first, last)
+ self
+ end
+
+ def html_text(first, last)
+ tk_send('text', 'html', first, last)
+ end
+ alias text_html html_text
+
+ def text_insert(idx, txt)
+ tk_send('text', 'insert', idx, txt)
+ self
+ end
+
+ def break_text(idx)
+ tk_send('text', 'break', idx)
+ end
+ alias text_break break_text
+
+ def text_find(txt, *args)
+ tk_send('text', 'find', txt, *args)
+ end
+
+ def text_table(idx, imgs=None, attrs=None)
+ tk_send('text', 'table', idx, imgs, attrs)
+ end
+
+ def token_append(tag, *args)
+ tk_send('token', 'append', tag, *args)
+ self
+ end
+
+ def token_delete(first, last=None)
+ tk_send('token', 'delete', first, last)
+ self
+ end
+
+ def token_define(*args)
+ tk_send('token', 'defile', *args)
+ self
+ end
+
+ def token_find(tag, *args)
+ list(tk_send('token', 'find', tag, *args))
+ end
+
+ def token_get(first, last=None)
+ list(tk_send('token', 'get', first, last))
+ end
+
+ def token_list(first, last=None)
+ list(tk_send('token', 'list', first, last))
+ end
+
+ def token_markup(first, last=None)
+ list(tk_send('token', 'markup', first, last))
+ end
+
+ def token_DOM(first, last=None)
+ list(tk_send('token', 'domtokens', first, last))
+ end
+ alias token_dom token_DOM
+ alias token_domtokens token_DOM
+ alias token_dom_tokens token_DOM
+
+ def token_get_end(idx)
+ tk_send('token', 'getend', idx)
+ end
+ alias token_getend token_get_end
+
+ def token_offset(start, num1, num2)
+ list(tk_send('token', 'offset', start, num1, num2))
+ end
+
+ def token_get_attr(idx, name=None)
+ list(tk_send('token', 'attr', idx, name))
+ end
+
+ def token_set_attr(idx, name=None, val=None)
+ tk_send('token', 'attr', idx, name, val)
+ self
+ end
+
+ def token_handler(tag, cmd=nil, &b)
+ cmd = Proc.new(&b) if !cmd && b
+ if cmd
+ tk_send('token', 'handler', tag, cmd)
+ return self
+ else
+ return tk_send('token', 'handler', tag)
+ end
+ end
+
+ def token_insert(idx, tag, *args)
+ tk_send('token', 'insert', idx, tag, *args)
+ self
+ end
+
+ def token_attrs(*args)
+ list(tk_send('token', 'attrs', *args))
+ end
+
+ def token_unique(*args)
+ list(tk_send('token', 'unique', *args))
+ end
+
+ def token_on_events(*args)
+ list(tk_send('token', 'onEvents', *args))
+ end
+
+ def dom_nameidx(tag, name)
+ number(tk_send('dom', 'nameidx', tag, name))
+ end
+ alias dom_name_index dom_nameidx
+
+ def dom_radioidx(tag, name)
+ number(tk_send('dom', 'radioidx', tag, name))
+ end
+ alias dom_radio_index dom_radioidx
+
+ def dom_id(*spec)
+ tk_send('dom', 'id', *spec)
+ end
+
+ def dom_ids(*spec)
+ list(tk_send('dom', 'ids', *spec))
+ end
+
+ def dom_value(*spec)
+ list(tk_send('dom', 'value', *spec))
+ end
+
+ def dom_attr(idx)
+ tk_send('dom', 'attr', idx)
+ end
+
+ def dom_formel(name)
+ tk_send('dom', 'formel', name)
+ end
+ alias dom_form_element dom_formel
+
+ def dom_tree(idx, val)
+ list(tk_send('dom', 'tree', idx, val))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tkHTML/setup.rb b/ext/tk/lib/tkextlib/tkHTML/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkHTML/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/tkimg.rb b/ext/tk/lib/tkextlib/tkimg.rb
new file mode 100644
index 00000000000..06184589b46
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg.rb
@@ -0,0 +1,23 @@
+#
+# TkImg extension support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load all image format handlers
+#TkPackage.require('Img', '1.3')
+TkPackage.require('Img')
+
+# autoload
+#autoload :TkPixmapImage, 'tkextlib/tkimg/pixmap'
+autoload :TkPixmapImage, File.join(dir, 'pixmap')
diff --git a/ext/tk/lib/tkextlib/tkimg/README b/ext/tk/lib/tkextlib/tkimg/README
new file mode 100644
index 00000000000..65d36365d0c
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/README
@@ -0,0 +1,26 @@
+
+ [ Tcl/Tk Image formats (TkImg) support ]
+
+TkImg contains a collection of format handlers for the Tk photo
+image type, and a new image type, pixmaps.
+
+Supported formats of TkImg version 1.3 are
+-------------------------------------------------------
+ bmp : Windows Bitmap Format
+ gif : Graphics Interchange Format
+ ico : Windows Icon Format
+ jpeg : Joint Picture Expert Group format
+ pcx : Paintbrush Format
+ pixmap : Pixmap Image type
+ png : Portable Network Graphics format
+ ppm : Portable Pixmap format
+ ps : Adobe PostScript Format
+ sgi : SGI Native Format
+ sun : Sun Raster Format
+ tga : Truevision Targa Format
+ tiff : Tagged Image File Format
+ window : Tk Windows
+ xbm : X Window Bitmap Format
+ xpm : X Window Pixmap Format
+-------------------------------------------------------
+
diff --git a/ext/tk/lib/tkextlib/tkimg/bmp.rb b/ext/tk/lib/tkextlib/tkimg/bmp.rb
new file mode 100644
index 00000000000..5bef0c7168f
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/bmp.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'bmp'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+#TkPackage.require('img::bmp', '1.3')
+TkPackage.require('img::bmp')
diff --git a/ext/tk/lib/tkextlib/tkimg/gif.rb b/ext/tk/lib/tkextlib/tkimg/gif.rb
new file mode 100644
index 00000000000..65c3b88a509
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/gif.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'gif'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::gif', '1.3')
+TkPackage.require('img::gif')
diff --git a/ext/tk/lib/tkextlib/tkimg/ico.rb b/ext/tk/lib/tkextlib/tkimg/ico.rb
new file mode 100644
index 00000000000..43646ec8da9
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/ico.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'ico'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::ico', '1.3')
+TkPackage.require('img::ico')
diff --git a/ext/tk/lib/tkextlib/tkimg/jpeg.rb b/ext/tk/lib/tkextlib/tkimg/jpeg.rb
new file mode 100644
index 00000000000..7b4df8c050f
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/jpeg.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'jpeg'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::jpeg', '1.3')
+TkPackage.require('img::jpeg')
diff --git a/ext/tk/lib/tkextlib/tkimg/pcx.rb b/ext/tk/lib/tkextlib/tkimg/pcx.rb
new file mode 100644
index 00000000000..4486ba24493
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/pcx.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'pcx'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::pcx', '1.3')
+TkPackage.require('img::pcx')
diff --git a/ext/tk/lib/tkextlib/tkimg/pixmap.rb b/ext/tk/lib/tkextlib/tkimg/pixmap.rb
new file mode 100644
index 00000000000..0c18c714083
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/pixmap.rb
@@ -0,0 +1,21 @@
+#
+# TkImg - format 'pixmap'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::pixmap', '1.3')
+TkPackage.require('img::pixmap')
+
+class TkPixmapImage<TkImage
+ def initialize(*args)
+ @type = 'pixmap'
+ super
+ end
+end
diff --git a/ext/tk/lib/tkextlib/tkimg/png.rb b/ext/tk/lib/tkextlib/tkimg/png.rb
new file mode 100644
index 00000000000..275035f47e9
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/png.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'png'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::png', '1.3')
+TkPackage.require('img::png')
diff --git a/ext/tk/lib/tkextlib/tkimg/ppm.rb b/ext/tk/lib/tkextlib/tkimg/ppm.rb
new file mode 100644
index 00000000000..730978b2814
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/ppm.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'ppm'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::ppm', '1.3')
+TkPackage.require('img::ppm')
diff --git a/ext/tk/lib/tkextlib/tkimg/ps.rb b/ext/tk/lib/tkextlib/tkimg/ps.rb
new file mode 100644
index 00000000000..edfb8dd7833
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/ps.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'ps'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::ps', '1.3')
+TkPackage.require('img::ps')
diff --git a/ext/tk/lib/tkextlib/tkimg/setup.rb b/ext/tk/lib/tkextlib/tkimg/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/tkimg/sgi.rb b/ext/tk/lib/tkextlib/tkimg/sgi.rb
new file mode 100644
index 00000000000..9dcfa614b06
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/sgi.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'sgi'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::sgi', '1.3')
+TkPackage.require('img::sgi')
diff --git a/ext/tk/lib/tkextlib/tkimg/sun.rb b/ext/tk/lib/tkextlib/tkimg/sun.rb
new file mode 100644
index 00000000000..4ada9c7ff13
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/sun.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'sun'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::sun', '1.3')
+TkPackage.require('img::sun')
diff --git a/ext/tk/lib/tkextlib/tkimg/tga.rb b/ext/tk/lib/tkextlib/tkimg/tga.rb
new file mode 100644
index 00000000000..221ebe5db1b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/tga.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'tga'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::tga', '1.3')
+TkPackage.require('img::tga')
diff --git a/ext/tk/lib/tkextlib/tkimg/tiff.rb b/ext/tk/lib/tkextlib/tkimg/tiff.rb
new file mode 100644
index 00000000000..1c7e9408435
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/tiff.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'tiff'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::tiff', '1.3')
+TkPackage.require('img::tiff')
diff --git a/ext/tk/lib/tkextlib/tkimg/window.rb b/ext/tk/lib/tkextlib/tkimg/window.rb
new file mode 100644
index 00000000000..056aa8f3cf9
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/window.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'window'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::window', '1.3')
+TkPackage.require('img::window')
diff --git a/ext/tk/lib/tkextlib/tkimg/xbm.rb b/ext/tk/lib/tkextlib/tkimg/xbm.rb
new file mode 100644
index 00000000000..80010c77def
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/xbm.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'xbm'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::xbm', '1.3')
+TkPackage.require('img::xbm')
diff --git a/ext/tk/lib/tkextlib/tkimg/xpm.rb b/ext/tk/lib/tkextlib/tkimg/xpm.rb
new file mode 100644
index 00000000000..04d56287ef5
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tkimg/xpm.rb
@@ -0,0 +1,14 @@
+#
+# TkImg - format 'xpm'
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('img::xpm', '1.3')
+TkPackage.require('img::xpm')
diff --git a/ext/tk/lib/tkextlib/tktrans.rb b/ext/tk/lib/tkextlib/tktrans.rb
new file mode 100644
index 00000000000..93bb338a9b1
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tktrans.rb
@@ -0,0 +1,17 @@
+#
+# TkTrans support (win32 only)
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load library
+require File.join(dir, 'tktrans')
diff --git a/ext/tk/lib/tkextlib/tktrans/setup.rb b/ext/tk/lib/tkextlib/tktrans/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tktrans/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/tktrans/tktrans.rb b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
new file mode 100644
index 00000000000..fa5d7a2eae1
--- /dev/null
+++ b/ext/tk/lib/tkextlib/tktrans/tktrans.rb
@@ -0,0 +1,53 @@
+#
+# TkTrans support (win32 only)
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+TkPackage.require('tktrans') rescue Tk.load_tcllibrary('tktrans')
+
+class TkWindow
+ begin
+ TkTrans_VERSION = TkPackage.require('tktrans')
+ rescue
+ TkTrans_VERSION = nil
+ end
+
+ def tktrans_set_image(img)
+ tk_send('tktrans::setwidget', @path, img)
+ self
+ end
+ def tktrans_get_image()
+ tk_send('tktrans::setwidget', @path)
+ end
+end
+
+class TkRoot
+ undef tktrans_set_image, tktrans_get_image
+
+ def tktrans_set_image(img)
+ tk_send('tktrans::settoplevel', @path, img)
+ self
+ end
+ def tktrans_get_image()
+ tk_send('tktrans::settoplevel', @path)
+ end
+end
+
+class TkToplevel
+ undef tktrans_set_image, tktrans_get_image
+
+ def tktrans_set_image(img)
+ tk_send('tktrans::settoplevel', @path, img)
+ self
+ end
+ def tktrans_get_image()
+ tk_send('tktrans::settoplevel', @path)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/treectrl.rb b/ext/tk/lib/tkextlib/treectrl.rb
new file mode 100644
index 00000000000..fb03283a8df
--- /dev/null
+++ b/ext/tk/lib/tkextlib/treectrl.rb
@@ -0,0 +1,16 @@
+#
+# TkTreeCtrl support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load library
+require File.join(dir, 'tktreectrl')
diff --git a/ext/tk/lib/tkextlib/treectrl/setup.rb b/ext/tk/lib/tkextlib/treectrl/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/treectrl/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
new file mode 100644
index 00000000000..fb74b72c3b3
--- /dev/null
+++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
@@ -0,0 +1,887 @@
+#
+# tkextlib/treectrl/tktreectrl.rb
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script
+require File.join(File.dirname(File.expand_path(__FILE__)), 'setup.rb')
+
+# TkPackage.require('treectrl', '1.0')
+#TkPackage.require('treectrl')
+
+module Tk
+ class TreeCtrl_Widget < TkWindow
+ #VERSION = TkPackage.require('treectrl', '1.0')
+ VERSION = TkPackage.require('treectrl')
+
+ class NotifyEvent < TkUtil::CallbackSubst
+ end
+
+ module ConfigMethod
+ end
+ end
+end
+
+##############################################
+
+class Tk::TreeCtrl_Widget::NotifyEvent
+ # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
+ KEY_TBL = [
+ [ ?c, ?n, :item_num ],
+ [ ?d, ?s, :detail ],
+ [ ?D, ?l, :items ],
+ [ ?e, ?e, :event ],
+ [ ?I, ?n, :id ],
+ [ ?l, ?b, :lower_bound ],
+ [ ?p, ?n, :active_id ],
+ [ ?S, ?l, :sel_items ],
+ [ ?T, ?w, :widget ],
+ [ ?U, ?b, :upper_bound ],
+ [ ?W, ?o, :object ],
+ nil
+ ]
+
+ # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
+ PROC_TBL = [
+ [ ?n, TkComm.method(:num_or_str) ],
+ [ ?s, TkComm.method(:string) ],
+ [ ?l, TkComm.method(:list) ],
+ [ ?w, TkComm.method(:window) ],
+
+ [ ?b, proc{|val| list(val)} ],
+
+ [ ?e, proc{|val|
+ case val
+ when /^<<[^<>]+>>$/
+ TkVirtualEvent.getobj(val[1..-2])
+ when /^<[^<>]+>$/
+ val[1..-2]
+ else
+ val
+ end
+ }
+ ],
+
+ [ ?o, proc{|val| tk_tcl2ruby(val)} ],
+
+ nil
+ ]
+
+ # 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
+ # which describe how to convert callback arguments to ruby objects.
+ # When binding parameters are given, use _get_subst_key().
+ # But when no parameters are given, use _get_all_subst_keys() to
+ # create a Event class object as a callback parameter.
+ #
+ # scan_args() is used when doing callback. It convert arguments
+ # ( 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);
+end
+
+##############################################
+
+module Tk::TreeCtrl_Widget::ConfigMethod
+ include TkItemConfigMethod
+
+ def treectrl_tagid(key, obj)
+ if key.kind_of?(Array)
+ key = key.join(' ')
+ else
+ key = key.to_s
+ end
+
+ case key
+ when 'column'
+ obj
+
+ when 'dragimage'
+ obj
+
+ when 'element'
+ obj
+
+ when 'item element'
+ obj
+
+ when 'marquee'
+ obj
+
+ when 'notify'
+ obj
+
+ when 'style'
+ obj
+
+ else
+ obj
+ end
+ end
+
+ def tagid(mixed_id)
+ if mixed_id.kind_of?(Array)
+ [mixed_id[0], treectrl_tagid(*mixed_id)]
+ else
+ tagid(mixed_id.split(':'))
+ end
+ fail ArgumentError, "unknown id format"
+ end
+
+ def __item_cget_cmd(mixed_id)
+ if mixed_id[1].kind_of?(Array)
+ id = mixed_id[1]
+ else
+ id = [mixed_id[1]]
+ end
+
+ if mixed_id[0].kind_of?(Array)
+ ([self.path].concat(mixed_id[0]) << 'cget').concat(id)
+ else
+ [self.path, mixed_id[0], 'cget'].concat(id)
+ end
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(mixed_id)
+ if mixed_id[1].kind_of?(Array)
+ id = mixed_id[1]
+ else
+ id = [mixed_id[1]]
+ end
+
+ if mixed_id[0].kind_of?(Array)
+ ([self.path].concat(mixed_id[0]) << 'configure').concat(id)
+ else
+ [self.path, mixed_id[0], 'configure'].concat(id)
+ end
+ end
+ private :__item_config_cmd
+
+ def __item_pathname(id)
+ if id.kind_of?(Array)
+ key = id[0]
+ if key.kind_of?(Array)
+ key = key.join(' ')
+ end
+
+ tag = id[1]
+ if tag.kind_of?(Array)
+ tag = tag.join(' ')
+ end
+
+ id = [key, tag].join(':')
+ end
+ [self.path, id].join(';')
+ end
+ private :__item_pathname
+
+ def __item_configinfo_struct(id)
+ if id.kind_of?(Array) && id[0].to_s == 'notify'
+ {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
+ :default_value=>nil, :current_value=>1}
+ else
+ {:key=>0, :alias=>1, :db_name=>1, :db_class=>2,
+ :default_value=>3, :current_value=>4}
+ end
+ end
+ private :__item_configinfo_struct
+
+ def __item_listval_optkeys(id)
+ []
+ end
+ private :__item_listval_optkeys
+
+ def __item_keyonly_optkeys(id) # { def_key=>(undef_key|nil), ... }
+ {
+ 'notreally'=>nil,
+ 'increasing'=>'decreasing',
+ 'decreasing'=>'increasing',
+ 'ascii'=>nil,
+ 'dictionary'=>nil,
+ 'integer'=>nil,
+ 'real'=>nil
+ }
+ end
+ private :__item_keyonly_optkeys
+
+ def column_cget(tagOrId, option)
+ itemcget(['column', tagOrId], option)
+ end
+ def column_configure(tagOrId, slot, value=None)
+ itemconfigure(['column', tagOrId], slot, value)
+ end
+ def column_configinfo(tagOrId, slot=nil)
+ itemconfigure(['column', tagOrId], slot)
+ end
+ def current_column_configinfo(tagOrId, slot=nil)
+ itemconfigure(['column', tagOrId], slot)
+ end
+
+ def dragimage_cget(tagOrId, option)
+ itemcget(['dragimage', tagOrId], option)
+ end
+ def dragimage_configure(tagOrId, slot, value=None)
+ itemconfigure(['dragimage', tagOrId], slot, value)
+ end
+ def dragimage_configinfo(tagOrId, slot=nil)
+ itemconfigure(['dragimage', tagOrId], slot)
+ end
+ def current_dragimage_configinfo(tagOrId, slot=nil)
+ itemconfigure(['dragimage', tagOrId], slot)
+ end
+
+ def element_cget(tagOrId, option)
+ itemcget(['element', tagOrId], option)
+ end
+ def element_configure(tagOrId, slot, value=None)
+ itemconfigure(['element', tagOrId], slot, value)
+ end
+ def element_configinfo(tagOrId, slot=nil)
+ itemconfigure(['element', tagOrId], slot)
+ end
+ def current_element_configinfo(tagOrId, slot=nil)
+ itemconfigure(['element', tagOrId], slot)
+ end
+
+ def item_element_cget(tagOrId, option)
+ itemcget([['item', 'element'], tagOrId], option)
+ end
+ def item_element_configure(tagOrId, slot, value=None)
+ itemconfigure([['item', 'element'], tagOrId], slot, value)
+ end
+ def item_element_configinfo(tagOrId, slot=nil)
+ itemconfigure([['item', 'element'], tagOrId], slot)
+ end
+ def current_item_element_configinfo(tagOrId, slot=nil)
+ itemconfigure([['item', 'element'], tagOrId], slot)
+ end
+
+ def marquee_cget(tagOrId, option)
+ itemcget(['marquee', tagOrId], option)
+ end
+ def marquee_configure(tagOrId, slot, value=None)
+ itemconfigure(['marquee', tagOrId], slot, value)
+ end
+ def marquee_configinfo(tagOrId, slot=nil)
+ itemconfigure(['marquee', tagOrId], slot)
+ end
+ def current_marquee_configinfo(tagOrId, slot=nil)
+ itemconfigure(['marquee', tagOrId], slot)
+ end
+
+ def notify_cget(win, pattern, option)
+ itemconfigure(['notify', [win, pattern]], option)
+ end
+ def notify_configure(win, pattern, slot, value=None)
+ itemconfigure(['notify', [win, pattern]], slot, value)
+ end
+ def notify_configinfo(win, pattern, slot=nil)
+ itemconfigure(['notify', [win, pattern]], slot)
+ end
+ alias current_notify_configinfo notify_configinfo
+
+ def style_cget(tagOrId, option)
+ itemcget(['style', tagOrId], option)
+ end
+ def style_configure(tagOrId, slot, value=None)
+ itemconfigure(['style', tagOrId], slot, value)
+ end
+ def style_configinfo(tagOrId, slot=nil)
+ itemconfigure(['style', tagOrId], slot)
+ end
+ def current_style_configinfo(tagOrId, slot=nil)
+ itemconfigure(['style', tagOrId], slot)
+ end
+
+ private :itemcget, :itemconfigure
+ private :itemconfiginfo, :current_itemconfiginfo
+end
+
+##############################################
+
+class Tk::TreeCtrl_Widget
+ include Tk::TreeCtrl_Widget::ConfigMethod
+ include Scrollable
+
+ TkCommandNames = ['treectrl'.freeze].freeze
+ WidgetClassName = ''.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc('treectrl', @path, *hash_kv(keys, true))
+ else
+ tk_call_without_enc('treectrl', @path)
+ end
+ end
+ private :create_self
+
+ #########################
+
+ def activate(desc)
+ tk_send('activate', desc)
+ self
+ end
+
+ def canvasx(x)
+ number(tk_send('canvasx', x))
+ end
+
+ def canvasy(y)
+ number(tk_send('canvasy', y))
+ end
+
+ def collapse(*dsc)
+ tk_send('collapse', *dsc)
+ self
+ end
+
+ def collapse_recurse(*dsc)
+ tk_send('collapse', '-recurse', *dsc)
+ self
+ end
+
+ def column_bbox(idx)
+ list(tk_send('column', 'bbox', idx))
+ end
+
+ def column_delete(idx)
+ tk_send('column', 'delete', idx)
+ self
+ end
+
+ def column_index(idx)
+ num_or_str(tk_send('column', 'index', idx))
+ end
+
+ def column_move(idx, to)
+ tk_send('column', 'move', idx, to)
+ self
+ end
+
+ def column_needed_width(idx)
+ num_or_str(tk_send('column', 'neededwidth', idx))
+ end
+ alias column_neededwidth column_needed_width
+
+ def column_width(idx)
+ num_or_str(tk_send('column', 'width', idx))
+ end
+
+ def compare(item1, op, item2)
+ number(tk_send('compare', item1, op, item2))
+ end
+
+ def contentbox()
+ list(tk_send('contentbox'))
+ end
+
+ def depth(item=None)
+ num_or_str(tk_send('depth', item))
+ end
+
+ def dragimage_add(item, *args)
+ tk_send('dragimage', 'add', item, *args)
+ self
+ end
+
+ def dragimage_clear()
+ tk_send('dragimage', 'clear')
+ self
+ end
+
+ def dragimage_offset(*args) # x, y
+ if args.empty?
+ list(tk_send('dragimage', 'offset'))
+ else
+ tk_send('dragimage', 'offset', *args)
+ self
+ end
+ end
+
+ def dragimage_visible(*args) # mode
+ if args..empty?
+ bool(tk_send('dragimage', 'visible'))
+ else
+ tk_send('dragimage', 'visible', *args)
+ self
+ end
+ end
+ def dragimage_visible?
+ dragimage_visible()
+ end
+
+ def element_create(elem, type, keys=nil)
+ if keys && keys.kind_of?(Hash)
+ tk_send('element', 'create', elem, type, *hash_kv(keys))
+ else
+ tk_send('element', 'create', elem, type)
+ end
+ end
+
+ def element_delete(*elems)
+ tk_send('element', 'delete', *elems)
+ self
+ end
+
+ def element_names()
+ list(tk_send('element', 'names'))
+ end
+
+ def element_type(elem)
+ tk_send('element', 'type', elem)
+ end
+
+ def expand(*dsc)
+ tk_send('expand', *dsc)
+ self
+ end
+
+ def expand_recurse(*dsc)
+ tk_send('expand', '-recurse', *dsc)
+ self
+ end
+
+ def identify(x, y)
+ list(tk_send('identify', x, y))
+ end
+
+ def index(idx)
+ num_or_str(tk_send('index', idx))
+ end
+
+ def item_ancestors(item)
+ list(tk_send('item', 'ancestors', item))
+ end
+
+ def item_bbox(item, *args)
+ list(tk_send('item', 'bbox', item, *args))
+ end
+
+ def item_children(item)
+ list(tk_send('item', 'children', item))
+ end
+
+ def item_complex(item, *args)
+ tk_send('item', 'complex', item, *args)
+ self
+ end
+
+ def item_create()
+ num_or_str(tk_send('item', 'create'))
+ end
+
+ def item_delete(first, last=None)
+ tk_send('item', 'delete', first, last)
+ self
+ end
+
+ def item_dump(item)
+ list(tk_send('item', 'dump', item))
+ end
+
+ def item_element_actual(item, column, elem, key)
+ tk_send('item', 'element', 'actual', item, column, elem, "-#{key}")
+ end
+
+ def item_firstchild(parent, child=nil)
+ if child
+ tk_send('item', 'firstchild', parent, child)
+ self
+ else
+ num_or_str(tk_send('item', 'firstchild', parent))
+ end
+ end
+ alias item_first_child item_firstchild
+
+ def item_hashbutton(item, st=None)
+ if st == None
+ bool(tk_send('item', 'hashbutton'))
+ else
+ tk_send('item', 'hashbutton', st)
+ self
+ end
+ end
+ def item_hashbutton?(item)
+ item_hashbutton(item)
+ end
+
+ def item_index(item)
+ list(tk_send('item', 'index', item))
+ end
+
+ def item_isancestor(item, des)
+ bool(tk_send('item', 'isancestor', item, des))
+ end
+ alias item_is_ancestor item_isancestor
+ alias item_isancestor? item_isancestor
+ alias item_is_ancestor? item_isancestor
+
+ def item_isopen(item)
+ bool(tk_send('item', 'isopen', item))
+ end
+ alias item_is_open item_isopen
+ alias item_isopen? item_isopen
+ alias item_is_open? item_isopen
+
+ def item_lastchild(parent, child=nil)
+ if child
+ tk_send('item', 'lastchild', parent, child)
+ self
+ else
+ num_or_str(tk_send('item', 'lastchild', parent))
+ end
+ end
+ alias item_last_child item_lastchild
+
+ def item_nextsibling(sibling, nxt=nil)
+ if nxt
+ tk_send('item', 'nextsibling', sibling, nxt)
+ self
+ else
+ num_or_str(tk_send('item', 'nextsibling', sibling))
+ end
+ end
+ alias item_next_sibling item_nextsibling
+
+ def item_numchildren()
+ number(tk_send('item', 'numchildren'))
+ end
+ alias item_num_children item_numchildren
+ alias item_children_size item_numchildren
+
+ def item_parent(item)
+ num_or_str(tk_send('item', 'parent', item))
+ end
+
+ def item_prevsibling(sibling, prev=nil)
+ if prev
+ tk_send('item', 'prevsibling', sibling, prev)
+ self
+ else
+ num_or_str(tk_send('item', 'prevsibling', sibling))
+ end
+ end
+ alias item_prev_sibling item_prevsibling
+
+ def item_remove(item)
+ list(tk_send('item', 'remove', item))
+ end
+
+ def item_rnc(item)
+ list(tk_send('item', 'rnc', item))
+ end
+
+ def item_sort(item, *opts)
+ flag = false
+ if opts[-1].kind_of?(Hash)
+ opts[-1,1] = __conv_item_keyonly_opts(item, opts[-1]).to_a
+ end
+
+ opts = opts.collect{|opt|
+ if opt.kind_of?(Array)
+ key = "-#{opt[0]}"
+ flag = true if key == '-notreally'
+ ["-#{opt[0]}", opt[1]]
+ else
+ key = "-#{opt}"
+ flag = true if key == '-notreally'
+ key
+ end
+ }.flatten
+
+ ret = tk_send('item', 'sort', item, *opts)
+ if flag
+ list(ret)
+ else
+ ret
+ end
+ end
+
+ def item_state_get(item, *args)
+ if args.empty?
+ list(tk_send('item', 'state', 'get', item *args))
+ else
+ bool(tk_send('item', 'state', 'get', item))
+ end
+ end
+
+ def item_state_set(item, *args)
+ tk_send('item', 'state', 'set', *args)
+ self
+ end
+
+ def item_style_elements(item, colun)
+ list(tk_send('item', 'style', 'elements', item, column))
+ end
+
+ def item_style_map(item, column, style, map)
+ tk_send('item', 'style', 'map', item, column, style, map)
+ self
+ end
+
+ def item_style_set(item, column=nil, *args)
+ if args.empty?
+ if column
+ tk_send('item', 'style', 'set', item, column)
+ else
+ list(tk_send('item', 'style', 'set', item))
+ end
+ else
+ tk_send('item', 'style', 'set', item, *(args.flatten))
+ self
+ end
+ end
+
+ def item_text(item, column, txt=nil, *args)
+ if args.empty?
+ if txt
+ tk_send('item', 'text', item, column, txt)
+ self
+ else
+ tk_send('item', 'text', item, column)
+ end
+ else
+ tk_send('item', 'text', item, txt, *args)
+ self
+ end
+ end
+
+ def item_visible(item, st=None)
+ if st == None
+ bool(tk_send('item', 'visible', item))
+ else
+ tk_send('item', 'visible', item, st)
+ self
+ end
+ end
+ def item_visible?(item)
+ item_visible(item)
+ end
+
+ def marquee_anchor(*args)
+ if args.empty?
+ list(tk_send('marquee', 'anchor'))
+ else
+ tk_send('marquee', 'anchor', *args)
+ self
+ end
+ end
+
+ def marquee_coords(*args)
+ if args.empty?
+ list(tk_send('marquee', 'coords'))
+ else
+ tk_send('marquee', 'coords', *args)
+ self
+ end
+ end
+
+ def marquee_corner(*args)
+ if args.empty?
+ tk_send('marquee', 'corner')
+ else
+ tk_send('marquee', 'corner', *args)
+ self
+ end
+ end
+
+ def marquee_identify()
+ list(tk_send('marquee', 'identify'))
+ end
+
+ def marquee_visible(st=None)
+ if st == None
+ bool(tk_send('marquee', 'visible'))
+ else
+ tk_send('marquee', 'visible', st)
+ self
+ end
+ end
+ def marquee_visible?()
+ marquee_visible()
+ end
+
+ def notify_bind(obj, event, cmd=Proc.new, args=nil)
+ _bind([@path, 'notify', 'bind', obj], event, cmd, args)
+ self
+ end
+
+ def notify_bind_append(obj, event, cmd=Proc.new, args=nil)
+ _bind([@path, 'notify', 'bind', obj], event, cmd, args)
+ self
+ end
+
+ def notify_bindinfo(obj, event=nil)
+ _bindinfo([@path, 'notify', 'bind', obj], event)
+ end
+
+ def notify_detailnames(event)
+ list(tk_send('notify', 'detailnames', event))
+ end
+
+ def notify_eventnames()
+ list(tk_send('notify', 'eventnames'))
+ end
+
+ def notify_generate(pattern, char_map=None)
+ tk_send('notify', 'generate', pattern, char_map)
+ self
+ end
+
+ def notify_install_detail(event, detail, percents_cmd=nil, &b)
+ percents_cmd = Proc.new(&b) if !percents_cmd && b
+ if percents_cmd
+ tk_send('notify', 'install', 'detail', event, detail, percents_cmd)
+ else
+ tk_send('notify', 'install', 'detail', event, detail)
+ end
+ end
+
+ def notify_install_event(event, percents_cmd=nil, &b)
+ percents_cmd = Proc.new(&b) if !percents_cmd && b
+ if percents_cmd
+ tk_send('notify', 'install', 'event', event, percents_cmd)
+ else
+ tk_send('notify', 'install', 'event', event)
+ end
+ end
+
+ def notify_linkage(event, detail=None)
+ tk_send('notify', 'linkage', event, detail)
+ end
+
+ def notify_uninstall_detail(event, detail)
+ tk_send('notify', 'uninstall', 'detail', event, detail)
+ self
+ end
+
+ def notify_uninstall_event(event)
+ tk_send('notify', 'uninstall', 'event', event)
+ self
+ end
+
+ def numcolumns()
+ num_or_str(tk_send('numcolumns'))
+ end
+
+ def numitems()
+ num_or_str(tk_send('numitems'))
+ end
+
+ def orphans()
+ list(tk_send('orphans'))
+ end
+
+ def range(first, last)
+ list(tk_send('range', first, last))
+ end
+
+ def state_define(name)
+ tk_send('state', 'define', name)
+ self
+ end
+
+ def state_linkage(name)
+ tk_send('state', 'linkage', name)
+ end
+
+ def state_names()
+ list(tk_send('state', 'names'))
+ end
+
+ def state_undefine(*names)
+ tk_send('state', 'undefine', *names)
+ self
+ end
+
+ def see(item)
+ tk_send('see', item)
+ self
+ end
+
+ def selection_add(first, last=None)
+ tk_send('selection', 'add', first, last)
+ self
+ end
+
+ def selection_anchor(item=None)
+ num_or_str(tk_send('selection', 'anchor', item))
+ end
+
+ def selection_clear(*args) # first, last
+ tk_send('selection', 'clear' *args)
+ self
+ end
+
+ def selection_count()
+ number(tk_send('selection', 'count'))
+ end
+
+ def selection_get()
+ list(tk_send('selection', 'get'))
+ end
+
+ def selection_includes(item)
+ bool(tk_send('selection', 'includes', item))
+ end
+
+ def selection_modify(sel, desel)
+ tk_send('selection', 'modify', sel, desel)
+ self
+ end
+
+ def style_create(style, keys=None)
+ if keys && keys != None
+ tk_send('style', 'create', style, *hash_kv(keys))
+ else
+ tk_send('style', 'create', style)
+ end
+ end
+
+ def style_delete(*args)
+ tk_send('style', 'delete', *args)
+ self
+ end
+
+ def style_elements(style, *elems)
+ if elems.empty?
+ list(tk_send('style', 'elements', style))
+ else
+ tk_send('style', 'elements', style, elems.flatten)
+ self
+ end
+ end
+
+ def style_layout(style, elem, keys=None)
+ if keys && keys != None
+ if keys.kind_of?(Hash)
+ tk_send('style', 'layout', style, elem, *hash_kv(keys))
+ self
+ else
+ tk_send('style', 'layout', style, elem, "-#{keys}")
+ end
+ else
+ list(tk_send('style', 'layout', style, elem))
+ end
+ end
+
+ def style_names()
+ list(tk_send('style', 'names'))
+ end
+
+ def toggle(*items)
+ tk_send('toggle', *items)
+ self
+ end
+
+ def toggle_recurse()
+ tk_send('toggle', '-recurse', *items)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/vu.rb b/ext/tk/lib/tkextlib/vu.rb
new file mode 100644
index 00000000000..923b67ce4e1
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu.rb
@@ -0,0 +1,40 @@
+#
+# The vu widget set support
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+require 'tk'
+
+# call setup script for general 'tkextlib' libraries
+require 'tkextlib/setup.rb'
+
+# library directory
+dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+# call setup script
+require File.join(dir, 'setup.rb')
+
+# load package
+# TkPackage.require('vu', '2.1')
+#TkPackage.require('vu')
+
+# autoload
+module Tk
+ module Vu
+ # load package
+ # VERSION = TkPackage.require('vu', '2.1')
+ VERSION = TkPackage.require('vu')
+
+ dir = File.expand_path(__FILE__).sub(/#{File.extname(__FILE__)}$/, '')
+
+ autoload :Dial, File.join(dir, 'dial')
+
+ autoload :Pie, File.join(dir, 'pie')
+ autoload :PieSlice, File.join(dir, 'pie')
+ autoload :NamedPieSlice, File.join(dir, 'pie')
+
+ autoload :Spinbox, File.join(dir, 'spinbox')
+
+ autoload :Bargraph, File.join(dir, 'bargraph')
+ end
+end
diff --git a/ext/tk/lib/tkextlib/vu/bargraph.rb b/ext/tk/lib/tkextlib/vu/bargraph.rb
new file mode 100644
index 00000000000..1dbd49db28d
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu/bargraph.rb
@@ -0,0 +1,50 @@
+#
+# ::vu::bargraph widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# create module/class
+module Tk
+ module Vu
+ class Bargraph < TkWindow
+ end
+ end
+end
+
+# call setup script -- <libdir>/tkextlib/vu.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+class Tk::Vu::Bargraph < TkWindow
+ TkCommandNames = ['::vu::bargraph'.freeze].freeze
+ WidgetClassName = 'Bargraph'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ###############################
+
+ def __boolval_optkeys
+ ['showminmax', 'showvalue']
+ end
+ private :__boolval_optkeys
+
+ def __listval_optkeys
+ ['alabels', 'blabels']
+ end
+ private :__listval_optkeys
+
+ def __font_optkeys
+ ['alabfont', 'blabfont']
+ end
+ private :__font_optkeys
+
+ ###############################
+
+ def set(val = None)
+ tk_call_without_enc(@path, 'set', val)
+ self
+ end
+
+ def get()
+ num_or_str(tk_call_without_enc(@path, 'get'))
+ end
+end
diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb
new file mode 100644
index 00000000000..bf2a3075bda
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu/charts.rb
@@ -0,0 +1,47 @@
+#
+# charts -- Create and manipulate canvas Add-On Items
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tk/canvas'
+
+# call setup script -- <libdir>/tkextlib/vu.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+module Tk
+ module Vu
+ module ChartsConfig
+ include TkItemConfigOptkeys
+ def __item_boolval_optkeys(id)
+ super(id) << 'lefttrunc' << 'autocolor'
+ end
+ private :__item_boolval_optkeys
+
+ def __item_listval_optkeys(id)
+ super(id) << 'values' << 'tags'
+ end
+ private :__item_listval_optkeys
+ end
+
+ class TkcSticker < TkcItem
+ include ChartsConfig
+
+ CItemTypeName = 'sticker'.freeze
+ CItemTypeToClass[CItemTypeName] = self
+ end
+
+ class TkcStripchart < TkcItem
+ include ChartsConfig
+
+ CItemTypeName = 'stripchart'.freeze
+ CItemTypeToClass[CItemTypeName] = self
+ end
+
+ class TkcBarchart < TkcItem
+ include ChartsConfig
+
+ CItemTypeName = 'barchart'.freeze
+ CItemTypeToClass[CItemTypeName] = self
+ end
+ end
+end
diff --git a/ext/tk/lib/tkextlib/vu/dial.rb b/ext/tk/lib/tkextlib/vu/dial.rb
new file mode 100644
index 00000000000..4d5770a3200
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu/dial.rb
@@ -0,0 +1,102 @@
+#
+# ::vu::dial widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+
+# create module/class
+module Tk
+ module Vu
+ class Dial < TkWindow
+ end
+ end
+end
+
+# call setup script -- <libdir>/tkextlib/vu.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+# define module/class
+class Tk::Vu::Dial < TkWindow
+ TkCommandNames = ['::vu::dial'.freeze].freeze
+ WidgetClassName = 'Dial'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ###############################
+
+ def __methodcall_optkeys # { key=>method, ... }
+ {'coords'=>'coords'}
+ end
+ private :__methodcall_optkeys
+
+ ###############################
+
+ def coords(val = nil)
+ if val
+ tk_split_list(tk_send_without_enc('coords'))
+ else
+ tk_send_without_enc('coords', val)
+ self
+ end
+ end
+
+ def constrain(val = None)
+ num_or_str(tk_call(@path, 'constrain', val))
+ end
+
+ def get(*args)
+ num_or_str(tk_call(@path, 'get', *args))
+ end
+
+ def identify(x, y)
+ tk_call(@path, 'identify', x, y)
+ end
+
+ def get_label(val=nil)
+ if val
+ tk_call(@path, 'label', val)
+ else
+ ret = []
+ lst = simplelist(tk_call(@path, 'label'))
+ while lst.size > 0
+ ret << ([num_or_str(lst.shift)] << lst.shift)
+ end
+ end
+ end
+
+ def set_label(val, str, *args)
+ tk_call(@path, 'label', val, str, *args)
+ self
+ end
+
+ def set_label_constrain(val, str, *args)
+ tk_call(@path, 'label', '-constrain', val, str, *args)
+ self
+ end
+
+ def get_tag(val=nil)
+ if val
+ tk_call(@path, 'tag', val)
+ else
+ ret = []
+ lst = simplelist(tk_call(@path, 'tag'))
+ while lst.size > 0
+ ret << ([num_or_str(lst.shift)] << lst.shift)
+ end
+ end
+ end
+
+ def set_tag(val, str, *args)
+ tk_call(@path, 'tag', val, str, *args)
+ self
+ end
+
+ def set_tag_constrain(val, str, *args)
+ tk_call(@path, 'tag', '-constrain', val, str, *args)
+ self
+ end
+
+ def set(val = None)
+ tk_call_without_enc(@path, 'set', val)
+ self
+ end
+end
diff --git a/ext/tk/lib/tkextlib/vu/pie.rb b/ext/tk/lib/tkextlib/vu/pie.rb
new file mode 100644
index 00000000000..833039c9f2b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu/pie.rb
@@ -0,0 +1,229 @@
+#
+# ::vu::pie widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+
+# create module/class
+module Tk
+ module Vu
+ module PieSliceConfigMethod
+ end
+ class Pie < TkWindow
+ end
+ class PieSlice < TkObject
+ end
+ class NamedPieSlice < PieSlice
+ end
+ end
+end
+
+# call setup script -- <libdir>/tkextlib/vu.rb
+require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+module Tk::Vu::PieSliceConfigMethod
+ include TkItemConfigMethod
+
+ def __item_pathname(tagOrId)
+ if tagOrId.kind_of?(Tk::Vu::PieSlice)
+ self.path + ';' + tagOrId.id.to_s
+ else
+ self.path + ';' + tagOrId.to_s
+ end
+ end
+ private :__item_pathname
+end
+
+class Tk::Vu::Pie < TkWindow
+ TkCommandNames = ['::vu::pie'.freeze].freeze
+ WidgetClassName = 'Pie'.freeze
+ WidgetClassNames[WidgetClassName] = self
+
+ ###############################
+
+ include Tk::Vu::PieSliceConfigMethod
+
+ def tagid(tag)
+ if tag.kind_of?(Tk::Vu::PieSlice)
+ tag.id
+ else
+ tag
+ end
+ end
+
+ ###############################
+
+ def delete(*glob_pats)
+ tk_call(@path, 'delete', *glob_pats)
+ self
+ end
+
+ def explode(slice, *args)
+ tk_call(@path, 'explode', slice, *args)
+ self
+ end
+
+ def explode_value(slice)
+ num_or_str(tk_call(@path, 'explode', slice))
+ end
+
+ def lower(slice, below=None)
+ tk_call(@path, 'lower', slice, below)
+ self
+ end
+
+ def names(*glob_pats)
+ simplelist(tk_call(@path, 'names', *glob_pats))
+ end
+ alias slices names
+
+ def order(*args)
+ tk_call(@path, 'order', *args)
+ self
+ end
+
+ def raise(slice, above=None)
+ tk_call(@path, 'raise', slice, above)
+ self
+ end
+
+ def swap(slice1, slice2)
+ tk_call(@path, 'swap', slice1, slice2)
+ self
+ end
+
+ def set(slice, *args)
+ num_or_str(tk_call(@path, 'set', slice, *args))
+ end
+ alias set_value set
+ alias set_values set
+ alias create set
+
+ def slice_value(slice)
+ num_or_str(tk_call(@path, 'set', slice))
+ end
+
+ def value(val = None)
+ num_or_str(tk_call_without_enc(@path, 'value'))
+ end
+ alias sum_value value
+end
+
+class Tk::Vu::PieSlice
+ SliceID_TBL = TkCore::INTERP.create_table
+ Pie_Slice_ID = ['vu_pie'.freeze, '00000'.taint].freeze
+ TkCore::INTERP.init_ip_env{ SliceID_TBL.clear }
+
+ def self.id2obj(pie, id)
+ pie_path = pie.path
+ return id unless SliceID_TBL[pie_path]
+ SliceID_TBL[pie_path][id]? SliceID_TBL[pie_path][id]: id
+ end
+
+ def initialize(parent, *args)
+ unless parent.kind_of?(Tk::Vu::Pie)
+ fail ArguemntError, "expect a Tk::Vu::Pie instance for 1st argument"
+ end
+ @parent = @pie = parent
+ @ppath = parent.path
+ @path = @id = Pie_Slice_ID.join(TkCore::INTERP._ip_id_)
+ SliceID_TBL[@ppath] = {} unless SliceID_TBL[@ppath]
+ SliceID_TBL[@ppath][@id] = self
+ Pie_Slice_ID[1].succ!
+
+ if args[-1].kind_of?(Hash)
+ keys = args.unshift
+ end
+ @pie.set(@id, *args)
+ configure(keys)
+ end
+
+ def id
+ @id
+ end
+
+ def [](key)
+ cget key
+ end
+
+ def []=(key,val)
+ configure key, val
+ val
+ end
+
+ def cget(slot)
+ @pie.itemcget(@id, slot)
+ end
+
+ def configure(*args)
+ @pie.itemconfigure(@id, *args)
+ self
+ end
+
+ def configinfo(*args)
+ @pie.itemconfiginfo(@id, *args)
+ end
+
+ def current_configinfo(*args)
+ @pie.current_itemconfiginfo(@id, *args)
+ end
+
+ def delete
+ @pie.delete(@id)
+ end
+
+ def explode(value)
+ @pie.explode(@id, value)
+ self
+ end
+
+ def explode_value
+ @pie.explode_value(@id)
+ end
+
+ def lower(other=None)
+ @pie.lower(@id, other)
+ self
+ end
+
+ def raise(other=None)
+ @pie.raise(@id, other)
+ self
+ end
+
+ def set(value)
+ @pie.set(@id, value)
+ self
+ end
+ alias set_value set
+
+ def value
+ @pie.set(@id)
+ end
+end
+
+class Tk::Vu::NamedPieSlice
+ def self.new(parent, name, *args)
+ if SliceID_TBL[parent.path] && SliceID_TBL[parent.path][name]
+ return SliceID_TBL[parent.path][name]
+ else
+ super(parent, name, *args)
+ end
+ end
+
+ def initialize(parent, name, *args)
+ unless parent.kind_of?(Tk::Vu::Pie)
+ fail ArguemntError, "expect a Tk::Vu::Pie instance for 1st argument"
+ end
+ @parent = @pie = parent
+ @ppath = parent.path
+ @path = @id = name.to_s
+ SliceID_TBL[@ppath] = {} unless SliceID_TBL[@ppath]
+ SliceID_TBL[@ppath][@id] = self
+
+ if args[-1].kind_of?(Hash)
+ keys = args.unshift
+ end
+ @pie.set(@id, *args)
+ configure(keys)
+ end
+end
diff --git a/ext/tk/lib/tkextlib/vu/setup.rb b/ext/tk/lib/tkextlib/vu/setup.rb
new file mode 100644
index 00000000000..ce0f0bd4d4b
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/ext/tk/lib/tkextlib/vu/spinbox.rb b/ext/tk/lib/tkextlib/vu/spinbox.rb
new file mode 100644
index 00000000000..db2743613c2
--- /dev/null
+++ b/ext/tk/lib/tkextlib/vu/spinbox.rb
@@ -0,0 +1,17 @@
+#
+# ::vu::spinbox widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+# a standard spinbox (<= 8.3)
+# This is the same as the 8.4 core spinbox widget.
+#
+
+if (Tk::TK_MAJOR_VERSION < 8 ||
+ (Tk::TK_MAJOR_VERSION == 8 && Tk::TK_MINOR_VERSION < 4))
+ # call setup script -- <libdir>/tkextlib/vu.rb
+ require(File.dirname(File.expand_path(__FILE__)) + '.rb')
+
+ Tk.tk_call('namespace', 'import', '::vu::spinbox')
+end
+
+Tk::Vu::Spinbox = TkSpinbox
diff --git a/ext/tk/sample/demos-en/paned2.rb b/ext/tk/sample/demos-en/paned2.rb
index c8c5abb470e..53c19c0ffaf 100644
--- a/ext/tk/sample/demos-en/paned2.rb
+++ b/ext/tk/sample/demos-en/paned2.rb
@@ -75,7 +75,7 @@ TkPanedwindow.new($paned2_demo, :orient=>:vertical){|f|
}
},
- TkFrame.new(f) {|paned2_bottom|
+ TkFrame.new(f, :height=>120) {|paned2_bottom|
# The bottom window is a text widget with scrollbar
paned2_xscr = TkScrollbar.new(paned2_bottom)
paned2_yscr = TkScrollbar.new(paned2_bottom)
diff --git a/ext/tk/sample/demos-jp/entry3.rb b/ext/tk/sample/demos-jp/entry3.rb
index f0e9bc868b2..4dff97a93ab 100644
--- a/ext/tk/sample/demos-jp/entry3.rb
+++ b/ext/tk/sample/demos-jp/entry3.rb
@@ -64,7 +64,7 @@ TkFrame.new($entry3_demo){|f|
# count - Counter to control the number of times flashed
def focusAndFlash(widget, fg, bg, count=5)
return if count <= 0
- TkTimer.new(200, count,
+ TkTimer.new(100, count,
proc{widget.configure(:foreground=>bg, :background=>fg)},
proc{widget.configure(:foreground=>fg, :background=>bg)}
).start
diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb
index 08598f88f82..e2f477da8ba 100644
--- a/ext/tk/sample/demos-jp/menu8x.rb
+++ b/ext/tk/sample/demos-jp/menu8x.rb
@@ -173,7 +173,8 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
TkMenu.new(m, 'tearoff'=>false) {|icon_menu|
m.add('cascade', 'label'=>'Icons', 'menu'=>icon_menu, 'underline'=>0)
add('command',
- 'bitmap'=>'@'+[$demo_dir,'images','pattern.bmp'].join(File::Separator),
+ 'bitmap'=>'@'+[$demo_dir,'..',
+ 'images','pattern.xbm'].join(File::Separator),
'hidemargin'=>1,
'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry',
'text'=>'今あなたが選択したメニューの項目はテキストではなくビットマップを表示していました。それ以外の点では他のメニュー項目と変わりません。',
diff --git a/ext/tk/sample/demos-jp/paned2.rb b/ext/tk/sample/demos-jp/paned2.rb
index b0261d50f02..c6b0f069143 100644
--- a/ext/tk/sample/demos-jp/paned2.rb
+++ b/ext/tk/sample/demos-jp/paned2.rb
@@ -78,7 +78,7 @@ TkPanedwindow.new($paned2_demo, :orient=>:vertical){|f|
}
},
- TkFrame.new(f) {|paned2_bottom|
+ TkFrame.new(f, :height=>120) {|paned2_bottom|
# The bottom window is a text widget with scrollbar
paned2_xscr = TkScrollbar.new(paned2_bottom)
paned2_yscr = TkScrollbar.new(paned2_bottom)
diff --git a/ext/tk/sample/optobj_sample.rb b/ext/tk/sample/optobj_sample.rb
new file mode 100644
index 00000000000..b7bab063243
--- /dev/null
+++ b/ext/tk/sample/optobj_sample.rb
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby
+#
+# sample script of Tk::OptionObj
+#
+require "tk"
+
+optobj = Tk::OptionObj.new('foreground'=>'red', 'background'=>'black')
+
+f = TkFrame.new.pack(:side=>:left, :anchor=>:n, :padx=>5, :pady=>30)
+
+b1 = TkButton.new(f, :text=>'AAA').pack(:fill=>:x)
+b2 = TkButton.new(f, :text=>'BBB').pack(:fill=>:x)
+b3 = TkButton.new(f, :text=>'CCC').pack(:fill=>:x)
+
+optobj.assign( b1,
+ [ b2, 'configure',
+ { 'foreground'=>'background',
+ 'background'=>'foreground' } ],
+ [ b3, nil,
+ { 'foreground'=>'background',
+ 'activeforeground'=>nil,
+ 'background'=>['foreground', 'activeforeground'] } ] )
+
+optobj.update('activeforeground'=>'yellow')
+
+TkButton.new(f){
+ configure( optobj.assign(self) + {:text=>'DDD'} )
+ pack(:fill=>:x)
+}
+
+TkButton.new(f){
+ configure( optobj.assign([self, nil,
+ {'foreground'=>'activeforeground',
+ 'background'=>'foreground',
+ 'activeforeground'=>'background'}]) \
+ + {:text=>'EEE', :relief=>:groove, :borderwidth=>5} )
+ pack(:fill=>:x)
+}
+
+optobj.notify # To apply the convert_key ( 3rd element of widget info
+ # (that is, {'foreground'=>'activeforeground', ,,, } )
+ # of the 'EEE' button
+
+TkButton.new(f, :text=>'toggle',
+ :command=>proc{
+ fg = optobj['foreground']
+ bg = optobj['background']
+ optobj.configure('foreground'=>bg, 'background'=>fg)
+ }).pack(:fill=>:x, :pady=>10)
+
+TkButton.new(f, :text=>'exit',
+ :command=>proc{exit}).pack(:fill=>:x, :pady=>10)
+
+TkFrame.new{|f|
+ pack(:side=>:right, :expand=>true, :fill=>:both)
+ TkLabel.new(f, :text=>'source::').pack(:anchor=>:w)
+ TkFrame.new(f){|ff|
+ TkText.new(ff){
+ yscrollbar(TkScrollbar.new(ff){pack(:fill=>:y, :side=>:right)})
+ insert('end', File.read(__FILE__))
+ pack(:side=>:left, :expand=>true, :fill=>:both)
+ }
+ pack(:expand=>true, :fill=>:both)
+ }
+}
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkcombobox.rb b/ext/tk/sample/tkcombobox.rb
index f0cbdac3bad..61ab2546914 100644
--- a/ext/tk/sample/tkcombobox.rb
+++ b/ext/tk/sample/tkcombobox.rb
@@ -62,6 +62,9 @@ EOD
delegate('relief', @frame)
delegate('borderwidth', @frame)
+ delegate_alias('arrowrelief', 'relief', @up_arrow, @down_arrow)
+ delegate_alias('arrowborderwidth', 'borderwidth', @up_arrow, @down_arrow)
+
scrollbar(keys.delete('scrollbar')){false}
configure keys unless keys.empty?
@@ -324,6 +327,9 @@ EOD
delegate('relief', @frame)
delegate('borderwidth', @frame)
+ delegate('arrowrelief', @lst)
+ delegate('arrowborderwidth', @lst)
+
if mode = keys.delete('scrollbar')
scrollbar(mode)
end
@@ -391,6 +397,7 @@ end
if __FILE__ == $0
v = TkVariable.new
e = TkCombobox.new(:height=>7, :scrollbar=>true, :textvariable=>v,
+ :arrowrelief=>:flat, :arrowborderwidth=>0,
:startwait=>400, :interval=>200).pack
e.values(%w(aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu))
#e.see(e.list_index('end') - 2)
diff --git a/ext/tk/sample/tkextlib/tcllib/datefield.rb b/ext/tk/sample/tkextlib/tcllib/datefield.rb
new file mode 100644
index 00000000000..1b0a29c0b91
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tcllib/datefield.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/ruby
+
+require 'tk'
+require 'tkextlib/tcllib/datefield'
+require 'parsedate'
+
+Tk.root.title('Datefield example')
+
+
+my_date1 = TkVariable.new
+my_date2 = TkVariable.new
+my_date1.trace('w'){
+ begin
+ t = Time.local(*(ParseDate.parsedate(my_date1.value)))
+ my_date2.value = t.strftime('%A')
+ rescue
+ # ignore error
+ end
+}
+
+df = Tk::Tcllib::Datefield.new(:textvariable=>my_date1)
+Tk.grid(TkLabel.new(:text=>'Enter a date:', :anchor=>:e), df, :sticky=>:ew)
+Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e),
+ TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12),
+ :sticky=>:ew)
+
+df.set_focus
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb
new file mode 100644
index 00000000000..6077d8ab2c9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb
@@ -0,0 +1,158 @@
+#!/usr/bin/ruby
+
+require 'tk'
+require 'tkextlib/tcllib/plotchart'
+
+###############################
+
+c1 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
+c2 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
+c3 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
+Tk.pack(c1,c2,c3, :fill=>:both, :side=>:top)
+
+h = TkToplevel.new(:title=>'h')
+hc1 = TkCanvas.new(h, :background=>'white', :width=>400, :height=>200)
+hc2 = TkCanvas.new(h, :background=>'white', :width=>400, :height=>200)
+Tk.pack(hc1,hc2, :fill=>:both, :side=>:top)
+
+v = TkToplevel.new(:title=>'v')
+vc1 = TkCanvas.new(v, :background=>'white', :width=>400, :height=>200)
+vc2 = TkCanvas.new(v, :background=>'white', :width=>400, :height=>200)
+vc3 = TkCanvas.new(v, :background=>'white', :width=>400, :height=>200)
+Tk.pack(vc1,vc2,vc3, :fill=>:both, :side=>:top)
+
+###############################
+
+s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0],
+ [0.0, 100.0, 20.0])
+
+
+xd = 5.0
+yd = 20.0
+xold = 0.0
+yold = 50.0
+
+s.dataconfig('series1', :color=>'red')
+
+(0..19).each{|i|
+ xnew = xold + xd
+ ynew = yold + (rand() - 0.5) * yd
+ ynew2 = yold + (rand() - 0.5) * 2.0 * yd
+ s.plot('series1', xnew, ynew)
+ s.plot('series2', xnew, ynew2)
+ xold = xnew
+ yold = ynew
+}
+
+s.xtext "X-coordinate"
+s.ytext "Y-data"
+s.title "Aha!"
+
+c1.wait_visibility
+
+s.save_plot "aha.ps"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::Piechart.new(c2)
+
+s.plot([ ["Long names", 10], ["Short names", 30],
+ ["Average", 40], ["Ultra-short names", 5] ])
+
+#
+# Note: title should be shifted up
+# - distinguish a separate title area
+#
+s.title "Okay - this works"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::PolarPlot.new(c3, [3.0, 1.0])
+
+0.step(359, 10){|angle|
+ rad = 1.0+Math.cos(angle*Math::PI/180.0)
+ s.plot('cardioid', rad, angle)
+}
+
+s.title "Cardioid"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E),
+ [0.0, 10.0, 2.0], 2)
+
+s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red')
+s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green')
+s.title "Arbitrary data"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E),
+ [0.0, 20.0, 5.0], :stacked)
+
+s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red')
+s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green')
+s.title "Stacked diagram"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0],
+ %w(A B C D E), 2)
+
+s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red')
+s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green')
+s.title "Arbitrary data"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0],
+ %w(A B C D E), :stacked)
+
+s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red')
+s.plot('series2', [0.0, 3.0, 7.0, 9.3, 2.0], 'green')
+s.title "Stacked diagram"
+
+###############################
+
+s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004",
+ "31 december 2004", 4)
+
+s.period("Spring", "1 march 2004", "1 june 2004", 'green')
+s.period("Summer", "1 june 2004", "1 september 2004", 'yellow')
+s.vertline("1 jan", "1 january 2004")
+s.vertline("1 apr", "1 april 2004")
+s.vertline("1 jul", "1 july 2004")
+s.vertline("1 oct", "1 october 2004")
+s.milestone("Longest day", "21 july 2004")
+s.title "Seasons (northern hemisphere)"
+
+###############################
+
+z = TkToplevel.new(:title=>'3D')
+
+zc1 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>300)
+zc2 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>250)
+Tk.pack(zc1,zc2)
+
+s = Tk::Tcllib::Plotchart::Plot3D.new(zc1,
+ [0, 10, 3], [-10, 10, 10], [0, 10, 2.5])
+
+s.title "3D Plot"
+s.plot_function{|x, y|
+ # cowboyhat
+ x1 = x.to_f/9.0
+ y1 = y.to_f/9.0
+ 3.0 * (1.0-(x1*x1+y1*y1))*(1.0-(x1*x1+y1*y1))
+}
+
+s = Tk::Tcllib::Plotchart::Plot3D.new(zc2,
+ [0, 10, 3], [-10, 10, 10], [0, 10, 2.5])
+s.title "3D Plot - data "
+s.colour("green", "black")
+s.plot_data([ [1.0, 2.0, 1.0, 0.0],
+ [1.1, 3.0, 1.1, -0.5],
+ [3.0, 1.0, 4.0, 5.0] ])
+
+###############################
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb
new file mode 100644
index 00000000000..3fd57f3804e
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb
@@ -0,0 +1,71 @@
+#!/usr/bin/ruby
+
+require 'tk'
+require 'tkextlib/tcllib/plotchart'
+
+###############################
+
+c1 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
+c2 = TkCanvas.new(:background=>'white', :width=>400, :height=>200)
+Tk.pack(c1,c2, :fill=>:both, :side=>:top)
+
+###############################
+# Set up a strip chart
+###############################
+slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0],
+ [0.0, 100.0, 20.0])
+
+TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object
+ slipchart, xold, xd, yold, yd = obj.return_value
+ xnew = xold + xd
+ ynew = yold + (rand() - 0.5) * yd
+ ynew2 = yold + (rand() - 0.5) * 2.0 * yd
+ slipchart.plot('series1', xnew, ynew)
+ slipchart.plot('series2', xnew, ynew2)
+ obj.stop if xnew >= 200
+ [slipchart, xnew, xd, ynew, yd] # return_value
+ }).start(100, proc{
+ # init return_value
+ [slipchart, 0.0, 15.0, 50.0, 30.0]
+ })
+
+slipchart.title "Aha!"
+
+###############################
+# Set up an isometric plot
+###############################
+s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0],
+ :noaxes)
+
+s.set_zoom_pan
+
+s.plot('rectangle', [10.0, 10.0, 50.0, 50.0], 'green')
+s.plot('filled-rectangle', [20.0, 20.0, 40.0, 40.0], 'red')
+s.plot('filled-circle', [70.0, 70.0, 40.0], 'yellow')
+s.plot('circle', [70.0, 70.0, 42.0])
+
+###############################
+# Check the symbols
+###############################
+h = TkToplevel.new(:title=>'h')
+c = TkCanvas.new(h, :bg=>'white', :width=>400, :height=>200).pack(:fill=>:both)
+
+s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0],
+ [0.0, 100.0, 20.0])
+s.dataconfig('series1', :colour=>'red', :type=>:symbol)
+s.dataconfig('series2', :colour=>'green', :type=>:both)
+
+s.yconfig(:format=>"%12.2e")
+
+x = 5.0
+%w(plus cross circle up down dot upfilled downfilled).each{|sym|
+ s.dataconfig('series1', :symbol=>sym)
+ s.dataconfig('series2', :symbol=>sym)
+ s.plot('series1', x, 50.0)
+ s.plot('series2', x, 20)
+ x += 10
+}
+
+##############################
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb
new file mode 100644
index 00000000000..3b74b1f5924
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb
@@ -0,0 +1,83 @@
+#!/usr/bin/ruby
+
+require 'tk'
+require 'tkextlib/tcllib/plotchart'
+
+###############################
+# Set up a strip chart
+###############################
+
+Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0],
+ [0.0, 100.0, 20.0],
+ :background=>'white',
+ :width=>400, :height=>200){|chart|
+ title "Aha!"
+ pack(:fill=>:both, :side=>:top)
+
+ series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart)
+ series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart)
+
+ xd = 15.0
+ yd = 30.0
+
+ TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object
+ xold, yold = obj.return_value
+ xnew = xold + xd
+ ynew = yold + (rand() - 0.5) * yd
+ ynew2 = yold + (rand() - 0.5) * 2.0 * yd
+
+ series1.plot(xnew, ynew)
+ series2.plot(xnew, ynew2)
+
+ obj.stop if xnew >= 200
+
+ [xnew, ynew] # return_value
+ }).start(100, proc{ [0.0, 50.0] }) # init return_value
+}
+
+###############################
+# Set up an isometric plot
+###############################
+Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes,
+ :background=>'white',
+ :width=>400, :height=>200){|chart|
+ pack(:fill=>:both, :side=>:top)
+ set_zoom_pan
+
+ chart.plot('rectangle', [10.0, 10.0, 50.0, 50.0], 'green')
+ chart.plot('filled-rectangle', [20.0, 20.0, 40.0, 40.0], 'red')
+ chart.plot('filled-circle', [70.0, 70.0, 40.0], 'yellow')
+ chart.plot('circle', [70.0, 70.0, 42.0])
+}
+
+###############################
+# Check the symbols
+###############################
+TkToplevel.new(:title=>'h'){|h|
+ Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0],
+ [0.0, 100.0, 20.0],
+ :bg=>'white',
+ :width=>400, :height=>200){|chart|
+ pack(:fill=>:both)
+
+ yconfig(:format=>"%12.2e")
+
+ series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red',
+ :type=>:symbol)
+ series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green',
+ :type=>:both)
+
+ x = 5.0
+ %w(plus cross circle up down dot upfilled downfilled).each{|sym|
+ series1.dataconfig(:symbol=>sym)
+ series2.dataconfig(:symbol=>sym)
+ series1.plot(x, 50.0)
+ series2.plot(x, 20)
+ x += 10
+ }
+ }
+}
+
+##############################
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tcllib/xyplot.rb b/ext/tk/sample/tkextlib/tcllib/xyplot.rb
new file mode 100644
index 00000000000..116609e34f3
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tcllib/xyplot.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/ruby
+
+require 'tk'
+require 'tkextlib/tcllib/plotchart'
+
+TkCanvas.new(:background=>'white', :width=>400, :height=>200){|c|
+ pack(:fill=>:both)
+ Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0],
+ [0.0, 100.0, 20.0]){
+ [ [0.0, 32.0], [10.0, 50.0], [25.0, 60.0], [78.0, 11.0] ].each{|x, y|
+ plot('series1', x, y)
+ }
+ title("Data series")
+ }
+}
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tkHTML/README b/ext/tk/sample/tkextlib/tkHTML/README
new file mode 100644
index 00000000000..1208e270b44
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/README
@@ -0,0 +1,12 @@
+
+ [ TkHtml widget example ]
+
+The directory page1 -- page4 are referd from "test" directory of
+original TkHtml extension's source archive.
+( see http://www.hwaci.com/sw/tkhtml/index.html )
+
+You can see the HTML documents on the 'hv.rb' or 'ss.rb' sample script.
+
+ e.g.
+ LD_LIBRARY_PATH=/usr/local/ActiveTcl/lib:$LD_LIBRARY_PATH /usr/local/bin/ruby ./hv.rb page1/index.html
+
diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb
new file mode 100644
index 00000000000..cf93ad3ba53
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb
@@ -0,0 +1,306 @@
+#!/usr/bin/env ruby
+#
+# This script implements the "hv" application. Type "hv FILE" to
+# view FILE as HTML.
+#
+# This application is used for testing the HTML widget. It can
+# also server as an example of how to use the HTML widget.
+#
+require 'tk'
+require 'tkextlib/tkHTML'
+
+root = TkRoot.new(:title=>'HTML File Viewer', :iconname=>'HV')
+
+file = ARGV[0]
+
+#
+# These images are used in place of GIFs or of form elements
+#
+biggray = TkPhotoImage.new(:data=><<'EOD')
+ R0lGODdhPAA+APAAALi4uAAAACwAAAAAPAA+AAACQISPqcvtD6OctNqLs968+w+G4kiW5omm
+ 6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNFgsAO///
+EOD
+
+smgray = TkPhotoImage.new(:data=><<'EOD')
+ R0lGODdhOAAYAPAAALi4uAAAACwAAAAAOAAYAAACI4SPqcvtD6OctNqLs968+w+G4kiW5omm
+ 6sq27gvH8kzX9m0VADv/
+EOD
+
+nogifbig = TkPhotoImage.new(:data=><<'EOD')
+ R0lGODdhJAAkAPEAAACQkADQ0PgAAAAAACwAAAAAJAAkAAACmISPqcsQD6OcdJqKM71PeK15
+ AsSJH0iZY1CqqKSurfsGsex08XuTuU7L9HywHWZILAaVJssvgoREk5PolFo1XrHZ29IZ8oo0
+ HKEYVDYbyc/jFhz2otvdcyZdF68qeKh2DZd3AtS0QWcDSDgWKJXY+MXS9qY4+JA2+Vho+YPp
+ FzSjiTIEWslDQ1rDhPOY2sXVOgeb2kBbu1AAADv/
+EOD
+
+nogifsm = TkPhotoImage.new(:data=><<'EOD')
+ R0lGODdhEAAQAPEAAACQkADQ0PgAAAAAACwAAAAAEAAQAAACNISPacHtD4IQz80QJ60as25d
+ 3idKZdR0IIOm2ta0Lhw/Lz2S1JqvK8ozbTKlEIVYceWSjwIAO///
+EOD
+
+#
+# define variables
+#
+ul_hyper = TkVariable.new(0)
+show_tbl = TkVariable.new(0)
+show_img = TkVariable.new(1)
+
+#
+# A font chooser routine.
+#
+# html[:fontcommand] = pick_font
+pick_font = proc{|size, attrs|
+ puts "FontCmd: #{size} #{attrs}"
+ [ ((attrs =~ /fixed/)? 'courier': 'charter'),
+ (12 * (1.2**(size.to_f - 4.0))).to_i,
+ ((attrs =~ /italic/)? 'italic': 'roman'),
+ ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ')
+}
+
+#
+# This routine is called for each form element
+#
+form_cmd = proc{|n, cmd, style, *args|
+ # puts "FormCmd: $n $cmd $args"
+ case cmd
+ when 'select', 'textarea', 'input'
+ TkLabel.new(:widgetname=>args[0], :image=>nogifsm)
+ end
+}
+
+#
+# This routine is called for every <IMG> markup
+#
+images = {}
+old_imgs = {}
+big_imgs = {}
+
+hotkey = {}
+
+move_big_image = proc{|b|
+ return unless big_imgs.key?(b)
+ b.copy(big_imgs[b])
+ big_imgs[b].delete
+ big_imgs.delete(b)
+ Tk.update
+}
+
+image_cmd = proc{|*args|
+ return smgray unless show_img.bool
+ fn = args[0]
+ if old_imgs.key?(fn)
+ images[fn] = old_imgs[fn]
+ old_imgs.delete(fn)
+ return images[fn]
+ end
+
+ begin
+ img = TkPhotoImage.new(:file=>fn)
+ rescue
+ return smgray
+ end
+
+ if img.width * img.height > 20000
+ b = TkPhotoImage.new(:width=>img.width, :height=>img.height)
+ big_imgs[b] = img
+ img = b
+ Tk.after_idle(proc{ move_big_image.call(b) })
+ end
+
+ images[fn] = img
+
+ img
+}
+
+#
+# This routine is called for every <SCRIPT> markup
+#
+script_cmd = proc{|*args|
+ # puts "ScriptCmd: #{args.inspect}"
+}
+
+# This routine is called for every <APPLET> markup
+#
+applet_cmd = proc{|w, arglist|
+ # puts "AppletCmd: w=#{w} arglist=#{arglist}"
+ TkLabel.new(w, :text=>"The Applet #{w}", :bd=>2, :relief=>raised)
+}
+
+#
+# Construct the main HTML viewer
+#
+html = Tk::HTML_Widget.new(:padx=>5, :pady=>9,
+ :formcommand=>form_cmd,
+ :imagecommand=>image_cmd,
+ :scriptcommand=>script_cmd,
+ :appletcommand=>applet_cmd,
+ :underlinehyperlinks=>0,
+ :bg=>'white', :tablerelief=>:raised)
+vscr = html.yscrollbar(TkScrollbar.new)
+hscr = html.xscrollbar(TkScrollbar.new)
+
+Tk.grid(html, vscr, :sticky=>:news)
+Tk.grid(hscr, :sticky=>:ew)
+Tk.root.grid_columnconfigure(0, :weight=>1)
+Tk.root.grid_columnconfigure(1, :weight=>0)
+Tk.root.grid_rowconfigure(0, :weight=>1)
+Tk.root.grid_rowconfigure(1, :weight=>0)
+
+#
+# This procedure is called when the user clicks on a hyperlink.
+#
+priv = {}
+last_file = ''
+
+# Read a file
+#
+read_file = proc{|name|
+ begin
+ fp = open(name, 'r')
+ ret = fp.read(File.size(name))
+ rescue
+ ret = nil
+ fp = nil
+ Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'",
+ :type=>:ok)
+ ensure
+ fp.close if fp
+ end
+ ret
+}
+
+# Clear the screen.
+#
+clear_screen = proc{
+ html.clear
+ old_imgs.clear
+ big_imgs.clear
+ hotkey.clear
+ images.each{|k, v| old_imgs[k] = v }
+ images.clear
+}
+
+# Load a file into the HTML widget
+#
+load_file = proc{|name|
+ return unless (doc = read_file.call(name))
+ clear_screen.call
+ last_file = name
+ html.configure(:base=>name)
+ html.parse(doc)
+ old_imgs.clear
+}
+
+href_binding = proc{|x, y|
+ # koba & dg marking text
+ html.selection_clear
+ priv['mark'] = "@#{x},#{y}"
+ lst = html.href(x, y)
+ return if lst.size.zero?
+
+ lnk, target = lst
+
+ if lnk != ""
+ if lnk =~ /^#{last_file}#(.*)$/
+ html.yview($1)
+ else
+ load_file.call(lnk)
+ end
+ end
+}
+html.clipping_window.bind('1', href_binding, '%x %y')
+
+# marking text with the mouse and copying to the clipboard just with tkhtml2.0 working
+html.clipping_window.bind('B1-Motion', proc{|w, x, y|
+ w.selection_set(priv['mark'], "@#{x},#{y}")
+ TkClipboard.clear
+ # avoid tkhtml0.0 errors
+ # anyone can fix this for tkhtml0.0
+ begin
+ TkClipboard.append(TkSelection.get)
+ rescue
+ end
+ }, '%W %x %y')
+
+# This procedure is called when the user selects the File/Open
+# menu option.
+#
+last_dir = Dir.pwd
+sel_load = proc{
+ filetypes = [
+ ['Html Files', ['.html', '.htm']],
+ ['All Files', '*']
+ ]
+
+ f = Tk.getOpenFile(:initialdir=>last_dir, :filetypes=>filetypes)
+ if f != ''
+ load_file.call(f)
+ last_dir = File.dirname(f)
+ end
+}
+
+# Refresh the current file.
+#
+refresh = proc{|*args|
+ load_file.call(last_file)
+}
+
+# This binding changes the cursor when the mouse move over
+# top of a hyperlink.
+#
+Tk::HTML_Widget::ClippingWindow.bind('Motion', proc{|w, x, y|
+ parent = w.winfo_parent
+ url = parent.href(x, y)
+ unless url.empty?
+ parent[:cursor] = 'hand2'
+ else
+ parent[:cursor] = ''
+ end
+ }, '%W %x %y')
+#
+# Setup menu
+#
+menu_spec = [
+ [['File', 0],
+ ['Open', sel_load, 0],
+ ['Refresh', refresh, 0],
+ '---',
+ ['Exit', proc{exit}, 1]],
+
+ [['View', 0],
+ ['Underline Hyperlinks', ul_hyper],
+ ['Show Table Structure', show_tbl],
+ ['Show Images', show_img]]
+]
+
+mbar = Tk.root.add_menubar(menu_spec)
+
+#
+# Setup trace
+#
+ul_hyper.trace('w', proc{
+ html[:underlinehyperlinks] = ul_hyper.value
+ refresh.call
+ })
+
+show_tbl.trace('w', proc{
+ if show_tbl.bool
+ html[:tablerelief] = :flat
+ else
+ html[:tablerelief] = :raised
+ end
+ refresh.call
+ })
+
+show_img.trace('w', refresh)
+
+# If an arguent was specified, read it into the HTML widget.
+#
+Tk.update
+if file && file != ""
+ load_file.call(file)
+end
+
+#####################################
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image1 b/ext/tk/sample/tkextlib/tkHTML/page1/image1
new file mode 100644
index 00000000000..31e96b6797b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image1
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image10 b/ext/tk/sample/tkextlib/tkHTML/page1/image10
new file mode 100644
index 00000000000..80a8f816867
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image10
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image11 b/ext/tk/sample/tkextlib/tkHTML/page1/image11
new file mode 100644
index 00000000000..e8cb01d450a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image11
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image12 b/ext/tk/sample/tkextlib/tkHTML/page1/image12
new file mode 100644
index 00000000000..c317bbd5cc3
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image12
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image13 b/ext/tk/sample/tkextlib/tkHTML/page1/image13
new file mode 100644
index 00000000000..ac4b3cd5946
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image13
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image14 b/ext/tk/sample/tkextlib/tkHTML/page1/image14
new file mode 100644
index 00000000000..c3b02558e38
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image14
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image2 b/ext/tk/sample/tkextlib/tkHTML/page1/image2
new file mode 100644
index 00000000000..da26d7092e2
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image2
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image3 b/ext/tk/sample/tkextlib/tkHTML/page1/image3
new file mode 100644
index 00000000000..d91cdfafab9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image3
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image4 b/ext/tk/sample/tkextlib/tkHTML/page1/image4
new file mode 100644
index 00000000000..5fdf70c0e5b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image4
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image5 b/ext/tk/sample/tkextlib/tkHTML/page1/image5
new file mode 100644
index 00000000000..67cd14d78da
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image5
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image6 b/ext/tk/sample/tkextlib/tkHTML/page1/image6
new file mode 100644
index 00000000000..9e05aa0f361
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image6
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image7 b/ext/tk/sample/tkextlib/tkHTML/page1/image7
new file mode 100644
index 00000000000..879656d45ca
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image7
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image8 b/ext/tk/sample/tkextlib/tkHTML/page1/image8
new file mode 100644
index 00000000000..8c647c4f00a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image8
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/image9 b/ext/tk/sample/tkextlib/tkHTML/page1/image9
new file mode 100644
index 00000000000..3a7707589b9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/image9
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page1/index.html b/ext/tk/sample/tkextlib/tkHTML/page1/index.html
new file mode 100644
index 00000000000..9efac7f7af5
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page1/index.html
@@ -0,0 +1,115 @@
+<HTML><HEAD><TITLE>Slashdot:News for Nerds. Stuff that Matters.</TITLE> </HEAD>
+<BODY bgcolor="#000000" text="#000000" link="#006666" vlink="#000000">
+<center><a href="http://209.207.224.220/redir.pl?1463" target="_top"><img src="image1" alt="Click Here to enter the Sweepstakes" border="2" width="468" height="60"></a></center> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD WIDTH="1"><SCRIPT LANGUAGE="JAVASCRIPT">
+<!-- now="now" ="" new="new" Date();="Date();" tail="tail" ="" now.getTime();="now.getTime();" document.write("<IMG="document.write("<IMG" SRC="http://209.207.224.245/Slashdot/pc.gif?/slashhead.inc,"+" tail="tail" +="+" "=""" WIDTH="1" HEIGHT="1><BR>");" -->
+</SCRIPT>
+<NOSCRIPT>
+<IMG SRC="image2" WIDTH="1" HEIGHT="1">
+</NOSCRIPT></TD></TR></TABLE><P>
+<TABLE bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" width="99%" align="center">
+ <TR>
+ <TD valign="top" align="left" valign="top"><A href="http://slashdot.org/"><IMG src="image3" width="275" height="72" border="0" alt="Welcome to Slashdot"></A></TD>
+ <TD><A href="http://slashdot.org/search.pl?topic=linux"><IMG SRC="image4" width="60" height="70" border="0" alt="Linux"></A></TD>
+<TD><A href="http://slashdot.org/search.pl?topic=news"><IMG SRC="image5" width="34" height="44" border="0" alt="News"></A></TD>
+<TD><A href="http://slashdot.org/search.pl?topic=usa"><IMG SRC="image6" width="80" height="61" border="0" alt="United States"></A></TD>
+<TD><A href="http://slashdot.org/search.pl?topic=ed"><IMG SRC="image7" width="87" height="64" border="0" alt="Education"></A></TD>
+<TD><A href="http://slashdot.org/search.pl?topic=space"><IMG SRC="image8" width="73" height="59" border="0" alt="Space"></A></TD>
+
+</TR></TABLE>
+<TABLE width="99%" align="center" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF"><TR>
+<TD valign="top" rowspan="5"><NOBR><FONT size="2"><B>
+&nbsp;<A href="/faq.shtml">faq</A> <BR>
+&nbsp;<A href="/code.shtml">code</A> <BR>
+&nbsp;<A href="/awards.shtml">awards</A> <BR>
+&nbsp;<A href="http://Andover.Net/privacy.html">privacy</A> <BR>
+&nbsp;<A href="http://slashnet.org">slashNET</A> <BR>
+&nbsp;<A href="/search.pl">older stuff</A> <BR>
+&nbsp;<A href="http://cmdrtaco.net">rob's page</A> <BR>
+&nbsp;<A href="/users.pl?op=preferences">preferences</A> <BR>
+&nbsp;<A href="http://Andover.Net">andover.net</A> <BR>
+&nbsp;<A href="/submit.pl">submit story</A> <BR>
+&nbsp;<A href="/advertising.shtml">advertising</A> <BR>
+&nbsp;<A href="/supporters.shtml">supporters</A> <BR>
+&nbsp;<A href="/pollBooth.pl">past polls</A> <BR>
+&nbsp;<A href="/topics.shtml">topics</A> <BR>
+&nbsp;<A href="/about.shtml">about</A> <BR>
+&nbsp;<A href="/jobs.shtml">jobs</A> <BR>
+&nbsp;<A href="/hof.shtml">hof</A>
+
+</B></FONT></NOBR>
+ <P><TABLE border="0" cellpadding="1" cellspacing="0" align="center" bgcolor="#CCCCCC"><TR>
+ <TD><FONT size="2" color="#000000"><B> Sections</B></FONT></TD></TR>
+ <TR><TD><TABLE border="0" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF" width="100%"><TR><TD><FONT color="#000000" size="2"><NOBR>
+1/23<BR>
+<B><A href="http://slashdot.org/index.pl?section=apache">apache</A></B><BR>
+1/29 (3)<BR>
+<B><A href="http://slashdot.org/index.pl?section=askslashdot">askslashdot</A></B><BR>
+1/27<BR>
+<B><A href="http://slashdot.org/index.pl?section=awards">awards</A></B><BR>
+1/29 (2)<BR>
+<B><A href="http://slashdot.org/index.pl?section=books">books</A></B><BR>
+1/27<BR>
+<B><A href="http://slashdot.org/index.pl?section=bsd">bsd</A></B><BR>
+1/28 (2)<BR>
+<B><A href="http://slashdot.org/index.pl?section=features">features</A></B><BR>
+1/28 (2)<BR>
+<B><A href="http://slashdot.org/index.pl?section=interviews">interviews</A></B><BR>
+1/19<BR>
+<B><A href="http://slashdot.org/index.pl?section=radio">radio</A></B><BR>
+1/27 (2)<BR>
+<B><A href="http://slashdot.org/index.pl?section=science">science</A></B><BR>
+1/28 (3)<BR>
+<B><A href="http://slashdot.org/index.pl?section=yro">yro</A></B><BR> </NOBR></FONT></TD></TR></TABLE><TR>
+ <TD><A href="http://andover.net"><FONT size="2" color="#000000"><B>Andover.Net</B></FONT></A></TD></TR>
+ <TR><TD><TABLE border="0" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF"><TR><TD>
+<FONT color="#000000" size="2"><NOBR><A href="http://www.andovernews.com">AndoverNews</A><BR><A href="http://www.askreggie.com">Ask Reggie</A><BR><A href="http://www.davecentral.com">DaveCentral</A><BR><A href="http://www.freecode.com">FreeCode</A><BR><A href="http://www.mediabuilder.com">MediaBuilder</A><BR> </NOBR></FONT></TD></TR></TABLE></TD></TR></TABLE></P>
+ <P></P>
+</TD><TD valign="top" align="left"><FONT color="#000000"> <TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Who Bought Linux.Net?</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=linux"><IMG src="image4" width="60" height="70" border="0" align="right" hspace="20" vspace="10" alt="Linux"></A> <B>Posted by <A href="http://CmdrTaco.net">CmdrTaco</A> on Saturday January 29, @10:52AM</B><BR> <FONT size="2"><B>from the this-game-again dept.</B></FONT><BR> So Fred VanKampen (who has to hold the record for most money made by reselling two domain names) e-mailed us to say that the Domain Name for 'Linux.Net' has been sold. He won't say to whom, but it supposedly will be announced at LinuxWorld next week. Of course we have no idea what he got for the entry, but the rumors were that he made several million when he sold <A href="http://www.linux.com">Linux.com</A> to <A href="http://www.valinux.com">VA Linux</A>. Hopefully he'll take me for a ride in his yacht. ;) <P><B>( </B><A href="http://slashdot.org/articles/00/01/29/0837235.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/29/0837235&mode=thread&threshold=0">58</A> of <A href="http://slashdot.org/article.pl?sid=00/01/29/0837235&mode=thread&threshold=-1">62</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Book Reviews: E-Mails from (Over?) The Edge</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=news"><IMG src="image5" width="34" height="44" border="0" align="right" hspace="20" vspace="10" alt="News"></A> <B>Posted by <A href="http://hemos.net">Hemos</A> on Saturday January 29, @10:43AM</B><BR> <FONT size="2"><B>from the touching-story dept.</B></FONT><BR> I'd like to thank the author of this book for sending it to me. Nick's written a book that's touching and endearing, and one that's well worth reading for everyone who's ever had social struggles to deal with. As well, his involvement with the fine folks of <a href="http://www.thevenue.org">TheVenue</a>. I'll warn you - it's not a tech text. But it's still worth reading. Click below to read more. <P><B>( </B><A href="http://slashdot.org/books/00/01/24/1146250.shtml"><B>Read More...</B></A> | <A href="http://slashdot.org/article.pl?sid=00/01/24/1146250&mode=nocomment">6197 bytes in body</A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/24/1146250&mode=thread&threshold=0">6</A> of <A href="http://slashdot.org/article.pl?sid=00/01/24/1146250&mode=thread&threshold=-1">22</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Linux Kernel 2.3.41</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=linux"><IMG src="image4" width="60" height="70" border="0" align="right" hspace="20" vspace="10" alt="Linux"></A> <B>Posted by <A href="http://CmdrTaco.net">CmdrTaco</A> on Saturday January 29, @10:21AM</B><BR> <FONT size="2"><B>from the download-compile-reboot-repeat dept.</B></FONT><BR> <A href="mailto:bwhitehead@nospam.acm.org">sdriver</A> writes <I>"For those of us who enjoy *panic*, *oops*, and suddenly seeing their video BIOS... the newest version is out! Be the first on your block to submit a new patch! ;) "</I> If you don't know where to get it, you probably should stick to your warm and cuddly 2.2.x kernel *grin*. Now outta my way, I wanna crash my laptop! <P><B>( </B><A href="http://slashdot.org/articles/00/01/29/0834223.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/29/0834223&mode=thread&threshold=0">52</A> of <A href="http://slashdot.org/article.pl?sid=00/01/29/0834223&mode=thread&threshold=-1">57</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Congress Still Figuring Out E-Mail</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=usa"><IMG src="image6" width="80" height="61" border="0" align="right" hspace="20" vspace="10" alt="United States"></A> <B>Posted by <A href="mailto:roblimo@slashdot.org">Roblimo</A> on Saturday January 29, @07:28AM</B><BR> <FONT size="2"><B>from the voice-of-the-people-can-get-awfully-loud dept.</B></FONT><BR> Jett writes <I>" <A href="http://www.vote.com/">Vote.com</A> has <A href="http://www.vote.com/magazine/editorials/editorial1843752.phtml">an interesting article</A> in their Webmag Fifth Estate about how congressmen have responded to the popularity of e-mail in their daily operations. Quote: 'Of the 440 voting and non-voting House of Representatives members, 22 have no e-mail at all. Even House Speaker Dennis Hastert is wired only halfway -- his office receives e-mail, but does not respond to it. And while all U.S. senators have e-mail, they, like their House counterparts, routinely shun non-constituent mail -- even though they chair committees whose decisions affect the entire country.'"</I> <P><B>( </B><A href="http://slashdot.org/articles/00/01/28/2311232.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/28/2311232&mode=thread&threshold=0">66</A> of <A href="http://slashdot.org/article.pl?sid=00/01/28/2311232&mode=thread&threshold=-1">66</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Ask Slashdot: Sci Fi Literature 101?</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=ed"><IMG src="image7" width="87" height="64" border="0" align="right" hspace="20" vspace="10" alt="Education"></A> <B>Posted by <A href="http://exit118.com/">Cliff</A> on Saturday January 29, @06:56AM</B><BR> <FONT size="2"><B>from the recommendations-wanted dept.</B></FONT><BR> ohlaadee asks: <I>"My niece (she's 13) wants to start reading science fiction. I do too. I gave us both Asimov's </I>_The Foundation_<I>&nbsp; for Christmas. We'll read it together. I suppose we could spend the rest of our lives just reading Asimov, but I'm wondering what books and movies you folks would come up with? What does the /. recommended Science Fiction 101 list include?"</I> <P><B>( </B><A href="http://slashdot.org/askslashdot/00/01/22/1946244.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/22/1946244&mode=thread&threshold=0">345</A> of <A href="http://slashdot.org/article.pl?sid=00/01/22/1946244&mode=thread&threshold=-1">345</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Could Distributed.Net Help the Mars Polar Lander?</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=space"><IMG src="image8" width="73" height="59" border="0" align="right" hspace="20" vspace="10" alt="Space"></A> <B>Posted by <A href="mailto:roblimo@slashdot.org">Roblimo</A> on Saturday January 29, @03:35AM</B><BR> <FONT size="2"><B>from the food-for-thought dept.</B></FONT><BR> Anonymous Coward writes <I>"This official JPL <A href="http://mpfwww.jpl.nasa.gov/msp98/news/mpl000127.html">press release</A> describes the current attempt to listen for faint signals from the Mars Lander. They get three windows a day, and it takes 18 hours to process data because the signal is so weak (if it's really there). Too bad they don't have a deal with <A href="http://www.distributed.net"> distributed.net</A>."</I> Interesting thought. Is anyone at distributed.net or JPL interested in pursuing it? <P><B>( </B><A href="http://slashdot.org/articles/00/01/28/2318246.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/28/2318246&mode=thread&threshold=0">99</A> of <A href="http://slashdot.org/article.pl?sid=00/01/28/2318246&mode=thread&threshold=-1">102</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>iCrave TV Loses Battle against U.S. Broadcasters</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=tv"><IMG src="image10" width="50" height="50" border="0" align="right" hspace="20" vspace="10" alt="Television"></A> <B>Posted by <A href="mailto:roblimo@slashdot.org">Roblimo</A> on Saturday January 29, @12:21AM</B><BR> <FONT size="2"><B>from the shut-down-just-before-the-super-bowl dept.</B></FONT><BR> <A href="mailto:doran@brandx.net">Doran</A> writes <I>"C|Net has <a href="http://news.cnet.com/news/0-1004-200-1535528.html">this story</a> about how the Canadian company <a href="http://www.icravetv.com">iCraveTV.com</a> has lost its latest battle in U.S. courts over whether it can rebroadcast TV signals over the Web. The broadcasters say it's theft, while iCraveTV sez it's just doing what's legal for other cable TV companies in Canada (ie. rebroadcasting TV). Of course, by framing the streaming video iCraveTV is doing more than just rebroadcasting, they're also adding more commercial content, which the broadcasters feel dilutes their TV commercials. "</I> <P><B>( </B><A href="http://slashdot.org/articles/00/01/29/0010203.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/29/0010203&mode=thread&threshold=0">152</A> of <A href="http://slashdot.org/article.pl?sid=00/01/29/0010203&mode=thread&threshold=-1">170</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Win2k Security holes found</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=microsoft"><IMG src="image11" width="75" height="55" border="0" align="right" hspace="20" vspace="10" alt="Microsoft"></A> <B>Posted by <A href="mailto:heunique@slashdot.org">HeUnique</A> on Friday January 28, @04:58PM</B><BR> <FONT size="2"><B>from the and-it's-not-even-out-yet dept.</B></FONT><BR> According to a story posted by <a href="http://www.zdnn.com">ZDNN</a>, <a href="http://www.zdnet.com/zdnn/stories/news/0,4586,2429334,00.html?chkpt=zdnntop">two security holes</a> have been found on Windows 2000, and that's even before the official release of Windows 2000! Administrators who rush to incorporate the patch from MS beware - according to one of the talkback posts on ZDNN, the patch creates a new problem with Windows 2000 news server service. <P><B>( </B><A href="http://slashdot.org/articles/00/01/28/1653228.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/28/1653228&mode=thread&threshold=0">510</A> of <A href="http://slashdot.org/article.pl?sid=00/01/28/1653228&mode=thread&threshold=-1">534</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Encryption Debate at Mitnick Trial</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=encryption"><IMG src="image12" width="80" height="70" border="0" align="right" hspace="20" vspace="10" alt="Encryption"></A> <B>Posted by <A href="http://hemos.net">Hemos</A> on Friday January 28, @03:33PM</B><BR> <FONT size="2"><B>from the gimmie-the-data dept.</B></FONT><BR> A number of people have written about <A HREF="http://nytimes.com/library/tech/00/01/cyber/cyberlaw/28law.html">the latest twist</a> in the Mitnick case. Kevin wants to get his data back, but the government is refusing to do so until he gives them the key. Apparently, the government is unable to crack the encryption that he's got on it - you'd think after having the data for five years, they'd be able to brute-force the darn thing. It's a NYT article - free login required. <P><B>( </B><A href="http://slashdot.org/articles/00/01/28/1320253.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/28/1320253&mode=thread&threshold=0">504</A> of <A href="http://slashdot.org/article.pl?sid=00/01/28/1320253&mode=thread&threshold=-1">521</A> </B>comments <B>)</B> <P><TABLE width="99%" cellpadding="0" cellspacing="0" border="0"><TR><TD valign="top" bgcolor="#006666"><IMG src="image9" width="13" height="16" alt="" align="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Forum: Future Ports of Games to Linux</B></FONT></TD> </TR></TABLE><A href="http://slashdot.org/search.pl?topic=games"><IMG src="image13" width="80" height="56" border="0" align="right" hspace="20" vspace="10" alt="Games"></A> <B>Posted by <A href="http://CmdrTaco.net">CmdrTaco</A> on Friday January 28, @02:26PM</B><BR> <FONT size="2"><B>from the it's-been-awhile dept.</B></FONT><BR> It's been a long time since I posted an open forum like this, but I'm curious what people think on this one. What games do you most want to see ported to Linux in the next few months? Of course, for me personally it's StarCraft and Diablo 2, but I'm curious what games have come out or are due soon that people would most like to see a port of (and note that WINE doesn't count. ;) <P><B>( </B><A href="http://slashdot.org/articles/00/01/28/1257211.shtml"><B>Read More...</B></A> | <B><A href="http://slashdot.org/article.pl?sid=00/01/28/1257211&mode=thread&threshold=0">648</A> of <A href="http://slashdot.org/article.pl?sid=00/01/28/1257211&mode=thread&threshold=-1">652</A> </B>comments <B>)</B> <P></TD><TD width="210" align="center" valign="top"><TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B><A HREF="/index.pl?section=features"><FONT COLOR="#FFFFFF">Features</FONT></A></B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><A href="/vote.pl">Voting has begun</A> for the $100k <A href="/index.pl?section=awards">Slashdot Beanie Awards</A>. Talk amongst yourselves and choose who deserves the cash. <P>The latest installment of <A href="http://www.thesync.com/geeks">Geeks in Space</A> is up at <A href="http://www.thesync.com">The Sync</A>. Listen to CmdrTaco, Hemos, and Nate talk about the latest events to happen - or not happen in the computer world. <P>Perhaps you are seeking Jon Katz's series of articles related to recent events in Colorado. These articles include <A href="/article.pl?sid=99/04/25/1438249">Voices from the Hellmouth</A>, <A href="/article.pl?sid=99/04/27/0310247">More Stories from the Hellmouth</A> or <A href="/article.pl?sid=99/04/29/0124247">The Price of Being Different</A>, <P>For something different, try reading a little essay <A href="/article.pl?sid=99/03/31/0137221">Thoughts from the Furnace</A> about the internet, and flame. <p> And for a bit of an amusing take on the Open Source world, check out <a href="/article.pl?sid=99/08/24/1327256&mode=thread">Open Source as an Ant Farm</a> <P><B>Update: 01/03 03:10</B> by <B><A href="http://cowboyneal.org">CowboyNeal</a></B>: <P align="right"><B><A href="/features/">Past Features</A></B> <!-- end="end" features="features" block="block" --></FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B><A HREF="http://slashdot.org/index.pl?section=askslashdot"><FONT COLOR="#FFFFFF">Ask Slashdot</FONT></A></B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1946244">Sci Fi Literature 101?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/192226">Linux and Satellite Internet Services</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1843258">Open Defensive Patents?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1825252">Technologies That Shaped the Last Century?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1958212">Disk Repair Tools for Linux?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1955215">Why Can't the Command-Line be More Standardized?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1928235">Packet Radio Networking with PalmOS?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1817211">Cheap Rackmount Enclosures/Systems?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1950249">Open Source Software and Tax Breaks?</A> <li><A HREF="http://slashdot.org/article.pl?sid=00/01/22/1917207">Building an Upgradable Dual Processor System</A> <P> if you have a question for Ask Slashdot, send it to <A href="mailto:askslashdot@slashdot.org">askslashdot@slashdot.org</A></FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B><A HREF="/users.pl"><FONT COLOR="#FFFFFF">Slashdot Login</FONT></A></B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><FORM action="/users.pl" METHOD="POST"> <B>Nickname:</B><BR> <INPUT type="text" name="unickname" size="20" value=""><BR> <B>Password:</B><BR> <INPUT type="hidden" name="returnto" value="index.pl"> <INPUT type="password" name="upasswd" size="20"><BR> <INPUT type="submit" name="op" value="userlogin"> </FORM> Don't have an account yet? <A href="/users.pl">Go Create One</A>. A user account will allow you to customize all these <A href="/cheesyportal.shtml">nutty little boxes</A>, tailor the stories you see, as well as remember your comment viewing preferences.</FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Slashdot Poll</B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><FORM action="http://slashdot.org/pollBooth.pl"> <INPUT type="hidden" name="qid" value="techadvance"> <B>The Tech Advance I Most Want Is:</B><BR><INPUT type="radio" name="aid" value="1">Nanotechnology<BR><INPUT type="radio" name="aid" value="2">Cold Fusion<BR><INPUT type="radio" name="aid" value="3">Powerful Fuel Cells<BR><INPUT type="radio" name="aid" value="4">Hard Wiring my Body<BR><INPUT type="radio" name="aid" value="5">Universal Strong Crypto<BR><INPUT type="radio" name="aid" value="6">Interstellar Travel<BR><INPUT type="radio" name="aid" value="7">Cybernetic Body Armor<BR><INPUT type="radio" name="aid" value="8">ColecoVision<BR><INPUT type="submit" value="Vote"> [ <A href="http://slashdot.org/pollBooth.pl?qid=techadvance&aid=-1"><B>Results</B></A> | <A href="http://slashdot.org/pollBooth.pl?"><B>Polls</B></A> ] <BR>Comments:<B>656</B> | Votes:<B>29121</B></FORM> </FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Older Stuff</B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><P><B><A href="http://slashdot.org/index.pl?section=&issue=730512&mode=thread"><FONT size="4">Friday</FONT></A> January 28</B> <LI><A href="http://slashdot.org/articles/00/01/28/1110258.shtml">Abstract Programming and GPL Enforcement</A> (235) <LI><A href="http://slashdot.org/interviews/00/01/28/1225206.shtml">Interview: FreeDOS Leader Jim Hall Answers</A> (86) <LI><A href="http://slashdot.org/articles/00/01/28/116240.shtml">Open Source's Achilles Heel</A> (466) <LI><A href="http://slashdot.org/features/00/01/26/1915230.shtml">The Virtue of Communal Instincts</A> (237) <LI><A href="http://slashdot.org/articles/00/01/28/0723223.shtml">Gartner Group Debunking Open Source Myths</A> (165) <LI><A href="http://slashdot.org/yro/00/01/28/0917229.shtml">DoubleClick Taken to Court</A> (310) <LI><A href="http://slashdot.org/articles/00/01/28/0718209.shtml">Updated Slash & Server 51</A> (81) <LI><A href="http://slashdot.org/articles/00/01/28/089230.shtml">XMMS 1.0.0 Released</A> (128) <LI><A href="http://slashdot.org/askslashdot/00/01/22/192226.shtml">Linux and Satellite Internet Services</A> (138) <LI><A href="http://slashdot.org/articles/00/01/27/1811221.shtml">UN Wants to Combat Online Racism</A> (531) <P><B><A href="http://slashdot.org/index.pl?section=&issue=730511&mode=thread"><FONT size="4">Thursday</FONT></A> January 27</B> <LI><A href="http://slashdot.org/yro/00/01/27/2330205.shtml">Crackdowns, Fools and the MPAA</A> (351) <LI><A href="http://slashdot.org/articles/00/01/27/0832215.shtml">Heroes of Might and Magic III Demo Released</A> (157) <LI><A href="http://slashdot.org/science/00/01/27/1345241.shtml">Sandia Labs Venture Into Nanotechnology</A> (117) <LI><A href="http://slashdot.org/articles/00/01/27/0931237.shtml">CA Announces Program Ports to Linux</A> (195) <LI><A href="http://slashdot.org/interviews/00/01/27/1118251.shtml">Interview: Larry Augustin Finally Answers</A> (210) <LI><A href="http://slashdot.org/awards/00/01/27/0855252.shtml">Final Call for Voting in Slashdot's Beanie Awards</A> (178) <LI><A href="http://slashdot.org/features/00/01/26/197211.shtml">Transmeta Code Morphing != Just In Time</A> (449) <LI><A href="http://slashdot.org/books/00/01/24/1150256.shtml">Intrusion Detection</A> (65) <LI><A href="http://slashdot.org/science/00/01/27/0824239.shtml">Using Enzymes to Help Fight CO2 Build-Up</A> (165) <LI><A href="http://slashdot.org/articles/00/01/27/0712217.shtml">Jon Johansen on ABC World News Tonight</A> (415) <P align="right"><BR><A href="http://slashdot.org/search.pl?section=&min=30"><B>Older Articles</B></A><BR><A href="http://slashdot.org/index.pl?section=&mode=thread&issue=730512"><B>Yesterday's Edition</B></A> </FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B><A HREF="/index.pl?section=books"><FONT COLOR="#FFFFFF">Book Reviews</FONT></A></B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><p>Jon Katz, Resident Gasbag, has a new, very appropriate book coming out soon, <a href="http://www.thinkgeek.com">Geeks</a>. Preorder now and receive the book early. <p>For probably the best fiction read around, check out Neal Stephenson's <cite><a href="/article.pl?sid=99/06/23/139229&mode=thread">Cryptonomicon</a></cite>, an engaging read about WWII, cryptography and buried treasure. And data vaults. <p>If you've been doing a lot of work in Perl, you've probably figured out you really need <cite><a href="/article.pl?sid=99/05/10/2238254&mode=thread">Perl in a Nutshell</a></cite> or <cite><a href="/article.pl?sid=99/01/29/1035246&mode=thread">The Perl Cookbook</a></cite>. If you're still learning, grab <cite><a href="/books/older/980526096229.shtml">Programming Perl</a></cite>. <p>And if you want to learn more about how to become a better coder, grab <cite><a href="/article.pl?sid=99/06/28/1417229&mode=thread">The Unified Software Development Process</a></cite> or <cite><a href="/article.pl?sid=99/04/08/1512209&mode=thread">The Practice of Programming</cite></a> Additionally, check out <cite><a href="http://slashdot.org/article.pl?sid=99/09/16/1333202&mode=thread">Refactoring: Improving the Design of Existing Code</a></cite> . <p>Developing a large application? Grab Eric Greenberg's excellent <cite><a href="/article.pl?sid=99/07/13/1943258&mode=thread">Network Application Frameworks</cite></a>. <P>Visit <A href="/index.pl?section=books">Our Book Reviews Section</A> for more. <br> <B>Update: 11/12 05:19</B> by <B><A href="mailto:hemos@slashdot.org">H</A></B>:</FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B>Quick Links</B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><B>Cool Sites:</B> <LI><A href="http://www.linux.com">Linux.com</A> (What <B>is</B> Linux?) <LI><A href="http://everything.blockstackers.com">Everything</A> (Blow your Mind) <LI><A href="http://www.geekculture.com/geekycomics/Aftery2k/aftery2kmain.html">After Y2k</A> (<I>This</I> is Post-Apocalyptic?) <LI><A href="http://www.userfriendly.org">User Friendly</A> (Laugh) <LI><A href="http://themes.org">Themes.org</A> (Make X Perty) <P><B>Support Slashdot:</B> <LI><A href="http://www.thinkgeek.com">ThinkGeek</A> (Clothe Yourself in Slashdot) <LI><A href="http://cdnow.com/from=sr-302791">CDnow</A> (Support <A href="http://www.cdnow.com/gift/malda@slashdot.org">Rob's Who Habit</A>) <LI><A href="http://adfu.slashdot.org">Slashdot Advertiser Index</A></FONT></TD> </TR> </TABLE><P> <TABLE cellpadding="1" cellspacing="0" border="0" width="200" align="center"> <TR bgcolor="#006666"> <TD valign="top"><FONT size="4" color="#FFFFFF" face="arial,helvetica"><B><A HREF="http://freshmeat.net"><FONT COLOR="#FFFFFF">Freshmeat</FONT></A></B></FONT></TD> </TR><TR><TD bgcolor="#CCCCCC"><FONT color="#000000" size="2"><P><FONT size="4" color="#006666"><B>January</B></FONT><BR> <LI><A href="http://freshmeat.net/news/2000/01/29/949208399.html">We should get this out of the door now</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949159642.html">Is Linux for Crazies?</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949156343.html">SQN Linux 1.6</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949156277.html">Limo 0.3.2</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949156237.html">Fusion GS 1.3</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949145887.html">MMR 1.5.4</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949142835.html">KUPS 0.3.4</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949142815.html">3DSE patch for XMMS 4</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949139763.html">Linux 2.3.41</A> <LI><A href="http://freshmeat.net/news/2000/01/29/949139751.html">Free Code for Linux S/390</A> <FORM METHOD="post" ACTION="http://core.freshmeat.net/search.php3"> <FONT size="3" color="#006666"><B>Search Freshmeat:</B></FONT><BR> <INPUT TYPE="hidden" NAME="link" VALUE="freshmeat.net"> <INPUT TYPE="text" NAME="query"> </FORM> <P align="right"><A href="http://freshmeat.net"><B>More Meat...</B></A></FONT></TD> </TR> </TABLE><P> </FONT></TD>
+ </TR>
+ </TABLE><TABLE cellpadding="0" cellspacing="0" border="0" width="99%" align="center" bgcolor="ffffff">
+ <TR>
+ <TD colspan="4" align="center"><IMG src="image14" alt="" width="80%" height="1" hspace="10" vspace="30"></TD>
+ </TR><TR>
+ <TD align="center"><FONT size="2" face="arial,helvetica">
+ <FORM method="GET" action="http://slashdot.org/search.pl">
+ <INPUT type="name" name="query" value="" width="20" size="20" length="20">
+ <INPUT type="submit" value="Search">
+ </FORM>
+ </FONT>
+ </TD>
+ <TD bgcolor="#ffffff" width="25"> &nbsp; </TD>
+ <TD align="center">
+ <FONT size="2" face="arial,helvetica"><I>Wasn't there something about a PASCAL programmer knowing the value of
+everything and the Wirth of nothing?
+<TD>&nbsp;</TD></I></FONT>
+ </FONT>
+ </TD></TR>
+ <TR><TD colspan="4" align="center">
+ <FONT size="1" color="#006666" face="arial,helvetica">
+
+ All trademarks and copyrights on this
+ page are owned by their respective owners. Comments
+ are owned by the Poster.
+ The Rest 1997-2000 <A href="http://Andover.Net">Andover.Net</A>.
+</FONT></CENTER>
+ </TD>
+ </TR>
+ </TABLE>
+ <CENTER>
+ <FONT size="2" color="#006666">
+
+ [ <A href="http://slashdot.org/"><Font color="#ffffff">home</FONT></A> |
+ <A href="http://slashdot.org/awards.shtml"><Font color="#ffffff">awards</FONT></A> |
+ <A href="http://slashdot.org/supporters.shtml"><FONT color="#ffffff">supporters</FONT></A> |
+ <A href="http://CmdrTaco.net"><FONT color="#ffffff">rob's homepage</FONT></A> |
+ <A href="http://slashdot.org/submit.pl"><FONT color="#ffffff">contribute story</FONT></A> |
+ <A href="http://slashdot.org/search.pl"><FONT color="#ffffff">older articles</FONT></A> |
+ <A href="http://Andover.Net"><FONT color="#ffffff">Andover.Net</FONT></A> |
+ <A href="http://slashdot.org/advertising.shtml"><FONT color="#ffffff">advertising</FONT></A> |
+ <A href="http://slashdot.org/pollBooth.pl"><FONT color="#ffffff">past polls</FONT></A> |
+ <A href="http://slashdot.org/about.shtml"><FONT color="#ffffff">about</FONT></A> |
+ <A href="http://slashdot.org/faq.shtml"><FONT color="#ffffff">faq</FONT></A> ]
+ </FONT>
+ </CENTER>
+</BODY>
+</HTML>
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image1 b/ext/tk/sample/tkextlib/tkHTML/page2/image1
new file mode 100644
index 00000000000..2ed6ddcfe1c
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image1
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image10 b/ext/tk/sample/tkextlib/tkHTML/page2/image10
new file mode 100644
index 00000000000..3021b68990d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image10
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image11 b/ext/tk/sample/tkextlib/tkHTML/page2/image11
new file mode 100644
index 00000000000..41d1fe36661
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image11
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image12 b/ext/tk/sample/tkextlib/tkHTML/page2/image12
new file mode 100644
index 00000000000..655a686541a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image12
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image13 b/ext/tk/sample/tkextlib/tkHTML/page2/image13
new file mode 100644
index 00000000000..97d5950e8c5
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image13
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image14 b/ext/tk/sample/tkextlib/tkHTML/page2/image14
new file mode 100644
index 00000000000..6d73ad833ca
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image14
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image15 b/ext/tk/sample/tkextlib/tkHTML/page2/image15
new file mode 100644
index 00000000000..90cc3b2b16f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image15
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image16 b/ext/tk/sample/tkextlib/tkHTML/page2/image16
new file mode 100644
index 00000000000..93aa853cf1d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image16
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image17 b/ext/tk/sample/tkextlib/tkHTML/page2/image17
new file mode 100644
index 00000000000..f46f0308cd2
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image17
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image18 b/ext/tk/sample/tkextlib/tkHTML/page2/image18
new file mode 100644
index 00000000000..3badd5e909d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image18
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image19 b/ext/tk/sample/tkextlib/tkHTML/page2/image19
new file mode 100644
index 00000000000..bd4f6d96776
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image19
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image2 b/ext/tk/sample/tkextlib/tkHTML/page2/image2
new file mode 100644
index 00000000000..7566dda25d4
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image2
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image20 b/ext/tk/sample/tkextlib/tkHTML/page2/image20
new file mode 100644
index 00000000000..358fa95f63d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image20
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image21 b/ext/tk/sample/tkextlib/tkHTML/page2/image21
new file mode 100644
index 00000000000..c81aa52588b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image21
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image22 b/ext/tk/sample/tkextlib/tkHTML/page2/image22
new file mode 100644
index 00000000000..6cbd63022a1
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image22
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image23 b/ext/tk/sample/tkextlib/tkHTML/page2/image23
new file mode 100644
index 00000000000..e8173a74567
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image23
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image24 b/ext/tk/sample/tkextlib/tkHTML/page2/image24
new file mode 100644
index 00000000000..bffd4b4956f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image24
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image25 b/ext/tk/sample/tkextlib/tkHTML/page2/image25
new file mode 100644
index 00000000000..c656fa4f308
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image25
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image26 b/ext/tk/sample/tkextlib/tkHTML/page2/image26
new file mode 100644
index 00000000000..bc93fdb259d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image26
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image27 b/ext/tk/sample/tkextlib/tkHTML/page2/image27
new file mode 100644
index 00000000000..6ad0eff1e77
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image27
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image28 b/ext/tk/sample/tkextlib/tkHTML/page2/image28
new file mode 100644
index 00000000000..88f0d7cea6f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image28
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image29 b/ext/tk/sample/tkextlib/tkHTML/page2/image29
new file mode 100644
index 00000000000..e0704183b34
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image29
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image3 b/ext/tk/sample/tkextlib/tkHTML/page2/image3
new file mode 100644
index 00000000000..ac3fa33e6f7
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image3
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image30 b/ext/tk/sample/tkextlib/tkHTML/page2/image30
new file mode 100644
index 00000000000..4a419504341
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image30
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image31 b/ext/tk/sample/tkextlib/tkHTML/page2/image31
new file mode 100644
index 00000000000..60f13ed5640
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image31
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image32 b/ext/tk/sample/tkextlib/tkHTML/page2/image32
new file mode 100644
index 00000000000..04ddc4e8d72
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image32
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image33 b/ext/tk/sample/tkextlib/tkHTML/page2/image33
new file mode 100644
index 00000000000..c1ecfff6c42
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image33
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image34 b/ext/tk/sample/tkextlib/tkHTML/page2/image34
new file mode 100644
index 00000000000..3dfd5d76e2c
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image34
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image35 b/ext/tk/sample/tkextlib/tkHTML/page2/image35
new file mode 100644
index 00000000000..aea44f3017e
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image35
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image36 b/ext/tk/sample/tkextlib/tkHTML/page2/image36
new file mode 100644
index 00000000000..baef0e0380b
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image36
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image37 b/ext/tk/sample/tkextlib/tkHTML/page2/image37
new file mode 100644
index 00000000000..6c6ba52b45f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image37
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image38 b/ext/tk/sample/tkextlib/tkHTML/page2/image38
new file mode 100644
index 00000000000..e298e04b291
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image38
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image39 b/ext/tk/sample/tkextlib/tkHTML/page2/image39
new file mode 100644
index 00000000000..e16e2f10d54
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image39
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image4 b/ext/tk/sample/tkextlib/tkHTML/page2/image4
new file mode 100644
index 00000000000..9e5e46b7e58
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image4
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image5 b/ext/tk/sample/tkextlib/tkHTML/page2/image5
new file mode 100644
index 00000000000..646a6d9a519
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image5
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image6 b/ext/tk/sample/tkextlib/tkHTML/page2/image6
new file mode 100644
index 00000000000..7df417c710c
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image6
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image7 b/ext/tk/sample/tkextlib/tkHTML/page2/image7
new file mode 100644
index 00000000000..0e6ac10affc
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image7
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image8 b/ext/tk/sample/tkextlib/tkHTML/page2/image8
new file mode 100644
index 00000000000..ba7fb476b95
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image8
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/image9 b/ext/tk/sample/tkextlib/tkHTML/page2/image9
new file mode 100644
index 00000000000..b1cad73ae93
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/image9
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page2/index.html b/ext/tk/sample/tkextlib/tkHTML/page2/index.html
new file mode 100644
index 00000000000..7eaf2d2cc96
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page2/index.html
@@ -0,0 +1,433 @@
+<html>
+<head>
+ <title>Tcl Resource Center</title>
+</head>
+
+<body bgcolor="white" text="black">
+
+ <!-- MenuTopLevel Resource Software Extensions -->
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="120" valign="TOP"><a href="/"><img src="image1" width="120" height="79" alt="Scriptics" border="0"></a></td>
+ <td valign="top" width="548">
+
+ <!-- Table to hold tabs -->
+ <table cellpadding="0" cellspacing="0" border="0" width="548">
+ <tr>
+ <td valign="top" align="right" colspan="15" width="548"><a name="TOP"><img src="image2" width="548" height="9" alt="Tcl/Tk" border="0"></a></td>
+ </tr>
+ <tr>
+ <td valign="top" align="right" colspan="15" width="548"><img src="image3" width="482" height="34" alt="Scripting Solutions for eBusiness Integration" border="0"></td>
+ </tr>
+ <tr>
+ <td width="18" valign="TOP"><img src="image4" width="18" height="36" alt="" border="0"></td>
+ <td width="58"><a href="/products/" onMouseOver="msover(4, 'http://images.scriptics.com/images/ProductsMouseOff.gif') ; return true ;" onMouseOut="msover(4, 'http://images.scriptics.com/images/ProductsOff.gif') ; return true ;"><img src="image5" width="58" height="36" alt="Products" border="0"></a></td>
+ <td width="14" valign="TOP"><img src="image6" width="14" height="36" alt="" border="0"></td>
+ <td width="69"><a href="/customers/" onMouseOver="msover(6, 'http://images.scriptics.com/images/CustomersMouseOff.gif') ; return true ;" onMouseOut="msover(6, 'http://images.scriptics.com/images/CustomersOff.gif') ; return true ;"><img src="image7" width="69" height="36" alt="Customers" border="0"></a></td>
+ <td width="14" valign="TOP"><img src="image6" width="14" height="36" alt="" border="0"></td>
+ <td width="60"><a href="/partners/" onMouseOver="msover(8, 'http://images.scriptics.com/images/PartnersMouseOff.gif') ; return true ;" onMouseOut="msover(8, 'http://images.scriptics.com/images/PartnersOff.gif') ; return true ;"><img src="image8" width="60" height="36" alt="Partners" border="0"></a></td>
+ <td width="14" valign="TOP"><img src="image6" width="14" height="36" alt="" border="0"></td>
+ <td width="56"><a href="/services/" onMouseOver="msover(10, 'http://images.scriptics.com/images/ServicesMouseOff.gif') ; return true ;" onMouseOut="msover(10, 'http://images.scriptics.com/images/ServicesOff.gif') ; return true ;"><img src="image9" width="56" height="36" alt="Services" border="0"></a></td>
+ <td width="14" valign="TOP"><img src="image10" width="14" height="36" alt="" border="0"></td>
+ <td width="88"><a href="/resource/" onMouseOver="msover(12, 'http://images.scriptics.com/images/ResourceMouseOn.gif') ; return true ;" onMouseOut="msover(12, 'http://images.scriptics.com/images/ResourceOn.gif') ; return true ;"><img src="image11" width="88" height="36" alt="Tcl Resources" border="0"></a></td>
+ <td width="14" valign="TOP"><img src="image12" width="14" height="36" alt="" border="0"></td>
+ <td width="57"><a href="/company/" onMouseOver="msover(14, 'http://images.scriptics.com/images/CompanyMouseOff.gif') ; return true ;" onMouseOut="msover(14, 'http://images.scriptics.com/images/CompanyOff.gif') ; return true ;"><img src="image13" width="57" height="36" alt="Company" border="0"></a></td>
+ <td width="8" valign="TOP"><img src="image14" width="8" height="36" alt="" border="0"></td>
+ <td width="50" valign="TOP"><img src="image15" width="50" height="36" alt="" border="0"></td>
+ <td width="14" valign="TOP"><img src="image16" width="14" height="36" alt="" border="0"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table> <script language="Javascript">
+ <!--
+ function msover(num, file )
+ {
+ old = (((navigator.appName=='Netscape') &&
+ (parseInt(navigator.appVersion)<=3.0 )))
+ if ( !old ) {
+ document.images[num].src=file
+ }
+ }
+ //-->
+ </SCRIPT>
+
+<!-- MenuSubLevel Resource Software Extensions Tk -->
+
+<table cellpadding="0" cellspacing="0" border="0">
+
+<!-- Left Hand Column-->
+
+<tr><td valign="top" width="120"><table cellpadding="0" cellspacing="0" border="0" width="120">
+ <tr>
+ <td width="120" valign="TOP"><img src="image17" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/"><img src="image18" width="120" height="11" alt="Software" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image19" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/tcltk/"><img src="image20" width="120" height="11" alt="Tcl/Tk Core" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image19" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/applications/"><img src="image21" width="120" height="11" alt="Applications" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image22" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/extensions/"><img src="image23" width="120" height="11" alt="Extensions" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image24" width="120" height="6" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/patches/"><img src="image25" width="120" height="11" alt="Patches" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image19" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/java/"><img src="image26" width="120" height="11" alt="Tcl &amp; Java" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image19" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/ports/"><img src="image27" width="120" height="11" alt="Tcl/Tk Ports" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image19" width="120" height="4" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/software/tools/"><img src="image28" width="120" height="11" alt="Tools" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image29" width="120" height="6" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/doc/"><img src="image30" width="120" height="11" alt="Documentation" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image31" width="120" height="5" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/resource/community/"><img src="image32" width="120" height="11" alt="Community" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image31" width="120" height="5" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/live/bydate"><img src="image33" width="120" height="11" alt="What's New" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image31" width="120" height="5" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/forms/urlnote.html"><img src="image34" width="120" height="11" alt="Add URL" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image31" width="120" height="5" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/live/keyword"><img src="image35" width="120" height="11" alt="Keyword Search" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image31" width="120" height="5" alt="" border="0"></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><a href="/live/sitemap"><img src="image36" width="120" height="11" alt="Index" border="0"></a></td>
+ </tr>
+ <tr>
+ <td width="120" valign="TOP"><img src="image37" width="120" height="6" alt="" border="0"></td>
+ </tr>
+</table><!-- End Left Column --></td><!-- Right Hand Column --><td valign="top" width="548" align="left"><table cellpadding="0" cellspacing="0" border="0" width="548">
+ <tr>
+ <td width="295" valign="TOP"><img src="image38" width="295" height="42" alt="Resource" border="0"></td>
+ <td width="187" valign="bottom" align="right"><FORM action="/live/keyword"><img src="image39" width="46" height="24" alt="" border="0"><INPUT TYPE="TEXT" SIZE="10" MAXLENGTH="35" NAME="keywords"><INPUT type="IMAGE" border="0" img="img" src="http://images.scriptics.com/images/Go.gif" value="submit" width="33" height="24"></FORM>
+ </tr>
+ </table>
+ <!-- 2 Columns for spacer -->
+ <table cellpadding="0" cellspacing="0" border="0" width="548">
+ <tr>
+ <!-- Spacer Column -->
+ <td valign="top" width="10">
+ &nbsp;
+ </td>
+
+
+ <td valign="top" width="548"><font face="Geneva, Helvetica, Arial" size="2"><h1>Tcl Resource Center</h1>
+<font size="+1"><a href="/resource/">Top</a>&gt;<a href="/resource/software/" ="">Software Central</a>&gt;<a href="/resource/software/extensions/" ="">Extensions</a>&gt;Tk Widgets</font><font size="-1"><br>Viewed by name (<a href="/resource/software/extensions/tk/?sortby=date">By date</a>)</font><br>
+<p>Tk is a toolkit for building graphical user interfaces with Tcl.
+ Your Tcl/Tk scripts run on UNIX, Windows, and Macintosh.<p>
+<font face="Geneva, Helvetica, Arial"><ul></ul></font><dl>
+<dt><b><a href="http://marge.phys.washington.edu/%7Ezager/blt80-unoff-exe.zip" ="">BLT 8.0 Unofficial zip and DLL</a></b>
+<dd>This is a compiled version of BLT 8.0 "unofficial" for
+the Windows platform. <a href="/live/annotate?url=http%3a%2f%2fmarge%2ephys%2ewashington%2eedu%2f%257Ezager%2fblt80%2dunoff%2dexe%2ezip">Edit</a>
+ <i><font size="-1">(September 24, 1999 06:31)</font></i><dt><b><a href="ftp://ftp.neosoft.com/languages/tcl/sorted/unknown/blt8.0p2-unoff.tgz" ="">BLT 8.0p2 Unofficial tar file</a><a name="bltunoff"></a></b>
+<dd>This is a contributed patch to make BLT compatible with Tcl/Tk 8.0p2. While still "unofficial", it is widely used.
+ Make sure you get the 8.0p2 version because the 8.0 version does
+ not compile under windows.
+ There is also a <a href="ftp://ftp.neosoft.com/languages/sorted/devel/blt2.3-8.1.tar.gz">2.3-8.1 version</a> that has been patched to work with 8.1.
+ <a href="ftp://ftp.neosoft.com/languages/tcl/sorted/unknown/blt8.0p2-unoff.README">README file</a>. <a href="/live/annotate?url=ftp%3a%2f%2fftp%2eneosoft%2ecom%2flanguages%2ftcl%2fsorted%2funknown%2fblt8%2e0p2%2dunoff%2etgz">Edit</a>
+ <i><font size="-1">(August 30, 1999 06:38)</font></i><dt><b><a href="http://www.tcltk.com/blt/" ="">BLT Home Page</a></b>
+<dd>
+ Author <b>George Howlett</b>, Version <b>2.3</b>,
+ Works with <b>Tk 4.1 through Tk 8.1</b>
+<br><a href="ftp://ftp.tcltk.com/pub/blt/">Download</a>, <a href="ftp://ftp.tcltk.com/pub/blt/BLT2.3.tar.gz">BLT2.3.tar.gz</a>, <a href="ftp://ftp.tcltk.com/pub/blt/BLT2.4h.tar.gz">BLT2.4h.tar.gz</a>, <a href="ftp://ftp.tcltk.com/pub/blt/BLT2.4i.tar.gz">BLT2.4i.tar.gz</a>, <a href="ftp://ftp.tcltk.com/pub/blt/blt2.4i-for-8.0.exe">blt2.4i-for-8.0.exe</a>, <a href="ftp://ftp.tcltk.com/pub/blt/blt2.4i-for-8.1.exe">blt2.4i-for-8.1.exe</a><br>BLT is a set of widgets for Tk, including a graph widget,
+bar chart, drag&drop, a simple command tracer, and much more.
+The 2.4 release, which is still under development, works with 8.0
+or higher.
+There are also an "<a href="#bltunoff">unofficial</a>" release for 8.0p2
+and 8.1a2 that were not done by the author. <a href="/live/annotate?url=http%3a%2f%2fwww%2etcltk%2ecom%2fblt%2f">Edit</a>
+ <i><font size="-1">(October 26, 1999 09:43)</font></i><dt><b><a href="http://www.unifix-online.com/BWidget/index.html" ="">BWidget</a></b>
+<dd>A set of native Tk 8.x Widgets using Tcl8.x namespaces.
+The ToolKit is available under Unix/X11 and Windows.
+The BWidget(s) have a professional look&feel as in other
+well known Toolkits (Tix or Incr Widget) but the concept is
+radically different because everything is native
+so no platform compilation, no compiled extension
+library are needed. The code is 100 Pure Tcl/Tk.
+More 30 components : Notebook, PageManager, Tree, PanedWindow, ButtonBox,
+ScrollView, ComboBox, SpinBox, ListBox, SelectFont, SelectColor,
+ProgressBare ... <a href="/live/annotate?url=http%3a%2f%2fwww%2eunifix%2donline%2ecom%2fBWidget%2findex%2ehtml">Edit</a>
+ <i><font size="-1">(September 06, 1999 09:58)</font></i><dt><b><a href="http://purl.oclc.org/net/nijtmans/dash.html" ="">Dash Patch for Tk</a></b>
+<dd>This patch has many enhancements to the Tk and its canvas
+widget, including dashed lines, smoothed polygons,
+and performance enhancements. <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2fnijtmans%2fdash%2ehtml">Edit</a>
+ <i><font size="-1">(November 21, 1999 06:33)</font></i><dt><b><a href="http://www.hwaci.com/sw/et" ="">Embedded Tk (et)</a></b>
+<dd>
+ Author <b><a href="mailto:drh@acm.org" ="">Richard Hipp</a></b>, Version <b>8.0b5</b>,
+ Works with <b>Tk 4.0, 4.1, 4.2, 8.0</b>
+<br>Download: <a href="http://www.hwaci.com/sw/et/et80b5.tar.gz">et80b5.tar.gz</a><br>Embedded Tk or ``ET'' is tool for making stand-alone executables out of a mixture of C or C++ and Tcl/Tk.
+Using ET you can invoke a short Tcl/Tk script in the middle of a C routine, or you can invoke a C routine in the
+middle of a Tcl/Tk script. ET also bundles external Tcl/Tk scripts (including the standard Tcl/Tk startup scripts)
+into the executable so that the executable can be run on another binary-compatible computer that doesn't have
+Tcl/Tk installed. <a href="/live/annotate?url=http%3a%2f%2fwww%2ehwaci%2ecom%2fsw%2fet">Edit</a>
+ <i><font size="-1">(August 19, 1999 15:35)</font></i><dt><b><a href="http://www.purl.org/net/hobbs/tcl/script/tkcon/" ="">Enhanced Tk Console (TkCon)</a></b>
+<dd>
+ Author <b><a href="mailto:jeffrey.hobbs@oen.siemens.de" ="">Jeff Hobbs</a></b>, Version <b>1.3</b>,
+ Works with <b>Tk 4.1 through Tk 8.1</b>
+<br>Download: <a href="http://www.purl.org/net/hobbs/tcl/script/tkcon/tkcon.tar.gz">tkcon.tar.gz</a><br>TkCon is a replacement for the standard console that comes with Tk (on Windows/Mac, but also works on
+
+Unix). The console itself provides many more features than the standard console. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fscript%2ftkcon%2f">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:06)</font></i><dt><b><a href="http://www.scriptmeridian.org/projects/tk/" ="">Frontier-Tk ScriptMeridian project</a></b>
+<dd>This project seeks to integrate the Tk toolkit
+with the Frontier scripting language. <a href="/live/annotate?url=http%3a%2f%2fwww%2escriptmeridian%2eorg%2fprojects%2ftk%2f">Edit</a>
+ <i><font size="-1">(August 19, 1999 15:36)</font></i><dt><b><a href="http://purl.oclc.org/net/nijtmans/img.html" ="">Img image format extension</a></b>
+<dd>This package enhances Tk, adding support for many other Image formats:
+BMP, XBM, XPM, GIF (with transparency), PNG,
+JPEG, TIFF and postscript.
+This is implemented as a shared library that can be dynamically loaded into
+Tcl/Tk.
+ <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2fnijtmans%2fimg%2ehtml">Edit</a>
+ <i><font size="-1">(November 21, 1999 06:35)</font></i><dt><b><a href="http://purl.oclc.org/net/oakley/tcl/mclistbox/index.html" ="">mclistbox - a multi-column listbox widget</a></b>
+<dd>mclistbox is a multi-column listbox that is
+written in pure tcl and runs on all platforms
+that support tcl/tk 8.0 or higher. This widget
+requires no other extensions; it is completely
+standalone. <a href="/live/annotate?url=http%3a%2f%2fpurl%2eoclc%2eorg%2fnet%2foakley%2ftcl%2fmclistbox%2findex%2ehtml">Edit</a>
+ <i><font size="-1">(August 19, 1999 15:37)</font></i><dt><b><a href="http://home.t-online.de/home/dshepherd/tkview.htm" ="">MFC views C++ class for embedding Tk</a></b>
+<dd>The idea of embedding Tk in MFC windows always seemed very enticing but information was sparse and contradictory - on a
+ scale between "very easy" and "not yet possible". The only thing for it was to have a go and lo, it wasn't that hard after all.
+ CTkView is a C++ class which can be used in MFC SDI or MDI applications. An instance of CTkView hosts an embedded Tk
+ toplevel widget and performs some management chores for the widget so that it can size, update and react correctly to Windows
+ events. <a href="/live/annotate?url=http%3a%2f%2fhome%2et%2donline%2ede%2fhome%2fdshepherd%2ftkview%2ehtm">Edit</a>
+ <i><font size="-1">(August 19, 1999 15:38)</font></i><dt><b><a href="http://www.cs.umd.edu/hcil/pad++" ="">Pad++</a></b>
+<dd>
+ Author <b><a href="mailto:pad-info@cs.umd.edu" ="">Ben Bederson et al</a></b>, Version <b>0.9p1</b>,
+ Works with <b>8.0</b>
+<br>Download: <a href="http://www.cs.umd.edu/hcil/pad++/download.html">download.html</a><br>Pad++ is a Tk widget that provides a Zoomable User Interface (ZUI) that supports real-time interactive zoomable graphics in a fashion similar to the Tk Canvas widget. Pad++ supports tens of thousands of objects which include text, images, graphics, portals, lenses, simple html (and more), including transparency and rotation. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecs%2eumd%2eedu%2fhcil%2fpad%2b%2b">Edit</a>
+ <i><font size="-1">(August 19, 1999 15:39)</font></i><dt><b><a href="http://home.t-online.de/home/sesam.com/freeware.htm" ="">Progressbar</a></b>
+<dd>Progressbar is a megawidget written in pure tcl (ie: no compiling required - runs on all platforms Macintosh, Unix, Windows).
+Its primary purpose is to show the progress of any action in percent. <a href="/live/annotate?url=http%3a%2f%2fhome%2et%2donline%2ede%2fhome%2fsesam%2ecom%2ffreeware%2ehtm">Edit</a>
+ <i><font size="-1">(January 24, 2000 09:19)</font></i><dt><b><a href="http://jfontain.free.fr/" ="">scwoop (Simple Composite Widget Object Oriented Package)</a></b>
+<dd>Scwoop is a composite widget (also known as mega widget) extension to the great Tk widget library. Scwoop is
+entirely written in Tcl using the stooop (Simple Tcl Only Object Oriented Programming) extension. <a href="/live/annotate?url=http%3a%2f%2fjfontain%2efree%2efr%2f">Edit</a>
+ <i><font size="-1">(January 09, 2000 02:10)</font></i><dt><b><a href="http://www2.clearlight.com/~oakley/tcl/supertext.html" ="">Supertext - tk text widget with unlimited undo</a></b>
+<dd>
+ Author <b><a href="mailto:oakley@channelpoint.com" ="">Bryan Oakley</a></b>, Version <b>1.0b1</b>,
+ Works with <b>Tcl 8.0</b>
+<br>Download: <a href="http://www2.clearlight.com/~oakley/tcl/supertext.tcl">supertext.tcl</a><br>Supertext is a package that provides a tk text widget with full undo and the ability to execute procedures both before and after a text
+widget command has been processed. Supertext may be used as-is, or for the brave it may be used in place of the standard text
+widget. <a href="/live/annotate?url=http%3a%2f%2fwww2%2eclearlight%2ecom%2f%7eoakley%2ftcl%2fsupertext%2ehtml">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:06)</font></i><dt><b><a href="http://www.hwaci.com/sw/tk/nbpi.html" ="">Tabbed Notebook Widget</a></b>
+<dd>
+ Author <b><a href="mailto:drh@acm.org" ="">Richard Hipp</a></b>, Version <b>1.0</b>,
+ Works with <b>Tk 4.1 or later.</b>
+<br>Download: <a href="http://www.hwaci.com/sw/tk/notebook.tcl">notebook.tcl</a><br>This implements a tabbed notebook using
+a canvas widget and embedded frames.
+This is pure Tcl
+code - not a C extension. <a href="/live/annotate?url=http%3a%2f%2fwww%2ehwaci%2ecom%2fsw%2ftk%2fnbpi%2ehtml">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:08)</font></i><dt><b><a href="http://www.tcltk.com/ellson/ftp/Gdtclft2.0.README" ="">Tcl GD - graphics</a></b>
+<dd>
+ Author <b>John Ellson and Spencer Thomas</b>, Version <b>2.0</b>,
+ Works with <b>8.0 and higher</b>
+<br>Download: <a href="http://www.tcltk.com/ellson/ftp/Gdtclft2.0.tar.gz">Gdtclft2.0.tar.gz</a><br>
+ Thomas Boutell's Gd package provides a convenient way to generate
+ PNG images with a C program. If you prefer Tcl for CGI
+ applications, you'll want the TCL GD extension. <a href="/live/annotate?url=http%3a%2f%2fwww%2etcltk%2ecom%2fellson%2fftp%2fGdtclft2%2e0%2eREADME">Edit</a>
+ <i><font size="-1">(August 19, 1999 14:52)</font></i><dt><b><a href="http://www.stratasys.com/software/metagui" ="">The Meta-GUI Tools</a></b>
+<dd>The Meta-GUI tools provide a framework for quickly building full
+GUI applications. The GUI is rendered by a run-time engine
+based on a hierarchical set of definitions you provide. At the bottom
+of the hierarchy are abstract data types such as length, angle,
+string, etc., and these are used to progressively build up frames,
+dialogs, toolbars, menus, and operations. <a href="/live/annotate?url=http%3a%2f%2fwww%2estratasys%2ecom%2fsoftware%2fmetagui">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:10)</font></i><dt><b><a href="http://jfontain.free.fr/" ="">Tkpiechart Home Page</a></b>
+<dd>Tkpiechart is a Tcl-only extension that allows the programmer to create and dynamically update 2D or 3D pie
+charts in a Tcl/Tk application. This uses the stooop package and builds
+pie charts on a Tk canvas. <a href="/live/annotate?url=http%3a%2f%2fjfontain%2efree%2efr%2f">Edit</a>
+ <i><font size="-1">(January 09, 2000 02:12)</font></i><dt><b><a href="http://www.cygnus.com/~irox/tkprint/" ="">TkPrint</a></b>
+<dd>TkPrint is an extension that allows you to print from a
+ Tk widget. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecygnus%2ecom%2f%7eirox%2ftkprint%2f">Edit</a>
+ <i><font size="-1">(October 11, 1999 09:58)</font></i><dt><b><a href="http://www.purl.org/net/hobbs/tcl/capp/" ="">TkTable Home Page</a></b>
+<dd>The TkTable widget. The <code>table</code> command creates a
+2-dimensional grid of cells. The table can use a Tcl array variable or Tcl
+
+command for data storage and retrieval. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fcapp%2f">Edit</a>
+ <i><font size="-1">(November 18, 1999 09:25)</font></i><dt><b><a href="http://ftp.austintx.net/users/jatucker/TkTextmatrix/default.htm" ="">TkTextMatrix (spreadsheet)</a></b>
+<dd>
+ Author <b><a href="mailto:jatucker@austin.dsccc.com" ="">John Arthur Tucker</a></b>, Version <b>4.1</b>,
+ Works with <b>Tk 4.1</b>
+<br>Download: <a href="http://ftp.austintx.net/users/jatucker/TkTextmatrix/download.htm">download.htm</a>, <a href="http://ftp.austintx.net/users/jatucker/TkTextmatrix/textmatrix4.1.tar.gz">textmatrix4.1.tar.gz</a><br>A Tcl/Tk spreadsheet widget, TkTextmatrix, which is implemented in C++ and is
+ basically a Tk Canvas widget plus extra behavior for manipulating rows and columns of cell
+ items many times faster than with a plain Tk Canvas. It actually inserts text nearly as fast
+ as the Tk Text widget. If you work with or are interested in creating your own Tcl/Tk widgets
+ in C++, you might want to take a look at the C++ widget library included with this
+ distribution. <a href="/live/annotate?url=http%3a%2f%2fftp%2eaustintx%2enet%2fusers%2fjatucker%2fTkTextmatrix%2fdefault%2ehtm">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:14)</font></i><dt><b><a href="http://www.cs.umd.edu/~bederson/Togl.html" ="">ToGL - a Tk Open GL widget</a></b>
+<dd>Togl is a Tk widget for OpenGL rendering. Togl is based on OGLTK, originally written by Benjamin Bederson at the
+University of New Mexico (who has since moved to the University of Maryland). Togl adds the new features:
+<ul>
+<li> color-index mode support including color allocation functions
+<li> support for requesting stencil, accumulation, alpha buffers, etc
+<li> multiple OpenGL drawing widgets
+<li> OpenGL extension testing from Tcl
+<li> simple, portable font support
+<li> overlay plane support
+</ul>
+Togl allows one to create and manage a special Tk/OpenGL widget with Tcl and render into it with a C program. That is,
+a typical Togl program will have Tcl code for managing the user interface and a C program for computations and
+OpenGL rendering. <a href="/live/annotate?url=http%3a%2f%2fwww%2ecs%2eumd%2eedu%2f%7ebederson%2fTogl%2ehtml">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:14)</font></i><dt><b><a href="http://www.hwaci.com/sw/tk/treepi.html" ="">Tree Widget</a></b>
+<dd>This implements a tree display in a canvas widget.
+It is similar in layout to that of the
+Windows explorer file viewer. This is pure Tcl
+code - not a C extension. <a href="/live/annotate?url=http%3a%2f%2fwww%2ehwaci%2ecom%2fsw%2ftk%2ftreepi%2ehtml">Edit</a>
+ <i><font size="-1">(September 29, 1999 14:37)</font></i><dt><b><a href="http://www.du.edu/~mschwart/tcl-tk.htm" ="">Windows Extensions for Tcl/Tk (Michael Schwartz)</a></b>
+<dd>This site has pointers to several extensions specific to the
+Windows platform. The extensions provide printing,
+a MAPI interface to send email, and an interface to manipulate
+.INI files, among other things. <a href="/live/annotate?url=http%3a%2f%2fwww%2edu%2eedu%2f%7emschwart%2ftcl%2dtk%2ehtm">Edit</a>
+ <i><font size="-1">(October 07, 1999 10:50)</font></i><dt><b><a href="http://www.tcltk.com/iwidgets/" ="">[incr Widgets] Home Page</a></b>
+<dd>[incr Widgets] is a set of megawidgets (combo boxes, etc.) that are
+upon the [incr Tcl] object system and the [incr Tk] megawidget
+framework. This comes bundled with the
+<a href="http://www.tcltk.com/itcl/">[incr Tcl]</a> distributions. <a href="/live/annotate?url=http%3a%2f%2fwww%2etcltk%2ecom%2fiwidgets%2f">Edit</a>
+ <i><font size="-1">(September 05, 1999 16:08)</font></i><dt><b><a href="http://www1.clearlight.com/~oakley/tcl/combobox/index.html" ="">combobox</a></b>
+<dd>
+ Author <b><a href="mailto:oakley@channelpoint.com" ="">Bryan Oakley</a></b>, Version <b>1.03</b>,
+ Works with <b>8.x</b>
+<br>Download: <a href="http://www1.clearlight.com/~oakley/tcl/combobox/combobox.tcl">combobox.tcl</a><br>combobox is a pure-tcl implementation of a combobox widget. It is
+entirely self contained and does not require any other OO or megawidget
+extension. It supports both editable and non-editable entries, and
+provides the ability to call a procedure anytime the value of the combobox
+changes. <a href="/live/annotate?url=http%3a%2f%2fwww1%2eclearlight%2ecom%2f%7eoakley%2ftcl%2fcombobox%2findex%2ehtml">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:15)</font></i><dt><b><a href="http://www.multimania.com/droche/rnotebook/index.html" ="">Rnotebook</a></b>
+<dd>
+ Author <b><a href="mailto:dan@lectra.com" ="">Daniel Roche</a></b>, Version <b>1.0</b>,
+ Works with <b>8.0 or higher</b>
+<br>Download: <a href="http://www.multimania.com/droche/rnotebook/index.html">index.html</a><br>This implements a resizeable notebook
+widget in pure tcl/tk <a href="/live/annotate?url=http%3a%2f%2fwww%2emultimania%2ecom%2fdroche%2frnotebook%2findex%2ehtml">Edit</a>
+ <i><font size="-1">(August 19, 1999 15:39)</font></i><dt><b><a href="http://www.tregar.com/samdi.html" ="">saMDI v1.0a1 Multi-Document Interface Extension</a></b>
+<dd>A multi-document interface (MDI) extension for TCL/Tk 8.0.
+This is a common interface format in Microsoft Windows that lets a parent window contain multiple child windows.
+In effect you get a window manager inside a window!
+Uses and includes the STOOOP object-oriented extension by
+Jean-Luc Fontaine.
+saMDI v1.0a1 GPL Copyright 1998 Sam Tregar. <a href="/live/annotate?url=http%3a%2f%2fwww%2etregar%2ecom%2fsamdi%2ehtml">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:07)</font></i><dt><b><a href="http://tix.mne.com/htdocs/tix/index.html" ="">Tix Support Site</a></b>
+<dd>
+ Author <b><a href="mailto:tix@mne.com" ="">Ioi Lam, (adopted by Gregg Squires)</a></b>, Version <b>4.1</b>,
+ Works with <b>Tcl 7.4 through Tcl 8.0</b>
+<br><a href="ftp://ftp.tix.mne.com/pub/tix/">Download</a>, <a href="ftp://ftp.tix.mne.com/pub/tix/Tix4.1.0.006.tar.gz">Tix4.1.0.006.tar.gz</a>, <a href="ftp://ftp.tix.mne.com/pub/tix/Tix41p6.zip">Tix41p6.zip</a>, <a href="ftp://ftp.tix.mne.com/pub/tix/win41p6bin.zip">win41p6bin.zip</a><br><b>Tix has found a new home!</b>
+ <br>
+ Tix provides over 40 new Tk including the
+combo box, file selection dialogs, paned widget,
+notebook, hierarchical list, directory tree, and more.
+ <a href="/live/annotate?url=http%3a%2f%2ftix%2emne%2ecom%2fhtdocs%2ftix%2findex%2ehtml">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:11)</font></i><dt><b><a href="ftp://ftp.archive.eso.org/pub/tree" ="">Tk Tree Widget (C++)</a></b>
+<dd>Tk Tree widget for Tcl8.0.3.
+
+This version contains (optional) support for \[incr Tcl\] and \[incr Tk\]
+version 3.0.
+<br>
+With the tree widget, you can display a tree in a Tk canvas. The nodes
+can be made up of any number of canvas items or even other Tk widgets.
+You create the objects that make up a node and the line that connects
+it to its parent and pass them to the tree widget. After this the tree
+widget manages the positions of the nodes and end points of the tree
+lines. Operations are available for inserting, moving and removing
+nodes and subtrees and for querrying the position of a node in the
+tree. The tree can be displayed horizontally or vertically.
+ <a href="/live/annotate?url=ftp%3a%2f%2fftp%2earchive%2eeso%2eorg%2fpub%2ftree">Edit</a>
+ <i><font size="-1">(August 25, 1999 03:14)</font></i><dt><b><a href="http://www.purl.org/net/hobbs/tcl/script/widget/" ="">widget, simple megawidget package</a></b>
+<dd>
+ Author <b><a href="mailto:jeffrey.hobbs@oen.siemens.de" ="">Jeffrey Hobbs</a></b>, Version <b>0.9</b>,
+ Works with <b>Tcl/Tk 8.0 or higher</b>
+<br>Download: <a href="http://www.purl.org/net/hobbs/tcl/script/widget/widget-0.9.tar.gz">widget-0.9.tar.gz</a><br>This is a package of
+ megawidgets (i.e., compound widgets) that work almost exactly like Tk widgets.
+ You can also build your own new megawidgets.
+Includes: combobox, hierarchy, console, progressbar,
+tabnotebook, validating entry, pane geometry manager, baloon help. <a href="/live/annotate?url=http%3a%2f%2fwww%2epurl%2eorg%2fnet%2fhobbs%2ftcl%2fscript%2fwidget%2f">Edit</a>
+ <i><font size="-1">(August 23, 1999 12:16)</font></i></dl>
+<hr><p><center><font size="-1" face="Geneva, Helvetica, Arial"><br><a href="#TOP"><b>Top</b></a><br><!-- key ResourceSoftwareExtensions --><a href="/">Home</a>
+ | <a href="/products/">Products</a>
+ | <a href="/customers/">Customers</a>
+ | <a href="/partners/">Partners</a>
+ | <a href="/services/">Services</a>
+ | <a href="/resource/">Tcl Resources</a>
+ | <a href="/company/">Company</a>
+<br><a href="/live/keyword">Search</a>
+ | <a href="/live/map">Site Map</a>
+ | <a href="/company/feedback.html?url=%2fresource%2fsoftware%2fextensions%2ftk%2f">Feedback</a>
+ | <a href="/company/contact.html">Contact Us</a>
+ | <a href="mailto:info@scriptics.com">info@scriptics.com</a>
+
+ <SCRIPT LANGUAGE="Javascript">
+<!--
+ browser = (((navigator.appName == "Netscape") &&(parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName =="Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))
+
+ if ( browser )
+ {
+ over = new MakeImageArray(10)
+ over[0].src = "http://images.scriptics.com/images/ProductsMouseOff.gif"
+ over[1].src = "http://images.scriptics.com/images/CustomersMouseOff.gif"
+ over[2].src = "http://images.scriptics.com/images/PartnersMouseOff.gif"
+ over[3].src = "http://images.scriptics.com/images/ServicesMouseOff.gif"
+ over[4].src = "http://images.scriptics.com/images/ResourceMouseOff.gif"
+ over[5].src = "http://images.scriptics.com/images/CompanyMouseOff.gif"
+ over[6].src = "http://images.scriptics.com/images/homeMainRollover1.gif"
+ over[7].src = "http://images.scriptics.com/images/homeMainRollover2.gif"
+ over[8].src = "http://images.scriptics.com/images/homeMainRollover3.gif"
+ over[9].src = "http://images.scriptics.com/images/homeMainRollover3.gif"
+
+ }
+
+ function MakeImageArray(n) {
+ this.length = n
+ for (var i = 0; i<=n; i++)="i++)" {="{" this[i]="this[i]" ="" new="new" Image()="Image()" }="}" return="return" this="this" }="}" //="//" --="--">
+ </SCRIPT><br>
+ <font size="2">
+ &copy; 1998-2000 Scriptics Corporation. All rights reserved.
+ <a href="/legal_notice.html">Legal Notice</a> | <A href="" /privacy.html="/privacy.html">
+ Privacy Statement</a>
+ </td></tr></table></td></tr></table>
+</Body>
+</Html> \ No newline at end of file
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image1 b/ext/tk/sample/tkextlib/tkHTML/page3/image1
new file mode 100644
index 00000000000..814d1e8f08d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image1
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image10 b/ext/tk/sample/tkextlib/tkHTML/page3/image10
new file mode 100644
index 00000000000..45001faf052
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image10
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image11 b/ext/tk/sample/tkextlib/tkHTML/page3/image11
new file mode 100644
index 00000000000..7c4c170f217
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image11
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image12 b/ext/tk/sample/tkextlib/tkHTML/page3/image12
new file mode 100644
index 00000000000..903e7344a68
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image12
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image13 b/ext/tk/sample/tkextlib/tkHTML/page3/image13
new file mode 100644
index 00000000000..226d4f68c2e
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image13
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image14 b/ext/tk/sample/tkextlib/tkHTML/page3/image14
new file mode 100644
index 00000000000..8e8c71814c1
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image14
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image2 b/ext/tk/sample/tkextlib/tkHTML/page3/image2
new file mode 100644
index 00000000000..2ddeb3258ce
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image2
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image3 b/ext/tk/sample/tkextlib/tkHTML/page3/image3
new file mode 100644
index 00000000000..1651ba7e415
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image3
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image4 b/ext/tk/sample/tkextlib/tkHTML/page3/image4
new file mode 100644
index 00000000000..b565c8dd0e9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image4
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image5 b/ext/tk/sample/tkextlib/tkHTML/page3/image5
new file mode 100644
index 00000000000..e1268b81c09
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image5
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image6 b/ext/tk/sample/tkextlib/tkHTML/page3/image6
new file mode 100644
index 00000000000..1a6b260b407
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image6
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image7 b/ext/tk/sample/tkextlib/tkHTML/page3/image7
new file mode 100644
index 00000000000..cec7aa04d8f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image7
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image8 b/ext/tk/sample/tkextlib/tkHTML/page3/image8
new file mode 100644
index 00000000000..ad0d748d65c
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image8
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/image9 b/ext/tk/sample/tkextlib/tkHTML/page3/image9
new file mode 100644
index 00000000000..46ade3018bb
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/image9
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page3/index.html b/ext/tk/sample/tkextlib/tkHTML/page3/index.html
new file mode 100644
index 00000000000..ce92e8a22e1
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page3/index.html
@@ -0,0 +1,2787 @@
+<html><body bgcolor="white">
+<hr>
+<h1 align="center">Embedding Tcl in C/C++ Applications</h1>
+
+ <table width="100%">
+ <tr><td valign="top" align="left" width="46%">
+ <b>Presented At:</b>
+ <blockquote>
+ The&nbsp;Tcl2K&nbsp;Conference<br>
+ Austin, Texas<br>
+ <nobr>9:00am, February 15, 2000</nobr><br>
+ </blockquote>
+ </td>
+ <td width="5%">&nbsp;</td>
+ <td valign="top" align="left" width="46%">
+ <b>Instructor:</b>
+ <blockquote>
+ D. Richard Hipp<br>
+ drh@hwaci.com<br>
+ http://www.hwaci.com/drh/<br>
+ 704.948.4565
+ </blockquote>
+ </td></tr>
+ </table><p>
+ <center><table border="2">
+ <tr><td>
+ <p align="center">
+ Copies of these notes, example source code,<br>and other
+ resources related to this tutorial<br>are available online at
+ <a href="http://www.hwaci.com/tcl2k/">
+ http://www.hwaci.com/tcl2k/</a></p>
+ <p align="center"><small>$Id$</small></p></td></tr>
+ </table>
+ </center>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Tutorial Outline</h2>
+<p><ul><li>Introduction</li>
+<li>Building It Yourself</li>
+<ul><li>"Hello, World!" using Tcl</li>
+<li>Tcl scripts as C strings</li>
+<li>Adding new Tcl commands</li>
+<li>A tour of the Tcl API</li>
+<li>Tcl initialization scripts</li>
+<li>Adding Tk</li>
+</ul><li>Tools Survey</li>
+<li>Mktclapp</li>
+<ul><li>"Hello World" using mktclapp</li>
+<li>Adding C code</li>
+<li>Other Features</li>
+<li>Invoking Tcl from C</li>
+<li>Running mktclapp directly</li>
+<li>Real-world examples</li>
+</ul><li>Summary</li>
+</ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Embedding Tcl in C/C++ Applications</h2>
+<p><ul><li>You know how to program in Tcl/Tk</li></ul><ul><li>You know how to program in C/C++</li></ul><ul><li>This tutorial is about how to do both at the same time.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Why Mix C With Tcl/Tk?</h2>
+<p><ul><li>Use C for the things C is good at and Tcl for the things
+ Tcl is good at.</li></ul><ul><li>Generate standalone executables.
+ <ul><li>Eliminate the need to install Tcl/Tk.</li>
+ <li>Prevent problems when the wrong version of Tcl/Tk is installed.</li>
+ </ul></li></ul><ul><li>Prevent end users from changing the source code.
+ <ul><li>Keeps users from creating new bugs.</li>
+ <li>Protects proprietary code.</li>
+ </ul></li></ul><ul><li>Office politics</li></ul><ul><li>Use Tcl/Tk as a portability layer for a large C program</li></ul><ul><li>Use Tcl as a testing interface</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Why Mix C With Tcl/Tk?</h2>
+<p><blockquote><big><b>
+ "Use C for the things C is good at and use Tcl/Tk for the things
+ Tcl/Tk is good at."
+ </b></blockquote></p><p>
+
+ <table width="100%">
+ <tr><td valign="top" align="left" width="46%">
+ <b>C is good at:</b>
+ <ul>
+ <li>Speed</li>
+ <li>Complex data structures</li>
+ <li>Computation</li>
+ <li>Interacting with hardware</li>
+ <li>Byte-by-byte data analysis</li>
+ </ul>
+ </td>
+ <td width="5%">&nbsp;</td>
+ <td valign="top" align="left" width="46%">
+ <b>Tcl/Tk is good at:</b>
+ <ul>
+ <li>Building a user interface</li>
+ <li>Manipulation of strings</li>
+ <li>Portability</li>
+ <li>Opening sockets</li>
+ <li>Handling events</li>
+ </ul>
+ </td></tr>
+ </table>
+<br clear="both"><p><hr></p>
+<h2 align="center">Programming Models</h2>
+<table width="100%">
+<tr><td valign="top" width="49%">
+
+ <p><b>Mainstream Tcl Programming Model:</b></p>
+</td>
+<td width="2%">&nbsp;</td>
+<td valign="top" width="49%">
+
+ <p><b>Embedded Tcl Programming Model:&nbsp;&nbsp;</b></p>
+</td></tr>
+<tr><td valign="top" width="49%">
+
+ <ul><li>Add bits of C code to a large Tcl program</li></ul>
+</td>
+<td width="2%">&nbsp;</td>
+<td valign="top" width="49%">
+
+ <ul><li>Add bits of Tcl code to a large C program</li></ul>
+</td></tr>
+<tr><td valign="top" width="49%">
+
+ <ul><li>Main Tcl script loads extensions written in C</li></ul>
+</td>
+<td width="2%">&nbsp;</td>
+<td valign="top" width="49%">
+
+ <ul><li>Main C procedure invokes the Tcl interpreter</li></ul>
+</td></tr>
+<tr><td valign="top" width="49%">
+
+ <ul><li>Tcl/Tk is a programming language</li></ul>
+</td>
+<td width="2%">&nbsp;</td>
+<td valign="top" width="49%">
+
+ <ul><li>Tcl/Tk is a C library</li></ul>
+</td></tr>
+<tr><td valign="top" width="49%">
+
+ <center><img src="image1"><br>
+ Most of the Tcl2K conference is about</center>
+</td>
+<td width="2%">&nbsp;</td>
+<td valign="top" width="49%">
+
+ <center><img src="image1"><br>
+ This tutorial is about</center>
+</td></tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">"Hello, World!" Using The Tcl Library</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h></tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Always include &lt;tcl.h></td>
+</tr>
+<tr><td valign="center">
+<small><tt>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Create a new Tcl interpreter</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;"puts&nbsp;{Hello,&nbsp;World!}");</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Execute a Tcl command.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Compiling "Hello, World!"</h2>
+<p><p><b>Unix:</b></p>
+ <blockquote><tt>
+ $ gcc hello.c -ltcl -lm -ldl<br>
+ $ ./a.out<br>
+ Hello, World!</tt></blockquote>
+
+ <p><b>Windows using Cygwin:</b></p>
+ <blockquote><tt>
+ C:> gcc hello.c -ltcl80 -lm<br>
+ C:> a.exe<br>
+ Hello, World!</tt></blockquote>
+
+ <p><b>Windows using Mingw32:</b></p>
+ <blockquote><tt>
+ C:> gcc -mno-cygwin hello.c -ltcl82 -lm<br>
+ </tt></blockquote>
+<table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>Also works with VC++</b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Where Does <tt>-ltcl</tt> Come From On Unix?</h2>
+<p><p>Build it yourself using these steps:</p></p><p>
+<p><ul><li>Get tcl8.2.2.tar.gz from Scriptics</li></ul><ul><li><tt>zcat tcl8.2.2.tar.gz | tar vx </tt></li></ul><ul><li><tt>cd tcl8.2.2/unix</tt></li></ul><ul><li><tt>./configure --disable-shared</tt></li></ul><ul><li><tt>make</tt></li></ul><ul><li>Move <b>libtcl8.2.a</b> to your lib directory.</li></ul><ul><li>Copy <b>../generic/tcl.h</b> into /usr/include.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">What Other Libraries Are Required For Unix?</h2>
+<p><ul><li>The sequence of <b>-l</b> options after <b>-ltcl</b>
+ varies from system to system</li></ul><ul><li>Observe what libraries the TCL makefile inserts when
+ it is building <b>tclsh</b></li></ul><ul><li>Examples in this talk are for RedHat Linux 6.0 for Intel</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">How To Compile Under Unix Without Installing Tcl</h2>
+<p><p>Specify the *.a file directly:</p>
+ <blockquote><pre>
+ $ gcc -I../tcl8.2.2/generic hello.c \
+ ../tcl8.2.2/unix/libtcl8.2.a -lm -ldl
+ $ strip a.out
+ $ ./a.out
+ Hello, World!</pre></blockquote>
+
+ <p>Or, tell the C compiler where to look for *.a files:</p>
+ <blockquote><pre>
+ $ gcc -I../tcl8.2.2/generic hello.c \
+ -L../tcl8.2.2/unix -ltcl -lm -ldl
+ $ strip a.out
+ $ ./a.out
+ Hello, World!</pre></blockquote>
+<table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>The <tt>-I../tcl8.2.2</tt> argument
+ tells the compiler where to
+ find <tt>&lt;tcl.h&gt;</tt>.</p></b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">What's "Cygwin"?</h2>
+<p><ul><li>An implementation of GCC/G++ and all development tools
+ for Windows95/98/NT/2000</li></ul><ul><li>Available for free download at
+ <blockquote>
+ <tt>http://sourceware.cygnus.com/cygwin/</tt>
+ </blockquote></li></ul><ul><li>Also available shrink-wrapped at your local software retailer or
+ online at
+ <blockquote>
+ <tt>http://www.cygnus.com/cygwin/index.html</tt>
+ </blockquote></li></ul><ul><li>Programs compiled using Cygwin require a special
+ DLL (<b>cygwin1.dll</b>) that provides a POSIX system API</li></ul><ul><li>Cygwin1.dll cannot be shipped with proprietary programs
+ without purchasing a license from Cygnus.</li></ul><ul><li>Mingw32 is the same compiler as Cygwin, but generates
+ binaries that do not use cygwin1.dll</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Where Does <tt>-ltcl82</tt> Come From On Windows?</h2>
+<p><p>Build it like this:</p></p><p>
+<p><ul><li>Get <b>tcl82.lib</b> and <b>tcl82.dll</b> from Scriptics.</li></ul><ul><li><tt>echo EXPORTS >tcl82.def</tt></li></ul><ul><li><tt>nm tcl82.lib | grep 'T _' | sed 's/.* T _//' >>tcl82.def</tt></li></ul><ul><li><tt>dlltool --def tcl82.def --dllname tcl82.dll --output-lib libtcl82.a</tt></li></ul><ul><li>Move <b>libtcl82.a</b> to the lib directory and <b>tcl82.dll</b>
+ to the bin directory.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Where Does Your Code Go?</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;Your&nbsp;application&nbsp;code&nbsp;goes&nbsp;here&nbsp;*/</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Insert C code here to do whatever it is your program is
+ suppose to do</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Building A Simple TCLSH</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;char&nbsp;*z;<br>
+&nbsp;&nbsp;char&nbsp;zLine[2000];<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;while(&nbsp;fgets(zLine,sizeof(zLine),stdin)&nbsp;){</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Get one line of input</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zLine);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Execute the input as Tcl.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;z&nbsp;=&nbsp;Tcl_GetStringResult(interp);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;z[0]&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("厚PX\n",&nbsp;z);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Print result if not empty</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>What if user types more than 2000 characters?</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Building A Simple TCLSH</h2>
+<p>Use TCL to handle input. Allows input lines of unlimited length.</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+/*&nbsp;Tcl&nbsp;code&nbsp;to&nbsp;implement&nbsp;the<br>
+**&nbsp;input&nbsp;loop&nbsp;*/<br>
+static&nbsp;char&nbsp;zLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;"while&nbsp;{![eof&nbsp;stdin]}&nbsp;{\n"</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;"&nbsp;&nbsp;set&nbsp;line&nbsp;[gets&nbsp;stdin]\n"</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Get one line of input</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;"&nbsp;&nbsp;set&nbsp;result&nbsp;[eval&nbsp;$line]\n"</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Execute input as Tcl</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;"&nbsp;&nbsp;if&nbsp;{$result!=\"\"}&nbsp;{puts&nbsp;$result}\n"</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Print result</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;"}\n"<br>
+;<br>
+&nbsp;<br>
+<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zLoop);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Run the Tcl input loop</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>But what about commands that span multiple lines of input?</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Better Handling Of Command-Line Input</h2>
+<p>The file "input.tcl"</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>set&nbsp;line&nbsp;{}<br>
+while&nbsp;{![eof&nbsp;stdin]}&nbsp;{</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if&nbsp;{$line!=""}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;-nonewline&nbsp;">&nbsp;"<br>
+&nbsp;&nbsp;}&nbsp;else&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;-nonewline&nbsp;"%&nbsp;"<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;flush&nbsp;stdout</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Prompt for user input. The prompt is normally &quot;%&quot;
+ but changes to &quot;&gt;&quot; if the current line is a continuation.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;append&nbsp;line&nbsp;[gets&nbsp;stdin]<br>
+&nbsp;&nbsp;if&nbsp;{[info&nbsp;complete&nbsp;$line]}&nbsp;{</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;{[catch&nbsp;{uplevel&nbsp;#0&nbsp;$line}&nbsp;result]}&nbsp;{</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">If the command is complete, execute it.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;stderr&nbsp;"Error:&nbsp;$result"<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;{$result!=""}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;$result<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;line&nbsp;{}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;}&nbsp;else&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;append&nbsp;line&nbsp;\n<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">If the command is incomplete, append a newline and get
+ another line of text.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Better Handling Of Command-Line Input</h2>
+<p>The file "input.c"</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;"source&nbsp;input.tcl");</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Read and execute the input loop</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>But now the program is not standalone!</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Converting Scripts Into C Strings</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;"set&nbsp;line&nbsp;{}\n"<br>
+&nbsp;&nbsp;"while&nbsp;{![eof&nbsp;stdin]}&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;if&nbsp;{$line!=\"\"}&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;-nonewline&nbsp;\">&nbsp;\"\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;}&nbsp;else&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;-nonewline&nbsp;\"%&nbsp;\"\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;}\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;flush&nbsp;stdout\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;append&nbsp;line&nbsp;[gets&nbsp;stdin]\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;if&nbsp;{[info&nbsp;complete&nbsp;$line]}&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;{[catch&nbsp;{uplevel&nbsp;#0&nbsp;$line}&nbsp;result]}&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;stderr&nbsp;\"Error:&nbsp;$result\"\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;{$result!=\"\"}&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;$result\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;}\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;line&nbsp;{}\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;}&nbsp;else&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;&nbsp;&nbsp;append&nbsp;line&nbsp;\\n\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;}\n"<br>
+&nbsp;&nbsp;"}\n"<br>
+;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Compile Tcl Scripts Into C Programs</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Actual&nbsp;code&nbsp;omitted&nbsp;*/<br>
+;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Copy and paste the converted Tcl script here</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Execute the Tcl code</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Converting Scripts To Strings<br>Using SED Or TCLSH</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>sed&nbsp;-e&nbsp;'s/\\/\\\\/g'&nbsp;\&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Convert <b>\</b> into <b>\\</b></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'s/"/\\"/g'&nbsp;\&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Convert <b>"</b> into <b>\"</b></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'s/^/&nbsp;&nbsp;"/'&nbsp;\&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Add <b>"</b> to start of each line</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'s/$/\\n"/'&nbsp;input.tcl</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Add <b>\n"</b> to end of each line</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+&nbsp;<br>
+<br>
+&nbsp;<br>
+<br>
+while&nbsp;{![eof&nbsp;stdin]}&nbsp;{<br>
+&nbsp;&nbsp;set&nbsp;line&nbsp;[gets&nbsp;stdin]</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;regsub&nbsp;-all&nbsp;{\}&nbsp;$line&nbsp;{&amp;&amp;}&nbsp;line</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Convert <b>\</b> into <b>\\</b></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;regsub&nbsp;-all&nbsp;{"}&nbsp;$line&nbsp;{\"}&nbsp;line</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Convert <b>"</b> into <b>\"</b></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;puts&nbsp;"\"$line\\n\""</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Add <b>"</b> in front and <b>\n"</b> at the end</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Converting Scripts Into C Strings</h2>
+<p>You may want to save space by removing comments and extra whitespace
+ from scripts.</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;"set&nbsp;line&nbsp;{}\n"<br>
+&nbsp;&nbsp;"while&nbsp;{![eof&nbsp;stdin]}&nbsp;{\n"<br>
+&nbsp;&nbsp;"if&nbsp;{$line!=\"\"}&nbsp;{\n"<br>
+&nbsp;&nbsp;"puts&nbsp;-nonewline&nbsp;\">&nbsp;\"\n"<br>
+&nbsp;&nbsp;"}&nbsp;else&nbsp;{\n"<br>
+&nbsp;&nbsp;"puts&nbsp;-nonewline&nbsp;\"%&nbsp;\"\n"<br>
+&nbsp;&nbsp;"}\n"<br>
+&nbsp;&nbsp;"flush&nbsp;stdout\n"<br>
+&nbsp;&nbsp;"append&nbsp;line&nbsp;[gets&nbsp;stdin]\n"<br>
+&nbsp;&nbsp;"if&nbsp;{[info&nbsp;complete&nbsp;$line]}&nbsp;{\n"<br>
+&nbsp;&nbsp;"if&nbsp;{[catch&nbsp;{uplevel&nbsp;#0&nbsp;$line}&nbsp;result]}&nbsp;{\n"<br>
+&nbsp;&nbsp;"puts&nbsp;stderr&nbsp;\"Error:&nbsp;$result\"\n"<br>
+&nbsp;&nbsp;"}&nbsp;elseif&nbsp;{$result!=\"\"}&nbsp;{\n"<br>
+&nbsp;&nbsp;"puts&nbsp;$result\n"<br>
+&nbsp;&nbsp;"}\n"<br>
+&nbsp;&nbsp;"set&nbsp;line&nbsp;{}\n"<br>
+&nbsp;&nbsp;"}&nbsp;else&nbsp;{\n"<br>
+&nbsp;&nbsp;"append&nbsp;line&nbsp;\\n\n"<br>
+&nbsp;&nbsp;"}\n"<br>
+&nbsp;&nbsp;"}\n"<br>
+;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Converting Scripts To Strings</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>sed&nbsp;-e&nbsp;'s/\\/\\\\/g'&nbsp;\&nbsp;<br>
+&nbsp;&nbsp;-e&nbsp;'s/"/\\"/g'&nbsp;\&nbsp;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'/^&nbsp;*#/d'&nbsp;\&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Delete lines that begin with #</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'/^&nbsp;*$/d'&nbsp;\&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Delete blank lines</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'s/^&nbsp;*/&nbsp;&nbsp;"/'&nbsp;\&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Delete leading spaces</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;-e&nbsp;'s/$/\\n"/'&nbsp;input.tcl<br>
+&nbsp;<br>
+<br>
+&nbsp;<br>
+<br>
+&nbsp;<br>
+while&nbsp;{![eof&nbsp;stdin]}&nbsp;{<br>
+&nbsp;&nbsp;set&nbsp;line&nbsp;[gets&nbsp;stdin]</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;set&nbsp;line&nbsp;[string&nbsp;trimleft&nbsp;$line]</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Remove leading space</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if&nbsp;{$line==""}&nbsp;continue</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Delete blank lines</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if&nbsp;{[string&nbsp;index&nbsp;$line&nbsp;0]=="#"}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;continue<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Delete lines starting with #</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;regsub&nbsp;-all&nbsp;{\}&nbsp;$line&nbsp;{&amp;&amp;}&nbsp;line<br>
+&nbsp;&nbsp;regsub&nbsp;-all&nbsp;{"}&nbsp;$line&nbsp;{\"}&nbsp;line<br>
+&nbsp;&nbsp;puts&nbsp;"\"$line\\n\""<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Removing Comments Or Leading Space<br>Will Break Some Tcl Scripts!</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>image&nbsp;create&nbsp;bitmap&nbsp;smiley&nbsp;-data&nbsp;{</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>#define&nbsp;smile_width&nbsp;15<br>
+#define&nbsp;smile_height&nbsp;15</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">These lines begin with # but are not comment</td>
+</tr>
+<tr><td valign="center">
+<small><tt>static&nbsp;unsigned&nbsp;char&nbsp;smile_bits[]&nbsp;=&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;0xc0,&nbsp;0x01,&nbsp;0x30,&nbsp;0x06,&nbsp;0x0c,&nbsp;0x18,<br>
+&nbsp;&nbsp;&nbsp;0x04,&nbsp;0x10,&nbsp;0x22,&nbsp;0x22,&nbsp;0x52,&nbsp;0x25,<br>
+&nbsp;&nbsp;&nbsp;0x01,&nbsp;0x40,&nbsp;0x01,&nbsp;0x40,&nbsp;0x01,&nbsp;0x40,<br>
+&nbsp;&nbsp;&nbsp;0x12,&nbsp;0x24,&nbsp;0xe2,&nbsp;0x23,&nbsp;0x04,&nbsp;0x10,<br>
+&nbsp;&nbsp;&nbsp;0x0c,&nbsp;0x18,&nbsp;0x30,&nbsp;0x06,&nbsp;0xc0,&nbsp;0x01};<br>
+}<br>
+&nbsp;<br>
+<br>
+&nbsp;<br>
+text&nbsp;.t<br>
+pack&nbsp;.t<br>
+.t&nbsp;insert&nbsp;end&nbsp;[string&nbsp;trim&nbsp;{</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>She&nbsp;walks&nbsp;in&nbsp;beauty,&nbsp;like&nbsp;the&nbsp;night<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Of&nbsp;cloudless&nbsp;climes&nbsp;and&nbsp;starry&nbsp;skies;<br>
+And&nbsp;all&nbsp;that's&nbsp;best&nbsp;of&nbsp;dark&nbsp;and&nbsp;bright<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Meet&nbsp;in&nbsp;her&nbsp;aspect&nbsp;and&nbsp;her&nbsp;eyes;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Indentation is deleted on lines 2
+ and 4</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}]&nbsp;<br>
+&nbsp;<br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>Problems like these are rare</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Adding A "continue" Command</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>set&nbsp;line&nbsp;{}<br>
+while&nbsp;{![eof&nbsp;stdin]}&nbsp;{<br>
+&nbsp;&nbsp;if&nbsp;{$line!=""}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;-nonewline&nbsp;">&nbsp;"<br>
+&nbsp;&nbsp;}&nbsp;else&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;-nonewline&nbsp;"%&nbsp;"<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;flush&nbsp;stdout<br>
+&nbsp;&nbsp;append&nbsp;line&nbsp;[gets&nbsp;stdin]<br>
+&nbsp;&nbsp;if&nbsp;{[info&nbsp;complete&nbsp;$line]}&nbsp;{</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;{[lindex&nbsp;$line&nbsp;0]=="continue"}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Break out of the loop if the command
+ is "continue"</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;{[catch&nbsp;{uplevel&nbsp;#0&nbsp;$line}&nbsp;result]}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;stderr&nbsp;"Error:&nbsp;$result"<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;{$result!=""}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;$result<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;line&nbsp;{}<br>
+&nbsp;&nbsp;}&nbsp;else&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;append&nbsp;line&nbsp;\n<br>
+&nbsp;&nbsp;}<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Stop For Tcl Input At Various Points<br>In A C Program</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Tcl&nbsp;Input&nbsp;loop&nbsp;as&nbsp;a&nbsp;C&nbsp;string&nbsp;*/<br>
+;<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;Application&nbsp;C&nbsp;code&nbsp;*/</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Do some computation</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Stop for some Tcl input</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;More&nbsp;application&nbsp;C&nbsp;code&nbsp;*/</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Do more computation</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Stop for more Tcl input</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;Finish&nbsp;up&nbsp;the&nbsp;application&nbsp;*/</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Finish the computation</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Using Tcl For Testing</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Tcl&nbsp;Input&nbsp;loop&nbsp;as&nbsp;a&nbsp;C&nbsp;string&nbsp;*/<br>
+;<br>
+&nbsp;<br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+#ifdef&nbsp;TESTING<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Create interpreter only if TESTING
+ is defined</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();<br>
+#endif<br>
+&nbsp;&nbsp;/*&nbsp;Application&nbsp;C&nbsp;code&nbsp;*/</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>#ifdef&nbsp;TESTING<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+#endif</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Accept command-line input only if TESTING
+ is defined</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;More&nbsp;application&nbsp;C&nbsp;code&nbsp;*/<br>
+#ifdef&nbsp;TESTING<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+#endif<br>
+&nbsp;&nbsp;/*&nbsp;Finish&nbsp;up&nbsp;the&nbsp;application&nbsp;*/<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Creating A New Tcl Command In C</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+int&nbsp;NewCmd(</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;void&nbsp;*clientData,<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp,<br>
+&nbsp;&nbsp;int&nbsp;argc,<br>
+&nbsp;&nbsp;char&nbsp;**argv</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">The Tcl command is implemented as
+ a C function with four arguments.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>){<br>
+&nbsp;&nbsp;printf("Hello,&nbsp;World!\n");</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;TCL_OK;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Returns TCL_OK or TCL_ERROR</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}<br>
+&nbsp;<br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Tcl&nbsp;code&nbsp;omitted...&nbsp;*/<br>
+;<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_CreateCommand(interp,&nbsp;"helloworld",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NewCmd,&nbsp;0,&nbsp;0);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Tell the interpreter which C function to call when the
+ "helloworld" Tcl command is executed</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Linkage From Tcl To C</h2>
+<p><p align="center"><img src="image4"></p></p><p><ul><li>3rd parameter of Tcl_CreateCommand() is a pointer to the C subroutine
+ that implements the command.</li></ul><ul><li>4th parameter to Tcl_CreateCommand() becomes the 1st parameter to
+ the C routine whenever the Tcl command is executed.</li></ul><ul><li>1st parameter to Tcl_CreateCommand() must be a valid Tcl interpreter.
+ The same pointer appears as the second parameter to the C routine
+ whenever the Tcl command is executed.</li></ul></p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Linkage From Tcl To C</h2>
+<p><p align="center"><img src="image5"></p></p><p><ul><li>5th parameter of Tcl_CreateCommand() is a pointer to the C subroutine
+ that is called when the Tcl command is deleted.</li></ul><ul><li>4th parameter to Tcl_CreateCommand() becomes the 1st parameter to
+ the C routine.</li></ul></p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">When To Use A Delete Proc</h2>
+<p>Examples of where the delete proc is used in standard Tcl/Tk:</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>button&nbsp;.b&nbsp;-text&nbsp;Hello<br>
+pack&nbsp;.b</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>rename&nbsp;.b&nbsp;{}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Deleting the <b>.b</b> command causes the button to be destroyed</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+&nbsp;<br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>image&nbsp;create&nbsp;photo&nbsp;smiley&nbsp;\&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;-file&nbsp;smiley.gif</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>rename&nbsp;smiley&nbsp;{}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Deleting the <b>smiley</b> command destroys the image and reclaims the
+ memory used to hold the image</td>
+</tr>
+</table>
+<p><ul><li>Always use a delete proc if the clientData is a pointer to
+ malloced memory or some other resource that needs freeing</li></ul><ul><li>Delete procs are never used in the Tcl core but are used
+ extensively in Tk</li></ul></p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Linkage From Tcl To C</h2>
+<p>The <tt>argc</tt> and <tt>argv</tt> parameters work just like in
+ <tt>main()</tt></p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>helloworld&nbsp;one&nbsp;{two&nbsp;three}&nbsp;four</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><tt>argc = 4<br>
+ argv[0] = "helloworld"<br>
+ argv[1] = "one"<br>
+ argv[2] = "two three"<br>
+ argv[3] = "four"<br>
+ argv[4] = NULL</tt></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">A Short-Cut</h2>
+<p>In a program with many new Tcl commands implemented in C, it becomes
+ tedious to type the same four parameters over and over again. So
+ we define a short-cut.</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#define&nbsp;TCLARGS&nbsp;\&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;*clientData,&nbsp;\&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;Tcl_Interp&nbsp;*interp,&nbsp;\&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;argc,&nbsp;\&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*argv</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Define TCLARGS once in a header file</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;<br>
+&nbsp;<br>
+&nbsp;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>int&nbsp;NewCmd(TCLARGS){</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Use the TCLARGS macro to define new C functions
+ that implement Tcl commands.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;/*&nbsp;implementation...&nbsp;*/<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>For brevity, we will use the TCLARGS macro during the
+ rest of this talk.</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Returning A Value From C Back To Tcl</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>int&nbsp;NewCmd(TCLARGS){</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Note that the C function returns an "int"</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;TCL_OK;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Return value is TCL_OK or TCL_ERROR</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><ul><li>TCL_OK and TCL_ERROR are defined in &lt;tcl.h&gt;</li></ul><ul><li>Other valid return values TCL_RETURN, TCL_BREAK and TCL_CONTINUE
+ are rarely used</li></ul><ul><li>Common mistake: forgetting to return TCL_OK</li></ul></p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Returning A Value From C Back To Tcl</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>int&nbsp;NewCmd(TCLARGS){</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_SetResult(interp,"Hello!",TCL_STATIC);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Set the result to "Hello!"</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;TCL_OK;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><ul><li>Result should be the text of an error message if you
+ return TCL_ERROR.</li></ul><ul><li>3rd argument to Tcl_SetResult() can be TCL_STATIC,
+ TCL_DYNAMIC, TCL_VOLATILE, or a function pointer.</li></ul><ul><li>Also consider using Tcl_AppendResult().</li></ul><ul><li>Direct access to <tt>interp->result</tt> is deprecated.</li></ul><ul><li>See the man pages for details.</li></ul></p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The Tcl_Obj Interface</h2>
+<p><ul><li>A new way to write Tcl commands in C code</li></ul><ul><li>First introduced in Tcl8.0</li></ul><ul><li>Can be much faster, especially for lists or numeric values.</li></ul><ul><li>Able to handle arbitrary binary data.</li></ul><ul><li>More difficult to program.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">The Tcl_Obj Interface</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>int&nbsp;NewObjCmd(<br>
+&nbsp;&nbsp;void&nbsp;*clientData,<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp,<br>
+&nbsp;&nbsp;int&nbsp;objc,</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Obj&nbsp;*const*&nbsp;objv</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">4th parameter is an array Tcl_Objs, not an array of strings</td>
+</tr>
+<tr><td valign="center">
+<small><tt>){<br>
+&nbsp;&nbsp;/*&nbsp;Implementation...&nbsp;*/<br>
+&nbsp;&nbsp;return&nbsp;TCL_OK;<br>
+}<br>
+&nbsp;<br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Tcl&nbsp;code&nbsp;omitted...&nbsp;*/<br>
+;<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_CreateObjCommand(interp,&nbsp;"newcmd",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NewObjCmd,&nbsp;0,&nbsp;0);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Use a different function to register the command</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The Tcl_Obj Interface</h2>
+<p><ul><li>There are countless access methods for reading information from and
+ placing information in Tcl_Objs. Always use the access methods.</li></ul><ul><li>Details provided at Lee Bernhard's talk this afternoon.</li></ul><ul><li>Definitely use Tcl_Objs if you are writing a new Tcl extension.</li></ul><ul><li>Tcl_Objs address some of the weaknesses of Tcl relative to C/C++.
+ <ul>
+ <li> Tcl_Objs are faster </li>
+ <li> Tcl_Objs work with binary data </li>
+ </ul>
+ But C/C++ is faster still and better for working with binary data.</li></ul><ul><li>When mixing C/C++ with Tcl/Tk the benefits of Tcl_Objs are
+ less important. Using Tcl_Objs in this context may not be
+ worth the extra trouble.</li></ul><ul><li>This talk will focus on the string interface.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Nickel Tour Of The Tcl API</h2>
+<p><p><b>Memory allocation functions</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Alloc<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Free<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Realloc<br>
+</tt></small></td>
+</table></center><p><b>Functions useful in the implementation of new Tcl commands</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_AppendElement<br>
+ Tcl_AppendResult<br>
+ Tcl_GetBoolean<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_GetDouble<br>
+ Tcl_GetInt<br>
+ Tcl_GetStringResult<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_ResetResult<br>
+ Tcl_SetResult<br>
+</tt></small></td>
+</table></center><p><b>Functions for controlling the Tcl interpreter</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_CreateCommand<br>
+ Tcl_CreateInterp<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_CreateObjCommand<br>
+ Tcl_DeleteCommand<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_DeleteInterp<br>
+ Tcl_Exit<br>
+</tt></small></td>
+</table></center></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Nickel Tour Of The Tcl API</h2>
+<p><p><b>I/O functions</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Close<br>
+ Tcl_Eof<br>
+ Tcl_Flush<br>
+ Tcl_GetChannel<br>
+ Tcl_GetChannelMode<br>
+ Tcl_GetChannelName<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Gets<br>
+ Tcl_OpenCommandChannel<br>
+ Tcl_OpenFileChannel<br>
+ Tcl_OpenTcpClient<br>
+ Tcl_OpenTcpServer<br>
+ Tcl_Read<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Seek<br>
+ Tcl_Tell<br>
+ Tcl_Ungets<br>
+ Tcl_Write<br>
+ Tcl_WriteChars<br>
+</tt></small></td>
+</table></center><p><b>Names and meanings of system error codes</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_ErrnoId<br>
+ Tcl_ErrnoMsg<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_GetErrno<br>
+ Tcl_SetErrno<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_SignalId<br>
+ Tcl_SignalMsg<br>
+</tt></small></td>
+</table></center></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Nickel Tour Of The Tcl API</h2>
+<p><p><b>General Operating System Calls</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Access<br>
+ Tcl_Chdir<br>
+ Tcl_GetCwd<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_GetHostName<br>
+ Tcl_GetNameOfExecutable<br>
+ Tcl_Sleep<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Stat<br>
+</tt></small></td>
+</table></center><p><b>String Manipulation And Comparison</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Concat<br>
+ Tcl_Merge<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_SplitList<br>
+ Tcl_StringCaseMatch<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_StringMatch<br>
+</tt></small></td>
+</table></center><p><b>Dynamically Resizable Strings</b></p>
+<center><table width="90%"><tr>
+<td width="49%" valign="top"><small><tt>
+ Tcl_DStringAppend<br>
+ Tcl_DStringAppendElement<br>
+ Tcl_DStringEndSublist<br>
+ Tcl_DStringInit<br>
+ Tcl_DStringLength<br>
+</tt></small></td>
+<td width="49%" valign="top"><small><tt>
+ Tcl_DStringResult<br>
+ Tcl_DStringSetLength<br>
+ Tcl_DStringStartSublist<br>
+ Tcl_DStringValue<br>
+</tt></small></td>
+</table></center></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Nickel Tour Of The Tcl API</h2>
+<p><p><b>Event Handlers</b></p>
+<center><table width="90%"><tr>
+<td width="49%" valign="top"><small><tt>
+ Tcl_CancelIdleCall<br>
+ Tcl_CreateChannelHandler<br>
+ Tcl_CreateTimerHandler<br>
+ Tcl_DeleteChannelHandler<br>
+</tt></small></td>
+<td width="49%" valign="top"><small><tt>
+ Tcl_DeleteTimerHandler<br>
+ Tcl_DoOneEvent<br>
+ Tcl_DoWhenIdle<br>
+</tt></small></td>
+</table></center><p><b>Functions For Reading And Writing Tcl Variables</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_GetVar<br>
+ Tcl_GetVar2<br>
+ Tcl_LinkVar<br>
+ Tcl_SetVar<br>
+ Tcl_SetVar2<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_TraceVar<br>
+ Tcl_TraceVar2<br>
+ Tcl_UnlinkVar<br>
+ Tcl_UnsetVar<br>
+ Tcl_UnsetVar2<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_UntraceVar<br>
+ Tcl_UntraceVar2<br>
+ Tcl_UpdateLinkedVar<br>
+</tt></small></td>
+</table></center><p><b>Functions For Executing Tcl Code</b></p>
+<center><table width="90%"><tr>
+<td width="32%" valign="top"><small><tt>
+ Tcl_Eval<br>
+ Tcl_EvalFile<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_EvalObj<br>
+ Tcl_GlobalEval<br>
+</tt></small></td>
+<td width="32%" valign="top"><small><tt>
+ Tcl_GlobalEvalObj<br>
+ Tcl_VarEval<br>
+</tt></small></td>
+</table></center></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Nickel Tour Of The Tcl API</h2>
+<p><p><b>Functions For Dealing With Unicode</b></p>
+<center><table width="90%"><tr>
+<td width="49%" valign="top"><small><tt>
+ Tcl_NumUtfChars<br>
+ Tcl_UniCharAtIndex<br>
+ Tcl_UniCharIsAlnum<br>
+ Tcl_UniCharIsAlpha<br>
+ Tcl_UniCharIsControl<br>
+ Tcl_UniCharIsDigit<br>
+ Tcl_UniCharIsGraph<br>
+ Tcl_UniCharIsLower<br>
+ Tcl_UniCharIsPrint<br>
+ Tcl_UniCharIsPunct<br>
+ Tcl_UniCharIsSpace<br>
+ Tcl_UniCharIsUpper<br>
+ Tcl_UniCharIsWordChar<br>
+ Tcl_UniCharLen<br>
+ Tcl_UniCharNcmp<br>
+ Tcl_UniCharToLower<br>
+ Tcl_UniCharToTitle<br>
+</tt></small></td>
+<td width="49%" valign="top"><small><tt>
+ Tcl_UniCharToUpper<br>
+ Tcl_UniCharToUtf<br>
+ Tcl_UniCharToUtfDString<br>
+ Tcl_UtfAtIndex<br>
+ Tcl_UtfBackslash<br>
+ Tcl_UtfCharComplete<br>
+ Tcl_UtfFindFirst<br>
+ Tcl_UtfFindLast<br>
+ Tcl_UtfNcasecmp<br>
+ Tcl_UtfNcmp<br>
+ Tcl_UtfNext<br>
+ Tcl_UtfPrev<br>
+ Tcl_UtfToLower<br>
+ Tcl_UtfToTitle<br>
+ Tcl_UtfToUniChar<br>
+ Tcl_UtfToUniCharDString<br>
+ Tcl_UtfToUpper<br>
+</tt></small></td>
+</table></center>
+ <p><b>Functions For Dealing With Tcl_Objs</b></p>
+ <blockquote><i>Too numerous to list...</i></blockquote></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Documentation Of The Tcl API</h2>
+<p><ul><li>Tcl comes with excellent man pages</li></ul><ul><li>"Use the source, Luke"</li></ul><ul><li>See <tt>tclDecl.h</tt> for a list of API functions</li></ul><ul><li>The header comments on the implementation of API functions usually
+ gives a good description of what the function does and how it should
+ be used.</li></ul><ul><li>Most API functions are used within Tcl and Tk. Use grep to locate
+ examples.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Initialization Scripts</h2>
+<p><ul><li>Run the mini TCLSH implemented above and execute the <tt>parray</tt> command</li></ul><ul><li>It doesn't work! What's wrong? </p></li></li></ul><ul><li><tt>parray</tt> is really a Tcl proc that is read in when the
+ interpreter is initialized. </p></li></li></ul><ul><li><tt>parray</tt> (and several other commands) are stored in a
+ handful of &quot;Initialization Scripts&quot; </p></li></li></ul><ul><li>All the initialization scripts are stored in the
+ &quot;Tcl Library&quot; - a directory on the host
+ computer. </p></li></li></ul><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>Invoke the Tcl_Init() function to locate and read the
+ Tcl initialization scripts.</b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>Tcl_Init()</tt> Function</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Tcl&nbsp;code&nbsp;omitted...&nbsp;*/<br>
+;<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Init(interp);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Locate and read the initialization scripts</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;Call&nbsp;Tcl_CreateCommand()?&nbsp;*/<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>But Tcl_Init() can fail. We need to check its return value...</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>Tcl_Init()</tt> Function</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+static&nbsp;char&nbsp;zInputLoop[]&nbsp;=&nbsp;<br>
+&nbsp;&nbsp;/*&nbsp;Tcl&nbsp;code&nbsp;omitted...&nbsp;*/<br>
+;<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;Tcl_Init(interp)!=TCL_OK&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,"Tcl_Init()&nbsp;failed:&nbsp;厚PX",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tcl_GetStringResult(interp));<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Print error message if Tcl_Init() fails</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;Call&nbsp;Tcl_CreateCommand()?&nbsp;*/<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>But now the program is not standalone.</b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">How <tt>Tcl_Init()</tt> Works</h2>
+<p><ul><li>Computes the value of variable <tt>tcl_libPath</tt>.</li></ul><ul><li>Invokes the procedure named &quot;<tt>tclInit</tt>&quot;</li></ul><ul><li>A default <tt>tclInit</tt> procedure is built into Tcl.
+ You can define an alternative <tt>tclInit</tt> procedure
+ prior to calling <tt>Tcl_Init()</tt>.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">The Default <tt>initTcl</tt> Procedure</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>set&nbsp;errors&nbsp;{}<br>
+set&nbsp;dirs&nbsp;{}<br>
+if&nbsp;{[info&nbsp;exists&nbsp;tcl_library]}&nbsp;{<br>
+&nbsp;&nbsp;lappend&nbsp;dirs&nbsp;$tcl_library<br>
+}&nbsp;else&nbsp;{<br>
+&nbsp;&nbsp;if&nbsp;{[info&nbsp;exists&nbsp;env(TCL_LIBRARY)]}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;lappend&nbsp;dirs&nbsp;$env(TCL_LIBRARY)<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;lappend&nbsp;dirs&nbsp;$tclDefaultLibrary<br>
+&nbsp;&nbsp;unset&nbsp;tclDefaultLibrary<br>
+&nbsp;&nbsp;set&nbsp;dirs&nbsp;[concat&nbsp;$dirs&nbsp;$tcl_libPath]<br>
+}<br>
+foreach&nbsp;i&nbsp;$dirs&nbsp;{<br>
+&nbsp;&nbsp;set&nbsp;tcl_library&nbsp;$i<br>
+&nbsp;&nbsp;set&nbsp;tclfile&nbsp;[file&nbsp;join&nbsp;$i&nbsp;init.tcl]<br>
+&nbsp;&nbsp;if&nbsp;{[file&nbsp;exists&nbsp;$tclfile]}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;{![catch&nbsp;{uplevel&nbsp;#0&nbsp;[list&nbsp;source&nbsp;$tclfile]}&nbsp;msg]}&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;append&nbsp;errors&nbsp;"$tclfile:&nbsp;$msg\n$errorInfo\n"<br>
+&nbsp;&nbsp;&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;}<br>
+}<br>
+error&nbsp;"Can't&nbsp;find&nbsp;a&nbsp;usable&nbsp;init.tcl&nbsp;..."</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The Default Initialization Sequence</h2>
+<p><ul><li>The <tt>tclInit</tt> procedure locates and sources the <tt>init.tcl</tt>
+ script. The directory that contains <tt>init.tcl</tt> is stored in
+ the <tt>tcl_library</tt> variable.</li></ul><ul><li>The <tt>init.tcl</tt> script creates an <tt>unknown</tt> procedure.
+ The <tt>unknown</tt> procedure will run whenever Tcl encounters an
+ unknown command.</li></ul><ul><li>The <tt>unknown</tt> procedure consults the file <tt>tclIndex</tt> in the
+ <tt>tcl_library</tt> directory to see if the command is defined by one of
+ the initialization scripts.</li></ul><ul><li>The <tt>unknown</tt> procedure sources any needed initialization scripts
+ and retries the command.</li></ul><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>Commands defined in the initialization scripts are loaded
+ on demand.</b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Standalone Initialization Techniques</h2>
+<p><p><b>Manually execute all initialization scripts</b></p>
+<ul><li>Convert all initialization scripts into C strings and
+ put them in the executable.</li></ul><ul><li>Call <tt>Tcl_Eval()</tt> on each initialization script and omit the
+ call to <tt>Tcl_Init()</tt></li></ul><ul><li>Or, redefine <tt>tclInit</tt> so that it does not attempt to source
+ <tt>init.tcl</tt> then call <tt>Tcl_Eval()</tt> on each initialization
+ script after <tt>Tcl_Init()</tt> returns.</li></ul><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>This approach is not recommended</b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Standalone Initialization Techniques</h2>
+<p><p><b>Redefining the builtin <tt>source</tt> command</b></p>
+<ul><li>Convert all initialization scripts into C strings and
+ put them in the executable.</li></ul><ul><li>Create a new <tt>source</tt> command that
+ calls <tt>Tcl_Eval()</tt> on the appropriate built-in string
+ instead of reading from the disk.</li></ul><ul><li>Read from disk if the named file is not one that is built in.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Redefining <tt>source</tt></h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>static&nbsp;char&nbsp;zInitTcl[]&nbsp;=&nbsp;"...";<br>
+static&nbsp;char&nbsp;zParrayTcl[]&nbsp;=&nbsp;"...";</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Scripts <tt>init.tcl</tt> and <tt>parray.tcl</tt></td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+int&nbsp;NewSourceCmd(TCLARGS){</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;!strcmp(argv[1],"/builtin/init.tcl")&nbsp;)<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;Tcl_Eval(interp,&nbsp;zInitTcl);<br>
+&nbsp;&nbsp;if(&nbsp;!strcmp(argv[1],"/builtin/parray.tcl")&nbsp;)<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;Tcl_Eval(interp,&nbsp;zParrayTcl);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Call <tt>Tcl_Eval()</tt> on builtin strings if the names match</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;Tcl_EvalFile(interp,&nbsp;argv[1]);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Call <tt>Tcl_EvalFile()</tt> if no match</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;setenv("TCL_LIBRARY","/builtin");</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Causes <tt>tclInit</tt> to look for <tt>init.tcl</tt> in <tt>/builtin</tt></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_CreateCommand(interp,&nbsp;"source",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NewSourceCmd,&nbsp;0,&nbsp;0);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Redefine <tt>source</tt></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Init(interp);<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Redefining <tt>source</tt></h2>
+<p><ul><li>This approach works for all versions of Tcl and Tk.</li></ul><ul><li>Also need to redefine the "<tt>file exists</tt>" Tcl command since it
+ too is used by <tt>tclInit</tt>.</li></ul><ul><li>To verify that the program is really standalone, remove the call
+ to <tt>Tcl_EvalFile()</tt>.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Standalone Initialization Techniques</h2>
+<p><p><b>Use the <tt>Tcl</tt>*<tt>InsertProc()</tt> functions</b></p>
+<ul><li>Three routines that overload basic file I/O operations:
+ <ul>
+ <li> <tt>TclStatInsertProc()</tt> </li>
+ <li> <tt>TclAccessInsertProc()</tt> </li>
+ <li> <tt>TclOpenFileChannelInsertProc()</tt> </li>
+ </ul></li></ul><ul><li>Allows us to implement a virtual filesystem that overlays the
+ real filesystem.</li></ul><ul><li>The virtual filesystem contains all the initialization scripts
+ as compiled-in strings. The initialization scripts look like
+ they are resident on disk even though they are built in.</li></ul><ul><li>These functions first appeared in Tcl8.0.3.
+ Presumably to support TclPro Wrapper.</li></ul><ul><li>The only documentation is comments on the code.
+ See the Tcl source file <tt>generic/tclIOUtil.c</tt></li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>TclStatInsertProc()</tt> Function</h2>
+<p><ul><li>Sole argument is a pointer to a function whose interface is the
+ same as <tt>stat()</tt></li></ul><ul><li>Functions are stacked. Tcl tries each <tt>stat</tt> function on the
+ list, beginning with the most recently inserted, until one succeeds.</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>TclStatInsertProc()</tt> Function</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tclInt.h></tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Rather than <tt>&lt;tcl.h&gt;</tt>!</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+static&nbsp;int<br>
+BltinFileStat(char&nbsp;*path,struct&nbsp;stat&nbsp;*buf){<br>
+&nbsp;&nbsp;char&nbsp;*zData;<br>
+&nbsp;&nbsp;int&nbsp;nData;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;zData&nbsp;=&nbsp;FindBuiltinFile(path,&nbsp;0,&nbsp;&amp;nData);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Check if <tt>path</tt> is a builtin</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;zData==0&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;-1;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Fail if <tt>path</tt> is not a builtin</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;memset(buf,&nbsp;0,&nbsp;sizeof(*buf));<br>
+&nbsp;&nbsp;buf->st_mode&nbsp;=&nbsp;0400;<br>
+&nbsp;&nbsp;buf->st_size&nbsp;=&nbsp;nData;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Success if it is builtin</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;TclStatInsertProc(BltinFileStat);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Register new <tt>stat</tt> function</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();<br>
+&nbsp;&nbsp;Tcl_Init(interp);<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>TclAccessInsertProc()</tt> Function</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tclInt.h></tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Rather than <tt>&lt;tcl.h&gt;</tt>!</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+/*&nbsp;BltinFileStat()&nbsp;not&nbsp;shown...&nbsp;*/<br>
+&nbsp;<br>
+static&nbsp;int<br>
+BltinFileAccess(char&nbsp;*path,&nbsp;int&nbsp;mode){<br>
+&nbsp;&nbsp;char&nbsp;*zData;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;mode&nbsp;&amp;&nbsp;3&nbsp;)&nbsp;return&nbsp;-1;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">All builtins are read-only</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;zData&nbsp;=&nbsp;FindBuiltinFile(path,&nbsp;0,&nbsp;&amp;nData);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Check if <tt>path</tt> is a builtin</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;zData==0&nbsp;)&nbsp;return&nbsp;-1;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Fail if <tt>path</tt> is not a builtin</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;0;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Success if it is builtin</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;TclStatInsertProc(BltinFileStat);<br>
+&nbsp;&nbsp;TclAccessInsertProc(BltinFileAccess);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Register new <tt>stat</tt> and <tt>access</tt> functions</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();<br>
+&nbsp;&nbsp;Tcl_Init(interp);<br>
+&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zInputLoop);<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>TclOpenFileChannelInsertProc()</tt> Function</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>static&nbsp;Tcl_Channel&nbsp;BuiltinFileOpen(<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp,&nbsp;&nbsp;&nbsp;/*&nbsp;The&nbsp;TCL&nbsp;interpreter&nbsp;doing&nbsp;the&nbsp;open&nbsp;*/<br>
+&nbsp;&nbsp;char&nbsp;*zFilename,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Name&nbsp;of&nbsp;the&nbsp;file&nbsp;to&nbsp;open&nbsp;*/<br>
+&nbsp;&nbsp;char&nbsp;*modeString,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Mode&nbsp;string&nbsp;for&nbsp;the&nbsp;open&nbsp;(ignored)&nbsp;*/<br>
+&nbsp;&nbsp;int&nbsp;permissions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Permissions&nbsp;for&nbsp;a&nbsp;newly&nbsp;created&nbsp;file&nbsp;(ignored)&nbsp;*/<br>
+){<br>
+&nbsp;&nbsp;char&nbsp;*zData;<br>
+&nbsp;&nbsp;BuiltinFileStruct&nbsp;*p;<br>
+&nbsp;&nbsp;int&nbsp;nData;<br>
+&nbsp;&nbsp;char&nbsp;zName[50];<br>
+&nbsp;&nbsp;Tcl_Channel&nbsp;chan;<br>
+&nbsp;&nbsp;static&nbsp;int&nbsp;count&nbsp;=&nbsp;1;<br>
+&nbsp;<br>
+&nbsp;&nbsp;zData&nbsp;=&nbsp;FindBuiltinFile(zFilename,&nbsp;1,&nbsp;&amp;nData);<br>
+&nbsp;&nbsp;if(&nbsp;zData==0&nbsp;)&nbsp;return&nbsp;NULL;<br>
+&nbsp;&nbsp;p&nbsp;=&nbsp;(BuiltinFileStruct*)Tcl_Alloc(&nbsp;sizeof(BuiltinFileStruct)&nbsp;);<br>
+&nbsp;&nbsp;if(&nbsp;p==0&nbsp;)&nbsp;return&nbsp;NULL;<br>
+&nbsp;&nbsp;p->zData&nbsp;=&nbsp;zData;<br>
+&nbsp;&nbsp;p->nData&nbsp;=&nbsp;nData;<br>
+&nbsp;&nbsp;p->cursor&nbsp;=&nbsp;0;<br>
+&nbsp;&nbsp;sprintf(zName,"etbi_bffffc7c_8049b04",((int)BuiltinFileOpen)>>12,count++);<br>
+&nbsp;&nbsp;chan&nbsp;=&nbsp;Tcl_CreateChannel(&amp;builtinChannelType,&nbsp;zName,&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ClientData)p,&nbsp;TCL_READABLE);<br>
+&nbsp;&nbsp;return&nbsp;chan;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">The <tt>TclOpenFileChannelInsertProc()</tt> Function</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>static&nbsp;Tcl_ChannelType&nbsp;builtinChannelType&nbsp;=&nbsp;{<br>
+&nbsp;&nbsp;"builtin",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Type&nbsp;name.&nbsp;*/<br>
+&nbsp;&nbsp;NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Always&nbsp;non-blocking.*/<br>
+&nbsp;&nbsp;BuiltinFileClose,&nbsp;&nbsp;&nbsp;/*&nbsp;Close&nbsp;proc.&nbsp;*/<br>
+&nbsp;&nbsp;BuiltinFileInput,&nbsp;&nbsp;&nbsp;/*&nbsp;Input&nbsp;proc.&nbsp;*/<br>
+&nbsp;&nbsp;BuiltinFileOutput,&nbsp;&nbsp;/*&nbsp;Output&nbsp;proc.&nbsp;*/<br>
+&nbsp;&nbsp;BuiltinFileSeek,&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Seek&nbsp;proc.&nbsp;*/<br>
+&nbsp;&nbsp;NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Set&nbsp;option&nbsp;proc.&nbsp;*/<br>
+&nbsp;&nbsp;NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Get&nbsp;option&nbsp;proc.&nbsp;*/<br>
+&nbsp;&nbsp;BuiltinFileWatch,&nbsp;&nbsp;&nbsp;/*&nbsp;Watch&nbsp;for&nbsp;events&nbsp;on&nbsp;console.&nbsp;*/<br>
+&nbsp;&nbsp;BuiltinFileHandle,&nbsp;&nbsp;/*&nbsp;Get&nbsp;a&nbsp;handle&nbsp;from&nbsp;the&nbsp;device.&nbsp;*/<br>
+};</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p>
+ <p>For additional information see:</p>
+ <ul>
+ <li>The man page for <tt>Tcl_CreateChannel()</tt></li>
+ <li>Tk source code file <tt>generic/tkConsole.c</tt></li>
+ </ul>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Initializing Tk</h2>
+<p><ul><li>All the same initialization script issues as Tcl</li></ul><ul><li>Tk initialization scripts are in a different directory
+ than the Tcl initialization scripts - the "Tk Library"</li></ul><ul><li>Call <tt>Tk_Init()</tt> after <tt>Tcl_Init()</tt></li></ul><ul><li>Must have an event loop or Tk will not work!</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Implementing An Event Loop</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>button&nbsp;.b&nbsp;-text&nbsp;Hello&nbsp;-command&nbsp;exit<br>
+pack&nbsp;.b</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Create a Tk interface</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>bind&nbsp;.&nbsp;&lt;Destroy>&nbsp;{<br>
+&nbsp;&nbsp;if&nbsp;{![winfo&nbsp;exists&nbsp;.]}&nbsp;exit<br>
+}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Close the application when the main window
+ is destroyed</td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>while&nbsp;1&nbsp;{vwait&nbsp;forever}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">The event loop</td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">"Hello, World!" Using Tk</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tk.h><br>
+&nbsp;<br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>static&nbsp;char&nbsp;zHello[]&nbsp;=&nbsp;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">The application code</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;"button&nbsp;.b&nbsp;"<br>
+&nbsp;&nbsp;&nbsp;&nbsp;"-text&nbsp;{Hello,&nbsp;World}&nbsp;"<br>
+&nbsp;&nbsp;&nbsp;&nbsp;"-command&nbsp;exit\n"<br>
+&nbsp;&nbsp;"pack&nbsp;.b\n";<br>
+&nbsp;<br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>static&nbsp;char&nbsp;zEventLoop[]&nbsp;=</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">The event loop</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;"bind&nbsp;.&nbsp;&lt;Destroy>&nbsp;{\n"<br>
+&nbsp;&nbsp;"&nbsp;&nbsp;if&nbsp;{![winfo&nbsp;exists&nbsp;.]}&nbsp;exit\n"<br>
+&nbsp;&nbsp;"}\n"<br>
+&nbsp;&nbsp;"while&nbsp;1&nbsp;{vwait&nbsp;forever}\n";<br>
+&nbsp;<br>
+<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;Tcl_Interp&nbsp;*interp;<br>
+&nbsp;&nbsp;interp&nbsp;=&nbsp;Tcl_CreateInterp();</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Init(interp);<br>
+&nbsp;&nbsp;Tk_Init(interp);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">We really should check the return values of the init functions...</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zHello);</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_Eval(interp,&nbsp;zEventLoop);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">The event loop never returns</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*NOTREACHED*/<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Compiling "Hello, World!" For Tk</h2>
+<p><p><b>Unix:</b></p>
+ <blockquote><pre>
+ $ gcc hello.c -ltk -L/usr/X11R6/lib \
+ -lX11 -ltcl -lm -ldl
+ $ ./a.out</pre></blockquote>
+
+ <p><b>Windows using Cygwin:</b></p>
+ <blockquote><pre>
+ C:> gcc hello.c -mwindows -ltk80 -ltcl80 -lm
+ C:> a.exe</pre></blockquote>
+
+ <p><b>Windows using Mingw32:</b></p>
+ <blockquote><pre>
+ C:> gcc -mno-cygwin hello.c -mwindows \
+ -ltk82 -ltcl82 -lm
+ C:> a.exe</pre></blockquote></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Making The Program Standalone</h2>
+<p><p>To make a Tcl application standalone you have to convert the following
+ initialization scripts to C strings and compile them into the
+ executable:</p>
+ <table><tr>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;auto.tcl<br>
+ &nbsp;&nbsp;history.tcl<br>
+ &nbsp;&nbsp;init.tcl
+ </tt></td>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;ldAout.tcl<br>
+ &nbsp;&nbsp;package.tcl
+ </tt></td>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;parray.tcl<br>
+ &nbsp;&nbsp;safe.tcl
+ </tt></td>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;tclIndex<br>
+ &nbsp;&nbsp;word.tcl
+ </tt></td>
+ </tr></table>
+
+ <p>To make a Tk application standalone requires these additional
+ initialization scripts from the Tk Library:</p>
+ <table><tr>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;bgerror.tcl<br>
+ &nbsp;&nbsp;button.tcl<br>
+ &nbsp;&nbsp;clrpick.tcl<br>
+ &nbsp;&nbsp;comdlg.tcl<br>
+ &nbsp;&nbsp;console.tcl<br>
+ &nbsp;&nbsp;dialog.tcl
+ </tt></td>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;entry.tcl<br>
+ &nbsp;&nbsp;focus.tcl<br>
+ &nbsp;&nbsp;listbox.tcl<br>
+ &nbsp;&nbsp;menu.tcl<br>
+ &nbsp;&nbsp;msgbox.tcl<br>
+ &nbsp;&nbsp;optMenu.tcl
+ </tt></td>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;palette.tcl<br>
+ &nbsp;&nbsp;safetk.tcl<br>
+ &nbsp;&nbsp;scale.tcl<br>
+ &nbsp;&nbsp;scrlbar.tcl<br>
+ &nbsp;&nbsp;tclIndex<br>
+ &nbsp;&nbsp;tearoff.tcl
+ </tt></td>
+ <td valign="top"><tt>
+ &nbsp;&nbsp;text.tcl<br>
+ &nbsp;&nbsp;tk.tcl<br>
+ &nbsp;&nbsp;tkfbox.tcl<br>
+ &nbsp;&nbsp;xmfbox.tcl
+ </tt></td>
+ </tr></table>
+
+ <p>Total of about 13K lines and 400K bytes of text or 9K lines and
+ 250K bytes if you strip comments and leading spaces</p></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">A Review Of The Features We Want</h2>
+<p><ol type="A">
+ <li value="1">
+ Combine C/C++ with Tcl/Tk into a single executable.</dd>
+ </li></ol>
+
+ <ol type="A">
+ <li value="2">
+ The executable should be standalone. It must not depend
+ on files not normally found on the system.
+ </li></ol>
+
+ <ol type="A">
+ <li value="3">
+ It should be difficult for end users to alter the program
+ (and introduce bugs).
+ </li></ol></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Available Programming Aids</h2>
+<p><p>Several tools are available. The chart below shows which tools
+ help achieve which objectives.</p>
+
+ <center><table border="2">
+ <tr>
+ <td></td>
+ <td colspan="3" align="center">
+ <b>Features The Tool Helps To Achieve</b></td>
+ </tr>
+ <tr>
+ <td align="center"><b>Tool Name</b></td>
+ <td align="center">Mix C and Tcl</td>
+ <td align="center">Standalone</td>
+ <td align="center">Hide Source</td>
+ </tr>
+ <tr>
+ <td>SWIG</td>
+ <td align="center"><img src="image6"></td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>TclPro Wrapper</td>
+ <td>&nbsp;</td>
+ <td align="center"><img src="image6"></td>
+ <td align="center"><img src="image6"></td>
+ </tr>
+ <tr>
+ <td>FreeWrap</td>
+ <td>&nbsp;</td>
+ <td align="center"><img src="image6"></td>
+ <td align="center"><img src="image6"></td>
+ </tr>
+ <tr>
+ <td>Wrap</td>
+ <td>&nbsp;</td>
+ <td align="center"><img src="image6"></td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>mktclapp</td>
+ <td align="center"><img src="image6"></td>
+ <td align="center"><img src="image6"></td>
+ <td align="center"><img src="image6"></td>
+ </tr>
+ </table></center></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">SWIG</h2>
+<table><tr><td valign="top"><img src="image7"></td>
+<td valign="top"><p><ul><li>Creates an interface between an existing C/C++ library and a high-level
+ programming language. Support for:
+ <ul>
+ <li> Tcl/Tk </li>
+ <li> Perl </li>
+ <li> Python </li>
+ <li> Java </li>
+ <li> Eiffel </li>
+ <li> Guile </li>
+ </ul></li></ul><ul><li>No changes required to C/C++ code. Can be used with legacy libraries.</li></ul><ul><li>Generates an extension, not a standalone binary</li></ul><ul><li>The tutorial on SWIG was yesterday afternoon.</li></ul><ul><li>http://www.swig.org/</li></ul></p></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Wrapper Programs</h2>
+<table><tr><td valign="top"><img src="image8"></td>
+<td valign="top"><p><ul><li>Convert a pure Tcl/Tk program into a standalone binary</li></ul><ul><li>Several wrapper programs are available:
+ <ul>
+ <li> TclPro Wrapper - http://www.scriptics.com/ </li>
+ <li> FreeWrap - http://www.albany.net/~dlabelle/freewrap/freewrap.html </li>
+ <li> Wrap - http://members1.chello.nl/~j.nijtmans/wrap.html </li>
+ </ul></li></ul><ul><li>No C compiler required!</li></ul><ul><li>TclPro will convert Tcl script into bytecode so that it cannot be
+ easily read by the end user. FreeWrap encrypts the scripts.</li></ul><ul><li>FreeWrap uses compression on its executable.
+ Wrap uses compression on both the executable and on the bundled script files.</li></ul><ul><li>Usually include extensions like winico and/or BLT</li></ul></p></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">mktclapp</h2>
+<table><tr><td valign="top"><img src="image9"></td>
+<td valign="top"><p><ul><li>Mix C/C++ with Tcl/Tk into a standalone binary</li></ul>
+<ul><li><tt>mktclapp</tt> generates an application initialization file
+ that contains Tcl scripts as strings and makes all necessary calls
+ to <tt>Tcl_Init</tt>, <tt>Tcl_CreateCommand</tt>,
+ <tt>Tcl</tt>*<tt>InsertProc</tt>, etc.</li></ul><ul><li>Features to make it easier to write new Tcl command in C</li></ul><ul><li><tt>xmktclapp.tcl</tt> provides a GUI interface to <tt>mktclapp</tt></li></ul><ul><li>http://www.hwaci.com/sw/mktclapp/</li></ul></p></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">"Hello, World!" Using Mktclapp</h2>
+<p><ul><li>Download <tt>mktclapp.c</tt> and <tt>xmktclapp.tcl</tt> from
+ http://www.hwaci.com/sw/mktclapp/</li></ul><ul><li>Compile <tt>mktclapp</tt>:
+ <blockquote><pre>
+ cc -o mktclapp mktclapp.c
+ </pre></blockquote></li></ul><ul><li>Create "Hello, World!" as a Tcl script in file <tt>hw.tcl</tt>:
+ <blockquote><pre>
+ button .b -text {Hello, World!} -command exit
+ pack .b
+ </pre></blockquote></li></ul><ul><li>Launch xmktclapp:
+ <blockquote><pre>
+ wish xmktclapp.tcl
+ </pre></blockquote></li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">"Hello, World!" Using Mktclapp</h2>
+<table width="100%"><tr><td valign="top"><p><ul><li>Set "Command Line Input?" to "None"</li></ul><ul><li>Set "Standalone?" to "Yes"</li></ul><ul><li>Enter "<tt>hw.mta</tt>" for the Configuration File</li></ul><ul><li>Enter "<tt>hw.c</tt>" for the Output C File</li></ul></p></td>
+<td valign="top" align="right"><img src="image10"></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">"Hello, World!" Using Mktclapp</h2>
+<table width="100%"><tr><td valign="top"><p><ul><li>Go to the "Tcl Scripts" page</li></ul><ul><li>Press "Insert" and add <tt>hw.tcl</tt> to the list of
+ Tcl scripts</li></ul><ul><li>Change the "Startup Script" to be <tt>hw.tcl</tt>.</li></ul><ul><li>Select File/Build and File/Exit</li></ul></p></td>
+<td valign="top" align="right"><img src="image11"></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">"Hello, World!" Using Mktclapp</h2>
+<p><ul><li>Mktclapp generates <tt>hw.c</tt>.
+ Compile it something like this:
+ <pre>
+ cc hw.c -ltk -L/usr/X11R6/lib -lX11 -ltcl -lm -ldl
+ </pre></li></ul><ul><li>Or, if using Cygwin:
+ <pre>
+ gcc hw.c -mwindows -ltk80 -ltcl80 -lm
+ </pre></li></ul><ul><li>Or, if using Mingw32:
+ <pre>
+ gcc -mno-cygwin hw.c -mwindows -ltk82 -ltcl82 -lm
+ </pre></li></ul><ul><li>And you're done!</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Adding C Code To Your Program</h2>
+<p>Put the new C code in a new source file named "<tt>add.c</tt>"</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;"hw.h"</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Generated by mktclapp</td>
+</tr>
+<tr><td valign="center">
+<small><tt></tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>int&nbsp;ET_COMMAND_add(ET_TCLARGS){</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><tt>ET_TCLARGS</tt> is a macro defined in <tt>hw.h</tt></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;int&nbsp;a,&nbsp;b;<br>
+&nbsp;&nbsp;char&nbsp;zResult[30];<br>
+&nbsp;&nbsp;a&nbsp;=&nbsp;atoi(argv[1]);<br>
+&nbsp;&nbsp;b&nbsp;=&nbsp;atoi(argv[2]);<br>
+&nbsp;&nbsp;sprintf(zResult,&nbsp;"-1073742724",&nbsp;a+b);<br>
+&nbsp;&nbsp;Tcl_SetResult(interp,&nbsp;zResult,&nbsp;TCL_VOLATILE);<br>
+&nbsp;&nbsp;return&nbsp;TCL_OK;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Adding C Code To Your Program</h2>
+<table width="100%"><tr><td valign="top"><p><ul><li>Go to the "C/C++ Modules" page of xmktclapp.tcl</li></ul>
+<ul><li>Press "Insert" and add <tt>add.c</tt> to the list of
+ C/C++ modules</p></li></ul></li></ul><ul><li>Select File/Build and File/Exit</li></ul></p></td>
+<td valign="top" align="right"><img src="image12"></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Adding C Code To Your Program</h2>
+<p><ul><li>Compile as follows:
+ <pre>
+ cc add.c hw.c -ltk -L/usr/X11R6/lib -ltcl -lm -ldl
+ </pre></li></ul><ul><li>Or construct a Makefile that compiles <tt>add.c</tt> into <tt>add.o</tt>
+ and <tt>hw.c</tt> into <tt>hw.o</tt> and then links them.</li></ul><ul><li>Compile the same way for Windows except use the usual Windows
+ libraries and options...</li></ul><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>Don't have to worry with <tt>Tcl_CreateCommand()</tt> - Mktclapp takes
+ care of that automatically.</b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Checking Parameters In The <tt>add</tt> Command</h2>
+<p>Modify <tt>add.c</tt> to insure the <tt>add</tt> command
+ is called with exactly two integer arguments</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;"hw.h"<br>
+&nbsp;<br>
+int&nbsp;ET_COMMAND_add(ET_TCLARGS){<br>
+&nbsp;&nbsp;int&nbsp;a,&nbsp;b;<br>
+&nbsp;&nbsp;char&nbsp;zResult[30];</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;argc!=3&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;Tcl_AppendResult(interp,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"wrong&nbsp;#&nbsp;args:&nbsp;should&nbsp;be:&nbsp;\"",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;argv[0],&nbsp;"&nbsp;VALUE&nbsp;VALUE\"",&nbsp;0);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Report an error if there are not exactly
+ 2 arguments</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;Tcl_GetInt(interp,&nbsp;argv[1],&nbsp;&amp;a)!=TCL_OK&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Report an error if the first argument is
+ not an integer</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;Tcl_GetInt(interp,&nbsp;argv[2],&nbsp;&amp;b)!=TCL_OK&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Do the same for the second argument</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;sprintf(zResult,&nbsp;"-1073742724",&nbsp;a+b);<br>
+&nbsp;&nbsp;Tcl_SetResult(interp,&nbsp;zResult,&nbsp;TCL_VOLATILE);<br>
+&nbsp;&nbsp;return&nbsp;TCL_OK;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Using The Tcl_Obj Interface</h2>
+<p>In the file <tt>objadd.c</tt> put this code:</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;"hw.h"</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+int&nbsp;ET_OBJCOMMAND_add2(ET_OBJARGS){<br>
+&nbsp;&nbsp;int&nbsp;a,&nbsp;b;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Use "<tt>ET_OBJCOMMAND</tt>" instead of "<tt>ET_COMMAND</tt>" and
+ "<tt>ET_OBJARGS</tt>" instead of "<tt>ET_TCLARGS</tt>"</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;objc!=3&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;Tcl_WrongNumArgs(interp,&nbsp;1,&nbsp;objv,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"number&nbsp;number");<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">A special routine for "wrong # args" error</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;Tcl_GetIntFromObj(interp,&nbsp;objv[1],&nbsp;&amp;a)&nbsp;){</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Instead of <tt>Tcl_GetInt</tt></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;if(&nbsp;Tcl_GetIntFromObj(interp,&nbsp;objv[2],&nbsp;&amp;b)&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_SetIntObj(Tcl_GetObjResult(interp),&nbsp;a+b);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Result stored as integer, not a string</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;TCL_OK;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Speed Of Tcl_Obj Versus "char*" Interfaces</h2>
+<p><ul><li>Compile both <tt>add</tt> and <tt>add2</tt> into the same executable.</li></ul><ul><li>Compare their speeds:
+ <pre>
+ time {add 123456 654321} 10000
+ <font color="blue">26 microseconds per iteration</font>
+ time {add2 123456 654321} 10000
+ <font color="blue">4 microseconds per iteration</font>
+ </pre></li></ul><ul><li>The Tcl_Obj version is 650 faster!</li></ul><ul><li>Replace the addition with a "real" computation that takes
+ 10 milliseconds.</li></ul><ul><li>Now the Tcl_Obj version is only 0.2 faster!</li></ul><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>In many real-world problems, the Tcl_Obj interface has no noticeable
+ speed advantage over the string interface.</b></td></tr></table></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">More About Built-in Tcl Scripts</h2>
+<table><tr><td valign="top"><img src="image11"></td>
+<td valign="top"><p><ul><li>Comments and leading white-space are removed from the
+ script by default. Use the "Don't Strip Comments"
+ button to change this.</li></ul><ul><li>The file name must exactly match the name that is
+ used by the <tt>source</tt> command.</li></ul></p></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Locations Of Libraries</h2>
+<table><tr><td valign="top"><img src="image13"></td>
+<td valign="top"><p><ul><li>Tells mktclapp where to look for script libraries.</li></ul><ul><li>All Tcl scripts in the indicated directories are
+ compiled into the <tt>appinit.c</tt> file.</li></ul><ul><li>Comments and extra white-space are removed.
+ There is no way to turn this off.</li></ul></p></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Built-in Binary Data Files</h2>
+<table><tr><td valign="top"><img src="image14"></td>
+<td valign="top"><p><ul><li>Arbitrary files become part of the virtual filesystem</li></ul><ul><li>No comment or white-space removal is attempted</li></ul><ul><li>Useful for images or other binary data</li></ul></p></td></tr></table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">New Commands In Namespaces</h2>
+<p>Two underscores (__) are replaced by two colons (::) in
+ command names, thus giving the ability to define new commands
+ in a namespace</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;hw.h></tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt><br>
+int&nbsp;ET_COMMAND_adder__add(ET_TCLARGS){<br>
+&nbsp;&nbsp;int&nbsp;a,&nbsp;b;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Creates the Tcl command called "<tt>adder::add</tt>"</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;char&nbsp;*zResult[30];<br>
+&nbsp;&nbsp;if(&nbsp;argc!=3&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;Tcl_AppendResult(interp,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"wrong&nbsp;#&nbsp;args:&nbsp;should&nbsp;be:&nbsp;\"",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;argv[0],&nbsp;"&nbsp;VALUE&nbsp;VALUE\"",&nbsp;0);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;if(&nbsp;Tcl_GetInt(interp,&nbsp;argv[1],&nbsp;&amp;a)!=TCL_OK&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;if(&nbsp;Tcl_GetInt(interp,&nbsp;argv[1],&nbsp;&amp;b)!=TCL_OK&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}<br>
+&nbsp;&nbsp;sprintf(zResult,&nbsp;"-1073742724",&nbsp;a+b);<br>
+&nbsp;&nbsp;Tcl_SetResult(interp,&nbsp;zResult,&nbsp;TCL_VOLATILE);<br>
+&nbsp;&nbsp;return&nbsp;TCL_OK;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Adding Your Own <tt>main()</tt></h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;/*&nbsp;Application&nbsp;specific&nbsp;initialization&nbsp;*/</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Et_Init(argc,&nbsp;argv);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Never returns!</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*NOTREACHED*/<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><table><tr><td valign="top"><img src="image3"></td>
+<td valign="top"><b>The "Autofork" feature is disabled if you supply your own <tt>main()</tt></b></td></tr></table>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Initializing The Tcl Interpreter</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+int&nbsp;counter&nbsp;=&nbsp;0;<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){<br>
+&nbsp;&nbsp;&nbsp;Et_Init(argc,&nbsp;argv);<br>
+&nbsp;&nbsp;&nbsp;/*NOTREACHED*/<br>
+&nbsp;&nbsp;&nbsp;return&nbsp;0;<br>
+}<br>
+&nbsp;<br>
+int&nbsp;Et_AppInit(Tcl_Interp&nbsp;*interp){</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;if(&nbsp;Blt_Init(Interp)&nbsp;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;TCL_ERROR;<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Example: Initialize an extension</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Tcl_LinkVar(interp,&nbsp;"counter",&nbsp;&amp;counter,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TCL_LINK_INT);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Or link a C variable to a Tcl variable</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return&nbsp;TCL_OK;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Return TCL_OK if successful</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Writing Your Own Event Loop</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>void&nbsp;Et_CustomMainLoop(Tcl_Interp&nbsp;*interp){</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Replaces the default event loop</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;return;</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Ex: Return without handling any events.</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Et_Init(argc,&nbsp;argv);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">This now returns after initializing Tcl</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*&nbsp;Application&nbsp;code&nbsp;here&nbsp;*/<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Writing Your Own Event Loop</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;&lt;tcl.h><br>
+&nbsp;<br>
+void&nbsp;Et_CustomMainLoop(Tcl_Interp&nbsp;*interp){</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;for(;;){<br>
+&nbsp;&nbsp;&nbsp;&nbsp;Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Other&nbsp;processing...&nbsp;*/<br>
+&nbsp;&nbsp;}</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Intermix processing and event handling</td>
+</tr>
+<tr><td valign="center">
+<small><tt>}<br>
+&nbsp;<br>
+int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;**argv){</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;Et_Init(argc,&nbsp;argv);</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Never returns</td>
+</tr>
+<tr><td valign="center">
+<small><tt>&nbsp;&nbsp;/*NOTREACHED*/<br>
+&nbsp;&nbsp;return&nbsp;0;<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Mktclapp Initialization Sequence</h2>
+<p><ul><li>Initialization starts when the <tt>Et_Init()</tt>
+ function is called either by client code or by
+ the <tt>main()</tt> that mktclapp generates</li></ul><ul><li>Create the main Tcl interpreter</li></ul><ul><li>Construct the virtual filesystem overlay by redefining
+ the <tt>source</tt> command and by using the
+ <tt>Tcl</tt>*<tt>InsertProc()</tt> functions</li></ul><ul><li>Call <tt>Et_PreInit()</tt> if the client defines it</li></ul><ul><li>Call <tt>Tcl_Init()</tt> and <tt>Tk_Init()</tt></li></ul><ul><li>Call <tt>Tcl_CreateCommand()</tt> and <tt>Tcl_CreateObjCommand()</tt>
+ for every <tt>ET_COMMAND_</tt>* and <tt>ET_OBJCOMMAND_</tt>* function
+ in the client code</li></ul><ul><li>Call <tt>Et_AppInit()</tt> if the client defines it</li></ul><ul><li>Run the main Tcl script if there is one</li></ul><ul><li>Call <tt>Et_CustomMainLoop()</tt> if defined by client code or
+ else run the built-in event loop</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Invoking Tcl From C</h2>
+<p><ul><li>Use one of the built-in evaluation functions:
+ <center><table width="80%">
+ <tr><td valign="top" width="50%"><ul>
+ <li> Tcl_Eval() </li>
+ <li> Tcl_VarEval() </li>
+ <li> Tcl_EvalFile() </li>
+ <li> Tcl_GlobalEval() </li>
+ </ul></td>
+ <td valign="top" width="50%"><ul>
+ <li> Tcl_EvalObj() </li>
+ <li> Tcl_GlobalEvalObj() </li>
+ </ul></td></tr>
+ </table></center></li></ul><ul><li>Mktclapp provides evaluation functions with variable argument
+ lists as in <tt>printf()</tt>:
+ <ul>
+ <li> Et_EvalF() </li>
+ <li> Et_GlobalEvalF() </li>
+ </ul></li></ul><ul><li>Mktclapp provides a global variable <tt>Et_Interp</tt> which is
+ a pointer to the main interpreter</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Invoking Tcl From C</h2>
+<p>Example: A C function that pops up an error message dialog box</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;"appinit.h"<br>
+&nbsp;<br>
+void&nbsp;ErrMsg(char&nbsp;*zMsg){<br>
+&nbsp;&nbsp;Tcl_SetVar(Et_Interp,&nbsp;"zMsg",&nbsp;zMsg,&nbsp;TCL_GLOBAL_ONLY);<br>
+&nbsp;&nbsp;Tcl_GlobalEval(Et_Interp,&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;"tk_messageBox&nbsp;-icon&nbsp;error&nbsp;-msg&nbsp;$zMsg&nbsp;-type&nbsp;ok");<br>
+&nbsp;&nbsp;Tcl_UnsetVar(Et_Interp,&nbsp;"zMsg",&nbsp;TCL_GLOBAL_ONLY);<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Invoking Tcl From C</h2>
+<p>The same C function implemented using <tt>Et_EvalF()</tt> instead
+ of <tt>Tcl_GlobalEval()</tt></p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;"appinit.h"<br>
+&nbsp;<br>
+void&nbsp;ErrMsg(char&nbsp;*zMsg){<br>
+&nbsp;&nbsp;Et_EvalF(Et_Interp,&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;"tk_messageBox&nbsp;-icon&nbsp;error&nbsp;-msg&nbsp;{厚PX}&nbsp;-type&nbsp;ok",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;zMsg);<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p>
+ <ul><li>
+ Suppose the function is called as follows:
+ <blockquote>
+ <tt>ErrMsg("Syntax error near \"}\"");</tt>
+ </blockquote>
+ </li></ul>
+
+ <ul><li>
+ The command that gets executed is:
+ <pre>
+ tk_messageBox -icon error -msg \
+ {Syntax error near "}"} -type ok
+ </pre>
+ </li></ul>
+
+ <ul><li>
+ But this is an ill-formed Tcl command!
+ </li></ul>
+</p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Invoking Tcl From C</h2>
+<p>Use the "<tt></tt>" format to generate a quoted string</p><p>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#include&nbsp;"appinit.h"<br>
+&nbsp;<br>
+void&nbsp;ErrMsg(char&nbsp;*zMsg){<br>
+&nbsp;&nbsp;Et_EvalF(Et_Interp,&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;"tk_messageBox&nbsp;-icon&nbsp;error&nbsp;-msg&nbsp;\"%\"&nbsp;-type&nbsp;ok",<br>
+&nbsp;&nbsp;&nbsp;&nbsp;zMsg);<br>
+}</tt></small></td>
+<td></td><td></td><td></td><td></td>
+</tr>
+</table>
+<p><ul><li>The <tt></tt> puts a backslash before all characters that
+ are special to Tcl</li></ul><ul><li>The Tcl command becomes:
+ <pre>
+ tk_messageBox -icon error -msg \
+ "Syntax error near \"\}\"" -type ok
+ </pre></li></ul></p>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Other Functions Provided By Mktclapp</h2>
+<p><ul><li><tt>void Et_ResultF(Tcl_Interp*, ...);</tt></li></ul><ul><li><tt>char *Et_DStringAppendF(Tcl_DString*, ...);</tt></li></ul><ul><li><tt>int Et_AppendObjF(Tcl_Obj*, ...);</tt></li></ul><ul><li><tt>char *mprintf(const char *format, ...);<br>
+ char *vmprintf(const char *format, va_list);</tt></li></ul><ul><li><tt>void Et_NewBuiltinFile(char *filename, char *data, int amt);</tt></li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Operating Mktclapp From The Command Line</h2>
+<p><ul><li>Generate the <tt>appinit.h</tt> header file like this:
+ <blockquote>
+ <tt>mktclapp -header &gt;appinit.h</tt>
+ </blockquote></li></ul><ul><li>Generate the <tt>appinit.c</tt> file like this:
+ <blockquote>
+ <tt>mktclapp -f appinit.mta >appinit.c</tt>
+ </blockquote></li></ul><ul><li>The <tt>*.mta</tt> file is just a list of command-line options</li></ul><ul><li>Enter
+ <blockquote>
+ <tt>mktclapp -help</tt>
+ </blockquote>
+ to get a list of available options</li></ul><ul><li>Look at MTA files generated by xmktclapp.tcl for examples</li></ul></p>
+<br clear="both"><p><hr></p>
+<h2 align="center">Format Of An MTA File</h2>
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td valign="center">
+<small><tt>#&nbsp;Configuration&nbsp;file&nbsp;generated&nbsp;by&nbsp;xmktclapp<br>
+#&nbsp;Hand&nbsp;editing&nbsp;is&nbsp;not&nbsp;recommended<br>
+#</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Comments begin with one #</td>
+</tr>
+<tr><td valign="center">
+<small><tt>##&nbsp;Autofork&nbsp;No<br>
+##&nbsp;CFile:add.c&nbsp;1<br>
+##&nbsp;CFile:objadd.c&nbsp;1<br>
+##&nbsp;CmdLine&nbsp;Console<br>
+##&nbsp;ConfigFile&nbsp;hw.mta<br>
+##&nbsp;Data:check.gif&nbsp;1<br>
+##&nbsp;MainScript&nbsp;hw.tcl<br>
+##&nbsp;Mode&nbsp;Tcl/Tk<br>
+##&nbsp;NoSource&nbsp;No<br>
+##&nbsp;OutputFile&nbsp;hw.c<br>
+##&nbsp;Shroud&nbsp;No<br>
+##&nbsp;Standalone&nbsp;Yes<br>
+##&nbsp;TclFile:hw.tcl&nbsp;1<br>
+##&nbsp;TclLib&nbsp;/usr/lib/tcl8.0<br>
+##&nbsp;TkLib&nbsp;/usr/lib/tk8.0</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">Lines beginning with two #s are used
+ by xmktclapp.tcl and ignored by mktclapp</td>
+</tr>
+<tr><td valign="center">
+<small><tt>-console<br>
+-main-script&nbsp;"hw.tcl"<br>
+-tcl-library&nbsp;"/usr/lib/tcl8.0"<br>
+-tk-library&nbsp;"/usr/lib/tk8.0"<br>
+"add.c"<br>
+"objadd.c"<br>
+-i&nbsp;"check.gif"<br>
+-strip-tcl&nbsp;"hw.tcl"</tt></small></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center"><img src="image2"></td>
+<td>&nbsp;&nbsp;</td>
+<td valign="center">All other lines are read by mktclapp and
+ ignored by xmktclapp.tcl</td>
+</tr>
+</table>
+
+<br clear="both"><p><hr></p>
+<h2 align="center">Summary</h2>
+<p><ul><li>Use Tcl for the things Tcl is good at and use C/C++ for the things that
+ C/C++ is good at</li></ul><ul><li>Use wrapper programs to make pure Tcl programs standalone</li></ul><ul><li>Use mktclapp to combine Tcl/Tk with C/C++ into a standalone</li></ul></p>
+<br clear="both"><p><hr></p>
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image1 b/ext/tk/sample/tkextlib/tkHTML/page4/image1
new file mode 100644
index 00000000000..da26d7092e2
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image1
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image2 b/ext/tk/sample/tkextlib/tkHTML/page4/image2
new file mode 100644
index 00000000000..e176a96a552
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image2
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image3 b/ext/tk/sample/tkextlib/tkHTML/page4/image3
new file mode 100644
index 00000000000..e829d3712cc
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image3
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image4 b/ext/tk/sample/tkextlib/tkHTML/page4/image4
new file mode 100644
index 00000000000..f14ea135474
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image4
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image5 b/ext/tk/sample/tkextlib/tkHTML/page4/image5
new file mode 100644
index 00000000000..4ef62772268
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image5
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image6 b/ext/tk/sample/tkextlib/tkHTML/page4/image6
new file mode 100644
index 00000000000..1adb261b401
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image6
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image7 b/ext/tk/sample/tkextlib/tkHTML/page4/image7
new file mode 100644
index 00000000000..ba0d26ec18a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image7
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image8 b/ext/tk/sample/tkextlib/tkHTML/page4/image8
new file mode 100644
index 00000000000..8b81d58e279
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image8
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/image9 b/ext/tk/sample/tkextlib/tkHTML/page4/image9
new file mode 100644
index 00000000000..f0a352f9d0d
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/image9
Binary files differ
diff --git a/ext/tk/sample/tkextlib/tkHTML/page4/index.html b/ext/tk/sample/tkextlib/tkHTML/page4/index.html
new file mode 100644
index 00000000000..c7bfde35a5e
--- /dev/null
+++ b/ext/tk/sample/tkextlib/tkHTML/page4/index.html
@@ -0,0 +1,768 @@
+<!DOCTYPE HTML="HTML" PUBLIC="PUBLIC" "-//W3C//DTD=""-//W3C//DTD" HTML="HTML" 4.0="4.0" Transitional//EN"="Transitional//EN"">
+<HTML>
+<HEAD>
+<TITLE>[fm] welcome to freshmeat.net</TITLE>
+<STYLE TYPE="text/css"><!-- A:link {text-decoration: none}A:visited{text-decoration:none}A:active{text-decoration:none}--></STYLE>
+</HEAD>
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+<BR><CENTER><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD WIDTH="1"><SCRIPT LANGUAGE="JAVASCRIPT">
+<!--
+now = new Date();
+tail = now.getTime();
+document.write("<IMG SRC='http://209.207.224.246/FreshMeat/Core/pc.gif?/index.php3," + tail + "' WIDTH=1 HEIGHT=1><BR>");
+//-->
+</SCRIPT>
+<NOSCRIPT>
+<IMG SRC="image1" WIDTH="1" HEIGHT="1"><BR>
+</NOSCRIPT></TD></TR></TABLE>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"><TR><TD WIDTH="468"><SCRIPT LANGUAGE="JAVASCRIPT">
+<!--
+now = new Date();
+tail = now.getTime();
+AltText = "\"Please click here.\"";
+document.write("<A HREF='http://ads.freshmeat.net/cgi-bin/ad_click.pl?index,tsof0001en'>")
+document.write("<IMG SRC='http://ads.freshmeat.net/tsof0001en.gif?" + tail + "' WIDTH=468 HEIGHT=60 ALT=" + AltText + "></A><BR>");
+//-->
+</SCRIPT>
+<NOSCRIPT>
+<A HREF="http://ads.freshmeat.net/cgi-bin/ad_click.pl?index,tsof0001en"><IMG SRC="image2" WIDTH="468" HEIGHT="60" ALT="Please click here."></A><BR>
+</NOSCRIPT></TD></TR></TABLE>
+
+<TABLE CELLSPACING="0" CELLPADDING="2" BORDER="0" WIDTH="97%"><TR>
+<TD ALIGN="left" VALIGN="bottom"><A HREF="/"><IMG SRC="image3" BORDER="0" ALT="freshmeat.net" WIDTH="300" HEIGHT="65"></A></TD>
+<TD VALIGN="bottom" ALIGN="left" ROWSPAN="2"><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<FORM METHOD="get" ACTION="/search.php3">
+<SMALL>find: <INPUT TYPE="text" SIZE="15" NAME="query"></SMALL></FORM></FONT></TD>
+<TD ALIGN="right" VALIGN="bottom"><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<A HREF="http://www.linux.com"><FONT COLOR="#000000"><B><SMALL>linux.com partner</SMALL></B></FONT></A><BR>
+<TABLE CELLSPACING="0" CELLPADDING="1" BORDER="0" WIDTH="100%"><TR>
+<TD ALIGN="right"><SMALL><NOBR><FONT FACE="Lucida,Verdana,Helvetica,Arial"><B><A HREF="/">news</A> |<BR>
+<A HREF="/appindex/">appindex</A> |<BR>
+<A HREF="/editorials/">editorials</A> |</B></FONT></NOBR></SMALL></TD>
+<TD ALIGN="right"><SMALL><NOBR><FONT FACE="Lucida,Verdana,Helvetica,Arial"><B><A HREF="/lounge/">lounge</A> |<BR>
+<A HREF="/contrib.php3">contribute</A> |<BR>
+<A HREF="/feedback.php3">feedback</A> |</B></FONT></NOBR></SMALL></TD>
+<TD ALIGN="right"><SMALL><NOBR><FONT FACE="Lucida,Verdana,Helvetica,Arial"><B><A HREF="/about.php3">about</A> |<BR>
+<A HREF="/awards.php3">awards</A> |<BR>
+<A HREF="/faq.php3">FAQ</A> |</B></FONT></NOBR></SMALL></TD>
+</TR></TABLE></TD>
+</TR></TABLE>
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">
+<TR BGCOLOR="#000000"><TD><IMG SRC="image4" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+<TABLE CELLSPACING="0" CELLPADDING="3" BORDER="0" WIDTH="100%" BGCOLOR="#BBDDFF">
+<TR><TD ALIGN="center" VALIGN="top">
+<BR>
+<FONT FACE="Lucida,Verdana,Helvetica,Arial">
+
+
+<SMALL><B>sort by: [ <A HREF="/news/2000/01/29/">date</A> | <A HREF="/news/list.php3?day=/2000/01/29/&orderby=name">name</A> | <A HREF="/news/list.php3?day=/2000/01/29/&orderby=urgency">urgency</A> ]</B></SMALL><BR></TD><TD>&nbsp;</TD></TR><TR><TD VALIGN="top" ALIGN="center"><FONT FACE="Lucida,Verdana,Helvetica,Arial"><TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">We should get this out of the door now</FONT></B><BR>
+<SMALL><B><A HREF="mailto:scoop@freshmeat.net">scoop</A> - January 29th 2000, 23:59 EST</B></SMALL>
+<P>Everyone else is talking about it, so we should announce it ourselves
+before you start to think it's a government hoax. <A HREF="http://server51.freshmeat.net/">Server 51</A> is our new hosting service for Open Source projects, based on Super Cool Space Alien Technology(TM). We hadn't planned to announce it quite so soon, and it's still in the alpha stage as we work day and night at integrating SCSAT with our terrestrial systems, but feel free to take a look around and see what's going on. When we're out of the testing stage and ready to make room for your project, we'll send word via your implants. Be listening.
+
+
+
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949208399.html">comments (8)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>Category: freshmeat
+</SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+ <A HREF="http://server51.freshmeat.net"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">Is Linux for Crazies?</FONT></B><BR>
+<SMALL><B><A HREF="mailto:jeff.covey@pobox.com">jeff covey</A> - January 29th 2000, 23:59 EST</B></SMALL>
+<P>Ray Woodcock writes: "In terms relevant to Linux, this freshmeat
+editorial glances at the tendency of mainstream viewpoints to dismiss
+other viewpoints as 'fringe,' the propensity of dissident movements to
+splinter into factions before they can effectively counter their
+primary adversaries, and the difficulty of creating stability without
+squelching curiosity."
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949208340.html">comments (2), 2065 words in body</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>Category: Editorial
+</SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+ &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">RabbIT 2.0.2</FONT></B><BR>
+<SMALL><B><A HREF="mailto:d94-rol@nada.kth.se">Ernimril</A> - January 29th 2000, 18:29 EST</B></SMALL>
+<DIV ALIGN="justify"><P>RabbIt is the mutating, caching webproxy which is used to speed up surfing over slow links like modems. It does this by removing advertising and background images and scaling down images to low quality JPEGs. RabbIT is written in Java and should be able to run on any platform. It does depend upon an image converter if imagescaleing is on. The recommended image converter is "convert" from the ImageMagick package.</DIV>
+<P><B>Changes:</B> Fixes have been made for a few bugs concerning keep alive and the HTTP response header, a bug with NT and cache directories, a bug concerning requests without a response body, a bug in GZIPHandler that caused it to not gzip already compressed (gzip or compress) streams, a bug in HTTPHeader regarding response phrases that are multiline, and a few bugs in ImageHandler and NCache. GZIPHandler has been built as an intermediate(*) to FilterHandler (this means that it is possible to gzip text/plain, etc., without filtering those streams) uuencoding has been added to the Coder, RabbIT now uses HTTP/1.1, HTMLParser now compiles cleanly with Jikes, and GeneralHeader has been created to allow for HTTPFooter (which is useful when sending chunked data).
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949188564.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: freely distributable</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/daemons/proxy.html"><FONT COLOR="#FFFFFF">Daemons/Proxy</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/902659138/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/902659138/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="/appindex/1998/08/09/902659138.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">nmpg 1.1.3</FONT></B><BR>
+<SMALL><B><A HREF="mailto:narkos@linuxmail.org">Joel Lindau</A> - January 29th 2000, 18:18 EST</B></SMALL>
+<DIV ALIGN="justify"><P>nmpg is a small command-driven frontend and network-jukebox for mpg123.</DIV>
+<P><B>Changes:</B> Bugfixes, better memory managment, a new .nmpgrc parser, and new options.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949187896.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: OpenSource</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/console/sound.html"><FONT COLOR="#FFFFFF">Console/Sound</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/935430877/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/935430877/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/935430877/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/08/23/935430877.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">mod_dtcl 0.7.3</FONT></B><BR>
+<SMALL><B><A HREF="mailto:davidw@prosa.it">David Welton</A> - January 29th 2000, 18:11 EST</B></SMALL>
+<DIV ALIGN="justify"><P>Mod_dtcl is a free/open source implementation of server-parsed Tcl under Apache. It allows you to tightly integrate HTML with Tcl, a widely-used scripting language with many years of development invested in it. There are also many external Tcl modules that you can load into mod_dtcl, to create images, access databases, etc.</DIV>
+<P><B>Changes:</B> A major overhaul of header handling and internal buffering, and the addition of the ability to handle binary data.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949187471.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/web/development.html"><FONT COLOR="#FFFFFF">Web/Development</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/917925309/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/917925309/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/917925309/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/02/01/917925309.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">CoreLinux++ 0.4.6</FONT></B><BR>
+<SMALL><B><A HREF="mailto:frankc@users.sourceforge.net">Frank V. Castellucci</A> - January 29th 2000, 18:07 EST</B></SMALL>
+<DIV ALIGN="justify"><P>CoreLinux++ is an initiative to normalize methods and conventions for OOA/OOD/C++ development for Linux, materialized in a set of Open Source C++ class libraries (libcorelinux++ and libcoreframework++) to support common patterns and exploit the C++ standards.</DIV>
+<P><B>Changes:</B> This release adds AbstractFactory and AssociativeIterator analysis, design, implementations, test code, a CVS daily tarball, a Patch Submission facility and updated FAQ, Web Pages, and defect reporting guidelines.
+<P><B>Urgency:</B> medium
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949187233.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: LGPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/development/libraries.html"><FONT COLOR="#FFFFFF">Development/Libraries</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/944077775/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/944077775/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/944077775/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/12/01/944077775.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">scribe 0.2</FONT></B><BR>
+<SMALL><B><A HREF="mailto:kahlage@logoncafe.net">ChromeBob</A> - January 29th 2000, 12:12 EST</B></SMALL>
+<DIV ALIGN="justify"><P>scribe writes functions prototypes for your C code, so you don't have to. It also compares unique functions between source code files and will 'extern' when appropriate. C++ methods support is also planned.</DIV>
+<P><B>Changes:</B> A fix for an fflush() bug and better documentation.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949165962.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/development/tools.html"><FONT COLOR="#FFFFFF">Development/Tools</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/946661656/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/946661656/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="/appindex/1999/12/31/946661656.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">E theme updater 0.1</FONT></B><BR>
+<SMALL><B><A HREF="mailto:hallvar@ii.uib.no">Hallvar Helleseth</A> - January 29th 2000, 12:04 EST</B></SMALL>
+<DIV ALIGN="justify"><P>E theme Updater is a bash script to automatically update all of your Enlightenment themes from e.themes.org.</DIV>
+<P><B>Changes:</B> Initial release.
+
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949165472.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/console/misc.html"><FONT COLOR="#FFFFFF">Console/Misc</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/949164501/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/949164501/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="/appindex/2000/01/29/949164501.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">Powertweak-Linux 0.1.7</FONT></B><BR>
+<SMALL><B><A HREF="mailto:dave@denial.force9.co.uk">Dave Jones</A> - January 29th 2000, 12:03 EST</B></SMALL>
+<DIV ALIGN="justify"><P>Powertweak-Linux is a port of the Microsoft Windows tool of the same name rewritten from the ground up. Its main function is to tune your system to its optimal performance settings. Currently, it tunes PCI chipsets and can set /proc/sys entries.</DIV>
+<P><B>Changes:</B> A major GUI overhaul, the ability to generate configuration files, extended PCI information tabs, extra information support for the Matrox G200, and numerous other bugfixes & improvements.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949165416.html">comments (2)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/console/system.html"><FONT COLOR="#FFFFFF">Console/System</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/930836224/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/930836224/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/930836224/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/07/01/930836224.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">Pexeso Beta</FONT></B><BR>
+<SMALL><B><A HREF="mailto:pavolkrigler@pobox.sk">Pavol Krigler</A> - January 29th 2000, 11:55 EST</B></SMALL>
+<DIV ALIGN="justify"><P>pexeso is a simple graphic card game for one or two players.</DIV>
+<P><B>Changes:</B> Initial public release.
+
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164956.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: Freeware</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/console/games.html"><FONT COLOR="#FFFFFF">Console/Games</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/949141436/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/949141436/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="/appindex/2000/01/29/949141436.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">XZX 2.9.2</FONT></B><BR>
+<SMALL><B><A HREF="mailto:Erik.Kunze@fantasy.muc.de">E. Kunze</A> - January 29th 2000, 11:54 EST</B></SMALL>
+<DIV ALIGN="justify"><P>XZX is a portable emulator of ZX Spectrum 48K/128K/+3 (8-bit home computers made by Sir Clive Sinclair) and Pentagon/Scorpion (Spectrum clones made in Russia) for machines running UNIX and the X Window system. XZX is completely written in C and emulates Spectrum 48K, 128K, +2 and +3, Pentagon and Scorpion, Interface I with up to 8 microdrives, Multiface 128 and Multiface 3, BetaDisk 128 interface by Technology Research Ltd with 4 disk drives, +D interface by Miles Gordon Technology with 2 disk drives, Kempston mouse, Kempston joystick and built-in machine code monitor.</DIV>
+<P><B>Changes:</B> Lots of feature improvement and bug fixes. Most parts of the audio support has been rewritten for different UNICES.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164896.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: Shareware</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/x11/emulators.html"><FONT COLOR="#FFFFFF">X11/Emulators</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/936956384/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/936956384/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/936956384/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/09/10/936956384.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">DistroLib 0.4</FONT></B><BR>
+<SMALL><B><A HREF="mailto:phir@gcu-squad.org">PhiR</A> - January 29th 2000, 11:54 EST</B></SMALL>
+<DIV ALIGN="justify"><P>DistroLib is an abstraction library designed to make the development of distributed application easier. Its main target is currently compute-bound tasks based on a one server, many clients model (much like distributed.net), but it is quite generic and could be used for any client/server app. It is lightweight, easy-to-use, and relies heavily on threads.</DIV>
+<P><B>Changes:</B> Important bug fixes and command history support.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164869.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/development/libraries.html"><FONT COLOR="#FFFFFF">Development/Libraries</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/942588431/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/942588431/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/942588431/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/11/14/942588431.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">ToutDoux 1.1.7</FONT></B><BR>
+<SMALL><B><A HREF="mailto:yeupou@altern.org">yeupou</A> - January 29th 2000, 11:54 EST</B></SMALL>
+<DIV ALIGN="justify"><P>ToutDoux is a project manager which lets you design a plan of action using a tree structure, with translations in French and English.</DIV>
+<P><B>Changes:</B> A new menu and XML standard for save files.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164843.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/gnome/tools.html"><FONT COLOR="#FFFFFF">GNOME/Tools</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/944433411/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/944433411/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="/appindex/1999/12/05/944433411.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">goMP 1.0.3</FONT></B><BR>
+<SMALL><B><A HREF="mailto:dioxine@poulet.org">Gautier</A> - January 29th 2000, 11:52 EST</B></SMALL>
+<DIV ALIGN="justify"><P>goMP is a set of CGI scripts that allows you to remotely control, via a Web browser, a computer acting as an MP3 jukebox. This program is very useful for someone who's got a dedicated computer with a lot of MP3 files but that doesn't have any output and input devices except network and sound card. It's main advantages are built-in cataloging, fast access to music, and no special software needed on the client side.</DIV>
+<P><B>Changes:</B> Bugfixes, a password-protected config page, basic search function, easier installation thanks to an install script, and relocation of HTML docs and CGIs to a subdirectory.
+<P><B>Urgency:</B> medium
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164772.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: Artistic</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/web/tools.html"><FONT COLOR="#FFFFFF">Web/Tools</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/948492962/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/948492962/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/948492962/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/2000/01/21/948492962.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">APSEND 1.40</FONT></B><BR>
+<SMALL><B><A HREF="mailto:sventek@gmx.net">M.K.</A> - January 29th 2000, 11:50 EST</B></SMALL>
+<DIV ALIGN="justify"><P>APSEND is a TCP/IP packet sender to test firewalls and other network applications. It also includes a syn flood option, the land DoS attack, and a DoS attack against tcpdump running on a UNIX-based system. Future updates will include support for a scripting language to construct TCP packets and a few more options and protocols like UDP and ICMP. A port of APSEND from Perl to C is planned as well.</DIV>
+<P><B>Changes:</B> The stream attack, bugfixes, and rewrites for parts of the code.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164633.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/console/networking.html"><FONT COLOR="#FFFFFF">Console/Networking</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/941654429/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/941654429/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/941654429/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/11/03/941654429.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">ecasound 1.6.12r10</FONT></B><BR>
+<SMALL><B><A HREF="mailto:kaiv@wakkanet.fi">Kai Vehmanen</A> - January 29th 2000, 11:48 EST</B></SMALL>
+<DIV ALIGN="justify"><P>Ecasound is a software package designed for multitrack audio processing. It can be used for simple tasks like audio playback, recording and format conversions, as well as for multitrack effect processing, mixing, recording and signal recycling. Ecasound supports a wide range of audio inputs, outputs and effect algorithms. Ecasound has a chain-based design that allows effects to be easily combined both in series and in parallel. Oscillators and MIDI-CCs can be used for controlling effect parameters. Includes a versatile console mode interface, a Qt-based X-interface and various command-line utils suitable for batch processing.</DIV>
+<P><B>Changes:</B> Support for 24- and 32-bit audio formats and for ALSA 0.5, multichannel noisegate, a new 2nd order lowpass filter, some ia-mode commands, and various bugfixes and low-level improvements.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164529.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: GPL</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/console/sound.html"><FONT COLOR="#FFFFFF">Console/Sound</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/931819147/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/931819147/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="http://apps.freshmeat.net/changelog/931819147/"><IMG SRC="image8" WIDTH="21" HEIGHT="21" BORDER="0" ALT="changelog"></A> <A HREF="/appindex/1999/07/12/931819147.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">SCEZ 20000129</FONT></B><BR>
+<SMALL><B><A HREF="mailto:m032@mbsks.franken.de">endergone Zwiebeltuete</A> - January 29th 2000, 11:46 EST</B></SMALL>
+<DIV ALIGN="justify"><P>SCEZ is a library that should make the handling of smart cards (not memory cards) and card readers as simple as possible and be at the same time small and easily portable. Currently supported are Dumb Mouse, CT-API and Towitoko readers and Schlumberger Cryptoflex, Gemplus GPK4000, GSM SIM and Telesec SigG cards. A PKCS#15 implementation is in the design phase. There are ports to PalmOS and MS-Windows available.</DIV>
+<P><B>Changes:</B> More card and reader drivers, and an application to read out GSM SIM card (phone book and SMS) and write it to the card.
+<P><B>Urgency:</B> low
+<P ALIGN="right"><B>[ <A HREF="/news/2000/01/29/949164394.html">comments (0)</A> ]</B>
+</FONT></TD></TR></TABLE></TD></TR><TR><TD VALIGN="middle">
+&nbsp;<FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#FFFFFF"><B><SMALL>License: BSD type</SMALL></B><BR>
+<B><SMALL>&nbsp;Category: <A HREF="/appindex/development/libraries.html"><FONT COLOR="#FFFFFF">Development/Libraries</FONT></A></SMALL></B></FONT></FONT></TD><TD ALIGN="right">
+<A HREF="http://apps.freshmeat.net/download/939677525/"><IMG SRC="image6" WIDTH="21" HEIGHT="21" BORDER="0" ALT="download"></A> <A HREF="http://apps.freshmeat.net/homepage/939677525/"><IMG SRC="image5" WIDTH="21" HEIGHT="21" BORDER="0" ALT="homepage"></A> <A HREF="/appindex/1999/10/11/939677525.html"><IMG SRC="image7" WIDTH="21" HEIGHT="21" BORDER="0" ALT="appindex record"></A> &nbsp;
+</TD></TR></TABLE>
+<HR WIDTH="0" SIZE="0">
+
+
+<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="97%" BORDER="0" BGCOLOR="#000000"><TR><TD COLSPAN="2">
+<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#FFFFFF">
+<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+<B><FONT SIZE="+2">Comicq 0.2.0</FONT></B><BR>
+<SMALL><B><A HREF="mailto:terminal6@submail.net">Terminal6</A> - January 29th 2000, 11:45 EST</B></SMALL>
+<DIV ALIGN="justify"><P>COMICQ is a command line ICQ messaging tool that allows a user to connect to ICQ using your UIN and password, then sends a message to the destination UIN.</DIV>
+<P><B>Changes:</B> Several bugfixes, icq99a compliance, and a new option --ip that allows you to get any