Previous Topic: Configure the Build Tool to Support External Action Block LinkingNext Topic: Application Test


Application Generation

Now we are ready to generate the remaining code.

Follow these steps:

  1. In the Toolset, open the Window Code Generation.
  2. In the Window Code Generation dialog, select the Window Manager EGOLFWIN. From the Menu Bar, click View, Expand All. The window manager will be fully expanded.
  3. We created two new procedure steps, the client procedure step EGOLFER_SCORE_CARD and the server procedure step MAINTAIN_SCORE_CARD. And we modified one existing client procedure step, EGOLFER_HOME with a link to the score card client. So at a minimum, those three procedure steps and all of their associated action blocks need to be generated.

    Additionally, we defined a flow between the two client procedure steps and changed the Windows user interface. So the Window Manager needs to be regenerated.

    Select the down arrow under the Code column for the window manager. That will select all of the action diagrams for code generation. But we also want them to be compiled and linked, so select the down arrow under the Install (Inst) column.

    If we wanted to be more efficient in our generation, and we had already generated and tested the application earlier, we could clear the selection of the portions of the load module that have not changed as follows, otherwise leave everything selected:

    Window Code Generation dialog

  4. From the Menu Bar, click Generate, Code, Selected. The Window Code Generation dialog will change to report that generation completed successfully and automatically launch the Build Tool if it is no longer open.
  5. If everything completes successfully, the Build Tool displays the Build-OK status as follows:

    Build Tool displaying the Build-OK status

  6. Now that we have generated some code, we can look at the workings of External Action Blocks in a little more detail.

    Go to your models “C” directory and locate the RDBLOB.c file. Open the file with Notepad.

    What you will find is the shell of a C program with parameters defined corresponding to the import and export views defined in our EAB action diagram. If you scroll to the bottom of the diagram you will see a section with the note;

    /* User-written code should be inserted here */

    So now someone who wanted to write their own code would take this stub as a starting point, copy it to another directory and add their code to it, being careful not to change the properties of the parameters already defined. Then they would compile it like they would any program they were handwriting and make the external code available to the Gen generated application through an external library.

    For an example of this, locate the same C file in the extrn folder. Open it and scroll to the bottom to see where someone added the code to read the BLOB from a file location provided to it in its import parameter and put its contents into the export parameter. It was then compiled and made available through the extrnc.lib.