//#local TESTVAR="TEST LOCAL VARIABLE"May be the preprocessor is only what supports loops in its directives.
//#assert "TESTVAR="+/*$TESTVAR$*/
//#include ".//test//_MainProcedure.java"
public static final void testproc()
{
System.out.println(/*$VARHELLO$*/);
System.out.println("// Hello commentaries");
//#local counter=10
//#while counter!=0
System.out.println("Number /*$counter$*/");
//#local counter=counter-1
//#end
System.out.println("Current file name is /*$SRV_CUR_FILE$*/");
System.out.println("Output dir is /*$SRV_OUT_DIR$*/");
//#if strhas("Hello","Hello world")
System.out.println("Substring found");
//#endif
}
| Directive | Reference |
|---|---|
| //#action EXPR0,EXPR1...EXPRn | To make an action event and process it with a preprocessor action listener |
| //#global NAME=EXPR | To define a global variable (the variable is globally visibiled, from all preprocessed files) |
| //#local NAME=EXPR | To define a local variable (the variable will be visibled only in preprocessed file and included files) |
| //#define NAME | To define a local logical variable as TRUE (it works as //#local NAME=true) |
| //#if BOOLEAN_EXPR | The start a #if..#else..#endif block |
| //#ifdefined VARIABLE_NAME | The start a #ifdefined..#else..#endif block, TRUE if the variable is exists else FALSE |
| //#else | To change the flag for current #if block |
| //#endif | To end current #if block |
| //#include STRING_EXPR | To include and preprocess other source file which is signed as the string result of the expression |
| //#excludeif BOOLEAN_EXPR | To exclude the file (where the directive is found) from the preprocessor output list if the expression is true (it very useful when you need to break a big file for a small preprocessed parts but don't need to get the parts as independed preprocessed sources) |
| //#exit | To abort current source file preprocessing |
| //#exitif BOOLEAN_EXPR | To abort current source file preprocessing if the expression result is true |
| //#while BOOLEAN_EXPR | To start a //#while..//#end block |
| //#break | To break current //#while..//#end block |
| //#continue | To continue //#while..//#end construction |
| //#end | End of //#while..//#end construction |
| //#// | To make the next string line after the directive as commented by "//" in the result file (will be processd only the next string line) |
| /*-*/ | To give up the tail of the string after the directive |
| /*$EXPR$*/ | This directive will be replaced by a string representation of the expression result |
| //#- | To turn off the output of preprocessed data in the output stream |
| //#+ | To turn on the output of preprocessed data in the output stream |
| //$ | To output the string line tail (after this directive) into the output stream without comments "//$Hello"==>"Hello" |
| //$$ | To output the string line tail (after this directive) into the output stream without comments and without (!) processing of /*$..$*/ directives |
| //#assert STR_EXPR | To output the string expression result at the console (usually I use it for information messages) |
| //#prefix+ | All strings after the directive will be added at the start of a result file (it is very useful to make the "import" list for Java sources) |
| //#prefix- | To reset the prefix output mode |
| //#postfix+ | All strings after the directive will be added at the end of a result file |
| //#postfix- | To reset the postfix output mode |
| //#outdir STRING_EXPR | To set a destination directory for the result file of current preprocessed source |
| //#outname STRING_EXPR | To set a name for the result file of current preprocessed source |
| //#flush | To flush inside buffer in //#outdir as //#outname and reset the buffer |
| //#_if BOOLEAN_EXPR | To start a #_if..#_else..#_endif block (it processed at the preprocessing start when the utility finds all global variables at all sources) |
| //#_else | To change the flag for current #_if block |
| //#_endif | To end current #_if block |
| Arithmetic | *, /, +, % |
| Logical | && (and) || (or) ! (not) ^ (xor) |
| Comparison | ==,!=,<,>,>=,<= |
| Brakes | (,) |
| FLOAT|INTEGER abs(FLOAT|INTEGER) | To get the absolute value of an int or float value. |
| INTEGER round(FLOAT|INTEGER) | To get the closest int to the argument. |
| STRING str2web(STRING) | To convert a string to a web compatible string. |
| INTEGER strlen(STRING) | To get the length of a string |
| INTEGER str2int(STRING) | To parse a string as an integer |
| INTEGER xml_open(STRING) | To open an xml document for the path (which given as an argument), it returns the ID of the ioened document |
| INTEGER xml_getDocumentElement(INTEGER) | To get the root document element of an opened xml document |
| INTEGER xml_getElementsForName(INTEGER,STRING) | To get an element list for an element name from an opened XML document |
| INTEGER xml_elementsNumber(INTEGER) | To get the length of an element list |
| INTEGER xml_elementAt(INTEGER) | To get an indexed element from an element list (the first index is 0) |
| STRING xml_elementName(INTEGER) | To get the name of an element |
| STRING xml_getAttribute(INTEGER,STRING) | To get an attribute value from the element |
| STRING xml_getElementText(STRING) | To get the text from an element (it means <element>Element text</element>) |
| VALUE $user_name(EXPR0,EXPR1..EXPRn) | To call an user defined function |
| BOOLEAN strhas(STRING,STRING) | To find a substring (1th argument) inside of a string (2th argument), TRUE if found, else FALSE |