Compiling HP C/iX Programs [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Reference Manual
Compiling HP C/iX Programs
You can compile HP C/iX programs using the MPE/iX commands CCXL, CCXLLK
or CCXLGO, or by explicitly running the CCOMXL.PUB.SYS program.
CCXL Command
The CCXL command invokes the HP C/iX compiler and generates an object
file.
Syntax.
CCXL [textfile] [,[objectfile] [,[listfile]]] [;INFO="options"]
Parameters.
textfile is the source file that the HP C/iX compiler reads.
If omitted, the default is $STDIN.
objectfile is the relocatable object file to which the
compiler writes the object code. If omitted, the
default is $NEWPASS.
listfile is the listing file. If omitted, the default is
$STDLIST.
options are compiler options you want to take effect;
separate options with a blank. See "HP C/iX
Compiler Options" later in this chapter for
specific options.
Description.
If you omit textfile, the current input device, $STDIN, is used by
default. Typically, the terminal is the standard input device, and this
allows you to enter source code interactively. Indicate the end of the
interactive session by entering a colon (:).
If you omit listfile, the standard listing file, $STDLIST, is used by
default. Typically, a listing is sent to the terminal during a terminal
session or to the printer in a batch job. If listfile is a file other
than $STDLIST, the compiler writes errors and warnings to $STDLIST and
listfile.
Examples.
CCXL MYTEXT,,MYLIST
This example compiles the HP C/iX source file MYTEXT, puts the object
code in $NEWPASS (by default), and writes the list file to MYLIST.
CCXL MYTEXT,MYOBJ;INFO="-Ddebug -v"
This example compiles the source file MYTEXT, places the object code in
the file MYOBJ, sends the list file to the terminal, and passes two
options to the compiler. The -Ddebug option defines debug as if it were
defined using the #define preprocessor statement and has the value of 1.
The -v option echoes the different stages of processing the source file
goes through during compilation.
CCXLLK Command
The CCXLLK command invokes the HP C/iX compiler, generates an object
file, and links the object file with the HP C/iX library to produce an
executable program file.
Syntax.
CCXLLK [textfile] [,[programfile] [,[listfile]]] [;INFO="options"]
Parameters.
textfile is the source file that the HP C/iX compiler reads.
If omitted, the default is $STDIN.
programfile is the program file to which the linker writes the
linked program. If omitted, the default is
$NEWPASS.
listfile is the listing file. If omitted, the default is
$STDLIST.
options are compiler options you want to take effect;
separate options with a blank. See "HP C/iX
Compiler Options" later in this chapter for
specific options.
Description.
If you omit textfile, the current input device, $STDIN, is used by
default. Typically, the terminal is the standard input device, and this
allows you to enter source code interactively. You should indicate the
end of the interactive session by entering a colon (:).
If you omit listfile, the standard listing file, $STDLIST, is used by
default. Typically, a listing is sent to the terminal during a terminal
session or to the printer in a batch job. If listfile is a file other
than $STDLIST, the compiler writes errors and warnings to $STDLIST and
listfile.
Examples.
CCXLLK MYTEXT,MYPROG
This example compiles the source file MYTEXT, places the linked program
in MYPROG, and writes the list file to $STDLIST.
CCXLLK ,MYPROG,MYLIST;INFO="-Wc,-r"
This example compiles from $STDIN (by default), places the linked program
in MYPROG, writes the list file to MYLIST, and passes the -Wc,-r option
to the compiler.
CCXLGO Command
The CCXLGO command invokes the HP C/iX compiler, generates an object
file, links the object file with the HP C/iX library to produce an
executable program, and then runs the program.
Syntax.
CCXLGO [textfile] [,[listfile]] [;INFO="options"]
Parameters.
textfile is the source file that the HP C/iX compiler reads.
If omitted, the default is $STDIN.
listfile is the listing file. If omitted, the default is
$STDLIST.
options are compiler options you want to take effect;
separate options with a blank. See "HP C/iX
Compiler Options" later in this chapter for
specific options.
Description.
If you omit textfile, the current input device, $STDIN, is used by
default. Typically, the terminal is the standard input device, and this
allows you to enter source code interactively. You should indicate the
end of the interactive session by entering a colon (:).
If you omit listfile, the standard listing file, $STDLIST, is used by
default. Typically, a listing is sent to the terminal during a terminal
session or to the printer in a batch job. If listfile is a file other
than $STDLIST, the compiler writes errors and warnings to $STDLIST and
listfile.
CCXLGO has the side effect of creating a temporary program file named
$NEWPASS.
Example.
CCXLGO MYTEXT,$NULL
This example compiles the HP C/iX source file MYTEXT without listing it
to the terminal, links and runs the resulting program, and places the
linked program in $NEWPASS. If $NULL is omitted, the compilation listing
appears on the screen.
RUN CCOMXL.PUB.SYS
You can also compile HP C/iX programs using the MPE RUN command. The HP
C/iX compiler is located in the program file CCOMXL in the PUB group of
the SYS account. The compiler uses the default files unless you override
the default values. To override the default values you needed to perform
the following steps:
1. Equate the file you want to substitute for the default file with
its formal file designator using the MPE FILE command.
2. Select an appropriate value of the PARM parameter of the RUN
command. This value indicates which files are not defaulted.
The HP C/iX compiler recognizes the following default files and formal
file designators:
Table 8-1. Default Files and Designators
-----------------------------------------------------------------------------------------------
| | | |
| File Type | Default | Designator |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| Source | $STDIN | CCTEXT |
| | | |
| Object | $NEWPASS | CCOBJ |
| | | |
| List | $STDLIST | CCLIST |
| | | |
-----------------------------------------------------------------------------------------------
The PARM parameter of the RUN command indicates which files have been
equated. This directs the compiler to use these files instead of the
default files. The RUN command takes a PARM parameter with an integral
value in the range 0 to 7. The low-order three bits of the PARM value
represent the source, object, and list files as shown in the following
diagram.
Bit 29 Bit 30 Bit 31
----------------------------------------
| object | listing | source |
----------------------------------------
The integral value sets the low-order bits as shown in the following
table.
Table 8-2. Low-order Bit Values
-------------------------------------------------
| | |
| Value | Files in FILE Commands |
| | |
-------------------------------------------------
| | |
| 0 | None |
| | |
| 1 | Source |
| | |
| 2 | Listing |
| | |
| 3 | Listing, source |
| | |
| 4 | Object |
| | |
| 5 | Object, source |
| | |
| 6 | Object, listing |
| | |
| 7 | Object, listing, source |
| | |
-------------------------------------------------
An error occurs if you use a PARM value that sets a bit for a file for
which no file equation exists. If a file equation exists, but the bit is
not set in the PARM value, the compiler uses the default value.
The RUN command also has an optional INFO parameter. You can use this
parameter to pass options, delimited with blanks, to the compiler.
Example.
FILE CCTEXT = MYFILE
FILE CCLIST = MYLIST
RUN CCOMXL.PUB.SYS;PARM=3;INFO="-O"
This example compiles the file MYFILE, places the object code in $NEWPASS
(the default), writes the listing to MYLIST, and passes the -O option to
the compiler.
MPE/iX 5.0 Documentation