Browse Source

* update for amigaos 3.9

* changed startcode for library
nils 22 years ago
parent
commit
e31a348e2b

+ 85 - 15
packages/extra/amunits/units/amigaguide.pas

@@ -26,6 +26,11 @@
     the library.
     the library.
     13 Jan 2003.
     13 Jan 2003.
 
 
+    Update for AmigaOs 3.9.
+    Added a const and a member to record tXRef;
+    Changed startupcode for library.
+    26 Jan 2003.
+
     [email protected]
     [email protected]
 }
 }
 
 
@@ -75,6 +80,9 @@ const
  AGA_ARexxPortName      = (AGA_Dummy+10);
  AGA_ARexxPortName      = (AGA_Dummy+10);
    { (STRPTR) Used to specify the ARexx port name (V40) (not copied) }
    { (STRPTR) Used to specify the ARexx port name (V40) (not copied) }
 
 
+ AGA_Secure		= (AGA_Dummy+11);
+   { (BOOL) Disable "ONOPEN", "ONCLOSE" and "LINK RX", "LINK RXS", "LINK SYSTEM" commands (V41) }
+
 Type
 Type
     AMIGAGUIDECONTEXT = Pointer;
     AMIGAGUIDECONTEXT = Pointer;
 
 
@@ -145,6 +153,7 @@ Type
     xr_File,                      { Name of document file }
     xr_File,                      { Name of document file }
     xr_Name   : STRPTR;           { Name of item }
     xr_Name   : STRPTR;           { Name of item }
     xr_Line   : Longint;          { Line defined at }
     xr_Line   : Longint;          { Line defined at }
+    xr_Reserved : array [0..1] of Ulong;
    END;
    END;
 
 
 CONST
 CONST
@@ -255,9 +264,24 @@ FUNCTION SetAmigaGuideAttrsA(cl : POINTER; attrs : pTagItem) : LONGINT;
 FUNCTION SetAmigaGuideContextA(cl : POINTER; id : ULONG; attrs : pTagItem) : LONGINT;
 FUNCTION SetAmigaGuideContextA(cl : POINTER; id : ULONG; attrs : pTagItem) : LONGINT;
 PROCEDURE UnlockAmigaGuideBase(key : LONGINT);
 PROCEDURE UnlockAmigaGuideBase(key : LONGINT);
 
 
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitAMIGAGUIDELibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    AMIGAGUIDEIsCompiledHow : longint;
+
 IMPLEMENTATION
 IMPLEMENTATION
 
 
+{$ifndef dont_use_openlib}
 uses msgbox;
 uses msgbox;
+{$endif dont_use_openlib}
+
 
 
 FUNCTION AddAmigaGuideHostA(h : pHook; name : pCHAR; attrs : pTagItem) : POINTER;
 FUNCTION AddAmigaGuideHostA(h : pHook; name : pCHAR; attrs : pTagItem) : POINTER;
 BEGIN
 BEGIN
@@ -484,9 +508,15 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of amigaguide.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of amigaguide.library}
+  {$Info don't forget to use InitAMIGAGUIDELibrary in the beginning of your program}
 
 
 var
 var
     amigaguide_exit : Pointer;
     amigaguide_exit : Pointer;
@@ -500,18 +530,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitAMIGAGUIDELibrary;
+begin
+    AmigaGuideBase := nil;
+    AmigaGuideBase := OpenLibrary(AMIGAGUIDENAME,LIBVERSION);
+    if AmigaGuideBase <> nil then begin
+        amigaguide_exit := ExitProc;
+        ExitProc := @CloseamigaguideLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open amigaguide.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    AMIGAGUIDEIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of amigaguide.library}
+
+var
+    amigaguide_exit : Pointer;
+
+procedure CloseamigaguideLibrary;
+begin
+    ExitProc := amigaguide_exit;
+    if AmigaGuideBase <> nil then begin
+        CloseLibrary(AmigaGuideBase);
+        AmigaGuideBase := nil;
+    end;
+end;
 
 
 begin
 begin
     AmigaGuideBase := nil;
     AmigaGuideBase := nil;
     AmigaGuideBase := OpenLibrary(AMIGAGUIDENAME,LIBVERSION);
     AmigaGuideBase := OpenLibrary(AMIGAGUIDENAME,LIBVERSION);
     if AmigaGuideBase <> nil then begin
     if AmigaGuideBase <> nil then begin
         amigaguide_exit := ExitProc;
         amigaguide_exit := ExitProc;
-        ExitProc := @CloseamigaguideLibrary
+        ExitProc := @CloseamigaguideLibrary;
+        AMIGAGUIDEIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open amigaguide.library version ' + VERSION + #10 +
         'Can''t open amigaguide.library version ' + VERSION + #10 +
@@ -520,23 +580,33 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of amigaguide.library compiled}
-   {$Info Make sure you open amigaguide.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    AMIGAGUIDEIsCompiledHow := 3;
+   {$Warning No autoopening of amigaguide.library compiled}
+   {$Warning Make sure you open amigaguide.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT AMIGAGUIDE *)
 END. (* UNIT AMIGAGUIDE *)
 
 
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.3  2003-01-14 18:46:04  nils
-   * added defines use_amia_smartlink and use_auto_openlib
+   Revision 1.4  2003-02-07 20:48:36  nils
+   * update for amigaos 3.9
    
    
-   * implemented autoopening of library
+   * changed startcode for library
    
    
+   Revision 1.3  2003/01/14 18:46:04  nils
+   * added defines use_amia_smartlink and use_auto_openlib
+
+   * implemented autoopening of library
+
    Revision 1.2  2002/11/17 20:28:53  nils
    Revision 1.2  2002/11/17 20:28:53  nils
    * added functions with array of const
    * added functions with array of const
-   
+
 }
 }
 
 

+ 221 - 27
packages/extra/amunits/units/asl.pas

@@ -35,6 +35,13 @@
     use_auto_openlib.
     use_auto_openlib.
     13 Jan 2003.
     13 Jan 2003.
 
 
+    Update for AmigaOS 3.9.
+    Added some const.
+    Added record  tAslSemaphore.
+    Added procedures AbortAslRequest and ActivateAslRequest.
+    Changed start code for library.
+    25 Jan 2003.
+
     [email protected]
     [email protected]
 }
 }
 
 
@@ -103,6 +110,8 @@ const
   ASLFR_IntuiMsgFunc   = ASL_TB+70;  { Function to handle IntuiMessages }
   ASLFR_IntuiMsgFunc   = ASL_TB+70;  { Function to handle IntuiMessages }
   ASLFR_SleepWindow    = ASL_TB+43;  { Block input in ASLFR_Window?     }
   ASLFR_SleepWindow    = ASL_TB+43;  { Block input in ASLFR_Window?     }
   ASLFR_UserData       = ASL_TB+52;  { What to put in fr_UserData       }
   ASLFR_UserData       = ASL_TB+52;  { What to put in fr_UserData       }
+  ASLFR_PopToFront     = ASL_TB+131; { Make the requester window visible }
+  ASLFR_Activate       = ASL_TB+132; { Activate the requester window when }
 
 
 { Text display }
 { Text display }
   ASLFR_TextAttr       = ASL_TB+51;  { Text font to use for gadget text }
   ASLFR_TextAttr       = ASL_TB+51;  { Text font to use for gadget text }
@@ -119,6 +128,7 @@ const
   ASLFR_InitialFile    = ASL_TB+8 ;  { Initial contents of File gadget  }
   ASLFR_InitialFile    = ASL_TB+8 ;  { Initial contents of File gadget  }
   ASLFR_InitialDrawer  = ASL_TB+9 ;  { Initial contents of Drawer gadg. }
   ASLFR_InitialDrawer  = ASL_TB+9 ;  { Initial contents of Drawer gadg. }
   ASLFR_InitialPattern = ASL_TB+10;  { Initial contents of Pattern gadg.}
   ASLFR_InitialPattern = ASL_TB+10;  { Initial contents of Pattern gadg.}
+  ASLFR_InitialShowVolumes = ASL_TB+130; { Initially, show the volume list (V44) }
 
 
 { Options }
 { Options }
   ASLFR_Flags1         = ASL_TB+20;  { Option flags                     }
   ASLFR_Flags1         = ASL_TB+20;  { Option flags                     }
@@ -136,6 +146,15 @@ const
   ASLFR_FilterDrawers  = ASL_TB+63;  { Also filter drawers with patterns}
   ASLFR_FilterDrawers  = ASL_TB+63;  { Also filter drawers with patterns}
   ASLFR_HookFunc       = ASL_TB+7 ;  { Combined callback function       }
   ASLFR_HookFunc       = ASL_TB+7 ;  { Combined callback function       }
 
 
+{ Sorting }
+  ASLFR_SetSortBy      = ASL_TB+124; { Sort criteria (name, date, size) }
+  ASLFR_GetSortBy      = ASL_TB+125;
+  ASLFR_SetSortDrawers = ASL_TB+126; { Placement of drawers in the list }
+  ASLFR_GetSortDrawers = ASL_TB+127;
+  ASLFR_SetSortOrder   = ASL_TB+128; { Order (ascending or descending)  }
+  ASLFR_GetSortOrder   = ASL_TB+129;
+
+
 { Flag bits for the ASLFR_Flags1 tag }
 { Flag bits for the ASLFR_Flags1 tag }
   FRB_FILTERFUNC     = 7;
   FRB_FILTERFUNC     = 7;
   FRB_INTUIFUNC      = 6;
   FRB_INTUIFUNC      = 6;
@@ -160,6 +179,19 @@ const
   FRF_FILTERDRAWERS  = 2;
   FRF_FILTERDRAWERS  = 2;
   FRF_REJECTICONS    = 4;
   FRF_REJECTICONS    = 4;
 
 
+{ Sort criteria for the ASLFR_SetSortBy/ASLFR_GetSortBy tags }
+  ASLFRSORTBY_Name   = 0;
+  ASLFRSORTBY_Date   = 1;
+  ASLFRSORTBY_Size   = 2;
+
+{ Drawer placement for the ASLFR_SetSortDrawers/ASLFR_GetSortDrawers tags }
+  ASLFRSORTDRAWERS_First  = 0;
+  ASLFRSORTDRAWERS_Mix    = 1;
+  ASLFRSORTDRAWERS_Last   = 2;
+
+{ Sort order for the ASLFR_SetSortOrder/ASLFR_GetSortOrder tags }
+  ASLFRSORTORDER_Ascend   = 0;
+  ASLFRSORTORDER_Descend  = 1;
 
 
 {****************************************************************************
 {****************************************************************************
  *
  *
@@ -200,7 +232,12 @@ const
   ASLFO_IntuiMsgFunc   = ASL_TB+70;  { Function to handle IntuiMessages }
   ASLFO_IntuiMsgFunc   = ASL_TB+70;  { Function to handle IntuiMessages }
   ASLFO_SleepWindow    = ASL_TB+43;  { Block input in ASLFO_Window?     }
   ASLFO_SleepWindow    = ASL_TB+43;  { Block input in ASLFO_Window?     }
   ASLFO_UserData       = ASL_TB+52;  { What to put in fo_UserData       }
   ASLFO_UserData       = ASL_TB+52;  { What to put in fo_UserData       }
-
+  ASLFO_PopToFront     = ASL_TB+131; { Make the requester window visible
+                                          * when it opens (V44)
+                                          }
+  ASLFO_Activate       = ASL_TB+132; { Activate the requester window when
+                                          * it opens (V45).
+                                          }
 { Text display }
 { Text display }
   ASLFO_TextAttr       = ASL_TB+51;  { Text font to use for gadget text }
   ASLFO_TextAttr       = ASL_TB+51;  { Text font to use for gadget text }
   ASLFO_Locale         = ASL_TB+50;  { Locale ASL should use for text   }
   ASLFO_Locale         = ASL_TB+50;  { Locale ASL should use for text   }
@@ -227,6 +264,7 @@ const
   ASLFO_DoBackPen      = ASL_TB+45;  { Display Back color selector?     }
   ASLFO_DoBackPen      = ASL_TB+45;  { Display Back color selector?     }
   ASLFO_DoStyle        = ASL_TB+46;  { Display Style checkboxes?        }
   ASLFO_DoStyle        = ASL_TB+46;  { Display Style checkboxes?        }
   ASLFO_DoDrawMode     = ASL_TB+47;  { Display DrawMode cycle gadget?   }
   ASLFO_DoDrawMode     = ASL_TB+47;  { Display DrawMode cycle gadget?   }
+  ASLFO_SampleText     = ASL_TB+133; { Text to display in font sample area (V45) }
 
 
 { Filtering }
 { Filtering }
   ASLFO_FixedWidthOnly = ASL_TB+48;  { Only allow fixed-width fonts?    }
   ASLFO_FixedWidthOnly = ASL_TB+48;  { Only allow fixed-width fonts?    }
@@ -324,6 +362,12 @@ const
   ASLSM_IntuiMsgFunc  =  ASL_TB+70;  { Function to handle IntuiMessages }
   ASLSM_IntuiMsgFunc  =  ASL_TB+70;  { Function to handle IntuiMessages }
   ASLSM_SleepWindow   =  ASL_TB+43;  { Block input in ASLSM_Window?     }
   ASLSM_SleepWindow   =  ASL_TB+43;  { Block input in ASLSM_Window?     }
   ASLSM_UserData      =  ASL_TB+52;  { What to put in sm_UserData       }
   ASLSM_UserData      =  ASL_TB+52;  { What to put in sm_UserData       }
+  ASLSM_PopToFront    =  ASL_TB+131; { Make the requester window visible
+                                          * when it opens (V44)
+                                          }
+  ASLSM_Activate      =  ASL_TB+132; { Activate the requester window when
+                                          * it opens (V45).
+                                          }
 
 
 { Text display }
 { Text display }
   ASLSM_TextAttr      =  ASL_TB+51;  { Text font to use for gadget text }
   ASLSM_TextAttr      =  ASL_TB+51;  { Text font to use for gadget text }
@@ -368,14 +412,80 @@ const
 { Custom additions }
 { Custom additions }
   ASLSM_CustomSMList    = ASL_TB+123;  { Exec list of struct DisplayMode }
   ASLSM_CustomSMList    = ASL_TB+123;  { Exec list of struct DisplayMode }
 
 
+{***************************************************************************}
+
+  ASL_LAST_TAG  = ASL_TB+133;
+
+{***************************************************************************}
+
+{ This defines the rendezvous data for setting and querying asl.library's
+ * defaults for the window size and the file requester sort order. The name
+ * of the semaphore is given below; it exists only with asl.library V45 and
+ * IPrefs V45 and beyond.
+ }
+  ASL_SEMAPHORE_NAME  : Pchar = 'asl.library';
+
+   type
+       PAslSemaphore = ^tAslSemaphore;
+       tAslSemaphore = record
+            as_Semaphore : tSignalSemaphore;
+            as_Version : UWORD;         { Must be >= 45 }
+            as_Size : ULONG;            { Size of this data structure. }
+            as_SortBy : UBYTE;          { File requester defaults; name, date or size }
+            as_SortDrawers : UBYTE;     { File requester defaults; first, mix or last }
+            as_SortOrder : UBYTE;       { File requester defaults; ascending or descending }
+            as_SizePosition : UBYTE;    { See below }
+            as_RelativeLeft : WORD;     { Window position offset }
+            as_RelativeTop : WORD;
+            as_RelativeWidth : UBYTE;   { Window size factor; this is
+                                         * a percentage of the parent
+                                         * window/screen width.
+					 }
+	    as_RelativeHeight : UBYTE;
+         end;
+
+const
+{ Default position of the ASL window. }
+  ASLPOS_DefaultPosition  = 0;	{ Position is calculated according to the builtin rules. }
+  ASLPOS_CenterWindow	  = 1;	{ Centred within the bounds of the parent window. }
+  ASLPOS_CenterScreen	  = 2;	{ Centred within the bounds of the parent screen. }
+  ASLPOS_WindowPosition	  = 3;	{ Relative to the top left corner of the parent window,
+					 * using the offset values provided in the
+					 * as_RelativeLeft/as_RelativeTop members.
+					 }
+  ASLPOS_ScreenPosition	  = 4;	{ Relative to the top left corner of the parent screen,
+					 * using the offset values provided in the
+					 * as_RelativeLeft/as_RelativeTop members.
+					 }
+  ASLPOS_CenterMouse	  = 5;	{ Directly below the mouse pointer. }
+  ASLPOS_MASK		  = $0F;
+
+{ Default size of the ASL window. }
+  ASLSIZE_DefaultSize	= (0 shl 4);	{ Size is calculated according to the builtin rules. }
+  ASLSIZE_RelativeSize	= (1 shl 4);	{ Size is relative to the size of the parent
+					 * window or screen, using the values provided in
+					 * the as_RelativeWidth/as_RelativeHeight members.
+					 * The as_RelativeWidth/as_RelativeHeight values are
+					 * taken as percentage, i.e. a value of "50" stands for
+					 * 50% of the width/height of the parent window/screen.
+					 }
+  ASLSIZE_MASK		= $30;
+
+{ Other options. }
+  ASLOPTION_ASLOverrides   = (1 shl 6);	{ ASL determines placement and size of requester
+					 * windows; application's choice is ignored.
+					 }
+
 
 
 {****************************************************************************
 {****************************************************************************
  *
  *
  * Obsolete ASL definitions, here for source code compatibility only.
  * Obsolete ASL definitions, here for source code compatibility only.
  * Please do NOT use in new code.
  * Please do NOT use in new code.
  *
  *
- *   ASL_V38_NAMES_ONLY to remove these older names
+ *   define ASL_V38_NAMES_ONLY to remove these older names
  }
  }
+{$define ASL_V38_NAMES_ONLY}
+{$ifndef ASL_V38_NAMES_ONLY}
 Const
 Const
   ASL_Dummy       = (TAG_USER + $80000);
   ASL_Dummy       = (TAG_USER + $80000);
   ASL_Hail        = ASL_Dummy+1 ;
   ASL_Hail        = ASL_Dummy+1 ;
@@ -434,10 +544,10 @@ Const
   FONF_NEWIDCMP    = 32;
   FONF_NEWIDCMP    = 32;
   FONF_DOMSGFUNC   = 64;
   FONF_DOMSGFUNC   = 64;
   FONF_DOWILDFUNC  = 128;
   FONF_DOWILDFUNC  = 128;
-
+{$endif ASL_V38_NAMES_ONLY}
 
 
 VAR AslBase : pLibrary;
 VAR AslBase : pLibrary;
-   
+
 
 
 FUNCTION AllocAslRequest(reqType : ULONG; tagList : pTagItem) : POINTER;
 FUNCTION AllocAslRequest(reqType : ULONG; tagList : pTagItem) : POINTER;
 FUNCTION AllocFileRequest : pFileRequester;
 FUNCTION AllocFileRequest : pFileRequester;
@@ -446,10 +556,25 @@ PROCEDURE FreeAslRequest(requester : POINTER);
 PROCEDURE FreeFileRequest(fileReq : pFileRequester);
 PROCEDURE FreeFileRequest(fileReq : pFileRequester);
 FUNCTION RequestFile(fileReq : pFileRequester) : BOOLEAN;
 FUNCTION RequestFile(fileReq : pFileRequester) : BOOLEAN;
 
 
+PROCEDURE AbortAslRequest(requester : POINTER);
+PROCEDURE ActivateAslRequest(requester : POINTER);
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitASLLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    ASLIsCompiledHow : longint;
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+{$ifndef dont_use_openlib}
+uses  msgbox;
+{$endif dont_use_openlib}
 
 
 FUNCTION AllocAslRequest(reqType : ULONG; tagList : pTagItem) : POINTER;
 FUNCTION AllocAslRequest(reqType : ULONG; tagList : pTagItem) : POINTER;
 BEGIN
 BEGIN
@@ -528,51 +653,120 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-   {$Info Compiling autoopening of asl.library}
+PROCEDURE AbortAslRequest(requester : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	requester,A0
+	MOVEA.L	AslBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE ActivateAslRequest(requester : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	requester,A0
+	MOVEA.L	AslBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of asl.library}
+  {$Info don't forget to use InitASLLibrary in the beginning of your program}
 
 
 var
 var
     asl_exit : Pointer;
     asl_exit : Pointer;
 
 
-procedure CloseAslLibrary;
+procedure CloseaslLibrary;
 begin
 begin
     ExitProc := asl_exit;
     ExitProc := asl_exit;
     if AslBase <> nil then begin
     if AslBase <> nil then begin
-       CloseLibrary(AslBase);
-       AslBase := nil;
+        CloseLibrary(AslBase);
+        AslBase := nil;
     end;
     end;
 end;
 end;
 
 
-const
-    VERSION : string[2] = '37';
+procedure InitASLLibrary;
+begin
+    AslBase := nil;
+    AslBase := OpenLibrary(ASLNAME,LIBVERSION);
+    if AslBase <> nil then begin
+        asl_exit := ExitProc;
+        ExitProc := @CloseaslLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open asl.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    ASLIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of asl.library}
+
+var
+    asl_exit : Pointer;
+
+procedure CloseaslLibrary;
+begin
+    ExitProc := asl_exit;
+    if AslBase <> nil then begin
+        CloseLibrary(AslBase);
+        AslBase := nil;
+    end;
+end;
 
 
 begin
 begin
     AslBase := nil;
     AslBase := nil;
-    AslBase := OpenLibrary(ASLNAME,37);
+    AslBase := OpenLibrary(ASLNAME,LIBVERSION);
     if AslBase <> nil then begin
     if AslBase <> nil then begin
-       asl_exit := ExitProc;
-       ExitProc := @CloseAslLibrary;
+        asl_exit := ExitProc;
+        ExitProc := @CloseaslLibrary;
+        ASLIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
-                   'Can''t open asl.library version ' +
-                   VERSION +
-                   chr(10) + 
-                   'Deallocating resources and closing down',
-                   'Oops');
-       halt(20);
+        'Can''t open asl.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of asl.library compiled}
-   {$Info Make sure you open asl.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    ASLIsCompiledHow := 3;
+   {$Warning No autoopening of asl.library compiled}
+   {$Warning Make sure you open asl.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT ASL *)
 END. (* UNIT ASL *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-13 20:36:00  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/13 20:36:00  nils
   * added the defines use_amiga_smartlink
   * added the defines use_amiga_smartlink
   * and use_auto_openlib
   * and use_auto_openlib
 
 
@@ -580,4 +774,4 @@ END. (* UNIT ASL *)
     * update check internal log
     * update check internal log
 
 
 }
 }
-  
+

+ 333 - 15
packages/extra/amunits/units/datatypes.pas

@@ -18,9 +18,27 @@
     History:
     History:
 
 
     Added functions and procedures with array of const.
     Added functions and procedures with array of const.
-    For use with fpc 1.0.7. Thay are in systemvartags.
+    For use with fpc 1.0.7. They are in systemvartags.
     11 Nov 2001.
     11 Nov 2001.
     
     
+    Update for AmigaOs 3.9.
+    Added some new const.
+    tadtNewFormatFrame is a new record.
+    New procedures and functions.
+             FUNCTION ObtainDTDrawInfoA
+             FUNCTION DrawDTObjectA
+             PROCEDURE ReleaseDTDrawInfo
+
+    New varargs procedures and function, they are
+    in systemvartags.
+         PROCEDURE RefreshDTObjects
+         FUNCTION DoDTMethod
+         FUNCTION PrintDTObject
+         FUNCTION ObtainDTDrawInfo
+         FUNCTION DrawDTObject
+    Changed startcode for library.
+    28 Jan 2003.
+
     [email protected]
     [email protected]
 }
 }
 
 
@@ -226,6 +244,9 @@ const
  DTERROR_NOT_ENOUGH_DATA               =  2007;
  DTERROR_NOT_ENOUGH_DATA               =  2007;
  DTERROR_INVALID_DATA                  =  2008;
  DTERROR_INVALID_DATA                  =  2008;
 
 
+{ New for V44 }
+ DTERROR_NOT_AVAILABLE		       =  2009;
+
 { Offset for types }
 { Offset for types }
  DTMSG_TYPE_OFFSET                     =  2100;
  DTMSG_TYPE_OFFSET                     =  2100;
 
 
@@ -337,6 +358,18 @@ const
         { New for V40. (BOOL) Indicate that the object should repeat
         { New for V40. (BOOL) Indicate that the object should repeat
          * playing.  Defaults to FALSE. }
          * playing.  Defaults to FALSE. }
 
 
