1 {
2   This file is part of the Free Pascal run time library.
3 
4   A file in Amiga system run time library.
5   Copyright (c) 1998-2002 by Nils Sj�holm.
6   member of the Amiga RTL development team.
7 
8   This is a unit for xadmaster.library
9 
10   See the file COPYING.FPC, included in this distribution,
11   for details about the copyright.
12 
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 **********************************************************************}
18 {
19   First version of this unit.
20   12 Feb 2003.
21 
22   nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
23 }
24 
25 
26 UNIT XADMASTER;
27 
28 INTERFACE
29 USES Exec,utility,amigados;
30 
31 const
32     XADMASTERNAME : PChar = 'xadmaster.library';
33 
34 
35   {
36         $VER: xadmaster.h 12.0 (24.06.2002)
37         xadmaster.library defines and structures
38 
39         Copyright � 1998-2002 by Dirk St�cker
40         All Rights Reserved.
41    }
42 
43 
44   const
45      XADNAME = 'xadmaster.library';
46   { NOTE: Nearly all structures need to be allocated using the
47      xadAllocObject function.  }
48   {
49 
50        library base structure
51 
52                                                                           }
53 
54 
55 
56   type
57      PxadMasterBase = ^txadMasterBase;
58      txadMasterBase = record
59           xmb_LibNode : tLibrary;
60           xmb_SysBase : PExecBase;
61           xmb_DOSBase : PDosLibrary;
62           xmb_UtilityBase : PUtilityBase;
63           xmb_RecogSize : ULONG;      { read only  }
64           xmb_DefaultName : STRPTR;   { name for XADFIF_NOFILENAME (V6)  }
65        end;
66 
67   {
68 
69        tag-function call flags
70 
71                                                                           }
72   { input tags for xadGetInfo, only one can be specified per call  }
73   const
74    { input data size  }
75      XAD_INSIZE = TAG_USER + 1;
76      XAD_INFILENAME = TAG_USER + 2;
77      XAD_INFILEHANDLE = TAG_USER + 3;
78      XAD_INMEMORY = TAG_USER + 4;
79      XAD_INHOOK = TAG_USER + 5;
80   { (V2)  }
81      XAD_INSPLITTED = TAG_USER + 6;
82   { (V4)  }
83      XAD_INDISKARCHIVE = TAG_USER + 7;
84   { (V8)  }
85      XAD_INXADSTREAM = TAG_USER + 8;
86   { (V11)  }
87      XAD_INDEVICE = TAG_USER + 9;
88   { output tags, only one can be specified per call, xadXXXXUnArc  }
89   { output data size  }
90      XAD_OUTSIZE = TAG_USER + 10;
91      XAD_OUTFILENAME = TAG_USER + 11;
92      XAD_OUTFILEHANDLE = TAG_USER + 12;
93      XAD_OUTMEMORY = TAG_USER + 13;
94      XAD_OUTHOOK = TAG_USER + 14;
95      XAD_OUTDEVICE = TAG_USER + 15;
96   { (V8)  }
97      XAD_OUTXADSTREAM = TAG_USER + 16;
98   { object allocation tags for xadAllocObjectA  }
99   { XADOBJ_FILEINFO, size of needed name space  }
100      XAD_OBJNAMESIZE = TAG_USER + 20;
101   { XADOBJ_FILEINFO, size of needed comment space  }
102      XAD_OBJCOMMENTSIZE = TAG_USER + 21;
103   { XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size  }
104      XAD_OBJPRIVINFOSIZE = TAG_USER + 22;
105   { XADOBJ_DISKINFO, number of needed entries  }
106      XAD_OBJBLOCKENTRIES = TAG_USER + 23;
107   { tags for xadGetInfo, xadFileUnArc and xadDiskUnArc  }
108   { do not use extern clients  }
109      XAD_NOEXTERN = TAG_USER + 50;
110   { password when needed  }
111      XAD_PASSWORD = TAG_USER + 51;
112   { number of wanted entry  }
113      XAD_ENTRYNUMBER = TAG_USER + 52;
114   { the progress hook  }
115      XAD_PROGRESSHOOK = TAG_USER + 53;
116   { overwrite file ?  }
117      XAD_OVERWRITE = TAG_USER + 54;
118   { create directory tree  }
119      XAD_MAKEDIRECTORY = TAG_USER + 55;
120   { ignore drive geometry ?  }
121      XAD_IGNOREGEOMETRY = TAG_USER + 56;
122   { lowest cylinder  }
123      XAD_LOWCYLINDER = TAG_USER + 57;
124   { highest cylinder  }
125      XAD_HIGHCYLINDER = TAG_USER + 58;
126   { verify for disk hook  }
127      XAD_VERIFY = TAG_USER + 59;
128   { do not delete partial/corrupt files (V3.3)  }
129      XAD_NOKILLPARTIAL = TAG_USER + 60;
130   { format output device (V5)  }
131      XAD_FORMAT = TAG_USER + 61;
132   { sector labels are stored on disk (V9)  }
133      XAD_USESECTORLABELS = TAG_USER + 62;
134   { ignore the client, if certain flags are set (V11)  }
135      XAD_IGNOREFLAGS = TAG_USER + 63;
136   { ignore the client, if certain flags are NOT set (V11)  }
137      XAD_ONLYFLAGS = TAG_USER + 64;
138   { input tags for xadConvertDates, only one can be passed  }
139   { unix date variable  }
140      XAD_DATEUNIX = TAG_USER + 70;
141   { amiga date variable  }
142      XAD_DATEAMIGA = TAG_USER + 71;
143   { struct DateStamp  }
144      XAD_DATEDATESTAMP = TAG_USER + 72;
145   { struct xadDate  }
146      XAD_DATEXADDATE = TAG_USER + 73;
147   { struct ClockData  }
148      XAD_DATECLOCKDATA = TAG_USER + 74;
149   { input is system time  }
150      XAD_DATECURRENTTIME = TAG_USER + 75;
151   { MS-DOS packed format (V2)  }
152      XAD_DATEMSDOS = TAG_USER + 76;
153   { Mac date variable (V8)  }
154      XAD_DATEMAC = TAG_USER + 77;
155   { CP/M data structure (V10)  }
156      XAD_DATECPM = TAG_USER + 78;
157   { CP/M data structure type 2 (V10)  }
158      XAD_DATECPM2 = TAG_USER + 79;
159   { ISO9660 date structure (V11)  }
160      XAD_DATEISO9660 = TAG_USER + 300;
161   { output tags, there can be specified multiple tags for one call  }
162   { unix date variable  }
163      XAD_GETDATEUNIX = TAG_USER + 80;
164   { amiga date variable  }
165      XAD_GETDATEAMIGA = TAG_USER + 81;
166   { struct DateStamp  }
167      XAD_GETDATEDATESTAMP = TAG_USER + 82;
168   { struct xadDate  }
169      XAD_GETDATEXADDATE = TAG_USER + 83;
170   { struct ClockData  }
171      XAD_GETDATECLOCKDATA = TAG_USER + 84;
172   { MS-DOS packed format (V2)  }
173      XAD_GETDATEMSDOS = TAG_USER + 86;
174   { Mac date variable (V8)  }
175      XAD_GETDATEMAC = TAG_USER + 87;
176   { CP/M data structure (V10)  }
177      XAD_GETDATECPM = TAG_USER + 88;
178   { CP/M data structure type 2 (V10)  }
179      XAD_GETDATECPM2 = TAG_USER + 89;
180   { ISO9660 date structure (V11)  }
181      XAD_GETDATEISO9660 = TAG_USER + 320;
182   { following tags need locale.library to be installed  }
183   { make local to GMT time  }
184      XAD_MAKEGMTDATE = TAG_USER + 90;
185   { make GMT to local time  }
186      XAD_MAKELOCALDATE = TAG_USER + 91;
187   { tags for xadHookTagAccess (V3)  }
188   { the hook uses xadSkipInfo (V3)  }
189      XAD_USESKIPINFO = TAG_USER + 104;
190   { pass sector labels with XADAC_WRITE (V9)  }
191      XAD_SECTORLABELS = TAG_USER + 105;
192   { pointer to UWORD value (V3)  }
193      XAD_GETCRC16 = TAG_USER + 120;
194   { pointer to ULONG value (V3)  }
195      XAD_GETCRC32 = TAG_USER + 121;
196   { ID for crc calculation (V3)  }
197      XAD_CRC16ID = TAG_USER + 130;
198   { ID for crc calculation (V3)  }
199      XAD_CRC32ID = TAG_USER + 131;
200   { tags for xadConvertProtection (V4)  }
201   { Amiga type protection bits (V4)  }
202      XAD_PROTAMIGA = TAG_USER + 160;
203   { protection bits in UNIX mode (V4)  }
204      XAD_PROTUNIX = TAG_USER + 161;
205   { MSDOS type protection bits (V4)  }
206      XAD_PROTMSDOS = TAG_USER + 162;
207   { input is a xadFileInfo structure (V11)  }
208      XAD_PROTFILEINFO = TAG_USER + 163;
209   { return Amiga protection bits (V4)  }
210      XAD_GETPROTAMIGA = TAG_USER + 170;
211   { return UNIX protection bits (V11)  }
212      XAD_GETPROTUNIX = TAG_USER + 171;
213   { return MSDOS protection bits (V11)  }
214      XAD_GETPROTMSDOS = TAG_USER + 172;
215   { fill xadFileInfo protection fields (V11)  }
216      XAD_GETPROTFILEINFO = TAG_USER + 173;
217   { tags for xadGetDiskInfo (V7)  }
218   { the client to start with (V7)  }
219      XAD_STARTCLIENT = TAG_USER + 180;
220   { do not create XADERR_EMPTY (V8)  }
221      XAD_NOEMPTYERROR = TAG_USER + 181;
222   { tags for xadFreeHookAccess (V8)  }
223   { error occurred, call abort method (V8)  }
224      XAD_WASERROR = TAG_USER + 190;
225   { tags for miscellaneous stuff  }
226   { xadArchiveInfo for stream hooks (V8)  }
227      XAD_ARCHIVEINFO = TAG_USER + 200;
228   { error code of function (V12)  }
229      XAD_ERRORCODE = TAG_USER + 201;
230   { tags for xadAddFileEntry and xadAddDiskEntry (V10)  }
231   { set xai_InPos after call (V10)  }
232      XAD_SETINPOS = TAG_USER + 240;
233   { insert dirs at list start (V10)  }
234      XAD_INSERTDIRSFIRST = TAG_USER + 241;
235   { tags for xadConvertName (V12)  }
236   (* UWORD  , default is {'/','\\',0} in source charset (V12)  *)
237      XAD_PATHSEPERATOR = TAG_USER + 260;
238   { the characterset of string (V12)  }
239      XAD_CHARACTERSET = TAG_USER + 261;
240   { maximum size of following (V12)  }
241      XAD_STRINGSIZE = TAG_USER + 262;
242   { zero-terminated string (V12)  }
243      XAD_CSTRING = TAG_USER + 263;
244   { lengthed Pascal string (V12)  }
245      XAD_PSTRING = TAG_USER + 264;
246   { an xad string (V12)  }
247      XAD_XADSTRING = TAG_USER + 265;
248   { default is TRUE (V12)  }
249      XAD_ADDPATHSEPERATOR = TAG_USER + 266;
250   { tags for xadGetFilename (V12)  }
251   { default is FALSE (V12)  }
252      XAD_NOLEADINGPATH = TAG_USER + 280;
253   { default is FALSE (V12)  }
254      XAD_NOTRAILINGPATH = TAG_USER + 281;
255   { default are #?()[]~% :|",1-31,127-160 (V12)  }
256      XAD_MASKCHARACTERS = TAG_USER + 282;
257   { default is '_' (V12)  }
258      XAD_MASKINGCHAR = TAG_USER + 283;
259   { pointer which should hold buf size (V12)  }
260      XAD_REQUIREDBUFFERSIZE = TAG_USER + 284;
261   { Places 300-339 used for dates!  }
262   {
263 
264        objects for xadAllocObjectA
265 
266                                                                           }
267   { struct xadArchiveInfo  }
268      XADOBJ_ARCHIVEINFO = $0001;
269   { struct xadFileInfo  }
270      XADOBJ_FILEINFO = $0002;
271   { struct xadDiskInfo  }
272      XADOBJ_DISKINFO = $0003;
273   { struct HookParam  }
274      XADOBJ_HOOKPARAM = $0004;
275   { struct xadDeviceInfo  }
276      XADOBJ_DEVICEINFO = $0005;
277   { struct xadProgressInfo  }
278      XADOBJ_PROGRESSINFO = $0006;
279   { struct xadTextInfo  }
280      XADOBJ_TEXTINFO = $0007;
281   { struct xadSplitFile (V2)  }
282      XADOBJ_SPLITFILE = $0008;
283   { struct xadSkipInfo (V3)  }
284      XADOBJ_SKIPINFO = $0009;
285   { struct xadImageInfo (V4)  }
286      XADOBJ_IMAGEINFO = $000A;
287   { struct xadSpecial (V11)  }
288      XADOBJ_SPECIAL = $000B;
289   { result type of xadAllocVec  }
290   { memory of requested size and type  }
291      XADOBJ_MEMBLOCK = $0100;
292   { private type  }
293   { an typed XAD string (V12)  }
294      XADOBJ_STRING = $0101;
295   {
296 
297        modes for xadCalcCRC126 and xadCalcCRC32
298 
299                                                                           }
300      XADCRC16_ID1 = $A001;
301      XADCRC32_ID1 = $EDB88320;
302   {
303 
304        hook related stuff
305 
306                                                                           }
307   { read data into buffer  }
308      XADHC_READ = 1;
309   { write buffer data to file/memory  }
310      XADHC_WRITE = 2;
311   { seek in file  }
312      XADHC_SEEK = 3;
313   { initialize the hook  }
314      XADHC_INIT = 4;
315   { end up hook work, free stuff  }
316      XADHC_FREE = 5;
317   { an error occurred, delete partial stuff  }
318      XADHC_ABORT = 6;
319   { complete input size is needed  }
320      XADHC_FULLSIZE = 7;
321   { return disk image info (V4)  }
322      XADHC_IMAGEINFO = 8;
323 
324   type
325      PxadHookParam = ^txadHookParam;
326      txadHookParam = record
327           xhp_Command : ULONG;
328           xhp_CommandData : LONG;
329           xhp_BufferPtr : APTR;
330           xhp_BufferSize : ULONG;
331           xhp_DataPos : ULONG;     { current seek position  }
332           xhp_PrivatePtr : APTR;
333           xhp_TagList : APTR;      { allows to transport tags to hook (V9)  }
334        end;
335 
336   { xadHookAccess commands  }
337   { get data  }
338 
339   const
340      XADAC_READ = 10;
341   { write data  }
342      XADAC_WRITE = 11;
343   { copy input to output  }
344      XADAC_COPY = 12;
345   { seek in input file  }
346      XADAC_INPUTSEEK = 13;
347   { seek in output file  }
348      XADAC_OUTPUTSEEK = 14;
349   {
350 
351        support structures
352 
353                                                                           }
354   { Own date structure to cover all possible dates in a human friendly
355      format. xadConvertDates may be used to convert between different date
356      structures and variables.  }
357 
358   type
359      PxadDate = ^txadDate;
360      txadDate = record
361           xd_Micros : ULONG;  { values 0 to 999999         }
362           xd_Year : LONG;     { values 1 to 2147483648  }
363           xd_Month : UBYTE;   { values 1 to 12     }
364           xd_WeekDay : UBYTE; { values 1 to 7      }
365           xd_Day : UBYTE;     { values 1 to 31     }
366           xd_Hour : UBYTE;    { values 0 to 23     }
367           xd_Minute : UBYTE;  { values 0 to 59     }
368           xd_Second : UBYTE;  { values 0 to 59     }
369        end;
370 
371   { monday is the first day and  }
372 
373   const
374      XADDAY_MONDAY = 1;
375      XADDAY_TUESDAY = 2;
376      XADDAY_WEDNESDAY = 3;
377      XADDAY_THURSDAY = 4;
378      XADDAY_FRIDAY = 5;
379      XADDAY_SATURDAY = 6;
380   { sunday the last day of a week  }
381      XADDAY_SUNDAY = 7;
382 
383   type
384      PxadDeviceInfo = ^txadDeviceInfo;
385      txadDeviceInfo = record         { for XAD_OUTDEVICE tag  }
386           xdi_DeviceName : STRPTR;   { name of device  }
387           xdi_Unit : ULONG;          { unit of device  }
388           xdi_DOSName : STRPTR;      { instead of Device+Unit, dos name without ':'  }
389        end;
390 
391      PxadSplitFile = ^txadSplitFile;
392      txadSplitFile = record           { for XAD_INSPLITTED  }
393           xsf_Next : PxadSplitFile;
394           xsf_Type : ULONG;           { XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK  }
395           xsf_Size : ULONG;           { necessary for XAD_INMEMORY, useful for others  }
396           xsf_Data : ULONG;           { FileName, Filehandle, Hookpointer or Memory  }
397        end;
398 
399      PxadSkipInfo = ^txadSkipInfo;
400      txadSkipInfo = record
401           xsi_Next : PxadSkipInfo;
402           xsi_Position : ULONG;     { position, where it should be skipped  }
403           xsi_SkipSize : ULONG;     { size to skip  }
404        end;
405 
406      PxadImageInfo = ^txadImageInfo;
407      txadImageInfo = record          { for XADHC_IMAGEINFO  }
408           xii_SectorSize : ULONG;    { usually 512  }
409           xii_FirstSector : ULONG;   { of the image file  }
410           xii_NumSectors : ULONG;    { of the image file  }
411           xii_TotalSectors : ULONG;  { of this device type  }
412        end;
413 
414    type
415      PxadClient = ^txadClient;
416      txadClient = record
417           xc_Next : PxadClient;
418           xc_Version : UWORD;         { set to XADCLIENT_VERSION  }
419           xc_MasterVersion : UWORD;
420           xc_ClientVersion : UWORD;
421           xc_ClientRevision : UWORD;
422           xc_RecogSize : ULONG;       { needed size to recog the type  }
423           xc_Flags : ULONG;           { see XADCF_xxx defines  }
424           xc_Identifier : ULONG;      { ID of internal clients  }
425           xc_ArchiverName : STRPTR;
426           xc_RecogData : function :BOOL;
427           xc_GetInfo : function :LONG;
428           xc_UnArchive : function :LONG;
429           xc_Free : procedure ;
430        end;
431 
432   { function interface
433   ASM(BOOL) xc_RecogData(REG(d0, ULONG size), REG(a0, STRPTR data),
434                 REG(a6, struct xadMasterBase  xadMasterBase));
435   ASM(LONG) xc_GetInfo(REG(a0, struct xadArchiveInfo  ai),
436                 REG(a6, struct xadMasterBase  xadMasterBase));
437   ASM(LONG) xc_UnArchive(REG(a0, struct xadArchiveInfo  ai),
438                 REG(a6, struct xadMasterBase  xadMasterBase));
439   ASM(void) xc_Free(REG(a0, struct xadArchiveInfo  ai),
440                 REG(a6, struct xadMasterBase  xadMasterBase));
441    }
442   { xc_RecogData returns 1 when recognized and 0 when not, all the others
443      return 0 when ok and XADERR values on error. xc_Free has no return
444      value.
445 
446      Filesystem clients need to clear xc_RecogSize and xc_RecogData. The
447      recognition is automatically done by GetInfo. XADERR_FILESYSTEM is
448      returned in case of unknown format. If it is known detection should
449      go on and any other code may be returned, if it fails.
450      The field xc_ArchiverName means xc_FileSystemName for filesystem
451      clients.
452    }
453 
454   type
455      PxadSpecialUnixDevice = ^txadSpecialUnixDevice;
456      txadSpecialUnixDevice = record
457           xfis_MajorVersion : ULONG;    { major device version  }
458           xfis_MinorVersion : ULONG;    { minor device version  }
459        end;
460 
461      PxadSpecialAmigaAddress = ^txadSpecialAmigaAddress;
462      txadSpecialAmigaAddress = record
463           xfis_JumpAddress : ULONG;      { code executaion start address  }
464           xfis_DecrunchAddress : ULONG;  { decrunch start of code  }
465        end;
466 
467      PxadSpecialCBM8bit = ^txadSpecialCBM8bit;
468      txadSpecialCBM8bit = record
469           xfis_FileType : UBYTE;       { File type XADCBM8BITTYPE_xxx  }
470           xfis_RecordLength : UBYTE;   { record length if relative file  }
471        end;
472 
473   type
474      PxadSpecial = ^txadSpecial;
475      txadSpecial = record
476           xfis_Type : ULONG;           { XADSPECIALTYPE to define type of block (V11)  }
477           xfis_Next : PxadSpecial;     { pointer to next entry  }
478           xfis_Data : record
479               case longint of
480                  0 : ( xfis_UnixDevice : txadSpecialUnixDevice );
481                  1 : ( xfis_AmigaAddress : txadSpecialAmigaAddress );
482                  2 : ( xfis_CBM8bit : txadSpecialCBM8bit );
483               end;
484        end;
485 
486   { Multiuser fields (xfi_OwnerUID, xfi_OwnerUID, xfi_UserName, xfi_GroupName)
487      and multiuser bits (see <dos/dos.h>) are currently not supported with normal
488      Amiga filesystem. But the clients support them, if archive format holds
489      such information.
490 
491      The protection bits (all 3 fields) should always be set using the
492      xadConvertProtection procedure. Call it with as much protection information
493      as possible. It extracts the relevant data at best (and also sets the 2 flags).
494      DO NOT USE these fields directly, but always through xadConvertProtection
495      call.
496    }
497 
498   type
499      PxadFileInfo = ^txadFileInfo;
500      txadFileInfo = record
501           xfi_Next : PxadFileInfo;
502           xfi_EntryNumber : ULONG;       { number of entry  }
503           xfi_EntryInfo : STRPTR;        { additional archiver text  }
504           xfi_PrivateInfo : APTR;        { client private, see XAD_OBJPRIVINFOSIZE  }
505           xfi_Flags : ULONG;             { see XADFIF_xxx defines  }
506           xfi_FileName : STRPTR;         { see XAD_OBJNAMESIZE tag  }
507           xfi_Comment : STRPTR;          { see XAD_OBJCOMMENTSIZE tag  }
508           xfi_Protection : ULONG;        { OS 3 bits (including multiuser)  }
509           xfi_OwnerUID : ULONG;          { user ID  }
510           xfi_OwnerGID : ULONG;          { group ID  }
511           xfi_UserName : STRPTR;         { user name  }
512           xfi_GroupName : STRPTR;        { group name  }
513           xfi_Size : ULONG;              { size of this file  }
514           xfi_GroupCrSize : ULONG;       { crunched size of group  }
515           xfi_CrunchSize : ULONG;        { crunched size  }
516           xfi_LinkName : STRPTR;         { name and path of link  }
517           xfi_Date : txadDate;
518           xfi_Generation : UWORD;        { File Generation [0...0xFFFF] (V3)  }
519           xfi_DataPos : ULONG;           { crunched data position (V3)  }
520           xfi_MacFork : PxadFileInfo;    { pointer to 2nd fork for Mac (V7)  }
521           xfi_UnixProtect : UWORD;       { protection bits for Unix (V11)  }
522           xfi_DosProtect : UBYTE;        { protection bits for MS-DOS (V11)  }
523           xfi_FileType : UBYTE;          { XADFILETYPE to define type of exe files (V11)  }
524           xfi_Special : PxadSpecial;     { pointer to special data (V11)  }
525        end;
526 
527  { NOTE: the texts passed with that structure must not always be printable.
528      Although the clients should add an additional (not counted) zero at the text
529      end, the whole file may contain other unprintable stuff (e.g. for DMS).
530      So when printing this texts do it on a byte for byte base including
531      printability checks.
532    }
533 
534  type
535      PxadTextInfo = ^txadTextInfo;
536      txadTextInfo = record
537           xti_Next : PxadTextInfo;
538           xti_Size : ULONG;      { maybe zero - no text - e.g. when crypted  }
539           xti_Text : STRPTR;     { and there is no password in xadGetInfo()  }
540           xti_Flags : ULONG;     { see XADTIF_xxx defines  }
541 
542        end;
543 
544   type
545      PxadDiskInfo = ^txadDiskInfo;
546      txadDiskInfo = record
547           xdi_Next : PxadDiskInfo;
548           xdi_EntryNumber : ULONG;    { number of entry  }
549           xdi_EntryInfo : STRPTR;     { additional archiver text  }
550           xdi_PrivateInfo : APTR;     { client private, see XAD_OBJPRIVINFOSIZE  }
551           xdi_Flags : ULONG;          { see XADDIF_xxx defines  }
552           xdi_SectorSize : ULONG;
553           xdi_TotalSectors : ULONG;   { see devices/trackdisk.h  }
554           xdi_Cylinders : ULONG;      { to find out what these  }
555           xdi_CylSectors : ULONG;     { fields mean, they are equal  }
556           xdi_Heads : ULONG;          { to struct DriveGeometry  }
557           xdi_TrackSectors : ULONG;
558           xdi_LowCyl : ULONG;         { lowest cylinder stored  }
559           xdi_HighCyl : ULONG;        { highest cylinder stored  }
560           xdi_BlockInfoSize : ULONG;  { number of BlockInfo entries  }
561           xdi_BlockInfo : Pointer;    { see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag  }
562           xdi_TextInfo : PxadTextInfo;{ linked list with info texts  }
563           xdi_DataPos : ULONG;        { crunched data position (V3)  }
564        end;
565 
566   { BlockInfo points to a UBYTE field for every track from first sector of
567      lowest cylinder to last sector of highest cylinder. When not used,
568      pointer must be 0. Do not use it, when there are no entries!
569      This is just for information. The applications still asks the client
570      to unarchive whole cylinders and not archived blocks are cleared for
571      unarchiving.
572    }
573 
574   { If the image file holds total data of disk xii_TotalSectors equals
575      xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector
576      and xii_NumSectors cannot exceed xii_TotalSectors value!
577    }
578   {
579 
580        information structures
581 
582                                                                           }
583      PxadArchiveInfo = ^txadArchiveInfo;
584      txadArchiveInfo = record
585           xai_Client : PxadClient;         { pointer to unarchiving client  }
586           xai_PrivateClient : APTR;        { private client data  }
587           xai_Password : STRPTR;           { password for crypted archives  }
588           xai_Flags : ULONG;               { read only XADAIF_ flags  }
589           xai_LowCyl : ULONG;              { lowest cylinder to unarchive  }
590           xai_HighCyl : ULONG;             { highest cylinder to unarchive  }
591           xai_InPos : ULONG;               { input position, read only  }
592           xai_InSize : ULONG;              { input size, read only  }
593           xai_OutPos : ULONG;              { output position, read only  }
594           xai_OutSize : ULONG;             { output file size, read only  }
595           xai_FileInfo : PxadFileInfo;     { data pointer for file arcs  }
596           xai_DiskInfo : PxadDiskInfo;     { data pointer for disk arcs  }
597           xai_CurFile : PxadFileInfo;      { data pointer for current file arc  }
598           xai_CurDisk : PxadDiskInfo;      { data pointer for current disk arc  }
599           xai_LastError : LONG;            { last error, when XADAIF_FILECORRUPT (V2)  }
600           xai_MultiVolume : PULONG;        { array of start offsets from parts (V2)  }
601           xai_SkipInfo : PxadSkipInfo;     { linked list of skip entries (V3)  }
602           xai_ImageInfo : PxadImageInfo;   { for filesystem clients (V5)  }
603           xai_InName : STRPTR;             { Input archive name if available (V7)  }
604        end;
605 
606 
607 
608   { This structure is nearly complete private to either xadmaster or its
609   clients. An application program may access for reading only xai_Client,
610   xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
611   and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
612   not be accessed!  }
613   { archive entries are encrypted  }
614 
615   const
616      XADAIB_CRYPTED = 0;
617   { file is corrupt, but valid entries are in the list  }
618      XADAIB_FILECORRUPT = 1;
619   { unarchive file entry  }
620      XADAIB_FILEARCHIVE = 2;
621   { unarchive disk entry  }
622      XADAIB_DISKARCHIVE = 3;
623   { overwrite the file (PRIVATE)  }
624      XADAIB_OVERWRITE = 4;
625   { create directory when missing (PRIVATE)  }
626      XADAIB_MAKEDIRECTORY = 5;
627   { ignore drive geometry (PRIVATE)  }
628      XADAIB_IGNOREGEOMETRY = 6;
629   { verify is turned on for disk hook (PRIVATE)  }
630      XADAIB_VERIFY = 7;
631   { do not delete partial files (PRIVATE)  }
632      XADAIB_NOKILLPARTIAL = 8;
633   { is disk image extraction (V5)  }
634      XADAIB_DISKIMAGE = 9;
635   { format in disk hook (PRIVATE)  }
636      XADAIB_FORMAT = 10;
637   { do not create empty error (PRIVATE)  }
638      XADAIB_NOEMPTYERROR = 11;
639   { in stuff only (PRIVATE)  }
640      XADAIB_ONLYIN = 12;
641   { out stuff only (PRIVATE)  }
642      XADAIB_ONLYOUT = 13;
643   { use SectorLabels (PRIVATE)  }
644      XADAIB_USESECTORLABELS = 14;
645      XADAIF_CRYPTED = 1 shl XADAIB_CRYPTED;
646      XADAIF_FILECORRUPT = 1 shl XADAIB_FILECORRUPT;
647      XADAIF_FILEARCHIVE = 1 shl XADAIB_FILEARCHIVE;
648      XADAIF_DISKARCHIVE = 1 shl XADAIB_DISKARCHIVE;
649      XADAIF_OVERWRITE = 1 shl XADAIB_OVERWRITE;
650      XADAIF_MAKEDIRECTORY = 1 shl XADAIB_MAKEDIRECTORY;
651      XADAIF_IGNOREGEOMETRY = 1 shl XADAIB_IGNOREGEOMETRY;
652      XADAIF_VERIFY = 1 shl XADAIB_VERIFY;
653      XADAIF_NOKILLPARTIAL = 1 shl XADAIB_NOKILLPARTIAL;
654      XADAIF_DISKIMAGE = 1 shl XADAIB_DISKIMAGE;
655      XADAIF_FORMAT = 1 shl XADAIB_FORMAT;
656      XADAIF_NOEMPTYERROR = 1 shl XADAIB_NOEMPTYERROR;
657      XADAIF_ONLYIN = 1 shl XADAIB_ONLYIN;
658      XADAIF_ONLYOUT = 1 shl XADAIB_ONLYOUT;
659      XADAIF_USESECTORLABELS = 1 shl XADAIB_USESECTORLABELS;
660 
661   { These are used for xfi_FileType to define file type. (V11)  }
662   { infile was only one data file  }
663 
664   const
665      XADFILETYPE_DATACRUNCHER = 1;
666   { infile was text-linked  }
667      XADFILETYPE_TEXTLINKER = 2;
668   { infile was an Amiga exe cruncher  }
669      XADFILETYPE_AMIGAEXECRUNCHER = 11;
670   { infile was an Amiga exe linker  }
671      XADFILETYPE_AMIGAEXELINKER = 12;
672   { infile was an Amiga text-exe linker  }
673      XADFILETYPE_AMIGATEXTLINKER = 13;
674   { infile was an Amiga address cruncher  }
675      XADFILETYPE_AMIGAADDRESS = 14;
676   { this file is a block device  }
677      XADFILETYPE_UNIXBLOCKDEVICE = 21;
678   { this file is a character device  }
679      XADFILETYPE_UNIXCHARDEVICE = 22;
680   { this file is a named pipe  }
681      XADFILETYPE_UNIXFIFO = 23;
682   { this file is a socket  }
683      XADFILETYPE_UNIXSOCKET = 24;
684   { infile was an MSDOS exe cruncher  }
685      XADFILETYPE_MSDOSEXECRUNCHER = 31;
686   { xadSpecial entry is xadSpecialUnixDevice  }
687      XADSPECIALTYPE_UNIXDEVICE = 1;
688   { xadSpecial entry is xadSpecialAmigaAddress  }
689      XADSPECIALTYPE_AMIGAADDRESS = 2;
690   { xadSpecial entry is xadSpecialCBM8bit  }
691      XADSPECIALTYPE_CBM8BIT = 3;
692 
693 
694 
695   {       Unknown / Unused  }
696 
697   const
698      XADCBM8BITTYPE_UNKNOWN = $00;
699   { Tape - BASIC program file  }
700      XADCBM8BITTYPE_BASIC = $01;
701   { Tape - Data block (SEQ file)  }
702      XADCBM8BITTYPE_DATA = $02;
703   { Tape - Fixed addres program file  }
704      XADCBM8BITTYPE_FIXED = $03;
705   { Tape - Sequential data file  }
706      XADCBM8BITTYPE_SEQDATA = $04;
707   { Disk - Sequential file "SEQ"  }
708      XADCBM8BITTYPE_SEQ = $81;
709   { Disk - Program file "PRG"  }
710      XADCBM8BITTYPE_PRG = $82;
711   { Disk - User-defined file "USR"  }
712      XADCBM8BITTYPE_USR = $83;
713   { Disk - Relative records file "REL"  }
714      XADCBM8BITTYPE_REL = $84;
715   { Disk - CBM (partition) "CBM"  }
716      XADCBM8BITTYPE_CBM = $85;
717 
718 
719 
720   { entry is crypted  }
721 
722   const
723      XADFIB_CRYPTED = 0;
724   { entry is a directory  }
725      XADFIB_DIRECTORY = 1;
726   { entry is a link  }
727      XADFIB_LINK = 2;
728   { file is an information text  }
729      XADFIB_INFOTEXT = 3;
730   { file is in a crunch group  }
731      XADFIB_GROUPED = 4;
732   { crunch group ends here  }
733      XADFIB_ENDOFGROUP = 5;
734   { no date supported, CURRENT date is set  }
735      XADFIB_NODATE = 6;
736   { file is marked as deleted (V3)  }
737      XADFIB_DELETED = 7;
738   { before unarchiving the datapos is set (V3)  }
739      XADFIB_SEEKDATAPOS = 8;
740   { there was no filename, using internal one (V6)  }
741      XADFIB_NOFILENAME = 9;
742   { file size is unknown and thus set to zero (V6)  }
743      XADFIB_NOUNCRUNCHSIZE = 10;
744   { file is only partial (V6)  }
745      XADFIB_PARTIALFILE = 11;
746   { file is Apple data fork (V7)  }
747      XADFIB_MACDATA = 12;
748   { file is Apple resource fork (V7)  }
749      XADFIB_MACRESOURCE = 13;
750   { allows extract file during scanning (V10)  }
751      XADFIB_EXTRACTONBUILD = 14;
752   { UNIX protection bits are present (V11)  }
753      XADFIB_UNIXPROTECTION = 15;
754   { MSDOS protection bits are present (V11)  }
755      XADFIB_DOSPROTECTION = 16;
756   { this entry may change until GetInfo is finished (V11)  }
757      XADFIB_ENTRYMAYCHANGE = 17;
758   { the xfi_FileName fields is an XAD string (V12)  }
759      XADFIB_XADSTRFILENAME = 18;
760   { the xfi_LinkName fields is an XAD string (V12)  }
761      XADFIB_XADSTRLINKNAME = 19;
762   { the xfi_Comment fields is an XAD string (V12)  }
763      XADFIB_XADSTRCOMMENT = 20;
764      XADFIF_CRYPTED = 1 shl XADFIB_CRYPTED;
765      XADFIF_DIRECTORY = 1 shl XADFIB_DIRECTORY;
766      XADFIF_LINK = 1 shl XADFIB_LINK;
767      XADFIF_INFOTEXT = 1 shl XADFIB_INFOTEXT;
768      XADFIF_GROUPED = 1 shl XADFIB_GROUPED;
769      XADFIF_ENDOFGROUP = 1 shl XADFIB_ENDOFGROUP;
770      XADFIF_NODATE = 1 shl XADFIB_NODATE;
771      XADFIF_DELETED = 1 shl XADFIB_DELETED;
772      XADFIF_SEEKDATAPOS = 1 shl XADFIB_SEEKDATAPOS;
773      XADFIF_NOFILENAME = 1 shl XADFIB_NOFILENAME;
774      XADFIF_NOUNCRUNCHSIZE = 1 shl XADFIB_NOUNCRUNCHSIZE;
775      XADFIF_PARTIALFILE = 1 shl XADFIB_PARTIALFILE;
776      XADFIF_MACDATA = 1 shl XADFIB_MACDATA;
777      XADFIF_MACRESOURCE = 1 shl XADFIB_MACRESOURCE;
778      XADFIF_EXTRACTONBUILD = 1 shl XADFIB_EXTRACTONBUILD;
779      XADFIF_UNIXPROTECTION = 1 shl XADFIB_UNIXPROTECTION;
780      XADFIF_DOSPROTECTION = 1 shl XADFIB_DOSPROTECTION;
781      XADFIF_ENTRYMAYCHANGE = 1 shl XADFIB_ENTRYMAYCHANGE;
782      XADFIF_XADSTRFILENAME = 1 shl XADFIB_XADSTRFILENAME;
783      XADFIF_XADSTRLINKNAME = 1 shl XADFIB_XADSTRLINKNAME;
784      XADFIF_XADSTRCOMMENT = 1 shl XADFIB_XADSTRCOMMENT;
785 
786 
787 
788   { entry is empty, as data was crypted  }
789 
790   const
791      XADTIB_CRYPTED = 0;
792   { text is a banner  }
793      XADTIB_BANNER = 1;
794   { text is a file description  }
795      XADTIB_FILEDIZ = 2;
796      XADTIF_CRYPTED = 1 shl XADTIB_CRYPTED;
797      XADTIF_BANNER = 1 shl XADTIB_BANNER;
798      XADTIF_FILEDIZ = 1 shl XADTIB_FILEDIZ;
799 
800   { entry is crypted  }
801 
802   const
803      XADDIB_CRYPTED = 0;
804   { before unarchiving the datapos is set (V3)  }
805      XADDIB_SEEKDATAPOS = 1;
806   { the clients delivers sector labels (V9)  }
807      XADDIB_SECTORLABELS = 2;
808   { allows extract disk during scanning (V10)  }
809      XADDIB_EXTRACTONBUILD = 3;
810   { this entry may change until GetInfo is finished (V11)  }
811      XADDIB_ENTRYMAYCHANGE = 4;
812   { Some of the crunchers do not store all necessary information, so it
813   may be needed to guess some of them. Set the following flags in that case
814   and geometry check will ignore these fields.  }
815   { sectorsize is guessed (V10)  }
816      XADDIB_GUESSSECTORSIZE = 5;
817   { totalsectors number is guessed (V10)  }
818      XADDIB_GUESSTOTALSECTORS = 6;
819   { cylinder number is guessed  }
820      XADDIB_GUESSCYLINDERS = 7;
821   { cylsectors is guessed  }
822      XADDIB_GUESSCYLSECTORS = 8;
823   { number of heads is guessed  }
824      XADDIB_GUESSHEADS = 9;
825   { tracksectors is guessed  }
826      XADDIB_GUESSTRACKSECTORS = 10;
827   { lowcyl is guessed  }
828      XADDIB_GUESSLOWCYL = 11;
829   { highcyl is guessed  }
830      XADDIB_GUESSHIGHCYL = 12;
831   { If it is impossible to set some of the fields, you need to set some of
832   these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
833   of usage of lowcyl and highcyl keywords. When you have cylinder information,
834   you should not use these and instead use guess flags and calculate
835   possible values for the missing fields.  }
836   { cylinder number is not set  }
837      XADDIB_NOCYLINDERS = 15;
838   { cylsectors is not set  }
839      XADDIB_NOCYLSECTORS = 16;
840   { number of heads is not set  }
841      XADDIB_NOHEADS = 17;
842   { tracksectors is not set  }
843      XADDIB_NOTRACKSECTORS = 18;
844   { lowcyl is not set  }
845      XADDIB_NOLOWCYL = 19;
846   { highcyl is not set  }
847      XADDIB_NOHIGHCYL = 20;
848      XADDIF_CRYPTED = 1 shl XADDIB_CRYPTED;
849      XADDIF_SEEKDATAPOS = 1 shl XADDIB_SEEKDATAPOS;
850      XADDIF_SECTORLABELS = 1 shl XADDIB_SECTORLABELS;
851      XADDIF_EXTRACTONBUILD = 1 shl XADDIB_EXTRACTONBUILD;
852      XADDIF_ENTRYMAYCHANGE = 1 shl XADDIB_ENTRYMAYCHANGE;
853      XADDIF_GUESSSECTORSIZE = 1 shl XADDIB_GUESSSECTORSIZE;
854      XADDIF_GUESSTOTALSECTORS = 1 shl XADDIB_GUESSTOTALSECTORS;
855      XADDIF_GUESSCYLINDERS = 1 shl XADDIB_GUESSCYLINDERS;
856      XADDIF_GUESSCYLSECTORS = 1 shl XADDIB_GUESSCYLSECTORS;
857      XADDIF_GUESSHEADS = 1 shl XADDIB_GUESSHEADS;
858      XADDIF_GUESSTRACKSECTORS = 1 shl XADDIB_GUESSTRACKSECTORS;
859      XADDIF_GUESSLOWCYL = 1 shl XADDIB_GUESSLOWCYL;
860      XADDIF_GUESSHIGHCYL = 1 shl XADDIB_GUESSHIGHCYL;
861      XADDIF_NOCYLINDERS = 1 shl XADDIB_NOCYLINDERS;
862      XADDIF_NOCYLSECTORS = 1 shl XADDIB_NOCYLSECTORS;
863      XADDIF_NOHEADS = 1 shl XADDIB_NOHEADS;
864      XADDIF_NOTRACKSECTORS = 1 shl XADDIB_NOTRACKSECTORS;
865      XADDIF_NOLOWCYL = 1 shl XADDIB_NOLOWCYL;
866      XADDIF_NOHIGHCYL = 1 shl XADDIB_NOHIGHCYL;
867   { defines for BlockInfo  }
868   { this block was cleared for archiving  }
869      XADBIB_CLEARED = 0;
870   { this block was not archived  }
871      XADBIB_UNUSED = 1;
872      XADBIF_CLEARED = 1 shl XADBIB_CLEARED;
873      XADBIF_UNUSED = 1 shl XADBIB_UNUSED;
874   {
875 
876        progress report stuff
877                                                                          }
878   type
879      PxadProgressInfo = ^txadProgressInfo;
880      txadProgressInfo = record
881           xpi_Mode : ULONG;                { work modus  }
882           xpi_Client : PxadClient;         { the client doing the work  }
883           xpi_DiskInfo : PxadDiskInfo;     { current diskinfo, for disks  }
884           xpi_FileInfo : PxadFileInfo;     { current info for files  }
885           xpi_CurrentSize : ULONG;         { current filesize  }
886           xpi_LowCyl : ULONG;              { for disks only  }
887           xpi_HighCyl : ULONG;             { for disks only  }
888           xpi_Status : ULONG;              { see XADPIF flags  }
889           xpi_Error : LONG;                { any of the error codes  }
890           xpi_FileName : STRPTR;           { name of file to overwrite (V2)  }
891           xpi_NewName : STRPTR;            { new name buffer, passed by hook (V2)  }
892        end;
893 
894   { NOTE: For disks CurrentSize is Sector SectorSize, where SectorSize can
895   be found in xadDiskInfo structure. So you may output the sector value.  }
896   { different progress modes  }
897 
898   const
899      XADPMODE_ASK = 1;
900      XADPMODE_PROGRESS = 2;
901      XADPMODE_END = 3;
902      XADPMODE_ERROR = 4;
903   { (V10)  }
904      XADPMODE_NEWENTRY = 5;
905   { (V11)  }
906      XADPMODE_GETINFOEND = 6;
907   { flags for progress hook and ProgressInfo status field  }
908   { overwrite the file  }
909      XADPIB_OVERWRITE = 0;
910   { create the directory  }
911      XADPIB_MAKEDIRECTORY = 1;
912   { ignore drive geometry  }
913      XADPIB_IGNOREGEOMETRY = 2;
914   { destination is a directory (V10)  }
915      XADPIB_ISDIRECTORY = 3;
916   { rename the file (V2)  }
917      XADPIB_RENAME = 10;
918   { all ok, proceed  }
919      XADPIB_OK = 16;
920   { skip file  }
921      XADPIB_SKIP = 17;
922      XADPIF_OVERWRITE = 1 shl XADPIB_OVERWRITE;
923      XADPIF_MAKEDIRECTORY = 1 shl XADPIB_MAKEDIRECTORY;
924      XADPIF_IGNOREGEOMETRY = 1 shl XADPIB_IGNOREGEOMETRY;
925      XADPIF_ISDIRECTORY = 1 shl XADPIB_ISDIRECTORY;
926      XADPIF_RENAME = 1 shl XADPIB_RENAME;
927      XADPIF_OK = 1 shl XADPIB_OK;
928      XADPIF_SKIP = 1 shl XADPIB_SKIP;
929   {
930 
931        errors
932 
933                                                                           }
934   { no error  }
935      XADERR_OK = $0000;
936   { unknown error  }
937      XADERR_UNKNOWN = $0001;
938   { input data buffers border exceeded  }
939      XADERR_INPUT = $0002;
940   { output data buffers border exceeded  }
941      XADERR_OUTPUT = $0003;
942   { function called with illegal parameters  }
943      XADERR_BADPARAMS = $0004;
944   { not enough memory available  }
945      XADERR_NOMEMORY = $0005;
946   { data is corrupted  }
947      XADERR_ILLEGALDATA = $0006;
948   { command is not supported  }
949      XADERR_NOTSUPPORTED = $0007;
950   { required resource missing  }
951      XADERR_RESOURCE = $0008;
952   { error on decrunching  }
953      XADERR_DECRUNCH = $0009;
954   { unknown file type  }
955      XADERR_FILETYPE = $000A;
956   { opening file failed  }
957      XADERR_OPENFILE = $000B;
958   { file, disk has been skipped  }
959      XADERR_SKIP = $000C;
960   { user break in progress hook  }
961      XADERR_BREAK = $000D;
962   { file already exists  }
963      XADERR_FILEEXISTS = $000E;
964   { missing or wrong password  }
965      XADERR_PASSWORD = $000F;
966   { could not create directory  }
967      XADERR_MAKEDIR = $0010;
968   { wrong checksum  }
969      XADERR_CHECKSUM = $0011;
970   { verify failed (disk hook)  }
971      XADERR_VERIFY = $0012;
972   { wrong drive geometry  }
973      XADERR_GEOMETRY = $0013;
974   { unknown data format  }
975      XADERR_DATAFORMAT = $0014;
976   { source contains no files  }
977      XADERR_EMPTY = $0015;
978   { unknown filesystem  }
979      XADERR_FILESYSTEM = $0016;
980   { name of file exists as directory  }
981      XADERR_FILEDIR = $0017;
982   { buffer was to short  }
983      XADERR_SHORTBUFFER = $0018;
984   { text encoding was defective  }
985      XADERR_ENCODING = $0019;
986   {
987 
988        characterset and filename conversion
989 
990                                                                           }
991   { this is the ONLY destination setting for clients!  }
992      CHARSET_HOST = 0;
993   { 16bit Unicode (usually no source type)  }
994      CHARSET_UNICODE_UCS2_HOST = 10;
995   { 16bit Unicode big endian storage  }
996      CHARSET_UNICODE_UCS2_BIGENDIAN = 11;
997   { 16bit Unicode little endian storage  }
998      CHARSET_UNICODE_UCS2_LITTLEENDIAN = 12;
999   { variable size unicode encoding  }
1000      CHARSET_UNICODE_UTF8 = 13;
1001   { all the 1xx types are generic types which also maybe a bit dynamic  }
1002   { the default Amiga charset  }
1003      CHARSET_AMIGA = 100;
1004   { the default MSDOS charset  }
1005      CHARSET_MSDOS = 101;
1006   { the default MacOS charset  }
1007      CHARSET_MACOS = 102;
1008   { the default C64 charset  }
1009      CHARSET_C64 = 103;
1010   { the default Atari ST charset  }
1011      CHARSET_ATARI_ST = 104;
1012   { the default Windows charset  }
1013      CHARSET_WINDOWS = 105;
1014   { all the 2xx to 9xx types are real charsets, use them whenever you know
1015      what the data really is  }
1016   { the lower 7 bits of ASCII charsets  }
1017      CHARSET_ASCII = 200;
1018   { the base charset  }
1019      CHARSET_ISO_8859_1 = 201;
1020   { Euro-sign fixed ISO variant  }
1021      CHARSET_ISO_8859_15 = 215;
1022   { Atari ST (US) charset  }
1023      CHARSET_ATARI_ST_US = 300;
1024   { C64 lower case charset  }
1025      CHARSET_PETSCII_C64_LC = 301;
1026   { IBM Codepage 437 charset  }
1027      CHARSET_CODEPAGE_437 = 400;
1028   { Windows Codepage 1252 charset  }
1029      CHARSET_CODEPAGE_1252 = 401;
1030   {
1031 
1032        client related stuff
1033 
1034                                                                           }
1035   type
1036      PxadForeman = ^txadForeman;
1037      txadForeman = record
1038           xfm_Security : ULONG;      { should be XADFOREMAN_SECURITY  }
1039           xfm_ID : ULONG;            { must be XADFOREMAN_ID  }
1040           xfm_Version : UWORD;       { set to XADFOREMAN_VERSION  }
1041           xfm_Reserved : UWORD;
1042           xfm_VersString : STRPTR;   { pointer to $VER: string  }
1043           xfm_FirstClient : PxadClient; { pointer to first client  }
1044        end;
1045 
1046   { MOVEQ #-1,D0 and RTS  }
1047 
1048   const
1049      XADFOREMAN_SECURITY = $70FF4E75;
1050   { 'XADF' identification ID  }
1051      XADFOREMAN_ID = $58414446;
1052      XADFOREMAN_VERSION = 1;
1053 
1054 
1055 
1056   const
1057      XADCLIENT_VERSION = 1;
1058   { archiver is a file archiver  }
1059      XADCB_FILEARCHIVER = 0;
1060   { archiver is a disk archiver  }
1061      XADCB_DISKARCHIVER = 1;
1062   { external client, set by xadmaster  }
1063      XADCB_EXTERN = 2;
1064   { filesystem clients (V5)  }
1065      XADCB_FILESYSTEM = 3;
1066   { do not check size for recog call (V6)  }
1067      XADCB_NOCHECKSIZE = 4;
1068   { file archiver is plain data file (V11)  }
1069      XADCB_DATACRUNCHER = 5;
1070   { file archiver is executable file (V11)  }
1071      XADCB_EXECRUNCHER = 6;
1072   { file archiver is address crunched file (V11)  }
1073      XADCB_ADDRESSCRUNCHER = 7;
1074   { file archiver is a linker file (V11)  }
1075      XADCB_LINKER = 8;
1076   { master frees XAD strings (V12)  }
1077      XADCB_FREEXADSTRINGS = 25;
1078   { master frees xadSpecial  structures (V11)  }
1079      XADCB_FREESPECIALINFO = 26;
1080   { master frees xadSkipInfo structures (V3)  }
1081      XADCB_FREESKIPINFO = 27;
1082   { master frees xadTextInfo structures (V2)  }
1083      XADCB_FREETEXTINFO = 28;
1084   { master frees xadTextInfo text block (V2)  }
1085      XADCB_FREETEXTINFOTEXT = 29;
1086   { master frees xadFileInfo structures (V2)  }
1087      XADCB_FREEFILEINFO = 30;
1088   { master frees xadDiskInfo structures (V2)  }
1089      XADCB_FREEDISKINFO = 31;
1090      XADCF_FILEARCHIVER = 1 shl XADCB_FILEARCHIVER;
1091      XADCF_DISKARCHIVER = 1 shl XADCB_DISKARCHIVER;
1092      XADCF_EXTERN = 1 shl XADCB_EXTERN;
1093      XADCF_FILESYSTEM = 1 shl XADCB_FILESYSTEM;
1094      XADCF_NOCHECKSIZE = 1 shl XADCB_NOCHECKSIZE;
1095      XADCF_DATACRUNCHER = 1 shl XADCB_DATACRUNCHER;
1096      XADCF_EXECRUNCHER = 1 shl XADCB_EXECRUNCHER;
1097      XADCF_ADDRESSCRUNCHER = 1 shl XADCB_ADDRESSCRUNCHER;
1098      XADCF_LINKER = 1 shl XADCB_LINKER;
1099      XADCF_FREEXADSTRINGS = 1 shl XADCB_FREEXADSTRINGS;
1100      XADCF_FREESPECIALINFO = 1 shl XADCB_FREESPECIALINFO;
1101      XADCF_FREESKIPINFO = 1 shl XADCB_FREESKIPINFO;
1102      XADCF_FREETEXTINFO = 1 shl XADCB_FREETEXTINFO;
1103      XADCF_FREETEXTINFOTEXT = 1 shl XADCB_FREETEXTINFOTEXT;
1104      XADCF_FREEFILEINFO = 1 shl XADCB_FREEFILEINFO;
1105      XADCF_FREEDISKINFO = 1 shl XADCB_FREEDISKINFO;
1106   { The types 5 to 9 always need XADCB_FILEARCHIVER set also. These only specify
1107   the type of the archiver somewhat better. Do not mix real archivers and these
1108   single file data clients.  }
1109   {
1110 
1111        client ID's
1112 
1113                                                                           }
1114   { If an external client has set the xc_Identifier field, the internal
1115   client is replaced.  }
1116   { disk archivers start with 1000  }
1117      XADCID_XMASH = 1000;
1118      XADCID_SUPERDUPER3 = 1001;
1119      XADCID_XDISK = 1002;
1120      XADCID_PACKDEV = 1003;
1121      XADCID_ZOOM = 1004;
1122      XADCID_ZOOM5 = 1005;
1123      XADCID_CRUNCHDISK = 1006;
1124      XADCID_PACKDISK = 1007;
1125      XADCID_MDC = 1008;
1126      XADCID_COMPDISK = 1009;
1127      XADCID_LHWARP = 1010;
1128      XADCID_SAVAGECOMPRESSOR = 1011;
1129      XADCID_WARP = 1012;
1130      XADCID_GDC = 1013;
1131      XADCID_DCS = 1014;
1132   { file archivers start with 5000  }
1133      XADCID_TAR = 5000;
1134      XADCID_SDSSFX = 5001;
1135      XADCID_LZX = 5002;
1136      XADCID_MXMSIMPLEARC = 5003;
1137      XADCID_LHPAK = 5004;
1138      XADCID_AMIGAPLUSUNPACK = 5005;
1139      XADCID_AMIPACK = 5006;
1140      XADCID_LHA = 5007;
1141      XADCID_LHASFX = 5008;
1142      XADCID_PCOMPARC = 5009;
1143      XADCID_SOMNI = 5010;
1144      XADCID_LHSFX = 5011;
1145      XADCID_XPKARCHIVE = 5012;
1146      XADCID_SHRINK = 5013;
1147      XADCID_SPACK = 5014;
1148      XADCID_SPACKSFX = 5015;
1149      XADCID_ZIP = 5016;
1150      XADCID_WINZIPEXE = 5017;
1151      XADCID_GZIP = 5018;
1152      XADCID_ARC = 5019;
1153      XADCID_ZOO = 5020;
1154      XADCID_LHAEXE = 5021;
1155      XADCID_ARJ = 5022;
1156      XADCID_ARJEXE = 5023;
1157      XADCID_ZIPEXE = 5024;
1158      XADCID_LHF = 5025;
1159      XADCID_COMPRESS = 5026;
1160      XADCID_ACE = 5027;
1161      XADCID_ACEEXE = 5028;
1162      XADCID_GZIPSFX = 5029;
1163      XADCID_HA = 5030;
1164      XADCID_SQ = 5031;
1165      XADCID_LHAC64SFX = 5032;
1166      XADCID_SIT = 5033;
1167      XADCID_SIT5 = 5034;
1168      XADCID_SIT5EXE = 5035;
1169      XADCID_MACBINARY = 5036;
1170      XADCID_CPIO = 5037;
1171      XADCID_PACKIT = 5038;
1172   { filesystem client start with 8000  }
1173      XADCID_FSAMIGA = 8000;
1174      XADCID_FSSANITYOS = 8001;
1175      XADCID_FSFAT = 8002;
1176   { mixed archivers start with 9000  }
1177      XADCID_DMS = 9000;
1178      XADCID_DMSSFX = 9001;
1179 
1180 VAR xadMasterBase : pxadMasterBase = nil;
1181 
1182 
xadAddDiskEntryAnull1183 FUNCTION xadAddDiskEntryA(di : pxadDiskInfo location 'a0'; ai : pxadArchiveInfo location 'a1'; CONST tags : pTagItem location 'a2') : LONGINT; syscall xadMasterBase 162;
xadAddFileEntryAnull1184 FUNCTION xadAddFileEntryA(fi : pxadFileInfo location 'a0'; ai : pxadArchiveInfo location 'a1'; CONST tags : pTagItem location 'a2') : LONGINT; syscall xadMasterBase 156;
xadAllocObjectAnull1185 FUNCTION xadAllocObjectA(_type : LONGINT location 'd0'; CONST tags : pTagItem location 'a0') : POINTER; syscall xadMasterBase 30;
xadAllocVecnull1186 FUNCTION xadAllocVec(size : longword location 'd0'; flags : longword location 'd1') : POINTER; syscall xadMasterBase 108;
xadCalcCRC16null1187 FUNCTION xadCalcCRC16(id : longword location 'd0'; init : longword location 'd1'; size : longword location 'd2'; buffer : pCHAR location 'a0') : WORD; syscall xadMasterBase 96;
xadCalcCRC32null1188 FUNCTION xadCalcCRC32(id : longword location 'd0'; init : longword location 'd1'; size : longword location 'd2'; buffer : pCHAR location 'a0') : longword; syscall xadMasterBase 102;
xadConvertDatesAnull1189 FUNCTION xadConvertDatesA(CONST tags : pTagItem location 'a0') : LONGINT; syscall xadMasterBase 90;
xadConvertNameAnull1190 FUNCTION xadConvertNameA(charset : longword location 'd0'; CONST tags : pTagItem location 'a0') : pCHAR; syscall xadMasterBase 174;
xadConvertProtectionAnull1191 FUNCTION xadConvertProtectionA(CONST tags : pTagItem location 'a0') : LONGINT; syscall xadMasterBase 126;
1192 PROCEDURE xadCopyMem(src : POINTER location 'a0'; dest : POINTER location 'a1'; size : longword location 'd0'); syscall xadMasterBase 114;
xadDiskFileUnArcAnull1193 FUNCTION xadDiskFileUnArcA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 138;
xadDiskUnArcAnull1194 FUNCTION xadDiskUnArcA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 66;
xadFileUnArcAnull1195 FUNCTION xadFileUnArcA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 60;
xadFreeHookAccessAnull1196 FUNCTION xadFreeHookAccessA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 150;
1197 PROCEDURE xadFreeInfo(ai : pxadArchiveInfo location 'a0'); syscall xadMasterBase 54;
1198 PROCEDURE xadFreeObjectA(obj : POINTER location 'a0'; CONST tags : pTagItem location 'a1'); syscall xadMasterBase 36;
xadGetClientInfonull1199 FUNCTION xadGetClientInfo : pxadClient; syscall xadMasterBase 78;
xadGetDiskInfoAnull1200 FUNCTION xadGetDiskInfoA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 132;
xadGetErrorTextnull1201 FUNCTION xadGetErrorText(errnum : longword location 'd0') : pCHAR; syscall xadMasterBase 72;
xadGetFilenameAnull1202 FUNCTION xadGetFilenameA(buffersize : longword location 'd0'; buffer : pCHAR location 'a0'; path : pCHAR location 'a1'; name : pCHAR location 'a2'; CONST tags : pTagItem location 'a3') : LONGINT; syscall xadMasterBase 168;
xadGetHookAccessAnull1203 FUNCTION xadGetHookAccessA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 144;
xadGetInfoAnull1204 FUNCTION xadGetInfoA(ai : pxadArchiveInfo location 'a0'; CONST tags : pTagItem location 'a1') : LONGINT; syscall xadMasterBase 48;
xadHookAccessnull1205 FUNCTION xadHookAccess(command : longword location 'd0'; data : LONGINT location 'd1'; buffer : POINTER location 'a0'; ai : pxadArchiveInfo location 'a1') : LONGINT; syscall xadMasterBase 84;
xadHookTagAccessAnull1206 FUNCTION xadHookTagAccessA(command : longword location 'd0'; data : LONGINT location 'd1'; buffer : POINTER location 'a0'; ai : pxadArchiveInfo location 'a1'; CONST tags : pTagItem location 'a2') : LONGINT; syscall xadMasterBase 120;
xadRecogFileAnull1207 FUNCTION xadRecogFileA(size : longword location 'd0'; memory : POINTER location 'a0'; CONST tags : pTagItem location 'a1') : pxadClient; syscall xadMasterBase 42;
1208 {
1209  Functions and procedures with array of PtrUInt go here
1210 }
xadAddDiskEntrynull1211 FUNCTION xadAddDiskEntry(di : pxadDiskInfo; ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadAddFileEntrynull1212 FUNCTION xadAddFileEntry(fi : pxadFileInfo; ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadAllocObjectnull1213 FUNCTION xadAllocObject(_type : LONGINT; const tags : array of PtrUInt) : POINTER;
xadConvertDatesnull1214 FUNCTION xadConvertDates(const tags : array of PtrUInt) : LONGINT;
xadConvertNamenull1215 FUNCTION xadConvertName(charset : longword; const tags : array of PtrUInt) : pCHAR;
xadConvertProtectionnull1216 FUNCTION xadConvertProtection(const tags : array of PtrUInt) : LONGINT;
xadDiskFileUnArcnull1217 FUNCTION xadDiskFileUnArc(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadDiskUnArcnull1218 FUNCTION xadDiskUnArc(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadFileUnArcnull1219 FUNCTION xadFileUnArc(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadFreeHookAccessnull1220 FUNCTION xadFreeHookAccess(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1221 PROCEDURE xadFreeObject(obj : POINTER; const tags : array of PtrUInt);
xadGetDiskInfonull1222 FUNCTION xadGetDiskInfo(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadGetFilenamenull1223 FUNCTION xadGetFilename(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; const tags : array of PtrUInt) : LONGINT;
xadGetHookAccessnull1224 FUNCTION xadGetHookAccess(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadGetInfonull1225 FUNCTION xadGetInfo(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadHookTagAccessnull1226 FUNCTION xadHookTagAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
xadRecogFilenull1227 FUNCTION xadRecogFile(size : longword; memory : POINTER; const tags : array of PtrUInt) : pxadClient;
1228 
1229 IMPLEMENTATION
1230 
1231 {
1232  Functions and procedures with array of PtrUInt go here
1233 }
xadAddDiskEntrynull1234 FUNCTION xadAddDiskEntry(di : pxadDiskInfo; ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1235 begin
1236     xadAddDiskEntry := xadAddDiskEntryA(di , ai , @tags);
1237 end;
1238 
xadAddFileEntrynull1239 FUNCTION xadAddFileEntry(fi : pxadFileInfo; ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1240 begin
1241     xadAddFileEntry := xadAddFileEntryA(fi , ai , @tags);
1242 end;
1243 
xadAllocObjectnull1244 FUNCTION xadAllocObject(_type : LONGINT; const tags : array of PtrUInt) : POINTER;
1245 begin
1246     xadAllocObject := xadAllocObjectA(_type , @tags);
1247 end;
1248 
xadConvertDatesnull1249 FUNCTION xadConvertDates(const tags : array of PtrUInt) : LONGINT;
1250 begin
1251     xadConvertDates := xadConvertDatesA(@tags);
1252 end;
1253 
xadConvertNamenull1254 FUNCTION xadConvertName(charset : longword; const tags : array of PtrUInt) : pCHAR;
1255 begin
1256     xadConvertName := xadConvertNameA(charset , @tags);
1257 end;
1258 
xadConvertProtectionnull1259 FUNCTION xadConvertProtection(const tags : array of PtrUInt) : LONGINT;
1260 begin
1261     xadConvertProtection := xadConvertProtectionA(@tags);
1262 end;
1263 
xadDiskFileUnArcnull1264 FUNCTION xadDiskFileUnArc(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1265 begin
1266     xadDiskFileUnArc := xadDiskFileUnArcA(ai , @tags);
1267 end;
1268 
xadDiskUnArcnull1269 FUNCTION xadDiskUnArc(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1270 begin
1271     xadDiskUnArc := xadDiskUnArcA(ai , @tags);
1272 end;
1273 
xadFileUnArcnull1274 FUNCTION xadFileUnArc(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1275 begin
1276     xadFileUnArc := xadFileUnArcA(ai , @tags);
1277 end;
1278 
xadFreeHookAccessnull1279 FUNCTION xadFreeHookAccess(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1280 begin
1281     xadFreeHookAccess := xadFreeHookAccessA(ai , @tags);
1282 end;
1283 
1284 PROCEDURE xadFreeObject(obj : POINTER; const tags : array of PtrUInt);
1285 begin
1286     xadFreeObjectA(obj , @tags);
1287 end;
1288 
xadGetDiskInfonull1289 FUNCTION xadGetDiskInfo(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1290 begin
1291     xadGetDiskInfo := xadGetDiskInfoA(ai , @tags);
1292 end;
1293 
xadGetFilenamenull1294 FUNCTION xadGetFilename(buffersize : longword; buffer : pCHAR; path : pCHAR; name : pCHAR; const tags : array of PtrUInt) : LONGINT;
1295 begin
1296     xadGetFilename := xadGetFilenameA(buffersize , buffer , path , name , @tags);
1297 end;
1298 
xadGetHookAccessnull1299 FUNCTION xadGetHookAccess(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1300 begin
1301     xadGetHookAccess := xadGetHookAccessA(ai , @tags);
1302 end;
1303 
xadGetInfonull1304 FUNCTION xadGetInfo(ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1305 begin
1306     xadGetInfo := xadGetInfoA(ai , @tags);
1307 end;
1308 
xadHookTagAccessnull1309 FUNCTION xadHookTagAccess(command : longword; data : LONGINT; buffer : POINTER; ai : pxadArchiveInfo; const tags : array of PtrUInt) : LONGINT;
1310 begin
1311     xadHookTagAccess := xadHookTagAccessA(command , data , buffer , ai , @tags);
1312 end;
1313 
xadRecogFilenull1314 FUNCTION xadRecogFile(size : longword; memory : POINTER; const tags : array of PtrUInt) : pxadClient;
1315 begin
1316     xadRecogFile := xadRecogFileA(size , memory , @tags);
1317 end;
1318 
1319 const
1320     { Change VERSION and LIBVERSION to proper values }
1321     VERSION : string[2] = '0';
1322     LIBVERSION : longword = 0;
1323 
1324 initialization
1325   xadMasterBase := pxadMasterBase(OpenLibrary(XADMASTERNAME,LIBVERSION));
1326 finalization
1327   if Assigned(xadMasterBase) then
1328     CloseLibrary(pLibrary(xadMasterBase));
1329 END. (* UNIT XADMASTER *)
1330