home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D3.DMS / in.adf / Interfaces / ASL.mod < prev    next >
Encoding:
Text File  |  1993-05-21  |  15.7 KB  |  401 lines

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