+        { New for V44. Address of a DTST_MEMORY source type
+         * object (APTR).
+         }
+  DTA_SourceAddress	=  (DTA_Dummy+39);
+
+        { New for V44. Size of a DTST_MEMORY source type
+         * object (ULONG).
+        }
+  DTA_SourceSize	=  (DTA_Dummy+40);
+
+        { Reserved tag; DO NOT USE (V44) }
+  DTA_Reserved		=  (DTA_Dummy+41);
 
 
 { DTObject attributes }
 { DTObject attributes }
   DTA_Name              =  (DTA_Dummy+100);
   DTA_Name              =  (DTA_Dummy+100);
@@ -397,6 +430,7 @@ const
   DTST_FILE             =  2;
   DTST_FILE             =  2;
   DTST_CLIPBOARD        =  3;
   DTST_CLIPBOARD        =  3;
   DTST_HOTLINK          =  4;
   DTST_HOTLINK          =  4;
+  DTST_MEMORY		=  5;	{ New for V44 }
 
 
 {***************************************************************************}
 {***************************************************************************}
 
 
@@ -650,14 +684,39 @@ const
         { Pointer to a class-allocated bitmap, that will end
         { Pointer to a class-allocated bitmap, that will end
          * up being freed by picture.class when DisposeDTObject()
          * up being freed by picture.class when DisposeDTObject()
          * is called }
          * is called }
-
+{ Picture colour table (struct ColorRegister *) }
    PDTA_ColorRegisters   =  (DTA_Dummy + 203);
    PDTA_ColorRegisters   =  (DTA_Dummy + 203);
+   
+{ Color table to use with SetRGB32CM() (ULONG *) }
    PDTA_CRegs            =  (DTA_Dummy + 204);
    PDTA_CRegs            =  (DTA_Dummy + 204);
+   
+{ Color table; this table is initialized during the layout
+ * process and will contain the colours the picture will use
+ * after remapping. If no remapping takes place, these colours
+ * will match those in the PDTA_CRegs table (ULONG *).
+ }
    PDTA_GRegs            =  (DTA_Dummy + 205);
    PDTA_GRegs            =  (DTA_Dummy + 205);
+
+{ Shared pen table; this table is initialized during the layout
+ * process while the picture is being remapped (UBYTE *).
+ }
    PDTA_ColorTable       =  (DTA_Dummy + 206);
    PDTA_ColorTable       =  (DTA_Dummy + 206);
+   
+{ Shared pen table; in most places this table will be identical to
+ * the PDTA_ColorTable table. Some of the colours in this table might
+ * match the original colour palette a little better than the colours
+ * picked for the other table. The picture.datatype uses the two tables
+ * during remapping, alternating for each pixel (UBYTE *).
+ }
    PDTA_ColorTable2      =  (DTA_Dummy + 207);
    PDTA_ColorTable2      =  (DTA_Dummy + 207);
+   
+{ OBSOLETE; DO NOT USE }
    PDTA_Allocated        =  (DTA_Dummy + 208);
    PDTA_Allocated        =  (DTA_Dummy + 208);
+   
+{ Number of colors used by the picture. (UWORD) }
    PDTA_NumColors        =  (DTA_Dummy + 209);
    PDTA_NumColors        =  (DTA_Dummy + 209);
+   
+{ Number of colors allocated by the picture (UWORD) }
    PDTA_NumAlloc         =  (DTA_Dummy + 210);
    PDTA_NumAlloc         =  (DTA_Dummy + 210);
 
 
    PDTA_Remap            =  (DTA_Dummy + 211);
    PDTA_Remap            =  (DTA_Dummy + 211);
@@ -689,6 +748,67 @@ const
          * This array must contain as many entries as there
          * This array must contain as many entries as there
          * are colors specified with PDTA_NumSparse }
          * are colors specified with PDTA_NumSparse }
 
 
+	 { Index number of the picture to load (ULONG). (V44) }
+   PDTA_WhichPicture	 = (DTA_Dummy + 219);
+
+{ Get the number of pictures stored in the file (ULONG *). (V44) }
+   PDTA_GetNumPictures	 = (DTA_Dummy + 220);
+
+{ Maximum number of colours to use for dithering (ULONG). (V44) }
+   PDTA_MaxDitherPens	 = (DTA_Dummy + 221);
+
+{ Quality of the dithering algorithm to be used during colour
+ * quantization (ULONG). (V44)
+ }
+   PDTA_DitherQuality	 = (DTA_Dummy + 222);
+
+{ Pointer to the allocated pen table (UBYTE *). (V44) }
+   PDTA_AllocatedPens	 = (DTA_Dummy + 223);
+
+{ Quality for scaling. (V45) }
+   PDTA_ScaleQuality	 = (DTA_Dummy + 224);
+
+{***************************************************************************}
+
+{ When querying the number of pictures stored in a file, the
+ * following value denotes "the number of pictures is unknown".
+ }
+   PDTANUMPICTURES_Unknown = (0);
+
+{***************************************************************************}
+
+{ V43 extensions (attributes) }
+
+{ Set the sub datatype interface mode (LONG); see "Interface modes" below }
+   PDTA_SourceMode		= (DTA_Dummy + 250);
+
+{ Set the app datatype interface mode (LONG); see "Interface modes" below }
+   PDTA_DestMode		= (DTA_Dummy + 251);
+
+{ Allocates the resulting bitmap as a friend bitmap (BOOL) }
+   PDTA_UseFriendBitMap	        = (DTA_Dummy + 255);
+
+{ NULL or mask plane for use with BltMaskBitMapRastPort() (PLANEPTR) }
+   PDTA_MaskPlane		= (DTA_Dummy + 258);
+
+{***************************************************************************}
+
+{ Interface modes }
+  PMODE_V42 = (0);	{ Compatibility mode }
+  PMODE_V43 = (1);	{ Extended mode }
+
+{***************************************************************************}
+
+{ V43 extensions (methods) }
+
+  PDTM_Dummy = (DTM_Dummy + $60);
+
+{ Transfer pixel data to the picture object in the specified format }
+  PDTM_WRITEPIXELARRAY = (PDTM_Dummy + 0);
+
+{ Transfer pixel data from the picture object in the specified format }
+  PDTM_READPIXELARRAY = (PDTM_Dummy + 1);
+
 {***************************************************************************}
 {***************************************************************************}
 
 
 {  Masking techniques  }
 {  Masking techniques  }
@@ -772,13 +892,49 @@ const
     { (struct Task *) Task to signal when sound is complete or
     { (struct Task *) Task to signal when sound is complete or
         next buffer needed. }
         next buffer needed. }
 
 
+{ (ULONG) Signal mask to use on completion or 0 to disable
+ *
+ *         NOTE: Due to a bug in sound.datatype V40 SDTA_SignalBit
+ *               was actually implemented as a signal mask as opposed
+ *               to a bit number. The documentation now reflects
+ *               this. If you intend to use a signal bit number
+ *               instead of the mask, use the new V44 tag
+ *               SDTA_SignalBitNumber below.
+ *}
    SDTA_SignalBit        =  (SDTA_Dummy + 8);
    SDTA_SignalBit        =  (SDTA_Dummy + 8);
+   SDTA_SignalBitMask	 = SDTA_SignalBit;
     { (BYTE) Signal bit to use on completion or -1 to disable }
     { (BYTE) Signal bit to use on completion or -1 to disable }
 
 
    SDTA_Continuous       =  (SDTA_Dummy + 9);
    SDTA_Continuous       =  (SDTA_Dummy + 9);
     { (ULONG) Playing a continuous stream of data.  Defaults to
     { (ULONG) Playing a continuous stream of data.  Defaults to
         FALSE. }
         FALSE. }
 
 
+{ The following tags are new for V44 }
+
+{ (BYTE) Signal bit to use on completion or -1 to disable }
+   SDTA_SignalBitNumber	 =  (SDTA_Dummy + 10);
+
+{ (UWORD) Samples per second }
+   SDTA_SamplesPerSec	 = (SDTA_Dummy + 11);
+
+{ (struct timeval *) Sample replay period }
+   SDTA_ReplayPeriod	 = (SDTA_Dummy + 12);
+
+{ (BYTE *) Sample data }
+   SDTA_LeftSample	 = (SDTA_Dummy + 13);
+   SDTA_RightSample	 = (SDTA_Dummy + 14);
+
+{ (BYTE) Stereo panning }
+   SDTA_Pan		 = (SDTA_Dummy + 15);
+
+{ (BOOL) FreeVec() all sample data upon OM_DISPOSE. }
+   SDTA_FreeSampleData	 = (SDTA_Dummy + 16);
+
+{ (BOOL) Wait for the current sample to be played back before
+ * switching to the new sample data.
+ }
+   SDTA_SyncSampleChange = (SDTA_Dummy + 17);
+
 {***************************************************************************}
 {***************************************************************************}
 
 
    CMP_NONE     = 0;
    CMP_NONE     = 0;
@@ -799,9 +955,16 @@ Type
 {***************************************************************************}
 {***************************************************************************}
 
 
 const
 const
+
+{ Channel allocation }
+   SAMPLETYPE_Left	= (2);
+   SAMPLETYPE_Right	= (4);
+   SAMPLETYPE_Stereo	= (6);
+
 { IFF types }
 { IFF types }
    ID_8SVX = 944985688;
    ID_8SVX = 944985688;
    ID_VHDR = 1447576658;
    ID_VHDR = 1447576658;
+   ID_CHAN = $4348414E;
 
 
 {***************************************************************************}
 {***************************************************************************}
 
 
@@ -915,6 +1078,7 @@ const
         {  (LONG) Amount to change frame by when fast forwarding or
         {  (LONG) Amount to change frame by when fast forwarding or
          * rewinding.  Defaults to 10. }
          * rewinding.  Defaults to 10. }
 
 
+   ADTA_PreloadFrameCount = (ADTA_Dummy + 8);	{ (V44) }
 {  Sound attributes }
 {  Sound attributes }
    ADTA_Sample           =  SDTA_Sample      ;
    ADTA_Sample           =  SDTA_Sample      ;
    ADTA_SampleLength     =  SDTA_SampleLength;
    ADTA_SampleLength     =  SDTA_SampleLength;
@@ -922,6 +1086,10 @@ const
    ADTA_Volume           =  SDTA_Volume      ;
    ADTA_Volume           =  SDTA_Volume      ;
    ADTA_Cycles           =  SDTA_Cycles      ;
    ADTA_Cycles           =  SDTA_Cycles      ;
 
 
+   ADTA_LeftSample	 =  SDTA_LeftSample;		{ (V44) }
+   ADTA_RightSample	 =  SDTA_RightSample;	{ (V44) }
+   ADTA_SamplesPerSec	 =  SDTA_SamplesPerSec;	{ (V44) }
+
 { ***************************************************************************}
 { ***************************************************************************}
 
 
    ID_ANIM   = 1095649613;
    ID_ANIM   = 1095649613;
@@ -1030,6 +1198,11 @@ const
    ADTM_LOCATE           =  ($706);
    ADTM_LOCATE           =  ($706);
     {  Used to locate a frame in the animation (as set by a slider...) }
     {  Used to locate a frame in the animation (as set by a slider...) }
 
 
+    { Used to load a new format frame of the animation (V44) }
+   ADTM_LOADNEWFORMATFRAME =	($707);
+
+    { Used to unload a new format frame of the animation (V44) }
+   ADTM_UNLOADNEWFORMATFRAME  = ($708);
 { ***************************************************************************}
 { ***************************************************************************}
 
 
 {  ADTM_LOADFRAME, ADTM_UNLOADFRAME }
 {  ADTM_LOADFRAME, ADTM_UNLOADFRAME }
@@ -1055,6 +1228,29 @@ Type
     alf_UserData  : Pointer;          {  Used by load frame for extra data }
     alf_UserData  : Pointer;          {  Used by load frame for extra data }
  end;
  end;
 
 
+ { ADTM_LOADNEWFORMATFRAME, ADTM_UNLOADNEWFORMATFRAME }
+
+ PadtNewFormatFrame = ^tadtNewFormatFrame;
+     tadtNewFormatFrame = record
+          MethodID : ULONG;
+          alf_TimeStamp : ULONG;     { Timestamp of frame to load }
+	  { The following fields are filled in by the ADTM_NEWLOADFRAME method, }
+    { and are read-only for any other methods. }
+          alf_Frame : ULONG;         { Frame number }
+          alf_Duration : ULONG;      { Duration of frame }
+          alf_BitMap : PBitMap;      { Loaded BitMap }
+          alf_CMap : PColorMap;      { Colormap, if changed }
+          alf_Sample : PBYTE;
+          alf_SampleLength : ULONG;  { Sound data }
+          alf_Period : ULONG;
+          alf_UserData : APTR;       { Used by load frame for extra data }
+          alf_Size : ULONG;          { Size of this data structure (in bytes) }
+          alf_LeftSample : PBYTE;    { Sound for left channel, or NULL if none }
+          alf_RightSample : PBYTE;   { Sound for right channel, or NULL if none }
+          alf_SamplesPerSec : ULONG; { Replay speed; if > 0, this overrides alf_Period }
+       end;
+
+
 {  ADTM_START, ADTM_PAUSE, ADTM_STOP, ADTM_LOCATE }
 {  ADTM_START, ADTM_PAUSE, ADTM_STOP, ADTM_LOCATE }
  padtStart = ^tadtStart;
  padtStart = ^tadtStart;
  tadtStart = record
  tadtStart = record
@@ -1069,6 +1265,18 @@ VAR DataTypesBase : pLibrary;
 const
 const
     DATATYPESNAME : PChar = 'datatypes.library';
     DATATYPESNAME : PChar = 'datatypes.library';
 
 
+{
+    Just a note.
+    You will see a lot of pObject_ here, pObject is
+    defined in intuition. 
+    
+    In c it's object * but we can't have object in fpc.
+    typedef object ULONG
+
+    pObject_ is just pULONG.
+    
+}
+
 FUNCTION AddDTObject(win : pWindow; req : pRequester; o : pObject_; pos : LONGINT) : LONGINT;
 FUNCTION AddDTObject(win : pWindow; req : pRequester; o : pObject_; pos : LONGINT) : LONGINT;
 PROCEDURE DisposeDTObject(o : pObject_);
 PROCEDURE DisposeDTObject(o : pObject_);
 FUNCTION DoAsyncLayout(o : pObject_; gpl : pgpLayout) : ULONG;
 FUNCTION DoAsyncLayout(o : pObject_; gpl : pgpLayout) : ULONG;
@@ -1085,10 +1293,27 @@ PROCEDURE ReleaseDataType(dt : pDataType);
 FUNCTION RemoveDTObject(win : pWindow; o : pObject_) : LONGINT;
 FUNCTION RemoveDTObject(win : pWindow; o : pObject_) : LONGINT;
 FUNCTION SetDTAttrsA(o : pObject_; win : pWindow; req : pRequester; attrs : pTagItem) : ULONG;
 FUNCTION SetDTAttrsA(o : pObject_; win : pWindow; req : pRequester; attrs : pTagItem) : ULONG;
 
 
+FUNCTION ObtainDTDrawInfoA( o : pObject_; attrs : pTagItem) : POINTER;
+FUNCTION DrawDTObjectA(rp : pRastPort; o : pObject_; x : LONGINT; y : LONGINT; w : LONGINT; h : LONGINT; th : LONGINT; tv : LONGINT; attrs : pTagItem) : LONGINT;
+PROCEDURE ReleaseDTDrawInfo( o : pObject_; handle : POINTER);
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitDATATYPESLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    DATATYPESIsCompiledHow : longint;
+
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
+{$ifndef dont_use_openlib}
 uses msgbox;
 uses msgbox;
+{$endif dont_use_openlib}
 
 
 FUNCTION AddDTObject(win : pWindow; req : pRequester; o : pObject_; pos : LONGINT) : LONGINT;
 FUNCTION AddDTObject(win : pWindow; req : pRequester; o : pObject_; pos : LONGINT) : LONGINT;
 BEGIN
 BEGIN
@@ -1288,9 +1513,62 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of datatypes.library}
+
+FUNCTION ObtainDTDrawInfoA( o : pObject_; attrs : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	o,A0
+	MOVEA.L	attrs,A1
+	MOVEA.L	DataTypesBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION DrawDTObjectA(rp : pRastPort;  o : pObject_; x : LONGINT; y : LONGINT; w : LONGINT; h : LONGINT; th : LONGINT; tv : LONGINT; attrs : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A0
+	MOVEA.L	o,A1
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVE.L	w,D2
+	MOVE.L	h,D3
+	MOVE.L	th,D4
+	MOVE.L	tv,D5
+	MOVEA.L	attrs,A2
+	MOVEA.L	DataTypesBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE ReleaseDTDrawInfo( o : pObject_; handle : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	o,A0
+	MOVEA.L	handle,A1
+	MOVEA.L	DataTypesBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of datatypes.library}
+  {$Info don't forget to use InitDATATYPESLibrary in the beginning of your program}
 
 
 var
 var
     datatypes_exit : Pointer;
     datatypes_exit : Pointer;
@@ -1304,18 +1582,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitDATATYPESLibrary;
+begin
+    DataTypesBase := nil;
+    DataTypesBase := OpenLibrary(DATATYPESNAME,LIBVERSION);
+    if DataTypesBase <> nil then begin
+        datatypes_exit := ExitProc;
+        ExitProc := @ClosedatatypesLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open datatypes.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    DATATYPESIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of datatypes.library}
+
+var
+    datatypes_exit : Pointer;
+
+procedure ClosedatatypesLibrary;
+begin
+    ExitProc := datatypes_exit;
+    if DataTypesBase <> nil then begin
+        CloseLibrary(DataTypesBase);
+        DataTypesBase := nil;
+    end;
+end;
 
 
 begin
 begin
     DataTypesBase := nil;
     DataTypesBase := nil;
     DataTypesBase := OpenLibrary(DATATYPESNAME,LIBVERSION);
     DataTypesBase := OpenLibrary(DATATYPESNAME,LIBVERSION);
     if DataTypesBase <> nil then begin
     if DataTypesBase <> nil then begin
         datatypes_exit := ExitProc;
         datatypes_exit := ExitProc;
-        ExitProc := @ClosedatatypesLibrary
+        ExitProc := @ClosedatatypesLibrary;
+        DATATYPESIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open datatypes.library version ' + VERSION + #10 +
         'Can''t open datatypes.library version ' + VERSION + #10 +
@@ -1324,17 +1632,27 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of datatypes.library compiled}
-   {$Info Make sure you open datatypes.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    DATATYPESIsCompiledHow := 3;
+   {$Warning No autoopening of datatypes.library compiled}
+   {$Warning Make sure you open datatypes.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT DATATYPES *)
 END. (* UNIT DATATYPES *)
 
 
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-14 18:46:04  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/14 18:46:04  nils
   * added defines use_amia_smartlink and use_auto_openlib
   * added defines use_amia_smartlink and use_auto_openlib
 
 
   * implemented autoopening of library
   * implemented autoopening of library
@@ -1344,5 +1662,5 @@ END. (* UNIT DATATYPES *)
 
 
 }
 }
 
 
-  
+
 
 

+ 111 - 15
packages/extra/amunits/units/diskfont.pas

@@ -21,6 +21,14 @@
     of the library.
     of the library.
     13 Jan 2003.
     13 Jan 2003.
     
     
+    Update for AmigaOS 3.9.
+       FUNCTION GetDiskFontCtrl
+       PROCEDURE SetDiskFontCtrlA
+    Varargs for SetDiskFontCtrl is in
+    systemvartags.
+    Changed startup for library.
+    01 Feb 2003.
+
     [email protected] Nils Sjoholm
     [email protected] Nils Sjoholm
 }
 }
 
 
@@ -33,7 +41,7 @@ unit diskfont;
 
 
 INTERFACE
 INTERFACE
 
 
-uses exec, graphics;
+uses exec, graphics,utility;
 
 
 Const
 Const
 
 
@@ -137,10 +145,29 @@ PROCEDURE DisposeFontContents(fontContentsHeader : pFontContentsHeader);
 FUNCTION NewFontContents(fontsLock : BPTR; fontName : pCHAR) : pFontContentsHeader;
 FUNCTION NewFontContents(fontsLock : BPTR; fontName : pCHAR) : pFontContentsHeader;
 FUNCTION NewScaledDiskFont(sourceFont : pTextFont; destTextAttr : pTextAttr) : pDiskFontHeader;
 FUNCTION NewScaledDiskFont(sourceFont : pTextFont; destTextAttr : pTextAttr) : pDiskFontHeader;
 FUNCTION OpenDiskFont(textAttr : pTextAttr) : pTextFont;
 FUNCTION OpenDiskFont(textAttr : pTextAttr) : pTextFont;
+FUNCTION GetDiskFontCtrl(tagid : LONGINT) : LONGINT;
+PROCEDURE SetDiskFontCtrlA(taglist : pTagItem);
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitDISKFONTLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    DISKFONTIsCompiledHow : longint;
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+{
+ If you don't use array of const then just remove tagsarray
+}
+uses
+{$ifndef dont_use_openlib}
+msgbox;
+{$endif dont_use_openlib}
 
 
 FUNCTION AvailFonts(buffer : pCHAR; bufBytes : LONGINT; flags : LONGINT) : LONGINT;
 FUNCTION AvailFonts(buffer : pCHAR; bufBytes : LONGINT; flags : LONGINT) : LONGINT;
 BEGIN
 BEGIN
@@ -205,9 +232,38 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of diskfont.library}
+FUNCTION GetDiskFontCtrl(tagid : LONGINT) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	tagid,D0
+	MOVEA.L	DiskfontBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE SetDiskFontCtrlA(taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	taglist,A0
+	MOVEA.L	DiskfontBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of diskfont.library}
+  {$Info don't forget to use InitDISKFONTLibrary in the beginning of your program}
 
 
 var
 var
     diskfont_exit : Pointer;
     diskfont_exit : Pointer;
@@ -221,18 +277,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitDISKFONTLibrary;
+begin
+    DiskfontBase := nil;
+    DiskfontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
+    if DiskfontBase <> nil then begin
+        diskfont_exit := ExitProc;
+        ExitProc := @ClosediskfontLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open diskfont.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    DISKFONTIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of diskfont.library}
+
+var
+    diskfont_exit : Pointer;
+
+procedure ClosediskfontLibrary;
+begin
+    ExitProc := diskfont_exit;
+    if DiskfontBase <> nil then begin
+        CloseLibrary(DiskfontBase);
+        DiskfontBase := nil;
+    end;
+end;
 
 
 begin
 begin
     DiskfontBase := nil;
     DiskfontBase := nil;
     DiskfontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
     DiskfontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
     if DiskfontBase <> nil then begin
     if DiskfontBase <> nil then begin
         diskfont_exit := ExitProc;
         diskfont_exit := ExitProc;
-        ExitProc := @ClosediskfontLibrary
+        ExitProc := @ClosediskfontLibrary;
+        DISKFONTIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open diskfont.library version ' + VERSION + #10 +
         'Can''t open diskfont.library version ' + VERSION + #10 +
@@ -241,16 +327,26 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of diskfont.library compiled}
-   {$Info Make sure you open diskfont.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    DISKFONTIsCompiledHow := 3;
+   {$Warning No autoopening of diskfont.library compiled}
+   {$Warning Make sure you open diskfont.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT DISKFONT *)
 END. (* UNIT DISKFONT *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-14 18:46:04  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/14 18:46:04  nils
   * added defines use_amia_smartlink and use_auto_openlib
   * added defines use_amia_smartlink and use_auto_openlib
 
 
   * implemented autoopening of library
   * implemented autoopening of library
@@ -259,6 +355,6 @@ END. (* UNIT DISKFONT *)
     * added diskfontname
     * added diskfontname
 
 
 }
 }
-  
+
 
 
 
 

+ 80 - 22
packages/extra/amunits/units/expansion.pas

@@ -21,6 +21,10 @@
     the library.
     the library.
     14 Jan 2003.
     14 Jan 2003.
     
     
+    Update for AmigaOS 3.9.
+    Changed start code for unit.
+    01 Feb 2003.
+    
     [email protected] Nils Sjoholm
     [email protected] Nils Sjoholm
 }
 }
 
 
@@ -52,23 +56,37 @@ FUNCTION AllocConfigDev : pConfigDev;
 FUNCTION AllocExpansionMem(numSlots : ULONG; slotAlign : ULONG) : POINTER;
 FUNCTION AllocExpansionMem(numSlots : ULONG; slotAlign : ULONG) : POINTER;
 PROCEDURE ConfigBoard(board : POINTER; configDev : pConfigDev);
 PROCEDURE ConfigBoard(board : POINTER; configDev : pConfigDev);
 PROCEDURE ConfigChain(baseAddr : POINTER);
 PROCEDURE ConfigChain(baseAddr : POINTER);
