Hi http://chiselapp.com/user/sg/repository/thsh/index
it is a tiny TH shell. Main goal was to keep original Fossil TH core (th.c and th_lang.c) without any changes and provide TH1 shell with alone source (th_shell.c, 391 lines in C). Only new one command was added [source] to interact with system, and a few TCL-like globals, argv0, argv (if that specified), th_interactive, and th_version. The main function to read TH sources is Th_EvalFile(). Even interactive prompt uses it, `thsh' in interactive mode just does process an input from stdin with Th_EvalFile(). The shell can report about errors on exit more verbosely like TCL does $ echo foo | thsh no such command: foo while executing foo (line 1) or $ echo foo > foo $ thsh foo no such command: foo while executing foo (file "foo" line 1) As ::argv0, ::argv are supported by default, sha-bang scripts work as expected (!# /usr/bin/env thsh). Interactive shell knowns how to deal with two globals ::th_prompt1 and ::th_prompt2 if that set, default `thsh' prompt is "% " % set ::th_prompt1 [list puts {th> }] puts {th> } th> proc hello args { set hello hello } th> hello hello th> About [info complete]. TH lacks this command, but if Th_Eval() returns (rc==TH_ERROR && nResult==0) this means that there was no close brace, quote, or bracket in a program and this fact was used to build simple interactive shell. In 'Th1 shell' project I also use `makeheaders' and `translate' *AS IS*. Those programs are neat code filters/generators! With `translate' you can easy to add new TH procedures or embed TH code in your C sources. Once again, my goal was to use TH core without any modifications, so it should be easy to keep the shell up to date: cp ../fossil/src/th.[ch] ../fossil/src/th_lang.c src/ make TH1 shell is really tiny shell (static build with musl libc) $ size -t bld/*.o text data bss dec hex filename 6128 0 0 6128 17f0 bld/th_lang.o 13124 432 0 13556 34f4 bld/th.o 2943 8 4 2955 b8b bld/th_shell.o 22195 440 4 22639 586f (TOTALS) $ size thsh text data bss dec hex filename 44693 840 3552 49085 bfbd thsh and you can use TH by its first appointment, test/glue code in embedded systems. At least `thsh' (IMHO) provides more comfortable way to run TH scripts on *nix than 'fossil test-th-eval', of course, I may be wrong. Please, excuse this OFF-TOPIC. I thought that `thsh' would help someone to learn or play with TH language. Sergei _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users