home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / m2 / CycloneModules.lha / modules / txt / commoditiesD.def < prev    next >
Text File  |  1996-09-23  |  7KB  |  196 lines

  1. (*
  2. **    Cyclone Modula-2 Interface module:
  3. **    $VER: commodities.h 38.4 (24.2.93)
  4. **    Includes Release 40.15
  5. **
  6. **    Commodities definitions
  7. **
  8. **    (C) Copyright 1990-1993 Commodore-Amiga Inc.
  9. **    All Rights Reserved
  10. **
  11. **      Interface module by Marcel Timmermans
  12. **      (C) Copyright 1995-1996 Marcel Timmermans
  13. **      All Rights Reserved
  14. *)
  15.  
  16. DEFINITION MODULE CommoditiesD;
  17.  
  18. (*$ Implementation- *)
  19.  
  20. FROM SYSTEM IMPORT ADDRESS;
  21. IMPORT ed:ExecD,Reg,ie:InputEvent;
  22.  
  23.  
  24. CONST
  25.  commoditiesName = "commodities.library";
  26.  
  27. TYPE
  28. (* Fake data types for system private objects *)
  29.   CxObjPtr; 
  30.   CxMsgPtr;
  31.  
  32. CONST
  33.  
  34. (* constant for NewBroker.nb_Version *)
  35.  nbVersion = 5;        (* Version of NewBroker structure *)
  36.  
  37. (* Sizes for various buffers *)
  38.  cbdNamelen  = 24;
  39.  cbdTitlelen = 40;
  40.  cbdDescrlen = 40;
  41.  
  42.  
  43. TYPE
  44.  UniqueFlags = (
  45.   unique,notify,uf2,uf3,uf4,uf5,uf6,uf7, 
  46.   uf8,uf9,uf10,uf11,uf12,uf13,uf14,uf15
  47.  );
  48.  
  49.  UniqueFlagSet=SET OF UniqueFlags;
  50.  
  51.  NewBrokerFlags = (
  52.   nbf0,nbf1,showHide,nbf3,nbf4,nbf5,nbf6,nbf7,
  53.   nbf8,nbf9,nbf10,nbf11,nbf12,nbf13,nbf14,nbf15
  54.  );
  55.  
  56.  NewBrokerFlagSet = SET OF NewBrokerFlags;
  57.  
  58.  NewBroker = RECORD
  59.   version         : SHORTINT;  (* Must be set to NB_VERSION *)
  60.   name            : ADDRESS;
  61.   title           : ADDRESS;
  62.   descr           : ADDRESS;
  63.   unique          : UniqueFlagSet;
  64.   flags           : NewBrokerFlagSet;
  65.   pri             : SHORTINT;
  66.   port            : ed.MsgPortPtr;
  67.   reservedChannel : CARDINAL;
  68.  END;
  69.  NewBrokerPtr=POINTER TO NewBroker;
  70.  
  71.  PFL=POINTER TO PROCEDURE():LONGINT;
  72.  
  73.  
  74. CONST
  75. (* Flags for NewBroker.nb_Unique *)
  76.  nbuDuplicate=UniqueFlagSet{};
  77.  nbuUnique=UniqueFlagSet{unique};       (* will not allow duplicates          *)
  78.  nbuNotify=UniqueFlagSet{notify};       (* sends CXM_UNIQUE to existing broker *)
  79.  
  80. (* Flags for NewBroker.nb_Flags *)
  81.  cofShowHide=NewBrokerFlagSet{showHide};
  82.  
  83.  
  84.  
  85. (* Commodities Object Types *)
  86.   cxInvalid     = 0;  (* not a valid object (probably null)  *)
  87.   cxFilter      = 1;  (* input event messages only           *)
  88.   cxTypeFilter  = 2;  (* obsolete, do not use                *)
  89.   cxSend        = 3;  (* sends a message                     *)
  90.   cxSignal      = 4;  (* sends a signal                      *)
  91.   cxTranslate   = 5;  (* translates input event into chain   *)
  92.   cxBroker      = 6;  (* application representative          *)
  93.   cxDebug       = 7;  (* dumps info to serial port           *)
  94.   cxCustom      = 8;  (* application provides function       *)
  95.   cxZero        = 9;  (* system terminator node              *)
  96.  
  97.  
  98.  
  99. (*****************************************************************************)
  100.  
  101.  
  102. (* Commodities message types *)
  103.   cxmIEvent   = 5;
  104.   cxmCommand  = 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.   cxcmdDisable   = 15;  (* please disable yourself       *)
  129.   cxcmdEnable    = 17;  (* please enable yourself        *)
  130.   cxcmdAppear    = 19;  (* open your window, if you can  *)
  131.   cxcmdDisappear = 21;  (* go dormant                    *)
  132.   cxcmdKill      = 23;  (* go away for good              *)
  133.   cxcmdListChg   = 27;  (* Someone changed the broker list *)
  134.   cxcmdUnique    = 25;  (* someone tried to create a broker
  135.                          * with your name. Suggest you appear.
  136.                          *)
  137.  
  138. (*****************************************************************************)
  139. TYPE
  140.  
  141.   InputXpressionPtr = POINTER TO InputXpression;
  142.   InputXpression = RECORD
  143.     version  : SHORTCARD;       (* must be set to IX_VERSION  *)
  144.     class    : ie.Class;        (* class must match exactly   *)
  145.  
  146.     code     : CARDINAL;        (* Bits that we want          *)
  147.     codeMask : CARDINAL;        (* Set bits here to indicate  *)
  148.                                 (* which bits in ix_Code are  *)
  149.                                 (* don't care bits.           *)
  150.     qualifier: ie.QualifierSet; (* Bits that we want          *)
  151.     qualMask : ie.QualifierSet; (* Set bits here to indicate  *)
  152.                                 (* which bits in ix_Qualifier *)
  153.                                 (* are don't care bits        *)
  154.     qualSame : CARDINAL         (* synonyms in qualifier      *)
  155.   END;
  156.  
  157.   IX = InputXpression;
  158.   IXPtr = POINTER TO IX;
  159.  
  160. CONST
  161. (* constant for InputXpression.ix_Version *)
  162.   ixVersion = 2;
  163.  
  164. (* constants for InputXpression.ix_QualSame *)
  165.   ixSymShift   = 0;     (* left- and right- shift are equivalent     *)
  166.   ixSymCaps    = 1;     (* either shift or caps lock are equivalent  *)
  167.   ixSymAlt     = 2;     (* left- and right- alt are equivalent       *)
  168.  
  169.   ixSymShiftMask = ie.QualifierSet{ie.lShift,ie.rShift};
  170.   ixSymCapsMask  = ixSymShiftMask + ie.QualifierSet{ie.capsLock};
  171.   ixSymAltMask   = ie.QualifierSet{ie.lAlt,ie.rAlt};
  172.  
  173. (* constant for InputXpression.ix_QualMask *)
  174.   ixNormalQuals = ie.QualifierSet{ie.lShift..ie.leftButton};
  175.  
  176. (*****************************************************************************)
  177.  
  178.  
  179. (* Error returns from CxBroker() *)
  180.   errOk       = 0;  (* No error                             *)
  181.   errSysErr   = 1;  (* System error, no memory, etc         *)
  182.   errDup      = 2;  (* uniqueness violation                 *)
  183.   errVersion  = 3;  (* didn't understand NewBroker.version  *)
  184.  
  185.  
  186. (*****************************************************************************)
  187.  
  188.  
  189. (* Return values from CxObjError() *)
  190.   coErrIsNull      = 0;  (* you called CxError(NULL)            *)
  191.   coErrNullAttach  = 1;  (* someone attached NULL to my list    *)
  192.   coErrBadFilter   = 2;  (* a bad filter description was given  *)
  193.   coErrBadType     = 3;  (* unmatched type-specific operation   *)
  194.  
  195. END CommoditiesD.
  196.