Tcl

TCL - the 'jimsh0' Tcl interpreter
Login

home

Use jimsh0 as Tcl interpreter

Basically grab jimsh0.c and compile:

    cc -o jimsh0 jimsh0.c

Details:

Use jimsh0 either from autosetup's github...

wget https://raw.githubusercontent.com/msteveb/autosetup/master/jimsh0.c
cc -o jimsh0 jimsh0.c
./jimsh0 --version
echo "puts {Hello}" | ./jimsh0 -

... or from the Fossil repo (which includes autosetup):

cd ~/fossil/repos
fossil clone https://fossil-scm.org fossil.fossil --no-open
mkdir -p ../nest/fossil
cd ../nest/fossil
fossil open --nested ../../repos/fossil.fossil
./configure
cc -o autosetup/jimsh0 autosetup/jimsh0.c
cd ../tcl
../fossil/autosetup/jimsh0 YOURSCRIPT.tcl

jimsh0 does not support package command

https://github.com/msteveb/jimtcl/issues/116

Well, jimsh0 doesn't really support the package command at all.
It has very minimal "package require" support in order to support running unit tests.
You should avoid using it. (e.g. autosetup has it's own 'use' command that does a similar thing).
But it doesn't hurt to support additional, ignored args, so I'll change that.

../fossil/autosetup/jimsh0.exe test2.tcl # ERROR

jimsh0 works with source command

../fossil/autosetup/jimsh0.exe sourcemain.tcl

jimsh0 does not support file normalize by default

https://fossil-scm.org/home/file?name=auto.def&ci=tip

...Jim supports file normalize, but only if you build it with HAVE_REALPATH ...

A workaround is the proc file-normalize found in https://core.tcl-lang.org/tclhttpd/file?name=autosetup/autosetup.
Test with:

./jimsh0 file-normalize.tcl

See also