HP Pascal/iX Programmer's Guide (31502-90023)

4: 8
(which has no program header) to use
stderr
. Importing the stderr module
into an independent module is the same as declaring
stderr
in the program
header of a program.
The content of the predefined module stderr is:
VAR
stderr : text;
The predefined module stderr is only available on the HP-UX operating
system.
The main use of stdinput, stdoutput, and stderr is to allow a module to
perform a read or write operation to either standard input files,
standard output files, or, on HP-UX, standard error files. The module
must import the corresponding stdinput, stdoutput, or stderror modules,
and the program must have input, output, or stderr in the program header.
A main program does not need to import these standard modules, but the
corresponding program parameter must be present in the program header.
The following example shows a program importing a module that imports
stdinput, stdoutput, and, on HP-UX, stderr.
MODULE A;
EXPORT
Procedure getnum (var n:integer);
IMPLEMENT
IMPORT
stdinput, stdoutput, stderr;
Procedure getnum (var n: integer);
BEGIN
Writeln ('Enter a positive number') {Writes to output.}
Readln (n); {Reads from input.}
IF n < 0 THEN
Writeln (stderr, 'Incorrect input') {Writes to stderr.}
END;
END.
The program below shows how module A is imported. It is compiled into
file A.o. The program parameters input, output, and stderr must be
present since module A imports them. arg and pas_hp1000 do not need to
be present if they are imported.
Program Test (input, output, stderr);
$search 'A.o'$ { search A.o for module A }
IMPORT A:
VAR
m : integer;
BEGIN
getnum(m);
.
.
.
END.
arg
The arg module contains routines that access HP-UX command line
arguments. (It also contains the types that these routines use, but only
the routines are presented here.)
The routines in the predefined module arg are:
Routine Effect and Declaration
argc Returns the total number of arguments to the program (the
name of the program is considered to be the first
argument).