HP 3000 Manuals

How to Build or Change an Intrinsic File [ HP Pascal/iX Programmer's Guide ] MPE/iX 5.0 Documentation


HP Pascal/iX Programmer's Guide

How to Build or Change an Intrinsic File 

You can build an intrinsic file, or change an existing intrinsic file,
with the BUILDINT compiler option and the EXTERNAL directive.

To build a new intrinsic file:

   1.  Put the BUILDINT option at the front of the compilation unit.
       Specify a new name for your intrinsic file--do not give it the
       name of an existing file.  (Refer to the HP Pascal/iX Reference 
       Manual or the HP Pascal/HP-UX Reference Manual, depending on your
       implementation, for more information on BUILDINT.)

   2.  Declare the constants, types, and variables that will appear in
       your intrinsic routines headings.

   3.  Declare your intrinsics as you would declare external routines
       (explained in Chapter 9 ), except:

          *   Use only the acceptable intrinsic parameter types listed in
              "Defining Intrinsics" .

          *   Use only these forms of the EXTERNAL directive:

            EXTERNAL
            EXTERNAL C
            EXTERNAL COBOL
            EXTERNAL FTN77

   4.  Leave the outer block of the compilation unit empty.

Example 1 

This program builds an intrinsic file.

     $BUILDINT 'myintr'$
     $STANDARD_LEVEL 'EXT_MODCAL'$

     PROGRAM build_intrinsic_file;

     TYPE
        t_integer_1 = $ALIGNMENT 1$ integer;  {allows byte-aligned integer}

        t_barray = PACKED ARRAY [1..1024] OF CHAR;

        t_status = RECORD
                      f1 : shortint;
                      f2 : shortint;
                   END;

     PROCEDURE proc1 (    i : integer;
                      VAR b : integer
                     );
                     EXTERNAL;

     PROCEDURE proc2 (ANYVAR $EXTNADDR$ parm1 : t_barray;
                                        parm2 : shortint
                     )
                     OPTION DEFAULT_PARMS (parm1 := NIL,
                                           parm2 := 0
                                          )
                     UNCHECKABLE_ANYVAR;
                     EXTERNAL;

     PROCEDURE proc3 (    parm1 : integer;
                      VAR parm2 : t_status
                     )
                     OPTION EXTENSIBLE 1;
                     EXTERNAL;

     PROCEDURE cob_proc (VAR i : t_integer_1); EXTERNAL COBOL;

     BEGIN
     {empty body}
     END.

To change an existing intrinsic file:

   1.  Put the BUILDINT option at the front of the compilation unit.
       Specify the name of the intrinsic file that you want to change.

   2.  Declare any new constants, types, or variables that will appear in
       new or changed intrinsic routines headings.

   3.  Declare any new intrinsic routines (see the third instruction for
       building an intrinsic file).  If a new routine has the same name
       as one that is already in the file, the new one replaces the old
       one; otherwise, the new one is added to the file.

   4.  Leave the outer block of the compilation unit empty.

Example 2 

This program changes the intrinsic file that the preceding example built,
replacing the procedure proc1 and adding the function func1.

     $BUILDINT 'myintr'$
     $STANDARD_LEVEL 'EXT_MODCAL'$

     PROGRAM change_intrinsic_file;
     PROCEDURE proc1 (    i : shortint;
                      VAR b : shortint;
                      VAR c : integer;
                     );
                     EXTERNAL;

     FUNCTION func1 (p : integer) : shortint; EXTERNAL;

     BEGIN
     {empty body}
     END.

To list an intrinsic file that you have built, use the compiler option
LISTINTR (for information on compiler options, refer to the HP Pascal/iX 
Reference Manual or the HP Pascal/HP-UX Reference Manual, depending on
your implementation.



MPE/iX 5.0 Documentation