Section 6.1: A4GL compilers Up Chapter 6: Aubit4GL Compilers Section 6.3: 4glc  

6.2 4glpc

The 4glpc compiler is really just a wrapper around the 4glc, gcc, and esql/c compilers. The idea is that the type of each file passed on the command line is determined, as well as the output object type, and the relevant compilers are called in stages to generate that output. For example :
4glpc myprog.4gl -o myprog.4ae
Assuming we are compiling using A4GL_LEXTYPE=EC, then we know that we must :
For A4GL_LEXTYPE=C, we can just remove the myprog.ec -> myprog.c and generate myprog.c directly from the 4gl.
4glc has a synonym: a4glc which you can use when you want to exploit the shell history ! mechanism. e.g.
!a4
will cause the most recent command starting with a4 to be re-executed. (This is likely to be a4glc modname.4gl). If you try to use
!4g
instead, the shell with rerun the 4th command line from the history file.

6.2.1 Usage

Basic Aubit 4GL compiler usage
4glpc [options] -oOutFile.ext file.ext [file.ext...]
Extensions (.ext):
In files list, all .4gl files will be compiled to c or .ec etc as applicable , other files passed to linker.
The extension specified on the file passed to the ’-o’ flag will normally decide type of linking:
ao=object
aox=static library
aso=shared lib
4ae=executable.
Options
Option Meaning
-L Passed directly to the C compiler (specifies where libraries will be found)
-o Specify the output file
-c Compile only - no linking
-e Just generate the .c file
-I Passed directly to the C compiler (specifies where include files can be found)
-G or --globals Generate the globals map file
-S or --silent no output other then errors
-V or --verbose Verbose output (-V1.. -V5 for increasing levels of verbosity)
-N name Prefix all functions with name (default ’aclfgl_’)
--namespace name Same as -N option
-n or --noprefix remove any prefix from function names (= -N ’ ’)
-v or --version Show compiler version and exit
-f or --version_full Show full compiler version and details
-h or -? or --help Show this help and exit
-t TYPE or --lextype TYPE output language, TYPE=C(default), EC, WRITE, or PERL
-td TYPE or --lexdialect TYPE Specify the output language dialect for ESQL/C generation (INFORMIX or POSTGRES)
-k or --keep keep intermediate files (default)
-K or --clean clean intermediate files when done
-s[01] or --stack_trace [01] Include the stack trace in file: 0-Don’t generate 1-Generate(Default)
--use-shared/--use-static compile with shared libraries
-echo Don’t really compile (ignored for now)
-d dbname Specify an alternative database name to use for compilation
--database dbname same as -d option (note ignores that specified in the .4gl
-4 or --system4gl Used internally - Ignores any clashes with builtin library names
--map Generate an unload file with some 4GL code metrics
--as-dll Generate a shared library as the output type
--make-compile Compare file times and only recompile where required (very simplistic)
Examples:
$ 4glpc sourcefile.4gl -o executablename.4ge
$ 4glpc sourcefile.4gl -c -o objectname.o
$ 4glpc -shared file.4gl -o file.4ge
$ 4glpc -static -echo file.4gl -o file.4ge
$ 4glpc -debug file.4gl -o file.debug 4glpc -map -echo file.4gl
As a matter of interest - the 4glpc compiler itself is written in Aubit4GL.
The 4glpc compiler will use a number of configuration files ($AUBITDIR/tools/4glpc/settings) to control what commands will be used and what options will be passed to them. These will normally be setup correctly, but if you wish to change them (for example if you are porting to a new database backed, or a new platform), then you may need to know the order in which they are read.
This will depend on the A4GL_LEXTYPE, A4GL_LEXDIALECT, TARGET_OS, TARGET.
For an example, assume A4GL_LEXTYPE is set to EC,
A4GL_LEXDIALECT=POSTGRES, TARGET_OS=linux (this is set by the ./configure script at compile time), and TARGET=i686-pc-linux-gnu (this is also set by the ./configure)
Files will be read as :
tools/4glpc/settings/EC
tools/4glpc/settings/EC_POSTGRES
tools/4glpc/settings/linux
tools/4glpc/settings/linux__EC
tools/4glpc/settings/i686-pc-linux-gnu
tools/4glpc/settings/i686-pc-linux-gnu__EC
tools/4glpc/settings/i686-pc-linux-gnu__EC_POSTGRES
Settings in any later configuration file will overwrite those in any previous file. This gives the maximum configurability possible.
 Section 6.1: A4GL compilers Up Chapter 6: Aubit4GL Compilers Section 6.3: 4glc