FRINK(1L)

NAME
frink - format, unformat and obfuscate tcl programs.

SYNOPSIS
format [-cgijlmqs] [filename]...

DESCRIPTION
frink prettyprints correct tcl programs. It can also uglyprint them if you believe that this gives you a speed improvement.

OPTIONS

-a  Add spaces surrounding the body of code in {} or "" when given to a -command option. (default = OFF)

-A  Turns OFF special processing of expr commands.

-b  Add braces where they have been omitted. This will convert the tcl code "if $a continue break" into "if {$a} { return } { break }" (give or take some newlines). Note that there is a possibility that in some cases this could change the semantics of your code. This will only happen in situations where the code that becomes bracketed contains calls on procs that have side effects as the bracketing will change the order of evaluation and in some cases may mean that code is not evaluated at all. However, if you have code written like that you deserve to get it broken!! (default = OFF)

-B  Turns OFF processing of code that you are attaching using the tk bind command.

-c num
    Set the extra indentation for continuations. (default = 2)

-C  Turns OFF processing of code that you are attaching using the tk catch command.

-d  Remove braces from round certain constructs where this is safe to do. (default = OFF)

-e  Generate the else keyword in if statements. (default = OFF)

-E locale
    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  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 the cases in switch statements. (default = OFF)

-h  Print information on options.

-H  turn on heuristic tests and warnings. (default = OFF)

-i num
    Set the indentation for each level. (default = 8)

-j  Throw away non-essential blank lines. (default = OFF);

-J  Just do checks, no output. (default = OFF)

-k  Throw away non-essential braces. (default = OFF);

-K file
    Specify file containing specs of additional commands.

-l  Try and build (simple) oneliners. (default = OFF)

-m  Minimise the code.

-M  Warn about switch statements with no --. (default = OFF)

-n  Generate spaces not tabs.

-N  Do not output a newline before elseif. (default = OFF)

-o  Obfuscate the code.

-p [num | style]
    If code is a number then output that many blanks after each procedure definition, otherwise produce whatever the style indicator requires. (Currently no styles are defined....)

-q  Add spaces round the conditions in if and while statements. (default = OFF)

-r  Turn OFF special processing of the code attached to "time" commands.

-r  Remove all comments, except for a leading #!.

-s <style>
    Format in the named style. No style names are as yet defined.

-S  Stop preserving end of line comments. (default = OFF)

-t num
    Set the tabstops every num characters.

-T  Generate the then keyword in if statements. (default = OFF)

-u  Indicates it is safe to remove braces from elseif conditions. The defaults is to add braces and helps prevent bad code being produced when minimising lines of the form: if ![info exist foo] blah elseif {$foo} bletch (default = OFF)

-v  Put { } round variable names where appropriate.

-V  Print the version number and exit.

-w num
    Set the line width (default = 80)

-W  Halt on warnings as well as errors.

-x  Generate xf style continuations. (default = OFF)

-X  Recognise tclX features. (default = OFF)

-y  Don't process -command. (default = OFF)

-z  Generate a space before continuation characters. (default = OFF)

FILES
Frink reads a file called .frinkrc in your home directory and then the .frinkrc in the current directory (if any). The format of this file is like the command line except that each flag (and any parameters) must stand alone. That is the file must contain "-e -i 4" rather than "-ei 4". Command files are read before the command line is processed so the command line can be used to override options set in the rc file.

See the README file for details of other features of the program.

BUGS
If you do some of the really arcane things that you can do in tcl frink will probably not like it. If you have any examples please send them to Lindsay.Marshall@newcastle.ac.uk