Thanks, I have been playing with this all day and have made some
discoveries, but I still need some help.
I have written the following:
def Tk.load_tcl_script(file)
begin
Tk.tk_call('source', file)
rescue
puts $!
end
end
The $! gives the error found during the Tk call
(for example, wrong # args: should be "set varName ?newValue?")
But, I also want to report the current line number and stack
trace of the tcl error. (To be more exact, I want the output
to look exactly like the error output when running tclsh.)
Is there any way to accomplish this?
On a side note, I finally figured out the call backs in tcl.
tcl syntax (in the tcl file):
ruby { ruby_method(arg1, arg2...) }
ruby syntax:
def ruby_method(arg1, arg2,...)
....
end
Tk.load_tcl_script(file)
On Mon, 29 Apr 2002 23:10:09 -0600, nagai wrote:
> Hi,
>
> From: nagai / ai.kyutech.ac.jp
> Subject: Re: TCL interpreter in Ruby? Date: Mon, 29 Apr 2002 10:46:54
> +0900 Message-ID: <20020429104649U.nagai / ai.kyutech.ac.jp>
>> The following is a sample to show tha way of reading the user configure
>> scripts.
>> --------------------------------------------------- require 'tk' def
>> Tk.load_tcl_script(file)
>> Tk.tk_call('eval', open(file){|f| f.read})
>> end
>> ---------------------------------------------------
>
> Sorry. That was not so good script.
> The following is the better and more (most?) simple way.
> --------------------------------------------------- require 'tk' def
> Tk.load_tcl_script(file)
> tk_call('source', file)
> end
> --------------------------------------------------- Is it enough to
> solve your problem?
--
___________________________________________________________________________
Craig Files, PhD | /
http://coxcomb.ftc.agilent.com/~cfiles/ | __o /
craig_files / agilent.com | \<, /
____________________________________________|_____()/ ()____/ (970)288-0183