Ver código fonte

* initial release

nils 22 anos atrás
pai
commit
4f84fe741c

+ 951 - 0
packages/extra/amunits/otherlibs/ahi/units/ahi.pas

@@ -0,0 +1,951 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for ahi.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  14 Jan 2003.
+  
+  Changed cardinal > longword.
+  Added startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}  
+
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT AHI;
+
+INTERFACE
+
+USES Exec,utility;
+
+VAR AHIBase : pLibrary;
+
+{
+    	$VER: ahi.h 4.2 (27.4.97)
+
+    	ahi.device definitions
+
+    	(C) Copyright 1994-1997 Martin Blom
+    	All Rights Reserved.
+
+     (TAB SIZE: 8)
+   }
+
+  type
+
+     PFixed = ^Fixed;
+     Fixed = LONGINT;
+  { A fixed-point value, 16 bits
+    to the left of the point and
+    16 bits to the right  }
+
+  type
+
+     Psposition = ^sposition;
+     sposition = Fixed;
+
+  { AHIAudioCtrl  }
+  { Lots of private data follows!  }
+     PAHIAudioCtrl = ^tAHIAudioCtrl;
+     tAHIAudioCtrl = record
+          ahiac_UserData : APTR;
+       end;
+
+  { AHISoundMessage  }
+     PAHISoundMessage = ^tAHISoundMessage;
+     tAHISoundMessage = record
+          ahism_Channel : UWORD;
+       end;
+
+  { AHIRecordMessage  }
+     PAHIRecordMessage = ^tAHIRecordMessage;
+     tAHIRecordMessage = record
+          ahirm_Type : ULONG;     { Format of buffer (object)  }
+          ahirm_Buffer : APTR;    { Pointer to the sample array  }
+          ahirm_Length : ULONG;   { Number of sample frames in buffer  }
+       end;
+
+  { AHISampleInfo  }
+     PAHISampleInfo = ^tAHISampleInfo;
+     tAHISampleInfo = record
+          ahisi_Type : ULONG;      { Format of samples  }
+          ahisi_Address : APTR;    { Address to array of samples  }
+          ahisi_Length : ULONG;    { Number of samples in array  }
+       end;
+
+  { AHIAudioModeRequester  }
+     PAHIAudioModeRequester = ^tAHIAudioModeRequester;
+     tAHIAudioModeRequester = record
+          ahiam_AudioID : ULONG;      { Selected audio mode  }
+          ahiam_MixFreq : ULONG;      { Selected mixing/sampling frequency  }
+          ahiam_LeftEdge : WORD;      { Coordinates of requester on exit  }
+          ahiam_TopEdge : WORD;
+          ahiam_Width : WORD;
+          ahiam_Height : WORD;
+          ahiam_InfoOpened : BOOL;    { Info window opened on exit?  }
+          ahiam_InfoLeftEdge : WORD;  { Last coordinates of Info window  }
+          ahiam_InfoTopEdge : WORD;
+          ahiam_InfoWidth : WORD;
+          ahiam_InfoHeight : WORD;
+          ahiam_UserData : APTR;      { You can store your own data here  }
+	  { Lots of private data follows!  }
+       end;
+
+  { AHIEffMasterVolume  }
+     PAHIEffMasterVolume = ^tAHIEffMasterVolume;
+     tAHIEffMasterVolume = record
+          ahie_Effect : ULONG;     { Set to AHIET_MASTERVOLUME  }
+          ahiemv_Volume : Fixed;   { See autodocs for range!  }
+       end;
+
+  { AHIEffOutputBuffer  }
+     PAHIEffOutputBuffer = ^tAHIEffOutputBuffer;
+     tAHIEffOutputBuffer = record
+          ahie_Effect : ULONG;     { Set to AHIET_OUTPUTBUFFER  }
+          ahieob_Func : PHook;
+	  { These fields are filled by AHI  }
+          ahieob_Type : ULONG;     { Format of buffer  }
+          ahieob_Buffer : APTR;    { Pointer to the sample array  }
+          ahieob_Length : ULONG;   { Number of sample frames in buffer  }
+       end;
+
+  { AHIEffDSPMask (V4)  }
+     PAHIEffDSPMask = ^tAHIEffDSPMask;
+     tAHIEffDSPMask = record
+          ahie_Effect : ULONG;       { Set to AHIET_DSPMASK  }
+          ahiedm_Channels : UWORD;   { Number of elements in array  }
+          ahiedm_Mask : array[0..0] of UBYTE;   { Here follows the array  }
+       end;
+
+
+  const
+     AHIEDM_WET = 0;
+     AHIEDM_DRY = 1;
+  { AHIEffDSPEcho (V4)  }
+  type
+     PAHIDSPEcho = ^tAHIDSPEcho;
+     tAHIDSPEcho = record
+          ahie_Effect : ULONG;     { Set to AHIET_DSPECHO  }
+          ahiede_Delay : ULONG;    { In samples  }
+          ahiede_Feedback : Fixed;
+          ahiede_Mix : Fixed;
+          ahiede_Cross : Fixed;
+       end;
+
+  { AHIEffChannelInfo (V4)  }
+     PAHIEffChannelInfo = ^tAHIEffChannelInfo;
+     tAHIEffChannelInfo = record
+          ahie_Effect : ULONG;    { Set to AHIET_CHANNELINFO  }
+          ahieci_Func : PHook;
+          ahieci_Channels : UWORD;
+          ahieci_Pad : UWORD;
+	  { The rest is filled by AHI  }
+          ahieci_Offset : array[0..0] of ULONG;   { The array follows  }
+       end;
+
+  {   TAGS  }
+
+  const
+     AHI_TagBase = TAG_USER;
+     AHI_TagBaseR = AHI_TagBase or $8000;
+  { AHI_AllocAudioA tags  }
+  { Desired audio mode  }
+     AHIA_AudioID = AHI_TagBase + 1;
+  { Suggested mixing frequency  }
+     AHIA_MixFreq = AHI_TagBase + 2;
+  { Suggested number of channels  }
+     AHIA_Channels = AHI_TagBase + 3;
+  { Number of sounds to use  }
+     AHIA_Sounds = AHI_TagBase + 4;
+  { End-of-Sound Hook  }
+     AHIA_SoundFunc = AHI_TagBase + 5;
+  { Player Hook  }
+     AHIA_PlayerFunc = AHI_TagBase + 6;
+  { Frequency for player Hook (Fixed) }
+     AHIA_PlayerFreq = AHI_TagBase + 7;
+  { Minimum Frequency for player Hook  }
+     AHIA_MinPlayerFreq = AHI_TagBase + 8;
+  { Maximum Frequency for player Hook  }
+     AHIA_MaxPlayerFreq = AHI_TagBase + 9;
+  { Sample recording Hook  }
+     AHIA_RecordFunc = AHI_TagBase + 10;
+  { What to put in ahiac_UserData  }
+     AHIA_UserData = AHI_TagBase + 11;
+  { AHI_PlayA tags (V4)  }
+  { All command tags should be...  }
+     AHIP_BeginChannel = AHI_TagBase + 40;
+  { ... enclosed by these tags.  }
+     AHIP_EndChannel = AHI_TagBase + 41;
+     AHIP_Freq = AHI_TagBase + 50;
+     AHIP_Vol = AHI_TagBase + 51;
+     AHIP_Pan = AHI_TagBase + 52;
+     AHIP_Sound = AHI_TagBase + 53;
+     AHIP_Offset = AHI_TagBase + 54;
+     AHIP_Length = AHI_TagBase + 55;
+     AHIP_LoopFreq = AHI_TagBase + 60;
+     AHIP_LoopVol = AHI_TagBase + 61;
+     AHIP_LoopPan = AHI_TagBase + 62;
+     AHIP_LoopSound = AHI_TagBase + 63;
+     AHIP_LoopOffset = AHI_TagBase + 64;
+     AHIP_LoopLength = AHI_TagBase + 65;
+  { AHI_ControlAudioA tags  }
+  { Boolean  }
+     AHIC_Play = AHI_TagBase + 80;
+  { Boolean  }
+     AHIC_Record = AHI_TagBase + 81;
+     AHIC_MonitorVolume = AHI_TagBase + 82;
+  { ti_Data is pointer to Fixed (LONG)  }
+     AHIC_MonitorVolume_Query = AHI_TagBase + 83;
+  { ti_Data is pointer to ULONG  }
+     AHIC_MixFreq_Query = AHI_TagBase + 84;
+  { --- New for V2, they will be ignored by V1 ---  }
+     AHIC_InputGain = AHI_TagBase + 85;
+  { ti_Data is pointer to Fixed (LONG)  }
+     AHIC_InputGain_Query = AHI_TagBase + 86;
+     AHIC_OutputVolume = AHI_TagBase + 87;
+  { ti_Data is pointer to Fixed (LONG)  }
+     AHIC_OutputVolume_Query = AHI_TagBase + 88;
+     AHIC_Input = AHI_TagBase + 89;
+  { ti_Data is pointer to ULONG  }
+     AHIC_Input_Query = AHI_TagBase + 90;
+     AHIC_Output = AHI_TagBase + 91;
+  { ti_Data is pointer to ULONG  }
+     AHIC_Output_Query = AHI_TagBase + 92;
+  { AHI_GetAudioAttrsA tags  }
+     AHIDB_AudioID = AHI_TagBase + 100;
+  { Pointer to name of driver  }
+     AHIDB_Driver = AHI_TagBaseR + 101;
+  { Private!  }
+     AHIDB_Flags = AHI_TagBase + 102;
+  { Boolean  }
+     AHIDB_Volume = AHI_TagBase + 103;
+  { Boolean  }
+     AHIDB_Panning = AHI_TagBase + 104;
+  { Boolean  }
+     AHIDB_Stereo = AHI_TagBase + 105;
+  { Boolean  }
+     AHIDB_HiFi = AHI_TagBase + 106;
+  { Boolean  }
+     AHIDB_PingPong = AHI_TagBase + 107;
+  { Private!  }
+     AHIDB_MultTable = AHI_TagBase + 108;
+  { Pointer to name of this mode  }
+     AHIDB_Name = AHI_TagBaseR + 109;
+  { Output bits  }
+     AHIDB_Bits = AHI_TagBase + 110;
+  { Max supported channels  }
+     AHIDB_MaxChannels = AHI_TagBase + 111;
+  { Min mixing freq. supported  }
+     AHIDB_MinMixFreq = AHI_TagBase + 112;
+  { Max mixing freq. supported  }
+     AHIDB_MaxMixFreq = AHI_TagBase + 113;
+  { Boolean  }
+     AHIDB_Record = AHI_TagBase + 114;
+     AHIDB_Frequencies = AHI_TagBase + 115;
+  { ti_Data is frequency index  }
+     AHIDB_FrequencyArg = AHI_TagBase + 116;
+     AHIDB_Frequency = AHI_TagBase + 117;
+  { Pointer to driver author name  }
+     AHIDB_Author = AHI_TagBase + 118;
+  { Pointer to driver copyright notice  }
+     AHIDB_Copyright = AHI_TagBase + 119;
+  { Pointer to driver version string  }
+     AHIDB_Version = AHI_TagBase + 120;
+  { Pointer to driver annotation text  }
+     AHIDB_Annotation = AHI_TagBase + 121;
+  { Specifies the string buffer size  }
+     AHIDB_BufferLen = AHI_TagBase + 122;
+  { ti_Data is frequency!  }
+     AHIDB_IndexArg = AHI_TagBase + 123;
+     AHIDB_Index = AHI_TagBase + 124;
+  { Boolean  }
+     AHIDB_Realtime = AHI_TagBase + 125;
+  { It's sample  frames   }
+     AHIDB_MaxPlaySamples = AHI_TagBase + 126;
+  { It's sample  frames   }
+     AHIDB_MaxRecordSamples = AHI_TagBase + 127;
+  { Boolean  }
+     AHIDB_FullDuplex = AHI_TagBase + 129;
+  { --- New for V2, they will be ignored by V1 ---  }
+     AHIDB_MinMonitorVolume = AHI_TagBase + 130;
+     AHIDB_MaxMonitorVolume = AHI_TagBase + 131;
+     AHIDB_MinInputGain = AHI_TagBase + 132;
+     AHIDB_MaxInputGain = AHI_TagBase + 133;
+     AHIDB_MinOutputVolume = AHI_TagBase + 134;
+     AHIDB_MaxOutputVolume = AHI_TagBase + 135;
+     AHIDB_Inputs = AHI_TagBase + 136;
+  { ti_Data is input index  }
+     AHIDB_InputArg = AHI_TagBase + 137;
+     AHIDB_Input = AHI_TagBase + 138;
+     AHIDB_Outputs = AHI_TagBase + 139;
+  { ti_Data is input index  }
+     AHIDB_OutputArg = AHI_TagBase + 140;
+     AHIDB_Output = AHI_TagBase + 141;
+  { --- New for V4, they will be ignored by V2 and earlier ---  }
+  { Private!  }
+     AHIDB_Data = AHI_TagBaseR + 142;
+  { AHI_BestAudioIDA tags  }
+  { --- New for V4, they will be ignored by V2 and earlier ---  }
+     AHIB_Dizzy = AHI_TagBase + 190;
+  { AHI_AudioRequestA tags  }
+  { Window control  }
+  { Parent window  }
+     AHIR_Window = AHI_TagBase + 200;
+  { Screen to open on if no window  }
+     AHIR_Screen = AHI_TagBase + 201;
+  { Name of public screen  }
+     AHIR_PubScreenName = AHI_TagBase + 202;
+  { Allocate private IDCMP?  }
+     AHIR_PrivateIDCMP = AHI_TagBase + 203;
+  { Function to handle IntuiMessages  }
+     AHIR_IntuiMsgFunc = AHI_TagBase + 204;
+  { Block input in AHIR_Window?  }
+     AHIR_SleepWindow = AHI_TagBase + 205;
+  { What to put in ahiam_UserData  }
+     AHIR_UserData = AHI_TagBase + 206;
+  { Text display  }
+  { Text font to use for gadget text  }
+     AHIR_TextAttr = AHI_TagBase + 220;
+  { Locale to use for text  }
+     AHIR_Locale = AHI_TagBase + 221;
+  { Title of requester  }
+     AHIR_TitleText = AHI_TagBase + 222;
+  { Positive gadget text  }
+     AHIR_PositiveText = AHI_TagBase + 223;
+  { Negative gadget text  }
+     AHIR_NegativeText = AHI_TagBase + 224;
+  { Initial settings  }
+  { Initial requester coordinates  }
+     AHIR_InitialLeftEdge = AHI_TagBase + 240;
+     AHIR_InitialTopEdge = AHI_TagBase + 241;
+  { Initial requester dimensions  }
+     AHIR_InitialWidth = AHI_TagBase + 242;
+     AHIR_InitialHeight = AHI_TagBase + 243;
+  { Initial audio mode id  }
+     AHIR_InitialAudioID = AHI_TagBase + 244;
+  { Initial mixing/sampling frequency  }
+     AHIR_InitialMixFreq = AHI_TagBase + 245;
+  { Info window initially opened?  }
+     AHIR_InitialInfoOpened = AHI_TagBase + 246;
+  { Initial Info window coords.  }
+     AHIR_InitialInfoLeftEdge = AHI_TagBase + 247;
+     AHIR_InitialInfoTopEdge = AHI_TagBase + 248;
+  { Not used!  }
+     AHIR_InitialInfoWidth = AHI_TagBase + 249;
+  { Not used!  }
+     AHIR_InitialInfoHeight = AHI_TagBase + 250;
+  { Options  }
+  { Allow selection of mixing frequency?  }
+     AHIR_DoMixFreq = AHI_TagBase + 260;
+  { Allow selection of default mode? (V4)  }
+     AHIR_DoDefaultMode = AHI_TagBase + 261;
+  { Filtering  }
+  { Pointer to filter taglist  }
+     AHIR_FilterTags = AHI_TagBase + 270;
+  { Function to filter mode id's  }
+     AHIR_FilterFunc = AHI_TagBase + 271;
+  {   DEFS  }
+     AHINAME : PChar = 'ahi.device';
+  { Invalid Audio ID  }
+     AHI_INVALID_ID =  not (0);
+  { Only for AHI_AllocAudioA()!  }
+     AHI_DEFAULT_ID = $00000000;
+  { Special sample render Audio ID  }
+     AHI_LOOPBACK_ID = $00000001;
+  { Only for AHI_AllocAudioA()!  }
+     AHI_DEFAULT_FREQ = 0;
+  { Special frequency for AHI_SetFreq()  }
+     AHI_MIXFREQ =  not (0);
+  { Turns a channel off  }
+     AHI_NOSOUND = $ffff;
+  { Set#? Flags  }
+     AHISF_IMM = 1 shl 0;
+     AHISB_IMM = 0;
+  { Effect Types  }
+  { OR with effect to disable  }
+     AHIET_CANCEL = 1 shl 31;
+     AHIET_MASTERVOLUME = 1;
+     AHIET_OUTPUTBUFFER = 2;
+  { --- New for V4 ---  }
+     AHIET_DSPMASK = 3;
+     AHIET_DSPECHO = 4;
+     AHIET_CHANNELINFO = 5;
+  { Sound Types  }
+  { Private  }
+     AHIST_NOTYPE =  not (0);
+  { 8 or 16 bit sample  }
+     AHIST_SAMPLE = 0;
+  { Dynamic sample  }
+     AHIST_DYNAMICSAMPLE = 1;
+  { The input from your sampler  }
+     AHIST_INPUT = 1 shl 29;
+  { Private  }
+     AHIST_BW = 1 shl 30;
+  { Sample types  }
+  { Note that only AHIST_M8S, AHIST_S8S, AHIST_M16S and AHIST_S16S
+     are supported by AHI_LoadSound().  }
+  { Mono, 8 bit signed (BYTE)  }
+     AHIST_M8S = 0;
+  { Mono, 16 bit signed (WORD)  }
+     AHIST_M16S = 1;
+  { Stereo, 8 bit signed (2×BYTE)  }
+     AHIST_S8S = 2;
+  { Stereo, 16 bit signed (2×WORD)  }
+     AHIST_S16S = 3;
+  { Mono, 32 bit signed (LONG)  }
+     AHIST_M32S = 8;
+  { Stereo, 32 bit signed (2×LONG)  }
+     AHIST_S32S = 10;
+  { OBSOLETE!  }
+     AHIST_M8U = 4;
+  { Error codes  }
+  { No error  }
+     AHIE_OK = 0;
+  { Out of memory  }
+     AHIE_NOMEM = 1;
+  { Unknown sound type  }
+     AHIE_BADSOUNDTYPE = 2;
+  { Unknown/unsupported sample type  }
+     AHIE_BADSAMPLETYPE = 3;
+  { User-triggered abortion  }
+     AHIE_ABORTED = 4;
+  { Error, but unknown  }
+     AHIE_UNKNOWN = 5;
+  { CMD_WRITE/CMD_READ failure  }
+     AHIE_HALFDUPLEX = 6;
+  { DEVICE INTERFACE DEFINITIONS FOLLOWS                                     }
+  { Device units  }
+     AHI_DEFAULT_UNIT = 0;
+     AHI_NO_UNIT = 255;
+  { The preference file  }
+     ID_AHIU = $41484955;
+     ID_AHIG = $41484947;
+
+
+  type
+     PAHIUnitPrefs = ^tAHIUnitPrefs;
+     tAHIUnitPrefs = record
+          ahiup_Unit : UBYTE;
+          ahiup_Pad : UBYTE;
+          ahiup_Channels : UWORD;
+          ahiup_AudioMode : ULONG;
+          ahiup_Frequency : ULONG;
+          ahiup_MonitorVolume : Fixed;
+          ahiup_InputGain : Fixed;
+          ahiup_OutputVolume : Fixed;
+          ahiup_Input : ULONG;
+          ahiup_Output : ULONG;
+       end;
+
+
+
+     PAHIGlobalPrefs = ^tAHIGlobalPrefs;
+     tAHIGlobalPrefs = record
+          ahigp_DebugLevel : UWORD;       { Range: 0-3 (for None, Low,}
+          ahigp_DisableSurround : BOOL;   { High and All)  }
+          ahigp_DisableEcho : BOOL;
+          ahigp_FastEcho : BOOL;
+          ahigp_MaxCPU : Fixed;
+          ahigp_ClipMasterVolume : BOOL;
+       end;
+
+  { Debug levels  }
+
+  const
+     AHI_DEBUG_NONE = 0;
+     AHI_DEBUG_LOW = 1;
+     AHI_DEBUG_HIGH = 2;
+     AHI_DEBUG_ALL = 3;
+
+  { AHIRequest  }
+  type
+     PAHIRequest = ^tAHIRequest;
+     tAHIRequest = record
+          ahir_Std : tIOStdReq;                  { Standard IO request  }
+          ahir_Version : UWORD;                  { Needed version  }
+          { --- New for V4, they will be ignored by V2 and earlier ---  }
+	  ahir_Pad1 : UWORD;
+          ahir_Private : array[0..1] of ULONG;   { Hands off!  }
+          ahir_Type : ULONG;                     { Sample format  }
+          ahir_Frequency : ULONG;                { Sample/Record frequency  }
+          ahir_Volume : Fixed;                   { Sample volume  }
+          ahir_Position : Fixed;                 { Stereo position  }
+          ahir_Link : PAHIRequest;               { For double buffering  }
+       end;
+
+  { Flags for OpenDevice()  }
+
+  const
+     AHIDF_NOMODESCAN = 1 shl 0;
+     AHIDB_NOMODESCAN = 0;
+
+
+
+FUNCTION AHI_AddAudioMode(a0arg : pTagItem) : longword;
+FUNCTION AHI_AllocAudioA(tagList : pTagItem) : pAHIAudioCtrl;
+FUNCTION AHI_AllocAudioRequestA(tagList : pTagItem) : pAHIAudioModeRequester;
+FUNCTION AHI_AudioRequestA(Requester : pAHIAudioModeRequester; tagList : pTagItem) : BOOLEAN;
+FUNCTION AHI_BestAudioIDA(tagList : pTagItem) : longword;
+FUNCTION AHI_ControlAudioA(AudioCtrl : pAHIAudioCtrl; tagList : pTagItem) : longword;
+PROCEDURE AHI_FreeAudio(AudioCtrl : pAHIAudioCtrl);
+PROCEDURE AHI_FreeAudioRequest(Requester : pAHIAudioModeRequester);
+FUNCTION AHI_GetAudioAttrsA(ID : longword; Audioctrl : pAHIAudioCtrl; tagList : pTagItem) : BOOLEAN;
+PROCEDURE AHI_KillAudio;
+FUNCTION AHI_LoadModeFile(a0arg : pCHAR) : longword;
+FUNCTION AHI_LoadSound(Sound : WORD; _Type : longword; Info : POINTER; AudioCtrl : pAHIAudioCtrl) : longword;
+FUNCTION AHI_NextAudioID(Last_ID : longword) : longword;
+PROCEDURE AHI_PlayA(Audioctrl : pAHIAudioCtrl; tagList : pTagItem);
+FUNCTION AHI_RemoveAudioMode(d0arg : longword) : longword;
+FUNCTION AHI_SampleFrameSize(SampleType : longword) : longword;
+FUNCTION AHI_SetEffect(Effect : POINTER; AudioCtrl : pAHIAudioCtrl) : longword;
+PROCEDURE AHI_SetFreq(Channel : WORD; Freq : longword; AudioCtrl : pAHIAudioCtrl; Flags : longword);
+PROCEDURE AHI_SetSound(Channel : WORD; Sound : WORD; Offset : longword; len : LONGINT; AudioCtrl : pAHIAudioCtrl; Flags : longword);
+PROCEDURE AHI_SetVol(Channel : WORD; Volume : LONGINT; Pan : LONGINT; AudioCtrl : pAHIAudioCtrl; Flags : longword);
+PROCEDURE AHI_UnloadSound(Sound : WORD; Audioctrl : pAHIAudioCtrl);
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AHI_AllocAudio(const tagList : Array Of Const) : pAHIAudioCtrl;
+FUNCTION AHI_AllocAudioRequest(const tagList : Array Of Const) : pAHIAudioModeRequester;
+FUNCTION AHI_AudioRequest(Requester : pAHIAudioModeRequester; const tagList : Array Of Const) : BOOLEAN;
+FUNCTION AHI_BestAudioID(const tagList : Array Of Const) : longword;
+FUNCTION AHI_ControlAudio(AudioCtrl : pAHIAudioCtrl; const tagList : Array Of Const) : longword;
+FUNCTION AHI_GetAudioAttrs(ID : longword; Audioctrl : pAHIAudioCtrl; const tagList : Array Of Const) : BOOLEAN;
+PROCEDURE AHI_Play(Audioctrl : pAHIAudioCtrl; const tagList : Array Of Const);
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitAHILibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    AHIIsCompiledHow : longint;
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+FUNCTION AHI_AddAudioMode(a0arg : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a0arg,A0
+	MOVEA.L	AHIBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_AllocAudioA(tagList : pTagItem) : pAHIAudioCtrl;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tagList,A1
+	MOVEA.L	AHIBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_AllocAudioRequestA(tagList : pTagItem) : pAHIAudioModeRequester;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tagList,A0
+	MOVEA.L	AHIBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_AudioRequestA(Requester : pAHIAudioModeRequester; tagList : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Requester,A0
+	MOVEA.L	tagList,A1
+	MOVEA.L	AHIBase,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 AHI_BestAudioIDA(tagList : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tagList,A1
+	MOVEA.L	AHIBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_ControlAudioA(AudioCtrl : pAHIAudioCtrl; tagList : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	tagList,A1
+	MOVEA.L	AHIBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE AHI_FreeAudio(AudioCtrl : pAHIAudioCtrl);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE AHI_FreeAudioRequest(Requester : pAHIAudioModeRequester);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Requester,A0
+	MOVEA.L	AHIBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION AHI_GetAudioAttrsA(ID : longword; Audioctrl : pAHIAudioCtrl; tagList : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	ID,D0
+	MOVEA.L	Audioctrl,A2
+	MOVEA.L	tagList,A1
+	MOVEA.L	AHIBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+PROCEDURE AHI_KillAudio;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	AHIBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION AHI_LoadModeFile(a0arg : pCHAR) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a0arg,A0
+	MOVEA.L	AHIBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_LoadSound(Sound : WORD; _Type : longword; Info : POINTER; AudioCtrl : pAHIAudioCtrl) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Sound,D0
+	MOVE.L	_Type,D1
+	MOVEA.L	Info,A0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_NextAudioID(Last_ID : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Last_ID,D0
+	MOVEA.L	AHIBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE AHI_PlayA(Audioctrl : pAHIAudioCtrl; tagList : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Audioctrl,A2
+	MOVEA.L	tagList,A1
+	MOVEA.L	AHIBase,A6
+	JSR	-138(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION AHI_RemoveAudioMode(d0arg : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	d0arg,D0
+	MOVEA.L	AHIBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_SampleFrameSize(SampleType : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	SampleType,D0
+	MOVEA.L	AHIBase,A6
+	JSR	-144(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHI_SetEffect(Effect : POINTER; AudioCtrl : pAHIAudioCtrl) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Effect,A0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE AHI_SetFreq(Channel : WORD; Freq : longword; AudioCtrl : pAHIAudioCtrl; Flags : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Channel,D0
+	MOVE.L	Freq,D1
+	MOVEA.L	AudioCtrl,A2
+	MOVE.L	Flags,D2
+	MOVEA.L	AHIBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE AHI_SetSound(Channel : WORD; Sound : WORD; Offset : longword; len : LONGINT; AudioCtrl : pAHIAudioCtrl; Flags : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Channel,D0
+	MOVE.L	Sound,D1
+	MOVE.L	Offset,D2
+	MOVE.L	len,D3
+	MOVEA.L	AudioCtrl,A2
+	MOVE.L	Flags,D4
+	MOVEA.L	AHIBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE AHI_SetVol(Channel : WORD; Volume : LONGINT; Pan : LONGINT; AudioCtrl : pAHIAudioCtrl; Flags : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Channel,D0
+	MOVE.L	Volume,D1
+	MOVE.L	Pan,D2
+	MOVEA.L	AudioCtrl,A2
+	MOVE.L	Flags,D3
+	MOVEA.L	AHIBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE AHI_UnloadSound(Sound : WORD; Audioctrl : pAHIAudioCtrl);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Sound,D0
+	MOVEA.L	Audioctrl,A2
+	MOVEA.L	AHIBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AHI_AllocAudio(const tagList : Array Of Const) : pAHIAudioCtrl;
+begin
+    AHI_AllocAudio := AHI_AllocAudioA(readintags(tagList));
+end;
+
+FUNCTION AHI_AllocAudioRequest(const tagList : Array Of Const) : pAHIAudioModeRequester;
+begin
+    AHI_AllocAudioRequest := AHI_AllocAudioRequestA(readintags(tagList));
+end;
+
+FUNCTION AHI_AudioRequest(Requester : pAHIAudioModeRequester; const tagList : Array Of Const) : BOOLEAN;
+begin
+    AHI_AudioRequest := AHI_AudioRequestA(Requester , readintags(tagList));
+end;
+
+FUNCTION AHI_BestAudioID(const tagList : Array Of Const) : longword;
+begin
+    AHI_BestAudioID := AHI_BestAudioIDA(readintags(tagList));
+end;
+
+FUNCTION AHI_ControlAudio(AudioCtrl : pAHIAudioCtrl; const tagList : Array Of Const) : longword;
+begin
+    AHI_ControlAudio := AHI_ControlAudioA(AudioCtrl , readintags(tagList));
+end;
+
+FUNCTION AHI_GetAudioAttrs(ID : longword; Audioctrl : pAHIAudioCtrl; const tagList : Array Of Const) : BOOLEAN;
+begin
+    AHI_GetAudioAttrs := AHI_GetAudioAttrsA(ID , Audioctrl , readintags(tagList));
+end;
+
+PROCEDURE AHI_Play(Audioctrl : pAHIAudioCtrl; const tagList : Array Of Const);
+begin
+    AHI_PlayA(Audioctrl , readintags(tagList));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of ahi.library}
+  {$Info don't forget to use InitAHILibrary in the beginning of your program}
+
+var
+    ahi_exit : Pointer;
+
+procedure CloseahiLibrary;
+begin
+    ExitProc := ahi_exit;
+    if AHIBase <> nil then begin
+        CloseLibrary(AHIBase);
+        AHIBase := nil;
+    end;
+end;
+
+procedure InitAHILibrary;
+begin
+    AHIBase := nil;
+    AHIBase := OpenLibrary(AHINAME,LIBVERSION);
+    if AHIBase <> nil then begin
+        ahi_exit := ExitProc;
+        ExitProc := @CloseahiLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ahi.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    AHIIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of ahi.library}
+
+var
+    ahi_exit : Pointer;
+
+procedure CloseahiLibrary;
+begin
+    ExitProc := ahi_exit;
+    if AHIBase <> nil then begin
+        CloseLibrary(AHIBase);
+        AHIBase := nil;
+    end;
+end;
+
+begin
+    AHIBase := nil;
+    AHIBase := OpenLibrary(AHINAME,LIBVERSION);
+    if AHIBase <> nil then begin
+        ahi_exit := ExitProc;
+        ExitProc := @CloseahiLibrary;
+        AHIIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ahi.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    AHIIsCompiledHow := 3;
+   {$Warning No autoopening of ahi.library compiled}
+   {$Warning Make sure you open ahi.library yourself}
+{$endif dont_use_openlib}
+
+END. (* UNIT AHI *)
+
+{
+  $Log
+}
+
+  

+ 471 - 0
packages/extra/amunits/otherlibs/ahi/units/ahi_sub.pas

@@ -0,0 +1,471 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for ahi_sub.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+
+{
+  History:
+  
+  First version of this unit.
+  15 Jan 2003.
+  
+  Changed cardinal > longword.
+  Added startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}
+
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT AHI_SUB;
+
+INTERFACE
+USES Exec, ahi, utility;
+
+
+  {
+    	$VER: ahi_sub.h 4.1 (2.4.97)
+
+    	ahi/[driver].audio definitions
+
+    	(C) Copyright 1994-1997 Martin Blom
+    	All Rights Reserved.
+
+     (TAB SIZE: 8)
+   }
+
+   { AHIAudioCtrlDrv  }
+  type
+     PAHIAudioCtrlDrv = ^tAHIAudioCtrlDrv;
+     tAHIAudioCtrlDrv = record
+          ahiac_AudioCtrl : tAHIAudioCtrl;
+          ahiac_Flags : ULONG;              { See below for definition  }
+          ahiac_SoundFunc : PHook;          { AHIA_SoundFunc  }
+          ahiac_PlayerFunc : PHook;         { AHIA_PlayerFunc  }
+          ahiac_PlayerFreq : Fixed;         { AHIA_PlayerFreq  }
+          ahiac_MinPlayerFreq : Fixed;      { AHIA_MinPlayerFreq  }
+          ahiac_MaxPlayerFreq : Fixed;      { AHIA_MaxPlayerFreq  }
+          ahiac_MixFreq : ULONG;            { AHIA_MixFreq  }
+          ahiac_Channels : UWORD;           { AHIA_Channels  }
+          ahiac_Sounds : UWORD;             { AHIA_Sounds  }
+          ahiac_DriverData : APTR;          { Unused. Store whatever you want here.  }
+          ahiac_MixerFunc : PHook;          { Mixing routine Hook  }
+          ahiac_SamplerFunc : PHook;        { Sampler routine Hook  }
+          ahiac_Obsolete : ULONG;
+          ahiac_BuffSamples : ULONG;        { Samples to mix this pass.  }
+          ahiac_MinBuffSamples : ULONG;     { Min. samples to mix each pass.  }
+          ahiac_MaxBuffSamples : ULONG;     { Max. samples to mix each pass.  }
+          ahiac_BuffSize : ULONG;           { Buffer size ahiac_MixerFunc needs.  }
+          ahiac_BuffType : ULONG;           { Buffer format (V2)  }
+          ahiac_PreTimer : function :BOOL;  { Call before mixing (V4)  }
+          ahiac_PostTimer : procedure;      { Call after mixing (V4)  }
+       end;
+
+       { The rest is PRIVATE! Hands off! They may change any time.
+  	[lots of private stuff]  }
+
+  {   TAGS  }
+  const
+     AHIDB_UserBase = AHI_TagBase + 500;    { Use for driver specific tags  }
+  {   DEFS  }
+  { AHIsub_AllocAudio return flags  }
+     AHISF_ERROR = 1 shl 0;
+     AHISF_MIXING = 1 shl 1;
+     AHISF_TIMING = 1 shl 2;
+     AHISF_KNOWSTEREO = 1 shl 3;
+     AHISF_KNOWHIFI = 1 shl 4;
+     AHISF_CANRECORD = 1 shl 5;
+     AHISF_CANPOSTPROCESS = 1 shl 6;
+     AHISB_ERROR = 0;
+     AHISB_MIXING = 1;
+     AHISB_TIMING = 2;
+     AHISB_KNOWSTEREO = 3;
+     AHISB_KNOWHIFI = 4;
+     AHISB_CANRECORD = 5;
+     AHISB_CANPOSTPROCESS = 6;
+  { AHIsub_Start() and AHIsub_Stop() flags  }
+     AHISF_PLAY = 1 shl 0;
+     AHISF_RECORD = 1 shl 1;
+     AHISB_PLAY = 0;
+     AHISB_RECORD = 1;
+  { ahiac_Flags  }
+     AHIACF_VOL = 1 shl 0;
+     AHIACF_PAN = 1 shl 1;
+     AHIACF_STEREO = 1 shl 2;
+     AHIACF_HIFI = 1 shl 3;
+     AHIACF_PINGPONG = 1 shl 4;
+     AHIACF_RECORD = 1 shl 5;
+
+     AHIACF_MULTTAB = 1 shl 6;   { Private!  }
+     AHIACB_VOL = 0;
+     AHIACB_PAN = 1;
+     AHIACB_STEREO = 2;
+     AHIACB_HIFI = 3;
+     AHIACB_PINGPONG = 4;
+     AHIACB_RECORD = 5;
+
+     AHIACB_MULTTAB = 6;        { Private!  }
+
+  { AHIsub_Set#? and AHIsub_(Un)LoadSound return code  }
+     AHIS_UNKNOWN =  not (0);
+
+  { IFF chunk names for the audio mode file  }
+     ID_AHIM = $4148494D;     { AHI Modes  }
+     ID_AUDN = $4155544E;     { AUDio driver Name  }
+     ID_AUDD = $41554444;     { AUDio driver Data  }
+     ID_AUDM = $4155444D;     { AUDio Mode  }
+
+
+
+
+VAR AHIsubBase : pLibrary;
+
+const
+    AHI_SUBNAME : PChar = 'ahi_sub.library';
+
+
+FUNCTION AHIsub_AllocAudio(tagList : pTagItem; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+PROCEDURE AHIsub_Disable(AudioCtrl : pAHIAudioCtrlDrv);
+PROCEDURE AHIsub_Enable(AudioCtrl : pAHIAudioCtrlDrv);
+PROCEDURE AHIsub_FreeAudio(AudioCtrl : pAHIAudioCtrlDrv);
+FUNCTION AHIsub_GetAttr(Attribute : longword; Argument : LONGINT; d2arg : LONGINT; tagList : pTagItem; AudioCtrl : pAHIAudioCtrlDrv) : LONGINT;
+FUNCTION AHIsub_HardwareControl(Attribute : longword; Argument : LONGINT; AudioCtrl : pAHIAudioCtrlDrv) : LONGINT;
+FUNCTION AHIsub_LoadSound(Sound : WORD; _Type : longword; Info : POINTER; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+FUNCTION AHIsub_SetEffect(Effect : POINTER; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+FUNCTION AHIsub_SetFreq(Channel : WORD; Freq : longword; AudioCtrl : pAHIAudioCtrlDrv; Flags : longword) : longword;
+FUNCTION AHIsub_SetSound(Channel : WORD; Sound : WORD; Offset : longword; Length : LONGINT; AudioCtrl : pAHIAudioCtrlDrv; Flags : longword) : longword;
+FUNCTION AHIsub_SetVol(Channel : WORD; Volume : LONGINT; Pan : LONGINT; AudioCtrl : pAHIAudioCtrlDrv; Flags : longword) : longword;
+FUNCTION AHIsub_Start(Flags : longword; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+FUNCTION AHIsub_Stop(Flags : longword; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+FUNCTION AHIsub_UnloadSound(Sound : WORD; Audioctrl : pAHIAudioCtrlDrv) : longword;
+FUNCTION AHIsub_Update(Flags : longword; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitAHI_SUBLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    AHI_SUBIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+
+FUNCTION AHIsub_AllocAudio(tagList : pTagItem; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tagList,A1
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE AHIsub_Disable(AudioCtrl : pAHIAudioCtrlDrv);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE AHIsub_Enable(AudioCtrl : pAHIAudioCtrlDrv);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE AHIsub_FreeAudio(AudioCtrl : pAHIAudioCtrlDrv);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION AHIsub_GetAttr(Attribute : longword; Argument : LONGINT; d2arg : LONGINT; tagList : pTagItem; AudioCtrl : pAHIAudioCtrlDrv) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Attribute,D0
+	MOVE.L	Argument,D1
+	MOVE.L	d2arg,D2
+	MOVEA.L	tagList,A1
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_HardwareControl(Attribute : longword; Argument : LONGINT; AudioCtrl : pAHIAudioCtrlDrv) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Attribute,D0
+	MOVE.L	Argument,D1
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_LoadSound(Sound : WORD; _Type : longword; Info : POINTER; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Sound,D0
+	MOVE.L	_Type,D1
+	MOVEA.L	Info,A0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_SetEffect(Effect : POINTER; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Effect,A0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_SetFreq(Channel : WORD; Freq : longword; AudioCtrl : pAHIAudioCtrlDrv; Flags : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Channel,D0
+	MOVE.L	Freq,D1
+	MOVEA.L	AudioCtrl,A2
+	MOVE.L	Flags,D2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_SetSound(Channel : WORD; Sound : WORD; Offset : longword; Length : LONGINT; AudioCtrl : pAHIAudioCtrlDrv; Flags : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Channel,D0
+	MOVE.L	Sound,D1
+	MOVE.L	Offset,D2
+	MOVE.L	Length,D3
+	MOVEA.L	AudioCtrl,A2
+	MOVE.L	Flags,D4
+	MOVEA.L	AHIsubBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_SetVol(Channel : WORD; Volume : LONGINT; Pan : LONGINT; AudioCtrl : pAHIAudioCtrlDrv; Flags : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Channel,D0
+	MOVE.L	Volume,D1
+	MOVE.L	Pan,D2
+	MOVEA.L	AudioCtrl,A2
+	MOVE.L	Flags,D3
+	MOVEA.L	AHIsubBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_Start(Flags : longword; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Flags,D0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_Stop(Flags : longword; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Flags,D0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_UnloadSound(Sound : WORD; Audioctrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Sound,D0
+	MOVEA.L	Audioctrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AHIsub_Update(Flags : longword; AudioCtrl : pAHIAudioCtrlDrv) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Flags,D0
+	MOVEA.L	AudioCtrl,A2
+	MOVEA.L	AHIsubBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of ahi_sub.library}
+  {$Info don't forget to use InitAHI_SUBLibrary in the beginning of your program}
+
+var
+    ahi_sub_exit : Pointer;
+
+procedure Closeahi_subLibrary;
+begin
+    ExitProc := ahi_sub_exit;
+    if AHIsubBase <> nil then begin
+        CloseLibrary(AHIsubBase);
+        AHIsubBase := nil;
+    end;
+end;
+
+procedure InitAHI_SUBLibrary;
+begin
+    AHIsubBase := nil;
+    AHIsubBase := OpenLibrary(AHI_SUBNAME,LIBVERSION);
+    if AHIsubBase <> nil then begin
+        ahi_sub_exit := ExitProc;
+        ExitProc := @Closeahi_subLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ahi_sub.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    AHI_SUBIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of ahi_sub.library}
+
+var
+    ahi_sub_exit : Pointer;
+
+procedure Closeahi_subLibrary;
+begin
+    ExitProc := ahi_sub_exit;
+    if AHIsubBase <> nil then begin
+        CloseLibrary(AHIsubBase);
+        AHIsubBase := nil;
+    end;
+end;
+
+begin
+    AHIsubBase := nil;
+    AHIsubBase := OpenLibrary(AHI_SUBNAME,LIBVERSION);
+    if AHIsubBase <> nil then begin
+        ahi_sub_exit := ExitProc;
+        ExitProc := @Closeahi_subLibrary;
+        AHI_SUBIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ahi_sub.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    AHI_SUBIsCompiledHow := 3;
+   {$Warning No autoopening of ahi_sub.library compiled}
+   {$Warning Make sure you open ahi_sub.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT AHI_SUB *)
+
+{
+  $Log
+}
+
+

+ 745 - 0
packages/extra/amunits/otherlibs/cybergraphics/units/cybergraphics.pas

@@ -0,0 +1,745 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for cybergraphics.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  15 Jan 2003.
+  
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}
+  
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT CYBERGRAPHICS;
+
+INTERFACE
+USES Exec,graphics,utility;
+
+VAR CyberGfxBase : pLibrary;
+
+const
+    CYBERGRAPHICSNAME : PChar = 'cybergraphics.library';
+
+{
+    	$VER: cybergraphics.h 41.18 (21.02.1998)
+
+    	include file for cybergraphics.library
+
+    	Copyright © 1996-1998 by phase5 digital products
+          All Rights reserved.
+
+   }
+
+  const
+     CYBERGFXNAME = 'cybergraphics.library';
+     CYBERGFX_INCLUDE_VERSION = 41;
+  {
+      Definition of CyberModeNode (Returned in AllocModeList)
+                                                               }
+  type
+     PCyberModeNode = ^tCyberModeNode;
+     tCyberModeNode = record
+          Node : tNode;
+          ModeText : array[0..(DISPLAYNAMELEN)-1] of char; { name for this mode  }
+          DisplayID : ULONG;                               { display id associated with the node  }
+          Width : UWORD;                                   { visible width  }
+          Height : UWORD;                                  { visible height  }
+          Depth : UWORD;                                   { display depth  }
+          DisplayTagList : PTagItem;                       { taglist with extended ModeID information  }
+       end;
+
+  {
+     Parameters for GetCyberMapAttr()
+                                       }
+  const
+  { function returns BytesPerRow if its called with this parameter  }
+     CYBRMATTR_XMOD = $80000001;
+  { BytesPerPixel shall be returned  }
+     CYBRMATTR_BPPIX = $80000002;
+  { do not use this ! private tag  }
+     CYBRMATTR_DISPADR = $80000003;
+  { the pixel format is returned  }
+     CYBRMATTR_PIXFMT = $80000004;
+  { returns width in pixels  }
+     CYBRMATTR_WIDTH = $80000005;
+  { returns height in lines  }
+     CYBRMATTR_HEIGHT = $80000006;
+  { returns bits per pixel  }
+     CYBRMATTR_DEPTH = $80000007;
+  { returns -1 if supplied bitmap is a cybergfx one  }
+     CYBRMATTR_ISCYBERGFX = $80000008;
+  { returns -1 if supplied bitmap is linear accessable  }
+     CYBRMATTR_ISLINEARMEM = $80000009;
+  {
+     Parameters for GetCyberIDAttr()  
+                                      }
+  { the pixel format is returned  }
+     CYBRIDATTR_PIXFMT = $80000001;
+  { returns visible width in pixels  }
+     CYBRIDATTR_WIDTH = $80000002;
+  { returns visible height in lines  }
+     CYBRIDATTR_HEIGHT = $80000003;
+  { returns bits per pixel  }
+     CYBRIDATTR_DEPTH = $80000004;
+  { BytesPerPixel shall be returned  }
+     CYBRIDATTR_BPPIX = $80000005;
+  {                               
+     Tags for CyberModeRequest()
+                                   }
+     CYBRMREQ_TB = TAG_USER + $40000;
+  {             
+     FilterTags
+                 }
+  { Minimum depth for displayed screenmode  }
+     CYBRMREQ_MinDepth = CYBRMREQ_TB + 0;
+  { Maximum depth  "       "        "  }
+     CYBRMREQ_MaxDepth = CYBRMREQ_TB + 1;
+  { Minumum width  "       "        "  }
+     CYBRMREQ_MinWidth = CYBRMREQ_TB + 2;
+  { Maximum width  "       "        "  }
+     CYBRMREQ_MaxWidth = CYBRMREQ_TB + 3;
+  { Minumum height "       "        "  }
+     CYBRMREQ_MinHeight = CYBRMREQ_TB + 4;
+  { Minumum height "       "        "  }
+     CYBRMREQ_MaxHeight = CYBRMREQ_TB + 5;
+     CYBRMREQ_CModelArray = CYBRMREQ_TB + 6;
+     CYBRMREQ_WinTitle = CYBRMREQ_TB + 20;
+     CYBRMREQ_OKText = CYBRMREQ_TB + 21;
+     CYBRMREQ_CancelText = CYBRMREQ_TB + 22;
+  { Screen you wish the Requester to open on  }
+     CYBRMREQ_Screen = CYBRMREQ_TB + 30;
+  {
+     Tags for BestCyberModeID()
+                                 }
+     CYBRBIDTG_TB = TAG_USER + $50000;
+  { FilterTags  }
+     CYBRBIDTG_Depth = CYBRBIDTG_TB + 0;
+     CYBRBIDTG_NominalWidth = CYBRBIDTG_TB + 1;
+     CYBRBIDTG_NominalHeight = CYBRBIDTG_TB + 2;
+     CYBRBIDTG_MonitorID = CYBRBIDTG_TB + 3;
+     CYBRBIDTG_BoardName = CYBRBIDTG_TB + 5;
+  {
+     definition of divers pixel formats  
+                                         }
+     PIXFMT_LUT8 = 0;
+     PIXFMT_RGB15 = 1;
+     PIXFMT_BGR15 = 2;
+     PIXFMT_RGB15PC = 3;
+     PIXFMT_BGR15PC = 4;
+     PIXFMT_RGB16 = 5;
+     PIXFMT_BGR16 = 6;
+     PIXFMT_RGB16PC = 7;
+     PIXFMT_BGR16PC = 8;
+     PIXFMT_RGB24 = 9;
+     PIXFMT_BGR24 = 10;
+     PIXFMT_ARGB32 = 11;
+     PIXFMT_BGRA32 = 12;
+     PIXFMT_RGBA32 = 13;
+  {                                                         
+     SrcRectangle formats defines for xxxPixelArray calls()
+                                                             }
+     RECTFMT_RGB = 0;
+     RECTFMT_RGBA = 1;
+     RECTFMT_ARGB = 2;
+     RECTFMT_LUT8 = 3;
+     RECTFMT_GREY8 = 4;
+  {                                     
+     Parameters for CVideoCtrlTagList()
+                                         }
+     SETVC_DPMSLevel = $88002001;
+  { Full operation                              }
+     DPMS_ON = 0;
+  { Optional state of minimal power reduction   }
+     DPMS_STANDBY = 1;
+  { Significant reduction of power consumption  }
+     DPMS_SUSPEND = 2;
+  { Lowest level of power consumption           }
+     DPMS_OFF = 3;
+  {
+     Tags for LockBitMapTagList()  
+                                   }
+     LBMI_WIDTH = $84001001;
+     LBMI_HEIGHT = $84001002;
+     LBMI_DEPTH = $84001003;
+     LBMI_PIXFMT = $84001004;
+     LBMI_BYTESPERPIX = $84001005;
+     LBMI_BYTESPERROW = $84001006;
+     LBMI_BASEADDRESS = $84001007;
+  {                                 
+     Tags for UnLockBitMapTagList()
+                                     }
+     UBMI_UPDATERECTS = $85001001;
+     UBMI_REALLYUNLOCK = $85001002;
+  {
+     Message passed to the DoCDrawMethodTagList() hook function	 
+    								 }
+
+  type
+     PCDrawMsg = ^tCDrawMsg;
+     tCDrawMsg = record
+          cdm_MemPtr : APTR;
+          cdm_offx : ULONG;
+          cdm_offy : ULONG;
+          cdm_xsize : ULONG;
+          cdm_ysize : ULONG;
+          cdm_BytesPerRow : UWORD;
+          cdm_BytesPerPix : UWORD;
+          cdm_ColorModel : UWORD;
+       end;
+
+  {							 
+     Colour Table source formats for WriteLUTPixelArray()
+    							 }
+  { ULONG [] table  }
+
+  const
+     CTABFMT_XRGB8 = 0;
+  {							 
+    	graphics.library/AllocBitMap() extended flags
+    							 }
+     BMB_SPECIALFMT = 7;
+     BMF_SPECIALFMT = 1 shl BMB_SPECIALFMT;
+
+FUNCTION AllocCModeListTagList(ModeListTags : pTagItem) : pList;
+FUNCTION BestCModeIDTagList(BestModeIDTags : pTagItem) : longword;
+FUNCTION CModeRequestTagList(ModeRequest : POINTER; ModeRequestTags : pTagItem) : longword;
+PROCEDURE CVideoCtrlTagList(ViewPort : pViewPort; TagList : pTagItem);
+PROCEDURE DoCDrawMethodTagList(Hook : pHook; a1arg : pRastPort; TagList : pTagItem);
+FUNCTION ExtractColor(a0arg : pRastPort; BitMap : pBitMap; Colour : longword; SrcX : longword; SrcY : longword; Width : longword; Height : longword) : longword;
+FUNCTION FillPixelArray(a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD; ARGB : longword) : longword;
+PROCEDURE FreeCModeList(ModeList : pList);
+FUNCTION GetCyberIDAttr(CyberIDAttr : longword; CyberDisplayModeID : longword) : longword;
+FUNCTION GetCyberMapAttr(CyberGfxBitmap : pBitMap; CyberAttrTag : longword) : longword;
+FUNCTION InvertPixelArray(a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD) : longword;
+FUNCTION IsCyberModeID(displayID : longword) : BOOLEAN;
+FUNCTION LockBitMapTagList(BitMap : POINTER; TagList : pTagItem) : POINTER;
+FUNCTION MovePixelArray(SrcX : WORD; SrcY : WORD; a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD) : longword;
+FUNCTION ReadPixelArray(destRect : POINTER; destX : WORD; destY : WORD; destMod : WORD; a1arg : pRastPort; SrcX : WORD; SrcY : WORD; SizeX : WORD; SizeY : WORD; DestFormat : byte) : longword;
+FUNCTION ReadRGBPixel(a1arg : pRastPort; x : WORD; y : WORD) : longword;
+FUNCTION ScalePixelArray(srcRect : POINTER; SrcW : WORD; SrcH : WORD; SrcMod : WORD; a1arg : pRastPort; DestX : WORD; DestY : WORD; DestW : WORD; DestH : WORD; SrcFormat : byte) : LONGINT;
+PROCEDURE UnLockBitMap(Handle : POINTER);
+PROCEDURE UnLockBitMapTagList(Handle : POINTER; TagList : pTagItem);
+FUNCTION WriteLUTPixelArray(srcRect : POINTER; SrcX : WORD; SrcY : WORD; SrcMod : WORD; a1arg : pRastPort; ColorTab : POINTER; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD; CTFormat : byte) : longword;
+FUNCTION WritePixelArray(srcRect : POINTER; SrcX : WORD; SrcY : WORD; SrcMod : WORD; a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD; SrcFormat : byte) : longword;
+FUNCTION WriteRGBPixel(a1arg : pRastPort; x : WORD; y : WORD; argb : longword) : LONGINT;
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AllocCModeListTags(const ModeListTags : Array Of Const) : pList;
+FUNCTION BestCModeIDTags(const BestModeIDTags : Array Of Const) : longword;
+FUNCTION CModeRequestTags(ModeRequest : POINTER; const ModeRequestTags : Array Of Const) : longword;
+PROCEDURE CVideoCtrlTags(ViewPort : pViewPort; const TagList : Array Of Const);
+PROCEDURE DoCDrawMethodTags(Hook : pHook; a1arg : pRastPort; const TagList : Array Of Const);
+FUNCTION LockBitMapTags(BitMap : POINTER; const TagList : Array Of Const) : POINTER;
+PROCEDURE UnLockBitMapTags(Handle : POINTER; const TagList : Array Of Const);
+
+function SHIFT_PIXFMT(fmt : longint) : longint;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitCYBERGRAPHICSLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    CYBERGRAPHICSIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+FUNCTION AllocCModeListTagList(ModeListTags : pTagItem) : pList;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ModeListTags,A1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION BestCModeIDTagList(BestModeIDTags : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	BestModeIDTags,A0
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CModeRequestTagList(ModeRequest : POINTER; ModeRequestTags : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ModeRequest,A0
+	MOVEA.L	ModeRequestTags,A1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE CVideoCtrlTagList(ViewPort : pViewPort; TagList : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ViewPort,A0
+	MOVEA.L	TagList,A1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DoCDrawMethodTagList(Hook : pHook; a1arg : pRastPort; TagList : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Hook,A0
+	MOVEA.L	a1arg,A1
+	MOVEA.L	TagList,A2
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION ExtractColor(a0arg : pRastPort; BitMap : pBitMap; Colour : longword; SrcX : longword; SrcY : longword; Width : longword; Height : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a0arg,A0
+	MOVEA.L	BitMap,A1
+	MOVE.L	Colour,D0
+	MOVE.L	SrcX,D1
+	MOVE.L	SrcY,D2
+	MOVE.L	Width,D3
+	MOVE.L	Height,D4
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-186(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION FillPixelArray(a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD; ARGB : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a1arg,A1
+	MOVE.L	DestX,D0
+	MOVE.L	DestY,D1
+	MOVE.L	SizeX,D2
+	MOVE.L	SizeY,D3
+	MOVE.L	ARGB,D4
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE FreeCModeList(ModeList : pList);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ModeList,A0
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION GetCyberIDAttr(CyberIDAttr : longword; CyberDisplayModeID : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	CyberIDAttr,D0
+	MOVE.L	CyberDisplayModeID,D1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GetCyberMapAttr(CyberGfxBitmap : pBitMap; CyberAttrTag : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	CyberGfxBitmap,A0
+	MOVE.L	CyberAttrTag,D0
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION InvertPixelArray(a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a1arg,A1
+	MOVE.L	DestX,D0
+	MOVE.L	DestY,D1
+	MOVE.L	SizeX,D2
+	MOVE.L	SizeY,D3
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-144(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION IsCyberModeID(displayID : longword) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	displayID,D0
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION LockBitMapTagList(BitMap : POINTER; TagList : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	BitMap,A0
+	MOVEA.L	TagList,A1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MovePixelArray(SrcX : WORD; SrcY : WORD; a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	SrcX,D0
+	MOVE.L	SrcY,D1
+	MOVEA.L	a1arg,A1
+	MOVE.L	DestX,D2
+	MOVE.L	DestY,D3
+	MOVE.L	SizeX,D4
+	MOVE.L	SizeY,D5
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ReadPixelArray(destRect : POINTER; destX : WORD; destY : WORD; destMod : WORD; a1arg : pRastPort; SrcX : WORD; SrcY : WORD; SizeX : WORD; SizeY : WORD; DestFormat : byte) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	destRect,A0
+	MOVE.L	destX,D0
+	MOVE.L	destY,D1
+	MOVE.L	destMod,D2
+	MOVEA.L	a1arg,A1
+	MOVE.L	SrcX,D3
+	MOVE.L	SrcY,D4
+	MOVE.L	SizeX,D5
+	MOVE.L	SizeY,D6
+	MOVE.L	DestFormat,D7
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ReadRGBPixel(a1arg : pRastPort; x : WORD; y : WORD) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a1arg,A1
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ScalePixelArray(srcRect : POINTER; SrcW : WORD; SrcH : WORD; SrcMod : WORD; a1arg : pRastPort; DestX : WORD; DestY : WORD; DestW : WORD; DestH : WORD; SrcFormat : byte) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	srcRect,A0
+	MOVE.L	SrcW,D0
+	MOVE.L	SrcH,D1
+	MOVE.L	SrcMod,D2
+	MOVEA.L	a1arg,A1
+	MOVE.L	DestX,D3
+	MOVE.L	DestY,D4
+	MOVE.L	DestW,D5
+	MOVE.L	DestH,D6
+	MOVE.L	SrcFormat,D7
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE UnLockBitMap(Handle : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Handle,A0
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-174(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE UnLockBitMapTagList(Handle : POINTER; TagList : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Handle,A0
+	MOVEA.L	TagList,A1
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-180(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION WriteLUTPixelArray(srcRect : POINTER; SrcX : WORD; SrcY : WORD; SrcMod : WORD; a1arg : pRastPort; ColorTab : POINTER; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD; CTFormat : byte) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	srcRect,A0
+	MOVE.L	SrcX,D0
+	MOVE.L	SrcY,D1
+	MOVE.L	SrcMod,D2
+	MOVEA.L	a1arg,A1
+	MOVEA.L	ColorTab,A2
+	MOVE.L	DestX,D3
+	MOVE.L	DestY,D4
+	MOVE.L	SizeX,D5
+	MOVE.L	SizeY,D6
+	MOVE.L	CTFormat,D7
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-198(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION WritePixelArray(srcRect : POINTER; SrcX : WORD; SrcY : WORD; SrcMod : WORD; a1arg : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD; SrcFormat : byte) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	srcRect,A0
+	MOVE.L	SrcX,D0
+	MOVE.L	SrcY,D1
+	MOVE.L	SrcMod,D2
+	MOVEA.L	a1arg,A1
+	MOVE.L	DestX,D3
+	MOVE.L	DestY,D4
+	MOVE.L	SizeX,D5
+	MOVE.L	SizeY,D6
+	MOVE.L	SrcFormat,D7
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION WriteRGBPixel(a1arg : pRastPort; x : WORD; y : WORD; argb : longword) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a1arg,A1
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVE.L	argb,D2
+	MOVEA.L	CyberGfxBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AllocCModeListTags(const ModeListTags : Array Of Const) : pList;
+begin
+    AllocCModeListTags := AllocCModeListTagList(readintags(ModeListTags));
+end;
+
+FUNCTION BestCModeIDTags(const BestModeIDTags : Array Of Const) : longword;
+begin
+    BestCModeIDTags := BestCModeIDTagList(readintags(BestModeIDTags));
+end;
+
+FUNCTION CModeRequestTags(ModeRequest : POINTER; const ModeRequestTags : Array Of Const) : longword;
+begin
+    CModeRequestTags := CModeRequestTagList(ModeRequest , readintags(ModeRequestTags));
+end;
+
+PROCEDURE CVideoCtrlTags(ViewPort : pViewPort; const TagList : Array Of Const);
+begin
+    CVideoCtrlTagList(ViewPort , readintags(TagList));
+end;
+
+PROCEDURE DoCDrawMethodTags(Hook : pHook; a1arg : pRastPort; const TagList : Array Of Const);
+begin
+    DoCDrawMethodTagList(Hook , a1arg , readintags(TagList));
+end;
+
+FUNCTION LockBitMapTags(BitMap : POINTER; const TagList : Array Of Const) : POINTER;
+begin
+    LockBitMapTags := LockBitMapTagList(BitMap , readintags(TagList));
+end;
+
+PROCEDURE UnLockBitMapTags(Handle : POINTER; const TagList : Array Of Const);
+begin
+    UnLockBitMapTagList(Handle , readintags(TagList));
+end;
+
+function SHIFT_PIXFMT(fmt : longint) : longint;
+begin
+    SHIFT_PIXFMT:=(ULONG(fmt)) shl 24;
+end;
+
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of cybergraphics.library}
+  {$Info don't forget to use InitCYBERGRAPHICSLibrary in the beginning of your program}
+
+var
+    cybergraphics_exit : Pointer;
+
+procedure ClosecybergraphicsLibrary;
+begin
+    ExitProc := cybergraphics_exit;
+    if CyberGfxBase <> nil then begin
+        CloseLibrary(CyberGfxBase);
+        CyberGfxBase := nil;
+    end;
+end;
+
+procedure InitCYBERGRAPHICSLibrary;
+begin
+    CyberGfxBase := nil;
+    CyberGfxBase := OpenLibrary(CYBERGRAPHICSNAME,LIBVERSION);
+    if CyberGfxBase <> nil then begin
+        cybergraphics_exit := ExitProc;
+        ExitProc := @ClosecybergraphicsLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open cybergraphics.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    CYBERGRAPHICSIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of cybergraphics.library}
+
+var
+    cybergraphics_exit : Pointer;
+
+procedure ClosecybergraphicsLibrary;
+begin
+    ExitProc := cybergraphics_exit;
+    if CyberGfxBase <> nil then begin
+        CloseLibrary(CyberGfxBase);
+        CyberGfxBase := nil;
+    end;
+end;
+
+begin
+    CyberGfxBase := nil;
+    CyberGfxBase := OpenLibrary(CYBERGRAPHICSNAME,LIBVERSION);
+    if CyberGfxBase <> nil then begin
+        cybergraphics_exit := ExitProc;
+        ExitProc := @ClosecybergraphicsLibrary;
+        CYBERGRAPHICSIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open cybergraphics.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    CYBERGRAPHICSIsCompiledHow := 3;
+   {$Warning No autoopening of cybergraphics.library compiled}
+   {$Warning Make sure you open cybergraphics.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT CYBERGRAPHICS *)
+
+{
+  $Log
+}
+
+

+ 790 - 0
packages/extra/amunits/otherlibs/guigfx/units/guigfx.pas

@@ -0,0 +1,790 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for guigfx.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  15 Jan 2003.
+  
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}
+
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT GUIGFX;
+
+INTERFACE
+USES Exec,utility,graphics;
+
+VAR GuiGFXBase : pLibrary;
+
+const
+    GUIGFXNAME : PChar = 'guigfx.library';
+
+
+  {
+        $VER: guigfx.h 17.2 (9.2.2000)
+
+        guigfx.library definitions
+    
+        © 1997-2000 TEK neoscientists
+   }
+
+  {
+    	Tags
+    }
+
+  const
+     GGFX_Dummy = 4567 + TAG_USER;
+  { strictly private  }
+     GGFX_Owner = GGFX_Dummy + 0;
+     GGFX_HSType = GGFX_Dummy + 1;
+     GGFX_DitherMode = GGFX_Dummy + 2;
+     GGFX_DitherAmount = GGFX_Dummy + 3;
+     GGFX_AutoDither = GGFX_Dummy + 4;
+     GGFX_DitherThreshold = GGFX_Dummy + 5;
+     GGFX_AspectX = GGFX_Dummy + 6;
+     GGFX_AspectY = GGFX_Dummy + 7;
+     GGFX_PixelFormat = GGFX_Dummy + 8;
+     GGFX_Palette = GGFX_Dummy + 9;
+     GGFX_PaletteFormat = GGFX_Dummy + 10;
+     GGFX_NumColors = GGFX_Dummy + 11;
+     GGFX_Precision = GGFX_Dummy + 12;
+     GGFX_Weight = GGFX_Dummy + 13;
+     GGFX_Ratio = GGFX_Dummy + 14;
+     GGFX_SourceWidth = GGFX_Dummy + 15;
+     GGFX_SourceHeight = GGFX_Dummy + 16;
+     GGFX_SourceX = GGFX_Dummy + 17;
+     GGFX_SourceY = GGFX_Dummy + 18;
+     GGFX_DestWidth = GGFX_Dummy + 19;
+     GGFX_DestHeight = GGFX_Dummy + 20;
+     GGFX_DestX = GGFX_Dummy + 21;
+     GGFX_DestY = GGFX_Dummy + 22;
+     GGFX_CallBackHook = GGFX_Dummy + 23;
+     GGFX_ErrorCode = GGFX_Dummy + 24;
+     GGFX_MaxAllocPens = GGFX_Dummy + 25;
+     GGFX_BufferSize = GGFX_Dummy + 26;
+     GGFX_AlphaPresent = GGFX_Dummy + 27;
+     GGFX_Independent = GGFX_Dummy + 28;
+     GGFX_ModeID = GGFX_Dummy + 29;
+     GGFX_PenTable = GGFX_Dummy + 30;
+  { obsolete  }
+     GGFX_License = GGFX_Dummy + 31;
+     GGFX_BGColor = GGFX_Dummy + 32;
+     GGFX_UseMask = GGFX_Dummy + 33;
+     GGFX_RastLock = GGFX_Dummy + 34;
+     GGFX_FormatName = GGFX_Dummy + 35;
+  {
+    	Picture Attributes
+    }
+     PICATTR_Dummy = 123 + TAG_USER;
+     PICATTR_Width = PICATTR_Dummy + 0;
+     PICATTR_Height = PICATTR_Dummy + 1;
+     PICATTR_RawData = PICATTR_Dummy + 2;
+     PICATTR_PixelFormat = PICATTR_Dummy + 3;
+     PICATTR_AspectX = PICATTR_Dummy + 4;
+     PICATTR_AspectY = PICATTR_Dummy + 5;
+     PICATTR_AlphaPresent = PICATTR_Dummy + 6;
+  {
+    	Picture Methods
+    }
+     PICMTHD_CROP = 1;
+     PICMTHD_RENDER = 2;
+     PICMTHD_SCALE = 3;
+     PICMTHD_MIX = 4;
+     PICMTHD_SETALPHA = 5;
+     PICMTHD_MIXALPHA = 6;
+     PICMTHD_MAPDRAWHANDLE = 7;
+     PICMTHD_CREATEALPHAMASK = 8;
+     PICMTHD_TINT = 9;
+     PICMTHD_TEXTURE = 10;
+     PICMTHD_SET = 11;
+     PICMTHD_TINTALPHA = 12;
+     PICMTHD_INSERT = 13;
+     PICMTHD_FLIPX = 14;
+     PICMTHD_FLIPY = 15;
+     PICMTHD_CHECKAUTODITHER = 16;
+     PICMTHD_NEGATIVE = 17;
+     PICMTHD_AUTOCROP = 18;
+     PICMTHD_CONVOLVE = 19;
+  {
+    	hook message types
+    }
+     GGFX_MSGTYPE_LINEDRAWN = 1;
+  {
+    	picture locking
+    }
+     LOCKMODE_DRAWHANDLE = 1;
+     LOCKMODE_FORCE = 1 shl 8;
+     LOCKMODE_MASK = $ff;
+
+  {
+    	bitmap attributes
+    	(strictly internal)
+    }
+
+  const
+     BMAPATTR_Width = 0 + TAG_USER;
+     BMAPATTR_Height = 1 + TAG_USER;
+     BMAPATTR_Depth = 2 + TAG_USER;
+     BMAPATTR_CyberGFX = 3 + TAG_USER;
+     BMAPATTR_BitMapFormat = 4 + TAG_USER;
+     BMAPATTR_PixelFormat = 5 + TAG_USER;
+     BMAPATTR_Flags = 6 + TAG_USER;
+
+
+FUNCTION AddPaletteA(psm : POINTER; palette : POINTER; tags : pTagItem) : POINTER;
+FUNCTION AddPictureA(psm : POINTER; pic : POINTER; tags : pTagItem) : POINTER;
+FUNCTION AddPixelArrayA(psm : POINTER; _array : POINTER; width : WORD; height : WORD; tags : pTagItem) : POINTER;
+FUNCTION ClonePictureA(pic : POINTER; tags : pTagItem) : POINTER;
+FUNCTION CreateDirectDrawHandleA(drawhandle : POINTER; sw : WORD; sh : WORD; dw : WORD; dh : WORD; tags : pTagItem) : POINTER;
+FUNCTION CreatePenShareMapA(tags : pTagItem) : POINTER;
+FUNCTION CreatePictureBitMapA(drawhandle : POINTER; pic : POINTER; tags : pTagItem) : pBitMap;
+FUNCTION CreatePictureMaskA(pic : POINTER; mask : pCHAR; maskwidth : WORD; tags : pTagItem) : BOOLEAN;
+PROCEDURE DeleteDirectDrawHandle(ddh : POINTER);
+PROCEDURE DeletePenShareMap(psm : POINTER);
+PROCEDURE DeletePicture(pic : POINTER);
+FUNCTION DirectDrawTrueColorA(ddh : POINTER; _array : pULONG; x : WORD; y : WORD; tags : pTagItem) : BOOLEAN;
+FUNCTION DoPictureMethodA(pic : POINTER; method : longword; arguments : pULONG) : longword;
+FUNCTION DrawPictureA(drawhandle : POINTER; pic : POINTER; x : WORD; y : WORD; tags : pTagItem) : BOOLEAN;
+FUNCTION GetPictureAttrsA(pic : POINTER; tags : pTagItem) : longword;
+FUNCTION IsPictureA(filename : pCHAR; tags : pTagItem) : BOOLEAN;
+FUNCTION LoadPictureA(filename : pCHAR; tags : pTagItem) : POINTER;
+FUNCTION LockPictureA(pic : POINTER; mode : longword; args : pULONG) : longword;
+FUNCTION MakePictureA(_array : POINTER; width : WORD; height : WORD; tags : pTagItem) : POINTER;
+FUNCTION MapPaletteA(drawhandle : POINTER; palette : POINTER; pentab : pCHAR; tags : pTagItem) : BOOLEAN;
+FUNCTION MapPenA(drawhandle : POINTER; rgb : longword; tags : pTagItem) : LONGINT;
+FUNCTION ObtainDrawHandleA(psm : POINTER; a1arg : pRastPort; cm : pColorMap; tags : pTagItem) : POINTER;
+FUNCTION ReadPictureA(a0arg : pRastPort; colormap : pColorMap; x : WORD; y : WORD; width : WORD; height : WORD; tags : pTagItem) : POINTER;
+PROCEDURE ReleaseDrawHandle(drawhandle : POINTER);
+PROCEDURE RemColorHandle(colorhandle : POINTER);
+PROCEDURE UnLockPicture(pic : POINTER; mode : longword);
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AddPalette(psm : POINTER; palette : POINTER; const tags : Array Of Const) : POINTER;
+FUNCTION AddPicture(psm : POINTER; pic : POINTER; const tags : Array Of Const) : POINTER;
+FUNCTION AddPixelArray(psm : POINTER; _array : POINTER; width : WORD; height : WORD; const tags : Array Of Const) : POINTER;
+FUNCTION ClonePicture(pic : POINTER; const tags : Array Of Const) : POINTER;
+FUNCTION CreateDirectDrawHandle(drawhandle : POINTER; sw : WORD; sh : WORD; dw : WORD; dh : WORD; const tags : Array Of Const) : POINTER;
+FUNCTION CreatePenShareMap(const tags : Array Of Const) : POINTER;
+FUNCTION CreatePictureBitMap(drawhandle : POINTER; pic : POINTER; const tags : Array Of Const) : pBitMap;
+FUNCTION CreatePictureMask(pic : POINTER; mask : pCHAR; maskwidth : WORD; const tags : Array Of Const) : BOOLEAN;
+FUNCTION DirectDrawTrueColor(ddh : POINTER; _array : pULONG; x : WORD; y : WORD; const tags : Array Of Const) : BOOLEAN;
+FUNCTION DoPictureMethod(pic : POINTER; method : longword; const arguments : Array Of Const) : longword;
+FUNCTION DrawPicture(drawhandle : POINTER; pic : POINTER; x : WORD; y : WORD; const tags : Array Of Const) : BOOLEAN;
+FUNCTION GetPictureAttrs(pic : POINTER; const tags : Array Of Const) : longword;
+FUNCTION IsPicture(filename : pCHAR; const tags : Array Of Const) : BOOLEAN;
+FUNCTION LoadPicture(filename : pCHAR; const tags : Array Of Const) : POINTER;
+FUNCTION LockPicture(pic : POINTER; mode : longword; const args : Array Of Const) : longword;
+FUNCTION MakePicture(_array : POINTER; width : WORD; height : WORD; const tags : Array Of Const) : POINTER;
+FUNCTION MapPalette(drawhandle : POINTER; palette : POINTER; pentab : pCHAR; const tags : Array Of Const) : BOOLEAN;
+FUNCTION MapPen(drawhandle : POINTER; rgb : longword; const tags : Array Of Const) : LONGINT;
+FUNCTION ObtainDrawHandle(psm : POINTER; a1arg : pRastPort; cm : pColorMap; const tags : Array Of Const) : POINTER;
+FUNCTION ReadPicture(a0arg : pRastPort; colormap : pColorMap; x : WORD; y : WORD; width : WORD; height : WORD; const tags : Array Of Const) : POINTER;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitGUIGFXLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    GUIGFXIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray,longarray;
+
+FUNCTION AddPaletteA(psm : POINTER; palette : POINTER; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	psm,A0
+	MOVEA.L	palette,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AddPictureA(psm : POINTER; pic : POINTER; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	psm,A0
+	MOVEA.L	pic,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AddPixelArrayA(psm : POINTER; _array : POINTER; width : WORD; height : WORD; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	psm,A0
+	MOVEA.L	_array,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ClonePictureA(pic : POINTER; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreateDirectDrawHandleA(drawhandle : POINTER; sw : WORD; sh : WORD; dw : WORD; dh : WORD; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	drawhandle,A0
+	MOVE.L	sw,D0
+	MOVE.L	sh,D1
+	MOVE.L	dw,D2
+	MOVE.L	dh,D3
+	MOVEA.L	tags,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreatePenShareMapA(tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tags,A0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreatePictureBitMapA(drawhandle : POINTER; pic : POINTER; tags : pTagItem) : pBitMap;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	drawhandle,A0
+	MOVEA.L	pic,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreatePictureMaskA(pic : POINTER; mask : pCHAR; maskwidth : WORD; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVEA.L	mask,A1
+	MOVE.L	maskwidth,D0
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-186(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+PROCEDURE DeleteDirectDrawHandle(ddh : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ddh,A0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-174(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DeletePenShareMap(psm : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	psm,A0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DeletePicture(pic : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION DirectDrawTrueColorA(ddh : POINTER; _array : pULONG; x : WORD; y : WORD; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ddh,A0
+	MOVEA.L	_array,A1
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-180(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION DoPictureMethodA(pic : POINTER; method : longword; arguments : pULONG) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVE.L	method,D0
+	MOVEA.L	arguments,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-138(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION DrawPictureA(drawhandle : POINTER; pic : POINTER; x : WORD; y : WORD; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	drawhandle,A0
+	MOVEA.L	pic,A1
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION GetPictureAttrsA(pic : POINTER; tags : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-144(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION IsPictureA(filename : pCHAR; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	filename,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION LoadPictureA(filename : pCHAR; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	filename,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION LockPictureA(pic : POINTER; mode : longword; args : pULONG) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVE.L	mode,D0
+	MOVEA.L	args,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MakePictureA(_array : POINTER; width : WORD; height : WORD; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	_array,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	tags,A1
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MapPaletteA(drawhandle : POINTER; palette : POINTER; pentab : pCHAR; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	drawhandle,A0
+	MOVEA.L	palette,A1
+	MOVEA.L	pentab,A2
+	MOVEA.L	tags,A3
+	MOVEA.L	GuiGFXBase,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 MapPenA(drawhandle : POINTER; rgb : longword; tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	drawhandle,A0
+	MOVEA.L	rgb,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ObtainDrawHandleA(psm : POINTER; a1arg : pRastPort; cm : pColorMap; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	psm,A0
+	MOVEA.L	a1arg,A1
+	MOVEA.L	cm,A2
+	MOVEA.L	tags,A3
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ReadPictureA(a0arg : pRastPort; colormap : pColorMap; x : WORD; y : WORD; width : WORD; height : WORD; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	a0arg,A0
+	MOVEA.L	colormap,A1
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVE.L	width,D2
+	MOVE.L	height,D3
+	MOVEA.L	tags,A2
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE ReleaseDrawHandle(drawhandle : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	drawhandle,A0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE RemColorHandle(colorhandle : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	colorhandle,A0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE UnLockPicture(pic : POINTER; mode : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pic,A0
+	MOVE.L	mode,D0
+	MOVEA.L	GuiGFXBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AddPalette(psm : POINTER; palette : POINTER; const tags : Array Of Const) : POINTER;
+begin
+    AddPalette := AddPaletteA(psm , palette , readintags(tags));
+end;
+
+FUNCTION AddPicture(psm : POINTER; pic : POINTER; const tags : Array Of Const) : POINTER;
+begin
+    AddPicture := AddPictureA(psm , pic , readintags(tags));
+end;
+
+FUNCTION AddPixelArray(psm : POINTER; _array : POINTER; width : WORD; height : WORD; const tags : Array Of Const) : POINTER;
+begin
+    AddPixelArray := AddPixelArrayA(psm , _array , width , height , readintags(tags));
+end;
+
+FUNCTION ClonePicture(pic : POINTER; const tags : Array Of Const) : POINTER;
+begin
+    ClonePicture := ClonePictureA(pic , readintags(tags));
+end;
+
+FUNCTION CreateDirectDrawHandle(drawhandle : POINTER; sw : WORD; sh : WORD; dw : WORD; dh : WORD; const tags : Array Of Const) : POINTER;
+begin
+    CreateDirectDrawHandle := CreateDirectDrawHandleA(drawhandle , sw , sh , dw , dh , readintags(tags));
+end;
+
+FUNCTION CreatePenShareMap(const tags : Array Of Const) : POINTER;
+begin
+    CreatePenShareMap := CreatePenShareMapA(readintags(tags));
+end;
+
+FUNCTION CreatePictureBitMap(drawhandle : POINTER; pic : POINTER; const tags : Array Of Const) : pBitMap;
+begin
+    CreatePictureBitMap := CreatePictureBitMapA(drawhandle , pic , readintags(tags));
+end;
+
+FUNCTION CreatePictureMask(pic : POINTER; mask : pCHAR; maskwidth : WORD; const tags : Array Of Const) : BOOLEAN;
+begin
+    CreatePictureMask := CreatePictureMaskA(pic , mask , maskwidth , readintags(tags));
+end;
+
+FUNCTION DirectDrawTrueColor(ddh : POINTER; _array : pULONG; x : WORD; y : WORD; const tags : Array Of Const) : BOOLEAN;
+begin
+    DirectDrawTrueColor := DirectDrawTrueColorA(ddh , _array , x , y , readintags(tags));
+end;
+
+FUNCTION DoPictureMethod(pic : POINTER; method : longword; const arguments : Array Of Const) : longword;
+begin
+    DoPictureMethod := DoPictureMethodA(pic , method , readinlongs(arguments));
+end;
+
+FUNCTION DrawPicture(drawhandle : POINTER; pic : POINTER; x : WORD; y : WORD; const tags : Array Of Const) : BOOLEAN;
+begin
+    DrawPicture := DrawPictureA(drawhandle , pic , x , y , readintags(tags));
+end;
+
+FUNCTION GetPictureAttrs(pic : POINTER; const tags : Array Of Const) : longword;
+begin
+    GetPictureAttrs := GetPictureAttrsA(pic , readintags(tags));
+end;
+
+FUNCTION IsPicture(filename : pCHAR; const tags : Array Of Const) : BOOLEAN;
+begin
+    IsPicture := IsPictureA(filename , readintags(tags));
+end;
+
+FUNCTION LoadPicture(filename : pCHAR; const tags : Array Of Const) : POINTER;
+begin
+    LoadPicture := LoadPictureA(filename , readintags(tags));
+end;
+
+FUNCTION LockPicture(pic : POINTER; mode : longword; const args : Array Of Const) : longword;
+begin
+    LockPicture := LockPictureA(pic , mode , readinlongs(args));
+end;
+
+FUNCTION MakePicture(_array : POINTER; width : WORD; height : WORD; const tags : Array Of Const) : POINTER;
+begin
+    MakePicture := MakePictureA(_array , width , height , readintags(tags));
+end;
+
+FUNCTION MapPalette(drawhandle : POINTER; palette : POINTER; pentab : pCHAR; const tags : Array Of Const) : BOOLEAN;
+begin
+    MapPalette := MapPaletteA(drawhandle , palette , pentab , readintags(tags));
+end;
+
+FUNCTION MapPen(drawhandle : POINTER; rgb : longword; const tags : Array Of Const) : LONGINT;
+begin
+    MapPen := MapPenA(drawhandle , rgb , readintags(tags));
+end;
+
+FUNCTION ObtainDrawHandle(psm : POINTER; a1arg : pRastPort; cm : pColorMap; const tags : Array Of Const) : POINTER;
+begin
+    ObtainDrawHandle := ObtainDrawHandleA(psm , a1arg , cm , readintags(tags));
+end;
+
+FUNCTION ReadPicture(a0arg : pRastPort; colormap : pColorMap; x : WORD; y : WORD; width : WORD; height : WORD; const tags : Array Of Const) : POINTER;
+begin
+    ReadPicture := ReadPictureA(a0arg , colormap , x , y , width , height , readintags(tags));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of guigfx.library}
+  {$Info don't forget to use InitGUIGFXLibrary in the beginning of your program}
+
+var
+    guigfx_exit : Pointer;
+
+procedure CloseguigfxLibrary;
+begin
+    ExitProc := guigfx_exit;
+    if GuiGFXBase <> nil then begin
+        CloseLibrary(GuiGFXBase);
+        GuiGFXBase := nil;
+    end;
+end;
+
+procedure InitGUIGFXLibrary;
+begin
+    GuiGFXBase := nil;
+    GuiGFXBase := OpenLibrary(GUIGFXNAME,LIBVERSION);
+    if GuiGFXBase <> nil then begin
+        guigfx_exit := ExitProc;
+        ExitProc := @CloseguigfxLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open guigfx.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    GUIGFXIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of guigfx.library}
+
+var
+    guigfx_exit : Pointer;
+
+procedure CloseguigfxLibrary;
+begin
+    ExitProc := guigfx_exit;
+    if GuiGFXBase <> nil then begin
+        CloseLibrary(GuiGFXBase);
+        GuiGFXBase := nil;
+    end;
+end;
+
+begin
+    GuiGFXBase := nil;
+    GuiGFXBase := OpenLibrary(GUIGFXNAME,LIBVERSION);
+    if GuiGFXBase <> nil then begin
+        guigfx_exit := ExitProc;
+        ExitProc := @CloseguigfxLibrary;
+        GUIGFXIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open guigfx.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    GUIGFXIsCompiledHow := 3;
+   {$Warning No autoopening of guigfx.library compiled}
+   {$Warning Make sure you open guigfx.library yourself}
+{$endif dont_use_openlib}
+
+END. (* UNIT GUIGFX *)
+
+{
+  $Log
+}
+
+

+ 375 - 0
packages/extra/amunits/otherlibs/lucyplay/units/lucyplay.pas

@@ -0,0 +1,375 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for lucyplay.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this library.
+  16 Jan 2003.
+
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}
+
+
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT LUCYPLAY;
+
+INTERFACE
+USES Exec;
+
+VAR LucyPlayBase : pLibrary;
+
+const
+    LUCYPLAYNAME : PChar = 'lucyplay.library';
+
+  type
+
+     PLucyPlaySample = ^tLucyPlaySample;
+     tLucyPlaySample = record
+          SampleRate : ULONG;        {  sample frequency                 }
+          Size : ULONG;              {  sample size (in bytes)           }
+          _Type : ULONG;             {  AHI type (mono/stereo, 8/16bit)  }
+          SampleData : pointer;      {  pointer to the sample data       }
+       end;
+
+     PLucyPlayJoystick = ^tLucyPlayJoystick;
+     tLucyPlayJoystick = record
+          Up : UBYTE;        {  0 means FALSE,  1 means TRUE     }
+          Down : UBYTE;      {  if (Up == 1) Down = 0;           }
+          Left : UBYTE;      {  Don't forget to check for        }
+          Right : UBYTE;     {   Up/Down + Left/Right combos!    }
+          Red : UBYTE;       {  Standard fire button             }
+          Blue : UBYTE;      {  for 2-button sticks/pads         }
+          Green : UBYTE;     {  for CD32 compatible pads only    }
+          Yellow : UBYTE;    {  for CD32 compatible pads only    }
+	  Reverse : UBYTE;   {  for CD32 compatible pads only    }
+          Forward : UBYTE;   {  for CD32 compatible pads only    }
+          Play : UBYTE;      {  for CD32 compatible pads only    }
+          Error : UBYTE;     {  hope this is always FALSE ;)     }
+       end;
+
+  const
+     INVALID_ID =  not (0);
+
+  const
+     LUC_JOY_RIGHT = 1;
+     LUC_JOY_LEFT = 2;
+     LUC_JOY_DOWN = 4;
+     LUC_JOY_UP = 8;
+     LUC_JOY_PLAY = 16;
+     LUC_JOY_REVERSE = 32;
+     LUC_JOY_FORWARD = 64;
+     LUC_JOY_GREEN = 128;
+     LUC_JOY_YELLOW = 256;
+     LUC_JOY_RED = 512;
+     LUC_JOY_BLUE = 1024;
+     LUC_ERR_ALLOCMEM = 1;
+     LUC_ERR_CREATEIOREQUEST = 2;
+     LUC_ERR_CREATEMSGPORT = 3;
+     LUC_ERR_FILETYPE = 4;
+     LUC_ERR_INTERNAL = 5;
+     LUC_ERR_OPENDEVICE = 6;
+     LUC_ERR_OPENFILE = 7;
+     LUC_ERR_OPENLIBRARY = 8;
+     LUC_ERR_READJOYPORT = 9;
+     LUC_ERR_DOIO = 10;
+
+
+
+
+PROCEDURE lucAudioFree(smp : pLucyPlaySample);
+FUNCTION lucAudioInit : LONGINT;
+PROCEDURE lucAudioKill;
+FUNCTION lucAudioLoad(fname : pCHAR) : pLucyPlaySample;
+PROCEDURE lucAudioPlay(smp : pLucyPlaySample);
+PROCEDURE lucAudioStop;
+PROCEDURE lucAudioWait;
+FUNCTION lucBestModeID(w : longword; h : longword; d : longword) : longword;
+FUNCTION lucError : longword;
+FUNCTION lucJoyInit : pLucyPlayJoystick;
+FUNCTION lucJoyInitForce : pLucyPlayJoystick;
+PROCEDURE lucJoyKill(joy : pLucyPlayJoystick);
+PROCEDURE lucJoyRead(joy : pLucyPlayJoystick);
+FUNCTION lucJoyReadBool : longword;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitLUCYPLAYLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    LUCYPLAYIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+{$ifndef dont_use_openlib}
+uses msgbox;
+{$endif dont_use_openlib}
+
+PROCEDURE lucAudioFree(smp : pLucyPlaySample);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	smp,A0
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION lucAudioInit : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE lucAudioKill;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION lucAudioLoad(fname : pCHAR) : pLucyPlaySample;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	fname,A0
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE lucAudioPlay(smp : pLucyPlaySample);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	smp,A0
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE lucAudioStop;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE lucAudioWait;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION lucBestModeID(w : longword; h : longword; d : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	w,D0
+	MOVE.L	h,D1
+	MOVE.L	d,D2
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION lucError : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION lucJoyInit : pLucyPlayJoystick;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION lucJoyInitForce : pLucyPlayJoystick;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE lucJoyKill(joy : pLucyPlayJoystick);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	joy,A0
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE lucJoyRead(joy : pLucyPlayJoystick);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	joy,A0
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION lucJoyReadBool : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	LucyPlayBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of lucyplay.library}
+  {$Info don't forget to use InitLUCYPLAYLibrary in the beginning of your program}
+
+var
+    lucyplay_exit : Pointer;
+
+procedure CloselucyplayLibrary;
+begin
+    ExitProc := lucyplay_exit;
+    if LucyPlayBase <> nil then begin
+        CloseLibrary(LucyPlayBase);
+        LucyPlayBase := nil;
+    end;
+end;
+
+procedure InitLUCYPLAYLibrary;
+begin
+    LucyPlayBase := nil;
+    LucyPlayBase := OpenLibrary(LUCYPLAYNAME,LIBVERSION);
+    if LucyPlayBase <> nil then begin
+        lucyplay_exit := ExitProc;
+        ExitProc := @CloselucyplayLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open lucyplay.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    LUCYPLAYIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of lucyplay.library}
+
+var
+    lucyplay_exit : Pointer;
+
+procedure CloselucyplayLibrary;
+begin
+    ExitProc := lucyplay_exit;
+    if LucyPlayBase <> nil then begin
+        CloseLibrary(LucyPlayBase);
+        LucyPlayBase := nil;
+    end;
+end;
+
+begin
+    LucyPlayBase := nil;
+    LucyPlayBase := OpenLibrary(LUCYPLAYNAME,LIBVERSION);
+    if LucyPlayBase <> nil then begin
+        lucyplay_exit := ExitProc;
+        ExitProc := @CloselucyplayLibrary;
+        LUCYPLAYIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open lucyplay.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    LUCYPLAYIsCompiledHow := 3;
+   {$Warning No autoopening of lucyplay.library compiled}
+   {$Warning Make sure you open lucyplay.library yourself}
+{$endif dont_use_openlib}
+
+END. (* UNIT LUCYPLAY *)
+
+{
+  $Log
+}
+
+

+ 4328 - 0
packages/extra/amunits/otherlibs/mui/units/mui.pas

@@ -0,0 +1,4328 @@
+
+{
+    This file is part of the Free Pascal run time library.
+
+    A file in Amiga system run time library.
+    Copyright (c) 2000-2003 by Nils Sjoholm
+    member of the Amiga RTL development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{
+    History:
+
+    Added MessageBox for error report.
+    31 Jul 2000.
+
+    Added the defines use_amiga_smartlink and
+    use_auto_openlib. Implemented autoopening
+    of the library.
+    15 Jan 2003.
+    
+    Changed integer > smallint.
+    Changed cardinal > longword.
+    Changed startcode for unit.
+    12 Feb 2003.
+     
+    [email protected]
+}
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+    {$smartlink on}
+{$endif use_amiga_smartlink}
+
+unit mui;
+
+interface
+
+  {                                                                          
+    
+     MUI - MagicUserInterface
+     (c) 1993-1997 Stefan Stuntz
+    
+     Main Header File
+    
+                                                                              
+     Class Tree
+                                                                              
+    
+     rootclass                    (BOOPSI's base class)
+     +--Notify                   (implements notification mechanism)
+     !  +--Family                (handles multiple children)
+     !  !  +--Menustrip          (describes a complete menu strip)
+     !  !  +--Menu               (describes a single menu)
+     !  !  \--Menuitem           (describes a single menu item)
+     !  +--Application           (main class for all applications)
+     !  +--Window                (main class for all windows)
+     !  !  \--Aboutmui           (About window of MUI preferences)
+     !  +--Area                  (base class for all GUI elements)
+     !     +--Rectangle          (spacing object)
+     !     +--Balance            (balancing separator bar)
+     !     +--Image              (image display)
+     !     +--Bitmap             (draws bitmaps)
+     !     !  \--Bodychunk       (makes bitmap from ILBM body chunk)
+     !     +--Text               (text display)
+     !     +--Gadget             (base class for intuition gadgets)
+     !     !  +--String          (string gadget)
+     !     !  +--Boopsi          (interface to BOOPSI gadgets)
+     !     !  \--Prop            (proportional gadget)
+     !     +--Gauge              (fule gauge)
+     !     +--Scale              (percentage scale)
+     !     +--Colorfield         (field with changeable color)
+     !     +--List               (line-oriented list)
+     !     !  +--Floattext       (special list with floating text)
+     !     !  +--Volumelist      (special list with volumes)
+     !     !  +--Scrmodelist     (special list with screen modes)
+     !     !  \--Dirlist         (special list with files)
+     !     +--Numeric            (base class for slider gadgets)
+     !     !  +--Knob            (turning knob)
+     !     !  +--Levelmeter      (level display)
+     !     !  +--Numericbutton   (space saving popup slider)
+     !     !  \--Slider          (traditional slider)
+     !     +--Framedisplay       (private)
+     !     !  \--Popframe        (private)
+     !     +--Imagedisplay       (private)
+     !     !  \--Popimage        (private)
+     !     +--Pendisplay         (displays a pen specification)
+     !     !  \--Poppen          (popup button to adjust a pen spec)
+     !     +--Group              (groups other GUI elements)
+     !        +--Mccprefs        (private)
+     !        +--Register        (handles page groups with titles)
+     !        !  \--Penadjust    (group to adjust a pen)
+     !        +--Settingsgroup   (private)
+     !        +--Settings        (private)
+     !        +--Frameadjust     (private)
+     !        +--Imageadjust     (private)
+     !        +--Virtgroup       (handles virtual groups)
+     !        +--Scrollgroup     (virtual groups with scrollbars)
+     !        +--Scrollbar       (traditional scrollbar)
+     !        +--Listview        (listview)
+     !        +--Radio           (radio button)
+     !        +--Cycle           (cycle gadget)
+     !        +--Coloradjust     (several gadgets to adjust a color)
+     !        +--Palette         (complete palette gadget)
+     !        +--Popstring       (base class for popup objects)
+     !           +--Popobject    (popup aynthing in a separate window)
+     !           !  +--Poplist   (popup a simple listview)
+     !           !  \--Popscreen (popup a list of public screens)
+     !           \--Popasl       (popup an asl requester)
+     +--Semaphore                (semaphore equipped objects)
+        +--Applist               (private)
+        +--Dataspace             (handles general purpose data spaces)
+           \--Configdata         (private)
+    
+                                                                              
+     General Header File Information
+                                                                              
+    
+     All macro and structure definitions follow these rules:
+    
+     Name                       Meaning
+    
+     MUIC_<class>               Name of a class
+     MUIM_<class>_<method>      Method
+     MUIP_<class>_<method>      Methods parameter structure
+     MUIV_<class>_<method>_<x>  Special method value
+     MUIA_<class>_<attrib>      Attribute
+     MUIV_<class>_<attrib>_<x>  Special attribute value
+     MUIE_<error>               Error return code from MUI_Error()
+     MUII_<name>                Standard MUI image
+     MUIX_<code>                Control codes for text strings
+     MUIO_<name>                Object type for MUI_MakeObject()
+    
+     MUIA_... attribute definitions are followed by a comment
+     consisting of the three possible letters I, S and G.
+     I: it's possible to specify this attribute at object creation time.
+     S: it's possible to change this attribute with SetAttrs().
+     G: it's possible to get this attribute with GetAttr().
+    
+     Items marked with "Custom Class" are for use in custom classes only!
+   }
+
+uses exec, intuition,utility,graphics,iffparse;
+
+
+  const
+     MUIMASTER_NAME  : PChar = 'muimaster.library';
+     MUIMASTER_VMIN = 11;
+     MUIMASTER_VLATEST = 19;
+  {
+     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+     Warning, some of the macros in this header file work only with
+     muimaster.library V11 and above. If you recompile your programs,
+     be sure to open muimaster.library with MUIMASTER_VMIN as version number.
+     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   }
+ 
+  {                                                                        
+     Config items for MUIM_GetConfigItem
+                                                                           }
+     MUICFG_PublicScreen = 36;
+  {                                                                        
+     Black box specification structures for images, pens, frames
+                                                                           }
+
+  type
+     plongword = ^longword;
+
+     tMUI_PenSpec = record
+          buf : array[0..31] of char;
+       end;
+     pMUI_PenSpec = ^tMUI_PenSpec;
+     
+  {                                                                        
+     Public Screen Stuff
+                                                                           }
+  {
+     NOTE: This stuff is only included to allow compilation of the supplied
+           public screen manager for educational purposes. Everything
+           here is subject to change without notice and I guarantee to
+           do that just for fun!
+           More info can be found in the screen manager source file.
+   }
+
+  const
+     PSD_INITIAL_NAME : PChar = '(unnamed)';
+     PSD_INITIAL_TITLE : PChar = 'MUI Public Screen';
+
+
+
+  const
+     PSD_NAME_FRONTMOST : PChar = '«Frontmost»';
+     PSD_FILENAME_SAVE : PChar = 'envarc:mui/PublicScreens.iff';
+     PSD_FILENAME_USE : PChar = 'env:mui/PublicScreens.iff';
+     PSD_MAXLEN_NAME = 32;
+     PSD_MAXLEN_TITLE = 128;
+     PSD_MAXLEN_FONT = 48;
+     PSD_MAXLEN_BACKGROUND = 256;
+     PSD_NUMCOLS = 8;
+     PSD_MAXSYSPENS = 20;
+     PSD_NUMSYSPENS = 12;
+     PSD_MAXMUIPENS = 10;
+     PSD_NUMMUIPENS = 8;
+
+  type
+     tMUI_RGBcolor = record
+          red : ULONG;
+          green : ULONG;
+          blue : ULONG;
+       end;
+     
+     pMUI_RGBColor = ^tMUI_RGBColor;
+
+     tMUI_PubScreenDesc = record
+          Version : LONG;
+          Name : array[0..(PSD_MAXLEN_NAME)-1] of char;
+          Title : array[0..(PSD_MAXLEN_TITLE)-1] of char;
+          Font : array[0..(PSD_MAXLEN_FONT)-1] of char;
+          Background : array[0..(PSD_MAXLEN_BACKGROUND)-1] of char;
+          DisplayID : ULONG;
+          DisplayWidth : WORD;
+          DisplayHeight : WORD;
+          DisplayDepth : BYTE;
+          OverscanType : BYTE;
+          AutoScroll : BYTE;
+          NoDrag : BYTE;
+          Exclusive : BYTE;
+          Interleaved : BYTE;
+          SysDefault : BYTE;
+          Behind : BYTE;
+          AutoClose : BYTE;
+          CloseGadget : BYTE;
+          DummyWasForeign : BYTE;
+          SystemPens : array[0..(PSD_MAXSYSPENS)-1] of BYTE;
+          Reserved : array[0..((1 + (7 * 4)) - PSD_MAXSYSPENS)-1] of BYTE;
+          Palette : array[0..(PSD_NUMCOLS)-1] of tMUI_RGBcolor;
+          rsvd : array[0..(PSD_MAXSYSPENS - PSD_NUMCOLS)-1] of tMUI_RGBcolor;
+          rsvd2 : array[0..(PSD_MAXMUIPENS)-1] of tMUI_PenSpec;
+          Changed : LONG;
+          UserData : APTR;
+       end;
+     pMUI_PubScreenDesc = ^tMUI_PubScreenDesc;
+
+     tMUIS_InfoClient = record
+          node : tMinNode;
+          task : PTask;
+          sigbit : ULONG;
+       end;
+     pMUIS_InfoClient = ^tMUIS_InfoClient;
+
+  {                                                                          
+     Object Types for MUI_MakeObject()
+                                                                             }
+  { STRPTR label, ULONG flags  }
+
+  const
+
+     MUIO_Label = 1;
+  { STRPTR label  }
+     MUIO_Button = 2;
+  { STRPTR label  }
+     MUIO_Checkmark = 3;
+  { STRPTR label, STRPTR  entries  }
+     MUIO_Cycle = 4;
+  { STRPTR label, STRPTR  entries  }
+     MUIO_Radio = 5;
+  { STRPTR label, LONG min, LONG max  }
+     MUIO_Slider = 6;
+  { STRPTR label, LONG maxlen  }
+     MUIO_String = 7;
+  { STRPTR imagespec  }
+     MUIO_PopButton = 8;
+  { LONG space    }
+     MUIO_HSpace = 9;
+  { LONG space    }
+     MUIO_VSpace = 10;
+  { LONG space    }
+     MUIO_HBar = 11;
+  { LONG space    }
+     MUIO_VBar = 12;
+  { struct NewMenu  nm, ULONG flags  }
+     MUIO_MenustripNM = 13;
+  { STRPTR label, STRPTR shortcut, ULONG flags, ULONG data   }
+     MUIO_Menuitem = 14;
+  { STRPTR label  }
+     MUIO_BarTitle = 15;
+  { STRPTR label, LONG min, LONG max, STRPTR format  }
+     MUIO_NumericButton = 16;
+     MUIO_Menuitem_CopyStrings = 1 shl 30;
+     MUIO_Label_SingleFrame = 1 shl 8;
+     MUIO_Label_DoubleFrame = 1 shl 9;
+     MUIO_Label_LeftAligned = 1 shl 10;
+     MUIO_Label_Centered = 1 shl 11;
+     MUIO_Label_FreeVert = 1 shl 12;
+  { check for "localized" menu items such as "O\0Open"  }
+     MUIO_MenustripNM_CommandKeyCheck = 1 shl 0;
+  {                                                                          
+     ARexx Interface
+                                                                             }
+
+  type
+     tMUI_Command = record
+          mc_Name : Pchar;
+          mc_Template : Pchar;
+          mc_Parameters : LONG;
+          mc_Hook : PHook;
+          mc_Reserved : array[0..4] of LONG;
+       end;
+     pMUI_Command = ^tMUI_Command;
+
+
+
+    const
+     {  MC_TEMPLATE_ID : PCHar = not(0); }
+       MC_TEMPLATE_ID  = -1;
+       MUI_RXERR_BADDEFINITION = -(1);
+       MUI_RXERR_OUTOFMEMORY = -(2);
+       MUI_RXERR_UNKNOWNCOMMAND = -(3);
+       MUI_RXERR_BADSYNTAX = -(4);
+    {                                                                          
+       Return values for MUI_Error()
+                                                                               }
+       MUIE_OK = 0;
+       MUIE_OutOfMemory = 1;
+       MUIE_OutOfGfxMemory = 2;
+       MUIE_InvalidWindowObject = 3;
+       MUIE_MissingLibrary = 4;
+       MUIE_NoARexx = 5;
+       MUIE_SingleTask = 6;
+    {                                                                          
+       Standard MUI Images & Backgrounds
+                                                                               }
+    { These images are configured    }
+       MUII_WindowBack = 0;
+    { with the preferences program.  }
+       MUII_RequesterBack = 1;
+       MUII_ButtonBack = 2;
+       MUII_ListBack = 3;
+       MUII_TextBack = 4;
+       MUII_PropBack = 5;
+       MUII_PopupBack = 6;
+       MUII_SelectedBack = 7;
+       MUII_ListCursor = 8;
+       MUII_ListSelect = 9;
+       MUII_ListSelCur = 10;
+       MUII_ArrowUp = 11;
+       MUII_ArrowDown = 12;
+       MUII_ArrowLeft = 13;
+       MUII_ArrowRight = 14;
+       MUII_CheckMark = 15;
+       MUII_RadioButton = 16;
+       MUII_Cycle = 17;
+       MUII_PopUp = 18;
+       MUII_PopFile = 19;
+       MUII_PopDrawer = 20;
+       MUII_PropKnob = 21;
+       MUII_Drawer = 22;
+       MUII_HardDisk = 23;
+       MUII_Disk = 24;
+       MUII_Chip = 25;
+       MUII_Volume = 26;
+       MUII_RegisterBack = 27;
+       MUII_Network = 28;
+       MUII_Assign = 29;
+       MUII_TapePlay = 30;
+       MUII_TapePlayBack = 31;
+       MUII_TapePause = 32;
+       MUII_TapeStop = 33;
+       MUII_TapeRecord = 34;
+       MUII_GroupBack = 35;
+       MUII_SliderBack = 36;
+       MUII_SliderKnob = 37;
+       MUII_TapeUp = 38;
+       MUII_TapeDown = 39;
+       MUII_PageBack = 40;
+       MUII_ReadListBack = 41;
+       MUII_Count = 42;
+    { These are direct color     }
+       MUII_BACKGROUND = 128;
+    { combinations and are not   }
+       MUII_SHADOW = 129;
+    { affected by users prefs.   }
+       MUII_SHINE = 130;
+       MUII_FILL = 131;
+    { Generally, you should      }
+       MUII_SHADOWBACK = 132;
+    { avoid using them. Better   }
+       MUII_SHADOWFILL = 133;
+    { use one of the customized  }
+       MUII_SHADOWSHINE = 134;
+    { images above.              }
+       MUII_FILLBACK = 135;
+       MUII_FILLSHINE = 136;
+       MUII_SHINEBACK = 137;
+       MUII_FILLBACK2 = 138;
+       MUII_HSHINEBACK = 139;
+       MUII_HSHADOWBACK = 140;
+       MUII_HSHINESHINE = 141;
+       MUII_HSHADOWSHADOW = 142;
+       MUII_MARKSHINE = 143;
+       MUII_MARKHALFSHINE = 144;
+       MUII_MARKBACKGROUND = 145;
+       MUII_LASTPAT = 145;
+    {                                                                          
+       Special values for some methods
+                                                                               }
+       MUIV_TriggerValue = $49893131;
+       MUIV_NotTriggerValue = $49893133;
+       MUIV_EveryTime = $49893131;
+       MUIV_Notify_Self = 1;
+       MUIV_Notify_Window = 2;
+       MUIV_Notify_Application = 3;
+       MUIV_Notify_Parent = 4;
+ 
+
+    const
+       MUIV_Application_ReturnID_Quit = -(1);
+       MUIV_List_Insert_Top = 0;
+       MUIV_List_Insert_Active = -(1);
+       MUIV_List_Insert_Sorted = -(2);
+       MUIV_List_Insert_Bottom = -(3);
+       MUIV_List_Remove_First = 0;
+       MUIV_List_Remove_Active = -(1);
+       MUIV_List_Remove_Last = -(2);
+       MUIV_List_Remove_Selected = -(3);
+       MUIV_List_Select_Off = 0;
+       MUIV_List_Select_On = 1;
+       MUIV_List_Select_Toggle = 2;
+       MUIV_List_Select_Ask = 3;
+       MUIV_List_GetEntry_Active = -(1);
+       MUIV_List_Select_Active = -(1);
+       MUIV_List_Select_All = -(2);
+       MUIV_List_Redraw_Active = -(1);
+       MUIV_List_Redraw_All = -(2);
+       MUIV_List_Move_Top = 0;
+       MUIV_List_Move_Active = -(1);
+       MUIV_List_Move_Bottom = -(2);
+    { only valid for second parameter  }
+       MUIV_List_Move_Next = -(3);
+    { only valid for second parameter  }
+       MUIV_List_Move_Previous = -(4);
+       MUIV_List_Exchange_Top = 0;
+       MUIV_List_Exchange_Active = -(1);
+       MUIV_List_Exchange_Bottom = -(2);
+    { only valid for second parameter  }
+       MUIV_List_Exchange_Next = -(3);
+    { only valid for second parameter  }
+       MUIV_List_Exchange_Previous = -(4);
+       MUIV_List_Jump_Top = 0;
+       MUIV_List_Jump_Active = -(1);
+       MUIV_List_Jump_Bottom = -(2);
+       MUIV_List_Jump_Up = -(4);
+       MUIV_List_Jump_Down = -(3);
+       MUIV_List_NextSelected_Start = -(1);
+       MUIV_List_NextSelected_End = -(1);
+       MUIV_DragQuery_Refuse = 0;
+       MUIV_DragQuery_Accept = 1;
+       MUIV_DragReport_Abort = 0;
+       MUIV_DragReport_Continue = 1;
+       MUIV_DragReport_Lock = 2;
+       MUIV_DragReport_Refresh = 3;
+    {                                                                          
+       Control codes for text strings
+                                                                               }
+    { right justified  }
+       MUIX_R : PChar = '\033r';
+    { centered         }
+       MUIX_C : PChar = '\033c';
+    { left justified   }
+       MUIX_L : PChar = '\033l';
+    { normal      }
+       MUIX_N : PChar = '\033n';
+    { bold        }
+       MUIX_B : PChar = '\033b';
+    { italic      }
+       MUIX_I : PChar = '\033i';
+    { underlined  }
+       MUIX_U : PChar = '\033u';
+    { text pen            }
+       MUIX_PT : PChar = '\0332';
+    { highlight text pen  }
+       MUIX_PH : PChar = '\0338';
+    {                                                                          
+       Parameter structures for some classes
+                                                                               }
+
+    type
+       tMUI_Palette_Entry = record
+            mpe_ID : LONG;
+            mpe_Red : ULONG;
+            mpe_Green : ULONG;
+            mpe_Blue : ULONG;
+            mpe_Group : LONG;
+         end;
+       pMUI_Palette_Entry = ^tMUI_Palette_Entry;
+
+    const
+       MUIV_Palette_Entry_End = (-1);
+    {                            }
+    { Application Input Handler  }
+    {                            }
+    { see below  }
+
+    type
+       tMUI_InputHandlerNode = record
+            ihn_Node : tMinNode;
+            ihn_Object : pObject_;
+            ihn_stuff : record
+                case longint of
+                   0 : ( ihn_sigs : ULONG );
+                   1 : ( ihn_timer : record
+                        ihn_millis : WORD;
+                        ihn_current : WORD;
+                     end );
+                end;
+            ihn_Flags : ULONG;
+            ihn_Method : ULONG;
+         end;
+    pMUI_InputHandlerNode = ^tMUI_InputHandlerNode;
+
+    const
+      { ihn_Signals = ihn_stuff.ihn_sigs;
+       ihn_Millis = ihn_stuff.(ihn_timer.ihn_millis);
+       ihn_Current = ihn_stuff.(ihn_timer.ihn_current); }
+    { Flags for ihn_Flags  }
+    { set ihn_Ticks to number of 1/100 sec ticks you want to be triggered  }
+       MUIIHNF_TIMER = 1 shl 0;
+    {                       }
+    { Window Event Handler  }
+    {                       }
+    { don't touch!  }
+    { event handlers are inserted according to their priority.  }
+    { certain flags, see below for definitions.  }
+    { object which should receive MUIM_HandleEvent.  }
+    { if !=NULL, MUIM_HandleEvent is invoked on exactly this class with CoerceMethod().  }
+    { one or more IDCMP flags this handler should react on.  }
+
+    type
+       tMUI_EventHandlerNode = record
+            ehn_Node : tMinNode;
+            ehn_Reserved : BYTE;
+            ehn_Priority : BYTE;
+            ehn_Flags : WORD;
+            ehn_Object : pObject_;
+            ehn_Class : PIClass;
+            ehn_Events : ULONG;
+         end;
+       pMUI_EventHandlerNode = ^tMUI_EventHandlerNode;
+    { flags for ehn_Flags  }
+
+    const
+       MUI_EHF_ALWAYSKEYS = 1 shl 0;
+    { other values reserved for future use  }
+    { return values for MUIM_HandleEvent (bit-masked, all other bits must be 0)  }
+    { stop MUI from calling other handlers  }
+       MUI_EventHandlerRC_Eat = 1 shl 0;
+    {                     }
+    { List Position Test  }
+    {                     }
+    { number of entry, -1 if mouse not over valid entry  }
+    { numer of column, -1 if no valid column  }
+    { see below  }
+    { x offset of mouse click relative to column start  }
+    { y offset of mouse click from center of line
+    	                  (negative values mean click was above center,
+    	                   positive values mean click was below center)  }
+
+    type
+       tMUI_List_TestPos_Result = record
+            entry : LONG;
+            column : WORD;
+            flags : WORD;
+            xoffset : WORD;
+            yoffset : WORD;
+         end;
+       pMUI_List_TestPos_Result = ^tMUI_List_TestPos_Result;
+   
+    const
+       MUI_LPR_ABOVE = 1 shl 0;
+       MUI_LPR_BELOW = 1 shl 1;
+       MUI_LPR_LEFT = 1 shl 2;
+       MUI_LPR_RIGHT = 1 shl 3;
+ 
+    {                                                                          
+      
+       For Boopsi Image Implementors Only:
+      
+       If MUI is using a boopsi image object, it will send a special method
+       immediately after object creation. This method has a parameter structure
+       where the boopsi can fill in its minimum and maximum size and learn if
+       its used in a horizontal or vertical context.
+      
+       The boopsi image must use the method id (MUIM_BoopsiQuery) as return
+       value. That's how MUI sees that the method is implemented.
+      
+       Note: MUI does not depend on this method. If the boopsi image doesn't
+             implement it, minimum size will be 0 and maximum size unlimited.
+      
+                                                                               }
+    { this is send to the boopsi and  }
+
+    const
+       MUIM_BoopsiQuery = $80427157;
+    { must be used as return value    }
+    { parameter structure  }
+    { always MUIM_BoopsiQuery  }
+    { obsolete, use mbq_RenderInfo  }
+    { read only, see below  }
+    { write only, fill in min width   }
+    { write only, fill in min height  }
+    { write only, fill in max width   }
+    { write only, fill in max height  }
+    { write only, fill in def width   }
+    { write only, fill in def height  }
+    { read only, display context  }
+    { may grow in future ...  }
+
+ type
+       tMUI_RenderInfo = record
+            mri_WindowObject : pObject_;
+            mri_Screen : PScreen;
+            mri_DrawInfo : PDrawInfo;
+            mri_Pens : ^WORD;
+            mri_Window : PWindow;
+            mri_RastPort : PRastPort;
+            mri_Flags : ULONG;
+         end;
+       pMUI_RenderInfo = ^tMUI_RenderInfo;
+
+    type
+       tMUI_BoopsiQuery = record
+            mbq_MethodID : ULONG;
+            mbq_Screen : PScreen;
+            mbq_Flags : ULONG;
+            mbq_MinWidth : LONG;
+            mbq_MinHeight : LONG;
+            mbq_MaxWidth : LONG;
+            mbq_MaxHeight : LONG;
+            mbq_DefWidth : LONG;
+            mbq_DefHeight : LONG;
+            mbq_RenderInfo : PMUI_RenderInfo;
+         end;
+       pMUI_BoopsiQuery = ^tMUI_BoopsiQuery; 
+    { old structure name  }
+
+   
+       MUIP_BoopsiQuery = tMUI_BoopsiQuery;
+
+     const
+    { object used in a horizontal  }
+       MBQF_HORIZ = 1 shl 0;
+    { context (else vertical)      }
+    { use this for unlimited MaxWidth/Height  }
+       MBQ_MUI_MAXMAX = 10000;
+    {                                          }
+    { Begin of automatic header file creation  }
+    {                                          }
+    {                                                                           }
+    {  Notify                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Notify : PChar = 'Notify.mui';
+
+    { Methods  }
+    { V4   }
+
+    const
+       MUIM_CallHook = $8042b96b;
+    { V12  }
+       MUIM_Export = $80420f1c;
+    { V8   }
+       MUIM_FindUData = $8042c196;
+    { V11  }
+       MUIM_GetConfigItem = $80423edb;
+    { V8   }
+       MUIM_GetUData = $8042ed0c;
+    { V12  }
+       MUIM_Import = $8042d012;
+    { V4   }
+       MUIM_KillNotify = $8042d240;
+    { V16  }
+       MUIM_KillNotifyObj = $8042b145;
+    { V7   }
+       MUIM_MultiSet = $8042d356;
+    { V9   }
+       MUIM_NoNotifySet = $8042216f;
+    { V4   }
+       MUIM_Notify = $8042c9cb;
+    { V4   }
+       MUIM_Set = $8042549a;
+    { V4   }
+       MUIM_SetAsString = $80422590;
+    { V8   }
+       MUIM_SetUData = $8042c920;
+    { V11  }
+       MUIM_SetUDataOnce = $8042ca19;
+    { V6   }
+       MUIM_WriteLong = $80428d86;
+    { V6   }
+       MUIM_WriteString = $80424bf4;
+    { ...  }
+
+    type
+       tMUIP_CallHook = record
+            MethodID : ULONG;
+            Hook : PHook;
+            param1 : ULONG;
+         end;
+       pMUIP_CallHook = ^tMUIP_CallHook;
+
+       tMUIP_Export = record
+            MethodID : ULONG;
+            dataspace : pObject_;
+         end;
+       pMUIP_Export = ^tMUIP_Export;
+
+       tMUIP_FindUData = record
+            MethodID : ULONG;
+            udata : ULONG;
+         end;
+       pMUIP_FindUData = ^tMUIP_FindUData;
+
+       tMUIP_GetConfigItem = record
+            MethodID : ULONG;
+            id : ULONG;
+            storage : PULONG;
+         end;
+       pMUIP_GetConfigItem = ^tMUIP_GetConfigItem;
+
+       tMUIP_GetUData = record
+            MethodID : ULONG;
+            udata : ULONG;
+            attr : ULONG;
+            storage : PULONG;
+         end;
+       pMUIP_GetUData = ^tMUIP_GetUData;
+
+       tMUIP_Import = record
+            MethodID : ULONG;
+            dataspace : pObject_;
+         end;
+       pMUIP_Import = ^tMUIP_Import;
+
+       tMUIP_KillNotify = record
+            MethodID : ULONG;
+            TrigAttr : ULONG;
+         end;
+       pMUIP_KillNotify = ^tMUIP_KillNotify;
+
+       tMUIP_KillNotifyObj = record
+            MethodID : ULONG;
+            TrigAttr : ULONG;
+            dest : pObject_;
+         end;
+       pMUIP_KillNotifyObj = ^tMUIP_KillNotifyObj;
+
+    { ...  }
+       tMUIP_MultiSet = record
+            MethodID : ULONG;
+            attr : ULONG;
+            val : ULONG;
+            obj : APTR;
+         end;
+       pMUIP_MultiSet = ^tMUIP_MultiSet;
+
+    { ...  }
+       tMUIP_NoNotifySet = record
+            MethodID : ULONG;
+            attr : ULONG;
+            format : Pchar;
+            val : ULONG;
+         end;
+       pMUIP_NoNotifySet = ^tMUIP_NoNotifySet;
+
+    { ...  }
+       tMUIP_Notify = record
+            MethodID : ULONG;
+            TrigAttr : ULONG;
+            TrigVal : ULONG;
+            DestObj : APTR;
+            FollowParams : ULONG;
+         end;
+       pMUIP_Notify = ^tMUIP_Notify;
+
+       tMUIP_Set = record
+            MethodID : ULONG;
+            attr : ULONG;
+            val : ULONG;
+         end;
+       pMUIP_Set = ^tMUIP_Set;
+
+    { ...  }
+       tMUIP_SetAsString = record
+            MethodID : ULONG;
+            attr : ULONG;
+            format : Pchar;
+            val : ULONG;
+         end;
+       pMUIP_SetAsString = ^tMUIP_SetAsString;
+
+       tMUIP_SetUData = record
+            MethodID : ULONG;
+            udata : ULONG;
+            attr : ULONG;
+            val : ULONG;
+         end;
+       pMUIP_SetUData = ^tMUIP_SetUData;
+
+       tMUIP_SetUDataOnce = record
+            MethodID : ULONG;
+            udata : ULONG;
+            attr : ULONG;
+            val : ULONG;
+         end;
+       pMUIP_SetUDataOnce = ^tMUIP_SetUDataOnce;
+
+       tMUIP_WriteLong = record
+            MethodID : ULONG;
+            val : ULONG;
+            memory : PULONG;
+         end;
+       pMUIP_WriteLong = ^tMUIP_WriteLong;
+
+       tMUIP_WriteString = record
+            MethodID : ULONG;
+            str : Pchar;
+            memory : Pchar;
+         end;
+       pMUIP_WriteString = ^tMUIP_WriteString;
+
+    { Attributes  }
+    { V4  ..g Object             }
+
+    const
+       MUIA_ApplicationObject = $8042d3ee;
+    { V5  ..g struct AppMessage    }
+       MUIA_AppMessage = $80421955;
+    { V4  isg LONG               }
+       MUIA_HelpLine = $8042a825;
+    { V4  isg STRPTR             }
+       MUIA_HelpNode = $80420b85;
+    { V7  .s. BOOL               }
+       MUIA_NoNotify = $804237f9;
+    { V11 isg ULONG              }
+       MUIA_ObjectID = $8042d76e;
+    { V11 ..g Object             }
+       MUIA_Parent = $8042e35f;
+    { V4  ..g LONG               }
+       MUIA_Revision = $80427eaa;
+    { V4  isg ULONG              }
+       MUIA_UserData = $80420313;
+    { V4  ..g LONG               }
+       MUIA_Version = $80422301;
+    {                                                                           }
+    {  Family                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Family : PChar = 'Family.mui';
+
+    { Methods  }
+    { V8   }
+
+    const
+       MUIM_Family_AddHead = $8042e200;
+    { V8   }
+       MUIM_Family_AddTail = $8042d752;
+    { V8   }
+       MUIM_Family_Insert = $80424d34;
+    { V8   }
+       MUIM_Family_Remove = $8042f8a9;
+    { V8   }
+       MUIM_Family_Sort = $80421c49;
+    { V8   }
+       MUIM_Family_Transfer = $8042c14a;
+
+    type
+       tMUIP_Family_AddHead = record
+            MethodID : ULONG;
+            obj : pObject_;
+         end;
+       pMUIP_Family_AddHead = ^tMUIP_Family_AddHead;
+
+       tMUIP_Family_AddTail = record
+            MethodID : ULONG;
+            obj : pObject_;
+         end;
+       pMUIP_Family_AddTail = ^tMUIP_Family_AddTail;
+
+       tMUIP_Family_Insert = record
+            MethodID : ULONG;
+            obj : pObject_;
+            pred : pObject_;
+         end;
+       pMUIP_Family_Insert = ^tMUIP_Family_Insert;
+
+       tMUIP_Family_Remove = record
+            MethodID : ULONG;
+            obj : pObject_;
+         end;
+       pMUIP_Family_Remove = ^tMUIP_Family_Remove;
+
+       tMUIP_Family_Sort = record
+            MethodID : ULONG;
+            obj : array[0..0] of pObject_;
+         end;
+       pMUIP_Family_Sort = ^tMUIP_Family_Sort;
+
+       tMUIP_Family_Transfer = record
+            MethodID : ULONG;
+            family : pObject_;
+         end;
+       pMUIP_Family_Transfer = ^tMUIP_Family_Transfer;
+
+    { Attributes  }
+    { V8  i.. Object             }
+
+    const
+       MUIA_Family_Child = $8042c696;
+    { V8  ..g struct MinList     }
+       MUIA_Family_List = $80424b9e;
+    {                                                                           }
+    {  Menustrip                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Menustrip : PChar = 'Menustrip.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V8  isg BOOL               }
+
+    const
+       MUIA_Menustrip_Enabled = $8042815b;
+    {                                                                           }
+    {  Menu                                                                     }
+    {                                                                           }
+
+
+    const
+       MUIC_Menu : PChar = 'Menu.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V8  isg BOOL               }
+
+    const
+       MUIA_Menu_Enabled = $8042ed48;
+    { V8  isg STRPTR             }
+       MUIA_Menu_Title = $8042a0e3;
+    {                                                                           }
+    {  Menuitem                                                                 }
+    {                                                                           }
+
+
+    const
+       MUIC_Menuitem : PChar = 'Menuitem.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V8  isg BOOL               }
+
+    const
+       MUIA_Menuitem_Checked = $8042562a;
+    { V8  isg BOOL               }
+       MUIA_Menuitem_Checkit = $80425ace;
+    { V16 isg BOOL               }
+       MUIA_Menuitem_CommandString = $8042b9cc;
+    { V8  isg BOOL               }
+       MUIA_Menuitem_Enabled = $8042ae0f;
+    { V8  isg LONG               }
+       MUIA_Menuitem_Exclude = $80420bc6;
+    { V8  isg STRPTR             }
+       MUIA_Menuitem_Shortcut = $80422030;
+    { V8  isg STRPTR             }
+       MUIA_Menuitem_Title = $804218be;
+    { V8  isg BOOL               }
+       MUIA_Menuitem_Toggle = $80424d5c;
+    { V8  ..g struct MenuItem    }
+       MUIA_Menuitem_Trigger = $80426f32;
+       MUIV_Menuitem_Shortcut_Check = -(1);
+    {                                                                           }
+    {  Application                                                              }
+    {                                                                           }
+
+
+    const
+       MUIC_Application : PChar = 'Application.mui';
+
+    { Methods  }
+    { V14  }
+
+    const
+       MUIM_Application_AboutMUI = $8042d21d;
+    { V11  }
+       MUIM_Application_AddInputHandler = $8042f099;
+    { V11  }
+       MUIM_Application_CheckRefresh = $80424d68;
+
+    { MUI_OBSOLETE  }
+    { V4   }
+
+    const
+       MUIM_Application_InputBuffered = $80427e59;
+    { V4   }
+       MUIM_Application_Load = $8042f90d;
+    { V11  }
+       MUIM_Application_NewInput = $80423ba6;
+    { V11  }
+       MUIM_Application_OpenConfigWindow = $804299ba;
+    { V4   }
+       MUIM_Application_PushMethod = $80429ef8;
+    { V11  }
+       MUIM_Application_RemInputHandler = $8042e7af;
+    { V4   }
+       MUIM_Application_ReturnID = $804276ef;
+    { V4   }
+       MUIM_Application_Save = $804227ef;
+    { V11  }
+       MUIM_Application_SetConfigItem = $80424a80;
+
+    { V4   }
+
+    const
+       MUIM_Application_ShowHelp = $80426479;
+
+    type
+       tMUIP_Application_AboutMUI = record
+            MethodID : ULONG;
+            refwindow : pObject_;
+         end;
+       pMUIP_Application_AboutMUI = ^tMUIP_Application_AboutMUI;
+
+       tMUIP_Application_AddInputHandler = record
+            MethodID : ULONG;
+            ihnode : PMUI_InputHandlerNode;
+         end;
+       pMUIP_Application_AddInputHandler = ^tMUIP_Application_AddInputHandler;
+       
+       tMUIP_Application_CheckRefresh = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Application_CheckRefresh = ^tMUIP_Application_CheckRefresh;
+
+       tMUIP_Application_GetMenuCheck = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+         end;
+       pMUIP_Application_GetMenuCheck = ^tMUIP_Application_GetMenuCheck;
+
+       tMUIP_Application_GetMenuState = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+         end;
+       pMUIP_Application_GetMenuState = ^tMUIP_Application_GetMenuState;
+
+       tMUIP_Application_Input = record
+            MethodID : ULONG;
+            signal : PLONGBITS;
+         end;
+       pMUIP_Application_Input = ^tMUIP_Application_Input;
+
+       tMUIP_Application_InputBuffered = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Application_InputBuffered = ^tMUIP_Application_InputBuffered;
+
+       tMUIP_Application_Load = record
+            MethodID : ULONG;
+            name : STRPTR;
+         end;
+
+       tMUIP_Application_NewInput = record
+            MethodID : ULONG;
+            signal : PLONGBITS;
+         end;
+       pMUIP_Application_NewInput = ^tMUIP_Application_NewInput;
+
+       tMUIP_Application_OpenConfigWindow = record
+            MethodID : ULONG;
+            flags : ULONG;
+         end;
+       pMUIP_Application_OpenConfigWindow = ^tMUIP_Application_OpenConfigWindow;
+
+    { ...  }
+       tMUIP_Application_PushMethod = record
+            MethodID : ULONG;
+            dest : pObject_;
+            count : LONG;
+         end;
+       pMUIP_Application_PushMethod = ^tMUIP_Application_PushMethod;
+
+       tMUIP_Application_RemInputHandler = record
+            MethodID : ULONG;
+            ihnode : PMUI_InputHandlerNode;
+         end;
+       pMUIP_Application_RemInputHandler = ^tMUIP_Application_RemInputHandler;
+       
+       tMUIP_Application_ReturnID = record
+            MethodID : ULONG;
+            retid : ULONG;
+         end;
+       pMUIP_Application_ReturnID = ^tMUIP_Application_ReturnID;
+
+       tMUIP_Application_Save = record
+            MethodID : ULONG;
+            name : STRPTR;
+         end;
+
+       tMUIP_Application_SetConfigItem = record
+            MethodID : ULONG;
+            item : ULONG;
+            data : APTR;
+         end;
+       pMUIP_Application_SetConfigItem = ^tMUIP_Application_SetConfigItem;
+
+       tMUIP_Application_SetMenuCheck = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+            stat : LONG;
+         end;
+       pMUIP_Application_SetMenuCheck = ^tMUIP_Application_SetMenuCheck;
+
+       tMUIP_Application_SetMenuState = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+            stat : LONG;
+         end;
+       pMUIP_Application_SetMenuState = ^tMUIP_Application_SetMenuState;
+       
+       tMUIP_Application_ShowHelp = record
+            MethodID : ULONG;
+            window : pObject_;
+            name : Pchar;
+            node : Pchar;
+            line : LONG;
+         end;
+       pMUIP_Application_ShowHelp = ^tMUIP_Application_ShowHelp;
+
+    { Attributes  }
+    { V4  isg BOOL               }
+
+    const
+       MUIA_Application_Active = $804260ab;
+    { V4  i.g STRPTR             }
+       MUIA_Application_Author = $80424842;
+    { V4  i.g STRPTR             }
+       MUIA_Application_Base = $8042e07a;
+    { V4  ..g Broker             }
+       MUIA_Application_Broker = $8042dbce;
+    { V4  isg struct Hook        }
+       MUIA_Application_BrokerHook = $80428f4b;
+    { V6  ..g struct MsgPort     }
+       MUIA_Application_BrokerPort = $8042e0ad;
+    { V6  i.g LONG               }
+       MUIA_Application_BrokerPri = $8042c8d0;
+    { V4  isg struct MUI_Command    }
+       MUIA_Application_Commands = $80428648;
+    { V4  i.g STRPTR             }
+       MUIA_Application_Copyright = $8042ef4d;
+    { V4  i.g STRPTR             }
+       MUIA_Application_Description = $80421fc6;
+    { V4  isg struct DiskObject    }
+       MUIA_Application_DiskObject = $804235cb;
+    { V4  ..g BOOL               }
+       MUIA_Application_DoubleStart = $80423bc6;
+    { V5  is. Object             }
+       MUIA_Application_DropObject = $80421266;
+    { V8  ..g BOOL               }
+       MUIA_Application_ForceQuit = $804257df;
+    { V8  isg STRPTR             }
+       MUIA_Application_HelpFile = $804293f4;
+    { V4  .sg BOOL               }
+       MUIA_Application_Iconified = $8042a07f;
+
+
+    const
+       MUIA_Application_MenuAction = $80428961;
+    { V4  ..g ULONG              }
+       MUIA_Application_MenuHelp = $8042540b;
+    { V8  i.. Object             }
+       MUIA_Application_Menustrip = $804252d9;
+    { V7  isg struct Hook        }
+       MUIA_Application_RexxHook = $80427c42;
+    { V4  ..g struct RxMsg       }
+       MUIA_Application_RexxMsg = $8042fd88;
+    { V4  .s. STRPTR             }
+       MUIA_Application_RexxString = $8042d711;
+    { V4  i.. BOOL               }
+       MUIA_Application_SingleTask = $8042a2c8;
+    { V4  .s. BOOL               }
+       MUIA_Application_Sleep = $80425711;
+    { V4  i.g STRPTR             }
+       MUIA_Application_Title = $804281b8;
+    { V10 i.. BOOL               }
+       MUIA_Application_UseCommodities = $80425ee5;
+    { V10 i.. BOOL               }
+       MUIA_Application_UseRexx = $80422387;
+    { V4  i.g STRPTR             }
+       MUIA_Application_Version = $8042b33f;
+    { V4  i.. Object             }
+       MUIA_Application_Window = $8042bfe0;
+    { V13 ..g struct List        }
+       MUIA_Application_WindowList = $80429abe;
+       MUIV_Application_Package_NetConnect = $a3ff7b49;
+    {                                                                           }
+    {  Window                                                                   }
+    {                                                                           }
+
+    const
+       MUIC_Window : PChar = 'Window.mui';
+
+    { V16  }
+
+    const
+       MUIM_Window_AddEventHandler = $804203b7;
+
+    { V16  }
+
+    const
+       MUIM_Window_RemEventHandler = $8042679e;
+    { V4   }
+       MUIM_Window_ScreenToBack = $8042913d;
+    { V4   }
+       MUIM_Window_ScreenToFront = $804227a4;
+
+    { V11  }
+
+    const
+       MUIM_Window_Snapshot = $8042945e;
+    { V4   }
+       MUIM_Window_ToBack = $8042152e;
+    { V4   }
+       MUIM_Window_ToFront = $8042554f;
+
+    type
+       tMUIP_Window_AddEventHandler = record
+            MethodID : ULONG;
+            ehnode : PMUI_EventHandlerNode;
+         end;
+       pMUIP_Window_AddEventHandler = ^tMUIP_Window_AddEventHandler;
+
+       tMUIP_Window_GetMenuCheck = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+         end;
+       pMUIP_Window_GetMenuCheck = ^tMUIP_Window_GetMenuCheck;
+
+       tMUIP_Window_GetMenuState = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+         end;
+        pMUIP_Window_GetMenuState =  ^tMUIP_Window_GetMenuState;
+
+       tMUIP_Window_RemEventHandler = record
+            MethodID : ULONG;
+            ehnode : PMUI_EventHandlerNode;
+         end;
+       pMUIP_Window_RemEventHandler = ^tMUIP_Window_RemEventHandler;
+
+       tMUIP_Window_ScreenToBack = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Window_ScreenToBack = ^tMUIP_Window_ScreenToBack;
+
+       tMUIP_Window_ScreenToFront = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Window_ScreenToFront = ^tMUIP_Window_ScreenToFront;
+       
+       tMUIP_Window_SetCycleChain = record
+            MethodID : ULONG;
+            obj : array[0..0] of pObject_;
+         end;
+       pMUIP_Window_SetCycleChain = ^tMUIP_Window_SetCycleChain;
+
+       tMUIP_Window_SetMenuCheck = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+            stat : LONG;
+         end;
+       pMUIP_Window_SetMenuCheck = ^tMUIP_Window_SetMenuCheck;
+
+       tMUIP_Window_SetMenuState = record
+            MethodID : ULONG;
+            MenuID : ULONG;
+            stat : LONG;
+         end;
+       pMUIP_Window_SetMenuState = ^tMUIP_Window_SetMenuState;
+
+       tMUIP_Window_Snapshot = record
+            MethodID : ULONG;
+            flags : LONG;
+         end;
+       pMUIP_Window_Snapshot = ^tMUIP_Window_Snapshot;
+
+       tMUIP_Window_ToBack = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Window_ToBack = ^tMUIP_Window_ToBack;
+
+       tMUIP_Window_ToFront = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Window_ToFront = ^tMUIP_Window_ToFront;
+
+    { Attributes  }
+    { V4  isg BOOL               }
+
+    const
+       MUIA_Window_Activate = $80428d2f;
+    { V4  .sg Object             }
+       MUIA_Window_ActiveObject = $80427925;
+    { V4  i.g LONG               }
+       MUIA_Window_AltHeight = $8042cce3;
+    { V4  i.g LONG               }
+       MUIA_Window_AltLeftEdge = $80422d65;
+    { V4  i.g LONG               }
+       MUIA_Window_AltTopEdge = $8042e99b;
+    { V4  i.g LONG               }
+       MUIA_Window_AltWidth = $804260f4;
+    { V5  i.. BOOL               }
+       MUIA_Window_AppWindow = $804280cf;
+    { V4  i.. BOOL               }
+       MUIA_Window_Backdrop = $8042c0bb;
+    { V4  i.. BOOL               }
+       MUIA_Window_Borderless = $80429b79;
+    { V4  i.. BOOL               }
+       MUIA_Window_CloseGadget = $8042a110;
+    { V4  ..g BOOL               }
+       MUIA_Window_CloseRequest = $8042e86e;
+    { V4  isg Object             }
+       MUIA_Window_DefaultObject = $804294d7;
+    { V4  i.. BOOL               }
+       MUIA_Window_DepthGadget = $80421923;
+    { V4  i.. BOOL               }
+       MUIA_Window_DragBar = $8042045d;
+    { V8  isg BOOL               }
+       MUIA_Window_FancyDrawing = $8042bd0e;
+    { V4  i.g LONG               }
+       MUIA_Window_Height = $80425846;
+    { V4  isg ULONG              }
+       MUIA_Window_ID = $804201bd;
+    { V4  ..g struct InputEvent    }
+       MUIA_Window_InputEvent = $804247d8;
+    { V4  isg BOOL               }
+       MUIA_Window_IsSubWindow = $8042b5aa;
+    { V4  i.g LONG               }
+       MUIA_Window_LeftEdge = $80426c65;
+    { MUI_OBSOLETE  }
+    { V8  isg ULONG              }
+
+    const
+       MUIA_Window_MenuAction = $80427521;
+    { V8  i.g Object             }
+       MUIA_Window_Menustrip = $8042855e;
+    { V10 ..g Object             }
+       MUIA_Window_MouseObject = $8042bf9b;
+    { V10 i.. BOOL               }
+       MUIA_Window_NeedsMouseObject = $8042372a;
+    { V4  is. BOOL               }
+       MUIA_Window_NoMenus = $80429df5;
+    { V4  .sg BOOL               }
+       MUIA_Window_Open = $80428aa0;
+    { V6  isg STRPTR             }
+       MUIA_Window_PublicScreen = $804278e4;
+    { V4  is. Object             }
+       MUIA_Window_RefWindow = $804201f4;
+    { V4  isg Object             }
+       MUIA_Window_RootObject = $8042cba5;
+    { V4  isg struct Screen      }
+       MUIA_Window_Screen = $8042df4f;
+    { V5  isg STRPTR             }
+       MUIA_Window_ScreenTitle = $804234b0;
+    { V4  i.. BOOL               }
+       MUIA_Window_SizeGadget = $8042e33d;
+    { V4  i.. BOOL               }
+       MUIA_Window_SizeRight = $80424780;
+    { V4  .sg BOOL               }
+       MUIA_Window_Sleep = $8042e7db;
+    { V4  isg STRPTR             }
+       MUIA_Window_Title = $8042ad3d;
+    { V4  i.g LONG               }
+       MUIA_Window_TopEdge = $80427c66;
+    { V13 isg BOOL               }
+       MUIA_Window_UseBottomBorderScroller = $80424e79;
+    { V13 isg BOOL               }
+       MUIA_Window_UseLeftBorderScroller = $8042433e;
+    { V13 isg BOOL               }
+       MUIA_Window_UseRightBorderScroller = $8042c05e;
+    { V4  i.g LONG               }
+       MUIA_Window_Width = $8042dcae;
+    { V4  ..g struct Window      }
+       MUIA_Window_Window = $80426a42;
+       MUIV_Window_ActiveObject_None = 0;
+       MUIV_Window_ActiveObject_Next = -(1);
+       MUIV_Window_ActiveObject_Prev = -(2);
+  
+
+    const
+       MUIV_Window_AltHeight_Scaled = -(1000);
+       MUIV_Window_AltLeftEdge_Centered = -(1);
+       MUIV_Window_AltLeftEdge_Moused = -(2);
+       MUIV_Window_AltLeftEdge_NoChange = -(1000);
+       MUIV_Window_AltTopEdge_Centered = -(1);
+       MUIV_Window_AltTopEdge_Moused = -(2);
+
+
+    const
+       MUIV_Window_AltTopEdge_NoChange = -(1000);
+  
+
+    const
+       MUIV_Window_AltWidth_Scaled = -(1000);
+  
+
+
+    const
+       MUIV_Window_Height_Scaled = -(1000);
+       MUIV_Window_Height_Default = -(1001);
+       MUIV_Window_LeftEdge_Centered = -(1);
+       MUIV_Window_LeftEdge_Moused = -(2);
+
+
+    const
+       MUIV_Window_TopEdge_Centered = -(1);
+       MUIV_Window_TopEdge_Moused = -(2);
+  
+
+    const
+       MUIV_Window_Width_Scaled = -(1000);
+       MUIV_Window_Width_Default = -(1001);
+    {                                                                           }
+    {  Aboutmui                                                                 }
+    {                                                                           }
+
+
+    const
+       MUIC_Aboutmui : PChar = 'Aboutmui.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V11 i.. Object             }
+
+    const
+       MUIA_Aboutmui_Application = $80422523;
+    {                                                                           }
+    {  Area                                                                     }
+    {                                                                           }
+
+
+    const
+       MUIC_Area : PChar = 'Area.mui';
+
+    { Methods  }
+    { Custom Class  }
+    { V4   }
+
+    const
+       MUIM_AskMinMax = $80423874;
+    { Custom Class  }
+    { V4   }
+       MUIM_Cleanup = $8042d985;
+    { V11  }
+       MUIM_ContextMenuBuild = $80429d2e;
+    { V11  }
+       MUIM_ContextMenuChoice = $80420f0e;
+    { V18  }
+       MUIM_CreateBubble = $80421c41;
+    { V11  }
+       MUIM_CreateShortHelp = $80428e93;
+    { V18  }
+       MUIM_DeleteBubble = $804211af;
+    { V11  }
+       MUIM_DeleteShortHelp = $8042d35a;
+    { V11  }
+       MUIM_DragBegin = $8042c03a;
+    { V11  }
+       MUIM_DragDrop = $8042c555;
+    { V11  }
+       MUIM_DragFinish = $804251f0;
+    { V11  }
+       MUIM_DragQuery = $80420261;
+    { V11  }
+       MUIM_DragReport = $8042edad;
+    { Custom Class  }
+    { V4   }
+       MUIM_Draw = $80426f3f;
+    { V11  }
+       MUIM_DrawBackground = $804238ca;
+    { Custom Class  }
+    { V16  }
+       MUIM_HandleEvent = $80426d66;
+    { Custom Class  }
+    { V4   }
+       MUIM_HandleInput = $80422a1a;
+    { Custom Class  }
+    { V4   }
+       MUIM_Hide = $8042f20f;
+    { Custom Class  }
+    { V4   }
+       MUIM_Setup = $80428354;
+    { Custom Class  }
+    { V4   }
+       MUIM_Show = $8042cc84;
+
+    type
+
+     { MUI_MinMax structure holds information about minimum, maximum
+       and default dimensions of an object.  }
+       tMUI_MinMax = record
+            MinWidth : WORD;
+            MinHeight : WORD;
+            MaxWidth : WORD;
+            MaxHeight : WORD;
+            DefWidth : WORD;
+            DefHeight : WORD;
+         end;
+       pMUI_MinMax = ^tMUI_MinMax;
+
+       tMUIP_AskMinMax = record
+            MethodID : ULONG;
+            MinMaxInfo : PMUI_MinMax;
+         end;
+       pMUIP_AskMinMax = ^tMUIP_AskMinMax;
+
+    { Custom Class  }
+       tMUIP_Cleanup = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Cleanup  = ^tMUIP_Cleanup;
+
+    { Custom Class  }
+       tMUIP_ContextMenuBuild = record
+            MethodID : ULONG;
+            mx : LONG;
+            my : LONG;
+         end;
+       pMUIP_ContextMenuBuild = ^tMUIP_ContextMenuBuild;
+
+       tMUIP_ContextMenuChoice = record
+            MethodID : ULONG;
+            item : pObject_;
+         end;
+       pMUIP_ContextMenuChoice = ^tMUIP_ContextMenuChoice;
+
+       tMUIP_CreateBubble = record
+            MethodID : ULONG;
+            x : LONG;
+            y : LONG;
+            txt : Pchar;
+            flags : ULONG;
+         end;
+       pMUIP_CreateBubble = ^tMUIP_CreateBubble;
+
+       tMUIP_CreateShortHelp = record
+            MethodID : ULONG;
+            mx : LONG;
+            my : LONG;
+         end;
+       pMUIP_CreateShortHelp = ^tMUIP_CreateShortHelp;
+
+       tMUIP_DeleteBubble = record
+            MethodID : ULONG;
+            bubble : APTR;
+         end;
+       pMUIP_DeleteBubble = ^tMUIP_DeleteBubble;
+
+       tMUIP_DeleteShortHelp = record
+            MethodID : ULONG;
+            help : STRPTR;
+         end;
+       pMUIP_DeleteShortHelp = ^tMUIP_DeleteShortHelp;
+
+       tMUIP_DragBegin = record
+            MethodID : ULONG;
+            obj : pObject_;
+         end;
+       pMUIP_DragBegin = ^tMUIP_DragBegin;
+
+       tMUIP_DragDrop = record
+            MethodID : ULONG;
+            obj : pObject_;
+            x : LONG;
+            y : LONG;
+         end;
+       pMUIP_DragDrop = ^tMUIP_DragDrop;
+
+       tMUIP_DragFinish = record
+            MethodID : ULONG;
+            obj : pObject_;
+         end;
+       pMUIP_DragFinish = ^tMUIP_DragFinish;
+
+       tMUIP_DragQuery = record
+            MethodID : ULONG;
+            obj : pObject_;
+         end;
+       pMUIP_DragQuery = ^tMUIP_DragQuery;
+
+       tMUIP_DragReport = record
+            MethodID : ULONG;
+            obj : pObject_;
+            x : LONG;
+            y : LONG;
+            update : LONG;
+         end;
+       pMUIP_DragReport = ^tMUIP_DragReport;
+
+       tMUIP_Draw = record
+            MethodID : ULONG;
+            flags : ULONG;
+         end;
+       pMUIP_Draw = ^tMUIP_Draw;
+
+    { Custom Class  }
+       tMUIP_DrawBackground = record
+            MethodID : ULONG;
+            left : LONG;
+            top : LONG;
+            width : LONG;
+            height : LONG;
+            xoffset : LONG;
+            yoffset : LONG;
+            flags : LONG;
+         end;
+       pMUIP_DrawBackground = ^tMUIP_DrawBackground;
+
+       tMUIP_HandleEvent = record
+            MethodID : ULONG;
+            imsg : PIntuiMessage;
+            muikey : LONG;
+         end;
+       pMUIP_HandleEvent = ^tMUIP_HandleEvent;
+
+    { Custom Class  }
+       tMUIP_HandleInput = record
+            MethodID : ULONG;
+            imsg : PIntuiMessage;
+            muikey : LONG;
+         end;
+       pMUIP_HandleInput = ^tMUIP_HandleInput;
+
+    { Custom Class  }
+       tMUIP_Hide = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Hide = ^tMUIP_Hide;
+
+    { Custom Class  }
+       tMUIP_Setup = record
+            MethodID : ULONG;
+            RenderInfo : PMUI_RenderInfo;
+         end;
+       pMUIP_Setup = ^tMUIP_Setup;
+
+    { Custom Class  }
+       tMUIP_Show = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Show = ^tMUIP_Show;
+
+    { Custom Class  }
+    { Attributes  }
+    { V4  is. LONG               }
+
+    const
+       MUIA_Background = $8042545b;
+    { V4  ..g LONG               }
+       MUIA_BottomEdge = $8042e552;
+    { V11 isg Object             }
+       MUIA_ContextMenu = $8042b704;
+    { V11 ..g Object             }
+       MUIA_ContextMenuTrigger = $8042a2c1;
+    { V4  isg char               }
+       MUIA_ControlChar = $8042120b;
+    { V11 isg LONG               }
+       MUIA_CycleChain = $80421ce7;
+    { V4  isg BOOL               }
+       MUIA_Disabled = $80423661;
+    { V11 isg BOOL               }
+       MUIA_Draggable = $80420b6e;
+    { V11 isg BOOL               }
+       MUIA_Dropable = $8042fbce;
+
+    { V4  is. BOOL               }
+
+    const
+       MUIA_FillArea = $804294a3;
+    { V4  i.. LONG               }
+       MUIA_FixHeight = $8042a92b;
+    { V4  i.. STRPTR             }
+       MUIA_FixHeightTxt = $804276f2;
+    { V4  i.. LONG               }
+       MUIA_FixWidth = $8042a3f1;
+    { V4  i.. STRPTR             }
+       MUIA_FixWidthTxt = $8042d044;
+    { V4  i.g struct TextFont    }
+       MUIA_Font = $8042be50;
+    { V4  i.. LONG               }
+       MUIA_Frame = $8042ac64;
+    { V4  i.. BOOL               }
+       MUIA_FramePhantomHoriz = $8042ed76;
+    { V4  i.. STRPTR             }
+       MUIA_FrameTitle = $8042d1c7;
+    { V4  ..g LONG               }
+       MUIA_Height = $80423237;
+    { V11 isg LONG               }
+       MUIA_HorizDisappear = $80429615;
+    { V4  isg WORD               }
+       MUIA_HorizWeight = $80426db9;
+    { V4  i.g LONG               }
+       MUIA_InnerBottom = $8042f2c0;
+    { V4  i.g LONG               }
+       MUIA_InnerLeft = $804228f8;
+    { V4  i.g LONG               }
+       MUIA_InnerRight = $804297ff;
+    { V4  i.g LONG               }
+       MUIA_InnerTop = $80421eb6;
+    { V4  i.. LONG               }
+       MUIA_InputMode = $8042fb04;
+    { V4  ..g LONG               }
+       MUIA_LeftEdge = $8042bec6;
+    { V11 i.. LONG               }
+       MUIA_MaxHeight = $804293e4;
+    { V11 i.. LONG               }
+       MUIA_MaxWidth = $8042f112;
+    { V4  ..g BOOL               }
+       MUIA_Pressed = $80423535;
+    { V4  ..g LONG               }
+       MUIA_RightEdge = $8042ba82;
+    { V4  isg BOOL               }
+       MUIA_Selected = $8042654b;
+    { V11 isg STRPTR             }
+       MUIA_ShortHelp = $80428fe3;
+    { V4  isg BOOL               }
+       MUIA_ShowMe = $80429ba8;
+    { V4  i.. BOOL               }
+       MUIA_ShowSelState = $8042caac;
+    { V4  ..g LONG               }
+       MUIA_Timer = $80426435;
+    { V4  ..g LONG               }
+       MUIA_TopEdge = $8042509b;
+    { V11 isg LONG               }
+       MUIA_VertDisappear = $8042d12f;
+    { V4  isg WORD               }
+       MUIA_VertWeight = $804298d0;
+    { V4  i.. WORD               }
+       MUIA_Weight = $80421d1f;
+    { V4  ..g LONG               }
+       MUIA_Width = $8042b59c;
+    { V4  ..g struct Window      }
+       MUIA_Window = $80421591;
+    { V4  ..g Object             }
+       MUIA_WindowObject = $8042669e;
+       MUIV_Font_Inherit = 0;
+       MUIV_Font_Normal = -(1);
+       MUIV_Font_List = -(2);
+       MUIV_Font_Tiny = -(3);
+       MUIV_Font_Fixed = -(4);
+       MUIV_Font_Title = -(5);
+       MUIV_Font_Big = -(6);
+       MUIV_Font_Button = -(7);
+       MUIV_Frame_None = 0;
+       MUIV_Frame_Button = 1;
+       MUIV_Frame_ImageButton = 2;
+       MUIV_Frame_Text = 3;
+       MUIV_Frame_String = 4;
+       MUIV_Frame_ReadList = 5;
+       MUIV_Frame_InputList = 6;
+       MUIV_Frame_Prop = 7;
+       MUIV_Frame_Gauge = 8;
+       MUIV_Frame_Group = 9;
+       MUIV_Frame_PopUp = 10;
+       MUIV_Frame_Virtual = 11;
+       MUIV_Frame_Slider = 12;
+       MUIV_Frame_Count = 13;
+       MUIV_InputMode_None = 0;
+       MUIV_InputMode_RelVerify = 1;
+       MUIV_InputMode_Immediate = 2;
+       MUIV_InputMode_Toggle = 3;
+    {                                                                           }
+    {  Rectangle                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Rectangle : PChar = 'Rectangle.mui';
+
+    { Attributes  }
+    { V11 i.g STRPTR             }
+
+    const
+       MUIA_Rectangle_BarTitle = $80426689;
+    { V7  i.g BOOL               }
+       MUIA_Rectangle_HBar = $8042c943;
+    { V7  i.g BOOL               }
+       MUIA_Rectangle_VBar = $80422204;
+    {                                                                           }
+    {  Balance                                                                  }
+    {                                                                           }
+
+
+    const
+       MUIC_Balance : PChar = 'Balance.mui';
+
+    {                                                                           }
+    {  Image                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Image : PChar = 'Image.mui';
+
+    { Attributes  }
+    { V4  i.. BOOL               }
+
+    const
+       MUIA_Image_FontMatch = $8042815d;
+    { V4  i.. BOOL               }
+       MUIA_Image_FontMatchHeight = $80429f26;
+    { V4  i.. BOOL               }
+       MUIA_Image_FontMatchWidth = $804239bf;
+    { V4  i.. BOOL               }
+       MUIA_Image_FreeHoriz = $8042da84;
+    { V4  i.. BOOL               }
+       MUIA_Image_FreeVert = $8042ea28;
+    { V4  i.. struct Image       }
+       MUIA_Image_OldImage = $80424f3d;
+    { V4  i.. char               }
+       MUIA_Image_Spec = $804233d5;
+    { V4  is. LONG               }
+       MUIA_Image_State = $8042a3ad;
+    {                                                                           }
+    {  Bitmap                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Bitmap : PChar = 'Bitmap.mui';
+
+    { Attributes  }
+    { V8  isg struct BitMap      }
+
+    const
+       MUIA_Bitmap_Bitmap = $804279bd;
+    { V8  isg LONG               }
+       MUIA_Bitmap_Height = $80421560;
+    { V8  isg UBYTE              }
+       MUIA_Bitmap_MappingTable = $8042e23d;
+    { V11 isg LONG               }
+       MUIA_Bitmap_Precision = $80420c74;
+    { V11 ..g struct BitMap      }
+       MUIA_Bitmap_RemappedBitmap = $80423a47;
+    { V8  isg ULONG              }
+       MUIA_Bitmap_SourceColors = $80425360;
+    { V8  isg LONG               }
+       MUIA_Bitmap_Transparent = $80422805;
+    { V11 i.. BOOL               }
+       MUIA_Bitmap_UseFriend = $804239d8;
+    { V8  isg LONG               }
+       MUIA_Bitmap_Width = $8042eb3a;
+    {                                                                           }
+    {  Bodychunk                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Bodychunk : PChar = 'Bodychunk.mui';
+
+    { Attributes  }
+    { V8  isg UBYTE              }
+
+    const
+       MUIA_Bodychunk_Body = $8042ca67;
+    { V8  isg UBYTE              }
+       MUIA_Bodychunk_Compression = $8042de5f;
+    { V8  isg LONG               }
+       MUIA_Bodychunk_Depth = $8042c392;
+    { V8  isg UBYTE              }
+       MUIA_Bodychunk_Masking = $80423b0e;
+    {                                                                           }
+    {  Text                                                                     }
+    {                                                                           }
+
+    const
+       MUIC_Text : PChar = 'Text.mui';
+
+    { Attributes  }
+    { V4  isg STRPTR             }
+
+    const
+       MUIA_Text_Contents = $8042f8dc;
+    { V4  i.. char               }
+       MUIA_Text_HiChar = $804218ff;
+    { V4  isg STRPTR             }
+       MUIA_Text_PreParse = $8042566d;
+    { V4  i.. BOOL               }
+       MUIA_Text_SetMax = $80424d0a;
+    { V4  i.. BOOL               }
+       MUIA_Text_SetMin = $80424e10;
+    { V11 i.. BOOL               }
+       MUIA_Text_SetVMax = $80420d8b;
+    {                                                                           }
+    {  Gadget                                                                   }
+    {                                                                           }
+
+    const
+       MUIC_Gadget : PChar = 'Gadget.mui';
+
+    { Attributes  }
+    { V11 ..g struct Gadget      }
+
+    const
+       MUIA_Gadget_Gadget = $8042ec1a;
+    {                                                                           }
+    {  String                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_String : PChar = 'String.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V4  isg STRPTR             }
+
+    const
+       MUIA_String_Accept = $8042e3e1;
+    { V4  ..g STRPTR             }
+       MUIA_String_Acknowledge = $8042026c;
+    { V11 isg BOOL               }
+       MUIA_String_AdvanceOnCR = $804226de;
+    { V4  isg Object             }
+       MUIA_String_AttachedList = $80420fd2;
+    { V4  .sg LONG               }
+       MUIA_String_BufferPos = $80428b6c;
+    { V4  isg STRPTR             }
+       MUIA_String_Contents = $80428ffd;
+    { V4  .sg LONG               }
+       MUIA_String_DisplayPos = $8042ccbf;
+    { V7  isg struct Hook        }
+       MUIA_String_EditHook = $80424c33;
+    { V4  i.g LONG               }
+       MUIA_String_Format = $80427484;
+    { V4  isg ULONG              }
+       MUIA_String_Integer = $80426e8a;
+    { V11 isg BOOL               }
+       MUIA_String_LonelyEditHook = $80421569;
+    { V4  i.g LONG               }
+       MUIA_String_MaxLen = $80424984;
+    { V4  isg STRPTR             }
+       MUIA_String_Reject = $8042179c;
+    { V4  i.g BOOL               }
+       MUIA_String_Secret = $80428769;
+       MUIV_String_Format_Left = 0;
+       MUIV_String_Format_Center = 1;
+       MUIV_String_Format_Right = 2;
+    {                                                                           }
+    {  Boopsi                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Boopsi : PChar = 'Boopsi.mui';
+
+    { Attributes  }
+    { V4  isg struct IClass      }
+
+    const
+       MUIA_Boopsi_Class = $80426999;
+    { V4  isg char               }
+       MUIA_Boopsi_ClassID = $8042bfa3;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_MaxHeight = $8042757f;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_MaxWidth = $8042bcb1;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_MinHeight = $80422c93;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_MinWidth = $80428fb2;
+    { V4  ..g Object             }
+       MUIA_Boopsi_Object = $80420178;
+    { V4  i.. ULONG              }
+       MUIA_Boopsi_Remember = $8042f4bd;
+    { V9  i.. BOOL               }
+       MUIA_Boopsi_Smart = $8042b8d7;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_TagDrawInfo = $8042bae7;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_TagScreen = $8042bc71;
+    { V4  isg ULONG              }
+       MUIA_Boopsi_TagWindow = $8042e11d;
+    {                                                                           }
+    {  Prop                                                                     }
+    {                                                                           }
+
+
+    const
+       MUIC_Prop : PChar = 'Prop.mui';
+
+    { Methods  }
+    { V16  }
+
+    const
+       MUIM_Prop_Decrease = $80420dd1;
+    { V16  }
+       MUIM_Prop_Increase = $8042cac0;
+
+    type
+       tMUIP_Prop_Decrease = record
+            MethodID : ULONG;
+            amount : LONG;
+         end;
+       pMUIP_Prop_Decrease = ^tMUIP_Prop_Decrease;
+
+       tMUIP_Prop_Increase = record
+            MethodID : ULONG;
+            amount : LONG;
+         end;
+       pMUIP_Prop_Increase = ^tMUIP_Prop_Increase;
+
+    { Attributes  }
+    { V4  isg LONG               }
+
+    const
+       MUIA_Prop_Entries = $8042fbdb;
+    { V4  isg LONG               }
+       MUIA_Prop_First = $8042d4b2;
+    { V4  i.g BOOL               }
+       MUIA_Prop_Horiz = $8042f4f3;
+    { V4  isg BOOL               }
+       MUIA_Prop_Slider = $80429c3a;
+    { V13 i.. LONG               }
+       MUIA_Prop_UseWinBorder = $8042deee;
+    { V4  isg LONG               }
+       MUIA_Prop_Visible = $8042fea6;
+       MUIV_Prop_UseWinBorder_None = 0;
+       MUIV_Prop_UseWinBorder_Left = 1;
+       MUIV_Prop_UseWinBorder_Right = 2;
+       MUIV_Prop_UseWinBorder_Bottom = 3;
+    {                                                                           }
+    {  Gauge                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Gauge : PChar = 'Gauge.mui';
+
+    { Attributes  }
+    { V4  isg LONG               }
+
+    const
+       MUIA_Gauge_Current = $8042f0dd;
+    { V4  isg BOOL               }
+       MUIA_Gauge_Divide = $8042d8df;
+    { V4  i.. BOOL               }
+       MUIA_Gauge_Horiz = $804232dd;
+    { V7  isg STRPTR             }
+       MUIA_Gauge_InfoText = $8042bf15;
+    { V4  isg LONG               }
+       MUIA_Gauge_Max = $8042bcdb;
+    {                                                                           }
+    {  Scale                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Scale : PChar = 'Scale.mui';
+
+    { Attributes  }
+    { V4  isg BOOL               }
+
+    const
+       MUIA_Scale_Horiz = $8042919a;
+    {                                                                           }
+    {  Colorfield                                                               }
+    {                                                                           }
+
+
+    const
+       MUIC_Colorfield : PChar = 'Colorfield.mui';
+
+    { Attributes  }
+    { V4  isg ULONG              }
+
+    const
+       MUIA_Colorfield_Blue = $8042d3b0;
+    { V4  isg ULONG              }
+       MUIA_Colorfield_Green = $80424466;
+    { V4  ..g ULONG              }
+       MUIA_Colorfield_Pen = $8042713a;
+    { V4  isg ULONG              }
+       MUIA_Colorfield_Red = $804279f6;
+    { V4  isg ULONG              }
+       MUIA_Colorfield_RGB = $8042677a;
+    {                                                                           }
+    {  List                                                                     }
+    {                                                                           }
+
+
+    const
+       MUIC_List : PChar = 'List.mui';
+
+    { Methods  }
+    { V4   }
+
+    const
+       MUIM_List_Clear = $8042ad89;
+    { V11  }
+       MUIM_List_CreateImage = $80429804;
+    { V11  }
+       MUIM_List_DeleteImage = $80420f58;
+    { V4   }
+       MUIM_List_Exchange = $8042468c;
+    { V4   }
+       MUIM_List_GetEntry = $804280ec;
+    { V4   }
+       MUIM_List_Insert = $80426c87;
+    { V7   }
+       MUIM_List_InsertSingle = $804254d5;
+    { V4   }
+       MUIM_List_Jump = $8042baab;
+    { V9   }
+       MUIM_List_Move = $804253c2;
+    { V6   }
+       MUIM_List_NextSelected = $80425f17;
+    { V4   }
+       MUIM_List_Redraw = $80427993;
+    { V4   }
+       MUIM_List_Remove = $8042647e;
+    { V4   }
+       MUIM_List_Select = $804252d8;
+    { V4   }
+       MUIM_List_Sort = $80422275;
+    { V11  }
+       MUIM_List_TestPos = $80425f48;
+
+    type
+       tMUIP_List_Clear = record
+            MethodID : ULONG;
+         end;
+       pMUIP_List_Clear = ^tMUIP_List_Clear;
+
+       tMUIP_List_CreateImage = record
+            MethodID : ULONG;
+            obj : pObject_;
+            flags : ULONG;
+         end;
+       pMUIP_List_CreateImage = ^tMUIP_List_CreateImage;
+
+       tMUIP_List_DeleteImage = record
+            MethodID : ULONG;
+            listimg : APTR;
+         end;
+       pMUIP_List_DeleteImage = ^tMUIP_List_DeleteImage;
+
+       tMUIP_List_Exchange = record
+            MethodID : ULONG;
+            pos1 : LONG;
+            pos2 : LONG;
+         end;
+       pMUIP_List_Exchange = ^tMUIP_List_Exchange;
+
+       tMUIP_List_GetEntry = record
+            MethodID : ULONG;
+            pos : LONG;
+            entry : PAPTR;
+         end;
+       pMUIP_List_GetEntry = ^tMUIP_List_GetEntry;
+
+       tMUIP_List_Insert = record
+            MethodID : ULONG;
+            entries : PAPTR;
+            count : LONG;
+            pos : LONG;
+         end;
+       pMUIP_List_Insert = ^tMUIP_List_Insert;
+
+       tMUIP_List_InsertSingle = record
+            MethodID : ULONG;
+            entry : APTR;
+            pos : LONG;
+         end;
+       pMUIP_List_InsertSingle = ^tMUIP_List_InsertSingle;
+       
+       tMUIP_List_Jump = record
+            MethodID : ULONG;
+            pos : LONG;
+         end;
+       pMUIP_List_Jump = ^tMUIP_List_Jump;
+
+       tMUIP_List_Move = record
+            MethodID : ULONG;
+            from : LONG;
+            too : LONG;
+         end;
+       pMUIP_List_Move = ^tMUIP_List_Move;
+       
+       tMUIP_List_NextSelected = record
+            MethodID : ULONG;
+            pos : PLONG;
+         end;
+       pMUIP_List_NextSelected = ^tMUIP_List_NextSelected;
+
+       tMUIP_List_Redraw = record
+            MethodID : ULONG;
+            pos : LONG;
+         end;
+       pMUIP_List_Redraw = ^tMUIP_List_Redraw;
+       
+       tMUIP_List_Remove = record
+            MethodID : ULONG;
+            pos : LONG;
+         end;
+       pMUIP_List_Remove = ^tMUIP_List_Remove;
+
+       tMUIP_List_Select = record
+            MethodID : ULONG;
+            pos : LONG;
+            seltype : LONG;
+            state : PLONG;
+         end;
+       pMUIP_List_Select = ^tMUIP_List_Select;
+
+       tMUIP_List_Sort = record
+            MethodID : ULONG;
+         end;
+       pMUIP_List_Sort = ^tMUIP_List_Sort;
+
+       tMUIP_List_TestPos = record
+            MethodID : ULONG;
+            x : LONG;
+            y : LONG;
+            res : PMUI_List_TestPos_Result;
+         end;
+       pMUIP_List_TestPos = ^tMUIP_List_TestPos;
+
+    { Attributes  }
+    { V4  isg LONG               }
+
+    const
+       MUIA_List_Active = $8042391c;
+    { V4  i.. BOOL               }
+       MUIA_List_AdjustHeight = $8042850d;
+    { V4  i.. BOOL               }
+       MUIA_List_AdjustWidth = $8042354a;
+    { V11 isg BOOL               }
+       MUIA_List_AutoVisible = $8042a445;
+    { V4  is. struct Hook        }
+       MUIA_List_CompareHook = $80425c14;
+    { V4  is. struct Hook        }
+       MUIA_List_ConstructHook = $8042894f;
+    { V4  is. struct Hook        }
+       MUIA_List_DestructHook = $804297ce;
+    { V4  is. struct Hook        }
+       MUIA_List_DisplayHook = $8042b4d5;
+    { V11 isg BOOL               }
+       MUIA_List_DragSortable = $80426099;
+    { V11 ..g LONG               }
+       MUIA_List_DropMark = $8042aba6;
+    { V4  ..g LONG               }
+       MUIA_List_Entries = $80421654;
+    { V4  ..g LONG               }
+       MUIA_List_First = $804238d4;
+    { V4  isg STRPTR             }
+       MUIA_List_Format = $80423c0a;
+    { V9  ..g LONG               }
+       MUIA_List_InsertPosition = $8042d0cd;
+    { V4  i.. LONG               }
+       MUIA_List_MinLineHeight = $8042d1c3;
+    { V4  is. struct Hook        }
+       MUIA_List_MultiTestHook = $8042c2c6;
+    { V13 i.. APTR               }
+       MUIA_List_Pool = $80423431;
+    { V13 i.. ULONG              }
+       MUIA_List_PoolPuddleSize = $8042a4eb;
+    { V13 i.. ULONG              }
+       MUIA_List_PoolThreshSize = $8042c48c;
+    { V4  .s. BOOL               }
+       MUIA_List_Quiet = $8042d8c7;
+    { V11 isg BOOL               }
+       MUIA_List_ShowDropMarks = $8042c6f3;
+    { V4  i.. APTR               }
+       MUIA_List_SourceArray = $8042c0a0;
+    { V6  isg char               }
+       MUIA_List_Title = $80423e66;
+    { V4  ..g LONG               }
+       MUIA_List_Visible = $8042191f;
+       MUIV_List_Active_Off = -(1);
+       MUIV_List_Active_Top = -(2);
+       MUIV_List_Active_Bottom = -(3);
+       MUIV_List_Active_Up = -(4);
+       MUIV_List_Active_Down = -(5);
+       MUIV_List_Active_PageUp = -(6);
+       MUIV_List_Active_PageDown = -(7);
+       MUIV_List_ConstructHook_String = -(1);
+       MUIV_List_CopyHook_String = -(1);
+       MUIV_List_CursorType_None = 0;
+       MUIV_List_CursorType_Bar = 1;
+       MUIV_List_CursorType_Rect = 2;
+       MUIV_List_DestructHook_String = -(1);
+    {                                                                           }
+    {  Floattext                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Floattext : PChar = 'Floattext.mui';
+
+    { Attributes  }
+    { V4  isg BOOL               }
+
+    const
+       MUIA_Floattext_Justify = $8042dc03;
+    { V4  is. STRPTR             }
+       MUIA_Floattext_SkipChars = $80425c7d;
+    { V4  is. LONG               }
+       MUIA_Floattext_TabSize = $80427d17;
+    { V4  isg STRPTR             }
+       MUIA_Floattext_Text = $8042d16a;
+    {                                                                           }
+    {  Volumelist                                                               }
+    {                                                                           }
+
+
+    const
+       MUIC_Volumelist : PChar = 'Volumelist.mui';
+
+    {                                                                           }
+    {  Scrmodelist                                                              }
+    {                                                                           }
+
+    const
+       MUIC_Scrmodelist : PChar = 'Scrmodelist.mui';
+
+    { Attributes  }
+    {                                                                           }
+    {  Dirlist                                                                  }
+    {                                                                           }
+
+
+    const
+       MUIC_Dirlist : PChar = 'Dirlist.mui';
+
+    { Methods  }
+    { V4   }
+
+    const
+       MUIM_Dirlist_ReRead = $80422d71;
+
+    type
+       MUIP_Dirlist_ReRead = record
+            MethodID : ULONG;
+         end;
+
+    { Attributes  }
+    { V4  is. STRPTR             }
+
+    const
+       MUIA_Dirlist_AcceptPattern = $8042760a;
+    { V4  isg STRPTR             }
+       MUIA_Dirlist_Directory = $8042ea41;
+    { V4  is. BOOL               }
+       MUIA_Dirlist_DrawersOnly = $8042b379;
+    { V4  is. BOOL               }
+       MUIA_Dirlist_FilesOnly = $8042896a;
+    { V4  is. BOOL               }
+       MUIA_Dirlist_FilterDrawers = $80424ad2;
+    { V4  is. struct Hook        }
+       MUIA_Dirlist_FilterHook = $8042ae19;
+    { V6  is. BOOL               }
+       MUIA_Dirlist_MultiSelDirs = $80428653;
+    { V4  ..g LONG               }
+       MUIA_Dirlist_NumBytes = $80429e26;
+    { V4  ..g LONG               }
+       MUIA_Dirlist_NumDrawers = $80429cb8;
+    { V4  ..g LONG               }
+       MUIA_Dirlist_NumFiles = $8042a6f0;
+    { V4  ..g STRPTR             }
+       MUIA_Dirlist_Path = $80426176;
+    { V4  is. BOOL               }
+       MUIA_Dirlist_RejectIcons = $80424808;
+    { V4  is. STRPTR             }
+       MUIA_Dirlist_RejectPattern = $804259c7;
+    { V4  is. LONG               }
+       MUIA_Dirlist_SortDirs = $8042bbb9;
+    { V4  is. BOOL               }
+       MUIA_Dirlist_SortHighLow = $80421896;
+    { V4  is. LONG               }
+       MUIA_Dirlist_SortType = $804228bc;
+    { V4  ..g LONG               }
+       MUIA_Dirlist_Status = $804240de;
+       MUIV_Dirlist_SortDirs_First = 0;
+       MUIV_Dirlist_SortDirs_Last = 1;
+       MUIV_Dirlist_SortDirs_Mix = 2;
+       MUIV_Dirlist_SortType_Name = 0;
+       MUIV_Dirlist_SortType_Date = 1;
+       MUIV_Dirlist_SortType_Size = 2;
+       MUIV_Dirlist_Status_Invalid = 0;
+       MUIV_Dirlist_Status_Reading = 1;
+       MUIV_Dirlist_Status_Valid = 2;
+    {                                                                           }
+    {  Numeric                                                                  }
+    {                                                                           }
+
+    const
+       MUIC_Numeric : PChar = 'Numeric.mui';
+
+    { Methods  }
+    { V11  }
+
+    const
+       MUIM_Numeric_Decrease = $804243a7;
+    { V11  }
+       MUIM_Numeric_Increase = $80426ecd;
+    { V11  }
+       MUIM_Numeric_ScaleToValue = $8042032c;
+    { V11  }
+       MUIM_Numeric_SetDefault = $8042ab0a;
+    { V11  }
+       MUIM_Numeric_Stringify = $80424891;
+    { V11  }
+       MUIM_Numeric_ValueToScale = $80423e4f;
+
+    type
+       tMUIP_Numeric_Decrease = record
+            MethodID : ULONG;
+            amount : LONG;
+         end;
+       pMUIP_Numeric_Decrease = ^tMUIP_Numeric_Decrease;
+
+       tMUIP_Numeric_Increase = record
+            MethodID : ULONG;
+            amount : LONG;
+         end;
+       pMUIP_Numeric_Increase = ^tMUIP_Numeric_Increase;
+
+       tMUIP_Numeric_ScaleToValue = record
+            MethodID : ULONG;
+            scalemin : LONG;
+            scalemax : LONG;
+            scale : LONG;
+         end;
+       pMUIP_Numeric_ScaleToValue = ^tMUIP_Numeric_ScaleToValue;
+
+       tMUIP_Numeric_SetDefault = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Numeric_SetDefault = ^tMUIP_Numeric_SetDefault;
+
+       tMUIP_Numeric_Stringify = record
+            MethodID : ULONG;
+            value : LONG;
+         end;
+       pMUIP_Numeric_Stringify = ^tMUIP_Numeric_Stringify;
+
+       tMUIP_Numeric_ValueToScale = record
+            MethodID : ULONG;
+            scalemin : LONG;
+            scalemax : LONG;
+         end;
+       pMUIP_Numeric_ValueToScale = ^tMUIP_Numeric_ValueToScale;
+
+    { Attributes  }
+    { V11 isg BOOL               }
+
+    const
+       MUIA_Numeric_CheckAllSizes = $80421594;
+    { V11 isg LONG               }
+       MUIA_Numeric_Default = $804263e8;
+    { V11 isg STRPTR             }
+       MUIA_Numeric_Format = $804263e9;
+    { V11 isg LONG               }
+       MUIA_Numeric_Max = $8042d78a;
+    { V11 isg LONG               }
+       MUIA_Numeric_Min = $8042e404;
+    { V11 isg BOOL               }
+       MUIA_Numeric_Reverse = $8042f2a0;
+    { V11 isg BOOL               }
+       MUIA_Numeric_RevLeftRight = $804294a7;
+    { V11 isg BOOL               }
+       MUIA_Numeric_RevUpDown = $804252dd;
+    { V11 isg LONG               }
+       MUIA_Numeric_Value = $8042ae3a;
+    {                                                                           }
+    {  Knob                                                                     }
+    {                                                                           }
+
+
+    const
+       MUIC_Knob : PChar = 'Knob.mui';
+
+    {                                                                           }
+    {  Levelmeter                                                               }
+    {                                                                           }
+
+
+    const
+       MUIC_Levelmeter : PChar = 'Levelmeter.mui';
+
+    { Attributes  }
+    { V11 isg STRPTR             }
+
+    const
+       MUIA_Levelmeter_Label = $80420dd5;
+    {                                                                           }
+    {  Numericbutton                                                            }
+    {                                                                           }
+
+
+    const
+       MUIC_Numericbutton : PChar = 'Numericbutton.mui';
+
+    {                                                                           }
+    {  Slider                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Slider : PChar = 'Slider.mui';
+
+    { Attributes  }
+    { V11 isg BOOL               }
+
+    const
+       MUIA_Slider_Horiz = $8042fad1;
+
+    { V6  i.. BOOL               }
+
+    const
+       MUIA_Slider_Quiet = $80420b26;
+
+    {                                                                           }
+    {  Framedisplay                                                             }
+    {                                                                           }
+
+
+    const
+       MUIC_Framedisplay : PChar = 'Framedisplay.mui';
+
+    { Attributes  }
+    {                                                                           }
+    {  Popframe                                                                 }
+    {                                                                           }
+
+
+    const
+       MUIC_Popframe : PChar = 'Popframe.mui';
+
+    {                                                                           }
+    {  Imagedisplay                                                             }
+    {                                                                           }
+
+    const
+       MUIC_Imagedisplay : PChar = 'Imagedisplay.mui';
+
+    { Attributes  }
+    {                                                                           }
+    {  Popimage                                                                 }
+    {                                                                           }
+
+
+    const
+       MUIC_Popimage : PChar = 'Popimage.mui';
+
+    {                                                                           }
+    {  Pendisplay                                                               }
+    {                                                                           }
+
+
+    const
+       MUIC_Pendisplay : PChar = 'Pendisplay.mui';
+
+    { Methods  }
+    { V13  }
+
+    const
+       MUIM_Pendisplay_SetColormap = $80426c80;
+    { V13  }
+       MUIM_Pendisplay_SetMUIPen = $8042039d;
+    { V13  }
+       MUIM_Pendisplay_SetRGB = $8042c131;
+
+    type
+       MUIP_Pendisplay_SetColormap = record
+            MethodID : ULONG;
+            colormap : LONG;
+         end;
+
+       MUIP_Pendisplay_SetMUIPen = record
+            MethodID : ULONG;
+            muipen : LONG;
+         end;
+
+       MUIP_Pendisplay_SetRGB = record
+            MethodID : ULONG;
+            red : ULONG;
+            green : ULONG;
+            blue : ULONG;
+         end;
+
+    { Attributes  }
+    { V13 ..g Object             }
+
+    const
+       MUIA_Pendisplay_Pen = $8042a748;
+    { V13 isg Object             }
+       MUIA_Pendisplay_Reference = $8042dc24;
+    { V11 isg struct MUI_RGBcolor    }
+       MUIA_Pendisplay_RGBcolor = $8042a1a9;
+    { V11 isg struct MUI_PenSpec     }
+       MUIA_Pendisplay_Spec = $8042a204;
+    {                                                                           }
+    {  Poppen                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Poppen : PChar = 'Poppen.mui';
+
+    {                                                                           }
+    {  Group                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Group : PChar = 'Group.mui';
+
+    { Methods  }
+    { V11  }
+
+    const
+       MUIM_Group_ExitChange = $8042d1cc;
+    { V11  }
+       MUIM_Group_InitChange = $80420887;
+    { V4   }
+       MUIM_Group_Sort = $80427417;
+
+    type
+       tMUIP_Group_ExitChange = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Group_ExitChange = ^tMUIP_Group_ExitChange;
+
+       tMUIP_Group_InitChange = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Group_InitChange = ^tMUIP_Group_InitChange;
+
+       tMUIP_Group_Sort = record
+            MethodID : ULONG;
+            obj : array[0..0] of pObject_;
+         end;
+       pMUIP_Group_Sort = ^tMUIP_Group_Sort;
+
+    { Attributes  }
+    { V5  isg LONG               }
+
+    const
+       MUIA_Group_ActivePage = $80424199;
+    { V4  i.. Object             }
+       MUIA_Group_Child = $804226e6;
+    { V4  ..g struct List        }
+       MUIA_Group_ChildList = $80424748;
+    { V4  is. LONG               }
+       MUIA_Group_Columns = $8042f416;
+    { V4  i.. BOOL               }
+       MUIA_Group_Horiz = $8042536b;
+    { V4  isg LONG               }
+       MUIA_Group_HorizSpacing = $8042c651;
+    { V11 i.. struct Hook        }
+       MUIA_Group_LayoutHook = $8042c3b2;
+    { V5  i.. BOOL               }
+       MUIA_Group_PageMode = $80421a5f;
+    { V4  is. LONG               }
+       MUIA_Group_Rows = $8042b68f;
+    { V4  i.. BOOL               }
+       MUIA_Group_SameHeight = $8042037e;
+    { V4  i.. BOOL               }
+       MUIA_Group_SameSize = $80420860;
+    { V4  i.. BOOL               }
+       MUIA_Group_SameWidth = $8042b3ec;
+    { V4  is. LONG               }
+       MUIA_Group_Spacing = $8042866d;
+    { V4  isg LONG               }
+       MUIA_Group_VertSpacing = $8042e1bf;
+       MUIV_Group_ActivePage_First = 0;
+       MUIV_Group_ActivePage_Last = -(1);
+       MUIV_Group_ActivePage_Prev = -(2);
+       MUIV_Group_ActivePage_Next = -(3);
+       MUIV_Group_ActivePage_Advance = -(4);
+    {                                                                           }
+    {  Mccprefs                                                                 }
+    {                                                                           }
+
+
+    const
+       MUIC_Mccprefs : PChar = 'Mccprefs.mui';
+
+    {                                                                           }
+    {  Register                                                                 }
+    {                                                                           }
+
+    const
+       MUIC_Register : PChar = 'Register.mui';
+
+    { Attributes  }
+    { V7  i.g BOOL               }
+
+    const
+       MUIA_Register_Frame = $8042349b;
+    { V7  i.g STRPTR             }
+       MUIA_Register_Titles = $804297ec;
+    {                                                                           }
+    {  Penadjust                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Penadjust : PChar= 'Penadjust.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V11 i.. BOOL               }
+
+    const
+       MUIA_Penadjust_PSIMode = $80421cbb;
+    {                                                                           }
+    {  Settingsgroup                                                            }
+    {                                                                           }
+
+
+    const
+       MUIC_Settingsgroup : PChar = 'Settingsgroup.mui';
+
+    { Methods  }
+    { V11  }
+
+    const
+       MUIM_Settingsgroup_ConfigToGadgets = $80427043;
+    { V11  }
+       MUIM_Settingsgroup_GadgetsToConfig = $80425242;
+
+    type
+       tMUIP_Settingsgroup_ConfigToGadgets = record
+            MethodID : ULONG;
+            configdata : pObject_;
+         end;
+       pMUIP_Settingsgroup_ConfigToGadgets = ^tMUIP_Settingsgroup_ConfigToGadgets;
+
+       tMUIP_Settingsgroup_GadgetsToConfig = record
+            MethodID : ULONG;
+            configdata : pObject_;
+         end;
+       pMUIP_Settingsgroup_GadgetsToConfig = ^tMUIP_Settingsgroup_GadgetsToConfig;
+
+    { Attributes  }
+    {                                                                           }
+    {  Settings                                                                 }
+    {                                                                           }
+
+    const
+       MUIC_Settings : PChar = 'Settings.mui';
+
+    { Methods  }
+    { Attributes  }
+    {                                                                           }
+    {  Frameadjust                                                              }
+    {                                                                           }
+
+
+    const
+       MUIC_Frameadjust : PChar = 'Frameadjust.mui';
+
+    { Methods  }
+    { Attributes  }
+    {                                                                           }
+    {  Imageadjust                                                              }
+    {                                                                           }
+
+
+    const
+       MUIC_Imageadjust : PChar = 'Imageadjust.mui';
+
+    { Methods  }
+    { Attributes  }
+
+    const
+       MUIV_Imageadjust_Type_All = 0;
+       MUIV_Imageadjust_Type_Image = 1;
+       MUIV_Imageadjust_Type_Background = 2;
+       MUIV_Imageadjust_Type_Pen = 3;
+    {                                                                           }
+    {  Virtgroup                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Virtgroup : PChar = 'Virtgroup.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V6  ..g LONG               }
+
+    const
+       MUIA_Virtgroup_Height = $80423038;
+    { V11 i.. BOOL               }
+       MUIA_Virtgroup_Input = $80427f7e;
+    { V6  isg LONG               }
+       MUIA_Virtgroup_Left = $80429371;
+    { V6  isg LONG               }
+       MUIA_Virtgroup_Top = $80425200;
+    { V6  ..g LONG               }
+       MUIA_Virtgroup_Width = $80427c49;
+    {                                                                           }
+    {  Scrollgroup                                                              }
+    {                                                                           }
+
+
+    const
+       MUIC_Scrollgroup : PChar = 'Scrollgroup.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V4  i.g Object             }
+
+    const
+       MUIA_Scrollgroup_Contents = $80421261;
+    { V9  i.. BOOL               }
+       MUIA_Scrollgroup_FreeHoriz = $804292f3;
+    { V9  i.. BOOL               }
+       MUIA_Scrollgroup_FreeVert = $804224f2;
+    { V16 ..g Object             }
+       MUIA_Scrollgroup_HorizBar = $8042b63d;
+    { V13 i.. BOOL               }
+       MUIA_Scrollgroup_UseWinBorder = $804284c1;
+    { V16 ..g Object             }
+       MUIA_Scrollgroup_VertBar = $8042cdc0;
+    {                                                                           }
+    {  Scrollbar                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Scrollbar : PChar = 'Scrollbar.mui';
+
+    { Attributes  }
+    { V11 i.. LONG               }
+
+    const
+       MUIA_Scrollbar_Type = $8042fb6b;
+       MUIV_Scrollbar_Type_Default = 0;
+       MUIV_Scrollbar_Type_Bottom = 1;
+       MUIV_Scrollbar_Type_Top = 2;
+       MUIV_Scrollbar_Type_Sym = 3;
+    {                                                                           }
+    {  Listview                                                                 }
+    {                                                                           }
+
+
+    const
+       MUIC_Listview : PChar = 'Listview.mui';
+
+    { Attributes  }
+    { V7  ..g LONG               }
+
+    const
+       MUIA_Listview_ClickColumn = $8042d1b3;
+    { V7  isg LONG               }
+       MUIA_Listview_DefClickColumn = $8042b296;
+    { V4  i.g BOOL               }
+       MUIA_Listview_DoubleClick = $80424635;
+    { V11 isg LONG               }
+       MUIA_Listview_DragType = $80425cd3;
+    { V4  i.. BOOL               }
+       MUIA_Listview_Input = $8042682d;
+    { V4  i.g Object             }
+       MUIA_Listview_List = $8042bcce;
+    { V7  i.. LONG               }
+       MUIA_Listview_MultiSelect = $80427e08;
+    { V10 i.. BOOL               }
+       MUIA_Listview_ScrollerPos = $8042b1b4;
+    { V4  ..g BOOL               }
+       MUIA_Listview_SelectChange = $8042178f;
+       MUIV_Listview_DragType_None = 0;
+       MUIV_Listview_DragType_Immediate = 1;
+       MUIV_Listview_MultiSelect_None = 0;
+       MUIV_Listview_MultiSelect_Default = 1;
+       MUIV_Listview_MultiSelect_Shifted = 2;
+       MUIV_Listview_MultiSelect_Always = 3;
+       MUIV_Listview_ScrollerPos_Default = 0;
+       MUIV_Listview_ScrollerPos_Left = 1;
+       MUIV_Listview_ScrollerPos_Right = 2;
+       MUIV_Listview_ScrollerPos_None = 3;
+    {                                                                           }
+    {  Radio                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Radio : PChar = 'Radio.mui';
+
+    { Attributes  }
+    { V4  isg LONG               }
+
+    const
+       MUIA_Radio_Active = $80429b41;
+    { V4  i.. STRPTR             }
+       MUIA_Radio_Entries = $8042b6a1;
+    {                                                                           }
+    {  Cycle                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Cycle : PChar = 'Cycle.mui';
+
+    { Attributes  }
+    { V4  isg LONG               }
+
+    const
+       MUIA_Cycle_Active = $80421788;
+    { V4  i.. STRPTR             }
+       MUIA_Cycle_Entries = $80420629;
+       MUIV_Cycle_Active_Next = -(1);
+       MUIV_Cycle_Active_Prev = -(2);
+    {                                                                           }
+    {  Coloradjust                                                              }
+    {                                                                           }
+
+
+    const
+       MUIC_Coloradjust : PChar = 'Coloradjust.mui';
+
+    { Methods  }
+    { Attributes  }
+    { V4  isg ULONG              }
+
+    const
+       MUIA_Coloradjust_Blue = $8042b8a3;
+    { V4  isg ULONG              }
+       MUIA_Coloradjust_Green = $804285ab;
+    { V4  isg ULONG              }
+       MUIA_Coloradjust_ModeID = $8042ec59;
+    { V4  isg ULONG              }
+       MUIA_Coloradjust_Red = $80420eaa;
+    { V4  isg ULONG              }
+       MUIA_Coloradjust_RGB = $8042f899;
+    {                                                                           }
+    {  Palette                                                                  }
+    {                                                                           }
+
+
+    const
+       MUIC_Palette : PChar = 'Palette.mui';
+
+    { Attributes  }
+    { V6  i.g struct MUI_Palette_Entry    }
+
+    const
+       MUIA_Palette_Entries = $8042a3d8;
+    { V6  isg BOOL               }
+       MUIA_Palette_Groupable = $80423e67;
+    { V6  isg char               }
+       MUIA_Palette_Names = $8042c3a2;
+    {                                                                           }
+    {  Popstring                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Popstring : PChar = 'Popstring.mui';
+
+    { Methods  }
+    { V7   }
+
+    const
+       MUIM_Popstring_Close = $8042dc52;
+    { V7   }
+       MUIM_Popstring_Open = $804258ba;
+
+    type
+       tMUIP_Popstring_Close = record
+            MethodID : ULONG;
+            result : LONG;
+         end;
+       pMUIP_Popstring_Close = ^tMUIP_Popstring_Close;
+
+       tMUIP_Popstring_Open = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Popstring_Open = ^tMUIP_Popstring_Open;
+
+    { Attributes  }
+    { V7  i.g Object             }
+
+    const
+       MUIA_Popstring_Button = $8042d0b9;
+    { V7  isg struct Hook        }
+       MUIA_Popstring_CloseHook = $804256bf;
+    { V7  isg struct Hook        }
+       MUIA_Popstring_OpenHook = $80429d00;
+    { V7  i.g Object             }
+       MUIA_Popstring_String = $804239ea;
+    { V7  isg BOOL               }
+       MUIA_Popstring_Toggle = $80422b7a;
+    {                                                                           }
+    {  Popobject                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Popobject : PChar = 'Popobject.mui';
+
+    { Attributes  }
+    { V7  isg BOOL               }
+
+    const
+       MUIA_Popobject_Follow = $80424cb5;
+    { V7  isg BOOL               }
+       MUIA_Popobject_Light = $8042a5a3;
+    { V7  i.g Object             }
+       MUIA_Popobject_Object = $804293e3;
+    { V7  isg struct Hook        }
+       MUIA_Popobject_ObjStrHook = $8042db44;
+    { V7  isg struct Hook        }
+       MUIA_Popobject_StrObjHook = $8042fbe1;
+    { V7  isg BOOL               }
+       MUIA_Popobject_Volatile = $804252ec;
+    { V9  isg struct Hook        }
+       MUIA_Popobject_WindowHook = $8042f194;
+    {                                                                           }
+    {  Poplist                                                                  }
+    {                                                                           }
+
+
+    const
+       MUIC_Poplist : PChar = 'Poplist.mui';
+
+    { Attributes  }
+    { V8  i.. char               }
+
+    const
+       MUIA_Poplist_Array = $8042084c;
+    {                                                                           }
+    {  Popscreen                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Popscreen : PChar = 'Popscreen.mui';
+
+    { Attributes  }
+    {                                                                           }
+    {  Popasl                                                                   }
+    {                                                                           }
+
+    const
+       MUIC_Popasl : PChar = 'Popasl.mui';
+
+    { Attributes  }
+    { V7  ..g BOOL               }
+
+    const
+       MUIA_Popasl_Active = $80421b37;
+    { V7  isg struct Hook        }
+       MUIA_Popasl_StartHook = $8042b703;
+    { V7  isg struct Hook        }
+       MUIA_Popasl_StopHook = $8042d8d2;
+    { V7  i.g ULONG              }
+       MUIA_Popasl_Type = $8042df3d;
+    {                                                                           }
+    {  Semaphore                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Semaphore : PChar = 'Semaphore.mui';
+
+    { Methods  }
+    { V11  }
+
+    const
+       MUIM_Semaphore_Attempt = $80426ce2;
+    { V11  }
+       MUIM_Semaphore_AttemptShared = $80422551;
+    { V11  }
+       MUIM_Semaphore_Obtain = $804276f0;
+    { V11  }
+       MUIM_Semaphore_ObtainShared = $8042ea02;
+    { V11  }
+       MUIM_Semaphore_Release = $80421f2d;
+
+    type
+       tMUIP_Semaphore_Attempt = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Semaphore_Attempt = ^tMUIP_Semaphore_Attempt;
+
+       tMUIP_Semaphore_AttemptShared = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Semaphore_AttemptShared = ^tMUIP_Semaphore_AttemptShared;
+
+       tMUIP_Semaphore_Obtain = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Semaphore_Obtain = ^tMUIP_Semaphore_Obtain;
+       
+       tMUIP_Semaphore_ObtainShared = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Semaphore_ObtainShared = ^tMUIP_Semaphore_ObtainShared;
+
+       tMUIP_Semaphore_Release = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Semaphore_Release = ^tMUIP_Semaphore_Release;
+
+    {                                                                           }
+    {  Applist                                                                  }
+    {                                                                           }
+
+    const
+       MUIC_Applist : PChar = 'Applist.mui';
+    { Methods  }
+    {                                                                           }
+    {  Cclist                                                                   }
+    {                                                                           }
+
+
+    const
+       MUIC_Cclist : PChar = 'Cclist.mui';
+
+    { Methods  }
+    {                                                                           }
+    {  Dataspace                                                                }
+    {                                                                           }
+
+
+    const
+       MUIC_Dataspace : PChar = 'Dataspace.mui';
+
+    { Methods  }
+    { V11  }
+
+    const
+       MUIM_Dataspace_Add = $80423366;
+    { V11  }
+       MUIM_Dataspace_Clear = $8042b6c9;
+    { V11  }
+       MUIM_Dataspace_Find = $8042832c;
+    { V11  }
+       MUIM_Dataspace_Merge = $80423e2b;
+    { V11  }
+       MUIM_Dataspace_ReadIFF = $80420dfb;
+    { V11  }
+       MUIM_Dataspace_Remove = $8042dce1;
+    { V11  }
+       MUIM_Dataspace_WriteIFF = $80425e8e;
+
+    type
+       tMUIP_Dataspace_Add = record
+            MethodID : ULONG;
+            data : APTR;
+            len : LONG;
+            id : ULONG;
+         end;
+       pMUIP_Dataspace_Add = ^tMUIP_Dataspace_Add;
+
+       tMUIP_Dataspace_Clear = record
+            MethodID : ULONG;
+         end;
+       pMUIP_Dataspace_Clear = ^tMUIP_Dataspace_Clear;
+
+       tMUIP_Dataspace_Find = record
+            MethodID : ULONG;
+            id : ULONG;
+         end;
+       pMUIP_Dataspace_Find = ^tMUIP_Dataspace_Find;
+
+       tMUIP_Dataspace_Merge = record
+            MethodID : ULONG;
+            dataspace : pObject_;
+         end;
+       pMUIP_Dataspace_Merge = ^tMUIP_Dataspace_Merge;
+
+       tMUIP_Dataspace_ReadIFF = record
+            MethodID : ULONG;
+            handle : PIFFHandle;
+         end;
+       pMUIP_Dataspace_ReadIFF = ^tMUIP_Dataspace_ReadIFF;
+
+       tMUIP_Dataspace_Remove = record
+            MethodID : ULONG;
+            id : ULONG;
+         end;
+       pMUIP_Dataspace_Remove = ^tMUIP_Dataspace_Remove;
+
+       tMUIP_Dataspace_WriteIFF = record
+            MethodID : ULONG;
+            handle : PIFFHandle;
+            type_ : ULONG;
+            id : ULONG;
+         end;
+       pMUIP_Dataspace_WriteIFF = ^tMUIP_Dataspace_WriteIFF;
+
+    { Attributes  }
+    { V11 i.. APTR               }
+
+    const
+       MUIA_Dataspace_Pool = $80424cf9;
+    {                                                                           }
+    {  Configdata                                                               }
+    {                                                                           }
+
+
+    const
+       MUIC_Configdata : PChar = 'Configdata.mui';
+
+    { Methods  }
+    { Attributes  }
+    {                                                                           }
+    {  Dtpic                                                                    }
+    {                                                                           }
+
+
+    const
+       MUIC_Dtpic : PChar = 'Dtpic.mui';
+    { Attributes  }
+    {                                        }
+    { End of automatic header file creation  }
+    {                                        }
+    {                                                                        
+       Structures and Macros for creating custom classes.
+                                                                             }
+    {
+       GENERAL NOTES:
+      
+       - Everything described in this header file is only valid within
+         MUI classes. You may never use any of these things out of
+         a class, e.g. in a traditional MUI application.
+      
+       - Except when otherwise stated, all structures are strictly read only.
+     }
+    { Global information for every object  }
+    { ... private data follows ...  }
+
+    type
+       tMUI_GlobalInfo = record
+            priv0 : ULONG;
+            mgi_ApplicationObject : pObject_;
+         end;
+       pMUI_GlobalInfo = ^tMUI_GlobalInfo;
+
+    { Instance data of notify class  }
+       tMUI_NotifyData = record
+            mnd_GlobalInfo : PMUI_GlobalInfo;
+            mnd_UserData : ULONG;
+            mnd_ObjectID : ULONG;
+            priv1 : ULONG;
+            priv2 : ULONG;
+            priv3 : ULONG;
+            priv4 : ULONG;
+         end;
+       pMUI_NotifyData = ^tMUI_NotifyData;
+   
+
+    { use this if a dimension is not limited.  }
+
+    const
+       MUI_MAXMAX = 10000;
+    { Hook message for custom layout  }
+    { type of message (see defines below)                       }
+    { list of this groups children, traverse with NextObject()  }
+    { results for MUILM_MINMAX                                  }
+    { size (and result) for MUILM_LAYOUT                        }
+
+    type
+       tMUI_LayoutMsg = record
+            lm_Type : ULONG;
+            lm_Children : PMinList;
+            lm_MinMax : tMUI_MinMax;
+            lm_Layout : record
+                 Width : LONG;
+                 Height : LONG;
+                 priv5 : ULONG;
+                 priv6 : ULONG;
+              end;
+         end;
+       pMUI_LayoutMsg = ^tMUI_LayoutMsg;
+
+    { MUI wants you to calc your min & max sizes  }
+
+    const
+       MUILM_MINMAX = 1;
+    { MUI wants you to layout your children       }
+       MUILM_LAYOUT = 2;
+    { return this if your hook doesn't implement lm_Type  }
+       MUILM_UNKNOWN = -(1);
+    { (partial) instance data of area class  }
+    { RenderInfo for this object  }
+    { Font  }
+    { min/max/default sizes  }
+    { position and dimension  }
+    { frame & innerspacing left offset  }
+    { frame & innerspacing top offset   }
+    { frame & innerspacing add. width   }
+    { frame & innerspacing add. height  }
+    { see definitions below  }
+    { ... private data follows ...  }
+
+    type
+       tMUI_AreaData = record
+            mad_RenderInfo : PMUI_RenderInfo;
+            priv7 : ULONG;
+            mad_Font : PTextFont;
+            mad_MinMax : tMUI_MinMax;
+            mad_Box : tIBox;
+            mad_addleft : BYTE;
+            mad_addtop : BYTE;
+            mad_subwidth : BYTE;
+            mad_subheight : BYTE;
+            mad_Flags : ULONG;
+         end;
+      pMUI_AreaData = ^tMUI_AreaData;
+
+    { Definitions for mad_Flags, other flags are private  }
+    { completely redraw yourself  }
+
+    const
+       MADF_DRAWOBJECT = 1 shl 0;
+    { only update yourself  }
+       MADF_DRAWUPDATE = 1 shl 1;
+    { MUI's draw pens  }
+       MPEN_SHINE = 0;
+       MPEN_HALFSHINE = 1;
+       MPEN_BACKGROUND = 2;
+       MPEN_HALFSHADOW = 3;
+       MPEN_SHADOW = 4;
+       MPEN_TEXT = 5;
+       MPEN_FILL = 6;
+       MPEN_MARK = 7;
+       MPEN_COUNT = 8;
+    { Mask for pens from MUI_ObtainPen()  }
+       MUIPEN_MASK = $0000ffff;
+  
+
+    { Information on display environment  }
+    { valid between MUIM_Setup/MUIM_Cleanup  }
+    { valid between MUIM_Setup/MUIM_Cleanup  }
+    { valid between MUIM_Setup/MUIM_Cleanup  }
+    { valid between MUIM_Setup/MUIM_Cleanup  }
+    { valid between MUIM_Show/MUIM_Hide  }
+    { valid between MUIM_Show/MUIM_Hide  }
+    { valid between MUIM_Setup/MUIM_Cleanup  }
+    { ... private data follows ...  }
+
+   
+
+    {
+       If mri_Flags & MUIMRI_RECTFILL, RectFill() is quicker
+       than Move()/Draw() for horizontal or vertical lines.
+       on the current display.
+     }
+
+    const
+       MUIMRI_RECTFILL = 1 shl 0;
+    {
+       If mri_Flags & MUIMRI_TRUECOLOR, display environment is a
+       cybergraphics emulated hicolor or true color display.
+     }
+       MUIMRI_TRUECOLOR = 1 shl 1;
+    {
+       If mri_Flags & MUIMRI_THINFRAMES, MUI uses thin frames
+       (1:1) apsect ratio instead of standard 2:1 frames.
+     }
+       MUIMRI_THINFRAMES = 1 shl 2;
+    {
+       If mri_Flags & MUIMRI_REFRESHMODE, MUI is currently
+       refreshing a WFLG_SIMPLEREFRESH window and is between
+       a BeginRefresh()/EndRefresh() pair.
+     }
+       MUIMRI_REFRESHMODE = 1 shl 3;
+    { the following macros can be used to get pointers to an objects
+       GlobalInfo and RenderInfo structures.  }
+
+    type
+       t__dummyXFC2__ = record
+            mnd : tMUI_NotifyData;
+            mad : tMUI_AreaData;
+         end;
+       p__dummyXFC2__ = ^t__dummyXFC2__;
+   
+
+    const
+
+        MUIKEY_RELEASE = -2;
+	MUIKEY_NONE    = -1;
+	MUIKEY_PRESS   = 0;
+	MUIKEY_TOGGLE  = 1;
+	MUIKEY_UP      = 2;
+	MUIKEY_DOWN    = 3;
+	MUIKEY_PAGEUP  = 4;
+	MUIKEY_PAGEDOWN = 5;
+	MUIKEY_TOP      = 6;
+	MUIKEY_BOTTOM   = 7;
+	MUIKEY_LEFT     = 8;
+	MUIKEY_RIGHT    = 9;
+	MUIKEY_WORDLEFT = 10;
+	MUIKEY_WORDRIGHT = 11;
+	MUIKEY_LINESTART = 12;
+	MUIKEY_LINEEND   = 13;
+	MUIKEY_GADGET_NEXT = 14;
+	MUIKEY_GADGET_PREV = 15;
+	MUIKEY_GADGET_OFF  = 16;
+	MUIKEY_WINDOW_CLOSE = 17;
+	MUIKEY_WINDOW_NEXT  = 18;
+	MUIKEY_WINDOW_PREV  = 19;
+	MUIKEY_HELP         = 20;
+	MUIKEY_POPUP        = 21;
+	MUIKEY_COUNT        = 22;
+
+       MUIKEYF_PRESS = 1 shl MUIKEY_PRESS;
+       MUIKEYF_TOGGLE = 1 shl MUIKEY_TOGGLE;
+       MUIKEYF_UP = 1 shl MUIKEY_UP;
+       MUIKEYF_DOWN = 1 shl MUIKEY_DOWN;
+       MUIKEYF_PAGEUP = 1 shl MUIKEY_PAGEUP;
+       MUIKEYF_PAGEDOWN = 1 shl MUIKEY_PAGEDOWN;
+       MUIKEYF_TOP = 1 shl MUIKEY_TOP;
+       MUIKEYF_BOTTOM = 1 shl MUIKEY_BOTTOM;
+       MUIKEYF_LEFT = 1 shl MUIKEY_LEFT;
+       MUIKEYF_RIGHT = 1 shl MUIKEY_RIGHT;
+       MUIKEYF_WORDLEFT = 1 shl MUIKEY_WORDLEFT;
+       MUIKEYF_WORDRIGHT = 1 shl MUIKEY_WORDRIGHT;
+       MUIKEYF_LINESTART = 1 shl MUIKEY_LINESTART;
+       MUIKEYF_LINEEND = 1 shl MUIKEY_LINEEND;
+       MUIKEYF_GADGET_NEXT = 1 shl MUIKEY_GADGET_NEXT;
+       MUIKEYF_GADGET_PREV = 1 shl MUIKEY_GADGET_PREV;
+       MUIKEYF_GADGET_OFF = 1 shl MUIKEY_GADGET_OFF;
+       MUIKEYF_WINDOW_CLOSE = 1 shl MUIKEY_WINDOW_CLOSE;
+       MUIKEYF_WINDOW_NEXT = 1 shl MUIKEY_WINDOW_NEXT;
+       MUIKEYF_WINDOW_PREV = 1 shl MUIKEY_WINDOW_PREV;
+       MUIKEYF_HELP = 1 shl MUIKEY_HELP;
+       MUIKEYF_POPUP = 1 shl MUIKEY_POPUP;
+
+    { MUI_CustomClass returned by MUI_CreateCustomClass()  }
+    { use for whatever you want  }
+    { MUI has opened these libraries  }
+    { for you automatically. You can  }
+    { use them or decide to open      }
+    { your libraries yourself.        }
+    { pointer to super class    }
+    { pointer to the new class  }
+    { ... private data follows ...  }
+
+    type
+       tMUI_CustomClass = record
+            mcc_UserData : APTR;
+            mcc_UtilityBase : PLibrary;
+            mcc_DOSBase : PLibrary;
+            mcc_GfxBase : PLibrary;
+            mcc_IntuitionBase : PLibrary;
+            mcc_Super : PIClass;
+            mcc_Class : PIClass;
+         end;
+       pMUI_CustomClass = ^tMUI_CustomClass;
+
+FUNCTION MUI_NewObjectA(class_ : pChar; tags : pTagItem) : pObject_;
+PROCEDURE MUI_DisposeObject(obj : pObject_);
+FUNCTION MUI_RequestA(app : POINTER; win : POINTER; flags : LONGBITS; title : pChar; gadgets : pChar; format : pChar; params : POINTER) : LONGINT;
+FUNCTION MUI_AllocAslRequest(typ : ULONG; tags : pTagItem) : POINTER;
+FUNCTION MUI_AslRequest(req : POINTER; tags : pTagItem) : BOOLEAN;
+PROCEDURE MUI_FreeAslRequest(req : POINTER);
+FUNCTION MUI_Error : LONGINT;
+FUNCTION MUI_SetError(errnum : LONGINT) : LONGINT;
+FUNCTION MUI_GetClass(name : pCHar) : pIClass;
+PROCEDURE MUI_FreeClass(cl : pIClass);
+PROCEDURE MUI_RequestIDCMP(obj : pObject_; flags : ULONG);
+PROCEDURE MUI_RejectIDCMP(obj : pObject_; flags : ULONG);
+PROCEDURE MUI_Redraw(obj : pObject_; flags : ULONG);
+FUNCTION MUI_CreateCustomClass(base : pLibrary; supername : pChar; supermcc : pMUI_CustomClass; datasize : LONGINT; dispatcher : POINTER) : pMUI_CustomClass;
+FUNCTION MUI_DeleteCustomClass(mcc : pMUI_CustomClass) : BOOLEAN;
+FUNCTION MUI_MakeObjectA(typ: LONGINT; params : pULONG) : pULONG;
+FUNCTION MUI_Layout(obj : pObject_; l : LONGINT; t : LONGINT; w : LONGINT; h : LONGINT; flags : ULONG) : BOOLEAN;
+FUNCTION MUI_ObtainPen(mri : pMUI_RenderInfo; spec : pMUI_PenSpec; flags : ULONG) : LONGINT;
+PROCEDURE MUI_ReleasePen(mri : pMUI_RenderInfo; pen : LONGINT);
+FUNCTION MUI_AddClipping(mri : pMUI_RenderInfo; l : smallint; t : smallint; w : smallint; h : smallint) : POINTER;
+PROCEDURE MUI_RemoveClipping(mri : pMUI_RenderInfo; h : POINTER);
+FUNCTION MUI_AddClipRegion(mri : pMUI_RenderInfo; region : pRegion) : POINTER;
+PROCEDURE MUI_RemoveClipRegion(mri : pMUI_RenderInfo; region : POINTER);
+FUNCTION MUI_BeginRefresh(mri : pMUI_RenderInfo; flags : ULONG) : BOOLEAN;
+PROCEDURE MUI_EndRefresh(mri : pMUI_RenderInfo; flags : ULONG);
+
+
+(*
+** some procedures to get some information about our object 
+*)
+
+function MUINotifyData(obj : APTR) : pMUI_NotifyData;
+function MUIAreaData(obj : APTR) : pMUI_AreaData;
+function MUIGlobalInfo(obj : APTR) : pMUI_GlobalInfo;
+function MUIUserData(obj : APTR) : Pointer ;
+function MUIRenderInfo(obj : APTR) : pMUI_RenderInfo;
+function MUIPen(pen : longint): longint;
+(*
+** some more specialized functions to retain information about special
+** object-data like rastport, window, etc.
+**
+** NOTE: These macros may only be used in custom classes and are
+** only valid if your class is inbetween the specified methods!
+*)
+
+function OBJ_App(obj : APTR) : pObject_;       (* valid between MUIM_Setup/Cleanup *)
+function OBJ_Win(obj : APTR) : pObject_;       (* valid between MUIM_Setup/Cleanup *)
+function OBJ_Dri(obj : APTR) : pDrawInfo;          (* valid between MUIM_Setup/Cleanup *)
+function OBJ_Screen(obj : APTR) : pScreen;         (* valid between MUIM_Setup/Cleanup *)
+function OBJ_Pens(obj : APTR) : pWord;             (* valid between MUIM_Setup/Cleanup *)
+function OBJ_Window(obj : APTR) : pWindow;         (* valid between MUIM_Show/Hide *)
+function OBJ_Rp(obj : APTR) : pRastPort;           (* valid between MUIM_Show/Hide *)
+function OBJ_Left(obj : APTR) : smallint;           (* valid during MUIM_Draw *)
+function OBJ_Top(obj : APTR) : smallint;            (* valid during MUIM_Draw *)
+function OBJ_Width(obj : APTR) : smallint;          (* valid during MUIM_Draw *)
+function OBJ_Height(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+function OBJ_Right(obj : APTR) : smallint;          (* valid during MUIM_Draw *)
+function OBJ_Bottom(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+function OBJ_AddLeft(obj : APTR) : smallint;        (* valid during MUIM_Draw *)
+function OBJ_AddTop(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+function OBJ_SubWidth(obj : APTR) : smallint;       (* valid during MUIM_Draw *)
+function OBJ_SubHeight(obj : APTR) : smallint;      (* valid during MUIM_Draw *)
+function OBJ_MLeft(obj : APTR) : smallint;          (* valid during MUIM_Draw *)
+function OBJ_MTop(obj : APTR) : smallint;           (* valid during MUIM_Draw *)
+function OBJ_MWidth(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+function OBJ_MHeight(obj : APTR) : smallint;        (* valid during MUIM_Draw *)
+function OBJ_MRight(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+function OBJ_MBottom(obj : APTR) : smallint;        (* valid during MUIM_Draw *)
+function OBJ_Font(obj : APTR) : pTextFont;         (* valid between MUIM_Setup/Cleanup *)
+function OBJ_MinWidth(obj : APTR) : ULONG;         (* valid between MUIM_Show/Hide *)
+function OBJ_MinHeight(obj : APTR) : ULONG;        (* valid between MUIM_Show/Hide *)
+function OBJ_MaxWidth(obj : APTR) : ULONG;         (* valid between MUIM_Show/Hide *)
+function OBJ_MaxHeight(obj : APTR) : ULONG;        (* valid between MUIM_Show/Hide *)
+function OBJ_DefWidth(obj : APTR) : ULONG;         (* valid between MUIM_Show/Hide *)
+function OBJ_DefHeight(obj : APTR) : ULONG;        (* valid between MUIM_Show/Hide *)
+function OBJ_Flags(obj : APTR) : ULONG;
+
+function OBJ_Between(a,x,b : smallint): boolean;
+function OBJ_IsInObject(x,y : smallint; obj : pObject_): boolean;
+
+function MUIV_Window_AltHeight_MinMax(p : longint) : longint;
+function MUIV_Window_AltHeight_Visible(p : longint) : longint;
+function MUIV_Window_AltHeight_Screen(p : longint) : longint;
+function MUIV_Window_AltTopEdge_Delta(p : longint) : longint;
+function MUIV_Window_AltWidth_MinMax(p : longint) : longint;
+function MUIV_Window_AltWidth_Visible(p : longint) : longint;
+function MUIV_Window_AltWidth_Screen(p : longint) : longint;
+function MUIV_Window_Height_MinMax(p : longint) : longint;
+function MUIV_Window_Height_Visible(p : longint) : longint;
+function MUIV_Window_Height_Screen(p : longint) : longint;
+function MUIV_Window_TopEdge_Delta(p : longint) : longint;
+function MUIV_Window_Width_MinMax(p : longint) : longint;
+function MUIV_Window_Width_Visible(p : longint) : longint;
+function MUIV_Window_Width_Screen(p : longint) : longint;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION MUI_AllocAslRequestTags(_type : longword; const tags : Array Of Const) : POINTER;
+FUNCTION MUI_AslRequestTags(req : POINTER; const tags : Array Of Const) : BOOLEAN;
+FUNCTION MUI_MakeObject(_type : LONGINT; const params : Array Of Const) : pULONG;
+FUNCTION MUI_NewObject(a0arg : pCHAR; const tags : Array Of Const) : pULONG;
+FUNCTION MUI_Request(app : POINTER; win : POINTER; flags : longword; title : pCHAR; gadgets : pCHAR; format : pCHAR; const params : Array Of Const) : LONGINT;
+
+VAR MUIMasterBase : pLibrary;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitMUIMASTERLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    MUIMASTERIsCompiledHow : longint;
+
+implementation
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray,longarray;
+
+function MUINotifyData(obj : APTR) : pMUI_NotifyData;
+begin
+    MUINotifyData := pMUI_NotifyData(@p__dummyXFC2__(obj)^.mnd);
+end;
+
+function MUIAreaData(obj : APTR) : pMUI_AreaData;
+begin
+    MUIAreaData := pMUI_AreaData(@p__dummyXFC2__(obj)^.mad);
+end;
+
+function MUIGlobalInfo(obj : APTR) : pMUI_GlobalInfo;
+begin
+    MUIGlobalInfo := pMUI_GlobalInfo(p__dummyXFC2__(obj)^.mnd.mnd_GlobalInfo);
+end;
+
+function MUIUserData(obj : APTR) : Pointer ;
+begin
+    MUIUserData := Pointer(p__dummyXFC2__(obj)^.mnd.mnd_GlobalInfo);
+end;
+
+function MUIRenderInfo(obj : APTR) : pMUI_RenderInfo;
+begin
+    MUIRenderInfo := pMUI_RenderInfo(p__dummyXFC2__(obj)^.mad.mad_RenderInfo);
+end;
+
+function MUIPen(pen : longint): longint;
+begin
+    MUIPen := longint(pen*MUIPEN_Mask);
+end;
+
+function OBJ_App(obj : APTR) : pObject_;       (* valid between MUIM_Setup/Cleanup *)
+begin
+    OBJ_App := pMUI_GlobalInfo(obj)^.mgi_ApplicationObject;
+end;
+
+function OBJ_Win(obj : APTR) : pObject_;       (* valid between MUIM_Setup/Cleanup *)
+begin
+    OBJ_Win := pMUI_RenderInfo(obj)^.mri_WindowObject;
+end;
+
+function OBJ_Dri(obj : APTR) : pDrawInfo;          (* valid between MUIM_Setup/Cleanup *)
+begin
+    OBJ_Dri := pMUI_RenderInfo(obj)^.mri_DrawInfo;
+end;
+
+function OBJ_Screen(obj : APTR) : pScreen;         (* valid between MUIM_Setup/Cleanup *)
+begin
+    OBJ_Screen := pMUI_RenderInfo(obj)^.mri_Screen;
+end;
+
+function OBJ_Pens(obj : APTR) : pWord;      (* valid between MUIM_Setup/Cleanup *)
+begin
+    OBJ_Pens := pMUI_RenderInfo(obj)^.mri_Pens;
+end;
+
+function OBJ_Window(obj : APTR) : pWindow;         (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_Window := PMUI_RenderInfo(obj)^.mri_Window;
+end;
+
+function OBJ_Rp(obj : APTR) : pRastPort;           (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_Rp := pMUI_RenderInfo(obj)^.mri_RastPort;
+end;
+
+function OBJ_Left(obj : APTR) : smallint;           (* valid during MUIM_Draw *)
+begin
+    OBJ_Left := pMUI_AreaData(obj)^.mad_Box.Left;
+end;
+
+function OBJ_Top(obj : APTR) : smallint;            (* valid during MUIM_Draw *)
+begin
+    OBJ_Top := pMUI_AreaData(obj)^.mad_Box.Top;
+end;
+
+function OBJ_Width(obj : APTR) : smallint;          (* valid during MUIM_Draw *)
+begin
+    OBJ_Width := pMUI_AreaData(obj)^.mad_Box.Width;
+end;
+
+function OBJ_Height(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+begin
+    OBJ_Height := pMUI_AreaData(obj)^.mad_Box.Height;
+end;
+
+function OBJ_Right(obj : APTR) : smallint;          (* valid during MUIM_Draw *)
+begin
+    OBJ_Right := OBJ_Left(obj) + OBJ_Width(obj) -1;
+end;
+
+function OBJ_Bottom(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+begin
+    OBJ_Bottom := OBJ_Top(obj) + OBJ_Height(obj) -1;
+end;
+
+function OBJ_AddLeft(obj : APTR) : smallint;        (* valid during MUIM_Draw *)
+begin
+    OBJ_AddLeft := pMUI_AreaData(obj)^.mad_AddLeft;
+end;
+
+function OBJ_AddTop(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+begin
+    OBJ_AddTop := pMUI_AreaData(obj)^.mad_AddTop;
+end;
+
+function OBJ_SubWidth(obj : APTR) : smallint;       (* valid during MUIM_Draw *)
+begin
+    OBJ_SubWidth := pMUI_AreaData(obj)^.mad_SubWidth;
+end;
+
+function OBJ_SubHeight(obj : APTR) : smallint;      (* valid during MUIM_Draw *)
+begin
+    OBJ_SubHeight := pMUI_AreaData(obj)^.mad_SubHeight;
+end;
+
+function OBJ_MLeft(obj : APTR) : smallint;          (* valid during MUIM_Draw *)
+begin
+    OBJ_MLeft := OBJ_Left(obj) + OBJ_AddLeft(obj);
+end;
+
+function OBJ_MTop(obj : APTR) : smallint;           (* valid during MUIM_Draw *)
+begin
+    OBJ_MTop := OBJ_Top(obj) + OBJ_AddTop(obj);
+end;
+
+function OBJ_MWidth(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+begin
+    OBJ_MWidth := OBJ_Width(obj) -OBJ_SubWidth(obj);
+end;
+
+function OBJ_MHeight(obj : APTR) : smallint;        (* valid during MUIM_Draw *)
+begin
+    OBJ_MHeight := OBJ_Height(obj) - OBJ_SubHeight(obj);
+end;
+
+function OBJ_MRight(obj : APTR) : smallint;         (* valid during MUIM_Draw *)
+begin
+    OBJ_MRight := OBJ_MLeft(obj) + OBJ_MWidth(obj) -1;
+end;
+
+function OBJ_MBottom(obj : APTR) : smallint;        (* valid during MUIM_Draw *)
+begin
+    OBJ_MBottom := OBJ_MTop(obj) + OBJ_MHeight(obj) -1;
+end;
+
+function OBJ_Font(obj : APTR) : pTextFont;         (* valid between MUIM_Setup/Cleanup *)
+begin
+    OBJ_Font := pMUI_AreaData(obj)^.mad_Font;
+end;
+
+function OBJ_MinWidth(obj : APTR) : ULONG;         (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_MinWidth := pMUI_AreaData(obj)^.mad_MinMax.MinWidth;
+end;
+
+function OBJ_MinHeight(obj : APTR) : ULONG;        (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_MinHeight := pMUI_AreaData(obj)^.mad_MinMax.MinHeight;
+end;
+
+function OBJ_MaxWidth(obj : APTR) : ULONG;         (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_maxWidth := pMUI_AreaData(obj)^.mad_MinMax.MaxWidth;
+end;
+
+function OBJ_MaxHeight(obj : APTR) : ULONG;        (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_maxHeight := pMUI_AreaData(obj)^.mad_MinMax.MaxHeight;
+end;
+
+function OBJ_DefWidth(obj : APTR) : ULONG;         (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_DefWidth := pMUI_AreaData(obj)^.mad_MinMax.DefWidth;
+end;
+
+function OBJ_DefHeight(obj : APTR) : ULONG;        (* valid between MUIM_Show/Hide *)
+begin
+    OBJ_DefHeight := pMUI_AreaData(obj)^.mad_MinMax.DefHeight;
+end;
+
+function OBJ_Flags(obj : APTR) : ULONG; 
+begin
+    OBJ_Flags := pMUI_AreaData(obj)^.mad_Flags;
+end;
+
+(*
+** 2 useful procedures for testing if some coordinates are inside your object
+** (converted from the ones in class3.c. So look there how to use... )
+*)
+
+function OBJ_Between(a,x,b : smallint): boolean;
+begin
+    OBJ_Between := ((x>=a) and (x<=b));
+end;
+
+function OBJ_IsInObject(x,y : smallint; obj : pObject_): boolean;
+begin
+    OBJ_IsInObject := (OBJ_Between(OBJ_MLeft(obj),x,OBJ_MRight(obj))
+        and OBJ_Between(OBJ_MTop(obj),y,OBJ_MBottom(obj)));
+end;
+
+function MUIV_Window_AltHeight_MinMax(p : longint) : longint;
+begin
+    MUIV_Window_AltHeight_MinMax := (0 - p);
+end;
+
+function MUIV_Window_AltHeight_Visible(p : longint) : longint;
+begin
+    MUIV_Window_AltHeight_Visible := (-100 - (p));
+end;
+
+function MUIV_Window_AltHeight_Screen(p : longint) : longint;
+begin
+    MUIV_Window_AltHeight_Screen := (-200 - (p));
+end;
+
+function MUIV_Window_AltTopEdge_Delta(p : longint) : longint;
+begin
+    MUIV_Window_AltTopEdge_Delta := (-3 - (p));
+end;
+
+function MUIV_Window_AltWidth_MinMax(p : longint) : longint;
+begin
+    MUIV_Window_AltWidth_MinMax := 0 - p;
+end;
+
+function MUIV_Window_AltWidth_Visible(p : longint) : longint;
+begin
+    MUIV_Window_AltWidth_Visible := (-100 - (p));
+end;
+
+function MUIV_Window_AltWidth_Screen(p : longint) : longint;
+begin
+    MUIV_Window_AltWidth_Screen := (-200 - (p));
+end;
+
+function MUIV_Window_Height_MinMax(p : longint) : longint;
+begin
+    MUIV_Window_Height_MinMax := 0 - p;
+end;
+
+function MUIV_Window_Height_Visible(p : longint) : longint;
+begin
+    MUIV_Window_Height_Visible := (-100 - (p));
+end;
+
+function MUIV_Window_Height_Screen(p : longint) : longint;
+begin
+    MUIV_Window_Height_Screen := (-200 - (p));
+end;
+
+function MUIV_Window_TopEdge_Delta(p : longint) : longint;
+begin
+    MUIV_Window_TopEdge_Delta := (-3 - (p));
+end;
+
+function MUIV_Window_Width_MinMax(p : longint) : longint;
+begin
+    MUIV_Window_Width_MinMax := 0 - p;
+end;
+
+function MUIV_Window_Width_Visible(p : longint) : longint;
+begin
+    MUIV_Window_Width_Visible := (-100 - (p));
+end;
+
+function MUIV_Window_Width_Screen(p : longint) : longint;
+begin
+    MUIV_Window_Width_Screen := (-200 - (p));
+end;
+
+FUNCTION MUI_NewObjectA(class_ : pCHar; tags : pTagItem) : pObject_;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	class_,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MUI_DisposeObject(obj : pObject_);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	obj,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MUI_RequestA(app : POINTER; win : POINTER; flags : LONGBITS; title : pCHar; gadgets : pChar; format : pChar; params : POINTER) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	app,D0
+	MOVE.L	win,D1
+	MOVE.L	flags,D2
+	MOVEA.L	title,A0
+	MOVEA.L	gadgets,A1
+	MOVEA.L	format,A2
+	MOVEA.L	params,A3
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_AllocAslRequest(typ : ULONG; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	typ,D0
+	MOVEA.L	tags,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_AslRequest(req : POINTER; tags : pTagItem) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	req,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MUI_FreeAslRequest(req : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	req,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MUI_Error : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_SetError(errnum : LONGINT) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	errnum,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_GetClass(name : pChar) : pIClass;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MUI_FreeClass(cl : pIClass);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	cl,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MUI_RequestIDCMP(obj : pObject_; flags : ULONG);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	obj,A0
+	MOVE.L	flags,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MUI_RejectIDCMP(obj : pObject_; flags : ULONG);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	obj,A0
+	MOVE.L	flags,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MUI_Redraw(obj : pObject_; flags : ULONG);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	obj,A0
+	MOVE.L	flags,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MUI_CreateCustomClass(base : pLibrary; supername : pChar; supermcc : pMUI_CustomClass; datasize : LONGINT; dispatcher : POINTER) : pMUI_CustomClass;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	base,A0
+	MOVEA.L	supername,A1
+	MOVEA.L	supermcc,A2
+	MOVE.L	datasize,D0
+	MOVEA.L	dispatcher,A3
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_DeleteCustomClass(mcc : pMUI_CustomClass) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mcc,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_MakeObjectA(typ : LONGINT; params : pULONG) : pObject_;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	typ,D0
+	MOVEA.L	params,A0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MUI_Layout(obj : pObject_; l : LONGINT; t : LONGINT; w : LONGINT; h : LONGINT; flags : ULONG) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	obj,A0
+	MOVE.L	l,D0
+	MOVE.L	t,D1
+	MOVE.L	w,D2
+	MOVE.L	h,D3
+	MOVE.L	flags,D4
+	MOVEA.L	MUIMasterBase,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 MUI_ObtainPen(mri : pMUI_RenderInfo; spec : pMUI_PenSpec; flags : ULONG) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVEA.L	spec,A1
+	MOVE.L	flags,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MUI_ReleasePen(mri : pMUI_RenderInfo; pen : LONGINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVE.L	pen,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MUI_AddClipping(mri : pMUI_RenderInfo; l : smallint; t : smallint; w : smallint; h : smallint) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVE.L	l,D0
+	MOVE.L	t,D1
+	MOVE.L	w,D2
+	MOVE.L	h,D3
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MUI_RemoveClipping(mri : pMUI_RenderInfo; h : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVEA.L	h,A1
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-174(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MUI_AddClipRegion(mri : pMUI_RenderInfo; region : pRegion) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVEA.L	region,A1
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-180(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MUI_RemoveClipRegion(mri : pMUI_RenderInfo; region : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVEA.L	region,A1
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-186(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MUI_BeginRefresh(mri : pMUI_RenderInfo; flags : ULONG) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVE.L	flags,D0
+	MOVEA.L	MUIMasterBase,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 MUI_EndRefresh(mri : pMUI_RenderInfo; flags : ULONG);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mri,A0
+	MOVE.L	flags,D0
+	MOVEA.L	MUIMasterBase,A6
+	JSR	-198(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION MUI_AllocAslRequestTags(_type : longword; const tags : Array Of Const) : POINTER;
+begin
+    MUI_AllocAslRequestTags := MUI_AllocAslRequest(_type , readintags(tags));
+end;
+
+FUNCTION MUI_AslRequestTags(req : POINTER; const tags : Array Of Const) : BOOLEAN;
+begin
+    MUI_AslRequestTags := MUI_AslRequest(req , readintags(tags));
+end;
+
+FUNCTION MUI_MakeObject(_type : LONGINT; const params : Array Of Const) : pULONG;
+begin
+    MUI_MakeObject := MUI_MakeObjectA(_type , readinlongs(params));
+end;
+
+FUNCTION MUI_NewObject(a0arg : pCHAR; const tags : Array Of Const) : pULONG;
+begin
+    MUI_NewObject := MUI_NewObjectA(a0arg , readintags(tags));
+end;
+
+FUNCTION MUI_Request(app : POINTER; win : POINTER; flags : longword; title : pCHAR; gadgets : pCHAR; format : pCHAR; const params : Array Of Const) : LONGINT;
+begin
+    MUI_Request := MUI_RequestA(app , win , flags , title , gadgets , format , readintags(params));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of muimaster.library}
+  {$Info don't forget to use InitMUIMASTERLibrary in the beginning of your program}
+
+var
+    muimaster_exit : Pointer;
+
+procedure ClosemuimasterLibrary;
+begin
+    ExitProc := muimaster_exit;
+    if MUIMasterBase <> nil then begin
+        CloseLibrary(MUIMasterBase);
+        MUIMasterBase := nil;
+    end;
+end;
+
+procedure InitMUIMASTERLibrary;
+begin
+    MUIMasterBase := nil;
+    MUIMasterBase := OpenLibrary(MUIMASTER_NAME,LIBVERSION);
+    if MUIMasterBase <> nil then begin
+        muimaster_exit := ExitProc;
+        ExitProc := @ClosemuimasterLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open muimaster.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    MUIMASTERIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of muimaster.library}
+
+var
+    muimaster_exit : Pointer;
+
+procedure ClosemuimasterLibrary;
+begin
+    ExitProc := muimaster_exit;
+    if MUIMasterBase <> nil then begin
+        CloseLibrary(MUIMasterBase);
+        MUIMasterBase := nil;
+    end;
+end;
+
+begin
+    MUIMasterBase := nil;
+    MUIMasterBase := OpenLibrary(MUIMASTER_NAME,LIBVERSION);
+    if MUIMasterBase <> nil then begin
+        muimaster_exit := ExitProc;
+        ExitProc := @ClosemuimasterLibrary;
+        MUIMASTERIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open muimaster.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    MUIMASTERIsCompiledHow := 3;
+   {$Warning No autoopening of muimaster.library compiled}
+   {$Warning Make sure you open muimaster.library yourself}
+{$endif dont_use_openlib}
+
+
+end.
+
+{
+  $Log
+}
+
+

+ 407 - 0
packages/extra/amunits/otherlibs/mysticview/units/mysticview.pas

@@ -0,0 +1,407 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for mysticview.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  16 Jan 2003.
+  
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}
+
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT MYSTICVIEW;
+
+INTERFACE
+USES Exec,graphics,utility,intuition;
+
+VAR MysticBase : pLibrary;
+
+const
+    MYSTICVIEWNAME : PChar = 'mysticview.library';
+
+  {
+        $VER: mysticview.h 4.2 (1.6.99)
+
+        mysticview.library definitions
+
+        © 1997-99 TEK neoscientists
+   }
+
+  {
+    	Tags
+    }
+
+  const
+     MVIEW_Dummy = TAG_USER + 765432;
+  { left edge in rastport }
+     MVIEW_DestX = MVIEW_Dummy + 1;
+  { top edge in rastport }
+     MVIEW_DestY = MVIEW_Dummy + 2;
+  { width in rastport }
+     MVIEW_DestWidth = MVIEW_Dummy + 3;
+  { height in rastport }
+     MVIEW_DestHeight = MVIEW_Dummy + 4;
+  { background color }
+     MVIEW_BackColor = MVIEW_Dummy + 5;
+  { OBP_Precision (view.h) }
+     MVIEW_Precision = MVIEW_Dummy + 6;
+  { aspect mode - see definitions below }
+     MVIEW_DisplayMode = MVIEW_Dummy + 7;
+  { preview mode - see definitions below }
+     MVIEW_PreviewMode = MVIEW_Dummy + 8;
+  { a guigfx.library picture }
+     MVIEW_Picture = MVIEW_Dummy + 9;
+  { simple text line }
+     MVIEW_Text = MVIEW_Dummy + 10;
+  { static palette }
+     MVIEW_StaticPalette = MVIEW_Dummy + 11;
+  { dither activation mode (see below) }
+     MVIEW_Dither = MVIEW_Dummy + 12;
+  { histogram type }
+     MVIEW_HSType = MVIEW_Dummy + 13;
+  { screen aspect horizontal }
+     MVIEW_ScreenAspectX = MVIEW_Dummy + 14;
+  { screen aspect vertical }
+     MVIEW_ScreenAspectY = MVIEW_Dummy + 15;
+  { dither mode }
+     MVIEW_DitherMode = MVIEW_Dummy + 16;
+  { display cursor }
+     MVIEW_ShowCursor = MVIEW_Dummy + 17;
+  { zoom factor (0.1 ... 10) }
+     MVIEW_Zoom = MVIEW_Dummy + 18;
+  { x position (0 ... 1) }
+     MVIEW_XPos = MVIEW_Dummy + 19;
+  { y position (0 ... 1) }
+     MVIEW_YPos = MVIEW_Dummy + 20;
+  { rotation (0 ... 1) }
+     MVIEW_Rotation = MVIEW_Dummy + 21;
+  { do not use }
+     MVIEW_AutoDither = MVIEW_Dummy + 22;
+  { picture fully drawn }
+     MVIEW_ReadySignal = MVIEW_Dummy + 23;
+  { picture X inside the rastport }
+     MVIEW_PictureX = MVIEW_Dummy + 24;
+  { picture Y inside the rastport }
+     MVIEW_PictureY = MVIEW_Dummy + 25;
+  { picture Width inside the rastport }
+     MVIEW_PictureWidth = MVIEW_Dummy + 26;
+  { picture Height inside the rastport }
+     MVIEW_PictureHeight = MVIEW_Dummy + 27;
+  { indicate scrollability }
+     MVIEW_DrawArrows = MVIEW_Dummy + 28;
+  { show PIP layer }
+     MVIEW_ShowPip = MVIEW_Dummy + 29;
+  { text/grid color }
+     MVIEW_TextColor = MVIEW_Dummy + 30;
+  { color for pip-border, cursor, arrows... }
+     MVIEW_MarkColor = MVIEW_Dummy + 31;
+  { rastport semaphore (MV_Create() only) }
+     MVIEW_RPSemaphore = MVIEW_Dummy + 32;
+  { set task priority (MV_Create() only) }
+     MVIEW_Priority = MVIEW_Dummy + 33;
+  {
+    	Types
+    }
+  { image fits exactly into view }
+     MVDISPMODE_FIT = 0;
+  { image is fully visible }
+     MVDISPMODE_KEEPASPECT_MIN = 1;
+  { width or height is fully visible }
+     MVDISPMODE_KEEPASPECT_MAX = 2;
+  { the image aspect is ignored }
+     MVDISPMODE_ONEPIXEL = 3;
+  { aspect ratios are ignored }
+     MVDISPMODE_IGNOREASPECT = 4;
+  { no realtime refresh }
+     MVPREVMODE_NONE = 0;
+  { grid realtime refresh }
+     MVPREVMODE_GRID = 1;
+  { opaque realtime refresh }
+     MVPREVMODE_OPAQUE = 2;
+  { dithering on }
+     MVDITHERMODE_ON = 0;
+  { dithering off }
+     MVDITHERMODE_OFF = 1;
+  { auto dithering  }
+     MVDITHERMODE_AUTO = 2;
+
+
+
+
+
+FUNCTION MV_CreateA(screen : pScreen; a1arg : pRastPort; tags : pTagItem) : POINTER;
+PROCEDURE MV_Delete(mview : POINTER);
+PROCEDURE MV_DrawOff(mview : POINTER);
+FUNCTION MV_DrawOn(mview : POINTER) : BOOLEAN;
+PROCEDURE MV_GetAttrsA(mview : POINTER; tags : pTagItem);
+PROCEDURE MV_Refresh(mview : POINTER);
+PROCEDURE MV_SetAttrsA(mview : POINTER; tags : pTagItem);
+PROCEDURE MV_SetViewRelative(mview : POINTER; x : LONGINT; y : LONGINT);
+PROCEDURE MV_SetViewStart(mview : POINTER; x : LONGINT; y : LONGINT);
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION MV_Create(screen : pScreen; a1arg : pRastPort; const tags : Array Of Const) : POINTER;
+PROCEDURE MV_GetAttrs(mview : POINTER; const tags : Array Of Const);
+PROCEDURE MV_SetAttrs(mview : POINTER; const tags : Array Of Const);
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitMYSTICVIEWLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    MYSTICVIEWIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+FUNCTION MV_CreateA(screen : pScreen; a1arg : pRastPort; tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	screen,A0
+	MOVEA.L	a1arg,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	MysticBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MV_Delete(mview : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVEA.L	MysticBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MV_DrawOff(mview : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVEA.L	MysticBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MV_DrawOn(mview : POINTER) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVEA.L	MysticBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MV_GetAttrsA(mview : POINTER; tags : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	MysticBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MV_Refresh(mview : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVEA.L	MysticBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MV_SetAttrsA(mview : POINTER; tags : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	MysticBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MV_SetViewRelative(mview : POINTER; x : LONGINT; y : LONGINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVEA.L	MysticBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MV_SetViewStart(mview : POINTER; x : LONGINT; y : LONGINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mview,A0
+	MOVE.L	x,D0
+	MOVE.L	y,D1
+	MOVEA.L	MysticBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION MV_Create(screen : pScreen; a1arg : pRastPort; const tags : Array Of Const) : POINTER;
+begin
+    MV_Create := MV_CreateA(screen , a1arg , readintags(tags));
+end;
+
+PROCEDURE MV_GetAttrs(mview : POINTER; const tags : Array Of Const);
+begin
+    MV_GetAttrsA(mview , readintags(tags));
+end;
+
+PROCEDURE MV_SetAttrs(mview : POINTER; const tags : Array Of Const);
+begin
+    MV_SetAttrsA(mview , readintags(tags));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of mysticview.library}
+  {$Info don't forget to use InitMYSTICVIEWLibrary in the beginning of your program}
+
+var
+    mysticview_exit : Pointer;
+
+procedure ClosemysticviewLibrary;
+begin
+    ExitProc := mysticview_exit;
+    if MysticBase <> nil then begin
+        CloseLibrary(MysticBase);
+        MysticBase := nil;
+    end;
+end;
+
+procedure InitMYSTICVIEWLibrary;
+begin
+    MysticBase := nil;
+    MysticBase := OpenLibrary(MYSTICVIEWNAME,LIBVERSION);
+    if MysticBase <> nil then begin
+        mysticview_exit := ExitProc;
+        ExitProc := @ClosemysticviewLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open mysticview.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    MYSTICVIEWIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of mysticview.library}
+
+var
+    mysticview_exit : Pointer;
+
+procedure ClosemysticviewLibrary;
+begin
+    ExitProc := mysticview_exit;
+    if MysticBase <> nil then begin
+        CloseLibrary(MysticBase);
+        MysticBase := nil;
+    end;
+end;
+
+begin
+    MysticBase := nil;
+    MysticBase := OpenLibrary(MYSTICVIEWNAME,LIBVERSION);
+    if MysticBase <> nil then begin
+        mysticview_exit := ExitProc;
+        ExitProc := @ClosemysticviewLibrary;
+        MYSTICVIEWIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open mysticview.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    MYSTICVIEWIsCompiledHow := 3;
+   {$Warning No autoopening of mysticview.library compiled}
+   {$Warning Make sure you open mysticview.library yourself}
+{$endif dont_use_openlib}
+
+END. (* UNIT MYSTICVIEW *)
+
+{
+  $Log
+}
+
+

+ 394 - 0
packages/extra/amunits/otherlibs/preferences/units/preferences.pas

@@ -0,0 +1,394 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for preferences.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  17 Jan 2003.
+  
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}  
+
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT PREFERENCES;
+
+INTERFACE
+USES Exec;
+
+VAR PreferencesBase : pLibrary;
+
+const
+    PREFERENCESNAME : PChar = 'preferences.library';
+
+
+  {
+      $VER: preferences.h 39.6 (26.07.2000)
+
+          preferences.library include
+
+      (C) Copyright 2000 Satanic Dreams Software
+      All Rights Reserved
+   }
+  { followed by the data, a total of ps_Size bytes  }
+
+  type
+     PPrefsStruct = ^tPrefsStruct;
+     tPrefsStruct = record
+          ps_Size : WORD;
+       end;
+
+  { -- Scalos specific Prefs: }
+  { ------------------ ScalosPrefs ------------------------- }
+  { Name: "Scalos" or "ScalosPrefs" }
+  { ID: "MAIN" }
+  { struct [8] }
+
+  const
+     SCP_IconOffsets = $80000001;
+  { word }
+     SCP_IconNormFrame = $80000002;
+  { word }
+     SCP_IconSelFrame = $80000003;
+  { word }
+     SCP_IconTextMode = $80000004;
+  { word }
+     SCP_IconSecLine = $80000005;
+  { word }
+     SCP_IconTextSkip = $80000006;
+  { byte image or image+text }
+     SCP_BobsType = $80000010;
+  { byte system or custom }
+     SCP_BobsMethod = $80000011;
+  { byte solid or transparent }
+     SCP_BobsTranspMode = $80000012;
+  { byte ghosted or real transparent }
+     SCP_BobsTranspType = $80000013;
+  { long when transparent }
+     SCP_BobsTransp = $80000014;
+  { string }
+     SCP_ScreenTitle = $80000020;
+  { string }
+     SCP_RootWinTitle = $80000021;
+  { string }
+     SCP_WindowTitle = $80000022;
+  { byte }
+     SCP_Separator = $80000023;
+  { byte }
+     SCP_TitleRefresh = $80000024;
+  { string }
+     SCP_PathsDefIcons = $80000025;
+  { string }
+     SCP_PathsDiskCopy = $80000026;
+  { string }
+     SCP_PathsWBStartup = $80000027;
+  { string }
+     SCP_PathsHome = $80000028;
+  { byte }
+     SCP_MiscAutoRemove = $80000029;
+  { byte }
+     SCP_MiscClickTransp = $8000002a;
+  { byte }
+     SCP_MiscHardEmulation = $8000002b;
+  { byte }
+     SCP_MiscUseExAll = $8000002c;
+  { byte }
+     SCP_MiscWindowType = $8000002d;
+  { byte }
+     SCP_MiscDoWaitDelay = $8000002e;
+  { byte delay }
+     SCP_MiscDiskiconsRefresh = $8000002f;
+  { byte }
+     SCP_MiscMenuCurrentDir = $80000030;
+  { byte }
+     SCP_NewIconsTransparent = $80000031;
+  { long }
+     SCP_NewIconsPrecision = $80000032;
+  { string }
+     SCP_TextModeFont = $80000033;
+  { byte }
+     SCP_TextModeDateFormat = $80000034;
+  { list }
+     SCP_PlugInList = $80000035;
+
+
+
+FUNCTION AllocPrefsHandle(name : pCHAR) : POINTER;
+FUNCTION FindPreferences(PrefsHandle : POINTER; ID : longword; d1arg : longword) : pPrefsStruct;
+PROCEDURE FreePrefsHandle(PrefsHandle : POINTER);
+FUNCTION GetEntry(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD; Entry : longword) : longword;
+FUNCTION GetPreferences(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD) : longword;
+PROCEDURE ReadPrefsHandle(PrefsHandle : POINTER; Filename : pCHAR);
+FUNCTION RemEntry(PrefsHandle : POINTER; ID : longword; d1arg : longword; Entry : longword) : longword;
+PROCEDURE SetEntry(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD; Entry : longword);
+PROCEDURE SetPreferences(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD);
+PROCEDURE WritePrefsHandle(PrefsHandle : POINTER; Filename : pCHAR);
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitPREFERENCESLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    PREFERENCESIsCompiledHow : longint;
+
+
+IMPLEMENTATION
+
+{$ifndef dont_use_openlib}
+uses msgbox;
+{$endif dont_use_openlib}
+
+FUNCTION AllocPrefsHandle(name : pCHAR) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	PreferencesBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION FindPreferences(PrefsHandle : POINTER; ID : longword; d1arg : longword) : pPrefsStruct;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVE.L	ID,D0
+	MOVE.L	d1arg,D1
+	MOVEA.L	PreferencesBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE FreePrefsHandle(PrefsHandle : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVEA.L	PreferencesBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION GetEntry(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD; Entry : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVE.L	ID,D0
+	MOVE.L	d1arg,D1
+	MOVEA.L	a1arg,A1
+	MOVE.L	Struct_Size,D2
+	MOVE.L	Entry,D3
+	MOVEA.L	PreferencesBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GetPreferences(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVE.L	ID,D0
+	MOVE.L	d1arg,D1
+	MOVEA.L	a1arg,A1
+	MOVE.L	Struct_Size,D2
+	MOVEA.L	PreferencesBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE ReadPrefsHandle(PrefsHandle : POINTER; Filename : pCHAR);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVEA.L	Filename,A1
+	MOVEA.L	PreferencesBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION RemEntry(PrefsHandle : POINTER; ID : longword; d1arg : longword; Entry : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVE.L	ID,D0
+	MOVE.L	d1arg,D1
+	MOVE.L	Entry,D2
+	MOVEA.L	PreferencesBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE SetEntry(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD; Entry : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVE.L	ID,D0
+	MOVE.L	d1arg,D1
+	MOVEA.L	a1arg,A1
+	MOVE.L	Struct_Size,D2
+	MOVE.L	Entry,D3
+	MOVEA.L	PreferencesBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE SetPreferences(PrefsHandle : POINTER; ID : longword; d1arg : longword; a1arg : POINTER; Struct_Size : WORD);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVE.L	ID,D0
+	MOVE.L	d1arg,D1
+	MOVEA.L	a1arg,A1
+	MOVE.L	Struct_Size,D2
+	MOVEA.L	PreferencesBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE WritePrefsHandle(PrefsHandle : POINTER; Filename : pCHAR);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PrefsHandle,A0
+	MOVEA.L	Filename,A1
+	MOVEA.L	PreferencesBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of preferences.library}
+  {$Info don't forget to use InitPREFERENCESLibrary in the beginning of your program}
+
+var
+    preferences_exit : Pointer;
+
+procedure ClosepreferencesLibrary;
+begin
+    ExitProc := preferences_exit;
+    if PreferencesBase <> nil then begin
+        CloseLibrary(PreferencesBase);
+        PreferencesBase := nil;
+    end;
+end;
+
+procedure InitPREFERENCESLibrary;
+begin
+    PreferencesBase := nil;
+    PreferencesBase := OpenLibrary(PREFERENCESNAME,LIBVERSION);
+    if PreferencesBase <> nil then begin
+        preferences_exit := ExitProc;
+        ExitProc := @ClosepreferencesLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open preferences.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    PREFERENCESIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of preferences.library}
+
+var
+    preferences_exit : Pointer;
+
+procedure ClosepreferencesLibrary;
+begin
+    ExitProc := preferences_exit;
+    if PreferencesBase <> nil then begin
+        CloseLibrary(PreferencesBase);
+        PreferencesBase := nil;
+    end;
+end;
+
+begin
+    PreferencesBase := nil;
+    PreferencesBase := OpenLibrary(PREFERENCESNAME,LIBVERSION);
+    if PreferencesBase <> nil then begin
+        preferences_exit := ExitProc;
+        ExitProc := @ClosepreferencesLibrary;
+        PREFERENCESIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open preferences.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    PREFERENCESIsCompiledHow := 3;
+   {$Warning No autoopening of preferences.library compiled}
+   {$Warning Make sure you open preferences.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT PREFERENCES *)
+
+{
+  $Log
+}
+
+

+ 56 - 0
packages/extra/amunits/otherlibs/ptreplay/examples/smallplay.pas

@@ -0,0 +1,56 @@
+program smallplay;
+
+{****************************************
+
+ PT-Player 2.0   © 1994 BetaSoft
+ 
+ uses PTReplay.library also by BetaSoft
+ and Andreas [Pucko] Pålsson
+ 
+****************************************}
+uses exec, amigados, ptreplay;
+
+const
+    vstr : pchar = '$VER: SmallPlay 2.0 (23.12.93)';
+
+var
+    module : pModule;
+    SigBit : shortint;
+    SigMask : longint;
+
+procedure CleanUp(why : string, err : integer);
+begin
+    if why <> '' then writeln(why);
+    halt(err);
+end;
+
+begin
+    module := nil;
+    if ParamCount > 1 then 
+       CleanUp('Specify one module only',20); 
+    if ParamCount < 0 then
+       CleanUp('Play what module?',20);
+
+    module := PTLoadModule(ParamStr[1]);
+    if not assigned(module) then
+       CleanUp('Couldn''t open/load module',20);
+    
+    SigBit := AllocSignal(-1);
+    if SigBit = -1 then
+       CleanUp('Couldn''t allocate signal',10);
+
+    PTInstallBits(module,SigBit,-1,-1,-1);
+    PTPlay(module);
+
+    SigMask := Wait(SIGBREAKF_CTRL_C or (1 shl SigBit));
+    if (SigMask and SIGBREAKF_CTRL_C) then
+        PTFade(module,1)
+    else
+        PTStop(module);
+
+    FreeSignal(SigBit);
+
+    PTUnloadModule(module);
+end.
+
+

+ 500 - 0
packages/extra/amunits/otherlibs/ptreplay/units/ptreplay.pas

@@ -0,0 +1,500 @@
+{
+    This file is part of the Free Pascal run time library.
+
+    A file in Amiga system run time library.
+    Copyright (c) 2000-2003 by Nils Sjoholm
+    member of the Amiga RTL development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{
+    History:
+
+    First version.
+    15 Oct 2000.
+
+    Updated for fpc 1.0.7
+    16 Jan 2003.
+
+    Changed integer > smallint.
+    Changed startcode for unit.
+    12 Feb 2003.
+    
+    [email protected]
+
+}
+
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT ptreplay;
+
+INTERFACE
+
+USES Exec;
+
+ const
+     PTREPLAYNAME : PChar = 'ptreplay.library';
+  { The rest is private for now, but more details may be released later.  }
+
+  type
+     PModule = ^TModule;
+     TModule = record
+          mod_Name : PChar;
+     { The rest is private for now, but more details may be released later.  }
+     end;
+
+     { This structure is returned by GetSample function  }
+     PPTSample = ^TPTSample;
+     TPTSample = record
+          Name     : array[0..21] of Char; { Null terminated string with samplename  }
+          Length   :  WORD;                { Sample length in words  }
+          FineTune : BYTE;                 { FineTune of sample in lower 4 bits  }
+          Volume   : BYTE;                 { Volume of sample  } 
+          Repeat_  : WORD;                 { Repeat start in number of words  }
+          Replen   : WORD;                 { Repeat length in number of words  }
+       end;
+
+VAR PTReplayBase : pLibrary;
+
+FUNCTION PTLoadModule(name : pCHAR) : pModule;
+PROCEDURE PTUnloadModule(module : pModule);
+FUNCTION PTPlay(module : pModule) : ULONG;
+FUNCTION PTStop(module : pModule) : ULONG;
+FUNCTION PTPause(module : pModule) : ULONG;
+FUNCTION PTResume(module : pModule) : ULONG;
+PROCEDURE PTFade(module : pModule; speed : BYTE);
+PROCEDURE PTSetVolume(module : pModule; vol : BYTE);
+FUNCTION PTSongPos(module : pModule) : BYTE;
+FUNCTION PTSongLen(module : pModule) : BYTE;
+FUNCTION PTSongPattern(module : pModule; Pos : WORD) : BYTE;
+FUNCTION PTPatternPos(Module : pModule) : BYTE;
+FUNCTION PTPatternData(Module : pModule; Pattern : BYTE; Row : BYTE) : POINTER;
+PROCEDURE PTInstallBits(Module : pModule; Restart : SHORTINT; NextPattern : SHORTINT; NextRow : SHORTINT; Fade : SHORTINT);
+FUNCTION PTSetupMod(ModuleFile : POINTER) : pModule;
+PROCEDURE PTFreeMod(Module : pModule);
+PROCEDURE PTStartFade(Module : pModule; speed : BYTE);
+PROCEDURE PTOnChannel(Module : pModule; Channels : SHORTINT);
+PROCEDURE PTOffChannel(Module : pModule; Channels : SHORTINT);
+PROCEDURE PTSetPos(Module : pModule; Pos : BYTE);
+PROCEDURE PTSetPri(Pri : SHORTINT);
+FUNCTION PTGetPri : SHORTINT;
+FUNCTION PTGetChan : SHORTINT;
+FUNCTION PTGetSample(Module : pModule; Nr : smallint) : pPTSample;
+
+FUNCTION PTLoadModule(name : string) : pModule;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitPTREPLAYLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    PTREPLAYIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+pastoc;
+
+FUNCTION PTLoadModule(name : pCHAR) : pModule;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	name,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE PTUnloadModule(module : pModule);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION PTPlay(module : pModule) : ULONG;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTStop(module : pModule) : ULONG;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTPause(module : pModule) : ULONG;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTResume(module : pModule) : ULONG;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE PTFade(module : pModule; speed : BYTE);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVE.L	speed,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE PTSetVolume(module : pModule; vol : BYTE);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVE.L	vol,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION PTSongPos(module : pModule) : BYTE;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTSongLen(module : pModule) : BYTE;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTSongPattern(module : pModule; Pos : WORD) : BYTE;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	module,A0
+	MOVE.L	Pos,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTPatternPos(Module : pModule) : BYTE;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTPatternData(Module : pModule; Pattern : BYTE; Row : BYTE) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.L	Pattern,D0
+	MOVE.L	Row,D1
+	MOVEA.L	PTReplayBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE PTInstallBits(Module : pModule; Restart : SHORTINT; NextPattern : SHORTINT; NextRow : SHORTINT; Fade : SHORTINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.L	Restart,D0
+	MOVE.L	NextPattern,D1
+	MOVE.L	NextRow,D2
+	MOVE.L	Fade,D3
+	MOVEA.L	PTReplayBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION PTSetupMod(ModuleFile : POINTER) : pModule;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ModuleFile,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE PTFreeMod(Module : pModule);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE PTStartFade(Module : pModule; speed : BYTE);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.L	speed,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE PTOnChannel(Module : pModule; Channels : SHORTINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.L	Channels,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE PTOffChannel(Module : pModule; Channels : SHORTINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.L	Channels,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-138(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE PTSetPos(Module : pModule; Pos : BYTE);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.L	Pos,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-144(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE PTSetPri(Pri : SHORTINT);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	Pri,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION PTGetPri : SHORTINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PTReplayBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTGetChan : SHORTINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	PTReplayBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.B	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTGetSample(Module : pModule; Nr : smallint) : pPTSample;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	Module,A0
+	MOVE.W	Nr,D0
+	MOVEA.L	PTReplayBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION PTLoadModule(name : string) : pModule;
+begin
+    PTLoadModule := PTLoadModule(pas2c(name));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of ptreplay.library}
+  {$Info don't forget to use InitPTREPLAYLibrary in the beginning of your program}
+
+var
+    ptreplay_exit : Pointer;
+
+procedure CloseptreplayLibrary;
+begin
+    ExitProc := ptreplay_exit;
+    if PTReplayBase <> nil then begin
+        CloseLibrary(PTReplayBase);
+        PTReplayBase := nil;
+    end;
+end;
+
+procedure InitPTREPLAYLibrary;
+begin
+    PTReplayBase := nil;
+    PTReplayBase := OpenLibrary(PTREPLAYNAME,LIBVERSION);
+    if PTReplayBase <> nil then begin
+        ptreplay_exit := ExitProc;
+        ExitProc := @CloseptreplayLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ptreplay.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    PTREPLAYIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of ptreplay.library}
+
+var
+    ptreplay_exit : Pointer;
+
+procedure CloseptreplayLibrary;
+begin
+    ExitProc := ptreplay_exit;
+    if PTReplayBase <> nil then begin
+        CloseLibrary(PTReplayBase);
+        PTReplayBase := nil;
+    end;
+end;
+
+begin
+    PTReplayBase := nil;
+    PTReplayBase := OpenLibrary(PTREPLAYNAME,LIBVERSION);
+    if PTReplayBase <> nil then begin
+        ptreplay_exit := ExitProc;
+        ExitProc := @CloseptreplayLibrary;
+        PTREPLAYIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ptreplay.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    PTREPLAYIsCompiledHow := 3;
+   {$Warning No autoopening of ptreplay.library compiled}
+   {$Warning Make sure you open ptreplay.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT PTREPLAY *)
+
+
+{
+  $Log
+}
+
+
+
+

+ 1354 - 0
packages/extra/amunits/otherlibs/render/units/render.pas

@@ -0,0 +1,1354 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for render.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  16 Jan 2003.
+  
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003
+  
+  [email protected] Nils Sjoholm
+}
+
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT RENDER;
+
+INTERFACE
+USES Exec,utility,graphics;
+
+VAR RenderBase : pLibrary;
+
+type
+    pPLANEPTR = ^PLANEPTR;
+
+const
+    RENDERNAME : PChar = 'render.library';
+
+{
+        $VER: render.h v40 (19.12.2002)
+        render.library definitions
+   }
+
+  const
+     RND_TAGBASE = TAG_USER + $1000;
+  {
+  
+  	memhandler
+
+                                                                          }
+  { type of memhandler, see below  }
+     RND_MemType = RND_TAGBASE + 1;
+  { ptr to block of memory  }
+     RND_MemBlock = RND_TAGBASE + 2;
+  { size of memblock [bytes]  }
+     RND_MemSize = RND_TAGBASE + 3;
+  { memflags (exec/memory.h)  }
+     RND_MemFlags = RND_TAGBASE + 18;
+  { to pass a memhandler as an argument  }
+     RND_RMHandler = RND_TAGBASE + 12;
+  {
+    	memhandler types
+    }
+  { v39 exec dynamic pool  }
+     RMHTYPE_POOL = 1;
+  { private memory pool  }
+     RMHTYPE_PRIVATE = 2;
+  { common public memory  }
+     RMHTYPE_PUBLIC = 3;
+  {
+
+  	palette
+
+                                                                          }
+  { palette import/export format  }
+     RND_PaletteFormat = RND_TAGBASE + 19;
+  { tag to indicate a palette is EHB  }
+     RND_EHBPalette = RND_TAGBASE + 22;
+  { first palette entry  }
+     RND_FirstColor = RND_TAGBASE + 23;
+  { dispose the old palette and load a new one  }
+     RND_NewPalette = RND_TAGBASE + 24;
+  { quantization factors  }
+     RND_RGBWeight = RND_TAGBASE + 11;
+  {
+    	palette format types
+    }
+  { ULONG red,green,blue  }
+     PALFMT_RGB32 = 1;
+  { ULONG 0x00rrggbb  }
+     PALFMT_RGB8 = 2;
+  { UWORD 0xrgb  }
+     PALFMT_RGB4 = 3;
+  { render.library palette  }
+     PALFMT_PALETTE = 4;
+  {
+    	palette sort mode types
+    	for the use with SortPalette()
+    }
+  { no particular order  }
+     PALMODE_NONE = $0000;
+  { sort palette entries by brightness  }
+     PALMODE_BRIGHTNESS = $0001;
+  { sort palette entries by the number of pixels that they represent.
+  	   You must supply the RND_Histogram taglist argument.  }
+     PALMODE_POPULARITY = $0002;
+  { sort palette entries by the number of histogram entries that they
+  	   represent. You must supply the RND_Histogram taglist argument.  }
+     PALMODE_REPRESENTATION = $0003;
+  { sort palette entries by their optical significance for the human
+  	   eye. Implementation is unknown to you and may change.
+  	   You must supply the RND_Histogram taglist argument.  }
+     PALMODE_SIGNIFICANCE = $0004;
+  { sort palette entries by color intensity  }
+     PALMODE_SATURATION = $0005;
+  { By default, sort direction is descending, i.e. the precedence is
+  	   more-to-less. Combine with this flag to invert the sort direction.  }
+     PALMODE_ASCENDING = $0008;
+  {
+  
+  	histogram related
+  
+                                                                          }
+  { histogram type, see below  }
+     RND_HSType = RND_TAGBASE + 4;
+  { a histogram as an argument  }
+     RND_Histogram = RND_TAGBASE + 9;
+  {
+    	Histogram / Palette types
+    	to be specified with RND_HSType
+    }
+  { 12bit dynamic histogram  }
+     HSTYPE_12BIT = 4;
+  { 15bit dynamic histogram  }
+     HSTYPE_15BIT = 5;
+  { 18bit dynamic histogram  }
+     HSTYPE_18BIT = 6;
+  { 21bit dynamic histogram  }
+     HSTYPE_21BIT = 7;
+  { 24bit dynamic histogram  }
+     HSTYPE_24BIT = 8;
+  { 12bit tabular histogram  }
+     HSTYPE_12BIT_TURBO = 20;
+  { 15bit tabular histogram  }
+     HSTYPE_15BIT_TURBO = 21;
+  { 18bit tabular histogram  }
+     HSTYPE_18BIT_TURBO = 22;
+  {
+    	tags that can be queried via QueryHistogram()
+    }
+  { # pixels in a histogram  }
+     RND_NumPixels = RND_TAGBASE + 5;
+  { # colors in a histogram  }
+     RND_NumColors = RND_TAGBASE + 6;
+  {
+  
+  	rendering and conversions
+  
+                                                                          }
+  { color mode, see below  }
+     RND_ColorMode = RND_TAGBASE + 7;
+  { dither mode, see below  }
+     RND_DitherMode = RND_TAGBASE + 8;
+  { dither amount  }
+     RND_DitherAmount = RND_TAGBASE + 26;
+  { first color index to be output  }
+     RND_OffsetColorZero = RND_TAGBASE + 10;
+  {
+    	color mode types
+    	to be specified with RND_ColorMode
+    }
+  { normal palette lookup  }
+     COLORMODE_CLUT = $0000;
+  { HAM8 mode  }
+     COLORMODE_HAM8 = $0001;
+  { HAM6 mode  }
+     COLORMODE_HAM6 = $0002;
+  { mask to determine COLORMODE  }
+     COLORMODE_MASK = $0003;
+  {
+    	dither mode types
+    	to be specified with RND_DitherMode
+    }
+  { no dither  }
+     DITHERMODE_NONE = $0000;
+  { Floyd-Steinberg dither  }
+     DITHERMODE_FS = $0001;
+  { random dither. amount required.  }
+     DITHERMODE_RANDOM = $0002;
+  { EDD dither  }
+     DITHERMODE_EDD = $0003;
+  {                                                                       
+
+  	miscellaneous
+
+                                                                          }
+  { progress callback hook  }
+     RND_ProgressHook = RND_TAGBASE + 13;
+  { total input width [pixels]  }
+     RND_SourceWidth = RND_TAGBASE + 14;
+  { total output width [pixels]  }
+     RND_DestWidth = RND_TAGBASE + 15;
+  { ptr to a chunky conversion table  }
+     RND_PenTable = RND_TAGBASE + 16;
+  { chunky data left edge [pixels]  }
+     RND_LeftEdge = RND_TAGBASE + 17;
+  { line callback hook  }
+     RND_LineHook = RND_TAGBASE + 20;
+  { Mapping-Engine  }
+     RND_MapEngine = RND_TAGBASE + 27;
+  { Interleave  }
+     RND_Interleave = RND_TAGBASE + 28;
+  { Palette  }
+     RND_Palette = RND_TAGBASE + 29;
+  { Weight factor  }
+     RND_Weight = RND_TAGBASE + 30;
+  { ScaleEngine  }
+     RND_ScaleEngine = RND_TAGBASE + 31;
+  { Texture coordinates  }
+     RND_DestCoordinates = RND_TAGBASE + 42;
+  { backcolor for filling  }
+     RND_BGColor = RND_TAGBASE + 43;
+  { backpen for filling  }
+     RND_BGPen = RND_TAGBASE + 44;
+  {
+  
+  	alpha-channel and masking
+  
+                                                                          }
+  { custom alpha-channel  }
+     RND_AlphaChannel = RND_TAGBASE + 32;
+  { bytes between alpha-channel pixels  }
+     RND_AlphaModulo = RND_TAGBASE + 33;
+  { width of alpha-channel array  }
+     RND_AlphaWidth = RND_TAGBASE + 34;
+  { masking RGB for CreateAlphaArray  }
+     RND_MaskRGB = RND_TAGBASE + 35;
+  { mask value for outside color range  }
+     RND_MaskFalse = RND_TAGBASE + 36;
+  { mask value for inside color range  }
+     RND_MaskTrue = RND_TAGBASE + 37;
+  { total source width for 3channel operations  }
+     RND_SourceWidth2 = RND_TAGBASE + 38;
+  { second custom alpha-channel  }
+     RND_AlphaChannel2 = RND_TAGBASE + 39;
+  { pixel modulo for a second alpha-channel  }
+     RND_AlphaModulo2 = RND_TAGBASE + 40;
+  { width of a second alpha-channel array  }
+     RND_AlphaWidth2 = RND_TAGBASE + 41;
+  {                                                                       
+
+  	PixelFormat
+
+                                                                          }
+  { pixel format, see below  }
+     RND_PixelFormat = RND_TAGBASE + 25;
+     PIXFMTB_CHUNKY = 3;
+     PIXFMTB_BITMAP = 4;
+     PIXFMTB_RGB = 5;
+     PIXFMT_CHUNKY_CLUT = (1 shl PIXFMTB_CHUNKY) + COLORMODE_CLUT;
+     PIXFMT_0RGB_32 = (1 shl PIXFMTB_RGB) + 0;
+  {
+    	these types are currently not used by render.library, but
+    	some of them are applicable for guigfx.library functions:
+    }
+     PIXFMT_CHUNKY_HAM8 = (1 shl PIXFMTB_CHUNKY) + COLORMODE_HAM8;
+     PIXFMT_CHUNKY_HAM6 = (1 shl PIXFMTB_CHUNKY) + COLORMODE_HAM6;
+     PIXFMT_BITMAP_CLUT = (1 shl PIXFMTB_BITMAP) + COLORMODE_CLUT;
+     PIXFMT_BITMAP_HAM8 = (1 shl PIXFMTB_BITMAP) + COLORMODE_HAM8;
+     PIXFMT_BITMAP_HAM6 = (1 shl PIXFMTB_BITMAP) + COLORMODE_HAM6;
+     PIXFMT_RGB_24 = (1 shl PIXFMTB_RGB) + 1;
+  {
+    	strictly internal:
+    }
+     PIXFMT_BITMAP_RGB = (1 shl PIXFMTB_BITMAP) + (1 shl PIXFMTB_RGB);
+  {
+  
+  	ExtractPalette return codes
+  
+  	You must at least check for EXTP_SUCCESS.
+  	EXTP_NO_DATA indicates that there were no colors
+  	in the histogram.
+
+                                                                          }
+     EXTP_SUCCESS = 0;
+     EXTP_NOT_ENOUGH_MEMORY = 1;
+     EXTP_CALLBACK_ABORTED = 2;
+     EXTP_NO_DATA = 3;
+  {
+  
+  	AddRGB, AddRGBImage and AddChunkyImage return codes
+  
+  	You must at least check for ADDH_SUCCESS.
+  	If not delivered, the histogram might be
+  	inaccurate.
+  
+                                                                          }
+     ADDH_SUCCESS = 0;
+     ADDH_NOT_ENOUGH_MEMORY = 1;
+     ADDH_CALLBACK_ABORTED = 2;
+     ADDH_NO_DATA = 3;
+  {                                                                       
+
+  	Render return codes
+
+  	You must at least check for REND_SUCCESS.
+  	If not delivered, the image has not been
+  	rendered completely.
+
+                                                                          }
+     REND_SUCCESS = 0;
+     REND_NOT_ENOUGH_MEMORY = 1;
+     REND_CALLBACK_ABORTED = 2;
+     REND_NO_VALID_PALETTE = 3;
+     REND_NO_DATA = 3;
+  {                                                                       
+
+  	SortPalette return codes
+
+  	You must at least check for SORTP_SUCCESS.
+  	SORTP_NO_DATA indicates that there were data missing,
+  	e.g. you specified no histogram or the histogram was empty.
+
+                                                                          }
+     SORTP_SUCCESS = 0;
+     SORTP_NO_DATA = 1;
+     SORTP_NOT_ENOUGH_MEMORY = 2;
+     SORTP_NOT_IMPLEMENTED = 3;
+  {
+  
+  	conversion return codes
+  
+  	These return codes apply to conversion functions
+  	such as Chunky2RGB and ConvertChunky.
+
+                                                                          }
+     CONV_SUCCESS = 0;
+     CONV_CALLBACK_ABORTED = 1;
+     CONV_NOT_ENOUGH_MEMORY = 2;
+     CONV_NO_DATA = 3;
+
+
+    
+
+
+FUNCTION AddChunkyImageA(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; taglist : pTagItem) : longword;
+FUNCTION AddHistogramA(histogram1 : POINTER; histogram2 : POINTER; taglist : pTagItem) : longword;
+FUNCTION AddRGB(histogram : POINTER; RGB : longword; count : longword) : longword;
+FUNCTION AddRGBImageA(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : longword;
+FUNCTION AllocRenderMem(rendermemhandler : POINTER; size : longword) : POINTER;
+FUNCTION AllocRenderVec(rendermemhandler : POINTER; size : longword) : POINTER;
+FUNCTION AllocRenderVecClear(rendermemhandler : POINTER; size : longword) : POINTER;
+PROCEDURE ApplyAlphaChannelA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; taglist : pTagItem);
+FUNCTION BestPen(palette : POINTER; rgb : longword) : LONGINT;
+PROCEDURE Chunky2BitMapA(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; taglist : pTagItem);
+FUNCTION Chunky2RGBA(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; taglist : pTagItem) : longword;
+FUNCTION ChunkyArrayDiversityA(chunky : pByte; palette : POINTER; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
+FUNCTION ConvertChunkyA(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; taglist : pTagItem) : longword;
+FUNCTION CountRGB(histogram : POINTER; rgb : longword) : longword;
+PROCEDURE CreateAlphaArrayA(rgbarray : pULONG; width : WORD; height : WORD; taglist : pTagItem);
+FUNCTION CreateHistogramA(taglist : pTagItem) : POINTER;
+FUNCTION CreateMapEngineA(palette : POINTER; taglist : pTagItem) : POINTER;
+FUNCTION CreatePaletteA(taglist : pTagItem) : POINTER;
+PROCEDURE CreatePenTableA(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; taglist : pTagItem);
+FUNCTION CreateRMHandlerA(taglist : pTagItem) : POINTER;
+FUNCTION CreateScaleEngineA(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; taglist : pTagItem) : POINTER;
+PROCEDURE DeleteHistogram(histogram : POINTER);
+PROCEDURE DeleteMapEngine(engine : POINTER);
+PROCEDURE DeletePalette(palette : POINTER);
+PROCEDURE DeleteRMHandler(rmh : POINTER);
+PROCEDURE DeleteScaleEngine(engine : POINTER);
+PROCEDURE ExportPaletteA(palette : POINTER; coltab : POINTER; taglist : pTagItem);
+PROCEDURE ExtractAlphaChannelA(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; taglist : pTagItem);
+FUNCTION ExtractPaletteA(histogram : POINTER; palette : pULONG; numcolors : WORD; taglist : pTagItem) : longword;
+PROCEDURE FlushPalette(palette : POINTER);
+PROCEDURE FreeRenderMem(rendermemhandler : POINTER; mem : POINTER; size : longword);
+PROCEDURE FreeRenderVec(mem : POINTER);
+PROCEDURE ImportPaletteA(palette : POINTER; coltab : POINTER; numcols : WORD; taglist : pTagItem);
+PROCEDURE InsertAlphaChannelA(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; taglist : pTagItem);
+FUNCTION MapChunkyArrayA(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; taglist : pTagItem) : longword;
+FUNCTION MapRGBArrayA(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; taglist : pTagItem) : longword;
+PROCEDURE MixAlphaChannelA(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; taglist : pTagItem);
+PROCEDURE MixRGBArrayA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; taglist : pTagItem);
+PROCEDURE Planar2ChunkyA(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; taglist : pTagItem);
+FUNCTION QueryHistogram(histogram : POINTER; d0arg : longword) : longword;
+FUNCTION RenderA(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; taglist : pTagItem) : longword;
+FUNCTION RGBArrayDiversityA(rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
+FUNCTION ScaleA(engine : POINTER; source : POINTER; dest : POINTER; taglist : pTagItem) : longword;
+FUNCTION ScaleOrdinate(source : WORD; dest : WORD; ordinate : WORD) : WORD;
+FUNCTION SortPaletteA(palette : POINTER; mode : longword; taglist : pTagItem) : longword;
+PROCEDURE TintRGBArrayA(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; taglist : pTagItem);
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AddChunkyImage(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; const taglist : Array Of Const) : longword;
+FUNCTION AddHistogram(histogram1 : POINTER; histogram2 : POINTER; const taglist : Array Of Const) : longword;
+FUNCTION AddRGBImage(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : longword;
+PROCEDURE ApplyAlphaChannel(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; const taglist : Array Of Const);
+PROCEDURE Chunky2BitMap(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; const taglist : Array Of Const);
+FUNCTION Chunky2RGB(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; const taglist : Array Of Const) : longword;
+FUNCTION ChunkyArrayDiversity(chunky : pByte; palette : POINTER; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
+FUNCTION ConvertChunky(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; const taglist : Array Of Const) : longword;
+PROCEDURE CreateAlphaArray(rgbarray : pULONG; width : WORD; height : WORD; const taglist : Array Of Const);
+FUNCTION CreateHistogram(const taglist : Array Of Const) : POINTER;
+FUNCTION CreateMapEngine(palette : POINTER; const taglist : Array Of Const) : POINTER;
+FUNCTION CreatePalette(const taglist : Array Of Const) : POINTER;
+PROCEDURE CreatePenTable(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; const taglist : Array Of Const);
+FUNCTION CreateRMHandler(const taglist : Array Of Const) : POINTER;
+FUNCTION CreateScaleEngine(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; const taglist : Array Of Const) : POINTER;
+PROCEDURE ExportPalette(palette : POINTER; coltab : POINTER; const taglist : Array Of Const);
+PROCEDURE ExtractAlphaChannel(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; const taglist : Array Of Const);
+FUNCTION ExtractPalette(histogram : POINTER; palette : pULONG; numcolors : WORD; const taglist : Array Of Const) : longword;
+PROCEDURE ImportPalette(palette : POINTER; coltab : POINTER; numcols : WORD; const taglist : Array Of Const);
+PROCEDURE InsertAlphaChannel(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; const taglist : Array Of Const);
+FUNCTION MapChunkyArray(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; const taglist : Array Of Const) : longword;
+FUNCTION MapRGBArray(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; const taglist : Array Of Const) : longword;
+PROCEDURE MixAlphaChannel(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; const taglist : Array Of Const);
+PROCEDURE MixRGBArray(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; const taglist : Array Of Const);
+PROCEDURE Planar2Chunky(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; const taglist : Array Of Const);
+FUNCTION RenderTags(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; const taglist : Array Of Const) : longword;
+FUNCTION RGBArrayDiversity(rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
+FUNCTION Scale(engine : POINTER; source : POINTER; dest : POINTER; const taglist : Array Of Const) : longword;
+FUNCTION SortPalette(palette : POINTER; mode : longword; const taglist : Array Of Const) : longword;
+PROCEDURE TintRGBArray(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; const taglist : Array Of Const);
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitRENDERLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    RENDERIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+FUNCTION AddChunkyImageA(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVEA.L	chunky,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	palette,A2
+	MOVEA.L	taglist,A3
+	MOVEA.L	RenderBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AddHistogramA(histogram1 : POINTER; histogram2 : POINTER; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram1,A0
+	MOVEA.L	histogram2,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-222(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AddRGB(histogram : POINTER; RGB : longword; count : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVE.L	RGB,D0
+	MOVE.L	count,D1
+	MOVEA.L	RenderBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AddRGBImageA(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVEA.L	rgb,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AllocRenderMem(rendermemhandler : POINTER; size : longword) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rendermemhandler,A0
+	MOVE.L	size,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AllocRenderVec(rendermemhandler : POINTER; size : longword) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rendermemhandler,A0
+	MOVE.L	size,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION AllocRenderVecClear(rendermemhandler : POINTER; size : longword) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rendermemhandler,A0
+	MOVE.L	size,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-306(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE ApplyAlphaChannelA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	sourcearray,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	destarray,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-294(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION BestPen(palette : POINTER; rgb : longword) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVE.L	rgb,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-204(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE Chunky2BitMapA(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	chunky,A0
+	MOVE.L	sx,D0
+	MOVE.L	sy,D1
+	MOVE.L	width,D2
+	MOVE.L	height,D3
+	MOVEA.L	bitmap,A1
+	MOVE.L	dx,D4
+	MOVE.L	dy,D5
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-138(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION Chunky2RGBA(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	chunky,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	rgb,A1
+	MOVEA.L	palette,A2
+	MOVEA.L	taglist,A3
+	MOVEA.L	RenderBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ChunkyArrayDiversityA(chunky : pByte; palette : POINTER; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	chunky,A0
+	MOVEA.L	palette,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-270(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ConvertChunkyA(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	source,A0
+	MOVEA.L	oldpalette,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	dest,A2
+	MOVEA.L	newpalette,A3
+	MOVEA.L	taglist,A4
+	MOVEA.L	RenderBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CountRGB(histogram : POINTER; rgb : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVE.L	rgb,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-198(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE CreateAlphaArrayA(rgbarray : pULONG; width : WORD; height : WORD; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rgbarray,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-312(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION CreateHistogramA(taglist : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreateMapEngineA(palette : POINTER; taglist : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-246(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreatePaletteA(taglist : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-174(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE CreatePenTableA(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	chunky,A0
+	MOVEA.L	oldpalette,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	newpalette,A2
+	MOVEA.L	convtab,A3
+	MOVEA.L	taglist,A4
+	MOVEA.L	RenderBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION CreateRMHandlerA(taglist : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION CreateScaleEngineA(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; taglist : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	sourcewidth,D0
+	MOVE.L	sourceheight,D1
+	MOVE.L	destwidth,D2
+	MOVE.L	destheight,D3
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-144(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE DeleteHistogram(histogram : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DeleteMapEngine(engine : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	engine,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-252(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DeletePalette(palette : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-180(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DeleteRMHandler(rmh : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rmh,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE DeleteScaleEngine(engine : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	engine,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE ExportPaletteA(palette : POINTER; coltab : POINTER; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVEA.L	coltab,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-192(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE ExtractAlphaChannelA(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rgbarray,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	chunkyarray,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-288(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION ExtractPaletteA(histogram : POINTER; palette : pULONG; numcolors : WORD; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVEA.L	palette,A1
+	MOVE.L	numcolors,D0
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE FlushPalette(palette : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-210(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE FreeRenderMem(rendermemhandler : POINTER; mem : POINTER; size : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rendermemhandler,A0
+	MOVEA.L	mem,A1
+	MOVE.L	size,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE FreeRenderVec(mem : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	mem,A0
+	MOVEA.L	RenderBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE ImportPaletteA(palette : POINTER; coltab : POINTER; numcols : WORD; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVEA.L	coltab,A1
+	MOVE.L	numcols,D0
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-186(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE InsertAlphaChannelA(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	maskarray,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	rgbarray,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-282(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION MapChunkyArrayA(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	engine,A0
+	MOVEA.L	source,A1
+	MOVEA.L	palette,A2
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	dest,A3
+	MOVEA.L	taglist,A4
+	MOVEA.L	RenderBase,A6
+	JSR	-276(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION MapRGBArrayA(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	engine,A0
+	MOVEA.L	rgb,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	chunky,A2
+	MOVEA.L	taglist,A3
+	MOVEA.L	RenderBase,A6
+	JSR	-258(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE MixAlphaChannelA(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	source1,A0
+	MOVEA.L	source2,A1
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	dest,A2
+	MOVEA.L	taglist,A3
+	MOVEA.L	RenderBase,A6
+	JSR	-318(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE MixRGBArrayA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	sourcearray,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	destarray,A1
+	MOVE.L	ratio,D2
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-300(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE Planar2ChunkyA(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	planetab,A0
+	MOVE.L	bytewidth,D0
+	MOVE.L	height,D1
+	MOVE.L	depth,D2
+	MOVE.L	bytesperrow,D3
+	MOVEA.L	chunky,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION QueryHistogram(histogram : POINTER; d0arg : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	histogram,A0
+	MOVE.L	d0arg,D0
+	MOVEA.L	RenderBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION RenderA(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rgb,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	chunky,A1
+	MOVEA.L	palette,A2
+	MOVEA.L	taglist,A3
+	MOVEA.L	RenderBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION RGBArrayDiversityA(rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rgb,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-264(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ScaleA(engine : POINTER; source : POINTER; dest : POINTER; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	engine,A0
+	MOVEA.L	source,A1
+	MOVEA.L	dest,A2
+	MOVEA.L	taglist,A3
+	MOVEA.L	RenderBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION ScaleOrdinate(source : WORD; dest : WORD; ordinate : WORD) : WORD;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	source,D0
+	MOVE.L	dest,D1
+	MOVE.L	ordinate,D2
+	MOVEA.L	RenderBase,A6
+	JSR	-228(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION SortPaletteA(palette : POINTER; mode : longword; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	palette,A0
+	MOVE.L	mode,D0
+	MOVEA.L	taglist,A1
+	MOVEA.L	RenderBase,A6
+	JSR	-216(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE TintRGBArrayA(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; taglist : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	source,A0
+	MOVE.L	width,D0
+	MOVE.L	height,D1
+	MOVE.L	RGB,D2
+	MOVE.L	ratio,D3
+	MOVEA.L	dest,A1
+	MOVEA.L	taglist,A2
+	MOVEA.L	RenderBase,A6
+	JSR	-324(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION AddChunkyImage(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; const taglist : Array Of Const) : longword;
+begin
+    AddChunkyImage := AddChunkyImageA(histogram , chunky , width , height , palette , readintags(taglist));
+end;
+
+FUNCTION AddHistogram(histogram1 : POINTER; histogram2 : POINTER; const taglist : Array Of Const) : longword;
+begin
+    AddHistogram := AddHistogramA(histogram1 , histogram2 , readintags(taglist));
+end;
+
+FUNCTION AddRGBImage(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : longword;
+begin
+    AddRGBImage := AddRGBImageA(histogram , rgb , width , height , readintags(taglist));
+end;
+
+PROCEDURE ApplyAlphaChannel(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; const taglist : Array Of Const);
+begin
+    ApplyAlphaChannelA(sourcearray , width , height , destarray , readintags(taglist));
+end;
+
+PROCEDURE Chunky2BitMap(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; const taglist : Array Of Const);
+begin
+    Chunky2BitMapA(chunky , sx , sy , width , height , bitmap , dx , dy , readintags(taglist));
+end;
+
+FUNCTION Chunky2RGB(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; const taglist : Array Of Const) : longword;
+begin
+    Chunky2RGB := Chunky2RGBA(chunky , width , height , rgb , palette , readintags(taglist));
+end;
+
+FUNCTION ChunkyArrayDiversity(chunky : pByte; palette : POINTER; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
+begin
+    ChunkyArrayDiversity := ChunkyArrayDiversityA(chunky , palette , width , height , readintags(taglist));
+end;
+
+FUNCTION ConvertChunky(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; const taglist : Array Of Const) : longword;
+begin
+    ConvertChunky := ConvertChunkyA(source , oldpalette , width , height , dest , newpalette , readintags(taglist));
+end;
+
+PROCEDURE CreateAlphaArray(rgbarray : pULONG; width : WORD; height : WORD; const taglist : Array Of Const);
+begin
+    CreateAlphaArrayA(rgbarray , width , height , readintags(taglist));
+end;
+
+FUNCTION CreateHistogram(const taglist : Array Of Const) : POINTER;
+begin
+    CreateHistogram := CreateHistogramA(readintags(taglist));
+end;
+
+FUNCTION CreateMapEngine(palette : POINTER; const taglist : Array Of Const) : POINTER;
+begin
+    CreateMapEngine := CreateMapEngineA(palette , readintags(taglist));
+end;
+
+FUNCTION CreatePalette(const taglist : Array Of Const) : POINTER;
+begin
+    CreatePalette := CreatePaletteA(readintags(taglist));
+end;
+
+PROCEDURE CreatePenTable(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; const taglist : Array Of Const);
+begin
+    CreatePenTableA(chunky , oldpalette , width , height , newpalette , convtab , readintags(taglist));
+end;
+
+FUNCTION CreateRMHandler(const taglist : Array Of Const) : POINTER;
+begin
+    CreateRMHandler := CreateRMHandlerA(readintags(taglist));
+end;
+
+FUNCTION CreateScaleEngine(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; const taglist : Array Of Const) : POINTER;
+begin
+    CreateScaleEngine := CreateScaleEngineA(sourcewidth , sourceheight , destwidth , destheight , readintags(taglist));
+end;
+
+PROCEDURE ExportPalette(palette : POINTER; coltab : POINTER; const taglist : Array Of Const);
+begin
+    ExportPaletteA(palette , coltab , readintags(taglist));
+end;
+
+PROCEDURE ExtractAlphaChannel(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; const taglist : Array Of Const);
+begin
+    ExtractAlphaChannelA(rgbarray , width , height , chunkyarray , readintags(taglist));
+end;
+
+FUNCTION ExtractPalette(histogram : POINTER; palette : pULONG; numcolors : WORD; const taglist : Array Of Const) : longword;
+begin
+    ExtractPalette := ExtractPaletteA(histogram , palette , numcolors , readintags(taglist));
+end;
+
+PROCEDURE ImportPalette(palette : POINTER; coltab : POINTER; numcols : WORD; const taglist : Array Of Const);
+begin
+    ImportPaletteA(palette , coltab , numcols , readintags(taglist));
+end;
+
+PROCEDURE InsertAlphaChannel(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; const taglist : Array Of Const);
+begin
+    InsertAlphaChannelA(maskarray , width , height , rgbarray , readintags(taglist));
+end;
+
+FUNCTION MapChunkyArray(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; const taglist : Array Of Const) : longword;
+begin
+    MapChunkyArray := MapChunkyArrayA(engine , source , palette , width , height , dest , readintags(taglist));
+end;
+
+FUNCTION MapRGBArray(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; const taglist : Array Of Const) : longword;
+begin
+    MapRGBArray := MapRGBArrayA(engine , rgb , width , height , chunky , readintags(taglist));
+end;
+
+PROCEDURE MixAlphaChannel(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; const taglist : Array Of Const);
+begin
+    MixAlphaChannelA(source1 , source2 , width , height , dest , readintags(taglist));
+end;
+
+PROCEDURE MixRGBArray(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; const taglist : Array Of Const);
+begin
+    MixRGBArrayA(sourcearray , width , height , destarray , ratio , readintags(taglist));
+end;
+
+PROCEDURE Planar2Chunky(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; const taglist : Array Of Const);
+begin
+    Planar2ChunkyA(planetab , bytewidth , height , depth , bytesperrow , chunky , readintags(taglist));
+end;
+
+FUNCTION RenderTags(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; const taglist : Array Of Const) : longword;
+begin
+    RenderTags := RenderA(rgb , width , height , chunky , palette , readintags(taglist));
+end;
+
+FUNCTION RGBArrayDiversity(rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
+begin
+    RGBArrayDiversity := RGBArrayDiversityA(rgb , width , height , readintags(taglist));
+end;
+
+FUNCTION Scale(engine : POINTER; source : POINTER; dest : POINTER; const taglist : Array Of Const) : longword;
+begin
+    Scale := ScaleA(engine , source , dest , readintags(taglist));
+end;
+
+FUNCTION SortPalette(palette : POINTER; mode : longword; const taglist : Array Of Const) : longword;
+begin
+    SortPalette := SortPaletteA(palette , mode , readintags(taglist));
+end;
+
+PROCEDURE TintRGBArray(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; const taglist : Array Of Const);
+begin
+    TintRGBArrayA(source , width , height , RGB , ratio , dest , readintags(taglist));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of render.library}
+  {$Info don't forget to use InitRENDERLibrary in the beginning of your program}
+
+var
+    render_exit : Pointer;
+
+procedure CloserenderLibrary;
+begin
+    ExitProc := render_exit;
+    if RenderBase <> nil then begin
+        CloseLibrary(RenderBase);
+        RenderBase := nil;
+    end;
+end;
+
+procedure InitRENDERLibrary;
+begin
+    RenderBase := nil;
+    RenderBase := OpenLibrary(RENDERNAME,LIBVERSION);
+    if RenderBase <> nil then begin
+        render_exit := ExitProc;
+        ExitProc := @CloserenderLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open render.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    RENDERIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of render.library}
+
+var
+    render_exit : Pointer;
+
+procedure CloserenderLibrary;
+begin
+    ExitProc := render_exit;
+    if RenderBase <> nil then begin
+        CloseLibrary(RenderBase);
+        RenderBase := nil;
+    end;
+end;
+
+begin
+    RenderBase := nil;
+    RenderBase := OpenLibrary(RENDERNAME,LIBVERSION);
+    if RenderBase <> nil then begin
+        render_exit := ExitProc;
+        ExitProc := @CloserenderLibrary;
+        RENDERIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open render.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    RENDERIsCompiledHow := 3;
+   {$Warning No autoopening of render.library compiled}
+   {$Warning Make sure you open render.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT RENDER *)
+
+{
+  $Log
+}
+
+

+ 555 - 0
packages/extra/amunits/otherlibs/ttengine/units/ttengine.pas

@@ -0,0 +1,555 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for ttengine.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  16 Jan 2003.
+  
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}
+
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT TTENGINE;
+
+INTERFACE
+USES Exec,utility,graphics;
+
+VAR TTEngineBase : pLibrary;
+
+const
+    TTENGINENAME : PChar = 'ttengine.library';
+
+
+  { $VER: ttengine.h 6.0 (3.1.2003) (c) by Grzegorz Kraszewski 2002.  }
+
+  const
+
+     TTENGINEVERSION = 6;
+     TTENGINEMINVERSION = 3;
+  { Tags  }
+  { Tags applicability legend:  }
+  { O - TT_OpenFont()  }
+  { G - TT_GetAttrs()  }
+  { S - TT_SetAttrs()  }
+  { P - TT_GetPixmap()  }
+  { ---- name -------------------- value ----- applicability  }
+  { OG..  }
+     TT_FontFile = $6EDA0000;
+  { OG..  }
+     TT_FontStyle = $6EDA0001;
+     TT_FontStyle_Regular = 0;
+     TT_FontStyle_Italic = 1;
+  { O...  }
+     TT_FamilyTable = $6EDA0002;
+  { OG..  }
+     TT_FontSize = $6EDA0003;
+  { OG..  }
+     TT_FontWeight = $6EDA0004;
+     TT_FontWeight_Normal = 400;
+     TT_FontWeight_Bold = 700;
+  { O...  }
+     TT_ColorMap = $6EDA0005;
+  { O...  }
+     TT_Screen = $6EDA0006;
+  { O...  }
+     TT_Window = $6EDA0007;
+  { .G..  }
+     TT_FontAscender = $6EDA0008;
+  { .G..  }
+     TT_FontDescender = $6EDA0009;
+  { .GSP  }
+     TT_Antialias = $6EDA000F;
+     TT_Antialias_Auto = 0;
+     TT_Antialias_Off = 1;
+     TT_Antialias_On = 2;
+  { .GSP  }
+     TT_Encoding = $6EDA0010;
+  { supported  }
+  { use ENV:ttfcodepage or ISO-8859-1 if not found  }
+     TT_Encoding_Default = 0;
+  { Western Europe and US  }
+     TT_Encoding_ISO8859_1 = 4;
+  { Eastern Europe  }
+     TT_Encoding_ISO8859_2 = 5;
+     TT_Encoding_ISO8859_3 = 6;
+     TT_Encoding_ISO8859_4 = 7;
+     TT_Encoding_ISO8859_5 = 8;
+     TT_Encoding_ISO8859_6 = 9;
+     TT_Encoding_ISO8859_7 = 10;
+     TT_Encoding_ISO8859_8 = 11;
+     TT_Encoding_ISO8859_9 = 12;
+     TT_Encoding_ISO8859_10 = 13;
+     TT_Encoding_ISO8859_11 = 14;
+     TT_Encoding_ISO8859_13 = 109;
+     TT_Encoding_ISO8859_14 = 110;
+     TT_Encoding_ISO8859_15 = 111;
+     TT_Encoding_ISO8859_16 = 112;
+     TT_Encoding_UTF16_BE = 1013;
+     TT_Encoding_UTF32_BE = 1018;
+     TT_Encoding_UTF8 = 106;
+     TT_Encoding_UTF16_LE = 1014;
+     TT_Encoding_UTF32_LE = 1019;
+     TT_Encoding_UTF16 = 1015;
+     TT_Encoding_UTF32 = 1017;
+  { .G..  }
+     TT_FontName = $6EDA0011;
+  { .G..  }
+     TT_FamilyName = $6EDA0012;
+  { .G..  }
+     TT_SubfamilyName = $6EDA0013;
+  { .GS.  from 0 to 255  }
+     TT_Transparency = $6EDA0014;
+  { O.SP  single precision floating point +- 0.01 to 100  }
+     TT_ScaleX = $6EDA0015;
+  { O.SP  single precision floating point +- 0.01 to 100  }
+     TT_ScaleY = $6EDA0016;
+  { ..SP (V5)  }
+     TT_SoftStyle = $6EDA0017;
+     TT_SoftStyle_None = $0000;
+     TT_SoftStyle_Underlined = $0001;
+     TT_SoftStyle_DblUnderlined = $0002;
+     TT_SoftStyle_Overstriked = $0004;
+     TT_SoftStyle_DblOverstriked = $0008;
+  { ..S.  foreground RGB value }
+     TT_Foreground = $6EDA0018;
+     TT_Foreground_UseRastPort = -(1);
+  { ..S.  background RGB value }
+     TT_Background = $6EDA0019;
+     TT_Background_UseRastPort = -(1);
+  { .G..  }
+     TT_FontMaxTop = $6EDA001E;
+  { .G..  }
+     TT_FontMaxBottom = $6EDA001F;
+  { .G..  }
+     TT_FontDesignHeight = $6EDA0020;
+  { .G..  }
+     TT_FontRealAscender = $6EDA0021;
+  { .G..  }
+     TT_FontRealDescender = $6EDA0022;
+  { .G..  }
+     TT_FontAccentedAscender = $6EDA0023;
+  { ..SP  }
+     TT_CustomEncoding = $6EDA0024;
+
+
+  { Structure returned by TT_GetPixmap() (V5) }
+  type
+     PTT_Pixmap = ^tTT_Pixmap;
+     tTT_Pixmap = record
+          ttp_Size : ULONG;      { size of the structure inculdung this field  }
+          ttp_Width : ULONG;     { also equal to bytes per row  }
+          ttp_Height : ULONG;    { number of rows  }
+          ttp_Data : Pointer;    { grayscale pixmap data  }
+       end;
+
+  { font requester attributes (V6)  }
+
+  const
+  { struct Window ,   NULL               }
+     TTRQ_Window = $6EDA2000;
+  { STRPTR,           NULL [Workbench]   }
+     TTRQ_PubScreenName = $6EDA2001;
+  { struct Screen ,   NULL               }
+     TTRQ_Screen = $6EDA2002;
+  { BOOL,             FALSE              }
+     TTRQ_SleepWindow = $6EDA2003;
+  { STRPTR,           "Select TrueType font" or localized  }
+     TTRQ_TitleText = $6EDA2004;
+  { STRPTR,           "OK" or localized  }
+     TTRQ_PositiveText = $6EDA2005;
+  { STRPTR,           "Cancel" or localized  }
+     TTRQ_NegativeText = $6EDA2006;
+  { WORD,             centered on screen  }
+     TTRQ_InitialLeftEdge = $6EDA2007;
+  { WORD,             centered on screen  }
+     TTRQ_InitialTopEdge = $6EDA2008;
+  { WORD,             max(200, 25% of sceeen width)  }
+     TTRQ_InitialWidth = $6EDA2009;
+  { WORD,             max(200, 50% of screen height)  }
+     TTRQ_InitialHeight = $6EDA200A;
+  { BOOL,             TRUE               }
+     TTRQ_DoSizes = $6EDA2000;
+
+
+
+FUNCTION TT_AllocRequest : POINTER;
+PROCEDURE TT_CloseFont(font : POINTER);
+PROCEDURE TT_DoneRastPort(rp : pRastPort);
+PROCEDURE TT_FreePixmap(pixmap : pTT_Pixmap);
+PROCEDURE TT_FreeRequest(request : POINTER);
+FUNCTION TT_GetAttrsA(rp : pRastPort; taglist : pTagItem) : longword;
+FUNCTION TT_GetPixmapA(font : POINTER; _string : POINTER; count : longword; taglist : pTagItem) : pTT_Pixmap;
+FUNCTION TT_OpenFontA(taglist : pTagItem) : POINTER;
+FUNCTION TT_RequestA(request : POINTER; taglist : pTagItem) : pTagItem;
+FUNCTION TT_SetAttrsA(rp : pRastPort; taglist : pTagItem) : longword;
+FUNCTION TT_SetFont(rp : pRastPort; font : POINTER) : BOOLEAN;
+PROCEDURE TT_Text(rp : pRastPort; _string : POINTER; count : longword);
+PROCEDURE TT_TextExtent(rp : pRastPort; _string : POINTER; count : LONGINT; te : pTextExtent);
+FUNCTION TT_TextFit(rp : pRastPort; _string : POINTER; count : longword; te : pTextExtent; tec : pTextExtent; dir : LONGINT; cwidth : longword; cheight : longword) : longword;
+FUNCTION TT_TextLength(rp : pRastPort; _string : POINTER; count : longword) : longword;
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION TT_GetAttrs(rp : pRastPort; const taglist : Array Of Const) : longword;
+FUNCTION TT_GetPixmap(font : POINTER; _string : POINTER; count : longword; const taglist : Array Of Const) : pTT_Pixmap;
+FUNCTION TT_OpenFont(const taglist : Array Of Const) : POINTER;
+FUNCTION TT_Request(request : POINTER; const taglist : Array Of Const) : pTagItem;
+FUNCTION TT_SetAttrs(rp : pRastPort; const taglist : Array Of Const) : longword;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitTTENGINELibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    TTENGINEIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+FUNCTION TT_AllocRequest : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	TTEngineBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE TT_CloseFont(font : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	font,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE TT_DoneRastPort(rp : pRastPort);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	TTEngineBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE TT_FreePixmap(pixmap : pTT_Pixmap);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	pixmap,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE TT_FreeRequest(request : POINTER);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	request,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION TT_GetAttrsA(rp : pRastPort; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	taglist,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION TT_GetPixmapA(font : POINTER; _string : POINTER; count : longword; taglist : pTagItem) : pTT_Pixmap;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	font,A1
+	MOVEA.L	_string,A2
+	MOVE.L	count,D0
+	MOVEA.L	taglist,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION TT_OpenFontA(taglist : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	taglist,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION TT_RequestA(request : POINTER; taglist : pTagItem) : pTagItem;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	request,A0
+	MOVEA.L	taglist,A1
+	MOVEA.L	TTEngineBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION TT_SetAttrsA(rp : pRastPort; taglist : pTagItem) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	taglist,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION TT_SetFont(rp : pRastPort; font : POINTER) : BOOLEAN;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	font,A0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+	TST.W	D0
+	BEQ.B	@end
+	MOVEQ	#1,D0
+  @end:	MOVE.B	D0,@RESULT
+  END;
+END;
+
+PROCEDURE TT_Text(rp : pRastPort; _string : POINTER; count : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	_string,A0
+	MOVE.L	count,D0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE TT_TextExtent(rp : pRastPort; _string : POINTER; count : LONGINT; te : pTextExtent);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	_string,A0
+	MOVE.L	count,D0
+	MOVEA.L	te,A2
+	MOVEA.L	TTEngineBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION TT_TextFit(rp : pRastPort; _string : POINTER; count : longword; te : pTextExtent; tec : pTextExtent; dir : LONGINT; cwidth : longword; cheight : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	_string,A0
+	MOVE.L	count,D0
+	MOVEA.L	te,A2
+	MOVEA.L	tec,A3
+	MOVE.L	dir,D1
+	MOVE.L	cwidth,D2
+	MOVE.L	cheight,D3
+	MOVEA.L	TTEngineBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION TT_TextLength(rp : pRastPort; _string : POINTER; count : longword) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	rp,A1
+	MOVEA.L	_string,A0
+	MOVE.L	count,D0
+	MOVEA.L	TTEngineBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION TT_GetAttrs(rp : pRastPort; const taglist : Array Of Const) : longword;
+begin
+    TT_GetAttrs := TT_GetAttrsA(rp , readintags(taglist));
+end;
+
+FUNCTION TT_GetPixmap(font : POINTER; _string : POINTER; count : longword; const taglist : Array Of Const) : pTT_Pixmap;
+begin
+    TT_GetPixmap := TT_GetPixmapA(font , _string , count , readintags(taglist));
+end;
+
+FUNCTION TT_OpenFont(const taglist : Array Of Const) : POINTER;
+begin
+    TT_OpenFont := TT_OpenFontA(readintags(taglist));
+end;
+
+FUNCTION TT_Request(request : POINTER; const taglist : Array Of Const) : pTagItem;
+begin
+    TT_Request := TT_RequestA(request , readintags(taglist));
+end;
+
+FUNCTION TT_SetAttrs(rp : pRastPort; const taglist : Array Of Const) : longword;
+begin
+    TT_SetAttrs := TT_SetAttrsA(rp , readintags(taglist));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of ttengine.library}
+  {$Info don't forget to use InitTTENGINELibrary in the beginning of your program}
+
+var
+    ttengine_exit : Pointer;
+
+procedure ClosettengineLibrary;
+begin
+    ExitProc := ttengine_exit;
+    if TTEngineBase <> nil then begin
+        CloseLibrary(TTEngineBase);
+        TTEngineBase := nil;
+    end;
+end;
+
+procedure InitTTENGINELibrary;
+begin
+    TTEngineBase := nil;
+    TTEngineBase := OpenLibrary(TTENGINENAME,LIBVERSION);
+    if TTEngineBase <> nil then begin
+        ttengine_exit := ExitProc;
+        ExitProc := @ClosettengineLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ttengine.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    TTENGINEIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of ttengine.library}
+
+var
+    ttengine_exit : Pointer;
+
+procedure ClosettengineLibrary;
+begin
+    ExitProc := ttengine_exit;
+    if TTEngineBase <> nil then begin
+        CloseLibrary(TTEngineBase);
+        TTEngineBase := nil;
+    end;
+end;
+
+begin
+    TTEngineBase := nil;
+    TTEngineBase := OpenLibrary(TTENGINENAME,LIBVERSION);
+    if TTEngineBase <> nil then begin
+        ttengine_exit := ExitProc;
+        ExitProc := @ClosettengineLibrary;
+        TTENGINEIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open ttengine.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    TTENGINEIsCompiledHow := 3;
+   {$Warning No autoopening of ttengine.library compiled}
+   {$Warning Make sure you open ttengine.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT TTENGINE *)
+
+{
+  $Log
+}
+
+

+ 1756 - 0
packages/extra/amunits/otherlibs/xadmaster/units/xadmaster.pas

@@ -0,0 +1,1756 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 1998-2002 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for xadmaster.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  First version of this unit.
+  12 Feb 2003.
+  
+  [email protected] Nils Sjoholm
+}  
+
+{$mode objfpc}
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT XADMASTER;
+
+INTERFACE
+USES Exec,utility,amigados;
+
+const
+    XADMASTERNAME : PChar = 'xadmaster.library';
+
+
+  {
+    	$VER: xadmaster.h 12.0 (24.06.2002)
+    	xadmaster.library defines and structures
+
+    	Copyright © 1998-2002 by Dirk Stöcker
+    	All Rights Reserved.
+   }
+
+
+  const
+     XADNAME = 'xadmaster.library';
+  { NOTE: Nearly all structures need to be allocated using the
+     xadAllocObject function.  }
+  {
+
+       library base structure
+
+                                                                          }
+ 
+ 
+
+  type
+     PxadMasterBase = ^txadMasterBase;
+     txadMasterBase = record
+          xmb_LibNode : tLibrary;
+          xmb_SysBase : PExecBase;
+          xmb_DOSBase : PDosLibrary;
+          xmb_UtilityBase : PUtilityBase;
+          xmb_RecogSize : ULONG;      { read only  }
+          xmb_DefaultName : STRPTR;   { name for XADFIF_NOFILENAME (V6)  }
+       end;
+
+  {
+
+       tag-function call flags
+
+                                                                          }
+  { input tags for xadGetInfo, only one can be specified per call  }
+  const
+   { input data size  }
+     XAD_INSIZE = TAG_USER + 1;
+     XAD_INFILENAME = TAG_USER + 2;
+     XAD_INFILEHANDLE = TAG_USER + 3;
+     XAD_INMEMORY = TAG_USER + 4;
+     XAD_INHOOK = TAG_USER + 5;
+  { (V2)  }
+     XAD_INSPLITTED = TAG_USER + 6;
+  { (V4)  }
+     XAD_INDISKARCHIVE = TAG_USER + 7;
+  { (V8)  }
+     XAD_INXADSTREAM = TAG_USER + 8;
+  { (V11)  }
+     XAD_INDEVICE = TAG_USER + 9;
+  { output tags, only one can be specified per call, xadXXXXUnArc  }
+  { output data size  }
+     XAD_OUTSIZE = TAG_USER + 10;
+     XAD_OUTFILENAME = TAG_USER + 11;
+     XAD_OUTFILEHANDLE = TAG_USER + 12;
+     XAD_OUTMEMORY = TAG_USER + 13;
+     XAD_OUTHOOK = TAG_USER + 14;
+     XAD_OUTDEVICE = TAG_USER + 15;
+  { (V8)  }
+     XAD_OUTXADSTREAM = TAG_USER + 16;
+  { object allocation tags for xadAllocObjectA  }
+  { XADOBJ_FILEINFO, size of needed name space  }
+     XAD_OBJNAMESIZE = TAG_USER + 20;
+  { XADOBJ_FILEINFO, size of needed comment space  }
+     XAD_OBJCOMMENTSIZE = TAG_USER + 21;
+  { XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size  }
+     XAD_OBJPRIVINFOSIZE = TAG_USER + 22;
+  { XADOBJ_DISKINFO, number of needed entries  }
+     XAD_OBJBLOCKENTRIES = TAG_USER + 23;
+  { tags for xadGetInfo, xadFileUnArc and xadDiskUnArc  }
+  { do not use extern clients  }
+     XAD_NOEXTERN = TAG_USER + 50;
+  { password when needed  }
+     XAD_PASSWORD = TAG_USER + 51;
+  { number of wanted entry  }
+     XAD_ENTRYNUMBER = TAG_USER + 52;
+  { the progress hook  }
+     XAD_PROGRESSHOOK = TAG_USER + 53;
+  { overwrite file ?  }
+     XAD_OVERWRITE = TAG_USER + 54;
+  { create directory tree  }
+     XAD_MAKEDIRECTORY = TAG_USER + 55;
+  { ignore drive geometry ?  }
+     XAD_IGNOREGEOMETRY = TAG_USER + 56;
+  { lowest cylinder  }
+     XAD_LOWCYLINDER = TAG_USER + 57;
+  { highest cylinder  }
+     XAD_HIGHCYLINDER = TAG_USER + 58;
+  { verify for disk hook  }
+     XAD_VERIFY = TAG_USER + 59;
+  { do not delete partial/corrupt files (V3.3)  }
+     XAD_NOKILLPARTIAL = TAG_USER + 60;
+  { format output device (V5)  }
+     XAD_FORMAT = TAG_USER + 61;
+  { sector labels are stored on disk (V9)  }
+     XAD_USESECTORLABELS = TAG_USER + 62;
+  { ignore the client, if certain flags are set (V11)  }
+     XAD_IGNOREFLAGS = TAG_USER + 63;
+  { ignore the client, if certain flags are NOT set (V11)  }
+     XAD_ONLYFLAGS = TAG_USER + 64;
+  { input tags for xadConvertDates, only one can be passed  }
+  { unix date variable  }
+     XAD_DATEUNIX = TAG_USER + 70;
+  { amiga date variable  }
+     XAD_DATEAMIGA = TAG_USER + 71;
+  { struct DateStamp  }
+     XAD_DATEDATESTAMP = TAG_USER + 72;
+  { struct xadDate  }
+     XAD_DATEXADDATE = TAG_USER + 73;
+  { struct ClockData  }
+     XAD_DATECLOCKDATA = TAG_USER + 74;
+  { input is system time  }
+     XAD_DATECURRENTTIME = TAG_USER + 75;
+  { MS-DOS packed format (V2)  }
+     XAD_DATEMSDOS = TAG_USER + 76;
+  { Mac date variable (V8)  }
+     XAD_DATEMAC = TAG_USER + 77;
+  { CP/M data structure (V10)  }
+     XAD_DATECPM = TAG_USER + 78;
+  { CP/M data structure type 2 (V10)  }
+     XAD_DATECPM2 = TAG_USER + 79;
+  { ISO9660 date structure (V11)  }
+     XAD_DATEISO9660 = TAG_USER + 300;
+  { output tags, there can be specified multiple tags for one call  }
+  { unix date variable  }
+     XAD_GETDATEUNIX = TAG_USER + 80;
+  { amiga date variable  }
+     XAD_GETDATEAMIGA = TAG_USER + 81;
+  { struct DateStamp  }
+     XAD_GETDATEDATESTAMP = TAG_USER + 82;
+  { struct xadDate  }
+     XAD_GETDATEXADDATE = TAG_USER + 83;
+  { struct ClockData  }
+     XAD_GETDATECLOCKDATA = TAG_USER + 84;
+  { MS-DOS packed format (V2)  }
+     XAD_GETDATEMSDOS = TAG_USER + 86;
+  { Mac date variable (V8)  }
+     XAD_GETDATEMAC = TAG_USER + 87;
+  { CP/M data structure (V10)  }
+     XAD_GETDATECPM = TAG_USER + 88;
+  { CP/M data structure type 2 (V10)  }
+     XAD_GETDATECPM2 = TAG_USER + 89;
+  { ISO9660 date structure (V11)  }
+     XAD_GETDATEISO9660 = TAG_USER + 320;
+  { following tags need locale.library to be installed  }
+  { make local to GMT time  }
+     XAD_MAKEGMTDATE = TAG_USER + 90;
+  { make GMT to local time  }
+     XAD_MAKELOCALDATE = TAG_USER + 91;
+  { tags for xadHookTagAccess (V3)  }
+  { the hook uses xadSkipInfo (V3)  }
+     XAD_USESKIPINFO = TAG_USER + 104;
+  { pass sector labels with XADAC_WRITE (V9)  }
+     XAD_SECTORLABELS = TAG_USER + 105;
+  { pointer to UWORD value (V3)  }
+     XAD_GETCRC16 = TAG_USER + 120;
+  { pointer to ULONG value (V3)  }
+     XAD_GETCRC32 = TAG_USER + 121;
+  { ID for crc calculation (V3)  }
+     XAD_CRC16ID = TAG_USER + 130;
+  { ID for crc calculation (V3)  }
+     XAD_CRC32ID = TAG_USER + 131;
+  { tags for xadConvertProtection (V4)  }
+  { Amiga type protection bits (V4)  }
+     XAD_PROTAMIGA = TAG_USER + 160;
+  { protection bits in UNIX mode (V4)  }
+     XAD_PROTUNIX = TAG_USER + 161;
+  { MSDOS type protection bits (V4)  }
+     XAD_PROTMSDOS = TAG_USER + 162;
+  { input is a xadFileInfo structure (V11)  }
+     XAD_PROTFILEINFO = TAG_USER + 163;
+  { return Amiga protection bits (V4)  }
+     XAD_GETPROTAMIGA = TAG_USER + 170;
+  { return UNIX protection bits (V11)  }
+     XAD_GETPROTUNIX = TAG_USER + 171;
+  { return MSDOS protection bits (V11)  }
+     XAD_GETPROTMSDOS = TAG_USER + 172;
+  { fill xadFileInfo protection fields (V11)  }
+     XAD_GETPROTFILEINFO = TAG_USER + 173;
+  { tags for xadGetDiskInfo (V7)  }
+  { the client to start with (V7)  }
+     XAD_STARTCLIENT = TAG_USER + 180;
+  { do not create XADERR_EMPTY (V8)  }
+     XAD_NOEMPTYERROR = TAG_USER + 181;
+  { tags for xadFreeHookAccess (V8)  }
+  { error occured, call abort method (V8)  }
+     XAD_WASERROR = TAG_USER + 190;
+  { tags for miscellaneous stuff  }
+  { xadArchiveInfo for stream hooks (V8)  }
+     XAD_ARCHIVEINFO = TAG_USER + 200;
+  { error code of function (V12)  }
+     XAD_ERRORCODE = TAG_USER + 201;
+  { tags for xadAddFileEntry and xadAddDiskEntry (V10)  }
+  { set xai_InPos after call (V10)  }
+     XAD_SETINPOS = TAG_USER + 240;
+  { insert dirs at list start (V10)  }
+     XAD_INSERTDIRSFIRST = TAG_USER + 241;
+  { tags for xadConvertName (V12)  }
+  (* UWORD  , default is {'/','\\',0} in source charset (V12)  *)
+     XAD_PATHSEPERATOR = TAG_USER + 260;
+  { the characterset of string (V12)  }
+     XAD_CHARACTERSET = TAG_USER + 261;
+  { maximum size of following (V12)  }
+     XAD_STRINGSIZE = TAG_USER + 262;
+  { zero-terminated string (V12)  }
+     XAD_CSTRING = TAG_USER + 263;
+  { lengthed Pascal string (V12)  }
+     XAD_PSTRING = TAG_USER + 264;
+  { an xad string (V12)  }
+     XAD_XADSTRING = TAG_USER + 265;
+  { default is TRUE (V12)  }
+     XAD_ADDPATHSEPERATOR = TAG_USER + 266;
+  { tags for xadGetFilename (V12)  }
+  { default is FALSE (V12)  }
+     XAD_NOLEADINGPATH = TAG_USER + 280;
+  { default is FALSE (V12)  }
+     XAD_NOTRAILINGPATH = TAG_USER + 281;
+  { default are #?()[]~% :|",1-31,127-160 (V12)  }
+     XAD_MASKCHARACTERS = TAG_USER + 282;
+  { default is '_' (V12)  }
+     XAD_MASKINGCHAR = TAG_USER + 283;
+  { pointer which should hold buf size (V12)  }
+     XAD_REQUIREDBUFFERSIZE = TAG_USER + 284;
+  { Places 300-339 used for dates!  }
+  {                                                                       
+
+       objects for xadAllocObjectA					 
+   									 
+                                                                          }
+  { struct xadArchiveInfo  }
+     XADOBJ_ARCHIVEINFO = $0001;
+  { struct xadFileInfo  }
+     XADOBJ_FILEINFO = $0002;
+  { struct xadDiskInfo  }
+     XADOBJ_DISKINFO = $0003;
+  { struct HookParam  }
+     XADOBJ_HOOKPARAM = $0004;
+  { struct xadDeviceInfo  }
+     XADOBJ_DEVICEINFO = $0005;
+  { struct xadProgressInfo  }
+     XADOBJ_PROGRESSINFO = $0006;
+  { struct xadTextInfo  }
+     XADOBJ_TEXTINFO = $0007;
+  { struct xadSplitFile (V2)  }
+     XADOBJ_SPLITFILE = $0008;
+  { struct xadSkipInfo (V3)  }
+     XADOBJ_SKIPINFO = $0009;
+  { struct xadImageInfo (V4)  }
+     XADOBJ_IMAGEINFO = $000A;
+  { struct xadSpecial (V11)  }
+     XADOBJ_SPECIAL = $000B;
+  { result type of xadAllocVec  }
+  { memory of requested size and type  }
+     XADOBJ_MEMBLOCK = $0100;
+  { private type  }
+  { an typed XAD string (V12)  }
+     XADOBJ_STRING = $0101;
+  {                                                                       
+
+       modes for xadCalcCRC126 and xadCalcCRC32				 
+   									 
+                                                                          }
+     XADCRC16_ID1 = $A001;
+     XADCRC32_ID1 = $EDB88320;
+  {
+   									 
+       hook related stuff 						 
+
+                                                                          }
+  { read data into buffer  }
+     XADHC_READ = 1;
+  { write buffer data to file/memory  }
+     XADHC_WRITE = 2;
+  { seek in file  }
+     XADHC_SEEK = 3;
+  { initialize the hook  }
+     XADHC_INIT = 4;
+  { end up hook work, free stuff  }
+     XADHC_FREE = 5;
+  { an error occured, delete partial stuff  }
+     XADHC_ABORT = 6;
+  { complete input size is needed  }
+     XADHC_FULLSIZE = 7;
+  { return disk image info (V4)  }
+     XADHC_IMAGEINFO = 8;
+ 
+  type
+     PxadHookParam = ^txadHookParam;
+     txadHookParam = record
+          xhp_Command : ULONG;
+          xhp_CommandData : LONG;
+          xhp_BufferPtr : APTR;
+          xhp_BufferSize : ULONG;
+          xhp_DataPos : ULONG;     { current seek position  }
+          xhp_PrivatePtr : APTR;
+          xhp_TagList : APTR;      { allows to transport tags to hook (V9)  }
+       end;
+
+  { xadHookAccess commands  }
+  { get data  }
+
+  const
+     XADAC_READ = 10;
+  { write data  }
+     XADAC_WRITE = 11;
+  { copy input to output  }
+     XADAC_COPY = 12;
+  { seek in input file  }
+     XADAC_INPUTSEEK = 13;
+  { seek in output file  }
+     XADAC_OUTPUTSEEK = 14;
+  {
+
+       support structures
+
+                                                                          }
+  { Own date structure to cover all possible dates in a human friendly
+     format. xadConvertDates may be used to convert between different date
+     structures and variables.  }
+
+  type
+     PxadDate = ^txadDate;
+     txadDate = record
+          xd_Micros : ULONG;  { values 0 to 999999	   }
+          xd_Year : LONG;     { values 1 to 2147483648  }
+          xd_Month : UBYTE;   { values 1 to 12	   }
+          xd_WeekDay : UBYTE; { values 1 to 7	   }
+          xd_Day : UBYTE;     { values 1 to 31	   }
+          xd_Hour : UBYTE;    { values 0 to 23	   }
+          xd_Minute : UBYTE;  { values 0 to 59	   }
+          xd_Second : UBYTE;  { values 0 to 59	   }
+       end;
+
+  { monday is the first day and  }
+
+  const
+     XADDAY_MONDAY = 1;
+     XADDAY_TUESDAY = 2;
+     XADDAY_WEDNESDAY = 3;
+     XADDAY_THURSDAY = 4;
+     XADDAY_FRIDAY = 5;
+     XADDAY_SATURDAY = 6;
+  { sunday the last day of a week  }
+     XADDAY_SUNDAY = 7;
+ 
+  type
+     PxadDeviceInfo = ^txadDeviceInfo;
+     txadDeviceInfo = record         { for XAD_OUTDEVICE tag  }                       
+          xdi_DeviceName : STRPTR;   { name of device  }                              
+          xdi_Unit : ULONG;	     { unit of device  }                              
+          xdi_DOSName : STRPTR;	     { instead of Device+Unit, dos name without ':'  }
+       end;
+
+     PxadSplitFile = ^txadSplitFile;
+     txadSplitFile = record           { for XAD_INSPLITTED  }    
+          xsf_Next : PxadSplitFile;                                           
+          xsf_Type : ULONG;	      { XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK  }  
+          xsf_Size : ULONG;	      { necessary for XAD_INMEMORY, useful for others  }               
+          xsf_Data : ULONG;	      { FileName, Filehandle, Hookpointer or Memory  }               
+       end;
+
+     PxadSkipInfo = ^txadSkipInfo;
+     txadSkipInfo = record
+          xsi_Next : PxadSkipInfo;
+          xsi_Position : ULONG;     { position, where it should be skipped  }
+          xsi_SkipSize : ULONG;     { size to skip  }
+       end;
+
+     PxadImageInfo = ^txadImageInfo;
+     txadImageInfo = record          { for XADHC_IMAGEINFO  }   
+          xii_SectorSize : ULONG;    { usually 512  }           
+          xii_FirstSector : ULONG;   { of the image file  }     
+          xii_NumSectors : ULONG;    { of the image file  }     
+          xii_TotalSectors : ULONG;  { of this device type  }   
+       end;
+
+   type
+     PxadClient = ^txadClient;
+     txadClient = record
+          xc_Next : PxadClient;
+          xc_Version : UWORD;         { set to XADCLIENT_VERSION  }
+          xc_MasterVersion : UWORD;
+          xc_ClientVersion : UWORD;
+          xc_ClientRevision : UWORD;
+          xc_RecogSize : ULONG;       { needed size to recog the type  }
+          xc_Flags : ULONG;           { see XADCF_xxx defines  }
+          xc_Identifier : ULONG;      { ID of internal clients  }
+          xc_ArchiverName : STRPTR;
+          xc_RecogData : function :BOOL;
+          xc_GetInfo : function :LONG;
+          xc_UnArchive : function :LONG;
+          xc_Free : procedure ;
+       end;
+
+  { function interface
+  ASM(BOOL) xc_RecogData(REG(d0, ULONG size), REG(a0, STRPTR data),
+  		REG(a6, struct xadMasterBase  xadMasterBase));
+  ASM(LONG) xc_GetInfo(REG(a0, struct xadArchiveInfo  ai),
+  		REG(a6, struct xadMasterBase  xadMasterBase));
+  ASM(LONG) xc_UnArchive(REG(a0, struct xadArchiveInfo  ai),
+  		REG(a6, struct xadMasterBase  xadMasterBase));
+  ASM(void) xc_Free(REG(a0, struct xadArchiveInfo  ai),
+  		REG(a6, struct xadMasterBase  xadMasterBase));
+   }
+  { xc_RecogData returns 1 when recognized and 0 when not, all the others
+     return 0 when ok and XADERR values on error. xc_Free has no return
+     value.
+
+     Filesystem clients need to clear xc_RecogSize and xc_RecogData. The
+     recognition is automatically done by GetInfo. XADERR_FILESYSTEM is
+     returned in case of unknown format. If it is known detection should
+     go on and any other code may be returned, if it fails.
+     The field xc_ArchiverName means xc_FileSystemName for filesystem
+     clients.
+   }
+
+  type
+     PxadSpecialUnixDevice = ^txadSpecialUnixDevice;
+     txadSpecialUnixDevice = record
+          xfis_MajorVersion : ULONG;    { major device version  }
+          xfis_MinorVersion : ULONG;    { minor device version  }
+       end;
+
+     PxadSpecialAmigaAddress = ^txadSpecialAmigaAddress;
+     txadSpecialAmigaAddress = record
+          xfis_JumpAddress : ULONG;      { code executaion start address  }
+          xfis_DecrunchAddress : ULONG;  { decrunch start of code  }
+       end;
+
+     PxadSpecialCBM8bit = ^txadSpecialCBM8bit;
+     txadSpecialCBM8bit = record
+          xfis_FileType : UBYTE;       { File type XADCBM8BITTYPE_xxx  }
+          xfis_RecordLength : UBYTE;   { record length if relative file  }
+       end;
+ 
+  type
+     PxadSpecial = ^txadSpecial;
+     txadSpecial = record
+          xfis_Type : ULONG;           { XADSPECIALTYPE to define type of block (V11)  }
+          xfis_Next : PxadSpecial;     { pointer to next entry  }
+          xfis_Data : record
+              case longint of
+                 0 : ( xfis_UnixDevice : txadSpecialUnixDevice );
+                 1 : ( xfis_AmigaAddress : txadSpecialAmigaAddress );
+                 2 : ( xfis_CBM8bit : txadSpecialCBM8bit );
+              end;
+       end;
+
+  { Multiuser fields (xfi_OwnerUID, xfi_OwnerUID, xfi_UserName, xfi_GroupName)
+     and multiuser bits (see <dos/dos.h>) are currently not supported with normal
+     Amiga filesystem. But the clients support them, if archive format holds
+     such information.
+
+     The protection bits (all 3 fields) should always be set using the
+     xadConvertProtection procedure. Call it with as much protection information
+     as possible. It extracts the relevant data at best (and also sets the 2 flags).
+     DO NOT USE these fields directly, but always through xadConvertProtection
+     call.
+   }
+
+  type
+     PxadFileInfo = ^txadFileInfo;
+     txadFileInfo = record
+          xfi_Next : PxadFileInfo;
+          xfi_EntryNumber : ULONG;       { number of entry  }                         
+          xfi_EntryInfo : STRPTR;	 { additional archiver text  }                
+          xfi_PrivateInfo : APTR;	 { client private, see XAD_OBJPRIVINFOSIZE  } 
+          xfi_Flags : ULONG;		 { see XADFIF_xxx defines  }                  
+          xfi_FileName : STRPTR;	 { see XAD_OBJNAMESIZE tag  }                 
+          xfi_Comment : STRPTR;		 { see XAD_OBJCOMMENTSIZE tag  }              
+          xfi_Protection : ULONG;	 { OS 3 bits (including multiuser)  }         
+          xfi_OwnerUID : ULONG;		 { user ID  }                                 
+          xfi_OwnerGID : ULONG;		 { group ID  }                                
+          xfi_UserName : STRPTR;	 { user name  }                               
+          xfi_GroupName : STRPTR;	 { group name  }                              
+          xfi_Size : ULONG;		 { size of this file  }                       
+          xfi_GroupCrSize : ULONG;	 { crunched size of group  }                  
+          xfi_CrunchSize : ULONG;	 { crunched size  }                           
+          xfi_LinkName : STRPTR;	 { name and path of link  }                   
+          xfi_Date : txadDate;
+          xfi_Generation : UWORD;        { File Generation [0...0xFFFF] (V3)  }             
+          xfi_DataPos : ULONG;		 { crunched data position (V3)  }                   
+          xfi_MacFork : PxadFileInfo;	 { pointer to 2nd fork for Mac (V7)  }              
+          xfi_UnixProtect : UWORD;	 { protection bits for Unix (V11)  }                
+          xfi_DosProtect : UBYTE;	 { protection bits for MS-DOS (V11)  }              
+          xfi_FileType : UBYTE;		 { XADFILETYPE to define type of exe files (V11)  } 
+          xfi_Special : PxadSpecial;	 { pointer to special data (V11)  }                 
+       end;
+
+ { NOTE: the texts passed with that structure must not always be printable.
+     Although the clients should add an additional (not counted) zero at the text
+     end, the whole file may contain other unprintable stuff (e.g. for DMS).
+     So when printing this texts do it on a byte for byte base including
+     printability checks.
+   }
+  
+ type
+     PxadTextInfo = ^txadTextInfo;
+     txadTextInfo = record
+          xti_Next : PxadTextInfo;
+          xti_Size : ULONG;      { maybe zero - no text - e.g. when crypted  }
+          xti_Text : STRPTR;     { and there is no password in xadGetInfo()  }
+          xti_Flags : ULONG;     { see XADTIF_xxx defines  }
+ 
+       end;  
+
+  type
+     PxadDiskInfo = ^txadDiskInfo;
+     txadDiskInfo = record
+          xdi_Next : PxadDiskInfo;
+          xdi_EntryNumber : ULONG;    { number of entry  }                            
+          xdi_EntryInfo : STRPTR;     { additional archiver text  }                   
+          xdi_PrivateInfo : APTR;     { client private, see XAD_OBJPRIVINFOSIZE  }    
+          xdi_Flags : ULONG;	      { see XADDIF_xxx defines  }                     
+          xdi_SectorSize : ULONG;
+          xdi_TotalSectors : ULONG;   { see devices/trackdisk.h  }      
+          xdi_Cylinders : ULONG;      { to find out what these  }      
+          xdi_CylSectors : ULONG;     { fields mean, they are equal  } 
+          xdi_Heads : ULONG;	      { to struct DriveGeometry  }     
+          xdi_TrackSectors : ULONG;
+          xdi_LowCyl : ULONG;         { lowest cylinder stored  }                              
+          xdi_HighCyl : ULONG;	      { highest cylinder stored  }                             
+          xdi_BlockInfoSize : ULONG;  { number of BlockInfo entries  }                         
+          xdi_BlockInfo : Pointer;    { see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag  }  
+          xdi_TextInfo : PxadTextInfo;{ linked list with info texts  }                         
+          xdi_DataPos : ULONG;	      { crunched data position (V3)  }                         
+       end;
+
+  { BlockInfo points to a UBYTE field for every track from first sector of
+     lowest cylinder to last sector of highest cylinder. When not used,
+     pointer must be 0. Do not use it, when there are no entries!
+     This is just for information. The applications still asks the client
+     to unarchive whole cylinders and not archived blocks are cleared for
+     unarchiving.
+   }
+
+  { If the image file holds total data of disk xii_TotalSectors equals
+     xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector
+     and xii_NumSectors cannot exceed xii_TotalSectors value!
+   }
+  {
+
+       information structures
+
+                                                                          }
+     PxadArchiveInfo = ^txadArchiveInfo;
+     txadArchiveInfo = record
+          xai_Client : PxadClient;         { pointer to unarchiving client  }                     
+          xai_PrivateClient : APTR;	   { private client data  }                               
+          xai_Password : STRPTR;	   { password for crypted archives  }                     
+          xai_Flags : ULONG;		   { read only XADAIF_ flags  }                           
+          xai_LowCyl : ULONG;		   { lowest cylinder to unarchive  }                      
+          xai_HighCyl : ULONG;		   { highest cylinder to unarchive  }                     
+          xai_InPos : ULONG;		   { input position, read only  }                         
+          xai_InSize : ULONG;		   { input size, read only  }                             
+          xai_OutPos : ULONG;		   { output position, read only  }                        
+          xai_OutSize : ULONG;		   { output file size, read only  }                       
+          xai_FileInfo : PxadFileInfo;	   { data pointer for file arcs  }                        
+          xai_DiskInfo : PxadDiskInfo;	   { data pointer for disk arcs  }                        
+          xai_CurFile : PxadFileInfo;	   { data pointer for current file arc  }                 
+          xai_CurDisk : PxadDiskInfo;	   { data pointer for current disk arc  }                 
+          xai_LastError : LONG;		   { last error, when XADAIF_FILECORRUPT (V2)  }          
+          xai_MultiVolume : PULONG;	   { array of start offsets from parts (V2)  }            
+          xai_SkipInfo : PxadSkipInfo;	   { linked list of skip entries (V3)  }                  
+          xai_ImageInfo : PxadImageInfo;   { for filesystem clients (V5)  }                       
+          xai_InName : STRPTR;		   { Input archive name if available (V7)  }              
+       end;
+
+
+
+  { This structure is nearly complete private to either xadmaster or its
+  clients. An application program may access for reading only xai_Client,
+  xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
+  and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
+  not be accessed!  }
+  { archive entries are encrypted  }
+
+  const
+     XADAIB_CRYPTED = 0;
+  { file is corrupt, but valid entries are in the list  }
+     XADAIB_FILECORRUPT = 1;
+  { unarchive file entry  }
+     XADAIB_FILEARCHIVE = 2;
+  { unarchive disk entry  }
+     XADAIB_DISKARCHIVE = 3;
+  { overwrite the file (PRIVATE)  }
+     XADAIB_OVERWRITE = 4;
+  { create directory when missing (PRIVATE)  }
+     XADAIB_MAKEDIRECTORY = 5;
+  { ignore drive geometry (PRIVATE)  }
+     XADAIB_IGNOREGEOMETRY = 6;
+  { verify is turned on for disk hook (PRIVATE)  }
+     XADAIB_VERIFY = 7;
+  { do not delete partial files (PRIVATE)  }
+     XADAIB_NOKILLPARTIAL = 8;
+  { is disk image extraction (V5)  }
+     XADAIB_DISKIMAGE = 9;
+  { format in disk hook (PRIVATE)  }
+     XADAIB_FORMAT = 10;
+  { do not create empty error (PRIVATE)  }
+     XADAIB_NOEMPTYERROR = 11;
+  { in stuff only (PRIVATE)  }
+     XADAIB_ONLYIN = 12;
+  { out stuff only (PRIVATE)  }
+     XADAIB_ONLYOUT = 13;
+  { use SectorLabels (PRIVATE)  }
+     XADAIB_USESECTORLABELS = 14;
+     XADAIF_CRYPTED = 1 shl XADAIB_CRYPTED;
+     XADAIF_FILECORRUPT = 1 shl XADAIB_FILECORRUPT;
+     XADAIF_FILEARCHIVE = 1 shl XADAIB_FILEARCHIVE;
+     XADAIF_DISKARCHIVE = 1 shl XADAIB_DISKARCHIVE;
+     XADAIF_OVERWRITE = 1 shl XADAIB_OVERWRITE;
+     XADAIF_MAKEDIRECTORY = 1 shl XADAIB_MAKEDIRECTORY;
+     XADAIF_IGNOREGEOMETRY = 1 shl XADAIB_IGNOREGEOMETRY;
+     XADAIF_VERIFY = 1 shl XADAIB_VERIFY;
+     XADAIF_NOKILLPARTIAL = 1 shl XADAIB_NOKILLPARTIAL;
+     XADAIF_DISKIMAGE = 1 shl XADAIB_DISKIMAGE;
+     XADAIF_FORMAT = 1 shl XADAIB_FORMAT;
+     XADAIF_NOEMPTYERROR = 1 shl XADAIB_NOEMPTYERROR;
+     XADAIF_ONLYIN = 1 shl XADAIB_ONLYIN;
+     XADAIF_ONLYOUT = 1 shl XADAIB_ONLYOUT;
+     XADAIF_USESECTORLABELS = 1 shl XADAIB_USESECTORLABELS;
+
+  { These are used for xfi_FileType to define file type. (V11)  }
+  { infile was only one data file  }
+
+  const
+     XADFILETYPE_DATACRUNCHER = 1;
+  { infile was text-linked  }
+     XADFILETYPE_TEXTLINKER = 2;
+  { infile was an Amiga exe cruncher  }
+     XADFILETYPE_AMIGAEXECRUNCHER = 11;
+  { infile was an Amiga exe linker  }
+     XADFILETYPE_AMIGAEXELINKER = 12;
+  { infile was an Amiga text-exe linker  }
+     XADFILETYPE_AMIGATEXTLINKER = 13;
+  { infile was an Amiga address cruncher  }
+     XADFILETYPE_AMIGAADDRESS = 14;
+  { this file is a block device  }
+     XADFILETYPE_UNIXBLOCKDEVICE = 21;
+  { this file is a character device  }
+     XADFILETYPE_UNIXCHARDEVICE = 22;
+  { this file is a named pipe  }
+     XADFILETYPE_UNIXFIFO = 23;
+  { this file is a socket  }
+     XADFILETYPE_UNIXSOCKET = 24;
+  { infile was an MSDOS exe cruncher  }
+     XADFILETYPE_MSDOSEXECRUNCHER = 31;
+  { xadSpecial entry is xadSpecialUnixDevice  }
+     XADSPECIALTYPE_UNIXDEVICE = 1;
+  { xadSpecial entry is xadSpecialAmigaAddress  }
+     XADSPECIALTYPE_AMIGAADDRESS = 2;
+  { xadSpecial entry is xadSpecialCBM8bit  }
+     XADSPECIALTYPE_CBM8BIT = 3;
+ 
+
+
+  {	  Unknown / Unused  }
+
+  const
+     XADCBM8BITTYPE_UNKNOWN = $00;
+  { Tape - BASIC program file  }
+     XADCBM8BITTYPE_BASIC = $01;
+  { Tape - Data block (SEQ file)  }
+     XADCBM8BITTYPE_DATA = $02;
+  { Tape - Fixed addres program file  }
+     XADCBM8BITTYPE_FIXED = $03;
+  { Tape - Sequential data file  }
+     XADCBM8BITTYPE_SEQDATA = $04;
+  { Disk - Sequential file "SEQ"  }
+     XADCBM8BITTYPE_SEQ = $81;
+  { Disk - Program file "PRG"  }
+     XADCBM8BITTYPE_PRG = $82;
+  { Disk - User-defined file "USR"  }
+     XADCBM8BITTYPE_USR = $83;
+  { Disk - Relative records file "REL"  }
+     XADCBM8BITTYPE_REL = $84;
+  { Disk - CBM (partition) "CBM"  }
+     XADCBM8BITTYPE_CBM = $85;
+ 
+
+
+  { entry is crypted  }
+
+  const
+     XADFIB_CRYPTED = 0;
+  { entry is a directory  }
+     XADFIB_DIRECTORY = 1;
+  { entry is a link  }
+     XADFIB_LINK = 2;
+  { file is an information text  }
+     XADFIB_INFOTEXT = 3;
+  { file is in a crunch group  }
+     XADFIB_GROUPED = 4;
+  { crunch group ends here  }
+     XADFIB_ENDOFGROUP = 5;
+  { no date supported, CURRENT date is set  }
+     XADFIB_NODATE = 6;
+  { file is marked as deleted (V3)  }
+     XADFIB_DELETED = 7;
+  { before unarchiving the datapos is set (V3)  }
+     XADFIB_SEEKDATAPOS = 8;
+  { there was no filename, using internal one (V6)  }
+     XADFIB_NOFILENAME = 9;
+  { file size is unknown and thus set to zero (V6)  }
+     XADFIB_NOUNCRUNCHSIZE = 10;
+  { file is only partial (V6)  }
+     XADFIB_PARTIALFILE = 11;
+  { file is Apple data fork (V7)  }
+     XADFIB_MACDATA = 12;
+  { file is Apple resource fork (V7)  }
+     XADFIB_MACRESOURCE = 13;
+  { allows extract file during scanning (V10)  }
+     XADFIB_EXTRACTONBUILD = 14;
+  { UNIX protection bits are present (V11)  }
+     XADFIB_UNIXPROTECTION = 15;
+  { MSDOS protection bits are present (V11)  }
+     XADFIB_DOSPROTECTION = 16;
+  { this entry may change until GetInfo is finished (V11)  }
+     XADFIB_ENTRYMAYCHANGE = 17;
+  { the xfi_FileName fields is an XAD string (V12)  }
+     XADFIB_XADSTRFILENAME = 18;
+  { the xfi_LinkName fields is an XAD string (V12)  }
+     XADFIB_XADSTRLINKNAME = 19;
+  { the xfi_Comment fields is an XAD string (V12)  }
+     XADFIB_XADSTRCOMMENT = 20;
+     XADFIF_CRYPTED = 1 shl XADFIB_CRYPTED;
+     XADFIF_DIRECTORY = 1 shl XADFIB_DIRECTORY;
+     XADFIF_LINK = 1 shl XADFIB_LINK;
+     XADFIF_INFOTEXT = 1 shl XADFIB_INFOTEXT;
+     XADFIF_GROUPED = 1 shl XADFIB_GROUPED;
+     XADFIF_ENDOFGROUP = 1 shl XADFIB_ENDOFGROUP;
+     XADFIF_NODATE = 1 shl XADFIB_NODATE;
+     XADFIF_DELETED = 1 shl XADFIB_DELETED;
+     XADFIF_SEEKDATAPOS = 1 shl XADFIB_SEEKDATAPOS;
+     XADFIF_NOFILENAME = 1 shl XADFIB_NOFILENAME;
+     XADFIF_NOUNCRUNCHSIZE = 1 shl XADFIB_NOUNCRUNCHSIZE;
+     XADFIF_PARTIALFILE = 1 shl XADFIB_PARTIALFILE;
+     XADFIF_MACDATA = 1 shl XADFIB_MACDATA;
+     XADFIF_MACRESOURCE = 1 shl XADFIB_MACRESOURCE;
+     XADFIF_EXTRACTONBUILD = 1 shl XADFIB_EXTRACTONBUILD;
+     XADFIF_UNIXPROTECTION = 1 shl XADFIB_UNIXPROTECTION;
+     XADFIF_DOSPROTECTION = 1 shl XADFIB_DOSPROTECTION;
+     XADFIF_ENTRYMAYCHANGE = 1 shl XADFIB_ENTRYMAYCHANGE;
+     XADFIF_XADSTRFILENAME = 1 shl XADFIB_XADSTRFILENAME;
+     XADFIF_XADSTRLINKNAME = 1 shl XADFIB_XADSTRLINKNAME;
+     XADFIF_XADSTRCOMMENT = 1 shl XADFIB_XADSTRCOMMENT;
+ 
+
+
+  { entry is empty, as data was crypted  }
+
+  const
+     XADTIB_CRYPTED = 0;
+  { text is a banner  }
+     XADTIB_BANNER = 1;
+  { text is a file description  }
+     XADTIB_FILEDIZ = 2;
+     XADTIF_CRYPTED = 1 shl XADTIB_CRYPTED;
+     XADTIF_BANNER = 1 shl XADTIB_BANNER;
+     XADTIF_FILEDIZ = 1 shl XADTIB_FILEDIZ;
+
+  { entry is crypted  }
+
+  const
+     XADDIB_CRYPTED = 0;
+  { before unarchiving the datapos is set (V3)  }
+     XADDIB_SEEKDATAPOS = 1;
+  { the clients delivers sector labels (V9)  }
+     XADDIB_SECTORLABELS = 2;
+  { allows extract disk during scanning (V10)  }
+     XADDIB_EXTRACTONBUILD = 3;
+  { this entry may change until GetInfo is finished (V11)  }
+     XADDIB_ENTRYMAYCHANGE = 4;
+  { Some of the crunchers do not store all necessary information, so it
+  may be needed to guess some of them. Set the following flags in that case
+  and geometry check will ignore these fields.  }
+  { sectorsize is guessed (V10)  }
+     XADDIB_GUESSSECTORSIZE = 5;
+  { totalsectors number is guessed (V10)  }
+     XADDIB_GUESSTOTALSECTORS = 6;
+  { cylinder number is guessed  }
+     XADDIB_GUESSCYLINDERS = 7;
+  { cylsectors is guessed  }
+     XADDIB_GUESSCYLSECTORS = 8;
+  { number of heads is guessed  }
+     XADDIB_GUESSHEADS = 9;
+  { tracksectors is guessed  }
+     XADDIB_GUESSTRACKSECTORS = 10;
+  { lowcyl is guessed  }
+     XADDIB_GUESSLOWCYL = 11;
+  { highcyl is guessed  }
+     XADDIB_GUESSHIGHCYL = 12;
+  { If it is impossible to set some of the fields, you need to set some of
+  these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
+  of usage of lowcyl and highcyl keywords. When you have cylinder information,
+  you should not use these and instead use guess flags and calculate
+  possible values for the missing fields.  }
+  { cylinder number is not set  }
+     XADDIB_NOCYLINDERS = 15;
+  { cylsectors is not set  }
+     XADDIB_NOCYLSECTORS = 16;
+  { number of heads is not set  }
+     XADDIB_NOHEADS = 17;
+  { tracksectors is not set  }
+     XADDIB_NOTRACKSECTORS = 18;
+  { lowcyl is not set  }
+     XADDIB_NOLOWCYL = 19;
+  { highcyl is not set  }
+     XADDIB_NOHIGHCYL = 20;
+     XADDIF_CRYPTED = 1 shl XADDIB_CRYPTED;
+     XADDIF_SEEKDATAPOS = 1 shl XADDIB_SEEKDATAPOS;
+     XADDIF_SECTORLABELS = 1 shl XADDIB_SECTORLABELS;
+     XADDIF_EXTRACTONBUILD = 1 shl XADDIB_EXTRACTONBUILD;
+     XADDIF_ENTRYMAYCHANGE = 1 shl XADDIB_ENTRYMAYCHANGE;
+     XADDIF_GUESSSECTORSIZE = 1 shl XADDIB_GUESSSECTORSIZE;
+     XADDIF_GUESSTOTALSECTORS = 1 shl XADDIB_GUESSTOTALSECTORS;
+     XADDIF_GUESSCYLINDERS = 1 shl XADDIB_GUESSCYLINDERS;
+     XADDIF_GUESSCYLSECTORS = 1 shl XADDIB_GUESSCYLSECTORS;
+     XADDIF_GUESSHEADS = 1 shl XADDIB_GUESSHEADS;
+     XADDIF_GUESSTRACKSECTORS = 1 shl XADDIB_GUESSTRACKSECTORS;
+     XADDIF_GUESSLOWCYL = 1 shl XADDIB_GUESSLOWCYL;
+     XADDIF_GUESSHIGHCYL = 1 shl XADDIB_GUESSHIGHCYL;
+     XADDIF_NOCYLINDERS = 1 shl XADDIB_NOCYLINDERS;
+     XADDIF_NOCYLSECTORS = 1 shl XADDIB_NOCYLSECTORS;
+     XADDIF_NOHEADS = 1 shl XADDIB_NOHEADS;
+     XADDIF_NOTRACKSECTORS = 1 shl XADDIB_NOTRACKSECTORS;
+     XADDIF_NOLOWCYL = 1 shl XADDIB_NOLOWCYL;
+     XADDIF_NOHIGHCYL = 1 shl XADDIB_NOHIGHCYL;
+  { defines for BlockInfo  }
+  { this block was cleared for archiving  }
+     XADBIB_CLEARED = 0;
+  { this block was not archived  }
+     XADBIB_UNUSED = 1;
+     XADBIF_CLEARED = 1 shl XADBIB_CLEARED;
+     XADBIF_UNUSED = 1 shl XADBIB_UNUSED;
+  {
+   									 
+       progress report stuff
+   									 }
+  type
+     PxadProgressInfo = ^txadProgressInfo;
+     txadProgressInfo = record
+          xpi_Mode : ULONG;                { work modus  }                             
+          xpi_Client : PxadClient;	   { the client doing the work  }              
+          xpi_DiskInfo : PxadDiskInfo;	   { current diskinfo, for disks  }            
+          xpi_FileInfo : PxadFileInfo;	   { current info for files  }                 
+          xpi_CurrentSize : ULONG;	   { current filesize  }                       
+          xpi_LowCyl : ULONG;		   { for disks only  }                         
+          xpi_HighCyl : ULONG;		   { for disks only  }                         
+          xpi_Status : ULONG;		   { see XADPIF flags  }                       
+          xpi_Error : LONG;		   { any of the error codes  }                 
+          xpi_FileName : STRPTR;	   { name of file to overwrite (V2)  }         
+          xpi_NewName : STRPTR;		   { new name buffer, passed by hook (V2)  }   
+       end;
+
+  { NOTE: For disks CurrentSize is Sector SectorSize, where SectorSize can
+  be found in xadDiskInfo structure. So you may output the sector value.  }
+  { different progress modes  }
+
+  const
+     XADPMODE_ASK = 1;
+     XADPMODE_PROGRESS = 2;
+     XADPMODE_END = 3;
+     XADPMODE_ERROR = 4;
+  { (V10)  }
+     XADPMODE_NEWENTRY = 5;
+  { (V11)  }
+     XADPMODE_GETINFOEND = 6;
+  { flags for progress hook and ProgressInfo status field  }
+  { overwrite the file  }
+     XADPIB_OVERWRITE = 0;
+  { create the directory  }
+     XADPIB_MAKEDIRECTORY = 1;
+  { ignore drive geometry  }
+     XADPIB_IGNOREGEOMETRY = 2;
+  { destination is a directory (V10)  }
+     XADPIB_ISDIRECTORY = 3;
+  { rename the file (V2)  }
+     XADPIB_RENAME = 10;
+  { all ok, proceed  }
+     XADPIB_OK = 16;
+  { skip file  }
+     XADPIB_SKIP = 17;
+     XADPIF_OVERWRITE = 1 shl XADPIB_OVERWRITE;
+     XADPIF_MAKEDIRECTORY = 1 shl XADPIB_MAKEDIRECTORY;
+     XADPIF_IGNOREGEOMETRY = 1 shl XADPIB_IGNOREGEOMETRY;
+     XADPIF_ISDIRECTORY = 1 shl XADPIB_ISDIRECTORY;
+     XADPIF_RENAME = 1 shl XADPIB_RENAME;
+     XADPIF_OK = 1 shl XADPIB_OK;
+     XADPIF_SKIP = 1 shl XADPIB_SKIP;
+  {                                                                       
+
+       errors								 
+
+                                                                          }
+  { no error  }
+     XADERR_OK = $0000;
+  { unknown error  }
+     XADERR_UNKNOWN = $0001;
+  { input data buffers border exceeded  }
+     XADERR_INPUT = $0002;
+  { output data buffers border exceeded  }
+     XADERR_OUTPUT = $0003;
+  { function called with illegal parameters  }
+     XADERR_BADPARAMS = $0004;
+  { not enough memory available  }
+     XADERR_NOMEMORY = $0005;
+  { data is corrupted  }
+     XADERR_ILLEGALDATA = $0006;
+  { command is not supported  }
+     XADERR_NOTSUPPORTED = $0007;
+  { required resource missing  }
+     XADERR_RESOURCE = $0008;
+  { error on decrunching  }
+     XADERR_DECRUNCH = $0009;
+  { unknown file type  }
+     XADERR_FILETYPE = $000A;
+  { opening file failed  }
+     XADERR_OPENFILE = $000B;
+  { file, disk has been skipped  }
+     XADERR_SKIP = $000C;
+  { user break in progress hook  }
+     XADERR_BREAK = $000D;
+  { file already exists  }
+     XADERR_FILEEXISTS = $000E;
+  { missing or wrong password  }
+     XADERR_PASSWORD = $000F;
+  { could not create directory  }
+     XADERR_MAKEDIR = $0010;
+  { wrong checksum  }
+     XADERR_CHECKSUM = $0011;
+  { verify failed (disk hook)  }
+     XADERR_VERIFY = $0012;
+  { wrong drive geometry  }
+     XADERR_GEOMETRY = $0013;
+  { unknown data format  }
+     XADERR_DATAFORMAT = $0014;
+  { source contains no files  }
+     XADERR_EMPTY = $0015;
+  { unknown filesystem  }
+     XADERR_FILESYSTEM = $0016;
+  { name of file exists as directory  }
+     XADERR_FILEDIR = $0017;
+  { buffer was to short  }
+     XADERR_SHORTBUFFER = $0018;
+  { text encoding was defective  }
+     XADERR_ENCODING = $0019;
+  {                                                                       
+
+       characterset and filename conversion				 
+
+                                                                          }
+  { this is the ONLY destination setting for clients!  }
+     CHARSET_HOST = 0;
+  { 16bit Unicode (usually no source type)  }
+     CHARSET_UNICODE_UCS2_HOST = 10;
+  { 16bit Unicode big endian storage  }
+     CHARSET_UNICODE_UCS2_BIGENDIAN = 11;
+  { 16bit Unicode little endian storage  }
+     CHARSET_UNICODE_UCS2_LITTLEENDIAN = 12;
+  { variable size unicode encoding  }
+     CHARSET_UNICODE_UTF8 = 13;
+  { all the 1xx types are generic types which also maybe a bit dynamic  }
+  { the default Amiga charset  }
+     CHARSET_AMIGA = 100;
+  { the default MSDOS charset  }
+     CHARSET_MSDOS = 101;
+  { the default MacOS charset  }
+     CHARSET_MACOS = 102;
+  { the default C64 charset  }
+     CHARSET_C64 = 103;
+  { the default Atari ST charset  }
+     CHARSET_ATARI_ST = 104;
+  { the default Windows charset  }
+     CHARSET_WINDOWS = 105;
+  { all the 2xx to 9xx types are real charsets, use them whenever you know
+     what the data really is  }
+  { the lower 7 bits of ASCII charsets  }
+     CHARSET_ASCII = 200;
+  { the base charset  }
+     CHARSET_ISO_8859_1 = 201;
+  { Euro-sign fixed ISO variant  }
+     CHARSET_ISO_8859_15 = 215;
+  { Atari ST (US) charset  }
+     CHARSET_ATARI_ST_US = 300;
+  { C64 lower case charset  }
+     CHARSET_PETSCII_C64_LC = 301;
+  { IBM Codepage 437 charset  }
+     CHARSET_CODEPAGE_437 = 400;
+  { Windows Codepage 1252 charset  }
+     CHARSET_CODEPAGE_1252 = 401;
+  {                                                                       
+
+       client related stuff						 
+
+                                                                          }
+  type
+     PxadForeman = ^txadForeman;
+     txadForeman = record
+          xfm_Security : ULONG;      { should be XADFOREMAN_SECURITY  }
+          xfm_ID : ULONG;            { must be XADFOREMAN_ID  }
+          xfm_Version : UWORD;       { set to XADFOREMAN_VERSION  }
+          xfm_Reserved : UWORD;
+          xfm_VersString : STRPTR;   { pointer to $VER: string  }
+          xfm_FirstClient : PxadClient; { pointer to first client  }
+       end;
+
+  { MOVEQ #-1,D0 and RTS  }
+
+  const
+     XADFOREMAN_SECURITY = $70FF4E75;
+  { 'XADF' identification ID  }
+     XADFOREMAN_ID = $58414446;
+     XADFOREMAN_VERSION = 1;
+ 
+
+
+  const
+     XADCLIENT_VERSION = 1;
+  { archiver is a file archiver  }
+     XADCB_FILEARCHIVER = 0;
+  { archiver is a disk archiver  }
+     XADCB_DISKARCHIVER = 1;
+  { external client, set by xadmaster  }
+     XADCB_EXTERN = 2;
+  { filesystem clients (V5)  }
+     XADCB_FILESYSTEM = 3;
+  { do not check size for recog call (V6)  }
+     XADCB_NOCHECKSIZE = 4;
+  { file archiver is plain data file (V11)  }
+     XADCB_DATACRUNCHER = 5;
+  { file archiver is executable file (V11)  }
+     XADCB_EXECRUNCHER = 6;
+  { file archiver is address crunched file (V11)  }
+     XADCB_ADDRESSCRUNCHER = 7;
+  { file archiver is a linker file (V11)  }
+     XADCB_LINKER = 8;
+  { master frees XAD strings (V12)  }
+     XADCB_FREEXADSTRINGS = 25;
+  { master frees xadSpecial  structures (V11)  }
+     XADCB_FREESPECIALINFO = 26;
+  { master frees xadSkipInfo structures (V3)  }
+     XADCB_FREESKIPINFO = 27;
+  { master frees xadTextInfo structures (V2)  }
+     XADCB_FREETEXTINFO = 28;
+  { master frees xadTextInfo text block (V2)  }
+     XADCB_FREETEXTINFOTEXT = 29;
+  { master frees xadFileInfo structures (V2)  }
+     XADCB_FREEFILEINFO = 30;
+  { master frees xadDiskInfo structures (V2)  }
+     XADCB_FREEDISKINFO = 31;
+     XADCF_FILEARCHIVER = 1 shl XADCB_FILEARCHIVER;
+     XADCF_DISKARCHIVER = 1 shl XADCB_DISKARCHIVER;
+     XADCF_EXTERN = 1 shl XADCB_EXTERN;
+     XADCF_FILESYSTEM = 1 shl XADCB_FILESYSTEM;
+     XADCF_NOCHECKSIZE = 1 shl XADCB_NOCHECKSIZE;
+     XADCF_DATACRUNCHER = 1 shl XADCB_DATACRUNCHER;
+     XADCF_EXECRUNCHER = 1 shl XADCB_EXECRUNCHER;
+     XADCF_ADDRESSCRUNCHER = 1 shl XADCB_ADDRESSCRUNCHER;
+     XADCF_LINKER = 1 shl XADCB_LINKER;
+     XADCF_FREEXADSTRINGS = 1 shl XADCB_FREEXADSTRINGS;
+     XADCF_FREESPECIALINFO = 1 shl XADCB_FREESPECIALINFO;
+     XADCF_FREESKIPINFO = 1 shl XADCB_FREESKIPINFO;
+     XADCF_FREETEXTINFO = 1 shl XADCB_FREETEXTINFO;
+     XADCF_FREETEXTINFOTEXT = 1 shl XADCB_FREETEXTINFOTEXT;
+     XADCF_FREEFILEINFO = 1 shl XADCB_FREEFILEINFO;
+     XADCF_FREEDISKINFO = 1 shl XADCB_FREEDISKINFO;
+  { The types 5 to 9 always need XADCB_FILEARCHIVER set also. These only specify
+  the type of the archiver somewhat better. Do not mix real archivers and these
+  single file data clients.  }
+  {
+
+       client ID's							 
+
+                                                                          }
+  { If an external client has set the xc_Identifier field, the internal
+  client is replaced.  }
+  { disk archivers start with 1000  }
+     XADCID_XMASH = 1000;
+     XADCID_SUPERDUPER3 = 1001;
+     XADCID_XDISK = 1002;
+     XADCID_PACKDEV = 1003;
+     XADCID_ZOOM = 1004;
+     XADCID_ZOOM5 = 1005;
+     XADCID_CRUNCHDISK = 1006;
+     XADCID_PACKDISK = 1007;
+     XADCID_MDC = 1008;
+     XADCID_COMPDISK = 1009;
+     XADCID_LHWARP = 1010;
+     XADCID_SAVAGECOMPRESSOR = 1011;
+     XADCID_WARP = 1012;
+     XADCID_GDC = 1013;
+     XADCID_DCS = 1014;
+  { file archivers start with 5000  }
+     XADCID_TAR = 5000;
+     XADCID_SDSSFX = 5001;
+     XADCID_LZX = 5002;
+     XADCID_MXMSIMPLEARC = 5003;
+     XADCID_LHPAK = 5004;
+     XADCID_AMIGAPLUSUNPACK = 5005;
+     XADCID_AMIPACK = 5006;
+     XADCID_LHA = 5007;
+     XADCID_LHASFX = 5008;
+     XADCID_PCOMPARC = 5009;
+     XADCID_SOMNI = 5010;
+     XADCID_LHSFX = 5011;
+     XADCID_XPKARCHIVE = 5012;
+     XADCID_SHRINK = 5013;
+     XADCID_SPACK = 5014;
+     XADCID_SPACKSFX = 5015;
+     XADCID_ZIP = 5016;
+     XADCID_WINZIPEXE = 5017;
+     XADCID_GZIP = 5018;
+     XADCID_ARC = 5019;
+     XADCID_ZOO = 5020;
+     XADCID_LHAEXE = 5021;
+     XADCID_ARJ = 5022;
+     XADCID_ARJEXE = 5023;
+     XADCID_ZIPEXE = 5024;
+     XADCID_LHF = 5025;
+     XADCID_COMPRESS = 5026;
+     XADCID_ACE = 5027;
+     XADCID_ACEEXE = 5028;
+     XADCID_GZIPSFX = 5029;
+     XADCID_HA = 5030;
+     XADCID_SQ = 5031;
+     XADCID_LHAC64SFX = 5032;
+     XADCID_SIT = 5033;
+     XADCID_SIT5 = 5034;
+     XADCID_SIT5EXE = 5035;
+     XADCID_MACBINARY = 5036;
+     XADCID_CPIO = 5037;
+     XADCID_PACKIT = 5038;
+  { filesystem client start with 8000  }
+     XADCID_FSAMIGA = 8000;
+     XADCID_FSSANITYOS = 8001;
+     XADCID_FSFAT = 8002;
+  { mixed archivers start with 9000  }
+     XADCID_DMS = 9000;
+     XADCID_DMSSFX = 9001;
+
+VAR xadMasterBase : pxadMasterBase;
+
+
+FUNCTION xadAddDiskEntryA(di : pxadDiskInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadAddFileEntryA(fi : pxadFileInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadAllocObjectA(_type : LONGINT; CONST tags : pTagItem) : POINTER;
+FUNCTION xadAllocVec(size : longword; flags : longword) : POINTER;
+FUNCTION xadCalcCRC16(id : longword; init : longword; size : longword; buffer : pCHAR) : WORD;
+FUNCTION xadCalcCRC32(id : longword; init : longword; size : longword; buffer : pCHAR) : longword;
+FUNCTION xadConvertDatesA(CONST tags : pTagItem) : LONGINT;
+FUNCTION xadConvertNameA(charset : longword; CONST tags : pTagItem) : pCHAR;
+FUNCTION xadConvertProtectionA(CONST tags : pTagItem) : LONGINT;
+PROCEDURE xadCopyMem(src : POINTER; dest : POINTER; size : longword);
+FUNCTION xadDiskFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadDiskUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadFreeHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+PROCEDURE xadFreeInfo(ai : pxadArchiveInfo);
+PROCEDURE xadFreeObjectA(obj : POINTER; CONST tags : pTagItem);
+FUNCTION xadGetClientInfo : pxadClient;
+FUNCTION xadGetDiskInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadGetErrorText(errnum : longword) : pCHAR;
+FUNCTION xadGetFilenameA(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadGetHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadGetInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadHookAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo) : LONGINT;
+FUNCTION xadHookTagAccessA(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+FUNCTION xadRecogFileA(size : longword; memory : POINTER; CONST tags : pTagItem) : pxadClient;
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION xadAddDiskEntry(di : pxadDiskInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadAddFileEntry(fi : pxadFileInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadAllocObject(_type : LONGINT; const tags : Array Of Const) : POINTER;
+FUNCTION xadConvertDates(const tags : Array Of Const) : LONGINT;
+FUNCTION xadConvertName(charset : longword; const tags : Array Of Const) : pCHAR;
+FUNCTION xadConvertProtection(const tags : Array Of Const) : LONGINT;
+FUNCTION xadDiskFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadDiskUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadFreeHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+PROCEDURE xadFreeObject(obj : POINTER; const tags : Array Of Const);
+FUNCTION xadGetDiskInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadGetFilename(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; const tags : Array Of Const) : LONGINT;
+FUNCTION xadGetHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadGetInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadHookTagAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+FUNCTION xadRecogFile(size : longword; memory : POINTER; const tags : Array Of Const) : pxadClient;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitXADMASTERLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    XADMASTERIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+uses
+{$ifndef dont_use_openlib}
+msgbox,
+{$endif dont_use_openlib}
+tagsarray;
+
+
+
+FUNCTION xadAddDiskEntryA(di : pxadDiskInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	di,A0
+	MOVEA.L	ai,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	xadMasterBase,A6
+	JSR	-162(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadAddFileEntryA(fi : pxadFileInfo; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	fi,A0
+	MOVEA.L	ai,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	xadMasterBase,A6
+	JSR	-156(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadAllocObjectA(_type : LONGINT; CONST tags : pTagItem) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	_type,D0
+	MOVEA.L	tags,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadAllocVec(size : longword; flags : longword) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	size,D0
+	MOVE.L	flags,D1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-108(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadCalcCRC16(id : longword; init : longword; size : longword; buffer : pCHAR) : WORD;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	id,D0
+	MOVE.L	init,D1
+	MOVE.L	size,D2
+	MOVEA.L	buffer,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-096(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadCalcCRC32(id : longword; init : longword; size : longword; buffer : pCHAR) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	id,D0
+	MOVE.L	init,D1
+	MOVE.L	size,D2
+	MOVEA.L	buffer,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-102(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadConvertDatesA(CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tags,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-090(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadConvertNameA(charset : longword; CONST tags : pTagItem) : pCHAR;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	charset,D0
+	MOVEA.L	tags,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-174(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadConvertProtectionA(CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	tags,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-126(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE xadCopyMem(src : POINTER; dest : POINTER; size : longword);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	src,A0
+	MOVEA.L	dest,A1
+	MOVE.L	size,D0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION xadDiskFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-138(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadDiskUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadFileUnArcA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadFreeHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-150(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+PROCEDURE xadFreeInfo(ai : pxadArchiveInfo);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+PROCEDURE xadFreeObjectA(obj : POINTER; CONST tags : pTagItem);
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	obj,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+  END;
+END;
+
+FUNCTION xadGetClientInfo : pxadClient;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	xadMasterBase,A6
+	JSR	-078(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadGetDiskInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-132(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadGetErrorText(errnum : longword) : pCHAR;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	errnum,D0
+	MOVEA.L	xadMasterBase,A6
+	JSR	-072(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadGetFilenameA(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	buffersize,D0
+	MOVEA.L	buffer,A0
+	MOVEA.L	path,A1
+	MOVEA.L	name,A2
+	MOVEA.L	tags,A3
+	MOVEA.L	xadMasterBase,A6
+	JSR	-168(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadGetHookAccessA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-144(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadGetInfoA(ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	ai,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadHookAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	command,D0
+	MOVE.L	data,D1
+	MOVEA.L	buffer,A0
+	MOVEA.L	ai,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-084(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadHookTagAccessA(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; CONST tags : pTagItem) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	command,D0
+	MOVE.L	data,D1
+	MOVEA.L	buffer,A0
+	MOVEA.L	ai,A1
+	MOVEA.L	tags,A2
+	MOVEA.L	xadMasterBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION xadRecogFileA(size : longword; memory : POINTER; CONST tags : pTagItem) : pxadClient;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVE.L	size,D0
+	MOVEA.L	memory,A0
+	MOVEA.L	tags,A1
+	MOVEA.L	xadMasterBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+{
+ Functions and procedures with array of const go here
+}
+FUNCTION xadAddDiskEntry(di : pxadDiskInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadAddDiskEntry := xadAddDiskEntryA(di , ai , readintags(tags));
+end;
+
+FUNCTION xadAddFileEntry(fi : pxadFileInfo; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadAddFileEntry := xadAddFileEntryA(fi , ai , readintags(tags));
+end;
+
+FUNCTION xadAllocObject(_type : LONGINT; const tags : Array Of Const) : POINTER;
+begin
+    xadAllocObject := xadAllocObjectA(_type , readintags(tags));
+end;
+
+FUNCTION xadConvertDates(const tags : Array Of Const) : LONGINT;
+begin
+    xadConvertDates := xadConvertDatesA(readintags(tags));
+end;
+
+FUNCTION xadConvertName(charset : longword; const tags : Array Of Const) : pCHAR;
+begin
+    xadConvertName := xadConvertNameA(charset , readintags(tags));
+end;
+
+FUNCTION xadConvertProtection(const tags : Array Of Const) : LONGINT;
+begin
+    xadConvertProtection := xadConvertProtectionA(readintags(tags));
+end;
+
+FUNCTION xadDiskFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadDiskFileUnArc := xadDiskFileUnArcA(ai , readintags(tags));
+end;
+
+FUNCTION xadDiskUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadDiskUnArc := xadDiskUnArcA(ai , readintags(tags));
+end;
+
+FUNCTION xadFileUnArc(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadFileUnArc := xadFileUnArcA(ai , readintags(tags));
+end;
+
+FUNCTION xadFreeHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadFreeHookAccess := xadFreeHookAccessA(ai , readintags(tags));
+end;
+
+PROCEDURE xadFreeObject(obj : POINTER; const tags : Array Of Const);
+begin
+    xadFreeObjectA(obj , readintags(tags));
+end;
+
+FUNCTION xadGetDiskInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadGetDiskInfo := xadGetDiskInfoA(ai , readintags(tags));
+end;
+
+FUNCTION xadGetFilename(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; const tags : Array Of Const) : LONGINT;
+begin
+    xadGetFilename := xadGetFilenameA(buffersize , buffer , path , name , readintags(tags));
+end;
+
+FUNCTION xadGetHookAccess(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadGetHookAccess := xadGetHookAccessA(ai , readintags(tags));
+end;
+
+FUNCTION xadGetInfo(ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadGetInfo := xadGetInfoA(ai , readintags(tags));
+end;
+
+FUNCTION xadHookTagAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; const tags : Array Of Const) : LONGINT;
+begin
+    xadHookTagAccess := xadHookTagAccessA(command , data , buffer , ai , readintags(tags));
+end;
+
+FUNCTION xadRecogFile(size : longword; memory : POINTER; const tags : Array Of Const) : pxadClient;
+begin
+    xadRecogFile := xadRecogFileA(size , memory , readintags(tags));
+end;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of xadmaster.library}
+  {$Info don't forget to use InitXADMASTERLibrary in the beginning of your program}
+
+var
+    xadmaster_exit : Pointer;
+
+procedure ClosexadmasterLibrary;
+begin
+    ExitProc := xadmaster_exit;
+    if xadMasterBase <> nil then begin
+        CloseLibrary(pLibrary(xadMasterBase));
+        xadMasterBase := nil;
+    end;
+end;
+
+procedure InitXADMASTERLibrary;
+begin
+    xadMasterBase := nil;
+    xadMasterBase := pxadMasterBase(OpenLibrary(XADMASTERNAME,LIBVERSION));
+    if xadMasterBase <> nil then begin
+        xadmaster_exit := ExitProc;
+        ExitProc := @ClosexadmasterLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open xadmaster.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    XADMASTERIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of xadmaster.library}
+
+var
+    xadmaster_exit : Pointer;
+
+procedure ClosexadmasterLibrary;
+begin
+    ExitProc := xadmaster_exit;
+    if xadMasterBase <> nil then begin
+        CloseLibrary(pLibrary(xadMasterBase));
+        xadMasterBase := nil;
+    end;
+end;
+
+begin
+    xadMasterBase := nil;
+    xadMasterBase := pxadMasterBase(OpenLibrary(XADMASTERNAME,LIBVERSION));
+    if xadMasterBase <> nil then begin
+        xadmaster_exit := ExitProc;
+        ExitProc := @ClosexadmasterLibrary;
+        XADMASTERIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open xadmaster.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    XADMASTERIsCompiledHow := 3;
+   {$Warning No autoopening of xadmaster.library compiled}
+   {$Warning Make sure you open xadmaster.library yourself}
+{$endif dont_use_openlib}
+
+
+END. (* UNIT XADMASTER *)

+ 314 - 0
packages/extra/amunits/otherlibs/zlib/units/zlib.pas

@@ -0,0 +1,314 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  A file in Amiga system run time library.
+  Copyright (c) 2003 by Nils Sjöholm.
+  member of the Amiga RTL development team.
+
+  This is a unit for zlib.library
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+{
+  History:
+  
+  First version of this unit.
+  17 Jan 2003.
+  
+  Changed cardinal > longword.
+  Changed startcode for unit.
+  12 Feb 2003.
+  
+  [email protected]
+}
+
+
+{$I useamigasmartlink.inc}
+{$ifdef use_amiga_smartlink}
+   {$smartlink on}
+{$endif use_amiga_smartlink}
+
+UNIT ZLIB;
+
+INTERFACE
+USES Exec;
+
+VAR ZLibBase : pLibrary;
+
+const
+    ZLIBNAME : PChar = 'zlib.library';
+
+  { Version 1.0  }
+  { Compression strategy  }
+     GZ_STRATEGY_DEFAULT = 0;
+     GZ_STRATEGY_FILTERED = 1;
+     GZ_STRATEGY_HUFFMAN = 2;
+  { some often used compression levels  }
+     GZ_COMPRESS_NO = 0;
+     GZ_COMPRESS_FASTEST = 1;
+     GZ_COMPRESS_DEFAULT = 6;
+     GZ_COMPRESS_BEST = 9;
+
+
+FUNCTION GZ_Close(handle : POINTER) : LONGINT;
+FUNCTION GZ_CompressMem(srcbuf : POINTER; srclen : longword; destbuf : POINTER; destlen : longword; strategy : longword; level : longword; VAR poutlen : longword) : LONGINT;
+FUNCTION GZ_DecompressMem(srcbuf : POINTER; srclen : longword; destbuf : POINTER; destlen : longword) : LONGINT;
+FUNCTION GZ_FGetC(handle : POINTER) : pLONGINT;
+FUNCTION GZ_FGetS(handle : POINTER; buf : pCHAR; len : longword) : pCHAR;
+FUNCTION GZ_FileLength(handle : POINTER) : longword;
+FUNCTION GZ_Open(filename : pCHAR; openmode : longword; strategy : longword; level : longword) : POINTER;
+FUNCTION GZ_OpenFromFH(fh : LONGINT; openmode : longword; strategy : longword; level : longword) : POINTER;
+FUNCTION GZ_Read(handle : POINTER; buf : POINTER; len : longword) : LONGINT;
+FUNCTION GZ_Write(handle : POINTER; buf : POINTER; len : longword) : LONGINT;
+
+{You can remove this include and use a define instead}
+{$I useautoopenlib.inc}
+{$ifdef use_init_openlib}
+procedure InitZLIBLibrary;
+{$endif use_init_openlib}
+
+{This is a variable that knows how the unit is compiled}
+var
+    ZLIBIsCompiledHow : longint;
+
+IMPLEMENTATION
+
+{$ifndef dont_use_openlib}
+uses msgbox;
+{$endif dont_use_openlib}
+
+FUNCTION GZ_Close(handle : POINTER) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	handle,A0
+	MOVEA.L	ZLibBase,A6
+	JSR	-042(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_CompressMem(srcbuf : POINTER; srclen : longword; destbuf : POINTER; destlen : longword; strategy : longword; level : longword; VAR poutlen : longword) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	srcbuf,A0
+	MOVE.L	srclen,D0
+	MOVEA.L	destbuf,A1
+	MOVE.L	destlen,D1
+	MOVE.L	strategy,D2
+	MOVE.L	level,D3
+	MOVEA.L	poutlen,A2
+	MOVEA.L	ZLibBase,A6
+	JSR	-114(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_DecompressMem(srcbuf : POINTER; srclen : longword; destbuf : POINTER; destlen : longword) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	srcbuf,A0
+	MOVE.L	srclen,D0
+	MOVEA.L	destbuf,A1
+	MOVE.L	destlen,D1
+	MOVEA.L	ZLibBase,A6
+	JSR	-120(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_FGetC(handle : POINTER) : pLONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	handle,A0
+	MOVEA.L	ZLibBase,A6
+	JSR	-060(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_FGetS(handle : POINTER; buf : pCHAR; len : longword) : pCHAR;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	handle,A0
+	MOVEA.L	buf,A1
+	MOVE.L	len,D0
+	MOVEA.L	ZLibBase,A6
+	JSR	-054(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_FileLength(handle : POINTER) : longword;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	handle,A0
+	MOVEA.L	ZLibBase,A6
+	JSR	-138(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_Open(filename : pCHAR; openmode : longword; strategy : longword; level : longword) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	filename,A0
+	MOVE.L	openmode,D0
+	MOVE.L	strategy,D1
+	MOVE.L	level,D2
+	MOVEA.L	ZLibBase,A6
+	JSR	-030(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_OpenFromFH(fh : LONGINT; openmode : longword; strategy : longword; level : longword) : POINTER;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	fh,A0
+	MOVE.L	openmode,D0
+	MOVE.L	strategy,D1
+	MOVE.L	level,D2
+	MOVEA.L	ZLibBase,A6
+	JSR	-036(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_Read(handle : POINTER; buf : POINTER; len : longword) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	handle,A0
+	MOVEA.L	buf,A1
+	MOVE.L	len,D0
+	MOVEA.L	ZLibBase,A6
+	JSR	-048(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+FUNCTION GZ_Write(handle : POINTER; buf : POINTER; len : longword) : LONGINT;
+BEGIN
+  ASM
+	MOVE.L	A6,-(A7)
+	MOVEA.L	handle,A0
+	MOVEA.L	buf,A1
+	MOVE.L	len,D0
+	MOVEA.L	ZLibBase,A6
+	JSR	-066(A6)
+	MOVEA.L	(A7)+,A6
+	MOVE.L	D0,@RESULT
+  END;
+END;
+
+const
+    { Change VERSION and LIBVERSION to proper values }
+
+    VERSION : string[2] = '0';
+    LIBVERSION : longword = 0;
+
+{$ifdef use_init_openlib}
+  {$Info Compiling initopening of zlib.library}
+  {$Info don't forget to use InitZLIBLibrary in the beginning of your program}
+
+var
+    zlib_exit : Pointer;
+
+procedure ClosezlibLibrary;
+begin
+    ExitProc := zlib_exit;
+    if ZLibBase <> nil then begin
+        CloseLibrary(ZLibBase);
+        ZLibBase := nil;
+    end;
+end;
+
+procedure InitZLIBLibrary;
+begin
+    ZLibBase := nil;
+    ZLibBase := OpenLibrary(ZLIBNAME,LIBVERSION);
+    if ZLibBase <> nil then begin
+        zlib_exit := ExitProc;
+        ExitProc := @ClosezlibLibrary;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open zlib.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+end;
+
+begin
+    ZLIBIsCompiledHow := 2;
+{$endif use_init_openlib}
+
+{$ifdef use_auto_openlib}
+  {$Info Compiling autoopening of zlib.library}
+
+var
+    zlib_exit : Pointer;
+
+procedure ClosezlibLibrary;
+begin
+    ExitProc := zlib_exit;
+    if ZLibBase <> nil then begin
+        CloseLibrary(ZLibBase);
+        ZLibBase := nil;
+    end;
+end;
+
+begin
+    ZLibBase := nil;
+    ZLibBase := OpenLibrary(ZLIBNAME,LIBVERSION);
+    if ZLibBase <> nil then begin
+        zlib_exit := ExitProc;
+        ExitProc := @ClosezlibLibrary;
+        ZLIBIsCompiledHow := 1;
+    end else begin
+        MessageBox('FPC Pascal Error',
+        'Can''t open zlib.library version ' + VERSION + #10 +
+        'Deallocating resources and closing down',
+        'Oops');
+        halt(20);
+    end;
+
+{$endif use_auto_openlib}
+
+{$ifdef dont_use_openlib}
+begin
+    ZLIBIsCompiledHow := 3;
+   {$Warning No autoopening of zlib.library compiled}
+   {$Warning Make sure you open zlib.library yourself}
+{$endif dont_use_openlib}
+
+END. (* UNIT ZLIB *)
+
+{
+  $Log
+}
+
+

+ 99 - 0
packages/extra/amunits/utilunits/deadkeys.pas

@@ -0,0 +1,99 @@
+
+{
+    This file is part of the Free Pascal run time library.
+
+    A file in Amiga system run time library.
+    Copyright (c) 1998-2002 by Nils Sjoholm
+    member of the Amiga RTL development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{
+	DeadKeyConvert
+
+	When you want Intuition to send you keystrokes, you either get just
+    the simple key-cap type keys (i.e. no cursor or function keys) or you
+    get keycodes, which tell you nothing about what was on the key the
+    user pressed.  DeadKeyConvert allows you to receive RAWKEY messages,
+    then translate them into their ANSI key sequences.  These are known as
+    cooked keys, and a single keystroke might be converted into as many as
+    four characters (including the CSI).  See the ROM Kernel Manual and the
+    Enhancer manual for details.
+	The difference between this and RawKeyConvert is that this also
+    handles the deadkeys - for example, pressing ALT-K, releasing it, and
+    pressing o gives you an o with an umlaut.
+	Also note that some keys will come back with a length of zero - the
+    shift and alt keys, for example.  You can probably ignore them.
+	Finally, I'll point out that, since this function calls RawKeyConvert,
+    you need to call OpenConsoleDevice (defined in ConsoleUtils) before using
+    it.
+}
+
+{
+    History:
+    A translation of DeadKeyConvert.p from PCQ Pascal.
+    26 Aug 2000.
+    [email protected]
+}
+
+unit deadkeys;
+
+interface
+
+uses exec,intuition,console,inputevent;
+
+function DeadKeyConvert(msg : pIntuiMessage; buffer : pchar;
+                        bufsize : longint; keymap : pointer): longint;
+
+implementation
+
+
+function DeadKeyConvert(msg : pIntuiMessage; buffer : pchar;
+                        bufsize : longint; keymap : pointer): longint;
+
+var
+    theevent  : tInputEvent;
+    Temp      : ^pointer;
+begin
+    if msg^.IClass <> IDCMP_RAWKEY then
+         DeadKeyConvert := -2;
+    with theevent do begin
+         ie_NextEvent := nil;
+         ie_Class := IECLASS_RAWKEY;
+         ie_SubClass := 0;
+         ie_Code := msg^.Code;
+         ie_Qualifier := msg^.Qualifier;
+         Temp := msg^.IAddress;
+         ie_position.ie_addr := Temp^;
+    end;
+    DeadKeyConvert := RawKeyConvert(Addr(theevent),buffer,bufsize,keymap);
+end;
+
+var
+    my_exit : pointer;
+    ConsoleRequest : tIOStdReq;
+
+procedure CloseConsoleDevice;
+begin
+   CloseDevice(Addr(ConsoleRequest));
+end;
+
+begin   
+   ConsoleDevice := nil;
+   OpenDevice(pchar('console.device'#0),-1,Addr(ConsoleRequest),0);
+   ConsoleDevice := ConsoleRequest.io_Device;
+   my_exit := ExitProc;
+   ExitProc := @CloseConsoleDevice;
+end.
+
+{
+  $Log
+}
+
+