=====================================
Java preprocessor prerelease
=====================================
Customize your Java!

Here is the preprocessor for SUN Java compiler. This product allows the using
of the C-like macros in your Java sources. The preprocessor is only the
superstructure over Java compiler and requires the JDK.

The preprocessor translates your sources with the preprocessor macros into the
Java sources and then calls the Java compiler. The messages about errors are
translated into the form compatible with most C compiler. The positions of
errors will point to the positions in original files, not to the resulted java
sources.

The preprocessor is an Open Source product. The original project created using
Visual C++ 5.0. We think that you will not have problems at the porting because
Microsoft extensions are not used.

You can make any changes while you follow these conditions:
- The authorship message can be is complemented, but is not changed.
- You should notify me about changes.

=====================================
Contacts
=====================================
Nick E. Geht:    geht@omskreg.ru
GehtSoft:        http://softdev.omskreg.ru/gehtsoft/index.html
                 http://gehtsoft.freeru.net

=========================
Java preprocessor summary
=========================
Preprocessor commands
-------------------------

#include "filename"

The command includes specified file into your source. The preprocessor search
the file in the current directory or in directories specified in the JPPINCLUDE
environment variable.

Example:
#include "cdefs.jh"


#define identifier value

The command defines macro identifier. This identifier will be replaced with the
value each time when it will be met in the source. The length of the identifier
should not exceed 64 characters, the length of the value should not exceed 256
characters. The value can not include any other macro identifier.

Example:
JPP source:
#define PI 3.14

a=PI*2;
b=PI_1*222
System.out.writeln("PI value is");

Resulted java source:
a=3.14*2;       //PI is the identifier - changed
b=PI_1*222;     //PI is the part of other identifier - not changed
System.out.writeln("PI value is");     //PI is the part of the literal - not changed.

#ifdef identifier/#endif

The command allows including of the source placed between #ifdef and #endif
commands if the identifier is defined.

Example:
#ifdef _DEBUG
        DumpContext();
#endif


#ifndef identifier/#endif

The command allows including of the source placed between #ifndef and #endif
commands if the identifier is not defined.

#inline identifier macrofunction

The command defines macro function. The description looks like #define, but you
can use the defined identifiers and the length of the macro function should not
exceed 1024 characters. In the macro function you can use parameters reference.
The parameter are used as _N there N is a decimal digit according to the number
of parameter. The parameters should be specified in brackets and delimited by
commas when using macro function.

Example:
JPP source
#inline strcpy _0=new String(_1)
 ...
 strcpy(myString,"eklmn");

Resulted java source:
myString=new String("eklmn");

The "repeat" block can be used in the inline construction. The repeat blocks
repeats specified text for each inline parameter starting from the second
parameter. The "repeat" block should starts from @ and should be specfied in
brackets. The "_P" macro should be specified instead the parameter. One one _P
macros should be used in each repeat block.

Example
#inline sum _0=0; _0=_0@(+_P)
sum(a,b,c);
sum(a,b);
sum(a,b,10,20,30,40);

One temporary variable can be used in the inline construction. The "_T" macro
should be specified instead name of the variable.

Example:
#inline aa { int _T=0; _0[_T++]=_1; _0[_T++]=_2; }
The command line
First parameter in the command line always specifies the name of jpp source.
Note that jpp source should not have "java" extension because the preprocessor
creates the file with this extension during the compilation. "jpp" extension is
recommended.

After the file name you can use the following options:
 /nologo        don't display logo message
 /noremove      don't remove resulted java sources
 /nc            don't execute javac compiler
 /Didentifier   define identifier. /DDEBUG option is analog to the #define
                DEBUG command in jpp source

The /javac key should be specified at end of the command line. All options
specified after this key will be passed to javac compiler without any changes.
The -Xstdout option is always underlined by default.

Example
jpp mysource.jpp /nologo /DDEBUG /javac -d .\myclasses -g:none -O

The conclusion
-------------------
There is prerelease of the java preprocessor. Please, report about all errors.
Write me if you have any ideas. I'm ready to continue this work if this product
will be interesting for you.

Watch for http://softdef.omskreg.ru/gehtsoft/download.html or
http://gehtsoft.freeru.net/download.html
for the last version.

