How code is generated
When you build an application from a Business Application diagram, the build rules define the various files that are input into the Code Generation Engine and the application code files that are output.
BAM Consolidates and Generates
- Data Consolidation
- The input from the BA diagram and related entities is gathered into a single XML file, which consolidates all the inputs into one package. This file is used when processing and generating the application code. This file could also be used to provide input to create the application models.
- Code Generation
- The XML file and a code template are used to generate the application code. The default Tcl template produces Genero 4gl files, but another tool could be used to generate the code (XSL translator for example). Custom code is preserved; if any custom code was created earlier, it is automatically restored in the newly generated application code.
Example
The build rules define the series of commands used to build and generate the code. In general, the Build rule for code generation:
- Saves custom code added by the user to the generated source files
- Generates the new source files without user code
- Restores the user code in the generated files
- Compiles the written and generated source files
- Links the compiled files
View default build rules selecting
. This example shows the build rules used to generate the code for a Program entity in the Business Application diagram.Build rule command | Description |
---|---|
$(generate) | The $(generate) command creates an intermediary XML file from modeled entities. |
$(blockpoint) -code | BLOCK/POINT is extracted from previously generated and modified code. |
tclsh | The tclsh executable generates the final file by using both a Tcl template file and the intermediary XML file created by the $(generate) command. |
$(blockpoint) -storeGenerated | Extracted BLOCK/POINT code is put back into the generated code. |
$(fglcomp) | The fglcomp tool compiles BDL program sources files into a p-code version. |
$(move) | Moves the given file or directory to the given destination in a platform-independent way. When moving a directory, the move command is recursive. |
Reviewing the Build
To better understand what is happening during the build of the program, turn on verbose mode using , then (or, if you are on a Mac, ) . Compile a diagram file, program, or application and view the results in the output.