home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / oberon-a-1.4ß.lha / Oberon-A / source / amiga / Commodities.mod < prev    next >
Text File  |  1994-08-08  |  13KB  |  472 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: Commodities.mod $
  4.   Description: Interface to commodities.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:57:41 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. MODULE Commodities;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT E := Exec, IE := InputEvent, KM := KeyMap, SYS := SYSTEM;
  31.  
  32. (**-- Pointer declarations ---------------------------------------------*)
  33.  
  34. TYPE
  35.  
  36.   NewBrokerPtr *      = CPOINTER TO NewBroker;
  37.   InputXpressionPtr * = CPOINTER TO InputXpression;
  38.   IXPtr *             = CPOINTER TO IX;
  39.   CxObjPtr *          = CPOINTER TO CxObj;
  40.   CxMsgPtr *          = CPOINTER TO CxMsg;
  41.  
  42. (*
  43. **      $VER: commodities.h 38.4 (24.2.93)
  44. **
  45. **      Commodities definitions.
  46. *)
  47.  
  48. (*****************************************************************************)
  49.  
  50. TYPE
  51.  
  52.   NewBroker * = RECORD
  53.     version * :  SHORTINT;        (* Must be set to NB_VERSION *)
  54.     name *    :  E.STRPTR;
  55.     title *   :  E.STRPTR;
  56.     descr *   :  E.STRPTR;
  57.     unique *  :  E.WSET;
  58.     flags *   :  E.WSET;
  59.     pri *     :  SHORTINT;
  60.     port *    :  E.MsgPortPtr;
  61.     reservedChannel * :  INTEGER;
  62.   END;
  63.  
  64. CONST
  65.  
  66. (* constant for NewBroker.version *)
  67.   nbVersion * = 5;          (* Version of NewBroker structure *)
  68.  
  69. (* Sizes for various buffers *)
  70.   cbdNamelen * = 24;
  71.   cbdTitlelen * = 40;
  72.   cbdDescrlen * = 40;
  73.  
  74. (* Flags for NewBroker.unique *)
  75.   nbuDuplicate * = 0;
  76.   nbuUnique * = 1;             (* will not allow duplicates           *)
  77.   nbuNotify * = 2;             (* sends cxmUnique to existing broker *)
  78.  
  79. (* Flags for NewBroker.flags *)
  80.   cofShowHide * = 4;
  81.  
  82.  
  83. (*****************************************************************************)
  84.  
  85. TYPE
  86.  
  87. (* Fake data types for system private objects *)
  88.   CxObj = RECORD END;
  89.   CxMsg = RECORD END;
  90.  
  91. (* Pointer to a function returning a LONG *)
  92.   PFL = PROCEDURE () : LONGINT;
  93.  
  94.  
  95. (*****************************************************************************)
  96.  
  97. CONST
  98.  
  99. (* Commodities object types *)
  100.   invalid *    = 0;  (* not a valid object (probably null) *)
  101.   filter *     = 1;  (* input event messages only          *)
  102.   typeFilter * = 2;  (* obsolete, do not use               *)
  103.   send *       = 3;  (* sends a message                    *)
  104.   signal *     = 4;  (* sends a signal                     *)
  105.   translate *  = 5;  (* translates input event into chain  *)
  106.   broker *     = 6;  (* application representative         *)
  107.   debug *      = 7;  (* dumps info to serial port          *)
  108.   custom *     = 8;  (* application provides function      *)
  109.   zero *       = 9;  (* system terminator node             *)
  110.  
  111.  
  112. (*****************************************************************************)
  113.  
  114. CONST
  115.  
  116. (* Commodities message types *)
  117.   mIEvent * = 32;
  118.   mCommand * = 64;
  119.  
  120. (* Only mIEvent messages are passed through the input network. Other types
  121.  * of messages are sent to an optional port in your broker. This means that
  122.  * you must test the message type in your message handling, if input messages
  123.  * and command messages come to the same port.
  124.  *
  125.  * mIEvent:    Messages of this type rattle around the Commodities input
  126.  *             network. They are sent to you by a Sender object, and passed
  127.  *             to you as a synchronous function call by a Custom object.
  128.  *
  129.  *             The message port or function entry point is stored in the
  130.  *             object, and the ID field of the message will be set to what
  131.  *             you arrange issuing object.
  132.  *
  133.  *             The data section of the message will point to the input event
  134.  *             triggering the message.
  135.  *
  136.  * mCommand:   These messages are sent to a port attached to your Broker.
  137.  *             They are sent to you when the controller program wants your
  138.  *             program to do something. The ID value identifies the command.
  139.  *)
  140.  
  141. CONST
  142.  
  143. (* ID values associated with a message of type mCommand *)
  144.   cmdDisable * = 15;        (* please disable yourself         *)
  145.   cmdEnable * = 17;         (* please enable yourself  *)
  146.   cmdAppear * = 19;         (* open your window, if you can    *)
  147.   cmdDisappear * = 21;      (* go dormant                      *)
  148.   cmdKill * = 23;           (* go away for good                *)
  149.   cmdListChg * = 27;        (* Someone changed the broker list *)
  150.   cmdUnique * = 25;         (* someone tried to create a broker
  151.                              * with your name. Suggest you appear.
  152.                              *)
  153.  
  154.  
  155. (*****************************************************************************)
  156.  
  157. TYPE
  158.  
  159.   InputXpression * = RECORD
  160.     version *   :  E.UBYTE;  (* must be set to ixVersion *)
  161.     class *     :  E.UBYTE;  (* class must match exactly  *)
  162.  
  163.     code *      :  E.WSET;   (* Bits that we want *)
  164.     codeMask *  :  E.WSET;   (* Set bits here to indicate which bits in code
  165.                               * are don't care bits.
  166.                               *)
  167.     qualifier * :  E.WSET;   (* Bits that we want *)
  168.     qualMask *  :  E.WSET;   (* Set bits here to indicate which bits in
  169.                               * qualifier are don't care bits
  170.                               *)
  171.     qualSame *  :  E.WSET;   (* synonyms in qualifier *)
  172.   END;
  173.  
  174.   IX * = InputXpression;
  175.  
  176. CONST
  177.  
  178. (* constant for InputXpression.version *)
  179.   ixVersion * = 2;
  180.  
  181. (* constants for InputXpression.qualSame *)
  182.   ixsymShift * = 0;     (* left- and right- shift are equivalent     *)
  183.   ixsymCaps * = 1;      (* either shift or caps lock are equivalent  *)
  184.   ixsymAlt * = 2;       (* left- and right- alt are equivalent       *)
  185.  
  186.   ixsymShiftMask * = {IE.qualLShift, IE.qualRShift};
  187.   ixsymCapsMask * = ixsymShiftMask + {IE.qualCapsLock};
  188.   ixsymAltMask * = {IE.qualLAlt, IE.qualRAlt};
  189.  
  190. (* constant for InputXpression.qualMask *)
  191.   ixNormalQuals * = {0..14};       (* avoid RELATIVEMOUSE *)
  192.  
  193.  
  194. (*****************************************************************************)
  195.  
  196. CONST
  197.  
  198. (* Error returns from CxBroker() *)
  199.   cbErrOk * = 0;          (* No error                               *)
  200.   cbErrSysErr * = 1;      (* System error, no memory, etc           *)
  201.   cbErrDup * = 2;         (* uniqueness violation                   *)
  202.   cbErrVersion * = 3;     (* didn't understand NewBroker.nb_Version *)
  203.  
  204.  
  205. (*****************************************************************************)
  206.  
  207. CONST
  208.  
  209. (* Return values from CxObjError() *)
  210.   coErrIsNull * = 1;           (* you called CxObjError(NULL)        *)
  211.   coErrNullAttach * = 2;       (* someone attached NULL to my list   *)
  212.   coErrBadFilter * = 4;        (* a bad filter description was given *)
  213.   coErrBadType * = 8;          (* unmatched type-specific operation  *)
  214.  
  215.  
  216. (*****************************************************************************)
  217.  
  218.  
  219. (**-- Library Base variable --------------------------------------------*)
  220.  
  221. TYPE
  222.  
  223.   CommoditiesBasePtr * = CPOINTER TO CommoditiesBase;
  224.   CommoditiesBase * = RECORD (E.Library) END;
  225.  
  226. CONST
  227.  
  228.   name * = "commodities.library";
  229.  
  230. VAR
  231.  
  232.   base * : CommoditiesBasePtr;
  233.  
  234.  
  235. (**-- Library Functions ------------------------------------------------*)
  236.  
  237. (*
  238. **      $VER: commodities_protos.h 38.4 (27.2.92)
  239. *)
  240.  
  241. TYPE
  242.   CustomProcType * = PROCEDURE ( obj : CxObjPtr; msg : CxMsgPtr );
  243.  
  244. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  245.  
  246. (*  OBJECT UTILITIES *)
  247.  
  248. LIBCALL (base : CommoditiesBasePtr) CreateCxObj*
  249.   ( type [0] : E.ULONG;
  250.     arg1 [8] : SYS.LONGWORD;
  251.     arg2 [9] : SYS.LONGWORD )
  252.   : CxObjPtr;
  253.   -30;
  254. LIBCALL (base : CommoditiesBasePtr) CxBroker*
  255.   ( VAR nb    [8] : NewBroker;
  256.     VAR error [0] : LONGINT )
  257.   : CxObjPtr;
  258.   -36;
  259. LIBCALL (base : CommoditiesBasePtr) ActivateCxObj*
  260.   ( co   [8] : CxObjPtr;
  261.     true [0] : E.LBOOL )
  262.   : E.LBOOL;
  263.   -42;
  264. LIBC