HP 3000 Manuals

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


HP Pascal/iX Reference Manual

GLOBAL 

GLOBAL is an HP Pascal Option.

The GLOBAL compiler option causes the compiler to generate code for the
entire compilation unit (including the outer block) and symbolic
information about global variables that allows them to be matched with
their counterparts in compilation units compiled with the EXTERNAL
compiler option.  See the HP Pascal/iX Programmer's Guide or the HP 
Pascal/HP-UX Programmer's Guide, depending on your implementation, for
more information.

Syntax 

$GLOBAL ['{PASCAL}']$
        [ {NONE  } ]
Parameters 

PASCAL        Causes the compiler to include type-checking information in
              the object file so that its global variables can be
              compared to those in a compilation unit that was compiled
              with $EXTERNAL 'PASCAL'$ (or its equivalent, $EXTERNAL$).

NONE          Prevents the compiler from emitting type-checking
              information for global variables.

Default       PASCAL.

Location      At front.

The GLOBAL option, in conjunction with the EXTERNAL option, enables you
to compile one program as two or more compilation units.  Specify the
GLOBAL option in the compilation unit that declares all of the global
variables and contains the main program.  Specify the EXTERNAL option in
each of the other compilation units (which declare routines and the
global variables that those routines use).  A compilation unit cannot
contain both the GLOBAL option and the EXTERNAL option.

Example 

One compilation unit:

     $GLOBAL$
     PROGRAM show_global (input,output);

     VAR
        a,b,c,d : integer;
        state : Boolean;

     PROCEDURE proc1; EXTERNAL;

     BEGIN                {Main program}
        .
        .
        .
     END.

Another compilation unit:

     $EXTERNAL$
     PROGRAM show_external (input,output);

     VAR
        state : Boolean;  {Matches variable in show_global's outer block}
                          {a,b,c,d need not be declared here because this
                           compilation unit does not use them.}
     PROCEDURE proc1;
     BEGIN
        .
        .
        .
     END;

     BEGIN
        {Empty outer block}
     END.



MPE/iX 5.0 Documentation