General Preprocessor Interface

ACUCOBOL-GT includes a general preprocessor interface that allows you to connect preprocessors to the ACUCOBOL-GT compiler. A preprocessor is a program designed to take application source code and preprocess it before compilation into an executable object. In the case of ACUCOBOL-GT, the conforming preprocessors should be designed to translate source code written in a variety of COBOLs into ACUCOBOL-GT.

The preprocessor interface in ACUCOBOL-GT has two general functions: (1) To invoke a preprocessor from the Compiler and then have the compiler process the resultant expanded COBOL; and (2) to signal the compiler that there are fatal errors in the preprocessor and therefore the compiler should not be run.

The interface is designed to accommodate a wide variety of preprocessors and to work on every platform supported by ACUCOBOL-GT. It is designed to call preprocessors as chained programs (instead of linking them into the ACUCOBOL-GT compiler) for three reasons:

  1. You can develop and debug preprocessors without access to the ACUCOBOL-GT compiler.
  2. You can invoke preprocessors directly from the command line.
  3. The stand-alone design gives much better portability among platforms.

The general preprocessor interface can be used with any preprocessor that conforms to the requirements of the interface. Most preprocessors will be written in ACUCOBOL-GT or C/C++, but preprocessors can be written in any language that produces an executable object file that can read and write text files and accept command-line arguments.

The specific preprocessors that will be used with ACUCOBOL-GT will be written by you, the user. The ACUCOBOL-GT general preprocessor interface supports many features that you can build into your preprocessor to best handle the job at hand. They include:

The use of conforming preprocessors is described in Use of Preprocessors. Writing conforming preprocessors is discussed in Writing a Preprocessor. The use of the AcuSQL pre-compiler is discussed in AcuSQL Pre-compiler.

Source code for a sample preprocessor written in ACUCOBOL-GT is available for your reference on the Web at http://supportline.microfocus.com/examplesandutilities/index.asp. Select ACUCOBOL-GTĀ® Samples > General Programming Techniques > ansi2term.zip .