-FUNCTION FindConfigDev(oldConfigDev : pConfigDev; manufacturer : LONGINT; product : LONGINT) : pConfigDev;
+FUNCTION FindConfigDev(const oldConfigDev : pConfigDev; manufacturer : LONGINT; product : LONGINT) : pConfigDev;
 PROCEDURE FreeBoardMem(startSlot : ULONG; slotSpec : ULONG);
 PROCEDURE FreeBoardMem(startSlot : ULONG; slotSpec : ULONG);
 PROCEDURE FreeConfigDev(configDev : pConfigDev);
 PROCEDURE FreeConfigDev(configDev : pConfigDev);
 PROCEDURE FreeExpansionMem(startSlot : ULONG; numSlots : ULONG);
 PROCEDURE FreeExpansionMem(startSlot : ULONG; numSlots : ULONG);
-FUNCTION GetCurrentBinding(currentBinding : pCurrentBinding; bindingSize : ULONG) : ULONG;
-FUNCTION MakeDosNode(parmPacket : POINTER) : pDeviceNode;
+FUNCTION GetCurrentBinding(const currentBinding : pCurrentBinding; bindingSize : ULONG) : ULONG;
+FUNCTION MakeDosNode(const parmPacket : POINTER) : pDeviceNode;
 PROCEDURE ObtainConfigBinding;
 PROCEDURE ObtainConfigBinding;
-FUNCTION ReadExpansionByte(board : POINTER; offset : ULONG) : BYTE;
-PROCEDURE ReadExpansionRom(board : POINTER; configDev : pConfigDev);
+FUNCTION ReadExpansionByte(const board : POINTER; offset : ULONG) : BYTE;
+PROCEDURE ReadExpansionRom(const board : POINTER; configDev : pConfigDev);
 PROCEDURE ReleaseConfigBinding;
 PROCEDURE ReleaseConfigBinding;
 PROCEDURE RemConfigDev(configDev : pConfigDev);
 PROCEDURE RemConfigDev(configDev : pConfigDev);
 PROCEDURE SetCurrentBinding(currentBinding : pCurrentBinding; bindingSize : ULONG);
 PROCEDURE SetCurrentBinding(currentBinding : pCurrentBinding; bindingSize : ULONG);
 PROCEDURE WriteExpansionByte(board : POINTER; offset : ULONG; byte : ULONG);
 PROCEDURE WriteExpansionByte(board : POINTER; offset : ULONG; byte : ULONG);
 
 
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitEXPANSIONLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    EXPANSIONIsCompiledHow : longint;
+
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox;
+{$endif dont_use_openlib}
 
 
 FUNCTION AddBootNode(bootPri : LONGINT; flags : ULONG; deviceNode : pDeviceNode; configDev : pConfigDev) : BOOLEAN;
 FUNCTION AddBootNode(bootPri : LONGINT; flags : ULONG; deviceNode : pDeviceNode; configDev : pConfigDev) : BOOLEAN;
 BEGIN
 BEGIN
@@ -174,7 +192,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION FindConfigDev(oldConfigDev : pConfigDev; manufacturer : LONGINT; product : LONGINT) : pConfigDev;
+FUNCTION FindConfigDev(const oldConfigDev : pConfigDev; manufacturer : LONGINT; product : LONGINT) : pConfigDev;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -223,7 +241,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetCurrentBinding(currentBinding : pCurrentBinding; bindingSize : ULONG) : ULONG;
+FUNCTION GetCurrentBinding(const currentBinding : pCurrentBinding; bindingSize : ULONG) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -236,7 +254,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION MakeDosNode(parmPacket : POINTER) : pDeviceNode;
+FUNCTION MakeDosNode(const parmPacket : POINTER) : pDeviceNode;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -258,7 +276,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION ReadExpansionByte(board : POINTER; offset : ULONG) : BYTE;
+FUNCTION ReadExpansionByte(const board : POINTER; offset : ULONG) : BYTE;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -271,7 +289,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE ReadExpansionRom(board : POINTER; configDev : pConfigDev);
+PROCEDURE ReadExpansionRom(const board : POINTER; configDev : pConfigDev);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -329,9 +347,15 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of expansion.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of expansion.library}
+  {$Info don't forget to use InitEXPANSIONLibrary in the beginning of your program}
 
 
 var
 var
     expansion_exit : Pointer;
     expansion_exit : Pointer;
@@ -345,18 +369,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitEXPANSIONLibrary;
+begin
+    ExpansionBase := nil;
+    ExpansionBase := OpenLibrary(EXPANSIONNAME,LIBVERSION);
+    if ExpansionBase <> nil then begin
+        expansion_exit := ExitProc;
+        ExitProc := @CloseexpansionLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open expansion.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    EXPANSIONIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of expansion.library}
+
+var
+    expansion_exit : Pointer;
+
+procedure CloseexpansionLibrary;
+begin
+    ExitProc := expansion_exit;
+    if ExpansionBase <> nil then begin
+        CloseLibrary(ExpansionBase);
+        ExpansionBase := nil;
+    end;
+end;
 
 
 begin
 begin
     ExpansionBase := nil;
     ExpansionBase := nil;
     ExpansionBase := OpenLibrary(EXPANSIONNAME,LIBVERSION);
     ExpansionBase := OpenLibrary(EXPANSIONNAME,LIBVERSION);
     if ExpansionBase <> nil then begin
     if ExpansionBase <> nil then begin
         expansion_exit := ExitProc;
         expansion_exit := ExitProc;
-        ExitProc := @CloseexpansionLibrary
+        ExitProc := @CloseexpansionLibrary;
+        EXPANSIONIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open expansion.library version ' + VERSION + #10 +
         'Can''t open expansion.library version ' + VERSION + #10 +
@@ -365,11 +419,15 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of expansion.library compiled}
-   {$Info Make sure you open expansion.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    EXPANSIONIsCompiledHow := 3;
+   {$Warning No autoopening of expansion.library compiled}
+   {$Warning Make sure you open expansion.library yourself}
+{$endif dont_use_openlib}
+
 
 
 END. (* UNIT EXPANSION *)
 END. (* UNIT EXPANSION *)
 
 

+ 105 - 41
packages/extra/amunits/units/gadtools.pas

@@ -33,6 +33,10 @@
     use_auto_openlib.
     use_auto_openlib.
     13 Jan 2003.
     13 Jan 2003.
 
 
+    Update for AmigaOS 3.9.
+    Changed startup code for the unit.
+    01 Feb 2003.
+    
     [email protected]
     [email protected]
 
 
 }
 }
@@ -465,31 +469,45 @@ VAR
     GadToolsBase : pLibrary;
     GadToolsBase : pLibrary;
 
 
 FUNCTION CreateContext(glistptr : pGadget): pGadget;
 FUNCTION CreateContext(glistptr : pGadget): pGadget;
-FUNCTION CreateGadgetA(kind : ULONG; gad : pGadget; ng : pNewGadget; taglist : pTagItem) : pGadget;
-FUNCTION CreateMenusA(newmenu : pNewMenu; taglist : pTagItem) : pMenu;
-PROCEDURE DrawBevelBoxA(rport : pRastPort; left : LONGINT; top : LONGINT; width : LONGINT; height : LONGINT; taglist : pTagItem);
+FUNCTION CreateGadgetA(kind : ULONG; gad : pGadget;const ng : pNewGadget;const taglist : pTagItem) : pGadget;
+FUNCTION CreateMenusA(const newmenu : pNewMenu;const taglist : pTagItem) : pMenu;
+PROCEDURE DrawBevelBoxA(rport : pRastPort; left : LONGINT; top : LONGINT; width : LONGINT; height : LONGINT;const taglist : pTagItem);
 PROCEDURE FreeGadgets(gad : pGadget);
 PROCEDURE FreeGadgets(gad : pGadget);
 PROCEDURE FreeMenus(menu : pMenu);
 PROCEDURE FreeMenus(menu : pMenu);
 PROCEDURE FreeVisualInfo(vi : POINTER);
 PROCEDURE FreeVisualInfo(vi : POINTER);
-FUNCTION GetVisualInfoA(screen : pScreen; taglist : pTagItem) : POINTER;
+FUNCTION GetVisualInfoA(screen : pScreen;const taglist : pTagItem) : POINTER;
 PROCEDURE GT_BeginRefresh(win : pWindow);
 PROCEDURE GT_BeginRefresh(win : pWindow);
 PROCEDURE GT_EndRefresh(win : pWindow; complete : LONGINT);
 PROCEDURE GT_EndRefresh(win : pWindow; complete : LONGINT);
-FUNCTION GT_FilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
-FUNCTION GT_GetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem) : LONGINT;
+FUNCTION GT_FilterIMsg(const imsg : pIntuiMessage) : pIntuiMessage;
+FUNCTION GT_GetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester;const taglist : pTagItem) : LONGINT;
 FUNCTION GT_GetIMsg(iport : pMsgPort) : pIntuiMessage;
 FUNCTION GT_GetIMsg(iport : pMsgPort) : pIntuiMessage;
 FUNCTION GT_PostFilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
 FUNCTION GT_PostFilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
 PROCEDURE GT_RefreshWindow(win : pWindow; req : pRequester);
 PROCEDURE GT_RefreshWindow(win : pWindow; req : pRequester);
 PROCEDURE GT_ReplyIMsg(imsg : pIntuiMessage);
 PROCEDURE GT_ReplyIMsg(imsg : pIntuiMessage);
-PROCEDURE GT_SetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem);
-FUNCTION LayoutMenuItemsA(firstitem : pMenuItem; vi : POINTER; taglist : pTagItem) : BOOLEAN;
-FUNCTION LayoutMenusA(firstmenu : pMenu; vi : POINTER; taglist : pTagItem) : BOOLEAN;
+PROCEDURE GT_SetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester;const taglist : pTagItem);
+FUNCTION LayoutMenuItemsA(firstitem : pMenuItem; vi : POINTER;const taglist : pTagItem) : BOOLEAN;
+FUNCTION LayoutMenusA(firstmenu : pMenu; vi : POINTER;const taglist : pTagItem) : BOOLEAN;
 
 
 function GTMENUITEM_USERDATA(menuitem : pMenuItem): pointer;
 function GTMENUITEM_USERDATA(menuitem : pMenuItem): pointer;
 function GTMENU_USERDATA(menu : pMenu): pointer;
 function GTMENU_USERDATA(menu : pMenu): pointer;
 
 
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitGADTOOLSLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    GADTOOLSIsCompiledHow : longint;
+
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox;
+{$endif dont_use_openlib}
 
 
 function GTMENUITEM_USERDATA(menuitem : pMenuItem): pointer;
 function GTMENUITEM_USERDATA(menuitem : pMenuItem): pointer;
 begin
 begin
@@ -513,7 +531,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION CreateGadgetA(kind : ULONG; gad : pGadget; ng : pNewGadget; taglist : pTagItem) : pGadget;
+FUNCTION CreateGadgetA(kind : ULONG; gad : pGadget;const ng : pNewGadget;const taglist : pTagItem) : pGadget;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -528,7 +546,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION CreateMenusA(newmenu : pNewMenu; taglist : pTagItem) : pMenu;
+FUNCTION CreateMenusA(const newmenu : pNewMenu;const taglist : pTagItem) : pMenu;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -541,7 +559,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE DrawBevelBoxA(rport : pRastPort; left : LONGINT; top : LONGINT; width : LONGINT; height : LONGINT; taglist : pTagItem);
+PROCEDURE DrawBevelBoxA(rport : pRastPort; left : LONGINT; top : LONGINT; width : LONGINT; height : LONGINT;const taglist : pTagItem);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -590,7 +608,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetVisualInfoA(screen : pScreen; taglist : pTagItem) : POINTER;
+FUNCTION GetVisualInfoA(screen : pScreen;const taglist : pTagItem) : POINTER;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -626,7 +644,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GT_FilterIMsg(imsg : pIntuiMessage) : pIntuiMessage;
+FUNCTION GT_FilterIMsg(const imsg : pIntuiMessage) : pIntuiMessage;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -638,7 +656,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GT_GetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem) : LONGINT;
+FUNCTION GT_GetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester;const taglist : pTagItem) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -700,7 +718,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE GT_SetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester; taglist : pTagItem);
+PROCEDURE GT_SetGadgetAttrsA(gad : pGadget; win : pWindow; req : pRequester;const taglist : pTagItem);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -714,7 +732,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION LayoutMenuItemsA(firstitem : pMenuItem; vi : POINTER; taglist : pTagItem) : BOOLEAN;
+FUNCTION LayoutMenuItemsA(firstitem : pMenuItem; vi : POINTER;const taglist : pTagItem) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -731,7 +749,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION LayoutMenusA(firstmenu : pMenu; vi : POINTER; taglist : pTagItem) : BOOLEAN;
+FUNCTION LayoutMenusA(firstmenu : pMenu; vi : POINTER;const taglist : pTagItem) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -748,14 +766,20 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-   {$Info Compiling autoopening of gadtools.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of gadtools.library}
+  {$Info don't forget to use InitGADTOOLSLibrary in the beginning of your program}
 
 
 var
 var
-  gadtools_exit : Pointer;
+    gadtools_exit : Pointer;
 
 
-procedure CloseGadToolsLibrary;
+procedure ClosegadtoolsLibrary;
 begin
 begin
     ExitProc := gadtools_exit;
     ExitProc := gadtools_exit;
     if GadToolsBase <> nil then begin
     if GadToolsBase <> nil then begin
@@ -764,37 +788,77 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-   VERSION        : string[2] = '37';
-   LIBVERSION     = 37;
+procedure InitGADTOOLSLibrary;
+begin
+    GadToolsBase := nil;
+    GadToolsBase := OpenLibrary(GADTOOLSNAME,LIBVERSION);
+    if GadToolsBase <> nil then begin
+        gadtools_exit := ExitProc;
+        ExitProc := @ClosegadtoolsLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open gadtools.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    GADTOOLSIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of gadtools.library}
+
+var
+    gadtools_exit : Pointer;
+
+procedure ClosegadtoolsLibrary;
+begin
+    ExitProc := gadtools_exit;
+    if GadToolsBase <> nil then begin
+        CloseLibrary(GadToolsBase);
+        GadToolsBase := nil;
+    end;
+end;
 
 
 begin
 begin
     GadToolsBase := nil;
     GadToolsBase := nil;
     GadToolsBase := OpenLibrary(GADTOOLSNAME,LIBVERSION);
     GadToolsBase := OpenLibrary(GADTOOLSNAME,LIBVERSION);
     if GadToolsBase <> nil then begin
     if GadToolsBase <> nil then begin
-         gadtools_Exit := ExitProc;
-         ExitProc := @CloseGadToolsLibrary;
+        gadtools_exit := ExitProc;
+        ExitProc := @ClosegadtoolsLibrary;
+        GADTOOLSIsCompiledHow := 1;
     end else begin
     end else begin
-         MessageBox('FPC Pascal Error',
-                    'Can''t open gadtools.library version ' + 
-                    VERSION +
-                    chr(10) + 
-                    'Deallocating resources and closing down',
-                    'Oops');
-         halt(20);
+        MessageBox('FPC Pascal Error',
+        'Can''t open gadtools.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of gadtools.library compiled}
-   {$Info Make sure you open gadtools.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    GADTOOLSIsCompiledHow := 3;
+   {$Warning No autoopening of gadtools.library compiled}
+   {$Warning Make sure you open gadtools.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT GADTOOLS *)
 END. (* UNIT GADTOOLS *)
 
 
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-13 20:36:00  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/13 20:36:00  nils
   * added the defines use_amiga_smartlink
   * added the defines use_amiga_smartlink
   * and use_auto_openlib
   * and use_auto_openlib
 
 
@@ -803,4 +867,4 @@ END. (* UNIT GADTOOLS *)
 
 
 }
 }
 
 
-  
+

+ 167 - 100
packages/extra/amunits/units/graphics.pas

@@ -41,6 +41,13 @@
     Added the defines use_amiga_smartlink and
     Added the defines use_amiga_smartlink and
     use_auto_openlib.
     use_auto_openlib.
     13 Jan 2003.
     13 Jan 2003.
+    
+    Update for AmifaOS 3.9.
+    Changed start code for unit.
+    Bugs in ChangeSprite, GetRGB32, LoadRGB32,
+    LoadRGB4 and PolyDraw, fixed.
+    01 Feb 2003.
+
     [email protected]
     [email protected]
 
 
 }
 }
@@ -2233,12 +2240,12 @@ PROCEDURE AddAnimOb(anOb : pAnimOb; anKey : ppAnimOb; rp : pRastPort);
 PROCEDURE AddBob(bob : pBob; rp : pRastPort);
 PROCEDURE AddBob(bob : pBob; rp : pRastPort);
 PROCEDURE AddFont(textFont : pTextFont);
 PROCEDURE AddFont(textFont : pTextFont);
 PROCEDURE AddVSprite(vSprite : pVSprite; rp : pRastPort);
 PROCEDURE AddVSprite(vSprite : pVSprite; rp : pRastPort);
-FUNCTION AllocBitMap(sizex : ULONG; sizey : ULONG; depth : ULONG; flags : ULONG; friend_bitmap : pBitMap) : pBitMap;
+FUNCTION AllocBitMap(sizex : ULONG; sizey : ULONG; depth : ULONG; flags : ULONG;const friend_bitmap : pBitMap) : pBitMap;
 FUNCTION AllocDBufInfo(vp : pViewPort) : pDBufInfo;
 FUNCTION AllocDBufInfo(vp : pViewPort) : pDBufInfo;
 FUNCTION AllocRaster(width : ULONG; height : ULONG) : pCHAR;
 FUNCTION AllocRaster(width : ULONG; height : ULONG) : pCHAR;
