Somusar/tjpp[tm] is a Java[tm] pre-processor and code generator featuring
the following functions:
- Property-oriented directives to define class properties and generate code related to the list of properties;
- File-oriented macro definitions;
- Inclusion of header files, with or without processing of their contents;
- Conditional generation of code blocks;
- Compact directives for boolean assertions and variable tracing print-outs.
With the only exception of item #4 in the above list,
all tjpp features are implemented as textual macros and
are thus open to any user-defined customization.
Tjpp fits particularly well in text-editor and
command-line oriented
development shops, allowing to reduce, insulate, and
factorize repetitive code blocks and coding practices
into parametrical user-defined macros that allow
to quickly generate and assemble
Java[tm] source files, or parts thereof.
The main advantage of tjpp is the
reduction of redundant code, that can be transparently
generated and re-generated
by means of pre-defined directives and user-defined
parametrical macros at file-system level.
Another advantage is the possibility to insulate in external
macros syntax constructs subject to change as Java evolves,
as shown by directive enumeration. When the new construct
becomes officially available, the required changes
need be applied only once in the macro, and all ".java" files using that
construct can then be regenerated, thus providing higher
flexibility and consistency.
To avoid introducing additional constructs in the
Java files, tjpp translates ".tj" files into ".java" files,
thus leaving untouched the subsequent steps of
the software development and management cycles. Adding the
".tj" to ".java" translation to a command-line oriented
software production chain should be not an issue.
Tjpp is a thin shell or ".bat" wrapper around Tefigel,
accepting one input file (a ".tj" file)
and producing one output file (the corresponding ".java" file).
Tefigel is a slim executable file, currently available
for Linux®, Mac OS® X, and Windows®. Tefigel is a scripting language
expressly designed for code generation. "Tefigel" stands for
text file generation language.
The Tefigel code implementing all tjpp's macros
and directives is kept in directory "tjpp_lib", while
the header files (extension ".tjh") are stored
under directory "tjpp_include". Note the clear separation
between macro files and header files:
each tjpp macro resides in exactly one file under "tjpp_lib", and header
files under "tjpp_include" do not define any macro.
After installing tjpp as described in the next chapter,
to run it type
prompt> tjpp YourClass.tj
prompt> tjpp subdir/AnotherClass.tj
which will produce "YourClass.java" and
"subdir/AnotherClass.java" respectively.
Note that each run will overwrite the generated ".java" file,
unless you set TJPP_BACKS_UP_JAVA to true in file
"tjpp_include/tjpp.defs" to have tjpp
save a time-stamped copy of "YourClass.java"
into (for example) "YourClass.java-Dec02-12.39".
Tjpp has no command line options or flags. In particular,
there is no equivalent to the C/C++ -DSOME_FLAG=some_value
or -Isome_include_path preprocessor options.
All tjpp's error and warning messages output by Tefigel
are described in
"Somusar/SoProMach[tm]: User's Guide
".
[Previous chapter]
[Next chapter]
[Back to top]
|