home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / apl2 / aplobj.h__ / aplobj.h
Encoding:
C/C++ Source or Header  |  1993-12-15  |  8.0 KB  |  174 lines

  1. /*-m-aplobj----------------------------------------------------------
  2.  *
  3.  * Module Name: aplobj.h
  4.  *
  5.  * Descriptive Name: Workstation CDR Formats
  6.  *
  7.  * Copyright:   APL2/6000               Version 1.2
  8.  *              APL2 for OS/2           Version 1.0
  9.  *              APL2 for Sun Solaris    Version 1.0
  10.  *              Licensed Materials - Property of IBM
  11.  *              (C) COPYRIGHT IBM CORP. 1994
  12.  *
  13.  * Function: Provide typedefs and constants for workstation CDRs
  14.  *
  15.  * Notes:
  16.  *
  17.  *    Dependencies: None
  18.  *
  19.  *    Restrictions: None
  20.  *
  21.  * Module Type: Header
  22.  *
  23.  * Change Activity:
  24.  *
  25.  *-Z----------------------------------------------------------------*/
  26.  
  27. #ifndef APLOBJ_DEF
  28. #define APLOBJ_DEF
  29. /*-------------------------------------------------------------------*/
  30. /*    Basic Structure                                                */
  31. /*                                                                   */
  32. /*    Note: Each array is a self-contained item, consisting of the   */
  33. /*          APLOBJ structure, followed by the data, and then extra   */
  34. /*          bytes to round up to an even multiple of 16 bytes.       */
  35. /*                                                                   */
  36. /*-------------------------------------------------------------------*/
  37. typedef struct aplobj {
  38.    unsigned long  ptr      ;           /* Platform Identifier        */
  39.    unsigned long  nb       ;           /* Total bytes in this array  */
  40.    unsigned long  nelm     ;           /* Number of elements (xrho)  */
  41.    unsigned char  type     ;           /* Data type                  */
  42.    unsigned char  rank     ;           /* Rank (number of dimensions)*/
  43.    unsigned char  fill[2]  ;           /* Reserved                   */
  44.    unsigned long  dim[1]   ;           /* Items in a dimension       */
  45.                                        /* (# dim elements = rank)    */
  46. } APLOBJ ;
  47.  
  48. /*-------------------------------------------------------------------*/
  49. /*    Alternate Structure                                            */
  50. /*                                                                   */
  51. /*    This structure refers to the first four bytes as 2 short. It   */
  52. /*    allows references to the pertinent parts of the platform       */
  53. /*    identifier to be made in a way independant of byte-reversal    */
  54. /*                                                                   */
  55. /*-------------------------------------------------------------------*/
  56. typedef struct cdw  {
  57.    unsigned short id       ;           /* Platform Identifier        */
  58.    unsigned short uuzero   ;           /* Unused (Must be zero)      */
  59.    unsigned long  nb       ;           /* Total bytes in this array  */
  60.    unsigned long  nelm     ;           /* Number of elements (xrho)  */
  61.    unsigned char  type     ;           /* Data type                  */
  62.    unsigned char  rank     ;           /* Rank (number of dimensions)*/
  63.    unsigned char  fill[2]  ;           /* Reserved                   */
  64.    unsigned long  dim[1]   ;           /* Items in a dimension       */
  65.                                        /* (# dim elements = rank)    */
  66. } CDW ;
  67.  
  68. /*-------------------------------------------------------------------*/
  69. /*    Mappings for Data Section                                      */
  70. /*                                                                   */
  71. /*    Note: For scalar integers, since there will be 0 elements in   */
  72. /*          "dim", dim[0] is often used to address the data value.   */
  73. /*                                                                   */
  74. /*    Other mappings could be added for each of the other types,     */
  75. /*    but these seem to be the most useful.                          */
  76. /*                                                                   */
  77. /*-------------------------------------------------------------------*/
  78.  
  79.  typedef struct objgen {
  80.     unsigned long offset[1] ;          /* Offsets to sub-items       */
  81.  } OBJGEN ;
  82.  
  83.  typedef struct objapv {
  84.     unsigned long start ;              /* Progression start value    */
  85.     unsigned long inc  ;               /* And increment              */
  86.  } OBJAPV ;
  87.  
  88. /*-------------------------------------------------------------------*/
  89. /*    Valid values for the ->ptr field  (APLOBJ)                     */
  90. /*    Note:  The value CDRID denotes the correct id for the          */
  91. /*           the running system.  Can be used to store into          */
  92. /*           the ptr field when creating CDR's for the running       */
  93. /*           system.  Beware of byte reversal when using these.      */
  94. /*-------------------------------------------------------------------*/
  95.  
  96. #define CDRid6000 0x40400000
  97. #define CDRidOS2  0x00002020
  98.  
  99. #ifdef __OS2__
  100.    #define CDRID CDRidOS2
  101. #else
  102.    #define CDRID CDRid6000
  103. #endif
  104.  
  105. /*-------------------------------------------------------------------*/
  106. /*    Valid values for the ->id  field  (CDW)                        */
  107. /*    Note: If using these to create CDRs be sure to also zero the   */
  108. /*          uuzero field                                             */
  109. /*-------------------------------------------------------------------*/
  110.  
  111. #define CDWid6000    0x4040
  112. #define CDWidOS2     0x2020
  113.  
  114. #ifdef __OS2__
  115.    #define CDWID CDWidOS2
  116. #else
  117.    #define CDWID CDWid6000
  118. #endif
  119.  
  120. /*-------------------------------------------------------------------*/
  121. /*    Valid values for the ->type field                              */
  122. /*-------------------------------------------------------------------*/
  123.  
  124.  #define CDWRTB    0                   /* Boolean                    */
  125.  #define BOOLEAN   CDWRTB
  126.  #define CDWRTI    1                   /* Integer                    */
  127.  #define INTEGER   CDWRTI
  128.  #define CDWRTR    2                   /* Real                       */
  129.  #define FLOAT     CDWRTR
  130.  #define CDWRTJ    3                   /* Complex                    */
  131.  #define COMPLEX   CDWRTJ
  132.  #define CDWRTC    4                   /* Character                  */
  133.  #define CHARACTER CDWRTC
  134.  #define CDWRTD    5                   /* Character long (dbcs)      */
  135.  #define CHARLONG  CDWRTD
  136.  #define CDWRTA    6                   /* Integer Progression vector */
  137.  #define APV       CDWRTA
  138.  #define CDWRTG    7                   /* General array              */
  139.  #define NESTED    CDWRTG
  140.  
  141. /*-------------------------------------------------------------------*/
  142. /*    Length in bytes for each of the valid types                    */
  143. /*-------------------------------------------------------------------*/
  144.  
  145.  #define CDWRLB  1                     /* Boolean                    */
  146.  #define CDWRLI  4                     /* Integer                    */
  147.  #define CDWRLR  8                     /* Real                       */
  148.  #define CDWRLJ  16                    /* Complex                    */
  149.  #define CDWRLC  1                     /* Character                  */
  150.  #define CDWRLD  4                     /* Character long (dbcs)      */
  151.  #define CDWRLA  8                     /* Integer Progression vector */
  152.  #define CDWRLG  4                     /* General array              */
  153.  
  154. /*-------------------------------------------------------------------*/
  155. /*    Some valid values for the ->rank field                         */
  156. /*-------------------------------------------------------------------*/
  157.  
  158.  #define CDWRRS  0                    /* Scalar                      */
  159.  #define SCALAR  CDWRRS
  160.  #define CDWRRV  1                    /* Vector                      */
  161.  #define VECTOR  CDWRRV
  162.  #define CDWRRM  2                    /* Matrix                      */
  163.  #define MATRIX  CDWRRM
  164.  
  165. /*-------------------------------------------------------------------*/
  166. /*    Miscellaneous Equates                                          */
  167. /*-------------------------------------------------------------------*/
  168.  
  169. #define CDWSDLEN      (sizeof(CDW) - sizeof(long))
  170. #define ObjHeadSize   CDWSDLEN
  171. #define ObjSize(Rank) (CDWSDLEN + (sizeof(long)*Rank))
  172.  
  173. #endif
  174.