Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
Please note: this document is currently under revision.
The information herein contained, while still valid, does not reflect the latest state of the described technology.
The Somusar/SoProTech[tm] Booklet Series
Volume VIII

"somusar/tjpp: User's Guide"

Printer friendly


Contents
1. Introduction
2. Overview
3. Installing tjpp[tm]
4. SimpleClass Example
5. ComplexClass Example
6. Running a Test
7. Exercise: Improving Multitier Code Consistency
8. Contacting Somusar
9. Further Reading
Appendix A - tjpp Directives and Macros
A.1 List of available directives
A.2 List of available macros

Appendix A - tjpp Directives and Macros

In summary, the current (December 2003) implementation of tjpp provides the directives and macros listed in the following tables.

A.1 - List of available directives        top

Table 1 - Tjpp generic directives

Directive Description
:IDENTIFIER=value Defines a tjpp variable IDENTIFIER, setting it to the given value. Subsequent references to IDENTIFIER will be replaced by value, even within quotes
@ IF ...
@ ELSE
@ ENDIF
Conditional code block generation. This is a Tefigel construct, and is documented at http://somusar.com/doc/booklets/tefigel_ref.
$include(filename) Includes filename in the generated file, processing its contents
$attach(filename) Includes filename in the generated file, without processing its contents
$trace(var1[,var2...]) Generates code to print out on System.err the value of each variable var1, var2, ...
$assert(expression) Generates code to evaluate the assertion defined by the boolean expression and perform an action if it evaluates to false. By default the action is a tracing message printed out on System.err

Generation of code for $asserts and $traces is controlled respectively by tjpp's variables ASSERTION_SWITCH and TRACE_SWITCH, which by default are both switched on.

Table 2 - Tjpp property-oriented directives

Directive Description
$property(type,id[,readonly]) Generates code to declare a class property of the given Java type, possibly non-modifiable (when readonly is specified). The identifier id should only contain lower case letters, decimal digits, and underscores, as in this_is_a_valid_identifier.
If TJPP_PROPERTY_MAKES_GSETTERS is set to true, generates also a getter method, and a setter method for modifiable properties
$getters Generates getter methods for all properties declared via directive $property, unless TJPP_PROPERTY_MAKES_GSETTERS is set to true
$setters Generates setter methods for all modifiable properties declared via directive $property, unless TJPP_PROPERTY_MAKES_GSETTERS is set to true
$to_string Generates a toString method based on the property list
$enumeration(enum_descr, %
    VALUE_1[=num_1], %
    VALUE_2[=num_2],...)
Generates code to declare a pseudo-enumeration type described by enum_descr and defined by symbols VALUE_1, VALUE_2, ... Numeric values num_1, num_2, ..., can optionally be associated with the corresponding symbols

A.2 - List of available macros        top

Tjpp provides the library and user-defined macros listed below. File names are relative to "tjpp_lib".

Table 3 - Tjpp predefined macros

File and macro name Description
checkhdr Verifies that a header file complies with the ".tjh" naming convention
eofinput Tefigel HOOK routine for end-of-file condition
fileprefix Strips a given extension from a given pathname
flatpath Calls fileprefix and replaces "/" with "_"
gen_warning Generates a Java comment with a "generated-file" warning
getset Generates an accessor or a modifier for a given property
jfileloc Returns the file/line location of current ".tj" and (optionally) ".java" files
newfile Tefigel HOOK routine for beginning-of-file condition
property_get Generates the accessor for a given property
property_id Returns the identifier of a given property
property_scan Scans the list of properties applying a given property processor (another tjpp macro)
property_set Generates the modifier for a given property
property_type Returns the type of a given property
warning Issues a generation-time warning message

Table 4 - Sample user-defined macros

File and macro name Description
my_macros/get_results Generate a block of result.getXXX statements
my_macros/perc Returns a code string that calculates the percentage of the given parameters
my_macros/timestamp Returns a time-stamp string

[Previous chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / tjpp_manual  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster