fglcomp

The fglcomp tool compiles .4gl source files into .42m p-code modules.

Syntax

fglcomp [options] module[.4gl] [...]
  1. options are described in Table 1.
  2. module.4gl is the program source file. The .4gl extension is optional.
  3. fglcomp can take several .4gl sources files as arguments.

Options

Table 1. fglcomp options
Option Description
-V or --version Display version information for the tool.
-h or --help Display options for the tool. Short help.
-i { mbcs } Display information. -i mbcs displays information about multibyte character set settings. See Multibyte character sets (MBCS).
-S Dump Static SQL statements found in the source to stdout.
-m Extract %"string" localized strings from source to stdout.
-M Write error messages to standard output instead of creating a .err error file.
-W warning-argument Produce warning messages.

The warning argument can be used as follows:

  • -W all enables all warning flags.
  • -W error makes the compiler stop, if any warning is raised, as if an error occurred.
  • -W to-err-file writes warnings to the .err file when this file is produced. By default warnings go to the stderr stream.
  • -W unused displays a message for all unused variables.
  • -W return displays a warning if the same function returns different number of values with several RETURN statements.
  • -W stdsql displays a message for all non-portable SQL statements or language instructions.
  • -W print displays a message when the PRINT instruction is used outside a REPORT.
  • -W implicit warns on references to undeclared functions. A function is undeclared if not defined in the current module or in any imported module. This warning is silently ignored if IMPORT FGL is not used.
  • -W apidoc prints a warning for invalid source documentation tags when using the --build-doc option.
The -W option also supports the negative form of arguments by using the no- prefix as in: no-return, no-unused, no-stdsql. You might need to use these negative forms in order to disable some warning when using the -W all option:
fglcomp -Wall -Wno-stdsql customers.4gl

Switches will be enabled/disabled in the order of appearance in the command line.

-E Preprocess only. See Source preprocessor for more details.
--format [ options ] Reformat the .4gl module source with specified options. Here options can be one of:
  • --fo-inplace
  • --fo-column-limit=int
  • --fo-indent-width=int
  • --fo-continuation-indent-width=int
  • --fo-label-indent={0|1}
  • --fo-pack={0|1}
  • --fo-lowercase-keywords={0|1}
For more details, see Source code beautifier.
--timestamp Add compilation timestamp to build information in 42m header. See 42m module information.
--omit-source-name Omit the source file name in the build information of the 42m header. See 42m module information.
--tag=string Write a custom string in the build information of the 42m header. See 42m module information.
-p option

Preprocessing control, where option can be one of:

  • nopp: Disable preprocessing.
  • noli: No line number information (only with -E option).
  • fglpp: Use # syntax instead of & syntax.
--qualify-imports Parse the provided source file to add module prefixes to all imported symbols. See Qualifying imports for details.
-I path Provides a single path to search for include files. See Source preprocessor for more details.
-D ident[=value] Defines the macro 'ident' with an optional value (default is 1). See Source preprocessor for more details.
-U ident Undefines the macro 'ident'. See Source preprocessor for more details.
--build-doc Generate source documentation.
--doc-private When using the --build-doc option, include PRIVATE symbols to the documentation.
--build-rdd While compiling, generate the module.rdd Report Data Definition file (of REPORT routines).
--verbose Print detailed compilation information.
--implicit=type Specify whether or not to compile imported modules, if the .42m does not exist, or if the .4gl source is more recent as the .42m.

Here type can be one of:

-r or --resolve-calls

Throw an error on references to undeclared functions. Each external function must be made known to the compiler by IMPORT FGL. When using this option, the linking phase is no longer needed; a source (.4gl) file compiled with this option must not be linked. See IMPORT FGL module for more details.

--java-option=option

Passes Java runtime options when initializing the JNI interface.

See Java Interface for more details.

Usage

The fglcomp command line tool compiles a .4gl into a .42m p-code module:
fglcomp customers.4gl

If a compilation error occurs, the compiler generates an error file with an .err extension. The error file contains the original source code with error messages. Use the option -M to display the error messages to standard error instead of producing the .err file.