-FUNCTION AllocSpriteDataA(bm : pBitMap; tags : pTagItem) : pExtSprite;
-PROCEDURE AndRectRegion(region : pRegion; rectangle : pRectangle);
-FUNCTION AndRegionRegion(srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
+FUNCTION AllocSpriteDataA(const bm : pBitMap;const tags : pTagItem) : pExtSprite;
+PROCEDURE AndRectRegion(region : pRegion;const rectangle : pRectangle);
+FUNCTION AndRegionRegion(const srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
 PROCEDURE Animate(anKey : ppAnimOb; rp : pRastPort);
 PROCEDURE Animate(anKey : ppAnimOb; rp : pRastPort);
 FUNCTION AreaDraw(rp : pRastPort; x : LONGINT; y : LONGINT) : LONGINT;
 FUNCTION AreaDraw(rp : pRastPort; x : LONGINT; y : LONGINT) : LONGINT;
 FUNCTION AreaEllipse(rp : pRastPort; xCenter : LONGINT; yCenter : LONGINT; a : LONGINT; b : LONGINT) : LONGINT;
 FUNCTION AreaEllipse(rp : pRastPort; xCenter : LONGINT; yCenter : LONGINT; a : LONGINT; b : LONGINT) : LONGINT;
@@ -2248,21 +2255,21 @@ PROCEDURE AskFont(rp : pRastPort; textAttr : pTextAttr);
 FUNCTION AskSoftStyle(rp : pRastPort) : ULONG;
 FUNCTION AskSoftStyle(rp : pRastPort) : ULONG;
 FUNCTION AttachPalExtra(cm : pColorMap; vp : pViewPort) : LONGINT;
 FUNCTION AttachPalExtra(cm : pColorMap; vp : pViewPort) : LONGINT;
 FUNCTION AttemptLockLayerRom(layer : pLayer) : BOOLEAN;
 FUNCTION AttemptLockLayerRom(layer : pLayer) : BOOLEAN;
-FUNCTION BestModeIDA(tags : pTagItem) : ULONG;
+FUNCTION BestModeIDA(const tags : pTagItem) : ULONG;
 PROCEDURE BitMapScale(bitScaleArgs : pBitScaleArgs);
 PROCEDURE BitMapScale(bitScaleArgs : pBitScaleArgs);
-FUNCTION BltBitMap(srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destBitMap : pBitMap; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG; mask : ULONG; tempA : pCHAR) : LONGINT;
-PROCEDURE BltBitMapRastPort(srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG);
+FUNCTION BltBitMap(const srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destBitMap : pBitMap; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG; mask : ULONG; tempA : pCHAR) : LONGINT;
+PROCEDURE BltBitMapRastPort(const srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG);
 PROCEDURE BltClear(memBlock : pCHAR; byteCount : ULONG; flags : ULONG);
 PROCEDURE BltClear(memBlock : pCHAR; byteCount : ULONG; flags : ULONG);
-PROCEDURE BltMaskBitMapRastPort(srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG; bltMask : pCHAR);
-PROCEDURE BltPattern(rp : pRastPort; mask : pCHAR; xMin : LONGINT; yMin : LONGINT; xMax : LONGINT; yMax : LONGINT; maskBPR : ULONG);
-PROCEDURE BltTemplate(source : pCHAR; xSrc : LONGINT; srcMod : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT);
+PROCEDURE BltMaskBitMapRastPort(const srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG;const bltMask : pCHAR);
+PROCEDURE BltPattern(rp : pRastPort;const mask : pCHAR; xMin : LONGINT; yMin : LONGINT; xMax : LONGINT; yMax : LONGINT; maskBPR : ULONG);
+PROCEDURE BltTemplate(const source : pCHAR; xSrc : LONGINT; srcMod : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT);
 FUNCTION CalcIVG(v : pView; vp : pViewPort) : WORD;
 FUNCTION CalcIVG(v : pView; vp : pViewPort) : WORD;
 PROCEDURE CBump(copList : pUCopList);
 PROCEDURE CBump(copList : pUCopList);
-FUNCTION ChangeExtSpriteA(vp : pViewPort; oldsprite : pExtSprite; newsprite : pExtSprite; tags : pTagItem) : LONGINT;
-PROCEDURE ChangeSprite(vp : pViewPort; sprite : pSimpleSprite; newData : pCHAR);
+FUNCTION ChangeExtSpriteA(vp : pViewPort; oldsprite : pExtSprite; newsprite : pExtSprite;const tags : pTagItem) : LONGINT;
+PROCEDURE ChangeSprite(vp : pViewPort; sprite : pSimpleSprite; newData : pWORD);
 PROCEDURE ChangeVPBitMap(vp : pViewPort; bm : pBitMap; db : pDBufInfo);
 PROCEDURE ChangeVPBitMap(vp : pViewPort; bm : pBitMap; db : pDBufInfo);
 PROCEDURE ClearEOL(rp : pRastPort);
 PROCEDURE ClearEOL(rp : pRastPort);
-FUNCTION ClearRectRegion(region : pRegion; rectangle : pRectangle) : BOOLEAN;
+FUNCTION ClearRectRegion(region : pRegion;const rectangle : pRectangle) : BOOLEAN;
 PROCEDURE ClearRegion(region : pRegion);
 PROCEDURE ClearRegion(region : pRegion);
 PROCEDURE ClearScreen(rp : pRastPort);
 PROCEDURE ClearScreen(rp : pRastPort);
 PROCEDURE ClipBlit(srcRP : pRastPort; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG);
 PROCEDURE ClipBlit(srcRP : pRastPort; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG);
@@ -2279,11 +2286,11 @@ PROCEDURE Draw(rp : pRastPort; x : LONGINT; y : LONGINT);
 PROCEDURE DrawEllipse(rp : pRastPort; xCenter : LONGINT; yCenter : LONGINT; a : LONGINT; b : LONGINT);
 PROCEDURE DrawEllipse(rp : pRastPort; xCenter : LONGINT; yCenter : LONGINT; a : LONGINT; b : LONGINT);
 PROCEDURE DrawGList(rp : pRastPort; vp : pViewPort);
 PROCEDURE DrawGList(rp : pRastPort; vp : pViewPort);
 PROCEDURE EraseRect(rp : pRastPort; xMin : LONGINT; yMin : LONGINT; xMax : LONGINT; yMax : LONGINT);
 PROCEDURE EraseRect(rp : pRastPort; xMin : LONGINT; yMin : LONGINT; xMax : LONGINT; yMax : LONGINT);
-FUNCTION ExtendFont(font : pTextFont; fontTags : pTagItem) : ULONG;
+FUNCTION ExtendFont(font : pTextFont;const fontTags : pTagItem) : ULONG;
 FUNCTION FindColor(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG; maxcolor : LONGINT) : LONGINT;
 FUNCTION FindColor(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG; maxcolor : LONGINT) : LONGINT;
 FUNCTION FindDisplayInfo(displayID : ULONG) : POINTER;
 FUNCTION FindDisplayInfo(displayID : ULONG) : POINTER;
 FUNCTION Flood(rp : pRastPort; mode : ULONG; x : LONGINT; y : LONGINT) : BOOLEAN;
 FUNCTION Flood(rp : pRastPort; mode : ULONG; x : LONGINT; y : LONGINT) : BOOLEAN;
-PROCEDURE FontExtent(font : pTextFont; fontExtent : pTextExtent);
+PROCEDURE FontExtent(const font : pTextFont; fontExtent : pTextExtent);
 PROCEDURE FreeBitMap(bm : pBitMap);
 PROCEDURE FreeBitMap(bm : pBitMap);
 PROCEDURE FreeColorMap(colorMap : pColorMap);
 PROCEDURE FreeColorMap(colorMap : pColorMap);
 PROCEDURE FreeCopList(copList : pCopList);
 PROCEDURE FreeCopList(copList : pCopList);
@@ -2295,22 +2302,22 @@ PROCEDURE FreeSprite(num : LONGINT);
 PROCEDURE FreeSpriteData(sp : pExtSprite);
 PROCEDURE FreeSpriteData(sp : pExtSprite);
 PROCEDURE FreeVPortCopLists(vp : pViewPort);
 PROCEDURE FreeVPortCopLists(vp : pViewPort);
 FUNCTION GetAPen(rp : pRastPort) : ULONG;
 FUNCTION GetAPen(rp : pRastPort) : ULONG;
-FUNCTION GetBitMapAttr(bm : pBitMap; attrnum : ULONG) : ULONG;
+FUNCTION GetBitMapAttr(const bm : pBitMap; attrnum : ULONG) : ULONG;
 FUNCTION GetBPen(rp : pRastPort) : ULONG;
 FUNCTION GetBPen(rp : pRastPort) : ULONG;
 FUNCTION GetColorMap(entries : LONGINT) : pColorMap;
 FUNCTION GetColorMap(entries : LONGINT) : pColorMap;
-FUNCTION GetDisplayInfoData(handle : POINTER; buf : pCHAR; size : ULONG; tagID : ULONG; displayID : ULONG) : ULONG;
+FUNCTION GetDisplayInfoData(const handle : POINTER; buf : pCHAR; size : ULONG; tagID : ULONG; displayID : ULONG) : ULONG;
 FUNCTION GetDrMd(rp : pRastPort) : ULONG;
 FUNCTION GetDrMd(rp : pRastPort) : ULONG;
-FUNCTION GetExtSpriteA(ss : pExtSprite; tags : pTagItem) : LONGINT;
+FUNCTION GetExtSpriteA(ss : pExtSprite;const tags : pTagItem) : LONGINT;
 FUNCTION GetGBuffers(anOb : pAnimOb; rp : pRastPort; flag : LONGINT) : BOOLEAN;
 FUNCTION GetGBuffers(anOb : pAnimOb; rp : pRastPort; flag : LONGINT) : BOOLEAN;
 FUNCTION GetOutlinePen(rp : pRastPort) : ULONG;
 FUNCTION GetOutlinePen(rp : pRastPort) : ULONG;
-PROCEDURE GetRGB32(cm : pColorMap; firstcolor : ULONG; ncolors : ULONG; table : POINTER);
+PROCEDURE GetRGB32(const cm : pColorMap; firstcolor : ULONG; ncolors : ULONG; table : pulong);
 FUNCTION GetRGB4(colorMap : pColorMap; entry : LONGINT) : ULONG;
 FUNCTION GetRGB4(colorMap : pColorMap; entry : LONGINT) : ULONG;
-PROCEDURE GetRPAttrsA(rp : pRastPort; tags : pTagItem);
+PROCEDURE GetRPAttrsA(const rp : pRastPort;const tags : pTagItem);
 FUNCTION GetSprite(sprite : pSimpleSprite; num : LONGINT) : INTEGER;
 FUNCTION GetSprite(sprite : pSimpleSprite; num : LONGINT) : INTEGER;
-FUNCTION GetVPModeID(vp : pViewPort) : LONGINT;
-PROCEDURE GfxAssociate(associateNode : POINTER; gfxNodePtr : POINTER);
+FUNCTION GetVPModeID(const vp : pViewPort) : LONGINT;
+PROCEDURE GfxAssociate(const associateNode : POINTER; gfxNodePtr : POINTER);
 PROCEDURE GfxFree(gfxNodePtr : POINTER);
 PROCEDURE GfxFree(gfxNodePtr : POINTER);
-FUNCTION GfxLookUp(associateNode : POINTER) : POINTER;
+FUNCTION GfxLookUp(const associateNode : POINTER) : POINTER;
 FUNCTION GfxNew(gfxNodeType : ULONG) : POINTER;
 FUNCTION GfxNew(gfxNodeType : ULONG) : POINTER;
 PROCEDURE InitArea(areaInfo : pAreaInfo; vectorBuffer : POINTER; maxVectors : LONGINT);
 PROCEDURE InitArea(areaInfo : pAreaInfo; vectorBuffer : POINTER; maxVectors : LONGINT);
 PROCEDURE InitBitMap(bitMap : pBitMap; depth : LONGINT; width : LONGINT; height : LONGINT);
 PROCEDURE InitBitMap(bitMap : pBitMap; depth : LONGINT; width : LONGINT; height : LONGINT);
@@ -2321,8 +2328,8 @@ PROCEDURE InitRastPort(rp : pRastPort);
 FUNCTION InitTmpRas(tmpRas : pTmpRas; buffer : PLANEPTR; size : LONGINT) : pTmpRas;
 FUNCTION InitTmpRas(tmpRas : pTmpRas; buffer : PLANEPTR; size : LONGINT) : pTmpRas;
 PROCEDURE InitView(view : pView);
 PROCEDURE InitView(view : pView);
 PROCEDURE InitVPort(vp : pViewPort);
 PROCEDURE InitVPort(vp : pViewPort);
-PROCEDURE LoadRGB32(vp : pViewPort; table : POINTER);
-PROCEDURE LoadRGB4(vp : pViewPort; colors : POINTER; count : LONGINT);
+PROCEDURE LoadRGB32(vp : pViewPort;const table : pULONG);
+PROCEDURE LoadRGB4(vp : pViewPort;const colors : pWord; count : LONGINT);
 PROCEDURE LoadView(view : pView);
 PROCEDURE LoadView(view : pView);
 PROCEDURE LockLayerRom(layer : pLayer);
 PROCEDURE LockLayerRom(layer : pLayer);
 FUNCTION MakeVPort(view : pView; vp : pViewPort) : ULONG;
 FUNCTION MakeVPort(view : pView; vp : pViewPort) : ULONG;
@@ -2332,14 +2339,14 @@ PROCEDURE MoveSprite(vp : pViewPort; sprite : pSimpleSprite; x : LONGINT; y : LO
 FUNCTION MrgCop(view : pView) : ULONG;
 FUNCTION MrgCop(view : pView) : ULONG;
 FUNCTION NewRegion : pRegion;
 FUNCTION NewRegion : pRegion;
 FUNCTION NextDisplayInfo(displayID : ULONG) : ULONG;
 FUNCTION NextDisplayInfo(displayID : ULONG) : ULONG;
-FUNCTION ObtainBestPenA(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG; tags : pTagItem) : LONGINT;
+FUNCTION ObtainBestPenA(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG;const tags : pTagItem) : LONGINT;
 FUNCTION ObtainPen(cm : pColorMap; n : ULONG; r : ULONG; g : ULONG; b : ULONG; f : LONGINT) : ULONG;
 FUNCTION ObtainPen(cm : pColorMap; n : ULONG; r : ULONG; g : ULONG; b : ULONG; f : LONGINT) : ULONG;
 FUNCTION OpenFont(textAttr : pTextAttr) : pTextFont;
 FUNCTION OpenFont(textAttr : pTextAttr) : pTextFont;
-FUNCTION OpenMonitor(monitorName : pCHAR; displayID : ULONG) : pMonitorSpec;
-FUNCTION OrRectRegion(region : pRegion; rectangle : pRectangle) : BOOLEAN;
-FUNCTION OrRegionRegion(srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
+FUNCTION OpenMonitor(const monitorName : pCHAR; displayID : ULONG) : pMonitorSpec;
+FUNCTION OrRectRegion(region : pRegion;const rectangle : pRectangle) : BOOLEAN;
+FUNCTION OrRegionRegion(const srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
 PROCEDURE OwnBlitter;
 PROCEDURE OwnBlitter;
-PROCEDURE PolyDraw(rp : pRastPort; count : LONGINT; polyTable : POINTER);
+PROCEDURE PolyDraw(rp : pRastPort; count : LONGINT;const polyTable : pLongint);
 PROCEDURE QBlit(blit : pbltnode);
 PROCEDURE QBlit(blit : pbltnode);
 PROCEDURE QBSBlit(blit : pbltnode);
 PROCEDURE QBSBlit(blit : pbltnode);
 FUNCTION ReadPixel(rp : pRastPort; x : LONGINT; y : LONGINT) : ULONG;
 FUNCTION ReadPixel(rp : pRastPort; x : LONGINT; y : LONGINT) : ULONG;
@@ -2360,7 +2367,7 @@ PROCEDURE SetBPen(rp : pRastPort; pen : ULONG);
 FUNCTION SetChipRev(want : ULONG) : ULONG;
 FUNCTION SetChipRev(want : ULONG) : ULONG;
 PROCEDURE SetCollision(num : ULONG; routine : tPROCEDURE; gelsInfo : pGelsInfo);
 PROCEDURE SetCollision(num : ULONG; routine : tPROCEDURE; gelsInfo : pGelsInfo);
 PROCEDURE SetDrMd(rp : pRastPort; drawMode : ULONG);
 PROCEDURE SetDrMd(rp : pRastPort; drawMode : ULONG);
-FUNCTION SetFont(rp : pRastPort; textFont : pTextFont) : LONGINT;
+FUNCTION SetFont(rp : pRastPort;const textFont : pTextFont) : LONGINT;
 PROCEDURE SetMaxPen(rp : pRastPort; maxpen : ULONG);
 PROCEDURE SetMaxPen(rp : pRastPort; maxpen : ULONG);
 FUNCTION SetOutlinePen(rp : pRastPort; pen : ULONG) : ULONG;
 FUNCTION SetOutlinePen(rp : pRastPort; pen : ULONG) : ULONG;
 PROCEDURE SetRast(rp : pRastPort; pen : ULONG);
 PROCEDURE SetRast(rp : pRastPort; pen : ULONG);
@@ -2368,16 +2375,16 @@ PROCEDURE SetRGB32(vp : pViewPort; n : ULONG; r : ULONG; g : ULONG; b : ULONG);
 PROCEDURE SetRGB32CM(cm : pColorMap; n : ULONG; r : ULONG; g : ULONG; b : ULONG);
 PROCEDURE SetRGB32CM(cm : pColorMap; n : ULONG; r : ULONG; g : ULONG; b : ULONG);
 PROCEDURE SetRGB4(vp : pViewPort; index : LONGINT; red : ULONG; green : ULONG; blue : ULONG);
 PROCEDURE SetRGB4(vp : pViewPort; index : LONGINT; red : ULONG; green : ULONG; blue : ULONG);
 PROCEDURE SetRGB4CM(colorMap : pColorMap; index : LONGINT; red : ULONG; green : ULONG; blue : ULONG);
 PROCEDURE SetRGB4CM(colorMap : pColorMap; index : LONGINT; red : ULONG; green : ULONG; blue : ULONG);
-PROCEDURE SetRPAttrsA(rp : pRastPort; tags : pTagItem);
+PROCEDURE SetRPAttrsA(rp : pRastPort;const tags : pTagItem);
 FUNCTION SetSoftStyle(rp : pRastPort; style : ULONG; enable : ULONG) : ULONG;
 FUNCTION SetSoftStyle(rp : pRastPort; style : ULONG; enable : ULONG) : ULONG;
 FUNCTION SetWriteMask(rp : pRastPort; msk : ULONG) : ULONG;
 FUNCTION SetWriteMask(rp : pRastPort; msk : ULONG) : ULONG;
 PROCEDURE SortGList(rp : pRastPort);
 PROCEDURE SortGList(rp : pRastPort);
 PROCEDURE StripFont(font : pTextFont);
 PROCEDURE StripFont(font : pTextFont);
 PROCEDURE SyncSBitMap(layer : pLayer);
 PROCEDURE SyncSBitMap(layer : pLayer);
-FUNCTION GText(rp : pRastPort; string_ : pCHAR; count : ULONG) : LONGINT;
-FUNCTION TextExtent(rp : pRastPort; string_ : pCHAR; count : LONGINT; _textExtent : pTextExtent) : INTEGER;
-FUNCTION TextFit(rp : pRastPort; string_ : pCHAR; strLen : ULONG; textExtent : pTextExtent; constrainingExtent : pTextExtent; strDirection : LONGINT; constrainingBitWidth : ULONG; constrainingBitHeight : ULONG) : ULONG;
-FUNCTION TextLength(rp : pRastPort; string_ : pCHAR; count : ULONG) : INTEGER;
+FUNCTION GText(rp : pRastPort;const string_ : pCHAR; count : ULONG) : LONGINT;
+FUNCTION TextExtent(rp : pRastPort;const string_ : pCHAR; count : LONGINT; _textExtent : pTextExtent) : INTEGER;
+FUNCTION TextFit(rp : pRastPort;const string_ : pCHAR; strLen : ULONG; textExtent : pTextExtent; constrainingExtent : pTextExtent; strDirection : LONGINT; constrainingBitWidth : ULONG; constrainingBitHeight : ULONG) : ULONG;
+FUNCTION TextLength(rp : pRastPort;const string_ : pCHAR; count : ULONG) : INTEGER;
 FUNCTION UCopperListInit(uCopList : pUCopList; n : LONGINT) : pCopList;
 FUNCTION UCopperListInit(uCopList : pUCopList; n : LONGINT) : pCopList;
 PROCEDURE UnlockLayerRom(layer : pLayer);
 PROCEDURE UnlockLayerRom(layer : pLayer);
 FUNCTION VBeamPos : LONGINT;
 FUNCTION VBeamPos : LONGINT;
@@ -2390,8 +2397,8 @@ PROCEDURE WriteChunkyPixels(rp : pRastPort; xstart : ULONG; ystart : ULONG; xsto
 FUNCTION WritePixel(rp : pRastPort; x : LONGINT; y : LONGINT) : LONGINT;
 FUNCTION WritePixel(rp : pRastPort; x : LONGINT; y : LONGINT) : LONGINT;
 FUNCTION WritePixelArray8(rp : pRastPort; xstart : ULONG; ystart : ULONG; xstop : ULONG; ystop : ULONG; array_ : pointer; temprp : pRastPort) : LONGINT;
 FUNCTION WritePixelArray8(rp : pRastPort; xstart : ULONG; ystart : ULONG; xstop : ULONG; ystop : ULONG; array_ : pointer; temprp : pRastPort) : LONGINT;
 FUNCTION WritePixelLine8(rp : pRastPort; xstart : ULONG; ystart : ULONG; width : ULONG; array_ : pointer; tempRP : pRastPort) : LONGINT;
 FUNCTION WritePixelLine8(rp : pRastPort; xstart : ULONG; ystart : ULONG; width : ULONG; array_ : pointer; tempRP : pRastPort) : LONGINT;
-FUNCTION XorRectRegion(region : pRegion; rectangle : pRectangle) : BOOLEAN;
-FUNCTION XorRegionRegion(srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
+FUNCTION XorRectRegion(region : pRegion;const rectangle : pRectangle) : BOOLEAN;
+FUNCTION XorRegionRegion(const srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
 
 
 { gfxmacros }
 { gfxmacros }
 
 
@@ -2412,10 +2419,23 @@ PROCEDURE ON_SPRITE (cust: pCustom);
 PROCEDURE OFF_VBLANK (cust: pCustom);
 PROCEDURE OFF_VBLANK (cust: pCustom);
 PROCEDURE ON_VBLANK (cust: pCustom);
 PROCEDURE ON_VBLANK (cust: pCustom);
 
 
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitGRAPHICSLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    GRAPHICSIsCompiledHow : longint;
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox;
+{$endif dont_use_openlib}
 
 
 PROCEDURE BNDRYOFF (w: pRastPort);
 PROCEDURE BNDRYOFF (w: pRastPort);
 BEGIN
 BEGIN
@@ -2560,7 +2580,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION AllocBitMap(sizex : ULONG; sizey : ULONG; depth : ULONG; flags : ULONG; friend_bitmap : pBitMap) : pBitMap;
+FUNCTION AllocBitMap(sizex : ULONG; sizey : ULONG; depth : ULONG; flags : ULONG;const friend_bitmap : pBitMap) : pBitMap;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2601,7 +2621,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION AllocSpriteDataA(bm : pBitMap; tags : pTagItem) : pExtSprite;
+FUNCTION AllocSpriteDataA(const bm : pBitMap;const tags : pTagItem) : pExtSprite;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2614,7 +2634,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE AndRectRegion(region : pRegion; rectangle : pRectangle);
+PROCEDURE AndRectRegion(region : pRegion;const rectangle : pRectangle);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2626,7 +2646,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION AndRegionRegion(srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
+FUNCTION AndRegionRegion(const srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2762,7 +2782,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION BestModeIDA(tags : pTagItem) : ULONG;
+FUNCTION BestModeIDA(const tags : pTagItem) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2785,7 +2805,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION BltBitMap(srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destBitMap : pBitMap; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG; mask : ULONG; tempA : pCHAR) : LONGINT;
+FUNCTION BltBitMap(const srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destBitMap : pBitMap; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG; mask : ULONG; tempA : pCHAR) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2807,7 +2827,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE BltBitMapRastPort(srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG);
+PROCEDURE BltBitMapRastPort(const srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2839,7 +2859,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE BltMaskBitMapRastPort(srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG; bltMask : pCHAR);
+PROCEDURE BltMaskBitMapRastPort(const srcBitMap : pBitMap; xSrc : LONGINT; ySrc : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT; minterm : ULONG;const bltMask : pCHAR);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2859,7 +2879,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE BltPattern(rp : pRastPort; mask : pCHAR; xMin : LONGINT; yMin : LONGINT; xMax : LONGINT; yMax : LONGINT; maskBPR : ULONG);
+PROCEDURE BltPattern(rp : pRastPort;const mask : pCHAR; xMin : LONGINT; yMin : LONGINT; xMax : LONGINT; yMax : LONGINT; maskBPR : ULONG);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2876,7 +2896,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE BltTemplate(source : pCHAR; xSrc : LONGINT; srcMod : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT);
+PROCEDURE BltTemplate(const source : pCHAR; xSrc : LONGINT; srcMod : LONGINT; destRP : pRastPort; xDest : LONGINT; yDest : LONGINT; xSize : LONGINT; ySize : LONGINT);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2918,7 +2938,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION ChangeExtSpriteA(vp : pViewPort; oldsprite : pExtSprite; newsprite : pExtSprite; tags : pTagItem) : LONGINT;
+FUNCTION ChangeExtSpriteA(vp : pViewPort; oldsprite : pExtSprite; newsprite : pExtSprite;const tags : pTagItem) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2933,7 +2953,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE ChangeSprite(vp : pViewPort; sprite : pSimpleSprite; newData : pCHAR);
+PROCEDURE ChangeSprite(vp : pViewPort; sprite : pSimpleSprite; newData : pWORD);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -2970,7 +2990,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION ClearRectRegion(region : pRegion; rectangle : pRectangle) : BOOLEAN;
+FUNCTION ClearRectRegion(region : pRegion;const rectangle : pRectangle) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3191,7 +3211,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION ExtendFont(font : pTextFont; fontTags : pTagItem) : ULONG;
+FUNCTION ExtendFont(font : pTextFont;const fontTags : pTagItem) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3250,7 +3270,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE FontExtent(font : pTextFont; fontExtent : pTextExtent);
+PROCEDURE FontExtent(const font : pTextFont; fontExtent : pTextExtent);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3388,7 +3408,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetBitMapAttr(bm : pBitMap; attrnum : ULONG) : ULONG;
+FUNCTION GetBitMapAttr(const bm : pBitMap; attrnum : ULONG) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3425,7 +3445,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetDisplayInfoData(handle : POINTER; buf : pCHAR; size : ULONG; tagID : ULONG; displayID : ULONG) : ULONG;
+FUNCTION GetDisplayInfoData(const handle : POINTER; buf : pCHAR; size : ULONG; tagID : ULONG; displayID : ULONG) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3453,7 +3473,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetExtSpriteA(ss : pExtSprite; tags : pTagItem) : LONGINT;
+FUNCTION GetExtSpriteA(ss : pExtSprite;const tags : pTagItem) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3495,7 +3515,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE GetRGB32(cm : pColorMap; firstcolor : ULONG; ncolors : ULONG; table : POINTER);
+PROCEDURE GetRGB32(const cm : pColorMap; firstcolor : ULONG; ncolors : ULONG; table : pUlong);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3522,7 +3542,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE GetRPAttrsA(rp : pRastPort; tags : pTagItem);
+PROCEDURE GetRPAttrsA(const rp : pRastPort;const tags : pTagItem);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3547,7 +3567,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetVPModeID(vp : pViewPort) : LONGINT;
+FUNCTION GetVPModeID(const vp : pViewPort) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3559,7 +3579,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE GfxAssociate(associateNode : POINTER; gfxNodePtr : POINTER);
+PROCEDURE GfxAssociate(const associateNode : POINTER; gfxNodePtr : POINTER);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3582,7 +3602,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GfxLookUp(associateNode : POINTER) : POINTER;
+FUNCTION GfxLookUp(const associateNode : POINTER) : POINTER;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3715,7 +3735,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE LoadRGB32(vp : pViewPort; table : POINTER);
+PROCEDURE LoadRGB32(vp : pViewPort;const table : pULONG);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3727,7 +3747,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE LoadRGB4(vp : pViewPort; colors : POINTER; count : LONGINT);
+PROCEDURE LoadRGB4(vp : pViewPort;const colors : pWord; count : LONGINT);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3849,7 +3869,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION ObtainBestPenA(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG; tags : pTagItem) : LONGINT;
+FUNCTION ObtainBestPenA(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG;const tags : pTagItem) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3894,7 +3914,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION OpenMonitor(monitorName : pCHAR; displayID : ULONG) : pMonitorSpec;
+FUNCTION OpenMonitor(const monitorName : pCHAR; displayID : ULONG) : pMonitorSpec;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3907,7 +3927,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION OrRectRegion(region : pRegion; rectangle : pRectangle) : BOOLEAN;
+FUNCTION OrRectRegion(region : pRegion;const rectangle : pRectangle) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3923,7 +3943,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION OrRegionRegion(srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
+FUNCTION OrRegionRegion(const srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -3949,7 +3969,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE PolyDraw(rp : pRastPort; count : LONGINT; polyTable : POINTER);
+PROCEDURE PolyDraw(rp : pRastPort; count : LONGINT;const polyTable : pLongint);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4229,7 +4249,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION SetFont(rp : pRastPort; textFont : pTextFont) : LONGINT;
+FUNCTION SetFont(rp : pRastPort;const textFont : pTextFont) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4339,7 +4359,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE SetRPAttrsA(rp : pRastPort; tags : pTagItem);
+PROCEDURE SetRPAttrsA(rp : pRastPort;const tags : pTagItem);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4411,7 +4431,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GText(rp : pRastPort; string_ : pCHAR; count : ULONG) : LONGINT;
+FUNCTION GText(rp : pRastPort;const string_ : pCHAR; count : ULONG) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4425,7 +4445,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION TextExtent(rp : pRastPort; string_ : pCHAR; count : LONGINT; _textExtent : pTextExtent) : INTEGER;
+FUNCTION TextExtent(rp : pRastPort;const string_ : pCHAR; count : LONGINT; _textExtent : pTextExtent) : INTEGER;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4440,7 +4460,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION TextFit(rp : pRastPort; string_ : pCHAR; strLen : ULONG; textExtent : pTextExtent; constrainingExtent : pTextExtent; strDirection : LONGINT; constrainingBitWidth : ULONG; constrainingBitHeight : ULONG) : ULONG;
+FUNCTION TextFit(rp : pRastPort;const string_ : pCHAR; strLen : ULONG; textExtent : pTextExtent; constrainingExtent : pTextExtent; strDirection : LONGINT; constrainingBitWidth : ULONG; constrainingBitHeight : ULONG) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4459,7 +4479,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION TextLength(rp : pRastPort; string_ : pCHAR; count : ULONG) : INTEGER;
+FUNCTION TextLength(rp : pRastPort;const string_ : pCHAR; count : ULONG) : INTEGER;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4635,7 +4655,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION XorRectRegion(region : pRegion; rectangle : pRectangle) : BOOLEAN;
+FUNCTION XorRectRegion(region : pRegion;const rectangle : pRectangle) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4651,7 +4671,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION XorRegionRegion(srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
+FUNCTION XorRegionRegion(const srcRegion : pRegion; destRegion : pRegion) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -4667,51 +4687,98 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-   {$Info Compiling autoopening of graphics.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of graphics.library}
+  {$Info don't forget to use InitGRAPHICSLibrary in the beginning of your program}
 
 
 var
 var
-    GfxBase_exit : Pointer;
+    graphics_exit : Pointer;
 
 
-procedure CloseGfxBaseLibrary;
+procedure ClosegraphicsLibrary;
 begin
 begin
-    ExitProc := GfxBase_exit;
+    ExitProc := graphics_exit;
     if GfxBase <> nil then begin
     if GfxBase <> nil then begin
-       CloseLibrary(GfxBase);
-       GfxBase := nil;
+        CloseLibrary(GfxBase);
+        GfxBase := nil;
     end;
     end;
 end;
 end;
 
 
-const
-    VERSION : string[2] = '37';
+procedure InitGRAPHICSLibrary;
+begin
+    GfxBase := nil;
+    GfxBase := OpenLibrary(GRAPHICSNAME,LIBVERSION);
+    if GfxBase <> nil then begin
+        graphics_exit := ExitProc;
+        ExitProc := @ClosegraphicsLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open graphics.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    GRAPHICSIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of graphics.library}
+
+var
+    graphics_exit : Pointer;
+
+procedure ClosegraphicsLibrary;
+begin
+    ExitProc := graphics_exit;
+    if GfxBase <> nil then begin
+        CloseLibrary(GfxBase);
+        GfxBase := nil;
+    end;
+end;
 
 
 begin
 begin
     GfxBase := nil;
     GfxBase := nil;
-    GfxBase := OpenLibrary(GRAPHICSNAME,37);
+    GfxBase := OpenLibrary(GRAPHICSNAME,LIBVERSION);
     if GfxBase <> nil then begin
     if GfxBase <> nil then begin
-       GfxBase_exit := ExitProc;
-       ExitProc := @CloseGfxBaseLibrary;
+        graphics_exit := ExitProc;
+        ExitProc := @ClosegraphicsLibrary;
+        GRAPHICSIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
-                   'Can''t open graphics.library version ' +
-                   VERSION +
-                   chr(10) + 
-                   'Deallocating resources and closing down',
-                   'Oops');
-       halt(20);
+        'Can''t open graphics.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of graphics.library compiled}
-   {$Info Make sure you open graphics.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    GRAPHICSIsCompiledHow := 3;
+   {$Warning No autoopening of graphics.library compiled}
+   {$Warning Make sure you open graphics.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT GRAPHICS *)
 END. (* UNIT GRAPHICS *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-13 20:36:00  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/13 20:36:00  nils
   * added the defines use_amiga_smartlink
   * added the defines use_amiga_smartlink
   * and use_auto_openlib
   * and use_auto_openlib
 
 

+ 581 - 57
packages/extra/amunits/units/icon.pas

@@ -27,6 +27,24 @@
     the library.
     the library.
     14 Jan 2003.
     14 Jan 2003.
 
 
+    Update for AmigaOS 3.9.
+    A lof of new const and a record.
+    Functions added.
+         FUNCTION DupDiskObjectA
+         FUNCTION IconControlA
+         PROCEDURE DrawIconStateA
+         FUNCTION GetIconRectangleA
+         FUNCTION NewDiskObject
+         FUNCTION GetIconTagList
+         FUNCTION PutIconTagList
+         FUNCTION LayoutIconA
+         PROCEDURE ChangeToSelectedIconColor
+    plus overlay for
+         FUNCTION GetIconTagList;
+         FUNCTION PutIconTagList
+    Changed start code for unit.
+    02 Feb 2003.
+    
     [email protected]
     [email protected]
 }
 }
 
 
@@ -40,7 +58,290 @@ unit icon;
 INTERFACE
 INTERFACE
 
 
 
 
-uses exec, workbench;
+uses exec, workbench,utility,amigados,graphics,intuition,datatypes;
+
+    const
+    ICONA_Dummy = TAG_USER + $9000;
+  {                                                                           }
+  { Error reporting (LONG  )  }
+     ICONA_ErrorCode = ICONA_Dummy + 1;
+
+  { Points to the tag item that caused the error (struct TagItem   ).  }
+     ICONA_ErrorTagItem = ICONA_Dummy + 75;
+  {                                                                           }
+  { Global options for IconControlA()  }
+
+  { Screen to use for remapping Workbench icons to (struct Screen  )  }
+     ICONCTRLA_SetGlobalScreen = ICONA_Dummy + 2;
+     ICONCTRLA_GetGlobalScreen = ICONA_Dummy + 3;
+
+  { Icon color remapping precision; defaults to PRECISION_ICON (LONG)  }
+     ICONCTRLA_SetGlobalPrecision = ICONA_Dummy + 4;
+     ICONCTRLA_GetGlobalPrecision = ICONA_Dummy + 5;
+
+  { Icon frame size dimensions (struct Rectangle  )  }
+     ICONCTRLA_SetGlobalEmbossRect = ICONA_Dummy + 6;
+     ICONCTRLA_GetGlobalEmbossRect = ICONA_Dummy + 7;
+
+  { Render image without frame (BOOL)  }
+     ICONCTRLA_SetGlobalFrameless = ICONA_Dummy + 8;
+     ICONCTRLA_GetGlobalFrameless = ICONA_Dummy + 9;
+
+  { Enable NewIcons support (BOOL)  }
+     ICONCTRLA_SetGlobalNewIconsSupport = ICONA_Dummy + 10;
+     ICONCTRLA_GetGlobalNewIconsSupport = ICONA_Dummy + 11;
+
+  { Enable color icon support (BOOL)  }
+     ICONCTRLA_SetGlobalColorIconSupport = ICONA_Dummy + 77;
+     ICONCTRLA_GetGlobalColorIconSupport = ICONA_Dummy + 78;
+
+  { Set/Get the hook to be called when identifying a file (struct Hook  )  }
+     ICONCTRLA_SetGlobalIdentifyHook = ICONA_Dummy + 12;
+     ICONCTRLA_GetGlobalIdentifyHook = ICONA_Dummy + 13;
+
+  { Set/get the maximum length of a file/drawer name supported
+     by icon.library (LONG).
+    }
+     ICONCTRLA_SetGlobalMaxNameLength = ICONA_Dummy + 67;
+     ICONCTRLA_GetGlobalMaxNameLength = ICONA_Dummy + 68;
+
+  {**************************************************************************}
+  { Per icon local options for IconControlA()  }
+
+  { Get the icon rendering masks (PLANEPTR)  }
+     ICONCTRLA_GetImageMask1 = ICONA_Dummy + 14;
+     ICONCTRLA_GetImageMask2 = ICONA_Dummy + 15;
+
+  { Transparent image color; set to -1 if opaque  }
+     ICONCTRLA_SetTransparentColor1 = ICONA_Dummy + 16;
+     ICONCTRLA_GetTransparentColor1 = ICONA_Dummy + 17;
+     ICONCTRLA_SetTransparentColor2 = ICONA_Dummy + 18;
+     ICONCTRLA_GetTransparentColor2 = ICONA_Dummy + 19;
+
+  { Image color palette (struct ColorRegister  )  }
+     ICONCTRLA_SetPalette1 = ICONA_Dummy + 20;
+     ICONCTRLA_GetPalette1 = ICONA_Dummy + 21;
+     ICONCTRLA_SetPalette2 = ICONA_Dummy + 22;
+     ICONCTRLA_GetPalette2 = ICONA_Dummy + 23;
+
+  { Size of image color palette (LONG)  }
+     ICONCTRLA_SetPaletteSize1 = ICONA_Dummy + 24;
+     ICONCTRLA_GetPaletteSize1 = ICONA_Dummy + 25;
+     ICONCTRLA_SetPaletteSize2 = ICONA_Dummy + 26;
+     ICONCTRLA_GetPaletteSize2 = ICONA_Dummy + 27;
+
+  { Image data; one by per pixel (UBYTE  )  }
+     ICONCTRLA_SetImageData1 = ICONA_Dummy + 28;
+     ICONCTRLA_GetImageData1 = ICONA_Dummy + 29;
+     ICONCTRLA_SetImageData2 = ICONA_Dummy + 30;
+     ICONCTRLA_GetImageData2 = ICONA_Dummy + 31;
+
+  { Render image without frame (BOOL)  }
+     ICONCTRLA_SetFrameless = ICONA_Dummy + 32;
+     ICONCTRLA_GetFrameless = ICONA_Dummy + 33;
+
+  { Enable NewIcons support (BOOL)  }
+     ICONCTRLA_SetNewIconsSupport = ICONA_Dummy + 34;
+     ICONCTRLA_GetNewIconsSupport = ICONA_Dummy + 35;
+
+  { Icon aspect ratio (UBYTE  )  }
+     ICONCTRLA_SetAspectRatio = ICONA_Dummy + 36;
+     ICONCTRLA_GetAspectRatio = ICONA_Dummy + 37;
+
+  { Icon dimensions; valid only for palette mapped icon images (LONG)  }
+     ICONCTRLA_SetWidth = ICONA_Dummy + 38;
+     ICONCTRLA_GetWidth = ICONA_Dummy + 39;
+     ICONCTRLA_SetHeight = ICONA_Dummy + 40;
+     ICONCTRLA_GetHeight = ICONA_Dummy + 41;
+
+  { Check whether the icon is palette mapped (LONG  ).  }
+     ICONCTRLA_IsPaletteMapped = ICONA_Dummy + 42;
+
+  { Get the screen the icon is attached to (struct Screen   ).  }
+     ICONCTRLA_GetScreen = ICONA_Dummy + 43;
+
+  { Check whether the icon has a real select image (LONG  ).  }
+     ICONCTRLA_HasRealImage2 = ICONA_Dummy + 44;
+
+  { Check whether the icon is of the NewIcon type (LONG  ).  }
+     ICONCTRLA_IsNewIcon = ICONA_Dummy + 79;
+
+  { Check whether this icon was allocated by icon.library
+     or if consists solely of a statically allocated
+     struct DiskObject. (LONG  ).
+    }
+     ICONCTRLA_IsNativeIcon = ICONA_Dummy + 80;
+
+  {**************************************************************************}
+
+  { Icon aspect ratio is not known.  }
+     ICON_ASPECT_RATIO_UNKNOWN = 0;
+
+{ Tags for use with GetIconTagList() }
+
+{ Default icon type to retrieve (LONG) }
+     ICONGETA_GetDefaultType	= ICONA_Dummy+45;
+
+{ Retrieve default icon for the given name (STRPTR) }
+       ICONGETA_GetDefaultName = ICONA_Dummy + 46;
+
+    { Return a default icon if the requested icon
+       file cannot be found (BOOL).
+      }
+       ICONGETA_FailIfUnavailable = ICONA_Dummy + 47;
+
+    { If possible, retrieve a palette mapped icon (BOOL).  }
+       ICONGETA_GetPaletteMappedIcon = ICONA_Dummy + 48;
+
+    { Set if the icon returned is a default icon (BOOL  ).  }
+       ICONGETA_IsDefaultIcon = ICONA_Dummy + 49;
+
+    { Remap the icon to the default screen, if possible (BOOL).  }
+       ICONGETA_RemapIcon = ICONA_Dummy + 50;
+
+    { Generate icon image masks (BOOL).  }
+       ICONGETA_GenerateImageMasks = ICONA_Dummy + 51;
+
+    { Label text to be assigned to the icon (STRPTR).  }
+       ICONGETA_Label = ICONA_Dummy + 52;
+
+    { Screen to remap the icon to (struct Screen  ).  }
+       ICONGETA_Screen = ICONA_Dummy + 69;
+  
+    {**************************************************************************}
+
+    { Tags for use with PutIconTagList()  }
+
+    { Notify Workbench of the icon being written (BOOL)  }
+       ICONPUTA_NotifyWorkbench = ICONA_Dummy + 53;
+
+    { Store icon as the default for this type (LONG)  }
+       ICONPUTA_PutDefaultType = ICONA_Dummy + 54;
+
+    { Store icon as a default for the given name (STRPTR)  }
+       ICONPUTA_PutDefaultName = ICONA_Dummy + 55;
+
+    { When storing a palette mapped icon, don't save the
+       the original planar icon image with the file. Replace
+       it with a tiny replacement image.
+      }
+       ICONPUTA_DropPlanarIconImage = ICONA_Dummy + 56;
+
+    { Don't write the chunky icon image data to disk.  }
+       ICONPUTA_DropChunkyIconImage = ICONA_Dummy + 57;
+
+    { Don't write the NewIcons tool types to disk.  }
+       ICONPUTA_DropNewIconToolTypes = ICONA_Dummy + 58;
+
+    { If this tag is enabled, the writer will examine the
+       icon image data to find out whether it can compress
+       it more efficiently. This may take extra time and
+       is not generally recommended.
+      }
+       ICONPUTA_OptimizeImageSpace = ICONA_Dummy + 59;
+
+    { Don't write the entire icon file back to disk,
+       only change the do->do_CurrentX/do->do_CurrentY
+       members.
+      }
+       ICONPUTA_OnlyUpdatePosition = ICONA_Dummy + 72;
+
+    { Before writing a palette mapped icon back to disk,
+       icon.library will make sure that the original
+       planar image data is stored in the file. If you
+       don't want that to happen, set this option to
+       FALSE. This will allow you to change the planar icon
+       image data written back to disk.
+      }
+      ICONPUTA_PreserveOldIconImages = ICONA_Dummy + 84;
+
+{**************************************************************************}
+
+{ For use with the file identification hook. }
+
+          type
+       PIconIdentifyMsg = ^tIconIdentifyMsg;
+       tIconIdentifyMsg = record
+            { Libraries that are already opened for your use. }
+            iim_SysBase : PLibrary;
+            iim_DOSBase : PLibrary;
+            iim_UtilityBase : PLibrary;
+            iim_IconBase : PLibrary;
+
+	    { File context information. }
+            iim_FileLock : BPTR;           { Lock on the object to return an icon for. }
+            iim_ParentLock : BPTR;         { Lock on the object's parent directory, if available. }
+            iim_FIB : PFileInfoBlock;      { Already initialized for you. }
+            iim_FileHandle : BPTR;         { If non-NULL, pointer to the file to examine,
+						 * positioned right at the first byte, ready
+						 * for you to use.
+						 }
+            iim_Tags : PTagItem;           { Tags passed to GetIconTagList(). }
+         end;
+
+{**************************************************************************}
+
+    { Tags for use with DupDiskObjectA()  }
+
+    const
+    { Duplicate do_DrawerData  }
+       ICONDUPA_DuplicateDrawerData = ICONA_Dummy + 60;
+
+    { Duplicate the Image structures.  }
+       ICONDUPA_DuplicateImages = ICONA_Dummy + 61;
+
+    { Duplicate the image data (Image->ImageData) itself.  }
+       ICONDUPA_DuplicateImageData = ICONA_Dummy + 62;
+
+    { Duplicate the default tool.  }
+       ICONDUPA_DuplicateDefaultTool = ICONA_Dummy + 63;
+
+    { Duplicate the tool types list.  }
+       ICONDUPA_DuplicateToolTypes = ICONA_Dummy + 64;
+
+    { Duplicate the tool window.  }
+       ICONDUPA_DuplicateToolWindow = ICONA_Dummy + 65;
+
+    { If the icon to be duplicated is in fact a palette mapped
+       icon which has never been set up to be displayed on the
+       screen, turn the duplicate into that palette mapped icon.
+      }
+       ICONDUPA_ActivateImageData = ICONA_Dummy + 82;
+
+{**************************************************************************}
+
+    { Tags for use with DrawIconStateA() and GetIconRectangleA().  }
+
+    { Drawing information to use (struct DrawInfo  ).  }
+       ICONDRAWA_DrawInfo = ICONA_Dummy + 66;
+
+    { Draw the icon without the surrounding frame (BOOL).  }
+       ICONDRAWA_Frameless = ICONA_Dummy + 70;
+
+    { Erase the background before drawing a frameless icon (BOOL).  }
+       ICONDRAWA_EraseBackground = ICONA_Dummy + 71;
+
+    { Draw the icon without the surrounding border and frame (BOOL).  }
+       ICONDRAWA_Borderless = ICONA_Dummy + 83;
+
+    { The icon to be drawn refers to a linked object (BOOL).  }
+       ICONDRAWA_IsLink = ICONA_Dummy + 89;
+
+{**************************************************************************}
+
+    { Reserved tags; don't use!  }
+       ICONA_Reserved1 = ICONA_Dummy + 73;
+       ICONA_Reserved2 = ICONA_Dummy + 74;
+       ICONA_Reserved3 = ICONA_Dummy + 76;
+       ICONA_Reserved4 = ICONA_Dummy + 81;
+       ICONA_Reserved5 = ICONA_Dummy + 85;
+       ICONA_Reserved6 = ICONA_Dummy + 86;
+       ICONA_Reserved7 = ICONA_Dummy + 87;
+       ICONA_Reserved8 = ICONA_Dummy + 88;
+    {                                                                           }
+       ICONA_LAST_TAG = ICONA_Dummy + 89;
+
+{**************************************************************************}
 
 
 
 
 Const
 Const
@@ -49,39 +350,76 @@ Const
 
 
 VAR IconBase : pLibrary;
 VAR IconBase : pLibrary;
 
 
-FUNCTION AddFreeList(freelist : pFreeList; mem : POINTER; size : ULONG) : BOOLEAN;
-FUNCTION BumpRevision(newname : pCHAR; oldname : pCHAR) : pCHAR;
-FUNCTION DeleteDiskObject(name : pCHAR) : BOOLEAN;
-FUNCTION FindToolType(toolTypeArray : POINTER; typeName : pCHAR) : pCHAR;
+FUNCTION AddFreeList(freelist : pFreeList;const mem : POINTER; size : ULONG) : BOOLEAN;
+FUNCTION BumpRevision(newname : pCHAR;const oldname : pCHAR) : pCHAR;
+FUNCTION DeleteDiskObject(const name : pCHAR) : BOOLEAN;
+FUNCTION FindToolType(const toolTypeArray : POINTER;const typeName : pCHAR) : pCHAR;
 PROCEDURE FreeDiskObject(diskobj : pDiskObject);
 PROCEDURE FreeDiskObject(diskobj : pDiskObject);
 PROCEDURE FreeFreeList(freelist : pFreeList);
 PROCEDURE FreeFreeList(freelist : pFreeList);
 FUNCTION GetDefDiskObject(typ : LONGINT) : pDiskObject;
 FUNCTION GetDefDiskObject(typ : LONGINT) : pDiskObject;
-FUNCTION GetDiskObject(name : pCHAR) : pDiskObject;
-FUNCTION GetDiskObjectNew(name : pCHAR) : pDiskObject;
-FUNCTION MatchToolValue(typeString : pCHAR; value : pCHAR) : BOOLEAN;
-FUNCTION PutDefDiskObject(diskObject : pDiskObject) : BOOLEAN;
-FUNCTION PutDiskObject(name : pCHAR; diskobj : pDiskObject) : BOOLEAN;
-
-
-FUNCTION BumpRevision(newname : string; oldname : pCHAR) : pCHAR;
-FUNCTION BumpRevision(newname : pCHar; oldname : string) : pCHAR;
-FUNCTION BumpRevision(newname : string; oldname : string) : pCHAR;
-FUNCTION DeleteDiskObject(name : string) : BOOLEAN;
-FUNCTION FindToolType(toolTypeArray : POINTER; typeName : string) : pCHAR;
-FUNCTION GetDiskObject(name : string) : pDiskObject;
-FUNCTION GetDiskObjectNew(name : string) : pDiskObject;
-FUNCTION MatchToolValue(typeString : string; value : pCHAR) : BOOLEAN;
-FUNCTION MatchToolValue(typeString : pCHAR; value : string) : BOOLEAN;
-FUNCTION MatchToolValue(typeString : string; value : string) : BOOLEAN;
-FUNCTION PutDiskObject(name : string; diskobj : pDiskObject) : BOOLEAN;
+FUNCTION GetDiskObject(const name : pCHAR) : pDiskObject;
+FUNCTION GetDiskObjectNew(const name : pCHAR) : pDiskObject;
+FUNCTION MatchToolValue(const typeString : pCHAR;const value : pCHAR) : BOOLEAN;
+FUNCTION PutDefDiskObject(const diskObject : pDiskObject) : BOOLEAN;
+FUNCTION PutDiskObject(const name : pCHAR;const diskobj : pDiskObject) : BOOLEAN;
+
+{ version 44 }
+FUNCTION DupDiskObjectA(CONST diskObject : pDiskObject; CONST tags : pTagItem) : pDiskObject;
+FUNCTION IconControlA(icon : pDiskObject; CONST tags : pTagItem) : CARDINAL;
+PROCEDURE DrawIconStateA(rp : pRastPort; CONST icon : pDiskObject; CONST label_ : pCHAR; leftOffset : LONGINT; topOffset : LONGINT; state : CARDINAL; CONST tags : pTagItem);
+FUNCTION GetIconRectangleA(rp : pRastPort; CONST icon : pDiskObject; CONST label_ : pCHAR; rect : pRectangle; CONST tags : pTagItem) : BOOLEAN;
+FUNCTION NewDiskObject(type_ : LONGINT) : pDiskObject;
+FUNCTION GetIconTagList(CONST name : pCHAR; CONST tags : pTagItem) : pDiskObject;
+FUNCTION PutIconTagList(CONST name : pCHAR; CONST icon : pDiskObject; CONST tags : pTagItem) : BOOLEAN;
+FUNCTION LayoutIconA(icon : pDiskObject; screen : pScreen; tags : pTagItem) : BOOLEAN;
+PROCEDURE ChangeToSelectedIconColor(cr : pColorRegister);
+
+{ overlay }
+FUNCTION BumpRevision(newname : string;const oldname : pCHAR) : pCHAR;
+FUNCTION BumpRevision(newname : pCHar;const oldname : string) : pCHAR;
+FUNCTION BumpRevision(newname : string;const oldname : string) : pCHAR;
+FUNCTION DeleteDiskObject(const name : string) : BOOLEAN;
+FUNCTION FindToolType(const toolTypeArray : POINTER;const typeName : string) : pCHAR;
+FUNCTION GetDiskObject(const name : string) : pDiskObject;
+FUNCTION GetDiskObjectNew(const name : string) : pDiskObject;
+FUNCTION MatchToolValue(const typeString :string;const value : pCHAR) : BOOLEAN;
+FUNCTION MatchToolValue(const typeString : pCHAR;const value : string) : BOOLEAN;
+FUNCTION MatchToolValue(const typeString : string;const value : string) : BOOLEAN;
+FUNCTION PutDiskObject(const name : string;const diskobj : pDiskObject) : BOOLEAN;
+
+{ version 44 overlay}
+FUNCTION GetIconTagList(CONST name : string; CONST tags : pTagItem) : pDiskObject;
+FUNCTION PutIconTagList(CONST name : string; CONST icon : pDiskObject; CONST tags : pTagItem) : BOOLEAN;
+
+{macros}
+function PACK_ICON_ASPECT_RATIO(num,den : longint) : longint;
+
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitICONLibrary;
+{$endif use_init_openlib}
 
 
+{This is a variable that knows how the unit is compiled}
+var
+    ICONIsCompiledHow : longint;
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+pastoc;
 
 
-uses pastoc,msgbox;
+function PACK_ICON_ASPECT_RATIO(num,den : longint) : longint;
+begin
+    PACK_ICON_ASPECT_RATIO:=(num shl 4) or den;
+end;
 
 
-FUNCTION AddFreeList(freelist : pFreeList; mem : POINTER; size : ULONG) : BOOLEAN;
+FUNCTION AddFreeList(freelist : pFreeList;const mem : POINTER; size : ULONG) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -98,7 +436,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION BumpRevision(newname : pCHAR; oldname : pCHAR) : pCHAR;
+FUNCTION BumpRevision(newname : pCHAR;const oldname : pCHAR) : pCHAR;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -111,7 +449,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION DeleteDiskObject(name : pCHAR) : BOOLEAN;
+FUNCTION DeleteDiskObject(const name : pCHAR) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -126,7 +464,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION FindToolType(toolTypeArray : POINTER; typeName : pCHAR) : pCHAR;
+FUNCTION FindToolType(const toolTypeArray : POINTER;const typeName : pCHAR) : pCHAR;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -173,7 +511,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetDiskObject(name : pCHAR) : pDiskObject;
+FUNCTION GetDiskObject(const name : pCHAR) : pDiskObject;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -185,7 +523,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION GetDiskObjectNew(name : pCHAR) : pDiskObject;
+FUNCTION GetDiskObjectNew(const name : pCHAR) : pDiskObject;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -197,7 +535,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION MatchToolValue(typeString : pCHAR; value : pCHAR) : BOOLEAN;
+FUNCTION MatchToolValue(const typeString : pCHAR;const value : pCHAR) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -213,7 +551,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION PutDefDiskObject(diskObject : pDiskObject) : BOOLEAN;
+FUNCTION PutDefDiskObject(const diskObject : pDiskObject) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -228,7 +566,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION PutDiskObject(name : pCHAR; diskobj : pDiskObject) : BOOLEAN;
+FUNCTION PutDiskObject(const name : pCHAR;const diskobj : pDiskObject) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -244,65 +582,212 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
+FUNCTION DupDiskObjectA(CONST diskObject : pDiskObject; CONST tags : pTagItem) : pDiskObject;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	diskObject,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	IconBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION IconControlA(icon : pDiskObject; CONST tags : pTagItem) : CARDINAL;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	icon,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	IconBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE DrawIconStateA(rp : pRastPort; CONST icon : pDiskObject; CONST label_ : pCHAR; leftOffset : LONGINT; topOffset : LONGINT; state : CARDINAL; CONST tags : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A0
+	MOVEA.L	icon,A1
+	MOVEA.L	label_,A2
+	MOVE.L	leftOffset,D0
+	MOVE.L	topOffset,D1
+	MOVE.L	state,D2
+	MOVEA.L	tags,A3
+	MOVEA.L	IconBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION GetIconRectangleA(rp : pRastPort; CONST icon : pDiskObject; CONST label_ : pCHAR; rect : pRectangle; CONST tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A0
+	MOVEA.L	icon,A1
+	MOVEA.L	label_,A2
+	MOVEA.L	rect,A3
+	MOVEA.L	tags,A4
+	MOVEA.L	IconBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION NewDiskObject(type_ : LONGINT) : pDiskObject;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	type_,D0
+	MOVEA.L	IconBase,A6
+	JSR	-174(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GetIconTagList(CONST name : pCHAR; CONST tags : pTagItem) : pDiskObject;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	IconBase,A6
+	JSR	-180(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
 
 
-FUNCTION BumpRevision(newname : string; oldname : pCHAR) : pCHAR;
+FUNCTION PutIconTagList(CONST name : pCHAR; CONST icon : pDiskObject; CONST tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	icon,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	IconBase,A6
+	JSR	-186(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION LayoutIconA(icon : pDiskObject; screen : pScreen; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	icon,A0
+	MOVEA.L	screen,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	IconBase,A6
+	JSR	-192(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+PROCEDURE ChangeToSelectedIconColor(cr : pColorRegister);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	cr,A0
+	MOVEA.L	IconBase,A6
+	JSR	-198(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION BumpRevision(newname : string;const oldname : pCHAR) : pCHAR;
 begin
 begin
       BumpRevision := BumpRevision(pas2c(newname),oldname);
       BumpRevision := BumpRevision(pas2c(newname),oldname);
 end;
 end;
 
 
-FUNCTION BumpRevision(newname : pCHar; oldname : string) : pCHAR;
+FUNCTION BumpRevision(newname : pCHar;const oldname : string) : pCHAR;
 begin
 begin
       BumpRevision := BumpRevision(newname,pas2c(oldname));
       BumpRevision := BumpRevision(newname,pas2c(oldname));
 end;
 end;
 
 
-FUNCTION BumpRevision(newname : string; oldname : string) : pCHAR;
+FUNCTION BumpRevision(newname : string;const oldname : string) : pCHAR;
 begin
 begin
       BumpRevision := BumpRevision(pas2c(newname),pas2c(oldname));
       BumpRevision := BumpRevision(pas2c(newname),pas2c(oldname));
 end;
 end;
 
 
-FUNCTION DeleteDiskObject(name : string) : BOOLEAN;
+FUNCTION DeleteDiskObject(const name : string) : BOOLEAN;
 begin
 begin
       DeleteDiskObject := DeleteDiskObject(pas2c(name));
       DeleteDiskObject := DeleteDiskObject(pas2c(name));
 end;
 end;
 
 
-FUNCTION FindToolType(toolTypeArray : POINTER; typeName : string) : pCHAR;
+FUNCTION FindToolType(const toolTypeArray : POINTER;const typeName : string) : pCHAR;
 begin
 begin
       FindToolType := FindToolType(toolTypeArray,pas2c(typeName));
       FindToolType := FindToolType(toolTypeArray,pas2c(typeName));
 end;
 end;
 
 
-FUNCTION GetDiskObject(name : string) : pDiskObject;
+FUNCTION GetDiskObject(const name : string) : pDiskObject;
 begin
 begin
       GetDiskObject := GetDiskObject(pas2c(name));
       GetDiskObject := GetDiskObject(pas2c(name));
 end;
 end;
 
 
-FUNCTION GetDiskObjectNew(name : string) : pDiskObject;
+FUNCTION GetDiskObjectNew(const name : string) : pDiskObject;
 begin
 begin
       GetDiskObjectNew := GetDiskObjectNew(pas2c(name)); 
       GetDiskObjectNew := GetDiskObjectNew(pas2c(name)); 
 end;
 end;
 
 
-FUNCTION MatchToolValue(typeString : string; value : pCHAR) : BOOLEAN;
+FUNCTION MatchToolValue(const typeString : string;const value : pCHAR) : BOOLEAN;
 begin
 begin
        MatchToolValue := MatchToolValue(pas2c(typeString),value);
        MatchToolValue := MatchToolValue(pas2c(typeString),value);
 end;
 end;
 
 
-FUNCTION MatchToolValue(typeString : pCHAR; value : string) : BOOLEAN;
+FUNCTION MatchToolValue(const typeString : pCHAR;const value : string) : BOOLEAN;
 begin
 begin
        MatchToolValue := MatchToolValue(typeString,pas2c(value));
        MatchToolValue := MatchToolValue(typeString,pas2c(value));
 end;
 end;
 
 
-FUNCTION MatchToolValue(typeString : string; value : string) : BOOLEAN;
+FUNCTION MatchToolValue(const typeString : string;const value : string) : BOOLEAN;
 begin
 begin
        MatchToolValue := MatchToolValue(pas2c(typeString),pas2c(value));
        MatchToolValue := MatchToolValue(pas2c(typeString),pas2c(value));
 end;
 end;
 
 
-FUNCTION PutDiskObject(name : string; diskobj : pDiskObject) : BOOLEAN;
+FUNCTION PutDiskObject(const name : string;const diskobj : pDiskObject) : BOOLEAN;
 begin
 begin
        PutDiskObject := PutDiskObject(pas2c(name),diskobj);
        PutDiskObject := PutDiskObject(pas2c(name),diskobj);
 end;
 end;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of icon.library}
+FUNCTION GetIconTagList(CONST name : string; CONST tags : pTagItem) : pDiskObject;
+begin
+       GetIconTagList := GetIconTagList(pas2c(name),tags);
+end;
+
+FUNCTION PutIconTagList(CONST name : string; CONST icon : pDiskObject; CONST tags : pTagItem) : BOOLEAN;
+begin
+       PutIconTagList := PutIconTagList(pas2c(name),icon,tags);
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of icon.library}
+  {$Info don't forget to use InitICONLibrary in the beginning of your program}
 
 
 var
 var
     icon_exit : Pointer;
     icon_exit : Pointer;
@@ -316,18 +801,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitICONLibrary;
+begin
+    IconBase := nil;
+    IconBase := OpenLibrary(ICONNAME,LIBVERSION);
+    if IconBase <> nil then begin
+        icon_exit := ExitProc;
+        ExitProc := @CloseiconLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open icon.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    ICONIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of icon.library}
+
+var
+    icon_exit : Pointer;
+
+procedure CloseiconLibrary;
+begin
+    ExitProc := icon_exit;
+    if IconBase <> nil then begin
+        CloseLibrary(IconBase);
+        IconBase := nil;
+    end;
+end;
 
 
 begin
 begin
     IconBase := nil;
     IconBase := nil;
     IconBase := OpenLibrary(ICONNAME,LIBVERSION);
     IconBase := OpenLibrary(ICONNAME,LIBVERSION);
     if IconBase <> nil then begin
     if IconBase <> nil then begin
         icon_exit := ExitProc;
         icon_exit := ExitProc;
-        ExitProc := @CloseiconLibrary
+        ExitProc := @CloseiconLibrary;
+        ICONIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open icon.library version ' + VERSION + #10 +
         'Can''t open icon.library version ' + VERSION + #10 +
@@ -336,17 +851,26 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of icon.library compiled}
-   {$Info Make sure you open icon.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    ICONIsCompiledHow := 3;
+   {$Warning No autoopening of icon.library compiled}
+   {$Warning Make sure you open icon.library yourself}
+{$endif dont_use_openlib}
+
 
 
 END. (* UNIT ICON *)
 END. (* UNIT ICON *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-14 18:46:04  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/14 18:46:04  nils
   * added defines use_amia_smartlink and use_auto_openlib
   * added defines use_amia_smartlink and use_auto_openlib
 
 
   * implemented autoopening of library
   * implemented autoopening of library
@@ -356,5 +880,5 @@ END. (* UNIT ICON *)
 
 
 }
 }
 
 
-  
+
 
 

+ 106 - 43
packages/extra/amunits/units/iffparse.pas

@@ -2,7 +2,7 @@
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
 
 
     A file in Amiga system run time library.
     A file in Amiga system run time library.
-    Copyright (c) 1998-2002 by Nils Sjoholm
+    Copyright (c) 1998-2003 by Nils Sjoholm
     member of the Amiga RTL development team.
     member of the Amiga RTL development team.
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
@@ -24,6 +24,10 @@
     Added function Make_ID.
     Added function Make_ID.
     14 Jan 2003.
     14 Jan 2003.
     
     
+    Update for AmigaOS 3.9.
+    Changed start code for unit.
+    01 Feb 2003.
+
     [email protected] Nils Sjoholm
     [email protected] Nils Sjoholm
 }
 }
 
 
@@ -237,47 +241,61 @@ FUNCTION AllocLocalItem(typ : LONGINT; id : LONGINT; ident : LONGINT; dataSize :
 PROCEDURE CloseClipboard(clipHandle : pClipboardHandle);
 PROCEDURE CloseClipboard(clipHandle : pClipboardHandle);
 PROCEDURE CloseIFF(iff : pIFFHandle);
 PROCEDURE CloseIFF(iff : pIFFHandle);
 FUNCTION CollectionChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
 FUNCTION CollectionChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
-FUNCTION CollectionChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
-FUNCTION CurrentChunk(iff : pIFFHandle) : pContextNode;
+FUNCTION CollectionChunks(iff : pIFFHandle;const propArray : pLONGINT; numPairs : LONGINT) : LONGINT;
+FUNCTION CurrentChunk(const iff : pIFFHandle) : pContextNode;
 FUNCTION EntryHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
 FUNCTION EntryHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
 FUNCTION ExitHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
 FUNCTION ExitHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
-FUNCTION FindCollection(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pCollectionItem;
-FUNCTION FindLocalItem(iff : pIFFHandle; typ : LONGINT; id : LONGINT; ident : LONGINT) : pLocalContextItem;
-FUNCTION FindProp(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pStoredProperty;
-FUNCTION FindPropContext(iff : pIFFHandle) : pContextNode;
+FUNCTION FindCollection(const iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pCollectionItem;
+FUNCTION FindLocalItem(const iff : pIFFHandle; typ : LONGINT; id : LONGINT; ident : LONGINT) : pLocalContextItem;
+FUNCTION FindProp(const iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pStoredProperty;
+FUNCTION FindPropContext(const iff : pIFFHandle) : pContextNode;
 PROCEDURE FreeIFF(iff : pIFFHandle);
 PROCEDURE FreeIFF(iff : pIFFHandle);
 PROCEDURE FreeLocalItem(localItem : pLocalContextItem);
 PROCEDURE FreeLocalItem(localItem : pLocalContextItem);
 FUNCTION GoodID(id : LONGINT) : LONGINT;
 FUNCTION GoodID(id : LONGINT) : LONGINT;
 FUNCTION GoodType(typ : LONGINT) : LONGINT;
 FUNCTION GoodType(typ : LONGINT) : LONGINT;
 FUNCTION IDtoStr(id : LONGINT; buf : pCHAR) : pCHAR;
 FUNCTION IDtoStr(id : LONGINT; buf : pCHAR) : pCHAR;
-PROCEDURE InitIFF(iff : pIFFHandle; flags : LONGINT; streamHook : pHook);
+PROCEDURE InitIFF(iff : pIFFHandle; flags : LONGINT;const streamHook : pHook);
 PROCEDURE InitIFFasClip(iff : pIFFHandle);
 PROCEDURE InitIFFasClip(iff : pIFFHandle);
 PROCEDURE InitIFFasDOS(iff : pIFFHandle);
 PROCEDURE InitIFFasDOS(iff : pIFFHandle);
-FUNCTION LocalItemData(localItem : pLocalContextItem) : POINTER;
+FUNCTION LocalItemData(const localItem : pLocalContextItem) : POINTER;
 FUNCTION OpenClipboard(unitNumber : LONGINT) : pClipboardHandle;
 FUNCTION OpenClipboard(unitNumber : LONGINT) : pClipboardHandle;
 FUNCTION OpenIFF(iff : pIFFHandle; rwMode : LONGINT) : LONGINT;
 FUNCTION OpenIFF(iff : pIFFHandle; rwMode : LONGINT) : LONGINT;
-FUNCTION ParentChunk(contextNode : pContextNode) : pContextNode;
+FUNCTION ParentChunk(const contextNode : pContextNode) : pContextNode;
 FUNCTION ParseIFF(iff : pIFFHandle; control : LONGINT) : LONGINT;
 FUNCTION ParseIFF(iff : pIFFHandle; control : LONGINT) : LONGINT;
 FUNCTION PopChunk(iff : pIFFHandle) : LONGINT;
 FUNCTION PopChunk(iff : pIFFHandle) : LONGINT;
 FUNCTION PropChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
 FUNCTION PropChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
-FUNCTION PropChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
+FUNCTION PropChunks(iff : pIFFHandle;const propArray : pLONGINT; numPairs : LONGINT) : LONGINT;
 FUNCTION PushChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT; size : LONGINT) : LONGINT;
 FUNCTION PushChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT; size : LONGINT) : LONGINT;
 FUNCTION ReadChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
 FUNCTION ReadChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
 FUNCTION ReadChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
 FUNCTION ReadChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
-PROCEDURE SetLocalItemPurge(localItem : pLocalContextItem; purgeHook : pHook);
+PROCEDURE SetLocalItemPurge(localItem : pLocalContextItem;const purgeHook : pHook);
 FUNCTION StopChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
 FUNCTION StopChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
-FUNCTION StopChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
+FUNCTION StopChunks(iff : pIFFHandle;const propArray : pLONGINT; numPairs : LONGINT) : LONGINT;
 FUNCTION StopOnExit(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
 FUNCTION StopOnExit(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
 PROCEDURE StoreItemInContext(iff : pIFFHandle; localItem : pLocalContextItem; contextNode : pContextNode);
 PROCEDURE StoreItemInContext(iff : pIFFHandle; localItem : pLocalContextItem; contextNode : pContextNode);
 FUNCTION StoreLocalItem(iff : pIFFHandle; localItem : pLocalContextItem; position : LONGINT) : LONGINT;
 FUNCTION StoreLocalItem(iff : pIFFHandle; localItem : pLocalContextItem; position : LONGINT) : LONGINT;
-FUNCTION WriteChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
-FUNCTION WriteChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
+FUNCTION WriteChunkBytes(iff : pIFFHandle;const buf : POINTER; numBytes : LONGINT) : LONGINT;
+FUNCTION WriteChunkRecords(iff : pIFFHandle;const buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
 
 
 Function Make_ID(str : String) : LONGINT;
 Function Make_ID(str : String) : LONGINT;
 
 
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitIFFPARSELibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    IFFPARSEIsCompiledHow : longint;
+
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox;
+{$endif dont_use_openlib}
 
 
 FUNCTION AllocIFF : pIFFHandle;
 FUNCTION AllocIFF : pIFFHandle;
 BEGIN
 BEGIN
@@ -341,7 +359,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION CollectionChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
+FUNCTION CollectionChunks(iff : pIFFHandle;const propArray : pLONGINT; numPairs : LONGINT) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -355,7 +373,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION CurrentChunk(iff : pIFFHandle) : pContextNode;
+FUNCTION CurrentChunk(const iff : pIFFHandle) : pContextNode;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -401,7 +419,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION FindCollection(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pCollectionItem;
+FUNCTION FindCollection(const iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pCollectionItem;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -415,7 +433,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION FindLocalItem(iff : pIFFHandle; typ : LONGINT; id : LONGINT; ident : LONGINT) : pLocalContextItem;
+FUNCTION FindLocalItem(const iff : pIFFHandle; typ : LONGINT; id : LONGINT; ident : LONGINT) : pLocalContextItem;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -430,7 +448,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION FindProp(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pStoredProperty;
+FUNCTION FindProp(const iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pStoredProperty;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -444,7 +462,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION FindPropContext(iff : pIFFHandle) : pContextNode;
+FUNCTION FindPropContext(const iff : pIFFHandle) : pContextNode;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -515,7 +533,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE InitIFF(iff : pIFFHandle; flags : LONGINT; streamHook : pHook);
+PROCEDURE InitIFF(iff : pIFFHandle; flags : LONGINT;const streamHook : pHook);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -550,7 +568,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION LocalItemData(localItem : pLocalContextItem) : POINTER;
+FUNCTION LocalItemData(const localItem : pLocalContextItem) : POINTER;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -587,7 +605,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION ParentChunk(contextNode : pContextNode) : pContextNode;
+FUNCTION ParentChunk(const contextNode : pContextNode) : pContextNode;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -638,7 +656,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION PropChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
+FUNCTION PropChunks(iff : pIFFHandle;const  propArray : pLONGINT; numPairs : LONGINT) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -696,7 +714,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE SetLocalItemPurge(localItem : pLocalContextItem; purgeHook : pHook);
+PROCEDURE SetLocalItemPurge(localItem : pLocalContextItem;const purgeHook : pHook);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -722,7 +740,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION StopChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
+FUNCTION StopChunks(iff : pIFFHandle; const propArray : pLONGINT; numPairs : LONGINT) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -777,7 +795,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION WriteChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
+FUNCTION WriteChunkBytes(iff : pIFFHandle;const buf : POINTER; numBytes : LONGINT) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -791,7 +809,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION WriteChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
+FUNCTION WriteChunkRecords(iff : pIFFHandle;const buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -813,9 +831,15 @@ begin
 		  (LONGINT(Ord(Str[3])) shl 8 ) or (LONGINT(Ord(Str[4])));
 		  (LONGINT(Ord(Str[3])) shl 8 ) or (LONGINT(Ord(Str[4])));
 end;
 end;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of iffparse.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of iffparse.library}
+  {$Info don't forget to use InitIFFPARSELibrary in the beginning of your program}
 
 
 var
 var
     iffparse_exit : Pointer;
     iffparse_exit : Pointer;
@@ -829,18 +853,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitIFFPARSELibrary;
+begin
+    IFFParseBase := nil;
+    IFFParseBase := OpenLibrary(IFFPARSENAME,LIBVERSION);
+    if IFFParseBase <> nil then begin
+        iffparse_exit := ExitProc;
+        ExitProc := @CloseiffparseLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open iffparse.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    IFFPARSEIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of iffparse.library}
+
+var
+    iffparse_exit : Pointer;
+
+procedure CloseiffparseLibrary;
+begin
+    ExitProc := iffparse_exit;
+    if IFFParseBase <> nil then begin
+        CloseLibrary(IFFParseBase);
+        IFFParseBase := nil;
+    end;
+end;
 
 
 begin
 begin
     IFFParseBase := nil;
     IFFParseBase := nil;
     IFFParseBase := OpenLibrary(IFFPARSENAME,LIBVERSION);
     IFFParseBase := OpenLibrary(IFFPARSENAME,LIBVERSION);
     if IFFParseBase <> nil then begin
     if IFFParseBase <> nil then begin
         iffparse_exit := ExitProc;
         iffparse_exit := ExitProc;
-        ExitProc := @CloseiffparseLibrary
+        ExitProc := @CloseiffparseLibrary;
+        IFFPARSEIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open iffparse.library version ' + VERSION + #10 +
         'Can''t open iffparse.library version ' + VERSION + #10 +
@@ -849,18 +903,27 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of iffparse.library compiled}
-   {$Info Make sure you open iffparse.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    IFFPARSEIsCompiledHow := 3;
+   {$Warning No autoopening of iffparse.library compiled}
+   {$Warning Make sure you open iffparse.library yourself}
+{$endif dont_use_openlib}
+
 
 
 END. (* UNIT IFFPARSE *)
 END. (* UNIT IFFPARSE *)
 
 
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2003-01-19 14:57:50  nils
+  Revision 1.5  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.4  2003/01/19 14:57:50  nils
   * added function make_id
   * added function make_id
 
 
   Revision 1.3  2003/01/14 18:46:04  nils
   Revision 1.3  2003/01/14 18:46:04  nils
@@ -873,5 +936,5 @@ END. (* UNIT IFFPARSE *)
 
 
 }
 }
 
 
-  
+
 
 

+ 84 - 20
packages/extra/amunits/units/layers.pas

@@ -21,6 +21,10 @@
     of the library.
     of the library.
     14 Jan 2003.
     14 Jan 2003.
     
     
+    Update for AmigaOS 3.9.
+    Changed start code for unit.
+    06 Feb 2003.
+    
     [email protected]
     [email protected]
 }
 }
 
 
@@ -90,13 +94,13 @@ FUNCTION CreateUpfrontHookLayer(li : pLayer_Info; bm : pBitMap; x0 : LONGINT; y0
 FUNCTION CreateUpfrontLayer(li : pLayer_Info; bm : pBitMap; x0 : LONGINT; y0 : LONGINT; x1 : LONGINT; y1 : LONGINT; flags : LONGINT; bm2 : pBitMap) : pLayer;
 FUNCTION CreateUpfrontLayer(li : pLayer_Info; bm : pBitMap; x0 : LONGINT; y0 : LONGINT; x1 : LONGINT; y1 : LONGINT; flags : LONGINT; bm2 : pBitMap) : pLayer;
 FUNCTION DeleteLayer(dummy : LONGINT; layer : pLayer) : LONGINT;
 FUNCTION DeleteLayer(dummy : LONGINT; layer : pLayer) : LONGINT;
 PROCEDURE DisposeLayerInfo(li : pLayer_Info);
 PROCEDURE DisposeLayerInfo(li : pLayer_Info);
-PROCEDURE DoHookClipRects(hook : pHook; rport : pRastPort; rect : pRectangle);
+PROCEDURE DoHookClipRects(hook : pHook; rport : pRastPort;const rect : pRectangle);
 PROCEDURE EndUpdate(layer : pLayer; flag : ULONG);
 PROCEDURE EndUpdate(layer : pLayer; flag : ULONG);
 FUNCTION FattenLayerInfo(li : pLayer_Info) : LONGINT;
 FUNCTION FattenLayerInfo(li : pLayer_Info) : LONGINT;
 PROCEDURE InitLayers(li : pLayer_Info);
 PROCEDURE InitLayers(li : pLayer_Info);
-FUNCTION InstallClipRegion(layer : pLayer; region : pRegion) : pRegion;
+FUNCTION InstallClipRegion(layer : pLayer;const region : pRegion) : pRegion;
 FUNCTION InstallLayerHook(layer : pLayer; hook : pHook) : pHook;
 FUNCTION InstallLayerHook(layer : pLayer; hook : pHook) : pHook;
-FUNCTION InstallLayerInfoHook(li : pLayer_Info; hook : pHook) : pHook;
+FUNCTION InstallLayerInfoHook(li : pLayer_Info;const hook : pHook) : pHook;
 PROCEDURE LockLayer(dummy : LONGINT; layer : pLayer);
 PROCEDURE LockLayer(dummy : LONGINT; layer : pLayer);
 PROCEDURE LockLayerInfo(li : pLayer_Info);
 PROCEDURE LockLayerInfo(li : pLayer_Info);
 PROCEDURE LockLayers(li : pLayer_Info);
 PROCEDURE LockLayers(li : pLayer_Info);
@@ -115,9 +119,23 @@ PROCEDURE UnlockLayers(li : pLayer_Info);
 FUNCTION UpfrontLayer(dummy : LONGINT; layer : pLayer) : LONGINT;
 FUNCTION UpfrontLayer(dummy : LONGINT; layer : pLayer) : LONGINT;
 FUNCTION WhichLayer(li : pLayer_Info; x : LONGINT; y : LONGINT) : pLayer;
 FUNCTION WhichLayer(li : pLayer_Info; x : LONGINT; y : LONGINT) : pLayer;
 
 
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitLAYERSLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    LAYERSIsCompiledHow : longint;
+
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox;
+{$endif dont_use_openlib}
 
 
 FUNCTION BeginUpdate(l : pLayer) : LONGINT;
 FUNCTION BeginUpdate(l : pLayer) : LONGINT;
 BEGIN
 BEGIN
@@ -246,7 +264,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-PROCEDURE DoHookClipRects(hook : pHook; rport : pRastPort; rect : pRectangle);
+PROCEDURE DoHookClipRects(hook : pHook; rport : pRastPort;const rect : pRectangle);
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -294,7 +312,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION InstallClipRegion(layer : pLayer; region : pRegion) : pRegion;
+FUNCTION InstallClipRegion(layer : pLayer;const region : pRegion) : pRegion;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -320,7 +338,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION InstallLayerInfoHook(li : pLayer_Info; hook : pHook) : pHook;
+FUNCTION InstallLayerInfoHook(li : pLayer_Info;const hook : pHook) : pHook;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -547,9 +565,15 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of layers.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of layers.library}
+  {$Info don't forget to use InitLAYERSLibrary in the beginning of your program}
 
 
 var
 var
     layers_exit : Pointer;
     layers_exit : Pointer;
@@ -563,18 +587,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitLAYERSLibrary;
+begin
+    LayersBase := nil;
+    LayersBase := OpenLibrary(LAYERSNAME,LIBVERSION);
+    if LayersBase <> nil then begin
+        layers_exit := ExitProc;
+        ExitProc := @CloselayersLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open layers.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    LAYERSIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of layers.library}
+
+var
+    layers_exit : Pointer;
+
+procedure CloselayersLibrary;
+begin
+    ExitProc := layers_exit;
+    if LayersBase <> nil then begin
+        CloseLibrary(LayersBase);
+        LayersBase := nil;
+    end;
+end;
 
 
 begin
 begin
     LayersBase := nil;
     LayersBase := nil;
     LayersBase := OpenLibrary(LAYERSNAME,LIBVERSION);
     LayersBase := OpenLibrary(LAYERSNAME,LIBVERSION);
     if LayersBase <> nil then begin
     if LayersBase <> nil then begin
         layers_exit := ExitProc;
         layers_exit := ExitProc;
-        ExitProc := @CloselayersLibrary
+        ExitProc := @CloselayersLibrary;
+        LAYERSIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open layers.library version ' + VERSION + #10 +
         'Can''t open layers.library version ' + VERSION + #10 +
@@ -583,16 +637,26 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of layers.library compiled}
-   {$Info Make sure you open layers.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    LAYERSIsCompiledHow := 3;
+   {$Warning No autoopening of layers.library compiled}
+   {$Warning Make sure you open layers.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT LAYERS *)
 END. (* UNIT LAYERS *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-14 18:46:04  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/14 18:46:04  nils
   * added defines use_amia_smartlink and use_auto_openlib
   * added defines use_amia_smartlink and use_auto_openlib
 
 
   * implemented autoopening of library
   * implemented autoopening of library
@@ -602,4 +666,4 @@ END. (* UNIT LAYERS *)
 
 
 }
 }
 
 
-  
+

+ 92 - 32
packages/extra/amunits/units/rexx.pas

@@ -484,26 +484,41 @@ const
     REXXSYSLIBNAME : PChar = 'rexxsyslib.library';
     REXXSYSLIBNAME : PChar = 'rexxsyslib.library';
 
 
 PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
 PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
-FUNCTION CreateArgstring(argstring : pCHAR; length : ULONG) : pCHAR;
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : pCHAR) : pRexxMsg;
+FUNCTION CreateArgstring(const argstring : pCHAR; length : ULONG) : pCHAR;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : pCHAR; host : pCHAR) : pRexxMsg;
 PROCEDURE DeleteArgstring(argstring : pCHAR);
 PROCEDURE DeleteArgstring(argstring : pCHAR);
 PROCEDURE DeleteRexxMsg(packet : pRexxMsg);
 PROCEDURE DeleteRexxMsg(packet : pRexxMsg);
 FUNCTION FillRexxMsg(msgptr : pRexxMsg; count : ULONG; mask : ULONG) : BOOLEAN;
 FUNCTION FillRexxMsg(msgptr : pRexxMsg; count : ULONG; mask : ULONG) : BOOLEAN;
-FUNCTION IsRexxMsg(msgptr : pRexxMsg) : BOOLEAN;
-FUNCTION LengthArgstring(argstring : pCHAR) : ULONG;
+FUNCTION IsRexxMsg(const msgptr : pRexxMsg) : BOOLEAN;
+FUNCTION LengthArgstring(const argstring : pCHAR) : ULONG;
 PROCEDURE LockRexxBase(resource : ULONG);
 PROCEDURE LockRexxBase(resource : ULONG);
 PROCEDURE UnlockRexxBase(resource : ULONG);
 PROCEDURE UnlockRexxBase(resource : ULONG);
 
 
-FUNCTION CreateArgstring(argstring : string; length : ULONG) : pCHAR;
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : pCHAR) : pRexxMsg;
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : string) : pRexxMsg;
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : string) : pRexxMsg;
+FUNCTION CreateArgstring(const argstring : string; length : ULONG) : pCHAR;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : string; host : pCHAR) : pRexxMsg;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : pCHAR; host : string) : pRexxMsg;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : string; host : string) : pRexxMsg;
 PROCEDURE DeleteArgstring(argstring : string);
 PROCEDURE DeleteArgstring(argstring : string);
-FUNCTION LengthArgstring(argstring : string) : ULONG;
+FUNCTION LengthArgstring(const argstring : string) : ULONG;
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitREXXSYSLIBLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    REXXSYSLIBIsCompiledHow : longint;
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses pastoc,msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+pastoc;
 
 
 
 
 PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
 PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
@@ -518,7 +533,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION CreateArgstring(argstring : pCHAR; length : ULONG) : pCHAR;
+FUNCTION CreateArgstring(const argstring : pCHAR; length : ULONG) : pCHAR;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -531,7 +546,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : pCHAR) : pRexxMsg;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : pCHAR; host : pCHAR) : pRexxMsg;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -584,7 +599,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION IsRexxMsg(msgptr : pRexxMsg) : BOOLEAN;
+FUNCTION IsRexxMsg(const msgptr : pRexxMsg) : BOOLEAN;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -599,7 +614,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION LengthArgstring(argstring : pCHAR) : ULONG;
+FUNCTION LengthArgstring(const argstring : pCHAR) : ULONG;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -634,22 +649,22 @@ BEGIN
 END;
 END;
 
 
 
 
-FUNCTION CreateArgstring(argstring : string; length : ULONG) : pCHAR;
+FUNCTION CreateArgstring(const argstring : string; length : ULONG) : pCHAR;
 begin
 begin
        CreateArgstring := CreateArgstring(pas2c(argstring),length);
        CreateArgstring := CreateArgstring(pas2c(argstring),length);
 end;
 end;
 
 
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : pCHAR) : pRexxMsg;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : string; host : pCHAR) : pRexxMsg;
 begin
 begin
        CreateRexxMsg := CreateRexxMsg(port,pas2c(extension),host);
        CreateRexxMsg := CreateRexxMsg(port,pas2c(extension),host);
 end;
 end;
 
 
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : string) : pRexxMsg;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : pCHAR; host : string) : pRexxMsg;
 begin
 begin
        CreateRexxMsg := CreateRexxMsg(port,extension,pas2c(host));
        CreateRexxMsg := CreateRexxMsg(port,extension,pas2c(host));
 end;
 end;
 
 
-FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : string) : pRexxMsg;
+FUNCTION CreateRexxMsg(const port : pMsgPort;const extension : string; host : string) : pRexxMsg;
 begin
 begin
        CreateRexxMsg := CreateRexxMsg(port,pas2c(extension),pas2c(host));
        CreateRexxMsg := CreateRexxMsg(port,pas2c(extension),pas2c(host));
 end;
 end;
@@ -659,14 +674,20 @@ begin
        DeleteArgstring(pas2c(argstring));
        DeleteArgstring(pas2c(argstring));
 end;
 end;
 
 
-FUNCTION LengthArgstring(argstring : string) : ULONG;
+FUNCTION LengthArgstring(const argstring : string) : ULONG;
 begin
 begin
        LengthArgstring := LengthArgstring(pas2c(argstring));
        LengthArgstring := LengthArgstring(pas2c(argstring));
 end;
 end;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of rexxsyslib.library}
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of rexxsyslib.library}
+  {$Info don't forget to use InitREXXSYSLIBLibrary in the beginning of your program}
 
 
 var
 var
     rexxsyslib_exit : Pointer;
     rexxsyslib_exit : Pointer;
@@ -680,18 +701,48 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitREXXSYSLIBLibrary;
+begin
+    RexxSysBase := nil;
+    RexxSysBase := OpenLibrary(REXXSYSLIBNAME,LIBVERSION);
+    if RexxSysBase <> nil then begin
+        rexxsyslib_exit := ExitProc;
+        ExitProc := @CloserexxsyslibLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open rexxsyslib.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    REXXSYSLIBIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of rexxsyslib.library}
+
+var
+    rexxsyslib_exit : Pointer;
+
+procedure CloserexxsyslibLibrary;
+begin
+    ExitProc := rexxsyslib_exit;
+    if RexxSysBase <> nil then begin
+        CloseLibrary(RexxSysBase);
+        RexxSysBase := nil;
+    end;
+end;
 
 
 begin
 begin
     RexxSysBase := nil;
     RexxSysBase := nil;
     RexxSysBase := OpenLibrary(REXXSYSLIBNAME,LIBVERSION);
     RexxSysBase := OpenLibrary(REXXSYSLIBNAME,LIBVERSION);
     if RexxSysBase <> nil then begin
     if RexxSysBase <> nil then begin
         rexxsyslib_exit := ExitProc;
         rexxsyslib_exit := ExitProc;
-        ExitProc := @CloserexxsyslibLibrary
+        ExitProc := @CloserexxsyslibLibrary;
+        REXXSYSLIBIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
         'Can''t open rexxsyslib.library version ' + VERSION + #10 +
         'Can''t open rexxsyslib.library version ' + VERSION + #10 +
@@ -700,17 +751,26 @@ begin
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of rexxsyslib.library compiled}
-   {$Info Make sure you open rexxsyslib.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    REXXSYSLIBIsCompiledHow := 3;
+   {$Warning No autoopening of rexxsyslib.library compiled}
+   {$Warning Make sure you open rexxsyslib.library yourself}
+{$endif dont_use_openlib}
+
 
 
 END. (* UNIT REXXSYSLIB *)
 END. (* UNIT REXXSYSLIB *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2003-01-14 18:46:04  nils
+  Revision 1.5  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.4  2003/01/14 18:46:04  nils
   * added defines use_amia_smartlink and use_auto_openlib
   * added defines use_amia_smartlink and use_auto_openlib
 
 
   * implemented autoopening of library
   * implemented autoopening of library
@@ -720,4 +780,4 @@ END. (* UNIT REXXSYSLIB *)
 
 
 }
 }
 
 
-  
+

+ 846 - 26
packages/extra/amunits/units/workbench.pas

@@ -39,6 +39,19 @@
     the library.
     the library.
     14 Jan 2003.
     14 Jan 2003.
 
 
+    Update for AmigaOS 3.9.
+    A lot of new const and new records.
+    New functions
+            FUNCTION AddAppWindowDropZoneA
+            FUNCTION ChangeWorkbenchSelectionA
+            FUNCTION CloseWorkbenchObjectA
+            FUNCTION MakeWorkbenchObjectVisibleA
+            FUNCTION OpenWorkbenchObjectA
+            FUNCTION RemoveAppWindowDropZone
+            FUNCTION WorkbenchControlA
+    Varargs functions are in systemvartags.
+    02 Feb 2003.
+
     [email protected]
     [email protected]
 }
 }
 
 
@@ -51,7 +64,7 @@ unit workbench;
 
 
 INTERFACE
 INTERFACE
 
 
-uses exec,amigados,utility, intuition;
+uses exec,amigados,utility, intuition,graphics;
 
 
 
 
 
 
@@ -120,6 +133,25 @@ Const
 
 
     DRAWERDATAFILESIZE  = 62;  { sizeof(DrawerData) }
     DRAWERDATAFILESIZE  = 62;  { sizeof(DrawerData) }
 
 
+       DDVM_BYDEFAULT = 0;
+    { view as icons  }
+       DDVM_BYICON = 1;
+    { view as text, sorted by name  }
+       DDVM_BYNAME = 2;
+    { view as text, sorted by date  }
+       DDVM_BYDATE = 3;
+    { view as text, sorted by size  }
+       DDVM_BYSIZE = 4;
+    { view as text, sorted by type  }
+       DDVM_BYTYPE = 5;
+
+    { definitions for dd_Flags  }
+    { default (show only icons)  }
+       DDFLAGS_SHOWDEFAULT = 0;
+    { show only icons  }
+       DDFLAGS_SHOWICONS = 1;
+    { show all files  }
+       DDFLAGS_SHOWALL = 2;
 
 
 Type
 Type
 
 
@@ -217,6 +249,37 @@ const
     AMTYPE_APPICON     = 8;    {* app icon message  *}
     AMTYPE_APPICON     = 8;    {* app icon message  *}
     AMTYPE_APPMENUITEM = 9;    {* app menu item message *}
     AMTYPE_APPMENUITEM = 9;    {* app menu item message *}
 
 
+  { Classes of AppIcon messages (V44)  }
+    { The "Open" menu item was invoked,
+    					   the icon got double-clicked or an
+    					   icon got dropped on it.
+    					  }
+       AMCLASSICON_Open = 0;
+    { The "Copy" menu item was invoked  }
+       AMCLASSICON_Copy = 1;
+    { The "Rename" menu item was invoked  }
+       AMCLASSICON_Rename = 2;
+    { The "Information" menu item was invoked  }
+       AMCLASSICON_Information = 3;
+    { The "Snapshot" menu item was invoked  }
+       AMCLASSICON_Snapshot = 4;
+    { The "UnSnapshot" menu item was invoked  }
+       AMCLASSICON_UnSnapshot = 5;
+    { The "Leave Out" menu item was invoked  }
+       AMCLASSICON_LeaveOut = 6;
+    { The "Put Away" menu item was invoked  }
+       AMCLASSICON_PutAway = 7;
+    { The "Delete" menu item was invoked  }
+       AMCLASSICON_Delete = 8;
+    { The "Format Disk" menu item was invoked  }
+       AMCLASSICON_FormatDisk = 9;
+    { The "Empty Trash" menu item was invoked  }
+       AMCLASSICON_EmptyTrash = 10;
+    { The icon is now selected  }
+       AMCLASSICON_Selected = 11;
+    { The icon is now unselected  }
+       AMCLASSICON_Unselected = 12;
+
 {
 {
  * The following structures are private.  These are just stub
  * The following structures are private.  These are just stub
  * structures for code compatibility...
  * structures for code compatibility...
@@ -238,30 +301,603 @@ type
  END;
  END;
  pAppMenuItem = ^tAppMenuItem;
  pAppMenuItem = ^tAppMenuItem;
 
 
+ PAppWindowDropZone = ^tAppWindowDropZone;
+       tAppWindowDropZone = record
+            awdz_PRIVATE : pointer;
+         end;
+
+ PAppMenu = ^tAppMenu;
+       tAppMenu = record
+            am_PRIVATE : pointer;
+         end;
+
+   const
+       WBA_Dummy = TAG_USER + $A000;
+    {                                                                           }
+    { Tags for use with AddAppIconA()  }
+    { AppIcon responds to the "Open" menu item (BOOL).  }
+       WBAPPICONA_SupportsOpen = WBA_Dummy + 1;
+
+    { AppIcon responds to the "Copy" menu item (BOOL).  }
+       WBAPPICONA_SupportsCopy = WBA_Dummy + 2;
+
+    { AppIcon responds to the "Rename" menu item (BOOL).  }
+       WBAPPICONA_SupportsRename = WBA_Dummy + 3;
+
+    { AppIcon responds to the "Information" menu item (BOOL).  }
+       WBAPPICONA_SupportsInformation = WBA_Dummy + 4;
+
+    { AppIcon responds to the "Snapshot" menu item (BOOL).  }
+       WBAPPICONA_SupportsSnapshot = WBA_Dummy + 5;
+
+    { AppIcon responds to the "UnSnapshot" menu item (BOOL).  }
+       WBAPPICONA_SupportsUnSnapshot = WBA_Dummy + 6;
+
+    { AppIcon responds to the "LeaveOut" menu item (BOOL).  }
+       WBAPPICONA_SupportsLeaveOut = WBA_Dummy + 7;
+
+    { AppIcon responds to the "PutAway" menu item (BOOL).  }
+       WBAPPICONA_SupportsPutAway = WBA_Dummy + 8;
+
+    { AppIcon responds to the "Delete" menu item (BOOL).  }
+       WBAPPICONA_SupportsDelete = WBA_Dummy + 9;
+
+    { AppIcon responds to the "FormatDisk" menu item (BOOL).  }
+       WBAPPICONA_SupportsFormatDisk = WBA_Dummy + 10;
+
+    { AppIcon responds to the "EmptyTrash" menu item (BOOL).  }
+       WBAPPICONA_SupportsEmptyTrash = WBA_Dummy + 11;
+
+    { AppIcon position should be propagated back to original DiskObject (BOOL).  }
+       WBAPPICONA_PropagatePosition = WBA_Dummy + 12;
+
+    { Callback hook to be invoked when rendering this icon (struct Hook  ).  }
+       WBAPPICONA_RenderHook = WBA_Dummy + 13;
+
+    { AppIcon wants to be notified when its select state changes (BOOL).  }
+       WBAPPICONA_NotifySelectState = WBA_Dummy + 14;
+
+   {**************************************************************************}
+
+    { Tags for use with AddAppMenuA()  }
+    { Command key string for this AppMenu (STRPTR).  }
+       WBAPPMENUA_CommandKeyString = WBA_Dummy + 15;
+    { Item to be added should get sub menu items attached to; make room for it,
+       then return the key to use later for attaching the items (ULONG  ).
+      }
+       WBAPPMENUA_GetKey = WBA_Dummy + 65;
+    { This item should be attached to a sub menu; the key provided refers to
+       the sub menu it should be attached to (ULONG).
+      }
+       WBAPPMENUA_UseKey = WBA_Dummy + 66;
+    { Item to be added is in fact a new menu title; make room for it, then
+       return the key to use later for attaching the items (ULONG  ).
+      }
+       WBAPPMENUA_GetTitleKey = WBA_Dummy + 77;
+
+    {**************************************************************************}
+
+    { Tags for use with OpenWorkbenchObjectA()  }
+    { Corresponds to the wa_Lock member of a struct WBArg  }
+       WBOPENA_ArgLock = WBA_Dummy + 16;
+
+    { Corresponds to the wa_Name member of a struct WBArg  }
+       WBOPENA_ArgName = WBA_Dummy + 17;
+
+    { When opening a drawer, show all files or only icons?
+       This must be one out of DDFLAGS_SHOWICONS,
+       or DDFLAGS_SHOWALL; (UBYTE); (V45)
+      }
+       WBOPENA_Show = WBA_Dummy + 75;
+
+    { When opening a drawer, view the contents by icon, name,
+       date, size or type? This must be one out of DDVM_BYICON,
+       DDVM_BYNAME, DDVM_BYDATE, DDVM_BYSIZE or DDVM_BYTYPE;
+       (UBYTE); (V45)
+      }
+       WBOPENA_ViewBy = WBA_Dummy + 76;
+   
+   {**************************************************************************}
+
+    { Tags for use with WorkbenchControlA()  }
+    { Check if the named drawer is currently open (LONG  ).  }
+       WBCTRLA_IsOpen = WBA_Dummy + 18;
+
+    { Create a duplicate of the Workbench private search path list (BPTR  ).  }
+       WBCTRLA_DuplicateSearchPath = WBA_Dummy + 19;
+
+    { Free the duplicated search path list (BPTR).  }
+       WBCTRLA_FreeSearchPath = WBA_Dummy + 20;
+
+    { Get the default stack size for launching programs with (ULONG  ).  }
+       WBCTRLA_GetDefaultStackSize = WBA_Dummy + 21;
+
+    { Set the default stack size for launching programs with (ULONG).  }
+       WBCTRLA_SetDefaultStackSize = WBA_Dummy + 22;
+
+    { Cause an AppIcon to be redrawn (struct AppIcon  ).  }
+       WBCTRLA_RedrawAppIcon = WBA_Dummy + 23;
+
+    { Get a list of currently running Workbench programs (struct List   ).  }
+       WBCTRLA_GetProgramList = WBA_Dummy + 24;
+
+    { Release the list of currently running Workbench programs (struct List  ).  }
+       WBCTRLA_FreeProgramList = WBA_Dummy + 25;
+
+    { Get a list of currently selected icons (struct List   ).  }
+       WBCTRLA_GetSelectedIconList = WBA_Dummy + 36;
+
+    { Release the list of currently selected icons (struct List  ).  }
+       WBCTRLA_FreeSelectedIconList = WBA_Dummy + 37;
+
+    { Get a list of currently open drawers (struct List   ).  }
+       WBCTRLA_GetOpenDrawerList = WBA_Dummy + 38;
+
+    { Release the list of currently open icons (struct List  ).  }
+       WBCTRLA_FreeOpenDrawerList = WBA_Dummy + 39;
+
+    { Get the list of hidden devices (struct List   ).  }
+       WBCTRLA_GetHiddenDeviceList = WBA_Dummy + 42;
+
+    { Release the list of hidden devices (struct List  ).  }
+       WBCTRLA_FreeHiddenDeviceList = WBA_Dummy + 43;
+
+    { Add the name of a device which Workbench should never try to
+       read a disk icon from (STRPTR).
+      }
+       WBCTRLA_AddHiddenDeviceName = WBA_Dummy + 44;
+
+    { Remove a name from list of hidden devices (STRPTR).  }
+       WBCTRLA_RemoveHiddenDeviceName = WBA_Dummy + 45;
+
+    { Get the number of seconds that have to pass before typing
+       the next character in a drawer window will restart
+       with a new file name (ULONG  ).
+      }
+       WBCTRLA_GetTypeRestartTime = WBA_Dummy + 47;
+
+    { Set the number of seconds that have to pass before typing
+       the next character in a drawer window will restart
+       with a new file name (ULONG).
+      }
+       WBCTRLA_SetTypeRestartTime = WBA_Dummy + 48;
+
+    { Obtain the hook that will be invoked when Workbench starts
+       to copy files and data (struct Hook   ); (V45)
+      }
+       WBCTRLA_GetCopyHook = WBA_Dummy + 69;
+
+    { Install the hook that will be invoked when Workbench starts
+       to copy files and data (struct Hook  ); (V45)
+      }
+       WBCTRLA_SetCopyHook = WBA_Dummy + 70;
+
+    { Obtain the hook that will be invoked when Workbench discards
+       files and drawers or empties the trashcan (struct Hook   );
+       (V45).
+      }
+       WBCTRLA_GetDeleteHook = WBA_Dummy + 71;
+
+    { Install the hook that will be invoked when Workbench discards
+       files and drawers or empties the trashcan (struct Hook  );
+       (V45).
+      }
+       WBCTRLA_SetDeleteHook = WBA_Dummy + 72;
+
+    { Obtain the hook that will be invoked when Workbench requests
+       that the user enters text, such as when a file is to be renamed
+       or a new drawer is to be created (struct Hook   ); (V45)
+      }
+       WBCTRLA_GetTextInputHook = WBA_Dummy + 73;
+
+    { Install the hook that will be invoked when Workbench requests
+       that the user enters text, such as when a file is to be renamed
+       or a new drawer is to be created (struct Hook  ); (V45)
+      }
+       WBCTRLA_SetTextInputHook = WBA_Dummy + 74;
+
+    { Add a hook that will be invoked when Workbench is about 
+       to shut down (cleanup), and when Workbench has returned
+       to operational state (setup) (struct Hook  ); (V45)
+      }
+       WBCTRLA_AddSetupCleanupHook = WBA_Dummy + 78;
+
+    { Remove a hook that has been installed with the
+       WBCTRLA_AddSetupCleanupHook tag (struct Hook  ); (V45)
+      }
+       WBCTRLA_RemSetupCleanupHook = WBA_Dummy + 79;
+
+       {**************************************************************************}
+
+{ The message your setup/cleanup hook gets invoked with. }
+       type
+       PSetupCleanupHookMsg = ^tSetupCleanupHookMsg;
+       tSetupCleanupHookMsg = record
+            schm_Length : ULONG;
+            schm_State : LONG;
+         end;
+
+      const
+    { Workbench will attempt to shut down now.  }
+       SCHMSTATE_TryCleanup = 0;
+    { Workbench will really shut down now.  }
+       SCHMSTATE_Cleanup = 1;
+    { Workbench is operational again or
+       could not be shut down.
+    }
+       SCHMSTATE_Setup = 2;
+
+{**************************************************************************}
+
+    { Tags for use with AddAppWindowDropZoneA()  }
+    { Zone left edge (WORD)  }
+       WBDZA_Left = WBA_Dummy + 26;
+
+    { Zone left edge, if relative to the right edge of the window (WORD)  }
+       WBDZA_RelRight = WBA_Dummy + 27;
+
+    { Zone top edge (WORD)  }
+       WBDZA_Top = WBA_Dummy + 28;
+
+    { Zone top edge, if relative to the bottom edge of the window (WORD)  }
+       WBDZA_RelBottom = WBA_Dummy + 29;
+
+    { Zone width (WORD)  }
+       WBDZA_Width = WBA_Dummy + 30;
+
+    { Zone width, if relative to the window width (WORD)  }
+       WBDZA_RelWidth = WBA_Dummy + 31;
+
+    { Zone height (WORD)  }
+       WBDZA_Height = WBA_Dummy + 32;
+
+    { Zone height, if relative to the window height (WORD)  }
+       WBDZA_RelHeight = WBA_Dummy + 33;
+
+    { Zone position and size (struct IBox  ).  }
+       WBDZA_Box = WBA_Dummy + 34;
+
+    { Hook to invoke when the mouse enters or leave a drop zone (struct Hook  ).  }
+       WBDZA_Hook = WBA_Dummy + 35;
+
+{**************************************************************************}
+
+    { Reserved tags; don't use!  }
+       WBA_Reserved1 = WBA_Dummy + 40;
+       WBA_Reserved2 = WBA_Dummy + 41;
+       WBA_Reserved3 = WBA_Dummy + 46;
+       WBA_Reserved4 = WBA_Dummy + 49;
+       WBA_Reserved5 = WBA_Dummy + 50;
+       WBA_Reserved6 = WBA_Dummy + 51;
+       WBA_Reserved7 = WBA_Dummy + 52;
+       WBA_Reserved8 = WBA_Dummy + 53;
+       WBA_Reserved9 = WBA_Dummy + 54;
+       WBA_Reserved10 = WBA_Dummy + 55;
+       WBA_Reserved11 = WBA_Dummy + 56;
+       WBA_Reserved12 = WBA_Dummy + 57;
+       WBA_Reserved13 = WBA_Dummy + 58;
+       WBA_Reserved14 = WBA_Dummy + 59;
+       WBA_Reserved15 = WBA_Dummy + 60;
+       WBA_Reserved16 = WBA_Dummy + 61;
+       WBA_Reserved17 = WBA_Dummy + 62;
+       WBA_Reserved18 = WBA_Dummy + 63;
+       WBA_Reserved19 = WBA_Dummy + 64;
+       WBA_Reserved20 = WBA_Dummy + 67;
+       WBA_Reserved21 = WBA_Dummy + 68;
+
+{**************************************************************************}
+
+       WBA_LAST_TAG = WBA_Dummy + 79;
+
+{**************************************************************************}
+
+{ The message your AppIcon rendering hook gets invoked with. }
+   type
+       PAppIconRenderMsg = ^tAppIconRenderMsg;
+       tAppIconRenderMsg = record
+            arm_RastPort : PRastPort;  { RastPort to render into }
+            arm_Icon : PDiskObject;    { The icon to be rendered }
+            arm_Label : STRPTR;        { The icon label txt }
+            arm_Tags : PTagItem;       { Further tags to be passed on
+						 * to DrawIconStateA().
+						 }
+            arm_Left : WORD;           { \ Rendering origin, not taking the }
+            arm_Top : WORD;            { / button border into account. }
+            arm_Width : WORD;          { \ Limit your rendering to }
+            arm_Height : WORD;         { / this area. }
+            arm_State : ULONG;         { IDS_SELECTED, IDS_NORMAL, etc. }
+         end;
+
+{ The message your drop zone hook gets invoked with. }
+       PAppWindowDropZoneMsg = ^tAppWindowDropZoneMsg;
+       tAppWindowDropZoneMsg = record
+            adzm_RastPort : PRastPort;  { RastPort to render into. }
+            adzm_DropZoneBox : tIBox;   { Limit your rendering to this area. }
+            adzm_ID : ULONG;            { \ These come from straight }
+            adzm_UserData : ULONG;      { / from AddAppWindowDropZoneA(). }
+            adzm_Action : LONG;         { See below for a list of actions. }
+         end;
+
+   const
+       ADZMACTION_Enter = 0;
+       ADZMACTION_Leave = 1;
+
+{**************************************************************************}
+
+{ The message your icon selection change hook is invoked with. }
+    type
+       PIconSelectMsg = ^tIconSelectMsg;
+       tIconSelectMsg = record
+            { Size of this data structure (in bytes). }
+            ism_Length : ULONG;
+	    { Lock on the drawer this object resides in,
+	     * NULL for Workbench backdrop (devices).
+	     }
+            ism_Drawer : BPTR;
+	    { Name of the object in question. }
+            ism_Name : STRPTR;
+	    { One of WBDISK, WBDRAWER, WBTOOL, WBPROJECT,
+	     * WBGARBAGE, WBDEVICE, WBKICK or WBAPPICON.
+	     }
+            ism_Type : UWORD;
+	    { TRUE if currently selected, FALSE otherwise. }
+            ism_Selected : BOOL;
+	    { Pointer to the list of tag items passed to
+	     * ChangeWorkbenchSelectionA().
+	     }
+            ism_Tags : PTagItem;
+	    { Pointer to the window attached to this icon,
+	     * if the icon is a drawer-like object.
+	     }
+            ism_DrawerWindow : PWindow;
+	    { Pointer to the window the icon resides in. }
+            ism_ParentWindow : PWindow;
+	    { Position and size of the icon; note that the
+	     * icon may not entirely reside within the visible
+	     * bounds of the parent window.
+	     }
+            ism_Left : WORD;
+            ism_Top : WORD;
+            ism_Width : WORD;
+            ism_Height : WORD;
+         end;
+
+    { These are the values your hook code can return.  }
+    const
+    { Unselect the icon  }
+       ISMACTION_Unselect = 0;
+    { Select the icon  }
+       ISMACTION_Select = 1;
+    { Do not change the selection state.  }
+       ISMACTION_Ignore = 2;
+    { Do not invoke the hook code again,
+      leave the icon as it is.
+    }
+       ISMACTION_Stop = 3;
+
+{**************************************************************************}
+
+{ The messages your copy hook is invoked with. }
+
+   type
+       PCopyBeginMsg = ^tCopyBeginMsg;
+       tCopyBeginMsg = record
+            cbm_Length : ULONG;           { Size of this data structure in bytes. }
+            cbm_Action : LONG;            { Will be set to CPACTION_Begin (see below). }
+            cbm_SourceDrawer : BPTR;      { A lock on the source drawer. }
+            cbm_DestinationDrawer : BPTR; { A lock on the destination drawer. }
+         end;
+
+       PCopyDataMsg = ^tCopyDataMsg;
+       tCopyDataMsg = record
+            cdm_Length : ULONG;           { Size of this data structure in bytes. }
+            cdm_Action : LONG;            { Will be set to CPACTION_Copy (see below). }
+            cdm_SourceLock : BPTR;        { A lock on the parent directory of the
+					   * source file/drawer.
+					   }
+            cdm_SourceName : STRPTR;      { The name of the source file or drawer. }
+            cdm_DestinationLock : BPTR;   { A lock on the parent directory of the
+					   * destination file/drawer.
+					   }
+            cdm_DestinationName : STRPTR; { The name of the destination file/drawer.
+					   * This may or may not match the name of
+					   * the source file/drawer in case the
+					   * data is to be copied under a different
+					   * name. For example, this is the case
+					   * with the Workbench "Copy" command which
+					   * creates duplicates of file/drawers by
+					   * prefixing the duplicate's name with
+					   * "Copy_XXX_of".
+					   }
+            cdm_DestinationX : LONG;      { When the icon corresponding to the
+					   * destination is written to disk, this
+					   * is the position (put into its
+					   * DiskObject->do_CurrentX/DiskObject->do_CurrentY
+					   * fields) it should be placed at.
+					   }
+            cdm_DestinationY : LONG;
+         end;
+
+     PCopyEndMsg = ^tCopyEndMsg;
+       tCopyEndMsg = record
+            cem_Length : ULONG;           { Size of this data structure in bytes. }
+            cem_Action : LONG;            { Will be set to CPACTION_End (see below). }
+         end;
+
+    const
+       CPACTION_Begin = 0;
+    { This message arrives for each file or
+      drawer to be copied.
+    }
+       CPACTION_Copy = 1;
+    { This message arrives when all files/drawers
+      have been copied.
+    }
+       CPACTION_End = 2;
+
+{**************************************************************************}
+
+{ The messages your delete hook is invoked with. }
+    type
+       PDeleteBeginMsg = ^tDeleteBeginMsg;
+       tDeleteBeginMsg = record
+            dbm_Length : ULONG;   { Size of this data structure in bytes. }
+            dbm_Action : LONG;    { Will be set to either DLACTION_BeginDiscard
+				   * or DLACTION_BeginEmptyTrash (see below).
+				   }
+         end;
+
+
+       PDeleteDataMsg = ^tDeleteDataMsg;
+       tDeleteDataMsg = record
+            ddm_Length : ULONG;   { Size of this data structure in bytes. }
+            ddm_Action : LONG;    { Will be set to either DLACTION_DeleteContents
+				   * or DLACTION_DeleteObject (see below).
+				   }
+            ddm_Lock : BPTR;      { A Lock on the parent directory of the object
+				   * whose contents or which itself should be
+				   * deleted.
+				   }
+            ddm_Name : STRPTR;    { The name of the object whose contents or
+				   * which itself should be deleted.
+				   }
+         end;
+
+
+       PDeleteEndMsg = ^tDeleteEndMsg;
+       tDeleteEndMsg = record
+            dem_Length : ULONG;   { Size of this data structure in bytes. }
+            dem_Action : LONG;    { Will be set to DLACTION_End (see below). }
+         end;
+
+ const
+       DLACTION_BeginDiscard = 0;
+    { This indicates that the following
+      delete operations are intended to
+      empty the trashcan.
+    }
+
+       DLACTION_BeginEmptyTrash = 1;
+    { This indicates that the object
+      described by lock and name refers
+      to a drawer; you should empty its
+      contents but  DO NOT  delete the
+      drawer itself!
+    }
+
+       DLACTION_DeleteContents = 3;
+    { This indicates that the object
+      described by lock and name should
+      be deleted; this could be a file
+      or an empty drawer.
+    }
+       
+       DLACTION_DeleteObject = 4;
+    { This indicates that the
+      deletion process is finished.
+    }
+
+       DLACTION_End = 5;
+
+{**************************************************************************}
+
+{ The messages your text input hook is invoked with. }
+    type
+       PTextInputMsg = ^tTextInputMsg;
+       tTextInputMsg = record
+            tim_Length : ULONG;     { Size of this data structure
+				     * in bytes.
+				     }
+            tim_Action : LONG;      { One of the TIACTION_...
+				     * values listed below.
+				     }
+            tim_Prompt : STRPTR;    { The Workbench suggested
+				     * result, depending on what
+				     * kind of input is requested
+				     * (as indicated by the
+				     * tim_Action member).
+				     }
+         end;
+
+   const
+   { A file or drawer is to be
+    * renamed.
+   }
+       TIACTION_Rename = 0;
+
+    { A volume is to be relabeled.  }
+       TIACTION_RelabelVolume = 1;
+
+    { A new drawer is to be created.  }
+       TIACTION_NewDrawer = 2;
+
+    { A program or script is to be
+      executed.
+    }
+       TIACTION_Execute = 3;
+
+{**************************************************************************}
+
+{ Parameters for the UpdateWorkbench() function. }
+
+    { Object has been deleted.  }
+       UPDATEWB_ObjectRemoved = 0;
+
+    { Object is new or has changed.  }
+       UPDATEWB_ObjectAdded = 1;
 
 
-CONST
     WORKBENCHNAME : PChar  = 'workbench.library';
     WORKBENCHNAME : PChar  = 'workbench.library';
 
 
 VAR
 VAR
     WorkbenchBase : pLibrary;
     WorkbenchBase : pLibrary;
 
 
-FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject; taglist : pTagItem) : pAppIcon;
-FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; taglist : pTagItem) : pAppMenuItem;
-FUNCTION AddAppWindowA(id : ULONG; userdata : ULONG; window : pWindow; msgport : pMsgPort; taglist : pTagItem) : pAppWindow;
+FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject;const taglist : pTagItem) : pAppIcon;
+FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort;const taglist : pTagItem) : pAppMenuItem;
+FUNCTION AddAppWindowA(id : ULONG; userdata : ULONG; window : pWindow; msgport : pMsgPort;const taglist : pTagItem) : pAppWindow;
 FUNCTION RemoveAppIcon(appIcon : pAppIcon) : BOOLEAN;
 FUNCTION RemoveAppIcon(appIcon : pAppIcon) : BOOLEAN;
 FUNCTION RemoveAppMenuItem(appMenuItem : pAppMenuItem) : BOOLEAN;
 FUNCTION RemoveAppMenuItem(appMenuItem : pAppMenuItem) : BOOLEAN;
 FUNCTION RemoveAppWindow(appWindow : pAppWindow) : BOOLEAN;
 FUNCTION RemoveAppWindow(appWindow : pAppWindow) : BOOLEAN;
 PROCEDURE WBInfo(lock : BPTR; name : pCHAR; screen : pScreen);
 PROCEDURE WBInfo(lock : BPTR; name : pCHAR; screen : pScreen);
 
 
-FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject; taglist : pTagItem) : pAppIcon;
-FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort; taglist : pTagItem) : pAppMenuItem;
+FUNCTION AddAppWindowDropZoneA(aw : pAppWindow; id : CARDINAL; userdata : CARDINAL;const tags : pTagItem) : pAppWindowDropZone;
+FUNCTION ChangeWorkbenchSelectionA(name : pCHAR; hook : pHook;const tags : pTagItem) : BOOLEAN;
+FUNCTION CloseWorkbenchObjectA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+FUNCTION MakeWorkbenchObjectVisibleA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+FUNCTION OpenWorkbenchObjectA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+FUNCTION RemoveAppWindowDropZone(aw : pAppWindow; dropZone : pAppWindowDropZone) : BOOLEAN;
+FUNCTION WorkbenchControlA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+
+{ overlays }
+FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject;const taglist : pTagItem) : pAppIcon;
+FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort;const taglist : pTagItem) : pAppMenuItem;
 PROCEDURE WBInfo(lock : BPTR; name : string; screen : pScreen);
 PROCEDURE WBInfo(lock : BPTR; name : string; screen : pScreen);
 
 
+FUNCTION ChangeWorkbenchSelectionA(name : string; hook : pHook;const tags : pTagItem) : BOOLEAN;
+FUNCTION CloseWorkbenchObjectA(name : string;const tags : pTagItem) : BOOLEAN;
+FUNCTION MakeWorkbenchObjectVisibleA(name : string;const tags : pTagItem) : BOOLEAN;
+FUNCTION OpenWorkbenchObjectA(name : string;const tags : pTagItem) : BOOLEAN;
+FUNCTION WorkbenchControlA(name : string;const tags : pTagItem) : BOOLEAN;
+
+{Here we read how to compile this unit}
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitWBLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    WBIsCompiledHow : longint;
+
 IMPLEMENTATION
 IMPLEMENTATION
 
 
-uses pastoc,msgbox;
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+pastoc;
 
 
-FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject; taglist : pTagItem) : pAppIcon;
+FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject;const taglist : pTagItem) : pAppIcon;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -279,7 +915,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; taglist : pTagItem) : pAppMenuItem;
+FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort;const taglist : pTagItem) : pAppMenuItem;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -295,7 +931,7 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION AddAppWindowA(id : ULONG; userdata : ULONG; window : pWindow; msgport : pMsgPort; taglist : pTagItem) : pAppWindow;
+FUNCTION AddAppWindowA(id : ULONG; userdata : ULONG; window : pWindow; msgport : pMsgPort;const taglist : pTagItem) : pAppWindow;
 BEGIN
 BEGIN
   ASM
   ASM
     MOVE.L  A6,-(A7)
     MOVE.L  A6,-(A7)
