| Previous | Contents | Index |
The HP MACRO output routine produces declarations that can generate either local symbol or global symbol definitions. The following is an example of HP SDL source code:
MODULE simple; CONSTANT bits EQUALS 4; ITEM field BYTE PREFIX tst$ COMMON; END_MODULE; |
The following is the resulting HP MACRO output:
.MACRO simple,..EQU=<=>,..COL=<:>
bits'..equ'4
.SAVE
.PSECT tst$b_field PIC,OVR,REL,GBL,-
SHR,NOEXE,RD,WRT,LONG
tst$b_field'..col' <P>lkb 1
.RESTORE
; tst$b_field'..equ'0
.ENDM
|
When the macro is invoked without arguments, the resulting local definitions are as follows:
bits = 4 tst$b_field1: blkb 1 |
To generate these names as global symbols, invoke the macro with the arguments <= => and <::>, as follows:
simple ..EQU=<==> ..COL=<::> |
This invocation results in the following definitions:
bits == 4 tst$b_field1:: blkb 1 |
The HP MACRO output routine always generates a size variable for bitfields, aggregates, arrays, and character strings, using the tag S_ preceding the output identifier.
The /VMS_DEVELOPMENT qualifier on the SDL command produces special forms of macros for entry point declarations.
Note
name = offset-value |
Offset-value is the byte offset relative to the origin of the
level-1 aggregate. A constant assignment of the following form gives
the size in bytes for aggregates, arrays, and character strings:
prefix$_name = byte-size |
.SAVE .PSECT module_name_STRCONST PIC,CON,REL,NOEXE,GBL,SHR,RD,NOWRT,LONG $EQU S_x size $DEF x .ASCII /s/ .RESTORE |
.SAVE .PSECT module_name STRCONST PIC,CON,REL,NOEXE,GBL,SHR,RD,NOWRT,LONG S_x ..equ'size x'..col' .ASCII /s/ .RESTORE |
The following table shows the HP SDL to HP Pascal language translation summary.
| HP SDL Declaration | HP Pascal Output |
|---|---|
| MODULE name IDENT string | (*** MODULE name IDENT string ***) |
| Note that when /MODULE is used, a HP Pascal MODULE statement of the form MODULE name; is generated. | |
| /* comment | (* comment *) |
| CONSTANT x | |
| EQUALS n; | CONST x = n; |
| EQUALS STRING "s"; | CONST x = 's'; |
| ENTRY | [ASYNCHRONOUS] FUNCTION |
| [ASYNCHRONOUS] PROCEDURE | |
| PARAMETER (type,...) | (formal param_list) |
| ANY | %REF param-name: [UNSAFE] ARRAY [$l1..$u1:INTEGER] OF $UBYTE |
| DESCRIPTOR | [CLASS_S] for scalars; |
| [CLASS_S] for CHARACTER LENGTH 1; | |
| [CLASS_A] for nonscalars; | |
| %DESCR for fixed-length VARYING; | |
| RTL_STR_DESC | PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; |
| IN | Default semantics (unless overridden by OUT) |
| OUT (or IN OUT) | VAR, except for CHARACTER LENGTH * and ANY (which generate %REF) |
| NAMED param-name | Parameter name. If none is given, names will be generated of the form $P1,...$Pn. |
| VALUE | %IMMED |
| REFERENCE | %REF for CHARACTER LENGTH * and ANY; VAR for all others if mode OUT or IN OUT; otherwise (IN only) default mechanism |
| DEFAULT n | := %IMMED value |
| LIST | If OPTIONAL is not specified, generates one required parameter followed by a parameter with the [LIST] attribute; if OPTIONAL is specified, only the parameter with [LIST] is generated. |
| OPTIONAL | :=%IMMED 0 |
| TYPENAME type-name | n/a |
| RETURNS return-data-type | FUNCTION name : data-type; |
| NAMED param-name | n/a |
| VARIABLE | n/a |
| ALIAS internal-name | Results in [EXTERNAL (entry-name)] and internal-name being used as entry-name |
| LINKAGE | n/a |
| TYPENAME type-name | n/a |
| STRUCTURE | RECORD |
| UNION | RECORD CASE INTEGER OF |
| 0: ... | |
| . | |
| . | |
| n: ... | |
| BYTE [SIGNED ] | $BYTE--- [BYTE ] -128..127 |
| INTEGER _BYTE [SIGNED ] | $BYTE--- [BYTE ] -128..127 |
| WORD [SIGNED ] | $WORD--- [WORD ] -32768..32767 |
| INTEGER _WORD [SIGNED ] | $WORD--- [WORD ] -32768..32767 |
| LONGWORD [SIGNED ] | INTEGER |
| INTEGER _LONG [SIGNED ] | INTEGER |
| INTEGER [SIGNED ] | INTEGER |
| INTEGER _HW [SIGNED ] | $QUAD--- [QUAD,UNSAFE ]RECORD L0: UNSIGNED; L1: INTEGER; END for /ALPHA |
| INTEGER for /VAX | |
| HARDWARE _INTEGER [SIGNED ] | $QUAD for /ALPHA |
| $QUAD for /ALPHA, INTEGER for /VAX | |
| QUADWORD [SIGNED ] | $QUAD |
| INTEGER _QUADWORD [SIGNED ] | $QUAD |
| OCTAWORD [SIGNED ] | $OCTA--- [OCTA,UNSAFE ]RECORD L0,L1,L2: UNSIGNED; L3: INTEGER; END |
| BYTE UNSIGNED | $UBYTE--- [BYTE ] 0..255 |
| INTEGER _BYTE UNSIGNED | $UBYTE--- [BYTE ] 0..255 |
| WORD UNSIGNED | $UWORD--- [WORD ] 0..65535 |
| INTEGER _WORD UNSIGNED | $UWORD--- [WORD ] 0..65535 |
| LONGWORD UNSIGNED | UNSIGNED |
| INTEGER _LONG UNSIGNED | UNSIGNED |
| INTEGER UNSIGNED | UNSIGNED |
| INTEGER _HW UNSIGNED | $UQUAD--- [QUAD,UNSAFE ]RECORD L0,L1: UNSIGNED; END for /ALPHA |
| INTEGER for /VAX | |
| HARDWARE _INTEGER UNSIGNED | $UQUAD for /ALPHA |
| INTEGER for /VAX | |
| QUADWORD UNSIGNED | $UQUAD |
| INTEGER _QUADWORD UNSIGNED | $UQUAD |
| OCTAWORD UNSIGNED | $UOCTA--- [OCTA,UNSAFE ]RECORD L0,L1,L2,L3: UNSIGNED; END |
| F_FLOATING | SINGLE |
| D _FLOATING | DOUBLE (D _FLOAT $ $TYPE if the logical name SDLPASCAL $FLAG is defined) |
| G _FLOATING | DOUBLE (G _FLOAT $ $TYPE if the logical name SDLPASCAL $FLAG is defined) |
| H_FLOATING | QUADRUPLE |
| F_FLOATING COMPLEX | $UQAD |
| D_FLOATING COMPLEX | $UOCTA |
| G_FLOATING COMPLEX | $UOCTA |
| H_FLOATING COMPLEX | $UOCTAQUAD --[OCTA(2),UNSAFE]RECORD L0,L1,L3,L4,L5,L6,L7:UNSIGNED; END; |
| DECIMAL PRECISION (p,q) | PACKED ARRAY [1..p+2-mod(p,2)] OF $PACKED_DEC |
| $PACKED_DEC---[BIT(4),UNSAFE] 0..15 | |
| BITFIELD LENGTH n | $BIT1---[BIT(1), UNSAFE] BOOLEAN |
| $BIT n---[BIT( n),UNSAFE] 0..2**n-1 | |
| MASK | CONST prefixM_name = mask-value; |
| SIGNED | n/a |
| CHARACTER | CHAR |
| LENGTH n | PACKED ARRAY [1..n] OF CHAR |
| LENGTH * | PACKED ARRAY [$l..$u] OF CHAR |
| or VARYING [$m] OF CHAR (if VARYING is also specified) | |
| VARYING | VARYING [n] OF CHAR |
| or VARYING [$m] OF CHAR (if LENGTH * is also specified) | |
| ADDRESS (object-type) | ^object-type |
| If object type is not supplied, generates $DEFPTR, which is defined as ^ $DEFTYP; $DEFTYP is defined as [UNSAFE ] INTEGER | |
| POINTER (object-type) | ^object-type |
| If object type is not supplied, generates UNSIGNED | |
| POINTER _LONG (object-type) | ^object-type |
| If object type is not supplied, generates UNSIGNED | |
| POINTER _HW (object-type) | $QUAD for /ALPHA |
| INTEGER for /VAX | |
| HARDWARE _ADDRESS (object-type) | $QUAD for /ALPHA |
| INTEGER for /VAX | |
| POINTER _QUAD (object-type) | $QUAD |
| BOOLEAN | BOOLEAN |
| user-type-name | user-type-name |
| Default storage class | TYPE |
| COMMON storage class | [COMMON] |
| GLOBAL storage class | [EXTERNAL] |
| with /GLOBALDEF | [GLOBAL] |
| BASED pointer-name | TYPE pointer-name = structure-name |
| TYPEDEF | n/a |
| name DIMENSION [lbound:]hbound | ARRAY [lbound..hbound] OF data type; if lbound is not supplied, it defaults to 1 |
| ORIGIN member-name | n/a |
Notes
| Previous | Next | Contents | Index |