Guide to the HP Structure Definition Language


Previous Contents Index


Appendix B
HP SDL Language Translation Summaries

This appendix shows the translation summaries of HP SDL language elements to their corresponding output in each of the following supported languages:


HP Ada Translation Summary

The following table shows the HP SDL to HP Ada language translation summary.
HP SDL Declaration HP Ada Output
MODULE name IDENT string - - module name IDENT string
/* comment - - comment
CONSTANT x  
EQUALS n; x : constant := n ;
EQUALS STRING "s"; x : constant STRING := "s";
ENTRY name procedure name
  (parameter-list ...);
  pragma INTERFACE (EXTERNAL, name);
  pragma IMPORT_VALUED_PROCEDURE
  (name,"name",)
  (type,...),
  (passing-mechanism,...);
PARAMETER (type,...) parameter-name : type;
  .
  .
  .
ANY UNSIGNED_LONGWORD ;
DESCRIPTOR Generates the DESCRIPTOR passing mechanism name in the IMPORT_VALUED_PROCEDURE pragma for the parameter.
RTL_STR_DESC Generates the DESCRIPTOR passing mechanism name in the IMPORT_VALUED_PROCEDURE pragma for the parameter.
IN Causes the IN parameter mode to appear on the formal parameter.
OUT Causes the OUT parameter mode to appear on the formal parameter.
NAMED param-name Parameter name. If none exists, names will be generated of the form PARAMETER_1 ... PARAMETER_n.
VALUE Generates the VALUE passing mechanism name in the IMPORT_VALUED_PROCEDURE pragma for the parameter.
REFERENCE Generates the REFERENCE passing mechanism name in the IMPORT_VALUED_PROCEDURE pragma for the parameter.
DEFAULT n If DEFAULT = 0, see the table at the end of this section for the initial values of each HP SDL data type. If the parameter contains the VALUE attribute and the default value is other than 0, that := value is added to the parameter.
LIST Generates 10 formal parameters of the type of the parameter being described. If optional is not specified, all but the first of the corresponding parameter specifications contain a default expression of the form type'NULL_PARAMETER. If optional is specified, all 10 parameter specifications contain the default expression. An appropriate entry for FIRST_OPTIONAL_PARAMETER is generated.
OPTIONAL Generates a parameter specification containing a default expression of the form type'NULL_PARAMETER. If mode is OUT (or IN OUT), an additional parameter specification is generated to allow for use as an output parameter. An appropriate entry for FIRST_OPTIONAL_PARAMETER is generated.
TYPENAME type-name Specifies a non-SDL keyword data type to be used as the parameter type.
RETURNS return-data-type The first parameter in the parameter list is the return parameter. A comment of the form '- - return value' is placed beside the return parameter.
NAMED param-name Specifies the name of a parameter in the IMPORT_VALUED_PROCEDURE argument list that receives the return value.
VARIABLE n/a
ALIAS internal-name The internal-name is used instead of the entry name as the identifier associated with the entry point.
LINKAGE n/a
TYPENAME type-name Specifies a non-SDL keyword data type to be used as the entry type.
STRUCTURE A HP Ada record type is generated as well as a record representation clause and an initialization constant for the record. If any substructures exist, the record types for those structures are generated first. Following this table, see the note on structures for a discussion of structure to HP Ada record translation.
UNION A HP Ada record type is generated depending on the union. See the notes following this table for a discussion of union translations.
BYTE [SIGNED ] INTEGER _8
INTEGER _BYTE [SIGNED ] INTEGER _8
WORD [SIGNED ] INTEGER _16
INTEGER _WORD [SIGNED ] INTEGER _16
LONGWORD [SIGNED ] INTEGER _32
INTEGER _LONG [SIGNED ] INTEGER _32
INTEGER [SIGNED ] INTEGER _32
QUADWORD [SIGNED ] UNSIGNED _QUADWORD
INTEGER _QUAD [SIGNED ] UNSIGNED _QUADWORD
INTEGER _HW [SIGNED ] INTEGER _64 for /ALPHA
  INTEGER _32 for /VAX
HARDWARE _INTEGER [SIGNED ] INTEGER _64 for /ALPHA
  INTEGER _32 for /VAX
OCTAWORD UNSIGNED _LONGWORD _ARRAY(0 .. 3)
BYTE UNSIGNED UNSIGNED _BYTE
INTEGER _BYTE UNSIGNED UNSIGNED _BYTE
WORD UNSIGNED UNSIGNED _WORD
INTEGER _WORD UNSIGNED UNSIGNED _WORD
LONGWORD UNSIGNED _LONGWORD
INTEGER _LONG UNSIGNED UNSIGNED _LONGWORD
INTEGER UNSIGNED UNSIGNED _LONGWORD
QUADWORD UNSIGNED UNSIGNED _QUADWORD
INTEGER _QUAD UNSIGNED UNSIGNED _QUADWORD
INTEGER _HW UNSIGNED UNSIGNED _QUADWORD for /ALPHA
  UNSIGNED _LONGWORD for /VAX
HARDWARE _INTEGER UNSIGNED UNSIGNED _QUADWORD for /ALPHA
  UNSIGNED _LONGWORD for /VAX
OCTAWORD UNSIGNED UNSIGNED _LONGWORD _ARRAY(0 .. 3)
F_FLOATING F_FLOAT
D_FLOATING D_FLOAT
G_FLOATING G_FLOAT
H_FLOATING LONG_LONG_FLOAT
F_FLOATING COMPLEX F_FLOATING_COMPLEX
D_FLOATING COMPLEX D_FLOATING_COMPLEX
G_FLOATING COMPLEX G_FLOATING_COMPLEX
H_FLOATING COMPLEX H_FLOATING_COMPLEX
DECIMAL PRECISION (p,q) This data type has not yet been implemented. A comment appears in the output, and a message is printed to this effect.
   
BITFIELD BOOLEAN (one bit)
LENGTH n UNSIGNED _n if n > 1; BOOLEAN if n = 1 for /ALPHA
  BIT _ARRAY (0..n-1) for /VAX
MASK prefix_M_name : constant : = 16#mask-value#;
SIGNED n/a
CHARACTER CHARACTER
LENGTH n STRING(1 .. n) if n > 1
LENGTH * STRING
VARYING UNSIGNED_WORD field for the string length is generated if VARYING is specified; n/a in parameter context
ADDRESS ADDRESS
POINTER ADDRESS
POINTER _LONG ADDRESS
POINTER _HW UNSIGNED _QUADWORD for /ALPHA
  ADDRESS for /VAX
HARDWARE _ADDRESS UNSIGNED _QUADWORD for /ALPHA
  ADDRESS for /VAX
POINTER _QUAD UNSIGNED _QUADWORD
BOOLEAN BOOLEAN
user-type-name user-type-name_TYPE
Default storage class n/a
COMMON storage class n/a
GLOBAL storage class n/a
BASED pointer-name n/a
TYPEDEF For an ITEM, a subtype definition is generated. For an AGGREGATE, the behavior is as though TYPEDEF had not been specified.
DIMENSION [lbound]:hbound If other than a BITFIELD data type, append '_ARRAY (lbound .. hbound)' to the type.
  For BITFIELDS, a BIT_ARRAY is generated of the form BIT_ARRAY(0 .. hbound*length-1). If lbound is not supplied, it defaults to 1.
ORIGIN member-name n/a

Notes

  1. HP Ada Names
    Dollar signs ($) are illegal in HP Ada names and are replaced with underscores (_).
  2. Union Criteria
    If the union has the following form, it is treated as a record type:


    A ... union; 
    ITEM_1 ...;           /* First member is not a union or 
                             a structure, and the size of the 
                             first member is the same as the 
                             size of the union. 
    ITEM_2 structure ...; /* Second member is a structure, 
                             and the size of the first member 
                             is the same as the size of the 
                             union.  (Needed so size based 
                             on structure components is 
                             correct.) 
                I_2_A ...; 
                I_2_B ...; 
                ... 
               end ITEM_2; 
               ITEM_3 ...; 
               ... 
               end A; 
    

    If the union does not have the form shown in the previous example, the union is ignored and only the first member is used.


             Example 1 - Criteria are satisfied: 
             --------- 
     
                 aggregate X prefix XXX$; 
                     X_1 longword unsigned; 
                     X_2_OVERLAY union; 
                         X_2 longword unsigned; 
                         X_2_FIELDS structure; 
                             X_2_B_1 byte unsigned; 
                             X_2_B_2 byte unsigned; 
                         end X_2_FIELDS; 
                         X_2_C word unsigned; 
                         X_2_D structure; 
                             X_2_D_1 bitfield(3); 
                             X_2_D_2 bitfield; 
                         end X_2_D; 
                    end X_2_OVERLAY; 
                 end X; 
    

    The union X_2_OVERLAY satisfies the criteria in the previous example and would be treated as a record declaration. Source code similar to the following would be generated:


                 type XXX_X_2_TYPE is record 
                     X_2_B_1 : BYTE; 
                     X_2_B_2 : BYTE; 
                     end record; 
                 type XXX_X_2_D_TYPE is record 
                     X_2_D_1 : FLAGS(1 .. 3); 
                     X_2_D_2 : BOOLEAN; 
                     end record; 
                 type XXX_TYPE is record 
                     X_1 : LONGWORD; 
                     X_2 : XXX_X_2_TYPE; 
     
                 ----X_2_C overlaps X_2 
                 ---- 
                 ----X_2_C : UNSIGNED_16; 
     
                 ----X_2_D overlaps X_2 
                 ---- 
                 ----X_2_D : XXX_X_2_D_TYPE; 
                     end record; 
    


             Example 2 - Criteria are not satisfied 
             --------- 
                 aggregate Y prefix YYY$; 
                     Y_1 longword unsigned; 
                     Y_2_OVERLAY union; 
                         Y_2_A byte unsigned; 
                         Y_2_B byte unsigned; 
                     end Y_2_OVERLAY; 
                 end Y; 
    

    In the previous example, the second member is not a structure, and the following source code would be generated:


                 type YYY_TYPE is record 
                     Y_1 : LONGWORD; 
                     Y_2_A : BYTE; 
                 ----Y_2_B overlaps Y_2_A 
                 ---- 
                 ----Y_2_B : BYTE; 
                     end record; 
    

  3. IN and OUT Parameter Modes
    If the mode is not explicitly given for a parameter, the default mode (IN) appears.
  4. OPTIONAL Parameters
    An entry for FIRST_OPTIONAL_PARAMETER is generated, naming the first trailing optional parameter, if one exists. The appropriate signatures are generated for OPTIONAL OUT (or IN OUT) parameters to allow for any valid combination of actual parameters to be specified.
  5. DEFAULT Values
    DEFAULT generates a default expression in the parameter specification.
    The following is a list of HP SDL data types and the default HP Ada values for the INITIALIZATION constant.
    HP SDL Data Type HP Ada INITIALIZATION
    BYTE [SIGNED ] 0
    INTEGER _BYTE [SIGNED ] INTEGER _8 _ZERO
    WORD [SIGNED ] 0
    INTEGER _WORD [SIGNED ] INTEGER _16 _ZERO
    LONGWORD [SIGNED ] 0
    INTEGER _LONG [SIGNED ] INTEGER _32 _ZERO
    INTEGER [SIGNED ] INTEGER _32 _ZERO
    INTEGER _HW [SIGNED ] INTEGER _64 _ZERO for /ALPHA
      INTEGER _32 _ZERO for /VAX
    HARDWARE _INTEGER [SIGNED ] INTEGER _64 _ZERO for /ALPHA
      INTEGER _32 _ZERO for /VAX
    QUADWORD [SIGNED ] (0, 0)
    INTEGER _QUAD [SIGNED ] UNSIGNED _QUADWORD _ZERO
    OCTAWORD [SIGNED ] (0, 0, 0, 0)
    BYTE UNSIGNED 0
    INTEGER _BYTE UNSIGNED UNSIGNED _BYTE _ZERO
    WORD UNSIGNED 0
    INTEGER _WORD UNSIGNED UNSIGNED _WORD _ZERO
    LONGWORD UNSIGNED 0
    INTEGER _LONG UNSIGNED UNSIGNED _LONGWORD _ZERO
    INTEGER UNSIGNED UNSIGNED _LONGWORD _ZERO
    INTEGER _HW UNSIGNED UNSIGNED _QUADWORD _ZERO for /ALPHA
      UNSIGNED _LONGWORD _ZERO for /VAX
    HARDWARE _INTEGER UNSIGNED UNSIGNED _ZERO for /ALPHA
      UNSIGNED _LONGWORD _ZERO for /VAX
    QUADWORD UNSIGNED (0, 0)
    INTEGER _QUAD UNSIGNED UNSIGNED _QUADWORD _ZERO
    OCTAWORD [SIGNED ] (0, 0, 0, 0)
    CHARACTER ASCII.NUL
    DECIMAL PRECISION (p,s) NYI_PACKED_DECIMAL_ZERO
    F_FLOATING 0.0
    F_FLOATING_COMPLEX F_FLOATING_COMPLEX_ZERO
    D_FLOATING 0.0
    D_FLOATING_COMPLEX D_FLOATING_COMPLEX_ZERO
    G_FLOATING 0.0
    G_FLOATING_COMPLEX G_FLOATING_COMPLEX_ZERO
    H_FLOATING 0.0
    H_FLOATING_COMPLEX H_FLOATING_COMPLEX_ZERO
    ADDRESS ADDRESS _ZERO
    POINTER ADDRESS _ZERO
    POINTER _LONG ADDRESS _ZERO
    POINTER _HW UNSIGNED _QUADWORD _ZERO for /ALPHA
      ADDRESS _ZERO for /VAX
    HARDWARE _ADDRESS UNSIGNED _QUADWORD _ZERO for /ALPHA
      ADDRESS _ZERO for /VAX
    POINTER _QUAD (0, 0)
  6. Structure of HP Ada Record Translation
    For each HP SDL structure, the corresponding HP Ada translation consists of three parts: 1) a record type definition, 2) a record representation clause, and 3) an initialization constant for the record. The three parts have the following form:


    Previous Next Contents Index