home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / os-include.lha / os-include / libraries / commodities.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  7KB  |  202 lines

  1. #ifndef LIBRARIES_COMMODITIES_H
  2. #define LIBRARIES_COMMODITIES_H
  3. /*
  4. **    $VER: commodities.h 38.4 (24.2.93)
  5. **    Includes Release 40.15
  6. **
  7. **    Commodities definitions
  8. **
  9. **    (C) Copyright 1990-1993 Commodore-Amiga Inc.
  10. **    All Rights Reserved
  11. */
  12.  
  13. /*****************************************************************************/
  14.  
  15.  
  16. #ifndef EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. #ifndef EXEC_PORTS_H
  21. #include <exec/ports.h>
  22. #endif
  23.  
  24.  
  25. /*****************************************************************************/
  26.  
  27.  
  28. /* object creation macros */
  29. #define CxFilter(d)        CreateCxObj((LONG) CX_FILTER,     (LONG) d,     0)
  30. #define CxSender(port,id)   CreateCxObj((LONG) CX_SEND,       (LONG) port,  (LONG) id)
  31. #define CxSignal(task,sig)  CreateCxObj((LONG) CX_SIGNAL,     (LONG) task,  (LONG) sig)
  32. #define CxTranslate(ie)     CreateCxObj((LONG) CX_TRANSLATE,  (LONG) ie,    0)
  33. #define CxDebug(id)        CreateCxObj((LONG) CX_DEBUG,      (LONG) id,    0)
  34. #define CxCustom(action,id) CreateCxObj((LONG) CX_CUSTOM,     (LONG)action, (LONG)id)
  35.  
  36.  
  37. /*****************************************************************************/
  38.  
  39.  
  40. struct NewBroker
  41. {
  42.     BYTE        nb_Version;   /* Must be set to NB_VERSION */
  43.     STRPTR        nb_Name;
  44.     STRPTR        nb_Title;
  45.     STRPTR        nb_Descr;
  46.     WORD        nb_Unique;
  47.     WORD        nb_Flags;
  48.     BYTE        nb_Pri;
  49.     struct MsgPort *nb_Port;
  50.     WORD        nb_ReservedChannel;
  51. };
  52.  
  53. /* constant for NewBroker.nb_Version */
  54. #define NB_VERSION 5        /* Version of NewBroker structure */
  55.  
  56. /* Sizes for various buffers */
  57. #define CBD_NAMELEN  24
  58. #define CBD_TITLELEN 40
  59. #define CBD_DESCRLEN 40
  60.  
  61. /* Flags for NewBroker.nb_Unique */
  62. #define NBU_DUPLICATE 0
  63. #define NBU_UNIQUE    1        /* will not allow duplicates          */
  64. #define NBU_NOTIFY    2        /* sends CXM_UNIQUE to existing broker */
  65.  
  66. /* Flags for NewBroker.nb_Flags */
  67. #define COF_SHOW_HIDE 4
  68.  
  69.  
  70. /*****************************************************************************/
  71.  
  72.  
  73. /* Fake data types for system private objects */
  74. #ifndef COMMODITIES_BASE_H
  75. typedef LONG CxObj;
  76. typedef LONG CxMsg;
  77. #endif
  78.  
  79. /* Pointer to a function returning a LONG */
  80. typedef LONG (*PFL)();
  81.  
  82.  
  83. /*****************************************************************************/
  84.  
  85.  
  86. /* Commodities object types */
  87. #define CX_INVALID    0     /* not a valid object (probably null) */
  88. #define CX_FILTER    1     /* input event messages only        */
  89. #define CX_TYPEFILTER    2     /* obsolete, do not use            */
  90. #define CX_SEND    3     /* sends a message            */
  91. #define CX_SIGNAL    4     /* sends a signal            */
  92. #define CX_TRANSLATE    5     /* translates input event into chain  */
  93. #define CX_BROKER    6     /* application representative        */
  94. #define CX_DEBUG    7     /* dumps info to serial port        */
  95. #define CX_CUSTOM    8     /* application provides function        */
  96. #define CX_ZERO    9     /* system terminator node        */
  97.  
  98.  
  99. /*****************************************************************************/
  100.  
  101.  
  102. /* Commodities message types */
  103. #define CXM_IEVENT  (1 << 5)
  104. #define CXM_COMMAND (1 << 6)
  105.  
  106. /* Only CXM_IEVENT messages are passed through the input network. Other types
  107.  * of messages are sent to an optional port in your broker. This means that
  108.  * you must test the message type in your message handling, if input messages
  109.  * and command messages come to the same port.
  110.  *
  111.  * CXM_IEVENT: Messages of this type rattle around the Commodities input
  112.  *           network. They are sent to you by a Sender object, and passed
  113.  *           to you as a synchronous function call by a Custom object.
  114.  *
  115.  *           The message port or function entry point is stored in the
  116.  *           object, and the ID field of the message will be set to what
  117.  *           you arrange issuing object.
  118.  *
  119.  *           The data section of the message will point to the input event
  120.  *           triggering the message.
  121.  *
  122.  * CXM_COMMAND: These messages are sent to a port attached to your Broker.
  123.  *        They are sent to you when the controller program wants your
  124.  *        program to do something. The ID value identifies the command.
  125.  */
  126.  
  127. /* ID values associated with a message of type CXM_COMMAND */
  128. #define CXCMD_DISABLE    (15)  /* please disable yourself     */
  129. #define CXCMD_ENABLE    (17)  /* please enable yourself     */
  130. #define CXCMD_APPEAR    (19)  /* open your window, if you can     */
  131. #define CXCMD_DISAPPEAR (21)  /* go dormant             */
  132. #define CXCMD_KILL    (23)  /* go away for good         */
  133. #define CXCMD_LIST_CHG    (27)  /* Someone changed the broker list */
  134. #define CXCMD_UNIQUE    (25)  /* someone tried to create a broker
  135.                    * with your name. Suggest you appear.
  136.                    */
  137.  
  138.  
  139. /*****************************************************************************/
  140.  
  141.  
  142. struct InputXpression
  143. {
  144.     UBYTE ix_Version;      /* must be set to IX_VERSION */
  145.     UBYTE ix_Class;      /* class must match exactly  */
  146.  
  147.     UWORD ix_Code;      /* Bits that we want */
  148.     UWORD ix_CodeMask;      /* Set bits here to indicate which bits in ix_Code
  149.                * are don't care bits.
  150.                */
  151.     UWORD ix_Qualifier;   /* Bits that we want */
  152.     UWORD ix_QualMask;      /* Set bits here to indicate which bits in
  153.                * ix_Qualifier are don't care bits
  154.                */
  155.     UWORD ix_QualSame;      /* synonyms in qualifier */
  156. };
  157. typedef struct InputXpression IX;
  158.  
  159. /* constant for InputXpression.ix_Version */
  160. #define IX_VERSION 2
  161.  
  162. /* constants for InputXpression.ix_QualSame */
  163. #define IXSYM_SHIFT 1    /* left- and right- shift are equivalent     */
  164. #define IXSYM_CAPS  2    /* either shift or caps lock are equivalent  */
  165. #define IXSYM_ALT   4    /* left- and right- alt are equivalent         */
  166.  
  167. #define IXSYM_SHIFTMASK (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  168. #define IXSYM_CAPSMASK    (IXSYM_SHIFTMASK | IEQUALIFIER_CAPSLOCK)
  169. #define IXSYM_ALTMASK    (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
  170.  
  171. /* constant for InputXpression.ix_QualMask */
  172. #define IX_NORMALQUALS    0x7FFF     /* avoid RELATIVEMOUSE */
  173.  
  174. /* matches nothing */
  175. #define NULL_IX(ix)   ((ix)->ix_Class == IECLASS_NULL)
  176.  
  177.  
  178. /*****************************************************************************/
  179.  
  180.  
  181. /* Error returns from CxBroker() */
  182. #define CBERR_OK      0  /* No error                   */
  183. #define CBERR_SYSERR  1  /* System error, no memory, etc       */
  184. #define CBERR_DUP     2  /* uniqueness violation           */
  185. #define CBERR_VERSION 3  /* didn't understand NewBroker.nb_Version */
  186.  
  187.  
  188. /*****************************************************************************/
  189.  
  190.  
  191. /* Return values from CxObjError() */
  192. #define COERR_ISNULL     1   /* you called CxObjError(NULL)       */
  193. #define COERR_NULLATTACH 2   /* someone attached NULL to my list   */
  194. #define COERR_BADFILTER  4   /* a bad filter description was given */
  195. #define COERR_BADTYPE     8   /* unmatched type-specific operation  */
  196.  
  197.  
  198. /*****************************************************************************/
  199.  
  200.  
  201. #endif /* LIBRARIES_COMMODITIES_H */
  202.