jaggler

Section: User Commands (1)
Updated: Feb 24, 1998
 

NAME

jaggler - manage several versions of a source code within the file  

SYNOPSIS

jaggler [ -Dflag ]* ( file )+  

DESCRIPTION

jaggler lets you comment out parts of your source code according to a set of if/endif directives that are themselves encoded as comments. The primary use of this is to have a preprocessor for the JAVA (tm) language without actually having a new file format for the simple reason that the java compiler would always report errors with the wrong line count. The flags themselves may be passed on the command line with the -D switch, or defined within the file. The file should contain JAVA source code or anything else that takes // as a line-oriented comment seperator. Multiple files can be specified. Each will be processed and replaced by the version with the new configuration of activated or deactivated code. The original copy is left as backup, a tilde symbol is appended to the file name. By the way, the name jaggler stands for java juggler, so you should pronounce it like juggler.  

SYNTAX

It is a useful habit to indent source code with TAB characters, since jaggler will insert //! at the beginning of lines, that are deactivated. Directives are given as //.<directive> , they must be placed on a line on their own. There are also inline conditionals which apply to just one line, you can append them at the end using the characters //? <expression>  

DIRECTIVES

.if <expression> will either activate or deactivate the following lines of code up to either the .else or the .endif (you can use .fi too), giving you conditional compilation, a feature JAVA doesn't normally provide for reasons that you may or may not agree upon. Conditional directives may be nested, as you would expect. .define <flag> permits you to set a flag. There is no .undef yet, do you need it? .require <file> lets you include a perl script which can extend the jaggler language with its own directives. Read the source if you really want to use this, but you don't need it.  

EXPRESSIONS

There are three styles of conditional expressions, one is mentioning the name of a flag, as in .if DEBUG . Another is to negate the flag, like this: .if !DEBUG . And then you have real expressions, which are perl expressions. In that case you must precede flags with a dollar sign. Here's an example .if $DEBUG and !$PARANOID  

SHORTCUT DIRECTIVES

To me if/else/endif is too much to type, that's why the following shortcuts exist: //{ <expression> is equivalent to //.if <expression> , //} is equivalent to //.endif while //: is the same as //.else  

EXAMPLES

Check out the sample files.  

AUTHOR

Carl von Loesch                  psyc://psyced.org/~lynX