home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gccdist / gcc / include / descrip.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-27  |  14.8 KB  |  372 lines

  1. /*
  2.  *    DESCRIP - VMS Descriptor Definitions
  3.  *    (Based on the VAX-11 Procedure Calling and Condition Handling Standard, Revision 9.0 [7-Dec-81])
  4.  */
  5.  
  6.  
  7. /*
  8.  *    General descriptor format - each class of descriptor consists of at least the following fields:
  9.  */
  10. struct    dsc$descriptor
  11.     {
  12.     unsigned short    dsc$w_length;    /* specific to descriptor class;  typically a 16-bit (unsigned) length */
  13.     unsigned char    dsc$b_dtype;    /* data type code */
  14.     unsigned char    dsc$b_class;    /* descriptor class code */
  15.     char        *dsc$a_pointer; /* address of first byte of data element */
  16.     };
  17.  
  18.  
  19. /*
  20.  *    Scalar or string descriptor:
  21.  */
  22. struct    dsc$descriptor_s
  23.     {
  24.     unsigned short    dsc$w_length;    /* length of data item in bytes,
  25.                          or if dsc$b_dtype is DSC$K_DTYPE_V, bits,
  26.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  27.     unsigned char    dsc$b_dtype;    /* data type code */
  28.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_S */
  29.     char        *dsc$a_pointer; /* address of first byte of data storage */
  30.     };
  31.  
  32.  
  33. /*
  34.  *    Dynamic string descriptor:
  35.  */
  36. struct    dsc$descriptor_d
  37.     {
  38.     unsigned short    dsc$w_length;    /* length of data item in bytes,
  39.                          or if dsc$b_dtype is DSC$K_DTYPE_V, bits,
  40.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  41.     unsigned char    dsc$b_dtype;    /* data type code */
  42.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_D */
  43.     char        *dsc$a_pointer; /* address of first byte of data storage */
  44.     };
  45.  
  46.  
  47. /*
  48.  *    Array descriptor:
  49.  */
  50. struct    dsc$descriptor_a
  51.     {
  52.     unsigned short    dsc$w_length;    /* length of an array element in bytes,
  53.                          or if dsc$b_dtype is DSC$K_DTYPE_V, bits,
  54.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  55.     unsigned char    dsc$b_dtype;    /* data type code */
  56.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_A */
  57.     char        *dsc$a_pointer; /* address of first actual byte of data storage */
  58.     char        dsc$b_scale;    /* scale multiplier to convert from internal to external form */
  59.     unsigned char    dsc$b_digits;    /* number of decimal digits in internal representation */
  60.     struct    {
  61.         unsigned         : 4;    /* reserved, must be zero */
  62.         unsigned dsc$v_fl_redim  : 1;    /* if set, indicates the array can be redimensioned */
  63.         unsigned dsc$v_fl_column : 1;    /* if set, indicates column-major order (FORTRAN) */
  64.         unsigned dsc$v_fl_coeff  : 1;    /* if set, indicates the multipliers block is present */
  65.         unsigned dsc$v_fl_bounds : 1;    /* if set, indicates the bounds block is present */
  66.         }    dsc$b_aflags;
  67.     unsigned char    dsc$b_dimct;    /* number of dimensions */
  68.     unsigned long    dsc$l_arsize;    /* total size of array in bytes,
  69.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  70.     /*
  71.      * One or two optional blocks of information may follow contiguously at this point;
  72.      * the first block contains information about the dimension multipliers (if present,
  73.      * dsc$b_aflags.dsc$v_fl_coeff is set), the second block contains information about
  74.      * the dimension bounds (if present, dsc$b_aflags.dsc$v_fl_bounds is set).  If the
  75.      * bounds information is present, the multipliers information must also be present.
  76.      *
  77.      * The multipliers block has the following format:
  78.      *    char    *dsc$a_a0;        Address of the element whose subscripts are all zero
  79.      *    long    dsc$l_m [DIMCT];    Addressing coefficients (multipliers)
  80.      *
  81.      * The bounds block has the following format:
  82.      *    struct    {
  83.      *        long    dsc$l_l;    Lower bound
  84.      *        long    dsc$l_u;    Upper bound
  85.      *        } dsc$bounds [DIMCT];
  86.      *
  87.      * (DIMCT represents the value contained in dsc$b_dimct.)
  88.      */
  89.     };
  90.  
  91.  
  92. /*
  93.  *    Procedure descriptor:
  94.  */
  95. struct    dsc$descriptor_p
  96.     {
  97.     unsigned short    dsc$w_length;    /* length associated with the function value */
  98.     unsigned char    dsc$b_dtype;    /* function value data type code */
  99.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_P */
  100.     char        *dsc$a_pointer; /* address of function entry mask */
  101.     };
  102.  
  103.  
  104. /*
  105.  *    Decimal scalar string descriptor:
  106.  */
  107. struct    dsc$descriptor_sd
  108.     {
  109.     unsigned short    dsc$w_length;    /* length of data item in bytes,
  110.                          or if dsc$b_dtype is DSC$K_DTYPE_V, bits,
  111.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  112.     unsigned char    dsc$b_dtype;    /* data type code */
  113.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_SD */
  114.     char        *dsc$a_pointer; /* address of first byte of data storage */
  115.     char        dsc$b_scale;    /* scale multiplier to convert from internal to external form */
  116.     unsigned char    dsc$b_digits;    /* number of decimal digits in internal representation */
  117.     unsigned    : 16;        /* reserved for future use, must be zero */
  118.     };
  119.  
  120.  
  121. /*
  122.  *    Noncontiguous array descriptor:
  123.  */
  124. struct    dsc$descriptor_nca
  125.     {
  126.     unsigned short    dsc$w_length;    /* length of an array element in bytes,
  127.                          or if dsc$b_dtype is DSC$K_DTYPE_V, bits,
  128.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  129.     unsigned char    dsc$b_dtype;    /* data type code */
  130.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_NCA */
  131.     char        *dsc$a_pointer; /* address of first actual byte of data storage */
  132.     char        dsc$b_scale;    /* scale multiplier to convert from internal to external form */
  133.     unsigned char    dsc$b_digits;    /* number of decimal digits in internal representation */
  134.     struct    {
  135.         unsigned         : 4;    /* reserved for future standardization, must be zero */
  136.         unsigned dsc$v_fl_redim  : 1;    /* must be zero */
  137.         unsigned         : 3;    /* reserved for future standardization, must be zero */
  138.         }    dsc$b_aflags;
  139.     unsigned char    dsc$b_dimct;    /* number of dimensions */
  140.     unsigned long    dsc$l_arsize;    /* total size of array in bytes,
  141.                          or if dsc$b_dtype is DSC$K_DTYPE_P, digits (4 bits each) */
  142.     /*
  143.      * Two blocks of information must follow contiguously at this point;  the first block
  144.      * contains information about the difference between the addresses of two adjacent
  145.      * elements in each dimension (the stride).  The second block contains information
  146.      * about the dimension bounds.
  147.      *
  148.      * The strides block has the following format:
  149.      *    char        *dsc$a_a0;        Address of the element whose subscripts are all zero
  150.      *    unsigned long    dsc$l_s [DIMCT];    Strides
  151.      *
  152.      * The bounds block has the following format:
  153.      *    struct    {
  154.      *        long    dsc$l_l;        Lower bound
  155.      *        long    dsc$l_u;        Upper bound
  156.      *        } dsc$bounds [DIMCT];
  157.      *
  158.      * (DIMCT represents the value contained in dsc$b_dimct.)
  159.      */
  160.     };
  161.  
  162.  
  163. /*
  164.  *    The varying string descriptor and varying string array descriptor are used with strings
  165.  *    of the following form:
  166.  *
  167.  *        struct    {
  168.  *            unsigned short    CURLEN;        The current length of BODY in bytes
  169.  *            char    BODY [MAXSTRLEN];    A fixed-length area containing the string
  170.  *            };
  171.  *
  172.  *    where MAXSTRLEN is the value contained in the dsc$w_maxstrlen field in the descriptor.
  173.  */
  174.  
  175. /*
  176.  *    Varying string descriptor:
  177.  */
  178. struct    dsc$descriptor_vs
  179.     {
  180.     unsigned short    dsc$w_maxstrlen; /* maximum length of the BODY field of the varying string in bytes */
  181.     unsigned char    dsc$b_dtype;    /* data type code = DSC$K_DTYPE_VT */
  182.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_VS */
  183.     char        *dsc$a_pointer; /* address of the CURLEN field of the varying string */
  184.     };
  185.  
  186.  
  187. /*
  188.  *    Varying string array descriptor:
  189.  */
  190. struct    dsc$descriptor_vsa
  191.     {
  192.     unsigned short    dsc$w_maxstrlen; /* maximum length of the BODY field of an array element in bytes */
  193.     unsigned char    dsc$b_dtype;    /* data type code = DSC$K_DTYPE_VT */
  194.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_VSA */
  195.     char        *dsc$a_pointer; /* address of first actual byte of data storage */
  196.     char        dsc$b_scale;    /* reserved for future standardization, must be zero */
  197.     unsigned char    dsc$b_digits;    /* reserved for future standardization, must be zero */
  198.     struct    {
  199.         unsigned         : 4;    /* reserved for future standardization, must be zero */
  200.         unsigned dsc$v_fl_redim  : 1;    /* must be zero */
  201.         unsigned         : 3;    /* reserved for future standardization, must be zero */
  202.         }    dsc$b_aflags;
  203.     unsigned char    dsc$b_dimct;    /* number of dimensions */
  204.     unsigned long    dsc$l_arsize;    /* total size of array in bytes */
  205.     /*
  206.      * Two blocks of information must follow contiguously at this point;  the first block
  207.      * contains information about the difference between the addresses of two adjacent
  208.      * elements in each dimension (the stride).  The second block contains information
  209.      * about the dimension bounds.
  210.      *
  211.      * The strides block has the following format:
  212.      *    char        *dsc$a_a0;        Address of the element whose subscripts are all zero
  213.      *    unsigned long    dsc$l_s [DIMCT];    Strides
  214.      *
  215.      * The bounds block has the following format:
  216.      *    struct    {
  217.      *        long    dsc$l_l;        Lower bound
  218.      *        long    dsc$l_u;        Upper bound
  219.      *        } dsc$bounds [DIMCT];
  220.      *
  221.      * (DIMCT represents the value contained in dsc$b_dimct.)
  222.      */
  223.     };
  224.  
  225.  
  226. /*
  227.  *    Unaligned bit string descriptor:
  228.  */
  229. struct    dsc$descriptor_ubs
  230.     {
  231.     unsigned short    dsc$w_length;    /* length of data item in bits */
  232.     unsigned char    dsc$b_dtype;    /* data type code = DSC$K_DTYPE_VU */
  233.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_UBS */
  234.     char        *dsc$a_base;    /* address to which dsc$l_pos is relative */
  235.     long        dsc$l_pos;    /* bit position relative to dsc$a_base of first bit in string */
  236.     };
  237.  
  238.  
  239. /*
  240.  *    Unaligned bit array descriptor:
  241.  */
  242. struct    dsc$descriptor_uba
  243.     {
  244.     unsigned short    dsc$w_length;    /* length of data item in bits */
  245.     unsigned char    dsc$b_dtype;    /* data type code = DSC$K_DTYPE_VU */
  246.     unsigned char    dsc$b_class;    /* descriptor class code = DSC$K_CLASS_UBA */
  247.     char        *dsc$a_base;    /* address to which effective bit offset is relative */
  248.     char        dsc$b_scale;    /* reserved for future standardization, must be zero */
  249.     unsigned char    dsc$b_digits;    /* reserved for future standardization, must be zero */
  250.     struct    {
  251.         unsigned         : 4;    /* reserved for future standardization, must be zero */
  252.         unsigned dsc$v_fl_redim  : 1;    /* must be zero */
  253.         unsigned         : 3;    /* reserved for future standardization, must be zero */
  254.         }    dsc$b_aflags;
  255.     unsigned char    dsc$b_dimct;    /* number of dimensions */
  256.     unsigned long    dsc$l_arsize;    /* total size of array in bits */
  257.     /*
  258.      * Three blocks of information must follow contiguously at this point;    the first block
  259.      * contains information about the difference between the bit addresses of two adjacent
  260.      * elements in each dimension (the stride).  The second block contains information
  261.      * about the dimension bounds.    The third block is the relative bit position with
  262.      * respect to dsc$a_base of the first actual bit of the array.
  263.      *
  264.      * The strides block has the following format:
  265.      *    long        dsc$l_v0;        Bit offset of the element whose subscripts are all zero,
  266.      *                        with respect to dsc$a_base
  267.      *    unsigned long    dsc$l_s [DIMCT];    Strides
  268.      *
  269.      * The bounds block has the following format:
  270.      *    struct    {
  271.      *        long    dsc$l_l;        Lower bound
  272.      *        long    dsc$l_u;        Upper bound
  273.      *        } dsc$bounds [DIMCT];
  274.      *
  275.      * The last block has the following format:
  276.      *    long    dsc$l_pos;
  277.      *
  278.      * (DIMCT represents the value contained in dsc$b_dimct.)
  279.      */
  280.     };
  281.  
  282.  
  283. /*
  284.  *    Codes for dsc$b_dtype:
  285.  */
  286.  
  287. /*
  288.  *    Atomic data types:
  289.  */
  290. #define DSC$K_DTYPE_Z    0        /* unspecified */
  291. #define DSC$K_DTYPE_BU    2        /* byte logical;  8-bit unsigned quantity */
  292. #define DSC$K_DTYPE_WU    3        /* word logical;  16-bit unsigned quantity */
  293. #define DSC$K_DTYPE_LU    4        /* longword logical;  32-bit unsigned quantity */
  294. #define DSC$K_DTYPE_QU    5        /* quadword logical;  64-bit unsigned quantity */
  295. #define DSC$K_DTYPE_OU    25        /* octaword logical;  128-bit unsigned quantity */
  296. #define DSC$K_DTYPE_B    6        /* byte integer;  8-bit signed 2's-complement integer */
  297. #define DSC$K_DTYPE_W    7        /* word integer;  16-bit signed 2's-complement integer */
  298. #define DSC$K_DTYPE_L    8        /* longword integer;  32-bit signed 2's-complement integer */
  299. #define DSC$K_DTYPE_Q    9        /* quadword integer;  64-bit signed 2's-complement integer */
  300. #define DSC$K_DTYPE_O    26        /* octaword integer;  128-bit signed 2's-complement integer */
  301. #define DSC$K_DTYPE_F    10        /* F_floating;    32-bit single-precision floating point */
  302. #define DSC$K_DTYPE_D    11        /* D_floating;    64-bit double-precision floating point */
  303. #define DSC$K_DTYPE_G    27        /* G_floating;    64-bit double-precision floating point */
  304. #define DSC$K_DTYPE_H    28        /* H_floating;    128-bit quadruple-precision floating point */
  305. #define DSC$K_DTYPE_FC    12        /* F_floating complex */
  306. #define DSC$K_DTYPE_DC    13        /* D_floating complex */
  307. #define DSC$K_DTYPE_GC    29        /* G_floating complex */
  308. #define DSC$K_DTYPE_HC    30        /* H_floating complex */
  309. #define DSC$K_DTYPE_CIT 31        /* COBOL Intermediate Temporary */
  310. /*
  311.  *    String data types:
  312.  */
  313. #define DSC$K_DTYPE_T    14        /* character-coded text;  a single character or a string */
  314. #define DSC$K_DTYPE_VT    37        /* varying character-coded text;  16-bit count, followed by a string */
  315. #define DSC$K_DTYPE_NU    15        /* numeric string, unsigned */
  316. #define DSC$K_DTYPE_NL    16        /* numeric string, left separate sign */
  317. #define DSC$K_DTYPE_NLO 17        /* numeric string, left overpunched sign */
  318. #define DSC$K_DTYPE_NR    18        /* numeric string, right separate sign */
  319. #define DSC$K_DTYPE_NRO 19        /* numeric string, right overpunched sign */
  320. #define DSC$K_DTYPE_NZ    20        /* numeric string, zoned sign */
  321. #define DSC$K_DTYPE_P    21        /* packed decimal string */
  322. #define DSC$K_DTYPE_V    1        /* bit;  aligned bit string */
  323. #define DSC$K_DTYPE_VU    34        /* bit unaligned;  arbitrary bit string */
  324. /*
  325.  *    Miscellaneous data types:
  326.  */
  327. #define DSC$K_DTYPE_ZI    22        /* sequence of instructions */
  328. #define DSC$K_DTYPE_ZEM 23        /* procedure entry mask */
  329. #define DSC$K_DTYPE_DSC 24        /* descriptor */
  330. #define DSC$K_DTYPE_BPV 32        /* bound procedure value */
  331. #define DSC$K_DTYPE_BLV 33        /* bound label value */
  332. #define DSC$K_DTYPE_ADT 35        /* absolute date and time */
  333. /*
  334.  *    Reserved data type codes:
  335.  *    codes 38-191 are reserved to DIGITAL;
  336.  *    codes 160-191 are reserved to DIGITAL facilities for facility-specific purposes;
  337.  *    codes 192-255 are reserved for DIGITAL's Computer Special Systems Group
  338.  *    and for customers for their own use.
  339.  */
  340.  
  341.  
  342. /*
  343.  *    Codes for dsc$b_class:
  344.  */
  345. #define DSC$K_CLASS_S    1        /* scalar or string descriptor */
  346. #define DSC$K_CLASS_D    2        /* dynamic string descriptor */
  347. /*    DSC$K_CLASS_V    3        ** variable buffer descriptor;    reserved for use by DIGITAL */
  348. #define DSC$K_CLASS_A    4        /* array descriptor */
  349. #define DSC$K_CLASS_P    5        /* procedure descriptor */
  350. /*    DSC$K_CLASS_PI    6        ** procedure incarnation descriptor;  obsolete */
  351. /*    DSC$K_CLASS_J    7        ** label descriptor;  reserved for use by the VAX-11 Debugger */
  352. /*    DSC$K_CLASS_JI    8        ** label incarnation descriptor;  obsolete */
  353. #define DSC$K_CLASS_SD    9        /* decimal scalar string descriptor */
  354. #define DSC$K_CLASS_NCA 10        /* noncontiguous array descriptor */
  355. #define DSC$K_CLASS_VS    11        /* varying string descriptor */
  356. #define DSC$K_CLASS_VSA 12        /* varying string array descriptor */
  357. #define DSC$K_CLASS_UBS 13        /* unaligned bit string descriptor */
  358. #define DSC$K_CLASS_UBA 14        /* unaligned bit array descriptor */
  359. /*
  360.  *    Reserved descriptor class codes:
  361.  *    codes 15-191 are reserved to DIGITAL;
  362.  *    codes 160-191 are reserved to DIGITAL facilities for facility-specific purposes;
  363.  *    codes 192-255 are reserved for DIGITAL's Computer Special Systems Group
  364.  *    and for customers for their own use.
  365.  */
  366.  
  367.  
  368. /*
  369.  *    A simple macro to construct a string descriptor:
  370.  */
  371. #define $DESCRIPTOR(name,string)    struct dsc$descriptor_s name = { sizeof(string)-1, DSC$K_DTYPE_T, DSC$K_CLASS_S, string }
  372.