home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / ace_gpl_release / include / rexx / storage.h < prev   
Encoding:
C/C++ Source or Header  |  1996-08-28  |  10.4 KB  |  261 lines

  1. #ifndef REXX_STORAGE_H
  2. #define REXX_STORAGE_H 1
  3. /*
  4. ** storage.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/03/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for storage.h
  17. */
  18. #ifndef NexxStrPtr
  19. #define NexxStrPtr ADDRESS
  20. #endif
  21. #ifndef RexxArgPtr
  22. #define RexxArgPtr ADDRESS
  23. #endif
  24. #ifndef RexxMsgPtr
  25. #define RexxMsgPtr ADDRESS
  26. #endif
  27. #ifndef RexxRsrcPtr
  28. #define RexxRsrcPtr ADDRESS
  29. #endif
  30. #ifndef RexxTaskPtr
  31. #define RexxTaskPtr ADDRESS
  32. #endif
  33. #ifndef SrcNodePtr
  34. #define SrcNodePtr ADDRESS
  35. #endif
  36. /*
  37. ** End of StructPointer defines for storage.h
  38. */
  39.  
  40.  
  41. #ifndef EXEC_TYPES_H
  42. #include <exec/types.h>
  43. #endif
  44.  
  45. #ifndef EXEC_NODES_H
  46. #include <exec/nodes.h>
  47. #endif
  48.  
  49. #ifndef EXEC_LISTS_H
  50. #include <exec/lists.h>
  51. #endif
  52.  
  53. #ifndef EXEC_PORTS_H
  54. #include <exec/ports.h>
  55. #endif
  56.  
  57. #ifndef EXEC_LIBRARIES_H
  58. #include <exec/libraries.h>
  59. #endif
  60.  
  61. /* The NexxStr structure is used to maintain the internal strings in REXX.
  62.  * It includes the buffer area for the string and associated attributes.
  63.  * This is actually a variable-length structure  it is allocated for a
  64.  * specific length string,  and the length is never modified thereafter
  65.  * (since it's used for recycling).
  66.  */
  67.  
  68. STRUCT NexxStr  
  69.    LONGINT     ns_Ivalue              /* integer value     */
  70.    SHORTINT    ns_Length              /* length in bytes (excl null)   */
  71.    BYTE     ns_Flags               /* attribute flags       */
  72.    BYTE     ns_Hash                /* hash code         */
  73.    STRING ns_Buff SIZE 8          /* buffer area for strings   */
  74. END STRUCT                       /* SIZE: 16 bytes (minimum)  */
  75.  
  76. #define NXADDLEN 9             /* offset plus null byte */
  77. #define IVALUE(nsPtr) (nsPtr->ns_Ivalue)
  78.  
  79. /* String attribute flag bit definitions                */
  80. #define NSB_KEEP     0             /* permanent string?     */
  81. #define NSB_STRING   1             /* string form valid?        */
  82. #define NSB_NOTNUM   2             /* non-numeric?          */
  83. #define NSB_NUMBER   3             /* a valid number?       */
  84. #define NSB_BINARY   4             /* integer value saved?      */
  85. #define NSB_FLOAT    5             /* floating point format?    */
  86. #define NSB_EXT      6             /* an external string?       */
  87. #define NSB_SOURCE   7             /* part of the program source?   */
  88.  
  89. /* The flag form of the string attributes               */
  90. #define NSF_KEEP     (1)
  91. #define NSF_STRING   (2)
  92. #define NSF_NOTNUM   (4)
  93. #define NSF_NUMBER   (8)
  94. #define NSF_BINARY   (16)
  95. #define NSF_FLOAT    (32)
  96. #define NSF_EXT      (64)
  97. #define NSF_SOURCE   (128)
  98.  
  99. /* Combinations of flags                        */
  100. #define NSF_INTNUM   (NSF_NUMBER OR NSF_BINARY OR NSF_STRING)
  101. #define NSF_DPNUM    (NSF_NUMBER OR NSF_FLOAT)
  102. #define NSF_ALPHA    (NSF_NOTNUM OR NSF_STRING)
  103. #define NSF_OWNED    (NSF_SOURCE OR NSF_EXT    OR NSF_KEEP)
  104. #define KEEPSTR      (NSF_STRING OR NSF_SOURCE OR NSF_NOTNUM)
  105. #define KEEPNUM      (NSF_STRING OR NSF_SOURCE OR NSF_NUMBER OR NSF_BINARY)
  106.  
  107. /* The RexxArg structure is identical to the NexxStr structure,  but
  108.  * is allocated from system memory rather than from internal storage.
  109.  * This structure is used for passing arguments to external programs.
  110.  * It is usually passed as an "argstring",  a pointer to the string buffer.
  111.  */
  112.  
  113. STRUCT RexxArg  
  114.    LONGINT     ra_Size                /* total allocated length    */
  115.    SHORTINT    ra_Length              /* length of string      */
  116.    BYTE     ra_Flags               /* attribute flags       */
  117.    BYTE     ra_Hash                /* hash code         */
  118.    STRING ra_Buff SIZE 8          /* buffer area           */
  119. END STRUCT                       /* SIZE: 16 bytes (minimum)  */
  120.  
  121. /* The RexxMsg structure is used for all communications with REXX
  122.  * programs.  It is an EXEC message with a parameter block appended.
  123.  */
  124.  
  125. STRUCT RexxMsg  
  126.    _Message rm_Node          /* EXEC message structure    */
  127.    ADDRESS     rm_TaskBlock           /* global structure (private)    */
  128.    ADDRESS     rm_LibBase         /* library base (private)    */
  129.    LONGINT     rm_Action              /* command (action) code */
  130.    LONGINT     rm_Result1         /* primary result (return code)  */
  131.    LONGINT     rm_Result2         /* secondary result      */
  132.    STRING rm_Args SIZE 64  /* 16*SIZEOF(ADDRESS) */           /* argument block (ARG0-ARG15)   */
  133.  
  134.    MsgPortPtr  rm_PassPort         /* forwarding port       */
  135.    ADDRESS   rm_CommAddr            /* host address (port name)  */
  136.    ADDRESS   rm_FileExt         /* file extension        */
  137.    LONGINT     rm_Stdin               /* input stream (filehandle) */
  138.    LONGINT     rm_Stdout              /* output stream (filehandle)    */
  139.    LONGINT     rm_avail               /* future expansion      */
  140. END STRUCT                       /* SIZE: 128 bytes       */
  141.  
  142. /* Field definitions                            */
  143. #define ARG0(rmp) (rmp->rm_Args[0])    /* start of argblock     */
  144. #define ARG1(rmp) (rmp->rm_Args[1])    /* first argument        */
  145. #define ARG2(rmp) (rmp->rm_Args[2])    /* second argument       */
  146.  
  147. #define MAXRMARG  15               /* maximum arguments     */
  148.  
  149. /* Command (action) codes for message packets               */
  150. #define RXCOMM    &H01000000           /* a command-level invocation    */
  151. #define RXFUNC    &H02000000           /* a function call       */
  152. #define RXCLOSE   &H03000000           /* close the REXX server */
  153. #define RXQUERY   &H04000000           /* query for information */
  154. #define RXADDFH   &H07000000           /* add a function host       */
  155. #define RXADDLIB  &H08000000           /* add a function library    */
  156. #define RXREMLIB  &H09000000           /* remove a function library */
  157. #define RXADDCON  &H0A000000           /* add/update a ClipList string  */
  158. #define RXREMCON  &H0B000000           /* remove a ClipList string  */
  159. #define RXTCOPN   &H0C000000           /* open the trace console    */
  160. #define RXTCCLS   &H0D000000           /* close the trace console   */
  161.  
  162. /* Command modifier flag bits                       */
  163. #define RXFB_NOIO    16        /* suppress I/O inheritance? */
  164. #define RXFB_RESULT  17        /* result string expected?   */
  165. #define RXFB_STRING  18        /* program is a "string file"?   */
  166. #define RXFB_TOKEN   19        /* tokenize the command line?    */
  167. #define RXFB_NONRET  20        /* a "no-return" message?    */
  168.  
  169. /* The flag form of the command modifiers               */
  170. #define RXFF_NOIO    (65536&)
  171. #define RXFF_RESULT  (131072&)
  172. #define RXFF_STRING  (262144&)
  173. #define RXFF_TOKEN   (524288&)
  174. #define RXFF_NONRET  (1048576&)
  175.  
  176. #define RXCODEMASK   &HFF000000
  177. #define RXARGMASK    &H0000000F
  178.  
  179. /* The RexxRsrc structure is used to manage global resources.  Each node
  180.  * has a name string created as a RexxArg structure,  and the total size
  181.  * of the node is saved in the "rr_Size" field.  The REXX systems library
  182.  * provides functions to allocate and release resource nodes.  If special
  183.  * deletion operations are required,  an offset and base can be provided in
  184.  * "rr_Func" and "rr_Base",  respectively.  This "autodelete" function will
  185.  * be called with the base in register A6 and the node in A0.
  186.  */
  187.  
  188. STRUCT RexxRsrc  
  189.    Node rr_Node 
  190.    SHORTINT     rr_Func                /* "auto-delete" offset      */
  191.    ADDRESS     rr_Base                /* "auto-delete" base        */
  192.    LONGINT     rr_Size                /* total size of node        */
  193.    LONGINT     rr_Arg1                /* available ...     */
  194.    LONGINT     rr_Arg2                /* available ...     */
  195. END STRUCT                       /* SIZE: 32 bytes        */
  196.  
  197. /* Resource node types                          */
  198. #define RRT_ANY      0             /* any node type ...     */
  199. #define RRT_LIB      1             /* a function library        */
  200. #define RRT_PORT     2             /* a public port     */
  201. #define RRT_FILE     3             /* a file IoBuff     */
  202. #define RRT_HOST     4             /* a function host       */
  203. #define RRT_CLIP     5             /* a Clip List node      */
  204.  
  205. /* The RexxTask structure holds the fields used by REXX to communicate with
  206.  * external processes,  including the client task.  It includes the global
  207.  * data structure (and the base environment).  The structure is passed to
  208.  * the newly-created task in its "wake-up" message.
  209.  */
  210.  
  211. #define GLOBALSZ  200              /* total size of GlobalData  */
  212.  
  213. STRUCT RexxTask  
  214.    STRING rt_Global SIZE 200  /* GLOBALSZ */        /* global DATA structure */
  215.    MsgPort rt_MsgPort           /* global message port       */
  216.    BYTE     rt_Flags               /* task flag bits        */
  217.    BYTE     rt_SigBit              /* signal bit            */
  218.  
  219.    ADDRESS     rt_ClientID            /* the client's task ID      */
  220.    ADDRESS     rt_MsgPkt              /* the packet being processed    */
  221.    ADDRESS     rt_TaskID              /* our task ID           */
  222.    ADDRESS     rt_RexxPort            /* the REXX public port      */
  223.  
  224.    ADDRESS     rt_ErrTrap         /* Error trap address        */
  225.    ADDRESS     rt_StackPtr            /* stack pointer for traps   */
  226.  
  227.    _List rt_Header1          /* Environment list      */
  228.    _List rt_Header2          /* Memory freelist       */
  229.    _List rt_Header3          /* Memory allocation list    */
  230.    _List rt_Header4          /* Files list            */
  231.    _List rt_Header5          /* Message Ports List        */
  232. END STRUCT
  233.  
  234. /* Definitions for RexxTask flag bits                   */
  235. #define RTFB_TRACE   0             /* external trace flag       */
  236. #define RTFB_HALT    1             /* external halt flag        */
  237. #define RTFB_SUSP    2             /* suspend task?     */
  238. #define RTFB_TCUSE   3             /* trace console in use? */
  239. #define RTFB_WAIT    6             /* waiting for reply?        */
  240. #define RTFB_CLOSE   7             /* task completed?       */
  241.  
  242. /* Definitions for memory allocation constants              */
  243. #define MEMQUANT  16&              /* quantum of memory space   */
  244. #define MEMMASK   &HFFFFFFF0           /* mask for rounding the size    */
  245.  
  246. #define MEMQUICK  (1&)           /* EXEC flags: MEMF_PUBLIC   */
  247. #define MEMCLEAR  (65536&)           /* EXEC flags: MEMF_CLEAR    */
  248.  
  249. /* The SrcNode is a temporary structure used to hold values destined for
  250.  * a segment array.  It is also used to maintain the memory freelist.
  251.  */
  252.  
  253. STRUCT SrcNode  
  254.    SrcNodePtr  sn_Succ         /* next node         */
  255.    SrcNodePtr  sn_Pred         /* previous node     */
  256.    ADDRESS     sn_Ptr             /* pointer value     */
  257.    LONGINT     sn_Size                /* size of object        */
  258. END STRUCT                       /* SIZE: 16 bytes        */
  259.  
  260. #endif
  261.