Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.
Achtung: the bindings described here have (as of July 2014) been superseded by better ones.
th1ish a a toy scripting engine of my own design, maintained in its own repository.
libfossil includes a th1ish script binding which is developed in parallel with the main library, for two reasons:
- Testing from script code is easier than writing all tests in C. Yes, the bindings require effort, but once in place they are easier to use. Being the author of th1ish, writing new bindings for it comes more or less naturally for me :-D.
- As a sanity check to ensure that the library can accommodate the needs of scripting engines. Why? As a usability benchmark - if it can do that, it "should" be general-purpose enough for a wide variety of applications.
High-level docs for these bindings can be found in this public Google Doc.
To build these bits, first build the main library (from the top-most directory), then run 'make' from the 'th1ish' directory. The 'run' make target runs some sanity-checking scripts, and there are some other scripts in that directory (all named *.th1ish). The scripts can be run via the th1ish interpreter, as demonstrated here:
stephan@tiny:~/cvs/fossil/f2/th1ish$ ./th1ish -f test-001.th1ish -- -c This script's name: test-001.th1ish ==canonical==> /home/stephan/cvs/fossil/f2/th1ish/test-001.th1ish test-001.th1ish:26:11: f=FossilContext@8EF4078, f.db=Db@8EF40C0 test-001.th1ish:35:19: Db details: Db type: repo DB file: /home/stephan/cvs/fossil/f2.fsl Size: 1016832 mtime: Thu Aug 1 23:10:37 2013 test-001.th1ish:35:19: Db details: Db type: checkout DB file: /home/stephan/cvs/fossil/f2/.fslckout Size: 301056 mtime: Thu Aug 1 23:10:36 2013 Stash entries:function@8EE01B8 stashid vid ctime comment 1 431 2013-07-30 10:37:03 mark test-001.th1ish:111:11: db=Db@8EFB298 test-001.th1ish:121:15: Prepared statement: Stmt@8F02238 test-001.th1ish:211:19: row #1=["aaa", "bbb"] test-001.th1ish:211:19: row #2=["ccc", "ddd"] Collected results:[["aaa", "bbb"], ["ccc", "ddd"]] stephan@host:~/cvs/fossil/f2/th1ish$ ./th1ish timeline.th1ish -- -n=3 The 3 most recent timeline events for /home/stephan/cvs/fossil/f2.fsl: ci [84fa56b3bee3] @ [2013-08-01 23:10:36] by [stephan] in branch [trunk] prettied up the timeline output a bit. ci [33238c45aac7] @ [2013-08-01 22:50:50] by [stephan] in branch [trunk] fixed the corruptOffset "broken" by the addition of comments. ci [02fdcb712e4a] @ [2013-08-01 22:35:49] by [stephan] in branch [trunk] more test code cleanups.
Run the interpreter without arguments for a long list of options. CLI arguments passed after -- (two dashes by themselves) are passed on to the script, made available via the ARGV global, as described in the th1ish manual.
Achtung: th1ish "should" build on non-Unix platforms but it is completely untested (because i only use Unix platforms). In any case, its dynamic module loader is not implemented for non-Unix platforms, but this build of the th1ish shell does not specifically require that feature.