HP 3000 Manuals

ALIAS [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation


HP Pascal/iX Reference Manual

ALIAS 

ALIAS is an HP Pascal Option.

The ALIAS compiler option specifies an external name for a procedure,
function, or global variable.

Syntax 

     $ALIAS string$

Parameter 

string        The external name.  The compiler does not distinguish
              between uppercase and lowercase letters.  By default, the
              external name is downshifted.  The LITERAL_ALIAS compiler
              option allows the external name to remain as it is.  The
              UPPERCASE compiler option upshifts the external name.

Default       The internal name, downshifted (or upshifted if UPPERCASE
              is ON).

Location        Routine:         Heading.

              Global           Immediately after the variable name in the
              variable:        variable declaration.

When a routine has both internal and external names, the program
recognizes its internal name and the operating system recognizes its
external name.


NOTE For global variables, the HP Pascal options EXTERNAL or GLOBAL must be included or the ALIAS option is ignored. Also, routines must be level 1 or the ALIAS option is ignored.
The reasons to use the ALIAS option are: * To define multiple internal names for a single external procedure. * To access a library or system routine that has an illegal (external) name, by giving it a legal internal name. Example 1 $GLOBAL$ PROGRAM p (input,output); VAR global_var $ALIAS 'gvar'$ : integer; {global variable} PROCEDURE $ALIAS 'write'$ Writefile; EXTERNAL; {procedure} FUNCTION $ALIAS 'read'$ Readfile : char; EXTERNAL; {function} BEGIN . . . END. Example 2 PROGRAM show_alias; . . PROCEDURE $ALIAS 'intrinname'$ A; INTRINSIC; {One intrinsic } PROCEDURE $ALIAS 'intrinname'$ B; INTRINSIC; {has two internal} {names, A and B } . . PROCEDURE $ALIAS 'x''x'$ xx; INTRINSIC; {The intrinsic name} {x'x is illegal in Pascal} . . PROCEDURE proc1; FUNCTION $ALIAS 'D1'$ do_it (n : INTEGER): BOOLEAN; BEGIN {do_it} . . END; {do_it} BEGIN {proc1} . . END; {proc1} PROCEDURE proc2; FUNCTION $ALIAS 'D2'$ do_it (a,b : INTEGER): INTEGER; BEGIN {do_it} . . END; {do_it} BEGIN {proc2} . . END; {proc2} BEGIN {show_alias} . . END. {show_alias} Example 3 PROGRAM show_alias; FUNCTION $ALIAS 'f'$ f1 (p1 : integer); EXTERNAL; FUNCTION $ALIAS 'f'$ f2 (p1,p2 : integer); EXTERNAL; BEGIN . . . END. Notice that the function f1 declares one parameter of the function f, while the function f2 declares two.


MPE/iX 5.0 Documentation