Index of /tcl/ftparchive/incoming
Name Last modified Size Description
Parent Directory 14-Aug-00 13:52 -
OpenVerse-0.8.3.tar.gz 04-Jul-00 12:24 278k
README 23-Aug-00 03:34 7k
cft-0.82.tar.gz 26-Jul-00 07:20 59k
cvs-exmh.tar.gz 26-Oct-99 09:06 738k
frink-2.0.1.tar.gz 23-Aug-00 03:34 50k
frink.README 23-Aug-00 03:34 7k
hi 21-Jul-00 17:03 1k
img1.2.4.tar.gz 15-Aug-00 00:37 1.5M
img124.exe 15-Aug-00 00:39 777k
img124.zip 15-Aug-00 00:35 1.8M
jstools-2001.02.10.ta..11-Feb-01 00:13 714k
moodss-8.10.README 06-Feb-00 10:23 3k
moodss-8.10.tar.gz 06-Feb-00 10:23 564k
moodss-8.11.README 26-Feb-00 17:31 3k
moodss-8.11.tar.gz 26-Feb-00 17:31 575k
moodss-8.12.README 17-Mar-00 16:38 3k
moodss-8.12.tar.gz 17-Mar-00 16:38 577k
moodss-8.13.README 20-Mar-00 16:03 3k
moodss-8.13.tar.gz 20-Mar-00 16:03 579k
moodss-8.14.README 26-Mar-00 07:59 3k
moodss-8.14.tar.gz 26-Mar-00 08:07 581k
moodss-8.15.README 09-Apr-00 16:03 3k
moodss-8.15.tar.gz 09-Apr-00 16:03 582k
moodss-8.2.README 22-Sep-99 08:57 3k
moodss-8.2.tar.gz 22-Sep-99 09:13 493k
moodss-8.3.README 03-Oct-99 13:11 4k
moodss-8.3.tar.gz 03-Oct-99 13:10 525k
moodss-8.4.README 17-Oct-99 15:02 4k
moodss-8.4.tar.gz 17-Oct-99 15:02 531k
moodss-8.5.README 06-Nov-99 14:54 4k
moodss-8.5.tar.gz 06-Nov-99 14:54 520k
moodss-8.6.README 24-Nov-99 16:09 3k
moodss-8.6.tar.gz 24-Nov-99 16:07 526k
moodss-8.7.README 19-Dec-99 11:45 3k
moodss-8.7.tar.gz 19-Dec-99 11:45 529k
moodss-8.8.README 30-Dec-99 17:19 3k
moodss-8.8.tar.gz 30-Dec-99 17:34 537k
moodss-8.9.README 03-Jan-00 03:31 3k
moodss-8.9.tar.gz 03-Jan-00 03:32 540k
moodss-9.0.README 22-Sep-99 09:14 4k
moodss-9.0.tar.gz 22-Sep-99 09:23 492k
run_freeamp_0.001.tar..23-Aug-99 05:11 19k
scwoop-3.0.README 12-Sep-99 14:37 1k
scwoop-3.0.tar.gz 12-Sep-99 14:37 72k
scwoop-3.1.README 28-Dec-99 11:22 1k
scwoop-3.1.tar.gz 28-Dec-99 11:07 72k
stooop-4.0.1.README 31-Aug-99 14:51 3k
stooop-4.0.1.tar.gz 31-Aug-99 14:51 67k
stooop-4.0.README 24-Aug-99 15:26 3k
stooop-4.0.tar.gz 24-Aug-99 15:26 67k
stooop-4.1.README 28-Dec-99 11:22 3k
stooop-4.1.tar.gz 28-Dec-99 11:10 65k
tcl-faq.part01 22-Dec-99 07:58 102k
tcl-faq.part02 22-Dec-99 07:58 137k
tcl-faq.part03 22-Dec-99 07:58 51k
tcl-faq.part04 22-Dec-99 07:58 543k
tcl-faq.part05 22-Dec-99 07:58 371k
tcl8.1.1plus.patch.gz 06-May-00 07:08 230k
tcl821.exe 09-Oct-99 09:09 2.3M
tclreadline-0.9.README 23-Aug-99 15:46 4k
tclreadline-0.9.tar.gz 23-Aug-99 15:46 60k
tix-8.1.0.tgz 14-Nov-00 11:00 1.4M
tk8.3.0.tar.gz 20-Feb-00 11:05 28k
tkSokoban-0.7.README 23-Feb-01 23:35 6k
tkSokoban-0.7.tcl 24-Feb-01 00:36 37k
tkSokoban-0.7.zip 23-Feb-01 23:45 105k
tkSokobon-0.7.zip 23-Feb-01 23:36 105k
tkdesk-1.2.README 14-Nov-99 18:20 5k
tkdesk-1.2.tar.gz 14-Nov-99 18:25 1.0M
tkmpeg_0.001.tar.gz 23-Aug-99 05:11 10k
tkpiechart-5.4.README 26-Mar-00 04:30 1k
tkpiechart-5.4.tar.gz 26-Mar-00 04:30 44k
tkpiechart-6.0.README 08-Sep-99 15:23 1k
tkpiechart-6.0.tar.gz 08-Sep-99 15:23 44k
tkpiechart-6.1.README 28-Dec-99 11:22 1k
tkpiechart-6.1.tar.gz 28-Dec-99 11:10 43k
tkusr-0.70.README 21-Nov-00 10:33 1k
tkusr-0.70.tar.gz 21-Nov-00 10:43 68k
tputs-1.2.tar.gz 05-Dec-99 03:51 20k
traversal-0.9.tar.Z 06-Apr-00 16:03 21k
xdobry-0.11-0.tar.gz 01-Nov-00 04:18 413k
xdobry-0.12-0.tar.gz 20-Nov-00 01:50 499k
zircon-1.18.224.tar.gz 14-Sep-99 04:16 317k
zircon-1.18.225.tar.gz 20-Oct-99 06:56 317k
zircon-1.18.226.tar.gz 25-Oct-99 10:54 317k
zircon-1.18.227.tar.gz 01-Nov-99 03:43 318k
zircon-1.18.228.tar.gz 22-Nov-99 08:16 318k
zircon-1.18.243.tar.gz 31-Mar-00 08:28 319k
zircon-1.18.244.tar.gz 07-Jun-00 03:19 319k
zircon-1.18.245.tar.gz 17-Jul-00 07:38 319k
zircon-1.18.246.tar.gz 21-Dec-00 09:25 309k
Frink 2.0
The latest version of Frink is always available by ftp from catless.ncl.ac.uk
in the /pub directory: ftp://catless.ncl.ac.uk/pub/frink.tar.gz
Frink is a tcl formatting and static check program. It can prettify your
program, minimise, obfuscate or just sanity check it. It can also do some
rewriting.
You pass it filenames (or the stdin) and the output is generated to stdout.
There are a variety of options you can pass in :
-a : add spaces after {} and "" when processing -command. (default = OFF)
-A : turn OFF special processing of expr commands.
-b : add braces (see manual page for details) (default = OFF)
-B : turn OFF processing code passed to the bind command.
-c <n> : set further indent for continuations to n. default = 2
-C : turn OFF processing code passed to the catch command.
-d : remove braces in certain (safe) circumstances (default = OFF)
-e : produce "else". default = OFF
-E <l> : extract constant strings. The parameter is the locale for which the
strings are currently written. If the -f flag is also used then only
the constant strings that are rewritten will be output. Output goes to
a file called "<locale>.msg".
-f : rewrite some strings to use msgcat. (currently -text and -label options)
-F <p> : selectively control which heuristics are used. Currently the parameter
is a single hex coded number with each bit representing a test. The
values you need to know are:
00001 : append parameter testing
00002 : lappend parameter testing
00004 : set parameter testing
00008 : incr parameter testing
00010 : return checks
00020 : check for : or ::: in names
00040 : expr checks
00080 : foreach var checking.
-g : indent switch cases. default = OFF
-h : print information about options.
-H : turn on heuristic tests and warnings. (default = OFF)
-i <n> : set indent for each level to n. default = 4
-j : remove non-essential blank lines. (default = OFF)
-J : Just do checks, no output. (default = OFF)
-k : remove non-essential braces. (default = OFF)
-K <f> : specify file of extra code specs (see below for details).
-l : try for one-liners
-m : minimise the code by removing redundant spacing. default = OFF
-n : do not generate tab characters. default = OFF
-N : do not put a newline out before elseif. default = OFF
-o : obfuscate : default = OFF
-p <v> : If v is a number produce that many blank lines after each
proc definition, otherwise produce whatever format the code
indicates. No codes are defined yet..... (default = do nothing)
-r : remove comments. default = OFF
-s <c> : format according to style name "c". (no style names defined yet)
-S : Stop preserving end of line comments. default = OFF
-t <n> : set tabs every n characters.
-T : produce "then". default = OFF
-u : Safe to remove brackets from round elseif conditions. default = OFF
-v : put { } round variable names where appropriate.
-w <n> : set line length. default = 80
-W : halt on warning.
-x : produce "xf style" continuations
-X : recognise tclX features
-y : Don't process -command (deafult = OFF)
-z : do not put a single space before the \ character on continuations.
Please try it and let me know how else you would like to be able to
tailor the output. (And all the bugs you find as well) Currently it is
geared very much towards the style of tcl programming that I use myself.
Obfuscation is not particularly sophisticated yet. In particular it
can be (in most cases) reversed by running the obfuscated program
through frink again!
Frink uses quite a few heuristics (i.e. a bunch of ad hoc hacks) to
improve both formatting and minimisation. In some obscure cases these
may burn you. Please let me know of any cases you find. Suggestions for
new heuristics are always welcome.
Currently frink supports straightforward tcl (it doesn't do case
either), tclX and [incr tcl] 1.0. N.B. frink assumes that you are
running it over a correct tcl program. If this is not the case then
all bets are off! There are some constructions possible in tcl where
it is impossible to determine the correct formatting except at
runtime. If you use these, sorry, but frink can't help you.
Comment handling is not brilliant - suggestions are welcome for how it could be
improved.....
Rewriting
=========
Frink will try to detect the cases where you use the options -text or
-label and can rewrite the string passed in to use the message catalogue.
Thus
label .foo -text "This is an example"
would become
label .foo -text [::msgcat::mc "This is an example"]
If Frink detects the the string is already of the form
[::msgcat::mc ......]
then it does not rewrite. N.B. Frink does not generate the
"package require msgcat" statement for you!!!!
Heuristics
==========
Frink applies a variety of heuristics to the tcl code to try to detect possible
errors. Note that sometimes the things that it points out are not in fact
incorrect. At the moment the checks it does are as follows:
1) detects if certain commands are used without parameters.
2) detects certain cases where too many or too few parameters are provided.
3) detects "< " at the end of a line (bad continuation usually).
4) detects missing }, ] and ".
5) detects when non-constant strings are passed as the first parameter
to set, append and lappend.
6) detects variable names with single or more than two sequential colons
in them.
7) detects exprs where the expression is not braced.
8) detects some missing ) cases.
9) detects where return is used inconsistently (i.e. sometimes you
return a result, sometimes not). Picks up missing returns at end
of procs that return results too.
10) checks nested foreach statements to see if variables get reused.
I have other heuristic tests planned, and if you have any suggestions
for tests i can implement please let me know.
Extending the analysis
======================
The -K flag allows you to specify a file that describes new commands to Frink
so that it can format/check them correctly. The syntax is very simple.
1) comment lines start with a #
2) blank lines are ignored
3) definition lines start with the name of the command and are followed by
a specification of the parameters. These tell Frink what to expect in
these positions and what formatting/checks it should therefore carry out.
Here are some specs for commands that you already are familiar with:
append {var any args}
append's first parameter is a variable name
the second can be anything and this can be followed by 0 or more
parameters.
proc {any any code}
proc's first two parameters can be anything
the third is code.
Lindsay
--
Lindsay.Marshall@newcastle.ac.uk