home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / obero / oberon-a / source / amiga / asl.mod < prev    next >
Text File  |  1994-08-08  |  18KB  |  495 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: ASL.mod $
  4.   Description: Interface to asl.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 01:12:29 $
  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, 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. MODULE ASL;
  24.  
  25. (*
  26. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  27. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  28. ** $V- OvflChk       $Z- ZeroVars
  29. *)
  30.  
  31. IMPORT
  32.   E := Exec, U := Utility, G := Graphics, W := Workbench, SYS := SYSTEM;
  33.  
  34. (*
  35. **      $VER: asl.h 38.5 (5.1.93)
  36. **
  37. **      ASL library structures and constants
  38. *)
  39.  
  40. (*****************************************************************************)
  41.  
  42. CONST
  43.  
  44.   name * = "asl.library";
  45.   tb *   = U.tagUser+080000H;
  46.  
  47.  
  48. (*****************************************************************************)
  49.  
  50. CONST
  51.  
  52. (* Types of requesters known to ASL, used as arguments to AllocAslRequest() *)
  53.   fileRequest * = 0;
  54.   fontRequest * = 1;
  55.   screenModeRequest * = 2;
  56.  
  57. (*
  58. ** Requester base type, for type compatibility between requester
  59. ** structures
  60. *)
  61.  
  62. TYPE
  63.  
  64.   RequesterBasePtr * = CPOINTER TO RequesterBase;
  65.   RequesterBase * = RECORD END;
  66.  
  67. (*****************************************************************************
  68.  *
  69.  * ASL File Requester data structures and constants
  70.  *
  71.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  72.  * Control of the various fields is provided via tags when the requester
  73.  * is created with AllocAslRequest() and when it is displayed via
  74.  * AslRequest()
  75.  *)
  76.  
  77. TYPE
  78.  
  79.   FileRequesterPtr * = CPOINTER TO FileRequester;
  80.   FileRequester * = RECORD (RequesterBase)
  81.     reserved0 - : ARRAY 4 OF E.UBYTE;
  82.     file -      : E.STRPTR;             (* Contents of File gadget on exit    *)
  83.     drawer -    : E.STRPTR;             (* Contents of Drawer gadget on exit  *)
  84.     reserved1 - : ARRAY 10 OF E.UBYTE;
  85.     leftEdge -  : INTEGER;              (* Coordinates of requester on exit   *)
  86.     topEdge -   : INTEGER;
  87.     width -     : INTEGER;
  88.     height -    : INTEGER;
  89.     reserved2 - : ARRAY 2 OF E.UBYTE;
  90.     numArgs -   : LONGINT;              (* Number of files selected           *)
  91.     argList -   : W.WBArgPtr;           (* List of files selected     *)
  92.     userData -  : E.APTR;               (* You can store your own data here   *)
  93.     reserved3 - : ARRAY 8 OF E.UBYTE;
  94.     pattern -   : E.STRPTR;             (* Contents of Pattern gadget on exit *)
  95.   END;
  96.  
  97. CONST
  98.  
  99. (* File requester tag values, used by AllocAslRequest() and AslRequest() *)
  100.  
  101. (* Window control *)
  102.   frWindow *          = tb+2;   (* Parent window                    *)
  103.   frScreen *          = tb+40;  (* Screen to open on if no window   *)
  104.   frPubScreenName *   = tb+41;  (* Name of public screen            *)
  105.   frPrivateIDCMP *    = tb+42;  (* Allocate private IDCMP?          *)
  106.   frIntuiMsgFunc *    = tb+70;  (* Function to handle IntuiMessages *)
  107.   frSleepWindow *     = tb+43;  (* Block input in FR_Window?     *)
  108.   frUserData *        = tb+52;  (* What to put in userData       *)
  109.  
  110. (* Text display *)
  111.   frTextAttr *        = tb+51;  (* Text font to use for gadget text *)
  112.   frLocale *          = tb+50;  (* Locale  should use for text   *)
  113.   frTitleText *       = tb+1;   (* Title of requester               *)
  114.   frPositiveText *    = tb+18;  (* Positive gadget text             *)
  115.   frNegativeText *    = tb+19;  (* Negative gadget text             *)
  116.  
  117. (* Initial settings *)
  118.   frInitialLeftEdge * = tb+3;   (* Initial requester coordinates    *)
  119.   frInitialTopEdge *  = tb+4;
  120.   frInitialWidth *    = tb+5;   (* Initial requester dimensions     *)
  121.   frInitialHeight *   = tb+6;
  122.   frInitialFile *     = tb+8;   (* Initial contents of File gadget  *)
  123.   frInitialDrawer *   = tb+9;   (* Initial contents of Drawer gadg. *)
  124.   frInitialPattern *  = tb+10;  (* Initial contents of Pattern gadg.*)
  125.  
  126. (* Options *)
  127.   frFlags1 *          = tb+20;  (* Option flags                     *)
  128.   frFlags2 *          = tb+22;  (* Additional option flags          *)
  129.   frDoSaveMode *      = tb+44;  (* Being used for saving?           *)
  130.   frDoMultiSelect *   = tb+45;  (* Do multi-select?                 *)
  131.   frDoPatterns *      = tb+46;  (* Display a Pattern gadget?        *)
  132.  
  133. (* Filtering *)
  134.   frDrawersOnly *     = tb+47;  (* Don't display files?             *)
  135.   frFilterFunc *      = tb+49;  (* Function to filter files         *)
  136.   frRejectIcons *     = tb+60;  (* Display .info files?             *)
  137.   frRejectPattern *   = tb+61;  (* Don't display files matching pat *)
  138.   frAcceptPattern *   = tb+62;  (* Accept only files matching pat   *)
  139.   frFilterDrawers *   = tb+63;  (* Also filter drawers with patterns*)
  140.   frHookFunc *        = tb+7;   (* Combined callback function       *)
  141.  
  142. (* Flag bits for the frFlags1 tag *)
  143.   frbFilterFunc *      = 7;
  144.   frbIntuiFunc *       = 6;
  145.   frbDoSaveMode *      = 5;
  146.   frbPrivateIDCMP *    = 4;
  147.   frbDoMultiSelect *   = 3;
  148.   frbDoPatterns *      = 0;
  149.  
  150. (* Flag bits for the frFlags2 tag *)
  151.   frbDrawersOnly *     = 0;
  152.   frbFilterDrawers *   = 1;
  153.   frbRejectIcons *     = 2;
  154.  
  155.  
  156. (*****************************************************************************
  157.  *
  158.  * ASL Font Requester data structures and constants
  159.  *
  160.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  161.  * Control of the various fields is provided via tags when the requester
  162.  * is created with AllocAslRequest() and when it is displayed via
  163.  * AslRequest()
  164.  *)
  165.  
  166. TYPE
  167.  
  168.   FontRequesterPtr * = CPOINTER TO FontRequester;
  169.   FontRequester * = RECORD (RequesterBase)
  170.     reserved0 - : ARRAY 8 OF E.UBYTE;
  171.     attr -      : G.TextAttr;           (* Returned TextAttr                *)
  172.     frontPen -  : E.UBYTE;              (* Returned front pen               *)
  173.     backPen -   : E.UBYTE;              (* Returned back pen                *)
  174.     drawMode -  : E.UBYTE;              (* Returned drawing mode            *)
  175.     reserved1 - : E.UBYTE;
  176.     userData -  : E.APTR;               (* You can store your own data here *)
  177.     leftEdge -  : INTEGER;              (* Coordinates of requester on exit *)
  178.     topEdge -   : INTEGER;
  179.     width -     : INTEGER;
  180.     height -    : INTEGER;
  181.     tAttr -     : G.TTextAttr;          (* Returned TTextAttr               *)
  182.   END;
  183.  
  184. CONST
  185.  
  186. (* Font requester tag values, used by AllocAslRequest() and AslRequest() *)
  187.  
  188. (* Window control *)
  189.   foWindow *          = tb+2;   (* Parent window                    *)
  190.   foScreen *          = tb+40;  (* Screen to open on if no window   *)
  191.   foPubScreenName *   = tb+41;  (* Name of public screen            *)
  192.   foPrivateIDCMP *    = tb+42;  (* Allocate private IDCMP?          *)
  193.   foIntuiMsgFunc *    = tb+70;  (* Function to handle IntuiMessages *)
  194.   foSleepWindow *     = tb+43;  (* Block input in FO_Window?     *)
  195.   foUserData *        = tb+52;  (* What to put in fo_UserData       *)
  196.  
  197. (* Text display *)
  198.   foTextAttr *        = tb+51;  (* Text font to use for gadget text *)
  199.   foLocale *          = tb+50;  (* Locale ASL should use for text   *)
  200.   foTitleText *       = tb+1;   (* Title of requester               *)
  201.   foPositiveText *    = tb+18;  (* Positive gadget text             *)
  202.   foNegativeText *    = tb+19;  (* Negative gadget text             *)
  203.  
  204. (* Initial settings *)
  205.   foInitialLeftEdge * = tb+3;   (* Initial requester coordinates    *)
  206.   foInitialTopEdge *  = tb+4;
  207.   foInitialWidth *    = tb+5;   (* Initial requester dimensions     *)
  208.   foInitialHeight *   = tb+6;
  209.   foInitialName *     = tb+10;  (* Initial contents of Name gadget  *)
  210.   foInitialSize *     = tb+11;  (* Initial contents of Size gadget  *)
  211.   foInitialStyle *    = tb+12;  (* Initial font style               *)
  212.   foInitialFlags *    = tb+13;  (* Initial font flags for TextAttr  *)
  213.   foInitialFrontPen * = tb+14;  (* Initial front pen                *)
  214.   foInitialBackPen *  = tb+15;  (* Initial back pen                 *)
  215.   foInitialDrawMode * = tb+59;  (* Initial draw mode                *)
  216.  
  217. (* Options *)
  218.   foFlags *           = tb+20;  (* Option flags                     *)
  219.   foDoFrontPen *      = tb+44;  (* Display Front color selector?    *)
  220.   foDoBackPen *       = tb+45;  (* Display Back color selector?     *)
  221.   foDoStyle *         = tb+46;  (* Display Style checkboxes?        *)
  222.   foDoDrawMode *      = tb+47;  (* Display DrawMode cycle gadget?   *)
  223.  
  224. (* Filtering *)
  225.   foFixedWidthOnly *  = tb+48;  (* Only allow fixed-width fonts?    *)
  226.   foMinHeight *       = tb+16;  (* Minimum font height to display   *)
  227.   foMaxHeight *       = tb+17;  (* Maximum font height to display   *)
  228.   foFilterFunc *      = tb+49;  (* Function to filter fonts         *)
  229.   foHookFunc *        = tb+7;   (* Combined callback function       *)
  230.   foMaxFrontPen *     = tb+66;  (* Max # of colors in front palette *)
  231.   foMaxBackPen *      = tb+67;  (* Max # of colors in back palette  *)
  232.  
  233. (* Custom additions *)
  234.   foModeList *        = tb+21;  (* Substitute list for drawmodes    *)
  235.   foFrontPens *       = tb+64;  (* Color table for front pen palette*)
  236.   foBackPens *        = tb+65;  (* Color table for back pen palette *)
  237.  
  238. (* Flag bits for foFlags tag *)
  239.   fobDoFrontPen *     = 0;
  240.   fobDoBackPen *      = 1;
  241.   fobDoStyle *        = 2;
  242.   fobDoDrawMode *     = 3;
  243.   fobFixedWidthOnly * = 4;
  244.   fobPrivateIDCMP *   = 5;
  245.   fobIntuiFunc *      = 6;
  246.   fobFilterFunc *     = 7;
  247.  
  248. (*****************************************************************************
  249.  *
  250.  * ASL Screen Mode Requester data structures and constants
  251.  *
  252.  * This structure must only be allocated by asl.library and is READ-ONLY!
  253.  * Control of the various fields is provided via tags when the requester
  254.  * is created with AllocAslRequest() and when it is displayed via
  255.  * AslRequest()
  256.  *)
  257.  
  258. TYPE
  259.  
  260.   ScreenModeRequesterPtr * = CPOINTER TO ScreenModeRequester;
  261.   ScreenModeRequester * = RECORD (RequesterBase)
  262.     displayID *     : E.ULONG;  (* Display mode ID                  *)
  263.     displayWidth *  : E.ULONG;  (* Width of display in pixels       *)
  264.     displayHeight * : E.ULONG;  (* Height of display in pixels      *)
  265.     displayDepth *  : E.UWORD;  (* Number of bit-planes of display  *)
  266.     overscanType *  : E.UWORD;  (* Type of overscan of display      *)
  267.     autoScroll *    : BOOLEAN;  (* Display should auto-scroll?      *)
  268.  
  269.     bitMapWidth *   : E.ULONG;  (* Used to create your own BitMap   *)
  270.     bitMapHeight *  : E.ULONG;
  271.  
  272.     leftEdge *      : INTEGER;  (* Coordinates of requester on exit *)
  273.     topEdge *       : INTEGER;
  274.     width *         : INTEGER;
  275.     height *        : INTEGER;
  276.  
  277.     infoOpened *    : BOOLEAN;  (* Info window opened on exit?      *)
  278.     infoLeftEdge *  : INTEGER;  (* Last coordinates of Info window  *)
  279.     infoTopEdge *   : INTEGER;
  280.     infoWidth *     : INTEGER;
  281.     infoHeight *    : INTEGER;
  282.  
  283.     userData *      : E.APTR;   (* You can store your own data here *)
  284.   END;
  285.  
  286. (* An Exec list of custom modes can be added to the list of available modes.
  287.  * The DimensionInfo structure must be completely initialized, including the
  288.  * Header. See <graphics/displayinfo.h>. Custom mode ID's must be in the range
  289.  * 0xFFFF0000..0xFFFFFFFF. Regular properties which apply to your custom modes
  290.  * can be added in the dn_PropertyFlags field. Custom properties are not
  291.  * allowed.
  292.  *)
  293.  
  294.   DisplayModePtr * = CPOINTER TO DisplayMode;
  295.   DisplayMode * = RECORD (E.Node)       (* see ln_Name           *)
  296.     dimensionInfo * : G.DimensionInfo;  (* mode description      *)
  297.     propertyFlags * : SET;              (* applicable properties *)
  298.   END;
  299.  
  300. CONST
  301.  
  302. (* ScreenMode requester tag values, used by AllocAslRequest() and AslRequest() *)
  303.  
  304. (* Window control *)
  305.   smWindow *          = tb+2;         (* Parent window                    *)
  306.   smScreen *          = tb+40;        (* Screen to open on if no window   *)
  307.   smPubScreenName *   = tb+41;        (* Name of public screen            *)
  308.   smPrivateIDCMP *    = tb+42;        (* Allocate private IDCMP?          *)
  309.   smIntuiMsgFunc *    = tb+70;        (* Function to handle IntuiMessages *)
  310.   smSleepWindow *     = tb+43;        (* Block input in SM_Window?     *)
  311.   smUserData *        = tb+52;        (* What to put in sm_UserData       *)
  312.  
  313. (* Text display *)
  314.   smTextAttr *        = tb+51;        (* Text font to use for gadget text *)
  315.   smLocale *          = tb+50;        (* Locale ASL should use for text   *)
  316.   smTitleText *       = tb+1;         (* Title of requester               *)
  317.   smPositiveText *    = tb+18;        (* Positive gadget text             *)
  318.   smNegativeText *    = tb+19;        (* Negative gadget text             *)
  319.  
  320. (* Initial settings *)
  321.   smInitialLeftEdge * = tb+3;         (* Initial requester coordinates    *)
  322.   smInitialTopEdge *  = tb+4;
  323.   smInitialWidth *    = tb+5;         (* Initial requester dimensions     *)
  324.   smInitialHeight *   = tb+6;
  325.   smInitialDisplayID * = tb+100;      (* Initial display mode id     *)
  326.   smInitialDisplayWidth * = tb+101;   (* Initial display width       *)
  327.   smInitialDisplayHeight * = tb+102;  (* Initial display height      *)
  328.   smInitialDisplayDepth * = tb+103;   (* Initial display depth       *)
  329.   smInitialOverscanType * = tb+104;   (* Initial type of overscan    *)
  330.   smInitialAutoScroll * = tb+105;     (* Initial autoscroll setting  *)
  331.   smInitialInfoOpened * = tb+106;     (* Info wndw initially opened? *)
  332.   smInitialInfoLeftEdge * = tb+107;   (* Initial Info window coords. *)
  333.   smInitialInfoTopEdge * = tb+108;
  334.  
  335. (* Options *)
  336.   smDoWidth *         = tb+109;       (* Display Width gadget?           *)
  337.   smDoHeight *        = tb+110;       (* Display Height gadget?          *)
  338.   smDoDepth *         = tb+111;       (* Display Depth gadget?           *)
  339.   smDoOverscanType *  = tb+112;       (* Display Overscan Type gadget?   *)
  340.   smDoAutoScroll *    = tb+113;       (* Display AutoScroll gadget?      *)
  341.  
  342. (* Filtering *)
  343.   smPropertyFlags *   = tb+114;       (* Must have these Property flags  *)
  344.   smPropertyMask *    = tb+115;       (* Only these should be looked at  *)
  345.   smMinWidth *        = tb+116;       (* Minimum display width to allow  *)
  346.   smMaxWidth *        = tb+117;       (* Maximum display width to allow  *)
  347.   smMinHeight *       = tb+118;       (* Minimum display height to allow *)
  348.   smMaxHeight *       = tb+119;       (* Maximum display height to allow *)
  349.   smMinDepth *        = tb+120;       (* Minimum display depth           *)
  350.   smMaxDepth *        = tb+121;       (* Maximum display depth           *)
  351.   smFilterFunc *      = tb+122;       (* Function to filter mode id's    *)
  352.  
  353. (* Custom additions *)
  354.   smCustomSMList *    = tb+123;       (* Exec list of struct DisplayMode *)
  355.  
  356.  
  357. (*****************************************************************************
  358.  *
  359.  * Obsolete ASL definitions, here for source code compatibility only.
  360.  * Please do NOT use in new code.
  361.  *
  362.  *)
  363.  
  364. CONST
  365.  
  366.   dummy *          = U.tagUser + 80000H;
  367.   hail *           = dummy+1;
  368.   window *         = dummy+2;
  369.   leftEdge *       = dummy+3;
  370.   topEdge *        = dummy+4;
  371.   width *          = dummy+5;
  372.   height *         = dummy+6;
  373.   hookFunc *       = dummy+7;
  374.   file *           = dummy+8;
  375.   dir *            = dummy+9;
  376.   fontName *       = dummy+10;
  377.   fontHeight *     = dummy+11;
  378.   fontStyles *     = dummy+12;
  379.   fontFlags *      = dummy+13;
  380.   frontPen *       = dummy+14;
  381.   backPen *        = dummy+15;
  382.   minHeight *      = dummy+16;
  383.   maxHeight *      = dummy+17;
  384.   okText *         = dummy+18;
  385.   cancelText *     = dummy+19;
  386.   funcFlags *      = dummy+20;
  387.   modeList *       = dummy+21;
  388.   extFlags1 *      = dummy+22;
  389.   pattern *        = fontName;
  390. (* remember what I said up there? Do not use these anymore! *)
  391.   filDoWildFunc *  = 7;
  392.   filDoMsgFunc *   = 6;
  393.   filSave *        = 5;
  394.   filNewIDCMP *    = 4;
  395.   filMultiSelect * = 3;
  396.   filPatGad *      = 0;
  397.   fil1NoFiles *    = 0;
  398.   fil1MatchDirs *  = 1;
  399.   fonFrontColor *  = 0;
  400.   fonBackColor *   = 1;
  401.   fonStyles *      = 2;
  402.   fonDrawMode *    = 3;
  403.   fonFixedWidth *  = 4;
  404.   fonNewIDCMP *    = 5;
  405.   fonDoMsgFunc *   = 6;
  406.   fonDoWildFunc *  = 7;
  407.  
  408.  
  409. (** --- Library Base variable -------------------------------------------- *)
  410.  
  411. TYPE
  412.  
  413.   AslBasePtr * = CPOINTER TO AslBase;
  414.   AslBase * = RECORD (E.Library) END;
  415.  
  416. VAR
  417.  
  418.   base *  : AslBasePtr;
  419.  
  420.  
  421. (** --- Library Functions ------------------------------------------------ *)
  422.  
  423. (*
  424. **      $VER: asl_protos.h 38.3 (19.3.92)
  425. *)
  426.  
  427. (*--- functions in V36 or higher (distributed as Release 2.0) ---*)
  428.  
  429. (* OBSOLETE -- Please use the generic requester functions instead *)
  430.  
  431. LIBCALL (base : AslBasePtr) AllocFileRequest * ()
  432.   : FileRequesterPtr;
  433.   -30;
  434. LIBCALL (base : AslBasePtr) FreeFileRequest *
  435.   ( fileReq [8] : FileRequesterPtr );
  436.   -36;
  437. LIBCALL (base : AslBasePtr) RequestFile *
  438.   ( fileReq [8] : FileRequesterPtr )
  439.   : BOOLEAN;
  440.   -42;
  441. LIBCALL (base : AslBasePtr) AllocAslRequest *
  442.   ( type    [0] : E.ULONG;
  443.     tagList [8] : ARRAY OF U.TagItem )
  444.   : RequesterBasePtr;
  445.   -48;
  446. LIBCALL (base : AslBasePtr) AllocAslRequestTags *
  447.   ( type    [0]   : E.ULONG;
  448.     tagList [8].. : U.Tag )
  449.   : RequesterBasePtr;
  450.   -48;
  451. LIBCALL (base : AslBasePtr) FreeAslRequest *
  452.   ( request [8] : RequesterBasePtr );
  453.   -54;
  454. LIBCALL (base : AslBasePtr) AslRequest *
  455.   ( request [8] : RequesterBasePtr;
  456.     tagList [9] : ARRAY OF U.TagItem )
  457.   : BOOLEAN;
  458.   -60;
  459. LIBCALL (base : AslBasePtr) AslRequestTags *
  460.   ( request [8]   : RequesterBasePtr;
  461.     tagList [9].. : U.Tag )
  462.   : BOOLEAN;
  463.   -60;
  464.  
  465. (** --- Library Base variable -------------------------------------------- *)
  466. (** $L- Address globals through A4 *)
  467.  
  468.  
  469. (*------------------------------------*)
  470. PROCEDURE* CloseLib ();
  471.  
  472. BEGIN (* CloseLib *)
  473.   IF base # NIL THEN E.base.CloseLibrary (base) END
  474. END CloseLib;
  475.  
  476. (*------------------------------------*)
  477. PROCEDURE OpenLib * (mustOpen : BOOLEAN);
  478.  
  479. BEGIN (* OpenLib *)
  480.   IF base = NIL THEN
  481.     base :=
  482.       SYS.VAL
  483.         ( AslBasePtr,
  484.           E.base.OpenLibrary (name, E.libraryMinimum) );
  485.     IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
  486.     ELSIF mustOpen THEN HALT (100)
  487.     END;
  488.   END;
  489. END OpenLib;
  490.  
  491.  
  492. BEGIN
  493.   base := NIL
  494. END ASL.
  495.