Once you finish the coding for an application, you must prepare it for use. Then it can be executed.
11.1.1 Compiling
When you compile an application, Empress 4GL starts creating
the internal p-code which is used to run the application. Then,
the results of this phase are stored in the sys_4gl_compile table
in the database. To perform this compilation, you can use one of several
ways.
You can compile the application from the Empress 4GL development application. In the Application window, function keys and a pop-up Tables Menu are available. Once you select the function to compile the application, a small window will indicate that the compile is taking place.
Compiling can also be done from the shell by using the -c option for the emp4gl command. Select the -c option and the names of the applications you would like to compile, and the compile will take place.
To link applications, use the menus within the application or the -l option for emp4gl.
Errors can be displayed within the development application in one of two ways. If the application window is active, use the Errors function to display a window with a list of the errors from the most recent compile or link. However, you must remove this window in order to edit the application and change the code.
In the Application window for the application, the Errors function allows the first error Empress 4GL encounters to appear in a window at the bottom of the screen. This window remains at the bottom of the screen until you exit the application, press the Errors function again, or receive a successful compile or link. Therefore you can see the error while you find the correct script and change it.
The most common errors at compile time are syntax errors and omissions on definitions (for example, forgetting the coordinates for a window). Common link errors include references to forms that are not in any of the applications, and duplicate items.
First, you can use the menus in the development application. If compile and link are options, run is usually an option as well.
However, the most common method of running an application when it is in production is from another application, like a menu. To do this, use the CALL APPLICATION command in the Empress 4GL script language.
You must still have a method to start up the menu application from the shell. To do this, specify the application name as an argument for the emp4gl command. If you name an application, Empress 4GL will go into runtime mode and execute the application.
Runtime mode differs from Empress 4GL's full mode in that the development application and debugger are not included in the runtime mode. This helps the production versions of applications to load more quickly, run more quickly, and use less memory.
Another option for the emp4gl command is the -p option. The -p option requires an application name as an argument. The application is then pre-retrieved so that it will not take as long to load when it is called. This is very useful for a set of applications that are grouped together with a menu application as the front end. You can call the menu application first with all the other pre-retrieved applications so that it is faster to switch from one application to another.
This provides an application which is faster to load and run than using the p-code version.
To call an application that has been built into an executable, run the executable as a normal program. It will have an option to pass a database name (-d option) and an application name (-a option).
The database that is passed will become the default database for the applications. If you do not specify a database, there will be no default unless the application sets one.
The application parameter is the name of the application that is to be started (since there can be many in one executable). If it is left "off", the first parameter in the emp4bldx command will be executed.