I am working on a bit of TH documentation, will publish over the next few 
weeks. As far as I can tell now, the only structural difference is the use of 
:: for accessing global vars, rest works identical to Tcl. Commands are a 
subset and have some differences (see below for draft command list).
 
I've carved out th.h, th.c, th_lang.c & th_main.c and with a few hacks made a 
stand-alone TH interpreter. With a few commands added (lsort, foreach, append) 
it would be capable of running the makemake.tcl script. I guess here is an 
opportunity to remove the dependence on tcl for building fossil.
 
At first I thought to find a command for working with the database directly, in 
the vein of the sqlite command for tcl. However this does not seem to exist and 
from a brief look at the ticketing system (tkt.c) I figure that the philosophy 
is to have C code prepare variables/lists before a TH script is run. Correct?
 
Also found a bug, I think: the "puts" and "html" commands seem to be reversed. 
In "putsCmd" change "pConvert!=0" to "pConvert==0" to fix.
 
Herewith the TH built-in command list and some other observations as a start 
for documentation:
 
<language core commands>
  catch script ?varname?
  if expr1 body1 ?elseif expr2 body2? ? ?else? bodyN?
  expr expr
  for init condition incr script
  list ?arg1 ?arg2? ...?
  lindex list index
  llength list
  set varname ?value?
  proc name arglist code
  rename oldcmd newcmd
  break    ?value...?
  continue ?value...?
  error    ?value...?
  return ?-code code? ?value?
  string compare STRING1 STRING2
  string first NEEDLE HAYSTACK ?STARTINDEX?
  string is CLASS STRING
  string last NEEDLE HAYSTACK ?STARTINDEX?
  string length STRING
  string range STRING FIRST LAST
  string repeat STRING COUNT
  info exists VAR
  unset VAR
  uplevel ?LEVEL? SCRIPT
  upvar ?FRAME? OTHERVAR MYVAR ?OTHERVAR MYVAR ...?
  breakpoint ARGS
 
<fossil extension commands>
  enable_output BOOLEAN
  puts STRING
  html STRING
  wiki STRING
  htmlize STRING
  date
  hascap STRING
  combobox NAME TEXT-LIST NUMLINES
  linecount STRING MAX MIN
 
** The TH1 scripts are contained within <th1>...</th1>. 
** TH1 variables are $aaa or $<aaa>.  The first form of
** variable is literal.  The second is run through htmlize
** before being inserted.
 
predefined fossil variables:
  "project_name"
  "title"
  "baseurl"
  "index_page"
  "current_page"
  "manifest_version"
  "manifest_date"

Regards,
 
Paul
 

________________________________

From: fossil-users-boun...@lists.fossil-scm.org on behalf of D. Richard Hipp
Sent: Mon 4/27/2009 2:59 PM
To: fossil-users@lists.fossil-scm.org
Subject: Re: [fossil-users] Documentation TH1




On Apr 27, 2009, at 8:56 AM, <p...@planet.nl> <p...@planet.nl> wrote:

> Is there documentation for the Fossil scripting language "TH" (or is 
> it "TH1"?) available somewhere?
> Or is it a matter of "Use the Source, Luke" :^)
>

Unfortunately, the only documentation currently available is the 
source code.  This is a deficiency that needs to be addressed.

D. Richard Hipp
d...@hwaci.com


_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to