@@ -369,12 +1005,125 @@ BEGIN
   END;
   END;
 END;
 END;
 
 
-FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject; taglist : pTagItem) : pAppIcon;
+FUNCTION AddAppWindowDropZoneA(aw : pAppWindow; id : CARDINAL; userdata : CARDINAL;const tags : pTagItem) : pAppWindowDropZone;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	aw,A0
+	MOVE.L	id,D0
+	MOVE.L	userdata,D1
+	MOVEA.L	tags,A1
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ChangeWorkbenchSelectionA(name : pCHAR; hook : pHook;const tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	hook,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION CloseWorkbenchObjectA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION MakeWorkbenchObjectVisibleA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION OpenWorkbenchObjectA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+
+FUNCTION RemoveAppWindowDropZone(aw : pAppWindow; dropZone : pAppWindowDropZone) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	aw,A0
+	MOVEA.L	dropZone,A1
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION WorkbenchControlA(name : pCHAR;const tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	WorkbenchBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort; lock : pFileLock; diskobj : pDiskObject;const taglist : pTagItem) : pAppIcon;
 begin
 begin
        AddAppIconA := AddAppIconA(id,userdata,pas2c(text_),msgport,lock,diskobj,taglist);
        AddAppIconA := AddAppIconA(id,userdata,pas2c(text_),msgport,lock,diskobj,taglist);
 end;
 end;
 
 
-FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort; taglist : pTagItem) : pAppMenuItem;
+FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; text_ : string; msgport : pMsgPort;const taglist : pTagItem) : pAppMenuItem;
 begin
 begin
        AddAppMenuItemA := AddAppMenuItemA(id,userdata,pas2c(text_),msgport,taglist);
        AddAppMenuItemA := AddAppMenuItemA(id,userdata,pas2c(text_),msgport,taglist);
 end;
 end;
@@ -384,9 +1133,40 @@ begin
        WBInfo(lock,pas2c(name),screen);
        WBInfo(lock,pas2c(name),screen);
 end;
 end;
 
 
-{$I useautoopenlib.inc}
-{$ifdef use_auto_openlib}
-  {$Info Compiling autoopening of workbench.library}
+FUNCTION ChangeWorkbenchSelectionA(name : string; hook : pHook;const tags : pTagItem) : BOOLEAN;
+begin
+       ChangeWorkbenchSelectionA := ChangeWorkbenchSelectionA(pas2c(name),hook,tags);
+end;
+
+FUNCTION CloseWorkbenchObjectA(name : string;const tags : pTagItem) : BOOLEAN;
+begin
+       CloseWorkbenchObjectA := CloseWorkbenchObjectA(pas2c(name),tags);
+end;
+
+FUNCTION MakeWorkbenchObjectVisibleA(name : string;const tags : pTagItem) : BOOLEAN;
+begin
+       MakeWorkbenchObjectVisibleA := MakeWorkbenchObjectVisibleA(pas2c(name),tags);
+end;
+
+FUNCTION OpenWorkbenchObjectA(name : string;const tags : pTagItem) : BOOLEAN;
+begin
+       OpenWorkbenchObjectA := OpenWorkbenchObjectA(pas2c(name),tags);
+end;
+
+FUNCTION WorkbenchControlA(name : string;const tags : pTagItem) : BOOLEAN;
+begin
+       WorkbenchControlA := WorkbenchControlA(pas2c(name),tags);
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : Cardinal = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of workbench.library}
+  {$Info don't forget to use InitWBLibrary in the beginning of your program}
 
 
 var
 var
     wb_exit : Pointer;
     wb_exit : Pointer;
@@ -400,36 +1180,76 @@ begin
     end;
     end;
 end;
 end;
 
 
-const
-    { Change VERSION and LIBVERSION to proper values }
+procedure InitWBLibrary;
+begin
+    WorkbenchBase := nil;
+    WorkbenchBase := OpenLibrary(WORKBENCHNAME,LIBVERSION);
+    if WorkbenchBase <> nil then begin
+        wb_exit := ExitProc;
+        ExitProc := @ClosewbLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open workbench.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
 
 
-    VERSION : string[2] = '0';
-    LIBVERSION : Cardinal = 0;
+begin
+    WBIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of workbench.library}
+
+var
+    wb_exit : Pointer;
+
+procedure ClosewbLibrary;
+begin
+    ExitProc := wb_exit;
+    if WorkbenchBase <> nil then begin
+        CloseLibrary(WorkbenchBase);
+        WorkbenchBase := nil;
+    end;
+end;
 
 
 begin
 begin
     WorkbenchBase := nil;
     WorkbenchBase := nil;
     WorkbenchBase := OpenLibrary(WORKBENCHNAME,LIBVERSION);
     WorkbenchBase := OpenLibrary(WORKBENCHNAME,LIBVERSION);
     if WorkbenchBase <> nil then begin
     if WorkbenchBase <> nil then begin
         wb_exit := ExitProc;
         wb_exit := ExitProc;
-        ExitProc := @ClosewbLibrary
+        ExitProc := @ClosewbLibrary;
+        WBIsCompiledHow := 1;
     end else begin
     end else begin
         MessageBox('FPC Pascal Error',
         MessageBox('FPC Pascal Error',
-        'Can''t open wb.library version ' + VERSION + #10 +
+        'Can''t open workbench.library version ' + VERSION + #10 +
         'Deallocating resources and closing down',
         'Deallocating resources and closing down',
         'Oops');
         'Oops');
         halt(20);
         halt(20);
     end;
     end;
 
 
-{$else}
-   {$Warning No autoopening of workbench.library compiled}
-   {$Info Make sure you open workbench.library yourself}
 {$endif use_auto_openlib}
 {$endif use_auto_openlib}
 
 
+{$ifdef dont_use_openlib}
+begin
+    WBIsCompiledHow := 3;
+   {$Warning No autoopening of workbench.library compiled}
+   {$Warning Make sure you open workbench.library yourself}
+{$endif dont_use_openlib}
+
+
 END. (* UNIT WB *)
 END. (* UNIT WB *)
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2003-01-14 18:46:04  nils
+  Revision 1.4  2003-02-07 20:48:36  nils
+  * update for amigaos 3.9
+
+  * changed startcode for library
+
+  Revision 1.3  2003/01/14 18:46:04  nils
   * added defines use_amia_smartlink and use_auto_openlib
   * added defines use_amia_smartlink and use_auto_openlib
 
 
   * implemented autoopening of library
   * implemented autoopening of library