Ruby-dev summary 24236-24254

Hello,

Here is a summary of ruby-dev last week.

[ruby-dev:24240] on enabling tcltk-stubs

  Hidetoshi Nagai, who is a maintainer of Ruby/Tk, called for help since a
  program abort on exit of Tcl/Tk interpreter as follows:
    $ /usr/local/bin/ruby -r tcltklib -e 'TclTkIp.new._eval("exit")'
    Tcl_Release couldn't find reference for 0x814ed38
  A trial fix of this issue was done, and he asked for someone to check
  if the library works fine.
  Also, he asked for someone to try multi-tk.rb and remote-tk.rb, since
  those have been improved from the previous version.

[ruby-dev:24250] DateTime#to_time

  Tadayoshi Funaba posted a specification and a prototype of following
  methods.
    - DateTime#to_time, #to_date
    - Date#to_time, #to_datetime
    - Time#to_date, #to_datetime

  Significant points are as follows:
    - It is not ensured that yyy.to_xxx.to_yyy is equal to yyy.
    - to_time
      * It always returns local time.
      * It may not return intended result because of summer time and
        leap second.
      * 'usec' is rounded.
    - to_date and to_datetime
      * Time zone information is lost, but time difference is left on
        DateTime.
      * Leap time is not considerable.

···

--
Takaaki Tateishi <ttate@ttsky.net>

Hi,

···

From: "Takaaki Tateishi" <ttate@ttsky.net>
Subject: ruby-dev summary 24236-24254
Date: Thu, 16 Sep 2004 04:17:20 +0900
Message-ID: <4487.210.194.45.215.1095275836.squirrel@210.194.45.215>

  Also, he asked for someone to try multi-tk.rb and remote-tk.rb, since
  those have been improved from the previous version.

Please try the latest version of multi-tk.rb/remote-tk.rb.
For example, the following script works properly. In it,

* There are three IPs (ip1, ip2, and master).
* A same procedure is running on each IP at same time.
* The procedure does NOT have a IP parameter.

However,

* Each button is generated on the proper root window.
* Each callback is running on each IP's safe-level.
   ( ip1's $SAFE==1, ip2's $SAFE==2, and master's $SAFE==0. )
* On slave IP, 'exit' function exits only the slave IP.
   And on master, exits all IPs and Ruby.

Some (a little complex) tricks are used on the libraries.
A slave IP can accept the script which works on a single IP
without changes (except security reasons), and can be referd
and controlled by a master IP.
The libraries may be useful to create a test environment for
Ruby/Tk scripts.
----------------------------------------------------
require 'multi-tk.rb'

th = Thread.new{Tk.mainloop}

TkLabel.new(:text=>'this is a primary master').pack

ip1 = MultiTkIp.new_slave(:safe=>1)
ip2 = MultiTkIp.new_slave(:safe=>2)

cmd = proc{
  require 'tk'

  TkButton.new(:text=>'b1: p self', :command=>proc{p self}).pack(:fill=>:x)
  sleep 0.5
  TkButton.new(:text=>'b2: p $SAFE', :command=>proc{p $SAFE}).pack(:fill=>:x)
  sleep 0.5
  TkButton.new(:text=>'b3: p MultiTkIp.ip_name',
         :command=>proc{p MultiTkIp.ip_name}).pack(:fill=>:x)
  sleep 0.5
  TkButton.new(:text=>'EXIT', :command=>proc{exit}).pack(:fill=>:x)

  Tk.mainloop
}

Thread.new{ip1.eval_proc(cmd)}
Thread.new{ip2.eval_proc(cmd)}
cmd.call

th.join
----------------------------------------------------
--
                                  Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)