On Wed, 25 Oct 2000, Frank Krahmer wrote:

> 
> After calling a Jacl script I get an exception and examine this by 
>               catch (Exception e) 
>               {
>                       e.printStackTrace();
>               }
> 
> The result on stdout stream is :
> 
> tcl.lang.TclException: syntax error in expression "([info level] == 1) &&
> ([info script] == "") \
>             && [info exists tcl_interactive] && $tcl_interactive"
>         at tcl.lang.Expression.SyntaxError(Expression.java:258)
>         at tcl.lang.Expression.ExprGetValue(Expression.java:550)
>         at tcl.lang.Expression.ExprGetValue(Expression.java:581)
>         at tcl.lang.Expression.ExprTopLevel(Expression.java:236)
>         at tcl.lang.Expression.evalBoolean(Expression.java:151)
>         at tcl.lang.IfCmd.cmdProc(IfCmd.java:46)
>         at tcl.lang.Parser.evalObjv(Parser.java:810)
>         at tcl.lang.Parser.eval2(Parser.java:1209)
>         at tcl.lang.Procedure.cmdProc(Procedure.java:161)
>         at tcl.lang.Parser.evalObjv(Parser.java:810)
>         at tcl.lang.Parser.evalObjv(Parser.java:796)
>         at tcl.lang.Parser.eval2(Parser.java:1209)
>         at tcl.lang.Procedure.cmdProc(Procedure.java:161)
>         at tcl.lang.Parser.evalObjv(Parser.java:810)
>         at tcl.lang.Parser.eval2(Parser.java:1209)
>         at tcl.lang.Interp.eval(Interp.java:2042)
>         at TMFSimulator.Jacl.JaclMgr.executeJaclProc(JaclMgr.java:431)
>         at
> TMFSimulator.Jacl.JaclMgr.initializeJaclTestNetwork(JaclMgr.java:473)
>         at TMFSimulator.Jacl.JaclMgr.initialize(JaclMgr.java:178)
>         at
> TMFSimulator.TMFSimulatorServer.initializeJaclMgr(TMFSimulatorServer.java:443)
>         at
> TMFSimulator.TMFSimulatorServer.initialize(TMFSimulatorServer.java:258)
>         at TMFSimulator.TMFSimulatorServer.main(TMFSimulatorServer.java:185)
> 
> How can I get the location (file, linenumber) where the syntaxerror occurred ?
> 
> Regards


In the general case, there is no way to know. Tcl only knows
about a file when sourcing a file. If you call interp.evalFile("foo"),
it will add "error ... line x in file foo". If you just call
a proc then there is no way to know where the proc came from.

% proc p { args } {
expr {1 == "}
}

% p d
missing "

% set errorInfo
missing "
    while compiling
"expr {1 == "}"
    (compiling body of proc "p", line 2)
    invoked from within
"p d"
%

It can tell you what line of the proc something went wrong
on, but that is about it. In C code, you can compile in
things like the file a function is in, because a given
function can't be defined more than once. Tcl (and any
scripting language for that matter) is dynamic, so
you can't really find this sort of thing out.

Mo DeJong
Red Hat Inc

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to