[tcljava-dev] Re: tcljava compiler
Brought to you by:
mdejong
|
From: Martti T. <ma...@da...> - 2006-04-05 05:31:07
|
tcl...@li... wrote:
The only minor problem so far is that the "-readyvar" option on
>> TJC::compile never returns a result in the server.
> Exception in thread "TJCThread service" java.lang.NoSuchMethodError:
>This is a binary compat issue with a version of the compiler that you
>installed already.
>The following should fix the problem:
>
>make clean
>make all
>make install
>rm -rf tjc2
>make tjc2
>make install
Thank you. I'll remember to make clean in the future.
I'll now post a simple example of my problem with the -readyvar option.
--------
/* Test2 */
import tcl.lang.*;
public class Test2 {
public static void main(String[] args) {
try {
Interp interp = new Interp();
interp.eval("source [pwd]/unknown.tcl");
interp.eval("test");
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
----unknown.tcl----
package require TJC
proc unknown { args } {
set command [lindex $args 0]
source [pwd]/${command}.tcl
set compile_ready NOT
TJC::compile $command -readyvar compile_ready
vwait compile_ready
if { ! [string equal [string range $compile_ready 0 1] "OK"] } {
puts "Compilation failed on $args ($compile_ready)"
return
} else {
return [eval $args]
}
}
-------
The ouput is "Compilation failed on test (NOT)". If I don't set the
variable compile_ready then it is undefined. The compiler runs correctly
and vwait takes 6 seconds just as in a direct compile but the -readyvar
variable is never set. In a more complex example the unknown proc
running ignores the wait and seems to compile as it goes along and the
proc execution speeds up considerably after a while. However I suspect
it is dangerous to allow the compiler to replace procs from another
thread while the interpreter is executing the source proc without
waiting for the compile to finish.
Cheers
--
Martti Tienhaara (ma...@da...)
DASH Software Ltd.
|