[tcljava-user] How to use Interp.setResult?
Brought to you by:
mdejong
From: Bret C. W. <bc...@ya...> - 2009-03-03 02:16:59
|
Hello, I have not found good documentation for some of Jacl - the API docs on the tcljava.sourceforge.net site are not giving me a good enough understanding to determine how to solve an exception. I have a command-line java program. In it's primary class constructor, it creates a TCL Interp session with the name of an external script file, and exits when the Interp session is complete. In response to various commands found in a script, various Java objects are created, and methods called on those objects from the script. I have a number of working examples of this, including some that successfully return values to the Interp session for further processing. But I haven't figured out what Interp.setResult() does, and it looks as if it might be useful. Consider these two methods. The first (getColumnCount) works as expected, and I can access the return value in my script. The second (getEntry) always provokes the exception listed below. 'myInterp' was set with a reference to the (one-and-only) Interp session when the object these methods belong to was created and is valid for the entire time. Please don't tell me to read the docs, I have and have tried many experiments and they don't tell me what circumstance to use the Interp.setResult() method in or what might be the problem here. Thanks in advance, bcw TCL: $tableName getEntry $column $row Java: /** * *@return* int - The number of columns in this result set. */ *public* *int* getColumnCount() { log.debug( "getColumnCount - columnCount is " + columnCount ); *return* columnCount; } *public* *void* getEntry( String columnName, *int* currentRow ) *throws* TclException { log.debug( "getEntry - column name is " + columnName ); myInterp.setResult( "an Answer" ); } tcl.lang.ReflectException at tcl.lang.JavaInvoke.call(JavaInvoke.java:328) at tcl.lang.JavaInvoke.callMethod(JavaInvoke.java:161) at tcl.lang.ReflectObject.cmdProc(ReflectObject.java:916) at tcl.lang.Parser.evalObjv(Parser.java:826) at tcl.lang.Parser.eval2(Parser.java:1228) at tcl.lang.Parser.evalTokens(Parser.java:1008) at tcl.lang.Parser.eval2(Parser.java:1215) at tcl.lang.Procedure.cmdProc(Procedure.java:174) at tcl.lang.Parser.evalObjv(Parser.java:826) at tcl.lang.Parser.eval2(Parser.java:1228) at tcl.lang.Parser.evalTokens(Parser.java:1008) at tcl.lang.Parser.eval2(Parser.java:1215) at tcl.lang.Interp.eval(Interp.java:2679) at tcl.lang.Interp.eval(Interp.java:2747) at tcl.lang.IfCmd.cmdProc(IfCmd.java:64) at tcl.lang.Parser.evalObjv(Parser.java:826) at tcl.lang.Parser.eval2(Parser.java:1228) at tcl.lang.Interp.eval(Interp.java:2679) at tcl.lang.Interp.eval(Interp.java:2747) at tcl.lang.ForeachCmd.cmdProc(ForeachCmd.java:98) at tcl.lang.Parser.evalObjv(Parser.java:826) at tcl.lang.Parser.eval2(Parser.java:1228) at tcl.lang.Interp.eval(Interp.java:2679) at tcl.lang.Interp.eval(Interp.java:2747) at tcl.lang.WhileCmd.cmdProc(WhileCmd.java:43) at tcl.lang.AutoloadStub.cmdProc(Extension.java:119) at tcl.lang.Parser.evalObjv(Parser.java:826) at tcl.lang.Parser.eval2(Parser.java:1228) at tcl.lang.Procedure.cmdProc(Procedure.java:174) at tcl.lang.Parser.evalObjv(Parser.java:826) at tcl.lang.Parser.eval2(Parser.java:1228) at tcl.lang.Parser.evalTokens(Parser.java:1008) at tcl.lang.Parser.eval2(Parser.java:1215) at tcl.lang.Interp.eval(Interp.java:2679) at tcl.lang.Interp.evalFile(Interp.java:2940) at com.ssg.dataconverter.DataConverter.<init>(DataConverter.java:76) at com.ssg.dataconverter.DataConverter.main(DataConverter.java:159) |