Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't source in tsp proc file interactively but runs from the command line #3

Open
lehenbauer opened this issue Jul 29, 2015 · 2 comments

Comments

@lehenbauer
Copy link

If I run, like, "tclsh latlons.tcl", it works, but if I start Tcl interactively and do a "source latlons.tcl", I get some MD5 signatures output to the terminal and a traceback.

 % source latlons.tcl 
MD5 (.) = ea4246ce05c0fff0f9db6a66575db603
MD5 (.) = ea4246ce05c0fff0f9db6a66575db603
can't read "v::code(/usr/home/karl/src/tsp_examples/latlons.tcl)": no such variable
while evaluating {source latlons.tcl }

 % puts $errorInfo
can't read "v::code(/usr/home/karl/src/tsp_examples/latlons.tcl)": no such variable
    while executing
"dict get $v::code($file) result"
    (procedure "critcl::cresults" line 3)
    invoked from within
"critcl::cresults"
    (procedure "::tsp::lang_compile" line 45)
    invoked from within
"::tsp::lang_compile compUnit $compilable"
    (procedure "::tsp::compile_proc" line 72)
    invoked from within
"::tsp::compile_proc $scriptfile $name $argList $body"
    (procedure "tsp::proc" line 6)
    invoked from within
"tsp::proc fa_latlongs_to_distance {lat1 lon1 lat2 lon2} {
    #tsp::procdef double -args double double double double
    #tsp::compile assert
    #tsp::double ..."
    (file "latlons.tcl" line 6)
    invoked from within
"source latlons.tcl "
    ("eval" body line 1)
    invoked from within
"eval $LINE"
@lehenbauer
Copy link
Author

It's running /sbin/md5 instead of doing whatever it's supposed to do.

@lehenbauer
Copy link
Author

The problem is due to some interaction between critcl, up to and including 3.1.15, and tclreadline. If in my .tclshrc I don't require tclreadline then the problem doesn't happen.

I'm pretty sure the problem is in critcl/lib/critcl/critcl.tcl; there's a lot of trickery starting around line 30 to come up with a working md5, or, depending on how you look at it, a problem in tclreadline.

In my .tclshrc if I package require tclreadline then when I try to source in a tsp::proc interactively, I get:

 % source test.tcl
MD5 (.) = 45786b6b37b66944713676903928042e
MD5 (.) = 45786b6b37b66944713676903928042e
can't read "v::code(/usr/home/karl/src/tmp/tsp/test.tcl)": no such variable
while evaluating {source test.tcl}

...even if I don't define a tclreadline::prompt proc or run ::tclreadline::Loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant