External Preprocessors
An External Preprocessor is an executable file that takes two parameters as input:
<input-file>, <output-file> |
The preprocessor analyzes the input file named <input-file> and produces an output file named <output-file>.
To integrate an External Preprocessor in the isCOBOL IDE Builder, the user has to select the project in the
isCOBOL Explorer View, right-click on it and select the menu-item 'Properties'. A dialog will be opened.
Expand 'isCOBOL Settings' and select the item 'Compile/Runtime options' in the list on the left of the dialog and check the option 'Use External Preprocessor'. The 'Configure' button will become enabled. Click on it to open the 'Preprocessor Configuration' dialog. In this dialog the user can select the executable program from his file system, clicking on the 'Browse' button.
The user can also set any necessary environment variables. The user can add, remove or edit these variables using the 'New', 'Edit' and 'Remove' buttons on the right side of the dialog.
The user is able to configure a particular Preprocessor for a single file inside his project's source folder. To do this, right-click on the file and select 'Properties -> Compiler options'.
When the isCOBOL IDE Builder is configured to integrate an external Preprocessor, it executes the following steps for each file inside the project's source folder that needs to be compiled:
1. As explained above, the isCOBOL IDE Builder assumes that the program set as Preprocessor takes two parameters in as input: the name of the input file and the name of the output file. The Builder checks whether or not a Preprocessor has been set for the specified file for the project and executes it passing the name of the source file as the input file name, and the name generated as follows as the output file name:
a. <project-location>/translated/<input-file-name-without-extension>.cbl
b. The extension of the original file is replaced with the 'cbl' extension.
c. The input file name is a path relative to the project's source folder.
d. The output file name is an absolute path.
e. In this way, the Preprocessor program creates the output file inside a standard project's folder named 'translated'. The 'translated' folder is created automatically if it does not exist.
2. The Builder checks whether or not the exit code of the Preprocessor program is equal to 0 (OK) and whether or not the output file has been created.
3. The Builder compiles the output file in the 'translated' folder and puts the output of compilation (.class and|or .java files) into the project's output folder.
The working directory of the executed Preprocessor program is the project's source folder.
The standard output/error streams of the Preprocessor program are redirected to the Eclipse 'Console' view.
If the program does not exist or cannot be executed, the Builder will add an entry to the 'Error Log' or 'Problems' view.
The compiler errors and their line numbers are related to the output file generated by the Preprocessor program.
The user is able to directly compile only the files inside the project's source folder, not those inside the 'translated' folder. These files are only the output of the Preprocessor, and they should be used only for debugging. For these reasons, an error message will be shown if the user assigns the 'translated' name to the source folder in the project's properties.
When the original source file contains some EXEC statements, the isCOBOL syntax checker does not recognize them. For this reason, a number of errors may be shown when the user opens the file.
To avoid this problem, the user should check the '-noexec' compiler option in the project's properties. Setting this option, the syntax checker will skip all EXEC statements.