home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / ASL.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  16.6 KB  |  467 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: ASL.mod $
  4.   Description: Interface to asl.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1989-1993 Commodore-Amiga Inc.
  14.   (C) Copyright 1989-1990 Charlie Heath
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  24. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  25. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  26.  
  27. MODULE [2] ASL;
  28.  
  29. IMPORT
  30.   SYS := SYSTEM, Kernel, e := Exec, u := Utility, gfx := Graphics,
  31.   w := Workbench, s := Sets;
  32.  
  33. (*
  34. **      $VER: asl.h 38.5 (5.1.93)
  35. **
  36. **      ASL library structures and constants
  37. *)
  38.  
  39. (*****************************************************************************)
  40.  
  41. CONST
  42.  
  43.   aslName *  = "asl.library";
  44.   aslTag *   = u.user+080000H;
  45.  
  46.  
  47. (*****************************************************************************)
  48.  
  49. CONST
  50.  
  51. (* Types of requesters known to ASL, used as arguments to AllocAslRequest() *)
  52.   fileRequest * = 0;
  53.   fontRequest * = 1;
  54.   screenModeRequest * = 2;
  55.  
  56. (************************************************************************)
  57. CONST
  58. (*
  59.  * common tag arguments
  60.  *)
  61.  
  62.  
  63. (* Window control *)
  64.   window         * = aslTag+2;   (* Parent window                    *)
  65.   screen         * = aslTag+40;  (* Screen to open on if no window   *)
  66.   pubScreenName  * = aslTag+41;  (* Name of public screen            *)
  67.   privateIDCMP   * = aslTag+42;  (* Allocate private IDCMP?          *)
  68.   intuiMsgFunc   * = aslTag+70;  (* Function to handle IntuiMessages *)
  69.   sleepWindow    * = aslTag+43;  (* Block input in ASLFO_WindoU?     *)
  70.   userData       * = aslTag+52;  (* What to put in fo_UserData       *)
  71.  
  72. (* Text display *)
  73.   textAttr       * = aslTag+51;  (* Text font to use for gadget text *)
  74.   locale         * = aslTag+50;  (* Locale ASL should use for text   *)
  75.   titleText      * = aslTag+1;   (* Title of requester               *)
  76.   positiveText   * = aslTag+18;  (* Positive gadget text             *)
  77.   negativeText   * = aslTag+19;  (* Negative gadget text             *)
  78.  
  79. (* Initial settings *)
  80.   initialLeftEdge * = aslTag+3;   (* Initial requester coordinates    *)
  81.   initialTopEdge  * = aslTag+4;
  82.   initialWidth    * = aslTag+5;   (* Initial requester dimensions     *)
  83.   initialHeight   * = aslTag+6;
  84.  
  85. (* Filtering *)
  86.   filterFunc     * = aslTag+49;  (* Function to filter fonts         *)
  87.   hookFunc       * = aslTag+7;   (* Combined callback function       *)
  88.  
  89. (*
  90. ** Requester base type, for type compatibility between requester
  91. ** structures
  92. *)
  93.  
  94. TYPE
  95.  
  96.   ASLRequesterPtr * = POINTER TO ASLRequester;
  97.   ASLRequester * = RECORD END;
  98.  
  99. (*****************************************************************************
  100.  *
  101.  * ASL File Requester data structures and constants
  102.  *
  103.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  104.  * Control of the various fields is provided via tags when the requester
  105.  * is created with AllocAslRequest() and when it is displayed via
  106.  * AslRequest()
  107.  *)
  108.  
  109. TYPE
  110.  
  111.   FileRequesterPtr * = POINTER TO FileRequester;
  112.   FileRequester * = RECORD (ASLRequester)
  113.     reserved0 - : ARRAY 4 OF e.UBYTE;
  114.     file -      : e.LSTRPTR;            (* Contents of File gadget on exit    *)
  115.     drawer -    : e.LSTRPTR;            (* Contents of Drawer gadget on exit  *)
  116.     reserved1 - : ARRAY 10 OF e.UBYTE;
  117.     leftEdge -  : INTEGER;              (* Coordinates of requester on exit   *)
  118.     topEdge -   : INTEGER;
  119.     width -     : INTEGER;
  120.     height -    : INTEGER;
  121.     reserved2 - : ARRAY 2 OF e.UBYTE;
  122.     numArgs -   : LONGINT;              (* Number of files selected           *)
  123.     argList -   : w.WBArgumentsPtr;     (* List of files selected     *)
  124.     userData -  : e.APTR;               (* You can store your own data here   *)
  125.     reserved3 - : ARRAY 8 OF e.UBYTE;
  126.     pattern -   : e.LSTRPTR;            (* Contents of Pattern gadget on exit *)
  127.   END;
  128.  
  129. CONST
  130.  
  131. (* File requester tag values, used by AllocAslRequest() and AslRequest() *)
  132.  
  133. (* Window control *)
  134.   (* see common tags above *)
  135.  
  136. (* Text display *)
  137.   (* see common tags above *)
  138.  
  139. (* Initial settings *)
  140.   (* see common tags above *)
  141.   initialFile *     = aslTag+8;   (* Initial contents of File gadget  *)
  142.   initialDrawer *   = aslTag+9;   (* Initial contents of Drawer gadg. *)
  143.   initialPattern *  = aslTag+10;  (* Initial contents of Pattern gadg.*)
  144.  
  145. (* Options *)
  146.   flags1 *          = aslTag+20;  (* Option flags                     *)
  147.   flags2 *          = aslTag+22;  (* Additional option flags          *)
  148.   doSaveMode *      = aslTag+44;  (* Being used for saving?           *)
  149.   doMultiSelect *   = aslTag+45;  (* Do multi-select?                 *)
  150.   doPatterns *      = aslTag+46;  (* Display a Pattern gadget?        *)
  151.  
  152. (* Filtering *)
  153.   (* see common tags above *)
  154.   drawersOnly *     = aslTag+47;  (* Don't display files?             *)
  155.   rejectIcons *     = aslTag+60;  (* Display .info files?             *)
  156.   rejectPattern *   = aslTag+61;  (* Don't display files matching pat *)
  157.   acceptPattern *   = aslTag+62;  (* Accept only files matching pat   *)
  158.   filterDrawers *   = aslTag+63;  (* Also filter drawers with patterns*)
  159.  
  160. (* Flag bits for the flags1 tag *)
  161.   frFilterFunc *      = 7;
  162.   frIntuiFunc *       = 6;
  163.   frDoSaveMode *      = 5;
  164.   frPrivateIDCMP *    = 4;
  165.   frDoMultiSelect *   = 3;
  166.   frDoPatterns *      = 0;
  167.  
  168. (* Flag bits for the flags2 tag *)
  169.   frDrawersOnly *     = 0;
  170.   frFilterDrawers *   = 1;
  171.   frRejectIcons *     = 2;
  172.  
  173.  
  174. (*****************************************************************************
  175.  *
  176.  * ASL Font Requester data structures and constants
  177.  *
  178.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  179.  * Control of the various fields is provided via tags when the requester
  180.  * is created with AllocAslRequest() and when it is displayed via
  181.  * AslRequest()
  182.  *)
  183.  
  184. TYPE
  185.  
  186.   FontRequesterPtr * = POINTER TO FontRequester;
  187.   FontRequester * = RECORD (ASLRequester)
  188.     reserved0 - : ARRAY 8 OF e.UBYTE;
  189.     attr -      : gfx.TextAttr;  (* Returned TextAttr                *)
  190.     frontPen -  : SHORTINT;      (* Returned front pen               *)
  191.     backPen -   : SHORTINT;      (* Returned back pen                *)
  192.     drawMode -  : s.SET8;        (* Returned drawing mode            *)
  193.     reserved1 - : e.UBYTE;
  194.     userData -  : e.APTR;        (* You can store your own data here *)
  195.     leftEdge -  : INTEGER;       (* Coordinates of requester on exit *)
  196.     topEdge -   : INTEGER;
  197.     width -     : INTEGER;
  198.     height -    : INTEGER;
  199.     tAttr -     : gfx.TTextAttr; (* Returned TTextAttr               *)
  200.   END;
  201.  
  202. CONST
  203.  
  204. (* Font requester tag values, used by AllocAslRequest() and AslRequest() *)
  205.  
  206. (* Window control *)
  207.   (* see common tags above *)
  208.  
  209. (* Text display *)
  210.   (* see common tags above *)
  211.  
  212. (* Initial settings *)
  213.   (* see common tags above *)
  214.   initialName *     = aslTag+10;  (* Initial contents of Name gadget  *)
  215.   initialSize *     = aslTag+11;  (* Initial contents of Size gadget  *)
  216.   initialStyle *    = aslTag+12;  (* Initial font style               *)
  217.   initialFlags *    = aslTag+13;  (* Initial font flags for TextAttr  *)
  218.   initialFrontPen * = aslTag+14;  (* Initial front pen                *)
  219.   initialBackPen *  = aslTag+15;  (* Initial back pen                 *)
  220.   initialDrawMode * = aslTag+59;  (* Initial draw mode                *)
  221.  
  222. (* Options *)
  223.   flags *           = aslTag+20;  (* Option flags                     *)
  224.   doFrontPen *      = aslTag+44;  (* Display Front color selector?    *)
  225.   doBackPen *       = aslTag+45;  (* Display Back color selector?     *)
  226.   doStyle *         = aslTag+46;  (* Display Style checkboxes?        *)
  227.   doDrawMode *      = aslTag+47;  (* Display DrawMode cycle gadget?   *)
  228.  
  229. (* Filtering *)
  230.   fixedWidthOnly *  = aslTag+48;  (* Only allow fixed-width fonts?    *)
  231.   minHeight *       = aslTag+16;  (* Minimum font height to display   *)
  232.   maxHeight *       = aslTag+17;  (* Maximum font height to display   *)
  233.   maxFrontPen *     = aslTag+66;  (* Max # of colors in front palette *)
  234.   maxBackPen *      = aslTag+67;  (* Max # of colors in back palette  *)
  235.  
  236. (* Custom additions *)
  237.   modeList *        = aslTag+21;  (* Substitute list for drawmodes    *)
  238.   frontPens *       = aslTag+64;  (* Color table for front pen palette*)
  239.   backPens *        = aslTag+65;  (* Color table for back pen palette *)
  240.  
  241. (* Flag bits for foFlags tag *)
  242.   foDoFrontPen *     = 0;
  243.   foDoBackPen *      = 1;
  244.   foDoStyle *        = 2;
  245.   foDoDrawMode *     = 3;
  246.   foFixedWidthOnly * = 4;
  247.   foPrivateIDCMP *   = 5;
  248.   foIntuiFunc *      = 6;
  249.   foFilterFunc *     = 7;
  250.  
  251. (*****************************************************************************
  252.  *
  253.  * ASL Screen Mode Requester data structures and constants
  254.  *
  255.  * This structure must only be allocated by asl.library and is READ-ONLY!
  256.  * Control of the various fields is provided via tags when the requester
  257.  * is created with AllocAslRequest() and when it is displayed via
  258.  * AslRequest()
  259.  *)
  260.  
  261. TYPE
  262.  
  263.   ScreenModeRequesterPtr * = POINTER TO ScreenModeRequester;
  264.   ScreenModeRequester * = RECORD (ASLRequester)
  265.     displayID -     : e.ULONG;  (* Display mode ID                  *)
  266.     displayWidth -  : e.ULONG;  (* Width of display in pixels       *)
  267.     displayHeight - : e.ULONG;  (* Height of display in pixels      *)
  268.     displayDepth -  : e.UWORD;  (* Number of bit-planes of display  *)
  269.     overscanType -  : e.UWORD;  (* Type of overscan of display      *)
  270.     autoScroll -    : BOOLEAN;  (* Display should auto-scroll?      *)
  271.     pad1            : SHORTINT;
  272.  
  273.     bitMapWidth -   : e.ULONG;  (* Used to create your own BitMap   *)
  274.     bitMapHeight -  : e.ULONG;
  275.  
  276.     leftEdge -      : INTEGER;  (* Coordinates of requester on exit *)
  277.     topEdge -       : INTEGER;
  278.     width -         : INTEGER;
  279.     height -        : INTEGER;
  280.  
  281.     infoOpened -    : BOOLEAN;  (* Info window opened on exit?      *)
  282.     pad2            : SHORTINT;
  283.     infoLeftEdge -  : INTEGER;  (* Last coordinates of Info window  *)
  284.     infoTopEdge -   : INTEGER;
  285.     infoWidth -     : INTEGER;
  286.     infoHeight -    : INTEGER;
  287.  
  288.     userData -      : e.APTR;   (* You can store your own data here *)
  289.   END;
  290.  
  291. (* An Exec list of custom modes can be added to the list of available modes.
  292.  * The DimensionInfo structure must be completely initialized, including the
  293.  * Header. See <graphics/displayinfo.h>. Custom mode ID's must be in the range
  294.  * 0xFFFF0000..0xFFFFFFFF. Regular properties which apply to your custom modes
  295.  * can be added in the dn_PropertyFlags field. Custom properties are not
  296.  * allowed.
  297.  *)
  298.  
  299.   DisplayModePtr * = POINTER TO DisplayMode;
  300.   DisplayMode * = RECORD (e.NodeBase)
  301.     node *          : e.Node;            (* see ln_Name           *)
  302.     dimensionInfo * : gfx.DimensionInfo; (* mode description      *)
  303.     propertyFlags * : s.SET32;           (* applicable properties *)
  304.   END;
  305.  
  306. CONST
  307.  
  308. (* ScreenMode requester tag values, used by AllocAslRequest() and AslRequest() *)
  309.  
  310. (* Window control *)
  311.   (* see common tags above *)
  312.  
  313. (* Text display *)
  314.   (* see common tags above *)
  315.  
  316. (* Initial settings *)
  317.   (* see common tags above *)
  318.   initialDisplayID * = aslTag+100;      (* Initial display mode id     *)
  319.   initialDisplayWidth * = aslTag+101;   (* Initial display width       *)
  320.   initialDisplayHeight * = aslTag+102;  (* Initial display height      *)
  321.   initialDisplayDepth * = aslTag+103;   (* Initial display depth       *)
  322.   initialOverscanType * = aslTag+104;   (* Initial type of overscan    *)
  323.   initialAutoScroll * = aslTag+105;     (* Initial autoscroll setting  *)
  324.   initialInfoOpened * = aslTag+106;     (* Info wndw initially opened? *)
  325.   initialInfoLeftEdge * = aslTag+107;   (* Initial Info window coords. *)
  326.   initialInfoTopEdge * = aslTag+108;
  327.  
  328. (* Options *)
  329.   doWidth *         = aslTag+109;       (* Display Width gadget?           *)
  330.   doHeight *        = aslTag+110;       (* Display Height gadget?          *)
  331.   doDepth *         = aslTag+111;       (* Display Depth gadget?           *)
  332.   doOverscanType *  = aslTag+112;       (* Display Overscan Type gadget?   *)
  333.   doAutoScroll *    = aslTag+113;       (* Display AutoScroll gadget?      *)
  334.  
  335. (* Filtering *)
  336.   smPropertyFlags *   = aslTag+114;       (* Must have these Property flags  *)
  337.   smPropertyMask *    = aslTag+115;       (* Only these should be looked at  *)
  338.   smMinWidth *        = aslTag+116;       (* Minimum display width to allow  *)
  339.   smMaxWidth *        = aslTag+117;       (* Maximum display width to allow  *)
  340.   smMinHeight *       = aslTag+118;       (* Minimum display height to allow *)
  341.   smMaxHeight *       = aslTag+119;       (* Maximum display height to allow *)
  342.   smMinDepth *        = aslTag+120;       (* Minimum display depth           *)
  343.   smMaxDepth *        = aslTag+121;       (* Maximum display depth           *)
  344.   smFilterFunc *      = aslTag+122;       (* Function to filter mode id's    *)
  345.  
  346. (* Custom additions *)
  347.   customSMList *    = aslTag+123;       (* Exec list of struct DisplayMode *)
  348.  
  349.  
  350. (*****************************************************************************
  351.  *
  352.  * Obsolete ASL definitions, here for source code compatibility only.
  353.  * Please do NOT use in new code.
  354.  *
  355.  *)
  356.  
  357. CONST
  358.  
  359.   fonFrontColor * = 0;
  360.   fonBackColor  * = 1;
  361.   fonStyles     * = 2;
  362.   fonDrawMode   * = 3;
  363.   fonFixedWidth * = 4;
  364.   fonNewIDCMP   * = 5;
  365.   fonDoMsgFunc  * = 6;
  366.   fonDoWildFunc * = 7;
  367.  
  368.   doWildFunc   * = frFilterFunc;
  369.   doMsgFunc    * = frIntuiFunc;
  370.   save         * = frDoSaveMode;
  371.   newIDCMP     * = frPrivateIDCMP;
  372.   multiSelect  * = frDoMultiSelect;
  373.   patGad       * = frDoPatterns;
  374.   noFiles      * = frDrawersOnly;
  375.  
  376.   aslDummy    * = aslTag;
  377.  
  378.   hail        * = aslDummy+1;    (* Hailing text follows              *)
  379.   leftEdge    * = aslDummy+3;    (* Initialize LeftEdge               *)
  380.   topEdge     * = aslDummy+4;    (* Initialize TopEdge                *)
  381.   width       * = aslDummy+5;
  382.   height      * = aslDummy+6;
  383.  
  384. (* Tags specific to file request                                             *)
  385.   file        * = aslDummy+8;    (* Initial name of file follows      *)
  386.   dir         * = aslDummy+9;    (* Initial string of filerequest dir *)
  387.  
  388. (* Tags specific to font request                                             *)
  389.   fontName    * = aslDummy+10;   (* Initial font name                 *)
  390.   fontHeight  * = aslDummy+11;   (* Initial font height               *)
  391.   fontStyles  * = aslDummy+12;   (* Initial font styles               *)
  392.   fontFlags   * = aslDummy+13;   (* Initial font flags for textattr   *)
  393.   frontPen    * = aslDummy+14;   (* Initial frontpen color            *)
  394.   backPen     * = aslDummy+15;   (* Initial backpen color             *)
  395.  
  396.   okText      * = aslDummy+18;   (* Text displayed in OK gadget       *)
  397.   cancelText  * = aslDummy+19;   (* Text displayed in CANCEL gadget   *)
  398.   funcFlags   * = aslDummy+20;   (* Function flags, depend on request *)
  399.  
  400.   extFlags1   * = aslDummy+22;   (* For passing extended FIL1F flags   *)
  401.  
  402.   pattern     * = fontName;      (* File requester pattern string     *)
  403.  
  404. (******** END of ASL Tag values *****************************************)
  405.  
  406. CONST
  407.  
  408. (** --- Library Base variable -------------------------------------------- *)
  409.  
  410. VAR
  411.  
  412.   base *, asl * : e.LibraryPtr;
  413.  
  414.  
  415. (** --- Library Functions ------------------------------------------------ *)
  416.  
  417. (*
  418. **      $VER: asl_protos.h 38.3 (19.3.92)
  419. *)
  420.  
  421. (*--- functions in V36 or higher (distributed as Release 2.0) ---*)
  422.  
  423. (* OBSOLETE -- Please use the generic requester functions instead *)
  424.  
  425. PROCEDURE AllocFileRequest* [base,-30] ()
  426.   : FileRequesterPtr;
  427. PROCEDURE FreeFileRequest* [base,-36]
  428.   ( fileReq [8] : FileRequesterPtr );
  429. PROCEDURE RequestFile* [base,-42]
  430.   ( fileReq [8] : FileRequesterPtr )
  431.   : BOOLEAN;
  432. PROCEDURE AllocAslRequest* [base,-48]
  433.   ( type    [0] : e.ULONG;
  434.     tagList [8] : ARRAY OF u.TagItem )
  435.   : ASLRequesterPtr;
  436. PROCEDURE AllocAslRequestTags* [base,-48]
  437.   ( type    [0]   : e.ULONG;
  438.     tagList [8].. : u.Tag )
  439.   : ASLRequesterPtr;
  440. PROCEDURE FreeAslRequest* [base,-54]
  441.   ( request [8] : ASLRequesterPtr );
  442. PROCEDURE AslRequest* [base,-60]
  443.   ( request [8] : ASLRequesterPtr;
  444.     tagList [9] : ARRAY OF u.TagItem )
  445.   : BOOLEAN;
  446. PROCEDURE AslRequestTags* [base,-60]
  447.   ( request [8]   : ASLRequesterPtr;
  448.     tagList [9].. : u.Tag )
  449.   : BOOLEAN;
  450.  
  451. (*--- Library Base variable --------------------------------------------*)
  452.  
  453. <*$LongVars-*>
  454.  
  455. (*------------------------------------*)
  456. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  457.  
  458. BEGIN (* CloseLib *)
  459.   IF base # NIL THEN e.CloseLibrary (base) END
  460. END CloseLib;
  461.  
  462. BEGIN
  463.   base := e.OpenLibrary (aslName, e.libraryMinimum);
  464.   IF base # NIL THEN Kernel.SetCleanup (CloseLib) END;
  465.   asl := base
  466. END ASL.
  467.